@intentius/chant-lexicon-sql 0.117.0 → 0.118.1

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 (183) hide show
  1. package/dist/clickhouse/access.d.ts +132 -0
  2. package/dist/clickhouse/access.d.ts.map +1 -0
  3. package/dist/clickhouse/apply/apply.d.ts.map +1 -1
  4. package/dist/clickhouse/apply/statements.d.ts +2 -0
  5. package/dist/clickhouse/apply/statements.d.ts.map +1 -1
  6. package/dist/clickhouse/entities.d.ts +171 -2
  7. package/dist/clickhouse/entities.d.ts.map +1 -1
  8. package/dist/clickhouse/http.d.ts +3 -0
  9. package/dist/clickhouse/http.d.ts.map +1 -1
  10. package/dist/clickhouse/import/generator.d.ts +28 -0
  11. package/dist/clickhouse/import/generator.d.ts.map +1 -1
  12. package/dist/clickhouse/import/ir.d.ts.map +1 -1
  13. package/dist/clickhouse/import/parser.d.ts +3 -3
  14. package/dist/clickhouse/import/parser.d.ts.map +1 -1
  15. package/dist/clickhouse/live/bind.d.ts.map +1 -1
  16. package/dist/clickhouse/live/catalog.d.ts +41 -6
  17. package/dist/clickhouse/live/catalog.d.ts.map +1 -1
  18. package/dist/clickhouse/live/describe-resources.d.ts +3 -2
  19. package/dist/clickhouse/live/describe-resources.d.ts.map +1 -1
  20. package/dist/clickhouse/parser.d.ts +54 -3
  21. package/dist/clickhouse/parser.d.ts.map +1 -1
  22. package/dist/clickhouse/plan/commands.d.ts +3 -1
  23. package/dist/clickhouse/plan/commands.d.ts.map +1 -1
  24. package/dist/clickhouse/plan/deep.d.ts.map +1 -1
  25. package/dist/clickhouse/plan/diff.d.ts +12 -0
  26. package/dist/clickhouse/plan/diff.d.ts.map +1 -1
  27. package/dist/clickhouse/plan/normalize.d.ts +61 -1
  28. package/dist/clickhouse/plan/normalize.d.ts.map +1 -1
  29. package/dist/clickhouse/plan/report.d.ts.map +1 -1
  30. package/dist/clickhouse/plan/rules.d.ts +7 -0
  31. package/dist/clickhouse/plan/rules.d.ts.map +1 -1
  32. package/dist/clickhouse/plan/schema.d.ts +8 -4
  33. package/dist/clickhouse/plan/schema.d.ts.map +1 -1
  34. package/dist/clickhouse/rebuild/backfill.d.ts +3 -1
  35. package/dist/clickhouse/rebuild/backfill.d.ts.map +1 -1
  36. package/dist/clickhouse/rebuild/observe.d.ts +7 -3
  37. package/dist/clickhouse/rebuild/observe.d.ts.map +1 -1
  38. package/dist/clickhouse/rebuild/op.d.ts +8 -0
  39. package/dist/clickhouse/rebuild/op.d.ts.map +1 -1
  40. package/dist/clickhouse/rebuild/steps.d.ts +48 -0
  41. package/dist/clickhouse/rebuild/steps.d.ts.map +1 -1
  42. package/dist/clickhouse/testing/fake-server.d.ts.map +1 -1
  43. package/dist/clickhouse/testing/writable-server.d.ts.map +1 -1
  44. package/dist/clickhouse/topology.d.ts.map +1 -1
  45. package/dist/clickhouse.d.ts +1 -1
  46. package/dist/clickhouse.d.ts.map +1 -1
  47. package/dist/codegen/classifier-page.d.ts.map +1 -1
  48. package/dist/codegen/registry.d.ts.map +1 -1
  49. package/dist/config.d.ts +50 -7
  50. package/dist/config.d.ts.map +1 -1
  51. package/dist/core/references.d.ts +4 -2
  52. package/dist/core/references.d.ts.map +1 -1
  53. package/dist/core/statements.d.ts +11 -0
  54. package/dist/core/statements.d.ts.map +1 -1
  55. package/dist/files/build-root.d.ts +34 -0
  56. package/dist/files/build-root.d.ts.map +1 -0
  57. package/dist/files/clickhouse.d.ts +19 -0
  58. package/dist/files/clickhouse.d.ts.map +1 -0
  59. package/dist/files/common.d.ts +25 -0
  60. package/dist/files/common.d.ts.map +1 -0
  61. package/dist/files/postgres.d.ts +36 -0
  62. package/dist/files/postgres.d.ts.map +1 -0
  63. package/dist/import-parser.d.ts +25 -0
  64. package/dist/import-parser.d.ts.map +1 -0
  65. package/dist/index.d.ts +3 -2
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/integrity.json +6 -6
  68. package/dist/lint/rules/sqlch001.d.ts +1 -1
  69. package/dist/lint/rules/sqlch001.d.ts.map +1 -1
  70. package/dist/lint/rules/sqlch002.d.ts.map +1 -1
  71. package/dist/lint/rules/templates.d.ts +1 -1
  72. package/dist/lint/rules/templates.d.ts.map +1 -1
  73. package/dist/manifest.json +1 -1
  74. package/dist/meta.json +30 -0
  75. package/dist/okf/index.md +7 -1
  76. package/dist/okf/rules/SQLCH001.md +2 -2
  77. package/dist/okf/types/Dictionary.md +9 -0
  78. package/dist/okf/types/Function.md +9 -0
  79. package/dist/okf/types/Grant.md +9 -0
  80. package/dist/okf/types/Role.md +9 -0
  81. package/dist/okf/types/RowPolicy.md +9 -0
  82. package/dist/okf/types/User.md +9 -0
  83. package/dist/op/activities/clickhouse-rebuild.d.ts.map +1 -1
  84. package/dist/op/activity-contracts.d.ts +9 -0
  85. package/dist/op/activity-contracts.d.ts.map +1 -1
  86. package/dist/plugin.d.ts.map +1 -1
  87. package/dist/postgres/apply/statements.d.ts +68 -0
  88. package/dist/postgres/apply/statements.d.ts.map +1 -1
  89. package/dist/postgres/import/generator.d.ts +33 -0
  90. package/dist/postgres/import/generator.d.ts.map +1 -1
  91. package/dist/postgres/live/bind.d.ts.map +1 -1
  92. package/dist/postgres/live/client.d.ts +3 -0
  93. package/dist/postgres/live/client.d.ts.map +1 -1
  94. package/dist/rules/sqlch001.ts +26 -4
  95. package/dist/rules/sqlch002.ts +3 -2
  96. package/dist/rules/templates.ts +2 -2
  97. package/dist/serializer.d.ts +2 -1
  98. package/dist/serializer.d.ts.map +1 -1
  99. package/dist/sql-files.d.ts +79 -0
  100. package/dist/sql-files.d.ts.map +1 -0
  101. package/dist/token-source.d.ts +88 -0
  102. package/dist/token-source.d.ts.map +1 -0
  103. package/dist/validate.d.ts.map +1 -1
  104. package/package.json +2 -2
  105. package/src/clickhouse/access.test.ts +203 -0
  106. package/src/clickhouse/access.ts +595 -0
  107. package/src/clickhouse/apply/apply.ts +29 -20
  108. package/src/clickhouse/apply/statements.ts +105 -8
  109. package/src/clickhouse/dictionary.test.ts +177 -0
  110. package/src/clickhouse/entities.ts +356 -6
  111. package/src/clickhouse/function.test.ts +91 -0
  112. package/src/clickhouse/http.ts +11 -2
  113. package/src/clickhouse/import/generator.ts +81 -46
  114. package/src/clickhouse/import/import.test.ts +9 -3
  115. package/src/clickhouse/import/ir.ts +6 -2
  116. package/src/clickhouse/import/parser.ts +10 -18
  117. package/src/clickhouse/live/access.e2e.test.ts +218 -0
  118. package/src/clickhouse/live/bind.ts +17 -6
  119. package/src/clickhouse/live/catalog.ts +106 -10
  120. package/src/clickhouse/live/describe-resources.ts +23 -10
  121. package/src/clickhouse/live/dictionaries.e2e.test.ts +186 -0
  122. package/src/clickhouse/live/functions.e2e.test.ts +155 -0
  123. package/src/clickhouse/live/live.test.ts +2 -2
  124. package/src/clickhouse/parser.ts +136 -4
  125. package/src/clickhouse/plan/commands.ts +18 -7
  126. package/src/clickhouse/plan/deep.ts +71 -11
  127. package/src/clickhouse/plan/diff.ts +65 -2
  128. package/src/clickhouse/plan/normalize.ts +200 -6
  129. package/src/clickhouse/plan/report.ts +14 -3
  130. package/src/clickhouse/plan/rules.ts +44 -1
  131. package/src/clickhouse/plan/schema.ts +40 -17
  132. package/src/clickhouse/plan/server-format.ts +1 -1
  133. package/src/clickhouse/rebuild/backfill.ts +5 -25
  134. package/src/clickhouse/rebuild/observe.ts +7 -3
  135. package/src/clickhouse/rebuild/op.ts +9 -0
  136. package/src/clickhouse/rebuild/rebuild.e2e.test.ts +62 -0
  137. package/src/clickhouse/rebuild/rebuild.test.ts +54 -0
  138. package/src/clickhouse/rebuild/steps.ts +136 -1
  139. package/src/clickhouse/testing/fake-server.ts +2 -0
  140. package/src/clickhouse/testing/writable-server.ts +2 -0
  141. package/src/clickhouse/topology.ts +17 -2
  142. package/src/clickhouse.ts +19 -0
  143. package/src/codegen/classifier-page.ts +2 -0
  144. package/src/codegen/registry.ts +6 -0
  145. package/src/config.ts +12 -3
  146. package/src/core/references.ts +5 -3
  147. package/src/core/statements.ts +11 -1
  148. package/src/files/build-root.ts +74 -0
  149. package/src/files/clickhouse.ts +52 -0
  150. package/src/files/common.ts +54 -0
  151. package/src/files/postgres.ts +371 -0
  152. package/src/generated/lexicon-sql.json +30 -0
  153. package/src/import-parser.ts +61 -0
  154. package/src/index.ts +15 -2
  155. package/src/lint/rules/sqlch001.ts +26 -4
  156. package/src/lint/rules/sqlch002.ts +3 -2
  157. package/src/lint/rules/templates.ts +2 -2
  158. package/src/lsp/template.ts +3 -3
  159. package/src/mcp/index.ts +6 -6
  160. package/src/migration-statements.test.ts +25 -0
  161. package/src/migration-statements.ts +1 -0
  162. package/src/op/activities/clickhouse-rebuild.ts +1 -0
  163. package/src/op/activity-contracts.ts +1 -0
  164. package/src/plugin.ts +29 -8
  165. package/src/postgres/apply/constraint-sequences.e2e.test.ts +179 -0
  166. package/src/postgres/apply/safe-sequences.e2e.test.ts +176 -0
  167. package/src/postgres/apply/statements.test.ts +138 -6
  168. package/src/postgres/apply/statements.ts +156 -10
  169. package/src/postgres/import/generator.ts +118 -45
  170. package/src/postgres/live/bind.ts +17 -6
  171. package/src/postgres/live/client.ts +10 -2
  172. package/src/postgres/plan/plan.test.ts +2 -2
  173. package/src/postgres/plan/rules.ts +5 -5
  174. package/src/serializer.ts +14 -9
  175. package/src/skills/chant-sql-postgres-plan.md +3 -3
  176. package/src/skills/chant-sql-rebuild.md +3 -2
  177. package/src/skills/chant-sql.md +7 -1
  178. package/src/sql-files.test.ts +220 -0
  179. package/src/sql-files.ts +218 -0
  180. package/src/token-source.e2e.test.ts +142 -0
  181. package/src/token-source.test.ts +119 -0
  182. package/src/token-source.ts +189 -0
  183. package/src/validate.ts +6 -0
@@ -27,6 +27,7 @@ export declare const clickhouseRebuildPlanContract: import("@intentius/chant/op"
27
27
  retain?: string | undefined;
28
28
  mutationTimeout?: string | undefined;
29
29
  replicaTimeout?: string | undefined;
30
+ cutoverTimeout?: string | undefined;
30
31
  stack?: string | undefined;
31
32
  ownershipEnv?: string | undefined;
32
33
  cwd?: string | undefined;
@@ -52,6 +53,7 @@ export declare const clickhouseRebuildCreateContract: import("@intentius/chant/o
52
53
  retain?: string | undefined;
53
54
  mutationTimeout?: string | undefined;
54
55
  replicaTimeout?: string | undefined;
56
+ cutoverTimeout?: string | undefined;
55
57
  stack?: string | undefined;
56
58
  ownershipEnv?: string | undefined;
57
59
  cwd?: string | undefined;
@@ -75,6 +77,7 @@ export declare const clickhouseRebuildDualWriteContract: import("@intentius/chan
75
77
  retain?: string | undefined;
76
78
  mutationTimeout?: string | undefined;
77
79
  replicaTimeout?: string | undefined;
80
+ cutoverTimeout?: string | undefined;
78
81
  stack?: string | undefined;
79
82
  ownershipEnv?: string | undefined;
80
83
  cwd?: string | undefined;
@@ -99,6 +102,7 @@ export declare const clickhouseRebuildBackfillContract: import("@intentius/chant
99
102
  retain?: string | undefined;
100
103
  mutationTimeout?: string | undefined;
101
104
  replicaTimeout?: string | undefined;
105
+ cutoverTimeout?: string | undefined;
102
106
  stack?: string | undefined;
103
107
  ownershipEnv?: string | undefined;
104
108
  cwd?: string | undefined;
@@ -124,6 +128,7 @@ export declare const clickhouseRebuildVerifyContract: import("@intentius/chant/o
124
128
  retain?: string | undefined;
125
129
  mutationTimeout?: string | undefined;
126
130
  replicaTimeout?: string | undefined;
131
+ cutoverTimeout?: string | undefined;
127
132
  stack?: string | undefined;
128
133
  ownershipEnv?: string | undefined;
129
134
  cwd?: string | undefined;
@@ -154,6 +159,7 @@ export declare const clickhouseRebuildSwapContract: import("@intentius/chant/op"
154
159
  retain?: string | undefined;
155
160
  mutationTimeout?: string | undefined;
156
161
  replicaTimeout?: string | undefined;
162
+ cutoverTimeout?: string | undefined;
157
163
  stack?: string | undefined;
158
164
  ownershipEnv?: string | undefined;
159
165
  cwd?: string | undefined;
@@ -179,6 +185,7 @@ export declare const clickhouseRebuildRetainContract: import("@intentius/chant/o
179
185
  retain?: string | undefined;
180
186
  mutationTimeout?: string | undefined;
181
187
  replicaTimeout?: string | undefined;
188
+ cutoverTimeout?: string | undefined;
182
189
  stack?: string | undefined;
183
190
  ownershipEnv?: string | undefined;
184
191
  cwd?: string | undefined;
@@ -204,6 +211,7 @@ export declare const clickhouseRebuildDropContract: import("@intentius/chant/op"
204
211
  retain?: string | undefined;
205
212
  mutationTimeout?: string | undefined;
206
213
  replicaTimeout?: string | undefined;
214
+ cutoverTimeout?: string | undefined;
207
215
  stack?: string | undefined;
208
216
  ownershipEnv?: string | undefined;
209
217
  cwd?: string | undefined;
@@ -228,6 +236,7 @@ export declare const clickhouseRebuildCompensateContract: import("@intentius/cha
228
236
  retain?: string | undefined;
229
237
  mutationTimeout?: string | undefined;
230
238
  replicaTimeout?: string | undefined;
239
+ cutoverTimeout?: string | undefined;
231
240
  stack?: string | undefined;
232
241
  ownershipEnv?: string | undefined;
233
242
  cwd?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"activity-contracts.d.ts","sourceRoot":"","sources":["../../src/op/activity-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA4BH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;EAKzC,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;EAK3C,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;EAK9C,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;EAK7C,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY3C,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;EAKzC,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;EAK3C,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;EAKzC,CAAC;AAEF,eAAO,MAAM,mCAAmC;;;;;;;;;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"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAgB,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAwB5E,eAAO,MAAM,SAAS,EAAE,aA0OvB,CAAC"}
@@ -56,6 +56,20 @@ export interface PgStep {
56
56
  rule?: PgClassifierRuleId;
57
57
  /** An index this statement builds CONCURRENTLY: a failed build leaves it INVALID, and the applier drops it again. */
58
58
  buildsIndex?: string;
59
+ /** A query to run before the statement, whose success depends on the rows already in the table (#3686). */
60
+ precheck?: PgPrecheck;
61
+ }
62
+ /**
63
+ * A data-dependent statement's pre-check (#3686): a query that returns one
64
+ * row with one column, `n`, the count of rows (or groups of rows) the
65
+ * statement would fail on. Zero means it can run. Nothing runs it on its own:
66
+ * a caller runs every step's pre-check before the first statement, and stops
67
+ * when one is not zero. It reads the table without locking it beyond `SELECT`.
68
+ */
69
+ export interface PgPrecheck {
70
+ sql: string;
71
+ /** What a count above zero means, e.g. `rows where email is NULL, which SET NOT NULL fails on`. */
72
+ detail: string;
59
73
  }
60
74
  /** What {@link alterSteps} could not make in place: changes with no statement, each with why. */
61
75
  export interface UnsupportedChange {
@@ -81,6 +95,31 @@ export declare const objectIdent: (o: {
81
95
  export declare const KIND_WORDS: Readonly<Record<CanonicalKind, string>>;
82
96
  /** The canonical kind of an entity type. */
83
97
  export declare const kindOfType: (type: string) => CanonicalKind;
98
+ /** The rows of `table` with `column` NULL: what SET NOT NULL fails on. */
99
+ export declare function nullPrecheck(table: string, column: string): PgPrecheck;
100
+ /**
101
+ * The groups of rows of `table` with the same `columns`: what a unique index
102
+ * or a unique or primary key constraint fails on. NULLs are distinct unless
103
+ * `nullsNotDistinct`; a primary key also counts the rows with a NULL key
104
+ * column, which its implied NOT NULL fails on. `where` is a partial index's
105
+ * predicate.
106
+ */
107
+ export declare function duplicatePrecheck(table: string, columns: readonly string[], opts?: {
108
+ primaryKey?: boolean;
109
+ nullsNotDistinct?: boolean;
110
+ where?: string;
111
+ }): PgPrecheck;
112
+ /** The rows of `table` that fail a CHECK: its expression false (a NULL result passes). */
113
+ export declare function checkPrecheck(table: string, expr: string, name?: string): PgPrecheck;
114
+ /**
115
+ * The rows of `table` whose foreign key references no row: every key column
116
+ * set and no referenced row with those values (MATCH SIMPLE, the default).
117
+ * Undefined for a foreign key that names no referenced columns or is MATCH
118
+ * FULL, which the query does not cover.
119
+ */
120
+ export declare function foreignKeyPrecheck(table: string, fk: ForeignKeyDef): PgPrecheck | undefined;
121
+ /** The check that proves a column NOT NULL while SET NOT NULL runs (SQLPG210), named as the migration Op names its own. */
122
+ export declare const notNullCheckName: (column: string) => string;
84
123
  interface Statement {
85
124
  text: string;
86
125
  tokens: Token[];
@@ -109,6 +148,22 @@ export declare function dropStatement(kind: CanonicalKind, schema: string | unde
109
148
  export declare function columnDefinition(c: ColumnDef): string;
110
149
  /** A constraint as a table constraint (`ADD CONSTRAINT ...`), whether it was declared on a column or the table. */
111
150
  export declare function constraintSql(kind: CanonicalConstraint["kind"], def: KeyDef | CheckDef | ForeignKeyDef | ExclusionDef): string;
151
+ /**
152
+ * A CHECK (SQLPG218) or a foreign key (SQLPG219) added to a table that
153
+ * exists, without reading its rows under a lock that blocks writes: the
154
+ * constraint added NOT VALID, which checks new rows only (SQLPG217), then
155
+ * validated (SQLPG220), which reads the rows under SHARE UPDATE EXCLUSIVE
156
+ * while writes go on. The applier commits between the two, since their
157
+ * classes differ, so the validation runs in a transaction of its own. A run
158
+ * interrupted after the first statement leaves the constraint NOT VALID on
159
+ * the server, and the next plan validates it as found. The first statement
160
+ * carries the pre-check (the rows the check or the foreign key refuses).
161
+ * VALIDATE needs a name, so a constraint declared without one is given
162
+ * {@link unnamedConstraintName}'s; the diff matches an unnamed declaration
163
+ * to the constraint by its body, whatever it is called.
164
+ */
165
+ /** The name given to a CHECK or foreign key declared without one: `<table>_<hash of its body>_check` or `_fkey`. */
166
+ export declare function unnamedConstraintName(table: string, c: Pick<CanonicalConstraint, "kind" | "body">): string;
112
167
  /** `ALTER SEQUENCE`'s options for what is declared, every option left out set back to its default. */
113
168
  export declare function sequenceOptionsSql(p: SequenceProps): string;
114
169
  /** Changes a plan refuses to make in place: expand and contract, by the migration Op (#3281). */
@@ -117,6 +172,19 @@ export declare const isRefused: (c: PgChange) => boolean;
117
172
  export declare const isDestructive: (c: PgChange) => boolean;
118
173
  /** Changes that replace the object: drop it and create it again from its declaration. */
119
174
  export declare const isRecreate: (c: PgChange) => boolean;
175
+ /**
176
+ * SET NOT NULL on a table that exists, without reading the table under
177
+ * ACCESS EXCLUSIVE (SQLPG210): a CHECK (column IS NOT NULL) added NOT VALID,
178
+ * which reads no rows; validated, which reads them under SHARE UPDATE
179
+ * EXCLUSIVE while writes go on; then SET NOT NULL, which the valid check
180
+ * proves without a scan (12 and later), and the check dropped. The applier
181
+ * commits between the catalog changes and the validation, so the brief
182
+ * ACCESS EXCLUSIVE locks are never held across the scan. A check left by an
183
+ * interrupted run is validated as found. The first statement carries the
184
+ * NULL count as its pre-check. 18's `NOT NULL ... NOT VALID` would save the
185
+ * last statement; the check is used on every major for one sequence.
186
+ */
187
+ export declare function setNotNullSteps(table: string, column: string, live?: Pick<PgDiffObject, "constraints">): PgStep[];
120
188
  /**
121
189
  * The statements for an object that exists on the server, change by change.
122
190
  * `live` is the server's definition, matched to the declaration (a renamed
@@ -1 +1 @@
1
- {"version":3,"file":"statements.d.ts","sourceRoot":"","sources":["../../../src/postgres/apply/statements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAA0B,KAAK,KAAK,EAAE,MAAM,WAAW,CAAC;AAG/D,OAAO,EAAyB,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEjF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAuB,KAAK,aAAa,EAAE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AMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,oBAAoB,GAAG,eAAe,CAmF7E"}
@@ -22,10 +22,43 @@
22
22
  */
23
23
  import type { GeneratedFile, TypeScriptGenerator } from "@intentius/chant/import/generator";
24
24
  import type { TemplateIR } from "@intentius/chant/import/parser";
25
+ /** One object a template is written for, or (with no `ddl` read) one a template may reference. */
26
+ export interface PgTemplateItem {
27
+ exportName: string;
28
+ type: string;
29
+ schema?: string;
30
+ name: string;
31
+ ddl: string;
32
+ }
33
+ type Item = PgTemplateItem;
34
+ /** A template's text: `parts` (template-literal safe) around one interpolation per entry of `refs`, an export name. */
35
+ export interface TemplateBody {
36
+ parts: string[];
37
+ refs: string[];
38
+ }
39
+ /** The tag each entity type is declared with (`table`, `func`, ...). */
40
+ export declare const POSTGRES_TAG_OF: Readonly<Record<string, string>>;
41
+ /** A template body as the text between the backquotes. */
42
+ export declare const bodyText: (body: TemplateBody) => string;
43
+ /**
44
+ * The template of each object in `items`, with the references to `targets`
45
+ * (the items themselves, and any object declared elsewhere that they may
46
+ * name) interpolated, and the items in the order a file declares them: each
47
+ * after what it references.
48
+ *
49
+ * A name is a reference where it is qualified (`app.users`), or bare where an
50
+ * object is named (`REFERENCES users`, `FROM users`, an index's table, a
51
+ * column's type) and an unqualified object has that name.
52
+ */
53
+ export declare function postgresTemplates(items: readonly Item[], targets?: readonly Item[]): {
54
+ order: Item[];
55
+ bodies: Map<string, TemplateBody>;
56
+ };
25
57
  export declare class PostgresGenerator implements TypeScriptGenerator {
26
58
  private readonly header?;
27
59
  readonly ownsLayout = true;
28
60
  constructor(header?: string | undefined);
29
61
  generate(ir: TemplateIR): GeneratedFile[];
30
62
  }
63
+ export {};
31
64
  //# sourceMappingURL=generator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/postgres/import/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,K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gG;AAChG,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAK3F;AAED,sFAAsF;AACtF,wBAAsB,YAAY,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE,CAAC,CAIzH;AAKD,uEAAuE;AACvE,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG;IAAE,MAAM,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAOlG"}
@@ -7,11 +7,14 @@
7
7
  * `pg_catalog`, so what a server prints does not depend on the role's own
8
8
  * search path.
9
9
  */
10
+ import type { CredentialSource } from "../../token-source.js";
10
11
  export interface PostgresEndpoint {
11
12
  /** A `postgres://` connection URL, without a password. */
12
13
  url: string;
13
14
  user?: string;
14
15
  password?: string;
16
+ /** Mints the password at each connect, in place of `password` (a profile's token source, #3685). */
17
+ token?: CredentialSource;
15
18
  }
16
19
  /** What chant reads and writes through: one connection. */
17
20
  export interface PostgresClient {
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/postgres/live/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3F,gDAAgD;IAChD,GAAG,IAAI,OAAO,CAAC,IAAI,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,EACN,IAAI,CAAC,EAAE,MAAM,YAAA,EACb,QAAQ,CAAC,EAAE,MAAM,YAAA;CAK7B;AAgBD,oEAAoE;AACpE,wBAAsB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,EAAE,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CAoCrI"}
@@ -1,12 +1,18 @@
1
1
  import type { LintContext, LintDiagnostic, LintRule } from "@intentius/chant/lint/rule";
2
2
  import { parseCreate } from "../../clickhouse/parser";
3
+ import { parseAccess } from "../../clickhouse/access";
3
4
  import { SqlSyntaxError } from "../../clickhouse/tokens";
4
5
  import { findTemplates, templatePosition, tokensOf } from "./templates";
5
6
 
6
- const STATEMENT: Record<string, string> = { database: "CREATE DATABASE", table: "CREATE TABLE", view: "CREATE VIEW" };
7
+ const ACCESS_TAGS = new Set(["user", "role", "policy", "grant"]);
8
+ const ACCESS_STATEMENT: Record<string, string> = { user: "CREATE USER", role: "CREATE ROLE", rowPolicy: "CREATE ROW POLICY", grant: "GRANT" };
9
+
10
+ const STATEMENT: Record<string, string> = { database: "CREATE DATABASE", table: "CREATE TABLE", view: "CREATE VIEW", dictionary: "CREATE DICTIONARY", function: "CREATE FUNCTION" };
11
+ /** The tag a statement belongs in: `func` for a function, the statement's own name otherwise. */
12
+ const tagOf = (statement: string): string => (statement === "function" ? "func" : statement);
7
13
 
8
14
  /**
9
- * SQLCH001: the DDL in a `database`, `table` or `view` template does not parse, or holds another statement than its tag.
15
+ * SQLCH001: the DDL in a ClickHouse template (`database`, `table`, `view`, `dictionary`, `func`, `user`, `role`, `policy`, `grant`) does not parse, or holds another statement than its tag.
10
16
  *
11
17
  * The same parse runs when the build calls the tag, and fails the build there.
12
18
  * This rule reports it in the editor and in `chant lint`, at the token, before
@@ -27,12 +33,28 @@ export const sqlch001: LintRule = {
27
33
  let tokens;
28
34
  try {
29
35
  tokens = tokensOf(found);
36
+ if (ACCESS_TAGS.has(found.tag)) {
37
+ const node = parseAccess(tokens);
38
+ const tag = node.statement === "rowPolicy" ? "policy" : node.statement;
39
+ if (tag !== found.tag || node.revoke) {
40
+ out.push({
41
+ ruleId: "SQLCH001",
42
+ severity: "error",
43
+ message: node.revoke
44
+ ? `${found.tag}\`...\` holds a REVOKE; declare the grants a grantee keeps, and a plan revokes the rest`
45
+ : `${found.tag}\`...\` holds a ${ACCESS_STATEMENT[node.statement]}; use the ${tag} tag`,
46
+ file: context.filePath,
47
+ ...templatePosition(source, found, 0, 0),
48
+ });
49
+ }
50
+ continue;
51
+ }
30
52
  const node = parseCreate(tokens);
31
- if (node.statement !== found.tag) {
53
+ if (tagOf(node.statement) !== found.tag) {
32
54
  out.push({
33
55
  ruleId: "SQLCH001",
34
56
  severity: "error",
35
- message: `${found.tag}\`...\` holds a ${STATEMENT[node.statement]}; use the ${node.statement} tag`,
57
+ message: `${found.tag}\`...\` holds a ${STATEMENT[node.statement]}; use the ${tagOf(node.statement)} tag`,
36
58
  file: context.filePath,
37
59
  ...templatePosition(source, found, 0, 0),
38
60
  });
@@ -41,7 +41,8 @@ function keyColumns(tokens: Token[], span: Span): Array<{ name: string; token: T
41
41
  }
42
42
 
43
43
  function allowsNullableKey(tokens: Token[], node: CreateNode): boolean {
44
- if (node.statement === "database" || !node.settings) return false;
44
+ if (node.statement !== "table" && node.statement !== "view") return false;
45
+ if (!node.settings) return false;
45
46
  const s = node.settings.find((x) => x.key === "allow_nullable_key");
46
47
  if (!s) return false;
47
48
  const v = tokens.slice(s.value.from, s.value.to).map((t) => t.text).join("").trim().toLowerCase().replace(/'/g, "");
@@ -74,7 +75,7 @@ export const sqlch002: LintRule = {
74
75
  if (err instanceof SqlSyntaxError) continue; // SQLCH001 reports it
75
76
  throw err;
76
77
  }
77
- if (node.statement === "database" || allowsNullableKey(tokens, node)) continue;
78
+ if ((node.statement !== "table" && node.statement !== "view") || allowsNullableKey(tokens, node)) continue;
78
79
  const nullable = new Set(node.columns.filter((c) => c.name && isNullable(tokens, c)).map((c) => c.name));
79
80
  if (nullable.size === 0) continue;
80
81
  const reported = new Set<string>();
@@ -13,7 +13,7 @@ import { findSqlTemplates, type FoundTemplate as SqlFoundTemplate, type Template
13
13
 
14
14
  export { templatePosition, tokenPosition } from "../../core/find-templates";
15
15
 
16
- export type SqlTag = "database" | "table" | "view";
16
+ export type SqlTag = "database" | "table" | "view" | "dictionary" | "func" | "user" | "role" | "policy" | "grant";
17
17
 
18
18
  /**
19
19
  * The ClickHouse tags, by the modules they are imported from. The package
@@ -22,7 +22,7 @@ export type SqlTag = "database" | "table" | "view";
22
22
  export const CLICKHOUSE_TEMPLATE_SOURCE: TemplateSource<SqlTag> = {
23
23
  dialect: "clickhouse",
24
24
  modules: ["@intentius/chant-lexicon-sql", "@intentius/chant-lexicon-sql/clickhouse"],
25
- tags: ["database", "table", "view"],
25
+ tags: ["database", "table", "view", "dictionary", "func", "user", "role", "policy", "grant"],
26
26
  };
27
27
 
28
28
  export type FoundTemplate = SqlFoundTemplate<SqlTag>;
@@ -12,7 +12,8 @@
12
12
  *
13
13
  * The order is the dependency order of the references: a view after the
14
14
  * tables it reads, a materialized view after its target, a table after its
15
- * database. Ties break by export name, so the output is the same however the
15
+ * database. An object read from a `.sql` file (`./sql-files.ts`) that a
16
+ * template names in its text counts as referenced too. Ties break by export name, so the output is the same however the
16
17
  * files were discovered. A reference cycle is an error naming the cycle.
17
18
  *
18
19
  * One build holds one dialect: the dialect is the document's, and a project
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAc,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AAQjF,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AAEpD,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAiEhD,eAAO,MAAM,aAAa,EAAE,UAsC3B,CAAC"}
1
+ {"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAc,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AASjF,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AAEpD,gEAAgE;AAChE,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAmEhD,eAAO,MAAM,aAAa,EAAE,UAuC3B,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Plain `.sql` files as a schema source (#3646): DDL read into the same
3
+ * declarations the tagged templates make. Also at the package root.
4
+ *
5
+ * - {@link readSqlFile}: the objects a file of DDL declares, each with its
6
+ * export name, type, qualified name and DDL.
7
+ * - {@link sqlFileDeclarations}: the same file as TypeScript, one `schema.ts`
8
+ * of `table`, `view`, ... templates, as `chant import <file>.sql` writes it.
9
+ * - {@link sqlFileEntities}: the declarations themselves, with the references
10
+ * between the files' objects, and to objects declared elsewhere, as
11
+ * interpolations, so dependency order comes from the graph. The build uses
12
+ * it for every `.sql` file in the source directory.
13
+ *
14
+ * Postgres reads each `CREATE`, `GRANT`, `REVOKE` and `ALTER DEFAULT
15
+ * PRIVILEGES` as an object, with `COMMENT ON`, `ALTER TABLE ... ROW LEVEL
16
+ * SECURITY` and `ALTER TABLE ... ADD <table constraint>` folded into the
17
+ * object they finish; ClickHouse reads `CREATE DATABASE`, `TABLE`, `VIEW`,
18
+ * `MATERIALIZED VIEW`, `DICTIONARY` and `FUNCTION`. Any other statement, and any
19
+ * statement that does not parse, throws a {@link SqlFileError} naming every
20
+ * such statement: none is left out.
21
+ *
22
+ * A name is a reference where it is qualified (`app.users`), or bare where an
23
+ * object is named (`REFERENCES users`, `FROM users`, an index's table, a
24
+ * column of an enum type) and an object declared without a schema has it.
25
+ */
26
+ import type { Declarable } from "@intentius/chant/declarable";
27
+ import type { SqlDialect } from "./dialects.js";
28
+ import { SqlFileError, type ReadOptions } from "./files/common.js";
29
+ export { SqlFileError };
30
+ export type { ReadOptions as SqlFileOptions };
31
+ /** One object a file of DDL declares. */
32
+ export interface SqlFileObject {
33
+ /** The export it is declared as. */
34
+ export: string;
35
+ /** Its entity type, `Postgres::Table`. */
36
+ type: string;
37
+ /** `schema.name` (Postgres), `database.name` (ClickHouse); the name alone when the DDL does not qualify it. */
38
+ name: string;
39
+ /** Its statements: the CREATE, then what was folded into it. */
40
+ ddl: string;
41
+ /** The file it came from, the `origin` it was read under. */
42
+ origin: string;
43
+ }
44
+ /** A file to read: its DDL and the name errors give it. */
45
+ export interface SqlFileSource extends ReadOptions {
46
+ ddl: string;
47
+ }
48
+ /** The objects a file of DDL declares. Throws a {@link SqlFileError} naming each statement it cannot read. */
49
+ export declare function readSqlFile(dialect: SqlDialect, ddl: string, options: ReadOptions): SqlFileObject[];
50
+ /**
51
+ * A file of DDL as TypeScript declarations: the `schema.ts` `chant import`
52
+ * writes, with `header` as comment lines at its top, and the objects in it.
53
+ */
54
+ export declare function sqlFileDeclarations(dialect: SqlDialect, ddl: string, options: ReadOptions & {
55
+ header?: string;
56
+ }): {
57
+ content: string;
58
+ objects: SqlFileObject[];
59
+ };
60
+ /** Where an entity read from a `.sql` file came from: its `origin`. Undefined for any other entity. */
61
+ export declare function sqlFileOf(entity: unknown): string | undefined;
62
+ /**
63
+ * The declarations the files make, by export name. `known` holds the
64
+ * entities declared elsewhere (the project's tagged templates): a file's
65
+ * reference to one of them is an interpolation of it, as an import would
66
+ * write it, and an export name or an object one of them already declares is
67
+ * an error naming both.
68
+ */
69
+ export declare function sqlFileEntities(dialect: SqlDialect, sources: readonly SqlFileSource[], options?: {
70
+ known?: ReadonlyMap<string, Declarable>;
71
+ }): Map<string, Declarable>;
72
+ /**
73
+ * The objects read from `.sql` files that each other object names in its
74
+ * DDL as text, by export name: a tagged template cannot import a file's
75
+ * object, so it names it, and this is the edge the dependency order needs.
76
+ * Empty when no object came from a file.
77
+ */
78
+ export declare function sqlFileReferences(dialect: SqlDialect, objects: ReadonlyMap<string, Declarable>): Map<string, string[]>;
79
+ //# sourceMappingURL=sql-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-files.d.ts","sourceRoot":"","sources":["../src/sql-files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAUhE,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,YAAY,EAAE,WAAW,IAAI,cAAc,EAAE,CAAC;AAE9C,yCAAyC;AACzC,MAAM,WAAW,aAAa;IAC5B,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,+GAA+G;IAC/G,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,2DAA2D;AAC3D,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,GAAG,EAAE,MAAM,CAAC;CACb;AAuBD,8GAA8G;AAC9G,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,EAAE,CAInG;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAA;CAAE,CAW/J;AAED,uGAAuG;AACvG,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAE7D;AA4BD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,aAAa,EAAE,EAAE,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;CAAO,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAqD1K;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAatH"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Short-lived database credentials (#3685): a profile's `password` can name a
3
+ * token source instead of an environment variable, and the token is minted
4
+ * when a connection needs it.
5
+ *
6
+ * ```ts
7
+ * profiles: {
8
+ * prod: { url: "postgres://db.abc.us-east-1.rds.amazonaws.com:5432/shop", user: { env: "PG_USER" }, password: { token: "rds-iam" } },
9
+ * ci: { url: "postgres://db.internal:5432/shop", password: { token: "command", command: ["./mint-token.sh"], ttlSeconds: 600 } },
10
+ * }
11
+ * ```
12
+ *
13
+ * Each cloud source runs that cloud's own command line, which reads the job's
14
+ * ambient identity (an OIDC-federated role in CI, a workload identity, a
15
+ * logged-in developer), so chant holds no cloud SDK and no long-lived secret:
16
+ *
17
+ * - `rds-iam`: `aws rds generate-db-auth-token`, for RDS and Aurora. The host
18
+ * and port come from the profile's URL, the user from its `user`, the region
19
+ * from `region`, else `AWS_REGION`, else the RDS host name.
20
+ * - `cloud-sql-iam`: `gcloud sql generate-login-token`.
21
+ * - `entra`: `az account get-access-token` for Azure Database for PostgreSQL.
22
+ * - `command`: any command that prints a password on its standard output.
23
+ *
24
+ * A token is reused until most of its lifetime has passed and minted again
25
+ * after, so a long apply, whose ClickHouse requests each carry the password
26
+ * and whose Postgres connections each authenticate when opened, never sends
27
+ * an expired one. A token is never written to a message, an outcome or a log.
28
+ */
29
+ import { z } from "zod";
30
+ /** The token sources a profile's `password` can name. */
31
+ export declare const tokenSourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
32
+ token: z.ZodLiteral<"rds-iam">;
33
+ /** The AWS region. `AWS_REGION`, `AWS_DEFAULT_REGION`, else the RDS host name's, when omitted. */
34
+ region: z.ZodOptional<z.ZodString>;
35
+ /** How long a token is valid, in seconds. 900, the RDS lifetime, when omitted. */
36
+ ttlSeconds: z.ZodOptional<z.ZodNumber>;
37
+ }, z.core.$strict>, z.ZodObject<{
38
+ token: z.ZodLiteral<"cloud-sql-iam">;
39
+ /** How long a token is valid, in seconds. 3600 when omitted. */
40
+ ttlSeconds: z.ZodOptional<z.ZodNumber>;
41
+ }, z.core.$strict>, z.ZodObject<{
42
+ token: z.ZodLiteral<"entra">;
43
+ /** How long a token is valid, in seconds. 3600 when omitted. */
44
+ ttlSeconds: z.ZodOptional<z.ZodNumber>;
45
+ }, z.core.$strict>, z.ZodObject<{
46
+ token: z.ZodLiteral<"command">;
47
+ /** The program and its arguments, run without a shell; its standard output, trimmed, is the password. */
48
+ command: z.ZodArray<z.ZodString>;
49
+ /** How long a token is valid, in seconds. 300 when omitted. */
50
+ ttlSeconds: z.ZodOptional<z.ZodNumber>;
51
+ }, z.core.$strict>], "token">;
52
+ export type TokenSourceConfig = z.infer<typeof tokenSourceSchema>;
53
+ /** The cloud sources, which mint for a Postgres server only. */
54
+ export declare const POSTGRES_ONLY_TOKEN_SOURCES: ReadonlySet<string>;
55
+ /** A token source that could not mint. The message names the source and the command, never what it printed. */
56
+ export declare class TokenSourceError extends Error {
57
+ constructor(message: string);
58
+ }
59
+ /** Runs a program without a shell and returns its standard output. */
60
+ export type RunCommand = (argv: readonly string[], env: Record<string, string | undefined>) => Promise<string>;
61
+ /** Where a token is minted, and the cached token. */
62
+ export interface CredentialSource {
63
+ /** What the token is minted by, for a message: `sql.profiles.prod.password (rds-iam)`. */
64
+ readonly source: string;
65
+ /** A valid token: the cached one, or a new one when it has expired. */
66
+ get(): Promise<string>;
67
+ /** Forget the cached token, so the next `get()` mints again. */
68
+ invalidate(): void;
69
+ }
70
+ /** The program a source runs. Pure, for tests. */
71
+ export declare function tokenCommand(config: TokenSourceConfig, input: {
72
+ url: string;
73
+ user?: string;
74
+ env: Record<string, string | undefined>;
75
+ }): readonly string[];
76
+ /**
77
+ * A source that mints with `config` when asked. Nothing runs until `get()`.
78
+ * `now` and `run` are for tests.
79
+ */
80
+ export declare function credentialSource(config: TokenSourceConfig, input: {
81
+ url: string;
82
+ user?: string;
83
+ env: Record<string, string | undefined>;
84
+ source: string;
85
+ run?: RunCommand;
86
+ now?: () => number;
87
+ }): CredentialSource;
88
+ //# sourceMappingURL=token-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-source.d.ts","sourceRoot":"","sources":["../src/token-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,yDAAyD;AACzD,eAAO,MAAM,iBAAiB;;IAG1B,kGAAkG;;IAElG,kFAAkF;;;;IAKlF,gEAAgE;;;;IAKhE,gEAAgE;;;;IAKhE,yGAAyG;;IAEzG,+DAA+D;;6BAGjE,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,gEAAgE;AAChE,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAAkD,CAAC;AAY/G,+GAA+G;AAC/G,q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H,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAoEvF,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;AA0EvF,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.117.0",
3
+ "version": "0.118.1",
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.117.0",
73
+ "@intentius/chant": "^0.118.1",
74
74
  "typescript": "^5.9.3"
75
75
  }
76
76
  }