@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.
@@ -2484,15 +2484,24 @@ var exists = /* @__PURE__ */ __name(async (filePath) => {
2484
2484
 
2485
2485
  // ../fs/src/helpers.ts
2486
2486
  var import_promises2 = require("node:fs/promises");
2487
- async function createDirectory(path7) {
2488
- if (await exists(path7)) {
2487
+ async function createDirectory(path6) {
2488
+ if (await exists(path6)) {
2489
2489
  return;
2490
2490
  }
2491
- return (0, import_promises2.mkdir)(path7, {
2491
+ return (0, import_promises2.mkdir)(path6, {
2492
2492
  recursive: true
2493
2493
  });
2494
2494
  }
2495
2495
  __name(createDirectory, "createDirectory");
2496
+ async function removeDirectory(path6) {
2497
+ if (!existsSync(path6)) {
2498
+ return;
2499
+ }
2500
+ return (0, import_promises2.rm)(path6, {
2501
+ recursive: true
2502
+ });
2503
+ }
2504
+ __name(removeDirectory, "removeDirectory");
2496
2505
 
2497
2506
  // ../path/src/join-paths.ts
2498
2507
  init_cjs_shims();
@@ -2510,65 +2519,65 @@ var _DRIVE_LETTER_RE = /^[A-Z]:$/i;
2510
2519
  var isAbsolute = /* @__PURE__ */ __name(function(p) {
2511
2520
  return _IS_ABSOLUTE_RE.test(p);
2512
2521
  }, "isAbsolute");
2513
- var correctPaths = /* @__PURE__ */ __name(function(path7) {
2514
- if (!path7 || path7.length === 0) {
2522
+ var correctPaths = /* @__PURE__ */ __name(function(path6) {
2523
+ if (!path6 || path6.length === 0) {
2515
2524
  return ".";
2516
2525
  }
2517
- path7 = normalizeWindowsPath(path7);
2518
- const isUNCPath = path7.match(_UNC_REGEX);
2519
- const isPathAbsolute = isAbsolute(path7);
2520
- const trailingSeparator = path7[path7.length - 1] === "/";
2521
- path7 = normalizeString(path7, !isPathAbsolute);
2522
- if (path7.length === 0) {
2526
+ path6 = normalizeWindowsPath(path6);
2527
+ const isUNCPath = path6.match(_UNC_REGEX);
2528
+ const isPathAbsolute = isAbsolute(path6);
2529
+ const trailingSeparator = path6[path6.length - 1] === "/";
2530
+ path6 = normalizeString(path6, !isPathAbsolute);
2531
+ if (path6.length === 0) {
2523
2532
  if (isPathAbsolute) {
2524
2533
  return "/";
2525
2534
  }
2526
2535
  return trailingSeparator ? "./" : ".";
2527
2536
  }
2528
2537
  if (trailingSeparator) {
2529
- path7 += "/";
2538
+ path6 += "/";
2530
2539
  }
2531
- if (_DRIVE_LETTER_RE.test(path7)) {
2532
- path7 += "/";
2540
+ if (_DRIVE_LETTER_RE.test(path6)) {
2541
+ path6 += "/";
2533
2542
  }
2534
2543
  if (isUNCPath) {
2535
2544
  if (!isPathAbsolute) {
2536
- return `//./${path7}`;
2545
+ return `//./${path6}`;
2537
2546
  }
2538
- return `//${path7}`;
2547
+ return `//${path6}`;
2539
2548
  }
2540
- return isPathAbsolute && !isAbsolute(path7) ? `/${path7}` : path7;
2549
+ return isPathAbsolute && !isAbsolute(path6) ? `/${path6}` : path6;
2541
2550
  }, "correctPaths");
2542
2551
  var joinPaths = /* @__PURE__ */ __name(function(...segments) {
2543
- let path7 = "";
2552
+ let path6 = "";
2544
2553
  for (const seg of segments) {
2545
2554
  if (!seg) {
2546
2555
  continue;
2547
2556
  }
2548
- if (path7.length > 0) {
2549
- const pathTrailing = path7[path7.length - 1] === "/";
2557
+ if (path6.length > 0) {
2558
+ const pathTrailing = path6[path6.length - 1] === "/";
2550
2559
  const segLeading = seg[0] === "/";
2551
2560
  const both = pathTrailing && segLeading;
2552
2561
  if (both) {
2553
- path7 += seg.slice(1);
2562
+ path6 += seg.slice(1);
2554
2563
  } else {
2555
- path7 += pathTrailing || segLeading ? seg : `/${seg}`;
2564
+ path6 += pathTrailing || segLeading ? seg : `/${seg}`;
2556
2565
  }
2557
2566
  } else {
2558
- path7 += seg;
2567
+ path6 += seg;
2559
2568
  }
2560
2569
  }
2561
- return correctPaths(path7);
2570
+ return correctPaths(path6);
2562
2571
  }, "joinPaths");
2563
- function normalizeString(path7, allowAboveRoot) {
2572
+ function normalizeString(path6, allowAboveRoot) {
2564
2573
  let res = "";
2565
2574
  let lastSegmentLength = 0;
2566
2575
  let lastSlash = -1;
2567
2576
  let dots = 0;
2568
2577
  let char = null;
2569
- for (let index = 0; index <= path7.length; ++index) {
2570
- if (index < path7.length) {
2571
- char = path7[index];
2578
+ for (let index = 0; index <= path6.length; ++index) {
2579
+ if (index < path6.length) {
2580
+ char = path6[index];
2572
2581
  } else if (char === "/") {
2573
2582
  break;
2574
2583
  } else {
@@ -2604,9 +2613,9 @@ function normalizeString(path7, allowAboveRoot) {
2604
2613
  }
2605
2614
  } else {
2606
2615
  if (res.length > 0) {
2607
- res += `/${path7.slice(lastSlash + 1, index)}`;
2616
+ res += `/${path6.slice(lastSlash + 1, index)}`;
2608
2617
  } else {
2609
- res = path7.slice(lastSlash + 1, index);
2618
+ res = path6.slice(lastSlash + 1, index);
2610
2619
  }
2611
2620
  lastSegmentLength = index - lastSlash - 1;
2612
2621
  }
@@ -2623,7 +2632,7 @@ function normalizeString(path7, allowAboveRoot) {
2623
2632
  __name(normalizeString, "normalizeString");
2624
2633
 
2625
2634
  // src/prisma-generator.ts
2626
- var import_node_path7 = __toESM(require("node:path"), 1);
2635
+ var import_node_path6 = __toESM(require("node:path"), 1);
2627
2636
  var import_pluralize = __toESM(require_pluralize(), 1);
2628
2637
 
2629
2638
  // src/config.ts
@@ -2991,8 +3000,8 @@ function getErrorMap() {
2991
3000
  }
2992
3001
  __name(getErrorMap, "getErrorMap");
2993
3002
  var makeIssue = /* @__PURE__ */ __name((params) => {
2994
- const { data, path: path7, errorMaps, issueData } = params;
2995
- const fullPath = [...path7, ...issueData.path || []];
3003
+ const { data, path: path6, errorMaps, issueData } = params;
3004
+ const fullPath = [...path6, ...issueData.path || []];
2996
3005
  const fullIssue = {
2997
3006
  ...issueData,
2998
3007
  path: fullPath
@@ -3126,11 +3135,11 @@ var ParseInputLazyPath = class {
3126
3135
  static {
3127
3136
  __name(this, "ParseInputLazyPath");
3128
3137
  }
3129
- constructor(parent, value, path7, key) {
3138
+ constructor(parent, value, path6, key) {
3130
3139
  this._cachedPath = [];
3131
3140
  this.parent = parent;
3132
3141
  this.data = value;
3133
- this._path = path7;
3142
+ this._path = path6;
3134
3143
  this._key = key;
3135
3144
  }
3136
3145
  get path() {
@@ -7115,34 +7124,34 @@ __name2(normalizeWindowsPath2, "normalizeWindowsPath");
7115
7124
  var _UNC_REGEX2 = /^[/\\]{2}/;
7116
7125
  var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
7117
7126
  var _DRIVE_LETTER_RE2 = /^[A-Za-z]:$/;
7118
- var correctPaths2 = /* @__PURE__ */ __name2(function(path7) {
7119
- if (!path7 || path7.length === 0) {
7127
+ var correctPaths2 = /* @__PURE__ */ __name2(function(path6) {
7128
+ if (!path6 || path6.length === 0) {
7120
7129
  return ".";
7121
7130
  }
7122
- path7 = normalizeWindowsPath2(path7);
7123
- const isUNCPath = path7.match(_UNC_REGEX2);
7124
- const isPathAbsolute = isAbsolute2(path7);
7125
- const trailingSeparator = path7[path7.length - 1] === "/";
7126
- path7 = normalizeString2(path7, !isPathAbsolute);
7127
- if (path7.length === 0) {
7131
+ path6 = normalizeWindowsPath2(path6);
7132
+ const isUNCPath = path6.match(_UNC_REGEX2);
7133
+ const isPathAbsolute = isAbsolute2(path6);
7134
+ const trailingSeparator = path6[path6.length - 1] === "/";
7135
+ path6 = normalizeString2(path6, !isPathAbsolute);
7136
+ if (path6.length === 0) {
7128
7137
  if (isPathAbsolute) {
7129
7138
  return "/";
7130
7139
  }
7131
7140
  return trailingSeparator ? "./" : ".";
7132
7141
  }
7133
7142
  if (trailingSeparator) {
7134
- path7 += "/";
7143
+ path6 += "/";
7135
7144
  }
7136
- if (_DRIVE_LETTER_RE2.test(path7)) {
7137
- path7 += "/";
7145
+ if (_DRIVE_LETTER_RE2.test(path6)) {
7146
+ path6 += "/";
7138
7147
  }
7139
7148
  if (isUNCPath) {
7140
7149
  if (!isPathAbsolute) {
7141
- return `//./${path7}`;
7150
+ return `//./${path6}`;
7142
7151
  }
7143
- return `//${path7}`;
7152
+ return `//${path6}`;
7144
7153
  }
7145
- return isPathAbsolute && !isAbsolute2(path7) ? `/${path7}` : path7;
7154
+ return isPathAbsolute && !isAbsolute2(path6) ? `/${path6}` : path6;
7146
7155
  }, "correctPaths");
7147
7156
  function cwd() {
7148
7157
  if (typeof process !== "undefined" && typeof process.cwd === "function") {
@@ -7152,15 +7161,15 @@ function cwd() {
7152
7161
  }
7153
7162
  __name(cwd, "cwd");
7154
7163
  __name2(cwd, "cwd");
7155
- function normalizeString2(path7, allowAboveRoot) {
7164
+ function normalizeString2(path6, allowAboveRoot) {
7156
7165
  let res = "";
7157
7166
  let lastSegmentLength = 0;
7158
7167
  let lastSlash = -1;
7159
7168
  let dots = 0;
7160
7169
  let char = null;
7161
- for (let index = 0; index <= path7.length; ++index) {
7162
- if (index < path7.length) {
7163
- char = path7[index];
7170
+ for (let index = 0; index <= path6.length; ++index) {
7171
+ if (index < path6.length) {
7172
+ char = path6[index];
7164
7173
  } else if (char === "/") {
7165
7174
  break;
7166
7175
  } else {
@@ -7196,9 +7205,9 @@ function normalizeString2(path7, allowAboveRoot) {
7196
7205
  }
7197
7206
  } else {
7198
7207
  if (res.length > 0) {
7199
- res += `/${path7.slice(lastSlash + 1, index)}`;
7208
+ res += `/${path6.slice(lastSlash + 1, index)}`;
7200
7209
  } else {
7201
- res = path7.slice(lastSlash + 1, index);
7210
+ res = path6.slice(lastSlash + 1, index);
7202
7211
  }
7203
7212
  lastSegmentLength = index - lastSlash - 1;
7204
7213
  }
@@ -7298,20 +7307,20 @@ init_cjs_shims();
7298
7307
  // ../path/src/is-file.ts
7299
7308
  init_cjs_shims();
7300
7309
  var import_node_fs3 = require("node:fs");
7301
- function isFile(path7, additionalPath) {
7302
- return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path7) : path7, {
7310
+ function isFile(path6, additionalPath) {
7311
+ return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
7303
7312
  throwIfNoEntry: false
7304
7313
  })?.isFile());
7305
7314
  }
7306
7315
  __name(isFile, "isFile");
7307
- function isDirectory(path7, additionalPath) {
7308
- return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path7) : path7, {
7316
+ function isDirectory(path6, additionalPath) {
7317
+ return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
7309
7318
  throwIfNoEntry: false
7310
7319
  })?.isDirectory());
7311
7320
  }
7312
7321
  __name(isDirectory, "isDirectory");
7313
- function isAbsolutePath(path7) {
7314
- return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path7);
7322
+ function isAbsolutePath(path6) {
7323
+ return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path6);
7315
7324
  }
7316
7325
  __name(isAbsolutePath, "isAbsolutePath");
7317
7326
 
@@ -7326,45 +7335,45 @@ function normalizeWindowsPath3(input = "") {
7326
7335
  __name(normalizeWindowsPath3, "normalizeWindowsPath");
7327
7336
  var _UNC_REGEX3 = /^[/\\]{2}/;
7328
7337
  var _DRIVE_LETTER_RE3 = /^[A-Z]:$/i;
7329
- function correctPath(path7) {
7330
- if (!path7 || path7.length === 0) {
7338
+ function correctPath(path6) {
7339
+ if (!path6 || path6.length === 0) {
7331
7340
  return ".";
7332
7341
  }
7333
- path7 = normalizeWindowsPath3(path7);
7334
- const isUNCPath = path7.match(_UNC_REGEX3);
7335
- const isPathAbsolute = isAbsolutePath(path7);
7336
- const trailingSeparator = path7[path7.length - 1] === "/";
7337
- path7 = normalizeString3(path7, !isPathAbsolute);
7338
- if (path7.length === 0) {
7342
+ path6 = normalizeWindowsPath3(path6);
7343
+ const isUNCPath = path6.match(_UNC_REGEX3);
7344
+ const isPathAbsolute = isAbsolutePath(path6);
7345
+ const trailingSeparator = path6[path6.length - 1] === "/";
7346
+ path6 = normalizeString3(path6, !isPathAbsolute);
7347
+ if (path6.length === 0) {
7339
7348
  if (isPathAbsolute) {
7340
7349
  return "/";
7341
7350
  }
7342
7351
  return trailingSeparator ? "./" : ".";
7343
7352
  }
7344
7353
  if (trailingSeparator) {
7345
- path7 += "/";
7354
+ path6 += "/";
7346
7355
  }
7347
- if (_DRIVE_LETTER_RE3.test(path7)) {
7348
- path7 += "/";
7356
+ if (_DRIVE_LETTER_RE3.test(path6)) {
7357
+ path6 += "/";
7349
7358
  }
7350
7359
  if (isUNCPath) {
7351
7360
  if (!isPathAbsolute) {
7352
- return `//./${path7}`;
7361
+ return `//./${path6}`;
7353
7362
  }
7354
- return `//${path7}`;
7363
+ return `//${path6}`;
7355
7364
  }
7356
- return isPathAbsolute && !isAbsolutePath(path7) ? `/${path7}` : path7;
7365
+ return isPathAbsolute && !isAbsolutePath(path6) ? `/${path6}` : path6;
7357
7366
  }
7358
7367
  __name(correctPath, "correctPath");
7359
- function normalizeString3(path7, allowAboveRoot) {
7368
+ function normalizeString3(path6, allowAboveRoot) {
7360
7369
  let res = "";
7361
7370
  let lastSegmentLength = 0;
7362
7371
  let lastSlash = -1;
7363
7372
  let dots = 0;
7364
7373
  let char = null;
7365
- for (let index = 0; index <= path7.length; ++index) {
7366
- if (index < path7.length) {
7367
- char = path7[index];
7374
+ for (let index = 0; index <= path6.length; ++index) {
7375
+ if (index < path6.length) {
7376
+ char = path6[index];
7368
7377
  } else if (char === "/") {
7369
7378
  break;
7370
7379
  } else {
@@ -7400,9 +7409,9 @@ function normalizeString3(path7, allowAboveRoot) {
7400
7409
  }
7401
7410
  } else {
7402
7411
  if (res.length > 0) {
7403
- res += `/${path7.slice(lastSlash + 1, index)}`;
7412
+ res += `/${path6.slice(lastSlash + 1, index)}`;
7404
7413
  } else {
7405
- res = path7.slice(lastSlash + 1, index);
7414
+ res = path6.slice(lastSlash + 1, index);
7406
7415
  }
7407
7416
  lastSegmentLength = index - lastSlash - 1;
7408
7417
  }
@@ -7437,17 +7446,17 @@ function findFilePath(filePath) {
7437
7446
  }), "");
7438
7447
  }
7439
7448
  __name(findFilePath, "findFilePath");
7440
- function resolvePath(path7, cwd2 = getWorkspaceRoot()) {
7441
- const paths = normalizeWindowsPath3(path7).split("/");
7449
+ function resolvePath(path6, cwd2 = getWorkspaceRoot()) {
7450
+ const paths = normalizeWindowsPath3(path6).split("/");
7442
7451
  let resolvedPath = "";
7443
7452
  let resolvedAbsolute = false;
7444
7453
  for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
7445
- const path8 = index >= 0 ? paths[index] : cwd2;
7446
- if (!path8 || path8.length === 0) {
7454
+ const path7 = index >= 0 ? paths[index] : cwd2;
7455
+ if (!path7 || path7.length === 0) {
7447
7456
  continue;
7448
7457
  }
7449
- resolvedPath = joinPaths(path8, resolvedPath);
7450
- resolvedAbsolute = isAbsolutePath(path8);
7458
+ resolvedPath = joinPaths(path7, resolvedPath);
7459
+ resolvedAbsolute = isAbsolutePath(path7);
7451
7460
  }
7452
7461
  resolvedPath = normalizeString3(resolvedPath, !resolvedAbsolute);
7453
7462
  if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {
@@ -7457,13 +7466,13 @@ function resolvePath(path7, cwd2 = getWorkspaceRoot()) {
7457
7466
  }
7458
7467
  __name(resolvePath, "resolvePath");
7459
7468
  function resolvePaths(...paths) {
7460
- return resolvePath(joinPaths(...paths.map((path7) => normalizeWindowsPath3(path7))));
7469
+ return resolvePath(joinPaths(...paths.map((path6) => normalizeWindowsPath3(path6))));
7461
7470
  }
7462
7471
  __name(resolvePaths, "resolvePaths");
7463
7472
 
7464
7473
  // ../path/src/get-parent-path.ts
7465
- var resolveParentPath = /* @__PURE__ */ __name((path7) => {
7466
- return resolvePaths(path7, "..");
7474
+ var resolveParentPath = /* @__PURE__ */ __name((path6) => {
7475
+ return resolvePaths(path6, "..");
7467
7476
  }, "resolveParentPath");
7468
7477
  var getParentPath = /* @__PURE__ */ __name((name, cwd2, options) => {
7469
7478
  const ignoreCase = options?.ignoreCase ?? true;
@@ -7960,24 +7969,6 @@ var project = new import_ts_morph.Project({
7960
7969
  }
7961
7970
  });
7962
7971
 
7963
- // src/utils/remove-dir.ts
7964
- init_cjs_shims();
7965
- var import_node_fs4 = require("node:fs");
7966
- var import_node_path4 = __toESM(require("node:path"), 1);
7967
- async function removeDir(dirPath, onlyContent) {
7968
- const dirEntries = await import_node_fs4.promises.readdir(dirPath, {
7969
- withFileTypes: true
7970
- });
7971
- await Promise.all(dirEntries.map(async (dirEntry) => {
7972
- const fullPath = import_node_path4.default.join(dirPath, dirEntry.name);
7973
- return dirEntry.isDirectory() ? removeDir(fullPath, false) : import_node_fs4.promises.unlink(fullPath);
7974
- }));
7975
- if (!onlyContent) {
7976
- await import_node_fs4.promises.rmdir(dirPath);
7977
- }
7978
- }
7979
- __name(removeDir, "removeDir");
7980
-
7981
7972
  // src/utils/write-file-safely.ts
7982
7973
  init_cjs_shims();
7983
7974
 
@@ -9166,7 +9157,7 @@ var isURL = /* @__PURE__ */ __name((payload) => payload instanceof URL, "isURL")
9166
9157
  // ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
9167
9158
  init_cjs_shims();
9168
9159
  var escapeKey = /* @__PURE__ */ __name((key) => key.replace(/\./g, "\\."), "escapeKey");
9169
- var stringifyPath = /* @__PURE__ */ __name((path7) => path7.map(String).map(escapeKey).join("."), "stringifyPath");
9160
+ var stringifyPath = /* @__PURE__ */ __name((path6) => path6.map(String).map(escapeKey).join("."), "stringifyPath");
9170
9161
  var parsePath = /* @__PURE__ */ __name((string) => {
9171
9162
  const result = [];
9172
9163
  let segment = "";
@@ -9429,27 +9420,27 @@ var getNthKey = /* @__PURE__ */ __name((value, n) => {
9429
9420
  }
9430
9421
  return keys.next().value;
9431
9422
  }, "getNthKey");
9432
- function validatePath(path7) {
9433
- if (includes(path7, "__proto__")) {
9423
+ function validatePath(path6) {
9424
+ if (includes(path6, "__proto__")) {
9434
9425
  throw new Error("__proto__ is not allowed as a property");
9435
9426
  }
9436
- if (includes(path7, "prototype")) {
9427
+ if (includes(path6, "prototype")) {
9437
9428
  throw new Error("prototype is not allowed as a property");
9438
9429
  }
9439
- if (includes(path7, "constructor")) {
9430
+ if (includes(path6, "constructor")) {
9440
9431
  throw new Error("constructor is not allowed as a property");
9441
9432
  }
9442
9433
  }
9443
9434
  __name(validatePath, "validatePath");
9444
- var getDeep = /* @__PURE__ */ __name((object, path7) => {
9445
- validatePath(path7);
9446
- for (let i = 0; i < path7.length; i++) {
9447
- const key = path7[i];
9435
+ var getDeep = /* @__PURE__ */ __name((object, path6) => {
9436
+ validatePath(path6);
9437
+ for (let i = 0; i < path6.length; i++) {
9438
+ const key = path6[i];
9448
9439
  if (isSet(object)) {
9449
9440
  object = getNthKey(object, +key);
9450
9441
  } else if (isMap(object)) {
9451
9442
  const row = +key;
9452
- const type = +path7[++i] === 0 ? "key" : "value";
9443
+ const type = +path6[++i] === 0 ? "key" : "value";
9453
9444
  const keyOfRow = getNthKey(object, row);
9454
9445
  switch (type) {
9455
9446
  case "key":
@@ -9465,14 +9456,14 @@ var getDeep = /* @__PURE__ */ __name((object, path7) => {
9465
9456
  }
9466
9457
  return object;
9467
9458
  }, "getDeep");
9468
- var setDeep = /* @__PURE__ */ __name((object, path7, mapper) => {
9469
- validatePath(path7);
9470
- if (path7.length === 0) {
9459
+ var setDeep = /* @__PURE__ */ __name((object, path6, mapper) => {
9460
+ validatePath(path6);
9461
+ if (path6.length === 0) {
9471
9462
  return mapper(object);
9472
9463
  }
9473
9464
  let parent = object;
9474
- for (let i = 0; i < path7.length - 1; i++) {
9475
- const key = path7[i];
9465
+ for (let i = 0; i < path6.length - 1; i++) {
9466
+ const key = path6[i];
9476
9467
  if (isArray(parent)) {
9477
9468
  const index = +key;
9478
9469
  parent = parent[index];
@@ -9482,12 +9473,12 @@ var setDeep = /* @__PURE__ */ __name((object, path7, mapper) => {
9482
9473
  const row = +key;
9483
9474
  parent = getNthKey(parent, row);
9484
9475
  } else if (isMap(parent)) {
9485
- const isEnd = i === path7.length - 2;
9476
+ const isEnd = i === path6.length - 2;
9486
9477
  if (isEnd) {
9487
9478
  break;
9488
9479
  }
9489
9480
  const row = +key;
9490
- const type = +path7[++i] === 0 ? "key" : "value";
9481
+ const type = +path6[++i] === 0 ? "key" : "value";
9491
9482
  const keyOfRow = getNthKey(parent, row);
9492
9483
  switch (type) {
9493
9484
  case "key":
@@ -9499,7 +9490,7 @@ var setDeep = /* @__PURE__ */ __name((object, path7, mapper) => {
9499
9490
  }
9500
9491
  }
9501
9492
  }
9502
- const lastKey = path7[path7.length - 1];
9493
+ const lastKey = path6[path6.length - 1];
9503
9494
  if (isArray(parent)) {
9504
9495
  parent[+lastKey] = mapper(parent[+lastKey]);
9505
9496
  } else if (isPlainObject2(parent)) {
@@ -9514,7 +9505,7 @@ var setDeep = /* @__PURE__ */ __name((object, path7, mapper) => {
9514
9505
  }
9515
9506
  }
9516
9507
  if (isMap(parent)) {
9517
- const row = +path7[path7.length - 2];
9508
+ const row = +path6[path6.length - 2];
9518
9509
  const keyToRow = getNthKey(parent, row);
9519
9510
  const type = +lastKey === 0 ? "key" : "value";
9520
9511
  switch (type) {
@@ -9560,15 +9551,15 @@ function traverse(tree, walker2, origin = []) {
9560
9551
  }
9561
9552
  __name(traverse, "traverse");
9562
9553
  function applyValueAnnotations(plain, annotations, superJson) {
9563
- traverse(annotations, (type, path7) => {
9564
- plain = setDeep(plain, path7, (v) => untransformValue(v, type, superJson));
9554
+ traverse(annotations, (type, path6) => {
9555
+ plain = setDeep(plain, path6, (v) => untransformValue(v, type, superJson));
9565
9556
  });
9566
9557
  return plain;
9567
9558
  }
9568
9559
  __name(applyValueAnnotations, "applyValueAnnotations");
9569
9560
  function applyReferentialEqualityAnnotations(plain, annotations) {
9570
- function apply(identicalPaths, path7) {
9571
- const object = getDeep(plain, parsePath(path7));
9561
+ function apply(identicalPaths, path6) {
9562
+ const object = getDeep(plain, parsePath(path6));
9572
9563
  identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
9573
9564
  plain = setDeep(plain, identicalObjectPath, () => object);
9574
9565
  });
@@ -9589,13 +9580,13 @@ function applyReferentialEqualityAnnotations(plain, annotations) {
9589
9580
  }
9590
9581
  __name(applyReferentialEqualityAnnotations, "applyReferentialEqualityAnnotations");
9591
9582
  var isDeep = /* @__PURE__ */ __name((object, superJson) => isPlainObject2(object) || isArray(object) || isMap(object) || isSet(object) || isInstanceOfRegisteredClass(object, superJson), "isDeep");
9592
- function addIdentity(object, path7, identities) {
9583
+ function addIdentity(object, path6, identities) {
9593
9584
  const existingSet = identities.get(object);
9594
9585
  if (existingSet) {
9595
- existingSet.push(path7);
9586
+ existingSet.push(path6);
9596
9587
  } else {
9597
9588
  identities.set(object, [
9598
- path7
9589
+ path6
9599
9590
  ]);
9600
9591
  }
9601
9592
  }
@@ -9608,7 +9599,7 @@ function generateReferentialEqualityAnnotations(identitites, dedupe) {
9608
9599
  return;
9609
9600
  }
9610
9601
  if (!dedupe) {
9611
- paths = paths.map((path7) => path7.map(String)).sort((a, b) => a.length - b.length);
9602
+ paths = paths.map((path6) => path6.map(String)).sort((a, b) => a.length - b.length);
9612
9603
  }
9613
9604
  const [representativePath, ...identicalPaths] = paths;
9614
9605
  if (representativePath.length === 0) {
@@ -9633,10 +9624,10 @@ function generateReferentialEqualityAnnotations(identitites, dedupe) {
9633
9624
  }
9634
9625
  }
9635
9626
  __name(generateReferentialEqualityAnnotations, "generateReferentialEqualityAnnotations");
9636
- var walker = /* @__PURE__ */ __name((object, identities, superJson, dedupe, path7 = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
9627
+ var walker = /* @__PURE__ */ __name((object, identities, superJson, dedupe, path6 = [], objectsInThisPath = [], seenObjects = /* @__PURE__ */ new Map()) => {
9637
9628
  const primitive = isPrimitive(object);
9638
9629
  if (!primitive) {
9639
- addIdentity(object, path7, identities);
9630
+ addIdentity(object, path6, identities);
9640
9631
  const seen = seenObjects.get(object);
9641
9632
  if (seen) {
9642
9633
  return dedupe ? {
@@ -9673,7 +9664,7 @@ var walker = /* @__PURE__ */ __name((object, identities, superJson, dedupe, path
9673
9664
  throw new Error(`Detected property ${index}. This is a prototype pollution risk, please remove it from your object.`);
9674
9665
  }
9675
9666
  const recursiveResult = walker(value, identities, superJson, dedupe, [
9676
- ...path7,
9667
+ ...path6,
9677
9668
  index
9678
9669
  ], [
9679
9670
  ...objectsInThisPath,
@@ -10253,7 +10244,7 @@ var writeFile = /* @__PURE__ */ __name(async (filePath, content, options) => {
10253
10244
  }, "writeFile");
10254
10245
 
10255
10246
  // src/utils/write-file-safely.ts
10256
- var import_node_path5 = __toESM(require("node:path"), 1);
10247
+ var import_node_path4 = __toESM(require("node:path"), 1);
10257
10248
 
10258
10249
  // src/utils/format-file.ts
10259
10250
  init_cjs_shims();
@@ -10297,7 +10288,7 @@ var writeFileSafely = /* @__PURE__ */ __name(async (writeLocation, content, addT
10297
10288
  }, "writeFileSafely");
10298
10289
  var writeIndexFile = /* @__PURE__ */ __name(async (indexPath) => {
10299
10290
  const rows = Array.from(indexExports).map((filePath) => {
10300
- let relativePath = import_node_path5.default.relative(import_node_path5.default.dirname(indexPath), filePath);
10291
+ let relativePath = import_node_path4.default.relative(import_node_path4.default.dirname(indexPath), filePath);
10301
10292
  if (relativePath.endsWith(".ts")) {
10302
10293
  relativePath = relativePath.slice(0, relativePath.lastIndexOf(".ts"));
10303
10294
  }
@@ -10474,7 +10465,7 @@ init_cjs_shims();
10474
10465
 
10475
10466
  // src/zod-helpers/transformer.ts
10476
10467
  init_cjs_shims();
10477
- var import_node_path6 = __toESM(require("node:path"), 1);
10468
+ var import_node_path5 = __toESM(require("node:path"), 1);
10478
10469
 
10479
10470
  // src/zod-helpers/model-helpers.ts
10480
10471
  init_cjs_shims();
@@ -10622,13 +10613,13 @@ var Transformer = class _Transformer {
10622
10613
  this.isCustomPrismaClientOutputPath = prismaClientCustomPath !== "@prisma/client";
10623
10614
  }
10624
10615
  static async generateIndex() {
10625
- const indexPath = import_node_path6.default.join(_Transformer.outputPath, "schemas/index.ts");
10616
+ const indexPath = import_node_path5.default.join(_Transformer.outputPath, "schemas/index.ts");
10626
10617
  await writeIndexFile(indexPath);
10627
10618
  }
10628
10619
  async generateEnumSchemas() {
10629
10620
  for (const enumType2 of this.enumTypes) {
10630
10621
  const { name, values } = enumType2;
10631
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/enums/${name}.schema.ts`), `${this.generateImportZodStatement()}
10622
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/enums/${name}.schema.ts`), `${this.generateImportZodStatement()}
10632
10623
  ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)})`)}`);
10633
10624
  }
10634
10625
  }
@@ -10642,7 +10633,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10642
10633
  const zodObjectSchemaFields = this.generateObjectSchemaFields();
10643
10634
  const objectSchema = this.prepareObjectSchema(zodObjectSchemaFields);
10644
10635
  const objectSchemaName = this.resolveObjectSchemaName();
10645
- await writeFileSafely(import_node_path6.default.join(_Transformer.outputPath, `schemas/objects/${objectSchemaName}.schema.ts`), objectSchema);
10636
+ await writeFileSafely(import_node_path5.default.join(_Transformer.outputPath, `schemas/objects/${objectSchemaName}.schema.ts`), objectSchema);
10646
10637
  }
10647
10638
  generateObjectSchemaFields() {
10648
10639
  const zodObjectSchemaFields = this.fields.map((field) => this.generateObjectSchemaField(field)).flatMap((item) => item).map((item) => {
@@ -10781,9 +10772,9 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10781
10772
  generateImportPrismaStatement() {
10782
10773
  let prismaClientImportPath;
10783
10774
  if (_Transformer.isCustomPrismaClientOutputPath) {
10784
- const fromPath = import_node_path6.default.join(_Transformer.outputPath, "schemas", "objects");
10775
+ const fromPath = import_node_path5.default.join(_Transformer.outputPath, "schemas", "objects");
10785
10776
  const toPath = _Transformer.prismaClientOutputPath;
10786
- const relativePathFromOutputToPrismaClient = import_node_path6.default.relative(fromPath, toPath).split(import_node_path6.default.sep).join(import_node_path6.default.posix.sep);
10777
+ const relativePathFromOutputToPrismaClient = import_node_path5.default.relative(fromPath, toPath).split(import_node_path5.default.sep).join(import_node_path5.default.posix.sep);
10787
10778
  prismaClientImportPath = relativePathFromOutputToPrismaClient;
10788
10779
  } else {
10789
10780
  prismaClientImportPath = _Transformer.prismaClientOutputPath;
@@ -10911,7 +10902,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10911
10902
  includeImport,
10912
10903
  `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`
10913
10904
  ];
10914
- 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 })`)}`);
10905
+ 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 })`)}`);
10915
10906
  }
10916
10907
  if (findFirst) {
10917
10908
  const imports = [
@@ -10922,7 +10913,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10922
10913
  `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`,
10923
10914
  `import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`
10924
10915
  ];
10925
- 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() })`)}`);
10916
+ 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() })`)}`);
10926
10917
  }
10927
10918
  if (findMany) {
10928
10919
  const imports = [
@@ -10933,7 +10924,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10933
10924
  `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`,
10934
10925
  `import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`
10935
10926
  ];
10936
- 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() })`)}`);
10927
+ 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() })`)}`);
10937
10928
  }
10938
10929
  if (createOne) {
10939
10930
  const imports = [
@@ -10942,13 +10933,13 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10942
10933
  `import { ${modelName}CreateInputObjectSchema } from './objects/${modelName}CreateInput.schema'`,
10943
10934
  `import { ${modelName}UncheckedCreateInputObjectSchema } from './objects/${modelName}UncheckedCreateInput.schema'`
10944
10935
  ];
10945
- 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]) })`)}`);
10936
+ 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]) })`)}`);
10946
10937
  }
10947
10938
  if (createMany) {
10948
10939
  const imports = [
10949
10940
  `import { ${modelName}CreateManyInputObjectSchema } from './objects/${modelName}CreateManyInput.schema'`
10950
10941
  ];
10951
- 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()"} })`)}`);
10942
+ 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()"} })`)}`);
10952
10943
  }
10953
10944
  if (deleteOne) {
10954
10945
  const imports = [
@@ -10956,13 +10947,13 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10956
10947
  includeImport,
10957
10948
  `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`
10958
10949
  ];
10959
- 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 })`)}`);
10950
+ 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 })`)}`);
10960
10951
  }
10961
10952
  if (deleteMany) {
10962
10953
  const imports = [
10963
10954
  `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`
10964
10955
  ];
10965
- 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() })`)}`);
10956
+ 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() })`)}`);
10966
10957
  }
10967
10958
  if (updateOne) {
10968
10959
  const imports = [
@@ -10972,14 +10963,14 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10972
10963
  `import { ${modelName}UncheckedUpdateInputObjectSchema } from './objects/${modelName}UncheckedUpdateInput.schema'`,
10973
10964
  `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`
10974
10965
  ];
10975
- 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 })`)}`);
10966
+ 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 })`)}`);
10976
10967
  }
10977
10968
  if (updateMany) {
10978
10969
  const imports = [
10979
10970
  `import { ${modelName}UpdateManyMutationInputObjectSchema } from './objects/${modelName}UpdateManyMutationInput.schema'`,
10980
10971
  `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`
10981
10972
  ];
10982
- 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() })`)}`);
10973
+ 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() })`)}`);
10983
10974
  }
10984
10975
  if (upsertOne) {
10985
10976
  const imports = [
@@ -10991,7 +10982,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
10991
10982
  `import { ${modelName}UpdateInputObjectSchema } from './objects/${modelName}UpdateInput.schema'`,
10992
10983
  `import { ${modelName}UncheckedUpdateInputObjectSchema } from './objects/${modelName}UncheckedUpdateInput.schema'`
10993
10984
  ];
10994
- 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 ]) })`)}`);
10985
+ 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 ]) })`)}`);
10995
10986
  }
10996
10987
  if (aggregate) {
10997
10988
  const imports = [
@@ -11022,7 +11013,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
11022
11013
  aggregateOperations.push(`_sum: ${modelName}SumAggregateInputObjectSchema.optional()`);
11023
11014
  }
11024
11015
  }
11025
- 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(", ")} })`)}`);
11016
+ 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(", ")} })`)}`);
11026
11017
  }
11027
11018
  if (groupBy) {
11028
11019
  const imports = [
@@ -11031,7 +11022,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
11031
11022
  `import { ${modelName}ScalarWhereWithAggregatesInputObjectSchema } from './objects/${modelName}ScalarWhereWithAggregatesInput.schema'`,
11032
11023
  `import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`
11033
11024
  ];
11034
- 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) })`)}`);
11025
+ 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) })`)}`);
11035
11026
  }
11036
11027
  }
11037
11028
  }
@@ -11482,8 +11473,8 @@ async function generate(options) {
11482
11473
  }
11483
11474
  }, "consoleLog");
11484
11475
  consoleLog(`Preparing output directory: ${outputDir}`);
11476
+ await removeDirectory(outputDir);
11485
11477
  await createDirectory(outputDir);
11486
- await removeDir(outputDir, true);
11487
11478
  consoleLog("Finding Prisma Client generator");
11488
11479
  const prismaClientProvider = options.otherGenerators.find((it) => internals.parseEnvValue(it.provider) === "prisma-client-js");
11489
11480
  if (!prismaClientProvider) {
@@ -11535,7 +11526,6 @@ async function generate(options) {
11535
11526
  const shieldOutputDir = joinPaths(outputDir, "shield");
11536
11527
  consoleLog("Preparing tRPC Shield output directory");
11537
11528
  await createDirectory(shieldOutputDir);
11538
- await removeDir(shieldOutputDir, true);
11539
11529
  const queries = [];
11540
11530
  const mutations = [];
11541
11531
  const subscriptions = [];
@@ -11593,7 +11583,7 @@ async function generate(options) {
11593
11583
  }
11594
11584
  consoleLog(`Generating tRPC source code for ${models.length} models`);
11595
11585
  resolveModelsComments(models, hiddenModels);
11596
- const createRouter = project.createSourceFile(import_node_path7.default.resolve(outputDir, "routers", "helpers", "createRouter.ts"), void 0, {
11586
+ const createRouter = project.createSourceFile(import_node_path6.default.resolve(outputDir, "routers", "helpers", "createRouter.ts"), void 0, {
11597
11587
  overwrite: true
11598
11588
  });
11599
11589
  consoleLog("Generating tRPC imports");
@@ -11606,7 +11596,7 @@ async function generate(options) {
11606
11596
  createRouter.formatText({
11607
11597
  indentSize: 2
11608
11598
  });
11609
- const appRouter = project.createSourceFile(import_node_path7.default.resolve(outputDir, "routers", `index.ts`), void 0, {
11599
+ const appRouter = project.createSourceFile(import_node_path6.default.resolve(outputDir, "routers", `index.ts`), void 0, {
11610
11600
  overwrite: true
11611
11601
  });
11612
11602
  consoleLog("Generating tRPC router imports");
@@ -11628,7 +11618,7 @@ async function generate(options) {
11628
11618
  const plural = (0, import_pluralize.default)(model.toLowerCase());
11629
11619
  consoleLog(`Generating tRPC router for model ${model}`);
11630
11620
  generateRouterImport(appRouter, plural, model);
11631
- const modelRouter = project.createSourceFile(import_node_path7.default.resolve(outputDir, "routers", `${model}.router.ts`), void 0, {
11621
+ const modelRouter = project.createSourceFile(import_node_path6.default.resolve(outputDir, "routers", `${model}.router.ts`), void 0, {
11632
11622
  overwrite: true
11633
11623
  });
11634
11624
  generateCreateRouterImport({