@prisma/client-generator-ts 7.2.0 → 7.3.0-integration-fix-6-19-0-cloudflare-accelerate-engine.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -111,14 +111,14 @@ var require_polyfills = __commonJS({
111
111
  fs3.fstatSync = statFixSync(fs3.fstatSync);
112
112
  fs3.lstatSync = statFixSync(fs3.lstatSync);
113
113
  if (fs3.chmod && !fs3.lchmod) {
114
- fs3.lchmod = function(path3, mode, cb) {
114
+ fs3.lchmod = function(path6, mode, cb) {
115
115
  if (cb) process.nextTick(cb);
116
116
  };
117
117
  fs3.lchmodSync = function() {
118
118
  };
119
119
  }
120
120
  if (fs3.chown && !fs3.lchown) {
121
- fs3.lchown = function(path3, uid, gid, cb) {
121
+ fs3.lchown = function(path6, uid, gid, cb) {
122
122
  if (cb) process.nextTick(cb);
123
123
  };
124
124
  fs3.lchownSync = function() {
@@ -185,9 +185,9 @@ var require_polyfills = __commonJS({
185
185
  };
186
186
  }(fs3.readSync);
187
187
  function patchLchmod(fs4) {
188
- fs4.lchmod = function(path3, mode, callback) {
188
+ fs4.lchmod = function(path6, mode, callback) {
189
189
  fs4.open(
190
- path3,
190
+ path6,
191
191
  constants.O_WRONLY | constants.O_SYMLINK,
192
192
  mode,
193
193
  function(err, fd) {
@@ -203,8 +203,8 @@ var require_polyfills = __commonJS({
203
203
  }
204
204
  );
205
205
  };
206
- fs4.lchmodSync = function(path3, mode) {
207
- var fd = fs4.openSync(path3, constants.O_WRONLY | constants.O_SYMLINK, mode);
206
+ fs4.lchmodSync = function(path6, mode) {
207
+ var fd = fs4.openSync(path6, constants.O_WRONLY | constants.O_SYMLINK, mode);
208
208
  var threw = true;
209
209
  var ret;
210
210
  try {
@@ -225,8 +225,8 @@ var require_polyfills = __commonJS({
225
225
  }
226
226
  function patchLutimes(fs4) {
227
227
  if (constants.hasOwnProperty("O_SYMLINK") && fs4.futimes) {
228
- fs4.lutimes = function(path3, at, mt, cb) {
229
- fs4.open(path3, constants.O_SYMLINK, function(er, fd) {
228
+ fs4.lutimes = function(path6, at, mt, cb) {
229
+ fs4.open(path6, constants.O_SYMLINK, function(er, fd) {
230
230
  if (er) {
231
231
  if (cb) cb(er);
232
232
  return;
@@ -238,8 +238,8 @@ var require_polyfills = __commonJS({
238
238
  });
239
239
  });
240
240
  };
241
- fs4.lutimesSync = function(path3, at, mt) {
242
- var fd = fs4.openSync(path3, constants.O_SYMLINK);
241
+ fs4.lutimesSync = function(path6, at, mt) {
242
+ var fd = fs4.openSync(path6, constants.O_SYMLINK);
243
243
  var ret;
244
244
  var threw = true;
245
245
  try {
@@ -358,11 +358,11 @@ var require_legacy_streams = __commonJS({
358
358
  ReadStream,
359
359
  WriteStream
360
360
  };
361
- function ReadStream(path3, options) {
362
- if (!(this instanceof ReadStream)) return new ReadStream(path3, options);
361
+ function ReadStream(path6, options) {
362
+ if (!(this instanceof ReadStream)) return new ReadStream(path6, options);
363
363
  Stream.call(this);
364
364
  var self = this;
365
- this.path = path3;
365
+ this.path = path6;
366
366
  this.fd = null;
367
367
  this.readable = true;
368
368
  this.paused = false;
@@ -407,10 +407,10 @@ var require_legacy_streams = __commonJS({
407
407
  self._read();
408
408
  });
409
409
  }
410
- function WriteStream(path3, options) {
411
- if (!(this instanceof WriteStream)) return new WriteStream(path3, options);
410
+ function WriteStream(path6, options) {
411
+ if (!(this instanceof WriteStream)) return new WriteStream(path6, options);
412
412
  Stream.call(this);
413
- this.path = path3;
413
+ this.path = path6;
414
414
  this.fd = null;
415
415
  this.writable = true;
416
416
  this.flags = "w";
@@ -494,11 +494,11 @@ var require_graceful_fs = __commonJS({
494
494
  }
495
495
  });
496
496
  }
497
- var debug2 = noop;
497
+ var debug3 = noop;
498
498
  if (util.debuglog)
499
- debug2 = util.debuglog("gfs4");
499
+ debug3 = util.debuglog("gfs4");
500
500
  else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
501
- debug2 = function() {
501
+ debug3 = function() {
502
502
  var m = util.format.apply(util, arguments);
503
503
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
504
504
  console.error(m);
@@ -533,7 +533,7 @@ var require_graceful_fs = __commonJS({
533
533
  }(fs3.closeSync);
534
534
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
535
535
  process.on("exit", function() {
536
- debug2(fs3[gracefulQueue]);
536
+ debug3(fs3[gracefulQueue]);
537
537
  require("assert").equal(fs3[gracefulQueue].length, 0);
538
538
  });
539
539
  }
@@ -554,14 +554,14 @@ var require_graceful_fs = __commonJS({
554
554
  fs4.createWriteStream = createWriteStream;
555
555
  var fs$readFile = fs4.readFile;
556
556
  fs4.readFile = readFile;
557
- function readFile(path3, options, cb) {
557
+ function readFile(path6, options, cb) {
558
558
  if (typeof options === "function")
559
559
  cb = options, options = null;
560
- return go$readFile(path3, options, cb);
561
- function go$readFile(path4, options2, cb2, startTime) {
562
- return fs$readFile(path4, options2, function(err) {
560
+ return go$readFile(path6, options, cb);
561
+ function go$readFile(path7, options2, cb2, startTime) {
562
+ return fs$readFile(path7, options2, function(err) {
563
563
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
564
- enqueue([go$readFile, [path4, options2, cb2], err, startTime || Date.now(), Date.now()]);
564
+ enqueue([go$readFile, [path7, options2, cb2], err, startTime || Date.now(), Date.now()]);
565
565
  else {
566
566
  if (typeof cb2 === "function")
567
567
  cb2.apply(this, arguments);
@@ -571,14 +571,14 @@ var require_graceful_fs = __commonJS({
571
571
  }
572
572
  var fs$writeFile = fs4.writeFile;
573
573
  fs4.writeFile = writeFile;
574
- function writeFile(path3, data, options, cb) {
574
+ function writeFile(path6, data, options, cb) {
575
575
  if (typeof options === "function")
576
576
  cb = options, options = null;
577
- return go$writeFile(path3, data, options, cb);
578
- function go$writeFile(path4, data2, options2, cb2, startTime) {
579
- return fs$writeFile(path4, data2, options2, function(err) {
577
+ return go$writeFile(path6, data, options, cb);
578
+ function go$writeFile(path7, data2, options2, cb2, startTime) {
579
+ return fs$writeFile(path7, data2, options2, function(err) {
580
580
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
581
- enqueue([go$writeFile, [path4, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
581
+ enqueue([go$writeFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
582
582
  else {
583
583
  if (typeof cb2 === "function")
584
584
  cb2.apply(this, arguments);
@@ -589,14 +589,14 @@ var require_graceful_fs = __commonJS({
589
589
  var fs$appendFile = fs4.appendFile;
590
590
  if (fs$appendFile)
591
591
  fs4.appendFile = appendFile;
592
- function appendFile(path3, data, options, cb) {
592
+ function appendFile(path6, data, options, cb) {
593
593
  if (typeof options === "function")
594
594
  cb = options, options = null;
595
- return go$appendFile(path3, data, options, cb);
596
- function go$appendFile(path4, data2, options2, cb2, startTime) {
597
- return fs$appendFile(path4, data2, options2, function(err) {
595
+ return go$appendFile(path6, data, options, cb);
596
+ function go$appendFile(path7, data2, options2, cb2, startTime) {
597
+ return fs$appendFile(path7, data2, options2, function(err) {
598
598
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
599
- enqueue([go$appendFile, [path4, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
599
+ enqueue([go$appendFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
600
600
  else {
601
601
  if (typeof cb2 === "function")
602
602
  cb2.apply(this, arguments);
@@ -627,31 +627,31 @@ var require_graceful_fs = __commonJS({
627
627
  var fs$readdir = fs4.readdir;
628
628
  fs4.readdir = readdir;
629
629
  var noReaddirOptionVersions = /^v[0-5]\./;
630
- function readdir(path3, options, cb) {
630
+ function readdir(path6, options, cb) {
631
631
  if (typeof options === "function")
632
632
  cb = options, options = null;
633
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path4, options2, cb2, startTime) {
634
- return fs$readdir(path4, fs$readdirCallback(
635
- path4,
633
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path7, options2, cb2, startTime) {
634
+ return fs$readdir(path7, fs$readdirCallback(
635
+ path7,
636
636
  options2,
637
637
  cb2,
638
638
  startTime
639
639
  ));
640
- } : function go$readdir2(path4, options2, cb2, startTime) {
641
- return fs$readdir(path4, options2, fs$readdirCallback(
642
- path4,
640
+ } : function go$readdir2(path7, options2, cb2, startTime) {
641
+ return fs$readdir(path7, options2, fs$readdirCallback(
642
+ path7,
643
643
  options2,
644
644
  cb2,
645
645
  startTime
646
646
  ));
647
647
  };
648
- return go$readdir(path3, options, cb);
649
- function fs$readdirCallback(path4, options2, cb2, startTime) {
648
+ return go$readdir(path6, options, cb);
649
+ function fs$readdirCallback(path7, options2, cb2, startTime) {
650
650
  return function(err, files) {
651
651
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
652
652
  enqueue([
653
653
  go$readdir,
654
- [path4, options2, cb2],
654
+ [path7, options2, cb2],
655
655
  err,
656
656
  startTime || Date.now(),
657
657
  Date.now()
@@ -722,7 +722,7 @@ var require_graceful_fs = __commonJS({
722
722
  enumerable: true,
723
723
  configurable: true
724
724
  });
725
- function ReadStream(path3, options) {
725
+ function ReadStream(path6, options) {
726
726
  if (this instanceof ReadStream)
727
727
  return fs$ReadStream.apply(this, arguments), this;
728
728
  else
@@ -742,7 +742,7 @@ var require_graceful_fs = __commonJS({
742
742
  }
743
743
  });
744
744
  }
745
- function WriteStream(path3, options) {
745
+ function WriteStream(path6, options) {
746
746
  if (this instanceof WriteStream)
747
747
  return fs$WriteStream.apply(this, arguments), this;
748
748
  else
@@ -760,22 +760,22 @@ var require_graceful_fs = __commonJS({
760
760
  }
761
761
  });
762
762
  }
763
- function createReadStream(path3, options) {
764
- return new fs4.ReadStream(path3, options);
763
+ function createReadStream(path6, options) {
764
+ return new fs4.ReadStream(path6, options);
765
765
  }
766
- function createWriteStream(path3, options) {
767
- return new fs4.WriteStream(path3, options);
766
+ function createWriteStream(path6, options) {
767
+ return new fs4.WriteStream(path6, options);
768
768
  }
769
769
  var fs$open = fs4.open;
770
770
  fs4.open = open;
771
- function open(path3, flags, mode, cb) {
771
+ function open(path6, flags, mode, cb) {
772
772
  if (typeof mode === "function")
773
773
  cb = mode, mode = null;
774
- return go$open(path3, flags, mode, cb);
775
- function go$open(path4, flags2, mode2, cb2, startTime) {
776
- return fs$open(path4, flags2, mode2, function(err, fd) {
774
+ return go$open(path6, flags, mode, cb);
775
+ function go$open(path7, flags2, mode2, cb2, startTime) {
776
+ return fs$open(path7, flags2, mode2, function(err, fd) {
777
777
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
778
- enqueue([go$open, [path4, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
778
+ enqueue([go$open, [path7, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
779
779
  else {
780
780
  if (typeof cb2 === "function")
781
781
  cb2.apply(this, arguments);
@@ -786,7 +786,7 @@ var require_graceful_fs = __commonJS({
786
786
  return fs4;
787
787
  }
788
788
  function enqueue(elem) {
789
- debug2("ENQUEUE", elem[0].name, elem[1]);
789
+ debug3("ENQUEUE", elem[0].name, elem[1]);
790
790
  fs3[gracefulQueue].push(elem);
791
791
  retry();
792
792
  }
@@ -813,10 +813,10 @@ var require_graceful_fs = __commonJS({
813
813
  var startTime = elem[3];
814
814
  var lastTime = elem[4];
815
815
  if (startTime === void 0) {
816
- debug2("RETRY", fn.name, args);
816
+ debug3("RETRY", fn.name, args);
817
817
  fn.apply(null, args);
818
818
  } else if (Date.now() - startTime >= 6e4) {
819
- debug2("TIMEOUT", fn.name, args);
819
+ debug3("TIMEOUT", fn.name, args);
820
820
  var cb = args.pop();
821
821
  if (typeof cb === "function")
822
822
  cb.call(null, err);
@@ -825,7 +825,7 @@ var require_graceful_fs = __commonJS({
825
825
  var sinceStart = Math.max(lastTime - startTime, 1);
826
826
  var desiredDelay = Math.min(sinceStart * 1.2, 100);
827
827
  if (sinceAttempt >= desiredDelay) {
828
- debug2("RETRY", fn.name, args);
828
+ debug3("RETRY", fn.name, args);
829
829
  fn.apply(null, args.concat([startTime]));
830
830
  } else {
831
831
  fs3[gracefulQueue].push(elem);
@@ -958,10 +958,10 @@ var require_fs = __commonJS({
958
958
  var require_utils = __commonJS({
959
959
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports2, module2) {
960
960
  "use strict";
961
- var path3 = require("path");
961
+ var path6 = require("path");
962
962
  module2.exports.checkPath = function checkPath(pth) {
963
963
  if (process.platform === "win32") {
964
- const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path3.parse(pth).root, ""));
964
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path6.parse(pth).root, ""));
965
965
  if (pathHasInvalidWinCharacters) {
966
966
  const error = new Error(`Path contains invalid characters: ${pth}`);
967
967
  error.code = "EINVAL";
@@ -1025,8 +1025,8 @@ var require_path_exists = __commonJS({
1025
1025
  "use strict";
1026
1026
  var u = require_universalify().fromPromise;
1027
1027
  var fs3 = require_fs();
1028
- function pathExists(path3) {
1029
- return fs3.access(path3).then(() => true).catch(() => false);
1028
+ function pathExists(path6) {
1029
+ return fs3.access(path6).then(() => true).catch(() => false);
1030
1030
  }
1031
1031
  module2.exports = {
1032
1032
  pathExists: u(pathExists),
@@ -1041,8 +1041,8 @@ var require_utimes = __commonJS({
1041
1041
  "use strict";
1042
1042
  var fs3 = require_fs();
1043
1043
  var u = require_universalify().fromPromise;
1044
- async function utimesMillis(path3, atime, mtime) {
1045
- const fd = await fs3.open(path3, "r+");
1044
+ async function utimesMillis(path6, atime, mtime) {
1045
+ const fd = await fs3.open(path6, "r+");
1046
1046
  let closeErr = null;
1047
1047
  try {
1048
1048
  await fs3.futimes(fd, atime, mtime);
@@ -1057,8 +1057,8 @@ var require_utimes = __commonJS({
1057
1057
  throw closeErr;
1058
1058
  }
1059
1059
  }
1060
- function utimesMillisSync(path3, atime, mtime) {
1061
- const fd = fs3.openSync(path3, "r+");
1060
+ function utimesMillisSync(path6, atime, mtime) {
1061
+ const fd = fs3.openSync(path6, "r+");
1062
1062
  fs3.futimesSync(fd, atime, mtime);
1063
1063
  return fs3.closeSync(fd);
1064
1064
  }
@@ -1074,7 +1074,7 @@ var require_stat = __commonJS({
1074
1074
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/util/stat.js"(exports2, module2) {
1075
1075
  "use strict";
1076
1076
  var fs3 = require_fs();
1077
- var path3 = require("path");
1077
+ var path6 = require("path");
1078
1078
  var u = require_universalify().fromPromise;
1079
1079
  function getStats(src, dest, opts) {
1080
1080
  const statFunc = opts.dereference ? (file4) => fs3.stat(file4, { bigint: true }) : (file4) => fs3.lstat(file4, { bigint: true });
@@ -1102,8 +1102,8 @@ var require_stat = __commonJS({
1102
1102
  const { srcStat, destStat } = await getStats(src, dest, opts);
1103
1103
  if (destStat) {
1104
1104
  if (areIdentical(srcStat, destStat)) {
1105
- const srcBaseName = path3.basename(src);
1106
- const destBaseName = path3.basename(dest);
1105
+ const srcBaseName = path6.basename(src);
1106
+ const destBaseName = path6.basename(dest);
1107
1107
  if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1108
1108
  return { srcStat, destStat, isChangingCase: true };
1109
1109
  }
@@ -1125,8 +1125,8 @@ var require_stat = __commonJS({
1125
1125
  const { srcStat, destStat } = getStatsSync(src, dest, opts);
1126
1126
  if (destStat) {
1127
1127
  if (areIdentical(srcStat, destStat)) {
1128
- const srcBaseName = path3.basename(src);
1129
- const destBaseName = path3.basename(dest);
1128
+ const srcBaseName = path6.basename(src);
1129
+ const destBaseName = path6.basename(dest);
1130
1130
  if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1131
1131
  return { srcStat, destStat, isChangingCase: true };
1132
1132
  }
@@ -1145,9 +1145,9 @@ var require_stat = __commonJS({
1145
1145
  return { srcStat, destStat };
1146
1146
  }
1147
1147
  async function checkParentPaths(src, srcStat, dest, funcName) {
1148
- const srcParent = path3.resolve(path3.dirname(src));
1149
- const destParent = path3.resolve(path3.dirname(dest));
1150
- if (destParent === srcParent || destParent === path3.parse(destParent).root) return;
1148
+ const srcParent = path6.resolve(path6.dirname(src));
1149
+ const destParent = path6.resolve(path6.dirname(dest));
1150
+ if (destParent === srcParent || destParent === path6.parse(destParent).root) return;
1151
1151
  let destStat;
1152
1152
  try {
1153
1153
  destStat = await fs3.stat(destParent, { bigint: true });
@@ -1161,9 +1161,9 @@ var require_stat = __commonJS({
1161
1161
  return checkParentPaths(src, srcStat, destParent, funcName);
1162
1162
  }
1163
1163
  function checkParentPathsSync(src, srcStat, dest, funcName) {
1164
- const srcParent = path3.resolve(path3.dirname(src));
1165
- const destParent = path3.resolve(path3.dirname(dest));
1166
- if (destParent === srcParent || destParent === path3.parse(destParent).root) return;
1164
+ const srcParent = path6.resolve(path6.dirname(src));
1165
+ const destParent = path6.resolve(path6.dirname(dest));
1166
+ if (destParent === srcParent || destParent === path6.parse(destParent).root) return;
1167
1167
  let destStat;
1168
1168
  try {
1169
1169
  destStat = fs3.statSync(destParent, { bigint: true });
@@ -1180,8 +1180,8 @@ var require_stat = __commonJS({
1180
1180
  return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
1181
1181
  }
1182
1182
  function isSrcSubdir(src, dest) {
1183
- const srcArr = path3.resolve(src).split(path3.sep).filter((i) => i);
1184
- const destArr = path3.resolve(dest).split(path3.sep).filter((i) => i);
1183
+ const srcArr = path6.resolve(src).split(path6.sep).filter((i) => i);
1184
+ const destArr = path6.resolve(dest).split(path6.sep).filter((i) => i);
1185
1185
  return srcArr.every((cur, i) => destArr[i] === cur);
1186
1186
  }
1187
1187
  function errMsg(src, dest, funcName) {
@@ -1206,7 +1206,7 @@ var require_copy = __commonJS({
1206
1206
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy.js"(exports2, module2) {
1207
1207
  "use strict";
1208
1208
  var fs3 = require_fs();
1209
- var path3 = require("path");
1209
+ var path6 = require("path");
1210
1210
  var { mkdirs } = require_mkdirs();
1211
1211
  var { pathExists } = require_path_exists();
1212
1212
  var { utimesMillis } = require_utimes();
@@ -1228,7 +1228,7 @@ var require_copy = __commonJS({
1228
1228
  await stat.checkParentPaths(src, srcStat, dest, "copy");
1229
1229
  const include = await runFilter(src, dest, opts);
1230
1230
  if (!include) return;
1231
- const destParent = path3.dirname(dest);
1231
+ const destParent = path6.dirname(dest);
1232
1232
  const dirExists = await pathExists(destParent);
1233
1233
  if (!dirExists) {
1234
1234
  await mkdirs(destParent);
@@ -1282,8 +1282,8 @@ var require_copy = __commonJS({
1282
1282
  }
1283
1283
  const promises = [];
1284
1284
  for await (const item of await fs3.opendir(src)) {
1285
- const srcItem = path3.join(src, item.name);
1286
- const destItem = path3.join(dest, item.name);
1285
+ const srcItem = path6.join(src, item.name);
1286
+ const destItem = path6.join(dest, item.name);
1287
1287
  promises.push(
1288
1288
  runFilter(srcItem, destItem, opts).then((include) => {
1289
1289
  if (include) {
@@ -1302,7 +1302,7 @@ var require_copy = __commonJS({
1302
1302
  async function onLink(destStat, src, dest, opts) {
1303
1303
  let resolvedSrc = await fs3.readlink(src);
1304
1304
  if (opts.dereference) {
1305
- resolvedSrc = path3.resolve(process.cwd(), resolvedSrc);
1305
+ resolvedSrc = path6.resolve(process.cwd(), resolvedSrc);
1306
1306
  }
1307
1307
  if (!destStat) {
1308
1308
  return fs3.symlink(resolvedSrc, dest);
@@ -1315,7 +1315,7 @@ var require_copy = __commonJS({
1315
1315
  throw e;
1316
1316
  }
1317
1317
  if (opts.dereference) {
1318
- resolvedDest = path3.resolve(process.cwd(), resolvedDest);
1318
+ resolvedDest = path6.resolve(process.cwd(), resolvedDest);
1319
1319
  }
1320
1320
  if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1321
1321
  throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
@@ -1335,7 +1335,7 @@ var require_copy_sync = __commonJS({
1335
1335
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/copy/copy-sync.js"(exports2, module2) {
1336
1336
  "use strict";
1337
1337
  var fs3 = require_graceful_fs();
1338
- var path3 = require("path");
1338
+ var path6 = require("path");
1339
1339
  var mkdirsSync = require_mkdirs().mkdirsSync;
1340
1340
  var utimesMillisSync = require_utimes().utimesMillisSync;
1341
1341
  var stat = require_stat();
@@ -1356,7 +1356,7 @@ var require_copy_sync = __commonJS({
1356
1356
  const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
1357
1357
  stat.checkParentPathsSync(src, srcStat, dest, "copy");
1358
1358
  if (opts.filter && !opts.filter(src, dest)) return;
1359
- const destParent = path3.dirname(dest);
1359
+ const destParent = path6.dirname(dest);
1360
1360
  if (!fs3.existsSync(destParent)) mkdirsSync(destParent);
1361
1361
  return getStats(destStat, src, dest, opts);
1362
1362
  }
@@ -1425,8 +1425,8 @@ var require_copy_sync = __commonJS({
1425
1425
  }
1426
1426
  }
1427
1427
  function copyDirItem(item, src, dest, opts) {
1428
- const srcItem = path3.join(src, item);
1429
- const destItem = path3.join(dest, item);
1428
+ const srcItem = path6.join(src, item);
1429
+ const destItem = path6.join(dest, item);
1430
1430
  if (opts.filter && !opts.filter(srcItem, destItem)) return;
1431
1431
  const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
1432
1432
  return getStats(destStat, srcItem, destItem, opts);
@@ -1434,7 +1434,7 @@ var require_copy_sync = __commonJS({
1434
1434
  function onLink(destStat, src, dest, opts) {
1435
1435
  let resolvedSrc = fs3.readlinkSync(src);
1436
1436
  if (opts.dereference) {
1437
- resolvedSrc = path3.resolve(process.cwd(), resolvedSrc);
1437
+ resolvedSrc = path6.resolve(process.cwd(), resolvedSrc);
1438
1438
  }
1439
1439
  if (!destStat) {
1440
1440
  return fs3.symlinkSync(resolvedSrc, dest);
@@ -1447,7 +1447,7 @@ var require_copy_sync = __commonJS({
1447
1447
  throw err;
1448
1448
  }
1449
1449
  if (opts.dereference) {
1450
- resolvedDest = path3.resolve(process.cwd(), resolvedDest);
1450
+ resolvedDest = path6.resolve(process.cwd(), resolvedDest);
1451
1451
  }
1452
1452
  if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1453
1453
  throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
@@ -1484,11 +1484,11 @@ var require_remove = __commonJS({
1484
1484
  "use strict";
1485
1485
  var fs3 = require_graceful_fs();
1486
1486
  var u = require_universalify().fromCallback;
1487
- function remove(path3, callback) {
1488
- fs3.rm(path3, { recursive: true, force: true }, callback);
1487
+ function remove(path6, callback) {
1488
+ fs3.rm(path6, { recursive: true, force: true }, callback);
1489
1489
  }
1490
- function removeSync(path3) {
1491
- fs3.rmSync(path3, { recursive: true, force: true });
1490
+ function removeSync(path6) {
1491
+ fs3.rmSync(path6, { recursive: true, force: true });
1492
1492
  }
1493
1493
  module2.exports = {
1494
1494
  remove: u(remove),
@@ -1503,7 +1503,7 @@ var require_empty = __commonJS({
1503
1503
  "use strict";
1504
1504
  var u = require_universalify().fromPromise;
1505
1505
  var fs3 = require_fs();
1506
- var path3 = require("path");
1506
+ var path6 = require("path");
1507
1507
  var mkdir = require_mkdirs();
1508
1508
  var remove = require_remove();
1509
1509
  var emptyDir = u(async function emptyDir2(dir) {
@@ -1513,7 +1513,7 @@ var require_empty = __commonJS({
1513
1513
  } catch {
1514
1514
  return mkdir.mkdirs(dir);
1515
1515
  }
1516
- return Promise.all(items.map((item) => remove.remove(path3.join(dir, item))));
1516
+ return Promise.all(items.map((item) => remove.remove(path6.join(dir, item))));
1517
1517
  });
1518
1518
  function emptyDirSync(dir) {
1519
1519
  let items;
@@ -1523,7 +1523,7 @@ var require_empty = __commonJS({
1523
1523
  return mkdir.mkdirsSync(dir);
1524
1524
  }
1525
1525
  items.forEach((item) => {
1526
- item = path3.join(dir, item);
1526
+ item = path6.join(dir, item);
1527
1527
  remove.removeSync(item);
1528
1528
  });
1529
1529
  }
@@ -1541,7 +1541,7 @@ var require_file = __commonJS({
1541
1541
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/file.js"(exports2, module2) {
1542
1542
  "use strict";
1543
1543
  var u = require_universalify().fromPromise;
1544
- var path3 = require("path");
1544
+ var path6 = require("path");
1545
1545
  var fs3 = require_fs();
1546
1546
  var mkdir = require_mkdirs();
1547
1547
  async function createFile(file4) {
@@ -1551,7 +1551,7 @@ var require_file = __commonJS({
1551
1551
  } catch {
1552
1552
  }
1553
1553
  if (stats && stats.isFile()) return;
1554
- const dir = path3.dirname(file4);
1554
+ const dir = path6.dirname(file4);
1555
1555
  let dirStats = null;
1556
1556
  try {
1557
1557
  dirStats = await fs3.stat(dir);
@@ -1577,7 +1577,7 @@ var require_file = __commonJS({
1577
1577
  } catch {
1578
1578
  }
1579
1579
  if (stats && stats.isFile()) return;
1580
- const dir = path3.dirname(file4);
1580
+ const dir = path6.dirname(file4);
1581
1581
  try {
1582
1582
  if (!fs3.statSync(dir).isDirectory()) {
1583
1583
  fs3.readdirSync(dir);
@@ -1600,7 +1600,7 @@ var require_link = __commonJS({
1600
1600
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/link.js"(exports2, module2) {
1601
1601
  "use strict";
1602
1602
  var u = require_universalify().fromPromise;
1603
- var path3 = require("path");
1603
+ var path6 = require("path");
1604
1604
  var fs3 = require_fs();
1605
1605
  var mkdir = require_mkdirs();
1606
1606
  var { pathExists } = require_path_exists();
@@ -1619,7 +1619,7 @@ var require_link = __commonJS({
1619
1619
  throw err;
1620
1620
  }
1621
1621
  if (dstStat && areIdentical(srcStat, dstStat)) return;
1622
- const dir = path3.dirname(dstpath);
1622
+ const dir = path6.dirname(dstpath);
1623
1623
  const dirExists = await pathExists(dir);
1624
1624
  if (!dirExists) {
1625
1625
  await mkdir.mkdirs(dir);
@@ -1639,7 +1639,7 @@ var require_link = __commonJS({
1639
1639
  err.message = err.message.replace("lstat", "ensureLink");
1640
1640
  throw err;
1641
1641
  }
1642
- const dir = path3.dirname(dstpath);
1642
+ const dir = path6.dirname(dstpath);
1643
1643
  const dirExists = fs3.existsSync(dir);
1644
1644
  if (dirExists) return fs3.linkSync(srcpath, dstpath);
1645
1645
  mkdir.mkdirsSync(dir);
@@ -1656,12 +1656,12 @@ var require_link = __commonJS({
1656
1656
  var require_symlink_paths = __commonJS({
1657
1657
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module2) {
1658
1658
  "use strict";
1659
- var path3 = require("path");
1659
+ var path6 = require("path");
1660
1660
  var fs3 = require_fs();
1661
1661
  var { pathExists } = require_path_exists();
1662
1662
  var u = require_universalify().fromPromise;
1663
1663
  async function symlinkPaths(srcpath, dstpath) {
1664
- if (path3.isAbsolute(srcpath)) {
1664
+ if (path6.isAbsolute(srcpath)) {
1665
1665
  try {
1666
1666
  await fs3.lstat(srcpath);
1667
1667
  } catch (err) {
@@ -1673,8 +1673,8 @@ var require_symlink_paths = __commonJS({
1673
1673
  toDst: srcpath
1674
1674
  };
1675
1675
  }
1676
- const dstdir = path3.dirname(dstpath);
1677
- const relativeToDst = path3.join(dstdir, srcpath);
1676
+ const dstdir = path6.dirname(dstpath);
1677
+ const relativeToDst = path6.join(dstdir, srcpath);
1678
1678
  const exists = await pathExists(relativeToDst);
1679
1679
  if (exists) {
1680
1680
  return {
@@ -1690,11 +1690,11 @@ var require_symlink_paths = __commonJS({
1690
1690
  }
1691
1691
  return {
1692
1692
  toCwd: srcpath,
1693
- toDst: path3.relative(dstdir, srcpath)
1693
+ toDst: path6.relative(dstdir, srcpath)
1694
1694
  };
1695
1695
  }
1696
1696
  function symlinkPathsSync(srcpath, dstpath) {
1697
- if (path3.isAbsolute(srcpath)) {
1697
+ if (path6.isAbsolute(srcpath)) {
1698
1698
  const exists2 = fs3.existsSync(srcpath);
1699
1699
  if (!exists2) throw new Error("absolute srcpath does not exist");
1700
1700
  return {
@@ -1702,8 +1702,8 @@ var require_symlink_paths = __commonJS({
1702
1702
  toDst: srcpath
1703
1703
  };
1704
1704
  }
1705
- const dstdir = path3.dirname(dstpath);
1706
- const relativeToDst = path3.join(dstdir, srcpath);
1705
+ const dstdir = path6.dirname(dstpath);
1706
+ const relativeToDst = path6.join(dstdir, srcpath);
1707
1707
  const exists = fs3.existsSync(relativeToDst);
1708
1708
  if (exists) {
1709
1709
  return {
@@ -1715,7 +1715,7 @@ var require_symlink_paths = __commonJS({
1715
1715
  if (!srcExists) throw new Error("relative srcpath does not exist");
1716
1716
  return {
1717
1717
  toCwd: srcpath,
1718
- toDst: path3.relative(dstdir, srcpath)
1718
+ toDst: path6.relative(dstdir, srcpath)
1719
1719
  };
1720
1720
  }
1721
1721
  module2.exports = {
@@ -1763,7 +1763,7 @@ var require_symlink = __commonJS({
1763
1763
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module2) {
1764
1764
  "use strict";
1765
1765
  var u = require_universalify().fromPromise;
1766
- var path3 = require("path");
1766
+ var path6 = require("path");
1767
1767
  var fs3 = require_fs();
1768
1768
  var { mkdirs, mkdirsSync } = require_mkdirs();
1769
1769
  var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
@@ -1786,7 +1786,7 @@ var require_symlink = __commonJS({
1786
1786
  const relative = await symlinkPaths(srcpath, dstpath);
1787
1787
  srcpath = relative.toDst;
1788
1788
  const toType = await symlinkType(relative.toCwd, type);
1789
- const dir = path3.dirname(dstpath);
1789
+ const dir = path6.dirname(dstpath);
1790
1790
  if (!await pathExists(dir)) {
1791
1791
  await mkdirs(dir);
1792
1792
  }
@@ -1806,7 +1806,7 @@ var require_symlink = __commonJS({
1806
1806
  const relative = symlinkPathsSync(srcpath, dstpath);
1807
1807
  srcpath = relative.toDst;
1808
1808
  type = symlinkTypeSync(relative.toCwd, type);
1809
- const dir = path3.dirname(dstpath);
1809
+ const dir = path6.dirname(dstpath);
1810
1810
  const exists = fs3.existsSync(dir);
1811
1811
  if (exists) return fs3.symlinkSync(srcpath, dstpath, type);
1812
1812
  mkdirsSync(dir);
@@ -1958,18 +1958,18 @@ var require_output_file = __commonJS({
1958
1958
  "use strict";
1959
1959
  var u = require_universalify().fromPromise;
1960
1960
  var fs3 = require_fs();
1961
- var path3 = require("path");
1961
+ var path6 = require("path");
1962
1962
  var mkdir = require_mkdirs();
1963
1963
  var pathExists = require_path_exists().pathExists;
1964
1964
  async function outputFile(file4, data, encoding = "utf-8") {
1965
- const dir = path3.dirname(file4);
1965
+ const dir = path6.dirname(file4);
1966
1966
  if (!await pathExists(dir)) {
1967
1967
  await mkdir.mkdirs(dir);
1968
1968
  }
1969
1969
  return fs3.writeFile(file4, data, encoding);
1970
1970
  }
1971
1971
  function outputFileSync(file4, ...args) {
1972
- const dir = path3.dirname(file4);
1972
+ const dir = path6.dirname(file4);
1973
1973
  if (!fs3.existsSync(dir)) {
1974
1974
  mkdir.mkdirsSync(dir);
1975
1975
  }
@@ -2033,7 +2033,7 @@ var require_move = __commonJS({
2033
2033
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move.js"(exports2, module2) {
2034
2034
  "use strict";
2035
2035
  var fs3 = require_fs();
2036
- var path3 = require("path");
2036
+ var path6 = require("path");
2037
2037
  var { copy } = require_copy2();
2038
2038
  var { remove } = require_remove();
2039
2039
  var { mkdirp } = require_mkdirs();
@@ -2043,8 +2043,8 @@ var require_move = __commonJS({
2043
2043
  const overwrite = opts.overwrite || opts.clobber || false;
2044
2044
  const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
2045
2045
  await stat.checkParentPaths(src, srcStat, dest, "move");
2046
- const destParent = path3.dirname(dest);
2047
- const parsedParentPath = path3.parse(destParent);
2046
+ const destParent = path6.dirname(dest);
2047
+ const parsedParentPath = path6.parse(destParent);
2048
2048
  if (parsedParentPath.root !== destParent) {
2049
2049
  await mkdirp(destParent);
2050
2050
  }
@@ -2085,7 +2085,7 @@ var require_move_sync = __commonJS({
2085
2085
  "../../node_modules/.pnpm/fs-extra@11.3.0/node_modules/fs-extra/lib/move/move-sync.js"(exports2, module2) {
2086
2086
  "use strict";
2087
2087
  var fs3 = require_graceful_fs();
2088
- var path3 = require("path");
2088
+ var path6 = require("path");
2089
2089
  var copySync = require_copy2().copySync;
2090
2090
  var removeSync = require_remove().removeSync;
2091
2091
  var mkdirpSync = require_mkdirs().mkdirpSync;
@@ -2095,12 +2095,12 @@ var require_move_sync = __commonJS({
2095
2095
  const overwrite = opts.overwrite || opts.clobber || false;
2096
2096
  const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
2097
2097
  stat.checkParentPathsSync(src, srcStat, dest, "move");
2098
- if (!isParentRoot(dest)) mkdirpSync(path3.dirname(dest));
2098
+ if (!isParentRoot(dest)) mkdirpSync(path6.dirname(dest));
2099
2099
  return doRename(src, dest, overwrite, isChangingCase);
2100
2100
  }
2101
2101
  function isParentRoot(dest) {
2102
- const parent = path3.dirname(dest);
2103
- const parsedPath = path3.parse(parent);
2102
+ const parent = path6.dirname(dest);
2103
+ const parsedPath = path6.parse(parent);
2104
2104
  return parsedPath.root === parent;
2105
2105
  }
2106
2106
  function doRename(src, dest, overwrite, isChangingCase) {
@@ -2223,8 +2223,9 @@ function getMappings(mappings, datamodel) {
2223
2223
 
2224
2224
  // src/generateClient.ts
2225
2225
  var import_promises = __toESM(require("node:fs/promises"));
2226
- var import_node_path2 = __toESM(require("node:path"));
2227
- var import_internals6 = require("@prisma/internals");
2226
+ var import_node_path4 = __toESM(require("node:path"));
2227
+ var import_fetch_engine = require("@prisma/fetch-engine");
2228
+ var import_internals10 = require("@prisma/internals");
2228
2229
  var import_fast_glob = require("fast-glob");
2229
2230
  var import_fs_extra = __toESM(require_lib());
2230
2231
 
@@ -2384,7 +2385,7 @@ var Enum = class {
2384
2385
  toTS() {
2385
2386
  const { type } = this;
2386
2387
  const enumVariants = `{
2387
- ${(0, import_indent_string.default)(type.data.map((v) => `${v.key}: ${this.getValue(v.value)}`).join(",\n"), TAB_SIZE)}
2388
+ ${(0, import_indent_string.default)(type.values.map((v) => `${v}: ${this.getValue(v)}`).join(",\n"), TAB_SIZE)}
2388
2389
  } as const`;
2389
2390
  const enumBody = this.isStrictEnum() ? `runtime.makeStrictEnum(${enumVariants})` : enumVariants;
2390
2391
  return `export const ${type.name} = ${enumBody}
@@ -2897,6 +2898,9 @@ var GenericArgsInfo = class {
2897
2898
  }
2898
2899
  };
2899
2900
 
2901
+ // src/TSClient/file-generators/BrowserFile.ts
2902
+ var import_internals3 = require("@prisma/internals");
2903
+
2900
2904
  // src/TSClient/ModelExports.ts
2901
2905
  var ts3 = __toESM(require("@prisma/ts-builders"));
2902
2906
  function modelExports(context) {
@@ -2922,7 +2926,9 @@ var jsDocHeader = `/*
2922
2926
  * \u{1F7E2} You can import this file directly.
2923
2927
  */
2924
2928
  `;
2925
- function createBrowserFile(context, _options) {
2929
+ function createBrowserFile(context, options) {
2930
+ const clientEngineType = (0, import_internals3.getClientEngineType)(options.generator);
2931
+ options.generator.config.engineType = clientEngineType;
2926
2932
  return `${jsDocHeader}
2927
2933
  import * as Prisma from '${context.importFileName("./internal/prismaNamespaceBrowser")}'
2928
2934
  export { Prisma }
@@ -2933,14 +2939,50 @@ ${modelExports(context).join("\n")}
2933
2939
  }
2934
2940
 
2935
2941
  // src/TSClient/file-generators/ClassFile.ts
2942
+ var import_node_crypto = __toESM(require("node:crypto"));
2943
+ var import_node_path2 = __toESM(require("node:path"));
2944
+ var import_internals4 = require("@prisma/internals");
2936
2945
  var ts6 = __toESM(require("@prisma/ts-builders"));
2946
+ var import_ci_info = __toESM(require("ci-info"));
2947
+
2948
+ // src/utils/buildInjectableEdgeEnv.ts
2949
+ function buildInjectableEdgeEnv(edge, datasources) {
2950
+ if (edge === true) {
2951
+ return declareInjectableEdgeEnv(datasources);
2952
+ }
2953
+ return ``;
2954
+ }
2955
+ function declareInjectableEdgeEnv(datasources) {
2956
+ const injectableEdgeEnv = { parsed: {} };
2957
+ const envVarNames = getSelectedEnvVarNames(datasources);
2958
+ for (const envVarName of envVarNames) {
2959
+ injectableEdgeEnv.parsed[envVarName] = getRuntimeEdgeEnvVar(envVarName);
2960
+ }
2961
+ const injectableEdgeEnvJson = JSON.stringify(injectableEdgeEnv, null, 2);
2962
+ const injectableEdgeEnvCode = injectableEdgeEnvJson.replace(/"/g, "");
2963
+ return `
2964
+ config.injectableEdgeEnv = () => (${injectableEdgeEnvCode})`;
2965
+ }
2966
+ function getSelectedEnvVarNames(datasources) {
2967
+ return datasources.reduce((acc, datasource) => {
2968
+ if (datasource.url.fromEnvVar) {
2969
+ return [...acc, datasource.url.fromEnvVar];
2970
+ }
2971
+ return acc;
2972
+ }, []);
2973
+ }
2974
+ function getRuntimeEdgeEnvVar(envVarName) {
2975
+ const cfwEnv = `typeof globalThis !== 'undefined' && globalThis['${envVarName}']`;
2976
+ const nodeOrVercelEnv = `typeof process !== 'undefined' && process.env && process.env.${envVarName}`;
2977
+ return `${cfwEnv} || ${nodeOrVercelEnv} || undefined`;
2978
+ }
2937
2979
 
2938
2980
  // src/utils/buildDebugInitialization.ts
2939
2981
  function buildDebugInitialization(edge) {
2940
2982
  if (!edge) {
2941
2983
  return "";
2942
2984
  }
2943
- const debugVar = `typeof globalThis !== 'undefined' && globalThis['DEBUG'] || (typeof process !== 'undefined' && process.env && process.env.DEBUG) || undefined`;
2985
+ const debugVar = getRuntimeEdgeEnvVar("DEBUG");
2944
2986
  return `if (${debugVar}) {
2945
2987
  runtime.Debug.enable(${debugVar})
2946
2988
  }
@@ -3414,7 +3456,7 @@ function escapeJson(str) {
3414
3456
  function buildRuntimeDataModel(datamodel, runtimeName) {
3415
3457
  const runtimeDataModel = (0, import_client_common10.dmmfToRuntimeDataModel)(datamodel);
3416
3458
  let prunedDataModel;
3417
- if (runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
3459
+ if (runtimeName === "wasm-engine-edge" || runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
3418
3460
  prunedDataModel = (0, import_client_common10.pruneRuntimeDataModel)(runtimeDataModel);
3419
3461
  } else {
3420
3462
  prunedDataModel = runtimeDataModel;
@@ -3424,28 +3466,50 @@ function buildRuntimeDataModel(datamodel, runtimeName) {
3424
3466
  config.runtimeDataModel = JSON.parse(${JSON.stringify(datamodelString)})`;
3425
3467
  }
3426
3468
 
3469
+ // src/utils/buildInlineDatasources.ts
3470
+ function buildInlineDatasources(datasources) {
3471
+ return datasources.reduce((acc, ds) => {
3472
+ return acc[ds.name] = buildInlineDatasource(ds), acc;
3473
+ }, {});
3474
+ }
3475
+ function buildInlineDatasource(ds) {
3476
+ if (ds.url.fromEnvVar) {
3477
+ return { url: { fromEnvVar: ds.url.fromEnvVar, value: null } };
3478
+ } else {
3479
+ return { url: { fromEnvVar: null, value: ds.url.value } };
3480
+ }
3481
+ }
3482
+
3427
3483
  // src/utils/wasm.ts
3428
3484
  var import_node_fs = __toESM(require("node:fs"));
3429
3485
  var import_node_path = __toESM(require("node:path"));
3486
+ var import_client_common11 = require("@prisma/client-common");
3430
3487
  var import_debug = require("@prisma/debug");
3431
3488
  var import_ts_pattern = require("ts-pattern");
3432
3489
  var debug = (0, import_debug.Debug)("prisma:client-generator-ts:wasm");
3433
- function usesEdgeWasmRuntime(runtimeName) {
3434
- return runtimeName === "wasm-compiler-edge";
3490
+ function usesEdgeWasmRuntime(component, runtimeName) {
3491
+ return runtimeName === "wasm-engine-edge" && component === "engine" || runtimeName === "wasm-compiler-edge" && component === "compiler";
3435
3492
  }
3436
- function buildGetWasmModule({ runtimeName, runtimeBase, activeProvider, moduleFormat }) {
3493
+ function buildGetWasmModule({
3494
+ component,
3495
+ runtimeName,
3496
+ runtimeBase,
3497
+ activeProvider,
3498
+ moduleFormat
3499
+ }) {
3500
+ const capitalizedComponent = (0, import_client_common11.capitalize)(component);
3437
3501
  const extension = (0, import_ts_pattern.match)(moduleFormat).with("esm", () => "mjs").with("cjs", () => "js").exhaustive();
3438
- const buildNonEdgeLoader = runtimeName === "client";
3439
- const buildEdgeLoader = !buildNonEdgeLoader;
3502
+ const buildNonEdgeLoader = (0, import_ts_pattern.match)(runtimeName).with("library", () => component === "engine" && !!process.env.PRISMA_CLIENT_FORCE_WASM).with("client", () => component === "compiler").otherwise(() => false);
3503
+ const buildEdgeLoader = usesEdgeWasmRuntime(component, runtimeName);
3440
3504
  let wasmPathBase;
3441
3505
  let wasmBindingsPath;
3442
3506
  let wasmModulePath;
3443
3507
  if (buildEdgeLoader) {
3444
- wasmPathBase = `./query_compiler_bg`;
3508
+ wasmPathBase = `./query_${component}_bg`;
3445
3509
  wasmBindingsPath = `${wasmPathBase}.js`;
3446
3510
  wasmModulePath = `${wasmPathBase}.wasm`;
3447
3511
  } else {
3448
- wasmPathBase = `${runtimeBase}/query_compiler_bg.${activeProvider}`;
3512
+ wasmPathBase = `${runtimeBase}/query_${component}_bg.${activeProvider}`;
3449
3513
  wasmBindingsPath = `${wasmPathBase}.mjs`;
3450
3514
  wasmModulePath = `${wasmPathBase}.wasm`;
3451
3515
  }
@@ -3459,26 +3523,26 @@ async function decodeBase64AsWasm(wasmBase64: string): Promise<WebAssembly.Modul
3459
3523
  return new WebAssembly.Module(wasmArray)
3460
3524
  }
3461
3525
 
3462
- config.compilerWasm = {
3526
+ config.${component}Wasm = {
3463
3527
  getRuntime: async () => await import(${JSON.stringify(wasmBindingsPath)}),
3464
3528
 
3465
- getQueryCompilerWasmModule: async () => {
3529
+ getQuery${capitalizedComponent}WasmModule: async () => {
3466
3530
  const { wasm } = await import(${JSON.stringify(wasmModulePath)})
3467
3531
  return await decodeBase64AsWasm(wasm)
3468
3532
  }
3469
3533
  }`;
3470
3534
  }
3471
3535
  if (buildEdgeLoader) {
3472
- return `config.compilerWasm = {
3536
+ return `config.${component}Wasm = {
3473
3537
  getRuntime: async () => await import(${JSON.stringify(wasmBindingsPath)}),
3474
3538
 
3475
- getQueryCompilerWasmModule: async () => {
3539
+ getQuery${capitalizedComponent}WasmModule: async () => {
3476
3540
  const { default: module } = await import(${JSON.stringify(`${wasmModulePath}?module`)})
3477
3541
  return module
3478
3542
  }
3479
3543
  }`;
3480
3544
  }
3481
- return `config.compilerWasm = undefined`;
3545
+ return `config.${component}Wasm = undefined`;
3482
3546
  }
3483
3547
  function readSourceFile(sourceFile) {
3484
3548
  const bundledLocation = import_node_path.default.join(__dirname, sourceFile);
@@ -3496,28 +3560,33 @@ function readSourceFile(sourceFile) {
3496
3560
  function buildWasmFileMap({ activeProvider, runtimeName }) {
3497
3561
  const fileMap = {};
3498
3562
  debug("buildWasmFileMap with", { runtimeName });
3499
- if (!usesEdgeWasmRuntime(runtimeName)) {
3500
- debug("Skipping component compiler for runtime", runtimeName);
3501
- return fileMap;
3502
- }
3503
- const fileNameBase = `query_compiler_bg.${activeProvider}`;
3504
- const files = {
3505
- [`query_compiler_bg.wasm`]: `${fileNameBase}.wasm`,
3506
- [`query_compiler_bg.js`]: `${fileNameBase}.mjs`
3507
- };
3508
- for (const [targetFile, sourceFile] of Object.entries(files)) {
3509
- fileMap[targetFile] = readSourceFile(sourceFile);
3563
+ for (const component of ["engine", "compiler"]) {
3564
+ if (!usesEdgeWasmRuntime(component, runtimeName)) {
3565
+ debug("Skipping component", component, "for runtime", runtimeName);
3566
+ continue;
3567
+ }
3568
+ const fileNameBase = `query_${component}_bg.${activeProvider}`;
3569
+ const files = {
3570
+ [`query_${component}_bg.wasm`]: `${fileNameBase}.wasm`,
3571
+ [`query_${component}_bg.js`]: `${fileNameBase}.mjs`
3572
+ };
3573
+ for (const [targetFile, sourceFile] of Object.entries(files)) {
3574
+ fileMap[targetFile] = readSourceFile(sourceFile);
3575
+ }
3510
3576
  }
3511
3577
  return fileMap;
3512
3578
  }
3513
3579
 
3514
3580
  // src/TSClient/PrismaClient.ts
3515
- var import_client_common11 = require("@prisma/client-common");
3581
+ var import_client_common12 = require("@prisma/client-common");
3516
3582
  var ts5 = __toESM(require("@prisma/ts-builders"));
3517
3583
  var import_indent_string3 = __toESM(require("indent-string"));
3518
3584
 
3519
3585
  // src/utils/runtimeImport.ts
3520
3586
  var ts4 = __toESM(require("@prisma/ts-builders"));
3587
+ function runtimeImport(name) {
3588
+ return name;
3589
+ }
3521
3590
  function runtimeImportedType(name) {
3522
3591
  return ts4.namedType(`runtime.${name}`);
3523
3592
  }
@@ -3591,7 +3660,7 @@ function queryRawDefinition(context) {
3591
3660
  * const result = await prisma.$queryRaw\`SELECT * FROM User WHERE id = \${1} OR email = \${'user@email.com'};\`
3592
3661
  * \`\`\`
3593
3662
  *
3594
- * Read more in our [docs](https://pris.ly/d/raw-queries).
3663
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
3595
3664
  */
3596
3665
  $queryRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<T>;
3597
3666
 
@@ -3603,7 +3672,7 @@ function queryRawDefinition(context) {
3603
3672
  * const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')
3604
3673
  * \`\`\`
3605
3674
  *
3606
- * Read more in our [docs](https://pris.ly/d/raw-queries).
3675
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
3607
3676
  */
3608
3677
  $queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;`;
3609
3678
  }
@@ -3619,7 +3688,7 @@ function executeRawDefinition(context) {
3619
3688
  * const result = await prisma.$executeRaw\`UPDATE User SET cool = \${true} WHERE email = \${'user@email.com'};\`
3620
3689
  * \`\`\`
3621
3690
  *
3622
- * Read more in our [docs](https://pris.ly/d/raw-queries).
3691
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
3623
3692
  */
3624
3693
  $executeRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<number>;
3625
3694
 
@@ -3631,7 +3700,7 @@ function executeRawDefinition(context) {
3631
3700
  * const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')
3632
3701
  * \`\`\`
3633
3702
  *
3634
- * Read more in our [docs](https://pris.ly/d/raw-queries).
3703
+ * Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
3635
3704
  */
3636
3705
  $executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;`;
3637
3706
  }
@@ -3661,6 +3730,24 @@ function queryRawTypedDefinition(context) {
3661
3730
  ).setReturnType(prismaPromise(ts5.array(param.toArgument())));
3662
3731
  return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3663
3732
  }
3733
+ function metricDefinition(context) {
3734
+ if (!context.isPreviewFeatureOn("metrics")) {
3735
+ return "";
3736
+ }
3737
+ const property13 = ts5.property("$metrics", ts5.namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
3738
+ ts5.docComment`
3739
+ Gives access to the client metrics in json or prometheus format.
3740
+
3741
+ @example
3742
+ \`\`\`
3743
+ const metrics = await prisma.$metrics.json()
3744
+ // or
3745
+ const metrics = await prisma.$metrics.prometheus()
3746
+ \`\`\`
3747
+ `
3748
+ ).readonly();
3749
+ return ts5.stringify(property13, { indentLevel: 1, newLine: "leading" });
3750
+ }
3664
3751
  function runCommandRawDefinition(context) {
3665
3752
  if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
3666
3753
  return "";
@@ -3676,10 +3763,17 @@ function runCommandRawDefinition(context) {
3676
3763
  })
3677
3764
  \`\`\`
3678
3765
 
3679
- Read more in our [docs](https://pris.ly/d/raw-queries).
3766
+ Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
3680
3767
  `);
3681
3768
  return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3682
3769
  }
3770
+ function eventRegistrationMethodDeclaration(runtimeName) {
3771
+ if (runtimeName === "binary") {
3772
+ return `$on<V extends (LogOpts | 'beforeExit')>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : V extends 'beforeExit' ? () => runtime.Types.Utils.JsPromise<void> : Prisma.LogEvent) => void): PrismaClient;`;
3773
+ } else {
3774
+ return `$on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;`;
3775
+ }
3776
+ }
3683
3777
  function getPrismaClientClassDocComment({ dmmf }) {
3684
3778
  let example;
3685
3779
  if (dmmf.mappings.modelOperations.length) {
@@ -3697,11 +3791,11 @@ function getPrismaClientClassDocComment({ dmmf }) {
3697
3791
  @example
3698
3792
  \`\`\`
3699
3793
  const prisma = new PrismaClient()
3700
- // Fetch zero or more ${(0, import_client_common11.capitalize)(example.plural)}
3701
- const ${(0, import_client_common11.uncapitalize)(example.plural)} = await prisma.${(0, import_client_common11.uncapitalize)(example.model)}.findMany()
3794
+ // Fetch zero or more ${(0, import_client_common12.capitalize)(example.plural)}
3795
+ const ${(0, import_client_common12.uncapitalize)(example.plural)} = await prisma.${(0, import_client_common12.uncapitalize)(example.model)}.findMany()
3702
3796
  \`\`\`
3703
3797
 
3704
- Read more in our [docs](https://pris.ly/d/client).
3798
+ Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
3705
3799
  `;
3706
3800
  }
3707
3801
  var PrismaClientClass = class {
@@ -3724,18 +3818,18 @@ export interface PrismaClientConstructor {
3724
3818
  LogOpts extends LogOptions<Options> = LogOptions<Options>,
3725
3819
  OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends { omit: infer U } ? U : Prisma.PrismaClientOptions['omit'],
3726
3820
  ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
3727
- >(options: Prisma.Subset<Options, Prisma.PrismaClientOptions> ): PrismaClient<LogOpts, OmitOpts, ExtArgs>
3821
+ >(options?: Prisma.Subset<Options, Prisma.PrismaClientOptions> ): PrismaClient<LogOpts, OmitOpts, ExtArgs>
3728
3822
  }
3729
3823
 
3730
3824
  ${this.jsDoc}
3731
3825
  export interface PrismaClient<
3732
3826
  in LogOpts extends Prisma.LogLevel = never,
3733
- in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = undefined,
3827
+ in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = Prisma.PrismaClientOptions['omit'],
3734
3828
  in out ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
3735
3829
  > {
3736
3830
  [K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
3737
3831
 
3738
- $on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
3832
+ ${eventRegistrationMethodDeclaration(this.runtimeName)}
3739
3833
 
3740
3834
  /**
3741
3835
  * Connect with the database
@@ -3754,12 +3848,14 @@ ${[
3754
3848
  batchingTransactionDefinition(this.context),
3755
3849
  interactiveTransactionDefinition(this.context),
3756
3850
  runCommandRawDefinition(this.context),
3851
+ metricDefinition(this.context),
3852
+ this.applyPendingMigrationsDefinition(),
3757
3853
  extendsPropertyDefinition()
3758
3854
  ].filter((d) => d !== null).join("\n").trim()}
3759
3855
 
3760
3856
  ${(0, import_indent_string3.default)(
3761
3857
  dmmf.mappings.modelOperations.filter((m) => m.findMany).map((m) => {
3762
- let methodName = (0, import_client_common11.uncapitalize)(m.model);
3858
+ let methodName = (0, import_client_common12.uncapitalize)(m.model);
3763
3859
  if (methodName === "constructor") {
3764
3860
  methodName = '["constructor"]';
3765
3861
  }
@@ -3768,8 +3864,8 @@ ${[
3768
3864
  * \`prisma.${methodName}\`: Exposes CRUD operations for the **${m.model}** model.
3769
3865
  * Example usage:
3770
3866
  * \`\`\`ts
3771
- * // Fetch zero or more ${(0, import_client_common11.capitalize)(m.plural)}
3772
- * const ${(0, import_client_common11.uncapitalize)(m.plural)} = await prisma.${methodName}.findMany()
3867
+ * // Fetch zero or more ${(0, import_client_common12.capitalize)(m.plural)}
3868
+ * const ${(0, import_client_common12.uncapitalize)(m.plural)} = await prisma.${methodName}.findMany()
3773
3869
  * \`\`\`
3774
3870
  */
3775
3871
  get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
@@ -3778,6 +3874,15 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
3778
3874
  )}
3779
3875
  }`;
3780
3876
  }
3877
+ applyPendingMigrationsDefinition() {
3878
+ if (this.runtimeName !== "react-native") {
3879
+ return null;
3880
+ }
3881
+ const method3 = ts5.method("$applyPendingMigrations").setReturnType(promise(ts5.voidType)).setDocComment(
3882
+ ts5.docComment`Tries to apply pending migrations one by one. If a migration fails to apply, the function will stop and throw an error. You are responsible for informing the user and possibly blocking the app as we cannot guarantee the state of the database.`
3883
+ );
3884
+ return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
3885
+ }
3781
3886
  };
3782
3887
 
3783
3888
  // src/TSClient/file-generators/ClassFile.ts
@@ -3803,7 +3908,8 @@ ${clientConfig(context, options)}
3803
3908
 
3804
3909
  ${prismaClientClass.toTS()}
3805
3910
 
3806
- export function getPrismaClientClass(): PrismaClientConstructor {
3911
+ export function getPrismaClientClass(dirname: string): PrismaClientConstructor {
3912
+ config.dirname = dirname
3807
3913
  return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor
3808
3914
  }
3809
3915
  `;
@@ -3812,39 +3918,105 @@ function clientConfig(context, options) {
3812
3918
  const {
3813
3919
  edge,
3814
3920
  generator,
3921
+ outputDir,
3815
3922
  datamodel: inlineSchema,
3816
3923
  runtimeBase,
3817
3924
  runtimeName,
3925
+ datasources,
3926
+ copyEngine = true,
3818
3927
  target,
3819
3928
  activeProvider,
3820
3929
  moduleFormat
3821
3930
  } = options;
3931
+ const clientEngineType = (0, import_internals4.getClientEngineType)(generator);
3932
+ generator.config.engineType = clientEngineType;
3933
+ const inlineSchemaHash = import_node_crypto.default.createHash("sha256").update(Buffer.from(inlineSchema, "utf8").toString("base64")).digest("hex");
3934
+ const datasourceFilePath = datasources[0].sourceFilePath;
3822
3935
  const config = {
3823
- previewFeatures: generator.previewFeatures,
3936
+ generator,
3937
+ relativePath: (0, import_internals4.pathToPosix)(import_node_path2.default.relative(outputDir, import_node_path2.default.dirname(datasourceFilePath))),
3824
3938
  clientVersion: options.clientVersion,
3825
3939
  engineVersion: options.engineVersion,
3940
+ datasourceNames: datasources.map((d) => d.name),
3826
3941
  activeProvider: options.activeProvider,
3942
+ postinstall: options.postinstall,
3943
+ ciName: import_ci_info.default.name ?? void 0,
3944
+ inlineDatasources: buildInlineDatasources(datasources),
3827
3945
  inlineSchema,
3828
- runtimeDataModel: { models: {}, enums: {}, types: {} }
3946
+ inlineSchemaHash,
3947
+ copyEngine,
3948
+ runtimeDataModel: { models: {}, enums: {}, types: {} },
3949
+ dirname: ""
3829
3950
  };
3830
3951
  return `
3831
3952
  const config: runtime.GetPrismaClientConfig = ${JSON.stringify(config, null, 2)}
3832
3953
  ${buildRuntimeDataModel(context.dmmf.datamodel, runtimeName)}
3833
- ${buildGetWasmModule({ runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
3954
+ ${buildGetWasmModule({ component: "engine", runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
3955
+ ${buildGetWasmModule({ component: "compiler", runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
3956
+ ${buildInjectableEdgeEnv(edge, datasources)}
3834
3957
  ${buildDebugInitialization(edge)}
3835
3958
  `;
3836
3959
  }
3837
3960
 
3838
3961
  // src/TSClient/file-generators/ClientFile.ts
3962
+ var import_node_path3 = __toESM(require("node:path"));
3963
+ var import_internals6 = require("@prisma/internals");
3839
3964
  var ts7 = __toESM(require("@prisma/ts-builders"));
3965
+
3966
+ // src/utils/buildNFTAnnotations.ts
3967
+ var import_get_platform = require("@prisma/get-platform");
3968
+ var import_internals5 = require("@prisma/internals");
3969
+ var import_path = __toESM(require("path"));
3970
+ function buildNFTAnnotations(noEngine, engineType, binaryTargets, relativeOutdir) {
3971
+ if (noEngine === true) return "";
3972
+ if (binaryTargets === void 0) {
3973
+ return "";
3974
+ }
3975
+ if (process.env.NETLIFY) {
3976
+ const isNodeMajor20OrUp = parseInt(process.versions.node.split(".")[0]) >= 20;
3977
+ const awsRuntimeVersion = (0, import_internals5.parseAWSNodejsRuntimeEnvVarVersion)();
3978
+ const isRuntimeEnvVar20OrUp = awsRuntimeVersion && awsRuntimeVersion >= 20;
3979
+ const isRuntimeEnvVar18OrDown = awsRuntimeVersion && awsRuntimeVersion <= 18;
3980
+ if ((isNodeMajor20OrUp || isRuntimeEnvVar20OrUp) && !isRuntimeEnvVar18OrDown) {
3981
+ binaryTargets = ["rhel-openssl-3.0.x"];
3982
+ } else {
3983
+ binaryTargets = ["rhel-openssl-1.0.x"];
3984
+ }
3985
+ }
3986
+ const engineAnnotations = binaryTargets.map((binaryTarget) => {
3987
+ const engineFilename = getQueryEngineFilename(engineType, binaryTarget);
3988
+ return engineFilename ? buildNFTAnnotation(engineFilename, relativeOutdir) : "";
3989
+ }).join("\n");
3990
+ return `${engineAnnotations}`;
3991
+ }
3992
+ function getQueryEngineFilename(engineType, binaryTarget) {
3993
+ if (engineType === import_internals5.ClientEngineType.Library) {
3994
+ return (0, import_get_platform.getNodeAPIName)(binaryTarget, "fs");
3995
+ }
3996
+ if (engineType === import_internals5.ClientEngineType.Binary) {
3997
+ return `query-engine-${binaryTarget}`;
3998
+ }
3999
+ return void 0;
4000
+ }
4001
+ function buildNFTAnnotation(fileName, relativeOutdir) {
4002
+ const relativeFilePath = import_path.default.join(relativeOutdir, fileName);
4003
+ return `
4004
+ // file annotations for bundling tools to include these files
4005
+ path.join(__dirname, ${JSON.stringify((0, import_internals5.pathToPosix)(fileName))})
4006
+ path.join(process.cwd(), ${JSON.stringify((0, import_internals5.pathToPosix)(relativeFilePath))})`;
4007
+ }
4008
+
4009
+ // src/TSClient/file-generators/ClientFile.ts
3840
4010
  var jsDocHeader3 = `/*
3841
4011
  * This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
3842
4012
  * If you're looking for something you can import in the client-side of your application, please refer to the \`browser.ts\` file instead.
3843
- *
4013
+ *
3844
4014
  * \u{1F7E2} You can import this file directly.
3845
4015
  */
3846
4016
  `;
3847
4017
  function createClientFile(context, options) {
4018
+ const clientEngineType = (0, import_internals6.getClientEngineType)(options.generator);
4019
+ options.generator.config.engineType = clientEngineType;
3848
4020
  const imports = [
3849
4021
  ts7.moduleImport(context.runtimeImport).asNamespace("runtime"),
3850
4022
  ts7.moduleImport(context.importFileName("./enums")).asNamespace("$Enums"),
@@ -3854,7 +4026,9 @@ function createClientFile(context, options) {
3854
4026
  const exports2 = [
3855
4027
  ts7.moduleExportFrom(context.importFileName("./enums")).asNamespace("$Enums"),
3856
4028
  ts7.moduleExportFrom(context.importFileName("./enums")),
3857
- ts7.moduleExport(ts7.constDeclaration("PrismaClient").setValue(ts7.functionCall("$Class.getPrismaClientClass", []))).setDocComment(getPrismaClientClassDocComment(context)),
4029
+ ts7.moduleExport(
4030
+ ts7.constDeclaration("PrismaClient").setValue(ts7.functionCall("$Class.getPrismaClientClass", [ts7.namedValue("__dirname")]))
4031
+ ).setDocComment(getPrismaClientClassDocComment(context)),
3858
4032
  ts7.moduleExport(
3859
4033
  ts7.typeDeclaration(
3860
4034
  "PrismaClient",
@@ -3868,6 +4042,8 @@ function createClientFile(context, options) {
3868
4042
  )
3869
4043
  )
3870
4044
  ].map((e) => ts7.stringify(e));
4045
+ const binaryTargets = clientEngineType === import_internals6.ClientEngineType.Library ? Object.keys(options.binaryPaths.libqueryEngine ?? {}) : Object.keys(options.binaryPaths.queryEngine ?? {});
4046
+ const relativeOutdir = import_node_path3.default.relative(process.cwd(), options.outputDir);
3871
4047
  return `${jsDocHeader3}
3872
4048
  ${buildPreamble(options.edge, options.moduleFormat)}
3873
4049
  ${imports.join("\n")}
@@ -3875,6 +4051,8 @@ ${imports.join("\n")}
3875
4051
  ${exports2.join("\n")}
3876
4052
  export { Prisma }
3877
4053
 
4054
+ ${buildNFTAnnotations(options.edge || !options.copyEngine, clientEngineType, binaryTargets, relativeOutdir)}
4055
+
3878
4056
  ${modelExports(context).join("\n")}
3879
4057
  `;
3880
4058
  }
@@ -3946,7 +4124,7 @@ export {}
3946
4124
  var ts15 = __toESM(require("@prisma/ts-builders"));
3947
4125
 
3948
4126
  // src/TSClient/Model.ts
3949
- var import_client_common15 = require("@prisma/client-common");
4127
+ var import_client_common16 = require("@prisma/client-common");
3950
4128
  var DMMF2 = __toESM(require("@prisma/dmmf"));
3951
4129
  var ts14 = __toESM(require("@prisma/ts-builders"));
3952
4130
  var import_indent_string5 = __toESM(require("indent-string"));
@@ -4032,15 +4210,15 @@ var ArgsTypeBuilder = class {
4032
4210
  };
4033
4211
 
4034
4212
  // src/TSClient/Count.ts
4035
- var import_client_common12 = require("@prisma/client-common");
4213
+ var import_client_common13 = require("@prisma/client-common");
4036
4214
  var ts11 = __toESM(require("@prisma/ts-builders"));
4037
4215
  var import_indent_string4 = __toESM(require("indent-string"));
4038
4216
 
4039
4217
  // src/TSClient/Output.ts
4040
- var import_internals3 = require("@prisma/internals");
4218
+ var import_internals7 = require("@prisma/internals");
4041
4219
  var ts10 = __toESM(require("@prisma/ts-builders"));
4042
4220
  function buildModelOutputProperty(field, dmmf) {
4043
- let fieldTypeName = (0, import_internals3.hasOwnProperty)(GraphQLScalarToJSTypeTable, field.type) ? GraphQLScalarToJSTypeTable[field.type] : field.type;
4221
+ let fieldTypeName = (0, import_internals7.hasOwnProperty)(GraphQLScalarToJSTypeTable, field.type) ? GraphQLScalarToJSTypeTable[field.type] : field.type;
4044
4222
  if (Array.isArray(fieldTypeName)) {
4045
4223
  fieldTypeName = fieldTypeName[0];
4046
4224
  }
@@ -4151,7 +4329,7 @@ ${this.argsTypes.map((typeExport) => ts11.stringify(typeExport)).join("\n\n")}
4151
4329
  }
4152
4330
  };
4153
4331
  function getCountArgsType(typeName, fieldName) {
4154
- return `${typeName}Count${(0, import_client_common12.capitalize)(fieldName)}Args`;
4332
+ return `${typeName}Count${(0, import_client_common13.capitalize)(fieldName)}Args`;
4155
4333
  }
4156
4334
 
4157
4335
  // src/TSClient/ModelFieldRefs.ts
@@ -4182,7 +4360,7 @@ ${this.stringifyFields()}
4182
4360
  };
4183
4361
 
4184
4362
  // src/TSClient/Payload.ts
4185
- var import_client_common13 = require("@prisma/client-common");
4363
+ var import_client_common14 = require("@prisma/client-common");
4186
4364
  var ts12 = __toESM(require("@prisma/ts-builders"));
4187
4365
  function buildModelPayload(model, context) {
4188
4366
  const isComposite = context.dmmf.isComposite(model.name);
@@ -4200,7 +4378,7 @@ function buildModelPayload(model, context) {
4200
4378
  scalars.add(buildModelOutputProperty(field, context.dmmf));
4201
4379
  }
4202
4380
  }
4203
- const scalarsType = isComposite ? scalars : ts12.namedType("runtime.Types.Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts12.namedType("ExtArgs").subKey("result").subKey((0, import_client_common13.uncapitalize)(model.name)));
4381
+ const scalarsType = isComposite ? scalars : ts12.namedType("runtime.Types.Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts12.namedType("ExtArgs").subKey("result").subKey((0, import_client_common14.uncapitalize)(model.name)));
4204
4382
  const payloadTypeDeclaration = ts12.typeDeclaration(
4205
4383
  getPayloadName(model.name, false),
4206
4384
  ts12.objectType().add(ts12.property("name", ts12.stringLiteral(model.name))).add(ts12.property("objects", objects)).add(ts12.property("scalars", scalarsType)).add(ts12.property("composites", composites))
@@ -4212,7 +4390,7 @@ function buildModelPayload(model, context) {
4212
4390
  }
4213
4391
 
4214
4392
  // src/TSClient/SelectIncludeOmit.ts
4215
- var import_client_common14 = require("@prisma/client-common");
4393
+ var import_client_common15 = require("@prisma/client-common");
4216
4394
  var ts13 = __toESM(require("@prisma/ts-builders"));
4217
4395
  function buildIncludeType({
4218
4396
  modelName,
@@ -4246,7 +4424,7 @@ function buildSelectType({
4246
4424
  return buildExport(typeName, selectType);
4247
4425
  }
4248
4426
  function modelResultExtensionsType(modelName) {
4249
- return extArgsParam.toArgument().subKey("result").subKey((0, import_client_common14.uncapitalize)(modelName));
4427
+ return extArgsParam.toArgument().subKey("result").subKey((0, import_client_common15.uncapitalize)(modelName));
4250
4428
  }
4251
4429
  function buildScalarSelectType({ modelName, fields, context }) {
4252
4430
  const object = buildSelectOrIncludeObject(
@@ -4815,7 +4993,7 @@ function getNonAggregateMethodDependencyValidations(modelMapping, actionName, co
4815
4993
  objectType11.add(ts14.property(reqArg, ts14.objectType()));
4816
4994
  }
4817
4995
  validators.push(
4818
- ts14.genericParameter(`${(0, import_client_common15.capitalize)(args.name)}DependenciesValidator`).extends(
4996
+ ts14.genericParameter(`${(0, import_client_common16.capitalize)(args.name)}DependenciesValidator`).extends(
4819
4997
  ts14.conditionalType().check(ts14.stringLiteral(args.name)).extends(ts14.namedType("Prisma.Keys<T>")).then(objectType11).else(ts14.objectType())
4820
4998
  )
4821
4999
  );
@@ -4975,36 +5153,33 @@ function createModelsFile(context, modelsNames) {
4975
5153
  }
4976
5154
 
4977
5155
  // src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
4978
- var import_dmmf2 = require("@prisma/dmmf");
4979
5156
  var ts16 = __toESM(require("@prisma/ts-builders"));
4980
5157
 
4981
5158
  // src/TSClient/NullTypes.ts
4982
5159
  var nullTypes = `
4983
5160
  export const NullTypes = {
4984
- DbNull: runtime.NullTypes.DbNull as (new (secret: never) => typeof runtime.DbNull),
4985
- JsonNull: runtime.NullTypes.JsonNull as (new (secret: never) => typeof runtime.JsonNull),
4986
- AnyNull: runtime.NullTypes.AnyNull as (new (secret: never) => typeof runtime.AnyNull),
5161
+ DbNull: runtime.objectEnumValues.classes.DbNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.DbNull),
5162
+ JsonNull: runtime.objectEnumValues.classes.JsonNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.JsonNull),
5163
+ AnyNull: runtime.objectEnumValues.classes.AnyNull as (new (secret: never) => typeof runtime.objectEnumValues.instances.AnyNull),
4987
5164
  }
4988
5165
  /**
4989
5166
  * Helper for filtering JSON entries that have \`null\` on the database (empty on the db)
4990
5167
  *
4991
5168
  * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
4992
5169
  */
4993
- export const DbNull = runtime.DbNull
4994
-
5170
+ export const DbNull = runtime.objectEnumValues.instances.DbNull
4995
5171
  /**
4996
5172
  * Helper for filtering JSON entries that have JSON \`null\` values (not empty on the db)
4997
5173
  *
4998
5174
  * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
4999
5175
  */
5000
- export const JsonNull = runtime.JsonNull
5001
-
5176
+ export const JsonNull = runtime.objectEnumValues.instances.JsonNull
5002
5177
  /**
5003
5178
  * Helper for filtering JSON entries that are \`Prisma.DbNull\` or \`Prisma.JsonNull\`
5004
5179
  *
5005
5180
  * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
5006
5181
  */
5007
- export const AnyNull = runtime.AnyNull
5182
+ export const AnyNull = runtime.objectEnumValues.instances.AnyNull
5008
5183
  `;
5009
5184
 
5010
5185
  // src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
@@ -5021,9 +5196,7 @@ var jsDocHeader7 = `/*
5021
5196
  */
5022
5197
  `;
5023
5198
  function createPrismaNamespaceBrowserFile(context) {
5024
- const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
5025
- (datamodelEnum) => new Enum((0, import_dmmf2.datamodelSchemaEnumToSchemaEnum)(datamodelEnum), false).toTS()
5026
- );
5199
+ const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
5027
5200
  return `${jsDocHeader7}
5028
5201
  ${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
5029
5202
 
@@ -5037,10 +5210,7 @@ ${nullTypes}
5037
5210
  ${new Enum(
5038
5211
  {
5039
5212
  name: "ModelName",
5040
- data: context.dmmf.mappings.modelOperations.map((m) => ({
5041
- key: m.model,
5042
- value: m.model
5043
- }))
5213
+ values: context.dmmf.mappings.modelOperations.map((m) => m.model)
5044
5214
  },
5045
5215
  true
5046
5216
  ).toTS()}
@@ -5053,7 +5223,6 @@ ${prismaEnums?.join("\n\n")}
5053
5223
  }
5054
5224
 
5055
5225
  // src/TSClient/file-generators/PrismaNamespaceFile.ts
5056
- var import_dmmf3 = require("@prisma/dmmf");
5057
5226
  var ts19 = __toESM(require("@prisma/ts-builders"));
5058
5227
 
5059
5228
  // src/TSClient/common.ts
@@ -5101,6 +5270,14 @@ export type Decimal = runtime.Decimal
5101
5270
 
5102
5271
  export type DecimalJsLike = runtime.DecimalJsLike
5103
5272
 
5273
+ /**
5274
+ * Metrics
5275
+ */
5276
+ export type Metrics = runtime.Metrics
5277
+ export type Metric<T> = runtime.Metric<T>
5278
+ export type MetricHistogram = runtime.MetricHistogram
5279
+ export type MetricHistogramBucket = runtime.MetricHistogramBucket
5280
+
5104
5281
  /**
5105
5282
  * Extensions
5106
5283
  */
@@ -5407,6 +5584,25 @@ export const skip = runtime.skip
5407
5584
  return "";
5408
5585
  }
5409
5586
 
5587
+ // src/TSClient/Datasources.ts
5588
+ var import_indent_string6 = __toESM(require("indent-string"));
5589
+ var Datasources = class {
5590
+ constructor(internalDatasources) {
5591
+ this.internalDatasources = internalDatasources;
5592
+ }
5593
+ toTS() {
5594
+ const sources = this.internalDatasources;
5595
+ return `
5596
+ export type Datasource = {
5597
+ url?: string
5598
+ }
5599
+ export type Datasources = {
5600
+ ${(0, import_indent_string6.default)(sources.map((s) => `${s.name}?: Datasource`).join("\n"), 2)}
5601
+ }
5602
+ `;
5603
+ }
5604
+ };
5605
+
5410
5606
  // src/TSClient/FieldRefInput.ts
5411
5607
  var FieldRefInput = class {
5412
5608
  constructor(type) {
@@ -5427,21 +5623,21 @@ export type ${this.type.name}<$PrismaModel> = FieldRefInputType<$PrismaModel, ${
5427
5623
  };
5428
5624
 
5429
5625
  // src/TSClient/globalOmit.ts
5430
- var import_client_common16 = require("@prisma/client-common");
5626
+ var import_client_common17 = require("@prisma/client-common");
5431
5627
  var ts17 = __toESM(require("@prisma/ts-builders"));
5432
5628
  function globalOmitConfig(dmmf) {
5433
5629
  const objectType11 = ts17.objectType().addMultiple(
5434
5630
  dmmf.datamodel.models.map((model) => {
5435
5631
  const type = ts17.namedType(`Prisma.${getOmitName(model.name)}`);
5436
- return ts17.property((0, import_client_common16.uncapitalize)(model.name), type).optional();
5632
+ return ts17.property((0, import_client_common17.uncapitalize)(model.name), type).optional();
5437
5633
  })
5438
5634
  );
5439
5635
  return ts17.moduleExport(ts17.typeDeclaration("GlobalOmitConfig", objectType11));
5440
5636
  }
5441
5637
 
5442
5638
  // src/TSClient/TypeMap.ts
5443
- var import_client_common17 = require("@prisma/client-common");
5444
- var import_internals4 = require("@prisma/internals");
5639
+ var import_client_common18 = require("@prisma/client-common");
5640
+ var import_internals8 = require("@prisma/internals");
5445
5641
  var ts18 = __toESM(require("@prisma/ts-builders"));
5446
5642
  function clientTypeMapDefinition(context) {
5447
5643
  const typeMap = `${ts18.stringify(clientTypeMapModelsDefinition(context))} & ${clientTypeMapOthersDefinition(context)}`;
@@ -5458,7 +5654,7 @@ function clientTypeMapModelsDefinition(context) {
5458
5654
  if (modelNames.length === 0) {
5459
5655
  meta.add(ts18.property("modelProps", ts18.neverType));
5460
5656
  } else {
5461
- meta.add(ts18.property("modelProps", ts18.unionType(modelNames.map((name) => ts18.stringLiteral((0, import_client_common17.uncapitalize)(name))))));
5657
+ meta.add(ts18.property("modelProps", ts18.unionType(modelNames.map((name) => ts18.stringLiteral((0, import_client_common18.uncapitalize)(name))))));
5462
5658
  }
5463
5659
  const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? ts18.namedType("TransactionIsolationLevel") : ts18.neverType;
5464
5660
  meta.add(ts18.property("txIsolationLevel", isolationLevel));
@@ -5541,7 +5737,7 @@ function clientTypeMapModelsResultDefinition(modelName, action) {
5541
5737
  if (action === "update") return payloadToResult(modelName);
5542
5738
  if (action === "upsert") return payloadToResult(modelName);
5543
5739
  if (action === "delete") return payloadToResult(modelName);
5544
- (0, import_internals4.assertNever)(action, `Unknown action: ${action}`);
5740
+ (0, import_internals8.assertNever)(action, `Unknown action: ${action}`);
5545
5741
  }
5546
5742
  function payloadToResult(modelName) {
5547
5743
  return ts18.namedType("runtime.Types.Utils.PayloadToResult").addGenericArgument(ts18.namedType(getPayloadName(modelName)));
@@ -5566,9 +5762,7 @@ function createPrismaNamespaceFile(context, options) {
5566
5762
  ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
5567
5763
  ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
5568
5764
  ].map((i) => ts19.stringify(i));
5569
- const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
5570
- (type) => new Enum((0, import_dmmf3.datamodelSchemaEnumToSchemaEnum)(type), true).toTS()
5571
- );
5765
+ const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map((type) => new Enum(type, true).toTS());
5572
5766
  const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
5573
5767
  return `${jsDocHeader8}
5574
5768
  ${imports.join("\n")}
@@ -5579,10 +5773,7 @@ ${commonCodeTS(options)}
5579
5773
  ${new Enum(
5580
5774
  {
5581
5775
  name: "ModelName",
5582
- data: context.dmmf.mappings.modelOperations.map((m) => ({
5583
- key: m.model,
5584
- value: m.model
5585
- }))
5776
+ values: context.dmmf.mappings.modelOperations.map((m) => m.model)
5586
5777
  },
5587
5778
  true
5588
5779
  ).toTS()}
@@ -5609,10 +5800,11 @@ export type BatchPayload = {
5609
5800
  count: number
5610
5801
  }
5611
5802
 
5803
+ ${new Datasources(options.datasources).toTS()}
5612
5804
  ${clientExtensionsDefinitions()}
5613
5805
  export type DefaultPrismaClient = PrismaClient
5614
5806
  export type ErrorFormat = 'pretty' | 'colorless' | 'minimal'
5615
- ${ts19.stringify(ts19.moduleExport(buildClientOptions(context)))}
5807
+ ${ts19.stringify(ts19.moduleExport(buildClientOptions(context, options)))}
5616
5808
  ${ts19.stringify(globalOmitConfig(context.dmmf))}
5617
5809
 
5618
5810
  /* Types for Logging */
@@ -5688,19 +5880,12 @@ function clientExtensionsDefinitions() {
5688
5880
  );
5689
5881
  return ts19.stringify(define);
5690
5882
  }
5691
- function buildClientOptions(context) {
5692
- const adapterOption = ts19.objectType().add(
5693
- ts19.property("adapter", ts19.namedType("runtime.SqlDriverAdapterFactory")).setDocComment(ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-pg`."))
5694
- ).add(ts19.property("accelerateUrl", ts19.neverType).optional());
5695
- const accelerateUrlOption = ts19.objectType().add(
5696
- ts19.property("accelerateUrl", ts19.stringType).setDocComment(
5697
- ts19.docComment(
5698
- "Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database."
5699
- )
5700
- )
5701
- ).add(ts19.property("adapter", ts19.neverType).optional());
5702
- const mutuallyExclusiveOptions = ts19.unionType([adapterOption, accelerateUrlOption]);
5703
- const otherOptions = ts19.objectType().add(
5883
+ function buildClientOptions(context, options) {
5884
+ const clientOptions = ts19.interfaceDeclaration("PrismaClientOptions").add(
5885
+ ts19.property("datasources", ts19.namedType("Datasources")).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
5886
+ ).add(
5887
+ ts19.property("datasourceUrl", ts19.stringType).optional().setDocComment(ts19.docComment("Overwrites the datasource url from your schema.prisma file"))
5888
+ ).add(
5704
5889
  ts19.property("errorFormat", ts19.namedType("ErrorFormat")).optional().setDocComment(ts19.docComment('@default "colorless"'))
5705
5890
  ).add(
5706
5891
  ts19.property("log", ts19.array(ts19.unionType([ts19.namedType("LogLevel"), ts19.namedType("LogDefinition")]))).optional().setDocComment(ts19.docComment`
@@ -5725,21 +5910,28 @@ function buildClientOptions(context) {
5725
5910
  { emit: 'stdout', level: 'error' }
5726
5911
  ]
5727
5912
  \`\`\`
5728
- Read more in our [docs](https://pris.ly/d/logging).
5913
+ Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/logging#the-log-option).
5729
5914
  `)
5730
5915
  );
5731
5916
  const transactionOptions = ts19.objectType().add(ts19.property("maxWait", ts19.numberType).optional()).add(ts19.property("timeout", ts19.numberType).optional());
5732
5917
  if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
5733
5918
  transactionOptions.add(ts19.property("isolationLevel", ts19.namedType("TransactionIsolationLevel")).optional());
5734
5919
  }
5735
- otherOptions.add(
5920
+ clientOptions.add(
5736
5921
  ts19.property("transactionOptions", transactionOptions).optional().setDocComment(ts19.docComment`
5737
5922
  The default values for transactionOptions
5738
5923
  maxWait ?= 2000
5739
5924
  timeout ?= 5000
5740
5925
  `)
5741
5926
  );
5742
- otherOptions.add(
5927
+ if (["library", "client", "wasm-compiler-edge", "wasm-engine-edge"].includes(options.runtimeName)) {
5928
+ clientOptions.add(
5929
+ ts19.property("adapter", ts19.unionType([ts19.namedType("runtime.SqlDriverAdapterFactory"), ts19.namedType("null")])).optional().setDocComment(
5930
+ ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-planetscale`")
5931
+ )
5932
+ );
5933
+ }
5934
+ clientOptions.add(
5743
5935
  ts19.property("omit", ts19.namedType("GlobalOmitConfig")).optional().setDocComment(ts19.docComment`
5744
5936
  Global configuration for omitting model fields by default.
5745
5937
 
@@ -5755,27 +5947,7 @@ function buildClientOptions(context) {
5755
5947
  \`\`\`
5756
5948
  `)
5757
5949
  );
5758
- if (context.isSqlProvider()) {
5759
- otherOptions.add(
5760
- ts19.property("comments", ts19.array(ts19.namedType("runtime.SqlCommenterPlugin"))).optional().setDocComment(ts19.docComment`
5761
- SQL commenter plugins that add metadata to SQL queries as comments.
5762
- Comments follow the sqlcommenter format: https://google.github.io/sqlcommenter/
5763
-
5764
- @example
5765
- \`\`\`
5766
- const prisma = new PrismaClient({
5767
- adapter,
5768
- comments: [
5769
- traceContext(),
5770
- queryInsights(),
5771
- ],
5772
- })
5773
- \`\`\`
5774
- `)
5775
- );
5776
- }
5777
- const prismaClientOptions = ts19.intersectionType([mutuallyExclusiveOptions, otherOptions]);
5778
- return ts19.typeDeclaration("PrismaClientOptions", prismaClientOptions);
5950
+ return clientOptions;
5779
5951
  }
5780
5952
 
5781
5953
  // src/TSClient/GenerateContext.ts
@@ -5787,32 +5959,26 @@ var GenerateContext = class {
5787
5959
  outputFileName;
5788
5960
  importFileName;
5789
5961
  generator;
5790
- provider;
5791
5962
  constructor({
5792
5963
  dmmf,
5793
5964
  genericArgsInfo,
5794
5965
  runtimeBase,
5795
- runtimeImport,
5966
+ runtimeImport: runtimeImport2,
5796
5967
  outputFileName,
5797
5968
  importFileName,
5798
- generator,
5799
- provider
5969
+ generator
5800
5970
  }) {
5801
5971
  this.dmmf = dmmf;
5802
5972
  this.genericArgsInfo = genericArgsInfo;
5803
5973
  this.runtimeBase = runtimeBase;
5804
- this.runtimeImport = runtimeImport;
5974
+ this.runtimeImport = runtimeImport2;
5805
5975
  this.outputFileName = outputFileName;
5806
5976
  this.importFileName = importFileName;
5807
5977
  this.generator = generator;
5808
- this.provider = provider;
5809
5978
  }
5810
5979
  isPreviewFeatureOn(previewFeature) {
5811
5980
  return this.generator?.previewFeatures?.includes(previewFeature) ?? false;
5812
5981
  }
5813
- isSqlProvider() {
5814
- return this.provider !== "mongodb";
5815
- }
5816
5982
  };
5817
5983
 
5818
5984
  // src/TSClient/TSClient.ts
@@ -5832,8 +5998,7 @@ var TSClient = class {
5832
5998
  runtimeImport: `${this.options.runtimeBase}/${this.options.runtimeName}`,
5833
5999
  outputFileName: generatedFileNameMapper(this.options.generatedFileExtension),
5834
6000
  importFileName: importFileNameMapper(this.options.importFileExtension),
5835
- generator: this.options.generator,
5836
- provider: this.options.activeProvider
6001
+ generator: this.options.generator
5837
6002
  });
5838
6003
  const modelNames = Object.values(context.dmmf.typeAndModelMap).filter((model) => context.dmmf.outputTypeMap.model[model.name]).map((model) => model.name);
5839
6004
  const modelsFileMap = modelNames.reduce((acc, modelName) => {
@@ -5857,7 +6022,7 @@ var TSClient = class {
5857
6022
  };
5858
6023
 
5859
6024
  // src/typedSql/buildDbEnums.ts
5860
- var import_internals5 = require("@prisma/internals");
6025
+ var import_internals9 = require("@prisma/internals");
5861
6026
  var ts20 = __toESM(require("@prisma/ts-builders"));
5862
6027
  var DbEnumsList = class {
5863
6028
  enums;
@@ -5875,14 +6040,14 @@ var DbEnumsList = class {
5875
6040
  }
5876
6041
  *validJsIdentifiers() {
5877
6042
  for (const dbEnum of this.enums) {
5878
- if ((0, import_internals5.isValidJsIdentifier)(dbEnum.name)) {
6043
+ if ((0, import_internals9.isValidJsIdentifier)(dbEnum.name)) {
5879
6044
  yield dbEnum;
5880
6045
  }
5881
6046
  }
5882
6047
  }
5883
6048
  *invalidJsIdentifiers() {
5884
6049
  for (const dbEnum of this.enums) {
5885
- if (!(0, import_internals5.isValidJsIdentifier)(dbEnum.name)) {
6050
+ if (!(0, import_internals9.isValidJsIdentifier)(dbEnum.name)) {
5886
6051
  yield dbEnum;
5887
6052
  }
5888
6053
  }
@@ -6113,7 +6278,7 @@ var DenylistError = class extends Error {
6113
6278
  this.stack = void 0;
6114
6279
  }
6115
6280
  };
6116
- (0, import_internals6.setClassName)(DenylistError, "DenylistError");
6281
+ (0, import_internals10.setClassName)(DenylistError, "DenylistError");
6117
6282
  function buildClient({
6118
6283
  schemaPath,
6119
6284
  runtimeBase,
@@ -6126,6 +6291,9 @@ function buildClient({
6126
6291
  engineVersion,
6127
6292
  clientVersion,
6128
6293
  activeProvider,
6294
+ postinstall,
6295
+ copyEngine,
6296
+ envPaths,
6129
6297
  typedSql,
6130
6298
  target,
6131
6299
  generatedFileExtension,
@@ -6133,11 +6301,13 @@ function buildClient({
6133
6301
  moduleFormat,
6134
6302
  tsNoCheckPreamble: tsNoCheckPreamble2
6135
6303
  }) {
6136
- const runtimeName = getRuntimeNameForTarget(target);
6304
+ const clientEngineType = (0, import_internals10.getClientEngineType)(generator);
6305
+ const runtimeName = getRuntimeNameForTarget(target, clientEngineType);
6137
6306
  const outputName = generatedFileNameMapper(generatedFileExtension);
6138
6307
  const importName = importFileNameMapper(importFileExtension);
6139
6308
  const clientOptions = {
6140
6309
  dmmf: getPrismaClientDMMF(dmmf),
6310
+ envPaths: envPaths ?? { rootEnvPath: null, schemaEnvPath: void 0 },
6141
6311
  datasources,
6142
6312
  generator,
6143
6313
  binaryPaths,
@@ -6147,8 +6317,10 @@ function buildClient({
6147
6317
  clientVersion,
6148
6318
  engineVersion,
6149
6319
  activeProvider,
6320
+ postinstall,
6321
+ copyEngine,
6150
6322
  datamodel,
6151
- edge: ["wasm-compiler-edge"].includes(runtimeName),
6323
+ edge: ["edge", "wasm-engine-edge", "wasm-compiler-edge", "react-native"].includes(runtimeName),
6152
6324
  runtimeName,
6153
6325
  target,
6154
6326
  generatedFileExtension,
@@ -6156,6 +6328,9 @@ function buildClient({
6156
6328
  moduleFormat,
6157
6329
  tsNoCheckPreamble: tsNoCheckPreamble2
6158
6330
  };
6331
+ if (runtimeName === "react-native" && !generator.previewFeatures.includes("reactNative")) {
6332
+ throw new Error(`Using the "react-native" runtime requires the "reactNative" preview feature to be enabled.`);
6333
+ }
6159
6334
  const client = new TSClient(clientOptions);
6160
6335
  let fileMap = client.generateClientFiles();
6161
6336
  if (typedSql && typedSql.length > 0) {
@@ -6209,6 +6384,9 @@ async function generateClient(options) {
6209
6384
  clientVersion,
6210
6385
  engineVersion,
6211
6386
  activeProvider,
6387
+ postinstall,
6388
+ envPaths,
6389
+ copyEngine = true,
6212
6390
  typedSql,
6213
6391
  target,
6214
6392
  generatedFileExtension,
@@ -6216,6 +6394,7 @@ async function generateClient(options) {
6216
6394
  moduleFormat,
6217
6395
  tsNoCheckPreamble: tsNoCheckPreamble2
6218
6396
  } = options;
6397
+ const clientEngineType = (0, import_internals10.getClientEngineType)(generator);
6219
6398
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
6220
6399
  const { prismaClientDmmf, fileMap } = buildClient({
6221
6400
  datamodel,
@@ -6229,6 +6408,9 @@ async function generateClient(options) {
6229
6408
  clientVersion,
6230
6409
  engineVersion,
6231
6410
  activeProvider,
6411
+ postinstall,
6412
+ copyEngine,
6413
+ envPaths,
6232
6414
  typedSql,
6233
6415
  target,
6234
6416
  generatedFileExtension,
@@ -6252,11 +6434,27 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
6252
6434
  await deleteOutputDir(outputDir);
6253
6435
  await (0, import_fs_extra.ensureDir)(outputDir);
6254
6436
  await writeFileMap(outputDir, fileMap);
6437
+ const enginePath = clientEngineType === import_internals10.ClientEngineType.Library ? binaryPaths.libqueryEngine : binaryPaths.queryEngine;
6438
+ if (copyEngine && enginePath) {
6439
+ if (process.env.NETLIFY) {
6440
+ await (0, import_fs_extra.ensureDir)("/tmp/prisma-engines");
6441
+ }
6442
+ for (const [binaryTarget, filePath] of Object.entries(enginePath)) {
6443
+ const fileName = import_node_path4.default.basename(filePath);
6444
+ let target2;
6445
+ if (process.env.NETLIFY && !["rhel-openssl-1.0.x", "rhel-openssl-3.0.x"].includes(binaryTarget)) {
6446
+ target2 = import_node_path4.default.join("/tmp/prisma-engines", fileName);
6447
+ } else {
6448
+ target2 = import_node_path4.default.join(outputDir, fileName);
6449
+ }
6450
+ await (0, import_fetch_engine.overwriteFile)(filePath, target2);
6451
+ }
6452
+ }
6255
6453
  }
6256
6454
  function writeFileMap(outputDir, fileMap) {
6257
6455
  return Promise.all(
6258
6456
  Object.entries(fileMap).map(async ([fileName, content]) => {
6259
- const absolutePath = import_node_path2.default.join(outputDir, fileName);
6457
+ const absolutePath = import_node_path4.default.join(outputDir, fileName);
6260
6458
  await import_promises.default.rm(absolutePath, { recursive: true, force: true });
6261
6459
  if (typeof content === "string" || Buffer.isBuffer(content)) {
6262
6460
  await import_promises.default.writeFile(absolutePath, content);
@@ -6345,27 +6543,41 @@ function validateDmmfAgainstDenylists(prismaClientDmmf) {
6345
6543
  return errorArray.length > 0 ? errorArray : null;
6346
6544
  }
6347
6545
  async function getGenerationDirs({ runtimeBase, outputDir }) {
6348
- const normalizedOutputDir = import_node_path2.default.normalize(outputDir);
6349
- const normalizedRuntimeBase = (0, import_internals6.pathToPosix)(runtimeBase);
6350
- const userPackageRoot = await (0, import_package_up.packageUp)({ cwd: import_node_path2.default.dirname(normalizedOutputDir) });
6351
- const userProjectRoot = userPackageRoot ? import_node_path2.default.dirname(userPackageRoot) : process.cwd();
6546
+ const normalizedOutputDir = import_node_path4.default.normalize(outputDir);
6547
+ const normalizedRuntimeBase = (0, import_internals10.pathToPosix)(runtimeBase);
6548
+ const userPackageRoot = await (0, import_package_up.packageUp)({ cwd: import_node_path4.default.dirname(normalizedOutputDir) });
6549
+ const userProjectRoot = userPackageRoot ? import_node_path4.default.dirname(userPackageRoot) : process.cwd();
6352
6550
  return {
6353
6551
  runtimeBase: normalizedRuntimeBase,
6354
6552
  outputDir: normalizedOutputDir,
6355
6553
  projectRoot: userProjectRoot
6356
6554
  };
6357
6555
  }
6358
- function getRuntimeNameForTarget(target) {
6556
+ function getRuntimeNameForTarget(target, engineType) {
6359
6557
  switch (target) {
6360
6558
  case "nodejs":
6361
6559
  case "deno":
6362
- return "client";
6560
+ return getNodeRuntimeName(engineType);
6363
6561
  case "workerd":
6364
6562
  case "vercel-edge":
6365
- return "wasm-compiler-edge";
6563
+ return engineType === import_internals10.ClientEngineType.Client ? "wasm-compiler-edge" : "wasm-engine-edge";
6564
+ case "react-native":
6565
+ return "react-native";
6366
6566
  default:
6367
- (0, import_internals6.assertNever)(target, "Unknown runtime target");
6567
+ (0, import_internals10.assertNever)(target, "Unknown runtime target");
6568
+ }
6569
+ }
6570
+ function getNodeRuntimeName(engineType) {
6571
+ if (engineType === import_internals10.ClientEngineType.Binary) {
6572
+ return "binary";
6573
+ }
6574
+ if (engineType === import_internals10.ClientEngineType.Library) {
6575
+ return "library";
6368
6576
  }
6577
+ if (engineType === import_internals10.ClientEngineType.Client) {
6578
+ return "client";
6579
+ }
6580
+ (0, import_internals10.assertNever)(engineType, "Unknown engine type");
6369
6581
  }
6370
6582
  async function deleteOutputDir(outputDir) {
6371
6583
  try {
@@ -6401,12 +6613,14 @@ async function deleteOutputDir(outputDir) {
6401
6613
  }
6402
6614
 
6403
6615
  // src/generator.ts
6616
+ var import_debug2 = require("@prisma/debug");
6404
6617
  var import_engines_version = require("@prisma/engines-version");
6405
- var import_internals7 = require("@prisma/internals");
6618
+ var import_internals11 = require("@prisma/internals");
6406
6619
  var import_get_tsconfig = require("get-tsconfig");
6620
+ var import_ts_pattern2 = require("ts-pattern");
6407
6621
 
6408
6622
  // package.json
6409
- var version = "7.2.0";
6623
+ var version = "7.3.0-integration-fix-6-19-0-cloudflare-accelerate-engine.1";
6410
6624
 
6411
6625
  // src/module-format.ts
6412
6626
  function parseModuleFormat(format) {
@@ -6449,7 +6663,16 @@ function fromTsConfigModule(module2) {
6449
6663
  }
6450
6664
 
6451
6665
  // src/runtime-targets.ts
6452
- var supportedPublicRuntimes = ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light"];
6666
+ var supportedPublicRuntimes = [
6667
+ "nodejs",
6668
+ "deno",
6669
+ "bun",
6670
+ "workerd",
6671
+ "cloudflare",
6672
+ "vercel-edge",
6673
+ "edge-light",
6674
+ "react-native"
6675
+ ];
6453
6676
  function parseRuntimeTarget(target) {
6454
6677
  switch (target.toLowerCase()) {
6455
6678
  case "workerd":
@@ -6463,6 +6686,8 @@ function parseRuntimeTarget(target) {
6463
6686
  return "nodejs";
6464
6687
  case "deno":
6465
6688
  return "deno";
6689
+ case "react-native":
6690
+ return "react-native";
6466
6691
  default:
6467
6692
  throw new Error(
6468
6693
  `Unknown target runtime: "${target}". The available options are: ${supportedPublicRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
@@ -6477,6 +6702,7 @@ function parseRuntimeTargetFromUnknown(target) {
6477
6702
  }
6478
6703
 
6479
6704
  // src/generator.ts
6705
+ var debug2 = (0, import_debug2.Debug)("prisma:client:generator");
6480
6706
  var missingOutputErrorMessage = `An output path is required for the \`prisma-client\` generator. Please provide an output path in your schema file:
6481
6707
 
6482
6708
  ${dim(`generator client {
@@ -6490,16 +6716,18 @@ function getOutputPath(config) {
6490
6716
  if (!config.output) {
6491
6717
  throw new Error(missingOutputErrorMessage);
6492
6718
  }
6493
- return (0, import_internals7.parseEnvValue)(config.output);
6719
+ return (0, import_internals11.parseEnvValue)(config.output);
6494
6720
  }
6495
6721
  var PrismaClientTsGenerator = class {
6496
6722
  name = "prisma-client-ts";
6497
6723
  getManifest(config) {
6724
+ const requiresEngines = (0, import_ts_pattern2.match)((0, import_internals11.getClientEngineType)(config)).with(import_internals11.ClientEngineType.Library, () => ["libqueryEngine"]).with(import_internals11.ClientEngineType.Binary, () => ["queryEngine"]).with(import_internals11.ClientEngineType.Client, () => []).exhaustive();
6725
+ debug2("requiresEngines", requiresEngines);
6498
6726
  return Promise.resolve({
6499
6727
  defaultOutput: getOutputPath(config),
6500
6728
  prettyName: "Prisma Client",
6501
6729
  version,
6502
- requiresEngines: [],
6730
+ requiresEngines,
6503
6731
  requiresEngineVersion: import_engines_version.enginesVersion
6504
6732
  });
6505
6733
  }
@@ -6524,6 +6752,7 @@ var PrismaClientTsGenerator = class {
6524
6752
  schemaPath: options.schemaPath,
6525
6753
  binaryPaths: options.binaryPaths,
6526
6754
  datasources: options.datasources,
6755
+ envPaths: options.envPaths,
6527
6756
  outputDir,
6528
6757
  runtimeBase: "@prisma/client/runtime",
6529
6758
  dmmf: options.dmmf,
@@ -6531,6 +6760,8 @@ var PrismaClientTsGenerator = class {
6531
6760
  engineVersion: options.version,
6532
6761
  clientVersion: version,
6533
6762
  activeProvider: options.datasources[0]?.activeProvider,
6763
+ postinstall: options.postinstall,
6764
+ copyEngine: !options.noEngine,
6534
6765
  typedSql: options.typedSql,
6535
6766
  target,
6536
6767
  generatedFileExtension,