@intentius/sql-yodeler 0.8.0 → 0.10.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 (163) hide show
  1. package/README.md +15 -7
  2. package/dist/chant/apply.d.ts +6 -0
  3. package/dist/chant/apply.js +6 -2
  4. package/dist/chant/apply.js.map +1 -1
  5. package/dist/chant/build.d.ts +1 -0
  6. package/dist/chant/build.js +5 -0
  7. package/dist/chant/build.js.map +1 -1
  8. package/dist/chant/drift.d.ts +12 -1
  9. package/dist/chant/drift.js +41 -1
  10. package/dist/chant/drift.js.map +1 -1
  11. package/dist/chant/export-name.d.ts +9 -0
  12. package/dist/chant/export-name.js +16 -0
  13. package/dist/chant/export-name.js.map +1 -0
  14. package/dist/chant/runnable.d.ts +1 -1
  15. package/dist/chant/runnable.js +1 -1
  16. package/dist/chant/sql-types.d.ts +19 -0
  17. package/dist/chant/sql-types.js +29 -0
  18. package/dist/chant/sql-types.js.map +1 -0
  19. package/dist/check/flyway.d.ts +67 -0
  20. package/dist/check/flyway.js +106 -0
  21. package/dist/check/flyway.js.map +1 -0
  22. package/dist/check/readers.d.ts +77 -0
  23. package/dist/check/readers.js +270 -0
  24. package/dist/check/readers.js.map +1 -0
  25. package/dist/check/run.d.ts +72 -0
  26. package/dist/check/run.js +243 -0
  27. package/dist/check/run.js.map +1 -0
  28. package/dist/ci/render.d.ts +34 -0
  29. package/dist/ci/render.js +156 -22
  30. package/dist/ci/render.js.map +1 -1
  31. package/dist/cli.js +1 -1
  32. package/dist/cli.js.map +1 -1
  33. package/dist/commands/apply.d.ts +27 -3
  34. package/dist/commands/apply.js +98 -30
  35. package/dist/commands/apply.js.map +1 -1
  36. package/dist/commands/check.d.ts +5 -0
  37. package/dist/commands/check.js +211 -0
  38. package/dist/commands/check.js.map +1 -0
  39. package/dist/commands/config.js +5 -5
  40. package/dist/commands/config.js.map +1 -1
  41. package/dist/commands/drift.js +5 -0
  42. package/dist/commands/drift.js.map +1 -1
  43. package/dist/commands/index.js +2 -0
  44. package/dist/commands/index.js.map +1 -1
  45. package/dist/commands/init.js +15 -6
  46. package/dist/commands/init.js.map +1 -1
  47. package/dist/commands/lint.js +104 -23
  48. package/dist/commands/lint.js.map +1 -1
  49. package/dist/commands/new.js +79 -6
  50. package/dist/commands/new.js.map +1 -1
  51. package/dist/commands/override.js +80 -33
  52. package/dist/commands/override.js.map +1 -1
  53. package/dist/commands/plan.js +62 -30
  54. package/dist/commands/plan.js.map +1 -1
  55. package/dist/commands/revert.js +1 -1
  56. package/dist/config/define.d.ts +28 -2
  57. package/dist/config/define.js.map +1 -1
  58. package/dist/config/load.js +18 -2
  59. package/dist/config/load.js.map +1 -1
  60. package/dist/credentials.d.ts +18 -5
  61. package/dist/credentials.js +29 -11
  62. package/dist/credentials.js.map +1 -1
  63. package/dist/declarative/plan.d.ts +84 -0
  64. package/dist/declarative/plan.js +187 -0
  65. package/dist/declarative/plan.js.map +1 -0
  66. package/dist/declarative/review.d.ts +78 -0
  67. package/dist/declarative/review.js +162 -0
  68. package/dist/declarative/review.js.map +1 -0
  69. package/dist/init/adopt.d.ts +16 -7
  70. package/dist/init/adopt.js +37 -8
  71. package/dist/init/adopt.js.map +1 -1
  72. package/dist/init/baseline.d.ts +2 -1
  73. package/dist/init/baseline.js +3 -3
  74. package/dist/init/baseline.js.map +1 -1
  75. package/dist/init/clickhouse-access.d.ts +29 -10
  76. package/dist/init/clickhouse-access.js +84 -13
  77. package/dist/init/clickhouse-access.js.map +1 -1
  78. package/dist/init/live.d.ts +4 -2
  79. package/dist/init/live.js +8 -3
  80. package/dist/init/live.js.map +1 -1
  81. package/dist/init/unsupported.d.ts +15 -0
  82. package/dist/init/unsupported.js +34 -0
  83. package/dist/init/unsupported.js.map +1 -0
  84. package/dist/lint/annotations.d.ts +1 -1
  85. package/dist/lint/annotations.js +2 -0
  86. package/dist/lint/annotations.js.map +1 -1
  87. package/dist/lint/check.d.ts +8 -1
  88. package/dist/lint/check.js +61 -3
  89. package/dist/lint/check.js.map +1 -1
  90. package/dist/lint/policies.d.ts +22 -0
  91. package/dist/lint/policies.js +47 -0
  92. package/dist/lint/policies.js.map +1 -0
  93. package/dist/lint/report.js +6 -0
  94. package/dist/lint/report.js.map +1 -1
  95. package/dist/lint/schema-checks.d.ts +14 -3
  96. package/dist/lint/schema-checks.js +11 -5
  97. package/dist/lint/schema-checks.js.map +1 -1
  98. package/dist/migrations/create.d.ts +6 -1
  99. package/dist/migrations/create.js +3 -0
  100. package/dist/migrations/create.js.map +1 -1
  101. package/dist/migrations/document.d.ts +6 -0
  102. package/dist/migrations/document.js +1 -0
  103. package/dist/migrations/document.js.map +1 -1
  104. package/dist/migrations/handwritten.d.ts +75 -0
  105. package/dist/migrations/handwritten.js +157 -0
  106. package/dist/migrations/handwritten.js.map +1 -0
  107. package/dist/migrations/index.d.ts +2 -0
  108. package/dist/migrations/index.js +2 -0
  109. package/dist/migrations/index.js.map +1 -1
  110. package/dist/pr/overdue.d.ts +48 -0
  111. package/dist/pr/overdue.js +88 -0
  112. package/dist/pr/overdue.js.map +1 -0
  113. package/dist/pr/part.d.ts +15 -0
  114. package/dist/pr/part.js +30 -0
  115. package/dist/pr/part.js.map +1 -0
  116. package/dist/rebase/index.js +28 -1
  117. package/dist/rebase/index.js.map +1 -1
  118. package/dist/release/index.d.ts +32 -7
  119. package/dist/release/index.js +42 -0
  120. package/dist/release/index.js.map +1 -1
  121. package/dist/replay/replay.d.ts +2 -0
  122. package/dist/replay/replay.js +7 -3
  123. package/dist/replay/replay.js.map +1 -1
  124. package/dist/replay/report.js +3 -1
  125. package/dist/replay/report.js.map +1 -1
  126. package/dist/schemas.d.ts +2 -1
  127. package/dist/schemas.js +1 -0
  128. package/dist/schemas.js.map +1 -1
  129. package/dist/steps/backfill.d.ts +8 -3
  130. package/dist/steps/backfill.js +20 -9
  131. package/dist/steps/backfill.js.map +1 -1
  132. package/dist/steps/index.d.ts +5 -0
  133. package/dist/steps/index.js +10 -0
  134. package/dist/steps/index.js.map +1 -1
  135. package/dist/steps/kinds.d.ts +44 -1
  136. package/dist/steps/kinds.js +50 -1
  137. package/dist/steps/kinds.js.map +1 -1
  138. package/dist/steps/orm-handoff.d.ts +74 -0
  139. package/dist/steps/orm-handoff.js +154 -0
  140. package/dist/steps/orm-handoff.js.map +1 -0
  141. package/dist/testing/run.js +3 -1
  142. package/dist/testing/run.js.map +1 -1
  143. package/dist/versioned/approval.d.ts +27 -7
  144. package/dist/versioned/approval.js +69 -18
  145. package/dist/versioned/approval.js.map +1 -1
  146. package/dist/versioned/engine.js +31 -2
  147. package/dist/versioned/engine.js.map +1 -1
  148. package/dist/versioned/op.d.ts +20 -3
  149. package/dist/versioned/op.js +12 -6
  150. package/dist/versioned/op.js.map +1 -1
  151. package/dist/versioned/policy.d.ts +2 -0
  152. package/dist/versioned/policy.js +2 -2
  153. package/dist/versioned/policy.js.map +1 -1
  154. package/dist/versioned/state.js +5 -0
  155. package/dist/versioned/state.js.map +1 -1
  156. package/package.json +21 -9
  157. package/schemas/apply.schema.json +36 -2
  158. package/schemas/check.schema.json +78 -0
  159. package/schemas/drift.schema.json +1 -0
  160. package/schemas/init.schema.json +1 -0
  161. package/schemas/lint.schema.json +9 -1
  162. package/schemas/new.schema.json +1 -0
  163. package/schemas/plan.schema.json +33 -0
package/package.json CHANGED
@@ -1,7 +1,18 @@
1
1
  {
2
2
  "name": "@intentius/sql-yodeler",
3
- "version": "0.8.0",
4
- "description": "Schema management and migrations for ClickHouse and Postgres, on chant's sql lexicon",
3
+ "version": "0.10.0",
4
+ "description": "Schema changes for ClickHouse and Postgres, and the ops they imply, on chant's sql lexicon",
5
+ "keywords": [
6
+ "clickhouse",
7
+ "postgres",
8
+ "postgresql",
9
+ "schema",
10
+ "migrations",
11
+ "declarative",
12
+ "ddl",
13
+ "backfill",
14
+ "cli"
15
+ ],
5
16
  "license": "Apache-2.0",
6
17
  "repository": {
7
18
  "type": "git",
@@ -43,19 +54,20 @@
43
54
  "workflows": "tsx .github/src/render.ts",
44
55
  "templates:check": "tsx scripts/templates-check.ts",
45
56
  "claims:page": "tsx scenarios/status-page.ts",
46
- "bench": "npm run build && tsx bench/run.ts"
57
+ "bench": "npm run build && tsx bench/run.ts",
58
+ "grant": "tsx scripts/grant.ts"
47
59
  },
48
60
  "dependencies": {
49
- "@intentius/chant": "^0.124.3",
50
- "@intentius/chant-lexicon-forgejo": "^0.124.3",
51
- "@intentius/chant-lexicon-github": "^0.124.3",
52
- "@intentius/chant-lexicon-gitlab": "^0.124.3",
53
- "@intentius/chant-lexicon-sql": "^0.124.3",
61
+ "@intentius/chant": "^0.124.48",
62
+ "@intentius/chant-lexicon-forgejo": "^0.124.48",
63
+ "@intentius/chant-lexicon-github": "^0.124.48",
64
+ "@intentius/chant-lexicon-gitlab": "^0.124.48",
65
+ "@intentius/chant-lexicon-sql": "^0.124.48",
54
66
  "tsx": "^4.23.15"
55
67
  },
56
68
  "devDependencies": {
57
69
  "@eslint/js": "^10.0.1",
58
- "@intentius/chant-lexicon-docker": "^0.124.3",
70
+ "@intentius/chant-lexicon-docker": "^0.124.48",
59
71
  "@types/node": "^22.20.5",
60
72
  "@types/pg": "^8.23.1",
61
73
  "ajv": "^8.20.0",
@@ -122,7 +122,7 @@
122
122
  "type": "string"
123
123
  },
124
124
  "approve": {
125
- "description": "gated: the command a person runs to approve. An agent prints it and never runs it.",
125
+ "description": "gated: the command a person runs to approve. failed, when the plan moved since its approval: the command that approves the plan as it is now. An agent prints it and never runs it.",
126
126
  "type": "string"
127
127
  },
128
128
  "chantApprove": { "description": "chant's own command for the same approval (chant approve <op> <gate> --plan <digest>), for scripts; a person runs approve.", "type": "string" },
@@ -130,7 +130,7 @@
130
130
  "type": "string"
131
131
  },
132
132
  "moved": {
133
- "description": "gated: the gate's newest approval does not hold, and what moved since it.",
133
+ "description": "gated, or failed when the plan moved under the lock: the gate's newest approval does not hold, and what moved since it.",
134
134
  "type": "object",
135
135
  "additionalProperties": false,
136
136
  "required": [
@@ -144,6 +144,10 @@
144
144
  "approved": {
145
145
  "type": "string"
146
146
  },
147
+ "now": {
148
+ "description": "The plan's digest now, which approve approves.",
149
+ "type": "string"
150
+ },
147
151
  "by": {
148
152
  "type": "string"
149
153
  },
@@ -184,6 +188,30 @@
184
188
  "appliedNow": {
185
189
  "description": "applied: the migrations this run applied.",
186
190
  "$ref": "common.schema.json#/$defs/stringList"
191
+ },
192
+ "resumed": {
193
+ "description": "applied: the run started at the approved gate (a gate with resume: true, chant#3947) rather than at the first phase.",
194
+ "type": "object",
195
+ "additionalProperties": false,
196
+ "required": [
197
+ "gate",
198
+ "run",
199
+ "checkpoint"
200
+ ],
201
+ "properties": {
202
+ "gate": {
203
+ "description": "The gate the run resumed at.",
204
+ "type": "string"
205
+ },
206
+ "run": {
207
+ "description": "The run that stopped at the gate, whose checkpoint this run read.",
208
+ "type": "string"
209
+ },
210
+ "checkpoint": {
211
+ "description": "The checkpoint's digest, the one the approval copied.",
212
+ "type": "string"
213
+ }
214
+ }
187
215
  }
188
216
  }
189
217
  },
@@ -274,8 +302,10 @@
274
302
  "type": "string"
275
303
  },
276
304
  "status": {
305
+ "description": "refused (a change needs its own Op), denied (a policy rule denies the plan, with no override; the ApplyOp did not run), unchanged, gated, failed, incomplete, applied.",
277
306
  "enum": [
278
307
  "refused",
308
+ "denied",
279
309
  "unchanged",
280
310
  "gated",
281
311
  "failed",
@@ -302,6 +332,10 @@
302
332
  "description": "The plan before the run.",
303
333
  "$ref": "plan.schema.json#/$defs/declarative"
304
334
  },
335
+ "policy": {
336
+ "description": "Each policy rule's outcome over the plan, when yodel.config.ts declares a policy and there was something to apply.",
337
+ "$ref": "common.schema.json#/$defs/policy"
338
+ },
305
339
  "remaining": {
306
340
  "description": "incomplete: the plan after the Op completed.",
307
341
  "$ref": "plan.schema.json#/$defs/declarative"
@@ -0,0 +1,78 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://intentius.io/sql-yodeler/schemas/v1/check.schema.json",
4
+ "title": "yodel check --json",
5
+ "description": "Version 1. Another tool's migrations, replayed and linted (#1): each finding on the migration file that made the change. Within a version, fields are only added; a reader ignores fields it does not know.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "tool",
10
+ "status",
11
+ "dialect",
12
+ "migrations",
13
+ "errors",
14
+ "warnings",
15
+ "silenced",
16
+ "findings",
17
+ "silences",
18
+ "checked"
19
+ ],
20
+ "properties": {
21
+ "tool": {
22
+ "enum": [
23
+ "golang-migrate",
24
+ "goose",
25
+ "flyway",
26
+ "dbmate"
27
+ ]
28
+ },
29
+ "status": {
30
+ "description": "failed when a finding at level error is not silenced: the command exits 3.",
31
+ "enum": [
32
+ "passed",
33
+ "failed"
34
+ ]
35
+ },
36
+ "dialect": {
37
+ "oneOf": [
38
+ {
39
+ "$ref": "common.schema.json#/$defs/dialect"
40
+ },
41
+ {
42
+ "type": "null"
43
+ }
44
+ ]
45
+ },
46
+ "migrations": {
47
+ "description": "The files linted: the ones new since the base that change the schema.",
48
+ "$ref": "common.schema.json#/$defs/stringList"
49
+ },
50
+ "errors": {
51
+ "type": "integer",
52
+ "minimum": 0
53
+ },
54
+ "warnings": {
55
+ "type": "integer",
56
+ "minimum": 0
57
+ },
58
+ "silenced": {
59
+ "type": "integer",
60
+ "minimum": 0
61
+ },
62
+ "findings": {
63
+ "type": "array",
64
+ "items": {
65
+ "$ref": "lint.schema.json#/properties/findings/items"
66
+ }
67
+ },
68
+ "silences": {
69
+ "description": "Empty: a file's yodel:allow lines show on the findings they silence.",
70
+ "type": "object",
71
+ "maxProperties": 0
72
+ },
73
+ "checked": {
74
+ "description": "The files new since the base, in the tool's order.",
75
+ "$ref": "common.schema.json#/$defs/stringList"
76
+ }
77
+ }
78
+ }
@@ -25,6 +25,7 @@
25
25
  "type": "array",
26
26
  "items": { "type": "object", "required": ["name"], "properties": { "name": { "type": "string" } } }
27
27
  },
28
+ "unmanaged": { "description": "Objects on the server of a kind yodel cannot declare, as <kind> <name>. They are unmanaged and never drift.", "$ref": "common.schema.json#/$defs/stringList" },
28
29
  "lockWait": { "description": "Postgres: a read gave up at the lock timeout, and what it waited on.", "type": "string" },
29
30
  "columns": {
30
31
  "description": "Each changed table's declared column names, by position.",
@@ -14,6 +14,7 @@
14
14
  "status": { "const": "adopted" },
15
15
  "objects": { "description": "The objects read, as <kind> <name>.", "$ref": "common.schema.json#/$defs/stringList" },
16
16
  "schemaFiles": { "description": "The declaration files written, relative to the project.", "$ref": "common.schema.json#/$defs/stringList" },
17
+ "unsupported": { "description": "Objects of a kind yodel cannot declare, left out with --skip-unsupported, as `<kind> <name>`.", "$ref": "common.schema.json#/$defs/stringList" },
17
18
  "migration": {
18
19
  "description": "The baseline migration.",
19
20
  "type": "object",
@@ -24,7 +24,7 @@
24
24
  ]
25
25
  },
26
26
  "environment": {
27
- "description": "With --env: the environment whose history the migrations were compared with.",
27
+ "description": "With --env: the environment whose history the migrations were compared with, or on a declarative project the one the declared schema was planned against.",
28
28
  "type": "string"
29
29
  },
30
30
  "dialect": {
@@ -37,6 +37,10 @@
37
37
  }
38
38
  ]
39
39
  },
40
+ "declarative": {
41
+ "description": "A project with no migrations: the findings are over the declared schema (src/), and with --env over the plan against that environment. Nothing is silenced on this path.",
42
+ "const": true
43
+ },
40
44
  "migrations": {
41
45
  "description": "Every migration read, sorted by id.",
42
46
  "$ref": "common.schema.json#/$defs/stringList"
@@ -88,6 +92,10 @@
88
92
  "line": {
89
93
  "type": "integer"
90
94
  },
95
+ "file": {
96
+ "description": "yodel check: the file of the other tool's migrations directory the finding is on, relative to that directory.",
97
+ "type": "string"
98
+ },
91
99
  "silenced": {
92
100
  "description": "A -- yodel:allow line silenced it: the reason given. A silenced finding fails nothing.",
93
101
  "type": "string"
@@ -11,6 +11,7 @@
11
11
  "required": ["written", "id", "path", "parent", "checksum", "dialect", "statements", "ops", "manual", "hints", "checks"],
12
12
  "properties": {
13
13
  "written": { "const": true },
14
+ "source": { "description": "\"sql\" for a hand-written migration (yodel new --sql): migration.sql is its source, recorded into migration.json with yodel lint --update-checksum <id>.", "const": "sql" },
14
15
  "id": { "type": "string" },
15
16
  "path": { "type": "string" },
16
17
  "parent": { "type": ["string", "null"] },
@@ -93,6 +93,39 @@
93
93
  }
94
94
  }
95
95
  },
96
+ "lint": {
97
+ "description": "The lint findings over the planned changes (#249): each statement rule a change's rule and class breaks, at the level yodel.config.ts lint.rules gives it. Nothing is silenced on this path.",
98
+ "type": "object",
99
+ "additionalProperties": false,
100
+ "required": ["status", "errors", "warnings", "findings"],
101
+ "properties": {
102
+ "status": { "enum": ["passed", "failed"] },
103
+ "errors": { "type": "integer", "minimum": 0 },
104
+ "warnings": { "type": "integer", "minimum": 0 },
105
+ "findings": { "$ref": "lint.schema.json#/properties/findings" }
106
+ }
107
+ },
108
+ "digest": {
109
+ "description": "The digest a policy override binds (yodel override <env>): chant's plan digest over the environment, dialect and declared changes. Not the ApplyOp gate's digest, which is known once yodel apply stops at the gate. Absent when nothing would change.",
110
+ "type": "string"
111
+ },
112
+ "policy": {
113
+ "$ref": "common.schema.json#/$defs/policy"
114
+ },
115
+ "approval": {
116
+ "description": "The ApplyOp and its gate, with the command that approves the plan it stops with; or, with no ApplyOp, why.",
117
+ "type": "object",
118
+ "additionalProperties": false,
119
+ "properties": {
120
+ "op": { "type": "string" },
121
+ "gate": { "type": "string" },
122
+ "command": { "type": "string" },
123
+ "message": { "type": "string" }
124
+ }
125
+ },
126
+ "notes": {
127
+ "$ref": "common.schema.json#/$defs/stringList"
128
+ },
96
129
  "mode": false
97
130
  }
98
131
  },