@prisma/client 5.18.0-integration-feat-typed-sql.9 → 5.18.0-integration-revert-24949-fix-ts-version.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.
@@ -33,18 +33,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
- // ../../node_modules/.pnpm/@prisma+engines-version@5.18.0-26.feat-introspect-sql-4dcdf8b8304815e12f4af0e41837efb42c98e9b7/node_modules/@prisma/engines-version/package.json
36
+ // ../../node_modules/.pnpm/@prisma+engines-version@5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169/node_modules/@prisma/engines-version/package.json
37
37
  var require_package = __commonJS({
38
- "../../node_modules/.pnpm/@prisma+engines-version@5.18.0-26.feat-introspect-sql-4dcdf8b8304815e12f4af0e41837efb42c98e9b7/node_modules/@prisma/engines-version/package.json"(exports2, module2) {
38
+ "../../node_modules/.pnpm/@prisma+engines-version@5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169/node_modules/@prisma/engines-version/package.json"(exports2, module2) {
39
39
  module2.exports = {
40
40
  name: "@prisma/engines-version",
41
- version: "5.18.0-26.feat-introspect-sql-4dcdf8b8304815e12f4af0e41837efb42c98e9b7",
41
+ version: "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169",
42
42
  main: "index.js",
43
43
  types: "index.d.ts",
44
44
  license: "Apache-2.0",
45
45
  author: "Tim Suchanek <suchanek@prisma.io>",
46
46
  prisma: {
47
- enginesVersion: "4dcdf8b8304815e12f4af0e41837efb42c98e9b7"
47
+ enginesVersion: "4c784e32044a8a016d99474bd02a3b6123742169"
48
48
  },
49
49
  repository: {
50
50
  type: "git",
@@ -66,9 +66,9 @@ var require_package = __commonJS({
66
66
  }
67
67
  });
68
68
 
69
- // ../../node_modules/.pnpm/@prisma+engines-version@5.18.0-26.feat-introspect-sql-4dcdf8b8304815e12f4af0e41837efb42c98e9b7/node_modules/@prisma/engines-version/index.js
69
+ // ../../node_modules/.pnpm/@prisma+engines-version@5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169/node_modules/@prisma/engines-version/index.js
70
70
  var require_engines_version = __commonJS({
71
- "../../node_modules/.pnpm/@prisma+engines-version@5.18.0-26.feat-introspect-sql-4dcdf8b8304815e12f4af0e41837efb42c98e9b7/node_modules/@prisma/engines-version/index.js"(exports2) {
71
+ "../../node_modules/.pnpm/@prisma+engines-version@5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169/node_modules/@prisma/engines-version/index.js"(exports2) {
72
72
  "use strict";
73
73
  Object.defineProperty(exports2, "__esModule", { value: true });
74
74
  exports2.enginesVersion = void 0;
@@ -197,29 +197,29 @@ var require_polyfills = __commonJS({
197
197
  }(fs3.rename);
198
198
  }
199
199
  fs3.read = typeof fs3.read !== "function" ? fs3.read : function(fs$read) {
200
- function read(fd, buffer2, offset, length, position, callback_) {
200
+ function read(fd, buffer, offset, length, position, callback_) {
201
201
  var callback;
202
202
  if (callback_ && typeof callback_ === "function") {
203
203
  var eagCounter = 0;
204
204
  callback = function(er, _, __) {
205
205
  if (er && er.code === "EAGAIN" && eagCounter < 10) {
206
206
  eagCounter++;
207
- return fs$read.call(fs3, fd, buffer2, offset, length, position, callback);
207
+ return fs$read.call(fs3, fd, buffer, offset, length, position, callback);
208
208
  }
209
209
  callback_.apply(this, arguments);
210
210
  };
211
211
  }
212
- return fs$read.call(fs3, fd, buffer2, offset, length, position, callback);
212
+ return fs$read.call(fs3, fd, buffer, offset, length, position, callback);
213
213
  }
214
214
  if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
215
215
  return read;
216
216
  }(fs3.read);
217
217
  fs3.readSync = typeof fs3.readSync !== "function" ? fs3.readSync : /* @__PURE__ */ function(fs$readSync) {
218
- return function(fd, buffer2, offset, length, position) {
218
+ return function(fd, buffer, offset, length, position) {
219
219
  var eagCounter = 0;
220
220
  while (true) {
221
221
  try {
222
- return fs$readSync.call(fs3, fd, buffer2, offset, length, position);
222
+ return fs$readSync.call(fs3, fd, buffer, offset, length, position);
223
223
  } catch (er) {
224
224
  if (er.code === "EAGAIN" && eagCounter < 10) {
225
225
  eagCounter++;
@@ -533,8 +533,8 @@ var require_graceful_fs = __commonJS({
533
533
  }
534
534
  function noop() {
535
535
  }
536
- function publishQueue(context2, queue2) {
537
- Object.defineProperty(context2, gracefulQueue, {
536
+ function publishQueue(context, queue2) {
537
+ Object.defineProperty(context, gracefulQueue, {
538
538
  get: function() {
539
539
  return queue2;
540
540
  }
@@ -940,25 +940,25 @@ var require_fs = __commonJS({
940
940
  return fs3.exists(filename, resolve);
941
941
  });
942
942
  };
943
- exports2.read = function(fd, buffer2, offset, length, position, callback) {
943
+ exports2.read = function(fd, buffer, offset, length, position, callback) {
944
944
  if (typeof callback === "function") {
945
- return fs3.read(fd, buffer2, offset, length, position, callback);
945
+ return fs3.read(fd, buffer, offset, length, position, callback);
946
946
  }
947
947
  return new Promise((resolve, reject) => {
948
- fs3.read(fd, buffer2, offset, length, position, (err, bytesRead, buffer3) => {
948
+ fs3.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
949
949
  if (err) return reject(err);
950
- resolve({ bytesRead, buffer: buffer3 });
950
+ resolve({ bytesRead, buffer: buffer2 });
951
951
  });
952
952
  });
953
953
  };
954
- exports2.write = function(fd, buffer2, ...args) {
954
+ exports2.write = function(fd, buffer, ...args) {
955
955
  if (typeof args[args.length - 1] === "function") {
956
- return fs3.write(fd, buffer2, ...args);
956
+ return fs3.write(fd, buffer, ...args);
957
957
  }
958
958
  return new Promise((resolve, reject) => {
959
- fs3.write(fd, buffer2, ...args, (err, bytesWritten, buffer3) => {
959
+ fs3.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
960
960
  if (err) return reject(err);
961
- resolve({ bytesWritten, buffer: buffer3 });
961
+ resolve({ bytesWritten, buffer: buffer2 });
962
962
  });
963
963
  });
964
964
  };
@@ -1112,7 +1112,7 @@ var require_stat = __commonJS({
1112
1112
  var path5 = require("path");
1113
1113
  var util2 = require("util");
1114
1114
  function getStats(src, dest, opts) {
1115
- const statFunc = opts.dereference ? (file2) => fs3.stat(file2, { bigint: true }) : (file2) => fs3.lstat(file2, { bigint: true });
1115
+ const statFunc = opts.dereference ? (file) => fs3.stat(file, { bigint: true }) : (file) => fs3.lstat(file, { bigint: true });
1116
1116
  return Promise.all([
1117
1117
  statFunc(src),
1118
1118
  statFunc(dest).catch((err) => {
@@ -1123,7 +1123,7 @@ var require_stat = __commonJS({
1123
1123
  }
1124
1124
  function getStatsSync(src, dest, opts) {
1125
1125
  let destStat;
1126
- const statFunc = opts.dereference ? (file2) => fs3.statSync(file2, { bigint: true }) : (file2) => fs3.lstatSync(file2, { bigint: true });
1126
+ const statFunc = opts.dereference ? (file) => fs3.statSync(file, { bigint: true }) : (file) => fs3.lstatSync(file, { bigint: true });
1127
1127
  const srcStat = statFunc(src);
1128
1128
  try {
1129
1129
  destStat = statFunc(dest);
@@ -1639,16 +1639,16 @@ var require_file = __commonJS({
1639
1639
  var path5 = require("path");
1640
1640
  var fs3 = require_graceful_fs();
1641
1641
  var mkdir = require_mkdirs();
1642
- function createFile(file2, callback) {
1642
+ function createFile(file, callback) {
1643
1643
  function makeFile() {
1644
- fs3.writeFile(file2, "", (err) => {
1644
+ fs3.writeFile(file, "", (err) => {
1645
1645
  if (err) return callback(err);
1646
1646
  callback();
1647
1647
  });
1648
1648
  }
1649
- fs3.stat(file2, (err, stats) => {
1649
+ fs3.stat(file, (err, stats) => {
1650
1650
  if (!err && stats.isFile()) return callback();
1651
- const dir = path5.dirname(file2);
1651
+ const dir = path5.dirname(file);
1652
1652
  fs3.stat(dir, (err2, stats2) => {
1653
1653
  if (err2) {
1654
1654
  if (err2.code === "ENOENT") {
@@ -1668,14 +1668,14 @@ var require_file = __commonJS({
1668
1668
  });
1669
1669
  });
1670
1670
  }
1671
- function createFileSync(file2) {
1671
+ function createFileSync(file) {
1672
1672
  let stats;
1673
1673
  try {
1674
- stats = fs3.statSync(file2);
1674
+ stats = fs3.statSync(file);
1675
1675
  } catch {
1676
1676
  }
1677
1677
  if (stats && stats.isFile()) return;
1678
- const dir = path5.dirname(file2);
1678
+ const dir = path5.dirname(file);
1679
1679
  try {
1680
1680
  if (!fs3.statSync(dir).isDirectory()) {
1681
1681
  fs3.readdirSync(dir);
@@ -1684,7 +1684,7 @@ var require_file = __commonJS({
1684
1684
  if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
1685
1685
  else throw err;
1686
1686
  }
1687
- fs3.writeFileSync(file2, "");
1687
+ fs3.writeFileSync(file, "");
1688
1688
  }
1689
1689
  module2.exports = {
1690
1690
  createFile: u(createFile),
@@ -2000,20 +2000,20 @@ var require_jsonfile = __commonJS({
2000
2000
  }
2001
2001
  var universalify = require_universalify();
2002
2002
  var { stringify: stringify2, stripBom } = require_utils2();
2003
- async function _readFile(file2, options = {}) {
2003
+ async function _readFile(file, options = {}) {
2004
2004
  if (typeof options === "string") {
2005
2005
  options = { encoding: options };
2006
2006
  }
2007
2007
  const fs3 = options.fs || _fs;
2008
2008
  const shouldThrow = "throws" in options ? options.throws : true;
2009
- let data = await universalify.fromCallback(fs3.readFile)(file2, options);
2009
+ let data = await universalify.fromCallback(fs3.readFile)(file, options);
2010
2010
  data = stripBom(data);
2011
2011
  let obj;
2012
2012
  try {
2013
2013
  obj = JSON.parse(data, options ? options.reviver : null);
2014
2014
  } catch (err) {
2015
2015
  if (shouldThrow) {
2016
- err.message = `${file2}: ${err.message}`;
2016
+ err.message = `${file}: ${err.message}`;
2017
2017
  throw err;
2018
2018
  } else {
2019
2019
  return null;
@@ -2022,35 +2022,35 @@ var require_jsonfile = __commonJS({
2022
2022
  return obj;
2023
2023
  }
2024
2024
  var readFile = universalify.fromPromise(_readFile);
2025
- function readFileSync(file2, options = {}) {
2025
+ function readFileSync(file, options = {}) {
2026
2026
  if (typeof options === "string") {
2027
2027
  options = { encoding: options };
2028
2028
  }
2029
2029
  const fs3 = options.fs || _fs;
2030
2030
  const shouldThrow = "throws" in options ? options.throws : true;
2031
2031
  try {
2032
- let content = fs3.readFileSync(file2, options);
2032
+ let content = fs3.readFileSync(file, options);
2033
2033
  content = stripBom(content);
2034
2034
  return JSON.parse(content, options.reviver);
2035
2035
  } catch (err) {
2036
2036
  if (shouldThrow) {
2037
- err.message = `${file2}: ${err.message}`;
2037
+ err.message = `${file}: ${err.message}`;
2038
2038
  throw err;
2039
2039
  } else {
2040
2040
  return null;
2041
2041
  }
2042
2042
  }
2043
2043
  }
2044
- async function _writeFile(file2, obj, options = {}) {
2044
+ async function _writeFile(file, obj, options = {}) {
2045
2045
  const fs3 = options.fs || _fs;
2046
2046
  const str = stringify2(obj, options);
2047
- await universalify.fromCallback(fs3.writeFile)(file2, str, options);
2047
+ await universalify.fromCallback(fs3.writeFile)(file, str, options);
2048
2048
  }
2049
2049
  var writeFile = universalify.fromPromise(_writeFile);
2050
- function writeFileSync(file2, obj, options = {}) {
2050
+ function writeFileSync(file, obj, options = {}) {
2051
2051
  const fs3 = options.fs || _fs;
2052
2052
  const str = stringify2(obj, options);
2053
- return fs3.writeFileSync(file2, str, options);
2053
+ return fs3.writeFileSync(file, str, options);
2054
2054
  }
2055
2055
  var jsonfile = {
2056
2056
  readFile,
@@ -2086,28 +2086,28 @@ var require_output_file = __commonJS({
2086
2086
  var path5 = require("path");
2087
2087
  var mkdir = require_mkdirs();
2088
2088
  var pathExists2 = require_path_exists().pathExists;
2089
- function outputFile(file2, data, encoding, callback) {
2089
+ function outputFile(file, data, encoding, callback) {
2090
2090
  if (typeof encoding === "function") {
2091
2091
  callback = encoding;
2092
2092
  encoding = "utf8";
2093
2093
  }
2094
- const dir = path5.dirname(file2);
2094
+ const dir = path5.dirname(file);
2095
2095
  pathExists2(dir, (err, itDoes) => {
2096
2096
  if (err) return callback(err);
2097
- if (itDoes) return fs3.writeFile(file2, data, encoding, callback);
2097
+ if (itDoes) return fs3.writeFile(file, data, encoding, callback);
2098
2098
  mkdir.mkdirs(dir, (err2) => {
2099
2099
  if (err2) return callback(err2);
2100
- fs3.writeFile(file2, data, encoding, callback);
2100
+ fs3.writeFile(file, data, encoding, callback);
2101
2101
  });
2102
2102
  });
2103
2103
  }
2104
- function outputFileSync(file2, ...args) {
2105
- const dir = path5.dirname(file2);
2104
+ function outputFileSync(file, ...args) {
2105
+ const dir = path5.dirname(file);
2106
2106
  if (fs3.existsSync(dir)) {
2107
- return fs3.writeFileSync(file2, ...args);
2107
+ return fs3.writeFileSync(file, ...args);
2108
2108
  }
2109
2109
  mkdir.mkdirsSync(dir);
2110
- fs3.writeFileSync(file2, ...args);
2110
+ fs3.writeFileSync(file, ...args);
2111
2111
  }
2112
2112
  module2.exports = {
2113
2113
  outputFile: u(outputFile),
@@ -2122,9 +2122,9 @@ var require_output_json = __commonJS({
2122
2122
  "use strict";
2123
2123
  var { stringify: stringify2 } = require_utils2();
2124
2124
  var { outputFile } = require_output_file();
2125
- async function outputJson(file2, data, options = {}) {
2125
+ async function outputJson(file, data, options = {}) {
2126
2126
  const str = stringify2(data, options);
2127
- await outputFile(file2, str, options);
2127
+ await outputFile(file, str, options);
2128
2128
  }
2129
2129
  module2.exports = outputJson;
2130
2130
  }
@@ -2136,9 +2136,9 @@ var require_output_json_sync = __commonJS({
2136
2136
  "use strict";
2137
2137
  var { stringify: stringify2 } = require_utils2();
2138
2138
  var { outputFileSync } = require_output_file();
2139
- function outputJsonSync(file2, data, options) {
2139
+ function outputJsonSync(file, data, options) {
2140
2140
  const str = stringify2(data, options);
2141
- outputFileSync(file2, str, options);
2141
+ outputFileSync(file, str, options);
2142
2142
  }
2143
2143
  module2.exports = outputJsonSync;
2144
2144
  }
@@ -2380,8 +2380,8 @@ var require_indent_string = __commonJS({
2380
2380
  if (count === 0) {
2381
2381
  return string;
2382
2382
  }
2383
- const regex3 = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
2384
- return string.replace(regex3, options.indent.repeat(count));
2383
+ const regex = options.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
2384
+ return string.replace(regex, options.indent.repeat(count));
2385
2385
  };
2386
2386
  }
2387
2387
  });
@@ -2950,9 +2950,9 @@ var require_find_up = __commonJS({
2950
2950
  const filenames = [].concat(filename);
2951
2951
  return new Promise((resolve) => {
2952
2952
  (function find(dir) {
2953
- locatePath2(filenames, { cwd: dir }).then((file2) => {
2954
- if (file2) {
2955
- resolve(path5.join(dir, file2));
2953
+ locatePath2(filenames, { cwd: dir }).then((file) => {
2954
+ if (file) {
2955
+ resolve(path5.join(dir, file));
2956
2956
  } else if (dir === root) {
2957
2957
  resolve(null);
2958
2958
  } else {
@@ -2967,9 +2967,9 @@ var require_find_up = __commonJS({
2967
2967
  const { root } = path5.parse(dir);
2968
2968
  const filenames = [].concat(filename);
2969
2969
  while (true) {
2970
- const file2 = locatePath2.sync(filenames, { cwd: dir });
2971
- if (file2) {
2972
- return path5.join(dir, file2);
2970
+ const file = locatePath2.sync(filenames, { cwd: dir });
2971
+ if (file) {
2972
+ return path5.join(dir, file);
2973
2973
  }
2974
2974
  if (dir === root) {
2975
2975
  return null;
@@ -2995,7 +2995,7 @@ var require_package2 = __commonJS({
2995
2995
  "package.json"(exports2, module2) {
2996
2996
  module2.exports = {
2997
2997
  name: "@prisma/client",
2998
- version: "5.18.0-integration-feat-typed-sql.9",
2998
+ version: "5.18.0-integration-revert-24949-fix-ts-version.1",
2999
2999
  description: "Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.",
3000
3000
  keywords: [
3001
3001
  "ORM",
@@ -3102,19 +3102,6 @@ var require_package2 = __commonJS({
3102
3102
  import: "./generator-build/index.js",
3103
3103
  default: "./generator-build/index.js"
3104
3104
  },
3105
- "./sql": {
3106
- require: {
3107
- types: "./sql.d.ts",
3108
- node: "./sql.js",
3109
- default: "./sql.js"
3110
- },
3111
- import: {
3112
- types: "./sql.d.ts",
3113
- node: "./sql.mjs",
3114
- default: "./sql.mjs"
3115
- },
3116
- default: "./sql.js"
3117
- },
3118
3105
  "./*": "./*"
3119
3106
  },
3120
3107
  license: "Apache-2.0",
@@ -3173,7 +3160,7 @@ var require_package2 = __commonJS({
3173
3160
  "@jest/create-cache-key-function": "29.7.0",
3174
3161
  "@jest/globals": "29.7.0",
3175
3162
  "@jest/test-sequencer": "29.7.0",
3176
- "@libsql/client": "0.6.2",
3163
+ "@libsql/client": "0.8.0",
3177
3164
  "@neondatabase/serverless": "0.9.3",
3178
3165
  "@opentelemetry/api": "1.9.0",
3179
3166
  "@opentelemetry/context-async-hooks": "1.25.1",
@@ -3191,7 +3178,7 @@ var require_package2 = __commonJS({
3191
3178
  "@prisma/debug": "workspace:*",
3192
3179
  "@prisma/driver-adapter-utils": "workspace:*",
3193
3180
  "@prisma/engines": "workspace:*",
3194
- "@prisma/engines-version": "5.18.0-26.feat-introspect-sql-4dcdf8b8304815e12f4af0e41837efb42c98e9b7",
3181
+ "@prisma/engines-version": "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169",
3195
3182
  "@prisma/fetch-engine": "workspace:*",
3196
3183
  "@prisma/generator-helper": "workspace:*",
3197
3184
  "@prisma/get-platform": "workspace:*",
@@ -3200,7 +3187,7 @@ var require_package2 = __commonJS({
3200
3187
  "@prisma/migrate": "workspace:*",
3201
3188
  "@prisma/mini-proxy": "0.9.5",
3202
3189
  "@prisma/pg-worker": "workspace:*",
3203
- "@prisma/query-engine-wasm": "5.18.0-26.feat-introspect-sql-4dcdf8b8304815e12f4af0e41837efb42c98e9b7",
3190
+ "@prisma/query-engine-wasm": "5.18.0-25.4c784e32044a8a016d99474bd02a3b6123742169",
3204
3191
  "@snaplet/copycat": "0.17.3",
3205
3192
  "@swc-node/register": "1.10.3",
3206
3193
  "@swc/core": "1.6.13",
@@ -3227,7 +3214,6 @@ var require_package2 = __commonJS({
3227
3214
  "get-stream": "6.0.1",
3228
3215
  globby: "11.1.0",
3229
3216
  "indent-string": "4.0.0",
3230
- "is-identifier": "1.0.1",
3231
3217
  jest: "29.7.0",
3232
3218
  "jest-extended": "4.0.2",
3233
3219
  "jest-junit": "16.0.0",
@@ -3982,9 +3968,9 @@ var processEnv = typeof process !== "undefined" ? process.env : {};
3982
3968
  globalThis.DEBUG ??= processEnv.DEBUG ?? "";
3983
3969
  globalThis.DEBUG_COLORS ??= processEnv.DEBUG_COLORS ? processEnv.DEBUG_COLORS === "true" : true;
3984
3970
  var topProps = {
3985
- enable(namespace2) {
3986
- if (typeof namespace2 === "string") {
3987
- globalThis.DEBUG = namespace2;
3971
+ enable(namespace) {
3972
+ if (typeof namespace === "string") {
3973
+ globalThis.DEBUG = namespace;
3988
3974
  }
3989
3975
  },
3990
3976
  disable() {
@@ -3993,47 +3979,47 @@ var topProps = {
3993
3979
  return prev;
3994
3980
  },
3995
3981
  // this is the core logic to check if logging should happen or not
3996
- enabled(namespace2) {
3982
+ enabled(namespace) {
3997
3983
  const listenedNamespaces = globalThis.DEBUG.split(",").map((s) => {
3998
3984
  return s.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
3999
3985
  });
4000
3986
  const isListened = listenedNamespaces.some((listenedNamespace) => {
4001
3987
  if (listenedNamespace === "" || listenedNamespace[0] === "-") return false;
4002
- return namespace2.match(RegExp(listenedNamespace.split("*").join(".*") + "$"));
3988
+ return namespace.match(RegExp(listenedNamespace.split("*").join(".*") + "$"));
4003
3989
  });
4004
3990
  const isExcluded = listenedNamespaces.some((listenedNamespace) => {
4005
3991
  if (listenedNamespace === "" || listenedNamespace[0] !== "-") return false;
4006
- return namespace2.match(RegExp(listenedNamespace.slice(1).split("*").join(".*") + "$"));
3992
+ return namespace.match(RegExp(listenedNamespace.slice(1).split("*").join(".*") + "$"));
4007
3993
  });
4008
3994
  return isListened && !isExcluded;
4009
3995
  },
4010
3996
  log: (...args) => {
4011
- const [namespace2, format, ...rest] = args;
3997
+ const [namespace, format, ...rest] = args;
4012
3998
  const logWithFormatting = console.warn ?? console.log;
4013
- logWithFormatting(`${namespace2} ${format}`, ...rest);
3999
+ logWithFormatting(`${namespace} ${format}`, ...rest);
4014
4000
  },
4015
4001
  formatters: {}
4016
4002
  // not implemented
4017
4003
  };
4018
- function debugCreate(namespace2) {
4004
+ function debugCreate(namespace) {
4019
4005
  const instanceProps = {
4020
4006
  color: COLORS[lastColor++ % COLORS.length],
4021
- enabled: topProps.enabled(namespace2),
4022
- namespace: namespace2,
4007
+ enabled: topProps.enabled(namespace),
4008
+ namespace,
4023
4009
  log: topProps.log,
4024
4010
  extend: () => {
4025
4011
  }
4026
4012
  // not implemented
4027
4013
  };
4028
4014
  const debugCall = (...args) => {
4029
- const { enabled, namespace: namespace3, color, log } = instanceProps;
4015
+ const { enabled, namespace: namespace2, color, log } = instanceProps;
4030
4016
  if (args.length !== 0) {
4031
- argsHistory.push([namespace3, ...args]);
4017
+ argsHistory.push([namespace2, ...args]);
4032
4018
  }
4033
4019
  if (argsHistory.length > MAX_ARGS_HISTORY) {
4034
4020
  argsHistory.shift();
4035
4021
  }
4036
- if (topProps.enabled(namespace3) || enabled) {
4022
+ if (topProps.enabled(namespace2) || enabled) {
4037
4023
  const stringArgs = args.map((arg) => {
4038
4024
  if (typeof arg === "string") {
4039
4025
  return arg;
@@ -4043,9 +4029,9 @@ function debugCreate(namespace2) {
4043
4029
  const ms = `+${Date.now() - lastTimestamp}ms`;
4044
4030
  lastTimestamp = Date.now();
4045
4031
  if (globalThis.DEBUG_COLORS) {
4046
- log(colors_exports[color](bold(namespace3)), ...stringArgs, colors_exports[color](ms));
4032
+ log(colors_exports[color](bold(namespace2)), ...stringArgs, colors_exports[color](ms));
4047
4033
  } else {
4048
- log(namespace3, ...stringArgs, ms);
4034
+ log(namespace2, ...stringArgs, ms);
4049
4035
  }
4050
4036
  }
4051
4037
  };
@@ -4769,94 +4755,21 @@ function moduleExport(declaration) {
4769
4755
  }
4770
4756
 
4771
4757
  // src/generation/ts-builders/ExportFrom.ts
4772
- var NamespaceExport = class {
4773
- constructor(from, namespace2) {
4774
- this.from = from;
4775
- this.namespace = namespace2;
4776
- }
4777
- write(writer) {
4778
- writer.write(`export * as ${this.namespace} from '${this.from}'`);
4779
- }
4780
- };
4781
- var BindingsExport = class {
4782
- constructor(from) {
4783
- this.from = from;
4784
- this.namedExports = [];
4785
- }
4786
- named(namedExport) {
4787
- if (typeof namedExport === "string") {
4788
- namedExport = new NamedExport(namedExport);
4789
- }
4790
- this.namedExports.push(namedExport);
4791
- return this;
4792
- }
4793
- write(writer) {
4794
- writer.write("export ").write("{ ").writeJoined(", ", this.namedExports).write(" }").write(` from "${this.from}"`);
4795
- }
4796
- };
4797
- var NamedExport = class {
4798
- constructor(name) {
4799
- this.name = name;
4800
- }
4801
- as(alias) {
4802
- this.alias = alias;
4803
- return this;
4804
- }
4805
- write(writer) {
4806
- writer.write(this.name);
4807
- if (this.alias) {
4808
- writer.write(" as ").write(this.alias);
4809
- }
4810
- }
4811
- };
4812
- var ExportAllFrom = class {
4813
- constructor(from) {
4758
+ var ExportFrom = class {
4759
+ constructor(modules, from) {
4760
+ this.modules = modules;
4814
4761
  this.from = from;
4815
4762
  }
4816
- asNamespace(namespace2) {
4817
- return new NamespaceExport(this.from, namespace2);
4818
- }
4819
- named(binding) {
4820
- return new BindingsExport(this.from).named(binding);
4821
- }
4822
- write(writer) {
4823
- writer.write(`export * from "${this.from}"`);
4824
- }
4825
- };
4826
- function moduleExportFrom(from) {
4827
- return new ExportAllFrom(from);
4828
- }
4829
-
4830
- // src/generation/ts-builders/File.ts
4831
- var File = class {
4832
- constructor() {
4833
- this.imports = [];
4834
- this.declarations = [];
4835
- }
4836
- addImport(moduleImport2) {
4837
- this.imports.push(moduleImport2);
4838
- return this;
4839
- }
4840
- add(declaration) {
4841
- this.declarations.push(declaration);
4842
- }
4843
4763
  write(writer) {
4844
- for (const moduleImport2 of this.imports) {
4845
- writer.writeLine(moduleImport2);
4846
- }
4847
- if (this.imports.length > 0) {
4848
- writer.newLine();
4849
- }
4850
- for (const [i, declaration] of this.declarations.entries()) {
4851
- writer.writeLine(declaration);
4852
- if (i < this.declarations.length - 1) {
4853
- writer.newLine();
4854
- }
4764
+ if (this.modules === "*") {
4765
+ writer.write(`export * from '${this.from}'`);
4766
+ } else {
4767
+ writer.write(`export { ${this.modules.join(", ")} } from '${this.from}'`);
4855
4768
  }
4856
4769
  }
4857
4770
  };
4858
- function file() {
4859
- return new File();
4771
+ function moduleExportFrom(modules, from) {
4772
+ return new ExportFrom(modules, from);
4860
4773
  }
4861
4774
 
4862
4775
  // src/generation/ts-builders/PrimitiveType.ts
@@ -4984,85 +4897,6 @@ function optional(innerType) {
4984
4897
  return new NamedType("$Utils.Optional").addGenericArgument(innerType);
4985
4898
  }
4986
4899
 
4987
- // src/generation/ts-builders/Import.ts
4988
- var NamespaceImport = class {
4989
- constructor(alias, from) {
4990
- this.alias = alias;
4991
- this.from = from;
4992
- }
4993
- write(writer) {
4994
- writer.write("import * as ").write(this.alias).write(` from "${this.from}"`);
4995
- }
4996
- };
4997
- var BindingsImport = class {
4998
- constructor(from) {
4999
- this.from = from;
5000
- this.namedImports = [];
5001
- }
5002
- default(name) {
5003
- this.defaultImport = name;
5004
- return this;
5005
- }
5006
- named(namedImport) {
5007
- if (typeof namedImport === "string") {
5008
- namedImport = new NamedImport(namedImport);
5009
- }
5010
- this.namedImports.push(namedImport);
5011
- return this;
5012
- }
5013
- write(writer) {
5014
- writer.write("import ");
5015
- if (this.defaultImport) {
5016
- writer.write(this.defaultImport);
5017
- if (this.hasNamedImports()) {
5018
- writer.write(", ");
5019
- }
5020
- }
5021
- if (this.hasNamedImports()) {
5022
- writer.write("{ ").writeJoined(", ", this.namedImports).write(" }");
5023
- }
5024
- writer.write(` from "${this.from}"`);
5025
- }
5026
- hasNamedImports() {
5027
- return this.namedImports.length > 0;
5028
- }
5029
- };
5030
- var NamedImport = class {
5031
- constructor(name) {
5032
- this.name = name;
5033
- }
5034
- as(alias) {
5035
- this.alias = alias;
5036
- return this;
5037
- }
5038
- write(writer) {
5039
- writer.write(this.name);
5040
- if (this.alias) {
5041
- writer.write(" as ").write(this.alias);
5042
- }
5043
- }
5044
- };
5045
- var ModuleImport = class {
5046
- constructor(from) {
5047
- this.from = from;
5048
- }
5049
- asNamespace(alias) {
5050
- return new NamespaceImport(alias, this.from);
5051
- }
5052
- default(alias) {
5053
- return new BindingsImport(this.from).default(alias);
5054
- }
5055
- named(namedImport) {
5056
- return new BindingsImport(this.from).named(namedImport);
5057
- }
5058
- write(writer) {
5059
- writer.write("import ").write(`"${this.from}"`);
5060
- }
5061
- };
5062
- function moduleImport(from) {
5063
- return new ModuleImport(from);
5064
- }
5065
-
5066
4900
  // src/generation/ts-builders/Interface.ts
5067
4901
  init_TypeBuilder();
5068
4902
  var InterfaceDeclaration = class extends TypeBuilder {
@@ -5161,27 +4995,6 @@ function method(name) {
5161
4995
  return new Method(name);
5162
4996
  }
5163
4997
 
5164
- // src/generation/ts-builders/NamespaceDeclaration.ts
5165
- var NamespaceDeclaration = class {
5166
- constructor(name) {
5167
- this.name = name;
5168
- this.items = [];
5169
- }
5170
- add(declaration) {
5171
- this.items.push(declaration);
5172
- }
5173
- write(writer) {
5174
- writer.writeLine(`namespace ${this.name} {`).withIndent(() => {
5175
- for (const item of this.items) {
5176
- writer.writeLine(item);
5177
- }
5178
- }).write("}");
5179
- }
5180
- };
5181
- function namespace(name) {
5182
- return new NamespaceDeclaration(name);
5183
- }
5184
-
5185
4998
  // src/generation/ts-builders/ObjectType.ts
5186
4999
  init_TypeBuilder();
5187
5000
  var ObjectType = class extends TypeBuilder {
@@ -5252,124 +5065,6 @@ function parameter(name, type) {
5252
5065
  return new Parameter(name, type);
5253
5066
  }
5254
5067
 
5255
- // ../../node_modules/.pnpm/reserved-identifiers@1.0.0/node_modules/reserved-identifiers/index.js
5256
- var identifiers = [
5257
- // Keywords
5258
- "await",
5259
- "break",
5260
- "case",
5261
- "catch",
5262
- "class",
5263
- "const",
5264
- "continue",
5265
- "debugger",
5266
- "default",
5267
- "delete",
5268
- "do",
5269
- "else",
5270
- "enum",
5271
- "export",
5272
- "extends",
5273
- "false",
5274
- "finally",
5275
- "for",
5276
- "function",
5277
- "if",
5278
- "import",
5279
- "in",
5280
- "instanceof",
5281
- "new",
5282
- "null",
5283
- "return",
5284
- "super",
5285
- "switch",
5286
- "this",
5287
- "throw",
5288
- "true",
5289
- "try",
5290
- "typeof",
5291
- "var",
5292
- "void",
5293
- "while",
5294
- "with",
5295
- "yield",
5296
- // Future reserved keywords
5297
- "implements",
5298
- "interface",
5299
- "package",
5300
- "private",
5301
- "protected",
5302
- "public",
5303
- // Not keywords, but still restricted
5304
- "arguments",
5305
- "eval"
5306
- ];
5307
- var globalProperties = [
5308
- "globalThis",
5309
- "Infinity",
5310
- "NaN",
5311
- "undefined"
5312
- ];
5313
- function reservedIdentifiers({ includeGlobalProperties = false } = {}) {
5314
- return /* @__PURE__ */ new Set([
5315
- ...identifiers,
5316
- ...includeGlobalProperties ? globalProperties : []
5317
- ]);
5318
- }
5319
-
5320
- // ../../node_modules/.pnpm/identifier-regex@1.0.0/node_modules/identifier-regex/index.js
5321
- var baseRegex = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*/u;
5322
- var basePattern = `(?!${[...reservedIdentifiers({ includeGlobalProperties: true })].join("|")})${baseRegex.source}`;
5323
- var regex = new RegExp(basePattern, "u");
5324
- var regexExact = new RegExp(`^${basePattern}$`, "u");
5325
- function identifierRegex({ exact = true } = {}) {
5326
- return exact ? regexExact : regex;
5327
- }
5328
-
5329
- // ../../node_modules/.pnpm/function-timeout@1.0.2/node_modules/function-timeout/index.js
5330
- var import_node_vm = __toESM(require("vm"), 1);
5331
- var script = new import_node_vm.default.Script("returnValue = functionToRun()");
5332
- function functionTimeout(function_, { timeout, context: context2 = import_node_vm.default.createContext() } = {}) {
5333
- const wrappedFunction = (...arguments_) => {
5334
- context2.functionToRun = () => function_(...arguments_);
5335
- script.runInNewContext(context2, { timeout });
5336
- return context2.returnValue;
5337
- };
5338
- Object.defineProperty(wrappedFunction, "name", {
5339
- value: `functionTimeout(${function_.name || "<anonymous>"})`,
5340
- configurable: true
5341
- });
5342
- return wrappedFunction;
5343
- }
5344
- function isTimeoutError(error) {
5345
- return error?.code === "ERR_SCRIPT_EXECUTION_TIMEOUT";
5346
- }
5347
-
5348
- // ../../node_modules/.pnpm/super-regex@1.0.0/node_modules/super-regex/index.js
5349
- var context = {};
5350
- function isMatch(regex3, string, { timeout } = {}) {
5351
- try {
5352
- return functionTimeout(() => structuredClone(regex3).test(string), { timeout, context })();
5353
- } catch (error) {
5354
- if (isTimeoutError(error)) {
5355
- return false;
5356
- }
5357
- throw error;
5358
- }
5359
- }
5360
-
5361
- // ../../node_modules/.pnpm/is-identifier@1.0.1/node_modules/is-identifier/index.js
5362
- var regex2 = identifierRegex();
5363
- function isIdentifier(value) {
5364
- if (typeof value !== "string") {
5365
- throw new TypeError(`Expected a string, got \`${typeof value}\`.`);
5366
- }
5367
- if (value.length > 1e5) {
5368
- return false;
5369
- }
5370
- return isMatch(regex2, value, { timeout: 1e3 });
5371
- }
5372
-
5373
5068
  // src/generation/ts-builders/Property.ts
5374
5069
  var Property = class {
5375
5070
  constructor(name, type) {
@@ -5397,11 +5092,7 @@ var Property = class {
5397
5092
  if (this.isReadonly) {
5398
5093
  writer.write("readonly ");
5399
5094
  }
5400
- if (isIdentifier(this.name)) {
5401
- writer.write(this.name);
5402
- } else {
5403
- writer.write("[").write(JSON.stringify(this.name)).write("]");
5404
- }
5095
+ writer.write(this.name);
5405
5096
  if (this.isOptional) {
5406
5097
  writer.write("?");
5407
5098
  }
@@ -5415,8 +5106,8 @@ function property(name, type) {
5415
5106
  // src/generation/ts-builders/Writer.ts
5416
5107
  var INDENT_SIZE = 2;
5417
5108
  var Writer = class {
5418
- constructor(startingIndent = 0, context2) {
5419
- this.context = context2;
5109
+ constructor(startingIndent = 0, context) {
5110
+ this.context = context;
5420
5111
  this.lines = [];
5421
5112
  this.currentLine = "";
5422
5113
  this.currentIndent = 0;
@@ -5590,46 +5281,6 @@ function stringLiteral(content) {
5590
5281
  return new StringLiteralType(content);
5591
5282
  }
5592
5283
 
5593
- // src/generation/ts-builders/TupleType.ts
5594
- init_TypeBuilder();
5595
- var TupleItem = class {
5596
- constructor(type) {
5597
- this.type = type;
5598
- }
5599
- setName(name) {
5600
- this.name = name;
5601
- return this;
5602
- }
5603
- write(writer) {
5604
- if (this.name) {
5605
- writer.write(this.name).write(": ");
5606
- }
5607
- writer.write(this.type);
5608
- }
5609
- };
5610
- var TupleType = class extends TypeBuilder {
5611
- constructor() {
5612
- super(...arguments);
5613
- this.items = [];
5614
- }
5615
- add(item) {
5616
- if (item instanceof TypeBuilder) {
5617
- item = new TupleItem(item);
5618
- }
5619
- this.items.push(item);
5620
- return this;
5621
- }
5622
- write(writer) {
5623
- writer.write("[").writeJoined(", ", this.items).write("]");
5624
- }
5625
- };
5626
- function tupleType() {
5627
- return new TupleType();
5628
- }
5629
- function tupleItem(type) {
5630
- return new TupleItem(type);
5631
- }
5632
-
5633
5284
  // src/generation/ts-builders/TypeDeclaration.ts
5634
5285
  var TypeDeclaration = class {
5635
5286
  constructor(name, type) {
@@ -6015,8 +5666,8 @@ function getModelArgName(modelName, action) {
6015
5666
  assertNever(action, `Unknown action: ${action}`);
6016
5667
  }
6017
5668
  }
6018
- function getPayloadName(modelName, namespace2 = true) {
6019
- if (namespace2) {
5669
+ function getPayloadName(modelName, namespace = true) {
5670
+ if (namespace) {
6020
5671
  return `Prisma.${getPayloadName(modelName, false)}`;
6021
5672
  }
6022
5673
  return `$${modelName}Payload`;
@@ -6459,9 +6110,9 @@ function escapeJson(str) {
6459
6110
 
6460
6111
  // src/generation/TSClient/Args.ts
6461
6112
  var ArgsTypeBuilder = class {
6462
- constructor(type, context2, action) {
6113
+ constructor(type, context, action) {
6463
6114
  this.type = type;
6464
- this.context = context2;
6115
+ this.context = context;
6465
6116
  this.action = action;
6466
6117
  this.hasDefaultName = true;
6467
6118
  this.moduleExport = moduleExport(
@@ -6625,25 +6276,25 @@ function buildOutputField(field) {
6625
6276
  }
6626
6277
  function enumTypeName(ref) {
6627
6278
  const name = ref.type;
6628
- const namespace2 = ref.namespace === "model" ? "$Enums" : "Prisma";
6629
- return `${namespace2}.${name}`;
6279
+ const namespace = ref.namespace === "model" ? "$Enums" : "Prisma";
6280
+ return `${namespace}.${name}`;
6630
6281
  }
6631
6282
 
6632
6283
  // src/generation/TSClient/Payload.ts
6633
- function buildModelPayload(model, context2) {
6634
- const isComposite = context2.dmmf.isComposite(model.name);
6284
+ function buildModelPayload(model, context) {
6285
+ const isComposite = context.dmmf.isComposite(model.name);
6635
6286
  const objects = objectType();
6636
6287
  const scalars = objectType();
6637
6288
  const composites = objectType();
6638
6289
  for (const field of model.fields) {
6639
6290
  if (field.kind === "object") {
6640
- if (context2.dmmf.isComposite(field.type)) {
6641
- composites.add(buildModelOutputProperty(field, context2.dmmf));
6291
+ if (context.dmmf.isComposite(field.type)) {
6292
+ composites.add(buildModelOutputProperty(field, context.dmmf));
6642
6293
  } else {
6643
- objects.add(buildModelOutputProperty(field, context2.dmmf));
6294
+ objects.add(buildModelOutputProperty(field, context.dmmf));
6644
6295
  }
6645
6296
  } else if (field.kind === "enum" || field.kind === "scalar") {
6646
- scalars.add(buildModelOutputProperty(field, context2.dmmf));
6297
+ scalars.add(buildModelOutputProperty(field, context.dmmf));
6647
6298
  }
6648
6299
  }
6649
6300
  const scalarsType = isComposite ? scalars : namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(namedType("ExtArgs").subKey("result").subKey(lowerCase(model.name)));
@@ -6731,11 +6382,11 @@ function getModelActions(dmmf, name) {
6731
6382
 
6732
6383
  // src/generation/TSClient/Model.ts
6733
6384
  var Model = class {
6734
- constructor(model, context2) {
6385
+ constructor(model, context) {
6735
6386
  this.model = model;
6736
- this.context = context2;
6737
- this.dmmf = context2.dmmf;
6738
- this.genericsInfo = context2.genericArgsInfo;
6387
+ this.context = context;
6388
+ this.dmmf = context.dmmf;
6389
+ this.genericsInfo = context.genericArgsInfo;
6739
6390
  this.type = this.context.dmmf.outputTypeMap.model[model.name];
6740
6391
  this.createManyAndReturnType = this.context.dmmf.outputTypeMap.model[getCreateManyAndReturnOutputType(model.name)];
6741
6392
  this.mapping = this.context.dmmf.mappings.modelOperations.find((m) => m.model === model.name);
@@ -7003,9 +6654,9 @@ ${this.argsTypes.map((type) => stringify(type)).join("\n\n")}
7003
6654
  }
7004
6655
  };
7005
6656
  var ModelDelegate = class {
7006
- constructor(outputType, context2) {
6657
+ constructor(outputType, context) {
7007
6658
  this.outputType = outputType;
7008
- this.context = context2;
6659
+ this.context = context;
7009
6660
  }
7010
6661
  /**
7011
6662
  * Returns all available non-aggregate or group actions
@@ -7139,10 +6790,10 @@ ${stringify(buildFluentWrapperDefinition(name, this.outputType, this.context))}
7139
6790
  `;
7140
6791
  }
7141
6792
  };
7142
- function buildModelDelegateMethod(modelName, actionName, context2) {
7143
- const mapping = context2.dmmf.mappingsMap[modelName] ?? { model: modelName, plural: `${modelName}s` };
7144
- const modelOrType = context2.dmmf.typeAndModelMap[modelName];
7145
- const method2 = method(actionName).setDocComment(docComment(getMethodJSDocBody(actionName, mapping, modelOrType))).addParameter(getNonAggregateMethodArgs(modelName, actionName)).setReturnType(getReturnType({ modelName, actionName, context: context2 }));
6793
+ function buildModelDelegateMethod(modelName, actionName, context) {
6794
+ const mapping = context.dmmf.mappingsMap[modelName] ?? { model: modelName, plural: `${modelName}s` };
6795
+ const modelOrType = context.dmmf.typeAndModelMap[modelName];
6796
+ const method2 = method(actionName).setDocComment(docComment(getMethodJSDocBody(actionName, mapping, modelOrType))).addParameter(getNonAggregateMethodArgs(modelName, actionName)).setReturnType(getReturnType({ modelName, actionName, context }));
7146
6797
  const generic = getNonAggregateMethodGenericParam(modelName, actionName);
7147
6798
  if (generic) {
7148
6799
  method2.addGenericParameter(generic);
@@ -7184,7 +6835,7 @@ function getNonAggregateMethodGenericParam(modelName, actionName) {
7184
6835
  function getReturnType({
7185
6836
  modelName,
7186
6837
  actionName,
7187
- context: context2,
6838
+ context,
7188
6839
  isChaining = false,
7189
6840
  isNullable = false
7190
6841
  }) {
@@ -7202,7 +6853,7 @@ function getReturnType({
7202
6853
  }
7203
6854
  const isList = actionName === DMMF.ModelAction.findMany || actionName === DMMF.ModelAction.createManyAndReturn;
7204
6855
  if (isList) {
7205
- let result = getResultType(modelName, actionName, context2);
6856
+ let result = getResultType(modelName, actionName, context);
7206
6857
  if (isChaining) {
7207
6858
  result = unionType(result).addVariant(namedType("Null"));
7208
6859
  }
@@ -7210,39 +6861,39 @@ function getReturnType({
7210
6861
  }
7211
6862
  if (isChaining && actionName === DMMF.ModelAction.findUniqueOrThrow) {
7212
6863
  const nullType2 = isNullable ? nullType : namedType("Null");
7213
- const result = unionType(getResultType(modelName, actionName, context2)).addVariant(nullType2);
7214
- return getFluentWrapper(modelName, context2, result, nullType2);
6864
+ const result = unionType(getResultType(modelName, actionName, context)).addVariant(nullType2);
6865
+ return getFluentWrapper(modelName, context, result, nullType2);
7215
6866
  }
7216
6867
  if (actionName === DMMF.ModelAction.findFirst || actionName === DMMF.ModelAction.findUnique) {
7217
- const result = unionType(getResultType(modelName, actionName, context2)).addVariant(nullType);
7218
- return getFluentWrapper(modelName, context2, result, nullType);
6868
+ const result = unionType(getResultType(modelName, actionName, context)).addVariant(nullType);
6869
+ return getFluentWrapper(modelName, context, result, nullType);
7219
6870
  }
7220
- return getFluentWrapper(modelName, context2, getResultType(modelName, actionName, context2));
6871
+ return getFluentWrapper(modelName, context, getResultType(modelName, actionName, context));
7221
6872
  }
7222
- function getFluentWrapper(modelName, context2, resultType, nullType2 = neverType) {
6873
+ function getFluentWrapper(modelName, context, resultType, nullType2 = neverType) {
7223
6874
  const result = namedType(fluentWrapperName(modelName)).addGenericArgument(resultType).addGenericArgument(nullType2).addGenericArgument(extArgsParam.toArgument());
7224
- if (context2.isPreviewFeatureOn("omitApi")) {
6875
+ if (context.isPreviewFeatureOn("omitApi")) {
7225
6876
  result.addGenericArgument(namedType("ClientOptions"));
7226
6877
  }
7227
6878
  return result;
7228
6879
  }
7229
- function getResultType(modelName, actionName, context2) {
6880
+ function getResultType(modelName, actionName, context) {
7230
6881
  const result = namedType("$Result.GetResult").addGenericArgument(namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument())).addGenericArgument(namedType("T")).addGenericArgument(stringLiteral(actionName));
7231
- if (context2.isPreviewFeatureOn("omitApi")) {
6882
+ if (context.isPreviewFeatureOn("omitApi")) {
7232
6883
  result.addGenericArgument(namedType("ClientOptions"));
7233
6884
  }
7234
6885
  return result;
7235
6886
  }
7236
- function buildFluentWrapperDefinition(modelName, outputType, context2) {
6887
+ function buildFluentWrapperDefinition(modelName, outputType, context) {
7237
6888
  const definition = interfaceDeclaration(fluentWrapperName(modelName));
7238
6889
  definition.addGenericParameter(genericParameter("T")).addGenericParameter(genericParameter("Null").default(neverType)).addGenericParameter(extArgsParam).extends(prismaPromise(namedType("T")));
7239
- if (context2.isPreviewFeatureOn("omitApi")) {
6890
+ if (context.isPreviewFeatureOn("omitApi")) {
7240
6891
  definition.addGenericParameter(genericParameter("ClientOptions").default(objectType()));
7241
6892
  }
7242
6893
  definition.add(property("[Symbol.toStringTag]", stringLiteral("PrismaPromise")).readonly());
7243
6894
  definition.addMultiple(
7244
6895
  outputType.fields.filter(
7245
- (field) => field.outputType.location === "outputObjectTypes" && !context2.dmmf.isComposite(field.outputType.type) && field.name !== "_count"
6896
+ (field) => field.outputType.location === "outputObjectTypes" && !context.dmmf.isComposite(field.outputType.type) && field.name !== "_count"
7246
6897
  ).map((field) => {
7247
6898
  const fieldArgType = namedType(getFieldArgName(field, modelName)).addGenericArgument(extArgsParam.toArgument());
7248
6899
  const argsParam = genericParameter("T").extends(fieldArgType).default(objectType());
@@ -7251,7 +6902,7 @@ function buildFluentWrapperDefinition(modelName, outputType, context2) {
7251
6902
  modelName: field.outputType.type,
7252
6903
  actionName: field.outputType.isList ? DMMF.ModelAction.findMany : DMMF.ModelAction.findUniqueOrThrow,
7253
6904
  isChaining: true,
7254
- context: context2,
6905
+ context,
7255
6906
  isNullable: field.isNullable
7256
6907
  })
7257
6908
  );
@@ -7368,8 +7019,8 @@ var DMMFHelper = class {
7368
7019
  Object.values(this.mappings.otherOperations.read)
7369
7020
  ].flat();
7370
7021
  }
7371
- hasEnumInNamespace(enumName, namespace2) {
7372
- return this.schema.enumTypes[namespace2]?.find((schemaEnum) => schemaEnum.name === enumName) !== void 0;
7022
+ hasEnumInNamespace(enumName, namespace) {
7023
+ return this.schema.enumTypes[namespace]?.find((schemaEnum) => schemaEnum.name === enumName) !== void 0;
7373
7024
  }
7374
7025
  resolveInputObjectType(ref) {
7375
7026
  return this.inputTypesByName.get(fullyQualifiedName(ref.type, ref.namespace));
@@ -7424,9 +7075,9 @@ var DMMFHelper = class {
7424
7075
  return result;
7425
7076
  }
7426
7077
  };
7427
- function fullyQualifiedName(typeName, namespace2) {
7428
- if (namespace2) {
7429
- return `${namespace2}.${typeName}`;
7078
+ function fullyQualifiedName(typeName, namespace) {
7079
+ if (namespace) {
7080
+ return `${namespace}.${typeName}`;
7430
7081
  }
7431
7082
  return typeName;
7432
7083
  }
@@ -7954,13 +7605,51 @@ export const prismaVersion: PrismaVersion
7954
7605
  * Utility Types
7955
7606
  */
7956
7607
 
7608
+ /**
7609
+ * From https://github.com/sindresorhus/type-fest/
7610
+ * Matches a JSON object.
7611
+ * This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from.
7612
+ */
7613
+ export type JsonObject = {[Key in string]?: JsonValue}
7614
+
7615
+ /**
7616
+ * From https://github.com/sindresorhus/type-fest/
7617
+ * Matches a JSON array.
7618
+ */
7619
+ export interface JsonArray extends Array<JsonValue> {}
7957
7620
 
7958
- export import JsonObject = runtime.JsonObject
7959
- export import JsonArray = runtime.JsonArray
7960
- export import JsonValue = runtime.JsonValue
7961
- export import InputJsonObject = runtime.InputJsonObject
7962
- export import InputJsonArray = runtime.InputJsonArray
7963
- export import InputJsonValue = runtime.InputJsonValue
7621
+ /**
7622
+ * From https://github.com/sindresorhus/type-fest/
7623
+ * Matches any valid JSON value.
7624
+ */
7625
+ export type JsonValue = string | number | boolean | JsonObject | JsonArray | null
7626
+
7627
+ /**
7628
+ * Matches a JSON object.
7629
+ * Unlike \`JsonObject\`, this type allows undefined and read-only properties.
7630
+ */
7631
+ export type InputJsonObject = {readonly [Key in string]?: InputJsonValue | null}
7632
+
7633
+ /**
7634
+ * Matches a JSON array.
7635
+ * Unlike \`JsonArray\`, readonly arrays are assignable to this type.
7636
+ */
7637
+ export interface InputJsonArray extends ReadonlyArray<InputJsonValue | null> {}
7638
+
7639
+ /**
7640
+ * Matches any valid value that can be used as an input for operations like
7641
+ * create and update as the value of a JSON field. Unlike \`JsonValue\`, this
7642
+ * type allows read-only arrays and read-only object properties and disallows
7643
+ * \`null\` at the top level.
7644
+ *
7645
+ * \`null\` cannot be used as the value of a JSON field because its meaning
7646
+ * would be ambiguous. Use \`Prisma.JsonNull\` to store the JSON null value or
7647
+ * \`Prisma.DbNull\` to clear the JSON value and set the field to the database
7648
+ * NULL value instead.
7649
+ *
7650
+ * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-by-null-values
7651
+ */
7652
+ export type InputJsonValue = string | number | boolean | InputJsonObject | InputJsonArray | { toJSON(): unknown }
7964
7653
 
7965
7654
  /**
7966
7655
  * Types of the values used to represent different kinds of \`null\` values when working with JSON fields.
@@ -8311,9 +8000,9 @@ class ${name} {
8311
8000
  // src/generation/TSClient/Count.ts
8312
8001
  var import_indent_string5 = __toESM(require_indent_string());
8313
8002
  var Count = class {
8314
- constructor(type, context2) {
8003
+ constructor(type, context) {
8315
8004
  this.type = type;
8316
- this.context = context2;
8005
+ this.context = context;
8317
8006
  }
8318
8007
  get argsTypes() {
8319
8008
  const argsTypes = [];
@@ -8435,9 +8124,6 @@ var import_indent_string7 = __toESM(require_indent_string());
8435
8124
  function runtimeImport(name) {
8436
8125
  return name;
8437
8126
  }
8438
- function runtimeImportedType(name) {
8439
- return namedType(`runtime.${name}`);
8440
- }
8441
8127
 
8442
8128
  // src/generation/TSClient/Datasources.ts
8443
8129
  var import_indent_string6 = __toESM(require_indent_string());
@@ -8465,15 +8151,15 @@ function globalOmitConfig(dmmf) {
8465
8151
  }
8466
8152
 
8467
8153
  // src/generation/TSClient/PrismaClient.ts
8468
- function clientTypeMapModelsDefinition(context2) {
8154
+ function clientTypeMapModelsDefinition(context) {
8469
8155
  const meta = objectType();
8470
- const modelNames = context2.dmmf.datamodel.models.map((m) => m.name);
8156
+ const modelNames = context.dmmf.datamodel.models.map((m) => m.name);
8471
8157
  if (modelNames.length === 0) {
8472
8158
  meta.add(property("modelProps", neverType));
8473
8159
  } else {
8474
8160
  meta.add(property("modelProps", unionType(modelNames.map((name) => stringLiteral(lowerCase(name))))));
8475
8161
  }
8476
- const isolationLevel = context2.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? namedType("Prisma.TransactionIsolationLevel") : neverType;
8162
+ const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? namedType("Prisma.TransactionIsolationLevel") : neverType;
8477
8163
  meta.add(property("txIsolationLevel", isolationLevel));
8478
8164
  const model = objectType();
8479
8165
  model.addMultiple(
@@ -8483,7 +8169,7 @@ function clientTypeMapModelsDefinition(context2) {
8483
8169
  property("payload", namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument()))
8484
8170
  );
8485
8171
  entry.add(property("fields", namedType(`Prisma.${getFieldRefsTypeName(modelName)}`)));
8486
- const actions = getModelActions(context2.dmmf, modelName);
8172
+ const actions = getModelActions(context.dmmf, modelName);
8487
8173
  const operations = objectType();
8488
8174
  operations.addMultiple(
8489
8175
  actions.map((action) => {
@@ -8525,12 +8211,12 @@ function clientTypeMapModelsResultDefinition(modelName, action) {
8525
8211
  function payloadToResult(modelName) {
8526
8212
  return namedType("$Utils.PayloadToResult").addGenericArgument(namedType(getPayloadName(modelName)));
8527
8213
  }
8528
- function clientTypeMapOthersDefinition(context2) {
8529
- const otherOperationsNames = context2.dmmf.getOtherOperationNames().flatMap((name) => {
8530
- if (name === "executeRaw" || name === "queryRaw") {
8531
- return [`$${name}Unsafe`, `$${name}`];
8214
+ function clientTypeMapOthersDefinition(context) {
8215
+ const otherOperationsNames = context.dmmf.getOtherOperationNames().flatMap((n) => {
8216
+ if (n === "executeRaw" || n === "queryRaw") {
8217
+ return [`$${n}Unsafe`, `$${n}`];
8532
8218
  }
8533
- return `$${name}`;
8219
+ return `$${n}`;
8534
8220
  });
8535
8221
  const argsResultMap = {
8536
8222
  $executeRaw: { args: "[query: TemplateStringsArray | Prisma.Sql, ...values: any[]]", result: "any" },
@@ -8553,8 +8239,8 @@ function clientTypeMapOthersDefinition(context2) {
8553
8239
  }
8554
8240
  }`;
8555
8241
  }
8556
- function clientTypeMapDefinition(context2) {
8557
- const typeMap = `${stringify(clientTypeMapModelsDefinition(context2))} & ${clientTypeMapOthersDefinition(context2)}`;
8242
+ function clientTypeMapDefinition(context) {
8243
+ const typeMap = `${stringify(clientTypeMapModelsDefinition(context))} & ${clientTypeMapOthersDefinition(context)}`;
8558
8244
  return `
8559
8245
  interface TypeMapCb extends $Utils.Fn<{extArgs: $Extensions.InternalArgs, clientOptions: PrismaClientOptions }, $Utils.Record<string, any>> {
8560
8246
  returns: Prisma.TypeMap<this['params']['extArgs'], this['params']['clientOptions']>
@@ -8562,8 +8248,8 @@ interface TypeMapCb extends $Utils.Fn<{extArgs: $Extensions.InternalArgs, client
8562
8248
 
8563
8249
  export type TypeMap<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs, ClientOptions = {}> = ${typeMap}`;
8564
8250
  }
8565
- function clientExtensionsDefinitions(context2) {
8566
- const typeMap = clientTypeMapDefinition(context2);
8251
+ function clientExtensionsDefinitions(context) {
8252
+ const typeMap = clientTypeMapDefinition(context);
8567
8253
  const define2 = moduleExport(
8568
8254
  constDeclaration(
8569
8255
  "defineExtension",
@@ -8572,16 +8258,16 @@ function clientExtensionsDefinitions(context2) {
8572
8258
  );
8573
8259
  return [typeMap, stringify(define2)].join("\n");
8574
8260
  }
8575
- function extendsPropertyDefinition(context2) {
8261
+ function extendsPropertyDefinition(context) {
8576
8262
  const extendsDefinition = namedType("$Extensions.ExtendsHook").addGenericArgument(stringLiteral("extends")).addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(namedType("ExtArgs"));
8577
- if (context2.isPreviewFeatureOn("omitApi")) {
8263
+ if (context.isPreviewFeatureOn("omitApi")) {
8578
8264
  extendsDefinition.addGenericArgument(
8579
8265
  namedType("$Utils.Call").addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(objectType().add(property("extArgs", namedType("ExtArgs"))))
8580
8266
  ).addGenericArgument(namedType("ClientOptions"));
8581
8267
  }
8582
8268
  return stringify(property("$extends", extendsDefinition), { indentLevel: 1 });
8583
8269
  }
8584
- function batchingTransactionDefinition(context2) {
8270
+ function batchingTransactionDefinition(context) {
8585
8271
  const method2 = method("$transaction").setDocComment(
8586
8272
  docComment`
8587
8273
  Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.
@@ -8597,15 +8283,15 @@ function batchingTransactionDefinition(context2) {
8597
8283
  Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).
8598
8284
  `
8599
8285
  ).addGenericParameter(genericParameter("P").extends(array(prismaPromise(anyType)))).addParameter(parameter("arg", arraySpread(namedType("P")))).setReturnType(promise(namedType("runtime.Types.Utils.UnwrapTuple").addGenericArgument(namedType("P"))));
8600
- if (context2.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
8286
+ if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
8601
8287
  const options = objectType().formatInline().add(property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional());
8602
8288
  method2.addParameter(parameter("options", options).optional());
8603
8289
  }
8604
8290
  return stringify(method2, { indentLevel: 1, newLine: "leading" });
8605
8291
  }
8606
- function interactiveTransactionDefinition(context2) {
8292
+ function interactiveTransactionDefinition(context) {
8607
8293
  const options = objectType().formatInline().add(property("maxWait", numberType).optional()).add(property("timeout", numberType).optional());
8608
- if (context2.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
8294
+ if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
8609
8295
  const isolationLevel = property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional();
8610
8296
  options.add(isolationLevel);
8611
8297
  }
@@ -8616,8 +8302,8 @@ function interactiveTransactionDefinition(context2) {
8616
8302
  const method2 = method("$transaction").addGenericParameter(genericParameter("R")).addParameter(parameter("fn", callbackType)).addParameter(parameter("options", options).optional()).setReturnType(returnType);
8617
8303
  return stringify(method2, { indentLevel: 1, newLine: "leading" });
8618
8304
  }
8619
- function queryRawDefinition(context2) {
8620
- if (!context2.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
8305
+ function queryRawDefinition(context) {
8306
+ if (!context.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
8621
8307
  return "";
8622
8308
  }
8623
8309
  return `
@@ -8644,8 +8330,8 @@ function queryRawDefinition(context2) {
8644
8330
  */
8645
8331
  $queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;`;
8646
8332
  }
8647
- function executeRawDefinition(context2) {
8648
- if (!context2.dmmf.mappings.otherOperations.write.includes("executeRaw")) {
8333
+ function executeRawDefinition(context) {
8334
+ if (!context.dmmf.mappings.otherOperations.write.includes("executeRaw")) {
8649
8335
  return "";
8650
8336
  }
8651
8337
  return `
@@ -8672,34 +8358,8 @@ function executeRawDefinition(context2) {
8672
8358
  */
8673
8359
  $executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;`;
8674
8360
  }
8675
- function queryRawTypedDefinition(context2) {
8676
- if (!context2.isPreviewFeatureOn("typedSql")) {
8677
- return "";
8678
- }
8679
- if (!context2.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
8680
- return "";
8681
- }
8682
- const param = genericParameter("T");
8683
- const method2 = method("$queryRawTyped").setDocComment(
8684
- docComment`
8685
- Executes a typed SQL query and returns a typed result
8686
- @example
8687
- \`\`\`
8688
- import { myQuery } from '@prisma/client/sql'
8689
-
8690
- const result = await prisma.$queryRawTyped(myQuery())
8691
- \`\`\`
8692
- `
8693
- ).addGenericParameter(param).addParameter(
8694
- parameter(
8695
- "typedSql",
8696
- runtimeImportedType("TypedSql").addGenericArgument(array(unknownType)).addGenericArgument(param.toArgument())
8697
- )
8698
- ).setReturnType(prismaPromise(array(param.toArgument())));
8699
- return stringify(method2, { indentLevel: 1, newLine: "leading" });
8700
- }
8701
- function metricDefinition(context2) {
8702
- if (!context2.isPreviewFeatureOn("metrics")) {
8361
+ function metricDefinition(context) {
8362
+ if (!context.isPreviewFeatureOn("metrics")) {
8703
8363
  return "";
8704
8364
  }
8705
8365
  const property2 = property("$metrics", namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
@@ -8716,8 +8376,8 @@ function metricDefinition(context2) {
8716
8376
  ).readonly();
8717
8377
  return stringify(property2, { indentLevel: 1, newLine: "leading" });
8718
8378
  }
8719
- function runCommandRawDefinition(context2) {
8720
- if (!context2.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
8379
+ function runCommandRawDefinition(context) {
8380
+ if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
8721
8381
  return "";
8722
8382
  }
8723
8383
  const method2 = method("$runCommandRaw").addParameter(parameter("command", namedType("Prisma.InputJsonObject"))).setReturnType(prismaPromise(namedType("Prisma.JsonObject"))).setDocComment(docComment`
@@ -8752,8 +8412,8 @@ function eventRegistrationMethodDeclaration(runtimeNameTs) {
8752
8412
  }
8753
8413
  }
8754
8414
  var PrismaClientClass = class {
8755
- constructor(context2, internalDatasources, outputDir, runtimeNameTs, browser) {
8756
- this.context = context2;
8415
+ constructor(context, internalDatasources, outputDir, runtimeNameTs, browser) {
8416
+ this.context = context;
8757
8417
  this.internalDatasources = internalDatasources;
8758
8418
  this.outputDir = outputDir;
8759
8419
  this.runtimeNameTs = runtimeNameTs;
@@ -8820,7 +8480,6 @@ export class PrismaClient<
8820
8480
  ${[
8821
8481
  executeRawDefinition(this.context),
8822
8482
  queryRawDefinition(this.context),
8823
- queryRawTypedDefinition(this.context),
8824
8483
  batchingTransactionDefinition(this.context),
8825
8484
  interactiveTransactionDefinition(this.context),
8826
8485
  runCommandRawDefinition(this.context),
@@ -9095,17 +8754,17 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
9095
8754
  toTS() {
9096
8755
  const { reusedTs } = this.options;
9097
8756
  if (reusedTs) {
9098
- const topExports = moduleExportFrom(`./${reusedTs}`);
8757
+ const topExports = moduleExportFrom("*", `./${reusedTs}`);
9099
8758
  return stringify(topExports);
9100
8759
  }
9101
- const context2 = new GenerateContext({
8760
+ const context = new GenerateContext({
9102
8761
  dmmf: this.dmmf,
9103
8762
  genericArgsInfo: this.genericsInfo,
9104
8763
  generator: this.options.generator,
9105
8764
  defaultArgsAliases: new DefaultArgsAliases()
9106
8765
  });
9107
8766
  const prismaClientClass = new PrismaClientClass(
9108
- context2,
8767
+ context,
9109
8768
  this.options.datasources,
9110
8769
  this.options.outputDir,
9111
8770
  this.options.runtimeNameTs,
@@ -9114,7 +8773,7 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
9114
8773
  const commonCode = commonCodeTS(this.options);
9115
8774
  const modelAndTypes = Object.values(this.dmmf.typeAndModelMap).reduce((acc, modelOrType) => {
9116
8775
  if (this.dmmf.outputTypeMap.model[modelOrType.name]) {
9117
- acc.push(new Model(modelOrType, context2));
8776
+ acc.push(new Model(modelOrType, context));
9118
8777
  }
9119
8778
  return acc;
9120
8779
  }, []);
@@ -9131,7 +8790,7 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
9131
8790
  );
9132
8791
  }
9133
8792
  const fieldRefs = this.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
9134
- const countTypes = this.dmmf.schema.outputObjectTypes.prisma?.filter((t) => t.name.endsWith("CountOutputType")).map((t) => new Count(t, context2));
8793
+ const countTypes = this.dmmf.schema.outputObjectTypes.prisma?.filter((t) => t.name.endsWith("CountOutputType")).map((t) => new Count(t, context));
9135
8794
  const code = `
9136
8795
  /**
9137
8796
  * Client
@@ -9218,7 +8877,7 @@ ${this.dmmf.inputObjectTypes.model?.map((inputType) => new InputType(inputType,
9218
8877
  /**
9219
8878
  * Aliases for legacy arg types
9220
8879
  */
9221
- ${context2.defaultArgsAliases.generateAliases()}
8880
+ ${context.defaultArgsAliases.generateAliases()}
9222
8881
 
9223
8882
  /**
9224
8883
  * Batch Payload for updateMany & deleteMany & createMany
@@ -9293,212 +8952,6 @@ Object.assign(exports, Prisma)
9293
8952
  }
9294
8953
  };
9295
8954
 
9296
- // src/generation/typedSql/buildDbEnums.ts
9297
- var DbEnumsList = class {
9298
- constructor(enums) {
9299
- this.enums = enums.map((dmmfEnum) => ({
9300
- name: dmmfEnum.dbName ?? dmmfEnum.name,
9301
- values: dmmfEnum.values.map((dmmfValue) => dmmfValue.dbName ?? dmmfValue.name)
9302
- }));
9303
- }
9304
- isEmpty() {
9305
- return this.enums.length === 0;
9306
- }
9307
- hasEnum(name) {
9308
- return Boolean(this.enums.find((dbEnum) => dbEnum.name === name));
9309
- }
9310
- *[Symbol.iterator]() {
9311
- for (const dbEnum of this.enums) {
9312
- yield dbEnum;
9313
- }
9314
- }
9315
- };
9316
- function buildDbEnums(list) {
9317
- const file2 = file();
9318
- for (const dbEntry of list) {
9319
- file2.add(buildDbEnum(dbEntry));
9320
- }
9321
- return stringify(file2);
9322
- }
9323
- function buildDbEnum(dbEnum) {
9324
- const type = unionType(dbEnum.values.map(stringLiteral));
9325
- return moduleExport(typeDeclaration(dbEnum.name, type));
9326
- }
9327
- function queryUsesEnums(query, enums) {
9328
- if (enums.isEmpty()) {
9329
- return false;
9330
- }
9331
- return query.parameters.some((param) => enums.hasEnum(param.typ)) || query.resultColumns.some((column) => enums.hasEnum(column.typ));
9332
- }
9333
-
9334
- // src/generation/typedSql/buildIndex.ts
9335
- function buildIndexTs(queries, enums) {
9336
- const file2 = file();
9337
- if (!enums.isEmpty()) {
9338
- file2.add(moduleExportFrom("./$DbEnums").asNamespace("$DbEnums"));
9339
- }
9340
- for (const query of queries) {
9341
- file2.add(moduleExportFrom(`./${query.name}`));
9342
- }
9343
- return stringify(file2);
9344
- }
9345
- function buildIndexCjs(queries) {
9346
- const writer = new Writer(0, void 0);
9347
- writer.writeLine('"use strict"');
9348
- for (const { name } of queries) {
9349
- writer.writeLine(`exports.${name} = require("./${name}.js").${name}`);
9350
- }
9351
- return writer.toString();
9352
- }
9353
-
9354
- // src/generation/typedSql/mapTypes.ts
9355
- var decimal = namedType("$runtime.Decimal");
9356
- var buffer = namedType("Buffer");
9357
- var date = namedType("Date");
9358
- var inputJsonValue = namedType("$runtime.InputJsonObject");
9359
- var jsonValue = namedType("$runtime.JsonValue");
9360
- var bigintIn = unionType([numberType, bigintType]);
9361
- var decimalIn = unionType([numberType, decimal]);
9362
- var typeMappings = {
9363
- unknown: unknownType,
9364
- string: stringType,
9365
- int: numberType,
9366
- bigint: {
9367
- in: bigintIn,
9368
- out: bigintType
9369
- },
9370
- decimal: {
9371
- in: decimalIn,
9372
- out: decimal
9373
- },
9374
- float: numberType,
9375
- double: numberType,
9376
- enum: stringType,
9377
- // TODO:
9378
- bytes: buffer,
9379
- bool: booleanType,
9380
- char: stringType,
9381
- json: {
9382
- in: inputJsonValue,
9383
- out: jsonValue
9384
- },
9385
- xml: stringType,
9386
- uuid: stringType,
9387
- date,
9388
- datetime: date,
9389
- time: date,
9390
- "int-array": array(numberType),
9391
- "string-array": array(stringType),
9392
- "json-array": {
9393
- in: array(inputJsonValue),
9394
- out: array(jsonValue)
9395
- },
9396
- "uuid-array": array(stringType),
9397
- "xml-array": array(stringType),
9398
- "bigint-array": {
9399
- in: array(bigintIn),
9400
- out: array(bigintType)
9401
- },
9402
- "float-array": array(numberType),
9403
- "double-array": array(numberType),
9404
- "char-array": array(stringType),
9405
- "bytes-array": array(buffer),
9406
- "bool-array": array(booleanType),
9407
- "date-array": array(date),
9408
- "time-array": array(date),
9409
- "datetime-array": array(date),
9410
- "decimal-array": {
9411
- in: array(decimalIn),
9412
- out: array(decimal)
9413
- }
9414
- };
9415
- function getInputType(introspectionType, enums) {
9416
- return getMappingConfig(introspectionType, enums).in;
9417
- }
9418
- function getOutputType(introspectionType, enums) {
9419
- return getMappingConfig(introspectionType, enums).out;
9420
- }
9421
- function getMappingConfig(introspectionType, enums) {
9422
- const config = typeMappings[introspectionType];
9423
- if (!config) {
9424
- if (enums.hasEnum(introspectionType)) {
9425
- const type = namedType(`$DbEnums.${introspectionType}`);
9426
- return { in: type, out: type };
9427
- }
9428
- throw new Error("Unknown type");
9429
- }
9430
- if (config instanceof TypeBuilder) {
9431
- return { in: config, out: config };
9432
- }
9433
- return config;
9434
- }
9435
-
9436
- // src/generation/typedSql/buildTypedQuery.ts
9437
- function buildTypedQueryTs({ query, runtimeBase, runtimeName, enums }) {
9438
- const file2 = file();
9439
- file2.addImport(moduleImport(`${runtimeBase}/${runtimeName}`).asNamespace("$runtime"));
9440
- if (queryUsesEnums(query, enums)) {
9441
- file2.addImport(moduleImport("./$DbEnums").asNamespace("$DbEnums"));
9442
- }
9443
- const doc = docComment(query.documentation ?? void 0);
9444
- const factoryType = functionType();
9445
- const parametersType = tupleType();
9446
- for (const param of query.parameters) {
9447
- const paramType = getInputType(param.typ, enums);
9448
- factoryType.addParameter(parameter(param.name, paramType));
9449
- parametersType.add(tupleItem(paramType).setName(param.name));
9450
- if (param.documentation) {
9451
- doc.addText(`@param ${param.name} ${param.documentation}`);
9452
- } else {
9453
- doc.addText(`@param ${param.name}`);
9454
- }
9455
- }
9456
- factoryType.setReturnType(
9457
- namedType("$runtime.TypedSql").addGenericArgument(namedType(`${query.name}.Parameters`)).addGenericArgument(namedType(`${query.name}.Result`))
9458
- );
9459
- file2.add(moduleExport(constDeclaration(query.name, factoryType)).setDocComment(doc));
9460
- const namespace2 = namespace(query.name);
9461
- namespace2.add(moduleExport(typeDeclaration("Parameters", parametersType)));
9462
- namespace2.add(buildResultType(query, enums));
9463
- file2.add(moduleExport(namespace2));
9464
- return stringify(file2);
9465
- }
9466
- function buildResultType(query, enums) {
9467
- const type = objectType().addMultiple(query.resultColumns.map((column) => property(column.name, getOutputType(column.typ, enums))));
9468
- return moduleExport(typeDeclaration("Result", type));
9469
- }
9470
- function buildTypedQueryCjs({ query, runtimeBase, runtimeName }) {
9471
- const writer = new Writer(0, void 0);
9472
- writer.writeLine('"use strict"');
9473
- writer.writeLine(`const { makeTypedQueryFactory: $mkFactory } = require("${runtimeBase}/${runtimeName}")`);
9474
- writer.writeLine(`exports.${query.name} = /*#__PURE__*/ $mkFactory(${JSON.stringify(query.source)})`);
9475
- return writer.toString();
9476
- }
9477
- function buildTypedQueryEsm({ query, runtimeBase, runtimeName }) {
9478
- const writer = new Writer(0, void 0);
9479
- writer.writeLine(`import { makeTypedQueryFactory as $mkFactory } from "${runtimeBase}/${runtimeName}"`);
9480
- writer.writeLine(`export const ${query.name} = /*#__PURE__*/ $mkFactory(${JSON.stringify(query.source)})`);
9481
- return writer.toString();
9482
- }
9483
-
9484
- // src/generation/typedSql/typedSql.ts
9485
- function buildTypedSql({ queries, runtimeBase, mainRuntimeName, dmmf }) {
9486
- const fileMap = {};
9487
- const enums = new DbEnumsList(dmmf.datamodel.enums);
9488
- if (!enums.isEmpty()) {
9489
- fileMap["$DbEnums.d.ts"] = buildDbEnums(enums);
9490
- }
9491
- for (const query of queries) {
9492
- const options = { query, runtimeBase, runtimeName: mainRuntimeName, enums };
9493
- fileMap[`${query.name}.d.ts`] = buildTypedQueryTs(options);
9494
- fileMap[`${query.name}.js`] = buildTypedQueryCjs(options);
9495
- fileMap[`${query.name}.mjs`] = buildTypedQueryEsm(options);
9496
- }
9497
- fileMap["index.d.ts"] = buildIndexTs(queries, enums);
9498
- fileMap["index.js"] = buildIndexCjs(queries);
9499
- return fileMap;
9500
- }
9501
-
9502
8955
  // src/generation/generateClient.ts
9503
8956
  var debug2 = src_default("prisma:client:generateClient");
9504
8957
  var DenylistError = class extends Error {
@@ -9522,8 +8975,7 @@ async function buildClient({
9522
8975
  activeProvider,
9523
8976
  postinstall,
9524
8977
  copyEngine,
9525
- envPaths,
9526
- typedSql
8978
+ envPaths
9527
8979
  }) {
9528
8980
  const clientEngineType = getClientEngineType(generator);
9529
8981
  const baseClientOptions = {
@@ -9675,27 +9127,6 @@ import './polyfill.js'
9675
9127
  export * from './edge.js'`;
9676
9128
  fileMap["deno/polyfill.js"] = "globalThis.process = { env: Deno.env.toObject() }; globalThis.global = globalThis";
9677
9129
  }
9678
- if (typedSql && typedSql.length > 0) {
9679
- pkgJson.exports["./sql"] = {
9680
- require: {
9681
- types: "./sql/index.d.ts",
9682
- node: "./sql/index.js",
9683
- default: "./sql/index.js"
9684
- },
9685
- import: {
9686
- types: "./sql/index.d.ts",
9687
- node: "./sql/index.mjs",
9688
- default: "./sql/index.mjs"
9689
- },
9690
- default: "./sql/index.js"
9691
- };
9692
- fileMap["sql"] = buildTypedSql({
9693
- dmmf,
9694
- runtimeBase: getTypedSqlRuntimeBase(runtimeBase),
9695
- mainRuntimeName: getNodeRuntimeName(clientEngineType),
9696
- queries: typedSql
9697
- });
9698
- }
9699
9130
  fileMap["package.json"] = JSON.stringify(pkgJson, null, 2);
9700
9131
  return {
9701
9132
  fileMap,
@@ -9704,15 +9135,6 @@ export * from './edge.js'`;
9704
9135
  // the DMMF document
9705
9136
  };
9706
9137
  }
9707
- function getTypedSqlRuntimeBase(runtimeBase) {
9708
- if (!runtimeBase.startsWith(".")) {
9709
- return runtimeBase;
9710
- }
9711
- if (runtimeBase.startsWith("./")) {
9712
- return `.${runtimeBase}`;
9713
- }
9714
- return `../${runtimeBase}`;
9715
- }
9716
9138
  async function getDefaultOutdir(outputDir) {
9717
9139
  if (outputDir.endsWith("node_modules/@prisma/client")) {
9718
9140
  return import_path5.default.join(outputDir, "../../.prisma/client");
@@ -9744,8 +9166,7 @@ async function generateClient(options) {
9744
9166
  activeProvider,
9745
9167
  postinstall,
9746
9168
  envPaths,
9747
- copyEngine = true,
9748
- typedSql
9169
+ copyEngine = true
9749
9170
  } = options;
9750
9171
  const clientEngineType = getClientEngineType(generator);
9751
9172
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
@@ -9764,8 +9185,7 @@ async function generateClient(options) {
9764
9185
  postinstall,
9765
9186
  copyEngine,
9766
9187
  testMode,
9767
- envPaths,
9768
- typedSql
9188
+ envPaths
9769
9189
  });
9770
9190
  const provider = datasources[0].provider;
9771
9191
  const denylistsErrors = validateDmmfAgainstDenylists(prismaClientDmmf);
@@ -9788,7 +9208,15 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
9788
9208
  if (generator.previewFeatures.includes("deno") && !!globalThis.Deno) {
9789
9209
  await (0, import_fs_extra.ensureDir)(import_path5.default.join(outputDir, "deno"));
9790
9210
  }
9791
- await writeFileMap(outputDir, fileMap);
9211
+ await Promise.all(
9212
+ Object.entries(fileMap).map(async ([fileName, file]) => {
9213
+ const filePath = import_path5.default.join(outputDir, fileName);
9214
+ if ((0, import_fs2.existsSync)(filePath)) {
9215
+ await import_promises.default.unlink(filePath);
9216
+ }
9217
+ await import_promises.default.writeFile(filePath, file);
9218
+ })
9219
+ );
9792
9220
  const runtimeDir = import_path5.default.join(__dirname, `${testMode ? "../" : ""}../runtime`);
9793
9221
  if (copyRuntime || generator.isCustomOutput === true) {
9794
9222
  const copiedRuntimeDir = import_path5.default.join(outputDir, "runtime");
@@ -9839,20 +9267,6 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
9839
9267
  } catch {
9840
9268
  }
9841
9269
  }
9842
- function writeFileMap(outputDir, fileMap) {
9843
- return Promise.all(
9844
- Object.entries(fileMap).map(async ([fileName, content]) => {
9845
- const absolutePath = import_path5.default.join(outputDir, fileName);
9846
- await import_promises.default.rm(absolutePath, { recursive: true, force: true });
9847
- if (typeof content === "string") {
9848
- await import_promises.default.writeFile(absolutePath, content);
9849
- } else {
9850
- await import_promises.default.mkdir(absolutePath);
9851
- await writeFileMap(absolutePath, content);
9852
- }
9853
- })
9854
- );
9855
- }
9856
9270
  function isWasmEngineSupported(provider) {
9857
9271
  return provider === "postgresql" || provider === "postgres" || provider === "mysql" || provider === "sqlite";
9858
9272
  }
@@ -10029,9 +9443,9 @@ async function copyRuntimeFiles({ from, to, runtimeName, sourceMaps }) {
10029
9443
  files.push(`${runtimeName}.d.ts`);
10030
9444
  }
10031
9445
  if (sourceMaps) {
10032
- files.push(...files.filter((file2) => file2.endsWith(".js")).map((file2) => `${file2}.map`));
9446
+ files.push(...files.filter((file) => file.endsWith(".js")).map((file) => `${file}.map`));
10033
9447
  }
10034
- await Promise.all(files.map((file2) => import_promises.default.copyFile(import_path5.default.join(from, file2), import_path5.default.join(to, file2))));
9448
+ await Promise.all(files.map((file) => import_promises.default.copyFile(import_path5.default.join(from, file), import_path5.default.join(to, file))));
10035
9449
  }
10036
9450
  async function deleteOutputDir(outputDir) {
10037
9451
  try {
@@ -10124,8 +9538,7 @@ if (process.argv[1] === __filename) {
10124
9538
  clientVersion,
10125
9539
  activeProvider: options.datasources[0]?.activeProvider,
10126
9540
  postinstall: options.postinstall,
10127
- copyEngine: !options.noEngine,
10128
- typedSql: options.typedSql
9541
+ copyEngine: !options.noEngine
10129
9542
  });
10130
9543
  }
10131
9544
  });