Liking cljdoc? Tell your friends :D
All platforms.

com.wsscode.pathom3.connect.planner


add-branch-to-nodeclj/s

(add-branch-to-node graph target-node-id branch-type new-branch-node-id)
source

add-ident-processclj/s

(add-ident-process graph {:keys [key]})
source

add-node-branchesclj/s

(add-node-branches graph target-node-id branch-type node-ids)
source

add-node-parentclj/s

(add-node-parent graph node-id node-parent-id)
source

add-placeholder-entryclj/s

(add-placeholder-entry graph attr)
source

add-snapshot!clj/s

(add-snapshot! graph
               {:com.wsscode.pathom3.connect.planner/keys [snapshots*
                                                           snapshot-depth]}
               event-details)
source

add-unreachable-pathclj/s

(add-unreachable-path graph env path)

Add attribute to unreachable list

Add attribute to unreachable list
sourceraw docstring

add-warningclj/s

(add-warning graph warn)
source

assoc-nodeclj/s

(assoc-node graph node-id k v)

Set attribute k about node-id. Only assoc when node exists, otherwise its a noop.

Set attribute k about node-id. Only assoc when node exists, otherwise its a noop.
sourceraw docstring

base-envclj/s

(base-env)
source

base-graphclj/s

(base-graph)
source

branch-node?clj/s

(branch-node? node)

Returns true when the node is a branch node type.

Returns true when the node is a branch node type.
sourceraw docstring

can-merge-sibling-resolver-nodes?clj/s

(can-merge-sibling-resolver-nodes? graph node-id1 node-id2)
source

combine-expectsclj/s

(combine-expects na nb)
source

combine-foreign-astclj/s

(combine-foreign-ast na nb)
source

combine-inputsclj/s

(combine-inputs na nb)
source

combine-run-nextclj/s

(combine-run-next graph env node-ids pivot)
source

compute-attribute-dependency-graphclj/s

(compute-attribute-dependency-graph
  graph
  {:com.wsscode.pathom3.connect.planner/keys [recursive-joins] :as env}
  attr
  shape)
source

compute-attribute-graphclj/s

(compute-attribute-graph
  {:com.wsscode.pathom3.connect.planner/keys [unreachable-paths] :as graph}
  {:com.wsscode.pathom3.connect.planner/keys [attr-deps-trail]
   :com.wsscode.pathom3.connect.indexes/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.
sourceraw docstring

compute-attribute-graph*clj/s

(compute-attribute-graph* graph
                          {:com.wsscode.pathom3.connect.indexes/keys [index-oir]
                           :com.wsscode.pathom3.attribute/keys [attribute]
                           :as env})

Traverse the attribute options, for example, considering we are processing the attribute :a. And we have this index:

{::pci/index-oir {:a {{} #{a}}}}

This means we are now at the {{} #{a}} part, lets call each entry of this map a process path.

To break it down, in this case we have one process path to get :a. Each process pair contains an input shape and a set of resolvers.

You can read it as: I can fetch :a providing the data {} to the resolver a.

A bigger example:

{::pci/index-oir {:a {{:b {}} #{a-from-b}
                      {:c {}} #{a-from-c a-f-c}}}}

In this case we have two process paths.

This function iterates over each process path, if at least one can complete the path, it returns a graph with a root o the node. In case of many options, an OR node will be the root, providing each path.

Traverse the attribute options, for example, considering we are processing the
attribute `:a`. And we have this index:

    {::pci/index-oir {:a {{} #{a}}}}

This means we are now at the `{{} #{a}}` part, lets call each entry of this map a
`process path`.

To break it down, in this case we have one `process path` to get `:a`. Each process
pair contains an input shape and a set of resolvers.

You can read it as: I can fetch `:a` providing the data `{}` to the resolver `a`.

A bigger example:

    {::pci/index-oir {:a {{:b {}} #{a-from-b}
                          {:c {}} #{a-from-c a-f-c}}}}

In this case we have two process paths.

This function iterates over each process path, if at least one can complete the path,
it returns a graph with a root o the node. In case of many options, an OR node will
be the root, providing each path.
sourceraw docstring

compute-attribute-nested-input-requireclj/s

(compute-attribute-nested-input-require graph env attr shape nodes)
source

compute-dynamic-nested-requirementsclj/s

(compute-dynamic-nested-requirements
  {:com.wsscode.pathom3.attribute/keys [attribute]
   :com.wsscode.pathom3.connect.operation/keys [op-name]
   ast :edn-query-language.ast/node
   :as env})

Considering the operation output, find out what a query can extend during nesting.

Pathom uses it to compute the dynamic requirements to send into dynamic resolvers.

This function is a useful tool for developers of custom dynamic resolvers.

Considering the operation output, find out what a query can extend during nesting.

Pathom uses it to compute the dynamic requirements to send into dynamic resolvers.

This function is a useful tool for developers of custom dynamic resolvers.
sourceraw docstring

compute-input-resolvers-graphclj/s

(compute-input-resolvers-graph graph
                               {:com.wsscode.pathom3.connect.planner/keys
                                  [available-data]
                                :com.wsscode.pathom3.attribute/keys [attribute]
                                :as env}
                               input
                               resolvers)

This function computes the graph for a given process path. It creates the resolver nodes to execute the resolvers, in case of many resolvers it uses a OR node to combine them.

Them it fetches the dependencies, declared in the process path. If the dependencies are successfully computed, it returns the graph with the root on the node that fulfills the request.

This function computes the graph for a given `process path`. It creates the resolver
nodes to execute the resolvers, in case of many resolvers it uses a OR node to combine
them.

Them it fetches the dependencies, declared in the process path. If the dependencies
are successfully computed, it returns the graph with the root on the node that
fulfills the request.
sourceraw docstring

compute-missing-chainclj/s

(compute-missing-chain graph env missing missing-optionals)

Start a recursive call to process the dependencies required by the resolver.

Start a recursive call to process the dependencies required by the resolver.
sourceraw docstring

compute-missing-chain-depsclj/s

(compute-missing-chain-deps
  graph
  {:com.wsscode.pathom3.connect.planner/keys [available-data] :as env}
  missing)
source

compute-missing-chain-optional-depsclj/s

(compute-missing-chain-optional-deps
  graph
  {:com.wsscode.pathom3.connect.planner/keys [available-data] :as env}
  opt-missing
  node-map)
source

compute-non-index-attributeclj/s

(compute-non-index-attribute graph
                             {:com.wsscode.pathom3.connect.planner/keys
                                [available-data]
                              {attr :key :as ast} :edn-query-language.ast/node
                              :as env})

This function deals with attributes that are not part of the index execution. The cases here are:

  • EQL idents
  • Previously available data
  • Placeholders
This function deals with attributes that are not part of the index execution. The
cases here are:

- EQL idents
- Previously available data
- Placeholders
sourceraw docstring

compute-plan-snapshotsclj/s

(compute-plan-snapshots env)

Run compute graph capturing snapshots, return the snapshots vector in the end.

Run compute graph capturing snapshots, return the snapshots vector in the end.
sourceraw docstring

compute-resolver-leafclj/s

(compute-resolver-leaf graph
                       {:com.wsscode.pathom3.connect.planner/keys [input]
                        :as env}
                       resolvers)

For a set of resolvers (the R part of OIR index), create one OR node that branches to each option in the set.

For a set of resolvers (the R part of OIR index), create one OR node that branches
to each option in the set.
sourceraw docstring

compute-run-graphclj/s

(compute-run-graph env)
(compute-run-graph graph
                   {:com.wsscode.pathom3.connect.planner/keys [optimize-graph?]
                    :or {optimize-graph? true}
                    :as 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 {::pco/op-name      a
                             ::node-id          1
                             ::requires         {:a {}}
                             ::input            {}
                             ::source-for-attrs #{:a}
                             ::node-parents      #{3}}
                          2 {::pco/op-name      b
                             ::node-id          2
                             ::requires         {:b {}}
                             ::input            {}
                             ::source-for-attrs #{:b}
                             ::node-parents      #{3}}
                          3 {::node-id  3
                             ::requires {:b {} :a {} :c {}}
                             ::run-and  #{2 1 4}}
                          4 {::pco/op-name      c
                             ::node-id          4
                             ::requires         {:c {}}
                             ::input            {}
                             ::source-for-attrs #{:c}
                             ::node-parents      #{3}}}
 ::index-resolver->nodes {a #{1} b #{2} c #{4}}
 ::unreachable-attrs     #{}
 ::index-attrs           {:a #{1} :b #{2} :c #{4}}
 ::root                  3}
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 {::pco/op-name      a
                                 ::node-id          1
                                 ::requires         {:a {}}
                                 ::input            {}
                                 ::source-for-attrs #{:a}
                                 ::node-parents      #{3}}
                              2 {::pco/op-name      b
                                 ::node-id          2
                                 ::requires         {:b {}}
                                 ::input            {}
                                 ::source-for-attrs #{:b}
                                 ::node-parents      #{3}}
                              3 {::node-id  3
                                 ::requires {:b {} :a {} :c {}}
                                 ::run-and  #{2 1 4}}
                              4 {::pco/op-name      c
                                 ::node-id          4
                                 ::requires         {:c {}}
                                 ::input            {}
                                 ::source-for-attrs #{:c}
                                 ::node-parents      #{3}}}
     ::index-resolver->nodes {a #{1} b #{2} c #{4}}
     ::unreachable-attrs     #{}
     ::index-attrs           {:a #{1} :b #{2} :c #{4}}
     ::root                  3}
sourceraw docstring

compute-run-graph*clj/s

(compute-run-graph* graph env)

Starts scanning the AST to plan for each attribute.

Starts scanning the AST to plan for each attribute.
sourceraw docstring

create-andclj/s

(create-and graph env node-ids)
source

create-node-for-resolver-callclj/s

(create-node-for-resolver-call
  {:com.wsscode.pathom3.connect.planner/keys [input]
   :com.wsscode.pathom3.attribute/keys [attribute]
   :com.wsscode.pathom3.connect.operation/keys [op-name]
   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.
sourceraw docstring

create-root-andclj/s

(create-root-and graph env node-ids)
source

create-root-orclj/s

(create-root-or graph
                {:com.wsscode.pathom3.attribute/keys [attribute] :as env}
                node-ids)
source

disj-remclj/s

(disj-rem m k item)
source

entry-astclj/s

(entry-ast graph k)

Find AST node a given entry from the source AST.

Find AST node a given entry from the source AST.
sourceraw docstring

extend-attribute-sub-queryclj/s

(extend-attribute-sub-query graph attr shape)
source

extend-available-attribute-nestedclj/s

(extend-available-attribute-nested
  graph
  {:com.wsscode.pathom3.connect.planner/keys [available-data] :as env}
  attr
  shape)
source

find-direct-node-successorsclj/s

(find-direct-node-successors
  {:com.wsscode.pathom3.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.
sourceraw docstring

find-leaf-nodeclj/s

(find-leaf-node graph node)

Traverses all run-next still it reaches a leaf.

Traverses all run-next still it reaches a leaf.
sourceraw docstring

find-root-resolver-nodesclj/s

(find-root-resolver-nodes {:com.wsscode.pathom3.connect.planner/keys [root]
                           :as graph})

Returns the first resolvers to get called in the graph. This will traverse AND and OR node branches until the first resolvers are found. This function doesn't work the run-next of nodes.

Returns the first resolvers to get called in the graph. This will traverse AND and OR
node branches until the first resolvers are found. This function doesn't work the
run-next of nodes.
sourceraw docstring

find-run-next-descendantsclj/s

(find-run-next-descendants graph
                           {:com.wsscode.pathom3.connect.planner/keys
                              [node-id]})

Return descendants by walking the run-next

Return descendants by walking the run-next
sourceraw docstring

get-nodeclj/s

(get-node graph node-id)
(get-node graph node-id k)
source

get-root-nodeclj/s

(get-root-node {:com.wsscode.pathom3.connect.planner/keys [root] :as graph})

Returns the root node of the graph.

Returns the root node of the graph.
sourceraw docstring

graph-providesclj/s

(graph-provides {:com.wsscode.pathom3.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.
sourceraw docstring

ignore-nilsclj/s

(ignore-nils m)
source

inc-snapshot-depthclj/s

(inc-snapshot-depth env)
source

include-nodeclj/s

(include-node graph
              {:com.wsscode.pathom3.connect.planner/keys [node-id]
               :com.wsscode.pathom3.connect.operation/keys [op-name]
               :as node})

Add new node to the graph, this add the node and the index of in ::index-syms.

Add new node to the graph, this add the node and the index of in ::index-syms.
sourceraw docstring

mark-attribute-process-sub-queryclj/s

(mark-attribute-process-sub-query graph {:keys [key children query]})

Add information about attribute that is present but requires further processing due to subquery, this is created so the runner can quickly know which attributes need to have the subquery processing done.

Add information about attribute that is present but requires further processing
due to subquery, this is created so the runner can quickly know which attributes
need to have the subquery processing done.
sourceraw docstring

merge-sibling-resolver-nodeclj/s

(merge-sibling-resolver-node graph target-node-id source-node-id)

Merges data from source-node-id into target-node-id, them removes the source node.

Merges data from source-node-id into target-node-id, them removes the source node.
sourceraw docstring

merge-sibling-resolver-nodesclj/s

(merge-sibling-resolver-nodes graph env parent-node-id node-ids)
source

merge-sibling-resolver-nodes*clj/s

(merge-sibling-resolver-nodes* graph pivot node-ids)
source

merge-unreachableclj/s

(merge-unreachable target-graph
                   {:com.wsscode.pathom3.connect.planner/keys
                      [unreachable-paths]})
(merge-unreachable target-graph graph env path)

Copy unreachable attributes from discard-graph to target-graph. Using the extra arity you can also add a new unreachable path in the same call.

Copy unreachable attributes from discard-graph to target-graph. Using the extra arity
you can also add a new unreachable path in the same call.
sourceraw docstring

new-nodeclj/s

(new-node env node-data)
source

next-node-idclj/s

(next-node-id {:com.wsscode.pathom3.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
sourceraw docstring

node->labelclj/s

(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.
sourceraw docstring

node-ancestorsclj/s

(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.
sourceraw docstring

node-attribute-providesclj/s

(node-attribute-provides graph env attr)

For a specific attribute, return a vector containing the provides of each node of that resolver, or the current available data for it.

For a specific attribute, return a vector containing the provides of each node of
that resolver, or the current available data for it.
sourceraw docstring

node-branchesclj/s

(node-branches node)

Return node branches, which can be the ::run-and or the ::run-or part of the node.

Return node branches, which can be the ::run-and or the ::run-or part of the node.
sourceraw docstring

node-kindclj/s

(node-kind node)

Return a keyword describing the type of the node.

Return a keyword describing the type of the node.
sourceraw docstring

node-successorsclj/s

(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.
sourceraw docstring

node-with-resolver-configclj/s

(node-with-resolver-config graph env node-id)

Get the node plus the resolver config, when the node has an op-name. If node is not a resolver not it returns nil.

Get the node plus the resolver config, when the node has an op-name. If node is
not a resolver not it returns nil.
sourceraw docstring

optimize-AND-branchesclj/s

(optimize-AND-branches graph env node-id)
source

optimize-AND-ORsclj/s

(optimize-AND-ORs graph _env sibling-ids _parent-id)
source

optimize-AND-resolver-siblingsclj/s

(optimize-AND-resolver-siblings graph env parent-id pivot other-nodes)
source

optimize-AND-resolvers-passclj/s

(optimize-AND-resolvers-pass graph env sibling-ids parent-id)

This pass will collapse the same resolver node branches. This also do a local optimization on AND's and OR's sub-nodes. This is important to simplify the pass to merge OR nodes.

This pass will collapse the same resolver node branches. This also do a local optimization
on AND's and OR's sub-nodes. This is important to simplify the pass to merge OR nodes.
sourceraw docstring

optimize-branch-itemsclj/s

(optimize-branch-items graph env branch-node-id)
source

optimize-dynamic-resolver-chainclj/s

(optimize-dynamic-resolver-chain graph env node-id)

Merge node and its run-next, when they are the same dynamic resolver.

Merge node and its run-next, when they are the same dynamic resolver.
sourceraw docstring

optimize-dynamic-resolver-chain?clj/s

(optimize-dynamic-resolver-chain?
  graph
  {:com.wsscode.pathom3.connect.operation/keys [op-name]
   :com.wsscode.pathom3.connect.planner/keys [run-next]})
source

optimize-graphclj/s

(optimize-graph graph env)
source

optimize-nodeclj/s

(optimize-node graph env node-id)
source

optimize-OR-branchesclj/s

(optimize-OR-branches graph env node-id)
source

plan-mutationclj/s

(plan-mutation graph env {:keys [key] :as ast})
source

plan-mutation-nested-queryclj/s

(plan-mutation-nested-query graph env {:keys [key] :as ast})
source

promote-foreign-ast-childrenclj/s

(promote-foreign-ast-children
  {:com.wsscode.pathom3.connect.planner/keys [foreign-ast] :as ast})

Moves the children from foreign ast to the main children. Also removes the foreign ast attribute.

Moves the children from foreign ast to the main children. Also removes the foreign
ast attribute.
sourceraw docstring

remove-branch-node-parentsclj/s

(remove-branch-node-parents graph node-id)

When node-id is a branch node, remove all node-parents associated from its children.

When node-id is a branch node, remove all node-parents associated from its children.
sourceraw docstring

remove-from-parent-branchesclj/s

(remove-from-parent-branches graph
                             {:com.wsscode.pathom3.connect.planner/keys
                                [node-id node-parents]})

Disconnect a branch node from its parents.

Disconnect a branch node from its parents.
sourceraw docstring

remove-nodeclj/s

(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.
sourceraw docstring

remove-node*clj/s

(remove-node* graph node-id)

Remove a node from the graph. Doesn't remove any references, caution!

Remove a node from the graph. Doesn't remove any references, caution!
sourceraw docstring

remove-node-edgesclj/s

(remove-node-edges graph node-id)

Remove all node connections. This disconnect the nodes from parents and run-next.

Remove all node connections. This disconnect the nodes from parents and run-next.
sourceraw docstring

remove-node-expects-index-attrsclj/s

(remove-node-expects-index-attrs graph node-id)

Since the node has attribute indexes associated with it, this removes those links considering the attributes listed on expects.

Since the node has attribute indexes associated with it, this removes those links
considering the attributes listed on expects.
sourceraw docstring

remove-node-parentclj/s

(remove-node-parent graph node-id node-parent-id)
source

remove-root-node-clusterclj/s

(remove-root-node-cluster graph node-ids)

Remove a complete node cluster, starting from some node root.

Remove a complete node cluster, starting from some node root.
sourceraw docstring

reset-envclj/s

(reset-env env)

Restore the original environment sent to run-graph! Use this for nested graphs that need a clean environment.

Restore the original environment sent to run-graph! Use this for nested graphs
that need a clean environment.
sourceraw docstring

resolvers-missing-optionalsclj/s

(resolvers-missing-optionals
  {:com.wsscode.pathom3.connect.planner/keys [available-data] :as env}
  resolvers)

Merge the optionals from a collection of resolver symbols.

Merge the optionals from a collection of resolver symbols.
sourceraw docstring

runner-node-symclj/s

(runner-node-sym env resolver-name)

Find the runner symbol for a resolver, on normal resolvers that is the resolver symbol, but for foreign resolvers it uses its ::p.c.o/dynamic-name.

Find the runner symbol for a resolver, on normal resolvers that is the resolver symbol,
but for foreign resolvers it uses its ::p.c.o/dynamic-name.
sourceraw docstring

set-node-expectsclj/s

(set-node-expects graph node-id expects)

Set node expects, this also removes previous references from index-attrs and add new ones for the new expects.

Set node expects, this also removes previous references from index-attrs and add
new ones for the new expects.
sourceraw docstring

set-node-run-nextclj/s

(set-node-run-next graph run-next)
(set-node-run-next graph target-node-id run-next)

Set the node run next value and add the node-parent counter part. Noop if target and run next are the same node.

Set the node run next value and add the node-parent counter part. Noop if target
and run next are the same node.
sourceraw docstring

set-node-run-next*clj/s

(set-node-run-next* graph node-id run-next)

Update the node-id run-next value, if run-next is nil the attribute will be removed from the map.

Update the node-id run-next value, if run-next is nil the attribute
will be removed from the map.
sourceraw docstring

set-node-source-for-attrsclj/s

(set-node-source-for-attrs graph env)
(set-node-source-for-attrs graph
                           {:com.wsscode.pathom3.attribute/keys [attribute]}
                           node-id)
source

set-root-nodeclj/s

(set-root-node graph node-id)
source

shape-reachable?clj/s

(shape-reachable? env available shape)

Given an environment, available data and shape, determines if the whole shape is reachable (including nested dependencies).

Given an environment, available data and shape, determines if the whole shape
is reachable (including nested dependencies).
sourceraw docstring

simplify-branch-nodeclj/s

(simplify-branch-node graph env node-id)

When a branch node contains a single branch out, remove the AND node and put that single item in place.

Note in case the branch has a run-next, that run-next gets moved to the end of chain to retain the same order as it would run with the branch.

When a branch node contains a single branch out, remove the AND node and put that
single item in place.

Note in case the branch has a run-next, that run-next gets moved to the end of chain
to retain the same order as it would run with the branch.
sourceraw docstring

transfer-node-indexesclj/s

(transfer-node-indexes graph target-node-id source-node-id)
source

transfer-node-parentclj/s

(transfer-node-parent graph target-node-id source-node-id node-id)

Transfer the node parent from source node to target node. This function will also update the parents references to point to target node.

Transfer the node parent from source node to target node. This function will also
update the parents references to point to target node.
sourceraw docstring

transfer-node-parentsclj/s

(transfer-node-parents graph target-node-id source-node-id)

Transfer node parents from source node to target node. In case source node is root, the root will be transferred to target node.

Transfer node parents from source node to target node. In case source node is root,
the root will be transferred to target node.
sourceraw docstring

update-nodeclj/s

(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.
sourceraw docstring

with-plan-cacheclj/s

(with-plan-cache env)
(with-plan-cache env cache*)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close