@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.
Files changed (209) hide show
  1. package/CHANGELOG.md +185 -0
  2. package/LICENSE +21 -0
  3. package/README.md +230 -2
  4. package/THIRD_PARTY_NOTICES.md +48 -0
  5. package/dist/cjs/CachePolicy.d.ts +131 -0
  6. package/dist/cjs/CachePolicy.d.ts.map +1 -0
  7. package/dist/cjs/CachePolicy.js +50 -0
  8. package/dist/cjs/CachePolicy.js.map +7 -0
  9. package/dist/cjs/Effects.d.ts +258 -0
  10. package/dist/cjs/Effects.d.ts.map +1 -0
  11. package/dist/cjs/Effects.js +76 -0
  12. package/dist/cjs/Effects.js.map +7 -0
  13. package/dist/cjs/FileSet.d.ts +366 -0
  14. package/dist/cjs/FileSet.d.ts.map +1 -0
  15. package/dist/cjs/FileSet.js +196 -0
  16. package/dist/cjs/FileSet.js.map +7 -0
  17. package/dist/cjs/GraphBuildError.d.ts +120 -0
  18. package/dist/cjs/GraphBuildError.d.ts.map +1 -0
  19. package/dist/cjs/GraphBuildError.js +71 -0
  20. package/dist/cjs/GraphBuildError.js.map +7 -0
  21. package/dist/cjs/KeyMaterial.d.ts +107 -0
  22. package/dist/cjs/KeyMaterial.d.ts.map +1 -0
  23. package/dist/cjs/KeyMaterial.js +64 -0
  24. package/dist/cjs/KeyMaterial.js.map +7 -0
  25. package/dist/cjs/Node.d.ts +677 -0
  26. package/dist/cjs/Node.d.ts.map +1 -0
  27. package/dist/cjs/Node.js +229 -0
  28. package/dist/cjs/Node.js.map +7 -0
  29. package/dist/cjs/Placement.d.ts +117 -0
  30. package/dist/cjs/Placement.d.ts.map +1 -0
  31. package/dist/cjs/Placement.js +46 -0
  32. package/dist/cjs/Placement.js.map +7 -0
  33. package/dist/cjs/Plan.d.ts +489 -0
  34. package/dist/cjs/Plan.d.ts.map +1 -0
  35. package/dist/cjs/Plan.js +511 -0
  36. package/dist/cjs/Plan.js.map +7 -0
  37. package/dist/cjs/PlanDiff.d.ts +77 -0
  38. package/dist/cjs/PlanDiff.d.ts.map +1 -0
  39. package/dist/cjs/PlanDiff.js +149 -0
  40. package/dist/cjs/PlanDiff.js.map +7 -0
  41. package/dist/cjs/Planned.d.ts +121 -0
  42. package/dist/cjs/Planned.d.ts.map +1 -0
  43. package/dist/cjs/Planned.js +72 -0
  44. package/dist/cjs/Planned.js.map +7 -0
  45. package/dist/cjs/Repetition.d.ts +31 -0
  46. package/dist/cjs/Repetition.d.ts.map +1 -0
  47. package/dist/cjs/Repetition.js +36 -0
  48. package/dist/cjs/Repetition.js.map +7 -0
  49. package/dist/cjs/Scheduling.d.ts +89 -0
  50. package/dist/cjs/Scheduling.d.ts.map +1 -0
  51. package/dist/cjs/Scheduling.js +76 -0
  52. package/dist/cjs/Scheduling.js.map +7 -0
  53. package/dist/cjs/StepKey.d.ts +354 -0
  54. package/dist/cjs/StepKey.d.ts.map +1 -0
  55. package/dist/cjs/StepKey.js +313 -0
  56. package/dist/cjs/StepKey.js.map +7 -0
  57. package/dist/cjs/index.d.ts +91 -0
  58. package/dist/cjs/index.d.ts.map +1 -0
  59. package/dist/cjs/index.js +59 -0
  60. package/dist/cjs/index.js.map +7 -0
  61. package/dist/cjs/internal/ConflictAnnotation.d.ts +59 -0
  62. package/dist/cjs/internal/ConflictAnnotation.d.ts.map +1 -0
  63. package/dist/cjs/internal/ConflictAnnotation.js +247 -0
  64. package/dist/cjs/internal/ConflictAnnotation.js.map +7 -0
  65. package/dist/cjs/internal/EffectCandidates.d.ts +19 -0
  66. package/dist/cjs/internal/EffectCandidates.d.ts.map +1 -0
  67. package/dist/cjs/internal/EffectCandidates.js +92 -0
  68. package/dist/cjs/internal/EffectCandidates.js.map +7 -0
  69. package/dist/cjs/internal/JsonMirror.d.ts +34 -0
  70. package/dist/cjs/internal/JsonMirror.d.ts.map +1 -0
  71. package/dist/cjs/internal/JsonMirror.js +195 -0
  72. package/dist/cjs/internal/JsonMirror.js.map +7 -0
  73. package/dist/cjs/internal/SchemaIdentity.d.ts +140 -0
  74. package/dist/cjs/internal/SchemaIdentity.d.ts.map +1 -0
  75. package/dist/cjs/internal/SchemaIdentity.js +718 -0
  76. package/dist/cjs/internal/SchemaIdentity.js.map +7 -0
  77. package/dist/cjs/internal/effects.d.ts +245 -0
  78. package/dist/cjs/internal/effects.d.ts.map +1 -0
  79. package/dist/cjs/internal/effects.js +290 -0
  80. package/dist/cjs/internal/effects.js.map +7 -0
  81. package/dist/cjs/internal/node.d.ts +526 -0
  82. package/dist/cjs/internal/node.d.ts.map +1 -0
  83. package/dist/cjs/internal/node.js +313 -0
  84. package/dist/cjs/internal/node.js.map +7 -0
  85. package/dist/cjs/package.json +1 -0
  86. package/dist/cjs/test/PlanFixtures.d.ts +127 -0
  87. package/dist/cjs/test/PlanFixtures.d.ts.map +1 -0
  88. package/dist/cjs/test/PlanFixtures.js +59 -0
  89. package/dist/cjs/test/PlanFixtures.js.map +7 -0
  90. package/dist/esm/CachePolicy.d.ts +131 -0
  91. package/dist/esm/CachePolicy.d.ts.map +1 -0
  92. package/dist/esm/CachePolicy.js +117 -0
  93. package/dist/esm/CachePolicy.js.map +1 -0
  94. package/dist/esm/Effects.d.ts +258 -0
  95. package/dist/esm/Effects.d.ts.map +1 -0
  96. package/dist/esm/Effects.js +178 -0
  97. package/dist/esm/Effects.js.map +1 -0
  98. package/dist/esm/FileSet.d.ts +366 -0
  99. package/dist/esm/FileSet.d.ts.map +1 -0
  100. package/dist/esm/FileSet.js +398 -0
  101. package/dist/esm/FileSet.js.map +1 -0
  102. package/dist/esm/GraphBuildError.d.ts +120 -0
  103. package/dist/esm/GraphBuildError.d.ts.map +1 -0
  104. package/dist/esm/GraphBuildError.js +145 -0
  105. package/dist/esm/GraphBuildError.js.map +1 -0
  106. package/dist/esm/KeyMaterial.d.ts +107 -0
  107. package/dist/esm/KeyMaterial.d.ts.map +1 -0
  108. package/dist/esm/KeyMaterial.js +92 -0
  109. package/dist/esm/KeyMaterial.js.map +1 -0
  110. package/dist/esm/Node.d.ts +677 -0
  111. package/dist/esm/Node.d.ts.map +1 -0
  112. package/dist/esm/Node.js +586 -0
  113. package/dist/esm/Node.js.map +1 -0
  114. package/dist/esm/Placement.d.ts +117 -0
  115. package/dist/esm/Placement.d.ts.map +1 -0
  116. package/dist/esm/Placement.js +65 -0
  117. package/dist/esm/Placement.js.map +1 -0
  118. package/dist/esm/Plan.d.ts +489 -0
  119. package/dist/esm/Plan.d.ts.map +1 -0
  120. package/dist/esm/Plan.js +718 -0
  121. package/dist/esm/Plan.js.map +1 -0
  122. package/dist/esm/PlanDiff.d.ts +77 -0
  123. package/dist/esm/PlanDiff.d.ts.map +1 -0
  124. package/dist/esm/PlanDiff.js +205 -0
  125. package/dist/esm/PlanDiff.js.map +1 -0
  126. package/dist/esm/Planned.d.ts +121 -0
  127. package/dist/esm/Planned.d.ts.map +1 -0
  128. package/dist/esm/Planned.js +147 -0
  129. package/dist/esm/Planned.js.map +1 -0
  130. package/dist/esm/Repetition.d.ts +31 -0
  131. package/dist/esm/Repetition.d.ts.map +1 -0
  132. package/dist/esm/Repetition.js +24 -0
  133. package/dist/esm/Repetition.js.map +1 -0
  134. package/dist/esm/Scheduling.d.ts +89 -0
  135. package/dist/esm/Scheduling.d.ts.map +1 -0
  136. package/dist/esm/Scheduling.js +82 -0
  137. package/dist/esm/Scheduling.js.map +1 -0
  138. package/dist/esm/StepKey.d.ts +354 -0
  139. package/dist/esm/StepKey.d.ts.map +1 -0
  140. package/dist/esm/StepKey.js +503 -0
  141. package/dist/esm/StepKey.js.map +1 -0
  142. package/dist/esm/index.d.ts +91 -0
  143. package/dist/esm/index.d.ts.map +1 -0
  144. package/dist/esm/index.js +91 -0
  145. package/dist/esm/index.js.map +1 -0
  146. package/dist/esm/internal/ConflictAnnotation.d.ts +59 -0
  147. package/dist/esm/internal/ConflictAnnotation.d.ts.map +1 -0
  148. package/dist/esm/internal/ConflictAnnotation.js +332 -0
  149. package/dist/esm/internal/ConflictAnnotation.js.map +1 -0
  150. package/dist/esm/internal/EffectCandidates.d.ts +19 -0
  151. package/dist/esm/internal/EffectCandidates.d.ts.map +1 -0
  152. package/dist/esm/internal/EffectCandidates.js +86 -0
  153. package/dist/esm/internal/EffectCandidates.js.map +1 -0
  154. package/dist/esm/internal/JsonMirror.d.ts +34 -0
  155. package/dist/esm/internal/JsonMirror.d.ts.map +1 -0
  156. package/dist/esm/internal/JsonMirror.js +204 -0
  157. package/dist/esm/internal/JsonMirror.js.map +1 -0
  158. package/dist/esm/internal/SchemaIdentity.d.ts +140 -0
  159. package/dist/esm/internal/SchemaIdentity.d.ts.map +1 -0
  160. package/dist/esm/internal/SchemaIdentity.js +1002 -0
  161. package/dist/esm/internal/SchemaIdentity.js.map +1 -0
  162. package/dist/esm/internal/effects.d.ts +245 -0
  163. package/dist/esm/internal/effects.d.ts.map +1 -0
  164. package/dist/esm/internal/effects.js +459 -0
  165. package/dist/esm/internal/effects.js.map +1 -0
  166. package/dist/esm/internal/node.d.ts +526 -0
  167. package/dist/esm/internal/node.d.ts.map +1 -0
  168. package/dist/esm/internal/node.js +565 -0
  169. package/dist/esm/internal/node.js.map +1 -0
  170. package/dist/esm/test/PlanFixtures.d.ts +127 -0
  171. package/dist/esm/test/PlanFixtures.d.ts.map +1 -0
  172. package/dist/esm/test/PlanFixtures.js +60 -0
  173. package/dist/esm/test/PlanFixtures.js.map +1 -0
  174. package/docs/README.md +167 -0
  175. package/docs/api.md +1485 -0
  176. package/docs/concepts/authoring-ast.md +204 -0
  177. package/docs/concepts/effects-and-conflicts.md +135 -0
  178. package/docs/concepts/plan-value.md +168 -0
  179. package/docs/concepts/step-keys.md +179 -0
  180. package/docs/guides/author-a-node-graph.md +182 -0
  181. package/docs/guides/compile-a-plan.md +146 -0
  182. package/docs/guides/declare-file-effects.md +143 -0
  183. package/docs/guides/diff-two-plans.md +310 -0
  184. package/docs/installation.md +75 -0
  185. package/docs/quickstart.md +128 -0
  186. package/docs/testing.md +73 -0
  187. package/docs/troubleshooting.md +314 -0
  188. package/package.json +255 -3
  189. package/src/CachePolicy.ts +143 -0
  190. package/src/Effects.ts +302 -0
  191. package/src/FileSet.ts +493 -0
  192. package/src/GraphBuildError.ts +156 -0
  193. package/src/KeyMaterial.ts +111 -0
  194. package/src/Node.ts +969 -0
  195. package/src/Placement.ts +99 -0
  196. package/src/Plan.ts +911 -0
  197. package/src/PlanDiff.ts +244 -0
  198. package/src/Planned.ts +208 -0
  199. package/src/Repetition.ts +33 -0
  200. package/src/Scheduling.ts +154 -0
  201. package/src/StepKey.ts +736 -0
  202. package/src/index.ts +103 -0
  203. package/src/internal/ConflictAnnotation.ts +374 -0
  204. package/src/internal/EffectCandidates.ts +89 -0
  205. package/src/internal/JsonMirror.ts +255 -0
  206. package/src/internal/SchemaIdentity.ts +1096 -0
  207. package/src/internal/effects.ts +543 -0
  208. package/src/internal/node.ts +859 -0
  209. package/src/test/PlanFixtures.ts +76 -0
@@ -0,0 +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;;;;;;;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;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,mDAA6C,CAAA;AAE7E;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,mBAAmB,CAAA;AAE5E;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,CAAC,GAAG,EAAE,UAAU,qBAAqB,KAAG,cAC7B,CAAA;AAExD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,sBAAsB,GAAI,KAAK,SAAS,CAAC,GAAG,KAAG,MAAM,CAAC,IACf,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;GAqBG;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"}
@@ -0,0 +1,586 @@
1
+ /**
2
+ * Pure, pipeable nodes: the shape a flow body describes and nothing more.
3
+ *
4
+ * Building a node records an inspectable AST and executes nothing — the same
5
+ * split as Bazel's `ctx.actions.run`, which declares an action rather than
6
+ * running one. A plan is
7
+ * always a DAG, so there is no loop node here and never will be: repetition
8
+ * lives one level up, in what a flow settles with.
9
+ *
10
+ * A node also carries Effect's requirement channel, `R`, and carries it as a
11
+ * PHANTOM: building a plan demands nothing, and every combinator here unions
12
+ * `R` without ever reading it. What fills the channel is a call to something
13
+ * whose code lives elsewhere — an action — so the type of a plan states which
14
+ * implementations executing it will need, and the place that executes it is
15
+ * where the compiler asks for them.
16
+ *
17
+ * Control flow is structure. {@link branch} takes both arms and evaluates each
18
+ * ONCE, symbolically, so the exit condition and the handoff site are visible
19
+ * topology before anything runs; its predicate is digested and runs later on
20
+ * the real value. {@link map} is transformation only. The rule the authoring
21
+ * note states, and this module encodes: **map transforms; branch decides.**
22
+ *
23
+ * Adapted from `@smthrs/core` (`packages/smithers/flows/core`) `Node.ts`.
24
+ * `Dynamic` is gone — a model call is an ordinary action, and nothing
25
+ * model-shaped belongs in this package — and node annotations are gone with
26
+ * it, because the AST has to stay JSON serializable.
27
+ *
28
+ * @since 0.1.0
29
+ */
30
+ import { dual } from "effect/Function";
31
+ import { GraphBuildError } from "./GraphBuildError.js";
32
+ import * as internal from "./internal/node.js";
33
+ import * as internalSchemaIdentity from "./internal/SchemaIdentity.js";
34
+ import * as Planned from "./Planned.js";
35
+ /**
36
+ * The runtime type identifier carried by every node.
37
+ *
38
+ * @since 0.1.0
39
+ * @category type ids
40
+ * @slop
41
+ */
42
+ export const TypeId = internal.TypeId;
43
+ /**
44
+ * How a flow call joins the caller's plan: `inline` splices the callee's body
45
+ * in, `boundary` makes it one child execution, and `handoff` names the next
46
+ * trampoline round.
47
+ *
48
+ * This is the ONE call-mode vocabulary. {@link flowCall} takes it and
49
+ * `@smthrs/flow`'s graph builder switches on it, so a second spelling in
50
+ * either package would fork the moment one gained a mode.
51
+ *
52
+ * @since 0.1.0
53
+ * @category models
54
+ * @slop
55
+ */
56
+ export const CallMode = internal.CallMode;
57
+ /**
58
+ * Reads the inert AST reference created for a planned value.
59
+ *
60
+ * Structural lookalikes remain ordinary payload data. This accessor is the
61
+ * only recognition path because the marker itself is deliberately private to
62
+ * the AST cloner.
63
+ *
64
+ * @since 1.0.0
65
+ * @category accessors
66
+ */
67
+ export const plannedReference = internal.plannedReference;
68
+ /**
69
+ * The node reference a branch arm's symbolic subject carries. Arms are built
70
+ * before the graph assigns ids, so every reference an arm records names this
71
+ * placeholder, and graph building rewrites it to the branch's own upstream
72
+ * node — which is `first`, structurally, and therefore not a guess.
73
+ *
74
+ * @since 0.1.0
75
+ * @category constants
76
+ * @slop
77
+ */
78
+ export const branchSubject = "branch/subject";
79
+ /** @private */
80
+ const subjectsKey = Symbol.for("@smthrs/plan/Node/subjects/v1");
81
+ const globals = globalThis;
82
+ const subjects = globals[subjectsKey] ??= { branch: 0, catch: 0 };
83
+ /**
84
+ * The prefix of the node reference a catch failure arm's symbolic error
85
+ * carries. Each {@link catch_} mints its own token under this prefix, so an
86
+ * outer error captured inside a nested failure arm keeps naming the outer
87
+ * catch, and graph building rewrites each token to the node that catch
88
+ * protects.
89
+ *
90
+ * @since 0.1.0
91
+ * @category constants
92
+ * @slop
93
+ */
94
+ export const catchSubject = "catch/subject";
95
+ /**
96
+ * Checks whether a value is a node.
97
+ *
98
+ * A node this package built is recognized by registration at construction. A
99
+ * node that crossed a serialization boundary, an object sharing the node
100
+ * prototype whose own `ast` is a well-formed AST, is recognized by that shape,
101
+ * because `@smthrs/flow` hands a rehydrated AST back as a node and its side
102
+ * tables are all a round trip loses. The {@link TypeId} marker is a public
103
+ * string any object can carry, so it counts for nothing on its own: every
104
+ * combinator that admits a node reads its `ast` as trusted topology, and an
105
+ * object carrying the marker on any other prototype, one inheriting it from a
106
+ * node, and one whose `ast` is missing, malformed, cyclic, or an accessor are
107
+ * all refused with the same `GraphBuildError` as any other non-node. A proxy
108
+ * is judged by the shape it forwards: one that forwards a node unchanged
109
+ * passes, and one that diverges from it does not.
110
+ *
111
+ * @since 0.1.0
112
+ * @category guards
113
+ * @slop
114
+ */
115
+ export const isNode = (value) => internal.isNode(value);
116
+ /**
117
+ * A node that succeeds with the constant's inert JSON projection.
118
+ *
119
+ * Dates produce strings (or null for invalid dates), URLs produce strings,
120
+ * and callable object members are omitted. Use {@link map} to reconstruct a
121
+ * domain value explicitly after this serialization boundary.
122
+ *
123
+ * @since 0.1.0
124
+ * @category constructors
125
+ */
126
+ export const succeed = (value) => internal.makeNode(internal.succeed(value));
127
+ /**
128
+ * A node that fails with the constant's inert JSON projection, in the typed
129
+ * error channel.
130
+ *
131
+ * It is how a plan states a refusal it already knows about — an unsupported
132
+ * input, an exhausted budget, a compensation that has nothing left to undo —
133
+ * without an action that exists only to fail. {@link catch} recovers it exactly
134
+ * as it recovers an action's failure, and an uncaught one is the flow's typed
135
+ * failure.
136
+ *
137
+ * @since 1.0.0
138
+ * @category constructors
139
+ */
140
+ export const fail = (error) => internal.makeNode(internal.fail(error));
141
+ /**
142
+ * Combines independent children into one node, keyed by name.
143
+ *
144
+ * Width is fixed here, at plan time. Fanning out over something a step
145
+ * discovered is not this: end the round and carry the list in the next flow's
146
+ * payload, where it is real data.
147
+ *
148
+ * @since 0.1.0
149
+ * @category constructors
150
+ * @slop
151
+ */
152
+ export const all = (nodes) => internal.makeNode(internal.all(memberAsts(nodes, "all", "invalid_all_member")));
153
+ /**
154
+ * The member ASTs of a combination, keyed by name, refusing a non-node member.
155
+ *
156
+ * @private
157
+ */
158
+ const memberAsts = (nodes, combinator, code) => {
159
+ const asts = Object.create(null);
160
+ for (const [member, node] of Object.entries(nodes)) {
161
+ if (!isNode(node)) {
162
+ throw new GraphBuildError({
163
+ code,
164
+ node: member,
165
+ path: [],
166
+ message: `Node.${combinator} expected a Node at member "${member}"`
167
+ });
168
+ }
169
+ Object.defineProperty(asts, member, {
170
+ configurable: true,
171
+ enumerable: true,
172
+ value: node.ast,
173
+ writable: true
174
+ });
175
+ }
176
+ return asts;
177
+ };
178
+ /**
179
+ * Builds a join that settles early, refusing a member set it could never
180
+ * decide on.
181
+ *
182
+ * @private
183
+ */
184
+ const join = (mode, count, nodes) => {
185
+ const asts = memberAsts(nodes, mode, "invalid_join");
186
+ const width = Object.keys(asts).length;
187
+ if (!internal.isRaceCount(mode, count, width)) {
188
+ throw new GraphBuildError({
189
+ code: "invalid_join",
190
+ node: mode,
191
+ path: [],
192
+ message: mode === "quorum"
193
+ ? `Node.quorum needs a whole number of successes between 1 and its ${width} members, got ${String(count)}`
194
+ : `Node.${mode} needs at least one member`
195
+ });
196
+ }
197
+ return internal.race(mode, count, asts);
198
+ };
199
+ /**
200
+ * Settles with the first member to settle, success or typed failure.
201
+ *
202
+ * The other members are interrupted. The winner is journaled, so a resumed run
203
+ * settles the same member and never starts the others again.
204
+ *
205
+ * @since 1.0.0
206
+ * @category constructors
207
+ */
208
+ export const race = (nodes) => internal.makeNode(join("race", 1, nodes));
209
+ /**
210
+ * Settles with the first member to succeed, ignoring typed failures while a
211
+ * member is still running.
212
+ *
213
+ * It fails with the last failure when every member fails. The other members
214
+ * are interrupted, and the winner is journaled as {@link race} journals it.
215
+ *
216
+ * @since 1.0.0
217
+ * @category constructors
218
+ */
219
+ export const any = (nodes) => internal.makeNode(join("any", 1, nodes));
220
+ /**
221
+ * Succeeds once `count` members succeed, with exactly those members' values
222
+ * keyed by name.
223
+ *
224
+ * It fails with the failure that leaves fewer than `count` members able to
225
+ * succeed. Either way the members still running are interrupted, and the
226
+ * members that decided are journaled as {@link race} journals its winner.
227
+ *
228
+ * @since 1.0.0
229
+ * @category constructors
230
+ */
231
+ export const quorum = (count, nodes) => internal.makeNode(join("quorum", count, nodes));
232
+ /**
233
+ * Transforms an eventual success value with a deferred pure function.
234
+ *
235
+ * The function is digested, not run: it executes later, on the real value.
236
+ * This is where computation on a step result belongs — and only computation. A
237
+ * `map` that decides what happens next is a `branch` written wrongly.
238
+ *
239
+ * @since 0.1.0
240
+ * @category mapping
241
+ * @slop
242
+ */
243
+ export const map = dual(2, (self, f) => internal.makeNode(internal.map(self.ast, (value) => f(value), f)));
244
+ /**
245
+ * Starts the entire next subtree only after this node succeeds, without
246
+ * consuming its result. Failure or interruption prevents that subtree from
247
+ * starting, including actions nested inside combinations or inline flows.
248
+ *
249
+ * Use {@link bindPlanned} to build a dependency from a symbolic result, or
250
+ * {@link map} to compute on the eventual value.
251
+ *
252
+ * @since 0.1.0
253
+ * @category sequencing
254
+ * @slop
255
+ */
256
+ export const andThen = dual(2, (self, next) => {
257
+ if (!isNode(next)) {
258
+ throw new GraphBuildError({
259
+ code: "invalid_continuation",
260
+ node: "andThen/next",
261
+ path: [],
262
+ message: "Node.andThen expects a Node; use Node.bindPlanned for a symbolic builder or Node.map for value computation"
263
+ });
264
+ }
265
+ return internal.makeNode(internal.andThenNode(self.ast, next.ast));
266
+ });
267
+ /**
268
+ * Builds a dependency using a symbolic reference to this node's future result.
269
+ *
270
+ * The builder runs during planning. Its argument is a {@link module:Planned.Planned}
271
+ * reference, not the value the node will eventually produce. Pass references
272
+ * into action payloads; use {@link branch} for decisions and {@link map} for
273
+ * computation on real results. JavaScript truthiness and reference equality
274
+ * cannot inspect a planned result. Enable type-aware ESLint's
275
+ * `@typescript-eslint/strict-boolean-expressions` to reject planned conditions.
276
+ * Independent descendants of the built subtree can start while this producer
277
+ * is running; consumers of its reference wait for its value. Use
278
+ * {@link andThen} when the whole next subtree must wait for success.
279
+ *
280
+ * @since 1.0.0
281
+ * @category sequencing
282
+ */
283
+ export const bindPlanned = dual(2, (self, build) => internal.makeNode(internal.andThen(self.ast, (value) => build(value), build)));
284
+ // Arm builders run before the graph walker can enforce its topology bound.
285
+ // Leave native stack headroom to construct the typed refusal and unwind.
286
+ const maximumArmDepth = 512;
287
+ let armDepth = 0;
288
+ /**
289
+ * Builds one arm, once, against the symbolic subject.
290
+ *
291
+ * @private
292
+ */
293
+ const arm = (build, subject, side) => {
294
+ if (armDepth >= maximumArmDepth) {
295
+ throw new GraphBuildError({
296
+ code: "graph_too_deep",
297
+ node: `${branchSubject}/${side}`,
298
+ path: [],
299
+ message: "Node.branch recursion needs a plan-time bound, such as a payload-derived round count. " +
300
+ "Both arms are built before the run-time predicate is evaluated."
301
+ });
302
+ }
303
+ armDepth++;
304
+ try {
305
+ const node = build(subject);
306
+ if (!isNode(node)) {
307
+ throw new GraphBuildError({
308
+ code: "invalid_continuation",
309
+ node: `${branchSubject}/${side}`,
310
+ path: [],
311
+ message: `Node.branch expected its "${side}" arm to return a Node`
312
+ });
313
+ }
314
+ return node.ast;
315
+ }
316
+ finally {
317
+ armDepth--;
318
+ }
319
+ };
320
+ /**
321
+ * Decides between two arms, both of them static topology.
322
+ *
323
+ * Each arm builder is evaluated exactly once, here, against a
324
+ * {@link module:Planned.Planned} placeholder, and the resulting ASTs are what
325
+ * the node stores — so a plan shows the exit condition and both continuations
326
+ * before it runs. The predicate is digested and evaluated at run time on the
327
+ * real value, which is why none of the plan-time placeholder machinery leaks
328
+ * into control flow.
329
+ *
330
+ * Both arms contribute their requirements, because both arms are topology the
331
+ * plan carries. A run takes one of them, but which one is not known until the
332
+ * predicate sees the real value, so an execution has to be able to take either.
333
+ *
334
+ * @since 0.1.0
335
+ * @category sequencing
336
+ * @slop
337
+ */
338
+ export const branch = dual(2, (self, options) => {
339
+ const predicate = options.if;
340
+ const subjectToken = `${branchSubject}/${subjects.branch++}`;
341
+ const subject = Planned.make(subjectToken);
342
+ return internal.makeNode(internal.branch(subjectToken, self.ast, (value) => predicate(value), predicate, arm(options.then, subject, "then"), arm(options.else, subject, "else")));
343
+ });
344
+ /**
345
+ * Recovers from matching typed failures with static failure topology.
346
+ *
347
+ * The protected graph and failure arm are both stored in the AST. The arm is
348
+ * built once at plan time against a strict planned error placeholder. With no
349
+ * schema the whole typed error channel is handled. A schema handles only the
350
+ * values it accepts, so its overloads retain E: a refinement can reject values
351
+ * without narrowing its TypeScript type. Runtime schema callbacks enter the
352
+ * filter identity along with its JSON Schema. Uncaptured callbacks are local
353
+ * to this process, just like uncaptured mappers.
354
+ *
355
+ * The failure arm contributes its requirements to the node's, for the same
356
+ * reason a branch's arms do: it is topology the plan carries, and a run reaches
357
+ * it whenever the protected graph fails.
358
+ *
359
+ * @since 0.1.0
360
+ * @category sequencing
361
+ * @slop
362
+ */
363
+ const catch_ = dual(2, (self, options) => {
364
+ const subjectToken = `${catchSubject}/${subjects.catch++}`;
365
+ const failure = options.onFailure(Planned.make(subjectToken));
366
+ if (!isNode(failure)) {
367
+ throw new GraphBuildError({
368
+ code: "invalid_continuation",
369
+ node: catchSubject,
370
+ path: [],
371
+ message: "Node.catch expected its failure arm to return a Node"
372
+ });
373
+ }
374
+ return internal.makeNode(internal.catch_(subjectToken, self.ast, failure.ast, options.error));
375
+ });
376
+ export { catch_ as catch };
377
+ /**
378
+ * Attaches a scheduling priority to a node, leaving the original unchanged.
379
+ *
380
+ * The scheduler runs ready work with a higher number first, so a priority
381
+ * changes LATENCY and nothing else. It never enters key material: a node
382
+ * ordered ahead of another still computes the same result, so re-keying it
383
+ * would throw away a legitimate cache hit. Children inherit the value
384
+ * lexically when the graph is built, and a child that states its own keeps it.
385
+ *
386
+ * @since 0.1.0
387
+ * @category annotations
388
+ * @slop
389
+ */
390
+ export const priority = dual(2, (self, value) => {
391
+ if (!Number.isSafeInteger(value)) {
392
+ throw new GraphBuildError({
393
+ code: "invalid_priority",
394
+ node: self.ast._tag,
395
+ path: [],
396
+ message: `Node.priority expects a safe integer, received ${value}`
397
+ });
398
+ }
399
+ return internal.makeNode(internal.withPriority(self.ast, value));
400
+ });
401
+ /**
402
+ * Reads the scheduling priority a node carries, or `undefined` when it states
403
+ * none and inherits from whatever encloses it.
404
+ *
405
+ * @since 0.1.0
406
+ * @category accessors
407
+ * @slop
408
+ */
409
+ export const declaredPriority = (ast) => ast.priority;
410
+ /**
411
+ * Constructs the flow-call node used by `@smthrs/flow` without making flow
412
+ * calls part of the public authoring surface of this package.
413
+ *
414
+ * Reserved for `@smthrs/flow`, which owns flow authoring. It is not part
415
+ * of this package's authoring surface, and it validates nothing: an unknown
416
+ * flow tag becomes a call node the graph keeps as a leaf.
417
+ *
418
+ * @since 0.1.0
419
+ * @category engine
420
+ * @slop
421
+ */
422
+ export const flowCall = (declaration, flow, mode, payload) => internal.makeNode(internal.flowCall(declaration, flow, mode, payload));
423
+ /**
424
+ * Constructs the action-call node used by `@smthrs/flow` without making
425
+ * action calls part of the public authoring surface of this package.
426
+ *
427
+ * Reserved for `@smthrs/flow`, which owns action authoring. It is not part
428
+ * of this package's authoring surface, and an unknown action tag becomes a
429
+ * call node the graph keeps as a leaf.
430
+ *
431
+ * @since 0.1.0
432
+ * @category engine
433
+ * @slop
434
+ */
435
+ export const actionCall = (declaration, action, payload) => internal.makeNode(internal.actionCall(declaration, action, payload));
436
+ /**
437
+ * Reads the flow or action declaration a call node names, so `@smthrs/flow`
438
+ * can expand a call it recorded. It is `undefined` for an AST that was
439
+ * rehydrated from JSON, because the declaration lives beside the AST rather
440
+ * than inside it — a graph built from such an AST keeps the call as a leaf.
441
+ *
442
+ * Reserved for `@smthrs/flow`, which files the declaration when it builds
443
+ * the call. Authors never call it.
444
+ *
445
+ * @since 0.1.0
446
+ * @category engine
447
+ * @slop
448
+ */
449
+ export const declaration = (ast) => internal.declaration(ast);
450
+ /**
451
+ * Reads the continuation builder of a sequenced node, which graph building
452
+ * evaluates once against a placeholder. It is `undefined` when the author
453
+ * supplied a node directly — the topology is already in `next` — and for a
454
+ * rehydrated AST, whose side table did not survive serialization.
455
+ *
456
+ * Reserved for `@smthrs/flow`'s graph walk. Authors never call it.
457
+ *
458
+ * @since 0.1.0
459
+ * @category engine
460
+ * @slop
461
+ */
462
+ export const continuation = (ast) => internal.operation(ast);
463
+ /**
464
+ * Reads the deferred mapper of a {@link map} node, which a driver applies to
465
+ * the real upstream value once it has one. It is `undefined` for every other
466
+ * variant, and for a rehydrated AST whose side table did not survive
467
+ * serialization.
468
+ *
469
+ * Reserved for `@smthrs/flow`'s interpreter. Authors never call it.
470
+ *
471
+ * @since 0.1.0
472
+ * @category engine
473
+ * @slop
474
+ */
475
+ export const mapper = (ast) => ast._tag === "Map" ? internal.operation(ast) : undefined;
476
+ /**
477
+ * Reads the run-time predicate of a {@link branch} node, which a driver
478
+ * evaluates on the real subject value to choose an arm. It is `undefined` for
479
+ * every other variant, and for a rehydrated AST whose side table did not
480
+ * survive serialization.
481
+ *
482
+ * Reserved for `@smthrs/flow`'s interpreter. Authors never call it.
483
+ *
484
+ * @since 0.1.0
485
+ * @category engine
486
+ * @slop
487
+ */
488
+ export const predicate = (ast) => ast._tag === "Branch" ? internal.predicate(ast) : undefined;
489
+ /**
490
+ * Reads the optional schema selecting failures handled by a {@link catch_}.
491
+ *
492
+ * Reserved for `@smthrs/flow`'s interpreter. It is `undefined` for every
493
+ * variant but `catch_`, and for a rehydrated AST whose side table did not
494
+ * survive serialization.
495
+ *
496
+ * @since 0.1.0
497
+ * @category engine
498
+ * @slop
499
+ */
500
+ export const catchFilter = (ast) => ast._tag === "Catch" ? internal.filter(ast) : undefined;
501
+ /**
502
+ * Identifies a plan-time function the AST does NOT store, a flow's `body`,
503
+ * exactly as the AST identifies the mapper and continuation it does store.
504
+ * A call that keeps its callee as a leaf still has to re-key when that
505
+ * callee's body is edited, and this is the identity it folds in. Unannotated
506
+ * functions fail closed with process-local identity; use {@link capture} to
507
+ * declare inert captures and obtain deterministic identity.
508
+ *
509
+ * Reserved for `@smthrs/flow`, which folds a callee body's identity into a
510
+ * call it keeps as a leaf. Authors never call it; it throws a `TypeError`
511
+ * when handed anything but a function.
512
+ *
513
+ * @since 0.1.0
514
+ * @category engine
515
+ * @slop
516
+ */
517
+ export const functionIdentity = (operation) => internal.functionIdentity(operation);
518
+ /**
519
+ * The refusal `schemaIdentity` and `representationIdentity` raise for a schema
520
+ * a step key cannot be derived from. Its message is the one
521
+ * `effect@4.0.0-rc.115` gave for the same schema, where it gave one.
522
+ *
523
+ * @since 1.0.0
524
+ * @category errors
525
+ */
526
+ export const SchemaIdentityError = internalSchemaIdentity.SchemaIdentityError;
527
+ /**
528
+ * Identifies a schema by the constraints it documents, so a call re-keys when
529
+ * what its callee accepts or produces changes, and a catch re-keys when its
530
+ * filter does.
531
+ *
532
+ * The document is what `Schema.toJsonSchemaDocument(schema, options)`
533
+ * returned under `effect@4.0.0-rc.115`. It is printed by this package, not by
534
+ * the installed `effect`, because a later release prints a different document
535
+ * for the same schema and a moved identity re-keys every recorded step. Use
536
+ * it wherever the document is hashed, compared or pinned; a JSON Schema shown
537
+ * to a model or a person comes from `Schema.toJsonSchemaDocument`.
538
+ *
539
+ * Reserved for the packages that derive identities. Authors never call it; it
540
+ * throws for a schema that has no JSON Schema form.
541
+ *
542
+ * @since 1.0.0
543
+ * @category engine
544
+ */
545
+ export const schemaIdentity = (schema, options) => internalSchemaIdentity.schemaIdentity(schema, options);
546
+ /**
547
+ * Identifies a schema AST by its encoded representation, the material a
548
+ * sealed action's step key folds in for its success and error schemas.
549
+ *
550
+ * The value is what `SchemaRepresentation.toJson(SchemaRepresentation.toRepresentation(ast))`
551
+ * returned under `effect@4.0.0-rc.115`, so a later `effect` release does not
552
+ * re-key recorded steps. The one exception is `Schema.brand`: from
553
+ * `effect@4.0.4` on a brand is not part of the AST, so a declaration with a
554
+ * brand re-keys once.
555
+ *
556
+ * Reserved for the packages that derive step keys. Authors never call it; it
557
+ * throws for an AST that has no representation.
558
+ *
559
+ * @since 1.0.0
560
+ * @category engine
561
+ */
562
+ export const representationIdentity = (ast) => internalSchemaIdentity.representationIdentity(ast);
563
+ /**
564
+ * Binds a frozen plain copy of inert captures as the callback's this receiver.
565
+ *
566
+ * Use a function expression to read the snapshot while keeping the ordinary
567
+ * callback arguments: Node.capture({ factor: 3 }, function(value: number) {
568
+ * return value * this.factor
569
+ * }). Caller objects remain unchanged; lexical aliases still name originals
570
+ * and must not be used as mutable semantic inputs. Nested captures retain the
571
+ * inner callback's snapshot and compose the two identities.
572
+ *
573
+ * Admission walks original descriptors once, rejects built-in brands and
574
+ * non-plain prototypes without evaluating getters, then uses structuredClone
575
+ * to refuse Proxies. Hosts without that API refuse object capture. Only the
576
+ * owned frozen copy enters identity and the wrapper. Sealed, non-extensible,
577
+ * frozen and Immer ordinary data are supported equally. Unsupported values
578
+ * raise a TypeError naming the path. See core docs/api.md#nodecapture for the
579
+ * complete algorithm and the migration from original-object locking.
580
+ *
581
+ * @category constructors
582
+ * @since 0.1.0
583
+ * @slop
584
+ */
585
+ export const capture = (captures, operation) => internal.capture(captures, operation);
586
+ //# sourceMappingURL=Node.js.map