@prisma/internals 6.6.0-dev.35 → 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.
Files changed (40) hide show
  1. package/dist/{chunk-DJYSR6QD.js → chunk-5II75LYF.js} +8 -8
  2. package/dist/{chunk-OQZDUJAJ.js → chunk-5MWCIDUY.js} +5 -5
  3. package/dist/{chunk-NZDLSDLM.js → chunk-EV7SJDE5.js} +5 -5
  4. package/dist/{chunk-VEWDTOV5.js → chunk-GH3DD2OM.js} +8 -8
  5. package/dist/{chunk-WCWE5A2C.js → chunk-OSAQY3IQ.js} +4 -4
  6. package/dist/{chunk-JHQHVXIR.js → chunk-OSHZ4P3G.js} +6 -7
  7. package/dist/{chunk-GNK3AD6X.js → chunk-RQK5KO77.js} +7 -7
  8. package/dist/{chunk-LR3WWKZI.js → chunk-UVLDTPOI.js} +5 -5
  9. package/dist/{chunk-O3MUXTZX.js → chunk-VYFTEDQQ.js} +347 -355
  10. package/dist/{chunk-PEB6D6GV.js → chunk-WSCZQCHP.js} +337 -345
  11. package/dist/{chunk-OKJT45NT.js → chunk-WUO3S6J2.js} +8 -8
  12. package/dist/{chunk-2WQVHYBS.js → chunk-YYIAYJ4W.js} +5 -5
  13. package/dist/cli/checkUnsupportedDataProxy.d.ts +12 -17
  14. package/dist/cli/checkUnsupportedDataProxy.js +13 -13
  15. package/dist/cli/getSchema.js +17 -17
  16. package/dist/cli/hashes.js +13 -13
  17. package/dist/cli/schemaContext.d.ts +1 -0
  18. package/dist/cli/schemaContext.js +13 -13
  19. package/dist/engine-commands/errorHelpers.js +4 -4
  20. package/dist/engine-commands/formatSchema.js +12 -12
  21. package/dist/engine-commands/getConfig.js +10 -10
  22. package/dist/engine-commands/getDmmf.js +7 -7
  23. package/dist/engine-commands/index.js +21 -21
  24. package/dist/engine-commands/lintSchema.js +8 -8
  25. package/dist/engine-commands/mergeSchemas.js +7 -7
  26. package/dist/engine-commands/validate.js +7 -7
  27. package/dist/get-generators/generatorResolvers/generatorResolvers.js +12 -12
  28. package/dist/get-generators/generatorResolvers/prisma-client-js/check-dependencies/checkTypeScriptVersion.js +12 -12
  29. package/dist/get-generators/generatorResolvers/prisma-client-js/prismaClientResolver.js +13 -13
  30. package/dist/get-generators/getGenerators.js +15 -15
  31. package/dist/index.js +44 -44
  32. package/dist/sendPanic.js +12 -12
  33. package/dist/utils/getEnvPaths.js +12 -12
  34. package/dist/utils/getVersionFromPackageJson.js +3 -3
  35. package/dist/utils/handlePanic.js +12 -12
  36. package/dist/utils/loadEnvFile.js +12 -12
  37. package/dist/utils/toSchemasContainer.d.ts +2 -3
  38. package/dist/utils/toSchemasContainer.js +3 -4
  39. package/dist/wasm.js +4 -4
  40. package/package.json +8 -8
@@ -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 chunk_O3MUXTZX_exports = {};
30
- __export2(chunk_O3MUXTZX_exports, {
29
+ var chunk_VYFTEDQQ_exports = {};
30
+ __export2(chunk_VYFTEDQQ_exports, {
31
31
  checkTypeScriptVersion: () => checkTypeScriptVersion,
32
32
  checkUnsupportedDataProxy: () => checkUnsupportedDataProxy,
33
33
  debug: () => debug5,
@@ -56,7 +56,7 @@ __export2(chunk_O3MUXTZX_exports, {
56
56
  sendPanic: () => sendPanic,
57
57
  skipIndex: () => skipIndex
58
58
  });
59
- module.exports = __toCommonJS2(chunk_O3MUXTZX_exports);
59
+ module.exports = __toCommonJS2(chunk_VYFTEDQQ_exports);
60
60
  var import_chunk_GHHABGYW = require("./chunk-GHHABGYW.js");
61
61
  var import_chunk_EUTJYQDW = require("./chunk-EUTJYQDW.js");
62
62
  var import_chunk_DGZO4GAJ = require("./chunk-DGZO4GAJ.js");
@@ -67,7 +67,7 @@ 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 import_chunk_JHQHVXIR = require("./chunk-JHQHVXIR.js");
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");
@@ -79,13 +79,13 @@ 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
81
  var import_chunk_CRVLHWC5 = require("./chunk-CRVLHWC5.js");
82
- var import_chunk_NZDLSDLM = require("./chunk-NZDLSDLM.js");
83
- var import_chunk_GNK3AD6X = require("./chunk-GNK3AD6X.js");
84
- var import_chunk_DJYSR6QD = require("./chunk-DJYSR6QD.js");
85
- var import_chunk_OKJT45NT = require("./chunk-OKJT45NT.js");
82
+ var import_chunk_EV7SJDE5 = require("./chunk-EV7SJDE5.js");
83
+ var import_chunk_RQK5KO77 = require("./chunk-RQK5KO77.js");
84
+ var import_chunk_5II75LYF = require("./chunk-5II75LYF.js");
85
+ var import_chunk_WUO3S6J2 = require("./chunk-WUO3S6J2.js");
86
86
  var import_chunk_YRBRUREX = require("./chunk-YRBRUREX.js");
87
87
  var import_chunk_XKZ6CBLA = require("./chunk-XKZ6CBLA.js");
88
- var import_chunk_LR3WWKZI = require("./chunk-LR3WWKZI.js");
88
+ var import_chunk_UVLDTPOI = require("./chunk-UVLDTPOI.js");
89
89
  var import_chunk_CCQRDM7X = require("./chunk-CCQRDM7X.js");
90
90
  var import_chunk_2B26F5N3 = require("./chunk-2B26F5N3.js");
91
91
  var import_chunk_RAYPCPVU = require("./chunk-RAYPCPVU.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 = __toESM2(require("@prisma/debug"));
103
- var import_config = require("@prisma/config");
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 import_path3 = __toESM2(require("path"));
121
- var import_debug4 = __toESM2(require("@prisma/debug"));
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 import_fs4 = __toESM2(require("fs"));
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 import_fs6 = __toESM2(require("fs"));
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 fs10 = (0, import_chunk_2ESYSVXG.__require)("fs");
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
- fs10.readdir(dir2, { withFileTypes: true }, (err, files) => {
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 ? fs10.stat : fs10.lstat;
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 fs10 = (0, import_chunk_RAYPCPVU.require_graceful_fs)();
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 fs10.existsSync(filepath);
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 fs10.statSync(filepath)[options2.filter]();
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 fs10 = (0, import_chunk_RAYPCPVU.require_graceful_fs)();
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 fs10.createReadStream(filepath);
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
- fs10.readdir(dirpath, function(err, list) {
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
- fs10.stat(filepath, function(err2, stats) {
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 fs10 = (0, import_chunk_2ESYSVXG.__require)("fs");
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 fs10.Stats) {
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
- fs10.lstat(task.filepath, function(err, stats) {
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 = fs10.readlinkSync(task.filepath);
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));
@@ -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 fs10 = (0, import_chunk_2ESYSVXG.__require)("fs");
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: fs10.constants, os: os3.constants };
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 = fs10.rmdirSync.bind(fs10);
14121
+ var FN_RMDIR_SYNC = fs9.rmdirSync.bind(fs9);
14124
14122
  var _gracefulCleanup = false;
14125
14123
  function rimraf(dirPath, callback) {
14126
- return fs10.rm(dirPath, { recursive: true }, callback);
14124
+ return fs9.rm(dirPath, { recursive: true }, callback);
14127
14125
  }
14128
14126
  function FN_RIMRAF_SYNC(dirPath) {
14129
- return fs10.rmSync(dirPath, { recursive: true });
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
- fs10.stat(name, function(err) {
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
- fs10.statSync(name);
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
- fs10.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err2, fd) {
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 fs10.close(fd, function _discardCallback(possibleErr) {
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 = fs10.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
14187
+ var fd = fs9.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);
14190
14188
  if (opts.discardDescriptor) {
14191
- fs10.closeSync(fd);
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
- fs10.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err2) {
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
- fs10.mkdirSync(name, opts.mode || DIR_MODE);
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
- fs10.close(fdPath[0], function() {
14228
- fs10.unlink(fdPath[1], _handler);
14225
+ fs9.close(fdPath[0], function() {
14226
+ fs9.unlink(fdPath[1], _handler);
14229
14227
  });
14230
- else fs10.unlink(fdPath[1], _handler);
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]) fs10.closeSync(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
- fs10.unlinkSync(fdPath[1]);
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 : fs10.rmdir.bind(fs10);
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 typeMappings = {
14418
- directory: "isDirectory",
14419
- file: "isFile"
14420
- };
14421
- function checkType(type) {
14422
- if (Object.hasOwnProperty.call(typeMappings, type)) {
14423
- return;
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_UVLDTPOI.prismaSchemaWasm.debug_panic();
14421
+ },
14422
+ { schemas }
14423
+ );
14424
14424
  }
14425
- throw new Error(`Invalid type specified: ${type}`);
14426
- }
14427
- var matchType = (type, stat2) => stat2[typeMappings[type]]();
14428
- var toPath2 = (urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url.fileURLToPath)(urlOrPath) : urlOrPath;
14429
- function locatePathSync(paths2, {
14430
- cwd = import_node_process.default.cwd(),
14431
- type = "file",
14432
- allowSymlinks = true
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_EV7SJDE5.lintSchema)({ schemas: formattedMultipleSchemas2 });
14441
+ return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
14442
+ },
14443
+ { schemas }
14444
+ );
14445
+ const lintWarnings = (0, import_chunk_EV7SJDE5.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 pathExistsSync(path11) {
14451
+ function handleFormatPanic(tryCb, { schemas }) {
14453
14452
  try {
14454
- import_node_fs2.default.accessSync(path11);
14455
- return true;
14456
- } catch {
14457
- return false;
14458
- }
14459
- }
14460
- var findUpStop = Symbol("findUpStop");
14461
- function findUpMultipleSync(name, options2 = {}) {
14462
- let directory = import_node_path.default.resolve((0, import_chunk_KYMYLH7F.toPath)(options2.cwd) ?? "");
14463
- const { root } = import_node_path.default.parse(directory);
14464
- const stopAt = import_node_path.default.resolve(directory, (0, import_chunk_KYMYLH7F.toPath)(options2.stopAt) ?? root);
14465
- const limit = options2.limit ?? Number.POSITIVE_INFINITY;
14466
- const paths2 = [name].flat();
14467
- const runMatcher = (locateOptions) => {
14468
- if (typeof name !== "function") {
14469
- return locatePathSync(paths2, locateOptions);
14470
- }
14471
- const foundPath = name(locateOptions.cwd);
14472
- if (typeof foundPath === "string") {
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 findUpSync(name, options2 = {}) {
14494
- const matches = findUpMultipleSync(name, { ...options2, limit: 1 });
14495
- return matches[0];
14474
+ function formatWasm(schema, documentFormattingParams) {
14475
+ const formattedSchema = import_chunk_UVLDTPOI.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
14476
+ return formattedSchema;
14496
14477
  }
14497
- var readFile = (0, import_util.promisify)(import_fs3.default.readFile);
14498
- var stat = (0, import_util.promisify)(import_fs3.default.stat);
14499
- var debug2 = (0, import_debug3.Debug)("prisma:getSchema");
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
- debug2("Reading schema from single file", schemaPath2);
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,22 +14502,22 @@ async function readSchemaFromSingleFile(schemaPath2) {
14521
14502
  const schemaTuple = [schemaPath2, file];
14522
14503
  return {
14523
14504
  ok: true,
14524
- schema: { schemaPath: schemaPath2, schemaRootDir: import_path2.default.dirname(schemaPath2), schemas: [schemaTuple] }
14505
+ schema: { schemaPath: schemaPath2, schemaRootDir: import_path.default.dirname(schemaPath2), schemas: [schemaTuple] }
14525
14506
  };
14526
14507
  }
14527
14508
  async function readSchemaFromDirectory(schemaPath2) {
14528
- debug2("Reading schema from multiple files", schemaPath2);
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
- debug2("Loading config");
14535
- const config = await (0, import_chunk_DJYSR6QD.getConfig)({
14515
+ debug3("Loading config");
14516
+ const config = await (0, import_chunk_5II75LYF.getConfig)({
14536
14517
  datamodel: files,
14537
14518
  ignoreEnvVarErrors: true
14538
14519
  });
14539
- debug2("Ok");
14520
+ debug3("Ok");
14540
14521
  if (!(0, import_schema_files_loader.usesPrismaSchemaFolder)(config)) {
14541
14522
  return { ok: false, error: { kind: "FolderPreviewNotEnabled", path: schemaPath2 } };
14542
14523
  }
@@ -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 = import_path2.default.resolve(cwd, schemaPathFromArgs);
14546
+ const absPath = import_path.default.resolve(cwd, schemaPathFromArgs);
14566
14547
  const customSchemaResult = await readSchemaFromFileOrDirectory(absPath);
14567
14548
  if (!customSchemaResult.ok) {
14568
- const relPath = import_path2.default.relative(cwd, absPath);
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(`${import_path2.default.relative(cwd, filePath)}: ${renderLookupError(failure.error)}`);
14599
+ parts.push(`${import_path.default.relative(cwd, filePath)}: ${renderLookupError(failure.error)}`);
14619
14600
  printedPaths.add(filePath);
14620
14601
  }
14621
14602
  }
@@ -14660,27 +14641,27 @@ async function readSchemaFromPrismaConfigBasedLocation(schemaPathFromConfig) {
14660
14641
  }
14661
14642
  async function getSchemaFromPackageJson(cwd) {
14662
14643
  const prismaConfig = await getPrismaConfigFromPackageJson(cwd);
14663
- debug2("prismaConfig", prismaConfig);
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 \`${import_path2.default.relative(
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 = import_path2.default.isAbsolute(schemaPathFromPkgJson) ? schemaPathFromPkgJson : import_path2.default.resolve(import_path2.default.dirname(prismaConfig.packagePath), schemaPathFromPkgJson);
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 \`${import_path2.default.relative(
14661
+ `Could not load schema from \`${import_path.default.relative(
14681
14662
  cwd,
14682
14663
  absoluteSchemaPath
14683
- )}\` provided by "prisma.schema" config of \`${import_path2.default.relative(
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: import_path2.default.join(cwd, "schema.prisma"),
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: import_path2.default.join(cwd, "prisma", "schema.prisma"),
14681
+ path: import_path.default.join(cwd, "prisma", "schema.prisma"),
14701
14682
  kind: "file"
14702
14683
  },
14703
14684
  conflictsWith: {
14704
- path: import_path2.default.join(cwd, "prisma", "schema"),
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: import_path2.default.join(cwd, "prisma", "schema"),
14691
+ path: import_path.default.join(cwd, "prisma", "schema"),
14711
14692
  kind: "directory"
14712
14693
  },
14713
14694
  conflictsWith: {
14714
- path: import_path2.default.join(cwd, "prisma", "schema.prisma"),
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
- debug2(`Checking existence of ${rule.schemaPath.path}`);
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 \`${import_path2.default.relative(cwd, rule.schemaPath.path)}\` and \`${import_path2.default.relative(
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 import_path2.default.resolve(import_path2.default.dirname(schemaPathFromArgs));
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 import_path2.default.dirname(schemaPathResult.schemaPath);
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,
14830
- printMessage = false
14831
- }) {
14832
- if (config.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 config = await (0, import_chunk_DJYSR6QD.getConfig)({ datamodel, ignoreEnvVarErrors: true });
14862
- const url = (0, import_chunk_DJYSR6QD.resolveUrl)((0, import_chunk_DJYSR6QD.getEffectiveUrl)(config.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);
@@ -14886,14 +14760,19 @@ async function loadSchemaContext({
14886
14760
  schemaPathFromConfig,
14887
14761
  printLoadMessage = true,
14888
14762
  ignoreEnvVarErrors = false,
14889
- allowNull = false
14763
+ allowNull = false,
14764
+ schemaPathArgumentName = "--schema"
14890
14765
  } = {}) {
14891
14766
  let schemaResult = null;
14892
14767
  if (allowNull) {
14893
- schemaResult = await getSchemaWithPathOptional(schemaPathFromArg, schemaPathFromConfig);
14768
+ schemaResult = await getSchemaWithPathOptional(schemaPathFromArg, schemaPathFromConfig, {
14769
+ argumentName: schemaPathArgumentName
14770
+ });
14894
14771
  if (!schemaResult) return null;
14895
14772
  } else {
14896
- schemaResult = await getSchemaWithPath(schemaPathFromArg, schemaPathFromConfig);
14773
+ schemaResult = await getSchemaWithPath(schemaPathFromArg, schemaPathFromConfig, {
14774
+ argumentName: schemaPathArgumentName
14775
+ });
14897
14776
  }
14898
14777
  return processSchemaResult({ schemaResult, printLoadMessage, ignoreEnvVarErrors });
14899
14778
  }
@@ -14903,11 +14782,11 @@ async function processSchemaResult({
14903
14782
  ignoreEnvVarErrors = false
14904
14783
  }) {
14905
14784
  const cwd = process.cwd();
14906
- const loadedFromPathForLogMessages = import_path3.default.relative(cwd, schemaResult.schemaPath);
14785
+ const loadedFromPathForLogMessages = import_path2.default.relative(cwd, schemaResult.schemaPath);
14907
14786
  if (printLoadMessage) {
14908
14787
  process.stdout.write((0, import_chunk_PG5FDKSF.dim)(`Prisma schema loaded from ${loadedFromPathForLogMessages}`) + "\n");
14909
14788
  }
14910
- const configFromPsl = await (0, import_chunk_DJYSR6QD.getConfig)({ datamodel: schemaResult.schemas, ignoreEnvVarErrors });
14789
+ const configFromPsl = await (0, import_chunk_5II75LYF.getConfig)({ datamodel: schemaResult.schemas, ignoreEnvVarErrors });
14911
14790
  const primaryDatasource = configFromPsl.datasources.at(0);
14912
14791
  return {
14913
14792
  schemaFiles: schemaResult.schemas,
@@ -14924,12 +14803,12 @@ async function processSchemaResult({
14924
14803
  function primaryDatasourceDirectory(primaryDatasource) {
14925
14804
  const datasourcePath = primaryDatasource?.sourceFilePath;
14926
14805
  if (datasourcePath) {
14927
- return import_path3.default.dirname(datasourcePath);
14806
+ return import_path2.default.dirname(datasourcePath);
14928
14807
  }
14929
14808
  return null;
14930
14809
  }
14931
14810
  var import_p_map = (0, import_chunk_2ESYSVXG.__toESM)((0, import_chunk_KYMYLH7F.require_p_map)());
14932
- var debug4 = (0, import_debug6.default)("prisma:generator");
14811
+ var debug4 = (0, import_debug5.default)("prisma:generator");
14933
14812
  async function checkTypeScriptVersion() {
14934
14813
  const minVersion = "4.1.0";
14935
14814
  try {
@@ -14937,8 +14816,8 @@ async function checkTypeScriptVersion() {
14937
14816
  basedir: process.cwd()
14938
14817
  });
14939
14818
  debug4("typescriptPath", typescriptPath);
14940
- const typescriptPkg = typescriptPath && import_path6.default.join(typescriptPath, "package.json");
14941
- if (typescriptPkg && import_fs5.default.existsSync(typescriptPkg)) {
14819
+ const typescriptPkg = typescriptPath && import_path5.default.join(typescriptPath, "package.json");
14820
+ if (typescriptPkg && import_fs3.default.existsSync(typescriptPkg)) {
14942
14821
  const pjson = (0, import_chunk_2ESYSVXG.__require)(typescriptPkg);
14943
14822
  const currentVersion = pjson.version;
14944
14823
  if ((0, import_chunk_EUTJYQDW.semverLt)(currentVersion, minVersion)) {
@@ -14954,7 +14833,7 @@ async function checkTypeScriptVersion() {
14954
14833
  } catch (e) {
14955
14834
  }
14956
14835
  }
14957
- var debug5 = (0, import_debug5.default)("prisma:generator");
14836
+ var debug5 = (0, import_debug4.default)("prisma:generator");
14958
14837
  async function prismaClientResolver(baseDir, version3) {
14959
14838
  let prismaClientDir = await (0, import_chunk_DGZO4GAJ.findPrismaClientDir)(baseDir);
14960
14839
  debug5("baseDir", baseDir);
@@ -14973,7 +14852,7 @@ async function prismaClientResolver(baseDir, version3) {
14973
14852
  );
14974
14853
  projectRoot = baseDir;
14975
14854
  }
14976
- if (!import_fs4.default.existsSync(import_path5.default.join(projectRoot, "package.json"))) {
14855
+ if (!import_fs2.default.existsSync(import_path4.default.join(projectRoot, "package.json"))) {
14977
14856
  console.warn(
14978
14857
  (0, import_chunk_PG5FDKSF.yellow)(
14979
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)(
@@ -15000,7 +14879,7 @@ async function prismaClientResolver(baseDir, version3) {
15000
14879
  await (0, import_chunk_ETNCBIDF.runPackageCmd)(projectRoot, "add", `prisma@${version3 ?? "latest"}`, "-D", "--silent");
15001
14880
  }
15002
14881
  await (0, import_chunk_ETNCBIDF.runPackageCmd)(projectRoot, "add", `@prisma/client@${version3 ?? "latest"}`, "--silent");
15003
- prismaClientDir = await (0, import_chunk_DGZO4GAJ.findPrismaClientDir)(import_path5.default.join(".", baseDir));
14882
+ prismaClientDir = await (0, import_chunk_DGZO4GAJ.findPrismaClientDir)(import_path4.default.join(".", baseDir));
15004
14883
  if (!prismaClientDir) {
15005
14884
  throw new Error(
15006
14885
  `Could not resolve @prisma/client despite the installation that we just tried.
@@ -15024,14 +14903,14 @@ Please try to install it with ${(0, import_chunk_PG5FDKSF.bold)((0, import_chunk
15024
14903
  }
15025
14904
  return {
15026
14905
  outputPath: prismaClientDir,
15027
- generatorPath: import_path5.default.resolve(prismaClientDir, "generator-build/index.js"),
14906
+ generatorPath: import_path4.default.resolve(prismaClientDir, "generator-build/index.js"),
15028
14907
  isNode: true
15029
14908
  };
15030
14909
  }
15031
14910
  var generatorResolvers = {
15032
14911
  "prisma-client-js": prismaClientResolver
15033
14912
  };
15034
- var debug6 = (0, import_debug4.default)("prisma:getGenerators");
14913
+ var debug6 = (0, import_debug3.default)("prisma:getGenerators");
15035
14914
  async function getGenerators(options) {
15036
14915
  const {
15037
14916
  schemaPath,
@@ -15076,7 +14955,7 @@ async function getGenerators(options) {
15076
14955
  }
15077
14956
  (0, import_chunk_5FJ3MENK.printConfigWarnings)(schemaContext.warnings);
15078
14957
  const previewFeatures = (0, import_chunk_CRVLHWC5.extractPreviewFeatures)(schemaContext.generators);
15079
- const dmmf = await (0, import_chunk_OKJT45NT.getDMMF)({
14958
+ const dmmf = await (0, import_chunk_WUO3S6J2.getDMMF)({
15080
14959
  datamodel: schemaContext.schemaFiles,
15081
14960
  previewFeatures
15082
14961
  });
@@ -15095,7 +14974,7 @@ async function getGenerators(options) {
15095
14974
  async (generator, index2) => {
15096
14975
  let generatorPath = (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.provider);
15097
14976
  let paths2;
15098
- const baseDir = import_path4.default.dirname(generator.sourceFilePath ?? schemaContext.schemaRootDir);
14977
+ const baseDir = import_path3.default.dirname(generator.sourceFilePath ?? schemaContext.schemaRootDir);
15099
14978
  const providerValue = (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.provider);
15100
14979
  if (aliases && aliases[providerValue]) {
15101
14980
  generatorPath = aliases[providerValue].generatorPath;
@@ -15108,7 +14987,7 @@ async function getGenerators(options) {
15108
14987
  await generatorInstance.init();
15109
14988
  if (generator.output) {
15110
14989
  generator.output = {
15111
- value: import_path4.default.resolve(baseDir, (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.output)),
14990
+ value: import_path3.default.resolve(baseDir, (0, import_chunk_IOIAK7V7.parseEnvValue)(generator.output)),
15112
14991
  fromEnvVar: null
15113
14992
  };
15114
14993
  generator.isCustomOutput = true;
@@ -15134,7 +15013,7 @@ The generator needs to either define the \`defaultOutput\` path in the manifest
15134
15013
  fromEnvVar: null
15135
15014
  };
15136
15015
  }
15137
- const datamodel = (0, import_chunk_GNK3AD6X.mergeSchemas)({ schemas: schemaContext.schemaFiles });
15016
+ const datamodel = (0, import_chunk_RQK5KO77.mergeSchemas)({ schemas: schemaContext.schemaFiles });
15138
15017
  const envPaths2 = await getEnvPaths(schemaContext.schemaPath, { cwd: generator.output.value });
15139
15018
  const options2 = {
15140
15019
  datamodel,
@@ -15218,7 +15097,7 @@ generator gen {
15218
15097
  debug6({ generatorBinaryPaths });
15219
15098
  generator.setBinaryPaths(generatorBinaryPaths);
15220
15099
  if (engineVersion !== version && generator.options && generator.manifest.requiresEngines.includes(queryEngineType) && generatorBinaryPaths[queryEngineType] && generatorBinaryPaths[queryEngineType]?.[binaryTarget]) {
15221
- const customDmmf = await (0, import_chunk_OKJT45NT.getDMMF)({
15100
+ const customDmmf = await (0, import_chunk_WUO3S6J2.getDMMF)({
15222
15101
  datamodel: schemaContext.schemaFiles,
15223
15102
  previewFeatures
15224
15103
  });
@@ -15347,7 +15226,7 @@ async function sendPanic({
15347
15226
  return {
15348
15227
  datasource: {
15349
15228
  tag: "Schema",
15350
- ...(0, import_chunk_JHQHVXIR.toSchemasContainer)(schema2)
15229
+ ...(0, import_chunk_OSHZ4P3G.toSchemasContainer)(schema2)
15351
15230
  }
15352
15231
  };
15353
15232
  }).with({ introspectionUrl: import_chunk_XKZ6CBLA.N.not(void 0) }, ({ introspectionUrl }) => {
@@ -15415,31 +15294,31 @@ async function makeErrorZip(error) {
15415
15294
  if (!error.schemaPath) {
15416
15295
  throw new Error(`Can't make zip without schema path`);
15417
15296
  }
15418
- const schemaDir = import_path7.default.dirname(error.schemaPath);
15297
+ const schemaDir = import_path6.default.dirname(error.schemaPath);
15419
15298
  const tmpFileObj = import_tmp.default.fileSync();
15420
- const outputFile = import_fs6.default.createWriteStream(tmpFileObj.name);
15299
+ const outputFile = import_fs4.default.createWriteStream(tmpFileObj.name);
15421
15300
  const zip = (0, import_archiver.default)("zip", { zlib: { level: 9 } });
15422
15301
  zip.pipe(outputFile);
15423
- const schemaFile = (0, import_chunk_KDHESRKE.maskSchema)(import_fs6.default.readFileSync(error.schemaPath, "utf-8"));
15424
- zip.append(schemaFile, { name: import_path7.default.basename(error.schemaPath) });
15425
- if (import_fs6.default.existsSync(schemaDir)) {
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)) {
15426
15305
  const filePaths = await (0, import_globby.default)("migrations/**/*", {
15427
15306
  // globby doesn't have it in its types but it's part of mrmlnc/fast-glob
15428
15307
  // @ts-ignore
15429
15308
  cwd: schemaDir
15430
15309
  });
15431
15310
  for (const filePath of filePaths) {
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))) {
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))) {
15434
15313
  file = (0, import_chunk_KDHESRKE.maskSchema)(file);
15435
15314
  }
15436
- zip.append(file, { name: import_path7.default.basename(filePath) });
15315
+ zip.append(file, { name: import_path6.default.basename(filePath) });
15437
15316
  }
15438
15317
  }
15439
15318
  zip.finalize();
15440
15319
  return new Promise((resolve, reject2) => {
15441
15320
  outputFile.on("close", () => {
15442
- const buffer = import_fs6.default.readFileSync(tmpFileObj.name);
15321
+ const buffer = import_fs4.default.readFileSync(tmpFileObj.name);
15443
15322
  resolve(buffer);
15444
15323
  });
15445
15324
  zip.on("error", (err) => {
@@ -15447,6 +15326,144 @@ async function makeErrorZip(error) {
15447
15326
  });
15448
15327
  });
15449
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
+ }
15450
15467
  async function handlePanic(args) {
15451
15468
  if (!(0, import_chunk_R3J2O23S.canPrompt)()) {
15452
15469
  throw args.error;
@@ -15509,68 +15526,43 @@ ${(0, import_chunk_PG5FDKSF.bold)("Thanks a lot for your help! \u{1F64F}")}`);
15509
15526
  });
15510
15527
  process.exit(1);
15511
15528
  }
15512
- var debug7 = (0, import_debug.default)("prisma:format");
15513
- async function formatSchema({ schemas }, inputFormattingOptions) {
15514
- if (process.env.FORCE_PANIC_PRISMA_SCHEMA) {
15515
- handleFormatPanic(
15516
- () => {
15517
- import_chunk_LR3WWKZI.prismaSchemaWasm.debug_panic();
15518
- },
15519
- { schemas }
15520
- );
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;
15521
15538
  }
15522
- const defaultFormattingOptions = {
15523
- tabSize: 2,
15524
- insertSpaces: true
15525
- };
15526
- const documentFormattingParams = {
15527
- textDocument: { uri: "file:/dev/null" },
15528
- options: {
15529
- ...defaultFormattingOptions,
15530
- ...inputFormattingOptions
15531
- }
15532
- };
15533
- const { formattedMultipleSchemas, lintDiagnostics } = handleFormatPanic(
15534
- () => {
15535
- const formattedMultipleSchemasRaw = formatWasm(JSON.stringify(schemas), documentFormattingParams);
15536
- const formattedMultipleSchemas2 = JSON.parse(formattedMultipleSchemasRaw);
15537
- const lintDiagnostics2 = (0, import_chunk_NZDLSDLM.lintSchema)({ schemas: formattedMultipleSchemas2 });
15538
- return { formattedMultipleSchemas: formattedMultipleSchemas2, lintDiagnostics: lintDiagnostics2 };
15539
- },
15540
- { schemas }
15541
- );
15542
- const lintWarnings = (0, import_chunk_NZDLSDLM.getLintWarningsAsText)(lintDiagnostics);
15543
- if (lintWarnings && import_chunk_MBB2KJWX.logger_exports.should.warn()) {
15544
- 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");
15545
15543
  }
15546
- return Promise.resolve(formattedMultipleSchemas);
15547
15544
  }
15548
- function handleFormatPanic(tryCb, { schemas }) {
15549
- try {
15550
- return tryCb();
15551
- } catch (e) {
15552
- const { message, stack } = (0, import_chunk_CCQRDM7X.getWasmError)(e);
15553
- debug7(`Error formatting schema: ${message}`);
15554
- debug7(stack);
15555
- const panic = new import_chunk_CCQRDM7X.RustPanic(
15556
- /* message */
15557
- message,
15558
- /* rustStack */
15559
- stack,
15560
- /* request */
15561
- "@prisma/prisma-schema-wasm format",
15562
- "FMT_CLI",
15563
- /* schemaPath */
15564
- (0, import_chunk_YRBRUREX.debugMultipleSchemaPaths)(schemas),
15565
- /* schema */
15566
- schemas
15567
- );
15568
- 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_5II75LYF.resolveUrl)((0, import_chunk_5II75LYF.getEffectiveUrl)(schemaContext2.primaryDatasource));
15563
+ if (url?.startsWith("prisma://")) {
15564
+ throw new Error(forbiddenCmdWithDataProxyFlagMessage(cmd));
15569
15565
  }
15570
- }
15571
- function formatWasm(schema, documentFormattingParams) {
15572
- const formattedSchema = import_chunk_LR3WWKZI.prismaSchemaWasm.format(schema, JSON.stringify(documentFormattingParams));
15573
- return formattedSchema;
15574
15566
  }
15575
15567
  /*! Bundled license information:
15576
15568