@prisma/client 5.18.0-integration-feat-typed-sql.8 → 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.8",
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
  };
@@ -4786,38 +4772,6 @@ function moduleExportFrom(modules, from) {
4786
4772
  return new ExportFrom(modules, from);
4787
4773
  }
4788
4774
 
4789
- // src/generation/ts-builders/File.ts
4790
- var File = class {
4791
- constructor() {
4792
- this.imports = [];
4793
- this.declarations = [];
4794
- }
4795
- addImport(moduleImport2) {
4796
- this.imports.push(moduleImport2);
4797
- return this;
4798
- }
4799
- add(declaration) {
4800
- this.declarations.push(declaration);
4801
- }
4802
- write(writer) {
4803
- for (const moduleImport2 of this.imports) {
4804
- writer.writeLine(moduleImport2);
4805
- }
4806
- if (this.imports.length > 0) {
4807
- writer.newLine();
4808
- }
4809
- for (const [i, declaration] of this.declarations.entries()) {
4810
- writer.writeLine(declaration);
4811
- if (i < this.declarations.length - 1) {
4812
- writer.newLine();
4813
- }
4814
- }
4815
- }
4816
- };
4817
- function file() {
4818
- return new File();
4819
- }
4820
-
4821
4775
  // src/generation/ts-builders/PrimitiveType.ts
4822
4776
  init_TypeBuilder();
4823
4777
  var PrimitiveType = class extends TypeBuilder {
@@ -4943,85 +4897,6 @@ function optional(innerType) {
4943
4897
  return new NamedType("$Utils.Optional").addGenericArgument(innerType);
4944
4898
  }
4945
4899
 
4946
- // src/generation/ts-builders/Import.ts
4947
- var NamespaceImport = class {
4948
- constructor(alias, from) {
4949
- this.alias = alias;
4950
- this.from = from;
4951
- }
4952
- write(writer) {
4953
- writer.write("import * as ").write(this.alias).write(` from "${this.from}"`);
4954
- }
4955
- };
4956
- var BindingsImport = class {
4957
- constructor(from) {
4958
- this.from = from;
4959
- this.namedImports = [];
4960
- }
4961
- default(name) {
4962
- this.defaultImport = name;
4963
- return this;
4964
- }
4965
- named(namedImport) {
4966
- if (typeof namedImport === "string") {
4967
- namedImport = new NamedImport(namedImport);
4968
- }
4969
- this.namedImports.push(namedImport);
4970
- return this;
4971
- }
4972
- write(writer) {
4973
- writer.write("import ");
4974
- if (this.defaultImport) {
4975
- writer.write(this.defaultImport);
4976
- if (this.hasNamedImports()) {
4977
- writer.write(", ");
4978
- }
4979
- }
4980
- if (this.hasNamedImports()) {
4981
- writer.write("{ ").writeJoined(", ", this.namedImports).write(" }");
4982
- }
4983
- writer.write(` from "${this.from}"`);
4984
- }
4985
- hasNamedImports() {
4986
- return this.namedImports.length > 0;
4987
- }
4988
- };
4989
- var NamedImport = class {
4990
- constructor(name) {
4991
- this.name = name;
4992
- }
4993
- as(alias) {
4994
- this.alias = alias;
4995
- return this;
4996
- }
4997
- write(writer) {
4998
- writer.write(this.name);
4999
- if (this.alias) {
5000
- writer.write(" as ").write(this.alias);
5001
- }
5002
- }
5003
- };
5004
- var ModuleImport = class {
5005
- constructor(from) {
5006
- this.from = from;
5007
- }
5008
- asNamespace(alias) {
5009
- return new NamespaceImport(alias, this.from);
5010
- }
5011
- default(alias) {
5012
- return new BindingsImport(this.from).default(alias);
5013
- }
5014
- named(namedImport) {
5015
- return new BindingsImport(this.from).named(namedImport);
5016
- }
5017
- write(writer) {
5018
- writer.write("import ").write(`"${this.from}"`);
5019
- }
5020
- };
5021
- function moduleImport(from) {
5022
- return new ModuleImport(from);
5023
- }
5024
-
5025
4900
  // src/generation/ts-builders/Interface.ts
5026
4901
  init_TypeBuilder();
5027
4902
  var InterfaceDeclaration = class extends TypeBuilder {
@@ -5120,27 +4995,6 @@ function method(name) {
5120
4995
  return new Method(name);
5121
4996
  }
5122
4997
 
5123
- // src/generation/ts-builders/NamespaceDeclaration.ts
5124
- var NamespaceDeclaration = class {
5125
- constructor(name) {
5126
- this.name = name;
5127
- this.items = [];
5128
- }
5129
- add(declaration) {
5130
- this.items.push(declaration);
5131
- }
5132
- write(writer) {
5133
- writer.writeLine(`namespace ${this.name} {`).withIndent(() => {
5134
- for (const item of this.items) {
5135
- writer.writeLine(item);
5136
- }
5137
- }).write("}");
5138
- }
5139
- };
5140
- function namespace(name) {
5141
- return new NamespaceDeclaration(name);
5142
- }
5143
-
5144
4998
  // src/generation/ts-builders/ObjectType.ts
5145
4999
  init_TypeBuilder();
5146
5000
  var ObjectType = class extends TypeBuilder {
@@ -5211,124 +5065,6 @@ function parameter(name, type) {
5211
5065
  return new Parameter(name, type);
5212
5066
  }
5213
5067
 
5214
- // ../../node_modules/.pnpm/reserved-identifiers@1.0.0/node_modules/reserved-identifiers/index.js
5215
- var identifiers = [
5216
- // Keywords
5217
- "await",
5218
- "break",
5219
- "case",
5220
- "catch",
5221
- "class",
5222
- "const",
5223
- "continue",
5224
- "debugger",
5225
- "default",
5226
- "delete",
5227
- "do",
5228
- "else",
5229
- "enum",
5230
- "export",
5231
- "extends",
5232
- "false",
5233
- "finally",
5234
- "for",
5235
- "function",
5236
- "if",
5237
- "import",
5238
- "in",
5239
- "instanceof",
5240
- "new",
5241
- "null",
5242
- "return",
5243
- "super",
5244
- "switch",
5245
- "this",
5246
- "throw",
5247
- "true",
5248
- "try",
5249
- "typeof",
5250
- "var",
5251
- "void",
5252
- "while",
5253
- "with",
5254
- "yield",
5255
- // Future reserved keywords
5256
- "implements",
5257
- "interface",
5258
- "package",
5259
- "private",
5260
- "protected",
5261
- "public",
5262
- // Not keywords, but still restricted
5263
- "arguments",
5264
- "eval"
5265
- ];
5266
- var globalProperties = [
5267
- "globalThis",
5268
- "Infinity",
5269
- "NaN",
5270
- "undefined"
5271
- ];
5272
- function reservedIdentifiers({ includeGlobalProperties = false } = {}) {
5273
- return /* @__PURE__ */ new Set([
5274
- ...identifiers,
5275
- ...includeGlobalProperties ? globalProperties : []
5276
- ]);
5277
- }
5278
-
5279
- // ../../node_modules/.pnpm/identifier-regex@1.0.0/node_modules/identifier-regex/index.js
5280
- var baseRegex = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*/u;
5281
- var basePattern = `(?!${[...reservedIdentifiers({ includeGlobalProperties: true })].join("|")})${baseRegex.source}`;
5282
- var regex = new RegExp(basePattern, "u");
5283
- var regexExact = new RegExp(`^${basePattern}$`, "u");
5284
- function identifierRegex({ exact = true } = {}) {
5285
- return exact ? regexExact : regex;
5286
- }
5287
-
5288
- // ../../node_modules/.pnpm/function-timeout@1.0.2/node_modules/function-timeout/index.js
5289
- var import_node_vm = __toESM(require("vm"), 1);
5290
- var script = new import_node_vm.default.Script("returnValue = functionToRun()");
5291
- function functionTimeout(function_, { timeout, context: context2 = import_node_vm.default.createContext() } = {}) {
5292
- const wrappedFunction = (...arguments_) => {
5293
- context2.functionToRun = () => function_(...arguments_);
5294
- script.runInNewContext(context2, { timeout });
5295
- return context2.returnValue;
5296
- };
5297
- Object.defineProperty(wrappedFunction, "name", {
5298
- value: `functionTimeout(${function_.name || "<anonymous>"})`,
5299
- configurable: true
5300
- });
5301
- return wrappedFunction;
5302
- }
5303
- function isTimeoutError(error) {
5304
- return error?.code === "ERR_SCRIPT_EXECUTION_TIMEOUT";
5305
- }
5306
-
5307
- // ../../node_modules/.pnpm/super-regex@1.0.0/node_modules/super-regex/index.js
5308
- var context = {};
5309
- function isMatch(regex3, string, { timeout } = {}) {
5310
- try {
5311
- return functionTimeout(() => structuredClone(regex3).test(string), { timeout, context })();
5312
- } catch (error) {
5313
- if (isTimeoutError(error)) {
5314
- return false;
5315
- }
5316
- throw error;
5317
- }
5318
- }
5319
-
5320
- // ../../node_modules/.pnpm/is-identifier@1.0.1/node_modules/is-identifier/index.js
5321
- var regex2 = identifierRegex();
5322
- function isIdentifier(value) {
5323
- if (typeof value !== "string") {
5324
- throw new TypeError(`Expected a string, got \`${typeof value}\`.`);
5325
- }
5326
- if (value.length > 1e5) {
5327
- return false;
5328
- }
5329
- return isMatch(regex2, value, { timeout: 1e3 });
5330
- }
5331
-
5332
5068
  // src/generation/ts-builders/Property.ts
5333
5069
  var Property = class {
5334
5070
  constructor(name, type) {
@@ -5356,11 +5092,7 @@ var Property = class {
5356
5092
  if (this.isReadonly) {
5357
5093
  writer.write("readonly ");
5358
5094
  }
5359
- if (isIdentifier(this.name)) {
5360
- writer.write(this.name);
5361
- } else {
5362
- writer.write("[").write(JSON.stringify(this.name)).write("]");
5363
- }
5095
+ writer.write(this.name);
5364
5096
  if (this.isOptional) {
5365
5097
  writer.write("?");
5366
5098
  }
@@ -5374,8 +5106,8 @@ function property(name, type) {
5374
5106
  // src/generation/ts-builders/Writer.ts
5375
5107
  var INDENT_SIZE = 2;
5376
5108
  var Writer = class {
5377
- constructor(startingIndent = 0, context2) {
5378
- this.context = context2;
5109
+ constructor(startingIndent = 0, context) {
5110
+ this.context = context;
5379
5111
  this.lines = [];
5380
5112
  this.currentLine = "";
5381
5113
  this.currentIndent = 0;
@@ -5549,46 +5281,6 @@ function stringLiteral(content) {
5549
5281
  return new StringLiteralType(content);
5550
5282
  }
5551
5283
 
5552
- // src/generation/ts-builders/TupleType.ts
5553
- init_TypeBuilder();
5554
- var TupleItem = class {
5555
- constructor(type) {
5556
- this.type = type;
5557
- }
5558
- setName(name) {
5559
- this.name = name;
5560
- return this;
5561
- }
5562
- write(writer) {
5563
- if (this.name) {
5564
- writer.write(this.name).write(": ");
5565
- }
5566
- writer.write(this.type);
5567
- }
5568
- };
5569
- var TupleType = class extends TypeBuilder {
5570
- constructor() {
5571
- super(...arguments);
5572
- this.items = [];
5573
- }
5574
- add(item) {
5575
- if (item instanceof TypeBuilder) {
5576
- item = new TupleItem(item);
5577
- }
5578
- this.items.push(item);
5579
- return this;
5580
- }
5581
- write(writer) {
5582
- writer.write("[").writeJoined(", ", this.items).write("]");
5583
- }
5584
- };
5585
- function tupleType() {
5586
- return new TupleType();
5587
- }
5588
- function tupleItem(type) {
5589
- return new TupleItem(type);
5590
- }
5591
-
5592
5284
  // src/generation/ts-builders/TypeDeclaration.ts
5593
5285
  var TypeDeclaration = class {
5594
5286
  constructor(name, type) {
@@ -5974,8 +5666,8 @@ function getModelArgName(modelName, action) {
5974
5666
  assertNever(action, `Unknown action: ${action}`);
5975
5667
  }
5976
5668
  }
5977
- function getPayloadName(modelName, namespace2 = true) {
5978
- if (namespace2) {
5669
+ function getPayloadName(modelName, namespace = true) {
5670
+ if (namespace) {
5979
5671
  return `Prisma.${getPayloadName(modelName, false)}`;
5980
5672
  }
5981
5673
  return `$${modelName}Payload`;
@@ -6418,9 +6110,9 @@ function escapeJson(str) {
6418
6110
 
6419
6111
  // src/generation/TSClient/Args.ts
6420
6112
  var ArgsTypeBuilder = class {
6421
- constructor(type, context2, action) {
6113
+ constructor(type, context, action) {
6422
6114
  this.type = type;
6423
- this.context = context2;
6115
+ this.context = context;
6424
6116
  this.action = action;
6425
6117
  this.hasDefaultName = true;
6426
6118
  this.moduleExport = moduleExport(
@@ -6584,25 +6276,25 @@ function buildOutputField(field) {
6584
6276
  }
6585
6277
  function enumTypeName(ref) {
6586
6278
  const name = ref.type;
6587
- const namespace2 = ref.namespace === "model" ? "$Enums" : "Prisma";
6588
- return `${namespace2}.${name}`;
6279
+ const namespace = ref.namespace === "model" ? "$Enums" : "Prisma";
6280
+ return `${namespace}.${name}`;
6589
6281
  }
6590
6282
 
6591
6283
  // src/generation/TSClient/Payload.ts
6592
- function buildModelPayload(model, context2) {
6593
- const isComposite = context2.dmmf.isComposite(model.name);
6284
+ function buildModelPayload(model, context) {
6285
+ const isComposite = context.dmmf.isComposite(model.name);
6594
6286
  const objects = objectType();
6595
6287
  const scalars = objectType();
6596
6288
  const composites = objectType();
6597
6289
  for (const field of model.fields) {
6598
6290
  if (field.kind === "object") {
6599
- if (context2.dmmf.isComposite(field.type)) {
6600
- composites.add(buildModelOutputProperty(field, context2.dmmf));
6291
+ if (context.dmmf.isComposite(field.type)) {
6292
+ composites.add(buildModelOutputProperty(field, context.dmmf));
6601
6293
  } else {
6602
- objects.add(buildModelOutputProperty(field, context2.dmmf));
6294
+ objects.add(buildModelOutputProperty(field, context.dmmf));
6603
6295
  }
6604
6296
  } else if (field.kind === "enum" || field.kind === "scalar") {
6605
- scalars.add(buildModelOutputProperty(field, context2.dmmf));
6297
+ scalars.add(buildModelOutputProperty(field, context.dmmf));
6606
6298
  }
6607
6299
  }
6608
6300
  const scalarsType = isComposite ? scalars : namedType("$Extensions.GetPayloadResult").addGenericArgument(scalars).addGenericArgument(namedType("ExtArgs").subKey("result").subKey(lowerCase(model.name)));
@@ -6690,11 +6382,11 @@ function getModelActions(dmmf, name) {
6690
6382
 
6691
6383
  // src/generation/TSClient/Model.ts
6692
6384
  var Model = class {
6693
- constructor(model, context2) {
6385
+ constructor(model, context) {
6694
6386
  this.model = model;
6695
- this.context = context2;
6696
- this.dmmf = context2.dmmf;
6697
- this.genericsInfo = context2.genericArgsInfo;
6387
+ this.context = context;
6388
+ this.dmmf = context.dmmf;
6389
+ this.genericsInfo = context.genericArgsInfo;
6698
6390
  this.type = this.context.dmmf.outputTypeMap.model[model.name];
6699
6391
  this.createManyAndReturnType = this.context.dmmf.outputTypeMap.model[getCreateManyAndReturnOutputType(model.name)];
6700
6392
  this.mapping = this.context.dmmf.mappings.modelOperations.find((m) => m.model === model.name);
@@ -6962,9 +6654,9 @@ ${this.argsTypes.map((type) => stringify(type)).join("\n\n")}
6962
6654
  }
6963
6655
  };
6964
6656
  var ModelDelegate = class {
6965
- constructor(outputType, context2) {
6657
+ constructor(outputType, context) {
6966
6658
  this.outputType = outputType;
6967
- this.context = context2;
6659
+ this.context = context;
6968
6660
  }
6969
6661
  /**
6970
6662
  * Returns all available non-aggregate or group actions
@@ -7098,10 +6790,10 @@ ${stringify(buildFluentWrapperDefinition(name, this.outputType, this.context))}
7098
6790
  `;
7099
6791
  }
7100
6792
  };
7101
- function buildModelDelegateMethod(modelName, actionName, context2) {
7102
- const mapping = context2.dmmf.mappingsMap[modelName] ?? { model: modelName, plural: `${modelName}s` };
7103
- const modelOrType = context2.dmmf.typeAndModelMap[modelName];
7104
- 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 }));
7105
6797
  const generic = getNonAggregateMethodGenericParam(modelName, actionName);
7106
6798
  if (generic) {
7107
6799
  method2.addGenericParameter(generic);
@@ -7143,7 +6835,7 @@ function getNonAggregateMethodGenericParam(modelName, actionName) {
7143
6835
  function getReturnType({
7144
6836
  modelName,
7145
6837
  actionName,
7146
- context: context2,
6838
+ context,
7147
6839
  isChaining = false,
7148
6840
  isNullable = false
7149
6841
  }) {
@@ -7161,7 +6853,7 @@ function getReturnType({
7161
6853
  }
7162
6854
  const isList = actionName === DMMF.ModelAction.findMany || actionName === DMMF.ModelAction.createManyAndReturn;
7163
6855
  if (isList) {
7164
- let result = getResultType(modelName, actionName, context2);
6856
+ let result = getResultType(modelName, actionName, context);
7165
6857
  if (isChaining) {
7166
6858
  result = unionType(result).addVariant(namedType("Null"));
7167
6859
  }
@@ -7169,39 +6861,39 @@ function getReturnType({
7169
6861
  }
7170
6862
  if (isChaining && actionName === DMMF.ModelAction.findUniqueOrThrow) {
7171
6863
  const nullType2 = isNullable ? nullType : namedType("Null");
7172
- const result = unionType(getResultType(modelName, actionName, context2)).addVariant(nullType2);
7173
- return getFluentWrapper(modelName, context2, result, nullType2);
6864
+ const result = unionType(getResultType(modelName, actionName, context)).addVariant(nullType2);
6865
+ return getFluentWrapper(modelName, context, result, nullType2);
7174
6866
  }
7175
6867
  if (actionName === DMMF.ModelAction.findFirst || actionName === DMMF.ModelAction.findUnique) {
7176
- const result = unionType(getResultType(modelName, actionName, context2)).addVariant(nullType);
7177
- return getFluentWrapper(modelName, context2, result, nullType);
6868
+ const result = unionType(getResultType(modelName, actionName, context)).addVariant(nullType);
6869
+ return getFluentWrapper(modelName, context, result, nullType);
7178
6870
  }
7179
- return getFluentWrapper(modelName, context2, getResultType(modelName, actionName, context2));
6871
+ return getFluentWrapper(modelName, context, getResultType(modelName, actionName, context));
7180
6872
  }
7181
- function getFluentWrapper(modelName, context2, resultType, nullType2 = neverType) {
6873
+ function getFluentWrapper(modelName, context, resultType, nullType2 = neverType) {
7182
6874
  const result = namedType(fluentWrapperName(modelName)).addGenericArgument(resultType).addGenericArgument(nullType2).addGenericArgument(extArgsParam.toArgument());
7183
- if (context2.isPreviewFeatureOn("omitApi")) {
6875
+ if (context.isPreviewFeatureOn("omitApi")) {
7184
6876
  result.addGenericArgument(namedType("ClientOptions"));
7185
6877
  }
7186
6878
  return result;
7187
6879
  }
7188
- function getResultType(modelName, actionName, context2) {
6880
+ function getResultType(modelName, actionName, context) {
7189
6881
  const result = namedType("$Result.GetResult").addGenericArgument(namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument())).addGenericArgument(namedType("T")).addGenericArgument(stringLiteral(actionName));
7190
- if (context2.isPreviewFeatureOn("omitApi")) {
6882
+ if (context.isPreviewFeatureOn("omitApi")) {
7191
6883
  result.addGenericArgument(namedType("ClientOptions"));
7192
6884
  }
7193
6885
  return result;
7194
6886
  }
7195
- function buildFluentWrapperDefinition(modelName, outputType, context2) {
6887
+ function buildFluentWrapperDefinition(modelName, outputType, context) {
7196
6888
  const definition = interfaceDeclaration(fluentWrapperName(modelName));
7197
6889
  definition.addGenericParameter(genericParameter("T")).addGenericParameter(genericParameter("Null").default(neverType)).addGenericParameter(extArgsParam).extends(prismaPromise(namedType("T")));
7198
- if (context2.isPreviewFeatureOn("omitApi")) {
6890
+ if (context.isPreviewFeatureOn("omitApi")) {
7199
6891
  definition.addGenericParameter(genericParameter("ClientOptions").default(objectType()));
7200
6892
  }
7201
6893
  definition.add(property("[Symbol.toStringTag]", stringLiteral("PrismaPromise")).readonly());
7202
6894
  definition.addMultiple(
7203
6895
  outputType.fields.filter(
7204
- (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"
7205
6897
  ).map((field) => {
7206
6898
  const fieldArgType = namedType(getFieldArgName(field, modelName)).addGenericArgument(extArgsParam.toArgument());
7207
6899
  const argsParam = genericParameter("T").extends(fieldArgType).default(objectType());
@@ -7210,7 +6902,7 @@ function buildFluentWrapperDefinition(modelName, outputType, context2) {
7210
6902
  modelName: field.outputType.type,
7211
6903
  actionName: field.outputType.isList ? DMMF.ModelAction.findMany : DMMF.ModelAction.findUniqueOrThrow,
7212
6904
  isChaining: true,
7213
- context: context2,
6905
+ context,
7214
6906
  isNullable: field.isNullable
7215
6907
  })
7216
6908
  );
@@ -7327,8 +7019,8 @@ var DMMFHelper = class {
7327
7019
  Object.values(this.mappings.otherOperations.read)
7328
7020
  ].flat();
7329
7021
  }
7330
- hasEnumInNamespace(enumName, namespace2) {
7331
- 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;
7332
7024
  }
7333
7025
  resolveInputObjectType(ref) {
7334
7026
  return this.inputTypesByName.get(fullyQualifiedName(ref.type, ref.namespace));
@@ -7383,9 +7075,9 @@ var DMMFHelper = class {
7383
7075
  return result;
7384
7076
  }
7385
7077
  };
7386
- function fullyQualifiedName(typeName, namespace2) {
7387
- if (namespace2) {
7388
- return `${namespace2}.${typeName}`;
7078
+ function fullyQualifiedName(typeName, namespace) {
7079
+ if (namespace) {
7080
+ return `${namespace}.${typeName}`;
7389
7081
  }
7390
7082
  return typeName;
7391
7083
  }
@@ -7913,13 +7605,51 @@ export const prismaVersion: PrismaVersion
7913
7605
  * Utility Types
7914
7606
  */
7915
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> {}
7916
7620
 
7917
- export import JsonObject = runtime.JsonObject
7918
- export import JsonArray = runtime.JsonArray
7919
- export import JsonValue = runtime.JsonValue
7920
- export import InputJsonObject = runtime.InputJsonObject
7921
- export import InputJsonArray = runtime.InputJsonArray
7922
- 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 }
7923
7653
 
7924
7654
  /**
7925
7655
  * Types of the values used to represent different kinds of \`null\` values when working with JSON fields.
@@ -8270,9 +8000,9 @@ class ${name} {
8270
8000
  // src/generation/TSClient/Count.ts
8271
8001
  var import_indent_string5 = __toESM(require_indent_string());
8272
8002
  var Count = class {
8273
- constructor(type, context2) {
8003
+ constructor(type, context) {
8274
8004
  this.type = type;
8275
- this.context = context2;
8005
+ this.context = context;
8276
8006
  }
8277
8007
  get argsTypes() {
8278
8008
  const argsTypes = [];
@@ -8394,9 +8124,6 @@ var import_indent_string7 = __toESM(require_indent_string());
8394
8124
  function runtimeImport(name) {
8395
8125
  return name;
8396
8126
  }
8397
- function runtimeImportedType(name) {
8398
- return namedType(`runtime.${name}`);
8399
- }
8400
8127
 
8401
8128
  // src/generation/TSClient/Datasources.ts
8402
8129
  var import_indent_string6 = __toESM(require_indent_string());
@@ -8424,15 +8151,15 @@ function globalOmitConfig(dmmf) {
8424
8151
  }
8425
8152
 
8426
8153
  // src/generation/TSClient/PrismaClient.ts
8427
- function clientTypeMapModelsDefinition(context2) {
8154
+ function clientTypeMapModelsDefinition(context) {
8428
8155
  const meta = objectType();
8429
- const modelNames = context2.dmmf.datamodel.models.map((m) => m.name);
8156
+ const modelNames = context.dmmf.datamodel.models.map((m) => m.name);
8430
8157
  if (modelNames.length === 0) {
8431
8158
  meta.add(property("modelProps", neverType));
8432
8159
  } else {
8433
8160
  meta.add(property("modelProps", unionType(modelNames.map((name) => stringLiteral(lowerCase(name))))));
8434
8161
  }
8435
- const isolationLevel = context2.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? namedType("Prisma.TransactionIsolationLevel") : neverType;
8162
+ const isolationLevel = context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma") ? namedType("Prisma.TransactionIsolationLevel") : neverType;
8436
8163
  meta.add(property("txIsolationLevel", isolationLevel));
8437
8164
  const model = objectType();
8438
8165
  model.addMultiple(
@@ -8442,7 +8169,7 @@ function clientTypeMapModelsDefinition(context2) {
8442
8169
  property("payload", namedType(getPayloadName(modelName)).addGenericArgument(extArgsParam.toArgument()))
8443
8170
  );
8444
8171
  entry.add(property("fields", namedType(`Prisma.${getFieldRefsTypeName(modelName)}`)));
8445
- const actions = getModelActions(context2.dmmf, modelName);
8172
+ const actions = getModelActions(context.dmmf, modelName);
8446
8173
  const operations = objectType();
8447
8174
  operations.addMultiple(
8448
8175
  actions.map((action) => {
@@ -8484,12 +8211,12 @@ function clientTypeMapModelsResultDefinition(modelName, action) {
8484
8211
  function payloadToResult(modelName) {
8485
8212
  return namedType("$Utils.PayloadToResult").addGenericArgument(namedType(getPayloadName(modelName)));
8486
8213
  }
8487
- function clientTypeMapOthersDefinition(context2) {
8488
- const otherOperationsNames = context2.dmmf.getOtherOperationNames().flatMap((name) => {
8489
- if (name === "executeRaw" || name === "queryRaw") {
8490
- 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}`];
8491
8218
  }
8492
- return `$${name}`;
8219
+ return `$${n}`;
8493
8220
  });
8494
8221
  const argsResultMap = {
8495
8222
  $executeRaw: { args: "[query: TemplateStringsArray | Prisma.Sql, ...values: any[]]", result: "any" },
@@ -8512,8 +8239,8 @@ function clientTypeMapOthersDefinition(context2) {
8512
8239
  }
8513
8240
  }`;
8514
8241
  }
8515
- function clientTypeMapDefinition(context2) {
8516
- const typeMap = `${stringify(clientTypeMapModelsDefinition(context2))} & ${clientTypeMapOthersDefinition(context2)}`;
8242
+ function clientTypeMapDefinition(context) {
8243
+ const typeMap = `${stringify(clientTypeMapModelsDefinition(context))} & ${clientTypeMapOthersDefinition(context)}`;
8517
8244
  return `
8518
8245
  interface TypeMapCb extends $Utils.Fn<{extArgs: $Extensions.InternalArgs, clientOptions: PrismaClientOptions }, $Utils.Record<string, any>> {
8519
8246
  returns: Prisma.TypeMap<this['params']['extArgs'], this['params']['clientOptions']>
@@ -8521,8 +8248,8 @@ interface TypeMapCb extends $Utils.Fn<{extArgs: $Extensions.InternalArgs, client
8521
8248
 
8522
8249
  export type TypeMap<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs, ClientOptions = {}> = ${typeMap}`;
8523
8250
  }
8524
- function clientExtensionsDefinitions(context2) {
8525
- const typeMap = clientTypeMapDefinition(context2);
8251
+ function clientExtensionsDefinitions(context) {
8252
+ const typeMap = clientTypeMapDefinition(context);
8526
8253
  const define2 = moduleExport(
8527
8254
  constDeclaration(
8528
8255
  "defineExtension",
@@ -8531,16 +8258,16 @@ function clientExtensionsDefinitions(context2) {
8531
8258
  );
8532
8259
  return [typeMap, stringify(define2)].join("\n");
8533
8260
  }
8534
- function extendsPropertyDefinition(context2) {
8261
+ function extendsPropertyDefinition(context) {
8535
8262
  const extendsDefinition = namedType("$Extensions.ExtendsHook").addGenericArgument(stringLiteral("extends")).addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(namedType("ExtArgs"));
8536
- if (context2.isPreviewFeatureOn("omitApi")) {
8263
+ if (context.isPreviewFeatureOn("omitApi")) {
8537
8264
  extendsDefinition.addGenericArgument(
8538
8265
  namedType("$Utils.Call").addGenericArgument(namedType("Prisma.TypeMapCb")).addGenericArgument(objectType().add(property("extArgs", namedType("ExtArgs"))))
8539
8266
  ).addGenericArgument(namedType("ClientOptions"));
8540
8267
  }
8541
8268
  return stringify(property("$extends", extendsDefinition), { indentLevel: 1 });
8542
8269
  }
8543
- function batchingTransactionDefinition(context2) {
8270
+ function batchingTransactionDefinition(context) {
8544
8271
  const method2 = method("$transaction").setDocComment(
8545
8272
  docComment`
8546
8273
  Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.
@@ -8556,15 +8283,15 @@ function batchingTransactionDefinition(context2) {
8556
8283
  Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).
8557
8284
  `
8558
8285
  ).addGenericParameter(genericParameter("P").extends(array(prismaPromise(anyType)))).addParameter(parameter("arg", arraySpread(namedType("P")))).setReturnType(promise(namedType("runtime.Types.Utils.UnwrapTuple").addGenericArgument(namedType("P"))));
8559
- if (context2.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
8286
+ if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
8560
8287
  const options = objectType().formatInline().add(property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional());
8561
8288
  method2.addParameter(parameter("options", options).optional());
8562
8289
  }
8563
8290
  return stringify(method2, { indentLevel: 1, newLine: "leading" });
8564
8291
  }
8565
- function interactiveTransactionDefinition(context2) {
8292
+ function interactiveTransactionDefinition(context) {
8566
8293
  const options = objectType().formatInline().add(property("maxWait", numberType).optional()).add(property("timeout", numberType).optional());
8567
- if (context2.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
8294
+ if (context.dmmf.hasEnumInNamespace("TransactionIsolationLevel", "prisma")) {
8568
8295
  const isolationLevel = property("isolationLevel", namedType("Prisma.TransactionIsolationLevel")).optional();
8569
8296
  options.add(isolationLevel);
8570
8297
  }
@@ -8575,8 +8302,8 @@ function interactiveTransactionDefinition(context2) {
8575
8302
  const method2 = method("$transaction").addGenericParameter(genericParameter("R")).addParameter(parameter("fn", callbackType)).addParameter(parameter("options", options).optional()).setReturnType(returnType);
8576
8303
  return stringify(method2, { indentLevel: 1, newLine: "leading" });
8577
8304
  }
8578
- function queryRawDefinition(context2) {
8579
- if (!context2.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
8305
+ function queryRawDefinition(context) {
8306
+ if (!context.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
8580
8307
  return "";
8581
8308
  }
8582
8309
  return `
@@ -8603,8 +8330,8 @@ function queryRawDefinition(context2) {
8603
8330
  */
8604
8331
  $queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;`;
8605
8332
  }
8606
- function executeRawDefinition(context2) {
8607
- if (!context2.dmmf.mappings.otherOperations.write.includes("executeRaw")) {
8333
+ function executeRawDefinition(context) {
8334
+ if (!context.dmmf.mappings.otherOperations.write.includes("executeRaw")) {
8608
8335
  return "";
8609
8336
  }
8610
8337
  return `
@@ -8631,34 +8358,8 @@ function executeRawDefinition(context2) {
8631
8358
  */
8632
8359
  $executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;`;
8633
8360
  }
8634
- function queryRawTypedDefinition(context2) {
8635
- if (!context2.isPreviewFeatureOn("typedSql")) {
8636
- return "";
8637
- }
8638
- if (!context2.dmmf.mappings.otherOperations.write.includes("queryRaw")) {
8639
- return "";
8640
- }
8641
- const param = genericParameter("T");
8642
- const method2 = method("$queryRawTyped").setDocComment(
8643
- docComment`
8644
- Executes a typed SQL query and returns a typed result
8645
- @example
8646
- \`\`\`
8647
- import { myQuery } from '@prisma/client/sql'
8648
-
8649
- const result = await prisma.$queryRawTyped(myQuery())
8650
- \`\`\`
8651
- `
8652
- ).addGenericParameter(param).addParameter(
8653
- parameter(
8654
- "typedSql",
8655
- runtimeImportedType("TypedSql").addGenericArgument(array(unknownType)).addGenericArgument(param.toArgument())
8656
- )
8657
- ).setReturnType(prismaPromise(array(param.toArgument())));
8658
- return stringify(method2, { indentLevel: 1, newLine: "leading" });
8659
- }
8660
- function metricDefinition(context2) {
8661
- if (!context2.isPreviewFeatureOn("metrics")) {
8361
+ function metricDefinition(context) {
8362
+ if (!context.isPreviewFeatureOn("metrics")) {
8662
8363
  return "";
8663
8364
  }
8664
8365
  const property2 = property("$metrics", namedType(`runtime.${runtimeImport("MetricsClient")}`)).setDocComment(
@@ -8675,8 +8376,8 @@ function metricDefinition(context2) {
8675
8376
  ).readonly();
8676
8377
  return stringify(property2, { indentLevel: 1, newLine: "leading" });
8677
8378
  }
8678
- function runCommandRawDefinition(context2) {
8679
- if (!context2.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
8379
+ function runCommandRawDefinition(context) {
8380
+ if (!context.dmmf.mappings.otherOperations.write.includes("runCommandRaw")) {
8680
8381
  return "";
8681
8382
  }
8682
8383
  const method2 = method("$runCommandRaw").addParameter(parameter("command", namedType("Prisma.InputJsonObject"))).setReturnType(prismaPromise(namedType("Prisma.JsonObject"))).setDocComment(docComment`
@@ -8711,8 +8412,8 @@ function eventRegistrationMethodDeclaration(runtimeNameTs) {
8711
8412
  }
8712
8413
  }
8713
8414
  var PrismaClientClass = class {
8714
- constructor(context2, internalDatasources, outputDir, runtimeNameTs, browser) {
8715
- this.context = context2;
8415
+ constructor(context, internalDatasources, outputDir, runtimeNameTs, browser) {
8416
+ this.context = context;
8716
8417
  this.internalDatasources = internalDatasources;
8717
8418
  this.outputDir = outputDir;
8718
8419
  this.runtimeNameTs = runtimeNameTs;
@@ -8779,7 +8480,6 @@ export class PrismaClient<
8779
8480
  ${[
8780
8481
  executeRawDefinition(this.context),
8781
8482
  queryRawDefinition(this.context),
8782
- queryRawTypedDefinition(this.context),
8783
8483
  batchingTransactionDefinition(this.context),
8784
8484
  interactiveTransactionDefinition(this.context),
8785
8485
  runCommandRawDefinition(this.context),
@@ -9057,14 +8757,14 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
9057
8757
  const topExports = moduleExportFrom("*", `./${reusedTs}`);
9058
8758
  return stringify(topExports);
9059
8759
  }
9060
- const context2 = new GenerateContext({
8760
+ const context = new GenerateContext({
9061
8761
  dmmf: this.dmmf,
9062
8762
  genericArgsInfo: this.genericsInfo,
9063
8763
  generator: this.options.generator,
9064
8764
  defaultArgsAliases: new DefaultArgsAliases()
9065
8765
  });
9066
8766
  const prismaClientClass = new PrismaClientClass(
9067
- context2,
8767
+ context,
9068
8768
  this.options.datasources,
9069
8769
  this.options.outputDir,
9070
8770
  this.options.runtimeNameTs,
@@ -9073,7 +8773,7 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
9073
8773
  const commonCode = commonCodeTS(this.options);
9074
8774
  const modelAndTypes = Object.values(this.dmmf.typeAndModelMap).reduce((acc, modelOrType) => {
9075
8775
  if (this.dmmf.outputTypeMap.model[modelOrType.name]) {
9076
- acc.push(new Model(modelOrType, context2));
8776
+ acc.push(new Model(modelOrType, context));
9077
8777
  }
9078
8778
  return acc;
9079
8779
  }, []);
@@ -9090,7 +8790,7 @@ ${buildNFTAnnotations(edge || !copyEngine, clientEngineType, binaryTargets, rela
9090
8790
  );
9091
8791
  }
9092
8792
  const fieldRefs = this.dmmf.schema.fieldRefTypes.prisma?.map((type) => new FieldRefInput(type).toTS()) ?? [];
9093
- 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));
9094
8794
  const code = `
9095
8795
  /**
9096
8796
  * Client
@@ -9177,7 +8877,7 @@ ${this.dmmf.inputObjectTypes.model?.map((inputType) => new InputType(inputType,
9177
8877
  /**
9178
8878
  * Aliases for legacy arg types
9179
8879
  */
9180
- ${context2.defaultArgsAliases.generateAliases()}
8880
+ ${context.defaultArgsAliases.generateAliases()}
9181
8881
 
9182
8882
  /**
9183
8883
  * Batch Payload for updateMany & deleteMany & createMany
@@ -9252,157 +8952,6 @@ Object.assign(exports, Prisma)
9252
8952
  }
9253
8953
  };
9254
8954
 
9255
- // src/generation/typedSql/buildIndex.ts
9256
- function buildIndexTs(queries) {
9257
- const file2 = file();
9258
- for (const query of queries) {
9259
- file2.add(moduleExportFrom("*", `./${query.name}`));
9260
- }
9261
- return stringify(file2);
9262
- }
9263
- function buildIndexCjs(queries) {
9264
- const writer = new Writer(0, void 0);
9265
- writer.writeLine('"use strict"');
9266
- for (const { name } of queries) {
9267
- writer.writeLine(`exports.${name} = require("./${name}.js").${name}`);
9268
- }
9269
- return writer.toString();
9270
- }
9271
-
9272
- // src/generation/typedSql/mapTypes.ts
9273
- var decimal = namedType("$runtime.Decimal");
9274
- var buffer = namedType("Buffer");
9275
- var date = namedType("Date");
9276
- var inputJsonValue = namedType("$runtime.InputJsonObject");
9277
- var jsonValue = namedType("$runtime.JsonValue");
9278
- var bigintIn = unionType([numberType, bigintType]);
9279
- var decimalIn = unionType([numberType, decimal]);
9280
- var typeMappings = {
9281
- unknown: unknownType,
9282
- string: stringType,
9283
- int: numberType,
9284
- bigint: {
9285
- in: bigintIn,
9286
- out: bigintType
9287
- },
9288
- decimal: {
9289
- in: decimalIn,
9290
- out: decimal
9291
- },
9292
- float: numberType,
9293
- double: numberType,
9294
- enum: stringType,
9295
- // TODO:
9296
- bytes: buffer,
9297
- bool: booleanType,
9298
- char: stringType,
9299
- json: {
9300
- in: inputJsonValue,
9301
- out: jsonValue
9302
- },
9303
- xml: stringType,
9304
- uuid: stringType,
9305
- date,
9306
- datetime: date,
9307
- time: date,
9308
- "int-array": array(numberType),
9309
- "string-array": array(stringType),
9310
- "json-array": {
9311
- in: array(inputJsonValue),
9312
- out: array(jsonValue)
9313
- },
9314
- "uuid-array": array(stringType),
9315
- "xml-array": array(stringType),
9316
- "bigint-array": {
9317
- in: array(bigintIn),
9318
- out: array(bigintType)
9319
- },
9320
- "float-array": array(numberType),
9321
- "double-array": array(numberType),
9322
- "char-array": array(stringType),
9323
- "bytes-array": array(buffer),
9324
- "bool-array": array(booleanType),
9325
- "date-array": array(date),
9326
- "time-array": array(date),
9327
- "datetime-array": array(date),
9328
- "decimal-array": {
9329
- in: array(decimalIn),
9330
- out: array(decimal)
9331
- }
9332
- };
9333
- function getInputType(introspectionType) {
9334
- return getMappingConfig(introspectionType).in;
9335
- }
9336
- function getOutputType(introspectionType) {
9337
- return getMappingConfig(introspectionType).out;
9338
- }
9339
- function getMappingConfig(introspectionType) {
9340
- const config = typeMappings[introspectionType];
9341
- if (config instanceof TypeBuilder) {
9342
- return { in: config, out: config };
9343
- }
9344
- return config;
9345
- }
9346
-
9347
- // src/generation/typedSql/buildTypedQuery.ts
9348
- function buildTypedQueryTs({ query, runtimeBase, runtimeName }) {
9349
- const file2 = file();
9350
- file2.addImport(moduleImport(`${runtimeBase}/${runtimeName}`).asNamespace("$runtime"));
9351
- const doc = docComment(query.documentation ?? void 0);
9352
- const factoryType = functionType();
9353
- const parametersType = tupleType();
9354
- for (const param of query.parameters) {
9355
- const paramType = getInputType(param.typ);
9356
- factoryType.addParameter(parameter(param.name, paramType));
9357
- parametersType.add(tupleItem(paramType).setName(param.name));
9358
- if (param.documentation) {
9359
- doc.addText(`@param ${param.name} ${param.documentation}`);
9360
- } else {
9361
- doc.addText(`@param ${param.name}`);
9362
- }
9363
- }
9364
- factoryType.setReturnType(
9365
- namedType("$runtime.TypedSql").addGenericArgument(namedType(`${query.name}.Parameters`)).addGenericArgument(namedType(`${query.name}.Result`))
9366
- );
9367
- file2.add(moduleExport(constDeclaration(query.name, factoryType)).setDocComment(doc));
9368
- const namespace2 = namespace(query.name);
9369
- namespace2.add(moduleExport(typeDeclaration("Parameters", parametersType)));
9370
- namespace2.add(buildResultType(query));
9371
- file2.add(moduleExport(namespace2));
9372
- return stringify(file2);
9373
- }
9374
- function buildResultType(query) {
9375
- const type = objectType().addMultiple(query.resultColumns.map((column) => property(column.name, getOutputType(column.typ))));
9376
- return moduleExport(typeDeclaration("Result", type));
9377
- }
9378
- function buildTypedQueryCjs({ query, runtimeBase, runtimeName }) {
9379
- const writer = new Writer(0, void 0);
9380
- writer.writeLine('"use strict"');
9381
- writer.writeLine(`const { makeTypedQueryFactory: $mkFactory } = require("${runtimeBase}/${runtimeName}")`);
9382
- writer.writeLine(`exports.${query.name} = /*#__PURE__*/ $mkFactory(${JSON.stringify(query.source)})`);
9383
- return writer.toString();
9384
- }
9385
- function buildTypedQueryEsm({ query, runtimeBase, runtimeName }) {
9386
- const writer = new Writer(0, void 0);
9387
- writer.writeLine(`import { makeTypedQueryFactory as $mkFactory } from "${runtimeBase}/${runtimeName}"`);
9388
- writer.writeLine(`export const ${query.name} = /*#__PURE__*/ $mkFactory(${JSON.stringify(query.source)})`);
9389
- return writer.toString();
9390
- }
9391
-
9392
- // src/generation/typedSql/typedSql.ts
9393
- function buildTypedSql({ queries, runtimeBase, mainRuntimeName }) {
9394
- const fileMap = {};
9395
- for (const query of queries) {
9396
- const options = { query, runtimeBase, runtimeName: mainRuntimeName };
9397
- fileMap[`${query.name}.d.ts`] = buildTypedQueryTs(options);
9398
- fileMap[`${query.name}.js`] = buildTypedQueryCjs(options);
9399
- fileMap[`${query.name}.mjs`] = buildTypedQueryEsm(options);
9400
- }
9401
- fileMap["index.d.ts"] = buildIndexTs(queries);
9402
- fileMap["index.js"] = buildIndexCjs(queries);
9403
- return fileMap;
9404
- }
9405
-
9406
8955
  // src/generation/generateClient.ts
9407
8956
  var debug2 = src_default("prisma:client:generateClient");
9408
8957
  var DenylistError = class extends Error {
@@ -9426,8 +8975,7 @@ async function buildClient({
9426
8975
  activeProvider,
9427
8976
  postinstall,
9428
8977
  copyEngine,
9429
- envPaths,
9430
- typedSql
8978
+ envPaths
9431
8979
  }) {
9432
8980
  const clientEngineType = getClientEngineType(generator);
9433
8981
  const baseClientOptions = {
@@ -9579,27 +9127,6 @@ import './polyfill.js'
9579
9127
  export * from './edge.js'`;
9580
9128
  fileMap["deno/polyfill.js"] = "globalThis.process = { env: Deno.env.toObject() }; globalThis.global = globalThis";
9581
9129
  }
9582
- if (typedSql && typedSql.length > 0) {
9583
- pkgJson.exports["./sql"] = {
9584
- require: {
9585
- types: "./sql/index.d.ts",
9586
- node: "./sql/index.js",
9587
- default: "./sql/index.js"
9588
- },
9589
- import: {
9590
- types: "./sql/index.d.ts",
9591
- node: "./sql/index.mjs",
9592
- default: "./sql/index.mjs"
9593
- },
9594
- default: "./sql/index.js"
9595
- };
9596
- fileMap["sql"] = buildTypedSql({
9597
- dmmf,
9598
- runtimeBase: getTypedSqlRuntimeBase(runtimeBase),
9599
- mainRuntimeName: getNodeRuntimeName(clientEngineType),
9600
- queries: typedSql
9601
- });
9602
- }
9603
9130
  fileMap["package.json"] = JSON.stringify(pkgJson, null, 2);
9604
9131
  return {
9605
9132
  fileMap,
@@ -9608,15 +9135,6 @@ export * from './edge.js'`;
9608
9135
  // the DMMF document
9609
9136
  };
9610
9137
  }
9611
- function getTypedSqlRuntimeBase(runtimeBase) {
9612
- if (!runtimeBase.startsWith(".")) {
9613
- return runtimeBase;
9614
- }
9615
- if (runtimeBase.startsWith("./")) {
9616
- return `.${runtimeBase}`;
9617
- }
9618
- return `../${runtimeBase}`;
9619
- }
9620
9138
  async function getDefaultOutdir(outputDir) {
9621
9139
  if (outputDir.endsWith("node_modules/@prisma/client")) {
9622
9140
  return import_path5.default.join(outputDir, "../../.prisma/client");
@@ -9648,8 +9166,7 @@ async function generateClient(options) {
9648
9166
  activeProvider,
9649
9167
  postinstall,
9650
9168
  envPaths,
9651
- copyEngine = true,
9652
- typedSql
9169
+ copyEngine = true
9653
9170
  } = options;
9654
9171
  const clientEngineType = getClientEngineType(generator);
9655
9172
  const { runtimeBase, outputDir } = await getGenerationDirs(options);
@@ -9668,8 +9185,7 @@ async function generateClient(options) {
9668
9185
  postinstall,
9669
9186
  copyEngine,
9670
9187
  testMode,
9671
- envPaths,
9672
- typedSql
9188
+ envPaths
9673
9189
  });
9674
9190
  const provider = datasources[0].provider;
9675
9191
  const denylistsErrors = validateDmmfAgainstDenylists(prismaClientDmmf);
@@ -9692,7 +9208,15 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
9692
9208
  if (generator.previewFeatures.includes("deno") && !!globalThis.Deno) {
9693
9209
  await (0, import_fs_extra.ensureDir)(import_path5.default.join(outputDir, "deno"));
9694
9210
  }
9695
- 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
+ );
9696
9220
  const runtimeDir = import_path5.default.join(__dirname, `${testMode ? "../" : ""}../runtime`);
9697
9221
  if (copyRuntime || generator.isCustomOutput === true) {
9698
9222
  const copiedRuntimeDir = import_path5.default.join(outputDir, "runtime");
@@ -9743,20 +9267,6 @@ To learn more about how to rename models, check out https://pris.ly/d/naming-mod
9743
9267
  } catch {
9744
9268
  }
9745
9269
  }
9746
- function writeFileMap(outputDir, fileMap) {
9747
- return Promise.all(
9748
- Object.entries(fileMap).map(async ([fileName, content]) => {
9749
- const absolutePath = import_path5.default.join(outputDir, fileName);
9750
- await import_promises.default.rm(absolutePath, { recursive: true, force: true });
9751
- if (typeof content === "string") {
9752
- await import_promises.default.writeFile(absolutePath, content);
9753
- } else {
9754
- await import_promises.default.mkdir(absolutePath);
9755
- await writeFileMap(absolutePath, content);
9756
- }
9757
- })
9758
- );
9759
- }
9760
9270
  function isWasmEngineSupported(provider) {
9761
9271
  return provider === "postgresql" || provider === "postgres" || provider === "mysql" || provider === "sqlite";
9762
9272
  }
@@ -9933,9 +9443,9 @@ async function copyRuntimeFiles({ from, to, runtimeName, sourceMaps }) {
9933
9443
  files.push(`${runtimeName}.d.ts`);
9934
9444
  }
9935
9445
  if (sourceMaps) {
9936
- 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`));
9937
9447
  }
9938
- 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))));
9939
9449
  }
9940
9450
  async function deleteOutputDir(outputDir) {
9941
9451
  try {
@@ -10028,8 +9538,7 @@ if (process.argv[1] === __filename) {
10028
9538
  clientVersion,
10029
9539
  activeProvider: options.datasources[0]?.activeProvider,
10030
9540
  postinstall: options.postinstall,
10031
- copyEngine: !options.noEngine,
10032
- typedSql: options.typedSql
9541
+ copyEngine: !options.noEngine
10033
9542
  });
10034
9543
  }
10035
9544
  });