@smthrs/plan 0.0.0-stage → 1.0.0-rc.12
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 +185 -0
- package/LICENSE +21 -0
- package/README.md +230 -2
- package/THIRD_PARTY_NOTICES.md +48 -0
- package/dist/cjs/CachePolicy.d.ts +131 -0
- package/dist/cjs/CachePolicy.d.ts.map +1 -0
- package/dist/cjs/CachePolicy.js +50 -0
- package/dist/cjs/CachePolicy.js.map +7 -0
- package/dist/cjs/Effects.d.ts +258 -0
- package/dist/cjs/Effects.d.ts.map +1 -0
- package/dist/cjs/Effects.js +76 -0
- package/dist/cjs/Effects.js.map +7 -0
- package/dist/cjs/FileSet.d.ts +366 -0
- package/dist/cjs/FileSet.d.ts.map +1 -0
- package/dist/cjs/FileSet.js +196 -0
- package/dist/cjs/FileSet.js.map +7 -0
- package/dist/cjs/GraphBuildError.d.ts +120 -0
- package/dist/cjs/GraphBuildError.d.ts.map +1 -0
- package/dist/cjs/GraphBuildError.js +71 -0
- package/dist/cjs/GraphBuildError.js.map +7 -0
- package/dist/cjs/KeyMaterial.d.ts +107 -0
- package/dist/cjs/KeyMaterial.d.ts.map +1 -0
- package/dist/cjs/KeyMaterial.js +64 -0
- package/dist/cjs/KeyMaterial.js.map +7 -0
- package/dist/cjs/Node.d.ts +677 -0
- package/dist/cjs/Node.d.ts.map +1 -0
- package/dist/cjs/Node.js +229 -0
- package/dist/cjs/Node.js.map +7 -0
- package/dist/cjs/Placement.d.ts +117 -0
- package/dist/cjs/Placement.d.ts.map +1 -0
- package/dist/cjs/Placement.js +46 -0
- package/dist/cjs/Placement.js.map +7 -0
- package/dist/cjs/Plan.d.ts +489 -0
- package/dist/cjs/Plan.d.ts.map +1 -0
- package/dist/cjs/Plan.js +511 -0
- package/dist/cjs/Plan.js.map +7 -0
- package/dist/cjs/PlanDiff.d.ts +77 -0
- package/dist/cjs/PlanDiff.d.ts.map +1 -0
- package/dist/cjs/PlanDiff.js +149 -0
- package/dist/cjs/PlanDiff.js.map +7 -0
- package/dist/cjs/Planned.d.ts +121 -0
- package/dist/cjs/Planned.d.ts.map +1 -0
- package/dist/cjs/Planned.js +72 -0
- package/dist/cjs/Planned.js.map +7 -0
- package/dist/cjs/Repetition.d.ts +31 -0
- package/dist/cjs/Repetition.d.ts.map +1 -0
- package/dist/cjs/Repetition.js +36 -0
- package/dist/cjs/Repetition.js.map +7 -0
- package/dist/cjs/Scheduling.d.ts +89 -0
- package/dist/cjs/Scheduling.d.ts.map +1 -0
- package/dist/cjs/Scheduling.js +76 -0
- package/dist/cjs/Scheduling.js.map +7 -0
- package/dist/cjs/StepKey.d.ts +354 -0
- package/dist/cjs/StepKey.d.ts.map +1 -0
- package/dist/cjs/StepKey.js +313 -0
- package/dist/cjs/StepKey.js.map +7 -0
- package/dist/cjs/index.d.ts +91 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +59 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/ConflictAnnotation.d.ts +59 -0
- package/dist/cjs/internal/ConflictAnnotation.d.ts.map +1 -0
- package/dist/cjs/internal/ConflictAnnotation.js +247 -0
- package/dist/cjs/internal/ConflictAnnotation.js.map +7 -0
- package/dist/cjs/internal/EffectCandidates.d.ts +19 -0
- package/dist/cjs/internal/EffectCandidates.d.ts.map +1 -0
- package/dist/cjs/internal/EffectCandidates.js +92 -0
- package/dist/cjs/internal/EffectCandidates.js.map +7 -0
- package/dist/cjs/internal/JsonMirror.d.ts +34 -0
- package/dist/cjs/internal/JsonMirror.d.ts.map +1 -0
- package/dist/cjs/internal/JsonMirror.js +195 -0
- package/dist/cjs/internal/JsonMirror.js.map +7 -0
- package/dist/cjs/internal/SchemaIdentity.d.ts +140 -0
- package/dist/cjs/internal/SchemaIdentity.d.ts.map +1 -0
- package/dist/cjs/internal/SchemaIdentity.js +718 -0
- package/dist/cjs/internal/SchemaIdentity.js.map +7 -0
- package/dist/cjs/internal/effects.d.ts +245 -0
- package/dist/cjs/internal/effects.d.ts.map +1 -0
- package/dist/cjs/internal/effects.js +290 -0
- package/dist/cjs/internal/effects.js.map +7 -0
- package/dist/cjs/internal/node.d.ts +526 -0
- package/dist/cjs/internal/node.d.ts.map +1 -0
- package/dist/cjs/internal/node.js +313 -0
- package/dist/cjs/internal/node.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/test/PlanFixtures.d.ts +127 -0
- package/dist/cjs/test/PlanFixtures.d.ts.map +1 -0
- package/dist/cjs/test/PlanFixtures.js +59 -0
- package/dist/cjs/test/PlanFixtures.js.map +7 -0
- package/dist/esm/CachePolicy.d.ts +131 -0
- package/dist/esm/CachePolicy.d.ts.map +1 -0
- package/dist/esm/CachePolicy.js +117 -0
- package/dist/esm/CachePolicy.js.map +1 -0
- package/dist/esm/Effects.d.ts +258 -0
- package/dist/esm/Effects.d.ts.map +1 -0
- package/dist/esm/Effects.js +178 -0
- package/dist/esm/Effects.js.map +1 -0
- package/dist/esm/FileSet.d.ts +366 -0
- package/dist/esm/FileSet.d.ts.map +1 -0
- package/dist/esm/FileSet.js +398 -0
- package/dist/esm/FileSet.js.map +1 -0
- package/dist/esm/GraphBuildError.d.ts +120 -0
- package/dist/esm/GraphBuildError.d.ts.map +1 -0
- package/dist/esm/GraphBuildError.js +145 -0
- package/dist/esm/GraphBuildError.js.map +1 -0
- package/dist/esm/KeyMaterial.d.ts +107 -0
- package/dist/esm/KeyMaterial.d.ts.map +1 -0
- package/dist/esm/KeyMaterial.js +92 -0
- package/dist/esm/KeyMaterial.js.map +1 -0
- package/dist/esm/Node.d.ts +677 -0
- package/dist/esm/Node.d.ts.map +1 -0
- package/dist/esm/Node.js +586 -0
- package/dist/esm/Node.js.map +1 -0
- package/dist/esm/Placement.d.ts +117 -0
- package/dist/esm/Placement.d.ts.map +1 -0
- package/dist/esm/Placement.js +65 -0
- package/dist/esm/Placement.js.map +1 -0
- package/dist/esm/Plan.d.ts +489 -0
- package/dist/esm/Plan.d.ts.map +1 -0
- package/dist/esm/Plan.js +718 -0
- package/dist/esm/Plan.js.map +1 -0
- package/dist/esm/PlanDiff.d.ts +77 -0
- package/dist/esm/PlanDiff.d.ts.map +1 -0
- package/dist/esm/PlanDiff.js +205 -0
- package/dist/esm/PlanDiff.js.map +1 -0
- package/dist/esm/Planned.d.ts +121 -0
- package/dist/esm/Planned.d.ts.map +1 -0
- package/dist/esm/Planned.js +147 -0
- package/dist/esm/Planned.js.map +1 -0
- package/dist/esm/Repetition.d.ts +31 -0
- package/dist/esm/Repetition.d.ts.map +1 -0
- package/dist/esm/Repetition.js +24 -0
- package/dist/esm/Repetition.js.map +1 -0
- package/dist/esm/Scheduling.d.ts +89 -0
- package/dist/esm/Scheduling.d.ts.map +1 -0
- package/dist/esm/Scheduling.js +82 -0
- package/dist/esm/Scheduling.js.map +1 -0
- package/dist/esm/StepKey.d.ts +354 -0
- package/dist/esm/StepKey.d.ts.map +1 -0
- package/dist/esm/StepKey.js +503 -0
- package/dist/esm/StepKey.js.map +1 -0
- package/dist/esm/index.d.ts +91 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +91 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/ConflictAnnotation.d.ts +59 -0
- package/dist/esm/internal/ConflictAnnotation.d.ts.map +1 -0
- package/dist/esm/internal/ConflictAnnotation.js +332 -0
- package/dist/esm/internal/ConflictAnnotation.js.map +1 -0
- package/dist/esm/internal/EffectCandidates.d.ts +19 -0
- package/dist/esm/internal/EffectCandidates.d.ts.map +1 -0
- package/dist/esm/internal/EffectCandidates.js +86 -0
- package/dist/esm/internal/EffectCandidates.js.map +1 -0
- package/dist/esm/internal/JsonMirror.d.ts +34 -0
- package/dist/esm/internal/JsonMirror.d.ts.map +1 -0
- package/dist/esm/internal/JsonMirror.js +204 -0
- package/dist/esm/internal/JsonMirror.js.map +1 -0
- package/dist/esm/internal/SchemaIdentity.d.ts +140 -0
- package/dist/esm/internal/SchemaIdentity.d.ts.map +1 -0
- package/dist/esm/internal/SchemaIdentity.js +1002 -0
- package/dist/esm/internal/SchemaIdentity.js.map +1 -0
- package/dist/esm/internal/effects.d.ts +245 -0
- package/dist/esm/internal/effects.d.ts.map +1 -0
- package/dist/esm/internal/effects.js +459 -0
- package/dist/esm/internal/effects.js.map +1 -0
- package/dist/esm/internal/node.d.ts +526 -0
- package/dist/esm/internal/node.d.ts.map +1 -0
- package/dist/esm/internal/node.js +565 -0
- package/dist/esm/internal/node.js.map +1 -0
- package/dist/esm/test/PlanFixtures.d.ts +127 -0
- package/dist/esm/test/PlanFixtures.d.ts.map +1 -0
- package/dist/esm/test/PlanFixtures.js +60 -0
- package/dist/esm/test/PlanFixtures.js.map +1 -0
- package/docs/README.md +167 -0
- package/docs/api.md +1485 -0
- package/docs/concepts/authoring-ast.md +204 -0
- package/docs/concepts/effects-and-conflicts.md +135 -0
- package/docs/concepts/plan-value.md +168 -0
- package/docs/concepts/step-keys.md +179 -0
- package/docs/guides/author-a-node-graph.md +182 -0
- package/docs/guides/compile-a-plan.md +146 -0
- package/docs/guides/declare-file-effects.md +143 -0
- package/docs/guides/diff-two-plans.md +310 -0
- package/docs/installation.md +75 -0
- package/docs/quickstart.md +128 -0
- package/docs/testing.md +73 -0
- package/docs/troubleshooting.md +314 -0
- package/package.json +255 -3
- package/src/CachePolicy.ts +143 -0
- package/src/Effects.ts +302 -0
- package/src/FileSet.ts +493 -0
- package/src/GraphBuildError.ts +156 -0
- package/src/KeyMaterial.ts +111 -0
- package/src/Node.ts +969 -0
- package/src/Placement.ts +99 -0
- package/src/Plan.ts +911 -0
- package/src/PlanDiff.ts +244 -0
- package/src/Planned.ts +208 -0
- package/src/Repetition.ts +33 -0
- package/src/Scheduling.ts +154 -0
- package/src/StepKey.ts +736 -0
- package/src/index.ts +103 -0
- package/src/internal/ConflictAnnotation.ts +374 -0
- package/src/internal/EffectCandidates.ts +89 -0
- package/src/internal/JsonMirror.ts +255 -0
- package/src/internal/SchemaIdentity.ts +1096 -0
- package/src/internal/effects.ts +543 -0
- package/src/internal/node.ts +859 -0
- package/src/test/PlanFixtures.ts +76 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The refusals a plan-time build raises instead of producing a wrong plan.
|
|
3
|
+
*
|
|
4
|
+
* Every one of these fails LOUDLY at build time: a planned value that was computed on must not
|
|
5
|
+
* bake `NaN` into a plan, an arm that returned something other than a node must
|
|
6
|
+
* not silently vanish from the topology, and a recursive `.call()` must direct
|
|
7
|
+
* the author to `.to()` or `.child()` rather than expanding forever. Each
|
|
8
|
+
* failure therefore names the site (`node` plus the recorded property `path`)
|
|
9
|
+
* and states the fix in `message`, because the author reading it is mid-body
|
|
10
|
+
* and needs the correction, not a classification.
|
|
11
|
+
*
|
|
12
|
+
* The codes are a closed schema literal so a caller can switch on them, and so
|
|
13
|
+
* a new refusal is a deliberate addition rather than a new free-form string.
|
|
14
|
+
*
|
|
15
|
+
* @since 0.1.0
|
|
16
|
+
*/
|
|
17
|
+
import * as Schema from "effect/Schema";
|
|
18
|
+
/**
|
|
19
|
+
* The stable code of a build refusal.
|
|
20
|
+
*
|
|
21
|
+
* `planned_value_computed` is a body computing on a step result;
|
|
22
|
+
* `invalid_all_member` is a non-node handed to {@link module:Node.all};
|
|
23
|
+
* `invalid_join` is a race, any, or quorum with a non-node member, no members,
|
|
24
|
+
* or a quorum count its members cannot reach;
|
|
25
|
+
* `invalid_continuation` is a branch arm or continuation that did not return a
|
|
26
|
+
* node; `recursion_requires_boundary` is a flow calling itself inline, which
|
|
27
|
+
* has to become a trampoline handoff or an explicit child boundary;
|
|
28
|
+
* `placement_requires_boundary` is an inline call whose callee declares a
|
|
29
|
+
* placement the enclosing flow cannot satisfy, which has to become that same
|
|
30
|
+
* explicit child boundary; `cyclic_payload` is a payload that contains itself,
|
|
31
|
+
* which no plan could serialize or hash; `payload_too_deep` is a payload
|
|
32
|
+
* nested past the build bound, which has to be flattened into shallower data;
|
|
33
|
+
* `graph_too_deep` is authored topology nested past the build bound, which
|
|
34
|
+
* has to be split with `.child()` boundaries or trampoline handoffs;
|
|
35
|
+
* `duplicate_node` is two structural graph addresses resolving to one durable
|
|
36
|
+
* node id;
|
|
37
|
+
* `invalid_priority` is a scheduling priority that is not a safe integer,
|
|
38
|
+
* which no ordering could compare; `invalid_payload` is a payload member that
|
|
39
|
+
* cannot be captured as inert JSON without executing author code or losing
|
|
40
|
+
* identity; `unstable_callback` is a function with process-local identity in a
|
|
41
|
+
* graph that requires stable callbacks. Declare its complete inert captures
|
|
42
|
+
* with `Node.capture`, including semantic implementation versions. The two
|
|
43
|
+
* depth refusals exist because graph building walks with an explicit stack
|
|
44
|
+
* and refuses at a bound, rather than recursing until the native stack
|
|
45
|
+
* overflows without a typed error.
|
|
46
|
+
*
|
|
47
|
+
* The four effect-authority refusals are raised when a declaration claims more
|
|
48
|
+
* than the declaration enclosing it granted:
|
|
49
|
+
* `effect_outside_envelope` is a read or write path the envelope does not
|
|
50
|
+
* cover, and it names those paths in `path`; `effect_mode_widening` is an
|
|
51
|
+
* `expected` declaration inside a `hermetic` envelope; `effect_tier_widening`
|
|
52
|
+
* is a tier less reversible than the envelope's; and
|
|
53
|
+
* `capability_outside_grant` is a called flow or action requiring a capability
|
|
54
|
+
* the caller does not hold, which names the dropped capabilities in `path`. The
|
|
55
|
+
* first three are fatal by {@link isFatalDiagnostic}; the fourth is advisory,
|
|
56
|
+
* because dropping a capability narrows authority rather than widening it.
|
|
57
|
+
*
|
|
58
|
+
* The last six are raised by `@smthrs/core`'s graph builder, which uses this
|
|
59
|
+
* one error rather than a second class of its own. `write_conflict` is two work
|
|
60
|
+
* nodes overlapping under `onConflict: "fail"`, and `node` names the first of
|
|
61
|
+
* the pair while `Graph.conflicts` carries both; `missing_key_material` is a
|
|
62
|
+
* node that reached key compilation without any; `dependency_cycle` is a
|
|
63
|
+
* dependency set that cannot be ordered, and `node` names a node in the cycle;
|
|
64
|
+
* `plan_too_large` is a node, edge, conflict, or effect-path limit crossed, and
|
|
65
|
+
* `node` names the node whose admission crossed it; `payload_too_large` is a
|
|
66
|
+
* plan value with more members than the bound, and `path` names the offending
|
|
67
|
+
* value path; `invalid_node` is a malformed node AST. All six are fatal.
|
|
68
|
+
*
|
|
69
|
+
* @since 0.1.0
|
|
70
|
+
* @category schemas
|
|
71
|
+
*/
|
|
72
|
+
export declare const GraphBuildErrorCode: Schema.Literals<readonly ["planned_value_computed", "invalid_all_member", "invalid_join", "invalid_continuation", "recursion_requires_boundary", "placement_requires_boundary", "cyclic_payload", "payload_too_deep", "graph_too_deep", "duplicate_node", "invalid_priority", "invalid_payload", "unstable_callback", "effect_outside_envelope", "effect_mode_widening", "effect_tier_widening", "capability_outside_grant", "write_conflict", "missing_key_material", "dependency_cycle", "plan_too_large", "payload_too_large", "invalid_node"]>;
|
|
73
|
+
/**
|
|
74
|
+
* The value form of {@link GraphBuildErrorCode}.
|
|
75
|
+
*
|
|
76
|
+
* @since 0.1.0
|
|
77
|
+
* @category models
|
|
78
|
+
*/
|
|
79
|
+
export type GraphBuildErrorCode = typeof GraphBuildErrorCode.Type;
|
|
80
|
+
declare const GraphBuildError_base: Schema.Class<GraphBuildError, Schema.TaggedStruct<"@smthrs/plan/GraphBuildError", {
|
|
81
|
+
readonly code: Schema.Literals<readonly ["planned_value_computed", "invalid_all_member", "invalid_join", "invalid_continuation", "recursion_requires_boundary", "placement_requires_boundary", "cyclic_payload", "payload_too_deep", "graph_too_deep", "duplicate_node", "invalid_priority", "invalid_payload", "unstable_callback", "effect_outside_envelope", "effect_mode_widening", "effect_tier_widening", "capability_outside_grant", "write_conflict", "missing_key_material", "dependency_cycle", "plan_too_large", "payload_too_large", "invalid_node"]>;
|
|
82
|
+
readonly node: Schema.String;
|
|
83
|
+
readonly path: Schema.$Array<Schema.String>;
|
|
84
|
+
readonly message: Schema.String;
|
|
85
|
+
}>, import("effect/Cause").YieldableError>;
|
|
86
|
+
/**
|
|
87
|
+
* A build the planner refuses, naming the site and the fix.
|
|
88
|
+
*
|
|
89
|
+
* `node` is the node reference the failure belongs to — a planned value's
|
|
90
|
+
* origin node, an `all` member name, a branch arm, or the node whose admission
|
|
91
|
+
* crossed a bound. `path` is the property path recorded on a planned value
|
|
92
|
+
* before it was misused, the effect paths an over-claiming declaration named,
|
|
93
|
+
* the capabilities a call lost, or the value path of an oversized payload; it
|
|
94
|
+
* is empty for every other code.
|
|
95
|
+
*
|
|
96
|
+
* This is the ONE build refusal. `@smthrs/core`'s graph builder raised a second
|
|
97
|
+
* `GraphBuildError` of its own, with `paths`, `nodeId` and `nodes` in place of
|
|
98
|
+
* these fields, and the two code sets diverged instead of merging. A conflict's
|
|
99
|
+
* second node is read from `Graph.conflicts`, which carries the pair.
|
|
100
|
+
*
|
|
101
|
+
* @since 0.1.0
|
|
102
|
+
* @category errors
|
|
103
|
+
*/
|
|
104
|
+
export declare class GraphBuildError extends GraphBuildError_base {
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Whether a recorded refusal blocks the drafts a plan is compiled from.
|
|
108
|
+
*
|
|
109
|
+
* A fatal refusal means the graph describes something no plan could execute as
|
|
110
|
+
* written, so the drafts are withheld. An advisory one reports a narrowing the
|
|
111
|
+
* author should see while the graph still compiles.
|
|
112
|
+
*
|
|
113
|
+
* @param diagnostic - A recorded refusal.
|
|
114
|
+
* @returns `false` only for an advisory code (`capability_outside_grant`).
|
|
115
|
+
* @since 0.1.0
|
|
116
|
+
* @category predicates
|
|
117
|
+
*/
|
|
118
|
+
export declare const isFatalDiagnostic: (diagnostic: GraphBuildError) => boolean;
|
|
119
|
+
export {};
|
|
120
|
+
//# sourceMappingURL=GraphBuildError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphBuildError.d.ts","sourceRoot":"","sources":["../../src/GraphBuildError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,mBAAmB,ohBAwB9B,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAAA;;;;;;;AAEjE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,eAAgB,SAAQ,oBAKnC;CAAG;AAaL;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,GAAI,YAAY,eAAe,KAAG,OAA8C,CAAA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var GraphBuildError_exports = {};
|
|
30
|
+
__export(GraphBuildError_exports, {
|
|
31
|
+
GraphBuildError: () => GraphBuildError,
|
|
32
|
+
GraphBuildErrorCode: () => GraphBuildErrorCode,
|
|
33
|
+
isFatalDiagnostic: () => isFatalDiagnostic
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(GraphBuildError_exports);
|
|
36
|
+
var Schema = __toESM(require("effect/Schema"), 1);
|
|
37
|
+
const GraphBuildErrorCode = Schema.Literals([
|
|
38
|
+
"planned_value_computed",
|
|
39
|
+
"invalid_all_member",
|
|
40
|
+
"invalid_join",
|
|
41
|
+
"invalid_continuation",
|
|
42
|
+
"recursion_requires_boundary",
|
|
43
|
+
"placement_requires_boundary",
|
|
44
|
+
"cyclic_payload",
|
|
45
|
+
"payload_too_deep",
|
|
46
|
+
"graph_too_deep",
|
|
47
|
+
"duplicate_node",
|
|
48
|
+
"invalid_priority",
|
|
49
|
+
"invalid_payload",
|
|
50
|
+
"unstable_callback",
|
|
51
|
+
"effect_outside_envelope",
|
|
52
|
+
"effect_mode_widening",
|
|
53
|
+
"effect_tier_widening",
|
|
54
|
+
"capability_outside_grant",
|
|
55
|
+
"write_conflict",
|
|
56
|
+
"missing_key_material",
|
|
57
|
+
"dependency_cycle",
|
|
58
|
+
"plan_too_large",
|
|
59
|
+
"payload_too_large",
|
|
60
|
+
"invalid_node"
|
|
61
|
+
]);
|
|
62
|
+
class GraphBuildError extends Schema.TaggedError()("@smthrs/plan/GraphBuildError", {
|
|
63
|
+
code: GraphBuildErrorCode,
|
|
64
|
+
node: Schema.String,
|
|
65
|
+
path: Schema.Array(Schema.String),
|
|
66
|
+
message: Schema.String
|
|
67
|
+
}) {
|
|
68
|
+
}
|
|
69
|
+
const advisoryCodes = /* @__PURE__ */ new Set(["capability_outside_grant"]);
|
|
70
|
+
const isFatalDiagnostic = (diagnostic) => !advisoryCodes.has(diagnostic.code);
|
|
71
|
+
//# sourceMappingURL=GraphBuildError.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/GraphBuildError.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The refusals a plan-time build raises instead of producing a wrong plan.\n *\n * Every one of these fails LOUDLY at build time: a planned value that was computed on must not\n * bake `NaN` into a plan, an arm that returned something other than a node must\n * not silently vanish from the topology, and a recursive `.call()` must direct\n * the author to `.to()` or `.child()` rather than expanding forever. Each\n * failure therefore names the site (`node` plus the recorded property `path`)\n * and states the fix in `message`, because the author reading it is mid-body\n * and needs the correction, not a classification.\n *\n * The codes are a closed schema literal so a caller can switch on them, and so\n * a new refusal is a deliberate addition rather than a new free-form string.\n *\n * @since 0.1.0\n */\n\nimport * as Schema from \"effect/Schema\"\n\n/**\n * The stable code of a build refusal.\n *\n * `planned_value_computed` is a body computing on a step result;\n * `invalid_all_member` is a non-node handed to {@link module:Node.all};\n * `invalid_join` is a race, any, or quorum with a non-node member, no members,\n * or a quorum count its members cannot reach;\n * `invalid_continuation` is a branch arm or continuation that did not return a\n * node; `recursion_requires_boundary` is a flow calling itself inline, which\n * has to become a trampoline handoff or an explicit child boundary;\n * `placement_requires_boundary` is an inline call whose callee declares a\n * placement the enclosing flow cannot satisfy, which has to become that same\n * explicit child boundary; `cyclic_payload` is a payload that contains itself,\n * which no plan could serialize or hash; `payload_too_deep` is a payload\n * nested past the build bound, which has to be flattened into shallower data;\n * `graph_too_deep` is authored topology nested past the build bound, which\n * has to be split with `.child()` boundaries or trampoline handoffs;\n * `duplicate_node` is two structural graph addresses resolving to one durable\n * node id;\n * `invalid_priority` is a scheduling priority that is not a safe integer,\n * which no ordering could compare; `invalid_payload` is a payload member that\n * cannot be captured as inert JSON without executing author code or losing\n * identity; `unstable_callback` is a function with process-local identity in a\n * graph that requires stable callbacks. Declare its complete inert captures\n * with `Node.capture`, including semantic implementation versions. The two\n * depth refusals exist because graph building walks with an explicit stack\n * and refuses at a bound, rather than recursing until the native stack\n * overflows without a typed error.\n *\n * The four effect-authority refusals are raised when a declaration claims more\n * than the declaration enclosing it granted:\n * `effect_outside_envelope` is a read or write path the envelope does not\n * cover, and it names those paths in `path`; `effect_mode_widening` is an\n * `expected` declaration inside a `hermetic` envelope; `effect_tier_widening`\n * is a tier less reversible than the envelope's; and\n * `capability_outside_grant` is a called flow or action requiring a capability\n * the caller does not hold, which names the dropped capabilities in `path`. The\n * first three are fatal by {@link isFatalDiagnostic}; the fourth is advisory,\n * because dropping a capability narrows authority rather than widening it.\n *\n * The last six are raised by `@smthrs/core`'s graph builder, which uses this\n * one error rather than a second class of its own. `write_conflict` is two work\n * nodes overlapping under `onConflict: \"fail\"`, and `node` names the first of\n * the pair while `Graph.conflicts` carries both; `missing_key_material` is a\n * node that reached key compilation without any; `dependency_cycle` is a\n * dependency set that cannot be ordered, and `node` names a node in the cycle;\n * `plan_too_large` is a node, edge, conflict, or effect-path limit crossed, and\n * `node` names the node whose admission crossed it; `payload_too_large` is a\n * plan value with more members than the bound, and `path` names the offending\n * value path; `invalid_node` is a malformed node AST. All six are fatal.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const GraphBuildErrorCode = Schema.Literals([\n \"planned_value_computed\",\n \"invalid_all_member\",\n \"invalid_join\",\n \"invalid_continuation\",\n \"recursion_requires_boundary\",\n \"placement_requires_boundary\",\n \"cyclic_payload\",\n \"payload_too_deep\",\n \"graph_too_deep\",\n \"duplicate_node\",\n \"invalid_priority\",\n \"invalid_payload\",\n \"unstable_callback\",\n \"effect_outside_envelope\",\n \"effect_mode_widening\",\n \"effect_tier_widening\",\n \"capability_outside_grant\",\n \"write_conflict\",\n \"missing_key_material\",\n \"dependency_cycle\",\n \"plan_too_large\",\n \"payload_too_large\",\n \"invalid_node\"\n])\n\n/**\n * The value form of {@link GraphBuildErrorCode}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type GraphBuildErrorCode = typeof GraphBuildErrorCode.Type\n\n/**\n * A build the planner refuses, naming the site and the fix.\n *\n * `node` is the node reference the failure belongs to \u2014 a planned value's\n * origin node, an `all` member name, a branch arm, or the node whose admission\n * crossed a bound. `path` is the property path recorded on a planned value\n * before it was misused, the effect paths an over-claiming declaration named,\n * the capabilities a call lost, or the value path of an oversized payload; it\n * is empty for every other code.\n *\n * This is the ONE build refusal. `@smthrs/core`'s graph builder raised a second\n * `GraphBuildError` of its own, with `paths`, `nodeId` and `nodes` in place of\n * these fields, and the two code sets diverged instead of merging. A conflict's\n * second node is read from `Graph.conflicts`, which carries the pair.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class GraphBuildError extends Schema.TaggedError<GraphBuildError>()(\"@smthrs/plan/GraphBuildError\", {\n code: GraphBuildErrorCode,\n node: Schema.String,\n path: Schema.Array(Schema.String),\n message: Schema.String\n}) {}\n\n/**\n * The one advisory code. Everything else a build records blocks the drafts.\n *\n * A capability the caller does not grant is DROPPED, not granted: the callee\n * runs with less authority than it asked for, which is the safe direction. The\n * author still needs to know, because a flow that silently loses a capability\n * fails later at the action that needed it, so the build records the refusal\n * and lets the graph compile.\n */\nconst advisoryCodes: ReadonlySet<GraphBuildErrorCode> = new Set<GraphBuildErrorCode>([\"capability_outside_grant\"])\n\n/**\n * Whether a recorded refusal blocks the drafts a plan is compiled from.\n *\n * A fatal refusal means the graph describes something no plan could execute as\n * written, so the drafts are withheld. An advisory one reports a narrowing the\n * author should see while the graph still compiles.\n *\n * @param diagnostic - A recorded refusal.\n * @returns `false` only for an advisory code (`capability_outside_grant`).\n * @since 0.1.0\n * @category predicates\n */\nexport const isFatalDiagnostic = (diagnostic: GraphBuildError): boolean => !advisoryCodes.has(diagnostic.code)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,aAAwB;AAwDjB,MAAM,sBAAsB,OAAO,SAAS;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AA4BM,MAAM,wBAAwB,OAAO,YAA6B,EAAE,gCAAgC;AAAA,EACzG,MAAM;AAAA,EACN,MAAM,OAAO;AAAA,EACb,MAAM,OAAO,MAAM,OAAO,MAAM;AAAA,EAChC,SAAS,OAAO;AAClB,CAAC,EAAE;AAAC;AAWJ,MAAM,gBAAkD,oBAAI,IAAyB,CAAC,0BAA0B,CAAC;AAc1G,MAAM,oBAAoB,CAAC,eAAyC,CAAC,cAAc,IAAI,WAAW,IAAI;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The key-material contract: what a planner hands the step-key compiler.
|
|
3
|
+
*
|
|
4
|
+
* Revived from the deleted `packages/smithers/flows/keys/src/KeyMaterial.ts`.
|
|
5
|
+
* It does NOT return to `@smthrs/keys`: that package owns generic derivation
|
|
6
|
+
* and stored-key validation, while material is a *plan-shaped* concept. It
|
|
7
|
+
* lives here, above `@smthrs/keys`, so the key package stays a leaf.
|
|
8
|
+
*
|
|
9
|
+
* Governing contract: the step-key rules at
|
|
10
|
+
* https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/plan/docs/concepts/step-keys.md. Material is computed with no I/O,
|
|
11
|
+
* and two hardening rules shape it: the nominal, never shape-sniffed
|
|
12
|
+
* `InputRef` and the hashed `version`.
|
|
13
|
+
*
|
|
14
|
+
* @since 0.1.0
|
|
15
|
+
*/
|
|
16
|
+
import * as Schema from "effect/Schema";
|
|
17
|
+
/**
|
|
18
|
+
* A reference to one declared input of a node: a value hashed inline, or the
|
|
19
|
+
* key of an upstream node whose result this node consumes.
|
|
20
|
+
*
|
|
21
|
+
* The three variants are tagged, and the tag is hashed, so `Pending{from}` and
|
|
22
|
+
* `Ref{from, path: []}` — which resolve to the same dependency digest — can
|
|
23
|
+
* never collide.
|
|
24
|
+
*
|
|
25
|
+
* - `Literal` hashes `value` inline.
|
|
26
|
+
* - `Ref` consumes the value at `path` inside node `from`'s result.
|
|
27
|
+
* - `Pending` consumes node `from`'s whole result.
|
|
28
|
+
*
|
|
29
|
+
* @since 0.1.0
|
|
30
|
+
* @category schemas
|
|
31
|
+
*/
|
|
32
|
+
export declare const InputRef: Schema.Union<readonly [Schema.TaggedStruct<"Literal", {
|
|
33
|
+
readonly value: Schema.Unknown;
|
|
34
|
+
}>, Schema.TaggedStruct<"Ref", {
|
|
35
|
+
readonly from: Schema.NonEmptyString;
|
|
36
|
+
readonly path: Schema.$Array<Schema.String>;
|
|
37
|
+
}>, Schema.TaggedStruct<"Pending", {
|
|
38
|
+
readonly from: Schema.NonEmptyString;
|
|
39
|
+
}>]>;
|
|
40
|
+
/**
|
|
41
|
+
* The value form of {@link InputRef}.
|
|
42
|
+
*
|
|
43
|
+
* @since 0.1.0
|
|
44
|
+
* @category models
|
|
45
|
+
*/
|
|
46
|
+
export type InputRef = typeof InputRef.Type;
|
|
47
|
+
/**
|
|
48
|
+
* The material version. Folded into every hashed body so a bump re-keys every
|
|
49
|
+
* node derived from it — the original's second collision fix, kept.
|
|
50
|
+
*
|
|
51
|
+
* @since 0.1.0
|
|
52
|
+
* @category constants
|
|
53
|
+
*/
|
|
54
|
+
export declare const version = "flows/key-material/v2";
|
|
55
|
+
/**
|
|
56
|
+
* Everything that can change a node's result, handed to the digest.
|
|
57
|
+
*
|
|
58
|
+
* `effects` and `placement` are opaque: canonically serialized, never
|
|
59
|
+
* interpreted, which is what keeps the compiler independent of whatever the
|
|
60
|
+
* flow builder decides an effect declaration looks like.
|
|
61
|
+
*
|
|
62
|
+
* `version` must equal {@link version}. `kind` is the effect tier. `inputs`
|
|
63
|
+
* are hashed in order; `layers` and `capabilities` name what the node runs
|
|
64
|
+
* with.
|
|
65
|
+
*
|
|
66
|
+
* @since 0.1.0
|
|
67
|
+
* @category schemas
|
|
68
|
+
*/
|
|
69
|
+
export declare const KeyMaterial: Schema.Struct<{
|
|
70
|
+
readonly version: Schema.Literal<"flows/key-material/v2">;
|
|
71
|
+
readonly kind: Schema.Literals<readonly ["sealed", "compensable", "irreversible"]>;
|
|
72
|
+
readonly nondeterministic: Schema.optional<Schema.Literal<true>>;
|
|
73
|
+
readonly body: Schema.Unknown;
|
|
74
|
+
readonly inputs: Schema.$Array<Schema.Union<readonly [Schema.TaggedStruct<"Literal", {
|
|
75
|
+
readonly value: Schema.Unknown;
|
|
76
|
+
}>, Schema.TaggedStruct<"Ref", {
|
|
77
|
+
readonly from: Schema.NonEmptyString;
|
|
78
|
+
readonly path: Schema.$Array<Schema.String>;
|
|
79
|
+
}>, Schema.TaggedStruct<"Pending", {
|
|
80
|
+
readonly from: Schema.NonEmptyString;
|
|
81
|
+
}>]>>;
|
|
82
|
+
readonly layers: Schema.$Array<Schema.String>;
|
|
83
|
+
readonly capabilities: Schema.$Array<Schema.String>;
|
|
84
|
+
readonly effects: Schema.optional<Schema.Unknown>;
|
|
85
|
+
readonly placement: Schema.optional<Schema.Unknown>;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* The value form of {@link KeyMaterial}.
|
|
89
|
+
*
|
|
90
|
+
* @since 0.1.0
|
|
91
|
+
* @category models
|
|
92
|
+
*/
|
|
93
|
+
export type KeyMaterial = typeof KeyMaterial.Type;
|
|
94
|
+
/**
|
|
95
|
+
* The graph-local dependencies a material names, in declaration order and
|
|
96
|
+
* without duplicates. The compiler resolves exactly these before hashing, and
|
|
97
|
+
* {@link module:Plan} uses them as the edge set — one derivation, so an edge
|
|
98
|
+
* and a hashed reference can never disagree.
|
|
99
|
+
*
|
|
100
|
+
* @param material - The node's key material.
|
|
101
|
+
* @returns The `from` of every `Ref` and `Pending` input, first occurrence
|
|
102
|
+
* order, deduplicated.
|
|
103
|
+
* @since 0.1.0
|
|
104
|
+
* @category accessors
|
|
105
|
+
*/
|
|
106
|
+
export declare const dependencies: (material: KeyMaterial) => ReadonlyArray<string>;
|
|
107
|
+
//# sourceMappingURL=KeyMaterial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyMaterial.d.ts","sourceRoot":"","sources":["../../src/KeyMaterial.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,QAAQ;;;;;;;IAInB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAA;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,0BAA0B,CAAA;AAE9C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;EAWtB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,UAAU,WAAW,KAAG,aAAa,CAAC,MAAM,CAMxE,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var KeyMaterial_exports = {};
|
|
30
|
+
__export(KeyMaterial_exports, {
|
|
31
|
+
InputRef: () => InputRef,
|
|
32
|
+
KeyMaterial: () => KeyMaterial,
|
|
33
|
+
dependencies: () => dependencies,
|
|
34
|
+
version: () => version
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(KeyMaterial_exports);
|
|
37
|
+
var Schema = __toESM(require("effect/Schema"), 1);
|
|
38
|
+
var Effects = __toESM(require("./Effects.js"), 1);
|
|
39
|
+
const InputRef = Schema.Union([
|
|
40
|
+
Schema.TaggedStruct("Literal", { value: Schema.Unknown }),
|
|
41
|
+
Schema.TaggedStruct("Ref", { from: Schema.NonEmptyString, path: Schema.Array(Schema.String) }),
|
|
42
|
+
Schema.TaggedStruct("Pending", { from: Schema.NonEmptyString })
|
|
43
|
+
]);
|
|
44
|
+
const version = "flows/key-material/v2";
|
|
45
|
+
const KeyMaterial = Schema.Struct({
|
|
46
|
+
version: Schema.Literal(version),
|
|
47
|
+
kind: Effects.Tier,
|
|
48
|
+
// Absence claims determinism; only the explicit declaration changes identity.
|
|
49
|
+
nondeterministic: Schema.optional(Schema.Literal(true)),
|
|
50
|
+
body: Schema.Unknown,
|
|
51
|
+
inputs: Schema.Array(InputRef),
|
|
52
|
+
layers: Schema.Array(Schema.String),
|
|
53
|
+
capabilities: Schema.Array(Schema.String),
|
|
54
|
+
effects: Schema.optional(Schema.Unknown),
|
|
55
|
+
placement: Schema.optional(Schema.Unknown)
|
|
56
|
+
});
|
|
57
|
+
const dependencies = (material) => {
|
|
58
|
+
const seen = /* @__PURE__ */ new Set();
|
|
59
|
+
for (const input of material.inputs) {
|
|
60
|
+
if (input._tag !== "Literal") seen.add(input.from);
|
|
61
|
+
}
|
|
62
|
+
return [...seen];
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=KeyMaterial.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/KeyMaterial.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The key-material contract: what a planner hands the step-key compiler.\n *\n * Revived from the deleted `packages/smithers/flows/keys/src/KeyMaterial.ts`.\n * It does NOT return to `@smthrs/keys`: that package owns generic derivation\n * and stored-key validation, while material is a *plan-shaped* concept. It\n * lives here, above `@smthrs/keys`, so the key package stays a leaf.\n *\n * Governing contract: the step-key rules at\n * https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/plan/docs/concepts/step-keys.md. Material is computed with no I/O,\n * and two hardening rules shape it: the nominal, never shape-sniffed\n * `InputRef` and the hashed `version`.\n *\n * @since 0.1.0\n */\n\nimport * as Schema from \"effect/Schema\"\nimport * as Effects from \"./Effects.ts\"\n\n/**\n * A reference to one declared input of a node: a value hashed inline, or the\n * key of an upstream node whose result this node consumes.\n *\n * The three variants are tagged, and the tag is hashed, so `Pending{from}` and\n * `Ref{from, path: []}` \u2014 which resolve to the same dependency digest \u2014 can\n * never collide.\n *\n * - `Literal` hashes `value` inline.\n * - `Ref` consumes the value at `path` inside node `from`'s result.\n * - `Pending` consumes node `from`'s whole result.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const InputRef = Schema.Union([\n Schema.TaggedStruct(\"Literal\", { value: Schema.Unknown }),\n Schema.TaggedStruct(\"Ref\", { from: Schema.NonEmptyString, path: Schema.Array(Schema.String) }),\n Schema.TaggedStruct(\"Pending\", { from: Schema.NonEmptyString })\n])\n\n/**\n * The value form of {@link InputRef}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type InputRef = typeof InputRef.Type\n\n/**\n * The material version. Folded into every hashed body so a bump re-keys every\n * node derived from it \u2014 the original's second collision fix, kept.\n *\n * @since 0.1.0\n * @category constants\n */\nexport const version = \"flows/key-material/v2\"\n\n/**\n * Everything that can change a node's result, handed to the digest.\n *\n * `effects` and `placement` are opaque: canonically serialized, never\n * interpreted, which is what keeps the compiler independent of whatever the\n * flow builder decides an effect declaration looks like.\n *\n * `version` must equal {@link version}. `kind` is the effect tier. `inputs`\n * are hashed in order; `layers` and `capabilities` name what the node runs\n * with.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const KeyMaterial = Schema.Struct({\n version: Schema.Literal(version),\n kind: Effects.Tier,\n // Absence claims determinism; only the explicit declaration changes identity.\n nondeterministic: Schema.optional(Schema.Literal(true)),\n body: Schema.Unknown,\n inputs: Schema.Array(InputRef),\n layers: Schema.Array(Schema.String),\n capabilities: Schema.Array(Schema.String),\n effects: Schema.optional(Schema.Unknown),\n placement: Schema.optional(Schema.Unknown)\n})\n\n/**\n * The value form of {@link KeyMaterial}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type KeyMaterial = typeof KeyMaterial.Type\n\n/**\n * The graph-local dependencies a material names, in declaration order and\n * without duplicates. The compiler resolves exactly these before hashing, and\n * {@link module:Plan} uses them as the edge set \u2014 one derivation, so an edge\n * and a hashed reference can never disagree.\n *\n * @param material - The node's key material.\n * @returns The `from` of every `Ref` and `Pending` input, first occurrence\n * order, deduplicated.\n * @since 0.1.0\n * @category accessors\n */\nexport const dependencies = (material: KeyMaterial): ReadonlyArray<string> => {\n const seen = new Set<string>()\n for (const input of material.inputs) {\n if (input._tag !== \"Literal\") seen.add(input.from)\n }\n return [...seen]\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,aAAwB;AACxB,cAAyB;AAiBlB,MAAM,WAAW,OAAO,MAAM;AAAA,EACnC,OAAO,aAAa,WAAW,EAAE,OAAO,OAAO,QAAQ,CAAC;AAAA,EACxD,OAAO,aAAa,OAAO,EAAE,MAAM,OAAO,gBAAgB,MAAM,OAAO,MAAM,OAAO,MAAM,EAAE,CAAC;AAAA,EAC7F,OAAO,aAAa,WAAW,EAAE,MAAM,OAAO,eAAe,CAAC;AAChE,CAAC;AAiBM,MAAM,UAAU;AAgBhB,MAAM,cAAc,OAAO,OAAO;AAAA,EACvC,SAAS,OAAO,QAAQ,OAAO;AAAA,EAC/B,MAAM,QAAQ;AAAA;AAAA,EAEd,kBAAkB,OAAO,SAAS,OAAO,QAAQ,IAAI,CAAC;AAAA,EACtD,MAAM,OAAO;AAAA,EACb,QAAQ,OAAO,MAAM,QAAQ;AAAA,EAC7B,QAAQ,OAAO,MAAM,OAAO,MAAM;AAAA,EAClC,cAAc,OAAO,MAAM,OAAO,MAAM;AAAA,EACxC,SAAS,OAAO,SAAS,OAAO,OAAO;AAAA,EACvC,WAAW,OAAO,SAAS,OAAO,OAAO;AAC3C,CAAC;AAsBM,MAAM,eAAe,CAAC,aAAiD;AAC5E,QAAM,OAAO,oBAAI,IAAY;AAC7B,aAAW,SAAS,SAAS,QAAQ;AACnC,QAAI,MAAM,SAAS,UAAW,MAAK,IAAI,MAAM,IAAI;AAAA,EACnD;AACA,SAAO,CAAC,GAAG,IAAI;AACjB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|