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