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