Options
All
  • Public
  • Public/Protected
  • All
Menu

Package muster

Muster

A universal data layer for your components and services

Muster is a state and data management library that gives you a unified, reactive, declarative, performant and powerful view of as much or as little data as you need.

Muster comes bundled with a number of NodeDefinitions split into following categories:

  • arithmetic - Nodes focusing on arithmetic operations, e.g. add, subtract, etc.
  • browser - Nodes used for interacting with the browser, e.g. location
  • collections - Nodes that are handling collections and all of the transformations on it, e.g. applyTransforms, filter, sort, map, etc.
  • graph - Core Muster nodes, e.g. ref, variable, value, action, etc.
  • logic - Nodes introducing logic operators, e.g. and, eq, ifElse, etc.
  • numeric - Nodes helping with handling numbers in Muster, e.g. parseInt
  • remote - Nodes used for connecting Muster with remote Muster instances, e.g. proxy.
  • string - String manipulation nodes, e.g. endsWith, join, split, etc.

Installation

npm install --save @dws/muster @dws/muster-observable

Usage

Creating basic muster application

import muster from '@dws/muster';

const app = muster({ firstName: 'John', lastName: 'Doe', age: 43, });

This example creates a muster application containing three nodes:

Accessing data from a muster graph

const app = muster({ firstName: 'John' });

First let's create a simple muster instance with a graph containing a single leaf value firstName. Now we have an instance of muster we can make queries against it:

const firstName = await app.resolve(ref('firstName'));

The Muster object exposes a resolve method which can be used for running queries against muster. In this example we've used a ref. This node is used to locate and return a graph node based on its path in the graph. The path in the graph is defined by the hierarchy of branches that exist in the muster graph. In this example we have just one branch containing a single leaf firstName. You can find out more about paths and branches in the ref and tree documentation.

app.resolve returns an object implementing both Observable and Promise APIs. In this example we have retrieved the current value of the firstName node with the use of the Promise API. Alternatively this can also be done with Observable by subscribing to the returned observable:

const unsubscribe = app.resolve(ref('firstName')).subscribe((firstName) => {
  // Do something with the first name as it changes over time
});

By nature, muster tries to execute the code synchronously when it can, so the callback of the subscribe will be called immediately with the latest value of firstName. In this example firstName resolves to 'John' string.

Notice: subscribe has one important advantage over await. It responds to changes in the subscribed query over time. Consider an example where the firstName is a node whose value changes while the application is running. Promise will emit the value as soon as it's available but won't cause your code to be re-run when the value of the subscribed node changes. On the other hand, Observable will re-emit a new value causing the subscriber (the function used to create the subscription) to be executed again with a new value.

See variable, fromPromise and fromStream for more information about settable nodes.

Creating muster application with branches

import muster, { computed, ref } from '@dws/muster';

const app = muster({ user: { firstName: 'John', lastName: 'Doe', fullName: computed([ ref('user', 'firstName'), ref('user', 'lastName'), ], (firstName, lastName) => <span class="hljs-subst">${firstName}</span> <span class="hljs-subst">${lastName}</span>), }, });

This example creates a muster application where the graph has one branch user (tree). That branch has three leaves:

  • firstName: value = 'John'
  • lastname: value = 'Doe'
  • fullName: computed = A node which computes full name of the user based on the current value of firstName and lastName.

Note the fullName computed dependencies are defined using fully qualified path of the nodes in the graph. This could have been simplified with the use of a relative helper function:

import muster, { computed, ref, relative } from '@dws/muster';

const app = muster({ user: { firstName: 'John', lastName: 'Doe', fullName: computed([ ref(relative('firstName')), ref(relative('lastName')), ], (firstName, lastName) => <span class="hljs-subst">${firstName}</span> <span class="hljs-subst">${lastName}</span>), }, });

The benefit of using relative instead of defining the full path is apparent when refactoring the application graph. Imagine a scenario when the user branch is to be renamed to currentUser. In this scenario, when the full path is used we'd have to change the name in three places: branch definitions and both references. It would be much simpler with the use of relative helper: we'd have to only rename the branch.

You can find out more about relative helper on its documentation.

Lazy-evaluating values

import muster, { computed, ref } from '@dws/muster';

let externalValue = 'initial';

const app = muster({ testComputed: computed([], () => { externalValue = 'updated'; return true; }), });

// externalValue === 'initial' const subscription = app.resolve(ref('testComputed'));

// externalValue === 'initial'

const unsubscribe = subscription.subscribe((testComputedValue) => { // externalValue === 'updated' // testComputedValue === true }); // externalValue === 'updated'

This example demonstrates the principle of lazy evaluation in muster. In muster the value of every node is evaluated only when a subscription is created to that node. Note how the value of externalValue changes in this example. Thanks to the synchronous code execution in muster the externalValue is set to the new value before the first line of the subscriber callback as well as after the call to the subscribe method.

Most of the Muster NodeDefinitions are synchronous, with exception of fromPromise, fromStream (depending on the type of stream used), action, proxy and remote.

Complex queries

import muster, { key, query, root } from '@dws/muster';

const app = muster({ user: { firstName: 'Bob', lastName: 'Johnson', }, });

const userTree = await app.resolve(query(root(), { user: key('user', { firstName: key('firstName'), lastName: key('lastName'), }), })); // userTree is a JS object with all of the requested branches encoded in it: // { // user: { // firstName: 'Bob', // lastName: 'Johnson', // }, // }

In previous examples we've been requesting a single NodeDefinition at a time. In real world apps this would not be the most efficient or fastest way of writing code. For this reason Muster comes with a query which allows for building complex queries. These queries define the shape of their output data as well as the place from the graph this data is to be retrieved from. See the query documentation to learn more about queries.

Index

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

AcceptedPredicateTypes

AcceptedPredicateTypes: function | string | Array<string>

ActionCache

ActionCache: object & object | object

ActionCacheQueueItem

ActionCacheQueueItem: object

Type declaration

ActionId

ActionId: NodeId & OperationId

AddItemAttableGraphNode

AddItemAttableGraphNode: DynamicGraphNode<T, P, S, D, V, "addItemAt", AddItemAtOperation, AddItemAttableNodeType<T, P, S, D, V>>

AddItemAttableNodeDefinition

AddItemAttableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "addItemAt", AddItemAtOperation, AddItemAttableNodeType<T, P, S, D, V>>

AddItemAttableNodeType

AddItemAttableNodeType: DynamicNodeType<T, P, S, D, V, "addItemAt", AddItemAtOperation>

AnyRequest

ArrayReducerAccumulator

ArrayReducerAccumulator: Array<GraphNode>

BranchDefinition

BranchDefinition: object

Type declaration

CachedActionId

CachedActionId: number

CallArgument

CallArgument: NodeDefinition | GraphNode

CallArgumentArray

CallArgumentArray: Array<CallArgument>

CallArgumentMap

CallArgumentMap: object

Type declaration

CallableGraphNode

CallableGraphNode: DynamicGraphNode<T, P, S, D, V, "call", CallOperation, CallableNodeType<T, P, S, D, V>>

CallableNodeDefinition

CallableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "call", CallOperation, CallableNodeType<T, P, S, D, V>>

CallableNodeType

CallableNodeType: DynamicNodeType<T, P, S, D, V, "call", CallOperation>

ChildKey

ChildKey: any

ChildKeyDefinition

ClearableGraphNode

ClearableGraphNode: DynamicGraphNode<T, P, S, D, V, "clear", ClearOperation, ClearableNodeType<T, P, S, D, V>>

ClearableNodeDefinition

ClearableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "clear", ClearOperation, ClearableNodeType<T, P, S, D, V>>

ClearableNodeType

ClearableNodeType: DynamicNodeType<T, P, S, D, V, "clear", ClearOperation>

ContainerGraphNode

ContainerGraphNode: DynamicGraphNode<T, P, S, D, V, "getChild", GetChildOperation, ContainerNodeType<T, P, S, D, V>>

ContainerNodeDefinition

ContainerNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "getChild", GetChildOperation, ContainerNodeType<T, P, S, D, V>>

ContainerNodeType

ContainerNodeType: DynamicNodeType<T, P, S, D, V, "getChild", GetChildOperation>

ContainsableGraphNode

ContainsableGraphNode: DynamicGraphNode<T, P, S, D, V, "contains", ContainsOperation, ContainsableNodeType<T, P, S, D, V>>

ContainsableNodeDefinition

ContainsableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "contains", ContainsOperation, ContainsableNodeType<T, P, S, D, V>>

ContainsableNodeType

ContainsableNodeType: DynamicNodeType<T, P, S, D, V, "contains", ContainsOperation>

ContextDependency

ContextId

ContextId: string

ContextName

ContextName: string

ContextValues

ContextValues: object

Type declaration

ContextValuesDefinitions

ContextValuesDefinitions: object

Type declaration

ContextWithPathKey

ContextWithPathKey: Context & object

DataNode

DataNode: ValueNode<any> | OkNode | NilNode | QuoteNode | ErrorNode

DataNodeDefinition

DeferNodeFallbackGenerator

DeferNodeFallbackGenerator: function

Type declaration

DisposeCallback

DisposeCallback: function

Type declaration

    • (): void
    • Returns void

DisposeCallback

DisposeCallback: function

Type declaration

    • (): void
    • Returns void

DisposeRequest

DisposeRequest: function

Type declaration

    • (): void
    • Returns void

DynamicNodeType

DynamicNodeType: StatelessNodeType<T, P, V, M, O> | StatefulNodeType<T, P, S, D, V, M, O>

EmitterCallback

EmitterCallback: function

Type declaration

    • (event: T): void
    • Parameters

      • event: T

      Returns void

ErrorFallbackGenerator

ErrorFallbackGenerator: function

Type declaration

EvaluableGraphNode

EvaluableGraphNode: DynamicGraphNode<T, P, S, D, V, "evaluate", EvaluateOperation, EvaluableNodeType<T, P, S, D, V>>

EvaluableNodeDefinition

EvaluableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "evaluate", EvaluateOperation, EvaluableNodeType<T, P, S, D, V>>

EvaluableNodeType

EvaluableNodeType: DynamicNodeType<T, P, S, D, V, "evaluate", EvaluateOperation>

EventRedispatcher

EventRedispatcher: function

Type declaration

ExclusiveSliceBounds

ExclusiveSliceBounds: object

Type declaration

FieldDefinition

FieldSetDefinition

FieldSetDefinition: object

Type declaration

FormatData

FormatData: Array<[string, NodeDefinition]>

GenericFactory

GenericFactory: function

Type declaration

GraphNodeWithIsPending

GraphNodeWithIsPending: DynamicGraphNode<T, P, S, D, V, "isPending", IsPendingOperation, NodeTypeWithIsPending<T, P, S, D, V>>

GraphNodeWithIsUpdating

GraphNodeWithIsUpdating: DynamicGraphNode<T, P, S, D, V, "isUpdating", IsUpdatingOperation, NodeTypeWithIsUpdating<T, P, S, D, V>>

GraphNodeWithRemoveItem

GraphNodeWithRemoveItem: DynamicGraphNode<T, P, S, D, V, "removeItem", RemoveItemOperation, NodeTypeWithRemoveItem<T, P, S, D, V>>

HashSet

HashSet: Set<string>

HistoryWithId

HistoryWithId: History & object

InclusiveSliceBounds

InclusiveSliceBounds: object

Type declaration

InitableGraphNode

InitableGraphNode: DynamicGraphNode<T, P, S, D, V, "init", InitOperation, InitableNodeType<T, P, S, D, V>>

InitableNodeDefinition

InitableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "init", InitOperation, InitableNodeType<T, P, S, D, V>>

InitableNodeType

InitableNodeType: DynamicNodeType<T, P, S, D, V, "init", InitOperation>

InvalidTypeErrorOptions

InvalidTypeErrorOptions: object

Type declaration

  • Optional expected?: any | Array<any>
  • received: any

InvalidateOnNodeCallback

InvalidateOnNodeCallback: function

Type declaration

IterableGraphNode

IterableGraphNode: DynamicGraphNode<T, P, S, D, V, "iterate", IterateOperation, IterableNodeType<T, P, S, D, V>>

IterableNodeDefinition

IterableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "iterate", IterateOperation, IterableNodeType<T, P, S, D, V>>

IterableNodeType

IterableNodeType: DynamicNodeType<T, P, S, D, V, "iterate", IterateOperation>

KeyMatcher

KeyMatcher: function

Type declaration

LegacyDataNode

LegacyDataNode: DataNode | TreeNode | ArrayNode

LegacyDataNodeDefinition

LengthtableGraphNode

LengthtableGraphNode: DynamicGraphNode<T, P, S, D, V, "length", LengthOperation, LengthtableNodeType<T, P, S, D, V>>

LengthtableNodeDefinition

LengthtableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "length", LengthOperation, LengthtableNodeType<T, P, S, D, V>>

LengthtableNodeType

LengthtableNodeType: DynamicNodeType<T, P, S, D, V, "length", LengthOperation>

ListGraphNode

ListGraphNode: DynamicGraphNode<T, P, S, D, V, "getItems", GetItemsOperation, ListNodeType<T, P, S, D, V>>

ListKeyNode

ListKeyNodeDefinition

ListNodeDefinition

ListNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "getItems", GetItemsOperation, ListNodeType<T, P, S, D, V>>

ListNodeType

ListNodeType: DynamicNodeType<T, P, S, D, V, "getItems", GetItemsOperation>

LocationParamsEncoding

LocationParamsEncoding: "base64" | "json"

LogSink

LogSink: function

Type declaration

    • (...args: Array<any>): void
    • Parameters

      • Rest ...args: Array<any>

      Returns void

MiddlewareTransformer

MiddlewareTransformer: function

Type declaration

ModuleDependencies

ModuleDependencies: object

Type declaration

ModuleFactory

ModuleFactory: function

Type declaration

ModuleRequirements

ModuleRequirements: object

Type declaration

  • [name: string]: Type

MusterEventName

MusterEventName: string

MusterEventPayload

MusterEventPayload: any

MusterEventSource

MusterEventSource: EventEmitter<MusterEvent<T, V>>

MusterOperationDefinition

MusterOperationDefinition: Operation<MusterScenarioInput, MusterScenarioOutput, NodeDefinition | Array<NodeDefinition>>

MusterScenarioDefinition

MusterScenarioState

MusterScenarioState: Muster

MusterTypeMap

MusterTypeMap: object

Type declaration

MusterTypeName

MusterTypeName: string

NamedFnArgs

NamedFnArgs: object

Type declaration

NodeData

NodeData: object

Type declaration

  • [key: string]: any

NodeDefinitionCallback

NodeDefinitionCallback: function

Type declaration

NodeDefinitionWithIsPending

NodeDefinitionWithIsPending: DynamicNodeDefinition<T, P, S, D, V, "isPending", IsPendingOperation, NodeTypeWithIsPending<T, P, S, D, V>>

NodeDefinitionWithIsUpdating

NodeDefinitionWithIsUpdating: DynamicNodeDefinition<T, P, S, D, V, "isUpdating", IsUpdatingOperation, NodeTypeWithIsUpdating<T, P, S, D, V>>

NodeDefinitionWithRemoveItem

NodeDefinitionWithRemoveItem: DynamicNodeDefinition<T, P, S, D, V, "removeItem", RemoveItemOperation, NodeTypeWithRemoveItem<T, P, S, D, V>>

NodeId

NodeId: string

NodeLike

NodeLike: any

NodeLikeCallArgument

NodeLikeCallArgument: NodeLike | NodeDefinition | GraphNode

NodeLikeCallArgumentArray

NodeLikeCallArgumentArray: Array<NodeLikeCallArgument>

NodeLikeCallArgumentMap

NodeLikeCallArgumentMap: object

Type declaration

NodeName

NodeName: string

NodeProperties

NodeProperties: object

Type declaration

NodeState

NodeState: any

NodeStream

NodeStream: Stream<T>

NodeTransformer

NodeTransformer: function

Type declaration

NodeType

NodeType: StaticNodeType<T, P, V> | DynamicNodeType<T, P, S, D, V, M, O>

NodeTypeDefinition

NodeTypeDefinition: StaticNodeTypeDefinition<P, V> | StatelessNodeTypeDefinition<T, P, V, M> | StatefulNodeTypeDefinition<T, P, S, D, V, M>

NodeTypeMap

NodeTypeMap: object

Type declaration

NodeTypeWithIsPending

NodeTypeWithIsPending: DynamicNodeType<T, P, S, D, V, "isPending", IsPendingOperation>

NodeTypeWithIsUpdating

NodeTypeWithIsUpdating: DynamicNodeType<T, P, S, D, V, "isUpdating", IsUpdatingOperation>

NodeTypeWithRemoveItem

NodeTypeWithRemoveItem: DynamicNodeType<T, P, S, D, V, "removeItem", RemoveItemOperation>

OnNodeCallback

OnNodeCallback: function

Type declaration

OperationFactory

OperationFactory: function

Type declaration

OperationHandler

OperationHandler: StatelessOperationHandler<T, P, V, M, O> | StatefulOperationHandler<T, P, S, D, V, M, O>

OperationHandlerDefinition

OperationHandlerDefinition: StatelessOperationHandlerDefinition<T, P, V, M> | StatefulOperationHandlerDefinition<T, P, S, D, V, M>

OperationId

OperationId: string

OperationName

OperationName: string

OperationProperties

OperationProperties: object

Type declaration

OperationTypeMap

OperationTypeMap: object

Type declaration

PathKey

PathKey: string | GraphNode | ListKeyNode

PendingFallbackGenerator

PendingFallbackGenerator: function

Type declaration

PoptableGraphNode

PoptableGraphNode: DynamicGraphNode<T, P, S, D, V, "pop", PopOperation, PoptableNodeType<T, P, S, D, V>>

PoptableNodeDefinition

PoptableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "pop", PopOperation, PoptableNodeType<T, P, S, D, V>>

PoptableNodeType

PoptableNodeType: DynamicNodeType<T, P, S, D, V, "pop", PopOperation>

PushtableGraphNode

PushtableGraphNode: DynamicGraphNode<T, P, S, D, V, "push", PushOperation, PushtableNodeType<T, P, S, D, V>>

PushtableNodeDefinition

PushtableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "push", PushOperation, PushtableNodeType<T, P, S, D, V>>

PushtableNodeType

PushtableNodeType: DynamicNodeType<T, P, S, D, V, "push", PushOperation>

QueriesSnapshot

QueriesSnapshot: object

Type declaration

QueryPartCallback

QueryPartCallback: function

Type declaration

QuerySetCallback

QuerySetCallback: function

Type declaration

QuerySetChild

QuerySetChildWithPath

QuerySetChildWithPath: object

Type declaration

RelativeSliceBounds

RelativeSliceBounds: object

Type declaration

RemoveItemAttableGraphNode

RemoveItemAttableGraphNode: DynamicGraphNode<T, P, S, D, V, "removeItemAt", RemoveItemAtOperation, RemoveItemAttableNodeType<T, P, S, D, V>>

RemoveItemAttableNodeDefinition

RemoveItemAttableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "removeItemAt", RemoveItemAtOperation, RemoveItemAttableNodeType<T, P, S, D, V>>

RemoveItemAttableNodeType

RemoveItemAttableNodeType: DynamicNodeType<T, P, S, D, V, "removeItemAt", RemoveItemAtOperation>

RequestGraphNode

RequestGraphNode: DynamicGraphNode<T, P, S, D, V, "request", RequestOperation, RequestNodeType<T, P, S, D, V>>

RequestMetadata

RequestMetadata: object

Type declaration

  • [namespace: string]: any

RequestNodeDefinition

RequestNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "request", RequestOperation, RequestNodeType<T, P, S, D, V>>

RequestNodeType

RequestNodeType: DynamicNodeType<T, P, S, D, V, "request", RequestOperation>

ResettableGraphNode

ResettableGraphNode: DynamicGraphNode<T, P, S, D, V, "reset", ResetOperation, ResettableNodeType<T, P, S, D, V>>

ResettableNodeDefinition

ResettableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "reset", ResetOperation, ResettableNodeType<T, P, S, D, V>>

ResettableNodeType

ResettableNodeType: DynamicNodeType<T, P, S, D, V, "reset", ResetOperation>

ResolvableGraphNode

ResolvableGraphNode: DynamicGraphNode<T, P, S, D, V, "resolve", ResolveOperation, ResolvableNodeType<T, P, S, D, V>>

ResolvableNodeDefinition

ResolvableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "resolve", ResolveOperation, ResolvableNodeType<T, P, S, D, V>>

ResolvableNodeType

ResolvableNodeType: DynamicNodeType<T, P, S, D, V, "resolve", ResolveOperation>

ResponseAssembler

ResponseAssembler: function

Type declaration

ResponseFactory

ResponseFactory: function

Type declaration

ResponsePartAssembler

ResponsePartAssembler: function

Type declaration

ResponseTransformer

ResponseTransformer: function

Type declaration

ResultableGraphNode

ResultableGraphNode: DynamicGraphNode<T, P, S, D, V, "result", ResultOperation<any>, ResultableNodeType<T, P, S, D, V>>

ResultableNodeDefinition

ResultableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "result", ResultOperation<any>, ResultableNodeType<T, P, S, D, V>>

ResultableNodeType

ResultableNodeType: DynamicNodeType<T, P, S, D, V, "result", ResultOperation<any>>

SchedulerFactory

SchedulerFactory: function

Type declaration

ScopeId

ScopeId: string

SerializableObject

SerializableObject: NodeDefinition | GraphOperation | Matcher<any, any>

SerializableQuerySetChild

SerializedActionCache

SerializedActionCache: object & object | object

SerializedContext

SerializedContext: ContextId

SerializedGraphOperation

SerializedGraphOperation: object

Type declaration

  • $operation: O["name"]
  • data: P
  • id: string

SerializedMusterTypeData

SerializedMusterTypeData: any

SerializedNodeDefinition

SerializedNodeDefinition: object

Type declaration

  • $type: N["name"]
  • data: V

SerializedNodeProperties

SerializedNodeProperties: any

SerializedNodeType

SerializedNodeType: object

Type declaration

  • operations: Array<string>

SerializedNodeTypesMap

SerializedNodeTypesMap: object

Type declaration

SerializedOperationProperties

SerializedOperationProperties: any

SerializedPrimitive

SerializedPrimitive: string | number | boolean | null | undefined

SerializedPrimitive

SerializedPrimitive: string | number | boolean | null | undefined

SerializedScope

SerializedScope: ScopeId

SerializedSubscription

SerializedSubscription: object

Type declaration

SerializedValue

SerializedValue

SettableGraphNode

SettableGraphNode: DynamicGraphNode<T, P, S, D, V, "set", SetOperation, SettableNodeType<T, P, S, D, V>>

SettableNodeDefinition

SettableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "set", SetOperation, SettableNodeType<T, P, S, D, V>>

SettableNodeType

SettableNodeType: DynamicNodeType<T, P, S, D, V, "set", SetOperation>

SetterFactory

SetterFactory: function

Type declaration

ShapeFields

ShapeFields: object

Type declaration

ShifttableGraphNode

ShifttableGraphNode: DynamicGraphNode<T, P, S, D, V, "shift", ShiftOperation, ShifttableNodeType<T, P, S, D, V>>

ShifttableNodeDefinition

ShifttableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "shift", ShiftOperation, ShifttableNodeType<T, P, S, D, V>>

ShifttableNodeType

ShifttableNodeType: DynamicNodeType<T, P, S, D, V, "shift", ShiftOperation>

SortValue

SortValue: null | undefined | boolean | string | number | Date

SteppableGraphNode

SteppableGraphNode: DynamicGraphNode<T, P, S, D, V, "step", StepOperation<any>, SteppableNodeType<T, P, S, D, V>>

SteppableNodeDefinition

SteppableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "step", StepOperation<any>, SteppableNodeType<T, P, S, D, V>>

SteppableNodeType

SteppableNodeType: DynamicNodeType<T, P, S, D, V, "step", StepOperation<any>>

StoreSubscribe

StoreSubscribe: function

Type declaration

StreamFactory

StreamFactory: function

Type declaration

StreamUpdateCallback

StreamUpdateCallback: function

Type declaration

    • (value: T): void
    • Parameters

      • value: T

      Returns void

SupportsRemoveItemsGraphNode

SupportsRemoveItemsGraphNode: DynamicGraphNode<T, P, S, D, V, "removeItems", RemoveItemsOperation, SupportsRemoveItemsNodeType<T, P, S, D, V>>

SupportsRemoveItemsNodeDefinition

SupportsRemoveItemsNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "removeItems", RemoveItemsOperation, SupportsRemoveItemsNodeType<T, P, S, D, V>>

SupportsRemoveItemsNodeType

SupportsRemoveItemsNodeType: DynamicNodeType<T, P, S, D, V, "removeItems", RemoveItemsOperation>

TransformOperation

TransformOperation: InitOperation | StepOperation<any> | ResultOperation<any>

TransformerGraphNode

TransformerGraphNode: DynamicGraphNode<T, P, S, D, V, "transformItems", TransformItemsOperation, TransformerNodeType<T, P, S, D, V>>

TransformerGraphNode

TransformerNodeDefinition

TransformerNodeDefinition

TransformerNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "transformItems", TransformItemsOperation, TransformerNodeType<T, P, S, D, V>>

TransformerNodeType

TransformerNodeType: DynamicNodeType<T, P, S, D, V, "transformItems", TransformItemsOperation>

Type

Type: true

UnshifttableGraphNode

UnshifttableGraphNode: DynamicGraphNode<T, P, S, D, V, "unshift", UnshiftOperation, UnshifttableNodeType<T, P, S, D, V>>

UnshifttableNodeDefinition

UnshifttableNodeDefinition: DynamicNodeDefinition<T, P, S, D, V, "unshift", UnshiftOperation, UnshifttableNodeType<T, P, S, D, V>>

UnshifttableNodeType

UnshifttableNodeType: DynamicNodeType<T, P, S, D, V, "unshift", UnshiftOperation>

UnsubscribeCallback

UnsubscribeCallback: function

Type declaration

    • (): void
    • Returns void

UpdateCallback

UpdateCallback: function

Type declaration

UpdateCallback

UpdateCallback: function

Type declaration

ValueStream

ValueStream: ObservableLike<NodeDefinition | NodeLike>

ValueStreamFactory

ValueStreamFactory: function

Type declaration

ValueUpdater

ValueUpdater: Partial<object> | function

YieldedValueType

YieldedValueType: NodeMap | ProxiedNode | DataNode | NodeLike | Array<ProxiedNode | DataNode | NodeLike>

Variables

Const ActionNodeType

ActionNodeType: StatelessNodeType<"action", ActionNodeProperties> = createNodeType<'action',ActionNodeProperties>('action', {serialize: false,deserialize: false,shape: {body: types.saveHash(types.func),},operations: {call: {cacheable: false,getDependencies(properties: ActionNodeProperties,operation: CallOperation,): Array<NodeDependency> {const { args } = operation.properties;if (!args) return [];if (isCallArgumentArray(args)) {return args.map((arg) => ({target: arg,until: untilIsDataNode,once: true,}));}return Object.keys(args).map((name) => ({target: args[name],until: untilIsDataNode,once: true,}));},run(node: ActionNode,operation: CallOperation,argValues: Array<DataNode>,): GraphNode | NodeDefinition {const { body } = node.definition.properties;const { args } = operation.properties;const unwrappedArgs = argValues.map((argValue) => valueOf(argValue));let result: any;if (!args) {result = body();} else if (isCallArgumentArray(args)) {// Handle array of argumentsresult = body(...unwrappedArgs);} else {// Handle named argumentsconst argNames = Object.keys(args);result = body(fromPairs(zip(argNames, unwrappedArgs)));}if (isProxiedNode(result)) {return getProxiedNodeValue(result);}if (isGraphNode(result)) {return result;}if (isNodeDefinition(result)) {return withScopeFrom(node, result);}if (isGenerator(result)) {const generatorResult = stepNext(result, []);return isGraphNode(generatorResult)? generatorResult: withScopeFrom(node, generatorResult);}return withScopeFrom(node, value(result));},},},})

The implementation of the action. See the action documentation for more information.

Const AddItemAtNodeType

AddItemAtNodeType: StatefulNodeType<"add-item-at", AddItemAtNodeProperties, AddItemAtNodeState, __type> = createNodeType<'add-item-at', AddItemAtNodeProperties, AddItemAtNodeState, {}>('add-item-at', {shape: {index: graphTypes.nodeDefinition,item: graphTypes.nodeDefinition,target: graphTypes.nodeDefinition,},state: {memoized: types.saveHash(types.func),},getInitialState() {return {memoized: once((target: GraphNode, item: NodeDefinition, index: number) =>createGraphAction(target, addItemAtOperation(item, index)),),};},operations: {evaluate: {cacheable: false,getDependencies({ target, index }: AddItemAtNodeProperties): Array<NodeDependency> {return [{target,until: untilSupportsAddItemAtOperation,},{target: index,until: untilIntegerValueIndex,},];},run(node: AddItemAtNode,options: never,[target, index]: [GraphNode, ValueNode<number>],context: never,state: AddItemAtNodeState,): GraphAction {const { item } = node.definition.properties;return state.memoized(target, item, index.definition.properties.value);},},},})

The implementation of the addItemAt node. See the addItemAt documentation for more information.

Const AddItemAtOperationType

AddItemAtOperationType: OperationType<"addItemAt", AddItemAtProperties> = createOperationType<'addItemAt', AddItemAtProperties>('addItemAt', {cacheable: false,shape: {index: types.number,value: graphTypes.nodeDefinition,},})

An implementation of the addItemAtOperation. See the addItemAtOperation documentation to find out more.

Const AddNodeType

AddNodeType: StatelessNodeType<"add", AddNodeProperties> = createNodeType<'add',AddNodeProperties>('add', {shape: {operands: types.arrayOf(graphTypes.nodeDefinition),},operations: {evaluate: {getDependencies({ operands }: AddNodeProperties): Array<NodeDependency> {return operands.map((operand) => ({target: operand,until: untilNumberValueNode(AddNodeType, 'operand'),}));},run(node: AddNode, options: never, operands: Array<ValueNode<number>>): NodeDefinition {const operandValues = operands.map((operand) => operand.definition.properties.value);return value(operandValues.reduce((total, value) => total + value, 0));},},},})

The implementation of the add node. See the add documentation to learn more.

Const AndNodeType

AndNodeType: StatelessNodeType<"and", AndNodeProperties> = createNodeType<'and',AndNodeProperties>('and', {shape: {operands: types.arrayOf(graphTypes.nodeDefinition),},operations: {evaluate: {getDependencies({ operands }: AndNodeProperties): Array<NodeDependency> {return operands.map((operand) => ({target: operand,until: {predicate: ValueNodeType.is,errorMessage(node: GraphNode): string {return getInvalidTypeErrorMessage('And node operands must resolve to value() nodes', {expected: ValueNodeType,received: node.definition,});},},}));},run(node: AndNode, options: never, operands: Array<ValueNode<any>>): NodeDefinition {return value(operands.every((operand) => Boolean(operand.definition.properties.value)));},},},})

The implementation of the and node. See the and documentation to learn more.

Const ApplyNodeType

ApplyNodeType: StatelessNodeType<"apply", ApplyNodeProperties> = createNodeType<'apply',ApplyNodeProperties>('apply', {shape: {target: types.oneOfType<NodeDefinition | GraphNode>([graphTypes.nodeDefinition,graphTypes.graphNode,]),args: types.oneOfType([types.arrayOf(types.oneOfType([graphTypes.nodeDefinition, graphTypes.graphNode])),types.objectOf(types.oneOfType([graphTypes.nodeDefinition, graphTypes.graphNode])),]),},operations: {evaluate: {getDependencies({ target }: ApplyNodeProperties): [NodeDependency] {return [{target,until: untilSupportsCallOperation,},];},run(node: ApplyNode, options: never, [subjectNode]: [CallableGraphNode]): GraphAction {const { args } = node.definition.properties;let argNodes: any;if (isCallArgumentArray(args)) {argNodes = args.map((arg) => (isGraphNode(arg) ? arg : withScopeFrom(node, arg)));} else {argNodes = mapValues(args, (arg) => (isGraphNode(arg) ? arg : withScopeFrom(node, arg)));}return createGraphAction(subjectNode, callOperation(argNodes));},},},})

The implementation of the apply node. See the apply documentation for more information.

Const ApplyTransformsNodeType

ApplyTransformsNodeType: StatelessNodeType<"applyTransforms", ApplyTransformsNodeProperties> = createNodeType<'applyTransforms', ApplyTransformsNodeProperties>('applyTransforms', {shape: {target: graphTypes.nodeDefinition,transforms: types.arrayOf(types.oneOfType([graphTypes.nodeDefinition, graphTypes.graphNode])),},operations: {getItems: {getDependencies({ target }: ApplyTransformsNodeProperties): Array<NodeDependency> {return [{target,until: untilSupportsGetItemOperation,},];},run(node: ApplyTransformsNode,operation: GetItemsOperation,[source]: [GraphNode],): GraphAction {const { transforms } = node.definition.properties;const scopedTransforms = [...transforms, ...operation.properties.transforms].map((transform) => (isNodeDefinition(transform) ? withScopeFrom(node, transform) : transform),);return createGraphAction(source, getItemsOperation(scopedTransforms));},},},})

The implementation of the applyTransforms node. See the applyTransforms documentation to learn more.

Const ArithmeticNodeTypes

ArithmeticNodeTypes: Array<NodeType> = [AddNodeType,CeilNodeType,ClampNodeType,DivideNodeType,FloorNodeType,MaxNodeType,MinNodeType,ModNodeType,MultiplyNodeType,PowNodeType,RoundNodeType,SqrtNodeType,SubtractNodeType,]

Const ArrayListNodeType

ArrayListNodeType: StatefulNodeType<"arrayList", ArrayListNodeProperties, ArrayListNodeState, ArrayListNodeData> = createNodeType<'arrayList', ArrayListNodeProperties, ArrayListNodeState, ArrayListNodeData>('arrayList',{state: {items: types.optional(graphTypes.nodeDefinition),poppedItem: types.optional(graphTypes.graphNode),shiftedItem: types.optional(graphTypes.graphNode),unshiftedItem: types.optional(graphTypes.graphNode),removeItems: types.objectOf(graphTypes.nodeDefinition),},shape: {items: types.arrayOf(graphTypes.nodeDefinition),},getInitialState(): ArrayListNodeState {return {items: undefined,poppedItem: undefined,shiftedItem: undefined,unshiftedItem: undefined,removeItems: {},};},onSubscribe(this: NodeExecutionContext<ArrayListNodeState, ArrayListNodeData>,node: ArrayListNode,) {if (this.getState().items) return;this.retain();this.setState((state) => ({...state,items: nodeList(node.definition.properties.items.map((item) => withUniqueId(node, item))),}));},operations: {addItemAt: {cacheable: false,run(): NodeDefinition {return ok();},onSubscribe(this: NodeExecutionContext<ArrayListNodeState, ArrayListNodeData>,node: ArrayListNode,operation: AddItemAtOperation,): void {const { index, value } = operation.properties;const clonedItems = this.getState().items!.properties.items.slice(0);const sanitizedIndex = Math.min(clonedItems.length - 1, index);clonedItems.splice(sanitizedIndex, 0, withUniqueId(node, value));this.setState((state) => ({...state,items: nodeList(clonedItems),}));},},clear: {cacheable: false,run(): NodeDefinition {return ok();},onSubscribe(this: NodeExecutionContext<ArrayListNodeState, ArrayListNodeData>,node: ArrayListNode,): void {this.setState((state) => ({...state,items: nodeList([]),}));},},evaluate: {run(node: ArrayListNode,options: never,dependencies: Array<never>,context: Array<never>,state: ArrayListNodeState,): NodeDefinition {return state.items!;},},length: {run(node: ArrayListNode,options: never,dependencies: Array<never>,context: Array<never>,state: ArrayListNodeState,): NodeDefinition {return value(state.items!.properties.items.length);},},contains: {run(node: ArrayListNode,operation: ContainsOperation,dependencies: Array<never>,contextDependencies: Array<never>,state: ArrayListNodeState,): NodeDefinition {const { item: otherItem, comparator } = operation.properties;return resolve(state.items!.properties.items.map((item) => ({target: apply([item, otherItem], comparator),until: untilBooleanValuePredicate,})),(results: Array<ValueNode<boolean>>) =>value(results.some((item) => item.definition.properties.value)),);},},pop: {cacheable: false,run(node: ArrayListNode,options: never,dependencies: Array<never>,context: Array<never>,state: ArrayListNodeState,): GraphNode {return state.poppedItem!;},onSubscribe(this: NodeExecutionContext<ArrayListNodeState, ArrayListNodeData>,node: ArrayListNode,): void {const items = this.getState().items!.properties.items;if (items.length === 0) {this.setState((state) => ({...state,poppedItem: withScopeFrom(node, nil()),}));return;}const remaining = items.slice(0);const last = remaining.pop()!;this.setState((state) => ({...state,items: nodeList(remaining),poppedItem: last,}));},},push: {cacheable: false,run(): NodeDefinition {return ok();},onSubscribe(this: NodeExecutionContext<ArrayListNodeState, ArrayListNodeData>,node: ArrayListNode,operation: PushOperation,): void {const { items } = this.getState().items!.properties;this.setState((state) => ({...state,items: nodeList([...items, withUniqueId(node, operation.properties.value)]),}));},},removeItem: {cacheable: false,run(): NodeDefinition {return ok();},onSubscribe(this: NodeExecutionContext<ArrayListNodeState, ArrayListNodeData>,node: ArrayListNode,operation: RemoveItemOperation,): void {const { items } = this.getState().items!.properties;const clonedItems = items.slice(0);const itemIndex = clonedItems.findIndex((item) => item.definition.properties.id === operation.properties.id,);if (itemIndex === -1) return;clonedItems.splice(itemIndex, 1);this.setState((state) => ({...state,items: nodeList(clonedItems),}));},},removeItemAt: {cacheable: false,run(): NodeDefinition {return ok();},onSubscribe(this: NodeExecutionContext<ArrayListNodeState, ArrayListNodeData>,node: ArrayListNode,operation: RemoveItemAtOperation,): void {const { index } = operation.properties;const { items } = this.getState().items!.properties;if (!Number.isInteger(index) || index < 0 || index > items.length - 1) return;this.setState((state) => ({...state,items: nodeList([...items.slice(0, operation.properties.index),...items.slice(operation.properties.index + 1),]),}));},},removeItems: {cacheable: false,run(node: ArrayListNode,operation: RemoveItemsOperation,dependencies: Array<never>,contextDependencies: Array<never>,state: ArrayListNodeState,): NodeDefinition {const { removeItems } = state;return removeItems[operation.id] || ok();},onSubscribe(this: NodeExecutionContext<ArrayListNodeState, ArrayListNodeData>,node: ArrayListNode,operation: RemoveItemsOperation,): void {const { predicate } = operation.properties;const { items } = this.getState().items!.properties;if (items.length === 0) {return;}this.setState((prevState) =>operation.id in prevState.removeItems? prevState: {...prevState,removeItems: {...prevState.removeItems,[operation.id]: resolve(items.map((item) => ({target: apply([item], predicate),until: untilBooleanValuePredicate,})),(processedResults: Array<ValueNode<boolean>>) => {this.setState((prevState) => {// If the array list has been mutated since this operation was subscribed, there// may now be some items which haven't been tested. These should NOT be removed.const { items: currentItems } = this.getState();const updatedItems = currentItems!.properties.items.filter((item, index) => {const processedItemIndex = items.findIndex((processedItem) => processedItem.id === item.id,);if (processedItemIndex === -1) {return true;}const result = processedResults[processedItemIndex];return !result.definition.properties.value;},);return {...prevState,items: nodeList(updatedItems),removeItems: omit(prevState.removeItems, operation.id),};});return ok();},),},},);},},shift: {cacheable: false,run(node: ArrayListNode,options: never,dependencies: Array<never>,context: Array<never>,state: ArrayListNodeState,): GraphNode {return state.shiftedItem!;},onSubscribe(this: NodeExecutionContext<ArrayListNodeState, ArrayListNodeData>,node: ArrayListNode,): void {const { items } = this.getState().items!.properties;if (!items || items.length === 0) {this.setState((state) => ({...state,shiftedItem: withScopeFrom(node, nil()),}));return;}const remaining = items.slice(0);const last = remaining.shift()!;this.setState((state) => ({...state,items: nodeList(remaining),shiftedItem: last,}));},},unshift: {cacheable: false,run(): NodeDefinition {return ok();},onSubscribe(this: NodeExecutionContext<ArrayListNodeState, ArrayListNodeData>,node: ArrayListNode,operation: UnshiftOperation,): void {const { items } = this.getState().items!.properties;this.setState((state) => ({...state,items: nodeList([withUniqueId(node, operation.properties.value), ...items]),}));},},},},)

The implementation of the arrayList node. See the arrayList documentation to learn more.

Const ArrayNodeType

ArrayNodeType: StatelessNodeType<"array", ArrayNodeProperties> = createNodeType<'array',ArrayNodeProperties>('array', {shape: {items: types.arrayOf(graphTypes.nodeDefinition),},operations: {getItems: {run(node: ArrayNode, operation: GetItemsOperation): NodeDefinition | GraphAction {const items = toGraphNodesWithIndices(node, node.definition.properties.items);const itemsNode = nodeList(items);return operation.properties.transforms.length === 0? itemsNode: createGraphAction(withScopeFrom(node, itemsNode), operation);},},iterate: {run(node: ArrayNode): NodeDefinition {const items = toGraphNodesWithIndices(node, node.definition.properties.items);if (items.length === 0) {return nil();}return iteratorResult(items[0], nodeList(items.slice(1)));},},length: {run(node: ArrayNode): NodeDefinition {return value(node.definition.properties.items.length);},},contains: {run(node: ArrayNode, operation: ContainsOperation): NodeDefinition {const items = toGraphNodesWithIndices(node, node.definition.properties.items);const { item: otherItem, comparator } = operation.properties;return resolve(items.map((item) => ({target: apply([item, otherItem], comparator),until: untilBooleanValueNodeItem,})),(results: Array<ValueNode<boolean>>) =>value(results.some((item) => item.definition.properties.value)),);},},},})

The implementation of the array. See the array documentation to learn more.

Const ArrayReducerNodeType

ArrayReducerNodeType: StatelessNodeType<"arrayReducer", ArrayReducerNodeProperties> = createNodeType('arrayReducer', {operations: {init: {run(): ValueNodeDefinition<ArrayReducerAccumulator> {return value([]);},},step: {run(node: ArrayReducerNode,operation: StepOperation<ArrayReducerAccumulator>,): ValueNodeDefinition<ArrayReducerAccumulator> {const { acc, item } = operation.properties;return value([...acc, item]);},},result: {run(node: ArrayReducerNode,operation: ResultOperation<ArrayReducerAccumulator>,): ValueNodeDefinition<NodeListNodeDefinition> {return value(nodeList(operation.properties.acc));},},},})

Const BatchRequestsMiddlewareNodeType

BatchRequestsMiddlewareNodeType: StatefulNodeType<"batch-requests-middleware", BatchRequestsMiddlewareNodeProperties, BatchRequestsMiddlewareNodeState, BatchRequestsMiddlewareNodeData> = createNodeType<'batch-requests-middleware',BatchRequestsMiddlewareNodeProperties,BatchRequestsMiddlewareNodeState,BatchRequestsMiddlewareNodeData>('batch-requests-middleware', {shape: {},state: {batcherResults: types.objectOf(graphTypes.nodeDefinition),},getInitialState() {return {batcherResults: {},};},onSubscribe() {this.setData({batchers: new Map(),});},onUnsubscribe() {const { batchers } = this.getData();if (!batchers) return;for (const batcher of batchers.values()) {batcher.dispose();}},operations: {request: {run(node: BatchRequestsMiddlewareNode,operation: RequestOperation,dependencies: never,context: never,state: BatchRequestsMiddlewareNodeState,): NodeDefinition | GraphNode {const { metadata, next, query } = operation.properties;if (!next) {return error('Missing `next` middleware.');}if (!isQuerySetNodeDefinition(query)) {return withScopeFrom(next, traverse(next.definition, requestOperation(query, metadata)));}return state.batcherResults[query.properties.root.id] || pending();},onSubscribe(this: NodeExecutionContext<BatchRequestsMiddlewareNodeState,BatchRequestsMiddlewareNodeData>,node: BatchRequestsMiddlewareNode,operation: RequestOperation,): void {const { metadata, next, query } = operation.properties;// Check if the query is of a supported type or the next middleware is undefinedif (!next || !isQuerySetNodeDefinition(query)) return;const batchers = this.getData().batchers!;const { children, root } = query.properties;let currentBatcher = batchers.get(root.id);if (!currentBatcher) {currentBatcher = new RequestBatcher((node, operation, callback) => node.scope.store.subscribe(node, operation, callback),next,root,(value) => {this.setState((state) => ({...state,batcherResults: {...state.batcherResults,[root.id]: value,},}));},);batchers.set(root.id, currentBatcher);}this.setState((state) => ({...state,batcherResults: omit(state.batcherResults, root.id),}));currentBatcher.setRequest(children as Array<SerializableQuerySetChild>, metadata);},onUnsubscribe(this: NodeExecutionContext<BatchRequestsMiddlewareNodeState,BatchRequestsMiddlewareNodeData>,node: BatchRequestsMiddlewareNode,operation: RequestOperation,): void {const { query } = operation.properties;if (!isQuerySetNodeDefinition(query)) return;const { root } = query.properties;this.setState((state) => ({...state,batcherResults: omit(state.batcherResults, root.id),}));},},},})

Const BrowserNodeTypes

BrowserNodeTypes: Array<NodeType> = [LocationNodeType,LocationDataNodeType,LocationPathNodeType,]

Const CACHED_INSTANCES

CACHED_INSTANCES: GraphOperation<string, ResolveProperties, ResolveProperties, OperationType<"resolve", ResolveProperties, ResolveProperties>>[] = [// TODO: Cleanup the `as ResolveProperties`createGraphOperation(ResolveOperationType, {until: undefined,allowErrors: false,allowPending: false,acceptNil: false,} as ResolveProperties),createGraphOperation(ResolveOperationType, {until: undefined,allowErrors: false,allowPending: false,acceptNil: true,} as ResolveProperties),createGraphOperation(ResolveOperationType, {until: undefined,allowErrors: false,allowPending: true,acceptNil: false,} as ResolveProperties),createGraphOperation(ResolveOperationType, {until: undefined,allowErrors: false,allowPending: true,acceptNil: true,} as ResolveProperties),createGraphOperation(ResolveOperationType, {until: undefined,allowErrors: true,allowPending: false,acceptNil: false,} as ResolveProperties),createGraphOperation(ResolveOperationType, {until: undefined,allowErrors: true,allowPending: false,acceptNil: true,} as ResolveProperties),createGraphOperation(ResolveOperationType, {until: undefined,allowErrors: true,allowPending: true,acceptNil: false,} as ResolveProperties),createGraphOperation(ResolveOperationType, {until: undefined,allowErrors: true,allowPending: true,acceptNil: true,} as ResolveProperties),]

Const CONTEXT

CONTEXT: unique symbol = Symbol.for('muster::CONTEXT')

Const CallNodeType

CallNodeType: StatefulNodeType<"call", CallNodeProperties, CallNodeState, CallNodeData> = createNodeType<'call', CallNodeProperties, CallNodeState, CallNodeData>('call', {shape: {target: graphTypes.nodeDefinition,args: types.optional(types.oneOfType([types.arrayOf(types.oneOfType([graphTypes.nodeDefinition, graphTypes.graphNode])),types.objectOf(types.oneOfType([graphTypes.nodeDefinition, graphTypes.graphNode])),]),),},state: {currentValue: types.oneOfType([graphTypes.nodeDefinition, graphTypes.graphNode]),},getInitialState() {return {currentValue: pending(),};},operations: {evaluate: {cacheable: false,run(node: CallNode,options: never,dependencies: never,context: never,state: CallNodeState,): GraphNode | NodeDefinition {return state.currentValue;},onSubscribe(this: NodeExecutionContext<CallNodeState, CallNodeData>, node: CallNode): void {const { target } = node.definition.properties;const updateState = ([result]: [GraphNode]) => {this.setState({ currentValue: result });return result;};this.setState({currentValue: resolve([{ target, until: untilSupportsCallOperation }], ([targetNode]) => {const { args } = node.definition.properties;let argNodes: CallArgumentMap | CallArgumentArray | undefined;if (args) {argNodes = isCallArgumentMap(args)? mapValues(args, (arg) => (isGraphNode(arg) ? arg : withScopeFrom(node, arg))): args.map((arg) => (isGraphNode(arg) ? arg : withScopeFrom(node, arg)));}const traverseTarget = traverse(targetNode.definition, callOperation(argNodes));return resolve([{ target: withScopeFrom(targetNode, traverseTarget) }], updateState);}),});},},},})

The implementation of a call node. See the call documentation for more information.

Const CallOperationType

CallOperationType: OperationType<"call", CallProperties> = createOperationType<'call',CallProperties>('call', {cacheable: false,shape: {args: types.optional(types.oneOfType([types.arrayOf(types.oneOfType([graphTypes.graphNode, graphTypes.nodeDefinition])),types.objectOf(types.oneOfType([graphTypes.graphNode, graphTypes.nodeDefinition])),]),),},})

An implementation of the callOperation. See the callOperation documentation to find out more.

Const CancelToken

CancelToken: CancelTokenStatic = axios.CancelToken

Const CatchErrorNodeType

CatchErrorNodeType: StaticNodeType<"catch-error", CatchErrorNodeProperties> = createNodeType<'catch-error', CatchErrorNodeProperties>('catch-error', {deserialize: false,serialize: false,shape: {fallbackGenerator: types.saveHash(types.func),target: graphTypes.nodeDefinition,},})

The implementation of the catchError. See the catchError documentation to learn more.

Const CeilNodeType

CeilNodeType: StatelessNodeType<"ceil", CeilNodeProperties> = createNodeType<'ceil',CeilNodeProperties>('ceil', {shape: {target: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ target }: CeilNodeProperties): Array<NodeDependency> {return [{ target, until: untilNumberValueNode(CeilNodeType, 'target') }];},run(node: CeilNode, options: never, [target]: [ValueNode<number>]): NodeDefinition {return toValue(Math.ceil(target.definition.properties.value));},},},})

The implementation of the ceil node. See the ceil documentation to learn more.

Const CharAtNodeType

CharAtNodeType: StatelessNodeType<"char-at", CharAtNodeProperties> = createNodeType<'char-at',CharAtNodeProperties>('char-at', {shape: {index: graphTypes.nodeDefinition,subject: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ index, subject }: CharAtNodeProperties): Array<NodeDependency> {return [{target: index,until: untilPositiveIntegerValueNode(CharAtNodeType, 'index'),},{target: subject,acceptNil: true,until: untilStringValueNode(CharAtNodeType, 'subject'),},];},run(node: CharAtNode,options: never,[index, subject]: [ValueNode<number>, ValueNode<string>],): NodeDefinition {if (NilNodeType.is(subject)) return nil();const indexValue = index.definition.properties.value;const content = subject.definition.properties.value;if (indexValue >= content.length) return nil();return value(content.charAt(indexValue));},},},})

The implementation of the charAt node. See the charAt documentation to learn more.

Const ChooseNodeType

ChooseNodeType: StatelessNodeType<"choose", ChooseNodeProperties> = createNodeType<'choose',ChooseNodeProperties>('choose', {shape: {options: types.arrayOf(graphTypes.nodeDefinition),fallback: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ options }: ChooseNodeProperties): Array<NodeDependency> {return options.map((option) => ({target: option.properties.pattern,until: untilConditionIsValueNode,}));},run(node: ChooseNode, operation: never, conditions: Array<ValueNode<any>>): NodeDefinition {const { fallback, options } = node.definition.properties;const matchIndex = conditions.findIndex((condition) =>Boolean(condition.definition.properties.value),);if (matchIndex === -1) {return fallback.properties.value;}return options[matchIndex].properties.value;},},},})

The implementation of the choose node. See the choose documentation to learn more.

Const ClampNodeType

ClampNodeType: StatelessNodeType<"clamp", ClampNodeProperties> = createNodeType<'clamp',ClampNodeProperties>('clamp', {shape: {max: graphTypes.nodeDefinition,min: graphTypes.nodeDefinition,value: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ max, min, value }: ClampNodeProperties): Array<NodeDependency> {return [{ target: max, until: untilNumberValueNode(ClampNodeType, 'max') },{ target: min, until: untilNumberValueNode(ClampNodeType, 'min') },{ target: value, until: untilNumberValueNode(ClampNodeType, 'value') },];},run(node: ClampNode,options: never,[max, min, value]: [ValueNode<number>, ValueNode<number>, ValueNode<number>],): NodeDefinition {const maxNumber = max.definition.properties.value;const minNumber = min.definition.properties.value;const valueNumber = value.definition.properties.value;return toValue(Math.min(Math.max(valueNumber, minNumber), maxNumber));},},},})

The implementation of the clamp node. See the clamp documentation to learn more.

Const ClearNodeType

ClearNodeType: StatelessNodeType<"clear", ClearNodeProperties> = createNodeType<'clear',ClearNodeProperties>('clear', {shape: {target: graphTypes.nodeDefinition,},operations: {evaluate: {cacheable: false,getDependencies({ target }: ClearNodeProperties): [NodeDependency] {return [{target,until: untilSupportsClearOperation,},];},run(node: ClearNode,options: never,[target]: [GraphNode, ValueNode<number>],context: never,): GraphAction {return createGraphAction(target, clearOperation());},},},})

The implementation of the clear node. See the clear documentation for more information.

Const ClearOperationType

ClearOperationType: OperationType<"clear", ClearProperties> = createOperationType<'clear',ClearProperties>('clear', {cacheable: false,})

An implementation of the clearOperation. See the clearOperation documentation to find out more.

Const CollectionNodeTypes

CollectionNodeTypes: Array<NodeType> = [...KeysNodeTypes,...TransformsNodeTypes,AddItemAtNodeType,ApplyTransformsNodeType,ArrayNodeType,ArrayListNodeType,ArrayReducerNodeType,ContainsNodeType,HeadNodeType,ItemWithIdNodeType,IterateNodeType,NodeListNodeType,PopNodeType,PushNodeType,ReduceNodeType,RemoveItemNodeType,RemoveItemAtNodeType,RemoveItemsNodeType,ShiftNodeType,TransduceNodeType,UnshiftNodeType,]

Const CombineLatestNodeType

CombineLatestNodeType: StatelessNodeType<"combineLatest", CombineLatestNodeProperties> = createNodeType<'combineLatest', CombineLatestNodeProperties>('combineLatest', {shape: {operations: types.arrayOf(graphTypes.nodeDefinition),},operations: {evaluate: {cacheable: false,getDependencies({ operations }: CombineLatestNodeProperties): Array<NodeDependency> {return operations.map((operation) => ({ target: operation }));},run(node: CombineLatestNode, options: never, dependencies: Array<GraphNode>): NodeDefinition {return array(dependencies.map((node) => node.definition));},},},})

The implementation of the combineLatest. See the combineLatest documentation page to lear more.

Const CombinedMiddlewareNodeType

CombinedMiddlewareNodeType: StatelessNodeType<"combined-middleware", CombinedMiddlewareNodeProperties> = createOperationComposer<'combined-middleware',RequestOperation['type']['name'],RequestOperation>('combined-middleware', ['request'])

Const CombinedReducerNodeType

CombinedReducerNodeType: StatelessNodeType<"combinedReducer", CombinedReducerNodeProperties> = createOperationComposer<'combinedReducer',TransformOperation['type']['name'],TransformOperation>('combinedReducer', ['init', 'step', 'result'])

Const ContainsNodeType

ContainsNodeType: StatelessNodeType<"contains", ContainsNodeProperties> = createNodeType<'contains', ContainsNodeProperties>('contains', {shape: {item: graphTypes.nodeDefinition,target: graphTypes.nodeDefinition,comparator: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ target }: ContainsNodeProperties): Array<NodeDependency> {return [{target,until: {predicate: supportsContainsOperation,errorMessage(node: GraphNode) {return getInvalidTypeErrorMessage('Target node does not support contains operation',{ received: node.definition },);},},},];},run(node: ContainsNode, operation: never, [target]: [GraphNode]): GraphAction {const { item, comparator } = node.definition.properties;return createGraphAction(target, containsOperation(item, comparator));},},},})

The implementation of the contains. See the contains documentation for more information.

Const ContainsOperationType

ContainsOperationType: OperationType<"contains", ContainsProperties> = createOperationType<'contains', ContainsProperties>('contains', {shape: {item: graphTypes.nodeDefinition,comparator: graphTypes.nodeDefinition,},})

An implementation of the containsOperation. See the containsOperation documentation to find out more.

Const ContextNodeType

ContextNodeType: StatelessNodeType<"context", ContextNodeProperties> = createNodeType<'context',ContextNodeProperties>('context', {shape: {name: types.oneOfType<string | symbol>([types.string, types.symbol]),},operations: {evaluate: {getContextDependencies({ name }: ContextNodeProperties): [ContextDependency] {return [{ name, required: true, until: shallow }];},run(node: ContextNode,options: never,dependencies: Array<never>,[contextNode]: [GraphNode],): GraphNode {return contextNode;},},},})

The implementation of the context node. See the context documentation to learn more.

Const CountNodeType

CountNodeType: StatelessNodeType<"count", CountNodeProperties> = createNodeType('count',{operations: {transformItems: {run(node: CountNode, operation: TransformItemsOperation): NodeDefinition {return nodeList([withScopeFrom(node, value(operation.properties.items.length))]);},},init: {run(node: CountNode): NodeDefinition {const initialState = 0;return value(initialState);},},step: {run(node: CountNode, operation: StepOperation<number>): NodeDefinition {return value(operation.properties.acc + 1);},},result: {run(node: CountNode, operation: ResultOperation<number>): NodeDefinition {const { acc, next } = operation.properties;const finalValue = array([value(acc)]);return next ? value(transduce(finalValue, [next])) : value(finalValue);},},},},)

The implementation of the count node. See the count documentation for more information.

Const CreateBehaviorNodeType

CreateBehaviorNodeType: StatelessNodeType<"createBehavior", CreateBehaviorNodeProperties> = createNodeType<'createBehavior', CreateBehaviorNodeProperties>('createBehavior', {serialize: false,deserialize: false,shape: {operations: types.objectOf(types.saveHash(types.func)),},operations: {[WILDCARD_OPERATION]: {run(node: CreateBehaviorNode, operation: GraphOperation): NodeDefinition {const operationHandler = node.definition.properties.operations[operation.type.name];if (!operationHandler) {return error(getInvalidTypeError(`This createBehavior node does not implement the '${operation.type.name}' operation.`,{expected: Object.keys(node.definition.properties.operations),received: operation.type.name,},),);}return operationHandler(getParams(node.context), operation.properties);},},},})

Implementation of the createBehavior. See the createBehavior documentation for more information.

Const CreateCallerNodeType

CreateCallerNodeType: StaticNodeType<"createCaller", CreateCallerNodeProperties> = createNodeType<'createCaller', CreateCallerNodeProperties>('createCaller', {shape: {key: types.saveHash(types.any),disposeEmitter: types.optional(types.saveHash(types.func)),matcher: types.saveHash(types.func),},})

The implementation of the createCaller. See the createCaller documentation to learn more.

Const CreateSetterNodeType

CreateSetterNodeType: StaticNodeType<"createSetter", CreateSetterNodeProperties> = createNodeType<'createSetter', CreateSetterNodeProperties>('createSetter', {shape: {key: types.saveHash(types.any),disposeEmitter: types.optional(types.saveHash(types.func)),matcher: types.saveHash(types.func),},})

The implementation of the createSetter node. See the createSetter documentation to learn more.

Const DEFAULT

DEFAULT: symbol = Symbol('DEFAULT')

Const DEFAULT_NODE_TYPES

DEFAULT_NODE_TYPES: Array<NodeType> = [...ArithmeticNodeTypes,...BrowserNodeTypes,...CollectionNodeTypes,...GraphNodeTypes,...LogicNodeTypes,...RemoteNodeTypes,...StringNodeTypes,]

Const DebugNodeType

DebugNodeType: StatelessNodeType<"debug", DebugNodeProperties> = createNodeType<'debug',DebugNodeProperties>('debug', {serialize: false,deserialize: false,shape: {target: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ target }: DebugNodeProperties): [NodeDependency] {return [{target,allowPending: true,allowErrors: true,acceptNil: true,},];},run(node: DebugNode, options: never, [targetValue]: [GraphNode]): NodeDefinition {const { target } = node.definition.properties;const input = target;const resolved = targetValue.definition;window.console.log({ input, resolved });debugger;return target;},},},})

The implementation of the debug. See the debug documentation to learn more.

Const DeferNodeType

DeferNodeType: StaticNodeType<"defer", DeferNodeProperties> = createNodeType<'defer',DeferNodeProperties>('defer', {deserialize: false,serialize: false,shape: {fallbackGenerator: types.saveHash(types.func),target: graphTypes.nodeDefinition,},})

The implementation of the defer. See the defer documentation to learn more.

Const DispatchNodeType

DispatchNodeType: StatelessNodeType<"dispatch", DispatchNodeProperties> = createNodeType<'dispatch', DispatchNodeProperties>('dispatch', {shape: {event: graphTypes.event,},operations: {evaluate: {cacheable: false,run(node: DispatchNode): NodeDefinition {const { event } = node.definition.properties;node.scope.events.emit(event);return ok();},},},})

The implementation of the dispatch. See the dispatch documentation to learn more.

Const DivideNodeType

DivideNodeType: StatelessNodeType<"divide", DivideNodeProperties> = createNodeType<'divide',DivideNodeProperties>('divide', {shape: {operands: types.arrayOf(graphTypes.nodeDefinition),},operations: {evaluate: {getDependencies({ operands }: DivideNodeProperties): Array<NodeDependency> {return operands.map((operand) => ({target: operand,until: untilNumberValueNode(DivideNodeType, 'operand'),}));},run(node: DivideNode, options: never, operands: Array<ValueNode<number>>): NodeDefinition {assertEnoughOperands(operands);const operandValues = operands.map((operand) => operand.definition.properties.value);return value(operandValues.reduce((total, value) => total / value));},},},})

The implementation of the divide node. See the divide documentation to learn more.

Const DoneNodeType

DoneNodeType: StaticNodeType<"done", DoneNodeProperties> = createNodeType<'done',DoneNodeProperties>('done', {shape: {value: types.optional(types.oneOfType<NodeDefinition | GraphNode>([graphTypes.nodeDefinition,graphTypes.graphNode,]),),},})

An implementation of the done node. See the done documentation to find out more.

Const EMPTY_CONTEXT_DEPENDENCIES

EMPTY_CONTEXT_DEPENDENCIES: Array<never> = []

Const EMPTY_HASH_SET

EMPTY_HASH_SET: Set<string> = createHashSet()

Const EMPTY_STACK

EMPTY_STACK: Stack<CachedAction> = createStack<CachedAction>()

Const EVENT_RESET_VARIABLE

EVENT_RESET_VARIABLE: "$$event:reset-variable" = "$$event:reset-variable"

Const EmptyItemNodeType

EmptyItemNodeType: StaticNodeType<"empty-item", EmptyItemNodeProperties> = createNodeType<'empty-item', EmptyItemNodeProperties>('empty-item', {shape: {},})

An implementation of the emptyItem node. See the emptyItem documentation to find out more.

Const EndsWithNodeType

EndsWithNodeType: StatelessNodeType<"ends-with", EndsWithNodeProperties> = createNodeType<'ends-with', EndsWithNodeProperties>('ends-with', {shape: {pattern: graphTypes.nodeDefinition,subject: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ pattern, subject }: EndsWithNodeProperties): Array<NodeDependency> {return [{target: pattern,until: untilStringValueNode(EndsWithNodeType, 'pattern'),},{target: subject,acceptNil: true,until: untilStringValueNode(EndsWithNodeType, 'subject'),},];},run(node: EndsWithNode,options: never,[pattern, subject]: [ValueNode<string>, ValueNode<string>],): NodeDefinition {if (NilNodeType.is(subject)) return value(false);const patternValue = pattern.definition.properties.value;const subjectValue = subject.definition.properties.value;return value((subjectValue || '').endsWith(patternValue));},},},})

The implementation of the endsWith node. See the endsWith documentation to learn more.

Const EntriesNodeType

EntriesNodeType: StaticNodeType<"entries", EntriesNodeProperties> = createNodeType<'entries',EntriesNodeProperties>('entries', {shape: {children: types.optional(graphTypes.nodeDefinition),},})

The implementation of the entries. See the entries documentation to learn more.

Const EqNodeType

EqNodeType: StatelessNodeType<"eq", EqNodeProperties> = createNodeType<'eq',EqNodeProperties>('eq', {shape: {left: graphTypes.nodeDefinition,right: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ left, right }: EqNodeProperties): Array<NodeDependency> {return [left, right].map((operand) => ({target: operand,until: {predicate: ValueNodeType.is,errorMessage(node: GraphNode): string {return getInvalidTypeErrorMessage('Eq node operands must resolve to value() nodes', {expected: ValueNodeType,received: node.definition,});},},}));},run(node: EqNode,options: never,[left, right]: [ValueNode<number>, ValueNode<number>],): NodeDefinition {const leftValue = left.definition.properties.value;const rightValue = right.definition.properties.value;return value(leftValue === rightValue);},},},})

The implementation of the eq node. See the eq documentation to learn more.

Const ErrorNodeType

ErrorNodeType: StaticNodeType<"error", ErrorNodeProperties, SerializedErrorNodeProperties> = createNodeType<'error', ErrorNodeProperties, SerializedErrorNodeProperties>('error', {shape: {error: types.shape({message: types.string,stack: types.ignore,}),code: types.optional(types.string),data: types.optional(types.saveHash(types.any)),path: types.optional(types.saveHash(types.arrayOf(types.any))),remotePath: types.optional(types.saveHash(types.arrayOf(types.any))),},serialize(properties: ErrorNodeProperties): SerializedErrorNodeProperties {const { error, code, data, path, remotePath } = properties;return {error: error instanceof Error ? { message: error.message, stack: error.stack } : error,code,data,path,remotePath,};},deserialize(data: SerializedErrorNodeProperties): ErrorNodeProperties {const safeData = data || {};const error = safeData.error || new Error('Unknown error');return {error,code: safeData.code,data: safeData.data,path: safeData.path,remotePath: safeData.remotePath,};},})

The implementation of the error node. See the error documentation to learn more.

Const EvaluateOperationType

EvaluateOperationType: OperationType<"evaluate"> = createOperationType<'evaluate'>('evaluate',)

An implementation of the evaluateOperation. See the evaluateOperation documentation to find out more.

Const ExtendNodeType

ExtendNodeType: StatelessNodeType<"extend", ExtendNodeProperties> = createNodeType<'extend',ExtendNodeProperties>('extend', {shape: {nodes: types.arrayOf(graphTypes.nodeDefinition),},operations: {getChild: {run(node: ExtendNode, operation: GetChildOperation): NodeDefinition {return resolveChildNode(node, node.definition.properties.nodes, operation.properties.key);},},},})

The implementation of the extend. See the extend documentation to learn more.

Const ExternalStatefulNodeType

ExternalStatefulNodeType: StatefulNodeType<"stateful", ExternalStatefulNodeProperties<any>, ExternalStatefulNodeState> = createNodeType<'stateful', ExternalStatefulNodeProperties<any>, ExternalStatefulNodeState>('stateful',{state: {currentValue: types.oneOfType([graphTypes.nodeDefinition, graphTypes.graphNode]),},shape: {valueStream: types.saveHash(types.any),},getInitialState(): ExternalStatefulNodeState {return {currentValue: pending(),};},serialize: false,deserialize: false,operations: {evaluate: {run(node: ExternalStatefulNode<any>,options: never,dependencies: Array<never>,context: Array<never>,state: ExternalStatefulNodeState,): NodeDefinition | GraphNode {return state.currentValue;},onSubscribe(this: NodeExecutionContext<ExternalStatefulNodeState, ExternalStatefulNodeData>,node: ExternalStatefulNode<any>,): void {const subscription = node.definition.properties.valueStream.subscribe((v) => {this.setState((s) => ({...s,currentValue: isGraphNode(v) ? v : toValue(v),}));});this.setData({subscription,});},onUnsubscribe(this: NodeExecutionContext<ExternalStatefulNodeState, ExternalStatefulNodeData>,): void {const subscription = this.getData().subscription;subscription && subscription.unsubscribe();},},},},)

The implementation of the stateful node. See the stateful documentation to learn more.

Const FACTORY

FACTORY: unique symbol = Symbol('HASH_FACTORY')

Const FLUSH

FLUSH: "$$event:flush" = "$$event:flush"

Const FactoryNodeType

FactoryNodeType: StatefulNodeType<"factory", FactoryNodeProperties, FactoryNodeState, FactoryNodeData> = createNodeType<'factory', FactoryNodeProperties, FactoryNodeState, FactoryNodeData>('factory', {state: {instance: graphTypes.nodeDefinition,},serialize: false,deserialize: false,shape: {factory: types.saveHash(types.func),},getInitialState(): FactoryNodeState {return {instance: pending(),};},operations: {evaluate: {run(node: FactoryNode,options: never,dependencies: Array<never>,contextDependencies: Array<never>,state: FactoryNodeState,): NodeDefinition {const { instance } = state;return instance;},onSubscribe(this: NodeExecutionContext<FactoryNodeState, FactoryNodeData>,node: FactoryNode,): void {const { factory } = node.definition.properties;this.setState({instance: factory(),});},onInvalidate(this: NodeExecutionContext<FactoryNodeState, FactoryNodeData>,node: FactoryNode,): void {const { factory } = node.definition.properties;this.setState({instance: factory(),});},onUnsubscribe(this: NodeExecutionContext<FactoryNodeState, FactoryNodeData>,node: FactoryNode,): void {this.setState({instance: pending(),});},},},})

The implementation of the factory. See the factory documentation to learn more.

Const FetchItemsNodeType

FetchItemsNodeType: StaticNodeType<"fetch-items", FetchItemsNodeProperties> = createNodeType<'fetch-items', FetchItemsNodeProperties>('fetch-items', {shape: {target: graphTypes.nodeDefinition,},operations: {getItems: {getDependencies({ target }: FetchItemsNodeProperties): Array<NodeDependency> {return [{target,until: untilSupportsGetItemOperation,},];},run(node: FetchItemsNode, operation: GetItemsOperation, [target]: [GraphNode]) {if (NilNodeType.is(target)) return target;const { transforms } = operation.properties;return resolve([{ target: traverse(target, getItemsOperation()), until: untilPlaceholderOrItems }],([items]: [GraphNode]) => {if (NilNodeType.is(items)) return items;if (!PlaceholderNodeType.is(items)) {return createGraphAction(items, getItemsOperation(transforms));}return applyTransforms(withScopeFrom(items, nodeList([items])) as NodeListNode,transforms,);},);},},},})

An implementation of the fetchItems node. See the fetchItems documentation to find out more.

Const FieldsNodeType

FieldsNodeType: StaticNodeType<"fields", FieldsNodeProperties, SerializedFieldsNodeProperties> = createNodeType<'fields', FieldsNodeProperties, SerializedFieldsNodeProperties>('fields', {shape: {fields: types.objectOf(graphTypes.nodeDefinition),},serialize<T>({ fields }: FieldsNodeProperties,serialize: (node: NodeDefinition) => T,): SerializedFieldsNodeProperties<T> {return {fields: mapValues(fields, (field) => serialize(field)),};},deserialize<T>({ fields }: SerializedFieldsNodeProperties<T>,deserialize: (node: T) => NodeDefinition,): FieldsNodeProperties {return {fields: mapValues(fields, (field) => deserialize(field)),};},})

The implementation of the fields node. See the fields documentation to learn more.

Const FilterNodeType

FilterNodeType: StatelessNodeType<"filter", FilterNodeProperties> = createNodeType('filter',{shape: {predicate: graphTypes.nodeDefinition,},operations: {transformItems: {getDependencies({ predicate }: FilterNodeProperties,operation: TransformItemsOperation,): Array<NodeDependency> {return operation.properties.items.map((item) => ({target: apply([item], predicate),until: untilIsValueNode,}));},run(node: FilterNode,operation: TransformItemsOperation,filterResults: Array<ValueNode<any>>,): NodeDefinition {const { items } = operation.properties;const filterValues = filterResults.map((result) => result.definition.properties.value);return nodeList((zip<GraphNode | ValueNode<any>>(items, filterValues) as Array<[GraphNode, ValueNode<any>]>).filter(([item, filterValue]) => Boolean(filterValue)).map(([item]) => item),);},},init: {run(node: FilterNode, operation: InitOperation): NodeDefinition | GraphAction {const { next } = operation.properties;if (!next) {return error('Filter reducer cannot be used as a base reducer');}return createGraphAction(next, init());},},step: {getDependencies({ predicate }: FilterNodeProperties,operation: StepOperation<any>,): [NodeDependency] {return [{target: apply([operation.properties.item], predicate),until: untilIsValueNode,},];},run(node: FilterNode,operation: StepOperation<any>,[result]: [ValueNode<any>],): NodeDefinition | GraphAction {const { acc, item, next } = operation.properties;if (!next) {return error('Filter reducer cannot be used as a base reducer');}const { value: resultValue } = result.definition.properties;return resultValue ? createGraphAction(next, step(acc, item)) : value(acc);},},result: {run(node: FilterNode, operation: ResultOperation<any>): NodeDefinition | GraphAction {const { acc, next } = operation.properties;if (!next) {return error('Filter reducer cannot be used as a base reducer');}return createGraphAction(next, result(acc));},},},},)

The implementation of the filter node. See the filter documentation to learn more.

Const FirstItemNodeType

FirstItemNodeType: StatelessNodeType<"firstItem", FirstItemNodeProperties> = createNodeType('firstItem', {operations: {transformItems: {run(node: FirstItemNode, operation: TransformItemsOperation): NodeDefinition {return nodeList(operation.properties.items.slice(0, 1));},},init: {run(node: FirstItemNode, operation: InitOperation): NodeDefinition | GraphAction {const { next } = operation.properties;return next ? createGraphAction(next, init()) : value(undefined);},},step: {run(node: FirstItemNode, operation: StepOperation<any>): NodeDefinition {const { acc, item, next } = operation.properties;return done(next ? traverse(next, step(acc, item)) : value(item));},},result: {run(node: FirstItemNode, operation: ResultOperation<any>): NodeDefinition | GraphAction {const { acc, next } = operation.properties;return next ? createGraphAction(next, result(acc)) : value(nodeList(acc ? [acc] : []));},},},})

The implementation of the firstItem node. See the firstItem documentation to learn more.

Const FirstNodeType

FirstNodeType: StaticNodeType<"first"> = createNodeType<'first'>('first')

An implementation of the first node. See the first documentation to find out more.

Const FloorNodeType

FloorNodeType: StatelessNodeType<"floor", FloorNodeProperties> = createNodeType<'floor',FloorNodeProperties>('floor', {shape: {target: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ target }: FloorNodeProperties): Array<NodeDependency> {return [{ target, until: untilNumberValueNode(FloorNodeType, 'target') }];},run(node: FloorNode, options: never, [target]: [ValueNode<number>]): NodeDefinition {return toValue(Math.floor(target.definition.properties.value));},},},})

The implementation of the floor node. See the floor documentation to learn more.

Const FlowNodeType

FlowNodeType: StatelessNodeType<"flow", FlowNodeProperties> = createNodeType<'flow',FlowNodeProperties>('flow', {shape: {functions: types.arrayOf(graphTypes.nodeDefinition),},operations: {call: {run(node: FlowNode, operation: CallOperation) {return composeApplyNodes(node.definition.properties.functions, operation.properties.args);},},},})

The implementation of the flow node. See the flow documentation for more information.

Const FnNodeType

FnNodeType: StatelessNodeType<"fn", FnNodeProperties> = createNodeType<'fn',FnNodeProperties>('fn', {shape: {argIds: types.arrayOf(types.string),body: graphTypes.nodeDefinition,hasNamedArgs: types.bool,},operations: {call: {run(node: FnNode, operation: CallOperation): NodeDefinition | GraphNode {const { argIds, body, hasNamedArgs } = node.definition.properties;const { args } = operation.properties;if (hasNamedArgs) {// Handle calling function with named argumentsif (args && isCallArgumentArray(args)) {return error('An fn() expected to have been called with named arguments, ' +'but was called with an array of arguments.',);}const receivedArgsNames = args ? Object.keys(args) : [];const isMissingArguments = argIds.some((name) => !receivedArgsNames.includes(name));if (isMissingArguments) {return error(getInvalidTypeError('An fn() was called with unexpected number of arguments.', {expected: argIds,received: receivedArgsNames,}),);}const sanitizedArgs = fromPairs(toPairs(args).map(([name, value]) => [`$$named-arg:${name}`,isGraphNode(value) ? value : withScopeFrom(node, value),]),);const childContext = createContext(node.context, sanitizedArgs);return createGraphNode(node.scope, childContext, body);}// Handle calling function with an array of argumentsif (args && isCallArgumentMap(args)) {return error('An fn() expected to have been called with an array of arguments, ' +'but was called with named arguments.',);}if ((!args && argIds.length > 0) || (args && args.length < argIds.length)) {return error(getInvalidTypeError('Too few arguments applied to fn.', {expected: argIds.length,received: args ? args.length : 0,}),);}const trimmedArgs = (args ? args.slice(0, argIds.length) : []).map((arg) =>isGraphNode(arg) ? arg : withScopeFrom(node, arg),);const context = fromPairs(zip<string | GraphNode>(argIds, trimmedArgs) as Array<[string, GraphNode]>);const childContext = createContext(node.context, context);return createGraphNode(node.scope, childContext, body);},},},})

The implementation of the fn. See the fn documentation to learn more.

Const FormatNodeType

FormatNodeType: StatelessNodeType<"format", FormatNodeProperties> = createNodeType<'format',FormatNodeProperties>('format', {shape: {format: types.string,data: types.arrayOf(types.arrayOf(types.oneOfType<string | NodeDefinition>([types.string, graphTypes.nodeDefinition]),),),},operations: {evaluate: {getDependencies({ data }: FormatNodeProperties): Array<NodeDependency> {return data.map(([key, dependency]) => ({target: dependency,until: untilStringValueNode(FormatNodeType, `data.${key}`),}));},run(node: FormatNode,options: never,dependencies: Array<ValueNode<string>>,): NodeDefinition {const data = buildFormatInput(node.definition.properties.data, dependencies);return value(es6TemplateStrings(node.definition.properties.format, data));},},},})

The implementation of the format node. See the format documentation to learn more.

Const FromBase64NodeType

FromBase64NodeType: StatelessNodeType<"from-base64", FromBase64NodeProperties> = createNodeType<'from-base64', FromBase64NodeProperties>('from-base64', {shape: {subject: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ subject }: FromBase64NodeProperties): Array<NodeDependency> {return [{target: subject,acceptNil: true,until: untilStringValueNode(FromBase64NodeType, 'subject'),},];},run(node: FromBase64Node, options: never, [subject]: [ValueNode<string>]): NodeDefinition {if (NilNodeType.is(subject)) return nil();return value(atob(subject.definition.properties.value));},},},})

The implementation of the fromBase64 node. See the fromBase64 documentation to learn more.

Const FromPromiseNodeType

FromPromiseNodeType: StatefulNodeType<"fromPromise", FromPromiseNodeProperties, FromPromiseNodeState> = createNodeType<'fromPromise', FromPromiseNodeProperties, FromPromiseNodeState>('fromPromise', {serialize: false,deserialize: false,state: {currentValue: types.optional(graphTypes.nodeDefinition),pendingUpdate: types.optional(types.saveHash(types.any)),updateError: types.optional(graphTypes.nodeDefinition),},shape: {clear: types.optional(types.saveHash(types.func)),get: types.optional(types.saveHash(types.func)),set: types.optional(types.saveHash(types.func)),},getInitialState(): FromPromiseNodeState {return {currentValue: undefined,pendingUpdate: undefined,updateError: undefined,};},operations: {clear: {run(node: FromPromiseNode,options: never,dependencies: never,context: never,state: FromPromiseNodeState,): NodeDefinition {if (!node.definition.properties.clear) {return error('Specified fromPromise node does not support `clear` operation');}return state.pendingUpdate ? pending() : state.updateError || ok();},onSubscribe(this: NodeExecutionContext<FromPromiseNodeState, FromPromiseNodeData>,node: FromPromiseNode,): void {const { clear } = node.definition.properties;if (!clear) return;const pendingUpdate = Promise.resolve(clear(getParams(node.context))).catch((e) => error(e)).then((result) => {if (this.getState().pendingUpdate === pendingUpdate) {this.setState((state) => ({...state,currentValue: isOkNodeDefinition(result) ? undefined : state.currentValue,pendingUpdate: undefined,updateError: isErrorNodeDefinition(result) ? result : undefined,}));if (isOkNodeDefinition(result) && this.getData().isSubscribed) {fetchValue(this, node);}}return result;});this.setState((state) => ({...state,pendingUpdate,pendingError: undefined,}));},},evaluate: {run(node: FromPromiseNode,options: never,dependencies: Array<never>,context: Array<never>,state: FromPromiseNodeState,): NodeDefinition {const { get } = node.definition.properties;if (!get) {return error('Specified fromPromise node is write-only');}const { currentValue } = state;return currentValue || pending();},onInvalidate(this: NodeExecutionContext<FromPromiseNodeState, FromPromiseNodeData>,node: FromPromiseNode,): void {this.setState((state) => ({...state,currentValue: undefined,pendingUpdate: undefined,updateError: undefined,}));fetchValue(this, node);},onSubscribe(this: NodeExecutionContext<FromPromiseNodeState, FromPromiseNodeData>,node: FromPromiseNode,): void {this.setData((data) => ({...data,isSubscribed: true,}));fetchValue(this, node);},onUnsubscribe(this: NodeExecutionContext<FromPromiseNodeState, FromPromiseNodeData>): void {this.setData((data) => ({...data,isSubscribed: false,}));},},set: {run(node: FromPromiseNode,options: never,dependencies: Array<never>,context: Array<never>,state: FromPromiseNodeState,): NodeDefinition {const { set } = node.definition.properties;if (!set) {return error('Specified fromPromise node is read-only');}return state.pendingUpdate ? pending() : state.updateError || ok();},onSubscribe(this: NodeExecutionContext<FromPromiseNodeState, FromPromiseNodeData>,node: FromPromiseNode,operation: SetOperation,): void {const { set } = node.definition.properties;if (!set) return;const { value: newValue } = operation.properties;const { currentValue: previousValue } = this.getState();if (!previousValue) {this.retain();}this.setData((data) => ({...data,pendingGet: undefined,}));const pendingUpdate = Promise.resolve(set(getParams(node.context), valueOf(newValue))).catch((e) => error(e)).then((result) => {if (this.getState().pendingUpdate !== pendingUpdate) return result;this.setState((state) => ({...state,currentValue: isOkNodeDefinition(result) ? newValue : state.currentValue,pendingUpdate: undefined,updateError: isErrorNodeDefinition(result) ? result : undefined,}));return result;});this.setState((state) => ({...state,pendingUpdate,updateError: undefined,}));},},reset: {run(): NodeDefinition {return ok();},onSubscribe(this: NodeExecutionContext<FromPromiseNodeState, FromPromiseNodeData>,node: FromPromiseNode,) {const { currentValue: previousValue } = this.getState();if (previousValue) {this.release();}this.setState((state) => ({...state,currentValue: undefined,pendingUpdate: undefined,}));if (this.getData().isSubscribed) {fetchValue(this, node);}},},},})

Implementation of the fromPromise. See the fromPromise documentation for more information.

Const FromStreamMiddlewareNodeType

FromStreamMiddlewareNodeType: StatelessNodeType<"from-stream-middleware", FromStreamMiddlewareNodeProperties> = createNodeType<'from-stream-middleware', FromStreamMiddlewareNodeProperties>('from-stream-middleware',{shape: {streamFactory: types.saveHash(types.func),},operations: {request: {run(node: FromStreamMiddlewareNode, operation: RequestOperation): NodeDefinition {const responseStream = node.definition.properties.streamFactory(operation.properties.query,);return fromStream(responseStream);},},},},)

Const FromStreamNodeType

FromStreamNodeType: StatefulNodeType<"fromStream", FromStreamNodeProperties, FromStreamNodeState> = createNodeType<'fromStream', FromStreamNodeProperties, FromStreamNodeState>('fromStream', {serialize: false,deserialize: false,state: {currentValue: types.optional(graphTypes.nodeDefinition),},shape: {factory: types.saveHash(types.oneOfType<Function | { subscribe: Function }>([types.func,types.instance({ subscribe: types.func }),types.shape({ subscribe: types.func }),]),),},getInitialState(): FromStreamNodeState {return {currentValue: undefined,};},operations: {evaluate: {run(node: FromStreamNode,options: never,dependencies: Array<never>,context: Array<never>,state: FromStreamNodeState,): NodeDefinition {const { currentValue } = state;return currentValue || pending();},onSubscribe(this: NodeExecutionContext<FromStreamNodeState, FromStreamNodeData>,node: FromStreamNode,): void {const { factory } = node.definition.properties;const { subscription: existingSubscription } = this.getData();let isSync = true;let syncValue: NodeDefinition | undefined;const stream = typeof factory === 'function' ? factory(getParams(node.context)) : factory;const subscription = stream.subscribe((rawValue) => {const valueNode = isNodeDefinition(rawValue) ? rawValue : value(rawValue);if (isSync) {syncValue = valueNode;} else {this.setState({currentValue: valueNode,});}});isSync = false;if (existingSubscription) {existingSubscription.unsubscribe();}this.setData({subscription,});if (syncValue) {this.setState({currentValue: syncValue,});}},onUnsubscribe(this: NodeExecutionContext<FromStreamNodeState, FromStreamNodeData>): void {const { subscription } = this.getData();subscription && subscription.unsubscribe();},},},})

The implementation of the fromStream node. See the fromStream documentation to learn more.

Const FuzzyTraverseNodeType

FuzzyTraverseNodeType: StatelessNodeType<"fuzzyTraverse", FuzzyTraverseNodeProperties> = createNodeType<'fuzzyTraverse', FuzzyTraverseNodeProperties>('fuzzyTraverse', {serialize: false,deserialize: false,shape: {operation: graphTypes.graphOperation,target: types.oneOfType([graphTypes.graphNode, graphTypes.nodeDefinition]),},operations: {evaluate: {getDependencies({ operation, target }: FuzzyTraverseNodeProperties): Array<NodeDependency> {return [{target,until: {predicate(node: GraphNode) {return supportsOperationType(operation.type.name, node.definition);},errorMessage(node: GraphNode) {return getInvalidTypeErrorMessage(`Node does not support ${operation.type.name} operation`,{expected: `Node supporting ${operation.type.name} operation`,received: node.definition,},);},},},];},run(node: FuzzyTraverseNode,operation: never,[target]: Array<never>,): GraphAction | GraphNode {if (NilNodeType.is(target) && isGetChildOperation(operation)) return target;return createGraphAction(target, node.definition.properties.operation);},},},})

The implementation of the fuzzyTraverse. See the fuzzyTraverse documentation to learn more.

Const GRAPH_ACTION

GRAPH_ACTION: unique symbol = Symbol.for('muster::GRAPH_ACTION')

Const GRAPH_NODE

GRAPH_NODE: unique symbol = Symbol.for('muster::GRAPH_NODE')

Const GRAPH_OPERATION

GRAPH_OPERATION: unique symbol = Symbol.for('muster::GRAPH_OPERATION')

Const GetChildOperationType

GetChildOperationType: OperationType<"getChild", GetChildProperties> = createOperationType<'getChild', GetChildProperties>('getChild', {shape: {key: types.optional(types.saveHash(types.any)),},})

An implementation of the getChildOperation. See the getChildOperation documentation to find out more.

Const GetItemsOperationType

GetItemsOperationType: OperationType<"getItems", GetItemsProperties> = createOperationType<'getItems', GetItemsProperties>('getItems', {shape: {transforms: types.arrayOf(types.oneOfType<NodeDefinition | GraphNode>([graphTypes.nodeDefinition,graphTypes.graphNode,]),),},})

An implementation of the getItemsOperation. See the getItemsOperation documentation to find out more.

Const GetLengthNodeType

GetLengthNodeType: StatelessNodeType<"get-length", GetLengthNodeProperties> = createNodeType<'get-length', GetLengthNodeProperties>('get-length', {shape: {target: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ target }: GetLengthNodeProperties) {return [{target,until: {predicate: supportsLengthOperation,errorMessage(node: GraphNode) {return getInvalidTypeErrorMessage('Target node does not support length operation', {received: node.definition,});},},},];},run(node: GetLengthNode, operation: never, [target]: [GraphNode]): GraphAction {return createGraphAction(target, lengthOperation());},},},})

An implementation of the length node used to compute a length of a target node. See the length documentation to find out more.

Const GetNodeType

GetNodeType: StatelessNodeType<"get", GetNodeProperties> = createNodeType<'get',GetNodeProperties>('get', {shape: {subject: graphTypes.nodeDefinition,key: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ subject, key }: GetNodeProperties): Array<NodeDependency> {return [{target: subject,until: untilNodeSupportedByGet,},{target: key,until: untilIsValueNodeOrKeyNode,},];},run(node: GetNode,operation: never,[subjectNode, keyNode]: [GraphNode, ValueNode<any> | ListKeyNode],): NodeDefinition | GraphNode | GraphAction {if (isListKeyNode(keyNode)) {if (FirstNodeType.is(keyNode)) {return withScopeFrom(subjectNode,head(applyTransforms(subjectNode.definition, [firstItem()])),);}if (LastNodeType.is(keyNode)) {return withScopeFrom(subjectNode,head(applyTransforms(subjectNode.definition, [lastItem()])),);}if (NthNodeType.is(keyNode)) {const { index } = keyNode.definition.properties;return withScopeFrom(subjectNode,head(applyTransforms(subjectNode.definition, [nthItem(index)])),);}if (LengthNodeType.is(keyNode)) {if (supportsLengthOperation(subjectNode)) {return withScopeFrom(subjectNode, length(subjectNode.definition));}return withScopeFrom(subjectNode,head(applyTransforms(subjectNode.definition, [count()])),);}}if (!supportsGetChildOperation(subjectNode)) {return withScopeFrom(subjectNode,error(untilNodeSupportedByGet.errorMessage(subjectNode)),);}return createGraphAction(subjectNode,getChildOperation(keyNode.definition.properties.value),);},},},})

The implementation of the get. See the get documentation page for more information.

Const GraphNodeNodeType

GraphNodeNodeType: StatelessNodeType<"graphNode", GraphNodeNodeProperties> = createNodeType<'graphNode', GraphNodeNodeProperties>('graphNode', {deserialize: false,serialize: false,shape: {value: graphTypes.graphNode,},operations: {evaluate: {run(node: GraphNodeNode): GraphNode {return node.definition.properties.value;},},},})

The implementation of the graphNode. See the graphNode documentation to learn more.

Const GraphNodeTypes

GraphNodeTypes: Array<NodeType> = [ActionNodeType,ApplyNodeType,CallNodeType,CatchErrorNodeType,CombineLatestNodeType,ContextNodeType,CreateCallerNodeType,CreateSetterNodeType,CreateBehaviorNodeType,DebugNodeType,DeferNodeType,DispatchNodeType,DoneNodeType,EntriesNodeType,ErrorNodeType,ExtendNodeType,FactoryNodeType,FieldsNodeType,ExternalStatefulNodeType,FlowNodeType,FnNodeType,FromPromiseNodeType,FromStreamNodeType,GetNodeType,GraphNodeNodeType,IfErrorNodeType,IfPendingNodeType,InvalidateNodeType,InvalidateOnNodeType,IsNilNodeType,IsPendingNodeType,IsUpdatingNodeType,IteratorResultNodeType,KeyNodeType,LegacyQueryNodeType,LogNodeType,NilNodeType,OkNodeType,OnNodeType,OnceNodeType,OptimisticNodeType,ParallelNodeType,ParamNodeType,ParentNodeType,InjectDependenciesNodeType,PartialNodeType,PendingNodeType,PlaceholderNodeType,PropertyNodeType,QueryNodeType,QuerySetNodeType,QuerySetCallOperationNodeType,QuerySetGetChildOperationNodeType,QuerySetGetItemsOperationNodeType,QuerySetOperationNodeType,QuerySetResultNodeType,QuerySetSetOperationNodeType,ResetNodeType,ResolveNodeType,RootNodeType,ScopeNodeType,SeriesNodeType,SetNodeType,SetResultNodeType,TakeLastNodeType,TraverseNodeType,TreeNodeType,UpdateNodeType,ValueNodeType,VariableNodeType,WithContextNodeType,WithScopeNodeType,WithTransformsNodeType,]

Const GroupByNodeType

GroupByNodeType: StatelessNodeType<"group-by", GroupByNodeProperties> = createNodeType('group-by',{shape: {predicate: graphTypes.nodeDefinition,},operations: {transformItems: {getDependencies({ predicate }: GroupByNodeProperties,operation: TransformItemsOperation,): Array<NodeDependency> {return operation.properties.items.map((item) => ({target: apply([item], predicate),until: untilIsValueNode,}));},run(node: GroupByNode,operation: TransformItemsOperation,groupByResults: Array<ValueNode<any>>,): NodeDefinition {const { items } = operation.properties;const groupedItems: Map<any, Array<GraphNode>> = new Map();items.forEach((item, index) => {const key = groupByResults[index].definition.properties.value;const items = groupedItems.get(key);if (items) items.push(item);else groupedItems.set(key, [item]);});return nodeList([...groupedItems.entries()].map(([key, items]) => withScopeFrom(node, nodeList(items))),);},},init: {run(node: GroupByNode): NodeDefinition {const initialState = [] as Array<GraphNode>;return value(initialState);},},step: {run(node: GroupByNode, operation: StepOperation<Array<GraphNode>>): NodeDefinition {const { acc, item } = operation.properties;return value([...acc, item]);},},result: {getDependencies({ predicate }: GroupByNodeProperties): Array<NodeDependency> {return [{target: predicate,until: untilSupportsCallOperation,},];},run(node: GroupByNode,operation: ResultOperation<Array<GraphNode>>,[predicate]: [GraphNode],): NodeDefinition | GraphAction {const { acc, next } = operation.properties;if (!next) {return error('group-by reducer cannot be used as a base reducer');}const sortedItems = resolve(acc.map((item) => ({target: apply([item], predicate.definition),until: untilIsValueNode,})),(groupByResults: Array<ValueNode<any>>) => {const groupedItems: Map<any, Array<GraphNode>> = new Map();acc.forEach((item, index) => {const key = groupByResults[index].definition.properties.value;const items = groupedItems.get(key);if (items) items.push(item);else groupedItems.set(key, [item]);});return nodeList([...groupedItems.entries()].map(([key, items]) =>withScopeFrom(node, nodeList(items)),),);},);return value(transduce(sortedItems, [next]));},},},},)

The implementation of the groupBy. See the groupBy documentation to learn more.

Const GtNodeType

GtNodeType: StatelessNodeType<"gt", GtNodeProperties> = createNodeType<'gt',GtNodeProperties>('gt', {shape: {left: graphTypes.nodeDefinition,right: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ left, right }: GtNodeProperties): Array<NodeDependency> {return [left, right].map((operand) => ({target: operand,until: {predicate: ValueNodeType.is,errorMessage(node: GraphNode): string {return getInvalidTypeErrorMessage('Gt node operands must resolve to value() nodes', {expected: ValueNodeType,received: node.definition,});},},}));},run(node: GtNode,options: never,[left, right]: [ValueNode<number>, ValueNode<number>],): NodeDefinition {const leftValue = left.definition.properties.value;const rightValue = right.definition.properties.value;return value(leftValue > rightValue);},},},})

The implementation of the gt node. See the gt documentation to learn more.

Const GteNodeType

GteNodeType: StatelessNodeType<"gte", GteNodeProperties> = createNodeType<'gte',GteNodeProperties>('gte', {shape: {left: graphTypes.nodeDefinition,right: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ left, right }: GteNodeProperties): Array<NodeDependency> {return [left, right].map((operand) => ({target: operand,until: {predicate: ValueNodeType.is,errorMessage(node: GraphNode): string {return getInvalidTypeErrorMessage('Gte node operands must resolve to value() nodes', {expected: ValueNodeType,received: node.definition,});},},}));},run(node: GteNode,options: never,[left, right]: [ValueNode<number>, ValueNode<number>],): NodeDefinition {const leftValue = left.definition.properties.value;const rightValue = right.definition.properties.value;return value(leftValue >= rightValue);},},},})

The implementation of the gte node. See the gte documentation to learn more.

Const HeadNodeType

HeadNodeType: StatelessNodeType<"head", HeadNodeProperties> = createNodeType<'head',HeadNodeProperties>('head', {shape: {target: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ target }: HeadNodeProperties): Array<NodeDependency> {return [{target,until: untilValidTargetNode,},];},run(node: HeadNode,options: never,[targetNode]: [NodeListNode | IterableGraphNode | PlaceholderNode | ItemPlaceholderNode],): GraphNode | NodeDefinition {if (NilNodeType.is(targetNode) ||ItemPlaceholderNodeType.is(targetNode) ||PlaceholderNodeType.is(targetNode)) {return targetNode;}if (NodeListNodeType.is(targetNode)) {const { items } = targetNode.definition.properties;return items.length > 0 ? items[0] : nil();}if (supportsIterateOperation(node)) {return getNextIteratorResult(targetNode, resolveIteratorResult);}// the item must support get items operation thenreturn withScopeFrom(targetNode,resolve([{target: traverse(targetNode, getItemsOperation()),until: untilValidGetItemsResult,},],([itemsNode]: [NodeListNode]) => {if (NilNodeType.is(itemsNode) ||ItemPlaceholderNodeType.is(itemsNode) ||PlaceholderNodeType.is(itemsNode)) {return itemsNode;}const { items } = itemsNode.definition.properties;return items.length > 0 ? items[0] : nil();},),);},},},})

The implementation of the head node. See the head documentation to learn more.

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StaticNodeType<"first", object, object>> = createNodeDefinition(FirstNodeType, {})

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StatelessNodeType<"arrayReducer", ArrayReducerNodeProperties, ArrayReducerNodeProperties, string, GraphOperation<string, object, object, OperationType<string, object, object>>>> = createNodeDefinition(ArrayReducerNodeType, {})

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StatelessNodeType<"nil", object, object, string, GraphOperation<string, object, object, OperationType<string, object, object>>>> = createNodeDefinition(NilNodeType, {})

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StatelessNodeType<"identity", IdentityNodeProperties, IdentityNodeProperties, string, GraphOperation<string, object, object, OperationType<string, object, object>>>> = createNodeDefinition(IdentityNodeType, {})

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StaticNodeType<"pending", object, object>> = createNodeDefinition(PendingNodeType, {})

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StaticNodeType<"ok", object, object>> = createNodeDefinition(OkNodeType, {})

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StatelessNodeType<"count", CountNodeProperties, CountNodeProperties, string, GraphOperation<string, object, object, OperationType<string, object, object>>>> = createNodeDefinition(CountNodeType, {})

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StatelessNodeType<"root", object, object, string, GraphOperation<string, object, object, OperationType<string, object, object>>>> = createNodeDefinition(RootNodeType, {})

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StaticNodeType<"length", object, object>> = createNodeDefinition(LengthNodeType, {})

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StatelessNodeType<"firstItem", FirstItemNodeProperties, FirstItemNodeProperties, string, GraphOperation<string, object, object, OperationType<string, object, object>>>> = createNodeDefinition(FirstItemNodeType, {})

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StatelessNodeType<"lastItem", LastItemNodeProperties, LastItemNodeProperties, string, GraphOperation<string, object, object, OperationType<string, object, object>>>> = createNodeDefinition(LastItemNodeType, {})

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StaticNodeType<"last", object, object>> = createNodeDefinition(LastNodeType, {})

Const INSTANCE

INSTANCE: StaticNodeDefinition<string, object, object, StatelessNodeType<"parent", object, object, string, GraphOperation<string, object, object, OperationType<string, object, object>>>> = createNodeDefinition(ParentNodeType, {})

Const ITEM_ID_CONTEXT

ITEM_ID_CONTEXT: "$$array:item-id" = "$$array:item-id"

Const ITEM_ID_KEY

ITEM_ID_KEY: "$$item-with-id:id" = "$$item-with-id:id"

Const IdentityNodeType

IdentityNodeType: StatelessNodeType<"identity", IdentityNodeProperties> = createNodeType<'identity', IdentityNodeProperties>('identity', {shape: {},operations: {call: {run(node: IdentityNode, operation: CallOperation): GraphNode | NodeDefinition {const { args } = operation.properties;if (!args) return nil();if (isCallArgumentArray(args)) return args[0];const argsNames = Object.keys(args);return args[argsNames[0]];},},},})

The implementation of the identity. See the identity documentation to learn more.

Const IdentityOperationType

IdentityOperationType: OperationType<"identity"> = createOperationType<'identity'>('identity',)

An implementation of the identityOperation. See the identityOperation documentation to find out more.

Const IfElseNodeType

IfElseNodeType: StatelessNodeType<"ifElse", IfElseNodeProperties> = createNodeType<'ifElse',IfElseNodeProperties>('ifElse', {shape: {if: graphTypes.nodeDefinition,then: graphTypes.nodeDefinition,else: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ if: ifNode }: IfElseNodeProperties): Array<NodeDependency> {return [{target: ifNode,until: {predicate: ValueNodeType.is,errorMessage(node: GraphNode): string {return getInvalidTypeErrorMessage('IfElse node condition must resolve to value() nodes',{expected: ValueNodeType,received: node.definition,},);},},},];},run(node: IfElseNode, options: never, [condition]: [ValueNode<any>]): NodeDefinition {const { then: thenNode, else: elseNode } = node.definition.properties;const conditionValue = condition.definition.properties.value;return conditionValue ? thenNode : elseNode;},},},})

The implementation of the ifElse node. See the ifElse documentation to learn more.

Const IfErrorNodeType

IfErrorNodeType: StatefulNodeType<"ifError", IfErrorNodeProperties, IfErrorNodeState, IfErrorNodeData> = createNodeType<'ifError', IfErrorNodeProperties, IfErrorNodeState, IfErrorNodeData>('ifError', {state: {previousValues: types.shape({evaluate: types.optional(graphTypes.graphNode),}),},shape: {target: graphTypes.nodeDefinition,fallback: types.saveHash(types.func),},getInitialState(): IfErrorNodeState {return {previousValues: {evaluate: undefined,},};},operations: {evaluate: {getDependencies({ target }: IfErrorNodeProperties): Array<NodeDependency> {return [{target,allowErrors: true,},];},run(node: IfErrorNode,options: never,[target]: [GraphNode],context: Array<never>,state: IfErrorNodeState,): NodeDefinition | GraphNode {const { fallback } = node.definition.properties;const { previousValues } = state;if (ErrorNodeType.is(target)) {const previousValue = previousValues.evaluate;return fallback(target.definition, previousValue && previousValue.definition);}return target;},onUpdate(this: NodeExecutionContext<IfErrorNodeState, IfErrorNodeData>,node: IfErrorNode,options: never,[target]: [GraphNode],): void {if (!ErrorNodeType.is(target)) {this.setState((prevState) => ({previousValues: {...prevState.previousValues,evaluate: target,},}));}},},call: {run(node: IfErrorNode, operation: CallOperation): NodeDefinition | GraphNode {const { fallback, target } = node.definition.properties;return resolve([{ target: traverse(target, operation), allowErrors: true }], ([result]) => {if (ErrorNodeType.is(result)) {return withScopeFrom(node, fallback(result.definition, undefined));}return result;});},},},})

The implementation of the ifError. See the ifError documentation to learn more.

Const IfPendingNodeType

IfPendingNodeType: StatelessNodeType<"ifPending", IfPendingNodeProperties> = createNodeType<'ifPending', IfPendingNodeProperties>('ifPending', {shape: {target: graphTypes.nodeDefinition,fallback: types.oneOfType([types.saveHash(types.func),graphTypes.nodeDefinition,types.saveHash(types.any),]),},operations: {evaluate: {run(node: IfPendingNode) {const { fallback, target } = node.definition.properties;const fallbackGenerator = parseFallbackGenerator(fallback);const queryBuilder = new QueryBuilder(uniqueId('if-pending_'));let resolveMirrorQuery: NodeDefinition = ok();let lastQuerySnapshot: QueriesSnapshot | undefined = undefined;let lastResolvedResult: QuerySetResultNodeDefinition | undefined = undefined;return takeLast([onGlobalEvent(FLUSH)(() => {if (!queryBuilder.isModified) return resolveMirrorQuery;queryBuilder.resetModifiedState();const queryBuilderSnapshot = getQueryBuilderSnapshot(queryBuilder);if (lastQuerySnapshot && isEqual(lastQuerySnapshot, queryBuilderSnapshot)) {return resolveMirrorQuery;}lastQuerySnapshot = queryBuilderSnapshot;const querySetWithCallback = buildQuerySetFromQueryBuilderSnapshot(queryBuilderSnapshot,queryBuilder,);const querySetChildren = querySetWithCallback.node.properties.children;const querySetWithTarget = querySet(target, querySetChildren);return (resolveMirrorQuery = resolve([{target: withScopeFrom(node, querySetWithTarget),until: untilIsArrayNodeOrPendingNode,acceptNil: true,allowPending: true,},],([result]: [ArrayNode | PendingNode]) => {if (!PendingNodeType.is(result)) {// Looks like the query is fully resolved - call the placeholder callbackslastResolvedResult = querySetResult(querySetChildren, result.definition);querySetWithCallback.callback(result.definition);return ok();}// Generate the fallback response and then resolve it to a simpler valuereturn resolve([{target: fallbackGenerator(lastResolvedResult),acceptNil: true,},],([fallback]: [GraphNode]) => {// Check if the fallback was resolved to a query set node// This should simplify things a bitif (lastResolvedResult &&fallback.definition.id === lastResolvedResult.properties.result.id) {querySetWithCallback.callback((fallback as QuerySetResultNode).definition.properties.result,);return ok();}// Otherwise - run the querySet against the fallback to generate a correct resultreturn resolve([{target: withScopeFrom(fallback,querySet(fallback.definition, querySetChildren),),acceptNil: true,allowErrors: true,allowPending: true,},],([fallbackResult]: [GraphNode]) => {querySetWithCallback.callback(fallbackResult.definition);return ok();},);},);},));}),placeholder(queryBuilder, []),]);},},},})

The implementation of the ifPending. See the ifPending documentation to learn more.

Const IncludesNodeType

IncludesNodeType: StatelessNodeType<"includes", IncludesNodeProperties> = createNodeType<'includes', IncludesNodeProperties>('includes', {shape: {pattern: graphTypes.nodeDefinition,subject: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ pattern, subject }: IncludesNodeProperties): Array<NodeDependency> {return [{target: pattern,until: untilStringValueNode(IncludesNodeType, 'pattern'),},{target: subject,acceptNil: true,until: untilStringValueNode(IncludesNodeType, 'subject'),},];},run(node: IncludesNode,options: never,[pattern, subject]: [ValueNode<string>, ValueNode<string>],): NodeDefinition {if (NilNodeType.is(subject)) return value(false);const patternValue = pattern.definition.properties.value;const subjectValue = subject.definition.properties.value;return value((subjectValue || '').includes(patternValue));},},},})

The implementation of the includes node. See the includes documentation to learn more.

Const InitOperationType

InitOperationType: OperationType<"init", InitProperties> = createOperationType<'init',InitProperties>('init', {shape: {next: types.optional(graphTypes.graphNode),},})

An implementation of the [[initOperation]]. See the [[initOperation]] documentation to find out more.

Const InjectDependenciesNodeType

InjectDependenciesNodeType: StatelessNodeType<"inject-dependencies", InjectDependenciesNodeProperties<NodeDefinition>> = createNodeType('inject-dependencies', {shape: {context: types.optional(types.objectOf(graphTypes.nodeDefinition)),dependencies: types.arrayOf(types.optional(types.oneOfType<NodeDefinition | GraphNode>([graphTypes.nodeDefinition,graphTypes.graphNode,]),),),target: graphTypes.nodeDefinition,},serialize: false,deserialize: false,operations: {evaluate: {cacheable: true,getDependencies<T extends NodeDefinition>(properties: InjectDependenciesNodeProperties<T>,operation: EvaluateOperation,): Array<Dependency> {const { target } = properties;if (!supportsEvaluateOperation(target)) {return [];}const evaluateOperationHandler = target.type.operations.evaluate;return getDependencies(properties, evaluateOperationHandler, operation);},getContextDependencies<T extends NodeDefinition>(properties: InjectDependenciesNodeProperties<T>,operation: EvaluateOperation,): Array<ContextDependency> {const { target } = properties;if (!supportsEvaluateOperation(target)) {return [];}const evaluateOperationHandler = target.type.operations.evaluate;return getContextDependencies(properties, evaluateOperationHandler, operation);},run<T extends NodeDefinition>(node: InjectDependenciesNode<T>,operation: EvaluateOperation,dependencies: Array<GraphNode>,contextDependencies: Array<GraphNode>,): GraphNode | GraphAction {const { target, context } = node.definition.properties;if (!supportsEvaluateOperation(target)) {return withScopeFrom(node, target);}const nodeType = target.type;const {dependencies: resolvedDependencies,contextDependencies: resolvedContextDependencies,} = getResolvedDependencies(node.definition,nodeType.operations.evaluate,operation,dependencies,contextDependencies,);const targetContext = context? createContext(node.context, mapValues(context, (value) => withScopeFrom(node, value))): node.context;const targetNode = createGraphNode(node.scope, targetContext, target);if (isStatefulNodeType(nodeType)) {return nodeType.operations.evaluate.run(targetNode,evaluateOperation(),resolvedDependencies,resolvedContextDependencies,node.scope.store.getNodeState(targetNode as StatefulGraphNode),);}return nodeType.operations.evaluate.run(targetNode,evaluateOperation(),resolvedDependencies,resolvedContextDependencies,undefined,);},},},})

An implementation of the injectDependencies node. See the injectDependencies documentation to find out more.

Const InvalidateNodeType

InvalidateNodeType: StatefulNodeType<"invalidate", InvalidateNodeProperties> = createNodeType<'invalidate', InvalidateNodeProperties>('invalidate', {state: {},shape: {target: graphTypes.nodeDefinition,},getInitialState(): InvalidateNodeState {return {};},operations: {evaluate: {cacheable: false,run(): GraphNode | NodeDefinition {return ok();},onSubscribe(this: NodeExecutionContext<InvalidateNodeState, InvalidateNodeData>,node: InvalidateNode,): void {if (!isDynamicNode(node)) {return;}const { target } = node.definition.properties;// Invalidate the target node via the store if it is already subscribedconst wasSubscribed = node.scope.store.invalidate(withScopeFrom(node, target));if (wasSubscribed) {return;}if (!supportsEvaluateOperation(target)) {return;}// The target node is not currently subscribed, so create a temporary subscription to the// target just in order to figure out the next result in the chain, and invalidate thatlet isSync = true;let isCompleted = false;const unsubscribe = node.scope.store.subscribe(withScopeFrom(node,resolve([createGraphAction(withScopeFrom(node, target), evaluateOperation())],([nextTarget]) => withScopeFrom(nextTarget, invalidate(nextTarget.definition)),),),resolveOperation(),() => {isCompleted = true;if (isSync) return;unsubscribe();},);isSync = false;if (isCompleted) {unsubscribe();}},},},})

The implementation of the invalidate. See the invalidate documentation to learn more.

Const InvalidateOnNodeType

InvalidateOnNodeType: StatefulNodeType<"invalidate-on", InvalidateOnNodeProperties, InvalidateOnNodeState> = createNodeType<'invalidate-on', InvalidateOnNodeProperties, InvalidateOnNodeState>('invalidate-on',{state: {},shape: {target: graphTypes.nodeDefinition,predicate: types.saveHash(types.func),},getInitialState(): InvalidateOnNodeState {return {};},operations: {evaluate: {run(node: InvalidateOnNode): NodeDefinition {const { target } = node.definition.properties;return target;},onSubscribe(node: InvalidateOnNode) {const { predicate, target } = node.definition.properties;const { subscription: disposeSubscription } = this.getData();disposeSubscription && disposeSubscription();const subscription = node.scope.events.listen((event) => {if (!predicate(event)) return;const targetNode = withScopeFrom(node, target);node.scope.store.invalidate(targetNode);});this.setData({subscription,});},onUnsubscribe() {const { subscription: disposeSubscription } = this.getData();disposeSubscription && disposeSubscription();},},},},)

The implementation of the invalidateOn. See the invalidateOn to learn more.

Const IsNilNodeType

IsNilNodeType: StatelessNodeType<"is-nil", IsNilNodeProperties> = createNodeType<'is-nil',IsNilNodeProperties>('is-nil', {serialize: false,deserialize: false,shape: {target: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ target }: IsNilNodeProperties): [NodeDependency] {return [{target,acceptNil: true,},];},run(node: IsNilNode, options: never, [targetValue]: [GraphNode]): NodeDefinition {return value(NilNodeType.is(targetValue));},},},})

The implementation of the isNil. See the isNil documentation to learn more.

Const IsPendingNodeType

IsPendingNodeType: StaticNodeType<"isPending", IsPendingNodeProperties> = createNodeType<'isPending', IsPendingNodeProperties>('isPending', {shape: {target: graphTypes.nodeDefinition,},})

The implementation of the isPending node. See the isPending documentation page to learn more.

Const IsPendingOperationType

IsPendingOperationType: OperationType<"isPending"> = createOperationType<'isPending'>('isPending',)

An implementation of the isPendingOperation. See the isPendingOperation documentation to find out more.

Const IsUpdatingNodeType

IsUpdatingNodeType: StatelessNodeType<"isUpdating", IsUpdatingNodeProperties> = createNodeType<'isUpdating', IsUpdatingNodeProperties>('isUpdating', {shape: {target: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ target }: IsUpdatingNodeProperties): Array<NodeDependency> {return [{target,until: untilSupportsIsUpdatingOperationOrStaticNode,},];},run(node: IsUpdatingNode,operation: never,[target]: [GraphNode],): NodeDefinition | GraphAction {if (!supportsIsUpdatingOperation(target)) {return value(true);}return createGraphAction(target, isUpdatingOperation());},},},})

The implementation of the isUpdating node. See the isUpdating documentation to learn more.

Const IsUpdatingOperationType

IsUpdatingOperationType: OperationType<"isUpdating"> = createOperationType<'isUpdating'>('isUpdating')

An implementation of the isUpdatingOperation. See the isUpdatingOperation documentation to find out more.

Const ItemIdNodeType

ItemIdNodeType: StaticNodeType<"item-id", ItemIdNodeProperties> = createNodeType<'item-id',ItemIdNodeProperties>('item-id', {shape: {id: types.string,},})

Const ItemPlaceholderNodeType

ItemPlaceholderNodeType: StatelessNodeType<"item-placeholder", ItemPlaceholderNodeProperties> = createNodeType<'item-placeholder', ItemPlaceholderNodeProperties>('item-placeholder', {shape: {results: types.arrayOf(types.shape({node: graphTypes.nodeDefinition,pathPart: types.shape({id: types.string,operation: graphTypes.graphOperation,}),}),),isEmpty: types.bool,path: types.arrayOf(types.shape({id: types.string,operation: graphTypes.graphOperation,}),),queryBuilder: types.saveHash(types.any),},operations: {[WILDCARD_OPERATION]: {getDependencies({ path, queryBuilder }: ItemPlaceholderNodeProperties,operation: GraphOperation,): Array<NodeDependency> {return [{target: traverse(placeholder(queryBuilder, path), operation),allowPending: true,until: untilValidPlaceholderResult,},];},run(node: ItemPlaceholderNode,operation: GraphOperation,[placeholder]: [PlaceholderNode],): NodeDefinition | GraphNode {const { results } = node.definition.properties;const matchingResult = results.find((result) => result.pathPart.id === operation.id);if (!matchingResult) return placeholder;return isSetOperation(operation) && isOkNodeDefinition(matchingResult.node)? operation.properties.value: matchingResult.node;},},},})

An implementation of the itemPlaceholder node. See the itemPlaceholder documentation to find out more.

Const ItemWithIdNodeType

ItemWithIdNodeType: StatelessNodeType<"item-with-id", ItemWithIdNodeProperties> = createNodeType<'item-with-id', ItemWithIdNodeProperties>('item-with-id', {shape: {id: types.string,item: graphTypes.nodeDefinition,},operations: {evaluate: {run(node: ItemWithIdNode): GraphNode {const { id, item } = node.definition.properties;return createGraphNode(node.scope,createContext(node.context, {[ITEM_ID_KEY]: withScopeFrom(node, value(id)),}),item,);},},},})

The implementation of the itemWithId node. See the itemWithId documentation to find out more.

Const IterateNodeType

IterateNodeType: StatelessNodeType<"iterate", IterateNodeProperties> = createNodeType<'iterate',IterateNodeProperties>('iterate', {shape: {target: graphTypes.nodeDefinition,transforms: types.arrayOf(types.oneOfType([graphTypes.nodeDefinition, graphTypes.graphNode])),},operations: {evaluate: {getDependencies({ target, transforms }: IterateNodeProperties): Array<NodeDependency> {return [{target,until: untilSupportsIterateOperation,},...transforms.map((transformer) => ({target: transformer,until: untilSupportsStepOperation,})),];},run(node: IterateNode,options: never,[targetNode, ...transforms]: Array<GraphNode>,): NodeDefinition | GraphNode {return withScopeFrom(targetNode,transduce(targetNode.definition, [...transforms, arrayReducer()]),);},},},})

Const IterateOperationType

IterateOperationType: OperationType<"iterate"> = createOperationType<'iterate'>('iterate',)

An implementation of the iterateOperation. See the iterateOperation documentation to find out more.

Const IteratorResultNodeType

IteratorResultNodeType: StaticNodeType<"iteratorResult", IteratorResultNodeProperties> = createNodeType<'iteratorResult', IteratorResultNodeProperties>('iteratorResult', {shape: {value: types.oneOfType([graphTypes.nodeDefinition, graphTypes.graphNode]),next: types.oneOfType([graphTypes.nodeDefinition, graphTypes.graphNode]),},})

An implementation of the iteratorResult node. See the iteratorResult documentation to find out more.

Const JoinNodeType

JoinNodeType: StatelessNodeType<"join", JoinNodeProperties> = createNodeType<'join',JoinNodeProperties>('join', {shape: {operands: types.arrayOf(graphTypes.nodeDefinition),separator: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ operands, separator }: JoinNodeProperties): Array<NodeDependency> {return [{target: separator,until: untilValidSeparator,},...operands.map((operand) => ({target: operand,acceptNil: true,until: untilValidJoinOperand,})),];},run(node: JoinNode,options: never,[separator, ...operands]: [ValueNode<string>, ValueNode<string | Array<string>>],): NodeDefinition {return value(flatMap(operands.filter((operand) => !NilNodeType.is(operand)), (operand) => {const { value } = operand.definition.properties;return typeof value === 'string' ? [value] : value;}).join(separator.definition.properties.value),);},},},})

The implementation of the join node. See the join documentation to learn more.

Const KeyNodeType

KeyNodeType: StaticNodeType<"key", KeyNodeProperties> = createNodeType<'key',KeyNodeProperties>('key', {shape: {key: graphTypes.nodeDefinition,children: types.optional(graphTypes.nodeDefinition),},})

The implementation of the key node. See the key documentation to learn more.

Const KeysNodeTypes

KeysNodeTypes: Array<NodeType> = [FirstNodeType,GetLengthNodeType,LastNodeType,LengthNodeType,NthNodeType,]

Const LOCATION_CHANGED

LOCATION_CHANGED: "$$event:location-changed" = "$$event:location-changed"

Const LOCATION_PART_CHANGED

LOCATION_PART_CHANGED: "$$event:location-part-changed" = "$$event:location-part-changed"

Const LastItemNodeType

LastItemNodeType: StatelessNodeType<"lastItem", LastItemNodeProperties> = createNodeType('lastItem', {operations: {transformItems: {run(node: LastItemNode, operation: TransformItemsOperation): NodeDefinition {return nodeList(operation.properties.items.slice(-1));},},init: {run(node: LastItemNode): NodeDefinition {return value(undefined);},},step: {run(node: LastItemNode, operation: StepOperation<any>): NodeDefinition {return value(operation.properties.item);},},result: {run(node: LastItemNode, operation: ResultOperation<any>): NodeDefinition {const { acc, next } = operation.properties;const finalValue = nodeList(acc ? [acc] : []);return next ? value(transduce(finalValue, [next])) : value(finalValue);},},},})

The implementation of the lastItem node. See the lastItem documentation to learn more.

Const LastNodeType

LastNodeType: StaticNodeType<"last"> = createNodeType<'last'>('last')

An implementation of the last node. See the last documentation to find out more.

Const LegacyQueryNodeType

LegacyQueryNodeType: StatelessNodeType<"legacyQuery", LegacyQueryNodeProperties> = createNodeType<'legacyQuery', LegacyQueryNodeProperties>('legacyQuery', {shape: {keys: graphTypes.nodeDefinition,root: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ keys }: LegacyQueryNodeProperties): [NodeDependency] {return [{target: keys,until: untilIsFieldsNodeOrCollectionFieldsNode,},];},run(node: LegacyQueryNode,operation: never,[keys]: [FieldsNode | EntriesNode | WithTransformsNode],): NodeDefinition | GraphNode {const { root } = node.definition.properties;if (FieldsNodeType.is(keys)) {if (supportsGetChildOperation(root)) {return resolveFields(withScopeFrom(node, root), keys);}return resolve([{target: root,until: untilSupportsGetChildOperation,},],([rootNode]) => resolveFields(rootNode, keys),);}if (isCollectionFieldsNode(keys)) {if (supportsGetItemsOperation(root)) {return resolveList(withScopeFrom(node, root), keys);}return resolve([{target: root,until: untilSupportsGetItemsOperation,},],([rootNode]) => resolveList(rootNode, keys),);}return error(getInvalidTypeError('Invalid query definition.', {expected: [FieldsNodeType, EntriesNodeType, WithTransformsNodeType],received: keys,}),);},},},})

The implementation of the legacyQuery node. See the legacyQuery documentation to learn more.

Const LengthNodeType

LengthNodeType: StaticNodeType<"length"> = createNodeType<'length'>('length')

An implementation of the length node used as part of a ref node. See the length documentation to find out more.

Const LengthOperationType

LengthOperationType: OperationType<"length", LengthProperties> = createOperationType<'length',LengthProperties>('length', {cacheable: false,shape: {},})

An implementation of the lengthOperation. See the lengthOperation documentation to find out more.

Const LocationDataNodeType

LocationDataNodeType: StatefulNodeType<"locationData", LocationDataNodeProperties, LocationDataNodeState> = createNodeType<'locationData', LocationDataNodeProperties, LocationDataNodeState>('locationData',{state: {currentValue: graphTypes.nodeDefinition,},shape: {history: types.shape({id: types.string,}),paramsEncoder: types.optional(types.shape({encode: types.saveHash(types.func),decode: types.saveHash(types.func),}),),update: types.optional(types.bool),},getInitialState(properties: LocationDataNodeProperties): LocationDataNodeState {return {currentValue: computeCurrentValue(properties.history.location, properties.paramsEncoder),};},operations: {evaluate: {run(node: LocationDataNode,options: never,dependencies: Array<never>,context: Array<never>,state: LocationDataNodeState,): NodeDefinition {return state.currentValue;},onSubscribe(this: NodeExecutionContext<LocationDataNodeState, LocationDataNodeData>,node: LocationDataNode,): void {if (this.getData().disposeEventListener) return;const { history, paramsEncoder } = node.definition.properties;this.setData({disposeEventListener: node.scope.events.listen((event) => {if (event.type !== LOCATION_CHANGED) return;this.setState({currentValue: computeCurrentValue(history.location, paramsEncoder),});}),disposeHistoryListener: history.listen((location) => {this.setState({currentValue: computeCurrentValue(location, paramsEncoder),});}),});},onUnsubscribe(this: NodeExecutionContext<LocationDataNodeState, LocationDataNodeData>,): void {const { disposeEventListener, disposeHistoryListener } = this.getData();disposeEventListener && disposeEventListener();disposeHistoryListener && disposeHistoryListener();},},set: {run(): NodeDefinition {return series([dispatch(LOCATION_PART_CHANGED), ok()]);},onSubscribe(this: NodeExecutionContext<LocationDataNodeState, LocationDataNodeData>,node: LocationDataNode,operation: SetOperation,): void {const { history } = node.definition.properties;const paramsValue = operation.properties.value.properties.value;getHistoryUpdater(history, node.definition.properties.update)({...history.location,search: paramsToSearch(paramsValue, node.definition.properties.paramsEncoder),});this.setState({currentValue: value(paramsValue),});},},},},)

Const LocationNodeType

LocationNodeType: StatefulNodeType<"location", LocationNodeProperties, LocationNodeState> = createNodeType<'location', LocationNodeProperties, LocationNodeState>('location', {state: {currentValue: graphTypes.nodeDefinition,history: types.shape({id: types.string,}),},shape: {hash: types.optional(types.string),paramsEncoder: types.optional(types.shape({encode: types.saveHash(types.func),decode: types.saveHash(types.func),}),),update: types.optional(types.bool),},getInitialState(properties: LocationNodeProperties): LocationNodeState {const history = (properties.hash? createHashHistory({ hashType: properties.hash }): createBrowserHistory({ forceRefresh: false })) as HistoryWithId;history.id = uniqueId('history_');return {currentValue: computeCurrentValue(history.location, properties.paramsEncoder),history,};},operations: {evaluate: {run(node: LocationNode,options: never,dependencies: Array<never>,context: Array<never>,state: LocationNodeState,): NodeDefinition {return state.currentValue;},onSubscribe(this: NodeExecutionContext<LocationNodeState, LocationNodeData>,node: LocationNode,): void {if (this.getData().unsubscribeHistory) return;const { history } = this.getState();const { paramsEncoder } = node.definition.properties;this.setData({unsubscribeEvent: node.scope.events.listen((event) => {if (event.type !== LOCATION_PART_CHANGED) return;this.setState((state) => ({...state,currentValue: computeCurrentValue(history.location, paramsEncoder),}));}),unsubscribeHistory: history.listen((location) => {this.setState((state) => ({...state,currentValue: computeCurrentValue(location, paramsEncoder),}));}),});},onUnsubscribe(this: NodeExecutionContext<LocationNodeState, LocationNodeData>): void {const { unsubscribeEvent, unsubscribeHistory } = this.getData();unsubscribeEvent && unsubscribeEvent();unsubscribeHistory && unsubscribeHistory();},},getChild: {run(node: LocationNode,operation: GetChildOperation,dependencies: Array<never>,context: Array<never>,state: LocationNodeState,): NodeDefinition | GraphNode {const { key } = operation.properties;const { history } = state;const childContext = createChildPathContext(node, key);if (key === 'path') {return createGraphNode(node.scope, childContext, locationPath(history));}if (key === 'params') {const { paramsEncoder, update } = node.definition.properties;return createGraphNode(node.scope,childContext,locationData(history, paramsEncoder, update),);}return nil();},},set: {run(node: LocationNode,options: never,dependencies: Array<never>,context: Array<never>,state: LocationNodeState,): NodeDefinition {return series([dispatch(LOCATION_CHANGED), ok()]);},onSubscribe(this: NodeExecutionContext<LocationNodeState, LocationNodeData>,node: LocationNode,operation: SetOperation,): void {const { history } = this.getState();const value = operation.properties.value.properties.value;const { paramsEncoder } = node.definition.properties;getHistoryUpdater(history, node.definition.properties.update)({pathname: value.path,search: paramsToSearch(value.params, paramsEncoder),});this.setState((state) => ({...state,currentValue: computeCurrentValue(history.location, paramsEncoder),}));},},},})

The implementation of the location node. See the location documentation to learn more.

Const LocationPathNodeType

LocationPathNodeType: StatefulNodeType<"locationPath", LocationPathNodeProperties, LocationPathNodeState> = createNodeType<'locationPath', LocationPathNodeProperties, LocationPathNodeState>('locationPath',{state: {currentValue: graphTypes.nodeDefinition,},shape: {history: types.shape({id: types.string,}),update: types.optional(types.bool),},getInitialState(properties: LocationPathNodeProperties): LocationPathNodeState {return {currentValue: value(properties.history.location.pathname),};},operations: {evaluate: {run(node: LocationPathNode,options: never,dependencies: Array<never>,context: Array<never>,state: LocationPathNodeState,): NodeDefinition {return state.currentValue;},onSubscribe(this: NodeExecutionContext<LocationPathNodeState, LocationPathNodeData>,node: LocationPathNode,): void {if (this.getData().disposeEventListener) return;const { history } = node.definition.properties;this.setData({disposeEventListener: node.scope.events.listen((event) => {if (event.type !== LOCATION_CHANGED) return;this.setState({currentValue: value(history.location.pathname),});}),disposeHistoryListener: history.listen((location) => {this.setState((state) => ({...state,currentValue: value(location.pathname),}));}),});},onUnsubscribe(this: NodeExecutionContext<LocationPathNodeState, LocationPathNodeData>,): void {const { disposeEventListener, disposeHistoryListener } = this.getData();disposeEventListener && disposeEventListener();disposeHistoryListener && disposeHistoryListener();},},set: {run(): NodeDefinition {return series([dispatch(LOCATION_PART_CHANGED), ok()]);},onSubscribe(this: NodeExecutionContext<LocationPathNodeState, LocationPathNodeData>,node: LocationPathNode,operation: SetOperation,): void {const { history } = node.definition.properties;const pathValue = operation.properties.value.properties.value;getHistoryUpdater(history, node.definition.properties.update)({...history.location,pathname: pathValue,});this.setState({currentValue: value(pathValue),});},},},},)

Const LogMiddlewareNodeType

LogMiddlewareNodeType: StatelessNodeType<"log-middleware", LogMiddlewareNodeProperties> = createNodeType<'log-middleware', LogMiddlewareNodeProperties>('log-middleware', {shape: {logRequests: types.bool,logResponses: types.bool,sink: types.saveHash(types.func),},operations: {request: {run(node: LogMiddlewareNode, operation: RequestOperation): NodeDefinition {const { logRequests, logResponses, sink } = node.definition.properties;const { metadata, next, query } = operation.properties;if (!next) {return error('LogMiddleware cannot be used as a base middleware.');}if (logRequests) {sink(`Request [${operation.id}]:`, getType(operation.properties.query));}return resolve([{target: withScopeFrom(next,traverse(next.definition, requestOperation(query, metadata)),),allowErrors: true,},],([response]) => {if (logResponses) {sink(`Response [${operation.id}]:`, getType(response.definition));}return response;},);},},},})

Const LogNodeType

LogNodeType: StatelessNodeType<"log", LogNodeProperties> = createNodeType<'log',LogNodeProperties>('log', {shape: {target: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ target }: LogNodeProperties): [NodeDependency] {return [{target,allowPending: true,allowErrors: true,acceptNil: true,},];},run(node: LogNode, options: never, [targetValue]: [GraphNode]): NodeDefinition {const { target } = node.definition.properties;const input = target;const output = targetValue.definition;window.console.log({ input: getType(input), output: getType(output) });return target;},},},})

The implementation of the log. See the log documentation to learn more.

Const LogicNodeTypes

LogicNodeTypes: Array<NodeType> = [AndNodeType,ChooseNodeType,EqNodeType,GtNodeType,GteNodeType,IfElseNodeType,LtNodeType,LteNodeType,NotNodeType,OrNodeType,OtherwiseNodeType,SwitchOnNodeType,WhenNodeType,]

Const LowerCaseNodeType

LowerCaseNodeType: StatelessNodeType<"lower-case", LowerCaseNodeProperties> = createNodeType<'lower-case', LowerCaseNodeProperties>('lower-case', {shape: {subject: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ subject }: LowerCaseNodeProperties): Array<NodeDependency> {return [{target: subject,until: untilStringValueNode(LowerCaseNodeType, 'subject'),},];},run(node: LowerCaseNode, options: never, [subject]: [ValueNode<string>]): NodeDefinition {return value(subject.definition.properties.value.toLowerCase());},},},})

The implementation of the lowerCase node. See the lowerCase documentation to learn more.

Const LtNodeType

LtNodeType: StatelessNodeType<"lt", LtNodeProperties> = createNodeType<'lt',LtNodeProperties>('lt', {shape: {left: graphTypes.nodeDefinition,right: graphTypes.nodeDefinition,},operations: {evaluate: {getDependencies({ left, right }: LtNodeProperties): Array<NodeDependency> {return [left, right].map((operand) => ({target: operand,until: {predicate: ValueNodeType.is,errorMessage(node: GraphNode): string {return getInvalidTypeErrorMessage('Lt node operands must resolve to value() nodes', {expected: ValueNodeType,received: node.definition,});},},}));},run(node: LtNode,options: never,[left, right]: [ValueNode<number>, ValueNode<number>],): NodeDefinition {const leftValue = left.definition.properties.value;const rightValue = right.definition.properties.value;return value(leftValue < rightValue);},},},})

The implementation of the lt node. See the lt documentation to learn more.