@prisma/internals 6.6.0-integration-engines-6-6-0-17-refactor-migrate-to-new-interface-a65ab979bf81a122861f2a68231321419d7fb303.1 → 6.6.0-integration-refactor-schema-path-less-migrate-class.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/dist/{chunk-PCBIQV5K.js → chunk-2SU4K35O.js} +174 -143
- package/dist/{chunk-N4FY6SYP.js → chunk-46YCXISN.js} +38 -67
- package/dist/{chunk-KKVB4S3E.js → chunk-4AC2JUM4.js} +23 -23
- package/dist/{chunk-7MD6344A.js → chunk-5DBOS77Y.js} +3 -5
- package/dist/{chunk-RBPRJFZN.js → chunk-6IZLN4Z5.js} +174 -143
- package/dist/{chunk-XARAHSDW.js → chunk-6RMP4L37.js} +14 -14
- package/dist/{chunk-DODIJPCS.js → chunk-AOQIUJT4.js} +16 -9
- package/dist/{chunk-TSJICM5S.js → chunk-CRVLHWC5.js} +5 -5
- package/dist/{chunk-DL7YQI4D.js → chunk-DZXCMG6O.js} +15 -15
- package/dist/{chunk-ABGGXGOC.js → chunk-EOWYER24.js} +5 -5
- package/dist/{chunk-3ERIN7PH.js → chunk-HMRJXDNO.js} +5 -5
- package/dist/{chunk-SQM6DJFL.js → chunk-JJBDZ3V4.js} +14 -14
- package/dist/{chunk-KTBNIQ7N.js → chunk-JMIU2AUX.js} +5 -5
- package/dist/{chunk-KOMGNJLE.js → chunk-LG5IW4IV.js} +6 -6
- package/dist/{chunk-Q22BLLK3.js → chunk-MUPZUVSI.js} +18 -12
- package/dist/{chunk-HRNPS5ND.js → chunk-OCPELPFI.js} +5 -5
- package/dist/{chunk-BGFWFIPR.js → chunk-OEXSUUW2.js} +5 -5
- package/dist/{chunk-PJHAB6NL.js → chunk-OIEQY7MB.js} +5 -5
- package/dist/{chunk-PJTR7UPQ.js → chunk-OZJAY6HP.js} +15 -15
- package/dist/{chunk-ARTAC6EG.js → chunk-Q2GXXFZU.js} +5 -5
- package/dist/{chunk-BGYLXBAN.js → chunk-QY2YJCMB.js} +5 -5
- package/dist/{chunk-FCYHZHVW.js → chunk-R3J2O23S.js} +4 -4
- package/dist/{chunk-TYIHFBAY.js → chunk-SNY3IPJ5.js} +5 -5
- package/dist/{chunk-XLGODPZH.js → chunk-UCHI3M2O.js} +7 -7
- package/dist/{chunk-K463GPQP.js → chunk-UFYNZD7Y.js} +23 -23
- package/dist/{chunk-TQCLUNM2.js → chunk-VNIE2AZB.js} +4 -4
- package/dist/{chunk-TATYN3T2.js → chunk-VNXTMX7Q.js} +26 -26
- package/dist/{chunk-2MWIMEFK.js → chunk-WO5ENZU5.js} +7 -7
- package/dist/{chunk-FAILNIEQ.js → chunk-X5YSMVVH.js} +5 -5
- package/dist/{chunk-VLCHHD5W.js → chunk-XKNXU2N3.js} +7 -7
- package/dist/{chunk-6TXVGFQA.js → chunk-Y4PCD4YX.js} +9 -9
- package/dist/{chunk-WCEODSXD.js → chunk-YG7D272D.js} +5 -5
- package/dist/{chunk-U2VNMXTK.js → chunk-YK5AZ3CV.js} +38 -67
- package/dist/cli/checkUnsupportedDataProxy.js +33 -34
- package/dist/cli/getSchema.js +37 -38
- package/dist/cli/hashes.js +33 -34
- package/dist/cli/schemaContext.d.ts +57 -0
- package/dist/cli/schemaContext.js +135 -0
- package/dist/cli/utils.js +4 -4
- package/dist/engine-commands/errorHelpers.js +4 -4
- package/dist/engine-commands/formatSchema.js +32 -33
- package/dist/engine-commands/getConfig.d.ts +0 -4
- package/dist/engine-commands/getConfig.js +13 -13
- package/dist/engine-commands/getDmmf.d.ts +1 -5
- package/dist/engine-commands/getDmmf.js +10 -10
- package/dist/engine-commands/getEngineVersion.js +5 -5
- package/dist/engine-commands/getEnginesMetaInfo.js +7 -7
- package/dist/engine-commands/index.js +43 -44
- package/dist/engine-commands/lintSchema.js +8 -8
- package/dist/engine-commands/mergeSchemas.js +10 -10
- package/dist/engine-commands/queryEngineCommons.js +7 -7
- package/dist/engine-commands/validate.js +10 -10
- package/dist/get-generators/generatorResolvers/generatorResolvers.js +32 -33
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +32 -33
- package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +33 -34
- package/dist/get-generators/getGenerators.d.ts +7 -3
- package/dist/get-generators/getGenerators.js +35 -36
- package/dist/highlight/highlight.js +5 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +81 -80
- package/dist/resolveBinary.js +7 -7
- package/dist/schemaEngineCommands.js +8 -8
- package/dist/sendPanic.js +32 -33
- package/dist/utils/binaryTargetRegex.js +2 -2
- package/dist/utils/canPrompt.js +3 -3
- package/dist/utils/extractPreviewFeatures.d.ts +2 -2
- package/dist/utils/extractPreviewFeatures.js +2 -2
- package/dist/utils/getEnvPaths.js +32 -33
- package/dist/utils/getVersionFromPackageJson.js +3 -3
- package/dist/utils/handlePanic.js +32 -33
- package/dist/utils/loadEnvFile.js +32 -33
- package/dist/utils/missingDatasource.js +4 -4
- package/dist/utils/missingGeneratorMessage.js +6 -6
- package/dist/wasm.js +4 -4
- package/package.json +11 -11
- 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,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_6IZLN4Z5_exports = {};
|
30
|
+
__export2(chunk_6IZLN4Z5_exports, {
|
31
31
|
checkTypeScriptVersion: () => checkTypeScriptVersion,
|
32
32
|
checkUnsupportedDataProxy: () => checkUnsupportedDataProxy,
|
33
33
|
debug: () => debug5,
|
@@ -50,14 +50,15 @@ __export2(chunk_RBPRJFZN_exports, {
|
|
50
50
|
handlePanic: () => handlePanic,
|
51
51
|
knownBinaryTargets: () => knownBinaryTargets,
|
52
52
|
loadEnvFile: () => loadEnvFile,
|
53
|
+
loadSchemaContext: () => loadSchemaContext,
|
53
54
|
prismaClientResolver: () => prismaClientResolver,
|
55
|
+
processSchemaResult: () => processSchemaResult,
|
54
56
|
sendPanic: () => sendPanic,
|
55
57
|
skipIndex: () => skipIndex
|
56
58
|
});
|
57
|
-
module.exports = __toCommonJS2(
|
59
|
+
module.exports = __toCommonJS2(chunk_6IZLN4Z5_exports);
|
58
60
|
var import_chunk_S57RMXZW = require("./chunk-S57RMXZW.js");
|
59
61
|
var import_chunk_EUTJYQDW = require("./chunk-EUTJYQDW.js");
|
60
|
-
var import_chunk_IPKE37QC = require("./chunk-IPKE37QC.js");
|
61
62
|
var import_chunk_PIPE5DSU = require("./chunk-PIPE5DSU.js");
|
62
63
|
var import_chunk_77IC3DNO = require("./chunk-77IC3DNO.js");
|
63
64
|
var import_chunk_MGZOEY6N = require("./chunk-MGZOEY6N.js");
|
@@ -71,20 +72,20 @@ var import_chunk_3BND5XB4 = require("./chunk-3BND5XB4.js");
|
|
71
72
|
var import_chunk_5V36RLCO = require("./chunk-5V36RLCO.js");
|
72
73
|
var import_chunk_5FJ3MENK = require("./chunk-5FJ3MENK.js");
|
73
74
|
var import_chunk_KDHESRKE = require("./chunk-KDHESRKE.js");
|
74
|
-
var
|
75
|
-
var
|
75
|
+
var import_chunk_OEXSUUW2 = require("./chunk-OEXSUUW2.js");
|
76
|
+
var import_chunk_WO5ENZU5 = require("./chunk-WO5ENZU5.js");
|
76
77
|
var import_chunk_L6GBFCXG = require("./chunk-L6GBFCXG.js");
|
77
78
|
var import_chunk_J77ZIDXB = require("./chunk-J77ZIDXB.js");
|
78
79
|
var import_chunk_5SN5JBT2 = require("./chunk-5SN5JBT2.js");
|
79
|
-
var
|
80
|
-
var
|
81
|
-
var
|
82
|
-
var
|
83
|
-
var
|
84
|
-
var
|
80
|
+
var import_chunk_R3J2O23S = require("./chunk-R3J2O23S.js");
|
81
|
+
var import_chunk_CRVLHWC5 = require("./chunk-CRVLHWC5.js");
|
82
|
+
var import_chunk_YG7D272D = require("./chunk-YG7D272D.js");
|
83
|
+
var import_chunk_6RMP4L37 = require("./chunk-6RMP4L37.js");
|
84
|
+
var import_chunk_4AC2JUM4 = require("./chunk-4AC2JUM4.js");
|
85
|
+
var import_chunk_46YCXISN = require("./chunk-46YCXISN.js");
|
85
86
|
var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
|
86
87
|
var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
|
87
|
-
var
|
88
|
+
var import_chunk_EOWYER24 = require("./chunk-EOWYER24.js");
|
88
89
|
var import_chunk_ATFQZVBS = require("./chunk-ATFQZVBS.js");
|
89
90
|
var import_chunk_2B26F5N3 = require("./chunk-2B26F5N3.js");
|
90
91
|
var import_chunk_GXDYIY4M = require("./chunk-GXDYIY4M.js");
|
@@ -116,21 +117,22 @@ var import_fs3 = __toESM2(require("fs"));
|
|
116
117
|
var import_path2 = __toESM2(require("path"));
|
117
118
|
var import_util = require("util");
|
118
119
|
var import_crypto = __toESM2(require("crypto"));
|
120
|
+
var import_path3 = __toESM2(require("path"));
|
119
121
|
var import_debug4 = __toESM2(require("@prisma/debug"));
|
120
122
|
var import_engines = require("@prisma/engines");
|
121
123
|
var import_fetch_engine = require("@prisma/fetch-engine");
|
122
124
|
var import_get_platform = require("@prisma/get-platform");
|
123
|
-
var
|
125
|
+
var import_path4 = __toESM2(require("path"));
|
124
126
|
var import_debug5 = __toESM2(require("@prisma/debug"));
|
125
127
|
var import_fs4 = __toESM2(require("fs"));
|
126
|
-
var
|
128
|
+
var import_path5 = __toESM2(require("path"));
|
127
129
|
var import_debug6 = __toESM2(require("@prisma/debug"));
|
128
130
|
var import_fs5 = __toESM2(require("fs"));
|
129
|
-
var
|
131
|
+
var import_path6 = __toESM2(require("path"));
|
130
132
|
var import_get_platform2 = require("@prisma/get-platform");
|
131
133
|
var import_fs6 = __toESM2(require("fs"));
|
132
134
|
var import_os = __toESM2(require("os"));
|
133
|
-
var
|
135
|
+
var import_path7 = __toESM2(require("path"));
|
134
136
|
var import_prompts = __toESM2(require("prompts"));
|
135
137
|
var import_get_platform3 = require("@prisma/get-platform");
|
136
138
|
var require_readdir_glob = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
@@ -197,8 +199,8 @@ var require_readdir_glob = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
197
199
|
});
|
198
200
|
});
|
199
201
|
}
|
200
|
-
async function* exploreWalkAsync(dir2,
|
201
|
-
let files = await readdir(
|
202
|
+
async function* exploreWalkAsync(dir2, path11, followSymlinks, useStat, shouldSkip, strict) {
|
203
|
+
let files = await readdir(path11 + dir2, strict);
|
202
204
|
for (const file of files) {
|
203
205
|
let name = file.name;
|
204
206
|
if (name === void 0) {
|
@@ -207,7 +209,7 @@ var require_readdir_glob = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
207
209
|
}
|
208
210
|
const filename = dir2 + "/" + name;
|
209
211
|
const relative = filename.slice(1);
|
210
|
-
const absolute =
|
212
|
+
const absolute = path11 + "/" + relative;
|
211
213
|
let stats = null;
|
212
214
|
if (useStat || followSymlinks) {
|
213
215
|
stats = await stat2(absolute, followSymlinks);
|
@@ -221,15 +223,15 @@ var require_readdir_glob = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
221
223
|
if (stats.isDirectory()) {
|
222
224
|
if (!shouldSkip(relative)) {
|
223
225
|
yield { relative, absolute, stats };
|
224
|
-
yield* exploreWalkAsync(filename,
|
226
|
+
yield* exploreWalkAsync(filename, path11, followSymlinks, useStat, shouldSkip, false);
|
225
227
|
}
|
226
228
|
} else {
|
227
229
|
yield { relative, absolute, stats };
|
228
230
|
}
|
229
231
|
}
|
230
232
|
}
|
231
|
-
async function* explore(
|
232
|
-
yield* exploreWalkAsync("",
|
233
|
+
async function* explore(path11, followSymlinks, useStat, shouldSkip) {
|
234
|
+
yield* exploreWalkAsync("", path11, followSymlinks, useStat, shouldSkip, true);
|
233
235
|
}
|
234
236
|
function readOptions(options2) {
|
235
237
|
return {
|
@@ -4162,22 +4164,22 @@ var require_lazystream = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
4162
4164
|
var require_normalize_path = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
4163
4165
|
"../../node_modules/.pnpm/normalize-path@3.0.0/node_modules/normalize-path/index.js"(exports2, module2) {
|
4164
4166
|
"use strict";
|
4165
|
-
module2.exports = function(
|
4166
|
-
if (typeof
|
4167
|
+
module2.exports = function(path11, stripTrailing) {
|
4168
|
+
if (typeof path11 !== "string") {
|
4167
4169
|
throw new TypeError("expected path to be a string");
|
4168
4170
|
}
|
4169
|
-
if (
|
4170
|
-
var len =
|
4171
|
-
if (len <= 1) return
|
4171
|
+
if (path11 === "\\" || path11 === "/") return "/";
|
4172
|
+
var len = path11.length;
|
4173
|
+
if (len <= 1) return path11;
|
4172
4174
|
var prefix = "";
|
4173
|
-
if (len > 4 &&
|
4174
|
-
var ch =
|
4175
|
-
if ((ch === "?" || ch === ".") &&
|
4176
|
-
|
4175
|
+
if (len > 4 && path11[3] === "\\") {
|
4176
|
+
var ch = path11[2];
|
4177
|
+
if ((ch === "?" || ch === ".") && path11.slice(0, 2) === "\\\\") {
|
4178
|
+
path11 = path11.slice(2);
|
4177
4179
|
prefix = "//";
|
4178
4180
|
}
|
4179
4181
|
}
|
4180
|
-
var segs =
|
4182
|
+
var segs = path11.split(/[/\\]+/);
|
4181
4183
|
if (stripTrailing !== false && segs[segs.length - 1] === "") {
|
4182
4184
|
segs.pop();
|
4183
4185
|
}
|
@@ -8247,7 +8249,7 @@ var require_file = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
8247
8249
|
"../../node_modules/.pnpm/archiver-utils@4.0.1/node_modules/archiver-utils/file.js"(exports2, module2) {
|
8248
8250
|
"use strict";
|
8249
8251
|
var fs10 = (0, import_chunk_GXDYIY4M.require_graceful_fs)();
|
8250
|
-
var
|
8252
|
+
var path11 = (0, import_chunk_WWAWV7DQ.__require)("path");
|
8251
8253
|
var flatten = require_flatten();
|
8252
8254
|
var difference = require_difference();
|
8253
8255
|
var union = require_union();
|
@@ -8272,7 +8274,7 @@ var require_file = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
8272
8274
|
return result;
|
8273
8275
|
};
|
8274
8276
|
file.exists = function() {
|
8275
|
-
var filepath =
|
8277
|
+
var filepath = path11.join.apply(path11, arguments);
|
8276
8278
|
return fs10.existsSync(filepath);
|
8277
8279
|
};
|
8278
8280
|
file.expand = function(...args) {
|
@@ -8286,7 +8288,7 @@ var require_file = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
8286
8288
|
});
|
8287
8289
|
if (options2.filter) {
|
8288
8290
|
matches = matches.filter(function(filepath) {
|
8289
|
-
filepath =
|
8291
|
+
filepath = path11.join(options2.cwd || "", filepath);
|
8290
8292
|
try {
|
8291
8293
|
if (typeof options2.filter === "function") {
|
8292
8294
|
return options2.filter(filepath);
|
@@ -8303,7 +8305,7 @@ var require_file = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
8303
8305
|
file.expandMapping = function(patterns, destBase, options2) {
|
8304
8306
|
options2 = Object.assign({
|
8305
8307
|
rename: function(destBase2, destPath) {
|
8306
|
-
return
|
8308
|
+
return path11.join(destBase2 || "", destPath);
|
8307
8309
|
}
|
8308
8310
|
}, options2);
|
8309
8311
|
var files = [];
|
@@ -8311,14 +8313,14 @@ var require_file = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
8311
8313
|
file.expand(options2, patterns).forEach(function(src) {
|
8312
8314
|
var destPath = src;
|
8313
8315
|
if (options2.flatten) {
|
8314
|
-
destPath =
|
8316
|
+
destPath = path11.basename(destPath);
|
8315
8317
|
}
|
8316
8318
|
if (options2.ext) {
|
8317
8319
|
destPath = destPath.replace(/(\.[^\/]*)?$/, options2.ext);
|
8318
8320
|
}
|
8319
8321
|
var dest = options2.rename(destBase, destPath, options2);
|
8320
8322
|
if (options2.cwd) {
|
8321
|
-
src =
|
8323
|
+
src = path11.join(options2.cwd, src);
|
8322
8324
|
}
|
8323
8325
|
dest = dest.replace(pathSeparatorRe, "/");
|
8324
8326
|
src = src.replace(pathSeparatorRe, "/");
|
@@ -8399,7 +8401,7 @@ var require_archiver_utils = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
8399
8401
|
"../../node_modules/.pnpm/archiver-utils@4.0.1/node_modules/archiver-utils/index.js"(exports2, module2) {
|
8400
8402
|
"use strict";
|
8401
8403
|
var fs10 = (0, import_chunk_GXDYIY4M.require_graceful_fs)();
|
8402
|
-
var
|
8404
|
+
var path11 = (0, import_chunk_WWAWV7DQ.__require)("path");
|
8403
8405
|
var lazystream = require_lazystream();
|
8404
8406
|
var normalizePath = require_normalize_path();
|
8405
8407
|
var defaults = require_defaults();
|
@@ -8486,11 +8488,11 @@ var require_archiver_utils = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
8486
8488
|
if (!file) {
|
8487
8489
|
return callback(null, results);
|
8488
8490
|
}
|
8489
|
-
filepath =
|
8491
|
+
filepath = path11.join(dirpath, file);
|
8490
8492
|
fs10.stat(filepath, function(err2, stats) {
|
8491
8493
|
results.push({
|
8492
8494
|
path: filepath,
|
8493
|
-
relative:
|
8495
|
+
relative: path11.relative(base, filepath).replace(/\\/g, "/"),
|
8494
8496
|
stats
|
8495
8497
|
});
|
8496
8498
|
if (stats && stats.isDirectory()) {
|
@@ -8550,7 +8552,7 @@ var require_core = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
8550
8552
|
var fs10 = (0, import_chunk_WWAWV7DQ.__require)("fs");
|
8551
8553
|
var glob = require_readdir_glob();
|
8552
8554
|
var async = (init_async(), (0, import_chunk_WWAWV7DQ.__toCommonJS)(async_exports));
|
8553
|
-
var
|
8555
|
+
var path11 = (0, import_chunk_WWAWV7DQ.__require)("path");
|
8554
8556
|
var util = require_archiver_utils();
|
8555
8557
|
var inherits = (0, import_chunk_WWAWV7DQ.__require)("util").inherits;
|
8556
8558
|
var ArchiverError = require_error();
|
@@ -8826,9 +8828,9 @@ var require_core = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
8826
8828
|
task.source = Buffer.concat([]);
|
8827
8829
|
} else if (stats.isSymbolicLink() && this._moduleSupports("symlink")) {
|
8828
8830
|
var linkPath = fs10.readlinkSync(task.filepath);
|
8829
|
-
var dirName =
|
8831
|
+
var dirName = path11.dirname(task.filepath);
|
8830
8832
|
task.data.type = "symlink";
|
8831
|
-
task.data.linkname =
|
8833
|
+
task.data.linkname = path11.relative(dirName, path11.resolve(dirName, linkPath));
|
8832
8834
|
task.data.sourceType = "buffer";
|
8833
8835
|
task.source = Buffer.concat([]);
|
8834
8836
|
} else {
|
@@ -14011,8 +14013,8 @@ var require_dist = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
14011
14013
|
status: "disabled"
|
14012
14014
|
};
|
14013
14015
|
}
|
14014
|
-
const
|
14015
|
-
const cacheResponse = await
|
14016
|
+
const config = await Config.new(state);
|
14017
|
+
const cacheResponse = await config.checkCache(state);
|
14016
14018
|
state.check_if_update_available = cacheResponse.stale === true || !cacheResponse.cache;
|
14017
14019
|
const child = spawn(state);
|
14018
14020
|
if (state.unref) {
|
@@ -14027,7 +14029,7 @@ var require_dist = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
14027
14029
|
}
|
14028
14030
|
for (const key of Object.keys(state)) {
|
14029
14031
|
if (state[key]) {
|
14030
|
-
await
|
14032
|
+
await config.set({
|
14031
14033
|
[key]: state[key]
|
14032
14034
|
});
|
14033
14035
|
}
|
@@ -14039,7 +14041,7 @@ var require_dist = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
14039
14041
|
data: cacheResponse.cache.output
|
14040
14042
|
};
|
14041
14043
|
}
|
14042
|
-
await
|
14044
|
+
await config.set({
|
14043
14045
|
last_reminder: state.now()
|
14044
14046
|
});
|
14045
14047
|
return {
|
@@ -14104,7 +14106,7 @@ var require_tmp = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
14104
14106
|
"use strict";
|
14105
14107
|
var fs10 = (0, import_chunk_WWAWV7DQ.__require)("fs");
|
14106
14108
|
var os3 = (0, import_chunk_WWAWV7DQ.__require)("os");
|
14107
|
-
var
|
14109
|
+
var path11 = (0, import_chunk_WWAWV7DQ.__require)("path");
|
14108
14110
|
var crypto3 = (0, import_chunk_WWAWV7DQ.__require)("crypto");
|
14109
14111
|
var _c = { fs: fs10.constants, os: os3.constants };
|
14110
14112
|
var RANDOM_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
@@ -14318,9 +14320,9 @@ var require_tmp = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
14318
14320
|
function _generateTmpName(opts) {
|
14319
14321
|
const tmpDir = opts.tmpdir;
|
14320
14322
|
if (!_isUndefined(opts.name))
|
14321
|
-
return
|
14323
|
+
return path11.join(tmpDir, opts.dir, opts.name);
|
14322
14324
|
if (!_isUndefined(opts.template))
|
14323
|
-
return
|
14325
|
+
return path11.join(tmpDir, opts.dir, opts.template).replace(TEMPLATE_PATTERN, _randomChars(6));
|
14324
14326
|
const name = [
|
14325
14327
|
opts.prefix ? opts.prefix : "tmp",
|
14326
14328
|
"-",
|
@@ -14329,7 +14331,7 @@ var require_tmp = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
14329
14331
|
_randomChars(12),
|
14330
14332
|
opts.postfix ? "-" + opts.postfix : ""
|
14331
14333
|
].join("");
|
14332
|
-
return
|
14334
|
+
return path11.join(tmpDir, opts.dir, name);
|
14333
14335
|
}
|
14334
14336
|
function _assertAndSanitizeOptions(options2) {
|
14335
14337
|
options2.tmpdir = _getTmpDir(options2);
|
@@ -14350,29 +14352,29 @@ var require_tmp = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
14350
14352
|
options2.detachDescriptor = !!options2.detachDescriptor;
|
14351
14353
|
options2.discardDescriptor = !!options2.discardDescriptor;
|
14352
14354
|
options2.unsafeCleanup = !!options2.unsafeCleanup;
|
14353
|
-
options2.dir = _isUndefined(options2.dir) ? "" :
|
14354
|
-
options2.template = _isUndefined(options2.template) ? void 0 :
|
14355
|
-
options2.template = _isBlank(options2.template) ? void 0 :
|
14355
|
+
options2.dir = _isUndefined(options2.dir) ? "" : path11.relative(tmpDir, _resolvePath(options2.dir, tmpDir));
|
14356
|
+
options2.template = _isUndefined(options2.template) ? void 0 : path11.relative(tmpDir, _resolvePath(options2.template, tmpDir));
|
14357
|
+
options2.template = _isBlank(options2.template) ? void 0 : path11.relative(options2.dir, options2.template);
|
14356
14358
|
options2.name = _isUndefined(options2.name) ? void 0 : options2.name;
|
14357
14359
|
options2.prefix = _isUndefined(options2.prefix) ? "" : options2.prefix;
|
14358
14360
|
options2.postfix = _isUndefined(options2.postfix) ? "" : options2.postfix;
|
14359
14361
|
}
|
14360
14362
|
function _resolvePath(name, tmpDir) {
|
14361
14363
|
if (name.startsWith(tmpDir)) {
|
14362
|
-
return
|
14364
|
+
return path11.resolve(name);
|
14363
14365
|
} else {
|
14364
|
-
return
|
14366
|
+
return path11.resolve(path11.join(tmpDir, name));
|
14365
14367
|
}
|
14366
14368
|
}
|
14367
14369
|
function _assertIsRelative(name, option, tmpDir) {
|
14368
14370
|
if (option === "name") {
|
14369
|
-
if (
|
14371
|
+
if (path11.isAbsolute(name))
|
14370
14372
|
throw new Error(`${option} option must not contain an absolute path, found "${name}".`);
|
14371
|
-
let basename =
|
14373
|
+
let basename = path11.basename(name);
|
14372
14374
|
if (basename === ".." || basename === "." || basename !== name)
|
14373
14375
|
throw new Error(`${option} option must not contain a path, found "${name}".`);
|
14374
14376
|
} else {
|
14375
|
-
if (
|
14377
|
+
if (path11.isAbsolute(name) && !name.startsWith(tmpDir)) {
|
14376
14378
|
throw new Error(`${option} option must be relative to "${tmpDir}", found "${name}".`);
|
14377
14379
|
}
|
14378
14380
|
let resolvedPath = _resolvePath(name, tmpDir);
|
@@ -14393,7 +14395,7 @@ var require_tmp = (0, import_chunk_WWAWV7DQ.__commonJS)({
|
|
14393
14395
|
_gracefulCleanup = true;
|
14394
14396
|
}
|
14395
14397
|
function _getTmpDir(options2) {
|
14396
|
-
return
|
14398
|
+
return path11.resolve(options2 && options2.tmpdir || os3.tmpdir());
|
14397
14399
|
}
|
14398
14400
|
process.addListener(EXIT, _garbageCollector);
|
14399
14401
|
Object.defineProperty(module2.exports, "tmpdir", {
|
@@ -14447,9 +14449,9 @@ function locatePathSync(paths2, {
|
|
14447
14449
|
}
|
14448
14450
|
}
|
14449
14451
|
}
|
14450
|
-
function pathExistsSync(
|
14452
|
+
function pathExistsSync(path11) {
|
14451
14453
|
try {
|
14452
|
-
import_node_fs2.default.accessSync(
|
14454
|
+
import_node_fs2.default.accessSync(path11);
|
14453
14455
|
return true;
|
14454
14456
|
} catch {
|
14455
14457
|
return false;
|
@@ -14530,12 +14532,12 @@ async function readSchemaFromDirectory(schemaPath2) {
|
|
14530
14532
|
}
|
14531
14533
|
const files = await (0, import_schema_files_loader.loadSchemaFiles)(schemaPath2);
|
14532
14534
|
debug2("Loading config");
|
14533
|
-
const
|
14535
|
+
const config = await (0, import_chunk_4AC2JUM4.getConfig)({
|
14534
14536
|
datamodel: files,
|
14535
14537
|
ignoreEnvVarErrors: true
|
14536
14538
|
});
|
14537
14539
|
debug2("Ok");
|
14538
|
-
if (!(0, import_schema_files_loader.usesPrismaSchemaFolder)(
|
14540
|
+
if (!(0, import_schema_files_loader.usesPrismaSchemaFolder)(config)) {
|
14539
14541
|
return { ok: false, error: { kind: "FolderPreviewNotEnabled", path: schemaPath2 } };
|
14540
14542
|
}
|
14541
14543
|
return { ok: true, schema: { schemaPath: schemaPath2, schemaRootDir: schemaPath2, schemas: files } };
|
@@ -14638,23 +14640,23 @@ async function readSchemaFromPrismaConfigBasedLocation(schemaPathFromConfig) {
|
|
14638
14640
|
error: { kind: "PrismaConfigNotConfigured" }
|
14639
14641
|
};
|
14640
14642
|
}
|
14641
|
-
let
|
14643
|
+
let schemaResult;
|
14642
14644
|
if (schemaPathFromConfig.kind === "single") {
|
14643
|
-
|
14644
|
-
if (!
|
14645
|
+
schemaResult = await readSchemaFromSingleFile(schemaPathFromConfig.filePath);
|
14646
|
+
if (!schemaResult.ok) {
|
14645
14647
|
throw new Error(
|
14646
|
-
`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)}`
|
14647
14649
|
);
|
14648
14650
|
}
|
14649
14651
|
} else {
|
14650
|
-
|
14651
|
-
if (!
|
14652
|
+
schemaResult = await readSchemaFromDirectory(schemaPathFromConfig.folderPath);
|
14653
|
+
if (!schemaResult.ok) {
|
14652
14654
|
throw new Error(
|
14653
|
-
`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)}`
|
14654
14656
|
);
|
14655
14657
|
}
|
14656
14658
|
}
|
14657
|
-
return
|
14659
|
+
return schemaResult;
|
14658
14660
|
}
|
14659
14661
|
async function getSchemaFromPackageJson(cwd) {
|
14660
14662
|
const prismaConfig = await getPrismaConfigFromPackageJson(cwd);
|
@@ -14824,10 +14826,10 @@ function schemaPathToEnvPath(schemaPath2) {
|
|
14824
14826
|
}
|
14825
14827
|
async function loadEnvFile({
|
14826
14828
|
schemaPath: schemaPath2,
|
14827
|
-
config
|
14829
|
+
config,
|
14828
14830
|
printMessage = false
|
14829
14831
|
}) {
|
14830
|
-
if (
|
14832
|
+
if (config.loadedFromFile) {
|
14831
14833
|
process.stdout.write(`Prisma config detected, skipping environment variable loading.
|
14832
14834
|
`);
|
14833
14835
|
return;
|
@@ -14856,8 +14858,8 @@ async function checkUnsupportedDataProxyMessage(command, args, schemaPathFromCon
|
|
14856
14858
|
if (argName.includes("schema")) {
|
14857
14859
|
await loadEnvFile({ schemaPath: argValue, printMessage: false, config: (0, import_config.defaultTestConfig)() });
|
14858
14860
|
const datamodel = await import_fs.default.promises.readFile(argValue, "utf-8");
|
14859
|
-
const
|
14860
|
-
const url = (0,
|
14861
|
+
const config = await (0, import_chunk_4AC2JUM4.getConfig)({ datamodel, ignoreEnvVarErrors: true });
|
14862
|
+
const url = (0, import_chunk_4AC2JUM4.resolveUrl)((0, import_chunk_4AC2JUM4.getEffectiveUrl)(config.datasources[0]));
|
14861
14863
|
if (url?.startsWith("prisma://")) {
|
14862
14864
|
return forbiddenCmdWithDataProxyFlagMessage(command);
|
14863
14865
|
}
|
@@ -14879,6 +14881,53 @@ function getCLIPathHash() {
|
|
14879
14881
|
const cliPath = process.argv[1];
|
14880
14882
|
return import_crypto.default.createHash("sha256").update(cliPath).digest("hex").substring(0, 8);
|
14881
14883
|
}
|
14884
|
+
async function loadSchemaContext({
|
14885
|
+
schemaPathFromArg,
|
14886
|
+
schemaPathFromConfig,
|
14887
|
+
printLoadMessage = true,
|
14888
|
+
ignoreEnvVarErrors = false,
|
14889
|
+
allowNull = false
|
14890
|
+
} = {}) {
|
14891
|
+
let schemaResult = null;
|
14892
|
+
if (allowNull) {
|
14893
|
+
schemaResult = await getSchemaWithPathOptional(schemaPathFromArg, schemaPathFromConfig);
|
14894
|
+
if (!schemaResult) return null;
|
14895
|
+
} else {
|
14896
|
+
schemaResult = await getSchemaWithPath(schemaPathFromArg, schemaPathFromConfig);
|
14897
|
+
}
|
14898
|
+
return processSchemaResult({ schemaResult, printLoadMessage, ignoreEnvVarErrors });
|
14899
|
+
}
|
14900
|
+
async function processSchemaResult({
|
14901
|
+
schemaResult,
|
14902
|
+
printLoadMessage = true,
|
14903
|
+
ignoreEnvVarErrors = false
|
14904
|
+
}) {
|
14905
|
+
const cwd = process.cwd();
|
14906
|
+
const loadedFromPathForLogMessages = import_path3.default.relative(cwd, schemaResult.schemaPath);
|
14907
|
+
if (printLoadMessage) {
|
14908
|
+
process.stdout.write((0, import_chunk_PG5FDKSF.dim)(`Prisma schema loaded from ${loadedFromPathForLogMessages}`) + "\n");
|
14909
|
+
}
|
14910
|
+
const configFromPsl = await (0, import_chunk_4AC2JUM4.getConfig)({ datamodel: schemaResult.schemas, ignoreEnvVarErrors });
|
14911
|
+
const primaryDatasource = configFromPsl.datasources.at(0);
|
14912
|
+
return {
|
14913
|
+
schemaFiles: schemaResult.schemas,
|
14914
|
+
schemaPath: schemaResult.schemaPath,
|
14915
|
+
schemaRootDir: schemaResult.schemaRootDir || cwd,
|
14916
|
+
datasources: configFromPsl.datasources,
|
14917
|
+
generators: configFromPsl.generators,
|
14918
|
+
primaryDatasource,
|
14919
|
+
primaryDatasourceDirectory: primaryDatasourceDirectory(primaryDatasource) || schemaResult.schemaRootDir || cwd,
|
14920
|
+
warnings: configFromPsl.warnings,
|
14921
|
+
loadedFromPathForLogMessages
|
14922
|
+
};
|
14923
|
+
}
|
14924
|
+
function primaryDatasourceDirectory(primaryDatasource) {
|
14925
|
+
const datasourcePath = primaryDatasource?.sourceFilePath;
|
14926
|
+
if (datasourcePath) {
|
14927
|
+
return import_path3.default.dirname(datasourcePath);
|
14928
|
+
}
|
14929
|
+
return null;
|
14930
|
+
}
|
14882
14931
|
var import_p_map = (0, import_chunk_WWAWV7DQ.__toESM)((0, import_chunk_C2WD2XUT.require_p_map)());
|
14883
14932
|
var debug4 = (0, import_debug6.default)("prisma:generator");
|
14884
14933
|
async function checkTypeScriptVersion() {
|
@@ -14888,7 +14937,7 @@ async function checkTypeScriptVersion() {
|
|
14888
14937
|
basedir: process.cwd()
|
14889
14938
|
});
|
14890
14939
|
debug4("typescriptPath", typescriptPath);
|
14891
|
-
const typescriptPkg = typescriptPath &&
|
14940
|
+
const typescriptPkg = typescriptPath && import_path6.default.join(typescriptPath, "package.json");
|
14892
14941
|
if (typescriptPkg && import_fs5.default.existsSync(typescriptPkg)) {
|
14893
14942
|
const pjson = (0, import_chunk_WWAWV7DQ.__require)(typescriptPkg);
|
14894
14943
|
const currentVersion = pjson.version;
|
@@ -14924,7 +14973,7 @@ async function prismaClientResolver(baseDir, version3) {
|
|
14924
14973
|
);
|
14925
14974
|
projectRoot = baseDir;
|
14926
14975
|
}
|
14927
|
-
if (!import_fs4.default.existsSync(
|
14976
|
+
if (!import_fs4.default.existsSync(import_path5.default.join(projectRoot, "package.json"))) {
|
14928
14977
|
console.warn(
|
14929
14978
|
(0, import_chunk_PG5FDKSF.yellow)(
|
14930
14979
|
`${warningTag} Prisma could not find a ${(0, import_chunk_PG5FDKSF.bold)("package.json")} file in the inferred project root ${(0, import_chunk_PG5FDKSF.bold)(
|
@@ -14951,7 +15000,7 @@ async function prismaClientResolver(baseDir, version3) {
|
|
14951
15000
|
await (0, import_chunk_77IC3DNO.runPackageCmd)(projectRoot, "add", `prisma@${version3 ?? "latest"}`, "-D", "--silent");
|
14952
15001
|
}
|
14953
15002
|
await (0, import_chunk_77IC3DNO.runPackageCmd)(projectRoot, "add", `@prisma/client@${version3 ?? "latest"}`, "--silent");
|
14954
|
-
prismaClientDir = await (0, import_chunk_PIPE5DSU.findPrismaClientDir)(
|
15003
|
+
prismaClientDir = await (0, import_chunk_PIPE5DSU.findPrismaClientDir)(import_path5.default.join(".", baseDir));
|
14955
15004
|
if (!prismaClientDir) {
|
14956
15005
|
throw new Error(
|
14957
15006
|
`Could not resolve @prisma/client despite the installation that we just tried.
|
@@ -14975,7 +15024,7 @@ Please try to install it with ${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk
|
|
14975
15024
|
}
|
14976
15025
|
return {
|
14977
15026
|
outputPath: prismaClientDir,
|
14978
|
-
generatorPath:
|
15027
|
+
generatorPath: import_path5.default.resolve(prismaClientDir, "generator-build/index.js"),
|
14979
15028
|
isNode: true
|
14980
15029
|
};
|
14981
15030
|
}
|
@@ -15000,21 +15049,14 @@ async function getGenerators(options) {
|
|
15000
15049
|
allowNoModels,
|
15001
15050
|
typedSql
|
15002
15051
|
} = options;
|
15003
|
-
|
15004
|
-
|
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`);
|
15005
15055
|
}
|
15006
|
-
let schemaResult = null;
|
15007
|
-
try {
|
15008
|
-
schemaResult = await getSchemaWithPath(schemaPath);
|
15009
|
-
} catch (_2) {
|
15010
|
-
throw new Error(`${schemaPath} does not exist`);
|
15011
|
-
}
|
15012
|
-
const { schemas } = schemaResult;
|
15013
15056
|
const binaryTarget = await (0, import_get_platform.getBinaryTargetForCurrentPlatform)();
|
15014
15057
|
const queryEngineBinaryType = (0, import_engines.getCliQueryEngineBinaryType)();
|
15015
15058
|
const queryEngineType = (0, import_chunk_RS2R7COT.binaryTypeToEngineType)(queryEngineBinaryType);
|
15016
|
-
|
15017
|
-
if (version && !prismaPath) {
|
15059
|
+
if (version && !binaryPathsOverride?.[queryEngineType]) {
|
15018
15060
|
const potentialPath = eval(`require('path').join(__dirname, '..')`);
|
15019
15061
|
if (!potentialPath.match(import_chunk_M3GBKLGE.vercelPkgPathRegex)) {
|
15020
15062
|
const downloadParams = {
|
@@ -15026,35 +15068,25 @@ async function getGenerators(options) {
|
|
15026
15068
|
version,
|
15027
15069
|
skipDownload
|
15028
15070
|
};
|
15029
|
-
|
15030
|
-
prismaPath = binaryPathsWithEngineType[queryEngineBinaryType][binaryTarget];
|
15071
|
+
await (0, import_fetch_engine.download)(downloadParams);
|
15031
15072
|
}
|
15032
15073
|
}
|
15033
|
-
|
15034
|
-
|
15035
|
-
|
15036
|
-
|
15037
|
-
|
15038
|
-
|
15039
|
-
|
15040
|
-
throw new Error(import_chunk_BGFWFIPR.missingDatasource);
|
15041
|
-
}
|
15042
|
-
(0, import_chunk_5FJ3MENK.printConfigWarnings)(config.warnings);
|
15043
|
-
const previewFeatures = (0, import_chunk_TSJICM5S.extractPreviewFeatures)(config);
|
15044
|
-
const dmmf = await (0, import_chunk_N4FY6SYP.getDMMF)({
|
15045
|
-
datamodel: schemas,
|
15046
|
-
datamodelPath: schemaPath,
|
15047
|
-
prismaPath,
|
15074
|
+
if (!schemaContext.primaryDatasource) {
|
15075
|
+
throw new Error(import_chunk_OEXSUUW2.missingDatasource);
|
15076
|
+
}
|
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_46YCXISN.getDMMF)({
|
15080
|
+
datamodel: schemaContext.schemaFiles,
|
15048
15081
|
previewFeatures
|
15049
15082
|
});
|
15050
15083
|
if (dmmf.datamodel.models.length === 0 && !allowNoModels) {
|
15051
|
-
if (
|
15052
|
-
throw new Error(
|
15084
|
+
if (schemaContext.primaryDatasource.provider === "mongodb") {
|
15085
|
+
throw new Error(import_chunk_WO5ENZU5.missingModelMessageMongoDB);
|
15053
15086
|
}
|
15054
|
-
throw new Error(
|
15087
|
+
throw new Error(import_chunk_WO5ENZU5.missingModelMessage);
|
15055
15088
|
}
|
15056
|
-
(
|
15057
|
-
const generatorConfigs = filterGenerators(overrideGenerators || config.generators, generatorNames);
|
15089
|
+
const generatorConfigs = filterGenerators(overrideGenerators || schemaContext.generators, generatorNames);
|
15058
15090
|
await validateGenerators(generatorConfigs);
|
15059
15091
|
const runningGenerators = [];
|
15060
15092
|
try {
|
@@ -15063,7 +15095,7 @@ async function getGenerators(options) {
|
|
15063
15095
|
async (generator, index2) => {
|
15064
15096
|
let generatorPath = (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.provider);
|
15065
15097
|
let paths2;
|
15066
|
-
const baseDir =
|
15098
|
+
const baseDir = import_path4.default.dirname(generator.sourceFilePath ?? schemaContext.schemaRootDir);
|
15067
15099
|
const providerValue = (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.provider);
|
15068
15100
|
if (aliases && aliases[providerValue]) {
|
15069
15101
|
generatorPath = aliases[providerValue].generatorPath;
|
@@ -15076,7 +15108,7 @@ async function getGenerators(options) {
|
|
15076
15108
|
await generatorInstance.init();
|
15077
15109
|
if (generator.output) {
|
15078
15110
|
generator.output = {
|
15079
|
-
value:
|
15111
|
+
value: import_path4.default.resolve(baseDir, (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.output)),
|
15080
15112
|
fromEnvVar: null
|
15081
15113
|
};
|
15082
15114
|
generator.isCustomOutput = true;
|
@@ -15102,15 +15134,16 @@ The generator needs to either define the \`defaultOutput\` path in the manifest
|
|
15102
15134
|
fromEnvVar: "null"
|
15103
15135
|
};
|
15104
15136
|
}
|
15105
|
-
const datamodel = (0,
|
15106
|
-
const envPaths2 = await getEnvPaths(schemaPath, { cwd: generator.output.value });
|
15137
|
+
const datamodel = (0, import_chunk_6RMP4L37.mergeSchemas)({ schemas: schemaContext.schemaFiles });
|
15138
|
+
const envPaths2 = await getEnvPaths(schemaContext.schemaPath, { cwd: generator.output.value });
|
15107
15139
|
const options2 = {
|
15108
15140
|
datamodel,
|
15109
|
-
datasources:
|
15141
|
+
datasources: schemaContext.datasources,
|
15110
15142
|
generator,
|
15111
15143
|
dmmf,
|
15112
15144
|
otherGenerators: skipIndex(generatorConfigs, index2),
|
15113
|
-
schemaPath,
|
15145
|
+
schemaPath: schemaContext.schemaPath,
|
15146
|
+
// TODO:(schemaPath) can we get rid of schema path passing here?
|
15114
15147
|
version: version || import_engines.enginesVersion,
|
15115
15148
|
// this version makes no sense anymore and should be ignored
|
15116
15149
|
postinstall,
|
@@ -15185,10 +15218,8 @@ generator gen {
|
|
15185
15218
|
debug6({ generatorBinaryPaths });
|
15186
15219
|
generator.setBinaryPaths(generatorBinaryPaths);
|
15187
15220
|
if (engineVersion !== version && generator.options && generator.manifest.requiresEngines.includes(queryEngineType) && generatorBinaryPaths[queryEngineType] && generatorBinaryPaths[queryEngineType]?.[binaryTarget]) {
|
15188
|
-
const customDmmf = await (0,
|
15189
|
-
datamodel:
|
15190
|
-
datamodelPath: schemaPath,
|
15191
|
-
prismaPath: generatorBinaryPaths[queryEngineType]?.[binaryTarget],
|
15221
|
+
const customDmmf = await (0, import_chunk_46YCXISN.getDMMF)({
|
15222
|
+
datamodel: schemaContext.schemaFiles,
|
15192
15223
|
previewFeatures
|
15193
15224
|
});
|
15194
15225
|
const options2 = { ...generator.options, dmmf: customDmmf };
|
@@ -15369,7 +15400,7 @@ function concatSchemaForReport(schemaFiles) {
|
|
15369
15400
|
if (!schemaFiles) {
|
15370
15401
|
return void 0;
|
15371
15402
|
}
|
15372
|
-
return schemaFiles.map(([
|
15403
|
+
return schemaFiles.map(([path11, content]) => `// ${path11}
|
15373
15404
|
${content}`).join("\n");
|
15374
15405
|
}
|
15375
15406
|
function getCommand() {
|
@@ -15384,13 +15415,13 @@ async function makeErrorZip(error) {
|
|
15384
15415
|
if (!error.schemaPath) {
|
15385
15416
|
throw new Error(`Can't make zip without schema path`);
|
15386
15417
|
}
|
15387
|
-
const schemaDir =
|
15418
|
+
const schemaDir = import_path7.default.dirname(error.schemaPath);
|
15388
15419
|
const tmpFileObj = import_tmp.default.fileSync();
|
15389
15420
|
const outputFile = import_fs6.default.createWriteStream(tmpFileObj.name);
|
15390
15421
|
const zip = (0, import_archiver.default)("zip", { zlib: { level: 9 } });
|
15391
15422
|
zip.pipe(outputFile);
|
15392
15423
|
const schemaFile = (0, import_chunk_KDHESRKE.maskSchema)(import_fs6.default.readFileSync(error.schemaPath, "utf-8"));
|
15393
|
-
zip.append(schemaFile, { name:
|
15424
|
+
zip.append(schemaFile, { name: import_path7.default.basename(error.schemaPath) });
|
15394
15425
|
if (import_fs6.default.existsSync(schemaDir)) {
|
15395
15426
|
const filePaths = await (0, import_globby.default)("migrations/**/*", {
|
15396
15427
|
// globby doesn't have it in its types but it's part of mrmlnc/fast-glob
|
@@ -15398,11 +15429,11 @@ async function makeErrorZip(error) {
|
|
15398
15429
|
cwd: schemaDir
|
15399
15430
|
});
|
15400
15431
|
for (const filePath of filePaths) {
|
15401
|
-
let file = import_fs6.default.readFileSync(
|
15402
|
-
if (filePath.endsWith("schema.prisma") || filePath.endsWith(
|
15432
|
+
let file = import_fs6.default.readFileSync(import_path7.default.resolve(schemaDir, filePath), "utf-8");
|
15433
|
+
if (filePath.endsWith("schema.prisma") || filePath.endsWith(import_path7.default.basename(error.schemaPath))) {
|
15403
15434
|
file = (0, import_chunk_KDHESRKE.maskSchema)(file);
|
15404
15435
|
}
|
15405
|
-
zip.append(file, { name:
|
15436
|
+
zip.append(file, { name: import_path7.default.basename(filePath) });
|
15406
15437
|
}
|
15407
15438
|
}
|
15408
15439
|
zip.finalize();
|
@@ -15417,7 +15448,7 @@ async function makeErrorZip(error) {
|
|
15417
15448
|
});
|
15418
15449
|
}
|
15419
15450
|
async function handlePanic(args) {
|
15420
|
-
if (!(0,
|
15451
|
+
if (!(0, import_chunk_R3J2O23S.canPrompt)()) {
|
15421
15452
|
throw args.error;
|
15422
15453
|
}
|
15423
15454
|
await panicDialog(args);
|
@@ -15479,13 +15510,13 @@ ${(0, import_chunk_PG5FDKSF.bold)("Thanks a lot for your help! \u{1F64F}")}`);
|
|
15479
15510
|
process.exit(1);
|
15480
15511
|
}
|
15481
15512
|
var debug7 = (0, import_debug.default)("prisma:format");
|
15482
|
-
async function formatSchema({ schemas
|
15513
|
+
async function formatSchema({ schemas }, inputFormattingOptions) {
|
15483
15514
|
if (process.env.FORCE_PANIC_PRISMA_SCHEMA) {
|
15484
15515
|
handleFormatPanic(
|
15485
15516
|
() => {
|
15486
|
-
|
15517
|
+
import_chunk_EOWYER24.prismaSchemaWasm.debug_panic();
|
15487
15518
|
},
|
15488
|
-
{ schemas
|
15519
|
+
{ schemas }
|
15489
15520
|
);
|
15490
15521
|
}
|
15491
15522
|
const defaultFormattingOptions = {
|
@@ -15501,20 +15532,20 @@ async function formatSchema({ schemas: schemas2 }, inputFormattingOptions) {
|
|
15501
15532
|
};
|
15502
15533
|
const { formattedMultipleSchemas, lintDiagnostics } = handleFormatPanic(
|
15503
15534
|
() => {
|
15504
|
-
const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(
|
15535
|
+
const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(schemas), documentFormattingParams);
|
15505
15536
|
const formattedMultipleSchemas2 = JSON.parse(formattedMultipleSchemasRaw);
|
15506
|
-
const lintDiagnostics2 = (0,
|
15537
|
+
const lintDiagnostics2 = (0, import_chunk_YG7D272D.lintSchema)({ schemas: formattedMultipleSchemas2 });
|
15507
15538
|
return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
|
15508
15539
|
},
|
15509
|
-
{ schemas
|
15540
|
+
{ schemas }
|
15510
15541
|
);
|
15511
|
-
const lintWarnings = (0,
|
15542
|
+
const lintWarnings = (0, import_chunk_YG7D272D.getLintWarningsAsText)(lintDiagnostics);
|
15512
15543
|
if (lintWarnings && import_chunk_AZNLB67U.logger_exports.should.warn()) {
|
15513
15544
|
console.warn(lintWarnings);
|
15514
15545
|
}
|
15515
15546
|
return Promise.resolve(formattedMultipleSchemas);
|
15516
15547
|
}
|
15517
|
-
function handleFormatPanic(tryCb, { schemas
|
15548
|
+
function handleFormatPanic(tryCb, { schemas }) {
|
15518
15549
|
try {
|
15519
15550
|
return tryCb();
|
15520
15551
|
} catch (e) {
|
@@ -15530,15 +15561,15 @@ function handleFormatPanic(tryCb, { schemas: schemas2 }) {
|
|
15530
15561
|
"@prisma/prisma-schema-wasm format",
|
15531
15562
|
"FMT_CLI",
|
15532
15563
|
/* schemaPath */
|
15533
|
-
(0, import_chunk_YRBRUREX.debugMultipleSchemaPaths)(
|
15564
|
+
(0, import_chunk_YRBRUREX.debugMultipleSchemaPaths)(schemas),
|
15534
15565
|
/* schema */
|
15535
|
-
|
15566
|
+
schemas
|
15536
15567
|
);
|
15537
15568
|
throw panic;
|
15538
15569
|
}
|
15539
15570
|
}
|
15540
15571
|
function formatWasm(schema, documentFormattingParams) {
|
15541
|
-
const formattedSchema =
|
15572
|
+
const formattedSchema = import_chunk_EOWYER24.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
|
15542
15573
|
return formattedSchema;
|
15543
15574
|
}
|
15544
15575
|
/*! Bundled license information:
|