@intentius/chant-lexicon-sql 0.118.1 → 0.121.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 (118) hide show
  1. package/dist/clickhouse/apply/apply.d.ts +1 -1
  2. package/dist/clickhouse/apply/apply.d.ts.map +1 -1
  3. package/dist/clickhouse/apply/statements.d.ts +8 -0
  4. package/dist/clickhouse/apply/statements.d.ts.map +1 -1
  5. package/dist/clickhouse/import/generator.d.ts +1 -1
  6. package/dist/clickhouse/import/generator.d.ts.map +1 -1
  7. package/dist/clickhouse/import/inlined.d.ts +49 -0
  8. package/dist/clickhouse/import/inlined.d.ts.map +1 -0
  9. package/dist/clickhouse/import/live-export.d.ts +22 -0
  10. package/dist/clickhouse/import/live-export.d.ts.map +1 -1
  11. package/dist/clickhouse/live/bind.d.ts +8 -0
  12. package/dist/clickhouse/live/bind.d.ts.map +1 -1
  13. package/dist/clickhouse/live/catalog.d.ts +15 -0
  14. package/dist/clickhouse/live/catalog.d.ts.map +1 -1
  15. package/dist/clickhouse/live/describe-resources.d.ts.map +1 -1
  16. package/dist/clickhouse/plan/commands.d.ts.map +1 -1
  17. package/dist/clickhouse/plan/deep.d.ts +19 -2
  18. package/dist/clickhouse/plan/deep.d.ts.map +1 -1
  19. package/dist/clickhouse/plan/diff.d.ts.map +1 -1
  20. package/dist/clickhouse/plan/normalize.d.ts +3 -0
  21. package/dist/clickhouse/plan/normalize.d.ts.map +1 -1
  22. package/dist/clickhouse/plan/rebuild-handoff.d.ts +2 -0
  23. package/dist/clickhouse/plan/rebuild-handoff.d.ts.map +1 -1
  24. package/dist/clickhouse/rebuild/engines.d.ts +44 -0
  25. package/dist/clickhouse/rebuild/engines.d.ts.map +1 -0
  26. package/dist/clickhouse/rebuild/verify.d.ts +25 -1
  27. package/dist/clickhouse/rebuild/verify.d.ts.map +1 -1
  28. package/dist/clickhouse/testing/fake-server.d.ts +5 -0
  29. package/dist/clickhouse/testing/fake-server.d.ts.map +1 -1
  30. package/dist/config.d.ts +36 -8
  31. package/dist/config.d.ts.map +1 -1
  32. package/dist/core/foreign-tables.d.ts +13 -0
  33. package/dist/core/foreign-tables.d.ts.map +1 -0
  34. package/dist/files/clickhouse.d.ts +7 -3
  35. package/dist/files/clickhouse.d.ts.map +1 -1
  36. package/dist/files/postgres.d.ts +3 -0
  37. package/dist/files/postgres.d.ts.map +1 -1
  38. package/dist/import-parser.d.ts.map +1 -1
  39. package/dist/integrity.json +2 -2
  40. package/dist/manifest.json +1 -1
  41. package/dist/op/activities/clickhouse-emulator.d.ts +7 -1
  42. package/dist/op/activities/clickhouse-emulator.d.ts.map +1 -1
  43. package/dist/op/activities/postgres-emulator.d.ts +8 -1
  44. package/dist/op/activities/postgres-emulator.d.ts.map +1 -1
  45. package/dist/postgres/access/changes.d.ts +23 -0
  46. package/dist/postgres/access/changes.d.ts.map +1 -0
  47. package/dist/postgres/apply/apply.d.ts.map +1 -1
  48. package/dist/postgres/entities.d.ts.map +1 -1
  49. package/dist/postgres/live/bind.d.ts +8 -1
  50. package/dist/postgres/live/bind.d.ts.map +1 -1
  51. package/dist/postgres/live/catalog.d.ts +3 -3
  52. package/dist/postgres/live/catalog.d.ts.map +1 -1
  53. package/dist/postgres/live/client.d.ts +31 -0
  54. package/dist/postgres/live/client.d.ts.map +1 -1
  55. package/dist/postgres/plan/commands.d.ts.map +1 -1
  56. package/dist/postgres/plan/deep.d.ts.map +1 -1
  57. package/dist/sql-files.d.ts +2 -1
  58. package/dist/sql-files.d.ts.map +1 -1
  59. package/package.json +2 -2
  60. package/src/clickhouse/apply/apply.ts +8 -2
  61. package/src/clickhouse/apply/statements.ts +32 -5
  62. package/src/clickhouse/import/generator.ts +8 -3
  63. package/src/clickhouse/import/import.test.ts +72 -0
  64. package/src/clickhouse/import/inlined-functions.e2e.test.ts +87 -0
  65. package/src/clickhouse/import/inlined.test.ts +48 -0
  66. package/src/clickhouse/import/inlined.ts +200 -0
  67. package/src/clickhouse/import/live-export.ts +75 -2
  68. package/src/clickhouse/live/access.e2e.test.ts +71 -18
  69. package/src/clickhouse/live/bind.ts +10 -0
  70. package/src/clickhouse/live/catalog.ts +25 -2
  71. package/src/clickhouse/live/describe-resources.ts +5 -2
  72. package/src/clickhouse/live/live.test.ts +8 -0
  73. package/src/clickhouse/plan/commands.ts +6 -3
  74. package/src/clickhouse/plan/deep-grants.test.ts +67 -0
  75. package/src/clickhouse/plan/deep.ts +70 -6
  76. package/src/clickhouse/plan/diff.ts +4 -1
  77. package/src/clickhouse/plan/normalize.ts +5 -2
  78. package/src/clickhouse/plan/plan.test.ts +9 -1
  79. package/src/clickhouse/plan/rebuild-handoff.ts +11 -1
  80. package/src/clickhouse/rebuild/engines.ts +163 -0
  81. package/src/clickhouse/rebuild/rebuild-collapsing.e2e.test.ts +120 -0
  82. package/src/clickhouse/rebuild/rebuild-into-collapsing.e2e.test.ts +198 -0
  83. package/src/clickhouse/rebuild/rebuild.test.ts +78 -0
  84. package/src/clickhouse/rebuild/verify.ts +153 -24
  85. package/src/clickhouse/testing/fake-server.ts +3 -2
  86. package/src/codegen/classifier-page.ts +1 -1
  87. package/src/config.ts +18 -4
  88. package/src/core/foreign-tables.ts +28 -0
  89. package/src/files/clickhouse.ts +71 -5
  90. package/src/files/postgres.ts +2 -1
  91. package/src/import-parser.ts +2 -0
  92. package/src/migration-statements.test.ts +33 -0
  93. package/src/migration-statements.ts +2 -0
  94. package/src/op/__snapshots__/watch-pipeline.test.ts.snap +1 -1
  95. package/src/op/activities/clickhouse-emulator.ts +22 -1
  96. package/src/op/activities/postgres-apply-lock-timeout.e2e.test.ts +87 -0
  97. package/src/op/activities/postgres-apply.test.ts +32 -0
  98. package/src/op/activities/postgres-emulator.test.ts +20 -0
  99. package/src/op/activities/postgres-emulator.ts +41 -1
  100. package/src/op/apply-gate-access-clickhouse.e2e.test.ts +195 -0
  101. package/src/op/apply-gate-access.e2e.test.ts +207 -0
  102. package/src/postgres/access/access.test.ts +26 -1
  103. package/src/postgres/access/changes.ts +39 -0
  104. package/src/postgres/apply/apply.ts +10 -7
  105. package/src/postgres/entities.ts +20 -1
  106. package/src/postgres/live/bind.ts +16 -4
  107. package/src/postgres/live/catalog.ts +3 -15
  108. package/src/postgres/live/client.ts +85 -0
  109. package/src/postgres/live/live.test.ts +54 -0
  110. package/src/postgres/live/lock-timeout.e2e.test.ts +70 -0
  111. package/src/postgres/plan/commands.ts +2 -14
  112. package/src/postgres/plan/deep.ts +44 -2
  113. package/src/serializer.test.ts +4 -0
  114. package/src/skills/chant-sql-postgres-plan.md +1 -1
  115. package/src/skills/chant-sql-rebuild.md +2 -0
  116. package/src/skills/chant-sql.md +1 -1
  117. package/src/sql-files.test.ts +78 -1
  118. package/src/sql-files.ts +2 -1
@@ -83,5 +83,5 @@ export declare function plannedChanges(target: ClickHouseTarget, declared: reado
83
83
  * exactly one of applied or not attempted, and every pruned orphan; throws
84
84
  * {@link ClickHouseApplyError} when the server refused a statement.
85
85
  */
86
- export declare function applyClickHouse(target: ClickHouseTarget, declared: readonly DeclaredObject[], opts?: ClickHouseApplyOptions): Promise<ClickHouseApplyOutcome>;
86
+ export declare function applyClickHouse(target: ClickHouseTarget, all: readonly DeclaredObject[], opts?: ClickHouseApplyOptions): Promise<ClickHouseApplyOutcome>;
87
87
  //# sourceMappingURL=apply.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/apply/apply.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EACL,aAAa,EAIb,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EA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GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAErD,sGAAsG;AACtG,qBAAa,oBAAqB,SAAQ,aAAa,CAAC,sBAAsB,CAAC;gBACjE,OAAO,EAAE,sBAAsB;CAI5C;AAgBD;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,SAAS,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAMzJ;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,SAAS,cAAc,EAAE,EAAE,IAAI,GAAE,sBAA2B,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAwFlK"}
@@ -164,6 +164,14 @@ export interface StatementPlanInput {
164
164
  * engine the topology runs. Default: the statements as declared.
165
165
  */
166
166
  topology?: Topology;
167
+ /**
168
+ * The versioned path (#3717): a user whose password is the environment's
169
+ * is taken to exist by the time the statements run, so its declared
170
+ * clauses are set with `ALTER USER` and its password left alone, where an
171
+ * apply against a server withholds it until the environment creates it.
172
+ * Default: off.
173
+ */
174
+ environmentCreatesUsers?: boolean;
167
175
  }
168
176
  export interface StatementPlan {
169
177
  /** One entry per declared object, in creation order. */
@@ -1 +1 @@
1
- {"version":3,"file":"statements.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/apply/statements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAoB,KAA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,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,CAK3C,CAAC"}
@@ -21,7 +21,7 @@ export interface TemplateBody {
21
21
  parts: string[];
22
22
  refs: string[];
23
23
  }
24
- export declare const CLICKHOUSE_TAG_OF: Readonly<Record<string, "database" | "table" | "view" | "dictionary" | "func">>;
24
+ export declare const CLICKHOUSE_TAG_OF: Readonly<Record<string, "database" | "table" | "view" | "dictionary" | "func" | "user" | "role" | "policy" | "grant">>;
25
25
  /** A template body as the text between the backquotes. */
26
26
  export declare const bodyText: (body: TemplateBody) => string;
27
27
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/import/generator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC5F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAKjE,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AACD,KAAK,IAAI,GAAG,cAAc,CAAC;AAE3B,uHAAuH;AACvH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM,CAAC,CAO7G,CAAC;AA+EF,0DAA0D;AAC1D,eAAO,MAAM,QAAQ,GAAI,MAAM,YAAY,KAAG,MAA0F,CAAC;AAEzI;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,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KAAG,MAA0F,CAAC;AAEzI;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,OAAO,GAAE,SAAS,IAAI,EAAU,GAAG;IAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;CAAE,CA2BlJ;AAOD,qBAAa,mBAAoB,YAAW,mBAAmB;IAGjD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;IAFpC,QAAQ,CAAC,UAAU,QAAQ;gBAEE,MAAM,CAAC,EAAE,MAAM,YAAA;IAE5C,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,aAAa,EAAE;CAuB1C"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Finding a SQL user-defined function in what ClickHouse stored (#3745).
3
+ *
4
+ * ClickHouse does not keep a call to a SQL function in a view's query or a
5
+ * column's DEFAULT: it writes the function's body in place of the call, with
6
+ * the arguments substituted, and a nested call expanded the same way.
7
+ * `CREATE FUNCTION tax AS x -> (x * 0.2)` used as `tax(amt)` reads back as
8
+ * `amt * 0.2`. So an import can't look for the name; it looks for the body.
9
+ *
10
+ * Each function's body is expanded (a call to another function becomes that
11
+ * function's body), its parameters become wildcards, and the result is
12
+ * matched against the stored statement's tokens. Parentheses that only
13
+ * group are dropped on both sides, since the server adds or leaves them by
14
+ * precedence where the body lands. A wildcard matches one balanced
15
+ * expression, and a parameter used twice must match the same text twice.
16
+ *
17
+ * A function whose body is just a parameter (`x -> x`) leaves nothing to
18
+ * look for, so it is never found this way.
19
+ */
20
+ import { type Token } from "../tokens.js";
21
+ /** One item of a pattern: a token's text, or the parameter at `arg`. */
22
+ type Item = {
23
+ lit: string;
24
+ } | {
25
+ arg: number;
26
+ };
27
+ /** A function's parameters and body, from `CREATE FUNCTION name AS (x, y) -> body`; undefined when it doesn't read that way. */
28
+ export declare function functionLambda(statement: string): {
29
+ params: string[];
30
+ body: Token[];
31
+ } | undefined;
32
+ /** What to look for: the function's expanded body, with its parameters as wildcards. Undefined when nothing but a parameter is left to match. */
33
+ export declare function inlinedPattern(name: string, lambdas: ReadonlyMap<string, {
34
+ params: string[];
35
+ body: Token[];
36
+ }>): Item[] | undefined;
37
+ /** Whether `pattern` appears in `statement`'s tokens. */
38
+ export declare function containsInlined(statement: string, pattern: readonly Item[]): boolean;
39
+ /**
40
+ * The functions among `functions` whose bodies appear inlined in any of
41
+ * `statements`. A function is matched with the others' bodies expanded into
42
+ * its own, as the server does.
43
+ */
44
+ export declare function inlinedFunctions(statements: readonly string[], functions: ReadonlyArray<{
45
+ name: string;
46
+ statement: string;
47
+ }>): string[];
48
+ export {};
49
+ //# sourceMappingURL=inlined.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inlined.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/import/inlined.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAA0B,KAAK,KAAK,EAAE,MAAM,WAAW,CAAC;AAG/D,wEAAwE;AACxE,KAAK,IAAI,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9C,gIAAgI;AAChI,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,KAAK,EAAE,CAAA;CAAE,GAAG,SAAS,CAiBjG;AAuFD,iJAAiJ;AACjJ,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,IAAI,EAAE,KAAK,EAAE,CAAA;CAAE,CAAC,GAAG,IAAI,EAAE,GAAG,SAAS,CAOlI;AAKD,yDAAyD;AACzD,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,IAAI,EAAE,GAAG,OAAO,CAmCpF;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,MAAM,EAAE,CAYvI"}
@@ -13,9 +13,31 @@
13
13
  * - `owned` keeps the objects whose comment carries chant's ownership marker
14
14
  * (`../ownership.ts`), the trailer the applier stamps. The trailer itself is
15
15
  * never written into a declaration: `readLiveSchema` takes it off.
16
+ * - a migration runner's history table (`schema_migrations`,
17
+ * `goose_db_version`) is left out with a warning (#3676), as on Postgres.
18
+ * - A SQL user-defined function belongs to no database, and every project's
19
+ * functions sit side by side on a server (#3718). Without a selector, an
20
+ * import adopts only the functions the imported objects use (and those
21
+ * functions call), and the ones `sql.profiles.<env>.importFunctions` names;
22
+ * a warning names the rest. ClickHouse stores a call as the function's body
23
+ * (#3745), so a use is found by that body (`./inlined.ts`) as well as by
24
+ * the name. A function carries no comment, so `owned` does
25
+ * not apply to it.
16
26
  */
17
27
  import type { ExportedTemplate, ResourceSelector } from "@intentius/chant/lexicon";
18
28
  import { type BindOptions } from "../live/bind.js";
29
+ import type { LiveObject } from "../live/catalog.js";
30
+ /** The functions among `names` a statement calls: a name followed by `(`. */
31
+ export declare function calledFunctions(ddl: string, names: ReadonlySet<string>): string[];
32
+ /**
33
+ * The functions an import adopts (#3718): those the objects call, those
34
+ * whose bodies the objects hold in place of a call (#3745, `./inlined.ts`),
35
+ * those `patterns` name, and the functions those call in turn; and the rest.
36
+ */
37
+ export declare function scopedFunctions(objects: readonly LiveObject[], functions: readonly LiveObject[], patterns?: readonly string[]): {
38
+ adopted: LiveObject[];
39
+ skipped: string[];
40
+ };
19
41
  export interface ExportOptions extends Omit<BindOptions, "environment"> {
20
42
  environment: string;
21
43
  stack?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"live-export.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/import/live-export.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhE,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoBvF"}
1
+ {"version":3,"file":"live-export.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/import/live-export.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAOhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAWjF;AAKD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,EAAE,SAAS,EAAE,SAAS,UAAU,EAAE,EAAE,QAAQ,GAAE,SAAS,MAAM,EAAO,GAAG;IAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAgBhL;AAED,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC;IACrE,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAsCvF"}
@@ -21,6 +21,14 @@ export interface ClickHouseTarget {
21
21
  * as declared.
22
22
  */
23
23
  topology?: Topology;
24
+ /**
25
+ * Whether chant manages access here (`sql.profiles.<env>.access`, #3716):
26
+ * the declared users, roles, row policies and grants. Off when omitted, as
27
+ * on Postgres, and off for a server bound by `CLICKHOUSE_URL`.
28
+ */
29
+ access?: boolean;
30
+ /** `sql.profiles.<env>.importFunctions` (#3718): the functions an import adopts besides those the imported objects call. */
31
+ importFunctions?: string[];
24
32
  }
25
33
  export interface UnresolvedTarget {
26
34
  reason: "no-binding" | "no-credentials";
@@ -1 +1 @@
1
- {"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/live/bind.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAyC,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAA6B,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,gFAAgF;IAChF,MAAM,EAAE,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MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C,GAAG,gBAAgB,GAAG,gBAAgB,CA+CtC;AAED,2CAA2C;AAC3C,qBAAa,sBAAuB,SAAQ,KAAK;IACnC,QAAQ,CAAC,UAAU,EAAE,gBAAgB;gBAA5B,UAAU,EAAE,gBAAgB;CAIlD;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AAYD,kGAAkG;AAClG,wBAAsB,cAAc,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAKzF;AAED,uEAAuE;AACvE,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAWpG;AAED,wCAAwC;AACxC,wBAAsB,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAG7E"}
@@ -21,6 +21,8 @@ export interface LiveObject {
21
21
  statement: string;
22
22
  /** A row policy's table. */
23
23
  table?: string;
24
+ /** The tool that keeps it, for a migration runner's history table (`../../core/foreign-tables.ts`): never chant's to import, change or drop. */
25
+ foreign?: string;
24
26
  }
25
27
  /** The entity type a `system.tables` engine stands for. */
26
28
  export declare function entityTypeOfEngine(engine: string): ClickHouseEntityType;
@@ -32,6 +34,11 @@ export declare function entityTypeOfEngine(engine: string): ClickHouseEntityType
32
34
  * `SELECT` on the database sees it without a grant on `system.dictionaries`;
33
35
  * a table with the `Dictionary` engine is a table.
34
36
  *
37
+ * A table another tool keeps its migration history in (`schema_migrations`,
38
+ * `goose_db_version`, `../../core/foreign-tables.ts`) is read and marked with
39
+ * the tool, as the Postgres reader marks it (#3676): import leaves it out
40
+ * with a warning, and a plan names it in a hint instead of dropping it.
41
+ *
35
42
  * So are chant's own working objects (`../ownership.ts`
36
43
  * `isChantWorkingObject`): a rebuild migration's new, dual-write and retained
37
44
  * tables, and the effect receipts database. None of them is a declaration, so
@@ -59,6 +66,14 @@ export interface DeclaredAccess {
59
66
  export declare function readLiveAccess(target: ClickHouseTarget, declared: readonly DeclaredAccess[], opts?: {
60
67
  withStatements?: boolean;
61
68
  }): Promise<LiveObject[]>;
69
+ /** The canonical kinds a profile's `access` switch decides (#3716). */
70
+ export declare const ACCESS_KINDS: ReadonlySet<string>;
71
+ /** The entity types a profile's `access` switch decides (#3716). */
72
+ export declare const ACCESS_ENTITY_TYPES: ReadonlySet<string>;
73
+ /** Why an access declaration is not read, planned or applied where the profile does not manage access. */
74
+ export declare const ACCESS_UNMANAGED_DETAIL = "access is not managed in this environment: set sql.profiles.<env>.access to plan and apply users, roles, row policies and grants";
75
+ /** The hint a plan gives for the access declarations it left out. */
76
+ export declare function accessUnmanagedHint(n: number, environment: string): string;
62
77
  /** The access objects among declared canonical objects, for `readLiveAccess`. */
63
78
  export declare function declaredAccess(objects: ReadonlyArray<{
64
79
  kind: string;
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/live/catalog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAA2B,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGjF,mEAAmE;AACnE,eAAO,MAAM,gBAAgB,aAAkE,CAAC;AAEhG,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,+HAA+H;I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M,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;IAC9E,mEAAmE;IACnE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,GACnC,OAAO,CAAC,uBAAuB,CAAC,CAMlC"}
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/plan/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EAAe,KAAK,UAAU,EAAwB,MAAM,QAAQ,CAAC;AAM5E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAyD9C,wBAAsB,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBvE;AAED,mFAAmF;AACnF,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAsBvJ;AAED,wBAAsB,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAYvE;AAED,eAAO,MAAM,WAAW,EAAE,YAOzB,CAAC"}
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/plan/commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EAAe,KAAK,UAAU,EAAwB,MAAM,QAAQ,CAAC;AAM5E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAyD9C,wBAAsB,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsBvE;AAED,mFAAmF;AACnF,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAyBvJ;AAED,wBAAsB,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAYvE;AAED,eAAO,MAAM,WAAW,EAAE,YAOzB,CAAC"}
@@ -17,9 +17,14 @@
17
17
  * (#3664). When a server's copy of a table differs from the profile
18
18
  * server's, that copy is what is reported, with the server in `observedOn`,
19
19
  * which the drift report prints as `seen on`.
20
+ *
21
+ * Where the profile manages access, the grants an apply would give or take
22
+ * from each declared grantee are reported as `pending` (#3733), the same
23
+ * statements `chant sql plan` plans (SQLCH273, SQLCH274), so a privilege
24
+ * granted or revoked by hand after an approval moves the plan digest.
20
25
  */
21
- import { type DeepObservationResult, type DeepNormalizationHooks } from "@intentius/chant/deep-observation";
22
- import { type BindOptions } from "../live/bind.js";
26
+ import { type DeepObservationResult, type DeepPendingChange, type DeepNormalizationHooks } from "@intentius/chant/deep-observation";
27
+ import { type BindOptions, type ClickHouseTarget } from "../live/bind.js";
23
28
  import { type CanonicalObject } from "./normalize.js";
24
29
  type Props = Record<string, unknown>;
25
30
  export declare const sqlDeepNormalizationHooks: DeepNormalizationHooks;
@@ -33,5 +38,17 @@ export declare function observeResourcesDeep(options: {
33
38
  props: Record<string, unknown>;
34
39
  }>;
35
40
  } & Omit<BindOptions, "environment">): Promise<DeepObservationResult>;
41
+ /**
42
+ * The grants an apply would give or take from each declared grantee (#3733),
43
+ * as `chant sql plan` compares them: the declared grants against what
44
+ * `SHOW GRANTS FOR` prints, atom by atom. One change per grantee, its
45
+ * REVOKEs before its GRANTs as the applier sends them, with the grant
46
+ * declarations behind it. A grantee the server does not hold yet is given
47
+ * every declared grant.
48
+ */
49
+ export declare function pendingGrants(target: ClickHouseTarget, entities: ReadonlyMap<string, {
50
+ entityType: string;
51
+ props: Record<string, unknown>;
52
+ }>): Promise<DeepPendingChange[]>;
36
53
  export {};
37
54
  //# sourceMappingURL=deep.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deep.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/plan/deep.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAmB,KAAK,qBAAqB,EAAgC,KAAK,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3J,OAAO,EAA6C,KAAK,WAAW,EAAyB,MAAM,cAAc,CAAC;AAMlH,OAAO,EAAoD,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAGrG,KAAK,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAKrC,eAAO,MAAM,yBAAyB,EAAE,sBAEvC,CAAC;AA4BF,uGAAuG;AACvG,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,GAAG,KAAK,CA2ChH;AAqFD,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,CAiFhC"}
1
+ {"version":3,"file":"deep.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/plan/deep.ts"],"names":[],"mappings":"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E,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAoB,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAmC,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE9E,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AAElD,MAAM,MAAM,MAAM,GAAG,gBAAgB,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAC;AAErE,MAAM,WAAW,UAAW,SAAQ,SAAS,CAAC,MAAM,CAAC;IACnD,wDAAwD;IACxD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,6GAA6G;IAC7G,UAAU,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACnC;;;;OAIG;IACH,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;CAChC;AAED,0EAA0E;AAC1E,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAqMD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,UAAU,CAqBvG"}
@@ -88,6 +88,8 @@ export interface CanonicalObject {
88
88
  access?: Record<string, string>;
89
89
  /** `-- previously: <name>` before the statement: the object's previous name. */
90
90
  previously?: string;
91
+ /** The tool that keeps a live table (a migration runner's history table): a plan never drops it. */
92
+ foreign?: string;
91
93
  }
92
94
  /**
93
95
  * The Keeper path and replica name a `Replicated*MergeTree` gets when its
@@ -153,5 +155,6 @@ export declare function liveCanonical(o: {
153
155
  type: string;
154
156
  name: string;
155
157
  statement: string;
158
+ foreign?: string;
156
159
  }, defaultDatabase?: string): CanonicalObject;
157
160
  //# sourceMappingURL=normalize.d.ts.map
@@ -1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RebuildOpSuggestion extends MigrationOpSuggestion {
27
27
  } | {
28
28
  mode: "app";
29
29
  };
30
+ /** What to know before running it: set for an engine that collapses rows by sorting key (#3674, #3727). */
31
+ note?: string;
30
32
  }
31
33
  /**
32
34
  * One suggestion per object the diff refuses as a rebuild. `declared` maps
@@ -1 +1 @@
1
- {"version":3,"file":"rebuild-handoff.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/plan/rebuild-handoff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAuC,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAErG,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB;IAChE,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE;QAAE,IAAI,EAAE,mBAAmB,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC;CACnF;AAID;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAmBzI;AAED,+CAA+C;AAC/C,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,mBAAmB,EAAE,GAAG,MAAM,EAAE,CAE9E"}
1
+ {"version":3,"file":"rebuild-handoff.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/plan/rebuild-handoff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAuC,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGrG,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB;IAChE,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE;QAAE,IAAI,EAAE,mBAAmB,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC;IAClF,2GAA2G;IAC3G,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAID;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAyBzI;AAED,+CAA+C;AAC/C,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,mBAAmB,EAAE,GAAG,MAAM,EAAE,CAG9E"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Which table engines the rebuild reads as merged (#3674): the verification
3
+ * (`./verify.ts`) and the plan's hand-off note (`../plan/rebuild-handoff.ts`).
4
+ */
5
+ /** Whether an engine collapses rows that share a sorting key (#3674). */
6
+ export declare const collapsesRows: (engine: string | undefined) => boolean;
7
+ /** A column of the new table, as `system.columns` reports it. */
8
+ export interface EngineColumn {
9
+ name: string;
10
+ type: string;
11
+ /** Part of the sorting key: the engine never merges its values. */
12
+ inSortingKey: boolean;
13
+ /** Part of the partition key: rows that merge share its value, so a SummingMergeTree does not sum it. */
14
+ inPartitionKey?: boolean;
15
+ }
16
+ /**
17
+ * How a collapsing engine merges the rows that share a sorting key, as what a
18
+ * merge leaves the same (#3727): for each key, the aggregates it preserves and
19
+ * whether it keeps the key at all. Both tables are grouped by the new table's
20
+ * sorting key and compared on these, so it does not matter which parts have
21
+ * merged, and a table that never collapses (a plain MergeTree) compares with
22
+ * one that does.
23
+ */
24
+ export interface CollapseSemantics {
25
+ /** The engine's name without `Replicated` or `Shared`. */
26
+ engine: string;
27
+ /** Per key: what merging leaves unchanged. SQL over the new table's column names. */
28
+ aggregates: string[];
29
+ /** Per key: whether the engine keeps a row for it. Absent: every key keeps one. */
30
+ having?: string;
31
+ /** One line for the summary and the error: what is compared per key. */
32
+ describe: string;
33
+ }
34
+ /** Split on the commas outside parentheses and quotes. */
35
+ export declare function splitTopLevel(text: string): string[];
36
+ /** The engine's own arguments in `system.tables.engine_full`, without a `Replicated` engine's Keeper path and replica name. */
37
+ export declare function engineArguments(engineFull: string): string[];
38
+ /**
39
+ * What a merge of `engine` keeps per sorting key, or undefined for an engine
40
+ * that does not collapse rows, or whose result depends on the order rows
41
+ * merge in (`GraphiteMergeTree` thins its rows by age).
42
+ */
43
+ export declare function collapseSemantics(engine: string, engineFull: string, columns: readonly EngineColumn[]): CollapseSemantics | undefined;
44
+ //# sourceMappingURL=engines.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engines.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/rebuild/engines.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,yEAAyE;AACzE,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,GAAG,SAAS,KAAG,OAA+C,CAAC;AAE3G,iEAAiE;AACjE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,YAAY,EAAE,OAAO,CAAC;IACtB,yGAAyG;IACzG,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,qFAAqF;IACrF,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,mFAAmF;IACnF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,0DAA0D;AAC1D,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAqBpD;AAED,+HAA+H;AAC/H,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAoB5D;AAYD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,iBAAiB,GAAG,SAAS,CAuDrI"}
@@ -24,6 +24,14 @@
24
24
  * later than the cut-over delay, with a time before the cut-over) stop the
25
25
  * swap too, rather than stay behind in the old table.
26
26
  *
27
+ * A table whose engine collapses rows that share a sorting key when parts
28
+ * merge (Summing, Replacing, Aggregating, Collapsing, VersionedCollapsing,
29
+ * Coalescing and Graphite, replicated or not), rebuilt into such an engine,
30
+ * is read under `FINAL` on both sides (#3674). The old table can hold unmerged parts with several rows for
31
+ * one key, which the copy inserts in one block and the new table collapses
32
+ * as it writes them, so the raw counts differ although the data is the same.
33
+ * Under `FINAL` both sides are compared as merged.
34
+ *
27
35
  * On a cluster of more than one shard (#3663) every shard is read, through
28
36
  * the profile's server, and each partition is compared per shard
29
37
  * (`shard<n>/<partition>`), so a shard the copy missed is a difference.
@@ -40,6 +48,7 @@ import { type RebuildObservation } from "./observe.js";
40
48
  import { type RebuildRun } from "./steps.js";
41
49
  export interface PartitionCheck {
42
50
  partition: string;
51
+ /** Rows; keys of the new sorting key when the tables were compared by key (#3727). */
43
52
  rows: number;
44
53
  checksum: string;
45
54
  }
@@ -60,7 +69,22 @@ export interface VerifyResult {
60
69
  export declare class RebuildVerificationError extends Error {
61
70
  readonly table: string;
62
71
  readonly mismatches: Mismatch[];
63
- constructor(table: string, mismatches: Mismatch[]);
72
+ /** The engine, when it collapses rows and the tables were compared under FINAL (#3674) or by sorting key (#3727). */
73
+ readonly collapsingEngine?: string;
74
+ constructor(table: string, mismatches: Mismatch[],
75
+ /** How the tables were compared when an engine collapses rows; an engine's name alone means under FINAL. */
76
+ collapsed?: string | Collapsed);
77
+ }
78
+ /**
79
+ * How the tables were compared when an engine collapses rows: both under
80
+ * FINAL (#3674), or grouped by the new table's sorting key on what its
81
+ * engine's merges keep (#3727).
82
+ */
83
+ export interface Collapsed {
84
+ engine: string;
85
+ how: "final" | "keys";
86
+ /** With `keys`: what is compared per key. */
87
+ describe?: string;
64
88
  }
65
89
  export type Mismatch = {
66
90
  partition: string;
@@ -1 +1 @@
1
- {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/rebuild/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAKH,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAExF,OAAO,EAAuD,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAG/F,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACnC,4IAA4I;IAC5I,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,qGAAqG;IACrG,YAAY,EAAE,cAAc,EAAE,CAAC;CAChC;AAED,sDAAsD;AACtD,qBAAa,wBAAyB,SAAQ,KAAK;IAE/C,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB,QAAQ,CAAC,UAAU,EAAE,QAAQ,EAAE;gBADtB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,QAAQ,EAAE;CAalC;AA6ED,MAAM,MAAM,QAAQ,GAAG;IAAE,SAAS,EAAE,MAA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AE;IAJjC,qHAAqH;IACrH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;gBAExB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,QAAQ,EAAE;IAC/B,4GAA4G;IAC5G,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS;CA0BjC;AAgBD;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC;IACtB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA+ID,MAAM,MAAM,QAAQ,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,cAAc,CAAC;IAAC,GAAG,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC;AAYzF,kGAAkG;AAClG,eAAO,MAAM,OAAO,GAAI,SAAS,SAAS,MAAM,EAAE,KAAG,MAA8D,CAAC;AAEpH;;;GAGG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAG1F;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAqC1E"}
@@ -22,6 +22,11 @@ export interface FakeOptions {
22
22
  body: string;
23
23
  };
24
24
  version?: string;
25
+ /** The SQL user-defined functions `system.functions` lists. Default: none. */
26
+ functions?: Array<{
27
+ name: string;
28
+ statement: string;
29
+ }>;
25
30
  }
26
31
  export declare function fakeClickHouse(objects: FakeObject[], options?: FakeOptions): Promise<FakeServer>;
27
32
  //# sourceMappingURL=fake-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fake-server.d.ts","sourceRoot":"","sources":["../../../src/clickhouse/testing/fake-server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,C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QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxD;AAKD,wBAAsB,cAAc,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,CAkC1G"}
package/dist/config.d.ts CHANGED
@@ -87,6 +87,16 @@ export declare const sqlProfileSchema: z.ZodObject<{
87
87
  databases: z.ZodOptional<z.ZodArray<z.ZodString>>;
88
88
  /** The database an unqualified declaration is created in. `default` when omitted. */
89
89
  defaultDatabase: z.ZodOptional<z.ZodString>;
90
+ /**
91
+ * ClickHouse import (#3718): the SQL user-defined functions `chant import
92
+ * --from <env>` adopts besides those the imported objects use, by name, or
93
+ * by prefix with a trailing `*` (`shop_*`). A function belongs to no
94
+ * database, so without this only the functions the imported tables, views
95
+ * and dictionaries use (and the functions those call) are imported. A use
96
+ * is found by name or, since ClickHouse stores a call as the function's
97
+ * body, by that body (#3745).
98
+ */
99
+ importFunctions: z.ZodOptional<z.ZodArray<z.ZodString>>;
90
100
  /**
91
101
  * ClickHouse: the topology this environment runs, which the applier, the
92
102
  * plan and the rebuild migration render every statement for: `single`,
@@ -142,8 +152,11 @@ export declare const sqlProfileSchema: z.ZodObject<{
142
152
  /**
143
153
  * Postgres apply: how long one statement waits for its lock before it
144
154
  * fails (`lock_timeout`), in milliseconds, so a change blocked behind a
145
- * long query fails fast instead of queueing every query behind it. 5000
146
- * when omitted.
155
+ * long query fails fast instead of queueing every query behind it. The
156
+ * catalog reads (`chant lifecycle diff --live`, `chant sql plan`, the
157
+ * import, and an apply's read before its first statement) wait under it
158
+ * too, and name the session holding the lock when it passes. 5000 when
159
+ * omitted.
147
160
  */
148
161
  lockTimeoutMs: z.ZodOptional<z.ZodNumber>;
149
162
  /**
@@ -158,11 +171,12 @@ export declare const sqlProfileSchema: z.ZodObject<{
158
171
  */
159
172
  scanTimeoutMs: z.ZodOptional<z.ZodNumber>;
160
173
  /**
161
- * Postgres: whether chant manages access in this environment (#3681): the
174
+ * Whether chant manages access in this environment. Postgres (#3681): the
162
175
  * declared row-level security policies and each table's row-level security,
163
176
  * the declared roles (created when missing, never dropped), and the
164
177
  * privileges on the declared objects and the default privileges, which a
165
- * plan compares and an apply grants and revokes. Off when omitted: the
178
+ * plan compares and an apply grants and revokes. ClickHouse (#3716): the
179
+ * declared users, roles, row policies and grants. Off when omitted: the
166
180
  * access declarations are not planned or applied, and the server's access
167
181
  * is not read, so a project that manages access elsewhere is not affected.
168
182
  */
@@ -242,6 +256,16 @@ export declare const sqlConfigSchema: z.ZodObject<{
242
256
  databases: z.ZodOptional<z.ZodArray<z.ZodString>>;
243
257
  /** The database an unqualified declaration is created in. `default` when omitted. */
244
258
  defaultDatabase: z.ZodOptional<z.ZodString>;
259
+ /**
260
+ * ClickHouse import (#3718): the SQL user-defined functions `chant import
261
+ * --from <env>` adopts besides those the imported objects use, by name, or
262
+ * by prefix with a trailing `*` (`shop_*`). A function belongs to no
263
+ * database, so without this only the functions the imported tables, views
264
+ * and dictionaries use (and the functions those call) are imported. A use
265
+ * is found by name or, since ClickHouse stores a call as the function's
266
+ * body, by that body (#3745).
267
+ */
268
+ importFunctions: z.ZodOptional<z.ZodArray<z.ZodString>>;
245
269
  /**
246
270
  * ClickHouse: the topology this environment runs, which the applier, the
247
271
  * plan and the rebuild migration render every statement for: `single`,
@@ -297,8 +321,11 @@ export declare const sqlConfigSchema: z.ZodObject<{
297
321
  /**
298
322
  * Postgres apply: how long one statement waits for its lock before it
299
323
  * fails (`lock_timeout`), in milliseconds, so a change blocked behind a
300
- * long query fails fast instead of queueing every query behind it. 5000
301
- * when omitted.
324
+ * long query fails fast instead of queueing every query behind it. The
325
+ * catalog reads (`chant lifecycle diff --live`, `chant sql plan`, the
326
+ * import, and an apply's read before its first statement) wait under it
327
+ * too, and name the session holding the lock when it passes. 5000 when
328
+ * omitted.
302
329
  */
303
330
  lockTimeoutMs: z.ZodOptional<z.ZodNumber>;
304
331
  /**
@@ -313,11 +340,12 @@ export declare const sqlConfigSchema: z.ZodObject<{
313
340
  */
314
341
  scanTimeoutMs: z.ZodOptional<z.ZodNumber>;
315
342
  /**
316
- * Postgres: whether chant manages access in this environment (#3681): the
343
+ * Whether chant manages access in this environment. Postgres (#3681): the
317
344
  * declared row-level security policies and each table's row-level security,
318
345
  * the declared roles (created when missing, never dropped), and the
319
346
  * privileges on the declared objects and the default privileges, which a
320
- * plan compares and an apply grants and revokes. Off when omitted: the
347
+ * plan compares and an apply grants and revokes. ClickHouse (#3716): the
348
+ * declared users, roles, row policies and grants. Off when omitted: the
321
349
  * access declarations are not planned or applied, and the server's access
322
350
  * is not read, so a project that manages access elsewhere is not affected.
323
351
  */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAmC3D,eAAO,MAAM,gBAAgB;IAC3B;;;;;OAKG;;IAEH,2EAA2E;;;;IAE3E;;;;;;;OAOG;;;;;;;;;;;;;;;;;;IAEH;;;;OAIG;;IAEH,qFAAqF;;IAErF;;;;;;;;;OASG;;;;;;;;;;;;;;IAEH;;;;;OAKG;;IAEH,4FAA4F;;IAE5F;;;;;OAKG;;IAEH;;;;OAIG;;;;;;;;;IAEH;;;;;OAKG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;;;;;;OAQG;;kBAEH,CAAC;AAcH,eAAO,MAAM,eAAe;IAC1B,iEAAiE;;;;;;;;IAEjE;;;;OAIG;;;;;;;;;IAEH;;;;OAIG;;IAMH,wCAAwC;;QAxHxC;;;;;WAKG;;QAEH,2EAA2E;;;;QAE3E;;;;;;;WAOG;;;;;;;;;;;;;;;;;;QA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IAEjE;;;;OAIG;;;;;;;;;IAEH;;;;OAIG;;IAMH,wCAAwC;;QAtIxC;;;;;WAKG;;QAEH,2EAA2E;;;;QAE3E;;;;;;;WAOG;;;;;;;;;;;;;;;;;;QAEH;;;;WAIG;;QAEH,qFAAqF;;QAErF;;;;;;;;WAQG;;QAEH;;;;;;;;;WASG;;;;;;;;;;;;;;QAEH;;;;;WAKG;;QAEH,4FAA4F;;QAE5F;;;;;WAKG;;QAEH;;;;WAIG;;;;;;;;;QAEH;;;;;;;;WAQG;;QAEH;;;WAGG;;QAEH;;;;WAIG;;QAEH;;;;;;;;;WASG;;;kBAqCH,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,OAAO,QAAQ,yBAAyB,CAAC;IACvC,UAAU,WAAW;QACnB,GAAG,CAAC,EAAE,SAAS,CAAC;KACjB;CACF;AAED,4EAA4E;AAC5E,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Tables another tool keeps its migration history in, by name, with the tool.
3
+ *
4
+ * Both dialects' catalog readers mark a table by one of these names as
5
+ * foreign: import leaves it out with a warning, and a plan names it in a hint
6
+ * instead of proposing a drop, since chant changing it would change what that
7
+ * tool owns (#3047 question 10, #3676). golang-migrate, dbmate, goose and
8
+ * Flyway keep the same tables on ClickHouse as on Postgres.
9
+ */
10
+ export declare const FOREIGN_TABLES: Readonly<Record<string, string>>;
11
+ /** The tool that keeps a table by this name, or undefined when none does. */
12
+ export declare function foreignTool(name: string): string | undefined;
13
+ //# sourceMappingURL=foreign-tables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"foreign-tables.d.ts","sourceRoot":"","sources":["../../src/core/foreign-tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAa3D,CAAC;AAEF,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE5D"}