eutaxy 0.5.0 → 0.5.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.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/aws.d.mts +7 -5
  3. package/dist/aws.d.mts.map +1 -1
  4. package/dist/aws.mjs +41 -135
  5. package/dist/aws.mjs.map +1 -1
  6. package/dist/bin.mjs +2 -2
  7. package/dist/checked-CGpA2-F0.d.mts +285 -0
  8. package/dist/checked-CGpA2-F0.d.mts.map +1 -0
  9. package/dist/cli-IJrKkeYS.mjs +2 -0
  10. package/dist/cli.d.mts.map +1 -1
  11. package/dist/cli.mjs +2 -2
  12. package/dist/cloudflare.d.mts +158 -54
  13. package/dist/cloudflare.d.mts.map +1 -1
  14. package/dist/cloudflare.mjs +3 -1815
  15. package/dist/delivery-invariants-BraYqcYN.d.mts +5 -0
  16. package/dist/delivery-invariants-BraYqcYN.d.mts.map +1 -0
  17. package/dist/delivery-invariants-Cuxdna28.mjs +39 -0
  18. package/dist/delivery-invariants-Cuxdna28.mjs.map +1 -0
  19. package/dist/index.d.mts +22 -189
  20. package/dist/index.d.mts.map +1 -1
  21. package/dist/index.mjs +17 -197
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/{platform-eVgCMbX0.d.mts → platform-DfMwknw1.d.mts} +94 -73
  24. package/dist/platform-DfMwknw1.d.mts.map +1 -0
  25. package/dist/{src-C19_yfMM.mjs → src-Bqc9Eyb1.mjs} +961 -543
  26. package/dist/src-Bqc9Eyb1.mjs.map +1 -0
  27. package/dist/src-DKb-fkdb.mjs +3399 -0
  28. package/dist/src-DKb-fkdb.mjs.map +1 -0
  29. package/dist/{src-CgfGiH25.mjs → src-Dxl9ZlKn.mjs} +223 -17
  30. package/dist/src-Dxl9ZlKn.mjs.map +1 -0
  31. package/package.json +1 -1
  32. package/dist/cli-NqY61bpo.mjs +0 -2
  33. package/dist/cloudflare.mjs.map +0 -1
  34. package/dist/explore-BHYvAZKN.d.mts +0 -84
  35. package/dist/explore-BHYvAZKN.d.mts.map +0 -1
  36. package/dist/platform-eVgCMbX0.d.mts.map +0 -1
  37. package/dist/src-BD3jkjgG.mjs +0 -477
  38. package/dist/src-BD3jkjgG.mjs.map +0 -1
  39. package/dist/src-C19_yfMM.mjs.map +0 -1
  40. package/dist/src-CgfGiH25.mjs.map +0 -1
  41. package/dist/src-s6uYyC0B.mjs +0 -89
  42. package/dist/src-s6uYyC0B.mjs.map +0 -1
  43. package/dist/verdict-evEM5Gxx.mjs +0 -12
  44. package/dist/verdict-evEM5Gxx.mjs.map +0 -1
@@ -24,34 +24,6 @@ interface EffectRecord {
24
24
  interface EffectLog {
25
25
  readonly entries: readonly EffectRecord[];
26
26
  }
27
- /**
28
- * `cut_off` is a crash that happens after a response or acknowledgement was
29
- * already sent, so only background work (ctx.waitUntil) is lost; platforms
30
- * offer it at the point where that work would start.
31
- */
32
- type FaultKind = "crash_before" | "crash_after" | "ambiguous" | "error" | "cut_off";
33
- interface FaultDecision {
34
- /** The invocation the effect belongs to, e.g. "msg-1#2". */
35
- readonly invocation: string;
36
- /** Position of the effect within that invocation, from 0. Stable when other invocations are removed. */
37
- readonly ordinal: number;
38
- readonly fault: FaultKind;
39
- /** What the effect was, for people reading the schedule. */
40
- readonly target: string;
41
- readonly op: string;
42
- }
43
- interface Schedule {
44
- /** The per-run seed the decisions were drawn from. */
45
- readonly seed: number;
46
- readonly faults: readonly FaultDecision[];
47
- /**
48
- * The turn picked at each scheduling decision with more than one option,
49
- * in order, as an index into the options (parked invocations by start
50
- * order, then starting the next event). Absent: turns follow the seed.
51
- * Exhaustive exploration records them, since it picks rather than draws.
52
- */
53
- readonly turns?: readonly number[];
54
- }
55
27
  /** Picks effect records by target, op, kind and payload fields. */
56
28
  interface EffectSelector {
57
29
  readonly target: string;
@@ -66,24 +38,32 @@ interface EffectSelector {
66
38
  readonly [path: string]: number;
67
39
  };
68
40
  }
69
- /** No two selected effects share the same key. Catches duplicate writes. */
70
- interface AtMostOncePerKey {
71
- readonly kind: "atMostOncePerKey";
72
- readonly name: string;
73
- readonly effect: EffectSelector;
74
- /** Dot path into the payload that identifies the key. */
75
- readonly key: string;
76
- }
77
- /** Every expected key appears in at least one selected effect. Catches lost work. */
78
- interface AtLeastOnce {
79
- readonly kind: "atLeastOnce";
41
+ /**
42
+ * The shell follows the core. Calls to a pure core function are recorded as
43
+ * decisions (`Core:<function>` results, payload `{ args, result }`). Every
44
+ * selected effect must come after a decision of `decision` in its own
45
+ * invocation; the latest such decision is the one it carries out. With
46
+ * `follows`, the effect's payload agrees with that decision at each pair of
47
+ * paths. With `state`, the decision rests on the last `read` its invocation
48
+ * made before it (none is a violation), and no other invocation's `write`
49
+ * (to the same `key`, when given) commits between that read and the effect:
50
+ * otherwise the effect carried out a decision made on a stale read.
51
+ */
52
+ interface Refines {
53
+ readonly kind: "refines";
80
54
  readonly name: string;
55
+ /** The core function, as recorded. */
56
+ readonly decision: string;
81
57
  readonly effect: EffectSelector;
82
- readonly key: string;
83
- readonly expected: readonly JsonValue[];
84
- /** Set when `expected` was derived from the drive's message bodies, so it can be re-derived when messages are removed. */
85
- readonly perMessage?: {
86
- readonly bodyKey: string;
58
+ readonly follows?: readonly {
59
+ readonly effect: string;
60
+ readonly decision: string;
61
+ }[];
62
+ readonly state?: {
63
+ readonly read: EffectSelector;
64
+ readonly write: EffectSelector;
65
+ /** Dot path into the read's and the writes' payloads naming the state they touch. */
66
+ readonly key?: string;
87
67
  };
88
68
  }
89
69
  /** A condition on one column of a row. */
@@ -144,34 +124,40 @@ interface Unique {
144
124
  readonly path: string;
145
125
  }
146
126
  /**
147
- * The shell follows the core. Calls to a pure core function are recorded as
148
- * decisions (`Core:<function>` results, payload `{ args, result }`). Every
149
- * selected effect must come after a decision of `decision` in its own
150
- * invocation; the latest such decision is the one it carries out. With
151
- * `follows`, the effect's payload agrees with that decision at each pair of
152
- * paths. With `state`, the decision rests on the last `read` its invocation
153
- * made before it (none is a violation), and no other invocation's `write`
154
- * (to the same `key`, when given) commits between that read and the effect:
155
- * otherwise the effect carried out a decision made on a stale read.
127
+ * Every row the query returns is pointed at: some row of `in` has its
128
+ * `column` equal to the row's value at `path`, as with a foreign key. Rows
129
+ * where the value is absent or null are skipped. Catches orphans across two
130
+ * stores, e.g. "no stored object without the row that names it".
156
131
  */
157
- interface Refines {
158
- readonly kind: "refines";
132
+ interface References {
133
+ readonly kind: "references";
134
+ readonly name: string;
135
+ readonly query: StateQuery;
136
+ readonly path: string;
137
+ readonly in: StateQuery;
138
+ readonly column: string;
139
+ }
140
+ /** No two selected effects share the same key. Catches duplicate writes. */
141
+ interface AtMostOncePerKey {
142
+ readonly kind: "atMostOncePerKey";
159
143
  readonly name: string;
160
- /** The core function, as recorded. */
161
- readonly decision: string;
162
144
  readonly effect: EffectSelector;
163
- readonly follows?: readonly {
164
- readonly effect: string;
165
- readonly decision: string;
166
- }[];
167
- readonly state?: {
168
- readonly read: EffectSelector;
169
- readonly write: EffectSelector;
170
- /** Dot path into the read's and the writes' payloads naming the state they touch. */
171
- readonly key?: string;
145
+ /** Dot path into the payload that identifies the key. */
146
+ readonly key: string;
147
+ }
148
+ /** Every expected key appears in at least one selected effect. Catches lost work. */
149
+ interface AtLeastOnce {
150
+ readonly kind: "atLeastOnce";
151
+ readonly name: string;
152
+ readonly effect: EffectSelector;
153
+ readonly key: string;
154
+ readonly expected: readonly JsonValue[];
155
+ /** Set when `expected` was derived from the drive's message bodies, so it can be re-derived when messages are removed. */
156
+ readonly perMessage?: {
157
+ readonly bodyKey: string;
172
158
  };
173
159
  }
174
- type Invariant = AtMostOncePerKey | AtLeastOnce | EveryRow | Implies | Unique | Refines;
160
+ type Invariant = AtMostOncePerKey | AtLeastOnce | EveryRow | Implies | Unique | References | Refines;
175
161
  interface Violation {
176
162
  readonly invariant: string;
177
163
  readonly message: string;
@@ -182,6 +168,34 @@ interface Violation {
182
168
  }
183
169
  declare function checkInvariant(log: EffectLog, inv: Invariant): Violation | null;
184
170
  declare function checkInvariants(log: EffectLog, invariants: readonly Invariant[]): readonly Violation[];
171
+ /**
172
+ * `cut_off` is a crash that happens after a response or acknowledgement was
173
+ * already sent, so only background work (ctx.waitUntil) is lost; platforms
174
+ * offer it at the point where that work would start.
175
+ */
176
+ type FaultKind = "crash_before" | "crash_after" | "ambiguous" | "error" | "cut_off";
177
+ interface FaultDecision {
178
+ /** The invocation the effect belongs to, e.g. "msg-1#2". */
179
+ readonly invocation: string;
180
+ /** Position of the effect within that invocation, from 0. Stable when other invocations are removed. */
181
+ readonly ordinal: number;
182
+ readonly fault: FaultKind;
183
+ /** What the effect was, for people reading the schedule. */
184
+ readonly target: string;
185
+ readonly op: string;
186
+ }
187
+ interface Schedule {
188
+ /** The per-run seed the decisions were drawn from. */
189
+ readonly seed: number;
190
+ readonly faults: readonly FaultDecision[];
191
+ /**
192
+ * The turn picked at each scheduling decision with more than one option,
193
+ * in order, as an index into the options (parked invocations by start
194
+ * order, then starting the next event). Absent: turns follow the seed.
195
+ * Exhaustive exploration records them, since it picks rather than draws.
196
+ */
197
+ readonly turns?: readonly number[];
198
+ }
185
199
  /** Opaque, JSON-shaped data owned by a platform package. `kind` names its shape. */
186
200
  interface PlatformData {
187
201
  readonly kind: string;
@@ -315,14 +329,21 @@ interface Invocation {
315
329
  /** What the engine offers a platform during one run. */
316
330
  interface RunHooks {
317
331
  /**
318
- * Start tracking an invocation; it becomes the running one. With
319
- * `bookkeeping`, it only records the platform's own actions (a dead
320
- * letter, a caller giving up) and never becomes the running one, so it
321
- * cannot take over the effects of the handler it was started during.
332
+ * Start tracking an invocation; it becomes the running one.
333
+ * @param options.bookkeeping Deprecated: use `bookkeeping()`. Tracks the
334
+ * invocation without it ever becoming the running one.
322
335
  */
323
336
  startInvocation(id: string, options?: {
324
337
  readonly bookkeeping?: boolean;
325
338
  }): Invocation;
339
+ /**
340
+ * The invocation the platform's own actions are recorded under (a dead
341
+ * letter, a caller giving up, an end-of-run snapshot), started on first
342
+ * use in the run. No fault crashes it and it never becomes the running
343
+ * one, so it cannot take over the effects of the handler it was started
344
+ * during.
345
+ */
346
+ bookkeeping(): string;
326
347
  /** Perform an asynchronous effect under fault injection and record it. */
327
348
  effect<T>(point: EffectPoint, perform: () => Promise<T>, summarize: (value: T) => JsonValue, options?: EffectOptions): Promise<T>;
328
349
  /** Perform a synchronous effect under fault injection and record it. */
@@ -381,5 +402,5 @@ interface Platform {
381
402
  /** Called when a run ends for any reason, after `finish` or after a failure: undo any per-run patching. */
382
403
  cleanup?(spec: ScenarioSpec): Promise<void>;
383
404
  }
384
- export { FaultDecision as C, EffectRecord as D, EffectLog as E, JsonValue as O, checkInvariants as S, Schedule as T, RowCondition as _, PlatformData as a, Violation as b, WorkerRef as c, AtMostOncePerKey as d, EffectSelector as f, Refines as g, Invariant as h, ExternalDecl as i, validateScenario as l, Implies as m, Platform as n, ScenarioSpec as o, EveryRow as p, Bounds as r, ScriptedResponse as s, EventRef as t, AtLeastOnce as u, StateQuery as v, FaultKind as w, checkInvariant as x, Unique as y };
385
- //# sourceMappingURL=platform-eVgCMbX0.d.mts.map
405
+ export { StateQuery as C, EffectLog as D, EffectSelector as E, EffectRecord as O, RowCondition as S, Refines as T, checkInvariant as _, PlatformData as a, Implies as b, WorkerRef as c, FaultKind as d, Schedule as f, Violation as g, Invariant as h, ExternalDecl as i, JsonValue as k, validateScenario as l, AtMostOncePerKey as m, Platform as n, ScenarioSpec as o, AtLeastOnce as p, Bounds as r, ScriptedResponse as s, EventRef as t, FaultDecision as u, checkInvariants as v, Unique as w, References as x, EveryRow as y };
406
+ //# sourceMappingURL=platform-DfMwknw1.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-DfMwknw1.d.mts","names":[],"sources":["../../core/src/canonical-json.ts","../../core/src/effect-log.ts","../../core/src/selectors.ts","../../core/src/refines.ts","../../core/src/state.ts","../../core/src/invariants.ts","../../core/src/faults.ts","../../core/src/scenario.ts","../../core/src/platform.ts"],"mappings":";;;;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