Liking cljdoc? Tell your friends :D

com.wsscode.pathom3.interface.smart-map

Smart map is a Pathom interface that provides a map-like data structure, but this structure will realize the values as the user requests then. Values realized are cached, meaning that subsequent lookups are fast.

Smart map is a Pathom interface that provides a map-like data structure, but this
structure will realize the values as the user requests then. Values realized are
cached, meaning that subsequent lookups are fast.
raw docstring

datafy-smart-mapclj/s

(datafy-smart-map sm)

Returns a map with all reachable keys from the smart map. The cached keys get their value in this map, unresolved keys return with the special value ::pcr/unknown-value.

This is helpful to use with REPL tools that support the Clojure Datafiable/Navitable protocols. On navigation Pathom try to load the attribute you navigate to.

Returns a map with all reachable keys from the smart map. The cached keys get their
value in this map, unresolved keys return with the special value `::pcr/unknown-value`.

This is helpful to use with REPL tools that support the Clojure Datafiable/Navitable
protocols. On navigation Pathom try to load the attribute you navigate to.
sourceraw docstring

sm-assoc!clj/s

(sm-assoc! smart-map k v)

Assoc on the smart map in place, this function mutates the current cache and return the same instance of smart map.

You should use this only in cases where the optimization is required, try starting with the immutable versions first, given this has side effects and so more error phone.

Assoc on the smart map in place, this function mutates the current cache and return
the same instance of smart map.

You should use this only in cases where the optimization is required, try starting
with the immutable versions first, given this has side effects and so more error phone.
sourceraw docstring

sm-dissoc!clj/s

(sm-dissoc! smart-map k)

Dissoc on the smart map in place, this function mutates the current cache and return the same instance of smart map.

You should use this only in cases where the optimization is required, try starting with the immutable versions first, given this has side effects and so more error phone.

Dissoc on the smart map in place, this function mutates the current cache and return
the same instance of smart map.

You should use this only in cases where the optimization is required, try starting
with the immutable versions first, given this has side effects and so more error phone.
sourceraw docstring

sm-entityclj/s

(sm-entity sm)

Return the source cached entity for the smart map

Return the source cached entity for the smart map
sourceraw docstring

sm-envclj/s

(sm-env smart-map)

Extract the env map from the smart map.

Extract the env map from the smart map.
sourceraw docstring

sm-env-assocclj/s

(sm-env-assoc env k v)

Creates a new smart map by adding k v to the initial context.

When you read information in the smart map, that information is cached into an internal atom, and any dependencies that were required to get to the requested data is also included in this atom.

When you assoc into a smart map, it will discard all the data loaded by Pathom itself and will be like you have assoced in the original map and created a new smart object.

Creates a new smart map by adding k v to the initial context.

When you read information in the smart map, that information is cached into an internal
atom, and any dependencies that were required to get to the requested data is also
included in this atom.

When you assoc into a smart map, it will discard all the data loaded by Pathom itself
and will be like you have assoced in the original map and created a new smart object.
sourceraw docstring

sm-env-contains?clj/s

(sm-env-contains? env k)

Check if a property is present in the cache-tree.

Check if a property is present in the cache-tree.
sourceraw docstring

sm-env-dissocclj/s

(sm-env-dissoc env k)

Creates a new smart map by adding k v to the initial context.

When you read information in the smart map, that information is cached into an internal atom, and any dependencies that were required to get to the requested data is also included in this atom.

When you assoc into a smart map, it will discard all the data loaded by Pathom itself and will be like you have assoced in the original map and created a new smart object.

Creates a new smart map by adding k v to the initial context.

When you read information in the smart map, that information is cached into an internal
atom, and any dependencies that were required to get to the requested data is also
included in this atom.

When you assoc into a smart map, it will discard all the data loaded by Pathom itself
and will be like you have assoced in the original map and created a new smart object.
sourceraw docstring

sm-env-emptyclj/s

(sm-env-empty env)

Return a new smart map with the same environment and an empty map context.

Return a new smart map with the same environment and an empty map context.
sourceraw docstring

sm-env-findclj/s

(sm-env-find env k)

Check if attribute can be found in the smart map.

Check if attribute can be found in the smart map.
sourceraw docstring

sm-env-getclj/s

(sm-env-get env k)
(sm-env-get {:com.wsscode.pathom3.entity-tree/keys [entity-tree*] :as env}
            k
            default-value)

Get a property from a smart map.

First it checks if the property is available in the cache-tree, if not it triggers the connect engine to lookup for the property. After the lookup is triggered the cache-tree will be updated in place, note this has a mutable effect in this data, but this change is consistent.

Repeated lookups will use the cache-tree and should be as fast as reading from a regular Clojure map.

Get a property from a smart map.

First it checks if the property is available in the cache-tree, if not it triggers
the connect engine to lookup for the property. After the lookup is triggered the
cache-tree will be updated in place, note this has a mutable effect in this data,
but this change is consistent.

Repeated lookups will use the cache-tree and should be as fast as reading from a
regular Clojure map.
sourceraw docstring

sm-env-keysclj/s

(sm-env-keys {:com.wsscode.pathom3.interface.smart-map/keys [keys-mode]
              :as env})

Retrieve the keys in the smart map cache-tree.

Retrieve the keys in the smart map cache-tree.
sourceraw docstring

sm-env-metaclj/s

(sm-env-meta env)

Returns meta data of smart map, which is the same as the meta data from context map used to create the smart map.

Returns meta data of smart map, which is the same as the meta data from context
map used to create the smart map.
sourceraw docstring

sm-env-with-metaclj/s

(sm-env-with-meta env meta)

Return a new smart-map with the given meta.

Return a new smart-map with the given meta.
sourceraw docstring

sm-get-with-statsclj/s

(sm-get-with-stats sm k)

Return the graph run analysis, use for debugging. You can find the get value return in the ::psm/value key.

Note that if the value is cached, there will be a blank stats.

Return the graph run analysis, use for debugging. You can find the get value return
in the ::psm/value key.

Note that if the value is cached, there will be a blank stats.
sourceraw docstring

sm-replace-contextclj/s

(sm-replace-context sm new-context)

Replace the context data for the smart map with new-context, keeping the same environment. This returns a new smart map.

Replace the context data for the smart map with new-context, keeping the
same environment. This returns a new smart map.
sourceraw docstring

sm-touch!clj/s

(sm-touch! smart-map eql)

Will pre-fetch data in a smart map, given the EQL request. Use this to optimize the load of data ahead of time, instead of pulling one by one lazily.

Will pre-fetch data in a smart map, given the EQL request. Use this to optimize the
load of data ahead of time, instead of pulling one by one lazily.
sourceraw docstring

sm-touch-ast!clj/s

(sm-touch-ast! smart-map ast)
source

sm-update-envclj/s

(sm-update-env sm f & args)

Update smart map environment

Update smart map environment
sourceraw docstring

smart-mapclj/s

(smart-map env)
(smart-map {:com.wsscode.pathom3.interface.smart-map/keys [persistent-cache?]
            :or {persistent-cache? true}
            :as env}
           context)

Create a new smart map.

Smart maps are a special data structure that realizes properties using Pathom resolvers.

They work like maps and can be used interchangeable with it.

To create a smart map you need send an environment with the indexes and a context map with the initial context data:

(smart-map (pci/register [resolver1 resolver2]) {:some "context"})

When the value of a property of the smart map is a map, that map will also be cast into a smart map, including maps inside collections.

Create a new smart map.

Smart maps are a special data structure that realizes properties using Pathom resolvers.

They work like maps and can be used interchangeable with it.

To create a smart map you need send an environment with the indexes and a context
map with the initial context data:

    (smart-map (pci/register [resolver1 resolver2]) {:some "context"})

When the value of a property of the smart map is a map, that map will also be cast
into a smart map, including maps inside collections.
sourceraw docstring

smart-map?clj/s

(smart-map? x)
source

smart-run-statsclj/s

(smart-run-stats run-stats)

Wrap runner run stats with smart definitions to traverse the runner data.

Wrap runner run stats with smart definitions to traverse the runner data.
sourceraw docstring

SmartMapcljs

source

SmartMapEntrycljs

source

with-error-modeclj/s

(with-error-mode env error-mode)

This configures what happens when some error occur during the Pathom process to provide more data to the Smart Map.

Available modes:

::error-mode-silent (default): Return nil as the value, don't throw errors. ::error-mode-loud: Throw the errors on read.

This configures what happens when some error occur during the Pathom process to
provide more data to the Smart Map.

Available modes:

::error-mode-silent (default): Return `nil` as the value, don't throw errors.
::error-mode-loud: Throw the errors on read.
sourceraw docstring

with-keys-modeclj/s

(with-keys-mode env key-mode)

Configure how the Smart Map should respond to keys.

Available modes:

::keys-mode-cached (default): in this mode, keys will return only the keys that are currently cached in the Smart Map. This is the safest mode, given it will only read things from memory.

::keys-mode-reachable: in this mode, keys will list all possible keys that Pathom can reach given the current indexes and available data. Be careful with this mode, on large graphs there is a risk that a scan operation (like printing it) may trigger a large amount of resolver processing.

Configure how the Smart Map should respond to `keys`.

Available modes:

::keys-mode-cached (default): in this mode, keys will return only the keys that are
currently cached in the Smart Map. This is the safest mode, given it will only
read things from memory.

::keys-mode-reachable: in this mode, keys will list all possible keys that Pathom can
reach given the current indexes and available data. Be careful with this mode, on large
graphs there is a risk that a scan operation (like printing it) may trigger a large amount of resolver
processing.
sourceraw docstring

with-wrap-nested?clj/s

(with-wrap-nested? env wrap?)

Configure smart map to enable or disable the automatic wrapping of nested structures.

Configure smart map to enable or disable the automatic wrapping of nested structures.
sourceraw docstring

wrap-smart-mapclj/s

(wrap-smart-map {:com.wsscode.pathom3.interface.smart-map/keys [wrap-nested?]
                 :or {wrap-nested? true}
                 :as env}
                x)

If x is a composite data structure, return the data wrapped by smart maps.

If x is a composite data structure, return the data wrapped by smart maps.
sourceraw docstring

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

× close