(ast-key-id ast)
DEPRECATED: use ident-value instead
DEPRECATED: use ident-value instead
(ast-properties {:keys [children]})
Takes an AST and return a single set with all properties that appear in a query.
Example:
(-> [:foo {:bar [:baz]}] eql/query->ast pc/all-out-attributes) ; => #{:foo :bar :baz}
Takes an AST and return a single set with all properties that appear in a query. Example: (-> [:foo {:bar [:baz]}] eql/query->ast pc/all-out-attributes) ; => #{:foo :bar :baz}
(async-parser settings)
Create a new pathom async parser, this parser is serial and capable of waiting for core.async to continue processing, allowing async operations to happen during the parsing.
Options to tune the parser:
::p/env - Use this key to provide a default environment for the parser. This is a sugar to use the p/env-plugin.
::p/mutate - A mutate function that will be called to run mutations, this function must have the signature: (mutate env key params)
::p/plugins - A vector with plugins.
Create a new pathom async parser, this parser is serial and capable of waiting for core.async to continue processing, allowing async operations to happen during the parsing. Options to tune the parser: ::p/env - Use this key to provide a default environment for the parser. This is a sugar to use the p/env-plugin. ::p/mutate - A mutate function that will be called to run mutations, this function must have the signature: (mutate env key params) ::p/plugins - A vector with plugins.
(cached-async
{:com.wsscode.pathom.core/keys [async-request-cache-ch request-cache] :as env}
key
f)
(elide-ast-nodes {:keys [key union-key] :as ast} elision-set)
Remove items from a query (AST) that have a key listed in the elision-set
Remove items from a query (AST) that have a key listed in the elision-set
(elide-items item-set input)
Removes any item on set item-set from the input
Removes any item on set item-set from the input
(elide-not-found input)
Convert all ::p/not-found values of maps to nil
Convert all ::p/not-found values of maps to nil
(entity env)
(entity {:keys [parser] :as env} attributes)
Fetch the entity according to the ::entity-key. If the entity is an IAtom, it will be derefed.
If a second argument is sent, calls the parser against current element to guarantee that some fields are loaded. This is useful when you need to ensure some values are loaded in order to fetch some more complex data. NOTE: When using this call with an explicit vector of attributes the parser will not be invoked for attributes that already exist in the current value of the current entity.
Fetch the entity according to the ::entity-key. If the entity is an IAtom, it will be derefed. If a second argument is sent, calls the parser against current element to guarantee that some fields are loaded. This is useful when you need to ensure some values are loaded in order to fetch some more complex data. NOTE: When using this call with an explicit vector of attributes the parser will not be invoked for attributes that already exist in the current value of the current entity.
(entity-attr env attr)
(entity-attr env attr default)
Helper function to fetch a single attribute from current entity.
Helper function to fetch a single attribute from current entity.
(entity-attr! env attr)
Like entity-attr. Raises an exception if the property can't be retrieved.
Like entity-attr. Raises an exception if the property can't be retrieved.
(entity-dispatch {:keys [ast]})
Dispatch on the first element (type) of an incoming ident.
Dispatch on the first element (type) of an incoming ident.
(entity-value-merge x y)
This is used for merging new parsed attributes from entity, works like regular merge but if the value from the right direction is not found, then the previous value will be kept.
This is used for merging new parsed attributes from entity, works like regular merge but if the value from the right direction is not found, then the previous value will be kept.
(env-placeholder-reader {:com.wsscode.pathom.core/keys [placeholder-prefixes]
:as env})
Produces a reader that will respond to any keyword whose namespace
is in the set (::placeholder-prefixes env)
. The join node logical
level stays the same as the parent where the placeholder node is
requested.
Produces a reader that will respond to any keyword whose namespace is in the set `(::placeholder-prefixes env)`. The join node logical level stays the same as the parent where the placeholder node is requested.
(env-wrap-plugin extra-env-wrapper)
This plugin receives a function that will be called to wrap the current enviroment each time the main parser is called (parser level).
This plugin receives a function that will be called to wrap the current enviroment each time the main parser is called (parser level).
(ident-join-reader env)
This reader will join on any ident join, the entity for the join will be a map containing the same key and value expressed on the ident, eg: [{[:id 123] [:id]}], the join entry will be {:id 123}.
This reader will join on any ident join, the entity for the join will be a map containing the same key and value expressed on the ident, eg: [{[:id 123] [:id]}], the join entry will be {:id 123}.
(ident-key {:keys [ast]})
The first element of an ident.
The first element of an ident.
(ident-value {:keys [ast]})
The second element of an ident
The second element of an ident
(join {:keys [parser ast query]
:com.wsscode.pathom.core/keys [union-path parent-query
processing-sequence placeholder-prefixes]
:as env})
(join entity
{:keys [ast query] :com.wsscode.pathom.core/keys [entity-key] :as env})
Runs a parser with current sub-query. When run with an entity
argument, that entity is set as the new environment
value of ::entity
, and the subquery is parsed with that new environment. When run without an entity
it
parses the current subquery in the context of whatever entity was already in ::entity
of the env.
Runs a parser with current sub-query. When run with an `entity` argument, that entity is set as the new environment value of `::entity`, and the subquery is parsed with that new environment. When run without an `entity` it parses the current subquery in the context of whatever entity was already in `::entity` of the env.
(join-seq {:com.wsscode.pathom.parser/keys [parallel?] :as env} coll)
Runs the current subquery against the items of the given collection.
Runs the current subquery against the items of the given collection.
(join-seq-parallel {:keys [query]
:com.wsscode.pathom.core/keys [entity-path-cache
parent-query]
:as env}
coll)
(js-obj-reader {:keys [query ast]
:com.wsscode.pathom.core/keys [js-key-transform
js-value-transform entity-key]
:as env
:or {js-key-transform name js-value-transform (fn [_ v] v)}})
Like map-reader*, but handles plain Javascript objects instead of Clojure maps.
Like map-reader*, but handles plain Javascript objects instead of Clojure maps.
(lift-placeholders {:com.wsscode.pathom.core/keys [placeholder-prefixes]} query)
This will lift the queries from placeholders to the same level of the query, as if there was not placeholders in it.
This will lift the queries from placeholders to the same level of the query, as if there was not placeholders in it.
(map-reader {:keys [ast query] :as env})
Map reader will try to find the ast key on the current entity and output it. When the value is a map and a sub query is present, it will apply the sub query on that value (recursively). When the value is a sequence, map-reader will do a join on each of the items (and apply sub queries if it's present and values are maps.
Map-reader will defer the read when the key is not present at entity.
Map reader will try to find the ast key on the current entity and output it. When the value is a map and a sub query is present, it will apply the sub query on that value (recursively). When the value is a sequence, map-reader will do a join on each of the items (and apply sub queries if it's present and values are maps. Map-reader will defer the read when the key is not present at entity.
(map-reader* {:com.wsscode.pathom.core/keys [map-key-transform
map-value-transform]})
Like map-reader, but it has extra options (read from the environment): map-key-transform: (fn [key]) will transform the key on the AST before trying to match with entity key map-value-transform: (fn [key value]) will transform the output value after reading from the entity.
The reason to have a separated reader is so the plain version (map-reader) can be faster by avoiding checking the presence of transform functions.
Like map-reader, but it has extra options (read from the environment): map-key-transform: (fn [key]) will transform the key on the AST before trying to match with entity key map-value-transform: (fn [key value]) will transform the output value after reading from the entity. The reason to have a separated reader is so the plain version (map-reader) can be faster by avoiding checking the presence of transform functions.
(map-select map selection)
Starting from a map, do a EQL selection on that map. Think of this function as
a power up version of select-keys, but supporting nested selections and placeholders
using the default >
namespace.
Example: (p/map-select {:foo "bar" :deep {:a 1 :b 2}} [{:deep [:a]}]) => {:deep {:a 1}}
Starting from a map, do a EQL selection on that map. Think of this function as a power up version of select-keys, but supporting nested selections and placeholders using the default `>` namespace. Example: (p/map-select {:foo "bar" :deep {:a 1 :b 2}} [{:deep [:a]}]) => {:deep {:a 1}}
(normalize-query-variables query)
Converts ident values and param values to ::p/var.
Converts ident values and param values to ::p/var.
(parallel-parser settings)
Create a new pathom parallel parser, this parser is capable of coordinating parallel data fetch. This also works as an async parser and will handle core async channels properly.
Options to tune the parser:
::p/env - Use this key to provide a default environment for the parser. This is a sugar to use the p/env-plugin.
::p/mutate - A mutate function that will be called to run mutations, this function must have the signature: (mutate env key params)
::p/plugins - A vector with plugins.
::p/async-request-cache-ch-size - Pathom uses internally a queue to avoid concurrency issues with concurrency, each request gets its own channel, so you can consider this size needs to accommodate the max parallelism for a single query. Default: 1024
::pp/external-wait-ignore-timeout - Sometimes external waits get stuck because a concurrency problem, this timeout will ignore external waits after some time so the request can go on. Default: 3000
::pp/max-key-iterations - there is a loop that happens when processing attributes in parallel, this loop will cause multiple iterations to happen in order for a single attribute to be processed, but in some conditions this loop can go indefinitely, to prevent this situation this option allows to control the max number of iterations, after that it will give up on processing that attribute. Default: 10
::pp/key-process-timeout - Max time allowed to run the full query. This is a cascading timeout, the first level will have the total amount. Default: 60000
::pp/processing-recheck-timer - Periodic time to run a checker to verify no parts are stuck during the processing, when nil the feature is disabled. Default: nil
Create a new pathom parallel parser, this parser is capable of coordinating parallel data fetch. This also works as an async parser and will handle core async channels properly. Options to tune the parser: ::p/env - Use this key to provide a default environment for the parser. This is a sugar to use the p/env-plugin. ::p/mutate - A mutate function that will be called to run mutations, this function must have the signature: (mutate env key params) ::p/plugins - A vector with plugins. ::p/async-request-cache-ch-size - Pathom uses internally a queue to avoid concurrency issues with concurrency, each request gets its own channel, so you can consider this size needs to accommodate the max parallelism for a single query. Default: 1024 ::pp/external-wait-ignore-timeout - Sometimes external waits get stuck because a concurrency problem, this timeout will ignore external waits after some time so the request can go on. Default: 3000 ::pp/max-key-iterations - there is a loop that happens when processing attributes in parallel, this loop will cause multiple iterations to happen in order for a single attribute to be processed, but in some conditions this loop can go indefinitely, to prevent this situation this option allows to control the max number of iterations, after that it will give up on processing that attribute. Default: 10 ::pp/key-process-timeout - Max time allowed to run the full query. This is a cascading timeout, the first level will have the total amount. Default: 60000 ::pp/processing-recheck-timer - Periodic time to run a checker to verify no parts are stuck during the processing, when nil the feature is disabled. Default: nil
(params env)
Get params from env, always returns a map.
Get params from env, always returns a map.
(parser settings)
Create a new pathom serial parser, this parser is capable of waiting for core.async to continue processing, allowing async operations to happen during the parsing.
Options to tune the parser:
::p/env - Use this key to provide a default environment for the parser. This is a sugar to use the p/env-plugin.
::p/mutate - A mutate function that will be called to run mutations, this function must have the signature: (mutate env key params)
::p/plugins - A vector with plugins.
Create a new pathom serial parser, this parser is capable of waiting for core.async to continue processing, allowing async operations to happen during the parsing. Options to tune the parser: ::p/env - Use this key to provide a default environment for the parser. This is a sugar to use the p/env-plugin. ::p/mutate - A mutate function that will be called to run mutations, this function must have the signature: (mutate env key params) ::p/plugins - A vector with plugins.
(pathom-read {:com.wsscode.pathom.core/keys [reader process-reader] :as env}
_
_)
DEPRECATED: use p/parser to create your parser
DEPRECATED: use p/parser to create your parser
(placeholder-reader)
(placeholder-reader ns)
DEPRECATED: use env-placeholder-reader instead.
Produces a reader that will respond to any keyword with the namespace ns. The join node logical level stays the same as the parent where the placeholder node is requested.
DEPRECATED: use env-placeholder-reader instead. Produces a reader that will respond to any keyword with the namespace ns. The join node logical level stays the same as the parent where the placeholder node is requested.
(post-process-parser-plugin f)
Helper to create a plugin to work on the parser output. f
will run once with the parser final result.
Helper to create a plugin to work on the parser output. `f` will run once with the parser final result.
(pre-process-parser-plugin f)
Helper to create a plugin that can view/modify the env/tx of a top-level request. f - (fn [{:keys [env tx]}] {:env new-env :tx new-tx}) If the function returns no env or tx, then the parser will not be called (aborts the parse)
Helper to create a plugin that can view/modify the env/tx of a top-level request. f - (fn [{:keys [env tx]}] {:env new-env :tx new-tx}) If the function returns no env or tx, then the parser will not be called (aborts the parse)
(query->ast query-expr)
Given a query expression convert it into an AST.
Given a query expression convert it into an AST.
(query->ast1 query-expr)
Call query->ast and return the first children.
Call query->ast and return the first children.
(query-id query)
Generates a consistent hash from the query. The query first goes to a process to remove any variables from idents and params, then we get the Clojure hash of it. You can use this to save information about a query that can be used to correlate with the query later.
Generates a consistent hash from the query. The query first goes to a process to remove any variables from idents and params, then we get the Clojure hash of it. You can use this to save information about a query that can be used to correlate with the query later.
(raise-response resp)
Mutations running through a parser all come back in a map like this {'my/mutation {:result {...}}}. This function converts that to {'my/mutation {...}}. Copied from fulcro.server.
Mutations running through a parser all come back in a map like this {'my/mutation {:result {...}}}. This function converts that to {'my/mutation {...}}. Copied from fulcro.server.
(read-from env reader)
Runs the read process for the reading, the reader can be a function, a vector or a map:
function: will receive the environment as argument map: will dispatch from the ast key to a reader on the map value vector: will try to run each reader in sequence, when a reader returns ::p/continue it will try the next
Runs the read process for the reading, the reader can be a function, a vector or a map: function: will receive the environment as argument map: will dispatch from the ast key to a reader on the map value vector: will try to run each reader in sequence, when a reader returns ::p/continue it will try the next
DEPRECATED not required anymore, this was integrated in the main engine.
DEPRECATED not required anymore, this was integrated in the main engine.
(swap-entity! env fn & args)
Helper to swap the current entity value.
Helper to swap the current entity value.
(transduce-children xform {:keys [children] :as node})
Recursivelly transduce children on the AST, you can use this to apply filter/transformations on a whole AST. Each iteration of the transducer will get a single AST node to process.
(->> [:a {:b [:c :d]} :e]
(p/query->ast)
(p/transduce-children (remove (comp #{:a :c} :key)))
(p/ast->query))
; => [{:b [:d]} :e]
Recursivelly transduce children on the AST, you can use this to apply filter/transformations on a whole AST. Each iteration of the transducer will get a single AST node to process. ``` (->> [:a {:b [:c :d]} :e] (p/query->ast) (p/transduce-children (remove (comp #{:a :c} :key))) (p/ast->query)) ; => [{:b [:d]} :e] ```
(transduce-maps xform input)
Walk the structure and transduce every map with xform.
Walk the structure and transduce every map with xform.
(union-children? ast)
Given an AST point, check if the children is a union query type.
Given an AST point, check if the children is a union query type.
(update-action m f)
Helper function to update a mutation action.
Helper function to update a mutation action.
(update-attribute-param x f & args)
Add attribute param, eg:
(p/update-attribute-param :keyword assoc :foo "bar") => (:keyword {:foo "bar"})
(p/update-attribute-param '(:keyword {:param "prev"}) assoc :foo "bar") => (:keyword {:foo "bar" :param "prev"})
Add attribute param, eg: ``` (p/update-attribute-param :keyword assoc :foo "bar") => (:keyword {:foo "bar"}) (p/update-attribute-param '(:keyword {:param "prev"}) assoc :foo "bar") => (:keyword {:foo "bar" :param "prev"}) ```
(update-child ast key & args)
Given an AST, find the child with a given key and run update against it.
Given an AST, find the child with a given key and run update against it.
(update-recursive-depth ast key & args)
Given an AST, find the child with a given key and run update against it.
Given an AST, find the child with a given key and run update against it.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close