deltafold 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +280 -2
- package/dist/changelog.d.ts +116 -0
- package/dist/changelog.d.ts.map +1 -0
- package/dist/changelog.js +304 -0
- package/dist/changelog.js.map +1 -0
- package/dist/document-BZcZo9nr.js +171 -0
- package/dist/document-BZcZo9nr.js.map +1 -0
- package/dist/document-DWHsgywm.d.ts +257 -0
- package/dist/document-DWHsgywm.d.ts.map +1 -0
- package/dist/html.d.ts +8 -0
- package/dist/html.d.ts.map +1 -0
- package/dist/html.js +13 -0
- package/dist/html.js.map +1 -0
- package/dist/index.d.ts +378 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2058 -0
- package/dist/index.js.map +1 -0
- package/dist/markdown.d.ts +8 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +16 -0
- package/dist/markdown.js.map +1 -0
- package/dist/mdast-DiRsYwPU.js +108 -0
- package/dist/mdast-DiRsYwPU.js.map +1 -0
- package/dist/package-BfBYnaCz.d.ts +1125 -0
- package/dist/package-BfBYnaCz.d.ts.map +1 -0
- package/dist/rolldown-runtime-D8jQpDG7.js +12 -0
- package/package.json +64 -3
- package/src/features/documents/changelog.ts +450 -0
- package/src/features/documents/document.ts +357 -0
- package/src/features/documents/index.ts +4 -0
- package/src/features/documents/public-document.ts +31 -0
- package/src/features/documents/sections.ts +44 -0
- package/src/features/execution/executor.ts +826 -0
- package/src/features/execution/handler.ts +257 -0
- package/src/features/execution/settlement.ts +49 -0
- package/src/features/package.ts +32 -0
- package/src/features/planning/guide.ts +56 -0
- package/src/features/planning/history.ts +174 -0
- package/src/features/planning/identifiers.ts +43 -0
- package/src/features/planning/resolve-error.ts +201 -0
- package/src/features/planning/resolve.ts +724 -0
- package/src/features/planning/rewrite.ts +331 -0
- package/src/features/planning/validate.ts +388 -0
- package/src/foundation/action.ts +188 -0
- package/src/foundation/change.ts +147 -0
- package/src/foundation/instruction.ts +110 -0
- package/src/foundation/migration.ts +236 -0
- package/src/foundation/plan.ts +245 -0
- package/src/foundation/rule.ts +74 -0
- package/src/foundation/shortcut.ts +79 -0
- package/src/foundation/template.ts +28 -0
- package/src/foundation/version.ts +78 -0
- package/src/index.ts +22 -0
- package/src/renderers/html.ts +12 -0
- package/src/renderers/markdown.ts +12 -0
- package/src/renderers/mdast.ts +120 -0
- package/src/types.ts +2 -0
|
@@ -0,0 +1,1125 @@
|
|
|
1
|
+
import { Result } from "effect";
|
|
2
|
+
/** Scalar values that interpolate as text. */
|
|
3
|
+
type Scalar = string | number | boolean | bigint;
|
|
4
|
+
/**
|
|
5
|
+
* Literal prose.
|
|
6
|
+
*
|
|
7
|
+
* @since @next
|
|
8
|
+
*/
|
|
9
|
+
type Text = {
|
|
10
|
+
readonly _tag: "Text";
|
|
11
|
+
readonly text: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Prose content: text and action mentions.
|
|
15
|
+
*
|
|
16
|
+
* @since @next
|
|
17
|
+
*/
|
|
18
|
+
type Prose = ReadonlyArray<Text | Ref>;
|
|
19
|
+
/**
|
|
20
|
+
* Values accepted inside prose templates.
|
|
21
|
+
*
|
|
22
|
+
* @since @next
|
|
23
|
+
*/
|
|
24
|
+
type ProseValue = Scalar | Ref;
|
|
25
|
+
/**
|
|
26
|
+
* Prose associated with exactly one action occurrence. The block declares that
|
|
27
|
+
* occurrence; when optimization removes the action, the block leaves the resolved guide
|
|
28
|
+
* with it.
|
|
29
|
+
*
|
|
30
|
+
* @since @next
|
|
31
|
+
*/
|
|
32
|
+
type Instruction<A extends Any$6 = Any$6> = {
|
|
33
|
+
readonly _tag: "Instruction";
|
|
34
|
+
readonly action: A;
|
|
35
|
+
readonly content: Prose;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Associates prose with one action occurrence.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* Migration.instruction(renameTimeout)`
|
|
43
|
+
* Rename the timeout option, keeping its existing value.
|
|
44
|
+
* `;
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @since @next
|
|
48
|
+
*/
|
|
49
|
+
declare const instruction: <A extends Any$6>(action: A) => (strings: TemplateStringsArray, ...values: ReadonlyArray<ProseValue>) => Instruction<A>;
|
|
50
|
+
declare namespace action_d_exports {
|
|
51
|
+
export { Action, ActionsOf$5 as ActionsOf, Any$6 as Any, Concurrency, Kind, Parallel$1 as Parallel, Ref, Sequence$1 as Sequence, Step$1 as Step, define$1 as define, isAction, isParallel, isRef, isSequence, parallel, ref, sequence };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Describes one kind of consumer-owned operation and its payload.
|
|
55
|
+
*
|
|
56
|
+
* @since @next
|
|
57
|
+
*/
|
|
58
|
+
type Kind<P> = {
|
|
59
|
+
readonly _tag: "ActionKind";
|
|
60
|
+
readonly kind: string;
|
|
61
|
+
readonly describe: (payload: P) => string;
|
|
62
|
+
/** Creates an action instance with a stable identifier. */
|
|
63
|
+
readonly make: <const Id extends string>(id: Id, payload: P) => Action<Id, P>;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* One concrete instruction. Its `id` identifies the instruction across plans, handler
|
|
67
|
+
* bindings, rules, and reports.
|
|
68
|
+
*
|
|
69
|
+
* @since @next
|
|
70
|
+
*/
|
|
71
|
+
type Action<Id extends string = string, P = unknown> = {
|
|
72
|
+
readonly _tag: "Action";
|
|
73
|
+
readonly id: Id;
|
|
74
|
+
readonly kind: string;
|
|
75
|
+
readonly payload: P;
|
|
76
|
+
/** The description produced by the kind's `describe` function. */
|
|
77
|
+
readonly description: string;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Any action instance.
|
|
81
|
+
*
|
|
82
|
+
* @since @next
|
|
83
|
+
*/
|
|
84
|
+
type Any$6 = Action<string, any>;
|
|
85
|
+
/**
|
|
86
|
+
* A mention of an action in prose. It does not declare an occurrence.
|
|
87
|
+
*
|
|
88
|
+
* @since @next
|
|
89
|
+
*/
|
|
90
|
+
type Ref = {
|
|
91
|
+
readonly _tag: "ActionRef";
|
|
92
|
+
readonly action: Any$6;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Children run one after another.
|
|
96
|
+
*
|
|
97
|
+
* @since @next
|
|
98
|
+
*/
|
|
99
|
+
type Sequence$1<A extends Any$6 = Any$6> = {
|
|
100
|
+
readonly _tag: "Sequence";
|
|
101
|
+
readonly children: ReadonlyArray<Step$1>;
|
|
102
|
+
/** Type-level record of the action instances in `children`. */
|
|
103
|
+
readonly "~actions"?: A;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* How many branches of a parallel group may run at the same time.
|
|
107
|
+
*
|
|
108
|
+
* @since @next
|
|
109
|
+
*/
|
|
110
|
+
type Concurrency = number | "unbounded";
|
|
111
|
+
/**
|
|
112
|
+
* Branches are independent of each other and may run concurrently. The group asserts
|
|
113
|
+
* that independence; the concurrency limit only controls scheduling.
|
|
114
|
+
*
|
|
115
|
+
* @since @next
|
|
116
|
+
*/
|
|
117
|
+
type Parallel$1<A extends Any$6 = Any$6> = {
|
|
118
|
+
readonly _tag: "Parallel";
|
|
119
|
+
readonly branches: ReadonlyArray<Step$1>;
|
|
120
|
+
readonly concurrency: Concurrency;
|
|
121
|
+
/** Type-level record of the action instances in `branches`. */
|
|
122
|
+
readonly "~actions"?: A;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* A node that declares action occurrences.
|
|
126
|
+
*
|
|
127
|
+
* @since @next
|
|
128
|
+
*/
|
|
129
|
+
type Step$1<A extends Any$6 = Any$6> = A | Instruction<A> | Sequence$1<A> | Parallel$1<A>;
|
|
130
|
+
/**
|
|
131
|
+
* Extracts the action instances declared by a step.
|
|
132
|
+
*
|
|
133
|
+
* @since @next
|
|
134
|
+
*/
|
|
135
|
+
type ActionsOf$5<S> = S extends Action<infer Id, infer P> ? Action<Id, P> : S extends Instruction<infer A> ? A : S extends Sequence$1<infer A> ? A : S extends Parallel$1<infer A> ? A : never;
|
|
136
|
+
/**
|
|
137
|
+
* Defines an action kind.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* const RenameKey = Action.define<{ target: string; from: string; to: string }>(
|
|
142
|
+
* "config.rename",
|
|
143
|
+
* { describe: ({ target, from, to }) => `In ${target}, rename "${from}" to "${to}"` },
|
|
144
|
+
* );
|
|
145
|
+
* const renameExportA = RenameKey.make("rename-export-a-timeout", {
|
|
146
|
+
* target: "export-a",
|
|
147
|
+
* from: "timeout",
|
|
148
|
+
* to: "requestTimeout",
|
|
149
|
+
* });
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* @since @next
|
|
153
|
+
*/
|
|
154
|
+
declare const define$1: <P>(kind: string, options?: {
|
|
155
|
+
readonly describe?: (payload: P) => string;
|
|
156
|
+
}) => Kind<P>;
|
|
157
|
+
/**
|
|
158
|
+
* Mentions an action in prose without declaring another occurrence.
|
|
159
|
+
*
|
|
160
|
+
* @since @next
|
|
161
|
+
*/
|
|
162
|
+
declare const ref: (action: Any$6) => Ref;
|
|
163
|
+
/**
|
|
164
|
+
* Declares steps that run one after another.
|
|
165
|
+
*
|
|
166
|
+
* @since @next
|
|
167
|
+
*/
|
|
168
|
+
declare const sequence: <const S extends ReadonlyArray<Step$1>>(children: S) => Sequence$1<ActionsOf$5<S[number]>>;
|
|
169
|
+
/**
|
|
170
|
+
* Declares independent branches that may run concurrently. Each branch can be a single
|
|
171
|
+
* step or a sequence.
|
|
172
|
+
*
|
|
173
|
+
* @since @next
|
|
174
|
+
*/
|
|
175
|
+
declare const parallel: <const S extends ReadonlyArray<Step$1>>(branches: S, options?: {
|
|
176
|
+
readonly concurrency?: Concurrency;
|
|
177
|
+
}) => Parallel$1<ActionsOf$5<S[number]>>;
|
|
178
|
+
/** @since @next */
|
|
179
|
+
declare const isAction: (value: unknown) => value is Any$6;
|
|
180
|
+
/** @since @next */
|
|
181
|
+
declare const isRef: (value: unknown) => value is Ref;
|
|
182
|
+
/** @since @next */
|
|
183
|
+
declare const isSequence: (value: unknown) => value is Sequence$1;
|
|
184
|
+
/** @since @next */
|
|
185
|
+
declare const isParallel: (value: unknown) => value is Parallel$1;
|
|
186
|
+
declare namespace change_d_exports {
|
|
187
|
+
export { Any$5 as Any, Change, Definition, Describe, Metadata, NoMetadata, Relations, define, isChange, make$5 as make };
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The metadata of a change whose shape is not known statically.
|
|
191
|
+
*
|
|
192
|
+
* @since @next
|
|
193
|
+
*/
|
|
194
|
+
type Metadata = {
|
|
195
|
+
readonly [field: string]: unknown;
|
|
196
|
+
};
|
|
197
|
+
/** @since @next */
|
|
198
|
+
type NoMetadata = {
|
|
199
|
+
readonly [field: string]: undefined;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* A human-readable record of one logical change. A change can exist before it is
|
|
203
|
+
* assigned to a release, and it does not need an executable migration.
|
|
204
|
+
*
|
|
205
|
+
* deltafold does not interpret `metadata`. Consumers choose its fields, such as a
|
|
206
|
+
* classification or a breaking flag, and what they mean.
|
|
207
|
+
*
|
|
208
|
+
* @since @next
|
|
209
|
+
*/
|
|
210
|
+
type Change<M extends object = Metadata> = {
|
|
211
|
+
readonly _tag: "Change";
|
|
212
|
+
/** Stable identifier. Editing the description does not change identity. */
|
|
213
|
+
readonly id: string;
|
|
214
|
+
readonly metadata: M;
|
|
215
|
+
readonly description: string;
|
|
216
|
+
/** Historical relationship only: it does not cancel actions or create routes. */
|
|
217
|
+
readonly reverts: ReadonlyArray<Any$5>;
|
|
218
|
+
/** The change that an adapted backport was derived from. */
|
|
219
|
+
readonly backportOf: Any$5 | undefined;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* A change whose metadata type is not known statically. Its metadata is an object, so
|
|
223
|
+
* reading a field requires narrowing first.
|
|
224
|
+
*
|
|
225
|
+
* @since @next
|
|
226
|
+
*/
|
|
227
|
+
type Any$5 = Change<object>;
|
|
228
|
+
/**
|
|
229
|
+
* Relationships to other changes.
|
|
230
|
+
*
|
|
231
|
+
* @since @next
|
|
232
|
+
*/
|
|
233
|
+
type Relations = {
|
|
234
|
+
readonly reverts?: ReadonlyArray<Any$5>;
|
|
235
|
+
readonly backportOf?: Any$5;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Takes the description as a tagged template and returns the change.
|
|
239
|
+
*
|
|
240
|
+
* @since @next
|
|
241
|
+
*/
|
|
242
|
+
type Describe<M extends object> = (strings: TemplateStringsArray, ...values: ReadonlyArray<Scalar>) => Change<M>;
|
|
243
|
+
/**
|
|
244
|
+
* Declares a change. The tagged template is its description. Metadata is optional, and
|
|
245
|
+
* its type is inferred from the value, literals included.
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```ts
|
|
249
|
+
* const retriesAdded = Change.make("2026-11-20.add-retries")`
|
|
250
|
+
* Add a retry limit option.
|
|
251
|
+
* `;
|
|
252
|
+
* const timeoutRenamed = Change.make("2026-11-06.rename-timeout", { breaking: true })`
|
|
253
|
+
* Rename the timeout configuration option to requestTimeout.
|
|
254
|
+
* `;
|
|
255
|
+
* ```
|
|
256
|
+
*
|
|
257
|
+
* @since @next
|
|
258
|
+
*/
|
|
259
|
+
declare function make$5(id: string): Describe<NoMetadata>;
|
|
260
|
+
declare function make$5<const M extends object>(id: string, metadata: M, relations?: Relations): Describe<M>;
|
|
261
|
+
/**
|
|
262
|
+
* Makes changes that share one metadata shape.
|
|
263
|
+
*
|
|
264
|
+
* @since @next
|
|
265
|
+
*/
|
|
266
|
+
type Definition<M extends object> = {
|
|
267
|
+
readonly make: (id: string, metadata: M, relations?: Relations) => Describe<M>;
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* Defines a reusable change factory whose metadata must have the type `M`.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```ts
|
|
274
|
+
* const ConfigChange = Change.define<{
|
|
275
|
+
* readonly kind: "added" | "changed" | "fixed";
|
|
276
|
+
* readonly breaking: boolean;
|
|
277
|
+
* }>();
|
|
278
|
+
* const timeoutRenamed = ConfigChange.make("2026-11-06.rename-timeout", {
|
|
279
|
+
* kind: "changed",
|
|
280
|
+
* breaking: true,
|
|
281
|
+
* })`
|
|
282
|
+
* Rename the timeout configuration option to requestTimeout.
|
|
283
|
+
* `;
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* @since @next
|
|
287
|
+
*/
|
|
288
|
+
declare const define: <M extends object>() => Definition<M>;
|
|
289
|
+
/** @since @next */
|
|
290
|
+
declare const isChange: (value: unknown) => value is Change;
|
|
291
|
+
declare namespace version_d_exports {
|
|
292
|
+
export { Options$1 as Options, Release, Version, isVersion, make$4 as make, withMetadata };
|
|
293
|
+
}
|
|
294
|
+
/** @since @next */
|
|
295
|
+
type Version<C extends Any$5 = Any$5> = {
|
|
296
|
+
readonly _tag: "Version";
|
|
297
|
+
readonly id: string;
|
|
298
|
+
/**
|
|
299
|
+
* The release this version descends from. Absent for a root such as `0.0.0`. Only
|
|
300
|
+
* this field sets ancestry: several versions can share a predecessor, and declaration
|
|
301
|
+
* order and semver order have no effect.
|
|
302
|
+
*/
|
|
303
|
+
readonly previous: Version | undefined;
|
|
304
|
+
/** The changes that shipped in this release. */
|
|
305
|
+
readonly changes: ReadonlyArray<C>;
|
|
306
|
+
};
|
|
307
|
+
/** @since @next */
|
|
308
|
+
type Options$1<C extends Any$5 = Any$5> = {
|
|
309
|
+
readonly previous?: Version;
|
|
310
|
+
readonly changes: ReadonlyArray<C>;
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* Declares a version.
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* ```ts
|
|
317
|
+
* const v0 = Version.make("0.0.0", { changes: [] });
|
|
318
|
+
* const v100 = Version.make("1.0.0", { previous: v0, changes: [timeoutRenamed] });
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
321
|
+
* @since @next
|
|
322
|
+
*/
|
|
323
|
+
declare const make$4: <C extends Any$5 = never>(id: string, options: Options$1<C>) => Version<C>;
|
|
324
|
+
/** @since @next */
|
|
325
|
+
declare const isVersion: (value: unknown) => value is Version;
|
|
326
|
+
/**
|
|
327
|
+
* Release metadata attached to a version by release tooling. It does not modify the
|
|
328
|
+
* version registered in history.
|
|
329
|
+
*
|
|
330
|
+
* @since @next
|
|
331
|
+
*/
|
|
332
|
+
type Release<M> = {
|
|
333
|
+
readonly _tag: "Release";
|
|
334
|
+
readonly version: Version;
|
|
335
|
+
readonly metadata: M;
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
* Annotates a version with release metadata.
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* ```ts
|
|
342
|
+
* export const release200 = Version.withMetadata(v200, {
|
|
343
|
+
* releasedAt: "2026-11-06T12:00:00Z",
|
|
344
|
+
* commit: "abc123",
|
|
345
|
+
* });
|
|
346
|
+
* ```
|
|
347
|
+
*
|
|
348
|
+
* @since @next
|
|
349
|
+
*/
|
|
350
|
+
declare const withMetadata: <const M>(version: Version, metadata: M) => Release<M>;
|
|
351
|
+
declare namespace migration_d_exports {
|
|
352
|
+
export { ActionsOf$4 as ActionsOf, Any$4 as Any, ChangesOf$2 as ChangesOf, Content, Instruction, Interpolation, Migration, NoopOptions, Options, Prose, ProseValue, Text, instruction, isMigration, make$3 as make, noop, withRevert };
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Prose, mentions, and occurrence-declaring steps in template order.
|
|
356
|
+
*
|
|
357
|
+
* @since @next
|
|
358
|
+
*/
|
|
359
|
+
type Content<A extends Any$6 = Any$6> = ReadonlyArray<Text | Ref | Step$1<A>>;
|
|
360
|
+
/**
|
|
361
|
+
* Values accepted in migration templates.
|
|
362
|
+
*
|
|
363
|
+
* @since @next
|
|
364
|
+
*/
|
|
365
|
+
type Interpolation = Scalar | Ref | Step$1;
|
|
366
|
+
/** @since @next */
|
|
367
|
+
type Migration<A extends Any$6 = Any$6, C extends Any$5 = Any$5> = {
|
|
368
|
+
readonly _tag: "Migration";
|
|
369
|
+
readonly id: string;
|
|
370
|
+
readonly from: Version;
|
|
371
|
+
readonly to: Version;
|
|
372
|
+
/** The logical changes this transition handles. */
|
|
373
|
+
readonly addresses: ReadonlyArray<C>;
|
|
374
|
+
/** Whether this is an explicit zero-work transition. */
|
|
375
|
+
readonly noop: boolean;
|
|
376
|
+
/** Author-declared cost, used only by the `lowest-cost` route policy. */
|
|
377
|
+
readonly cost: number | undefined;
|
|
378
|
+
readonly content: Content;
|
|
379
|
+
/** The reverse transition, from `to` back to `from`. Absent means no reverse edge. */
|
|
380
|
+
readonly revert: Content | undefined;
|
|
381
|
+
/** Type-level record of the action instances in `content` and `revert`. */
|
|
382
|
+
readonly "~actions"?: A;
|
|
383
|
+
};
|
|
384
|
+
/**
|
|
385
|
+
* Any migration.
|
|
386
|
+
*
|
|
387
|
+
* @since @next
|
|
388
|
+
*/
|
|
389
|
+
type Any$4 = Migration<any>;
|
|
390
|
+
/**
|
|
391
|
+
* The action instances a migration can contribute to a plan.
|
|
392
|
+
*
|
|
393
|
+
* @since @next
|
|
394
|
+
*/
|
|
395
|
+
type ActionsOf$4<M> = M extends Migration<infer A> ? A : never;
|
|
396
|
+
/**
|
|
397
|
+
* The changes a migration addresses.
|
|
398
|
+
*
|
|
399
|
+
* @since @next
|
|
400
|
+
*/
|
|
401
|
+
type ChangesOf$2<M> = M extends Migration<any, infer C> ? C : never;
|
|
402
|
+
/** @since @next */
|
|
403
|
+
type Options<C extends Any$5 = Any$5> = {
|
|
404
|
+
readonly from: Version;
|
|
405
|
+
readonly to: Version;
|
|
406
|
+
readonly addresses?: ReadonlyArray<C>;
|
|
407
|
+
readonly cost?: number;
|
|
408
|
+
};
|
|
409
|
+
/** @since @next */
|
|
410
|
+
declare const isMigration: (value: unknown) => value is Any$4;
|
|
411
|
+
/**
|
|
412
|
+
* Declares a migration between exact versions. Interpolated actions, instruction blocks,
|
|
413
|
+
* and groups declare occurrences; `Action.ref` only mentions an action.
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```ts
|
|
417
|
+
* const migrate152To200 = Migration.make("1.5.2-to-2.0.0", {
|
|
418
|
+
* from: v152,
|
|
419
|
+
* to: v200,
|
|
420
|
+
* addresses: [timeoutRenamed],
|
|
421
|
+
* })`
|
|
422
|
+
* Update the configuration for export A:
|
|
423
|
+
*
|
|
424
|
+
* ${renameExportA}
|
|
425
|
+
* `;
|
|
426
|
+
* ```
|
|
427
|
+
*
|
|
428
|
+
* @since @next
|
|
429
|
+
*/
|
|
430
|
+
declare const make$3: <C extends Any$5 = never>(id: string, options: Options<C>) => <const V extends ReadonlyArray<Interpolation>>(strings: TemplateStringsArray, ...values: V) => Migration<ActionsOf$5<V[number]>, C>;
|
|
431
|
+
/** @since @next */
|
|
432
|
+
type NoopOptions<C extends Any$5 = Any$5> = Options<C> & {
|
|
433
|
+
/** Also declares the reverse transition as zero-work. */
|
|
434
|
+
readonly reversible?: boolean;
|
|
435
|
+
};
|
|
436
|
+
/**
|
|
437
|
+
* Declares a supported transition that requires no consumer work. It is a directed edge
|
|
438
|
+
* like any migration. Do not use it to hide missing support for changes that need
|
|
439
|
+
* instructions.
|
|
440
|
+
*
|
|
441
|
+
* @since @next
|
|
442
|
+
*/
|
|
443
|
+
declare const noop: <C extends Any$5 = never>(id: string, options: NoopOptions<C>) => Migration<never, C>;
|
|
444
|
+
/**
|
|
445
|
+
* Adds a reverse transition. Register the returned migration in place of the original:
|
|
446
|
+
* both share the same identifier. On a `Migration.noop`, the reverse is real work: only
|
|
447
|
+
* the forward side stays zero-work.
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* ```ts
|
|
451
|
+
* const reversible = Migration.withRevert(migrate152To200)`
|
|
452
|
+
* Restore the previous configuration:
|
|
453
|
+
*
|
|
454
|
+
* ${restoreTimeout}
|
|
455
|
+
* `;
|
|
456
|
+
* ```
|
|
457
|
+
*
|
|
458
|
+
* @since @next
|
|
459
|
+
*/
|
|
460
|
+
declare const withRevert: <A extends Any$6, C extends Any$5>(migration: Migration<A, C>) => <const V extends ReadonlyArray<Interpolation>>(strings: TemplateStringsArray, ...values: V) => Migration<A | ActionsOf$5<V[number]>, C>;
|
|
461
|
+
declare namespace rule_d_exports {
|
|
462
|
+
export { ActionsOf$3 as ActionsOf, Any$3 as Any, Pattern, Rule, isRule, replace };
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* What a rule matches: an action instance, or a parallel group matched by its branch
|
|
466
|
+
* structure. Matching a parallel group is an explicit structural rule.
|
|
467
|
+
*
|
|
468
|
+
* @since @next
|
|
469
|
+
*/
|
|
470
|
+
type Pattern = Any$6 | Parallel$1;
|
|
471
|
+
/** @since @next */
|
|
472
|
+
type Rule<A extends Any$6 = Any$6> = {
|
|
473
|
+
readonly _tag: "Rule";
|
|
474
|
+
readonly id: string;
|
|
475
|
+
readonly match: ReadonlyArray<Pattern>;
|
|
476
|
+
/** Steps that take the place of the match. An empty replacement cancels it. */
|
|
477
|
+
readonly replacement: ReadonlyArray<Step$1<A>>;
|
|
478
|
+
};
|
|
479
|
+
/**
|
|
480
|
+
* Any rule.
|
|
481
|
+
*
|
|
482
|
+
* @since @next
|
|
483
|
+
*/
|
|
484
|
+
type Any$3 = Rule<any>;
|
|
485
|
+
/**
|
|
486
|
+
* The action instances a rule can contribute to a plan.
|
|
487
|
+
*
|
|
488
|
+
* @since @next
|
|
489
|
+
*/
|
|
490
|
+
type ActionsOf$3<R> = R extends Rule<infer A> ? A : never;
|
|
491
|
+
/**
|
|
492
|
+
* Declares a replacement. Cancellation, composition, and supersession all use it.
|
|
493
|
+
*
|
|
494
|
+
* The author asserts that the replacement is equivalent to the matched occurrences.
|
|
495
|
+
* deltafold checks the rule's structure and where it applies, but it cannot prove the
|
|
496
|
+
* equivalence.
|
|
497
|
+
*
|
|
498
|
+
* Ordinary rules match consecutive occurrences inside one sequential branch, including
|
|
499
|
+
* across migration boundaries of a route. They never match across parallel branches.
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* ```ts
|
|
503
|
+
* const cancelRoundTrip = Rule.replace("cancel-timeout-round-trip", {
|
|
504
|
+
* match: [renameTimeout, restoreTimeout],
|
|
505
|
+
* replacement: [],
|
|
506
|
+
* });
|
|
507
|
+
* const combineRenames = Rule.replace("combine-renames", {
|
|
508
|
+
* match: [renameAtoB, renameBtoC],
|
|
509
|
+
* replacement: [renameAtoC],
|
|
510
|
+
* });
|
|
511
|
+
* ```
|
|
512
|
+
*
|
|
513
|
+
* @since @next
|
|
514
|
+
*/
|
|
515
|
+
declare const replace: <A extends Any$6 = never>(id: string, options: {
|
|
516
|
+
readonly match: ReadonlyArray<Pattern>;
|
|
517
|
+
readonly replacement: ReadonlyArray<Step$1<A>>;
|
|
518
|
+
}) => Rule<A>;
|
|
519
|
+
/** @since @next */
|
|
520
|
+
declare const isRule: (value: unknown) => value is Any$3;
|
|
521
|
+
declare namespace shortcut_d_exports {
|
|
522
|
+
export { ActionsOf$2 as ActionsOf, Any$2 as Any, ChangesOf$1 as ChangesOf, Shortcut, isShortcut, make$2 as make };
|
|
523
|
+
}
|
|
524
|
+
/** @since @next */
|
|
525
|
+
type Shortcut<A extends Any$6 = Any$6, C extends Any$5 = Any$5> = {
|
|
526
|
+
readonly _tag: "Shortcut";
|
|
527
|
+
readonly id: string;
|
|
528
|
+
readonly from: Version;
|
|
529
|
+
readonly to: Version;
|
|
530
|
+
/** The canonical route this shortcut replaces, in order. */
|
|
531
|
+
readonly replaces: ReadonlyArray<Any$4>;
|
|
532
|
+
/** The migrations that run instead, in order. */
|
|
533
|
+
readonly migrations: ReadonlyArray<Migration<A, C>>;
|
|
534
|
+
/** Author-declared cost, used only by the `lowest-cost` route policy. */
|
|
535
|
+
readonly cost: number | undefined;
|
|
536
|
+
};
|
|
537
|
+
/**
|
|
538
|
+
* Any shortcut.
|
|
539
|
+
*
|
|
540
|
+
* @since @next
|
|
541
|
+
*/
|
|
542
|
+
type Any$2 = Shortcut<any>;
|
|
543
|
+
/**
|
|
544
|
+
* The action instances a shortcut can contribute to a plan.
|
|
545
|
+
*
|
|
546
|
+
* @since @next
|
|
547
|
+
*/
|
|
548
|
+
type ActionsOf$2<S> = S extends Shortcut<infer A> ? A : never;
|
|
549
|
+
/**
|
|
550
|
+
* The changes addressed by a shortcut's migrations.
|
|
551
|
+
*
|
|
552
|
+
* @since @next
|
|
553
|
+
*/
|
|
554
|
+
type ChangesOf$1<S> = S extends Shortcut<any, infer C> ? C : never;
|
|
555
|
+
/**
|
|
556
|
+
* Declares a shortcut. The author asserts that its migrations are equivalent to the
|
|
557
|
+
* canonical route it replaces; deltafold does not prove it.
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* ```ts
|
|
561
|
+
* const fastUpgrade = Shortcut.make("fast-upgrade", {
|
|
562
|
+
* from: v201,
|
|
563
|
+
* to: v208,
|
|
564
|
+
* replaces: [migrate202, migrate203, migrate204],
|
|
565
|
+
* migrations: [migrateDirectlyTo208],
|
|
566
|
+
* });
|
|
567
|
+
* ```
|
|
568
|
+
*
|
|
569
|
+
* @since @next
|
|
570
|
+
*/
|
|
571
|
+
declare const make$2: <A extends Any$6, C extends Any$5 = never>(id: string, options: {
|
|
572
|
+
readonly from: Version;
|
|
573
|
+
readonly to: Version;
|
|
574
|
+
readonly replaces: ReadonlyArray<Any$4>;
|
|
575
|
+
readonly migrations: ReadonlyArray<Migration<A, C>>;
|
|
576
|
+
readonly cost?: number;
|
|
577
|
+
}) => Shortcut<A, C>;
|
|
578
|
+
/** @since @next */
|
|
579
|
+
declare const isShortcut: (value: unknown) => value is Any$2;
|
|
580
|
+
declare namespace plan_d_exports {
|
|
581
|
+
export { ActionsOf$1 as ActionsOf, Any$1 as Any, Coverage, Direction, Explanation, GuideItem, Hop, Node, Occurrence, Origin, Parallel, Plan, RequestDirection, Route, Sequence, Step, isEmpty, withRuntimeCoverage };
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Which side of a migration runs.
|
|
585
|
+
*
|
|
586
|
+
* @since @next
|
|
587
|
+
*/
|
|
588
|
+
type Direction = "forward" | "revert";
|
|
589
|
+
/**
|
|
590
|
+
* How an occurrence entered the plan.
|
|
591
|
+
*
|
|
592
|
+
* @since @next
|
|
593
|
+
*/
|
|
594
|
+
type Origin = {
|
|
595
|
+
readonly _tag: "Declared";
|
|
596
|
+
} | {
|
|
597
|
+
readonly _tag: "Replacement";
|
|
598
|
+
readonly rule: Any$3;
|
|
599
|
+
/** The occurrences the rule replaced, in order. */
|
|
600
|
+
readonly replaces: ReadonlyArray<Occurrence>;
|
|
601
|
+
};
|
|
602
|
+
/**
|
|
603
|
+
* One execution of an action instance in a plan. Its `id` is stable across prose edits:
|
|
604
|
+
* it combines the migration, direction, and action identifiers, or the rule and the
|
|
605
|
+
* replaced occurrences for a replacement.
|
|
606
|
+
*
|
|
607
|
+
* @since @next
|
|
608
|
+
*/
|
|
609
|
+
type Occurrence<A extends Any$6 = Any$6> = {
|
|
610
|
+
readonly _tag: "Occurrence";
|
|
611
|
+
/**
|
|
612
|
+
* Unique within the plan. Built from the migration, direction, and action identifiers,
|
|
613
|
+
* or from the rule and the replaced occurrences. Separator characters in author
|
|
614
|
+
* identifiers are escaped with a backslash, so identifiers never collide.
|
|
615
|
+
*/
|
|
616
|
+
readonly id: string;
|
|
617
|
+
readonly action: A;
|
|
618
|
+
/** The migration whose step contains this occurrence. */
|
|
619
|
+
readonly migration: Any$4;
|
|
620
|
+
readonly direction: Direction;
|
|
621
|
+
/** The instruction block that declared this occurrence, if any. */
|
|
622
|
+
readonly instruction: Instruction | undefined;
|
|
623
|
+
readonly origin: Origin;
|
|
624
|
+
};
|
|
625
|
+
/** @since @next */
|
|
626
|
+
type Sequence<A extends Any$6 = Any$6> = {
|
|
627
|
+
readonly _tag: "Sequence";
|
|
628
|
+
readonly children: ReadonlyArray<Node<A>>;
|
|
629
|
+
};
|
|
630
|
+
/** @since @next */
|
|
631
|
+
type Parallel<A extends Any$6 = Any$6> = {
|
|
632
|
+
readonly _tag: "Parallel";
|
|
633
|
+
readonly branches: ReadonlyArray<Node<A>>;
|
|
634
|
+
readonly concurrency: Concurrency;
|
|
635
|
+
};
|
|
636
|
+
/**
|
|
637
|
+
* The declared execution structure.
|
|
638
|
+
*
|
|
639
|
+
* @since @next
|
|
640
|
+
*/
|
|
641
|
+
type Node<A extends Any$6 = Any$6> = Occurrence<A> | Sequence<A> | Parallel<A>;
|
|
642
|
+
/**
|
|
643
|
+
* Resolved prose for a guide. Occurrences render as their instruction or description.
|
|
644
|
+
*
|
|
645
|
+
* @since @next
|
|
646
|
+
*/
|
|
647
|
+
type GuideItem<A extends Any$6 = Any$6> = Text | Ref | {
|
|
648
|
+
readonly _tag: "Occurrence";
|
|
649
|
+
readonly occurrence: Occurrence<A>;
|
|
650
|
+
} | {
|
|
651
|
+
readonly _tag: "Group";
|
|
652
|
+
readonly kind: "Sequence" | "Parallel";
|
|
653
|
+
/** One entry per retained child or branch. */
|
|
654
|
+
readonly children: ReadonlyArray<ReadonlyArray<GuideItem<A>>>;
|
|
655
|
+
};
|
|
656
|
+
/**
|
|
657
|
+
* One migration in the route. Steps are sequential barriers: a step starts only after
|
|
658
|
+
* the previous step completed.
|
|
659
|
+
*
|
|
660
|
+
* @since @next
|
|
661
|
+
*/
|
|
662
|
+
type Step<A extends Any$6 = Any$6> = {
|
|
663
|
+
readonly _tag: "Step";
|
|
664
|
+
readonly migration: Any$4;
|
|
665
|
+
readonly direction: Direction;
|
|
666
|
+
readonly from: Version;
|
|
667
|
+
readonly to: Version;
|
|
668
|
+
readonly node: Sequence<A>;
|
|
669
|
+
/** Resolved guide content. Empty when the step is omitted from the guide. */
|
|
670
|
+
readonly guide: ReadonlyArray<GuideItem<A>>;
|
|
671
|
+
/**
|
|
672
|
+
* Whether the normal resolved guide leaves this step out: a noop, or a migration whose
|
|
673
|
+
* actions were all removed by rules.
|
|
674
|
+
*/
|
|
675
|
+
readonly omitted: boolean;
|
|
676
|
+
};
|
|
677
|
+
/**
|
|
678
|
+
* Why the plan differs from the declared migrations.
|
|
679
|
+
*
|
|
680
|
+
* @since @next
|
|
681
|
+
*/
|
|
682
|
+
type Explanation = {
|
|
683
|
+
readonly _tag: "Rewrite";
|
|
684
|
+
readonly rule: Any$3;
|
|
685
|
+
readonly removed: ReadonlyArray<Occurrence>;
|
|
686
|
+
readonly produced: ReadonlyArray<Occurrence>;
|
|
687
|
+
} | {
|
|
688
|
+
readonly _tag: "OmittedStep";
|
|
689
|
+
readonly migration: Any$4;
|
|
690
|
+
readonly direction: Direction;
|
|
691
|
+
readonly reason: "noop" | "all-actions-removed";
|
|
692
|
+
};
|
|
693
|
+
/**
|
|
694
|
+
* A hop in a route: the migrations between two versions, or a shortcut.
|
|
695
|
+
*
|
|
696
|
+
* @since @next
|
|
697
|
+
*/
|
|
698
|
+
type Hop = {
|
|
699
|
+
readonly _tag: "Migrations";
|
|
700
|
+
readonly from: Version;
|
|
701
|
+
readonly to: Version;
|
|
702
|
+
/**
|
|
703
|
+
* The migration side that moves between these versions. Validation allows one
|
|
704
|
+
* side per transition, so this holds exactly one entry.
|
|
705
|
+
*/
|
|
706
|
+
readonly migrations: ReadonlyArray<{
|
|
707
|
+
readonly migration: Any$4;
|
|
708
|
+
readonly direction: Direction;
|
|
709
|
+
}>;
|
|
710
|
+
} | {
|
|
711
|
+
readonly _tag: "Shortcut";
|
|
712
|
+
readonly from: Version;
|
|
713
|
+
readonly to: Version;
|
|
714
|
+
readonly shortcut: Any$2;
|
|
715
|
+
};
|
|
716
|
+
/** @since @next */
|
|
717
|
+
type Route = {
|
|
718
|
+
/**
|
|
719
|
+
* Identifies the route for explicit selection: version identifiers joined by `>`,
|
|
720
|
+
* with shortcut hops written as `[shortcut-id]`. A backslash escapes `\`, `>`, `[`,
|
|
721
|
+
* and `]` inside identifiers, so a version `a>b` appears as `a\>b`.
|
|
722
|
+
*/
|
|
723
|
+
readonly id: string;
|
|
724
|
+
readonly hops: ReadonlyArray<Hop>;
|
|
725
|
+
};
|
|
726
|
+
/**
|
|
727
|
+
* How the requested target relates to the source in release ancestry.
|
|
728
|
+
*
|
|
729
|
+
* @since @next
|
|
730
|
+
*/
|
|
731
|
+
type RequestDirection = "none" | "upgrade" | "downgrade" | "cross-branch";
|
|
732
|
+
/**
|
|
733
|
+
* When executors check handler coverage. Static plans also expose uncovered actions in
|
|
734
|
+
* the execution's type.
|
|
735
|
+
*
|
|
736
|
+
* @since @next
|
|
737
|
+
*/
|
|
738
|
+
type Coverage = "static" | "runtime";
|
|
739
|
+
/**
|
|
740
|
+
* A resolved, optimized route between two versions. Every step stays traceable to its
|
|
741
|
+
* migration and the changes that migration addresses.
|
|
742
|
+
*
|
|
743
|
+
* @since @next
|
|
744
|
+
*/
|
|
745
|
+
type Plan<A extends Any$6 = Any$6, C extends Coverage = "static", Ch extends Any$5 = Any$5> = {
|
|
746
|
+
readonly _tag: "Plan";
|
|
747
|
+
readonly from: Version;
|
|
748
|
+
readonly to: Version;
|
|
749
|
+
readonly direction: RequestDirection;
|
|
750
|
+
readonly route: Route;
|
|
751
|
+
readonly steps: ReadonlyArray<Step<A>>;
|
|
752
|
+
/** Occurrences in plan order. */
|
|
753
|
+
readonly occurrences: ReadonlyArray<Occurrence<A>>;
|
|
754
|
+
/** The changes addressed by the route's migrations. */
|
|
755
|
+
readonly changes: ReadonlyArray<Ch>;
|
|
756
|
+
readonly explanations: ReadonlyArray<Explanation>;
|
|
757
|
+
/**
|
|
758
|
+
* Whether executors check handler coverage only at run time. Plans resolved from a
|
|
759
|
+
* history are checked statically against its conservative action union.
|
|
760
|
+
*/
|
|
761
|
+
readonly coverage: C;
|
|
762
|
+
};
|
|
763
|
+
/**
|
|
764
|
+
* Any plan.
|
|
765
|
+
*
|
|
766
|
+
* @since @next
|
|
767
|
+
*/
|
|
768
|
+
type Any$1 = Plan<any, any>;
|
|
769
|
+
/**
|
|
770
|
+
* The action instances of a plan.
|
|
771
|
+
*
|
|
772
|
+
* @since @next
|
|
773
|
+
*/
|
|
774
|
+
type ActionsOf$1<P> = P extends Plan<infer A, any> ? A : never;
|
|
775
|
+
/**
|
|
776
|
+
* Whether the plan has no action occurrences. An empty plan is valid.
|
|
777
|
+
*
|
|
778
|
+
* @since @next
|
|
779
|
+
*/
|
|
780
|
+
declare const isEmpty: (plan: Any$1) => boolean;
|
|
781
|
+
/**
|
|
782
|
+
* Marks a plan for run-time coverage checks only. Use it for dynamically selected or
|
|
783
|
+
* loaded plans whose action union is not known statically. Executors still reject
|
|
784
|
+
* missing handlers before any action body runs.
|
|
785
|
+
*
|
|
786
|
+
* @since @next
|
|
787
|
+
*/
|
|
788
|
+
declare const withRuntimeCoverage: <A extends Any$6, Ch extends Any$5>(plan: Plan<A, Coverage, Ch>) => Plan<A, "runtime", Ch>;
|
|
789
|
+
/**
|
|
790
|
+
* A problem in a history's declarations.
|
|
791
|
+
*
|
|
792
|
+
* @since @next
|
|
793
|
+
*/
|
|
794
|
+
type Issue = {
|
|
795
|
+
readonly _tag: "DuplicateVersion" | "UnregisteredVersion" | "AncestryCycle" | "ConflictingChange" | "ConflictingAction" | "DuplicateMigration" | "DuplicateEdge" | "SelfMigration" | "EmptyMigration" | "DuplicateOccurrence" | "DuplicateRule" | "InvalidRule" | "DuplicateShortcut" | "InvalidShortcut";
|
|
796
|
+
/** The identifier of the declaration the issue is about. */
|
|
797
|
+
readonly subject: string;
|
|
798
|
+
readonly message: string;
|
|
799
|
+
};
|
|
800
|
+
/**
|
|
801
|
+
* A candidate route, summarized for diagnostics and explicit selection.
|
|
802
|
+
*
|
|
803
|
+
* @since @next
|
|
804
|
+
*/
|
|
805
|
+
type RouteSummary = {
|
|
806
|
+
/** Pass this as the `route` option to select the route. */
|
|
807
|
+
readonly id: string;
|
|
808
|
+
readonly migrations: ReadonlyArray<string>;
|
|
809
|
+
readonly shortcuts: ReadonlyArray<string>;
|
|
810
|
+
/** Optimized action count, or `undefined` when the route failed to optimize. */
|
|
811
|
+
readonly actions: number | undefined;
|
|
812
|
+
readonly cost: number;
|
|
813
|
+
/** Why the route cannot be planned, if it cannot. */
|
|
814
|
+
readonly failure: string | undefined;
|
|
815
|
+
};
|
|
816
|
+
/**
|
|
817
|
+
* An ancestry hop with no declared route in the requested direction.
|
|
818
|
+
*
|
|
819
|
+
* @since @next
|
|
820
|
+
*/
|
|
821
|
+
type Blocker = {
|
|
822
|
+
readonly from: string;
|
|
823
|
+
readonly to: string;
|
|
824
|
+
readonly reason: string;
|
|
825
|
+
};
|
|
826
|
+
declare const InvalidHistory_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
827
|
+
readonly _tag: "InvalidHistory";
|
|
828
|
+
} & Readonly<A>;
|
|
829
|
+
/**
|
|
830
|
+
* The history's declarations are invalid. Resolution needs a valid history.
|
|
831
|
+
*
|
|
832
|
+
* @since @next
|
|
833
|
+
*/
|
|
834
|
+
declare class InvalidHistory extends InvalidHistory_base<{
|
|
835
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
836
|
+
}> {
|
|
837
|
+
get message(): string;
|
|
838
|
+
}
|
|
839
|
+
declare const UnknownVersion_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
840
|
+
readonly _tag: "UnknownVersion";
|
|
841
|
+
} & Readonly<A>;
|
|
842
|
+
/** @since @next */
|
|
843
|
+
declare class UnknownVersion extends UnknownVersion_base<{
|
|
844
|
+
readonly version: string;
|
|
845
|
+
readonly known: ReadonlyArray<string>;
|
|
846
|
+
}> {
|
|
847
|
+
get message(): string;
|
|
848
|
+
}
|
|
849
|
+
declare const UnsupportedRoute_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
850
|
+
readonly _tag: "UnsupportedRoute";
|
|
851
|
+
} & Readonly<A>;
|
|
852
|
+
/**
|
|
853
|
+
* No declared route connects the versions. This never means that no work is needed:
|
|
854
|
+
* declare `Migration.noop` for a supported zero-work transition.
|
|
855
|
+
*
|
|
856
|
+
* @since @next
|
|
857
|
+
*/
|
|
858
|
+
declare class UnsupportedRoute extends UnsupportedRoute_base<{
|
|
859
|
+
readonly from: string;
|
|
860
|
+
readonly to: string;
|
|
861
|
+
readonly direction: RequestDirection;
|
|
862
|
+
/** Versions that are reachable from `from` in the requested direction. */
|
|
863
|
+
readonly reachable: ReadonlyArray<string>;
|
|
864
|
+
/** Reachable versions closest to `to` along release ancestry. Ties are all listed. */
|
|
865
|
+
readonly closest: ReadonlyArray<string>;
|
|
866
|
+
readonly blockers: ReadonlyArray<Blocker>;
|
|
867
|
+
}> {
|
|
868
|
+
get message(): string;
|
|
869
|
+
}
|
|
870
|
+
declare const AmbiguousRoute_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
871
|
+
readonly _tag: "AmbiguousRoute";
|
|
872
|
+
} & Readonly<A>;
|
|
873
|
+
/**
|
|
874
|
+
* Several routes connect the versions and no selection or policy chose one.
|
|
875
|
+
*
|
|
876
|
+
* @since @next
|
|
877
|
+
*/
|
|
878
|
+
declare class AmbiguousRoute extends AmbiguousRoute_base<{
|
|
879
|
+
readonly from: string;
|
|
880
|
+
readonly to: string;
|
|
881
|
+
readonly candidates: ReadonlyArray<RouteSummary>;
|
|
882
|
+
readonly policy: string | undefined;
|
|
883
|
+
}> {
|
|
884
|
+
get message(): string;
|
|
885
|
+
}
|
|
886
|
+
declare const UnknownRoute_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
887
|
+
readonly _tag: "UnknownRoute";
|
|
888
|
+
} & Readonly<A>;
|
|
889
|
+
/**
|
|
890
|
+
* The `route` option names no candidate route.
|
|
891
|
+
*
|
|
892
|
+
* @since @next
|
|
893
|
+
*/
|
|
894
|
+
declare class UnknownRoute extends UnknownRoute_base<{
|
|
895
|
+
readonly route: string;
|
|
896
|
+
readonly candidates: ReadonlyArray<RouteSummary>;
|
|
897
|
+
}> {
|
|
898
|
+
get message(): string;
|
|
899
|
+
}
|
|
900
|
+
declare const RewriteCycle_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
901
|
+
readonly _tag: "RewriteCycle";
|
|
902
|
+
} & Readonly<A>;
|
|
903
|
+
/**
|
|
904
|
+
* Rules rewrite a sequence back into itself.
|
|
905
|
+
*
|
|
906
|
+
* @since @next
|
|
907
|
+
*/
|
|
908
|
+
declare class RewriteCycle extends RewriteCycle_base<{
|
|
909
|
+
readonly route: string;
|
|
910
|
+
readonly rules: ReadonlyArray<string>;
|
|
911
|
+
readonly actions: string;
|
|
912
|
+
}> {
|
|
913
|
+
get message(): string;
|
|
914
|
+
}
|
|
915
|
+
declare const ConflictingRewrites_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
916
|
+
readonly _tag: "ConflictingRewrites";
|
|
917
|
+
} & Readonly<A>;
|
|
918
|
+
/**
|
|
919
|
+
* Rules can produce different results depending on which applies first.
|
|
920
|
+
*
|
|
921
|
+
* @since @next
|
|
922
|
+
*/
|
|
923
|
+
declare class ConflictingRewrites extends ConflictingRewrites_base<{
|
|
924
|
+
readonly route: string;
|
|
925
|
+
readonly outcomes: ReadonlyArray<{
|
|
926
|
+
readonly actions: string;
|
|
927
|
+
readonly rules: ReadonlyArray<string>;
|
|
928
|
+
}>;
|
|
929
|
+
}> {
|
|
930
|
+
get message(): string;
|
|
931
|
+
}
|
|
932
|
+
declare const RewriteLimitExceeded_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
933
|
+
readonly _tag: "RewriteLimitExceeded";
|
|
934
|
+
} & Readonly<A>;
|
|
935
|
+
/**
|
|
936
|
+
* Optimization explored too many states or chained too many rule applications, for
|
|
937
|
+
* example because a rule keeps growing the sequence.
|
|
938
|
+
*
|
|
939
|
+
* @since @next
|
|
940
|
+
*/
|
|
941
|
+
declare class RewriteLimitExceeded extends RewriteLimitExceeded_base<{
|
|
942
|
+
readonly route: string;
|
|
943
|
+
readonly limit: "states" | "depth";
|
|
944
|
+
readonly value: number;
|
|
945
|
+
}> {
|
|
946
|
+
get message(): string;
|
|
947
|
+
}
|
|
948
|
+
declare const TooManyRoutes_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
949
|
+
readonly _tag: "TooManyRoutes";
|
|
950
|
+
} & Readonly<A>;
|
|
951
|
+
/**
|
|
952
|
+
* More candidate routes exist than the resolver enumerates.
|
|
953
|
+
*
|
|
954
|
+
* @since @next
|
|
955
|
+
*/
|
|
956
|
+
declare class TooManyRoutes extends TooManyRoutes_base<{
|
|
957
|
+
readonly from: string;
|
|
958
|
+
readonly to: string;
|
|
959
|
+
readonly limit: number;
|
|
960
|
+
}> {
|
|
961
|
+
get message(): string;
|
|
962
|
+
}
|
|
963
|
+
/** @since @next */
|
|
964
|
+
type RewriteError = RewriteCycle | ConflictingRewrites | RewriteLimitExceeded;
|
|
965
|
+
/**
|
|
966
|
+
* Why a plan could not be resolved. `UnsupportedRoute` lists the reachable versions, the
|
|
967
|
+
* closest ones by release ancestry, and blockers. `AmbiguousRoute` lists the candidate
|
|
968
|
+
* routes: pass one as `route`, or choose a `policy`.
|
|
969
|
+
*
|
|
970
|
+
* @since @next
|
|
971
|
+
*/
|
|
972
|
+
type ResolveError = InvalidHistory | UnknownVersion | UnsupportedRoute | AmbiguousRoute | UnknownRoute | TooManyRoutes | RewriteError;
|
|
973
|
+
/**
|
|
974
|
+
* Route policies for choosing between candidate routes. Each one is opt-in, and a policy
|
|
975
|
+
* that leaves a tie still fails as ambiguous.
|
|
976
|
+
*
|
|
977
|
+
* - `fewest-actions`: the fewest action occurrences after optimization.
|
|
978
|
+
* - `fewest-migrations`: the fewest migration steps.
|
|
979
|
+
* - `lowest-cost`: the lowest total cost. A migration costs 1 unless it declares
|
|
980
|
+
* `cost`; a shortcut costs its declared `cost` or the total of its migrations.
|
|
981
|
+
* - `prefer-shortcuts`: a route through a shortcut over the route the shortcut replaces.
|
|
982
|
+
*
|
|
983
|
+
* @since @next
|
|
984
|
+
*/
|
|
985
|
+
type RoutePolicy = "fewest-actions" | "fewest-migrations" | "lowest-cost" | "prefer-shortcuts";
|
|
986
|
+
/** @since @next */
|
|
987
|
+
type ResolveOptions = {
|
|
988
|
+
readonly from: Version | string;
|
|
989
|
+
readonly to: Version | string;
|
|
990
|
+
/** Selects a candidate route by identifier. */
|
|
991
|
+
readonly route?: string;
|
|
992
|
+
/** Chooses between candidate routes. Ties still fail as ambiguous. */
|
|
993
|
+
readonly policy?: RoutePolicy;
|
|
994
|
+
};
|
|
995
|
+
/**
|
|
996
|
+
* A reachable destination and the identifiers of its candidate routes.
|
|
997
|
+
*
|
|
998
|
+
* @since @next
|
|
999
|
+
*/
|
|
1000
|
+
type Destination = {
|
|
1001
|
+
readonly version: Version;
|
|
1002
|
+
readonly routes: ReadonlyArray<string>;
|
|
1003
|
+
/**
|
|
1004
|
+
* Present when more routes exist than route search explores. `routes` then lists the
|
|
1005
|
+
* routes found, cheapest first, and `History.resolve` to this destination fails with
|
|
1006
|
+
* `TooManyRoutes`.
|
|
1007
|
+
*/
|
|
1008
|
+
readonly overLimit?: true;
|
|
1009
|
+
};
|
|
1010
|
+
declare namespace history_d_exports {
|
|
1011
|
+
export { ActionsOf, AmbiguousRoute, Any, Blocker, ChangesOf, ConflictingRewrites, Destination, History, InvalidHistory, Issue, ResolveError, ResolveOptions, RewriteCycle, RewriteError, RewriteLimitExceeded, RoutePolicy, RouteSummary, TooManyRoutes, UnknownRoute, UnknownVersion, UnsupportedRoute, downgrades, isHistory, make$1 as make, resolve, upgrades, validate };
|
|
1012
|
+
}
|
|
1013
|
+
/** @since @next */
|
|
1014
|
+
type History<A extends Any$6 = Any$6, C extends Any$5 = Any$5> = {
|
|
1015
|
+
readonly _tag: "History";
|
|
1016
|
+
readonly versions: ReadonlyArray<Version>;
|
|
1017
|
+
readonly migrations: ReadonlyArray<Any$4>;
|
|
1018
|
+
readonly rules: ReadonlyArray<Any$3>;
|
|
1019
|
+
readonly shortcuts: ReadonlyArray<Any$2>;
|
|
1020
|
+
/** Type-level record of every action instance that a plan can contain. */
|
|
1021
|
+
readonly "~actions"?: A;
|
|
1022
|
+
/** Type-level record of every change that a plan's `changes` can contain. */
|
|
1023
|
+
readonly "~changes"?: C;
|
|
1024
|
+
};
|
|
1025
|
+
/**
|
|
1026
|
+
* Any history.
|
|
1027
|
+
*
|
|
1028
|
+
* @since @next
|
|
1029
|
+
*/
|
|
1030
|
+
type Any = History<any>;
|
|
1031
|
+
/**
|
|
1032
|
+
* Every action instance that a plan resolved from the history can contain.
|
|
1033
|
+
*
|
|
1034
|
+
* @since @next
|
|
1035
|
+
*/
|
|
1036
|
+
type ActionsOf<H> = H extends History<infer A> ? A : never;
|
|
1037
|
+
/**
|
|
1038
|
+
* Every change that a plan resolved from the history can list in `changes`.
|
|
1039
|
+
*
|
|
1040
|
+
* @since @next
|
|
1041
|
+
*/
|
|
1042
|
+
type ChangesOf<H> = H extends History<any, infer C> ? C : never;
|
|
1043
|
+
/**
|
|
1044
|
+
* Registers declarations. Migrations are registered independently of versions, so
|
|
1045
|
+
* routes can be added later without changing published release definitions.
|
|
1046
|
+
*
|
|
1047
|
+
* `make` does not throw. Use `History.validate` to list declaration issues;
|
|
1048
|
+
* resolution fails with `InvalidHistory` when there are any.
|
|
1049
|
+
*
|
|
1050
|
+
* @since @next
|
|
1051
|
+
*/
|
|
1052
|
+
declare const make$1: <const M extends ReadonlyArray<Any$4>, const R extends ReadonlyArray<Any$3> = [], const S extends ReadonlyArray<Any$2> = []>(declarations: {
|
|
1053
|
+
readonly versions: ReadonlyArray<Version>;
|
|
1054
|
+
readonly migrations: M;
|
|
1055
|
+
readonly rules?: R;
|
|
1056
|
+
readonly shortcuts?: S;
|
|
1057
|
+
}) => History<ActionsOf$4<M[number]> | ActionsOf$3<R[number]> | ActionsOf$2<S[number]>, ChangesOf$2<M[number]> | ChangesOf$1<S[number]>>;
|
|
1058
|
+
/** @since @next */
|
|
1059
|
+
declare const isHistory: (value: unknown) => value is Any;
|
|
1060
|
+
/**
|
|
1061
|
+
* Lists declaration issues in a deterministic order. An empty list means valid.
|
|
1062
|
+
*
|
|
1063
|
+
* @since @next
|
|
1064
|
+
*/
|
|
1065
|
+
declare const validate: (history: Any) => ReadonlyArray<Issue>;
|
|
1066
|
+
/**
|
|
1067
|
+
* Resolves an optimized plan between two versions. Planning needs no handlers or
|
|
1068
|
+
* execution services, and it never reads or modifies consumer files.
|
|
1069
|
+
*
|
|
1070
|
+
* When several routes connect the versions, resolution fails with `AmbiguousRoute`
|
|
1071
|
+
* unless the `route` option selects one or a route `policy` leaves exactly one.
|
|
1072
|
+
*
|
|
1073
|
+
* @example
|
|
1074
|
+
* ```ts
|
|
1075
|
+
* const result = History.resolve(history, { from: "1.5.3", to: "2.0.0" });
|
|
1076
|
+
* if (Result.isSuccess(result)) console.log(result.success.route.id);
|
|
1077
|
+
* ```
|
|
1078
|
+
*
|
|
1079
|
+
* @since @next
|
|
1080
|
+
*/
|
|
1081
|
+
declare const resolve: <A extends Any$6, C extends Any$5>(history: History<A, C>, options: ResolveOptions) => Result.Result<Plan<A, "static", C>, ResolveError>;
|
|
1082
|
+
/**
|
|
1083
|
+
* Destinations reachable by upgrade from a version, with their candidate routes.
|
|
1084
|
+
*
|
|
1085
|
+
* @since @next
|
|
1086
|
+
*/
|
|
1087
|
+
declare const upgrades: (history: Any, options: {
|
|
1088
|
+
readonly from: Version | string;
|
|
1089
|
+
}) => Result.Result<ReadonlyArray<Destination>, InvalidHistory | UnknownVersion>;
|
|
1090
|
+
/**
|
|
1091
|
+
* Destinations reachable by downgrade from a version, with their candidate routes.
|
|
1092
|
+
*
|
|
1093
|
+
* @since @next
|
|
1094
|
+
*/
|
|
1095
|
+
declare const downgrades: (history: Any, options: {
|
|
1096
|
+
readonly from: Version | string;
|
|
1097
|
+
}) => Result.Result<ReadonlyArray<Destination>, InvalidHistory | UnknownVersion>;
|
|
1098
|
+
declare namespace package_d_exports {
|
|
1099
|
+
export { Package, isPackage, make };
|
|
1100
|
+
}
|
|
1101
|
+
/** @since @next */
|
|
1102
|
+
type Package<A extends Any$6 = Any$6> = {
|
|
1103
|
+
readonly _tag: "Package";
|
|
1104
|
+
/** The name of the modeled package, for example `@acme/widgets`. */
|
|
1105
|
+
readonly name: string;
|
|
1106
|
+
readonly history: History<A>;
|
|
1107
|
+
};
|
|
1108
|
+
/**
|
|
1109
|
+
* Defines the modeled package. It holds no renderer settings, release metadata, or
|
|
1110
|
+
* handlers.
|
|
1111
|
+
*
|
|
1112
|
+
* @example
|
|
1113
|
+
* ```ts
|
|
1114
|
+
* export const widgets = Package.make("@acme/widgets", { history });
|
|
1115
|
+
* ```
|
|
1116
|
+
*
|
|
1117
|
+
* @since @next
|
|
1118
|
+
*/
|
|
1119
|
+
declare const make: <A extends Any$6>(name: string, options: {
|
|
1120
|
+
readonly history: History<A>;
|
|
1121
|
+
}) => Package<A>;
|
|
1122
|
+
/** @since @next */
|
|
1123
|
+
declare const isPackage: (value: unknown) => value is Package<any>;
|
|
1124
|
+
export { Any$6 as _, Occurrence as a, shortcut_d_exports as c, Release as d, Version as f, change_d_exports as g, Change as h, Coverage as i, rule_d_exports as l, Any$5 as m, package_d_exports as n, Plan as o, version_d_exports as p, history_d_exports as r, plan_d_exports as s, Package as t, migration_d_exports as u, action_d_exports as v };
|
|
1125
|
+
//# sourceMappingURL=package-BfBYnaCz.d.ts.map
|