@supatype/cli 0.3.2 → 0.3.3

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 (83) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +163 -161
  3. package/.turbo/turbo-typecheck.log +1 -1
  4. package/CHANGELOG.md +77 -0
  5. package/dist/augmentation-generator.d.ts.map +1 -1
  6. package/dist/augmentation-generator.js +70 -15
  7. package/dist/augmentation-generator.js.map +1 -1
  8. package/dist/cli-version-embedded.js +1 -1
  9. package/dist/commands/generate.d.ts.map +1 -1
  10. package/dist/commands/generate.js +3 -3
  11. package/dist/commands/generate.js.map +1 -1
  12. package/dist/commands/init.d.ts.map +1 -1
  13. package/dist/commands/init.js +29 -19
  14. package/dist/commands/init.js.map +1 -1
  15. package/dist/commands/seed.d.ts +27 -1
  16. package/dist/commands/seed.d.ts.map +1 -1
  17. package/dist/commands/seed.js +206 -33
  18. package/dist/commands/seed.js.map +1 -1
  19. package/dist/engine-client.d.ts +1 -0
  20. package/dist/engine-client.d.ts.map +1 -1
  21. package/dist/engine-client.js +47 -2
  22. package/dist/engine-client.js.map +1 -1
  23. package/dist/engine-floor.d.ts +27 -4
  24. package/dist/engine-floor.d.ts.map +1 -1
  25. package/dist/engine-floor.js +90 -9
  26. package/dist/engine-floor.js.map +1 -1
  27. package/dist/gitignore.d.ts.map +1 -1
  28. package/dist/gitignore.js +7 -0
  29. package/dist/gitignore.js.map +1 -1
  30. package/dist/hooks-generator.d.ts.map +1 -1
  31. package/dist/hooks-generator.js +18 -3
  32. package/dist/hooks-generator.js.map +1 -1
  33. package/dist/seed-connection.d.ts +60 -0
  34. package/dist/seed-connection.d.ts.map +1 -0
  35. package/dist/seed-connection.js +90 -0
  36. package/dist/seed-connection.js.map +1 -0
  37. package/dist/seed-ir.d.ts +66 -0
  38. package/dist/seed-ir.d.ts.map +1 -0
  39. package/dist/seed-ir.js +265 -0
  40. package/dist/seed-ir.js.map +1 -0
  41. package/dist/seed-runner.d.ts +44 -0
  42. package/dist/seed-runner.d.ts.map +1 -0
  43. package/dist/seed-runner.js +83 -0
  44. package/dist/seed-runner.js.map +1 -0
  45. package/dist/seed.d.ts +345 -0
  46. package/dist/seed.d.ts.map +1 -1
  47. package/dist/seed.js +138 -0
  48. package/dist/seed.js.map +1 -1
  49. package/dist/self-host-compose.d.ts.map +1 -1
  50. package/dist/self-host-compose.js +14 -8
  51. package/dist/self-host-compose.js.map +1 -1
  52. package/dist/type-extractor.d.ts.map +1 -1
  53. package/dist/type-extractor.js +73 -0
  54. package/dist/type-extractor.js.map +1 -1
  55. package/dist/type-generation.d.ts +29 -0
  56. package/dist/type-generation.d.ts.map +1 -1
  57. package/dist/type-generation.js +52 -0
  58. package/dist/type-generation.js.map +1 -1
  59. package/package.json +2 -2
  60. package/src/augmentation-generator.ts +73 -14
  61. package/src/cli-version-embedded.ts +1 -1
  62. package/src/commands/generate.ts +7 -3
  63. package/src/commands/init.ts +31 -21
  64. package/src/commands/seed.ts +294 -44
  65. package/src/engine-client.ts +52 -3
  66. package/src/engine-floor.ts +100 -9
  67. package/src/gitignore.ts +7 -0
  68. package/src/hooks-generator.ts +21 -6
  69. package/src/seed-connection.ts +146 -0
  70. package/src/seed-ir.ts +311 -0
  71. package/src/seed-runner.ts +109 -0
  72. package/src/seed.ts +408 -0
  73. package/src/self-host-compose.ts +14 -8
  74. package/src/type-extractor.ts +101 -0
  75. package/src/type-generation.ts +64 -0
  76. package/tests/access-composition.test.ts +123 -0
  77. package/tests/augmentation-generator.test.ts +149 -9
  78. package/tests/engine-floor.test.ts +93 -0
  79. package/tests/fixtures/seed_golden_ir.json +186 -0
  80. package/tests/runtime-contract.test.ts +31 -6
  81. package/tests/seed-connection.test.ts +158 -0
  82. package/tests/seed-ir.test.ts +436 -0
  83. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"engine-floor.js","sourceRoot":"","sources":["../src/engine-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,EAAE,mBAAmB;YAC3B,IAAI,EAAE,kBAAkB,KAAK,GAAG,IAAI,OAAO,WAAW,CAAC,WAAW,EAAE;SACrE,CAAC,CACH,CAAA;IACH,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,6BAA6B,CAC3C,mBAAuC;IAEvC,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC;QAAE,OAAO,SAAS,CAAA;IACtD,IAAI,eAAe,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAA;IAEpF,OAAO,OAAO,CAAC;QACb,KAAK,EAAE,+BAA+B;QACtC,KAAK,EAAE,mBAAmB;QAC1B,MAAM,EAAE,mBAAmB;QAC3B,IAAI,EACF,wBAAwB,mBAAmB,+CAA+C;YAC1F,wFAAwF;YACxF,+CAA+C;KAClD,CAAC,CAAA;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../src/gitignore.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,8DAA8D,CAAA;AAyBpG,sFAAsF;AACtF,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAA2B,CAAA;AAEjF,eAAO,MAAM,wBAAwB,QAEpC,CAAA;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAKzD;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAkBzF;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAMzD"}
1
+ {"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../src/gitignore.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,8DAA8D,CAAA;AAgCpG,sFAAsF;AACtF,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAA2B,CAAA;AAEjF,eAAO,MAAM,wBAAwB,QAEpC,CAAA;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAKzD;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAkBzF;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAMzD"}
package/dist/gitignore.js CHANGED
@@ -22,6 +22,13 @@ const SUPATYPE_IGNORED_PATHS = [
22
22
  "supatype.local.config.ts",
23
23
  "supatype.local.config.js",
24
24
  "supatype.local.config.mjs",
25
+ // Generated from schema/index.ts by `supatype generate`, which needs no database and no
26
+ // running stack, so a clone can always rebuild it. Listed here rather than only in the
27
+ // `init` template so projects that already exist pick it up too.
28
+ //
29
+ // The default path. A project that moves `output.client` moves this with it, and would
30
+ // need its own line: there is no pattern that follows a value from the config file.
31
+ "supatype/generated/seed.ts",
25
32
  ];
26
33
  /** The paths above, for a scaffold that composes its own `.gitignore` around them. */
27
34
  export const SUPATYPE_GITIGNORE_PATHS = SUPATYPE_IGNORED_PATHS;
@@ -1 +1 @@
1
- {"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../src/gitignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,CAAC,MAAM,yBAAyB,GAAG,2DAA2D,CAAA;AAEpG;;;;;;;;;;;;GAYG;AACH,MAAM,sBAAsB,GAAG;IAC7B,MAAM;IACN,YAAY;IACZ,cAAc;IACd,YAAY;IACZ,0BAA0B;IAC1B,0BAA0B;IAC1B,2BAA2B;CACnB,CAAA;AAEV,sFAAsF;AACtF,MAAM,CAAC,MAAM,wBAAwB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kW/D"}
1
+ {"version":3,"file":"hooks-generator.d.ts","sourceRoot":"","sources":["../src/hooks-generator.ts"],"names":[],"mappings":"AA2CA;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAwW/D"}
@@ -64,12 +64,18 @@ export function generateHooksModule(ast) {
64
64
  // })
65
65
 
66
66
  /**
67
- * Lexical editor state as JSON, or the plain string accepted for seeds and defaults.
67
+ * Lexical editor state as JSON.
68
68
  *
69
69
  * Structural rather than imported: the precise \`SerializedEditorState\` lives in
70
70
  * \`@supatype/types/lexical\`, which a Deno function has no way to resolve.
71
+ *
72
+ * A hook writing to a rich text column may hand back a plain string instead; a trigger
73
+ * normalises it into one of these, so what a later read returns is always the document.
71
74
  */
72
- export type RichTextValue = { readonly root: { readonly children: readonly unknown[] } } | string
75
+ export type RichTextValue = { readonly root: { readonly children: readonly unknown[] } }
76
+
77
+ /** A stored file, and the bucket it went to. */
78
+ export type StorageReference = { readonly bucket: string; readonly path: string }
73
79
 
74
80
  export interface HookTables {
75
81
  ${tableEntries}
@@ -392,8 +398,17 @@ function json(body: unknown, status: number): Response {
392
398
  * column emitted a module that failed to compile in the user's editor. Caught by compiling the
393
399
  * generated file in a test rather than by a reader reporting it.
394
400
  */
401
+ /**
402
+ * The shared type names, as a Deno module can spell them.
403
+ *
404
+ * `RichText` resolves through `@supatype/types/lexical`, which a Deno function has no way to
405
+ * reach, so the module declares a structural stand-in and the generated rows point at that.
406
+ * `StorageReference` needs no import and is declared here as itself.
407
+ */
395
408
  function denoSafe(source) {
396
- return source.replaceAll('import("@supatype/types/lexical").SerializedEditorState', "RichTextValue");
409
+ return source
410
+ .replaceAll("RichText", "RichTextValue")
411
+ .replaceAll('import("@supatype/types/lexical").SerializedEditorState', "RichTextValue");
397
412
  }
398
413
  /** Re-indent a generated type literal so the emitted file reads as if it were written by hand. */
399
414
  function indent(source, spaces) {
@@ -1 +1 @@
1
- {"version":3,"file":"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AMG;AACH,SAAS,QAAQ,CAAC,MAAc;IAC9B,OAAO,MAAM;SACV,UAAU,CAAC,UAAU,EAAE,eAAe,CAAC;SACvC,UAAU,CACT,yDAAyD,EACzD,eAAe,CAChB,CAAA;AACL,CAAC;AAED,kGAAkG;AAClG,SAAS,MAAM,CAAC,MAAc,EAAE,MAAc;IAC5C,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC9B,OAAO,MAAM;SACV,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC,CAAC;SACpD,IAAI,CAAC,IAAI,CAAC,CAAA;AACf,CAAC"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Which database a seed run targets, and how that was decided.
3
+ *
4
+ * Its own file so the failure is testable without spawning anything. The failure is the
5
+ * point: the old seed template carried a hardcoded fallback DSN, so a project with no
6
+ * `.env` did not fail, it silently tried `localhost:5432` with a guessed password and
7
+ * reported a connection error that named none of the things it had looked at. Someone
8
+ * reading that has no way to tell "I have not set DATABASE_URL" from "the stack is not
9
+ * running".
10
+ *
11
+ * So every source is recorded whether it was found or not, and the error prints the lot.
12
+ */
13
+ import { type SupatypeProjectConfig } from "./project-config.js";
14
+ /** One place a connection string could have come from. */
15
+ export interface DsnSource {
16
+ /** How it would be described to the person running the command. */
17
+ name: string;
18
+ /** What was found there, or why nothing was. */
19
+ detail: string;
20
+ found: boolean;
21
+ }
22
+ export interface ResolvedDsn {
23
+ dsn: string;
24
+ /** The `name` of the source it came from. */
25
+ source: string;
26
+ /** Every source, in the order they were considered. */
27
+ tried: readonly DsnSource[];
28
+ }
29
+ /** Nothing named a database, with every source tried. */
30
+ export declare class DsnNotFound extends Error {
31
+ readonly tried: readonly DsnSource[];
32
+ constructor(tried: readonly DsnSource[]);
33
+ }
34
+ export interface ResolveOptions {
35
+ /** `--connection`, which beats everything because it was typed just now. */
36
+ connection?: string | undefined;
37
+ /**
38
+ * Whether to fall back to the DSN derived from the project name.
39
+ *
40
+ * True for a project whose database Supatype manages, where the derived value is right by
41
+ * construction. A project pointed at someone else's Postgres has no such default, and
42
+ * inventing one would send the seed to a database nobody named.
43
+ */
44
+ allowDerived?: boolean;
45
+ }
46
+ /**
47
+ * Resolve the DSN, in the order the rest of the CLI already uses.
48
+ *
49
+ * `.env` is loaded first but ranks below a real environment variable, which is how every
50
+ * other dotenv reader behaves and how Compose resolves the same names.
51
+ */
52
+ export declare function resolveSeedDsn(cwd: string, config: SupatypeProjectConfig, options?: ResolveOptions): ResolvedDsn;
53
+ /**
54
+ * A connection string with its password removed.
55
+ *
56
+ * Every one of these reaches a terminal, and often a CI log. Printing a DSN to explain where
57
+ * it came from should not be how a password ends up somewhere it is kept.
58
+ */
59
+ export declare function redact(dsn: string): string;
60
+ //# sourceMappingURL=seed-connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-connection.d.ts","sourceRoot":"","sources":["../src/seed-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAA;AAE5B,0DAA0D;AAC1D,MAAM,WAAW,SAAS;IACxB,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAA;IACZ,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,uDAAuD;IACvD,KAAK,EAAE,SAAS,SAAS,EAAE,CAAA;CAC5B;AAED,yDAAyD;AACzD,qBAAa,WAAY,SAAQ,KAAK;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE;gBAA3B,KAAK,EAAE,SAAS,SAAS,EAAE;CAQjD;AAED,MAAM,WAAW,cAAc;IAC7B,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,qBAAqB,EAC7B,OAAO,GAAE,cAAmB,GAC3B,WAAW,CA4Db;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1C"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Which database a seed run targets, and how that was decided.
3
+ *
4
+ * Its own file so the failure is testable without spawning anything. The failure is the
5
+ * point: the old seed template carried a hardcoded fallback DSN, so a project with no
6
+ * `.env` did not fail, it silently tried `localhost:5432` with a guessed password and
7
+ * reported a connection error that named none of the things it had looked at. Someone
8
+ * reading that has no way to tell "I have not set DATABASE_URL" from "the stack is not
9
+ * running".
10
+ *
11
+ * So every source is recorded whether it was found or not, and the error prints the lot.
12
+ */
13
+ import { existsSync } from "node:fs";
14
+ import { join } from "node:path";
15
+ import { readEnvFile } from "./env-file.js";
16
+ import { externalDatabaseUrl, localDSN, projectRootFromConfig, } from "./project-config.js";
17
+ /** Nothing named a database, with every source tried. */
18
+ export class DsnNotFound extends Error {
19
+ tried;
20
+ constructor(tried) {
21
+ super(`No database connection string for this seed run.\n${tried
22
+ .map((source) => ` ${source.found ? "found" : "not set"} ${source.name}: ${source.detail}`)
23
+ .join("\n")}`);
24
+ this.tried = tried;
25
+ this.name = "DsnNotFound";
26
+ }
27
+ }
28
+ /**
29
+ * Resolve the DSN, in the order the rest of the CLI already uses.
30
+ *
31
+ * `.env` is loaded first but ranks below a real environment variable, which is how every
32
+ * other dotenv reader behaves and how Compose resolves the same names.
33
+ */
34
+ export function resolveSeedDsn(cwd, config, options = {}) {
35
+ const root = projectRootFromConfig(config, cwd);
36
+ const envPath = join(root, ".env");
37
+ const fromFile = readEnvFile(root);
38
+ const tried = [];
39
+ const candidate = (name, value, absent) => {
40
+ const trimmed = value?.trim();
41
+ if (trimmed !== undefined && trimmed.length > 0) {
42
+ tried.push({ name, detail: redact(trimmed), found: true });
43
+ return trimmed;
44
+ }
45
+ tried.push({ name, detail: absent, found: false });
46
+ return undefined;
47
+ };
48
+ const flag = candidate("--connection", options.connection, "not passed");
49
+ if (flag !== undefined)
50
+ return { dsn: flag, source: "--connection", tried };
51
+ // Ahead of the rest on purpose: a stated external database is the whole stack's database,
52
+ // and seeding somewhere else while the services read from here would look like data loss.
53
+ const external = candidate("database.external.url in supatype.config.ts", externalDatabaseUrl(config), "not declared");
54
+ if (external !== undefined) {
55
+ return { dsn: external, source: "database.external.url in supatype.config.ts", tried };
56
+ }
57
+ const declared = candidate("connection in supatype.config.ts", config.connection, "not declared");
58
+ if (declared !== undefined) {
59
+ return { dsn: declared, source: "connection in supatype.config.ts", tried };
60
+ }
61
+ const fromEnv = candidate("DATABASE_URL in the environment", process.env["DATABASE_URL"], "not set");
62
+ if (fromEnv !== undefined) {
63
+ return { dsn: fromEnv, source: "DATABASE_URL in the environment", tried };
64
+ }
65
+ const fileLabel = `DATABASE_URL in ${envPath}`;
66
+ const fileValue = candidate(fileLabel, fromFile["DATABASE_URL"], existsSync(envPath) ? "the file has no DATABASE_URL" : "no .env file");
67
+ if (fileValue !== undefined)
68
+ return { dsn: fileValue, source: fileLabel, tried };
69
+ if (options.allowDerived === true) {
70
+ const derived = localDSN(config);
71
+ tried.push({ name: "the project's own local database", detail: redact(derived), found: true });
72
+ return { dsn: derived, source: "the project's own local database", tried };
73
+ }
74
+ tried.push({
75
+ name: "the project's own local database",
76
+ detail: "this project points at a database it does not manage, so there is no default",
77
+ found: false,
78
+ });
79
+ throw new DsnNotFound(tried);
80
+ }
81
+ /**
82
+ * A connection string with its password removed.
83
+ *
84
+ * Every one of these reaches a terminal, and often a CI log. Printing a DSN to explain where
85
+ * it came from should not be how a password ends up somewhere it is kept.
86
+ */
87
+ export function redact(dsn) {
88
+ return dsn.replace(/(:\/\/[^:/@]+:)[^@]*(@)/, "$1***$2");
89
+ }
90
+ //# sourceMappingURL=seed-connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-connection.js","sourceRoot":"","sources":["../src/seed-connection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EACL,mBAAmB,EACnB,QAAQ,EACR,qBAAqB,GAEtB,MAAM,qBAAqB,CAAA;AAmB5B,yDAAyD;AACzD,MAAM,OAAO,WAAY,SAAQ,KAAK;IACf;IAArB,YAAqB,KAA2B;QAC9C,KAAK,CACH,qDAAqD,KAAK;aACvD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,KAAK,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;aAC5F,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAA;QALkB,UAAK,GAAL,KAAK,CAAsB;QAM9C,IAAI,CAAC,IAAI,GAAG,aAAa,CAAA;IAC3B,CAAC;CACF;AAeD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,GAAW,EACX,MAA6B,EAC7B,UAA0B,EAAE;IAE5B,MAAM,IAAI,GAAG,qBAAqB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAClC,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC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O,GAAG,CAAC,OAAO,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAA;AAC1D,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Collect a seed's builder calls into an IR document.
3
+ *
4
+ * The only genuinely new file in the CLI half of this: everything else is rewiring. What it
5
+ * does is narrow. It records calls in the order they were made, encodes each value into the
6
+ * shape the engine reads, and hands back a document. It resolves nothing, orders nothing,
7
+ * validates nothing and connects to nothing, because the engine does all four and doing any
8
+ * of them twice is how the two ends come to disagree.
9
+ *
10
+ * **Labels are assigned lazily.** A `create` becomes a referenceable operation only when
11
+ * something actually reads a property off what it returned. Assigning one to every operation
12
+ * would put an `id` in the IR for rows nobody points at, which is noise in a document people
13
+ * read and diff.
14
+ */
15
+ import type { DefaultExpr, ModelManifest, Operand, RefValue, SeedCondition, SeedConditionInput, SeedDb, SeedIr, SeedOperation, SeedValue } from "./seed.js";
16
+ /** A model's own name and the facts the encoder needs about its columns. */
17
+ export type Manifest = Readonly<Record<string, ModelManifest>>;
18
+ /** What a collector hands back once the seed has run. */
19
+ export interface CollectedIr {
20
+ ir: SeedIr;
21
+ /** The document as the engine will read it, which is what the ledger hashes. */
22
+ json: string;
23
+ }
24
+ export declare class SeedCollector {
25
+ private readonly fingerprint;
26
+ private readonly manifest;
27
+ private readonly byModel;
28
+ /** The block currently being collected into: the document, or a `$if` body. */
29
+ private readonly stack;
30
+ private readonly root;
31
+ private labels;
32
+ constructor(fingerprint: string, manifest: Manifest);
33
+ /** The `db` a seed's default export is handed. */
34
+ db(): SeedDb;
35
+ /** The document, with every label that was actually used written in. */
36
+ finish(): CollectedIr;
37
+ private modelApi;
38
+ private group;
39
+ private push;
40
+ private name;
41
+ /**
42
+ * What an operation hands back.
43
+ *
44
+ * A proxy rather than a plain object, because the columns a seed may reference are the
45
+ * model's columns and building one property per column per row would cost more than the
46
+ * seed itself. Reading a property is also what tells the collector this operation needs a
47
+ * label at all.
48
+ */
49
+ private reference;
50
+ private encodeRow;
51
+ private encode;
52
+ /**
53
+ * A relation's input, with its rows encoded against the model they will be written to.
54
+ *
55
+ * Returns `undefined` when the value is not one of the relation shapes, so an ordinary
56
+ * value on a field that happens to share a relation's name is left alone.
57
+ */
58
+ private nested;
59
+ /** A value with no column to consult, such as an element of an array. */
60
+ private encodeLoose;
61
+ }
62
+ /** The surface a seed writes, in the shape the IR carries. */
63
+ export declare function encodeCondition(condition: SeedConditionInput): SeedCondition;
64
+ /** Re-exported for the runner, which has no reason to know these came from `seed.ts`. */
65
+ export type { DefaultExpr, Operand, RefValue, SeedIr, SeedOperation, SeedValue };
66
+ //# sourceMappingURL=seed-ir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-ir.d.ts","sourceRoot":"","sources":["../src/seed-ir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,WAAW,EAEX,aAAa,EAEb,OAAO,EAEP,QAAQ,EACR,aAAa,EACb,kBAAkB,EAElB,MAAM,EACN,MAAM,EACN,aAAa,EACb,SAAS,EACV,MAAM,WAAW,CAAA;AAElB,4EAA4E;AAC5E,MAAM,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAA;AAE9D,yDAAyD;AACzD,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAA;CACb;AASD,qBAAa,aAAa;IAStB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAR9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IACpD,+EAA+E;IAC/E,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwB;IAC9C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAsB;IAC3C,OAAO,CAAC,MAAM,CAAI;gBAGC,WAAW,EAAE,MAAM,EACpC,QAAQ,EAAE,QAAQ;IAOpB,kDAAkD;IAClD,EAAE,IAAI,MAAM;IAgBZ,wEAAwE;IACxE,MAAM,IAAI,WAAW;IAWrB,OAAO,CAAC,QAAQ;IAmChB,OAAO,CAAC,KAAK;IAab,OAAO,CAAC,IAAI;IAQZ,OAAO,CAAC,IAAI;IAWZ;;;;;;;OAOG;IACH,OAAO,CAAC,SAAS;IAcjB,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,MAAM;IA0Bd;;;;;OAKG;IACH,OAAO,CAAC,MAAM;IAuBd,yEAAyE;IACzE,OAAO,CAAC,WAAW;CAOpB;AA+BD,8DAA8D;AAC9D,wBAAgB,eAAe,CAAC,SAAS,EAAE,kBAAkB,GAAG,aAAa,CAQ5E;AAaD,yFAAyF;AACzF,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,CAAA"}
@@ -0,0 +1,265 @@
1
+ /**
2
+ * Collect a seed's builder calls into an IR document.
3
+ *
4
+ * The only genuinely new file in the CLI half of this: everything else is rewiring. What it
5
+ * does is narrow. It records calls in the order they were made, encodes each value into the
6
+ * shape the engine reads, and hands back a document. It resolves nothing, orders nothing,
7
+ * validates nothing and connects to nothing, because the engine does all four and doing any
8
+ * of them twice is how the two ends come to disagree.
9
+ *
10
+ * **Labels are assigned lazily.** A `create` becomes a referenceable operation only when
11
+ * something actually reads a property off what it returned. Assigning one to every operation
12
+ * would put an `id` in the IR for rows nobody points at, which is noise in a document people
13
+ * read and diff.
14
+ */
15
+ export class SeedCollector {
16
+ fingerprint;
17
+ manifest;
18
+ byModel;
19
+ /** The block currently being collected into: the document, or a `$if` body. */
20
+ stack = [];
21
+ root = [];
22
+ labels = 0;
23
+ constructor(fingerprint, manifest) {
24
+ this.fingerprint = fingerprint;
25
+ this.manifest = manifest;
26
+ this.byModel = new Map(Object.values(manifest).map((entry) => [entry.model, entry]));
27
+ this.stack.push(this.root);
28
+ }
29
+ /** The `db` a seed's default export is handed. */
30
+ db() {
31
+ const api = {};
32
+ for (const [accessor, entry] of Object.entries(this.manifest)) {
33
+ api[accessor] = this.modelApi(entry);
34
+ }
35
+ api["$if"] = (condition, body) => {
36
+ this.group(condition, body);
37
+ };
38
+ api["$sql"] = (text, params) => {
39
+ // Always present, even when empty: the engine defaults it either way, and a document
40
+ // whose shape changes with its contents is harder to read and to diff.
41
+ this.push({ op: "sql", text, params: params === undefined ? [] : [...params] });
42
+ };
43
+ return api;
44
+ }
45
+ /** The document, with every label that was actually used written in. */
46
+ finish() {
47
+ const ir = {
48
+ irVersion: 1,
49
+ schemaFingerprint: this.fingerprint,
50
+ operations: this.root,
51
+ };
52
+ return { ir, json: JSON.stringify(ir, null, 2) };
53
+ }
54
+ // --- Operations ---
55
+ modelApi(entry) {
56
+ return {
57
+ create: (data, options) => {
58
+ const pending = {
59
+ operation: { op: "create", model: entry.model, data: this.encodeRow(entry, data) },
60
+ };
61
+ if (options?.id !== undefined)
62
+ this.name(pending, options.id);
63
+ this.push(pending.operation);
64
+ return this.reference(pending);
65
+ },
66
+ createMany: (rows) => {
67
+ this.push({
68
+ op: "createMany",
69
+ model: entry.model,
70
+ rows: rows.map((row) => this.encodeRow(entry, row)),
71
+ });
72
+ },
73
+ upsert: ({ where, data, id }) => {
74
+ const pending = {
75
+ operation: {
76
+ op: "upsert",
77
+ model: entry.model,
78
+ where: this.encodeRow(entry, where),
79
+ data: this.encodeRow(entry, data),
80
+ },
81
+ };
82
+ if (id !== undefined)
83
+ this.name(pending, id);
84
+ this.push(pending.operation);
85
+ return this.reference(pending);
86
+ },
87
+ };
88
+ }
89
+ group(condition, body) {
90
+ const operations = [];
91
+ this.stack.push(operations);
92
+ try {
93
+ body();
94
+ }
95
+ finally {
96
+ // Popped in a `finally` so a seed that throws inside a `$if` does not leave every
97
+ // later operation collecting into a block that is never emitted.
98
+ this.stack.pop();
99
+ }
100
+ this.push({ op: "group", if: encodeCondition(condition), operations });
101
+ }
102
+ push(operation) {
103
+ const block = this.stack[this.stack.length - 1];
104
+ if (block === undefined)
105
+ throw new Error("the seed collector lost its block");
106
+ block.push(operation);
107
+ }
108
+ // --- References ---
109
+ name(pending, label) {
110
+ if (pending.label !== undefined)
111
+ return pending.label;
112
+ this.labels += 1;
113
+ pending.label = label ?? `op${this.labels}`;
114
+ const operation = pending.operation;
115
+ if (operation.op === "create" || operation.op === "upsert") {
116
+ operation.id = pending.label;
117
+ }
118
+ return pending.label;
119
+ }
120
+ /**
121
+ * What an operation hands back.
122
+ *
123
+ * A proxy rather than a plain object, because the columns a seed may reference are the
124
+ * model's columns and building one property per column per row would cost more than the
125
+ * seed itself. Reading a property is also what tells the collector this operation needs a
126
+ * label at all.
127
+ */
128
+ reference(pending) {
129
+ return new Proxy({}, {
130
+ get: (_target, property) => {
131
+ // A proxy gets asked about `then` when it is awaited or resolved, and about
132
+ // symbols by anything that inspects it. Answering with a reference would make a
133
+ // seed that awaits a builder call hang on a thenable that never settles.
134
+ if (typeof property !== "string" || property === "then")
135
+ return undefined;
136
+ return { $ref: `${this.name(pending)}.${property}` };
137
+ },
138
+ });
139
+ }
140
+ // --- Values ---
141
+ encodeRow(entry, row) {
142
+ const out = {};
143
+ for (const [key, value] of Object.entries(row)) {
144
+ if (value === undefined)
145
+ continue;
146
+ out[key] = this.encode(entry, key, value);
147
+ }
148
+ return out;
149
+ }
150
+ encode(entry, key, value) {
151
+ if (isPassThrough(value))
152
+ return value;
153
+ const relation = entry.relations[key];
154
+ if (relation !== undefined) {
155
+ const nested = this.nested(relation.target, value);
156
+ if (nested !== undefined)
157
+ return nested;
158
+ }
159
+ if (value instanceof Date)
160
+ return value.toISOString();
161
+ if (typeof value === "bigint")
162
+ return value.toString();
163
+ // The column's kind decides the encoding, and only the manifest knows it: a decimal
164
+ // sent as a JSON number round-trips through a double and stops being the value the
165
+ // column holds.
166
+ if (typeof value === "number" && entry.numeric.includes(key)) {
167
+ return { $numeric: String(value) };
168
+ }
169
+ if (typeof value === "string" && entry.numeric.includes(key)) {
170
+ return { $numeric: value };
171
+ }
172
+ if (Array.isArray(value))
173
+ return value.map((item) => this.encodeLoose(item));
174
+ return value;
175
+ }
176
+ /**
177
+ * A relation's input, with its rows encoded against the model they will be written to.
178
+ *
179
+ * Returns `undefined` when the value is not one of the relation shapes, so an ordinary
180
+ * value on a field that happens to share a relation's name is left alone.
181
+ */
182
+ nested(target, value) {
183
+ if (value === null || typeof value !== "object" || Array.isArray(value))
184
+ return undefined;
185
+ const shape = value;
186
+ const entry = this.byModel.get(target);
187
+ if ("connect" in shape) {
188
+ const where = shape["connect"];
189
+ if (entry === undefined || where === null || typeof where !== "object")
190
+ return undefined;
191
+ return { connect: this.encodeRow(entry, where) };
192
+ }
193
+ if ("create" in shape) {
194
+ const rows = toRows(shape["create"]);
195
+ if (entry === undefined || rows === undefined)
196
+ return undefined;
197
+ return { create: rows.map((row) => this.encodeRow(entry, row)) };
198
+ }
199
+ if ("createMany" in shape) {
200
+ const rows = toRows(shape["createMany"]);
201
+ if (entry === undefined || rows === undefined)
202
+ return undefined;
203
+ return { createMany: rows.map((row) => this.encodeRow(entry, row)) };
204
+ }
205
+ return undefined;
206
+ }
207
+ /** A value with no column to consult, such as an element of an array. */
208
+ encodeLoose(value) {
209
+ if (isPassThrough(value))
210
+ return value;
211
+ if (value instanceof Date)
212
+ return value.toISOString();
213
+ if (typeof value === "bigint")
214
+ return value.toString();
215
+ if (Array.isArray(value))
216
+ return value.map((item) => this.encodeLoose(item));
217
+ return value;
218
+ }
219
+ }
220
+ /**
221
+ * A `hasOne` nests one row and a `hasMany` nests several; the IR carries a list either way.
222
+ *
223
+ * Normalised here rather than in the generated builder, so six more generators do not each
224
+ * have to remember it.
225
+ */
226
+ function toRows(value) {
227
+ if (Array.isArray(value))
228
+ return value;
229
+ if (value !== null && typeof value === "object")
230
+ return [value];
231
+ return undefined;
232
+ }
233
+ /**
234
+ * Values that are already in the shape the engine reads.
235
+ *
236
+ * `expr.now()` is literally `{ kind: "now" }` and a reference is literally `{ $ref: ... }`,
237
+ * so encoding them again would wrap an operand in a decimal or walk into a proxy.
238
+ */
239
+ function isPassThrough(value) {
240
+ if (value === null || typeof value !== "object" || Array.isArray(value))
241
+ return false;
242
+ const shape = value;
243
+ return ("$ref" in shape ||
244
+ "$numeric" in shape ||
245
+ "$default" in shape ||
246
+ typeof shape["kind"] === "string");
247
+ }
248
+ /** The surface a seed writes, in the shape the IR carries. */
249
+ export function encodeCondition(condition) {
250
+ if ("environment" in condition) {
251
+ return { kind: "environment", name: condition.environment };
252
+ }
253
+ if ("exists" in condition) {
254
+ return scoped("exists", condition.exists);
255
+ }
256
+ return scoped("notExists", condition.notExists);
257
+ }
258
+ function scoped(kind, target) {
259
+ return {
260
+ kind,
261
+ model: target.model,
262
+ ...(target.where !== undefined ? { where: target.where } : {}),
263
+ };
264
+ }
265
+ //# sourceMappingURL=seed-ir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-ir.js","sourceRoot":"","sources":["../src/seed-ir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAoCH,MAAM,OAAO,aAAa;IASL;IARF,QAAQ,CAAU;IAClB,OAAO,CAA4B;IACpD,+EAA+E;IAC9D,KAAK,GAAsB,EAAE,CAAA;IAC7B,IAAI,GAAoB,EAAE,CAAA;IACnC,MAAM,GAAG,CAAC,CAAA;IAElB,YACmB,WAAmB,EACpC,QAAkB;QADD,gBAAW,GAAX,WAAW,CAAQ;QAGpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;QACpF,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;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