(add-branch-node {:com.wsscode.pathom.connect.planner/keys [root] :as graph}
{:com.wsscode.pathom.connect.planner/keys [branch-type]
:as env}
{:com.wsscode.pathom.connect.planner/keys [node-id]})
Given a branch node is the root, this function will add the new node as part of that branch node. If the node is a repeating dynamic node it will cause the new node to be collapsed into the already existent dynamic node.
Given a branch node is the root, this function will add the new node as part of that branch node. If the node is a repeating dynamic node it will cause the new node to be collapsed into the already existent dynamic node.
(add-node-log graph node-id event)
Add a new log entry to the node, this is similar to how tracing works, but these are internal logs about events for that specific node.
Add a new log entry to the node, this is similar to how tracing works, but these are internal logs about events for that specific node.
(add-unreachable-attr graph attr)
Add attribute to unreachable list
Add attribute to unreachable list
(all-attribute-resolvers {:com.wsscode.pathom.connect/keys [index-oir]} attr)
(all-node-ids graph)
Return all node-ids from the graph.
Return all node-ids from the graph.
(assoc-node graph node-id k v)
Set property k about node-id. Only assoc when node exists, otherwise its a noop.
Set property k about node-id. Only assoc when node exists, otherwise its a noop.
(collapse-and-nodes graph target-node-id node-id)
Collapse AND node next-node into AND node target-node-id.
Collapse AND node next-node into AND node target-node-id.
(collapse-nodes-chain graph target-node-id node-id)
Merge chained nodes:
A -> B
A is target node, B is the node, this collapses things and only A will exist after.
Merge chained nodes: A -> B A is target node, B is the node, this collapses things and only A will exist after.
(collapse-set-node-run-next graph target-node-id run-next)
Like set-node-run-next, but also checks if the target and next node are the same resolver, if so, this fn will collapse those nodes.
Like set-node-run-next, but also checks if the target and next node are the same resolver, if so, this fn will collapse those nodes.
(collect-syms graph env node)
(collect-syms graph
env
{:com.wsscode.pathom.connect.planner/keys [node-id]}
syms)
(compute-all-node-depths graph)
Return graph with node-depth calculated for all nodes.
Return graph with node-depth calculated for all nodes.
(compute-attribute-graph
{:com.wsscode.pathom.connect.planner/keys [unreachable-attrs] :as graph}
{:com.wsscode.pathom.connect.planner/keys [available-data attr-deps-trail]
:com.wsscode.pathom.connect/keys [index-oir]
{attr :key} :edn-query-language.ast/node
:as env})
Compute the run graph for a given attribute.
Compute the run graph for a given attribute.
(compute-attribute-graph*
{:com.wsscode.pathom.connect.planner/keys [root] :as graph}
{:com.wsscode.pathom.connect/keys [index-oir attribute] :as env})
(compute-input-resolvers-graph
graph
{:com.wsscode.pathom.connect.planner/keys [available-data] :as env}
inputs
resolvers)
(compute-missing-chain graph
{:com.wsscode.pathom.connect.planner/keys
[graph-before-missing-chain]
:as env}
missing)
Start a recursive call to process the dependencies required by the resolver. It sets the ::run-next data at the env, it will be used to link the nodes after they are created in the process.
Start a recursive call to process the dependencies required by the resolver. It sets the ::run-next data at the env, it will be used to link the nodes after they are created in the process.
(compute-nested-node-details {ast :edn-query-language.ast/node :as env})
Use AST children nodes and resolver provides data to compute the nested requirements for dynamic nodes.
Use AST children nodes and resolver provides data to compute the nested requirements for dynamic nodes.
(compute-node-depth graph node-id)
Calculate depth of node-id, this returns a graph in which that node has the key ::node-depth associated in the node. The depth is calculated by following the ::after-nodes chain, in the process all the parent node depths are also calculated and set, this makes it efficient to scan the list calculating the depths, given each node will be visited at max once.
Calculate depth of node-id, this returns a graph in which that node has the key ::node-depth associated in the node. The depth is calculated by following the ::after-nodes chain, in the process all the parent node depths are also calculated and set, this makes it efficient to scan the list calculating the depths, given each node will be visited at max once.
(compute-resolver-graph
{:com.wsscode.pathom.connect.planner/keys [unreachable-syms] :as graph}
env
resolver)
(compute-root-and {:com.wsscode.pathom.connect.planner/keys [root] :as graph}
env
{:com.wsscode.pathom.connect.planner/keys [node-id] :as node})
(compute-root-branch {:com.wsscode.pathom.connect.planner/keys [root] :as graph}
{:com.wsscode.pathom.connect.planner/keys [branch-type]
:as env}
{:com.wsscode.pathom.connect.planner/keys [node-id]}
branch-node-factory)
(compute-root-or {:com.wsscode.pathom.connect.planner/keys [root] :as graph}
{:com.wsscode.pathom.connect/keys [attribute] :as env}
{:com.wsscode.pathom.connect.planner/keys [node-id] :as node})
(compute-run-graph env)
(compute-run-graph graph env)
Generates a run plan for a given environment, the environment should contain the indexes in it (::pc/index-oir and ::pc/index-resolvers). It computes a plan to execute one level of an AST, the AST must be provided via the key :edn-query-language.ast/node.
(compute-run-graph (assoc indexes :edn-query-language.ast/node ...))
The resulting graph will look like this:
::nodes {1 {::node-id 1}}
Generates a run plan for a given environment, the environment should contain the indexes in it (::pc/index-oir and ::pc/index-resolvers). It computes a plan to execute one level of an AST, the AST must be provided via the key :edn-query-language.ast/node. (compute-run-graph (assoc indexes :edn-query-language.ast/node ...)) The resulting graph will look like this: ::nodes {1 {::node-id 1}}
(create-branch-node {:com.wsscode.pathom.connect.planner/keys [root] :as graph}
env
node
branch-node)
(create-resolver-node graph
{:com.wsscode.pathom.connect.planner/keys [run-next input
source-sym]
:com.wsscode.pathom.connect/keys [attribute sym]
ast :edn-query-language.ast/node
:as env})
Create a new node representative to run a given resolver.
Create a new node representative to run a given resolver.
(direct-node-successors {:com.wsscode.pathom.connect.planner/keys [run-next]
:as node})
Direct successors of node, branch nodes and run-next, in case of branch nodes the branches will always come before the run-next.
Direct successors of node, branch nodes and run-next, in case of branch nodes the branches will always come before the run-next.
(dynamic-resolver? {:com.wsscode.pathom.connect/keys [index-resolvers]} sym)
(find-attribute-resolver-in-successors graph node-id attribute)
Find the nodes that get the data required for the require in the OR node.
Find the nodes that get the data required for the require in the OR node.
(find-branch-node-to-merge
{:com.wsscode.pathom.connect.planner/keys [root] :as graph}
{:com.wsscode.pathom.connect.planner/keys [branch-type]}
{:com.wsscode.pathom.connect.planner/keys [node-id]})
Given some branch node, tries to find a node with a dynamic resolver that's the same sym as the node in node-id.
Given some branch node, tries to find a node with a dynamic resolver that's the same sym as the node in node-id.
(find-first-ancestor graph node-id)
Traverse node after-node chain and returns the most distant resolver ancestor node id. This only walks though resolver nodes, branch nodes are removed.
Traverse node after-node chain and returns the most distant resolver ancestor node id. This only walks though resolver nodes, branch nodes are removed.
(find-missing-ancestor graph missing)
Find the first common AND node ancestors from missing list, missing is a list of attributes
Find the first common AND node ancestors from missing list, missing is a list of attributes
(first-common-ancestor graph node-ids)
Find first common node ancestor given a list of node ids.
Find first common node ancestor given a list of node ids.
(get-attribute-node graph attribute)
Find the node for attribute in attribute index.
Find the node for attribute in attribute index.
(graph-provides {:com.wsscode.pathom.connect.planner/keys [index-attrs]})
Get a set with all provided attributes from the graph.
Get a set with all provided attributes from the graph.
(include-node graph
_env
{:com.wsscode.pathom.connect.planner/keys [node-id] :as node})
(inject-index-nested-provides indexes
{:com.wsscode.pathom.connect/keys [attribute sym]
:as env})
(integrate-node-log {:com.wsscode.pathom.connect.planner/keys [node-trace]
:as node})
Pulls the events from ::node-trace to the node itself, this will use the name from ::pt/event on each trace event and make it part of the node itself.
Note that in case of repeated events, only the last one will be kept.
Pulls the events from ::node-trace to the node itself, this will use the name from ::pt/event on each trace event and make it part of the node itself. Note that in case of repeated events, only the last one will be kept.
(mark-node-unreachable previous-graph
graph
{:com.wsscode.pathom.connect.planner/keys
[unreachable-syms unreachable-attrs]}
env)
(merge-node-input graph
target-node-id
{:com.wsscode.pathom.connect.planner/keys [input]})
Merge input from node into target-node-id.
Merge input from node into target-node-id.
(merge-node-requires graph
target-node-id
{:com.wsscode.pathom.connect.planner/keys [requires]})
Merge requires from node into target-node-id.
Merge requires from node into target-node-id.
(merge-nodes-foreign-ast graph
target-node-id
{:com.wsscode.pathom.connect.planner/keys
[foreign-ast]})
Merge the foreign-ast from two dynamic nodes, the operations adds each children from node into foreign-ast of the target node. This uses the requires to detect if some property is already on the query, so this must be called before merging requires to get the correct behavior.
Merge the foreign-ast from two dynamic nodes, the operations adds each children from node into foreign-ast of the target node. This uses the requires to detect if some property is already on the query, so this must be called before merging requires to get the correct behavior.
(merge-nodes-params graph
target-node-id
{:com.wsscode.pathom.connect.planner/keys [params]})
Merge params of nodes, in case of conflicting keys a warning will be generated.
Merge params of nodes, in case of conflicting keys a warning will be generated.
(merge-nodes-run-next {:com.wsscode.pathom.connect.planner/keys [root]
:as graph}
env
target-node-id
{:com.wsscode.pathom.connect.planner/keys [run-next]})
Updates target-node-id run-next with the run-next of the last argument. This will do an AND branch operation with node-id run-next and run-next, updating the reference of node-id run-next.
Updates target-node-id run-next with the run-next of the last argument. This will do an AND branch operation with node-id run-next and run-next, updating the reference of node-id run-next.
(next-node-id {:com.wsscode.pathom.connect.planner/keys [id-counter]})
Return the next node ID in the system, its an incremental number
Return the next node ID in the system, its an incremental number
(node->label node)
Return a string representation for the node, for resolver nodes this is the symbol, branch nodes get AND / OR respectively.
Return a string representation for the node, for resolver nodes this is the symbol, branch nodes get AND / OR respectively.
(node-ancestors graph node-id)
Return all node ancestors. The order of the output will go from closest to farthest nodes, like breathing out of the current node.
Return all node ancestors. The order of the output will go from closest to farthest nodes, like breathing out of the current node.
(node-depth graph node-id)
Compute the depth for node-id and return it.
Compute the depth for node-id and return it.
(node-direct-ancestor-chain graph node-id)
Computes ancestor chain for a given node, it only walks as long as there is a single parent on the node, if there is a fork (multiple after-nodes) it will stop.
Computes ancestor chain for a given node, it only walks as long as there is a single parent on the node, if there is a fork (multiple after-nodes) it will stop.
(node-for-attribute-in-chain graph
{:com.wsscode.pathom.connect/keys [attribute]
:as env}
root)
Walks the graph run next chain until it finds the node that's providing the attribute.
Walks the graph run next chain until it finds the node that's providing the attribute.
(node-kind node)
Return a keyword describing the type of the node.
Return a keyword describing the type of the node.
(node-successors graph node-id)
Find successor nodes of node-id, node-id is included in the list. This will add branch nodes before run-next nodes. Returns a lazy sequence that traverse the graph as items are requested.
Find successor nodes of node-id, node-id is included in the list. This will add branch nodes before run-next nodes. Returns a lazy sequence that traverse the graph as items are requested.
(optimize-merge? graph {:com.wsscode.pathom.connect.planner/keys [node-id]})
Check if node and graph point to same run-next.
Check if node and graph point to same run-next.
(params-conflicting-keys m1 m2)
Find conflicting keys between maps m1 and m2, same keys with same values are not considered conflicting keys.
Find conflicting keys between maps m1 and m2, same keys with same values are not considered conflicting keys.
(prepare-ast env ast)
Prepare AST from query. This will lift placeholder nodes, convert query to AST and remove children keys that are already present in the current entity.
Prepare AST from query. This will lift placeholder nodes, convert query to AST and remove children keys that are already present in the current entity.
(previous-node-depth graph current-node-id previous-node-id)
Get previous node depth, normally it uses the ::node-depth of previous node. There is a special case, when the previous node is a branch node and the current node is the run-next of the previous, in this case the previous depth should return the node chain depth instead, so the depth of the run-next goes after the branch dependencies.
Get previous node depth, normally it uses the ::node-depth of previous node. There is a special case, when the previous node is a branch node and the current node is the run-next of the previous, in this case the previous depth should return the node chain depth instead, so the depth of the run-next goes after the branch dependencies.
(remove-branch-node-after-nodes graph node-id)
When node-id is a branch node, remove all after-nodes associated from its children.
When node-id is a branch node, remove all after-nodes associated from its children.
(remove-node graph node-id)
Remove a node from the graph. In case of resolver nodes it also removes them from the ::index-syms and after node references.
Remove a node from the graph. In case of resolver nodes it also removes them from the ::index-syms and after node references.
(resolver-node-requires-attribute? {:com.wsscode.pathom.connect.planner/keys
[requires sym]}
attribute)
(resolver-provides {:com.wsscode.pathom.connect/keys [index-resolvers]
:com.wsscode.pathom.connect.planner/keys [source-sym]})
Get resolver provides from environment source symbol.
Get resolver provides from environment source symbol.
(root-execution-node? graph node-id)
A node is a root execution is a node without any ancestors, or all ancestors are branch nodes.
A node is a root execution is a node without any ancestors, or all ancestors are branch nodes.
(runner-node-sym {:com.wsscode.pathom.connect/keys [index-resolvers]} sym)
Find the runner symbol for a resolver, on normal resolvers that is the resolver symbol, but for foreign resolvers it uses its ::pc/dynamic-sym.
Find the runner symbol for a resolver, on normal resolvers that is the resolver symbol, but for foreign resolvers it uses its ::pc/dynamic-sym.
(same-resolver? node1 node2)
Check if node1 and node2 have the same resolver name.
Check if node1 and node2 have the same resolver name.
(set-node-run-next graph target-node-id run-next)
Set the node run next value and add the after-node counter part. Noop if target and run next are the same node.
Set the node run next value and add the after-node counter part. Noop if target and run next are the same node.
(set-node-run-next* graph node-id run-next)
Update the node-id run-next value, if run-next is nil the property will be removed from the map.
Update the node-id run-next value, if run-next is nil the property will be removed from the map.
(set-node-source-for-attrs graph
{:com.wsscode.pathom.connect/keys [attribute]
:as env})
(transfer-node-after-nodes graph
target-node-id
{:com.wsscode.pathom.connect.planner/keys
[after-nodes]})
Set the run next for each after node to be target-node-id.
Set the run next for each after node to be target-node-id.
(transfer-node-source-attrs graph
target-node-id
{:com.wsscode.pathom.connect.planner/keys
[source-for-attrs]})
Pulls source for attributes from node to target-node-id, also updates the attributes index to respect the transfer.
Pulls source for attributes from node to target-node-id, also updates the attributes index to respect the transfer.
(update-node graph node-id k f)
(update-node graph node-id k f v)
(update-node graph node-id k f v v2)
(update-node graph node-id k f v v2 v3)
(update-node graph node-id k f v v2 v3 & args)
Update a given node in a graph, like Clojure native update.
Update a given node in a graph, like Clojure native update.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close