@stryke/prisma-trpc-generator 0.5.0 → 0.5.2
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 +385 -374
- package/dist/generator.js +386 -375
- package/dist/index.cjs +385 -374
- package/dist/index.js +386 -375
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6899,217 +6899,39 @@ var configSchema = z.object({
|
|
|
6899
6899
|
// src/helpers.ts
|
|
6900
6900
|
init_cjs_shims();
|
|
6901
6901
|
|
|
6902
|
-
// src/
|
|
6903
|
-
init_cjs_shims();
|
|
6904
|
-
|
|
6905
|
-
// src/utils/get-jiti.ts
|
|
6906
|
-
init_cjs_shims();
|
|
6907
|
-
|
|
6908
|
-
// ../env/src/get-env-paths.ts
|
|
6909
|
-
init_cjs_shims();
|
|
6910
|
-
|
|
6911
|
-
// ../string-format/src/title-case.ts
|
|
6912
|
-
init_cjs_shims();
|
|
6913
|
-
|
|
6914
|
-
// ../string-format/src/acronyms.ts
|
|
6915
|
-
init_cjs_shims();
|
|
6916
|
-
var ACRONYMS = [
|
|
6917
|
-
"API",
|
|
6918
|
-
"CPU",
|
|
6919
|
-
"CSS",
|
|
6920
|
-
"DNS",
|
|
6921
|
-
"EOF",
|
|
6922
|
-
"GUID",
|
|
6923
|
-
"HTML",
|
|
6924
|
-
"HTTP",
|
|
6925
|
-
"HTTPS",
|
|
6926
|
-
"ID",
|
|
6927
|
-
"IP",
|
|
6928
|
-
"JSON",
|
|
6929
|
-
"LHS",
|
|
6930
|
-
"OEM",
|
|
6931
|
-
"PP",
|
|
6932
|
-
"QA",
|
|
6933
|
-
"RAM",
|
|
6934
|
-
"RHS",
|
|
6935
|
-
"RPC",
|
|
6936
|
-
"RSS",
|
|
6937
|
-
"SLA",
|
|
6938
|
-
"SMTP",
|
|
6939
|
-
"SQL",
|
|
6940
|
-
"SSH",
|
|
6941
|
-
"SSL",
|
|
6942
|
-
"TCP",
|
|
6943
|
-
"TLS",
|
|
6944
|
-
"TRPC",
|
|
6945
|
-
"TTL",
|
|
6946
|
-
"UDP",
|
|
6947
|
-
"UI",
|
|
6948
|
-
"UID",
|
|
6949
|
-
"UUID",
|
|
6950
|
-
"URI",
|
|
6951
|
-
"URL",
|
|
6952
|
-
"UTF",
|
|
6953
|
-
"VM",
|
|
6954
|
-
"XML",
|
|
6955
|
-
"XSS",
|
|
6956
|
-
"XSRF"
|
|
6957
|
-
];
|
|
6958
|
-
|
|
6959
|
-
// ../string-format/src/upper-case-first.ts
|
|
6960
|
-
init_cjs_shims();
|
|
6961
|
-
var upperCaseFirst = /* @__PURE__ */ __name((input) => {
|
|
6962
|
-
return input ? input.charAt(0).toUpperCase() + input.slice(1) : input;
|
|
6963
|
-
}, "upperCaseFirst");
|
|
6964
|
-
|
|
6965
|
-
// ../string-format/src/title-case.ts
|
|
6966
|
-
var titleCase = /* @__PURE__ */ __name((input) => {
|
|
6967
|
-
if (!input) {
|
|
6968
|
-
return "";
|
|
6969
|
-
}
|
|
6970
|
-
return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
|
|
6971
|
-
}, "titleCase");
|
|
6972
|
-
|
|
6973
|
-
// ../type-checks/src/is-string.ts
|
|
6974
|
-
init_cjs_shims();
|
|
6975
|
-
var isString = /* @__PURE__ */ __name((value) => {
|
|
6976
|
-
try {
|
|
6977
|
-
return typeof value === "string";
|
|
6978
|
-
} catch {
|
|
6979
|
-
return false;
|
|
6980
|
-
}
|
|
6981
|
-
}, "isString");
|
|
6982
|
-
|
|
6983
|
-
// ../env/src/get-env-paths.ts
|
|
6984
|
-
var import_node_os = __toESM(require("node:os"), 1);
|
|
6985
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
6986
|
-
var homedir = import_node_os.default.homedir();
|
|
6987
|
-
var tmpdir = import_node_os.default.tmpdir();
|
|
6988
|
-
var macos = /* @__PURE__ */ __name((orgId) => {
|
|
6989
|
-
const library = joinPaths(homedir, "Library");
|
|
6990
|
-
return {
|
|
6991
|
-
data: joinPaths(library, "Application Support", orgId),
|
|
6992
|
-
config: joinPaths(library, "Preferences", orgId),
|
|
6993
|
-
cache: joinPaths(library, "Caches", orgId),
|
|
6994
|
-
log: joinPaths(library, "Logs", orgId),
|
|
6995
|
-
temp: joinPaths(tmpdir, orgId)
|
|
6996
|
-
};
|
|
6997
|
-
}, "macos");
|
|
6998
|
-
var windows = /* @__PURE__ */ __name((orgId) => {
|
|
6999
|
-
const appData = process.env.APPDATA || joinPaths(homedir, "AppData", "Roaming");
|
|
7000
|
-
const localAppData = process.env.LOCALAPPDATA || joinPaths(homedir, "AppData", "Local");
|
|
7001
|
-
const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\s+/g, "");
|
|
7002
|
-
return {
|
|
7003
|
-
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
7004
|
-
data: joinPaths(localAppData, windowsFormattedOrgId, "Data"),
|
|
7005
|
-
config: joinPaths(appData, windowsFormattedOrgId, "Config"),
|
|
7006
|
-
cache: joinPaths(localAppData, "Cache", orgId),
|
|
7007
|
-
log: joinPaths(localAppData, windowsFormattedOrgId, "Log"),
|
|
7008
|
-
temp: joinPaths(tmpdir, orgId)
|
|
7009
|
-
};
|
|
7010
|
-
}, "windows");
|
|
7011
|
-
var linux = /* @__PURE__ */ __name((orgId) => {
|
|
7012
|
-
const username = import_node_path.default.basename(homedir);
|
|
7013
|
-
return {
|
|
7014
|
-
data: joinPaths(process.env.XDG_DATA_HOME || joinPaths(homedir, ".local", "share"), orgId),
|
|
7015
|
-
config: joinPaths(process.env.XDG_CONFIG_HOME || joinPaths(homedir, ".config"), orgId),
|
|
7016
|
-
cache: joinPaths(process.env.XDG_CACHE_HOME || joinPaths(homedir, ".cache"), orgId),
|
|
7017
|
-
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
7018
|
-
log: joinPaths(process.env.XDG_STATE_HOME || joinPaths(homedir, ".local", "state"), orgId),
|
|
7019
|
-
temp: joinPaths(tmpdir, username, orgId)
|
|
7020
|
-
};
|
|
7021
|
-
}, "linux");
|
|
7022
|
-
function getEnvPaths(options = {}) {
|
|
7023
|
-
let orgId = options.orgId || "storm-software";
|
|
7024
|
-
if (!orgId) {
|
|
7025
|
-
throw new Error("You need to provide an orgId to the `getEnvPaths` function");
|
|
7026
|
-
}
|
|
7027
|
-
if (options.suffix) {
|
|
7028
|
-
orgId += `-${isString(options.suffix) ? options.suffix : "nodejs"}`;
|
|
7029
|
-
}
|
|
7030
|
-
let result = {};
|
|
7031
|
-
if (process.platform === "darwin") {
|
|
7032
|
-
result = macos(orgId);
|
|
7033
|
-
} else if (process.platform === "win32") {
|
|
7034
|
-
result = windows(orgId);
|
|
7035
|
-
} else {
|
|
7036
|
-
result = linux(orgId);
|
|
7037
|
-
}
|
|
7038
|
-
if (process.env.STORM_DATA_DIRECTORY) {
|
|
7039
|
-
result.data = process.env.STORM_DATA_DIRECTORY;
|
|
7040
|
-
} else if (process.env.STORM_CONFIG_DIRECTORY) {
|
|
7041
|
-
result.config = process.env.STORM_CONFIG_DIRECTORY;
|
|
7042
|
-
} else if (process.env.STORM_CACHE_DIRECTORY) {
|
|
7043
|
-
result.cache = process.env.STORM_CACHE_DIRECTORY;
|
|
7044
|
-
} else if (process.env.STORM_LOG_DIRECTORY) {
|
|
7045
|
-
result.log = process.env.STORM_LOG_DIRECTORY;
|
|
7046
|
-
} else if (process.env.STORM_TEMP_DIRECTORY) {
|
|
7047
|
-
result.temp = process.env.STORM_TEMP_DIRECTORY;
|
|
7048
|
-
}
|
|
7049
|
-
if (options.workspaceRoot) {
|
|
7050
|
-
result.cache ??= joinPaths(options.workspaceRoot, "node_modules", ".cache", orgId);
|
|
7051
|
-
result.temp ??= joinPaths(options.workspaceRoot, "tmp", orgId);
|
|
7052
|
-
result.log ??= joinPaths(result.temp, "logs");
|
|
7053
|
-
result.config ??= joinPaths(options.workspaceRoot, ".config", orgId);
|
|
7054
|
-
}
|
|
7055
|
-
return Object.keys(result).reduce((ret, key) => {
|
|
7056
|
-
if (result[key]) {
|
|
7057
|
-
const filePath = result[key];
|
|
7058
|
-
ret[key] = options.appId && options.appId !== options.orgId && options.appId !== options.nestedDir ? joinPaths(filePath, options.appId) : filePath;
|
|
7059
|
-
if (options.nestedDir && options.nestedDir !== options.orgId && options.nestedDir !== options.appId) {
|
|
7060
|
-
ret[key] = joinPaths(ret[key], options.nestedDir);
|
|
7061
|
-
}
|
|
7062
|
-
}
|
|
7063
|
-
return ret;
|
|
7064
|
-
}, {});
|
|
7065
|
-
}
|
|
7066
|
-
__name(getEnvPaths, "getEnvPaths");
|
|
7067
|
-
|
|
7068
|
-
// ../path/src/get-workspace-root.ts
|
|
7069
|
-
init_cjs_shims();
|
|
7070
|
-
|
|
7071
|
-
// ../../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
|
|
6902
|
+
// ../path/src/file-path-fns.ts
|
|
7072
6903
|
init_cjs_shims();
|
|
7073
6904
|
|
|
7074
|
-
//
|
|
6905
|
+
// ../types/src/base.ts
|
|
7075
6906
|
init_cjs_shims();
|
|
6907
|
+
var EMPTY_STRING = "";
|
|
6908
|
+
var $NestedValue = Symbol("NestedValue");
|
|
7076
6909
|
|
|
7077
|
-
//
|
|
6910
|
+
// ../path/src/correct-path.ts
|
|
7078
6911
|
init_cjs_shims();
|
|
7079
6912
|
|
|
7080
|
-
//
|
|
6913
|
+
// ../path/src/is-file.ts
|
|
7081
6914
|
init_cjs_shims();
|
|
7082
|
-
var __defProp2 = Object.defineProperty;
|
|
7083
|
-
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
|
|
7084
|
-
value,
|
|
7085
|
-
configurable: true
|
|
7086
|
-
}), "__name");
|
|
7087
|
-
|
|
7088
|
-
// ../../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
|
|
7089
6915
|
var import_node_fs2 = require("node:fs");
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
const _startPath = startPath ?? process.cwd();
|
|
7095
|
-
if (endDirectoryNames.some((endDirName) => (0, import_node_fs2.existsSync)((0, import_node_path2.join)(_startPath, endDirName)))) {
|
|
7096
|
-
return _startPath;
|
|
7097
|
-
}
|
|
7098
|
-
if (endFileNames.some((endFileName) => (0, import_node_fs2.existsSync)((0, import_node_path2.join)(_startPath, endFileName)))) {
|
|
7099
|
-
return _startPath;
|
|
7100
|
-
}
|
|
7101
|
-
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
7102
|
-
const parent = (0, import_node_path2.join)(_startPath, "..");
|
|
7103
|
-
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
7104
|
-
}
|
|
7105
|
-
return void 0;
|
|
6916
|
+
function isFile(path6, additionalPath) {
|
|
6917
|
+
return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
|
|
6918
|
+
throwIfNoEntry: false
|
|
6919
|
+
})?.isFile());
|
|
7106
6920
|
}
|
|
7107
|
-
__name(
|
|
7108
|
-
|
|
6921
|
+
__name(isFile, "isFile");
|
|
6922
|
+
function isDirectory(path6, additionalPath) {
|
|
6923
|
+
return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
|
|
6924
|
+
throwIfNoEntry: false
|
|
6925
|
+
})?.isDirectory());
|
|
6926
|
+
}
|
|
6927
|
+
__name(isDirectory, "isDirectory");
|
|
6928
|
+
function isAbsolutePath(path6) {
|
|
6929
|
+
return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path6);
|
|
6930
|
+
}
|
|
6931
|
+
__name(isAbsolutePath, "isAbsolutePath");
|
|
7109
6932
|
|
|
7110
|
-
//
|
|
7111
|
-
|
|
7112
|
-
var _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
|
|
6933
|
+
// ../path/src/correct-path.ts
|
|
6934
|
+
var _DRIVE_LETTER_START_RE2 = /^[A-Z]:\//i;
|
|
7113
6935
|
function normalizeWindowsPath2(input = "") {
|
|
7114
6936
|
if (!input) {
|
|
7115
6937
|
return input;
|
|
@@ -7117,17 +6939,15 @@ function normalizeWindowsPath2(input = "") {
|
|
|
7117
6939
|
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
|
|
7118
6940
|
}
|
|
7119
6941
|
__name(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
7120
|
-
__name2(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
7121
6942
|
var _UNC_REGEX2 = /^[/\\]{2}/;
|
|
7122
|
-
var
|
|
7123
|
-
|
|
7124
|
-
var correctPaths2 = /* @__PURE__ */ __name2(function(path6) {
|
|
6943
|
+
var _DRIVE_LETTER_RE2 = /^[A-Z]:$/i;
|
|
6944
|
+
function correctPath(path6) {
|
|
7125
6945
|
if (!path6 || path6.length === 0) {
|
|
7126
6946
|
return ".";
|
|
7127
6947
|
}
|
|
7128
6948
|
path6 = normalizeWindowsPath2(path6);
|
|
7129
6949
|
const isUNCPath = path6.match(_UNC_REGEX2);
|
|
7130
|
-
const isPathAbsolute =
|
|
6950
|
+
const isPathAbsolute = isAbsolutePath(path6);
|
|
7131
6951
|
const trailingSeparator = path6[path6.length - 1] === "/";
|
|
7132
6952
|
path6 = normalizeString2(path6, !isPathAbsolute);
|
|
7133
6953
|
if (path6.length === 0) {
|
|
@@ -7148,16 +6968,9 @@ var correctPaths2 = /* @__PURE__ */ __name2(function(path6) {
|
|
|
7148
6968
|
}
|
|
7149
6969
|
return `//${path6}`;
|
|
7150
6970
|
}
|
|
7151
|
-
return isPathAbsolute && !
|
|
7152
|
-
}, "correctPaths");
|
|
7153
|
-
function cwd() {
|
|
7154
|
-
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
7155
|
-
return process.cwd().replace(/\\/g, "/");
|
|
7156
|
-
}
|
|
7157
|
-
return "/";
|
|
6971
|
+
return isPathAbsolute && !isAbsolutePath(path6) ? `/${path6}` : path6;
|
|
7158
6972
|
}
|
|
7159
|
-
__name(
|
|
7160
|
-
__name2(cwd, "cwd");
|
|
6973
|
+
__name(correctPath, "correctPath");
|
|
7161
6974
|
function normalizeString2(path6, allowAboveRoot) {
|
|
7162
6975
|
let res = "";
|
|
7163
6976
|
let lastSegmentLength = 0;
|
|
@@ -7219,110 +7032,52 @@ function normalizeString2(path6, allowAboveRoot) {
|
|
|
7219
7032
|
return res;
|
|
7220
7033
|
}
|
|
7221
7034
|
__name(normalizeString2, "normalizeString");
|
|
7222
|
-
__name2(normalizeString2, "normalizeString");
|
|
7223
|
-
var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
|
|
7224
|
-
return _IS_ABSOLUTE_RE2.test(p);
|
|
7225
|
-
}, "isAbsolute");
|
|
7226
|
-
|
|
7227
|
-
// ../../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
|
|
7228
|
-
var rootFiles = [
|
|
7229
|
-
"storm-workspace.json",
|
|
7230
|
-
"storm-workspace.json",
|
|
7231
|
-
"storm-workspace.yaml",
|
|
7232
|
-
"storm-workspace.yml",
|
|
7233
|
-
"storm-workspace.js",
|
|
7234
|
-
"storm-workspace.ts",
|
|
7235
|
-
".storm-workspace.json",
|
|
7236
|
-
".storm-workspace.yaml",
|
|
7237
|
-
".storm-workspace.yml",
|
|
7238
|
-
".storm-workspace.js",
|
|
7239
|
-
".storm-workspace.ts",
|
|
7240
|
-
"lerna.json",
|
|
7241
|
-
"nx.json",
|
|
7242
|
-
"turbo.json",
|
|
7243
|
-
"npm-workspace.json",
|
|
7244
|
-
"yarn-workspace.json",
|
|
7245
|
-
"pnpm-workspace.json",
|
|
7246
|
-
"npm-workspace.yaml",
|
|
7247
|
-
"yarn-workspace.yaml",
|
|
7248
|
-
"pnpm-workspace.yaml",
|
|
7249
|
-
"npm-workspace.yml",
|
|
7250
|
-
"yarn-workspace.yml",
|
|
7251
|
-
"pnpm-workspace.yml",
|
|
7252
|
-
"npm-lock.json",
|
|
7253
|
-
"yarn-lock.json",
|
|
7254
|
-
"pnpm-lock.json",
|
|
7255
|
-
"npm-lock.yaml",
|
|
7256
|
-
"yarn-lock.yaml",
|
|
7257
|
-
"pnpm-lock.yaml",
|
|
7258
|
-
"npm-lock.yml",
|
|
7259
|
-
"yarn-lock.yml",
|
|
7260
|
-
"pnpm-lock.yml",
|
|
7261
|
-
"bun.lockb"
|
|
7262
|
-
];
|
|
7263
|
-
var rootDirectories = [
|
|
7264
|
-
".storm-workspace",
|
|
7265
|
-
".nx",
|
|
7266
|
-
".github",
|
|
7267
|
-
".vscode",
|
|
7268
|
-
".verdaccio"
|
|
7269
|
-
];
|
|
7270
|
-
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
7271
|
-
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
7272
|
-
return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
7273
|
-
}
|
|
7274
|
-
return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
7275
|
-
}
|
|
7276
|
-
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
7277
|
-
__name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
7278
|
-
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
7279
|
-
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
7280
|
-
if (!result) {
|
|
7281
|
-
throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
|
|
7282
|
-
${rootFiles.join("\n")}
|
|
7283
|
-
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
|
|
7284
|
-
}
|
|
7285
|
-
return result;
|
|
7286
|
-
}
|
|
7287
|
-
__name(findWorkspaceRoot, "findWorkspaceRoot");
|
|
7288
|
-
__name2(findWorkspaceRoot, "findWorkspaceRoot");
|
|
7289
7035
|
|
|
7290
|
-
// ../path/src/get-
|
|
7036
|
+
// ../path/src/get-workspace-root.ts
|
|
7291
7037
|
init_cjs_shims();
|
|
7292
7038
|
|
|
7293
|
-
//
|
|
7039
|
+
// ../../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
|
|
7294
7040
|
init_cjs_shims();
|
|
7295
7041
|
|
|
7296
|
-
//
|
|
7042
|
+
// ../../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
|
|
7297
7043
|
init_cjs_shims();
|
|
7298
|
-
var EMPTY_STRING = "";
|
|
7299
|
-
var $NestedValue = Symbol("NestedValue");
|
|
7300
7044
|
|
|
7301
|
-
//
|
|
7045
|
+
// ../../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
|
|
7302
7046
|
init_cjs_shims();
|
|
7303
7047
|
|
|
7304
|
-
//
|
|
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-SHUYVCID.js
|
|
7305
7049
|
init_cjs_shims();
|
|
7050
|
+
var __defProp2 = Object.defineProperty;
|
|
7051
|
+
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
|
|
7052
|
+
value,
|
|
7053
|
+
configurable: true
|
|
7054
|
+
}), "__name");
|
|
7055
|
+
|
|
7056
|
+
// ../../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
|
|
7306
7057
|
var import_node_fs3 = require("node:fs");
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
}
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7058
|
+
var import_node_path = require("node:path");
|
|
7059
|
+
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
7060
|
+
var depth = 0;
|
|
7061
|
+
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
7062
|
+
const _startPath = startPath ?? process.cwd();
|
|
7063
|
+
if (endDirectoryNames.some((endDirName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endDirName)))) {
|
|
7064
|
+
return _startPath;
|
|
7065
|
+
}
|
|
7066
|
+
if (endFileNames.some((endFileName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
|
|
7067
|
+
return _startPath;
|
|
7068
|
+
}
|
|
7069
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
7070
|
+
const parent = (0, import_node_path.join)(_startPath, "..");
|
|
7071
|
+
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
7072
|
+
}
|
|
7073
|
+
return void 0;
|
|
7321
7074
|
}
|
|
7322
|
-
__name(
|
|
7075
|
+
__name(findFolderUp, "findFolderUp");
|
|
7076
|
+
__name2(findFolderUp, "findFolderUp");
|
|
7323
7077
|
|
|
7324
|
-
//
|
|
7325
|
-
|
|
7078
|
+
// ../../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
|
|
7079
|
+
init_cjs_shims();
|
|
7080
|
+
var _DRIVE_LETTER_START_RE3 = /^[A-Za-z]:\//;
|
|
7326
7081
|
function normalizeWindowsPath3(input = "") {
|
|
7327
7082
|
if (!input) {
|
|
7328
7083
|
return input;
|
|
@@ -7330,15 +7085,17 @@ function normalizeWindowsPath3(input = "") {
|
|
|
7330
7085
|
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE3, (r) => r.toUpperCase());
|
|
7331
7086
|
}
|
|
7332
7087
|
__name(normalizeWindowsPath3, "normalizeWindowsPath");
|
|
7088
|
+
__name2(normalizeWindowsPath3, "normalizeWindowsPath");
|
|
7333
7089
|
var _UNC_REGEX3 = /^[/\\]{2}/;
|
|
7334
|
-
var
|
|
7335
|
-
|
|
7090
|
+
var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
7091
|
+
var _DRIVE_LETTER_RE3 = /^[A-Za-z]:$/;
|
|
7092
|
+
var correctPaths2 = /* @__PURE__ */ __name2(function(path6) {
|
|
7336
7093
|
if (!path6 || path6.length === 0) {
|
|
7337
7094
|
return ".";
|
|
7338
7095
|
}
|
|
7339
7096
|
path6 = normalizeWindowsPath3(path6);
|
|
7340
7097
|
const isUNCPath = path6.match(_UNC_REGEX3);
|
|
7341
|
-
const isPathAbsolute =
|
|
7098
|
+
const isPathAbsolute = isAbsolute2(path6);
|
|
7342
7099
|
const trailingSeparator = path6[path6.length - 1] === "/";
|
|
7343
7100
|
path6 = normalizeString3(path6, !isPathAbsolute);
|
|
7344
7101
|
if (path6.length === 0) {
|
|
@@ -7359,9 +7116,16 @@ function correctPath(path6) {
|
|
|
7359
7116
|
}
|
|
7360
7117
|
return `//${path6}`;
|
|
7361
7118
|
}
|
|
7362
|
-
return isPathAbsolute && !
|
|
7119
|
+
return isPathAbsolute && !isAbsolute2(path6) ? `/${path6}` : path6;
|
|
7120
|
+
}, "correctPaths");
|
|
7121
|
+
function cwd() {
|
|
7122
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
7123
|
+
return process.cwd().replace(/\\/g, "/");
|
|
7124
|
+
}
|
|
7125
|
+
return "/";
|
|
7363
7126
|
}
|
|
7364
|
-
__name(
|
|
7127
|
+
__name(cwd, "cwd");
|
|
7128
|
+
__name2(cwd, "cwd");
|
|
7365
7129
|
function normalizeString3(path6, allowAboveRoot) {
|
|
7366
7130
|
let res = "";
|
|
7367
7131
|
let lastSegmentLength = 0;
|
|
@@ -7423,51 +7187,76 @@ function normalizeString3(path6, allowAboveRoot) {
|
|
|
7423
7187
|
return res;
|
|
7424
7188
|
}
|
|
7425
7189
|
__name(normalizeString3, "normalizeString");
|
|
7190
|
+
__name2(normalizeString3, "normalizeString");
|
|
7191
|
+
var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
|
|
7192
|
+
return _IS_ABSOLUTE_RE2.test(p);
|
|
7193
|
+
}, "isAbsolute");
|
|
7426
7194
|
|
|
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
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7195
|
+
// ../../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
|
|
7196
|
+
var rootFiles = [
|
|
7197
|
+
"storm-workspace.json",
|
|
7198
|
+
"storm-workspace.json",
|
|
7199
|
+
"storm-workspace.yaml",
|
|
7200
|
+
"storm-workspace.yml",
|
|
7201
|
+
"storm-workspace.js",
|
|
7202
|
+
"storm-workspace.ts",
|
|
7203
|
+
".storm-workspace.json",
|
|
7204
|
+
".storm-workspace.yaml",
|
|
7205
|
+
".storm-workspace.yml",
|
|
7206
|
+
".storm-workspace.js",
|
|
7207
|
+
".storm-workspace.ts",
|
|
7208
|
+
"lerna.json",
|
|
7209
|
+
"nx.json",
|
|
7210
|
+
"turbo.json",
|
|
7211
|
+
"npm-workspace.json",
|
|
7212
|
+
"yarn-workspace.json",
|
|
7213
|
+
"pnpm-workspace.json",
|
|
7214
|
+
"npm-workspace.yaml",
|
|
7215
|
+
"yarn-workspace.yaml",
|
|
7216
|
+
"pnpm-workspace.yaml",
|
|
7217
|
+
"npm-workspace.yml",
|
|
7218
|
+
"yarn-workspace.yml",
|
|
7219
|
+
"pnpm-workspace.yml",
|
|
7220
|
+
"npm-lock.json",
|
|
7221
|
+
"yarn-lock.json",
|
|
7222
|
+
"pnpm-lock.json",
|
|
7223
|
+
"npm-lock.yaml",
|
|
7224
|
+
"yarn-lock.yaml",
|
|
7225
|
+
"pnpm-lock.yaml",
|
|
7226
|
+
"npm-lock.yml",
|
|
7227
|
+
"yarn-lock.yml",
|
|
7228
|
+
"pnpm-lock.yml",
|
|
7229
|
+
"bun.lockb"
|
|
7230
|
+
];
|
|
7231
|
+
var rootDirectories = [
|
|
7232
|
+
".storm-workspace",
|
|
7233
|
+
".nx",
|
|
7234
|
+
".github",
|
|
7235
|
+
".vscode",
|
|
7236
|
+
".verdaccio"
|
|
7237
|
+
];
|
|
7238
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
7239
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
7240
|
+
return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
7461
7241
|
}
|
|
7462
|
-
return
|
|
7242
|
+
return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
7463
7243
|
}
|
|
7464
|
-
__name(
|
|
7465
|
-
|
|
7466
|
-
|
|
7244
|
+
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
7245
|
+
__name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
7246
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
7247
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
7248
|
+
if (!result) {
|
|
7249
|
+
throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
|
|
7250
|
+
${rootFiles.join("\n")}
|
|
7251
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
|
|
7252
|
+
}
|
|
7253
|
+
return result;
|
|
7467
7254
|
}
|
|
7468
|
-
__name(
|
|
7255
|
+
__name(findWorkspaceRoot, "findWorkspaceRoot");
|
|
7256
|
+
__name2(findWorkspaceRoot, "findWorkspaceRoot");
|
|
7469
7257
|
|
|
7470
7258
|
// ../path/src/get-parent-path.ts
|
|
7259
|
+
init_cjs_shims();
|
|
7471
7260
|
var resolveParentPath = /* @__PURE__ */ __name((path6) => {
|
|
7472
7261
|
return resolvePaths(path6, "..");
|
|
7473
7262
|
}, "resolveParentPath");
|
|
@@ -7555,6 +7344,237 @@ var getWorkspaceRoot = /* @__PURE__ */ __name((dir = process.cwd()) => {
|
|
|
7555
7344
|
return dir;
|
|
7556
7345
|
}, "getWorkspaceRoot");
|
|
7557
7346
|
|
|
7347
|
+
// ../path/src/file-path-fns.ts
|
|
7348
|
+
function findFileName(filePath, { requireExtension, withExtension } = {}) {
|
|
7349
|
+
const result = normalizeWindowsPath2(filePath)?.split(filePath?.includes("\\") ? "\\" : "/")?.pop() ?? "";
|
|
7350
|
+
if (requireExtension === true && !result.includes(".")) {
|
|
7351
|
+
return EMPTY_STRING;
|
|
7352
|
+
}
|
|
7353
|
+
if (withExtension === false && result.includes(".")) {
|
|
7354
|
+
return result.split(".").slice(-1).join(".") || EMPTY_STRING;
|
|
7355
|
+
}
|
|
7356
|
+
return result;
|
|
7357
|
+
}
|
|
7358
|
+
__name(findFileName, "findFileName");
|
|
7359
|
+
function findFilePath(filePath) {
|
|
7360
|
+
const normalizedPath = normalizeWindowsPath2(filePath);
|
|
7361
|
+
return normalizedPath.replace(findFileName(normalizedPath, {
|
|
7362
|
+
requireExtension: true
|
|
7363
|
+
}), "");
|
|
7364
|
+
}
|
|
7365
|
+
__name(findFilePath, "findFilePath");
|
|
7366
|
+
function resolvePath(path6, cwd2 = getWorkspaceRoot()) {
|
|
7367
|
+
const paths = normalizeWindowsPath2(path6).split("/");
|
|
7368
|
+
let resolvedPath = "";
|
|
7369
|
+
let resolvedAbsolute = false;
|
|
7370
|
+
for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
7371
|
+
const path7 = index >= 0 ? paths[index] : cwd2;
|
|
7372
|
+
if (!path7 || path7.length === 0) {
|
|
7373
|
+
continue;
|
|
7374
|
+
}
|
|
7375
|
+
resolvedPath = joinPaths(path7, resolvedPath);
|
|
7376
|
+
resolvedAbsolute = isAbsolutePath(path7);
|
|
7377
|
+
}
|
|
7378
|
+
resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute);
|
|
7379
|
+
if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {
|
|
7380
|
+
return `/${resolvedPath}`;
|
|
7381
|
+
}
|
|
7382
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
7383
|
+
}
|
|
7384
|
+
__name(resolvePath, "resolvePath");
|
|
7385
|
+
function resolvePaths(...paths) {
|
|
7386
|
+
return resolvePath(joinPaths(...paths.map((path6) => normalizeWindowsPath2(path6))));
|
|
7387
|
+
}
|
|
7388
|
+
__name(resolvePaths, "resolvePaths");
|
|
7389
|
+
function relativePath(from, to) {
|
|
7390
|
+
const _from = resolvePath(from).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
|
|
7391
|
+
const _to = resolvePath(to).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
|
|
7392
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
7393
|
+
return _to.join("/");
|
|
7394
|
+
}
|
|
7395
|
+
const _fromCopy = [
|
|
7396
|
+
..._from
|
|
7397
|
+
];
|
|
7398
|
+
for (const segment of _fromCopy) {
|
|
7399
|
+
if (_to[0] !== segment) {
|
|
7400
|
+
break;
|
|
7401
|
+
}
|
|
7402
|
+
_from.shift();
|
|
7403
|
+
_to.shift();
|
|
7404
|
+
}
|
|
7405
|
+
return [
|
|
7406
|
+
..._from.map(() => ".."),
|
|
7407
|
+
..._to
|
|
7408
|
+
].join("/");
|
|
7409
|
+
}
|
|
7410
|
+
__name(relativePath, "relativePath");
|
|
7411
|
+
|
|
7412
|
+
// src/utils/get-prisma-internals.ts
|
|
7413
|
+
init_cjs_shims();
|
|
7414
|
+
|
|
7415
|
+
// src/utils/get-jiti.ts
|
|
7416
|
+
init_cjs_shims();
|
|
7417
|
+
|
|
7418
|
+
// ../env/src/get-env-paths.ts
|
|
7419
|
+
init_cjs_shims();
|
|
7420
|
+
|
|
7421
|
+
// ../string-format/src/title-case.ts
|
|
7422
|
+
init_cjs_shims();
|
|
7423
|
+
|
|
7424
|
+
// ../string-format/src/acronyms.ts
|
|
7425
|
+
init_cjs_shims();
|
|
7426
|
+
var ACRONYMS = [
|
|
7427
|
+
"API",
|
|
7428
|
+
"CPU",
|
|
7429
|
+
"CSS",
|
|
7430
|
+
"DNS",
|
|
7431
|
+
"EOF",
|
|
7432
|
+
"GUID",
|
|
7433
|
+
"HTML",
|
|
7434
|
+
"HTTP",
|
|
7435
|
+
"HTTPS",
|
|
7436
|
+
"ID",
|
|
7437
|
+
"IP",
|
|
7438
|
+
"JSON",
|
|
7439
|
+
"LHS",
|
|
7440
|
+
"OEM",
|
|
7441
|
+
"PP",
|
|
7442
|
+
"QA",
|
|
7443
|
+
"RAM",
|
|
7444
|
+
"RHS",
|
|
7445
|
+
"RPC",
|
|
7446
|
+
"RSS",
|
|
7447
|
+
"SLA",
|
|
7448
|
+
"SMTP",
|
|
7449
|
+
"SQL",
|
|
7450
|
+
"SSH",
|
|
7451
|
+
"SSL",
|
|
7452
|
+
"TCP",
|
|
7453
|
+
"TLS",
|
|
7454
|
+
"TRPC",
|
|
7455
|
+
"TTL",
|
|
7456
|
+
"UDP",
|
|
7457
|
+
"UI",
|
|
7458
|
+
"UID",
|
|
7459
|
+
"UUID",
|
|
7460
|
+
"URI",
|
|
7461
|
+
"URL",
|
|
7462
|
+
"UTF",
|
|
7463
|
+
"VM",
|
|
7464
|
+
"XML",
|
|
7465
|
+
"XSS",
|
|
7466
|
+
"XSRF"
|
|
7467
|
+
];
|
|
7468
|
+
|
|
7469
|
+
// ../string-format/src/upper-case-first.ts
|
|
7470
|
+
init_cjs_shims();
|
|
7471
|
+
var upperCaseFirst = /* @__PURE__ */ __name((input) => {
|
|
7472
|
+
return input ? input.charAt(0).toUpperCase() + input.slice(1) : input;
|
|
7473
|
+
}, "upperCaseFirst");
|
|
7474
|
+
|
|
7475
|
+
// ../string-format/src/title-case.ts
|
|
7476
|
+
var titleCase = /* @__PURE__ */ __name((input) => {
|
|
7477
|
+
if (!input) {
|
|
7478
|
+
return "";
|
|
7479
|
+
}
|
|
7480
|
+
return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
|
|
7481
|
+
}, "titleCase");
|
|
7482
|
+
|
|
7483
|
+
// ../type-checks/src/is-string.ts
|
|
7484
|
+
init_cjs_shims();
|
|
7485
|
+
var isString = /* @__PURE__ */ __name((value) => {
|
|
7486
|
+
try {
|
|
7487
|
+
return typeof value === "string";
|
|
7488
|
+
} catch {
|
|
7489
|
+
return false;
|
|
7490
|
+
}
|
|
7491
|
+
}, "isString");
|
|
7492
|
+
|
|
7493
|
+
// ../env/src/get-env-paths.ts
|
|
7494
|
+
var import_node_os = __toESM(require("node:os"), 1);
|
|
7495
|
+
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
7496
|
+
var homedir = import_node_os.default.homedir();
|
|
7497
|
+
var tmpdir = import_node_os.default.tmpdir();
|
|
7498
|
+
var macos = /* @__PURE__ */ __name((orgId) => {
|
|
7499
|
+
const library = joinPaths(homedir, "Library");
|
|
7500
|
+
return {
|
|
7501
|
+
data: joinPaths(library, "Application Support", orgId),
|
|
7502
|
+
config: joinPaths(library, "Preferences", orgId),
|
|
7503
|
+
cache: joinPaths(library, "Caches", orgId),
|
|
7504
|
+
log: joinPaths(library, "Logs", orgId),
|
|
7505
|
+
temp: joinPaths(tmpdir, orgId)
|
|
7506
|
+
};
|
|
7507
|
+
}, "macos");
|
|
7508
|
+
var windows = /* @__PURE__ */ __name((orgId) => {
|
|
7509
|
+
const appData = process.env.APPDATA || joinPaths(homedir, "AppData", "Roaming");
|
|
7510
|
+
const localAppData = process.env.LOCALAPPDATA || joinPaths(homedir, "AppData", "Local");
|
|
7511
|
+
const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\s+/g, "");
|
|
7512
|
+
return {
|
|
7513
|
+
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
7514
|
+
data: joinPaths(localAppData, windowsFormattedOrgId, "Data"),
|
|
7515
|
+
config: joinPaths(appData, windowsFormattedOrgId, "Config"),
|
|
7516
|
+
cache: joinPaths(localAppData, "Cache", orgId),
|
|
7517
|
+
log: joinPaths(localAppData, windowsFormattedOrgId, "Log"),
|
|
7518
|
+
temp: joinPaths(tmpdir, orgId)
|
|
7519
|
+
};
|
|
7520
|
+
}, "windows");
|
|
7521
|
+
var linux = /* @__PURE__ */ __name((orgId) => {
|
|
7522
|
+
const username = import_node_path2.default.basename(homedir);
|
|
7523
|
+
return {
|
|
7524
|
+
data: joinPaths(process.env.XDG_DATA_HOME || joinPaths(homedir, ".local", "share"), orgId),
|
|
7525
|
+
config: joinPaths(process.env.XDG_CONFIG_HOME || joinPaths(homedir, ".config"), orgId),
|
|
7526
|
+
cache: joinPaths(process.env.XDG_CACHE_HOME || joinPaths(homedir, ".cache"), orgId),
|
|
7527
|
+
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
7528
|
+
log: joinPaths(process.env.XDG_STATE_HOME || joinPaths(homedir, ".local", "state"), orgId),
|
|
7529
|
+
temp: joinPaths(tmpdir, username, orgId)
|
|
7530
|
+
};
|
|
7531
|
+
}, "linux");
|
|
7532
|
+
function getEnvPaths(options = {}) {
|
|
7533
|
+
let orgId = options.orgId || "storm-software";
|
|
7534
|
+
if (!orgId) {
|
|
7535
|
+
throw new Error("You need to provide an orgId to the `getEnvPaths` function");
|
|
7536
|
+
}
|
|
7537
|
+
if (options.suffix) {
|
|
7538
|
+
orgId += `-${isString(options.suffix) ? options.suffix : "nodejs"}`;
|
|
7539
|
+
}
|
|
7540
|
+
let result = {};
|
|
7541
|
+
if (process.platform === "darwin") {
|
|
7542
|
+
result = macos(orgId);
|
|
7543
|
+
} else if (process.platform === "win32") {
|
|
7544
|
+
result = windows(orgId);
|
|
7545
|
+
} else {
|
|
7546
|
+
result = linux(orgId);
|
|
7547
|
+
}
|
|
7548
|
+
if (process.env.STORM_DATA_DIRECTORY) {
|
|
7549
|
+
result.data = process.env.STORM_DATA_DIRECTORY;
|
|
7550
|
+
} else if (process.env.STORM_CONFIG_DIRECTORY) {
|
|
7551
|
+
result.config = process.env.STORM_CONFIG_DIRECTORY;
|
|
7552
|
+
} else if (process.env.STORM_CACHE_DIRECTORY) {
|
|
7553
|
+
result.cache = process.env.STORM_CACHE_DIRECTORY;
|
|
7554
|
+
} else if (process.env.STORM_LOG_DIRECTORY) {
|
|
7555
|
+
result.log = process.env.STORM_LOG_DIRECTORY;
|
|
7556
|
+
} else if (process.env.STORM_TEMP_DIRECTORY) {
|
|
7557
|
+
result.temp = process.env.STORM_TEMP_DIRECTORY;
|
|
7558
|
+
}
|
|
7559
|
+
if (options.workspaceRoot) {
|
|
7560
|
+
result.cache ??= joinPaths(options.workspaceRoot, "node_modules", ".cache", orgId);
|
|
7561
|
+
result.temp ??= joinPaths(options.workspaceRoot, "tmp", orgId);
|
|
7562
|
+
result.log ??= joinPaths(result.temp, "logs");
|
|
7563
|
+
result.config ??= joinPaths(options.workspaceRoot, ".config", orgId);
|
|
7564
|
+
}
|
|
7565
|
+
return Object.keys(result).reduce((ret, key) => {
|
|
7566
|
+
if (result[key]) {
|
|
7567
|
+
const filePath = result[key];
|
|
7568
|
+
ret[key] = options.appId && options.appId !== options.orgId && options.appId !== options.nestedDir ? joinPaths(filePath, options.appId) : filePath;
|
|
7569
|
+
if (options.nestedDir && options.nestedDir !== options.orgId && options.nestedDir !== options.appId) {
|
|
7570
|
+
ret[key] = joinPaths(ret[key], options.nestedDir);
|
|
7571
|
+
}
|
|
7572
|
+
}
|
|
7573
|
+
return ret;
|
|
7574
|
+
}, {});
|
|
7575
|
+
}
|
|
7576
|
+
__name(getEnvPaths, "getEnvPaths");
|
|
7577
|
+
|
|
7558
7578
|
// src/utils/get-jiti.ts
|
|
7559
7579
|
var import_jiti = require("jiti");
|
|
7560
7580
|
var jiti;
|
|
@@ -7612,12 +7632,6 @@ var generateCreateRouterImport = /* @__PURE__ */ __name(({ sourceFile, config })
|
|
|
7612
7632
|
namedImports: imports
|
|
7613
7633
|
});
|
|
7614
7634
|
}, "generateCreateRouterImport");
|
|
7615
|
-
var generateRPCImport = /* @__PURE__ */ __name((sourceFile) => {
|
|
7616
|
-
sourceFile.addImportDeclaration({
|
|
7617
|
-
moduleSpecifier: "@trpc/server",
|
|
7618
|
-
namespaceImport: "trpc"
|
|
7619
|
-
});
|
|
7620
|
-
}, "generateRPCImport");
|
|
7621
7635
|
var generateShieldImport = /* @__PURE__ */ __name(async (sourceFile, options, value) => {
|
|
7622
7636
|
const internals = await getPrismaInternals();
|
|
7623
7637
|
const outputDir = internals.parseEnvValue(options.generator.output);
|
|
@@ -7671,7 +7685,7 @@ async function generateBaseRouter(sourceFile, config, options) {
|
|
|
7671
7685
|
sourceFile.addStatements(
|
|
7672
7686
|
/* ts */
|
|
7673
7687
|
`
|
|
7674
|
-
export const t =
|
|
7688
|
+
export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});
|
|
7675
7689
|
`
|
|
7676
7690
|
);
|
|
7677
7691
|
const middlewares = [];
|
|
@@ -7813,7 +7827,7 @@ function generateRouterSchemaImports(sourceFile, modelName, modelActions) {
|
|
|
7813
7827
|
}
|
|
7814
7828
|
__name(generateRouterSchemaImports, "generateRouterSchemaImports");
|
|
7815
7829
|
var getRouterSchemaImportByOpName = /* @__PURE__ */ __name((opName, modelName) => {
|
|
7816
|
-
const opType = opName.replace("OrThrow", "");
|
|
7830
|
+
const opType = opName.replace("OrThrow", "").replace("ManyAndReturn", "");
|
|
7817
7831
|
const inputType = getInputTypeByOpName(opType, modelName);
|
|
7818
7832
|
return inputType ? `import { ${inputType} } from "../schemas/${opType}${modelName}.schema"; ` : "";
|
|
7819
7833
|
}, "getRouterSchemaImportByOpName");
|
|
@@ -7839,22 +7853,22 @@ var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
|
|
|
7839
7853
|
inputType = `${modelName}CreateManySchema`;
|
|
7840
7854
|
break;
|
|
7841
7855
|
case "createManyAndReturn":
|
|
7842
|
-
inputType = `${modelName}
|
|
7856
|
+
inputType = `${modelName}CreateManySchema`;
|
|
7843
7857
|
break;
|
|
7844
7858
|
case "deleteOne":
|
|
7845
7859
|
inputType = `${modelName}DeleteOneSchema`;
|
|
7846
7860
|
break;
|
|
7847
|
-
case "updateOne":
|
|
7848
|
-
inputType = `${modelName}UpdateOneSchema`;
|
|
7849
|
-
break;
|
|
7850
7861
|
case "deleteMany":
|
|
7851
7862
|
inputType = `${modelName}DeleteManySchema`;
|
|
7852
7863
|
break;
|
|
7864
|
+
case "updateOne":
|
|
7865
|
+
inputType = `${modelName}UpdateOneSchema`;
|
|
7866
|
+
break;
|
|
7853
7867
|
case "updateMany":
|
|
7854
7868
|
inputType = `${modelName}UpdateManySchema`;
|
|
7855
7869
|
break;
|
|
7856
7870
|
case "updateManyAndReturn":
|
|
7857
|
-
inputType = `${modelName}
|
|
7871
|
+
inputType = `${modelName}UpdateManySchema`;
|
|
7858
7872
|
break;
|
|
7859
7873
|
case "upsertOne":
|
|
7860
7874
|
inputType = `${modelName}UpsertSchema`;
|
|
@@ -7939,7 +7953,7 @@ var getImports = /* @__PURE__ */ __name((type, newPath) => {
|
|
|
7939
7953
|
} else if (type === "trpc-shield") {
|
|
7940
7954
|
statement = "import { shield, allow } from 'trpc-shield';\n";
|
|
7941
7955
|
} else if (type === "context") {
|
|
7942
|
-
statement = `import { Context } from '${newPath}';
|
|
7956
|
+
statement = `import type { Context } from '${newPath}';
|
|
7943
7957
|
`;
|
|
7944
7958
|
}
|
|
7945
7959
|
return statement;
|
|
@@ -7963,7 +7977,7 @@ var wrapWithTrpcShieldCall = /* @__PURE__ */ __name(({ shieldObjectTextWrapped }
|
|
|
7963
7977
|
var wrapWithExport = /* @__PURE__ */ __name(({ shieldObjectText }) => {
|
|
7964
7978
|
return `export const permissions = ${shieldObjectText};`;
|
|
7965
7979
|
}, "wrapWithExport");
|
|
7966
|
-
var constructShield = /* @__PURE__ */ __name(async ({ queries, mutations, subscriptions }, config, options) => {
|
|
7980
|
+
var constructShield = /* @__PURE__ */ __name(async ({ queries, mutations, subscriptions }, config, options, shieldOutputDir) => {
|
|
7967
7981
|
if (queries.length === 0 && mutations.length === 0 && subscriptions.length === 0) {
|
|
7968
7982
|
return "";
|
|
7969
7983
|
}
|
|
@@ -7990,9 +8004,7 @@ var constructShield = /* @__PURE__ */ __name(async ({ queries, mutations, subscr
|
|
|
7990
8004
|
return "";
|
|
7991
8005
|
}
|
|
7992
8006
|
let shieldText = getImports("trpc-shield");
|
|
7993
|
-
|
|
7994
|
-
const outputDir = internals.parseEnvValue(options.generator.output);
|
|
7995
|
-
shieldText += getImports("context", getRelativePath(outputDir, config.contextPath, true, options.schemaPath));
|
|
8007
|
+
shieldText += getImports("context", relativePath(shieldOutputDir, joinPaths(options.schemaPath, config.contextPath)));
|
|
7996
8008
|
shieldText += "\n\n";
|
|
7997
8009
|
shieldText += wrapWithExport({
|
|
7998
8010
|
shieldObjectText: wrapWithTrpcShieldCall({
|
|
@@ -10339,11 +10351,11 @@ var writeFileSafely = /* @__PURE__ */ __name(async (writeLocation, content, addT
|
|
|
10339
10351
|
}, "writeFileSafely");
|
|
10340
10352
|
var writeIndexFile = /* @__PURE__ */ __name(async (indexPath) => {
|
|
10341
10353
|
const rows = Array.from(indexExports).map((filePath) => {
|
|
10342
|
-
let
|
|
10343
|
-
if (
|
|
10344
|
-
|
|
10354
|
+
let relativePath2 = import_node_path4.default.relative(import_node_path4.default.dirname(indexPath), filePath);
|
|
10355
|
+
if (relativePath2.endsWith(".ts")) {
|
|
10356
|
+
relativePath2 = relativePath2.slice(0, relativePath2.lastIndexOf(".ts"));
|
|
10345
10357
|
}
|
|
10346
|
-
const normalized = correctPath(
|
|
10358
|
+
const normalized = correctPath(relativePath2);
|
|
10347
10359
|
return `export * from './${normalized}'`;
|
|
10348
10360
|
});
|
|
10349
10361
|
await writeFileSafely(indexPath, rows.join("\n"), false);
|
|
@@ -11648,7 +11660,7 @@ async function generate(options) {
|
|
|
11648
11660
|
contextPath: config.contextPath
|
|
11649
11661
|
}
|
|
11650
11662
|
}
|
|
11651
|
-
});
|
|
11663
|
+
}, shieldOutputDir);
|
|
11652
11664
|
consoleLog("Saving tRPC Shield source file to disk");
|
|
11653
11665
|
await writeFileSafely(joinPaths(shieldOutputDir, "shield.ts"), shieldText);
|
|
11654
11666
|
} else {
|
|
@@ -11681,7 +11693,6 @@ export default {${config.useTRPCNext ? "\n transformer," : ""}
|
|
|
11681
11693
|
overwrite: true
|
|
11682
11694
|
});
|
|
11683
11695
|
consoleLog("Generating tRPC imports");
|
|
11684
|
-
generateRPCImport(createRouter);
|
|
11685
11696
|
if (config.withShield) {
|
|
11686
11697
|
await generateShieldImport(createRouter, options, config.withShield);
|
|
11687
11698
|
}
|