@prisma/internals 6.6.0-dev.34 → 6.6.0-dev.36
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-7MD6344A.js → chunk-5DBOS77Y.js} +3 -5
- package/dist/{chunk-KSJNY56L.js → chunk-5II75LYF.js} +22 -22
- package/dist/{chunk-JUXIW5NS.js → chunk-5MWCIDUY.js} +5 -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-LOQLKDQE.js → chunk-EV7SJDE5.js} +5 -5
- package/dist/{chunk-6E4KJPDH.js → chunk-GH3DD2OM.js} +14 -14
- package/dist/{chunk-PIHBLNPJ.js → chunk-OSAQY3IQ.js} +4 -4
- package/dist/{chunk-JHQHVXIR.js → chunk-OSHZ4P3G.js} +6 -7
- package/dist/{chunk-MM4PIVNT.js → chunk-PAIGKNMY.js} +26 -26
- package/dist/{chunk-2TQR7BKX.js → chunk-Q6VZHKYE.js} +9 -9
- package/dist/{chunk-T2PFJSAD.js → chunk-RQK5KO77.js} +13 -13
- package/dist/{chunk-YBYBY7QI.js → chunk-U4WXIU7C.js} +5 -5
- package/dist/{chunk-EORSBI5P.js → chunk-UCI7OFQ4.js} +5 -5
- package/dist/{chunk-RAC7G3AO.js → chunk-UVLDTPOI.js} +5 -5
- package/dist/{chunk-X3CLVIIZ.js → chunk-VLBKBUPL.js} +35 -64
- package/dist/{chunk-RVU5FP25.js → chunk-VYFTEDQQ.js} +393 -415
- package/dist/{chunk-GNEFDTJE.js → chunk-WSCZQCHP.js} +391 -413
- package/dist/{chunk-AYSLETYV.js → chunk-WUO3S6J2.js} +38 -67
- package/dist/{chunk-MSQTBYIV.js → chunk-YYIAYJ4W.js} +5 -5
- package/dist/cli/checkUnsupportedDataProxy.d.ts +12 -17
- package/dist/cli/checkUnsupportedDataProxy.js +21 -22
- package/dist/cli/getSchema.js +25 -26
- package/dist/cli/hashes.js +21 -22
- package/dist/cli/schemaContext.d.ts +17 -2
- package/dist/cli/schemaContext.js +21 -21
- package/dist/engine-commands/errorHelpers.js +4 -4
- package/dist/engine-commands/formatSchema.js +20 -21
- 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 +31 -32
- 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 +20 -21
- package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +20 -21
- package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +21 -22
- package/dist/get-generators/getGenerators.d.ts +7 -3
- package/dist/get-generators/getGenerators.js +23 -24
- package/dist/index.d.ts +1 -1
- package/dist/index.js +62 -62
- package/dist/resolveBinary.js +7 -7
- package/dist/schemaEngineCommands.js +8 -8
- package/dist/sendPanic.js +20 -21
- package/dist/utils/extractPreviewFeatures.d.ts +2 -2
- package/dist/utils/extractPreviewFeatures.js +2 -2
- package/dist/utils/getEnvPaths.js +20 -21
- package/dist/utils/getVersionFromPackageJson.js +3 -3
- package/dist/utils/handlePanic.js +20 -21
- package/dist/utils/loadEnvFile.js +20 -21
- package/dist/utils/toSchemasContainer.d.ts +2 -3
- package/dist/utils/toSchemasContainer.js +3 -4
- 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,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_WSCZQCHP_exports = {};
|
30
|
+
__export2(chunk_WSCZQCHP_exports, {
|
31
31
|
checkTypeScriptVersion: () => checkTypeScriptVersion,
|
32
32
|
checkUnsupportedDataProxy: () => checkUnsupportedDataProxy,
|
33
33
|
debug: () => debug5,
|
@@ -52,22 +52,22 @@ __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_WSCZQCHP_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");
|
67
67
|
var import_chunk_RS2R7COT = require("./chunk-RS2R7COT.js");
|
68
68
|
var import_chunk_X3P4J7WW = require("./chunk-X3P4J7WW.js");
|
69
69
|
var import_chunk_IKQFIRRX = require("./chunk-IKQFIRRX.js");
|
70
|
-
var
|
70
|
+
var import_chunk_OSHZ4P3G = require("./chunk-OSHZ4P3G.js");
|
71
71
|
var import_chunk_ZCVVZ6U6 = require("./chunk-ZCVVZ6U6.js");
|
72
72
|
var import_chunk_5V36RLCO = require("./chunk-5V36RLCO.js");
|
73
73
|
var import_chunk_5FJ3MENK = require("./chunk-5FJ3MENK.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");
|
@@ -99,39 +99,37 @@ var import_chunk_V37JTUKZ = require("./chunk-V37JTUKZ.js");
|
|
99
99
|
var import_chunk_MBB2KJWX = require("./chunk-MBB2KJWX.js");
|
100
100
|
var import_chunk_PG5FDKSF = require("./chunk-PG5FDKSF.js");
|
101
101
|
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
|
102
|
-
var import_debug =
|
103
|
-
var
|
102
|
+
var import_debug = require("@prisma/debug");
|
103
|
+
var import_schema_files_loader = require("@prisma/schema-files-loader");
|
104
104
|
var import_fs = __toESM2(require("fs"));
|
105
|
-
var import_debug2 = __toESM2(require("@prisma/debug"));
|
106
|
-
var import_node_path = __toESM2(require("node:path"));
|
107
|
-
var import_node_process = __toESM2(require("node:process"));
|
108
|
-
var import_node_path2 = __toESM2(require("node:path"));
|
109
|
-
var import_node_fs = __toESM2(require("node:fs"));
|
110
|
-
var import_node_url = require("node:url");
|
111
|
-
var import_node_fs2 = __toESM2(require("node:fs"));
|
112
|
-
var import_fs2 = __toESM2(require("fs"));
|
113
105
|
var import_path = __toESM2(require("path"));
|
114
|
-
var import_debug3 = require("@prisma/debug");
|
115
|
-
var import_schema_files_loader = require("@prisma/schema-files-loader");
|
116
|
-
var import_fs3 = __toESM2(require("fs"));
|
117
|
-
var import_path2 = __toESM2(require("path"));
|
118
106
|
var import_util = require("util");
|
107
|
+
var import_debug2 = __toESM2(require("@prisma/debug"));
|
119
108
|
var import_crypto = __toESM2(require("crypto"));
|
120
|
-
var
|
121
|
-
var
|
109
|
+
var import_path2 = __toESM2(require("path"));
|
110
|
+
var import_debug3 = __toESM2(require("@prisma/debug"));
|
122
111
|
var import_engines = require("@prisma/engines");
|
123
112
|
var import_fetch_engine = require("@prisma/fetch-engine");
|
124
113
|
var import_get_platform = require("@prisma/get-platform");
|
114
|
+
var import_path3 = __toESM2(require("path"));
|
115
|
+
var import_debug4 = __toESM2(require("@prisma/debug"));
|
116
|
+
var import_fs2 = __toESM2(require("fs"));
|
125
117
|
var import_path4 = __toESM2(require("path"));
|
126
118
|
var import_debug5 = __toESM2(require("@prisma/debug"));
|
127
|
-
var
|
119
|
+
var import_fs3 = __toESM2(require("fs"));
|
128
120
|
var import_path5 = __toESM2(require("path"));
|
129
|
-
var import_debug6 = __toESM2(require("@prisma/debug"));
|
130
|
-
var import_fs5 = __toESM2(require("fs"));
|
131
|
-
var import_path6 = __toESM2(require("path"));
|
132
121
|
var import_get_platform2 = require("@prisma/get-platform");
|
133
|
-
var
|
122
|
+
var import_fs4 = __toESM2(require("fs"));
|
134
123
|
var import_os = __toESM2(require("os"));
|
124
|
+
var import_path6 = __toESM2(require("path"));
|
125
|
+
var import_debug6 = __toESM2(require("@prisma/debug"));
|
126
|
+
var import_node_path = __toESM2(require("node:path"));
|
127
|
+
var import_node_process = __toESM2(require("node:process"));
|
128
|
+
var import_node_path2 = __toESM2(require("node:path"));
|
129
|
+
var import_node_fs = __toESM2(require("node:fs"));
|
130
|
+
var import_node_url = require("node:url");
|
131
|
+
var import_node_fs2 = __toESM2(require("node:fs"));
|
132
|
+
var import_fs5 = __toESM2(require("fs"));
|
135
133
|
var import_path7 = __toESM2(require("path"));
|
136
134
|
var import_prompts = __toESM2(require("prompts"));
|
137
135
|
var import_get_platform3 = require("@prisma/get-platform");
|
@@ -139,13 +137,13 @@ var require_readdir_glob = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
139
137
|
"../../node_modules/.pnpm/readdir-glob@1.1.2/node_modules/readdir-glob/index.js"(exports2, module2) {
|
140
138
|
"use strict";
|
141
139
|
module2.exports = readdirGlob;
|
142
|
-
var
|
140
|
+
var fs9 = (0, import_chunk_2ESYSVXG.__require)("fs");
|
143
141
|
var { EventEmitter } = (0, import_chunk_2ESYSVXG.__require)("events");
|
144
142
|
var { Minimatch } = (0, import_chunk_KYMYLH7F.require_minimatch)();
|
145
143
|
var { resolve } = (0, import_chunk_2ESYSVXG.__require)("path");
|
146
144
|
function readdir(dir2, strict) {
|
147
145
|
return new Promise((resolve2, reject2) => {
|
148
|
-
|
146
|
+
fs9.readdir(dir2, { withFileTypes: true }, (err, files) => {
|
149
147
|
if (err) {
|
150
148
|
switch (err.code) {
|
151
149
|
case "ENOTDIR":
|
@@ -178,7 +176,7 @@ var require_readdir_glob = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
178
176
|
}
|
179
177
|
function stat2(file, followSymlinks) {
|
180
178
|
return new Promise((resolve2, reject2) => {
|
181
|
-
const statFunc = followSymlinks ?
|
179
|
+
const statFunc = followSymlinks ? fs9.stat : fs9.lstat;
|
182
180
|
statFunc(file, (err, stats) => {
|
183
181
|
if (err) {
|
184
182
|
switch (err.code) {
|
@@ -8248,7 +8246,7 @@ var require_isPlainObject = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
8248
8246
|
var require_file = (0, import_chunk_2ESYSVXG.__commonJS)({
|
8249
8247
|
"../../node_modules/.pnpm/archiver-utils@4.0.1/node_modules/archiver-utils/file.js"(exports2, module2) {
|
8250
8248
|
"use strict";
|
8251
|
-
var
|
8249
|
+
var fs9 = (0, import_chunk_RAYPCPVU.require_graceful_fs)();
|
8252
8250
|
var path11 = (0, import_chunk_2ESYSVXG.__require)("path");
|
8253
8251
|
var flatten = require_flatten();
|
8254
8252
|
var difference = require_difference();
|
@@ -8275,7 +8273,7 @@ var require_file = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
8275
8273
|
};
|
8276
8274
|
file.exists = function() {
|
8277
8275
|
var filepath = path11.join.apply(path11, arguments);
|
8278
|
-
return
|
8276
|
+
return fs9.existsSync(filepath);
|
8279
8277
|
};
|
8280
8278
|
file.expand = function(...args) {
|
8281
8279
|
var options2 = isPlainObject(args[0]) ? args.shift() : {};
|
@@ -8293,7 +8291,7 @@ var require_file = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
8293
8291
|
if (typeof options2.filter === "function") {
|
8294
8292
|
return options2.filter(filepath);
|
8295
8293
|
} else {
|
8296
|
-
return
|
8294
|
+
return fs9.statSync(filepath)[options2.filter]();
|
8297
8295
|
}
|
8298
8296
|
} catch (e) {
|
8299
8297
|
return false;
|
@@ -8400,7 +8398,7 @@ var require_file = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
8400
8398
|
var require_archiver_utils = (0, import_chunk_2ESYSVXG.__commonJS)({
|
8401
8399
|
"../../node_modules/.pnpm/archiver-utils@4.0.1/node_modules/archiver-utils/index.js"(exports2, module2) {
|
8402
8400
|
"use strict";
|
8403
|
-
var
|
8401
|
+
var fs9 = (0, import_chunk_RAYPCPVU.require_graceful_fs)();
|
8404
8402
|
var path11 = (0, import_chunk_2ESYSVXG.__require)("path");
|
8405
8403
|
var lazystream = require_lazystream();
|
8406
8404
|
var normalizePath = require_normalize_path();
|
@@ -8448,7 +8446,7 @@ var require_archiver_utils = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
8448
8446
|
};
|
8449
8447
|
utils.lazyReadStream = function(filepath) {
|
8450
8448
|
return new lazystream.Readable(function() {
|
8451
|
-
return
|
8449
|
+
return fs9.createReadStream(filepath);
|
8452
8450
|
});
|
8453
8451
|
};
|
8454
8452
|
utils.normalizeInputSource = function(source) {
|
@@ -8476,7 +8474,7 @@ var require_archiver_utils = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
8476
8474
|
callback = base;
|
8477
8475
|
base = dirpath;
|
8478
8476
|
}
|
8479
|
-
|
8477
|
+
fs9.readdir(dirpath, function(err, list) {
|
8480
8478
|
var i = 0;
|
8481
8479
|
var file;
|
8482
8480
|
var filepath;
|
@@ -8489,7 +8487,7 @@ var require_archiver_utils = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
8489
8487
|
return callback(null, results);
|
8490
8488
|
}
|
8491
8489
|
filepath = path11.join(dirpath, file);
|
8492
|
-
|
8490
|
+
fs9.stat(filepath, function(err2, stats) {
|
8493
8491
|
results.push({
|
8494
8492
|
path: filepath,
|
8495
8493
|
relative: path11.relative(base, filepath).replace(/\\/g, "/"),
|
@@ -8549,7 +8547,7 @@ var require_error = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
8549
8547
|
var require_core = (0, import_chunk_2ESYSVXG.__commonJS)({
|
8550
8548
|
"../../node_modules/.pnpm/archiver@6.0.2/node_modules/archiver/lib/core.js"(exports2, module2) {
|
8551
8549
|
"use strict";
|
8552
|
-
var
|
8550
|
+
var fs9 = (0, import_chunk_2ESYSVXG.__require)("fs");
|
8553
8551
|
var glob = require_readdir_glob();
|
8554
8552
|
var async = (init_async(), (0, import_chunk_2ESYSVXG.__toCommonJS)(async_exports));
|
8555
8553
|
var path11 = (0, import_chunk_2ESYSVXG.__require)("path");
|
@@ -8613,7 +8611,7 @@ var require_core = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
8613
8611
|
data.sourcePath = filepath;
|
8614
8612
|
task.data = data;
|
8615
8613
|
this._entriesCount++;
|
8616
|
-
if (data.stats && data.stats instanceof
|
8614
|
+
if (data.stats && data.stats instanceof fs9.Stats) {
|
8617
8615
|
task = this._updateQueueTaskWithStats(task, data.stats);
|
8618
8616
|
if (task) {
|
8619
8617
|
if (data.stats.size) {
|
@@ -8784,7 +8782,7 @@ var require_core = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
8784
8782
|
callback();
|
8785
8783
|
return;
|
8786
8784
|
}
|
8787
|
-
|
8785
|
+
fs9.lstat(task.filepath, function(err, stats) {
|
8788
8786
|
if (this._state.aborted) {
|
8789
8787
|
setImmediate(callback);
|
8790
8788
|
return;
|
@@ -8827,7 +8825,7 @@ var require_core = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
8827
8825
|
task.data.sourceType = "buffer";
|
8828
8826
|
task.source = Buffer.concat([]);
|
8829
8827
|
} else if (stats.isSymbolicLink() && this._moduleSupports("symlink")) {
|
8830
|
-
var linkPath =
|
8828
|
+
var linkPath = fs9.readlinkSync(task.filepath);
|
8831
8829
|
var dirName = path11.dirname(task.filepath);
|
8832
8830
|
task.data.type = "symlink";
|
8833
8831
|
task.data.linkname = path11.relative(dirName, path11.resolve(dirName, linkPath));
|
@@ -14013,8 +14011,8 @@ var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14013
14011
|
status: "disabled"
|
14014
14012
|
};
|
14015
14013
|
}
|
14016
|
-
const
|
14017
|
-
const cacheResponse = await
|
14014
|
+
const config = await Config.new(state);
|
14015
|
+
const cacheResponse = await config.checkCache(state);
|
14018
14016
|
state.check_if_update_available = cacheResponse.stale === true || !cacheResponse.cache;
|
14019
14017
|
const child = spawn(state);
|
14020
14018
|
if (state.unref) {
|
@@ -14029,7 +14027,7 @@ var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14029
14027
|
}
|
14030
14028
|
for (const key of Object.keys(state)) {
|
14031
14029
|
if (state[key]) {
|
14032
|
-
await
|
14030
|
+
await config.set({
|
14033
14031
|
[key]: state[key]
|
14034
14032
|
});
|
14035
14033
|
}
|
@@ -14041,7 +14039,7 @@ var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14041
14039
|
data: cacheResponse.cache.output
|
14042
14040
|
};
|
14043
14041
|
}
|
14044
|
-
await
|
14042
|
+
await config.set({
|
14045
14043
|
last_reminder: state.now()
|
14046
14044
|
});
|
14047
14045
|
return {
|
@@ -14104,11 +14102,11 @@ var require_dist = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14104
14102
|
var require_tmp = (0, import_chunk_2ESYSVXG.__commonJS)({
|
14105
14103
|
"../../node_modules/.pnpm/tmp@0.2.3/node_modules/tmp/lib/tmp.js"(exports2, module2) {
|
14106
14104
|
"use strict";
|
14107
|
-
var
|
14105
|
+
var fs9 = (0, import_chunk_2ESYSVXG.__require)("fs");
|
14108
14106
|
var os3 = (0, import_chunk_2ESYSVXG.__require)("os");
|
14109
14107
|
var path11 = (0, import_chunk_2ESYSVXG.__require)("path");
|
14110
14108
|
var crypto3 = (0, import_chunk_2ESYSVXG.__require)("crypto");
|
14111
|
-
var _c = { fs:
|
14109
|
+
var _c = { fs: fs9.constants, os: os3.constants };
|
14112
14110
|
var RANDOM_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
14113
14111
|
var TEMPLATE_PATTERN = /XXXXXX/;
|
14114
14112
|
var DEFAULT_TRIES = 3;
|
@@ -14120,13 +14118,13 @@ var require_tmp = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14120
14118
|
var FILE_MODE = 384;
|
14121
14119
|
var EXIT = "exit";
|
14122
14120
|
var _removeObjects = [];
|
14123
|
-
var FN_RMDIR_SYNC =
|
14121
|
+
var FN_RMDIR_SYNC = fs9.rmdirSync.bind(fs9);
|
14124
14122
|
var _gracefulCleanup = false;
|
14125
14123
|
function rimraf(dirPath, callback) {
|
14126
|
-
return
|
14124
|
+
return fs9.rm(dirPath, { recursive: true }, callback);
|
14127
14125
|
}
|
14128
14126
|
function FN_RIMRAF_SYNC(dirPath) {
|
14129
|
-
return
|
14127
|
+
return fs9.rmSync(dirPath, { recursive: true });
|
14130
14128
|
}
|
14131
14129
|
function tmpName(options2, callback) {
|
14132
14130
|
const args = _parseArguments(options2, callback), opts = args[0], cb = args[1];
|
@@ -14139,7 +14137,7 @@ var require_tmp = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14139
14137
|
(function _getUniqueName() {
|
14140
14138
|
try {
|
14141
14139
|
const name = _generateTmpName(opts);
|
14142
|
-
|
14140
|
+
fs9.stat(name, function(err) {
|
14143
14141
|
if (!err) {
|
14144
14142
|
if (tries-- > 0) return _getUniqueName();
|
14145
14143
|
return cb(new Error("Could not get a unique tmp filename, max tries reached " + name));
|
@@ -14158,7 +14156,7 @@ var require_tmp = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14158
14156
|
do {
|
14159
14157
|
const name = _generateTmpName(opts);
|
14160
14158
|
try {
|
14161
|
-
|
14159
|
+
fs9.statSync(name);
|
14162
14160
|
} catch (e) {
|
14163
14161
|
return name;
|
14164
14162
|
}
|
@@ -14169,10 +14167,10 @@ var require_tmp = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14169
14167
|
const args = _parseArguments(options2, callback), opts = args[0], cb = args[1];
|
14170
14168
|
tmpName(opts, function _tmpNameCreated(err, name) {
|
14171
14169
|
if (err) return cb(err);
|
14172
|
-
|
14170
|
+
fs9.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err2, fd) {
|
14173
14171
|
if (err2) return cb(err2);
|
14174
14172
|
if (opts.discardDescriptor) {
|
14175
|
-
return
|
14173
|
+
return fs9.close(fd, function _discardCallback(possibleErr) {
|
14176
14174
|
return cb(possibleErr, name, void 0, _prepareTmpFileRemoveCallback(name, -1, opts, false));
|
14177
14175
|
});
|
14178
14176
|
} else {
|
@@ -14186,9 +14184,9 @@ var require_tmp = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14186
14184
|
const args = _parseArguments(options2), opts = args[0];
|
14187
14185
|
const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;
|
14188
14186
|
const name = tmpNameSync(opts);
|
14189
|
-
var fd =
|
14187
|
+
var fd = fs9.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
|
14190
14188
|
if (opts.discardDescriptor) {
|
14191
|
-
|
14189
|
+
fs9.closeSync(fd);
|
14192
14190
|
fd = void 0;
|
14193
14191
|
}
|
14194
14192
|
return {
|
@@ -14201,7 +14199,7 @@ var require_tmp = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14201
14199
|
const args = _parseArguments(options2, callback), opts = args[0], cb = args[1];
|
14202
14200
|
tmpName(opts, function _tmpNameCreated(err, name) {
|
14203
14201
|
if (err) return cb(err);
|
14204
|
-
|
14202
|
+
fs9.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err2) {
|
14205
14203
|
if (err2) return cb(err2);
|
14206
14204
|
cb(null, name, _prepareTmpDirRemoveCallback(name, opts, false));
|
14207
14205
|
});
|
@@ -14210,7 +14208,7 @@ var require_tmp = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14210
14208
|
function dirSync(options2) {
|
14211
14209
|
const args = _parseArguments(options2), opts = args[0];
|
14212
14210
|
const name = tmpNameSync(opts);
|
14213
|
-
|
14211
|
+
fs9.mkdirSync(name, opts.mode || DIR_MODE);
|
14214
14212
|
return {
|
14215
14213
|
name,
|
14216
14214
|
removeCallback: _prepareTmpDirRemoveCallback(name, opts, true)
|
@@ -14224,20 +14222,20 @@ var require_tmp = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14224
14222
|
next();
|
14225
14223
|
};
|
14226
14224
|
if (0 <= fdPath[0])
|
14227
|
-
|
14228
|
-
|
14225
|
+
fs9.close(fdPath[0], function() {
|
14226
|
+
fs9.unlink(fdPath[1], _handler);
|
14229
14227
|
});
|
14230
|
-
else
|
14228
|
+
else fs9.unlink(fdPath[1], _handler);
|
14231
14229
|
}
|
14232
14230
|
function _removeFileSync(fdPath) {
|
14233
14231
|
let rethrownException = null;
|
14234
14232
|
try {
|
14235
|
-
if (0 <= fdPath[0])
|
14233
|
+
if (0 <= fdPath[0]) fs9.closeSync(fdPath[0]);
|
14236
14234
|
} catch (e) {
|
14237
14235
|
if (!_isEBADF(e) && !_isENOENT(e)) throw e;
|
14238
14236
|
} finally {
|
14239
14237
|
try {
|
14240
|
-
|
14238
|
+
fs9.unlinkSync(fdPath[1]);
|
14241
14239
|
} catch (e) {
|
14242
14240
|
if (!_isENOENT(e)) rethrownException = e;
|
14243
14241
|
}
|
@@ -14253,7 +14251,7 @@ var require_tmp = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14253
14251
|
return sync ? removeCallbackSync : removeCallback;
|
14254
14252
|
}
|
14255
14253
|
function _prepareTmpDirRemoveCallback(name, opts, sync) {
|
14256
|
-
const removeFunction = opts.unsafeCleanup ? rimraf :
|
14254
|
+
const removeFunction = opts.unsafeCleanup ? rimraf : fs9.rmdir.bind(fs9);
|
14257
14255
|
const removeFunctionSync = opts.unsafeCleanup ? FN_RIMRAF_SYNC : FN_RMDIR_SYNC;
|
14258
14256
|
const removeCallbackSync = _prepareRemoveCallback(removeFunctionSync, name, sync);
|
14259
14257
|
const removeCallback = _prepareRemoveCallback(removeFunction, name, sync, removeCallbackSync);
|
@@ -14414,89 +14412,72 @@ var require_tmp = (0, import_chunk_2ESYSVXG.__commonJS)({
|
|
14414
14412
|
module2.exports.setGracefulCleanup = setGracefulCleanup;
|
14415
14413
|
}
|
14416
14414
|
});
|
14417
|
-
var
|
14418
|
-
|
14419
|
-
|
14420
|
-
|
14421
|
-
|
14422
|
-
|
14423
|
-
|
14415
|
+
var debug2 = (0, import_debug2.default)("prisma:format");
|
14416
|
+
async function formatSchema({ schemas }, inputFormattingOptions) {
|
14417
|
+
if (process.env.FORCE_PANIC_PRISMA_SCHEMA) {
|
14418
|
+
handleFormatPanic(
|
14419
|
+
() => {
|
14420
|
+
import_chunk_R7U45FIQ.prismaSchemaWasm.debug_panic();
|
14421
|
+
},
|
14422
|
+
{ schemas }
|
14423
|
+
);
|
14424
14424
|
}
|
14425
|
-
|
14426
|
-
|
14427
|
-
|
14428
|
-
|
14429
|
-
|
14430
|
-
|
14431
|
-
|
14432
|
-
|
14433
|
-
|
14434
|
-
checkType(type);
|
14435
|
-
cwd = toPath2(cwd);
|
14436
|
-
const statFunction = allowSymlinks ? import_node_fs.default.statSync : import_node_fs.default.lstatSync;
|
14437
|
-
for (const path_ of paths2) {
|
14438
|
-
try {
|
14439
|
-
const stat2 = statFunction(import_node_path2.default.resolve(cwd, path_), {
|
14440
|
-
throwIfNoEntry: false
|
14441
|
-
});
|
14442
|
-
if (!stat2) {
|
14443
|
-
continue;
|
14444
|
-
}
|
14445
|
-
if (matchType(type, stat2)) {
|
14446
|
-
return path_;
|
14447
|
-
}
|
14448
|
-
} catch {
|
14425
|
+
const defaultFormattingOptions = {
|
14426
|
+
tabSize: 2,
|
14427
|
+
insertSpaces: true
|
14428
|
+
};
|
14429
|
+
const documentFormattingParams = {
|
14430
|
+
textDocument: { uri: "file:/dev/null" },
|
14431
|
+
options: {
|
14432
|
+
...defaultFormattingOptions,
|
14433
|
+
...inputFormattingOptions
|
14449
14434
|
}
|
14435
|
+
};
|
14436
|
+
const { formattedMultipleSchemas, lintDiagnostics } = handleFormatPanic(
|
14437
|
+
() => {
|
14438
|
+
const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(schemas), documentFormattingParams);
|
14439
|
+
const formattedMultipleSchemas2 = JSON.parse(formattedMultipleSchemasRaw);
|
14440
|
+
const lintDiagnostics2 = (0, import_chunk_7CMXNYMQ.lintSchema)({ schemas: formattedMultipleSchemas2 });
|
14441
|
+
return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
|
14442
|
+
},
|
14443
|
+
{ schemas }
|
14444
|
+
);
|
14445
|
+
const lintWarnings = (0, import_chunk_7CMXNYMQ.getLintWarningsAsText)(lintDiagnostics);
|
14446
|
+
if (lintWarnings && import_chunk_MBB2KJWX.logger_exports.should.warn()) {
|
14447
|
+
console.warn(lintWarnings);
|
14450
14448
|
}
|
14449
|
+
return Promise.resolve(formattedMultipleSchemas);
|
14451
14450
|
}
|
14452
|
-
function
|
14451
|
+
function handleFormatPanic(tryCb, { schemas }) {
|
14453
14452
|
try {
|
14454
|
-
|
14455
|
-
|
14456
|
-
|
14457
|
-
|
14458
|
-
|
14459
|
-
|
14460
|
-
|
14461
|
-
|
14462
|
-
|
14463
|
-
|
14464
|
-
|
14465
|
-
|
14466
|
-
|
14467
|
-
|
14468
|
-
|
14469
|
-
|
14470
|
-
|
14471
|
-
|
14472
|
-
|
14473
|
-
return locatePathSync([foundPath], locateOptions);
|
14474
|
-
}
|
14475
|
-
return foundPath;
|
14476
|
-
};
|
14477
|
-
const matches = [];
|
14478
|
-
while (true) {
|
14479
|
-
const foundPath = runMatcher({ ...options2, cwd: directory });
|
14480
|
-
if (foundPath === findUpStop) {
|
14481
|
-
break;
|
14482
|
-
}
|
14483
|
-
if (foundPath) {
|
14484
|
-
matches.push(import_node_path.default.resolve(directory, foundPath));
|
14485
|
-
}
|
14486
|
-
if (directory === stopAt || matches.length >= limit) {
|
14487
|
-
break;
|
14488
|
-
}
|
14489
|
-
directory = import_node_path.default.dirname(directory);
|
14453
|
+
return tryCb();
|
14454
|
+
} catch (e) {
|
14455
|
+
const { message, stack } = (0, import_chunk_CCQRDM7X.getWasmError)(e);
|
14456
|
+
debug2(`Error formatting schema: ${message}`);
|
14457
|
+
debug2(stack);
|
14458
|
+
const panic = new import_chunk_CCQRDM7X.RustPanic(
|
14459
|
+
/* message */
|
14460
|
+
message,
|
14461
|
+
/* rustStack */
|
14462
|
+
stack,
|
14463
|
+
/* request */
|
14464
|
+
"@prisma/prisma-schema-wasm format",
|
14465
|
+
"FMT_CLI",
|
14466
|
+
/* schemaPath */
|
14467
|
+
(0, import_chunk_YRBRUREX.debugMultipleSchemaPaths)(schemas),
|
14468
|
+
/* schema */
|
14469
|
+
schemas
|
14470
|
+
);
|
14471
|
+
throw panic;
|
14490
14472
|
}
|
14491
|
-
return matches;
|
14492
14473
|
}
|
14493
|
-
function
|
14494
|
-
const
|
14495
|
-
return
|
14474
|
+
function formatWasm(schema, documentFormattingParams) {
|
14475
|
+
const formattedSchema = import_chunk_R7U45FIQ.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
|
14476
|
+
return formattedSchema;
|
14496
14477
|
}
|
14497
|
-
var readFile = (0, import_util.promisify)(
|
14498
|
-
var stat = (0, import_util.promisify)(
|
14499
|
-
var
|
14478
|
+
var readFile = (0, import_util.promisify)(import_fs.default.readFile);
|
14479
|
+
var stat = (0, import_util.promisify)(import_fs.default.stat);
|
14480
|
+
var debug3 = (0, import_debug.Debug)("prisma:getSchema");
|
14500
14481
|
async function getSchemaWithPath(schemaPathFromArgs, schemaPathFromConfig, { cwd = process.cwd(), argumentName = "--schema" } = {}) {
|
14501
14482
|
const result = await getSchemaWithPathInternal(schemaPathFromArgs, schemaPathFromConfig, { cwd, argumentName });
|
14502
14483
|
if (result.ok) {
|
@@ -14512,7 +14493,7 @@ async function getSchemaWithPathOptional(schemaPathFromArgs, schemaPathFromConfi
|
|
14512
14493
|
return null;
|
14513
14494
|
}
|
14514
14495
|
async function readSchemaFromSingleFile(schemaPath2) {
|
14515
|
-
|
14496
|
+
debug3("Reading schema from single file", schemaPath2);
|
14516
14497
|
const typeError = await (0, import_schema_files_loader.ensureType)(schemaPath2, "file");
|
14517
14498
|
if (typeError) {
|
14518
14499
|
return { ok: false, error: typeError };
|
@@ -14521,23 +14502,23 @@ async function readSchemaFromSingleFile(schemaPath2) {
|
|
14521
14502
|
const schemaTuple = [schemaPath2, file];
|
14522
14503
|
return {
|
14523
14504
|
ok: true,
|
14524
|
-
schema: { schemaPath: schemaPath2, schemaRootDir:
|
14505
|
+
schema: { schemaPath: schemaPath2, schemaRootDir: import_path.default.dirname(schemaPath2), schemas: [schemaTuple] }
|
14525
14506
|
};
|
14526
14507
|
}
|
14527
14508
|
async function readSchemaFromDirectory(schemaPath2) {
|
14528
|
-
|
14509
|
+
debug3("Reading schema from multiple files", schemaPath2);
|
14529
14510
|
const typeError = await (0, import_schema_files_loader.ensureType)(schemaPath2, "directory");
|
14530
14511
|
if (typeError) {
|
14531
14512
|
return { ok: false, error: typeError };
|
14532
14513
|
}
|
14533
14514
|
const files = await (0, import_schema_files_loader.loadSchemaFiles)(schemaPath2);
|
14534
|
-
|
14535
|
-
const
|
14515
|
+
debug3("Loading config");
|
14516
|
+
const config = await (0, import_chunk_2VT4AM4Y.getConfig)({
|
14536
14517
|
datamodel: files,
|
14537
14518
|
ignoreEnvVarErrors: true
|
14538
14519
|
});
|
14539
|
-
|
14540
|
-
if (!(0, import_schema_files_loader.usesPrismaSchemaFolder)(
|
14520
|
+
debug3("Ok");
|
14521
|
+
if (!(0, import_schema_files_loader.usesPrismaSchemaFolder)(config)) {
|
14541
14522
|
return { ok: false, error: { kind: "FolderPreviewNotEnabled", path: schemaPath2 } };
|
14542
14523
|
}
|
14543
14524
|
return { ok: true, schema: { schemaPath: schemaPath2, schemaRootDir: schemaPath2, schemas: files } };
|
@@ -14562,10 +14543,10 @@ async function readSchemaFromFileOrDirectory(schemaPath2) {
|
|
14562
14543
|
}
|
14563
14544
|
async function getSchemaWithPathInternal(schemaPathFromArgs, schemaPathFromConfig, { cwd, argumentName }) {
|
14564
14545
|
if (schemaPathFromArgs) {
|
14565
|
-
const absPath =
|
14546
|
+
const absPath = import_path.default.resolve(cwd, schemaPathFromArgs);
|
14566
14547
|
const customSchemaResult = await readSchemaFromFileOrDirectory(absPath);
|
14567
14548
|
if (!customSchemaResult.ok) {
|
14568
|
-
const relPath =
|
14549
|
+
const relPath = import_path.default.relative(cwd, absPath);
|
14569
14550
|
throw new Error(
|
14570
14551
|
`Could not load \`${argumentName}\` from provided path \`${relPath}\`: ${renderLookupError(
|
14571
14552
|
customSchemaResult.error
|
@@ -14615,7 +14596,7 @@ function renderDefaultLookupError(error, cwd) {
|
|
14615
14596
|
for (const failure of error.failures) {
|
14616
14597
|
const filePath = failure.rule.schemaPath.path;
|
14617
14598
|
if (!printedPaths.has(failure.rule.schemaPath.path)) {
|
14618
|
-
parts.push(`${
|
14599
|
+
parts.push(`${import_path.default.relative(cwd, filePath)}: ${renderLookupError(failure.error)}`);
|
14619
14600
|
printedPaths.add(filePath);
|
14620
14601
|
}
|
14621
14602
|
}
|
@@ -14640,47 +14621,47 @@ async function readSchemaFromPrismaConfigBasedLocation(schemaPathFromConfig) {
|
|
14640
14621
|
error: { kind: "PrismaConfigNotConfigured" }
|
14641
14622
|
};
|
14642
14623
|
}
|
14643
|
-
let
|
14624
|
+
let schemaResult;
|
14644
14625
|
if (schemaPathFromConfig.kind === "single") {
|
14645
|
-
|
14646
|
-
if (!
|
14626
|
+
schemaResult = await readSchemaFromSingleFile(schemaPathFromConfig.filePath);
|
14627
|
+
if (!schemaResult.ok) {
|
14647
14628
|
throw new Error(
|
14648
|
-
`Could not load schema from file \`${schemaPathFromConfig.filePath}\` provided by "prisma.config.ts"\`: ${renderLookupError(
|
14629
|
+
`Could not load schema from file \`${schemaPathFromConfig.filePath}\` provided by "prisma.config.ts"\`: ${renderLookupError(schemaResult.error)}`
|
14649
14630
|
);
|
14650
14631
|
}
|
14651
14632
|
} else {
|
14652
|
-
|
14653
|
-
if (!
|
14633
|
+
schemaResult = await readSchemaFromDirectory(schemaPathFromConfig.folderPath);
|
14634
|
+
if (!schemaResult.ok) {
|
14654
14635
|
throw new Error(
|
14655
|
-
`Could not load schema from folder \`${schemaPathFromConfig.folderPath}\` provided by "prisma.config.ts"\`: ${renderLookupError(
|
14636
|
+
`Could not load schema from folder \`${schemaPathFromConfig.folderPath}\` provided by "prisma.config.ts"\`: ${renderLookupError(schemaResult.error)}`
|
14656
14637
|
);
|
14657
14638
|
}
|
14658
14639
|
}
|
14659
|
-
return
|
14640
|
+
return schemaResult;
|
14660
14641
|
}
|
14661
14642
|
async function getSchemaFromPackageJson(cwd) {
|
14662
14643
|
const prismaConfig = await getPrismaConfigFromPackageJson(cwd);
|
14663
|
-
|
14644
|
+
debug3("prismaConfig", prismaConfig);
|
14664
14645
|
if (!prismaConfig || !prismaConfig.data?.schema) {
|
14665
14646
|
return { ok: false, error: { kind: "PackageJsonNotConfigured" } };
|
14666
14647
|
}
|
14667
14648
|
const schemaPathFromPkgJson = prismaConfig.data.schema;
|
14668
14649
|
if (typeof schemaPathFromPkgJson !== "string") {
|
14669
14650
|
throw new Error(
|
14670
|
-
`Provided schema path \`${schemaPathFromPkgJson}\` from \`${
|
14651
|
+
`Provided schema path \`${schemaPathFromPkgJson}\` from \`${import_path.default.relative(
|
14671
14652
|
cwd,
|
14672
14653
|
prismaConfig.packagePath
|
14673
14654
|
)}\` must be of type string`
|
14674
14655
|
);
|
14675
14656
|
}
|
14676
|
-
const absoluteSchemaPath =
|
14657
|
+
const absoluteSchemaPath = import_path.default.isAbsolute(schemaPathFromPkgJson) ? schemaPathFromPkgJson : import_path.default.resolve(import_path.default.dirname(prismaConfig.packagePath), schemaPathFromPkgJson);
|
14677
14658
|
const lookupResult = await readSchemaFromFileOrDirectory(absoluteSchemaPath);
|
14678
14659
|
if (!lookupResult.ok) {
|
14679
14660
|
throw new Error(
|
14680
|
-
`Could not load schema from \`${
|
14661
|
+
`Could not load schema from \`${import_path.default.relative(
|
14681
14662
|
cwd,
|
14682
14663
|
absoluteSchemaPath
|
14683
|
-
)}\` provided by "prisma.schema" config of \`${
|
14664
|
+
)}\` provided by "prisma.schema" config of \`${import_path.default.relative(
|
14684
14665
|
cwd,
|
14685
14666
|
prismaConfig.packagePath
|
14686
14667
|
)}\`: ${renderLookupError(lookupResult.error)}`
|
@@ -14691,33 +14672,33 @@ async function getSchemaFromPackageJson(cwd) {
|
|
14691
14672
|
async function getDefaultSchema(cwd, failures = []) {
|
14692
14673
|
const schemaPrisma = {
|
14693
14674
|
schemaPath: {
|
14694
|
-
path:
|
14675
|
+
path: import_path.default.join(cwd, "schema.prisma"),
|
14695
14676
|
kind: "file"
|
14696
14677
|
}
|
14697
14678
|
};
|
14698
14679
|
const prismaSchemaFile = {
|
14699
14680
|
schemaPath: {
|
14700
|
-
path:
|
14681
|
+
path: import_path.default.join(cwd, "prisma", "schema.prisma"),
|
14701
14682
|
kind: "file"
|
14702
14683
|
},
|
14703
14684
|
conflictsWith: {
|
14704
|
-
path:
|
14685
|
+
path: import_path.default.join(cwd, "prisma", "schema"),
|
14705
14686
|
kind: "directory"
|
14706
14687
|
}
|
14707
14688
|
};
|
14708
14689
|
const prismaSchemaFolder = {
|
14709
14690
|
schemaPath: {
|
14710
|
-
path:
|
14691
|
+
path: import_path.default.join(cwd, "prisma", "schema"),
|
14711
14692
|
kind: "directory"
|
14712
14693
|
},
|
14713
14694
|
conflictsWith: {
|
14714
|
-
path:
|
14695
|
+
path: import_path.default.join(cwd, "prisma", "schema.prisma"),
|
14715
14696
|
kind: "file"
|
14716
14697
|
}
|
14717
14698
|
};
|
14718
14699
|
const rules = [schemaPrisma, prismaSchemaFile, prismaSchemaFolder];
|
14719
14700
|
for (const rule of rules) {
|
14720
|
-
|
14701
|
+
debug3(`Checking existence of ${rule.schemaPath.path}`);
|
14721
14702
|
const schema = await loadSchemaFromDefaultLocation(rule.schemaPath);
|
14722
14703
|
if (!schema.ok) {
|
14723
14704
|
failures.push({ rule, error: schema.error });
|
@@ -14727,7 +14708,7 @@ async function getDefaultSchema(cwd, failures = []) {
|
|
14727
14708
|
const conflictingSchema = await loadSchemaFromDefaultLocation(rule.conflictsWith);
|
14728
14709
|
if (conflictingSchema.ok) {
|
14729
14710
|
throw new Error(
|
14730
|
-
`Found Prisma Schemas at both \`${
|
14711
|
+
`Found Prisma Schemas at both \`${import_path.default.relative(cwd, rule.schemaPath.path)}\` and \`${import_path.default.relative(
|
14731
14712
|
cwd,
|
14732
14713
|
rule.conflictsWith.path
|
14733
14714
|
)}\`. Please remove one.`
|
@@ -14754,125 +14735,18 @@ async function loadSchemaFromDefaultLocation(lookupPath) {
|
|
14754
14735
|
}
|
14755
14736
|
async function getSchemaDir(schemaPathFromArgs) {
|
14756
14737
|
if (schemaPathFromArgs) {
|
14757
|
-
return
|
14738
|
+
return import_path.default.resolve(import_path.default.dirname(schemaPathFromArgs));
|
14758
14739
|
}
|
14759
14740
|
const schemaPathResult = await getSchemaWithPath();
|
14760
14741
|
if (!schemaPathResult) {
|
14761
14742
|
return null;
|
14762
14743
|
}
|
14763
|
-
return
|
14744
|
+
return import_path.default.dirname(schemaPathResult.schemaPath);
|
14764
14745
|
}
|
14765
14746
|
async function getSchema(schemaPathFromArgs, schemaPathFromConfig) {
|
14766
14747
|
const schemaPathResult = await getSchemaWithPath(schemaPathFromArgs, schemaPathFromConfig);
|
14767
14748
|
return schemaPathResult.schemas;
|
14768
14749
|
}
|
14769
|
-
var debug3 = (0, import_debug2.default)("prisma:loadEnv");
|
14770
|
-
async function getEnvPaths(schemaPath2, opts = { cwd: process.cwd() }) {
|
14771
|
-
const rootEnvPath = getProjectRootEnvPath({ cwd: opts.cwd }) ?? null;
|
14772
|
-
const schemaEnvPathFromArgs = schemaPathToEnvPath(schemaPath2);
|
14773
|
-
const schemaEnvPathFromPkgJson = schemaPathToEnvPath(await readSchemaPathFromPkgJson());
|
14774
|
-
const schemaEnvPaths = [
|
14775
|
-
schemaEnvPathFromArgs,
|
14776
|
-
// 1 - Check --schema directory for .env
|
14777
|
-
schemaEnvPathFromPkgJson,
|
14778
|
-
// 2 - Check package.json schema directory for .env
|
14779
|
-
"./prisma/.env",
|
14780
|
-
// 3 - Check ./prisma directory for .env
|
14781
|
-
"./.env"
|
14782
|
-
// 4 - Check cwd for .env
|
14783
|
-
];
|
14784
|
-
const schemaEnvPath = schemaEnvPaths.find(import_chunk_ZCVVZ6U6.exists);
|
14785
|
-
return { rootEnvPath, schemaEnvPath };
|
14786
|
-
}
|
14787
|
-
async function readSchemaPathFromPkgJson() {
|
14788
|
-
try {
|
14789
|
-
const pkgJsonSchema = await getSchemaFromPackageJson(process.cwd());
|
14790
|
-
if (pkgJsonSchema.ok) {
|
14791
|
-
pkgJsonSchema.schema.schemaPath;
|
14792
|
-
}
|
14793
|
-
return null;
|
14794
|
-
} catch {
|
14795
|
-
return null;
|
14796
|
-
}
|
14797
|
-
}
|
14798
|
-
function getProjectRootEnvPath(opts) {
|
14799
|
-
const pkgJsonPath = findUpSync((dir2) => {
|
14800
|
-
const pkgPath = import_path.default.join(dir2, "package.json");
|
14801
|
-
if (pathExistsSync(pkgPath)) {
|
14802
|
-
try {
|
14803
|
-
const pkg = JSON.parse(import_fs2.default.readFileSync(pkgPath, "utf8"));
|
14804
|
-
if (pkg["name"] !== ".prisma/client") {
|
14805
|
-
debug3(`project root found at ${pkgPath}`);
|
14806
|
-
return pkgPath;
|
14807
|
-
}
|
14808
|
-
} catch (e) {
|
14809
|
-
debug3(`skipping package.json at ${pkgPath}`);
|
14810
|
-
}
|
14811
|
-
}
|
14812
|
-
return void 0;
|
14813
|
-
}, opts);
|
14814
|
-
if (!pkgJsonPath) {
|
14815
|
-
return null;
|
14816
|
-
}
|
14817
|
-
const candidate = import_path.default.join(import_path.default.dirname(pkgJsonPath), ".env");
|
14818
|
-
if (!import_fs2.default.existsSync(candidate)) {
|
14819
|
-
return null;
|
14820
|
-
}
|
14821
|
-
return candidate;
|
14822
|
-
}
|
14823
|
-
function schemaPathToEnvPath(schemaPath2) {
|
14824
|
-
if (!schemaPath2) return null;
|
14825
|
-
return import_path.default.join(import_path.default.dirname(schemaPath2), ".env");
|
14826
|
-
}
|
14827
|
-
async function loadEnvFile({
|
14828
|
-
schemaPath: schemaPath2,
|
14829
|
-
config: config2,
|
14830
|
-
printMessage = false
|
14831
|
-
}) {
|
14832
|
-
if (config2.loadedFromFile) {
|
14833
|
-
process.stdout.write(`Prisma config detected, skipping environment variable loading.
|
14834
|
-
`);
|
14835
|
-
return;
|
14836
|
-
}
|
14837
|
-
const envPaths2 = await getEnvPaths(schemaPath2);
|
14838
|
-
const envData = (0, import_chunk_ZCVVZ6U6.tryLoadEnvs)(envPaths2, { conflictCheck: "error" });
|
14839
|
-
if (printMessage && envData && envData.message) {
|
14840
|
-
process.stdout.write(envData.message + "\n");
|
14841
|
-
}
|
14842
|
-
}
|
14843
|
-
var forbiddenCmdWithDataProxyFlagMessage = (command) => `
|
14844
|
-
Using an Accelerate URL is not supported for this CLI command ${(0, import_chunk_PG5FDKSF.green)(`prisma ${command}`)} yet.
|
14845
|
-
Please use a direct connection to your database via the datasource \`directUrl\` setting.
|
14846
|
-
|
14847
|
-
More information about this limitation: ${(0, import_chunk_FNA4EAZ6.link)("https://pris.ly/d/accelerate-limitations")}
|
14848
|
-
`;
|
14849
|
-
async function checkUnsupportedDataProxyMessage(command, args, schemaPathFromConfig, implicitSchema) {
|
14850
|
-
if (implicitSchema === true) {
|
14851
|
-
args["--schema"] = (await getSchemaWithPath(args["--schema"], schemaPathFromConfig))?.schemaPath ?? void 0;
|
14852
|
-
}
|
14853
|
-
const argList = Object.entries(args);
|
14854
|
-
for (const [argName, argValue] of argList) {
|
14855
|
-
if (argName.includes("url") && argValue.includes("prisma://")) {
|
14856
|
-
return forbiddenCmdWithDataProxyFlagMessage(command);
|
14857
|
-
}
|
14858
|
-
if (argName.includes("schema")) {
|
14859
|
-
await loadEnvFile({ schemaPath: argValue, printMessage: false, config: (0, import_config.defaultTestConfig)() });
|
14860
|
-
const datamodel = await import_fs.default.promises.readFile(argValue, "utf-8");
|
14861
|
-
const config2 = await (0, import_chunk_WD2267J3.getConfig)({ datamodel, ignoreEnvVarErrors: true });
|
14862
|
-
const url = (0, import_chunk_WD2267J3.resolveUrl)((0, import_chunk_WD2267J3.getEffectiveUrl)(config2.datasources[0]));
|
14863
|
-
if (url?.startsWith("prisma://")) {
|
14864
|
-
return forbiddenCmdWithDataProxyFlagMessage(command);
|
14865
|
-
}
|
14866
|
-
}
|
14867
|
-
}
|
14868
|
-
return void 0;
|
14869
|
-
}
|
14870
|
-
async function checkUnsupportedDataProxy(command, args, schemaPathFromConfig, implicitSchema) {
|
14871
|
-
const message = await checkUnsupportedDataProxyMessage(command, args, schemaPathFromConfig, implicitSchema).catch(
|
14872
|
-
() => void 0
|
14873
|
-
);
|
14874
|
-
if (message) throw new Error(message);
|
14875
|
-
}
|
14876
14750
|
async function getProjectHash(schemaPathFromArgs, schemaPathFromConfig) {
|
14877
14751
|
const projectPath = (await getSchemaWithPath(schemaPathFromArgs, schemaPathFromConfig))?.schemaPath ?? process.cwd();
|
14878
14752
|
return import_crypto.default.createHash("sha256").update(projectPath).digest("hex").substring(0, 8);
|
@@ -14885,47 +14759,56 @@ async function loadSchemaContext({
|
|
14885
14759
|
schemaPathFromArg,
|
14886
14760
|
schemaPathFromConfig,
|
14887
14761
|
printLoadMessage = true,
|
14888
|
-
|
14889
|
-
|
14890
|
-
|
14762
|
+
ignoreEnvVarErrors = false,
|
14763
|
+
allowNull = false,
|
14764
|
+
schemaPathArgumentName = "--schema"
|
14765
|
+
} = {}) {
|
14766
|
+
let schemaResult = null;
|
14891
14767
|
if (allowNull) {
|
14892
|
-
|
14893
|
-
|
14768
|
+
schemaResult = await getSchemaWithPathOptional(schemaPathFromArg, schemaPathFromConfig, {
|
14769
|
+
argumentName: schemaPathArgumentName
|
14770
|
+
});
|
14771
|
+
if (!schemaResult) return null;
|
14894
14772
|
} else {
|
14895
|
-
|
14773
|
+
schemaResult = await getSchemaWithPath(schemaPathFromArg, schemaPathFromConfig, {
|
14774
|
+
argumentName: schemaPathArgumentName
|
14775
|
+
});
|
14896
14776
|
}
|
14897
|
-
return processSchemaResult({ schemaResult
|
14777
|
+
return processSchemaResult({ schemaResult, printLoadMessage, ignoreEnvVarErrors });
|
14898
14778
|
}
|
14899
14779
|
async function processSchemaResult({
|
14900
|
-
schemaResult
|
14901
|
-
printLoadMessage
|
14780
|
+
schemaResult,
|
14781
|
+
printLoadMessage = true,
|
14782
|
+
ignoreEnvVarErrors = false
|
14902
14783
|
}) {
|
14903
14784
|
const cwd = process.cwd();
|
14904
|
-
const loadedFromPathForLogMessages =
|
14785
|
+
const loadedFromPathForLogMessages = import_path2.default.relative(cwd, schemaResult.schemaPath);
|
14905
14786
|
if (printLoadMessage) {
|
14906
14787
|
process.stdout.write((0, import_chunk_PG5FDKSF.dim)(`Prisma schema loaded from ${loadedFromPathForLogMessages}`) + "\n");
|
14907
14788
|
}
|
14908
|
-
const configFromPsl = await (0,
|
14789
|
+
const configFromPsl = await (0, import_chunk_2VT4AM4Y.getConfig)({ datamodel: schemaResult.schemas, ignoreEnvVarErrors });
|
14909
14790
|
const primaryDatasource = configFromPsl.datasources.at(0);
|
14910
14791
|
return {
|
14911
|
-
schemaFiles:
|
14912
|
-
schemaPath:
|
14913
|
-
schemaRootDir:
|
14792
|
+
schemaFiles: schemaResult.schemas,
|
14793
|
+
schemaPath: schemaResult.schemaPath,
|
14794
|
+
schemaRootDir: schemaResult.schemaRootDir || cwd,
|
14795
|
+
datasources: configFromPsl.datasources,
|
14914
14796
|
generators: configFromPsl.generators,
|
14915
14797
|
primaryDatasource,
|
14916
|
-
primaryDatasourceDirectory: primaryDatasourceDirectory(primaryDatasource) ||
|
14798
|
+
primaryDatasourceDirectory: primaryDatasourceDirectory(primaryDatasource) || schemaResult.schemaRootDir || cwd,
|
14799
|
+
warnings: configFromPsl.warnings,
|
14917
14800
|
loadedFromPathForLogMessages
|
14918
14801
|
};
|
14919
14802
|
}
|
14920
14803
|
function primaryDatasourceDirectory(primaryDatasource) {
|
14921
14804
|
const datasourcePath = primaryDatasource?.sourceFilePath;
|
14922
14805
|
if (datasourcePath) {
|
14923
|
-
return
|
14806
|
+
return import_path2.default.dirname(datasourcePath);
|
14924
14807
|
}
|
14925
14808
|
return null;
|
14926
14809
|
}
|
14927
14810
|
var import_p_map = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_KYMYLH7F.require_p_map)());
|
14928
|
-
var debug4 = (0,
|
14811
|
+
var debug4 = (0, import_debug5.default)("prisma:generator");
|
14929
14812
|
async function checkTypeScriptVersion() {
|
14930
14813
|
const minVersion = "4.1.0";
|
14931
14814
|
try {
|
@@ -14933,8 +14816,8 @@ async function checkTypeScriptVersion() {
|
|
14933
14816
|
basedir: process.cwd()
|
14934
14817
|
});
|
14935
14818
|
debug4("typescriptPath", typescriptPath);
|
14936
|
-
const typescriptPkg = typescriptPath &&
|
14937
|
-
if (typescriptPkg &&
|
14819
|
+
const typescriptPkg = typescriptPath && import_path5.default.join(typescriptPath, "package.json");
|
14820
|
+
if (typescriptPkg && import_fs3.default.existsSync(typescriptPkg)) {
|
14938
14821
|
const pjson = (0, import_chunk_2ESYSVXG.__require)(typescriptPkg);
|
14939
14822
|
const currentVersion = pjson.version;
|
14940
14823
|
if ((0, import_chunk_EUTJYQDW.semverLt)(currentVersion, minVersion)) {
|
@@ -14950,7 +14833,7 @@ async function checkTypeScriptVersion() {
|
|
14950
14833
|
} catch (e) {
|
14951
14834
|
}
|
14952
14835
|
}
|
14953
|
-
var debug5 = (0,
|
14836
|
+
var debug5 = (0, import_debug4.default)("prisma:generator");
|
14954
14837
|
async function prismaClientResolver(baseDir, version3) {
|
14955
14838
|
let prismaClientDir = await (0, import_chunk_DGZO4GAJ.findPrismaClientDir)(baseDir);
|
14956
14839
|
debug5("baseDir", baseDir);
|
@@ -14969,7 +14852,7 @@ async function prismaClientResolver(baseDir, version3) {
|
|
14969
14852
|
);
|
14970
14853
|
projectRoot = baseDir;
|
14971
14854
|
}
|
14972
|
-
if (!
|
14855
|
+
if (!import_fs2.default.existsSync(import_path4.default.join(projectRoot, "package.json"))) {
|
14973
14856
|
console.warn(
|
14974
14857
|
(0, import_chunk_PG5FDKSF.yellow)(
|
14975
14858
|
`${warningTag} Prisma could not find a ${(0, import_chunk_PG5FDKSF.bold)("package.json")} file in the inferred project root ${(0, import_chunk_PG5FDKSF.bold)(
|
@@ -14996,7 +14879,7 @@ async function prismaClientResolver(baseDir, version3) {
|
|
14996
14879
|
await (0, import_chunk_ETNCBIDF.runPackageCmd)(projectRoot, "add", `prisma@${version3 ?? "latest"}`, "-D", "--silent");
|
14997
14880
|
}
|
14998
14881
|
await (0, import_chunk_ETNCBIDF.runPackageCmd)(projectRoot, "add", `@prisma/client@${version3 ?? "latest"}`, "--silent");
|
14999
|
-
prismaClientDir = await (0, import_chunk_DGZO4GAJ.findPrismaClientDir)(
|
14882
|
+
prismaClientDir = await (0, import_chunk_DGZO4GAJ.findPrismaClientDir)(import_path4.default.join(".", baseDir));
|
15000
14883
|
if (!prismaClientDir) {
|
15001
14884
|
throw new Error(
|
15002
14885
|
`Could not resolve @prisma/client despite the installation that we just tried.
|
@@ -15020,14 +14903,14 @@ Please try to install it with ${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk
|
|
15020
14903
|
}
|
15021
14904
|
return {
|
15022
14905
|
outputPath: prismaClientDir,
|
15023
|
-
generatorPath:
|
14906
|
+
generatorPath: import_path4.default.resolve(prismaClientDir, "generator-build/index.js"),
|
15024
14907
|
isNode: true
|
15025
14908
|
};
|
15026
14909
|
}
|
15027
14910
|
var generatorResolvers = {
|
15028
14911
|
"prisma-client-js": prismaClientResolver
|
15029
14912
|
};
|
15030
|
-
var debug6 = (0,
|
14913
|
+
var debug6 = (0, import_debug3.default)("prisma:getGenerators");
|
15031
14914
|
async function getGenerators(options) {
|
15032
14915
|
const {
|
15033
14916
|
schemaPath,
|
@@ -15045,21 +14928,14 @@ async function getGenerators(options) {
|
|
15045
14928
|
allowNoModels,
|
15046
14929
|
typedSql
|
15047
14930
|
} = options;
|
15048
|
-
|
15049
|
-
|
14931
|
+
const schemaContext = !options.schemaContext && schemaPath ? await loadSchemaContext({ schemaPathFromArg: schemaPath, ignoreEnvVarErrors: true }) : options.schemaContext;
|
14932
|
+
if (!schemaContext) {
|
14933
|
+
throw new Error(`no schema provided for getGenerators`);
|
15050
14934
|
}
|
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
14935
|
const binaryTarget = await (0, import_get_platform.getBinaryTargetForCurrentPlatform)();
|
15059
14936
|
const queryEngineBinaryType = (0, import_engines.getCliQueryEngineBinaryType)();
|
15060
14937
|
const queryEngineType = (0, import_chunk_RS2R7COT.binaryTypeToEngineType)(queryEngineBinaryType);
|
15061
|
-
|
15062
|
-
if (version && !prismaPath) {
|
14938
|
+
if (version && !binaryPathsOverride?.[queryEngineType]) {
|
15063
14939
|
const potentialPath = eval(`require('path').join(__dirname, '..')`);
|
15064
14940
|
if (!potentialPath.match(import_chunk_M3GBKLGE.vercelPkgPathRegex)) {
|
15065
14941
|
const downloadParams = {
|
@@ -15071,35 +14947,25 @@ async function getGenerators(options) {
|
|
15071
14947
|
version,
|
15072
14948
|
skipDownload
|
15073
14949
|
};
|
15074
|
-
|
15075
|
-
prismaPath = binaryPathsWithEngineType[queryEngineBinaryType][binaryTarget];
|
14950
|
+
await (0, import_fetch_engine.download)(downloadParams);
|
15076
14951
|
}
|
15077
14952
|
}
|
15078
|
-
|
15079
|
-
datamodel: schemas,
|
15080
|
-
datamodelPath: schemaPath,
|
15081
|
-
prismaPath,
|
15082
|
-
ignoreEnvVarErrors: true
|
15083
|
-
});
|
15084
|
-
if (config.datasources.length === 0) {
|
14953
|
+
if (!schemaContext.primaryDatasource) {
|
15085
14954
|
throw new Error(import_chunk_2ZPYYZJB.missingDatasource);
|
15086
14955
|
}
|
15087
|
-
(0, import_chunk_5FJ3MENK.printConfigWarnings)(
|
15088
|
-
const previewFeatures = (0,
|
15089
|
-
const dmmf = await (0,
|
15090
|
-
datamodel:
|
15091
|
-
datamodelPath: schemaPath,
|
15092
|
-
prismaPath,
|
14956
|
+
(0, import_chunk_5FJ3MENK.printConfigWarnings)(schemaContext.warnings);
|
14957
|
+
const previewFeatures = (0, import_chunk_CRVLHWC5.extractPreviewFeatures)(schemaContext.generators);
|
14958
|
+
const dmmf = await (0, import_chunk_VLBKBUPL.getDMMF)({
|
14959
|
+
datamodel: schemaContext.schemaFiles,
|
15093
14960
|
previewFeatures
|
15094
14961
|
});
|
15095
14962
|
if (dmmf.datamodel.models.length === 0 && !allowNoModels) {
|
15096
|
-
if (
|
14963
|
+
if (schemaContext.primaryDatasource.provider === "mongodb") {
|
15097
14964
|
throw new Error(import_chunk_HL5VFJX4.missingModelMessageMongoDB);
|
15098
14965
|
}
|
15099
14966
|
throw new Error(import_chunk_HL5VFJX4.missingModelMessage);
|
15100
14967
|
}
|
15101
|
-
(
|
15102
|
-
const generatorConfigs = filterGenerators(overrideGenerators || config.generators, generatorNames);
|
14968
|
+
const generatorConfigs = filterGenerators(overrideGenerators || schemaContext.generators, generatorNames);
|
15103
14969
|
await validateGenerators(generatorConfigs);
|
15104
14970
|
const runningGenerators = [];
|
15105
14971
|
try {
|
@@ -15108,7 +14974,7 @@ async function getGenerators(options) {
|
|
15108
14974
|
async (generator, index2) => {
|
15109
14975
|
let generatorPath = (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.provider);
|
15110
14976
|
let paths2;
|
15111
|
-
const baseDir =
|
14977
|
+
const baseDir = import_path3.default.dirname(generator.sourceFilePath ?? schemaContext.schemaRootDir);
|
15112
14978
|
const providerValue = (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.provider);
|
15113
14979
|
if (aliases && aliases[providerValue]) {
|
15114
14980
|
generatorPath = aliases[providerValue].generatorPath;
|
@@ -15121,7 +14987,7 @@ async function getGenerators(options) {
|
|
15121
14987
|
await generatorInstance.init();
|
15122
14988
|
if (generator.output) {
|
15123
14989
|
generator.output = {
|
15124
|
-
value:
|
14990
|
+
value: import_path3.default.resolve(baseDir, (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.output)),
|
15125
14991
|
fromEnvVar: null
|
15126
14992
|
};
|
15127
14993
|
generator.isCustomOutput = true;
|
@@ -15147,15 +15013,16 @@ The generator needs to either define the \`defaultOutput\` path in the manifest
|
|
15147
15013
|
fromEnvVar: null
|
15148
15014
|
};
|
15149
15015
|
}
|
15150
|
-
const datamodel = (0,
|
15151
|
-
const envPaths2 = await getEnvPaths(schemaPath, { cwd: generator.output.value });
|
15016
|
+
const datamodel = (0, import_chunk_Q6VZHKYE.mergeSchemas)({ schemas: schemaContext.schemaFiles });
|
15017
|
+
const envPaths2 = await getEnvPaths(schemaContext.schemaPath, { cwd: generator.output.value });
|
15152
15018
|
const options2 = {
|
15153
15019
|
datamodel,
|
15154
|
-
datasources:
|
15020
|
+
datasources: schemaContext.datasources,
|
15155
15021
|
generator,
|
15156
15022
|
dmmf,
|
15157
15023
|
otherGenerators: skipIndex(generatorConfigs, index2),
|
15158
|
-
schemaPath,
|
15024
|
+
schemaPath: schemaContext.schemaPath,
|
15025
|
+
// TODO:(schemaPath) can we get rid of schema path passing here?
|
15159
15026
|
version: version || import_engines.enginesVersion,
|
15160
15027
|
// this version makes no sense anymore and should be ignored
|
15161
15028
|
postinstall,
|
@@ -15230,10 +15097,8 @@ generator gen {
|
|
15230
15097
|
debug6({ generatorBinaryPaths });
|
15231
15098
|
generator.setBinaryPaths(generatorBinaryPaths);
|
15232
15099
|
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],
|
15100
|
+
const customDmmf = await (0, import_chunk_VLBKBUPL.getDMMF)({
|
15101
|
+
datamodel: schemaContext.schemaFiles,
|
15237
15102
|
previewFeatures
|
15238
15103
|
});
|
15239
15104
|
const options2 = { ...generator.options, dmmf: customDmmf };
|
@@ -15361,7 +15226,7 @@ async function sendPanic({
|
|
15361
15226
|
return {
|
15362
15227
|
datasource: {
|
15363
15228
|
tag: "Schema",
|
15364
|
-
...(0,
|
15229
|
+
...(0, import_chunk_OSHZ4P3G.toSchemasContainer)(schema2)
|
15365
15230
|
}
|
15366
15231
|
};
|
15367
15232
|
}).with({ introspectionUrl: import_chunk_XKZ6CBLA.N.not(void 0) }, ({ introspectionUrl }) => {
|
@@ -15429,31 +15294,31 @@ async function makeErrorZip(error) {
|
|
15429
15294
|
if (!error.schemaPath) {
|
15430
15295
|
throw new Error(`Can't make zip without schema path`);
|
15431
15296
|
}
|
15432
|
-
const schemaDir =
|
15297
|
+
const schemaDir = import_path6.default.dirname(error.schemaPath);
|
15433
15298
|
const tmpFileObj = import_tmp.default.fileSync();
|
15434
|
-
const outputFile =
|
15299
|
+
const outputFile = import_fs4.default.createWriteStream(tmpFileObj.name);
|
15435
15300
|
const zip = (0, import_archiver.default)("zip", { zlib: { level: 9 } });
|
15436
15301
|
zip.pipe(outputFile);
|
15437
|
-
const schemaFile = (0, import_chunk_KDHESRKE.maskSchema)(
|
15438
|
-
zip.append(schemaFile, { name:
|
15439
|
-
if (
|
15302
|
+
const schemaFile = (0, import_chunk_KDHESRKE.maskSchema)(import_fs4.default.readFileSync(error.schemaPath, "utf-8"));
|
15303
|
+
zip.append(schemaFile, { name: import_path6.default.basename(error.schemaPath) });
|
15304
|
+
if (import_fs4.default.existsSync(schemaDir)) {
|
15440
15305
|
const filePaths = await (0, import_globby.default)("migrations/**/*", {
|
15441
15306
|
// globby doesn't have it in its types but it's part of mrmlnc/fast-glob
|
15442
15307
|
// @ts-ignore
|
15443
15308
|
cwd: schemaDir
|
15444
15309
|
});
|
15445
15310
|
for (const filePath of filePaths) {
|
15446
|
-
let file =
|
15447
|
-
if (filePath.endsWith("schema.prisma") || filePath.endsWith(
|
15311
|
+
let file = import_fs4.default.readFileSync(import_path6.default.resolve(schemaDir, filePath), "utf-8");
|
15312
|
+
if (filePath.endsWith("schema.prisma") || filePath.endsWith(import_path6.default.basename(error.schemaPath))) {
|
15448
15313
|
file = (0, import_chunk_KDHESRKE.maskSchema)(file);
|
15449
15314
|
}
|
15450
|
-
zip.append(file, { name:
|
15315
|
+
zip.append(file, { name: import_path6.default.basename(filePath) });
|
15451
15316
|
}
|
15452
15317
|
}
|
15453
15318
|
zip.finalize();
|
15454
15319
|
return new Promise((resolve, reject2) => {
|
15455
15320
|
outputFile.on("close", () => {
|
15456
|
-
const buffer =
|
15321
|
+
const buffer = import_fs4.default.readFileSync(tmpFileObj.name);
|
15457
15322
|
resolve(buffer);
|
15458
15323
|
});
|
15459
15324
|
zip.on("error", (err) => {
|
@@ -15461,6 +15326,144 @@ async function makeErrorZip(error) {
|
|
15461
15326
|
});
|
15462
15327
|
});
|
15463
15328
|
}
|
15329
|
+
var typeMappings = {
|
15330
|
+
directory: "isDirectory",
|
15331
|
+
file: "isFile"
|
15332
|
+
};
|
15333
|
+
function checkType(type) {
|
15334
|
+
if (Object.hasOwnProperty.call(typeMappings, type)) {
|
15335
|
+
return;
|
15336
|
+
}
|
15337
|
+
throw new Error(`Invalid type specified: ${type}`);
|
15338
|
+
}
|
15339
|
+
var matchType = (type, stat2) => stat2[typeMappings[type]]();
|
15340
|
+
var toPath2 = (urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url.fileURLToPath)(urlOrPath) : urlOrPath;
|
15341
|
+
function locatePathSync(paths2, {
|
15342
|
+
cwd = import_node_process.default.cwd(),
|
15343
|
+
type = "file",
|
15344
|
+
allowSymlinks = true
|
15345
|
+
} = {}) {
|
15346
|
+
checkType(type);
|
15347
|
+
cwd = toPath2(cwd);
|
15348
|
+
const statFunction = allowSymlinks ? import_node_fs.default.statSync : import_node_fs.default.lstatSync;
|
15349
|
+
for (const path_ of paths2) {
|
15350
|
+
try {
|
15351
|
+
const stat2 = statFunction(import_node_path2.default.resolve(cwd, path_), {
|
15352
|
+
throwIfNoEntry: false
|
15353
|
+
});
|
15354
|
+
if (!stat2) {
|
15355
|
+
continue;
|
15356
|
+
}
|
15357
|
+
if (matchType(type, stat2)) {
|
15358
|
+
return path_;
|
15359
|
+
}
|
15360
|
+
} catch {
|
15361
|
+
}
|
15362
|
+
}
|
15363
|
+
}
|
15364
|
+
function pathExistsSync(path11) {
|
15365
|
+
try {
|
15366
|
+
import_node_fs2.default.accessSync(path11);
|
15367
|
+
return true;
|
15368
|
+
} catch {
|
15369
|
+
return false;
|
15370
|
+
}
|
15371
|
+
}
|
15372
|
+
var findUpStop = Symbol("findUpStop");
|
15373
|
+
function findUpMultipleSync(name, options2 = {}) {
|
15374
|
+
let directory = import_node_path.default.resolve((0, import_chunk_KYMYLH7F.toPath)(options2.cwd) ?? "");
|
15375
|
+
const { root } = import_node_path.default.parse(directory);
|
15376
|
+
const stopAt = import_node_path.default.resolve(directory, (0, import_chunk_KYMYLH7F.toPath)(options2.stopAt) ?? root);
|
15377
|
+
const limit = options2.limit ?? Number.POSITIVE_INFINITY;
|
15378
|
+
const paths2 = [name].flat();
|
15379
|
+
const runMatcher = (locateOptions) => {
|
15380
|
+
if (typeof name !== "function") {
|
15381
|
+
return locatePathSync(paths2, locateOptions);
|
15382
|
+
}
|
15383
|
+
const foundPath = name(locateOptions.cwd);
|
15384
|
+
if (typeof foundPath === "string") {
|
15385
|
+
return locatePathSync([foundPath], locateOptions);
|
15386
|
+
}
|
15387
|
+
return foundPath;
|
15388
|
+
};
|
15389
|
+
const matches = [];
|
15390
|
+
while (true) {
|
15391
|
+
const foundPath = runMatcher({ ...options2, cwd: directory });
|
15392
|
+
if (foundPath === findUpStop) {
|
15393
|
+
break;
|
15394
|
+
}
|
15395
|
+
if (foundPath) {
|
15396
|
+
matches.push(import_node_path.default.resolve(directory, foundPath));
|
15397
|
+
}
|
15398
|
+
if (directory === stopAt || matches.length >= limit) {
|
15399
|
+
break;
|
15400
|
+
}
|
15401
|
+
directory = import_node_path.default.dirname(directory);
|
15402
|
+
}
|
15403
|
+
return matches;
|
15404
|
+
}
|
15405
|
+
function findUpSync(name, options2 = {}) {
|
15406
|
+
const matches = findUpMultipleSync(name, { ...options2, limit: 1 });
|
15407
|
+
return matches[0];
|
15408
|
+
}
|
15409
|
+
var debug7 = (0, import_debug6.default)("prisma:loadEnv");
|
15410
|
+
async function getEnvPaths(schemaPath2, opts = { cwd: process.cwd() }) {
|
15411
|
+
const rootEnvPath = getProjectRootEnvPath({ cwd: opts.cwd }) ?? null;
|
15412
|
+
const schemaEnvPathFromArgs = schemaPathToEnvPath(schemaPath2);
|
15413
|
+
const schemaEnvPathFromPkgJson = schemaPathToEnvPath(await readSchemaPathFromPkgJson());
|
15414
|
+
const schemaEnvPaths = [
|
15415
|
+
schemaEnvPathFromArgs,
|
15416
|
+
// 1 - Check --schema directory for .env
|
15417
|
+
schemaEnvPathFromPkgJson,
|
15418
|
+
// 2 - Check package.json schema directory for .env
|
15419
|
+
"./prisma/.env",
|
15420
|
+
// 3 - Check ./prisma directory for .env
|
15421
|
+
"./.env"
|
15422
|
+
// 4 - Check cwd for .env
|
15423
|
+
];
|
15424
|
+
const schemaEnvPath = schemaEnvPaths.find(import_chunk_ZCVVZ6U6.exists);
|
15425
|
+
return { rootEnvPath, schemaEnvPath };
|
15426
|
+
}
|
15427
|
+
async function readSchemaPathFromPkgJson() {
|
15428
|
+
try {
|
15429
|
+
const pkgJsonSchema = await getSchemaFromPackageJson(process.cwd());
|
15430
|
+
if (pkgJsonSchema.ok) {
|
15431
|
+
pkgJsonSchema.schema.schemaPath;
|
15432
|
+
}
|
15433
|
+
return null;
|
15434
|
+
} catch {
|
15435
|
+
return null;
|
15436
|
+
}
|
15437
|
+
}
|
15438
|
+
function getProjectRootEnvPath(opts) {
|
15439
|
+
const pkgJsonPath = findUpSync((dir2) => {
|
15440
|
+
const pkgPath = import_path7.default.join(dir2, "package.json");
|
15441
|
+
if (pathExistsSync(pkgPath)) {
|
15442
|
+
try {
|
15443
|
+
const pkg = JSON.parse(import_fs5.default.readFileSync(pkgPath, "utf8"));
|
15444
|
+
if (pkg["name"] !== ".prisma/client") {
|
15445
|
+
debug7(`project root found at ${pkgPath}`);
|
15446
|
+
return pkgPath;
|
15447
|
+
}
|
15448
|
+
} catch (e) {
|
15449
|
+
debug7(`skipping package.json at ${pkgPath}`);
|
15450
|
+
}
|
15451
|
+
}
|
15452
|
+
return void 0;
|
15453
|
+
}, opts);
|
15454
|
+
if (!pkgJsonPath) {
|
15455
|
+
return null;
|
15456
|
+
}
|
15457
|
+
const candidate = import_path7.default.join(import_path7.default.dirname(pkgJsonPath), ".env");
|
15458
|
+
if (!import_fs5.default.existsSync(candidate)) {
|
15459
|
+
return null;
|
15460
|
+
}
|
15461
|
+
return candidate;
|
15462
|
+
}
|
15463
|
+
function schemaPathToEnvPath(schemaPath2) {
|
15464
|
+
if (!schemaPath2) return null;
|
15465
|
+
return import_path7.default.join(import_path7.default.dirname(schemaPath2), ".env");
|
15466
|
+
}
|
15464
15467
|
async function handlePanic(args) {
|
15465
15468
|
if (!(0, import_chunk_R3J2O23S.canPrompt)()) {
|
15466
15469
|
throw args.error;
|
@@ -15523,68 +15526,43 @@ ${(0, import_chunk_PG5FDKSF.bold)("Thanks a lot for your help! \u{1F64F}")}`);
|
|
15523
15526
|
});
|
15524
15527
|
process.exit(1);
|
15525
15528
|
}
|
15526
|
-
|
15527
|
-
|
15528
|
-
|
15529
|
-
|
15530
|
-
|
15531
|
-
|
15532
|
-
|
15533
|
-
|
15534
|
-
|
15529
|
+
async function loadEnvFile({
|
15530
|
+
schemaPath: schemaPath2,
|
15531
|
+
config,
|
15532
|
+
printMessage = false
|
15533
|
+
}) {
|
15534
|
+
if (config.loadedFromFile) {
|
15535
|
+
process.stdout.write(`Prisma config detected, skipping environment variable loading.
|
15536
|
+
`);
|
15537
|
+
return;
|
15535
15538
|
}
|
15536
|
-
const
|
15537
|
-
|
15538
|
-
|
15539
|
-
|
15540
|
-
const documentFormattingParams = {
|
15541
|
-
textDocument: { uri: "file:/dev/null" },
|
15542
|
-
options: {
|
15543
|
-
...defaultFormattingOptions,
|
15544
|
-
...inputFormattingOptions
|
15545
|
-
}
|
15546
|
-
};
|
15547
|
-
const { formattedMultipleSchemas, lintDiagnostics } = handleFormatPanic(
|
15548
|
-
() => {
|
15549
|
-
const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(schemas2), documentFormattingParams);
|
15550
|
-
const formattedMultipleSchemas2 = JSON.parse(formattedMultipleSchemasRaw);
|
15551
|
-
const lintDiagnostics2 = (0, import_chunk_7CMXNYMQ.lintSchema)({ schemas: formattedMultipleSchemas2 });
|
15552
|
-
return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
|
15553
|
-
},
|
15554
|
-
{ schemas: schemas2 }
|
15555
|
-
);
|
15556
|
-
const lintWarnings = (0, import_chunk_7CMXNYMQ.getLintWarningsAsText)(lintDiagnostics);
|
15557
|
-
if (lintWarnings && import_chunk_MBB2KJWX.logger_exports.should.warn()) {
|
15558
|
-
console.warn(lintWarnings);
|
15539
|
+
const envPaths2 = await getEnvPaths(schemaPath2);
|
15540
|
+
const envData = (0, import_chunk_ZCVVZ6U6.tryLoadEnvs)(envPaths2, { conflictCheck: "error" });
|
15541
|
+
if (printMessage && envData && envData.message) {
|
15542
|
+
process.stdout.write(envData.message + "\n");
|
15559
15543
|
}
|
15560
|
-
return Promise.resolve(formattedMultipleSchemas);
|
15561
15544
|
}
|
15562
|
-
|
15563
|
-
|
15564
|
-
|
15565
|
-
|
15566
|
-
|
15567
|
-
|
15568
|
-
|
15569
|
-
|
15570
|
-
|
15571
|
-
|
15572
|
-
|
15573
|
-
|
15574
|
-
|
15575
|
-
|
15576
|
-
|
15577
|
-
|
15578
|
-
|
15579
|
-
|
15580
|
-
|
15581
|
-
);
|
15582
|
-
throw panic;
|
15545
|
+
var forbiddenCmdWithDataProxyFlagMessage = (command) => `
|
15546
|
+
Using an Accelerate URL is not supported for this CLI command ${(0, import_chunk_PG5FDKSF.green)(`prisma ${command}`)} yet.
|
15547
|
+
Please use a direct connection to your database via the datasource \`directUrl\` setting.
|
15548
|
+
|
15549
|
+
More information about this limitation: ${(0, import_chunk_FNA4EAZ6.link)("https://pris.ly/d/accelerate-limitations")}
|
15550
|
+
`;
|
15551
|
+
function checkUnsupportedDataProxy({
|
15552
|
+
cmd,
|
15553
|
+
schemaContext: schemaContext2 = void 0,
|
15554
|
+
urls = []
|
15555
|
+
}) {
|
15556
|
+
for (const url2 of urls) {
|
15557
|
+
if (url2 && url2.includes("prisma://")) {
|
15558
|
+
throw new Error(forbiddenCmdWithDataProxyFlagMessage(cmd));
|
15559
|
+
}
|
15560
|
+
}
|
15561
|
+
if (!schemaContext2?.primaryDatasource) return;
|
15562
|
+
const url = (0, import_chunk_2VT4AM4Y.resolveUrl)((0, import_chunk_2VT4AM4Y.getEffectiveUrl)(schemaContext2.primaryDatasource));
|
15563
|
+
if (url?.startsWith("prisma://")) {
|
15564
|
+
throw new Error(forbiddenCmdWithDataProxyFlagMessage(cmd));
|
15583
15565
|
}
|
15584
|
-
}
|
15585
|
-
function formatWasm(schema, documentFormattingParams) {
|
15586
|
-
const formattedSchema = import_chunk_R7U45FIQ.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
|
15587
|
-
return formattedSchema;
|
15588
15566
|
}
|
15589
15567
|
/*! Bundled license information:
|
15590
15568
|
|