@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.
package/dist/index.cjs CHANGED
@@ -2499,6 +2499,21 @@ async function removeDirectory(path6) {
2499
2499
  }
2500
2500
  __name(removeDirectory, "removeDirectory");
2501
2501
 
2502
+ // ../path/src/file-path-fns.ts
2503
+ init_cjs_shims();
2504
+
2505
+ // ../types/src/base.ts
2506
+ init_cjs_shims();
2507
+ var EMPTY_STRING = "";
2508
+ var $NestedValue = Symbol("NestedValue");
2509
+
2510
+ // ../path/src/correct-path.ts
2511
+ init_cjs_shims();
2512
+
2513
+ // ../path/src/is-file.ts
2514
+ init_cjs_shims();
2515
+ var import_node_fs2 = require("node:fs");
2516
+
2502
2517
  // ../path/src/join-paths.ts
2503
2518
  init_cjs_shims();
2504
2519
  var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
@@ -2627,75 +2642,405 @@ function normalizeString(path6, allowAboveRoot) {
2627
2642
  }
2628
2643
  __name(normalizeString, "normalizeString");
2629
2644
 
2630
- // ../string-format/src/lower-case-first.ts
2645
+ // ../path/src/is-file.ts
2646
+ function isFile(path6, additionalPath) {
2647
+ return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
2648
+ throwIfNoEntry: false
2649
+ })?.isFile());
2650
+ }
2651
+ __name(isFile, "isFile");
2652
+ function isDirectory(path6, additionalPath) {
2653
+ return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
2654
+ throwIfNoEntry: false
2655
+ })?.isDirectory());
2656
+ }
2657
+ __name(isDirectory, "isDirectory");
2658
+ function isAbsolutePath(path6) {
2659
+ return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path6);
2660
+ }
2661
+ __name(isAbsolutePath, "isAbsolutePath");
2662
+
2663
+ // ../path/src/correct-path.ts
2664
+ var _DRIVE_LETTER_START_RE2 = /^[A-Z]:\//i;
2665
+ function normalizeWindowsPath2(input = "") {
2666
+ if (!input) {
2667
+ return input;
2668
+ }
2669
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
2670
+ }
2671
+ __name(normalizeWindowsPath2, "normalizeWindowsPath");
2672
+ var _UNC_REGEX2 = /^[/\\]{2}/;
2673
+ var _DRIVE_LETTER_RE2 = /^[A-Z]:$/i;
2674
+ function correctPath(path6) {
2675
+ if (!path6 || path6.length === 0) {
2676
+ return ".";
2677
+ }
2678
+ path6 = normalizeWindowsPath2(path6);
2679
+ const isUNCPath = path6.match(_UNC_REGEX2);
2680
+ const isPathAbsolute = isAbsolutePath(path6);
2681
+ const trailingSeparator = path6[path6.length - 1] === "/";
2682
+ path6 = normalizeString2(path6, !isPathAbsolute);
2683
+ if (path6.length === 0) {
2684
+ if (isPathAbsolute) {
2685
+ return "/";
2686
+ }
2687
+ return trailingSeparator ? "./" : ".";
2688
+ }
2689
+ if (trailingSeparator) {
2690
+ path6 += "/";
2691
+ }
2692
+ if (_DRIVE_LETTER_RE2.test(path6)) {
2693
+ path6 += "/";
2694
+ }
2695
+ if (isUNCPath) {
2696
+ if (!isPathAbsolute) {
2697
+ return `//./${path6}`;
2698
+ }
2699
+ return `//${path6}`;
2700
+ }
2701
+ return isPathAbsolute && !isAbsolutePath(path6) ? `/${path6}` : path6;
2702
+ }
2703
+ __name(correctPath, "correctPath");
2704
+ function normalizeString2(path6, allowAboveRoot) {
2705
+ let res = "";
2706
+ let lastSegmentLength = 0;
2707
+ let lastSlash = -1;
2708
+ let dots = 0;
2709
+ let char = null;
2710
+ for (let index = 0; index <= path6.length; ++index) {
2711
+ if (index < path6.length) {
2712
+ char = path6[index];
2713
+ } else if (char === "/") {
2714
+ break;
2715
+ } else {
2716
+ char = "/";
2717
+ }
2718
+ if (char === "/") {
2719
+ if (lastSlash === index - 1 || dots === 1) {
2720
+ } else if (dots === 2) {
2721
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
2722
+ if (res.length > 2) {
2723
+ const lastSlashIndex = res.lastIndexOf("/");
2724
+ if (lastSlashIndex === -1) {
2725
+ res = "";
2726
+ lastSegmentLength = 0;
2727
+ } else {
2728
+ res = res.slice(0, lastSlashIndex);
2729
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
2730
+ }
2731
+ lastSlash = index;
2732
+ dots = 0;
2733
+ continue;
2734
+ } else if (res.length > 0) {
2735
+ res = "";
2736
+ lastSegmentLength = 0;
2737
+ lastSlash = index;
2738
+ dots = 0;
2739
+ continue;
2740
+ }
2741
+ }
2742
+ if (allowAboveRoot) {
2743
+ res += res.length > 0 ? "/.." : "..";
2744
+ lastSegmentLength = 2;
2745
+ }
2746
+ } else {
2747
+ if (res.length > 0) {
2748
+ res += `/${path6.slice(lastSlash + 1, index)}`;
2749
+ } else {
2750
+ res = path6.slice(lastSlash + 1, index);
2751
+ }
2752
+ lastSegmentLength = index - lastSlash - 1;
2753
+ }
2754
+ lastSlash = index;
2755
+ dots = 0;
2756
+ } else if (char === "." && dots !== -1) {
2757
+ ++dots;
2758
+ } else {
2759
+ dots = -1;
2760
+ }
2761
+ }
2762
+ return res;
2763
+ }
2764
+ __name(normalizeString2, "normalizeString");
2765
+
2766
+ // ../path/src/get-workspace-root.ts
2631
2767
  init_cjs_shims();
2632
- var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
2633
- return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
2634
- }, "lowerCaseFirst");
2635
2768
 
2636
- // src/prisma-generator.ts
2637
- var import_node_path6 = __toESM(require("node:path"), 1);
2638
- var import_pluralize = __toESM(require_pluralize(), 1);
2769
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/index.js
2770
+ init_cjs_shims();
2639
2771
 
2640
- // src/config.ts
2772
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
2641
2773
  init_cjs_shims();
2642
2774
 
2643
- // ../../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
2775
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
2644
2776
  init_cjs_shims();
2645
- var util;
2646
- (function(util2) {
2647
- util2.assertEqual = (val) => val;
2648
- function assertIs(_arg) {
2777
+
2778
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
2779
+ init_cjs_shims();
2780
+ var __defProp2 = Object.defineProperty;
2781
+ var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
2782
+ value,
2783
+ configurable: true
2784
+ }), "__name");
2785
+
2786
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
2787
+ var import_node_fs3 = require("node:fs");
2788
+ var import_node_path = require("node:path");
2789
+ var MAX_PATH_SEARCH_DEPTH = 30;
2790
+ var depth = 0;
2791
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
2792
+ const _startPath = startPath ?? process.cwd();
2793
+ if (endDirectoryNames.some((endDirName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endDirName)))) {
2794
+ return _startPath;
2649
2795
  }
2650
- __name(assertIs, "assertIs");
2651
- util2.assertIs = assertIs;
2652
- function assertNever(_x) {
2653
- throw new Error();
2796
+ if (endFileNames.some((endFileName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
2797
+ return _startPath;
2654
2798
  }
2655
- __name(assertNever, "assertNever");
2656
- util2.assertNever = assertNever;
2657
- util2.arrayToEnum = (items) => {
2658
- const obj = {};
2659
- for (const item of items) {
2660
- obj[item] = item;
2661
- }
2662
- return obj;
2663
- };
2664
- util2.getValidEnumValues = (obj) => {
2665
- const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
2666
- const filtered = {};
2667
- for (const k of validKeys) {
2668
- filtered[k] = obj[k];
2669
- }
2670
- return util2.objectValues(filtered);
2671
- };
2672
- util2.objectValues = (obj) => {
2673
- return util2.objectKeys(obj).map(function(e) {
2674
- return obj[e];
2675
- });
2676
- };
2677
- util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
2678
- const keys = [];
2679
- for (const key in object) {
2680
- if (Object.prototype.hasOwnProperty.call(object, key)) {
2681
- keys.push(key);
2682
- }
2683
- }
2684
- return keys;
2685
- };
2686
- util2.find = (arr, checker) => {
2687
- for (const item of arr) {
2688
- if (checker(item))
2689
- return item;
2799
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
2800
+ const parent = (0, import_node_path.join)(_startPath, "..");
2801
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
2802
+ }
2803
+ return void 0;
2804
+ }
2805
+ __name(findFolderUp, "findFolderUp");
2806
+ __name2(findFolderUp, "findFolderUp");
2807
+
2808
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
2809
+ init_cjs_shims();
2810
+ var _DRIVE_LETTER_START_RE3 = /^[A-Za-z]:\//;
2811
+ function normalizeWindowsPath3(input = "") {
2812
+ if (!input) {
2813
+ return input;
2814
+ }
2815
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE3, (r) => r.toUpperCase());
2816
+ }
2817
+ __name(normalizeWindowsPath3, "normalizeWindowsPath");
2818
+ __name2(normalizeWindowsPath3, "normalizeWindowsPath");
2819
+ var _UNC_REGEX3 = /^[/\\]{2}/;
2820
+ var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
2821
+ var _DRIVE_LETTER_RE3 = /^[A-Za-z]:$/;
2822
+ var correctPaths2 = /* @__PURE__ */ __name2(function(path6) {
2823
+ if (!path6 || path6.length === 0) {
2824
+ return ".";
2825
+ }
2826
+ path6 = normalizeWindowsPath3(path6);
2827
+ const isUNCPath = path6.match(_UNC_REGEX3);
2828
+ const isPathAbsolute = isAbsolute2(path6);
2829
+ const trailingSeparator = path6[path6.length - 1] === "/";
2830
+ path6 = normalizeString3(path6, !isPathAbsolute);
2831
+ if (path6.length === 0) {
2832
+ if (isPathAbsolute) {
2833
+ return "/";
2690
2834
  }
2691
- return void 0;
2692
- };
2693
- util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
2694
- function joinValues(array, separator = " | ") {
2695
- return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
2835
+ return trailingSeparator ? "./" : ".";
2696
2836
  }
2697
- __name(joinValues, "joinValues");
2698
- util2.joinValues = joinValues;
2837
+ if (trailingSeparator) {
2838
+ path6 += "/";
2839
+ }
2840
+ if (_DRIVE_LETTER_RE3.test(path6)) {
2841
+ path6 += "/";
2842
+ }
2843
+ if (isUNCPath) {
2844
+ if (!isPathAbsolute) {
2845
+ return `//./${path6}`;
2846
+ }
2847
+ return `//${path6}`;
2848
+ }
2849
+ return isPathAbsolute && !isAbsolute2(path6) ? `/${path6}` : path6;
2850
+ }, "correctPaths");
2851
+ function cwd() {
2852
+ if (typeof process !== "undefined" && typeof process.cwd === "function") {
2853
+ return process.cwd().replace(/\\/g, "/");
2854
+ }
2855
+ return "/";
2856
+ }
2857
+ __name(cwd, "cwd");
2858
+ __name2(cwd, "cwd");
2859
+ function normalizeString3(path6, allowAboveRoot) {
2860
+ let res = "";
2861
+ let lastSegmentLength = 0;
2862
+ let lastSlash = -1;
2863
+ let dots = 0;
2864
+ let char = null;
2865
+ for (let index = 0; index <= path6.length; ++index) {
2866
+ if (index < path6.length) {
2867
+ char = path6[index];
2868
+ } else if (char === "/") {
2869
+ break;
2870
+ } else {
2871
+ char = "/";
2872
+ }
2873
+ if (char === "/") {
2874
+ if (lastSlash === index - 1 || dots === 1) {
2875
+ } else if (dots === 2) {
2876
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
2877
+ if (res.length > 2) {
2878
+ const lastSlashIndex = res.lastIndexOf("/");
2879
+ if (lastSlashIndex === -1) {
2880
+ res = "";
2881
+ lastSegmentLength = 0;
2882
+ } else {
2883
+ res = res.slice(0, lastSlashIndex);
2884
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
2885
+ }
2886
+ lastSlash = index;
2887
+ dots = 0;
2888
+ continue;
2889
+ } else if (res.length > 0) {
2890
+ res = "";
2891
+ lastSegmentLength = 0;
2892
+ lastSlash = index;
2893
+ dots = 0;
2894
+ continue;
2895
+ }
2896
+ }
2897
+ if (allowAboveRoot) {
2898
+ res += res.length > 0 ? "/.." : "..";
2899
+ lastSegmentLength = 2;
2900
+ }
2901
+ } else {
2902
+ if (res.length > 0) {
2903
+ res += `/${path6.slice(lastSlash + 1, index)}`;
2904
+ } else {
2905
+ res = path6.slice(lastSlash + 1, index);
2906
+ }
2907
+ lastSegmentLength = index - lastSlash - 1;
2908
+ }
2909
+ lastSlash = index;
2910
+ dots = 0;
2911
+ } else if (char === "." && dots !== -1) {
2912
+ ++dots;
2913
+ } else {
2914
+ dots = -1;
2915
+ }
2916
+ }
2917
+ return res;
2918
+ }
2919
+ __name(normalizeString3, "normalizeString");
2920
+ __name2(normalizeString3, "normalizeString");
2921
+ var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
2922
+ return _IS_ABSOLUTE_RE2.test(p);
2923
+ }, "isAbsolute");
2924
+
2925
+ // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
2926
+ var rootFiles = [
2927
+ "storm-workspace.json",
2928
+ "storm-workspace.json",
2929
+ "storm-workspace.yaml",
2930
+ "storm-workspace.yml",
2931
+ "storm-workspace.js",
2932
+ "storm-workspace.ts",
2933
+ ".storm-workspace.json",
2934
+ ".storm-workspace.yaml",
2935
+ ".storm-workspace.yml",
2936
+ ".storm-workspace.js",
2937
+ ".storm-workspace.ts",
2938
+ "lerna.json",
2939
+ "nx.json",
2940
+ "turbo.json",
2941
+ "npm-workspace.json",
2942
+ "yarn-workspace.json",
2943
+ "pnpm-workspace.json",
2944
+ "npm-workspace.yaml",
2945
+ "yarn-workspace.yaml",
2946
+ "pnpm-workspace.yaml",
2947
+ "npm-workspace.yml",
2948
+ "yarn-workspace.yml",
2949
+ "pnpm-workspace.yml",
2950
+ "npm-lock.json",
2951
+ "yarn-lock.json",
2952
+ "pnpm-lock.json",
2953
+ "npm-lock.yaml",
2954
+ "yarn-lock.yaml",
2955
+ "pnpm-lock.yaml",
2956
+ "npm-lock.yml",
2957
+ "yarn-lock.yml",
2958
+ "pnpm-lock.yml",
2959
+ "bun.lockb"
2960
+ ];
2961
+ var rootDirectories = [
2962
+ ".storm-workspace",
2963
+ ".nx",
2964
+ ".github",
2965
+ ".vscode",
2966
+ ".verdaccio"
2967
+ ];
2968
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
2969
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
2970
+ return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
2971
+ }
2972
+ return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
2973
+ }
2974
+ __name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
2975
+ __name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
2976
+ function findWorkspaceRoot(pathInsideMonorepo) {
2977
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
2978
+ if (!result) {
2979
+ throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
2980
+ ${rootFiles.join("\n")}
2981
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
2982
+ }
2983
+ return result;
2984
+ }
2985
+ __name(findWorkspaceRoot, "findWorkspaceRoot");
2986
+ __name2(findWorkspaceRoot, "findWorkspaceRoot");
2987
+
2988
+ // ../../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
2989
+ init_cjs_shims();
2990
+ var util;
2991
+ (function(util2) {
2992
+ util2.assertEqual = (val) => val;
2993
+ function assertIs(_arg) {
2994
+ }
2995
+ __name(assertIs, "assertIs");
2996
+ util2.assertIs = assertIs;
2997
+ function assertNever(_x) {
2998
+ throw new Error();
2999
+ }
3000
+ __name(assertNever, "assertNever");
3001
+ util2.assertNever = assertNever;
3002
+ util2.arrayToEnum = (items) => {
3003
+ const obj = {};
3004
+ for (const item of items) {
3005
+ obj[item] = item;
3006
+ }
3007
+ return obj;
3008
+ };
3009
+ util2.getValidEnumValues = (obj) => {
3010
+ const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
3011
+ const filtered = {};
3012
+ for (const k of validKeys) {
3013
+ filtered[k] = obj[k];
3014
+ }
3015
+ return util2.objectValues(filtered);
3016
+ };
3017
+ util2.objectValues = (obj) => {
3018
+ return util2.objectKeys(obj).map(function(e) {
3019
+ return obj[e];
3020
+ });
3021
+ };
3022
+ util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
3023
+ const keys = [];
3024
+ for (const key in object) {
3025
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
3026
+ keys.push(key);
3027
+ }
3028
+ }
3029
+ return keys;
3030
+ };
3031
+ util2.find = (arr, checker) => {
3032
+ for (const item of arr) {
3033
+ if (checker(item))
3034
+ return item;
3035
+ }
3036
+ return void 0;
3037
+ };
3038
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
3039
+ function joinValues(array, separator = " | ") {
3040
+ return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
3041
+ }
3042
+ __name(joinValues, "joinValues");
3043
+ util2.joinValues = joinValues;
2699
3044
  util2.jsonStringifyReplacer = (_, value) => {
2700
3045
  if (typeof value === "bigint") {
2701
3046
  return value.toString();
@@ -6658,602 +7003,193 @@ var ZodFirstPartyTypeKind;
6658
7003
  ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
6659
7004
  ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
6660
7005
  ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
6661
- ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
6662
- ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
6663
- ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
6664
- ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
6665
- ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
6666
- ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
6667
- ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
6668
- ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
6669
- ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
6670
- ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
6671
- ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
6672
- ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
6673
- ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
6674
- ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
6675
- ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
6676
- ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
6677
- ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
6678
- ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
6679
- ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
6680
- })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
6681
- var instanceOfType = /* @__PURE__ */ __name((cls, params = {
6682
- message: `Input not instance of ${cls.name}`
6683
- }) => custom((data) => data instanceof cls, params), "instanceOfType");
6684
- var stringType = ZodString.create;
6685
- var numberType = ZodNumber.create;
6686
- var nanType = ZodNaN.create;
6687
- var bigIntType = ZodBigInt.create;
6688
- var booleanType = ZodBoolean.create;
6689
- var dateType = ZodDate.create;
6690
- var symbolType = ZodSymbol.create;
6691
- var undefinedType = ZodUndefined.create;
6692
- var nullType = ZodNull.create;
6693
- var anyType = ZodAny.create;
6694
- var unknownType = ZodUnknown.create;
6695
- var neverType = ZodNever.create;
6696
- var voidType = ZodVoid.create;
6697
- var arrayType = ZodArray.create;
6698
- var objectType = ZodObject.create;
6699
- var strictObjectType = ZodObject.strictCreate;
6700
- var unionType = ZodUnion.create;
6701
- var discriminatedUnionType = ZodDiscriminatedUnion.create;
6702
- var intersectionType = ZodIntersection.create;
6703
- var tupleType = ZodTuple.create;
6704
- var recordType = ZodRecord.create;
6705
- var mapType = ZodMap.create;
6706
- var setType = ZodSet.create;
6707
- var functionType = ZodFunction.create;
6708
- var lazyType = ZodLazy.create;
6709
- var literalType = ZodLiteral.create;
6710
- var enumType = ZodEnum.create;
6711
- var nativeEnumType = ZodNativeEnum.create;
6712
- var promiseType = ZodPromise.create;
6713
- var effectsType = ZodEffects.create;
6714
- var optionalType = ZodOptional.create;
6715
- var nullableType = ZodNullable.create;
6716
- var preprocessType = ZodEffects.createWithPreprocess;
6717
- var pipelineType = ZodPipeline.create;
6718
- var ostring = /* @__PURE__ */ __name(() => stringType().optional(), "ostring");
6719
- var onumber = /* @__PURE__ */ __name(() => numberType().optional(), "onumber");
6720
- var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean");
6721
- var coerce = {
6722
- string: /* @__PURE__ */ __name((arg) => ZodString.create({ ...arg, coerce: true }), "string"),
6723
- number: /* @__PURE__ */ __name((arg) => ZodNumber.create({ ...arg, coerce: true }), "number"),
6724
- boolean: /* @__PURE__ */ __name((arg) => ZodBoolean.create({
6725
- ...arg,
6726
- coerce: true
6727
- }), "boolean"),
6728
- bigint: /* @__PURE__ */ __name((arg) => ZodBigInt.create({ ...arg, coerce: true }), "bigint"),
6729
- date: /* @__PURE__ */ __name((arg) => ZodDate.create({ ...arg, coerce: true }), "date")
6730
- };
6731
- var NEVER = INVALID;
6732
- var z = /* @__PURE__ */ Object.freeze({
6733
- __proto__: null,
6734
- defaultErrorMap: errorMap,
6735
- setErrorMap,
6736
- getErrorMap,
6737
- makeIssue,
6738
- EMPTY_PATH,
6739
- addIssueToContext,
6740
- ParseStatus,
6741
- INVALID,
6742
- DIRTY,
6743
- OK,
6744
- isAborted,
6745
- isDirty,
6746
- isValid,
6747
- isAsync,
6748
- get util() {
6749
- return util;
6750
- },
6751
- get objectUtil() {
6752
- return objectUtil;
6753
- },
6754
- ZodParsedType,
6755
- getParsedType,
6756
- ZodType,
6757
- datetimeRegex,
6758
- ZodString,
6759
- ZodNumber,
6760
- ZodBigInt,
6761
- ZodBoolean,
6762
- ZodDate,
6763
- ZodSymbol,
6764
- ZodUndefined,
6765
- ZodNull,
6766
- ZodAny,
6767
- ZodUnknown,
6768
- ZodNever,
6769
- ZodVoid,
6770
- ZodArray,
6771
- ZodObject,
6772
- ZodUnion,
6773
- ZodDiscriminatedUnion,
6774
- ZodIntersection,
6775
- ZodTuple,
6776
- ZodRecord,
6777
- ZodMap,
6778
- ZodSet,
6779
- ZodFunction,
6780
- ZodLazy,
6781
- ZodLiteral,
6782
- ZodEnum,
6783
- ZodNativeEnum,
6784
- ZodPromise,
6785
- ZodEffects,
6786
- ZodTransformer: ZodEffects,
6787
- ZodOptional,
6788
- ZodNullable,
6789
- ZodDefault,
6790
- ZodCatch,
6791
- ZodNaN,
6792
- BRAND,
6793
- ZodBranded,
6794
- ZodPipeline,
6795
- ZodReadonly,
6796
- custom,
6797
- Schema: ZodType,
6798
- ZodSchema: ZodType,
6799
- late,
6800
- get ZodFirstPartyTypeKind() {
6801
- return ZodFirstPartyTypeKind;
6802
- },
6803
- coerce,
6804
- any: anyType,
6805
- array: arrayType,
6806
- bigint: bigIntType,
6807
- boolean: booleanType,
6808
- date: dateType,
6809
- discriminatedUnion: discriminatedUnionType,
6810
- effect: effectsType,
6811
- "enum": enumType,
6812
- "function": functionType,
6813
- "instanceof": instanceOfType,
6814
- intersection: intersectionType,
6815
- lazy: lazyType,
6816
- literal: literalType,
6817
- map: mapType,
6818
- nan: nanType,
6819
- nativeEnum: nativeEnumType,
6820
- never: neverType,
6821
- "null": nullType,
6822
- nullable: nullableType,
6823
- number: numberType,
6824
- object: objectType,
6825
- oboolean,
6826
- onumber,
6827
- optional: optionalType,
6828
- ostring,
6829
- pipeline: pipelineType,
6830
- preprocess: preprocessType,
6831
- promise: promiseType,
6832
- record: recordType,
6833
- set: setType,
6834
- strictObject: strictObjectType,
6835
- string: stringType,
6836
- symbol: symbolType,
6837
- transformer: effectsType,
6838
- tuple: tupleType,
6839
- "undefined": undefinedType,
6840
- union: unionType,
6841
- unknown: unknownType,
6842
- "void": voidType,
6843
- NEVER,
6844
- ZodIssueCode,
6845
- quotelessJson,
6846
- ZodError
6847
- });
6848
-
6849
- // src/config.ts
6850
- var ModelAction = /* @__PURE__ */ function(ModelAction2) {
6851
- ModelAction2["findUnique"] = "findUnique";
6852
- ModelAction2["findUniqueOrThrow"] = "findUniqueOrThrow";
6853
- ModelAction2["findFirst"] = "findFirst";
6854
- ModelAction2["findFirstOrThrow"] = "findFirstOrThrow";
6855
- ModelAction2["findMany"] = "findMany";
6856
- ModelAction2["create"] = "create";
6857
- ModelAction2["createMany"] = "createMany";
6858
- ModelAction2["createManyAndReturn"] = "createManyAndReturn";
6859
- ModelAction2["update"] = "update";
6860
- ModelAction2["updateMany"] = "updateMany";
6861
- ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
6862
- ModelAction2["upsert"] = "upsert";
6863
- ModelAction2["delete"] = "delete";
6864
- ModelAction2["deleteMany"] = "deleteMany";
6865
- ModelAction2["groupBy"] = "groupBy";
6866
- ModelAction2["count"] = "count";
6867
- ModelAction2["aggregate"] = "aggregate";
6868
- ModelAction2["findRaw"] = "findRaw";
6869
- ModelAction2["aggregateRaw"] = "aggregateRaw";
6870
- return ModelAction2;
6871
- }(ModelAction || {});
6872
- var configBoolean = z.enum([
6873
- "true",
6874
- "false"
6875
- ]).transform((arg) => JSON.parse(arg));
6876
- var configMiddleware = z.union([
6877
- configBoolean,
6878
- z.string().default("../src/trpc/middleware")
6879
- ]);
6880
- var configShield = z.union([
6881
- configBoolean,
6882
- z.string().default("../src/trpc/shields")
6883
- ]);
6884
- var modelActionEnum = z.nativeEnum(ModelAction);
6885
- var configSchema = z.object({
6886
- debug: configBoolean.default("false"),
6887
- withMiddleware: configMiddleware.default("false"),
6888
- withShields: configShield.default("true"),
6889
- withZod: configBoolean.default("true"),
6890
- withNext: configBoolean.default("true"),
6891
- contextPath: z.string().default("../src/trpc/context"),
6892
- trpcOptions: z.boolean().or(z.string()).optional(),
6893
- showModelNameInProcedure: configBoolean.default("true"),
6894
- generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
6895
- return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
6896
- })
6897
- });
6898
-
6899
- // src/helpers.ts
6900
- init_cjs_shims();
6901
-
6902
- // ../path/src/file-path-fns.ts
6903
- init_cjs_shims();
6904
-
6905
- // ../types/src/base.ts
6906
- init_cjs_shims();
6907
- var EMPTY_STRING = "";
6908
- var $NestedValue = Symbol("NestedValue");
6909
-
6910
- // ../path/src/correct-path.ts
6911
- init_cjs_shims();
6912
-
6913
- // ../path/src/is-file.ts
6914
- init_cjs_shims();
6915
- var import_node_fs2 = require("node:fs");
6916
- function isFile(path6, additionalPath) {
6917
- return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
6918
- throwIfNoEntry: false
6919
- })?.isFile());
6920
- }
6921
- __name(isFile, "isFile");
6922
- function isDirectory(path6, additionalPath) {
6923
- return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path6) : path6, {
6924
- throwIfNoEntry: false
6925
- })?.isDirectory());
6926
- }
6927
- __name(isDirectory, "isDirectory");
6928
- function isAbsolutePath(path6) {
6929
- return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path6);
6930
- }
6931
- __name(isAbsolutePath, "isAbsolutePath");
6932
-
6933
- // ../path/src/correct-path.ts
6934
- var _DRIVE_LETTER_START_RE2 = /^[A-Z]:\//i;
6935
- function normalizeWindowsPath2(input = "") {
6936
- if (!input) {
6937
- return input;
6938
- }
6939
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
6940
- }
6941
- __name(normalizeWindowsPath2, "normalizeWindowsPath");
6942
- var _UNC_REGEX2 = /^[/\\]{2}/;
6943
- var _DRIVE_LETTER_RE2 = /^[A-Z]:$/i;
6944
- function correctPath(path6) {
6945
- if (!path6 || path6.length === 0) {
6946
- return ".";
6947
- }
6948
- path6 = normalizeWindowsPath2(path6);
6949
- const isUNCPath = path6.match(_UNC_REGEX2);
6950
- const isPathAbsolute = isAbsolutePath(path6);
6951
- const trailingSeparator = path6[path6.length - 1] === "/";
6952
- path6 = normalizeString2(path6, !isPathAbsolute);
6953
- if (path6.length === 0) {
6954
- if (isPathAbsolute) {
6955
- return "/";
6956
- }
6957
- return trailingSeparator ? "./" : ".";
6958
- }
6959
- if (trailingSeparator) {
6960
- path6 += "/";
6961
- }
6962
- if (_DRIVE_LETTER_RE2.test(path6)) {
6963
- path6 += "/";
6964
- }
6965
- if (isUNCPath) {
6966
- if (!isPathAbsolute) {
6967
- return `//./${path6}`;
6968
- }
6969
- return `//${path6}`;
6970
- }
6971
- return isPathAbsolute && !isAbsolutePath(path6) ? `/${path6}` : path6;
6972
- }
6973
- __name(correctPath, "correctPath");
6974
- function normalizeString2(path6, allowAboveRoot) {
6975
- let res = "";
6976
- let lastSegmentLength = 0;
6977
- let lastSlash = -1;
6978
- let dots = 0;
6979
- let char = null;
6980
- for (let index = 0; index <= path6.length; ++index) {
6981
- if (index < path6.length) {
6982
- char = path6[index];
6983
- } else if (char === "/") {
6984
- break;
6985
- } else {
6986
- char = "/";
6987
- }
6988
- if (char === "/") {
6989
- if (lastSlash === index - 1 || dots === 1) {
6990
- } else if (dots === 2) {
6991
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
6992
- if (res.length > 2) {
6993
- const lastSlashIndex = res.lastIndexOf("/");
6994
- if (lastSlashIndex === -1) {
6995
- res = "";
6996
- lastSegmentLength = 0;
6997
- } else {
6998
- res = res.slice(0, lastSlashIndex);
6999
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
7000
- }
7001
- lastSlash = index;
7002
- dots = 0;
7003
- continue;
7004
- } else if (res.length > 0) {
7005
- res = "";
7006
- lastSegmentLength = 0;
7007
- lastSlash = index;
7008
- dots = 0;
7009
- continue;
7010
- }
7011
- }
7012
- if (allowAboveRoot) {
7013
- res += res.length > 0 ? "/.." : "..";
7014
- lastSegmentLength = 2;
7015
- }
7016
- } else {
7017
- if (res.length > 0) {
7018
- res += `/${path6.slice(lastSlash + 1, index)}`;
7019
- } else {
7020
- res = path6.slice(lastSlash + 1, index);
7021
- }
7022
- lastSegmentLength = index - lastSlash - 1;
7023
- }
7024
- lastSlash = index;
7025
- dots = 0;
7026
- } else if (char === "." && dots !== -1) {
7027
- ++dots;
7028
- } else {
7029
- dots = -1;
7030
- }
7031
- }
7032
- return res;
7033
- }
7034
- __name(normalizeString2, "normalizeString");
7035
-
7036
- // ../path/src/get-workspace-root.ts
7037
- init_cjs_shims();
7038
-
7039
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/index.js
7040
- init_cjs_shims();
7041
-
7042
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
7043
- init_cjs_shims();
7044
-
7045
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
7046
- init_cjs_shims();
7047
-
7048
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-SHUYVCID.js
7049
- init_cjs_shims();
7050
- var __defProp2 = Object.defineProperty;
7051
- var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
7052
- value,
7053
- configurable: true
7054
- }), "__name");
7055
-
7056
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
7057
- var import_node_fs3 = require("node:fs");
7058
- var import_node_path = require("node:path");
7059
- var MAX_PATH_SEARCH_DEPTH = 30;
7060
- var depth = 0;
7061
- function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
7062
- const _startPath = startPath ?? process.cwd();
7063
- if (endDirectoryNames.some((endDirName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endDirName)))) {
7064
- return _startPath;
7065
- }
7066
- if (endFileNames.some((endFileName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
7067
- return _startPath;
7068
- }
7069
- if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
7070
- const parent = (0, import_node_path.join)(_startPath, "..");
7071
- return findFolderUp(parent, endFileNames, endDirectoryNames);
7072
- }
7073
- return void 0;
7074
- }
7075
- __name(findFolderUp, "findFolderUp");
7076
- __name2(findFolderUp, "findFolderUp");
7077
-
7078
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
7079
- init_cjs_shims();
7080
- var _DRIVE_LETTER_START_RE3 = /^[A-Za-z]:\//;
7081
- function normalizeWindowsPath3(input = "") {
7082
- if (!input) {
7083
- return input;
7084
- }
7085
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE3, (r) => r.toUpperCase());
7086
- }
7087
- __name(normalizeWindowsPath3, "normalizeWindowsPath");
7088
- __name2(normalizeWindowsPath3, "normalizeWindowsPath");
7089
- var _UNC_REGEX3 = /^[/\\]{2}/;
7090
- var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
7091
- var _DRIVE_LETTER_RE3 = /^[A-Za-z]:$/;
7092
- var correctPaths2 = /* @__PURE__ */ __name2(function(path6) {
7093
- if (!path6 || path6.length === 0) {
7094
- return ".";
7095
- }
7096
- path6 = normalizeWindowsPath3(path6);
7097
- const isUNCPath = path6.match(_UNC_REGEX3);
7098
- const isPathAbsolute = isAbsolute2(path6);
7099
- const trailingSeparator = path6[path6.length - 1] === "/";
7100
- path6 = normalizeString3(path6, !isPathAbsolute);
7101
- if (path6.length === 0) {
7102
- if (isPathAbsolute) {
7103
- return "/";
7104
- }
7105
- return trailingSeparator ? "./" : ".";
7106
- }
7107
- if (trailingSeparator) {
7108
- path6 += "/";
7109
- }
7110
- if (_DRIVE_LETTER_RE3.test(path6)) {
7111
- path6 += "/";
7112
- }
7113
- if (isUNCPath) {
7114
- if (!isPathAbsolute) {
7115
- return `//./${path6}`;
7116
- }
7117
- return `//${path6}`;
7118
- }
7119
- return isPathAbsolute && !isAbsolute2(path6) ? `/${path6}` : path6;
7120
- }, "correctPaths");
7121
- function cwd() {
7122
- if (typeof process !== "undefined" && typeof process.cwd === "function") {
7123
- return process.cwd().replace(/\\/g, "/");
7124
- }
7125
- return "/";
7126
- }
7127
- __name(cwd, "cwd");
7128
- __name2(cwd, "cwd");
7129
- function normalizeString3(path6, allowAboveRoot) {
7130
- let res = "";
7131
- let lastSegmentLength = 0;
7132
- let lastSlash = -1;
7133
- let dots = 0;
7134
- let char = null;
7135
- for (let index = 0; index <= path6.length; ++index) {
7136
- if (index < path6.length) {
7137
- char = path6[index];
7138
- } else if (char === "/") {
7139
- break;
7140
- } else {
7141
- char = "/";
7142
- }
7143
- if (char === "/") {
7144
- if (lastSlash === index - 1 || dots === 1) {
7145
- } else if (dots === 2) {
7146
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
7147
- if (res.length > 2) {
7148
- const lastSlashIndex = res.lastIndexOf("/");
7149
- if (lastSlashIndex === -1) {
7150
- res = "";
7151
- lastSegmentLength = 0;
7152
- } else {
7153
- res = res.slice(0, lastSlashIndex);
7154
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
7155
- }
7156
- lastSlash = index;
7157
- dots = 0;
7158
- continue;
7159
- } else if (res.length > 0) {
7160
- res = "";
7161
- lastSegmentLength = 0;
7162
- lastSlash = index;
7163
- dots = 0;
7164
- continue;
7165
- }
7166
- }
7167
- if (allowAboveRoot) {
7168
- res += res.length > 0 ? "/.." : "..";
7169
- lastSegmentLength = 2;
7170
- }
7171
- } else {
7172
- if (res.length > 0) {
7173
- res += `/${path6.slice(lastSlash + 1, index)}`;
7174
- } else {
7175
- res = path6.slice(lastSlash + 1, index);
7176
- }
7177
- lastSegmentLength = index - lastSlash - 1;
7178
- }
7179
- lastSlash = index;
7180
- dots = 0;
7181
- } else if (char === "." && dots !== -1) {
7182
- ++dots;
7183
- } else {
7184
- dots = -1;
7185
- }
7186
- }
7187
- return res;
7188
- }
7189
- __name(normalizeString3, "normalizeString");
7190
- __name2(normalizeString3, "normalizeString");
7191
- var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
7192
- return _IS_ABSOLUTE_RE2.test(p);
7193
- }, "isAbsolute");
7194
-
7195
- // ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
7196
- var rootFiles = [
7197
- "storm-workspace.json",
7198
- "storm-workspace.json",
7199
- "storm-workspace.yaml",
7200
- "storm-workspace.yml",
7201
- "storm-workspace.js",
7202
- "storm-workspace.ts",
7203
- ".storm-workspace.json",
7204
- ".storm-workspace.yaml",
7205
- ".storm-workspace.yml",
7206
- ".storm-workspace.js",
7207
- ".storm-workspace.ts",
7208
- "lerna.json",
7209
- "nx.json",
7210
- "turbo.json",
7211
- "npm-workspace.json",
7212
- "yarn-workspace.json",
7213
- "pnpm-workspace.json",
7214
- "npm-workspace.yaml",
7215
- "yarn-workspace.yaml",
7216
- "pnpm-workspace.yaml",
7217
- "npm-workspace.yml",
7218
- "yarn-workspace.yml",
7219
- "pnpm-workspace.yml",
7220
- "npm-lock.json",
7221
- "yarn-lock.json",
7222
- "pnpm-lock.json",
7223
- "npm-lock.yaml",
7224
- "yarn-lock.yaml",
7225
- "pnpm-lock.yaml",
7226
- "npm-lock.yml",
7227
- "yarn-lock.yml",
7228
- "pnpm-lock.yml",
7229
- "bun.lockb"
7230
- ];
7231
- var rootDirectories = [
7232
- ".storm-workspace",
7233
- ".nx",
7234
- ".github",
7235
- ".vscode",
7236
- ".verdaccio"
7237
- ];
7238
- function findWorkspaceRootSafe(pathInsideMonorepo) {
7239
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
7240
- return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
7241
- }
7242
- return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
7243
- }
7244
- __name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
7245
- __name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
7246
- function findWorkspaceRoot(pathInsideMonorepo) {
7247
- const result = findWorkspaceRootSafe(pathInsideMonorepo);
7248
- if (!result) {
7249
- throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
7250
- ${rootFiles.join("\n")}
7251
- Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
7252
- }
7253
- return result;
7254
- }
7255
- __name(findWorkspaceRoot, "findWorkspaceRoot");
7256
- __name2(findWorkspaceRoot, "findWorkspaceRoot");
7006
+ ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
7007
+ ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
7008
+ ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
7009
+ ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
7010
+ ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
7011
+ ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
7012
+ ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
7013
+ ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
7014
+ ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
7015
+ ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
7016
+ ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
7017
+ ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
7018
+ ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
7019
+ ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
7020
+ ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
7021
+ ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
7022
+ ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
7023
+ ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
7024
+ ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
7025
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
7026
+ var instanceOfType = /* @__PURE__ */ __name((cls, params = {
7027
+ message: `Input not instance of ${cls.name}`
7028
+ }) => custom((data) => data instanceof cls, params), "instanceOfType");
7029
+ var stringType = ZodString.create;
7030
+ var numberType = ZodNumber.create;
7031
+ var nanType = ZodNaN.create;
7032
+ var bigIntType = ZodBigInt.create;
7033
+ var booleanType = ZodBoolean.create;
7034
+ var dateType = ZodDate.create;
7035
+ var symbolType = ZodSymbol.create;
7036
+ var undefinedType = ZodUndefined.create;
7037
+ var nullType = ZodNull.create;
7038
+ var anyType = ZodAny.create;
7039
+ var unknownType = ZodUnknown.create;
7040
+ var neverType = ZodNever.create;
7041
+ var voidType = ZodVoid.create;
7042
+ var arrayType = ZodArray.create;
7043
+ var objectType = ZodObject.create;
7044
+ var strictObjectType = ZodObject.strictCreate;
7045
+ var unionType = ZodUnion.create;
7046
+ var discriminatedUnionType = ZodDiscriminatedUnion.create;
7047
+ var intersectionType = ZodIntersection.create;
7048
+ var tupleType = ZodTuple.create;
7049
+ var recordType = ZodRecord.create;
7050
+ var mapType = ZodMap.create;
7051
+ var setType = ZodSet.create;
7052
+ var functionType = ZodFunction.create;
7053
+ var lazyType = ZodLazy.create;
7054
+ var literalType = ZodLiteral.create;
7055
+ var enumType = ZodEnum.create;
7056
+ var nativeEnumType = ZodNativeEnum.create;
7057
+ var promiseType = ZodPromise.create;
7058
+ var effectsType = ZodEffects.create;
7059
+ var optionalType = ZodOptional.create;
7060
+ var nullableType = ZodNullable.create;
7061
+ var preprocessType = ZodEffects.createWithPreprocess;
7062
+ var pipelineType = ZodPipeline.create;
7063
+ var ostring = /* @__PURE__ */ __name(() => stringType().optional(), "ostring");
7064
+ var onumber = /* @__PURE__ */ __name(() => numberType().optional(), "onumber");
7065
+ var oboolean = /* @__PURE__ */ __name(() => booleanType().optional(), "oboolean");
7066
+ var coerce = {
7067
+ string: /* @__PURE__ */ __name((arg) => ZodString.create({ ...arg, coerce: true }), "string"),
7068
+ number: /* @__PURE__ */ __name((arg) => ZodNumber.create({ ...arg, coerce: true }), "number"),
7069
+ boolean: /* @__PURE__ */ __name((arg) => ZodBoolean.create({
7070
+ ...arg,
7071
+ coerce: true
7072
+ }), "boolean"),
7073
+ bigint: /* @__PURE__ */ __name((arg) => ZodBigInt.create({ ...arg, coerce: true }), "bigint"),
7074
+ date: /* @__PURE__ */ __name((arg) => ZodDate.create({ ...arg, coerce: true }), "date")
7075
+ };
7076
+ var NEVER = INVALID;
7077
+ var z = /* @__PURE__ */ Object.freeze({
7078
+ __proto__: null,
7079
+ defaultErrorMap: errorMap,
7080
+ setErrorMap,
7081
+ getErrorMap,
7082
+ makeIssue,
7083
+ EMPTY_PATH,
7084
+ addIssueToContext,
7085
+ ParseStatus,
7086
+ INVALID,
7087
+ DIRTY,
7088
+ OK,
7089
+ isAborted,
7090
+ isDirty,
7091
+ isValid,
7092
+ isAsync,
7093
+ get util() {
7094
+ return util;
7095
+ },
7096
+ get objectUtil() {
7097
+ return objectUtil;
7098
+ },
7099
+ ZodParsedType,
7100
+ getParsedType,
7101
+ ZodType,
7102
+ datetimeRegex,
7103
+ ZodString,
7104
+ ZodNumber,
7105
+ ZodBigInt,
7106
+ ZodBoolean,
7107
+ ZodDate,
7108
+ ZodSymbol,
7109
+ ZodUndefined,
7110
+ ZodNull,
7111
+ ZodAny,
7112
+ ZodUnknown,
7113
+ ZodNever,
7114
+ ZodVoid,
7115
+ ZodArray,
7116
+ ZodObject,
7117
+ ZodUnion,
7118
+ ZodDiscriminatedUnion,
7119
+ ZodIntersection,
7120
+ ZodTuple,
7121
+ ZodRecord,
7122
+ ZodMap,
7123
+ ZodSet,
7124
+ ZodFunction,
7125
+ ZodLazy,
7126
+ ZodLiteral,
7127
+ ZodEnum,
7128
+ ZodNativeEnum,
7129
+ ZodPromise,
7130
+ ZodEffects,
7131
+ ZodTransformer: ZodEffects,
7132
+ ZodOptional,
7133
+ ZodNullable,
7134
+ ZodDefault,
7135
+ ZodCatch,
7136
+ ZodNaN,
7137
+ BRAND,
7138
+ ZodBranded,
7139
+ ZodPipeline,
7140
+ ZodReadonly,
7141
+ custom,
7142
+ Schema: ZodType,
7143
+ ZodSchema: ZodType,
7144
+ late,
7145
+ get ZodFirstPartyTypeKind() {
7146
+ return ZodFirstPartyTypeKind;
7147
+ },
7148
+ coerce,
7149
+ any: anyType,
7150
+ array: arrayType,
7151
+ bigint: bigIntType,
7152
+ boolean: booleanType,
7153
+ date: dateType,
7154
+ discriminatedUnion: discriminatedUnionType,
7155
+ effect: effectsType,
7156
+ "enum": enumType,
7157
+ "function": functionType,
7158
+ "instanceof": instanceOfType,
7159
+ intersection: intersectionType,
7160
+ lazy: lazyType,
7161
+ literal: literalType,
7162
+ map: mapType,
7163
+ nan: nanType,
7164
+ nativeEnum: nativeEnumType,
7165
+ never: neverType,
7166
+ "null": nullType,
7167
+ nullable: nullableType,
7168
+ number: numberType,
7169
+ object: objectType,
7170
+ oboolean,
7171
+ onumber,
7172
+ optional: optionalType,
7173
+ ostring,
7174
+ pipeline: pipelineType,
7175
+ preprocess: preprocessType,
7176
+ promise: promiseType,
7177
+ record: recordType,
7178
+ set: setType,
7179
+ strictObject: strictObjectType,
7180
+ string: stringType,
7181
+ symbol: symbolType,
7182
+ transformer: effectsType,
7183
+ tuple: tupleType,
7184
+ "undefined": undefinedType,
7185
+ union: unionType,
7186
+ unknown: unknownType,
7187
+ "void": voidType,
7188
+ NEVER,
7189
+ ZodIssueCode,
7190
+ quotelessJson,
7191
+ ZodError
7192
+ });
7257
7193
 
7258
7194
  // ../path/src/get-parent-path.ts
7259
7195
  init_cjs_shims();
@@ -7409,6 +7345,66 @@ function relativePath(from, to) {
7409
7345
  }
7410
7346
  __name(relativePath, "relativePath");
7411
7347
 
7348
+ // ../string-format/src/lower-case-first.ts
7349
+ init_cjs_shims();
7350
+ var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
7351
+ return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
7352
+ }, "lowerCaseFirst");
7353
+
7354
+ // src/prisma-generator.ts
7355
+ var import_node_path6 = __toESM(require("node:path"), 1);
7356
+ var import_pluralize = __toESM(require_pluralize(), 1);
7357
+
7358
+ // src/config.ts
7359
+ init_cjs_shims();
7360
+ var ModelAction = /* @__PURE__ */ function(ModelAction2) {
7361
+ ModelAction2["findUnique"] = "findUnique";
7362
+ ModelAction2["findUniqueOrThrow"] = "findUniqueOrThrow";
7363
+ ModelAction2["findFirst"] = "findFirst";
7364
+ ModelAction2["findFirstOrThrow"] = "findFirstOrThrow";
7365
+ ModelAction2["findMany"] = "findMany";
7366
+ ModelAction2["create"] = "create";
7367
+ ModelAction2["createMany"] = "createMany";
7368
+ ModelAction2["createManyAndReturn"] = "createManyAndReturn";
7369
+ ModelAction2["update"] = "update";
7370
+ ModelAction2["updateMany"] = "updateMany";
7371
+ ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
7372
+ ModelAction2["upsert"] = "upsert";
7373
+ ModelAction2["delete"] = "delete";
7374
+ ModelAction2["deleteMany"] = "deleteMany";
7375
+ ModelAction2["groupBy"] = "groupBy";
7376
+ ModelAction2["count"] = "count";
7377
+ ModelAction2["aggregate"] = "aggregate";
7378
+ ModelAction2["findRaw"] = "findRaw";
7379
+ ModelAction2["aggregateRaw"] = "aggregateRaw";
7380
+ return ModelAction2;
7381
+ }(ModelAction || {});
7382
+ var configBoolean = z.enum([
7383
+ "true",
7384
+ "false"
7385
+ ]).transform((arg) => JSON.parse(arg));
7386
+ var configMiddleware = z.union([
7387
+ configBoolean,
7388
+ z.string().default("../src/trpc/middleware")
7389
+ ]);
7390
+ var modelActionEnum = z.nativeEnum(ModelAction);
7391
+ var configSchema = z.object({
7392
+ debug: configBoolean.default("false"),
7393
+ withMiddleware: configMiddleware.default("false"),
7394
+ withShield: z.boolean().or(z.string()).default("true"),
7395
+ withZod: configBoolean.default("true"),
7396
+ withNext: configBoolean.default("true"),
7397
+ contextPath: z.string().default("../src/trpc/context"),
7398
+ trpcOptions: z.boolean().or(z.string()).optional(),
7399
+ showModelNameInProcedure: configBoolean.default("true"),
7400
+ generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
7401
+ return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
7402
+ })
7403
+ });
7404
+
7405
+ // src/helpers.ts
7406
+ init_cjs_shims();
7407
+
7412
7408
  // src/utils/get-prisma-internals.ts
7413
7409
  init_cjs_shims();
7414
7410
 
@@ -7618,7 +7614,7 @@ __name(getRelativePath, "getRelativePath");
7618
7614
 
7619
7615
  // src/helpers.ts
7620
7616
  var getProcedureName = /* @__PURE__ */ __name((config) => {
7621
- return config.withShields ? "shieldedProcedure" : config.withMiddleware ? "protectedProcedure" : "publicProcedure";
7617
+ return config.withShield ? "shieldedProcedure" : config.withMiddleware ? "protectedProcedure" : "publicProcedure";
7622
7618
  }, "getProcedureName");
7623
7619
  var generateCreateRouterImport = /* @__PURE__ */ __name(({ sourceFile, config }) => {
7624
7620
  const imports = [
@@ -7635,7 +7631,7 @@ var generateCreateRouterImport = /* @__PURE__ */ __name(({ sourceFile, config })
7635
7631
  var generateShieldImport = /* @__PURE__ */ __name(async (sourceFile, options, value) => {
7636
7632
  const internals = await getPrismaInternals();
7637
7633
  const outputDir = internals.parseEnvValue(options.generator.output);
7638
- let shieldPath = getRelativePath(outputDir, "shield");
7634
+ let shieldPath = joinPaths(outputDir, "shield");
7639
7635
  if (typeof value === "string") {
7640
7636
  shieldPath = getRelativePath(outputDir, value, true, options.schemaPath);
7641
7637
  }
@@ -7657,37 +7653,30 @@ var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural,
7657
7653
  async function generateBaseRouter(sourceFile, config, options) {
7658
7654
  const internals = await getPrismaInternals();
7659
7655
  const outputDir = internals.parseEnvValue(options.generator.output);
7660
- const relativeContextPath = getRelativePath(outputDir, config.contextPath, true, options.schemaPath);
7661
7656
  sourceFile.addStatements(
7662
7657
  /* ts */
7663
7658
  `
7664
- import type { Context } from '${relativeContextPath}';
7665
- `
7659
+ import type { Context } from '${getRelativePath(outputDir, config.contextPath, true, options.schemaPath)}';`
7666
7660
  );
7667
7661
  if (config.trpcOptions) {
7668
7662
  sourceFile.addStatements(
7669
7663
  /* ts */
7670
7664
  `
7671
- import trpcOptions from '${getRelativePath(outputDir, typeof config.trpcOptions === "boolean" ? joinPaths(outputDir, "options") : config.trpcOptions, true, options.schemaPath)}';
7672
- `
7665
+ import trpcOptions from '${getRelativePath(outputDir, typeof config.trpcOptions === "boolean" ? joinPaths(outputDir, "options") : config.trpcOptions, true, options.schemaPath)}';`
7673
7666
  );
7674
7667
  }
7675
7668
  if (config.withNext) {
7676
7669
  sourceFile.addStatements(
7677
7670
  /* ts */
7678
- `
7679
- import { createContext } from '${relativeContextPath}';
7680
- import { initTRPC, TRPCError } from '@trpc/server';
7681
- import { experimental_nextAppDirCaller } from '@trpc/server/adapters/next-app-dir';
7682
- import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';
7683
- `
7671
+ `import { createContext } from '${getRelativePath(outputDir, config.contextPath, true, options.schemaPath)}';
7672
+ import { initTRPC } from '@trpc/server';
7673
+ import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';`
7684
7674
  );
7685
7675
  }
7686
7676
  sourceFile.addStatements(
7687
7677
  /* ts */
7688
7678
  `
7689
- export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});
7690
- `
7679
+ export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});`
7691
7680
  );
7692
7681
  const middlewares = [];
7693
7682
  if (config.withMiddleware && typeof config.withMiddleware === "boolean") {
@@ -7727,7 +7716,7 @@ async function generateBaseRouter(sourceFile, config, options) {
7727
7716
  )
7728
7717
  });
7729
7718
  }
7730
- if (config.withShields) {
7719
+ if (config.withShield) {
7731
7720
  sourceFile.addStatements(
7732
7721
  /* ts */
7733
7722
  `
@@ -7776,13 +7765,7 @@ export const createCallerFactory = t.createCallerFactory;`
7776
7765
  }
7777
7766
  sourceFile.addStatements(
7778
7767
  /* ts */
7779
- `
7780
- .use(${middleware.type === "shield" ? "permissionsMiddleware" : "globalMiddleware"})${config.withNext ? `.experimental_caller(
7781
- experimental_nextAppDirCaller({
7782
- normalizeFormData: true,
7783
- }),
7784
- )` : ""}
7785
- `
7768
+ `.use(${middleware.type === "shield" ? "permissionsMiddleware" : "globalMiddleware"})`
7786
7769
  );
7787
7770
  });
7788
7771
  }
@@ -11624,31 +11607,21 @@ async function generate(options) {
11624
11607
  queries.sort();
11625
11608
  mutations.sort();
11626
11609
  subscriptions.sort();
11627
- if (config.withShields !== false) {
11610
+ if (config.withShield !== false) {
11628
11611
  consoleLog("Generating tRPC Shield");
11629
- const shieldOutputDir = outputDir;
11630
- consoleLog("Constructing tRPC Shield source file");
11631
- const shieldText = await constructShield({
11632
- queries,
11633
- mutations,
11634
- subscriptions
11635
- }, config, {
11636
- ...options,
11637
- generator: {
11638
- ...options.generator,
11639
- output: {
11640
- fromEnvVar: null,
11641
- ...options.generator.output,
11642
- value: shieldOutputDir
11643
- },
11644
- config: {
11645
- ...options.generator.config,
11646
- contextPath: config.contextPath
11647
- }
11648
- }
11649
- }, shieldOutputDir);
11650
- consoleLog("Saving tRPC Shield source file to disk");
11651
- await writeFileSafely(joinPaths(shieldOutputDir, "shield.ts"), shieldText);
11612
+ if (typeof config.withShield === "string" && (existsSync(config.withShield) || existsSync(joinPaths(config.withShield, "shield.ts")))) {
11613
+ consoleLog("Skipping tRPC Shield generation as path provided already exists");
11614
+ } else {
11615
+ consoleLog("Constructing tRPC Shield source file");
11616
+ const shieldOutputDir = typeof config.withShield === "string" ? findFilePath(config.withShield) : outputDir;
11617
+ const shieldText = await constructShield({
11618
+ queries,
11619
+ mutations,
11620
+ subscriptions
11621
+ }, config, options, shieldOutputDir);
11622
+ consoleLog("Saving tRPC Shield source file to disk");
11623
+ await writeFileSafely(joinPaths(shieldOutputDir, "shield.ts"), shieldText);
11624
+ }
11652
11625
  } else {
11653
11626
  consoleLog("Skipping tRPC Shield generation");
11654
11627
  }
@@ -11679,8 +11652,8 @@ export default {${config.withNext ? "\n transformer," : ""}
11679
11652
  overwrite: true
11680
11653
  });
11681
11654
  consoleLog("Generating tRPC imports");
11682
- if (config.withShields) {
11683
- await generateShieldImport(createRouter, options, config.withShields);
11655
+ if (config.withShield) {
11656
+ await generateShieldImport(createRouter, options, config.withShield);
11684
11657
  }
11685
11658
  consoleLog("Generating tRPC base router");
11686
11659
  await generateBaseRouter(createRouter, config, options);