@stryke/prisma-trpc-generator 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2480,15 +2480,24 @@ var exists = /* @__PURE__ */ __name(async (filePath) => {
2480
2480
 
2481
2481
  // ../fs/src/helpers.ts
2482
2482
  var import_promises2 = require("node:fs/promises");
2483
- async function createDirectory(path7) {
2484
- if (await exists(path7)) {
2483
+ async function createDirectory(path6) {
2484
+ if (await exists(path6)) {
2485
2485
  return;
2486
2486
  }
2487
- return (0, import_promises2.mkdir)(path7, {
2487
+ return (0, import_promises2.mkdir)(path6, {
2488
2488
  recursive: true
2489
2489
  });
2490
2490
  }
2491
2491
  __name(createDirectory, "createDirectory");
2492
+ async function removeDirectory(path6) {
2493
+ if (!existsSync(path6)) {
2494
+ return;
2495
+ }
2496
+ return (0, import_promises2.rm)(path6, {
2497
+ recursive: true
2498
+ });
2499
+ }
2500
+ __name(removeDirectory, "removeDirectory");
2492
2501
 
2493
2502
  // ../path/src/join-paths.ts
2494
2503
  init_cjs_shims();
@@ -2506,65 +2515,65 @@ var _DRIVE_LETTER_RE = /^[A-Z]:$/i;
2506
2515
  var isAbsolute = /* @__PURE__ */ __name(function(p) {
2507
2516
  return _IS_ABSOLUTE_RE.test(p);
2508
2517
  }, "isAbsolute");
2509
- var correctPaths = /* @__PURE__ */ __name(function(path7) {
2510
- if (!path7 || path7.length === 0) {
2518
+ var correctPaths = /* @__PURE__ */ __name(function(path6) {
2519
+ if (!path6 || path6.length === 0) {
2511
2520
  return ".";
2512
2521
  }
2513
- path7 = normalizeWindowsPath(path7);
2514
- const isUNCPath = path7.match(_UNC_REGEX);
2515
- const isPathAbsolute = isAbsolute(path7);
2516
- const trailingSeparator = path7[path7.length - 1] === "/";
2517
- path7 = normalizeString(path7, !isPathAbsolute);
2518
- if (path7.length === 0) {
2522
+ path6 = normalizeWindowsPath(path6);
2523
+ const isUNCPath = path6.match(_UNC_REGEX);
2524
+ const isPathAbsolute = isAbsolute(path6);
2525
+ const trailingSeparator = path6[path6.length - 1] === "/";
2526
+ path6 = normalizeString(path6, !isPathAbsolute);
2527
+ if (path6.length === 0) {
2519
2528
  if (isPathAbsolute) {
2520
2529
  return "/";
2521
2530
  }
2522
2531
  return trailingSeparator ? "./" : ".";
2523
2532
  }
2524
2533
  if (trailingSeparator) {
2525
- path7 += "/";
2534
+ path6 += "/";
2526
2535
  }
2527
- if (_DRIVE_LETTER_RE.test(path7)) {
2528
- path7 += "/";
2536
+ if (_DRIVE_LETTER_RE.test(path6)) {
2537
+ path6 += "/";
2529
2538
  }
2530
2539
  if (isUNCPath) {
2531
2540
  if (!isPathAbsolute) {
2532
- return `//./${path7}`;
2541
+ return `//./${path6}`;
2533
2542
  }
2534
- return `//${path7}`;
2543
+ return `//${path6}`;
2535
2544
  }
2536
- return isPathAbsolute && !isAbsolute(path7) ? `/${path7}` : path7;
2545
+ return isPathAbsolute && !isAbsolute(path6) ? `/${path6}` : path6;
2537
2546
  }, "correctPaths");
2538
2547
  var joinPaths = /* @__PURE__ */ __name(function(...segments) {
2539
- let path7 = "";
2548
+ let path6 = "";
2540
2549
  for (const seg of segments) {
2541
2550
  if (!seg) {
2542
2551
  continue;
2543
2552
  }
2544
- if (path7.length > 0) {
2545
- const pathTrailing = path7[path7.length - 1] === "/";
2553
+ if (path6.length > 0) {
2554
+ const pathTrailing = path6[path6.length - 1] === "/";
2546
2555
  const segLeading = seg[0] === "/";
2547
2556
  const both = pathTrailing && segLeading;
2548
2557
  if (both) {
2549
- path7 += seg.slice(1);
2558
+ path6 += seg.slice(1);
2550
2559
  } else {
2551
- path7 += pathTrailing || segLeading ? seg : `/${seg}`;
2560
+ path6 += pathTrailing || segLeading ? seg : `/${seg}`;
2552
2561
  }
2553
2562
  } else {
2554
- path7 += seg;
2563
+ path6 += seg;
2555
2564
  }
2556
2565
  }
2557
- return correctPaths(path7);
2566
+ return correctPaths(path6);
2558
2567
  }, "joinPaths");
2559
- function normalizeString(path7, allowAboveRoot) {
2568
+ function normalizeString(path6, allowAboveRoot) {
2560
2569
  let res = "";
2561
2570
  let lastSegmentLength = 0;
2562
2571
  let lastSlash = -1;
2563
2572
  let dots = 0;
2564
2573
  let char = null;
2565
- for (let index = 0; index <= path7.length; ++index) {
2566
- if (index < path7.length) {
2567
- char = path7[index];
2574
+ for (let index = 0; index <= path6.length; ++index) {
2575
+ if (index < path6.length) {
2576
+ char = path6[index];
2568
2577
  } else if (char === "/") {
2569
2578
  break;
2570
2579
  } else {
@@ -2600,9 +2609,9 @@ function normalizeString(path7, allowAboveRoot) {
2600
2609
  }
2601
2610
  } else {
2602
2611
  if (res.length > 0) {
2603
- res += `/${path7.slice(lastSlash + 1, index)}`;
2612
+ res += `/${path6.slice(lastSlash + 1, index)}`;
2604
2613
  } else {
2605
- res = path7.slice(lastSlash + 1, index);
2614
+ res = path6.slice(lastSlash + 1, index);
2606
2615
  }
2607
2616
  lastSegmentLength = index - lastSlash - 1;
2608
2617
  }
@@ -2619,7 +2628,7 @@ function normalizeString(path7, allowAboveRoot) {
2619
2628
  __name(normalizeString, "normalizeString");
2620
2629
 
2621
2630
  // src/prisma-generator.ts
2622
- var import_node_path7 = __toESM(require("node:path"), 1);
2631
+ var import_node_path6 = __toESM(require("node:path"), 1);
2623
2632
  var import_pluralize = __toESM(require_pluralize(), 1);
2624
2633
 
2625
2634
  // src/config.ts
@@ -2987,8 +2996,8 @@ function getErrorMap() {
2987
2996
  }
2988
2997
  __name(getErrorMap, "getErrorMap");
2989
2998
  var makeIssue = /* @__PURE__ */ __name((params) => {
2990
- const { data, path: path7, errorMaps, issueData } = params;
2991
- const fullPath = [...path7, ...issueData.path || []];
2999
+ const { data, path: path6, errorMaps, issueData } = params;
3000
+ const fullPath = [...path6, ...issueData.path || []];
2992
3001
  const fullIssue = {
2993
3002
  ...issueData,
2994
3003
  path: fullPath
@@ -3122,11 +3131,11 @@ var ParseInputLazyPath = class {
3122
3131
  static {
3123
3132
  __name(this, "ParseInputLazyPath");
3124
3133
  }
3125
- constructor(parent, value, path7, key) {
3134
+ constructor(parent, value, path6, key) {
3126
3135
  this._cachedPath = [];
3127
3136
  this.parent = parent;
3128
3137
  this.data = value;
3129
- this._path = path7;
3138
+ this._path = path6;
3130
3139
  this._key = key;
3131
3140
  }
3132
3141
  get path() {
@@ -7111,34 +7120,34 @@ __name2(normalizeWindowsPath2, "normalizeWindowsPath");
7111
7120
  var _UNC_REGEX2 = /^[/\\]{2}/;
7112
7121
  var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
7113
7122
  var _DRIVE_LETTER_RE2 = /^[A-Za-z]:$/;
7114
- var correctPaths2 = /* @__PURE__ */ __name2(function(path7) {
7115
- if (!path7 || path7.length === 0) {
7123
+ var correctPaths2 = /* @__PURE__ */ __name2(function(path6) {
7124
+ if (!path6 || path6.length === 0) {
7116
7125
  return ".";
7117
7126
  }
7118
- path7 = normalizeWindowsPath2(path7);
7119
- const isUNCPath = path7.match(_UNC_REGEX2);
7120
- const isPathAbsolute = isAbsolute2(path7);
7121
- const trailingSeparator = path7[path7.length - 1] === "/";
7122
- path7 = normalizeString2(path7, !isPathAbsolute);
7123
- if (path7.length === 0) {
7127
+ path6 = normalizeWindowsPath2(path6);
7128
+ const isUNCPath = path6.match(_UNC_REGEX2);
7129
+ const isPathAbsolute = isAbsolute2(path6);
7130
+ const trailingSeparator = path6[path6.length - 1] === "/";
7131
+ path6 = normalizeString2(path6, !isPathAbsolute);
7132
+ if (path6.length === 0) {
7124
7133
  if (isPathAbsolute) {
7125
7134
  return "/";
7126
7135
  }
7127
7136
  return trailingSeparator ? "./" : ".";
7128
7137
  }
7129
7138
  if (trailingSeparator) {
7130
- path7 += "/";
7139
+ path6 += "/";
7131
7140
  }
7132
- if (_DRIVE_LETTER_RE2.test(path7)) {
7133
- path7 += "/";
7141
+ if (_DRIVE_LETTER_RE2.test(path6)) {
7142
+ path6 += "/";
7134
7143
  }
7135
7144
  if (isUNCPath) {
7136
7145
  if (!isPathAbsolute) {
7137
- return `//./${path7}`;
7146
+ return `//./${path6}`;
7138
7147
  }
7139
- return `//${path7}`;
7148
+ return `//${path6}`;
7140
7149
  }
7141
- return isPathAbsolute && !isAbsolute2(path7) ? `/${path7}` : path7;
7150
+ return isPathAbsolute && !isAbsolute2(path6) ? `/${path6}` : path6;
7142
7151
  }, "correctPaths");
7143
7152
  function cwd() {
7144
7153
  if (typeof process !== "undefined" && typeof process.cwd === "function") {
@@ -7148,15 +7157,15 @@ function cwd() {
7148
7157
  }
7149
7158
  __name(cwd, "cwd");
7150
7159
  __name2(cwd, "cwd");
7151
- function normalizeString2(path7, allowAboveRoot) {
7160
+ function normalizeString2(path6, allowAboveRoot) {
7152
7161
  let res = "";
7153
7162
  let lastSegmentLength = 0;
7154
7163
  let lastSlash = -1;
7155
7164
  let dots = 0;
7156
7165
  let char = null;
7157
- for (let index = 0; index <= path7.length; ++index) {
7158
- if (index < path7.length) {
7159
- char = path7[index];
7166
+ for (let index = 0; index <= path6.length; ++index) {
7167
+ if (index < path6.length) {
7168
+ char = path6[index];
7160
7169
  } else if (char === "/") {
7161
7170
  break;
7162
7171
  } else {
@@ -7192,9 +7201,9 @@ function normalizeString2(path7, allowAboveRoot) {
7192
7201
  }
7193
7202
  } else {
7194
7203
  if (res.length > 0) {
7195
- res += `/${path7.slice(lastSlash + 1, index)}`;
7204
+ res += `/${path6.slice(lastSlash + 1, index)}`;
7196
7205
  } else {
7197
- res = path7.slice(lastSlash + 1, index);
7206
+ res = path6.slice(lastSlash + 1, index);
7198
7207
  }
7199
7208
  lastSegmentLength = index - lastSlash - 1;
7200
7209
  }
@@ -7294,20 +7303,20 @@ init_cjs_shims();
7294
7303
  // ../path/src/is-file.ts
7295
7304
  init_cjs_shims();
7296
7305
  var import_node_fs3 = require("node:fs");
7297
- function isFile(path7, additionalPath) {
7298
- return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path7) : path7, {
7306
+ function isFile(path6, additionalPath) {
7307
+ return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
7299
7308
  throwIfNoEntry: false
7300
7309
  })?.isFile());
7301
7310
  }
7302
7311
  __name(isFile, "isFile");
7303
- function isDirectory(path7, additionalPath) {
7304
- return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path7) : path7, {
7312
+ function isDirectory(path6, additionalPath) {
7313
+ return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
7305
7314
  throwIfNoEntry: false
7306
7315
  })?.isDirectory());
7307
7316
  }
7308
7317
  __name(isDirectory, "isDirectory");
7309
- function isAbsolutePath(path7) {
7310
- return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path7);
7318
+ function isAbsolutePath(path6) {
7319
+ return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path6);
7311
7320
  }
7312
7321
  __name(isAbsolutePath, "isAbsolutePath");
7313
7322
 
@@ -7322,45 +7331,45 @@ function normalizeWindowsPath3(input = "") {
7322
7331
  __name(normalizeWindowsPath3, "normalizeWindowsPath");
7323
7332
  var _UNC_REGEX3 = /^[/\\]{2}/;
7324
7333
  var _DRIVE_LETTER_RE3 = /^[A-Z]:$/i;
7325
- function correctPath(path7) {
7326
- if (!path7 || path7.length === 0) {
7334
+ function correctPath(path6) {
7335
+ if (!path6 || path6.length === 0) {
7327
7336
  return ".";
7328
7337
  }
7329
- path7 = normalizeWindowsPath3(path7);
7330
- const isUNCPath = path7.match(_UNC_REGEX3);
7331
- const isPathAbsolute = isAbsolutePath(path7);
7332
- const trailingSeparator = path7[path7.length - 1] === "/";
7333
- path7 = normalizeString3(path7, !isPathAbsolute);
7334
- if (path7.length === 0) {
7338
+ path6 = normalizeWindowsPath3(path6);
7339
+ const isUNCPath = path6.match(_UNC_REGEX3);
7340
+ const isPathAbsolute = isAbsolutePath(path6);
7341
+ const trailingSeparator = path6[path6.length - 1] === "/";
7342
+ path6 = normalizeString3(path6, !isPathAbsolute);
7343
+ if (path6.length === 0) {
7335
7344
  if (isPathAbsolute) {
7336
7345
  return "/";
7337
7346
  }
7338
7347
  return trailingSeparator ? "./" : ".";
7339
7348
  }
7340
7349
  if (trailingSeparator) {
7341
- path7 += "/";
7350
+ path6 += "/";
7342
7351
  }
7343
- if (_DRIVE_LETTER_RE3.test(path7)) {
7344
- path7 += "/";
7352
+ if (_DRIVE_LETTER_RE3.test(path6)) {
7353
+ path6 += "/";
7345
7354
  }
7346
7355
  if (isUNCPath) {
7347
7356
  if (!isPathAbsolute) {
7348
- return `//./${path7}`;
7357
+ return `//./${path6}`;
7349
7358
  }
7350
- return `//${path7}`;
7359
+ return `//${path6}`;
7351
7360
  }
7352
- return isPathAbsolute && !isAbsolutePath(path7) ? `/${path7}` : path7;
7361
+ return isPathAbsolute && !isAbsolutePath(path6) ? `/${path6}` : path6;
7353
7362
  }
7354
7363
  __name(correctPath, "correctPath");
7355
- function normalizeString3(path7, allowAboveRoot) {
7364
+ function normalizeString3(path6, allowAboveRoot) {
7356
7365
  let res = "";
7357
7366
  let lastSegmentLength = 0;
7358
7367
  let lastSlash = -1;
7359
7368
  let dots = 0;
7360
7369
  let char = null;
7361
- for (let index = 0; index <= path7.length; ++index) {
7362
- if (index < path7.length) {
7363
- char = path7[index];
7370
+ for (let index = 0; index <= path6.length; ++index) {
7371
+ if (index < path6.length) {
7372
+ char = path6[index];
7364
7373
  } else if (char === "/") {
7365
7374
  break;
7366
7375
  } else {
@@ -7396,9 +7405,9 @@ function normalizeString3(path7, allowAboveRoot) {
7396
7405
  }
7397
7406
  } else {
7398
7407
  if (res.length > 0) {
7399
- res += `/${path7.slice(lastSlash + 1, index)}`;
7408
+ res += `/${path6.slice(lastSlash + 1, index)}`;
7400
7409
  } else {
7401
- res = path7.slice(lastSlash + 1, index);
7410
+ res = path6.slice(lastSlash + 1, index);
7402
7411
  }
7403
7412
  lastSegmentLength = index - lastSlash - 1;
7404
7413
  }
@@ -7433,17 +7442,17 @@ function findFilePath(filePath) {
7433
7442
  }), "");
7434
7443
  }
7435
7444
  __name(findFilePath, "findFilePath");
7436
- function resolvePath(path7, cwd2 = getWorkspaceRoot()) {
7437
- const paths = normalizeWindowsPath3(path7).split("/");
7445
+ function resolvePath(path6, cwd2 = getWorkspaceRoot()) {
7446
+ const paths = normalizeWindowsPath3(path6).split("/");
7438
7447
  let resolvedPath = "";
7439
7448
  let resolvedAbsolute = false;
7440
7449
  for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
7441
- const path8 = index >= 0 ? paths[index] : cwd2;
7442
- if (!path8 || path8.length === 0) {
7450
+ const path7 = index >= 0 ? paths[index] : cwd2;
7451
+ if (!path7 || path7.length === 0) {
7443
7452
  continue;
7444
7453
  }
7445
- resolvedPath = joinPaths(path8, resolvedPath);
7446
- resolvedAbsolute = isAbsolutePath(path8);
7454
+ resolvedPath = joinPaths(path7, resolvedPath);
7455
+ resolvedAbsolute = isAbsolutePath(path7);
7447
7456
  }
7448
7457
  resolvedPath = normalizeString3(resolvedPath, !resolvedAbsolute);
7449
7458
  if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {
@@ -7453,13 +7462,13 @@ function resolvePath(path7, cwd2 = getWorkspaceRoot()) {
7453
7462
  }
7454
7463
  __name(resolvePath, "resolvePath");
7455
7464
  function resolvePaths(...paths) {
7456
- return resolvePath(joinPaths(...paths.map((path7) => normalizeWindowsPath3(path7))));
7465
+ return resolvePath(joinPaths(...paths.map((path6) => normalizeWindowsPath3(path6))));
7457
7466
  }
7458
7467
  __name(resolvePaths, "resolvePaths");
7459
7468
 
7460
7469
  // ../path/src/get-parent-path.ts
7461
- var resolveParentPath = /* @__PURE__ */ __name((path7) => {
7462
- return resolvePaths(path7, "..");
7470
+ var resolveParentPath = /* @__PURE__ */ __name((path6) => {
7471
+ return resolvePaths(path6, "..");
7463
7472
  }, "resolveParentPath");
7464
7473
  var getParentPath = /* @__PURE__ */ __name((name, cwd2, options) => {
7465
7474
  const ignoreCase = options?.ignoreCase ?? true;
@@ -7956,24 +7965,6 @@ var project = new import_ts_morph.Project({
7956
7965
  }
7957
7966
  });
7958
7967
 
7959
- // src/utils/remove-dir.ts
7960
- init_cjs_shims();
7961
- var import_node_fs4 = require("node:fs");
7962
- var import_node_path4 = __toESM(require("node:path"), 1);
7963
- async function removeDir(dirPath, onlyContent) {
7964
- const dirEntries = await import_node_fs4.promises.readdir(dirPath, {
7965
- withFileTypes: true
7966
- });
7967
- await Promise.all(dirEntries.map(async (dirEntry) => {
7968
- const fullPath = import_node_path4.default.join(dirPath, dirEntry.name);
7969
- return dirEntry.isDirectory() ? removeDir(fullPath, false) : import_node_fs4.promises.unlink(fullPath);
7970
- }));
7971
- if (!onlyContent) {
7972
- await import_node_fs4.promises.rmdir(dirPath);
7973
- }
7974
- }
7975
- __name(removeDir, "removeDir");
7976
-
7977
7968
  // src/utils/write-file-safely.ts
7978
7969
  init_cjs_shims();
7979
7970
 
@@ -9162,7 +9153,7 @@ var isURL = /* @__PURE__ */ __name((payload) => payload instanceof URL, "isURL")
9162
9153
  // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
9163
9154
  init_cjs_shims();
9164
9155
  var escapeKey = /* @__PURE__ */ __name((key) => key.replace(/\./g, "\\."), "escapeKey");
9165
- var stringifyPath = /* @__PURE__ */ __name((path7) => path7.map(String).map(escapeKey).join("."), "stringifyPath");
9156
+ var stringifyPath = /* @__PURE__ */ __name((path6) => path6.map(String).map(escapeKey).join("."), "stringifyPath");
9166
9157
  var parsePath = /* @__PURE__ */ __name((string) => {
9167
9158
  const result = [];
9168
9159
  let segment = "";
@@ -9425,27 +9416,27 @@ var getNthKey = /* @__PURE__ */ __name((value, n) => {
9425
9416
  }
9426
9417
  return keys.next().value;
9427
9418
  }, "getNthKey");
9428
- function validatePath(path7) {
9429
- if (includes(path7, "__proto__")) {
9419
+ function validatePath(path6) {
9420
+ if (includes(path6, "__proto__")) {
9430
9421
  throw new Error("__proto__ is not allowed as a property");
9431
9422
  }
9432
- if (includes(path7, "prototype")) {
9423
+ if (includes(path6, "prototype")) {
9433
9424
  throw new Error("prototype is not allowed as a property");
9434
9425
  }
9435
- if (includes(path7, "constructor")) {
9426
+ if (includes(path6, "constructor")) {
9436
9427
  throw new Error("constructor is not allowed as a property");
9437
9428
  }
9438
9429
  }
9439
9430
  __name(validatePath, "validatePath");
9440
- var getDeep = /* @__PURE__ */ __name((object, path7) => {
9441
- validatePath(path7);
9442
- for (let i = 0; i < path7.length; i++) {
9443
- const key = path7[i];
9431
+ var getDeep = /* @__PURE__ */ __name((object, path6) => {
9432
+ validatePath(path6);
9433
+ for (let i = 0; i < path6.length; i++) {
9434
+ const key = path6[i];
9444
9435
  if (isSet(object)) {
9445
9436
  object = getNthKey(object, +key);
9446
9437
  } else if (isMap(object)) {
9447
9438
  const row = +key;
9448
- const type = +path7[++i] === 0 ? "key" : "value";
9439
+ const type = +path6[++i] === 0 ? "key" : "value";
9449
9440
  const keyOfRow = getNthKey(object, row);
9450
9441
  switch (type) {
9451
9442
  case "key":
@@ -9461,14 +9452,14 @@ var getDeep = /* @__PURE__ */ __name((object, path7) => {
9461
9452
  }
9462
9453
  return object;
9463
9454
  }, "getDeep");
9464
- var setDeep = /* @__PURE__ */ __name((object, path7, mapper) => {
9465
- validatePath(path7);
9466
- if (path7.length === 0) {
9455
+ var setDeep = /* @__PURE__ */ __name((object, path6, mapper) => {
9456
+ validatePath(path6);
9457
+ if (path6.length === 0) {
9467
9458
  return mapper(object);
9468
9459
  }
9469
9460
  let parent = object;
9470
- for (let i = 0; i < path7.length - 1; i++) {
9471
- const key = path7[i];
9461
+ for (let i = 0; i < path6.length - 1; i++) {
9462
+ const key = path6[i];
9472
9463
  if (isArray(parent)) {
9473
9464
  const index = +key;
9474
9465
  parent = parent[index];
@@ -9478,12 +9469,12 @@ var setDeep = /* @__PURE__ */ __name((object, path7, mapper) => {
9478
9469
  const row = +key;
9479
9470
  parent = getNthKey(parent, row);
9480
9471
  } else if (isMap(parent)) {
9481
- const isEnd = i === path7.length - 2;
9472
+ const isEnd = i === path6.length - 2;
9482
9473
  if (isEnd) {
9483
9474
  break;
9484
9475
  }
9485
9476
  const row = +key;
9486
- const type = +path7[++i] === 0 ? "key" : "value";
9477
+ const type = +path6[++i] === 0 ? "key" : "value";
9487
9478
  const keyOfRow = getNthKey(parent, row);
9488
9479
  switch (type) {
9489
9480
  case "key":
@@ -9495,7 +9486,7 @@ var setDeep = /* @__PURE__ */ __name((object, path7, mapper) => {
9495
9486
  }
9496
9487
  }
9497
9488
  }
9498
- const lastKey = path7[path7.length - 1];
9489
+ const lastKey = path6[path6.length - 1];
9499
9490
  if (isArray(parent)) {
9500
9491
  parent[+lastKey] = mapper(parent[+lastKey]);
9501
9492
  } else if (isPlainObject2(parent)) {
@@ -9510,7 +9501,7 @@ var setDeep = /* @__PURE__ */ __name((object, path7, mapper) => {
9510
9501
  }
9511
9502
  }
9512
9503
  if (isMap(parent)) {
9513
- const row = +path7[path7.length - 2];
9504
+ const row = +path6[path6.length - 2];
9514
9505
  const keyToRow = getNthKey(parent, row);
9515
9506
  const type = +lastKey === 0 ? "key" : "value";
9516
9507
  switch (type) {
@@ -9556,15 +9547,15 @@ function traverse(tree, walker2, origin = []) {
9556
9547
  }
9557
9548
  __name(traverse, "traverse");
9558
9549
  function applyValueAnnotations(plain, annotations, superJson) {
9559
- traverse(annotations, (type, path7) => {
9560
- plain = setDeep(plain, path7, (v) => untransformValue(v, type, superJson));
9550
+ traverse(annotations, (type, path6) => {
9551
+ plain = setDeep(plain, path6, (v) => untransformValue(v, type, superJson));
9561
9552
  });
9562
9553
  return plain;
9563
9554
  }
9564
9555
  __name(applyValueAnnotations, "applyValueAnnotations");
9565
9556
  function applyReferentialEqualityAnnotations(plain, annotations) {
9566
- function apply(identicalPaths, path7) {
9567
- const object = getDeep(plain, parsePath(path7));
9557
+ function apply(identicalPaths, path6) {
9558
+ const object = getDeep(plain, parsePath(path6));
9568
9559
  identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
9569
9560
  plain = setDeep(plain, identicalObjectPath, () => object);
9570
9561
  });
@@ -9585,13 +9576,13 @@ function applyReferentialEqualityAnnotations(plain, annotations) {
9585
9576
  }
9586
9577
  __name(applyReferentialEqualityAnnotations, "applyReferentialEqualityAnnotations");
9587
9578
  var isDeep = /* @__PURE__ */ __name((object, superJson) => isPlainObject2(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson), "isDeep");
9588
- function addIdentity(object, path7, identities) {
9579
+ function addIdentity(object, path6, identities) {
9589
9580
  const existingSet = identities.get(object);
9590
9581
  if (existingSet) {
9591
- existingSet.push(path7);
9582
+ existingSet.push(path6);
9592
9583
  } else {
9593
9584
  identities.set(object, [
9594
- path7
9585
+ path6
9595
9586
  ]);
9596
9587
  }
9597
9588
  }
@@ -9604,7 +9595,7 @@ function generateReferentialEqualityAnnotations(identitites, dedupe) {
9604
9595
  return;
9605
9596
  }
9606
9597
  if (!dedupe) {
9607
- paths = paths.map((path7) => path7.map(String)).sort((a, b) => a.length - b.length);
9598
+ paths = paths.map((path6) => path6.map(String)).sort((a, b) => a.length - b.length);
9608
9599
  }
9609
9600
  const [representativePath, ...identicalPaths] = paths;
9610
9601
  if (representativePath.length === 0) {
@@ -9629,10 +9620,10 @@ function generateReferentialEqualityAnnotations(identitites, dedupe) {
9629
9620
  }
9630
9621
  }
9631
9622
  __name(generateReferentialEqualityAnnotations, "generateReferentialEqualityAnnotations");
9632
- var walker = /* @__PURE__ */ __name((object, identities, superJson, dedupe, path7 = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
9623
+ var walker = /* @__PURE__ */ __name((object, identities, superJson, dedupe, path6 = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
9633
9624
  const primitive = isPrimitive(object);
9634
9625
  if (!primitive) {
9635
- addIdentity(object, path7, identities);
9626
+ addIdentity(object, path6, identities);
9636
9627
  const seen = seenObjects.get(object);
9637
9628
  if (seen) {
9638
9629
  return dedupe ? {
@@ -9669,7 +9660,7 @@ var walker = /* @__PURE__ */ __name((object, identities, superJson, dedupe, path
9669
9660
  throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
9670
9661
  }
9671
9662
  const recursiveResult = walker(value, identities, superJson, dedupe, [
9672
- ...path7,
9663
+ ...path6,
9673
9664
  index
9674
9665
  ], [
9675
9666
  ...objectsInThisPath,
@@ -10249,7 +10240,7 @@ var writeFile = /* @__PURE__ */ __name(async (filePath, content, options) => {
10249
10240
  }, "writeFile");
10250
10241
 
10251
10242
  // src/utils/write-file-safely.ts
10252
- var import_node_path5 = __toESM(require("node:path"), 1);
10243
+ var import_node_path4 = __toESM(require("node:path"), 1);
10253
10244
 
10254
10245
  // src/utils/format-file.ts
10255
10246
  init_cjs_shims();
@@ -10293,7 +10284,7 @@ var writeFileSafely = /* @__PURE__ */ __name(async (writeLocation, content, addT
10293
10284
  }, "writeFileSafely");
10294
10285
  var writeIndexFile = /* @__PURE__ */ __name(async (indexPath) => {
10295
10286
  const rows = Array.from(indexExports).map((filePath) => {
10296
- let relativePath = import_node_path5.default.relative(import_node_path5.default.dirname(indexPath), filePath);
10287
+ let relativePath = import_node_path4.default.relative(import_node_path4.default.dirname(indexPath), filePath);
10297
10288
  if (relativePath.endsWith(".ts")) {
10298
10289
  relativePath = relativePath.slice(0, relativePath.lastIndexOf(".ts"));
10299
10290
  }
@@ -10470,7 +10461,7 @@ init_cjs_shims();
10470
10461
 
10471
10462
  // src/zod-helpers/transformer.ts
10472
10463
  init_cjs_shims();
10473
- var import_node_path6 = __toESM(require("node:path"), 1);
10464
+ var import_node_path5 = __toESM(require("node:path"), 1);
10474
10465
 
10475
10466
  // src/zod-helpers/model-helpers.ts
10476
10467
  init_cjs_shims();
@@ -10618,13 +10609,13 @@ var Transformer = class _Transformer {
10618
10609
  this.isCustomPrismaClientOutputPath = prismaClientCustomPath !== "@prisma/client";
10619
10610
  }
10620
10611
  static async generateIndex() {
10621
- const indexPath = import_node_path6.default.join(_Transformer.outputPath, "schemas/index.ts");
10612
+ const indexPath = import_node_path5.default.join(_Transformer.outputPath, "schemas/index.ts");
10622
10613
  await writeIndexFile(indexPath);
10623
10614
  }
10624
10615
  async generateEnumSchemas() {
10625
10616
  for (const enumType2 of this.enumTypes) {
10626
10617
  const { name, values } = enumType2;
10627
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/enums/${name}.schema.ts`), `${this.generateImportZodStatement()}
10618
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/enums/${name}.schema.ts`), `${this.generateImportZodStatement()}
10628
10619
  ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)})`)}`);
10629
10620
  }
10630
10621
  }
@@ -10638,7 +10629,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10638
10629
  const zodObjectSchemaFields = this.generateObjectSchemaFields();
10639
10630
  const objectSchema = this.prepareObjectSchema(zodObjectSchemaFields);
10640
10631
  const objectSchemaName = this.resolveObjectSchemaName();
10641
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/objects/${objectSchemaName}.schema.ts`), objectSchema);
10632
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/objects/${objectSchemaName}.schema.ts`), objectSchema);
10642
10633
  }
10643
10634
  generateObjectSchemaFields() {
10644
10635
  const zodObjectSchemaFields = this.fields.map((field) => this.generateObjectSchemaField(field)).flatMap((item) => item).map((item) => {
@@ -10777,9 +10768,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10777
10768
  generateImportPrismaStatement() {
10778
10769
  let prismaClientImportPath;
10779
10770
  if (_Transformer.isCustomPrismaClientOutputPath) {
10780
- const fromPath = import_node_path6.default.join(_Transformer.outputPath, "schemas", "objects");
10771
+ const fromPath = import_node_path5.default.join(_Transformer.outputPath, "schemas", "objects");
10781
10772
  const toPath = _Transformer.prismaClientOutputPath;
10782
- const relativePathFromOutputToPrismaClient = import_node_path6.default.relative(fromPath, toPath).split(import_node_path6.default.sep).join(import_node_path6.default.posix.sep);
10773
+ const relativePathFromOutputToPrismaClient = import_node_path5.default.relative(fromPath, toPath).split(import_node_path5.default.sep).join(import_node_path5.default.posix.sep);
10783
10774
  prismaClientImportPath = relativePathFromOutputToPrismaClient;
10784
10775
  } else {
10785
10776
  prismaClientImportPath = _Transformer.prismaClientOutputPath;
@@ -10907,7 +10898,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10907
10898
  includeImport,
10908
10899
  `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`
10909
10900
  ];
10910
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/${findUnique}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}FindUnique`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} where: ${modelName}WhereUniqueInputObjectSchema })`)}`);
10901
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/${findUnique}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}FindUnique`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} where: ${modelName}WhereUniqueInputObjectSchema })`)}`);
10911
10902
  }
10912
10903
  if (findFirst) {
10913
10904
  const imports = [
@@ -10918,7 +10909,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10918
10909
  `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`,
10919
10910
  `import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`
10920
10911
  ];
10921
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/${findFirst}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}FindFirst`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} ${orderByZodSchemaLine} where: ${modelName}WhereInputObjectSchema.optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.array(${modelName}ScalarFieldEnumSchema).optional() })`)}`);
10912
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/${findFirst}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}FindFirst`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} ${orderByZodSchemaLine} where: ${modelName}WhereInputObjectSchema.optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.array(${modelName}ScalarFieldEnumSchema).optional() })`)}`);
10922
10913
  }
10923
10914
  if (findMany) {
10924
10915
  const imports = [
@@ -10929,7 +10920,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10929
10920
  `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`,
10930
10921
  `import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`
10931
10922
  ];
10932
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/${findMany}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}FindMany`, `z.object({ ${selectZodSchemaLineLazy} ${includeZodSchemaLineLazy} ${orderByZodSchemaLine} where: ${modelName}WhereInputObjectSchema.optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.array(${modelName}ScalarFieldEnumSchema).optional() })`)}`);
10923
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/${findMany}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}FindMany`, `z.object({ ${selectZodSchemaLineLazy} ${includeZodSchemaLineLazy} ${orderByZodSchemaLine} where: ${modelName}WhereInputObjectSchema.optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.array(${modelName}ScalarFieldEnumSchema).optional() })`)}`);
10933
10924
  }
10934
10925
  if (createOne) {
10935
10926
  const imports = [
@@ -10938,13 +10929,13 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10938
10929
  `import { ${modelName}CreateInputObjectSchema } from './objects/${modelName}CreateInput.schema'`,
10939
10930
  `import { ${modelName}UncheckedCreateInputObjectSchema } from './objects/${modelName}UncheckedCreateInput.schema'`
10940
10931
  ];
10941
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/${createOne}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}CreateOne`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} data: z.union([${modelName}CreateInputObjectSchema, ${modelName}UncheckedCreateInputObjectSchema]) })`)}`);
10932
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/${createOne}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}CreateOne`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} data: z.union([${modelName}CreateInputObjectSchema, ${modelName}UncheckedCreateInputObjectSchema]) })`)}`);
10942
10933
  }
10943
10934
  if (createMany) {
10944
10935
  const imports = [
10945
10936
  `import { ${modelName}CreateManyInputObjectSchema } from './objects/${modelName}CreateManyInput.schema'`
10946
10937
  ];
10947
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/${createMany}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}CreateMany`, `z.object({ data: z.union([ ${modelName}CreateManyInputObjectSchema, z.array(${modelName}CreateManyInputObjectSchema) ]), ${_Transformer.provider === "mongodb" || _Transformer.provider === "sqlserver" ? "" : "skipDuplicates: z.boolean().optional()"} })`)}`);
10938
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/${createMany}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}CreateMany`, `z.object({ data: z.union([ ${modelName}CreateManyInputObjectSchema, z.array(${modelName}CreateManyInputObjectSchema) ]), ${_Transformer.provider === "mongodb" || _Transformer.provider === "sqlserver" ? "" : "skipDuplicates: z.boolean().optional()"} })`)}`);
10948
10939
  }
10949
10940
  if (deleteOne) {
10950
10941
  const imports = [
@@ -10952,13 +10943,13 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10952
10943
  includeImport,
10953
10944
  `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`
10954
10945
  ];
10955
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/${deleteOne}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}DeleteOne`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} where: ${modelName}WhereUniqueInputObjectSchema })`)}`);
10946
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/${deleteOne}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}DeleteOne`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} where: ${modelName}WhereUniqueInputObjectSchema })`)}`);
10956
10947
  }
10957
10948
  if (deleteMany) {
10958
10949
  const imports = [
10959
10950
  `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`
10960
10951
  ];
10961
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/${deleteMany}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}DeleteMany`, `z.object({ where: ${modelName}WhereInputObjectSchema.optional() })`)}`);
10952
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/${deleteMany}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}DeleteMany`, `z.object({ where: ${modelName}WhereInputObjectSchema.optional() })`)}`);
10962
10953
  }
10963
10954
  if (updateOne) {
10964
10955
  const imports = [
@@ -10968,14 +10959,14 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10968
10959
  `import { ${modelName}UncheckedUpdateInputObjectSchema } from './objects/${modelName}UncheckedUpdateInput.schema'`,
10969
10960
  `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`
10970
10961
  ];
10971
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/${updateOne}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}UpdateOne`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} data: z.union([${modelName}UpdateInputObjectSchema, ${modelName}UncheckedUpdateInputObjectSchema]), where: ${modelName}WhereUniqueInputObjectSchema })`)}`);
10962
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/${updateOne}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}UpdateOne`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} data: z.union([${modelName}UpdateInputObjectSchema, ${modelName}UncheckedUpdateInputObjectSchema]), where: ${modelName}WhereUniqueInputObjectSchema })`)}`);
10972
10963
  }
10973
10964
  if (updateMany) {
10974
10965
  const imports = [
10975
10966
  `import { ${modelName}UpdateManyMutationInputObjectSchema } from './objects/${modelName}UpdateManyMutationInput.schema'`,
10976
10967
  `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`
10977
10968
  ];
10978
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/${updateMany}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}UpdateMany`, `z.object({ data: ${modelName}UpdateManyMutationInputObjectSchema, where: ${modelName}WhereInputObjectSchema.optional() })`)}`);
10969
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/${updateMany}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}UpdateMany`, `z.object({ data: ${modelName}UpdateManyMutationInputObjectSchema, where: ${modelName}WhereInputObjectSchema.optional() })`)}`);
10979
10970
  }
10980
10971
  if (upsertOne) {
10981
10972
  const imports = [
@@ -10987,7 +10978,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10987
10978
  `import { ${modelName}UpdateInputObjectSchema } from './objects/${modelName}UpdateInput.schema'`,
10988
10979
  `import { ${modelName}UncheckedUpdateInputObjectSchema } from './objects/${modelName}UncheckedUpdateInput.schema'`
10989
10980
  ];
10990
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/${upsertOne}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}Upsert`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} where: ${modelName}WhereUniqueInputObjectSchema, create: z.union([ ${modelName}CreateInputObjectSchema, ${modelName}UncheckedCreateInputObjectSchema ]), update: z.union([ ${modelName}UpdateInputObjectSchema, ${modelName}UncheckedUpdateInputObjectSchema ]) })`)}`);
10981
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/${upsertOne}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}Upsert`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} where: ${modelName}WhereUniqueInputObjectSchema, create: z.union([ ${modelName}CreateInputObjectSchema, ${modelName}UncheckedCreateInputObjectSchema ]), update: z.union([ ${modelName}UpdateInputObjectSchema, ${modelName}UncheckedUpdateInputObjectSchema ]) })`)}`);
10991
10982
  }
10992
10983
  if (aggregate) {
10993
10984
  const imports = [
@@ -11018,7 +11009,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
11018
11009
  aggregateOperations.push(`_sum: ${modelName}SumAggregateInputObjectSchema.optional()`);
11019
11010
  }
11020
11011
  }
11021
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/${aggregate}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}Aggregate`, `z.object({ ${orderByZodSchemaLine} where: ${modelName}WhereInputObjectSchema.optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), ${aggregateOperations.join(", ")} })`)}`);
11012
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/${aggregate}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}Aggregate`, `z.object({ ${orderByZodSchemaLine} where: ${modelName}WhereInputObjectSchema.optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), ${aggregateOperations.join(", ")} })`)}`);
11022
11013
  }
11023
11014
  if (groupBy) {
11024
11015
  const imports = [
@@ -11027,7 +11018,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
11027
11018
  `import { ${modelName}ScalarWhereWithAggregatesInputObjectSchema } from './objects/${modelName}ScalarWhereWithAggregatesInput.schema'`,
11028
11019
  `import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`
11029
11020
  ];
11030
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/${groupBy}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}GroupBy`, `z.object({ where: ${modelName}WhereInputObjectSchema.optional(), orderBy: z.union([${modelName}OrderByWithAggregationInputObjectSchema, ${modelName}OrderByWithAggregationInputObjectSchema.array()]).optional(), having: ${modelName}ScalarWhereWithAggregatesInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), by: z.array(${modelName}ScalarFieldEnumSchema) })`)}`);
11021
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/${groupBy}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}GroupBy`, `z.object({ where: ${modelName}WhereInputObjectSchema.optional(), orderBy: z.union([${modelName}OrderByWithAggregationInputObjectSchema, ${modelName}OrderByWithAggregationInputObjectSchema.array()]).optional(), having: ${modelName}ScalarWhereWithAggregatesInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), by: z.array(${modelName}ScalarFieldEnumSchema) })`)}`);
11031
11022
  }
11032
11023
  }
11033
11024
  }
@@ -11478,8 +11469,8 @@ async function generate(options) {
11478
11469
  }
11479
11470
  }, "consoleLog");
11480
11471
  consoleLog(`Preparing output directory: ${outputDir}`);
11472
+ await removeDirectory(outputDir);
11481
11473
  await createDirectory(outputDir);
11482
- await removeDir(outputDir, true);
11483
11474
  consoleLog("Finding Prisma Client generator");
11484
11475
  const prismaClientProvider = options.otherGenerators.find((it) => internals.parseEnvValue(it.provider) === "prisma-client-js");
11485
11476
  if (!prismaClientProvider) {
@@ -11531,7 +11522,6 @@ async function generate(options) {
11531
11522
  const shieldOutputDir = joinPaths(outputDir, "shield");
11532
11523
  consoleLog("Preparing tRPC Shield output directory");
11533
11524
  await createDirectory(shieldOutputDir);
11534
- await removeDir(shieldOutputDir, true);
11535
11525
  const queries = [];
11536
11526
  const mutations = [];
11537
11527
  const subscriptions = [];
@@ -11589,7 +11579,7 @@ async function generate(options) {
11589
11579
  }
11590
11580
  consoleLog(`Generating tRPC source code for ${models.length} models`);
11591
11581
  resolveModelsComments(models, hiddenModels);
11592
- const createRouter = project.createSourceFile(import_node_path7.default.resolve(outputDir, "routers", "helpers", "createRouter.ts"), void 0, {
11582
+ const createRouter = project.createSourceFile(import_node_path6.default.resolve(outputDir, "routers", "helpers", "createRouter.ts"), void 0, {
11593
11583
  overwrite: true
11594
11584
  });
11595
11585
  consoleLog("Generating tRPC imports");
@@ -11602,7 +11592,7 @@ async function generate(options) {
11602
11592
  createRouter.formatText({
11603
11593
  indentSize: 2
11604
11594
  });
11605
- const appRouter = project.createSourceFile(import_node_path7.default.resolve(outputDir, "routers", `index.ts`), void 0, {
11595
+ const appRouter = project.createSourceFile(import_node_path6.default.resolve(outputDir, "routers", `index.ts`), void 0, {
11606
11596
  overwrite: true
11607
11597
  });
11608
11598
  consoleLog("Generating tRPC router imports");
@@ -11624,7 +11614,7 @@ async function generate(options) {
11624
11614
  const plural = (0, import_pluralize.default)(model.toLowerCase());
11625
11615
  consoleLog(`Generating tRPC router for model ${model}`);
11626
11616
  generateRouterImport(appRouter, plural, model);
11627
- const modelRouter = project.createSourceFile(import_node_path7.default.resolve(outputDir, "routers", `${model}.router.ts`), void 0, {
11617
+ const modelRouter = project.createSourceFile(import_node_path6.default.resolve(outputDir, "routers", `${model}.router.ts`), void 0, {
11628
11618
  overwrite: true
11629
11619
  });
11630
11620
  generateCreateRouterImport({