@stryke/prisma-trpc-generator 0.8.2 → 0.9.0
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 +426 -452
- package/dist/generator.js +424 -450
- package/dist/index.cjs +426 -452
- package/dist/index.js +424 -450
- package/package.json +1 -1
package/dist/generator.cjs
CHANGED
|
@@ -6880,7 +6880,7 @@ var configSchema = z.object({
|
|
|
6880
6880
|
withShield: z.coerce.boolean().or(z.string()).default(true),
|
|
6881
6881
|
withZod: z.coerce.boolean().or(z.string()).default(true),
|
|
6882
6882
|
withNext: z.coerce.boolean().or(z.string()).default(true),
|
|
6883
|
-
contextPath: z.string().default("../
|
|
6883
|
+
contextPath: z.string().default("../context"),
|
|
6884
6884
|
trpcOptions: z.coerce.boolean().or(z.string()).default(true),
|
|
6885
6885
|
showModelNameInProcedure: z.coerce.boolean().or(z.string()).default(true),
|
|
6886
6886
|
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
@@ -6891,217 +6891,39 @@ var configSchema = z.object({
|
|
|
6891
6891
|
// src/helpers.ts
|
|
6892
6892
|
init_cjs_shims();
|
|
6893
6893
|
|
|
6894
|
-
// src/
|
|
6895
|
-
init_cjs_shims();
|
|
6896
|
-
|
|
6897
|
-
// src/utils/get-jiti.ts
|
|
6898
|
-
init_cjs_shims();
|
|
6899
|
-
|
|
6900
|
-
// ../env/src/get-env-paths.ts
|
|
6901
|
-
init_cjs_shims();
|
|
6902
|
-
|
|
6903
|
-
// ../string-format/src/title-case.ts
|
|
6904
|
-
init_cjs_shims();
|
|
6905
|
-
|
|
6906
|
-
// ../string-format/src/acronyms.ts
|
|
6907
|
-
init_cjs_shims();
|
|
6908
|
-
var ACRONYMS = [
|
|
6909
|
-
"API",
|
|
6910
|
-
"CPU",
|
|
6911
|
-
"CSS",
|
|
6912
|
-
"DNS",
|
|
6913
|
-
"EOF",
|
|
6914
|
-
"GUID",
|
|
6915
|
-
"HTML",
|
|
6916
|
-
"HTTP",
|
|
6917
|
-
"HTTPS",
|
|
6918
|
-
"ID",
|
|
6919
|
-
"IP",
|
|
6920
|
-
"JSON",
|
|
6921
|
-
"LHS",
|
|
6922
|
-
"OEM",
|
|
6923
|
-
"PP",
|
|
6924
|
-
"QA",
|
|
6925
|
-
"RAM",
|
|
6926
|
-
"RHS",
|
|
6927
|
-
"RPC",
|
|
6928
|
-
"RSS",
|
|
6929
|
-
"SLA",
|
|
6930
|
-
"SMTP",
|
|
6931
|
-
"SQL",
|
|
6932
|
-
"SSH",
|
|
6933
|
-
"SSL",
|
|
6934
|
-
"TCP",
|
|
6935
|
-
"TLS",
|
|
6936
|
-
"TRPC",
|
|
6937
|
-
"TTL",
|
|
6938
|
-
"UDP",
|
|
6939
|
-
"UI",
|
|
6940
|
-
"UID",
|
|
6941
|
-
"UUID",
|
|
6942
|
-
"URI",
|
|
6943
|
-
"URL",
|
|
6944
|
-
"UTF",
|
|
6945
|
-
"VM",
|
|
6946
|
-
"XML",
|
|
6947
|
-
"XSS",
|
|
6948
|
-
"XSRF"
|
|
6949
|
-
];
|
|
6950
|
-
|
|
6951
|
-
// ../string-format/src/upper-case-first.ts
|
|
6952
|
-
init_cjs_shims();
|
|
6953
|
-
var upperCaseFirst = /* @__PURE__ */ __name((input) => {
|
|
6954
|
-
return input ? input.charAt(0).toUpperCase() + input.slice(1) : input;
|
|
6955
|
-
}, "upperCaseFirst");
|
|
6956
|
-
|
|
6957
|
-
// ../string-format/src/title-case.ts
|
|
6958
|
-
var titleCase = /* @__PURE__ */ __name((input) => {
|
|
6959
|
-
if (!input) {
|
|
6960
|
-
return "";
|
|
6961
|
-
}
|
|
6962
|
-
return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
|
|
6963
|
-
}, "titleCase");
|
|
6964
|
-
|
|
6965
|
-
// ../type-checks/src/is-string.ts
|
|
6966
|
-
init_cjs_shims();
|
|
6967
|
-
var isString = /* @__PURE__ */ __name((value) => {
|
|
6968
|
-
try {
|
|
6969
|
-
return typeof value === "string";
|
|
6970
|
-
} catch {
|
|
6971
|
-
return false;
|
|
6972
|
-
}
|
|
6973
|
-
}, "isString");
|
|
6974
|
-
|
|
6975
|
-
// ../env/src/get-env-paths.ts
|
|
6976
|
-
var import_node_os = __toESM(require("node:os"), 1);
|
|
6977
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
6978
|
-
var homedir = import_node_os.default.homedir();
|
|
6979
|
-
var tmpdir = import_node_os.default.tmpdir();
|
|
6980
|
-
var macos = /* @__PURE__ */ __name((orgId) => {
|
|
6981
|
-
const library = joinPaths(homedir, "Library");
|
|
6982
|
-
return {
|
|
6983
|
-
data: joinPaths(library, "Application Support", orgId),
|
|
6984
|
-
config: joinPaths(library, "Preferences", orgId),
|
|
6985
|
-
cache: joinPaths(library, "Caches", orgId),
|
|
6986
|
-
log: joinPaths(library, "Logs", orgId),
|
|
6987
|
-
temp: joinPaths(tmpdir, orgId)
|
|
6988
|
-
};
|
|
6989
|
-
}, "macos");
|
|
6990
|
-
var windows = /* @__PURE__ */ __name((orgId) => {
|
|
6991
|
-
const appData = process.env.APPDATA || joinPaths(homedir, "AppData", "Roaming");
|
|
6992
|
-
const localAppData = process.env.LOCALAPPDATA || joinPaths(homedir, "AppData", "Local");
|
|
6993
|
-
const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\s+/g, "");
|
|
6994
|
-
return {
|
|
6995
|
-
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
6996
|
-
data: joinPaths(localAppData, windowsFormattedOrgId, "Data"),
|
|
6997
|
-
config: joinPaths(appData, windowsFormattedOrgId, "Config"),
|
|
6998
|
-
cache: joinPaths(localAppData, "Cache", orgId),
|
|
6999
|
-
log: joinPaths(localAppData, windowsFormattedOrgId, "Log"),
|
|
7000
|
-
temp: joinPaths(tmpdir, orgId)
|
|
7001
|
-
};
|
|
7002
|
-
}, "windows");
|
|
7003
|
-
var linux = /* @__PURE__ */ __name((orgId) => {
|
|
7004
|
-
const username = import_node_path.default.basename(homedir);
|
|
7005
|
-
return {
|
|
7006
|
-
data: joinPaths(process.env.XDG_DATA_HOME || joinPaths(homedir, ".local", "share"), orgId),
|
|
7007
|
-
config: joinPaths(process.env.XDG_CONFIG_HOME || joinPaths(homedir, ".config"), orgId),
|
|
7008
|
-
cache: joinPaths(process.env.XDG_CACHE_HOME || joinPaths(homedir, ".cache"), orgId),
|
|
7009
|
-
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
7010
|
-
log: joinPaths(process.env.XDG_STATE_HOME || joinPaths(homedir, ".local", "state"), orgId),
|
|
7011
|
-
temp: joinPaths(tmpdir, username, orgId)
|
|
7012
|
-
};
|
|
7013
|
-
}, "linux");
|
|
7014
|
-
function getEnvPaths(options = {}) {
|
|
7015
|
-
let orgId = options.orgId || "storm-software";
|
|
7016
|
-
if (!orgId) {
|
|
7017
|
-
throw new Error("You need to provide an orgId to the `getEnvPaths` function");
|
|
7018
|
-
}
|
|
7019
|
-
if (options.suffix) {
|
|
7020
|
-
orgId += `-${isString(options.suffix) ? options.suffix : "nodejs"}`;
|
|
7021
|
-
}
|
|
7022
|
-
let result = {};
|
|
7023
|
-
if (process.platform === "darwin") {
|
|
7024
|
-
result = macos(orgId);
|
|
7025
|
-
} else if (process.platform === "win32") {
|
|
7026
|
-
result = windows(orgId);
|
|
7027
|
-
} else {
|
|
7028
|
-
result = linux(orgId);
|
|
7029
|
-
}
|
|
7030
|
-
if (process.env.STORM_DATA_DIRECTORY) {
|
|
7031
|
-
result.data = process.env.STORM_DATA_DIRECTORY;
|
|
7032
|
-
} else if (process.env.STORM_CONFIG_DIRECTORY) {
|
|
7033
|
-
result.config = process.env.STORM_CONFIG_DIRECTORY;
|
|
7034
|
-
} else if (process.env.STORM_CACHE_DIRECTORY) {
|
|
7035
|
-
result.cache = process.env.STORM_CACHE_DIRECTORY;
|
|
7036
|
-
} else if (process.env.STORM_LOG_DIRECTORY) {
|
|
7037
|
-
result.log = process.env.STORM_LOG_DIRECTORY;
|
|
7038
|
-
} else if (process.env.STORM_TEMP_DIRECTORY) {
|
|
7039
|
-
result.temp = process.env.STORM_TEMP_DIRECTORY;
|
|
7040
|
-
}
|
|
7041
|
-
if (options.workspaceRoot) {
|
|
7042
|
-
result.cache ??= joinPaths(options.workspaceRoot, "node_modules", ".cache", orgId);
|
|
7043
|
-
result.temp ??= joinPaths(options.workspaceRoot, "tmp", orgId);
|
|
7044
|
-
result.log ??= joinPaths(result.temp, "logs");
|
|
7045
|
-
result.config ??= joinPaths(options.workspaceRoot, ".config", orgId);
|
|
7046
|
-
}
|
|
7047
|
-
return Object.keys(result).reduce((ret, key) => {
|
|
7048
|
-
if (result[key]) {
|
|
7049
|
-
const filePath = result[key];
|
|
7050
|
-
ret[key] = options.appId && options.appId !== options.orgId && options.appId !== options.nestedDir ? joinPaths(filePath, options.appId) : filePath;
|
|
7051
|
-
if (options.nestedDir && options.nestedDir !== options.orgId && options.nestedDir !== options.appId) {
|
|
7052
|
-
ret[key] = joinPaths(ret[key], options.nestedDir);
|
|
7053
|
-
}
|
|
7054
|
-
}
|
|
7055
|
-
return ret;
|
|
7056
|
-
}, {});
|
|
7057
|
-
}
|
|
7058
|
-
__name(getEnvPaths, "getEnvPaths");
|
|
7059
|
-
|
|
7060
|
-
// ../path/src/get-workspace-root.ts
|
|
7061
|
-
init_cjs_shims();
|
|
7062
|
-
|
|
7063
|
-
// ../../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
|
|
6894
|
+
// ../path/src/file-path-fns.ts
|
|
7064
6895
|
init_cjs_shims();
|
|
7065
6896
|
|
|
7066
|
-
//
|
|
6897
|
+
// ../types/src/base.ts
|
|
7067
6898
|
init_cjs_shims();
|
|
6899
|
+
var EMPTY_STRING = "";
|
|
6900
|
+
var $NestedValue = Symbol("NestedValue");
|
|
7068
6901
|
|
|
7069
|
-
//
|
|
6902
|
+
// ../path/src/correct-path.ts
|
|
7070
6903
|
init_cjs_shims();
|
|
7071
6904
|
|
|
7072
|
-
//
|
|
6905
|
+
// ../path/src/is-file.ts
|
|
7073
6906
|
init_cjs_shims();
|
|
7074
|
-
var __defProp2 = Object.defineProperty;
|
|
7075
|
-
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
|
|
7076
|
-
value,
|
|
7077
|
-
configurable: true
|
|
7078
|
-
}), "__name");
|
|
7079
|
-
|
|
7080
|
-
// ../../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
|
|
7081
6907
|
var import_node_fs2 = require("node:fs");
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
const _startPath = startPath ?? process.cwd();
|
|
7087
|
-
if (endDirectoryNames.some((endDirName) => (0, import_node_fs2.existsSync)((0, import_node_path2.join)(_startPath, endDirName)))) {
|
|
7088
|
-
return _startPath;
|
|
7089
|
-
}
|
|
7090
|
-
if (endFileNames.some((endFileName) => (0, import_node_fs2.existsSync)((0, import_node_path2.join)(_startPath, endFileName)))) {
|
|
7091
|
-
return _startPath;
|
|
7092
|
-
}
|
|
7093
|
-
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
7094
|
-
const parent = (0, import_node_path2.join)(_startPath, "..");
|
|
7095
|
-
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
7096
|
-
}
|
|
7097
|
-
return void 0;
|
|
6908
|
+
function isFile(path5, additionalPath) {
|
|
6909
|
+
return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path5) : path5, {
|
|
6910
|
+
throwIfNoEntry: false
|
|
6911
|
+
})?.isFile());
|
|
7098
6912
|
}
|
|
7099
|
-
__name(
|
|
7100
|
-
|
|
6913
|
+
__name(isFile, "isFile");
|
|
6914
|
+
function isDirectory(path5, additionalPath) {
|
|
6915
|
+
return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path5) : path5, {
|
|
6916
|
+
throwIfNoEntry: false
|
|
6917
|
+
})?.isDirectory());
|
|
6918
|
+
}
|
|
6919
|
+
__name(isDirectory, "isDirectory");
|
|
6920
|
+
function isAbsolutePath(path5) {
|
|
6921
|
+
return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path5);
|
|
6922
|
+
}
|
|
6923
|
+
__name(isAbsolutePath, "isAbsolutePath");
|
|
7101
6924
|
|
|
7102
|
-
//
|
|
7103
|
-
|
|
7104
|
-
var _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
|
|
6925
|
+
// ../path/src/correct-path.ts
|
|
6926
|
+
var _DRIVE_LETTER_START_RE2 = /^[A-Z]:\//i;
|
|
7105
6927
|
function normalizeWindowsPath2(input = "") {
|
|
7106
6928
|
if (!input) {
|
|
7107
6929
|
return input;
|
|
@@ -7109,17 +6931,15 @@ function normalizeWindowsPath2(input = "") {
|
|
|
7109
6931
|
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
|
|
7110
6932
|
}
|
|
7111
6933
|
__name(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
7112
|
-
__name2(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
7113
6934
|
var _UNC_REGEX2 = /^[/\\]{2}/;
|
|
7114
|
-
var
|
|
7115
|
-
|
|
7116
|
-
var correctPaths2 = /* @__PURE__ */ __name2(function(path5) {
|
|
6935
|
+
var _DRIVE_LETTER_RE2 = /^[A-Z]:$/i;
|
|
6936
|
+
function correctPath(path5) {
|
|
7117
6937
|
if (!path5 || path5.length === 0) {
|
|
7118
6938
|
return ".";
|
|
7119
6939
|
}
|
|
7120
6940
|
path5 = normalizeWindowsPath2(path5);
|
|
7121
6941
|
const isUNCPath = path5.match(_UNC_REGEX2);
|
|
7122
|
-
const isPathAbsolute =
|
|
6942
|
+
const isPathAbsolute = isAbsolutePath(path5);
|
|
7123
6943
|
const trailingSeparator = path5[path5.length - 1] === "/";
|
|
7124
6944
|
path5 = normalizeString2(path5, !isPathAbsolute);
|
|
7125
6945
|
if (path5.length === 0) {
|
|
@@ -7140,16 +6960,9 @@ var correctPaths2 = /* @__PURE__ */ __name2(function(path5) {
|
|
|
7140
6960
|
}
|
|
7141
6961
|
return `//${path5}`;
|
|
7142
6962
|
}
|
|
7143
|
-
return isPathAbsolute && !
|
|
7144
|
-
}, "correctPaths");
|
|
7145
|
-
function cwd() {
|
|
7146
|
-
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
7147
|
-
return process.cwd().replace(/\\/g, "/");
|
|
7148
|
-
}
|
|
7149
|
-
return "/";
|
|
6963
|
+
return isPathAbsolute && !isAbsolutePath(path5) ? `/${path5}` : path5;
|
|
7150
6964
|
}
|
|
7151
|
-
__name(
|
|
7152
|
-
__name2(cwd, "cwd");
|
|
6965
|
+
__name(correctPath, "correctPath");
|
|
7153
6966
|
function normalizeString2(path5, allowAboveRoot) {
|
|
7154
6967
|
let res = "";
|
|
7155
6968
|
let lastSegmentLength = 0;
|
|
@@ -7211,110 +7024,52 @@ function normalizeString2(path5, allowAboveRoot) {
|
|
|
7211
7024
|
return res;
|
|
7212
7025
|
}
|
|
7213
7026
|
__name(normalizeString2, "normalizeString");
|
|
7214
|
-
__name2(normalizeString2, "normalizeString");
|
|
7215
|
-
var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
|
|
7216
|
-
return _IS_ABSOLUTE_RE2.test(p);
|
|
7217
|
-
}, "isAbsolute");
|
|
7218
|
-
|
|
7219
|
-
// ../../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
|
|
7220
|
-
var rootFiles = [
|
|
7221
|
-
"storm-workspace.json",
|
|
7222
|
-
"storm-workspace.json",
|
|
7223
|
-
"storm-workspace.yaml",
|
|
7224
|
-
"storm-workspace.yml",
|
|
7225
|
-
"storm-workspace.js",
|
|
7226
|
-
"storm-workspace.ts",
|
|
7227
|
-
".storm-workspace.json",
|
|
7228
|
-
".storm-workspace.yaml",
|
|
7229
|
-
".storm-workspace.yml",
|
|
7230
|
-
".storm-workspace.js",
|
|
7231
|
-
".storm-workspace.ts",
|
|
7232
|
-
"lerna.json",
|
|
7233
|
-
"nx.json",
|
|
7234
|
-
"turbo.json",
|
|
7235
|
-
"npm-workspace.json",
|
|
7236
|
-
"yarn-workspace.json",
|
|
7237
|
-
"pnpm-workspace.json",
|
|
7238
|
-
"npm-workspace.yaml",
|
|
7239
|
-
"yarn-workspace.yaml",
|
|
7240
|
-
"pnpm-workspace.yaml",
|
|
7241
|
-
"npm-workspace.yml",
|
|
7242
|
-
"yarn-workspace.yml",
|
|
7243
|
-
"pnpm-workspace.yml",
|
|
7244
|
-
"npm-lock.json",
|
|
7245
|
-
"yarn-lock.json",
|
|
7246
|
-
"pnpm-lock.json",
|
|
7247
|
-
"npm-lock.yaml",
|
|
7248
|
-
"yarn-lock.yaml",
|
|
7249
|
-
"pnpm-lock.yaml",
|
|
7250
|
-
"npm-lock.yml",
|
|
7251
|
-
"yarn-lock.yml",
|
|
7252
|
-
"pnpm-lock.yml",
|
|
7253
|
-
"bun.lockb"
|
|
7254
|
-
];
|
|
7255
|
-
var rootDirectories = [
|
|
7256
|
-
".storm-workspace",
|
|
7257
|
-
".nx",
|
|
7258
|
-
".github",
|
|
7259
|
-
".vscode",
|
|
7260
|
-
".verdaccio"
|
|
7261
|
-
];
|
|
7262
|
-
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
7263
|
-
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
7264
|
-
return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
7265
|
-
}
|
|
7266
|
-
return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
7267
|
-
}
|
|
7268
|
-
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
7269
|
-
__name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
7270
|
-
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
7271
|
-
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
7272
|
-
if (!result) {
|
|
7273
|
-
throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
|
|
7274
|
-
${rootFiles.join("\n")}
|
|
7275
|
-
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
|
|
7276
|
-
}
|
|
7277
|
-
return result;
|
|
7278
|
-
}
|
|
7279
|
-
__name(findWorkspaceRoot, "findWorkspaceRoot");
|
|
7280
|
-
__name2(findWorkspaceRoot, "findWorkspaceRoot");
|
|
7281
7027
|
|
|
7282
|
-
// ../path/src/get-
|
|
7028
|
+
// ../path/src/get-workspace-root.ts
|
|
7283
7029
|
init_cjs_shims();
|
|
7284
7030
|
|
|
7285
|
-
//
|
|
7031
|
+
// ../../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
|
|
7286
7032
|
init_cjs_shims();
|
|
7287
7033
|
|
|
7288
|
-
//
|
|
7034
|
+
// ../../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
|
|
7289
7035
|
init_cjs_shims();
|
|
7290
|
-
var EMPTY_STRING = "";
|
|
7291
|
-
var $NestedValue = Symbol("NestedValue");
|
|
7292
7036
|
|
|
7293
|
-
//
|
|
7037
|
+
// ../../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
|
|
7294
7038
|
init_cjs_shims();
|
|
7295
7039
|
|
|
7296
|
-
//
|
|
7040
|
+
// ../../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
|
|
7297
7041
|
init_cjs_shims();
|
|
7042
|
+
var __defProp2 = Object.defineProperty;
|
|
7043
|
+
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
|
|
7044
|
+
value,
|
|
7045
|
+
configurable: true
|
|
7046
|
+
}), "__name");
|
|
7047
|
+
|
|
7048
|
+
// ../../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
|
|
7298
7049
|
var import_node_fs3 = require("node:fs");
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
}
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7050
|
+
var import_node_path = require("node:path");
|
|
7051
|
+
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
7052
|
+
var depth = 0;
|
|
7053
|
+
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
7054
|
+
const _startPath = startPath ?? process.cwd();
|
|
7055
|
+
if (endDirectoryNames.some((endDirName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endDirName)))) {
|
|
7056
|
+
return _startPath;
|
|
7057
|
+
}
|
|
7058
|
+
if (endFileNames.some((endFileName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
|
|
7059
|
+
return _startPath;
|
|
7060
|
+
}
|
|
7061
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
7062
|
+
const parent = (0, import_node_path.join)(_startPath, "..");
|
|
7063
|
+
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
7064
|
+
}
|
|
7065
|
+
return void 0;
|
|
7313
7066
|
}
|
|
7314
|
-
__name(
|
|
7067
|
+
__name(findFolderUp, "findFolderUp");
|
|
7068
|
+
__name2(findFolderUp, "findFolderUp");
|
|
7315
7069
|
|
|
7316
|
-
//
|
|
7317
|
-
|
|
7070
|
+
// ../../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
|
|
7071
|
+
init_cjs_shims();
|
|
7072
|
+
var _DRIVE_LETTER_START_RE3 = /^[A-Za-z]:\//;
|
|
7318
7073
|
function normalizeWindowsPath3(input = "") {
|
|
7319
7074
|
if (!input) {
|
|
7320
7075
|
return input;
|
|
@@ -7322,15 +7077,17 @@ function normalizeWindowsPath3(input = "") {
|
|
|
7322
7077
|
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE3, (r) => r.toUpperCase());
|
|
7323
7078
|
}
|
|
7324
7079
|
__name(normalizeWindowsPath3, "normalizeWindowsPath");
|
|
7080
|
+
__name2(normalizeWindowsPath3, "normalizeWindowsPath");
|
|
7325
7081
|
var _UNC_REGEX3 = /^[/\\]{2}/;
|
|
7326
|
-
var
|
|
7327
|
-
|
|
7082
|
+
var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
7083
|
+
var _DRIVE_LETTER_RE3 = /^[A-Za-z]:$/;
|
|
7084
|
+
var correctPaths2 = /* @__PURE__ */ __name2(function(path5) {
|
|
7328
7085
|
if (!path5 || path5.length === 0) {
|
|
7329
7086
|
return ".";
|
|
7330
7087
|
}
|
|
7331
7088
|
path5 = normalizeWindowsPath3(path5);
|
|
7332
7089
|
const isUNCPath = path5.match(_UNC_REGEX3);
|
|
7333
|
-
const isPathAbsolute =
|
|
7090
|
+
const isPathAbsolute = isAbsolute2(path5);
|
|
7334
7091
|
const trailingSeparator = path5[path5.length - 1] === "/";
|
|
7335
7092
|
path5 = normalizeString3(path5, !isPathAbsolute);
|
|
7336
7093
|
if (path5.length === 0) {
|
|
@@ -7351,9 +7108,16 @@ function correctPath(path5) {
|
|
|
7351
7108
|
}
|
|
7352
7109
|
return `//${path5}`;
|
|
7353
7110
|
}
|
|
7354
|
-
return isPathAbsolute && !
|
|
7111
|
+
return isPathAbsolute && !isAbsolute2(path5) ? `/${path5}` : path5;
|
|
7112
|
+
}, "correctPaths");
|
|
7113
|
+
function cwd() {
|
|
7114
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
7115
|
+
return process.cwd().replace(/\\/g, "/");
|
|
7116
|
+
}
|
|
7117
|
+
return "/";
|
|
7355
7118
|
}
|
|
7356
|
-
__name(
|
|
7119
|
+
__name(cwd, "cwd");
|
|
7120
|
+
__name2(cwd, "cwd");
|
|
7357
7121
|
function normalizeString3(path5, allowAboveRoot) {
|
|
7358
7122
|
let res = "";
|
|
7359
7123
|
let lastSegmentLength = 0;
|
|
@@ -7415,73 +7179,76 @@ function normalizeString3(path5, allowAboveRoot) {
|
|
|
7415
7179
|
return res;
|
|
7416
7180
|
}
|
|
7417
7181
|
__name(normalizeString3, "normalizeString");
|
|
7182
|
+
__name2(normalizeString3, "normalizeString");
|
|
7183
|
+
var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
|
|
7184
|
+
return _IS_ABSOLUTE_RE2.test(p);
|
|
7185
|
+
}, "isAbsolute");
|
|
7418
7186
|
|
|
7419
|
-
//
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7187
|
+
// ../../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
|
|
7188
|
+
var rootFiles = [
|
|
7189
|
+
"storm-workspace.json",
|
|
7190
|
+
"storm-workspace.json",
|
|
7191
|
+
"storm-workspace.yaml",
|
|
7192
|
+
"storm-workspace.yml",
|
|
7193
|
+
"storm-workspace.js",
|
|
7194
|
+
"storm-workspace.ts",
|
|
7195
|
+
".storm-workspace.json",
|
|
7196
|
+
".storm-workspace.yaml",
|
|
7197
|
+
".storm-workspace.yml",
|
|
7198
|
+
".storm-workspace.js",
|
|
7199
|
+
".storm-workspace.ts",
|
|
7200
|
+
"lerna.json",
|
|
7201
|
+
"nx.json",
|
|
7202
|
+
"turbo.json",
|
|
7203
|
+
"npm-workspace.json",
|
|
7204
|
+
"yarn-workspace.json",
|
|
7205
|
+
"pnpm-workspace.json",
|
|
7206
|
+
"npm-workspace.yaml",
|
|
7207
|
+
"yarn-workspace.yaml",
|
|
7208
|
+
"pnpm-workspace.yaml",
|
|
7209
|
+
"npm-workspace.yml",
|
|
7210
|
+
"yarn-workspace.yml",
|
|
7211
|
+
"pnpm-workspace.yml",
|
|
7212
|
+
"npm-lock.json",
|
|
7213
|
+
"yarn-lock.json",
|
|
7214
|
+
"pnpm-lock.json",
|
|
7215
|
+
"npm-lock.yaml",
|
|
7216
|
+
"yarn-lock.yaml",
|
|
7217
|
+
"pnpm-lock.yaml",
|
|
7218
|
+
"npm-lock.yml",
|
|
7219
|
+
"yarn-lock.yml",
|
|
7220
|
+
"pnpm-lock.yml",
|
|
7221
|
+
"bun.lockb"
|
|
7222
|
+
];
|
|
7223
|
+
var rootDirectories = [
|
|
7224
|
+
".storm-workspace",
|
|
7225
|
+
".nx",
|
|
7226
|
+
".github",
|
|
7227
|
+
".vscode",
|
|
7228
|
+
".verdaccio"
|
|
7229
|
+
];
|
|
7230
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
7231
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
7232
|
+
return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
7453
7233
|
}
|
|
7454
|
-
return
|
|
7455
|
-
}
|
|
7456
|
-
__name(resolvePath, "resolvePath");
|
|
7457
|
-
function resolvePaths(...paths) {
|
|
7458
|
-
return resolvePath(joinPaths(...paths.map((path5) => normalizeWindowsPath3(path5))));
|
|
7234
|
+
return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
7459
7235
|
}
|
|
7460
|
-
__name(
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
const
|
|
7464
|
-
if (
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
..._from
|
|
7469
|
-
];
|
|
7470
|
-
for (const segment of _fromCopy) {
|
|
7471
|
-
if (_to[0] !== segment) {
|
|
7472
|
-
break;
|
|
7473
|
-
}
|
|
7474
|
-
_from.shift();
|
|
7475
|
-
_to.shift();
|
|
7236
|
+
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
7237
|
+
__name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
7238
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
7239
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
7240
|
+
if (!result) {
|
|
7241
|
+
throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
|
|
7242
|
+
${rootFiles.join("\n")}
|
|
7243
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
|
|
7476
7244
|
}
|
|
7477
|
-
return
|
|
7478
|
-
..._from.map(() => ".."),
|
|
7479
|
-
..._to
|
|
7480
|
-
].join("/");
|
|
7245
|
+
return result;
|
|
7481
7246
|
}
|
|
7482
|
-
__name(
|
|
7247
|
+
__name(findWorkspaceRoot, "findWorkspaceRoot");
|
|
7248
|
+
__name2(findWorkspaceRoot, "findWorkspaceRoot");
|
|
7483
7249
|
|
|
7484
7250
|
// ../path/src/get-parent-path.ts
|
|
7251
|
+
init_cjs_shims();
|
|
7485
7252
|
var resolveParentPath = /* @__PURE__ */ __name((path5) => {
|
|
7486
7253
|
return resolvePaths(path5, "..");
|
|
7487
7254
|
}, "resolveParentPath");
|
|
@@ -7569,6 +7336,237 @@ var getWorkspaceRoot = /* @__PURE__ */ __name((dir = process.cwd()) => {
|
|
|
7569
7336
|
return dir;
|
|
7570
7337
|
}, "getWorkspaceRoot");
|
|
7571
7338
|
|
|
7339
|
+
// ../path/src/file-path-fns.ts
|
|
7340
|
+
function findFileName(filePath, { requireExtension, withExtension } = {}) {
|
|
7341
|
+
const result = normalizeWindowsPath2(filePath)?.split(filePath?.includes("\\") ? "\\" : "/")?.pop() ?? "";
|
|
7342
|
+
if (requireExtension === true && !result.includes(".")) {
|
|
7343
|
+
return EMPTY_STRING;
|
|
7344
|
+
}
|
|
7345
|
+
if (withExtension === false && result.includes(".")) {
|
|
7346
|
+
return result.split(".").slice(-1).join(".") || EMPTY_STRING;
|
|
7347
|
+
}
|
|
7348
|
+
return result;
|
|
7349
|
+
}
|
|
7350
|
+
__name(findFileName, "findFileName");
|
|
7351
|
+
function findFilePath(filePath) {
|
|
7352
|
+
const normalizedPath = normalizeWindowsPath2(filePath);
|
|
7353
|
+
return normalizedPath.replace(findFileName(normalizedPath, {
|
|
7354
|
+
requireExtension: true
|
|
7355
|
+
}), "");
|
|
7356
|
+
}
|
|
7357
|
+
__name(findFilePath, "findFilePath");
|
|
7358
|
+
function resolvePath(path5, cwd2 = getWorkspaceRoot()) {
|
|
7359
|
+
const paths = normalizeWindowsPath2(path5).split("/");
|
|
7360
|
+
let resolvedPath = "";
|
|
7361
|
+
let resolvedAbsolute = false;
|
|
7362
|
+
for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
7363
|
+
const path6 = index >= 0 ? paths[index] : cwd2;
|
|
7364
|
+
if (!path6 || path6.length === 0) {
|
|
7365
|
+
continue;
|
|
7366
|
+
}
|
|
7367
|
+
resolvedPath = joinPaths(path6, resolvedPath);
|
|
7368
|
+
resolvedAbsolute = isAbsolutePath(path6);
|
|
7369
|
+
}
|
|
7370
|
+
resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute);
|
|
7371
|
+
if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {
|
|
7372
|
+
return `/${resolvedPath}`;
|
|
7373
|
+
}
|
|
7374
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
7375
|
+
}
|
|
7376
|
+
__name(resolvePath, "resolvePath");
|
|
7377
|
+
function resolvePaths(...paths) {
|
|
7378
|
+
return resolvePath(joinPaths(...paths.map((path5) => normalizeWindowsPath2(path5))));
|
|
7379
|
+
}
|
|
7380
|
+
__name(resolvePaths, "resolvePaths");
|
|
7381
|
+
function relativePath(from, to) {
|
|
7382
|
+
const _from = resolvePath(from).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
|
|
7383
|
+
const _to = resolvePath(to).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
|
|
7384
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
7385
|
+
return _to.join("/");
|
|
7386
|
+
}
|
|
7387
|
+
const _fromCopy = [
|
|
7388
|
+
..._from
|
|
7389
|
+
];
|
|
7390
|
+
for (const segment of _fromCopy) {
|
|
7391
|
+
if (_to[0] !== segment) {
|
|
7392
|
+
break;
|
|
7393
|
+
}
|
|
7394
|
+
_from.shift();
|
|
7395
|
+
_to.shift();
|
|
7396
|
+
}
|
|
7397
|
+
return [
|
|
7398
|
+
..._from.map(() => ".."),
|
|
7399
|
+
..._to
|
|
7400
|
+
].join("/");
|
|
7401
|
+
}
|
|
7402
|
+
__name(relativePath, "relativePath");
|
|
7403
|
+
|
|
7404
|
+
// src/utils/get-prisma-internals.ts
|
|
7405
|
+
init_cjs_shims();
|
|
7406
|
+
|
|
7407
|
+
// src/utils/get-jiti.ts
|
|
7408
|
+
init_cjs_shims();
|
|
7409
|
+
|
|
7410
|
+
// ../env/src/get-env-paths.ts
|
|
7411
|
+
init_cjs_shims();
|
|
7412
|
+
|
|
7413
|
+
// ../string-format/src/title-case.ts
|
|
7414
|
+
init_cjs_shims();
|
|
7415
|
+
|
|
7416
|
+
// ../string-format/src/acronyms.ts
|
|
7417
|
+
init_cjs_shims();
|
|
7418
|
+
var ACRONYMS = [
|
|
7419
|
+
"API",
|
|
7420
|
+
"CPU",
|
|
7421
|
+
"CSS",
|
|
7422
|
+
"DNS",
|
|
7423
|
+
"EOF",
|
|
7424
|
+
"GUID",
|
|
7425
|
+
"HTML",
|
|
7426
|
+
"HTTP",
|
|
7427
|
+
"HTTPS",
|
|
7428
|
+
"ID",
|
|
7429
|
+
"IP",
|
|
7430
|
+
"JSON",
|
|
7431
|
+
"LHS",
|
|
7432
|
+
"OEM",
|
|
7433
|
+
"PP",
|
|
7434
|
+
"QA",
|
|
7435
|
+
"RAM",
|
|
7436
|
+
"RHS",
|
|
7437
|
+
"RPC",
|
|
7438
|
+
"RSS",
|
|
7439
|
+
"SLA",
|
|
7440
|
+
"SMTP",
|
|
7441
|
+
"SQL",
|
|
7442
|
+
"SSH",
|
|
7443
|
+
"SSL",
|
|
7444
|
+
"TCP",
|
|
7445
|
+
"TLS",
|
|
7446
|
+
"TRPC",
|
|
7447
|
+
"TTL",
|
|
7448
|
+
"UDP",
|
|
7449
|
+
"UI",
|
|
7450
|
+
"UID",
|
|
7451
|
+
"UUID",
|
|
7452
|
+
"URI",
|
|
7453
|
+
"URL",
|
|
7454
|
+
"UTF",
|
|
7455
|
+
"VM",
|
|
7456
|
+
"XML",
|
|
7457
|
+
"XSS",
|
|
7458
|
+
"XSRF"
|
|
7459
|
+
];
|
|
7460
|
+
|
|
7461
|
+
// ../string-format/src/upper-case-first.ts
|
|
7462
|
+
init_cjs_shims();
|
|
7463
|
+
var upperCaseFirst = /* @__PURE__ */ __name((input) => {
|
|
7464
|
+
return input ? input.charAt(0).toUpperCase() + input.slice(1) : input;
|
|
7465
|
+
}, "upperCaseFirst");
|
|
7466
|
+
|
|
7467
|
+
// ../string-format/src/title-case.ts
|
|
7468
|
+
var titleCase = /* @__PURE__ */ __name((input) => {
|
|
7469
|
+
if (!input) {
|
|
7470
|
+
return "";
|
|
7471
|
+
}
|
|
7472
|
+
return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
|
|
7473
|
+
}, "titleCase");
|
|
7474
|
+
|
|
7475
|
+
// ../type-checks/src/is-string.ts
|
|
7476
|
+
init_cjs_shims();
|
|
7477
|
+
var isString = /* @__PURE__ */ __name((value) => {
|
|
7478
|
+
try {
|
|
7479
|
+
return typeof value === "string";
|
|
7480
|
+
} catch {
|
|
7481
|
+
return false;
|
|
7482
|
+
}
|
|
7483
|
+
}, "isString");
|
|
7484
|
+
|
|
7485
|
+
// ../env/src/get-env-paths.ts
|
|
7486
|
+
var import_node_os = __toESM(require("node:os"), 1);
|
|
7487
|
+
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
7488
|
+
var homedir = import_node_os.default.homedir();
|
|
7489
|
+
var tmpdir = import_node_os.default.tmpdir();
|
|
7490
|
+
var macos = /* @__PURE__ */ __name((orgId) => {
|
|
7491
|
+
const library = joinPaths(homedir, "Library");
|
|
7492
|
+
return {
|
|
7493
|
+
data: joinPaths(library, "Application Support", orgId),
|
|
7494
|
+
config: joinPaths(library, "Preferences", orgId),
|
|
7495
|
+
cache: joinPaths(library, "Caches", orgId),
|
|
7496
|
+
log: joinPaths(library, "Logs", orgId),
|
|
7497
|
+
temp: joinPaths(tmpdir, orgId)
|
|
7498
|
+
};
|
|
7499
|
+
}, "macos");
|
|
7500
|
+
var windows = /* @__PURE__ */ __name((orgId) => {
|
|
7501
|
+
const appData = process.env.APPDATA || joinPaths(homedir, "AppData", "Roaming");
|
|
7502
|
+
const localAppData = process.env.LOCALAPPDATA || joinPaths(homedir, "AppData", "Local");
|
|
7503
|
+
const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\s+/g, "");
|
|
7504
|
+
return {
|
|
7505
|
+
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
7506
|
+
data: joinPaths(localAppData, windowsFormattedOrgId, "Data"),
|
|
7507
|
+
config: joinPaths(appData, windowsFormattedOrgId, "Config"),
|
|
7508
|
+
cache: joinPaths(localAppData, "Cache", orgId),
|
|
7509
|
+
log: joinPaths(localAppData, windowsFormattedOrgId, "Log"),
|
|
7510
|
+
temp: joinPaths(tmpdir, orgId)
|
|
7511
|
+
};
|
|
7512
|
+
}, "windows");
|
|
7513
|
+
var linux = /* @__PURE__ */ __name((orgId) => {
|
|
7514
|
+
const username = import_node_path2.default.basename(homedir);
|
|
7515
|
+
return {
|
|
7516
|
+
data: joinPaths(process.env.XDG_DATA_HOME || joinPaths(homedir, ".local", "share"), orgId),
|
|
7517
|
+
config: joinPaths(process.env.XDG_CONFIG_HOME || joinPaths(homedir, ".config"), orgId),
|
|
7518
|
+
cache: joinPaths(process.env.XDG_CACHE_HOME || joinPaths(homedir, ".cache"), orgId),
|
|
7519
|
+
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
7520
|
+
log: joinPaths(process.env.XDG_STATE_HOME || joinPaths(homedir, ".local", "state"), orgId),
|
|
7521
|
+
temp: joinPaths(tmpdir, username, orgId)
|
|
7522
|
+
};
|
|
7523
|
+
}, "linux");
|
|
7524
|
+
function getEnvPaths(options = {}) {
|
|
7525
|
+
let orgId = options.orgId || "storm-software";
|
|
7526
|
+
if (!orgId) {
|
|
7527
|
+
throw new Error("You need to provide an orgId to the `getEnvPaths` function");
|
|
7528
|
+
}
|
|
7529
|
+
if (options.suffix) {
|
|
7530
|
+
orgId += `-${isString(options.suffix) ? options.suffix : "nodejs"}`;
|
|
7531
|
+
}
|
|
7532
|
+
let result = {};
|
|
7533
|
+
if (process.platform === "darwin") {
|
|
7534
|
+
result = macos(orgId);
|
|
7535
|
+
} else if (process.platform === "win32") {
|
|
7536
|
+
result = windows(orgId);
|
|
7537
|
+
} else {
|
|
7538
|
+
result = linux(orgId);
|
|
7539
|
+
}
|
|
7540
|
+
if (process.env.STORM_DATA_DIRECTORY) {
|
|
7541
|
+
result.data = process.env.STORM_DATA_DIRECTORY;
|
|
7542
|
+
} else if (process.env.STORM_CONFIG_DIRECTORY) {
|
|
7543
|
+
result.config = process.env.STORM_CONFIG_DIRECTORY;
|
|
7544
|
+
} else if (process.env.STORM_CACHE_DIRECTORY) {
|
|
7545
|
+
result.cache = process.env.STORM_CACHE_DIRECTORY;
|
|
7546
|
+
} else if (process.env.STORM_LOG_DIRECTORY) {
|
|
7547
|
+
result.log = process.env.STORM_LOG_DIRECTORY;
|
|
7548
|
+
} else if (process.env.STORM_TEMP_DIRECTORY) {
|
|
7549
|
+
result.temp = process.env.STORM_TEMP_DIRECTORY;
|
|
7550
|
+
}
|
|
7551
|
+
if (options.workspaceRoot) {
|
|
7552
|
+
result.cache ??= joinPaths(options.workspaceRoot, "node_modules", ".cache", orgId);
|
|
7553
|
+
result.temp ??= joinPaths(options.workspaceRoot, "tmp", orgId);
|
|
7554
|
+
result.log ??= joinPaths(result.temp, "logs");
|
|
7555
|
+
result.config ??= joinPaths(options.workspaceRoot, ".config", orgId);
|
|
7556
|
+
}
|
|
7557
|
+
return Object.keys(result).reduce((ret, key) => {
|
|
7558
|
+
if (result[key]) {
|
|
7559
|
+
const filePath = result[key];
|
|
7560
|
+
ret[key] = options.appId && options.appId !== options.orgId && options.appId !== options.nestedDir ? joinPaths(filePath, options.appId) : filePath;
|
|
7561
|
+
if (options.nestedDir && options.nestedDir !== options.orgId && options.nestedDir !== options.appId) {
|
|
7562
|
+
ret[key] = joinPaths(ret[key], options.nestedDir);
|
|
7563
|
+
}
|
|
7564
|
+
}
|
|
7565
|
+
return ret;
|
|
7566
|
+
}, {});
|
|
7567
|
+
}
|
|
7568
|
+
__name(getEnvPaths, "getEnvPaths");
|
|
7569
|
+
|
|
7572
7570
|
// src/utils/get-jiti.ts
|
|
7573
7571
|
var import_jiti = require("jiti");
|
|
7574
7572
|
var jiti;
|
|
@@ -7594,17 +7592,6 @@ async function getPrismaGeneratorHelper() {
|
|
|
7594
7592
|
}
|
|
7595
7593
|
__name(getPrismaGeneratorHelper, "getPrismaGeneratorHelper");
|
|
7596
7594
|
|
|
7597
|
-
// src/utils/get-relative-path.ts
|
|
7598
|
-
init_cjs_shims();
|
|
7599
|
-
function getRelativePath(outputPath, filePath, isOutsideOutputPath, schemaPath, fromPath) {
|
|
7600
|
-
let toPath = joinPaths(outputPath, filePath.endsWith(".ts") ? findFilePath(filePath) : filePath);
|
|
7601
|
-
if (isOutsideOutputPath && schemaPath) {
|
|
7602
|
-
toPath = joinPaths(schemaPath.endsWith(".prisma") ? findFilePath(schemaPath) : schemaPath, filePath);
|
|
7603
|
-
}
|
|
7604
|
-
return relativePath(fromPath || outputPath, toPath);
|
|
7605
|
-
}
|
|
7606
|
-
__name(getRelativePath, "getRelativePath");
|
|
7607
|
-
|
|
7608
7595
|
// src/helpers.ts
|
|
7609
7596
|
var getProcedureName = /* @__PURE__ */ __name((config) => {
|
|
7610
7597
|
return config.withShield ? "shieldedProcedure" : config.withMiddleware ? "protectedProcedure" : "publicProcedure";
|
|
@@ -7631,12 +7618,8 @@ var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural,
|
|
|
7631
7618
|
}, "generateRouterImport");
|
|
7632
7619
|
async function generateTRPCExports(sourceFile, config, options, outputDir) {
|
|
7633
7620
|
if (config.withShield) {
|
|
7634
|
-
let shieldPath = joinPaths(outputDir, "shield");
|
|
7635
|
-
if (typeof config.withShield === "string") {
|
|
7636
|
-
shieldPath = getRelativePath(outputDir, config.withShield, true, options.schemaPath);
|
|
7637
|
-
}
|
|
7638
7621
|
sourceFile.addImportDeclaration({
|
|
7639
|
-
moduleSpecifier:
|
|
7622
|
+
moduleSpecifier: relativePath(outputDir, joinPaths(outputDir, typeof config.withShield === "string" ? config.withShield : "shield")),
|
|
7640
7623
|
namedImports: [
|
|
7641
7624
|
"permissions"
|
|
7642
7625
|
]
|
|
@@ -7648,19 +7631,19 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
|
|
|
7648
7631
|
sourceFile.addStatements(
|
|
7649
7632
|
/* ts */
|
|
7650
7633
|
`
|
|
7651
|
-
import type { Context } from '${
|
|
7634
|
+
import type { Context } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';`
|
|
7652
7635
|
);
|
|
7653
7636
|
if (config.trpcOptions) {
|
|
7654
7637
|
sourceFile.addStatements(
|
|
7655
7638
|
/* ts */
|
|
7656
7639
|
`
|
|
7657
|
-
import trpcOptions from '${
|
|
7640
|
+
import trpcOptions from '${relativePath(outputDir, joinPaths(outputDir, typeof config.trpcOptions === "string" ? config.trpcOptions : "options"))}';`
|
|
7658
7641
|
);
|
|
7659
7642
|
}
|
|
7660
7643
|
if (config.withNext) {
|
|
7661
7644
|
sourceFile.addStatements(
|
|
7662
7645
|
/* ts */
|
|
7663
|
-
`import { createContext } from '${
|
|
7646
|
+
`import { createContext } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';
|
|
7664
7647
|
import { initTRPC } from '@trpc/server';
|
|
7665
7648
|
import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';`
|
|
7666
7649
|
);
|
|
@@ -7692,7 +7675,7 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
|
|
|
7692
7675
|
sourceFile.addStatements(
|
|
7693
7676
|
/* ts */
|
|
7694
7677
|
`
|
|
7695
|
-
import defaultMiddleware from '${
|
|
7678
|
+
import defaultMiddleware from '${relativePath(outputDir, joinPaths(outputDir, typeof config.withMiddleware === "string" ? config.withMiddleware : "middleware"))}';
|
|
7696
7679
|
`
|
|
7697
7680
|
);
|
|
7698
7681
|
sourceFile.addStatements(
|
|
@@ -7969,7 +7952,7 @@ var constructShield = /* @__PURE__ */ __name(async ({ queries, mutations, subscr
|
|
|
7969
7952
|
return "";
|
|
7970
7953
|
}
|
|
7971
7954
|
let shieldText = getImports("trpc-shield");
|
|
7972
|
-
shieldText += getImports("context",
|
|
7955
|
+
shieldText += getImports("context", relativePath(outputDir, joinPaths(outputDir, config.contextPath)));
|
|
7973
7956
|
shieldText += "\n\n";
|
|
7974
7957
|
shieldText += wrapWithExport({
|
|
7975
7958
|
shieldObjectText: wrapWithTrpcShieldCall({
|
|
@@ -7982,50 +7965,50 @@ var constructShield = /* @__PURE__ */ __name(async ({ queries, mutations, subscr
|
|
|
7982
7965
|
}, "constructShield");
|
|
7983
7966
|
var constructDefaultOptions = /* @__PURE__ */ __name((config, options, outputDir) => {
|
|
7984
7967
|
return `import { ZodError } from 'zod';${config.withNext ? '\nimport { transformer } from "@stryke/trpc-next/shared";' : ""}
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7968
|
+
import type {
|
|
7969
|
+
DataTransformerOptions,
|
|
7970
|
+
RootConfig
|
|
7971
|
+
} from "@trpc/server/unstable-core-do-not-import";
|
|
7972
|
+
import type { Context } from "${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}";
|
|
7990
7973
|
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
7974
|
+
interface RuntimeConfigOptions<
|
|
7975
|
+
TContext extends object,
|
|
7976
|
+
TMeta extends object = object
|
|
7977
|
+
> extends Partial<
|
|
7978
|
+
Omit<
|
|
7979
|
+
RootConfig<{
|
|
7980
|
+
ctx: TContext;
|
|
7981
|
+
meta: TMeta;
|
|
7982
|
+
errorShape: any;
|
|
7983
|
+
transformer: any;
|
|
7984
|
+
}>,
|
|
7985
|
+
"$types" | "transformer"
|
|
7986
|
+
>
|
|
7987
|
+
> {
|
|
7988
|
+
/**
|
|
7989
|
+
* Use a data transformer
|
|
7990
|
+
* @see https://trpc.io/docs/v11/data-transformers
|
|
7991
|
+
*/
|
|
7992
|
+
transformer?: DataTransformerOptions;
|
|
7993
|
+
}
|
|
8011
7994
|
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
7995
|
+
const options: RuntimeConfigOptions<Context> = {${config.withNext ? "\n transformer," : ""}
|
|
7996
|
+
errorFormatter({ shape, error }) {
|
|
7997
|
+
return {
|
|
7998
|
+
...shape,
|
|
7999
|
+
data: {
|
|
8000
|
+
...shape.data,
|
|
8001
|
+
zodError:
|
|
8002
|
+
error.code === "BAD_REQUEST" && error.cause instanceof ZodError
|
|
8003
|
+
? error.cause.flatten()
|
|
8004
|
+
: null
|
|
8005
|
+
}
|
|
8006
|
+
};
|
|
8007
|
+
}
|
|
8008
|
+
};
|
|
8026
8009
|
|
|
8027
|
-
|
|
8028
|
-
|
|
8010
|
+
export default options;
|
|
8011
|
+
`;
|
|
8029
8012
|
}, "constructDefaultOptions");
|
|
8030
8013
|
|
|
8031
8014
|
// src/project.ts
|
|
@@ -11648,29 +11631,20 @@ async function generate(options) {
|
|
|
11648
11631
|
queries.sort();
|
|
11649
11632
|
mutations.sort();
|
|
11650
11633
|
subscriptions.sort();
|
|
11651
|
-
if (config.withShield !== false) {
|
|
11652
|
-
consoleLog(
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
const shieldText = await constructShield({
|
|
11659
|
-
queries,
|
|
11660
|
-
mutations,
|
|
11661
|
-
subscriptions
|
|
11662
|
-
}, config, options, shieldOutputDir);
|
|
11663
|
-
consoleLog("Saving tRPC Shield source file to disk");
|
|
11664
|
-
await writeFileSafely(shieldOutputDir.endsWith(".ts") ? shieldOutputDir : joinPaths(shieldOutputDir, "shield.ts"), shieldText);
|
|
11665
|
-
}
|
|
11634
|
+
if (config.withShield !== false && (typeof config.withShield !== "string" || !existsSync(joinPaths(outputDir, config.withShield)) && !existsSync(joinPaths(outputDir, `${config.withShield}.ts`)) && !existsSync(joinPaths(outputDir, config.withShield, "shield.ts")))) {
|
|
11635
|
+
consoleLog(`Generating tRPC Shield source file to ${outputDir}`);
|
|
11636
|
+
await writeFileSafely(joinPaths(outputDir, "shield.ts"), await constructShield({
|
|
11637
|
+
queries,
|
|
11638
|
+
mutations,
|
|
11639
|
+
subscriptions
|
|
11640
|
+
}, config, options, outputDir));
|
|
11666
11641
|
} else {
|
|
11667
11642
|
consoleLog("Skipping tRPC Shield generation");
|
|
11668
11643
|
}
|
|
11669
11644
|
consoleLog(`Generating tRPC source code for ${models.length} models`);
|
|
11670
11645
|
if (config.trpcOptions && typeof config.trpcOptions === "boolean") {
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
await writeFileSafely(trpcOptionsOutputPath, constructDefaultOptions(config, options, trpcOptionsOutputPath));
|
|
11646
|
+
consoleLog(`Generating tRPC options source file to ${outputDir}`);
|
|
11647
|
+
await writeFileSafely(joinPaths(outputDir, "options.ts"), constructDefaultOptions(config, options, outputDir));
|
|
11674
11648
|
}
|
|
11675
11649
|
resolveModelsComments(models, hiddenModels);
|
|
11676
11650
|
consoleLog("Generating tRPC export file");
|