@stryke/prisma-trpc-generator 0.8.1 → 0.8.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/index.cjs CHANGED
@@ -2499,21 +2499,6 @@ async function removeDirectory(path5) {
2499
2499
  }
2500
2500
  __name(removeDirectory, "removeDirectory");
2501
2501
 
2502
- // ../path/src/file-path-fns.ts
2503
- init_cjs_shims();
2504
-
2505
- // ../types/src/base.ts
2506
- init_cjs_shims();
2507
- var EMPTY_STRING = "";
2508
- var $NestedValue = Symbol("NestedValue");
2509
-
2510
- // ../path/src/correct-path.ts
2511
- init_cjs_shims();
2512
-
2513
- // ../path/src/is-file.ts
2514
- init_cjs_shims();
2515
- var import_node_fs2 = require("node:fs");
2516
-
2517
2502
  // ../path/src/join-paths.ts
2518
2503
  init_cjs_shims();
2519
2504
  var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
@@ -2642,402 +2627,72 @@ function normalizeString(path5, allowAboveRoot) {
2642
2627
  }
2643
2628
  __name(normalizeString, "normalizeString");
2644
2629
 
2645
- // ../path/src/is-file.ts
2646
- function isFile(path5, additionalPath) {
2647
- return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path5) : path5, {
2648
- throwIfNoEntry: false
2649
- })?.isFile());
2650
- }
2651
- __name(isFile, "isFile");
2652
- function isDirectory(path5, additionalPath) {
2653
- return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path5) : path5, {
2654
- throwIfNoEntry: false
2655
- })?.isDirectory());
2656
- }
2657
- __name(isDirectory, "isDirectory");
2658
- function isAbsolutePath(path5) {
2659
- return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path5);
2660
- }
2661
- __name(isAbsolutePath, "isAbsolutePath");
2662
-
2663
- // ../path/src/correct-path.ts
2664
- var _DRIVE_LETTER_START_RE2 = /^[A-Z]:\//i;
2665
- function normalizeWindowsPath2(input = "") {
2666
- if (!input) {
2667
- return input;
2668
- }
2669
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
2670
- }
2671
- __name(normalizeWindowsPath2, "normalizeWindowsPath");
2672
- var _UNC_REGEX2 = /^[/\\]{2}/;
2673
- var _DRIVE_LETTER_RE2 = /^[A-Z]:$/i;
2674
- function correctPath(path5) {
2675
- if (!path5 || path5.length === 0) {
2676
- return ".";
2677
- }
2678
- path5 = normalizeWindowsPath2(path5);
2679
- const isUNCPath = path5.match(_UNC_REGEX2);
2680
- const isPathAbsolute = isAbsolutePath(path5);
2681
- const trailingSeparator = path5[path5.length - 1] === "/";
2682
- path5 = normalizeString2(path5, !isPathAbsolute);
2683
- if (path5.length === 0) {
2684
- if (isPathAbsolute) {
2685
- return "/";
2686
- }
2687
- return trailingSeparator ? "./" : ".";
2688
- }
2689
- if (trailingSeparator) {
2690
- path5 += "/";
2691
- }
2692
- if (_DRIVE_LETTER_RE2.test(path5)) {
2693
- path5 += "/";
2694
- }
2695
- if (isUNCPath) {
2696
- if (!isPathAbsolute) {
2697
- return `//./${path5}`;
2698
- }
2699
- return `//${path5}`;
2700
- }
2701
- return isPathAbsolute && !isAbsolutePath(path5) ? `/${path5}` : path5;
2702
- }
2703
- __name(correctPath, "correctPath");
2704
- function normalizeString2(path5, allowAboveRoot) {
2705
- let res = "";
2706
- let lastSegmentLength = 0;
2707
- let lastSlash = -1;
2708
- let dots = 0;
2709
- let char = null;
2710
- for (let index = 0; index <= path5.length; ++index) {
2711
- if (index < path5.length) {
2712
- char = path5[index];
2713
- } else if (char === "/") {
2714
- break;
2715
- } else {
2716
- char = "/";
2717
- }
2718
- if (char === "/") {
2719
- if (lastSlash === index - 1 || dots === 1) {
2720
- } else if (dots === 2) {
2721
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
2722
- if (res.length > 2) {
2723
- const lastSlashIndex = res.lastIndexOf("/");
2724
- if (lastSlashIndex === -1) {
2725
- res = "";
2726
- lastSegmentLength = 0;
2727
- } else {
2728
- res = res.slice(0, lastSlashIndex);
2729
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
2730
- }
2731
- lastSlash = index;
2732
- dots = 0;
2733
- continue;
2734
- } else if (res.length > 0) {
2735
- res = "";
2736
- lastSegmentLength = 0;
2737
- lastSlash = index;
2738
- dots = 0;
2739
- continue;
2740
- }
2741
- }
2742
- if (allowAboveRoot) {
2743
- res += res.length > 0 ? "/.." : "..";
2744
- lastSegmentLength = 2;
2745
- }
2746
- } else {
2747
- if (res.length > 0) {
2748
- res += `/${path5.slice(lastSlash + 1, index)}`;
2749
- } else {
2750
- res = path5.slice(lastSlash + 1, index);
2751
- }
2752
- lastSegmentLength = index - lastSlash - 1;
2753
- }
2754
- lastSlash = index;
2755
- dots = 0;
2756
- } else if (char === "." && dots !== -1) {
2757
- ++dots;
2758
- } else {
2759
- dots = -1;
2760
- }
2761
- }
2762
- return res;
2763
- }
2764
- __name(normalizeString2, "normalizeString");
2765
-
2766
- // ../path/src/get-workspace-root.ts
2767
- init_cjs_shims();
2768
-
2769
- // ../../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
2770
- init_cjs_shims();
2771
-
2772
- // ../../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
2630
+ // ../string-format/src/lower-case-first.ts
2773
2631
  init_cjs_shims();
2632
+ var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
2633
+ return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
2634
+ }, "lowerCaseFirst");
2774
2635
 
2775
- // ../../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
2776
- init_cjs_shims();
2636
+ // src/prisma-generator.ts
2637
+ var import_node_path5 = __toESM(require("node:path"), 1);
2638
+ var import_pluralize = __toESM(require_pluralize(), 1);
2777
2639
 
2778
- // ../../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
2640
+ // src/config.ts
2779
2641
  init_cjs_shims();
2780
- var __defProp2 = Object.defineProperty;
2781
- var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
2782
- value,
2783
- configurable: true
2784
- }), "__name");
2785
-
2786
- // ../../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
2787
- var import_node_fs3 = require("node:fs");
2788
- var import_node_path = require("node:path");
2789
- var MAX_PATH_SEARCH_DEPTH = 30;
2790
- var depth = 0;
2791
- function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
2792
- const _startPath = startPath ?? process.cwd();
2793
- if (endDirectoryNames.some((endDirName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endDirName)))) {
2794
- return _startPath;
2795
- }
2796
- if (endFileNames.some((endFileName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
2797
- return _startPath;
2798
- }
2799
- if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
2800
- const parent = (0, import_node_path.join)(_startPath, "..");
2801
- return findFolderUp(parent, endFileNames, endDirectoryNames);
2802
- }
2803
- return void 0;
2804
- }
2805
- __name(findFolderUp, "findFolderUp");
2806
- __name2(findFolderUp, "findFolderUp");
2807
2642
 
2808
- // ../../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
2643
+ // ../../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
2809
2644
  init_cjs_shims();
2810
- var _DRIVE_LETTER_START_RE3 = /^[A-Za-z]:\//;
2811
- function normalizeWindowsPath3(input = "") {
2812
- if (!input) {
2813
- return input;
2645
+ var util;
2646
+ (function(util2) {
2647
+ util2.assertEqual = (val) => val;
2648
+ function assertIs(_arg) {
2814
2649
  }
2815
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE3, (r) => r.toUpperCase());
2816
- }
2817
- __name(normalizeWindowsPath3, "normalizeWindowsPath");
2818
- __name2(normalizeWindowsPath3, "normalizeWindowsPath");
2819
- var _UNC_REGEX3 = /^[/\\]{2}/;
2820
- var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
2821
- var _DRIVE_LETTER_RE3 = /^[A-Za-z]:$/;
2822
- var correctPaths2 = /* @__PURE__ */ __name2(function(path5) {
2823
- if (!path5 || path5.length === 0) {
2824
- return ".";
2650
+ __name(assertIs, "assertIs");
2651
+ util2.assertIs = assertIs;
2652
+ function assertNever(_x) {
2653
+ throw new Error();
2825
2654
  }
2826
- path5 = normalizeWindowsPath3(path5);
2827
- const isUNCPath = path5.match(_UNC_REGEX3);
2828
- const isPathAbsolute = isAbsolute2(path5);
2829
- const trailingSeparator = path5[path5.length - 1] === "/";
2830
- path5 = normalizeString3(path5, !isPathAbsolute);
2831
- if (path5.length === 0) {
2832
- if (isPathAbsolute) {
2833
- return "/";
2655
+ __name(assertNever, "assertNever");
2656
+ util2.assertNever = assertNever;
2657
+ util2.arrayToEnum = (items) => {
2658
+ const obj = {};
2659
+ for (const item of items) {
2660
+ obj[item] = item;
2834
2661
  }
2835
- return trailingSeparator ? "./" : ".";
2836
- }
2837
- if (trailingSeparator) {
2838
- path5 += "/";
2839
- }
2840
- if (_DRIVE_LETTER_RE3.test(path5)) {
2841
- path5 += "/";
2842
- }
2843
- if (isUNCPath) {
2844
- if (!isPathAbsolute) {
2845
- return `//./${path5}`;
2662
+ return obj;
2663
+ };
2664
+ util2.getValidEnumValues = (obj) => {
2665
+ const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
2666
+ const filtered = {};
2667
+ for (const k of validKeys) {
2668
+ filtered[k] = obj[k];
2846
2669
  }
2847
- return `//${path5}`;
2848
- }
2849
- return isPathAbsolute && !isAbsolute2(path5) ? `/${path5}` : path5;
2850
- }, "correctPaths");
2851
- function cwd() {
2852
- if (typeof process !== "undefined" && typeof process.cwd === "function") {
2853
- return process.cwd().replace(/\\/g, "/");
2854
- }
2855
- return "/";
2856
- }
2857
- __name(cwd, "cwd");
2858
- __name2(cwd, "cwd");
2859
- function normalizeString3(path5, allowAboveRoot) {
2860
- let res = "";
2861
- let lastSegmentLength = 0;
2862
- let lastSlash = -1;
2863
- let dots = 0;
2864
- let char = null;
2865
- for (let index = 0; index <= path5.length; ++index) {
2866
- if (index < path5.length) {
2867
- char = path5[index];
2868
- } else if (char === "/") {
2869
- break;
2870
- } else {
2871
- char = "/";
2872
- }
2873
- if (char === "/") {
2874
- if (lastSlash === index - 1 || dots === 1) {
2875
- } else if (dots === 2) {
2876
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
2877
- if (res.length > 2) {
2878
- const lastSlashIndex = res.lastIndexOf("/");
2879
- if (lastSlashIndex === -1) {
2880
- res = "";
2881
- lastSegmentLength = 0;
2882
- } else {
2883
- res = res.slice(0, lastSlashIndex);
2884
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
2885
- }
2886
- lastSlash = index;
2887
- dots = 0;
2888
- continue;
2889
- } else if (res.length > 0) {
2890
- res = "";
2891
- lastSegmentLength = 0;
2892
- lastSlash = index;
2893
- dots = 0;
2894
- continue;
2895
- }
2896
- }
2897
- if (allowAboveRoot) {
2898
- res += res.length > 0 ? "/.." : "..";
2899
- lastSegmentLength = 2;
2900
- }
2901
- } else {
2902
- if (res.length > 0) {
2903
- res += `/${path5.slice(lastSlash + 1, index)}`;
2904
- } else {
2905
- res = path5.slice(lastSlash + 1, index);
2906
- }
2907
- lastSegmentLength = index - lastSlash - 1;
2908
- }
2909
- lastSlash = index;
2910
- dots = 0;
2911
- } else if (char === "." && dots !== -1) {
2912
- ++dots;
2913
- } else {
2914
- dots = -1;
2915
- }
2916
- }
2917
- return res;
2918
- }
2919
- __name(normalizeString3, "normalizeString");
2920
- __name2(normalizeString3, "normalizeString");
2921
- var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
2922
- return _IS_ABSOLUTE_RE2.test(p);
2923
- }, "isAbsolute");
2924
-
2925
- // ../../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
2926
- var rootFiles = [
2927
- "storm-workspace.json",
2928
- "storm-workspace.json",
2929
- "storm-workspace.yaml",
2930
- "storm-workspace.yml",
2931
- "storm-workspace.js",
2932
- "storm-workspace.ts",
2933
- ".storm-workspace.json",
2934
- ".storm-workspace.yaml",
2935
- ".storm-workspace.yml",
2936
- ".storm-workspace.js",
2937
- ".storm-workspace.ts",
2938
- "lerna.json",
2939
- "nx.json",
2940
- "turbo.json",
2941
- "npm-workspace.json",
2942
- "yarn-workspace.json",
2943
- "pnpm-workspace.json",
2944
- "npm-workspace.yaml",
2945
- "yarn-workspace.yaml",
2946
- "pnpm-workspace.yaml",
2947
- "npm-workspace.yml",
2948
- "yarn-workspace.yml",
2949
- "pnpm-workspace.yml",
2950
- "npm-lock.json",
2951
- "yarn-lock.json",
2952
- "pnpm-lock.json",
2953
- "npm-lock.yaml",
2954
- "yarn-lock.yaml",
2955
- "pnpm-lock.yaml",
2956
- "npm-lock.yml",
2957
- "yarn-lock.yml",
2958
- "pnpm-lock.yml",
2959
- "bun.lockb"
2960
- ];
2961
- var rootDirectories = [
2962
- ".storm-workspace",
2963
- ".nx",
2964
- ".github",
2965
- ".vscode",
2966
- ".verdaccio"
2967
- ];
2968
- function findWorkspaceRootSafe(pathInsideMonorepo) {
2969
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
2970
- return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
2971
- }
2972
- return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
2973
- }
2974
- __name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
2975
- __name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
2976
- function findWorkspaceRoot(pathInsideMonorepo) {
2977
- const result = findWorkspaceRootSafe(pathInsideMonorepo);
2978
- if (!result) {
2979
- throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
2980
- ${rootFiles.join("\n")}
2981
- Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
2982
- }
2983
- return result;
2984
- }
2985
- __name(findWorkspaceRoot, "findWorkspaceRoot");
2986
- __name2(findWorkspaceRoot, "findWorkspaceRoot");
2987
-
2988
- // ../../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
2989
- init_cjs_shims();
2990
- var util;
2991
- (function(util2) {
2992
- util2.assertEqual = (val) => val;
2993
- function assertIs(_arg) {
2994
- }
2995
- __name(assertIs, "assertIs");
2996
- util2.assertIs = assertIs;
2997
- function assertNever(_x) {
2998
- throw new Error();
2999
- }
3000
- __name(assertNever, "assertNever");
3001
- util2.assertNever = assertNever;
3002
- util2.arrayToEnum = (items) => {
3003
- const obj = {};
3004
- for (const item of items) {
3005
- obj[item] = item;
3006
- }
3007
- return obj;
3008
- };
3009
- util2.getValidEnumValues = (obj) => {
3010
- const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
3011
- const filtered = {};
3012
- for (const k of validKeys) {
3013
- filtered[k] = obj[k];
3014
- }
3015
- return util2.objectValues(filtered);
3016
- };
3017
- util2.objectValues = (obj) => {
3018
- return util2.objectKeys(obj).map(function(e) {
3019
- return obj[e];
3020
- });
3021
- };
3022
- util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
3023
- const keys = [];
3024
- for (const key in object) {
3025
- if (Object.prototype.hasOwnProperty.call(object, key)) {
3026
- keys.push(key);
3027
- }
3028
- }
3029
- return keys;
3030
- };
3031
- util2.find = (arr, checker) => {
3032
- for (const item of arr) {
3033
- if (checker(item))
3034
- return item;
3035
- }
3036
- return void 0;
3037
- };
3038
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
3039
- function joinValues(array, separator = " | ") {
3040
- return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
2670
+ return util2.objectValues(filtered);
2671
+ };
2672
+ util2.objectValues = (obj) => {
2673
+ return util2.objectKeys(obj).map(function(e) {
2674
+ return obj[e];
2675
+ });
2676
+ };
2677
+ util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
2678
+ const keys = [];
2679
+ for (const key in object) {
2680
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
2681
+ keys.push(key);
2682
+ }
2683
+ }
2684
+ return keys;
2685
+ };
2686
+ util2.find = (arr, checker) => {
2687
+ for (const item of arr) {
2688
+ if (checker(item))
2689
+ return item;
2690
+ }
2691
+ return void 0;
2692
+ };
2693
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
2694
+ function joinValues(array, separator = " | ") {
2695
+ return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
3041
2696
  }
3042
2697
  __name(joinValues, "joinValues");
3043
2698
  util2.joinValues = joinValues;
@@ -7191,208 +6846,43 @@ var z = /* @__PURE__ */ Object.freeze({
7191
6846
  ZodError
7192
6847
  });
7193
6848
 
7194
- // ../path/src/get-parent-path.ts
7195
- init_cjs_shims();
7196
- var resolveParentPath = /* @__PURE__ */ __name((path5) => {
7197
- return resolvePaths(path5, "..");
7198
- }, "resolveParentPath");
7199
- var getParentPath = /* @__PURE__ */ __name((name, cwd2, options) => {
7200
- const ignoreCase = options?.ignoreCase ?? true;
7201
- const skipCwd = options?.skipCwd ?? false;
7202
- const targetType = options?.targetType ?? "both";
7203
- let dir = cwd2;
7204
- if (skipCwd) {
7205
- dir = resolveParentPath(cwd2);
7206
- }
7207
- let names = Array.isArray(name) ? name : [
7208
- name
7209
- ];
7210
- if (ignoreCase) {
7211
- names = names.map((name2) => name2.toLowerCase());
7212
- }
7213
- while (true) {
7214
- const target = names.find((name2) => isFile(joinPaths(dir, name2)) && (targetType === "file" || targetType === "both") || isDirectory(joinPaths(dir, name2)) && (targetType === "directory" || targetType === "both"));
7215
- if (target) {
7216
- return joinPaths(dir, target);
7217
- }
7218
- const parentDir = resolveParentPath(dir);
7219
- if (parentDir === dir) {
7220
- return void 0;
7221
- }
7222
- dir = parentDir;
7223
- }
7224
- }, "getParentPath");
7225
-
7226
- // ../path/src/is-root-dir.ts
7227
- init_cjs_shims();
7228
- var isSystemRoot = /* @__PURE__ */ __name((dir) => {
7229
- return Boolean(dir === "/" || dir === "c:\\" || dir === "C:\\");
7230
- }, "isSystemRoot");
7231
-
7232
- // ../path/src/get-workspace-root.ts
7233
- var getWorkspaceRoot = /* @__PURE__ */ __name((dir = process.cwd()) => {
7234
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
7235
- return process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
7236
- }
7237
- const root = findWorkspaceRootSafe(dir);
7238
- if (root) {
7239
- return root;
7240
- }
7241
- let result = getParentPath([
7242
- "package-lock.json",
7243
- "yarn.lock",
7244
- "pnpm-lock.yaml",
7245
- "bun.lock",
7246
- "nx.json",
7247
- "knip.json",
7248
- "pnpm-workspace.yaml",
7249
- "LICENSE",
7250
- ".all-contributorsrc",
7251
- ".whitesource",
7252
- "syncpack.config.js",
7253
- "syncpack.json",
7254
- "socket.yaml",
7255
- "lefthook.yaml",
7256
- ".npmrc",
7257
- ".log4brains.yml",
7258
- ".huskyrc",
7259
- ".husky",
7260
- ".lintstagedrc",
7261
- ".commitlintrc",
7262
- "lefthook.yml",
7263
- ".github",
7264
- ".nx",
7265
- ".vscode",
7266
- "patches"
7267
- ], dir);
7268
- if (result) {
7269
- return result;
7270
- }
7271
- result = dir;
7272
- while (result && !isSystemRoot(result)) {
7273
- result = getParentPath("storm.json", result, {
7274
- skipCwd: true
7275
- });
7276
- if (result) {
7277
- return result;
7278
- }
7279
- }
7280
- return dir;
7281
- }, "getWorkspaceRoot");
7282
-
7283
- // ../path/src/file-path-fns.ts
7284
- function findFileName(filePath, { requireExtension, withExtension } = {}) {
7285
- const result = normalizeWindowsPath2(filePath)?.split(filePath?.includes("\\") ? "\\" : "/")?.pop() ?? "";
7286
- if (requireExtension === true && !result.includes(".")) {
7287
- return EMPTY_STRING;
7288
- }
7289
- if (withExtension === false && result.includes(".")) {
7290
- return result.split(".").slice(-1).join(".") || EMPTY_STRING;
7291
- }
7292
- return result;
7293
- }
7294
- __name(findFileName, "findFileName");
7295
- function findFilePath(filePath) {
7296
- const normalizedPath = normalizeWindowsPath2(filePath);
7297
- return normalizedPath.replace(findFileName(normalizedPath, {
7298
- requireExtension: true
7299
- }), "");
7300
- }
7301
- __name(findFilePath, "findFilePath");
7302
- function resolvePath(path5, cwd2 = getWorkspaceRoot()) {
7303
- const paths = normalizeWindowsPath2(path5).split("/");
7304
- let resolvedPath = "";
7305
- let resolvedAbsolute = false;
7306
- for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
7307
- const path6 = index >= 0 ? paths[index] : cwd2;
7308
- if (!path6 || path6.length === 0) {
7309
- continue;
7310
- }
7311
- resolvedPath = joinPaths(path6, resolvedPath);
7312
- resolvedAbsolute = isAbsolutePath(path6);
7313
- }
7314
- resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute);
7315
- if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {
7316
- return `/${resolvedPath}`;
7317
- }
7318
- return resolvedPath.length > 0 ? resolvedPath : ".";
7319
- }
7320
- __name(resolvePath, "resolvePath");
7321
- function resolvePaths(...paths) {
7322
- return resolvePath(joinPaths(...paths.map((path5) => normalizeWindowsPath2(path5))));
7323
- }
7324
- __name(resolvePaths, "resolvePaths");
7325
- function relativePath(from, to) {
7326
- const _from = resolvePath(from).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
7327
- const _to = resolvePath(to).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
7328
- if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
7329
- return _to.join("/");
7330
- }
7331
- const _fromCopy = [
7332
- ..._from
7333
- ];
7334
- for (const segment of _fromCopy) {
7335
- if (_to[0] !== segment) {
7336
- break;
7337
- }
7338
- _from.shift();
7339
- _to.shift();
7340
- }
7341
- return [
7342
- ..._from.map(() => ".."),
7343
- ..._to
7344
- ].join("/");
7345
- }
7346
- __name(relativePath, "relativePath");
7347
-
7348
- // ../string-format/src/lower-case-first.ts
7349
- init_cjs_shims();
7350
- var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
7351
- return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
7352
- }, "lowerCaseFirst");
7353
-
7354
- // src/prisma-generator.ts
7355
- var import_node_path5 = __toESM(require("node:path"), 1);
7356
- var import_pluralize = __toESM(require_pluralize(), 1);
7357
-
7358
- // src/config.ts
7359
- init_cjs_shims();
7360
- var ModelAction = /* @__PURE__ */ function(ModelAction2) {
7361
- ModelAction2["findUnique"] = "findUnique";
7362
- ModelAction2["findUniqueOrThrow"] = "findUniqueOrThrow";
7363
- ModelAction2["findFirst"] = "findFirst";
7364
- ModelAction2["findFirstOrThrow"] = "findFirstOrThrow";
7365
- ModelAction2["findMany"] = "findMany";
7366
- ModelAction2["create"] = "create";
7367
- ModelAction2["createMany"] = "createMany";
7368
- ModelAction2["createManyAndReturn"] = "createManyAndReturn";
7369
- ModelAction2["update"] = "update";
7370
- ModelAction2["updateMany"] = "updateMany";
7371
- ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
7372
- ModelAction2["upsert"] = "upsert";
7373
- ModelAction2["delete"] = "delete";
7374
- ModelAction2["deleteMany"] = "deleteMany";
7375
- ModelAction2["groupBy"] = "groupBy";
7376
- ModelAction2["count"] = "count";
7377
- ModelAction2["aggregate"] = "aggregate";
7378
- ModelAction2["findRaw"] = "findRaw";
7379
- ModelAction2["aggregateRaw"] = "aggregateRaw";
7380
- return ModelAction2;
7381
- }(ModelAction || {});
7382
- var modelActionEnum = z.nativeEnum(ModelAction);
7383
- var configSchema = z.object({
7384
- debug: z.coerce.boolean().or(z.string()).default(false),
7385
- withMiddleware: z.coerce.boolean().or(z.string()).default(false),
7386
- withShield: z.coerce.boolean().or(z.string()).default(true),
7387
- withZod: z.coerce.boolean().or(z.string()).default(true),
7388
- withNext: z.coerce.boolean().or(z.string()).default(true),
7389
- contextPath: z.string().default("../src/trpc/context.ts"),
7390
- trpcOptions: z.coerce.boolean().or(z.string()).default(true),
7391
- showModelNameInProcedure: z.coerce.boolean().or(z.string()).default(true),
7392
- generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
7393
- return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
7394
- })
7395
- });
6849
+ // src/config.ts
6850
+ var ModelAction = /* @__PURE__ */ function(ModelAction2) {
6851
+ ModelAction2["findUnique"] = "findUnique";
6852
+ ModelAction2["findUniqueOrThrow"] = "findUniqueOrThrow";
6853
+ ModelAction2["findFirst"] = "findFirst";
6854
+ ModelAction2["findFirstOrThrow"] = "findFirstOrThrow";
6855
+ ModelAction2["findMany"] = "findMany";
6856
+ ModelAction2["create"] = "create";
6857
+ ModelAction2["createMany"] = "createMany";
6858
+ ModelAction2["createManyAndReturn"] = "createManyAndReturn";
6859
+ ModelAction2["update"] = "update";
6860
+ ModelAction2["updateMany"] = "updateMany";
6861
+ ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
6862
+ ModelAction2["upsert"] = "upsert";
6863
+ ModelAction2["delete"] = "delete";
6864
+ ModelAction2["deleteMany"] = "deleteMany";
6865
+ ModelAction2["groupBy"] = "groupBy";
6866
+ ModelAction2["count"] = "count";
6867
+ ModelAction2["aggregate"] = "aggregate";
6868
+ ModelAction2["findRaw"] = "findRaw";
6869
+ ModelAction2["aggregateRaw"] = "aggregateRaw";
6870
+ return ModelAction2;
6871
+ }(ModelAction || {});
6872
+ var modelActionEnum = z.nativeEnum(ModelAction);
6873
+ var configSchema = z.object({
6874
+ debug: z.coerce.boolean().or(z.string()).default(false),
6875
+ withMiddleware: z.coerce.boolean().or(z.string()).default(false),
6876
+ withShield: z.coerce.boolean().or(z.string()).default(true),
6877
+ withZod: z.coerce.boolean().or(z.string()).default(true),
6878
+ withNext: z.coerce.boolean().or(z.string()).default(true),
6879
+ contextPath: z.string().default("../src/trpc/context"),
6880
+ trpcOptions: z.coerce.boolean().or(z.string()).default(true),
6881
+ showModelNameInProcedure: z.coerce.boolean().or(z.string()).default(true),
6882
+ generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
6883
+ return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
6884
+ })
6885
+ });
7396
6886
 
7397
6887
  // src/helpers.ts
7398
6888
  init_cjs_shims();
@@ -7465,103 +6955,615 @@ var titleCase = /* @__PURE__ */ __name((input) => {
7465
6955
  if (!input) {
7466
6956
  return "";
7467
6957
  }
7468
- return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
7469
- }, "titleCase");
6958
+ return input.split(/(?=[A-Z])|[\s._-]/).map((s) => s.trim()).filter(Boolean).map((s) => ACRONYMS.includes(s) ? s.toUpperCase() : upperCaseFirst(s.toLowerCase())).join(" ");
6959
+ }, "titleCase");
6960
+
6961
+ // ../type-checks/src/is-string.ts
6962
+ init_cjs_shims();
6963
+ var isString = /* @__PURE__ */ __name((value) => {
6964
+ try {
6965
+ return typeof value === "string";
6966
+ } catch {
6967
+ return false;
6968
+ }
6969
+ }, "isString");
6970
+
6971
+ // ../env/src/get-env-paths.ts
6972
+ var import_node_os = __toESM(require("node:os"), 1);
6973
+ var import_node_path = __toESM(require("node:path"), 1);
6974
+ var homedir = import_node_os.default.homedir();
6975
+ var tmpdir = import_node_os.default.tmpdir();
6976
+ var macos = /* @__PURE__ */ __name((orgId) => {
6977
+ const library = joinPaths(homedir, "Library");
6978
+ return {
6979
+ data: joinPaths(library, "Application Support", orgId),
6980
+ config: joinPaths(library, "Preferences", orgId),
6981
+ cache: joinPaths(library, "Caches", orgId),
6982
+ log: joinPaths(library, "Logs", orgId),
6983
+ temp: joinPaths(tmpdir, orgId)
6984
+ };
6985
+ }, "macos");
6986
+ var windows = /* @__PURE__ */ __name((orgId) => {
6987
+ const appData = process.env.APPDATA || joinPaths(homedir, "AppData", "Roaming");
6988
+ const localAppData = process.env.LOCALAPPDATA || joinPaths(homedir, "AppData", "Local");
6989
+ const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\s+/g, "");
6990
+ return {
6991
+ // Data/config/cache/log are invented by me as Windows isn't opinionated about this
6992
+ data: joinPaths(localAppData, windowsFormattedOrgId, "Data"),
6993
+ config: joinPaths(appData, windowsFormattedOrgId, "Config"),
6994
+ cache: joinPaths(localAppData, "Cache", orgId),
6995
+ log: joinPaths(localAppData, windowsFormattedOrgId, "Log"),
6996
+ temp: joinPaths(tmpdir, orgId)
6997
+ };
6998
+ }, "windows");
6999
+ var linux = /* @__PURE__ */ __name((orgId) => {
7000
+ const username = import_node_path.default.basename(homedir);
7001
+ return {
7002
+ data: joinPaths(process.env.XDG_DATA_HOME || joinPaths(homedir, ".local", "share"), orgId),
7003
+ config: joinPaths(process.env.XDG_CONFIG_HOME || joinPaths(homedir, ".config"), orgId),
7004
+ cache: joinPaths(process.env.XDG_CACHE_HOME || joinPaths(homedir, ".cache"), orgId),
7005
+ // https://wiki.debian.org/XDGBaseDirectorySpecification#state
7006
+ log: joinPaths(process.env.XDG_STATE_HOME || joinPaths(homedir, ".local", "state"), orgId),
7007
+ temp: joinPaths(tmpdir, username, orgId)
7008
+ };
7009
+ }, "linux");
7010
+ function getEnvPaths(options = {}) {
7011
+ let orgId = options.orgId || "storm-software";
7012
+ if (!orgId) {
7013
+ throw new Error("You need to provide an orgId to the `getEnvPaths` function");
7014
+ }
7015
+ if (options.suffix) {
7016
+ orgId += `-${isString(options.suffix) ? options.suffix : "nodejs"}`;
7017
+ }
7018
+ let result = {};
7019
+ if (process.platform === "darwin") {
7020
+ result = macos(orgId);
7021
+ } else if (process.platform === "win32") {
7022
+ result = windows(orgId);
7023
+ } else {
7024
+ result = linux(orgId);
7025
+ }
7026
+ if (process.env.STORM_DATA_DIRECTORY) {
7027
+ result.data = process.env.STORM_DATA_DIRECTORY;
7028
+ } else if (process.env.STORM_CONFIG_DIRECTORY) {
7029
+ result.config = process.env.STORM_CONFIG_DIRECTORY;
7030
+ } else if (process.env.STORM_CACHE_DIRECTORY) {
7031
+ result.cache = process.env.STORM_CACHE_DIRECTORY;
7032
+ } else if (process.env.STORM_LOG_DIRECTORY) {
7033
+ result.log = process.env.STORM_LOG_DIRECTORY;
7034
+ } else if (process.env.STORM_TEMP_DIRECTORY) {
7035
+ result.temp = process.env.STORM_TEMP_DIRECTORY;
7036
+ }
7037
+ if (options.workspaceRoot) {
7038
+ result.cache ??= joinPaths(options.workspaceRoot, "node_modules", ".cache", orgId);
7039
+ result.temp ??= joinPaths(options.workspaceRoot, "tmp", orgId);
7040
+ result.log ??= joinPaths(result.temp, "logs");
7041
+ result.config ??= joinPaths(options.workspaceRoot, ".config", orgId);
7042
+ }
7043
+ return Object.keys(result).reduce((ret, key) => {
7044
+ if (result[key]) {
7045
+ const filePath = result[key];
7046
+ ret[key] = options.appId && options.appId !== options.orgId && options.appId !== options.nestedDir ? joinPaths(filePath, options.appId) : filePath;
7047
+ if (options.nestedDir && options.nestedDir !== options.orgId && options.nestedDir !== options.appId) {
7048
+ ret[key] = joinPaths(ret[key], options.nestedDir);
7049
+ }
7050
+ }
7051
+ return ret;
7052
+ }, {});
7053
+ }
7054
+ __name(getEnvPaths, "getEnvPaths");
7055
+
7056
+ // ../path/src/get-workspace-root.ts
7057
+ init_cjs_shims();
7058
+
7059
+ // ../../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
7060
+ init_cjs_shims();
7061
+
7062
+ // ../../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
7063
+ init_cjs_shims();
7064
+
7065
+ // ../../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
7066
+ init_cjs_shims();
7067
+
7068
+ // ../../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
7069
+ init_cjs_shims();
7070
+ var __defProp2 = Object.defineProperty;
7071
+ var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
7072
+ value,
7073
+ configurable: true
7074
+ }), "__name");
7075
+
7076
+ // ../../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
7077
+ var import_node_fs2 = require("node:fs");
7078
+ var import_node_path2 = require("node:path");
7079
+ var MAX_PATH_SEARCH_DEPTH = 30;
7080
+ var depth = 0;
7081
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
7082
+ const _startPath = startPath ?? process.cwd();
7083
+ if (endDirectoryNames.some((endDirName) => (0, import_node_fs2.existsSync)((0, import_node_path2.join)(_startPath, endDirName)))) {
7084
+ return _startPath;
7085
+ }
7086
+ if (endFileNames.some((endFileName) => (0, import_node_fs2.existsSync)((0, import_node_path2.join)(_startPath, endFileName)))) {
7087
+ return _startPath;
7088
+ }
7089
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
7090
+ const parent = (0, import_node_path2.join)(_startPath, "..");
7091
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
7092
+ }
7093
+ return void 0;
7094
+ }
7095
+ __name(findFolderUp, "findFolderUp");
7096
+ __name2(findFolderUp, "findFolderUp");
7097
+
7098
+ // ../../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
7099
+ init_cjs_shims();
7100
+ var _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
7101
+ function normalizeWindowsPath2(input = "") {
7102
+ if (!input) {
7103
+ return input;
7104
+ }
7105
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
7106
+ }
7107
+ __name(normalizeWindowsPath2, "normalizeWindowsPath");
7108
+ __name2(normalizeWindowsPath2, "normalizeWindowsPath");
7109
+ var _UNC_REGEX2 = /^[/\\]{2}/;
7110
+ var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
7111
+ var _DRIVE_LETTER_RE2 = /^[A-Za-z]:$/;
7112
+ var correctPaths2 = /* @__PURE__ */ __name2(function(path5) {
7113
+ if (!path5 || path5.length === 0) {
7114
+ return ".";
7115
+ }
7116
+ path5 = normalizeWindowsPath2(path5);
7117
+ const isUNCPath = path5.match(_UNC_REGEX2);
7118
+ const isPathAbsolute = isAbsolute2(path5);
7119
+ const trailingSeparator = path5[path5.length - 1] === "/";
7120
+ path5 = normalizeString2(path5, !isPathAbsolute);
7121
+ if (path5.length === 0) {
7122
+ if (isPathAbsolute) {
7123
+ return "/";
7124
+ }
7125
+ return trailingSeparator ? "./" : ".";
7126
+ }
7127
+ if (trailingSeparator) {
7128
+ path5 += "/";
7129
+ }
7130
+ if (_DRIVE_LETTER_RE2.test(path5)) {
7131
+ path5 += "/";
7132
+ }
7133
+ if (isUNCPath) {
7134
+ if (!isPathAbsolute) {
7135
+ return `//./${path5}`;
7136
+ }
7137
+ return `//${path5}`;
7138
+ }
7139
+ return isPathAbsolute && !isAbsolute2(path5) ? `/${path5}` : path5;
7140
+ }, "correctPaths");
7141
+ function cwd() {
7142
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
7143
+ return process.cwd().replace(/\\/g, "/");
7144
+ }
7145
+ return "/";
7146
+ }
7147
+ __name(cwd, "cwd");
7148
+ __name2(cwd, "cwd");
7149
+ function normalizeString2(path5, allowAboveRoot) {
7150
+ let res = "";
7151
+ let lastSegmentLength = 0;
7152
+ let lastSlash = -1;
7153
+ let dots = 0;
7154
+ let char = null;
7155
+ for (let index = 0; index <= path5.length; ++index) {
7156
+ if (index < path5.length) {
7157
+ char = path5[index];
7158
+ } else if (char === "/") {
7159
+ break;
7160
+ } else {
7161
+ char = "/";
7162
+ }
7163
+ if (char === "/") {
7164
+ if (lastSlash === index - 1 || dots === 1) {
7165
+ } else if (dots === 2) {
7166
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
7167
+ if (res.length > 2) {
7168
+ const lastSlashIndex = res.lastIndexOf("/");
7169
+ if (lastSlashIndex === -1) {
7170
+ res = "";
7171
+ lastSegmentLength = 0;
7172
+ } else {
7173
+ res = res.slice(0, lastSlashIndex);
7174
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
7175
+ }
7176
+ lastSlash = index;
7177
+ dots = 0;
7178
+ continue;
7179
+ } else if (res.length > 0) {
7180
+ res = "";
7181
+ lastSegmentLength = 0;
7182
+ lastSlash = index;
7183
+ dots = 0;
7184
+ continue;
7185
+ }
7186
+ }
7187
+ if (allowAboveRoot) {
7188
+ res += res.length > 0 ? "/.." : "..";
7189
+ lastSegmentLength = 2;
7190
+ }
7191
+ } else {
7192
+ if (res.length > 0) {
7193
+ res += `/${path5.slice(lastSlash + 1, index)}`;
7194
+ } else {
7195
+ res = path5.slice(lastSlash + 1, index);
7196
+ }
7197
+ lastSegmentLength = index - lastSlash - 1;
7198
+ }
7199
+ lastSlash = index;
7200
+ dots = 0;
7201
+ } else if (char === "." && dots !== -1) {
7202
+ ++dots;
7203
+ } else {
7204
+ dots = -1;
7205
+ }
7206
+ }
7207
+ return res;
7208
+ }
7209
+ __name(normalizeString2, "normalizeString");
7210
+ __name2(normalizeString2, "normalizeString");
7211
+ var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
7212
+ return _IS_ABSOLUTE_RE2.test(p);
7213
+ }, "isAbsolute");
7214
+
7215
+ // ../../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
7216
+ var rootFiles = [
7217
+ "storm-workspace.json",
7218
+ "storm-workspace.json",
7219
+ "storm-workspace.yaml",
7220
+ "storm-workspace.yml",
7221
+ "storm-workspace.js",
7222
+ "storm-workspace.ts",
7223
+ ".storm-workspace.json",
7224
+ ".storm-workspace.yaml",
7225
+ ".storm-workspace.yml",
7226
+ ".storm-workspace.js",
7227
+ ".storm-workspace.ts",
7228
+ "lerna.json",
7229
+ "nx.json",
7230
+ "turbo.json",
7231
+ "npm-workspace.json",
7232
+ "yarn-workspace.json",
7233
+ "pnpm-workspace.json",
7234
+ "npm-workspace.yaml",
7235
+ "yarn-workspace.yaml",
7236
+ "pnpm-workspace.yaml",
7237
+ "npm-workspace.yml",
7238
+ "yarn-workspace.yml",
7239
+ "pnpm-workspace.yml",
7240
+ "npm-lock.json",
7241
+ "yarn-lock.json",
7242
+ "pnpm-lock.json",
7243
+ "npm-lock.yaml",
7244
+ "yarn-lock.yaml",
7245
+ "pnpm-lock.yaml",
7246
+ "npm-lock.yml",
7247
+ "yarn-lock.yml",
7248
+ "pnpm-lock.yml",
7249
+ "bun.lockb"
7250
+ ];
7251
+ var rootDirectories = [
7252
+ ".storm-workspace",
7253
+ ".nx",
7254
+ ".github",
7255
+ ".vscode",
7256
+ ".verdaccio"
7257
+ ];
7258
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
7259
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
7260
+ return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
7261
+ }
7262
+ return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
7263
+ }
7264
+ __name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
7265
+ __name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
7266
+ function findWorkspaceRoot(pathInsideMonorepo) {
7267
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
7268
+ if (!result) {
7269
+ throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
7270
+ ${rootFiles.join("\n")}
7271
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
7272
+ }
7273
+ return result;
7274
+ }
7275
+ __name(findWorkspaceRoot, "findWorkspaceRoot");
7276
+ __name2(findWorkspaceRoot, "findWorkspaceRoot");
7277
+
7278
+ // ../path/src/get-parent-path.ts
7279
+ init_cjs_shims();
7280
+
7281
+ // ../path/src/file-path-fns.ts
7282
+ init_cjs_shims();
7283
+
7284
+ // ../types/src/base.ts
7285
+ init_cjs_shims();
7286
+ var EMPTY_STRING = "";
7287
+ var $NestedValue = Symbol("NestedValue");
7288
+
7289
+ // ../path/src/correct-path.ts
7290
+ init_cjs_shims();
7291
+
7292
+ // ../path/src/is-file.ts
7293
+ init_cjs_shims();
7294
+ var import_node_fs3 = require("node:fs");
7295
+ function isFile(path5, additionalPath) {
7296
+ return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path5) : path5, {
7297
+ throwIfNoEntry: false
7298
+ })?.isFile());
7299
+ }
7300
+ __name(isFile, "isFile");
7301
+ function isDirectory(path5, additionalPath) {
7302
+ return Boolean((0, import_node_fs3.statSync)(additionalPath ? joinPaths(additionalPath, path5) : path5, {
7303
+ throwIfNoEntry: false
7304
+ })?.isDirectory());
7305
+ }
7306
+ __name(isDirectory, "isDirectory");
7307
+ function isAbsolutePath(path5) {
7308
+ return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path5);
7309
+ }
7310
+ __name(isAbsolutePath, "isAbsolutePath");
7311
+
7312
+ // ../path/src/correct-path.ts
7313
+ var _DRIVE_LETTER_START_RE3 = /^[A-Z]:\//i;
7314
+ function normalizeWindowsPath3(input = "") {
7315
+ if (!input) {
7316
+ return input;
7317
+ }
7318
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE3, (r) => r.toUpperCase());
7319
+ }
7320
+ __name(normalizeWindowsPath3, "normalizeWindowsPath");
7321
+ var _UNC_REGEX3 = /^[/\\]{2}/;
7322
+ var _DRIVE_LETTER_RE3 = /^[A-Z]:$/i;
7323
+ function correctPath(path5) {
7324
+ if (!path5 || path5.length === 0) {
7325
+ return ".";
7326
+ }
7327
+ path5 = normalizeWindowsPath3(path5);
7328
+ const isUNCPath = path5.match(_UNC_REGEX3);
7329
+ const isPathAbsolute = isAbsolutePath(path5);
7330
+ const trailingSeparator = path5[path5.length - 1] === "/";
7331
+ path5 = normalizeString3(path5, !isPathAbsolute);
7332
+ if (path5.length === 0) {
7333
+ if (isPathAbsolute) {
7334
+ return "/";
7335
+ }
7336
+ return trailingSeparator ? "./" : ".";
7337
+ }
7338
+ if (trailingSeparator) {
7339
+ path5 += "/";
7340
+ }
7341
+ if (_DRIVE_LETTER_RE3.test(path5)) {
7342
+ path5 += "/";
7343
+ }
7344
+ if (isUNCPath) {
7345
+ if (!isPathAbsolute) {
7346
+ return `//./${path5}`;
7347
+ }
7348
+ return `//${path5}`;
7349
+ }
7350
+ return isPathAbsolute && !isAbsolutePath(path5) ? `/${path5}` : path5;
7351
+ }
7352
+ __name(correctPath, "correctPath");
7353
+ function normalizeString3(path5, allowAboveRoot) {
7354
+ let res = "";
7355
+ let lastSegmentLength = 0;
7356
+ let lastSlash = -1;
7357
+ let dots = 0;
7358
+ let char = null;
7359
+ for (let index = 0; index <= path5.length; ++index) {
7360
+ if (index < path5.length) {
7361
+ char = path5[index];
7362
+ } else if (char === "/") {
7363
+ break;
7364
+ } else {
7365
+ char = "/";
7366
+ }
7367
+ if (char === "/") {
7368
+ if (lastSlash === index - 1 || dots === 1) {
7369
+ } else if (dots === 2) {
7370
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
7371
+ if (res.length > 2) {
7372
+ const lastSlashIndex = res.lastIndexOf("/");
7373
+ if (lastSlashIndex === -1) {
7374
+ res = "";
7375
+ lastSegmentLength = 0;
7376
+ } else {
7377
+ res = res.slice(0, lastSlashIndex);
7378
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
7379
+ }
7380
+ lastSlash = index;
7381
+ dots = 0;
7382
+ continue;
7383
+ } else if (res.length > 0) {
7384
+ res = "";
7385
+ lastSegmentLength = 0;
7386
+ lastSlash = index;
7387
+ dots = 0;
7388
+ continue;
7389
+ }
7390
+ }
7391
+ if (allowAboveRoot) {
7392
+ res += res.length > 0 ? "/.." : "..";
7393
+ lastSegmentLength = 2;
7394
+ }
7395
+ } else {
7396
+ if (res.length > 0) {
7397
+ res += `/${path5.slice(lastSlash + 1, index)}`;
7398
+ } else {
7399
+ res = path5.slice(lastSlash + 1, index);
7400
+ }
7401
+ lastSegmentLength = index - lastSlash - 1;
7402
+ }
7403
+ lastSlash = index;
7404
+ dots = 0;
7405
+ } else if (char === "." && dots !== -1) {
7406
+ ++dots;
7407
+ } else {
7408
+ dots = -1;
7409
+ }
7410
+ }
7411
+ return res;
7412
+ }
7413
+ __name(normalizeString3, "normalizeString");
7470
7414
 
7471
- // ../type-checks/src/is-string.ts
7472
- init_cjs_shims();
7473
- var isString = /* @__PURE__ */ __name((value) => {
7474
- try {
7475
- return typeof value === "string";
7476
- } catch {
7477
- return false;
7415
+ // ../path/src/file-path-fns.ts
7416
+ function findFileName(filePath, { requireExtension, withExtension } = {}) {
7417
+ const result = normalizeWindowsPath3(filePath)?.split(filePath?.includes("\\") ? "\\" : "/")?.pop() ?? "";
7418
+ if (requireExtension === true && !result.includes(".")) {
7419
+ return EMPTY_STRING;
7478
7420
  }
7479
- }, "isString");
7421
+ if (withExtension === false && result.includes(".")) {
7422
+ return result.split(".").slice(-1).join(".") || EMPTY_STRING;
7423
+ }
7424
+ return result;
7425
+ }
7426
+ __name(findFileName, "findFileName");
7427
+ function findFilePath(filePath) {
7428
+ const normalizedPath = normalizeWindowsPath3(filePath);
7429
+ return normalizedPath.replace(findFileName(normalizedPath, {
7430
+ requireExtension: true
7431
+ }), "");
7432
+ }
7433
+ __name(findFilePath, "findFilePath");
7434
+ function resolvePath(path5, cwd2 = getWorkspaceRoot()) {
7435
+ const paths = normalizeWindowsPath3(path5).split("/");
7436
+ let resolvedPath = "";
7437
+ let resolvedAbsolute = false;
7438
+ for (let index = paths.length - 1; index >= -1 && !resolvedAbsolute; index--) {
7439
+ const path6 = index >= 0 ? paths[index] : cwd2;
7440
+ if (!path6 || path6.length === 0) {
7441
+ continue;
7442
+ }
7443
+ resolvedPath = joinPaths(path6, resolvedPath);
7444
+ resolvedAbsolute = isAbsolutePath(path6);
7445
+ }
7446
+ resolvedPath = normalizeString3(resolvedPath, !resolvedAbsolute);
7447
+ if (resolvedAbsolute && !isAbsolutePath(resolvedPath)) {
7448
+ return `/${resolvedPath}`;
7449
+ }
7450
+ return resolvedPath.length > 0 ? resolvedPath : ".";
7451
+ }
7452
+ __name(resolvePath, "resolvePath");
7453
+ function resolvePaths(...paths) {
7454
+ return resolvePath(joinPaths(...paths.map((path5) => normalizeWindowsPath3(path5))));
7455
+ }
7456
+ __name(resolvePaths, "resolvePaths");
7457
+ function relativePath(from, to) {
7458
+ const _from = resolvePath(from).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
7459
+ const _to = resolvePath(to).replace(/^\/([A-Z]:)?$/i, "$1").split("/");
7460
+ if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
7461
+ return _to.join("/");
7462
+ }
7463
+ const _fromCopy = [
7464
+ ..._from
7465
+ ];
7466
+ for (const segment of _fromCopy) {
7467
+ if (_to[0] !== segment) {
7468
+ break;
7469
+ }
7470
+ _from.shift();
7471
+ _to.shift();
7472
+ }
7473
+ return [
7474
+ ..._from.map(() => ".."),
7475
+ ..._to
7476
+ ].join("/");
7477
+ }
7478
+ __name(relativePath, "relativePath");
7480
7479
 
7481
- // ../env/src/get-env-paths.ts
7482
- var import_node_os = __toESM(require("node:os"), 1);
7483
- var import_node_path2 = __toESM(require("node:path"), 1);
7484
- var homedir = import_node_os.default.homedir();
7485
- var tmpdir = import_node_os.default.tmpdir();
7486
- var macos = /* @__PURE__ */ __name((orgId) => {
7487
- const library = joinPaths(homedir, "Library");
7488
- return {
7489
- data: joinPaths(library, "Application Support", orgId),
7490
- config: joinPaths(library, "Preferences", orgId),
7491
- cache: joinPaths(library, "Caches", orgId),
7492
- log: joinPaths(library, "Logs", orgId),
7493
- temp: joinPaths(tmpdir, orgId)
7494
- };
7495
- }, "macos");
7496
- var windows = /* @__PURE__ */ __name((orgId) => {
7497
- const appData = process.env.APPDATA || joinPaths(homedir, "AppData", "Roaming");
7498
- const localAppData = process.env.LOCALAPPDATA || joinPaths(homedir, "AppData", "Local");
7499
- const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\s+/g, "");
7500
- return {
7501
- // Data/config/cache/log are invented by me as Windows isn't opinionated about this
7502
- data: joinPaths(localAppData, windowsFormattedOrgId, "Data"),
7503
- config: joinPaths(appData, windowsFormattedOrgId, "Config"),
7504
- cache: joinPaths(localAppData, "Cache", orgId),
7505
- log: joinPaths(localAppData, windowsFormattedOrgId, "Log"),
7506
- temp: joinPaths(tmpdir, orgId)
7507
- };
7508
- }, "windows");
7509
- var linux = /* @__PURE__ */ __name((orgId) => {
7510
- const username = import_node_path2.default.basename(homedir);
7511
- return {
7512
- data: joinPaths(process.env.XDG_DATA_HOME || joinPaths(homedir, ".local", "share"), orgId),
7513
- config: joinPaths(process.env.XDG_CONFIG_HOME || joinPaths(homedir, ".config"), orgId),
7514
- cache: joinPaths(process.env.XDG_CACHE_HOME || joinPaths(homedir, ".cache"), orgId),
7515
- // https://wiki.debian.org/XDGBaseDirectorySpecification#state
7516
- log: joinPaths(process.env.XDG_STATE_HOME || joinPaths(homedir, ".local", "state"), orgId),
7517
- temp: joinPaths(tmpdir, username, orgId)
7518
- };
7519
- }, "linux");
7520
- function getEnvPaths(options = {}) {
7521
- let orgId = options.orgId || "storm-software";
7522
- if (!orgId) {
7523
- throw new Error("You need to provide an orgId to the `getEnvPaths` function");
7480
+ // ../path/src/get-parent-path.ts
7481
+ var resolveParentPath = /* @__PURE__ */ __name((path5) => {
7482
+ return resolvePaths(path5, "..");
7483
+ }, "resolveParentPath");
7484
+ var getParentPath = /* @__PURE__ */ __name((name, cwd2, options) => {
7485
+ const ignoreCase = options?.ignoreCase ?? true;
7486
+ const skipCwd = options?.skipCwd ?? false;
7487
+ const targetType = options?.targetType ?? "both";
7488
+ let dir = cwd2;
7489
+ if (skipCwd) {
7490
+ dir = resolveParentPath(cwd2);
7524
7491
  }
7525
- if (options.suffix) {
7526
- orgId += `-${isString(options.suffix) ? options.suffix : "nodejs"}`;
7492
+ let names = Array.isArray(name) ? name : [
7493
+ name
7494
+ ];
7495
+ if (ignoreCase) {
7496
+ names = names.map((name2) => name2.toLowerCase());
7527
7497
  }
7528
- let result = {};
7529
- if (process.platform === "darwin") {
7530
- result = macos(orgId);
7531
- } else if (process.platform === "win32") {
7532
- result = windows(orgId);
7533
- } else {
7534
- result = linux(orgId);
7498
+ while (true) {
7499
+ const target = names.find((name2) => isFile(joinPaths(dir, name2)) && (targetType === "file" || targetType === "both") || isDirectory(joinPaths(dir, name2)) && (targetType === "directory" || targetType === "both"));
7500
+ if (target) {
7501
+ return joinPaths(dir, target);
7502
+ }
7503
+ const parentDir = resolveParentPath(dir);
7504
+ if (parentDir === dir) {
7505
+ return void 0;
7506
+ }
7507
+ dir = parentDir;
7535
7508
  }
7536
- if (process.env.STORM_DATA_DIRECTORY) {
7537
- result.data = process.env.STORM_DATA_DIRECTORY;
7538
- } else if (process.env.STORM_CONFIG_DIRECTORY) {
7539
- result.config = process.env.STORM_CONFIG_DIRECTORY;
7540
- } else if (process.env.STORM_CACHE_DIRECTORY) {
7541
- result.cache = process.env.STORM_CACHE_DIRECTORY;
7542
- } else if (process.env.STORM_LOG_DIRECTORY) {
7543
- result.log = process.env.STORM_LOG_DIRECTORY;
7544
- } else if (process.env.STORM_TEMP_DIRECTORY) {
7545
- result.temp = process.env.STORM_TEMP_DIRECTORY;
7509
+ }, "getParentPath");
7510
+
7511
+ // ../path/src/is-root-dir.ts
7512
+ init_cjs_shims();
7513
+ var isSystemRoot = /* @__PURE__ */ __name((dir) => {
7514
+ return Boolean(dir === "/" || dir === "c:\\" || dir === "C:\\");
7515
+ }, "isSystemRoot");
7516
+
7517
+ // ../path/src/get-workspace-root.ts
7518
+ var getWorkspaceRoot = /* @__PURE__ */ __name((dir = process.cwd()) => {
7519
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
7520
+ return process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH;
7546
7521
  }
7547
- if (options.workspaceRoot) {
7548
- result.cache ??= joinPaths(options.workspaceRoot, "node_modules", ".cache", orgId);
7549
- result.temp ??= joinPaths(options.workspaceRoot, "tmp", orgId);
7550
- result.log ??= joinPaths(result.temp, "logs");
7551
- result.config ??= joinPaths(options.workspaceRoot, ".config", orgId);
7522
+ const root = findWorkspaceRootSafe(dir);
7523
+ if (root) {
7524
+ return root;
7552
7525
  }
7553
- return Object.keys(result).reduce((ret, key) => {
7554
- if (result[key]) {
7555
- const filePath = result[key];
7556
- ret[key] = options.appId && options.appId !== options.orgId && options.appId !== options.nestedDir ? joinPaths(filePath, options.appId) : filePath;
7557
- if (options.nestedDir && options.nestedDir !== options.orgId && options.nestedDir !== options.appId) {
7558
- ret[key] = joinPaths(ret[key], options.nestedDir);
7559
- }
7526
+ let result = getParentPath([
7527
+ "package-lock.json",
7528
+ "yarn.lock",
7529
+ "pnpm-lock.yaml",
7530
+ "bun.lock",
7531
+ "nx.json",
7532
+ "knip.json",
7533
+ "pnpm-workspace.yaml",
7534
+ "LICENSE",
7535
+ ".all-contributorsrc",
7536
+ ".whitesource",
7537
+ "syncpack.config.js",
7538
+ "syncpack.json",
7539
+ "socket.yaml",
7540
+ "lefthook.yaml",
7541
+ ".npmrc",
7542
+ ".log4brains.yml",
7543
+ ".huskyrc",
7544
+ ".husky",
7545
+ ".lintstagedrc",
7546
+ ".commitlintrc",
7547
+ "lefthook.yml",
7548
+ ".github",
7549
+ ".nx",
7550
+ ".vscode",
7551
+ "patches"
7552
+ ], dir);
7553
+ if (result) {
7554
+ return result;
7555
+ }
7556
+ result = dir;
7557
+ while (result && !isSystemRoot(result)) {
7558
+ result = getParentPath("storm.json", result, {
7559
+ skipCwd: true
7560
+ });
7561
+ if (result) {
7562
+ return result;
7560
7563
  }
7561
- return ret;
7562
- }, {});
7563
- }
7564
- __name(getEnvPaths, "getEnvPaths");
7564
+ }
7565
+ return dir;
7566
+ }, "getWorkspaceRoot");
7565
7567
 
7566
7568
  // src/utils/get-jiti.ts
7567
7569
  var import_jiti = require("jiti");
@@ -7615,18 +7617,6 @@ var generateCreateRouterImport = /* @__PURE__ */ __name(({ sourceFile, config })
7615
7617
  namedImports: imports
7616
7618
  });
7617
7619
  }, "generateCreateRouterImport");
7618
- var generateShieldImport = /* @__PURE__ */ __name(async (sourceFile, options, outputDir, value) => {
7619
- let shieldPath = joinPaths(outputDir, "shield");
7620
- if (typeof value === "string") {
7621
- shieldPath = getRelativePath(outputDir, value, true, options.schemaPath);
7622
- }
7623
- sourceFile.addImportDeclaration({
7624
- moduleSpecifier: shieldPath,
7625
- namedImports: [
7626
- "permissions"
7627
- ]
7628
- });
7629
- }, "generateShieldImport");
7630
7620
  var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural, modelNameCamelCase) => {
7631
7621
  sourceFile.addImportDeclaration({
7632
7622
  moduleSpecifier: `./${modelNameCamelCase}.router`,
@@ -7635,9 +7625,22 @@ var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural,
7635
7625
  ]
7636
7626
  });
7637
7627
  }, "generateRouterImport");
7638
- async function generateBaseRouter(sourceFile, config, options) {
7639
- const internals = await getPrismaInternals();
7640
- const outputDir = internals.parseEnvValue(options.generator.output);
7628
+ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7629
+ if (config.withShield) {
7630
+ let shieldPath = joinPaths(outputDir, "shield");
7631
+ if (typeof config.withShield === "string") {
7632
+ shieldPath = getRelativePath(outputDir, config.withShield, true, options.schemaPath);
7633
+ }
7634
+ sourceFile.addImportDeclaration({
7635
+ moduleSpecifier: shieldPath,
7636
+ namedImports: [
7637
+ "permissions"
7638
+ ]
7639
+ });
7640
+ sourceFile.formatText({
7641
+ indentSize: 2
7642
+ });
7643
+ }
7641
7644
  sourceFile.addStatements(
7642
7645
  /* ts */
7643
7646
  `
@@ -7757,7 +7760,7 @@ export const createCallerFactory = t.createCallerFactory;`
7757
7760
  );
7758
7761
  }
7759
7762
  }
7760
- __name(generateBaseRouter, "generateBaseRouter");
7763
+ __name(generateTRPCExports, "generateTRPCExports");
7761
7764
  function generateProcedure(sourceFile, name, typeName, modelName, opType, baseOpType, config) {
7762
7765
  let input = `input${!config.withZod ? " as any" : ""}`;
7763
7766
  const nameWithoutModel = name.replace(modelName, "");
@@ -11643,11 +11646,11 @@ async function generate(options) {
11643
11646
  subscriptions.sort();
11644
11647
  if (config.withShield !== false) {
11645
11648
  consoleLog("Generating tRPC Shield");
11646
- if (typeof config.withShield === "string" && (existsSync(joinPaths(findFilePath(options.schemaPath), config.withShield)) || existsSync(joinPaths(findFilePath(options.schemaPath), config.withShield, "shield.ts")))) {
11649
+ if (typeof config.withShield === "string" && (existsSync(config.withShield) || existsSync(`${config.withShield}.ts`) || existsSync(joinPaths(config.withShield, "shield.ts")))) {
11647
11650
  consoleLog("Skipping tRPC Shield generation as path provided already exists");
11648
11651
  } else {
11649
- consoleLog("Constructing tRPC Shield source file");
11650
11652
  const shieldOutputDir = typeof config.withShield === "string" ? config.withShield : outputDir;
11653
+ consoleLog(`Constructing tRPC Shield source file in ${shieldOutputDir}`);
11651
11654
  const shieldText = await constructShield({
11652
11655
  queries,
11653
11656
  mutations,
@@ -11666,18 +11669,12 @@ async function generate(options) {
11666
11669
  await writeFileSafely(trpcOptionsOutputPath, constructDefaultOptions(config, options, trpcOptionsOutputPath));
11667
11670
  }
11668
11671
  resolveModelsComments(models, hiddenModels);
11672
+ consoleLog("Generating tRPC export file");
11669
11673
  const trpcExports = project.createSourceFile(import_node_path5.default.resolve(outputDir, "trpc.ts"), void 0, {
11670
11674
  overwrite: true
11671
11675
  });
11672
- consoleLog("Generating tRPC imports");
11673
- if (config.withShield) {
11674
- await generateShieldImport(trpcExports, options, outputDir, config.withShield);
11675
- }
11676
- consoleLog("Generating tRPC base router");
11677
- await generateBaseRouter(trpcExports, config, options);
11678
- trpcExports.formatText({
11679
- indentSize: 2
11680
- });
11676
+ await generateTRPCExports(trpcExports, config, options, outputDir);
11677
+ consoleLog("Generating tRPC app router");
11681
11678
  const appRouter = project.createSourceFile(import_node_path5.default.resolve(outputDir, "routers", `index.ts`), void 0, {
11682
11679
  overwrite: true
11683
11680
  });