@intentius/chant-lexicon-sql 0.114.1 → 0.116.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 (142) hide show
  1. package/dist/clickhouse/apply/mutations.d.ts +7 -1
  2. package/dist/clickhouse/apply/mutations.d.ts.map +1 -1
  3. package/dist/clickhouse/container.d.ts +22 -7
  4. package/dist/clickhouse/container.d.ts.map +1 -1
  5. package/dist/clickhouse/plan/deep.d.ts +5 -0
  6. package/dist/clickhouse/plan/deep.d.ts.map +1 -1
  7. package/dist/clickhouse/plan/normalize.d.ts.map +1 -1
  8. package/dist/clickhouse/rebuild/backfill.d.ts +11 -5
  9. package/dist/clickhouse/rebuild/backfill.d.ts.map +1 -1
  10. package/dist/clickhouse/rebuild/op.d.ts +29 -0
  11. package/dist/clickhouse/rebuild/op.d.ts.map +1 -1
  12. package/dist/clickhouse/rebuild/partitions.d.ts +8 -0
  13. package/dist/clickhouse/rebuild/partitions.d.ts.map +1 -1
  14. package/dist/clickhouse/rebuild/receipts.d.ts +4 -6
  15. package/dist/clickhouse/rebuild/receipts.d.ts.map +1 -1
  16. package/dist/clickhouse/rebuild/shards.d.ts +59 -0
  17. package/dist/clickhouse/rebuild/shards.d.ts.map +1 -0
  18. package/dist/clickhouse/rebuild/steps.d.ts +3 -0
  19. package/dist/clickhouse/rebuild/steps.d.ts.map +1 -1
  20. package/dist/clickhouse/rebuild/verify.d.ts +4 -0
  21. package/dist/clickhouse/rebuild/verify.d.ts.map +1 -1
  22. package/dist/codegen/registry.d.ts.map +1 -1
  23. package/dist/config.d.ts +14 -0
  24. package/dist/config.d.ts.map +1 -1
  25. package/dist/core/receipts.d.ts +5 -3
  26. package/dist/core/receipts.d.ts.map +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/integrity.json +5 -5
  30. package/dist/lint/rules/sqlpg001.d.ts.map +1 -1
  31. package/dist/lsp/postgres-template.d.ts.map +1 -1
  32. package/dist/manifest.json +1 -1
  33. package/dist/meta.json +15 -0
  34. package/dist/okf/index.md +3 -0
  35. package/dist/okf/types/PostgresFunction.md +9 -0
  36. package/dist/okf/types/PostgresProcedure.md +9 -0
  37. package/dist/okf/types/PostgresTrigger.md +9 -0
  38. package/dist/op/activities/clickhouse-rebuild.d.ts.map +1 -1
  39. package/dist/op/activities/index.d.ts +13 -1
  40. package/dist/op/activities/index.d.ts.map +1 -1
  41. package/dist/op/activities/sql-exec.d.ts +41 -0
  42. package/dist/op/activities/sql-exec.d.ts.map +1 -0
  43. package/dist/op/activity-contracts.d.ts +20 -0
  44. package/dist/op/activity-contracts.d.ts.map +1 -1
  45. package/dist/plugin.d.ts.map +1 -1
  46. package/dist/postgres/apply/apply.d.ts +6 -1
  47. package/dist/postgres/apply/apply.d.ts.map +1 -1
  48. package/dist/postgres/apply/statements.d.ts +9 -2
  49. package/dist/postgres/apply/statements.d.ts.map +1 -1
  50. package/dist/postgres/entities.d.ts +110 -3
  51. package/dist/postgres/entities.d.ts.map +1 -1
  52. package/dist/postgres/entity-types.d.ts +3 -0
  53. package/dist/postgres/entity-types.d.ts.map +1 -1
  54. package/dist/postgres/import/generator.d.ts.map +1 -1
  55. package/dist/postgres/import/live-export.d.ts.map +1 -1
  56. package/dist/postgres/live/catalog.d.ts +17 -5
  57. package/dist/postgres/live/catalog.d.ts.map +1 -1
  58. package/dist/postgres/live/describe-resources.d.ts +6 -1
  59. package/dist/postgres/live/describe-resources.d.ts.map +1 -1
  60. package/dist/postgres/migrate/receipts.d.ts +8 -5
  61. package/dist/postgres/migrate/receipts.d.ts.map +1 -1
  62. package/dist/postgres/parser.d.ts +82 -5
  63. package/dist/postgres/parser.d.ts.map +1 -1
  64. package/dist/postgres/plan/deep.d.ts.map +1 -1
  65. package/dist/postgres/plan/diff.d.ts +1 -1
  66. package/dist/postgres/plan/diff.d.ts.map +1 -1
  67. package/dist/postgres/plan/normalize.d.ts +21 -2
  68. package/dist/postgres/plan/normalize.d.ts.map +1 -1
  69. package/dist/postgres/plan/rules.d.ts +6 -0
  70. package/dist/postgres/plan/rules.d.ts.map +1 -1
  71. package/dist/postgres/plan/schema.d.ts +11 -1
  72. package/dist/postgres/plan/schema.d.ts.map +1 -1
  73. package/dist/postgres/plan/server-normalize.d.ts.map +1 -1
  74. package/dist/postgres.d.ts +1 -1
  75. package/dist/postgres.d.ts.map +1 -1
  76. package/dist/receipts.d.ts +102 -0
  77. package/dist/receipts.d.ts.map +1 -0
  78. package/dist/rules/postgres-templates.ts +2 -2
  79. package/dist/rules/sqlpg001.ts +3 -0
  80. package/dist/validate.d.ts.map +1 -1
  81. package/package.json +2 -2
  82. package/src/clickhouse/apply/mutations.ts +9 -3
  83. package/src/clickhouse/container.ts +39 -11
  84. package/src/clickhouse/plan/cluster-drift.e2e.test.ts +117 -0
  85. package/src/clickhouse/plan/deep.ts +102 -3
  86. package/src/clickhouse/plan/normalize.ts +10 -0
  87. package/src/clickhouse/plan/plan.test.ts +10 -0
  88. package/src/clickhouse/rebuild/backfill.ts +85 -42
  89. package/src/clickhouse/rebuild/op.ts +80 -35
  90. package/src/clickhouse/rebuild/partitions.ts +11 -0
  91. package/src/clickhouse/rebuild/rebuild-sharded.e2e.test.ts +161 -0
  92. package/src/clickhouse/rebuild/rebuild.e2e.test.ts +110 -4
  93. package/src/clickhouse/rebuild/rebuild.test.ts +56 -4
  94. package/src/clickhouse/rebuild/receipts.ts +4 -6
  95. package/src/clickhouse/rebuild/shards.ts +104 -0
  96. package/src/clickhouse/rebuild/steps.ts +4 -0
  97. package/src/clickhouse/rebuild/verify.ts +14 -5
  98. package/src/codegen/postgres-classifier-page.ts +1 -1
  99. package/src/codegen/registry.ts +3 -0
  100. package/src/config.ts +7 -0
  101. package/src/core/receipts.ts +5 -3
  102. package/src/generated/lexicon-sql.json +15 -0
  103. package/src/index.ts +1 -1
  104. package/src/lint/rules/postgres-templates.ts +2 -2
  105. package/src/lint/rules/sqlpg001.ts +3 -0
  106. package/src/lsp/postgres-template.ts +6 -0
  107. package/src/mcp/postgres.ts +1 -1
  108. package/src/op/activities/clickhouse-rebuild.ts +32 -7
  109. package/src/op/activities/index.ts +21 -4
  110. package/src/op/activities/sql-exec.ts +84 -0
  111. package/src/op/activity-contracts.ts +15 -0
  112. package/src/op/effect-receipts.e2e.test.ts +277 -0
  113. package/src/plugin.ts +3 -0
  114. package/src/postgres/apply/apply.ts +21 -5
  115. package/src/postgres/apply/statements.ts +53 -11
  116. package/src/postgres/entities.ts +332 -9
  117. package/src/postgres/entity-types.ts +3 -0
  118. package/src/postgres/import/generator.ts +5 -2
  119. package/src/postgres/import/live-export.ts +4 -0
  120. package/src/postgres/live/catalog.ts +81 -5
  121. package/src/postgres/live/describe-resources.ts +17 -7
  122. package/src/postgres/live/routines.e2e.test.ts +173 -0
  123. package/src/postgres/migrate/batches.e2e.test.ts +2 -1
  124. package/src/postgres/migrate/migrate.e2e.test.ts +2 -1
  125. package/src/postgres/migrate/migrate.test.ts +3 -2
  126. package/src/postgres/migrate/receipts.ts +18 -10
  127. package/src/postgres/parser.ts +314 -8
  128. package/src/postgres/plan/commands.ts +2 -2
  129. package/src/postgres/plan/deep.ts +57 -17
  130. package/src/postgres/plan/diff.ts +46 -6
  131. package/src/postgres/plan/normalize.ts +158 -4
  132. package/src/postgres/plan/rules.ts +36 -0
  133. package/src/postgres/plan/schema.ts +25 -6
  134. package/src/postgres/plan/server-normalize.ts +24 -0
  135. package/src/postgres/routines.test.ts +150 -0
  136. package/src/postgres.ts +11 -0
  137. package/src/receipts.test.ts +91 -0
  138. package/src/receipts.ts +259 -0
  139. package/src/skill-defs.ts +1 -1
  140. package/src/skills/chant-sql-postgres.md +18 -2
  141. package/src/skills/chant-sql-rebuild.md +5 -1
  142. package/src/validate.ts +3 -0
@@ -27,9 +27,9 @@
27
27
  * stale; onFailure and the contract also delete the migration's receipts.
28
28
  *
29
29
  * The store implements the shared core's `SqlReceiptStore`
30
- * (`../../core/receipts.ts`) over the migration's own connection. It is not
31
- * exported as the `receiptRead` / `receiptWrite` activities, whose names are
32
- * global to a run and belong to an aws or k8s project's receipt row.
30
+ * (`../../core/receipts.ts`) over the migration's own connection, which the
31
+ * backfill reaches directly. A sql project's `effect()` receipts use the same
32
+ * store over `chant_receipts.receipts` (`../../receipts.ts`).
33
33
  */
34
34
  import { type SqlReceiptStore } from "../../core/receipts.js";
35
35
  import type { PostgresClient } from "../live/client.js";
@@ -38,7 +38,7 @@ export declare const POSTGRES_RECEIPTS_TABLE = "__chant_receipts";
38
38
  export { receiptAddress } from "../../core/receipts.js";
39
39
  /** A receipts table chant did not make: a user's table under the same name. */
40
40
  export declare class ReceiptsTableConflict extends Error {
41
- constructor(schema: string);
41
+ constructor(schema: string, table?: string);
42
42
  }
43
43
  export interface PostgresReceiptStore extends SqlReceiptStore {
44
44
  /** The qualified, quoted table name. */
@@ -52,12 +52,15 @@ export interface PostgresReceiptStore extends SqlReceiptStore {
52
52
  * A receipt store in `<schema>.__chant_receipts`, over `client`. `write` runs
53
53
  * on the client as it is, so a write inside the caller's transaction commits
54
54
  * or rolls back with it. `identity` is the project's ownership stack and env,
55
- * which every address starts with.
55
+ * which every address starts with. `table` names the table in `schema`,
56
+ * `__chant_receipts` by default (`../../receipts.ts` keeps `effect()`
57
+ * receipts in `chant_receipts.receipts`).
56
58
  */
57
59
  export declare function postgresReceiptStore(client: PostgresClient, schema: string, identity: {
58
60
  stack?: string;
59
61
  env?: string;
60
62
  }, opts?: {
61
63
  runId?: string;
64
+ table?: string;
62
65
  }): PostgresReceiptStore;
63
66
  //# sourceMappingURL=receipts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"receipts.d.ts","sourceRoot":"","sources":["../../../src/postgres/migrate/receipts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAKH,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3E,OAAO,KAAK,EAAE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e;IAC3D,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,gGAAgG;IAChG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,iGAAiG;IACjG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1C,IAAI,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC5C,oBAAoB,CA6DtB"}
@@ -2,7 +2,13 @@
2
2
  * A hand-written, lossless parser for the Postgres statements the dialect
3
3
  * declares (chant #3278, #3279): `CREATE SCHEMA`, `TABLE`, `INDEX`, `VIEW`,
4
4
  * `MATERIALIZED VIEW`, `SEQUENCE`, `TYPE ... AS ENUM`, `DOMAIN`, `EXTENSION`,
5
- * and `COMMENT ON` for those objects.
5
+ * `FUNCTION`, `PROCEDURE` and `TRIGGER` (#3680), and `COMMENT ON` for those
6
+ * objects.
7
+ *
8
+ * A function's or procedure's body is a string (`AS $$ ... $$`), kept
9
+ * verbatim: Postgres stores it as written and prints it back unchanged. A
10
+ * SQL-standard body (`RETURN expr`, `BEGIN ATOMIC ... END`) is refused, since
11
+ * the server stores it parsed and prints it back rewritten.
6
12
  *
7
13
  * As for ClickHouse (#3196), statement structure is parsed and expressions are
8
14
  * not: a default, a check, a generated expression, an index element, a
@@ -22,7 +28,8 @@
22
28
  * Grammar source: the Postgres 18 reference pages for each statement
23
29
  * (sql-createtable, sql-createindex, sql-createview,
24
30
  * sql-creatematerializedview, sql-createsequence, sql-createtype,
25
- * sql-createdomain, sql-createextension, sql-createschema, sql-comment) and
31
+ * sql-createdomain, sql-createextension, sql-createschema, sql-createfunction,
32
+ * sql-createprocedure, sql-createtrigger, sql-comment) and
26
33
  * `src/backend/parser/gram.y` at `REL_18_6` where a page is silent.
27
34
  */
28
35
  import { type Span } from "../core/cursor.js";
@@ -197,17 +204,87 @@ export interface ExtensionNode {
197
204
  version?: Span;
198
205
  cascade: boolean;
199
206
  }
207
+ /** One parameter of a function or procedure: `[mode] [name] type [DEFAULT expr]`. */
208
+ export interface RoutineArgNode {
209
+ mode?: "IN" | "OUT" | "INOUT" | "VARIADIC";
210
+ name?: string;
211
+ nameSpan?: Span;
212
+ type: Span;
213
+ default?: Span;
214
+ }
215
+ export interface RoutineNode {
216
+ statement: "function" | "procedure";
217
+ orReplace: boolean;
218
+ name: NameNode;
219
+ args: RoutineArgNode[];
220
+ /** `RETURNS [SETOF] type`: the type, `SETOF` excluded. */
221
+ returns?: {
222
+ setof: boolean;
223
+ type: Span;
224
+ };
225
+ /** `RETURNS TABLE (name type, ...)`. */
226
+ returnsTable?: Array<{
227
+ name: string;
228
+ nameSpan: Span;
229
+ type: Span;
230
+ }>;
231
+ language?: Span;
232
+ /** The attributes after the signature, by their key word: `VOLATILITY` (IMMUTABLE, STABLE, VOLATILE), `STRICT`, `SECURITY`, `LEAKPROOF`, `PARALLEL`, `COST`, `ROWS`, `SUPPORT`, `WINDOW`, `TRANSFORM`. */
233
+ options: Array<{
234
+ option: string;
235
+ value?: Span;
236
+ flag?: boolean;
237
+ }>;
238
+ /** `SET name { TO | = } value`: the parameter, folded, and its value as written. */
239
+ set: Array<{
240
+ name: string;
241
+ value: Span;
242
+ }>;
243
+ /** `AS 'definition'`, or `AS 'obj_file', 'link_symbol'`: the string constants. */
244
+ body: Span[];
245
+ }
246
+ export interface TriggerNode {
247
+ statement: "trigger";
248
+ orReplace: boolean;
249
+ constraint: boolean;
250
+ name: NameNode;
251
+ timing: "BEFORE" | "AFTER" | "INSTEAD OF";
252
+ events: Array<{
253
+ event: "INSERT" | "UPDATE" | "DELETE" | "TRUNCATE";
254
+ columns: Array<{
255
+ name: string;
256
+ span: Span;
257
+ }>;
258
+ }>;
259
+ table: NameNode;
260
+ /** A constraint trigger's `FROM referenced_table`. */
261
+ from?: NameNode;
262
+ deferrable?: boolean;
263
+ initiallyDeferred?: boolean;
264
+ /** `REFERENCING OLD TABLE AS o NEW TABLE AS n`. */
265
+ referencing: Array<{
266
+ which: "OLD" | "NEW";
267
+ name: string;
268
+ }>;
269
+ forEach?: "ROW" | "STATEMENT";
270
+ /** The `WHEN (...)` condition, parentheses excluded. */
271
+ when?: Span;
272
+ function: NameNode;
273
+ args: Span[];
274
+ }
200
275
  export interface CommentNode {
201
276
  statement: "comment";
202
- /** TABLE, COLUMN, INDEX, VIEW, MATERIALIZED VIEW, SEQUENCE, TYPE, DOMAIN, SCHEMA, EXTENSION, CONSTRAINT, DOMAIN CONSTRAINT. */
277
+ /** TABLE, COLUMN, INDEX, VIEW, MATERIALIZED VIEW, SEQUENCE, TYPE, DOMAIN, SCHEMA, EXTENSION, FUNCTION, PROCEDURE, TRIGGER, CONSTRAINT, DOMAIN CONSTRAINT. */
203
278
  objectType: string;
204
279
  target: NameNode;
205
- /** For `COMMENT ON CONSTRAINT c ON [DOMAIN] t`: the table or domain. */
280
+ /** For `COMMENT ON CONSTRAINT c ON [DOMAIN] t` and `COMMENT ON TRIGGER t ON table`: the table or domain. */
206
281
  on?: NameNode;
282
+ /** For `COMMENT ON FUNCTION f(...)`: the parameter list, parentheses excluded. */
283
+ args?: Span;
207
284
  /** The comment, a string, or undefined for `IS NULL`. */
208
285
  text?: Span;
209
286
  }
210
- export type StatementNode = TableNode | IndexNode | ViewNode | SequenceNode | SchemaNode | EnumNode | DomainNode | ExtensionNode | CommentNode;
287
+ export type StatementNode = TableNode | IndexNode | ViewNode | SequenceNode | SchemaNode | EnumNode | DomainNode | ExtensionNode | RoutineNode | TriggerNode | CommentNode;
211
288
  /**
212
289
  * Parse a template: one CREATE, optionally followed by COMMENT ON statements,
213
290
  * separated by `;`. Throws {@link SqlSyntaxError} located in the template.
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/postgres/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAiB,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5D,YAAY,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B,uGAAuG;AACvG,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAQpD;AAID,MAAM,WAAW,QAAQ;IACvB,oFAAoF;IACpF,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,QAAQ,CAAC,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,GAAG,UAAU,CAAC;AAEzG,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;IACrB,qDAAqD;IACrD,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IAC7C,4DAA4D;IAC5D,IAAI,CAAC,EAAE,IAAI,CAAC;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AG,aAAa,EAAE,CAEhE"}
@@ -1 +1 @@
1
- {"version":3,"file":"deep.d.ts","sourceRoot":"","sources":["../../../src/postgres/plan/deep.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAmB,KAAK,qBAAqB,EAAgC,MAAM,mCAAmC,CAAC;AAE9H,OAAO,EAAyC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI7E,OAAO,EAAkD,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErG,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAcrC,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,GAAG,KAAK,CAGhD;AA6CD,uGAAuG;AACvG,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAmDpH;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/E,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAwChC"}
1
+ {"version":3,"file":"deep.d.ts","sourceRoot":"","sources":["../../../src/postgres/plan/deep.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAmB,KAAK,qBAAqB,EAAgC,MAAM,mCAAmC,CAAC;AAE9H,OAAO,EAAyC,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACvF,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI7E,OAAO,EAAkD,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIrG,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAiBrC,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,GAAG,KAAK,CAGhD;AAuED,uGAAuG;AACvG,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAmDpH;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/E,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAiDhC"}
@@ -16,7 +16,7 @@ import { type ChangeSet, type ClassifiedChange } from "../../core/classifier.js"
16
16
  import { matchByIdentity } from "../../core/diff.js";
17
17
  import { type PgChangeClass, type PgClassifierRuleId } from "./rules.js";
18
18
  import { type CanonicalConstraint } from "./normalize.js";
19
- import type { PgDiffObject, PgSchemaObject } from "./schema.js";
19
+ import { type PgDiffObject, type PgSchemaObject } from "./schema.js";
20
20
  import type { PostgresMigrationOpSuggestion } from "../migrate/handoff.js";
21
21
  /** What the diff needs to know beyond the two schemas: the server's major (`sql.postgresMajor`, else the newest pinned). */
22
22
  export interface PgDiffOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["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
27
27
  * column's columns are `NOT NULL` whether or not that is written;
28
28
  * - an identity column's or a sequence's options at their defaults are left
29
29
  * out; storage parameters compare as a map;
30
- * - an index's access method defaults to `btree`.
30
+ * - an index's access method defaults to `btree`;
31
+ * - a function's or procedure's parameter types drop their modifiers (the
32
+ * catalog keeps none: `varchar(20)` is `character varying`), a parameter's
33
+ * mode is `in` unless written, its attributes at their defaults (VOLATILE,
34
+ * CALLED ON NULL INPUT, SECURITY INVOKER, PARALLEL UNSAFE, COST 100 or 1,
35
+ * ROWS 1000 or 0) are left out, and its body is compared as written, since
36
+ * the server keeps it verbatim;
37
+ * - a trigger's events compare as a set, `UPDATE OF` columns sorted, and its
38
+ * arguments as the strings the catalog stores.
31
39
  *
32
40
  * What the rules cannot see (a view's `SELECT *`, which the server expands, or
33
41
  * an expression it parenthesizes) is asked of the live server itself when a
34
42
  * plan or a deep read has one (`./server-normalize.ts`). Offline, between two
35
43
  * builds, only the rules apply.
36
44
  */
45
+ import type { RoutineProps } from "../entities.js";
37
46
  /** The integer type a serial spelling stands for, or undefined for any other type. */
38
47
  export declare const serialBase: (type: string | undefined) => string | undefined;
39
48
  /** A qualified name in canonical form: each piece unquoted where it can be, the default schema added to a bare one. */
@@ -76,11 +85,17 @@ export interface CanonicalConstraint {
76
85
  notValid?: boolean;
77
86
  comment?: string;
78
87
  }
79
- export type CanonicalKind = "schema" | "table" | "index" | "view" | "materializedView" | "sequence" | "enum" | "domain" | "extension";
88
+ export type CanonicalKind = "schema" | "table" | "index" | "view" | "materializedView" | "sequence" | "enum" | "domain" | "extension" | "function" | "procedure" | "trigger";
80
89
  export interface CanonicalPgObject {
81
90
  kind: CanonicalKind;
82
91
  schema?: string;
83
92
  name: string;
93
+ /**
94
+ * What tells the object from another of the same name: a routine's input
95
+ * parameter types, `(integer,text)`; a trigger's table, ` ON app.users`.
96
+ * Written as SQL names the object after its name.
97
+ */
98
+ signature?: string;
84
99
  /** Everything else that is compared, by field, each field canonical. */
85
100
  fields: Record<string, unknown>;
86
101
  columns: CanonicalColumn[];
@@ -96,6 +111,10 @@ export declare function canonicalSequenceOptions(o: {
96
111
  cache?: string;
97
112
  cycle?: boolean;
98
113
  }, ownerType?: string): string;
114
+ /** A parameter's or result's type as the catalog keeps it: canonical, its modifiers dropped (`varchar(20)` is `character varying`). */
115
+ export declare function canonicalArgType(text: string, defaultSchema: string): string;
116
+ /** A routine's identity among its overloads: its input parameter types, `(integer,text)`. */
117
+ export declare function routineSignature(p: Pick<RoutineProps, "args">, defaultSchema: string): string;
99
118
  /**
100
119
  * A definition in canonical form. `props` is an entity's props, declared or
101
120
  * parsed from what the server printed; `defaultSchema` qualifies a bare name.
@@ -1 +1 @@
1
- {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/postgres/plan/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAyDH,sFAAsF;AACtF,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SAAiE,CAAC;AAEjI,uHAAuH;AACvH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ1E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,aAAa,SAAW,GAAG,MAAM,GAAG,SAAS,CAgCpG;AA8CD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAyB1E;AAmDD,2HAA2H;AAC3H,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAS7F;AAID,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI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AAC;IAC3B,WAAW,EAAE,mBAAmB,EAAE,CAAC;CACpC;AAyBD,8FAA8F;AAC9F,wBAAgB,wBAAwB,CACtC,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,EAC7I,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAiBR;AAoCD,uIAAuI;AACvI,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAI5E;AAKD,6FAA6F;AAC7F,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAE7F;AAqGD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,SAAW,GAAG,iBAAiB,CAsJjI;AAED,kHAAkH;AAClH,wBAAgB,cAAc,CAAC,CAAC,EAAE,mBAAmB,EAAE,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAEtF;AAED,gEAAgE;AAChE,eAAO,MAAM,WAAW,GAAI,2BAA2B,eAAe,KAAG,MAA8B,CAAC"}
@@ -78,6 +78,12 @@ export declare const PG_CLASSIFIER_RULES: {
78
78
  readonly SQLPG266: PgClassifierRule;
79
79
  readonly SQLPG267: PgClassifierRule;
80
80
  readonly SQLPG268: PgClassifierRule;
81
+ readonly SQLPG280: PgClassifierRule;
82
+ readonly SQLPG281: PgClassifierRule;
83
+ readonly SQLPG282: PgClassifierRule;
84
+ readonly SQLPG283: PgClassifierRule;
85
+ readonly SQLPG284: PgClassifierRule;
86
+ readonly SQLPG285: PgClassifierRule;
81
87
  readonly SQLPG270: PgClassifierRule;
82
88
  };
83
89
  export type PgClassifierRuleId = keyof typeof PG_CLASSIFIER_RULES;
@@ -1 +1 @@
1
- {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/postgres/plan/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAkB,KAAK,aAAa,EAAE,KAAK,cAAc,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAErH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhH,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAEhE,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,aAAa,CAY1D,CAAC;AASF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyNqB,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,mBAAmB,CAAC"}
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/postgres/plan/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAkB,KAAK,aAAa,EAAE,KAAK,cAAc,IAAI,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAErH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,UAAU,GAAG,cAAc,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEhH,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAEhE,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,aAAa,CAY1D,CAAC;AASF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6PqB,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,mBAAmB,CAAC"}
@@ -22,6 +22,8 @@ export interface PgDiffObject extends CanonicalPgObject {
22
22
  foreign?: string;
23
23
  /** The export name, against a server. */
24
24
  exportName?: string;
25
+ /** What depends on a routine on the server (a view, a trigger, a default), which a DROP FUNCTION would refuse. */
26
+ dependents?: string[];
25
27
  }
26
28
  export type PgSchemaObject = Keyed<PgDiffObject>;
27
29
  /** The rename hints in a statement: the object's (a comment before the CREATE) and each column's (a comment on its line). */
@@ -37,11 +39,19 @@ export declare function pgSchemaFromBuildOutput(json: string, defaultSchema?: st
37
39
  export declare function pgBuildMajor(json: string): number | undefined;
38
40
  export declare function pgBuildFileMajor(path: string): number | undefined;
39
41
  export declare function pgSchemaFromBuildFile(path: string, defaultSchema?: string): PgSchemaObject[];
40
- /** The identity an object has on a server: its kind's namespace and its qualified name. */
42
+ /**
43
+ * The namespace an object's name is unique in: relations (tables, views,
44
+ * sequences, indexes) share one per schema, types and domains another,
45
+ * functions and procedures a third (told apart by their parameter types),
46
+ * and a trigger's name is unique on its table.
47
+ */
48
+ export declare function pgNamespace(kind: string): string;
49
+ /** The identity an object has on a server: its kind's namespace, its qualified name, and its signature where it has one. */
41
50
  export declare function qualifiedKey(o: {
42
51
  kind: string;
43
52
  schema?: string;
44
53
  name: string;
54
+ signature?: string;
45
55
  }): string;
46
56
  /** The declared objects re-keyed by qualified name, the only identity a server has. */
47
57
  export declare function keyedByQualifiedName(objects: readonly PgSchemaObject[]): PgSchemaObject[];
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/postgres/plan/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,O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"}
@@ -1 +1 @@
1
- {"version":3,"file":"server-normalize.d.ts","sourceRoot":"","sources":["../../../src/postgres/plan/server-normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAwEpE;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,iBAAiB,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CA2B5J"}
1
+ {"version":3,"file":"server-normalize.d.ts","sourceRoot":"","sources":["../../../src/postgres/plan/server-normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AA4FpE;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,iBAAiB,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CA+B5J"}
@@ -5,7 +5,7 @@
5
5
  * the statements are Postgres's own DDL, parsed at build time into entities,
6
6
  * and the names fold and quote as Postgres folds and quotes them.
7
7
  */
8
- export { schema, table, index, view, sequence, type, domain, extension, literal, SqlLiteral, SqlTemplateError, PostgresObject, POSTGRES_ENTITY_TYPES, isPostgresObject, isColumnRef, quoteIdent, type PostgresEntityType, type PostgresSchema, type PostgresRelation, type PostgresTable, type PostgresView, type PostgresIndex, type PostgresSequence, type PostgresEnum, type PostgresDomain, type PostgresExtension, type ColumnDef, type KeyDef, type CheckDef, type ForeignKeyDef, type ExclusionDef, type SchemaProps, type TableProps, type IndexProps, type ViewProps, type SequenceProps, type EnumProps, type DomainProps, type ExtensionProps, type LineageEdge, } from "./postgres/entities.js";
8
+ export { schema, table, index, view, sequence, type, domain, extension, func, procedure, trigger, literal, SqlLiteral, SqlTemplateError, PostgresObject, POSTGRES_ENTITY_TYPES, isPostgresObject, isColumnRef, quoteIdent, type PostgresEntityType, type PostgresSchema, type PostgresRelation, type PostgresTable, type PostgresView, type PostgresIndex, type PostgresSequence, type PostgresEnum, type PostgresDomain, type PostgresExtension, type PostgresFunction, type PostgresProcedure, type PostgresTrigger, type ColumnDef, type KeyDef, type CheckDef, type ForeignKeyDef, type ExclusionDef, type SchemaProps, type TableProps, type IndexProps, type ViewProps, type SequenceProps, type EnumProps, type DomainProps, type ExtensionProps, type RoutineProps, type RoutineArgDef, type FunctionProps, type ProcedureProps, type TriggerProps, type LineageEdge, } from "./postgres/entities.js";
9
9
  export { POSTGRES_PROVIDERS, COMMON_REFUSED, providerData, isPostgresProvider, providerAllowsExtension, isProviderOwned, refusedStatement, normalizeStatement, type PostgresProvider, type ProviderData, type ProviderSource, type RefusedStatement, type LiveObjectRef, } from "./postgres/providers/index.js";
10
10
  export { PostgresMigrationOp, type PostgresMigrationOpConfig, type PostgresMigrationOpResources, type PostgresMigrationArgs, } from "./postgres/migrate/op.js";
11
11
  export { POSTGRES_RECEIPTS_TABLE } from "./postgres/migrate/receipts.js";
@@ -1 +1 @@
1
- {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../src/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,SAAS,EACT,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,WAAW,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,mBAAmB,EACnB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../src/postgres.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,SAAS,EACT,IAAI,EACJ,SAAS,EACT,OAAO,EACP,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,mBAAmB,EACnB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The sql lexicon's `effect()` receipt store (#3657): where the receipts of a
3
+ * project that uses only the sql lexicon are kept, on the database server the
4
+ * environment names.
5
+ *
6
+ * ClickHouse chant_receipts.receipts
7
+ * Postgres chant_receipts.receipts (or <receiptsSchema>.__chant_receipts)
8
+ *
9
+ * The op activities module binds it as `receiptRead`, `receiptWrite` and
10
+ * `receiptStaleness` (`./op/activities/index.ts`), listed as fallbacks: a
11
+ * project that also configures aws or k8s keeps its receipts in that
12
+ * lexicon's receipt row, in whichever order `lexicons` lists them.
13
+ *
14
+ * Which server: the environment is the one `chant run --env` sets
15
+ * (`CHANT_ENV`), else a literal `ownership.env`. Its `sql.profiles.<env>`
16
+ * binds the server, a `postgres://` URL making it Postgres; with no profile,
17
+ * `CLICKHOUSE_URL` or `POSTGRES_URL`, picked by `sql.dialect`. A receipt's
18
+ * address is `<stack>/<env>/<effect>`, from `ownership.stack` and that
19
+ * environment, the same identity the rebuild's and the column migration's
20
+ * receipts carry (`./core/receipts.ts`).
21
+ *
22
+ * Both tables carry chant's ownership trailer with the `receipts` key in their
23
+ * comment (the Postgres schema too), so plan, import and prune leave them out.
24
+ *
25
+ * A caller that runs its own Op over a server it has already bound (a
26
+ * migration runner, say) passes that server instead: a ClickHouse endpoint,
27
+ * or a Postgres connection, whose receipt writes then commit or roll back
28
+ * with whatever transaction the caller has open on it.
29
+ */
30
+ import type { ChantConfig } from "@intentius/chant/config";
31
+ import { type ReceiptActivities, type ReceiptActivityOptions } from "@intentius/chant/op/receipt-store";
32
+ import type { SqlReceiptStore } from "./core/receipts.js";
33
+ import type { ClickHouseEndpoint } from "./clickhouse/http.js";
34
+ import type { Topology } from "./clickhouse/topology.js";
35
+ import type { PostgresClient } from "./postgres/live/client.js";
36
+ /** The database (ClickHouse) or schema (Postgres) the receipts are kept in. */
37
+ export declare const SQL_RECEIPTS_SCHEMA = "chant_receipts";
38
+ /** The table in it. */
39
+ export declare const SQL_RECEIPTS_TABLE = "receipts";
40
+ /** The table's name in a schema of the user's own (`receiptsSchema`), as the column migration names it. */
41
+ export declare const SQL_RECEIPTS_TABLE_BESIDE = "__chant_receipts";
42
+ export interface SqlReceiptStoreOptions {
43
+ /** The chant environment. Default: `CHANT_ENV`, then a literal `ownership.env`. */
44
+ environment?: string;
45
+ /** The address's stack segment. Default: `ownership.stack`. */
46
+ stack?: string;
47
+ /** The project directory chant.config.ts is read from. Default: the working directory. */
48
+ cwd?: string;
49
+ /** The project's config, instead of reading chant.config.ts. */
50
+ config?: Pick<ChantConfig, "sql" | "ownership">;
51
+ /** The process environment the bindings and `CHANT_ENV` are read from. Default: `process.env`. */
52
+ env?: Record<string, string | undefined>;
53
+ /** A ClickHouse server already bound: the receipts go there, and no profile is read. */
54
+ clickhouse?: {
55
+ endpoint: ClickHouseEndpoint;
56
+ topology?: Topology;
57
+ };
58
+ /**
59
+ * A Postgres connection already open: the receipts go over it, and it is
60
+ * never closed. A write runs inside whatever transaction the caller has
61
+ * open, so it commits or rolls back with it. Call `ensure()` before such a
62
+ * transaction begins, so the receipts table does not roll back with it.
63
+ */
64
+ postgres?: PostgresClient;
65
+ /** Postgres: the schema to keep the receipts in. Default: the profile's `receiptsSchema`, then `chant_receipts`. */
66
+ schema?: string;
67
+ /** Recorded on each receipt written. Default: the current Op run's id. */
68
+ runId?: string;
69
+ }
70
+ /** The store, and the step a caller with its own transaction takes before one opens. */
71
+ export interface SqlServerReceiptStore extends SqlReceiptStore {
72
+ /** Create the receipts table (and database or schema) if it is not there. */
73
+ ensure(): Promise<void>;
74
+ /** Where the receipts are, as resolved: `chant_receipts.receipts` and the server it is on. */
75
+ location(): Promise<{
76
+ dialect: "clickhouse" | "postgres";
77
+ table: string;
78
+ source: string;
79
+ address: string;
80
+ }>;
81
+ }
82
+ type Config = Pick<ChantConfig, "sql" | "ownership">;
83
+ /** The dialect an environment's receipts are kept in: its profile's URL, else `sql.dialect`, else whichever server variable is set. */
84
+ export declare function receiptDialect(config: Config | undefined, environment: string | undefined, env: Record<string, string | undefined>): "clickhouse" | "postgres";
85
+ /** The run's environment: the option, `CHANT_ENV`, or a literal `ownership.env`. */
86
+ export declare function environmentOf(options: {
87
+ environment?: string;
88
+ }, config: Pick<ChantConfig, "ownership"> | undefined, env: Record<string, string | undefined>): string | undefined;
89
+ /**
90
+ * The receipt store on the environment's database server. Nothing is read or
91
+ * connected until the first read or write; the environment, the server and
92
+ * the identity are resolved then, once.
93
+ */
94
+ export declare function sqlReceiptStore(options?: SqlReceiptStoreOptions): SqlServerReceiptStore;
95
+ /**
96
+ * The `receiptRead`, `receiptWrite` and `receiptStaleness` activities over
97
+ * {@link sqlReceiptStore}: what the op activities module exports, and what a
98
+ * caller running an Op of `effect()` steps with its own activity map binds.
99
+ */
100
+ export declare function sqlReceiptActivities(options?: SqlReceiptStoreOptions, activityOptions?: ReceiptActivityOptions): ReceiptActivities;
101
+ export {};
102
+ //# sourceMappingURL=receipts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipts.d.ts","sourceRoot":"","sources":["../src/receipts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAqB,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3H,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AACpD,uBAAuB;AACvB,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAC7C,2GAA2G;AAC3G,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAE5D,MAAM,WAAW,sBAAsB;IACrC,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0FAA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I,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,SAAS,CAKhL;AAgGD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,qBAAqB,CA+B3F;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,sBAA2B,EAAE,eAAe,CAAC,EAAE,sBAAsB,GAAG,iBAAiB,CAEtI"}
@@ -17,12 +17,12 @@ export const POSTGRES_TEMPLATE_SOURCES: readonly TemplateSource<PostgresTag>[] =
17
17
  {
18
18
  dialect: "postgres",
19
19
  modules: ["@intentius/chant-lexicon-sql/postgres"],
20
- tags: ["schema", "table", "index", "view", "sequence", "type", "domain", "extension"],
20
+ tags: ["schema", "table", "index", "view", "sequence", "type", "domain", "extension", "func", "procedure", "trigger"],
21
21
  },
22
22
  {
23
23
  dialect: "postgres",
24
24
  modules: ["@intentius/chant-lexicon-sql"],
25
- tags: ["schema", "index", "sequence", "type", "domain", "extension"],
25
+ tags: ["schema", "index", "sequence", "type", "domain", "extension", "func", "procedure", "trigger"],
26
26
  },
27
27
  ];
28
28
 
@@ -13,6 +13,9 @@ const STATEMENT: Record<PostgresTag, string> = {
13
13
  type: "enum",
14
14
  domain: "domain",
15
15
  extension: "extension",
16
+ func: "function",
17
+ procedure: "procedure",
18
+ trigger: "trigger",
16
19
  };
17
20
 
18
21
  const TAG_OF: Record<string, PostgresTag> = Object.fromEntries(Object.entries(STATEMENT).map(([tag, statement]) => [statement, tag as PostgresTag]));
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAgD,KAAK,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAMtH,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AA6DvF,wBAAsB,QAAQ,CAAC,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAoEpF"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAgD,KAAK,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAMtH,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAgEvF,wBAAsB,QAAQ,CAAC,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAoEpF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-sql",
3
- "version": "0.114.1",
3
+ "version": "0.116.0",
4
4
  "description": "SQL lexicon for chant — database schema as typed declarations, one dialect at a time; ClickHouse first, with types read from a pinned server's catalog",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -70,7 +70,7 @@
70
70
  "typescript": "^5.9.3"
71
71
  },
72
72
  "peerDependencies": {
73
- "@intentius/chant": "^0.114.1",
73
+ "@intentius/chant": "^0.116.0",
74
74
  "typescript": "^5.9.3"
75
75
  }
76
76
  }
@@ -49,10 +49,10 @@ export class MutationFailedError extends Error {
49
49
  }
50
50
 
51
51
  /** The table's mutations that are not done. */
52
- export async function pendingMutations(endpoint: ClickHouseEndpoint, database: string, table: string): Promise<PendingMutation[]> {
52
+ export async function pendingMutations(endpoint: ClickHouseEndpoint, database: string, table: string, source = "system.mutations"): Promise<PendingMutation[]> {
53
53
  return clickhouseQuery<PendingMutation>(
54
54
  endpoint,
55
- `SELECT mutation_id, command, latest_fail_reason FROM system.mutations ` +
55
+ `SELECT mutation_id, command, latest_fail_reason FROM ${source} ` +
56
56
  `WHERE database = ${sqlString(database)} AND table = ${sqlString(table)} AND NOT is_done ORDER BY create_time`,
57
57
  );
58
58
  }
@@ -63,6 +63,12 @@ export interface WaitOptions {
63
63
  /** First poll interval; it doubles up to two seconds. Default: 100ms. */
64
64
  intervalMs?: number;
65
65
  signal?: AbortSignal;
66
+ /**
67
+ * Where the mutations are listed. Default: `system.mutations`, this
68
+ * server's. A rebuild across the shards of a cluster waits on every
69
+ * server's, `clusterAllReplicas('<cluster>', system.mutations)` (#3663).
70
+ */
71
+ source?: string;
66
72
  }
67
73
 
68
74
  /**
@@ -78,7 +84,7 @@ export async function waitForMutations(endpoint: ClickHouseEndpoint, database: s
78
84
  const name = `${database}.${table}`;
79
85
  for (;;) {
80
86
  opts.signal?.throwIfAborted();
81
- const pending = await pendingMutations(endpoint, database, table);
87
+ const pending = await pendingMutations(endpoint, database, table, opts.source);
82
88
  for (const m of pending) seen.add(m.mutation_id);
83
89
  if (pending.length === 0) return [...seen];
84
90
  const failing = pending.find((m) => m.latest_fail_reason);