@mooloo-ai/eutaxy 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/README.md +16 -2
- package/dist/aws.d.mts +15464 -0
- package/dist/aws.d.mts.map +1 -0
- package/dist/aws.mjs +24057 -0
- package/dist/aws.mjs.map +1 -0
- package/dist/bin.d.mts +1 -0
- package/dist/bin.mjs +17 -0
- package/dist/bin.mjs.map +1 -0
- package/dist/checksum-DhS6ofSm.mjs +6049 -0
- package/dist/checksum-DhS6ofSm.mjs.map +1 -0
- package/dist/cli-DnPkIL8h.mjs +2 -0
- package/dist/cli.d.mts +8 -0
- package/dist/cli.d.mts.map +1 -0
- package/dist/cli.mjs +2 -0
- package/dist/cloudflare.d.mts +141 -0
- package/dist/cloudflare.d.mts.map +1 -0
- package/dist/cloudflare.mjs +847 -0
- package/dist/cloudflare.mjs.map +1 -0
- package/dist/es5-DtZuPEgt.mjs +1721 -0
- package/dist/es5-DtZuPEgt.mjs.map +1 -0
- package/dist/event-streams-BANyO9xt.mjs +801 -0
- package/dist/event-streams-BANyO9xt.mjs.map +1 -0
- package/dist/explore-C5fDFOoY.d.mts +63 -0
- package/dist/explore-C5fDFOoY.d.mts.map +1 -0
- package/dist/index.d.mts +24 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +5 -0
- package/dist/platform-CGVkTa16.d.mts +267 -0
- package/dist/platform-CGVkTa16.d.mts.map +1 -0
- package/dist/rolldown-runtime-C1I3wEg2.mjs +43 -0
- package/dist/src-B66we2mG.mjs +311 -0
- package/dist/src-B66we2mG.mjs.map +1 -0
- package/dist/src-BP6Iqc_9.mjs +117 -0
- package/dist/src-BP6Iqc_9.mjs.map +1 -0
- package/dist/src-BrCsF5RZ.mjs +1286 -0
- package/dist/src-BrCsF5RZ.mjs.map +1 -0
- package/dist/src-s6uYyC0B.mjs +89 -0
- package/dist/src-s6uYyC0B.mjs.map +1 -0
- package/dist/verdict-evEM5Gxx.mjs +12 -0
- package/dist/verdict-evEM5Gxx.mjs.map +1 -0
- package/package.json +76 -3
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.mts","names":[],"sources":["../../cli/src/main.ts"],"mappings":"A,UAqBiB;WACN;WACA,SAAS;WACT,SAAS;;wBAGE,KAAK,yBAAyB,IAAI,KAAK"}
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { E as JsonValue, _ as StateQuery, a as PlatformData, c as WorkerRef, d as AtMostOncePerKey, f as EffectSelector, g as RowCondition, h as Invariant, i as ExternalDecl, m as Implies, n as Platform, o as ScenarioSpec, p as EveryRow, r as Bounds, s as ScriptedResponse, u as AtLeastOnce } from "./platform-CGVkTa16.mjs";
|
|
2
|
+
import { c as Violated, o as ScenarioVerdict, t as ExploreOptions } from "./explore-C5fDFOoY.mjs";
|
|
3
|
+
interface CloudflareRegressionOptions {
|
|
4
|
+
/** Import path of the scenario module, relative to the emitted file. */
|
|
5
|
+
readonly scenarioPath: string;
|
|
6
|
+
/** Import path of the Worker module. */
|
|
7
|
+
readonly workerPath: string;
|
|
8
|
+
/** D1 binding name to schema file path, imported with `?raw`. */
|
|
9
|
+
readonly schemaPaths: Readonly<Record<string, string>>;
|
|
10
|
+
/** The platform's retry limit, when the scenario was checked with a non-default one. */
|
|
11
|
+
readonly maxRetries?: number;
|
|
12
|
+
readonly expect?: "holds" | "violates";
|
|
13
|
+
readonly engineModule?: string;
|
|
14
|
+
}
|
|
15
|
+
/** A Vitest regression test for a Cloudflare scenario, to run under the Cloudflare Vitest plugin. */
|
|
16
|
+
export declare function cloudflareRegressionTest(verdict: Violated, options: CloudflareRegressionOptions): string;
|
|
17
|
+
/** Explore a scenario on a platform and return its verdict. */
|
|
18
|
+
export declare function check(spec: ScenarioSpec, platform: Platform, options?: ExploreOptions): Promise<ScenarioVerdict>;
|
|
19
|
+
/** For use from a test: passes only when the scenario is BOUNDED. */
|
|
20
|
+
export declare function expectHolds(spec: ScenarioSpec, platform: Platform, options?: ExploreOptions): Promise<void>;
|
|
21
|
+
/** Every user table's rows, sorted canonically, read through the real binding (not an effect). */
|
|
22
|
+
export declare function snapshotD1(real: D1Database): Promise<{
|
|
23
|
+
readonly [table: string]: readonly JsonValue[];
|
|
24
|
+
}>;
|
|
25
|
+
interface QueueHandler {
|
|
26
|
+
queue?(batch: MessageBatch<unknown>, env: unknown, ctx: ExecutionContext): void | Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
interface CloudflarePlatformOptions {
|
|
29
|
+
/** The bindings from `cloudflare:workers`. */
|
|
30
|
+
readonly env: object;
|
|
31
|
+
/** The Worker's default export. */
|
|
32
|
+
readonly handler: QueueHandler;
|
|
33
|
+
/** Schema SQL per D1 binding named in the scenario's setup. */
|
|
34
|
+
readonly schemas: Readonly<Record<string, string>>;
|
|
35
|
+
/** Cloudflare's default when the consumer does not set max_retries. */
|
|
36
|
+
readonly maxRetries?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare function createCloudflarePlatform(options: CloudflarePlatformOptions): Platform;
|
|
39
|
+
interface AttemptRecord {
|
|
40
|
+
readonly event: string;
|
|
41
|
+
readonly attempt: number;
|
|
42
|
+
readonly status: "completed" | "errored";
|
|
43
|
+
readonly decision: "ack" | "retry" | null;
|
|
44
|
+
}
|
|
45
|
+
interface Side {
|
|
46
|
+
readonly attempts: readonly AttemptRecord[];
|
|
47
|
+
readonly state: {
|
|
48
|
+
readonly [binding: string]: {
|
|
49
|
+
readonly [table: string]: readonly JsonValue[];
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
interface DifferentialResult {
|
|
54
|
+
/** True only when both sides agree and the proxied run touched nothing unmodelled. */
|
|
55
|
+
readonly equal: boolean;
|
|
56
|
+
readonly eutaxy: Side;
|
|
57
|
+
readonly raw: Side;
|
|
58
|
+
readonly differences: readonly string[];
|
|
59
|
+
/** What the proxied run could not control; non-empty means the comparison proves nothing. */
|
|
60
|
+
readonly unsupported: readonly string[];
|
|
61
|
+
}
|
|
62
|
+
/** Run both sides and compare. The Eutaxy side runs first; both start from the schema. */
|
|
63
|
+
export declare function runDifferential(spec: ScenarioSpec, options: CloudflarePlatformOptions): Promise<DifferentialResult>;
|
|
64
|
+
/** One queue message to deliver; `id` defaults to its position. */
|
|
65
|
+
interface QueueMessage {
|
|
66
|
+
readonly id?: string;
|
|
67
|
+
readonly body: JsonValue;
|
|
68
|
+
}
|
|
69
|
+
/** Drive the Worker's `queue()` handler with these messages. */
|
|
70
|
+
interface QueueDrive extends PlatformData {
|
|
71
|
+
readonly kind: "queue";
|
|
72
|
+
readonly queue: string;
|
|
73
|
+
readonly messages: readonly {
|
|
74
|
+
readonly id: string;
|
|
75
|
+
readonly body: JsonValue;
|
|
76
|
+
}[];
|
|
77
|
+
}
|
|
78
|
+
/** Apply a SQL file to a D1 binding before each run. */
|
|
79
|
+
interface D1Setup extends PlatformData {
|
|
80
|
+
readonly kind: "d1";
|
|
81
|
+
readonly binding: string;
|
|
82
|
+
readonly schemaFile: string;
|
|
83
|
+
}
|
|
84
|
+
interface CloudflareScenarioInput {
|
|
85
|
+
readonly name: string;
|
|
86
|
+
readonly worker: WorkerRef;
|
|
87
|
+
readonly drive: QueueDrive | {
|
|
88
|
+
readonly kind: "queue";
|
|
89
|
+
readonly queue: string;
|
|
90
|
+
readonly messages: readonly QueueMessage[];
|
|
91
|
+
};
|
|
92
|
+
readonly setup?: readonly D1Setup[];
|
|
93
|
+
readonly externals?: readonly ExternalDecl[];
|
|
94
|
+
readonly invariants: readonly Invariant[];
|
|
95
|
+
readonly bounds?: Partial<Bounds>;
|
|
96
|
+
}
|
|
97
|
+
export declare function queue(name: string, messages: readonly QueueMessage[]): QueueDrive;
|
|
98
|
+
export declare function d1Schema(binding: string, schemaFile: string): D1Setup;
|
|
99
|
+
/**
|
|
100
|
+
* Effect conventions for D1 (what the proxies record):
|
|
101
|
+
* call payload { args: { sql, params } }
|
|
102
|
+
* result payload { args: { sql, params }, result: { changes, lastRowId } }
|
|
103
|
+
* A committed write is a `result` whose `result.changes` is at least 1.
|
|
104
|
+
*/
|
|
105
|
+
export declare function d1Write(binding: string, op?: "run" | "batch"): EffectSelector;
|
|
106
|
+
/** Dot path to the Nth bound parameter of a D1 statement, in an effect payload. */
|
|
107
|
+
export declare function d1Param(index: number): string;
|
|
108
|
+
export declare function atMostOncePerKey(name: string, effect: EffectSelector, key: string): AtMostOncePerKey;
|
|
109
|
+
export declare function atLeastOnce(name: string, effect: EffectSelector, key: string, expected: readonly JsonValue[]): AtLeastOnce;
|
|
110
|
+
/**
|
|
111
|
+
* Every message's `bodyKey` value must appear at least once as `key` in a
|
|
112
|
+
* selected effect: nothing the queue delivered may be lost.
|
|
113
|
+
*/
|
|
114
|
+
export declare function atLeastOncePerMessage(name: string, drive: QueueDrive, effect: EffectSelector, key: string, bodyKey: string): AtLeastOnce;
|
|
115
|
+
/** Rows of a D1 table in the end-of-run snapshot, optionally filtered. */
|
|
116
|
+
export declare function d1Rows(binding: string, table: string, where?: readonly RowCondition[]): StateQuery;
|
|
117
|
+
/** Every row the query selects satisfies all conditions. */
|
|
118
|
+
export declare function everyRow(name: string, query: StateQuery, holds: readonly RowCondition[]): EveryRow;
|
|
119
|
+
/** Every selected effect has a row whose column equals the effect's key. */
|
|
120
|
+
export declare function implies(name: string, when: EffectSelector, key: string, state: StateQuery, column: string): Implies;
|
|
121
|
+
/** Selects the acknowledgement that took effect for each message (explicit or implicit; not one ignored after a retry). */
|
|
122
|
+
export declare function queueAck(queueName: string): EffectSelector;
|
|
123
|
+
/**
|
|
124
|
+
* Declare an external service: requests to `host` are answered from
|
|
125
|
+
* `responses` (every request gets 200 and an empty body when omitted), and
|
|
126
|
+
* `dedupeBy` names the header whose value makes repeated requests
|
|
127
|
+
* idempotent at that service.
|
|
128
|
+
*/
|
|
129
|
+
export declare function external(name: string, host: string, options?: {
|
|
130
|
+
readonly dedupeBy?: string;
|
|
131
|
+
readonly responses?: readonly ScriptedResponse[];
|
|
132
|
+
}): ExternalDecl;
|
|
133
|
+
/**
|
|
134
|
+
* Selects the requests to an external that took effect: a request replayed
|
|
135
|
+
* under a dedupe key the external had already seen is not counted.
|
|
136
|
+
*/
|
|
137
|
+
export declare function fetchCall(externalName: string, method?: string): EffectSelector;
|
|
138
|
+
/** Build and validate a scenario spec; throws with every problem listed. */
|
|
139
|
+
export declare function defineScenario(input: CloudflareScenarioInput): ScenarioSpec;
|
|
140
|
+
export type { CloudflarePlatformOptions, CloudflareRegressionOptions, CloudflareScenarioInput, D1Setup, DifferentialResult, QueueDrive, QueueHandler, QueueMessage };
|
|
141
|
+
//# sourceMappingURL=cloudflare.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare.d.mts","names":[],"sources":["../../cli/src/regression.ts","../../cloudflare/src/check.ts","../../cloudflare/src/d1.ts","../../cloudflare/src/platform.ts","../../cloudflare/src/differential.ts","../../cloudflare/src/scenario.ts"],"mappings":";;UAGiB;;WAEN;;WAEA;;WAEA,aAAa,SAAS;;WAEtB;WACA;WACA;;;wBAIK,yBACd,SAAS,UACT,SAAS;;wBCVK,MACd,MAAM,cACN,UAAU,UACV,UAAS,iBACR,QAAQ;;wBAKW,YACpB,MAAM,cACN,UAAU,UACV,UAAU,iBACT;;wBCiOmB,WACpB,MAAM,aACL;YAAoB,yBAAyB;;UClO/B;EACf,OAAO,OAAO,uBAAuB,cAAc,KAAK,0BAA0B;;UAGnE;;WAEN;;WAEA,SAAS;;WAET,SAAS,SAAS;;WAElB;;wBAoCK,yBAAyB,SAAS,4BAA4B;UC1C7D;WACN;WACA;WACA;WACA;;UAGM;WACN,mBAAmB;WACnB;cACG;gBAA8B,yBAAyB;;;;UAIpD;;WAEN;WACA,QAAQ;WACR,KAAK;WACL;;WAEA;;;wBAkPW,gBACpB,MAAM,cACN,SAAS,4BACR,QAAQ;;UC1QM;WACN;WACA,MAAM;;;UAIA,mBAAmB;WACzB;WACA;WACA;aAA8B;aAAqB,MAAM;;;;UAInD,gBAAgB;WACtB;WACA;WACA;;UAGM;WACN;WACA,QAAQ;WACR,OACL;aAEW;aACA;aACA,mBAAmB;;WAEzB,iBAAiB;WACjB,qBAAqB;WACrB,qBAAqB;WACrB,SAAS,QAAQ;;wBAGZ,MAAM,cAAc,mBAAmB,iBAAiB;wBAQxD,SAAS,iBAAiB,qBAAqB;;;;;;;wBAU/C,QAAQ,iBAAiB,uBAA8B;;wBAKvD,QAAQ;wBAIR,iBACd,cACA,QAAQ,gBACR,cACC;wBAIa,YACd,cACA,QAAQ,gBACR,aACA,mBAAmB,cAClB;;;;;wBAQa,sBACd,cACA,OAAO,YACP,QAAQ,gBACR,aACA,kBACC;;wBAaa,OACd,iBACA,eACA,iBAAiB,iBAChB;;wBAKa,SACd,cACA,OAAO,YACP,gBAAgB,iBACf;;wBAKa,QACd,cACA,MAAM,gBACN,aACA,OAAO,YACP,iBACC;;wBAKa,SAAS,oBAAoB;;;;;;;wBAe7B,SACd,cACA,cACA;WAAoB;WAA4B,qBAAqB;IACpE;;;;;wBAaa,UAAU,sBAAsB,kBAAkB;;wBAUlD,eAAe,OAAO,0BAA0B"}
|