Liking cljdoc? Tell your friends :D

com.wsscode.pathom3.format.shape-descriptor

Shape descriptor is a format to describe data. This format optimizes for fast detection of value present given a shape and a value path.

This namespace contains functions to operate on maps in the shape descriptor format.

Shape descriptor is a format to describe data. This format optimizes for fast detection
of value present given a shape and a value path.

This namespace contains functions to operate on maps in the shape descriptor format.
raw docstring

ast->shape-descriptorclj/s

(ast->shape-descriptor ast)

Convert EQL AST to shape descriptor format.

Convert EQL AST to shape descriptor format.
sourceraw docstring

data->shape-descriptorclj/s

(data->shape-descriptor data)

Helper function to transform a map into an shape descriptor.

Edges of shape descriptor are always an empty map. If a value of the map is a sequence. This will combine the keys present in all items on the final shape description.

WARN: this idea of merging is still under test, this may change in the future.

Helper function to transform a map into an shape descriptor.

Edges of shape descriptor are always an empty map. If a value of the map is a sequence.
This will combine the keys present in all items on the final shape description.

WARN: this idea of merging is still under test, this may change in the future.
sourceraw docstring

data->shape-descriptor-shallowclj/s

(data->shape-descriptor-shallow data)

Like data->shape-descriptor, but only at the root keys of the data.

Like data->shape-descriptor, but only at the root keys of the data.
sourceraw docstring

differenceclj/s

(difference s1 s2)

Like set/difference, for shapes.

Like set/difference, for shapes.
sourceraw docstring

intersectionclj/s

(intersection s1 s2)

Like set/intersection, for shapes.

Like set/intersection, for shapes.
sourceraw docstring

lift-placeholders-first-levelclj/s

(lift-placeholders-first-level env shape)

This function will normalize up all placeholders that start from the root of the tree.

For example:

{:>/foo {:a {}}} = becomes => {:a {}}

Nested items also are bring up:

{:>/foo {:a {} :>/other {:b {}}}} => {:a {} :b {}}

But placeholders not connected to the root as kept as-is:

{:coll {:>/inner {:a {}}}} => {:coll {:>/inner {:a {}}}}

This function will normalize up all placeholders that start from the root of the tree.

For example:

  {:>/foo {:a {}}} = becomes => {:a {}}

Nested items also are bring up:

  {:>/foo {:a {} :>/other {:b {}}}} => {:a {} :b {}}

But placeholders not connected to the root as kept as-is:

  {:coll {:>/inner {:a {}}}} => {:coll {:>/inner {:a {}}}}
sourceraw docstring

merge-shapesclj/s

(merge-shapes a)
(merge-shapes a b)

Deep merge of shapes, it takes in account that values are always maps.

Deep merge of shapes, it takes in account that values are always maps.
sourceraw docstring

missingclj/s

(missing available-shape required-shape)
(missing available required data)

Given some available and required shapes, returns which items are missing from available in the required. Returns nil when nothing is missing.

Given some available and required shapes, returns which items are missing from available
in the required. Returns nil when nothing is missing.
sourceraw docstring

missing-from-dataclj/s

(missing-from-data available-data required-shape)

Like missing, but starts from data instead of shape. If you are starting from data prefer this over missing, this can perform better by avoiding scanning the whole available data to build a shape, when the required-shape is a sub-set of the available data.

Like missing, but starts from data instead of shape. If you are starting from data
prefer this over missing, this can perform better by avoiding scanning the whole
available data to build a shape, when the required-shape is a sub-set of the available
data.
sourceraw docstring

query->shape-descriptorclj/s

(query->shape-descriptor output)

Convert pathom output format into shape descriptor format.

Convert pathom output format into shape descriptor format.
sourceraw docstring

relax-empty-collectionsclj/s

(relax-empty-collections required data)

This helper will remove nested requirements when data is an empty collection. This allows for nested inputs with empty collections to still be valid in shape.

This helper will remove nested requirements when data is an empty collection. This
allows for nested inputs with empty collections to still be valid in shape.
sourceraw docstring

select-shapeclj/s

(select-shape data shape)

Select the parts of data covered by shape. This is similar to select-keys, but for nested shapes.

Select the parts of data covered by shape. This is similar to select-keys, but for
nested shapes.
sourceraw docstring

select-shape-filteringclj/s

(select-shape-filtering data shape)
(select-shape-filtering data shape required-shape)

Like select-shape, but in case of collections, if some item doesn't have all the required keys, it's removed from the collection.

Like select-shape, but in case of collections, if some item doesn't have all the
required keys, it's removed from the collection.
sourceraw docstring

shape-descriptor->astclj/s

(shape-descriptor->ast shape)

Convert pathom output format into shape descriptor format.

Convert pathom output format into shape descriptor format.
sourceraw docstring

shape-descriptor->ast-childrenclj/s

(shape-descriptor->ast-children shape)

Convert pathom output format into shape descriptor format.

Convert pathom output format into shape descriptor format.
sourceraw docstring

shape-descriptor->queryclj/s

(shape-descriptor->query shape)

Convert shape descriptor format to EQL.

Convert shape descriptor format to EQL.
sourceraw docstring

shape-paramsclj/s

(shape-params shape-value params)
source

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

× close