@akal/supaforge 0.0.46 → 0.0.48
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 +21 -11
- package/dist/base-command.js +2 -2
- package/dist/{chunk-C32M67YH.js → chunk-3XQHSJOJ.js} +3 -3
- package/dist/{chunk-YE3RQLCR.js → chunk-AMG4PVQS.js} +24 -3
- package/dist/{chunk-XBXMOGI3.js → chunk-C7VBY54T.js} +179 -41
- package/dist/{chunk-PH2PU4NS.js → chunk-D3JEYV4M.js} +6 -6
- package/dist/{chunk-CKH6J7DI.js → chunk-EPGKCP3K.js} +8 -6
- package/dist/{chunk-AJ53RPJS.js → chunk-FKL3TQB7.js} +8 -8
- package/dist/{chunk-FFRGDQMV.js → chunk-HKG4KGDV.js} +2 -2
- package/dist/{chunk-HWRRFF55.js → chunk-HZ2FKMY3.js} +2 -2
- package/dist/{chunk-LV44B3BX.js → chunk-NCMERJNX.js} +2 -2
- package/dist/{chunk-AUNVMGTR.js → chunk-PSSMJRMM.js} +39 -15
- package/dist/{chunk-BLP7UO6C.js → chunk-RXPYUFJR.js} +6 -6
- package/dist/{chunk-YDISW5X7.js → chunk-S2GQI7ZO.js} +34 -21
- package/dist/{chunk-2ELJ46KR.js → chunk-VEXHBRNW.js} +7 -7
- package/dist/{chunk-RC7ZU7OV.js → chunk-W42J6U7R.js} +3 -1
- package/dist/{chunk-67JVGG3G.js → chunk-X4L3JT4R.js} +10 -7
- package/dist/{chunk-ZBQLDCYV.js → chunk-Z3SB66RS.js} +5 -5
- package/dist/commands/clone.js +5 -5
- package/dist/commands/diff.js +9 -9
- package/dist/commands/hukam.js +9 -9
- package/dist/commands/mcp.js +8 -8
- package/dist/commands/migrate/baseline.js +3 -3
- package/dist/commands/migrate/create.js +8 -8
- package/dist/commands/migrate/list.js +3 -3
- package/dist/commands/migrate/run.js +7 -7
- package/dist/commands/report.js +2 -2
- package/dist/commands/restore.js +8 -8
- package/dist/commands/snapshot.js +5 -5
- package/dist/commands/sync.js +9 -9
- package/dist/index.js +13 -13
- package/package.json +23 -3
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
RolesCheck,
|
|
5
5
|
applyTableFilter,
|
|
6
6
|
comparedSchemas,
|
|
7
|
+
dataScope,
|
|
7
8
|
destructiveReason,
|
|
8
9
|
isComparisonCheck,
|
|
9
10
|
parseStatements,
|
|
@@ -21,7 +22,7 @@ import {
|
|
|
21
22
|
sqlToIssues,
|
|
22
23
|
withPlatformExtensionCalls,
|
|
23
24
|
withoutAbsentRoles
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-C7VBY54T.js";
|
|
25
26
|
import {
|
|
26
27
|
RealtimeCheck,
|
|
27
28
|
createPolicySql,
|
|
@@ -33,10 +34,10 @@ import {
|
|
|
33
34
|
readJsonArray,
|
|
34
35
|
readJsonObject,
|
|
35
36
|
schemaPolicySql
|
|
36
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-X4L3JT4R.js";
|
|
37
38
|
import {
|
|
38
39
|
splitSqlStatements
|
|
39
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-AMG4PVQS.js";
|
|
40
41
|
import {
|
|
41
42
|
Check,
|
|
42
43
|
CheckSkipped,
|
|
@@ -51,7 +52,7 @@ import {
|
|
|
51
52
|
releaseSnapshots,
|
|
52
53
|
setSnapshotsOff,
|
|
53
54
|
sqlLiteral
|
|
54
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-W42J6U7R.js";
|
|
55
56
|
import {
|
|
56
57
|
DEFAULT_IGNORE_SCHEMAS,
|
|
57
58
|
SCORE_MAX,
|
|
@@ -418,7 +419,8 @@ var SchemaCheck = class extends Check {
|
|
|
418
419
|
let issues = sqlToIssues(result, "schema", ignoreSchemas, ignoredSchemaTables);
|
|
419
420
|
const moves = platformExtensionMoves(issues);
|
|
420
421
|
if (moves.length) {
|
|
421
|
-
|
|
422
|
+
const { owned, shadows } = await this.extensionFunctions(ctx.target.dbUrl, moves);
|
|
423
|
+
issues = withPlatformExtensionCalls(issues, moves, owned, shadows);
|
|
422
424
|
}
|
|
423
425
|
const roles = await this.targetRoles(ctx.target.dbUrl);
|
|
424
426
|
return roles?.size ? withoutAbsentRoles(issues, roles) : issues;
|
|
@@ -440,25 +442,39 @@ var SchemaCheck = class extends Check {
|
|
|
440
442
|
* DB error here never blocks the main schema diff.
|
|
441
443
|
*/
|
|
442
444
|
/**
|
|
443
|
-
* The functions each extension owns on the target,
|
|
444
|
-
*
|
|
445
|
+
* The functions each extension owns on the target, with how many arguments
|
|
446
|
+
* each takes, and the user's own functions of the same names in the schemas
|
|
447
|
+
* the source keeps those extensions in, which a call could mean instead.
|
|
448
|
+
* Unreadable, none: the calls are then left as the source wrote them.
|
|
445
449
|
*/
|
|
446
450
|
async extensionFunctions(dbUrl, moves) {
|
|
447
451
|
const owned = /* @__PURE__ */ new Map();
|
|
452
|
+
const shadows = [];
|
|
448
453
|
try {
|
|
449
|
-
const rows = await this.queryFn(dbUrl, `SELECT e.extname, p.proname
|
|
454
|
+
const rows = await this.queryFn(dbUrl, `SELECT e.extname, p.proname, p.pronargs, p.pronargdefaults, p.provariadic <> 0 AS variadic
|
|
450
455
|
FROM pg_depend d
|
|
451
456
|
JOIN pg_extension e ON e.oid = d.refobjid
|
|
452
457
|
JOIN pg_proc p ON p.oid = d.objid
|
|
453
458
|
WHERE d.classid = 'pg_proc'::regclass AND d.refclassid = 'pg_extension'::regclass
|
|
454
459
|
AND d.deptype = 'e' AND e.extname = ANY($1)`, [moves.map((m) => m.name)]);
|
|
455
|
-
for (const
|
|
456
|
-
|
|
457
|
-
owned.
|
|
460
|
+
for (const row of rows) {
|
|
461
|
+
const extname = String(row.extname);
|
|
462
|
+
if (!owned.has(extname)) owned.set(extname, []);
|
|
463
|
+
owned.get(extname).push(arity(row));
|
|
458
464
|
}
|
|
465
|
+
const names = [...new Set(rows.map((r) => String(r.proname)))];
|
|
466
|
+
const others = await this.queryFn(
|
|
467
|
+
dbUrl,
|
|
468
|
+
`SELECT n.nspname, p.proname, p.pronargs, p.pronargdefaults, p.provariadic <> 0 AS variadic
|
|
469
|
+
FROM pg_proc p JOIN pg_namespace n ON n.oid = p.pronamespace
|
|
470
|
+
WHERE n.nspname = ANY($1) AND p.proname = ANY($2)
|
|
471
|
+
AND NOT EXISTS (SELECT FROM pg_depend d WHERE d.classid = 'pg_proc'::regclass AND d.objid = p.oid AND d.deptype = 'e')`,
|
|
472
|
+
[[...new Set(moves.map((m) => m.sourceSchema))], names]
|
|
473
|
+
);
|
|
474
|
+
for (const row of others) shadows.push({ schema: String(row.nspname), ...arity(row) });
|
|
459
475
|
} catch {
|
|
460
476
|
}
|
|
461
|
-
return owned;
|
|
477
|
+
return { owned, shadows };
|
|
462
478
|
}
|
|
463
479
|
/** The target's roles, or undefined when they cannot be read. */
|
|
464
480
|
async targetRoles(dbUrl) {
|
|
@@ -487,6 +503,14 @@ var SchemaCheck = class extends Check {
|
|
|
487
503
|
}
|
|
488
504
|
}
|
|
489
505
|
};
|
|
506
|
+
function arity(row) {
|
|
507
|
+
const nargs = Number(row.pronargs ?? 0);
|
|
508
|
+
return {
|
|
509
|
+
name: String(row.proname),
|
|
510
|
+
minArgs: nargs - Number(row.pronargdefaults ?? 0),
|
|
511
|
+
maxArgs: row.variadic === true ? Infinity : nargs
|
|
512
|
+
};
|
|
513
|
+
}
|
|
490
514
|
|
|
491
515
|
// src/checks/rls.ts
|
|
492
516
|
var RlsCheck = class extends Check {
|
|
@@ -1827,7 +1851,7 @@ async function getTableFingerprint(dbUrl, table2, queryFn = pgQuery) {
|
|
|
1827
1851
|
coalesce(sum(('x' || substr(d, 1, 16))::bit(64)::bigint::numeric), 0)::text
|
|
1828
1852
|
|| ':' ||
|
|
1829
1853
|
coalesce(sum(('x' || substr(d, 17, 16))::bit(64)::bigint::numeric), 0)::text AS content
|
|
1830
|
-
FROM (SELECT md5(t::text) AS d FROM ${quoteIdent(table2)} t) s
|
|
1854
|
+
FROM (SELECT md5(ROW(t.*)::text) AS d FROM ${quoteIdent(table2)} t) s
|
|
1831
1855
|
`;
|
|
1832
1856
|
const [row] = await queryFn(dbUrl, sql);
|
|
1833
1857
|
return {
|
|
@@ -1896,7 +1920,7 @@ var DataCheck = class extends Check {
|
|
|
1896
1920
|
targetUrl: ctx.target.dbUrl,
|
|
1897
1921
|
type: "data",
|
|
1898
1922
|
include: "both",
|
|
1899
|
-
|
|
1923
|
+
...dataScope(changed, ctx.config.ignoreSchemas ?? DEFAULT_IGNORE_SCHEMAS),
|
|
1900
1924
|
timeoutSeconds: ctx.target?.checks?.schema?.timeout
|
|
1901
1925
|
});
|
|
1902
1926
|
return sqlToIssues(result, "data");
|
|
@@ -2444,4 +2468,4 @@ export {
|
|
|
2444
2468
|
createDefaultRegistry,
|
|
2445
2469
|
proveBeforeApply
|
|
2446
2470
|
};
|
|
2447
|
-
//# sourceMappingURL=chunk-
|
|
2471
|
+
//# sourceMappingURL=chunk-PSSMJRMM.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
migrationsDir,
|
|
3
3
|
writeMigrationFile
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Z3SB66RS.js";
|
|
5
5
|
import {
|
|
6
6
|
createDefaultRegistry,
|
|
7
7
|
proveBeforeApply,
|
|
8
8
|
scan
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PSSMJRMM.js";
|
|
10
10
|
import {
|
|
11
11
|
CHECK_NAMES,
|
|
12
12
|
promote
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-C7VBY54T.js";
|
|
14
14
|
import {
|
|
15
15
|
captureSnapshot,
|
|
16
16
|
unrestorableSchema
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-X4L3JT4R.js";
|
|
18
18
|
import {
|
|
19
19
|
checkConnection
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-W42J6U7R.js";
|
|
21
21
|
import {
|
|
22
22
|
describeFailure,
|
|
23
23
|
redactUrls,
|
|
@@ -530,4 +530,4 @@ export {
|
|
|
530
530
|
clearLastScanResult,
|
|
531
531
|
createServer
|
|
532
532
|
};
|
|
533
|
-
//# sourceMappingURL=chunk-
|
|
533
|
+
//# sourceMappingURL=chunk-RXPYUFJR.js.map
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
captureSnapshot
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-X4L3JT4R.js";
|
|
4
4
|
import {
|
|
5
5
|
checkPgDumpCompat,
|
|
6
|
+
pgToolConnection,
|
|
6
7
|
splitSqlStatements
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AMG4PVQS.js";
|
|
8
9
|
import {
|
|
9
10
|
newPgClient,
|
|
10
11
|
pgQuery,
|
|
11
12
|
quoteName
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-W42J6U7R.js";
|
|
13
14
|
import {
|
|
14
15
|
BRANCHES_FILE,
|
|
15
16
|
CLONE_PROGRESS_INTERVAL_MS,
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
|
|
20
21
|
// src/branch.ts
|
|
21
22
|
import { spawn } from "child_process";
|
|
22
|
-
import { readFile, writeFile as writeFile2, mkdir } from "fs/promises";
|
|
23
|
+
import { readFile, writeFile as writeFile2, mkdir, chmod } from "fs/promises";
|
|
23
24
|
import { resolve, dirname } from "path";
|
|
24
25
|
|
|
25
26
|
// src/stubs.ts
|
|
@@ -95,8 +96,15 @@ import { tmpdir } from "os";
|
|
|
95
96
|
import { join } from "path";
|
|
96
97
|
import { promisify } from "util";
|
|
97
98
|
var run = promisify(execFile);
|
|
98
|
-
function privilegeEntries(listing) {
|
|
99
|
-
|
|
99
|
+
function privilegeEntries(listing, excludeSchemas = []) {
|
|
100
|
+
const excluded = new Set(excludeSchemas);
|
|
101
|
+
return listing.split("\n").filter((line) => {
|
|
102
|
+
const m = /^\d+;\s+\d+\s+\d+\s+(?:DEFAULT\s+)?ACL\s+(\S+)\s+(.*)$/.exec(line);
|
|
103
|
+
if (!m) return false;
|
|
104
|
+
const [, schema, rest] = m;
|
|
105
|
+
const subject = schema === "-" ? /^SCHEMA\s+(\S+)/.exec(rest)?.[1] : schema;
|
|
106
|
+
return subject === void 0 || !excluded.has(subject);
|
|
107
|
+
});
|
|
100
108
|
}
|
|
101
109
|
function privilegeStatements(sql) {
|
|
102
110
|
const body = sql.split("\n").filter((line) => !line.startsWith("\\")).join("\n");
|
|
@@ -135,6 +143,7 @@ async function restorePrivileges(opts) {
|
|
|
135
143
|
try {
|
|
136
144
|
const archive = join(dir, "schema.dump");
|
|
137
145
|
const list = join(dir, "acl.list");
|
|
146
|
+
const remote = pgToolConnection(opts.remoteUrl);
|
|
138
147
|
await run(opts.pgDumpPath, [
|
|
139
148
|
"--format=custom",
|
|
140
149
|
"--schema-only",
|
|
@@ -142,10 +151,10 @@ async function restorePrivileges(opts) {
|
|
|
142
151
|
...(opts.excludeSchemas ?? []).map((s) => `--exclude-schema=${s}`),
|
|
143
152
|
"--file",
|
|
144
153
|
archive,
|
|
145
|
-
|
|
146
|
-
], { maxBuffer: 64 * 1024 * 1024 });
|
|
154
|
+
remote.url
|
|
155
|
+
], { maxBuffer: 64 * 1024 * 1024, env: remote.env });
|
|
147
156
|
const { stdout: listing } = await run(opts.pgRestorePath, ["--list", archive], { maxBuffer: 256 * 1024 * 1024 });
|
|
148
|
-
const entries = privilegeEntries(listing);
|
|
157
|
+
const entries = privilegeEntries(listing, opts.excludeSchemas);
|
|
149
158
|
if (entries.length === 0) return { granted: 0, notGranted: [], failures: [] };
|
|
150
159
|
await writeFile(list, entries.join("\n") + "\n");
|
|
151
160
|
const { stdout: sql } = await run(opts.pgRestorePath, ["--use-list", list, "--file", "-", archive], { maxBuffer: 256 * 1024 * 1024 });
|
|
@@ -201,8 +210,9 @@ async function loadManifest(cwd = process.cwd()) {
|
|
|
201
210
|
}
|
|
202
211
|
async function saveManifest(manifest, cwd) {
|
|
203
212
|
const p = await manifestPath(cwd);
|
|
204
|
-
await mkdir(dirname(p), { recursive: true });
|
|
205
|
-
await writeFile2(p, JSON.stringify(manifest, null, 2) + "\n");
|
|
213
|
+
await mkdir(dirname(p), { recursive: true, mode: 448 });
|
|
214
|
+
await writeFile2(p, JSON.stringify(manifest, null, 2) + "\n", { mode: 384 });
|
|
215
|
+
await chmod(p, 384);
|
|
206
216
|
}
|
|
207
217
|
async function createBranch(opts) {
|
|
208
218
|
const cwd = opts.cwd ?? process.cwd();
|
|
@@ -278,18 +288,19 @@ async function tryDumpRestore(sourceUrl, newDb, schemaOnly, pgDumpPath = "pg_dum
|
|
|
278
288
|
} finally {
|
|
279
289
|
await client.end();
|
|
280
290
|
}
|
|
281
|
-
const
|
|
291
|
+
const source = pgToolConnection(sourceUrl);
|
|
292
|
+
const dumpArgs = ["--format=custom", "--no-owner", source.url];
|
|
282
293
|
if (schemaOnly) dumpArgs.unshift("--schema-only");
|
|
283
|
-
const
|
|
294
|
+
const target = pgToolConnection(replaceDbName(sourceUrl, newDb));
|
|
284
295
|
const restoreArgs = [
|
|
285
296
|
"--format=custom",
|
|
286
297
|
"--no-owner",
|
|
287
|
-
`--dbname=${
|
|
298
|
+
`--dbname=${target.url}`
|
|
288
299
|
];
|
|
289
300
|
try {
|
|
290
301
|
await new Promise((resolve2, reject) => {
|
|
291
|
-
const dump = spawn(pgDumpPath, dumpArgs, { stdio: ["ignore", "pipe", "pipe"] });
|
|
292
|
-
const restore = spawn(pgRestorePath, restoreArgs, { stdio: [dump.stdout, "pipe", "pipe"] });
|
|
302
|
+
const dump = spawn(pgDumpPath, dumpArgs, { stdio: ["ignore", "pipe", "pipe"], env: source.env });
|
|
303
|
+
const restore = spawn(pgRestorePath, restoreArgs, { stdio: [dump.stdout, "pipe", "pipe"], env: target.env });
|
|
293
304
|
let restoreStderr = "";
|
|
294
305
|
restore.stderr?.on("data", (chunk) => {
|
|
295
306
|
restoreStderr += chunk.toString();
|
|
@@ -473,18 +484,20 @@ async function cloneRemoteToLocal(opts) {
|
|
|
473
484
|
dumpArgs.push(`--exclude-schema=${schema}`);
|
|
474
485
|
}
|
|
475
486
|
}
|
|
476
|
-
|
|
487
|
+
const remote = pgToolConnection(opts.remoteUrl);
|
|
488
|
+
const local = pgToolConnection(localDbUrl);
|
|
489
|
+
dumpArgs.push(remote.url);
|
|
477
490
|
const restoreArgs = [
|
|
478
491
|
"--format=custom",
|
|
479
492
|
"--no-owner",
|
|
480
493
|
"--no-acl",
|
|
481
|
-
`--dbname=${
|
|
494
|
+
`--dbname=${local.url}`
|
|
482
495
|
];
|
|
483
496
|
let restoreLog = "";
|
|
484
497
|
try {
|
|
485
498
|
restoreLog = await new Promise((resolve2, reject) => {
|
|
486
|
-
const dump = spawn(compat.pgDumpPath, dumpArgs, { stdio: ["ignore", "pipe", "pipe"] });
|
|
487
|
-
const restore = spawn(compat.pgRestorePath, restoreArgs, { stdio: ["pipe", "pipe", "pipe"] });
|
|
499
|
+
const dump = spawn(compat.pgDumpPath, dumpArgs, { stdio: ["ignore", "pipe", "pipe"], env: remote.env });
|
|
500
|
+
const restore = spawn(compat.pgRestorePath, restoreArgs, { stdio: ["pipe", "pipe", "pipe"], env: local.env });
|
|
488
501
|
let bytesTransferred = 0;
|
|
489
502
|
dump.stdout.on("data", (chunk) => {
|
|
490
503
|
bytesTransferred += chunk.length;
|
|
@@ -732,4 +745,4 @@ export {
|
|
|
732
745
|
isCloneDatabase,
|
|
733
746
|
sourceLooksLikeCloneOf
|
|
734
747
|
};
|
|
735
|
-
//# sourceMappingURL=chunk-
|
|
748
|
+
//# sourceMappingURL=chunk-S2GQI7ZO.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadMigrations
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3XQHSJOJ.js";
|
|
4
4
|
import {
|
|
5
5
|
ensureMigrationsTable,
|
|
6
6
|
getAppliedVersions
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HZ2FKMY3.js";
|
|
8
8
|
import {
|
|
9
9
|
ABSENT_ON_TARGET,
|
|
10
10
|
EXTENSION_UNAVAILABLE,
|
|
@@ -18,23 +18,23 @@ import {
|
|
|
18
18
|
rolesNamedBy,
|
|
19
19
|
sqlSkeleton,
|
|
20
20
|
statementSubject
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-C7VBY54T.js";
|
|
22
22
|
import {
|
|
23
23
|
loadSnapshot
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-X4L3JT4R.js";
|
|
25
25
|
import {
|
|
26
26
|
isCommentOnly,
|
|
27
27
|
isPsqlMetaCommand,
|
|
28
28
|
splitSqlStatements,
|
|
29
29
|
stripPsqlMetaCommands
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-AMG4PVQS.js";
|
|
31
31
|
import {
|
|
32
32
|
newPgClient,
|
|
33
33
|
pgQuery,
|
|
34
34
|
quoteIdent,
|
|
35
35
|
quoteLiteral,
|
|
36
36
|
quoteName
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-W42J6U7R.js";
|
|
38
38
|
import {
|
|
39
39
|
DEFAULT_IGNORE_SCHEMAS,
|
|
40
40
|
MIGRATIONS_TABLE,
|
|
@@ -900,4 +900,4 @@ export {
|
|
|
900
900
|
previewMigrationRestore,
|
|
901
901
|
summarizeStatement
|
|
902
902
|
};
|
|
903
|
-
//# sourceMappingURL=chunk-
|
|
903
|
+
//# sourceMappingURL=chunk-VEXHBRNW.js.map
|
|
@@ -39,11 +39,13 @@ function newPgClient(dbUrl, queryTimeoutMs) {
|
|
|
39
39
|
client.on("error", () => void 0);
|
|
40
40
|
return client;
|
|
41
41
|
}
|
|
42
|
+
var PINNED_OUTPUT = "SET extra_float_digits = 3; SET bytea_output = hex";
|
|
42
43
|
function newPgPool(config) {
|
|
43
44
|
const pool = new pg.Pool(config);
|
|
44
45
|
pool.on("error", () => void 0);
|
|
45
46
|
pool.on("connect", (client) => {
|
|
46
47
|
client.on("error", () => void 0);
|
|
48
|
+
client.query(PINNED_OUTPUT).catch(() => void 0);
|
|
47
49
|
});
|
|
48
50
|
return pool;
|
|
49
51
|
}
|
|
@@ -627,4 +629,4 @@ export {
|
|
|
627
629
|
MigrationsCheck,
|
|
628
630
|
readLocalMigrations
|
|
629
631
|
};
|
|
630
|
-
//# sourceMappingURL=chunk-
|
|
632
|
+
//# sourceMappingURL=chunk-W42J6U7R.js.map
|
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
describeMissingPgDump,
|
|
4
4
|
getServerMajorVersion,
|
|
5
5
|
normalizeRoles,
|
|
6
|
+
pgToolConnection,
|
|
6
7
|
resolvePgDumpPath
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AMG4PVQS.js";
|
|
8
9
|
import {
|
|
9
10
|
Check,
|
|
10
11
|
inRolledBackTransaction,
|
|
@@ -15,7 +16,7 @@ import {
|
|
|
15
16
|
quoteLiteral,
|
|
16
17
|
quoteName,
|
|
17
18
|
readOrAbsent
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-W42J6U7R.js";
|
|
19
20
|
import {
|
|
20
21
|
DEFAULT_IGNORE_SCHEMAS,
|
|
21
22
|
MIGRATIONS_SUBDIR,
|
|
@@ -31,7 +32,7 @@ import {
|
|
|
31
32
|
} from "./chunk-SQ52YBKK.js";
|
|
32
33
|
|
|
33
34
|
// src/snapshot.ts
|
|
34
|
-
import { mkdir, writeFile, readFile, readdir, rm } from "fs/promises";
|
|
35
|
+
import { mkdir, writeFile, readFile, readdir, rm, chmod } from "fs/promises";
|
|
35
36
|
import { join, resolve } from "path";
|
|
36
37
|
import { execFile as execFileCb } from "child_process";
|
|
37
38
|
import { promisify } from "util";
|
|
@@ -604,7 +605,8 @@ async function captureSnapshot(options) {
|
|
|
604
605
|
const cwd = options.cwd ?? process.cwd();
|
|
605
606
|
const timestamp = generateTimestamp();
|
|
606
607
|
const dir = options.outputDir ? join(resolve(options.outputDir), timestamp) : snapshotDir(cwd, timestamp);
|
|
607
|
-
await mkdir(dir, { recursive: true });
|
|
608
|
+
await mkdir(dir, { recursive: true, mode: 448 });
|
|
609
|
+
await chmod(dir, 448);
|
|
608
610
|
const queryFn = options.queryFn ?? pgQuery;
|
|
609
611
|
const fetchFn = options.fetchFn ?? globalThis.fetch.bind(globalThis);
|
|
610
612
|
const ignoreSchemas = options.config.ignoreSchemas ?? DEFAULT_IGNORE_SCHEMAS;
|
|
@@ -704,14 +706,15 @@ async function captureSchemaSql(dir, dbUrl, schemas) {
|
|
|
704
706
|
sqlSkipReason: `${await describeMissingPgDump(serverMajor)} \u2014 schema.json was still captured, but restore cannot replay the schema`
|
|
705
707
|
};
|
|
706
708
|
}
|
|
709
|
+
const conn = pgToolConnection(dbUrl);
|
|
707
710
|
const { stdout } = await execFile(resolved.path, [
|
|
708
|
-
|
|
711
|
+
conn.url,
|
|
709
712
|
"--schema-only",
|
|
710
713
|
"--no-owner",
|
|
711
714
|
"--no-privileges",
|
|
712
715
|
// Quoted: pg_dump reads --schema as a pattern, folding `App Data` to lower case.
|
|
713
716
|
...schemas.map((s) => `--schema=${quoteName(s)}`)
|
|
714
|
-
], { maxBuffer: 256 * 1024 * 1024, timeout: 3e5 });
|
|
717
|
+
], { maxBuffer: 256 * 1024 * 1024, timeout: 3e5, env: conn.env });
|
|
715
718
|
if (stdout.trim().length === 0) {
|
|
716
719
|
return { sqlSkipReason: "pg_dump produced an empty schema dump" };
|
|
717
720
|
}
|
|
@@ -1249,4 +1252,4 @@ export {
|
|
|
1249
1252
|
DEFAULT_KEEP_COUNT,
|
|
1250
1253
|
pruneSnapshots
|
|
1251
1254
|
};
|
|
1252
|
-
//# sourceMappingURL=chunk-
|
|
1255
|
+
//# sourceMappingURL=chunk-X4L3JT4R.js.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
targetFingerprint,
|
|
3
3
|
writtenAgainstLine
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NCMERJNX.js";
|
|
5
5
|
import {
|
|
6
6
|
RolesCheck,
|
|
7
7
|
isDestructiveSql,
|
|
8
8
|
runDbDiff
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-C7VBY54T.js";
|
|
10
10
|
import {
|
|
11
11
|
slugify,
|
|
12
12
|
splitSqlStatements
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-AMG4PVQS.js";
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_MIGRATIONS_DIR,
|
|
16
16
|
pgQuery
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-W42J6U7R.js";
|
|
18
18
|
import {
|
|
19
19
|
DEFAULT_IGNORE_SCHEMAS
|
|
20
20
|
} from "./chunk-SQ52YBKK.js";
|
|
@@ -89,4 +89,4 @@ export {
|
|
|
89
89
|
writeMigrationFile,
|
|
90
90
|
generateTimestamp
|
|
91
91
|
};
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-Z3SB66RS.js.map
|
package/dist/commands/clone.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../chunk-RQCXGO37.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseCommand
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-EPGKCP3K.js";
|
|
7
7
|
import {
|
|
8
8
|
addBranchToManifest,
|
|
9
9
|
cloneRemoteToLocal,
|
|
@@ -13,21 +13,21 @@ import {
|
|
|
13
13
|
maintenanceUrl,
|
|
14
14
|
reconcileClones,
|
|
15
15
|
replaceDbName
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-S2GQI7ZO.js";
|
|
17
17
|
import {
|
|
18
18
|
captureSnapshot,
|
|
19
19
|
formatSnapshotLayers
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-X4L3JT4R.js";
|
|
21
21
|
import {
|
|
22
22
|
checkPgDumpCompat
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-AMG4PVQS.js";
|
|
24
24
|
import {
|
|
25
25
|
DEFAULT_LOCAL_PORT,
|
|
26
26
|
LOCAL_PG_PASSWORD,
|
|
27
27
|
LOCAL_PG_USER,
|
|
28
28
|
newPgClient,
|
|
29
29
|
startLocalPg
|
|
30
|
-
} from "../chunk-
|
|
30
|
+
} from "../chunk-W42J6U7R.js";
|
|
31
31
|
import "../chunk-KHXEES2M.js";
|
|
32
32
|
import {
|
|
33
33
|
CLONE_EXTRA_EXCLUDE_SCHEMAS,
|
package/dist/commands/diff.js
CHANGED
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
Diff,
|
|
3
3
|
inertApplyFlags,
|
|
4
4
|
rollbackHint
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-FKL3TQB7.js";
|
|
6
6
|
import "../chunk-Q43MN6NE.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-HKG4KGDV.js";
|
|
8
|
+
import "../chunk-PSSMJRMM.js";
|
|
9
|
+
import "../chunk-C7VBY54T.js";
|
|
10
10
|
import "../chunk-RQCXGO37.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-EPGKCP3K.js";
|
|
12
|
+
import "../chunk-S2GQI7ZO.js";
|
|
13
|
+
import "../chunk-X4L3JT4R.js";
|
|
14
|
+
import "../chunk-AMG4PVQS.js";
|
|
15
|
+
import "../chunk-W42J6U7R.js";
|
|
16
16
|
import "../chunk-KHXEES2M.js";
|
|
17
17
|
import "../chunk-SQ52YBKK.js";
|
|
18
18
|
export {
|
package/dist/commands/hukam.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Diff
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-FKL3TQB7.js";
|
|
4
4
|
import "../chunk-Q43MN6NE.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-HKG4KGDV.js";
|
|
6
|
+
import "../chunk-PSSMJRMM.js";
|
|
7
|
+
import "../chunk-C7VBY54T.js";
|
|
8
8
|
import "../chunk-RQCXGO37.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-EPGKCP3K.js";
|
|
10
|
+
import "../chunk-S2GQI7ZO.js";
|
|
11
|
+
import "../chunk-X4L3JT4R.js";
|
|
12
|
+
import "../chunk-AMG4PVQS.js";
|
|
13
|
+
import "../chunk-W42J6U7R.js";
|
|
14
14
|
import "../chunk-KHXEES2M.js";
|
|
15
15
|
import "../chunk-SQ52YBKK.js";
|
|
16
16
|
|
package/dist/commands/mcp.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServer
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-RXPYUFJR.js";
|
|
4
|
+
import "../chunk-Z3SB66RS.js";
|
|
5
|
+
import "../chunk-NCMERJNX.js";
|
|
6
|
+
import "../chunk-PSSMJRMM.js";
|
|
7
|
+
import "../chunk-C7VBY54T.js";
|
|
8
|
+
import "../chunk-X4L3JT4R.js";
|
|
9
|
+
import "../chunk-AMG4PVQS.js";
|
|
10
|
+
import "../chunk-W42J6U7R.js";
|
|
11
11
|
import {
|
|
12
12
|
installProcessGuard,
|
|
13
13
|
keepRunningOnStrayErrors
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
baselineMigrations
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-HZ2FKMY3.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseCommand
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
} from "../../chunk-EPGKCP3K.js";
|
|
7
|
+
import "../../chunk-W42J6U7R.js";
|
|
8
8
|
import "../../chunk-KHXEES2M.js";
|
|
9
9
|
import {
|
|
10
10
|
bold,
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
truncateSql
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-D3JEYV4M.js";
|
|
4
4
|
import {
|
|
5
5
|
generateTimestamp,
|
|
6
6
|
writeMigrationFile
|
|
7
|
-
} from "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
7
|
+
} from "../../chunk-Z3SB66RS.js";
|
|
8
|
+
import "../../chunk-NCMERJNX.js";
|
|
9
|
+
import "../../chunk-HZ2FKMY3.js";
|
|
10
|
+
import "../../chunk-C7VBY54T.js";
|
|
11
11
|
import {
|
|
12
12
|
BaseCommand
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-EPGKCP3K.js";
|
|
14
14
|
import {
|
|
15
15
|
slugify
|
|
16
|
-
} from "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
16
|
+
} from "../../chunk-AMG4PVQS.js";
|
|
17
|
+
import "../../chunk-W42J6U7R.js";
|
|
18
18
|
import "../../chunk-KHXEES2M.js";
|
|
19
19
|
import {
|
|
20
20
|
bold,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getAppliedVersions
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-HZ2FKMY3.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseCommand
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-EPGKCP3K.js";
|
|
7
7
|
import {
|
|
8
8
|
pgQuery,
|
|
9
9
|
readLocalMigrations
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-W42J6U7R.js";
|
|
11
11
|
import "../../chunk-KHXEES2M.js";
|
|
12
12
|
import {
|
|
13
13
|
bold,
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
MigrateRun,
|
|
3
3
|
findDestructiveStatements,
|
|
4
4
|
truncateSql
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
5
|
+
} from "../../chunk-D3JEYV4M.js";
|
|
6
|
+
import "../../chunk-NCMERJNX.js";
|
|
7
|
+
import "../../chunk-HZ2FKMY3.js";
|
|
8
|
+
import "../../chunk-C7VBY54T.js";
|
|
9
|
+
import "../../chunk-EPGKCP3K.js";
|
|
10
|
+
import "../../chunk-AMG4PVQS.js";
|
|
11
|
+
import "../../chunk-W42J6U7R.js";
|
|
12
12
|
import "../../chunk-KHXEES2M.js";
|
|
13
13
|
import "../../chunk-SQ52YBKK.js";
|
|
14
14
|
export {
|