@intentius/sql-yodeler 0.0.0-stage → 0.2.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.
- package/LICENSE +202 -0
- package/README.md +112 -2
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +29 -0
- package/dist/bin.js.map +1 -0
- package/dist/chant/apply.d.ts +59 -0
- package/dist/chant/apply.js +116 -0
- package/dist/chant/apply.js.map +1 -0
- package/dist/chant/build.d.ts +34 -0
- package/dist/chant/build.js +48 -0
- package/dist/chant/build.js.map +1 -0
- package/dist/chant/drift.d.ts +112 -0
- package/dist/chant/drift.js +238 -0
- package/dist/chant/drift.js.map +1 -0
- package/dist/chant/plan.d.ts +45 -0
- package/dist/chant/plan.js +61 -0
- package/dist/chant/plan.js.map +1 -0
- package/dist/chant/process.d.ts +41 -0
- package/dist/chant/process.js +87 -0
- package/dist/chant/process.js.map +1 -0
- package/dist/chant/runnable.d.ts +19 -0
- package/dist/chant/runnable.js +47 -0
- package/dist/chant/runnable.js.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +99 -0
- package/dist/cli.js.map +1 -0
- package/dist/command.d.ts +23 -0
- package/dist/command.js +13 -0
- package/dist/command.js.map +1 -0
- package/dist/commands/apply.d.ts +3 -0
- package/dist/commands/apply.js +426 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/approve.d.ts +5 -0
- package/dist/commands/approve.js +111 -0
- package/dist/commands/approve.js.map +1 -0
- package/dist/commands/drift.d.ts +14 -0
- package/dist/commands/drift.js +267 -0
- package/dist/commands/drift.js.map +1 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.js +28 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.js +139 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/lint.d.ts +3 -0
- package/dist/commands/lint.js +202 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/mcp.d.ts +3 -0
- package/dist/commands/mcp.js +50 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/new.d.ts +5 -0
- package/dist/commands/new.js +292 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/override.d.ts +3 -0
- package/dist/commands/override.js +118 -0
- package/dist/commands/override.js.map +1 -0
- package/dist/commands/plan.d.ts +3 -0
- package/dist/commands/plan.js +183 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/rebase.d.ts +3 -0
- package/dist/commands/rebase.js +167 -0
- package/dist/commands/rebase.js.map +1 -0
- package/dist/commands/repair.d.ts +14 -0
- package/dist/commands/repair.js +125 -0
- package/dist/commands/repair.js.map +1 -0
- package/dist/commands/status.d.ts +7 -0
- package/dist/commands/status.js +54 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/config/define.d.ts +148 -0
- package/dist/config/define.js +20 -0
- package/dist/config/define.js.map +1 -0
- package/dist/config/index.d.ts +11 -0
- package/dist/config/index.js +12 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/load.d.ts +17 -0
- package/dist/config/load.js +162 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/settings.d.ts +53 -0
- package/dist/config/settings.js +116 -0
- package/dist/config/settings.js.map +1 -0
- package/dist/env-args.d.ts +24 -0
- package/dist/env-args.js +92 -0
- package/dist/env-args.js.map +1 -0
- package/dist/exit.d.ts +20 -0
- package/dist/exit.js +28 -0
- package/dist/exit.js.map +1 -0
- package/dist/history/client.d.ts +25 -0
- package/dist/history/client.js +42 -0
- package/dist/history/client.js.map +1 -0
- package/dist/history/ddl.d.ts +58 -0
- package/dist/history/ddl.js +100 -0
- package/dist/history/ddl.js.map +1 -0
- package/dist/history/index.d.ts +25 -0
- package/dist/history/index.js +26 -0
- package/dist/history/index.js.map +1 -0
- package/dist/history/lock.d.ts +104 -0
- package/dist/history/lock.js +230 -0
- package/dist/history/lock.js.map +1 -0
- package/dist/history/postgres/ddl.d.ts +22 -0
- package/dist/history/postgres/ddl.js +47 -0
- package/dist/history/postgres/ddl.js.map +1 -0
- package/dist/history/postgres/index.d.ts +12 -0
- package/dist/history/postgres/index.js +13 -0
- package/dist/history/postgres/index.js.map +1 -0
- package/dist/history/postgres/lock.d.ts +48 -0
- package/dist/history/postgres/lock.js +95 -0
- package/dist/history/postgres/lock.js.map +1 -0
- package/dist/history/postgres/store.d.ts +39 -0
- package/dist/history/postgres/store.js +68 -0
- package/dist/history/postgres/store.js.map +1 -0
- package/dist/history/rows.d.ts +96 -0
- package/dist/history/rows.js +73 -0
- package/dist/history/rows.js.map +1 -0
- package/dist/history/store.d.ts +72 -0
- package/dist/history/store.js +134 -0
- package/dist/history/store.js.map +1 -0
- package/dist/history/topology.d.ts +41 -0
- package/dist/history/topology.js +54 -0
- package/dist/history/topology.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/init/adopt.d.ts +70 -0
- package/dist/init/adopt.js +143 -0
- package/dist/init/adopt.js.map +1 -0
- package/dist/init/baseline.d.ts +61 -0
- package/dist/init/baseline.js +88 -0
- package/dist/init/baseline.js.map +1 -0
- package/dist/init/files.d.ts +23 -0
- package/dist/init/files.js +77 -0
- package/dist/init/files.js.map +1 -0
- package/dist/init/index.d.ts +16 -0
- package/dist/init/index.js +17 -0
- package/dist/init/index.js.map +1 -0
- package/dist/init/live.d.ts +39 -0
- package/dist/init/live.js +68 -0
- package/dist/init/live.js.map +1 -0
- package/dist/lint/check.d.ts +88 -0
- package/dist/lint/check.js +227 -0
- package/dist/lint/check.js.map +1 -0
- package/dist/lint/config.d.ts +21 -0
- package/dist/lint/config.js +43 -0
- package/dist/lint/config.js.map +1 -0
- package/dist/lint/index.d.ts +31 -0
- package/dist/lint/index.js +43 -0
- package/dist/lint/index.js.map +1 -0
- package/dist/lint/project-rules.d.ts +19 -0
- package/dist/lint/project-rules.js +32 -0
- package/dist/lint/project-rules.js.map +1 -0
- package/dist/lint/report.d.ts +7 -0
- package/dist/lint/report.js +48 -0
- package/dist/lint/report.js.map +1 -0
- package/dist/lint/rules.d.ts +53 -0
- package/dist/lint/rules.js +42 -0
- package/dist/lint/rules.js.map +1 -0
- package/dist/lint/silences.d.ts +49 -0
- package/dist/lint/silences.js +91 -0
- package/dist/lint/silences.js.map +1 -0
- package/dist/lint/statements.d.ts +38 -0
- package/dist/lint/statements.js +120 -0
- package/dist/lint/statements.js.map +1 -0
- package/dist/mcp/server.d.ts +40 -0
- package/dist/mcp/server.js +106 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +72 -0
- package/dist/mcp/tools.js +178 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/migrations/checks.d.ts +28 -0
- package/dist/migrations/checks.js +97 -0
- package/dist/migrations/checks.js.map +1 -0
- package/dist/migrations/checksum.d.ts +56 -0
- package/dist/migrations/checksum.js +72 -0
- package/dist/migrations/checksum.js.map +1 -0
- package/dist/migrations/create.d.ts +75 -0
- package/dist/migrations/create.js +120 -0
- package/dist/migrations/create.js.map +1 -0
- package/dist/migrations/directory.d.ts +119 -0
- package/dist/migrations/directory.js +229 -0
- package/dist/migrations/directory.js.map +1 -0
- package/dist/migrations/document.d.ts +106 -0
- package/dist/migrations/document.js +83 -0
- package/dist/migrations/document.js.map +1 -0
- package/dist/migrations/index.d.ts +21 -0
- package/dist/migrations/index.js +22 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/pr/comment.d.ts +32 -0
- package/dist/pr/comment.js +99 -0
- package/dist/pr/comment.js.map +1 -0
- package/dist/pr/forge.d.ts +54 -0
- package/dist/pr/forge.js +119 -0
- package/dist/pr/forge.js.map +1 -0
- package/dist/pr/issue.d.ts +68 -0
- package/dist/pr/issue.js +107 -0
- package/dist/pr/issue.js.map +1 -0
- package/dist/pr/model.d.ts +99 -0
- package/dist/pr/model.js +137 -0
- package/dist/pr/model.js.map +1 -0
- package/dist/pr/render.d.ts +29 -0
- package/dist/pr/render.js +279 -0
- package/dist/pr/render.js.map +1 -0
- package/dist/project.d.ts +62 -0
- package/dist/project.js +92 -0
- package/dist/project.js.map +1 -0
- package/dist/rebase/index.d.ts +121 -0
- package/dist/rebase/index.js +390 -0
- package/dist/rebase/index.js.map +1 -0
- package/dist/rebase/repair.d.ts +41 -0
- package/dist/rebase/repair.js +68 -0
- package/dist/rebase/repair.js.map +1 -0
- package/dist/replay/clickhouse.d.ts +33 -0
- package/dist/replay/clickhouse.js +106 -0
- package/dist/replay/clickhouse.js.map +1 -0
- package/dist/replay/index.d.ts +39 -0
- package/dist/replay/index.js +57 -0
- package/dist/replay/index.js.map +1 -0
- package/dist/replay/postgres.d.ts +31 -0
- package/dist/replay/postgres.js +140 -0
- package/dist/replay/postgres.js.map +1 -0
- package/dist/replay/replay.d.ts +114 -0
- package/dist/replay/replay.js +98 -0
- package/dist/replay/replay.js.map +1 -0
- package/dist/replay/report.d.ts +18 -0
- package/dist/replay/report.js +72 -0
- package/dist/replay/report.js.map +1 -0
- package/dist/replay/shared.d.ts +28 -0
- package/dist/replay/shared.js +77 -0
- package/dist/replay/shared.js.map +1 -0
- package/dist/schemas.d.ts +34 -0
- package/dist/schemas.js +38 -0
- package/dist/schemas.js.map +1 -0
- package/dist/server.d.ts +40 -0
- package/dist/server.js +87 -0
- package/dist/server.js.map +1 -0
- package/dist/steps/backfill.d.ts +132 -0
- package/dist/steps/backfill.js +307 -0
- package/dist/steps/backfill.js.map +1 -0
- package/dist/steps/index.d.ts +52 -0
- package/dist/steps/index.js +52 -0
- package/dist/steps/index.js.map +1 -0
- package/dist/steps/kinds.d.ts +101 -0
- package/dist/steps/kinds.js +143 -0
- package/dist/steps/kinds.js.map +1 -0
- package/dist/steps/postgres-migration.d.ts +95 -0
- package/dist/steps/postgres-migration.js +149 -0
- package/dist/steps/postgres-migration.js.map +1 -0
- package/dist/steps/rebuild.d.ts +97 -0
- package/dist/steps/rebuild.js +155 -0
- package/dist/steps/rebuild.js.map +1 -0
- package/dist/steps/run.d.ts +45 -0
- package/dist/steps/run.js +72 -0
- package/dist/steps/run.js.map +1 -0
- package/dist/topology/render.d.ts +17 -0
- package/dist/topology/render.js +17 -0
- package/dist/topology/render.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +11 -0
- package/dist/version.js.map +1 -0
- package/dist/versioned/approval.d.ts +35 -0
- package/dist/versioned/approval.js +53 -0
- package/dist/versioned/approval.js.map +1 -0
- package/dist/versioned/checks.d.ts +29 -0
- package/dist/versioned/checks.js +54 -0
- package/dist/versioned/checks.js.map +1 -0
- package/dist/versioned/clickhouse.d.ts +24 -0
- package/dist/versioned/clickhouse.js +42 -0
- package/dist/versioned/clickhouse.js.map +1 -0
- package/dist/versioned/digest.d.ts +77 -0
- package/dist/versioned/digest.js +69 -0
- package/dist/versioned/digest.js.map +1 -0
- package/dist/versioned/driver.d.ts +51 -0
- package/dist/versioned/driver.js +13 -0
- package/dist/versioned/driver.js.map +1 -0
- package/dist/versioned/engine.d.ts +206 -0
- package/dist/versioned/engine.js +370 -0
- package/dist/versioned/engine.js.map +1 -0
- package/dist/versioned/explain.d.ts +123 -0
- package/dist/versioned/explain.js +294 -0
- package/dist/versioned/explain.js.map +1 -0
- package/dist/versioned/index.d.ts +46 -0
- package/dist/versioned/index.js +77 -0
- package/dist/versioned/index.js.map +1 -0
- package/dist/versioned/op.d.ts +72 -0
- package/dist/versioned/op.js +185 -0
- package/dist/versioned/op.js.map +1 -0
- package/dist/versioned/policy.d.ts +67 -0
- package/dist/versioned/policy.js +161 -0
- package/dist/versioned/policy.js.map +1 -0
- package/dist/versioned/postgres/catalog.d.ts +33 -0
- package/dist/versioned/postgres/catalog.js +34 -0
- package/dist/versioned/postgres/catalog.js.map +1 -0
- package/dist/versioned/postgres/driver.d.ts +71 -0
- package/dist/versioned/postgres/driver.js +140 -0
- package/dist/versioned/postgres/driver.js.map +1 -0
- package/dist/versioned/postgres/executor.d.ts +104 -0
- package/dist/versioned/postgres/executor.js +172 -0
- package/dist/versioned/postgres/executor.js.map +1 -0
- package/dist/versioned/postgres/index.d.ts +11 -0
- package/dist/versioned/postgres/index.js +12 -0
- package/dist/versioned/postgres/index.js.map +1 -0
- package/dist/versioned/postgres/waits.d.ts +46 -0
- package/dist/versioned/postgres/waits.js +78 -0
- package/dist/versioned/postgres/waits.js.map +1 -0
- package/dist/versioned/report.d.ts +25 -0
- package/dist/versioned/report.js +84 -0
- package/dist/versioned/report.js.map +1 -0
- package/dist/versioned/stand-down.d.ts +30 -0
- package/dist/versioned/stand-down.js +56 -0
- package/dist/versioned/stand-down.js.map +1 -0
- package/dist/versioned/state.d.ts +108 -0
- package/dist/versioned/state.js +153 -0
- package/dist/versioned/state.js.map +1 -0
- package/package.json +61 -4
- package/schemas/apply.schema.json +269 -0
- package/schemas/common.schema.json +213 -0
- package/schemas/drift.schema.json +36 -0
- package/schemas/init.schema.json +31 -0
- package/schemas/lint-rules.schema.json +54 -0
- package/schemas/lint.schema.json +290 -0
- package/schemas/mcp.schema.json +70 -0
- package/schemas/new.schema.json +71 -0
- package/schemas/plan.schema.json +371 -0
- package/schemas/rebase.schema.json +54 -0
- package/schemas/repair.schema.json +20 -0
- package/schemas/status.schema.json +310 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"baseline.js","sourceRoot":"","sources":["../../src/init/baseline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAmB,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAqB,MAAM,uBAAuB,CAAC;AAEnE,2EAA2E;AAC3E,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;AAExC,4CAA4C;AAC5C,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CA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GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,UAAU,CAAC,CAAC;QAC3E,IAAI,OAAO;YAAE,MAAM,OAAO,CAAC;QAC3B,MAAM,GAAG,GAAG,WAAW,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACzH,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAChH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The files `yodel init` writes, and taking them back when a later step
|
|
3
|
+
* fails, so an init that does not finish leaves the project as it found it.
|
|
4
|
+
*/
|
|
5
|
+
/** Whether a file is a declaration chant builds: TypeScript (not a test or a `.d.ts`) or SQL. */
|
|
6
|
+
export declare const isDeclarationFile: (name: string) => boolean;
|
|
7
|
+
/** The declaration files under `dir`, relative to it, sorted. None when `dir` does not exist. */
|
|
8
|
+
export declare function declarationFiles(dir: string): string[];
|
|
9
|
+
/**
|
|
10
|
+
* Records every file and directory written, with what a file held before,
|
|
11
|
+
* so {@link Journal.undo} puts things back.
|
|
12
|
+
*/
|
|
13
|
+
export declare class Journal {
|
|
14
|
+
private readonly steps;
|
|
15
|
+
/** Makes `dir` and any parents missing, remembering the ones it made. */
|
|
16
|
+
mkdir(dir: string): void;
|
|
17
|
+
/** Writes a file, remembering what was there. */
|
|
18
|
+
write(path: string, content: string): void;
|
|
19
|
+
/** Remembers a directory something else made (a migration's), to remove on undo. */
|
|
20
|
+
created(path: string): void;
|
|
21
|
+
/** Puts back everything, newest first. */
|
|
22
|
+
undo(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The files `yodel init` writes, and taking them back when a later step
|
|
3
|
+
* fails, so an init that does not finish leaves the project as it found it.
|
|
4
|
+
*/
|
|
5
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { dirname, join, relative } from "node:path";
|
|
7
|
+
/** Directories never searched for declarations. */
|
|
8
|
+
const SKIP = new Set(["node_modules", "dist", "coverage"]);
|
|
9
|
+
/** Whether a file is a declaration chant builds: TypeScript (not a test or a `.d.ts`) or SQL. */
|
|
10
|
+
export const isDeclarationFile = (name) => (/\.(ts|mts|sql)$/.test(name) && !/\.d\.ts$/.test(name) && !/\.(test|spec)\.ts$/.test(name));
|
|
11
|
+
/** The declaration files under `dir`, relative to it, sorted. None when `dir` does not exist. */
|
|
12
|
+
export function declarationFiles(dir) {
|
|
13
|
+
if (!existsSync(dir))
|
|
14
|
+
return [];
|
|
15
|
+
const out = [];
|
|
16
|
+
const walk = (at) => {
|
|
17
|
+
for (const e of readdirSync(at, { withFileTypes: true })) {
|
|
18
|
+
if (e.name.startsWith(".") || SKIP.has(e.name))
|
|
19
|
+
continue;
|
|
20
|
+
const path = join(at, e.name);
|
|
21
|
+
if (e.isDirectory())
|
|
22
|
+
walk(path);
|
|
23
|
+
else if (e.isFile() && isDeclarationFile(e.name))
|
|
24
|
+
out.push(relative(dir, path));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
walk(dir);
|
|
28
|
+
return out.sort();
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Records every file and directory written, with what a file held before,
|
|
32
|
+
* so {@link Journal.undo} puts things back.
|
|
33
|
+
*/
|
|
34
|
+
export class Journal {
|
|
35
|
+
steps = [];
|
|
36
|
+
/** Makes `dir` and any parents missing, remembering the ones it made. */
|
|
37
|
+
mkdir(dir) {
|
|
38
|
+
const missing = [];
|
|
39
|
+
for (let d = dir; !existsSync(d); d = dirname(d))
|
|
40
|
+
missing.push(d);
|
|
41
|
+
if (missing.length === 0)
|
|
42
|
+
return;
|
|
43
|
+
mkdirSync(dir, { recursive: true });
|
|
44
|
+
const top = missing[missing.length - 1];
|
|
45
|
+
if (top !== undefined)
|
|
46
|
+
this.steps.push(() => { rmSync(top, { recursive: true, force: true }); });
|
|
47
|
+
}
|
|
48
|
+
/** Writes a file, remembering what was there. */
|
|
49
|
+
write(path, content) {
|
|
50
|
+
this.mkdir(dirname(path));
|
|
51
|
+
const before = existsSync(path) && statSync(path).isFile() ? readFileSync(path, "utf8") : undefined;
|
|
52
|
+
writeFileSync(path, content);
|
|
53
|
+
this.steps.push(() => {
|
|
54
|
+
if (before === undefined)
|
|
55
|
+
rmSync(path, { force: true });
|
|
56
|
+
else
|
|
57
|
+
writeFileSync(path, before);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/** Remembers a directory something else made (a migration's), to remove on undo. */
|
|
61
|
+
created(path) {
|
|
62
|
+
this.steps.push(() => { rmSync(path, { recursive: true, force: true }); });
|
|
63
|
+
}
|
|
64
|
+
/** Puts back everything, newest first. */
|
|
65
|
+
undo() {
|
|
66
|
+
for (const step of this.steps.reverse()) {
|
|
67
|
+
try {
|
|
68
|
+
step();
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Best effort: the rest still runs.
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
this.steps.length = 0;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/init/files.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AS,CAAC;QACpG,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACnB,IAAI,MAAM,KAAK,SAAS;gBAAE,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;;gBACnD,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,oFAAoF;IACpF,OAAO,CAAC,IAAY;QAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED,0CAA0C;IAC1C,IAAI;QACF,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YACxC,IAAI,CAAC;gBACH,IAAI,EAAE,CAAC;YACT,CAAC;YAAC,MAAM,CAAC;gBACP,oCAAoC;YACtC,CAAC;QACH,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adoption (#10): `yodel init --from <env>` reads a live database with
|
|
3
|
+
* chant's import, writes its declarations, writes the baseline migration
|
|
4
|
+
* holding them, and records the baseline applied without running it.
|
|
5
|
+
*
|
|
6
|
+
* adopt(project, env, options) the whole of it; takes back what it wrote on a failure
|
|
7
|
+
* preflight(project, env) the refusals that need no server
|
|
8
|
+
* importLive(project, env) chant import --from, in process: the IR and the files
|
|
9
|
+
* baselineRow(migration, input) the history row that records a baseline
|
|
10
|
+
* isBaselineRow(row) whether a row is one
|
|
11
|
+
* recordBaseline(venv, migration) appends it under the apply lock
|
|
12
|
+
*/
|
|
13
|
+
export * from "./adopt.js";
|
|
14
|
+
export * from "./baseline.js";
|
|
15
|
+
export * from "./files.js";
|
|
16
|
+
export * from "./live.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adoption (#10): `yodel init --from <env>` reads a live database with
|
|
3
|
+
* chant's import, writes its declarations, writes the baseline migration
|
|
4
|
+
* holding them, and records the baseline applied without running it.
|
|
5
|
+
*
|
|
6
|
+
* adopt(project, env, options) the whole of it; takes back what it wrote on a failure
|
|
7
|
+
* preflight(project, env) the refusals that need no server
|
|
8
|
+
* importLive(project, env) chant import --from, in process: the IR and the files
|
|
9
|
+
* baselineRow(migration, input) the history row that records a baseline
|
|
10
|
+
* isBaselineRow(row) whether a row is one
|
|
11
|
+
* recordBaseline(venv, migration) appends it under the apply lock
|
|
12
|
+
*/
|
|
13
|
+
export * from "./adopt.js";
|
|
14
|
+
export * from "./baseline.js";
|
|
15
|
+
export * from "./files.js";
|
|
16
|
+
export * from "./live.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/init/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a live database as declarations: the library functions behind
|
|
3
|
+
* `chant import --from <env>`, called in process with the project's own
|
|
4
|
+
* config, so the server read is the one `sql.profiles.<env>` binds and the
|
|
5
|
+
* files written are the ones `chant import --from` writes.
|
|
6
|
+
*
|
|
7
|
+
* chant's import already strips its ownership marker from every comment it
|
|
8
|
+
* reads, so the declarations say what an author would, and an object that
|
|
9
|
+
* carries no marker (one made by hand) reads the same as one chant made.
|
|
10
|
+
*/
|
|
11
|
+
import type { GeneratedFile } from "@intentius/chant/import/generator";
|
|
12
|
+
import type { TemplateIR } from "@intentius/chant/import/parser";
|
|
13
|
+
import { type Environment, type Project } from "../project.js";
|
|
14
|
+
export interface LiveImport {
|
|
15
|
+
/** What the server holds, as chant's import IR: one resource per object. */
|
|
16
|
+
ir: TemplateIR;
|
|
17
|
+
/** The declaration files, paths relative to the source directory (chant's sql generator writes one, `schema.ts`). */
|
|
18
|
+
files: GeneratedFile[];
|
|
19
|
+
/** What the import left out or could not carry, as chant reports it. */
|
|
20
|
+
warnings: string[];
|
|
21
|
+
/** Live objects left out as another tool's (`<database>.<name>`), which a plan then shows as undeclared. */
|
|
22
|
+
leftOut: string[];
|
|
23
|
+
}
|
|
24
|
+
/** The objects an import read, as `<type> <name>` lines for people. */
|
|
25
|
+
export declare function describeImported(ir: TemplateIR): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Reads the environment's live database and generates its declarations,
|
|
28
|
+
* exactly as `chant import --from <env>` does. Nothing is written.
|
|
29
|
+
*/
|
|
30
|
+
export declare function importLive(project: Project, env: Environment, processEnv?: NodeJS.ProcessEnv): Promise<LiveImport>;
|
|
31
|
+
/**
|
|
32
|
+
* ClickHouse: leaves out a table another migration runner keeps its history
|
|
33
|
+
* in (golang-migrate's and dbmate's `schema_migrations`, goose's
|
|
34
|
+
* `goose_db_version`, ...), with the warning chant's Postgres import gives
|
|
35
|
+
* for the same table (#17). chant's ClickHouse import adopts them; declaring
|
|
36
|
+
* one would have chant change what that tool owns. The names are chant's own
|
|
37
|
+
* list, `FOREIGN_TABLES`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function withoutRunnerTables(resources: TemplateIR["resources"], warnings: string[], leftOut?: string[]): Promise<TemplateIR["resources"]>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a live database as declarations: the library functions behind
|
|
3
|
+
* `chant import --from <env>`, called in process with the project's own
|
|
4
|
+
* config, so the server read is the one `sql.profiles.<env>` binds and the
|
|
5
|
+
* files written are the ones `chant import --from` writes.
|
|
6
|
+
*
|
|
7
|
+
* chant's import already strips its ownership marker from every comment it
|
|
8
|
+
* reads, so the declarations say what an author would, and an object that
|
|
9
|
+
* carries no marker (one made by hand) reads the same as one chant made.
|
|
10
|
+
*/
|
|
11
|
+
import { YodelError } from "../project.js";
|
|
12
|
+
/** The objects an import read, as `<type> <name>` lines for people. */
|
|
13
|
+
export function describeImported(ir) {
|
|
14
|
+
return ir.resources.map((r) => {
|
|
15
|
+
const p = r.properties;
|
|
16
|
+
const where = p.database ?? p.schema;
|
|
17
|
+
return `${r.type.replace(/^(ClickHouse|Postgres)::/, "")} ${where ? `${where}.` : ""}${p.name ?? r.logicalId}`;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Reads the environment's live database and generates its declarations,
|
|
22
|
+
* exactly as `chant import --from <env>` does. Nothing is written.
|
|
23
|
+
*/
|
|
24
|
+
export async function importLive(project, env, processEnv = process.env) {
|
|
25
|
+
const options = { environment: env.name, config: project.config, cwd: project.dir, env: processEnv };
|
|
26
|
+
let exported;
|
|
27
|
+
try {
|
|
28
|
+
if (project.dialect === "postgres") {
|
|
29
|
+
const { exportResources } = await import("@intentius/chant-lexicon-sql/postgres/import/live-export");
|
|
30
|
+
exported = await exportResources(options);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
const { exportResources } = await import("@intentius/chant-lexicon-sql/clickhouse/import/live-export");
|
|
34
|
+
exported = await exportResources(options);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
throw new YodelError(`reading ${env.name}'s live schema failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
39
|
+
}
|
|
40
|
+
const warnings = [...(exported.warnings ?? [])];
|
|
41
|
+
const leftOut = [];
|
|
42
|
+
const resources = project.dialect === "clickhouse" ? await withoutRunnerTables(exported.resources, warnings, leftOut) : exported.resources;
|
|
43
|
+
const ir = { resources, parameters: exported.parameters ?? [] };
|
|
44
|
+
const { sqlTemplateGenerator } = await import("@intentius/chant-lexicon-sql/import-generator");
|
|
45
|
+
const files = ir.resources.length === 0 ? [] : sqlTemplateGenerator.generate(ir);
|
|
46
|
+
return { ir, files, warnings, leftOut };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* ClickHouse: leaves out a table another migration runner keeps its history
|
|
50
|
+
* in (golang-migrate's and dbmate's `schema_migrations`, goose's
|
|
51
|
+
* `goose_db_version`, ...), with the warning chant's Postgres import gives
|
|
52
|
+
* for the same table (#17). chant's ClickHouse import adopts them; declaring
|
|
53
|
+
* one would have chant change what that tool owns. The names are chant's own
|
|
54
|
+
* list, `FOREIGN_TABLES`.
|
|
55
|
+
*/
|
|
56
|
+
export async function withoutRunnerTables(resources, warnings, leftOut = []) {
|
|
57
|
+
const { FOREIGN_TABLES } = await import("@intentius/chant-lexicon-sql/postgres/live/catalog");
|
|
58
|
+
return resources.filter((r) => {
|
|
59
|
+
const p = r.properties;
|
|
60
|
+
const tool = r.type === "ClickHouse::Table" && p.name !== undefined && Object.hasOwn(FOREIGN_TABLES, p.name) ? FOREIGN_TABLES[p.name] : undefined;
|
|
61
|
+
if (tool === undefined)
|
|
62
|
+
return true;
|
|
63
|
+
leftOut.push(`${p.database ? `${p.database}.` : ""}${String(p.name)}`);
|
|
64
|
+
warnings.push(`${p.database ? `${p.database}.` : ""}${String(p.name)} is kept by ${tool}; left out, since declaring it would have chant change what that tool owns`);
|
|
65
|
+
return false;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=live.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live.js","sourceRoot":"","sources":["../../src/init/live.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,UAAU,EAAkC,MAAM,eAAe,CAAC;AAa3E,uEAAuE;AACvE,MAAM,UAAU,gBAAgB,CAAC,EAAc;IA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MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAClJ,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvE,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,IAAI,4EAA4E,CAAC,CAAC;QACrK,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `yodel lint` over a migrations directory: every rule in `./rules.ts`,
|
|
3
|
+
* offline, with no server. Optionally against one environment's history
|
|
4
|
+
* (`--env`), which turns the checksum rule from "the files changed since
|
|
5
|
+
* yodel wrote them" into "an applied migration changed since it ran".
|
|
6
|
+
*
|
|
7
|
+
* Rules that need more than the directory, such as the replay check (#11),
|
|
8
|
+
* plug in as {@link ProjectRule}s through {@link LintOptions.rules}.
|
|
9
|
+
*/
|
|
10
|
+
import type { Project } from "../project.js";
|
|
11
|
+
import { type Migration, type MigrationScan } from "../migrations/index.js";
|
|
12
|
+
import type { VersionedStatus } from "../versioned/state.js";
|
|
13
|
+
import { type LintSettings } from "./config.js";
|
|
14
|
+
import { type LintLevel, type LintRule } from "./rules.js";
|
|
15
|
+
import { type Silence } from "./silences.js";
|
|
16
|
+
import { type Dialect } from "./statements.js";
|
|
17
|
+
/** One thing a rule found. */
|
|
18
|
+
export interface Finding {
|
|
19
|
+
rule: string;
|
|
20
|
+
level: LintLevel;
|
|
21
|
+
message: string;
|
|
22
|
+
/** The migration it is in, when it is in one. */
|
|
23
|
+
migration?: string;
|
|
24
|
+
/** The step, an index into the migration's `steps`. */
|
|
25
|
+
step?: number;
|
|
26
|
+
/** The step's object on the server (`database.table`, `schema.table`). */
|
|
27
|
+
object?: string;
|
|
28
|
+
/** A line in migration.sql. */
|
|
29
|
+
line?: number;
|
|
30
|
+
/** Set when a `-- yodel:allow` line silenced it: the reason given. A silenced finding fails nothing. */
|
|
31
|
+
silenced?: string;
|
|
32
|
+
}
|
|
33
|
+
/** What a rule reports, before its level and any silence are applied. */
|
|
34
|
+
export type RawFinding = Omit<Finding, "level" | "silenced"> & {
|
|
35
|
+
/** Overrides the rule's level for this one finding (a pending migration edited, with --env, is a warning). */
|
|
36
|
+
level?: LintLevel;
|
|
37
|
+
};
|
|
38
|
+
export interface LintContext {
|
|
39
|
+
/** The migrations directory, absolute. */
|
|
40
|
+
dir: string;
|
|
41
|
+
scan: MigrationScan;
|
|
42
|
+
dialect: Dialect | undefined;
|
|
43
|
+
project: Project | undefined;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A rule that checks the project as a whole and may reach a server or the
|
|
47
|
+
* emulator: the hook for the replay check (#11). Its findings get levels
|
|
48
|
+
* from `yodel.config.ts` like any rule's; `yodel lint --rules` lists it.
|
|
49
|
+
*/
|
|
50
|
+
export interface ProjectRule {
|
|
51
|
+
rule: LintRule;
|
|
52
|
+
check: (ctx: LintContext) => Promise<RawFinding[]>;
|
|
53
|
+
}
|
|
54
|
+
export interface LintOptions {
|
|
55
|
+
/** The project's dialect. Every migration must be this dialect. */
|
|
56
|
+
dialect?: Dialect;
|
|
57
|
+
project?: Project;
|
|
58
|
+
settings?: LintSettings;
|
|
59
|
+
/** An environment's history compared with the directory (`compareHistory`), for --env. */
|
|
60
|
+
history?: {
|
|
61
|
+
environment: string;
|
|
62
|
+
status: VersionedStatus;
|
|
63
|
+
};
|
|
64
|
+
/** More rules: the replay check (#11) plugs in here. */
|
|
65
|
+
rules?: readonly ProjectRule[];
|
|
66
|
+
}
|
|
67
|
+
export interface LintReport {
|
|
68
|
+
dir: string;
|
|
69
|
+
dialect: Dialect | undefined;
|
|
70
|
+
environment: string | undefined;
|
|
71
|
+
/** Every migration read, sorted by id. */
|
|
72
|
+
migrations: string[];
|
|
73
|
+
findings: Finding[];
|
|
74
|
+
/** The silences each migration's migration.sql holds, by migration id. */
|
|
75
|
+
silences: Record<string, Silence[]>;
|
|
76
|
+
errors: number;
|
|
77
|
+
warnings: number;
|
|
78
|
+
silenced: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Whether the only change to `m` since its checksum was recorded is added
|
|
82
|
+
* `-- yodel:allow` lines: its files without them hash to the recorded
|
|
83
|
+
* checksum. Then nothing it runs changed, and the fix is to record the
|
|
84
|
+
* checksum (#19).
|
|
85
|
+
*/
|
|
86
|
+
export declare function onlySilencesAdded(m: Migration | undefined, recorded: string): boolean;
|
|
87
|
+
/** Lints the migrations in `dir`. Never throws on what it finds; a finding is a result. */
|
|
88
|
+
export declare function lintMigrations(dir: string, options?: LintOptions): Promise<LintReport>;
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `yodel lint` over a migrations directory: every rule in `./rules.ts`,
|
|
3
|
+
* offline, with no server. Optionally against one environment's history
|
|
4
|
+
* (`--env`), which turns the checksum rule from "the files changed since
|
|
5
|
+
* yodel wrote them" into "an applied migration changed since it ran".
|
|
6
|
+
*
|
|
7
|
+
* Rules that need more than the directory, such as the replay check (#11),
|
|
8
|
+
* plug in as {@link ProjectRule}s through {@link LintOptions.rules}.
|
|
9
|
+
*/
|
|
10
|
+
import { diffStatements } from "@intentius/chant-lexicon-sql/migration-statements";
|
|
11
|
+
import { computeChecksum, emptyBuild, scanMigrations } from "../migrations/index.js";
|
|
12
|
+
import { levelOf } from "./config.js";
|
|
13
|
+
import { LINT_RULES } from "./rules.js";
|
|
14
|
+
import { mapMigrationSql } from "./silences.js";
|
|
15
|
+
import { refusedStep, stepFindings, unreadableStep } from "./statements.js";
|
|
16
|
+
const message = (e) => (e instanceof Error ? e.message : String(e)).split("\n")[0] ?? "";
|
|
17
|
+
const UPDATE = "if it is not applied in any environment, record its new checksum with yodel lint --update-checksum <id>; if it is, undo the edit, or record it with yodel repair <id> --reason ... <env>";
|
|
18
|
+
/** The `-- yodel:allow` lines silences.ts reads. */
|
|
19
|
+
const ALLOW_LINE = /^\s*--\s*yodel:allow\b.*(?:\r?\n|$)/gm;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the only change to `m` since its checksum was recorded is added
|
|
22
|
+
* `-- yodel:allow` lines: its files without them hash to the recorded
|
|
23
|
+
* checksum. Then nothing it runs changed, and the fix is to record the
|
|
24
|
+
* checksum (#19).
|
|
25
|
+
*/
|
|
26
|
+
export function onlySilencesAdded(m, recorded) {
|
|
27
|
+
if (!m || !recorded)
|
|
28
|
+
return false;
|
|
29
|
+
const sql = m.files.sql.replace(ALLOW_LINE, "");
|
|
30
|
+
return sql !== m.files.sql && computeChecksum({ ...m.files, sql }) === recorded;
|
|
31
|
+
}
|
|
32
|
+
function directoryFindings(problems, history, migrations = []) {
|
|
33
|
+
const out = [];
|
|
34
|
+
for (const p of problems) {
|
|
35
|
+
switch (p.kind) {
|
|
36
|
+
case "fork":
|
|
37
|
+
// The rule already says "fork"; the directory problem's own "fork: " prefix would say it twice.
|
|
38
|
+
out.push({ rule: "fork", message: p.message.replace(/^fork: /, "") });
|
|
39
|
+
break;
|
|
40
|
+
case "checksum": {
|
|
41
|
+
if (history) {
|
|
42
|
+
const applied = history.status.applied.find((a) => a.id === p.id && a.index !== undefined);
|
|
43
|
+
// Applied: the history decides (below). Pending: an edit before it runs is allowed; say so.
|
|
44
|
+
if (!applied) {
|
|
45
|
+
out.push({
|
|
46
|
+
rule: "checksum",
|
|
47
|
+
level: "warning",
|
|
48
|
+
migration: p.id,
|
|
49
|
+
message: `${p.message}. It is not applied in ${history.environment}, so the edit is allowed there; record the new checksum with yodel lint --update-checksum ${p.id}`,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
if (onlySilencesAdded(migrations.find((m) => m.id === p.id), p.check.recorded)) {
|
|
55
|
+
out.push({ rule: "checksum", migration: p.id, message: `${p.id}: the only change since its checksum was recorded is its added -- yodel:allow lines, and nothing it runs changed; record them with yodel lint --update-checksum ${p.id} (and, where it is already applied, yodel repair <env> ${p.id} --reason ...)` });
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
out.push({ rule: "checksum", migration: p.id, message: `${p.message}; ${UPDATE.replaceAll("<id>", p.id)}` });
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
case "missing-parent":
|
|
62
|
+
case "id-mismatch":
|
|
63
|
+
out.push({ rule: "directory", migration: p.id, message: p.message });
|
|
64
|
+
break;
|
|
65
|
+
case "unreachable":
|
|
66
|
+
out.push({ rule: "directory", message: p.message });
|
|
67
|
+
break;
|
|
68
|
+
case "unreadable":
|
|
69
|
+
out.push({ rule: "directory", message: p.message });
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (history) {
|
|
74
|
+
for (const mm of history.status.mismatches) {
|
|
75
|
+
out.push({ rule: "checksum", migration: mm.id, ...(mm.kind === "part-way" ? { step: mm.statement } : {}), message: `${history.environment}: ${mm.message}` });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
/** The objects of a build that the lexicon cannot read, each alone; `[]` when it reads them all. */
|
|
81
|
+
function unreadableObjects(schema, options) {
|
|
82
|
+
const empty = emptyBuild(schema);
|
|
83
|
+
const out = [];
|
|
84
|
+
for (const o of schema.objects) {
|
|
85
|
+
try {
|
|
86
|
+
diffStatements(empty, { ...schema, objects: [{ ...o, dependsOn: [] }] }, options);
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
out.push({ export: o.export, type: o.type ?? "", ddl: o.ddl, error: message(e) });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The lexicon reads every migration's recorded schema: the diff from its
|
|
96
|
+
* parent's schema to its own is made again, as `yodel new` made it. An
|
|
97
|
+
* object it cannot read is reported once, in the first migration that
|
|
98
|
+
* records it; a failure no single object explains is reported whole.
|
|
99
|
+
*/
|
|
100
|
+
function schemaFindings(migrations, dialect) {
|
|
101
|
+
const out = [];
|
|
102
|
+
const byId = new Map(migrations.map((m) => [m.id, m]));
|
|
103
|
+
const reported = new Set();
|
|
104
|
+
for (const m of migrations) {
|
|
105
|
+
const doc = m.document;
|
|
106
|
+
const schema = doc.schema;
|
|
107
|
+
const recorded = doc.dialect;
|
|
108
|
+
if (recorded !== "clickhouse" && recorded !== "postgres") {
|
|
109
|
+
out.push({ rule: "directory", migration: m.id, message: `${m.id}/migration.json: dialect ${JSON.stringify(recorded)} is neither clickhouse nor postgres` });
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (dialect !== undefined && recorded !== dialect) {
|
|
113
|
+
out.push({ rule: "directory", migration: m.id, message: `${m.id} is a ${recorded} migration, but the project's dialect is ${dialect}` });
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (!Array.isArray(schema.objects) || schema.dialect !== recorded) {
|
|
117
|
+
out.push({ rule: "unreadable-object", migration: m.id, message: `${m.id}: its recorded schema is not a ${recorded} build output (a dialect and a list of objects)` });
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const parent = m.parent === null ? undefined : byId.get(m.parent)?.document.schema;
|
|
121
|
+
const before = parent && Array.isArray(parent.objects) && parent.dialect === schema.dialect ? parent : emptyBuild(schema);
|
|
122
|
+
const options = {
|
|
123
|
+
...(doc.defaultDatabase !== undefined ? { defaultDatabase: doc.defaultDatabase } : {}),
|
|
124
|
+
...(doc.defaultSchema !== undefined ? { defaultSchema: doc.defaultSchema } : {}),
|
|
125
|
+
};
|
|
126
|
+
try {
|
|
127
|
+
diffStatements(before, schema, options);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
catch (e) {
|
|
131
|
+
const bad = unreadableObjects(schema, options);
|
|
132
|
+
for (const o of bad) {
|
|
133
|
+
const key = `${o.export}\u0000${o.type}\u0000${o.ddl}`;
|
|
134
|
+
if (reported.has(key))
|
|
135
|
+
continue;
|
|
136
|
+
reported.add(key);
|
|
137
|
+
out.push({ rule: "unreadable-object", migration: m.id, object: o.export, message: `${o.export} (${o.type || "no type"}) in ${m.id}'s recorded schema: the sql lexicon cannot read it: ${o.error}` });
|
|
138
|
+
}
|
|
139
|
+
if (bad.length === 0)
|
|
140
|
+
out.push({ rule: "unreadable-object", migration: m.id, message: `${m.id}: the sql lexicon cannot read its recorded schema against its parent's: ${message(e)}` });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return out;
|
|
144
|
+
}
|
|
145
|
+
const stepName = (s) => (typeof s.name === "string" ? s.name : undefined);
|
|
146
|
+
/** Lints the migrations in `dir`. Never throws on what it finds; a finding is a result. */
|
|
147
|
+
export async function lintMigrations(dir, options = {}) {
|
|
148
|
+
const scan = scanMigrations(dir);
|
|
149
|
+
const extra = options.rules ?? [];
|
|
150
|
+
const rules = { ...LINT_RULES, ...Object.fromEntries(extra.map((r) => [r.rule.id, r.rule])) };
|
|
151
|
+
const dialect = options.dialect;
|
|
152
|
+
const raw = [...directoryFindings(scan.problems, options.history, scan.migrations), ...schemaFindings(scan.migrations, dialect)];
|
|
153
|
+
const silenceable = new Set(Object.values(rules).filter((r) => r.silenceable).map((r) => r.id));
|
|
154
|
+
const silences = {};
|
|
155
|
+
const used = new Set();
|
|
156
|
+
const statementRaw = [];
|
|
157
|
+
for (const m of scan.migrations) {
|
|
158
|
+
const d = m.document.dialect;
|
|
159
|
+
if (d !== "clickhouse" && d !== "postgres")
|
|
160
|
+
continue; // reported above
|
|
161
|
+
const steps = m.document.steps;
|
|
162
|
+
const map = mapMigrationSql(m.files.sql, steps, silenceable);
|
|
163
|
+
silences[m.id] = map.silences;
|
|
164
|
+
for (const p of map.problems)
|
|
165
|
+
raw.push({ rule: p.rule, migration: m.id, message: p.message, ...(p.step !== undefined ? { step: p.step } : {}), ...(p.line !== undefined ? { line: p.line } : {}) });
|
|
166
|
+
steps.forEach((step, i) => {
|
|
167
|
+
const name = stepName(step);
|
|
168
|
+
const where = { migration: m.id, step: i, ...(name !== undefined ? { object: name } : {}) };
|
|
169
|
+
const unreadable = unreadableStep(d, step);
|
|
170
|
+
if (unreadable) {
|
|
171
|
+
raw.push({ rule: "unreadable-object", ...where, message: `step ${String(i)}: ${unreadable}` });
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const refused = refusedStep(step);
|
|
175
|
+
if (refused)
|
|
176
|
+
raw.push({ rule: "refused-step", ...where, message: `step ${String(i)}: yodel apply refuses ${refused}` });
|
|
177
|
+
for (const f of stepFindings(d, step)) {
|
|
178
|
+
const rule = rules[f.rule];
|
|
179
|
+
if (rule?.dialect !== undefined && rule.dialect !== d)
|
|
180
|
+
continue;
|
|
181
|
+
const silence = map.silences.find((s) => s.step === i && s.rule === f.rule);
|
|
182
|
+
if (silence)
|
|
183
|
+
used.add(silence);
|
|
184
|
+
statementRaw.push({ rule: f.rule, ...where, message: `step ${String(i)}: ${f.message}`, ...(silence ? { silence } : {}) });
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
for (const s of map.silences) {
|
|
188
|
+
if (used.has(s))
|
|
189
|
+
continue;
|
|
190
|
+
raw.push({ rule: "silence", level: "warning", migration: m.id, step: s.step, line: s.line, message: `migration.sql line ${String(s.line)}: yodel:allow ${s.rule} silences nothing: step ${String(s.step)} breaks no ${s.rule} rule` });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
for (const r of extra) {
|
|
194
|
+
try {
|
|
195
|
+
raw.push(...(await r.check({ dir: scan.dir, scan, dialect, project: options.project })));
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
raw.push({ rule: r.rule.id, message: `${r.rule.id} could not run: ${message(e)}` });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const findings = [];
|
|
202
|
+
for (const f of [...raw, ...statementRaw]) {
|
|
203
|
+
const rule = rules[f.rule];
|
|
204
|
+
const setting = rule ? levelOf(rule, options.settings) : "error";
|
|
205
|
+
if (setting === "off")
|
|
206
|
+
continue;
|
|
207
|
+
const { silence, level, ...rest } = f;
|
|
208
|
+
findings.push({ ...rest, level: level ?? setting, ...(silence ? { silenced: silence.reason } : {}) });
|
|
209
|
+
}
|
|
210
|
+
findings.sort((a, b) => (a.migration ?? "").localeCompare(b.migration ?? "") ||
|
|
211
|
+
(a.step ?? -1) - (b.step ?? -1) ||
|
|
212
|
+
(a.line ?? 0) - (b.line ?? 0) ||
|
|
213
|
+
a.rule.localeCompare(b.rule));
|
|
214
|
+
const live = findings.filter((f) => f.silenced === undefined);
|
|
215
|
+
return {
|
|
216
|
+
dir: scan.dir,
|
|
217
|
+
dialect,
|
|
218
|
+
environment: options.history?.environment,
|
|
219
|
+
migrations: scan.migrations.map((m) => m.id),
|
|
220
|
+
findings,
|
|
221
|
+
silences,
|
|
222
|
+
errors: live.filter((f) => f.level === "error").length,
|
|
223
|
+
warnings: live.filter((f) => f.level === "warning").length,
|
|
224
|
+
silenced: findings.length - live.length,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/lint/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,cAAc,EAAsB,MAAM,mDAAmD,CAAC;AAGvG,OA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ACL,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,OAAO;QACP,WAAW,EAAE,OAAO,CAAC,OAAO,EAAE,WAAW;QACzC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5C,QAAQ;QACR,QAAQ;QACR,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,MAAM;QACtD,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,MAAM;QAC1D,QAAQ,EAAE,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM;KACxC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rule levels from `yodel.config.ts`:
|
|
3
|
+
*
|
|
4
|
+
* ```ts
|
|
5
|
+
* export default defineConfig({
|
|
6
|
+
* lint: { rules: { "ch-mutation": "warning", "pg-lock": "off" } },
|
|
7
|
+
* });
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* A level is `error` (fails the run), `warning` (reported, does not fail)
|
|
11
|
+
* or `off`. The integrity rules (`fork`, `directory`, `checksum`,
|
|
12
|
+
* `unreadable-object`) are always errors and cannot be set.
|
|
13
|
+
*/
|
|
14
|
+
import type { LevelSetting, LintRule } from "./rules.js";
|
|
15
|
+
export interface LintSettings {
|
|
16
|
+
levels: Record<string, LevelSetting>;
|
|
17
|
+
}
|
|
18
|
+
/** Checks `lint` from `yodel.config.ts` against the rules there are. `where` names the file in errors. */
|
|
19
|
+
export declare function lintSettings(raw: Record<string, unknown> | undefined, rules: Readonly<Record<string, LintRule>>, where?: string): LintSettings;
|
|
20
|
+
/** The level a rule runs at. */
|
|
21
|
+
export declare const levelOf: (rule: LintRule, settings: LintSettings | undefined) => LevelSetting;
|