Metreeca Keep
    Preparing search index...

    Module @metreeca/keep-flake - v0.10.0

    A shape and its optional retrieval model or collection query, represented as a single traversal tree.

    A Shape and its retrieval Model or collection Query scatter what to fetch across the structure as independent probes (property requests, constraints, transforms), leaving the collective traversal that satisfies them implicit. A flake makes it explicit, reorganising the probes into one tree a shape-driven processor walks directly instead of correlating raw shape with raw input at every step.

    createFlake produces three flavours of the tree, one per overload:

    • shape — a resource full structural reach, with no input (a leaf for a non-resource root);
    • model — the reach restricted to the properties a retrieval Model addresses, each node carrying the drain requested for it (a @metreeca/qest/template!Template on a resource root; any other form, or a non-resource root, degenerates to a leaf);
    • query — a collection member shape tagged with the constraints, ordering, and projection a Query expresses.

    Every node, the root included, is a Flake located by its path along the property axis and its pipe along the transform axis, and sharing the same constraint, ordering, and projection slots. A resource node branches along both axes; a non-resource node is a bare leaf:

    • property branches — a node steps through its entries into one Branch per addressed Id / Type / Property, a union-typed property keeping one branch per variant. The path records this axis;
    • transform stages — a node hangs each Transform a query applies off its transforms as a nested Flake. The pipe records this axis.

    Type Aliases

    Flake

    A node of a flake.

    Branch

    Property-step node of a flake.

    Drain

    The retrieval requested at a node of a flake.

    Transforms

    A node's transform stages, keyed by the Transform each stage applies.

    Entries

    A node's property branches, keyed by property name.

    Functions

    createFlake

    Builds a Flake from a Shape and an optional Model or Query.

    isComputedFlake

    Checks whether a Flake is a transform stage rather than a property or marker step.

    isAggregateFlake

    Checks whether a Flake is an aggregate transform stage.

    isScalarFlake

    Checks whether a Flake is a scalar (non-aggregating) transform stage.

    isGroupingFlake

    Checks whether a Flake groups the query.

    isDrainedFlake

    Checks whether a Flake requests any retrieval, at the node or anywhere beneath it.

    isConstrainedFlake

    Checks whether a Flake carries any constraint, ranking, or ordering slot, at the node or anywhere beneath it.

    isFilteredFlake

    Checks whether a Flake carries a filtering constraint, at the node or anywhere beneath it.

    isRequiredFlake

    Checks whether a Flake carries an existence-implying filter constraint.

    hasValueOptions

    Checks whether a Flake's membership constraints name at least one non-null value.

    hasDictionaryOptions

    Checks whether a Flake's membership constraints include a localised dictionary option.

    hasNullOptions

    Checks whether a Flake's membership constraints include an explicit null option.

    isBranch

    Checks whether a Flake is a Branch (a property or marker step) rather than a transform stage, so its entry is available.

    isPropertyBranch

    Checks whether a flake steps through a Property edge, regardless of what it retrieves: the union of model, query, and projected branches, excluding Id / Type markers and transform stages.

    isModelBranch

    Checks whether a flake steps through a Property carrying a single-value Model template retrieval: a non-projected drain whose mould is a Model (or no drain).

    isQueryBranch

    Checks whether a flake steps through a Property carrying a collection Query template retrieval: a non-projected drain whose mould is a Query.

    isProbeBranch

    Checks whether a flake is projected by a query: its drain carries a projection alias.

    getFlakeProjections

    Collects every projected flake of a Flake into a flat list.

    getFlakeTransforms

    Lists a flake's own transform stages.

    getFlakeEntries

    Lists a flake's own property branches.

    getFlakeProjection

    Collects every projection in a Flake into an alias-keyed index.

    getFlakeGrouping

    Collects the grouping keys of a Flake.

    getFlakeFocusing

    Collects the focus keys of a Flake.

    getFlakeOrdering

    Collects the sort keys of a Flake, by ascending precedence.

    getFlakeVariant

    Slices a node's entry-major branch index down to the branches one variant shape contributes.