eutaxy 0.12.0 → 0.14.0
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/README.md +11 -8
- package/dist/aws.mjs +5 -5
- package/dist/bin.mjs +1 -2
- package/dist/bin.mjs.map +1 -1
- package/dist/{checksum-DJbbDJA0.mjs → checksum-75EliDEr.mjs} +5 -5
- package/dist/{checksum-DJbbDJA0.mjs.map → checksum-75EliDEr.mjs.map} +1 -1
- package/dist/{src-DIG0_CjU.mjs → cli-BppjMaqL.mjs} +690 -4113
- package/dist/cli-BppjMaqL.mjs.map +1 -0
- package/dist/cli.mjs +1 -2
- package/dist/cloudflare.d.mts +245 -84
- package/dist/cloudflare.d.mts.map +1 -1
- package/dist/cloudflare.mjs +3 -3
- package/dist/{delivery-invariants-Br29H7Rg.mjs → delivery-invariants-_T9ZMwOJ.mjs} +2 -2
- package/dist/{delivery-invariants-Br29H7Rg.mjs.map → delivery-invariants-_T9ZMwOJ.mjs.map} +1 -1
- package/dist/{event-streams-eH6Jim9p.mjs → event-streams-lXGVdHFn.mjs} +2 -2
- package/dist/{event-streams-eH6Jim9p.mjs.map → event-streams-lXGVdHFn.mjs.map} +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/dist/provers-DS44OeEm.mjs +83 -0
- package/dist/provers-DS44OeEm.mjs.map +1 -0
- package/dist/{src-CWVQEhTr.mjs → src-ClXnIi6O.mjs} +3 -83
- package/dist/src-ClXnIi6O.mjs.map +1 -0
- package/dist/{src-DGh7w877.mjs → src-DPCF2XGv.mjs} +103 -16
- package/dist/src-DPCF2XGv.mjs.map +1 -0
- package/dist/workerd-DVJ8eCLI.mjs +5200 -0
- package/dist/workerd-DVJ8eCLI.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/cli-BFTyLLRF.mjs +0 -2
- package/dist/src-CWVQEhTr.mjs.map +0 -1
- package/dist/src-DGh7w877.mjs.map +0 -1
- package/dist/src-DIG0_CjU.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
import "./cli-BFTyLLRF.mjs";
|
|
1
|
+
export { t as main } from "./cli-BppjMaqL.mjs";
|
package/dist/cloudflare.d.mts
CHANGED
|
@@ -24,6 +24,24 @@ interface CloudflareRegressionOptions {
|
|
|
24
24
|
readonly exports?: boolean;
|
|
25
25
|
/** @deprecated Use `exports`. */
|
|
26
26
|
readonly workflows?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The Workers behind service bindings the scenario names with `callee`, by
|
|
29
|
+
* binding: each one's name from its wrangler config and the import path of
|
|
30
|
+
* its module.
|
|
31
|
+
*/
|
|
32
|
+
readonly callees?: Readonly<Record<string, {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly path: string;
|
|
35
|
+
readonly entrypoint?: string;
|
|
36
|
+
readonly props?: Readonly<Record<string, unknown>>;
|
|
37
|
+
}>>;
|
|
38
|
+
/**
|
|
39
|
+
* The qualified names the callees' bindings had in the check's isolate: the
|
|
40
|
+
* replay needs them in its own, so the test says so at its top.
|
|
41
|
+
*/
|
|
42
|
+
readonly calleeBindings?: readonly string[];
|
|
43
|
+
/** Qualified binding names that are aliases of the caller's bindings, passed to the platform. */
|
|
44
|
+
readonly aliases?: Readonly<Record<string, string>>;
|
|
27
45
|
readonly expect?: "holds" | "violates";
|
|
28
46
|
readonly engineModule?: string;
|
|
29
47
|
/** Core modules to observe during the replay (import path, functions), for `refines`. */
|
|
@@ -34,89 +52,10 @@ interface CloudflareRegressionOptions {
|
|
|
34
52
|
}
|
|
35
53
|
/** A Vitest regression test for a Cloudflare scenario, to run under the Cloudflare Vitest plugin. */
|
|
36
54
|
export declare function cloudflareRegressionTest(verdict: Violated, options: CloudflareRegressionOptions): string;
|
|
37
|
-
/** Explore a scenario on a platform and return its verdict. */
|
|
38
|
-
export declare function check(spec: ScenarioSpec, platform: Platform, options?: ExploreOptions): Promise<ScenarioVerdict>;
|
|
39
|
-
/** For use from a test: passes only when the scenario is BOUNDED. */
|
|
40
|
-
export declare function expectHolds(spec: ScenarioSpec, platform: Platform, options?: ExploreOptions): Promise<void>;
|
|
41
55
|
/** Every user table's rows, sorted canonically, read through the real binding (not an effect). */
|
|
42
56
|
export declare function snapshotD1(real: D1Database): Promise<{
|
|
43
57
|
readonly [table: string]: readonly JsonValue[];
|
|
44
58
|
}>;
|
|
45
|
-
/**
|
|
46
|
-
* The Cloudflare Vitest plugin's test helpers, as exported by
|
|
47
|
-
* `cloudflare:test` (pass the module namespace). Typed loosely on purpose:
|
|
48
|
-
* the plugin's generic overloads are too deep to check against an interface.
|
|
49
|
-
*/
|
|
50
|
-
interface DurableObjectTestHelpers {
|
|
51
|
-
readonly runInDurableObject: unknown;
|
|
52
|
-
readonly evictDurableObject: unknown;
|
|
53
|
-
readonly listDurableObjectIds: unknown;
|
|
54
|
-
}
|
|
55
|
-
/** The Worker's default export, as far as the platform drives it. */
|
|
56
|
-
interface WorkerHandler {
|
|
57
|
-
queue?(batch: MessageBatch<unknown>, env: unknown, ctx: ExecutionContext): void | Promise<void>;
|
|
58
|
-
fetch?(request: Request, env: unknown, ctx: ExecutionContext): Response | Promise<Response>;
|
|
59
|
-
scheduled?(controller: ScheduledController, env: unknown, ctx: ExecutionContext): void | Promise<void>;
|
|
60
|
-
}
|
|
61
|
-
/** A `WorkerEntrypoint` subclass: the Worker's default export when it exposes RPC methods. Its env is its own. */
|
|
62
|
-
type WorkerEntrypointClass = abstract new (ctx: ExecutionContext, env: never) => object;
|
|
63
|
-
interface CloudflarePlatformOptions {
|
|
64
|
-
/** The bindings from `cloudflare:workers`. */
|
|
65
|
-
readonly env: object;
|
|
66
|
-
/**
|
|
67
|
-
* The Worker's default export: the handler object, or the
|
|
68
|
-
* `WorkerEntrypoint` class the `rpc` drive calls (its own `fetch()`
|
|
69
|
-
* method is not driven by `http()` yet).
|
|
70
|
-
*/
|
|
71
|
-
readonly handler: WorkerHandler | WorkerEntrypointClass;
|
|
72
|
-
/** Schema SQL per D1 binding named in the scenario's setup. */
|
|
73
|
-
readonly schemas: Readonly<Record<string, string>>;
|
|
74
|
-
/** Cloudflare's default when the consumer does not set max_retries. */
|
|
75
|
-
readonly maxRetries?: number;
|
|
76
|
-
/**
|
|
77
|
-
* The Cloudflare Vitest plugin's test helpers (`import * as helpers from
|
|
78
|
-
* "cloudflare:test"`), needed for Durable Object bindings: Eutaxy resets,
|
|
79
|
-
* seeds and snapshots the real objects through them.
|
|
80
|
-
*/
|
|
81
|
-
readonly durableObjects?: DurableObjectTestHelpers;
|
|
82
|
-
/**
|
|
83
|
-
* The Worker module's exports (`import * as worker from "./worker.ts"`),
|
|
84
|
-
* where the classes `workflow` setup steps name are found.
|
|
85
|
-
*/
|
|
86
|
-
readonly exports?: Readonly<Record<string, unknown>>;
|
|
87
|
-
}
|
|
88
|
-
export declare function createCloudflarePlatform(options: CloudflarePlatformOptions): Platform;
|
|
89
|
-
/** A type, not an interface, so it is JSON data the comparison takes as it is. */
|
|
90
|
-
type AttemptRecord = {
|
|
91
|
-
readonly event: string;
|
|
92
|
-
readonly attempt: number;
|
|
93
|
-
readonly status: "completed" | "errored";
|
|
94
|
-
/** Queue drive: the acknowledgement that took effect. Cron drive: `no_retry` when the handler asked for none. */
|
|
95
|
-
readonly decision: "ack" | "retry" | "no_retry" | null;
|
|
96
|
-
/** HTTP drive: the response status the caller saw (500 for an uncaught exception). */
|
|
97
|
-
readonly response?: number;
|
|
98
|
-
/** RPC drive: the answer the caller saw, `{ ok: true, value }` or `{ ok: false, error }`. */
|
|
99
|
-
readonly result?: JsonValue;
|
|
100
|
-
};
|
|
101
|
-
interface Side {
|
|
102
|
-
readonly attempts: readonly AttemptRecord[];
|
|
103
|
-
readonly state: {
|
|
104
|
-
readonly [binding: string]: {
|
|
105
|
-
readonly [table: string]: readonly JsonValue[];
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
interface DifferentialResult {
|
|
110
|
-
/** True only when both sides agree and the proxied run touched nothing unmodelled. */
|
|
111
|
-
readonly equal: boolean;
|
|
112
|
-
readonly eutaxy: Side;
|
|
113
|
-
readonly raw: Side;
|
|
114
|
-
readonly differences: readonly string[];
|
|
115
|
-
/** What the proxied run could not control; non-empty means the comparison proves nothing. */
|
|
116
|
-
readonly unsupported: readonly string[];
|
|
117
|
-
}
|
|
118
|
-
/** Run both sides and compare. The Eutaxy side runs first; both start from the schema. */
|
|
119
|
-
export declare function runDifferential(spec: ScenarioSpec, options: CloudflarePlatformOptions): Promise<DifferentialResult>;
|
|
120
59
|
/** An object a setup seeds: its text, or its text with metadata. */
|
|
121
60
|
type R2Seed = string | {
|
|
122
61
|
readonly value: string;
|
|
@@ -184,6 +123,42 @@ interface HttpCallerOptions {
|
|
|
184
123
|
readonly deadlineMs?: number;
|
|
185
124
|
}
|
|
186
125
|
export declare function http(requests: readonly HttpRequestInput[], options?: HttpCallerOptions): HttpDrive;
|
|
126
|
+
/** One message the scenario sends on a connection: text, or a JSON value sent as its text (plain data, as drives are). */
|
|
127
|
+
type WebSocketMessageSpec = {
|
|
128
|
+
readonly id: string;
|
|
129
|
+
readonly data: JsonValue;
|
|
130
|
+
};
|
|
131
|
+
/** One WebSocket connection the scenario opens to the Worker, and the messages it sends on it, in order. */
|
|
132
|
+
type WebSocketConnectionSpec = {
|
|
133
|
+
readonly id: string;
|
|
134
|
+
readonly path: string;
|
|
135
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
136
|
+
readonly messages: readonly WebSocketMessageSpec[];
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Drive the Worker over WebSocket connections: each connection is opened
|
|
140
|
+
* with an upgrade request to its path (one event) and its messages are sent
|
|
141
|
+
* in order (one event each, after its connection opened and its previous
|
|
142
|
+
* message was handled); every connection closes at the end of the run.
|
|
143
|
+
* Events of different connections interleave as concurrency allows.
|
|
144
|
+
*/
|
|
145
|
+
interface WebSocketDrive extends PlatformData {
|
|
146
|
+
readonly kind: "websocket";
|
|
147
|
+
readonly connections: readonly WebSocketConnectionSpec[];
|
|
148
|
+
}
|
|
149
|
+
interface WebSocketMessageInput {
|
|
150
|
+
readonly id?: string;
|
|
151
|
+
readonly data: JsonValue;
|
|
152
|
+
}
|
|
153
|
+
interface WebSocketConnectionInput {
|
|
154
|
+
/** Defaults to its position: `conn-1`, `conn-2`, … */
|
|
155
|
+
readonly id?: string;
|
|
156
|
+
readonly path: string;
|
|
157
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
158
|
+
/** Message ids default to `<connection>:1`, `<connection>:2`, … */
|
|
159
|
+
readonly messages?: readonly WebSocketMessageInput[];
|
|
160
|
+
}
|
|
161
|
+
export declare function websocket(connections: readonly WebSocketConnectionInput[]): WebSocketDrive;
|
|
187
162
|
/** One RPC call; `id` defaults to its position, `args` to none. */
|
|
188
163
|
interface RpcCallInput {
|
|
189
164
|
readonly id?: string;
|
|
@@ -247,7 +222,7 @@ interface CronOptions {
|
|
|
247
222
|
}
|
|
248
223
|
export declare function cron(expression: string, options?: CronOptions): CronDrive;
|
|
249
224
|
/** The drives a Cloudflare scenario can have. */
|
|
250
|
-
type Drive = QueueDrive | HttpDrive | RpcDrive | CronDrive;
|
|
225
|
+
type Drive = QueueDrive | HttpDrive | RpcDrive | CronDrive | WebSocketDrive;
|
|
251
226
|
/** Apply a SQL file to a D1 binding before each run. */
|
|
252
227
|
interface D1Setup extends PlatformData {
|
|
253
228
|
readonly kind: "d1";
|
|
@@ -272,13 +247,32 @@ interface DurableObjectSetup extends PlatformData {
|
|
|
272
247
|
* counted); an object that keeps re-arming stops there. Default 3.
|
|
273
248
|
*/
|
|
274
249
|
readonly alarmsPerObject?: number;
|
|
250
|
+
/** For SQLite-backed objects, by name: the tables to create and the rows to insert after the clear. */
|
|
251
|
+
readonly sql?: {
|
|
252
|
+
readonly [name: string]: DurableObjectSqlSeed;
|
|
253
|
+
};
|
|
275
254
|
}
|
|
255
|
+
/** A SQLite-backed object's starting storage: its `CREATE TABLE` statements, and rows per table (plain data, as setup steps are). */
|
|
256
|
+
type DurableObjectSqlSeed = {
|
|
257
|
+
/** SQL run after the clear: the schema, `CREATE TABLE` statements and the like. */
|
|
258
|
+
readonly schema: string;
|
|
259
|
+
readonly rows?: {
|
|
260
|
+
readonly [table: string]: readonly SqlRow[];
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
/** One row to insert, or one row snapshotted: column name to value (booleans and objects as SQLite stores them). */
|
|
264
|
+
type SqlRow = {
|
|
265
|
+
readonly [column: string]: JsonValue;
|
|
266
|
+
};
|
|
276
267
|
export declare function durableObject(binding: string, objects?: {
|
|
277
268
|
readonly [name: string]: {
|
|
278
269
|
readonly [key: string]: JsonValue;
|
|
279
270
|
};
|
|
280
271
|
}, options?: {
|
|
281
272
|
readonly alarmsPerObject?: number;
|
|
273
|
+
readonly sql?: {
|
|
274
|
+
readonly [name: string]: DurableObjectSqlSeed;
|
|
275
|
+
};
|
|
282
276
|
}): DurableObjectSetup;
|
|
283
277
|
/** An R2 bucket the scenario uses: emptied, then seeded with these objects, before each run. */
|
|
284
278
|
interface R2Setup extends PlatformData {
|
|
@@ -350,7 +344,32 @@ export declare function service(binding: string, options?: {
|
|
|
350
344
|
};
|
|
351
345
|
readonly fetch?: readonly ServiceResponse[];
|
|
352
346
|
}): ServiceSetup;
|
|
353
|
-
/**
|
|
347
|
+
/**
|
|
348
|
+
* The Worker behind a service binding, run for real: its module and wrangler
|
|
349
|
+
* config, relative to the scenario, in place of a script. The `name` in that
|
|
350
|
+
* config qualifies the callee's bindings (`orders/DB`) in effect targets,
|
|
351
|
+
* setup steps, state queries and snapshots. Each call is one effect,
|
|
352
|
+
* `Service:<binding>`, hosting the callee's invocation
|
|
353
|
+
* (`<caller invocation>/<binding>.<method>`), with the faults of a call in
|
|
354
|
+
* the network: `crash_before`, `ambiguous` and `crash_after`; what the
|
|
355
|
+
* callee throws is real.
|
|
356
|
+
*/
|
|
357
|
+
interface CalleeSetup extends PlatformData {
|
|
358
|
+
readonly kind: "callee";
|
|
359
|
+
readonly binding: string;
|
|
360
|
+
/** The callee's module, relative to the scenario. */
|
|
361
|
+
readonly entry: string;
|
|
362
|
+
/** Its wrangler config, relative to the scenario; its `name` qualifies the callee's bindings. */
|
|
363
|
+
readonly config: string;
|
|
364
|
+
/** The named export the binding reaches; the default export otherwise. */
|
|
365
|
+
readonly entrypoint?: string;
|
|
366
|
+
}
|
|
367
|
+
export declare function callee(binding: string, worker: {
|
|
368
|
+
readonly entry: string;
|
|
369
|
+
readonly config: string;
|
|
370
|
+
readonly entrypoint?: string;
|
|
371
|
+
}): CalleeSetup;
|
|
372
|
+
/** Selects the calls through a service binding that completed (scripted or a callee's), one method's or all. */
|
|
354
373
|
export declare function serviceCall(binding: string, method?: string): EffectSelector;
|
|
355
374
|
/** Selects a Workflow's step attempts, optionally of one step; a failed attempt's result carries its error. */
|
|
356
375
|
export declare function workflowStep(binding: string, step?: string): EffectSelector;
|
|
@@ -361,15 +380,21 @@ export declare function workflowRows(binding: string, where?: readonly RowCondit
|
|
|
361
380
|
* `{ key, value }`, for state invariants.
|
|
362
381
|
*/
|
|
363
382
|
export declare function durableObjectRows(binding: string, object: string, where?: readonly RowCondition[]): StateQuery;
|
|
383
|
+
/**
|
|
384
|
+
* One SQL table of a SQLite-backed object (by the name its id was made
|
|
385
|
+
* from) at the end of the run, its rows as the table holds them, for state
|
|
386
|
+
* invariants. The snapshot names it `<object>/<table>`.
|
|
387
|
+
*/
|
|
388
|
+
export declare function durableObjectTable(binding: string, object: string, table: string, where?: readonly RowCondition[]): StateQuery;
|
|
364
389
|
interface CloudflareScenarioInput {
|
|
365
390
|
readonly name: string;
|
|
366
391
|
readonly worker: WorkerRef;
|
|
367
|
-
readonly drive: QueueDrive | HttpDrive | RpcDrive | CronDrive | {
|
|
392
|
+
readonly drive: QueueDrive | HttpDrive | RpcDrive | CronDrive | WebSocketDrive | {
|
|
368
393
|
readonly kind: "queue";
|
|
369
394
|
readonly queue: string;
|
|
370
395
|
readonly messages: readonly QueueMessage[];
|
|
371
396
|
};
|
|
372
|
-
readonly setup?: readonly (D1Setup | DurableObjectSetup | R2Setup | WorkflowSetup | ServiceSetup)[];
|
|
397
|
+
readonly setup?: readonly (CalleeSetup | D1Setup | DurableObjectSetup | R2Setup | WorkflowSetup | ServiceSetup)[];
|
|
373
398
|
readonly externals?: readonly ExternalDecl[];
|
|
374
399
|
readonly invariants: readonly Invariant[];
|
|
375
400
|
readonly bounds?: Partial<Bounds>;
|
|
@@ -405,6 +430,12 @@ export declare function refines(name: string, decision: string, effect: EffectSe
|
|
|
405
430
|
* (`"0.orderId"`).
|
|
406
431
|
*/
|
|
407
432
|
export declare function atLeastOncePerMessage(name: string, drive: Drive, effect: EffectSelector, key: string, bodyKey: string): AtLeastOnce;
|
|
433
|
+
/**
|
|
434
|
+
* Selects the frames the Worker sent on a connection (`WebSocket:<connection>`,
|
|
435
|
+
* op `message`), each recorded at the end of the run, in arrival order, with
|
|
436
|
+
* its data (JSON where it parses, text otherwise).
|
|
437
|
+
*/
|
|
438
|
+
export declare function webSocketReceived(connection: string): EffectSelector;
|
|
408
439
|
/**
|
|
409
440
|
* Selects the responses the Worker returned for a path (`ok` narrows to 2xx
|
|
410
441
|
* or to everything else). One `result` per attempt: a crash before the
|
|
@@ -449,6 +480,122 @@ export declare function external(name: string, host: string, options?: {
|
|
|
449
480
|
export declare function fetchCall(externalName: string, method?: string): EffectSelector;
|
|
450
481
|
/** Build and validate a scenario spec; throws with every problem listed. */
|
|
451
482
|
export declare function defineScenario(input: CloudflareScenarioInput): ScenarioSpec;
|
|
483
|
+
/**
|
|
484
|
+
* The callee's module as the test gives it: the Worker's name from its
|
|
485
|
+
* wrangler config, which qualifies its bindings, its exports, and what the
|
|
486
|
+
* caller's service binding carries in its own config: the `entrypoint` the
|
|
487
|
+
* binding reaches (the scenario's `callee()` may name one too, and wins)
|
|
488
|
+
* and the `props` the callee reads from `ctx.props`.
|
|
489
|
+
*/
|
|
490
|
+
interface CalleeModule {
|
|
491
|
+
readonly name: string;
|
|
492
|
+
readonly exports: Readonly<Record<string, unknown>>;
|
|
493
|
+
readonly entrypoint?: string;
|
|
494
|
+
readonly props?: Readonly<Record<string, JsonValue>>;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* The callee's `env`: the scenario's env seen under the callee's own names,
|
|
498
|
+
* each mapped onto `<name>/<key>`. Over the platform's proxied env the
|
|
499
|
+
* entries are the proxies, so the callee's effects are recorded under their
|
|
500
|
+
* qualified targets, and an alias (`<name>/STOCK` for the caller's `STOCK`)
|
|
501
|
+
* is already resolved; over workerd's raw env (a callee's Durable Object,
|
|
502
|
+
* which the runtime constructs with the main Worker's env) the aliases are
|
|
503
|
+
* given here, so the shared binding is there under the callee's name too.
|
|
504
|
+
*/
|
|
505
|
+
export declare function calleeEnv(name: string, env: object, aliases?: Readonly<Record<string, string>>): object;
|
|
506
|
+
/** Explore a scenario on a platform and return its verdict. */
|
|
507
|
+
export declare function check(spec: ScenarioSpec, platform: Platform, options?: ExploreOptions): Promise<ScenarioVerdict>;
|
|
508
|
+
/** For use from a test: passes only when the scenario is BOUNDED. */
|
|
509
|
+
export declare function expectHolds(spec: ScenarioSpec, platform: Platform, options?: ExploreOptions): Promise<void>;
|
|
510
|
+
/**
|
|
511
|
+
* The Cloudflare Vitest plugin's test helpers, as exported by
|
|
512
|
+
* `cloudflare:test` (pass the module namespace). Typed loosely on purpose:
|
|
513
|
+
* the plugin's generic overloads are too deep to check against an interface.
|
|
514
|
+
*/
|
|
515
|
+
interface DurableObjectTestHelpers {
|
|
516
|
+
readonly runInDurableObject: unknown;
|
|
517
|
+
readonly evictDurableObject: unknown;
|
|
518
|
+
readonly listDurableObjectIds: unknown;
|
|
519
|
+
}
|
|
520
|
+
/** The Worker's default export, as far as the platform drives it. */
|
|
521
|
+
interface WorkerHandler {
|
|
522
|
+
queue?(batch: MessageBatch<unknown>, env: unknown, ctx: ExecutionContext): void | Promise<void>;
|
|
523
|
+
fetch?(request: Request, env: unknown, ctx: ExecutionContext): Response | Promise<Response>;
|
|
524
|
+
scheduled?(controller: ScheduledController, env: unknown, ctx: ExecutionContext): void | Promise<void>;
|
|
525
|
+
}
|
|
526
|
+
/** A `WorkerEntrypoint` subclass: the Worker's default export when it exposes RPC methods. Its env is its own. */
|
|
527
|
+
type WorkerEntrypointClass = abstract new (ctx: ExecutionContext, env: never) => object;
|
|
528
|
+
interface CloudflarePlatformOptions {
|
|
529
|
+
/** The bindings from `cloudflare:workers`. */
|
|
530
|
+
readonly env: object;
|
|
531
|
+
/**
|
|
532
|
+
* The Worker's default export: the handler object, or the
|
|
533
|
+
* `WorkerEntrypoint` class the `rpc` drive calls (its own `fetch()`
|
|
534
|
+
* method is not driven by `http()` yet).
|
|
535
|
+
*/
|
|
536
|
+
readonly handler: WorkerHandler | WorkerEntrypointClass;
|
|
537
|
+
/** Schema SQL per D1 binding named in the scenario's setup. */
|
|
538
|
+
readonly schemas: Readonly<Record<string, string>>;
|
|
539
|
+
/** Cloudflare's default when the consumer does not set max_retries. */
|
|
540
|
+
readonly maxRetries?: number;
|
|
541
|
+
/**
|
|
542
|
+
* The Cloudflare Vitest plugin's test helpers (`import * as helpers from
|
|
543
|
+
* "cloudflare:test"`), needed for Durable Object bindings: Eutaxy resets,
|
|
544
|
+
* seeds and snapshots the real objects through them.
|
|
545
|
+
*/
|
|
546
|
+
readonly durableObjects?: DurableObjectTestHelpers;
|
|
547
|
+
/**
|
|
548
|
+
* The Worker module's exports (`import * as worker from "./worker.ts"`),
|
|
549
|
+
* where the classes `workflow` setup steps name are found.
|
|
550
|
+
*/
|
|
551
|
+
readonly exports?: Readonly<Record<string, unknown>>;
|
|
552
|
+
/**
|
|
553
|
+
* The Workers behind service bindings that `callee` setup steps name, by
|
|
554
|
+
* binding: each one's name from its wrangler config, which qualifies its
|
|
555
|
+
* bindings in `env` (`orders/DB`), and its module's exports.
|
|
556
|
+
*/
|
|
557
|
+
readonly callees?: Readonly<Record<string, CalleeModule>>;
|
|
558
|
+
/**
|
|
559
|
+
* Bindings that name a resource another binding already names (the same
|
|
560
|
+
* database, the same Durable Object namespace), by their qualified name
|
|
561
|
+
* (`inventory/DB`) to the name the resource is set up and snapshotted
|
|
562
|
+
* under (`DB`): one resource, one snapshot, the alias a second name for it
|
|
563
|
+
* in `env`. A setup step on an alias is refused.
|
|
564
|
+
*/
|
|
565
|
+
readonly aliases?: Readonly<Record<string, string>>;
|
|
566
|
+
}
|
|
567
|
+
export declare function createCloudflarePlatform(options: CloudflarePlatformOptions): Platform;
|
|
568
|
+
/** A type, not an interface, so it is JSON data the comparison takes as it is. */
|
|
569
|
+
type AttemptRecord = {
|
|
570
|
+
readonly event: string;
|
|
571
|
+
readonly attempt: number;
|
|
572
|
+
readonly status: "completed" | "errored";
|
|
573
|
+
/** Queue drive: the acknowledgement that took effect. Cron drive: `no_retry` when the handler asked for none. */
|
|
574
|
+
readonly decision: "ack" | "retry" | "no_retry" | null;
|
|
575
|
+
/** HTTP drive: the response status the caller saw (500 for an uncaught exception). */
|
|
576
|
+
readonly response?: number;
|
|
577
|
+
/** RPC drive: the answer the caller saw, `{ ok: true, value }` or `{ ok: false, error }`. */
|
|
578
|
+
readonly result?: JsonValue;
|
|
579
|
+
};
|
|
580
|
+
interface Side {
|
|
581
|
+
readonly attempts: readonly AttemptRecord[];
|
|
582
|
+
readonly state: {
|
|
583
|
+
readonly [binding: string]: {
|
|
584
|
+
readonly [table: string]: readonly JsonValue[];
|
|
585
|
+
};
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
interface DifferentialResult {
|
|
589
|
+
/** True only when both sides agree and the proxied run touched nothing unmodelled. */
|
|
590
|
+
readonly equal: boolean;
|
|
591
|
+
readonly eutaxy: Side;
|
|
592
|
+
readonly raw: Side;
|
|
593
|
+
readonly differences: readonly string[];
|
|
594
|
+
/** What the proxied run could not control; non-empty means the comparison proves nothing. */
|
|
595
|
+
readonly unsupported: readonly string[];
|
|
596
|
+
}
|
|
597
|
+
/** Run both sides and compare. The Eutaxy side runs first; both start from the schema. */
|
|
598
|
+
export declare function runDifferential(spec: ScenarioSpec, options: CloudflarePlatformOptions): Promise<DifferentialResult>;
|
|
452
599
|
/** What the generated test stores in its task meta. */
|
|
453
600
|
interface CheckTransport {
|
|
454
601
|
readonly report: unknown;
|
|
@@ -468,6 +615,14 @@ interface CheckTransport {
|
|
|
468
615
|
readonly [key: string]: unknown;
|
|
469
616
|
};
|
|
470
617
|
/** The core modules observed (as the scenario's specs name them) and the functions on each. */
|
|
618
|
+
/** The callees the platform ran, by binding: each one's Worker name, and what the binding carried, for the regression test. */
|
|
619
|
+
readonly callees?: Readonly<Record<string, {
|
|
620
|
+
readonly name: string;
|
|
621
|
+
readonly entrypoint?: string;
|
|
622
|
+
readonly props?: Readonly<Record<string, unknown>>;
|
|
623
|
+
}>>;
|
|
624
|
+
/** The aliases the platform ran with, for the regression test. */
|
|
625
|
+
readonly aliases?: Readonly<Record<string, string>>;
|
|
471
626
|
readonly observed?: readonly {
|
|
472
627
|
readonly module: string;
|
|
473
628
|
readonly functions: readonly string[];
|
|
@@ -498,6 +653,12 @@ interface WorkerdCheckInput {
|
|
|
498
653
|
readonly modules: ModuleGlob;
|
|
499
654
|
/** The generated `specs.ts` entries, by module key. */
|
|
500
655
|
readonly specEntries: Readonly<Record<string, SpecEntry>>;
|
|
656
|
+
/** The callees the scenario names, by binding: each one's Worker name and module exports, imported by the generated test. */
|
|
657
|
+
readonly callees?: Readonly<Record<string, CalleeModule>>;
|
|
658
|
+
/** SQL files outside the scenario's directory, by the key `schemasFor` looks up. */
|
|
659
|
+
readonly extraSql?: Readonly<Record<string, string>>;
|
|
660
|
+
/** Qualified binding names that are aliases of the caller's bindings (shared resources). */
|
|
661
|
+
readonly aliases?: Readonly<Record<string, string>>;
|
|
501
662
|
readonly seed: string;
|
|
502
663
|
readonly maxRuns?: number;
|
|
503
664
|
readonly budgetMs?: number;
|
|
@@ -505,5 +666,5 @@ interface WorkerdCheckInput {
|
|
|
505
666
|
}
|
|
506
667
|
/** Run the scenario's check, with its specs observed, and return what the CLI reads back. */
|
|
507
668
|
export declare function checkInWorkerd(input: WorkerdCheckInput): Promise<CheckTransport>;
|
|
508
|
-
export { type CheckTransport, type CloudflarePlatformOptions, type CloudflareRegressionOptions, type CloudflareScenarioInput, type CronDrive, type CronOptions, type CronTickSpec, type D1Setup, type DifferentialResult, type DurableObjectSetup, type DurableObjectTestHelpers, type HttpCallerOptions, type HttpDrive, type HttpRequestInput, type HttpRequestSpec, type QueueDrive, type QueueMessage, type R2Setup, type RpcCallInput, type RpcCallSpec, type RpcCallerOptions, type RpcDrive, type ScriptedReply, type ServiceResponse, type ServiceSetup, type SpecEntry, type WorkerEntrypointClass, type WorkerHandler, type WorkerdCheckInput, type WorkflowSetup, atLeastOnce, atMostOncePerKey };
|
|
669
|
+
export { type CalleeModule, type CalleeSetup, type CheckTransport, type CloudflarePlatformOptions, type CloudflareRegressionOptions, type CloudflareScenarioInput, type CronDrive, type CronOptions, type CronTickSpec, type D1Setup, type DifferentialResult, type DurableObjectSetup, type DurableObjectSqlSeed, type DurableObjectTestHelpers, type HttpCallerOptions, type HttpDrive, type HttpRequestInput, type HttpRequestSpec, type QueueDrive, type QueueMessage, type R2Setup, type RpcCallInput, type RpcCallSpec, type RpcCallerOptions, type RpcDrive, type ScriptedReply, type ServiceResponse, type ServiceSetup, type SpecEntry, type SqlRow, type WebSocketConnectionInput, type WebSocketDrive, type WebSocketMessageInput, type WorkerEntrypointClass, type WorkerHandler, type WorkerdCheckInput, type WorkflowSetup, atLeastOnce, atMostOncePerKey };
|
|
509
670
|
//# sourceMappingURL=cloudflare.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloudflare.d.mts","names":[],"sources":["../../cli/src/regression.ts","../../cloudflare/src/
|
|
1
|
+
{"version":3,"file":"cloudflare.d.mts","names":[],"sources":["../../cli/src/regression.ts","../../cloudflare/src/d1.ts","../../cloudflare/src/r2.ts","../../cloudflare/src/scenario.ts","../../cloudflare/src/callees.ts","../../cloudflare/src/check.ts","../../cloudflare/src/durable-objects.ts","../../cloudflare/src/platform.ts","../../cloudflare/src/differential.ts","../../cli/src/workerd.ts"],"mappings":";;;UAGiB;;WAEN;;WAEA;;WAEA,aAAa,SAAS;;;;;WAKtB;;WAEA;;WAEA;;;;;WAKA;;WAEA;;;;;;WAMA,UAAU,SACjB;aAGa;aACA;aACA;aACA,QAAQ,SAAS;;;;;;WAQvB;;WAEA,UAAU,SAAS;WACnB;WACA;;WAEA;aACE;aACA;;;;wBA0BG,yBACd,SAAS,UACT,SAAS;;wBCsLW,WACpB,MAAM,aACL;YAAoB,yBAAyB;;;KCxBpC;WAGG;WACA,iBAAiB,SAAS;WAC1B,eAAe,SAAS;;;UCpNtB;WACN;WACA,MAAM;;;UAIA,mBAAmB;WACzB;WACA;WACA;aAA8B;aAAqB,MAAM;;;;UAInD;WACN;WACA;WACA;WACA;cAAsB;;;WAEtB,OAAO;;;KAIN;WACD;WACA;WACA;WACA;cAAqB;;;WAErB,OAAO;;;;;;;;;;;;UAaD,kBAAkB;WACxB;WACA,mBAAmB;WACnB;WACA;WACA;WACA;;UAGM;WACN;WACA;WACA;WACA;;wBAGK,KACd,mBAAmB,oBACnB,UAAS,oBACR;;KAkBS;WACD;WACA,MAAM;;;KAIL;WACD;WACA;WACA,SAAS,SAAS;WAClB,mBAAmB;;;;;;;;;UAUb,uBAAuB;WAC7B;WACA,sBAAsB;;UAGhB;WACN;WACA,MAAM;;UAGA;;WAEN;WACA;WACA,UAAU,SAAS;;WAEnB,oBAAoB;;wBAGf,UAAU,sBAAsB,6BAA6B;;UAmB5D;WACN;WACA;WACA,gBAAgB;;;KAIf;WACD;WACA;WACA,eAAe;;;;;;;;;;;;UAaT,iBAAiB;WACvB;WACA;WACA,gBAAgB;WAChB;WACA;WACA;;UAGM;WACN;WACA;WACA;WACA;;wBAGK,IAAI,gBAAgB,gBAAgB,UAAS,mBAAwB;;KAqBzE;WAA0B;WAAqB;;;;;;;;;;UAU1C,kBAAkB;WACxB;WACA;WACA,gBAAgB;WAChB;;UAGM;;WAEN;WACA;;wBAGK,KAAK,oBAAoB,UAAS,cAAmB;;KAazD,QAAQ,aAAa,YAAY,WAAW,YAAY;;UAiGnD,gBAAgB;WACtB;WACA;WACA;;;;;;;UAQM,2BAA2B;WACjC;WACA;WACA;cAAqB;gBAA2B,cAAc;;;;;;;WAK9D;;WAEA;cAAkB,eAAe;;;;KAIhC;;WAED;WACA;cAAmB,yBAAyB;;;;KAI3C;YAAqB,iBAAiB;;wBAElC,cACd,iBACA;YAAqB;cAA2B,cAAc;;GAC9D;WACW;WACA;cAAkB,eAAe;;IAE3C;;UAWc,gBAAgB;WACtB;WACA;WACA,SAAS,SAAS,eAAe;;wBAG5B,SAAS,iBAAiB,UAAS,SAAS,eAAe,WAAgB;;;;;;wBAS3E,KACd,iBACA,kDACC;;wBAQa,OAAO,iBAAiB,iBAAiB,iBAAiB;;;;;wBAS1D,WACd,cACA,OAAO,YACP,cACA,SAAS,YACT,iBACC;;UAKc,sBAAsB;WAC5B;WACA;WACA;;WAEA;;wBAGK,SACd,iBACA,mBACA;WAAoB;IACnB;;KAUS;WAA2B,SAAS;;WAAyB;;;KAG7D;WACD;WACA;WACA;WACA;cAAsB;;WACtB,OAAO;;;;;;;;;;;UAYD,qBAAqB;WAC3B;WACA;WACA;cAAsB,iBAAiB;;WACvC,iBAAiB;;wBAGZ,QACd,iBACA;WACW;cAAsB,iBAAiB;;WACvC,iBAAiB;IAE3B;;;;;;;;;;;UAmBc,oBAAoB;WAC1B;WACA;;WAEA;;WAEA;;WAEA;;wBAGK,OACd,iBACA;WAAmB;WAAwB;WAAyB;IACnE;;wBAoCa,YAAY,iBAAiB,kBAAkB;;wBAS/C,aAAa,iBAAiB,gBAAgB;;wBAU9C,aAAa,iBAAiB,iBAAiB,iBAAiB;;;;;wBAYhE,kBACd,iBACA,gBACA,iBAAiB,iBAChB;;;;;;wBAUa,mBACd,iBACA,gBACA,eACA,iBAAiB,iBAChB;UAMc;WACN;WACA,QAAQ;WACR,OACL,aACA,YACA,WACA,YACA;aAEW;aACA;aACA,mBAAmB;;WAEzB,kBACL,cACA,UACA,qBACA,UACA,gBACA;WAEK,qBAAqB;WACrB,qBAAqB;WACrB,SAAS,QAAQ;;WAEjB;;wBAGK,MAAM,cAAc,mBAAmB,iBAAiB;wBAQxD,SAAS,iBAAiB,qBAAqB;;;;;;;wBAU/C,QAAQ,iBAAiB,uBAA8B;;wBAKvD,OAAO,iBAAiB,+BAAwC;;wBAKhE,QAAQ;;;;;;;;;wBAYR,QACd,cACA,kBACA,QAAQ,gBACR,UAAS,KAAK,gCACb;;;;;;;wBAUa,sBACd,cACA,OAAO,OACP,QAAQ,gBACR,aACA,kBACC;;;;;;wBAsCa,kBAAkB,qBAAqB;;;;;;wBASvC,aACd,cACA;WAAoB;IACnB;;;;;;wBAca,YACd,gBACA;WAAoB;WAAuB;IAC1C;;wBAUa,OACd,iBACA,eACA,iBAAiB,iBAChB;;wBAKa,SACd,cACA,OAAO,YACP,gBAAgB,iBACf;;wBAKa,OAAO,cAAc,OAAO,YAAY,eAAe;;wBAKvD,QACd,cACA,MAAM,gBACN,aACA,OAAO,YACP,iBACC;;wBAKa,SAAS,oBAAoB;;;;;;;wBAe7B,SACd,cACA,cACA;WAAoB;WAA4B,qBAAqB;IACpE;;;;;wBAaa,UAAU,sBAAsB,kBAAkB;;wBAgJlD,eAAe,OAAO,0BAA0B;;;;;;;;UCl9B/C;WACN;WACA,SAAS,SAAS;WAClB;WACA,QAAQ,SAAS,eAAe;;;;;;;;;;;wBAwB3B,UACd,cACA,aACA,UAAS,SAAS;;wBChEJ,MACd,MAAM,cACN,UAAU,UACV,UAAS,iBACR,QAAQ;;wBAKW,YACpB,MAAM,cACN,UAAU,UACV,UAAU,iBACT;;;;;;UCqFc;WACN;WACA;WACA;;;UCtEM;EACf,OAAO,OAAO,uBAAuB,cAAc,KAAK,0BAA0B;EAClF,OAAO,SAAS,SAAS,cAAc,KAAK,mBAAmB,WAAW,QAAQ;EAClF,WACE,YAAY,qBACZ,cACA,KAAK,0BACG;;;KAIA,sCAAsC,KAAK,kBAAkB;UAExD;;WAEN;;;;;;WAMA,SAAS,gBAAgB;;WAEzB,SAAS,SAAS;;WAElB;;;;;;WAMA,iBAAiB;;;;;WAKjB,UAAU,SAAS;;;;;;WAMnB,UAAU,SAAS,eAAe;;;;;;;;WAQlC,UAAU,SAAS;;wBAiCd,yBAAyB,SAAS,4BAA4B;;KCnFlE;WACD;WACA;WACA;;WAEA;;WAEA;;WAEA,SAAS;;UAGH;WACN,mBAAmB;WACnB;cACG;gBAA8B,yBAAyB;;;;UAIpD;;WAEN;WACA,QAAQ;WACR,KAAK;WACL;;WAEA;;;wBAwYW,gBACpB,MAAM,cACN,SAAS,4BACR,QAAQ;;UCvbM;WACN;;WAEA,sBAAsB;WACtB;aAAmB;aAAwB;;WAC3C;aAA2B;cAAwB;;;WAEnD;aAAmB;cAAwB;;;;WAG3C,UAAU,SACjB;aAGa;aACA;aACA,QAAQ,SAAS;;;WAKvB,UAAU,SAAS;WACnB;aAA+B;aAAyB;;;UAGlD;WACN;WACA;WACA;;;UAIM;WACN,OAAO;WACP,YAAY;;;KAIX,aAAa,SAAS,qBAAqB;UAqFtC;;WAEN,UAAU;;WAEV;;WAEA,gBAAgB;;WAEhB,UAAU,SAAS;;WAEnB,SAAS;;WAET,aAAa,SAAS,eAAe;;WAErC,UAAU,SAAS,eAAe;;WAElC,WAAW,SAAS;;WAEpB,UAAU,SAAS;WACnB;WACA;WACA;WACA;;;wBAIW,eAAe,OAAO,oBAAoB,QAAQ"}
|
package/dist/cloudflare.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { r as atMostOncePerKey, t as atLeastOnce } from "./delivery-invariants-
|
|
2
|
-
import { A as
|
|
3
|
-
export { atLeastOnce, atLeastOncePerMessage, atMostOncePerKey, check, checkInWorkerd, cloudflareRegressionTest, createCloudflarePlatform, cron, d1Param, d1Read, d1Rows, d1Schema, d1Write, defineScenario, durableObject, durableObjectRows, everyRow, expectHolds, external, fetchCall, http, httpResponse, implies, queue, queueAck, r2Bucket, r2Op, r2Rows, references, refines, rpc, rpcResponse, runDifferential, service, serviceCall, snapshotD1, unique, workflow, workflowRows, workflowStep };
|
|
1
|
+
import { r as atMostOncePerKey, t as atLeastOnce } from "./delivery-invariants-_T9ZMwOJ.mjs";
|
|
2
|
+
import { A as r2Bucket, B as webSocketReceived, C as external, D as implies, E as httpResponse, F as rpc, G as cloudflareRegressionTest, H as workflow, I as rpcResponse, L as service, M as r2Rows, N as references, O as queue, P as refines, R as serviceCall, S as everyRow, T as http, U as workflowRows, V as websocket, W as workflowStep, _ as d1Write, a as createCloudflarePlatform, b as durableObjectRows, c as expectHolds, d as callee, f as cron, g as d1Schema, h as d1Rows, i as runDifferential, j as r2Op, k as queueAck, l as calleeEnv, m as d1Read, o as snapshotD1, p as d1Param, s as check, t as checkInWorkerd, u as atLeastOncePerMessage, v as defineScenario, w as fetchCall, x as durableObjectTable, y as durableObject, z as unique } from "./workerd-DVJ8eCLI.mjs";
|
|
3
|
+
export { atLeastOnce, atLeastOncePerMessage, atMostOncePerKey, callee, calleeEnv, check, checkInWorkerd, cloudflareRegressionTest, createCloudflarePlatform, cron, d1Param, d1Read, d1Rows, d1Schema, d1Write, defineScenario, durableObject, durableObjectRows, durableObjectTable, everyRow, expectHolds, external, fetchCall, http, httpResponse, implies, queue, queueAck, r2Bucket, r2Op, r2Rows, references, refines, rpc, rpcResponse, runDifferential, service, serviceCall, snapshotD1, unique, webSocketReceived, websocket, workflow, workflowRows, workflowStep };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as getPath } from "./src-DPCF2XGv.mjs";
|
|
2
2
|
// packages/core/src/delivery.ts
|
|
3
3
|
/** The invocation one attempt of an event runs as: `<event>#<attempt>`, so a schedule's faults stay keyed when other events are removed. */
|
|
4
4
|
function invocationOf(event) {
|
|
@@ -59,4 +59,4 @@ function atLeastOncePerMessage(name, events, effect, key, bodyKey) {
|
|
|
59
59
|
}
|
|
60
60
|
export { redelivery as a, invocationOf as i, atLeastOncePerMessage as n, atMostOncePerKey as r, atLeastOnce as t };
|
|
61
61
|
|
|
62
|
-
//# sourceMappingURL=delivery-invariants-
|
|
62
|
+
//# sourceMappingURL=delivery-invariants-_T9ZMwOJ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-invariants-
|
|
1
|
+
{"version":3,"file":"delivery-invariants-_T9ZMwOJ.mjs","names":[],"sources":["../../core/src/delivery.ts","../../core/src/delivery-invariants.ts"],"sourcesContent":["/**\n * The delivery conventions every platform shares, and the differential\n * runner's raw sides with them: how an attempt names its invocation, and\n * the redelivery rule, which applies the same reading of a platform's limit\n * without any of its proxy code.\n */\n\nimport type { EventRef } from \"./platform.ts\";\nimport type { Bounds } from \"./scenario.ts\";\n\n/** The invocation one attempt of an event runs as: `<event>#<attempt>`, so a schedule's faults stay keyed when other events are removed. */\nexport function invocationOf(event: EventRef): string {\n return `${event.id}#${event.attempt}`;\n}\n\n/**\n * The next attempt of an event that was not handled (a message not\n * acknowledged or deleted, a request its caller resends, an alarm that\n * failed), or null when it is dropped (dead-lettered, given up on). It is\n * delivered again while both the platform's own limit on redeliveries\n * (Queues' `max_retries`, the caller's `retries`, SQS's `maxReceiveCount`\n * less the first delivery, an alarm's six retries) and the scenario's\n * `maxRedeliveries` leave room; the redeliveries so far are `attempt - 1`.\n * Pure.\n */\nexport function redelivery(\n event: EventRef,\n limit: number,\n bounds: Pick<Bounds, \"maxRedeliveries\">,\n): EventRef | null {\n const redeliveries = event.attempt - 1;\n if (redeliveries >= limit || redeliveries >= bounds.maxRedeliveries) return null;\n return { ...event, attempt: event.attempt + 1 };\n}\n","/**\n * Constructors for the delivery invariants every platform's scenarios use:\n * nothing delivered twice, nothing lost. Platforms wrap them to take their\n * own drive shapes.\n */\n\nimport type { JsonValue } from \"./canonical-json.ts\";\nimport type { AtLeastOnce, AtMostOncePerKey } from \"./invariants.ts\";\nimport { type EffectSelector, getPath } from \"./selectors.ts\";\n\nexport function atMostOncePerKey(\n name: string,\n effect: EffectSelector,\n key: string,\n): AtMostOncePerKey {\n return { kind: \"atMostOncePerKey\", name, effect, key };\n}\n\nexport function atLeastOnce(\n name: string,\n effect: EffectSelector,\n key: string,\n expected: readonly JsonValue[],\n): AtLeastOnce {\n return { kind: \"atLeastOnce\", name, effect, key, expected };\n}\n\n/**\n * Every event's `bodyKey` value must appear at least once as `key` in a\n * selected effect. The expected keys are re-derived from the bodies that\n * remain when shrinking removes events.\n */\nexport function atLeastOncePerMessage(\n name: string,\n events: readonly { readonly id: string; readonly body: JsonValue }[],\n effect: EffectSelector,\n key: string,\n bodyKey: string,\n): AtLeastOnce {\n const expected: JsonValue[] = [];\n for (const e of events) {\n const v = getPath(e.body, bodyKey);\n if (v === undefined)\n throw new Error(`event ${e.id} has no ${JSON.stringify(bodyKey)} in its body`);\n expected.push(v);\n }\n return { ...atLeastOnce(name, effect, key, expected), perMessage: { bodyKey } };\n}\n"],"mappings":";;;AAWA,SAAgB,aAAa,OAAyB;CACpD,OAAO,GAAG,MAAM,GAAG,GAAG,MAAM;AAC9B;;;;;;;;;;;AAYA,SAAgB,WACd,OACA,OACA,QACiB;CACjB,MAAM,eAAe,MAAM,UAAU;CACrC,IAAI,gBAAgB,SAAS,gBAAgB,OAAO,iBAAiB,OAAO;CAC5E,OAAO;EAAE,GAAG;EAAO,SAAS,MAAM,UAAU;CAAE;AAChD;;ACvBA,SAAgB,iBACd,MACA,QACA,KACkB;CAClB,OAAO;EAAE,MAAM;EAAoB;EAAM;EAAQ;CAAI;AACvD;AAEA,SAAgB,YACd,MACA,QACA,KACA,UACa;CACb,OAAO;EAAE,MAAM;EAAe;EAAM;EAAQ;EAAK;CAAS;AAC5D;;;;;;AAOA,SAAgB,sBACd,MACA,QACA,QACA,KACA,SACa;CACb,MAAM,WAAwB,CAAC;CAC/B,KAAK,MAAM,KAAK,QAAQ;EACtB,MAAM,IAAI,QAAQ,EAAE,MAAM,OAAO;EACjC,IAAI,MAAM,KAAA,GACR,MAAM,IAAI,MAAM,SAAS,EAAE,GAAG,UAAU,KAAK,UAAU,OAAO,EAAE,aAAa;EAC/E,SAAS,KAAK,CAAC;CACjB;CACA,OAAO;EAAE,GAAG,YAAY,MAAM,QAAQ,KAAK,QAAQ;EAAG,YAAY,EAAE,QAAQ;CAAE;AAChF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __esmMin } from "./rolldown-runtime-C1I3wEg2.mjs";
|
|
2
|
-
import { Fn as hasOwn, Pt as fromUtf8, a as Crc32Node, at as fromHex, bn as init_transport, cn as TypeRegistry, jt as toUtf8, l as init_serde, n as init_checksum, on as init_schema, st as toHex } from "./checksum-
|
|
2
|
+
import { Fn as hasOwn, Pt as fromUtf8, a as Crc32Node, at as fromHex, bn as init_transport, cn as TypeRegistry, jt as toUtf8, l as init_serde, n as init_checksum, on as init_schema, st as toHex } from "./checksum-75EliDEr.mjs";
|
|
3
3
|
import { Readable } from "node:stream";
|
|
4
4
|
// node_modules/.pnpm/@smithy+core@3.36.2/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/Int64.js
|
|
5
5
|
function negate(bytes) {
|
|
@@ -798,4 +798,4 @@ __esmMin((() => {
|
|
|
798
798
|
}))();
|
|
799
799
|
export { EventStreamSerde, eventStreamSerdeProvider };
|
|
800
800
|
|
|
801
|
-
//# sourceMappingURL=event-streams-
|
|
801
|
+
//# sourceMappingURL=event-streams-lXGVdHFn.mjs.map
|