@smthrs/plan 1.0.0-rc.12 → 1.0.0-rc.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +3 -3
- package/dist/cjs/Node.d.ts +8 -0
- package/dist/cjs/Node.d.ts.map +1 -1
- package/dist/cjs/Node.js +1 -0
- package/dist/cjs/Node.js.map +2 -2
- package/dist/cjs/internal/node.d.ts +2 -0
- package/dist/cjs/internal/node.d.ts.map +1 -1
- package/dist/cjs/internal/node.js +13 -2
- package/dist/cjs/internal/node.js.map +2 -2
- package/dist/esm/Node.d.ts +8 -0
- package/dist/esm/Node.d.ts.map +1 -1
- package/dist/esm/Node.js +8 -3
- package/dist/esm/Node.js.map +1 -1
- package/dist/esm/internal/node.d.ts +2 -0
- package/dist/esm/internal/node.d.ts.map +1 -1
- package/dist/esm/internal/node.js +13 -2
- package/dist/esm/internal/node.js.map +1 -1
- package/docs/api.md +2 -2
- package/docs/guides/diff-two-plans.md +1 -1
- package/docs/installation.md +1 -1
- package/package.json +8 -8
- package/src/Node.ts +8 -3
- package/src/internal/node.ts +17 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `Node.maximumArmDepth` exposes the existing eager branch construction limit so bounded patterns can reject unsupported declarations before planning. The limit and refusal behavior are unchanged. ([#4103](https://github.com/smithersai/smithers/issues/4103)).
|
|
8
|
+
|
|
5
9
|
### Fixed
|
|
6
10
|
|
|
7
11
|
- `Node.representationIdentity` writes the representation a sealed action's step key hashes as `effect@4.0.0-rc.115` wrote it, with the six built-in check ids `effect@4.0.4` renamed written back. A schema with `Schema.brand` re-keys once, because the brand is no longer part of the AST. ([#3839](https://github.com/smithersai/smithers/issues/3839)).
|
package/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Release candidate scope, host requirements and compatibility review are defined in the [library support policy](https://github.com/smithersai/smithers/blob/main/RELEASE_SUPPORT.md).
|
|
4
4
|
|
|
5
|
-
This package declares `effect` as
|
|
6
|
-
`effect` release
|
|
5
|
+
This package declares `effect` as an exact `4.0.5` peer dependency. Install one
|
|
6
|
+
`effect` release at that version so all Smithers packages share one Effect
|
|
7
7
|
runtime.
|
|
8
8
|
|
|
9
9
|
**Documentation:** https://github.com/smithersai/smithers/tree/main/packages/smithers/flows/plan/docs
|
|
@@ -36,7 +36,7 @@ supplies:
|
|
|
36
36
|
pnpm add @effect/platform-node @effect/platform-node-shared
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
Node.js 26.4.0 or later, and `effect`
|
|
39
|
+
Node.js 26.4.0 or later, and `effect` `4.0.5` as a peer. Recording a plan
|
|
40
40
|
is [`@smthrs/plan-store`](https://github.com/smithersai/smithers/tree/main/packages/smithers/flows/plan-store/docs), which owns the SQL
|
|
41
41
|
and brings [`@smthrs/database`](https://github.com/smithersai/smithers/tree/main/packages/smithers/flows/database/docs) with it.
|
|
42
42
|
|
package/dist/cjs/Node.d.ts
CHANGED
|
@@ -388,6 +388,14 @@ export declare const bindPlanned: {
|
|
|
388
388
|
<A, B, E2, R2>(build: (reference: Planned.Planned<A>) => Node<B, E2, R2>): <E, R>(self: Node<A, E, R>) => Node<B, E | E2, R | R2>;
|
|
389
389
|
<A, E, R, B, E2, R2>(self: Node<A, E, R>, build: (reference: Planned.Planned<A>) => Node<B, E2, R2>): Node<B, E | E2, R | R2>;
|
|
390
390
|
};
|
|
391
|
+
/**
|
|
392
|
+
* Maximum eagerly nested branch arms. Arm construction precedes graph walking;
|
|
393
|
+
* this bound leaves native stack headroom for a typed refusal.
|
|
394
|
+
*
|
|
395
|
+
* @since 1.0.0
|
|
396
|
+
* @category constants
|
|
397
|
+
*/
|
|
398
|
+
export declare const maximumArmDepth = 512;
|
|
391
399
|
/**
|
|
392
400
|
* Decides between two arms, both of them static topology.
|
|
393
401
|
*
|
package/dist/cjs/Node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Node.d.ts","sourceRoot":"","sources":["../../src/Node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAClD,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,QAAQ,MAAM,oBAAoB,CAAA;AAC9C,OAAO,KAAK,sBAAsB,MAAM,8BAA8B,CAAA;AACtE,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,EAAE,MAAwB,CAAA;AAE7C;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,oBAAoB,CAAA;AAEzC;;;;;;;GAOG;AACH,MAAM,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAA;AAElC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,6DAAoB,CAAA;AAEzC;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAA;AAExC;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;AAE/E;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,2DAA4B,CAAA;AAEzD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC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AqBG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,IAAI,SAAS,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,EACzG,UAAU,CAAC,EACX,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,IAAI,KAAK,CAAC,KACjD,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,CAA0C,CAAA"}
|
package/dist/cjs/Node.js
CHANGED
package/dist/cjs/Node.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Node.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Pure, pipeable nodes: the shape a flow body describes and nothing more.\n *\n * Building a node records an inspectable AST and executes nothing \u2014 the same\n * split as Bazel's `ctx.actions.run`, which declares an action rather than\n * running one. A plan is\n * always a DAG, so there is no loop node here and never will be: repetition\n * lives one level up, in what a flow settles with.\n *\n * A node also carries Effect's requirement channel, `R`, and carries it as a\n * PHANTOM: building a plan demands nothing, and every combinator here unions\n * `R` without ever reading it. What fills the channel is a call to something\n * whose code lives elsewhere \u2014 an action \u2014 so the type of a plan states which\n * implementations executing it will need, and the place that executes it is\n * where the compiler asks for them.\n *\n * Control flow is structure. {@link branch} takes both arms and evaluates each\n * ONCE, symbolically, so the exit condition and the handoff site are visible\n * topology before anything runs; its predicate is digested and runs later on\n * the real value. {@link map} is transformation only. The rule the authoring\n * note states, and this module encodes: **map transforms; branch decides.**\n *\n * Adapted from `@smthrs/core` (`packages/smithers/flows/core`) `Node.ts`.\n * `Dynamic` is gone \u2014 a model call is an ordinary action, and nothing\n * model-shaped belongs in this package \u2014 and node annotations are gone with\n * it, because the AST has to stay JSON serializable.\n *\n * @since 0.1.0\n */\n\nimport { dual } from \"effect/Function\"\nimport type * as Pipeable from \"effect/Pipeable\"\nimport type * as Schema from \"effect/Schema\"\nimport type * as SchemaAST from \"effect/SchemaAST\"\nimport type * as Types from \"effect/Types\"\nimport { GraphBuildError } from \"./GraphBuildError.ts\"\nimport * as internal from \"./internal/node.ts\"\nimport * as internalSchemaIdentity from \"./internal/SchemaIdentity.ts\"\nimport * as Planned from \"./Planned.ts\"\n\n/**\n * The runtime type identifier carried by every node.\n *\n * @since 0.1.0\n * @category type ids\n * @slop\n */\nexport const TypeId: TypeId = internal.TypeId\n\n/**\n * The type-level form of {@link TypeId}.\n *\n * @since 0.1.0\n * @category type ids\n * @slop\n */\nexport type TypeId = \"~@smthrs/plan/Node\"\n\n/**\n * The inspectable AST a node stores: closure-free, and JSON serializable for\n * every JSON payload an author puts in it.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Ast = internal.NodeAst\n\n/**\n * How a flow call joins the caller's plan: `inline` splices the callee's body\n * in, `boundary` makes it one child execution, and `handoff` names the next\n * trampoline round.\n *\n * This is the ONE call-mode vocabulary. {@link flowCall} takes it and\n * `@smthrs/flow`'s graph builder switches on it, so a second spelling in\n * either package would fork the moment one gained a mode.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport const CallMode = internal.CallMode\n\n/**\n * The value form of {@link CallMode}.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type CallMode = internal.CallMode\n\n/**\n * The serializable stand-in an AST keeps for a plan-time function: a digest of\n * its normalized source, hashed in place of a closure that could not be\n * shipped, stored, or compared.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type FunctionIdentity = Extract<Ast, { readonly _tag: \"Map\" }>[\"mapper\"]\n\n/**\n * Reads the inert AST reference created for a planned value.\n *\n * Structural lookalikes remain ordinary payload data. This accessor is the\n * only recognition path because the marker itself is deliberately private to\n * the AST cloner.\n *\n * @since 1.0.0\n * @category accessors\n */\nexport const plannedReference = internal.plannedReference\n\n/**\n * A pure graph-building value, covariant in what it will succeed and fail\n * with and in what it will need to run. It is a description: holding one has\n * run nothing.\n *\n * `R` is Effect's requirement channel, and it is PHANTOM here. Nothing at plan\n * time reads it: the AST, the graph built from it, its key material, and every\n * digest are identical whatever `R` says. It exists so a value that names an\n * implementation it does not carry \u2014 an action call \u2014 can say so in its type,\n * and so the place that finally has to run that implementation can demand it.\n * Building a plan therefore stays requirement-free; only executing one is not.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface Node<out A, out E = never, out R = never> extends Pipeable.Pipeable {\n readonly [TypeId]: {\n readonly _A: Types.Covariant<A>\n readonly _E: Types.Covariant<E>\n readonly _R: Types.Covariant<R>\n }\n readonly ast: Ast\n}\n\n/**\n * Any node, whatever it succeeds or fails with and whatever it requires.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Any = Node<unknown, unknown, any>\n\n/**\n * The success type of a node.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Success<N> = N extends Node<infer A, infer _E, infer _R> ? A : never\n\n/**\n * The error type of a node.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Error<N> = N extends Node<infer _A, infer E, infer _R> ? E : never\n\n/**\n * The requirements of a node: what has to be provided wherever it is finally\n * executed, and nothing that has to be provided to build it.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Services<N> = N extends Node<infer _A, infer _E, infer R> ? R : never\n\n/**\n * The node reference a branch arm's symbolic subject carries. Arms are built\n * before the graph assigns ids, so every reference an arm records names this\n * placeholder, and graph building rewrites it to the branch's own upstream\n * node \u2014 which is `first`, structurally, and therefore not a guess.\n *\n * @since 0.1.0\n * @category constants\n * @slop\n */\nexport const branchSubject = \"branch/subject\"\n\n/** @private */\nconst subjectsKey = Symbol.for(\"@smthrs/plan/Node/subjects/v1\")\nconst globals = globalThis as typeof globalThis & { [subjectsKey]?: { branch: number; catch: number } }\nconst subjects = globals[subjectsKey] ??= { branch: 0, catch: 0 }\n\n/**\n * The prefix of the node reference a catch failure arm's symbolic error\n * carries. Each {@link catch_} mints its own token under this prefix, so an\n * outer error captured inside a nested failure arm keeps naming the outer\n * catch, and graph building rewrites each token to the node that catch\n * protects.\n *\n * @since 0.1.0\n * @category constants\n * @slop\n */\nexport const catchSubject = \"catch/subject\"\n\n/**\n * The two arms of a decision plus the predicate that chooses between them.\n *\n * `if` runs at RUN time on the real value. `then` and `else` run at PLAN time,\n * once each, against a {@link module:Planned.Planned} placeholder \u2014 they\n * describe topology, so they may pass the value on but never compute on it.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface BranchOptions<A, B1, E1, R1, B2, E2, R2> {\n readonly if: (value: A) => boolean\n readonly then: (value: Planned.Planned<A>) => Node<B1, E1, R1>\n readonly else: (value: Planned.Planned<A>) => Node<B2, E2, R2>\n}\n\n/**\n * The statically planned recovery arm and optional schema selecting which\n * typed failures it handles.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface CatchOptions<E, B, E2, R2 = never, Handled = E> {\n readonly error?: Schema.Schema<Handled> | undefined\n readonly onFailure: (error: Planned.Planned<Handled>) => Node<B, E2, R2>\n}\n\n/**\n * Checks whether a value is a node.\n *\n * A node this package built is recognized by registration at construction. A\n * node that crossed a serialization boundary, an object sharing the node\n * prototype whose own `ast` is a well-formed AST, is recognized by that shape,\n * because `@smthrs/flow` hands a rehydrated AST back as a node and its side\n * tables are all a round trip loses. The {@link TypeId} marker is a public\n * string any object can carry, so it counts for nothing on its own: every\n * combinator that admits a node reads its `ast` as trusted topology, and an\n * object carrying the marker on any other prototype, one inheriting it from a\n * node, and one whose `ast` is missing, malformed, cyclic, or an accessor are\n * all refused with the same `GraphBuildError` as any other non-node. A proxy\n * is judged by the shape it forwards: one that forwards a node unchanged\n * passes, and one that diverges from it does not.\n *\n * @since 0.1.0\n * @category guards\n * @slop\n */\nexport const isNode = (value: unknown): value is Any => internal.isNode(value)\n\n/**\n * The inert value delivered by {@link succeed}. Planned references resolve to\n * their result type; other values follow the payload's JSON projection.\n * Invalid dates serialize to null. Members without a JSON representation are\n * omitted from objects and replaced with null in arrays.\n *\n * @since 1.0.0\n * @category models\n */\nexport type Succeed<A> = A extends Planned.Planned<infer Value> ? Value\n : A extends Date ? string | null\n : A extends { toJSON: (...args: any) => infer Value } ? Succeed<Value>\n : A extends (...args: any) => any ? undefined\n : A extends symbol ? undefined\n : A extends ReadonlyArray<unknown> ? { [K in keyof A]: SucceedArrayMember<A[K]> }\n : A extends object ? {\n [K in keyof A as K extends string | number ? [Succeed<A[K]>] extends [undefined] ? never : K : never]: Succeed<\n A[K]\n >\n }\n : A\n\n/** @private */\ntype SucceedArrayMember<A> = A extends Planned.Planned<infer Value> ? Value\n : A extends unknown ? Succeed<A> extends infer Value ? Value extends undefined ? null : Value\n : never\n : never\n\n/**\n * A node that succeeds with the constant's inert JSON projection.\n *\n * Dates produce strings (or null for invalid dates), URLs produce strings,\n * and callable object members are omitted. Use {@link map} to reconstruct a\n * domain value explicitly after this serialization boundary.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const succeed = <A>(value: A): Node<Succeed<A>> => internal.makeNode<Succeed<A>>(internal.succeed(value))\n\n/**\n * The inert error delivered by {@link fail}: the same JSON projection\n * {@link Succeed} describes, because a plan stores an error exactly as it\n * stores a value.\n *\n * @since 1.0.0\n * @category models\n */\nexport type Fail<E> = Succeed<E>\n\n/**\n * A node that fails with the constant's inert JSON projection, in the typed\n * error channel.\n *\n * It is how a plan states a refusal it already knows about \u2014 an unsupported\n * input, an exhausted budget, a compensation that has nothing left to undo \u2014\n * without an action that exists only to fail. {@link catch} recovers it exactly\n * as it recovers an action's failure, and an uncaught one is the flow's typed\n * failure.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const fail = <E>(error: E): Node<never, Fail<E>> => internal.makeNode<never, Fail<E>>(internal.fail(error))\n\n/**\n * Combines independent children into one node, keyed by name.\n *\n * Width is fixed here, at plan time. Fanning out over something a step\n * discovered is not this: end the round and carry the list in the next flow's\n * payload, where it is real data.\n *\n * @since 0.1.0\n * @category constructors\n * @slop\n */\nexport const all = <const Nodes extends Readonly<Record<string, Any>>>(\n nodes: Nodes\n): Node<\n Types.Simplify<{ readonly [K in keyof Nodes]: Success<Nodes[K]> }>,\n Error<Nodes[keyof Nodes]>,\n Services<Nodes[keyof Nodes]>\n> => internal.makeNode(internal.all(memberAsts(nodes, \"all\", \"invalid_all_member\")))\n\n/**\n * The member ASTs of a combination, keyed by name, refusing a non-node member.\n *\n * @private\n */\nconst memberAsts = (\n nodes: Readonly<Record<string, unknown>>,\n combinator: string,\n code: \"invalid_all_member\" | \"invalid_join\"\n): Record<string, Ast> => {\n const asts: Record<string, Ast> = Object.create(null) as Record<string, Ast>\n for (const [member, node] of Object.entries(nodes)) {\n if (!isNode(node)) {\n throw new GraphBuildError({\n code,\n node: member,\n path: [],\n message: `Node.${combinator} expected a Node at member \"${member}\"`\n })\n }\n Object.defineProperty(asts, member, {\n configurable: true,\n enumerable: true,\n value: node.ast,\n writable: true\n })\n }\n return asts\n}\n\n/**\n * Builds a join that settles early, refusing a member set it could never\n * decide on.\n *\n * @private\n */\nconst join = (mode: internal.RaceMode, count: number, nodes: Readonly<Record<string, unknown>>): Ast => {\n const asts = memberAsts(nodes, mode, \"invalid_join\")\n const width = Object.keys(asts).length\n if (!internal.isRaceCount(mode, count, width)) {\n throw new GraphBuildError({\n code: \"invalid_join\",\n node: mode,\n path: [],\n message: mode === \"quorum\"\n ? `Node.quorum needs a whole number of successes between 1 and its ${width} members, got ${String(count)}`\n : `Node.${mode} needs at least one member`\n })\n }\n return internal.race(mode, count, asts)\n}\n\n/**\n * The members of an early-settling join, keyed by name.\n *\n * @since 1.0.0\n * @category models\n */\nexport type Members = Readonly<Record<string, Any>>\n\n/**\n * Settles with the first member to settle, success or typed failure.\n *\n * The other members are interrupted. The winner is journaled, so a resumed run\n * settles the same member and never starts the others again.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const race = <const Nodes extends Members>(\n nodes: Nodes\n): Node<Success<Nodes[keyof Nodes]>, Error<Nodes[keyof Nodes]>, Services<Nodes[keyof Nodes]>> =>\n internal.makeNode(join(\"race\", 1, nodes))\n\n/**\n * Settles with the first member to succeed, ignoring typed failures while a\n * member is still running.\n *\n * It fails with the last failure when every member fails. The other members\n * are interrupted, and the winner is journaled as {@link race} journals it.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const any = <const Nodes extends Members>(\n nodes: Nodes\n): Node<Success<Nodes[keyof Nodes]>, Error<Nodes[keyof Nodes]>, Services<Nodes[keyof Nodes]>> =>\n internal.makeNode(join(\"any\", 1, nodes))\n\n/**\n * Succeeds once `count` members succeed, with exactly those members' values\n * keyed by name.\n *\n * It fails with the failure that leaves fewer than `count` members able to\n * succeed. Either way the members still running are interrupted, and the\n * members that decided are journaled as {@link race} journals its winner.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const quorum = <const Nodes extends Members>(\n count: number,\n nodes: Nodes\n): Node<\n Types.Simplify<{ readonly [K in keyof Nodes]?: Success<Nodes[K]> }>,\n Error<Nodes[keyof Nodes]>,\n Services<Nodes[keyof Nodes]>\n> => internal.makeNode(join(\"quorum\", count, nodes))\n\n/**\n * Transforms an eventual success value with a deferred pure function.\n *\n * The function is digested, not run: it executes later, on the real value.\n * This is where computation on a step result belongs \u2014 and only computation. A\n * `map` that decides what happens next is a `branch` written wrongly.\n *\n * @since 0.1.0\n * @category mapping\n * @slop\n */\nexport const map: {\n <A, B>(f: (a: A) => B): <E, R>(self: Node<A, E, R>) => Node<B, E, R>\n <A, E, R, B>(self: Node<A, E, R>, f: (a: A) => B): Node<B, E, R>\n} = dual(\n 2,\n <A, E, R, B>(self: Node<A, E, R>, f: (a: A) => B): Node<B, E, R> =>\n internal.makeNode<B, E, R>(internal.map(self.ast, (value) => f(value as A), f))\n)\n\n/**\n * Starts the entire next subtree only after this node succeeds, without\n * consuming its result. Failure or interruption prevents that subtree from\n * starting, including actions nested inside combinations or inline flows.\n *\n * Use {@link bindPlanned} to build a dependency from a symbolic result, or\n * {@link map} to compute on the eventual value.\n *\n * @since 0.1.0\n * @category sequencing\n * @slop\n */\nexport const andThen: {\n <B, E2, R2>(next: Node<B, E2, R2>): <A, E, R>(self: Node<A, E, R>) => Node<B, E | E2, R | R2>\n <A, E, R, B, E2, R2>(self: Node<A, E, R>, next: Node<B, E2, R2>): Node<B, E | E2, R | R2>\n} = dual(\n 2,\n <A, E, R, B, E2, R2>(\n self: Node<A, E, R>,\n next: Node<B, E2, R2>\n ): Node<B, E | E2, R | R2> => {\n if (!isNode(next)) {\n throw new GraphBuildError({\n code: \"invalid_continuation\",\n node: \"andThen/next\",\n path: [],\n message:\n \"Node.andThen expects a Node; use Node.bindPlanned for a symbolic builder or Node.map for value computation\"\n })\n }\n return internal.makeNode<B, E | E2, R | R2>(internal.andThenNode(self.ast, next.ast))\n }\n)\n\n/**\n * Builds a dependency using a symbolic reference to this node's future result.\n *\n * The builder runs during planning. Its argument is a {@link module:Planned.Planned}\n * reference, not the value the node will eventually produce. Pass references\n * into action payloads; use {@link branch} for decisions and {@link map} for\n * computation on real results. JavaScript truthiness and reference equality\n * cannot inspect a planned result. Enable type-aware ESLint's\n * `@typescript-eslint/strict-boolean-expressions` to reject planned conditions.\n * Independent descendants of the built subtree can start while this producer\n * is running; consumers of its reference wait for its value. Use\n * {@link andThen} when the whole next subtree must wait for success.\n *\n * @since 1.0.0\n * @category sequencing\n */\nexport const bindPlanned: {\n <A, B, E2, R2>(\n build: (reference: Planned.Planned<A>) => Node<B, E2, R2>\n ): <E, R>(self: Node<A, E, R>) => Node<B, E | E2, R | R2>\n <A, E, R, B, E2, R2>(\n self: Node<A, E, R>,\n build: (reference: Planned.Planned<A>) => Node<B, E2, R2>\n ): Node<B, E | E2, R | R2>\n} = dual(\n 2,\n <A, E, R, B, E2, R2>(\n self: Node<A, E, R>,\n build: (reference: Planned.Planned<A>) => Node<B, E2, R2>\n ): Node<B, E | E2, R | R2> =>\n internal.makeNode<B, E | E2, R | R2>(\n internal.andThen(self.ast, (value) => build(value as Planned.Planned<A>), build)\n )\n)\n\n// Arm builders run before the graph walker can enforce its topology bound.\n// Leave native stack headroom to construct the typed refusal and unwind.\nconst maximumArmDepth = 512\nlet armDepth = 0\n\n/**\n * Builds one arm, once, against the symbolic subject.\n *\n * @private\n */\nconst arm = <A, B, E, R>(\n build: (value: Planned.Planned<A>) => Node<B, E, R>,\n subject: Planned.Planned<A>,\n side: string\n): Ast => {\n if (armDepth >= maximumArmDepth) {\n throw new GraphBuildError({\n code: \"graph_too_deep\",\n node: `${branchSubject}/${side}`,\n path: [],\n message: \"Node.branch recursion needs a plan-time bound, such as a payload-derived round count. \" +\n \"Both arms are built before the run-time predicate is evaluated.\"\n })\n }\n armDepth++\n try {\n const node = build(subject)\n if (!isNode(node)) {\n throw new GraphBuildError({\n code: \"invalid_continuation\",\n node: `${branchSubject}/${side}`,\n path: [],\n message: `Node.branch expected its \"${side}\" arm to return a Node`\n })\n }\n return node.ast\n } finally {\n armDepth--\n }\n}\n\n/**\n * Decides between two arms, both of them static topology.\n *\n * Each arm builder is evaluated exactly once, here, against a\n * {@link module:Planned.Planned} placeholder, and the resulting ASTs are what\n * the node stores \u2014 so a plan shows the exit condition and both continuations\n * before it runs. The predicate is digested and evaluated at run time on the\n * real value, which is why none of the plan-time placeholder machinery leaks\n * into control flow.\n *\n * Both arms contribute their requirements, because both arms are topology the\n * plan carries. A run takes one of them, but which one is not known until the\n * predicate sees the real value, so an execution has to be able to take either.\n *\n * @since 0.1.0\n * @category sequencing\n * @slop\n */\nexport const branch: {\n <A, B1, E1, R1, B2, E2, R2>(\n options: BranchOptions<A, B1, E1, R1, B2, E2, R2>\n ): <E, R>(self: Node<A, E, R>) => Node<B1 | B2, E | E1 | E2, R | R1 | R2>\n <A, E, R, B1, E1, R1, B2, E2, R2>(\n self: Node<A, E, R>,\n options: BranchOptions<A, B1, E1, R1, B2, E2, R2>\n ): Node<B1 | B2, E | E1 | E2, R | R1 | R2>\n} = dual(\n 2,\n <A, E, R, B1, E1, R1, B2, E2, R2>(\n self: Node<A, E, R>,\n options: BranchOptions<A, B1, E1, R1, B2, E2, R2>\n ): Node<B1 | B2, E | E1 | E2, R | R1 | R2> => {\n const predicate = options.if\n const subjectToken = `${branchSubject}/${subjects.branch++}`\n const subject = Planned.make<A>(subjectToken)\n return internal.makeNode<B1 | B2, E | E1 | E2, R | R1 | R2>(\n internal.branch(\n subjectToken,\n self.ast,\n (value) => predicate(value as A),\n predicate,\n arm(options.then, subject, \"then\"),\n arm(options.else, subject, \"else\")\n )\n )\n }\n)\n\n/**\n * Recovers from matching typed failures with static failure topology.\n *\n * The protected graph and failure arm are both stored in the AST. The arm is\n * built once at plan time against a strict planned error placeholder. With no\n * schema the whole typed error channel is handled. A schema handles only the\n * values it accepts, so its overloads retain E: a refinement can reject values\n * without narrowing its TypeScript type. Runtime schema callbacks enter the\n * filter identity along with its JSON Schema. Uncaptured callbacks are local\n * to this process, just like uncaptured mappers.\n *\n * The failure arm contributes its requirements to the node's, for the same\n * reason a branch's arms do: it is topology the plan carries, and a run reaches\n * it whenever the protected graph fails.\n *\n * @since 0.1.0\n * @category sequencing\n * @slop\n */\nconst catch_: {\n <Handled, B, E2, R2>(\n options: CatchOptions<unknown, B, E2, R2, Handled> & {\n readonly error: Schema.Schema<Handled>\n }\n ): <A, E, R>(self: Node<A, E, R>) => Node<A | B, E | E2, R | R2>\n <E, B, E2, R2>(\n options: CatchOptions<E, B, E2, R2> & {\n readonly error?: undefined\n }\n ): <A, R>(self: Node<A, E, R>) => Node<A | B, E2, R | R2>\n <A, E, R, Handled, B, E2, R2>(\n self: Node<A, E, R>,\n options: CatchOptions<E, B, E2, R2, Handled> & {\n readonly error: Schema.Schema<Handled>\n }\n ): Node<A | B, E | E2, R | R2>\n <A, E, R, B, E2, R2>(\n self: Node<A, E, R>,\n options: CatchOptions<E, B, E2, R2> & {\n readonly error?: undefined\n }\n ): Node<A | B, E2, R | R2>\n} = dual(\n 2,\n <A, E, R, Handled, B, E2, R2>(\n self: Node<A, E, R>,\n options: CatchOptions<E, B, E2, R2, Handled>\n ): Node<A | B, E | E2, R | R2> => {\n const subjectToken = `${catchSubject}/${subjects.catch++}`\n const failure = options.onFailure(Planned.make<Handled>(subjectToken))\n if (!isNode(failure)) {\n throw new GraphBuildError({\n code: \"invalid_continuation\",\n node: catchSubject,\n path: [],\n message: \"Node.catch expected its failure arm to return a Node\"\n })\n }\n return internal.makeNode(internal.catch_(subjectToken, self.ast, failure.ast, options.error))\n }\n)\n\nexport { catch_ as catch }\n\n/**\n * Attaches a scheduling priority to a node, leaving the original unchanged.\n *\n * The scheduler runs ready work with a higher number first, so a priority\n * changes LATENCY and nothing else. It never enters key material: a node\n * ordered ahead of another still computes the same result, so re-keying it\n * would throw away a legitimate cache hit. Children inherit the value\n * lexically when the graph is built, and a child that states its own keeps it.\n *\n * @since 0.1.0\n * @category annotations\n * @slop\n */\nexport const priority: {\n (value: number): <A, E, R>(self: Node<A, E, R>) => Node<A, E, R>\n <A, E, R>(self: Node<A, E, R>, value: number): Node<A, E, R>\n} = dual(\n 2,\n <A, E, R>(self: Node<A, E, R>, value: number): Node<A, E, R> => {\n if (!Number.isSafeInteger(value)) {\n throw new GraphBuildError({\n code: \"invalid_priority\",\n node: self.ast._tag,\n path: [],\n message: `Node.priority expects a safe integer, received ${value}`\n })\n }\n return internal.makeNode<A, E, R>(internal.withPriority(self.ast, value))\n }\n)\n\n/**\n * Reads the scheduling priority a node carries, or `undefined` when it states\n * none and inherits from whatever encloses it.\n *\n * @since 0.1.0\n * @category accessors\n * @slop\n */\nexport const declaredPriority = (ast: Ast): number | undefined => ast.priority\n\n/**\n * Constructs the flow-call node used by `@smthrs/flow` without making flow\n * calls part of the public authoring surface of this package.\n *\n * Reserved for `@smthrs/flow`, which owns flow authoring. It is not part\n * of this package's authoring surface, and it validates nothing: an unknown\n * flow tag becomes a call node the graph keeps as a leaf.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const flowCall = <A = unknown, E = never, R = never>(\n declaration: unknown,\n flow: string,\n mode: CallMode,\n payload: unknown\n): Node<A, E, R> => internal.makeNode<A, E, R>(internal.flowCall(declaration, flow, mode, payload))\n\n/**\n * Constructs the action-call node used by `@smthrs/flow` without making\n * action calls part of the public authoring surface of this package.\n *\n * Reserved for `@smthrs/flow`, which owns action authoring. It is not part\n * of this package's authoring surface, and an unknown action tag becomes a\n * call node the graph keeps as a leaf.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const actionCall = <A = unknown, E = never, R = never>(\n declaration: unknown,\n action: string,\n payload: unknown\n): Node<A, E, R> => internal.makeNode<A, E, R>(internal.actionCall(declaration, action, payload))\n\n/**\n * Reads the flow or action declaration a call node names, so `@smthrs/flow`\n * can expand a call it recorded. It is `undefined` for an AST that was\n * rehydrated from JSON, because the declaration lives beside the AST rather\n * than inside it \u2014 a graph built from such an AST keeps the call as a leaf.\n *\n * Reserved for `@smthrs/flow`, which files the declaration when it builds\n * the call. Authors never call it.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const declaration = (\n ast: Extract<Ast, { readonly _tag: \"ActionCall\" | \"FlowCall\" }>\n): unknown => internal.declaration(ast)\n\n/**\n * Reads the continuation builder of a sequenced node, which graph building\n * evaluates once against a placeholder. It is `undefined` when the author\n * supplied a node directly \u2014 the topology is already in `next` \u2014 and for a\n * rehydrated AST, whose side table did not survive serialization.\n *\n * Reserved for `@smthrs/flow`'s graph walk. Authors never call it.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const continuation = (\n ast: Extract<Ast, { readonly _tag: \"AndThen\" }>\n): ((value: Planned.Planned<unknown>) => unknown) | undefined => internal.operation(ast)\n\n/**\n * Reads the deferred mapper of a {@link map} node, which a driver applies to\n * the real upstream value once it has one. It is `undefined` for every other\n * variant, and for a rehydrated AST whose side table did not survive\n * serialization.\n *\n * Reserved for `@smthrs/flow`'s interpreter. Authors never call it.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const mapper = (ast: Ast): ((value: unknown) => unknown) | undefined =>\n ast._tag === \"Map\" ? internal.operation(ast) : undefined\n\n/**\n * Reads the run-time predicate of a {@link branch} node, which a driver\n * evaluates on the real subject value to choose an arm. It is `undefined` for\n * every other variant, and for a rehydrated AST whose side table did not\n * survive serialization.\n *\n * Reserved for `@smthrs/flow`'s interpreter. Authors never call it.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const predicate = (ast: Ast): ((value: unknown) => boolean) | undefined =>\n ast._tag === \"Branch\" ? internal.predicate(ast) : undefined\n\n/**\n * Reads the optional schema selecting failures handled by a {@link catch_}.\n *\n * Reserved for `@smthrs/flow`'s interpreter. It is `undefined` for every\n * variant but `catch_`, and for a rehydrated AST whose side table did not\n * survive serialization.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const catchFilter = (ast: Ast): Schema.Top | undefined => ast._tag === \"Catch\" ? internal.filter(ast) : undefined\n\n/**\n * Identifies a plan-time function the AST does NOT store, a flow's `body`,\n * exactly as the AST identifies the mapper and continuation it does store.\n * A call that keeps its callee as a leaf still has to re-key when that\n * callee's body is edited, and this is the identity it folds in. Unannotated\n * functions fail closed with process-local identity; use {@link capture} to\n * declare inert captures and obtain deterministic identity.\n *\n * Reserved for `@smthrs/flow`, which folds a callee body's identity into a\n * call it keeps as a leaf. Authors never call it; it throws a `TypeError`\n * when handed anything but a function.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const functionIdentity = (operation: unknown): FunctionIdentity => internal.functionIdentity(operation)\n\n/**\n * The document a schema's identity is: JSON-Schema-shaped, and the same bytes\n * under every `effect` release this package supports.\n *\n * @since 1.0.0\n * @category engine\n */\nexport type SchemaIdentity = internalSchemaIdentity.Document\n\n/**\n * The one option a schema's identity is taken under: whether an object closes\n * over the keys it declares (`\"error\"`) or leaves others open (`\"ignore\"`,\n * the default). It has the meaning it has in `Schema.toJsonSchemaDocument`.\n *\n * @since 1.0.0\n * @category engine\n */\nexport type SchemaIdentityOptions = internalSchemaIdentity.Options\n\n/**\n * The refusal `schemaIdentity` and `representationIdentity` raise for a schema\n * a step key cannot be derived from. Its message is the one\n * `effect@4.0.0-rc.115` gave for the same schema, where it gave one.\n *\n * @since 1.0.0\n * @category errors\n */\nexport const SchemaIdentityError = internalSchemaIdentity.SchemaIdentityError\n\n/**\n * The type of {@link SchemaIdentityError}.\n *\n * @since 1.0.0\n * @category errors\n */\nexport type SchemaIdentityError = internalSchemaIdentity.SchemaIdentityError\n\n/**\n * Identifies a schema by the constraints it documents, so a call re-keys when\n * what its callee accepts or produces changes, and a catch re-keys when its\n * filter does.\n *\n * The document is what `Schema.toJsonSchemaDocument(schema, options)`\n * returned under `effect@4.0.0-rc.115`. It is printed by this package, not by\n * the installed `effect`, because a later release prints a different document\n * for the same schema and a moved identity re-keys every recorded step. Use\n * it wherever the document is hashed, compared or pinned; a JSON Schema shown\n * to a model or a person comes from `Schema.toJsonSchemaDocument`.\n *\n * Reserved for the packages that derive identities. Authors never call it; it\n * throws for a schema that has no JSON Schema form.\n *\n * @since 1.0.0\n * @category engine\n */\nexport const schemaIdentity = (schema: Schema.Top, options?: SchemaIdentityOptions): SchemaIdentity =>\n internalSchemaIdentity.schemaIdentity(schema, options)\n\n/**\n * Identifies a schema AST by its encoded representation, the material a\n * sealed action's step key folds in for its success and error schemas.\n *\n * The value is what `SchemaRepresentation.toJson(SchemaRepresentation.toRepresentation(ast))`\n * returned under `effect@4.0.0-rc.115`, so a later `effect` release does not\n * re-key recorded steps. The one exception is `Schema.brand`: from\n * `effect@4.0.4` on a brand is not part of the AST, so a declaration with a\n * brand re-keys once.\n *\n * Reserved for the packages that derive step keys. Authors never call it; it\n * throws for an AST that has no representation.\n *\n * @since 1.0.0\n * @category engine\n */\nexport const representationIdentity = (ast: SchemaAST.AST): Schema.Json =>\n internalSchemaIdentity.representationIdentity(ast)\n\n/**\n * Binds a frozen plain copy of inert captures as the callback's this receiver.\n *\n * Use a function expression to read the snapshot while keeping the ordinary\n * callback arguments: Node.capture({ factor: 3 }, function(value: number) {\n * return value * this.factor\n * }). Caller objects remain unchanged; lexical aliases still name originals\n * and must not be used as mutable semantic inputs. Nested captures retain the\n * inner callback's snapshot and compose the two identities.\n *\n * Admission walks original descriptors once, rejects built-in brands and\n * non-plain prototypes without evaluating getters, then uses structuredClone\n * to refuse Proxies. Hosts without that API refuse object capture. Only the\n * owned frozen copy enters identity and the wrapper. Sealed, non-extensible,\n * frozen and Immer ordinary data are supported equally. Unsupported values\n * raise a TypeError naming the path. See core docs/api.md#nodecapture for the\n * complete algorithm and the migration from original-object locking.\n *\n * @category constructors\n * @since 0.1.0\n * @slop\n */\nexport const capture = <C extends Readonly<Record<string, unknown>>, Args extends ReadonlyArray<unknown>, A>(\n captures: C,\n operation: (this: Readonly<C>, ...args: Args) => A\n): (...args: Args) => A => internal.capture(captures, operation)\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BA,sBAAqB;AAKrB,6BAAgC;AAChC,eAA0B;AAC1B,6BAAwC;AACxC,cAAyB;AASlB,MAAM,SAAiB,SAAS;AAkChC,MAAM,WAAW,SAAS;AAgC1B,MAAM,mBAAmB,SAAS;AA0ElC,MAAM,gBAAgB;AAG7B,MAAM,cAAc,uBAAO,IAAI,+BAA+B;AAC9D,MAAM,UAAU;AAChB,MAAM,WAAW,QAAQ,WAAW,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE;AAazD,MAAM,eAAe;AAoDrB,MAAM,SAAS,CAAC,UAAiC,SAAS,OAAO,KAAK;AAwCtE,MAAM,UAAU,CAAI,UAA+B,SAAS,SAAqB,SAAS,QAAQ,KAAK,CAAC;AAyB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M,SAAS,CACpB,OACA,UAKG,SAAS,SAAS,KAAK,UAAU,OAAO,KAAK,CAAC;AAa5C,MAAM,UAGT;AAAA,EACF;AAAA,EACA,CAAa,MAAqB,MAChC,SAAS,SAAkB,SAAS,IAAI,KAAK,KAAK,CAAC,UAAU,EAAE,KAAU,GAAG,CAAC,CAAC;AAClF;AAcO,MAAM,cAGT;AAAA,EACF;AAAA,EACA,CACE,MACA,SAC4B;AAC5B,QAAI,CAAC,OAAO,IAAI,GAAG;AACjB,YAAM,IAAI,uCAAgB;AAAA,QACxB,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM,CAAC;AAAA,QACP,SACE;AAAA,MACJ,CAAC;AAAA,IACH;AACA,WAAO,SAAS,SAA4B,SAAS,YAAY,KAAK,KAAK,KAAK,GAAG,CAAC;AAAA,EACtF;AACF;AAkBO,MAAM,kBAQT;AAAA,EACF;AAAA,EACA,CACE,MACA,UAEA,SAAS;AAAA,IACP,SAAS,QAAQ,KAAK,KAAK,CAAC,UAAU,MAAM,KAA2B,GAAG,KAAK;AAAA,EACjF;AACJ;
|
|
4
|
+
"sourcesContent": ["/**\n * Pure, pipeable nodes: the shape a flow body describes and nothing more.\n *\n * Building a node records an inspectable AST and executes nothing \u2014 the same\n * split as Bazel's `ctx.actions.run`, which declares an action rather than\n * running one. A plan is\n * always a DAG, so there is no loop node here and never will be: repetition\n * lives one level up, in what a flow settles with.\n *\n * A node also carries Effect's requirement channel, `R`, and carries it as a\n * PHANTOM: building a plan demands nothing, and every combinator here unions\n * `R` without ever reading it. What fills the channel is a call to something\n * whose code lives elsewhere \u2014 an action \u2014 so the type of a plan states which\n * implementations executing it will need, and the place that executes it is\n * where the compiler asks for them.\n *\n * Control flow is structure. {@link branch} takes both arms and evaluates each\n * ONCE, symbolically, so the exit condition and the handoff site are visible\n * topology before anything runs; its predicate is digested and runs later on\n * the real value. {@link map} is transformation only. The rule the authoring\n * note states, and this module encodes: **map transforms; branch decides.**\n *\n * Adapted from `@smthrs/core` (`packages/smithers/flows/core`) `Node.ts`.\n * `Dynamic` is gone \u2014 a model call is an ordinary action, and nothing\n * model-shaped belongs in this package \u2014 and node annotations are gone with\n * it, because the AST has to stay JSON serializable.\n *\n * @since 0.1.0\n */\n\nimport { dual } from \"effect/Function\"\nimport type * as Pipeable from \"effect/Pipeable\"\nimport type * as Schema from \"effect/Schema\"\nimport type * as SchemaAST from \"effect/SchemaAST\"\nimport type * as Types from \"effect/Types\"\nimport { GraphBuildError } from \"./GraphBuildError.ts\"\nimport * as internal from \"./internal/node.ts\"\nimport * as internalSchemaIdentity from \"./internal/SchemaIdentity.ts\"\nimport * as Planned from \"./Planned.ts\"\n\n/**\n * The runtime type identifier carried by every node.\n *\n * @since 0.1.0\n * @category type ids\n * @slop\n */\nexport const TypeId: TypeId = internal.TypeId\n\n/**\n * The type-level form of {@link TypeId}.\n *\n * @since 0.1.0\n * @category type ids\n * @slop\n */\nexport type TypeId = \"~@smthrs/plan/Node\"\n\n/**\n * The inspectable AST a node stores: closure-free, and JSON serializable for\n * every JSON payload an author puts in it.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Ast = internal.NodeAst\n\n/**\n * How a flow call joins the caller's plan: `inline` splices the callee's body\n * in, `boundary` makes it one child execution, and `handoff` names the next\n * trampoline round.\n *\n * This is the ONE call-mode vocabulary. {@link flowCall} takes it and\n * `@smthrs/flow`'s graph builder switches on it, so a second spelling in\n * either package would fork the moment one gained a mode.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport const CallMode = internal.CallMode\n\n/**\n * The value form of {@link CallMode}.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type CallMode = internal.CallMode\n\n/**\n * The serializable stand-in an AST keeps for a plan-time function: a digest of\n * its normalized source, hashed in place of a closure that could not be\n * shipped, stored, or compared.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type FunctionIdentity = Extract<Ast, { readonly _tag: \"Map\" }>[\"mapper\"]\n\n/**\n * Reads the inert AST reference created for a planned value.\n *\n * Structural lookalikes remain ordinary payload data. This accessor is the\n * only recognition path because the marker itself is deliberately private to\n * the AST cloner.\n *\n * @since 1.0.0\n * @category accessors\n */\nexport const plannedReference = internal.plannedReference\n\n/**\n * A pure graph-building value, covariant in what it will succeed and fail\n * with and in what it will need to run. It is a description: holding one has\n * run nothing.\n *\n * `R` is Effect's requirement channel, and it is PHANTOM here. Nothing at plan\n * time reads it: the AST, the graph built from it, its key material, and every\n * digest are identical whatever `R` says. It exists so a value that names an\n * implementation it does not carry \u2014 an action call \u2014 can say so in its type,\n * and so the place that finally has to run that implementation can demand it.\n * Building a plan therefore stays requirement-free; only executing one is not.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface Node<out A, out E = never, out R = never> extends Pipeable.Pipeable {\n readonly [TypeId]: {\n readonly _A: Types.Covariant<A>\n readonly _E: Types.Covariant<E>\n readonly _R: Types.Covariant<R>\n }\n readonly ast: Ast\n}\n\n/**\n * Any node, whatever it succeeds or fails with and whatever it requires.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Any = Node<unknown, unknown, any>\n\n/**\n * The success type of a node.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Success<N> = N extends Node<infer A, infer _E, infer _R> ? A : never\n\n/**\n * The error type of a node.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Error<N> = N extends Node<infer _A, infer E, infer _R> ? E : never\n\n/**\n * The requirements of a node: what has to be provided wherever it is finally\n * executed, and nothing that has to be provided to build it.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport type Services<N> = N extends Node<infer _A, infer _E, infer R> ? R : never\n\n/**\n * The node reference a branch arm's symbolic subject carries. Arms are built\n * before the graph assigns ids, so every reference an arm records names this\n * placeholder, and graph building rewrites it to the branch's own upstream\n * node \u2014 which is `first`, structurally, and therefore not a guess.\n *\n * @since 0.1.0\n * @category constants\n * @slop\n */\nexport const branchSubject = \"branch/subject\"\n\n/** @private */\nconst subjectsKey = Symbol.for(\"@smthrs/plan/Node/subjects/v1\")\nconst globals = globalThis as typeof globalThis & { [subjectsKey]?: { branch: number; catch: number } }\nconst subjects = globals[subjectsKey] ??= { branch: 0, catch: 0 }\n\n/**\n * The prefix of the node reference a catch failure arm's symbolic error\n * carries. Each {@link catch_} mints its own token under this prefix, so an\n * outer error captured inside a nested failure arm keeps naming the outer\n * catch, and graph building rewrites each token to the node that catch\n * protects.\n *\n * @since 0.1.0\n * @category constants\n * @slop\n */\nexport const catchSubject = \"catch/subject\"\n\n/**\n * The two arms of a decision plus the predicate that chooses between them.\n *\n * `if` runs at RUN time on the real value. `then` and `else` run at PLAN time,\n * once each, against a {@link module:Planned.Planned} placeholder \u2014 they\n * describe topology, so they may pass the value on but never compute on it.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface BranchOptions<A, B1, E1, R1, B2, E2, R2> {\n readonly if: (value: A) => boolean\n readonly then: (value: Planned.Planned<A>) => Node<B1, E1, R1>\n readonly else: (value: Planned.Planned<A>) => Node<B2, E2, R2>\n}\n\n/**\n * The statically planned recovery arm and optional schema selecting which\n * typed failures it handles.\n *\n * @since 0.1.0\n * @category models\n * @slop\n */\nexport interface CatchOptions<E, B, E2, R2 = never, Handled = E> {\n readonly error?: Schema.Schema<Handled> | undefined\n readonly onFailure: (error: Planned.Planned<Handled>) => Node<B, E2, R2>\n}\n\n/**\n * Checks whether a value is a node.\n *\n * A node this package built is recognized by registration at construction. A\n * node that crossed a serialization boundary, an object sharing the node\n * prototype whose own `ast` is a well-formed AST, is recognized by that shape,\n * because `@smthrs/flow` hands a rehydrated AST back as a node and its side\n * tables are all a round trip loses. The {@link TypeId} marker is a public\n * string any object can carry, so it counts for nothing on its own: every\n * combinator that admits a node reads its `ast` as trusted topology, and an\n * object carrying the marker on any other prototype, one inheriting it from a\n * node, and one whose `ast` is missing, malformed, cyclic, or an accessor are\n * all refused with the same `GraphBuildError` as any other non-node. A proxy\n * is judged by the shape it forwards: one that forwards a node unchanged\n * passes, and one that diverges from it does not.\n *\n * @since 0.1.0\n * @category guards\n * @slop\n */\nexport const isNode = (value: unknown): value is Any => internal.isNode(value)\n\n/**\n * The inert value delivered by {@link succeed}. Planned references resolve to\n * their result type; other values follow the payload's JSON projection.\n * Invalid dates serialize to null. Members without a JSON representation are\n * omitted from objects and replaced with null in arrays.\n *\n * @since 1.0.0\n * @category models\n */\nexport type Succeed<A> = A extends Planned.Planned<infer Value> ? Value\n : A extends Date ? string | null\n : A extends { toJSON: (...args: any) => infer Value } ? Succeed<Value>\n : A extends (...args: any) => any ? undefined\n : A extends symbol ? undefined\n : A extends ReadonlyArray<unknown> ? { [K in keyof A]: SucceedArrayMember<A[K]> }\n : A extends object ? {\n [K in keyof A as K extends string | number ? [Succeed<A[K]>] extends [undefined] ? never : K : never]: Succeed<\n A[K]\n >\n }\n : A\n\n/** @private */\ntype SucceedArrayMember<A> = A extends Planned.Planned<infer Value> ? Value\n : A extends unknown ? Succeed<A> extends infer Value ? Value extends undefined ? null : Value\n : never\n : never\n\n/**\n * A node that succeeds with the constant's inert JSON projection.\n *\n * Dates produce strings (or null for invalid dates), URLs produce strings,\n * and callable object members are omitted. Use {@link map} to reconstruct a\n * domain value explicitly after this serialization boundary.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const succeed = <A>(value: A): Node<Succeed<A>> => internal.makeNode<Succeed<A>>(internal.succeed(value))\n\n/**\n * The inert error delivered by {@link fail}: the same JSON projection\n * {@link Succeed} describes, because a plan stores an error exactly as it\n * stores a value.\n *\n * @since 1.0.0\n * @category models\n */\nexport type Fail<E> = Succeed<E>\n\n/**\n * A node that fails with the constant's inert JSON projection, in the typed\n * error channel.\n *\n * It is how a plan states a refusal it already knows about \u2014 an unsupported\n * input, an exhausted budget, a compensation that has nothing left to undo \u2014\n * without an action that exists only to fail. {@link catch} recovers it exactly\n * as it recovers an action's failure, and an uncaught one is the flow's typed\n * failure.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const fail = <E>(error: E): Node<never, Fail<E>> => internal.makeNode<never, Fail<E>>(internal.fail(error))\n\n/**\n * Combines independent children into one node, keyed by name.\n *\n * Width is fixed here, at plan time. Fanning out over something a step\n * discovered is not this: end the round and carry the list in the next flow's\n * payload, where it is real data.\n *\n * @since 0.1.0\n * @category constructors\n * @slop\n */\nexport const all = <const Nodes extends Readonly<Record<string, Any>>>(\n nodes: Nodes\n): Node<\n Types.Simplify<{ readonly [K in keyof Nodes]: Success<Nodes[K]> }>,\n Error<Nodes[keyof Nodes]>,\n Services<Nodes[keyof Nodes]>\n> => internal.makeNode(internal.all(memberAsts(nodes, \"all\", \"invalid_all_member\")))\n\n/**\n * The member ASTs of a combination, keyed by name, refusing a non-node member.\n *\n * @private\n */\nconst memberAsts = (\n nodes: Readonly<Record<string, unknown>>,\n combinator: string,\n code: \"invalid_all_member\" | \"invalid_join\"\n): Record<string, Ast> => {\n const asts: Record<string, Ast> = Object.create(null) as Record<string, Ast>\n for (const [member, node] of Object.entries(nodes)) {\n if (!isNode(node)) {\n throw new GraphBuildError({\n code,\n node: member,\n path: [],\n message: `Node.${combinator} expected a Node at member \"${member}\"`\n })\n }\n Object.defineProperty(asts, member, {\n configurable: true,\n enumerable: true,\n value: node.ast,\n writable: true\n })\n }\n return asts\n}\n\n/**\n * Builds a join that settles early, refusing a member set it could never\n * decide on.\n *\n * @private\n */\nconst join = (mode: internal.RaceMode, count: number, nodes: Readonly<Record<string, unknown>>): Ast => {\n const asts = memberAsts(nodes, mode, \"invalid_join\")\n const width = Object.keys(asts).length\n if (!internal.isRaceCount(mode, count, width)) {\n throw new GraphBuildError({\n code: \"invalid_join\",\n node: mode,\n path: [],\n message: mode === \"quorum\"\n ? `Node.quorum needs a whole number of successes between 1 and its ${width} members, got ${String(count)}`\n : `Node.${mode} needs at least one member`\n })\n }\n return internal.race(mode, count, asts)\n}\n\n/**\n * The members of an early-settling join, keyed by name.\n *\n * @since 1.0.0\n * @category models\n */\nexport type Members = Readonly<Record<string, Any>>\n\n/**\n * Settles with the first member to settle, success or typed failure.\n *\n * The other members are interrupted. The winner is journaled, so a resumed run\n * settles the same member and never starts the others again.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const race = <const Nodes extends Members>(\n nodes: Nodes\n): Node<Success<Nodes[keyof Nodes]>, Error<Nodes[keyof Nodes]>, Services<Nodes[keyof Nodes]>> =>\n internal.makeNode(join(\"race\", 1, nodes))\n\n/**\n * Settles with the first member to succeed, ignoring typed failures while a\n * member is still running.\n *\n * It fails with the last failure when every member fails. The other members\n * are interrupted, and the winner is journaled as {@link race} journals it.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const any = <const Nodes extends Members>(\n nodes: Nodes\n): Node<Success<Nodes[keyof Nodes]>, Error<Nodes[keyof Nodes]>, Services<Nodes[keyof Nodes]>> =>\n internal.makeNode(join(\"any\", 1, nodes))\n\n/**\n * Succeeds once `count` members succeed, with exactly those members' values\n * keyed by name.\n *\n * It fails with the failure that leaves fewer than `count` members able to\n * succeed. Either way the members still running are interrupted, and the\n * members that decided are journaled as {@link race} journals its winner.\n *\n * @since 1.0.0\n * @category constructors\n */\nexport const quorum = <const Nodes extends Members>(\n count: number,\n nodes: Nodes\n): Node<\n Types.Simplify<{ readonly [K in keyof Nodes]?: Success<Nodes[K]> }>,\n Error<Nodes[keyof Nodes]>,\n Services<Nodes[keyof Nodes]>\n> => internal.makeNode(join(\"quorum\", count, nodes))\n\n/**\n * Transforms an eventual success value with a deferred pure function.\n *\n * The function is digested, not run: it executes later, on the real value.\n * This is where computation on a step result belongs \u2014 and only computation. A\n * `map` that decides what happens next is a `branch` written wrongly.\n *\n * @since 0.1.0\n * @category mapping\n * @slop\n */\nexport const map: {\n <A, B>(f: (a: A) => B): <E, R>(self: Node<A, E, R>) => Node<B, E, R>\n <A, E, R, B>(self: Node<A, E, R>, f: (a: A) => B): Node<B, E, R>\n} = dual(\n 2,\n <A, E, R, B>(self: Node<A, E, R>, f: (a: A) => B): Node<B, E, R> =>\n internal.makeNode<B, E, R>(internal.map(self.ast, (value) => f(value as A), f))\n)\n\n/**\n * Starts the entire next subtree only after this node succeeds, without\n * consuming its result. Failure or interruption prevents that subtree from\n * starting, including actions nested inside combinations or inline flows.\n *\n * Use {@link bindPlanned} to build a dependency from a symbolic result, or\n * {@link map} to compute on the eventual value.\n *\n * @since 0.1.0\n * @category sequencing\n * @slop\n */\nexport const andThen: {\n <B, E2, R2>(next: Node<B, E2, R2>): <A, E, R>(self: Node<A, E, R>) => Node<B, E | E2, R | R2>\n <A, E, R, B, E2, R2>(self: Node<A, E, R>, next: Node<B, E2, R2>): Node<B, E | E2, R | R2>\n} = dual(\n 2,\n <A, E, R, B, E2, R2>(\n self: Node<A, E, R>,\n next: Node<B, E2, R2>\n ): Node<B, E | E2, R | R2> => {\n if (!isNode(next)) {\n throw new GraphBuildError({\n code: \"invalid_continuation\",\n node: \"andThen/next\",\n path: [],\n message:\n \"Node.andThen expects a Node; use Node.bindPlanned for a symbolic builder or Node.map for value computation\"\n })\n }\n return internal.makeNode<B, E | E2, R | R2>(internal.andThenNode(self.ast, next.ast))\n }\n)\n\n/**\n * Builds a dependency using a symbolic reference to this node's future result.\n *\n * The builder runs during planning. Its argument is a {@link module:Planned.Planned}\n * reference, not the value the node will eventually produce. Pass references\n * into action payloads; use {@link branch} for decisions and {@link map} for\n * computation on real results. JavaScript truthiness and reference equality\n * cannot inspect a planned result. Enable type-aware ESLint's\n * `@typescript-eslint/strict-boolean-expressions` to reject planned conditions.\n * Independent descendants of the built subtree can start while this producer\n * is running; consumers of its reference wait for its value. Use\n * {@link andThen} when the whole next subtree must wait for success.\n *\n * @since 1.0.0\n * @category sequencing\n */\nexport const bindPlanned: {\n <A, B, E2, R2>(\n build: (reference: Planned.Planned<A>) => Node<B, E2, R2>\n ): <E, R>(self: Node<A, E, R>) => Node<B, E | E2, R | R2>\n <A, E, R, B, E2, R2>(\n self: Node<A, E, R>,\n build: (reference: Planned.Planned<A>) => Node<B, E2, R2>\n ): Node<B, E | E2, R | R2>\n} = dual(\n 2,\n <A, E, R, B, E2, R2>(\n self: Node<A, E, R>,\n build: (reference: Planned.Planned<A>) => Node<B, E2, R2>\n ): Node<B, E | E2, R | R2> =>\n internal.makeNode<B, E | E2, R | R2>(\n internal.andThen(self.ast, (value) => build(value as Planned.Planned<A>), build)\n )\n)\n\n/**\n * Maximum eagerly nested branch arms. Arm construction precedes graph walking;\n * this bound leaves native stack headroom for a typed refusal.\n *\n * @since 1.0.0\n * @category constants\n */\nexport const maximumArmDepth = 512\nlet armDepth = 0\n\n/**\n * Builds one arm, once, against the symbolic subject.\n *\n * @private\n */\nconst arm = <A, B, E, R>(\n build: (value: Planned.Planned<A>) => Node<B, E, R>,\n subject: Planned.Planned<A>,\n side: string\n): Ast => {\n if (armDepth >= maximumArmDepth) {\n throw new GraphBuildError({\n code: \"graph_too_deep\",\n node: `${branchSubject}/${side}`,\n path: [],\n message: \"Node.branch recursion needs a plan-time bound, such as a payload-derived round count. \" +\n \"Both arms are built before the run-time predicate is evaluated.\"\n })\n }\n armDepth++\n try {\n const node = build(subject)\n if (!isNode(node)) {\n throw new GraphBuildError({\n code: \"invalid_continuation\",\n node: `${branchSubject}/${side}`,\n path: [],\n message: `Node.branch expected its \"${side}\" arm to return a Node`\n })\n }\n return node.ast\n } finally {\n armDepth--\n }\n}\n\n/**\n * Decides between two arms, both of them static topology.\n *\n * Each arm builder is evaluated exactly once, here, against a\n * {@link module:Planned.Planned} placeholder, and the resulting ASTs are what\n * the node stores \u2014 so a plan shows the exit condition and both continuations\n * before it runs. The predicate is digested and evaluated at run time on the\n * real value, which is why none of the plan-time placeholder machinery leaks\n * into control flow.\n *\n * Both arms contribute their requirements, because both arms are topology the\n * plan carries. A run takes one of them, but which one is not known until the\n * predicate sees the real value, so an execution has to be able to take either.\n *\n * @since 0.1.0\n * @category sequencing\n * @slop\n */\nexport const branch: {\n <A, B1, E1, R1, B2, E2, R2>(\n options: BranchOptions<A, B1, E1, R1, B2, E2, R2>\n ): <E, R>(self: Node<A, E, R>) => Node<B1 | B2, E | E1 | E2, R | R1 | R2>\n <A, E, R, B1, E1, R1, B2, E2, R2>(\n self: Node<A, E, R>,\n options: BranchOptions<A, B1, E1, R1, B2, E2, R2>\n ): Node<B1 | B2, E | E1 | E2, R | R1 | R2>\n} = dual(\n 2,\n <A, E, R, B1, E1, R1, B2, E2, R2>(\n self: Node<A, E, R>,\n options: BranchOptions<A, B1, E1, R1, B2, E2, R2>\n ): Node<B1 | B2, E | E1 | E2, R | R1 | R2> => {\n const predicate = options.if\n const subjectToken = `${branchSubject}/${subjects.branch++}`\n const subject = Planned.make<A>(subjectToken)\n return internal.makeNode<B1 | B2, E | E1 | E2, R | R1 | R2>(\n internal.branch(\n subjectToken,\n self.ast,\n (value) => predicate(value as A),\n predicate,\n arm(options.then, subject, \"then\"),\n arm(options.else, subject, \"else\")\n )\n )\n }\n)\n\n/**\n * Recovers from matching typed failures with static failure topology.\n *\n * The protected graph and failure arm are both stored in the AST. The arm is\n * built once at plan time against a strict planned error placeholder. With no\n * schema the whole typed error channel is handled. A schema handles only the\n * values it accepts, so its overloads retain E: a refinement can reject values\n * without narrowing its TypeScript type. Runtime schema callbacks enter the\n * filter identity along with its JSON Schema. Uncaptured callbacks are local\n * to this process, just like uncaptured mappers.\n *\n * The failure arm contributes its requirements to the node's, for the same\n * reason a branch's arms do: it is topology the plan carries, and a run reaches\n * it whenever the protected graph fails.\n *\n * @since 0.1.0\n * @category sequencing\n * @slop\n */\nconst catch_: {\n <Handled, B, E2, R2>(\n options: CatchOptions<unknown, B, E2, R2, Handled> & {\n readonly error: Schema.Schema<Handled>\n }\n ): <A, E, R>(self: Node<A, E, R>) => Node<A | B, E | E2, R | R2>\n <E, B, E2, R2>(\n options: CatchOptions<E, B, E2, R2> & {\n readonly error?: undefined\n }\n ): <A, R>(self: Node<A, E, R>) => Node<A | B, E2, R | R2>\n <A, E, R, Handled, B, E2, R2>(\n self: Node<A, E, R>,\n options: CatchOptions<E, B, E2, R2, Handled> & {\n readonly error: Schema.Schema<Handled>\n }\n ): Node<A | B, E | E2, R | R2>\n <A, E, R, B, E2, R2>(\n self: Node<A, E, R>,\n options: CatchOptions<E, B, E2, R2> & {\n readonly error?: undefined\n }\n ): Node<A | B, E2, R | R2>\n} = dual(\n 2,\n <A, E, R, Handled, B, E2, R2>(\n self: Node<A, E, R>,\n options: CatchOptions<E, B, E2, R2, Handled>\n ): Node<A | B, E | E2, R | R2> => {\n const subjectToken = `${catchSubject}/${subjects.catch++}`\n const failure = options.onFailure(Planned.make<Handled>(subjectToken))\n if (!isNode(failure)) {\n throw new GraphBuildError({\n code: \"invalid_continuation\",\n node: catchSubject,\n path: [],\n message: \"Node.catch expected its failure arm to return a Node\"\n })\n }\n return internal.makeNode(internal.catch_(subjectToken, self.ast, failure.ast, options.error))\n }\n)\n\nexport { catch_ as catch }\n\n/**\n * Attaches a scheduling priority to a node, leaving the original unchanged.\n *\n * The scheduler runs ready work with a higher number first, so a priority\n * changes LATENCY and nothing else. It never enters key material: a node\n * ordered ahead of another still computes the same result, so re-keying it\n * would throw away a legitimate cache hit. Children inherit the value\n * lexically when the graph is built, and a child that states its own keeps it.\n *\n * @since 0.1.0\n * @category annotations\n * @slop\n */\nexport const priority: {\n (value: number): <A, E, R>(self: Node<A, E, R>) => Node<A, E, R>\n <A, E, R>(self: Node<A, E, R>, value: number): Node<A, E, R>\n} = dual(\n 2,\n <A, E, R>(self: Node<A, E, R>, value: number): Node<A, E, R> => {\n if (!Number.isSafeInteger(value)) {\n throw new GraphBuildError({\n code: \"invalid_priority\",\n node: self.ast._tag,\n path: [],\n message: `Node.priority expects a safe integer, received ${value}`\n })\n }\n return internal.makeNode<A, E, R>(internal.withPriority(self.ast, value))\n }\n)\n\n/**\n * Reads the scheduling priority a node carries, or `undefined` when it states\n * none and inherits from whatever encloses it.\n *\n * @since 0.1.0\n * @category accessors\n * @slop\n */\nexport const declaredPriority = (ast: Ast): number | undefined => ast.priority\n\n/**\n * Constructs the flow-call node used by `@smthrs/flow` without making flow\n * calls part of the public authoring surface of this package.\n *\n * Reserved for `@smthrs/flow`, which owns flow authoring. It is not part\n * of this package's authoring surface, and it validates nothing: an unknown\n * flow tag becomes a call node the graph keeps as a leaf.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const flowCall = <A = unknown, E = never, R = never>(\n declaration: unknown,\n flow: string,\n mode: CallMode,\n payload: unknown\n): Node<A, E, R> => internal.makeNode<A, E, R>(internal.flowCall(declaration, flow, mode, payload))\n\n/**\n * Constructs the action-call node used by `@smthrs/flow` without making\n * action calls part of the public authoring surface of this package.\n *\n * Reserved for `@smthrs/flow`, which owns action authoring. It is not part\n * of this package's authoring surface, and an unknown action tag becomes a\n * call node the graph keeps as a leaf.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const actionCall = <A = unknown, E = never, R = never>(\n declaration: unknown,\n action: string,\n payload: unknown\n): Node<A, E, R> => internal.makeNode<A, E, R>(internal.actionCall(declaration, action, payload))\n\n/**\n * Reads the flow or action declaration a call node names, so `@smthrs/flow`\n * can expand a call it recorded. It is `undefined` for an AST that was\n * rehydrated from JSON, because the declaration lives beside the AST rather\n * than inside it \u2014 a graph built from such an AST keeps the call as a leaf.\n *\n * Reserved for `@smthrs/flow`, which files the declaration when it builds\n * the call. Authors never call it.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const declaration = (\n ast: Extract<Ast, { readonly _tag: \"ActionCall\" | \"FlowCall\" }>\n): unknown => internal.declaration(ast)\n\n/**\n * Reads the continuation builder of a sequenced node, which graph building\n * evaluates once against a placeholder. It is `undefined` when the author\n * supplied a node directly \u2014 the topology is already in `next` \u2014 and for a\n * rehydrated AST, whose side table did not survive serialization.\n *\n * Reserved for `@smthrs/flow`'s graph walk. Authors never call it.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const continuation = (\n ast: Extract<Ast, { readonly _tag: \"AndThen\" }>\n): ((value: Planned.Planned<unknown>) => unknown) | undefined => internal.operation(ast)\n\n/**\n * Reads the deferred mapper of a {@link map} node, which a driver applies to\n * the real upstream value once it has one. It is `undefined` for every other\n * variant, and for a rehydrated AST whose side table did not survive\n * serialization.\n *\n * Reserved for `@smthrs/flow`'s interpreter. Authors never call it.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const mapper = (ast: Ast): ((value: unknown) => unknown) | undefined =>\n ast._tag === \"Map\" ? internal.operation(ast) : undefined\n\n/**\n * Reads the run-time predicate of a {@link branch} node, which a driver\n * evaluates on the real subject value to choose an arm. It is `undefined` for\n * every other variant, and for a rehydrated AST whose side table did not\n * survive serialization.\n *\n * Reserved for `@smthrs/flow`'s interpreter. Authors never call it.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const predicate = (ast: Ast): ((value: unknown) => boolean) | undefined =>\n ast._tag === \"Branch\" ? internal.predicate(ast) : undefined\n\n/**\n * Reads the optional schema selecting failures handled by a {@link catch_}.\n *\n * Reserved for `@smthrs/flow`'s interpreter. It is `undefined` for every\n * variant but `catch_`, and for a rehydrated AST whose side table did not\n * survive serialization.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const catchFilter = (ast: Ast): Schema.Top | undefined => ast._tag === \"Catch\" ? internal.filter(ast) : undefined\n\n/**\n * Identifies a plan-time function the AST does NOT store, a flow's `body`,\n * exactly as the AST identifies the mapper and continuation it does store.\n * A call that keeps its callee as a leaf still has to re-key when that\n * callee's body is edited, and this is the identity it folds in. Unannotated\n * functions fail closed with process-local identity; use {@link capture} to\n * declare inert captures and obtain deterministic identity.\n *\n * Reserved for `@smthrs/flow`, which folds a callee body's identity into a\n * call it keeps as a leaf. Authors never call it; it throws a `TypeError`\n * when handed anything but a function.\n *\n * @since 0.1.0\n * @category engine\n * @slop\n */\nexport const functionIdentity = (operation: unknown): FunctionIdentity => internal.functionIdentity(operation)\n\n/**\n * The document a schema's identity is: JSON-Schema-shaped, and the same bytes\n * under every `effect` release this package supports.\n *\n * @since 1.0.0\n * @category engine\n */\nexport type SchemaIdentity = internalSchemaIdentity.Document\n\n/**\n * The one option a schema's identity is taken under: whether an object closes\n * over the keys it declares (`\"error\"`) or leaves others open (`\"ignore\"`,\n * the default). It has the meaning it has in `Schema.toJsonSchemaDocument`.\n *\n * @since 1.0.0\n * @category engine\n */\nexport type SchemaIdentityOptions = internalSchemaIdentity.Options\n\n/**\n * The refusal `schemaIdentity` and `representationIdentity` raise for a schema\n * a step key cannot be derived from. Its message is the one\n * `effect@4.0.0-rc.115` gave for the same schema, where it gave one.\n *\n * @since 1.0.0\n * @category errors\n */\nexport const SchemaIdentityError = internalSchemaIdentity.SchemaIdentityError\n\n/**\n * The type of {@link SchemaIdentityError}.\n *\n * @since 1.0.0\n * @category errors\n */\nexport type SchemaIdentityError = internalSchemaIdentity.SchemaIdentityError\n\n/**\n * Identifies a schema by the constraints it documents, so a call re-keys when\n * what its callee accepts or produces changes, and a catch re-keys when its\n * filter does.\n *\n * The document is what `Schema.toJsonSchemaDocument(schema, options)`\n * returned under `effect@4.0.0-rc.115`. It is printed by this package, not by\n * the installed `effect`, because a later release prints a different document\n * for the same schema and a moved identity re-keys every recorded step. Use\n * it wherever the document is hashed, compared or pinned; a JSON Schema shown\n * to a model or a person comes from `Schema.toJsonSchemaDocument`.\n *\n * Reserved for the packages that derive identities. Authors never call it; it\n * throws for a schema that has no JSON Schema form.\n *\n * @since 1.0.0\n * @category engine\n */\nexport const schemaIdentity = (schema: Schema.Top, options?: SchemaIdentityOptions): SchemaIdentity =>\n internalSchemaIdentity.schemaIdentity(schema, options)\n\n/**\n * Identifies a schema AST by its encoded representation, the material a\n * sealed action's step key folds in for its success and error schemas.\n *\n * The value is what `SchemaRepresentation.toJson(SchemaRepresentation.toRepresentation(ast))`\n * returned under `effect@4.0.0-rc.115`, so a later `effect` release does not\n * re-key recorded steps. The one exception is `Schema.brand`: from\n * `effect@4.0.4` on a brand is not part of the AST, so a declaration with a\n * brand re-keys once.\n *\n * Reserved for the packages that derive step keys. Authors never call it; it\n * throws for an AST that has no representation.\n *\n * @since 1.0.0\n * @category engine\n */\nexport const representationIdentity = (ast: SchemaAST.AST): Schema.Json =>\n internalSchemaIdentity.representationIdentity(ast)\n\n/**\n * Binds a frozen plain copy of inert captures as the callback's this receiver.\n *\n * Use a function expression to read the snapshot while keeping the ordinary\n * callback arguments: Node.capture({ factor: 3 }, function(value: number) {\n * return value * this.factor\n * }). Caller objects remain unchanged; lexical aliases still name originals\n * and must not be used as mutable semantic inputs. Nested captures retain the\n * inner callback's snapshot and compose the two identities.\n *\n * Admission walks original descriptors once, rejects built-in brands and\n * non-plain prototypes without evaluating getters, then uses structuredClone\n * to refuse Proxies. Hosts without that API refuse object capture. Only the\n * owned frozen copy enters identity and the wrapper. Sealed, non-extensible,\n * frozen and Immer ordinary data are supported equally. Unsupported values\n * raise a TypeError naming the path. See core docs/api.md#nodecapture for the\n * complete algorithm and the migration from original-object locking.\n *\n * @category constructors\n * @since 0.1.0\n * @slop\n */\nexport const capture = <C extends Readonly<Record<string, unknown>>, Args extends ReadonlyArray<unknown>, A>(\n captures: C,\n operation: (this: Readonly<C>, ...args: Args) => A\n): (...args: Args) => A => internal.capture(captures, operation)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BA,sBAAqB;AAKrB,6BAAgC;AAChC,eAA0B;AAC1B,6BAAwC;AACxC,cAAyB;AASlB,MAAM,SAAiB,SAAS;AAkChC,MAAM,WAAW,SAAS;AAgC1B,MAAM,mBAAmB,SAAS;AA0ElC,MAAM,gBAAgB;AAG7B,MAAM,cAAc,uBAAO,IAA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AAA,QACxB,MAAM;AAAA,QACN,MAAM,KAAK,IAAI;AAAA,QACf,MAAM,CAAC;AAAA,QACP,SAAS,kDAAkD,KAAK;AAAA,MAClE,CAAC;AAAA,IACH;AACA,WAAO,SAAS,SAAkB,SAAS,aAAa,KAAK,KAAK,KAAK,CAAC;AAAA,EAC1E;AACF;AAUO,MAAM,mBAAmB,CAAC,QAAiC,IAAI;AAc/D,MAAM,WAAW,CACtBC,cACA,MACA,MACA,YACkB,SAAS,SAAkB,SAAS,SAASA,cAAa,MAAM,MAAM,OAAO,CAAC;AAc3F,MAAM,aAAa,CACxBA,cACA,QACA,YACkB,SAAS,SAAkB,SAAS,WAAWA,cAAa,QAAQ,OAAO,CAAC;AAezF,MAAM,cAAc,CACzB,QACY,SAAS,YAAY,GAAG;AAc/B,MAAM,eAAe,CAC1B,QAC+D,SAAS,UAAU,GAAG;AAchF,MAAM,SAAS,CAAC,QACrB,IAAI,SAAS,QAAQ,SAAS,UAAU,GAAG,IAAI;AAc1C,MAAM,YAAY,CAAC,QACxB,IAAI,SAAS,WAAW,SAAS,UAAU,GAAG,IAAI;AAa7C,MAAM,cAAc,CAAC,QAAqC,IAAI,SAAS,UAAU,SAAS,OAAO,GAAG,IAAI;AAkBxG,MAAM,mBAAmB,CAAC,cAAyC,SAAS,iBAAiB,SAAS;AA6BtG,MAAM,sBAAsB,uBAAuB;AA4BnD,MAAM,iBAAiB,CAAC,QAAoB,YACjD,uBAAuB,eAAe,QAAQ,OAAO;AAkBhD,MAAM,yBAAyB,CAAC,QACrC,uBAAuB,uBAAuB,GAAG;AAwB5C,MAAM,UAAU,CACrB,UACA,cACyB,SAAS,QAAQ,UAAU,SAAS;",
|
|
6
6
|
"names": ["predicate", "declaration"]
|
|
7
7
|
}
|
|
@@ -269,6 +269,8 @@ export interface FunctionIdentity {
|
|
|
269
269
|
readonly _tag: "FunctionIdentity";
|
|
270
270
|
readonly algorithm: IdentityAlgorithm;
|
|
271
271
|
readonly digest: string;
|
|
272
|
+
/** Nonce-free resume comparison material. Step keys still use `digest`. */
|
|
273
|
+
readonly sourceDigest?: string | undefined;
|
|
272
274
|
}
|
|
273
275
|
/**
|
|
274
276
|
* Brands an operation with every inert value it closes over, so its identity
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/internal/node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAOH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAKtC;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,EAAG,oBAA6B,CAAA;AAEnD;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAA;AAElC;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CACvC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,OAAQ,SAAQ,SAAS;IACxC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CACxB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,IAAK,SAAQ,SAAS;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CACxB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,GAAI,SAAQ,SAAS;IACpC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;IACpB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAClD;AAED;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAA;AAEhD;;;;;;;GAOG;AACH,MAAM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M,SAAS,GAAI,KAAK,MAAM,KAAG,SAAS,GAAG,SAAgC,CAAA;AAEpF;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,GAAI,KAAK,KAAK,KAAG,MAAM,CAAC,GAAG,GAAG,SAA6B,CAAA;AAE9E;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,UAAU,GAAG,QAAQ,KAAG,OAAgC,CAAA;AAEzF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,OAAO,EAAE,UAAU,MAAM,KAAG,OAmB7D,CAAA"}
|
|
@@ -256,10 +256,21 @@ const filterIdentity = (filter2) => {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
+
const ephemeral = identities.some(([, identity2]) => identity2.algorithm === "sha256-source-ephemeral/v4");
|
|
260
|
+
const sourceComparable = identities.every(
|
|
261
|
+
([, identity2]) => identity2.algorithm !== "sha256-source-ephemeral/v4" || identity2.sourceDigest !== void 0
|
|
262
|
+
);
|
|
259
263
|
return {
|
|
260
264
|
_tag: "FunctionIdentity",
|
|
261
|
-
algorithm:
|
|
262
|
-
digest: (0, import_crypto.digestSync)(JSON.stringify(identities))
|
|
265
|
+
algorithm: ephemeral ? "sha256-source-ephemeral/v4" : "sha256-source-captures/v5",
|
|
266
|
+
digest: (0, import_crypto.digestSync)(JSON.stringify(identities)),
|
|
267
|
+
...ephemeral && sourceComparable ? {
|
|
268
|
+
sourceDigest: (0, import_crypto.digestSync)(JSON.stringify(identities.map(([path, identity2]) => [path, {
|
|
269
|
+
_tag: identity2._tag,
|
|
270
|
+
algorithm: identity2.algorithm,
|
|
271
|
+
digest: identity2.sourceDigest ?? identity2.digest
|
|
272
|
+
}])))
|
|
273
|
+
} : {}
|
|
263
274
|
};
|
|
264
275
|
};
|
|
265
276
|
const catch_ = (subject, protectedAst, failure, filter2) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/internal/node.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The node AST, and the side tables the functions hang off.\n *\n * Two invariants shape every declaration here. The AST is **closure-free**\n * and keeps payloads as inert JSON mirrors, so a valid plan can be shipped,\n * stored, diffed, and rendered without the process that built it; control flow is\n * **structure**, so a branch stores both arms as ASTs rather than a function\n * that would have to be run to find out what comes next.\n *\n * The functions an author does write \u2014 a mapper, a continuation, a branch\n * predicate \u2014 live in `WeakMap`s keyed by the AST node they belong to, and the\n * AST keeps only a {@link FunctionIdentity} digest of their source. The digest\n * is what enters content identity (https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/plan/docs/concepts/step-keys.md); the\n * `WeakMap` is what the run reaches for when it has the real value in hand, and\n * it drops with the AST it is keyed by.\n *\n * Adapted from `@smthrs/core` (`packages/smithers/flows/core`)\n * `internal/node.ts`. `Dynamic` does not come across \u2014 a model call is an\n * ordinary action here \u2014 and neither do annotations, which are `Context`\n * values and would break serializability. Scheduling priority is the one thing that does cross, as\n * the plain JSON field {@link Scheduled.priority} rather than as an\n * annotation, because the scheduler has to read it out of a stored plan.\n *\n * @since 0.1.0\n */\n\nimport { isRecord } from \"@smthrs/canonical/Record\"\nimport { digestSync } from \"@smthrs/crypto\"\nimport * as Identity from \"@smthrs/crypto/Identity\"\nimport { identity } from \"effect/Function\"\nimport { pipeArguments } from \"effect/Pipeable\"\nimport * as Schema from \"effect/Schema\"\nimport type { Node } from \"../Node.ts\"\nimport type * as Planned from \"../Planned.ts\"\nimport { jsonMirror } from \"./JsonMirror.ts\"\nimport { schemaIdentity } from \"./SchemaIdentity.ts\"\n\n/**\n * The runtime type identifier every node carries.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const TypeId = \"~@smthrs/plan/Node\" as const\n\n/**\n * The type-level form of {@link TypeId}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type TypeId = typeof TypeId\n\n/**\n * What every AST variant carries besides its own shape: an optional scheduling\n * priority.\n *\n * A priority is JSON, not a `Context` annotation, which is why it can live in\n * the AST at all: the whole point of dropping core's annotations was to keep a\n * plan shippable, storable, and diffable. It is a scheduling HINT \u2014 the plan\n * compiler copies it onto the node draft and the scheduler orders ready work by\n * it, while key material never reads it, so raising a priority reorders work\n * without re-keying a single step.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Scheduled {\n readonly priority?: number | undefined\n}\n\n/**\n * A constant, known before anything runs.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Succeed extends Scheduled {\n readonly _tag: \"Succeed\"\n readonly value: unknown\n}\n\n/**\n * A constant typed failure, known before anything runs.\n *\n * The error is an inert JSON mirror for the same reason {@link Succeed.value}\n * is: a stored plan has to carry what the node produces without the process\n * that built it.\n *\n * @since 1.0.0\n * @private\n * @slop\n */\nexport interface Fail extends Scheduled {\n readonly _tag: \"Fail\"\n readonly error: unknown\n}\n\n/**\n * Independent children, combined by name. Width is fixed here, at plan time:\n * there is no dynamic fan-out.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface All extends Scheduled {\n readonly _tag: \"All\"\n readonly nodes: Readonly<Record<string, NodeAst>>\n}\n\n/**\n * How a {@link Race} settles: `race` on the first member to settle, `any` on\n * the first member to succeed, and `quorum` once `count` members succeed.\n *\n * @since 1.0.0\n * @private\n */\nexport type RaceMode = \"race\" | \"any\" | \"quorum\"\n\n/**\n * Independent children that settle early: the join decides as soon as its\n * {@link RaceMode} can, and the members it did not wait for are interrupted.\n * `count` is the successes a quorum needs, and 1 for `race` and `any`.\n *\n * @since 1.0.0\n * @private\n */\nexport interface Race extends Scheduled {\n readonly _tag: \"Race\"\n readonly mode: RaceMode\n readonly count: number\n readonly nodes: Readonly<Record<string, NodeAst>>\n}\n\n/**\n * A deferred pure transformation of an upstream result. `map` transforms; it\n * never decides.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Map extends Scheduled {\n readonly _tag: \"Map\"\n readonly first: NodeAst\n readonly mapper: FunctionIdentity\n}\n\n/**\n * A continuation after an upstream node. `next` is present when the author\n * supplied a node directly instead of a builder, in which case the topology is\n * already known and nothing has to be evaluated to reveal it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface AndThen extends Scheduled {\n readonly _tag: \"AndThen\"\n readonly first: NodeAst\n readonly continuation: FunctionIdentity\n readonly next?: NodeAst | undefined\n}\n\n/**\n * A decision whose arms are static topology. The predicate runs at run time on\n * the real value; both arms are already ASTs, so the exit condition and the\n * handoff site are visible before anything runs.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Branch extends Scheduled {\n readonly _tag: \"Branch\"\n readonly subject: string\n readonly first: NodeAst\n readonly predicate: FunctionIdentity\n readonly then: NodeAst\n readonly else: NodeAst\n}\n\n/**\n * A protected graph and its statically planned typed-failure continuation.\n *\n * The symbolic error `subject` is minted per catch node rather than shared,\n * mirroring {@link Branch}. Failure arms are built before the graph assigns\n * ids, so a nested arm that captured an outer error would resolve it to the\n * inner catch's protected node under one shared token.\n *\n * An absent filter catches the entire typed error channel, while a present\n * schema catches only values it accepts. This mirrors Effect's typed-error\n * boundary and keeps defects outside normal recovery. The serializable AST carries the schema identity; the live schema\n * remains in a side table beside the AST.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Catch extends Scheduled {\n readonly _tag: \"Catch\"\n readonly subject: string\n readonly protected: NodeAst\n readonly failure: NodeAst\n readonly filter?: unknown | undefined\n readonly filterIdentity?: FunctionIdentity | undefined\n}\n\n/**\n * How a flow call joins the caller's plan: `inline` splices the callee's body\n * in, `boundary` makes it one child execution, and `handoff` names the next\n * trampoline round. Why the child call is a mode rather than a second AST tag\n * is in `docs/concepts/authoring-ast.md`.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const CallMode = Schema.Literals([\"inline\", \"boundary\", \"handoff\"])\n\n/**\n * How a flow call joins the caller's plan.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type CallMode = typeof CallMode.Type\n\n/**\n * A call to another flow. The AST keeps the callee's tag and the payload;\n * the declaration itself is in the side table, because a flow value carries\n * schemas and a body and is not JSON.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface FlowCall extends Scheduled {\n readonly _tag: \"FlowCall\"\n readonly flow: string\n readonly mode: CallMode\n readonly payload: unknown\n}\n\n/**\n * A call to an action: the atom that does work. Same split as\n * {@link FlowCall}, and no mode \u2014 an action is always one node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface ActionCall extends Scheduled {\n readonly _tag: \"ActionCall\"\n readonly action: string\n readonly payload: unknown\n}\n\n/**\n * The algorithms a {@link FunctionIdentity} may name. The tag is versioned so a\n * change to identity semantics re-keys everything derived from one, rather than\n * colliding with it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const IdentityAlgorithm = Schema.Literals([\n \"sha256-source-ephemeral/v4\",\n \"sha256-source-captures/v5\",\n \"static-node/v1\"\n])\n\n/**\n * The algorithms a {@link FunctionIdentity} may name.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type IdentityAlgorithm = typeof IdentityAlgorithm.Type\n\n/**\n * The serializable stand-in for a function. Captured functions digest their\n * exact source and declared inert captures. Unannotated functions additionally\n * carry process-local, per-object entropy so indistinguishable closure sources\n * fail closed instead of sharing a cache key. The tag it names is\n * {@link IdentityAlgorithm}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface FunctionIdentity {\n readonly _tag: \"FunctionIdentity\"\n readonly algorithm: IdentityAlgorithm\n readonly digest: string\n}\n\n/**\n * Brands an operation with every inert value it closes over, so its identity\n * covers what it computes with and not only its source.\n *\n * `@smthrs/crypto` owns the captures, nested metadata, and freezing contract.\n *\n * @since 0.1.0\n * @private\n */\nexport const capture = Identity.capture\n\n/**\n * The serializable form of a planned value embedded in an AST value or\n * payload. The strict proxy itself cannot enter the AST because serializing it\n * is deliberately a build error.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface PlannedReference {\n readonly _tag: \"PlannedReference\"\n readonly node: string\n readonly path: ReadonlyArray<string>\n}\n\n// A bundled runtime and a dynamically loaded flow may contain separate\n// compatible package copies. Share only live object metadata: JSON round trips\n// still lose executable bindings, and structural lookalikes remain inert.\nconst stateKey = Symbol.for(\"@smthrs/plan/Node/live/v1\")\ninterface LiveState {\n readonly references: WeakSet<object>\n readonly nodes: WeakSet<object>\n readonly operations: WeakMap<AndThen | Map, Operation>\n readonly predicates: WeakMap<Branch, Predicate>\n readonly filters: WeakMap<Catch, Schema.Top>\n readonly declarations: WeakMap<ActionCall | FlowCall, unknown>\n}\nconst globals = globalThis as typeof globalThis & { [stateKey]?: LiveState }\nconst liveState = globals[stateKey] ??= {\n references: new WeakSet(),\n nodes: new WeakSet(),\n operations: new WeakMap(),\n predicates: new WeakMap(),\n filters: new WeakMap(),\n declarations: new WeakMap()\n}\n\n/** The AST references minted by this module; structural lookalikes are data. */\nconst plannedReferences = liveState.references\n\nconst makePlannedReference = (reference: Planned.Reference): PlannedReference => {\n const value = Object.freeze({\n _tag: \"PlannedReference\" as const,\n node: reference.node,\n path: Object.freeze([...reference.path])\n })\n plannedReferences.add(value)\n return value\n}\n\n/**\n * Reads an AST-owned planned reference without trusting its public data shape.\n *\n * @since 1.0.0\n * @private\n */\nexport const plannedReference = (value: unknown): PlannedReference | undefined =>\n typeof value === \"object\" && value !== null && plannedReferences.has(value)\n ? value as PlannedReference\n : undefined\n\n/**\n * Every AST variant.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type NodeAst = Succeed | Fail | All | Race | Map | AndThen | Branch | Catch | FlowCall | ActionCall\n\ntype Operation = (value: unknown) => unknown\n\ntype Predicate = (value: unknown) => boolean\n\nconst operations = liveState.operations\nconst predicates = liveState.predicates\nconst filters = liveState.filters\nconst declarations = liveState.declarations\n\n/**\n * The JSON mirror of an AST payload. A planned value becomes an AST-owned\n * {@link PlannedReference}, so the AST stays inert JSON.\n *\n * @private\n */\nconst payloadMirror = (input: unknown): unknown =>\n jsonMirror(input, (_value, reference) => makePlannedReference(reference))\n\n/**\n * Digests a function's exact source as UTF-8 with SHA-256. Exact source matters:\n * whitespace inside a string literal is behavior, and normalizing it before\n * hashing can make different functions share an identity. Unless its inert\n * captures were declared with {@link capture}, the digest also includes\n * process-local, per-function entropy: JavaScript cannot inspect a closure, so\n * source-only identity would permit incorrect cache hits.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const functionIdentity: (operation: unknown) => FunctionIdentity = Identity.functionIdentity\n\n/**\n * The prototype every node shares, so `pipe` is one function rather than one\n * closure per node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const NodeProto = {\n [TypeId]: {\n _A: identity,\n _E: identity,\n _R: identity\n },\n pipe() {\n // eslint-disable-next-line prefer-rest-params -- `pipeArguments` takes the arguments object itself.\n return pipeArguments(this, arguments)\n }\n}\n\n/**\n * Every node {@link makeNode} built, so a node this module made is recognized\n * in constant time without walking its AST again.\n */\nconst liveNodes = liveState.nodes\n\n/** Recognizes the algorithms {@link IdentityAlgorithm} declares, and nothing else. */\nconst isIdentityAlgorithm = Schema.is(IdentityAlgorithm)\n\n/** Recognizes the modes {@link CallMode} declares, and nothing else. */\nconst isCallMode = Schema.is(CallMode)\n\n/** Recognizes the modes {@link RaceMode} names, and nothing else. @private */\nconst isRaceMode = (value: unknown): value is RaceMode => value === \"race\" || value === \"any\" || value === \"quorum\"\n\n/**\n * Whether `count` is a successes target a {@link Race} of `members` can reach:\n * a quorum needs between one and every member, and the other modes need one.\n *\n * @since 1.0.0\n * @private\n */\nexport const isRaceCount = (mode: RaceMode, count: unknown, members: number): boolean =>\n members > 0 && Number.isSafeInteger(count) &&\n (mode === \"quorum\" ? (count as number) >= 1 && (count as number) <= members : count === 1)\n\n/** @private */\nconst isFunctionIdentity = (value: unknown): value is FunctionIdentity =>\n isRecord(value) && value._tag === \"FunctionIdentity\" && isIdentityAlgorithm(value.algorithm) &&\n typeof value.digest === \"string\"\n\n/** One position of the {@link isNodeAst} walk: an AST to check, or one whose children are all checked. @private */\ntype AstVisit = { readonly enter: unknown } | { readonly exit: object }\n\n/**\n * Checks whether a value has the shape of a {@link NodeAst}: what a JSON round\n * trip of a genuine AST produces, and nothing looser. Every variant's own\n * fields are checked, and every child is walked. The walk is an explicit stack\n * rather than recursion, so an arbitrarily deep AST cannot overflow the native\n * stack, and it tracks the ancestors of the position it has reached, so a\n * cyclic object is refused rather than walked forever while a shared sub-AST\n * still passes.\n *\n * @since 1.0.0\n * @private\n */\nexport const isNodeAst = (value: unknown): value is NodeAst => {\n const ancestors = new Set<object>()\n const pending: Array<AstVisit> = [{ enter: value }]\n while (pending.length > 0) {\n const visit = pending.pop()!\n if (\"exit\" in visit) {\n ancestors.delete(visit.exit)\n continue\n }\n const ast = visit.enter\n if (!isRecord(ast) || ancestors.has(ast)) return false\n if (ast.priority !== undefined && !Number.isSafeInteger(ast.priority)) return false\n const children: Array<unknown> = []\n switch (ast._tag) {\n case \"Succeed\":\n case \"Fail\":\n break\n case \"All\": {\n if (!isRecord(ast.nodes) || Array.isArray(ast.nodes)) return false\n for (const child of Object.values(ast.nodes)) children.push(child)\n break\n }\n case \"Race\": {\n if (!isRecord(ast.nodes) || Array.isArray(ast.nodes)) return false\n const members = Object.values(ast.nodes)\n if (!isRaceMode(ast.mode) || !isRaceCount(ast.mode, ast.count, members.length)) return false\n for (const child of members) children.push(child)\n break\n }\n case \"Map\": {\n if (!isFunctionIdentity(ast.mapper)) return false\n children.push(ast.first)\n break\n }\n case \"AndThen\": {\n if (!isFunctionIdentity(ast.continuation)) return false\n children.push(ast.first)\n if (ast.next !== undefined) children.push(ast.next)\n break\n }\n case \"Branch\": {\n if (typeof ast.subject !== \"string\" || !isFunctionIdentity(ast.predicate)) return false\n children.push(ast.first, ast.then, ast.else)\n break\n }\n case \"Catch\": {\n if (typeof ast.subject !== \"string\") return false\n if (ast.filterIdentity !== undefined && !isFunctionIdentity(ast.filterIdentity)) return false\n children.push(ast.protected, ast.failure)\n break\n }\n case \"FlowCall\": {\n if (typeof ast.flow !== \"string\" || !isCallMode(ast.mode)) return false\n break\n }\n case \"ActionCall\": {\n if (typeof ast.action !== \"string\") return false\n break\n }\n default:\n return false\n }\n if (children.length > 0) {\n ancestors.add(ast)\n pending.push({ exit: ast })\n for (const child of children) pending.push({ enter: child })\n }\n }\n return true\n}\n\n/**\n * Checks whether a value is a node.\n *\n * A node this module built is recognized by registration. A node that crossed\n * a serialization boundary, an object whose prototype is {@link NodeProto} and\n * whose own `ast` data property passes {@link isNodeAst}, is recognized by that\n * shape: `@smthrs/flow` hands a rehydrated AST back as a node, and the side\n * tables are all a round trip loses. The {@link TypeId} marker is an exported\n * string any object can carry, so it counts for nothing on its own, and an\n * `ast` that is missing, malformed, cyclic, or an accessor is refused because\n * every combinator reads it as trusted topology. A proxy is judged by the\n * shape it forwards.\n *\n * @since 1.0.0\n * @private\n */\nexport const isNode = (value: unknown): value is Node<unknown, unknown, any> => {\n if (typeof value !== \"object\" || value === null) return false\n if (liveNodes.has(value)) return true\n if (Object.getPrototypeOf(value) !== NodeProto) return false\n const ast = Object.getOwnPropertyDescriptor(value, \"ast\")\n return ast !== undefined && \"value\" in ast && isNodeAst(ast.value)\n}\n\n/**\n * Wraps an AST as a node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const makeNode = <A = unknown, E = never, R = never>(ast: NodeAst): Node<A, E, R> => {\n const node: Node<A, E, R> = Object.assign(Object.create(NodeProto), { ast })\n liveNodes.add(node)\n return node\n}\n\n/**\n * Constructs a {@link Succeed}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const succeed = (input: unknown): Succeed => ({ _tag: \"Succeed\", value: payloadMirror(input) })\n\n/**\n * Constructs a {@link Fail}.\n *\n * @since 1.0.0\n * @private\n * @slop\n */\nexport const fail = (error: unknown): Fail => ({ _tag: \"Fail\", error: payloadMirror(error) })\n\n/**\n * Constructs an {@link All}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const all = (nodes: Readonly<Record<string, NodeAst>>): All => ({ _tag: \"All\", nodes })\n\n/**\n * Constructs a {@link Race}.\n *\n * @since 1.0.0\n * @private\n */\nexport const race = (mode: RaceMode, count: number, nodes: Readonly<Record<string, NodeAst>>): Race => ({\n _tag: \"Race\",\n mode,\n count,\n nodes\n})\n\n/**\n * Constructs a {@link Map}, filing the mapper under the AST it belongs to.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const map = (first: NodeAst, operation: Operation, source: unknown): Map => {\n const ast: Map = { _tag: \"Map\", first, mapper: functionIdentity(source) }\n operations.set(ast, operation)\n return ast\n}\n\n/**\n * Constructs an {@link AndThen} from a builder. The builder is evaluated once\n * against a planned value when the graph is built, never here.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const andThen = (first: NodeAst, operation: Operation, source: unknown): AndThen => {\n const ast: AndThen = { _tag: \"AndThen\", first, continuation: functionIdentity(source) }\n operations.set(ast, operation)\n return ast\n}\n\n/**\n * Constructs an {@link AndThen} from a node the author supplied directly. There\n * is no function to digest, so the continuation carries a fixed marker.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const andThenNode = (first: NodeAst, next: NodeAst): AndThen => ({\n _tag: \"AndThen\",\n first,\n continuation: { _tag: \"FunctionIdentity\", algorithm: \"static-node/v1\", digest: digestSync(\"static-node\") },\n next\n})\n\n/**\n * Constructs a {@link Branch}. Both arms arrive already evaluated, because a\n * branch that had to be run to reveal its topology would not be a plan.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const branch = (\n subject: string,\n first: NodeAst,\n predicate: Predicate,\n source: unknown,\n then: NodeAst,\n otherwise: NodeAst\n): Branch => {\n const ast: Branch = {\n _tag: \"Branch\",\n subject,\n first,\n predicate: functionIdentity(source),\n then,\n else: otherwise\n }\n predicates.set(ast, predicate)\n return ast\n}\n\n/**\n * JSON Schema does not describe arbitrary checks, declaration parsers, or\n * suspended schema factories. Include every function reachable from the\n * schema AST, preserving declared captures and treating opaque wrappers as\n * ephemeral. The iterative walk also covers nested checks and cyclic ASTs.\n *\n * @private\n */\nconst filterIdentity = (filter: Schema.Top): FunctionIdentity => {\n const identities: Array<readonly [string, FunctionIdentity]> = []\n const pending: Array<readonly [string, unknown]> = [[\"$\", filter.ast]]\n const seen = new WeakSet<object>()\n while (pending.length > 0) {\n const [path, current] = pending.pop()!\n if (typeof current === \"function\") {\n identities.push([path, functionIdentity(current)])\n } else if (typeof current === \"object\" && current !== null && !seen.has(current)) {\n seen.add(current)\n const descriptors = Object.getOwnPropertyDescriptors(current)\n for (const key of Object.keys(descriptors).sort()) {\n const descriptor = descriptors[key]!\n if (\"value\" in descriptor) pending.push([`${path}/${JSON.stringify(key)}`, descriptor.value])\n else {\n if (descriptor.get !== undefined) pending.push([`${path}/${JSON.stringify(key)}/get`, descriptor.get])\n if (descriptor.set !== undefined) pending.push([`${path}/${JSON.stringify(key)}/set`, descriptor.set])\n }\n }\n }\n }\n return {\n _tag: \"FunctionIdentity\",\n algorithm: identities.some(([, identity]) => identity.algorithm === \"sha256-source-ephemeral/v4\")\n ? \"sha256-source-ephemeral/v4\"\n : \"sha256-source-captures/v5\",\n digest: digestSync(JSON.stringify(identities))\n }\n}\n\n/**\n * Constructs a {@link Catch} whose failure topology is already evaluated.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const catch_ = (subject: string, protectedAst: NodeAst, failure: NodeAst, filter?: Schema.Top): Catch => {\n const ast: Catch = {\n _tag: \"Catch\",\n subject,\n protected: protectedAst,\n failure,\n ...(filter === undefined\n ? {}\n : {\n filter: schemaIdentity(filter, { onExcessProperty: \"error\" }),\n filterIdentity: filterIdentity(filter)\n })\n }\n if (filter !== undefined) filters.set(ast, filter)\n return ast\n}\n\n/**\n * Constructs a {@link FlowCall}, filing the flow declaration beside it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const flowCall = (declaration: unknown, flow: string, mode: CallMode, payload: unknown): FlowCall => {\n const ast: FlowCall = { _tag: \"FlowCall\", flow, mode, payload: payloadMirror(payload) }\n declarations.set(ast, declaration)\n return ast\n}\n\n/**\n * Constructs an {@link ActionCall}, filing the action declaration beside\n * it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const actionCall = (declaration: unknown, action: string, payload: unknown): ActionCall => {\n const ast: ActionCall = { _tag: \"ActionCall\", action, payload: payloadMirror(payload) }\n declarations.set(ast, declaration)\n return ast\n}\n\n/**\n * The deferred function of a map or a continuation.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const operation = (ast: AndThen | Map): Operation | undefined => operations.get(ast)\n\n/**\n * The run-time predicate of a branch.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const predicate = (ast: Branch): Predicate | undefined => predicates.get(ast)\n\n/**\n * The optional error schema filter of a catch node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const filter = (ast: Catch): Schema.Top | undefined => filters.get(ast)\n\n/**\n * The flow or action declaration a call node names.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const declaration = (ast: ActionCall | FlowCall): unknown => declarations.get(ast)\n\n/**\n * Copies an AST with a scheduling priority attached.\n *\n * The copy is shallow and the side tables are re-filed against it, because a\n * function, a predicate, a filter schema, and a declaration are keyed by the\n * exact AST object they belong to: a copy that left them behind would silently\n * lose the continuation the graph walk has to evaluate.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const withPriority = (ast: NodeAst, priority: number): NodeAst => {\n const prioritized = { ...ast, priority }\n if (ast._tag === \"AndThen\" || ast._tag === \"Map\") {\n const deferred = operations.get(ast)\n if (deferred !== undefined) operations.set(prioritized as AndThen | Map, deferred)\n }\n if (ast._tag === \"Branch\") {\n const decision = predicates.get(ast)\n if (decision !== undefined) predicates.set(prioritized as Branch, decision)\n }\n if (ast._tag === \"Catch\") {\n const schema = filters.get(ast)\n if (schema !== undefined) filters.set(prioritized as Catch, schema)\n }\n if (ast._tag === \"ActionCall\" || ast._tag === \"FlowCall\") {\n const target = declarations.get(ast)\n if (target !== undefined) declarations.set(prioritized as ActionCall | FlowCall, target)\n }\n return prioritized\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BA,oBAAyB;AACzB,oBAA2B;AAC3B,eAA0B;AAC1B,sBAAyB;AACzB,sBAA8B;AAC9B,aAAwB;AAGxB,wBAA2B;AAC3B,4BAA+B;AASxB,MAAM,SAAS;AAmLf,MAAM,WAAW,OAAO,SAAS,CAAC,UAAU,YAAY,SAAS,CAAC;AAkDlE,MAAM,oBAAoB,OAAO,SAAS;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AACF,CAAC;
|
|
4
|
+
"sourcesContent": ["/**\n * The node AST, and the side tables the functions hang off.\n *\n * Two invariants shape every declaration here. The AST is **closure-free**\n * and keeps payloads as inert JSON mirrors, so a valid plan can be shipped,\n * stored, diffed, and rendered without the process that built it; control flow is\n * **structure**, so a branch stores both arms as ASTs rather than a function\n * that would have to be run to find out what comes next.\n *\n * The functions an author does write \u2014 a mapper, a continuation, a branch\n * predicate \u2014 live in `WeakMap`s keyed by the AST node they belong to, and the\n * AST keeps only a {@link FunctionIdentity} digest of their source. The digest\n * is what enters content identity (https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/plan/docs/concepts/step-keys.md); the\n * `WeakMap` is what the run reaches for when it has the real value in hand, and\n * it drops with the AST it is keyed by.\n *\n * Adapted from `@smthrs/core` (`packages/smithers/flows/core`)\n * `internal/node.ts`. `Dynamic` does not come across \u2014 a model call is an\n * ordinary action here \u2014 and neither do annotations, which are `Context`\n * values and would break serializability. Scheduling priority is the one thing that does cross, as\n * the plain JSON field {@link Scheduled.priority} rather than as an\n * annotation, because the scheduler has to read it out of a stored plan.\n *\n * @since 0.1.0\n */\n\nimport { isRecord } from \"@smthrs/canonical/Record\"\nimport { digestSync } from \"@smthrs/crypto\"\nimport * as Identity from \"@smthrs/crypto/Identity\"\nimport { identity } from \"effect/Function\"\nimport { pipeArguments } from \"effect/Pipeable\"\nimport * as Schema from \"effect/Schema\"\nimport type { Node } from \"../Node.ts\"\nimport type * as Planned from \"../Planned.ts\"\nimport { jsonMirror } from \"./JsonMirror.ts\"\nimport { schemaIdentity } from \"./SchemaIdentity.ts\"\n\n/**\n * The runtime type identifier every node carries.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const TypeId = \"~@smthrs/plan/Node\" as const\n\n/**\n * The type-level form of {@link TypeId}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type TypeId = typeof TypeId\n\n/**\n * What every AST variant carries besides its own shape: an optional scheduling\n * priority.\n *\n * A priority is JSON, not a `Context` annotation, which is why it can live in\n * the AST at all: the whole point of dropping core's annotations was to keep a\n * plan shippable, storable, and diffable. It is a scheduling HINT \u2014 the plan\n * compiler copies it onto the node draft and the scheduler orders ready work by\n * it, while key material never reads it, so raising a priority reorders work\n * without re-keying a single step.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Scheduled {\n readonly priority?: number | undefined\n}\n\n/**\n * A constant, known before anything runs.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Succeed extends Scheduled {\n readonly _tag: \"Succeed\"\n readonly value: unknown\n}\n\n/**\n * A constant typed failure, known before anything runs.\n *\n * The error is an inert JSON mirror for the same reason {@link Succeed.value}\n * is: a stored plan has to carry what the node produces without the process\n * that built it.\n *\n * @since 1.0.0\n * @private\n * @slop\n */\nexport interface Fail extends Scheduled {\n readonly _tag: \"Fail\"\n readonly error: unknown\n}\n\n/**\n * Independent children, combined by name. Width is fixed here, at plan time:\n * there is no dynamic fan-out.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface All extends Scheduled {\n readonly _tag: \"All\"\n readonly nodes: Readonly<Record<string, NodeAst>>\n}\n\n/**\n * How a {@link Race} settles: `race` on the first member to settle, `any` on\n * the first member to succeed, and `quorum` once `count` members succeed.\n *\n * @since 1.0.0\n * @private\n */\nexport type RaceMode = \"race\" | \"any\" | \"quorum\"\n\n/**\n * Independent children that settle early: the join decides as soon as its\n * {@link RaceMode} can, and the members it did not wait for are interrupted.\n * `count` is the successes a quorum needs, and 1 for `race` and `any`.\n *\n * @since 1.0.0\n * @private\n */\nexport interface Race extends Scheduled {\n readonly _tag: \"Race\"\n readonly mode: RaceMode\n readonly count: number\n readonly nodes: Readonly<Record<string, NodeAst>>\n}\n\n/**\n * A deferred pure transformation of an upstream result. `map` transforms; it\n * never decides.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Map extends Scheduled {\n readonly _tag: \"Map\"\n readonly first: NodeAst\n readonly mapper: FunctionIdentity\n}\n\n/**\n * A continuation after an upstream node. `next` is present when the author\n * supplied a node directly instead of a builder, in which case the topology is\n * already known and nothing has to be evaluated to reveal it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface AndThen extends Scheduled {\n readonly _tag: \"AndThen\"\n readonly first: NodeAst\n readonly continuation: FunctionIdentity\n readonly next?: NodeAst | undefined\n}\n\n/**\n * A decision whose arms are static topology. The predicate runs at run time on\n * the real value; both arms are already ASTs, so the exit condition and the\n * handoff site are visible before anything runs.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Branch extends Scheduled {\n readonly _tag: \"Branch\"\n readonly subject: string\n readonly first: NodeAst\n readonly predicate: FunctionIdentity\n readonly then: NodeAst\n readonly else: NodeAst\n}\n\n/**\n * A protected graph and its statically planned typed-failure continuation.\n *\n * The symbolic error `subject` is minted per catch node rather than shared,\n * mirroring {@link Branch}. Failure arms are built before the graph assigns\n * ids, so a nested arm that captured an outer error would resolve it to the\n * inner catch's protected node under one shared token.\n *\n * An absent filter catches the entire typed error channel, while a present\n * schema catches only values it accepts. This mirrors Effect's typed-error\n * boundary and keeps defects outside normal recovery. The serializable AST carries the schema identity; the live schema\n * remains in a side table beside the AST.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface Catch extends Scheduled {\n readonly _tag: \"Catch\"\n readonly subject: string\n readonly protected: NodeAst\n readonly failure: NodeAst\n readonly filter?: unknown | undefined\n readonly filterIdentity?: FunctionIdentity | undefined\n}\n\n/**\n * How a flow call joins the caller's plan: `inline` splices the callee's body\n * in, `boundary` makes it one child execution, and `handoff` names the next\n * trampoline round. Why the child call is a mode rather than a second AST tag\n * is in `docs/concepts/authoring-ast.md`.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const CallMode = Schema.Literals([\"inline\", \"boundary\", \"handoff\"])\n\n/**\n * How a flow call joins the caller's plan.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type CallMode = typeof CallMode.Type\n\n/**\n * A call to another flow. The AST keeps the callee's tag and the payload;\n * the declaration itself is in the side table, because a flow value carries\n * schemas and a body and is not JSON.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface FlowCall extends Scheduled {\n readonly _tag: \"FlowCall\"\n readonly flow: string\n readonly mode: CallMode\n readonly payload: unknown\n}\n\n/**\n * A call to an action: the atom that does work. Same split as\n * {@link FlowCall}, and no mode \u2014 an action is always one node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface ActionCall extends Scheduled {\n readonly _tag: \"ActionCall\"\n readonly action: string\n readonly payload: unknown\n}\n\n/**\n * The algorithms a {@link FunctionIdentity} may name. The tag is versioned so a\n * change to identity semantics re-keys everything derived from one, rather than\n * colliding with it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const IdentityAlgorithm = Schema.Literals([\n \"sha256-source-ephemeral/v4\",\n \"sha256-source-captures/v5\",\n \"static-node/v1\"\n])\n\n/**\n * The algorithms a {@link FunctionIdentity} may name.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type IdentityAlgorithm = typeof IdentityAlgorithm.Type\n\n/**\n * The serializable stand-in for a function. Captured functions digest their\n * exact source and declared inert captures. Unannotated functions additionally\n * carry process-local, per-object entropy so indistinguishable closure sources\n * fail closed instead of sharing a cache key. The tag it names is\n * {@link IdentityAlgorithm}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface FunctionIdentity {\n readonly _tag: \"FunctionIdentity\"\n readonly algorithm: IdentityAlgorithm\n readonly digest: string\n /** Nonce-free resume comparison material. Step keys still use `digest`. */\n readonly sourceDigest?: string | undefined\n}\n\n/**\n * Brands an operation with every inert value it closes over, so its identity\n * covers what it computes with and not only its source.\n *\n * `@smthrs/crypto` owns the captures, nested metadata, and freezing contract.\n *\n * @since 0.1.0\n * @private\n */\nexport const capture = Identity.capture\n\n/**\n * The serializable form of a planned value embedded in an AST value or\n * payload. The strict proxy itself cannot enter the AST because serializing it\n * is deliberately a build error.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport interface PlannedReference {\n readonly _tag: \"PlannedReference\"\n readonly node: string\n readonly path: ReadonlyArray<string>\n}\n\n// A bundled runtime and a dynamically loaded flow may contain separate\n// compatible package copies. Share only live object metadata: JSON round trips\n// still lose executable bindings, and structural lookalikes remain inert.\nconst stateKey = Symbol.for(\"@smthrs/plan/Node/live/v1\")\ninterface LiveState {\n readonly references: WeakSet<object>\n readonly nodes: WeakSet<object>\n readonly operations: WeakMap<AndThen | Map, Operation>\n readonly predicates: WeakMap<Branch, Predicate>\n readonly filters: WeakMap<Catch, Schema.Top>\n readonly declarations: WeakMap<ActionCall | FlowCall, unknown>\n}\nconst globals = globalThis as typeof globalThis & { [stateKey]?: LiveState }\nconst liveState = globals[stateKey] ??= {\n references: new WeakSet(),\n nodes: new WeakSet(),\n operations: new WeakMap(),\n predicates: new WeakMap(),\n filters: new WeakMap(),\n declarations: new WeakMap()\n}\n\n/** The AST references minted by this module; structural lookalikes are data. */\nconst plannedReferences = liveState.references\n\nconst makePlannedReference = (reference: Planned.Reference): PlannedReference => {\n const value = Object.freeze({\n _tag: \"PlannedReference\" as const,\n node: reference.node,\n path: Object.freeze([...reference.path])\n })\n plannedReferences.add(value)\n return value\n}\n\n/**\n * Reads an AST-owned planned reference without trusting its public data shape.\n *\n * @since 1.0.0\n * @private\n */\nexport const plannedReference = (value: unknown): PlannedReference | undefined =>\n typeof value === \"object\" && value !== null && plannedReferences.has(value)\n ? value as PlannedReference\n : undefined\n\n/**\n * Every AST variant.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport type NodeAst = Succeed | Fail | All | Race | Map | AndThen | Branch | Catch | FlowCall | ActionCall\n\ntype Operation = (value: unknown) => unknown\n\ntype Predicate = (value: unknown) => boolean\n\nconst operations = liveState.operations\nconst predicates = liveState.predicates\nconst filters = liveState.filters\nconst declarations = liveState.declarations\n\n/**\n * The JSON mirror of an AST payload. A planned value becomes an AST-owned\n * {@link PlannedReference}, so the AST stays inert JSON.\n *\n * @private\n */\nconst payloadMirror = (input: unknown): unknown =>\n jsonMirror(input, (_value, reference) => makePlannedReference(reference))\n\n/**\n * Digests a function's exact source as UTF-8 with SHA-256. Exact source matters:\n * whitespace inside a string literal is behavior, and normalizing it before\n * hashing can make different functions share an identity. Unless its inert\n * captures were declared with {@link capture}, the digest also includes\n * process-local, per-function entropy: JavaScript cannot inspect a closure, so\n * source-only identity would permit incorrect cache hits.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const functionIdentity: (operation: unknown) => FunctionIdentity = Identity.functionIdentity\n\n/**\n * The prototype every node shares, so `pipe` is one function rather than one\n * closure per node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const NodeProto = {\n [TypeId]: {\n _A: identity,\n _E: identity,\n _R: identity\n },\n pipe() {\n // eslint-disable-next-line prefer-rest-params -- `pipeArguments` takes the arguments object itself.\n return pipeArguments(this, arguments)\n }\n}\n\n/**\n * Every node {@link makeNode} built, so a node this module made is recognized\n * in constant time without walking its AST again.\n */\nconst liveNodes = liveState.nodes\n\n/** Recognizes the algorithms {@link IdentityAlgorithm} declares, and nothing else. */\nconst isIdentityAlgorithm = Schema.is(IdentityAlgorithm)\n\n/** Recognizes the modes {@link CallMode} declares, and nothing else. */\nconst isCallMode = Schema.is(CallMode)\n\n/** Recognizes the modes {@link RaceMode} names, and nothing else. @private */\nconst isRaceMode = (value: unknown): value is RaceMode => value === \"race\" || value === \"any\" || value === \"quorum\"\n\n/**\n * Whether `count` is a successes target a {@link Race} of `members` can reach:\n * a quorum needs between one and every member, and the other modes need one.\n *\n * @since 1.0.0\n * @private\n */\nexport const isRaceCount = (mode: RaceMode, count: unknown, members: number): boolean =>\n members > 0 && Number.isSafeInteger(count) &&\n (mode === \"quorum\" ? (count as number) >= 1 && (count as number) <= members : count === 1)\n\n/** @private */\nconst isFunctionIdentity = (value: unknown): value is FunctionIdentity =>\n isRecord(value) && value._tag === \"FunctionIdentity\" && isIdentityAlgorithm(value.algorithm) &&\n typeof value.digest === \"string\"\n\n/** One position of the {@link isNodeAst} walk: an AST to check, or one whose children are all checked. @private */\ntype AstVisit = { readonly enter: unknown } | { readonly exit: object }\n\n/**\n * Checks whether a value has the shape of a {@link NodeAst}: what a JSON round\n * trip of a genuine AST produces, and nothing looser. Every variant's own\n * fields are checked, and every child is walked. The walk is an explicit stack\n * rather than recursion, so an arbitrarily deep AST cannot overflow the native\n * stack, and it tracks the ancestors of the position it has reached, so a\n * cyclic object is refused rather than walked forever while a shared sub-AST\n * still passes.\n *\n * @since 1.0.0\n * @private\n */\nexport const isNodeAst = (value: unknown): value is NodeAst => {\n const ancestors = new Set<object>()\n const pending: Array<AstVisit> = [{ enter: value }]\n while (pending.length > 0) {\n const visit = pending.pop()!\n if (\"exit\" in visit) {\n ancestors.delete(visit.exit)\n continue\n }\n const ast = visit.enter\n if (!isRecord(ast) || ancestors.has(ast)) return false\n if (ast.priority !== undefined && !Number.isSafeInteger(ast.priority)) return false\n const children: Array<unknown> = []\n switch (ast._tag) {\n case \"Succeed\":\n case \"Fail\":\n break\n case \"All\": {\n if (!isRecord(ast.nodes) || Array.isArray(ast.nodes)) return false\n for (const child of Object.values(ast.nodes)) children.push(child)\n break\n }\n case \"Race\": {\n if (!isRecord(ast.nodes) || Array.isArray(ast.nodes)) return false\n const members = Object.values(ast.nodes)\n if (!isRaceMode(ast.mode) || !isRaceCount(ast.mode, ast.count, members.length)) return false\n for (const child of members) children.push(child)\n break\n }\n case \"Map\": {\n if (!isFunctionIdentity(ast.mapper)) return false\n children.push(ast.first)\n break\n }\n case \"AndThen\": {\n if (!isFunctionIdentity(ast.continuation)) return false\n children.push(ast.first)\n if (ast.next !== undefined) children.push(ast.next)\n break\n }\n case \"Branch\": {\n if (typeof ast.subject !== \"string\" || !isFunctionIdentity(ast.predicate)) return false\n children.push(ast.first, ast.then, ast.else)\n break\n }\n case \"Catch\": {\n if (typeof ast.subject !== \"string\") return false\n if (ast.filterIdentity !== undefined && !isFunctionIdentity(ast.filterIdentity)) return false\n children.push(ast.protected, ast.failure)\n break\n }\n case \"FlowCall\": {\n if (typeof ast.flow !== \"string\" || !isCallMode(ast.mode)) return false\n break\n }\n case \"ActionCall\": {\n if (typeof ast.action !== \"string\") return false\n break\n }\n default:\n return false\n }\n if (children.length > 0) {\n ancestors.add(ast)\n pending.push({ exit: ast })\n for (const child of children) pending.push({ enter: child })\n }\n }\n return true\n}\n\n/**\n * Checks whether a value is a node.\n *\n * A node this module built is recognized by registration. A node that crossed\n * a serialization boundary, an object whose prototype is {@link NodeProto} and\n * whose own `ast` data property passes {@link isNodeAst}, is recognized by that\n * shape: `@smthrs/flow` hands a rehydrated AST back as a node, and the side\n * tables are all a round trip loses. The {@link TypeId} marker is an exported\n * string any object can carry, so it counts for nothing on its own, and an\n * `ast` that is missing, malformed, cyclic, or an accessor is refused because\n * every combinator reads it as trusted topology. A proxy is judged by the\n * shape it forwards.\n *\n * @since 1.0.0\n * @private\n */\nexport const isNode = (value: unknown): value is Node<unknown, unknown, any> => {\n if (typeof value !== \"object\" || value === null) return false\n if (liveNodes.has(value)) return true\n if (Object.getPrototypeOf(value) !== NodeProto) return false\n const ast = Object.getOwnPropertyDescriptor(value, \"ast\")\n return ast !== undefined && \"value\" in ast && isNodeAst(ast.value)\n}\n\n/**\n * Wraps an AST as a node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const makeNode = <A = unknown, E = never, R = never>(ast: NodeAst): Node<A, E, R> => {\n const node: Node<A, E, R> = Object.assign(Object.create(NodeProto), { ast })\n liveNodes.add(node)\n return node\n}\n\n/**\n * Constructs a {@link Succeed}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const succeed = (input: unknown): Succeed => ({ _tag: \"Succeed\", value: payloadMirror(input) })\n\n/**\n * Constructs a {@link Fail}.\n *\n * @since 1.0.0\n * @private\n * @slop\n */\nexport const fail = (error: unknown): Fail => ({ _tag: \"Fail\", error: payloadMirror(error) })\n\n/**\n * Constructs an {@link All}.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const all = (nodes: Readonly<Record<string, NodeAst>>): All => ({ _tag: \"All\", nodes })\n\n/**\n * Constructs a {@link Race}.\n *\n * @since 1.0.0\n * @private\n */\nexport const race = (mode: RaceMode, count: number, nodes: Readonly<Record<string, NodeAst>>): Race => ({\n _tag: \"Race\",\n mode,\n count,\n nodes\n})\n\n/**\n * Constructs a {@link Map}, filing the mapper under the AST it belongs to.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const map = (first: NodeAst, operation: Operation, source: unknown): Map => {\n const ast: Map = { _tag: \"Map\", first, mapper: functionIdentity(source) }\n operations.set(ast, operation)\n return ast\n}\n\n/**\n * Constructs an {@link AndThen} from a builder. The builder is evaluated once\n * against a planned value when the graph is built, never here.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const andThen = (first: NodeAst, operation: Operation, source: unknown): AndThen => {\n const ast: AndThen = { _tag: \"AndThen\", first, continuation: functionIdentity(source) }\n operations.set(ast, operation)\n return ast\n}\n\n/**\n * Constructs an {@link AndThen} from a node the author supplied directly. There\n * is no function to digest, so the continuation carries a fixed marker.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const andThenNode = (first: NodeAst, next: NodeAst): AndThen => ({\n _tag: \"AndThen\",\n first,\n continuation: { _tag: \"FunctionIdentity\", algorithm: \"static-node/v1\", digest: digestSync(\"static-node\") },\n next\n})\n\n/**\n * Constructs a {@link Branch}. Both arms arrive already evaluated, because a\n * branch that had to be run to reveal its topology would not be a plan.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const branch = (\n subject: string,\n first: NodeAst,\n predicate: Predicate,\n source: unknown,\n then: NodeAst,\n otherwise: NodeAst\n): Branch => {\n const ast: Branch = {\n _tag: \"Branch\",\n subject,\n first,\n predicate: functionIdentity(source),\n then,\n else: otherwise\n }\n predicates.set(ast, predicate)\n return ast\n}\n\n/**\n * JSON Schema does not describe arbitrary checks, declaration parsers, or\n * suspended schema factories. Include every function reachable from the\n * schema AST, preserving declared captures and treating opaque wrappers as\n * ephemeral. The iterative walk also covers nested checks and cyclic ASTs.\n *\n * @private\n */\nconst filterIdentity = (filter: Schema.Top): FunctionIdentity => {\n const identities: Array<readonly [string, FunctionIdentity]> = []\n const pending: Array<readonly [string, unknown]> = [[\"$\", filter.ast]]\n const seen = new WeakSet<object>()\n while (pending.length > 0) {\n const [path, current] = pending.pop()!\n if (typeof current === \"function\") {\n identities.push([path, functionIdentity(current)])\n } else if (typeof current === \"object\" && current !== null && !seen.has(current)) {\n seen.add(current)\n const descriptors = Object.getOwnPropertyDescriptors(current)\n for (const key of Object.keys(descriptors).sort()) {\n const descriptor = descriptors[key]!\n if (\"value\" in descriptor) pending.push([`${path}/${JSON.stringify(key)}`, descriptor.value])\n else {\n if (descriptor.get !== undefined) pending.push([`${path}/${JSON.stringify(key)}/get`, descriptor.get])\n if (descriptor.set !== undefined) pending.push([`${path}/${JSON.stringify(key)}/set`, descriptor.set])\n }\n }\n }\n }\n const ephemeral = identities.some(([, identity]) => identity.algorithm === \"sha256-source-ephemeral/v4\")\n const sourceComparable = identities.every(([, identity]) =>\n identity.algorithm !== \"sha256-source-ephemeral/v4\" || identity.sourceDigest !== undefined\n )\n return {\n _tag: \"FunctionIdentity\",\n algorithm: ephemeral\n ? \"sha256-source-ephemeral/v4\"\n : \"sha256-source-captures/v5\",\n digest: digestSync(JSON.stringify(identities)),\n ...(ephemeral && sourceComparable\n ? {\n sourceDigest: digestSync(JSON.stringify(identities.map(([path, identity]) => [path, {\n _tag: identity._tag,\n algorithm: identity.algorithm,\n digest: identity.sourceDigest ?? identity.digest\n }])))\n }\n : {})\n }\n}\n\n/**\n * Constructs a {@link Catch} whose failure topology is already evaluated.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const catch_ = (subject: string, protectedAst: NodeAst, failure: NodeAst, filter?: Schema.Top): Catch => {\n const ast: Catch = {\n _tag: \"Catch\",\n subject,\n protected: protectedAst,\n failure,\n ...(filter === undefined\n ? {}\n : {\n filter: schemaIdentity(filter, { onExcessProperty: \"error\" }),\n filterIdentity: filterIdentity(filter)\n })\n }\n if (filter !== undefined) filters.set(ast, filter)\n return ast\n}\n\n/**\n * Constructs a {@link FlowCall}, filing the flow declaration beside it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const flowCall = (declaration: unknown, flow: string, mode: CallMode, payload: unknown): FlowCall => {\n const ast: FlowCall = { _tag: \"FlowCall\", flow, mode, payload: payloadMirror(payload) }\n declarations.set(ast, declaration)\n return ast\n}\n\n/**\n * Constructs an {@link ActionCall}, filing the action declaration beside\n * it.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const actionCall = (declaration: unknown, action: string, payload: unknown): ActionCall => {\n const ast: ActionCall = { _tag: \"ActionCall\", action, payload: payloadMirror(payload) }\n declarations.set(ast, declaration)\n return ast\n}\n\n/**\n * The deferred function of a map or a continuation.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const operation = (ast: AndThen | Map): Operation | undefined => operations.get(ast)\n\n/**\n * The run-time predicate of a branch.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const predicate = (ast: Branch): Predicate | undefined => predicates.get(ast)\n\n/**\n * The optional error schema filter of a catch node.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const filter = (ast: Catch): Schema.Top | undefined => filters.get(ast)\n\n/**\n * The flow or action declaration a call node names.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const declaration = (ast: ActionCall | FlowCall): unknown => declarations.get(ast)\n\n/**\n * Copies an AST with a scheduling priority attached.\n *\n * The copy is shallow and the side tables are re-filed against it, because a\n * function, a predicate, a filter schema, and a declaration are keyed by the\n * exact AST object they belong to: a copy that left them behind would silently\n * lose the continuation the graph walk has to evaluate.\n *\n * @since 0.1.0\n * @private\n * @slop\n */\nexport const withPriority = (ast: NodeAst, priority: number): NodeAst => {\n const prioritized = { ...ast, priority }\n if (ast._tag === \"AndThen\" || ast._tag === \"Map\") {\n const deferred = operations.get(ast)\n if (deferred !== undefined) operations.set(prioritized as AndThen | Map, deferred)\n }\n if (ast._tag === \"Branch\") {\n const decision = predicates.get(ast)\n if (decision !== undefined) predicates.set(prioritized as Branch, decision)\n }\n if (ast._tag === \"Catch\") {\n const schema = filters.get(ast)\n if (schema !== undefined) filters.set(prioritized as Catch, schema)\n }\n if (ast._tag === \"ActionCall\" || ast._tag === \"FlowCall\") {\n const target = declarations.get(ast)\n if (target !== undefined) declarations.set(prioritized as ActionCall | FlowCall, target)\n }\n return prioritized\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BA,oBAAyB;AACzB,oBAA2B;AAC3B,eAA0B;AAC1B,sBAAyB;AACzB,sBAA8B;AAC9B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c,QAAQ,SAAS,cAAc,OAAO,EAAE;AACtF,eAAa,IAAI,KAAKA,YAAW;AACjC,SAAO;AACT;AASO,MAAM,YAAY,CAAC,QAA8C,WAAW,IAAI,GAAG;AASnF,MAAM,YAAY,CAAC,QAAuC,WAAW,IAAI,GAAG;AAS5E,MAAM,SAAS,CAAC,QAAuC,QAAQ,IAAI,GAAG;AAStE,MAAM,cAAc,CAAC,QAAwC,aAAa,IAAI,GAAG;AAcjF,MAAM,eAAe,CAAC,KAAc,aAA8B;AACvE,QAAM,cAAc,EAAE,GAAG,KAAK,SAAS;AACvC,MAAI,IAAI,SAAS,aAAa,IAAI,SAAS,OAAO;AAChD,UAAM,WAAW,WAAW,IAAI,GAAG;AACnC,QAAI,aAAa,OAAW,YAAW,IAAI,aAA8B,QAAQ;AAAA,EACnF;AACA,MAAI,IAAI,SAAS,UAAU;AACzB,UAAM,WAAW,WAAW,IAAI,GAAG;AACnC,QAAI,aAAa,OAAW,YAAW,IAAI,aAAuB,QAAQ;AAAA,EAC5E;AACA,MAAI,IAAI,SAAS,SAAS;AACxB,UAAM,SAAS,QAAQ,IAAI,GAAG;AAC9B,QAAI,WAAW,OAAW,SAAQ,IAAI,aAAsB,MAAM;AAAA,EACpE;AACA,MAAI,IAAI,SAAS,gBAAgB,IAAI,SAAS,YAAY;AACxD,UAAM,SAAS,aAAa,IAAI,GAAG;AACnC,QAAI,WAAW,OAAW,cAAa,IAAI,aAAsC,MAAM;AAAA,EACzF;AACA,SAAO;AACT;",
|
|
6
6
|
"names": ["operation", "predicate", "filter", "identity", "declaration"]
|
|
7
7
|
}
|
package/dist/esm/Node.d.ts
CHANGED
|
@@ -388,6 +388,14 @@ export declare const bindPlanned: {
|
|
|
388
388
|
<A, B, E2, R2>(build: (reference: Planned.Planned<A>) => Node<B, E2, R2>): <E, R>(self: Node<A, E, R>) => Node<B, E | E2, R | R2>;
|
|
389
389
|
<A, E, R, B, E2, R2>(self: Node<A, E, R>, build: (reference: Planned.Planned<A>) => Node<B, E2, R2>): Node<B, E | E2, R | R2>;
|
|
390
390
|
};
|
|
391
|
+
/**
|
|
392
|
+
* Maximum eagerly nested branch arms. Arm construction precedes graph walking;
|
|
393
|
+
* this bound leaves native stack headroom for a typed refusal.
|
|
394
|
+
*
|
|
395
|
+
* @since 1.0.0
|
|
396
|
+
* @category constants
|
|
397
|
+
*/
|
|
398
|
+
export declare const maximumArmDepth = 512;
|
|
391
399
|
/**
|
|
392
400
|
* Decides between two arms, both of them static topology.
|
|
393
401
|
*
|