@dads-framework/toolbox 0.4.0 → 0.5.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/README.md +50 -5
- package/bin/usage.js +13 -0
- package/dist/cli-db-commands.d.ts +43 -0
- package/dist/cli-db-commands.d.ts.map +1 -0
- package/dist/cli-db-commands.js +276 -0
- package/dist/cli-db-commands.js.map +1 -0
- package/dist/cli-db-loader.d.ts +82 -0
- package/dist/cli-db-loader.d.ts.map +1 -0
- package/dist/cli-db-loader.js +142 -0
- package/dist/cli-db-loader.js.map +1 -0
- package/dist/cli-migrate-commands.d.ts.map +1 -1
- package/dist/cli-migrate-commands.js +3 -1
- package/dist/cli-migrate-commands.js.map +1 -1
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/doctor/issue-catalog-enforcement.d.ts.map +1 -1
- package/dist/doctor/issue-catalog-enforcement.js +4 -0
- package/dist/doctor/issue-catalog-enforcement.js.map +1 -1
- package/dist/doctor/signals/its-not-you-its-my-boundaries/cross-domain-foreign-keys.d.ts +15 -0
- package/dist/doctor/signals/its-not-you-its-my-boundaries/cross-domain-foreign-keys.d.ts.map +1 -0
- package/dist/doctor/signals/its-not-you-its-my-boundaries/cross-domain-foreign-keys.js +188 -0
- package/dist/doctor/signals/its-not-you-its-my-boundaries/cross-domain-foreign-keys.js.map +1 -0
- package/dist/doctor/signals/registry/text-and-packages.d.ts.map +1 -1
- package/dist/doctor/signals/registry/text-and-packages.js +2 -0
- package/dist/doctor/signals/registry/text-and-packages.js.map +1 -1
- package/dist/migrate-v03.d.ts +1 -1
- package/dist/migrate-v03.d.ts.map +1 -1
- package/dist/resource-generators/domain-generator.d.ts.map +1 -1
- package/dist/resource-generators/domain-generator.js +51 -9
- package/dist/resource-generators/domain-generator.js.map +1 -1
- package/dist/starter-project/kit-starter.generated.d.ts.map +1 -1
- package/dist/starter-project/kit-starter.generated.js +16 -15
- package/dist/starter-project/kit-starter.generated.js.map +1 -1
- package/dist/toolbox.tsbuildinfo +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ commands, and the path to its README. Run `npx dad doctor explain enmeshment`
|
|
|
26
26
|
to see the explanation for that diagnostic.
|
|
27
27
|
|
|
28
28
|
To create a project that already includes the Toolbox, run
|
|
29
|
-
`npm create dads@0.
|
|
29
|
+
`npm create dads@0.5.0 my-app` with Node 24 and Docker Compose running.
|
|
30
30
|
|
|
31
31
|
Dads is the framework; its packages live under `@dads-framework/*`, and `dad`
|
|
32
32
|
is the executable this package exposes. `dad --help` (or `dad help`) prints the
|
|
@@ -50,7 +50,7 @@ Applies the same idempotent recipes as `create-dads`. `--existing` writes an
|
|
|
50
50
|
isolated project under `<path>/dads` beside an existing application,
|
|
51
51
|
`--dry-run` previews the owned files, and `--skip-install` leaves dependency
|
|
52
52
|
installation to another tool. Use `npm start` in the generated app to start
|
|
53
|
-
Docker, or use `npm create dads@0.
|
|
53
|
+
Docker, or use `npm create dads@0.5.0` to install and start a new app in
|
|
54
54
|
one step.
|
|
55
55
|
|
|
56
56
|
Generated projects include Git hooks, a shared CI shell job, and optional GitHub
|
|
@@ -64,9 +64,9 @@ Links `.cursor/skills`, `.claude/skills`, and `.codex/skills` at
|
|
|
64
64
|
`../.agents/skills` so every harness reads one skill library. Each harness is
|
|
65
65
|
reported as `created` or `correct`.
|
|
66
66
|
|
|
67
|
-
`dad migrate <0.3|0.4> [path] [--dry-run] [--include-migrations] [--json]`
|
|
67
|
+
`dad migrate <0.3|0.4|0.5> [path] [--dry-run] [--include-migrations] [--json]`
|
|
68
68
|
|
|
69
|
-
Rewrites a `0.1.x`, `0.2.x`, or `0.
|
|
69
|
+
Rewrites a `0.1.x`, `0.2.x`, `0.3.x`, or `0.4.x` workspace to the consolidated `0.3.0`, `0.4.0`, or `0.5.0` package
|
|
70
70
|
surface: updates every `package.json` (deduplicating merged packages and adding
|
|
71
71
|
any newly-optional peer providers the project already used), rewrites TypeScript,
|
|
72
72
|
JavaScript, CSS, and `tsconfig*.json` specifiers to their new subpaths, and
|
|
@@ -139,6 +139,13 @@ profile supplied says `strict` beside it.
|
|
|
139
139
|
The report exits `0`. Pass `--online` to enable network checks.
|
|
140
140
|
Unknown options are rejected.
|
|
141
141
|
|
|
142
|
+
Setting `"strictForeignKeys": true` in `dads.project.json` opts into the
|
|
143
|
+
`cross-domain-foreign-keys` Doctor signal (off by default). When enabled, domain
|
|
144
|
+
migrations under `domains/<domain>/**` that declare a SQL `REFERENCES` or
|
|
145
|
+
`node-pg-migrate` `references:` option targeting a table owned by another domain
|
|
146
|
+
are flagged and pointed to `@dads-framework/core/references`
|
|
147
|
+
(`declareCrossDomainReferences` and `checkCrossDomainReferences`).
|
|
148
|
+
|
|
142
149
|
`dad doctor [path] --gate|--update|--seed|--report|--file <path>|--base <ref>
|
|
143
150
|
[--today YYYY-MM-DD] [--reason <text>] [--key <key>] [--json]`
|
|
144
151
|
|
|
@@ -303,7 +310,11 @@ paths, custom roots, and a two-API example.
|
|
|
303
310
|
|
|
304
311
|
`dad add --help` lists the eleven commands for domains, endpoints, tables,
|
|
305
312
|
access, flags, email, pages, resources, workflows, integrations, and dependency
|
|
306
|
-
libraries.
|
|
313
|
+
libraries. `dad add domain <name>` scaffolds branded entity IDs with
|
|
314
|
+
`entityIdSchema` in `domains/<name>/contract/index.ts`, passes that ID schema
|
|
315
|
+
into `resource(..., { id })` in `domains/<name>/access/index.ts`, and threads
|
|
316
|
+
the branded ID through `domains/<name>/pure/`. In the starter, preview a domain
|
|
317
|
+
on the staff API with
|
|
307
318
|
`npx dad add domain inventory --api staff --dry-run --json`. The preview
|
|
308
319
|
lists the planned files and registration without editing the project.
|
|
309
320
|
[Generator guide](../../../docs/generators.md)
|
|
@@ -317,6 +328,34 @@ update workspace links and the lockfile. See the
|
|
|
317
328
|
[dependency library guide](../../../docs/dependency-libraries.md) for the
|
|
318
329
|
workflow from an owning repository to a consuming repository.
|
|
319
330
|
|
|
331
|
+
### Database
|
|
332
|
+
|
|
333
|
+
`dad db generate [--database-url <url>] [--out <dir>] [--metadata <path>] [--schema <name>] [--json]`
|
|
334
|
+
|
|
335
|
+
Introspects a PostgreSQL database and writes deterministic Drizzle table modules
|
|
336
|
+
via `@dads-framework/postgres/schema-generate`, resolved dynamically from the
|
|
337
|
+
target workspace so `@dads-framework/toolbox` carries no static dependency on
|
|
338
|
+
Postgres. Pass `--database-url` or set `DATABASE_URL`. `--schema` accepts a
|
|
339
|
+
schema name (or comma-separated list), `--out` overrides the output directory,
|
|
340
|
+
and `--metadata` loads an optional JSON table-metadata file.
|
|
341
|
+
|
|
342
|
+
`dad db check [--database-url <url>] [--out <dir>] [--metadata <path>] [--schema <name>] [--json]`
|
|
343
|
+
|
|
344
|
+
Runs the same introspection and compares generated table modules against what is
|
|
345
|
+
on disk. Exits `0` when every module matches and `1` when any file is missing or
|
|
346
|
+
drifted.
|
|
347
|
+
|
|
348
|
+
`dad db migrate [--database-url <url>] [--json]`
|
|
349
|
+
|
|
350
|
+
Applies pending database migrations for the current workspace through
|
|
351
|
+
`@dads-framework/postgres/migrations`.
|
|
352
|
+
|
|
353
|
+
`dad db status [--database-url <url>] [--json]`
|
|
354
|
+
|
|
355
|
+
Reports migration status (`current`, `node-pg-pending`, or `legacy-pending`)
|
|
356
|
+
together with applied, pending, and shipped migration counts from the database
|
|
357
|
+
journal. Run `dad db --help` for subcommand usage.
|
|
358
|
+
|
|
320
359
|
### Access schemas
|
|
321
360
|
|
|
322
361
|
`dad access import <schema.zed> [--out <path>] [--dry-run] [--json]`
|
|
@@ -404,6 +443,10 @@ reports `initialization` and `installed`. `add library` reports `result`.
|
|
|
404
443
|
`permissionChanges`, `requiresMigration`, and `summary`.
|
|
405
444
|
`access migrate` reports `id`, `slug`, `fromPath`, `toPath`, `outDir`,
|
|
406
445
|
`filePath`, `dryRun`, `written`, `requiresMigration`, `diff`, and `code`.
|
|
446
|
+
`db generate` reports `command`, `outputRoot`, `files`, and `tableCount`.
|
|
447
|
+
`db check` reports `ok`, `command`, `outputRoot`, `checkedCount`, `drifted`, and `missing`.
|
|
448
|
+
`db migrate` reports `command` and `events`.
|
|
449
|
+
`db status` reports `command`, `status`, `shippedCount`, `appliedCount`, `pendingCount`, `pending`, and `applied`.
|
|
407
450
|
`test:recommend` prints `changedScope`, `recommendation`, and `notApplicable`;
|
|
408
451
|
`verify` prints those plus `report`. A failure prints
|
|
409
452
|
`{"ok":false,"error":"<message>"}` on stderr and exits `1`; without `--json`
|
|
@@ -445,6 +488,8 @@ Errors, and when each happens:
|
|
|
445
488
|
| `access migrate requires a migration slug.` | `access migrate` with no slug |
|
|
446
489
|
| `access migrate requires --from <before>.` / `--to <after>.` | `access migrate` missing `--from` or `--to` |
|
|
447
490
|
| `Zed schema file not found: <path>.` / `Access schema file not found: <path>.` | `access` command with a missing schema file |
|
|
491
|
+
| `DATABASE_URL is required (pass --database-url <url> or set DATABASE_URL).` | `db` command without `--database-url` or `DATABASE_URL` |
|
|
492
|
+
| `@dads-framework/postgres is required for dad db commands. …` | `db` command in a workspace without Postgres installed |
|
|
448
493
|
| `npm install failed[: <detail>]` | Dependency installation failed |
|
|
449
494
|
|
|
450
495
|
The package requires Node.js 22 or newer.
|
package/bin/usage.js
CHANGED
|
@@ -11,7 +11,15 @@ const accessCommands = [
|
|
|
11
11
|
" access migrate <slug> --from <before> --to <after> [--out <dir>] [--dry-run] [--json]",
|
|
12
12
|
];
|
|
13
13
|
|
|
14
|
+
const dbCommands = [
|
|
15
|
+
" db generate [--database-url <url>] [--out <dir>] [--metadata <path>] [--schema <name>] [--json]",
|
|
16
|
+
" db check [--database-url <url>] [--out <dir>] [--metadata <path>] [--schema <name>] [--json]",
|
|
17
|
+
" db migrate [--database-url <url>] [--json]",
|
|
18
|
+
" db status [--database-url <url>] [--json]",
|
|
19
|
+
];
|
|
20
|
+
|
|
14
21
|
const accessSubcommands = new Set(["import", "tree", "diff", "migrate"]);
|
|
22
|
+
const dbSubcommands = new Set(["generate", "check", "migrate", "status"]);
|
|
15
23
|
|
|
16
24
|
export const usage = [
|
|
17
25
|
"Usage: dad <command>",
|
|
@@ -20,6 +28,8 @@ export const usage = [
|
|
|
20
28
|
" add --help",
|
|
21
29
|
...accessCommands,
|
|
22
30
|
" access --help",
|
|
31
|
+
...dbCommands,
|
|
32
|
+
" db --help",
|
|
23
33
|
" orient|explain <path> [--json]",
|
|
24
34
|
' inspect http-operation "<METHOD /path>" [--json]',
|
|
25
35
|
" check boundaries [--json]",
|
|
@@ -46,6 +56,7 @@ export const usage = [
|
|
|
46
56
|
|
|
47
57
|
const addUsage = ["Usage: dad add <generator>", ...addCommands].join("\n");
|
|
48
58
|
const accessUsage = ["Usage: dad access <subcommand>", ...accessCommands].join("\n");
|
|
59
|
+
const dbUsage = ["Usage: dad db <generate|check|migrate|status>", ...dbCommands].join("\n");
|
|
49
60
|
|
|
50
61
|
function isHelpFlag(argument) {
|
|
51
62
|
return argument === "--help" || argument === "-h";
|
|
@@ -57,5 +68,7 @@ export function helpFor(args) {
|
|
|
57
68
|
if (command === "add" && isHelpFlag(subject)) return addUsage;
|
|
58
69
|
if (command === "access" && isHelpFlag(subject)) return accessUsage;
|
|
59
70
|
if (command === "access" && accessSubcommands.has(subject) && isHelpFlag(detail)) return accessUsage;
|
|
71
|
+
if (command === "db" && isHelpFlag(subject)) return dbUsage;
|
|
72
|
+
if (command === "db" && dbSubcommands.has(subject) && isHelpFlag(detail)) return dbUsage;
|
|
60
73
|
return undefined;
|
|
61
74
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dad db` subcommands: `generate`, `check`, `migrate`, and `status`.
|
|
3
|
+
*
|
|
4
|
+
* Delegates Postgres introspection, Drizzle table generation, drift checking,
|
|
5
|
+
* and migration execution to `@dads-framework/postgres` loaded dynamically from
|
|
6
|
+
* the target workspace.
|
|
7
|
+
*/
|
|
8
|
+
import { type DbPostgresLoader } from "./cli-db-loader.js";
|
|
9
|
+
export type DbSubcommand = "generate" | "check" | "migrate" | "status";
|
|
10
|
+
type SchemaDbBase = {
|
|
11
|
+
readonly databaseUrl: string;
|
|
12
|
+
readonly outDir: string | undefined;
|
|
13
|
+
readonly metadataPath: string | undefined;
|
|
14
|
+
readonly schemas: readonly string[] | undefined;
|
|
15
|
+
readonly json: boolean;
|
|
16
|
+
};
|
|
17
|
+
type MigrationDbBase = {
|
|
18
|
+
readonly databaseUrl: string;
|
|
19
|
+
readonly json: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type ParsedDbArguments = ({
|
|
22
|
+
readonly command: "generate";
|
|
23
|
+
} & SchemaDbBase) | ({
|
|
24
|
+
readonly command: "check";
|
|
25
|
+
} & SchemaDbBase) | ({
|
|
26
|
+
readonly command: "migrate";
|
|
27
|
+
} & MigrationDbBase) | ({
|
|
28
|
+
readonly command: "status";
|
|
29
|
+
} & MigrationDbBase);
|
|
30
|
+
export type RunDbCommandOptions = {
|
|
31
|
+
readonly cwd?: string;
|
|
32
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
33
|
+
readonly loadAdapter?: DbPostgresLoader;
|
|
34
|
+
readonly stdout?: (text: string) => void;
|
|
35
|
+
};
|
|
36
|
+
/** Parses arguments after `dad db` and resolves the database connection string. */
|
|
37
|
+
export declare function parseDbArguments(args: readonly string[], env?: Readonly<Record<string, string | undefined>>): ParsedDbArguments;
|
|
38
|
+
/** Executes a `dad db` subcommand and returns the process exit code. */
|
|
39
|
+
export declare function runDbCommand(args: readonly string[], options?: RunDbCommandOptions): Promise<number>;
|
|
40
|
+
/** CLI entrypoint invoked by `dad db ...`. */
|
|
41
|
+
export declare function dbCommand(args: readonly string[]): Promise<number>;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=cli-db-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-db-commands.d.ts","sourceRoot":"","sources":["../src/cli-db-commands.ts"],"names":[],"mappings":"AAAA;;;;;;G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AM,KAAK,IAAI,CAAC;CAC1C,CAAC;AAoDF,mFAAmF;AACnF,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,GAC9D,iBAAiB,CAuBnB;AA+ND,wEAAwE;AACxE,wBAAsB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgB9G;AAED,8CAA8C;AAC9C,wBAAsB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAExE"}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dad db` subcommands: `generate`, `check`, `migrate`, and `status`.
|
|
3
|
+
*
|
|
4
|
+
* Delegates Postgres introspection, Drizzle table generation, drift checking,
|
|
5
|
+
* and migration execution to `@dads-framework/postgres` loaded dynamically from
|
|
6
|
+
* the target workspace.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
9
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
10
|
+
import { loadPostgresAdapter, } from "./cli-db-loader.js";
|
|
11
|
+
import { readOption } from "./cli-io.js";
|
|
12
|
+
import { isRecord, isString, isUnknownArray } from "./parse-guards.js";
|
|
13
|
+
const DB_SUBCOMMANDS = new Set(["generate", "check", "migrate", "status"]);
|
|
14
|
+
const SCHEMA_OPTIONS = new Set(["--database-url", "--out", "--metadata", "--schema"]);
|
|
15
|
+
const MIGRATION_OPTIONS = new Set(["--database-url"]);
|
|
16
|
+
function isDbSubcommand(value) {
|
|
17
|
+
return value !== undefined && DB_SUBCOMMANDS.has(value);
|
|
18
|
+
}
|
|
19
|
+
function assertAllowedOptions(args, allowedValueOptions) {
|
|
20
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
21
|
+
const token = args[index];
|
|
22
|
+
if (token === undefined || token === "--json")
|
|
23
|
+
continue;
|
|
24
|
+
if (allowedValueOptions.has(token)) {
|
|
25
|
+
index += 1;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (token.startsWith("-")) {
|
|
29
|
+
throw new Error(`Unknown option ${token}.`);
|
|
30
|
+
}
|
|
31
|
+
throw new Error(`Unexpected argument ${token}.`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function resolveDatabaseUrl(optionArgs, env) {
|
|
35
|
+
const fromFlag = readOption(optionArgs, "--database-url");
|
|
36
|
+
const raw = fromFlag ?? env["DATABASE_URL"];
|
|
37
|
+
if (raw === undefined || raw.trim().length === 0) {
|
|
38
|
+
throw new Error("DATABASE_URL is required (pass --database-url <url> or set DATABASE_URL).");
|
|
39
|
+
}
|
|
40
|
+
return raw.trim();
|
|
41
|
+
}
|
|
42
|
+
function parseSchemasOption(raw) {
|
|
43
|
+
if (raw === undefined)
|
|
44
|
+
return undefined;
|
|
45
|
+
const schemas = raw
|
|
46
|
+
.split(",")
|
|
47
|
+
.map((entry) => entry.trim())
|
|
48
|
+
.filter((entry) => entry.length > 0);
|
|
49
|
+
if (schemas.length === 0) {
|
|
50
|
+
throw new Error("--schema requires at least one non-empty schema name.");
|
|
51
|
+
}
|
|
52
|
+
return schemas;
|
|
53
|
+
}
|
|
54
|
+
/** Parses arguments after `dad db` and resolves the database connection string. */
|
|
55
|
+
export function parseDbArguments(args, env = process.env) {
|
|
56
|
+
const [subcommand, ...rest] = args;
|
|
57
|
+
if (!isDbSubcommand(subcommand)) {
|
|
58
|
+
throw new Error("Usage: dad db <generate|check|migrate|status> [--database-url <url>] [--json]");
|
|
59
|
+
}
|
|
60
|
+
const json = rest.includes("--json");
|
|
61
|
+
if (subcommand === "generate" || subcommand === "check") {
|
|
62
|
+
assertAllowedOptions(rest, SCHEMA_OPTIONS);
|
|
63
|
+
return {
|
|
64
|
+
command: subcommand,
|
|
65
|
+
databaseUrl: resolveDatabaseUrl(rest, env),
|
|
66
|
+
outDir: readOption(rest, "--out"),
|
|
67
|
+
metadataPath: readOption(rest, "--metadata"),
|
|
68
|
+
schemas: parseSchemasOption(readOption(rest, "--schema")),
|
|
69
|
+
json,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
assertAllowedOptions(rest, MIGRATION_OPTIONS);
|
|
73
|
+
return {
|
|
74
|
+
command: subcommand,
|
|
75
|
+
databaseUrl: resolveDatabaseUrl(rest, env),
|
|
76
|
+
json,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function parseRetiredColumns(value, metadataPath) {
|
|
80
|
+
if (!isRecord(value)) {
|
|
81
|
+
throw new Error(`Invalid retiredColumns in ${metadataPath}: expected an object mapping table names to string arrays.`);
|
|
82
|
+
}
|
|
83
|
+
const result = {};
|
|
84
|
+
for (const [key, columns] of Object.entries(value)) {
|
|
85
|
+
if (!isUnknownArray(columns) || !columns.every(isString)) {
|
|
86
|
+
throw new Error(`Invalid retiredColumns["${key}"] in ${metadataPath}: expected an array of column names.`);
|
|
87
|
+
}
|
|
88
|
+
result[key] = columns;
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
function loadTableMetadata(cwd, metadataPath) {
|
|
93
|
+
const absolutePath = resolve(cwd, metadataPath);
|
|
94
|
+
if (!existsSync(absolutePath)) {
|
|
95
|
+
throw new Error(`Table metadata file not found: ${absolutePath}.`);
|
|
96
|
+
}
|
|
97
|
+
const parsed = JSON.parse(readFileSync(absolutePath, "utf8"));
|
|
98
|
+
if (Array.isArray(parsed)) {
|
|
99
|
+
return { metadata: parsed, retiredColumns: undefined };
|
|
100
|
+
}
|
|
101
|
+
if (isRecord(parsed) && isUnknownArray(parsed["tables"])) {
|
|
102
|
+
const retired = parsed["retiredColumns"];
|
|
103
|
+
return {
|
|
104
|
+
metadata: parsed["tables"],
|
|
105
|
+
retiredColumns: retired === undefined ? undefined : parseRetiredColumns(retired, absolutePath),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
throw new Error(`Invalid table metadata file ${absolutePath}: expected a JSON array or { tables: [...] }.`);
|
|
109
|
+
}
|
|
110
|
+
function resolveOutputTargets(cwd, outDir) {
|
|
111
|
+
if (outDir === undefined) {
|
|
112
|
+
return { outputRoot: cwd, defaultOutputDir: undefined };
|
|
113
|
+
}
|
|
114
|
+
if (isAbsolute(outDir)) {
|
|
115
|
+
return { outputRoot: outDir, defaultOutputDir: undefined };
|
|
116
|
+
}
|
|
117
|
+
return { outputRoot: cwd, defaultOutputDir: outDir };
|
|
118
|
+
}
|
|
119
|
+
function buildIntrospectOptions(cwd, parsed, defaultOutputDir) {
|
|
120
|
+
const loadedMetadata = parsed.metadataPath === undefined ? undefined : loadTableMetadata(cwd, parsed.metadataPath);
|
|
121
|
+
return {
|
|
122
|
+
...(parsed.schemas === undefined ? {} : { schemas: parsed.schemas }),
|
|
123
|
+
...(defaultOutputDir === undefined ? {} : { defaultOutputDir }),
|
|
124
|
+
...(loadedMetadata === undefined ? {} : { metadata: loadedMetadata.metadata }),
|
|
125
|
+
...(loadedMetadata?.retiredColumns === undefined ? {} : { retiredColumns: loadedMetadata.retiredColumns }),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function selectMigrationWorkspace(cwd, adapter) {
|
|
129
|
+
const hasServerPackages = existsSync(join(cwd, "packages", "server"));
|
|
130
|
+
const hasDomains = existsSync(join(cwd, "domains"));
|
|
131
|
+
if (hasServerPackages && !hasDomains) {
|
|
132
|
+
return adapter.defaultMigrationWorkspace(cwd);
|
|
133
|
+
}
|
|
134
|
+
return adapter.applicationMigrationWorkspace(cwd);
|
|
135
|
+
}
|
|
136
|
+
function writeResult(stdout, payload, humanLines, json) {
|
|
137
|
+
stdout(json ? `${JSON.stringify(payload)}\n` : `${humanLines.join("\n")}\n`);
|
|
138
|
+
}
|
|
139
|
+
async function runGenerate(cwd, parsed, adapter, stdout) {
|
|
140
|
+
const { outputRoot, defaultOutputDir } = resolveOutputTargets(cwd, parsed.outDir);
|
|
141
|
+
const options = buildIntrospectOptions(cwd, parsed, defaultOutputDir);
|
|
142
|
+
const client = await adapter.connectPostgresClient(parsed.databaseUrl);
|
|
143
|
+
let files;
|
|
144
|
+
try {
|
|
145
|
+
files = await adapter.introspectAndGenerateTables(client, options);
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
await client.end();
|
|
149
|
+
}
|
|
150
|
+
const written = await adapter.writeGeneratedTableFiles(files, outputRoot);
|
|
151
|
+
const tableCount = files.reduce((sum, file) => sum + file.tables.length, 0);
|
|
152
|
+
const payload = {
|
|
153
|
+
ok: true,
|
|
154
|
+
command: "generate",
|
|
155
|
+
outputRoot,
|
|
156
|
+
files: written,
|
|
157
|
+
tableCount,
|
|
158
|
+
};
|
|
159
|
+
const humanLines = [
|
|
160
|
+
`Generated ${written.length} table file${written.length === 1 ? "" : "s"} (${tableCount} table${tableCount === 1 ? "" : "s"}).`,
|
|
161
|
+
...written.map((file) => ` ${file}`),
|
|
162
|
+
];
|
|
163
|
+
writeResult(stdout, payload, humanLines, parsed.json);
|
|
164
|
+
return 0;
|
|
165
|
+
}
|
|
166
|
+
function formatDriftHumanLines(report, fileCount) {
|
|
167
|
+
if (report.ok) {
|
|
168
|
+
return [`Database table modules are up to date (${fileCount} file${fileCount === 1 ? "" : "s"} checked).`];
|
|
169
|
+
}
|
|
170
|
+
const lines = ["Database table drift detected:"];
|
|
171
|
+
for (const missingFile of report.missing) {
|
|
172
|
+
lines.push(` missing: ${missingFile}`);
|
|
173
|
+
}
|
|
174
|
+
for (const entry of report.drifted) {
|
|
175
|
+
lines.push(` drifted: ${entry.outputFile}`);
|
|
176
|
+
}
|
|
177
|
+
lines.push("Run `dad db generate` to update generated table modules.");
|
|
178
|
+
return lines;
|
|
179
|
+
}
|
|
180
|
+
async function runCheck(cwd, parsed, adapter, stdout) {
|
|
181
|
+
const { outputRoot, defaultOutputDir } = resolveOutputTargets(cwd, parsed.outDir);
|
|
182
|
+
const options = buildIntrospectOptions(cwd, parsed, defaultOutputDir);
|
|
183
|
+
const client = await adapter.connectPostgresClient(parsed.databaseUrl);
|
|
184
|
+
let files;
|
|
185
|
+
try {
|
|
186
|
+
files = await adapter.introspectAndGenerateTables(client, options);
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
await client.end();
|
|
190
|
+
}
|
|
191
|
+
const report = await adapter.checkGeneratedTableFiles(files, outputRoot);
|
|
192
|
+
const payload = {
|
|
193
|
+
ok: report.ok,
|
|
194
|
+
command: "check",
|
|
195
|
+
outputRoot,
|
|
196
|
+
checkedCount: files.length,
|
|
197
|
+
drifted: report.drifted,
|
|
198
|
+
missing: report.missing,
|
|
199
|
+
};
|
|
200
|
+
writeResult(stdout, payload, formatDriftHumanLines(report, files.length), parsed.json);
|
|
201
|
+
return report.ok ? 0 : 1;
|
|
202
|
+
}
|
|
203
|
+
async function runDbMigrate(cwd, parsed, adapter, stdout) {
|
|
204
|
+
const workspace = selectMigrationWorkspace(cwd, adapter);
|
|
205
|
+
const events = [];
|
|
206
|
+
await adapter.runDatabaseMigrations({ databaseUrl: parsed.databaseUrl, workspace }, {
|
|
207
|
+
info(context, message) {
|
|
208
|
+
events.push({ context, message });
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
const payload = {
|
|
212
|
+
ok: true,
|
|
213
|
+
command: "migrate",
|
|
214
|
+
events,
|
|
215
|
+
};
|
|
216
|
+
const humanLines = events.length === 0 ? ["Database migrations complete."] : events.map((event) => event.message);
|
|
217
|
+
writeResult(stdout, payload, humanLines, parsed.json);
|
|
218
|
+
return 0;
|
|
219
|
+
}
|
|
220
|
+
async function runDbStatus(cwd, parsed, adapter, stdout) {
|
|
221
|
+
const workspace = selectMigrationWorkspace(cwd, adapter);
|
|
222
|
+
const status = await adapter.inspectNodePgMigrations({ databaseUrl: parsed.databaseUrl, workspace });
|
|
223
|
+
const shipped = await adapter.listShippedDatabaseMigrations(workspace);
|
|
224
|
+
const client = await adapter.connectPostgresClient(parsed.databaseUrl);
|
|
225
|
+
let applied;
|
|
226
|
+
try {
|
|
227
|
+
applied = await adapter.readAppliedNodePgJournal(client);
|
|
228
|
+
}
|
|
229
|
+
finally {
|
|
230
|
+
await client.end();
|
|
231
|
+
}
|
|
232
|
+
const appliedNames = new Set(applied.map((entry) => entry.journalName));
|
|
233
|
+
const pending = shipped.filter((entry) => !appliedNames.has(entry.journalName));
|
|
234
|
+
const payload = {
|
|
235
|
+
ok: true,
|
|
236
|
+
command: "status",
|
|
237
|
+
status,
|
|
238
|
+
shippedCount: shipped.length,
|
|
239
|
+
appliedCount: applied.length,
|
|
240
|
+
pendingCount: pending.length,
|
|
241
|
+
pending: pending.map((entry) => ({ journalName: entry.journalName, owner: entry.owner, file: entry.file })),
|
|
242
|
+
applied: applied.map((entry) => ({
|
|
243
|
+
journalName: entry.journalName,
|
|
244
|
+
ranAt: entry.ranAt.toISOString(),
|
|
245
|
+
sha256: entry.sha256,
|
|
246
|
+
})),
|
|
247
|
+
};
|
|
248
|
+
const humanLines = [
|
|
249
|
+
`Migration status: ${status} (${applied.length} applied, ${pending.length} pending, ${shipped.length} shipped)`,
|
|
250
|
+
...pending.map((entry) => ` pending: ${entry.journalName} (${entry.file})`),
|
|
251
|
+
];
|
|
252
|
+
writeResult(stdout, payload, humanLines, parsed.json);
|
|
253
|
+
return 0;
|
|
254
|
+
}
|
|
255
|
+
/** Executes a `dad db` subcommand and returns the process exit code. */
|
|
256
|
+
export async function runDbCommand(args, options = {}) {
|
|
257
|
+
const cwd = options.cwd ?? process.cwd();
|
|
258
|
+
const env = options.env ?? process.env;
|
|
259
|
+
const stdout = options.stdout ?? ((text) => process.stdout.write(text));
|
|
260
|
+
const parsed = parseDbArguments(args, env);
|
|
261
|
+
const adapter = await (options.loadAdapter ?? loadPostgresAdapter)(cwd);
|
|
262
|
+
if (parsed.command === "generate" || parsed.command === "check") {
|
|
263
|
+
return parsed.command === "generate"
|
|
264
|
+
? runGenerate(cwd, parsed, adapter, stdout)
|
|
265
|
+
: runCheck(cwd, parsed, adapter, stdout);
|
|
266
|
+
}
|
|
267
|
+
if (parsed.command === "migrate") {
|
|
268
|
+
return runDbMigrate(cwd, parsed, adapter, stdout);
|
|
269
|
+
}
|
|
270
|
+
return runDbStatus(cwd, parsed, adapter, stdout);
|
|
271
|
+
}
|
|
272
|
+
/** CLI entrypoint invoked by `dad db ...`. */
|
|
273
|
+
export async function dbCommand(args) {
|
|
274
|
+
return runDbCommand(args);
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=cli-db-commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-db-commands.js","sourceRoot":"","sources":["../src/cli-db-commands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,mBAAmB,GAMpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC3E,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;AACtF,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAwCtD,SAAS,cAAc,CAAC,KAAyB;IAC/C,OAAO,KAAK,KAAK,SAAS,IAAI,cAAc,CAAC,GAAG,CAA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,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC;YAC3C,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACnD,CAAC;AAED,8CAA8C;AAC9C,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAuB;IACrD,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamically resolves `@dads-framework/postgres` subpaths from the target
|
|
3
|
+
* workspace so `@dads-framework/toolbox` never takes a static dependency on the
|
|
4
|
+
* Postgres adapter.
|
|
5
|
+
*/
|
|
6
|
+
type UnknownCallable = (...args: readonly unknown[]) => unknown;
|
|
7
|
+
export type DbPostgresClient = {
|
|
8
|
+
readonly query: UnknownCallable;
|
|
9
|
+
end(): Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export type DbGeneratedTableSummary = {
|
|
12
|
+
readonly schema: string;
|
|
13
|
+
readonly table: string;
|
|
14
|
+
readonly exportSymbol: string;
|
|
15
|
+
readonly fingerprint: string;
|
|
16
|
+
};
|
|
17
|
+
export type DbGeneratedTableFile = {
|
|
18
|
+
readonly outputFile: string;
|
|
19
|
+
readonly content: string;
|
|
20
|
+
readonly tables: readonly DbGeneratedTableSummary[];
|
|
21
|
+
};
|
|
22
|
+
export type DbTableDriftEntry = {
|
|
23
|
+
readonly outputFile: string;
|
|
24
|
+
readonly expectedFingerprints: readonly string[];
|
|
25
|
+
readonly actualFingerprints: readonly string[];
|
|
26
|
+
};
|
|
27
|
+
export type DbTableDriftReport = {
|
|
28
|
+
readonly ok: boolean;
|
|
29
|
+
readonly drifted: readonly DbTableDriftEntry[];
|
|
30
|
+
readonly missing: readonly string[];
|
|
31
|
+
};
|
|
32
|
+
export type DbIntrospectOptions = {
|
|
33
|
+
readonly schemas?: readonly string[];
|
|
34
|
+
readonly metadata?: readonly unknown[];
|
|
35
|
+
readonly defaultOutputDir?: string;
|
|
36
|
+
readonly retiredColumns?: Readonly<Record<string, readonly string[]>>;
|
|
37
|
+
};
|
|
38
|
+
export type DbMigrationWorkspace = {
|
|
39
|
+
readonly root: string;
|
|
40
|
+
readonly sources: readonly unknown[];
|
|
41
|
+
readonly moduleAliases: Readonly<Record<string, string>>;
|
|
42
|
+
};
|
|
43
|
+
export type DbMigrationLog = {
|
|
44
|
+
info(context: object, message: string): void;
|
|
45
|
+
};
|
|
46
|
+
export type DbMigrationStatusKind = "current" | "node-pg-pending" | "legacy-pending";
|
|
47
|
+
export type DbShippedMigration = {
|
|
48
|
+
readonly journalName: string;
|
|
49
|
+
readonly owner: string;
|
|
50
|
+
readonly file: string;
|
|
51
|
+
readonly sha256: string;
|
|
52
|
+
};
|
|
53
|
+
export type DbAppliedMigration = {
|
|
54
|
+
readonly journalName: string;
|
|
55
|
+
readonly ranAt: Date;
|
|
56
|
+
readonly sha256: string | null;
|
|
57
|
+
};
|
|
58
|
+
export type DbPostgresAdapter = {
|
|
59
|
+
connectPostgresClient(databaseUrl: string): Promise<DbPostgresClient>;
|
|
60
|
+
introspectAndGenerateTables(client: DbPostgresClient, options?: DbIntrospectOptions): Promise<readonly DbGeneratedTableFile[]>;
|
|
61
|
+
writeGeneratedTableFiles(files: readonly DbGeneratedTableFile[], outputRoot: string): Promise<readonly string[]>;
|
|
62
|
+
checkGeneratedTableFiles(files: readonly DbGeneratedTableFile[], outputRoot: string): Promise<DbTableDriftReport>;
|
|
63
|
+
applicationMigrationWorkspace(root: string): DbMigrationWorkspace;
|
|
64
|
+
defaultMigrationWorkspace(root: string): DbMigrationWorkspace;
|
|
65
|
+
runDatabaseMigrations(input: {
|
|
66
|
+
readonly databaseUrl: string;
|
|
67
|
+
readonly workspace: DbMigrationWorkspace;
|
|
68
|
+
}, log: DbMigrationLog): Promise<void>;
|
|
69
|
+
inspectNodePgMigrations(input: {
|
|
70
|
+
readonly databaseUrl: string;
|
|
71
|
+
readonly workspace: DbMigrationWorkspace;
|
|
72
|
+
}): Promise<DbMigrationStatusKind>;
|
|
73
|
+
listShippedDatabaseMigrations(workspace: DbMigrationWorkspace): Promise<readonly DbShippedMigration[]>;
|
|
74
|
+
readAppliedNodePgJournal(client: DbPostgresClient): Promise<readonly DbAppliedMigration[]>;
|
|
75
|
+
};
|
|
76
|
+
export type DbPostgresLoader = (cwd: string) => Promise<DbPostgresAdapter>;
|
|
77
|
+
/** Resolves a `@dads-framework/postgres` specifier from `cwd`, falling back to a monorepo sibling checkout. */
|
|
78
|
+
export declare function resolvePostgresModulePath(cwd: string, subpath?: string, allowFallback?: boolean): string;
|
|
79
|
+
/** Dynamically loads the `@dads-framework/postgres` adapter modules from `cwd`. */
|
|
80
|
+
export declare function loadPostgresAdapter(cwd: string): Promise<DbPostgresAdapter>;
|
|
81
|
+
export {};
|
|
82
|
+
//# sourceMappingURL=cli-db-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-db-loader.d.ts","sourceRoot":"","sources":["../src/cli-db-loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,KAAK,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,SAAS,OAAO,EAAE,KAAK,OAAO,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,MA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