@marinoscar/platform-db 0.0.0-stage → 0.1.0-next.3
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/CHANGELOG.md +40 -0
- package/LICENSE +21 -0
- package/README.md +382 -2
- package/bin/platform.js +28 -0
- package/dist/baseline/deps.d.ts +32 -0
- package/dist/baseline/deps.d.ts.map +1 -0
- package/dist/baseline/deps.js +64 -0
- package/dist/baseline/deps.js.map +1 -0
- package/dist/baseline/errors.d.ts +34 -0
- package/dist/baseline/errors.d.ts.map +1 -0
- package/dist/baseline/errors.js +23 -0
- package/dist/baseline/errors.js.map +1 -0
- package/dist/baseline/fs.d.ts +9 -0
- package/dist/baseline/fs.d.ts.map +1 -0
- package/dist/baseline/fs.js +39 -0
- package/dist/baseline/fs.js.map +1 -0
- package/dist/baseline/index.d.ts +8 -0
- package/dist/baseline/index.d.ts.map +1 -0
- package/dist/baseline/index.js +24 -0
- package/dist/baseline/index.js.map +1 -0
- package/dist/baseline/mapping.d.ts +43 -0
- package/dist/baseline/mapping.d.ts.map +1 -0
- package/dist/baseline/mapping.js +80 -0
- package/dist/baseline/mapping.js.map +1 -0
- package/dist/baseline/normalise.d.ts +42 -0
- package/dist/baseline/normalise.d.ts.map +1 -0
- package/dist/baseline/normalise.js +133 -0
- package/dist/baseline/normalise.js.map +1 -0
- package/dist/baseline/plan.d.ts +66 -0
- package/dist/baseline/plan.d.ts.map +1 -0
- package/dist/baseline/plan.js +105 -0
- package/dist/baseline/plan.js.map +1 -0
- package/dist/baseline/report.d.ts +125 -0
- package/dist/baseline/report.d.ts.map +1 -0
- package/dist/baseline/report.js +85 -0
- package/dist/baseline/report.js.map +1 -0
- package/dist/baseline/run.d.ts +106 -0
- package/dist/baseline/run.d.ts.map +1 -0
- package/dist/baseline/run.js +339 -0
- package/dist/baseline/run.js.map +1 -0
- package/dist/bin/db-commands.d.ts +31 -0
- package/dist/bin/db-commands.d.ts.map +1 -0
- package/dist/bin/db-commands.js +276 -0
- package/dist/bin/db-commands.js.map +1 -0
- package/dist/bin/fs-io.d.ts +7 -0
- package/dist/bin/fs-io.d.ts.map +1 -0
- package/dist/bin/fs-io.js +45 -0
- package/dist/bin/fs-io.js.map +1 -0
- package/dist/bin/platform.d.ts +21 -0
- package/dist/bin/platform.d.ts.map +1 -0
- package/dist/bin/platform.js +99 -0
- package/dist/bin/platform.js.map +1 -0
- package/dist/compose/api.d.ts +84 -0
- package/dist/compose/api.d.ts.map +1 -0
- package/dist/compose/api.js +101 -0
- package/dist/compose/api.js.map +1 -0
- package/dist/compose/compose.d.ts +51 -0
- package/dist/compose/compose.d.ts.map +1 -0
- package/dist/compose/compose.js +177 -0
- package/dist/compose/compose.js.map +1 -0
- package/dist/compose/diff.d.ts +7 -0
- package/dist/compose/diff.d.ts.map +1 -0
- package/dist/compose/diff.js +68 -0
- package/dist/compose/diff.js.map +1 -0
- package/dist/compose/errors.d.ts +31 -0
- package/dist/compose/errors.d.ts.map +1 -0
- package/dist/compose/errors.js +35 -0
- package/dist/compose/errors.js.map +1 -0
- package/dist/compose/index.d.ts +3 -0
- package/dist/compose/index.d.ts.map +1 -0
- package/dist/compose/index.js +11 -0
- package/dist/compose/index.js.map +1 -0
- package/dist/compose/parse.d.ts +65 -0
- package/dist/compose/parse.d.ts.map +1 -0
- package/dist/compose/parse.js +122 -0
- package/dist/compose/parse.js.map +1 -0
- package/dist/drift/db-conformance.d.ts +49 -0
- package/dist/drift/db-conformance.d.ts.map +1 -0
- package/dist/drift/db-conformance.js +65 -0
- package/dist/drift/db-conformance.js.map +1 -0
- package/dist/drift/index.d.ts +5 -0
- package/dist/drift/index.d.ts.map +1 -0
- package/dist/drift/index.js +26 -0
- package/dist/drift/index.js.map +1 -0
- package/dist/drift/raw-sql-indexes.d.ts +106 -0
- package/dist/drift/raw-sql-indexes.d.ts.map +1 -0
- package/dist/drift/raw-sql-indexes.js +113 -0
- package/dist/drift/raw-sql-indexes.js.map +1 -0
- package/dist/drift/raw-sql-tripwire.d.ts +150 -0
- package/dist/drift/raw-sql-tripwire.d.ts.map +1 -0
- package/dist/drift/raw-sql-tripwire.js +394 -0
- package/dist/drift/raw-sql-tripwire.js.map +1 -0
- package/dist/drift/run.d.ts +128 -0
- package/dist/drift/run.d.ts.map +1 -0
- package/dist/drift/run.js +201 -0
- package/dist/drift/run.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/lock/hash.d.ts +13 -0
- package/dist/lock/hash.d.ts.map +1 -0
- package/dist/lock/hash.js +19 -0
- package/dist/lock/hash.js.map +1 -0
- package/dist/lock/index.d.ts +5 -0
- package/dist/lock/index.d.ts.map +1 -0
- package/dist/lock/index.js +20 -0
- package/dist/lock/index.js.map +1 -0
- package/dist/lock/lock.d.ts +117 -0
- package/dist/lock/lock.d.ts.map +1 -0
- package/dist/lock/lock.js +140 -0
- package/dist/lock/lock.js.map +1 -0
- package/dist/lock/manifest.d.ts +60 -0
- package/dist/lock/manifest.d.ts.map +1 -0
- package/dist/lock/manifest.js +95 -0
- package/dist/lock/manifest.js.map +1 -0
- package/dist/lock/semver.d.ts +10 -0
- package/dist/lock/semver.d.ts.map +1 -0
- package/dist/lock/semver.js +13 -0
- package/dist/lock/semver.js.map +1 -0
- package/dist/seed/index.d.ts +4 -0
- package/dist/seed/index.d.ts.map +1 -0
- package/dist/seed/index.js +10 -0
- package/dist/seed/index.js.map +1 -0
- package/dist/seed/input.d.ts +52 -0
- package/dist/seed/input.d.ts.map +1 -0
- package/dist/seed/input.js +77 -0
- package/dist/seed/input.js.map +1 -0
- package/dist/seed/seed-platform.d.ts +28 -0
- package/dist/seed/seed-platform.d.ts.map +1 -0
- package/dist/seed/seed-platform.js +133 -0
- package/dist/seed/seed-platform.js.map +1 -0
- package/dist/seed/types.d.ts +277 -0
- package/dist/seed/types.d.ts.map +1 -0
- package/dist/seed/types.js +5 -0
- package/dist/seed/types.js.map +1 -0
- package/dist/sync/apply.d.ts +29 -0
- package/dist/sync/apply.d.ts.map +1 -0
- package/dist/sync/apply.js +37 -0
- package/dist/sync/apply.js.map +1 -0
- package/dist/sync/check.d.ts +56 -0
- package/dist/sync/check.d.ts.map +1 -0
- package/dist/sync/check.js +108 -0
- package/dist/sync/check.js.map +1 -0
- package/dist/sync/errors.d.ts +31 -0
- package/dist/sync/errors.d.ts.map +1 -0
- package/dist/sync/errors.js +23 -0
- package/dist/sync/errors.js.map +1 -0
- package/dist/sync/index.d.ts +9 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +25 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/ledger.d.ts +65 -0
- package/dist/sync/ledger.d.ts.map +1 -0
- package/dist/sync/ledger.js +49 -0
- package/dist/sync/ledger.js.map +1 -0
- package/dist/sync/plan.d.ts +61 -0
- package/dist/sync/plan.d.ts.map +1 -0
- package/dist/sync/plan.js +79 -0
- package/dist/sync/plan.js.map +1 -0
- package/dist/sync/promote.d.ts +58 -0
- package/dist/sync/promote.d.ts.map +1 -0
- package/dist/sync/promote.js +93 -0
- package/dist/sync/promote.js.map +1 -0
- package/dist/sync/timestamps.d.ts +41 -0
- package/dist/sync/timestamps.d.ts.map +1 -0
- package/dist/sync/timestamps.js +68 -0
- package/dist/sync/timestamps.js.map +1 -0
- package/dist/sync/version.d.ts +28 -0
- package/dist/sync/version.d.ts.map +1 -0
- package/dist/sync/version.js +66 -0
- package/dist/sync/version.js.map +1 -0
- package/migrations/0001_initial/migration.sql +297 -0
- package/migrations/0002_add_personal_access_tokens/migration.sql +31 -0
- package/migrations/0003_add_credentials/migration.sql +20 -0
- package/migrations/0004_add_notification_deliveries/migration.sql +27 -0
- package/migrations/0005_drop_stale_uuid_defaults/migration.sql +35 -0
- package/migrations/0006_add_notifications/migration.sql +22 -0
- package/migrations/0007_add_push_subscriptions/migration.sql +25 -0
- package/migrations/0008_add_jobs/migration.sql +110 -0
- package/migrations/0009_add_worker_nodes/migration.sql +90 -0
- package/migrations/0010_add_database_backup_runs/migration.sql +104 -0
- package/migrations/0011_add_notification_broadcasts/migration.sql +57 -0
- package/migrations/0012_add_backup_run_job_link/migration.sql +87 -0
- package/migrations/0013_add_job_node_secrets/migration.sql +61 -0
- package/migrations/0014_add_backup_run_pg_dump_version/migration.sql +26 -0
- package/migrations/0015_add_job_claim_token/migration.sql +92 -0
- package/migrations/0016_add_ai_platform/migration.sql +108 -0
- package/migrations/0017_revoke_viewer_ai_use/migration.sql +32 -0
- package/migrations/0018_add_user_credentials/migration.sql +29 -0
- package/migrations/0019_add_device_session_credential_link/migration.sql +52 -0
- package/migrations/0020_add_worker_node_vitals/migration.sql +3 -0
- package/migrations/0021_add_job_trace_context/migration.sql +6 -0
- package/migrations/0022_add_retention_created_at_indexes/migration.sql +13 -0
- package/migrations/0023_add_organizations/migration.sql +142 -0
- package/migrations/0024_split_system_org_roles/migration.sql +131 -0
- package/migrations/manifest.json +240 -0
- package/package.json +75 -4
- package/raw-sql-indexes.json +49 -0
- package/schema/ai.prisma +387 -0
- package/schema/base.prisma +11 -0
- package/schema/credentials.prisma +108 -0
- package/schema/db-backup.prisma +376 -0
- package/schema/identity.prisma +407 -0
- package/schema/jobs.prisma +731 -0
- package/schema/notifications.prisma +610 -0
- package/schema/settings.prisma +35 -0
- package/schema/storage.prisma +57 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why `platform db baseline` refused or could not continue.
|
|
3
|
+
*
|
|
4
|
+
* - `THROUGH_UNKNOWN`: `--through` names no package migration.
|
|
5
|
+
* - `MAP_INVALID`: the `--map` file is not valid, or names a directory or entry that does not exist or is already matched.
|
|
6
|
+
* - `LEDGER_FAILED_ROW`: `_prisma_migrations` holds a failed or rolled-back row.
|
|
7
|
+
* - `LEDGER_ROW_MISSING`: a mapped directory has no finished row in `_prisma_migrations`.
|
|
8
|
+
* - `LEDGER_CHECKSUM_MISMATCH`: a mapped directory's file differs from the checksum the database recorded.
|
|
9
|
+
* - `DIFF_BLOCKING`: the live database differs from the package history in a statement no deviation declares.
|
|
10
|
+
* - `INDEX_MISSING`, `INDEX_DEFINITION_DIFFERS`: a raw-SQL index is missing or changed in the live database.
|
|
11
|
+
* - `LOCK_NOT_EMPTY`: `platform.lock` already has entries and `--force-remap` was not given.
|
|
12
|
+
* - `PLACEMENT_IMPOSSIBLE`: a migration to resolve cannot be named so that the history keeps package order.
|
|
13
|
+
* - `PACKAGE_FILE_MISMATCH`: a package file does not match its manifest hash.
|
|
14
|
+
* - `RESOLVE_FAILED`: `prisma migrate resolve --applied` failed.
|
|
15
|
+
* - `VERIFY_FAILED`: a check after the apply failed.
|
|
16
|
+
*
|
|
17
|
+
* @stability experimental
|
|
18
|
+
*/
|
|
19
|
+
export type BaselineErrorCode = 'THROUGH_UNKNOWN' | 'MAP_INVALID' | 'LEDGER_FAILED_ROW' | 'LEDGER_ROW_MISSING' | 'LEDGER_CHECKSUM_MISMATCH' | 'DIFF_BLOCKING' | 'INDEX_MISSING' | 'INDEX_DEFINITION_DIFFERS' | 'LOCK_NOT_EMPTY' | 'PLACEMENT_IMPOSSIBLE' | 'PACKAGE_FILE_MISMATCH' | 'RESOLVE_FAILED' | 'VERIFY_FAILED';
|
|
20
|
+
/**
|
|
21
|
+
* A refusal of `platform db baseline`, with a stable code.
|
|
22
|
+
*
|
|
23
|
+
* @stability experimental
|
|
24
|
+
*/
|
|
25
|
+
export declare class BaselineError extends Error {
|
|
26
|
+
/** The class of refusal. */
|
|
27
|
+
readonly code: BaselineErrorCode;
|
|
28
|
+
/**
|
|
29
|
+
* @param code - The class of refusal.
|
|
30
|
+
* @param message - What is wrong and how to fix it.
|
|
31
|
+
*/
|
|
32
|
+
constructor(code: BaselineErrorCode, message: string);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/baseline/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,iBAAiB,GACzB,iBAAiB,GACjB,aAAa,GACb,mBAAmB,GACnB,oBAAoB,GACpB,0BAA0B,GAC1B,eAAe,GACf,eAAe,GACf,0BAA0B,GAC1B,gBAAgB,GAChB,sBAAsB,GACtB,uBAAuB,GACvB,gBAAgB,GAChB,eAAe,CAAC;AAEpB;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IAEjC;;;OAGG;gBACS,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM;CAKrD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaselineError = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A refusal of `platform db baseline`, with a stable code.
|
|
6
|
+
*
|
|
7
|
+
* @stability experimental
|
|
8
|
+
*/
|
|
9
|
+
class BaselineError extends Error {
|
|
10
|
+
/** The class of refusal. */
|
|
11
|
+
code;
|
|
12
|
+
/**
|
|
13
|
+
* @param code - The class of refusal.
|
|
14
|
+
* @param message - What is wrong and how to fix it.
|
|
15
|
+
*/
|
|
16
|
+
constructor(code, message) {
|
|
17
|
+
super(`${code}: ${message}`);
|
|
18
|
+
this.name = 'BaselineError';
|
|
19
|
+
this.code = code;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.BaselineError = BaselineError;
|
|
23
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/baseline/errors.ts"],"names":[],"mappings":";;;AAiCA;;;;GAIG;AACH,MAAa,aAAc,SAAQ,KAAK;IACtC,4BAA4B;IACnB,IAAI,CAAoB;IAEjC;;;OAGG;IACH,YAAY,IAAuB,EAAE,OAAe;QAClD,KAAK,CAAC,GAAG,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAbD,sCAaC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Every directory name under `prisma/migrations` (sorted), whether or not it holds a `migration.sql`. */
|
|
2
|
+
export declare function listDirs(migrationsDir: string): string[];
|
|
3
|
+
/** Directory name to `migration.sql` bytes for every directory that has one. */
|
|
4
|
+
export declare function readLocalMigrations(migrationsDir: string): Map<string, Buffer>;
|
|
5
|
+
/** Creates `<migrationsDir>/<localDir>/migration.sql` with exactly `bytes`; refuses an existing directory. */
|
|
6
|
+
export declare function installMigration(migrationsDir: string, localDir: string, bytes: Uint8Array): void;
|
|
7
|
+
/** Removes a directory the baseline itself created (a failed resolve); nothing else is ever removed. */
|
|
8
|
+
export declare function removeInstalled(migrationsDir: string, localDir: string): void;
|
|
9
|
+
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/baseline/fs.ts"],"names":[],"mappings":"AAGA,0GAA0G;AAC1G,wBAAgB,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAMxD;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAO9E;AAED,8GAA8G;AAC9G,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,IAAI,CAKjG;AAED,wGAAwG;AACxG,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAE7E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listDirs = listDirs;
|
|
4
|
+
exports.readLocalMigrations = readLocalMigrations;
|
|
5
|
+
exports.installMigration = installMigration;
|
|
6
|
+
exports.removeInstalled = removeInstalled;
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
/** Every directory name under `prisma/migrations` (sorted), whether or not it holds a `migration.sql`. */
|
|
10
|
+
function listDirs(migrationsDir) {
|
|
11
|
+
if (!(0, node_fs_1.existsSync)(migrationsDir))
|
|
12
|
+
return [];
|
|
13
|
+
return (0, node_fs_1.readdirSync)(migrationsDir, { withFileTypes: true })
|
|
14
|
+
.filter((entry) => entry.isDirectory())
|
|
15
|
+
.map((entry) => entry.name)
|
|
16
|
+
.sort();
|
|
17
|
+
}
|
|
18
|
+
/** Directory name to `migration.sql` bytes for every directory that has one. */
|
|
19
|
+
function readLocalMigrations(migrationsDir) {
|
|
20
|
+
const out = new Map();
|
|
21
|
+
for (const dir of listDirs(migrationsDir)) {
|
|
22
|
+
const file = (0, node_path_1.join)(migrationsDir, dir, 'migration.sql');
|
|
23
|
+
if ((0, node_fs_1.existsSync)(file))
|
|
24
|
+
out.set(dir, (0, node_fs_1.readFileSync)(file));
|
|
25
|
+
}
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
/** Creates `<migrationsDir>/<localDir>/migration.sql` with exactly `bytes`; refuses an existing directory. */
|
|
29
|
+
function installMigration(migrationsDir, localDir, bytes) {
|
|
30
|
+
(0, node_fs_1.mkdirSync)(migrationsDir, { recursive: true });
|
|
31
|
+
const dir = (0, node_path_1.join)(migrationsDir, localDir);
|
|
32
|
+
(0, node_fs_1.mkdirSync)(dir); // throws EEXIST: the baseline never writes into an existing directory
|
|
33
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(dir, 'migration.sql'), bytes);
|
|
34
|
+
}
|
|
35
|
+
/** Removes a directory the baseline itself created (a failed resolve); nothing else is ever removed. */
|
|
36
|
+
function removeInstalled(migrationsDir, localDir) {
|
|
37
|
+
(0, node_fs_1.rmSync)((0, node_path_1.join)(migrationsDir, localDir), { recursive: true, force: true });
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/baseline/fs.ts"],"names":[],"mappings":";;AAIA,4BAMC;AAGD,kDAOC;AAGD,4CAKC;AAGD,0CAEC;AAjCD,qCAAkG;AAClG,yCAAiC;AAEjC,0GAA0G;AAC1G,SAAgB,QAAQ,CAAC,aAAqB;IAC5C,IAAI,CAAC,IAAA,oBAAU,EAAC,aAAa,CAAC;QAAE,OAAO,EAAE,CAAC;IAC1C,OAAO,IAAA,qBAAW,EAAC,aAAa,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;SACvD,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;SACtC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;SAC1B,IAAI,EAAE,CAAC;AACZ,CAAC;AAED,gFAAgF;AAChF,SAAgB,mBAAmB,CAAC,aAAqB;IACvD,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,GAAG,IAAA,gBAAI,EAAC,aAAa,EAAE,GAAG,EAAE,eAAe,CAAC,CAAC;QACvD,IAAI,IAAA,oBAAU,EAAC,IAAI,CAAC;YAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,IAAA,sBAAY,EAAC,IAAI,CAAC,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,8GAA8G;AAC9G,SAAgB,gBAAgB,CAAC,aAAqB,EAAE,QAAgB,EAAE,KAAiB;IACzF,IAAA,mBAAS,EAAC,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,MAAM,GAAG,GAAG,IAAA,gBAAI,EAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAC1C,IAAA,mBAAS,EAAC,GAAG,CAAC,CAAC,CAAC,sEAAsE;IACtF,IAAA,uBAAa,EAAC,IAAA,gBAAI,EAAC,GAAG,EAAE,eAAe,CAAC,EAAE,KAAK,CAAC,CAAC;AACnD,CAAC;AAED,wGAAwG;AACxG,SAAgB,eAAe,CAAC,aAAqB,EAAE,QAAgB;IACrE,IAAA,gBAAM,EAAC,IAAA,gBAAI,EAAC,aAAa,EAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { createBaselineDeps, type BaselineDepsOptions } from './deps.js';
|
|
2
|
+
export { BaselineError, type BaselineErrorCode } from './errors.js';
|
|
3
|
+
export { proposeMapping, type MatchKind, type MatchedMigration } from './mapping.js';
|
|
4
|
+
export { normaliseSql, normalisedSha256, normaliseStatement, splitStatements } from './normalise.js';
|
|
5
|
+
export { planBaseline, type PlannedAction, type PlannedEntry } from './plan.js';
|
|
6
|
+
export { isBaselineClean, renderReport, type BaselineDiff, type BaselineInstallItem, type BaselineLedgerState, type BaselineRefusal, type BaselineReport, type BaselineResolveItem, type BaselineVerification, } from './report.js';
|
|
7
|
+
export { readOperatorMap, resolveThrough, runBaseline, type BaselineDeps, type BaselineOptions, type PrismaResult, } from './run.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/baseline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EACL,eAAe,EACf,YAAY,EACZ,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,cAAc,EACd,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,YAAY,GAClB,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runBaseline = exports.resolveThrough = exports.readOperatorMap = exports.renderReport = exports.isBaselineClean = exports.planBaseline = exports.splitStatements = exports.normaliseStatement = exports.normalisedSha256 = exports.normaliseSql = exports.proposeMapping = exports.BaselineError = exports.createBaselineDeps = void 0;
|
|
4
|
+
var deps_js_1 = require("./deps.js");
|
|
5
|
+
Object.defineProperty(exports, "createBaselineDeps", { enumerable: true, get: function () { return deps_js_1.createBaselineDeps; } });
|
|
6
|
+
var errors_js_1 = require("./errors.js");
|
|
7
|
+
Object.defineProperty(exports, "BaselineError", { enumerable: true, get: function () { return errors_js_1.BaselineError; } });
|
|
8
|
+
var mapping_js_1 = require("./mapping.js");
|
|
9
|
+
Object.defineProperty(exports, "proposeMapping", { enumerable: true, get: function () { return mapping_js_1.proposeMapping; } });
|
|
10
|
+
var normalise_js_1 = require("./normalise.js");
|
|
11
|
+
Object.defineProperty(exports, "normaliseSql", { enumerable: true, get: function () { return normalise_js_1.normaliseSql; } });
|
|
12
|
+
Object.defineProperty(exports, "normalisedSha256", { enumerable: true, get: function () { return normalise_js_1.normalisedSha256; } });
|
|
13
|
+
Object.defineProperty(exports, "normaliseStatement", { enumerable: true, get: function () { return normalise_js_1.normaliseStatement; } });
|
|
14
|
+
Object.defineProperty(exports, "splitStatements", { enumerable: true, get: function () { return normalise_js_1.splitStatements; } });
|
|
15
|
+
var plan_js_1 = require("./plan.js");
|
|
16
|
+
Object.defineProperty(exports, "planBaseline", { enumerable: true, get: function () { return plan_js_1.planBaseline; } });
|
|
17
|
+
var report_js_1 = require("./report.js");
|
|
18
|
+
Object.defineProperty(exports, "isBaselineClean", { enumerable: true, get: function () { return report_js_1.isBaselineClean; } });
|
|
19
|
+
Object.defineProperty(exports, "renderReport", { enumerable: true, get: function () { return report_js_1.renderReport; } });
|
|
20
|
+
var run_js_1 = require("./run.js");
|
|
21
|
+
Object.defineProperty(exports, "readOperatorMap", { enumerable: true, get: function () { return run_js_1.readOperatorMap; } });
|
|
22
|
+
Object.defineProperty(exports, "resolveThrough", { enumerable: true, get: function () { return run_js_1.resolveThrough; } });
|
|
23
|
+
Object.defineProperty(exports, "runBaseline", { enumerable: true, get: function () { return run_js_1.runBaseline; } });
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/baseline/index.ts"],"names":[],"mappings":";;;AAAA,qCAAyE;AAAhE,6GAAA,kBAAkB,OAAA;AAC3B,yCAAoE;AAA3D,0GAAA,aAAa,OAAA;AACtB,2CAAqF;AAA5E,4GAAA,cAAc,OAAA;AACvB,+CAAqG;AAA5F,4GAAA,YAAY,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAAE,kHAAA,kBAAkB,OAAA;AAAE,+GAAA,eAAe,OAAA;AAC5E,qCAAgF;AAAvE,uGAAA,YAAY,OAAA;AACrB,yCAUqB;AATnB,4GAAA,eAAe,OAAA;AACf,yGAAA,YAAY,OAAA;AASd,mCAOkB;AANhB,yGAAA,eAAe,OAAA;AACf,wGAAA,cAAc,OAAA;AACd,qGAAA,WAAW,OAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ManifestEntry } from '../lock/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* How a package migration was matched to a local directory.
|
|
4
|
+
*
|
|
5
|
+
* - `sha256`: the bytes are identical (a directory rename is irrelevant).
|
|
6
|
+
* - `normalised`: identical once comments and whitespace are stripped; the lock records `localSha256`.
|
|
7
|
+
* - `operator-map`: named by the operator in `--map`; the lock records `localSha256` when the bytes differ.
|
|
8
|
+
*
|
|
9
|
+
* @stability experimental
|
|
10
|
+
*/
|
|
11
|
+
export type MatchKind = 'sha256' | 'normalised' | 'operator-map';
|
|
12
|
+
/**
|
|
13
|
+
* A package migration matched to an existing local directory.
|
|
14
|
+
*
|
|
15
|
+
* @stability experimental
|
|
16
|
+
*/
|
|
17
|
+
export interface MatchedMigration {
|
|
18
|
+
/** `platform:NNNN_slug`. */
|
|
19
|
+
originId: string;
|
|
20
|
+
/** The app's directory. */
|
|
21
|
+
localDir: string;
|
|
22
|
+
/** How it was matched; a reviewer checks every match that is not `sha256`. */
|
|
23
|
+
kind: MatchKind;
|
|
24
|
+
/** SHA-256 of the app's file, present when it differs from the package's. */
|
|
25
|
+
localSha256?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Proposes the mapping from package migrations to the app's directories (step B1).
|
|
29
|
+
*
|
|
30
|
+
* Per package migration, in order: an exact SHA-256 of `migration.sql`, then
|
|
31
|
+
* the same after stripping comments and whitespace, then the operator's
|
|
32
|
+
* `--map`. A directory matches at most one migration. Pure.
|
|
33
|
+
*
|
|
34
|
+
* @param manifest - The package history, in order.
|
|
35
|
+
* @param localDirs - Directory name to `migration.sql` bytes, for every directory of the app's `prisma/migrations`.
|
|
36
|
+
* @param packageFile - Reads the package's `migration.sql` for a manifest entry (the normalised pass compares against it).
|
|
37
|
+
* @param map - Operator overrides, `platform:NNNN_slug` (or `NNNN_slug`) to a local directory name. An override replaces the automatic match of its own entry; a directory that already matches another migration exactly is refused.
|
|
38
|
+
* @returns One entry per matched package migration, in package order.
|
|
39
|
+
* @throws BaselineError `MAP_INVALID` when `map` names an unknown entry or directory, or a directory that another migration already matched.
|
|
40
|
+
* @stability experimental
|
|
41
|
+
*/
|
|
42
|
+
export declare function proposeMapping(manifest: readonly ManifestEntry[], localDirs: ReadonlyMap<string, Uint8Array>, packageFile: (entry: ManifestEntry) => Uint8Array, map?: Readonly<Record<string, string>>): MatchedMigration[];
|
|
43
|
+
//# sourceMappingURL=mapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapping.d.ts","sourceRoot":"","sources":["../../src/baseline/mapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAI7E;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,YAAY,GAAG,cAAc,CAAC;AAEjE;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,IAAI,EAAE,SAAS,CAAC;IAChB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,SAAS,aAAa,EAAE,EAClC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EAC1C,WAAW,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,UAAU,EACjD,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,GACzC,gBAAgB,EAAE,CAsDpB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.proposeMapping = proposeMapping;
|
|
4
|
+
const index_js_1 = require("../lock/index.js");
|
|
5
|
+
const errors_js_1 = require("./errors.js");
|
|
6
|
+
const normalise_js_1 = require("./normalise.js");
|
|
7
|
+
/**
|
|
8
|
+
* Proposes the mapping from package migrations to the app's directories (step B1).
|
|
9
|
+
*
|
|
10
|
+
* Per package migration, in order: an exact SHA-256 of `migration.sql`, then
|
|
11
|
+
* the same after stripping comments and whitespace, then the operator's
|
|
12
|
+
* `--map`. A directory matches at most one migration. Pure.
|
|
13
|
+
*
|
|
14
|
+
* @param manifest - The package history, in order.
|
|
15
|
+
* @param localDirs - Directory name to `migration.sql` bytes, for every directory of the app's `prisma/migrations`.
|
|
16
|
+
* @param packageFile - Reads the package's `migration.sql` for a manifest entry (the normalised pass compares against it).
|
|
17
|
+
* @param map - Operator overrides, `platform:NNNN_slug` (or `NNNN_slug`) to a local directory name. An override replaces the automatic match of its own entry; a directory that already matches another migration exactly is refused.
|
|
18
|
+
* @returns One entry per matched package migration, in package order.
|
|
19
|
+
* @throws BaselineError `MAP_INVALID` when `map` names an unknown entry or directory, or a directory that another migration already matched.
|
|
20
|
+
* @stability experimental
|
|
21
|
+
*/
|
|
22
|
+
function proposeMapping(manifest, localDirs, packageFile, map = {}) {
|
|
23
|
+
const operator = new Map();
|
|
24
|
+
const known = new Set(manifest.map(index_js_1.originIdOf));
|
|
25
|
+
for (const [key, dir] of Object.entries(map)) {
|
|
26
|
+
const id = key.startsWith('platform:') ? key : `platform:${key}`;
|
|
27
|
+
if (!known.has(id))
|
|
28
|
+
throw new errors_js_1.BaselineError('MAP_INVALID', `--map names ${key}, which is not in the package manifest`);
|
|
29
|
+
if (!localDirs.has(dir))
|
|
30
|
+
throw new errors_js_1.BaselineError('MAP_INVALID', `--map maps ${key} to ${dir}, which is not a directory with a migration.sql under prisma/migrations`);
|
|
31
|
+
operator.set(id, dir);
|
|
32
|
+
}
|
|
33
|
+
const localSha = new Map();
|
|
34
|
+
const localNormalised = new Map();
|
|
35
|
+
for (const [dir, bytes] of localDirs) {
|
|
36
|
+
localSha.set(dir, (0, index_js_1.sha256Hex)(bytes));
|
|
37
|
+
localNormalised.set(dir, (0, normalise_js_1.normalisedSha256)(bytes));
|
|
38
|
+
}
|
|
39
|
+
const used = new Set();
|
|
40
|
+
const byEntry = new Map();
|
|
41
|
+
const take = (entry, dir, kind) => {
|
|
42
|
+
used.add(dir);
|
|
43
|
+
const local = localSha.get(dir);
|
|
44
|
+
byEntry.set((0, index_js_1.originIdOf)(entry), {
|
|
45
|
+
originId: (0, index_js_1.originIdOf)(entry),
|
|
46
|
+
localDir: dir,
|
|
47
|
+
kind,
|
|
48
|
+
...(local === entry.sha256 ? {} : { localSha256: local }),
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
// Pass 1, exact bytes. Directories are tried in name order so the result is deterministic.
|
|
52
|
+
const sortedDirs = [...localDirs.keys()].sort();
|
|
53
|
+
for (const entry of manifest) {
|
|
54
|
+
const dir = sortedDirs.find((d) => !used.has(d) && localSha.get(d) === entry.sha256 && operator.get((0, index_js_1.originIdOf)(entry)) === undefined);
|
|
55
|
+
if (dir)
|
|
56
|
+
take(entry, dir, 'sha256');
|
|
57
|
+
}
|
|
58
|
+
// Pass 2, comments and whitespace stripped.
|
|
59
|
+
for (const entry of manifest) {
|
|
60
|
+
if (byEntry.has((0, index_js_1.originIdOf)(entry)) || operator.has((0, index_js_1.originIdOf)(entry)))
|
|
61
|
+
continue;
|
|
62
|
+
const want = (0, normalise_js_1.normalisedSha256)(packageFile(entry));
|
|
63
|
+
const dir = sortedDirs.find((d) => !used.has(d) && localNormalised.get(d) === want);
|
|
64
|
+
if (dir)
|
|
65
|
+
take(entry, dir, 'normalised');
|
|
66
|
+
}
|
|
67
|
+
// Pass 3, the operator. An explicit mapping always wins over a guess.
|
|
68
|
+
for (const entry of manifest) {
|
|
69
|
+
const dir = operator.get((0, index_js_1.originIdOf)(entry));
|
|
70
|
+
if (dir === undefined)
|
|
71
|
+
continue;
|
|
72
|
+
if (used.has(dir)) {
|
|
73
|
+
const holder = [...byEntry.values()].find((m) => m.localDir === dir);
|
|
74
|
+
throw new errors_js_1.BaselineError('MAP_INVALID', `--map maps ${(0, index_js_1.originIdOf)(entry)} to ${dir}, which already matches ${holder?.originId ?? 'another migration'}`);
|
|
75
|
+
}
|
|
76
|
+
take(entry, dir, 'operator-map');
|
|
77
|
+
}
|
|
78
|
+
return manifest.flatMap((entry) => byEntry.get((0, index_js_1.originIdOf)(entry)) ?? []);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=mapping.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapping.js","sourceRoot":"","sources":["../../src/baseline/mapping.ts"],"names":[],"mappings":";;AA8CA,wCA2DC;AAzGD,+CAA6E;AAC7E,2CAA4C;AAC5C,iDAAkD;AA6BlD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,cAAc,CAC5B,QAAkC,EAClC,SAA0C,EAC1C,WAAiD,EACjD,MAAwC,EAAE;IAE1C,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC3C,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,qBAAU,CAAC,CAAC,CAAC;IAChD,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,MAAM,EAAE,GAAG,GAAG,CAAC,UAAU,CAAC,WAA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CAAC,CAAC;IAC1C,CAAC;IACD,sEAAsE;IACtE,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC7B,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAA,qBAAU,EAAC,KAAK,CAAC,CAAC,CAAC;QAC5C,IAAI,GAAG,KAAK,SAAS;YAAE,SAAS;QAChC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,GAAG,CAAC,CAAC;YACrE,MAAM,IAAI,yBAAa,CAAC,aAAa,EAAE,cAAc,IAAA,qBAAU,EAAC,KAAK,CAAC,OAAO,GAAG,2BAA2B,MAAM,EAAE,QAAQ,IAAI,mBAAmB,EAAE,CAAC,CAAC;QACxJ,CAAC;QACD,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,cAAc,CAAC,CAAC;IACnC,CAAC;IACD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,qBAAU,EAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalises migration SQL for matching a fork that edited comments or
|
|
3
|
+
* whitespace: strips `--` line comments and block comments, collapses runs of
|
|
4
|
+
* whitespace (dropping it next to `(`, `)`, `,` and `;`) and lower-cases everything outside string literals and quoted
|
|
5
|
+
* identifiers (so keywords compare equal while `"User"` stays distinct from
|
|
6
|
+
* `"user"`).
|
|
7
|
+
*
|
|
8
|
+
* The result is only ever compared with another normalised text; it is never
|
|
9
|
+
* written anywhere, because Prisma checksums the raw bytes.
|
|
10
|
+
*
|
|
11
|
+
* @param sql - The text of a `migration.sql`.
|
|
12
|
+
* @returns The normalised text.
|
|
13
|
+
* @stability experimental
|
|
14
|
+
*/
|
|
15
|
+
export declare function normaliseSql(sql: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* SHA-256 of {@link normaliseSql}, the fingerprint the second matching pass compares.
|
|
18
|
+
*
|
|
19
|
+
* @param bytes - The raw `migration.sql` bytes.
|
|
20
|
+
* @returns 64 lower-case hex characters.
|
|
21
|
+
* @stability experimental
|
|
22
|
+
*/
|
|
23
|
+
export declare function normalisedSha256(bytes: Uint8Array): string;
|
|
24
|
+
/**
|
|
25
|
+
* Normalises one statement of `prisma migrate diff` output for comparison with
|
|
26
|
+
* a `deviations[].expectDiff` entry: removes `"public".` and collapses whitespace.
|
|
27
|
+
*
|
|
28
|
+
* @param statement - A statement.
|
|
29
|
+
* @returns The normalised statement.
|
|
30
|
+
* @stability experimental
|
|
31
|
+
*/
|
|
32
|
+
export declare function normaliseStatement(statement: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Splits the SQL `prisma migrate diff --script` prints into statements:
|
|
35
|
+
* comment headings are dropped and each statement keeps its trailing `;`.
|
|
36
|
+
*
|
|
37
|
+
* @param script - The script text, banner lines already removed.
|
|
38
|
+
* @returns The statements; empty for an empty migration.
|
|
39
|
+
* @stability experimental
|
|
40
|
+
*/
|
|
41
|
+
export declare function splitStatements(script: string): string[];
|
|
42
|
+
//# sourceMappingURL=normalise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalise.d.ts","sourceRoot":"","sources":["../../src/baseline/normalise.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA6DhD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE1D;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAOxD"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normaliseSql = normaliseSql;
|
|
4
|
+
exports.normalisedSha256 = normalisedSha256;
|
|
5
|
+
exports.normaliseStatement = normaliseStatement;
|
|
6
|
+
exports.splitStatements = splitStatements;
|
|
7
|
+
const index_js_1 = require("../lock/index.js");
|
|
8
|
+
/**
|
|
9
|
+
* Normalises migration SQL for matching a fork that edited comments or
|
|
10
|
+
* whitespace: strips `--` line comments and block comments, collapses runs of
|
|
11
|
+
* whitespace (dropping it next to `(`, `)`, `,` and `;`) and lower-cases everything outside string literals and quoted
|
|
12
|
+
* identifiers (so keywords compare equal while `"User"` stays distinct from
|
|
13
|
+
* `"user"`).
|
|
14
|
+
*
|
|
15
|
+
* The result is only ever compared with another normalised text; it is never
|
|
16
|
+
* written anywhere, because Prisma checksums the raw bytes.
|
|
17
|
+
*
|
|
18
|
+
* @param sql - The text of a `migration.sql`.
|
|
19
|
+
* @returns The normalised text.
|
|
20
|
+
* @stability experimental
|
|
21
|
+
*/
|
|
22
|
+
function normaliseSql(sql) {
|
|
23
|
+
let out = '';
|
|
24
|
+
let pendingSpace = false;
|
|
25
|
+
const emit = (token) => {
|
|
26
|
+
// One space between tokens, none next to punctuation: `(\n "id"` and `("id"` are the same text.
|
|
27
|
+
if (pendingSpace && out !== '' && !/[(),;]$/.test(out) && !/^[(),;]/.test(token))
|
|
28
|
+
out += ' ';
|
|
29
|
+
pendingSpace = false;
|
|
30
|
+
out += token;
|
|
31
|
+
};
|
|
32
|
+
let i = 0;
|
|
33
|
+
const n = sql.length;
|
|
34
|
+
while (i < n) {
|
|
35
|
+
const c = sql[i];
|
|
36
|
+
const next = sql[i + 1];
|
|
37
|
+
if (c === '-' && next === '-') {
|
|
38
|
+
while (i < n && sql[i] !== '\n')
|
|
39
|
+
i += 1;
|
|
40
|
+
pendingSpace = true;
|
|
41
|
+
}
|
|
42
|
+
else if (c === '/' && next === '*') {
|
|
43
|
+
let depth = 1;
|
|
44
|
+
i += 2;
|
|
45
|
+
while (i < n && depth > 0) {
|
|
46
|
+
if (sql[i] === '/' && sql[i + 1] === '*') {
|
|
47
|
+
depth += 1;
|
|
48
|
+
i += 2;
|
|
49
|
+
}
|
|
50
|
+
else if (sql[i] === '*' && sql[i + 1] === '/') {
|
|
51
|
+
depth -= 1;
|
|
52
|
+
i += 2;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
i += 1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
pendingSpace = true;
|
|
59
|
+
}
|
|
60
|
+
else if (c === "'" || c === '"') {
|
|
61
|
+
// A literal or a quoted identifier: copied verbatim, doubled quotes are escapes.
|
|
62
|
+
let j = i + 1;
|
|
63
|
+
while (j < n) {
|
|
64
|
+
if (sql[j] === c) {
|
|
65
|
+
if (sql[j + 1] === c)
|
|
66
|
+
j += 2;
|
|
67
|
+
else
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
j += 1;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
emit(sql.slice(i, j + 1));
|
|
75
|
+
i = j + 1;
|
|
76
|
+
}
|
|
77
|
+
else if (c === '$' && /^\$[A-Za-z_]*\$/.test(sql.slice(i, i + 64))) {
|
|
78
|
+
// A dollar-quoted body (a DO block, a function): verbatim up to the matching tag.
|
|
79
|
+
const tag = /^\$[A-Za-z_]*\$/.exec(sql.slice(i, i + 64))[0];
|
|
80
|
+
const end = sql.indexOf(tag, i + tag.length);
|
|
81
|
+
const stop = end === -1 ? n : end + tag.length;
|
|
82
|
+
emit(sql.slice(i, stop));
|
|
83
|
+
i = stop;
|
|
84
|
+
}
|
|
85
|
+
else if (/\s/.test(c)) {
|
|
86
|
+
pendingSpace = true;
|
|
87
|
+
i += 1;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
emit(c.toLowerCase());
|
|
91
|
+
i += 1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* SHA-256 of {@link normaliseSql}, the fingerprint the second matching pass compares.
|
|
98
|
+
*
|
|
99
|
+
* @param bytes - The raw `migration.sql` bytes.
|
|
100
|
+
* @returns 64 lower-case hex characters.
|
|
101
|
+
* @stability experimental
|
|
102
|
+
*/
|
|
103
|
+
function normalisedSha256(bytes) {
|
|
104
|
+
return (0, index_js_1.sha256Hex)(normaliseSql(Buffer.from(bytes).toString('utf8')));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Normalises one statement of `prisma migrate diff` output for comparison with
|
|
108
|
+
* a `deviations[].expectDiff` entry: removes `"public".` and collapses whitespace.
|
|
109
|
+
*
|
|
110
|
+
* @param statement - A statement.
|
|
111
|
+
* @returns The normalised statement.
|
|
112
|
+
* @stability experimental
|
|
113
|
+
*/
|
|
114
|
+
function normaliseStatement(statement) {
|
|
115
|
+
return statement.replace(/"public"\./g, '').replace(/\s+/g, ' ').trim();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Splits the SQL `prisma migrate diff --script` prints into statements:
|
|
119
|
+
* comment headings are dropped and each statement keeps its trailing `;`.
|
|
120
|
+
*
|
|
121
|
+
* @param script - The script text, banner lines already removed.
|
|
122
|
+
* @returns The statements; empty for an empty migration.
|
|
123
|
+
* @stability experimental
|
|
124
|
+
*/
|
|
125
|
+
function splitStatements(script) {
|
|
126
|
+
const cleaned = script.replace(/^\s*-- This is an empty migration\.\s*$/m, '');
|
|
127
|
+
return cleaned
|
|
128
|
+
.split(/;[ \t]*\r?\n/)
|
|
129
|
+
.map((chunk) => chunk.replace(/^(\s*--[^\n]*\n)+/g, '').trim())
|
|
130
|
+
.filter((chunk) => chunk !== '' && !/^--[^\n]*$/.test(chunk))
|
|
131
|
+
.map((chunk) => (chunk.endsWith(';') ? chunk : `${chunk};`));
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=normalise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalise.js","sourceRoot":"","sources":["../../src/baseline/normalise.ts"],"names":[],"mappings":";;AAgBA,oCA6DC;AASD,4CAEC;AAUD,gDAEC;AAUD,0CAOC;AArHD,+CAA6C;AAE7C;;;;;;;;;;;;;GAaG;AACH,SAAgB,YAAY,CAAC,GAAW;IACtC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,YAAY,GAAG,KAAK,CAAC;IACzB,MAAM,IAAI,GAAG,CAAC,KAAa,EAAQ,EAAE;QACnC,iGAAiG;QACjG,IAAI,YAAY,IAAI,GAAG,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,GAAG,IAAI,GAAG,CAAC;QAC7F,YAAY,GAAG,KAAK,CAAC;QACrB,GAAG,IAAI,KAAK,CAAC;IACf,CAAC,CAAC;IACF,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC;IACrB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACb,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAE,CAAC;QAClB,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI;gBAAE,CAAC,IAAI,CAAC,CAAC;YACxC,YAAY,GAAG,IAAI,CAAC;QACtB,CAAC;aAAM,IAAI,CAAC,KAA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CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC1E,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,eAAe,CAAC,MAAc;IAC5C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,0CAA0C,EAAE,EAAE,CAAC,CAAC;IAC/E,OAAO,OAAO;SACX,KAAK,CAAC,cAAc,CAAC;SACrB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;SAC9D,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC5D,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type ManifestEntry } from '../lock/index.js';
|
|
2
|
+
import type { MatchKind, MatchedMigration } from './mapping.js';
|
|
3
|
+
/**
|
|
4
|
+
* What the baseline does with one package migration (step B5).
|
|
5
|
+
*
|
|
6
|
+
* - `mapped`: an existing directory is the migration; the lock points at it.
|
|
7
|
+
* - `install-resolve`: no directory, yet the migration is at or below `--through`, so its effect is already in the database. It is installed and marked applied without running it.
|
|
8
|
+
* - `install`: above `--through`; it is only installed, and `migrate deploy` applies it.
|
|
9
|
+
*
|
|
10
|
+
* @stability experimental
|
|
11
|
+
*/
|
|
12
|
+
export type PlannedAction = 'mapped' | 'install-resolve' | 'install';
|
|
13
|
+
/**
|
|
14
|
+
* One package migration in the baseline plan; the plan holds all of them in package order.
|
|
15
|
+
*
|
|
16
|
+
* @stability experimental
|
|
17
|
+
*/
|
|
18
|
+
export interface PlannedEntry {
|
|
19
|
+
/** `platform:NNNN_slug`. */
|
|
20
|
+
originId: string;
|
|
21
|
+
/** The directory under the package's `migrations/`. */
|
|
22
|
+
packageDir: string;
|
|
23
|
+
/** The app directory: the existing one, or the name an installed copy will get. */
|
|
24
|
+
localDir: string;
|
|
25
|
+
/** SHA-256 of the package file. */
|
|
26
|
+
sha256: string;
|
|
27
|
+
/** The version recorded as `since`. */
|
|
28
|
+
since: string;
|
|
29
|
+
/** What the baseline does with it. */
|
|
30
|
+
action: PlannedAction;
|
|
31
|
+
/** How a `mapped` entry was matched. */
|
|
32
|
+
kind?: MatchKind;
|
|
33
|
+
/** SHA-256 of the app's file when it differs from the package's. */
|
|
34
|
+
localSha256?: string;
|
|
35
|
+
/** Why the files differ (recorded with `localSha256`). */
|
|
36
|
+
note?: string;
|
|
37
|
+
/** Whether `prisma migrate resolve --applied <localDir>` runs for it. */
|
|
38
|
+
resolve: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** The directory slug of a package migration id (the rule `platform db sync` uses). */
|
|
41
|
+
export declare function slugOf(id: string): string;
|
|
42
|
+
/** The sequence number of a manifest id (`0007_x` is 7). */
|
|
43
|
+
export declare function sequenceOf(id: string): number;
|
|
44
|
+
/**
|
|
45
|
+
* Plans the baseline: one entry per package migration, in order, with the
|
|
46
|
+
* directory name every installed one will get. Pure.
|
|
47
|
+
*
|
|
48
|
+
* Placement (ADR 0002 D4): a migration that is installed **and** resolved goes
|
|
49
|
+
* immediately after its package predecessor (predecessor timestamp plus one
|
|
50
|
+
* second, or the next free second), or before everything when it has no
|
|
51
|
+
* predecessor, so a fresh database built from the adopted history applies it
|
|
52
|
+
* in package order and the app's own equivalent migration then no-ops. A
|
|
53
|
+
* migration above `--through` goes to the end by the sync naming rule.
|
|
54
|
+
*
|
|
55
|
+
* @param manifest - The package history.
|
|
56
|
+
* @param matched - The result of `proposeMapping`.
|
|
57
|
+
* @param localDirs - Every directory name under the app's `prisma/migrations`.
|
|
58
|
+
* @param through - The sequence number of the migration the database claims to equal.
|
|
59
|
+
* @param recorded - Directory names with a finished `_prisma_migrations` row; empty for a database Prisma never managed.
|
|
60
|
+
* @param now - The clock for migrations above `--through`.
|
|
61
|
+
* @returns The plan.
|
|
62
|
+
* @throws BaselineError `PLACEMENT_IMPOSSIBLE` when the directories cannot be made to sort in package order.
|
|
63
|
+
* @stability experimental
|
|
64
|
+
*/
|
|
65
|
+
export declare function planBaseline(manifest: readonly ManifestEntry[], matched: readonly MatchedMigration[], localDirs: readonly string[], through: number, recorded: ReadonlySet<string>, now: Date): PlannedEntry[];
|
|
66
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/baseline/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGlE,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhE;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,iBAAiB,GAAG,SAAS,CAAC;AAErE;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,MAAM,EAAE,aAAa,CAAC;IACtB,wCAAwC;IACxC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,OAAO,EAAE,OAAO,CA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