eutaxy 0.17.2 → 0.19.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.
Files changed (74) hide show
  1. package/README.md +15 -12
  2. package/dist/aws.d.mts +2 -2
  3. package/dist/aws.mjs +3 -2
  4. package/dist/aws.mjs.map +1 -1
  5. package/dist/bin.mjs +1 -1
  6. package/dist/check-zkHLdWyf.mjs +1281 -0
  7. package/dist/check-zkHLdWyf.mjs.map +1 -0
  8. package/dist/cli-CNAKqV9R.mjs +297 -0
  9. package/dist/cli-CNAKqV9R.mjs.map +1 -0
  10. package/dist/cli.d.mts.map +1 -1
  11. package/dist/cli.mjs +1 -1
  12. package/dist/cloudflare.d.mts +56 -5
  13. package/dist/cloudflare.d.mts.map +1 -1
  14. package/dist/cloudflare.mjs +6417 -3
  15. package/dist/cloudflare.mjs.map +1 -0
  16. package/dist/{delivery-invariants-DO3j1mmD.mjs → delivery-invariants-BJDck0K8.mjs} +2 -2
  17. package/dist/{delivery-invariants-DO3j1mmD.mjs.map → delivery-invariants-BJDck0K8.mjs.map} +1 -1
  18. package/dist/{delivery-invariants-D7DI7i8x.d.mts → delivery-invariants-C3GXJIbg.d.mts} +2 -2
  19. package/dist/{delivery-invariants-D7DI7i8x.d.mts.map → delivery-invariants-C3GXJIbg.d.mts.map} +1 -1
  20. package/dist/draft-DEUDffHa.mjs +467 -0
  21. package/dist/draft-DEUDffHa.mjs.map +1 -0
  22. package/dist/{src-fxWc6oGc.mjs → generate-TBJM3-2P.mjs} +3 -574
  23. package/dist/generate-TBJM3-2P.mjs.map +1 -0
  24. package/dist/index.d.mts +45 -37
  25. package/dist/index.d.mts.map +1 -1
  26. package/dist/index.mjs +7 -4
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/install-DkzpGA5D.mjs +611 -0
  29. package/dist/install-DkzpGA5D.mjs.map +1 -0
  30. package/dist/{explore-CkKiOuz6.d.mts → ir-KpC2epGn.d.mts} +88 -53
  31. package/dist/ir-KpC2epGn.d.mts.map +1 -0
  32. package/dist/keys-xtanNmuR.mjs +111 -0
  33. package/dist/keys-xtanNmuR.mjs.map +1 -0
  34. package/dist/mcp-B64Ko6y7.mjs +539 -0
  35. package/dist/mcp-B64Ko6y7.mjs.map +1 -0
  36. package/dist/{platform-D4hlJjm3.d.mts → platform-Cs9V9t2k.d.mts} +92 -11
  37. package/dist/platform-Cs9V9t2k.d.mts.map +1 -0
  38. package/dist/pool-CXN4CwGY.mjs +61 -0
  39. package/dist/pool-CXN4CwGY.mjs.map +1 -0
  40. package/dist/{provers-DS44OeEm.mjs → provers-D8VaY_OM.mjs} +18 -2
  41. package/dist/provers-D8VaY_OM.mjs.map +1 -0
  42. package/dist/reader-B9FSoEYW.mjs +1 -0
  43. package/dist/reader-Cz6_bLf6.mjs +3774 -0
  44. package/dist/reader-Cz6_bLf6.mjs.map +1 -0
  45. package/dist/report-_Vzavqg0.mjs +310 -0
  46. package/dist/report-_Vzavqg0.mjs.map +1 -0
  47. package/dist/src-B2DpVbMN.mjs +2 -0
  48. package/dist/src-BFGTvuA_.mjs +1235 -0
  49. package/dist/src-BFGTvuA_.mjs.map +1 -0
  50. package/dist/src-BtLZPRyG.mjs +120 -0
  51. package/dist/src-BtLZPRyG.mjs.map +1 -0
  52. package/dist/src-CB8DcvsK.mjs +1 -0
  53. package/dist/src-COuquJvI.mjs +269 -0
  54. package/dist/src-COuquJvI.mjs.map +1 -0
  55. package/dist/src-Chn-m_r1.mjs +1082 -0
  56. package/dist/src-Chn-m_r1.mjs.map +1 -0
  57. package/dist/src-DwYD3QQJ.mjs +346 -0
  58. package/dist/src-DwYD3QQJ.mjs.map +1 -0
  59. package/dist/{src-D_hHC_-3.mjs → src-Dx4QvrQb.mjs} +945 -548
  60. package/dist/src-Dx4QvrQb.mjs.map +1 -0
  61. package/dist/toolchain-DWfymxAJ.mjs +80 -0
  62. package/dist/toolchain-DWfymxAJ.mjs.map +1 -0
  63. package/dist/verdict-evEM5Gxx.mjs +12 -0
  64. package/dist/verdict-evEM5Gxx.mjs.map +1 -0
  65. package/package.json +4 -1
  66. package/dist/cli-B0Gs2mhT.mjs +0 -9445
  67. package/dist/cli-B0Gs2mhT.mjs.map +0 -1
  68. package/dist/explore-CkKiOuz6.d.mts.map +0 -1
  69. package/dist/platform-D4hlJjm3.d.mts.map +0 -1
  70. package/dist/provers-DS44OeEm.mjs.map +0 -1
  71. package/dist/src-D_hHC_-3.mjs.map +0 -1
  72. package/dist/src-fxWc6oGc.mjs.map +0 -1
  73. package/dist/workerd-DhrzU6AZ.mjs +0 -6300
  74. package/dist/workerd-DhrzU6AZ.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { F as getPath } from "./src-D_hHC_-3.mjs";
1
+ import { M as getPath } from "./src-Dx4QvrQb.mjs";
2
2
  // packages/core/src/delivery-invariants.ts
3
3
  /**
4
4
  * No two selected effects share the value at `key` (a dot path into the effect's payload): nothing
@@ -41,4 +41,4 @@ function atLeastOncePerMessage(name, events, effect, key, bodyKey) {
41
41
  }
42
42
  export { atLeastOncePerMessage as n, atMostOncePerKey as r, atLeastOnce as t };
43
43
 
44
- //# sourceMappingURL=delivery-invariants-DO3j1mmD.mjs.map
44
+ //# sourceMappingURL=delivery-invariants-BJDck0K8.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-invariants-DO3j1mmD.mjs","names":[],"sources":["../../core/src/delivery-invariants.ts"],"sourcesContent":["/**\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\n/**\n * No two selected effects share the value at `key` (a dot path into the effect's payload): nothing\n * happened twice for one key, a payment recorded twice, a message sent twice.\n */\nexport function atMostOncePerKey(\n name: string,\n effect: EffectSelector,\n key: string,\n): AtMostOncePerKey {\n return { kind: \"atMostOncePerKey\", name, effect, key };\n}\n\n/** Every value in `expected` appears at least once as `key` in a selected effect: nothing was lost. */\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":";;;;;;AAcA,SAAgB,iBACd,MACA,QACA,KACkB;CAClB,OAAO;EAAE,MAAM;EAAoB;EAAM;EAAQ;CAAI;AACvD;;AAGA,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
+ {"version":3,"file":"delivery-invariants-BJDck0K8.mjs","names":[],"sources":["../../core/src/delivery-invariants.ts"],"sourcesContent":["/**\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\n/**\n * No two selected effects share the value at `key` (a dot path into the effect's payload): nothing\n * happened twice for one key, a payment recorded twice, a message sent twice.\n */\nexport function atMostOncePerKey(\n name: string,\n effect: EffectSelector,\n key: string,\n): AtMostOncePerKey {\n return { kind: \"atMostOncePerKey\", name, effect, key };\n}\n\n/** Every value in `expected` appears at least once as `key` in a selected effect: nothing was lost. */\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":";;;;;;AAcA,SAAgB,iBACd,MACA,QACA,KACkB;CAClB,OAAO;EAAE,MAAM;EAAoB;EAAM;EAAQ;CAAI;AACvD;;AAGA,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,4 +1,4 @@
1
- import { C as EffectSelector, d as AtMostOncePerKey, k as JsonValue, u as AtLeastOnce } from "./platform-D4hlJjm3.mjs";
1
+ import { M as JsonValue, T as EffectSelector, f as AtLeastOnce, p as AtMostOncePerKey } from "./platform-Cs9V9t2k.mjs";
2
2
  /**
3
3
  * No two selected effects share the value at `key` (a dot path into the effect's payload): nothing
4
4
  * happened twice for one key, a payment recorded twice, a message sent twice.
@@ -7,4 +7,4 @@ declare function atMostOncePerKey(name: string, effect: EffectSelector, key: str
7
7
  /** Every value in `expected` appears at least once as `key` in a selected effect: nothing was lost. */
8
8
  declare function atLeastOnce(name: string, effect: EffectSelector, key: string, expected: readonly JsonValue[]): AtLeastOnce;
9
9
  export { atMostOncePerKey as n, atLeastOnce as t };
10
- //# sourceMappingURL=delivery-invariants-D7DI7i8x.d.mts.map
10
+ //# sourceMappingURL=delivery-invariants-C3GXJIbg.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-invariants-D7DI7i8x.d.mts","names":[],"sources":["../../core/src/delivery-invariants.ts"],"mappings":";;;;;iBAcgB,iBACd,cACA,QAAQ,gBACR,cACC;;iBAKa,YACd,cACA,QAAQ,gBACR,aACA,mBAAmB,cAClB"}
1
+ {"version":3,"file":"delivery-invariants-C3GXJIbg.d.mts","names":[],"sources":["../../core/src/delivery-invariants.ts"],"mappings":";;;;;iBAcgB,iBACd,cACA,QAAQ,gBACR,cACC;;iBAKa,YACd,cACA,QAAQ,gBACR,aACA,mBAAmB,cAClB"}
@@ -0,0 +1,467 @@
1
+ import { d as list, f as r2Bucket, h as workerName, m as sqliteClasses, p as readWranglerConfig, u as d1Id } from "./check-zkHLdWyf.mjs";
2
+ import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
3
+ import { basename, dirname, extname, join, relative, resolve } from "node:path";
4
+ // packages/cli/src/draft.ts
5
+ /**
6
+ * `eutaxy draft`: a scenario skeleton from a wrangler config and the Worker
7
+ * module it names. The config's bindings become setup steps, the Worker's
8
+ * handlers the drive, the hosts its code fetches the externals; the
9
+ * invariants and the drive's events are left as holes marked TODO, since
10
+ * only the author knows what must hold and which events matter. Nothing is
11
+ * imported or run: the config is read as JSON or JSONC and the module's
12
+ * source (with the modules it imports relatively) is scanned as text.
13
+ */
14
+ const text = (v) => typeof v === "string" ? v : "";
15
+ const record = (v) => typeof v === "object" && v !== null && !Array.isArray(v) ? v : {};
16
+ /** A path relative to `from`, with forward slashes and a leading `./`. */
17
+ function ref(from, to) {
18
+ const p = relative(from, to).split("\\").join("/");
19
+ return p.startsWith(".") ? p : `./${p}`;
20
+ }
21
+ /** Binding kinds the simulation does not proxy: a run that touches one is UNSUPPORTED. */
22
+ const unmodelled = {
23
+ kv_namespaces: "KV namespace",
24
+ ai: "Workers AI",
25
+ vectorize: "Vectorize index",
26
+ hyperdrive: "Hyperdrive config",
27
+ analytics_engine_datasets: "Analytics Engine dataset",
28
+ browser: "Browser Rendering",
29
+ send_email: "email sender",
30
+ dispatch_namespaces: "dispatch namespace",
31
+ mtls_certificates: "mTLS certificate",
32
+ secrets_store_secrets: "Secrets Store secret",
33
+ images: "Images",
34
+ version_metadata: "version metadata",
35
+ pipelines: "pipeline"
36
+ };
37
+ /**
38
+ * The schema file of a D1 binding, beside its config: `schema.sql`, else `<database_name>.sql`, else the
39
+ * only `.sql` file there; `found` false when none is, and the step names `schema.sql` to create.
40
+ */
41
+ function schemaOf(configDir, database) {
42
+ for (const name of ["schema.sql", database ? `${database}.sql` : ""]) if (name && existsSync(join(configDir, name))) return {
43
+ file: join(configDir, name),
44
+ found: true
45
+ };
46
+ const sql = readdirSync(configDir).filter((f) => f.endsWith(".sql"));
47
+ if (sql.length === 1) return {
48
+ file: join(configDir, sql[0]),
49
+ found: true
50
+ };
51
+ return {
52
+ file: join(configDir, "schema.sql"),
53
+ found: false
54
+ };
55
+ }
56
+ /**
57
+ * Migrations in the order wrangler applies them: by the number a name starts with, compared as a number
58
+ * (`2_add` before `10_seed`), then by name; a name with no number after the numbered ones.
59
+ */
60
+ function migrationOrder(a, b) {
61
+ const na = /^\d+/.exec(a)?.[0];
62
+ const nb = /^\d+/.exec(b)?.[0];
63
+ if (na !== void 0 && nb !== void 0 && Number(na) !== Number(nb)) return Number(na) - Number(nb);
64
+ if (na !== void 0 && nb === void 0) return -1;
65
+ if (na === void 0 && nb !== void 0) return 1;
66
+ return a < b ? -1 : a > b ? 1 : 0;
67
+ }
68
+ /**
69
+ * A migrations directory's files in the order wrangler applies them: its `.sql` files, and a
70
+ * subdirectory's `migration.sql` (one folder per migration, as drizzle-kit writes them).
71
+ */
72
+ function migrationFiles(dir) {
73
+ if (!existsSync(dir)) return [];
74
+ return readdirSync(dir, { withFileTypes: true }).sort((a, b) => migrationOrder(a.name, b.name)).flatMap((e) => {
75
+ if (e.isFile() && e.name.endsWith(".sql")) return [join(dir, e.name)];
76
+ const nested = join(dir, e.name, "migration.sql");
77
+ return e.isDirectory() && existsSync(nested) ? [nested] : [];
78
+ });
79
+ }
80
+ /** Wrangler configs under `root` (not in node_modules or dot directories), by their `name`. */
81
+ function configsByName(root, depth = 3) {
82
+ const out = /* @__PURE__ */ new Map();
83
+ const walk = (dir, left) => {
84
+ let entries;
85
+ try {
86
+ entries = readdirSync(dir, { withFileTypes: true });
87
+ } catch {
88
+ return;
89
+ }
90
+ for (const e of entries) {
91
+ const path = join(dir, e.name);
92
+ if (e.isDirectory()) {
93
+ if (left > 0 && e.name !== "node_modules" && !e.name.startsWith(".")) walk(path, left - 1);
94
+ } else if (e.name === "wrangler.jsonc" || e.name === "wrangler.json") {
95
+ const name = workerName(path);
96
+ if (name !== void 0 && !out.has(name)) out.set(name, path);
97
+ }
98
+ }
99
+ };
100
+ walk(root, depth);
101
+ return out;
102
+ }
103
+ /** The source of a module and of the modules it imports by relative path, transitively. */
104
+ function sources(entry) {
105
+ const seen = /* @__PURE__ */ new Set();
106
+ const out = [];
107
+ const visit = (file) => {
108
+ if (seen.has(file) || !existsSync(file)) return;
109
+ seen.add(file);
110
+ const src = readFileSync(file, "utf8");
111
+ out.push(src);
112
+ for (const m of src.matchAll(/(?:\bfrom\s*|\bimport\s*\(?\s*)["'](\.{1,2}\/[^"']+)["']/g)) {
113
+ const spec = resolve(dirname(file), m[1]);
114
+ const found = [
115
+ spec,
116
+ spec.replace(/\.js$/, ".ts"),
117
+ `${spec}.ts`,
118
+ join(spec, "index.ts")
119
+ ].find((c) => existsSync(c) && extname(c) !== "");
120
+ if (found) visit(found);
121
+ }
122
+ };
123
+ visit(entry);
124
+ return out;
125
+ }
126
+ /**
127
+ * The hosts a module's code fetches by a literal URL, in order of first appearance, as `URL.host` has
128
+ * them (which the fetch interceptor matches): lowercase, a non-default port kept.
129
+ */
130
+ function fetchedHosts(srcs) {
131
+ const hosts = [];
132
+ for (const src of srcs) for (const m of src.matchAll(/\bfetch\(\s*["'`](https?):\/\/([a-z0-9.-]+)(?::(\d+))?/gi)) {
133
+ const port = m[3];
134
+ const defaultPort = m[1].toLowerCase() === "https" ? "443" : "80";
135
+ const host = `${m[2].toLowerCase()}${port && port !== defaultPort ? `:${port}` : ""}`;
136
+ if (!hosts.includes(host)) hosts.push(host);
137
+ }
138
+ return hosts;
139
+ }
140
+ /** An external's name from its host: the first label, made an identifier-like word, unique. */
141
+ function externalName(host, taken) {
142
+ const base = (host.split(".")[0] ?? host).replace(/[^a-z0-9-]/gi, "-") || "external";
143
+ let name = base;
144
+ for (let i = 2; taken.has(name); i++) name = `${base}-${i}`;
145
+ taken.add(name);
146
+ return name;
147
+ }
148
+ /**
149
+ * The SDK's route segment for an Agent's binding, as `routeAgentRequest` matches it: the Agents SDK's
150
+ * `camelCaseToKebabCase` (an all-caps name lowercased, else a dash before every capital).
151
+ */
152
+ function agentSegment(binding) {
153
+ if (binding === binding.toUpperCase() && binding !== binding.toLowerCase()) return binding.toLowerCase().replaceAll("_", "-");
154
+ const kebab = binding.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
155
+ return (kebab.startsWith("-") ? kebab.slice(1) : kebab).replaceAll("_", "-").replace(/-$/, "");
156
+ }
157
+ function draftScenario(input) {
158
+ const config = readWranglerConfig(input.config);
159
+ const configDir = dirname(input.config);
160
+ const scenarioDir = input.scenarioDir ?? configDir;
161
+ const name = text(config["name"]) || basename(configDir);
162
+ const main = text(config["main"]);
163
+ if (input.entry === void 0 && !main) throw new Error(`${basename(input.config)} names no main module; pass the Worker's module`);
164
+ const entry = input.entry ?? resolve(configDir, main);
165
+ if (!existsSync(entry)) throw new Error(`the Worker module ${entry} does not exist`);
166
+ const notes = [];
167
+ const setup = [];
168
+ const callerSrcs = sources(entry);
169
+ const srcs = [...callerSrcs];
170
+ const others = list(config["services"]).length > 0 ? configsByName(scenarioDir) : /* @__PURE__ */ new Map();
171
+ const callees = /* @__PURE__ */ new Map();
172
+ for (const s of list(config["services"])) {
173
+ const service = text(s["service"]);
174
+ const found = service && service !== name ? others.get(service) : void 0;
175
+ if (found !== void 0) callees.set(service, found);
176
+ }
177
+ const callerDatabases = new Map(list(config["d1_databases"]).map((db) => [d1Id(db), text(db["binding"])]));
178
+ const callerBuckets = new Map(list(config["r2_buckets"]).map((b) => [r2Bucket(b), text(b["binding"])]));
179
+ /** Classes of a callee's script the caller binds itself: one namespace, set up under the caller's name. */
180
+ const sharedClasses = new Set(list(record(config["durable_objects"])["bindings"]).filter((b) => callees.has(text(b["script_name"]))).map((b) => `${text(b["script_name"])}:${text(b["class_name"])}`));
181
+ /** The setup steps of one Worker's own resources: the caller's (prefix ""), or a callee's (`<name>/`). */
182
+ const resourceSteps = (cfg, dir, worker, prefix) => {
183
+ const sqlite = sqliteClasses(cfg);
184
+ for (const db of list(cfg["d1_databases"])) {
185
+ const binding = text(db["binding"]);
186
+ if (!binding) continue;
187
+ const shared = prefix ? callerDatabases.get(d1Id(db)) : void 0;
188
+ if (shared !== void 0) {
189
+ notes.push(`D1 ${prefix}${binding} is the caller's database ${shared}: set it up and read it as ${shared}`);
190
+ continue;
191
+ }
192
+ const schema = schemaOf(dir, text(db["database_name"]));
193
+ const pattern = text(db["migrations_pattern"]);
194
+ if (!schema.found && pattern) notes.push(`D1 ${prefix}${binding}: its migrations are the files matching ${pattern}; add a d1Schema step for each, in the order wrangler applies them`);
195
+ const migrations = schema.found || pattern ? [] : migrationFiles(join(dir, text(db["migrations_dir"]) || "migrations"));
196
+ if (migrations.length > 0) {
197
+ for (const file of migrations) setup.push({
198
+ kind: "d1",
199
+ binding: `${prefix}${binding}`,
200
+ schemaFile: ref(scenarioDir, file)
201
+ });
202
+ continue;
203
+ }
204
+ if (!schema.found && !pattern) notes.push(`D1 ${prefix}${binding}: no schema file found; write the tables it needs into ${ref(scenarioDir, schema.file)}`);
205
+ setup.push({
206
+ kind: "d1",
207
+ binding: `${prefix}${binding}`,
208
+ schemaFile: ref(scenarioDir, schema.file)
209
+ });
210
+ }
211
+ for (const b of list(record(cfg["durable_objects"])["bindings"])) {
212
+ const binding = text(b["name"]);
213
+ const className = text(b["class_name"]);
214
+ const script = text(b["script_name"]);
215
+ if (!binding) continue;
216
+ if (script && script !== worker) {
217
+ if (!prefix && callees.has(script)) setup.push({
218
+ kind: "durable_object",
219
+ binding,
220
+ sqlite: sqliteClasses(readWranglerConfig(callees.get(script))).has(className)
221
+ });
222
+ else notes.push(`Durable Object ${prefix}${binding} is ${script}'s class ${className}: name ${script} with callee() to run it`);
223
+ continue;
224
+ }
225
+ if (prefix && sharedClasses.has(`${worker}:${className}`)) {
226
+ notes.push(`Durable Object ${prefix}${binding} is the namespace the caller binds to ${worker}'s class ${className}: set it up and read it under the caller's name`);
227
+ continue;
228
+ }
229
+ setup.push({
230
+ kind: "durable_object",
231
+ binding: `${prefix}${binding}`,
232
+ sqlite: sqlite.has(className)
233
+ });
234
+ }
235
+ for (const b of list(cfg["r2_buckets"])) {
236
+ const binding = text(b["binding"]);
237
+ if (!binding) continue;
238
+ const shared = prefix ? callerBuckets.get(r2Bucket(b)) : void 0;
239
+ if (shared !== void 0) {
240
+ notes.push(`R2 ${prefix}${binding} is the caller's bucket ${shared}: set it up and read it as ${shared}`);
241
+ continue;
242
+ }
243
+ setup.push({
244
+ kind: "r2",
245
+ binding: `${prefix}${binding}`
246
+ });
247
+ }
248
+ for (const w of list(cfg["workflows"])) {
249
+ const binding = text(w["binding"]);
250
+ const className = text(w["class_name"]);
251
+ const script = text(w["script_name"]);
252
+ if (!binding || !className) continue;
253
+ if (script && script !== worker) {
254
+ notes.push(`Workflow ${prefix}${binding} runs in ${script}: name ${script} with callee() to run it`);
255
+ continue;
256
+ }
257
+ const workflowName = text(w["name"]);
258
+ setup.push({
259
+ kind: "workflow",
260
+ binding: `${prefix}${binding}`,
261
+ className,
262
+ ...workflowName ? { name: workflowName } : {}
263
+ });
264
+ }
265
+ for (const [key, what] of Object.entries(unmodelled)) {
266
+ const v = cfg[key];
267
+ const bindings = Array.isArray(v) ? list(v).map((b) => text(b["binding"]) || text(b["name"])) : v !== void 0 ? [text(record(v)["binding"]) || key] : [];
268
+ for (const b of bindings) notes.push(`not modelled: ${what} ${prefix}${b}; a run that touches it is UNSUPPORTED`);
269
+ }
270
+ for (const q of list(record(cfg["queues"])["producers"])) notes.push(`not modelled: Queue producer ${prefix}${text(q["binding"])}; a run that sends to it is UNSUPPORTED`);
271
+ };
272
+ resourceSteps(config, configDir, name, "");
273
+ for (const s of list(config["services"])) {
274
+ const binding = text(s["binding"]);
275
+ const service = text(s["service"]);
276
+ if (!binding) continue;
277
+ const calleeConfig = callees.get(service);
278
+ if (calleeConfig === void 0) {
279
+ setup.push({
280
+ kind: "service",
281
+ binding
282
+ });
283
+ notes.push(`service binding ${binding}: no wrangler config named ${service || "(none)"} under the scenario's directory, so its answers are scripted; script them with service(), or run that Worker with callee()`);
284
+ continue;
285
+ }
286
+ const callee = readWranglerConfig(calleeConfig);
287
+ const calleeDir = dirname(calleeConfig);
288
+ const calleeMain = resolve(calleeDir, text(callee["main"]));
289
+ setup.push({
290
+ kind: "callee",
291
+ binding,
292
+ entry: ref(scenarioDir, calleeMain),
293
+ config: ref(scenarioDir, calleeConfig)
294
+ });
295
+ resourceSteps(callee, calleeDir, service, `${service}/`);
296
+ srcs.push(...sources(calleeMain));
297
+ }
298
+ const outside = [entry, ...setup.flatMap((s) => s.kind === "d1" && !s.binding.includes("/") ? [resolve(scenarioDir, s.schemaFile)] : [])].filter((f) => relative(scenarioDir, f).startsWith(".."));
299
+ if (outside.length > 0) throw new Error(`eutaxy check finds the Worker's module and its schema files beneath the scenario's directory, and ${outside.map((f) => relative(scenarioDir, f)).join(", ")} is not; write the scenario beside the wrangler config or in a directory above the Worker`);
300
+ const consumers = list(record(config["queues"])["consumers"]);
301
+ const crons = Array.isArray(record(config["triggers"])["crons"]) ? record(config["triggers"])["crons"].filter((c) => typeof c === "string") : [];
302
+ const routesAgents = callerSrcs.some((s) => /\brouteAgentRequest\s*\(/.test(s));
303
+ const firstObject = setup.find((s) => s.kind === "durable_object" && !s.binding.includes("/"));
304
+ let drive;
305
+ if (consumers.length > 0) {
306
+ drive = {
307
+ kind: "queue",
308
+ queue: text(consumers[0]?.["queue"])
309
+ };
310
+ if (consumers.length > 1) notes.push(`the Worker consumes ${consumers.length} queues; one drive per scenario, so a scenario per queue`);
311
+ } else if (crons.length > 0) drive = {
312
+ kind: "cron",
313
+ cron: crons[0]
314
+ };
315
+ else if (routesAgents && firstObject) drive = {
316
+ kind: "websocket",
317
+ agent: agentSegment(firstObject.binding)
318
+ };
319
+ else drive = { kind: "http" };
320
+ if (drive.kind !== "cron" && crons.length > 0) notes.push(`the Worker also has Cron Triggers (${crons.join(", ")}); a scenario per drive`);
321
+ const taken = /* @__PURE__ */ new Set();
322
+ const externals = fetchedHosts(srcs).map((host) => ({
323
+ name: externalName(host, taken),
324
+ host
325
+ }));
326
+ return {
327
+ name,
328
+ worker: {
329
+ entry: ref(scenarioDir, entry),
330
+ config: ref(scenarioDir, input.config)
331
+ },
332
+ drive,
333
+ setup,
334
+ externals,
335
+ notes
336
+ };
337
+ }
338
+ const q = (s) => JSON.stringify(s);
339
+ function stepSource(s) {
340
+ switch (s.kind) {
341
+ case "d1": return `d1Schema(${q(s.binding)}, ${q(s.schemaFile)}),`;
342
+ case "durable_object": return s.sqlite ? `// SQLite-backed: seed tables with { sql: { <object name>: { schema, rows } } }.\n durableObject(${q(s.binding)}, {}),` : `durableObject(${q(s.binding)}, {}),`;
343
+ case "r2": return `r2Bucket(${q(s.binding)}),`;
344
+ case "workflow": return s.name === void 0 ? `workflow(${q(s.binding)}, ${q(s.className)}),` : `workflow(${q(s.binding)}, ${q(s.className)}, { name: ${q(s.name)} }),`;
345
+ case "callee": return `callee(${q(s.binding)}, { entry: ${q(s.entry)}, config: ${q(s.config)} }),`;
346
+ case "service": return `// TODO: the answers of the Worker behind ${s.binding}, e.g. { methods: { <method>: { value: … } } }.\n service(${q(s.binding)}),`;
347
+ }
348
+ }
349
+ function driveSource(d) {
350
+ switch (d.kind) {
351
+ case "queue": return {
352
+ helper: "queue",
353
+ source: `// TODO: the messages to deliver.\n drive: queue(${q(d.queue)}, [{ body: {} }]),`
354
+ };
355
+ case "cron": return {
356
+ helper: "cron",
357
+ source: `// TODO: how many ticks, and how many times a failed tick is re-run.\n drive: cron(${q(d.cron)}, { ticks: 2 }),`
358
+ };
359
+ case "websocket": return {
360
+ helper: "websocket",
361
+ source: `// TODO: the connections, the Agent instance they reach and the messages each sends.\n drive: websocket([\n { id: "a", path: ${q(`/agents/${d.agent}/<name>`)}, messages: [{ data: {} }] },\n ]),`
362
+ };
363
+ case "http": return {
364
+ helper: "http",
365
+ source: `// TODO: the requests, and how the caller resends one that got no 2xx.\n drive: http([{ path: "/", body: {} }], { retries: 3 }),`
366
+ };
367
+ }
368
+ }
369
+ /** Example invariants for the draft's bindings, as comments: the hole the author fills. */
370
+ function invariantHints(d) {
371
+ const hints = [];
372
+ const d1 = d.setup.find((s) => s.kind === "d1");
373
+ if (d1) hints.push(`unique("one-row-per-key", d1Rows(${q(d1.binding)}, "<table>"), "<column>"),`);
374
+ const sqliteObject = d.setup.find((s) => s.kind === "durable_object" && s.sqlite);
375
+ if (sqliteObject) hints.push(`everyRow("<rule>", durableObjectTable(${q(sqliteObject.binding)}, "<object name>", "<table>"), [{ column: "<column>", op: "gte", value: 0 }]),`);
376
+ const external = d.externals[0];
377
+ if (external) hints.push(`atMostOncePerKey("<call>-once", fetchCall(${q(external.name)}, "POST"), "args.body.<id>"),`);
378
+ if (hints.length === 0) hints.push(`atMostOncePerKey("<effect>-once", httpResponse("/", { ok: true }), "args.requestId"),`);
379
+ return hints;
380
+ }
381
+ /** The scenario's source. With no invariant it does not check until the holes are filled. */
382
+ function renderDraft(d) {
383
+ const drive = driveSource(d.drive);
384
+ const helpers = /* @__PURE__ */ new Set(["defineScenario", drive.helper]);
385
+ const stepHelper = {
386
+ d1: "d1Schema",
387
+ durable_object: "durableObject",
388
+ r2: "r2Bucket",
389
+ workflow: "workflow",
390
+ callee: "callee",
391
+ service: "service"
392
+ };
393
+ for (const s of d.setup) helpers.add(stepHelper[s.kind]);
394
+ if (d.externals.length > 0) helpers.add("external");
395
+ const imports = [...helpers].sort((a, b) => a.localeCompare(b));
396
+ const lines = [];
397
+ lines.push(`import { ${imports.join(", ")} } from "eutaxy/cloudflare";`, "");
398
+ lines.push(`// Drafted by eutaxy draft from ${d.worker.config}. Fill in each TODO, then run`, `// eutaxy check on this file; it does not check until it has an invariant.`);
399
+ for (const n of d.notes) lines.push(`// Note: ${n}.`);
400
+ lines.push(`export default defineScenario({`);
401
+ lines.push(` name: ${q(d.name)},`);
402
+ lines.push(` worker: { entry: ${q(d.worker.entry)}, config: ${q(d.worker.config)} },`);
403
+ if (d.setup.length > 0) {
404
+ lines.push(` setup: [`);
405
+ for (const s of d.setup) lines.push(` ${stepSource(s)}`);
406
+ lines.push(` ],`);
407
+ }
408
+ lines.push(` ${drive.source}`);
409
+ if (d.externals.length > 0) {
410
+ lines.push(` // Each host the Worker fetches answers 200 with an empty body until you script its responses.`);
411
+ lines.push(` externals: [`);
412
+ for (const e of d.externals) lines.push(` external(${q(e.name)}, ${q(e.host)}),`);
413
+ lines.push(` ],`);
414
+ }
415
+ lines.push(` invariants: [`);
416
+ lines.push(` // TODO: what must hold after every run, for example (import what you use from eutaxy/cloudflare):`);
417
+ for (const h of invariantHints(d)) lines.push(` // ${h}`);
418
+ lines.push(` ],`);
419
+ lines.push(` bounds: { maxFaultsPerRun: 1, maxRedeliveries: 2, maxConcurrentInvocations: 1, budgetMs: 2000 },`);
420
+ lines.push(`});`, "");
421
+ return lines.join("\n");
422
+ }
423
+ /** Exit 0 with the draft printed or written, 3 on an error. */
424
+ function runDraft(o) {
425
+ const config = o.config !== void 0 ? resolve(o.cwd, o.config) : ["wrangler.jsonc", "wrangler.json"].map((f) => join(o.cwd, f)).find((p) => existsSync(p));
426
+ if (config === void 0 || !existsSync(config)) {
427
+ o.stderr(config === void 0 ? "no wrangler.jsonc or wrangler.json in the working directory; name the config\n" : `wrangler config not found: ${config}\n`);
428
+ return 3;
429
+ }
430
+ const out = o.out === void 0 ? void 0 : resolve(o.cwd, o.out);
431
+ if (out !== void 0 && existsSync(out)) {
432
+ o.stderr(`${out} exists; eutaxy draft does not overwrite a file\n`);
433
+ return 3;
434
+ }
435
+ if (out !== void 0 && !existsSync(dirname(out))) {
436
+ o.stderr(`the directory of ${out} does not exist\n`);
437
+ return 3;
438
+ }
439
+ let draft;
440
+ try {
441
+ draft = draftScenario({
442
+ config,
443
+ ...o.worker === void 0 ? {} : { entry: resolve(o.cwd, o.worker) },
444
+ ...out === void 0 ? {} : { scenarioDir: dirname(out) }
445
+ });
446
+ } catch (err) {
447
+ o.stderr(`${err instanceof Error ? err.message : String(err)}\n`);
448
+ return 3;
449
+ }
450
+ const source = renderDraft(draft);
451
+ if (out !== void 0) writeFileSync(out, source);
452
+ if (o.json) o.stdout(`${JSON.stringify({
453
+ schemaVersion: 1,
454
+ draft,
455
+ source,
456
+ ...out === void 0 ? {} : { written: out }
457
+ }, null, 2)}\n`);
458
+ else if (out === void 0) o.stdout(source);
459
+ else {
460
+ o.stdout(`Scenario drafted in ${relative(o.cwd, out) || out}\n`);
461
+ for (const n of draft.notes) o.stdout(` note: ${n}\n`);
462
+ }
463
+ return 0;
464
+ }
465
+ export { runDraft as t };
466
+
467
+ //# sourceMappingURL=draft-DEUDffHa.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draft-DEUDffHa.mjs","names":[],"sources":["../../cli/src/draft.ts"],"sourcesContent":["/**\n * `eutaxy draft`: a scenario skeleton from a wrangler config and the Worker\n * module it names. The config's bindings become setup steps, the Worker's\n * handlers the drive, the hosts its code fetches the externals; the\n * invariants and the drive's events are left as holes marked TODO, since\n * only the author knows what must hold and which events matter. Nothing is\n * imported or run: the config is read as JSON or JSONC and the module's\n * source (with the modules it imports relatively) is scanned as text.\n */\n\nimport { existsSync, readdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { basename, dirname, extname, join, relative, resolve } from \"node:path\";\nimport { d1Id, list, r2Bucket, readWranglerConfig, sqliteClasses, workerName } from \"./wrangler.ts\";\n\n/** The drive a draft chooses, with what names its target; the events themselves are left to fill in. */\nexport type DraftDrive =\n | { readonly kind: \"queue\"; readonly queue: string }\n | { readonly kind: \"cron\"; readonly cron: string }\n | { readonly kind: \"websocket\"; readonly agent: string }\n | { readonly kind: \"http\" };\n\n/** A setup step a draft writes. Paths are relative to the scenario's directory. */\nexport type DraftStep =\n | { readonly kind: \"d1\"; readonly binding: string; readonly schemaFile: string }\n | { readonly kind: \"durable_object\"; readonly binding: string; readonly sqlite: boolean }\n | { readonly kind: \"r2\"; readonly binding: string }\n | {\n readonly kind: \"workflow\";\n readonly binding: string;\n readonly className: string;\n /** Its name in the config, which `event.workflowName` reads. */\n readonly name?: string;\n }\n | {\n readonly kind: \"callee\";\n readonly binding: string;\n readonly entry: string;\n readonly config: string;\n }\n | { readonly kind: \"service\"; readonly binding: string };\n\nexport interface Draft {\n readonly name: string;\n readonly worker: { readonly entry: string; readonly config: string };\n readonly drive: DraftDrive;\n readonly setup: readonly DraftStep[];\n readonly externals: readonly { readonly name: string; readonly host: string }[];\n /** What the draft could not decide or does not model, written into the file as comments. */\n readonly notes: readonly string[];\n}\n\nconst text = (v: unknown): string => (typeof v === \"string\" ? v : \"\");\nconst record = (v: unknown): Record<string, unknown> =>\n typeof v === \"object\" && v !== null && !Array.isArray(v) ? (v as Record<string, unknown>) : {};\n\n/** A path relative to `from`, with forward slashes and a leading `./`. */\nfunction ref(from: string, to: string): string {\n const p = relative(from, to).split(\"\\\\\").join(\"/\");\n return p.startsWith(\".\") ? p : `./${p}`;\n}\n\n/** Binding kinds the simulation does not proxy: a run that touches one is UNSUPPORTED. */\nconst unmodelled: Readonly<Record<string, string>> = {\n kv_namespaces: \"KV namespace\",\n ai: \"Workers AI\",\n vectorize: \"Vectorize index\",\n hyperdrive: \"Hyperdrive config\",\n analytics_engine_datasets: \"Analytics Engine dataset\",\n browser: \"Browser Rendering\",\n send_email: \"email sender\",\n dispatch_namespaces: \"dispatch namespace\",\n mtls_certificates: \"mTLS certificate\",\n secrets_store_secrets: \"Secrets Store secret\",\n images: \"Images\",\n version_metadata: \"version metadata\",\n pipelines: \"pipeline\",\n};\n\n/**\n * The schema file of a D1 binding, beside its config: `schema.sql`, else `<database_name>.sql`, else the\n * only `.sql` file there; `found` false when none is, and the step names `schema.sql` to create.\n */\nfunction schemaOf(configDir: string, database: string): { file: string; found: boolean } {\n for (const name of [\"schema.sql\", database ? `${database}.sql` : \"\"])\n if (name && existsSync(join(configDir, name)))\n return { file: join(configDir, name), found: true };\n const sql = readdirSync(configDir).filter((f) => f.endsWith(\".sql\"));\n if (sql.length === 1) return { file: join(configDir, sql[0] as string), found: true };\n return { file: join(configDir, \"schema.sql\"), found: false };\n}\n\n/**\n * Migrations in the order wrangler applies them: by the number a name starts with, compared as a number\n * (`2_add` before `10_seed`), then by name; a name with no number after the numbered ones.\n */\nexport function migrationOrder(a: string, b: string): number {\n const na = /^\\d+/.exec(a)?.[0];\n const nb = /^\\d+/.exec(b)?.[0];\n if (na !== undefined && nb !== undefined && Number(na) !== Number(nb))\n return Number(na) - Number(nb);\n if (na !== undefined && nb === undefined) return -1;\n if (na === undefined && nb !== undefined) return 1;\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n/**\n * A migrations directory's files in the order wrangler applies them: its `.sql` files, and a\n * subdirectory's `migration.sql` (one folder per migration, as drizzle-kit writes them).\n */\nfunction migrationFiles(dir: string): string[] {\n if (!existsSync(dir)) return [];\n return readdirSync(dir, { withFileTypes: true })\n .sort((a, b) => migrationOrder(a.name, b.name))\n .flatMap((e) => {\n if (e.isFile() && e.name.endsWith(\".sql\")) return [join(dir, e.name)];\n const nested = join(dir, e.name, \"migration.sql\");\n return e.isDirectory() && existsSync(nested) ? [nested] : [];\n });\n}\n\n/** Wrangler configs under `root` (not in node_modules or dot directories), by their `name`. */\nfunction configsByName(root: string, depth = 3): Map<string, string> {\n const out = new Map<string, string>();\n const walk = (dir: string, left: number): void => {\n let entries: import(\"node:fs\").Dirent[];\n try {\n entries = readdirSync(dir, { withFileTypes: true });\n } catch {\n return;\n }\n for (const e of entries) {\n const path = join(dir, e.name);\n if (e.isDirectory()) {\n if (left > 0 && e.name !== \"node_modules\" && !e.name.startsWith(\".\")) walk(path, left - 1);\n } else if (e.name === \"wrangler.jsonc\" || e.name === \"wrangler.json\") {\n const name = workerName(path); // an unreadable config names nothing\n if (name !== undefined && !out.has(name)) out.set(name, path);\n }\n }\n };\n walk(root, depth);\n return out;\n}\n\n/** The source of a module and of the modules it imports by relative path, transitively. */\nfunction sources(entry: string): string[] {\n const seen = new Set<string>();\n const out: string[] = [];\n const visit = (file: string): void => {\n if (seen.has(file) || !existsSync(file)) return;\n seen.add(file);\n const src = readFileSync(file, \"utf8\");\n out.push(src);\n // `from` clauses (imports and re-exports), side-effect imports and dynamic imports of a literal path.\n for (const m of src.matchAll(/(?:\\bfrom\\s*|\\bimport\\s*\\(?\\s*)[\"'](\\.{1,2}\\/[^\"']+)[\"']/g)) {\n const spec = resolve(dirname(file), m[1] as string);\n const candidates = [spec, spec.replace(/\\.js$/, \".ts\"), `${spec}.ts`, join(spec, \"index.ts\")];\n const found = candidates.find((c) => existsSync(c) && extname(c) !== \"\");\n if (found) visit(found);\n }\n };\n visit(entry);\n return out;\n}\n\n/**\n * The hosts a module's code fetches by a literal URL, in order of first appearance, as `URL.host` has\n * them (which the fetch interceptor matches): lowercase, a non-default port kept.\n */\nexport function fetchedHosts(srcs: readonly string[]): string[] {\n const hosts: string[] = [];\n for (const src of srcs)\n for (const m of src.matchAll(/\\bfetch\\(\\s*[\"'`](https?):\\/\\/([a-z0-9.-]+)(?::(\\d+))?/gi)) {\n const port = m[3];\n const defaultPort = (m[1] as string).toLowerCase() === \"https\" ? \"443\" : \"80\";\n const host = `${(m[2] as string).toLowerCase()}${port && port !== defaultPort ? `:${port}` : \"\"}`;\n if (!hosts.includes(host)) hosts.push(host);\n }\n return hosts;\n}\n\n/** An external's name from its host: the first label, made an identifier-like word, unique. */\nfunction externalName(host: string, taken: Set<string>): string {\n const base = (host.split(\".\")[0] ?? host).replace(/[^a-z0-9-]/gi, \"-\") || \"external\";\n let name = base;\n for (let i = 2; taken.has(name); i++) name = `${base}-${i}`;\n taken.add(name);\n return name;\n}\n\n/**\n * The SDK's route segment for an Agent's binding, as `routeAgentRequest` matches it: the Agents SDK's\n * `camelCaseToKebabCase` (an all-caps name lowercased, else a dash before every capital).\n */\nexport function agentSegment(binding: string): string {\n if (binding === binding.toUpperCase() && binding !== binding.toLowerCase())\n return binding.toLowerCase().replaceAll(\"_\", \"-\");\n const kebab = binding.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);\n return (kebab.startsWith(\"-\") ? kebab.slice(1) : kebab).replaceAll(\"_\", \"-\").replace(/-$/, \"\");\n}\n\nexport interface DraftInput {\n /** The wrangler config, absolute. */\n readonly config: string;\n /** The Worker module, absolute; default: the config's `main`. */\n readonly entry?: string;\n /** Where the scenario will live, absolute; default: the config's directory. */\n readonly scenarioDir?: string;\n}\n\nexport function draftScenario(input: DraftInput): Draft {\n const config = readWranglerConfig(input.config);\n const configDir = dirname(input.config);\n const scenarioDir = input.scenarioDir ?? configDir;\n const name = text(config[\"name\"]) || basename(configDir);\n const main = text(config[\"main\"]);\n if (input.entry === undefined && !main)\n throw new Error(`${basename(input.config)} names no main module; pass the Worker's module`);\n const entry = input.entry ?? resolve(configDir, main);\n if (!existsSync(entry)) throw new Error(`the Worker module ${entry} does not exist`);\n const notes: string[] = [];\n const setup: DraftStep[] = [];\n // The caller's own code decides the drive; with the callees' code it gives the externals.\n const callerSrcs = sources(entry);\n const srcs = [...callerSrcs];\n // The Workers behind the service bindings whose configs are found under the scenario's directory run\n // for real (callee()); their names decide which of the caller's bindings to their classes are shared.\n const others = list(config[\"services\"]).length > 0 ? configsByName(scenarioDir) : new Map();\n const callees = new Map<string, string>();\n for (const s of list(config[\"services\"])) {\n const service = text(s[\"service\"]);\n const found = service && service !== name ? others.get(service) : undefined;\n if (found !== undefined) callees.set(service, found);\n }\n // The caller's databases and buckets: a callee binding the same one reads it under the caller's name.\n const callerDatabases = new Map(\n list(config[\"d1_databases\"]).map((db) => [d1Id(db), text(db[\"binding\"])]),\n );\n const callerBuckets = new Map(\n list(config[\"r2_buckets\"]).map((b) => [r2Bucket(b), text(b[\"binding\"])]),\n );\n /** Classes of a callee's script the caller binds itself: one namespace, set up under the caller's name. */\n const sharedClasses = new Set(\n list(record(config[\"durable_objects\"])[\"bindings\"])\n .filter((b) => callees.has(text(b[\"script_name\"])))\n .map((b) => `${text(b[\"script_name\"])}:${text(b[\"class_name\"])}`),\n );\n\n /** The setup steps of one Worker's own resources: the caller's (prefix \"\"), or a callee's (`<name>/`). */\n const resourceSteps = (\n cfg: Record<string, unknown>,\n dir: string,\n worker: string,\n prefix: string,\n ): void => {\n const sqlite = sqliteClasses(cfg);\n for (const db of list(cfg[\"d1_databases\"])) {\n const binding = text(db[\"binding\"]);\n if (!binding) continue;\n const shared = prefix ? callerDatabases.get(d1Id(db)) : undefined;\n if (shared !== undefined) {\n notes.push(\n `D1 ${prefix}${binding} is the caller's database ${shared}: set it up and read it as ${shared}`,\n );\n continue;\n }\n const schema = schemaOf(dir, text(db[\"database_name\"]));\n // A pattern choosing the migration files is the config's own rule, which the draft does not apply.\n const pattern = text(db[\"migrations_pattern\"]);\n if (!schema.found && pattern)\n notes.push(\n `D1 ${prefix}${binding}: its migrations are the files matching ${pattern}; add a d1Schema step for each, in the order wrangler applies them`,\n );\n const migrations =\n schema.found || pattern\n ? []\n : migrationFiles(join(dir, text(db[\"migrations_dir\"]) || \"migrations\"));\n if (migrations.length > 0) {\n // No schema file, but migrations: one step per migration, applied in order as wrangler does.\n for (const file of migrations)\n setup.push({\n kind: \"d1\",\n binding: `${prefix}${binding}`,\n schemaFile: ref(scenarioDir, file),\n });\n continue;\n }\n if (!schema.found && !pattern)\n notes.push(\n `D1 ${prefix}${binding}: no schema file found; write the tables it needs into ${ref(scenarioDir, schema.file)}`,\n );\n setup.push({\n kind: \"d1\",\n binding: `${prefix}${binding}`,\n schemaFile: ref(scenarioDir, schema.file),\n });\n }\n for (const b of list(record(cfg[\"durable_objects\"])[\"bindings\"])) {\n const binding = text(b[\"name\"]);\n const className = text(b[\"class_name\"]);\n const script = text(b[\"script_name\"]);\n if (!binding) continue;\n if (script && script !== worker) {\n // Another Worker's class: one shared namespace when that Worker runs here as a callee.\n if (!prefix && callees.has(script))\n setup.push({\n kind: \"durable_object\",\n binding,\n sqlite: sqliteClasses(readWranglerConfig(callees.get(script) as string)).has(className),\n });\n else\n notes.push(\n `Durable Object ${prefix}${binding} is ${script}'s class ${className}: name ${script} with callee() to run it`,\n );\n continue;\n }\n if (prefix && sharedClasses.has(`${worker}:${className}`)) {\n notes.push(\n `Durable Object ${prefix}${binding} is the namespace the caller binds to ${worker}'s class ${className}: set it up and read it under the caller's name`,\n );\n continue;\n }\n setup.push({\n kind: \"durable_object\",\n binding: `${prefix}${binding}`,\n sqlite: sqlite.has(className),\n });\n }\n for (const b of list(cfg[\"r2_buckets\"])) {\n const binding = text(b[\"binding\"]);\n if (!binding) continue;\n const shared = prefix ? callerBuckets.get(r2Bucket(b)) : undefined;\n if (shared !== undefined) {\n notes.push(\n `R2 ${prefix}${binding} is the caller's bucket ${shared}: set it up and read it as ${shared}`,\n );\n continue;\n }\n setup.push({ kind: \"r2\", binding: `${prefix}${binding}` });\n }\n for (const w of list(cfg[\"workflows\"])) {\n const binding = text(w[\"binding\"]);\n const className = text(w[\"class_name\"]);\n const script = text(w[\"script_name\"]);\n if (!binding || !className) continue;\n if (script && script !== worker) {\n notes.push(\n `Workflow ${prefix}${binding} runs in ${script}: name ${script} with callee() to run it`,\n );\n continue;\n }\n const workflowName = text(w[\"name\"]);\n setup.push({\n kind: \"workflow\",\n binding: `${prefix}${binding}`,\n className,\n ...(workflowName ? { name: workflowName } : {}),\n });\n }\n for (const [key, what] of Object.entries(unmodelled)) {\n const v = cfg[key];\n const bindings = Array.isArray(v)\n ? list(v).map((b) => text(b[\"binding\"]) || text(b[\"name\"]))\n : v !== undefined\n ? [text(record(v)[\"binding\"]) || key]\n : [];\n for (const b of bindings)\n notes.push(`not modelled: ${what} ${prefix}${b}; a run that touches it is UNSUPPORTED`);\n }\n for (const q of list(record(cfg[\"queues\"])[\"producers\"]))\n notes.push(\n `not modelled: Queue producer ${prefix}${text(q[\"binding\"])}; a run that sends to it is UNSUPPORTED`,\n );\n };\n\n resourceSteps(config, configDir, name, \"\");\n for (const s of list(config[\"services\"])) {\n const binding = text(s[\"binding\"]);\n const service = text(s[\"service\"]);\n if (!binding) continue;\n const calleeConfig = callees.get(service);\n if (calleeConfig === undefined) {\n setup.push({ kind: \"service\", binding });\n notes.push(\n `service binding ${binding}: no wrangler config named ${service || \"(none)\"} under the scenario's directory, so its answers are scripted; script them with service(), or run that Worker with callee()`,\n );\n continue;\n }\n const callee = readWranglerConfig(calleeConfig);\n const calleeDir = dirname(calleeConfig);\n const calleeMain = resolve(calleeDir, text(callee[\"main\"]));\n setup.push({\n kind: \"callee\",\n binding,\n entry: ref(scenarioDir, calleeMain),\n config: ref(scenarioDir, calleeConfig),\n });\n resourceSteps(callee, calleeDir, service, `${service}/`);\n srcs.push(...sources(calleeMain));\n }\n\n // eutaxy check finds the Worker's module and its own schema files beneath the scenario's directory.\n const outside = [\n entry,\n ...setup.flatMap((s) =>\n s.kind === \"d1\" && !s.binding.includes(\"/\") ? [resolve(scenarioDir, s.schemaFile)] : [],\n ),\n ].filter((f) => relative(scenarioDir, f).startsWith(\"..\"));\n if (outside.length > 0)\n throw new Error(\n `eutaxy check finds the Worker's module and its schema files beneath the scenario's directory, and ${outside.map((f) => relative(scenarioDir, f)).join(\", \")} is not; write the scenario beside the wrangler config or in a directory above the Worker`,\n );\n\n // The drive: a queue consumer, else a Cron Trigger, else an Agent's WebSocket route, else fetch().\n const consumers = list(record(config[\"queues\"])[\"consumers\"]);\n const crons = Array.isArray(record(config[\"triggers\"])[\"crons\"])\n ? (record(config[\"triggers\"])[\"crons\"] as unknown[]).filter((c) => typeof c === \"string\")\n : [];\n const routesAgents = callerSrcs.some((s) => /\\brouteAgentRequest\\s*\\(/.test(s));\n const firstObject = setup.find((s) => s.kind === \"durable_object\" && !s.binding.includes(\"/\"));\n let drive: DraftDrive;\n if (consumers.length > 0) {\n drive = { kind: \"queue\", queue: text(consumers[0]?.[\"queue\"]) };\n if (consumers.length > 1)\n notes.push(\n `the Worker consumes ${consumers.length} queues; one drive per scenario, so a scenario per queue`,\n );\n } else if (crons.length > 0) drive = { kind: \"cron\", cron: crons[0] as string };\n else if (routesAgents && firstObject)\n drive = { kind: \"websocket\", agent: agentSegment(firstObject.binding) };\n else drive = { kind: \"http\" };\n if (drive.kind !== \"cron\" && crons.length > 0)\n notes.push(`the Worker also has Cron Triggers (${crons.join(\", \")}); a scenario per drive`);\n\n const taken = new Set<string>();\n const externals = fetchedHosts(srcs).map((host) => ({ name: externalName(host, taken), host }));\n return {\n name,\n worker: { entry: ref(scenarioDir, entry), config: ref(scenarioDir, input.config) },\n drive,\n setup,\n externals,\n notes,\n };\n}\n\nconst q = (s: string): string => JSON.stringify(s);\n\nfunction stepSource(s: DraftStep): string {\n switch (s.kind) {\n case \"d1\":\n return `d1Schema(${q(s.binding)}, ${q(s.schemaFile)}),`;\n case \"durable_object\":\n return s.sqlite\n ? `// SQLite-backed: seed tables with { sql: { <object name>: { schema, rows } } }.\\n durableObject(${q(s.binding)}, {}),`\n : `durableObject(${q(s.binding)}, {}),`;\n case \"r2\":\n return `r2Bucket(${q(s.binding)}),`;\n case \"workflow\":\n return s.name === undefined\n ? `workflow(${q(s.binding)}, ${q(s.className)}),`\n : `workflow(${q(s.binding)}, ${q(s.className)}, { name: ${q(s.name)} }),`;\n case \"callee\":\n return `callee(${q(s.binding)}, { entry: ${q(s.entry)}, config: ${q(s.config)} }),`;\n case \"service\":\n return `// TODO: the answers of the Worker behind ${s.binding}, e.g. { methods: { <method>: { value: … } } }.\\n service(${q(s.binding)}),`;\n }\n}\n\nfunction driveSource(d: DraftDrive): { helper: string; source: string } {\n switch (d.kind) {\n case \"queue\":\n return {\n helper: \"queue\",\n source: `// TODO: the messages to deliver.\\n drive: queue(${q(d.queue)}, [{ body: {} }]),`,\n };\n case \"cron\":\n return {\n helper: \"cron\",\n source: `// TODO: how many ticks, and how many times a failed tick is re-run.\\n drive: cron(${q(d.cron)}, { ticks: 2 }),`,\n };\n case \"websocket\":\n return {\n helper: \"websocket\",\n source: `// TODO: the connections, the Agent instance they reach and the messages each sends.\\n drive: websocket([\\n { id: \"a\", path: ${q(`/agents/${d.agent}/<name>`)}, messages: [{ data: {} }] },\\n ]),`,\n };\n case \"http\":\n return {\n helper: \"http\",\n source: `// TODO: the requests, and how the caller resends one that got no 2xx.\\n drive: http([{ path: \"/\", body: {} }], { retries: 3 }),`,\n };\n }\n}\n\n/** Example invariants for the draft's bindings, as comments: the hole the author fills. */\nfunction invariantHints(d: Draft): string[] {\n const hints: string[] = [];\n const d1 = d.setup.find((s) => s.kind === \"d1\");\n if (d1) hints.push(`unique(\"one-row-per-key\", d1Rows(${q(d1.binding)}, \"<table>\"), \"<column>\"),`);\n const sqliteObject = d.setup.find((s) => s.kind === \"durable_object\" && s.sqlite);\n if (sqliteObject)\n hints.push(\n `everyRow(\"<rule>\", durableObjectTable(${q(sqliteObject.binding)}, \"<object name>\", \"<table>\"), [{ column: \"<column>\", op: \"gte\", value: 0 }]),`,\n );\n const external = d.externals[0];\n if (external)\n hints.push(\n `atMostOncePerKey(\"<call>-once\", fetchCall(${q(external.name)}, \"POST\"), \"args.body.<id>\"),`,\n );\n if (hints.length === 0)\n hints.push(\n `atMostOncePerKey(\"<effect>-once\", httpResponse(\"/\", { ok: true }), \"args.requestId\"),`,\n );\n return hints;\n}\n\n/** The scenario's source. With no invariant it does not check until the holes are filled. */\nexport function renderDraft(d: Draft): string {\n const drive = driveSource(d.drive);\n const helpers = new Set<string>([\"defineScenario\", drive.helper]);\n const stepHelper: Record<DraftStep[\"kind\"], string> = {\n d1: \"d1Schema\",\n durable_object: \"durableObject\",\n r2: \"r2Bucket\",\n workflow: \"workflow\",\n callee: \"callee\",\n service: \"service\",\n };\n for (const s of d.setup) helpers.add(stepHelper[s.kind]);\n if (d.externals.length > 0) helpers.add(\"external\");\n const imports = [...helpers].sort((a, b) => a.localeCompare(b));\n const lines: string[] = [];\n lines.push(`import { ${imports.join(\", \")} } from \"eutaxy/cloudflare\";`, \"\");\n lines.push(\n `// Drafted by eutaxy draft from ${d.worker.config}. Fill in each TODO, then run`,\n `// eutaxy check on this file; it does not check until it has an invariant.`,\n );\n for (const n of d.notes) lines.push(`// Note: ${n}.`);\n lines.push(`export default defineScenario({`);\n lines.push(` name: ${q(d.name)},`);\n lines.push(` worker: { entry: ${q(d.worker.entry)}, config: ${q(d.worker.config)} },`);\n if (d.setup.length > 0) {\n lines.push(` setup: [`);\n for (const s of d.setup) lines.push(` ${stepSource(s)}`);\n lines.push(` ],`);\n }\n lines.push(` ${drive.source}`);\n if (d.externals.length > 0) {\n lines.push(\n ` // Each host the Worker fetches answers 200 with an empty body until you script its responses.`,\n );\n lines.push(` externals: [`);\n for (const e of d.externals) lines.push(` external(${q(e.name)}, ${q(e.host)}),`);\n lines.push(` ],`);\n }\n lines.push(` invariants: [`);\n lines.push(\n ` // TODO: what must hold after every run, for example (import what you use from eutaxy/cloudflare):`,\n );\n for (const h of invariantHints(d)) lines.push(` // ${h}`);\n lines.push(` ],`);\n lines.push(\n ` bounds: { maxFaultsPerRun: 1, maxRedeliveries: 2, maxConcurrentInvocations: 1, budgetMs: 2000 },`,\n );\n lines.push(`});`, \"\");\n return lines.join(\"\\n\");\n}\n\nexport interface DraftOptions {\n readonly cwd: string;\n /** The wrangler config; default: wrangler.jsonc or wrangler.json in the working directory. */\n readonly config?: string;\n /** The Worker module; default: the config's `main`. */\n readonly worker?: string;\n /** Where to write the scenario; default: print it. An existing file is not overwritten. */\n readonly out?: string;\n readonly json: boolean;\n readonly stdout: (text: string) => void;\n readonly stderr: (text: string) => void;\n}\n\n/** Exit 0 with the draft printed or written, 3 on an error. */\nexport function runDraft(o: DraftOptions): number {\n const config =\n o.config !== undefined\n ? resolve(o.cwd, o.config)\n : [\"wrangler.jsonc\", \"wrangler.json\"].map((f) => join(o.cwd, f)).find((p) => existsSync(p));\n if (config === undefined || !existsSync(config)) {\n o.stderr(\n config === undefined\n ? \"no wrangler.jsonc or wrangler.json in the working directory; name the config\\n\"\n : `wrangler config not found: ${config}\\n`,\n );\n return 3;\n }\n const out = o.out === undefined ? undefined : resolve(o.cwd, o.out);\n if (out !== undefined && existsSync(out)) {\n o.stderr(`${out} exists; eutaxy draft does not overwrite a file\\n`);\n return 3;\n }\n if (out !== undefined && !existsSync(dirname(out))) {\n o.stderr(`the directory of ${out} does not exist\\n`);\n return 3;\n }\n let draft: Draft;\n try {\n draft = draftScenario({\n config,\n ...(o.worker === undefined ? {} : { entry: resolve(o.cwd, o.worker) }),\n ...(out === undefined ? {} : { scenarioDir: dirname(out) }),\n });\n } catch (err) {\n o.stderr(`${err instanceof Error ? err.message : String(err)}\\n`);\n return 3;\n }\n const source = renderDraft(draft);\n if (out !== undefined) writeFileSync(out, source);\n if (o.json)\n o.stdout(\n `${JSON.stringify({ schemaVersion: 1, draft, source, ...(out === undefined ? {} : { written: out }) }, null, 2)}\\n`,\n );\n else if (out === undefined) o.stdout(source);\n else {\n o.stdout(`Scenario drafted in ${relative(o.cwd, out) || out}\\n`);\n for (const n of draft.notes) o.stdout(` note: ${n}\\n`);\n }\n return 0;\n}\n"],"mappings":";;;;;;;;;;;;;AAmDA,MAAM,QAAQ,MAAwB,OAAO,MAAM,WAAW,IAAI;AAClE,MAAM,UAAU,MACd,OAAO,MAAM,YAAY,MAAM,QAAQ,CAAC,MAAM,QAAQ,CAAC,IAAK,IAAgC,CAAC;;AAG/F,SAAS,IAAI,MAAc,IAAoB;CAC7C,MAAM,IAAI,SAAS,MAAM,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,GAAG;CACjD,OAAO,EAAE,WAAW,GAAG,IAAI,IAAI,KAAK;AACtC;;AAGA,MAAM,aAA+C;CACnD,eAAe;CACf,IAAI;CACJ,WAAW;CACX,YAAY;CACZ,2BAA2B;CAC3B,SAAS;CACT,YAAY;CACZ,qBAAqB;CACrB,mBAAmB;CACnB,uBAAuB;CACvB,QAAQ;CACR,kBAAkB;CAClB,WAAW;AACb;;;;;AAMA,SAAS,SAAS,WAAmB,UAAoD;CACvF,KAA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