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