@prisma/client-generator-ts 7.3.0-integration-prisma6-fix-cloudflare-engine.3 → 7.3.0-integration-engines-7-3-0-10-fix-fix-mapped-enum-issue-0b7e6564db7dc3dac7f9312aa84e9ed81d805521.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/TSClient/Args.d.ts +5 -5
- package/dist/TSClient/GenerateContext.d.ts +5 -2
- package/dist/TSClient/NullTypes.d.ts +1 -1
- package/dist/TSClient/PrismaClient.d.ts +0 -1
- package/dist/TSClient/TSClient.d.ts +1 -1
- package/dist/TSClient/file-generators/BrowserFile.d.ts +1 -1
- package/dist/generateClient.d.ts +2 -7
- package/dist/index.d.mts +2 -7
- package/dist/index.d.ts +2 -7
- package/dist/index.js +320 -523
- package/dist/index.mjs +299 -508
- package/dist/runtime-targets.d.ts +3 -3
- package/dist/utils/buildDebugInitialization.d.ts +1 -1
- package/dist/utils/runtimeImport.d.ts +1 -8
- package/dist/utils/wasm.d.ts +4 -3
- package/package.json +10 -11
- package/dist/TSClient/Datasources.d.ts +0 -6
- package/dist/extractSqliteSources.d.ts +0 -6
- package/dist/extractSqliteSources.test.d.ts +0 -1
- package/dist/resolveDatasources.d.ts +0 -1
- package/dist/resolveDatasources.test.d.ts +0 -1
- package/dist/serializeDatasources.d.ts +0 -4
- package/dist/serializeDatasources.test.d.ts +0 -1
- package/dist/utils/buildInjectableEdgeEnv.d.ts +0 -20
- package/dist/utils/buildInlineDatasources.d.ts +0 -3
- package/dist/utils/buildNFTAnnotations.d.ts +0 -11
- package/dist/utils/buildNFTAnnotations.test.d.ts +0 -1
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(
|
|
114
|
+
fs3.lchmod = function(path3, 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(
|
|
121
|
+
fs3.lchown = function(path3, 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(
|
|
188
|
+
fs4.lchmod = function(path3, mode, callback) {
|
|
189
189
|
fs4.open(
|
|
190
|
-
|
|
190
|
+
path3,
|
|
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(
|
|
207
|
-
var fd = fs4.openSync(
|
|
206
|
+
fs4.lchmodSync = function(path3, mode) {
|
|
207
|
+
var fd = fs4.openSync(path3, 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(
|
|
229
|
-
fs4.open(
|
|
228
|
+
fs4.lutimes = function(path3, at, mt, cb) {
|
|
229
|
+
fs4.open(path3, 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(
|
|
242
|
-
var fd = fs4.openSync(
|
|
241
|
+
fs4.lutimesSync = function(path3, at, mt) {
|
|
242
|
+
var fd = fs4.openSync(path3, 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(
|
|
362
|
-
if (!(this instanceof ReadStream)) return new ReadStream(
|
|
361
|
+
function ReadStream(path3, options) {
|
|
362
|
+
if (!(this instanceof ReadStream)) return new ReadStream(path3, options);
|
|
363
363
|
Stream.call(this);
|
|
364
364
|
var self = this;
|
|
365
|
-
this.path =
|
|
365
|
+
this.path = path3;
|
|
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(
|
|
411
|
-
if (!(this instanceof WriteStream)) return new WriteStream(
|
|
410
|
+
function WriteStream(path3, options) {
|
|
411
|
+
if (!(this instanceof WriteStream)) return new WriteStream(path3, options);
|
|
412
412
|
Stream.call(this);
|
|
413
|
-
this.path =
|
|
413
|
+
this.path = path3;
|
|
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
|
|
497
|
+
var debug2 = noop;
|
|
498
498
|
if (util.debuglog)
|
|
499
|
-
|
|
499
|
+
debug2 = util.debuglog("gfs4");
|
|
500
500
|
else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
|
|
501
|
-
|
|
501
|
+
debug2 = 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
|
-
|
|
536
|
+
debug2(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(
|
|
557
|
+
function readFile(path3, options, cb) {
|
|
558
558
|
if (typeof options === "function")
|
|
559
559
|
cb = options, options = null;
|
|
560
|
-
return go$readFile(
|
|
561
|
-
function go$readFile(
|
|
562
|
-
return fs$readFile(
|
|
560
|
+
return go$readFile(path3, options, cb);
|
|
561
|
+
function go$readFile(path4, options2, cb2, startTime) {
|
|
562
|
+
return fs$readFile(path4, options2, function(err) {
|
|
563
563
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
564
|
-
enqueue([go$readFile, [
|
|
564
|
+
enqueue([go$readFile, [path4, 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(
|
|
574
|
+
function writeFile(path3, data, options, cb) {
|
|
575
575
|
if (typeof options === "function")
|
|
576
576
|
cb = options, options = null;
|
|
577
|
-
return go$writeFile(
|
|
578
|
-
function go$writeFile(
|
|
579
|
-
return fs$writeFile(
|
|
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) {
|
|
580
580
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
581
|
-
enqueue([go$writeFile, [
|
|
581
|
+
enqueue([go$writeFile, [path4, 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(
|
|
592
|
+
function appendFile(path3, data, options, cb) {
|
|
593
593
|
if (typeof options === "function")
|
|
594
594
|
cb = options, options = null;
|
|
595
|
-
return go$appendFile(
|
|
596
|
-
function go$appendFile(
|
|
597
|
-
return fs$appendFile(
|
|
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) {
|
|
598
598
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
599
|
-
enqueue([go$appendFile, [
|
|
599
|
+
enqueue([go$appendFile, [path4, 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(
|
|
630
|
+
function readdir(path3, 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(
|
|
634
|
-
return fs$readdir(
|
|
635
|
-
|
|
633
|
+
var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path4, options2, cb2, startTime) {
|
|
634
|
+
return fs$readdir(path4, fs$readdirCallback(
|
|
635
|
+
path4,
|
|
636
636
|
options2,
|
|
637
637
|
cb2,
|
|
638
638
|
startTime
|
|
639
639
|
));
|
|
640
|
-
} : function go$readdir2(
|
|
641
|
-
return fs$readdir(
|
|
642
|
-
|
|
640
|
+
} : function go$readdir2(path4, options2, cb2, startTime) {
|
|
641
|
+
return fs$readdir(path4, options2, fs$readdirCallback(
|
|
642
|
+
path4,
|
|
643
643
|
options2,
|
|
644
644
|
cb2,
|
|
645
645
|
startTime
|
|
646
646
|
));
|
|
647
647
|
};
|
|
648
|
-
return go$readdir(
|
|
649
|
-
function fs$readdirCallback(
|
|
648
|
+
return go$readdir(path3, options, cb);
|
|
649
|
+
function fs$readdirCallback(path4, 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
|
-
[
|
|
654
|
+
[path4, 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(
|
|
725
|
+
function ReadStream(path3, 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(
|
|
745
|
+
function WriteStream(path3, 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(
|
|
764
|
-
return new fs4.ReadStream(
|
|
763
|
+
function createReadStream(path3, options) {
|
|
764
|
+
return new fs4.ReadStream(path3, options);
|
|
765
765
|
}
|
|
766
|
-
function createWriteStream(
|
|
767
|
-
return new fs4.WriteStream(
|
|
766
|
+
function createWriteStream(path3, options) {
|
|
767
|
+
return new fs4.WriteStream(path3, options);
|
|
768
768
|
}
|
|
769
769
|
var fs$open = fs4.open;
|
|
770
770
|
fs4.open = open;
|
|
771
|
-
function open(
|
|
771
|
+
function open(path3, flags, mode, cb) {
|
|
772
772
|
if (typeof mode === "function")
|
|
773
773
|
cb = mode, mode = null;
|
|
774
|
-
return go$open(
|
|
775
|
-
function go$open(
|
|
776
|
-
return fs$open(
|
|
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) {
|
|
777
777
|
if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
|
|
778
|
-
enqueue([go$open, [
|
|
778
|
+
enqueue([go$open, [path4, 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
|
-
|
|
789
|
+
debug2("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
|
-
|
|
816
|
+
debug2("RETRY", fn.name, args);
|
|
817
817
|
fn.apply(null, args);
|
|
818
818
|
} else if (Date.now() - startTime >= 6e4) {
|
|
819
|
-
|
|
819
|
+
debug2("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
|
-
|
|
828
|
+
debug2("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
|
|
961
|
+
var path3 = require("path");
|
|
962
962
|
module2.exports.checkPath = function checkPath(pth) {
|
|
963
963
|
if (process.platform === "win32") {
|
|
964
|
-
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(
|
|
964
|
+
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path3.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(
|
|
1029
|
-
return fs3.access(
|
|
1028
|
+
function pathExists(path3) {
|
|
1029
|
+
return fs3.access(path3).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(
|
|
1045
|
-
const fd = await fs3.open(
|
|
1044
|
+
async function utimesMillis(path3, atime, mtime) {
|
|
1045
|
+
const fd = await fs3.open(path3, "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(
|
|
1061
|
-
const fd = fs3.openSync(
|
|
1060
|
+
function utimesMillisSync(path3, atime, mtime) {
|
|
1061
|
+
const fd = fs3.openSync(path3, "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
|
|
1077
|
+
var path3 = 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 =
|
|
1106
|
-
const destBaseName =
|
|
1105
|
+
const srcBaseName = path3.basename(src);
|
|
1106
|
+
const destBaseName = path3.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 =
|
|
1129
|
-
const destBaseName =
|
|
1128
|
+
const srcBaseName = path3.basename(src);
|
|
1129
|
+
const destBaseName = path3.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 =
|
|
1149
|
-
const destParent =
|
|
1150
|
-
if (destParent === srcParent || destParent ===
|
|
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;
|
|
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 =
|
|
1165
|
-
const destParent =
|
|
1166
|
-
if (destParent === srcParent || destParent ===
|
|
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;
|
|
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 =
|
|
1184
|
-
const destArr =
|
|
1183
|
+
const srcArr = path3.resolve(src).split(path3.sep).filter((i) => i);
|
|
1184
|
+
const destArr = path3.resolve(dest).split(path3.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
|
|
1209
|
+
var path3 = 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 =
|
|
1231
|
+
const destParent = path3.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 =
|
|
1286
|
-
const destItem =
|
|
1285
|
+
const srcItem = path3.join(src, item.name);
|
|
1286
|
+
const destItem = path3.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 =
|
|
1305
|
+
resolvedSrc = path3.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 =
|
|
1318
|
+
resolvedDest = path3.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
|
|
1338
|
+
var path3 = 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 =
|
|
1359
|
+
const destParent = path3.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 =
|
|
1429
|
-
const destItem =
|
|
1428
|
+
const srcItem = path3.join(src, item);
|
|
1429
|
+
const destItem = path3.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 =
|
|
1437
|
+
resolvedSrc = path3.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 =
|
|
1450
|
+
resolvedDest = path3.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(
|
|
1488
|
-
fs3.rm(
|
|
1487
|
+
function remove(path3, callback) {
|
|
1488
|
+
fs3.rm(path3, { recursive: true, force: true }, callback);
|
|
1489
1489
|
}
|
|
1490
|
-
function removeSync(
|
|
1491
|
-
fs3.rmSync(
|
|
1490
|
+
function removeSync(path3) {
|
|
1491
|
+
fs3.rmSync(path3, { 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
|
|
1506
|
+
var path3 = 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(
|
|
1516
|
+
return Promise.all(items.map((item) => remove.remove(path3.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 =
|
|
1526
|
+
item = path3.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
|
|
1544
|
+
var path3 = 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 =
|
|
1554
|
+
const dir = path3.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 =
|
|
1580
|
+
const dir = path3.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
|
|
1603
|
+
var path3 = 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 =
|
|
1622
|
+
const dir = path3.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 =
|
|
1642
|
+
const dir = path3.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
|
|
1659
|
+
var path3 = 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 (
|
|
1664
|
+
if (path3.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 =
|
|
1677
|
-
const relativeToDst =
|
|
1676
|
+
const dstdir = path3.dirname(dstpath);
|
|
1677
|
+
const relativeToDst = path3.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:
|
|
1693
|
+
toDst: path3.relative(dstdir, srcpath)
|
|
1694
1694
|
};
|
|
1695
1695
|
}
|
|
1696
1696
|
function symlinkPathsSync(srcpath, dstpath) {
|
|
1697
|
-
if (
|
|
1697
|
+
if (path3.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 =
|
|
1706
|
-
const relativeToDst =
|
|
1705
|
+
const dstdir = path3.dirname(dstpath);
|
|
1706
|
+
const relativeToDst = path3.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:
|
|
1718
|
+
toDst: path3.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
|
|
1766
|
+
var path3 = 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 =
|
|
1789
|
+
const dir = path3.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 =
|
|
1809
|
+
const dir = path3.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
|
|
1961
|
+
var path3 = 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 =
|
|
1965
|
+
const dir = path3.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 =
|
|
1972
|
+
const dir = path3.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
|
|
2036
|
+
var path3 = 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 =
|
|
2047
|
-
const parsedParentPath =
|
|
2046
|
+
const destParent = path3.dirname(dest);
|
|
2047
|
+
const parsedParentPath = path3.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
|
|
2088
|
+
var path3 = 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(
|
|
2098
|
+
if (!isParentRoot(dest)) mkdirpSync(path3.dirname(dest));
|
|
2099
2099
|
return doRename(src, dest, overwrite, isChangingCase);
|
|
2100
2100
|
}
|
|
2101
2101
|
function isParentRoot(dest) {
|
|
2102
|
-
const parent =
|
|
2103
|
-
const parsedPath =
|
|
2102
|
+
const parent = path3.dirname(dest);
|
|
2103
|
+
const parsedPath = path3.parse(parent);
|
|
2104
2104
|
return parsedPath.root === parent;
|
|
2105
2105
|
}
|
|
2106
2106
|
function doRename(src, dest, overwrite, isChangingCase) {
|
|
@@ -2223,9 +2223,8 @@ function getMappings(mappings, datamodel) {
|
|
|
2223
2223
|
|
|
2224
2224
|
// src/generateClient.ts
|
|
2225
2225
|
var import_promises = __toESM(require("node:fs/promises"));
|
|
2226
|
-
var
|
|
2227
|
-
var
|
|
2228
|
-
var import_internals10 = require("@prisma/internals");
|
|
2226
|
+
var import_node_path2 = __toESM(require("node:path"));
|
|
2227
|
+
var import_internals6 = require("@prisma/internals");
|
|
2229
2228
|
var import_fast_glob = require("fast-glob");
|
|
2230
2229
|
var import_fs_extra = __toESM(require_lib());
|
|
2231
2230
|
|
|
@@ -2385,7 +2384,7 @@ var Enum = class {
|
|
|
2385
2384
|
toTS() {
|
|
2386
2385
|
const { type } = this;
|
|
2387
2386
|
const enumVariants = `{
|
|
2388
|
-
${(0, import_indent_string.default)(type.
|
|
2387
|
+
${(0, import_indent_string.default)(type.data.map((v) => `${v.key}: ${this.getValue(v.value)}`).join(",\n"), TAB_SIZE)}
|
|
2389
2388
|
} as const`;
|
|
2390
2389
|
const enumBody = this.isStrictEnum() ? `runtime.makeStrictEnum(${enumVariants})` : enumVariants;
|
|
2391
2390
|
return `export const ${type.name} = ${enumBody}
|
|
@@ -2898,9 +2897,6 @@ var GenericArgsInfo = class {
|
|
|
2898
2897
|
}
|
|
2899
2898
|
};
|
|
2900
2899
|
|
|
2901
|
-
// src/TSClient/file-generators/BrowserFile.ts
|
|
2902
|
-
var import_internals3 = require("@prisma/internals");
|
|
2903
|
-
|
|
2904
2900
|
// src/TSClient/ModelExports.ts
|
|
2905
2901
|
var ts3 = __toESM(require("@prisma/ts-builders"));
|
|
2906
2902
|
function modelExports(context) {
|
|
@@ -2926,9 +2922,7 @@ var jsDocHeader = `/*
|
|
|
2926
2922
|
* \u{1F7E2} You can import this file directly.
|
|
2927
2923
|
*/
|
|
2928
2924
|
`;
|
|
2929
|
-
function createBrowserFile(context,
|
|
2930
|
-
const clientEngineType = (0, import_internals3.getClientEngineType)(options.generator);
|
|
2931
|
-
options.generator.config.engineType = clientEngineType;
|
|
2925
|
+
function createBrowserFile(context, _options) {
|
|
2932
2926
|
return `${jsDocHeader}
|
|
2933
2927
|
import * as Prisma from '${context.importFileName("./internal/prismaNamespaceBrowser")}'
|
|
2934
2928
|
export { Prisma }
|
|
@@ -2939,50 +2933,14 @@ ${modelExports(context).join("\n")}
|
|
|
2939
2933
|
}
|
|
2940
2934
|
|
|
2941
2935
|
// 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");
|
|
2945
2936
|
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
|
-
}
|
|
2979
2937
|
|
|
2980
2938
|
// src/utils/buildDebugInitialization.ts
|
|
2981
2939
|
function buildDebugInitialization(edge) {
|
|
2982
2940
|
if (!edge) {
|
|
2983
2941
|
return "";
|
|
2984
2942
|
}
|
|
2985
|
-
const debugVar =
|
|
2943
|
+
const debugVar = `typeof globalThis !== 'undefined' && globalThis['DEBUG'] || (typeof process !== 'undefined' && process.env && process.env.DEBUG) || undefined`;
|
|
2986
2944
|
return `if (${debugVar}) {
|
|
2987
2945
|
runtime.Debug.enable(${debugVar})
|
|
2988
2946
|
}
|
|
@@ -3456,7 +3414,7 @@ function escapeJson(str) {
|
|
|
3456
3414
|
function buildRuntimeDataModel(datamodel, runtimeName) {
|
|
3457
3415
|
const runtimeDataModel = (0, import_client_common10.dmmfToRuntimeDataModel)(datamodel);
|
|
3458
3416
|
let prunedDataModel;
|
|
3459
|
-
if (runtimeName === "wasm-
|
|
3417
|
+
if (runtimeName === "wasm-compiler-edge" || runtimeName === "client") {
|
|
3460
3418
|
prunedDataModel = (0, import_client_common10.pruneRuntimeDataModel)(runtimeDataModel);
|
|
3461
3419
|
} else {
|
|
3462
3420
|
prunedDataModel = runtimeDataModel;
|
|
@@ -3466,50 +3424,35 @@ function buildRuntimeDataModel(datamodel, runtimeName) {
|
|
|
3466
3424
|
config.runtimeDataModel = JSON.parse(${JSON.stringify(datamodelString)})`;
|
|
3467
3425
|
}
|
|
3468
3426
|
|
|
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
|
-
|
|
3483
3427
|
// src/utils/wasm.ts
|
|
3484
3428
|
var import_node_fs = __toESM(require("node:fs"));
|
|
3485
3429
|
var import_node_path = __toESM(require("node:path"));
|
|
3486
|
-
var import_client_common11 = require("@prisma/client-common");
|
|
3487
3430
|
var import_debug = require("@prisma/debug");
|
|
3488
3431
|
var import_ts_pattern = require("ts-pattern");
|
|
3489
3432
|
var debug = (0, import_debug.Debug)("prisma:client-generator-ts:wasm");
|
|
3490
|
-
function usesEdgeWasmRuntime(
|
|
3491
|
-
return runtimeName === "wasm-
|
|
3433
|
+
function usesEdgeWasmRuntime(runtimeName) {
|
|
3434
|
+
return runtimeName === "wasm-compiler-edge";
|
|
3492
3435
|
}
|
|
3493
3436
|
function buildGetWasmModule({
|
|
3494
|
-
component,
|
|
3495
3437
|
runtimeName,
|
|
3496
3438
|
runtimeBase,
|
|
3497
3439
|
activeProvider,
|
|
3498
|
-
moduleFormat
|
|
3440
|
+
moduleFormat,
|
|
3441
|
+
compilerBuild
|
|
3499
3442
|
}) {
|
|
3500
|
-
const capitalizedComponent = (0, import_client_common11.capitalize)(component);
|
|
3501
3443
|
const extension = (0, import_ts_pattern.match)(moduleFormat).with("esm", () => "mjs").with("cjs", () => "js").exhaustive();
|
|
3502
|
-
const buildNonEdgeLoader =
|
|
3503
|
-
const buildEdgeLoader =
|
|
3444
|
+
const buildNonEdgeLoader = runtimeName === "client";
|
|
3445
|
+
const buildEdgeLoader = !buildNonEdgeLoader;
|
|
3446
|
+
const artifactName = `query_compiler_${compilerBuild}_bg`;
|
|
3504
3447
|
let wasmPathBase;
|
|
3505
3448
|
let wasmBindingsPath;
|
|
3506
3449
|
let wasmModulePath;
|
|
3507
3450
|
if (buildEdgeLoader) {
|
|
3508
|
-
wasmPathBase =
|
|
3451
|
+
wasmPathBase = `./${artifactName}`;
|
|
3509
3452
|
wasmBindingsPath = `${wasmPathBase}.js`;
|
|
3510
3453
|
wasmModulePath = `${wasmPathBase}.wasm`;
|
|
3511
3454
|
} else {
|
|
3512
|
-
wasmPathBase = `${runtimeBase}
|
|
3455
|
+
wasmPathBase = `${runtimeBase}/${artifactName}.${activeProvider}`;
|
|
3513
3456
|
wasmBindingsPath = `${wasmPathBase}.mjs`;
|
|
3514
3457
|
wasmModulePath = `${wasmPathBase}.wasm`;
|
|
3515
3458
|
}
|
|
@@ -3523,26 +3466,30 @@ async function decodeBase64AsWasm(wasmBase64: string): Promise<WebAssembly.Modul
|
|
|
3523
3466
|
return new WebAssembly.Module(wasmArray)
|
|
3524
3467
|
}
|
|
3525
3468
|
|
|
3526
|
-
config
|
|
3469
|
+
config.compilerWasm = {
|
|
3527
3470
|
getRuntime: async () => await import(${JSON.stringify(wasmBindingsPath)}),
|
|
3528
3471
|
|
|
3529
|
-
|
|
3472
|
+
getQueryCompilerWasmModule: async () => {
|
|
3530
3473
|
const { wasm } = await import(${JSON.stringify(wasmModulePath)})
|
|
3531
3474
|
return await decodeBase64AsWasm(wasm)
|
|
3532
|
-
}
|
|
3475
|
+
},
|
|
3476
|
+
|
|
3477
|
+
importName: ${JSON.stringify(`./${artifactName}.js`)}
|
|
3533
3478
|
}`;
|
|
3534
3479
|
}
|
|
3535
3480
|
if (buildEdgeLoader) {
|
|
3536
|
-
return `config
|
|
3481
|
+
return `config.compilerWasm = {
|
|
3537
3482
|
getRuntime: async () => await import(${JSON.stringify(wasmBindingsPath)}),
|
|
3538
3483
|
|
|
3539
|
-
|
|
3484
|
+
getQueryCompilerWasmModule: async () => {
|
|
3540
3485
|
const { default: module } = await import(${JSON.stringify(`${wasmModulePath}?module`)})
|
|
3541
3486
|
return module
|
|
3542
|
-
}
|
|
3487
|
+
},
|
|
3488
|
+
|
|
3489
|
+
importName: ${JSON.stringify(`./${artifactName}.js`)}
|
|
3543
3490
|
}`;
|
|
3544
3491
|
}
|
|
3545
|
-
return `config
|
|
3492
|
+
return `config.compilerWasm = undefined`;
|
|
3546
3493
|
}
|
|
3547
3494
|
function readSourceFile(sourceFile) {
|
|
3548
3495
|
const bundledLocation = import_node_path.default.join(__dirname, sourceFile);
|
|
@@ -3557,36 +3504,32 @@ function readSourceFile(sourceFile) {
|
|
|
3557
3504
|
throw new Error(`Could not find ${sourceFile} in ${bundledLocation} or ${sourceLocation}`);
|
|
3558
3505
|
}
|
|
3559
3506
|
}
|
|
3560
|
-
function buildWasmFileMap({ activeProvider, runtimeName }) {
|
|
3507
|
+
function buildWasmFileMap({ activeProvider, runtimeName, compilerBuild }) {
|
|
3561
3508
|
const fileMap = {};
|
|
3562
3509
|
debug("buildWasmFileMap with", { runtimeName });
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
}
|
|
3510
|
+
if (!usesEdgeWasmRuntime(runtimeName)) {
|
|
3511
|
+
debug("Skipping component compiler for runtime", runtimeName);
|
|
3512
|
+
return fileMap;
|
|
3513
|
+
}
|
|
3514
|
+
const artifactName = `query_compiler_${compilerBuild}_bg`;
|
|
3515
|
+
const fileNameBase = `${artifactName}.${activeProvider}`;
|
|
3516
|
+
const files = {
|
|
3517
|
+
[`${artifactName}.wasm`]: `${fileNameBase}.wasm`,
|
|
3518
|
+
[`${artifactName}.js`]: `${fileNameBase}.mjs`
|
|
3519
|
+
};
|
|
3520
|
+
for (const [targetFile, sourceFile] of Object.entries(files)) {
|
|
3521
|
+
fileMap[targetFile] = readSourceFile(sourceFile);
|
|
3576
3522
|
}
|
|
3577
3523
|
return fileMap;
|
|
3578
3524
|
}
|
|
3579
3525
|
|
|
3580
3526
|
// src/TSClient/PrismaClient.ts
|
|
3581
|
-
var
|
|
3527
|
+
var import_client_common11 = require("@prisma/client-common");
|
|
3582
3528
|
var ts5 = __toESM(require("@prisma/ts-builders"));
|
|
3583
3529
|
var import_indent_string3 = __toESM(require("indent-string"));
|
|
3584
3530
|
|
|
3585
3531
|
// src/utils/runtimeImport.ts
|
|
3586
3532
|
var ts4 = __toESM(require("@prisma/ts-builders"));
|
|
3587
|
-
function runtimeImport(name) {
|
|
3588
|
-
return name;
|
|
3589
|
-
}
|
|
3590
3533
|
function runtimeImportedType(name) {
|
|
3591
3534
|
return ts4.namedType(`runtime.${name}`);
|
|
3592
3535
|
}
|
|
@@ -3660,7 +3603,7 @@ function queryRawDefinition(context) {
|
|
|
3660
3603
|
* const result = await prisma.$queryRaw\`SELECT * FROM User WHERE id = \${1} OR email = \${'user@email.com'};\`
|
|
3661
3604
|
* \`\`\`
|
|
3662
3605
|
*
|
|
3663
|
-
* Read more in our [docs](https://
|
|
3606
|
+
* Read more in our [docs](https://pris.ly/d/raw-queries).
|
|
3664
3607
|
*/
|
|
3665
3608
|
$queryRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<T>;
|
|
3666
3609
|
|
|
@@ -3672,7 +3615,7 @@ function queryRawDefinition(context) {
|
|
|
3672
3615
|
* const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')
|
|
3673
3616
|
* \`\`\`
|
|
3674
3617
|
*
|
|
3675
|
-
* Read more in our [docs](https://
|
|
3618
|
+
* Read more in our [docs](https://pris.ly/d/raw-queries).
|
|
3676
3619
|
*/
|
|
3677
3620
|
$queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;`;
|
|
3678
3621
|
}
|
|
@@ -3688,7 +3631,7 @@ function executeRawDefinition(context) {
|
|
|
3688
3631
|
* const result = await prisma.$executeRaw\`UPDATE User SET cool = \${true} WHERE email = \${'user@email.com'};\`
|
|
3689
3632
|
* \`\`\`
|
|
3690
3633
|
*
|
|
3691
|
-
* Read more in our [docs](https://
|
|
3634
|
+
* Read more in our [docs](https://pris.ly/d/raw-queries).
|
|
3692
3635
|
*/
|
|
3693
3636
|
$executeRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<number>;
|
|
3694
3637
|
|
|
@@ -3700,7 +3643,7 @@ function executeRawDefinition(context) {
|
|
|
3700
3643
|
* const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')
|
|
3701
3644
|
* \`\`\`
|
|
3702
3645
|
*
|
|
3703
|
-
* Read more in our [docs](https://
|
|
3646
|
+
* Read more in our [docs](https://pris.ly/d/raw-queries).
|
|
3704
3647
|
*/
|
|
3705
3648
|
$executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;`;
|
|
3706
3649
|
}
|
|
@@ -3730,24 +3673,6 @@ function queryRawTypedDefinition(context) {
|
|
|
3730
3673
|
).setReturnType(prismaPromise(ts5.array(param.toArgument())));
|
|
3731
3674
|
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3732
3675
|
}
|
|
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
|
-
}
|
|
3751
3676
|
function runCommandRawDefinition(context) {
|
|
3752
3677
|
if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
|
|
3753
3678
|
return "";
|
|
@@ -3763,17 +3688,10 @@ function runCommandRawDefinition(context) {
|
|
|
3763
3688
|
})
|
|
3764
3689
|
\`\`\`
|
|
3765
3690
|
|
|
3766
|
-
Read more in our [docs](https://
|
|
3691
|
+
Read more in our [docs](https://pris.ly/d/raw-queries).
|
|
3767
3692
|
`);
|
|
3768
3693
|
return ts5.stringify(method3, { indentLevel: 1, newLine: "leading" });
|
|
3769
3694
|
}
|
|
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
|
-
}
|
|
3777
3695
|
function getPrismaClientClassDocComment({ dmmf }) {
|
|
3778
3696
|
let example;
|
|
3779
3697
|
if (dmmf.mappings.modelOperations.length) {
|
|
@@ -3791,11 +3709,11 @@ function getPrismaClientClassDocComment({ dmmf }) {
|
|
|
3791
3709
|
@example
|
|
3792
3710
|
\`\`\`
|
|
3793
3711
|
const prisma = new PrismaClient()
|
|
3794
|
-
// Fetch zero or more ${(0,
|
|
3795
|
-
const ${(0,
|
|
3712
|
+
// Fetch zero or more ${(0, import_client_common11.capitalize)(example.plural)}
|
|
3713
|
+
const ${(0, import_client_common11.uncapitalize)(example.plural)} = await prisma.${(0, import_client_common11.uncapitalize)(example.model)}.findMany()
|
|
3796
3714
|
\`\`\`
|
|
3797
3715
|
|
|
3798
|
-
Read more in our [docs](https://
|
|
3716
|
+
Read more in our [docs](https://pris.ly/d/client).
|
|
3799
3717
|
`;
|
|
3800
3718
|
}
|
|
3801
3719
|
var PrismaClientClass = class {
|
|
@@ -3818,18 +3736,18 @@ export interface PrismaClientConstructor {
|
|
|
3818
3736
|
LogOpts extends LogOptions<Options> = LogOptions<Options>,
|
|
3819
3737
|
OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends { omit: infer U } ? U : Prisma.PrismaClientOptions['omit'],
|
|
3820
3738
|
ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
|
|
3821
|
-
>(options
|
|
3739
|
+
>(options: Prisma.Subset<Options, Prisma.PrismaClientOptions> ): PrismaClient<LogOpts, OmitOpts, ExtArgs>
|
|
3822
3740
|
}
|
|
3823
3741
|
|
|
3824
3742
|
${this.jsDoc}
|
|
3825
3743
|
export interface PrismaClient<
|
|
3826
3744
|
in LogOpts extends Prisma.LogLevel = never,
|
|
3827
|
-
in out OmitOpts extends Prisma.PrismaClientOptions['omit'] =
|
|
3745
|
+
in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = undefined,
|
|
3828
3746
|
in out ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs
|
|
3829
3747
|
> {
|
|
3830
3748
|
[K: symbol]: { types: Prisma.TypeMap<ExtArgs>['other'] }
|
|
3831
3749
|
|
|
3832
|
-
$
|
|
3750
|
+
$on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
|
|
3833
3751
|
|
|
3834
3752
|
/**
|
|
3835
3753
|
* Connect with the database
|
|
@@ -3848,14 +3766,12 @@ ${[
|
|
|
3848
3766
|
batchingTransactionDefinition(this.context),
|
|
3849
3767
|
interactiveTransactionDefinition(this.context),
|
|
3850
3768
|
runCommandRawDefinition(this.context),
|
|
3851
|
-
metricDefinition(this.context),
|
|
3852
|
-
this.applyPendingMigrationsDefinition(),
|
|
3853
3769
|
extendsPropertyDefinition()
|
|
3854
3770
|
].filter((d) => d !== null).join("\n").trim()}
|
|
3855
3771
|
|
|
3856
3772
|
${(0, import_indent_string3.default)(
|
|
3857
3773
|
dmmf.mappings.modelOperations.filter((m) => m.findMany).map((m) => {
|
|
3858
|
-
let methodName = (0,
|
|
3774
|
+
let methodName = (0, import_client_common11.uncapitalize)(m.model);
|
|
3859
3775
|
if (methodName === "constructor") {
|
|
3860
3776
|
methodName = '["constructor"]';
|
|
3861
3777
|
}
|
|
@@ -3864,8 +3780,8 @@ ${[
|
|
|
3864
3780
|
* \`prisma.${methodName}\`: Exposes CRUD operations for the **${m.model}** model.
|
|
3865
3781
|
* Example usage:
|
|
3866
3782
|
* \`\`\`ts
|
|
3867
|
-
* // Fetch zero or more ${(0,
|
|
3868
|
-
* const ${(0,
|
|
3783
|
+
* // Fetch zero or more ${(0, import_client_common11.capitalize)(m.plural)}
|
|
3784
|
+
* const ${(0, import_client_common11.uncapitalize)(m.plural)} = await prisma.${methodName}.findMany()
|
|
3869
3785
|
* \`\`\`
|
|
3870
3786
|
*/
|
|
3871
3787
|
get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
@@ -3874,15 +3790,6 @@ get ${methodName}(): Prisma.${m.model}Delegate<${generics.join(", ")}>;`;
|
|
|
3874
3790
|
)}
|
|
3875
3791
|
}`;
|
|
3876
3792
|
}
|
|
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
|
-
}
|
|
3886
3793
|
};
|
|
3887
3794
|
|
|
3888
3795
|
// src/TSClient/file-generators/ClassFile.ts
|
|
@@ -3908,8 +3815,7 @@ ${clientConfig(context, options)}
|
|
|
3908
3815
|
|
|
3909
3816
|
${prismaClientClass.toTS()}
|
|
3910
3817
|
|
|
3911
|
-
export function getPrismaClientClass(
|
|
3912
|
-
config.dirname = dirname
|
|
3818
|
+
export function getPrismaClientClass(): PrismaClientConstructor {
|
|
3913
3819
|
return runtime.getPrismaClient(config) as unknown as PrismaClientConstructor
|
|
3914
3820
|
}
|
|
3915
3821
|
`;
|
|
@@ -3918,105 +3824,40 @@ function clientConfig(context, options) {
|
|
|
3918
3824
|
const {
|
|
3919
3825
|
edge,
|
|
3920
3826
|
generator,
|
|
3921
|
-
outputDir,
|
|
3922
3827
|
datamodel: inlineSchema,
|
|
3923
3828
|
runtimeBase,
|
|
3924
3829
|
runtimeName,
|
|
3925
|
-
datasources,
|
|
3926
|
-
copyEngine = true,
|
|
3927
3830
|
target,
|
|
3928
3831
|
activeProvider,
|
|
3929
|
-
moduleFormat
|
|
3832
|
+
moduleFormat,
|
|
3833
|
+
compilerBuild
|
|
3930
3834
|
} = 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;
|
|
3935
3835
|
const config = {
|
|
3936
|
-
generator,
|
|
3937
|
-
relativePath: (0, import_internals4.pathToPosix)(import_node_path2.default.relative(outputDir, import_node_path2.default.dirname(datasourceFilePath))),
|
|
3836
|
+
previewFeatures: generator.previewFeatures,
|
|
3938
3837
|
clientVersion: options.clientVersion,
|
|
3939
3838
|
engineVersion: options.engineVersion,
|
|
3940
|
-
datasourceNames: datasources.map((d) => d.name),
|
|
3941
3839
|
activeProvider: options.activeProvider,
|
|
3942
|
-
postinstall: options.postinstall,
|
|
3943
|
-
ciName: import_ci_info.default.name ?? void 0,
|
|
3944
|
-
inlineDatasources: buildInlineDatasources(datasources),
|
|
3945
3840
|
inlineSchema,
|
|
3946
|
-
|
|
3947
|
-
copyEngine,
|
|
3948
|
-
runtimeDataModel: { models: {}, enums: {}, types: {} },
|
|
3949
|
-
dirname: ""
|
|
3841
|
+
runtimeDataModel: { models: {}, enums: {}, types: {} }
|
|
3950
3842
|
};
|
|
3951
3843
|
return `
|
|
3952
3844
|
const config: runtime.GetPrismaClientConfig = ${JSON.stringify(config, null, 2)}
|
|
3953
3845
|
${buildRuntimeDataModel(context.dmmf.datamodel, runtimeName)}
|
|
3954
|
-
${buildGetWasmModule({
|
|
3955
|
-
${buildGetWasmModule({ component: "compiler", runtimeBase, runtimeName, target, activeProvider, moduleFormat })}
|
|
3956
|
-
${buildInjectableEdgeEnv(edge, datasources)}
|
|
3846
|
+
${buildGetWasmModule({ runtimeBase, runtimeName, target, activeProvider, moduleFormat, compilerBuild })}
|
|
3957
3847
|
${buildDebugInitialization(edge)}
|
|
3958
3848
|
`;
|
|
3959
3849
|
}
|
|
3960
3850
|
|
|
3961
3851
|
// src/TSClient/file-generators/ClientFile.ts
|
|
3962
|
-
var import_node_path3 = __toESM(require("node:path"));
|
|
3963
|
-
var import_internals6 = require("@prisma/internals");
|
|
3964
3852
|
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
|
|
4010
3853
|
var jsDocHeader3 = `/*
|
|
4011
3854
|
* This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
|
|
4012
3855
|
* If you're looking for something you can import in the client-side of your application, please refer to the \`browser.ts\` file instead.
|
|
4013
|
-
*
|
|
3856
|
+
*
|
|
4014
3857
|
* \u{1F7E2} You can import this file directly.
|
|
4015
3858
|
*/
|
|
4016
3859
|
`;
|
|
4017
3860
|
function createClientFile(context, options) {
|
|
4018
|
-
const clientEngineType = (0, import_internals6.getClientEngineType)(options.generator);
|
|
4019
|
-
options.generator.config.engineType = clientEngineType;
|
|
4020
3861
|
const imports = [
|
|
4021
3862
|
ts7.moduleImport(context.runtimeImport).asNamespace("runtime"),
|
|
4022
3863
|
ts7.moduleImport(context.importFileName("./enums")).asNamespace("$Enums"),
|
|
@@ -4026,9 +3867,7 @@ function createClientFile(context, options) {
|
|
|
4026
3867
|
const exports2 = [
|
|
4027
3868
|
ts7.moduleExportFrom(context.importFileName("./enums")).asNamespace("$Enums"),
|
|
4028
3869
|
ts7.moduleExportFrom(context.importFileName("./enums")),
|
|
4029
|
-
ts7.moduleExport(
|
|
4030
|
-
ts7.constDeclaration("PrismaClient").setValue(ts7.functionCall("$Class.getPrismaClientClass", [ts7.namedValue("__dirname")]))
|
|
4031
|
-
).setDocComment(getPrismaClientClassDocComment(context)),
|
|
3870
|
+
ts7.moduleExport(ts7.constDeclaration("PrismaClient").setValue(ts7.functionCall("$Class.getPrismaClientClass", []))).setDocComment(getPrismaClientClassDocComment(context)),
|
|
4032
3871
|
ts7.moduleExport(
|
|
4033
3872
|
ts7.typeDeclaration(
|
|
4034
3873
|
"PrismaClient",
|
|
@@ -4042,8 +3881,6 @@ function createClientFile(context, options) {
|
|
|
4042
3881
|
)
|
|
4043
3882
|
)
|
|
4044
3883
|
].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);
|
|
4047
3884
|
return `${jsDocHeader3}
|
|
4048
3885
|
${buildPreamble(options.edge, options.moduleFormat)}
|
|
4049
3886
|
${imports.join("\n")}
|
|
@@ -4051,8 +3888,6 @@ ${imports.join("\n")}
|
|
|
4051
3888
|
${exports2.join("\n")}
|
|
4052
3889
|
export { Prisma }
|
|
4053
3890
|
|
|
4054
|
-
${buildNFTAnnotations(options.edge || !options.copyEngine, clientEngineType, binaryTargets, relativeOutdir)}
|
|
4055
|
-
|
|
4056
3891
|
${modelExports(context).join("\n")}
|
|
4057
3892
|
`;
|
|
4058
3893
|
}
|
|
@@ -4124,7 +3959,7 @@ export {}
|
|
|
4124
3959
|
var ts15 = __toESM(require("@prisma/ts-builders"));
|
|
4125
3960
|
|
|
4126
3961
|
// src/TSClient/Model.ts
|
|
4127
|
-
var
|
|
3962
|
+
var import_client_common15 = require("@prisma/client-common");
|
|
4128
3963
|
var DMMF2 = __toESM(require("@prisma/dmmf"));
|
|
4129
3964
|
var ts14 = __toESM(require("@prisma/ts-builders"));
|
|
4130
3965
|
var import_indent_string5 = __toESM(require("indent-string"));
|
|
@@ -4210,15 +4045,15 @@ var ArgsTypeBuilder = class {
|
|
|
4210
4045
|
};
|
|
4211
4046
|
|
|
4212
4047
|
// src/TSClient/Count.ts
|
|
4213
|
-
var
|
|
4048
|
+
var import_client_common12 = require("@prisma/client-common");
|
|
4214
4049
|
var ts11 = __toESM(require("@prisma/ts-builders"));
|
|
4215
4050
|
var import_indent_string4 = __toESM(require("indent-string"));
|
|
4216
4051
|
|
|
4217
4052
|
// src/TSClient/Output.ts
|
|
4218
|
-
var
|
|
4053
|
+
var import_internals3 = require("@prisma/internals");
|
|
4219
4054
|
var ts10 = __toESM(require("@prisma/ts-builders"));
|
|
4220
4055
|
function buildModelOutputProperty(field, dmmf) {
|
|
4221
|
-
let fieldTypeName = (0,
|
|
4056
|
+
let fieldTypeName = (0, import_internals3.hasOwnProperty)(GraphQLScalarToJSTypeTable, field.type) ? GraphQLScalarToJSTypeTable[field.type] : field.type;
|
|
4222
4057
|
if (Array.isArray(fieldTypeName)) {
|
|
4223
4058
|
fieldTypeName = fieldTypeName[0];
|
|
4224
4059
|
}
|
|
@@ -4329,7 +4164,7 @@ ${this.argsTypes.map((typeExport) => ts11.stringify(typeExport)).join("\n\n")}
|
|
|
4329
4164
|
}
|
|
4330
4165
|
};
|
|
4331
4166
|
function getCountArgsType(typeName, fieldName) {
|
|
4332
|
-
return `${typeName}Count${(0,
|
|
4167
|
+
return `${typeName}Count${(0, import_client_common12.capitalize)(fieldName)}Args`;
|
|
4333
4168
|
}
|
|
4334
4169
|
|
|
4335
4170
|
// src/TSClient/ModelFieldRefs.ts
|
|
@@ -4360,7 +4195,7 @@ ${this.stringifyFields()}
|
|
|
4360
4195
|
};
|
|
4361
4196
|
|
|
4362
4197
|
// src/TSClient/Payload.ts
|
|
4363
|
-
var
|
|
4198
|
+
var import_client_common13 = require("@prisma/client-common");
|
|
4364
4199
|
var ts12 = __toESM(require("@prisma/ts-builders"));
|
|
4365
4200
|
function buildModelPayload(model, context) {
|
|
4366
4201
|
const isComposite = context.dmmf.isComposite(model.name);
|
|
@@ -4378,7 +4213,7 @@ function buildModelPayload(model, context) {
|
|
|
4378
4213
|
scalars.add(buildModelOutputProperty(field, context.dmmf));
|
|
4379
4214
|
}
|
|
4380
4215
|
}
|
|
4381
|
-
const scalarsType = isComposite ? scalars : ts12.namedType("runtime.Types.Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(ts12.namedType("ExtArgs").subKey("result").subKey((0,
|
|
4216
|
+
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)));
|
|
4382
4217
|
const payloadTypeDeclaration = ts12.typeDeclaration(
|
|
4383
4218
|
getPayloadName(model.name, false),
|
|
4384
4219
|
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))
|
|
@@ -4390,7 +4225,7 @@ function buildModelPayload(model, context) {
|
|
|
4390
4225
|
}
|
|
4391
4226
|
|
|
4392
4227
|
// src/TSClient/SelectIncludeOmit.ts
|
|
4393
|
-
var
|
|
4228
|
+
var import_client_common14 = require("@prisma/client-common");
|
|
4394
4229
|
var ts13 = __toESM(require("@prisma/ts-builders"));
|
|
4395
4230
|
function buildIncludeType({
|
|
4396
4231
|
modelName,
|
|
@@ -4424,7 +4259,7 @@ function buildSelectType({
|
|
|
4424
4259
|
return buildExport(typeName, selectType);
|
|
4425
4260
|
}
|
|
4426
4261
|
function modelResultExtensionsType(modelName) {
|
|
4427
|
-
return extArgsParam.toArgument().subKey("result").subKey((0,
|
|
4262
|
+
return extArgsParam.toArgument().subKey("result").subKey((0, import_client_common14.uncapitalize)(modelName));
|
|
4428
4263
|
}
|
|
4429
4264
|
function buildScalarSelectType({ modelName, fields, context }) {
|
|
4430
4265
|
const object = buildSelectOrIncludeObject(
|
|
@@ -4993,7 +4828,7 @@ function getNonAggregateMethodDependencyValidations(modelMapping, actionName, co
|
|
|
4993
4828
|
objectType11.add(ts14.property(reqArg, ts14.objectType()));
|
|
4994
4829
|
}
|
|
4995
4830
|
validators.push(
|
|
4996
|
-
ts14.genericParameter(`${(0,
|
|
4831
|
+
ts14.genericParameter(`${(0, import_client_common15.capitalize)(args.name)}DependenciesValidator`).extends(
|
|
4997
4832
|
ts14.conditionalType().check(ts14.stringLiteral(args.name)).extends(ts14.namedType("Prisma.Keys<T>")).then(objectType11).else(ts14.objectType())
|
|
4998
4833
|
)
|
|
4999
4834
|
);
|
|
@@ -5153,33 +4988,36 @@ function createModelsFile(context, modelsNames) {
|
|
|
5153
4988
|
}
|
|
5154
4989
|
|
|
5155
4990
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
4991
|
+
var import_dmmf2 = require("@prisma/dmmf");
|
|
5156
4992
|
var ts16 = __toESM(require("@prisma/ts-builders"));
|
|
5157
4993
|
|
|
5158
4994
|
// src/TSClient/NullTypes.ts
|
|
5159
4995
|
var nullTypes = `
|
|
5160
4996
|
export const NullTypes = {
|
|
5161
|
-
DbNull: runtime.
|
|
5162
|
-
JsonNull: runtime.
|
|
5163
|
-
AnyNull: runtime.
|
|
4997
|
+
DbNull: runtime.NullTypes.DbNull as (new (secret: never) => typeof runtime.DbNull),
|
|
4998
|
+
JsonNull: runtime.NullTypes.JsonNull as (new (secret: never) => typeof runtime.JsonNull),
|
|
4999
|
+
AnyNull: runtime.NullTypes.AnyNull as (new (secret: never) => typeof runtime.AnyNull),
|
|
5164
5000
|
}
|
|
5165
5001
|
/**
|
|
5166
5002
|
* Helper for filtering JSON entries that have \`null\` on the database (empty on the db)
|
|
5167
5003
|
*
|
|
5168
5004
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5169
5005
|
*/
|
|
5170
|
-
export const DbNull = runtime.
|
|
5006
|
+
export const DbNull = runtime.DbNull
|
|
5007
|
+
|
|
5171
5008
|
/**
|
|
5172
5009
|
* Helper for filtering JSON entries that have JSON \`null\` values (not empty on the db)
|
|
5173
5010
|
*
|
|
5174
5011
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5175
5012
|
*/
|
|
5176
|
-
export const JsonNull = runtime.
|
|
5013
|
+
export const JsonNull = runtime.JsonNull
|
|
5014
|
+
|
|
5177
5015
|
/**
|
|
5178
5016
|
* Helper for filtering JSON entries that are \`Prisma.DbNull\` or \`Prisma.JsonNull\`
|
|
5179
5017
|
*
|
|
5180
5018
|
* @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-on-a-json-field
|
|
5181
5019
|
*/
|
|
5182
|
-
export const AnyNull = runtime.
|
|
5020
|
+
export const AnyNull = runtime.AnyNull
|
|
5183
5021
|
`;
|
|
5184
5022
|
|
|
5185
5023
|
// src/TSClient/file-generators/PrismaNamespaceBrowserFile.ts
|
|
@@ -5196,7 +5034,9 @@ var jsDocHeader7 = `/*
|
|
|
5196
5034
|
*/
|
|
5197
5035
|
`;
|
|
5198
5036
|
function createPrismaNamespaceBrowserFile(context) {
|
|
5199
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5037
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5038
|
+
(datamodelEnum) => new Enum((0, import_dmmf2.datamodelSchemaEnumToSchemaEnum)(datamodelEnum), false).toTS()
|
|
5039
|
+
);
|
|
5200
5040
|
return `${jsDocHeader7}
|
|
5201
5041
|
${ts16.stringify(ts16.moduleImport(`${context.runtimeBase}/index-browser`).asNamespace("runtime"))}
|
|
5202
5042
|
|
|
@@ -5210,7 +5050,10 @@ ${nullTypes}
|
|
|
5210
5050
|
${new Enum(
|
|
5211
5051
|
{
|
|
5212
5052
|
name: "ModelName",
|
|
5213
|
-
|
|
5053
|
+
data: context.dmmf.mappings.modelOperations.map((m) => ({
|
|
5054
|
+
key: m.model,
|
|
5055
|
+
value: m.model
|
|
5056
|
+
}))
|
|
5214
5057
|
},
|
|
5215
5058
|
true
|
|
5216
5059
|
).toTS()}
|
|
@@ -5223,6 +5066,7 @@ ${prismaEnums?.join("\n\n")}
|
|
|
5223
5066
|
}
|
|
5224
5067
|
|
|
5225
5068
|
// src/TSClient/file-generators/PrismaNamespaceFile.ts
|
|
5069
|
+
var import_dmmf3 = require("@prisma/dmmf");
|
|
5226
5070
|
var ts19 = __toESM(require("@prisma/ts-builders"));
|
|
5227
5071
|
|
|
5228
5072
|
// src/TSClient/common.ts
|
|
@@ -5270,14 +5114,6 @@ export type Decimal = runtime.Decimal
|
|
|
5270
5114
|
|
|
5271
5115
|
export type DecimalJsLike = runtime.DecimalJsLike
|
|
5272
5116
|
|
|
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
|
-
|
|
5281
5117
|
/**
|
|
5282
5118
|
* Extensions
|
|
5283
5119
|
*/
|
|
@@ -5584,25 +5420,6 @@ export const skip = runtime.skip
|
|
|
5584
5420
|
return "";
|
|
5585
5421
|
}
|
|
5586
5422
|
|
|
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
|
-
|
|
5606
5423
|
// src/TSClient/FieldRefInput.ts
|
|
5607
5424
|
var FieldRefInput = class {
|
|
5608
5425
|
constructor(type) {
|
|
@@ -5623,21 +5440,21 @@ export type ${this.type.name}<$PrismaModel> = FieldRefInputType<$PrismaModel, ${
|
|
|
5623
5440
|
};
|
|
5624
5441
|
|
|
5625
5442
|
// src/TSClient/globalOmit.ts
|
|
5626
|
-
var
|
|
5443
|
+
var import_client_common16 = require("@prisma/client-common");
|
|
5627
5444
|
var ts17 = __toESM(require("@prisma/ts-builders"));
|
|
5628
5445
|
function globalOmitConfig(dmmf) {
|
|
5629
5446
|
const objectType11 = ts17.objectType().addMultiple(
|
|
5630
5447
|
dmmf.datamodel.models.map((model) => {
|
|
5631
5448
|
const type = ts17.namedType(`Prisma.${getOmitName(model.name)}`);
|
|
5632
|
-
return ts17.property((0,
|
|
5449
|
+
return ts17.property((0, import_client_common16.uncapitalize)(model.name), type).optional();
|
|
5633
5450
|
})
|
|
5634
5451
|
);
|
|
5635
5452
|
return ts17.moduleExport(ts17.typeDeclaration("GlobalOmitConfig", objectType11));
|
|
5636
5453
|
}
|
|
5637
5454
|
|
|
5638
5455
|
// src/TSClient/TypeMap.ts
|
|
5639
|
-
var
|
|
5640
|
-
var
|
|
5456
|
+
var import_client_common17 = require("@prisma/client-common");
|
|
5457
|
+
var import_internals4 = require("@prisma/internals");
|
|
5641
5458
|
var ts18 = __toESM(require("@prisma/ts-builders"));
|
|
5642
5459
|
function clientTypeMapDefinition(context) {
|
|
5643
5460
|
const typeMap = `${ts18.stringify(clientTypeMapModelsDefinition(context))} & ${clientTypeMapOthersDefinition(context)}`;
|
|
@@ -5654,7 +5471,7 @@ function clientTypeMapModelsDefinition(context) {
|
|
|
5654
5471
|
if (modelNames.length === 0) {
|
|
5655
5472
|
meta.add(ts18.property("modelProps", ts18.neverType));
|
|
5656
5473
|
} else {
|
|
5657
|
-
meta.add(ts18.property("modelProps", ts18.unionType(modelNames.map((name) => ts18.stringLiteral((0,
|
|
5474
|
+
meta.add(ts18.property("modelProps", ts18.unionType(modelNames.map((name) => ts18.stringLiteral((0, import_client_common17.uncapitalize)(name))))));
|
|
5658
5475
|
}
|
|
5659
5476
|
const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? ts18.namedType("TransactionIsolationLevel") : ts18.neverType;
|
|
5660
5477
|
meta.add(ts18.property("txIsolationLevel", isolationLevel));
|
|
@@ -5737,7 +5554,7 @@ function clientTypeMapModelsResultDefinition(modelName, action) {
|
|
|
5737
5554
|
if (action === "update") return payloadToResult(modelName);
|
|
5738
5555
|
if (action === "upsert") return payloadToResult(modelName);
|
|
5739
5556
|
if (action === "delete") return payloadToResult(modelName);
|
|
5740
|
-
(0,
|
|
5557
|
+
(0, import_internals4.assertNever)(action, `Unknown action: ${action}`);
|
|
5741
5558
|
}
|
|
5742
5559
|
function payloadToResult(modelName) {
|
|
5743
5560
|
return ts18.namedType("runtime.Types.Utils.PayloadToResult").addGenericArgument(ts18.namedType(getPayloadName(modelName)));
|
|
@@ -5762,7 +5579,9 @@ function createPrismaNamespaceFile(context, options) {
|
|
|
5762
5579
|
ts19.moduleImport(context.importFileName(`../models`)).asNamespace("Prisma").typeOnly(),
|
|
5763
5580
|
ts19.moduleImport(context.importFileName(`./class`)).named(ts19.namedImport("PrismaClient").typeOnly())
|
|
5764
5581
|
].map((i) => ts19.stringify(i));
|
|
5765
|
-
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5582
|
+
const prismaEnums = context.dmmf.schema.enumTypes.prisma?.map(
|
|
5583
|
+
(type) => new Enum((0, import_dmmf3.datamodelSchemaEnumToSchemaEnum)(type), true).toTS()
|
|
5584
|
+
);
|
|
5766
5585
|
const fieldRefs = context.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
|
|
5767
5586
|
return `${jsDocHeader8}
|
|
5768
5587
|
${imports.join("\n")}
|
|
@@ -5773,7 +5592,10 @@ ${commonCodeTS(options)}
|
|
|
5773
5592
|
${new Enum(
|
|
5774
5593
|
{
|
|
5775
5594
|
name: "ModelName",
|
|
5776
|
-
|
|
5595
|
+
data: context.dmmf.mappings.modelOperations.map((m) => ({
|
|
5596
|
+
key: m.model,
|
|
5597
|
+
value: m.model
|
|
5598
|
+
}))
|
|
5777
5599
|
},
|
|
5778
5600
|
true
|
|
5779
5601
|
).toTS()}
|
|
@@ -5800,11 +5622,10 @@ export type BatchPayload = {
|
|
|
5800
5622
|
count: number
|
|
5801
5623
|
}
|
|
5802
5624
|
|
|
5803
|
-
${new Datasources(options.datasources).toTS()}
|
|
5804
5625
|
${clientExtensionsDefinitions()}
|
|
5805
5626
|
export type DefaultPrismaClient = PrismaClient
|
|
5806
5627
|
export type ErrorFormat = 'pretty' | 'colorless' | 'minimal'
|
|
5807
|
-
${ts19.stringify(ts19.moduleExport(buildClientOptions(context
|
|
5628
|
+
${ts19.stringify(ts19.moduleExport(buildClientOptions(context)))}
|
|
5808
5629
|
${ts19.stringify(globalOmitConfig(context.dmmf))}
|
|
5809
5630
|
|
|
5810
5631
|
/* Types for Logging */
|
|
@@ -5880,12 +5701,19 @@ function clientExtensionsDefinitions() {
|
|
|
5880
5701
|
);
|
|
5881
5702
|
return ts19.stringify(define);
|
|
5882
5703
|
}
|
|
5883
|
-
function buildClientOptions(context
|
|
5884
|
-
const
|
|
5885
|
-
ts19.property("
|
|
5886
|
-
).add(
|
|
5887
|
-
|
|
5888
|
-
|
|
5704
|
+
function buildClientOptions(context) {
|
|
5705
|
+
const adapterOption = ts19.objectType().add(
|
|
5706
|
+
ts19.property("adapter", ts19.namedType("runtime.SqlDriverAdapterFactory")).setDocComment(ts19.docComment("Instance of a Driver Adapter, e.g., like one provided by `@prisma/adapter-pg`."))
|
|
5707
|
+
).add(ts19.property("accelerateUrl", ts19.neverType).optional());
|
|
5708
|
+
const accelerateUrlOption = ts19.objectType().add(
|
|
5709
|
+
ts19.property("accelerateUrl", ts19.stringType).setDocComment(
|
|
5710
|
+
ts19.docComment(
|
|
5711
|
+
"Prisma Accelerate URL allowing the client to connect through Accelerate instead of a direct database."
|
|
5712
|
+
)
|
|
5713
|
+
)
|
|
5714
|
+
).add(ts19.property("adapter", ts19.neverType).optional());
|
|
5715
|
+
const mutuallyExclusiveOptions = ts19.unionType([adapterOption, accelerateUrlOption]);
|
|
5716
|
+
const otherOptions = ts19.objectType().add(
|
|
5889
5717
|
ts19.property("errorFormat", ts19.namedType("ErrorFormat")).optional().setDocComment(ts19.docComment('@default "colorless"'))
|
|
5890
5718
|
).add(
|
|
5891
5719
|
ts19.property("log", ts19.array(ts19.unionType([ts19.namedType("LogLevel"), ts19.namedType("LogDefinition")]))).optional().setDocComment(ts19.docComment`
|
|
@@ -5910,28 +5738,21 @@ function buildClientOptions(context, options) {
|
|
|
5910
5738
|
{ emit: 'stdout', level: 'error' }
|
|
5911
5739
|
]
|
|
5912
5740
|
\`\`\`
|
|
5913
|
-
Read more in our [docs](https://
|
|
5741
|
+
Read more in our [docs](https://pris.ly/d/logging).
|
|
5914
5742
|
`)
|
|
5915
5743
|
);
|
|
5916
5744
|
const transactionOptions = ts19.objectType().add(ts19.property("maxWait", ts19.numberType).optional()).add(ts19.property("timeout", ts19.numberType).optional());
|
|
5917
5745
|
if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
|
|
5918
5746
|
transactionOptions.add(ts19.property("isolationLevel", ts19.namedType("TransactionIsolationLevel")).optional());
|
|
5919
5747
|
}
|
|
5920
|
-
|
|
5748
|
+
otherOptions.add(
|
|
5921
5749
|
ts19.property("transactionOptions", transactionOptions).optional().setDocComment(ts19.docComment`
|
|
5922
5750
|
The default values for transactionOptions
|
|
5923
5751
|
maxWait ?= 2000
|
|
5924
5752
|
timeout ?= 5000
|
|
5925
5753
|
`)
|
|
5926
5754
|
);
|
|
5927
|
-
|
|
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(
|
|
5755
|
+
otherOptions.add(
|
|
5935
5756
|
ts19.property("omit", ts19.namedType("GlobalOmitConfig")).optional().setDocComment(ts19.docComment`
|
|
5936
5757
|
Global configuration for omitting model fields by default.
|
|
5937
5758
|
|
|
@@ -5947,7 +5768,27 @@ function buildClientOptions(context, options) {
|
|
|
5947
5768
|
\`\`\`
|
|
5948
5769
|
`)
|
|
5949
5770
|
);
|
|
5950
|
-
|
|
5771
|
+
if (context.isSqlProvider()) {
|
|
5772
|
+
otherOptions.add(
|
|
5773
|
+
ts19.property("comments", ts19.array(ts19.namedType("runtime.SqlCommenterPlugin"))).optional().setDocComment(ts19.docComment`
|
|
5774
|
+
SQL commenter plugins that add metadata to SQL queries as comments.
|
|
5775
|
+
Comments follow the sqlcommenter format: https://google.github.io/sqlcommenter/
|
|
5776
|
+
|
|
5777
|
+
@example
|
|
5778
|
+
\`\`\`
|
|
5779
|
+
const prisma = new PrismaClient({
|
|
5780
|
+
adapter,
|
|
5781
|
+
comments: [
|
|
5782
|
+
traceContext(),
|
|
5783
|
+
queryInsights(),
|
|
5784
|
+
],
|
|
5785
|
+
})
|
|
5786
|
+
\`\`\`
|
|
5787
|
+
`)
|
|
5788
|
+
);
|
|
5789
|
+
}
|
|
5790
|
+
const prismaClientOptions = ts19.intersectionType([mutuallyExclusiveOptions, otherOptions]);
|
|
5791
|
+
return ts19.typeDeclaration("PrismaClientOptions", prismaClientOptions);
|
|
5951
5792
|
}
|
|
5952
5793
|
|
|
5953
5794
|
// src/TSClient/GenerateContext.ts
|
|
@@ -5959,26 +5800,32 @@ var GenerateContext = class {
|
|
|
5959
5800
|
outputFileName;
|
|
5960
5801
|
importFileName;
|
|
5961
5802
|
generator;
|
|
5803
|
+
provider;
|
|
5962
5804
|
constructor({
|
|
5963
5805
|
dmmf,
|
|
5964
5806
|
genericArgsInfo,
|
|
5965
5807
|
runtimeBase,
|
|
5966
|
-
runtimeImport
|
|
5808
|
+
runtimeImport,
|
|
5967
5809
|
outputFileName,
|
|
5968
5810
|
importFileName,
|
|
5969
|
-
generator
|
|
5811
|
+
generator,
|
|
5812
|
+
provider
|
|
5970
5813
|
}) {
|
|
5971
5814
|
this.dmmf = dmmf;
|
|
5972
5815
|
this.genericArgsInfo = genericArgsInfo;
|
|
5973
5816
|
this.runtimeBase = runtimeBase;
|
|
5974
|
-
this.runtimeImport =
|
|
5817
|
+
this.runtimeImport = runtimeImport;
|
|
5975
5818
|
this.outputFileName = outputFileName;
|
|
5976
5819
|
this.importFileName = importFileName;
|
|
5977
5820
|
this.generator = generator;
|
|
5821
|
+
this.provider = provider;
|
|
5978
5822
|
}
|
|
5979
5823
|
isPreviewFeatureOn(previewFeature) {
|
|
5980
5824
|
return this.generator?.previewFeatures?.includes(previewFeature) ?? false;
|
|
5981
5825
|
}
|
|
5826
|
+
isSqlProvider() {
|
|
5827
|
+
return this.provider !== "mongodb";
|
|
5828
|
+
}
|
|
5982
5829
|
};
|
|
5983
5830
|
|
|
5984
5831
|
// src/TSClient/TSClient.ts
|
|
@@ -5998,7 +5845,8 @@ var TSClient = class {
|
|
|
5998
5845
|
runtimeImport: `${this.options.runtimeBase}/${this.options.runtimeName}`,
|
|
5999
5846
|
outputFileName: generatedFileNameMapper(this.options.generatedFileExtension),
|
|
6000
5847
|
importFileName: importFileNameMapper(this.options.importFileExtension),
|
|
6001
|
-
generator: this.options.generator
|
|
5848
|
+
generator: this.options.generator,
|
|
5849
|
+
provider: this.options.activeProvider
|
|
6002
5850
|
});
|
|
6003
5851
|
const modelNames = Object.values(context.dmmf.typeAndModelMap).filter((model) => context.dmmf.outputTypeMap.model[model.name]).map((model) => model.name);
|
|
6004
5852
|
const modelsFileMap = modelNames.reduce((acc, modelName) => {
|
|
@@ -6022,7 +5870,7 @@ var TSClient = class {
|
|
|
6022
5870
|
};
|
|
6023
5871
|
|
|
6024
5872
|
// src/typedSql/buildDbEnums.ts
|
|
6025
|
-
var
|
|
5873
|
+
var import_internals5 = require("@prisma/internals");
|
|
6026
5874
|
var ts20 = __toESM(require("@prisma/ts-builders"));
|
|
6027
5875
|
var DbEnumsList = class {
|
|
6028
5876
|
enums;
|
|
@@ -6040,14 +5888,14 @@ var DbEnumsList = class {
|
|
|
6040
5888
|
}
|
|
6041
5889
|
*validJsIdentifiers() {
|
|
6042
5890
|
for (const dbEnum of this.enums) {
|
|
6043
|
-
if ((0,
|
|
5891
|
+
if ((0, import_internals5.isValidJsIdentifier)(dbEnum.name)) {
|
|
6044
5892
|
yield dbEnum;
|
|
6045
5893
|
}
|
|
6046
5894
|
}
|
|
6047
5895
|
}
|
|
6048
5896
|
*invalidJsIdentifiers() {
|
|
6049
5897
|
for (const dbEnum of this.enums) {
|
|
6050
|
-
if (!(0,
|
|
5898
|
+
if (!(0, import_internals5.isValidJsIdentifier)(dbEnum.name)) {
|
|
6051
5899
|
yield dbEnum;
|
|
6052
5900
|
}
|
|
6053
5901
|
}
|
|
@@ -6278,7 +6126,7 @@ var DenylistError = class extends Error {
|
|
|
6278
6126
|
this.stack = void 0;
|
|
6279
6127
|
}
|
|
6280
6128
|
};
|
|
6281
|
-
(0,
|
|
6129
|
+
(0, import_internals6.setClassName)(DenylistError, "DenylistError");
|
|
6282
6130
|
function buildClient({
|
|
6283
6131
|
schemaPath,
|
|
6284
6132
|
runtimeBase,
|
|
@@ -6291,23 +6139,19 @@ function buildClient({
|
|
|
6291
6139
|
engineVersion,
|
|
6292
6140
|
clientVersion,
|
|
6293
6141
|
activeProvider,
|
|
6294
|
-
postinstall,
|
|
6295
|
-
copyEngine,
|
|
6296
|
-
envPaths,
|
|
6297
6142
|
typedSql,
|
|
6298
6143
|
target,
|
|
6299
6144
|
generatedFileExtension,
|
|
6300
6145
|
importFileExtension,
|
|
6301
6146
|
moduleFormat,
|
|
6302
|
-
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6147
|
+
tsNoCheckPreamble: tsNoCheckPreamble2,
|
|
6148
|
+
compilerBuild
|
|
6303
6149
|
}) {
|
|
6304
|
-
const
|
|
6305
|
-
const runtimeName = getRuntimeNameForTarget(target, clientEngineType);
|
|
6150
|
+
const runtimeName = getRuntimeNameForTarget(target);
|
|
6306
6151
|
const outputName = generatedFileNameMapper(generatedFileExtension);
|
|
6307
6152
|
const importName = importFileNameMapper(importFileExtension);
|
|
6308
6153
|
const clientOptions = {
|
|
6309
6154
|
dmmf: getPrismaClientDMMF(dmmf),
|
|
6310
|
-
envPaths: envPaths ?? { rootEnvPath: null, schemaEnvPath: void 0 },
|
|
6311
6155
|
datasources,
|
|
6312
6156
|
generator,
|
|
6313
6157
|
binaryPaths,
|
|
@@ -6317,20 +6161,16 @@ function buildClient({
|
|
|
6317
6161
|
clientVersion,
|
|
6318
6162
|
engineVersion,
|
|
6319
6163
|
activeProvider,
|
|
6320
|
-
postinstall,
|
|
6321
|
-
copyEngine,
|
|
6322
6164
|
datamodel,
|
|
6323
|
-
edge: ["
|
|
6165
|
+
edge: ["wasm-compiler-edge"].includes(runtimeName),
|
|
6324
6166
|
runtimeName,
|
|
6325
6167
|
target,
|
|
6326
6168
|
generatedFileExtension,
|
|
6327
6169
|
importFileExtension,
|
|
6328
6170
|
moduleFormat,
|
|
6329
|
-
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6171
|
+
tsNoCheckPreamble: tsNoCheckPreamble2,
|
|
6172
|
+
compilerBuild
|
|
6330
6173
|
};
|
|
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
|
-
}
|
|
6334
6174
|
const client = new TSClient(clientOptions);
|
|
6335
6175
|
let fileMap = client.generateClientFiles();
|
|
6336
6176
|
if (typedSql && typedSql.length > 0) {
|
|
@@ -6352,7 +6192,8 @@ function buildClient({
|
|
|
6352
6192
|
...fileMap.internal,
|
|
6353
6193
|
...buildWasmFileMap({
|
|
6354
6194
|
runtimeName,
|
|
6355
|
-
activeProvider
|
|
6195
|
+
activeProvider,
|
|
6196
|
+
compilerBuild
|
|
6356
6197
|
})
|
|
6357
6198
|
}
|
|
6358
6199
|
};
|
|
@@ -6384,17 +6225,14 @@ async function generateClient(options) {
|
|
|
6384
6225
|
clientVersion,
|
|
6385
6226
|
engineVersion,
|
|
6386
6227
|
activeProvider,
|
|
6387
|
-
postinstall,
|
|
6388
|
-
envPaths,
|
|
6389
|
-
copyEngine = true,
|
|
6390
6228
|
typedSql,
|
|
6391
6229
|
target,
|
|
6392
6230
|
generatedFileExtension,
|
|
6393
6231
|
importFileExtension,
|
|
6394
6232
|
moduleFormat,
|
|
6395
|
-
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6233
|
+
tsNoCheckPreamble: tsNoCheckPreamble2,
|
|
6234
|
+
compilerBuild
|
|
6396
6235
|
} = options;
|
|
6397
|
-
const clientEngineType = (0, import_internals10.getClientEngineType)(generator);
|
|
6398
6236
|
const { runtimeBase, outputDir } = await getGenerationDirs(options);
|
|
6399
6237
|
const { prismaClientDmmf, fileMap } = buildClient({
|
|
6400
6238
|
datamodel,
|
|
@@ -6408,15 +6246,13 @@ async function generateClient(options) {
|
|
|
6408
6246
|
clientVersion,
|
|
6409
6247
|
engineVersion,
|
|
6410
6248
|
activeProvider,
|
|
6411
|
-
postinstall,
|
|
6412
|
-
copyEngine,
|
|
6413
|
-
envPaths,
|
|
6414
6249
|
typedSql,
|
|
6415
6250
|
target,
|
|
6416
6251
|
generatedFileExtension,
|
|
6417
6252
|
importFileExtension,
|
|
6418
6253
|
moduleFormat,
|
|
6419
|
-
tsNoCheckPreamble: tsNoCheckPreamble2
|
|
6254
|
+
tsNoCheckPreamble: tsNoCheckPreamble2,
|
|
6255
|
+
compilerBuild
|
|
6420
6256
|
});
|
|
6421
6257
|
const denylistsErrors = validateDmmfAgainstDenylists(prismaClientDmmf);
|
|
6422
6258
|
if (denylistsErrors) {
|
|
@@ -6434,27 +6270,11 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
|
|
|
6434
6270
|
await deleteOutputDir(outputDir);
|
|
6435
6271
|
await (0, import_fs_extra.ensureDir)(outputDir);
|
|
6436
6272
|
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
|
-
}
|
|
6453
6273
|
}
|
|
6454
6274
|
function writeFileMap(outputDir, fileMap) {
|
|
6455
6275
|
return Promise.all(
|
|
6456
6276
|
Object.entries(fileMap).map(async ([fileName, content]) => {
|
|
6457
|
-
const absolutePath =
|
|
6277
|
+
const absolutePath = import_node_path2.default.join(outputDir, fileName);
|
|
6458
6278
|
await import_promises.default.rm(absolutePath, { recursive: true, force: true });
|
|
6459
6279
|
if (typeof content === "string" || Buffer.isBuffer(content)) {
|
|
6460
6280
|
await import_promises.default.writeFile(absolutePath, content);
|
|
@@ -6543,42 +6363,28 @@ function validateDmmfAgainstDenylists(prismaClientDmmf) {
|
|
|
6543
6363
|
return errorArray.length > 0 ? errorArray : null;
|
|
6544
6364
|
}
|
|
6545
6365
|
async function getGenerationDirs({ runtimeBase, outputDir }) {
|
|
6546
|
-
const normalizedOutputDir =
|
|
6547
|
-
const normalizedRuntimeBase = (0,
|
|
6548
|
-
const userPackageRoot = await (0, import_package_up.packageUp)({ cwd:
|
|
6549
|
-
const userProjectRoot = userPackageRoot ?
|
|
6366
|
+
const normalizedOutputDir = import_node_path2.default.normalize(outputDir);
|
|
6367
|
+
const normalizedRuntimeBase = (0, import_internals6.pathToPosix)(runtimeBase);
|
|
6368
|
+
const userPackageRoot = await (0, import_package_up.packageUp)({ cwd: import_node_path2.default.dirname(normalizedOutputDir) });
|
|
6369
|
+
const userProjectRoot = userPackageRoot ? import_node_path2.default.dirname(userPackageRoot) : process.cwd();
|
|
6550
6370
|
return {
|
|
6551
6371
|
runtimeBase: normalizedRuntimeBase,
|
|
6552
6372
|
outputDir: normalizedOutputDir,
|
|
6553
6373
|
projectRoot: userProjectRoot
|
|
6554
6374
|
};
|
|
6555
6375
|
}
|
|
6556
|
-
function getRuntimeNameForTarget(target
|
|
6376
|
+
function getRuntimeNameForTarget(target) {
|
|
6557
6377
|
switch (target) {
|
|
6558
6378
|
case "nodejs":
|
|
6559
6379
|
case "deno":
|
|
6560
|
-
return
|
|
6380
|
+
return "client";
|
|
6561
6381
|
case "workerd":
|
|
6562
6382
|
case "vercel-edge":
|
|
6563
|
-
return
|
|
6564
|
-
case "react-native":
|
|
6565
|
-
return "react-native";
|
|
6383
|
+
return "wasm-compiler-edge";
|
|
6566
6384
|
default:
|
|
6567
|
-
(0,
|
|
6385
|
+
(0, import_internals6.assertNever)(target, "Unknown runtime target");
|
|
6568
6386
|
}
|
|
6569
6387
|
}
|
|
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";
|
|
6576
|
-
}
|
|
6577
|
-
if (engineType === import_internals10.ClientEngineType.Client) {
|
|
6578
|
-
return "client";
|
|
6579
|
-
}
|
|
6580
|
-
(0, import_internals10.assertNever)(engineType, "Unknown engine type");
|
|
6581
|
-
}
|
|
6582
6388
|
async function deleteOutputDir(outputDir) {
|
|
6583
6389
|
try {
|
|
6584
6390
|
const files = await import_promises.default.readdir(outputDir);
|
|
@@ -6613,14 +6419,12 @@ async function deleteOutputDir(outputDir) {
|
|
|
6613
6419
|
}
|
|
6614
6420
|
|
|
6615
6421
|
// src/generator.ts
|
|
6616
|
-
var import_debug2 = require("@prisma/debug");
|
|
6617
6422
|
var import_engines_version = require("@prisma/engines-version");
|
|
6618
|
-
var
|
|
6423
|
+
var import_internals7 = require("@prisma/internals");
|
|
6619
6424
|
var import_get_tsconfig = require("get-tsconfig");
|
|
6620
|
-
var import_ts_pattern2 = require("ts-pattern");
|
|
6621
6425
|
|
|
6622
6426
|
// package.json
|
|
6623
|
-
var version = "7.3.0-integration-
|
|
6427
|
+
var version = "7.3.0-integration-engines-7-3-0-10-fix-fix-mapped-enum-issue-0b7e6564db7dc3dac7f9312aa84e9ed81d805521.1";
|
|
6624
6428
|
|
|
6625
6429
|
// src/module-format.ts
|
|
6626
6430
|
function parseModuleFormat(format) {
|
|
@@ -6663,16 +6467,7 @@ function fromTsConfigModule(module2) {
|
|
|
6663
6467
|
}
|
|
6664
6468
|
|
|
6665
6469
|
// src/runtime-targets.ts
|
|
6666
|
-
var supportedPublicRuntimes = [
|
|
6667
|
-
"nodejs",
|
|
6668
|
-
"deno",
|
|
6669
|
-
"bun",
|
|
6670
|
-
"workerd",
|
|
6671
|
-
"cloudflare",
|
|
6672
|
-
"vercel-edge",
|
|
6673
|
-
"edge-light",
|
|
6674
|
-
"react-native"
|
|
6675
|
-
];
|
|
6470
|
+
var supportedPublicRuntimes = ["nodejs", "deno", "bun", "workerd", "cloudflare", "vercel-edge", "edge-light"];
|
|
6676
6471
|
function parseRuntimeTarget(target) {
|
|
6677
6472
|
switch (target.toLowerCase()) {
|
|
6678
6473
|
case "workerd":
|
|
@@ -6686,8 +6481,6 @@ function parseRuntimeTarget(target) {
|
|
|
6686
6481
|
return "nodejs";
|
|
6687
6482
|
case "deno":
|
|
6688
6483
|
return "deno";
|
|
6689
|
-
case "react-native":
|
|
6690
|
-
return "react-native";
|
|
6691
6484
|
default:
|
|
6692
6485
|
throw new Error(
|
|
6693
6486
|
`Unknown target runtime: "${target}". The available options are: ${supportedPublicRuntimes.map((runtime) => `"${runtime}"`).join(", ")}`
|
|
@@ -6702,7 +6495,6 @@ function parseRuntimeTargetFromUnknown(target) {
|
|
|
6702
6495
|
}
|
|
6703
6496
|
|
|
6704
6497
|
// src/generator.ts
|
|
6705
|
-
var debug2 = (0, import_debug2.Debug)("prisma:client:generator");
|
|
6706
6498
|
var missingOutputErrorMessage = `An output path is required for the \`prisma-client\` generator. Please provide an output path in your schema file:
|
|
6707
6499
|
|
|
6708
6500
|
${dim(`generator client {
|
|
@@ -6716,18 +6508,16 @@ function getOutputPath(config) {
|
|
|
6716
6508
|
if (!config.output) {
|
|
6717
6509
|
throw new Error(missingOutputErrorMessage);
|
|
6718
6510
|
}
|
|
6719
|
-
return (0,
|
|
6511
|
+
return (0, import_internals7.parseEnvValue)(config.output);
|
|
6720
6512
|
}
|
|
6721
6513
|
var PrismaClientTsGenerator = class {
|
|
6722
6514
|
name = "prisma-client-ts";
|
|
6723
6515
|
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);
|
|
6726
6516
|
return Promise.resolve({
|
|
6727
6517
|
defaultOutput: getOutputPath(config),
|
|
6728
6518
|
prettyName: "Prisma Client",
|
|
6729
6519
|
version,
|
|
6730
|
-
requiresEngines,
|
|
6520
|
+
requiresEngines: [],
|
|
6731
6521
|
requiresEngineVersion: import_engines_version.enginesVersion
|
|
6732
6522
|
});
|
|
6733
6523
|
}
|
|
@@ -6752,7 +6542,6 @@ var PrismaClientTsGenerator = class {
|
|
|
6752
6542
|
schemaPath: options.schemaPath,
|
|
6753
6543
|
binaryPaths: options.binaryPaths,
|
|
6754
6544
|
datasources: options.datasources,
|
|
6755
|
-
envPaths: options.envPaths,
|
|
6756
6545
|
outputDir,
|
|
6757
6546
|
runtimeBase: "@prisma/client/runtime",
|
|
6758
6547
|
dmmf: options.dmmf,
|
|
@@ -6760,18 +6549,26 @@ var PrismaClientTsGenerator = class {
|
|
|
6760
6549
|
engineVersion: options.version,
|
|
6761
6550
|
clientVersion: version,
|
|
6762
6551
|
activeProvider: options.datasources[0]?.activeProvider,
|
|
6763
|
-
postinstall: options.postinstall,
|
|
6764
|
-
copyEngine: !options.noEngine,
|
|
6765
6552
|
typedSql: options.typedSql,
|
|
6766
6553
|
target,
|
|
6767
6554
|
generatedFileExtension,
|
|
6768
6555
|
importFileExtension,
|
|
6769
6556
|
moduleFormat,
|
|
6770
|
-
tsNoCheckPreamble: true
|
|
6557
|
+
tsNoCheckPreamble: true,
|
|
6771
6558
|
// Set to false only during internal tests
|
|
6559
|
+
compilerBuild: parseCompilerBuildFromUnknown(options.generator.config.compilerBuild, target)
|
|
6772
6560
|
});
|
|
6773
6561
|
}
|
|
6774
6562
|
};
|
|
6563
|
+
function parseCompilerBuildFromUnknown(value, target) {
|
|
6564
|
+
if (value === void 0) {
|
|
6565
|
+
return target === "vercel-edge" ? "small" : "fast";
|
|
6566
|
+
}
|
|
6567
|
+
if (value === "small" || value === "fast") {
|
|
6568
|
+
return value;
|
|
6569
|
+
}
|
|
6570
|
+
throw new Error(`Invalid compiler build: ${JSON.stringify(value)}, expected one of: "fast", "small"`);
|
|
6571
|
+
}
|
|
6775
6572
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6776
6573
|
0 && (module.exports = {
|
|
6777
6574
|
PrismaClientTsGenerator,
|