@prisma/orm-toolchain 8.0.0-rc.2-dev.3 → 8.0.0-rc.20-dev.1
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 +1 -5
- package/dist/{aggregate-DLUJLq5Y.d.mts → aggregate-BpcQdygS.d.mts} +83 -36
- package/dist/aggregate-BpcQdygS.d.mts.map +1 -0
- package/dist/{aggregate-CPZB020V.mjs → aggregate-T_HG6gq6.mjs} +118 -57
- package/dist/aggregate-T_HG6gq6.mjs.map +1 -0
- package/dist/caught-errors-Bmbi1dBu-DKO5X2tN.mjs +1026 -0
- package/dist/caught-errors-Bmbi1dBu-DKO5X2tN.mjs.map +1 -0
- package/dist/cli-telemetry.d.mts +9 -8
- package/dist/cli-telemetry.d.mts.map +1 -1
- package/dist/cli-telemetry.mjs +30 -27
- package/dist/cli-telemetry.mjs.map +1 -1
- package/dist/cli.d.mts +7 -14
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +3769 -1506
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +233 -93
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +3 -2
- package/dist/cli__control-api__testing.d.mts +5 -4
- package/dist/cli__control-api__testing.d.mts.map +1 -1
- package/dist/cli__control-api__testing.mjs +21 -16
- package/dist/cli__control-api__testing.mjs.map +1 -1
- package/dist/cli__init-output.d.mts +11 -1
- package/dist/cli__init-output.d.mts.map +1 -1
- package/dist/cli__init-output.mjs +1 -1
- package/dist/cli__migration-cli.d.mts +1 -1
- package/dist/cli__migration-cli.mjs +65 -19
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/config-loader.d.mts +2 -2
- package/dist/config-loader.mjs +2 -2
- package/dist/{contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs → contract-snapshot-store-6gIBcUeb-DJK3OM0j.mjs} +44 -16
- package/dist/contract-snapshot-store-6gIBcUeb-DJK3OM0j.mjs.map +1 -0
- package/dist/contract-snapshot-store-Bok5nQYi-D3g_P7im.d.mts +59 -0
- package/dist/contract-snapshot-store-Bok5nQYi-D3g_P7im.d.mts.map +1 -0
- package/dist/contract-snapshot-store-DrIwu5pn.d.mts +2 -0
- package/dist/{db-verify-BwgNK50T-DGvKgFCK.d.mts → db-sign-gvrl0kFE-D-nTGx88.d.mts} +330 -230
- package/dist/db-sign-gvrl0kFE-D-nTGx88.d.mts.map +1 -0
- package/dist/{domain-type-generation-bpSO3Y0L-jo2C7LlH.mjs → domain-type-generation-B4m774CV-WAjyhZHw.mjs} +144 -154
- package/dist/domain-type-generation-B4m774CV-WAjyhZHw.mjs.map +1 -0
- package/dist/domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts +78 -0
- package/dist/domain-type-generation-DZjtzrbE-BpOOD3YV.d.mts.map +1 -0
- package/dist/emitter.d.mts +3 -3
- package/dist/emitter.mjs +3 -3
- package/dist/emitter__domain-type-generation.d.mts +2 -2
- package/dist/emitter__domain-type-generation.mjs +2 -2
- package/dist/{errors-D59OCpoI.d.mts → errors-CLwhWJiz.d.mts} +14 -3
- package/dist/errors-CLwhWJiz.d.mts.map +1 -0
- package/dist/{errors-CXbGUWGu-CstQHPh6.mjs → errors-DXha_4l--relAaiI4.mjs} +37 -42
- package/dist/errors-DXha_4l--relAaiI4.mjs.map +1 -0
- package/dist/exports-BCIlMjIW-DkUBVDzl.mjs +421 -0
- package/dist/exports-BCIlMjIW-DkUBVDzl.mjs.map +1 -0
- package/dist/exports-BlYTE3-J.mjs +539 -0
- package/dist/exports-BlYTE3-J.mjs.map +1 -0
- package/dist/exports-CKgwcXbp.mjs +3973 -0
- package/dist/exports-CKgwcXbp.mjs.map +1 -0
- package/dist/graph-membership-DxpNgxfZ-BfqA-H7V.mjs +19 -0
- package/dist/graph-membership-DxpNgxfZ-BfqA-H7V.mjs.map +1 -0
- package/dist/{hash-DH8hl5Rq-BpM2t3Nu.mjs → hash-BAZVWU4a-BQovI7hF.mjs} +24 -3
- package/dist/hash-BAZVWU4a-BQovI7hF.mjs.map +1 -0
- package/dist/hash-CwWGlFWV.d.mts +1 -0
- package/dist/{hash-XZYYKJ-i.d.mts → hash-DclMqd7S-WBvXJ_4C.d.mts} +17 -4
- package/dist/hash-DclMqd7S-WBvXJ_4C.d.mts.map +1 -0
- package/dist/{import-roots-CfoYgejL.d.mts → import-roots-ARK1wjzc.d.mts} +3 -3
- package/dist/{import-roots-CfoYgejL.d.mts.map → import-roots-ARK1wjzc.d.mts.map} +1 -1
- package/dist/{import-roots-CNFBPAT1.mjs → import-roots-BPn2s_fq.mjs} +6 -6
- package/dist/import-roots-BPn2s_fq.mjs.map +1 -0
- package/dist/index-CWPFeYyi.d.mts +204 -0
- package/dist/index-CWPFeYyi.d.mts.map +1 -0
- package/dist/{index-Dgwl8Tzs.d.mts → index-tAySVPvZ.d.mts} +16 -4
- package/dist/index-tAySVPvZ.d.mts.map +1 -0
- package/dist/{invariants-CTHy88OP-CYI2a8IO.mjs → invariants-DrF9p5Gd-BF70vGl1.mjs} +3 -3
- package/dist/{invariants-CTHy88OP-CYI2a8IO.mjs.map → invariants-DrF9p5Gd-BF70vGl1.mjs.map} +1 -1
- package/dist/{io-635GlNx1-D3zrw2qu.mjs → io-BNxFm3eg-DYD82QeZ.mjs} +8 -8
- package/dist/io-BNxFm3eg-DYD82QeZ.mjs.map +1 -0
- package/dist/io-D8Epu7iY.d.mts +1 -0
- package/dist/{io-sr4CO9_t-C3eV_kn-.d.mts → io-DZfMV51z-BKlH5Dhb.d.mts} +9 -2
- package/dist/io-DZfMV51z-BKlH5Dhb.d.mts.map +1 -0
- package/dist/{migration-B2ljMJim.d.mts → migration-Bjz05034.d.mts} +12 -5
- package/dist/migration-Bjz05034.d.mts.map +1 -0
- package/dist/{migration-hspPIEeV.mjs → migration-CWyjX9vz.mjs} +18 -6
- package/dist/migration-CWyjX9vz.mjs.map +1 -0
- package/dist/{migration-graph-_SJImD5V-BURyY1KM.mjs → migration-graph-BoiiZAaU-DLht12k7.mjs} +6 -89
- package/dist/migration-graph-BoiiZAaU-DLht12k7.mjs.map +1 -0
- package/dist/{migration-graph-tarTxJ99-BrGBANeE.d.mts → migration-graph-D8IuOkZb-pSI7-k4_.d.mts} +7 -29
- package/dist/migration-graph-D8IuOkZb-pSI7-k4_.d.mts.map +1 -0
- package/dist/migration-graph-Dra4CcyN.d.mts +14 -0
- package/dist/migration-graph-Dra4CcyN.d.mts.map +1 -0
- package/dist/migration-tools.d.mts +17 -15
- package/dist/migration-tools.mjs +15 -15
- package/dist/migration-tools__aggregate.d.mts +2 -2
- package/dist/migration-tools__aggregate.mjs +2 -2
- package/dist/migration-tools__contract-snapshot-store.d.mts +4 -2
- package/dist/migration-tools__contract-snapshot-store.mjs +2 -2
- package/dist/migration-tools__errors.d.mts +2 -2
- package/dist/migration-tools__errors.mjs +1 -1
- package/dist/migration-tools__hash.d.mts +2 -1
- package/dist/migration-tools__hash.mjs +1 -1
- package/dist/migration-tools__invariants.mjs +1 -1
- package/dist/migration-tools__io.d.mts +2 -2
- package/dist/migration-tools__io.mjs +1 -1
- package/dist/migration-tools__migration-graph.d.mts +3 -3
- package/dist/migration-tools__migration-graph.mjs +3 -3
- package/dist/migration-tools__migration-ts.d.mts +2 -2
- package/dist/migration-tools__migration-ts.mjs +2 -2
- package/dist/migration-tools__migration.d.mts +1 -1
- package/dist/migration-tools__migration.mjs +1 -1
- package/dist/migration-tools__ref-resolution.d.mts +2 -2
- package/dist/migration-tools__ref-resolution.mjs +2 -2
- package/dist/migration-tools__refs.mjs +1 -1
- package/dist/migration-tools__spaces.d.mts +1 -1
- package/dist/migration-tools__spaces.mjs +2 -2
- package/dist/{migration-ts-DdVm0rws.mjs → migration-ts-DDgjsR1O.mjs} +6 -5
- package/dist/migration-ts-DDgjsR1O.mjs.map +1 -0
- package/dist/{migration-ts-CNaAtK8C.d.mts → migration-ts-SGer0PXq.d.mts} +4 -2
- package/dist/migration-ts-SGer0PXq.d.mts.map +1 -0
- package/dist/op-schema-3tXg0LTS-DqpOKDEa.mjs +23 -0
- package/dist/op-schema-3tXg0LTS-DqpOKDEa.mjs.map +1 -0
- package/dist/output-BcC8eB0h-C5bRd-aC.mjs +129 -0
- package/dist/output-BcC8eB0h-C5bRd-aC.mjs.map +1 -0
- package/dist/publish-surface.d.mts +1 -1
- package/dist/publish-surface.mjs +2 -2
- package/dist/publish-surface__import-roots.d.mts +1 -1
- package/dist/publish-surface__import-roots.mjs +1 -1
- package/dist/publish-surface__shells.mjs +1 -1
- package/dist/quick-reference-mongo.md +12 -12
- package/dist/quick-reference-postgres.md +10 -10
- package/dist/quick-reference-prisma7.md +80 -0
- package/dist/readme-mongo.md +6 -6
- package/dist/readme-postgres.md +6 -6
- package/dist/ref-DEiY2Cbd-1ZImpUEN.mjs +6663 -0
- package/dist/ref-DEiY2Cbd-1ZImpUEN.mjs.map +1 -0
- package/dist/{ref-resolution-COGOSL57.d.mts → ref-resolution-BPhR-kta.d.mts} +29 -11
- package/dist/ref-resolution-BPhR-kta.d.mts.map +1 -0
- package/dist/{ref-resolution-HeNBXW53.mjs → ref-resolution-Eo0QHp4f.mjs} +30 -6
- package/dist/ref-resolution-Eo0QHp4f.mjs.map +1 -0
- package/dist/{refs-WK86uYYp-gM8tvWQP.mjs → refs-DM3q3IZC-BC6H6P0X.mjs} +9 -9
- package/dist/refs-DM3q3IZC-BC6H6P0X.mjs.map +1 -0
- package/dist/{shells-C4HbRAr5.mjs → shells-w_yEDhe8.mjs} +98 -31
- package/dist/shells-w_yEDhe8.mjs.map +1 -0
- package/dist/{spaces-Dj65JrwZ.d.mts → spaces-BWULKO54.d.mts} +3 -3
- package/dist/{spaces-Dj65JrwZ.d.mts.map → spaces-BWULKO54.d.mts.map} +1 -1
- package/dist/{spaces-4qMOAYE9.mjs → spaces-c9xdiXW8.mjs} +14 -13
- package/dist/spaces-c9xdiXW8.mjs.map +1 -0
- package/dist/{verify-contract-spaces-DhJTb0zM-B62maCfE.mjs → verify-contract-spaces-YzEHF9zj-DGZgox_3.mjs} +7 -7
- package/dist/{verify-contract-spaces-DhJTb0zM-B62maCfE.mjs.map → verify-contract-spaces-YzEHF9zj-DGZgox_3.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.d.mts +1 -1
- package/dist/vite-plugin-contract-emit.mjs +10 -10
- package/dist/vite-plugin-contract-emit.mjs.map +1 -1
- package/package.json +16 -15
- package/dist/aggregate-CPZB020V.mjs.map +0 -1
- package/dist/aggregate-DLUJLq5Y.d.mts.map +0 -1
- package/dist/contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs.map +0 -1
- package/dist/contract-snapshot-store-CbqynbtE.d.mts +0 -28
- package/dist/contract-snapshot-store-CbqynbtE.d.mts.map +0 -1
- package/dist/db-verify-BwgNK50T-DGvKgFCK.d.mts.map +0 -1
- package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts +0 -63
- package/dist/domain-type-generation-PkAb39ob-Ct8AGqow.d.mts.map +0 -1
- package/dist/domain-type-generation-bpSO3Y0L-jo2C7LlH.mjs.map +0 -1
- package/dist/errors-CXbGUWGu-CstQHPh6.mjs.map +0 -1
- package/dist/errors-D59OCpoI.d.mts.map +0 -1
- package/dist/exports-8ZUN43ve.mjs +0 -1734
- package/dist/exports-8ZUN43ve.mjs.map +0 -1
- package/dist/exports-BCLg4CiV-05kuwcb0.mjs +0 -160
- package/dist/exports-BCLg4CiV-05kuwcb0.mjs.map +0 -1
- package/dist/exports-BZaG8_w_.mjs +0 -243
- package/dist/exports-BZaG8_w_.mjs.map +0 -1
- package/dist/graph-membership-BViWUMpP-C4lYYJdU.mjs +0 -14
- package/dist/graph-membership-BViWUMpP-C4lYYJdU.mjs.map +0 -1
- package/dist/hash-DH8hl5Rq-BpM2t3Nu.mjs.map +0 -1
- package/dist/hash-XZYYKJ-i.d.mts.map +0 -1
- package/dist/import-roots-CNFBPAT1.mjs.map +0 -1
- package/dist/index-DRs7L6N0.d.mts +0 -57
- package/dist/index-DRs7L6N0.d.mts.map +0 -1
- package/dist/index-Dgwl8Tzs.d.mts.map +0 -1
- package/dist/io-635GlNx1-D3zrw2qu.mjs.map +0 -1
- package/dist/io-DYfeLJxR.d.mts +0 -1
- package/dist/io-sr4CO9_t-C3eV_kn-.d.mts.map +0 -1
- package/dist/migration-B2ljMJim.d.mts.map +0 -1
- package/dist/migration-graph-Dqndu0i5.d.mts +0 -9
- package/dist/migration-graph-Dqndu0i5.d.mts.map +0 -1
- package/dist/migration-graph-_SJImD5V-BURyY1KM.mjs.map +0 -1
- package/dist/migration-graph-tarTxJ99-BrGBANeE.d.mts.map +0 -1
- package/dist/migration-hspPIEeV.mjs.map +0 -1
- package/dist/migration-ts-CNaAtK8C.d.mts.map +0 -1
- package/dist/migration-ts-DdVm0rws.mjs.map +0 -1
- package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs +0 -13
- package/dist/op-schema-BSVHzEQN-DIWt28D8.mjs.map +0 -1
- package/dist/output-CovTDY14-CUoAqLML.mjs +0 -77
- package/dist/output-CovTDY14-CUoAqLML.mjs.map +0 -1
- package/dist/ref-h6InR6dO-rGfl18Jv.mjs +0 -4686
- package/dist/ref-h6InR6dO-rGfl18Jv.mjs.map +0 -1
- package/dist/ref-resolution-COGOSL57.d.mts.map +0 -1
- package/dist/ref-resolution-HeNBXW53.mjs.map +0 -1
- package/dist/refs-WK86uYYp-gM8tvWQP.mjs.map +0 -1
- package/dist/shells-C4HbRAr5.mjs.map +0 -1
- package/dist/spaces-4qMOAYE9.mjs.map +0 -1
|
@@ -1,16 +1,224 @@
|
|
|
1
|
-
import "./
|
|
1
|
+
import { n as SnapshotContentVerifier } from "./contract-snapshot-store-Bok5nQYi-D3g_P7im.mjs";
|
|
2
|
+
import "./contract-snapshot-store-DrIwu5pn.mjs";
|
|
3
|
+
import "./ref-resolution-BPhR-kta.mjs";
|
|
2
4
|
import { CliStructuredError as CliStructuredError$2 } from "@prisma/orm-framework/errors/control";
|
|
3
|
-
import { ControlAdapterDescriptor, ControlDriverDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlTargetDescriptor, CoreSchemaView, MigrationPlanOperation, MigrationPlannerConflict, OperationPreview,
|
|
4
|
-
import { Result } from "@prisma/orm-framework/utils/result";
|
|
5
|
-
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
5
|
+
import { ControlAdapterDescriptor, ControlDriverConnectOptions, ControlDriverDescriptor, ControlDriverInstance, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlTargetDescriptor, CoreSchemaView, MarkerHashes, MigrationAccessChange, MigrationDataLoss, MigrationOperationSubject, MigrationPlanNamespaces, MigrationPlanOperation, MigrationPlanSubjects, MigrationPlannerConflict, MigrationStatementJson, MigrationSubjectJson, OperationPreview, ResolvedMigrationStatement, SpaceSignature, VerifyDatabaseResult, VerifyDatabaseSchemaResult } from "@prisma/orm-framework/components/control";
|
|
6
6
|
import "@prisma/orm-framework/errors/execution";
|
|
7
7
|
import "@prisma/orm-framework/errors/migration";
|
|
8
|
+
import { ImportSpecifierResolver } from "@prisma/orm-framework/components/emission";
|
|
9
|
+
import { PslDocumentAst } from "@prisma/orm-framework/components/psl-ast";
|
|
10
|
+
import { Result } from "@prisma/orm-framework/utils/result";
|
|
11
|
+
import { TargetBoundComponentDescriptor } from "@prisma/orm-framework/components/components";
|
|
8
12
|
import { Contract, ContractMarkerRecord, LedgerEntryRecord } from "@prisma/orm-framework/contract/types";
|
|
9
13
|
import "@prisma/cli-engine/protocol";
|
|
10
|
-
import { ContractSourceDiagnostics, ContractSourceProvider, PrismaNextConfig } from "@prisma/orm-framework/config/config-types";
|
|
14
|
+
import { ContractSourceDiagnostic, ContractSourceDiagnostics, ContractSourceProvider, PrismaNextConfig } from "@prisma/orm-framework/config/config-types";
|
|
11
15
|
import { AuthoringPslBlockDescriptorNamespace } from "@prisma/orm-framework/components/authoring";
|
|
12
|
-
|
|
13
|
-
//#region
|
|
16
|
+
//#region ../../../1-framework/3-tooling/cli/dist/db-sign-gvrl0kFE.d.mts
|
|
17
|
+
//#region src/control-api/statements/statement-text.d.ts
|
|
18
|
+
/** The verbs a statement can have. */
|
|
19
|
+
type StatementVerb = 'rename' | 'delete' | 'allow' | 'convert' | 'backfill';
|
|
20
|
+
/**
|
|
21
|
+
* A statement as the user wrote it, before it is parsed: its verb and its text, for example
|
|
22
|
+
* `{ verb: 'rename', text: 'Profile:User' }` for `--rename Profile:User` or
|
|
23
|
+
* `{ verb: 'delete', text: 'Legacy' }` for `--delete Legacy`.
|
|
24
|
+
*/
|
|
25
|
+
interface StatementText {
|
|
26
|
+
readonly verb: StatementVerb;
|
|
27
|
+
readonly text: string;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/utils/printed-command.d.ts
|
|
31
|
+
/**
|
|
32
|
+
* Where the user ran the CLI from, the `--config` they gave it, as they typed it, and whether they
|
|
33
|
+
* gave it `--db`.
|
|
34
|
+
*/
|
|
35
|
+
interface CliInvocation {
|
|
36
|
+
readonly cwd: string;
|
|
37
|
+
readonly configPath: string | undefined;
|
|
38
|
+
readonly dbGiven: boolean;
|
|
39
|
+
/** The arguments a re-run of the same command repeats, such as its statements. */
|
|
40
|
+
readonly rerunArgs?: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/control-api/operations/db-verify.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* Inputs for the aggregate `db verify` operation.
|
|
46
|
+
*
|
|
47
|
+
* Loader → verifier pipeline. The loader (sole descriptor-import
|
|
48
|
+
* boundary) builds a {@link import('@prisma/orm-toolchain/migration-tools/aggregate').ContractSpaceAggregate};
|
|
49
|
+
* the aggregate verifier bundles `markerCheck` + per-space `schemaCheck`
|
|
50
|
+
* (each contract space verified against the full schema; extras stripped to its own view).
|
|
51
|
+
* `mode: 'strict' | 'lenient'` maps directly to the user facing `--strict` flag.
|
|
52
|
+
*/
|
|
53
|
+
interface ExecuteDbVerifyOptions<TFamilyId extends string, TTargetId extends string> {
|
|
54
|
+
readonly driver: ControlDriverInstance<TFamilyId, TTargetId>;
|
|
55
|
+
readonly familyInstance: ControlFamilyInstance<TFamilyId, unknown>;
|
|
56
|
+
readonly contract: Contract;
|
|
57
|
+
readonly migrationsDir: string;
|
|
58
|
+
readonly targetId: TTargetId;
|
|
59
|
+
readonly extensions: ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>;
|
|
60
|
+
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;
|
|
61
|
+
readonly mode: 'strict' | 'lenient';
|
|
62
|
+
readonly skipSchema: boolean;
|
|
63
|
+
readonly skipMarker: boolean;
|
|
64
|
+
/** Content check for contract snapshots the aggregate loader resolves. */
|
|
65
|
+
readonly verifySnapshotContent?: SnapshotContentVerifier;
|
|
66
|
+
readonly onProgress?: OnControlProgress;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Result of the aggregate verify operation.
|
|
70
|
+
*
|
|
71
|
+
* Marker drift keeps the envelope shape the legacy
|
|
72
|
+
* `runContractSpaceVerifierMarkerCheck` emitted, but rides the success value
|
|
73
|
+
* as {@link ExecuteDbVerifySuccess.markerDrift}: the check ran to completion,
|
|
74
|
+
* so drift is a finding for the caller to settle, not a failure to run.
|
|
75
|
+
*
|
|
76
|
+
* On success, the per-space verify results are returned for the CLI to
|
|
77
|
+
* render. When `skipSchema` is true (`--marker-only`), the schema map
|
|
78
|
+
* is empty.
|
|
79
|
+
*/
|
|
80
|
+
interface ExecuteDbVerifySuccess {
|
|
81
|
+
readonly schemaResults: ReadonlyMap<string, VerifyDatabaseSchemaResult>;
|
|
82
|
+
/**
|
|
83
|
+
* Live element names no contract space declares, deduplicated and reported
|
|
84
|
+
* once for the whole database (never per space). Strict mode fails on a
|
|
85
|
+
* non-empty list; lenient mode surfaces it informationally.
|
|
86
|
+
*/
|
|
87
|
+
readonly unclaimed: readonly string[];
|
|
88
|
+
readonly spaceOrder: readonly string[];
|
|
89
|
+
readonly appSpaceId: string;
|
|
90
|
+
/**
|
|
91
|
+
* Per-space marker drift the verifier found — a hash mismatch, missing
|
|
92
|
+
* invariants, an orphan marker row — as the violation envelope. The check
|
|
93
|
+
* completed and this is its verdict, so it rides the success value: callers
|
|
94
|
+
* settle it as a finding, while the failure lane stays reserved for a check
|
|
95
|
+
* that could not run (loader violations, introspection failure).
|
|
96
|
+
*/
|
|
97
|
+
readonly markerDrift: CliStructuredError$2 | null;
|
|
98
|
+
}
|
|
99
|
+
type ExecuteDbVerifyResult = Result<ExecuteDbVerifySuccess, CliStructuredError$2>;
|
|
100
|
+
/**
|
|
101
|
+
* Loader → verifier pipeline shared by `db verify` modes (`full`,
|
|
102
|
+
* `marker-only`, `schema-only`).
|
|
103
|
+
*
|
|
104
|
+
* 1. **Load**: build a {@link import('@prisma/orm-toolchain/migration-tools/aggregate').ContractSpaceAggregate}
|
|
105
|
+
* from descriptors + on-disk on-disk artefacts. Layout / drift /
|
|
106
|
+
* integrity / disjointness violations short-circuit with a
|
|
107
|
+
* structured CLI error.
|
|
108
|
+
* 2. **Read DB state**: marker rows + (when `skipSchema` is `false`)
|
|
109
|
+
* schema introspection.
|
|
110
|
+
* 3. **Verify**: {@link verifyMigration} returns per-space `markerCheck` +
|
|
111
|
+
* per-space `schemaCheck` (each contract space verified against the full schema,
|
|
112
|
+
* then scoped to its own contract space). Marker drift is returned as the
|
|
113
|
+
* success value's `markerDrift` envelope for callers to settle as a
|
|
114
|
+
* finding. Verify results are returned to the caller verbatim.
|
|
115
|
+
*/
|
|
116
|
+
declare function executeDbVerify<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbVerifyOptions<TFamilyId, TTargetId>): Promise<ExecuteDbVerifyResult>;
|
|
117
|
+
//#endregion
|
|
118
|
+
//#region src/control-api/render-contract-dts.d.ts
|
|
119
|
+
/**
|
|
120
|
+
* Options for rendering the `contract.d.ts` text of an already-emitted
|
|
121
|
+
* contract, as read from `contract.json`.
|
|
122
|
+
*/
|
|
123
|
+
interface RenderContractDtsOptions {
|
|
124
|
+
/** The parsed `contract.json` to render types for. */
|
|
125
|
+
readonly contract: unknown;
|
|
126
|
+
/**
|
|
127
|
+
* Rewrites the package names the declarations import from, for the import
|
|
128
|
+
* root of the project that keeps them. Defaults to leaving every specifier
|
|
129
|
+
* as authored.
|
|
130
|
+
*/
|
|
131
|
+
readonly resolveImportSpecifier?: ImportSpecifierResolver;
|
|
132
|
+
}
|
|
133
|
+
interface RenderContractDtsSuccess {
|
|
134
|
+
/** The declarations, rendered through the same emitter as `emit`, with the import specifiers the caller asked for. */
|
|
135
|
+
readonly contractDts: string;
|
|
136
|
+
}
|
|
137
|
+
type RenderContractDtsFailureCode = 'CONTRACT_VALIDATION_FAILED' | 'RENDER_FAILED';
|
|
138
|
+
interface RenderContractDtsFailure {
|
|
139
|
+
readonly code: RenderContractDtsFailureCode;
|
|
140
|
+
readonly summary: string;
|
|
141
|
+
readonly why: string | undefined;
|
|
142
|
+
/** Underlying error for diagnostics; never serialized into envelopes. */
|
|
143
|
+
readonly cause?: unknown;
|
|
144
|
+
}
|
|
145
|
+
type RenderContractDtsResult = Result<RenderContractDtsSuccess, RenderContractDtsFailure>;
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/control-api/statements/parse-consent.d.ts
|
|
148
|
+
/** A verb whose statement consents to what a plan does to its subject. */
|
|
149
|
+
type ConsentVerb = 'delete' | 'allow';
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/control-api/statements/plan-questions.d.ts
|
|
152
|
+
/** A verb a plan question accepts. */
|
|
153
|
+
type PlanQuestionVerb = 'rename' | 'convert' | ConsentVerb;
|
|
154
|
+
/**
|
|
155
|
+
* What a command asks about one operation of a plan: the question, its subject written as the
|
|
156
|
+
* statement names it, and the verbs that answer it. A command hands it to its prompt.
|
|
157
|
+
*/
|
|
158
|
+
interface PlanQuestion {
|
|
159
|
+
readonly question: string;
|
|
160
|
+
readonly subject: string;
|
|
161
|
+
/** The namespace of a data-loss question's model or field when the destination removed it: a `delete` of it answers the question too. */
|
|
162
|
+
readonly removedNamespace?: string;
|
|
163
|
+
readonly verbs: readonly PlanQuestionVerb[];
|
|
164
|
+
readonly forms: {
|
|
165
|
+
readonly rename?: string;
|
|
166
|
+
readonly convert?: string;
|
|
167
|
+
};
|
|
168
|
+
readonly validate: (verb: PlanQuestionVerb, text: string) => string | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* Whether an answer is the removed namespace's own, a `delete` or a `rename` of the namespace,
|
|
171
|
+
* which answers its other questions too; `undefined` for any other answer.
|
|
172
|
+
*/
|
|
173
|
+
readonly namespaceAnswer?: (verb: PlanQuestionVerb, text: string) => NamespaceAnswer | undefined;
|
|
174
|
+
}
|
|
175
|
+
/** How an answer answers a removed namespace as a whole. */
|
|
176
|
+
type NamespaceAnswer = 'delete' | 'rename';
|
|
177
|
+
interface PlanAnswer {
|
|
178
|
+
readonly verb: PlanQuestionVerb;
|
|
179
|
+
readonly text: string;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Asks every question at once and returns one answer per question, in question order, with a verb
|
|
183
|
+
* and text the question accepts. To refuse, throw. It is called at least once per apply, with an
|
|
184
|
+
* empty list when nothing is in question, including under `acceptDataLoss: true`; return `[]`
|
|
185
|
+
* then. Beside a `rename` or `convert` answer, which plans again, a question may be left
|
|
186
|
+
* `undefined`: it is asked again, as the new plan has it.
|
|
187
|
+
*/
|
|
188
|
+
type AnswerPlanQuestions = (questions: readonly PlanQuestion[]) => Promise<readonly (PlanAnswer | undefined)[]>;
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/control-api/statements/report-applied-statements.d.ts
|
|
191
|
+
/** A delete or allow statement in JSON output: the subject whose data or access it consents to. */
|
|
192
|
+
interface ConsentStatementJson {
|
|
193
|
+
readonly kind: ConsentVerb;
|
|
194
|
+
readonly subject: MigrationSubjectJson;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* A statement a plan applied, as the CLI reports it: its verb, the statement as JSON output writes
|
|
198
|
+
* it, the positions of its operations in the result's `operations`, and its description.
|
|
199
|
+
*/
|
|
200
|
+
type AppliedStatementReport = {
|
|
201
|
+
readonly verb: ResolvedMigrationStatement['kind'];
|
|
202
|
+
readonly statement: MigrationStatementJson;
|
|
203
|
+
readonly operationIndexes: readonly number[];
|
|
204
|
+
/** The statement in domain names, for example `rename model "Profile" to "User"` or `convert field "User.age"`. */
|
|
205
|
+
readonly description: string;
|
|
206
|
+
} | {
|
|
207
|
+
readonly verb: ConsentVerb;
|
|
208
|
+
readonly statement: ConsentStatementJson;
|
|
209
|
+
readonly operationIndexes: readonly number[];
|
|
210
|
+
/** The statement as its question named the subject, for example `delete model "Legacy"`. */
|
|
211
|
+
readonly description: string;
|
|
212
|
+
};
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/control-api/statements/temporary-values.d.ts
|
|
215
|
+
/** A new required field whose existing rows a plan gives one temporary value, as a statement names it. */
|
|
216
|
+
interface TemporaryValueReport {
|
|
217
|
+
readonly field: string;
|
|
218
|
+
/** The value as SQL text, such as `''` or `0`. */
|
|
219
|
+
readonly value: string;
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
14
222
|
//#region src/control-api/types.d.ts
|
|
15
223
|
/**
|
|
16
224
|
* Options for creating a control client.
|
|
@@ -45,7 +253,7 @@ type CreateControlClient = (options: ControlClientOptions) => ControlClient;
|
|
|
45
253
|
/**
|
|
46
254
|
* Action names for control-api operations that can emit progress events.
|
|
47
255
|
*/
|
|
48
|
-
type ControlActionName = 'dbInit' | 'dbUpdate' | 'dbVerify' | '
|
|
256
|
+
type ControlActionName = 'dbInit' | 'dbUpdate' | 'dbVerify' | 'dbSign' | 'migrate' | 'verify' | 'schemaVerify' | 'introspect' | 'emit';
|
|
49
257
|
/**
|
|
50
258
|
* Progress event emitted during control-api operation execution.
|
|
51
259
|
*
|
|
@@ -113,33 +321,17 @@ interface SchemaVerifyOptions {
|
|
|
113
321
|
/** Optional progress callback for observing operation progress */
|
|
114
322
|
readonly onProgress?: OnControlProgress;
|
|
115
323
|
}
|
|
116
|
-
/**
|
|
117
|
-
|
|
118
|
-
*/
|
|
119
|
-
|
|
120
|
-
/** Contract or unvalidated JSON - validated at runtime via familyInstance.deserializeContract() */
|
|
121
|
-
readonly contract: unknown;
|
|
122
|
-
/**
|
|
123
|
-
* Path to the contract file (for metadata in the result).
|
|
124
|
-
*/
|
|
125
|
-
readonly contractPath?: string;
|
|
126
|
-
/**
|
|
127
|
-
* Path to the config file (for metadata in the result).
|
|
128
|
-
*/
|
|
129
|
-
readonly configPath?: string;
|
|
130
|
-
/**
|
|
131
|
-
* Database connection. If provided, sign will connect before executing.
|
|
132
|
-
* If omitted, the client must already be connected.
|
|
133
|
-
* The type is driver-specific (e.g., string URL for Postgres).
|
|
134
|
-
*/
|
|
135
|
-
readonly connection?: unknown;
|
|
136
|
-
/** Optional progress callback for observing operation progress */
|
|
137
|
-
readonly onProgress?: OnControlProgress;
|
|
324
|
+
/** Receives the warnings the planner raised about a run's plan without refusing it. */
|
|
325
|
+
interface PlannerWarningsListener {
|
|
326
|
+
/** Called once per run, after planning, when the planner raised warnings, whether the apply then succeeds or fails. */
|
|
327
|
+
readonly onPlannerWarnings?: (warnings: readonly MigrationPlannerConflict[]) => void;
|
|
138
328
|
}
|
|
139
329
|
/**
|
|
140
330
|
* Options for the dbInit operation.
|
|
141
331
|
*/
|
|
142
|
-
interface DbInitOptions {
|
|
332
|
+
interface DbInitOptions extends PlannerWarningsListener {
|
|
333
|
+
/** The command line the advice of a failure repeats: its directory, `--config` and whether `--db` was given. */
|
|
334
|
+
readonly invocation: CliInvocation;
|
|
143
335
|
/** Contract or unvalidated JSON - validated at runtime via familyInstance.deserializeContract() */
|
|
144
336
|
readonly contract: unknown;
|
|
145
337
|
/**
|
|
@@ -167,7 +359,9 @@ interface DbInitOptions {
|
|
|
167
359
|
/**
|
|
168
360
|
* Options for the dbUpdate operation.
|
|
169
361
|
*/
|
|
170
|
-
interface DbUpdateOptions {
|
|
362
|
+
interface DbUpdateOptions extends PlannerWarningsListener {
|
|
363
|
+
/** The command line the advice of a failure repeats: its directory, `--config` and whether `--db` was given. */
|
|
364
|
+
readonly invocation: CliInvocation;
|
|
171
365
|
/** Contract or unvalidated JSON - validated at runtime via familyInstance.deserializeContract() */
|
|
172
366
|
readonly contract: unknown;
|
|
173
367
|
/**
|
|
@@ -182,24 +376,10 @@ interface DbUpdateOptions {
|
|
|
182
376
|
* The type is driver-specific (e.g., string URL for Postgres).
|
|
183
377
|
*/
|
|
184
378
|
readonly connection?: unknown;
|
|
185
|
-
/**
|
|
186
|
-
* When true, allows applying plans that contain destructive operations
|
|
187
|
-
* (e.g., DROP TABLE, DROP COLUMN, ALTER TYPE).
|
|
188
|
-
* When false (default), the operation returns a failure if the plan
|
|
189
|
-
* includes destructive operations, which `db update` turns into its consent
|
|
190
|
-
* prompt: the user types the database name, or passes `--confirm <database>`
|
|
191
|
-
* where there is nobody to ask.
|
|
192
|
-
*/
|
|
379
|
+
/** Consents to every operation that would lose data, without asking. */
|
|
193
380
|
readonly acceptDataLoss?: boolean;
|
|
194
|
-
/**
|
|
195
|
-
|
|
196
|
-
* named, identified by that refusal's `planHash`. The apply recomputes its
|
|
197
|
-
* plan and refuses with `CONSENT_PLAN_MISMATCH` when the fresh plan is not
|
|
198
|
-
* the one that was consented to.
|
|
199
|
-
*/
|
|
200
|
-
readonly consent?: {
|
|
201
|
-
readonly planHash: string;
|
|
202
|
-
};
|
|
381
|
+
/** Consents to every operation that would change who can read or write data, without asking. */
|
|
382
|
+
readonly acceptAccessChanges?: boolean;
|
|
203
383
|
/**
|
|
204
384
|
* On-disk migrations directory. Always required — every `db update`
|
|
205
385
|
* routes through the per-space flow, which reads on-disk
|
|
@@ -207,6 +387,20 @@ interface DbUpdateOptions {
|
|
|
207
387
|
* root.
|
|
208
388
|
*/
|
|
209
389
|
readonly migrationsDir: string;
|
|
390
|
+
/**
|
|
391
|
+
* The statements as the user wrote them, in the order given. A `rename`
|
|
392
|
+
* resolves against the contract the database marker names, read from the
|
|
393
|
+
* snapshot store, and the destination contract; a `delete` or `allow`
|
|
394
|
+
* answers the question about the subject it names.
|
|
395
|
+
*/
|
|
396
|
+
readonly statements?: readonly StatementText[];
|
|
397
|
+
/**
|
|
398
|
+
* Asks, before an apply, what each operation that would lose data means and
|
|
399
|
+
* whether each that would change who can read or write data may run, for the
|
|
400
|
+
* questions no statement answered. The `db update` command asks through its
|
|
401
|
+
* prompt.
|
|
402
|
+
*/
|
|
403
|
+
readonly answerQuestions: AnswerPlanQuestions;
|
|
210
404
|
/** Optional progress callback for observing operation progress */
|
|
211
405
|
readonly onProgress?: OnControlProgress;
|
|
212
406
|
}
|
|
@@ -233,6 +427,16 @@ interface DbVerifyOptions {
|
|
|
233
427
|
readonly connection?: unknown;
|
|
234
428
|
readonly onProgress?: OnControlProgress;
|
|
235
429
|
}
|
|
430
|
+
/**
|
|
431
|
+
* Options for the dbSign operation.
|
|
432
|
+
*/
|
|
433
|
+
interface DbSignOptions {
|
|
434
|
+
/** The app space's contract, already deserialized through the family seam. */
|
|
435
|
+
readonly contract: Contract;
|
|
436
|
+
readonly migrationsDir: string;
|
|
437
|
+
readonly connection?: unknown;
|
|
438
|
+
readonly onProgress?: OnControlProgress;
|
|
439
|
+
}
|
|
236
440
|
/**
|
|
237
441
|
* Options for the introspect operation.
|
|
238
442
|
*/
|
|
@@ -351,43 +555,26 @@ interface DbInitSuccess {
|
|
|
351
555
|
*/
|
|
352
556
|
readonly perSpace?: ReadonlyArray<PerSpaceExecutionEntry>;
|
|
353
557
|
readonly summary: string;
|
|
354
|
-
readonly warnings?: ReadonlyArray<MigrationPlannerConflict>;
|
|
355
558
|
}
|
|
356
|
-
/**
|
|
357
|
-
|
|
358
|
-
*/
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
interface DbInitFailure {
|
|
364
|
-
readonly code: DbInitFailureCode;
|
|
365
|
-
readonly summary: string;
|
|
366
|
-
readonly why: string | undefined;
|
|
367
|
-
readonly conflicts: ReadonlyArray<MigrationPlannerConflict> | undefined;
|
|
368
|
-
readonly warnings?: ReadonlyArray<MigrationPlannerConflict>;
|
|
369
|
-
readonly meta: Record<string, unknown> | undefined;
|
|
370
|
-
/** Underlying failure or error for diagnostics; never serialized into envelopes. */
|
|
371
|
-
readonly cause?: unknown;
|
|
372
|
-
readonly marker?: {
|
|
373
|
-
readonly storageHash?: string;
|
|
374
|
-
readonly profileHash?: string;
|
|
375
|
-
};
|
|
376
|
-
readonly destination?: {
|
|
377
|
-
readonly storageHash: string;
|
|
378
|
-
readonly profileHash?: string | undefined;
|
|
379
|
-
};
|
|
559
|
+
/** The result of `db init`: a failure is the structured error the command reports. */
|
|
560
|
+
type DbInitResult = Result<DbInitSuccess, CliStructuredError$2>;
|
|
561
|
+
/** An operation an apply asks about, with its subject written as the question writes it: `User.nickname`. */
|
|
562
|
+
interface AskedSubject extends MigrationOperationSubject {
|
|
563
|
+
readonly text: string;
|
|
564
|
+
/** The subject's namespace when the destination removed it: a `--delete` of it answers the question. */
|
|
565
|
+
readonly removedNamespace?: string;
|
|
380
566
|
}
|
|
381
|
-
/**
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
type DbInitResult = Result<DbInitSuccess, DbInitFailure>;
|
|
567
|
+
/** An operation an apply asks about because it loses its subject's data. */
|
|
568
|
+
interface AskedDataLoss extends AskedSubject, MigrationDataLoss {}
|
|
569
|
+
/** An operation an apply asks about because it changes who can read or write its subject's data. */
|
|
570
|
+
interface AskedAccessChange extends AskedSubject, MigrationAccessChange {}
|
|
386
571
|
/**
|
|
387
572
|
* Successful dbUpdate result.
|
|
388
573
|
*/
|
|
389
|
-
interface DbUpdateSuccess {
|
|
574
|
+
interface DbUpdateSuccess extends MigrationPlanSubjects<AskedDataLoss, AskedAccessChange, TemporaryValueReport> {
|
|
390
575
|
readonly mode: 'plan' | 'apply';
|
|
576
|
+
/** The namespaces the application space's plan removes and adds, when its planner reports them. */
|
|
577
|
+
readonly namespaces?: MigrationPlanNamespaces;
|
|
391
578
|
readonly plan: {
|
|
392
579
|
readonly operations: ReadonlyArray<{
|
|
393
580
|
readonly id: string;
|
|
@@ -420,61 +607,17 @@ interface DbUpdateSuccess {
|
|
|
420
607
|
* alphabetically, then app). See {@link PerSpaceExecutionEntry}.
|
|
421
608
|
*/
|
|
422
609
|
readonly perSpace?: ReadonlyArray<PerSpaceExecutionEntry>;
|
|
610
|
+
/** The statements the application space's plan applied, in order; empty when none were given. */
|
|
611
|
+
readonly appliedStatements: readonly AppliedStatementReport[];
|
|
612
|
+
/**
|
|
613
|
+
* The storage hash of the contract the database was at before the run, when a migration of the
|
|
614
|
+
* graph ends at it: the origin a `migration plan` for this database starts from.
|
|
615
|
+
*/
|
|
616
|
+
readonly databaseStorageHash?: string;
|
|
423
617
|
readonly summary: string;
|
|
424
|
-
readonly warnings?: ReadonlyArray<MigrationPlannerConflict>;
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Failure codes for dbUpdate operation.
|
|
428
|
-
*/
|
|
429
|
-
type DbUpdateFailureCode = 'PLANNING_FAILED' | 'RUNNER_FAILED' | 'DESTRUCTIVE_CHANGES' | 'CONSENT_PLAN_MISMATCH';
|
|
430
|
-
/** One planned operation whose class is destructive, as the refusal names it. */
|
|
431
|
-
interface DestructivePlanOperation {
|
|
432
|
-
readonly id: string;
|
|
433
|
-
readonly label: string;
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* The verdict a `DESTRUCTIVE_CHANGES` refusal carries: what the plan would
|
|
437
|
-
* destroy, the database it would destroy it in, and the identity of the plan
|
|
438
|
-
* that was refused. Consent is granted against `planHash` — the caller passes
|
|
439
|
-
* it back as `DbUpdateOptions.consent`.
|
|
440
|
-
*/
|
|
441
|
-
interface DestructiveChangesVerdict {
|
|
442
|
-
readonly destructiveOperations: ReadonlyArray<DestructivePlanOperation>;
|
|
443
|
-
/** The connected database's name, when the driver can name it. */
|
|
444
|
-
readonly databaseName: string | undefined;
|
|
445
|
-
/** Content hash of the refused plan. */
|
|
446
|
-
readonly planHash: string;
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Why an apply carrying consent was refused: the plan recomputed for the
|
|
450
|
-
* apply is not the plan that was consented to.
|
|
451
|
-
*/
|
|
452
|
-
interface ConsentPlanMismatchVerdict {
|
|
453
|
-
readonly consentedPlanHash: string;
|
|
454
|
-
readonly planHash: string;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Failure details for dbUpdate operation.
|
|
458
|
-
*/
|
|
459
|
-
interface DbUpdateFailure {
|
|
460
|
-
readonly code: DbUpdateFailureCode;
|
|
461
|
-
readonly summary: string;
|
|
462
|
-
readonly why: string | undefined;
|
|
463
|
-
readonly conflicts: ReadonlyArray<MigrationPlannerConflict> | undefined;
|
|
464
|
-
readonly warnings?: ReadonlyArray<MigrationPlannerConflict>;
|
|
465
|
-
readonly meta: Record<string, unknown> | undefined;
|
|
466
|
-
/** Present exactly when `code` is `'DESTRUCTIVE_CHANGES'`. */
|
|
467
|
-
readonly destructiveChanges?: DestructiveChangesVerdict;
|
|
468
|
-
/** Present exactly when `code` is `'CONSENT_PLAN_MISMATCH'`. */
|
|
469
|
-
readonly consentPlanMismatch?: ConsentPlanMismatchVerdict;
|
|
470
|
-
/** Underlying failure or error for diagnostics; never serialized into envelopes. */
|
|
471
|
-
readonly cause?: unknown;
|
|
472
618
|
}
|
|
473
|
-
/**
|
|
474
|
-
|
|
475
|
-
* Uses Result pattern: success returns DbUpdateSuccess, failure returns DbUpdateFailure.
|
|
476
|
-
*/
|
|
477
|
-
type DbUpdateResult = Result<DbUpdateSuccess, DbUpdateFailure>;
|
|
619
|
+
/** The result of `db update`: a failure is the structured error the command reports. */
|
|
620
|
+
type DbUpdateResult = Result<DbUpdateSuccess, CliStructuredError$2>;
|
|
478
621
|
/**
|
|
479
622
|
* Successful emit result.
|
|
480
623
|
* Contains the hashes and paths of emitted files.
|
|
@@ -490,6 +633,8 @@ interface EmitSuccess {
|
|
|
490
633
|
readonly contractJson: string;
|
|
491
634
|
/** The emitted contract TypeScript declarations */
|
|
492
635
|
readonly contractDts: string;
|
|
636
|
+
/** Warnings the contract source reported while producing the contract. Undefined when there were none. */
|
|
637
|
+
readonly sourceWarnings?: readonly ContractSourceDiagnostic[];
|
|
493
638
|
}
|
|
494
639
|
/**
|
|
495
640
|
* Failure codes for emit operation.
|
|
@@ -502,6 +647,7 @@ interface EmitFailure {
|
|
|
502
647
|
readonly code: EmitFailureCode;
|
|
503
648
|
readonly summary: string;
|
|
504
649
|
readonly why: string | undefined;
|
|
650
|
+
/** For `CONTRACT_SOURCE_INVALID` from a structured error the source threw, such as `CONTRACT.DEFAULT_INVALID` from a TypeScript builder, `meta` holds that error's `code` and its own `meta`, `reason` included. */
|
|
505
651
|
readonly meta: Record<string, unknown> | undefined;
|
|
506
652
|
readonly diagnostics?: ContractSourceDiagnostics;
|
|
507
653
|
}
|
|
@@ -522,6 +668,8 @@ type EmitResult = Result<EmitSuccess, EmitFailure>;
|
|
|
522
668
|
* envelope, app-space migration packages) and hands the inputs in.
|
|
523
669
|
*/
|
|
524
670
|
interface MigrateOptions {
|
|
671
|
+
/** The command line the advice of a failure repeats: its directory, `--config` and whether `--db` was given. */
|
|
672
|
+
readonly invocation: CliInvocation;
|
|
525
673
|
/** Already-validated app contract (the canonical "where we are heading" hash). */
|
|
526
674
|
readonly contract: unknown;
|
|
527
675
|
/** Migrations root directory (`migrations/` under the project). */
|
|
@@ -624,30 +772,13 @@ interface MigrateSuccess {
|
|
|
624
772
|
*/
|
|
625
773
|
readonly pathDecision?: MigratePathDecision;
|
|
626
774
|
}
|
|
627
|
-
/**
|
|
628
|
-
|
|
629
|
-
*/
|
|
630
|
-
type MigrateFailureCode = 'RUNNER_FAILED' | 'MIGRATION_PATH_NOT_FOUND';
|
|
631
|
-
/**
|
|
632
|
-
* Failure details for migrate operation.
|
|
633
|
-
*/
|
|
634
|
-
interface MigrateFailure {
|
|
635
|
-
readonly code: MigrateFailureCode;
|
|
636
|
-
readonly summary: string;
|
|
637
|
-
readonly why: string | undefined;
|
|
638
|
-
readonly meta: Record<string, unknown> | undefined;
|
|
639
|
-
/** Underlying failure or error for diagnostics; never serialized into envelopes. */
|
|
640
|
-
readonly cause?: unknown;
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Result type for migrate operation.
|
|
644
|
-
*/
|
|
645
|
-
type MigrateResult = Result<MigrateSuccess, MigrateFailure>;
|
|
775
|
+
/** The result of `db migrate`: a failure is the structured error the command reports. */
|
|
776
|
+
type MigrateResult = Result<MigrateSuccess, CliStructuredError$2>;
|
|
646
777
|
/**
|
|
647
778
|
* Options for the standalone executeContractEmit function.
|
|
648
779
|
*
|
|
649
780
|
* `executeContractEmit` is the canonical publication path for both the
|
|
650
|
-
* `prisma
|
|
781
|
+
* `prisma contract emit` CLI command and the `@internal/vite-plugin-contract-emit`
|
|
651
782
|
* Vite plugin. Do not duplicate the load → emit → publish dance elsewhere; if a
|
|
652
783
|
* caller needs additional behavior, extend this options shape and update the
|
|
653
784
|
* single implementation rather than building a parallel publication path.
|
|
@@ -661,13 +792,13 @@ interface ContractEmitOptions {
|
|
|
661
792
|
/** Directory the caller was invoked from. */
|
|
662
793
|
readonly cwd: string;
|
|
663
794
|
/**
|
|
664
|
-
*
|
|
665
|
-
*
|
|
666
|
-
*
|
|
667
|
-
*
|
|
795
|
+
* The project's directory, normally the validated config's `baseDir`. Used
|
|
796
|
+
* to find the project manifest whose dependencies decide the import
|
|
797
|
+
* specifiers in emitted files. Omit it and the manifest is looked up from
|
|
798
|
+
* the directory the artifacts are written to, which is the package that
|
|
668
799
|
* will import them.
|
|
669
800
|
*/
|
|
670
|
-
readonly
|
|
801
|
+
readonly projectDir?: string;
|
|
671
802
|
/**
|
|
672
803
|
* Directory to write contract artifacts into. When set, `contract.json` and
|
|
673
804
|
* `contract.d.ts` are written inside this directory, taking precedence over
|
|
@@ -707,9 +838,11 @@ interface ContractEmitResult {
|
|
|
707
838
|
* not write to stderr itself. Undefined when no warning was raised.
|
|
708
839
|
*/
|
|
709
840
|
readonly validationWarning?: string;
|
|
841
|
+
/** Warnings the contract source reported while producing the contract. Undefined when there were none. */
|
|
842
|
+
readonly sourceWarnings?: readonly ContractSourceDiagnostic[];
|
|
710
843
|
}
|
|
711
844
|
/**
|
|
712
|
-
* Programmatic control client for Prisma
|
|
845
|
+
* Programmatic control client for Prisma ORM operations.
|
|
713
846
|
*
|
|
714
847
|
* Lifecycle: `connect(connection)` before operations, `close()` when done.
|
|
715
848
|
* Both `init()` and `connect()` are auto-called by operations if needed,
|
|
@@ -738,7 +871,7 @@ interface ControlClient {
|
|
|
738
871
|
* @throws If connection fails, already connected, driver is not configured,
|
|
739
872
|
* or no connection provided and no default connection in options.
|
|
740
873
|
*/
|
|
741
|
-
connect(connection?: unknown): Promise<void>;
|
|
874
|
+
connect(connection?: unknown, options?: ControlDriverConnectOptions): Promise<void>;
|
|
742
875
|
/**
|
|
743
876
|
* Closes the database connection.
|
|
744
877
|
* Idempotent (safe to call multiple times).
|
|
@@ -761,15 +894,6 @@ interface ControlClient {
|
|
|
761
894
|
* @throws If not connected or infrastructure failure
|
|
762
895
|
*/
|
|
763
896
|
schemaVerify(options: SchemaVerifyOptions): Promise<VerifyDatabaseSchemaResult>;
|
|
764
|
-
/**
|
|
765
|
-
* Signs the database with a contract signature.
|
|
766
|
-
* Writes or updates the signature if schema verification passes.
|
|
767
|
-
* Idempotent (no-op if signature already matches).
|
|
768
|
-
*
|
|
769
|
-
* @returns Structured result
|
|
770
|
-
* @throws If not connected or infrastructure failure
|
|
771
|
-
*/
|
|
772
|
-
sign(options: SignOptions): Promise<SignDatabaseResult>;
|
|
773
897
|
/**
|
|
774
898
|
* Initializes database schema from contract.
|
|
775
899
|
* Uses additive-only policy (no destructive changes).
|
|
@@ -803,6 +927,13 @@ interface ControlClient {
|
|
|
803
927
|
* @throws If not connected or infrastructure failure
|
|
804
928
|
*/
|
|
805
929
|
dbVerify(options: DbVerifyOptions): Promise<ExecuteDbVerifyResult>;
|
|
930
|
+
/**
|
|
931
|
+
* Verifies every contract space (app and extensions) against the live schema without strict mode, then signs every space that verified, in one transaction where the family supports one.
|
|
932
|
+
*
|
|
933
|
+
* @returns Result pattern: each space's outcome on success; structured CLI error on loader failure.
|
|
934
|
+
* @throws If not connected or infrastructure failure
|
|
935
|
+
*/
|
|
936
|
+
dbSign(options: DbSignOptions): Promise<ExecuteDbSignResult>;
|
|
806
937
|
/**
|
|
807
938
|
* Reads the contract marker from the database.
|
|
808
939
|
* Returns null if no marker exists (fresh database).
|
|
@@ -858,7 +989,7 @@ interface ControlClient {
|
|
|
858
989
|
* @param schemaIR - The schema IR from introspect()
|
|
859
990
|
* @returns PslDocumentAst if the family supports the capability, undefined otherwise
|
|
860
991
|
*/
|
|
861
|
-
inferPslContract(schemaIR: unknown): PslDocumentAst | undefined
|
|
992
|
+
inferPslContract(schemaIR: unknown): Promise<PslDocumentAst | undefined>;
|
|
862
993
|
/**
|
|
863
994
|
* Returns the assembled PSL block descriptors from the control stack — the full
|
|
864
995
|
* set of extension-contributed top-level block descriptors. The CLI's
|
|
@@ -884,80 +1015,49 @@ interface ControlClient {
|
|
|
884
1015
|
* @returns Result pattern: Ok with emit details, NotOk with failure details
|
|
885
1016
|
*/
|
|
886
1017
|
emit(options: EmitOptions): Promise<EmitResult>;
|
|
1018
|
+
/**
|
|
1019
|
+
* Renders the `contract.d.ts` text for a `contract.json` that was already
|
|
1020
|
+
* emitted. A snapshot of a contract is that JSON plus these declarations, so
|
|
1021
|
+
* whoever writes a snapshot renders them from the JSON it is storing rather
|
|
1022
|
+
* than reading a sibling file that may have drifted or gone missing.
|
|
1023
|
+
* Offline: uses `init()` but never `connect()`.
|
|
1024
|
+
*/
|
|
1025
|
+
renderContractDts(options: RenderContractDtsOptions): Promise<RenderContractDtsResult>;
|
|
887
1026
|
}
|
|
888
1027
|
//#endregion
|
|
889
|
-
//#region src/control-api/operations/db-
|
|
890
|
-
|
|
891
|
-
* Inputs for the aggregate `db verify` operation.
|
|
892
|
-
*
|
|
893
|
-
* Loader → verifier pipeline. The loader (sole descriptor-import
|
|
894
|
-
* boundary) builds a {@link import('@prisma/orm-toolchain/migration-tools/aggregate').ContractSpaceAggregate};
|
|
895
|
-
* the aggregate verifier bundles `markerCheck` + per-space `schemaCheck`
|
|
896
|
-
* (each contract space verified against the full schema; extras stripped to its own view).
|
|
897
|
-
* `mode: 'strict' | 'lenient'` maps directly to the user facing `--strict` flag.
|
|
898
|
-
*/
|
|
899
|
-
interface ExecuteDbVerifyOptions<TFamilyId extends string, TTargetId extends string> {
|
|
1028
|
+
//#region src/control-api/operations/db-sign.d.ts
|
|
1029
|
+
interface ExecuteDbSignOptions<TFamilyId extends string, TTargetId extends string> {
|
|
900
1030
|
readonly driver: ControlDriverInstance<TFamilyId, TTargetId>;
|
|
901
1031
|
readonly familyInstance: ControlFamilyInstance<TFamilyId, unknown>;
|
|
1032
|
+
/** The app space's contract, already deserialized. */
|
|
902
1033
|
readonly contract: Contract;
|
|
903
1034
|
readonly migrationsDir: string;
|
|
904
1035
|
readonly targetId: TTargetId;
|
|
905
1036
|
readonly extensions: ReadonlyArray<ControlExtensionDescriptor<TFamilyId, TTargetId>>;
|
|
906
1037
|
readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;
|
|
907
|
-
readonly
|
|
908
|
-
readonly skipSchema: boolean;
|
|
909
|
-
readonly skipMarker: boolean;
|
|
1038
|
+
readonly verifySnapshotContent?: SnapshotContentVerifier;
|
|
910
1039
|
readonly onProgress?: OnControlProgress;
|
|
911
1040
|
}
|
|
1041
|
+
/** A space `db sign` did not sign because the live schema does not satisfy its contract; its marker is left as it was. */
|
|
1042
|
+
interface DbSignSpaceFailure {
|
|
1043
|
+
readonly space: string;
|
|
1044
|
+
readonly status: 'failed';
|
|
1045
|
+
readonly contract: MarkerHashes;
|
|
1046
|
+
readonly schema: VerifyDatabaseSchemaResult;
|
|
1047
|
+
}
|
|
912
1048
|
/**
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
* Marker drift keeps the envelope shape the legacy
|
|
916
|
-
* `runContractSpaceVerifierMarkerCheck` emitted, but rides the success value
|
|
917
|
-
* as {@link ExecuteDbVerifySuccess.markerDrift}: the check ran to completion,
|
|
918
|
-
* so drift is a finding for the caller to settle, not a failure to run.
|
|
919
|
-
*
|
|
920
|
-
* On success, the per-space verify results are returned for the CLI to
|
|
921
|
-
* render. When `skipSchema` is true (`--marker-only`), the schema map
|
|
922
|
-
* is empty.
|
|
1049
|
+
* What `db sign` did with one contract space: what the family's signing did to its marker ({@link SpaceSignature}), or `failed` when the live schema does not satisfy the space's contract.
|
|
923
1050
|
*/
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
/**
|
|
927
|
-
|
|
928
|
-
* once for the whole database (never per space). Strict mode fails on a
|
|
929
|
-
* non-empty list; lenient mode surfaces it informationally.
|
|
930
|
-
*/
|
|
931
|
-
readonly unclaimed: readonly string[];
|
|
932
|
-
readonly spaceOrder: readonly string[];
|
|
933
|
-
readonly appSpaceId: string;
|
|
934
|
-
/**
|
|
935
|
-
* Per-space marker drift the verifier found — a hash mismatch, missing
|
|
936
|
-
* invariants, an orphan marker row — as the violation envelope. The check
|
|
937
|
-
* completed and this is its verdict, so it rides the success value: callers
|
|
938
|
-
* settle it as a finding, while the failure lane stays reserved for a check
|
|
939
|
-
* that could not run (loader violations, introspection failure).
|
|
940
|
-
*/
|
|
941
|
-
readonly markerDrift: CliStructuredError$2 | null;
|
|
1051
|
+
type DbSignSpaceOutcome = SpaceSignature | DbSignSpaceFailure;
|
|
1052
|
+
interface ExecuteDbSignSuccess {
|
|
1053
|
+
/** The app space first, then each extension space in declaration order. */
|
|
1054
|
+
readonly spaces: readonly DbSignSpaceOutcome[];
|
|
942
1055
|
}
|
|
943
|
-
type
|
|
1056
|
+
type ExecuteDbSignResult = Result<ExecuteDbSignSuccess, CliStructuredError$2>;
|
|
944
1057
|
/**
|
|
945
|
-
*
|
|
946
|
-
* `marker-only`, `schema-only`).
|
|
947
|
-
*
|
|
948
|
-
* 1. **Load**: build a {@link import('@prisma/orm-toolchain/migration-tools/aggregate').ContractSpaceAggregate}
|
|
949
|
-
* from descriptors + on-disk on-disk artefacts. Layout / drift /
|
|
950
|
-
* integrity / disjointness violations short-circuit with a
|
|
951
|
-
* structured CLI error.
|
|
952
|
-
* 2. **Read DB state**: marker rows + (when `skipSchema` is `false`)
|
|
953
|
-
* schema introspection.
|
|
954
|
-
* 3. **Verify**: {@link verifyMigration} returns per-space `markerCheck` +
|
|
955
|
-
* per-space `schemaCheck` (each contract space verified against the full schema,
|
|
956
|
-
* then scoped to its own contract space). Marker drift is returned as the
|
|
957
|
-
* success value's `markerDrift` envelope for callers to settle as a
|
|
958
|
-
* finding. Verify results are returned to the caller verbatim.
|
|
1058
|
+
* Loads the contract-space aggregate and signs it with {@link signContractSpaces}.
|
|
959
1059
|
*/
|
|
960
|
-
declare function
|
|
1060
|
+
declare function executeDbSign<TFamilyId extends string, TTargetId extends string>(options: ExecuteDbSignOptions<TFamilyId, TTargetId>): Promise<ExecuteDbSignResult>;
|
|
961
1061
|
//#endregion
|
|
962
|
-
export {
|
|
963
|
-
//# sourceMappingURL=db-
|
|
1062
|
+
export { ExecuteDbSignResult as A, RenderContractDtsFailure as B, EmitContractConfig as C, EmitResult as D, EmitOptions as E, OnControlProgress as F, SchemaVerifyOptions as G, RenderContractDtsOptions as H, PlanAnswer as I, TemporaryValueReport as J, StatementText as K, PlanQuestion as L, ExecuteDbVerifyResult as M, IntrospectOptions as N, EmitSuccess as O, MigrateResult as P, PlanQuestionVerb as R, DbUpdateSuccess as S, EmitFailureCode as T, RenderContractDtsResult as U, RenderContractDtsFailureCode as V, RenderContractDtsSuccess as W, executeDbSign as X, VerifyOptions as Y, executeDbVerify as Z, DbSignOptions as _, CliInvocation as a, DbUpdateOptions as b, ContractEmitResult as c, ControlClientOptions as d, ControlProgressEvent as f, DbInitSuccess as g, DbInitResult as h, AskedSubject as i, ExecuteDbVerifyOptions as j, ExecuteDbSignOptions as k, ControlActionName as l, DbInitOptions as m, AppliedStatementReport as n, CliStructuredError$2 as o, CreateControlClient as p, StatementVerb as q, AskedDataLoss as r, ContractEmitOptions as s, AnswerPlanQuestions as t, ControlClient as u, DbSignSpaceFailure as v, EmitFailure as w, DbUpdateResult as x, DbSignSpaceOutcome as y, PlannerWarningsListener as z };
|
|
1063
|
+
//# sourceMappingURL=db-sign-gvrl0kFE-D-nTGx88.d.mts.map
|