@intentius/chant-lexicon-sql 0.121.1 → 0.123.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 (219) hide show
  1. package/README.md +1 -1
  2. package/dist/clickhouse/catalog-types.d.ts +8 -0
  3. package/dist/clickhouse/catalog-types.d.ts.map +1 -1
  4. package/dist/clickhouse/entities.d.ts +37 -11
  5. package/dist/clickhouse/entities.d.ts.map +1 -1
  6. package/dist/clickhouse/import/generator.d.ts.map +1 -1
  7. package/dist/clickhouse/overlays/codecs.d.ts.map +1 -1
  8. package/dist/clickhouse/overlays/kinds.d.ts +1 -1
  9. package/dist/clickhouse/overlays/kinds.d.ts.map +1 -1
  10. package/dist/clickhouse/overlays/types.d.ts.map +1 -1
  11. package/dist/clickhouse/plan/commands.d.ts.map +1 -1
  12. package/dist/clickhouse/row-types.d.ts +30 -0
  13. package/dist/clickhouse/row-types.d.ts.map +1 -0
  14. package/dist/clickhouse/type-syntax.d.ts +33 -0
  15. package/dist/clickhouse/type-syntax.d.ts.map +1 -0
  16. package/dist/clickhouse.d.ts +1 -1
  17. package/dist/clickhouse.d.ts.map +1 -1
  18. package/dist/codegen/clickhouse-module.d.ts.map +1 -1
  19. package/dist/codegen/postgres-module.d.ts.map +1 -1
  20. package/dist/core/index.d.ts +4 -0
  21. package/dist/core/index.d.ts.map +1 -1
  22. package/dist/core/typed.d.ts +132 -0
  23. package/dist/core/typed.d.ts.map +1 -0
  24. package/dist/generated/clickhouse.d.ts +7 -1
  25. package/dist/generated/clickhouse.d.ts.map +1 -1
  26. package/dist/generated/postgres.d.ts +6 -0
  27. package/dist/generated/postgres.d.ts.map +1 -1
  28. package/dist/integrity.json +27 -5
  29. package/dist/lint/audit-catalog.d.ts.map +1 -1
  30. package/dist/lint/post-synth/audit-entries.d.ts.map +1 -1
  31. package/dist/lint/post-synth/clickhouse-type-check.d.ts +37 -0
  32. package/dist/lint/post-synth/clickhouse-type-check.d.ts.map +1 -0
  33. package/dist/lint/post-synth/index.d.ts.map +1 -1
  34. package/dist/lint/post-synth/postgres-audit-entries.d.ts.map +1 -1
  35. package/dist/lint/post-synth/postgres-names.d.ts +151 -0
  36. package/dist/lint/post-synth/postgres-names.d.ts.map +1 -0
  37. package/dist/lint/post-synth/sql101.d.ts +9 -0
  38. package/dist/lint/post-synth/sql101.d.ts.map +1 -0
  39. package/dist/lint/post-synth/sql102.d.ts +16 -0
  40. package/dist/lint/post-synth/sql102.d.ts.map +1 -0
  41. package/dist/lint/post-synth/sqlch121.d.ts +10 -0
  42. package/dist/lint/post-synth/sqlch121.d.ts.map +1 -0
  43. package/dist/lint/post-synth/sqlch122.d.ts +10 -0
  44. package/dist/lint/post-synth/sqlch122.d.ts.map +1 -0
  45. package/dist/lint/post-synth/sqlch123.d.ts +9 -0
  46. package/dist/lint/post-synth/sqlch123.d.ts.map +1 -0
  47. package/dist/lint/post-synth/sqlch124.d.ts +6 -0
  48. package/dist/lint/post-synth/sqlch124.d.ts.map +1 -0
  49. package/dist/lint/post-synth/sqlch125.d.ts +11 -0
  50. package/dist/lint/post-synth/sqlch125.d.ts.map +1 -0
  51. package/dist/lint/post-synth/sqlch126.d.ts +12 -0
  52. package/dist/lint/post-synth/sqlch126.d.ts.map +1 -0
  53. package/dist/lint/post-synth/sqlch127.d.ts +22 -0
  54. package/dist/lint/post-synth/sqlch127.d.ts.map +1 -0
  55. package/dist/lint/post-synth/sqlpg119.d.ts +18 -0
  56. package/dist/lint/post-synth/sqlpg119.d.ts.map +1 -0
  57. package/dist/lint/post-synth/sqlpg120.d.ts +17 -0
  58. package/dist/lint/post-synth/sqlpg120.d.ts.map +1 -0
  59. package/dist/lint/post-synth/sqlpg121.d.ts +12 -0
  60. package/dist/lint/post-synth/sqlpg121.d.ts.map +1 -0
  61. package/dist/lint/post-synth/sqlpg122.d.ts +12 -0
  62. package/dist/lint/post-synth/sqlpg122.d.ts.map +1 -0
  63. package/dist/lint/post-synth/sqlpg123.d.ts +17 -0
  64. package/dist/lint/post-synth/sqlpg123.d.ts.map +1 -0
  65. package/dist/lint/post-synth/sqlpg124.d.ts +16 -0
  66. package/dist/lint/post-synth/sqlpg124.d.ts.map +1 -0
  67. package/dist/lint/post-synth/sqlpg125.d.ts +17 -0
  68. package/dist/lint/post-synth/sqlpg125.d.ts.map +1 -0
  69. package/dist/lint/post-synth/sqlpg126.d.ts +19 -0
  70. package/dist/lint/post-synth/sqlpg126.d.ts.map +1 -0
  71. package/dist/lint/rules/index.d.ts +3 -1
  72. package/dist/lint/rules/index.d.ts.map +1 -1
  73. package/dist/lint/rules/sqlch004.d.ts +19 -0
  74. package/dist/lint/rules/sqlch004.d.ts.map +1 -0
  75. package/dist/lint/rules/sqlpg005.d.ts +18 -0
  76. package/dist/lint/rules/sqlpg005.d.ts.map +1 -0
  77. package/dist/lint/rules/typed-names.d.ts +43 -0
  78. package/dist/lint/rules/typed-names.d.ts.map +1 -0
  79. package/dist/manifest.json +1 -1
  80. package/dist/okf/index.md +19 -0
  81. package/dist/okf/rules/SQL101.md +23 -0
  82. package/dist/okf/rules/SQL102.md +11 -0
  83. package/dist/okf/rules/SQLCH004.md +11 -0
  84. package/dist/okf/rules/SQLCH121.md +11 -0
  85. package/dist/okf/rules/SQLCH122.md +11 -0
  86. package/dist/okf/rules/SQLCH123.md +11 -0
  87. package/dist/okf/rules/SQLCH124.md +18 -0
  88. package/dist/okf/rules/SQLCH125.md +11 -0
  89. package/dist/okf/rules/SQLCH126.md +15 -0
  90. package/dist/okf/rules/SQLCH127.md +15 -0
  91. package/dist/okf/rules/SQLPG005.md +11 -0
  92. package/dist/okf/rules/SQLPG119.md +16 -0
  93. package/dist/okf/rules/SQLPG120.md +16 -0
  94. package/dist/okf/rules/SQLPG121.md +11 -0
  95. package/dist/okf/rules/SQLPG122.md +15 -0
  96. package/dist/okf/rules/SQLPG123.md +16 -0
  97. package/dist/okf/rules/SQLPG124.md +11 -0
  98. package/dist/okf/rules/SQLPG125.md +11 -0
  99. package/dist/okf/rules/SQLPG126.md +11 -0
  100. package/dist/okf/types/Dictionary.md +4 -0
  101. package/dist/okf/types/Function.md +5 -0
  102. package/dist/okf/types/Grant.md +6 -0
  103. package/dist/okf/types/MaterializedView.md +1 -0
  104. package/dist/okf/types/PostgresDefaultPrivileges.md +4 -0
  105. package/dist/okf/types/PostgresDomain.md +2 -0
  106. package/dist/okf/types/PostgresEnum.md +1 -0
  107. package/dist/okf/types/PostgresFunction.md +4 -0
  108. package/dist/okf/types/PostgresGrant.md +5 -0
  109. package/dist/okf/types/PostgresPolicy.md +4 -0
  110. package/dist/okf/types/PostgresProcedure.md +4 -0
  111. package/dist/okf/types/PostgresSequence.md +2 -0
  112. package/dist/okf/types/PostgresTrigger.md +4 -0
  113. package/dist/okf/types/RowPolicy.md +4 -0
  114. package/dist/okf/types/Table.md +1 -0
  115. package/dist/okf/types/View.md +1 -0
  116. package/dist/postgres/entities.d.ts +38 -9
  117. package/dist/postgres/entities.d.ts.map +1 -1
  118. package/dist/postgres/import/generator.d.ts.map +1 -1
  119. package/dist/postgres/overlays/extension-objects.d.ts +28 -0
  120. package/dist/postgres/overlays/extension-objects.d.ts.map +1 -0
  121. package/dist/postgres/overlays/types.d.ts +10 -0
  122. package/dist/postgres/overlays/types.d.ts.map +1 -1
  123. package/dist/postgres/row-types.d.ts +17 -0
  124. package/dist/postgres/row-types.d.ts.map +1 -0
  125. package/dist/postgres/testing/migration.d.ts +3 -2
  126. package/dist/postgres/testing/migration.d.ts.map +1 -1
  127. package/dist/postgres.d.ts +1 -1
  128. package/dist/postgres.d.ts.map +1 -1
  129. package/dist/rules/audit-entries.ts +7 -0
  130. package/dist/rules/clickhouse-type-check.ts +173 -0
  131. package/dist/rules/postgres-audit-entries.ts +8 -0
  132. package/dist/rules/postgres-names.ts +510 -0
  133. package/dist/rules/sql101.ts +62 -0
  134. package/dist/rules/sql102.ts +34 -0
  135. package/dist/rules/sqlch004.ts +81 -0
  136. package/dist/rules/sqlch121.ts +12 -0
  137. package/dist/rules/sqlch122.ts +12 -0
  138. package/dist/rules/sqlch123.ts +11 -0
  139. package/dist/rules/sqlch124.ts +21 -0
  140. package/dist/rules/sqlch125.ts +56 -0
  141. package/dist/rules/sqlch126.ts +57 -0
  142. package/dist/rules/sqlch127.ts +128 -0
  143. package/dist/rules/sqlpg005.ts +73 -0
  144. package/dist/rules/sqlpg119.ts +37 -0
  145. package/dist/rules/sqlpg120.ts +70 -0
  146. package/dist/rules/sqlpg121.ts +32 -0
  147. package/dist/rules/sqlpg122.ts +28 -0
  148. package/dist/rules/sqlpg123.ts +63 -0
  149. package/dist/rules/sqlpg124.ts +47 -0
  150. package/dist/rules/sqlpg125.ts +40 -0
  151. package/dist/rules/sqlpg126.ts +37 -0
  152. package/dist/rules/typed-names.ts +120 -0
  153. package/dist/sql-types-command.d.ts +19 -0
  154. package/dist/sql-types-command.d.ts.map +1 -0
  155. package/dist/sql-types.d.ts +53 -0
  156. package/dist/sql-types.d.ts.map +1 -0
  157. package/package.json +2 -2
  158. package/src/clickhouse/catalog-types.ts +9 -0
  159. package/src/clickhouse/dictionary.test.ts +1 -1
  160. package/src/clickhouse/entities.ts +79 -14
  161. package/src/clickhouse/import/generator.ts +7 -1
  162. package/src/clickhouse/import/roundtrip.test.ts +1 -1
  163. package/src/clickhouse/overlays/codecs.ts +6 -2
  164. package/src/clickhouse/overlays/kinds.ts +1 -1
  165. package/src/clickhouse/overlays/types.ts +20 -3
  166. package/src/clickhouse/plan/commands.ts +5 -0
  167. package/src/clickhouse/row-types.ts +158 -0
  168. package/src/clickhouse/type-syntax.ts +82 -0
  169. package/src/clickhouse.ts +10 -0
  170. package/src/codegen/clickhouse-module.ts +15 -1
  171. package/src/codegen/postgres-module.ts +43 -0
  172. package/src/composites/composites.test.ts +7 -6
  173. package/src/core/index.ts +4 -0
  174. package/src/core/typed.ts +143 -0
  175. package/src/generated/clickhouse.ts +1905 -6
  176. package/src/generated/postgres.ts +2639 -0
  177. package/src/lint/audit-catalog.ts +28 -0
  178. package/src/lint/post-synth/audit-entries.ts +7 -0
  179. package/src/lint/post-synth/clickhouse-catalog-checks.test.ts +315 -0
  180. package/src/lint/post-synth/clickhouse-type-check.ts +173 -0
  181. package/src/lint/post-synth/index.ts +34 -0
  182. package/src/lint/post-synth/postgres-audit-entries.ts +8 -0
  183. package/src/lint/post-synth/postgres-checks.test.ts +214 -1
  184. package/src/lint/post-synth/postgres-names.ts +510 -0
  185. package/src/lint/post-synth/sql101.ts +62 -0
  186. package/src/lint/post-synth/sql102.ts +34 -0
  187. package/src/lint/post-synth/sqlch121.ts +12 -0
  188. package/src/lint/post-synth/sqlch122.ts +12 -0
  189. package/src/lint/post-synth/sqlch123.ts +11 -0
  190. package/src/lint/post-synth/sqlch124.ts +21 -0
  191. package/src/lint/post-synth/sqlch125.ts +56 -0
  192. package/src/lint/post-synth/sqlch126.ts +57 -0
  193. package/src/lint/post-synth/sqlch127.ts +128 -0
  194. package/src/lint/post-synth/sqlpg119.ts +37 -0
  195. package/src/lint/post-synth/sqlpg120.ts +70 -0
  196. package/src/lint/post-synth/sqlpg121.ts +32 -0
  197. package/src/lint/post-synth/sqlpg122.ts +28 -0
  198. package/src/lint/post-synth/sqlpg123.ts +63 -0
  199. package/src/lint/post-synth/sqlpg124.ts +47 -0
  200. package/src/lint/post-synth/sqlpg125.ts +40 -0
  201. package/src/lint/post-synth/sqlpg126.ts +37 -0
  202. package/src/lint/rules/index.ts +4 -2
  203. package/src/lint/rules/sqlch004.ts +81 -0
  204. package/src/lint/rules/sqlpg005.ts +73 -0
  205. package/src/lint/rules/typed-names.test.ts +151 -0
  206. package/src/lint/rules/typed-names.ts +120 -0
  207. package/src/op/__snapshots__/watch-pipeline.test.ts.snap +3 -3
  208. package/src/postgres/entities.ts +65 -12
  209. package/src/postgres/import/generator.ts +7 -1
  210. package/src/postgres/overlays/extension-objects.ts +100 -0
  211. package/src/postgres/overlays/types.ts +25 -0
  212. package/src/postgres/row-types.ts +111 -0
  213. package/src/postgres.ts +10 -0
  214. package/src/sql-types-command.ts +99 -0
  215. package/src/sql-types-staleness.test.ts +110 -0
  216. package/src/sql-types.test.ts +132 -0
  217. package/src/sql-types.ts +352 -0
  218. package/src/typecheck.test.ts +12 -3
  219. package/src/typed-columns.test.ts +92 -0
@@ -2,11 +2,13 @@ import type { LintRule } from "@intentius/chant/lint/rule";
2
2
  import { sqlch001 } from "./sqlch001.js";
3
3
  import { sqlch002 } from "./sqlch002.js";
4
4
  import { sqlch003 } from "./sqlch003.js";
5
+ import { sqlch004 } from "./sqlch004.js";
5
6
  import { sqlpg001 } from "./sqlpg001.js";
6
7
  import { sqlpg002 } from "./sqlpg002.js";
7
8
  import { sqlpg003 } from "./sqlpg003.js";
8
9
  import { sqlpg004 } from "./sqlpg004.js";
9
- export { sqlch001, sqlch002, sqlch003, sqlpg001, sqlpg002, sqlpg003, sqlpg004 };
10
+ import { sqlpg005 } from "./sqlpg005.js";
11
+ export { sqlch001, sqlch002, sqlch003, sqlch004, sqlpg001, sqlpg002, sqlpg003, sqlpg004, sqlpg005 };
10
12
  /** The lexicon's source-level lint rules, returned by `lintRules()`. */
11
13
  export declare const rules: LintRule[];
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAEhF,wEAAwE;AACxE,eAAO,MAAM,KAAK,EAAE,QAAQ,EAA2E,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAEpG,wEAAwE;AACxE,eAAO,MAAM,KAAK,EAAE,QAAQ,EAA+F,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { LintRule } from "@intentius/chant/lint/rule";
2
+ /**
3
+ * SQLCH004: a typed ClickHouse tag whose type argument does not name the
4
+ * object its template declares, or is not in the generated `sql-types.d.ts`.
5
+ *
6
+ * `table<"shop.events">\`CREATE TABLE shop.events ...\``, and the same for
7
+ * `view` and `dictionary`, types `.columns` from the generated file's
8
+ * `SqlSchema["shop.events"]`. tsc does not compare the argument with the
9
+ * template's text, and an argument the file does not list falls back to
10
+ * unchecked columns, so a typo checks nothing and says nothing. The rule reads
11
+ * the declared name from the template (a database supplied by an interpolation
12
+ * is not known to lint, and is left out of the comparison) and the listed
13
+ * names from the nearest `sql-types.d.ts` above the file. With no generated
14
+ * file, only the first check runs. A name missing from the file is a warning,
15
+ * since an object added since the last `chant sql types` is stale and
16
+ * `chant sql types --check` is what fails on it.
17
+ */
18
+ export declare const sqlch004: LintRule;
19
+ //# sourceMappingURL=sqlch004.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlch004.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/sqlch004.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA+B,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAQxF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ,EAAE,QAwDtB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { LintRule } from "@intentius/chant/lint/rule";
2
+ /**
3
+ * SQLPG005: a typed Postgres tag whose type argument does not name the object
4
+ * its template declares, or is not in the generated `sql-types.d.ts`.
5
+ *
6
+ * `table<"shop.orders">\`CREATE TABLE shop.orders ...\`` types `.columns` from
7
+ * the generated file's `SqlSchema["shop.orders"]`. tsc does not compare the
8
+ * argument with the template's text, and an argument the file does not list
9
+ * falls back to unchecked columns, so a typo checks nothing and says nothing.
10
+ * The rule reads the declared name from the template (a schema supplied by an
11
+ * interpolation is not known to lint, and is left out of the comparison) and
12
+ * the listed names from the nearest `sql-types.d.ts` above the file. With no
13
+ * generated file, only the first check runs. A name missing from the file is
14
+ * a warning, since a table added since the last `chant sql types` is stale
15
+ * and `chant sql types --check` is what fails on it.
16
+ */
17
+ export declare const sqlpg005: LintRule;
18
+ //# sourceMappingURL=sqlpg005.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sqlpg005.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/sqlpg005.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA+B,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAOxF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,QAAQ,EAAE,QAkDtB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * What the typed-column rules (SQLPG005, SQLCH004; chant #3751) share: reading
3
+ * a tag's type argument, comparing it with the name the template declares, and
4
+ * reading the names the generated `sql-types.d.ts` lists.
5
+ *
6
+ * The type argument is `table<"shop.orders">\`CREATE TABLE ...\``. tsc checks
7
+ * that it names an entry of the generated file's `SqlSchema` only when the
8
+ * argument is a constraint, and an unlisted name falls back to unchecked
9
+ * columns, so a mistyped argument is silent without these rules.
10
+ */
11
+ import * as ts from "typescript";
12
+ /** The generated file's name, beside the source (`chant sql types`). */
13
+ export declare const SQL_TYPES_FILE = "sql-types.d.ts";
14
+ /** A tag's type argument, when it is a string literal: `table<"shop.orders">`. */
15
+ export declare function typeArgumentName(node: ts.TaggedTemplateExpression): {
16
+ name: string;
17
+ node: ts.LiteralTypeNode;
18
+ } | undefined;
19
+ /** Split a dotted name outside quotes and take the quotes off: `shop."Order Items"` is `shop`, `Order Items`. */
20
+ export declare function splitQualified(name: string): string[];
21
+ /**
22
+ * Whether the declared name (an empty piece is an interpolation, which lint
23
+ * cannot read) can be the type argument's. Compared from the last piece back.
24
+ * A template that does not qualify its name takes the argument's schema, since
25
+ * the build qualifies it with the schema or database the project sets; one
26
+ * that does qualify it must agree with the argument.
27
+ */
28
+ export declare function nameAgrees(declared: readonly string[], argument: string): boolean;
29
+ /** The text of a declared name for a message; an interpolation is `${...}`. */
30
+ export declare const declaredText: (declared: readonly string[]) => string;
31
+ /** A qualified name with quoting taken off, so `"shop"."orders"` and `shop.orders` compare equal. */
32
+ export declare const normalizedName: (name: string) => string;
33
+ /** The names (normalized, see {@link normalizedName}) a `declare module "<module>"` block in a generated file augments `SqlSchema` with. */
34
+ export declare function namesInGenerated(content: string, module: string): Set<string> | undefined;
35
+ /**
36
+ * The generated file nearest above a source file, up to the directory that
37
+ * holds the project's config. `chant sql types` writes it in `sourceDir` (or
38
+ * the project root), so the walk finds it from any file below.
39
+ */
40
+ export declare function findGeneratedFile(filePath: string): string | undefined;
41
+ /** The names the generated file lists for a dialect's module, or undefined when there is no file or it has no such block. */
42
+ export declare function generatedNamesFor(filePath: string, module: string): Set<string> | undefined;
43
+ //# sourceMappingURL=typed-names.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typed-names.d.ts","sourceRoot":"","sources":["../../../src/lint/rules/typed-names.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjC,wEAAwE;AACxE,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAE/C,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,wBAAwB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAA;CAAE,GAAG,SAAS,CAK1H;AAED,iHAAiH;AACjH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAoBrD;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAUjF;AAED,+EAA+E;AAC/E,eAAO,MAAM,YAAY,GAAI,UAAU,SAAS,MAAM,EAAE,KAAG,MAAkE,CAAC;AAE9H,qGAAqG;AACrG,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,MAAyC,CAAC;AAExF,4IAA4I;AAC5I,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAgBzF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUtE;AAED,6HAA6H;AAC7H,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAQ3F"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sql",
3
- "version": "0.121.1",
3
+ "version": "0.123.0",
4
4
  "chantVersion": ">=0.1.0",
5
5
  "namespace": "SQL",
6
6
  "intrinsics": [],
package/dist/okf/index.md CHANGED
@@ -33,9 +33,12 @@ okf_version: '0.2'
33
33
 
34
34
  # Rules
35
35
 
36
+ * [SQL101](/rules/SQL101.md) - Two exports declare the same object
37
+ * [SQL102](/rules/SQL102.md) - sql-types.d.ts differs from what the build declares
36
38
  * [SQLCH001](/rules/SQLCH001.md) - the DDL in a ClickHouse template (`database`, `table`, `view`, `dictionary`, `func`, `user`, `role`, `policy`, `grant`) does not parse, or holds another stat...
37
39
  * [SQLCH002](/rules/SQLCH002.md) - a `Nullable` column in a table's sort key or primary key.
38
40
  * [SQLCH003](/rules/SQLCH003.md) - a column written as `${events.kind}` instead of `${events.columns.kind}`.
41
+ * [SQLCH004](/rules/SQLCH004.md) - a typed ClickHouse tag whose type argument does not name the
39
42
  * [SQLCH101](/rules/SQLCH101.md) - A ClickHouse object names an engine the pinned server does not have
40
43
  * [SQLCH102](/rules/SQLCH102.md) - A PRIMARY KEY is not a prefix of ORDER BY
41
44
  * [SQLCH103](/rules/SQLCH103.md) - An engine's version, sign or is_deleted column has an unsupported type
@@ -56,10 +59,18 @@ okf_version: '0.2'
56
59
  * [SQLCH118](/rules/SQLCH118.md) - A MergeTree setting is not one the pinned server has
57
60
  * [SQLCH119](/rules/SQLCH119.md) - An object uses a deprecated or experimental engine
58
61
  * [SQLCH120](/rules/SQLCH120.md) - A MergeTree engine uses the deprecated positional arguments
62
+ * [SQLCH121](/rules/SQLCH121.md) - A column type names a family the pinned server does not have
63
+ * [SQLCH122](/rules/SQLCH122.md) - A column type's parameters do not fit its family
64
+ * [SQLCH123](/rules/SQLCH123.md) - A Nullable wraps a type ClickHouse does not allow inside Nullable
65
+ * [SQLCH124](/rules/SQLCH124.md) - A table declares a column twice
66
+ * [SQLCH125](/rules/SQLCH125.md) - A codec parameter is outside what the codec takes
67
+ * [SQLCH126](/rules/SQLCH126.md) - A GRANT column list names a column the table does not declare
68
+ * [SQLCH127](/rules/SQLCH127.md) - An expression calls a function the pinned server does not have
59
69
  * [SQLPG001](/rules/SQLPG001.md) - the DDL in a Postgres template does not parse, or does not hold
60
70
  * [SQLPG002](/rules/SQLPG002.md) - a column written as `${events.kind}` instead of `${events.columns.kind}`.
61
71
  * [SQLPG003](/rules/SQLPG003.md) - an object named in a string where Postgres reads a `regclass`:
62
72
  * [SQLPG004](/rules/SQLPG004.md) - a declared extension the configured provider does not allow.
73
+ * [SQLPG005](/rules/SQLPG005.md) - a typed Postgres tag whose type argument does not name the object
63
74
  * [SQLPG101](/rules/SQLPG101.md) - A table declares no primary key
64
75
  * [SQLPG102](/rules/SQLPG102.md) - A foreign key's referencing columns have no index
65
76
  * [SQLPG103](/rules/SQLPG103.md) - A serial column where an identity column is preferred
@@ -78,3 +89,11 @@ okf_version: '0.2'
78
89
  * [SQLPG116](/rules/SQLPG116.md) - An extension the target major no longer ships
79
90
  * [SQLPG117](/rules/SQLPG117.md) - A view without security_invoker runs with its owner's privileges
80
91
  * [SQLPG118](/rules/SQLPG118.md) - A table uses INHERITS where declarative partitioning replaced it
92
+ * [SQLPG119](/rules/SQLPG119.md) - A column, domain or sequence type the target major does not have
93
+ * [SQLPG120](/rules/SQLPG120.md) - A type modifier that does not fit the type
94
+ * [SQLPG121](/rules/SQLPG121.md) - An identity column whose type is not smallint, integer or bigint
95
+ * [SQLPG122](/rules/SQLPG122.md) - A table declares a column twice, or an enum lists a label twice
96
+ * [SQLPG123](/rules/SQLPG123.md) - A key, index or grant column list names a column the table does not declare
97
+ * [SQLPG124](/rules/SQLPG124.md) - A foreign key names a column the referenced table lacks, or one of another type category
98
+ * [SQLPG125](/rules/SQLPG125.md) - An index access method or operator class the target major does not have, or not for that method
99
+ * [SQLPG126](/rules/SQLPG126.md) - An expression calls a function the target major does not have
@@ -0,0 +1,23 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQL101
4
+ description: Two exports declare the same object
5
+ id: SQL101
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ Two exports declare the same object
12
+
13
+ ## Applies to
14
+
15
+ - [Function](/types/Function.md)
16
+ - [Grant](/types/Grant.md)
17
+ - [PostgresDefaultPrivileges](/types/PostgresDefaultPrivileges.md)
18
+ - [PostgresFunction](/types/PostgresFunction.md)
19
+ - [PostgresGrant](/types/PostgresGrant.md)
20
+ - [PostgresPolicy](/types/PostgresPolicy.md)
21
+ - [PostgresProcedure](/types/PostgresProcedure.md)
22
+ - [PostgresTrigger](/types/PostgresTrigger.md)
23
+ - [RowPolicy](/types/RowPolicy.md)
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQL102
4
+ description: sql-types.d.ts differs from what the build declares
5
+ id: SQL102
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ sql-types.d.ts differs from what the build declares
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: lint-rule
3
+ title: SQLCH004
4
+ description: a typed ClickHouse tag whose type argument does not name the
5
+ id: SQLCH004
6
+ severity: error
7
+ category: correctness
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ a typed ClickHouse tag whose type argument does not name the
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH121
4
+ description: A column type names a family the pinned server does not have
5
+ id: SQLCH121
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A column type names a family the pinned server does not have
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH122
4
+ description: A column type's parameters do not fit its family
5
+ id: SQLCH122
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A column type's parameters do not fit its family
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH123
4
+ description: A Nullable wraps a type ClickHouse does not allow inside Nullable
5
+ id: SQLCH123
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A Nullable wraps a type ClickHouse does not allow inside Nullable
@@ -0,0 +1,18 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH124
4
+ description: A table declares a column twice
5
+ id: SQLCH124
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A table declares a column twice
12
+
13
+ ## Applies to
14
+
15
+ - [Dictionary](/types/Dictionary.md)
16
+ - [MaterializedView](/types/MaterializedView.md)
17
+ - [Table](/types/Table.md)
18
+ - [View](/types/View.md)
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH125
4
+ description: A codec parameter is outside what the codec takes
5
+ id: SQLCH125
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A codec parameter is outside what the codec takes
@@ -0,0 +1,15 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH126
4
+ description: A GRANT column list names a column the table does not declare
5
+ id: SQLCH126
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A GRANT column list names a column the table does not declare
12
+
13
+ ## Applies to
14
+
15
+ - [Grant](/types/Grant.md)
@@ -0,0 +1,15 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLCH127
4
+ description: An expression calls a function the pinned server does not have
5
+ id: SQLCH127
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ An expression calls a function the pinned server does not have
12
+
13
+ ## Applies to
14
+
15
+ - [Function](/types/Function.md)
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: lint-rule
3
+ title: SQLPG005
4
+ description: a typed Postgres tag whose type argument does not name the object
5
+ id: SQLPG005
6
+ severity: error
7
+ category: correctness
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ a typed Postgres tag whose type argument does not name the object
@@ -0,0 +1,16 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG119
4
+ description: A column, domain or sequence type the target major does not have
5
+ id: SQLPG119
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A column, domain or sequence type the target major does not have
12
+
13
+ ## Applies to
14
+
15
+ - [PostgresDomain](/types/PostgresDomain.md)
16
+ - [PostgresSequence](/types/PostgresSequence.md)
@@ -0,0 +1,16 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG120
4
+ description: A type modifier that does not fit the type
5
+ id: SQLPG120
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A type modifier that does not fit the type
12
+
13
+ ## Applies to
14
+
15
+ - [PostgresDomain](/types/PostgresDomain.md)
16
+ - [PostgresSequence](/types/PostgresSequence.md)
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG121
4
+ description: An identity column whose type is not smallint, integer or bigint
5
+ id: SQLPG121
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ An identity column whose type is not smallint, integer or bigint
@@ -0,0 +1,15 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG122
4
+ description: A table declares a column twice, or an enum lists a label twice
5
+ id: SQLPG122
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A table declares a column twice, or an enum lists a label twice
12
+
13
+ ## Applies to
14
+
15
+ - [PostgresEnum](/types/PostgresEnum.md)
@@ -0,0 +1,16 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG123
4
+ description: A key, index or grant column list names a column the table does not declare
5
+ id: SQLPG123
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A key, index or grant column list names a column the table does not declare
12
+
13
+ ## Applies to
14
+
15
+ - [Grant](/types/Grant.md)
16
+ - [PostgresGrant](/types/PostgresGrant.md)
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG124
4
+ description: A foreign key names a column the referenced table lacks, or one of another type category
5
+ id: SQLPG124
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ A foreign key names a column the referenced table lacks, or one of another type category
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG125
4
+ description: An index access method or operator class the target major does not have, or not for that method
5
+ id: SQLPG125
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ An index access method or operator class the target major does not have, or not for that method
@@ -0,0 +1,11 @@
1
+ ---
2
+ type: post-synth-check
3
+ title: SQLPG126
4
+ description: An expression calls a function the target major does not have
5
+ id: SQLPG126
6
+ severity: error
7
+ category: post-synth
8
+ lexicon: sql
9
+ docs: https://intentius.io/chant/lexicons/sql/rules/
10
+ ---
11
+ An expression calls a function the target major does not have
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: ClickHouse::Dictionary
8
8
  ---
9
9
  `ClickHouse::Dictionary`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQLCH124](/rules/SQLCH124.md): A table declares a column twice
@@ -7,3 +7,8 @@ lexicon: sql
7
7
  resource_type: ClickHouse::Function
8
8
  ---
9
9
  `ClickHouse::Function`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
14
+ - [SQLCH127](/rules/SQLCH127.md): An expression calls a function the pinned server does not have
@@ -7,3 +7,9 @@ lexicon: sql
7
7
  resource_type: ClickHouse::Grant
8
8
  ---
9
9
  `ClickHouse::Grant`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
14
+ - [SQLCH126](/rules/SQLCH126.md): A GRANT column list names a column the table does not declare
15
+ - [SQLPG123](/rules/SQLPG123.md): A key, index or grant column list names a column the table does not declare
@@ -11,4 +11,5 @@ resource_type: ClickHouse::MaterializedView
11
11
  ## Governed by
12
12
 
13
13
  - [SQLCH117](/rules/SQLCH117.md): A MergeTree setting is obsolete at the pinned server
14
+ - [SQLCH124](/rules/SQLCH124.md): A table declares a column twice
14
15
  - [SQLPG113](/rules/SQLPG113.md): An object is in the public schema though the project declares schemas
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: Postgres::DefaultPrivileges
8
8
  ---
9
9
  `Postgres::DefaultPrivileges`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
@@ -11,3 +11,5 @@ resource_type: Postgres::Domain
11
11
  ## Governed by
12
12
 
13
13
  - [SQLPG113](/rules/SQLPG113.md): An object is in the public schema though the project declares schemas
14
+ - [SQLPG119](/rules/SQLPG119.md): A column, domain or sequence type the target major does not have
15
+ - [SQLPG120](/rules/SQLPG120.md): A type modifier that does not fit the type
@@ -11,3 +11,4 @@ resource_type: Postgres::Enum
11
11
  ## Governed by
12
12
 
13
13
  - [SQLPG113](/rules/SQLPG113.md): An object is in the public schema though the project declares schemas
14
+ - [SQLPG122](/rules/SQLPG122.md): A table declares a column twice, or an enum lists a label twice
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: Postgres::Function
8
8
  ---
9
9
  `Postgres::Function`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
@@ -7,3 +7,8 @@ lexicon: sql
7
7
  resource_type: Postgres::Grant
8
8
  ---
9
9
  `Postgres::Grant`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
14
+ - [SQLPG123](/rules/SQLPG123.md): A key, index or grant column list names a column the table does not declare
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: Postgres::Policy
8
8
  ---
9
9
  `Postgres::Policy`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: Postgres::Procedure
8
8
  ---
9
9
  `Postgres::Procedure`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
@@ -11,3 +11,5 @@ resource_type: Postgres::Sequence
11
11
  ## Governed by
12
12
 
13
13
  - [SQLPG113](/rules/SQLPG113.md): An object is in the public schema though the project declares schemas
14
+ - [SQLPG119](/rules/SQLPG119.md): A column, domain or sequence type the target major does not have
15
+ - [SQLPG120](/rules/SQLPG120.md): A type modifier that does not fit the type
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: Postgres::Trigger
8
8
  ---
9
9
  `Postgres::Trigger`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
@@ -7,3 +7,7 @@ lexicon: sql
7
7
  resource_type: ClickHouse::RowPolicy
8
8
  ---
9
9
  `ClickHouse::RowPolicy`, a resource type of the sql lexicon.
10
+
11
+ ## Governed by
12
+
13
+ - [SQL101](/rules/SQL101.md): Two exports declare the same object
@@ -12,4 +12,5 @@ resource_type: ClickHouse::Table
12
12
 
13
13
  - [SQLCH118](/rules/SQLCH118.md): A MergeTree setting is not one the pinned server has
14
14
  - [SQLCH120](/rules/SQLCH120.md): A MergeTree engine uses the deprecated positional arguments
15
+ - [SQLCH124](/rules/SQLCH124.md): A table declares a column twice
15
16
  - [SQLPG113](/rules/SQLPG113.md): An object is in the public schema though the project declares schemas
@@ -10,4 +10,5 @@ resource_type: ClickHouse::View
10
10
 
11
11
  ## Governed by
12
12
 
13
+ - [SQLCH124](/rules/SQLCH124.md): A table declares a column twice
13
14
  - [SQLPG113](/rules/SQLPG113.md): An object is in the public schema though the project declares schemas