@stryke/prisma-trpc-generator 0.2.14 → 0.2.16

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.js CHANGED
@@ -679,7 +679,7 @@ init_esm_shims();
679
679
  init_esm_shims();
680
680
  var import_pluralize = __toESM(require_pluralize(), 1);
681
681
  import { promises as fs4 } from "node:fs";
682
- import path5 from "node:path";
682
+ import path6 from "node:path";
683
683
 
684
684
  // src/config.ts
685
685
  init_esm_shims();
@@ -1046,8 +1046,8 @@ function getErrorMap() {
1046
1046
  }
1047
1047
  __name(getErrorMap, "getErrorMap");
1048
1048
  var makeIssue = /* @__PURE__ */ __name((params) => {
1049
- const { data, path: path6, errorMaps, issueData } = params;
1050
- const fullPath = [...path6, ...issueData.path || []];
1049
+ const { data, path: path7, errorMaps, issueData } = params;
1050
+ const fullPath = [...path7, ...issueData.path || []];
1051
1051
  const fullIssue = {
1052
1052
  ...issueData,
1053
1053
  path: fullPath
@@ -1181,11 +1181,11 @@ var ParseInputLazyPath = class {
1181
1181
  static {
1182
1182
  __name(this, "ParseInputLazyPath");
1183
1183
  }
1184
- constructor(parent, value, path6, key) {
1184
+ constructor(parent, value, path7, key) {
1185
1185
  this._cachedPath = [];
1186
1186
  this.parent = parent;
1187
1187
  this.data = value;
1188
- this._path = path6;
1188
+ this._path = path7;
1189
1189
  this._key = key;
1190
1190
  }
1191
1191
  get path() {
@@ -4946,8 +4946,735 @@ init_esm_shims();
4946
4946
 
4947
4947
  // src/utils/get-jiti.ts
4948
4948
  init_esm_shims();
4949
- import { getEnvPaths } from "@stryke/env";
4950
- import { getWorkspaceRoot, joinPaths } from "@stryke/path";
4949
+
4950
+ // ../env/src/get-env-paths.ts
4951
+ init_esm_shims();
4952
+
4953
+ // ../path/src/join-paths.ts
4954
+ init_esm_shims();
4955
+ var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
4956
+ function normalizeWindowsPath(input = "") {
4957
+ if (!input) {
4958
+ return input;
4959
+ }
4960
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
4961
+ }
4962
+ __name(normalizeWindowsPath, "normalizeWindowsPath");
4963
+ var _UNC_REGEX = /^[/\\]{2}/;
4964
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i;
4965
+ var _DRIVE_LETTER_RE = /^[A-Z]:$/i;
4966
+ var isAbsolute = /* @__PURE__ */ __name(function(p) {
4967
+ return _IS_ABSOLUTE_RE.test(p);
4968
+ }, "isAbsolute");
4969
+ var correctPaths = /* @__PURE__ */ __name(function(path7) {
4970
+ if (!path7 || path7.length === 0) {
4971
+ return ".";
4972
+ }
4973
+ path7 = normalizeWindowsPath(path7);
4974
+ const isUNCPath = path7.match(_UNC_REGEX);
4975
+ const isPathAbsolute = isAbsolute(path7);
4976
+ const trailingSeparator = path7[path7.length - 1] === "/";
4977
+ path7 = normalizeString(path7, !isPathAbsolute);
4978
+ if (path7.length === 0) {
4979
+ if (isPathAbsolute) {
4980
+ return "/";
4981
+ }
4982
+ return trailingSeparator ? "./" : ".";
4983
+ }
4984
+ if (trailingSeparator) {
4985
+ path7 += "/";
4986
+ }
4987
+ if (_DRIVE_LETTER_RE.test(path7)) {
4988
+ path7 += "/";
4989
+ }
4990
+ if (isUNCPath) {
4991
+ if (!isPathAbsolute) {
4992
+ return `//./${path7}`;
4993
+ }
4994
+ return `//${path7}`;
4995
+ }
4996
+ return isPathAbsolute && !isAbsolute(path7) ? `/${path7}` : path7;
4997
+ }, "correctPaths");
4998
+ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
4999
+ let path7 = "";
5000
+ for (const seg of segments) {
5001
+ if (!seg) {
5002
+ continue;
5003
+ }
5004
+ if (path7.length > 0) {
5005
+ const pathTrailing = path7[path7.length - 1] === "/";
5006
+ const segLeading = seg[0] === "/";
5007
+ const both = pathTrailing && segLeading;
5008
+ if (both) {
5009
+ path7 += seg.slice(1);
5010
+ } else {
5011
+ path7 += pathTrailing || segLeading ? seg : `/${seg}`;
5012
+ }
5013
+ } else {
5014
+ path7 += seg;
5015
+ }
5016
+ }
5017
+ return correctPaths(path7);
5018
+ }, "joinPaths");
5019
+ function normalizeString(path7, allowAboveRoot) {
5020
+ let res = "";
5021
+ let lastSegmentLength = 0;
5022
+ let lastSlash = -1;
5023
+ let dots = 0;
5024
+ let char = null;
5025
+ for (let index = 0; index <= path7.length; ++index) {
5026
+ if (index < path7.length) {
5027
+ char = path7[index];
5028
+ } else if (char === "/") {
5029
+ break;
5030
+ } else {
5031
+ char = "/";
5032
+ }
5033
+ if (char === "/") {
5034
+ if (lastSlash === index - 1 || dots === 1) {
5035
+ } else if (dots === 2) {
5036
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
5037
+ if (res.length > 2) {
5038
+ const lastSlashIndex = res.lastIndexOf("/");
5039
+ if (lastSlashIndex === -1) {
5040
+ res = "";
5041
+ lastSegmentLength = 0;
5042
+ } else {
5043
+ res = res.slice(0, lastSlashIndex);
5044
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
5045
+ }
5046
+ lastSlash = index;
5047
+ dots = 0;
5048
+ continue;
5049
+ } else if (res.length > 0) {
5050
+ res = "";
5051
+ lastSegmentLength = 0;
5052
+ lastSlash = index;
5053
+ dots = 0;
5054
+ continue;
5055
+ }
5056
+ }
5057
+ if (allowAboveRoot) {
5058
+ res += res.length > 0 ? "/.." : "..";
5059
+ lastSegmentLength = 2;
5060
+ }
5061
+ } else {
5062
+ if (res.length > 0) {
5063
+ res += `/${path7.slice(lastSlash + 1, index)}`;
5064
+ } else {
5065
+ res = path7.slice(lastSlash + 1, index);
5066
+ }
5067
+ lastSegmentLength = index - lastSlash - 1;
5068
+ }
5069
+ lastSlash = index;
5070
+ dots = 0;
5071
+ } else if (char === "." && dots !== -1) {
5072
+ ++dots;
5073
+ } else {
5074
+ dots = -1;
5075
+ }
5076
+ }
5077
+ return res;
5078
+ }
5079
+ __name(normalizeString, "normalizeString");
5080
+
5081
+ // ../string-format/src/title-case.ts
5082
+ init_esm_shims();
5083
+
5084
+ // ../string-format/src/acronyms.ts
5085
+ init_esm_shims();
5086
+ var ACRONYMS = [
5087
+ "API",
5088
+ "CPU",
5089
+ "CSS",
5090
+ "DNS",
5091
+ "EOF",
5092
+ "GUID",
5093
+ "HTML",
5094
+ "HTTP",
5095
+ "HTTPS",
5096
+ "ID",
5097
+ "IP",
5098
+ "JSON",
5099
+ "LHS",
5100
+ "OEM",
5101
+ "PP",
5102
+ "QA",
5103
+ "RAM",
5104
+ "RHS",
5105
+ "RPC",
5106
+ "RSS",
5107
+ "SLA",
5108
+ "SMTP",
5109
+ "SQL",
5110
+ "SSH",
5111
+ "SSL",
5112
+ "TCP",
5113
+ "TLS",
5114
+ "TRPC",
5115
+ "TTL",
5116
+ "UDP",
5117
+ "UI",
5118
+ "UID",
5119
+ "UUID",
5120
+ "URI",
5121
+ "URL",
5122
+ "UTF",
5123
+ "VM",
5124
+ "XML",
5125
+ "XSS",
5126
+ "XSRF"
5127
+ ];
5128
+
5129
+ // ../string-format/src/upper-case-first.ts
5130
+ init_esm_shims();
5131
+ var upperCaseFirst = /* @__PURE__ */ __name((input) => {
5132
+ return input ? input.charAt(0).toUpperCase() + input.slice(1) : input;
5133
+ }, "upperCaseFirst");
5134
+
5135
+ // ../string-format/src/title-case.ts
5136
+ var titleCase = /* @__PURE__ */ __name((input) => {
5137
+ if (!input) {
5138
+ return "";
5139
+ }
5140
+ return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
5141
+ }, "titleCase");
5142
+
5143
+ // ../type-checks/src/is-string.ts
5144
+ init_esm_shims();
5145
+ var isString = /* @__PURE__ */ __name((value) => {
5146
+ try {
5147
+ return typeof value === "string";
5148
+ } catch {
5149
+ return false;
5150
+ }
5151
+ }, "isString");
5152
+
5153
+ // ../env/src/get-env-paths.ts
5154
+ import os from "node:os";
5155
+ import path from "node:path";
5156
+ var homedir = os.homedir();
5157
+ var tmpdir = os.tmpdir();
5158
+ var macos = /* @__PURE__ */ __name((orgId) => {
5159
+ const library = joinPaths(homedir, "Library");
5160
+ return {
5161
+ data: joinPaths(library, "Application Support", orgId),
5162
+ config: joinPaths(library, "Preferences", orgId),
5163
+ cache: joinPaths(library, "Caches", orgId),
5164
+ log: joinPaths(library, "Logs", orgId),
5165
+ temp: joinPaths(tmpdir, orgId)
5166
+ };
5167
+ }, "macos");
5168
+ var windows = /* @__PURE__ */ __name((orgId) => {
5169
+ const appData = process.env.APPDATA || joinPaths(homedir, "AppData", "Roaming");
5170
+ const localAppData = process.env.LOCALAPPDATA || joinPaths(homedir, "AppData", "Local");
5171
+ const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\s+/g, "");
5172
+ return {
5173
+ // Data/config/cache/log are invented by me as Windows isn't opinionated about this
5174
+ data: joinPaths(localAppData, windowsFormattedOrgId, "Data"),
5175
+ config: joinPaths(appData, windowsFormattedOrgId, "Config"),
5176
+ cache: joinPaths(localAppData, "Cache", orgId),
5177
+ log: joinPaths(localAppData, windowsFormattedOrgId, "Log"),
5178
+ temp: joinPaths(tmpdir, orgId)
5179
+ };
5180
+ }, "windows");
5181
+ var linux = /* @__PURE__ */ __name((orgId) => {
5182
+ const username = path.basename(homedir);
5183
+ return {
5184
+ data: joinPaths(process.env.XDG_DATA_HOME || joinPaths(homedir, ".local", "share"), orgId),
5185
+ config: joinPaths(process.env.XDG_CONFIG_HOME || joinPaths(homedir, ".config"), orgId),
5186
+ cache: joinPaths(process.env.XDG_CACHE_HOME || joinPaths(homedir, ".cache"), orgId),
5187
+ // https://wiki.debian.org/XDGBaseDirectorySpecification#state
5188
+ log: joinPaths(process.env.XDG_STATE_HOME || joinPaths(homedir, ".local", "state"), orgId),
5189
+ temp: joinPaths(tmpdir, username, orgId)
5190
+ };
5191
+ }, "linux");
5192
+ function getEnvPaths(options = {}) {
5193
+ let orgId = options.orgId || "storm-software";
5194
+ if (!orgId) {
5195
+ throw new Error("You need to provide an orgId to the `getEnvPaths` function");
5196
+ }
5197
+ if (options.suffix) {
5198
+ orgId += `-${isString(options.suffix) ? options.suffix : "nodejs"}`;
5199
+ }
5200
+ let result = {};
5201
+ if (process.platform === "darwin") {
5202
+ result = macos(orgId);
5203
+ } else if (process.platform === "win32") {
5204
+ result = windows(orgId);
5205
+ } else {
5206
+ result = linux(orgId);
5207
+ }
5208
+ if (process.env.STORM_DATA_DIRECTORY) {
5209
+ result.data = process.env.STORM_DATA_DIRECTORY;
5210
+ } else if (process.env.STORM_CONFIG_DIRECTORY) {
5211
+ result.config = process.env.STORM_CONFIG_DIRECTORY;
5212
+ } else if (process.env.STORM_CACHE_DIRECTORY) {
5213
+ result.cache = process.env.STORM_CACHE_DIRECTORY;
5214
+ } else if (process.env.STORM_LOG_DIRECTORY) {
5215
+ result.log = process.env.STORM_LOG_DIRECTORY;
5216
+ } else if (process.env.STORM_TEMP_DIRECTORY) {
5217
+ result.temp = process.env.STORM_TEMP_DIRECTORY;
5218
+ }
5219
+ if (options.workspaceRoot) {
5220
+ result.cache ??= joinPaths(options.workspaceRoot, "node_modules", ".cache", orgId);
5221
+ result.temp ??= joinPaths(options.workspaceRoot, "tmp", orgId);
5222
+ result.log ??= joinPaths(result.temp, "logs");
5223
+ result.config ??= joinPaths(options.workspaceRoot, ".config", orgId);
5224
+ }
5225
+ return Object.keys(result).reduce((ret, key) => {
5226
+ if (result[key]) {
5227
+ const filePath = result[key];
5228
+ ret[key] = options.appId && options.appId !== options.orgId && options.appId !== options.nestedDir ? joinPaths(filePath, options.appId) : filePath;
5229
+ if (options.nestedDir && options.nestedDir !== options.orgId && options.nestedDir !== options.appId) {
5230
+ ret[key] = joinPaths(ret[key], options.nestedDir);
5231
+ }
5232
+ }
5233
+ return ret;
5234
+ }, {});
5235
+ }
5236
+ __name(getEnvPaths, "getEnvPaths");
5237
+
5238
+ // ../path/src/get-workspace-root.ts
5239
+ init_esm_shims();
5240
+
5241
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/index.js
5242
+ init_esm_shims();
5243
+
5244
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
5245
+ init_esm_shims();
5246
+
5247
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
5248
+ init_esm_shims();
5249
+
5250
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
5251
+ init_esm_shims();
5252
+ var __defProp2 = Object.defineProperty;
5253
+ var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
5254
+ value,
5255
+ configurable: true
5256
+ }), "__name");
5257
+
5258
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
5259
+ import { existsSync } from "node:fs";
5260
+ import { join } from "node:path";
5261
+ var MAX_PATH_SEARCH_DEPTH = 30;
5262
+ var depth = 0;
5263
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
5264
+ const _startPath = startPath ?? process.cwd();
5265
+ if (endDirectoryNames.some((endDirName) => existsSync(join(_startPath, endDirName)))) {
5266
+ return _startPath;
5267
+ }
5268
+ if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
5269
+ return _startPath;
5270
+ }
5271
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
5272
+ const parent = join(_startPath, "..");
5273
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
5274
+ }
5275
+ return void 0;
5276
+ }
5277
+ __name(findFolderUp, "findFolderUp");
5278
+ __name2(findFolderUp, "findFolderUp");
5279
+
5280
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
5281
+ init_esm_shims();
5282
+ var _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
5283
+ function normalizeWindowsPath2(input = "") {
5284
+ if (!input) {
5285
+ return input;
5286
+ }
5287
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
5288
+ }
5289
+ __name(normalizeWindowsPath2, "normalizeWindowsPath");
5290
+ __name2(normalizeWindowsPath2, "normalizeWindowsPath");
5291
+ var _UNC_REGEX2 = /^[/\\]{2}/;
5292
+ var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
5293
+ var _DRIVE_LETTER_RE2 = /^[A-Za-z]:$/;
5294
+ var correctPaths2 = /* @__PURE__ */ __name2(function(path7) {
5295
+ if (!path7 || path7.length === 0) {
5296
+ return ".";
5297
+ }
5298
+ path7 = normalizeWindowsPath2(path7);
5299
+ const isUNCPath = path7.match(_UNC_REGEX2);
5300
+ const isPathAbsolute = isAbsolute2(path7);
5301
+ const trailingSeparator = path7[path7.length - 1] === "/";
5302
+ path7 = normalizeString2(path7, !isPathAbsolute);
5303
+ if (path7.length === 0) {
5304
+ if (isPathAbsolute) {
5305
+ return "/";
5306
+ }
5307
+ return trailingSeparator ? "./" : ".";
5308
+ }
5309
+ if (trailingSeparator) {
5310
+ path7 += "/";
5311
+ }
5312
+ if (_DRIVE_LETTER_RE2.test(path7)) {
5313
+ path7 += "/";
5314
+ }
5315
+ if (isUNCPath) {
5316
+ if (!isPathAbsolute) {
5317
+ return `//./${path7}`;
5318
+ }
5319
+ return `//${path7}`;
5320
+ }
5321
+ return isPathAbsolute && !isAbsolute2(path7) ? `/${path7}` : path7;
5322
+ }, "correctPaths");
5323
+ function cwd() {
5324
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
5325
+ return process.cwd().replace(/\\/g, "/");
5326
+ }
5327
+ return "/";
5328
+ }
5329
+ __name(cwd, "cwd");
5330
+ __name2(cwd, "cwd");
5331
+ function normalizeString2(path7, allowAboveRoot) {
5332
+ let res = "";
5333
+ let lastSegmentLength = 0;
5334
+ let lastSlash = -1;
5335
+ let dots = 0;
5336
+ let char = null;
5337
+ for (let index = 0; index <= path7.length; ++index) {
5338
+ if (index < path7.length) {
5339
+ char = path7[index];
5340
+ } else if (char === "/") {
5341
+ break;
5342
+ } else {
5343
+ char = "/";
5344
+ }
5345
+ if (char === "/") {
5346
+ if (lastSlash === index - 1 || dots === 1) {
5347
+ } else if (dots === 2) {
5348
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
5349
+ if (res.length > 2) {
5350
+ const lastSlashIndex = res.lastIndexOf("/");
5351
+ if (lastSlashIndex === -1) {
5352
+ res = "";
5353
+ lastSegmentLength = 0;
5354
+ } else {
5355
+ res = res.slice(0, lastSlashIndex);
5356
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
5357
+ }
5358
+ lastSlash = index;
5359
+ dots = 0;
5360
+ continue;
5361
+ } else if (res.length > 0) {
5362
+ res = "";
5363
+ lastSegmentLength = 0;
5364
+ lastSlash = index;
5365
+ dots = 0;
5366
+ continue;
5367
+ }
5368
+ }
5369
+ if (allowAboveRoot) {
5370
+ res += res.length > 0 ? "/.." : "..";
5371
+ lastSegmentLength = 2;
5372
+ }
5373
+ } else {
5374
+ if (res.length > 0) {
5375
+ res += `/${path7.slice(lastSlash + 1, index)}`;
5376
+ } else {
5377
+ res = path7.slice(lastSlash + 1, index);
5378
+ }
5379
+ lastSegmentLength = index - lastSlash - 1;
5380
+ }
5381
+ lastSlash = index;
5382
+ dots = 0;
5383
+ } else if (char === "." && dots !== -1) {
5384
+ ++dots;
5385
+ } else {
5386
+ dots = -1;
5387
+ }
5388
+ }
5389
+ return res;
5390
+ }
5391
+ __name(normalizeString2, "normalizeString");
5392
+ __name2(normalizeString2, "normalizeString");
5393
+ var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
5394
+ return _IS_ABSOLUTE_RE2.test(p);
5395
+ }, "isAbsolute");
5396
+
5397
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
5398
+ var rootFiles = [
5399
+ "storm-workspace.json",
5400
+ "storm-workspace.json",
5401
+ "storm-workspace.yaml",
5402
+ "storm-workspace.yml",
5403
+ "storm-workspace.js",
5404
+ "storm-workspace.ts",
5405
+ ".storm-workspace.json",
5406
+ ".storm-workspace.yaml",
5407
+ ".storm-workspace.yml",
5408
+ ".storm-workspace.js",
5409
+ ".storm-workspace.ts",
5410
+ "lerna.json",
5411
+ "nx.json",
5412
+ "turbo.json",
5413
+ "npm-workspace.json",
5414
+ "yarn-workspace.json",
5415
+ "pnpm-workspace.json",
5416
+ "npm-workspace.yaml",
5417
+ "yarn-workspace.yaml",
5418
+ "pnpm-workspace.yaml",
5419
+ "npm-workspace.yml",
5420
+ "yarn-workspace.yml",
5421
+ "pnpm-workspace.yml",
5422
+ "npm-lock.json",
5423
+ "yarn-lock.json",
5424
+ "pnpm-lock.json",
5425
+ "npm-lock.yaml",
5426
+ "yarn-lock.yaml",
5427
+ "pnpm-lock.yaml",
5428
+ "npm-lock.yml",
5429
+ "yarn-lock.yml",
5430
+ "pnpm-lock.yml",
5431
+ "bun.lockb"
5432
+ ];
5433
+ var rootDirectories = [
5434
+ ".storm-workspace",
5435
+ ".nx",
5436
+ ".github",
5437
+ ".vscode",
5438
+ ".verdaccio"
5439
+ ];
5440
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
5441
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
5442
+ return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
5443
+ }
5444
+ return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
5445
+ }
5446
+ __name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
5447
+ __name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
5448
+ function findWorkspaceRoot(pathInsideMonorepo) {
5449
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
5450
+ if (!result) {
5451
+ throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
5452
+ ${rootFiles.join("\n")}
5453
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
5454
+ }
5455
+ return result;
5456
+ }
5457
+ __name(findWorkspaceRoot, "findWorkspaceRoot");
5458
+ __name2(findWorkspaceRoot, "findWorkspaceRoot");
5459
+
5460
+ // ../path/src/get-parent-path.ts
5461
+ init_esm_shims();
5462
+
5463
+ // ../path/src/file-path-fns.ts
5464
+ init_esm_shims();
5465
+
5466
+ // ../types/src/base.ts
5467
+ init_esm_shims();
5468
+ var $NestedValue = Symbol("NestedValue");
5469
+
5470
+ // ../path/src/correct-path.ts
5471
+ init_esm_shims();
5472
+
5473
+ // ../path/src/is-file.ts
5474
+ init_esm_shims();
5475
+ import { lstatSync, statSync } from "node:fs";
5476
+ function isFile(path7, additionalPath) {
5477
+ return Boolean(statSync(additionalPath ? joinPaths(additionalPath, path7) : path7, {
5478
+ throwIfNoEntry: false
5479
+ })?.isFile());
5480
+ }
5481
+ __name(isFile, "isFile");
5482
+ function isDirectory(path7, additionalPath) {
5483
+ return Boolean(statSync(additionalPath ? joinPaths(additionalPath, path7) : path7, {
5484
+ throwIfNoEntry: false
5485
+ })?.isDirectory());
5486
+ }
5487
+ __name(isDirectory, "isDirectory");
5488
+ function isAbsolutePath(path7) {
5489
+ return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path7);
5490
+ }
5491
+ __name(isAbsolutePath, "isAbsolutePath");
5492
+
5493
+ // ../path/src/correct-path.ts
5494
+ var _DRIVE_LETTER_START_RE3 = /^[A-Z]:\//i;
5495
+ function normalizeWindowsPath3(input = "") {
5496
+ if (!input) {
5497
+ return input;
5498
+ }
5499
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE3, (r) => r.toUpperCase());
5500
+ }
5501
+ __name(normalizeWindowsPath3, "normalizeWindowsPath");
5502
+ function normalizeString3(path7, allowAboveRoot) {
5503
+ let res = "";
5504
+ let lastSegmentLength = 0;
5505
+ let lastSlash = -1;
5506
+ let dots = 0;
5507
+ let char = null;
5508
+ for (let index = 0; index <= path7.length; ++index) {
5509
+ if (index < path7.length) {
5510
+ char = path7[index];
5511
+ } else if (char === "/") {
5512
+ break;
5513
+ } else {
5514
+ char = "/";
5515
+ }
5516
+ if (char === "/") {
5517
+ if (lastSlash === index - 1 || dots === 1) {
5518
+ } else if (dots === 2) {
5519
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
5520
+ if (res.length > 2) {
5521
+ const lastSlashIndex = res.lastIndexOf("/");
5522
+ if (lastSlashIndex === -1) {
5523
+ res = "";
5524
+ lastSegmentLength = 0;
5525
+ } else {
5526
+ res = res.slice(0, lastSlashIndex);
5527
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
5528
+ }
5529
+ lastSlash = index;
5530
+ dots = 0;
5531
+ continue;
5532
+ } else if (res.length > 0) {
5533
+ res = "";
5534
+ lastSegmentLength = 0;
5535
+ lastSlash = index;
5536
+ dots = 0;
5537
+ continue;
5538
+ }
5539
+ }
5540
+ if (allowAboveRoot) {
5541
+ res += res.length > 0 ? "/.." : "..";
5542
+ lastSegmentLength = 2;
5543
+ }
5544
+ } else {
5545
+ if (res.length > 0) {
5546
+ res += `/${path7.slice(lastSlash + 1, index)}`;
5547
+ } else {
5548
+ res = path7.slice(lastSlash + 1, index);
5549
+ }
5550
+ lastSegmentLength = index - lastSlash - 1;
5551
+ }
5552
+ lastSlash = index;
5553
+ dots = 0;
5554
+ } else if (char === "." && dots !== -1) {
5555
+ ++dots;
5556
+ } else {
5557
+ dots = -1;
5558
+ }
5559
+ }
5560
+ return res;
5561
+ }
5562
+ __name(normalizeString3, "normalizeString");
5563
+
5564
+ // ../path/src/file-path-fns.ts
5565
+ function resolvePath(path7, cwd2 = getWorkspaceRoot()) {
5566
+ const paths = normalizeWindowsPath3(path7).split("/");
5567
+ let resolvedPath = "";
5568
+ let resolvedAbsolute = false;
5569
+ for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
5570
+ const path8 = index >= 0 ? paths[index] : cwd2;
5571
+ if (!path8 || path8.length === 0) {
5572
+ continue;
5573
+ }
5574
+ resolvedPath = joinPaths(path8, resolvedPath);
5575
+ resolvedAbsolute = isAbsolutePath(path8);
5576
+ }
5577
+ resolvedPath = normalizeString3(resolvedPath, !resolvedAbsolute);
5578
+ if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {
5579
+ return `/${resolvedPath}`;
5580
+ }
5581
+ return resolvedPath.length > 0 ? resolvedPath : ".";
5582
+ }
5583
+ __name(resolvePath, "resolvePath");
5584
+ function resolvePaths(...paths) {
5585
+ return resolvePath(joinPaths(...paths.map((path7) => normalizeWindowsPath3(path7))));
5586
+ }
5587
+ __name(resolvePaths, "resolvePaths");
5588
+
5589
+ // ../path/src/get-parent-path.ts
5590
+ var resolveParentPath = /* @__PURE__ */ __name((path7) => {
5591
+ return resolvePaths(path7, "..");
5592
+ }, "resolveParentPath");
5593
+ var getParentPath = /* @__PURE__ */ __name((name, cwd2, options) => {
5594
+ const ignoreCase = options?.ignoreCase ?? true;
5595
+ const skipCwd = options?.skipCwd ?? false;
5596
+ const targetType = options?.targetType ?? "both";
5597
+ let dir = cwd2;
5598
+ if (skipCwd) {
5599
+ dir = resolveParentPath(cwd2);
5600
+ }
5601
+ let names = Array.isArray(name) ? name : [
5602
+ name
5603
+ ];
5604
+ if (ignoreCase) {
5605
+ names = names.map((name2) => name2.toLowerCase());
5606
+ }
5607
+ while (true) {
5608
+ const target = names.find((name2) => isFile(joinPaths(dir, name2)) && (targetType === "file" || targetType === "both") || isDirectory(joinPaths(dir, name2)) && (targetType === "directory" || targetType === "both"));
5609
+ if (target) {
5610
+ return joinPaths(dir, target);
5611
+ }
5612
+ const parentDir = resolveParentPath(dir);
5613
+ if (parentDir === dir) {
5614
+ return void 0;
5615
+ }
5616
+ dir = parentDir;
5617
+ }
5618
+ }, "getParentPath");
5619
+
5620
+ // ../path/src/is-root-dir.ts
5621
+ init_esm_shims();
5622
+ var isSystemRoot = /* @__PURE__ */ __name((dir) => {
5623
+ return Boolean(dir === "/" || dir === "c:\\" || dir === "C:\\");
5624
+ }, "isSystemRoot");
5625
+
5626
+ // ../path/src/get-workspace-root.ts
5627
+ var getWorkspaceRoot = /* @__PURE__ */ __name((dir = process.cwd()) => {
5628
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
5629
+ return process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
5630
+ }
5631
+ const root = findWorkspaceRootSafe(dir);
5632
+ if (root) {
5633
+ return root;
5634
+ }
5635
+ let result = getParentPath([
5636
+ "package-lock.json",
5637
+ "yarn.lock",
5638
+ "pnpm-lock.yaml",
5639
+ "bun.lock",
5640
+ "nx.json",
5641
+ "knip.json",
5642
+ "pnpm-workspace.yaml",
5643
+ "LICENSE",
5644
+ ".all-contributorsrc",
5645
+ ".whitesource",
5646
+ "syncpack.config.js",
5647
+ "syncpack.json",
5648
+ "socket.yaml",
5649
+ "lefthook.yaml",
5650
+ ".npmrc",
5651
+ ".log4brains.yml",
5652
+ ".huskyrc",
5653
+ ".husky",
5654
+ ".lintstagedrc",
5655
+ ".commitlintrc",
5656
+ "lefthook.yml",
5657
+ ".github",
5658
+ ".nx",
5659
+ ".vscode",
5660
+ "patches"
5661
+ ], dir);
5662
+ if (result) {
5663
+ return result;
5664
+ }
5665
+ result = dir;
5666
+ while (result && !isSystemRoot(result)) {
5667
+ result = getParentPath("storm.json", result, {
5668
+ skipCwd: true
5669
+ });
5670
+ if (result) {
5671
+ return result;
5672
+ }
5673
+ }
5674
+ return dir;
5675
+ }, "getWorkspaceRoot");
5676
+
5677
+ // src/utils/get-jiti.ts
4951
5678
  import { createJiti } from "jiti";
4952
5679
  var jiti;
4953
5680
  function getJiti() {
@@ -4974,16 +5701,16 @@ __name(getPrismaGeneratorHelper, "getPrismaGeneratorHelper");
4974
5701
 
4975
5702
  // src/utils/get-relative-path.ts
4976
5703
  init_esm_shims();
4977
- import path from "node:path";
5704
+ import path2 from "node:path";
4978
5705
  function getRelativePath(outputPath, filePath, isOutsideOutputPath, schemaPath) {
4979
- const fromPath = path.join(outputPath, "routers", "helpers");
4980
- let toPath = path.join(outputPath, filePath);
5706
+ const fromPath = path2.join(outputPath, "routers", "helpers");
5707
+ let toPath = path2.join(outputPath, filePath);
4981
5708
  if (isOutsideOutputPath) {
4982
- const schemaPathSplit = schemaPath?.split(path.sep);
4983
- const schemaPathWithoutFileAndExtension = schemaPathSplit.slice(0, schemaPathSplit.length - 1).join(path.posix.sep);
4984
- toPath = path.join(schemaPathWithoutFileAndExtension, filePath);
5709
+ const schemaPathSplit = schemaPath?.split(path2.sep);
5710
+ const schemaPathWithoutFileAndExtension = schemaPathSplit.slice(0, schemaPathSplit.length - 1).join(path2.posix.sep);
5711
+ toPath = path2.join(schemaPathWithoutFileAndExtension, filePath);
4985
5712
  }
4986
- const newPath = path.relative(fromPath, toPath).split(path.sep).join(path.posix.sep);
5713
+ const newPath = path2.relative(fromPath, toPath).split(path2.sep).join(path2.posix.sep);
4987
5714
  return newPath;
4988
5715
  }
4989
5716
  __name(getRelativePath, "getRelativePath");
@@ -5351,18 +6078,18 @@ var constructShield = /* @__PURE__ */ __name(async ({ queries, mutations, subscr
5351
6078
  // src/prisma-shield-generator.ts
5352
6079
  init_esm_shims();
5353
6080
  import { promises as fs3 } from "node:fs";
5354
- import path4 from "node:path";
6081
+ import path5 from "node:path";
5355
6082
 
5356
6083
  // src/utils/remove-dir.ts
5357
6084
  init_esm_shims();
5358
6085
  import { promises as fs } from "node:fs";
5359
- import path2 from "node:path";
6086
+ import path3 from "node:path";
5360
6087
  async function removeDir(dirPath, onlyContent) {
5361
6088
  const dirEntries = await fs.readdir(dirPath, {
5362
6089
  withFileTypes: true
5363
6090
  });
5364
6091
  await Promise.all(dirEntries.map(async (dirEntry) => {
5365
- const fullPath = path2.join(dirPath, dirEntry.name);
6092
+ const fullPath = path3.join(dirPath, dirEntry.name);
5366
6093
  return dirEntry.isDirectory() ? removeDir(fullPath, false) : fs.unlink(fullPath);
5367
6094
  }));
5368
6095
  if (!onlyContent) {
@@ -5374,7 +6101,7 @@ __name(removeDir, "removeDir");
5374
6101
  // src/utils/write-file-safely.ts
5375
6102
  init_esm_shims();
5376
6103
  import fs2 from "node:fs";
5377
- import path3 from "node:path";
6104
+ import path4 from "node:path";
5378
6105
 
5379
6106
  // src/utils/format-file.ts
5380
6107
  init_esm_shims();
@@ -5403,7 +6130,7 @@ __name(formatFile, "formatFile");
5403
6130
 
5404
6131
  // src/utils/write-file-safely.ts
5405
6132
  var writeFileSafely = /* @__PURE__ */ __name(async (writeLocation, content) => {
5406
- fs2.mkdirSync(path3.dirname(writeLocation), {
6133
+ fs2.mkdirSync(path4.dirname(writeLocation), {
5407
6134
  recursive: true
5408
6135
  });
5409
6136
  fs2.writeFileSync(writeLocation, await formatFile(content));
@@ -5460,7 +6187,7 @@ async function generateShield(options) {
5460
6187
  mutations,
5461
6188
  subscriptions
5462
6189
  }, config, options);
5463
- await writeFileSafely(path4.join(outputDir, "shield.ts"), shieldText);
6190
+ await writeFileSafely(path5.join(outputDir, "shield.ts"), shieldText);
5464
6191
  }
5465
6192
  __name(generateShield, "generateShield");
5466
6193
 
@@ -5485,7 +6212,9 @@ async function generate(options) {
5485
6212
  const internals = await getPrismaInternals();
5486
6213
  const outputDir = internals.parseEnvValue(options.generator.output);
5487
6214
  const results = configSchema.safeParse(options.generator.config);
5488
- if (!results.success) throw new Error("Invalid options passed");
6215
+ if (!results.success) {
6216
+ throw new Error("Invalid options passed");
6217
+ }
5489
6218
  const config = results.data;
5490
6219
  await fs4.mkdir(outputDir, {
5491
6220
  recursive: true
@@ -5496,7 +6225,7 @@ async function generate(options) {
5496
6225
  await prismaZodGenerator.generate(options);
5497
6226
  }
5498
6227
  if (config.withShield !== false) {
5499
- const shieldOutputPath = path5.join(outputDir, "./shield");
6228
+ const shieldOutputPath = path6.join(outputDir, "./shield");
5500
6229
  await generateShield({
5501
6230
  ...options,
5502
6231
  generator: {
@@ -5522,7 +6251,7 @@ async function generate(options) {
5522
6251
  const models = prismaClientDmmf.datamodel.models;
5523
6252
  const hiddenModels = [];
5524
6253
  resolveModelsComments(models, hiddenModels);
5525
- const createRouter = project.createSourceFile(path5.resolve(outputDir, "routers", "helpers", "createRouter.ts"), void 0, {
6254
+ const createRouter = project.createSourceFile(path6.resolve(outputDir, "routers", "helpers", "createRouter.ts"), void 0, {
5526
6255
  overwrite: true
5527
6256
  });
5528
6257
  generateRPCImport(createRouter);
@@ -5533,7 +6262,7 @@ async function generate(options) {
5533
6262
  createRouter.formatText({
5534
6263
  indentSize: 2
5535
6264
  });
5536
- const appRouter = project.createSourceFile(path5.resolve(outputDir, "routers", `index.ts`), void 0, {
6265
+ const appRouter = project.createSourceFile(path6.resolve(outputDir, "routers", `index.ts`), void 0, {
5537
6266
  overwrite: true
5538
6267
  });
5539
6268
  generateCreateRouterImport({
@@ -5547,7 +6276,7 @@ async function generate(options) {
5547
6276
  if (!modelActions.length) continue;
5548
6277
  const plural = (0, import_pluralize.default)(model.toLowerCase());
5549
6278
  generateRouterImport(appRouter, plural, model);
5550
- const modelRouter = project.createSourceFile(path5.resolve(outputDir, "routers", `${model}.router.ts`), void 0, {
6279
+ const modelRouter = project.createSourceFile(path6.resolve(outputDir, "routers", `${model}.router.ts`), void 0, {
5551
6280
  overwrite: true
5552
6281
  });
5553
6282
  generateCreateRouterImport({