@prisma/orm-toolchain 8.0.0-rc.1-dev.46 → 8.0.0-rc.10-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-CPZB020V.mjs → aggregate-B4HKshLQ.mjs} +10 -10
- package/dist/aggregate-B4HKshLQ.mjs.map +1 -0
- package/dist/{aggregate-DLUJLq5Y.d.mts → aggregate-D_eX4zoo.d.mts} +3 -3
- package/dist/{aggregate-DLUJLq5Y.d.mts.map → aggregate-D_eX4zoo.d.mts.map} +1 -1
- package/dist/cli-telemetry.d.mts +8 -7
- package/dist/cli-telemetry.d.mts.map +1 -1
- package/dist/cli-telemetry.mjs +22 -24
- package/dist/cli-telemetry.mjs.map +1 -1
- package/dist/cli.d.mts +2 -6
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +447 -430
- package/dist/cli.mjs.map +1 -1
- package/dist/cli__control-api.d.mts +20 -11
- package/dist/cli__control-api.d.mts.map +1 -1
- package/dist/cli__control-api.mjs +1 -1
- package/dist/cli__control-api__testing.d.mts +1 -1
- package/dist/cli__init-output.mjs +1 -1
- package/dist/cli__migration-cli.mjs +6 -6
- package/dist/cli__migration-cli.mjs.map +1 -1
- package/dist/config-loader.d.mts +1 -1
- package/dist/config-loader.mjs +1 -1
- package/dist/{contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs → contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs} +3 -3
- package/dist/{contract-snapshot-store-B0G1Fw_F-CHc4QfKb.mjs.map → contract-snapshot-store-qGrwlGmt-Cf2NFzRL.mjs.map} +1 -1
- package/dist/{db-verify-BwgNK50T-DGvKgFCK.d.mts → db-verify-Yih5kWtB-B1kv76ec.d.mts} +5 -5
- package/dist/{db-verify-BwgNK50T-DGvKgFCK.d.mts.map → db-verify-Yih5kWtB-B1kv76ec.d.mts.map} +1 -1
- package/dist/{domain-type-generation-bpSO3Y0L-jo2C7LlH.mjs → domain-type-generation-CR9ECUau-DOlKbcaE.mjs} +20 -6
- package/dist/domain-type-generation-CR9ECUau-DOlKbcaE.mjs.map +1 -0
- package/dist/{domain-type-generation-PkAb39ob-Ct8AGqow.d.mts → domain-type-generation-X6-AaL1U-DHEoRf_y.d.mts} +14 -3
- package/dist/domain-type-generation-X6-AaL1U-DHEoRf_y.d.mts.map +1 -0
- package/dist/emitter.d.mts +2 -2
- package/dist/emitter.mjs +2 -2
- package/dist/emitter__domain-type-generation.d.mts +2 -2
- package/dist/emitter__domain-type-generation.mjs +2 -2
- package/dist/{errors-CXbGUWGu-CstQHPh6.mjs → errors-SoLLYLtw-DMxVbVs9.mjs} +9 -9
- package/dist/errors-SoLLYLtw-DMxVbVs9.mjs.map +1 -0
- package/dist/{exports-BZaG8_w_.mjs → exports-BXXeNWlj.mjs} +25 -47
- package/dist/exports-BXXeNWlj.mjs.map +1 -0
- package/dist/exports-CE6OD63o-4Qpqr2W7.mjs +398 -0
- package/dist/exports-CE6OD63o-4Qpqr2W7.mjs.map +1 -0
- package/dist/{exports-8ZUN43ve.mjs → exports-CYa2di3d.mjs} +382 -22
- package/dist/exports-CYa2di3d.mjs.map +1 -0
- package/dist/{graph-membership-BViWUMpP-C4lYYJdU.mjs → graph-membership-DY1Onbc3-CwBd6wuB.mjs} +3 -3
- package/dist/{graph-membership-BViWUMpP-C4lYYJdU.mjs.map → graph-membership-DY1Onbc3-CwBd6wuB.mjs.map} +1 -1
- 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-BHOrDJbI.mjs} +5 -5
- package/dist/import-roots-BHOrDJbI.mjs.map +1 -0
- package/dist/{index-Dgwl8Tzs.d.mts → index-D217lbiW.d.mts} +7 -3
- package/dist/index-D217lbiW.d.mts.map +1 -0
- package/dist/{index-DRs7L6N0.d.mts → index-u5RdrumF.d.mts} +2 -19
- package/dist/index-u5RdrumF.d.mts.map +1 -0
- package/dist/{invariants-CTHy88OP-CYI2a8IO.mjs → invariants-Cww4bv0v-BEiFxmbX.mjs} +3 -3
- package/dist/{invariants-CTHy88OP-CYI2a8IO.mjs.map → invariants-Cww4bv0v-BEiFxmbX.mjs.map} +1 -1
- package/dist/{io-635GlNx1-D3zrw2qu.mjs → io-BmWQNxRP-DQqbcPsS.mjs} +5 -5
- package/dist/{io-635GlNx1-D3zrw2qu.mjs.map → io-BmWQNxRP-DQqbcPsS.mjs.map} +1 -1
- package/dist/{migration-hspPIEeV.mjs → migration-B9w-7dKe.mjs} +4 -4
- package/dist/{migration-hspPIEeV.mjs.map → migration-B9w-7dKe.mjs.map} +1 -1
- package/dist/{migration-graph-_SJImD5V-BURyY1KM.mjs → migration-graph-CW4bMmTz-B5xFtFVB.mjs} +3 -3
- package/dist/{migration-graph-_SJImD5V-BURyY1KM.mjs.map → migration-graph-CW4bMmTz-B5xFtFVB.mjs.map} +1 -1
- package/dist/migration-tools.d.mts +3 -3
- package/dist/migration-tools.mjs +12 -12
- package/dist/migration-tools__aggregate.d.mts +1 -1
- package/dist/migration-tools__aggregate.mjs +1 -1
- package/dist/migration-tools__contract-snapshot-store.mjs +1 -1
- package/dist/migration-tools__errors.mjs +1 -1
- package/dist/migration-tools__invariants.mjs +1 -1
- package/dist/migration-tools__io.mjs +1 -1
- package/dist/migration-tools__migration-graph.mjs +2 -2
- package/dist/migration-tools__migration.mjs +1 -1
- package/dist/migration-tools__ref-resolution.d.mts +1 -1
- package/dist/migration-tools__ref-resolution.mjs +1 -1
- 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/{output-CovTDY14-CUoAqLML.mjs → output-D83nTTpC-XlvN30yS.mjs} +4 -4
- package/dist/{output-CovTDY14-CUoAqLML.mjs.map → output-D83nTTpC-XlvN30yS.mjs.map} +1 -1
- 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 +11 -11
- package/dist/quick-reference-postgres.md +10 -10
- package/dist/readme-mongo.md +6 -6
- package/dist/readme-postgres.md +6 -6
- package/dist/{ref-h6InR6dO-rGfl18Jv.mjs → ref-DcqFmceq-QaUjgZeM.mjs} +190 -87
- package/dist/ref-DcqFmceq-QaUjgZeM.mjs.map +1 -0
- package/dist/{ref-resolution-HeNBXW53.mjs → ref-resolution-BWpwb8_b.mjs} +9 -2
- package/dist/ref-resolution-BWpwb8_b.mjs.map +1 -0
- package/dist/{ref-resolution-COGOSL57.d.mts → ref-resolution-CaHQJXE0.d.mts} +11 -1
- package/dist/ref-resolution-CaHQJXE0.d.mts.map +1 -0
- package/dist/{refs-WK86uYYp-gM8tvWQP.mjs → refs-BpSpzdYB-BcDelHGt.mjs} +9 -9
- package/dist/refs-BpSpzdYB-BcDelHGt.mjs.map +1 -0
- package/dist/{shells-C4HbRAr5.mjs → shells-BIdFZwUY.mjs} +1 -6
- package/dist/shells-BIdFZwUY.mjs.map +1 -0
- package/dist/{spaces-Dj65JrwZ.d.mts → spaces-B20bgxF9.d.mts} +2 -2
- package/dist/{spaces-Dj65JrwZ.d.mts.map → spaces-B20bgxF9.d.mts.map} +1 -1
- package/dist/{spaces-4qMOAYE9.mjs → spaces-BCZiAZQn.mjs} +7 -7
- package/dist/spaces-BCZiAZQn.mjs.map +1 -0
- package/dist/{verify-contract-spaces-DhJTb0zM-B62maCfE.mjs → verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs} +7 -7
- package/dist/{verify-contract-spaces-DhJTb0zM-B62maCfE.mjs.map → verify-contract-spaces-CrxvgpwD-D5LLXGci.mjs.map} +1 -1
- package/dist/vite-plugin-contract-emit.d.mts +1 -1
- package/dist/vite-plugin-contract-emit.mjs +7 -7
- package/dist/vite-plugin-contract-emit.mjs.map +1 -1
- package/package.json +16 -16
- package/dist/aggregate-CPZB020V.mjs.map +0 -1
- 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/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.map +0 -1
- package/dist/import-roots-CNFBPAT1.mjs.map +0 -1
- package/dist/index-DRs7L6N0.d.mts.map +0 -1
- package/dist/index-Dgwl8Tzs.d.mts.map +0 -1
- 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,7 +1,7 @@
|
|
|
1
1
|
import { ImportSpecifierResolver, TypesImportSpec } from "@prisma/orm-framework/components/emission";
|
|
2
2
|
import { ContractField, ContractModelBase, ContractValueObject, CrossReference, JsonValue } from "@prisma/orm-framework/contract/types";
|
|
3
3
|
import { CodecLookup } from "@prisma/orm-framework/components/codec";
|
|
4
|
-
//#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-
|
|
4
|
+
//#region ../../../1-framework/3-tooling/emitter/dist/domain-type-generation-X6-AaL1U.d.mts
|
|
5
5
|
//#region src/domain-type-generation.d.ts
|
|
6
6
|
declare function serializeValue(value: unknown): string;
|
|
7
7
|
declare function serializeObjectKey(key: string): string;
|
|
@@ -49,6 +49,17 @@ type FieldValueSetResolver = (modelName: string, fieldName: string, model: Contr
|
|
|
49
49
|
declare function renderValueSetType(values: readonly JsonValue[], codecId: string, side: 'output' | 'input', codecLookup: CodecLookup | undefined): string | undefined;
|
|
50
50
|
declare function resolveFieldType(field: ContractField, codecLookup?: CodecLookup, resolvedTypeParams?: Record<string, unknown>, resolvedValueSet?: ResolvedFieldValueSet): ResolvedFieldType;
|
|
51
51
|
declare function generateFieldResolvedType(field: ContractField, codecLookup?: CodecLookup, side?: 'input' | 'output'): string;
|
|
52
|
+
type ModelFieldTypeResolvers = {
|
|
53
|
+
readonly codecLookup: CodecLookup | undefined;
|
|
54
|
+
readonly resolveFieldTypeParams: FieldTypeParamsResolver | undefined;
|
|
55
|
+
readonly resolveFieldValueSet: FieldValueSetResolver | undefined;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Resolves one model field's input and output types the way `FieldOutputTypes` /
|
|
59
|
+
* `FieldInputTypes` do: inline type params win over the family resolver, and a family-resolved
|
|
60
|
+
* value set renders as a literal union.
|
|
61
|
+
*/
|
|
62
|
+
declare function resolveModelFieldType(modelName: string, fieldName: string, field: ContractField, model: ContractModelBase, resolvers: ModelFieldTypeResolvers): ResolvedFieldType;
|
|
52
63
|
declare function generateBothFieldTypesMaps(models: Record<string, ContractModelBase> | undefined, codecLookup?: CodecLookup, resolveFieldTypeParams?: FieldTypeParamsResolver, resolveFieldValueSet?: FieldValueSetResolver): ResolvedFieldType;
|
|
53
64
|
declare function generateFieldTypesMapsByNamespace(namespaceModels: ReadonlyArray<readonly [string, Record<string, ContractModelBase>]>, codecLookup?: CodecLookup, resolveFieldTypeParams?: FieldTypeParamsResolver, resolveFieldValueSet?: FieldValueSetResolver): ResolvedFieldType;
|
|
54
65
|
declare function generateFieldOutputTypesMap(models: Record<string, ContractModelBase> | undefined, codecLookup?: CodecLookup, resolveFieldTypeParams?: FieldTypeParamsResolver): string;
|
|
@@ -59,5 +70,5 @@ declare function generateContractFieldDescriptor(fieldName: string, field: Contr
|
|
|
59
70
|
declare function generateValueObjectsDescriptorType(valueObjects: Record<string, ContractValueObject> | undefined): string;
|
|
60
71
|
declare function generateValueObjectTypeAliases(valueObjects: Record<string, ContractValueObject> | undefined, codecLookup?: CodecLookup): string;
|
|
61
72
|
//#endregion
|
|
62
|
-
export {
|
|
63
|
-
//# sourceMappingURL=domain-type-generation-
|
|
73
|
+
export { serializeNamespaceId as A, generateValueObjectsDescriptorType as C, resolveValueObjectType as D, resolveModelFieldType as E, serializeValue as M, serializeCrossReference as O, generateValueObjectTypeAliases as S, resolveFieldType as T, generateModelFieldsType as _, ResolvedFieldValueSet as a, generateRootsType as b, generateCodecTypeIntersection as c, generateFieldOutputTypesMap as d, generateFieldResolvedType as f, generateModelFieldEntry as g, generateImportLines as h, ResolvedFieldType as i, serializeObjectKey as j, serializeExecutionType as k, generateContractFieldDescriptor as l, generateHashTypeAliases as m, FieldValueSetResolver as n, deduplicateImports as o, generateFieldTypesMapsByNamespace as p, ModelFieldTypeResolvers as r, generateBothFieldTypesMaps as s, FieldTypeParamsResolver as t, generateFieldInputTypesMap as u, generateModelRelationsType as v, renderValueSetType as w, generateValueObjectType as x, generateModelsType as y };
|
|
74
|
+
//# sourceMappingURL=domain-type-generation-X6-AaL1U-DHEoRf_y.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain-type-generation-X6-AaL1U-DHEoRf_y.d.mts","names":[],"sources":["../../../../1-framework/3-tooling/emitter/dist/domain-type-generation-X6-AaL1U.d.mts"],"mappings":";;;;;iBAIiB,eAAe;iBACf,mBAAmB;iBACnB,qBAAqB;iBACrB,wBAAwB,KAAK;iBAC7B,kBAAkB,OAAO,eAAe;iBACxC,wBAAwB,mBAAmB,OAAO;iBAClD,wBAAwB,QAAQ,eAAe;iBAC/C,2BAA2B,WAAW;iBACtC,mBAAmB,QAAQ,eAAe,oBAAoB,uBAAuB,mBAAmB,OAAO;iBAC/G,mBAAmB,SAAS,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ths, n as EmitResult, o as generateContractDts, r as EmitStackInput, s as getEmittedArtifactPaths, t as EmitOptions } from "./index-
|
|
1
|
+
import { M as serializeValue, b as generateRootsType, c as generateCodecTypeIntersection, d as generateFieldOutputTypesMap, h as generateImportLines, j as serializeObjectKey, m as generateHashTypeAliases, o as deduplicateImports, v as generateModelRelationsType } from "./domain-type-generation-X6-AaL1U-DHEoRf_y.mjs";
|
|
2
|
+
import { a as emit, i as EmittedArtifactPaths, n as EmitResult, o as generateContractDts, r as EmitStackInput, s as getEmittedArtifactPaths, t as EmitOptions } from "./index-D217lbiW.mjs";
|
|
3
3
|
export { type EmitOptions, type EmitResult, type EmitStackInput, type EmittedArtifactPaths, deduplicateImports, emit, generateCodecTypeIntersection, generateContractDts, generateFieldOutputTypesMap, generateHashTypeAliases, generateImportLines, generateModelRelationsType, generateRootsType, getEmittedArtifactPaths, serializeObjectKey, serializeValue };
|
package/dist/emitter.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { D as
|
|
2
|
-
import { n as generateContractDts, r as getEmittedArtifactPaths, t as emit } from "./exports-
|
|
1
|
+
import { D as serializeObjectKey, O as serializeValue, d as generateImportLines, g as generateRootsType, i as generateCodecTypeIntersection, m as generateModelRelationsType, s as generateFieldOutputTypesMap, t as deduplicateImports, u as generateHashTypeAliases } from "./domain-type-generation-CR9ECUau-DOlKbcaE.mjs";
|
|
2
|
+
import { n as generateContractDts, r as getEmittedArtifactPaths, t as emit } from "./exports-CE6OD63o-4Qpqr2W7.mjs";
|
|
3
3
|
export { deduplicateImports, emit, generateCodecTypeIntersection, generateContractDts, generateFieldOutputTypesMap, generateHashTypeAliases, generateImportLines, generateModelRelationsType, generateRootsType, getEmittedArtifactPaths, serializeObjectKey, serializeValue };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { FieldTypeParamsResolver, FieldValueSetResolver, ResolvedFieldType, ResolvedFieldValueSet, deduplicateImports, generateBothFieldTypesMaps, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldInputTypesMap, generateFieldOutputTypesMap, generateFieldResolvedType, generateFieldTypesMapsByNamespace, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, renderValueSetType, resolveFieldType, resolveValueObjectType, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
|
|
1
|
+
import { A as serializeNamespaceId, C as generateValueObjectsDescriptorType, D as resolveValueObjectType, E as resolveModelFieldType, M as serializeValue, O as serializeCrossReference, S as generateValueObjectTypeAliases, T as resolveFieldType, _ as generateModelFieldsType, a as ResolvedFieldValueSet, b as generateRootsType, c as generateCodecTypeIntersection, d as generateFieldOutputTypesMap, f as generateFieldResolvedType, g as generateModelFieldEntry, h as generateImportLines, i as ResolvedFieldType, j as serializeObjectKey, k as serializeExecutionType, l as generateContractFieldDescriptor, m as generateHashTypeAliases, n as FieldValueSetResolver, o as deduplicateImports, p as generateFieldTypesMapsByNamespace, r as ModelFieldTypeResolvers, s as generateBothFieldTypesMaps, t as FieldTypeParamsResolver, u as generateFieldInputTypesMap, v as generateModelRelationsType, w as renderValueSetType, x as generateValueObjectType, y as generateModelsType } from "./domain-type-generation-X6-AaL1U-DHEoRf_y.mjs";
|
|
2
|
+
export { FieldTypeParamsResolver, FieldValueSetResolver, ModelFieldTypeResolvers, ResolvedFieldType, ResolvedFieldValueSet, deduplicateImports, generateBothFieldTypesMaps, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldInputTypesMap, generateFieldOutputTypesMap, generateFieldResolvedType, generateFieldTypesMapsByNamespace, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, renderValueSetType, resolveFieldType, resolveModelFieldType, resolveValueObjectType, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export { deduplicateImports, generateBothFieldTypesMaps, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldInputTypesMap, generateFieldOutputTypesMap, generateFieldResolvedType, generateFieldTypesMapsByNamespace, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, renderValueSetType, resolveFieldType, resolveValueObjectType, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
|
|
1
|
+
import { C as resolveValueObjectType, D as serializeObjectKey, E as serializeNamespaceId, O as serializeValue, S as resolveModelFieldType, T as serializeExecutionType, _ as generateValueObjectType, a as generateContractFieldDescriptor, b as renderValueSetType, c as generateFieldResolvedType, d as generateImportLines, f as generateModelFieldEntry, g as generateRootsType, h as generateModelsType, i as generateCodecTypeIntersection, l as generateFieldTypesMapsByNamespace, m as generateModelRelationsType, o as generateFieldInputTypesMap, p as generateModelFieldsType, r as generateBothFieldTypesMaps, s as generateFieldOutputTypesMap, t as deduplicateImports, u as generateHashTypeAliases, v as generateValueObjectTypeAliases, w as serializeCrossReference, x as resolveFieldType, y as generateValueObjectsDescriptorType } from "./domain-type-generation-CR9ECUau-DOlKbcaE.mjs";
|
|
2
|
+
export { deduplicateImports, generateBothFieldTypesMaps, generateCodecTypeIntersection, generateContractFieldDescriptor, generateFieldInputTypesMap, generateFieldOutputTypesMap, generateFieldResolvedType, generateFieldTypesMapsByNamespace, generateHashTypeAliases, generateImportLines, generateModelFieldEntry, generateModelFieldsType, generateModelRelationsType, generateModelsType, generateRootsType, generateValueObjectType, generateValueObjectTypeAliases, generateValueObjectsDescriptorType, renderValueSetType, resolveFieldType, resolveModelFieldType, resolveValueObjectType, serializeCrossReference, serializeExecutionType, serializeNamespaceId, serializeObjectKey, serializeValue };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
2
2
|
import { CliStructuredError } from "@prisma/orm-framework/errors/control";
|
|
3
3
|
import { dirname, relative } from "pathe";
|
|
4
|
-
//#region ../../../1-framework/3-tooling/migration/dist/errors-
|
|
4
|
+
//#region ../../../1-framework/3-tooling/migration/dist/errors-SoLLYLtw.mjs
|
|
5
5
|
/**
|
|
6
6
|
* Build the canonical "re-emit this package" remediation hint.
|
|
7
7
|
*
|
|
@@ -164,7 +164,7 @@ function errorAmbiguousTarget(branchTips, context) {
|
|
|
164
164
|
const divergenceInfo = context ? `\nDivergence point: ${context.divergencePoint}\nBranches:\n${context.branches.map((b) => ` → ${b.tip} (${b.edges.length} edge(s): ${b.edges.map((e) => e.dirName).join(" → ") || "direct"})`).join("\n")}` : "";
|
|
165
165
|
return new MigrationToolsError("MIGRATION.AMBIGUOUS_TARGET", "Ambiguous migration target", {
|
|
166
166
|
why: `The migration history has diverged into multiple branches: ${branchTips.join(", ")}. This typically happens when two developers plan migrations from the same starting point.${divergenceInfo}`,
|
|
167
|
-
fix: "Use `ref set <name> <hash>` to target a specific branch, delete one of the conflicting migration directories and re-run `migration plan`, or use --from <hash> to explicitly select a starting point.",
|
|
167
|
+
fix: "Use `{bin} migration ref set <name> <hash>` to target a specific branch, delete one of the conflicting migration directories and re-run `{bin} migration plan`, or use --from <hash> to explicitly select a starting point.",
|
|
168
168
|
meta: {
|
|
169
169
|
branchTips,
|
|
170
170
|
...context ? {
|
|
@@ -208,7 +208,7 @@ function errorNoTarget(reachableHashes) {
|
|
|
208
208
|
function errorInvalidRefValue(value) {
|
|
209
209
|
return new MigrationToolsError("MIGRATION.INVALID_REF_VALUE", "Invalid ref value", {
|
|
210
210
|
why: `Ref value "${value}" is not a valid contract hash. Values must be a 64-character hex digest or "empty".`,
|
|
211
|
-
fix: "Use a valid storage hash from `
|
|
211
|
+
fix: "Use a valid storage hash from `{bin} contract emit` output or an existing migration.",
|
|
212
212
|
nextActions: [{
|
|
213
213
|
kind: "run-command",
|
|
214
214
|
label: "Emit the contract to obtain a valid storage hash",
|
|
@@ -301,12 +301,12 @@ function errorMigrationHashMismatch(dir, storedHash, computedHash) {
|
|
|
301
301
|
function errorRefNotResolvable(refName) {
|
|
302
302
|
return new MigrationToolsError("MIGRATION.REF_NOT_RESOLVABLE", `Ref "${refName}" is not resolvable`, {
|
|
303
303
|
why: `Ref "${refName}" has no pointer file, and the hash being resolved is not a node in the migration graph either — there is nothing to materialize a contract from.`,
|
|
304
|
-
fix: `Create the ref with "
|
|
304
|
+
fix: `Create the ref with "{bin} migration ref set ${refName} <hash>" (or advance it via "{bin} db update --advance-ref ${refName}"), or pass a hash that is a node in the migration graph.`,
|
|
305
305
|
nextActions: [
|
|
306
306
|
{
|
|
307
307
|
kind: "run-command",
|
|
308
308
|
label: `Create the ref "${refName}"`,
|
|
309
|
-
command: `{bin} ref set ${refName} <hash>`
|
|
309
|
+
command: `{bin} migration ref set ${refName} <hash>`
|
|
310
310
|
},
|
|
311
311
|
{
|
|
312
312
|
kind: "run-command",
|
|
@@ -327,7 +327,7 @@ function errorRefNotResolvable(refName) {
|
|
|
327
327
|
function errorBundleNotFoundForGraphNode(hash, explicitLabel) {
|
|
328
328
|
return new MigrationToolsError("MIGRATION.BUNDLE_NOT_FOUND_FOR_GRAPH_NODE", explicitLabel ? `No migration bundle found for reference "${explicitLabel}" (resolved hash: ${hash})` : `No migration bundle found for graph node ${hash}`, {
|
|
329
329
|
why: `The hash ${hash} is a graph node but no on-disk migration package has a destination (\`to\`) hash matching it.`,
|
|
330
|
-
fix: "Provide a ref or hash that corresponds to an existing migration package, or run `migration list` to see available migrations.",
|
|
330
|
+
fix: "Provide a ref or hash that corresponds to an existing migration package, or run `{bin} migration list` to see available migrations.",
|
|
331
331
|
meta: {
|
|
332
332
|
hash,
|
|
333
333
|
...explicitLabel ? { explicitLabel } : {}
|
|
@@ -350,7 +350,7 @@ function errorHashNotInGraph(hash, graph) {
|
|
|
350
350
|
const reachableList = reachableHashes.length > 0 ? reachableHashes.join(", ") : "(none)";
|
|
351
351
|
return new MigrationToolsError("MIGRATION.HASH_NOT_IN_GRAPH", `Hash "${hash}" is not a node in the migration graph`, {
|
|
352
352
|
why: `The migration graph contains nodes ${reachableList}; "${hash}" isn't one of them.`,
|
|
353
|
-
fix: `Pass a hash that's the from-or-to of an on-disk migration bundle, use --from with a graph-node hash, or run "
|
|
353
|
+
fix: `Pass a hash that's the from-or-to of an on-disk migration bundle, use --from with a graph-node hash, or run "{bin} migration plan" to introduce it.`,
|
|
354
354
|
nextActions: [{
|
|
355
355
|
kind: "user-choice",
|
|
356
356
|
label: "Pass a hash that is the from-or-to of an on-disk migration bundle, or use --from with a graph-node hash",
|
|
@@ -369,7 +369,7 @@ function errorHashNotInGraph(hash, graph) {
|
|
|
369
369
|
function errorContractSnapshotMissing(storageHash, expectedPath) {
|
|
370
370
|
return new MigrationToolsError("MIGRATION.CONTRACT_SNAPSHOT_MISSING", "Contract snapshot is missing", {
|
|
371
371
|
why: `Expected a contract snapshot for ${storageHash} at "${expectedPath}" but the file does not exist.`,
|
|
372
|
-
fix: "Re-emit the contract snapshot by re-running the command that authored the migration referencing this hash (`
|
|
372
|
+
fix: "Re-emit the contract snapshot by re-running the command that authored the migration referencing this hash (`{bin} migration plan` for app-space migrations; the extension's contract-space build for extension spaces), or restore migrations/snapshots/ from version control.",
|
|
373
373
|
nextActions: [
|
|
374
374
|
{
|
|
375
375
|
kind: "run-command",
|
|
@@ -416,4 +416,4 @@ function errorMigrationContractViewMissing(className, accessor, jsonField) {
|
|
|
416
416
|
//#endregion
|
|
417
417
|
export { errorOperationsNotArray as A, errorInvalidSpaceId as C, errorNoInitialMigration as D, errorMissingFile as E, errorRefNotResolvable as M, errorSpaceHeadRefMissing as N, errorNoInvariantPath as O, errorUnknownInvariant as P, errorInvalidSlug as S, errorMigrationHashMismatch as T, errorInvalidManifest as _, errorContractSnapshotHashMismatch as a, errorInvalidRefName as b, errorDescribeMissingEndContract as c, errorDuplicateInvariantInEdge as d, errorDuplicateSpaceId as f, errorInvalidJson as g, errorInvalidInvariantId as h, errorContractDeserializationFailed as i, errorProvidedInvariantsMismatch as j, errorNoTarget as k, errorDescriptorHeadHashMismatch as l, errorInvalidDestName as m, errorAmbiguousTarget as n, errorContractSnapshotMissing as o, errorHashNotInGraph as p, errorBundleNotFoundForGraphNode as r, errorDescribeInvalidMetadata as s, MigrationToolsError as t, errorDirectoryExists as u, errorInvalidOperationEntry as v, errorMigrationContractViewMissing as w, errorInvalidRefValue as x, errorInvalidRefFile as y };
|
|
418
418
|
|
|
419
|
-
//# sourceMappingURL=errors-
|
|
419
|
+
//# sourceMappingURL=errors-SoLLYLtw-DMxVbVs9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-SoLLYLtw-DMxVbVs9.mjs","names":[],"sources":["../../../../1-framework/3-tooling/migration/dist/errors-SoLLYLtw.mjs"],"sourcesContent":["import { CliStructuredError } from \"@internal/errors/control\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { dirname, relative } from \"pathe\";\n//#region src/errors.ts\n/**\n* Build the canonical \"re-emit this package\" remediation hint.\n*\n* Every on-disk migration package ships its own `migration.ts` author-time\n* file. Running it regenerates `migration.json` and `ops.json` with the\n* correct hash + metadata, so it is the right primitive whenever a single\n* package's on-disk artifacts are missing, malformed, or otherwise corrupt.\n* Pointing users at `migration plan` would emit a *new* package rather than\n* heal the broken one.\n*/\nfunction reemitHint(dir, fallback) {\n\tconst reemit = `Re-emit the package by running \\`node \"${relative(process.cwd(), dir)}/migration.ts\"\\``;\n\treturn fallback ? `${reemit}, ${fallback}` : `${reemit}.`;\n}\n/**\n* Structured error for migration tooling operations.\n*\n* Follows the NAMESPACE.SUBCODE convention from ADR 027. All codes live under\n* the MIGRATION namespace. These are tooling-time errors (file I/O, hash\n* verification, migration history reconstruction), distinct from the runtime\n* MIGRATION.* codes for apply-time failures (PRECHECK_FAILED, POSTCHECK_FAILED,\n* etc.).\n*\n* Fields:\n* - code: Stable machine-readable code (MIGRATION.SUBCODE)\n* - category: Always 'MIGRATION'\n* - why: Explains the cause in plain language\n* - fix: Actionable remediation step\n* - meta: Machine-readable structured data for agents\n*/\nvar MigrationToolsError = class extends CliStructuredError {\n\tcategory;\n\tconstructor(code, summary, options) {\n\t\tsuper(code, summary, options);\n\t\tthis.category = \"MIGRATION\";\n\t}\n\tstatic is(error) {\n\t\treturn CliStructuredError.is(error) && \"category\" in error && error.category === \"MIGRATION\" && error.code.startsWith(\"MIGRATION.\");\n\t}\n};\nfunction errorDirectoryExists(dir) {\n\treturn new MigrationToolsError(\"MIGRATION.DIR_EXISTS\", \"Migration directory already exists\", {\n\t\twhy: `The directory \"${dir}\" already exists. Each migration must have a unique directory.`,\n\t\tfix: \"Use --name to pick a different name, or delete the existing directory and re-run.\",\n\t\tmeta: { dir }\n\t});\n}\nfunction errorMissingFile(file, dir) {\n\treturn new MigrationToolsError(\"MIGRATION.FILE_MISSING\", `Missing ${file}`, {\n\t\twhy: `Expected \"${file}\" in \"${dir}\" but the file does not exist.`,\n\t\tfix: reemitHint(dir, \"or delete the directory if the migration is unwanted and the source TypeScript is gone.\"),\n\t\tmeta: {\n\t\t\tfile,\n\t\t\tdir\n\t\t}\n\t});\n}\nfunction errorInvalidJson(filePath, parseError) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_JSON\", \"Invalid JSON in migration file\", {\n\t\twhy: `Failed to parse \"${filePath}\": ${parseError}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\tparseError\n\t\t}\n\t});\n}\nfunction errorInvalidManifest(filePath, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_MANIFEST\", \"Invalid migration manifest\", {\n\t\twhy: `Migration manifest at \"${filePath}\" is invalid: ${reason}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorDescribeMissingEndContract() {\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIBE_INVALID\", \"Migration.describe(): provide endContractJson or override describe() — a migration needs a destination contract hash.\", {\n\t\twhy: \"Migration.describe() was called on a migration that carries no endContractJson and does not override describe(), so no destination contract hash can be derived.\",\n\t\tfix: \"Set endContractJson on the migration, or override describe() to return the { from, to } metadata explicitly.\",\n\t\tmeta: { reason: \"missing-end-contract\" }\n\t});\n}\nfunction errorDescribeInvalidMetadata(summary) {\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIBE_INVALID\", `describe() returned invalid metadata: ${summary}`, {\n\t\twhy: `The migration's describe() returned metadata that failed schema validation: ${summary}.`,\n\t\tfix: \"Ensure describe() returns { from: string | null, to: string } with valid contract hashes.\",\n\t\tmeta: {\n\t\t\treason: \"invalid-metadata\",\n\t\t\tsummary\n\t\t}\n\t});\n}\nfunction errorOperationsNotArray() {\n\treturn new MigrationToolsError(\"MIGRATION.PLAN_NOT_ARRAY\", \"operations must be an array\", {\n\t\twhy: \"The migration instance's `operations` getter returned a non-array value.\",\n\t\tfix: \"Ensure the `operations` getter returns an array of migration operations.\",\n\t\tmeta: {}\n\t});\n}\nfunction errorSpaceHeadRefMissing(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.CHECK_HEAD_REF_MISSING\", `Contract space \"${spaceId}\" has no head ref; its contract cannot be resolved from the snapshot store without one.`, {\n\t\twhy: `Contract space \"${spaceId}\" declares no refs/head.json, so there is no hash to resolve its contract against the snapshot store.`,\n\t\tfix: \"Re-emit the contract-space migrations and head-ref artifacts (the extension's contract-space build), or restore refs/head.json from version control.\",\n\t\tmeta: { spaceId }\n\t});\n}\nfunction errorInvalidOperationEntry(index, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_OPERATION_ENTRY\", \"Migration operation entry is malformed\", {\n\t\twhy: `Operation at index ${index} returned by the migration class failed schema validation: ${reason}.`,\n\t\tfix: \"Update the migration class so each entry of `operations` carries `id` (string), `label` (string), and `operationClass` (one of 'additive' | 'widening' | 'destructive' | 'data').\",\n\t\tmeta: {\n\t\t\tindex,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorInvalidSlug(slug) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_NAME\", \"Invalid migration name\", {\n\t\twhy: `The slug \"${slug}\" contains no valid characters after sanitization (only a-z, 0-9 are kept).`,\n\t\tfix: \"Provide a name with at least one alphanumeric character, e.g. --name add_users.\",\n\t\tmeta: { slug }\n\t});\n}\nfunction errorInvalidDestName(destName) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_DEST_NAME\", \"Invalid copy destination name\", {\n\t\twhy: `The destination name \"${destName}\" must be a single path segment (no \"..\" or directory separators).`,\n\t\tfix: \"Use a simple file name such as \\\"contract.json\\\" for each destination in the copy list.\",\n\t\tmeta: { destName }\n\t});\n}\nfunction errorInvalidSpaceId(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_SPACE_ID\", \"Invalid contract space identifier\", {\n\t\twhy: `The space id \"${spaceId}\" does not match the required pattern /^[a-z][a-z0-9_-]{0,63}$/. Space ids are used as filesystem directory names under \\`migrations/\\`, so the pattern is conservative on purpose.`,\n\t\tfix: \"Pick a lowercase identifier that begins with a letter and contains only lowercase letters, digits, hyphens, or underscores; max 64 characters total.\",\n\t\tmeta: { spaceId }\n\t});\n}\nfunction errorDescriptorHeadHashMismatch(args) {\n\tconst { extensionId, recomputedHash, headRefHash } = args;\n\treturn new MigrationToolsError(\"MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH\", \"Extension descriptor's headRef.hash does not match its contractJson\", {\n\t\twhy: `Extension \"${extensionId}\" publishes a \\`contractSpace\\` whose \\`headRef.hash\\` (${headRefHash}) does not match the canonical hash recomputed from \\`contractSpace.contractJson\\` (${recomputedHash}). This means the extension descriptor was published with stale \\`headRef.hash\\` — typically because the contract was bumped without rerunning the extension's emit pipeline.`,\n\t\tfix: \"Re-run the extension authoring pipeline so `contractJson.storage.storageHash` and `headRef.hash` agree, then republish the extension. If you are the extension author and you intentionally bumped `contractJson`, recompute and update `headRef.hash` (and refresh any on-disk migration metadata that derives from it).\",\n\t\tmeta: {\n\t\t\textensionId,\n\t\t\trecomputedHash,\n\t\t\theadRefHash\n\t\t}\n\t});\n}\nfunction errorDuplicateSpaceId(spaceId) {\n\treturn new MigrationToolsError(\"MIGRATION.DUPLICATE_SPACE_ID\", \"Duplicate contract space identifier\", {\n\t\twhy: `The space id \"${spaceId}\" appears more than once in the per-space planner input. Each space id must be unique across the inputs (the per-space planner emits one output entry per id).`,\n\t\tfix: \"Deduplicate the inputs before passing them to `planAllSpaces` — typically by checking your `extensions` declaration for repeated entries.\",\n\t\tmeta: { spaceId }\n\t});\n}\nfunction errorAmbiguousTarget(branchTips, context) {\n\tconst divergenceInfo = context ? `\\nDivergence point: ${context.divergencePoint}\\nBranches:\\n${context.branches.map((b) => ` → ${b.tip} (${b.edges.length} edge(s): ${b.edges.map((e) => e.dirName).join(\" → \") || \"direct\"})`).join(\"\\n\")}` : \"\";\n\treturn new MigrationToolsError(\"MIGRATION.AMBIGUOUS_TARGET\", \"Ambiguous migration target\", {\n\t\twhy: `The migration history has diverged into multiple branches: ${branchTips.join(\", \")}. This typically happens when two developers plan migrations from the same starting point.${divergenceInfo}`,\n\t\tfix: \"Use `{bin} migration ref set <name> <hash>` to target a specific branch, delete one of the conflicting migration directories and re-run `{bin} migration plan`, or use --from <hash> to explicitly select a starting point.\",\n\t\tmeta: {\n\t\t\tbranchTips,\n\t\t\t...context ? {\n\t\t\t\tdivergencePoint: context.divergencePoint,\n\t\t\t\tbranches: context.branches\n\t\t\t} : {}\n\t\t}\n\t});\n}\nfunction errorNoInitialMigration(nodes) {\n\treturn new MigrationToolsError(\"MIGRATION.NO_INITIAL_MIGRATION\", \"No initial migration found\", {\n\t\twhy: `No migration starts from the empty contract state (known hashes: ${nodes.join(\", \")}). At least one migration must originate from the empty state.`,\n\t\tfix: \"Inspect the migrations directory for corrupted migration.json files. At least one migration must start from the empty contract hash.\",\n\t\tmeta: { nodes }\n\t});\n}\nfunction errorInvalidRefFile(filePath, reason) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_FILE\", \"Invalid ref file\", {\n\t\twhy: `Ref file at \"${filePath}\" is invalid: ${reason}`,\n\t\tfix: \"Ensure the ref file contains valid JSON with { \\\"hash\\\": \\\"<64 hex chars>\\\", \\\"invariants\\\": [\\\"...\\\"] }.\",\n\t\tmeta: {\n\t\t\tpath: filePath,\n\t\t\treason\n\t\t}\n\t});\n}\nfunction errorInvalidRefName(refName) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_NAME\", \"Invalid ref name\", {\n\t\twhy: `Ref name \"${refName}\" is invalid. Names must be lowercase alphanumeric with hyphens or forward slashes (no \".\" or \"..\" segments).`,\n\t\tfix: `Use a valid ref name (e.g., \"staging\", \"envs/production\").`,\n\t\tmeta: { refName }\n\t});\n}\nfunction errorNoTarget(reachableHashes) {\n\treturn new MigrationToolsError(\"MIGRATION.NO_TARGET\", \"No migration target could be resolved\", {\n\t\twhy: `The migration history contains cycles and no target can be resolved automatically (reachable hashes: ${reachableHashes.join(\", \")}). This typically happens after rollback migrations (e.g., C1→C2→C1).`,\n\t\tfix: \"Use --from <hash> to specify the planning origin explicitly.\",\n\t\tmeta: { reachableHashes }\n\t});\n}\nfunction errorInvalidRefValue(value) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_REF_VALUE\", \"Invalid ref value\", {\n\t\twhy: `Ref value \"${value}\" is not a valid contract hash. Values must be a 64-character hex digest or \"empty\".`,\n\t\tfix: \"Use a valid storage hash from `{bin} contract emit` output or an existing migration.\",\n\t\tnextActions: [{\n\t\t\tkind: \"run-command\",\n\t\t\tlabel: \"Emit the contract to obtain a valid storage hash\",\n\t\t\tcommand: \"{bin} contract emit\"\n\t\t}, {\n\t\t\tkind: \"run-command\",\n\t\t\tlabel: \"List existing migrations to reuse one of their hashes\",\n\t\t\tcommand: \"{bin} migration list\"\n\t\t}],\n\t\tmeta: { value }\n\t});\n}\nfunction errorInvalidInvariantId(invariantId) {\n\treturn new MigrationToolsError(\"MIGRATION.INVALID_INVARIANT_ID\", \"Invalid invariantId\", {\n\t\twhy: `invariantId ${JSON.stringify(invariantId)} is invalid. Ids must be non-empty and contain no whitespace or control characters (including Unicode whitespace like NBSP); other content (kebab-case, camelCase, namespaced, Unicode letters) is allowed.`,\n\t\tfix: \"Pick an invariantId without spaces, tabs, newlines, or control characters — e.g. \\\"backfill-user-phone\\\", \\\"users/backfill-phone\\\", or \\\"BackfillUserPhone\\\".\",\n\t\tmeta: { invariantId }\n\t});\n}\nfunction errorDuplicateInvariantInEdge(invariantId) {\n\treturn new MigrationToolsError(\"MIGRATION.DUPLICATE_INVARIANT_IN_EDGE\", \"Duplicate invariantId on a single migration\", {\n\t\twhy: `invariantId \"${invariantId}\" is declared by more than one dataTransform on the same migration. The marker stores invariants as a set and the routing layer treats them as edge-level, so two ops cannot share a routing identity.`,\n\t\tfix: \"Rename one of the conflicting dataTransform invariantIds, or drop invariantId on the op that does not need to be routing-visible.\",\n\t\tmeta: { invariantId }\n\t});\n}\nfunction errorProvidedInvariantsMismatch(filePath, stored, derived) {\n\tconst storedSet = new Set(stored);\n\tconst derivedSet = new Set(derived);\n\tconst missing = [...derivedSet].filter((id) => !storedSet.has(id));\n\tconst extra = [...storedSet].filter((id) => !derivedSet.has(id));\n\treturn new MigrationToolsError(\"MIGRATION.PROVIDED_INVARIANTS_MISMATCH\", \"providedInvariants on migration.json disagrees with ops.json\", {\n\t\twhy: missing.length === 0 && extra.length === 0 ? `migration.json at \"${filePath}\" stores providedInvariants ${JSON.stringify(stored)}, but the canonical value derived from ops.json is ${JSON.stringify(derived)} — same ids, different order. Canonical providedInvariants is sorted ascending.` : `migration.json at \"${filePath}\" stores providedInvariants ${JSON.stringify(stored)}, but the value derived from ops.json is ${JSON.stringify(derived)}. The manifest copy was likely hand-edited without re-emitting.`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\tstored,\n\t\t\tderived,\n\t\t\tdifference: {\n\t\t\t\tmissing,\n\t\t\t\textra\n\t\t\t}\n\t\t}\n\t});\n}\nfunction errorNoInvariantPath(args) {\n\tconst { refName, required, missing, structuralPath } = args;\n\tconst refClause = refName ? `Ref \"${refName}\"` : \"Target\";\n\tconst missingList = missing.map((id) => JSON.stringify(id)).join(\", \");\n\treturn new MigrationToolsError(\"MIGRATION.NO_INVARIANT_PATH\", \"No path covers the required invariants\", {\n\t\twhy: `${refClause} requires invariants the reachable path doesn't cover. required=[${required.map((id) => JSON.stringify(id)).join(\", \")}], missing=[${missingList}].`,\n\t\tfix: \"Add a migration on the path that runs `dataTransform({ invariantId: \\\"<id>\\\", … })` for each missing invariant, or retarget the ref to a hash whose path already provides them.\",\n\t\tmeta: {\n\t\t\trequired,\n\t\t\tmissing,\n\t\t\tstructuralPath,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t});\n}\nfunction errorUnknownInvariant(args) {\n\tconst { refName, unknown, declared } = args;\n\treturn new MigrationToolsError(\"MIGRATION.UNKNOWN_INVARIANT\", \"Ref declares invariants no migration in the graph provides\", {\n\t\twhy: `${refName ? `Ref \"${refName}\" declares` : \"Declares\"} invariants no migration in the graph provides. unknown=[${unknown.map((id) => JSON.stringify(id)).join(\", \")}].`,\n\t\tfix: \"Either the ref has a typo, or the declaring migration has not been authored/attested yet. Re-check the ref file and the migrations directory.\",\n\t\tmeta: {\n\t\t\tunknown,\n\t\t\tdeclared,\n\t\t\t...ifDefined(\"refName\", refName)\n\t\t}\n\t});\n}\nfunction errorMigrationHashMismatch(dir, storedHash, computedHash) {\n\treturn new MigrationToolsError(\"MIGRATION.HASH_MISMATCH\", \"Migration package is corrupt\", {\n\t\twhy: `Stored migrationHash \"${storedHash}\" does not match the recomputed hash \"${computedHash}\" for \"${relative(process.cwd(), dir)}\". The migration.json or ops.json has been edited or partially written since emit.`,\n\t\tfix: reemitHint(dir, \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tdir,\n\t\t\tstoredHash,\n\t\t\tcomputedHash\n\t\t}\n\t});\n}\n/**\n* A ref name that resolves to nothing: no pointer file named `refName`\n* exists, and the hash being resolved (the `contractAt` argument, used as a\n* fallback when the pointer is absent) is not a node in the migration graph\n* either. There is no contract to materialize.\n*/\nfunction errorRefNotResolvable(refName) {\n\treturn new MigrationToolsError(\"MIGRATION.REF_NOT_RESOLVABLE\", `Ref \"${refName}\" is not resolvable`, {\n\t\twhy: `Ref \"${refName}\" has no pointer file, and the hash being resolved is not a node in the migration graph either — there is nothing to materialize a contract from.`,\n\t\tfix: `Create the ref with \"{bin} migration ref set ${refName} <hash>\" (or advance it via \"{bin} db update --advance-ref ${refName}\"), or pass a hash that is a node in the migration graph.`,\n\t\tnextActions: [\n\t\t\t{\n\t\t\t\tkind: \"run-command\",\n\t\t\t\tlabel: `Create the ref \"${refName}\"`,\n\t\t\t\tcommand: `{bin} migration ref set ${refName} <hash>`\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"run-command\",\n\t\t\t\tlabel: `Advance the ref \"${refName}\" as part of an update`,\n\t\t\t\tcommand: `{bin} db update --advance-ref ${refName}`\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"user-choice\",\n\t\t\t\tlabel: \"Pass a hash that is already a node in the migration graph\"\n\t\t\t}\n\t\t],\n\t\tmeta: {\n\t\t\trefName,\n\t\t\tidentifier: refName\n\t\t}\n\t});\n}\nfunction errorBundleNotFoundForGraphNode(hash, explicitLabel) {\n\treturn new MigrationToolsError(\"MIGRATION.BUNDLE_NOT_FOUND_FOR_GRAPH_NODE\", explicitLabel ? `No migration bundle found for reference \"${explicitLabel}\" (resolved hash: ${hash})` : `No migration bundle found for graph node ${hash}`, {\n\t\twhy: `The hash ${hash} is a graph node but no on-disk migration package has a destination (\\`to\\`) hash matching it.`,\n\t\tfix: \"Provide a ref or hash that corresponds to an existing migration package, or run `{bin} migration list` to see available migrations.\",\n\t\tmeta: {\n\t\t\thash,\n\t\t\t...explicitLabel ? { explicitLabel } : {}\n\t\t}\n\t});\n}\nfunction errorContractDeserializationFailed(filePath, message, options) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_DESERIALIZATION_FAILED\", \"Contract failed to deserialize\", {\n\t\twhy: `Contract at \"${filePath}\" failed to deserialize: ${message}`,\n\t\tfix: reemitHint(dirname(filePath), \"or restore the directory from version control.\"),\n\t\tmeta: {\n\t\t\tfilePath,\n\t\t\tmessage\n\t\t},\n\t\t...ifDefined(\"cause\", options?.cause)\n\t});\n}\nfunction errorHashNotInGraph(hash, graph) {\n\tconst reachableHashes = [...graph.nodes].sort();\n\tconst reachableList = reachableHashes.length > 0 ? reachableHashes.join(\", \") : \"(none)\";\n\treturn new MigrationToolsError(\"MIGRATION.HASH_NOT_IN_GRAPH\", `Hash \"${hash}\" is not a node in the migration graph`, {\n\t\twhy: `The migration graph contains nodes ${reachableList}; \"${hash}\" isn't one of them.`,\n\t\tfix: `Pass a hash that's the from-or-to of an on-disk migration bundle, use --from with a graph-node hash, or run \"{bin} migration plan\" to introduce it.`,\n\t\tnextActions: [{\n\t\t\tkind: \"user-choice\",\n\t\t\tlabel: \"Pass a hash that is the from-or-to of an on-disk migration bundle, or use --from with a graph-node hash\",\n\t\t\treason: `Graph nodes: ${reachableList}.`\n\t\t}, {\n\t\t\tkind: \"run-command\",\n\t\t\tlabel: `Introduce \"${hash}\" by planning a migration for it`,\n\t\t\tcommand: \"{bin} migration plan\"\n\t\t}],\n\t\tmeta: {\n\t\t\thash,\n\t\t\treachableHashes\n\t\t}\n\t});\n}\nfunction errorContractSnapshotMissing(storageHash, expectedPath) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_SNAPSHOT_MISSING\", \"Contract snapshot is missing\", {\n\t\twhy: `Expected a contract snapshot for ${storageHash} at \"${expectedPath}\" but the file does not exist.`,\n\t\tfix: \"Re-emit the contract snapshot by re-running the command that authored the migration referencing this hash (`{bin} migration plan` for app-space migrations; the extension's contract-space build for extension spaces), or restore migrations/snapshots/ from version control.\",\n\t\tnextActions: [\n\t\t\t{\n\t\t\t\tkind: \"run-command\",\n\t\t\t\tlabel: \"Re-emit the snapshot for an app-space migration\",\n\t\t\t\tcommand: \"{bin} migration plan\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"user-choice\",\n\t\t\t\tlabel: \"For an extension space, re-run that extension's contract-space build instead\"\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"user-choice\",\n\t\t\t\tlabel: \"Restore migrations/snapshots/ from version control\"\n\t\t\t}\n\t\t],\n\t\tmeta: {\n\t\t\tstorageHash,\n\t\t\texpectedPath\n\t\t}\n\t});\n}\nfunction errorContractSnapshotHashMismatch(storageHash, actualHash, dir) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_SNAPSHOT_HASH_MISMATCH\", \"Contract snapshot hash mismatch\", {\n\t\twhy: `The contract JSON's inner storage.storageHash (\"${actualHash}\") does not match the requested storage hash (\"${storageHash}\") for snapshot directory \"${dir}\".`,\n\t\tfix: \"Pass a contractJson whose storage.storageHash equals the storageHash argument passed to writeContractSnapshot — the two must agree by construction.\",\n\t\tmeta: {\n\t\t\tstorageHash,\n\t\t\tactualHash,\n\t\t\tdir\n\t\t}\n\t});\n}\nfunction errorMigrationContractViewMissing(className, accessor, jsonField) {\n\treturn new MigrationToolsError(\"MIGRATION.CONTRACT_VIEW_MISSING\", `${className}.${accessor} requires ${jsonField}`, {\n\t\twhy: `${className}.${accessor} was read, but this instance has no ${jsonField} to build the view from.`,\n\t\tfix: `Set ${jsonField} to the migration's committed contract JSON, or avoid reading ${accessor} on a migration that overrides describe() and carries no contract.`,\n\t\tmeta: {\n\t\t\tclassName,\n\t\t\taccessor,\n\t\t\tjsonField\n\t\t}\n\t});\n}\n//#endregion\nexport { errorOperationsNotArray as A, errorInvalidSpaceId as C, errorNoInitialMigration as D, errorMissingFile as E, errorRefNotResolvable as M, errorSpaceHeadRefMissing as N, errorNoInvariantPath as O, errorUnknownInvariant as P, errorInvalidSlug as S, errorMigrationHashMismatch as T, errorInvalidManifest as _, errorContractSnapshotHashMismatch as a, errorInvalidRefName as b, errorDescribeMissingEndContract as c, errorDuplicateInvariantInEdge as d, errorDuplicateSpaceId as f, errorInvalidJson as g, errorInvalidInvariantId as h, errorContractDeserializationFailed as i, errorProvidedInvariantsMismatch as j, errorNoTarget as k, errorDescriptorHeadHashMismatch as l, errorInvalidDestName as m, errorAmbiguousTarget as n, errorContractSnapshotMissing as o, errorHashNotInGraph as p, errorBundleNotFoundForGraphNode as r, errorDescribeInvalidMetadata as s, MigrationToolsError as t, errorDirectoryExists as u, errorInvalidOperationEntry as v, errorMigrationContractViewMissing as w, errorInvalidRefValue as x, errorInvalidRefFile as y };\n\n//# sourceMappingURL=errors-SoLLYLtw.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,WAAW,KAAK,UAAU;CAClC,MAAM,SAAS,0CAA0C,SAAS,QAAQ,IAAI,GAAG,GAAG,EAAE;CACtF,OAAO,WAAW,GAAG,OAAO,IAAI,aAAa,GAAG,OAAO;AACxD;;;;;;;;;;;;;;;;;AAiBA,IAAI,sBAAsB,cAAc,mBAAmB;CAC1D;CACA,YAAY,MAAM,SAAS,SAAS;EACnC,MAAM,MAAM,SAAS,OAAO;EAC5B,KAAK,WAAW;CACjB;CACA,OAAO,GAAG,OAAO;EAChB,OAAO,mBAAmB,GAAG,KAAK,KAAK,cAAc,SAAS,MAAM,aAAa,eAAe,MAAM,KAAK,WAAW,YAAY;CACnI;AACD;AACA,SAAS,qBAAqB,KAAK;CAClC,OAAO,IAAI,oBAAoB,wBAAwB,sCAAsC;EAC5F,KAAK,kBAAkB,IAA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AM;GACL;GACA;GACA;EACD;CACD,CAAC;AACF;AACA,SAAS,kCAAkC,WAAW,UAAU,WAAW;CAC1E,OAAO,IAAI,oBAAoB,mCAAmC,GAAG,UAAU,GAAG,SAAS,YAAY,aAAa;EACnH,KAAK,GAAG,UAAU,GAAG,SAAS,sCAAsC,UAAU;EAC9E,KAAK,OAAO,UAAU,gEAAgE,SAAS;EAC/F,MAAM;GACL;GACA;GACA;EACD;CACD,CAAC;AACF"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { r as getEmittedArtifactPaths } from "./exports-
|
|
1
|
+
import { r as getEmittedArtifactPaths } from "./exports-CE6OD63o-4Qpqr2W7.mjs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { realpathSync } from "node:fs";
|
|
2
4
|
import { ifDefined } from "@prisma/orm-framework/utils/defined";
|
|
3
5
|
import { isStructuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
4
6
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
5
7
|
import { CliStructuredError, errorConfigEvaluationFailed, errorConfigFileNotFound, errorConfigValidation, errorConfigVersionMarkerMissing } from "@prisma/orm-framework/errors/control";
|
|
6
8
|
import { notOk, ok } from "@prisma/orm-framework/utils/result";
|
|
7
|
-
import {
|
|
9
|
+
import { dirname, join, resolve } from "pathe";
|
|
8
10
|
import { access } from "node:fs/promises";
|
|
9
11
|
import { collectConfigIssues } from "@prisma/orm-framework/config/config-validation";
|
|
10
|
-
import {
|
|
12
|
+
import { normalizeContractConfig } from "@prisma/orm-framework/config/config-types";
|
|
13
|
+
import { pathToFileURL } from "node:url";
|
|
11
14
|
//#region ../../../1-framework/3-tooling/config-loader/dist/exports/index.mjs
|
|
12
15
|
function finalizeContractSource(source, configDir) {
|
|
13
16
|
const resolvedInputs = source.inputs?.map((input) => resolve(configDir, input));
|
|
@@ -47,26 +50,11 @@ function finalizeConfig(config, configDir) {
|
|
|
47
50
|
};
|
|
48
51
|
}
|
|
49
52
|
const CONFIG_FILENAME = "prisma.config.ts";
|
|
50
|
-
const DEPRECATED_CONFIG_FILENAME = "prisma-next.config.ts";
|
|
51
|
-
function deprecatedFilenameWarning() {
|
|
52
|
-
return {
|
|
53
|
-
code: "CONFIG.DEPRECATED_FILENAME",
|
|
54
|
-
message: `${DEPRECATED_CONFIG_FILENAME} is deprecated; rename the file to ${CONFIG_FILENAME}.`
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function deprecatedShapeWarning() {
|
|
58
|
-
return {
|
|
59
|
-
code: "CONFIG.DEPRECATED_SHAPE",
|
|
60
|
-
message: "The flat Prisma Next config shape is deprecated; wrap it in an `orm` section with defineConfig from @prisma/cli-engine: export default defineConfig({ orm: { … } })."
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
53
|
async function findNearestConfigPathForFile(filePath) {
|
|
64
54
|
let current = dirname(resolve(process.cwd(), filePath));
|
|
65
55
|
while (true) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (await fileExists(candidate)) return candidate;
|
|
69
|
-
}
|
|
56
|
+
const candidate = join(current, CONFIG_FILENAME);
|
|
57
|
+
if (await fileExists(candidate)) return candidate;
|
|
70
58
|
const parent = dirname(current);
|
|
71
59
|
if (parent === current) return;
|
|
72
60
|
current = parent;
|
|
@@ -146,7 +134,7 @@ function toConfigLoadFailure(error, configPath) {
|
|
|
146
134
|
return errorConfigEvaluationFailed(resolvedPath, { why: String(error) });
|
|
147
135
|
}
|
|
148
136
|
/**
|
|
149
|
-
* Loads and finalizes the Prisma
|
|
137
|
+
* Loads and finalizes the Prisma 8 config.
|
|
150
138
|
*
|
|
151
139
|
* Failures that prevent evaluation entirely — missing file, module that does
|
|
152
140
|
* not evaluate (`CONFIG.FILE_NOT_FOUND`, `CONFIG.EVALUATION_FAILED`) — are the
|
|
@@ -154,22 +142,24 @@ function toConfigLoadFailure(error, configPath) {
|
|
|
154
142
|
* fail the load: they are returned as section-tagged diagnostics so commands
|
|
155
143
|
* fail only on the sections they read (via {@link requireConfigSections}).
|
|
156
144
|
*/
|
|
145
|
+
/**
|
|
146
|
+
* c12 is resolved to its real on-disk entry before importing: jiti (inside
|
|
147
|
+
* c12) resolves its own transitive imports from the importing file's location,
|
|
148
|
+
* and a symlinked install (pnpm) would otherwise anchor them somewhere the
|
|
149
|
+
* packages are not. Importing at the real location keeps every transitive
|
|
150
|
+
* resolution working.
|
|
151
|
+
*/
|
|
152
|
+
async function importC12() {
|
|
153
|
+
return await import(pathToFileURL(realpathSync(createRequire(import.meta.url).resolve("c12"))).href);
|
|
154
|
+
}
|
|
157
155
|
async function loadConfig(configPath, options) {
|
|
158
156
|
const cwd = options?.cwd ?? process.cwd();
|
|
159
157
|
const resolvedConfigPath = configPath ? resolve(cwd, configPath) : void 0;
|
|
160
158
|
const configCwd = resolvedConfigPath ? dirname(resolvedConfigPath) : cwd;
|
|
161
|
-
const deprecations = [];
|
|
162
|
-
let discoveryName = "prisma";
|
|
163
|
-
if (resolvedConfigPath === void 0) {
|
|
164
|
-
if (!await fileExists(join(configCwd, CONFIG_FILENAME)) && await fileExists(join(configCwd, DEPRECATED_CONFIG_FILENAME))) {
|
|
165
|
-
discoveryName = "prisma-next";
|
|
166
|
-
deprecations.push(deprecatedFilenameWarning());
|
|
167
|
-
}
|
|
168
|
-
} else if (basename(resolvedConfigPath) === DEPRECATED_CONFIG_FILENAME) deprecations.push(deprecatedFilenameWarning());
|
|
169
159
|
let result;
|
|
170
160
|
try {
|
|
171
|
-
result = await (await
|
|
172
|
-
name:
|
|
161
|
+
result = await (await importC12()).loadConfig({
|
|
162
|
+
name: "prisma",
|
|
173
163
|
...ifDefined("configFile", resolvedConfigPath),
|
|
174
164
|
cwd: configCwd
|
|
175
165
|
});
|
|
@@ -191,20 +181,9 @@ async function loadConfig(configPath, options) {
|
|
|
191
181
|
const orm = result.config["orm"];
|
|
192
182
|
if (orm !== void 0 && !isRecord(orm)) return ok({
|
|
193
183
|
config: buildLoadedConfig({}, loadedConfigDir).config,
|
|
194
|
-
diagnostics: [errorConfigValidation("orm", { why: `The orm section of ${CONFIG_FILENAME} must be an object` })]
|
|
195
|
-
deprecations
|
|
196
|
-
});
|
|
197
|
-
return ok({
|
|
198
|
-
...buildLoadedConfig(orm ?? {}, loadedConfigDir),
|
|
199
|
-
deprecations
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
if (hasCurrentConfigFormatVersion(layerConfig)) {
|
|
203
|
-
deprecations.push(deprecatedShapeWarning());
|
|
204
|
-
return ok({
|
|
205
|
-
...buildLoadedConfig(result.config, loadedConfigDir),
|
|
206
|
-
deprecations
|
|
184
|
+
diagnostics: [errorConfigValidation("orm", { why: `The orm section of ${CONFIG_FILENAME} must be an object` })]
|
|
207
185
|
});
|
|
186
|
+
return ok(buildLoadedConfig(orm ?? {}, loadedConfigDir));
|
|
208
187
|
}
|
|
209
188
|
/* v8 ignore next -- a config that evaluated always carries its resolved path */
|
|
210
189
|
return notOk(errorConfigVersionMarkerMissing(result.configFile ?? resolvedConfigPath));
|
|
@@ -226,10 +205,9 @@ function requireConfigSections(loaded, sections) {
|
|
|
226
205
|
* {@link requireConfigSections} for commands that read a fixed set of
|
|
227
206
|
* sections and have no use for diagnostics outside them.
|
|
228
207
|
*/
|
|
229
|
-
async function loadConfigForSections(configPath, sections
|
|
208
|
+
async function loadConfigForSections(configPath, sections) {
|
|
230
209
|
const loaded = await loadConfig(configPath);
|
|
231
210
|
if (!loaded.ok) return loaded;
|
|
232
|
-
if (options?.onDeprecation) for (const deprecation of loaded.value.deprecations) options.onDeprecation(deprecation);
|
|
233
211
|
return requireConfigSections(loaded.value, sections);
|
|
234
212
|
}
|
|
235
213
|
async function loadConfigForFile(filePath) {
|
|
@@ -240,4 +218,4 @@ async function loadConfigForFile(filePath) {
|
|
|
240
218
|
//#endregion
|
|
241
219
|
export { loadConfigForSections as a, loadConfigForFile as i, findNearestConfigPathForFile as n, requireConfigSections as o, loadConfig as r, finalizeConfig as t };
|
|
242
220
|
|
|
243
|
-
//# sourceMappingURL=exports-
|
|
221
|
+
//# sourceMappingURL=exports-BXXeNWlj.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports-BXXeNWlj.mjs","names":[],"sources":["../../../../1-framework/3-tooling/config-loader/dist/exports/index.mjs"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { normalizeContractConfig } from \"@internal/config/config-types\";\nimport { dirname, join, resolve } from \"pathe\";\nimport { realpathSync } from \"node:fs\";\nimport { access } from \"node:fs/promises\";\nimport { pathToFileURL } from \"node:url\";\nimport { collectConfigIssues } from \"@internal/config/config-validation\";\nimport { getEmittedArtifactPaths } from \"@internal/emitter\";\nimport { CliStructuredError, errorConfigEvaluationFailed, errorConfigFileNotFound, errorConfigValidation, errorConfigVersionMarkerMissing } from \"@internal/errors/control\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { ifDefined } from \"@internal/utils/defined\";\nimport { notOk, ok } from \"@internal/utils/result\";\nimport { isStructuredError } from \"@internal/utils/structured-error\";\n//#region src/finalize-config.ts\nfunction finalizeContractSource(source, configDir) {\n\tconst resolvedInputs = source.inputs?.map((input) => resolve(configDir, input));\n\tif (resolvedInputs === void 0) return source;\n\treturn {\n\t\t...source,\n\t\tinputs: resolvedInputs\n\t};\n}\n/** Normalizes a contract section and resolves its paths against `configDir`. */\nfunction finalizeContractConfig(contract, configDir) {\n\tconst normalized = normalizeContractConfig(contract);\n\treturn {\n\t\t...normalized,\n\t\tsource: finalizeContractSource(normalized.source, configDir),\n\t\toutput: resolve(configDir, normalized.output)\n\t};\n}\nconst DEFAULT_MIGRATIONS_DIR = \"migrations\";\n/**\n* Resolves the migrations directory against `configDir`, which is what `migrations.dir` is\n* documented to be relative to. The default is applied here too, so no caller re-derives it\n* against a different base — a command run from one directory with `--config` naming a project in\n* another would otherwise read the wrong `migrations/`.\n*/\nfunction finalizeMigrationsConfig(migrations, configDir) {\n\treturn {\n\t\t...migrations,\n\t\tdir: resolve(configDir, migrations?.dir ?? DEFAULT_MIGRATIONS_DIR)\n\t};\n}\nfunction finalizeConfig(config, configDir) {\n\treturn {\n\t\t...config,\n\t\t...config.contract ? { contract: finalizeContractConfig(config.contract, configDir) } : void 0,\n\t\tmigrations: finalizeMigrationsConfig(config.migrations, configDir)\n\t};\n}\n//#endregion\n//#region src/load.ts\nconst CONFIG_FILENAME = \"prisma.config.ts\";\nasync function findNearestConfigPathForFile(filePath) {\n\tlet current = dirname(resolve(process.cwd(), filePath));\n\twhile (true) {\n\t\tconst candidate = join(current, CONFIG_FILENAME);\n\t\tif (await fileExists(candidate)) return candidate;\n\t\tconst parent = dirname(current);\n\t\tif (parent === current) return;\n\t\tcurrent = parent;\n\t}\n}\nasync function fileExists(path) {\n\ttry {\n\t\tawait access(path);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\nfunction isRecord(value) {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction collectArtifactCollisionDiagnostics(contract) {\n\tconst inputs = contract.source.inputs;\n\tconst output = contract.output;\n\tif (inputs === void 0 || output === void 0) return [];\n\tlet emittedArtifactPaths;\n\ttry {\n\t\temittedArtifactPaths = getEmittedArtifactPaths(output);\n\t} catch (error) {\n\t\treturn [errorConfigValidation(\"contract.output\", {\n\t\t\t/* v8 ignore next -- getEmittedArtifactPaths only ever throws an Error */\n\t\t\twhy: error instanceof Error ? error.message : String(error),\n\t\t\tsection: \"contract\"\n\t\t})];\n\t}\n\tconst emittedPaths = /* @__PURE__ */ new Set([emittedArtifactPaths.jsonPath, emittedArtifactPaths.dtsPath]);\n\tif (inputs.some((input) => emittedPaths.has(input))) return [errorConfigValidation(\"contract.source.inputs[]\", {\n\t\twhy: \"Config.contract.source.inputs must not include emitted artifact paths derived from contract.output\",\n\t\tsection: \"contract\"\n\t})];\n\treturn [];\n}\nfunction buildLoadedConfig(rawConfig, configDir) {\n\tconst issues = collectConfigIssues(rawConfig);\n\tconst diagnostics = issues.map((issue) => errorConfigValidation(issue.field, {\n\t\twhy: issue.message,\n\t\tsection: issue.section\n\t}));\n\tconst raw = blindCast(rawConfig);\n\tconst config = issues.some((issue) => issue.section === \"migrations\") ? raw : {\n\t\t...raw,\n\t\tmigrations: finalizeMigrationsConfig(raw.migrations, configDir)\n\t};\n\tif (config.contract === void 0 || issues.some((issue) => issue.section === \"contract\")) return {\n\t\tconfig,\n\t\tdiagnostics\n\t};\n\tconst contract = finalizeContractConfig(config.contract, configDir);\n\tdiagnostics.push(...collectArtifactCollisionDiagnostics(contract));\n\treturn {\n\t\tconfig: {\n\t\t\t...config,\n\t\t\tcontract\n\t\t},\n\t\tdiagnostics\n\t};\n}\nfunction toConfigLoadFailure(error, configPath) {\n\tif (CliStructuredError.is(error)) return error;\n\tconst resolvedPath = configPath ? resolve(process.cwd(), configPath) : void 0;\n\tif (isStructuredError(error)) return new CliStructuredError(error.code, error.message, {\n\t\t...ifDefined(\"why\", error.why),\n\t\t...ifDefined(\"fix\", error.fix),\n\t\t...ifDefined(\"where\", error.where),\n\t\t...ifDefined(\"meta\", error.meta),\n\t\tcause: error\n\t});\n\tif (error instanceof Error) return errorConfigEvaluationFailed(resolvedPath, {\n\t\twhy: error.message,\n\t\tcause: error\n\t});\n\treturn errorConfigEvaluationFailed(resolvedPath, { why: String(error) });\n}\n/**\n* Loads and finalizes the Prisma 8 config.\n*\n* Failures that prevent evaluation entirely — missing file, module that does\n* not evaluate (`CONFIG.FILE_NOT_FOUND`, `CONFIG.EVALUATION_FAILED`) — are the\n* `Result` failure. Structural problems inside an evaluated config do not\n* fail the load: they are returned as section-tagged diagnostics so commands\n* fail only on the sections they read (via {@link requireConfigSections}).\n*/\n/**\n* c12 is resolved to its real on-disk entry before importing: jiti (inside\n* c12) resolves its own transitive imports from the importing file's location,\n* and a symlinked install (pnpm) would otherwise anchor them somewhere the\n* packages are not. Importing at the real location keeps every transitive\n* resolution working.\n*/\nasync function importC12() {\n\treturn await import(pathToFileURL(realpathSync(createRequire(import.meta.url).resolve(\"c12\"))).href);\n}\nasync function loadConfig(configPath, options) {\n\tconst cwd = options?.cwd ?? process.cwd();\n\tconst resolvedConfigPath = configPath ? resolve(cwd, configPath) : void 0;\n\tconst configCwd = resolvedConfigPath ? dirname(resolvedConfigPath) : cwd;\n\tlet result;\n\ttry {\n\t\tresult = await (await importC12()).loadConfig({\n\t\t\tname: \"prisma\",\n\t\t\t...ifDefined(\"configFile\", resolvedConfigPath),\n\t\t\tcwd: configCwd\n\t\t});\n\t} catch (error) {\n\t\treturn notOk(toConfigLoadFailure(error, configPath));\n\t}\n\tif (resolvedConfigPath && result.configFile !== resolvedConfigPath) return notOk(errorConfigFileNotFound(resolvedConfigPath));\n\tif (!result.config || Object.keys(result.config).length === 0) return notOk(errorConfigFileNotFound(result.configFile || resolvedConfigPath || configPath));\n\t/* v8 ignore next -- @preserve */\n\tconst loadedConfigDir = result.configFile ? dirname(result.configFile) : configCwd;\n\t/* v8 ignore next -- c12 always returns layers for a config it evaluated */\n\tconst [requestedLayer] = result.layers ?? [];\n\tconst layerConfig = requestedLayer?.config;\n\tconst engineMarker = isRecord(layerConfig) ? layerConfig[\"$prismaConfig\"] : void 0;\n\tif (engineMarker !== void 0) {\n\t\tif (engineMarker !== 1)\n /* v8 ignore next -- a config that evaluated always carries its resolved path */\n\t\treturn notOk(errorConfigVersionMarkerMissing(result.configFile ?? resolvedConfigPath));\n\t\tconst orm = result.config[\"orm\"];\n\t\tif (orm !== void 0 && !isRecord(orm)) return ok({\n\t\t\tconfig: buildLoadedConfig({}, loadedConfigDir).config,\n\t\t\tdiagnostics: [errorConfigValidation(\"orm\", { why: `The orm section of ${CONFIG_FILENAME} must be an object` })]\n\t\t});\n\t\treturn ok(buildLoadedConfig(orm ?? {}, loadedConfigDir));\n\t}\n\t/* v8 ignore next -- a config that evaluated always carries its resolved path */\n\treturn notOk(errorConfigVersionMarkerMissing(result.configFile ?? resolvedConfigPath));\n}\n/**\n* Narrows a {@link LoadedConfig} to the sections a command reads. Fails with\n* the first diagnostic concerning a required section; diagnostics on other\n* sections are ignored so unrelated commands keep working.\n*/\nfunction requireConfigSections(loaded, sections) {\n\tconst blocking = loaded.diagnostics.find((diagnostic) => {\n\t\tconst section = diagnostic.meta?.[\"section\"];\n\t\treturn typeof section !== \"string\" || sections.some((required) => required === section);\n\t});\n\treturn blocking ? notOk(blocking) : ok(loaded.config);\n}\n/**\n* Convenience composition of {@link loadConfig} and\n* {@link requireConfigSections} for commands that read a fixed set of\n* sections and have no use for diagnostics outside them.\n*/\nasync function loadConfigForSections(configPath, sections) {\n\tconst loaded = await loadConfig(configPath);\n\tif (!loaded.ok) return loaded;\n\treturn requireConfigSections(loaded.value, sections);\n}\nasync function loadConfigForFile(filePath) {\n\tconst configPath = await findNearestConfigPathForFile(filePath);\n\tif (configPath === void 0) return notOk(errorConfigFileNotFound(join(dirname(resolve(process.cwd(), filePath)), CONFIG_FILENAME)));\n\treturn loadConfig(configPath);\n}\n//#endregion\nexport { finalizeConfig, findNearestConfigPathForFile, loadConfig, loadConfigForFile, loadConfigForSections, requireConfigSections };\n\n//# sourceMappingURL=index.mjs.map"],"mappings":";;;;;;;;;;;;;;AAcA,SAAS,uBAAuB,QAAQ,WAAW;CAClD,MAAM,iBAAiB,OAAO,QAAQ,KAAK,UAAU,QAAQ,WAAW,KAAK,CAAC;CAC9E,IAAI,mBAAmB,KAAK,GAAG,OAAO;CACtC,OAAO;EACN,GAAG;EACH,QAAQ;CACT;AACD;;AAEA,SAAS,uBAAuB,UAAU,WAAW;CACpD,MAAM,aAAa,wBAAwB,QAAQ;CACnD,OAAO;EACN,GAAG;EACH,QAAQ,uBAAuB,WAAW,QAAQ,SAAS;EAC3D,QAAQ,QAAQ,WAAW,WAAW,MAAM;CAC7C;AACD;AACA,MAAM,yBAAyB;;;;;;;AAO/B,SAAS,yBAAyB,YAAY,WAAW;CACxD,OAAO;EACN,GAAG;EACH,KAAK,QAAQ,WAAW,YAAY,OAAO,sBAAsB;CAClE;AACD;AACA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