@stryke/prisma-trpc-generator 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generator.cjs +491 -520
- package/dist/generator.js +491 -520
- package/dist/index.cjs +491 -520
- package/dist/index.js +491 -520
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2499,21 +2499,6 @@ async function removeDirectory(path5) {
|
|
|
2499
2499
|
}
|
|
2500
2500
|
__name(removeDirectory, "removeDirectory");
|
|
2501
2501
|
|
|
2502
|
-
// ../path/src/file-path-fns.ts
|
|
2503
|
-
init_cjs_shims();
|
|
2504
|
-
|
|
2505
|
-
// ../types/src/base.ts
|
|
2506
|
-
init_cjs_shims();
|
|
2507
|
-
var EMPTY_STRING = "";
|
|
2508
|
-
var $NestedValue = Symbol("NestedValue");
|
|
2509
|
-
|
|
2510
|
-
// ../path/src/correct-path.ts
|
|
2511
|
-
init_cjs_shims();
|
|
2512
|
-
|
|
2513
|
-
// ../path/src/is-file.ts
|
|
2514
|
-
init_cjs_shims();
|
|
2515
|
-
var import_node_fs2 = require("node:fs");
|
|
2516
|
-
|
|
2517
2502
|
// ../path/src/join-paths.ts
|
|
2518
2503
|
init_cjs_shims();
|
|
2519
2504
|
var _DRIVE_LETTER_START_RE = /^[A-Z]:\//i;
|
|
@@ -2629,361 +2614,31 @@ function normalizeString(path5, allowAboveRoot) {
|
|
|
2629
2614
|
res = path5.slice(lastSlash + 1, index);
|
|
2630
2615
|
}
|
|
2631
2616
|
lastSegmentLength = index - lastSlash - 1;
|
|
2632
|
-
}
|
|
2633
|
-
lastSlash = index;
|
|
2634
|
-
dots = 0;
|
|
2635
|
-
} else if (char === "." && dots !== -1) {
|
|
2636
|
-
++dots;
|
|
2637
|
-
} else {
|
|
2638
|
-
dots = -1;
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
return res;
|
|
2642
|
-
}
|
|
2643
|
-
__name(normalizeString, "normalizeString");
|
|
2644
|
-
|
|
2645
|
-
// ../path/src/is-file.ts
|
|
2646
|
-
function isFile(path5, additionalPath) {
|
|
2647
|
-
return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path5) : path5, {
|
|
2648
|
-
throwIfNoEntry: false
|
|
2649
|
-
})?.isFile());
|
|
2650
|
-
}
|
|
2651
|
-
__name(isFile, "isFile");
|
|
2652
|
-
function isDirectory(path5, additionalPath) {
|
|
2653
|
-
return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path5) : path5, {
|
|
2654
|
-
throwIfNoEntry: false
|
|
2655
|
-
})?.isDirectory());
|
|
2656
|
-
}
|
|
2657
|
-
__name(isDirectory, "isDirectory");
|
|
2658
|
-
function isAbsolutePath(path5) {
|
|
2659
|
-
return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path5);
|
|
2660
|
-
}
|
|
2661
|
-
__name(isAbsolutePath, "isAbsolutePath");
|
|
2662
|
-
|
|
2663
|
-
// ../path/src/correct-path.ts
|
|
2664
|
-
var _DRIVE_LETTER_START_RE2 = /^[A-Z]:\//i;
|
|
2665
|
-
function normalizeWindowsPath2(input = "") {
|
|
2666
|
-
if (!input) {
|
|
2667
|
-
return input;
|
|
2668
|
-
}
|
|
2669
|
-
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
|
|
2670
|
-
}
|
|
2671
|
-
__name(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
2672
|
-
var _UNC_REGEX2 = /^[/\\]{2}/;
|
|
2673
|
-
var _DRIVE_LETTER_RE2 = /^[A-Z]:$/i;
|
|
2674
|
-
function correctPath(path5) {
|
|
2675
|
-
if (!path5 || path5.length === 0) {
|
|
2676
|
-
return ".";
|
|
2677
|
-
}
|
|
2678
|
-
path5 = normalizeWindowsPath2(path5);
|
|
2679
|
-
const isUNCPath = path5.match(_UNC_REGEX2);
|
|
2680
|
-
const isPathAbsolute = isAbsolutePath(path5);
|
|
2681
|
-
const trailingSeparator = path5[path5.length - 1] === "/";
|
|
2682
|
-
path5 = normalizeString2(path5, !isPathAbsolute);
|
|
2683
|
-
if (path5.length === 0) {
|
|
2684
|
-
if (isPathAbsolute) {
|
|
2685
|
-
return "/";
|
|
2686
|
-
}
|
|
2687
|
-
return trailingSeparator ? "./" : ".";
|
|
2688
|
-
}
|
|
2689
|
-
if (trailingSeparator) {
|
|
2690
|
-
path5 += "/";
|
|
2691
|
-
}
|
|
2692
|
-
if (_DRIVE_LETTER_RE2.test(path5)) {
|
|
2693
|
-
path5 += "/";
|
|
2694
|
-
}
|
|
2695
|
-
if (isUNCPath) {
|
|
2696
|
-
if (!isPathAbsolute) {
|
|
2697
|
-
return `//./${path5}`;
|
|
2698
|
-
}
|
|
2699
|
-
return `//${path5}`;
|
|
2700
|
-
}
|
|
2701
|
-
return isPathAbsolute && !isAbsolutePath(path5) ? `/${path5}` : path5;
|
|
2702
|
-
}
|
|
2703
|
-
__name(correctPath, "correctPath");
|
|
2704
|
-
function normalizeString2(path5, allowAboveRoot) {
|
|
2705
|
-
let res = "";
|
|
2706
|
-
let lastSegmentLength = 0;
|
|
2707
|
-
let lastSlash = -1;
|
|
2708
|
-
let dots = 0;
|
|
2709
|
-
let char = null;
|
|
2710
|
-
for (let index = 0; index <= path5.length; ++index) {
|
|
2711
|
-
if (index < path5.length) {
|
|
2712
|
-
char = path5[index];
|
|
2713
|
-
} else if (char === "/") {
|
|
2714
|
-
break;
|
|
2715
|
-
} else {
|
|
2716
|
-
char = "/";
|
|
2717
|
-
}
|
|
2718
|
-
if (char === "/") {
|
|
2719
|
-
if (lastSlash === index - 1 || dots === 1) {
|
|
2720
|
-
} else if (dots === 2) {
|
|
2721
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
2722
|
-
if (res.length > 2) {
|
|
2723
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
2724
|
-
if (lastSlashIndex === -1) {
|
|
2725
|
-
res = "";
|
|
2726
|
-
lastSegmentLength = 0;
|
|
2727
|
-
} else {
|
|
2728
|
-
res = res.slice(0, lastSlashIndex);
|
|
2729
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
2730
|
-
}
|
|
2731
|
-
lastSlash = index;
|
|
2732
|
-
dots = 0;
|
|
2733
|
-
continue;
|
|
2734
|
-
} else if (res.length > 0) {
|
|
2735
|
-
res = "";
|
|
2736
|
-
lastSegmentLength = 0;
|
|
2737
|
-
lastSlash = index;
|
|
2738
|
-
dots = 0;
|
|
2739
|
-
continue;
|
|
2740
|
-
}
|
|
2741
|
-
}
|
|
2742
|
-
if (allowAboveRoot) {
|
|
2743
|
-
res += res.length > 0 ? "/.." : "..";
|
|
2744
|
-
lastSegmentLength = 2;
|
|
2745
|
-
}
|
|
2746
|
-
} else {
|
|
2747
|
-
if (res.length > 0) {
|
|
2748
|
-
res += `/${path5.slice(lastSlash + 1, index)}`;
|
|
2749
|
-
} else {
|
|
2750
|
-
res = path5.slice(lastSlash + 1, index);
|
|
2751
|
-
}
|
|
2752
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
2753
|
-
}
|
|
2754
|
-
lastSlash = index;
|
|
2755
|
-
dots = 0;
|
|
2756
|
-
} else if (char === "." && dots !== -1) {
|
|
2757
|
-
++dots;
|
|
2758
|
-
} else {
|
|
2759
|
-
dots = -1;
|
|
2760
|
-
}
|
|
2761
|
-
}
|
|
2762
|
-
return res;
|
|
2763
|
-
}
|
|
2764
|
-
__name(normalizeString2, "normalizeString");
|
|
2765
|
-
|
|
2766
|
-
// ../path/src/get-workspace-root.ts
|
|
2767
|
-
init_cjs_shims();
|
|
2768
|
-
|
|
2769
|
-
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/index.js
|
|
2770
|
-
init_cjs_shims();
|
|
2771
|
-
|
|
2772
|
-
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
|
|
2773
|
-
init_cjs_shims();
|
|
2774
|
-
|
|
2775
|
-
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-NQFXB5CV.js
|
|
2776
|
-
init_cjs_shims();
|
|
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;
|
|
2795
|
-
}
|
|
2796
|
-
if (endFileNames.some((endFileName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
|
|
2797
|
-
return _startPath;
|
|
2798
|
-
}
|
|
2799
|
-
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
2800
|
-
const parent = (0, import_node_path.join)(_startPath, "..");
|
|
2801
|
-
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
2802
|
-
}
|
|
2803
|
-
return void 0;
|
|
2804
|
-
}
|
|
2805
|
-
__name(findFolderUp, "findFolderUp");
|
|
2806
|
-
__name2(findFolderUp, "findFolderUp");
|
|
2807
|
-
|
|
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(path5) {
|
|
2823
|
-
if (!path5 || path5.length === 0) {
|
|
2824
|
-
return ".";
|
|
2825
|
-
}
|
|
2826
|
-
path5 = normalizeWindowsPath3(path5);
|
|
2827
|
-
const isUNCPath = path5.match(_UNC_REGEX3);
|
|
2828
|
-
const isPathAbsolute = isAbsolute2(path5);
|
|
2829
|
-
const trailingSeparator = path5[path5.length - 1] === "/";
|
|
2830
|
-
path5 = normalizeString3(path5, !isPathAbsolute);
|
|
2831
|
-
if (path5.length === 0) {
|
|
2832
|
-
if (isPathAbsolute) {
|
|
2833
|
-
return "/";
|
|
2834
|
-
}
|
|
2835
|
-
return trailingSeparator ? "./" : ".";
|
|
2836
|
-
}
|
|
2837
|
-
if (trailingSeparator) {
|
|
2838
|
-
path5 += "/";
|
|
2839
|
-
}
|
|
2840
|
-
if (_DRIVE_LETTER_RE3.test(path5)) {
|
|
2841
|
-
path5 += "/";
|
|
2842
|
-
}
|
|
2843
|
-
if (isUNCPath) {
|
|
2844
|
-
if (!isPathAbsolute) {
|
|
2845
|
-
return `//./${path5}`;
|
|
2846
|
-
}
|
|
2847
|
-
return `//${path5}`;
|
|
2848
|
-
}
|
|
2849
|
-
return isPathAbsolute && !isAbsolute2(path5) ? `/${path5}` : path5;
|
|
2850
|
-
}, "correctPaths");
|
|
2851
|
-
function cwd() {
|
|
2852
|
-
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
2853
|
-
return process.cwd().replace(/\\/g, "/");
|
|
2854
|
-
}
|
|
2855
|
-
return "/";
|
|
2856
|
-
}
|
|
2857
|
-
__name(cwd, "cwd");
|
|
2858
|
-
__name2(cwd, "cwd");
|
|
2859
|
-
function normalizeString3(path5, allowAboveRoot) {
|
|
2860
|
-
let res = "";
|
|
2861
|
-
let lastSegmentLength = 0;
|
|
2862
|
-
let lastSlash = -1;
|
|
2863
|
-
let dots = 0;
|
|
2864
|
-
let char = null;
|
|
2865
|
-
for (let index = 0; index <= path5.length; ++index) {
|
|
2866
|
-
if (index < path5.length) {
|
|
2867
|
-
char = path5[index];
|
|
2868
|
-
} else if (char === "/") {
|
|
2869
|
-
break;
|
|
2870
|
-
} else {
|
|
2871
|
-
char = "/";
|
|
2872
|
-
}
|
|
2873
|
-
if (char === "/") {
|
|
2874
|
-
if (lastSlash === index - 1 || dots === 1) {
|
|
2875
|
-
} else if (dots === 2) {
|
|
2876
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
2877
|
-
if (res.length > 2) {
|
|
2878
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
2879
|
-
if (lastSlashIndex === -1) {
|
|
2880
|
-
res = "";
|
|
2881
|
-
lastSegmentLength = 0;
|
|
2882
|
-
} else {
|
|
2883
|
-
res = res.slice(0, lastSlashIndex);
|
|
2884
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
2885
|
-
}
|
|
2886
|
-
lastSlash = index;
|
|
2887
|
-
dots = 0;
|
|
2888
|
-
continue;
|
|
2889
|
-
} else if (res.length > 0) {
|
|
2890
|
-
res = "";
|
|
2891
|
-
lastSegmentLength = 0;
|
|
2892
|
-
lastSlash = index;
|
|
2893
|
-
dots = 0;
|
|
2894
|
-
continue;
|
|
2895
|
-
}
|
|
2896
|
-
}
|
|
2897
|
-
if (allowAboveRoot) {
|
|
2898
|
-
res += res.length > 0 ? "/.." : "..";
|
|
2899
|
-
lastSegmentLength = 2;
|
|
2900
|
-
}
|
|
2901
|
-
} else {
|
|
2902
|
-
if (res.length > 0) {
|
|
2903
|
-
res += `/${path5.slice(lastSlash + 1, index)}`;
|
|
2904
|
-
} else {
|
|
2905
|
-
res = path5.slice(lastSlash + 1, index);
|
|
2906
|
-
}
|
|
2907
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
2908
|
-
}
|
|
2909
|
-
lastSlash = index;
|
|
2910
|
-
dots = 0;
|
|
2911
|
-
} else if (char === "." && dots !== -1) {
|
|
2912
|
-
++dots;
|
|
2913
|
-
} else {
|
|
2914
|
-
dots = -1;
|
|
2915
|
-
}
|
|
2916
|
-
}
|
|
2917
|
-
return res;
|
|
2918
|
-
}
|
|
2919
|
-
__name(normalizeString3, "normalizeString");
|
|
2920
|
-
__name2(normalizeString3, "normalizeString");
|
|
2921
|
-
var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
|
|
2922
|
-
return _IS_ABSOLUTE_RE2.test(p);
|
|
2923
|
-
}, "isAbsolute");
|
|
2924
|
-
|
|
2925
|
-
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-K6PUXRK3.js
|
|
2926
|
-
var rootFiles = [
|
|
2927
|
-
"storm-workspace.json",
|
|
2928
|
-
"storm-workspace.json",
|
|
2929
|
-
"storm-workspace.yaml",
|
|
2930
|
-
"storm-workspace.yml",
|
|
2931
|
-
"storm-workspace.js",
|
|
2932
|
-
"storm-workspace.ts",
|
|
2933
|
-
".storm-workspace.json",
|
|
2934
|
-
".storm-workspace.yaml",
|
|
2935
|
-
".storm-workspace.yml",
|
|
2936
|
-
".storm-workspace.js",
|
|
2937
|
-
".storm-workspace.ts",
|
|
2938
|
-
"lerna.json",
|
|
2939
|
-
"nx.json",
|
|
2940
|
-
"turbo.json",
|
|
2941
|
-
"npm-workspace.json",
|
|
2942
|
-
"yarn-workspace.json",
|
|
2943
|
-
"pnpm-workspace.json",
|
|
2944
|
-
"npm-workspace.yaml",
|
|
2945
|
-
"yarn-workspace.yaml",
|
|
2946
|
-
"pnpm-workspace.yaml",
|
|
2947
|
-
"npm-workspace.yml",
|
|
2948
|
-
"yarn-workspace.yml",
|
|
2949
|
-
"pnpm-workspace.yml",
|
|
2950
|
-
"npm-lock.json",
|
|
2951
|
-
"yarn-lock.json",
|
|
2952
|
-
"pnpm-lock.json",
|
|
2953
|
-
"npm-lock.yaml",
|
|
2954
|
-
"yarn-lock.yaml",
|
|
2955
|
-
"pnpm-lock.yaml",
|
|
2956
|
-
"npm-lock.yml",
|
|
2957
|
-
"yarn-lock.yml",
|
|
2958
|
-
"pnpm-lock.yml",
|
|
2959
|
-
"bun.lockb"
|
|
2960
|
-
];
|
|
2961
|
-
var rootDirectories = [
|
|
2962
|
-
".storm-workspace",
|
|
2963
|
-
".nx",
|
|
2964
|
-
".github",
|
|
2965
|
-
".vscode",
|
|
2966
|
-
".verdaccio"
|
|
2967
|
-
];
|
|
2968
|
-
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
2969
|
-
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
2970
|
-
return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
2971
|
-
}
|
|
2972
|
-
return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
2973
|
-
}
|
|
2974
|
-
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
2975
|
-
__name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
2976
|
-
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
2977
|
-
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
2978
|
-
if (!result) {
|
|
2979
|
-
throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
|
|
2980
|
-
${rootFiles.join("\n")}
|
|
2981
|
-
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
|
|
2617
|
+
}
|
|
2618
|
+
lastSlash = index;
|
|
2619
|
+
dots = 0;
|
|
2620
|
+
} else if (char === "." && dots !== -1) {
|
|
2621
|
+
++dots;
|
|
2622
|
+
} else {
|
|
2623
|
+
dots = -1;
|
|
2624
|
+
}
|
|
2982
2625
|
}
|
|
2983
|
-
return
|
|
2626
|
+
return res;
|
|
2984
2627
|
}
|
|
2985
|
-
__name(
|
|
2986
|
-
|
|
2628
|
+
__name(normalizeString, "normalizeString");
|
|
2629
|
+
|
|
2630
|
+
// ../string-format/src/lower-case-first.ts
|
|
2631
|
+
init_cjs_shims();
|
|
2632
|
+
var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
|
|
2633
|
+
return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
|
|
2634
|
+
}, "lowerCaseFirst");
|
|
2635
|
+
|
|
2636
|
+
// src/prisma-generator.ts
|
|
2637
|
+
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
2638
|
+
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
2639
|
+
|
|
2640
|
+
// src/config.ts
|
|
2641
|
+
init_cjs_shims();
|
|
2987
2642
|
|
|
2988
2643
|
// ../../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
|
|
2989
2644
|
init_cjs_shims();
|
|
@@ -7191,6 +6846,403 @@ var z = /* @__PURE__ */ Object.freeze({
|
|
|
7191
6846
|
ZodError
|
|
7192
6847
|
});
|
|
7193
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 modelActionEnum = z.nativeEnum(ModelAction);
|
|
6873
|
+
var configSchema = z.object({
|
|
6874
|
+
debug: z.coerce.boolean().or(z.string()).default(false),
|
|
6875
|
+
withMiddleware: z.coerce.boolean().or(z.string()).default(false),
|
|
6876
|
+
withShield: z.coerce.boolean().or(z.string()).default(true),
|
|
6877
|
+
withZod: z.coerce.boolean().or(z.string()).default(true),
|
|
6878
|
+
withNext: z.coerce.boolean().or(z.string()).default(true),
|
|
6879
|
+
contextPath: z.string().default("../context"),
|
|
6880
|
+
trpcOptions: z.coerce.boolean().or(z.string()).default(true),
|
|
6881
|
+
showModelNameInProcedure: z.coerce.boolean().or(z.string()).default(true),
|
|
6882
|
+
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
6883
|
+
return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
|
|
6884
|
+
})
|
|
6885
|
+
});
|
|
6886
|
+
|
|
6887
|
+
// src/helpers.ts
|
|
6888
|
+
init_cjs_shims();
|
|
6889
|
+
|
|
6890
|
+
// ../path/src/file-path-fns.ts
|
|
6891
|
+
init_cjs_shims();
|
|
6892
|
+
|
|
6893
|
+
// ../types/src/base.ts
|
|
6894
|
+
init_cjs_shims();
|
|
6895
|
+
var EMPTY_STRING = "";
|
|
6896
|
+
var $NestedValue = Symbol("NestedValue");
|
|
6897
|
+
|
|
6898
|
+
// ../path/src/correct-path.ts
|
|
6899
|
+
init_cjs_shims();
|
|
6900
|
+
|
|
6901
|
+
// ../path/src/is-file.ts
|
|
6902
|
+
init_cjs_shims();
|
|
6903
|
+
var import_node_fs2 = require("node:fs");
|
|
6904
|
+
function isFile(path5, additionalPath) {
|
|
6905
|
+
return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path5) : path5, {
|
|
6906
|
+
throwIfNoEntry: false
|
|
6907
|
+
})?.isFile());
|
|
6908
|
+
}
|
|
6909
|
+
__name(isFile, "isFile");
|
|
6910
|
+
function isDirectory(path5, additionalPath) {
|
|
6911
|
+
return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path5) : path5, {
|
|
6912
|
+
throwIfNoEntry: false
|
|
6913
|
+
})?.isDirectory());
|
|
6914
|
+
}
|
|
6915
|
+
__name(isDirectory, "isDirectory");
|
|
6916
|
+
function isAbsolutePath(path5) {
|
|
6917
|
+
return !/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i.test(path5);
|
|
6918
|
+
}
|
|
6919
|
+
__name(isAbsolutePath, "isAbsolutePath");
|
|
6920
|
+
|
|
6921
|
+
// ../path/src/correct-path.ts
|
|
6922
|
+
var _DRIVE_LETTER_START_RE2 = /^[A-Z]:\//i;
|
|
6923
|
+
function normalizeWindowsPath2(input = "") {
|
|
6924
|
+
if (!input) {
|
|
6925
|
+
return input;
|
|
6926
|
+
}
|
|
6927
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
|
|
6928
|
+
}
|
|
6929
|
+
__name(normalizeWindowsPath2, "normalizeWindowsPath");
|
|
6930
|
+
var _UNC_REGEX2 = /^[/\\]{2}/;
|
|
6931
|
+
var _DRIVE_LETTER_RE2 = /^[A-Z]:$/i;
|
|
6932
|
+
function correctPath(path5) {
|
|
6933
|
+
if (!path5 || path5.length === 0) {
|
|
6934
|
+
return ".";
|
|
6935
|
+
}
|
|
6936
|
+
path5 = normalizeWindowsPath2(path5);
|
|
6937
|
+
const isUNCPath = path5.match(_UNC_REGEX2);
|
|
6938
|
+
const isPathAbsolute = isAbsolutePath(path5);
|
|
6939
|
+
const trailingSeparator = path5[path5.length - 1] === "/";
|
|
6940
|
+
path5 = normalizeString2(path5, !isPathAbsolute);
|
|
6941
|
+
if (path5.length === 0) {
|
|
6942
|
+
if (isPathAbsolute) {
|
|
6943
|
+
return "/";
|
|
6944
|
+
}
|
|
6945
|
+
return trailingSeparator ? "./" : ".";
|
|
6946
|
+
}
|
|
6947
|
+
if (trailingSeparator) {
|
|
6948
|
+
path5 += "/";
|
|
6949
|
+
}
|
|
6950
|
+
if (_DRIVE_LETTER_RE2.test(path5)) {
|
|
6951
|
+
path5 += "/";
|
|
6952
|
+
}
|
|
6953
|
+
if (isUNCPath) {
|
|
6954
|
+
if (!isPathAbsolute) {
|
|
6955
|
+
return `//./${path5}`;
|
|
6956
|
+
}
|
|
6957
|
+
return `//${path5}`;
|
|
6958
|
+
}
|
|
6959
|
+
return isPathAbsolute && !isAbsolutePath(path5) ? `/${path5}` : path5;
|
|
6960
|
+
}
|
|
6961
|
+
__name(correctPath, "correctPath");
|
|
6962
|
+
function normalizeString2(path5, allowAboveRoot) {
|
|
6963
|
+
let res = "";
|
|
6964
|
+
let lastSegmentLength = 0;
|
|
6965
|
+
let lastSlash = -1;
|
|
6966
|
+
let dots = 0;
|
|
6967
|
+
let char = null;
|
|
6968
|
+
for (let index = 0; index <= path5.length; ++index) {
|
|
6969
|
+
if (index < path5.length) {
|
|
6970
|
+
char = path5[index];
|
|
6971
|
+
} else if (char === "/") {
|
|
6972
|
+
break;
|
|
6973
|
+
} else {
|
|
6974
|
+
char = "/";
|
|
6975
|
+
}
|
|
6976
|
+
if (char === "/") {
|
|
6977
|
+
if (lastSlash === index - 1 || dots === 1) {
|
|
6978
|
+
} else if (dots === 2) {
|
|
6979
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
6980
|
+
if (res.length > 2) {
|
|
6981
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
6982
|
+
if (lastSlashIndex === -1) {
|
|
6983
|
+
res = "";
|
|
6984
|
+
lastSegmentLength = 0;
|
|
6985
|
+
} else {
|
|
6986
|
+
res = res.slice(0, lastSlashIndex);
|
|
6987
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
6988
|
+
}
|
|
6989
|
+
lastSlash = index;
|
|
6990
|
+
dots = 0;
|
|
6991
|
+
continue;
|
|
6992
|
+
} else if (res.length > 0) {
|
|
6993
|
+
res = "";
|
|
6994
|
+
lastSegmentLength = 0;
|
|
6995
|
+
lastSlash = index;
|
|
6996
|
+
dots = 0;
|
|
6997
|
+
continue;
|
|
6998
|
+
}
|
|
6999
|
+
}
|
|
7000
|
+
if (allowAboveRoot) {
|
|
7001
|
+
res += res.length > 0 ? "/.." : "..";
|
|
7002
|
+
lastSegmentLength = 2;
|
|
7003
|
+
}
|
|
7004
|
+
} else {
|
|
7005
|
+
if (res.length > 0) {
|
|
7006
|
+
res += `/${path5.slice(lastSlash + 1, index)}`;
|
|
7007
|
+
} else {
|
|
7008
|
+
res = path5.slice(lastSlash + 1, index);
|
|
7009
|
+
}
|
|
7010
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
7011
|
+
}
|
|
7012
|
+
lastSlash = index;
|
|
7013
|
+
dots = 0;
|
|
7014
|
+
} else if (char === "." && dots !== -1) {
|
|
7015
|
+
++dots;
|
|
7016
|
+
} else {
|
|
7017
|
+
dots = -1;
|
|
7018
|
+
}
|
|
7019
|
+
}
|
|
7020
|
+
return res;
|
|
7021
|
+
}
|
|
7022
|
+
__name(normalizeString2, "normalizeString");
|
|
7023
|
+
|
|
7024
|
+
// ../path/src/get-workspace-root.ts
|
|
7025
|
+
init_cjs_shims();
|
|
7026
|
+
|
|
7027
|
+
// ../../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
|
|
7028
|
+
init_cjs_shims();
|
|
7029
|
+
|
|
7030
|
+
// ../../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
|
|
7031
|
+
init_cjs_shims();
|
|
7032
|
+
|
|
7033
|
+
// ../../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
|
|
7034
|
+
init_cjs_shims();
|
|
7035
|
+
|
|
7036
|
+
// ../../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
|
|
7037
|
+
init_cjs_shims();
|
|
7038
|
+
var __defProp2 = Object.defineProperty;
|
|
7039
|
+
var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name", {
|
|
7040
|
+
value,
|
|
7041
|
+
configurable: true
|
|
7042
|
+
}), "__name");
|
|
7043
|
+
|
|
7044
|
+
// ../../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
|
|
7045
|
+
var import_node_fs3 = require("node:fs");
|
|
7046
|
+
var import_node_path = require("node:path");
|
|
7047
|
+
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
7048
|
+
var depth = 0;
|
|
7049
|
+
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
7050
|
+
const _startPath = startPath ?? process.cwd();
|
|
7051
|
+
if (endDirectoryNames.some((endDirName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endDirName)))) {
|
|
7052
|
+
return _startPath;
|
|
7053
|
+
}
|
|
7054
|
+
if (endFileNames.some((endFileName) => (0, import_node_fs3.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
|
|
7055
|
+
return _startPath;
|
|
7056
|
+
}
|
|
7057
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
7058
|
+
const parent = (0, import_node_path.join)(_startPath, "..");
|
|
7059
|
+
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
7060
|
+
}
|
|
7061
|
+
return void 0;
|
|
7062
|
+
}
|
|
7063
|
+
__name(findFolderUp, "findFolderUp");
|
|
7064
|
+
__name2(findFolderUp, "findFolderUp");
|
|
7065
|
+
|
|
7066
|
+
// ../../node_modules/.pnpm/@storm-software+config-tools@1.160.6_@storm-software+config@1.110.6/node_modules/@storm-software/config-tools/dist/chunk-D6E6GZD2.js
|
|
7067
|
+
init_cjs_shims();
|
|
7068
|
+
var _DRIVE_LETTER_START_RE3 = /^[A-Za-z]:\//;
|
|
7069
|
+
function normalizeWindowsPath3(input = "") {
|
|
7070
|
+
if (!input) {
|
|
7071
|
+
return input;
|
|
7072
|
+
}
|
|
7073
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE3, (r) => r.toUpperCase());
|
|
7074
|
+
}
|
|
7075
|
+
__name(normalizeWindowsPath3, "normalizeWindowsPath");
|
|
7076
|
+
__name2(normalizeWindowsPath3, "normalizeWindowsPath");
|
|
7077
|
+
var _UNC_REGEX3 = /^[/\\]{2}/;
|
|
7078
|
+
var _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
7079
|
+
var _DRIVE_LETTER_RE3 = /^[A-Za-z]:$/;
|
|
7080
|
+
var correctPaths2 = /* @__PURE__ */ __name2(function(path5) {
|
|
7081
|
+
if (!path5 || path5.length === 0) {
|
|
7082
|
+
return ".";
|
|
7083
|
+
}
|
|
7084
|
+
path5 = normalizeWindowsPath3(path5);
|
|
7085
|
+
const isUNCPath = path5.match(_UNC_REGEX3);
|
|
7086
|
+
const isPathAbsolute = isAbsolute2(path5);
|
|
7087
|
+
const trailingSeparator = path5[path5.length - 1] === "/";
|
|
7088
|
+
path5 = normalizeString3(path5, !isPathAbsolute);
|
|
7089
|
+
if (path5.length === 0) {
|
|
7090
|
+
if (isPathAbsolute) {
|
|
7091
|
+
return "/";
|
|
7092
|
+
}
|
|
7093
|
+
return trailingSeparator ? "./" : ".";
|
|
7094
|
+
}
|
|
7095
|
+
if (trailingSeparator) {
|
|
7096
|
+
path5 += "/";
|
|
7097
|
+
}
|
|
7098
|
+
if (_DRIVE_LETTER_RE3.test(path5)) {
|
|
7099
|
+
path5 += "/";
|
|
7100
|
+
}
|
|
7101
|
+
if (isUNCPath) {
|
|
7102
|
+
if (!isPathAbsolute) {
|
|
7103
|
+
return `//./${path5}`;
|
|
7104
|
+
}
|
|
7105
|
+
return `//${path5}`;
|
|
7106
|
+
}
|
|
7107
|
+
return isPathAbsolute && !isAbsolute2(path5) ? `/${path5}` : path5;
|
|
7108
|
+
}, "correctPaths");
|
|
7109
|
+
function cwd() {
|
|
7110
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
7111
|
+
return process.cwd().replace(/\\/g, "/");
|
|
7112
|
+
}
|
|
7113
|
+
return "/";
|
|
7114
|
+
}
|
|
7115
|
+
__name(cwd, "cwd");
|
|
7116
|
+
__name2(cwd, "cwd");
|
|
7117
|
+
function normalizeString3(path5, allowAboveRoot) {
|
|
7118
|
+
let res = "";
|
|
7119
|
+
let lastSegmentLength = 0;
|
|
7120
|
+
let lastSlash = -1;
|
|
7121
|
+
let dots = 0;
|
|
7122
|
+
let char = null;
|
|
7123
|
+
for (let index = 0; index <= path5.length; ++index) {
|
|
7124
|
+
if (index < path5.length) {
|
|
7125
|
+
char = path5[index];
|
|
7126
|
+
} else if (char === "/") {
|
|
7127
|
+
break;
|
|
7128
|
+
} else {
|
|
7129
|
+
char = "/";
|
|
7130
|
+
}
|
|
7131
|
+
if (char === "/") {
|
|
7132
|
+
if (lastSlash === index - 1 || dots === 1) {
|
|
7133
|
+
} else if (dots === 2) {
|
|
7134
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
7135
|
+
if (res.length > 2) {
|
|
7136
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
7137
|
+
if (lastSlashIndex === -1) {
|
|
7138
|
+
res = "";
|
|
7139
|
+
lastSegmentLength = 0;
|
|
7140
|
+
} else {
|
|
7141
|
+
res = res.slice(0, lastSlashIndex);
|
|
7142
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
7143
|
+
}
|
|
7144
|
+
lastSlash = index;
|
|
7145
|
+
dots = 0;
|
|
7146
|
+
continue;
|
|
7147
|
+
} else if (res.length > 0) {
|
|
7148
|
+
res = "";
|
|
7149
|
+
lastSegmentLength = 0;
|
|
7150
|
+
lastSlash = index;
|
|
7151
|
+
dots = 0;
|
|
7152
|
+
continue;
|
|
7153
|
+
}
|
|
7154
|
+
}
|
|
7155
|
+
if (allowAboveRoot) {
|
|
7156
|
+
res += res.length > 0 ? "/.." : "..";
|
|
7157
|
+
lastSegmentLength = 2;
|
|
7158
|
+
}
|
|
7159
|
+
} else {
|
|
7160
|
+
if (res.length > 0) {
|
|
7161
|
+
res += `/${path5.slice(lastSlash + 1, index)}`;
|
|
7162
|
+
} else {
|
|
7163
|
+
res = path5.slice(lastSlash + 1, index);
|
|
7164
|
+
}
|
|
7165
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
7166
|
+
}
|
|
7167
|
+
lastSlash = index;
|
|
7168
|
+
dots = 0;
|
|
7169
|
+
} else if (char === "." && dots !== -1) {
|
|
7170
|
+
++dots;
|
|
7171
|
+
} else {
|
|
7172
|
+
dots = -1;
|
|
7173
|
+
}
|
|
7174
|
+
}
|
|
7175
|
+
return res;
|
|
7176
|
+
}
|
|
7177
|
+
__name(normalizeString3, "normalizeString");
|
|
7178
|
+
__name2(normalizeString3, "normalizeString");
|
|
7179
|
+
var isAbsolute2 = /* @__PURE__ */ __name2(function(p) {
|
|
7180
|
+
return _IS_ABSOLUTE_RE2.test(p);
|
|
7181
|
+
}, "isAbsolute");
|
|
7182
|
+
|
|
7183
|
+
// ../../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
|
|
7184
|
+
var rootFiles = [
|
|
7185
|
+
"storm-workspace.json",
|
|
7186
|
+
"storm-workspace.json",
|
|
7187
|
+
"storm-workspace.yaml",
|
|
7188
|
+
"storm-workspace.yml",
|
|
7189
|
+
"storm-workspace.js",
|
|
7190
|
+
"storm-workspace.ts",
|
|
7191
|
+
".storm-workspace.json",
|
|
7192
|
+
".storm-workspace.yaml",
|
|
7193
|
+
".storm-workspace.yml",
|
|
7194
|
+
".storm-workspace.js",
|
|
7195
|
+
".storm-workspace.ts",
|
|
7196
|
+
"lerna.json",
|
|
7197
|
+
"nx.json",
|
|
7198
|
+
"turbo.json",
|
|
7199
|
+
"npm-workspace.json",
|
|
7200
|
+
"yarn-workspace.json",
|
|
7201
|
+
"pnpm-workspace.json",
|
|
7202
|
+
"npm-workspace.yaml",
|
|
7203
|
+
"yarn-workspace.yaml",
|
|
7204
|
+
"pnpm-workspace.yaml",
|
|
7205
|
+
"npm-workspace.yml",
|
|
7206
|
+
"yarn-workspace.yml",
|
|
7207
|
+
"pnpm-workspace.yml",
|
|
7208
|
+
"npm-lock.json",
|
|
7209
|
+
"yarn-lock.json",
|
|
7210
|
+
"pnpm-lock.json",
|
|
7211
|
+
"npm-lock.yaml",
|
|
7212
|
+
"yarn-lock.yaml",
|
|
7213
|
+
"pnpm-lock.yaml",
|
|
7214
|
+
"npm-lock.yml",
|
|
7215
|
+
"yarn-lock.yml",
|
|
7216
|
+
"pnpm-lock.yml",
|
|
7217
|
+
"bun.lockb"
|
|
7218
|
+
];
|
|
7219
|
+
var rootDirectories = [
|
|
7220
|
+
".storm-workspace",
|
|
7221
|
+
".nx",
|
|
7222
|
+
".github",
|
|
7223
|
+
".vscode",
|
|
7224
|
+
".verdaccio"
|
|
7225
|
+
];
|
|
7226
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
7227
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
7228
|
+
return correctPaths2(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
7229
|
+
}
|
|
7230
|
+
return correctPaths2(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
7231
|
+
}
|
|
7232
|
+
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
7233
|
+
__name2(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
7234
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
7235
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
7236
|
+
if (!result) {
|
|
7237
|
+
throw new Error(`Cannot find workspace root upwards from known path. Files search list includes:
|
|
7238
|
+
${rootFiles.join("\n")}
|
|
7239
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
|
|
7240
|
+
}
|
|
7241
|
+
return result;
|
|
7242
|
+
}
|
|
7243
|
+
__name(findWorkspaceRoot, "findWorkspaceRoot");
|
|
7244
|
+
__name2(findWorkspaceRoot, "findWorkspaceRoot");
|
|
7245
|
+
|
|
7194
7246
|
// ../path/src/get-parent-path.ts
|
|
7195
7247
|
init_cjs_shims();
|
|
7196
7248
|
var resolveParentPath = /* @__PURE__ */ __name((path5) => {
|
|
@@ -7345,58 +7397,6 @@ function relativePath(from, to) {
|
|
|
7345
7397
|
}
|
|
7346
7398
|
__name(relativePath, "relativePath");
|
|
7347
7399
|
|
|
7348
|
-
// ../string-format/src/lower-case-first.ts
|
|
7349
|
-
init_cjs_shims();
|
|
7350
|
-
var lowerCaseFirst = /* @__PURE__ */ __name((input) => {
|
|
7351
|
-
return input ? input.charAt(0).toLowerCase() + input.slice(1) : input;
|
|
7352
|
-
}, "lowerCaseFirst");
|
|
7353
|
-
|
|
7354
|
-
// src/prisma-generator.ts
|
|
7355
|
-
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
7356
|
-
var import_pluralize = __toESM(require_pluralize(), 1);
|
|
7357
|
-
|
|
7358
|
-
// src/config.ts
|
|
7359
|
-
init_cjs_shims();
|
|
7360
|
-
var ModelAction = /* @__PURE__ */ function(ModelAction2) {
|
|
7361
|
-
ModelAction2["findUnique"] = "findUnique";
|
|
7362
|
-
ModelAction2["findUniqueOrThrow"] = "findUniqueOrThrow";
|
|
7363
|
-
ModelAction2["findFirst"] = "findFirst";
|
|
7364
|
-
ModelAction2["findFirstOrThrow"] = "findFirstOrThrow";
|
|
7365
|
-
ModelAction2["findMany"] = "findMany";
|
|
7366
|
-
ModelAction2["create"] = "create";
|
|
7367
|
-
ModelAction2["createMany"] = "createMany";
|
|
7368
|
-
ModelAction2["createManyAndReturn"] = "createManyAndReturn";
|
|
7369
|
-
ModelAction2["update"] = "update";
|
|
7370
|
-
ModelAction2["updateMany"] = "updateMany";
|
|
7371
|
-
ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
|
|
7372
|
-
ModelAction2["upsert"] = "upsert";
|
|
7373
|
-
ModelAction2["delete"] = "delete";
|
|
7374
|
-
ModelAction2["deleteMany"] = "deleteMany";
|
|
7375
|
-
ModelAction2["groupBy"] = "groupBy";
|
|
7376
|
-
ModelAction2["count"] = "count";
|
|
7377
|
-
ModelAction2["aggregate"] = "aggregate";
|
|
7378
|
-
ModelAction2["findRaw"] = "findRaw";
|
|
7379
|
-
ModelAction2["aggregateRaw"] = "aggregateRaw";
|
|
7380
|
-
return ModelAction2;
|
|
7381
|
-
}(ModelAction || {});
|
|
7382
|
-
var modelActionEnum = z.nativeEnum(ModelAction);
|
|
7383
|
-
var configSchema = z.object({
|
|
7384
|
-
debug: z.coerce.boolean().or(z.string()).default(false),
|
|
7385
|
-
withMiddleware: z.coerce.boolean().or(z.string()).default(false),
|
|
7386
|
-
withShield: z.coerce.boolean().or(z.string()).default(true),
|
|
7387
|
-
withZod: z.coerce.boolean().or(z.string()).default(true),
|
|
7388
|
-
withNext: z.coerce.boolean().or(z.string()).default(true),
|
|
7389
|
-
contextPath: z.string().default("../src/trpc/context.ts"),
|
|
7390
|
-
trpcOptions: z.coerce.boolean().or(z.string()).default(true),
|
|
7391
|
-
showModelNameInProcedure: z.coerce.boolean().or(z.string()).default(true),
|
|
7392
|
-
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
7393
|
-
return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
|
|
7394
|
-
})
|
|
7395
|
-
});
|
|
7396
|
-
|
|
7397
|
-
// src/helpers.ts
|
|
7398
|
-
init_cjs_shims();
|
|
7399
|
-
|
|
7400
7400
|
// src/utils/get-prisma-internals.ts
|
|
7401
7401
|
init_cjs_shims();
|
|
7402
7402
|
|
|
@@ -7588,17 +7588,6 @@ async function getPrismaGeneratorHelper() {
|
|
|
7588
7588
|
}
|
|
7589
7589
|
__name(getPrismaGeneratorHelper, "getPrismaGeneratorHelper");
|
|
7590
7590
|
|
|
7591
|
-
// src/utils/get-relative-path.ts
|
|
7592
|
-
init_cjs_shims();
|
|
7593
|
-
function getRelativePath(outputPath, filePath, isOutsideOutputPath, schemaPath, fromPath) {
|
|
7594
|
-
let toPath = joinPaths(outputPath, filePath.endsWith(".ts") ? findFilePath(filePath) : filePath);
|
|
7595
|
-
if (isOutsideOutputPath && schemaPath) {
|
|
7596
|
-
toPath = joinPaths(schemaPath.endsWith(".prisma") ? findFilePath(schemaPath) : schemaPath, filePath);
|
|
7597
|
-
}
|
|
7598
|
-
return relativePath(fromPath || outputPath, toPath);
|
|
7599
|
-
}
|
|
7600
|
-
__name(getRelativePath, "getRelativePath");
|
|
7601
|
-
|
|
7602
7591
|
// src/helpers.ts
|
|
7603
7592
|
var getProcedureName = /* @__PURE__ */ __name((config) => {
|
|
7604
7593
|
return config.withShield ? "shieldedProcedure" : config.withMiddleware ? "protectedProcedure" : "publicProcedure";
|
|
@@ -7615,18 +7604,6 @@ var generateCreateRouterImport = /* @__PURE__ */ __name(({ sourceFile, config })
|
|
|
7615
7604
|
namedImports: imports
|
|
7616
7605
|
});
|
|
7617
7606
|
}, "generateCreateRouterImport");
|
|
7618
|
-
var generateShieldImport = /* @__PURE__ */ __name(async (sourceFile, options, outputDir, value) => {
|
|
7619
|
-
let shieldPath = joinPaths(outputDir, "shield");
|
|
7620
|
-
if (typeof value === "string") {
|
|
7621
|
-
shieldPath = getRelativePath(outputDir, value, true, options.schemaPath);
|
|
7622
|
-
}
|
|
7623
|
-
sourceFile.addImportDeclaration({
|
|
7624
|
-
moduleSpecifier: shieldPath,
|
|
7625
|
-
namedImports: [
|
|
7626
|
-
"permissions"
|
|
7627
|
-
]
|
|
7628
|
-
});
|
|
7629
|
-
}, "generateShieldImport");
|
|
7630
7607
|
var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural, modelNameCamelCase) => {
|
|
7631
7608
|
sourceFile.addImportDeclaration({
|
|
7632
7609
|
moduleSpecifier: `./${modelNameCamelCase}.router`,
|
|
@@ -7635,25 +7612,34 @@ var generateRouterImport = /* @__PURE__ */ __name((sourceFile, modelNamePlural,
|
|
|
7635
7612
|
]
|
|
7636
7613
|
});
|
|
7637
7614
|
}, "generateRouterImport");
|
|
7638
|
-
async function
|
|
7639
|
-
|
|
7640
|
-
|
|
7615
|
+
async function generateTRPCExports(sourceFile, config, options, outputDir) {
|
|
7616
|
+
if (config.withShield) {
|
|
7617
|
+
sourceFile.addImportDeclaration({
|
|
7618
|
+
moduleSpecifier: relativePath(outputDir, joinPaths(outputDir, typeof config.withShield === "string" ? config.withShield : "shield")),
|
|
7619
|
+
namedImports: [
|
|
7620
|
+
"permissions"
|
|
7621
|
+
]
|
|
7622
|
+
});
|
|
7623
|
+
sourceFile.formatText({
|
|
7624
|
+
indentSize: 2
|
|
7625
|
+
});
|
|
7626
|
+
}
|
|
7641
7627
|
sourceFile.addStatements(
|
|
7642
7628
|
/* ts */
|
|
7643
7629
|
`
|
|
7644
|
-
import type { Context } from '${
|
|
7630
|
+
import type { Context } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';`
|
|
7645
7631
|
);
|
|
7646
7632
|
if (config.trpcOptions) {
|
|
7647
7633
|
sourceFile.addStatements(
|
|
7648
7634
|
/* ts */
|
|
7649
7635
|
`
|
|
7650
|
-
import trpcOptions from '${
|
|
7636
|
+
import trpcOptions from '${relativePath(outputDir, joinPaths(outputDir, typeof config.trpcOptions === "string" ? config.trpcOptions : "options"))}';`
|
|
7651
7637
|
);
|
|
7652
7638
|
}
|
|
7653
7639
|
if (config.withNext) {
|
|
7654
7640
|
sourceFile.addStatements(
|
|
7655
7641
|
/* ts */
|
|
7656
|
-
`import { createContext } from '${
|
|
7642
|
+
`import { createContext } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';
|
|
7657
7643
|
import { initTRPC } from '@trpc/server';
|
|
7658
7644
|
import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';`
|
|
7659
7645
|
);
|
|
@@ -7685,7 +7671,7 @@ async function generateBaseRouter(sourceFile, config, options) {
|
|
|
7685
7671
|
sourceFile.addStatements(
|
|
7686
7672
|
/* ts */
|
|
7687
7673
|
`
|
|
7688
|
-
import defaultMiddleware from '${
|
|
7674
|
+
import defaultMiddleware from '${relativePath(outputDir, joinPaths(outputDir, typeof config.withMiddleware === "string" ? config.withMiddleware : "middleware"))}';
|
|
7689
7675
|
`
|
|
7690
7676
|
);
|
|
7691
7677
|
sourceFile.addStatements(
|
|
@@ -7757,7 +7743,7 @@ export const createCallerFactory = t.createCallerFactory;`
|
|
|
7757
7743
|
);
|
|
7758
7744
|
}
|
|
7759
7745
|
}
|
|
7760
|
-
__name(
|
|
7746
|
+
__name(generateTRPCExports, "generateTRPCExports");
|
|
7761
7747
|
function generateProcedure(sourceFile, name, typeName, modelName, opType, baseOpType, config) {
|
|
7762
7748
|
let input = `input${!config.withZod ? " as any" : ""}`;
|
|
7763
7749
|
const nameWithoutModel = name.replace(modelName, "");
|
|
@@ -7962,7 +7948,7 @@ var constructShield = /* @__PURE__ */ __name(async ({ queries, mutations, subscr
|
|
|
7962
7948
|
return "";
|
|
7963
7949
|
}
|
|
7964
7950
|
let shieldText = getImports("trpc-shield");
|
|
7965
|
-
shieldText += getImports("context",
|
|
7951
|
+
shieldText += getImports("context", relativePath(outputDir, joinPaths(outputDir, config.contextPath)));
|
|
7966
7952
|
shieldText += "\n\n";
|
|
7967
7953
|
shieldText += wrapWithExport({
|
|
7968
7954
|
shieldObjectText: wrapWithTrpcShieldCall({
|
|
@@ -7975,50 +7961,50 @@ var constructShield = /* @__PURE__ */ __name(async ({ queries, mutations, subscr
|
|
|
7975
7961
|
}, "constructShield");
|
|
7976
7962
|
var constructDefaultOptions = /* @__PURE__ */ __name((config, options, outputDir) => {
|
|
7977
7963
|
return `import { ZodError } from 'zod';${config.withNext ? '\nimport { transformer } from "@stryke/trpc-next/shared";' : ""}
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7964
|
+
import type {
|
|
7965
|
+
DataTransformerOptions,
|
|
7966
|
+
RootConfig
|
|
7967
|
+
} from "@trpc/server/unstable-core-do-not-import";
|
|
7968
|
+
import type { Context } from "${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}";
|
|
7983
7969
|
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
7970
|
+
interface RuntimeConfigOptions<
|
|
7971
|
+
TContext extends object,
|
|
7972
|
+
TMeta extends object = object
|
|
7973
|
+
> extends Partial<
|
|
7974
|
+
Omit<
|
|
7975
|
+
RootConfig<{
|
|
7976
|
+
ctx: TContext;
|
|
7977
|
+
meta: TMeta;
|
|
7978
|
+
errorShape: any;
|
|
7979
|
+
transformer: any;
|
|
7980
|
+
}>,
|
|
7981
|
+
"$types" | "transformer"
|
|
7982
|
+
>
|
|
7983
|
+
> {
|
|
7984
|
+
/**
|
|
7985
|
+
* Use a data transformer
|
|
7986
|
+
* @see https://trpc.io/docs/v11/data-transformers
|
|
7987
|
+
*/
|
|
7988
|
+
transformer?: DataTransformerOptions;
|
|
7989
|
+
}
|
|
8004
7990
|
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
7991
|
+
const options: RuntimeConfigOptions<Context> = {${config.withNext ? "\n transformer," : ""}
|
|
7992
|
+
errorFormatter({ shape, error }) {
|
|
7993
|
+
return {
|
|
7994
|
+
...shape,
|
|
7995
|
+
data: {
|
|
7996
|
+
...shape.data,
|
|
7997
|
+
zodError:
|
|
7998
|
+
error.code === "BAD_REQUEST" && error.cause instanceof ZodError
|
|
7999
|
+
? error.cause.flatten()
|
|
8000
|
+
: null
|
|
8001
|
+
}
|
|
8002
|
+
};
|
|
8003
|
+
}
|
|
8004
|
+
};
|
|
8019
8005
|
|
|
8020
|
-
|
|
8021
|
-
|
|
8006
|
+
export default options;
|
|
8007
|
+
`;
|
|
8022
8008
|
}, "constructDefaultOptions");
|
|
8023
8009
|
|
|
8024
8010
|
// src/project.ts
|
|
@@ -11641,43 +11627,28 @@ async function generate(options) {
|
|
|
11641
11627
|
queries.sort();
|
|
11642
11628
|
mutations.sort();
|
|
11643
11629
|
subscriptions.sort();
|
|
11644
|
-
if (config.withShield !== false) {
|
|
11645
|
-
consoleLog(
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
const shieldText = await constructShield({
|
|
11652
|
-
queries,
|
|
11653
|
-
mutations,
|
|
11654
|
-
subscriptions
|
|
11655
|
-
}, config, options, shieldOutputDir);
|
|
11656
|
-
consoleLog("Saving tRPC Shield source file to disk");
|
|
11657
|
-
await writeFileSafely(shieldOutputDir.endsWith(".ts") ? shieldOutputDir : joinPaths(shieldOutputDir, "shield.ts"), shieldText);
|
|
11658
|
-
}
|
|
11630
|
+
if (config.withShield !== false && (typeof config.withShield !== "string" || !existsSync(joinPaths(outputDir, config.withShield)) && !existsSync(joinPaths(outputDir, `${config.withShield}.ts`)) && !existsSync(joinPaths(outputDir, config.withShield, "shield.ts")))) {
|
|
11631
|
+
consoleLog(`Generating tRPC Shield source file to ${outputDir}`);
|
|
11632
|
+
await writeFileSafely(joinPaths(outputDir, "shield.ts"), await constructShield({
|
|
11633
|
+
queries,
|
|
11634
|
+
mutations,
|
|
11635
|
+
subscriptions
|
|
11636
|
+
}, config, options, outputDir));
|
|
11659
11637
|
} else {
|
|
11660
11638
|
consoleLog("Skipping tRPC Shield generation");
|
|
11661
11639
|
}
|
|
11662
11640
|
consoleLog(`Generating tRPC source code for ${models.length} models`);
|
|
11663
11641
|
if (config.trpcOptions && typeof config.trpcOptions === "boolean") {
|
|
11664
|
-
|
|
11665
|
-
|
|
11666
|
-
await writeFileSafely(trpcOptionsOutputPath, constructDefaultOptions(config, options, trpcOptionsOutputPath));
|
|
11642
|
+
consoleLog(`Generating tRPC options source file to ${outputDir}`);
|
|
11643
|
+
await writeFileSafely(joinPaths(outputDir, "options.ts"), constructDefaultOptions(config, options, outputDir));
|
|
11667
11644
|
}
|
|
11668
11645
|
resolveModelsComments(models, hiddenModels);
|
|
11646
|
+
consoleLog("Generating tRPC export file");
|
|
11669
11647
|
const trpcExports = project.createSourceFile(import_node_path5.default.resolve(outputDir, "trpc.ts"), void 0, {
|
|
11670
11648
|
overwrite: true
|
|
11671
11649
|
});
|
|
11672
|
-
|
|
11673
|
-
|
|
11674
|
-
await generateShieldImport(trpcExports, options, outputDir, config.withShield);
|
|
11675
|
-
}
|
|
11676
|
-
consoleLog("Generating tRPC base router");
|
|
11677
|
-
await generateBaseRouter(trpcExports, config, options);
|
|
11678
|
-
trpcExports.formatText({
|
|
11679
|
-
indentSize: 2
|
|
11680
|
-
});
|
|
11650
|
+
await generateTRPCExports(trpcExports, config, options, outputDir);
|
|
11651
|
+
consoleLog("Generating tRPC app router");
|
|
11681
11652
|
const appRouter = project.createSourceFile(import_node_path5.default.resolve(outputDir, "routers", `index.ts`), void 0, {
|
|
11682
11653
|
overwrite: true
|
|
11683
11654
|
});
|