@rawsql-ts/ztd-cli 0.13.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 +21 -0
- package/README.md +178 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/commands/ddl.d.ts +7 -0
- package/dist/commands/ddl.js +118 -0
- package/dist/commands/ddl.js.map +1 -0
- package/dist/commands/diff.d.ts +10 -0
- package/dist/commands/diff.js +38 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/genConfigCommand.d.ts +2 -0
- package/dist/commands/genConfigCommand.js +36 -0
- package/dist/commands/genConfigCommand.js.map +1 -0
- package/dist/commands/genEntities.d.ts +6 -0
- package/dist/commands/genEntities.js +50 -0
- package/dist/commands/genEntities.js.map +1 -0
- package/dist/commands/init.d.ts +34 -0
- package/dist/commands/init.js +467 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/options.d.ts +9 -0
- package/dist/commands/options.js +48 -0
- package/dist/commands/options.js.map +1 -0
- package/dist/commands/pull.d.ts +10 -0
- package/dist/commands/pull.js +105 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/ztdConfig.d.ts +22 -0
- package/dist/commands/ztdConfig.js +190 -0
- package/dist/commands/ztdConfig.js.map +1 -0
- package/dist/commands/ztdConfigCommand.d.ts +5 -0
- package/dist/commands/ztdConfigCommand.js +146 -0
- package/dist/commands/ztdConfigCommand.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/agents.d.ts +1 -0
- package/dist/utils/agents.js +31 -0
- package/dist/utils/agents.js.map +1 -0
- package/dist/utils/collectSqlFiles.d.ts +9 -0
- package/dist/utils/collectSqlFiles.js +58 -0
- package/dist/utils/collectSqlFiles.js.map +1 -0
- package/dist/utils/connectionSummary.d.ts +3 -0
- package/dist/utils/connectionSummary.js +29 -0
- package/dist/utils/connectionSummary.js.map +1 -0
- package/dist/utils/dbConnection.d.ts +29 -0
- package/dist/utils/dbConnection.js +210 -0
- package/dist/utils/dbConnection.js.map +1 -0
- package/dist/utils/fs.d.ts +1 -0
- package/dist/utils/fs.js +12 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/normalizePulledSchema.d.ts +12 -0
- package/dist/utils/normalizePulledSchema.js +201 -0
- package/dist/utils/normalizePulledSchema.js.map +1 -0
- package/dist/utils/pgDump.d.ts +11 -0
- package/dist/utils/pgDump.js +55 -0
- package/dist/utils/pgDump.js.map +1 -0
- package/dist/utils/sqliteAffinity.d.ts +5 -0
- package/dist/utils/sqliteAffinity.js +39 -0
- package/dist/utils/sqliteAffinity.js.map +1 -0
- package/dist/utils/typeMapper.d.ts +4 -0
- package/dist/utils/typeMapper.js +76 -0
- package/dist/utils/typeMapper.js.map +1 -0
- package/dist/utils/ztdProjectConfig.d.ts +37 -0
- package/dist/utils/ztdProjectConfig.js +161 -0
- package/dist/utils/ztdProjectConfig.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runPgDump = runPgDump;
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
9
|
+
const connectionSummary_1 = require("./connectionSummary");
|
|
10
|
+
/**
|
|
11
|
+
* Wraps `pg_dump` in schema-only mode for the given connection URL and returns the captured DDL output.
|
|
12
|
+
*/
|
|
13
|
+
function runPgDump(options) {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f;
|
|
15
|
+
const executable = (_b = (_a = options.pgDumpPath) !== null && _a !== void 0 ? _a : process.env.PG_DUMP_PATH) !== null && _b !== void 0 ? _b : 'pg_dump';
|
|
16
|
+
const args = [
|
|
17
|
+
'--schema-only',
|
|
18
|
+
'--no-owner',
|
|
19
|
+
'--no-privileges',
|
|
20
|
+
...((_c = options.extraArgs) !== null && _c !== void 0 ? _c : []),
|
|
21
|
+
'--dbname',
|
|
22
|
+
options.url
|
|
23
|
+
];
|
|
24
|
+
const result = (0, node_child_process_1.spawnSync)(executable, args, {
|
|
25
|
+
encoding: 'utf8',
|
|
26
|
+
stdio: ['ignore', 'pipe', 'pipe']
|
|
27
|
+
});
|
|
28
|
+
const connectionNote = (0, connectionSummary_1.describeConnectionContext)(options.connectionContext);
|
|
29
|
+
const extraArgsNote = ((_d = options.extraArgs) === null || _d === void 0 ? void 0 : _d.length) ? ` (extra args: ${options.extraArgs.join(' ')})` : '';
|
|
30
|
+
if (result.error) {
|
|
31
|
+
const windowsHint = node_os_1.default.platform() === 'win32'
|
|
32
|
+
? ' On Windows, ensure "C:\\Program Files\\PostgreSQL\\<version>\\bin" is on PATH or use a shell where pg_dump is available.'
|
|
33
|
+
: '';
|
|
34
|
+
if (isExecutableMissing(result.error, (_e = result.stderr) === null || _e === void 0 ? void 0 : _e.toString())) {
|
|
35
|
+
throw new Error(`pg_dump executable not found (${executable}). Install PostgreSQL or pass --pg-dump-path to point at the binary.${windowsHint}`);
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`Failed to launch pg_dump (${executable})${connectionNote}: ${(_f = result.error.message) !== null && _f !== void 0 ? _f : 'Unknown error'}${extraArgsNote}`);
|
|
38
|
+
}
|
|
39
|
+
if (result.status !== 0 || !result.stdout) {
|
|
40
|
+
const stderr = result.stderr ? result.stderr.toString().trim() : 'Unknown error';
|
|
41
|
+
throw new Error(`pg_dump reported an error${connectionNote}: ${stderr}${extraArgsNote}`);
|
|
42
|
+
}
|
|
43
|
+
return result.stdout;
|
|
44
|
+
}
|
|
45
|
+
function isExecutableMissing(error, stderr) {
|
|
46
|
+
if (error.code === 'ENOENT') {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
if (!stderr) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
const normalized = stderr.toLowerCase();
|
|
53
|
+
return normalized.includes('not recognized') || normalized.includes('command not found');
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=pgDump.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pgDump.js","sourceRoot":"","sources":["../../src/utils/pgDump.ts"],"names":[],"mappings":";;;;;AAeA,8BA0CC;AAzDD,2DAA+C;AAC/C,sDAAyB;AAEzB,2DAAgE;AAShE;;GAEG;AACH,SAAgB,SAAS,CAAC,OAAsB;;IAC9C,MAAM,UAAU,GAAG,MAAA,MAAA,OAAO,CAAC,UAAU,mCAAI,OAAO,CAAC,GAAG,CAAC,YAAY,mCAAI,SAAS,CAAC;IAC/E,MAAM,IAAI,GAAG;QACX,eAAe;QACf,YAAY;QACZ,iBAAiB;QACjB,GAAG,CAAC,MAAA,OAAO,CAAC,SAAS,mCAAI,EAAE,CAAC;QAC5B,UAAU;QACV,OAAO,CAAC,GAAG;KACZ,CAAC;IAEF,MAAM,MAAM,GAAG,IAAA,8BAAS,EAAC,UAAU,EAAE,IAAI,EAAE;QACzC,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;KAClC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,IAAA,6CAAyB,EAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC5E,MAAM,aAAa,GAAG,CAAA,MAAA,OAAO,CAAC,SAAS,0CAAE,MAAM,EAAC,CAAC,CAAC,iBAAiB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAEvG,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,WAAW,GACf,iBAAE,CAAC,QAAQ,EAAE,KAAK,OAAO;YACvB,CAAC,CAAC,2HAA2H;YAC7H,CAAC,C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greSQL column types to SQLite affinities to keep fixtures compatible with sqlite-testkit.
|
|
4
|
+
*/
|
|
5
|
+
export declare function mapSqlTypeToAffinity(typeName?: string, context?: string): SqliteAffinity;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapSqlTypeToAffinity = mapSqlTypeToAffinity;
|
|
4
|
+
const shouldLogUnknownSqlTypes = process.env.RAWSQL_DDL_SILENT !== '1';
|
|
5
|
+
function warnUnknownSqlType(typeName, context) {
|
|
6
|
+
if (!shouldLogUnknownSqlTypes) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const subject = context !== null && context !== void 0 ? context : 'column';
|
|
10
|
+
console.warn(`[ztd ddl] Unknown SQL type for ${subject}: ${typeName !== null && typeName !== void 0 ? typeName : 'undefined'}. Defaulting to NUMERIC.`);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Maps PostgreSQL column types to SQLite affinities to keep fixtures compatible with sqlite-testkit.
|
|
14
|
+
*/
|
|
15
|
+
function mapSqlTypeToAffinity(typeName, context) {
|
|
16
|
+
if (!typeName) {
|
|
17
|
+
warnUnknownSqlType(typeName, context);
|
|
18
|
+
return 'NUMERIC';
|
|
19
|
+
}
|
|
20
|
+
const normalized = typeName.split('(')[0].trim().toUpperCase();
|
|
21
|
+
if (normalized === '' || normalized.includes('BLOB')) {
|
|
22
|
+
return 'BLOB';
|
|
23
|
+
}
|
|
24
|
+
if (normalized.includes('INT')) {
|
|
25
|
+
return 'INTEGER';
|
|
26
|
+
}
|
|
27
|
+
// Treat temporal types as TEXT so fixtures align with how pg-testkit exposes timestamps/dates.
|
|
28
|
+
if (normalized.includes('TIME') || normalized.includes('DATE')) {
|
|
29
|
+
return 'TEXT';
|
|
30
|
+
}
|
|
31
|
+
if (normalized.includes('CHAR') || normalized.includes('CLOB') || normalized.includes('TEXT')) {
|
|
32
|
+
return 'TEXT';
|
|
33
|
+
}
|
|
34
|
+
if (normalized.includes('REAL') || normalized.includes('DOUB') || normalized.includes('FLOA')) {
|
|
35
|
+
return 'REAL';
|
|
36
|
+
}
|
|
37
|
+
return 'NUMERIC';
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=sqliteAffinity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqliteAffinity.js","sourceRoot":"","sources":["../../src/utils/sqliteAffinity.ts"],"names":[],"mappings":";;AAgBA,oDA8BC;AA5CD,MAAM,wBAAwB,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,KAAK,GAAG,CAAC;AAEvE,SAAS,kBAAkB,CAAC,QAA4B,EAAE,OAAgB;IACxE,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAC9B,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,QAAQ,CAAC;IACpC,OAAO,CAAC,IAAI,CAAC,kCAAkC,OAAO,KAAK,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,WAAW,0BAA0B,CAAC,CAAC;AAChH,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,QAAiB,EAAE,OAAgB;IACtE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACtC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAE/D,IAAI,UAAU,KAAK,EAAE,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACrD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,+FAA+F;IAC/F,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9F,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9F,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapSqlTypeToTs = mapSqlTypeToTs;
|
|
4
|
+
const numericTypes = new Set([
|
|
5
|
+
'int',
|
|
6
|
+
'integer',
|
|
7
|
+
'smallint',
|
|
8
|
+
'bigint',
|
|
9
|
+
'real',
|
|
10
|
+
'double precision',
|
|
11
|
+
'float',
|
|
12
|
+
'serial',
|
|
13
|
+
'bigserial',
|
|
14
|
+
'smallserial'
|
|
15
|
+
]);
|
|
16
|
+
const arbitraryPrecisionTypes = new Set(['decimal', 'numeric']);
|
|
17
|
+
const stringTypes = new Set(['text', 'varchar', 'char', 'character varying', 'character', 'uuid', 'citext']);
|
|
18
|
+
const dateTypes = new Set(['date', 'timestamp', 'timestamp without time zone', 'timestamp with time zone', 'time', 'time without time zone', 'time with time zone', 'timestamptz']);
|
|
19
|
+
const shouldLogUnknownSqlTypes = process.env.RAWSQL_DDL_SILENT !== '1';
|
|
20
|
+
function warnUnknownSqlType(typeName, context) {
|
|
21
|
+
// Do nothing when logging is explicitly silenced in CI or tooling.
|
|
22
|
+
if (!shouldLogUnknownSqlTypes) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// Keep developers aware when the generator sees an unmapped SQL type.
|
|
26
|
+
const subject = context !== null && context !== void 0 ? context : 'column';
|
|
27
|
+
console.warn(`[ztd ddl] Unknown SQL type for ${subject}: ${typeName !== null && typeName !== void 0 ? typeName : 'undefined'}. Defaulting to unknown.`);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Maps PostgreSQL data types (basic numeric, string, temporal, JSON/binary types) to serializable TypeScript types, falling back to `unknown` when unmatched.
|
|
31
|
+
*/
|
|
32
|
+
function mapSqlTypeToTs(typeName, context) {
|
|
33
|
+
// Log when the AST omitted a type so callers can track down why type inference failed.
|
|
34
|
+
if (!typeName) {
|
|
35
|
+
warnUnknownSqlType(typeName, context);
|
|
36
|
+
return 'unknown';
|
|
37
|
+
}
|
|
38
|
+
// Drop trailing precision/length metadata (varchar(255), numeric(10,2), etc.) because TS cannot capture it.
|
|
39
|
+
const normalized = typeName.split('(')[0].trim().toLowerCase();
|
|
40
|
+
if (numericTypes.has(normalized)) {
|
|
41
|
+
return 'number';
|
|
42
|
+
}
|
|
43
|
+
if (arbitraryPrecisionTypes.has(normalized)) {
|
|
44
|
+
// Postgres decimal/numeric are arbitrary precision, so string preserves exactness when floating-point would lose it.
|
|
45
|
+
return 'string';
|
|
46
|
+
}
|
|
47
|
+
// Treat all date/time families as strings to keep the generated rows serializable.
|
|
48
|
+
if (normalized.includes('time') || dateTypes.has(normalized)) {
|
|
49
|
+
return 'string';
|
|
50
|
+
}
|
|
51
|
+
if (stringTypes.has(normalized) || normalized.includes('text')) {
|
|
52
|
+
return 'string';
|
|
53
|
+
}
|
|
54
|
+
if (normalized === 'boolean' || normalized === 'bool') {
|
|
55
|
+
return 'boolean';
|
|
56
|
+
}
|
|
57
|
+
if (normalized === 'json' || normalized === 'jsonb') {
|
|
58
|
+
// Use any so generated APIs stay friendly for JSON-heavy applications; narrowing can still be applied later.
|
|
59
|
+
return 'any';
|
|
60
|
+
}
|
|
61
|
+
if (normalized === 'bytea') {
|
|
62
|
+
// Prefer Uint8Array to avoid Node.js-only Buffer while still representing binary payloads.
|
|
63
|
+
return 'Uint8Array';
|
|
64
|
+
}
|
|
65
|
+
if (normalized === 'inet' || normalized === 'cidr' || normalized === 'macaddr') {
|
|
66
|
+
return 'string';
|
|
67
|
+
}
|
|
68
|
+
if (normalized.startsWith('interval')) {
|
|
69
|
+
// Interval strings cover day/hour/second variants, so keep them as text.
|
|
70
|
+
return 'string';
|
|
71
|
+
}
|
|
72
|
+
// Alert when an unfamiliar SQL type flows through so we can extend the mapper later.
|
|
73
|
+
warnUnknownSqlType(typeName, context);
|
|
74
|
+
return 'unknown';
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=typeMapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeMapper.js","sourceRoot":"","sources":["../../src/utils/typeMapper.ts"],"names":[],"mappings":";;AAqCA,wCAsDC;AA3FD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,KAAK;IACL,SAAS;IACT,UAAU;IACV,QAAQ;IACR,MAAM;IACN,kBAAkB;IAClB,OAAO;IACP,QAAQ;IACR,WAAW;IACX,aAAa;CACd,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;AAEhE,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE7G,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,EAAE,w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,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/D,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,UAAU,KAAK,MAAM,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;QACpD,6GAA6G;QAC7G,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;QAC3B,2FAA2F;QAC3F,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,IAAI,UAAU,KAAK,MAAM,IAAI,UAAU,KAAK,MAAM,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC/E,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,yEAAyE;QACzE,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,qFAAqF;IACrF,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtC,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface ZtdConnectionConfig {
|
|
2
|
+
url?: string;
|
|
3
|
+
host?: string;
|
|
4
|
+
port?: number;
|
|
5
|
+
user?: string;
|
|
6
|
+
password?: string;
|
|
7
|
+
database?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ZtdProjectConfig {
|
|
10
|
+
dialect: string;
|
|
11
|
+
ddlDir: string;
|
|
12
|
+
testsDir: string;
|
|
13
|
+
ddl: {
|
|
14
|
+
defaultSchema: string;
|
|
15
|
+
searchPath: string[];
|
|
16
|
+
};
|
|
17
|
+
connection?: ZtdConnectionConfig;
|
|
18
|
+
}
|
|
19
|
+
export declare const DEFAULT_ZTD_CONFIG: ZtdProjectConfig;
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the path to the project's ztd.config.json from a provided root.
|
|
22
|
+
* @param rootDir - Directory to start searching from (defaults to current working directory).
|
|
23
|
+
* @returns Absolute path to ztd.config.json.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveZtdConfigPath(rootDir?: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Loads the project configuration, merging against defaults when the file is missing or partially provided.
|
|
28
|
+
* @param rootDir - Directory containing the ztd.config.json file.
|
|
29
|
+
* @returns A fully-resolved ZtdProjectConfig instance.
|
|
30
|
+
*/
|
|
31
|
+
export declare function loadZtdProjectConfig(rootDir?: string): ZtdProjectConfig;
|
|
32
|
+
/**
|
|
33
|
+
* Persists the provided overrides on top of the existing project configuration.
|
|
34
|
+
* @param rootDir - Directory that hosts ztd.config.json.
|
|
35
|
+
* @param overrides - Partial configuration values to merge.
|
|
36
|
+
*/
|
|
37
|
+
export declare function writeZtdProjectConfig(rootDir: string, overrides?: Partial<ZtdProjectConfig>): void;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DEFAULT_ZTD_CONFIG = void 0;
|
|
7
|
+
exports.resolveZtdConfigPath = resolveZtdConfigPath;
|
|
8
|
+
exports.loadZtdProjectConfig = loadZtdProjectConfig;
|
|
9
|
+
exports.writeZtdProjectConfig = writeZtdProjectConfig;
|
|
10
|
+
const node_fs_1 = require("node:fs");
|
|
11
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
+
const CONFIG_NAME = 'ztd.config.json';
|
|
13
|
+
const DEFAULT_DDL_PROPERTIES = {
|
|
14
|
+
defaultSchema: 'public',
|
|
15
|
+
searchPath: ['public']
|
|
16
|
+
};
|
|
17
|
+
exports.DEFAULT_ZTD_CONFIG = {
|
|
18
|
+
dialect: 'postgres',
|
|
19
|
+
ddlDir: 'ztd/ddl',
|
|
20
|
+
testsDir: 'tests',
|
|
21
|
+
ddl: { ...DEFAULT_DDL_PROPERTIES }
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Resolves the path to the project's ztd.config.json from a provided root.
|
|
25
|
+
* @param rootDir - Directory to start searching from (defaults to current working directory).
|
|
26
|
+
* @returns Absolute path to ztd.config.json.
|
|
27
|
+
*/
|
|
28
|
+
function resolveZtdConfigPath(rootDir = process.cwd()) {
|
|
29
|
+
return node_path_1.default.join(rootDir, CONFIG_NAME);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Loads the project configuration, merging against defaults when the file is missing or partially provided.
|
|
33
|
+
* @param rootDir - Directory containing the ztd.config.json file.
|
|
34
|
+
* @returns A fully-resolved ZtdProjectConfig instance.
|
|
35
|
+
*/
|
|
36
|
+
function loadZtdProjectConfig(rootDir = process.cwd()) {
|
|
37
|
+
const filePath = resolveZtdConfigPath(rootDir);
|
|
38
|
+
if (!(0, node_fs_1.existsSync)(filePath)) {
|
|
39
|
+
return exports.DEFAULT_ZTD_CONFIG;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
// Merge on top of defaults so partial configs remain valid.
|
|
43
|
+
const raw = JSON.parse((0, node_fs_1.readFileSync)(filePath, 'utf8'));
|
|
44
|
+
const rawDdl = typeof raw.ddl === 'object' && raw.ddl !== null ? raw.ddl : undefined;
|
|
45
|
+
const rawConnection = typeof raw.connection === 'object' && raw.connection !== null ? raw.connection : undefined;
|
|
46
|
+
// Treat only non-empty ddl.searchPath arrays as explicit overrides.
|
|
47
|
+
const rawSearchPath = Array.isArray(rawDdl === null || rawDdl === void 0 ? void 0 : rawDdl.searchPath) ? rawDdl.searchPath : undefined;
|
|
48
|
+
// Detect override intent only when a non-empty searchPath array is provided.
|
|
49
|
+
let hasSearchPathOverrides = false;
|
|
50
|
+
if (rawSearchPath && rawSearchPath.length > 0) {
|
|
51
|
+
hasSearchPathOverrides = true;
|
|
52
|
+
}
|
|
53
|
+
let resolvedSearchPath = [...exports.DEFAULT_ZTD_CONFIG.ddl.searchPath];
|
|
54
|
+
if (hasSearchPathOverrides && rawSearchPath) {
|
|
55
|
+
resolvedSearchPath = rawSearchPath.filter((schema) => typeof schema === 'string' && schema.length > 0);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
dialect: typeof raw.dialect === 'string' ? raw.dialect : exports.DEFAULT_ZTD_CONFIG.dialect,
|
|
59
|
+
ddlDir: typeof raw.ddlDir === 'string' && raw.ddlDir.length ? raw.ddlDir : exports.DEFAULT_ZTD_CONFIG.ddlDir,
|
|
60
|
+
testsDir: typeof raw.testsDir === 'string' && raw.testsDir.length ? raw.testsDir : exports.DEFAULT_ZTD_CONFIG.testsDir,
|
|
61
|
+
ddl: {
|
|
62
|
+
defaultSchema: typeof (rawDdl === null || rawDdl === void 0 ? void 0 : rawDdl.defaultSchema) === 'string' && rawDdl.defaultSchema.length
|
|
63
|
+
? rawDdl.defaultSchema
|
|
64
|
+
: exports.DEFAULT_ZTD_CONFIG.ddl.defaultSchema,
|
|
65
|
+
searchPath: resolvedSearchPath
|
|
66
|
+
},
|
|
67
|
+
connection: normalizeConnectionConfig(rawConnection)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
throw new Error(`${CONFIG_NAME} is malformed: ${error instanceof Error ? error.message : String(error)}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Persists the provided overrides on top of the existing project configuration.
|
|
76
|
+
* @param rootDir - Directory that hosts ztd.config.json.
|
|
77
|
+
* @param overrides - Partial configuration values to merge.
|
|
78
|
+
*/
|
|
79
|
+
function writeZtdProjectConfig(rootDir, overrides = {}) {
|
|
80
|
+
var _a;
|
|
81
|
+
const baseConfig = loadZtdProjectConfig(rootDir);
|
|
82
|
+
const finalConfig = {
|
|
83
|
+
...baseConfig,
|
|
84
|
+
...overrides,
|
|
85
|
+
ddl: {
|
|
86
|
+
...baseConfig.ddl,
|
|
87
|
+
...((_a = overrides.ddl) !== null && _a !== void 0 ? _a : {})
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const resolvedConnection = mergeConnectionConfig(baseConfig.connection, overrides.connection);
|
|
91
|
+
if (resolvedConnection) {
|
|
92
|
+
finalConfig.connection = resolvedConnection;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
delete finalConfig.connection;
|
|
96
|
+
}
|
|
97
|
+
const serialized = `${JSON.stringify(finalConfig, null, 2)}\n`;
|
|
98
|
+
(0, node_fs_1.writeFileSync)(resolveZtdConfigPath(rootDir), serialized, 'utf8');
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Normalizes a raw connection object into the typed connection configuration.
|
|
102
|
+
* @param rawConnection - Value read from ztd.config.json that may describe a connection.
|
|
103
|
+
* @returns A typed connection config or undefined when the input is invalid.
|
|
104
|
+
*/
|
|
105
|
+
function normalizeConnectionConfig(rawConnection) {
|
|
106
|
+
if (typeof rawConnection !== 'object' || rawConnection === null) {
|
|
107
|
+
return undefined;
|
|
108
|
+
}
|
|
109
|
+
const rawRecord = rawConnection;
|
|
110
|
+
const connection = {};
|
|
111
|
+
const url = typeof rawRecord.url === 'string' ? rawRecord.url.trim() : undefined;
|
|
112
|
+
if (url) {
|
|
113
|
+
connection.url = url;
|
|
114
|
+
}
|
|
115
|
+
const host = typeof rawRecord.host === 'string' ? rawRecord.host.trim() : undefined;
|
|
116
|
+
if (host) {
|
|
117
|
+
connection.host = host;
|
|
118
|
+
}
|
|
119
|
+
const user = typeof rawRecord.user === 'string' ? rawRecord.user.trim() : undefined;
|
|
120
|
+
if (user) {
|
|
121
|
+
connection.user = user;
|
|
122
|
+
}
|
|
123
|
+
const password = typeof rawRecord.password === 'string' && rawRecord.password.length > 0 ? rawRecord.password : undefined;
|
|
124
|
+
if (password) {
|
|
125
|
+
connection.password = password;
|
|
126
|
+
}
|
|
127
|
+
const database = typeof rawRecord.database === 'string' ? rawRecord.database.trim() : undefined;
|
|
128
|
+
if (database) {
|
|
129
|
+
connection.database = database;
|
|
130
|
+
}
|
|
131
|
+
const portValue = rawRecord.port;
|
|
132
|
+
const port = typeof portValue === 'number'
|
|
133
|
+
? portValue
|
|
134
|
+
: typeof portValue === 'string'
|
|
135
|
+
? Number(portValue)
|
|
136
|
+
: undefined;
|
|
137
|
+
if (port && Number.isInteger(port) && port > 0) {
|
|
138
|
+
connection.port = port;
|
|
139
|
+
}
|
|
140
|
+
if (Object.keys(connection).length === 0) {
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
return connection;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Merges two connection config objects, preferring values from the overrides.
|
|
147
|
+
* @param base - Existing connection configuration.
|
|
148
|
+
* @param overrides - Incoming override values from CLI or other sources.
|
|
149
|
+
* @returns Combined configuration or undefined when nothing is specified.
|
|
150
|
+
*/
|
|
151
|
+
function mergeConnectionConfig(base, overrides) {
|
|
152
|
+
const merged = {
|
|
153
|
+
...(base !== null && base !== void 0 ? base : {}),
|
|
154
|
+
...(overrides !== null && overrides !== void 0 ? overrides : {})
|
|
155
|
+
};
|
|
156
|
+
if (Object.keys(merged).length === 0) {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
return merged;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=ztdProjectConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ztdProjectConfig.js","sourceRoot":"","sources":["../../src/utils/ztdProjectConfig.ts"],"names":[],"mappings":";;;;;;AA0CA,oDAEC;AAOD,oDA2CC;AAOD,sDAsBC;AA3HD,qCAAkE;AAClE,0DAA6B;AAsB7B,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAEtC,MAAM,sBAAsB,GAAG;IAC7B,aAAa,EAAE,QAAQ;IACvB,UAAU,EAAE,CAAC,QAAQ,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I,GAAG,OAAO,SAAS,KAAK,QAAQ;QACxC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,OAAO,SAAS,KAAK,QAAQ;YAC7B,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC;YACnB,CAAC,CAAC,SAAS,CAAC;IAChB,IAAI,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;QAC/C,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;IACzB,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;;GAKG;AACH,SAAS,qBAAqB,CAC5B,IAA0B,EAC1B,SAA+B;IAE/B,MAAM,MAAM,GAAwB;QAClC,GAAG,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;QACf,GAAG,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;KACrB,CAAC;IAEF,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rawsql-ts/ztd-cli",
|
|
3
|
+
"version": "0.13.0",
|
|
4
|
+
"description": "DB-agnostic scaffolding and DDL helpers for Zero Table Dependency projects",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ztd": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"rawsql-ts",
|
|
11
|
+
"ztd",
|
|
12
|
+
"cli",
|
|
13
|
+
"ddl",
|
|
14
|
+
"fixtures"
|
|
15
|
+
],
|
|
16
|
+
"author": "msugiura",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=20"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"chokidar": "^5.0.0",
|
|
23
|
+
"commander": "^12.0.0",
|
|
24
|
+
"diff": "^5.1.0",
|
|
25
|
+
"@rawsql-ts/testkit-core": "0.13.0",
|
|
26
|
+
"rawsql-ts": "0.13.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/diff": "^5.0.1",
|
|
30
|
+
"@types/node": "^22.13.10",
|
|
31
|
+
"typescript": "^5.8.2",
|
|
32
|
+
"vitest": "^4.0.7"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"AGENTS.md",
|
|
37
|
+
"README.md"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc -p tsconfig.json",
|
|
41
|
+
"test": "vitest run",
|
|
42
|
+
"lint": "eslint src --ext .ts",
|
|
43
|
+
"release": "npm run lint && npm run test && npm run build && npm pack --dry-run && npm publish --access public"
|
|
44
|
+
}
|
|
45
|
+
}
|