@prisma/internals 6.6.0-dev.33 → 6.6.0-dev.35
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/{chunk-WD2267J3.js → chunk-2VT4AM4Y.js} +17 -17
- package/dist/{chunk-US3GVDJU.js → chunk-2WQVHYBS.js} +5 -5
- package/dist/{chunk-7MD6344A.js → chunk-5DBOS77Y.js} +3 -5
- package/dist/{chunk-KTB2HCCO.js → chunk-7FH5JKIS.js} +7 -7
- package/dist/{chunk-JAWGW6LI.js → chunk-BXZXLEEH.js} +9 -9
- package/dist/{chunk-PSYMCJ4B.js → chunk-CMIKSBKL.js} +8 -8
- package/dist/{chunk-TSJICM5S.js → chunk-CRVLHWC5.js} +5 -5
- package/dist/{chunk-Y5IIJ464.js → chunk-DJYSR6QD.js} +22 -22
- package/dist/{chunk-P62PZLW4.js → chunk-GNK3AD6X.js} +13 -13
- package/dist/{chunk-LN2AVE5M.js → chunk-LR3WWKZI.js} +5 -5
- package/dist/{chunk-25XBBR4V.js → chunk-NZDLSDLM.js} +5 -5
- package/dist/{chunk-UBYXOLCN.js → chunk-O3MUXTZX.js} +78 -92
- package/dist/{chunk-N4QYGJOZ.js → chunk-OKJT45NT.js} +38 -67
- package/dist/{chunk-SXCF4HKZ.js → chunk-OQZDUJAJ.js} +5 -5
- package/dist/{chunk-MM4PIVNT.js → chunk-PAIGKNMY.js} +26 -26
- package/dist/{chunk-GNEFDTJE.js → chunk-PEB6D6GV.js} +72 -86
- package/dist/{chunk-2TQR7BKX.js → chunk-Q6VZHKYE.js} +9 -9
- package/dist/{chunk-YBYBY7QI.js → chunk-U4WXIU7C.js} +5 -5
- package/dist/{chunk-EORSBI5P.js → chunk-UCI7OFQ4.js} +5 -5
- package/dist/{chunk-SK3BZQHX.js → chunk-VEWDTOV5.js} +14 -14
- package/dist/{chunk-X3CLVIIZ.js → chunk-VLBKBUPL.js} +35 -64
- package/dist/{chunk-63QLYXZV.js → chunk-WCWE5A2C.js} +4 -4
- package/dist/cli/checkUnsupportedDataProxy.js +20 -21
- package/dist/cli/getSchema.js +24 -25
- package/dist/cli/hashes.js +20 -21
- package/dist/cli/schemaContext.d.ts +16 -2
- package/dist/cli/schemaContext.js +20 -20
- package/dist/engine-commands/errorHelpers.js +4 -4
- package/dist/engine-commands/formatSchema.js +19 -20
- package/dist/engine-commands/getConfig.d.ts +0 -4
- package/dist/engine-commands/getConfig.js +12 -12
- package/dist/engine-commands/getDmmf.d.ts +1 -5
- package/dist/engine-commands/getDmmf.js +9 -9
- package/dist/engine-commands/getEngineVersion.js +5 -5
- package/dist/engine-commands/getEnginesMetaInfo.js +7 -7
- package/dist/engine-commands/index.js +30 -31
- package/dist/engine-commands/lintSchema.js +8 -8
- package/dist/engine-commands/mergeSchemas.js +9 -9
- package/dist/engine-commands/queryEngineCommons.js +6 -6
- package/dist/engine-commands/validate.js +9 -9
- package/dist/get-generators/generatorResolvers/generatorResolvers.js +19 -20
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +19 -20
- package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +20 -21
- package/dist/get-generators/getGenerators.d.ts +7 -3
- package/dist/get-generators/getGenerators.js +22 -23
- package/dist/index.d.ts +1 -1
- package/dist/index.js +59 -59
- package/dist/resolveBinary.js +7 -7
- package/dist/schemaEngineCommands.js +8 -8
- package/dist/sendPanic.js +19 -20
- package/dist/utils/extractPreviewFeatures.d.ts +2 -2
- package/dist/utils/extractPreviewFeatures.js +2 -2
- package/dist/utils/getEnvPaths.js +19 -20
- package/dist/utils/getVersionFromPackageJson.js +3 -3
- package/dist/utils/handlePanic.js +19 -20
- package/dist/utils/loadEnvFile.js +19 -20
- package/dist/wasm.js +4 -4
- package/package.json +8 -8
- package/dist/chunk-IPKE37QC.js +0 -25
- package/dist/get-generators/utils/check-feature-flags/checkFeatureFlags.d.ts +0 -8
- package/dist/get-generators/utils/check-feature-flags/checkFeatureFlags.js +0 -25
@@ -26,33 +26,33 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
26
26
|
mod
|
27
27
|
));
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var
|
30
|
-
__export(
|
29
|
+
var chunk_PAIGKNMY_exports = {};
|
30
|
+
__export(chunk_PAIGKNMY_exports, {
|
31
31
|
getEnginesInfo: () => getEnginesInfo,
|
32
32
|
getEnginesMetaInfo: () => getEnginesMetaInfo,
|
33
33
|
resolveEngine: () => resolveEngine
|
34
34
|
});
|
35
|
-
module.exports = __toCommonJS(
|
35
|
+
module.exports = __toCommonJS(chunk_PAIGKNMY_exports);
|
36
36
|
var import_chunk_ZGAIRZ32 = require("./chunk-ZGAIRZ32.js");
|
37
|
-
var
|
37
|
+
var import_chunk_7FH5JKIS = require("./chunk-7FH5JKIS.js");
|
38
38
|
var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
|
39
|
-
var
|
40
|
-
var
|
39
|
+
var import_chunk_U4WXIU7C = require("./chunk-U4WXIU7C.js");
|
40
|
+
var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
|
41
41
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
42
42
|
var import_engines = require("@prisma/engines");
|
43
43
|
var import_fetch_engine = require("@prisma/fetch-engine");
|
44
44
|
var import_path = __toESM(require("path"));
|
45
45
|
var import_function2 = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_ZGAIRZ32.require_function)());
|
46
|
-
var none2 =
|
47
|
-
var some2 =
|
46
|
+
var none2 = import_chunk_5DBOS77Y.none;
|
47
|
+
var some2 = import_chunk_5DBOS77Y.some;
|
48
48
|
var getRight = function(ma) {
|
49
49
|
return ma._tag === "Left" ? none2 : some2(ma.right);
|
50
50
|
};
|
51
51
|
var _map = function(fa, f) {
|
52
|
-
return (0,
|
52
|
+
return (0, import_chunk_5DBOS77Y.pipe)(fa, map(f));
|
53
53
|
};
|
54
54
|
var _ap = function(fab, fa) {
|
55
|
-
return (0,
|
55
|
+
return (0, import_chunk_5DBOS77Y.pipe)(fab, ap(fa));
|
56
56
|
};
|
57
57
|
var URI = "Option";
|
58
58
|
var map = function(f) {
|
@@ -64,14 +64,14 @@ var Functor = {
|
|
64
64
|
URI,
|
65
65
|
map: _map
|
66
66
|
};
|
67
|
-
var as2 = (0,
|
68
|
-
var asUnit2 = (0,
|
67
|
+
var as2 = (0, import_chunk_5DBOS77Y.dual)(2, (0, import_chunk_5DBOS77Y.as)(Functor));
|
68
|
+
var asUnit2 = (0, import_chunk_5DBOS77Y.asUnit)(Functor);
|
69
69
|
var ap = function(fa) {
|
70
70
|
return function(fab) {
|
71
71
|
return isNone(fab) ? none2 : isNone(fa) ? none2 : some2(fab.value(fa.value));
|
72
72
|
};
|
73
73
|
};
|
74
|
-
var flatMap = /* @__PURE__ */ (0,
|
74
|
+
var flatMap = /* @__PURE__ */ (0, import_chunk_5DBOS77Y.dual)(2, function(ma, f) {
|
75
75
|
return isNone(ma) ? none2 : f(ma.value);
|
76
76
|
});
|
77
77
|
var Chain = {
|
@@ -80,7 +80,7 @@ var Chain = {
|
|
80
80
|
ap: _ap,
|
81
81
|
chain: flatMap
|
82
82
|
};
|
83
|
-
var orElse = (0,
|
83
|
+
var orElse = (0, import_chunk_5DBOS77Y.dual)(2, function(self, that) {
|
84
84
|
return isNone(self) ? that() : self;
|
85
85
|
});
|
86
86
|
var fromEither2 = getRight;
|
@@ -88,7 +88,7 @@ var FromEither = {
|
|
88
88
|
URI,
|
89
89
|
fromEither: fromEither2
|
90
90
|
};
|
91
|
-
var isSome2 =
|
91
|
+
var isSome2 = import_chunk_5DBOS77Y.isSome;
|
92
92
|
var isNone = function(fa) {
|
93
93
|
return fa._tag === "None";
|
94
94
|
};
|
@@ -99,8 +99,8 @@ var matchW = function(onNone, onSome) {
|
|
99
99
|
};
|
100
100
|
var match = matchW;
|
101
101
|
var fold = match;
|
102
|
-
var tap2 = /* @__PURE__ */ (0,
|
103
|
-
var tapEither2 = /* @__PURE__ */ (0,
|
102
|
+
var tap2 = /* @__PURE__ */ (0, import_chunk_5DBOS77Y.dual)(2, (0, import_chunk_5DBOS77Y.tap)(Chain));
|
103
|
+
var tapEither2 = /* @__PURE__ */ (0, import_chunk_5DBOS77Y.dual)(2, (0, import_chunk_5DBOS77Y.tapEither)(FromEither, Chain));
|
104
104
|
var fromNullable = function(a) {
|
105
105
|
return a == null ? none2 : some2(a);
|
106
106
|
};
|
@@ -133,15 +133,15 @@ function getEnginesInfo(enginesInfo) {
|
|
133
133
|
const resolved = (0, import_chunk_XKZ6CBLA.z)(enginesInfo).with({ fromEnvVar: import_chunk_XKZ6CBLA.N.when(isSome2) }, (_engineInfo) => {
|
134
134
|
return `, resolved by ${_engineInfo.fromEnvVar.value}`;
|
135
135
|
}).otherwise(() => "");
|
136
|
-
const absolutePath = (0, import_chunk_XKZ6CBLA.z)(enginesInfo).with({ path: import_chunk_XKZ6CBLA.N.when(
|
136
|
+
const absolutePath = (0, import_chunk_XKZ6CBLA.z)(enginesInfo).with({ path: import_chunk_XKZ6CBLA.N.when(import_chunk_5DBOS77Y.isRight) }, (_engineInfo) => {
|
137
137
|
return _engineInfo.path.right;
|
138
|
-
}).with({ path: import_chunk_XKZ6CBLA.N.when(
|
138
|
+
}).with({ path: import_chunk_XKZ6CBLA.N.when(import_chunk_5DBOS77Y.isLeft) }, (_engineInfo) => {
|
139
139
|
errors.push(_engineInfo.path.left);
|
140
140
|
return "E_CANNOT_RESOLVE_PATH";
|
141
141
|
}).exhaustive();
|
142
|
-
const version = (0, import_chunk_XKZ6CBLA.z)(enginesInfo).with({ version: import_chunk_XKZ6CBLA.N.when(
|
142
|
+
const version = (0, import_chunk_XKZ6CBLA.z)(enginesInfo).with({ version: import_chunk_XKZ6CBLA.N.when(import_chunk_5DBOS77Y.isRight) }, (_engineInfo) => {
|
143
143
|
return _engineInfo.version.right;
|
144
|
-
}).with({ version: import_chunk_XKZ6CBLA.N.when(
|
144
|
+
}).with({ version: import_chunk_XKZ6CBLA.N.when(import_chunk_5DBOS77Y.isLeft) }, (_engineInfo) => {
|
145
145
|
errors.push(_engineInfo.version.left);
|
146
146
|
return "E_CANNOT_RESOLVE_VERSION";
|
147
147
|
}).exhaustive();
|
@@ -157,15 +157,15 @@ async function resolveEngine(binaryName) {
|
|
157
157
|
const enginePathEither = await (0, import_function2.pipe)(
|
158
158
|
pathFromEnvOption,
|
159
159
|
fold(
|
160
|
-
() => (0,
|
161
|
-
(pathFromEnv) => (0,
|
160
|
+
() => (0, import_chunk_U4WXIU7C.safeResolveBinary)(binaryName),
|
161
|
+
(pathFromEnv) => (0, import_chunk_5DBOS77Y.right2)(pathFromEnv.path)
|
162
162
|
)
|
163
163
|
)();
|
164
164
|
const versionEither = await (0, import_function2.pipe)(
|
165
165
|
enginePathEither,
|
166
|
-
|
167
|
-
(0,
|
168
|
-
return (0,
|
166
|
+
import_chunk_5DBOS77Y.fromEither,
|
167
|
+
(0, import_chunk_5DBOS77Y.chain)((enginePath) => {
|
168
|
+
return (0, import_chunk_7FH5JKIS.safeGetEngineVersion)(enginePath, binaryName);
|
169
169
|
})
|
170
170
|
)();
|
171
171
|
const engineInfo = {
|
@@ -26,8 +26,8 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__g
|
|
26
26
|
mod
|
27
27
|
));
|
28
28
|
var __toCommonJS2 = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var
|
30
|
-
__export2(
|
29
|
+
var chunk_PEB6D6GV_exports = {};
|
30
|
+
__export2(chunk_PEB6D6GV_exports, {
|
31
31
|
checkTypeScriptVersion: () => checkTypeScriptVersion,
|
32
32
|
checkUnsupportedDataProxy: () => checkUnsupportedDataProxy,
|
33
33
|
debug: () => debug5,
|
@@ -52,15 +52,15 @@ __export2(chunk_GNEFDTJE_exports, {
|
|
52
52
|
loadEnvFile: () => loadEnvFile,
|
53
53
|
loadSchemaContext: () => loadSchemaContext,
|
54
54
|
prismaClientResolver: () => prismaClientResolver,
|
55
|
+
processSchemaResult: () => processSchemaResult,
|
55
56
|
sendPanic: () => sendPanic,
|
56
57
|
skipIndex: () => skipIndex
|
57
58
|
});
|
58
|
-
module.exports = __toCommonJS2(
|
59
|
-
var import_chunk_ETNCBIDF = require("./chunk-ETNCBIDF.js");
|
59
|
+
module.exports = __toCommonJS2(chunk_PEB6D6GV_exports);
|
60
60
|
var import_chunk_GHHABGYW = require("./chunk-GHHABGYW.js");
|
61
61
|
var import_chunk_EUTJYQDW = require("./chunk-EUTJYQDW.js");
|
62
|
-
var import_chunk_IPKE37QC = require("./chunk-IPKE37QC.js");
|
63
62
|
var import_chunk_DGZO4GAJ = require("./chunk-DGZO4GAJ.js");
|
63
|
+
var import_chunk_ETNCBIDF = require("./chunk-ETNCBIDF.js");
|
64
64
|
var import_chunk_72UZXEBG = require("./chunk-72UZXEBG.js");
|
65
65
|
var import_chunk_X77CS5RK = require("./chunk-X77CS5RK.js");
|
66
66
|
var import_chunk_EIERU2IM = require("./chunk-EIERU2IM.js");
|
@@ -78,11 +78,11 @@ var import_chunk_FNA4EAZ6 = require("./chunk-FNA4EAZ6.js");
|
|
78
78
|
var import_chunk_J77ZIDXB = require("./chunk-J77ZIDXB.js");
|
79
79
|
var import_chunk_2T4NJDHK = require("./chunk-2T4NJDHK.js");
|
80
80
|
var import_chunk_R3J2O23S = require("./chunk-R3J2O23S.js");
|
81
|
-
var
|
81
|
+
var import_chunk_CRVLHWC5 = require("./chunk-CRVLHWC5.js");
|
82
82
|
var import_chunk_7CMXNYMQ = require("./chunk-7CMXNYMQ.js");
|
83
|
-
var
|
84
|
-
var
|
85
|
-
var
|
83
|
+
var import_chunk_Q6VZHKYE = require("./chunk-Q6VZHKYE.js");
|
84
|
+
var import_chunk_2VT4AM4Y = require("./chunk-2VT4AM4Y.js");
|
85
|
+
var import_chunk_VLBKBUPL = require("./chunk-VLBKBUPL.js");
|
86
86
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
87
87
|
var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
|
88
88
|
var import_chunk_R7U45FIQ = require("./chunk-R7U45FIQ.js");
|
@@ -14013,8 +14013,8 @@ var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14013
14013
|
status: "disabled"
|
14014
14014
|
};
|
14015
14015
|
}
|
14016
|
-
const
|
14017
|
-
const cacheResponse = await
|
14016
|
+
const config = await Config.new(state);
|
14017
|
+
const cacheResponse = await config.checkCache(state);
|
14018
14018
|
state.check_if_update_available = cacheResponse.stale === true || !cacheResponse.cache;
|
14019
14019
|
const child = spawn(state);
|
14020
14020
|
if (state.unref) {
|
@@ -14029,7 +14029,7 @@ var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14029
14029
|
}
|
14030
14030
|
for (const key of Object.keys(state)) {
|
14031
14031
|
if (state[key]) {
|
14032
|
-
await
|
14032
|
+
await config.set({
|
14033
14033
|
[key]: state[key]
|
14034
14034
|
});
|
14035
14035
|
}
|
@@ -14041,7 +14041,7 @@ var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14041
14041
|
data: cacheResponse.cache.output
|
14042
14042
|
};
|
14043
14043
|
}
|
14044
|
-
await
|
14044
|
+
await config.set({
|
14045
14045
|
last_reminder: state.now()
|
14046
14046
|
});
|
14047
14047
|
return {
|
@@ -14532,12 +14532,12 @@ async function readSchemaFromDirectory(schemaPath2) {
|
|
14532
14532
|
}
|
14533
14533
|
const files = await (0, import_schema_files_loader.loadSchemaFiles)(schemaPath2);
|
14534
14534
|
debug2("Loading config");
|
14535
|
-
const
|
14535
|
+
const config = await (0, import_chunk_2VT4AM4Y.getConfig)({
|
14536
14536
|
datamodel: files,
|
14537
14537
|
ignoreEnvVarErrors: true
|
14538
14538
|
});
|
14539
14539
|
debug2("Ok");
|
14540
|
-
if (!(0, import_schema_files_loader.usesPrismaSchemaFolder)(
|
14540
|
+
if (!(0, import_schema_files_loader.usesPrismaSchemaFolder)(config)) {
|
14541
14541
|
return { ok: false, error: { kind: "FolderPreviewNotEnabled", path: schemaPath2 } };
|
14542
14542
|
}
|
14543
14543
|
return { ok: true, schema: { schemaPath: schemaPath2, schemaRootDir: schemaPath2, schemas: files } };
|
@@ -14640,23 +14640,23 @@ async function readSchemaFromPrismaConfigBasedLocation(schemaPathFromConfig) {
|
|
14640
14640
|
error: { kind: "PrismaConfigNotConfigured" }
|
14641
14641
|
};
|
14642
14642
|
}
|
14643
|
-
let
|
14643
|
+
let schemaResult;
|
14644
14644
|
if (schemaPathFromConfig.kind === "single") {
|
14645
|
-
|
14646
|
-
if (!
|
14645
|
+
schemaResult = await readSchemaFromSingleFile(schemaPathFromConfig.filePath);
|
14646
|
+
if (!schemaResult.ok) {
|
14647
14647
|
throw new Error(
|
14648
|
-
`Could not load schema from file \`${schemaPathFromConfig.filePath}\` provided by "prisma.config.ts"\`: ${renderLookupError(
|
14648
|
+
`Could not load schema from file \`${schemaPathFromConfig.filePath}\` provided by "prisma.config.ts"\`: ${renderLookupError(schemaResult.error)}`
|
14649
14649
|
);
|
14650
14650
|
}
|
14651
14651
|
} else {
|
14652
|
-
|
14653
|
-
if (!
|
14652
|
+
schemaResult = await readSchemaFromDirectory(schemaPathFromConfig.folderPath);
|
14653
|
+
if (!schemaResult.ok) {
|
14654
14654
|
throw new Error(
|
14655
|
-
`Could not load schema from folder \`${schemaPathFromConfig.folderPath}\` provided by "prisma.config.ts"\`: ${renderLookupError(
|
14655
|
+
`Could not load schema from folder \`${schemaPathFromConfig.folderPath}\` provided by "prisma.config.ts"\`: ${renderLookupError(schemaResult.error)}`
|
14656
14656
|
);
|
14657
14657
|
}
|
14658
14658
|
}
|
14659
|
-
return
|
14659
|
+
return schemaResult;
|
14660
14660
|
}
|
14661
14661
|
async function getSchemaFromPackageJson(cwd) {
|
14662
14662
|
const prismaConfig = await getPrismaConfigFromPackageJson(cwd);
|
@@ -14826,10 +14826,10 @@ function schemaPathToEnvPath(schemaPath2) {
|
|
14826
14826
|
}
|
14827
14827
|
async function loadEnvFile({
|
14828
14828
|
schemaPath: schemaPath2,
|
14829
|
-
config
|
14829
|
+
config,
|
14830
14830
|
printMessage = false
|
14831
14831
|
}) {
|
14832
|
-
if (
|
14832
|
+
if (config.loadedFromFile) {
|
14833
14833
|
process.stdout.write(`Prisma config detected, skipping environment variable loading.
|
14834
14834
|
`);
|
14835
14835
|
return;
|
@@ -14858,8 +14858,8 @@ async function checkUnsupportedDataProxyMessage(command, args, schemaPathFromCon
|
|
14858
14858
|
if (argName.includes("schema")) {
|
14859
14859
|
await loadEnvFile({ schemaPath: argValue, printMessage: false, config: (0, import_config.defaultTestConfig)() });
|
14860
14860
|
const datamodel = await import_fs.default.promises.readFile(argValue, "utf-8");
|
14861
|
-
const
|
14862
|
-
const url = (0,
|
14861
|
+
const config = await (0, import_chunk_2VT4AM4Y.getConfig)({ datamodel, ignoreEnvVarErrors: true });
|
14862
|
+
const url = (0, import_chunk_2VT4AM4Y.resolveUrl)((0, import_chunk_2VT4AM4Y.getEffectiveUrl)(config.datasources[0]));
|
14863
14863
|
if (url?.startsWith("prisma://")) {
|
14864
14864
|
return forbiddenCmdWithDataProxyFlagMessage(command);
|
14865
14865
|
}
|
@@ -14885,35 +14885,39 @@ async function loadSchemaContext({
|
|
14885
14885
|
schemaPathFromArg,
|
14886
14886
|
schemaPathFromConfig,
|
14887
14887
|
printLoadMessage = true,
|
14888
|
+
ignoreEnvVarErrors = false,
|
14888
14889
|
allowNull = false
|
14889
|
-
}) {
|
14890
|
-
let
|
14890
|
+
} = {}) {
|
14891
|
+
let schemaResult = null;
|
14891
14892
|
if (allowNull) {
|
14892
|
-
|
14893
|
-
if (!
|
14893
|
+
schemaResult = await getSchemaWithPathOptional(schemaPathFromArg, schemaPathFromConfig);
|
14894
|
+
if (!schemaResult) return null;
|
14894
14895
|
} else {
|
14895
|
-
|
14896
|
+
schemaResult = await getSchemaWithPath(schemaPathFromArg, schemaPathFromConfig);
|
14896
14897
|
}
|
14897
|
-
return processSchemaResult({ schemaResult
|
14898
|
+
return processSchemaResult({ schemaResult, printLoadMessage, ignoreEnvVarErrors });
|
14898
14899
|
}
|
14899
14900
|
async function processSchemaResult({
|
14900
|
-
schemaResult
|
14901
|
-
printLoadMessage
|
14901
|
+
schemaResult,
|
14902
|
+
printLoadMessage = true,
|
14903
|
+
ignoreEnvVarErrors = false
|
14902
14904
|
}) {
|
14903
14905
|
const cwd = process.cwd();
|
14904
|
-
const loadedFromPathForLogMessages = import_path3.default.relative(cwd,
|
14906
|
+
const loadedFromPathForLogMessages = import_path3.default.relative(cwd, schemaResult.schemaPath);
|
14905
14907
|
if (printLoadMessage) {
|
14906
14908
|
process.stdout.write((0, import_chunk_PG5FDKSF.dim)(`Prisma schema loaded from ${loadedFromPathForLogMessages}`) + "\n");
|
14907
14909
|
}
|
14908
|
-
const configFromPsl = await (0,
|
14910
|
+
const configFromPsl = await (0, import_chunk_2VT4AM4Y.getConfig)({ datamodel: schemaResult.schemas, ignoreEnvVarErrors });
|
14909
14911
|
const primaryDatasource = configFromPsl.datasources.at(0);
|
14910
14912
|
return {
|
14911
|
-
schemaFiles:
|
14912
|
-
schemaPath:
|
14913
|
-
schemaRootDir:
|
14913
|
+
schemaFiles: schemaResult.schemas,
|
14914
|
+
schemaPath: schemaResult.schemaPath,
|
14915
|
+
schemaRootDir: schemaResult.schemaRootDir || cwd,
|
14916
|
+
datasources: configFromPsl.datasources,
|
14914
14917
|
generators: configFromPsl.generators,
|
14915
14918
|
primaryDatasource,
|
14916
|
-
primaryDatasourceDirectory: primaryDatasourceDirectory(primaryDatasource) ||
|
14919
|
+
primaryDatasourceDirectory: primaryDatasourceDirectory(primaryDatasource) || schemaResult.schemaRootDir || cwd,
|
14920
|
+
warnings: configFromPsl.warnings,
|
14917
14921
|
loadedFromPathForLogMessages
|
14918
14922
|
};
|
14919
14923
|
}
|
@@ -15045,21 +15049,14 @@ async function getGenerators(options) {
|
|
15045
15049
|
allowNoModels,
|
15046
15050
|
typedSql
|
15047
15051
|
} = options;
|
15048
|
-
|
15049
|
-
|
15052
|
+
const schemaContext = !options.schemaContext && schemaPath ? await loadSchemaContext({ schemaPathFromArg: schemaPath, ignoreEnvVarErrors: true }) : options.schemaContext;
|
15053
|
+
if (!schemaContext) {
|
15054
|
+
throw new Error(`no schema provided for getGenerators`);
|
15050
15055
|
}
|
15051
|
-
let schemaResult = null;
|
15052
|
-
try {
|
15053
|
-
schemaResult = await getSchemaWithPath(schemaPath);
|
15054
|
-
} catch (_2) {
|
15055
|
-
throw new Error(`${schemaPath} does not exist`);
|
15056
|
-
}
|
15057
|
-
const { schemas } = schemaResult;
|
15058
15056
|
const binaryTarget = await (0, import_get_platform.getBinaryTargetForCurrentPlatform)();
|
15059
15057
|
const queryEngineBinaryType = (0, import_engines.getCliQueryEngineBinaryType)();
|
15060
15058
|
const queryEngineType = (0, import_chunk_RS2R7COT.binaryTypeToEngineType)(queryEngineBinaryType);
|
15061
|
-
|
15062
|
-
if (version && !prismaPath) {
|
15059
|
+
if (version && !binaryPathsOverride?.[queryEngineType]) {
|
15063
15060
|
const potentialPath = eval(`require('path').join(__dirname, '..')`);
|
15064
15061
|
if (!potentialPath.match(import_chunk_M3GBKLGE.vercelPkgPathRegex)) {
|
15065
15062
|
const downloadParams = {
|
@@ -15071,35 +15068,25 @@ async function getGenerators(options) {
|
|
15071
15068
|
version,
|
15072
15069
|
skipDownload
|
15073
15070
|
};
|
15074
|
-
|
15075
|
-
prismaPath = binaryPathsWithEngineType[queryEngineBinaryType][binaryTarget];
|
15071
|
+
await (0, import_fetch_engine.download)(downloadParams);
|
15076
15072
|
}
|
15077
15073
|
}
|
15078
|
-
|
15079
|
-
datamodel: schemas,
|
15080
|
-
datamodelPath: schemaPath,
|
15081
|
-
prismaPath,
|
15082
|
-
ignoreEnvVarErrors: true
|
15083
|
-
});
|
15084
|
-
if (config.datasources.length === 0) {
|
15074
|
+
if (!schemaContext.primaryDatasource) {
|
15085
15075
|
throw new Error(import_chunk_2ZPYYZJB.missingDatasource);
|
15086
15076
|
}
|
15087
|
-
(0, import_chunk_5FJ3MENK.printConfigWarnings)(
|
15088
|
-
const previewFeatures = (0,
|
15089
|
-
const dmmf = await (0,
|
15090
|
-
datamodel:
|
15091
|
-
datamodelPath: schemaPath,
|
15092
|
-
prismaPath,
|
15077
|
+
(0, import_chunk_5FJ3MENK.printConfigWarnings)(schemaContext.warnings);
|
15078
|
+
const previewFeatures = (0, import_chunk_CRVLHWC5.extractPreviewFeatures)(schemaContext.generators);
|
15079
|
+
const dmmf = await (0, import_chunk_VLBKBUPL.getDMMF)({
|
15080
|
+
datamodel: schemaContext.schemaFiles,
|
15093
15081
|
previewFeatures
|
15094
15082
|
});
|
15095
15083
|
if (dmmf.datamodel.models.length === 0 && !allowNoModels) {
|
15096
|
-
if (
|
15084
|
+
if (schemaContext.primaryDatasource.provider === "mongodb") {
|
15097
15085
|
throw new Error(import_chunk_HL5VFJX4.missingModelMessageMongoDB);
|
15098
15086
|
}
|
15099
15087
|
throw new Error(import_chunk_HL5VFJX4.missingModelMessage);
|
15100
15088
|
}
|
15101
|
-
(
|
15102
|
-
const generatorConfigs = filterGenerators(overrideGenerators || config.generators, generatorNames);
|
15089
|
+
const generatorConfigs = filterGenerators(overrideGenerators || schemaContext.generators, generatorNames);
|
15103
15090
|
await validateGenerators(generatorConfigs);
|
15104
15091
|
const runningGenerators = [];
|
15105
15092
|
try {
|
@@ -15108,7 +15095,7 @@ async function getGenerators(options) {
|
|
15108
15095
|
async (generator, index2) => {
|
15109
15096
|
let generatorPath = (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.provider);
|
15110
15097
|
let paths2;
|
15111
|
-
const baseDir = import_path4.default.dirname(generator.sourceFilePath ??
|
15098
|
+
const baseDir = import_path4.default.dirname(generator.sourceFilePath ?? schemaContext.schemaRootDir);
|
15112
15099
|
const providerValue = (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.provider);
|
15113
15100
|
if (aliases && aliases[providerValue]) {
|
15114
15101
|
generatorPath = aliases[providerValue].generatorPath;
|
@@ -15147,15 +15134,16 @@ The generator needs to either define the \`defaultOutput\` path in the manifest
|
|
15147
15134
|
fromEnvVar: null
|
15148
15135
|
};
|
15149
15136
|
}
|
15150
|
-
const datamodel = (0,
|
15151
|
-
const envPaths2 = await getEnvPaths(schemaPath, { cwd: generator.output.value });
|
15137
|
+
const datamodel = (0, import_chunk_Q6VZHKYE.mergeSchemas)({ schemas: schemaContext.schemaFiles });
|
15138
|
+
const envPaths2 = await getEnvPaths(schemaContext.schemaPath, { cwd: generator.output.value });
|
15152
15139
|
const options2 = {
|
15153
15140
|
datamodel,
|
15154
|
-
datasources:
|
15141
|
+
datasources: schemaContext.datasources,
|
15155
15142
|
generator,
|
15156
15143
|
dmmf,
|
15157
15144
|
otherGenerators: skipIndex(generatorConfigs, index2),
|
15158
|
-
schemaPath,
|
15145
|
+
schemaPath: schemaContext.schemaPath,
|
15146
|
+
// TODO:(schemaPath) can we get rid of schema path passing here?
|
15159
15147
|
version: version || import_engines.enginesVersion,
|
15160
15148
|
// this version makes no sense anymore and should be ignored
|
15161
15149
|
postinstall,
|
@@ -15230,10 +15218,8 @@ generator gen {
|
|
15230
15218
|
debug6({ generatorBinaryPaths });
|
15231
15219
|
generator.setBinaryPaths(generatorBinaryPaths);
|
15232
15220
|
if (engineVersion !== version && generator.options && generator.manifest.requiresEngines.includes(queryEngineType) && generatorBinaryPaths[queryEngineType] && generatorBinaryPaths[queryEngineType]?.[binaryTarget]) {
|
15233
|
-
const customDmmf = await (0,
|
15234
|
-
datamodel:
|
15235
|
-
datamodelPath: schemaPath,
|
15236
|
-
prismaPath: generatorBinaryPaths[queryEngineType]?.[binaryTarget],
|
15221
|
+
const customDmmf = await (0, import_chunk_VLBKBUPL.getDMMF)({
|
15222
|
+
datamodel: schemaContext.schemaFiles,
|
15237
15223
|
previewFeatures
|
15238
15224
|
});
|
15239
15225
|
const options2 = { ...generator.options, dmmf: customDmmf };
|
@@ -15524,13 +15510,13 @@ ${(0, import_chunk_PG5FDKSF.bold)("Thanks a lot for your help! \u{1F64F}")}`);
|
|
15524
15510
|
process.exit(1);
|
15525
15511
|
}
|
15526
15512
|
var debug7 = (0, import_debug.default)("prisma:format");
|
15527
|
-
async function formatSchema({ schemas
|
15513
|
+
async function formatSchema({ schemas }, inputFormattingOptions) {
|
15528
15514
|
if (process.env.FORCE_PANIC_PRISMA_SCHEMA) {
|
15529
15515
|
handleFormatPanic(
|
15530
15516
|
() => {
|
15531
15517
|
import_chunk_R7U45FIQ.prismaSchemaWasm.debug_panic();
|
15532
15518
|
},
|
15533
|
-
{ schemas
|
15519
|
+
{ schemas }
|
15534
15520
|
);
|
15535
15521
|
}
|
15536
15522
|
const defaultFormattingOptions = {
|
@@ -15546,12 +15532,12 @@ async function formatSchema({ schemas: schemas2 }, inputFormattingOptions) {
|
|
15546
15532
|
};
|
15547
15533
|
const { formattedMultipleSchemas, lintDiagnostics } = handleFormatPanic(
|
15548
15534
|
() => {
|
15549
|
-
const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(
|
15535
|
+
const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(schemas), documentFormattingParams);
|
15550
15536
|
const formattedMultipleSchemas2 = JSON.parse(formattedMultipleSchemasRaw);
|
15551
15537
|
const lintDiagnostics2 = (0, import_chunk_7CMXNYMQ.lintSchema)({ schemas: formattedMultipleSchemas2 });
|
15552
15538
|
return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
|
15553
15539
|
},
|
15554
|
-
{ schemas
|
15540
|
+
{ schemas }
|
15555
15541
|
);
|
15556
15542
|
const lintWarnings = (0, import_chunk_7CMXNYMQ.getLintWarningsAsText)(lintDiagnostics);
|
15557
15543
|
if (lintWarnings && import_chunk_MBB2KJWX.logger_exports.should.warn()) {
|
@@ -15559,7 +15545,7 @@ async function formatSchema({ schemas: schemas2 }, inputFormattingOptions) {
|
|
15559
15545
|
}
|
15560
15546
|
return Promise.resolve(formattedMultipleSchemas);
|
15561
15547
|
}
|
15562
|
-
function handleFormatPanic(tryCb, { schemas
|
15548
|
+
function handleFormatPanic(tryCb, { schemas }) {
|
15563
15549
|
try {
|
15564
15550
|
return tryCb();
|
15565
15551
|
} catch (e) {
|
@@ -15575,9 +15561,9 @@ function handleFormatPanic(tryCb, { schemas: schemas2 }) {
|
|
15575
15561
|
"@prisma/prisma-schema-wasm format",
|
15576
15562
|
"FMT_CLI",
|
15577
15563
|
/* schemaPath */
|
15578
|
-
(0, import_chunk_YRBRUREX.debugMultipleSchemaPaths)(
|
15564
|
+
(0, import_chunk_YRBRUREX.debugMultipleSchemaPaths)(schemas),
|
15579
15565
|
/* schema */
|
15580
|
-
|
15566
|
+
schemas
|
15581
15567
|
);
|
15582
15568
|
throw panic;
|
15583
15569
|
}
|
@@ -26,21 +26,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
26
26
|
mod
|
27
27
|
));
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var
|
30
|
-
__export(
|
29
|
+
var chunk_Q6VZHKYE_exports = {};
|
30
|
+
__export(chunk_Q6VZHKYE_exports, {
|
31
31
|
MergeSchemasError: () => MergeSchemasError,
|
32
32
|
mergeSchemas: () => mergeSchemas
|
33
33
|
});
|
34
|
-
module.exports = __toCommonJS(
|
34
|
+
module.exports = __toCommonJS(chunk_Q6VZHKYE_exports);
|
35
35
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
36
|
-
var
|
36
|
+
var import_chunk_CMIKSBKL = require("./chunk-CMIKSBKL.js");
|
37
37
|
var import_chunk_ZGAIRZ32 = require("./chunk-ZGAIRZ32.js");
|
38
38
|
var import_chunk_C47SCASR = require("./chunk-C47SCASR.js");
|
39
39
|
var import_chunk_QKPV6M3S = require("./chunk-QKPV6M3S.js");
|
40
40
|
var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
|
41
41
|
var import_chunk_R7U45FIQ = require("./chunk-R7U45FIQ.js");
|
42
42
|
var import_chunk_CCQRDM7X = require("./chunk-CCQRDM7X.js");
|
43
|
-
var
|
43
|
+
var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
|
44
44
|
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
45
45
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
46
46
|
var import_debug = __toESM(require("@prisma/debug"));
|
@@ -65,10 +65,10 @@ ${detailsHeader} ${message}`;
|
|
65
65
|
}
|
66
66
|
};
|
67
67
|
function mergeSchemas(options) {
|
68
|
-
const debugErrorType = (0,
|
68
|
+
const debugErrorType = (0, import_chunk_CMIKSBKL.createDebugErrorType)(debug, "mergeSchemasWasm");
|
69
69
|
debug(`Using mergeSchemas Wasm`);
|
70
70
|
const mergeSchemasEither = (0, import_function.pipe)(
|
71
|
-
(0,
|
71
|
+
(0, import_chunk_5DBOS77Y.tryCatch)(
|
72
72
|
() => {
|
73
73
|
const params = JSON.stringify({
|
74
74
|
schema: options.schemas
|
@@ -82,7 +82,7 @@ function mergeSchemas(options) {
|
|
82
82
|
})
|
83
83
|
)
|
84
84
|
);
|
85
|
-
if ((0,
|
85
|
+
if ((0, import_chunk_5DBOS77Y.isRight)(mergeSchemasEither)) {
|
86
86
|
return mergeSchemasEither.right;
|
87
87
|
}
|
88
88
|
const error = (0, import_chunk_XKZ6CBLA.z)(mergeSchemasEither.left).with({ type: "wasm-error" }, (e) => {
|
@@ -108,7 +108,7 @@ function mergeSchemas(options) {
|
|
108
108
|
return panic;
|
109
109
|
}
|
110
110
|
const errorOutput = e.error.message;
|
111
|
-
return new MergeSchemasError((0,
|
111
|
+
return new MergeSchemasError((0, import_chunk_CMIKSBKL.parseQueryEngineError)({ errorOutput, reason: e.reason }));
|
112
112
|
}).exhaustive();
|
113
113
|
throw error;
|
114
114
|
}
|
@@ -26,19 +26,19 @@ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__g
|
|
26
26
|
mod
|
27
27
|
));
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
var
|
30
|
-
__export(
|
29
|
+
var chunk_U4WXIU7C_exports = {};
|
30
|
+
__export(chunk_U4WXIU7C_exports, {
|
31
31
|
BinaryType: () => import_fetch_engine.BinaryType,
|
32
32
|
engineEnvVarMap: () => import_fetch_engine.engineEnvVarMap,
|
33
33
|
maybeCopyToTmp: () => maybeCopyToTmp,
|
34
34
|
resolveBinary: () => resolveBinary,
|
35
35
|
safeResolveBinary: () => safeResolveBinary
|
36
36
|
});
|
37
|
-
module.exports = __toCommonJS(
|
37
|
+
module.exports = __toCommonJS(chunk_U4WXIU7C_exports);
|
38
38
|
var import_chunk_RAYPCPVU = require("./chunk-RAYPCPVU.js");
|
39
39
|
var import_chunk_M3GBKLGE = require("./chunk-M3GBKLGE.js");
|
40
40
|
var import_chunk_TWSLDIFL = require("./chunk-TWSLDIFL.js");
|
41
|
-
var
|
41
|
+
var import_chunk_5DBOS77Y = require("./chunk-5DBOS77Y.js");
|
42
42
|
var import_chunk_6TVEFPKE = require("./chunk-6TVEFPKE.js");
|
43
43
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
44
44
|
var import_engines = require("@prisma/engines");
|
@@ -90,7 +90,7 @@ async function resolveBinary(name, proposedPath) {
|
|
90
90
|
);
|
91
91
|
}
|
92
92
|
function safeResolveBinary(name, proposedPath) {
|
93
|
-
return (0,
|
93
|
+
return (0, import_chunk_5DBOS77Y.tryCatch2)(
|
94
94
|
() => resolveBinary(name, proposedPath),
|
95
95
|
(error) => error
|
96
96
|
);
|
@@ -16,17 +16,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
16
16
|
return to;
|
17
17
|
};
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
var
|
20
|
-
__export(
|
19
|
+
var chunk_UCI7OFQ4_exports = {};
|
20
|
+
__export(chunk_UCI7OFQ4_exports, {
|
21
21
|
SchemaEngineExitCode: () => SchemaEngineExitCode,
|
22
22
|
canConnectToDatabase: () => canConnectToDatabase,
|
23
23
|
createDatabase: () => createDatabase,
|
24
24
|
dropDatabase: () => dropDatabase,
|
25
25
|
execaCommand: () => execaCommand
|
26
26
|
});
|
27
|
-
module.exports = __toCommonJS(
|
27
|
+
module.exports = __toCommonJS(chunk_UCI7OFQ4_exports);
|
28
28
|
var import_chunk_2WR3PY2L = require("./chunk-2WR3PY2L.js");
|
29
|
-
var
|
29
|
+
var import_chunk_U4WXIU7C = require("./chunk-U4WXIU7C.js");
|
30
30
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
31
31
|
var import_fetch_engine = require("@prisma/fetch-engine");
|
32
32
|
var import_execa = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_2WR3PY2L.require_execa)());
|
@@ -141,7 +141,7 @@ async function execaCommand({
|
|
141
141
|
schemaEnginePath,
|
142
142
|
engineCommandName
|
143
143
|
}) {
|
144
|
-
schemaEnginePath = schemaEnginePath || await (0,
|
144
|
+
schemaEnginePath = schemaEnginePath || await (0, import_chunk_U4WXIU7C.resolveBinary)(import_fetch_engine.BinaryType.SchemaEngineBinary);
|
145
145
|
try {
|
146
146
|
return await (0, import_execa.default)(schemaEnginePath, ["cli", "--datasource", connectionString, engineCommandName], {
|
147
147
|
cwd,
|