prisma-next 0.5.0-dev.73 → 0.5.0-dev.75
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/dist/cli.mjs +8 -8
- package/dist/{client-0ZX24FXF.mjs → client-qVH-rEgd.mjs} +433 -236
- package/dist/client-qVH-rEgd.mjs.map +1 -0
- package/dist/{result-handler-DWb1rFS-.mjs → command-helpers-BeZHkxV8.mjs} +22 -24
- package/dist/command-helpers-BeZHkxV8.mjs.map +1 -0
- package/dist/commands/contract-emit.mjs +1 -1
- package/dist/commands/contract-infer.mjs +1 -1
- package/dist/commands/db-init.d.mts.map +1 -1
- package/dist/commands/db-init.mjs +7 -5
- package/dist/commands/db-init.mjs.map +1 -1
- package/dist/commands/db-schema.mjs +5 -4
- package/dist/commands/db-schema.mjs.map +1 -1
- package/dist/commands/db-sign.mjs +6 -5
- package/dist/commands/db-sign.mjs.map +1 -1
- package/dist/commands/db-update.d.mts.map +1 -1
- package/dist/commands/db-update.mjs +7 -5
- package/dist/commands/db-update.mjs.map +1 -1
- package/dist/commands/db-verify.mjs +1 -1
- package/dist/commands/migration-apply.d.mts +29 -17
- package/dist/commands/migration-apply.d.mts.map +1 -1
- package/dist/commands/migration-apply.mjs +35 -129
- package/dist/commands/migration-apply.mjs.map +1 -1
- package/dist/commands/migration-new.mjs +4 -3
- package/dist/commands/migration-new.mjs.map +1 -1
- package/dist/commands/migration-plan.d.mts +19 -1
- package/dist/commands/migration-plan.d.mts.map +1 -1
- package/dist/commands/migration-plan.mjs +2 -2
- package/dist/commands/migration-ref.d.mts +1 -1
- package/dist/commands/migration-ref.mjs +3 -2
- package/dist/commands/migration-ref.mjs.map +1 -1
- package/dist/commands/migration-show.d.mts +1 -1
- package/dist/commands/migration-show.mjs +5 -4
- package/dist/commands/migration-show.mjs.map +1 -1
- package/dist/commands/migration-status.d.mts +104 -1
- package/dist/commands/migration-status.d.mts.map +1 -1
- package/dist/commands/migration-status.mjs +2 -2
- package/dist/{contract-emit-DkMqO7f2.mjs → contract-emit-9DBda5Ou.mjs} +7 -5
- package/dist/{contract-emit-DkMqO7f2.mjs.map → contract-emit-9DBda5Ou.mjs.map} +1 -1
- package/dist/{contract-emit-B3ChISB_.mjs → contract-emit-B77TsJqf.mjs} +4 -15
- package/dist/{contract-emit-B3ChISB_.mjs.map → contract-emit-B77TsJqf.mjs.map} +1 -1
- package/dist/{contract-enrichment-CF6ogEJ_.mjs → contract-enrichment-Dani0mMW.mjs} +1 -1
- package/dist/{contract-enrichment-CF6ogEJ_.mjs.map → contract-enrichment-Dani0mMW.mjs.map} +1 -1
- package/dist/{contract-infer-BDKAE0B0.mjs → contract-infer-BK9YFGEG.mjs} +5 -4
- package/dist/{contract-infer-BDKAE0B0.mjs.map → contract-infer-BK9YFGEG.mjs.map} +1 -1
- package/dist/{db-verify-B4TdDKOI.mjs → db-verify-C0y1PCO2.mjs} +7 -6
- package/dist/{db-verify-B4TdDKOI.mjs.map → db-verify-C0y1PCO2.mjs.map} +1 -1
- package/dist/exports/control-api.d.mts +3 -746
- package/dist/exports/control-api.d.mts.map +1 -1
- package/dist/exports/control-api.mjs +3 -3
- package/dist/exports/index.mjs +1 -1
- package/dist/exports/init-output.mjs +1 -1
- package/dist/extension-pack-inputs-C7xgE-vv.mjs +74 -0
- package/dist/extension-pack-inputs-C7xgE-vv.mjs.map +1 -0
- package/dist/{framework-components-gwAHl7ml.mjs → framework-components-ChqVUxR-.mjs} +1 -1
- package/dist/{framework-components-gwAHl7ml.mjs.map → framework-components-ChqVUxR-.mjs.map} +1 -1
- package/dist/global-flags-Icqpxk23.d.mts +12 -0
- package/dist/global-flags-Icqpxk23.d.mts.map +1 -0
- package/dist/helpers-eqdN8tH6.mjs +25 -0
- package/dist/helpers-eqdN8tH6.mjs.map +1 -0
- package/dist/{init-Deo7U8_U.mjs → init-CoDVPvQ4.mjs} +4 -4
- package/dist/{init-Deo7U8_U.mjs.map → init-CoDVPvQ4.mjs.map} +1 -1
- package/dist/{inspect-live-schema-BAgQMYpD.mjs → inspect-live-schema-CWYxGKlb.mjs} +4 -4
- package/dist/{inspect-live-schema-BAgQMYpD.mjs.map → inspect-live-schema-CWYxGKlb.mjs.map} +1 -1
- package/dist/{migration-command-scaffold-B8J702Uh.mjs → migration-command-scaffold-B5dORFEv.mjs} +4 -4
- package/dist/{migration-command-scaffold-B8J702Uh.mjs.map → migration-command-scaffold-B5dORFEv.mjs.map} +1 -1
- package/dist/{migration-plan-BcKNnTM7.mjs → migration-plan-C6lVaHsO.mjs} +47 -23
- package/dist/migration-plan-C6lVaHsO.mjs.map +1 -0
- package/dist/{migration-status-CjwB2of-.mjs → migration-status-CZ-D5k7k.mjs} +161 -7
- package/dist/migration-status-CZ-D5k7k.mjs.map +1 -0
- package/dist/{migrations-CIK94AJf.mjs → migrations-D_UJnpuW.mjs} +67 -24
- package/dist/migrations-D_UJnpuW.mjs.map +1 -0
- package/dist/{output-DnjfCC_u.mjs → output-B16Kefzx.mjs} +1 -1
- package/dist/{output-DnjfCC_u.mjs.map → output-B16Kefzx.mjs.map} +1 -1
- package/dist/{progress-adapter-xASh41wr.mjs → progress-adapter-DFfvZcYL.mjs} +1 -1
- package/dist/{progress-adapter-xASh41wr.mjs.map → progress-adapter-DFfvZcYL.mjs.map} +1 -1
- package/dist/result-handler-rmPVKIP2.mjs +25 -0
- package/dist/result-handler-rmPVKIP2.mjs.map +1 -0
- package/dist/rolldown-runtime-twds-ZHy.mjs +14 -0
- package/dist/{terminal-ui-zaRDhJnP.mjs → terminal-ui-C_hFNbAn.mjs} +3 -23
- package/dist/terminal-ui-C_hFNbAn.mjs.map +1 -0
- package/dist/types-D7x-IFLO.d.mts +858 -0
- package/dist/types-D7x-IFLO.d.mts.map +1 -0
- package/dist/{verify-BEIa9638.mjs → verify-CiwNWM9N.mjs} +2 -2
- package/dist/{verify-BEIa9638.mjs.map → verify-CiwNWM9N.mjs.map} +1 -1
- package/package.json +10 -10
- package/dist/client-0ZX24FXF.mjs.map +0 -1
- package/dist/migration-plan-BcKNnTM7.mjs.map +0 -1
- package/dist/migration-status-CjwB2of-.mjs.map +0 -1
- package/dist/migrations-CIK94AJf.mjs.map +0 -1
- package/dist/result-handler-DWb1rFS-.mjs.map +0 -1
- package/dist/terminal-ui-zaRDhJnP.mjs.map +0 -1
- /package/dist/{cli-errors-QH8kf-C2.d.mts → cli-errors-B9OBbled.d.mts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-api.d.mts","names":[],"sources":["../../src/control-api/
|
|
1
|
+
{"version":3,"file":"control-api.d.mts","names":[],"sources":["../../src/control-api/client.ts","../../src/control-api/contract-enrichment.ts","../../src/control-api/operations/contract-emit.ts","../../src/control-api/operations/db-init.ts","../../src/control-api/operations/db-update.ts","../../src/utils/emit-queue.ts"],"mappings":";;;;;;;;;;;AA+DA;;;;;iBAAgB,mBAAA,CAAoB,OAAA,EAAS,oBAAA,GAAuB,aAAA;;;;;;iBC4BpD,cAAA,CACd,EAAA,EAAI,QAAA,EACJ,UAAA,EAAY,aAAA,CAAc,8BAAA,oBACzB,QAAA;;;;;;;;AD/BH;;;;;;;;;;;;AC4BA;;;iBC4DsB,mBAAA,CACpB,OAAA,EAAS,mBAAA,GACR,OAAA,CAAQ,kBAAA;;;;;AF1FX;;;;;;;;;;;;AC4BA;;;UE9DiB,oBAAA;EAAA,SACN,MAAA,EAAQ,qBAAA,CAAsB,SAAA,EAAW,SAAA;EAAA,SACzC,cAAA,EAAgB,qBAAA,CAAsB,SAAA;EAAA,SACtC,QAAA,EAAU,QAAA;EAAA,SACV,IAAA;EAAA,SACA,UAAA,EAAY,0BAAA,CACnB,SAAA,EACA,SAAA,EACA,qBAAA,CAAsB,SAAA;EAAA,SAEf,mBAAA,EAAqB,aAAA,CAAc,8BAAA,CAA+B,SAAA,EAAW,SAAA;EFqDtF;;;;EAAA,SEhDS,aAAA;EFkDA;;;;EAAA,SE7CA,QAAA,EAAU,SAAA;EDsGC;;;;;EAAA,SChGX,cAAA,GAAiB,aAAA,CAAc,0BAAA,CAA2B,SAAA,EAAW,SAAA;EDkGtE;EAAA,SChGC,UAAA,GAAa,iBAAA;AAAA;;;;;;;;iBAUF,aAAA,oDAAA,CACpB,OAAA,EAAS,oBAAA,CAAqB,SAAA,EAAW,SAAA,IACxC,OAAA,CAAQ,YAAA;;;;;AHNX;;;;;;;UIrCiB,sBAAA;EAAA,SACN,MAAA,EAAQ,qBAAA,CAAsB,SAAA,EAAW,SAAA;EAAA,SACzC,cAAA,EAAgB,qBAAA,CAAsB,SAAA;EAAA,SACtC,QAAA,EAAU,QAAA;EAAA,SACV,IAAA;EAAA,SACA,UAAA,EAAY,0BAAA,CACnB,SAAA,EACA,SAAA,EACA,qBAAA,CAAsB,SAAA;EAAA,SAEf,mBAAA,EAAqB,aAAA,CAAc,8BAAA,CAA+B,SAAA,EAAW,SAAA;EAAA,SAC7E,cAAA;EAAA,SACA,aAAA;EAAA,SACA,QAAA,EAAU,SAAA;EAAA,SACV,cAAA,GAAiB,aAAA,CAAc,0BAAA,CAA2B,SAAA,EAAW,SAAA;EAAA,SACrE,UAAA,GAAa,iBAAA;AAAA;;;;;;;;;;iBAYF,eAAA,oDAAA,CACpB,OAAA,EAAS,sBAAA,CAAuB,SAAA,EAAW,SAAA,IAC1C,OAAA,CAAQ,cAAA;;;iBChCK,gBAAA,CAAiB,cAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as executeContractEmit, r as disposeEmitQueue } from "../contract-emit-
|
|
2
|
-
import { t as enrichContract } from "../contract-enrichment-
|
|
3
|
-
import { i as executeDbInit, n as executeDbVerify, r as executeDbUpdate, t as createControlClient } from "../client-
|
|
1
|
+
import { n as executeContractEmit, r as disposeEmitQueue } from "../contract-emit-B77TsJqf.mjs";
|
|
2
|
+
import { t as enrichContract } from "../contract-enrichment-Dani0mMW.mjs";
|
|
3
|
+
import { i as executeDbInit, n as executeDbVerify, r as executeDbUpdate, t as createControlClient } from "../client-qVH-rEgd.mjs";
|
|
4
4
|
export { createControlClient, disposeEmitQueue, enrichContract, executeContractEmit, executeDbInit, executeDbUpdate, executeDbVerify };
|
package/dist/exports/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createContractEmitCommand } from "../contract-emit-
|
|
1
|
+
import { t as createContractEmitCommand } from "../contract-emit-9DBda5Ou.mjs";
|
|
2
2
|
import { join, resolve } from "pathe";
|
|
3
3
|
import { existsSync, unlinkSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as InitOutputSchema } from "../output-
|
|
1
|
+
import { t as InitOutputSchema } from "../output-B16Kefzx.mjs";
|
|
2
2
|
export { InitOutputSchema };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//#region src/utils/extension-pack-inputs.ts
|
|
2
|
+
/**
|
|
3
|
+
* Project the CLI's `Config.extensionPacks` array into the canonical
|
|
4
|
+
* {@link ExtensionPackInput} shape. The single `as ExtensionPackLike`
|
|
5
|
+
* structural cast in the CLI lives inside this function.
|
|
6
|
+
*/
|
|
7
|
+
function toExtensionInputs(extensionPacks) {
|
|
8
|
+
return extensionPacks.map((raw) => {
|
|
9
|
+
const pack = raw;
|
|
10
|
+
if (pack.contractSpace === void 0) return {
|
|
11
|
+
id: pack.id,
|
|
12
|
+
targetId: pack.targetId
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
id: pack.id,
|
|
16
|
+
targetId: pack.targetId,
|
|
17
|
+
contractSpace: {
|
|
18
|
+
contractJson: pack.contractSpace.contractJson,
|
|
19
|
+
headRef: pack.contractSpace.headRef,
|
|
20
|
+
migrations: pack.contractSpace.migrations ?? []
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Aggregate-loader projection: surfaces `targetId` + `contractSpace.contractJson`
|
|
27
|
+
* to {@link import('./contract-space-aggregate-loader').buildContractSpaceAggregate}
|
|
28
|
+
* and a `hashByContractJson` map keyed by the same `contractJson` reference
|
|
29
|
+
* the loader hands to its hash callback.
|
|
30
|
+
*/
|
|
31
|
+
function toDeclaredExtensions(inputs) {
|
|
32
|
+
const entries = [];
|
|
33
|
+
const hashByContractJson = /* @__PURE__ */ new Map();
|
|
34
|
+
for (const pack of inputs) if (pack.contractSpace) {
|
|
35
|
+
entries.push({
|
|
36
|
+
id: pack.id,
|
|
37
|
+
targetId: pack.targetId,
|
|
38
|
+
contractSpace: { contractJson: pack.contractSpace.contractJson }
|
|
39
|
+
});
|
|
40
|
+
hashByContractJson.set(pack.contractSpace.contractJson, pack.contractSpace.headRef.hash);
|
|
41
|
+
} else entries.push({
|
|
42
|
+
id: pack.id,
|
|
43
|
+
targetId: pack.targetId
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
entries,
|
|
47
|
+
hashByContractJson
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/** Migrate-time per-space pass projection. */
|
|
51
|
+
function toMigratePassInputs(inputs) {
|
|
52
|
+
return inputs.map((pack) => pack.contractSpace ? {
|
|
53
|
+
id: pack.id,
|
|
54
|
+
contractSpace: {
|
|
55
|
+
contractJson: pack.contractSpace.contractJson,
|
|
56
|
+
headRef: pack.contractSpace.headRef
|
|
57
|
+
}
|
|
58
|
+
} : { id: pack.id });
|
|
59
|
+
}
|
|
60
|
+
/** Extension-migrations materialisation pass projection. */
|
|
61
|
+
function toExtensionMigrationsInputs(inputs) {
|
|
62
|
+
return inputs.map((pack) => pack.contractSpace ? {
|
|
63
|
+
id: pack.id,
|
|
64
|
+
contractSpace: {
|
|
65
|
+
contractJson: pack.contractSpace.contractJson,
|
|
66
|
+
headRef: pack.contractSpace.headRef,
|
|
67
|
+
migrations: pack.contractSpace.migrations
|
|
68
|
+
}
|
|
69
|
+
} : { id: pack.id });
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { toMigratePassInputs as i, toExtensionInputs as n, toExtensionMigrationsInputs as r, toDeclaredExtensions as t };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=extension-pack-inputs-C7xgE-vv.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-pack-inputs-C7xgE-vv.mjs","names":[],"sources":["../src/utils/extension-pack-inputs.ts"],"sourcesContent":["/**\n * Single descriptor-import boundary for CLI consumers of `Config.extensionPacks`.\n *\n * Every CLI command / utility that reads an extension descriptor's\n * `contractSpace` projection (loader, migrate-pass, extension-migrations\n * pass, migration commands) goes through {@link toExtensionInputs}. The\n * structural cast `pack as { contractSpace?: ... }` lives **only** here —\n * downstream code consumes the canonical shape and maps it to its own\n * narrower shape via the per-consumer adapters below.\n *\n * The CLI receives extension descriptors typed against the SQL family\n * (or any other family in the future); this helper only depends on the\n * structural shape of `contractSpace`. SQL-family callers pass the same\n * `contractJson` / `headRef.hash` value through unchanged.\n */\nimport type { DeclaredExtensionEntry } from '@prisma-next/migration-tools/aggregate';\nimport type { MigrationMetadata } from '@prisma-next/migration-tools/metadata';\nimport type { MigrationOps } from '@prisma-next/migration-tools/package';\nimport type { ExtensionMigrationsExtensionInput } from './contract-space-extension-migrations-pass';\nimport type { MigrateExtensionInput } from './contract-space-migrate-pass';\n\n/**\n * In-memory authored migration package shipped by an extension descriptor.\n * Mirrors the `MigrationPackage` shape from\n * `@prisma-next/framework-components/control` minus `dirPath`; redeclared\n * structurally here so the helper does not couple to the SQL family's\n * `ExtensionMigrationPackage` type.\n */\nexport interface DescriptorMigrationPackage {\n readonly dirName: string;\n readonly metadata: MigrationMetadata;\n readonly ops: MigrationOps;\n}\n\n/**\n * The most-general projection of a single declared extension pack\n * needed by the CLI's descriptor-import boundary.\n *\n * - `id` / `targetId` are always present.\n * - `contractSpace` is present only when the extension declares one.\n * When present, it carries the canonical inputs every downstream\n * consumer needs — `contractJson`, `headRef`, and the descriptor's\n * pre-built migration packages.\n */\nexport interface ExtensionPackInput {\n readonly id: string;\n readonly targetId: string;\n readonly contractSpace?: {\n readonly contractJson: unknown;\n readonly headRef: {\n readonly hash: string;\n readonly invariants: readonly string[];\n };\n readonly migrations: readonly DescriptorMigrationPackage[];\n };\n}\n\n/**\n * Structural shape we read off each `Config.extensionPacks` entry.\n *\n * The CLI is the descriptor-import boundary; `extensionPacks` is the only\n * surface where the SQL-family-typed `ControlExtensionDescriptor` flows\n * into framework-neutral helpers. The structural cast lives here, and\n * here alone — every other CLI consumer reads the canonical\n * {@link ExtensionPackInput} shape produced by {@link toExtensionInputs}.\n */\ntype ExtensionPackLike = {\n readonly id: string;\n readonly targetId: string;\n readonly contractSpace?: {\n readonly contractJson: unknown;\n readonly headRef: {\n readonly hash: string;\n readonly invariants: readonly string[];\n };\n readonly migrations?: readonly DescriptorMigrationPackage[];\n };\n};\n\n/**\n * Project the CLI's `Config.extensionPacks` array into the canonical\n * {@link ExtensionPackInput} shape. The single `as ExtensionPackLike`\n * structural cast in the CLI lives inside this function.\n */\nexport function toExtensionInputs(\n extensionPacks: ReadonlyArray<unknown>,\n): readonly ExtensionPackInput[] {\n return extensionPacks.map((raw) => {\n const pack = raw as ExtensionPackLike;\n if (pack.contractSpace === undefined) {\n return { id: pack.id, targetId: pack.targetId };\n }\n return {\n id: pack.id,\n targetId: pack.targetId,\n contractSpace: {\n contractJson: pack.contractSpace.contractJson,\n headRef: pack.contractSpace.headRef,\n migrations: pack.contractSpace.migrations ?? [],\n },\n };\n });\n}\n\n// ---------------------------------------------------------------------------\n// Per-consumer adapters: take the canonical `ExtensionPackInput[]` and\n// project to whatever narrower shape the downstream primitive needs.\n// ---------------------------------------------------------------------------\n\n/**\n * Aggregate-loader projection: surfaces `targetId` + `contractSpace.contractJson`\n * to {@link import('./contract-space-aggregate-loader').buildContractSpaceAggregate}\n * and a `hashByContractJson` map keyed by the same `contractJson` reference\n * the loader hands to its hash callback.\n */\nexport function toDeclaredExtensions(inputs: ReadonlyArray<ExtensionPackInput>): {\n readonly entries: ReadonlyArray<DeclaredExtensionEntry>;\n readonly hashByContractJson: Map<unknown, string>;\n} {\n const entries: DeclaredExtensionEntry[] = [];\n const hashByContractJson = new Map<unknown, string>();\n for (const pack of inputs) {\n if (pack.contractSpace) {\n entries.push({\n id: pack.id,\n targetId: pack.targetId,\n contractSpace: { contractJson: pack.contractSpace.contractJson },\n });\n hashByContractJson.set(pack.contractSpace.contractJson, pack.contractSpace.headRef.hash);\n } else {\n entries.push({ id: pack.id, targetId: pack.targetId });\n }\n }\n return { entries, hashByContractJson };\n}\n\n/** Migrate-time per-space pass projection. */\nexport function toMigratePassInputs(\n inputs: ReadonlyArray<ExtensionPackInput>,\n): readonly MigrateExtensionInput[] {\n return inputs.map((pack) =>\n pack.contractSpace\n ? {\n id: pack.id,\n contractSpace: {\n contractJson: pack.contractSpace.contractJson,\n headRef: pack.contractSpace.headRef,\n },\n }\n : { id: pack.id },\n );\n}\n\n/** Extension-migrations materialisation pass projection. */\nexport function toExtensionMigrationsInputs(\n inputs: ReadonlyArray<ExtensionPackInput>,\n): readonly ExtensionMigrationsExtensionInput[] {\n return inputs.map((pack) =>\n pack.contractSpace\n ? {\n id: pack.id,\n contractSpace: {\n contractJson: pack.contractSpace.contractJson,\n headRef: pack.contractSpace.headRef,\n migrations: pack.contractSpace.migrations,\n },\n }\n : { id: pack.id },\n );\n}\n"],"mappings":";;;;;;AAoFA,SAAgB,kBACd,gBAC+B;CAC/B,OAAO,eAAe,KAAK,QAAQ;EACjC,MAAM,OAAO;EACb,IAAI,KAAK,kBAAkB,KAAA,GACzB,OAAO;GAAE,IAAI,KAAK;GAAI,UAAU,KAAK;GAAU;EAEjD,OAAO;GACL,IAAI,KAAK;GACT,UAAU,KAAK;GACf,eAAe;IACb,cAAc,KAAK,cAAc;IACjC,SAAS,KAAK,cAAc;IAC5B,YAAY,KAAK,cAAc,cAAc,EAAE;IAChD;GACF;GACD;;;;;;;;AAcJ,SAAgB,qBAAqB,QAGnC;CACA,MAAM,UAAoC,EAAE;CAC5C,MAAM,qCAAqB,IAAI,KAAsB;CACrD,KAAK,MAAM,QAAQ,QACjB,IAAI,KAAK,eAAe;EACtB,QAAQ,KAAK;GACX,IAAI,KAAK;GACT,UAAU,KAAK;GACf,eAAe,EAAE,cAAc,KAAK,cAAc,cAAc;GACjE,CAAC;EACF,mBAAmB,IAAI,KAAK,cAAc,cAAc,KAAK,cAAc,QAAQ,KAAK;QAExF,QAAQ,KAAK;EAAE,IAAI,KAAK;EAAI,UAAU,KAAK;EAAU,CAAC;CAG1D,OAAO;EAAE;EAAS;EAAoB;;;AAIxC,SAAgB,oBACd,QACkC;CAClC,OAAO,OAAO,KAAK,SACjB,KAAK,gBACD;EACE,IAAI,KAAK;EACT,eAAe;GACb,cAAc,KAAK,cAAc;GACjC,SAAS,KAAK,cAAc;GAC7B;EACF,GACD,EAAE,IAAI,KAAK,IAAI,CACpB;;;AAIH,SAAgB,4BACd,QAC8C;CAC9C,OAAO,OAAO,KAAK,SACjB,KAAK,gBACD;EACE,IAAI,KAAK;EACT,eAAe;GACb,cAAc,KAAK,cAAc;GACjC,SAAS,KAAK,cAAc;GAC5B,YAAY,KAAK,cAAc;GAChC;EACF,GACD,EAAE,IAAI,KAAK,IAAI,CACpB"}
|
|
@@ -55,4 +55,4 @@ function assertFrameworkComponentsCompatible(expectedFamilyId, expectedTargetId,
|
|
|
55
55
|
//#endregion
|
|
56
56
|
export { assertFrameworkComponentsCompatible as t };
|
|
57
57
|
|
|
58
|
-
//# sourceMappingURL=framework-components-
|
|
58
|
+
//# sourceMappingURL=framework-components-ChqVUxR-.mjs.map
|
package/dist/{framework-components-gwAHl7ml.mjs.map → framework-components-ChqVUxR-.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framework-components-
|
|
1
|
+
{"version":3,"file":"framework-components-ChqVUxR-.mjs","names":[],"sources":["../src/utils/framework-components.ts"],"sourcesContent":["import type { Contract } from '@prisma-next/contract/types';\nimport {\n checkContractComponentRequirements,\n type TargetBoundComponentDescriptor,\n} from '@prisma-next/framework-components/components';\nimport type { ControlStack } from '@prisma-next/framework-components/control';\nimport { errorConfigValidation, errorContractMissingExtensionPacks } from './cli-errors';\n\n/**\n * Asserts that all framework components are compatible with the expected family and target.\n *\n * This function validates that each component in the framework components array:\n * - Has kind 'target', 'adapter', 'extension', or 'driver'\n * - Has familyId matching expectedFamilyId\n * - Has targetId matching expectedTargetId\n *\n * This validation happens at the CLI composition boundary, before passing components\n * to typed planner/runner instances. It fills the gap between runtime validation\n * (via `validateConfig()`) and compile-time type enforcement.\n *\n * @param expectedFamilyId - The expected family ID (e.g., 'sql')\n * @param expectedTargetId - The expected target ID (e.g., 'postgres')\n * @param frameworkComponents - Array of framework components to validate\n * @returns The same array typed as TargetBoundComponentDescriptor\n * @throws CliStructuredError if any component is incompatible\n *\n * @example\n * ```ts\n * const config = await loadConfig();\n * const frameworkComponents = [config.target, config.adapter, ...(config.extensionPacks ?? [])];\n *\n * // Validate and type-narrow components before passing to planner\n * const typedComponents = assertFrameworkComponentsCompatible(\n * config.family.familyId,\n * config.target.targetId,\n * frameworkComponents\n * );\n *\n * const planner = target.migrations.createPlanner(familyInstance);\n * planner.plan({ contract, schema, policy, frameworkComponents: typedComponents });\n * ```\n */\nexport function assertFrameworkComponentsCompatible<\n TFamilyId extends string,\n TTargetId extends string,\n>(\n expectedFamilyId: TFamilyId,\n expectedTargetId: TTargetId,\n frameworkComponents: ReadonlyArray<unknown>,\n): ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>> {\n for (let i = 0; i < frameworkComponents.length; i++) {\n const component = frameworkComponents[i];\n\n // Check that component is an object\n if (typeof component !== 'object' || component === null) {\n throw errorConfigValidation('frameworkComponents[]', {\n why: `Framework component at index ${i} must be an object`,\n });\n }\n\n const record = component as Record<string, unknown>;\n\n // Check kind\n if (!Object.hasOwn(record, 'kind')) {\n throw errorConfigValidation('frameworkComponents[].kind', {\n why: `Framework component at index ${i} must have 'kind' property`,\n });\n }\n\n const kind = record['kind'];\n if (kind !== 'target' && kind !== 'adapter' && kind !== 'extension' && kind !== 'driver') {\n throw errorConfigValidation('frameworkComponents[].kind', {\n why: `Framework component at index ${i} has invalid kind '${String(kind)}' (must be 'target', 'adapter', 'extension', or 'driver')`,\n });\n }\n\n // Check familyId\n if (!Object.hasOwn(record, 'familyId')) {\n throw errorConfigValidation('frameworkComponents[].familyId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'familyId' property`,\n });\n }\n\n const familyId = record['familyId'];\n if (familyId !== expectedFamilyId) {\n throw errorConfigValidation('frameworkComponents[].familyId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) has familyId '${String(familyId)}' but expected '${expectedFamilyId}'`,\n });\n }\n\n // Check targetId\n if (!Object.hasOwn(record, 'targetId')) {\n throw errorConfigValidation('frameworkComponents[].targetId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) must have 'targetId' property`,\n });\n }\n\n const targetId = record['targetId'];\n if (targetId !== expectedTargetId) {\n throw errorConfigValidation('frameworkComponents[].targetId', {\n why: `Framework component at index ${i} (kind: ${String(kind)}) has targetId '${String(targetId)}' but expected '${expectedTargetId}'`,\n });\n }\n }\n\n // Type assertion is safe because we've validated all components above\n return frameworkComponents as ReadonlyArray<TargetBoundComponentDescriptor<TFamilyId, TTargetId>>;\n}\n\n/**\n * Validates that a contract is compatible with the configured target, adapter,\n * and extension packs. Throws on family/target mismatches or missing extension packs.\n *\n * This check ensures the emitted contract matches the CLI config before running\n * commands that depend on the contract (e.g., db verify, db sign).\n *\n * @param contract - The contract to validate (must include targetFamily, target, extensionPacks).\n * @param stack - The control plane stack (target, adapter, driver, extensionPacks).\n *\n * @throws {CliStructuredError} errorConfigValidation when contract.targetFamily or contract.target\n * doesn't match the configured family/target.\n * @throws {CliStructuredError} errorContractMissingExtensionPacks when the contract requires\n * extension packs that are not provided in the config (includes all missing packs in error.meta).\n *\n * @example\n * ```ts\n * import { assertContractRequirementsSatisfied } from './framework-components';\n *\n * const config = await loadConfig();\n * const contract = await loadContractJson(config.contract.output);\n * const stack = createControlStack({ family: config.family, target: config.target, adapter: config.adapter, ... });\n *\n * // Throws if contract is incompatible with config\n * assertContractRequirementsSatisfied({ contract, stack });\n * ```\n */\nexport function assertContractRequirementsSatisfied<\n TFamilyId extends string,\n TTargetId extends string,\n>({\n contract,\n stack,\n}: {\n readonly contract: Pick<Contract, 'targetFamily' | 'target' | 'extensionPacks'>;\n readonly stack: ControlStack<TFamilyId, TTargetId>;\n}): void {\n const providedComponentIds = new Set<string>([\n stack.target.id,\n ...(stack.adapter ? [stack.adapter.id] : []),\n ]);\n for (const extension of stack.extensionPacks) {\n providedComponentIds.add(extension.id);\n }\n\n const result = checkContractComponentRequirements({\n contract,\n expectedTargetFamily: stack.target.familyId,\n expectedTargetId: stack.target.targetId,\n providedComponentIds,\n });\n\n if (result.familyMismatch) {\n throw errorConfigValidation('contract.targetFamily', {\n why: `Contract was emitted for family '${result.familyMismatch.actual}' but CLI config is wired to '${result.familyMismatch.expected}'.`,\n });\n }\n\n if (result.targetMismatch) {\n throw errorConfigValidation('contract.target', {\n why: `Contract target '${result.targetMismatch.actual}' does not match CLI target '${result.targetMismatch.expected}'.`,\n });\n }\n\n if (result.missingExtensionPackIds.length > 0) {\n throw errorContractMissingExtensionPacks({\n missingExtensionPacks: result.missingExtensionPackIds,\n providedComponentIds: [...providedComponentIds],\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,oCAId,kBACA,kBACA,qBACqE;CACrE,KAAK,IAAI,IAAI,GAAG,IAAI,oBAAoB,QAAQ,KAAK;EACnD,MAAM,YAAY,oBAAoB;EAGtC,IAAI,OAAO,cAAc,YAAY,cAAc,MACjD,MAAM,sBAAsB,yBAAyB,EACnD,KAAK,gCAAgC,EAAE,qBACxC,CAAC;EAGJ,MAAM,SAAS;EAGf,IAAI,CAAC,OAAO,OAAO,QAAQ,OAAO,EAChC,MAAM,sBAAsB,8BAA8B,EACxD,KAAK,gCAAgC,EAAE,6BACxC,CAAC;EAGJ,MAAM,OAAO,OAAO;EACpB,IAAI,SAAS,YAAY,SAAS,aAAa,SAAS,eAAe,SAAS,UAC9E,MAAM,sBAAsB,8BAA8B,EACxD,KAAK,gCAAgC,EAAE,qBAAqB,OAAO,KAAK,CAAC,4DAC1E,CAAC;EAIJ,IAAI,CAAC,OAAO,OAAO,QAAQ,WAAW,EACpC,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,KAAK,CAAC,kCAC/D,CAAC;EAGJ,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBACf,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,KAAK,CAAC,kBAAkB,OAAO,SAAS,CAAC,kBAAkB,iBAAiB,IACrI,CAAC;EAIJ,IAAI,CAAC,OAAO,OAAO,QAAQ,WAAW,EACpC,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,KAAK,CAAC,kCAC/D,CAAC;EAGJ,MAAM,WAAW,OAAO;EACxB,IAAI,aAAa,kBACf,MAAM,sBAAsB,kCAAkC,EAC5D,KAAK,gCAAgC,EAAE,UAAU,OAAO,KAAK,CAAC,kBAAkB,OAAO,SAAS,CAAC,kBAAkB,iBAAiB,IACrI,CAAC;;CAKN,OAAO"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/utils/global-flags.d.ts
|
|
2
|
+
interface GlobalFlags {
|
|
3
|
+
readonly json?: boolean;
|
|
4
|
+
readonly quiet?: boolean;
|
|
5
|
+
readonly verbose?: number;
|
|
6
|
+
readonly color?: boolean;
|
|
7
|
+
readonly interactive?: boolean;
|
|
8
|
+
readonly yes?: boolean;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { GlobalFlags as t };
|
|
12
|
+
//# sourceMappingURL=global-flags-Icqpxk23.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-flags-Icqpxk23.d.mts","names":[],"sources":["../src/utils/global-flags.ts"],"mappings":";UAAiB,WAAA;EAAA,SACN,IAAA;EAAA,SACA,KAAA;EAAA,SACA,OAAA;EAAA,SACA,KAAA;EAAA,SACA,WAAA;EAAA,SACA,GAAA;AAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { dim } from "colorette";
|
|
2
|
+
//#region src/utils/formatters/helpers.ts
|
|
3
|
+
/**
|
|
4
|
+
* Checks if verbose output is enabled at the specified level.
|
|
5
|
+
*/
|
|
6
|
+
function isVerbose(flags, level) {
|
|
7
|
+
return (flags.verbose ?? 0) >= level;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates a color-aware formatter function.
|
|
11
|
+
* Returns a function that applies the color only if colors are enabled.
|
|
12
|
+
*/
|
|
13
|
+
function createColorFormatter(useColor, colorFn) {
|
|
14
|
+
return useColor ? colorFn : (text) => text;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Formats text with dim styling if colors are enabled.
|
|
18
|
+
*/
|
|
19
|
+
function formatDim(useColor, text) {
|
|
20
|
+
return useColor ? dim(text) : text;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { formatDim as n, isVerbose as r, createColorFormatter as t };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=helpers-eqdN8tH6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers-eqdN8tH6.mjs","names":[],"sources":["../src/utils/formatters/helpers.ts"],"sourcesContent":["import { dim } from 'colorette';\n\nimport type { GlobalFlags } from '../global-flags';\n\n/**\n * Checks if verbose output is enabled at the specified level.\n */\nexport function isVerbose(flags: GlobalFlags, level: 1 | 2): boolean {\n return (flags.verbose ?? 0) >= level;\n}\n\n/**\n * Creates a color-aware formatter function.\n * Returns a function that applies the color only if colors are enabled.\n */\nexport function createColorFormatter<T extends (text: string) => string>(\n useColor: boolean,\n colorFn: T,\n): (text: string) => string {\n return useColor ? colorFn : (text: string) => text;\n}\n\n/**\n * Formats text with dim styling if colors are enabled.\n */\nexport function formatDim(useColor: boolean, text: string): string {\n return useColor ? dim(text) : text;\n}\n"],"mappings":";;;;;AAOA,SAAgB,UAAU,OAAoB,OAAuB;CACnE,QAAQ,MAAM,WAAW,MAAM;;;;;;AAOjC,SAAgB,qBACd,UACA,SAC0B;CAC1B,OAAO,WAAW,WAAW,SAAiB;;;;;AAMhD,SAAgB,UAAU,UAAmB,MAAsB;CACjE,OAAO,WAAW,IAAI,KAAK,GAAG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as CliStructuredError } from "./cli-errors-D3_sMh2K.mjs";
|
|
2
|
-
import { i as formatErrorOutput, r as formatErrorJson, t as TerminalUI } from "./terminal-ui-
|
|
3
|
-
import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-
|
|
2
|
+
import { i as formatErrorOutput, r as formatErrorJson, t as TerminalUI } from "./terminal-ui-C_hFNbAn.mjs";
|
|
3
|
+
import { i as renderInitOutro, n as buildNextSteps, r as formatInitJson, t as InitOutputSchema } from "./output-B16Kefzx.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { dirname, extname, isAbsolute, join, normalize } from "pathe";
|
|
6
6
|
import * as clack from "@clack/prompts";
|
|
@@ -2031,7 +2031,7 @@ async function runEmit(ctx) {
|
|
|
2031
2031
|
const spinner = ctx.ui.spinner();
|
|
2032
2032
|
spinner.start("Emitting contract...");
|
|
2033
2033
|
try {
|
|
2034
|
-
const { executeContractEmit } = await import("./contract-emit-
|
|
2034
|
+
const { executeContractEmit } = await import("./contract-emit-B77TsJqf.mjs").then((n) => n.t);
|
|
2035
2035
|
await executeContractEmit({ configPath: join(ctx.baseDir, "prisma-next.config.ts") });
|
|
2036
2036
|
spinner.stop("Contract emitted");
|
|
2037
2037
|
} catch (err) {
|
|
@@ -2050,4 +2050,4 @@ function causeMessage(err) {
|
|
|
2050
2050
|
//#endregion
|
|
2051
2051
|
export { runInit };
|
|
2052
2052
|
|
|
2053
|
-
//# sourceMappingURL=init-
|
|
2053
|
+
//# sourceMappingURL=init-CoDVPvQ4.mjs.map
|