@stryke/prisma-trpc-generator 0.7.0 → 0.7.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,6 +2503,21 @@ async function removeDirectory(path6) {
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
+
2506
2521
  // ../path/src/join-paths.ts
2507
2522
  init_cjs_shims();
2508
2523
  var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
@@ -2631,75 +2646,405 @@ function normalizeString(path6, allowAboveRoot) {
2631
2646
  }
2632
2647
  __name(normalizeString, "normalizeString");
2633
2648
 
2634
- // ../string-format/src/lower-case-first.ts
2649
+ // ../path/src/is-file.ts
2650
+ function isFile(path6, additionalPath) {
2651
+ return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
2652
+ throwIfNoEntry: false
2653
+ })?.isFile());
2654
+ }
2655
+ __name(isFile, "isFile");
2656
+ function isDirectory(path6, additionalPath) {
2657
+ return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
2658
+ throwIfNoEntry: false
2659
+ })?.isDirectory());
2660
+ }
2661
+ __name(isDirectory, "isDirectory");
2662
+ function isAbsolutePath(path6) {
2663
+ return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path6);
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(path6) {
2679
+ if (!path6 || path6.length === 0) {
2680
+ return ".";
2681
+ }
2682
+ path6 = normalizeWindowsPath2(path6);
2683
+ const isUNCPath = path6.match(_UNC_REGEX2);
2684
+ const isPathAbsolute = isAbsolutePath(path6);
2685
+ const trailingSeparator = path6[path6.length - 1] === "/";
2686
+ path6 = normalizeString2(path6, !isPathAbsolute);
2687
+ if (path6.length === 0) {
2688
+ if (isPathAbsolute) {
2689
+ return "/";
2690
+ }
2691
+ return trailingSeparator ? "./" : ".";
2692
+ }
2693
+ if (trailingSeparator) {
2694
+ path6 += "/";
2695
+ }
2696
+ if (_DRIVE_LETTER_RE2.test(path6)) {
2697
+ path6 += "/";
2698
+ }
2699
+ if (isUNCPath) {
2700
+ if (!isPathAbsolute) {
2701
+ return `//./${path6}`;
2702
+ }
2703
+ return `//${path6}`;
2704
+ }
2705
+ return isPathAbsolute && !isAbsolutePath(path6) ? `/${path6}` : path6;
2706
+ }
2707
+ __name(correctPath, "correctPath");
2708
+ function normalizeString2(path6, 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 <= path6.length; ++index) {
2715
+ if (index < path6.length) {
2716
+ char = path6[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 += `/${path6.slice(lastSlash + 1, index)}`;
2753
+ } else {
2754
+ res = path6.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
2635
2771
  init_cjs_shims();
2636
- var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
2637
- return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
2638
- }, "lowerCaseFirst");
2639
2772
 
2640
- // src/prisma-generator.ts
2641
- var import_node_path6 = __toESM(require("node:path"), 1);
2642
- var import_pluralize = __toESM(require_pluralize(), 1);
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();
2643
2775
 
2644
- // src/config.ts
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
2645
2777
  init_cjs_shims();
2646
2778
 
2647
- // ../../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
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
2648
2780
  init_cjs_shims();
2649
- var util;
2650
- (function(util2) {
2651
- util2.assertEqual = (val) => val;
2652
- function assertIs(_arg) {
2781
+
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
2783
+ 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;
2653
2799
  }
2654
- __name(assertIs, "assertIs");
2655
- util2.assertIs = assertIs;
2656
- function assertNever(_x) {
2657
- throw new Error();
2800
+ if (endFileNames.some((endFileName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
2801
+ return _startPath;
2658
2802
  }
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;
2665
- }
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];
2673
- }
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;
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
+
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
2813
+ init_cjs_shims();
2814
+ var _DRIVE_LETTER_START_RE3 = /^[A-Za-z]:\//;
2815
+ function normalizeWindowsPath3(input = "") {
2816
+ if (!input) {
2817
+ return input;
2818
+ }
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(path6) {
2827
+ if (!path6 || path6.length === 0) {
2828
+ return ".";
2829
+ }
2830
+ path6 = normalizeWindowsPath3(path6);
2831
+ const isUNCPath = path6.match(_UNC_REGEX3);
2832
+ const isPathAbsolute = isAbsolute2(path6);
2833
+ const trailingSeparator = path6[path6.length - 1] === "/";
2834
+ path6 = normalizeString3(path6, !isPathAbsolute);
2835
+ if (path6.length === 0) {
2836
+ if (isPathAbsolute) {
2837
+ return "/";
2694
2838
  }
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);
2839
+ return trailingSeparator ? "./" : ".";
2700
2840
  }
2701
- __name(joinValues, "joinValues");
2702
- util2.joinValues = joinValues;
2841
+ if (trailingSeparator) {
2842
+ path6 += "/";
2843
+ }
2844
+ if (_DRIVE_LETTER_RE3.test(path6)) {
2845
+ path6 += "/";
2846
+ }
2847
+ if (isUNCPath) {
2848
+ if (!isPathAbsolute) {
2849
+ return `//./${path6}`;
2850
+ }
2851
+ return `//${path6}`;
2852
+ }
2853
+ return isPathAbsolute && !isAbsolute2(path6) ? `/${path6}` : path6;
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(path6, 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 <= path6.length; ++index) {
2870
+ if (index < path6.length) {
2871
+ char = path6[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 += `/${path6.slice(lastSlash + 1, index)}`;
2908
+ } else {
2909
+ res = path6.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);
3045
+ }
3046
+ __name(joinValues, "joinValues");
3047
+ util2.joinValues = joinValues;
2703
3048
  util2.jsonStringifyReplacer = (_, value) => {
2704
3049
  if (typeof value === "bigint") {
2705
3050
  return value.toString();
@@ -6662,602 +7007,193 @@ var ZodFirstPartyTypeKind;
6662
7007
  ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
6663
7008
  ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
6664
7009
  ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
6665
- ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
6666
- ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
6667
- ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
6668
- ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
6669
- ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
6670
- ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
6671
- ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
6672
- ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
6673
- ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
6674
- ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
6675
- ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
6676
- ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
6677
- ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
6678
- ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
6679
- ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
6680
- ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
6681
- ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
6682
- ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
6683
- ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
6684
- })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
6685
- var instanceOfType = /* @__PURE__ */ __name((cls, params = {
6686
- message: `Input not instance of ${cls.name}`
6687
- }) => custom((data) => data instanceof cls, params), "instanceOfType");
6688
- var stringType = ZodString.create;
6689
- var numberType = ZodNumber.create;
6690
- var nanType = ZodNaN.create;
6691
- var bigIntType = ZodBigInt.create;
6692
- var booleanType = ZodBoolean.create;
6693
- var dateType = ZodDate.create;
6694
- var symbolType = ZodSymbol.create;
6695
- var undefinedType = ZodUndefined.create;
6696
- var nullType = ZodNull.create;
6697
- var anyType = ZodAny.create;
6698
- var unknownType = ZodUnknown.create;
6699
- var neverType = ZodNever.create;
6700
- var voidType = ZodVoid.create;
6701
- var arrayType = ZodArray.create;
6702
- var objectType = ZodObject.create;
6703
- var strictObjectType = ZodObject.strictCreate;
6704
- var unionType = ZodUnion.create;
6705
- var discriminatedUnionType = ZodDiscriminatedUnion.create;
6706
- var intersectionType = ZodIntersection.create;
6707
- var tupleType = ZodTuple.create;
6708
- var recordType = ZodRecord.create;
6709
- var mapType = ZodMap.create;
6710
- var setType = ZodSet.create;
6711
- var functionType = ZodFunction.create;
6712
- var lazyType = ZodLazy.create;
6713
- var literalType = ZodLiteral.create;
6714
- var enumType = ZodEnum.create;
6715
- var nativeEnumType = ZodNativeEnum.create;
6716
- var promiseType = ZodPromise.create;
6717
- var effectsType = ZodEffects.create;
6718
- var optionalType = ZodOptional.create;
6719
- var nullableType = ZodNullable.create;
6720
- var preprocessType = ZodEffects.createWithPreprocess;
6721
- var pipelineType = ZodPipeline.create;
6722
- var ostring = /* @__PURE__ */ __name(() => stringType().optional(), "ostring");
6723
- var onumber = /* @__PURE__ */ __name(() => numberType().optional(), "onumber");
6724
- var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean");
6725
- var coerce = {
6726
- string: /* @__PURE__ */ __name((arg) => ZodString.create({ ...arg, coerce: true }), "string"),
6727
- number: /* @__PURE__ */ __name((arg) => ZodNumber.create({ ...arg, coerce: true }), "number"),
6728
- boolean: /* @__PURE__ */ __name((arg) => ZodBoolean.create({
6729
- ...arg,
6730
- coerce: true
6731
- }), "boolean"),
6732
- bigint: /* @__PURE__ */ __name((arg) => ZodBigInt.create({ ...arg, coerce: true }), "bigint"),
6733
- date: /* @__PURE__ */ __name((arg) => ZodDate.create({ ...arg, coerce: true }), "date")
6734
- };
6735
- var NEVER = INVALID;
6736
- var z = /* @__PURE__ */ Object.freeze({
6737
- __proto__: null,
6738
- defaultErrorMap: errorMap,
6739
- setErrorMap,
6740
- getErrorMap,
6741
- makeIssue,
6742
- EMPTY_PATH,
6743
- addIssueToContext,
6744
- ParseStatus,
6745
- INVALID,
6746
- DIRTY,
6747
- OK,
6748
- isAborted,
6749
- isDirty,
6750
- isValid,
6751
- isAsync,
6752
- get util() {
6753
- return util;
6754
- },
6755
- get objectUtil() {
6756
- return objectUtil;
6757
- },
6758
- ZodParsedType,
6759
- getParsedType,
6760
- ZodType,
6761
- datetimeRegex,
6762
- ZodString,
6763
- ZodNumber,
6764
- ZodBigInt,
6765
- ZodBoolean,
6766
- ZodDate,
6767
- ZodSymbol,
6768
- ZodUndefined,
6769
- ZodNull,
6770
- ZodAny,
6771
- ZodUnknown,
6772
- ZodNever,
6773
- ZodVoid,
6774
- ZodArray,
6775
- ZodObject,
6776
- ZodUnion,
6777
- ZodDiscriminatedUnion,
6778
- ZodIntersection,
6779
- ZodTuple,
6780
- ZodRecord,
6781
- ZodMap,
6782
- ZodSet,
6783
- ZodFunction,
6784
- ZodLazy,
6785
- ZodLiteral,
6786
- ZodEnum,
6787
- ZodNativeEnum,
6788
- ZodPromise,
6789
- ZodEffects,
6790
- ZodTransformer: ZodEffects,
6791
- ZodOptional,
6792
- ZodNullable,
6793
- ZodDefault,
6794
- ZodCatch,
6795
- ZodNaN,
6796
- BRAND,
6797
- ZodBranded,
6798
- ZodPipeline,
6799
- ZodReadonly,
6800
- custom,
6801
- Schema: ZodType,
6802
- ZodSchema: ZodType,
6803
- late,
6804
- get ZodFirstPartyTypeKind() {
6805
- return ZodFirstPartyTypeKind;
6806
- },
6807
- coerce,
6808
- any: anyType,
6809
- array: arrayType,
6810
- bigint: bigIntType,
6811
- boolean: booleanType,
6812
- date: dateType,
6813
- discriminatedUnion: discriminatedUnionType,
6814
- effect: effectsType,
6815
- "enum": enumType,
6816
- "function": functionType,
6817
- "instanceof": instanceOfType,
6818
- intersection: intersectionType,
6819
- lazy: lazyType,
6820
- literal: literalType,
6821
- map: mapType,
6822
- nan: nanType,
6823
- nativeEnum: nativeEnumType,
6824
- never: neverType,
6825
- "null": nullType,
6826
- nullable: nullableType,
6827
- number: numberType,
6828
- object: objectType,
6829
- oboolean,
6830
- onumber,
6831
- optional: optionalType,
6832
- ostring,
6833
- pipeline: pipelineType,
6834
- preprocess: preprocessType,
6835
- promise: promiseType,
6836
- record: recordType,
6837
- set: setType,
6838
- strictObject: strictObjectType,
6839
- string: stringType,
6840
- symbol: symbolType,
6841
- transformer: effectsType,
6842
- tuple: tupleType,
6843
- "undefined": undefinedType,
6844
- union: unionType,
6845
- unknown: unknownType,
6846
- "void": voidType,
6847
- NEVER,
6848
- ZodIssueCode,
6849
- quotelessJson,
6850
- ZodError
6851
- });
6852
-
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 configBoolean = z.enum([
6877
- "true",
6878
- "false"
6879
- ]).transform((arg) => JSON.parse(arg));
6880
- var configMiddleware = z.union([
6881
- configBoolean,
6882
- z.string().default("../src/trpc/middleware")
6883
- ]);
6884
- var configShield = z.union([
6885
- configBoolean,
6886
- z.string().default("../src/trpc/shields")
6887
- ]);
6888
- var modelActionEnum = z.nativeEnum(ModelAction);
6889
- var configSchema = z.object({
6890
- debug: configBoolean.default("false"),
6891
- withMiddleware: configMiddleware.default("false"),
6892
- withShields: configShield.default("true"),
6893
- withZod: configBoolean.default("true"),
6894
- withNext: configBoolean.default("true"),
6895
- contextPath: z.string().default("../src/trpc/context"),
6896
- trpcOptions: z.boolean().or(z.string()).optional(),
6897
- showModelNameInProcedure: configBoolean.default("true"),
6898
- generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
6899
- return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
6900
- })
6901
- });
6902
-
6903
- // src/helpers.ts
6904
- init_cjs_shims();
6905
-
6906
- // ../path/src/file-path-fns.ts
6907
- init_cjs_shims();
6908
-
6909
- // ../types/src/base.ts
6910
- init_cjs_shims();
6911
- var EMPTY_STRING = "";
6912
- var $NestedValue = Symbol("NestedValue");
6913
-
6914
- // ../path/src/correct-path.ts
6915
- init_cjs_shims();
6916
-
6917
- // ../path/src/is-file.ts
6918
- init_cjs_shims();
6919
- var import_node_fs2 = require("node:fs");
6920
- function isFile(path6, additionalPath) {
6921
- return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
6922
- throwIfNoEntry: false
6923
- })?.isFile());
6924
- }
6925
- __name(isFile, "isFile");
6926
- function isDirectory(path6, additionalPath) {
6927
- return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
6928
- throwIfNoEntry: false
6929
- })?.isDirectory());
6930
- }
6931
- __name(isDirectory, "isDirectory");
6932
- function isAbsolutePath(path6) {
6933
- return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path6);
6934
- }
6935
- __name(isAbsolutePath, "isAbsolutePath");
6936
-
6937
- // ../path/src/correct-path.ts
6938
- var _DRIVE_LETTER_START_RE2 = /^[A-Z]:\//i;
6939
- function normalizeWindowsPath2(input = "") {
6940
- if (!input) {
6941
- return input;
6942
- }
6943
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
6944
- }
6945
- __name(normalizeWindowsPath2, "normalizeWindowsPath");
6946
- var _UNC_REGEX2 = /^[/\\]{2}/;
6947
- var _DRIVE_LETTER_RE2 = /^[A-Z]:$/i;
6948
- function correctPath(path6) {
6949
- if (!path6 || path6.length === 0) {
6950
- return ".";
6951
- }
6952
- path6 = normalizeWindowsPath2(path6);
6953
- const isUNCPath = path6.match(_UNC_REGEX2);
6954
- const isPathAbsolute = isAbsolutePath(path6);
6955
- const trailingSeparator = path6[path6.length - 1] === "/";
6956
- path6 = normalizeString2(path6, !isPathAbsolute);
6957
- if (path6.length === 0) {
6958
- if (isPathAbsolute) {
6959
- return "/";
6960
- }
6961
- return trailingSeparator ? "./" : ".";
6962
- }
6963
- if (trailingSeparator) {
6964
- path6 += "/";
6965
- }
6966
- if (_DRIVE_LETTER_RE2.test(path6)) {
6967
- path6 += "/";
6968
- }
6969
- if (isUNCPath) {
6970
- if (!isPathAbsolute) {
6971
- return `//./${path6}`;
6972
- }
6973
- return `//${path6}`;
6974
- }
6975
- return isPathAbsolute && !isAbsolutePath(path6) ? `/${path6}` : path6;
6976
- }
6977
- __name(correctPath, "correctPath");
6978
- function normalizeString2(path6, allowAboveRoot) {
6979
- let res = "";
6980
- let lastSegmentLength = 0;
6981
- let lastSlash = -1;
6982
- let dots = 0;
6983
- let char = null;
6984
- for (let index = 0; index <= path6.length; ++index) {
6985
- if (index < path6.length) {
6986
- char = path6[index];
6987
- } else if (char === "/") {
6988
- break;
6989
- } else {
6990
- char = "/";
6991
- }
6992
- if (char === "/") {
6993
- if (lastSlash === index - 1 || dots === 1) {
6994
- } else if (dots === 2) {
6995
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
6996
- if (res.length > 2) {
6997
- const lastSlashIndex = res.lastIndexOf("/");
6998
- if (lastSlashIndex === -1) {
6999
- res = "";
7000
- lastSegmentLength = 0;
7001
- } else {
7002
- res = res.slice(0, lastSlashIndex);
7003
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
7004
- }
7005
- lastSlash = index;
7006
- dots = 0;
7007
- continue;
7008
- } else if (res.length > 0) {
7009
- res = "";
7010
- lastSegmentLength = 0;
7011
- lastSlash = index;
7012
- dots = 0;
7013
- continue;
7014
- }
7015
- }
7016
- if (allowAboveRoot) {
7017
- res += res.length > 0 ? "/.." : "..";
7018
- lastSegmentLength = 2;
7019
- }
7020
- } else {
7021
- if (res.length > 0) {
7022
- res += `/${path6.slice(lastSlash + 1, index)}`;
7023
- } else {
7024
- res = path6.slice(lastSlash + 1, index);
7025
- }
7026
- lastSegmentLength = index - lastSlash - 1;
7027
- }
7028
- lastSlash = index;
7029
- dots = 0;
7030
- } else if (char === "." && dots !== -1) {
7031
- ++dots;
7032
- } else {
7033
- dots = -1;
7034
- }
7035
- }
7036
- return res;
7037
- }
7038
- __name(normalizeString2, "normalizeString");
7039
-
7040
- // ../path/src/get-workspace-root.ts
7041
- init_cjs_shims();
7042
-
7043
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/index.js
7044
- init_cjs_shims();
7045
-
7046
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
7047
- init_cjs_shims();
7048
-
7049
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
7050
- init_cjs_shims();
7051
-
7052
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
7053
- init_cjs_shims();
7054
- var __defProp2 = Object.defineProperty;
7055
- var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
7056
- value,
7057
- configurable: true
7058
- }), "__name");
7059
-
7060
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
7061
- var import_node_fs3 = require("node:fs");
7062
- var import_node_path = require("node:path");
7063
- var MAX_PATH_SEARCH_DEPTH = 30;
7064
- var depth = 0;
7065
- function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
7066
- const _startPath = startPath ?? process.cwd();
7067
- if (endDirectoryNames.some((endDirName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endDirName)))) {
7068
- return _startPath;
7069
- }
7070
- if (endFileNames.some((endFileName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
7071
- return _startPath;
7072
- }
7073
- if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
7074
- const parent = (0, import_node_path.join)(_startPath, "..");
7075
- return findFolderUp(parent, endFileNames, endDirectoryNames);
7076
- }
7077
- return void 0;
7078
- }
7079
- __name(findFolderUp, "findFolderUp");
7080
- __name2(findFolderUp, "findFolderUp");
7081
-
7082
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
7083
- init_cjs_shims();
7084
- var _DRIVE_LETTER_START_RE3 = /^[A-Za-z]:\//;
7085
- function normalizeWindowsPath3(input = "") {
7086
- if (!input) {
7087
- return input;
7088
- }
7089
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE3, (r) => r.toUpperCase());
7090
- }
7091
- __name(normalizeWindowsPath3, "normalizeWindowsPath");
7092
- __name2(normalizeWindowsPath3, "normalizeWindowsPath");
7093
- var _UNC_REGEX3 = /^[/\\]{2}/;
7094
- var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
7095
- var _DRIVE_LETTER_RE3 = /^[A-Za-z]:$/;
7096
- var correctPaths2 = /* @__PURE__ */ __name2(function(path6) {
7097
- if (!path6 || path6.length === 0) {
7098
- return ".";
7099
- }
7100
- path6 = normalizeWindowsPath3(path6);
7101
- const isUNCPath = path6.match(_UNC_REGEX3);
7102
- const isPathAbsolute = isAbsolute2(path6);
7103
- const trailingSeparator = path6[path6.length - 1] === "/";
7104
- path6 = normalizeString3(path6, !isPathAbsolute);
7105
- if (path6.length === 0) {
7106
- if (isPathAbsolute) {
7107
- return "/";
7108
- }
7109
- return trailingSeparator ? "./" : ".";
7110
- }
7111
- if (trailingSeparator) {
7112
- path6 += "/";
7113
- }
7114
- if (_DRIVE_LETTER_RE3.test(path6)) {
7115
- path6 += "/";
7116
- }
7117
- if (isUNCPath) {
7118
- if (!isPathAbsolute) {
7119
- return `//./${path6}`;
7120
- }
7121
- return `//${path6}`;
7122
- }
7123
- return isPathAbsolute && !isAbsolute2(path6) ? `/${path6}` : path6;
7124
- }, "correctPaths");
7125
- function cwd() {
7126
- if (typeof process !== "undefined" && typeof process.cwd === "function") {
7127
- return process.cwd().replace(/\\/g, "/");
7128
- }
7129
- return "/";
7130
- }
7131
- __name(cwd, "cwd");
7132
- __name2(cwd, "cwd");
7133
- function normalizeString3(path6, allowAboveRoot) {
7134
- let res = "";
7135
- let lastSegmentLength = 0;
7136
- let lastSlash = -1;
7137
- let dots = 0;
7138
- let char = null;
7139
- for (let index = 0; index <= path6.length; ++index) {
7140
- if (index < path6.length) {
7141
- char = path6[index];
7142
- } else if (char === "/") {
7143
- break;
7144
- } else {
7145
- char = "/";
7146
- }
7147
- if (char === "/") {
7148
- if (lastSlash === index - 1 || dots === 1) {
7149
- } else if (dots === 2) {
7150
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
7151
- if (res.length > 2) {
7152
- const lastSlashIndex = res.lastIndexOf("/");
7153
- if (lastSlashIndex === -1) {
7154
- res = "";
7155
- lastSegmentLength = 0;
7156
- } else {
7157
- res = res.slice(0, lastSlashIndex);
7158
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
7159
- }
7160
- lastSlash = index;
7161
- dots = 0;
7162
- continue;
7163
- } else if (res.length > 0) {
7164
- res = "";
7165
- lastSegmentLength = 0;
7166
- lastSlash = index;
7167
- dots = 0;
7168
- continue;
7169
- }
7170
- }
7171
- if (allowAboveRoot) {
7172
- res += res.length > 0 ? "/.." : "..";
7173
- lastSegmentLength = 2;
7174
- }
7175
- } else {
7176
- if (res.length > 0) {
7177
- res += `/${path6.slice(lastSlash + 1, index)}`;
7178
- } else {
7179
- res = path6.slice(lastSlash + 1, index);
7180
- }
7181
- lastSegmentLength = index - lastSlash - 1;
7182
- }
7183
- lastSlash = index;
7184
- dots = 0;
7185
- } else if (char === "." && dots !== -1) {
7186
- ++dots;
7187
- } else {
7188
- dots = -1;
7189
- }
7190
- }
7191
- return res;
7192
- }
7193
- __name(normalizeString3, "normalizeString");
7194
- __name2(normalizeString3, "normalizeString");
7195
- var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
7196
- return _IS_ABSOLUTE_RE2.test(p);
7197
- }, "isAbsolute");
7198
-
7199
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
7200
- var rootFiles = [
7201
- "storm-workspace.json",
7202
- "storm-workspace.json",
7203
- "storm-workspace.yaml",
7204
- "storm-workspace.yml",
7205
- "storm-workspace.js",
7206
- "storm-workspace.ts",
7207
- ".storm-workspace.json",
7208
- ".storm-workspace.yaml",
7209
- ".storm-workspace.yml",
7210
- ".storm-workspace.js",
7211
- ".storm-workspace.ts",
7212
- "lerna.json",
7213
- "nx.json",
7214
- "turbo.json",
7215
- "npm-workspace.json",
7216
- "yarn-workspace.json",
7217
- "pnpm-workspace.json",
7218
- "npm-workspace.yaml",
7219
- "yarn-workspace.yaml",
7220
- "pnpm-workspace.yaml",
7221
- "npm-workspace.yml",
7222
- "yarn-workspace.yml",
7223
- "pnpm-workspace.yml",
7224
- "npm-lock.json",
7225
- "yarn-lock.json",
7226
- "pnpm-lock.json",
7227
- "npm-lock.yaml",
7228
- "yarn-lock.yaml",
7229
- "pnpm-lock.yaml",
7230
- "npm-lock.yml",
7231
- "yarn-lock.yml",
7232
- "pnpm-lock.yml",
7233
- "bun.lockb"
7234
- ];
7235
- var rootDirectories = [
7236
- ".storm-workspace",
7237
- ".nx",
7238
- ".github",
7239
- ".vscode",
7240
- ".verdaccio"
7241
- ];
7242
- function findWorkspaceRootSafe(pathInsideMonorepo) {
7243
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
7244
- return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
7245
- }
7246
- return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
7247
- }
7248
- __name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
7249
- __name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
7250
- function findWorkspaceRoot(pathInsideMonorepo) {
7251
- const result = findWorkspaceRootSafe(pathInsideMonorepo);
7252
- if (!result) {
7253
- throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
7254
- ${rootFiles.join("\n")}
7255
- Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
7256
- }
7257
- return result;
7258
- }
7259
- __name(findWorkspaceRoot, "findWorkspaceRoot");
7260
- __name2(findWorkspaceRoot, "findWorkspaceRoot");
7010
+ ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
7011
+ ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
7012
+ ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
7013
+ ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
7014
+ ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
7015
+ ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
7016
+ ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
7017
+ ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
7018
+ ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
7019
+ ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
7020
+ ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
7021
+ ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
7022
+ ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
7023
+ ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
7024
+ ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
7025
+ ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
7026
+ ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
7027
+ ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
7028
+ ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
7029
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
7030
+ var instanceOfType = /* @__PURE__ */ __name((cls, params = {
7031
+ message: `Input not instance of ${cls.name}`
7032
+ }) => custom((data) => data instanceof cls, params), "instanceOfType");
7033
+ var stringType = ZodString.create;
7034
+ var numberType = ZodNumber.create;
7035
+ var nanType = ZodNaN.create;
7036
+ var bigIntType = ZodBigInt.create;
7037
+ var booleanType = ZodBoolean.create;
7038
+ var dateType = ZodDate.create;
7039
+ var symbolType = ZodSymbol.create;
7040
+ var undefinedType = ZodUndefined.create;
7041
+ var nullType = ZodNull.create;
7042
+ var anyType = ZodAny.create;
7043
+ var unknownType = ZodUnknown.create;
7044
+ var neverType = ZodNever.create;
7045
+ var voidType = ZodVoid.create;
7046
+ var arrayType = ZodArray.create;
7047
+ var objectType = ZodObject.create;
7048
+ var strictObjectType = ZodObject.strictCreate;
7049
+ var unionType = ZodUnion.create;
7050
+ var discriminatedUnionType = ZodDiscriminatedUnion.create;
7051
+ var intersectionType = ZodIntersection.create;
7052
+ var tupleType = ZodTuple.create;
7053
+ var recordType = ZodRecord.create;
7054
+ var mapType = ZodMap.create;
7055
+ var setType = ZodSet.create;
7056
+ var functionType = ZodFunction.create;
7057
+ var lazyType = ZodLazy.create;
7058
+ var literalType = ZodLiteral.create;
7059
+ var enumType = ZodEnum.create;
7060
+ var nativeEnumType = ZodNativeEnum.create;
7061
+ var promiseType = ZodPromise.create;
7062
+ var effectsType = ZodEffects.create;
7063
+ var optionalType = ZodOptional.create;
7064
+ var nullableType = ZodNullable.create;
7065
+ var preprocessType = ZodEffects.createWithPreprocess;
7066
+ var pipelineType = ZodPipeline.create;
7067
+ var ostring = /* @__PURE__ */ __name(() => stringType().optional(), "ostring");
7068
+ var onumber = /* @__PURE__ */ __name(() => numberType().optional(), "onumber");
7069
+ var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean");
7070
+ var coerce = {
7071
+ string: /* @__PURE__ */ __name((arg) => ZodString.create({ ...arg, coerce: true }), "string"),
7072
+ number: /* @__PURE__ */ __name((arg) => ZodNumber.create({ ...arg, coerce: true }), "number"),
7073
+ boolean: /* @__PURE__ */ __name((arg) => ZodBoolean.create({
7074
+ ...arg,
7075
+ coerce: true
7076
+ }), "boolean"),
7077
+ bigint: /* @__PURE__ */ __name((arg) => ZodBigInt.create({ ...arg, coerce: true }), "bigint"),
7078
+ date: /* @__PURE__ */ __name((arg) => ZodDate.create({ ...arg, coerce: true }), "date")
7079
+ };
7080
+ var NEVER = INVALID;
7081
+ var z = /* @__PURE__ */ Object.freeze({
7082
+ __proto__: null,
7083
+ defaultErrorMap: errorMap,
7084
+ setErrorMap,
7085
+ getErrorMap,
7086
+ makeIssue,
7087
+ EMPTY_PATH,
7088
+ addIssueToContext,
7089
+ ParseStatus,
7090
+ INVALID,
7091
+ DIRTY,
7092
+ OK,
7093
+ isAborted,
7094
+ isDirty,
7095
+ isValid,
7096
+ isAsync,
7097
+ get util() {
7098
+ return util;
7099
+ },
7100
+ get objectUtil() {
7101
+ return objectUtil;
7102
+ },
7103
+ ZodParsedType,
7104
+ getParsedType,
7105
+ ZodType,
7106
+ datetimeRegex,
7107
+ ZodString,
7108
+ ZodNumber,
7109
+ ZodBigInt,
7110
+ ZodBoolean,
7111
+ ZodDate,
7112
+ ZodSymbol,
7113
+ ZodUndefined,
7114
+ ZodNull,
7115
+ ZodAny,
7116
+ ZodUnknown,
7117
+ ZodNever,
7118
+ ZodVoid,
7119
+ ZodArray,
7120
+ ZodObject,
7121
+ ZodUnion,
7122
+ ZodDiscriminatedUnion,
7123
+ ZodIntersection,
7124
+ ZodTuple,
7125
+ ZodRecord,
7126
+ ZodMap,
7127
+ ZodSet,
7128
+ ZodFunction,
7129
+ ZodLazy,
7130
+ ZodLiteral,
7131
+ ZodEnum,
7132
+ ZodNativeEnum,
7133
+ ZodPromise,
7134
+ ZodEffects,
7135
+ ZodTransformer: ZodEffects,
7136
+ ZodOptional,
7137
+ ZodNullable,
7138
+ ZodDefault,
7139
+ ZodCatch,
7140
+ ZodNaN,
7141
+ BRAND,
7142
+ ZodBranded,
7143
+ ZodPipeline,
7144
+ ZodReadonly,
7145
+ custom,
7146
+ Schema: ZodType,
7147
+ ZodSchema: ZodType,
7148
+ late,
7149
+ get ZodFirstPartyTypeKind() {
7150
+ return ZodFirstPartyTypeKind;
7151
+ },
7152
+ coerce,
7153
+ any: anyType,
7154
+ array: arrayType,
7155
+ bigint: bigIntType,
7156
+ boolean: booleanType,
7157
+ date: dateType,
7158
+ discriminatedUnion: discriminatedUnionType,
7159
+ effect: effectsType,
7160
+ "enum": enumType,
7161
+ "function": functionType,
7162
+ "instanceof": instanceOfType,
7163
+ intersection: intersectionType,
7164
+ lazy: lazyType,
7165
+ literal: literalType,
7166
+ map: mapType,
7167
+ nan: nanType,
7168
+ nativeEnum: nativeEnumType,
7169
+ never: neverType,
7170
+ "null": nullType,
7171
+ nullable: nullableType,
7172
+ number: numberType,
7173
+ object: objectType,
7174
+ oboolean,
7175
+ onumber,
7176
+ optional: optionalType,
7177
+ ostring,
7178
+ pipeline: pipelineType,
7179
+ preprocess: preprocessType,
7180
+ promise: promiseType,
7181
+ record: recordType,
7182
+ set: setType,
7183
+ strictObject: strictObjectType,
7184
+ string: stringType,
7185
+ symbol: symbolType,
7186
+ transformer: effectsType,
7187
+ tuple: tupleType,
7188
+ "undefined": undefinedType,
7189
+ union: unionType,
7190
+ unknown: unknownType,
7191
+ "void": voidType,
7192
+ NEVER,
7193
+ ZodIssueCode,
7194
+ quotelessJson,
7195
+ ZodError
7196
+ });
7261
7197
 
7262
7198
  // ../path/src/get-parent-path.ts
7263
7199
  init_cjs_shims();
@@ -7413,6 +7349,66 @@ function relativePath(from, to) {
7413
7349
  }
7414
7350
  __name(relativePath, "relativePath");
7415
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_path6 = __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 configBoolean = z.enum([
7387
+ "true",
7388
+ "false"
7389
+ ]).transform((arg) => JSON.parse(arg));
7390
+ var configMiddleware = z.union([
7391
+ configBoolean,
7392
+ z.string().default("../src/trpc/middleware")
7393
+ ]);
7394
+ var modelActionEnum = z.nativeEnum(ModelAction);
7395
+ var configSchema = z.object({
7396
+ debug: configBoolean.default("false"),
7397
+ withMiddleware: configMiddleware.default("false"),
7398
+ withShield: z.boolean().or(z.string()).default("true"),
7399
+ withZod: configBoolean.default("true"),
7400
+ withNext: configBoolean.default("true"),
7401
+ contextPath: z.string().default("../src/trpc/context"),
7402
+ trpcOptions: z.boolean().or(z.string()).optional(),
7403
+ showModelNameInProcedure: configBoolean.default("true"),
7404
+ generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
7405
+ return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
7406
+ })
7407
+ });
7408
+
7409
+ // src/helpers.ts
7410
+ init_cjs_shims();
7411
+
7416
7412
  // src/utils/get-prisma-internals.ts
7417
7413
  init_cjs_shims();
7418
7414
 
@@ -7622,7 +7618,7 @@ __name(getRelativePath, "getRelativePath");
7622
7618
 
7623
7619
  // src/helpers.ts
7624
7620
  var getProcedureName = /* @__PURE__ */ __name((config) => {
7625
- return config.withShields ? "shieldedProcedure" : config.withMiddleware ? "protectedProcedure" : "publicProcedure";
7621
+ return config.withShield ? "shieldedProcedure" : config.withMiddleware ? "protectedProcedure" : "publicProcedure";
7626
7622
  }, "getProcedureName");
7627
7623
  var generateCreateRouterImport = /* @__PURE__ */ __name(({ sourceFile, config }) => {
7628
7624
  const imports = [
@@ -7639,7 +7635,7 @@ var generateCreateRouterImport = /* @__PURE__ */ __name(({ sourceFile, config })
7639
7635
  var generateShieldImport = /* @__PURE__ */ __name(async (sourceFile, options, value) => {
7640
7636
  const internals = await getPrismaInternals();
7641
7637
  const outputDir = internals.parseEnvValue(options.generator.output);
7642
- let shieldPath = getRelativePath(outputDir, "shield");
7638
+ let shieldPath = joinPaths(outputDir, "shield");
7643
7639
  if (typeof value === "string") {
7644
7640
  shieldPath = getRelativePath(outputDir, value, true, options.schemaPath);
7645
7641
  }
@@ -7661,37 +7657,30 @@ var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural,
7661
7657
  async function generateBaseRouter(sourceFile, config, options) {
7662
7658
  const internals = await getPrismaInternals();
7663
7659
  const outputDir = internals.parseEnvValue(options.generator.output);
7664
- const relativeContextPath = getRelativePath(outputDir, config.contextPath, true, options.schemaPath);
7665
7660
  sourceFile.addStatements(
7666
7661
  /* ts */
7667
7662
  `
7668
- import type { Context } from '${relativeContextPath}';
7669
- `
7663
+ import type { Context } from '${getRelativePath(outputDir, config.contextPath, true, options.schemaPath)}';`
7670
7664
  );
7671
7665
  if (config.trpcOptions) {
7672
7666
  sourceFile.addStatements(
7673
7667
  /* ts */
7674
7668
  `
7675
- import trpcOptions from '${getRelativePath(outputDir, typeof config.trpcOptions === "boolean" ? joinPaths(outputDir, "options") : config.trpcOptions, true, options.schemaPath)}';
7676
- `
7669
+ import trpcOptions from '${getRelativePath(outputDir, typeof config.trpcOptions === "boolean" ? joinPaths(outputDir, "options") : config.trpcOptions, true, options.schemaPath)}';`
7677
7670
  );
7678
7671
  }
7679
7672
  if (config.withNext) {
7680
7673
  sourceFile.addStatements(
7681
7674
  /* ts */
7682
- `
7683
- import { createContext } from '${relativeContextPath}';
7684
- import { initTRPC, TRPCError } from '@trpc/server';
7685
- import { experimental_nextAppDirCaller } from '@trpc/server/adapters/next-app-dir';
7686
- import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';
7687
- `
7675
+ `import { createContext } from '${getRelativePath(outputDir, config.contextPath, true, options.schemaPath)}';
7676
+ import { initTRPC } from '@trpc/server';
7677
+ import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';`
7688
7678
  );
7689
7679
  }
7690
7680
  sourceFile.addStatements(
7691
7681
  /* ts */
7692
7682
  `
7693
- export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});
7694
- `
7683
+ export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});`
7695
7684
  );
7696
7685
  const middlewares = [];
7697
7686
  if (config.withMiddleware && typeof config.withMiddleware === "boolean") {
@@ -7731,7 +7720,7 @@ async function generateBaseRouter(sourceFile, config, options) {
7731
7720
  )
7732
7721
  });
7733
7722
  }
7734
- if (config.withShields) {
7723
+ if (config.withShield) {
7735
7724
  sourceFile.addStatements(
7736
7725
  /* ts */
7737
7726
  `
@@ -7780,13 +7769,7 @@ export const createCallerFactory = t.createCallerFactory;`
7780
7769
  }
7781
7770
  sourceFile.addStatements(
7782
7771
  /* ts */
7783
- `
7784
- .use(${middleware.type === "shield" ? "permissionsMiddleware" : "globalMiddleware"})${config.withNext ? `.experimental_caller(
7785
- experimental_nextAppDirCaller({
7786
- normalizeFormData: true,
7787
- }),
7788
- )` : ""}
7789
- `
7772
+ `.use(${middleware.type === "shield" ? "permissionsMiddleware" : "globalMiddleware"})`
7790
7773
  );
7791
7774
  });
7792
7775
  }
@@ -11628,31 +11611,21 @@ async function generate(options) {
11628
11611
  queries.sort();
11629
11612
  mutations.sort();
11630
11613
  subscriptions.sort();
11631
- if (config.withShields !== false) {
11614
+ if (config.withShield !== false) {
11632
11615
  consoleLog("Generating tRPC Shield");
11633
- const shieldOutputDir = outputDir;
11634
- consoleLog("Constructing tRPC Shield source file");
11635
- const shieldText = await constructShield({
11636
- queries,
11637
- mutations,
11638
- subscriptions
11639
- }, config, {
11640
- ...options,
11641
- generator: {
11642
- ...options.generator,
11643
- output: {
11644
- fromEnvVar: null,
11645
- ...options.generator.output,
11646
- value: shieldOutputDir
11647
- },
11648
- config: {
11649
- ...options.generator.config,
11650
- contextPath: config.contextPath
11651
- }
11652
- }
11653
- }, shieldOutputDir);
11654
- consoleLog("Saving tRPC Shield source file to disk");
11655
- await writeFileSafely(joinPaths(shieldOutputDir, "shield.ts"), shieldText);
11616
+ if (typeof config.withShield === "string" && (existsSync(config.withShield) || existsSync(joinPaths(config.withShield, "shield.ts")))) {
11617
+ consoleLog("Skipping tRPC Shield generation as path provided already exists");
11618
+ } else {
11619
+ consoleLog("Constructing tRPC Shield source file");
11620
+ const shieldOutputDir = typeof config.withShield === "string" ? findFilePath(config.withShield) : outputDir;
11621
+ const shieldText = await constructShield({
11622
+ queries,
11623
+ mutations,
11624
+ subscriptions
11625
+ }, config, options, shieldOutputDir);
11626
+ consoleLog("Saving tRPC Shield source file to disk");
11627
+ await writeFileSafely(joinPaths(shieldOutputDir, "shield.ts"), shieldText);
11628
+ }
11656
11629
  } else {
11657
11630
  consoleLog("Skipping tRPC Shield generation");
11658
11631
  }
@@ -11683,8 +11656,8 @@ export default {${config.withNext ? "\n transformer," : ""}
11683
11656
  overwrite: true
11684
11657
  });
11685
11658
  consoleLog("Generating tRPC imports");
11686
- if (config.withShields) {
11687
- await generateShieldImport(createRouter, options, config.withShields);
11659
+ if (config.withShield) {
11660
+ await generateShieldImport(createRouter, options, config.withShield);
11688
11661
  }
11689
11662
  consoleLog("Generating tRPC base router");
11690
11663
  await generateBaseRouter(createRouter, config, options);