@smthrs/plan 0.0.0-stage → 1.0.0-rc.3

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 (199) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/LICENSE +21 -0
  3. package/README.md +228 -2
  4. package/dist/cjs/CachePolicy.d.ts +131 -0
  5. package/dist/cjs/CachePolicy.d.ts.map +1 -0
  6. package/dist/cjs/CachePolicy.js +50 -0
  7. package/dist/cjs/CachePolicy.js.map +7 -0
  8. package/dist/cjs/Effects.d.ts +240 -0
  9. package/dist/cjs/Effects.d.ts.map +1 -0
  10. package/dist/cjs/Effects.js +76 -0
  11. package/dist/cjs/Effects.js.map +7 -0
  12. package/dist/cjs/FileSet.d.ts +288 -0
  13. package/dist/cjs/FileSet.d.ts.map +1 -0
  14. package/dist/cjs/FileSet.js +191 -0
  15. package/dist/cjs/FileSet.js.map +7 -0
  16. package/dist/cjs/GraphBuildError.d.ts +122 -0
  17. package/dist/cjs/GraphBuildError.d.ts.map +1 -0
  18. package/dist/cjs/GraphBuildError.js +71 -0
  19. package/dist/cjs/GraphBuildError.js.map +7 -0
  20. package/dist/cjs/KeyMaterial.d.ts +102 -0
  21. package/dist/cjs/KeyMaterial.d.ts.map +1 -0
  22. package/dist/cjs/KeyMaterial.js +64 -0
  23. package/dist/cjs/KeyMaterial.js.map +7 -0
  24. package/dist/cjs/Node.d.ts +606 -0
  25. package/dist/cjs/Node.d.ts.map +1 -0
  26. package/dist/cjs/Node.js +207 -0
  27. package/dist/cjs/Node.js.map +7 -0
  28. package/dist/cjs/Placement.d.ts +117 -0
  29. package/dist/cjs/Placement.d.ts.map +1 -0
  30. package/dist/cjs/Placement.js +46 -0
  31. package/dist/cjs/Placement.js.map +7 -0
  32. package/dist/cjs/Plan.d.ts +440 -0
  33. package/dist/cjs/Plan.d.ts.map +1 -0
  34. package/dist/cjs/Plan.js +508 -0
  35. package/dist/cjs/Plan.js.map +7 -0
  36. package/dist/cjs/PlanDiff.d.ts +58 -0
  37. package/dist/cjs/PlanDiff.d.ts.map +1 -0
  38. package/dist/cjs/PlanDiff.js +124 -0
  39. package/dist/cjs/PlanDiff.js.map +7 -0
  40. package/dist/cjs/Planned.d.ts +121 -0
  41. package/dist/cjs/Planned.d.ts.map +1 -0
  42. package/dist/cjs/Planned.js +72 -0
  43. package/dist/cjs/Planned.js.map +7 -0
  44. package/dist/cjs/Repetition.d.ts +31 -0
  45. package/dist/cjs/Repetition.d.ts.map +1 -0
  46. package/dist/cjs/Repetition.js +36 -0
  47. package/dist/cjs/Repetition.js.map +7 -0
  48. package/dist/cjs/Scheduling.d.ts +89 -0
  49. package/dist/cjs/Scheduling.d.ts.map +1 -0
  50. package/dist/cjs/Scheduling.js +76 -0
  51. package/dist/cjs/Scheduling.js.map +7 -0
  52. package/dist/cjs/StepKey.d.ts +333 -0
  53. package/dist/cjs/StepKey.d.ts.map +1 -0
  54. package/dist/cjs/StepKey.js +311 -0
  55. package/dist/cjs/StepKey.js.map +7 -0
  56. package/dist/cjs/index.d.ts +91 -0
  57. package/dist/cjs/index.d.ts.map +1 -0
  58. package/dist/cjs/index.js +59 -0
  59. package/dist/cjs/index.js.map +7 -0
  60. package/dist/cjs/internal/ConflictAnnotation.d.ts +59 -0
  61. package/dist/cjs/internal/ConflictAnnotation.d.ts.map +1 -0
  62. package/dist/cjs/internal/ConflictAnnotation.js +247 -0
  63. package/dist/cjs/internal/ConflictAnnotation.js.map +7 -0
  64. package/dist/cjs/internal/EffectCandidates.d.ts +19 -0
  65. package/dist/cjs/internal/EffectCandidates.d.ts.map +1 -0
  66. package/dist/cjs/internal/EffectCandidates.js +92 -0
  67. package/dist/cjs/internal/EffectCandidates.js.map +7 -0
  68. package/dist/cjs/internal/JsonMirror.d.ts +34 -0
  69. package/dist/cjs/internal/JsonMirror.d.ts.map +1 -0
  70. package/dist/cjs/internal/JsonMirror.js +195 -0
  71. package/dist/cjs/internal/JsonMirror.js.map +7 -0
  72. package/dist/cjs/internal/effects.d.ts +245 -0
  73. package/dist/cjs/internal/effects.d.ts.map +1 -0
  74. package/dist/cjs/internal/effects.js +290 -0
  75. package/dist/cjs/internal/effects.js.map +7 -0
  76. package/dist/cjs/internal/node.d.ts +526 -0
  77. package/dist/cjs/internal/node.d.ts.map +1 -0
  78. package/dist/cjs/internal/node.js +312 -0
  79. package/dist/cjs/internal/node.js.map +7 -0
  80. package/dist/cjs/package.json +1 -0
  81. package/dist/cjs/test/PlanFixtures.d.ts +127 -0
  82. package/dist/cjs/test/PlanFixtures.d.ts.map +1 -0
  83. package/dist/cjs/test/PlanFixtures.js +59 -0
  84. package/dist/cjs/test/PlanFixtures.js.map +7 -0
  85. package/dist/esm/CachePolicy.d.ts +131 -0
  86. package/dist/esm/CachePolicy.d.ts.map +1 -0
  87. package/dist/esm/CachePolicy.js +117 -0
  88. package/dist/esm/CachePolicy.js.map +1 -0
  89. package/dist/esm/Effects.d.ts +240 -0
  90. package/dist/esm/Effects.d.ts.map +1 -0
  91. package/dist/esm/Effects.js +167 -0
  92. package/dist/esm/Effects.js.map +1 -0
  93. package/dist/esm/FileSet.d.ts +288 -0
  94. package/dist/esm/FileSet.d.ts.map +1 -0
  95. package/dist/esm/FileSet.js +324 -0
  96. package/dist/esm/FileSet.js.map +1 -0
  97. package/dist/esm/GraphBuildError.d.ts +122 -0
  98. package/dist/esm/GraphBuildError.d.ts.map +1 -0
  99. package/dist/esm/GraphBuildError.js +146 -0
  100. package/dist/esm/GraphBuildError.js.map +1 -0
  101. package/dist/esm/KeyMaterial.d.ts +102 -0
  102. package/dist/esm/KeyMaterial.d.ts.map +1 -0
  103. package/dist/esm/KeyMaterial.js +85 -0
  104. package/dist/esm/KeyMaterial.js.map +1 -0
  105. package/dist/esm/Node.d.ts +606 -0
  106. package/dist/esm/Node.d.ts.map +1 -0
  107. package/dist/esm/Node.js +521 -0
  108. package/dist/esm/Node.js.map +1 -0
  109. package/dist/esm/Placement.d.ts +117 -0
  110. package/dist/esm/Placement.d.ts.map +1 -0
  111. package/dist/esm/Placement.js +65 -0
  112. package/dist/esm/Placement.js.map +1 -0
  113. package/dist/esm/Plan.d.ts +440 -0
  114. package/dist/esm/Plan.d.ts.map +1 -0
  115. package/dist/esm/Plan.js +673 -0
  116. package/dist/esm/Plan.js.map +1 -0
  117. package/dist/esm/PlanDiff.d.ts +58 -0
  118. package/dist/esm/PlanDiff.d.ts.map +1 -0
  119. package/dist/esm/PlanDiff.js +159 -0
  120. package/dist/esm/PlanDiff.js.map +1 -0
  121. package/dist/esm/Planned.d.ts +121 -0
  122. package/dist/esm/Planned.d.ts.map +1 -0
  123. package/dist/esm/Planned.js +147 -0
  124. package/dist/esm/Planned.js.map +1 -0
  125. package/dist/esm/Repetition.d.ts +31 -0
  126. package/dist/esm/Repetition.d.ts.map +1 -0
  127. package/dist/esm/Repetition.js +24 -0
  128. package/dist/esm/Repetition.js.map +1 -0
  129. package/dist/esm/Scheduling.d.ts +89 -0
  130. package/dist/esm/Scheduling.d.ts.map +1 -0
  131. package/dist/esm/Scheduling.js +82 -0
  132. package/dist/esm/Scheduling.js.map +1 -0
  133. package/dist/esm/StepKey.d.ts +333 -0
  134. package/dist/esm/StepKey.d.ts.map +1 -0
  135. package/dist/esm/StepKey.js +478 -0
  136. package/dist/esm/StepKey.js.map +1 -0
  137. package/dist/esm/index.d.ts +91 -0
  138. package/dist/esm/index.d.ts.map +1 -0
  139. package/dist/esm/index.js +91 -0
  140. package/dist/esm/index.js.map +1 -0
  141. package/dist/esm/internal/ConflictAnnotation.d.ts +59 -0
  142. package/dist/esm/internal/ConflictAnnotation.d.ts.map +1 -0
  143. package/dist/esm/internal/ConflictAnnotation.js +332 -0
  144. package/dist/esm/internal/ConflictAnnotation.js.map +1 -0
  145. package/dist/esm/internal/EffectCandidates.d.ts +19 -0
  146. package/dist/esm/internal/EffectCandidates.d.ts.map +1 -0
  147. package/dist/esm/internal/EffectCandidates.js +86 -0
  148. package/dist/esm/internal/EffectCandidates.js.map +1 -0
  149. package/dist/esm/internal/JsonMirror.d.ts +34 -0
  150. package/dist/esm/internal/JsonMirror.d.ts.map +1 -0
  151. package/dist/esm/internal/JsonMirror.js +204 -0
  152. package/dist/esm/internal/JsonMirror.js.map +1 -0
  153. package/dist/esm/internal/effects.d.ts +245 -0
  154. package/dist/esm/internal/effects.d.ts.map +1 -0
  155. package/dist/esm/internal/effects.js +459 -0
  156. package/dist/esm/internal/effects.js.map +1 -0
  157. package/dist/esm/internal/node.d.ts +526 -0
  158. package/dist/esm/internal/node.d.ts.map +1 -0
  159. package/dist/esm/internal/node.js +564 -0
  160. package/dist/esm/internal/node.js.map +1 -0
  161. package/dist/esm/test/PlanFixtures.d.ts +127 -0
  162. package/dist/esm/test/PlanFixtures.d.ts.map +1 -0
  163. package/dist/esm/test/PlanFixtures.js +60 -0
  164. package/dist/esm/test/PlanFixtures.js.map +1 -0
  165. package/docs/README.md +165 -0
  166. package/docs/api.md +1475 -0
  167. package/docs/concepts/authoring-ast.md +203 -0
  168. package/docs/concepts/effects-and-conflicts.md +135 -0
  169. package/docs/concepts/plan-value.md +168 -0
  170. package/docs/concepts/step-keys.md +179 -0
  171. package/docs/guides/author-a-node-graph.md +182 -0
  172. package/docs/guides/compile-a-plan.md +146 -0
  173. package/docs/guides/declare-file-effects.md +143 -0
  174. package/docs/guides/diff-two-plans.md +101 -0
  175. package/docs/installation.md +71 -0
  176. package/docs/quickstart.md +128 -0
  177. package/docs/testing.md +73 -0
  178. package/docs/troubleshooting.md +314 -0
  179. package/package.json +254 -3
  180. package/src/CachePolicy.ts +143 -0
  181. package/src/Effects.ts +284 -0
  182. package/src/FileSet.ts +411 -0
  183. package/src/GraphBuildError.ts +158 -0
  184. package/src/KeyMaterial.ts +106 -0
  185. package/src/Node.ts +871 -0
  186. package/src/Placement.ts +99 -0
  187. package/src/Plan.ts +868 -0
  188. package/src/PlanDiff.ts +199 -0
  189. package/src/Planned.ts +208 -0
  190. package/src/Repetition.ts +33 -0
  191. package/src/Scheduling.ts +154 -0
  192. package/src/StepKey.ts +710 -0
  193. package/src/index.ts +103 -0
  194. package/src/internal/ConflictAnnotation.ts +374 -0
  195. package/src/internal/EffectCandidates.ts +89 -0
  196. package/src/internal/JsonMirror.ts +255 -0
  197. package/src/internal/effects.ts +543 -0
  198. package/src/internal/node.ts +858 -0
  199. package/src/test/PlanFixtures.ts +76 -0
@@ -0,0 +1,240 @@
1
+ /**
2
+ * Pure effect declarations used to describe flow read and write envelopes.
3
+ *
4
+ * This is the ONE effect-envelope model. `@smthrs/flow` enforces it while it
5
+ * builds a graph, `@smthrs/core` re-exports it, and `@smthrs/patterns` reads it
6
+ * to intersect a decorator's declaration with the flow it wraps. It lives here
7
+ * because `@smthrs/plan` is the lowest package all three depend on, beside the
8
+ * `tier` and `onConflict` vocabularies a plan already speaks.
9
+ *
10
+ * Two layers: the declaration API, which a flow author and a catalog use, and
11
+ * the prepared matching API below it, which a graph builder uses to check one
12
+ * envelope against many steps without re-reading the envelope each time.
13
+ *
14
+ * Governing contract: `packages/smithers/flows/plan/docs/api.md`, published as
15
+ * https://smithers.sh/docs/reference/api/plan.
16
+ *
17
+ * @since 0.0.0
18
+ */
19
+ import * as Context from "effect/Context";
20
+ import * as Schema from "effect/Schema";
21
+ /**
22
+ * How reversible the work beneath a declaration is.
23
+ *
24
+ * This is the ONE tier vocabulary. `KeyMaterial.kind` is this schema, and so
25
+ * is `@smthrs/flow`'s `Action.Tier`: an action's durability and a declared
26
+ * envelope's ceiling are the same three words, and a fourth spelling of them
27
+ * in one of the three places would fork identity silently.
28
+ *
29
+ * @category schemas
30
+ * @since 1.0.0-rc.0
31
+ */
32
+ export declare const Tier: Schema.Literals<readonly ["sealed", "compensable", "irreversible"]>;
33
+ /**
34
+ * The value form of {@link Tier}.
35
+ *
36
+ * @category models
37
+ * @since 1.0.0-rc.0
38
+ */
39
+ export type Tier = typeof Tier.Type;
40
+ /**
41
+ * How hermetic the work beneath a declaration is.
42
+ *
43
+ * This is the ONE mode vocabulary: the two words were written out in
44
+ * `Declaration`, in `MakeOptions`, and twice more inside the matcher.
45
+ *
46
+ * @category schemas
47
+ * @since 1.0.0-rc.0
48
+ */
49
+ export declare const Mode: Schema.Literals<readonly ["hermetic", "expected"]>;
50
+ /**
51
+ * The value form of {@link Mode}.
52
+ *
53
+ * @category models
54
+ * @since 1.0.0-rc.0
55
+ */
56
+ export type Mode = typeof Mode.Type;
57
+ /**
58
+ * What a plan does when two nodes write the same path.
59
+ *
60
+ * This is the ONE conflict vocabulary: `Declaration.onConflict` declares it and
61
+ * `Plan.PairStrategy` is this same schema, resolved per pair by
62
+ * `Plan.compile`.
63
+ *
64
+ * @category schemas
65
+ * @since 1.0.0-rc.0
66
+ */
67
+ export declare const ConflictStrategy: Schema.Literals<readonly ["serialize", "lane", "fail"]>;
68
+ /**
69
+ * The value form of {@link ConflictStrategy}.
70
+ *
71
+ * @category models
72
+ * @since 1.0.0-rc.0
73
+ */
74
+ export type ConflictStrategy = typeof ConflictStrategy.Type;
75
+ /**
76
+ * The annotation key a flow's declared effect ENVELOPE is carried under.
77
+ *
78
+ * One key, here, because two graph builders read it: `@smthrs/flow`'s
79
+ * `Graph.build` enforces the envelope it names, and `@smthrs/core` re-exports
80
+ * this key as `Annotations.Effects`. While they were separate keys a flow
81
+ * annotated for one builder was invisible to the other.
82
+ *
83
+ * It is a `Context` key, not hashed material: annotating a flow with an
84
+ * envelope changes what a build ADMITS, and the declaration reaches identity
85
+ * only through `KeyMaterial.kind`.
86
+ *
87
+ * @category annotations
88
+ * @since 1.0.0-rc.0
89
+ */
90
+ export declare const Envelope: Context.Service<Declaration, Declaration>;
91
+ /**
92
+ * The prepared matching API: what a graph builder needs to check one envelope
93
+ * against every step it encloses, and to find the write overlaps between two
94
+ * declarations, at the cost the public functions above pay once rather than
95
+ * once per step.
96
+ *
97
+ * {@link prepareEnvelope} reads an envelope once into the form
98
+ * {@link narrowPrepared} answers from, which is what makes a wide envelope cost
99
+ * its size per build rather than per node. {@link indexPaths},
100
+ * {@link rankPaths} and {@link overlapRanks} are the same decomposition for
101
+ * write overlap, which {@link overlaps} wraps for the pairwise case.
102
+ * {@link boundedEffects} snapshots a declaration into builder-owned data,
103
+ * refusing through the caller's own error before the copy grows past its limit,
104
+ * and {@link maximumPathLength} and {@link maximumGlobs} are the per-path bounds
105
+ * that refusal enforces.
106
+ *
107
+ * @category matching
108
+ * @since 1.0.0-rc.0
109
+ */
110
+ export type { PathIndex, PreparedEnvelope, Ranked } from "./internal/effects.ts";
111
+ /**
112
+ * The prepared matching API. See the type re-exports above for what each member
113
+ * is for.
114
+ *
115
+ * @category matching
116
+ * @since 1.0.0-rc.0
117
+ */
118
+ export { boundedEffects, indexPaths, maximumGlobs, maximumPathLength, narrowPrepared, overlapRanks, prepareEnvelope, rankPaths } from "./internal/effects.ts";
119
+ /**
120
+ * A normalized description of the resources a flow or step may read and
121
+ * write.
122
+ *
123
+ * @category models
124
+ * @since 0.0.0
125
+ * @slop
126
+ */
127
+ export interface Declaration {
128
+ readonly reads: ReadonlyArray<string>;
129
+ readonly writes: ReadonlyArray<string>;
130
+ readonly mode: Mode;
131
+ readonly onConflict: ConflictStrategy;
132
+ readonly tier?: Tier | undefined;
133
+ }
134
+ /**
135
+ * Input accepted by {@link make}. Iterables are normalized into sorted,
136
+ * duplicate-free arrays so declarations are deterministic key material.
137
+ * Envelope entries and declared paths must already be path-normalized: no
138
+ * separator or dot-segment rewriting is performed. A declared path containing
139
+ * a whole `.` or `..` segment is never covered and therefore surfaces from
140
+ * {@link narrow} as an `effect_outside_envelope` diagnostic.
141
+ *
142
+ * @category models
143
+ * @since 0.0.0
144
+ * @slop
145
+ */
146
+ export interface MakeOptions {
147
+ readonly reads: Iterable<string>;
148
+ readonly writes: Iterable<string>;
149
+ readonly mode: Mode;
150
+ readonly onConflict: ConflictStrategy;
151
+ readonly tier?: Tier | undefined;
152
+ }
153
+ /**
154
+ * A result of checking that a step declaration narrows a flow envelope.
155
+ *
156
+ * @category models
157
+ * @since 0.0.0
158
+ * @slop
159
+ */
160
+ export type NarrowResult = {
161
+ readonly ok: true;
162
+ } | {
163
+ readonly ok: false;
164
+ readonly code: "effect_outside_envelope" | "effect_mode_widening" | "effect_tier_widening";
165
+ readonly paths: ReadonlyArray<string>;
166
+ };
167
+ /**
168
+ * Constructs a deterministic effect declaration.
169
+ *
170
+ * @category constructors
171
+ * @since 0.0.0
172
+ * @slop
173
+ */
174
+ export declare const make: (input: MakeOptions) => Declaration;
175
+ /**
176
+ * Checks whether `path` is covered by an envelope entry.
177
+ *
178
+ * The grammar is exhaustive: an exact path matches itself; `*` and `**` match
179
+ * everything; `prefix*` matches by string prefix; and `prefix/**` matches
180
+ * `prefix/` and everything below it, but not bare `prefix`. This is
181
+ * intentionally not full minimatch syntax. Envelope entries and declared paths
182
+ * must be normalized. A path containing a whole `.` or `..` segment is never
183
+ * covered, so {@link narrow} reports it as `effect_outside_envelope` rather
184
+ * than silently accepting an escape.
185
+ *
186
+ * @category predicates
187
+ * @since 0.0.0
188
+ * @slop
189
+ */
190
+ export declare const covers: (envelope: string, path: string) => boolean;
191
+ /**
192
+ * Verifies that a step declaration stays within an enclosing flow envelope.
193
+ *
194
+ * Read and write paths must be covered independently. A step may tighten
195
+ * `expected` to `hermetic`, but cannot widen `hermetic` to `expected`.
196
+ * Effect tiers narrow from irreversible to compensable to sealed.
197
+ *
198
+ * The envelope's lists are prepared once: exact entries go into a set and
199
+ * covering patterns collapse to their outermost prefixes, sorted, so each step
200
+ * path costs one dot-segment scan, one lookup, and one binary search ending in
201
+ * one prefix comparison, whatever the envelope's width or how many of its
202
+ * patterns nest. A graph build prepares each envelope once for every node it
203
+ * encloses.
204
+ *
205
+ * @category validation
206
+ * @since 0.0.0
207
+ * @slop
208
+ */
209
+ export declare const narrow: (envelope: Declaration, step: Declaration) => NarrowResult;
210
+ /**
211
+ * Returns the concrete or narrower write declarations shared by two effect
212
+ * declarations. The result is sorted and duplicate-free.
213
+ *
214
+ * Two declarations of the same literal path always overlap, including a path
215
+ * {@link covers} refuses to match because it carries a `.` or `..` segment.
216
+ * Glob coverage stays strict for those paths, so an unnormalized declaration
217
+ * still escapes no envelope, but two writers naming the same unnormalized path
218
+ * are still detected as writing the same resource.
219
+ *
220
+ * The union of both declarations is indexed once: the distinct paths are
221
+ * sorted, each is scanned once for a dot segment, and each pattern's prefix
222
+ * is located by binary search. Exact paths then match through a merge of two
223
+ * rank lists and each covering pattern enumerates the other declaration's
224
+ * ranks inside its interval, so the cost is linear in the two declarations
225
+ * plus the matches, whatever the paths' lengths or how many patterns nest.
226
+ *
227
+ * @category analysis
228
+ * @since 0.0.0
229
+ * @slop
230
+ */
231
+ export declare const overlaps: (a: Declaration, b: Declaration) => ReadonlyArray<string>;
232
+ /**
233
+ * Returns a sealed, hermetic copy of an effect declaration.
234
+ *
235
+ * @category constructors
236
+ * @since 0.0.0
237
+ * @slop
238
+ */
239
+ export declare const sealed: (declaration: Declaration) => Declaration;
240
+ //# sourceMappingURL=Effects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Effects.d.ts","sourceRoot":"","sources":["../../src/Effects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI,qEAA6D,CAAA;AAE9E;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAA;AAEnC;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,oDAA4C,CAAA;AAE7D;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAA;AAEnC;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,yDAAiD,CAAA;AAE9E;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBA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CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CACtC,CAAA;AAIH;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,GAAI,OAAO,WAAW,KAAG,WAMxC,CAAA;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,MAAM,GAAI,UAAU,MAAM,EAAE,MAAM,MAAM,KAAG,OAGvD,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM,GAAI,UAAU,WAAW,EAAE,MAAM,WAAW,KAAG,YACL,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,QAAQ,GAAI,GAAG,WAAW,EAAE,GAAG,WAAW,KAAG,aAAa,CAAC,MAAM,CAI7E,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,GAAI,aAAa,WAAW,KAAG,WACU,CAAA"}
@@ -0,0 +1,76 @@
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 Effects_exports = {};
30
+ __export(Effects_exports, {
31
+ ConflictStrategy: () => ConflictStrategy,
32
+ Envelope: () => Envelope,
33
+ Mode: () => Mode,
34
+ Tier: () => Tier,
35
+ boundedEffects: () => import_effects.boundedEffects,
36
+ covers: () => covers,
37
+ indexPaths: () => import_effects.indexPaths,
38
+ make: () => make,
39
+ maximumGlobs: () => import_effects.maximumGlobs,
40
+ maximumPathLength: () => import_effects.maximumPathLength,
41
+ narrow: () => narrow,
42
+ narrowPrepared: () => import_effects.narrowPrepared,
43
+ overlapRanks: () => import_effects.overlapRanks,
44
+ overlaps: () => overlaps,
45
+ prepareEnvelope: () => import_effects.prepareEnvelope,
46
+ rankPaths: () => import_effects.rankPaths,
47
+ sealed: () => sealed
48
+ });
49
+ module.exports = __toCommonJS(Effects_exports);
50
+ var Context = __toESM(require("effect/Context"), 1);
51
+ var Schema = __toESM(require("effect/Schema"), 1);
52
+ var Index = __toESM(require("./internal/effects.js"), 1);
53
+ var import_effects = require("./internal/effects.js");
54
+ const Tier = Schema.Literals(["sealed", "compensable", "irreversible"]);
55
+ const Mode = Schema.Literals(["hermetic", "expected"]);
56
+ const ConflictStrategy = Schema.Literals(["serialize", "lane", "fail"]);
57
+ const Envelope = Context.Service("@smthrs/plan/Effects/Envelope");
58
+ const normalize = (paths) => [...new Set(paths)].sort();
59
+ const make = (input) => ({
60
+ reads: normalize(input.reads),
61
+ writes: normalize(input.writes),
62
+ mode: input.mode,
63
+ onConflict: input.onConflict,
64
+ ...input.tier === void 0 ? {} : { tier: input.tier }
65
+ });
66
+ const covers = (envelope, path) => {
67
+ if (Index.hasDotSegment(path)) return false;
68
+ return envelope === path || Index.isGlob(envelope) && path.startsWith(Index.globPrefix(envelope));
69
+ };
70
+ const narrow = (envelope, step) => Index.narrowPrepared(Index.prepareEnvelope(envelope), step);
71
+ const overlaps = (a, b) => {
72
+ const indexed = Index.indexPaths([a.writes, b.writes]);
73
+ return Index.overlapRanks(indexed, Index.rankPaths(indexed, a.writes), Index.rankPaths(indexed, b.writes)).map((rank) => indexed.paths[rank]);
74
+ };
75
+ const sealed = (declaration) => make({ ...declaration, mode: "hermetic", tier: "sealed" });
76
+ //# sourceMappingURL=Effects.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Effects.ts"],
4
+ "sourcesContent": ["/**\n * Pure effect declarations used to describe flow read and write envelopes.\n *\n * This is the ONE effect-envelope model. `@smthrs/flow` enforces it while it\n * builds a graph, `@smthrs/core` re-exports it, and `@smthrs/patterns` reads it\n * to intersect a decorator's declaration with the flow it wraps. It lives here\n * because `@smthrs/plan` is the lowest package all three depend on, beside the\n * `tier` and `onConflict` vocabularies a plan already speaks.\n *\n * Two layers: the declaration API, which a flow author and a catalog use, and\n * the prepared matching API below it, which a graph builder uses to check one\n * envelope against many steps without re-reading the envelope each time.\n *\n * Governing contract: `packages/smithers/flows/plan/docs/api.md`, published as\n * https://smithers.sh/docs/reference/api/plan.\n *\n * @since 0.0.0\n */\n\nimport * as Context from \"effect/Context\"\nimport * as Schema from \"effect/Schema\"\nimport * as Index from \"./internal/effects.ts\"\n\n/**\n * How reversible the work beneath a declaration is.\n *\n * This is the ONE tier vocabulary. `KeyMaterial.kind` is this schema, and so\n * is `@smthrs/flow`'s `Action.Tier`: an action's durability and a declared\n * envelope's ceiling are the same three words, and a fourth spelling of them\n * in one of the three places would fork identity silently.\n *\n * @category schemas\n * @since 1.0.0-rc.0\n */\nexport const Tier = Schema.Literals([\"sealed\", \"compensable\", \"irreversible\"])\n\n/**\n * The value form of {@link Tier}.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type Tier = typeof Tier.Type\n\n/**\n * How hermetic the work beneath a declaration is.\n *\n * This is the ONE mode vocabulary: the two words were written out in\n * `Declaration`, in `MakeOptions`, and twice more inside the matcher.\n *\n * @category schemas\n * @since 1.0.0-rc.0\n */\nexport const Mode = Schema.Literals([\"hermetic\", \"expected\"])\n\n/**\n * The value form of {@link Mode}.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type Mode = typeof Mode.Type\n\n/**\n * What a plan does when two nodes write the same path.\n *\n * This is the ONE conflict vocabulary: `Declaration.onConflict` declares it and\n * `Plan.PairStrategy` is this same schema, resolved per pair by\n * `Plan.compile`.\n *\n * @category schemas\n * @since 1.0.0-rc.0\n */\nexport const ConflictStrategy = Schema.Literals([\"serialize\", \"lane\", \"fail\"])\n\n/**\n * The value form of {@link ConflictStrategy}.\n *\n * @category models\n * @since 1.0.0-rc.0\n */\nexport type ConflictStrategy = typeof ConflictStrategy.Type\n\n/**\n * The annotation key a flow's declared effect ENVELOPE is carried under.\n *\n * One key, here, because two graph builders read it: `@smthrs/flow`'s\n * `Graph.build` enforces the envelope it names, and `@smthrs/core` re-exports\n * this key as `Annotations.Effects`. While they were separate keys a flow\n * annotated for one builder was invisible to the other.\n *\n * It is a `Context` key, not hashed material: annotating a flow with an\n * envelope changes what a build ADMITS, and the declaration reaches identity\n * only through `KeyMaterial.kind`.\n *\n * @category annotations\n * @since 1.0.0-rc.0\n */\nexport const Envelope = Context.Service<Declaration>(\"@smthrs/plan/Effects/Envelope\")\n\n/**\n * The prepared matching API: what a graph builder needs to check one envelope\n * against every step it encloses, and to find the write overlaps between two\n * declarations, at the cost the public functions above pay once rather than\n * once per step.\n *\n * {@link prepareEnvelope} reads an envelope once into the form\n * {@link narrowPrepared} answers from, which is what makes a wide envelope cost\n * its size per build rather than per node. {@link indexPaths},\n * {@link rankPaths} and {@link overlapRanks} are the same decomposition for\n * write overlap, which {@link overlaps} wraps for the pairwise case.\n * {@link boundedEffects} snapshots a declaration into builder-owned data,\n * refusing through the caller's own error before the copy grows past its limit,\n * and {@link maximumPathLength} and {@link maximumGlobs} are the per-path bounds\n * that refusal enforces.\n *\n * @category matching\n * @since 1.0.0-rc.0\n */\nexport type { PathIndex, PreparedEnvelope, Ranked } from \"./internal/effects.ts\"\n\n/**\n * The prepared matching API. See the type re-exports above for what each member\n * is for.\n *\n * @category matching\n * @since 1.0.0-rc.0\n */\nexport {\n boundedEffects,\n indexPaths,\n maximumGlobs,\n maximumPathLength,\n narrowPrepared,\n overlapRanks,\n prepareEnvelope,\n rankPaths\n} from \"./internal/effects.ts\"\n\n/**\n * A normalized description of the resources a flow or step may read and\n * write.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport interface Declaration {\n readonly reads: ReadonlyArray<string>\n readonly writes: ReadonlyArray<string>\n readonly mode: Mode\n readonly onConflict: ConflictStrategy\n readonly tier?: Tier | undefined\n}\n\n/**\n * Input accepted by {@link make}. Iterables are normalized into sorted,\n * duplicate-free arrays so declarations are deterministic key material.\n * Envelope entries and declared paths must already be path-normalized: no\n * separator or dot-segment rewriting is performed. A declared path containing\n * a whole `.` or `..` segment is never covered and therefore surfaces from\n * {@link narrow} as an `effect_outside_envelope` diagnostic.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport interface MakeOptions {\n readonly reads: Iterable<string>\n readonly writes: Iterable<string>\n readonly mode: Mode\n readonly onConflict: ConflictStrategy\n readonly tier?: Tier | undefined\n}\n\n/**\n * A result of checking that a step declaration narrows a flow envelope.\n *\n * @category models\n * @since 0.0.0\n * @slop\n */\nexport type NarrowResult =\n | { readonly ok: true }\n | {\n readonly ok: false\n readonly code: \"effect_outside_envelope\" | \"effect_mode_widening\" | \"effect_tier_widening\"\n readonly paths: ReadonlyArray<string>\n }\n\nconst normalize = (paths: Iterable<string>): ReadonlyArray<string> => [...new Set(paths)].sort()\n\n/**\n * Constructs a deterministic effect declaration.\n *\n * @category constructors\n * @since 0.0.0\n * @slop\n */\nexport const make = (input: MakeOptions): Declaration => ({\n reads: normalize(input.reads),\n writes: normalize(input.writes),\n mode: input.mode,\n onConflict: input.onConflict,\n ...(input.tier === undefined ? {} : { tier: input.tier })\n})\n\n/**\n * Checks whether `path` is covered by an envelope entry.\n *\n * The grammar is exhaustive: an exact path matches itself; `*` and `**` match\n * everything; `prefix*` matches by string prefix; and `prefix/**` matches\n * `prefix/` and everything below it, but not bare `prefix`. This is\n * intentionally not full minimatch syntax. Envelope entries and declared paths\n * must be normalized. A path containing a whole `.` or `..` segment is never\n * covered, so {@link narrow} reports it as `effect_outside_envelope` rather\n * than silently accepting an escape.\n *\n * @category predicates\n * @since 0.0.0\n * @slop\n */\nexport const covers = (envelope: string, path: string): boolean => {\n if (Index.hasDotSegment(path)) return false\n return envelope === path || (Index.isGlob(envelope) && path.startsWith(Index.globPrefix(envelope)))\n}\n\n/**\n * Verifies that a step declaration stays within an enclosing flow envelope.\n *\n * Read and write paths must be covered independently. A step may tighten\n * `expected` to `hermetic`, but cannot widen `hermetic` to `expected`.\n * Effect tiers narrow from irreversible to compensable to sealed.\n *\n * The envelope's lists are prepared once: exact entries go into a set and\n * covering patterns collapse to their outermost prefixes, sorted, so each step\n * path costs one dot-segment scan, one lookup, and one binary search ending in\n * one prefix comparison, whatever the envelope's width or how many of its\n * patterns nest. A graph build prepares each envelope once for every node it\n * encloses.\n *\n * @category validation\n * @since 0.0.0\n * @slop\n */\nexport const narrow = (envelope: Declaration, step: Declaration): NarrowResult =>\n Index.narrowPrepared(Index.prepareEnvelope(envelope), step)\n\n/**\n * Returns the concrete or narrower write declarations shared by two effect\n * declarations. The result is sorted and duplicate-free.\n *\n * Two declarations of the same literal path always overlap, including a path\n * {@link covers} refuses to match because it carries a `.` or `..` segment.\n * Glob coverage stays strict for those paths, so an unnormalized declaration\n * still escapes no envelope, but two writers naming the same unnormalized path\n * are still detected as writing the same resource.\n *\n * The union of both declarations is indexed once: the distinct paths are\n * sorted, each is scanned once for a dot segment, and each pattern's prefix\n * is located by binary search. Exact paths then match through a merge of two\n * rank lists and each covering pattern enumerates the other declaration's\n * ranks inside its interval, so the cost is linear in the two declarations\n * plus the matches, whatever the paths' lengths or how many patterns nest.\n *\n * @category analysis\n * @since 0.0.0\n * @slop\n */\nexport const overlaps = (a: Declaration, b: Declaration): ReadonlyArray<string> => {\n const indexed = Index.indexPaths([a.writes, b.writes])\n return Index.overlapRanks(indexed, Index.rankPaths(indexed, a.writes), Index.rankPaths(indexed, b.writes))\n .map((rank) => indexed.paths[rank]!)\n}\n\n/**\n * Returns a sealed, hermetic copy of an effect declaration.\n *\n * @category constructors\n * @since 0.0.0\n * @slop\n */\nexport const sealed = (declaration: Declaration): Declaration =>\n make({ ...declaration, mode: \"hermetic\", tier: \"sealed\" })\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBA,cAAyB;AACzB,aAAwB;AACxB,YAAuB;AA2GvB,qBASO;AAvGA,MAAM,OAAO,OAAO,SAAS,CAAC,UAAU,eAAe,cAAc,CAAC;AAmBtE,MAAM,OAAO,OAAO,SAAS,CAAC,YAAY,UAAU,CAAC;AAoBrD,MAAM,mBAAmB,OAAO,SAAS,CAAC,aAAa,QAAQ,MAAM,CAAC;AAyBtE,MAAM,WAAW,QAAQ,QAAqB,+BAA+B;AA4FpF,MAAM,YAAY,CAAC,UAAmD,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC,EAAE,KAAK;AASxF,MAAM,OAAO,CAAC,WAAqC;AAAA,EACxD,OAAO,UAAU,MAAM,KAAK;AAAA,EAC5B,QAAQ,UAAU,MAAM,MAAM;AAAA,EAC9B,MAAM,MAAM;AAAA,EACZ,YAAY,MAAM;AAAA,EAClB,GAAI,MAAM,SAAS,SAAY,CAAC,IAAI,EAAE,MAAM,MAAM,KAAK;AACzD;AAiBO,MAAM,SAAS,CAAC,UAAkB,SAA0B;AACjE,MAAI,MAAM,cAAc,IAAI,EAAG,QAAO;AACtC,SAAO,aAAa,QAAS,MAAM,OAAO,QAAQ,KAAK,KAAK,WAAW,MAAM,WAAW,QAAQ,CAAC;AACnG;AAoBO,MAAM,SAAS,CAAC,UAAuB,SAC5C,MAAM,eAAe,MAAM,gBAAgB,QAAQ,GAAG,IAAI;AAuBrD,MAAM,WAAW,CAAC,GAAgB,MAA0C;AACjF,QAAM,UAAU,MAAM,WAAW,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC;AACrD,SAAO,MAAM,aAAa,SAAS,MAAM,UAAU,SAAS,EAAE,MAAM,GAAG,MAAM,UAAU,SAAS,EAAE,MAAM,CAAC,EACtG,IAAI,CAAC,SAAS,QAAQ,MAAM,IAAI,CAAE;AACvC;AASO,MAAM,SAAS,CAAC,gBACrB,KAAK,EAAE,GAAG,aAAa,MAAM,YAAY,MAAM,SAAS,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,288 @@
1
+ /**
2
+ * Static filesystem declaration vocabulary shared by planning and execution.
3
+ *
4
+ * Declared paths use `/` as their canonical separator and normalize Unicode
5
+ * to NFC. Workspace-relative paths reject C0 controls (U+0000 through U+001F)
6
+ * and DEL (U+007F), which name nothing a supported filesystem can open. C1
7
+ * controls (U+0080 through U+009F) remain accepted because those bytes are
8
+ * legal in a POSIX file name.
9
+ *
10
+ * @since 0.1.0
11
+ */
12
+ import * as Schema from "effect/Schema";
13
+ /**
14
+ * How strictly a declared file set is enforced at the boundary.
15
+ *
16
+ * `hard` rejects undeclared access. `expected` records access for validation
17
+ * after execution without requiring the sandbox to reject it immediately.
18
+ *
19
+ * This is the ONE spelling of the pair. `Plan.NodeEffects.boundaryMode` is this
20
+ * schema and so is `@smthrs/flow`'s `Action.BoundaryMode`; the literal used to
21
+ * be written out in all three places.
22
+ *
23
+ * @category schemas
24
+ * @since 1.0.0-rc.0
25
+ */
26
+ export declare const BoundaryMode: Schema.Literals<readonly ["hard", "expected"]>;
27
+ /**
28
+ * The value form of {@link BoundaryMode}.
29
+ *
30
+ * @category models
31
+ * @since 1.0.0-rc.0
32
+ */
33
+ export type BoundaryMode = typeof BoundaryMode.Type;
34
+ /**
35
+ * The canonical spelling of a declared path or pattern: every separator is
36
+ * `/`, and Unicode is normalized to NFC.
37
+ *
38
+ * {@link workspaceRelative} accepts a backslash as a separator, so
39
+ * `dist\same.js` and `dist/same.js` are two spellings of ONE workspace path.
40
+ * Every exact-path comparison in this module goes through this form, because
41
+ * comparing the raw spellings would let the separator alias defeat overlap
42
+ * detection exactly as `.` segments and empty segments would.
43
+ *
44
+ * @category accessors
45
+ * @since 0.1.0
46
+ * @slop
47
+ */
48
+ export declare const canonical: (path: string) => string;
49
+ /**
50
+ * The {@link canonical} spelling with letter case folded away.
51
+ *
52
+ * A case-insensitive filesystem (default macOS APFS, Windows NTFS) opens
53
+ * `src/A.ts` and `src/a.ts` as one file, so static overlap compares this form:
54
+ * two declarations that differ only in case must serialize. Folding goes
55
+ * through upper case because that mapping is context-free, so it folds each
56
+ * character alone and commutes with splitting a path into segments.
57
+ *
58
+ * @category accessors
59
+ * @since 1.0.0-rc.0
60
+ */
61
+ export declare const folded: (path: string) => string;
62
+ /** Workspace-relative glob pattern.
63
+ * @category schemas
64
+ * @since 0.1.0
65
+ * @slop
66
+ */
67
+ export declare const Pattern: Schema.NonEmptyString;
68
+ /**
69
+ * Whether a declared path or pattern stays inside the workspace and names it
70
+ * one way only. Refuses absolute paths (POSIX and drive-letter), upward
71
+ * traversal, and the aliasing forms — `.` segments, empty segments — that
72
+ * would let two spellings of one file defeat exact-string overlap detection.
73
+ *
74
+ * @category predicates
75
+ * @since 0.1.0
76
+ * @slop
77
+ */
78
+ export declare const workspaceRelative: (pattern: string) => boolean;
79
+ /** Bazel-style file glob.
80
+ * @category schemas
81
+ * @since 0.1.0
82
+ * @slop
83
+ */
84
+ export declare const Glob: Schema.TaggedStruct<"Glob", {
85
+ readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
86
+ readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
87
+ }>;
88
+ /** Bazel-style file glob.
89
+ * @category models
90
+ * @since 0.1.0
91
+ * @slop
92
+ */
93
+ export type Glob = typeof Glob.Type;
94
+ /** A directory output captured and replayed as one tree artifact.
95
+ * @category schemas
96
+ * @since 0.1.0
97
+ * @slop
98
+ */
99
+ export declare const TreeArtifact: Schema.TaggedStruct<"TreeArtifact", {
100
+ readonly path: Schema.NonEmptyString;
101
+ }>;
102
+ /** A directory output captured and replayed as one tree artifact.
103
+ * @category models
104
+ * @since 0.1.0
105
+ * @slop
106
+ */
107
+ export type TreeArtifact = typeof TreeArtifact.Type;
108
+ /** One leaf of a named filegroup.
109
+ * @category schemas
110
+ * @since 0.1.0
111
+ * @slop
112
+ */
113
+ export declare const Entry: Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
114
+ readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
115
+ readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
116
+ }>, Schema.TaggedStruct<"TreeArtifact", {
117
+ readonly path: Schema.NonEmptyString;
118
+ }>]>;
119
+ /** One leaf of a named filegroup.
120
+ * @category models
121
+ * @since 0.1.0
122
+ * @slop
123
+ */
124
+ export type Entry = typeof Entry.Type;
125
+ /** A declaration valid in a read set.
126
+ * @category schemas
127
+ * @since 0.1.0
128
+ * @slop
129
+ */
130
+ export declare const ReadEntry: Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
131
+ readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
132
+ readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
133
+ }>]>;
134
+ /** A declaration valid in a read set.
135
+ * @category models
136
+ * @since 0.1.0
137
+ * @slop
138
+ */
139
+ export type ReadEntry = typeof ReadEntry.Type;
140
+ /** A named reusable collection expanded before measurement.
141
+ * @category schemas
142
+ * @since 0.1.0
143
+ * @slop
144
+ */
145
+ export declare const Filegroup: Schema.TaggedStruct<"Filegroup", {
146
+ readonly name: Schema.NonEmptyString;
147
+ readonly entries: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
148
+ readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
149
+ readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
150
+ }>, Schema.TaggedStruct<"TreeArtifact", {
151
+ readonly path: Schema.NonEmptyString;
152
+ }>]>>;
153
+ }>;
154
+ /** A named reusable collection expanded before measurement.
155
+ * @category models
156
+ * @since 0.1.0
157
+ * @slop
158
+ */
159
+ export type Filegroup = typeof Filegroup.Type;
160
+ /** A named read-only collection.
161
+ * @category schemas
162
+ * @since 0.1.0
163
+ * @slop
164
+ */
165
+ export declare const ReadFilegroup: Schema.TaggedStruct<"Filegroup", {
166
+ readonly name: Schema.NonEmptyString;
167
+ readonly entries: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
168
+ readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
169
+ readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
170
+ }>]>>;
171
+ }>;
172
+ /** A named read-only collection.
173
+ * @category models
174
+ * @since 0.1.0
175
+ * @slop
176
+ */
177
+ export type ReadFilegroup = typeof ReadFilegroup.Type;
178
+ /** Any declaration accepted by a plan effect set.
179
+ * @category schemas
180
+ * @since 0.1.0
181
+ * @slop
182
+ */
183
+ export declare const Declaration: Schema.Union<readonly [Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
184
+ readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
185
+ readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
186
+ }>, Schema.TaggedStruct<"TreeArtifact", {
187
+ readonly path: Schema.NonEmptyString;
188
+ }>]>, Schema.TaggedStruct<"Filegroup", {
189
+ readonly name: Schema.NonEmptyString;
190
+ readonly entries: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
191
+ readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
192
+ readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
193
+ }>, Schema.TaggedStruct<"TreeArtifact", {
194
+ readonly path: Schema.NonEmptyString;
195
+ }>]>>;
196
+ }>]>;
197
+ /** Any declaration accepted by a plan effect set.
198
+ * @category models
199
+ * @since 0.1.0
200
+ * @slop
201
+ */
202
+ export type Declaration = typeof Declaration.Type;
203
+ /** Any declaration accepted by a plan read set.
204
+ * @category schemas
205
+ * @since 0.1.0
206
+ * @slop
207
+ */
208
+ export declare const ReadDeclaration: Schema.Union<readonly [Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
209
+ readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
210
+ readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
211
+ }>]>, Schema.TaggedStruct<"Filegroup", {
212
+ readonly name: Schema.NonEmptyString;
213
+ readonly entries: Schema.$Array<Schema.Union<readonly [Schema.NonEmptyString, Schema.TaggedStruct<"Glob", {
214
+ readonly include: Schema.NonEmptyArray<Schema.NonEmptyString>;
215
+ readonly exclude: Schema.optional<Schema.$Array<Schema.NonEmptyString>>;
216
+ }>]>>;
217
+ }>]>;
218
+ /** Any declaration accepted by a plan read set.
219
+ * @category models
220
+ * @since 0.1.0
221
+ * @slop
222
+ */
223
+ export type ReadDeclaration = typeof ReadDeclaration.Type;
224
+ /** Creates a named filegroup.
225
+ * @category constructors
226
+ * @since 0.1.0
227
+ * @slop
228
+ */
229
+ export declare const makeFilegroup: (name: string, entries: ReadonlyArray<Entry>) => Filegroup;
230
+ /** Expands filegroups deterministically, preserving declaration order.
231
+ * @category accessors
232
+ * @since 0.1.0
233
+ * @slop
234
+ */
235
+ export declare const expand: (declarations: ReadonlyArray<Declaration>) => ReadonlyArray<Entry>;
236
+ /** Expands read filegroups deterministically, preserving declaration order.
237
+ * @category accessors
238
+ * @since 0.1.0
239
+ * @slop
240
+ */
241
+ export declare const expandReads: (declarations: ReadonlyArray<ReadDeclaration>) => ReadonlyArray<ReadEntry>;
242
+ /** Whether a value is a glob declaration.
243
+ * @category guards
244
+ * @since 0.1.0
245
+ * @slop
246
+ */
247
+ export declare const isGlob: (value: unknown) => value is Glob;
248
+ /** Whether a value is a tree artifact declaration.
249
+ * @category guards
250
+ * @since 0.1.0
251
+ * @slop
252
+ */
253
+ export declare const isTreeArtifact: (value: unknown) => value is TreeArtifact;
254
+ /** Tests one workspace-relative path against one Bazel-style pattern.
255
+ * @category predicates
256
+ * @since 0.1.0
257
+ * @slop
258
+ */
259
+ export declare const matchesPattern: (pattern: string, path: string) => boolean;
260
+ /** Tests one file path against a glob, including exclusions.
261
+ * @category predicates
262
+ * @since 0.1.0
263
+ * @slop
264
+ */
265
+ export declare const matchesGlob: (glob: Glob, path: string) => boolean;
266
+ /**
267
+ * Conservative static overlap. `true` may over-serialize; `false` proves that
268
+ * no path can belong to both declarations.
269
+ *
270
+ * A plain string is a literal path, even when it contains `*` or `**`, as it
271
+ * is at execution (sandbox admission, capture, removal, and replay); wildcard
272
+ * matching belongs to a Glob.
273
+ *
274
+ * Exact paths and tree roots compare in their
275
+ * {@link folded} form, so separator aliases, canonically equivalent Unicode
276
+ * spellings, and spellings that differ only in letter case overlap. A Glob
277
+ * against an exact path matches both its `include` and `exclude` patterns in
278
+ * folded form. {@link matchesGlob} itself stays case-sensitive and tests the path bytes it
279
+ * is handed; its property suite pins a backslash inside a path segment as
280
+ * literal text, so canonicalizing a measured path before matching is its
281
+ * caller's decision, not this module's.
282
+ *
283
+ * @category predicates
284
+ * @since 0.1.0
285
+ * @slop
286
+ */
287
+ export declare const overlaps: (left: Entry, right: Entry) => boolean;
288
+ //# sourceMappingURL=FileSet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSet.d.ts","source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