@stryke/prisma-trpc-generator 0.2.12 → 0.2.13

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.
@@ -668,1568 +668,6 @@ var require_pluralize = __commonJS({
668
668
  }
669
669
  });
670
670
 
671
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/comments-helpers.js
672
- var require_comments_helpers = __commonJS({
673
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/comments-helpers.js"(exports2) {
674
- "use strict";
675
- init_cjs_shims();
676
- Object.defineProperty(exports2, "__esModule", {
677
- value: true
678
- });
679
- exports2.hideInputObjectTypesAndRelatedFields = exports2.resolveModelsComments = void 0;
680
- var modelAttributeRegex = /(@@Gen\.)+([A-z])+(\()+(.+)+(\))+/;
681
- var attributeNameRegex = /(?:\.)+([A-Za-z])+(?:\()+/;
682
- var attributeArgsRegex = /(?:\()+([A-Za-z])+\:+(.+)+(?:\))+/;
683
- function resolveModelsComments2(models, modelOperations, enumTypes, hiddenModels, hiddenFields) {
684
- models = collectHiddenModels(models, hiddenModels);
685
- collectHiddenFields(models, hiddenModels, hiddenFields);
686
- hideModelOperations(models, modelOperations);
687
- hideEnums(enumTypes, hiddenModels);
688
- }
689
- __name(resolveModelsComments2, "resolveModelsComments");
690
- exports2.resolveModelsComments = resolveModelsComments2;
691
- function collectHiddenModels(models, hiddenModels) {
692
- return models.map((model) => {
693
- var _a, _b, _c, _d, _e, _f;
694
- if (model.documentation) {
695
- const attribute = (_b = (_a = model.documentation) === null || _a === void 0 ? void 0 : _a.match(modelAttributeRegex)) === null || _b === void 0 ? void 0 : _b[0];
696
- const attributeName = (_d = (_c = attribute === null || attribute === void 0 ? void 0 : attribute.match(attributeNameRegex)) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.slice(1, -1);
697
- if (attributeName !== "model") model;
698
- const rawAttributeArgs = (_f = (_e = attribute === null || attribute === void 0 ? void 0 : attribute.match(attributeArgsRegex)) === null || _e === void 0 ? void 0 : _e[0]) === null || _f === void 0 ? void 0 : _f.slice(1, -1);
699
- const parsedAttributeArgs = {};
700
- if (rawAttributeArgs) {
701
- const rawAttributeArgsParts = rawAttributeArgs.split(":").map((it) => it.trim()).map((part) => part.startsWith("[") ? part : part.split(",")).flat().map((it) => it.trim());
702
- for (let i = 0; i < rawAttributeArgsParts.length; i += 2) {
703
- const key = rawAttributeArgsParts[i];
704
- const value = rawAttributeArgsParts[i + 1];
705
- parsedAttributeArgs[key] = JSON.parse(value);
706
- }
707
- }
708
- if (parsedAttributeArgs.hide) {
709
- hiddenModels.push(model.name);
710
- return null;
711
- }
712
- }
713
- return model;
714
- }).filter(Boolean);
715
- }
716
- __name(collectHiddenModels, "collectHiddenModels");
717
- function collectHiddenFields(models, hiddenModels, hiddenFields) {
718
- models.forEach((model) => {
719
- model.fields.forEach((field) => {
720
- if (hiddenModels.includes(field.type)) {
721
- hiddenFields.push(field.name);
722
- if (field.relationFromFields) {
723
- field.relationFromFields.forEach((item) => hiddenFields.push(item));
724
- }
725
- }
726
- });
727
- });
728
- }
729
- __name(collectHiddenFields, "collectHiddenFields");
730
- function hideEnums(enumTypes, hiddenModels) {
731
- enumTypes.prisma = enumTypes.prisma.filter((item) => !hiddenModels.find((model) => item.name.startsWith(model)));
732
- }
733
- __name(hideEnums, "hideEnums");
734
- function hideModelOperations(models, modelOperations) {
735
- let i = modelOperations.length;
736
- while (i >= 0) {
737
- --i;
738
- const modelOperation = modelOperations[i];
739
- if (modelOperation && !models.find((model) => {
740
- return model.name === modelOperation.model;
741
- })) {
742
- modelOperations.splice(i, 1);
743
- }
744
- }
745
- }
746
- __name(hideModelOperations, "hideModelOperations");
747
- function hideInputObjectTypesAndRelatedFields(inputObjectTypes, hiddenModels, hiddenFields) {
748
- var _a, _b, _c, _d;
749
- let j = inputObjectTypes.length;
750
- while (j >= 0) {
751
- --j;
752
- const inputType = inputObjectTypes[j];
753
- if (inputType && (hiddenModels.includes((_a = inputType === null || inputType === void 0 ? void 0 : inputType.meta) === null || _a === void 0 ? void 0 : _a.source) || hiddenModels.find((model) => inputType.name.startsWith(model)))) {
754
- inputObjectTypes.splice(j, 1);
755
- } else {
756
- let k = (_c = (_b = inputType === null || inputType === void 0 ? void 0 : inputType.fields) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
757
- while (k >= 0) {
758
- --k;
759
- const field = (_d = inputType === null || inputType === void 0 ? void 0 : inputType.fields) === null || _d === void 0 ? void 0 : _d[k];
760
- if (field && hiddenFields.includes(field.name)) {
761
- inputObjectTypes[j].fields.splice(k, 1);
762
- }
763
- }
764
- }
765
- }
766
- }
767
- __name(hideInputObjectTypesAndRelatedFields, "hideInputObjectTypesAndRelatedFields");
768
- exports2.hideInputObjectTypesAndRelatedFields = hideInputObjectTypesAndRelatedFields;
769
- }
770
- });
771
-
772
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/aggregate-helpers.js
773
- var require_aggregate_helpers = __commonJS({
774
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/aggregate-helpers.js"(exports2) {
775
- "use strict";
776
- init_cjs_shims();
777
- Object.defineProperty(exports2, "__esModule", {
778
- value: true
779
- });
780
- exports2.resolveAggregateOperationSupport = exports2.addMissingInputObjectTypesForAggregate = exports2.isAggregateInputType = void 0;
781
- var isAggregateOutputType = /* @__PURE__ */ __name((name) => /(?:Count|Avg|Sum|Min|Max)AggregateOutputType$/.test(name), "isAggregateOutputType");
782
- var isAggregateInputType = /* @__PURE__ */ __name((name) => name.endsWith("CountAggregateInput") || name.endsWith("SumAggregateInput") || name.endsWith("AvgAggregateInput") || name.endsWith("MinAggregateInput") || name.endsWith("MaxAggregateInput"), "isAggregateInputType");
783
- exports2.isAggregateInputType = isAggregateInputType;
784
- function addMissingInputObjectTypesForAggregate(inputObjectTypes, outputObjectTypes) {
785
- const aggregateOutputTypes = outputObjectTypes.filter(({ name }) => isAggregateOutputType(name));
786
- for (const aggregateOutputType of aggregateOutputTypes) {
787
- const name = aggregateOutputType.name.replace(/(?:OutputType|Output)$/, "");
788
- inputObjectTypes.push({
789
- constraints: {
790
- maxNumFields: null,
791
- minNumFields: null
792
- },
793
- name: `${name}Input`,
794
- fields: aggregateOutputType.fields.map((field) => ({
795
- name: field.name,
796
- isNullable: false,
797
- isRequired: false,
798
- inputTypes: [
799
- {
800
- isList: false,
801
- type: "True",
802
- location: "scalar"
803
- }
804
- ]
805
- }))
806
- });
807
- }
808
- }
809
- __name(addMissingInputObjectTypesForAggregate, "addMissingInputObjectTypesForAggregate");
810
- exports2.addMissingInputObjectTypesForAggregate = addMissingInputObjectTypesForAggregate;
811
- function resolveAggregateOperationSupport(inputObjectTypes) {
812
- const aggregateOperationSupport = {};
813
- for (const inputType of inputObjectTypes) {
814
- if ((0, exports2.isAggregateInputType)(inputType.name)) {
815
- const name = inputType.name.replace("AggregateInput", "");
816
- if (name.endsWith("Count")) {
817
- const model = name.replace("Count", "");
818
- aggregateOperationSupport[model] = {
819
- ...aggregateOperationSupport[model],
820
- count: true
821
- };
822
- } else if (name.endsWith("Min")) {
823
- const model = name.replace("Min", "");
824
- aggregateOperationSupport[model] = {
825
- ...aggregateOperationSupport[model],
826
- min: true
827
- };
828
- } else if (name.endsWith("Max")) {
829
- const model = name.replace("Max", "");
830
- aggregateOperationSupport[model] = {
831
- ...aggregateOperationSupport[model],
832
- max: true
833
- };
834
- } else if (name.endsWith("Sum")) {
835
- const model = name.replace("Sum", "");
836
- aggregateOperationSupport[model] = {
837
- ...aggregateOperationSupport[model],
838
- sum: true
839
- };
840
- } else if (name.endsWith("Avg")) {
841
- const model = name.replace("Avg", "");
842
- aggregateOperationSupport[model] = {
843
- ...aggregateOperationSupport[model],
844
- avg: true
845
- };
846
- }
847
- }
848
- }
849
- return aggregateOperationSupport;
850
- }
851
- __name(resolveAggregateOperationSupport, "resolveAggregateOperationSupport");
852
- exports2.resolveAggregateOperationSupport = resolveAggregateOperationSupport;
853
- }
854
- });
855
-
856
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/utils/formatFile.js
857
- var require_formatFile = __commonJS({
858
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/utils/formatFile.js"(exports2) {
859
- "use strict";
860
- init_cjs_shims();
861
- var __importDefault = exports2 && exports2.__importDefault || function(mod) {
862
- return mod && mod.__esModule ? mod : {
863
- "default": mod
864
- };
865
- };
866
- Object.defineProperty(exports2, "__esModule", {
867
- value: true
868
- });
869
- exports2.formatFile = void 0;
870
- var prettier_1 = __importDefault(require("prettier"));
871
- var formatFile2 = /* @__PURE__ */ __name((content) => {
872
- return new Promise((res, rej) => prettier_1.default.resolveConfig(process.cwd()).then((options) => {
873
- let formatOptions = options;
874
- if (!options) {
875
- formatOptions = {
876
- trailingComma: "all",
877
- tabWidth: 2,
878
- printWidth: 80,
879
- bracketSpacing: true,
880
- semi: true,
881
- singleQuote: true,
882
- useTabs: false
883
- };
884
- }
885
- try {
886
- const formatted = prettier_1.default.format(content, {
887
- ...formatOptions,
888
- parser: "typescript"
889
- });
890
- res(formatted);
891
- } catch (error) {
892
- rej(error);
893
- }
894
- }));
895
- }, "formatFile");
896
- exports2.formatFile = formatFile2;
897
- }
898
- });
899
-
900
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/utils/writeIndexFile.js
901
- var require_writeIndexFile = __commonJS({
902
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/utils/writeIndexFile.js"(exports2) {
903
- "use strict";
904
- init_cjs_shims();
905
- var __importDefault = exports2 && exports2.__importDefault || function(mod) {
906
- return mod && mod.__esModule ? mod : {
907
- "default": mod
908
- };
909
- };
910
- Object.defineProperty(exports2, "__esModule", {
911
- value: true
912
- });
913
- exports2.writeIndexFile = exports2.addIndexExport = void 0;
914
- var path_1 = __importDefault(require("path"));
915
- var writeFileSafely_1 = require_writeFileSafely();
916
- var indexExports = /* @__PURE__ */ new Set();
917
- var addIndexExport = /* @__PURE__ */ __name((filePath) => {
918
- indexExports.add(filePath);
919
- }, "addIndexExport");
920
- exports2.addIndexExport = addIndexExport;
921
- function normalizePath(path7) {
922
- if (typeof path7 !== "string") {
923
- throw new TypeError("Expected argument path to be a string");
924
- }
925
- if (path7 === "\\" || path7 === "/") return "/";
926
- let len = path7.length;
927
- if (len <= 1) return path7;
928
- let prefix = "";
929
- if (len > 4 && path7[3] === "\\") {
930
- let ch = path7[2];
931
- if ((ch === "?" || ch === ".") && path7.slice(0, 2) === "\\\\") {
932
- path7 = path7.slice(2);
933
- prefix = "//";
934
- }
935
- }
936
- let segs = path7.split(/[/\\]+/);
937
- return prefix + segs.join("/");
938
- }
939
- __name(normalizePath, "normalizePath");
940
- var writeIndexFile = /* @__PURE__ */ __name(async (indexPath) => {
941
- const rows = Array.from(indexExports).map((filePath) => {
942
- let relativePath = path_1.default.relative(path_1.default.dirname(indexPath), filePath);
943
- if (relativePath.endsWith(".ts")) {
944
- relativePath = relativePath.slice(0, relativePath.lastIndexOf(".ts"));
945
- }
946
- const normalized = normalizePath(relativePath);
947
- return `export * from './${normalized}'`;
948
- });
949
- const content = rows.join("\n");
950
- await (0, writeFileSafely_1.writeFileSafely)(indexPath, content, false);
951
- }, "writeIndexFile");
952
- exports2.writeIndexFile = writeIndexFile;
953
- }
954
- });
955
-
956
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/utils/writeFileSafely.js
957
- var require_writeFileSafely = __commonJS({
958
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/utils/writeFileSafely.js"(exports2) {
959
- "use strict";
960
- init_cjs_shims();
961
- var __importDefault = exports2 && exports2.__importDefault || function(mod) {
962
- return mod && mod.__esModule ? mod : {
963
- "default": mod
964
- };
965
- };
966
- Object.defineProperty(exports2, "__esModule", {
967
- value: true
968
- });
969
- exports2.writeFileSafely = void 0;
970
- var fs_1 = __importDefault(require("fs"));
971
- var path_1 = __importDefault(require("path"));
972
- var formatFile_1 = require_formatFile();
973
- var writeIndexFile_1 = require_writeIndexFile();
974
- var writeFileSafely2 = /* @__PURE__ */ __name(async (writeLocation, content, addToIndex = true) => {
975
- fs_1.default.mkdirSync(path_1.default.dirname(writeLocation), {
976
- recursive: true
977
- });
978
- fs_1.default.writeFileSync(writeLocation, await (0, formatFile_1.formatFile)(content));
979
- if (addToIndex) {
980
- (0, writeIndexFile_1.addIndexExport)(writeLocation);
981
- }
982
- }, "writeFileSafely");
983
- exports2.writeFileSafely = writeFileSafely2;
984
- }
985
- });
986
-
987
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/transformer.js
988
- var require_transformer = __commonJS({
989
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/transformer.js"(exports2) {
990
- "use strict";
991
- init_cjs_shims();
992
- var __importDefault = exports2 && exports2.__importDefault || function(mod) {
993
- return mod && mod.__esModule ? mod : {
994
- "default": mod
995
- };
996
- };
997
- Object.defineProperty(exports2, "__esModule", {
998
- value: true
999
- });
1000
- var path_1 = __importDefault(require("path"));
1001
- var helpers_1 = require_helpers2();
1002
- var aggregate_helpers_1 = require_aggregate_helpers();
1003
- var writeFileSafely_1 = require_writeFileSafely();
1004
- var writeIndexFile_1 = require_writeIndexFile();
1005
- var Transformer = class Transformer2 {
1006
- static {
1007
- __name(this, "Transformer");
1008
- }
1009
- constructor(params) {
1010
- var _a, _b, _c, _d, _e, _f;
1011
- this.schemaImports = /* @__PURE__ */ new Set();
1012
- this.hasJson = false;
1013
- this.name = (_a = params.name) !== null && _a !== void 0 ? _a : "";
1014
- this.fields = (_b = params.fields) !== null && _b !== void 0 ? _b : [];
1015
- this.models = (_c = params.models) !== null && _c !== void 0 ? _c : [];
1016
- this.modelOperations = (_d = params.modelOperations) !== null && _d !== void 0 ? _d : [];
1017
- this.aggregateOperationSupport = (_e = params.aggregateOperationSupport) !== null && _e !== void 0 ? _e : {};
1018
- this.enumTypes = (_f = params.enumTypes) !== null && _f !== void 0 ? _f : [];
1019
- }
1020
- static setOutputPath(outPath) {
1021
- this.outputPath = outPath;
1022
- }
1023
- static setIsGenerateSelect(isGenerateSelect) {
1024
- this.isGenerateSelect = isGenerateSelect;
1025
- }
1026
- static setIsGenerateInclude(isGenerateInclude) {
1027
- this.isGenerateInclude = isGenerateInclude;
1028
- }
1029
- static getOutputPath() {
1030
- return this.outputPath;
1031
- }
1032
- static setPrismaClientOutputPath(prismaClientCustomPath) {
1033
- this.prismaClientOutputPath = prismaClientCustomPath;
1034
- this.isCustomPrismaClientOutputPath = prismaClientCustomPath !== "@prisma/client";
1035
- }
1036
- static async generateIndex() {
1037
- const indexPath = path_1.default.join(Transformer2.outputPath, "schemas/index.ts");
1038
- await (0, writeIndexFile_1.writeIndexFile)(indexPath);
1039
- }
1040
- async generateEnumSchemas() {
1041
- for (const enumType2 of this.enumTypes) {
1042
- const { name, values } = enumType2;
1043
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/enums/${name}.schema.ts`), `${this.generateImportZodStatement()}
1044
- ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)})`)}`);
1045
- }
1046
- }
1047
- generateImportZodStatement() {
1048
- return "import { z } from 'zod';\n";
1049
- }
1050
- generateExportSchemaStatement(name, schema) {
1051
- return `export const ${name}Schema = ${schema}`;
1052
- }
1053
- async generateObjectSchema() {
1054
- const zodObjectSchemaFields = this.generateObjectSchemaFields();
1055
- const objectSchema = this.prepareObjectSchema(zodObjectSchemaFields);
1056
- const objectSchemaName = this.resolveObjectSchemaName();
1057
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/objects/${objectSchemaName}.schema.ts`), objectSchema);
1058
- }
1059
- generateObjectSchemaFields() {
1060
- const zodObjectSchemaFields = this.fields.map((field) => this.generateObjectSchemaField(field)).flatMap((item) => item).map((item) => {
1061
- const [zodStringWithMainType, field, skipValidators] = item;
1062
- const value = skipValidators ? zodStringWithMainType : this.generateFieldValidators(zodStringWithMainType, field);
1063
- return value.trim();
1064
- });
1065
- return zodObjectSchemaFields;
1066
- }
1067
- generateObjectSchemaField(field) {
1068
- let lines = field.inputTypes;
1069
- if (lines.length === 0) {
1070
- return [];
1071
- }
1072
- let alternatives = lines.reduce((result, inputType) => {
1073
- if (inputType.type === "String") {
1074
- result.push(this.wrapWithZodValidators("z.string()", field, inputType));
1075
- } else if (inputType.type === "Int" || inputType.type === "Float" || inputType.type === "Decimal") {
1076
- result.push(this.wrapWithZodValidators("z.number()", field, inputType));
1077
- } else if (inputType.type === "BigInt") {
1078
- result.push(this.wrapWithZodValidators("z.bigint()", field, inputType));
1079
- } else if (inputType.type === "Boolean") {
1080
- result.push(this.wrapWithZodValidators("z.boolean()", field, inputType));
1081
- } else if (inputType.type === "DateTime") {
1082
- result.push(this.wrapWithZodValidators("z.coerce.date()", field, inputType));
1083
- } else if (inputType.type === "Json") {
1084
- this.hasJson = true;
1085
- result.push(this.wrapWithZodValidators("jsonSchema", field, inputType));
1086
- } else if (inputType.type === "True") {
1087
- result.push(this.wrapWithZodValidators("z.literal(true)", field, inputType));
1088
- } else if (inputType.type === "Bytes") {
1089
- result.push(this.wrapWithZodValidators("z.instanceof(Buffer)", field, inputType));
1090
- } else {
1091
- const isEnum = inputType.location === "enumTypes";
1092
- if (inputType.namespace === "prisma" || isEnum) {
1093
- if (inputType.type !== this.name && typeof inputType.type === "string") {
1094
- this.addSchemaImport(inputType.type);
1095
- }
1096
- result.push(this.generatePrismaStringLine(field, inputType, lines.length));
1097
- }
1098
- }
1099
- return result;
1100
- }, []);
1101
- if (alternatives.length === 0) {
1102
- return [];
1103
- }
1104
- if (alternatives.length > 1) {
1105
- alternatives = alternatives.map((alter) => alter.replace(".optional()", ""));
1106
- }
1107
- const fieldName = alternatives.some((alt) => alt.includes(":")) ? "" : ` ${field.name}:`;
1108
- const opt = !field.isRequired ? ".optional()" : "";
1109
- let resString = alternatives.length === 1 ? alternatives.join(",\r\n") : `z.union([${alternatives.join(",\r\n")}])${opt}`;
1110
- if (field.isNullable) {
1111
- resString += ".nullable()";
1112
- }
1113
- return [
1114
- [
1115
- ` ${fieldName} ${resString} `,
1116
- field,
1117
- true
1118
- ]
1119
- ];
1120
- }
1121
- wrapWithZodValidators(mainValidator, field, inputType) {
1122
- let line = "";
1123
- line = mainValidator;
1124
- if (inputType.isList) {
1125
- line += ".array()";
1126
- }
1127
- if (!field.isRequired) {
1128
- line += ".optional()";
1129
- }
1130
- return line;
1131
- }
1132
- addSchemaImport(name) {
1133
- this.schemaImports.add(name);
1134
- }
1135
- generatePrismaStringLine(field, inputType, inputsLength) {
1136
- const isEnum = inputType.location === "enumTypes";
1137
- const { isModelQueryType, modelName, queryName } = this.checkIsModelQueryType(inputType.type);
1138
- let objectSchemaLine = isModelQueryType ? this.resolveModelQuerySchemaName(modelName, queryName) : `${inputType.type}ObjectSchema`;
1139
- let enumSchemaLine = `${inputType.type}Schema`;
1140
- const schema = inputType.type === this.name ? objectSchemaLine : isEnum ? enumSchemaLine : objectSchemaLine;
1141
- const arr = inputType.isList ? ".array()" : "";
1142
- const opt = !field.isRequired ? ".optional()" : "";
1143
- return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${schema})${arr}${opt}` : `z.lazy(() => ${schema})${arr}${opt}`;
1144
- }
1145
- generateFieldValidators(zodStringWithMainType, field) {
1146
- const { isRequired, isNullable } = field;
1147
- if (!isRequired) {
1148
- zodStringWithMainType += ".optional()";
1149
- }
1150
- if (isNullable) {
1151
- zodStringWithMainType += ".nullable()";
1152
- }
1153
- return zodStringWithMainType;
1154
- }
1155
- prepareObjectSchema(zodObjectSchemaFields) {
1156
- const objectSchema = `${this.generateExportObjectSchemaStatement(this.addFinalWrappers({
1157
- zodStringFields: zodObjectSchemaFields
1158
- }))}
1159
- `;
1160
- const prismaImportStatement = this.generateImportPrismaStatement();
1161
- const json = this.generateJsonSchemaImplementation();
1162
- return `${this.generateObjectSchemaImportStatements()}${prismaImportStatement}${json}${objectSchema}`;
1163
- }
1164
- generateExportObjectSchemaStatement(schema) {
1165
- let name = this.name;
1166
- let exportName = this.name;
1167
- if (Transformer2.provider === "mongodb") {
1168
- if ((0, helpers_1.isMongodbRawOp)(name)) {
1169
- name = Transformer2.rawOpsMap[name];
1170
- exportName = name.replace("Args", "");
1171
- }
1172
- }
1173
- if ((0, aggregate_helpers_1.isAggregateInputType)(name)) {
1174
- name = `${name}Type`;
1175
- }
1176
- const end = `export const ${exportName}ObjectSchema = Schema`;
1177
- return `const Schema: z.ZodType<Prisma.${name}> = ${schema};
1178
-
1179
- ${end}`;
1180
- }
1181
- addFinalWrappers({ zodStringFields }) {
1182
- const fields = [
1183
- ...zodStringFields
1184
- ];
1185
- return this.wrapWithZodObject(fields) + ".strict()";
1186
- }
1187
- generateImportPrismaStatement() {
1188
- let prismaClientImportPath;
1189
- if (Transformer2.isCustomPrismaClientOutputPath) {
1190
- const fromPath = path_1.default.join(Transformer2.outputPath, "schemas", "objects");
1191
- const toPath = Transformer2.prismaClientOutputPath;
1192
- const relativePathFromOutputToPrismaClient = path_1.default.relative(fromPath, toPath).split(path_1.default.sep).join(path_1.default.posix.sep);
1193
- prismaClientImportPath = relativePathFromOutputToPrismaClient;
1194
- } else {
1195
- prismaClientImportPath = Transformer2.prismaClientOutputPath;
1196
- }
1197
- return `import type { Prisma } from '${prismaClientImportPath}';
1198
-
1199
- `;
1200
- }
1201
- generateJsonSchemaImplementation() {
1202
- let jsonSchemaImplementation = "";
1203
- if (this.hasJson) {
1204
- jsonSchemaImplementation += `
1205
- `;
1206
- jsonSchemaImplementation += `const literalSchema = z.union([z.string(), z.number(), z.boolean()]);
1207
- `;
1208
- jsonSchemaImplementation += `const jsonSchema: z.ZodType<Prisma.InputJsonValue> = z.lazy(() =>
1209
- `;
1210
- jsonSchemaImplementation += ` z.union([literalSchema, z.array(jsonSchema.nullable()), z.record(jsonSchema.nullable())])
1211
- `;
1212
- jsonSchemaImplementation += `);
1213
-
1214
- `;
1215
- }
1216
- return jsonSchemaImplementation;
1217
- }
1218
- generateObjectSchemaImportStatements() {
1219
- let generatedImports = this.generateImportZodStatement();
1220
- generatedImports += this.generateSchemaImports();
1221
- generatedImports += "\n\n";
1222
- return generatedImports;
1223
- }
1224
- generateSchemaImports() {
1225
- return [
1226
- ...this.schemaImports
1227
- ].map((name) => {
1228
- const { isModelQueryType, modelName, queryName } = this.checkIsModelQueryType(name);
1229
- if (isModelQueryType) {
1230
- return `import { ${this.resolveModelQuerySchemaName(modelName, queryName)} } from '../${queryName}${modelName}.schema'`;
1231
- } else if (Transformer2.enumNames.includes(name)) {
1232
- return `import { ${name}Schema } from '../enums/${name}.schema'`;
1233
- } else {
1234
- return `import { ${name}ObjectSchema } from './${name}.schema'`;
1235
- }
1236
- }).join(";\r\n");
1237
- }
1238
- checkIsModelQueryType(type) {
1239
- const modelQueryTypeSuffixToQueryName = {
1240
- FindManyArgs: "findMany"
1241
- };
1242
- for (const modelQueryType of [
1243
- "FindManyArgs"
1244
- ]) {
1245
- if (type.includes(modelQueryType)) {
1246
- const modelQueryTypeSuffixIndex = type.indexOf(modelQueryType);
1247
- return {
1248
- isModelQueryType: true,
1249
- modelName: type.substring(0, modelQueryTypeSuffixIndex),
1250
- queryName: modelQueryTypeSuffixToQueryName[modelQueryType]
1251
- };
1252
- }
1253
- }
1254
- return {
1255
- isModelQueryType: false
1256
- };
1257
- }
1258
- resolveModelQuerySchemaName(modelName, queryName) {
1259
- const modelNameCapitalized = modelName.charAt(0).toUpperCase() + modelName.slice(1);
1260
- const queryNameCapitalized = queryName.charAt(0).toUpperCase() + queryName.slice(1);
1261
- return `${modelNameCapitalized}${queryNameCapitalized}Schema`;
1262
- }
1263
- wrapWithZodUnion(zodStringFields) {
1264
- let wrapped = "";
1265
- wrapped += "z.union([";
1266
- wrapped += "\n";
1267
- wrapped += " " + zodStringFields.join(",");
1268
- wrapped += "\n";
1269
- wrapped += "])";
1270
- return wrapped;
1271
- }
1272
- wrapWithZodObject(zodStringFields) {
1273
- let wrapped = "";
1274
- wrapped += "z.object({";
1275
- wrapped += "\n";
1276
- wrapped += " " + zodStringFields;
1277
- wrapped += "\n";
1278
- wrapped += "})";
1279
- return wrapped;
1280
- }
1281
- resolveObjectSchemaName() {
1282
- let name = this.name;
1283
- let exportName = this.name;
1284
- if ((0, helpers_1.isMongodbRawOp)(name)) {
1285
- name = Transformer2.rawOpsMap[name];
1286
- exportName = name.replace("Args", "");
1287
- }
1288
- return exportName;
1289
- }
1290
- async generateModelSchemas() {
1291
- for (const modelOperation of this.modelOperations) {
1292
- const {
1293
- model: modelName,
1294
- findUnique,
1295
- findFirst,
1296
- findMany,
1297
- // @ts-ignore
1298
- createOne,
1299
- createMany,
1300
- // @ts-ignore
1301
- deleteOne,
1302
- // @ts-ignore
1303
- updateOne,
1304
- deleteMany,
1305
- updateMany,
1306
- // @ts-ignore
1307
- upsertOne,
1308
- aggregate,
1309
- groupBy
1310
- } = modelOperation;
1311
- const model = (0, helpers_1.findModelByName)(this.models, modelName);
1312
- const { selectImport, includeImport, selectZodSchemaLine, includeZodSchemaLine, selectZodSchemaLineLazy, includeZodSchemaLineLazy } = this.resolveSelectIncludeImportAndZodSchemaLine(model);
1313
- const { orderByImport, orderByZodSchemaLine } = this.resolveOrderByWithRelationImportAndZodSchemaLine(model);
1314
- if (findUnique) {
1315
- const imports = [
1316
- selectImport,
1317
- includeImport,
1318
- `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`
1319
- ];
1320
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/${findUnique}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}FindUnique`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} where: ${modelName}WhereUniqueInputObjectSchema })`)}`);
1321
- }
1322
- if (findFirst) {
1323
- const imports = [
1324
- selectImport,
1325
- includeImport,
1326
- orderByImport,
1327
- `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`,
1328
- `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`,
1329
- `import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`
1330
- ];
1331
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/${findFirst}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}FindFirst`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} ${orderByZodSchemaLine} where: ${modelName}WhereInputObjectSchema.optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.array(${modelName}ScalarFieldEnumSchema).optional() })`)}`);
1332
- }
1333
- if (findMany) {
1334
- const imports = [
1335
- selectImport,
1336
- includeImport,
1337
- orderByImport,
1338
- `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`,
1339
- `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`,
1340
- `import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`
1341
- ];
1342
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/${findMany}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}FindMany`, `z.object({ ${selectZodSchemaLineLazy} ${includeZodSchemaLineLazy} ${orderByZodSchemaLine} where: ${modelName}WhereInputObjectSchema.optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.array(${modelName}ScalarFieldEnumSchema).optional() })`)}`);
1343
- }
1344
- if (createOne) {
1345
- const imports = [
1346
- selectImport,
1347
- includeImport,
1348
- `import { ${modelName}CreateInputObjectSchema } from './objects/${modelName}CreateInput.schema'`,
1349
- `import { ${modelName}UncheckedCreateInputObjectSchema } from './objects/${modelName}UncheckedCreateInput.schema'`
1350
- ];
1351
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/${createOne}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}CreateOne`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} data: z.union([${modelName}CreateInputObjectSchema, ${modelName}UncheckedCreateInputObjectSchema]) })`)}`);
1352
- }
1353
- if (createMany) {
1354
- const imports = [
1355
- `import { ${modelName}CreateManyInputObjectSchema } from './objects/${modelName}CreateManyInput.schema'`
1356
- ];
1357
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/${createMany}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}CreateMany`, `z.object({ data: z.union([ ${modelName}CreateManyInputObjectSchema, z.array(${modelName}CreateManyInputObjectSchema) ]), ${Transformer2.provider === "mongodb" || Transformer2.provider === "sqlserver" ? "" : "skipDuplicates: z.boolean().optional()"} })`)}`);
1358
- }
1359
- if (deleteOne) {
1360
- const imports = [
1361
- selectImport,
1362
- includeImport,
1363
- `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`
1364
- ];
1365
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/${deleteOne}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}DeleteOne`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} where: ${modelName}WhereUniqueInputObjectSchema })`)}`);
1366
- }
1367
- if (deleteMany) {
1368
- const imports = [
1369
- `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`
1370
- ];
1371
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/${deleteMany}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}DeleteMany`, `z.object({ where: ${modelName}WhereInputObjectSchema.optional() })`)}`);
1372
- }
1373
- if (updateOne) {
1374
- const imports = [
1375
- selectImport,
1376
- includeImport,
1377
- `import { ${modelName}UpdateInputObjectSchema } from './objects/${modelName}UpdateInput.schema'`,
1378
- `import { ${modelName}UncheckedUpdateInputObjectSchema } from './objects/${modelName}UncheckedUpdateInput.schema'`,
1379
- `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`
1380
- ];
1381
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/${updateOne}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}UpdateOne`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} data: z.union([${modelName}UpdateInputObjectSchema, ${modelName}UncheckedUpdateInputObjectSchema]), where: ${modelName}WhereUniqueInputObjectSchema })`)}`);
1382
- }
1383
- if (updateMany) {
1384
- const imports = [
1385
- `import { ${modelName}UpdateManyMutationInputObjectSchema } from './objects/${modelName}UpdateManyMutationInput.schema'`,
1386
- `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`
1387
- ];
1388
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/${updateMany}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}UpdateMany`, `z.object({ data: ${modelName}UpdateManyMutationInputObjectSchema, where: ${modelName}WhereInputObjectSchema.optional() })`)}`);
1389
- }
1390
- if (upsertOne) {
1391
- const imports = [
1392
- selectImport,
1393
- includeImport,
1394
- `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`,
1395
- `import { ${modelName}CreateInputObjectSchema } from './objects/${modelName}CreateInput.schema'`,
1396
- `import { ${modelName}UncheckedCreateInputObjectSchema } from './objects/${modelName}UncheckedCreateInput.schema'`,
1397
- `import { ${modelName}UpdateInputObjectSchema } from './objects/${modelName}UpdateInput.schema'`,
1398
- `import { ${modelName}UncheckedUpdateInputObjectSchema } from './objects/${modelName}UncheckedUpdateInput.schema'`
1399
- ];
1400
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/${upsertOne}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}Upsert`, `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} where: ${modelName}WhereUniqueInputObjectSchema, create: z.union([ ${modelName}CreateInputObjectSchema, ${modelName}UncheckedCreateInputObjectSchema ]), update: z.union([ ${modelName}UpdateInputObjectSchema, ${modelName}UncheckedUpdateInputObjectSchema ]) })`)}`);
1401
- }
1402
- if (aggregate) {
1403
- const imports = [
1404
- orderByImport,
1405
- `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`,
1406
- `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`
1407
- ];
1408
- const aggregateOperations = [];
1409
- if (this.aggregateOperationSupport[modelName].count) {
1410
- imports.push(`import { ${modelName}CountAggregateInputObjectSchema } from './objects/${modelName}CountAggregateInput.schema'`);
1411
- aggregateOperations.push(`_count: z.union([ z.literal(true), ${modelName}CountAggregateInputObjectSchema ]).optional()`);
1412
- }
1413
- if (this.aggregateOperationSupport[modelName].min) {
1414
- imports.push(`import { ${modelName}MinAggregateInputObjectSchema } from './objects/${modelName}MinAggregateInput.schema'`);
1415
- aggregateOperations.push(`_min: ${modelName}MinAggregateInputObjectSchema.optional()`);
1416
- }
1417
- if (this.aggregateOperationSupport[modelName].max) {
1418
- imports.push(`import { ${modelName}MaxAggregateInputObjectSchema } from './objects/${modelName}MaxAggregateInput.schema'`);
1419
- aggregateOperations.push(`_max: ${modelName}MaxAggregateInputObjectSchema.optional()`);
1420
- }
1421
- if (this.aggregateOperationSupport[modelName].avg) {
1422
- imports.push(`import { ${modelName}AvgAggregateInputObjectSchema } from './objects/${modelName}AvgAggregateInput.schema'`);
1423
- aggregateOperations.push(`_avg: ${modelName}AvgAggregateInputObjectSchema.optional()`);
1424
- }
1425
- if (this.aggregateOperationSupport[modelName].sum) {
1426
- imports.push(`import { ${modelName}SumAggregateInputObjectSchema } from './objects/${modelName}SumAggregateInput.schema'`);
1427
- aggregateOperations.push(`_sum: ${modelName}SumAggregateInputObjectSchema.optional()`);
1428
- }
1429
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/${aggregate}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}Aggregate`, `z.object({ ${orderByZodSchemaLine} where: ${modelName}WhereInputObjectSchema.optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), ${aggregateOperations.join(", ")} })`)}`);
1430
- }
1431
- if (groupBy) {
1432
- const imports = [
1433
- `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`,
1434
- `import { ${modelName}OrderByWithAggregationInputObjectSchema } from './objects/${modelName}OrderByWithAggregationInput.schema'`,
1435
- `import { ${modelName}ScalarWhereWithAggregatesInputObjectSchema } from './objects/${modelName}ScalarWhereWithAggregatesInput.schema'`,
1436
- `import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`
1437
- ];
1438
- await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer2.outputPath, `schemas/${groupBy}.schema.ts`), `${this.generateImportStatements(imports)}${this.generateExportSchemaStatement(`${modelName}GroupBy`, `z.object({ where: ${modelName}WhereInputObjectSchema.optional(), orderBy: z.union([${modelName}OrderByWithAggregationInputObjectSchema, ${modelName}OrderByWithAggregationInputObjectSchema.array()]).optional(), having: ${modelName}ScalarWhereWithAggregatesInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), by: z.array(${modelName}ScalarFieldEnumSchema) })`)}`);
1439
- }
1440
- }
1441
- }
1442
- generateImportStatements(imports) {
1443
- var _a;
1444
- let generatedImports = this.generateImportZodStatement();
1445
- generatedImports += (_a = imports === null || imports === void 0 ? void 0 : imports.filter((importItem) => !!importItem).join(";\r\n")) !== null && _a !== void 0 ? _a : "";
1446
- generatedImports += "\n\n";
1447
- return generatedImports;
1448
- }
1449
- resolveSelectIncludeImportAndZodSchemaLine(model) {
1450
- const { name: modelName } = model;
1451
- const hasRelationToAnotherModel = (0, helpers_1.checkModelHasModelRelation)(model);
1452
- const selectImport = Transformer2.isGenerateSelect ? `import { ${modelName}SelectObjectSchema } from './objects/${modelName}Select.schema'` : "";
1453
- const includeImport = Transformer2.isGenerateInclude && hasRelationToAnotherModel ? `import { ${modelName}IncludeObjectSchema } from './objects/${modelName}Include.schema'` : "";
1454
- let selectZodSchemaLine = "";
1455
- let includeZodSchemaLine = "";
1456
- let selectZodSchemaLineLazy = "";
1457
- let includeZodSchemaLineLazy = "";
1458
- if (Transformer2.isGenerateSelect) {
1459
- const zodSelectObjectSchema = `${modelName}SelectObjectSchema.optional()`;
1460
- selectZodSchemaLine = `select: ${zodSelectObjectSchema},`;
1461
- selectZodSchemaLineLazy = `select: z.lazy(() => ${zodSelectObjectSchema}),`;
1462
- }
1463
- if (Transformer2.isGenerateInclude && hasRelationToAnotherModel) {
1464
- const zodIncludeObjectSchema = `${modelName}IncludeObjectSchema.optional()`;
1465
- includeZodSchemaLine = `include: ${zodIncludeObjectSchema},`;
1466
- includeZodSchemaLineLazy = `include: z.lazy(() => ${zodIncludeObjectSchema}),`;
1467
- }
1468
- return {
1469
- selectImport,
1470
- includeImport,
1471
- selectZodSchemaLine,
1472
- includeZodSchemaLine,
1473
- selectZodSchemaLineLazy,
1474
- includeZodSchemaLineLazy
1475
- };
1476
- }
1477
- resolveOrderByWithRelationImportAndZodSchemaLine(model) {
1478
- var _a;
1479
- const { name: modelName } = model;
1480
- let modelOrderBy = "";
1481
- if ([
1482
- "postgresql",
1483
- "mysql"
1484
- ].includes(Transformer2.provider) && ((_a = Transformer2.previewFeatures) === null || _a === void 0 ? void 0 : _a.includes("fullTextSearch"))) {
1485
- modelOrderBy = `${modelName}OrderByWithRelationAndSearchRelevanceInput`;
1486
- } else {
1487
- modelOrderBy = `${modelName}OrderByWithRelationInput`;
1488
- }
1489
- const orderByImport = `import { ${modelOrderBy}ObjectSchema } from './objects/${modelOrderBy}.schema'`;
1490
- const orderByZodSchemaLine = `orderBy: z.union([${modelOrderBy}ObjectSchema, ${modelOrderBy}ObjectSchema.array()]).optional(),`;
1491
- return {
1492
- orderByImport,
1493
- orderByZodSchemaLine
1494
- };
1495
- }
1496
- };
1497
- exports2.default = Transformer;
1498
- Transformer.enumNames = [];
1499
- Transformer.rawOpsMap = {};
1500
- Transformer.outputPath = "./generated";
1501
- Transformer.prismaClientOutputPath = "@prisma/client";
1502
- Transformer.isCustomPrismaClientOutputPath = false;
1503
- Transformer.isGenerateSelect = false;
1504
- Transformer.isGenerateInclude = false;
1505
- }
1506
- });
1507
-
1508
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/model-helpers.js
1509
- var require_model_helpers = __commonJS({
1510
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/model-helpers.js"(exports2) {
1511
- "use strict";
1512
- init_cjs_shims();
1513
- Object.defineProperty(exports2, "__esModule", {
1514
- value: true
1515
- });
1516
- exports2.findModelByName = exports2.checkIsManyModelRelationField = exports2.checkIsModelRelationField = exports2.checkModelHasManyModelRelation = exports2.checkModelHasModelRelation = void 0;
1517
- function checkModelHasModelRelation(model) {
1518
- const { fields: modelFields } = model;
1519
- for (const modelField of modelFields) {
1520
- const isRelationField = checkIsModelRelationField(modelField);
1521
- if (isRelationField) {
1522
- return true;
1523
- }
1524
- }
1525
- return false;
1526
- }
1527
- __name(checkModelHasModelRelation, "checkModelHasModelRelation");
1528
- exports2.checkModelHasModelRelation = checkModelHasModelRelation;
1529
- function checkModelHasManyModelRelation(model) {
1530
- const { fields: modelFields } = model;
1531
- for (const modelField of modelFields) {
1532
- const isManyRelationField = checkIsManyModelRelationField(modelField);
1533
- if (isManyRelationField) {
1534
- return true;
1535
- }
1536
- }
1537
- return false;
1538
- }
1539
- __name(checkModelHasManyModelRelation, "checkModelHasManyModelRelation");
1540
- exports2.checkModelHasManyModelRelation = checkModelHasManyModelRelation;
1541
- function checkIsModelRelationField(modelField) {
1542
- const { kind, relationName } = modelField;
1543
- return kind === "object" && !!relationName;
1544
- }
1545
- __name(checkIsModelRelationField, "checkIsModelRelationField");
1546
- exports2.checkIsModelRelationField = checkIsModelRelationField;
1547
- function checkIsManyModelRelationField(modelField) {
1548
- return checkIsModelRelationField(modelField) && modelField.isList;
1549
- }
1550
- __name(checkIsManyModelRelationField, "checkIsManyModelRelationField");
1551
- exports2.checkIsManyModelRelationField = checkIsManyModelRelationField;
1552
- function findModelByName(models, modelName) {
1553
- return models.find(({ name }) => name === modelName);
1554
- }
1555
- __name(findModelByName, "findModelByName");
1556
- exports2.findModelByName = findModelByName;
1557
- }
1558
- });
1559
-
1560
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/include-helpers.js
1561
- var require_include_helpers = __commonJS({
1562
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/include-helpers.js"(exports2) {
1563
- "use strict";
1564
- init_cjs_shims();
1565
- Object.defineProperty(exports2, "__esModule", {
1566
- value: true
1567
- });
1568
- exports2.addMissingInputObjectTypesForInclude = void 0;
1569
- var model_helpers_1 = require_model_helpers();
1570
- function addMissingInputObjectTypesForInclude(inputObjectTypes, models, isGenerateSelect) {
1571
- const generatedIncludeInputObjectTypes = generateModelIncludeInputObjectTypes(models, isGenerateSelect);
1572
- for (const includeInputObjectType of generatedIncludeInputObjectTypes) {
1573
- inputObjectTypes.push(includeInputObjectType);
1574
- }
1575
- }
1576
- __name(addMissingInputObjectTypesForInclude, "addMissingInputObjectTypesForInclude");
1577
- exports2.addMissingInputObjectTypesForInclude = addMissingInputObjectTypesForInclude;
1578
- function generateModelIncludeInputObjectTypes(models, isGenerateSelect) {
1579
- const modelIncludeInputObjectTypes = [];
1580
- for (const model of models) {
1581
- const { name: modelName, fields: modelFields } = model;
1582
- const fields = [];
1583
- for (const modelField of modelFields) {
1584
- const { name: modelFieldName, isList, type } = modelField;
1585
- const isRelationField = (0, model_helpers_1.checkIsModelRelationField)(modelField);
1586
- if (isRelationField) {
1587
- const field = {
1588
- name: modelFieldName,
1589
- isRequired: false,
1590
- isNullable: false,
1591
- inputTypes: [
1592
- {
1593
- isList: false,
1594
- type: "Boolean",
1595
- location: "scalar"
1596
- },
1597
- {
1598
- isList: false,
1599
- type: isList ? `${type}FindManyArgs` : `${type}Args`,
1600
- location: "inputObjectTypes",
1601
- namespace: "prisma"
1602
- }
1603
- ]
1604
- };
1605
- fields.push(field);
1606
- }
1607
- }
1608
- const hasRelationToAnotherModel = (0, model_helpers_1.checkModelHasModelRelation)(model);
1609
- if (!hasRelationToAnotherModel) {
1610
- continue;
1611
- }
1612
- const hasManyRelationToAnotherModel = (0, model_helpers_1.checkModelHasManyModelRelation)(model);
1613
- const shouldAddCountField = hasManyRelationToAnotherModel;
1614
- if (shouldAddCountField) {
1615
- const inputTypes = [
1616
- {
1617
- isList: false,
1618
- type: "Boolean",
1619
- location: "scalar"
1620
- }
1621
- ];
1622
- if (isGenerateSelect) {
1623
- inputTypes.push({
1624
- isList: false,
1625
- type: `${modelName}CountOutputTypeArgs`,
1626
- location: "inputObjectTypes",
1627
- namespace: "prisma"
1628
- });
1629
- }
1630
- const _countField = {
1631
- name: "_count",
1632
- isRequired: false,
1633
- isNullable: false,
1634
- inputTypes
1635
- };
1636
- fields.push(_countField);
1637
- }
1638
- const modelIncludeInputObjectType = {
1639
- name: `${modelName}Include`,
1640
- constraints: {
1641
- maxNumFields: null,
1642
- minNumFields: null
1643
- },
1644
- fields
1645
- };
1646
- modelIncludeInputObjectTypes.push(modelIncludeInputObjectType);
1647
- }
1648
- return modelIncludeInputObjectTypes;
1649
- }
1650
- __name(generateModelIncludeInputObjectTypes, "generateModelIncludeInputObjectTypes");
1651
- }
1652
- });
1653
-
1654
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/modelArgs-helpers.js
1655
- var require_modelArgs_helpers = __commonJS({
1656
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/modelArgs-helpers.js"(exports2) {
1657
- "use strict";
1658
- init_cjs_shims();
1659
- Object.defineProperty(exports2, "__esModule", {
1660
- value: true
1661
- });
1662
- exports2.addMissingInputObjectTypesForModelArgs = void 0;
1663
- var model_helpers_1 = require_model_helpers();
1664
- function addMissingInputObjectTypesForModelArgs(inputObjectTypes, models, isGenerateSelect, isGenerateInclude) {
1665
- const modelArgsInputObjectTypes = generateModelArgsInputObjectTypes(models, isGenerateSelect, isGenerateInclude);
1666
- for (const modelArgsInputObjectType of modelArgsInputObjectTypes) {
1667
- inputObjectTypes.push(modelArgsInputObjectType);
1668
- }
1669
- }
1670
- __name(addMissingInputObjectTypesForModelArgs, "addMissingInputObjectTypesForModelArgs");
1671
- exports2.addMissingInputObjectTypesForModelArgs = addMissingInputObjectTypesForModelArgs;
1672
- function generateModelArgsInputObjectTypes(models, isGenerateSelect, isGenerateInclude) {
1673
- const modelArgsInputObjectTypes = [];
1674
- for (const model of models) {
1675
- const { name: modelName } = model;
1676
- const fields = [];
1677
- if (isGenerateSelect) {
1678
- const selectField = {
1679
- name: "select",
1680
- isRequired: false,
1681
- isNullable: false,
1682
- inputTypes: [
1683
- {
1684
- isList: false,
1685
- type: `${modelName}Select`,
1686
- location: "inputObjectTypes",
1687
- namespace: "prisma"
1688
- }
1689
- ]
1690
- };
1691
- fields.push(selectField);
1692
- }
1693
- const hasRelationToAnotherModel = (0, model_helpers_1.checkModelHasModelRelation)(model);
1694
- if (isGenerateInclude && hasRelationToAnotherModel) {
1695
- const includeField = {
1696
- name: "include",
1697
- isRequired: false,
1698
- isNullable: false,
1699
- inputTypes: [
1700
- {
1701
- isList: false,
1702
- type: `${modelName}Include`,
1703
- location: "inputObjectTypes",
1704
- namespace: "prisma"
1705
- }
1706
- ]
1707
- };
1708
- fields.push(includeField);
1709
- }
1710
- const modelArgsInputObjectType = {
1711
- name: `${modelName}Args`,
1712
- constraints: {
1713
- maxNumFields: null,
1714
- minNumFields: null
1715
- },
1716
- fields
1717
- };
1718
- modelArgsInputObjectTypes.push(modelArgsInputObjectType);
1719
- }
1720
- return modelArgsInputObjectTypes;
1721
- }
1722
- __name(generateModelArgsInputObjectTypes, "generateModelArgsInputObjectTypes");
1723
- }
1724
- });
1725
-
1726
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/mongodb-helpers.js
1727
- var require_mongodb_helpers = __commonJS({
1728
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/mongodb-helpers.js"(exports2) {
1729
- "use strict";
1730
- init_cjs_shims();
1731
- var __importDefault = exports2 && exports2.__importDefault || function(mod) {
1732
- return mod && mod.__esModule ? mod : {
1733
- "default": mod
1734
- };
1735
- };
1736
- Object.defineProperty(exports2, "__esModule", {
1737
- value: true
1738
- });
1739
- exports2.isMongodbRawOp = exports2.addMissingInputObjectTypesForMongoDbRawOpsAndQueries = void 0;
1740
- var transformer_1 = __importDefault(require_transformer());
1741
- function addMissingInputObjectTypesForMongoDbRawOpsAndQueries(modelOperations, outputObjectTypes, inputObjectTypes) {
1742
- const rawOpsMap = resolveMongoDbRawOperations(modelOperations);
1743
- transformer_1.default.rawOpsMap = rawOpsMap !== null && rawOpsMap !== void 0 ? rawOpsMap : {};
1744
- const mongoDbRawQueryInputObjectTypes = resolveMongoDbRawQueryInputObjectTypes(outputObjectTypes);
1745
- for (const mongoDbRawQueryInputType of mongoDbRawQueryInputObjectTypes) {
1746
- inputObjectTypes.push(mongoDbRawQueryInputType);
1747
- }
1748
- }
1749
- __name(addMissingInputObjectTypesForMongoDbRawOpsAndQueries, "addMissingInputObjectTypesForMongoDbRawOpsAndQueries");
1750
- exports2.addMissingInputObjectTypesForMongoDbRawOpsAndQueries = addMissingInputObjectTypesForMongoDbRawOpsAndQueries;
1751
- function resolveMongoDbRawOperations(modelOperations) {
1752
- const rawOpsMap = {};
1753
- const rawOpsNames = [
1754
- ...new Set(modelOperations.reduce((result, current) => {
1755
- const keys = Object.keys(current);
1756
- keys === null || keys === void 0 ? void 0 : keys.forEach((key) => {
1757
- if (key.includes("Raw")) {
1758
- result.push(key);
1759
- }
1760
- });
1761
- return result;
1762
- }, []))
1763
- ];
1764
- const modelNames = modelOperations.map((item) => item.model);
1765
- rawOpsNames.forEach((opName) => {
1766
- modelNames.forEach((modelName) => {
1767
- const isFind = opName === "findRaw";
1768
- const opWithModel = `${opName.replace("Raw", "")}${modelName}Raw`;
1769
- rawOpsMap[opWithModel] = isFind ? `${modelName}FindRawArgs` : `${modelName}AggregateRawArgs`;
1770
- });
1771
- });
1772
- return rawOpsMap;
1773
- }
1774
- __name(resolveMongoDbRawOperations, "resolveMongoDbRawOperations");
1775
- function resolveMongoDbRawQueryInputObjectTypes(outputObjectTypes) {
1776
- const mongoDbRawQueries = getMongoDbRawQueries(outputObjectTypes);
1777
- const mongoDbRawQueryInputObjectTypes = mongoDbRawQueries.map((item) => ({
1778
- name: item.name,
1779
- constraints: {
1780
- maxNumFields: null,
1781
- minNumFields: null
1782
- },
1783
- fields: item.args.map((arg) => ({
1784
- name: arg.name,
1785
- isRequired: arg.isRequired,
1786
- isNullable: arg.isNullable,
1787
- inputTypes: arg.inputTypes
1788
- }))
1789
- }));
1790
- return mongoDbRawQueryInputObjectTypes;
1791
- }
1792
- __name(resolveMongoDbRawQueryInputObjectTypes, "resolveMongoDbRawQueryInputObjectTypes");
1793
- function getMongoDbRawQueries(outputObjectTypes) {
1794
- var _a;
1795
- const queryOutputTypes = outputObjectTypes.filter((item) => item.name === "Query");
1796
- const mongodbRawQueries = (_a = queryOutputTypes === null || queryOutputTypes === void 0 ? void 0 : queryOutputTypes[0].fields.filter((field) => field.name.includes("Raw"))) !== null && _a !== void 0 ? _a : [];
1797
- return mongodbRawQueries;
1798
- }
1799
- __name(getMongoDbRawQueries, "getMongoDbRawQueries");
1800
- var isMongodbRawOp = /* @__PURE__ */ __name((name) => /find([^]*?)Raw/.test(name) || /aggregate([^]*?)Raw/.test(name), "isMongodbRawOp");
1801
- exports2.isMongodbRawOp = isMongodbRawOp;
1802
- }
1803
- });
1804
-
1805
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/select-helpers.js
1806
- var require_select_helpers = __commonJS({
1807
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/select-helpers.js"(exports2) {
1808
- "use strict";
1809
- init_cjs_shims();
1810
- Object.defineProperty(exports2, "__esModule", {
1811
- value: true
1812
- });
1813
- exports2.addMissingInputObjectTypesForSelect = void 0;
1814
- var model_helpers_1 = require_model_helpers();
1815
- function addMissingInputObjectTypesForSelect(inputObjectTypes, outputObjectTypes, models) {
1816
- const modelCountOutputTypes = getModelCountOutputTypes(outputObjectTypes);
1817
- const modelCountOutputTypeSelectInputObjectTypes = generateModelCountOutputTypeSelectInputObjectTypes(modelCountOutputTypes);
1818
- const modelCountOutputTypeArgsInputObjectTypes = generateModelCountOutputTypeArgsInputObjectTypes(modelCountOutputTypes);
1819
- const modelSelectInputObjectTypes = generateModelSelectInputObjectTypes(models);
1820
- const generatedInputObjectTypes = [
1821
- modelCountOutputTypeSelectInputObjectTypes,
1822
- modelCountOutputTypeArgsInputObjectTypes,
1823
- modelSelectInputObjectTypes
1824
- ].flat();
1825
- for (const inputObjectType of generatedInputObjectTypes) {
1826
- inputObjectTypes.push(inputObjectType);
1827
- }
1828
- }
1829
- __name(addMissingInputObjectTypesForSelect, "addMissingInputObjectTypesForSelect");
1830
- exports2.addMissingInputObjectTypesForSelect = addMissingInputObjectTypesForSelect;
1831
- function getModelCountOutputTypes(outputObjectTypes) {
1832
- return outputObjectTypes.filter(({ name }) => name.includes("CountOutputType"));
1833
- }
1834
- __name(getModelCountOutputTypes, "getModelCountOutputTypes");
1835
- function generateModelCountOutputTypeSelectInputObjectTypes(modelCountOutputTypes) {
1836
- const modelCountOutputTypeSelectInputObjectTypes = [];
1837
- for (const modelCountOutputType of modelCountOutputTypes) {
1838
- const { name: modelCountOutputTypeName, fields: modelCountOutputTypeFields } = modelCountOutputType;
1839
- const modelCountOutputTypeSelectInputObjectType = {
1840
- name: `${modelCountOutputTypeName}Select`,
1841
- constraints: {
1842
- maxNumFields: null,
1843
- minNumFields: null
1844
- },
1845
- fields: modelCountOutputTypeFields.map(({ name }) => ({
1846
- name,
1847
- isRequired: false,
1848
- isNullable: false,
1849
- inputTypes: [
1850
- {
1851
- isList: false,
1852
- type: `Boolean`,
1853
- location: "scalar"
1854
- }
1855
- ]
1856
- }))
1857
- };
1858
- modelCountOutputTypeSelectInputObjectTypes.push(modelCountOutputTypeSelectInputObjectType);
1859
- }
1860
- return modelCountOutputTypeSelectInputObjectTypes;
1861
- }
1862
- __name(generateModelCountOutputTypeSelectInputObjectTypes, "generateModelCountOutputTypeSelectInputObjectTypes");
1863
- function generateModelCountOutputTypeArgsInputObjectTypes(modelCountOutputTypes) {
1864
- const modelCountOutputTypeArgsInputObjectTypes = [];
1865
- for (const modelCountOutputType of modelCountOutputTypes) {
1866
- const { name: modelCountOutputTypeName } = modelCountOutputType;
1867
- const modelCountOutputTypeArgsInputObjectType = {
1868
- name: `${modelCountOutputTypeName}Args`,
1869
- constraints: {
1870
- maxNumFields: null,
1871
- minNumFields: null
1872
- },
1873
- fields: [
1874
- {
1875
- name: "select",
1876
- isRequired: false,
1877
- isNullable: false,
1878
- inputTypes: [
1879
- {
1880
- isList: false,
1881
- type: `${modelCountOutputTypeName}Select`,
1882
- location: "inputObjectTypes",
1883
- namespace: "prisma"
1884
- }
1885
- ]
1886
- }
1887
- ]
1888
- };
1889
- modelCountOutputTypeArgsInputObjectTypes.push(modelCountOutputTypeArgsInputObjectType);
1890
- }
1891
- return modelCountOutputTypeArgsInputObjectTypes;
1892
- }
1893
- __name(generateModelCountOutputTypeArgsInputObjectTypes, "generateModelCountOutputTypeArgsInputObjectTypes");
1894
- function generateModelSelectInputObjectTypes(models) {
1895
- const modelSelectInputObjectTypes = [];
1896
- for (const model of models) {
1897
- const { name: modelName, fields: modelFields } = model;
1898
- const fields = [];
1899
- for (const modelField of modelFields) {
1900
- const { name: modelFieldName, isList, type } = modelField;
1901
- const isRelationField = (0, model_helpers_1.checkIsModelRelationField)(modelField);
1902
- const field = {
1903
- name: modelFieldName,
1904
- isRequired: false,
1905
- isNullable: false,
1906
- inputTypes: [
1907
- {
1908
- isList: false,
1909
- type: "Boolean",
1910
- location: "scalar"
1911
- }
1912
- ]
1913
- };
1914
- if (isRelationField) {
1915
- let schemaArgInputType = {
1916
- isList: false,
1917
- type: isList ? `${type}FindManyArgs` : `${type}Args`,
1918
- location: "inputObjectTypes",
1919
- namespace: "prisma"
1920
- };
1921
- field.inputTypes.push(schemaArgInputType);
1922
- }
1923
- fields.push(field);
1924
- }
1925
- const hasManyRelationToAnotherModel = (0, model_helpers_1.checkModelHasManyModelRelation)(model);
1926
- const shouldAddCountField = hasManyRelationToAnotherModel;
1927
- if (shouldAddCountField) {
1928
- const _countField = {
1929
- name: "_count",
1930
- isRequired: false,
1931
- isNullable: false,
1932
- inputTypes: [
1933
- {
1934
- isList: false,
1935
- type: "Boolean",
1936
- location: "scalar"
1937
- },
1938
- {
1939
- isList: false,
1940
- type: `${modelName}CountOutputTypeArgs`,
1941
- location: "inputObjectTypes",
1942
- namespace: "prisma"
1943
- }
1944
- ]
1945
- };
1946
- fields.push(_countField);
1947
- }
1948
- const modelSelectInputObjectType = {
1949
- name: `${modelName}Select`,
1950
- constraints: {
1951
- maxNumFields: null,
1952
- minNumFields: null
1953
- },
1954
- fields
1955
- };
1956
- modelSelectInputObjectTypes.push(modelSelectInputObjectType);
1957
- }
1958
- return modelSelectInputObjectTypes;
1959
- }
1960
- __name(generateModelSelectInputObjectTypes, "generateModelSelectInputObjectTypes");
1961
- }
1962
- });
1963
-
1964
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/whereUniqueInput-helpers.js
1965
- var require_whereUniqueInput_helpers = __commonJS({
1966
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/whereUniqueInput-helpers.js"(exports2) {
1967
- "use strict";
1968
- init_cjs_shims();
1969
- Object.defineProperty(exports2, "__esModule", {
1970
- value: true
1971
- });
1972
- exports2.changeOptionalToRequiredFields = void 0;
1973
- function changeOptionalToRequiredFields(inputObjectTypes) {
1974
- inputObjectTypes.map((item) => {
1975
- var _a;
1976
- if (item.name.includes("WhereUniqueInput") && ((_a = item.constraints.fields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1977
- item.fields = item.fields.map((subItem) => {
1978
- var _a2;
1979
- if ((_a2 = item.constraints.fields) === null || _a2 === void 0 ? void 0 : _a2.includes(subItem.name)) {
1980
- subItem.isRequired = true;
1981
- return subItem;
1982
- }
1983
- return subItem;
1984
- });
1985
- }
1986
- return item;
1987
- });
1988
- }
1989
- __name(changeOptionalToRequiredFields, "changeOptionalToRequiredFields");
1990
- exports2.changeOptionalToRequiredFields = changeOptionalToRequiredFields;
1991
- }
1992
- });
1993
-
1994
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/helpers.js
1995
- var require_helpers = __commonJS({
1996
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/helpers.js"(exports2) {
1997
- "use strict";
1998
- init_cjs_shims();
1999
- var __importDefault = exports2 && exports2.__importDefault || function(mod) {
2000
- return mod && mod.__esModule ? mod : {
2001
- "default": mod
2002
- };
2003
- };
2004
- Object.defineProperty(exports2, "__esModule", {
2005
- value: true
2006
- });
2007
- exports2.resolveAddMissingInputObjectTypeOptions = exports2.addMissingInputObjectTypes = void 0;
2008
- var transformer_1 = __importDefault(require_transformer());
2009
- var aggregate_helpers_1 = require_aggregate_helpers();
2010
- var include_helpers_1 = require_include_helpers();
2011
- var modelArgs_helpers_1 = require_modelArgs_helpers();
2012
- var mongodb_helpers_1 = require_mongodb_helpers();
2013
- var select_helpers_1 = require_select_helpers();
2014
- var whereUniqueInput_helpers_1 = require_whereUniqueInput_helpers();
2015
- function addMissingInputObjectTypes(inputObjectTypes, outputObjectTypes, models, modelOperations, dataSourceProvider, options) {
2016
- if (dataSourceProvider === "mongodb") {
2017
- (0, mongodb_helpers_1.addMissingInputObjectTypesForMongoDbRawOpsAndQueries)(modelOperations, outputObjectTypes, inputObjectTypes);
2018
- }
2019
- (0, aggregate_helpers_1.addMissingInputObjectTypesForAggregate)(inputObjectTypes, outputObjectTypes);
2020
- if (options.isGenerateSelect) {
2021
- (0, select_helpers_1.addMissingInputObjectTypesForSelect)(inputObjectTypes, outputObjectTypes, models);
2022
- transformer_1.default.setIsGenerateSelect(true);
2023
- }
2024
- if (options.isGenerateSelect || options.isGenerateInclude) {
2025
- (0, modelArgs_helpers_1.addMissingInputObjectTypesForModelArgs)(inputObjectTypes, models, options.isGenerateSelect, options.isGenerateInclude);
2026
- }
2027
- if (options.isGenerateInclude) {
2028
- (0, include_helpers_1.addMissingInputObjectTypesForInclude)(inputObjectTypes, models, options.isGenerateSelect);
2029
- transformer_1.default.setIsGenerateInclude(true);
2030
- }
2031
- (0, whereUniqueInput_helpers_1.changeOptionalToRequiredFields)(inputObjectTypes);
2032
- }
2033
- __name(addMissingInputObjectTypes, "addMissingInputObjectTypes");
2034
- exports2.addMissingInputObjectTypes = addMissingInputObjectTypes;
2035
- function resolveAddMissingInputObjectTypeOptions(generatorConfigOptions) {
2036
- return {
2037
- isGenerateSelect: generatorConfigOptions.isGenerateSelect === "true",
2038
- isGenerateInclude: generatorConfigOptions.isGenerateInclude === "true"
2039
- };
2040
- }
2041
- __name(resolveAddMissingInputObjectTypeOptions, "resolveAddMissingInputObjectTypeOptions");
2042
- exports2.resolveAddMissingInputObjectTypeOptions = resolveAddMissingInputObjectTypeOptions;
2043
- }
2044
- });
2045
-
2046
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/index.js
2047
- var require_helpers2 = __commonJS({
2048
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/helpers/index.js"(exports2) {
2049
- "use strict";
2050
- init_cjs_shims();
2051
- var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
2052
- if (k2 === void 0) k2 = k;
2053
- var desc = Object.getOwnPropertyDescriptor(m, k);
2054
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2055
- desc = {
2056
- enumerable: true,
2057
- get: /* @__PURE__ */ __name(function() {
2058
- return m[k];
2059
- }, "get")
2060
- };
2061
- }
2062
- Object.defineProperty(o, k2, desc);
2063
- } : function(o, m, k, k2) {
2064
- if (k2 === void 0) k2 = k;
2065
- o[k2] = m[k];
2066
- });
2067
- var __exportStar = exports2 && exports2.__exportStar || function(m, exports1) {
2068
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports1, p)) __createBinding(exports1, m, p);
2069
- };
2070
- Object.defineProperty(exports2, "__esModule", {
2071
- value: true
2072
- });
2073
- __exportStar(require_comments_helpers(), exports2);
2074
- __exportStar(require_helpers(), exports2);
2075
- __exportStar(require_model_helpers(), exports2);
2076
- __exportStar(require_mongodb_helpers(), exports2);
2077
- __exportStar(require_whereUniqueInput_helpers(), exports2);
2078
- }
2079
- });
2080
-
2081
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/utils/removeDir.js
2082
- var require_removeDir = __commonJS({
2083
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/utils/removeDir.js"(exports2) {
2084
- "use strict";
2085
- init_cjs_shims();
2086
- var __importDefault = exports2 && exports2.__importDefault || function(mod) {
2087
- return mod && mod.__esModule ? mod : {
2088
- "default": mod
2089
- };
2090
- };
2091
- Object.defineProperty(exports2, "__esModule", {
2092
- value: true
2093
- });
2094
- var path_1 = __importDefault(require("path"));
2095
- var fs_1 = require("fs");
2096
- async function removeDir2(dirPath, onlyContent) {
2097
- const dirEntries = await fs_1.promises.readdir(dirPath, {
2098
- withFileTypes: true
2099
- });
2100
- await Promise.all(dirEntries.map(async (dirEntry) => {
2101
- const fullPath = path_1.default.join(dirPath, dirEntry.name);
2102
- return dirEntry.isDirectory() ? await removeDir2(fullPath, false) : await fs_1.promises.unlink(fullPath);
2103
- }));
2104
- if (!onlyContent) {
2105
- await fs_1.promises.rmdir(dirPath);
2106
- }
2107
- }
2108
- __name(removeDir2, "removeDir");
2109
- exports2.default = removeDir2;
2110
- }
2111
- });
2112
-
2113
- // ../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/prisma-generator.js
2114
- var require_prisma_generator = __commonJS({
2115
- "../../node_modules/.pnpm/prisma-zod-generator@0.8.13/node_modules/prisma-zod-generator/lib/prisma-generator.js"(exports2) {
2116
- "use strict";
2117
- init_cjs_shims();
2118
- var __importDefault = exports2 && exports2.__importDefault || function(mod) {
2119
- return mod && mod.__esModule ? mod : {
2120
- "default": mod
2121
- };
2122
- };
2123
- Object.defineProperty(exports2, "__esModule", {
2124
- value: true
2125
- });
2126
- exports2.generate = void 0;
2127
- var internals_1 = require("@prisma/internals");
2128
- var fs_1 = require("fs");
2129
- var helpers_1 = require_helpers2();
2130
- var aggregate_helpers_1 = require_aggregate_helpers();
2131
- var transformer_1 = __importDefault(require_transformer());
2132
- var removeDir_1 = __importDefault(require_removeDir());
2133
- async function generate2(options) {
2134
- var _a, _b;
2135
- try {
2136
- await handleGeneratorOutputValue(options.generator.output);
2137
- const prismaClientGeneratorConfig = getGeneratorConfigByProvider(options.otherGenerators, "prisma-client-js");
2138
- const prismaClientDmmf = await (0, internals_1.getDMMF)({
2139
- datamodel: options.datamodel,
2140
- previewFeatures: prismaClientGeneratorConfig === null || prismaClientGeneratorConfig === void 0 ? void 0 : prismaClientGeneratorConfig.previewFeatures
2141
- });
2142
- checkForCustomPrismaClientOutputPath(prismaClientGeneratorConfig);
2143
- const modelOperations = prismaClientDmmf.mappings.modelOperations;
2144
- const inputObjectTypes = prismaClientDmmf.schema.inputObjectTypes.prisma;
2145
- const outputObjectTypes = prismaClientDmmf.schema.outputObjectTypes.prisma;
2146
- const enumTypes = prismaClientDmmf.schema.enumTypes;
2147
- const models = prismaClientDmmf.datamodel.models;
2148
- const hiddenModels = [];
2149
- const hiddenFields = [];
2150
- (0, helpers_1.resolveModelsComments)(models, modelOperations, enumTypes, hiddenModels, hiddenFields);
2151
- await generateEnumSchemas(prismaClientDmmf.schema.enumTypes.prisma, (_a = prismaClientDmmf.schema.enumTypes.model) !== null && _a !== void 0 ? _a : []);
2152
- const dataSource = (_b = options.datasources) === null || _b === void 0 ? void 0 : _b[0];
2153
- const previewFeatures = prismaClientGeneratorConfig === null || prismaClientGeneratorConfig === void 0 ? void 0 : prismaClientGeneratorConfig.previewFeatures;
2154
- transformer_1.default.provider = dataSource.provider;
2155
- transformer_1.default.previewFeatures = previewFeatures;
2156
- const generatorConfigOptions = options.generator.config;
2157
- const addMissingInputObjectTypeOptions = (0, helpers_1.resolveAddMissingInputObjectTypeOptions)(generatorConfigOptions);
2158
- (0, helpers_1.addMissingInputObjectTypes)(inputObjectTypes, outputObjectTypes, models, modelOperations, dataSource.provider, addMissingInputObjectTypeOptions);
2159
- const aggregateOperationSupport = (0, aggregate_helpers_1.resolveAggregateOperationSupport)(inputObjectTypes);
2160
- (0, helpers_1.hideInputObjectTypesAndRelatedFields)(inputObjectTypes, hiddenModels, hiddenFields);
2161
- await generateObjectSchemas(inputObjectTypes);
2162
- await generateModelSchemas(models, modelOperations, aggregateOperationSupport);
2163
- await generateIndex();
2164
- } catch (error) {
2165
- console.error(error);
2166
- }
2167
- }
2168
- __name(generate2, "generate");
2169
- exports2.generate = generate2;
2170
- async function handleGeneratorOutputValue(generatorOutputValue) {
2171
- const outputDirectoryPath = (0, internals_1.parseEnvValue)(generatorOutputValue);
2172
- await fs_1.promises.mkdir(outputDirectoryPath, {
2173
- recursive: true
2174
- });
2175
- const isRemoveContentsOnly = true;
2176
- await (0, removeDir_1.default)(outputDirectoryPath, isRemoveContentsOnly);
2177
- transformer_1.default.setOutputPath(outputDirectoryPath);
2178
- }
2179
- __name(handleGeneratorOutputValue, "handleGeneratorOutputValue");
2180
- function getGeneratorConfigByProvider(generators, provider2) {
2181
- return generators.find((it) => (0, internals_1.parseEnvValue)(it.provider) === provider2);
2182
- }
2183
- __name(getGeneratorConfigByProvider, "getGeneratorConfigByProvider");
2184
- function checkForCustomPrismaClientOutputPath(prismaClientGeneratorConfig) {
2185
- var _a;
2186
- if (prismaClientGeneratorConfig === null || prismaClientGeneratorConfig === void 0 ? void 0 : prismaClientGeneratorConfig.isCustomOutput) {
2187
- transformer_1.default.setPrismaClientOutputPath((_a = prismaClientGeneratorConfig.output) === null || _a === void 0 ? void 0 : _a.value);
2188
- }
2189
- }
2190
- __name(checkForCustomPrismaClientOutputPath, "checkForCustomPrismaClientOutputPath");
2191
- async function generateEnumSchemas(prismaSchemaEnum, modelSchemaEnum) {
2192
- const enumTypes = [
2193
- ...prismaSchemaEnum,
2194
- ...modelSchemaEnum
2195
- ];
2196
- const enumNames = enumTypes.map((enumItem) => enumItem.name);
2197
- transformer_1.default.enumNames = enumNames !== null && enumNames !== void 0 ? enumNames : [];
2198
- const transformer = new transformer_1.default({
2199
- enumTypes
2200
- });
2201
- await transformer.generateEnumSchemas();
2202
- }
2203
- __name(generateEnumSchemas, "generateEnumSchemas");
2204
- async function generateObjectSchemas(inputObjectTypes) {
2205
- var _a, _b;
2206
- for (let i = 0; i < inputObjectTypes.length; i += 1) {
2207
- const fields = (_a = inputObjectTypes[i]) === null || _a === void 0 ? void 0 : _a.fields;
2208
- const name = (_b = inputObjectTypes[i]) === null || _b === void 0 ? void 0 : _b.name;
2209
- const transformer = new transformer_1.default({
2210
- name,
2211
- fields
2212
- });
2213
- await transformer.generateObjectSchema();
2214
- }
2215
- }
2216
- __name(generateObjectSchemas, "generateObjectSchemas");
2217
- async function generateModelSchemas(models, modelOperations, aggregateOperationSupport) {
2218
- const transformer = new transformer_1.default({
2219
- models,
2220
- modelOperations,
2221
- aggregateOperationSupport
2222
- });
2223
- await transformer.generateModelSchemas();
2224
- }
2225
- __name(generateModelSchemas, "generateModelSchemas");
2226
- async function generateIndex() {
2227
- await transformer_1.default.generateIndex();
2228
- }
2229
- __name(generateIndex, "generateIndex");
2230
- }
2231
- });
2232
-
2233
671
  // ../../node_modules/.pnpm/@dotenvx+dotenvx@1.35.0/node_modules/@dotenvx/dotenvx/package.json
2234
672
  var require_package = __commonJS({
2235
673
  "../../node_modules/.pnpm/@dotenvx+dotenvx@1.35.0/node_modules/@dotenvx/dotenvx/package.json"(exports2, module2) {
@@ -3875,9 +2313,9 @@ var require_parse = __commonJS({
3875
2313
  "../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/lib/parse.js"(exports2, module2) {
3876
2314
  "use strict";
3877
2315
  init_cjs_shims();
3878
- var constants2 = require_constants();
2316
+ var constants = require_constants();
3879
2317
  var utils = require_utils2();
3880
- var { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants2;
2318
+ var { MAX_LENGTH, POSIX_REGEX_SOURCE, REGEX_NON_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_BACKREF, REPLACEMENTS } = constants;
3881
2319
  var expandRange = /* @__PURE__ */ __name((args, options) => {
3882
2320
  if (typeof options.expandRange === "function") {
3883
2321
  return options.expandRange(...args, options);
@@ -3916,8 +2354,8 @@ var require_parse = __commonJS({
3916
2354
  bos
3917
2355
  ];
3918
2356
  const capture = opts.capture ? "" : "?:";
3919
- const PLATFORM_CHARS = constants2.globChars(opts.windows);
3920
- const EXTGLOB_CHARS = constants2.extglobChars(PLATFORM_CHARS);
2357
+ const PLATFORM_CHARS = constants.globChars(opts.windows);
2358
+ const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
3921
2359
  const { DOT_LITERAL, PLUS_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK, QMARK_NO_DOT, STAR, START_ANCHOR } = PLATFORM_CHARS;
3922
2360
  const globstar = /* @__PURE__ */ __name((opts2) => {
3923
2361
  return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
@@ -4707,7 +3145,7 @@ var require_parse = __commonJS({
4707
3145
  throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
4708
3146
  }
4709
3147
  input = REPLACEMENTS[input] || input;
4710
- const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants2.globChars(opts.windows);
3148
+ const { DOT_LITERAL, SLASH_LITERAL, ONE_CHAR, DOTS_SLASH, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR } = constants.globChars(opts.windows);
4711
3149
  const nodot = opts.dot ? NO_DOTS : NO_DOT;
4712
3150
  const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
4713
3151
  const capture = opts.capture ? "" : "?:";
@@ -4769,7 +3207,7 @@ var require_picomatch = __commonJS({
4769
3207
  var scan = require_scan();
4770
3208
  var parse5 = require_parse();
4771
3209
  var utils = require_utils2();
4772
- var constants2 = require_constants();
3210
+ var constants = require_constants();
4773
3211
  var isObject2 = /* @__PURE__ */ __name((val) => val && typeof val === "object" && !Array.isArray(val), "isObject");
4774
3212
  var picomatch = /* @__PURE__ */ __name((glob, options, returnState = false) => {
4775
3213
  if (Array.isArray(glob)) {
@@ -4927,7 +3365,7 @@ var require_picomatch = __commonJS({
4927
3365
  return /$^/;
4928
3366
  }
4929
3367
  };
4930
- picomatch.constants = constants2;
3368
+ picomatch.constants = constants;
4931
3369
  module2.exports = picomatch;
4932
3370
  }
4933
3371
  });
@@ -6080,7 +4518,7 @@ var require_cryptoNode = __commonJS({
6080
4518
  value: true
6081
4519
  });
6082
4520
  exports2.crypto = void 0;
6083
- var nc = require("crypto");
4521
+ var nc = require("node:crypto");
6084
4522
  exports2.crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
6085
4523
  }
6086
4524
  });
@@ -6270,7 +4708,7 @@ var require_cryptoNode2 = __commonJS({
6270
4708
  value: true
6271
4709
  });
6272
4710
  exports2.crypto = void 0;
6273
- var nc = require("crypto");
4711
+ var nc = require("node:crypto");
6274
4712
  exports2.crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
6275
4713
  }
6276
4714
  });
@@ -10862,7 +9300,7 @@ var require_compat = __commonJS({
10862
9300
  });
10863
9301
  exports2._compat = void 0;
10864
9302
  var utils_1 = require_utils3();
10865
- var node_crypto_1 = require("crypto");
9303
+ var node_crypto_1 = require("node:crypto");
10866
9304
  var AEAD_TAG_LENGTH = 16;
10867
9305
  var IS_DENO = globalThis.Deno !== void 0;
10868
9306
  var _compat = /* @__PURE__ */ __name(function(algorithm, key, nonce, AAD) {
@@ -11038,14 +9476,14 @@ var require_node2 = __commonJS({
11038
9476
  if (nonce.length !== 24) {
11039
9477
  throw new Error("xchacha20's nonce must be 24 bytes");
11040
9478
  }
11041
- var constants2 = new Uint32Array([
9479
+ var constants = new Uint32Array([
11042
9480
  1634760805,
11043
9481
  857760878,
11044
9482
  2036477234,
11045
9483
  1797285236
11046
9484
  ]);
11047
9485
  var subKey = new Uint32Array(8);
11048
- (0, hchacha_1._hchacha20)(constants2, (0, utils_1.u32)(key), (0, utils_1.u32)(nonce.subarray(0, 16)), subKey);
9486
+ (0, hchacha_1._hchacha20)(constants, (0, utils_1.u32)(key), (0, utils_1.u32)(nonce.subarray(0, 16)), subKey);
11049
9487
  var subNonce = new Uint8Array(12);
11050
9488
  subNonce.set([
11051
9489
  0,
@@ -15712,10 +14150,9 @@ init_cjs_shims();
15712
14150
 
15713
14151
  // src/prisma-generator.ts
15714
14152
  init_cjs_shims();
15715
- var import_node_fs8 = require("fs");
15716
- var import_node_path7 = __toESM(require("path"), 1);
14153
+ var import_node_fs6 = require("node:fs");
14154
+ var import_node_path7 = __toESM(require("node:path"), 1);
15717
14155
  var import_pluralize = __toESM(require_pluralize(), 1);
15718
- var import_prisma_generator = __toESM(require_prisma_generator(), 1);
15719
14156
 
15720
14157
  // src/config.ts
15721
14158
  init_cjs_shims();
@@ -19977,7 +18414,10 @@ var configSchema = z.object({
19977
18414
  // src/helpers.ts
19978
18415
  init_cjs_shims();
19979
18416
 
19980
- // src/utils/getPrismaInternals.ts
18417
+ // src/utils/get-prisma-internals.ts
18418
+ init_cjs_shims();
18419
+
18420
+ // src/utils/get-jiti.ts
19981
18421
  init_cjs_shims();
19982
18422
 
19983
18423
  // ../env/src/index.ts
@@ -20434,8 +18874,8 @@ var isString = /* @__PURE__ */ __name((value) => {
20434
18874
  }, "isString");
20435
18875
 
20436
18876
  // ../env/src/get-env-paths.ts
20437
- var import_node_os = __toESM(require("os"), 1);
20438
- var import_node_path = __toESM(require("path"), 1);
18877
+ var import_node_os = __toESM(require("node:os"), 1);
18878
+ var import_node_path = __toESM(require("node:path"), 1);
20439
18879
  var homedir = import_node_os.default.homedir();
20440
18880
  var tmpdir = import_node_os.default.tmpdir();
20441
18881
  var macos = /* @__PURE__ */ __name((orgId) => {
@@ -22779,10 +21219,6 @@ StormJSON.instance.registerCustom({
22779
21219
  // ../type-checks/src/is-error.ts
22780
21220
  init_cjs_shims();
22781
21221
 
22782
- // ../fs/src/read-file.ts
22783
- var import_node_fs = require("fs");
22784
- var import_promises = require("fs/promises");
22785
-
22786
21222
  // ../json/src/index.ts
22787
21223
  init_cjs_shims();
22788
21224
 
@@ -22845,15 +21281,15 @@ init_cjs_shims();
22845
21281
 
22846
21282
  // ../path/src/is-file.ts
22847
21283
  init_cjs_shims();
22848
- var import_node_fs2 = require("fs");
21284
+ var import_node_fs = require("node:fs");
22849
21285
  function isFile(path7, additionalPath) {
22850
- return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path7) : path7, {
21286
+ return Boolean((0, import_node_fs.statSync)(additionalPath ? joinPaths(additionalPath, path7) : path7, {
22851
21287
  throwIfNoEntry: false
22852
21288
  })?.isFile());
22853
21289
  }
22854
21290
  __name(isFile, "isFile");
22855
21291
  function isDirectory(path7, additionalPath) {
22856
- return Boolean((0, import_node_fs2.statSync)(additionalPath ? joinPaths(additionalPath, path7) : path7, {
21292
+ return Boolean((0, import_node_fs.statSync)(additionalPath ? joinPaths(additionalPath, path7) : path7, {
22857
21293
  throwIfNoEntry: false
22858
21294
  })?.isDirectory());
22859
21295
  }
@@ -22939,8 +21375,6 @@ init_cjs_shims();
22939
21375
 
22940
21376
  // ../path/src/exists.ts
22941
21377
  init_cjs_shims();
22942
- var import_node_fs3 = require("fs");
22943
- var import_promises2 = require("fs/promises");
22944
21378
 
22945
21379
  // ../path/src/file-path-fns.ts
22946
21380
  init_cjs_shims();
@@ -22970,16 +21404,16 @@ var __name2 = /* @__PURE__ */ __name((target, value) => __defProp2(target, "name
22970
21404
  }), "__name");
22971
21405
 
22972
21406
  // ../../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
22973
- var import_node_fs4 = require("fs");
22974
- var import_node_path2 = require("path");
21407
+ var import_node_fs2 = require("node:fs");
21408
+ var import_node_path2 = require("node:path");
22975
21409
  var MAX_PATH_SEARCH_DEPTH = 30;
22976
21410
  var depth = 0;
22977
21411
  function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
22978
21412
  const _startPath = startPath ?? process.cwd();
22979
- if (endDirectoryNames.some((endDirName) => (0, import_node_fs4.existsSync)((0, import_node_path2.join)(_startPath, endDirName)))) {
21413
+ if (endDirectoryNames.some((endDirName) => (0, import_node_fs2.existsSync)((0, import_node_path2.join)(_startPath, endDirName)))) {
22980
21414
  return _startPath;
22981
21415
  }
22982
- if (endFileNames.some((endFileName) => (0, import_node_fs4.existsSync)((0, import_node_path2.join)(_startPath, endFileName)))) {
21416
+ if (endFileNames.some((endFileName) => (0, import_node_fs2.existsSync)((0, import_node_path2.join)(_startPath, endFileName)))) {
22983
21417
  return _startPath;
22984
21418
  }
22985
21419
  if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
@@ -23347,7 +21781,7 @@ __name(detectRuntime, "detectRuntime");
23347
21781
  var runtimeInfo = detectRuntime();
23348
21782
  var runtime = runtimeInfo?.name || "";
23349
21783
 
23350
- // src/utils/getPrismaInternals.ts
21784
+ // src/utils/get-jiti.ts
23351
21785
  var import_jiti = require("jiti");
23352
21786
  var jiti;
23353
21787
  function getJiti() {
@@ -23361,6 +21795,8 @@ function getJiti() {
23361
21795
  return jiti;
23362
21796
  }
23363
21797
  __name(getJiti, "getJiti");
21798
+
21799
+ // src/utils/get-prisma-internals.ts
23364
21800
  async function getPrismaInternals() {
23365
21801
  return getJiti().import(getJiti().esmResolve("@prisma/internals"));
23366
21802
  }
@@ -23370,9 +21806,9 @@ async function getPrismaGeneratorHelper() {
23370
21806
  }
23371
21807
  __name(getPrismaGeneratorHelper, "getPrismaGeneratorHelper");
23372
21808
 
23373
- // src/utils/getRelativePath.ts
21809
+ // src/utils/get-relative-path.ts
23374
21810
  init_cjs_shims();
23375
- var import_node_path3 = __toESM(require("path"), 1);
21811
+ var import_node_path3 = __toESM(require("node:path"), 1);
23376
21812
  function getRelativePath(outputPath, filePath, isOutsideOutputPath, schemaPath) {
23377
21813
  const fromPath = import_node_path3.default.join(outputPath, "routers", "helpers");
23378
21814
  let toPath = import_node_path3.default.join(outputPath, filePath);
@@ -23386,7 +21822,7 @@ function getRelativePath(outputPath, filePath, isOutsideOutputPath, schemaPath)
23386
21822
  }
23387
21823
  __name(getRelativePath, "getRelativePath");
23388
21824
 
23389
- // src/utils/uncapitalizeFirstLetter.ts
21825
+ // src/utils/uncapitalize-first-letter.ts
23390
21826
  init_cjs_shims();
23391
21827
  var uncapitalizeFirstLetter = /* @__PURE__ */ __name((str) => {
23392
21828
  return str.charAt(0).toLowerCase() + str.slice(1);
@@ -23748,33 +22184,33 @@ var constructShield = /* @__PURE__ */ __name(async ({ queries, mutations, subscr
23748
22184
 
23749
22185
  // src/prisma-shield-generator.ts
23750
22186
  init_cjs_shims();
23751
- var import_node_fs7 = require("fs");
23752
- var import_node_path6 = __toESM(require("path"), 1);
22187
+ var import_node_fs5 = require("node:fs");
22188
+ var import_node_path6 = __toESM(require("node:path"), 1);
23753
22189
 
23754
- // src/utils/removeDir.ts
22190
+ // src/utils/remove-dir.ts
23755
22191
  init_cjs_shims();
23756
- var import_node_fs5 = require("fs");
23757
- var import_node_path4 = __toESM(require("path"), 1);
22192
+ var import_node_fs3 = require("node:fs");
22193
+ var import_node_path4 = __toESM(require("node:path"), 1);
23758
22194
  async function removeDir(dirPath, onlyContent) {
23759
- const dirEntries = await import_node_fs5.promises.readdir(dirPath, {
22195
+ const dirEntries = await import_node_fs3.promises.readdir(dirPath, {
23760
22196
  withFileTypes: true
23761
22197
  });
23762
22198
  await Promise.all(dirEntries.map(async (dirEntry) => {
23763
22199
  const fullPath = import_node_path4.default.join(dirPath, dirEntry.name);
23764
- return dirEntry.isDirectory() ? removeDir(fullPath, false) : import_node_fs5.promises.unlink(fullPath);
22200
+ return dirEntry.isDirectory() ? removeDir(fullPath, false) : import_node_fs3.promises.unlink(fullPath);
23765
22201
  }));
23766
22202
  if (!onlyContent) {
23767
- await import_node_fs5.promises.rmdir(dirPath);
22203
+ await import_node_fs3.promises.rmdir(dirPath);
23768
22204
  }
23769
22205
  }
23770
22206
  __name(removeDir, "removeDir");
23771
22207
 
23772
- // src/utils/writeFileSafely.ts
22208
+ // src/utils/write-file-safely.ts
23773
22209
  init_cjs_shims();
23774
- var import_node_fs6 = __toESM(require("fs"), 1);
23775
- var import_node_path5 = __toESM(require("path"), 1);
22210
+ var import_node_fs4 = __toESM(require("node:fs"), 1);
22211
+ var import_node_path5 = __toESM(require("node:path"), 1);
23776
22212
 
23777
- // src/utils/formatFile.ts
22213
+ // src/utils/format-file.ts
23778
22214
  init_cjs_shims();
23779
22215
  var import_prettier = __toESM(require("prettier"), 1);
23780
22216
  async function formatFile(content) {
@@ -23799,12 +22235,12 @@ async function formatFile(content) {
23799
22235
  }
23800
22236
  __name(formatFile, "formatFile");
23801
22237
 
23802
- // src/utils/writeFileSafely.ts
22238
+ // src/utils/write-file-safely.ts
23803
22239
  var writeFileSafely = /* @__PURE__ */ __name(async (writeLocation, content) => {
23804
- import_node_fs6.default.mkdirSync(import_node_path5.default.dirname(writeLocation), {
22240
+ import_node_fs4.default.mkdirSync(import_node_path5.default.dirname(writeLocation), {
23805
22241
  recursive: true
23806
22242
  });
23807
- import_node_fs6.default.writeFileSync(writeLocation, await formatFile(content));
22243
+ import_node_fs4.default.writeFileSync(writeLocation, await formatFile(content));
23808
22244
  }, "writeFileSafely");
23809
22245
 
23810
22246
  // src/prisma-shield-generator.ts
@@ -23814,7 +22250,7 @@ async function generateShield(options) {
23814
22250
  const results = configSchema.safeParse(options.generator.config);
23815
22251
  if (!results.success) throw new Error("Invalid options passed");
23816
22252
  const config = results.data;
23817
- await import_node_fs7.promises.mkdir(outputDir, {
22253
+ await import_node_fs5.promises.mkdir(outputDir, {
23818
22254
  recursive: true
23819
22255
  });
23820
22256
  await removeDir(outputDir, true);
@@ -23885,12 +22321,13 @@ async function generate(options) {
23885
22321
  const results = configSchema.safeParse(options.generator.config);
23886
22322
  if (!results.success) throw new Error("Invalid options passed");
23887
22323
  const config = results.data;
23888
- await import_node_fs8.promises.mkdir(outputDir, {
22324
+ await import_node_fs6.promises.mkdir(outputDir, {
23889
22325
  recursive: true
23890
22326
  });
23891
22327
  await removeDir(outputDir, true);
23892
22328
  if (config.withZod !== false) {
23893
- await (0, import_prisma_generator.generate)(options);
22329
+ const prismaZodGenerator = await getJiti().import(getJiti().esmResolve("prisma-zod-generator/lib/prisma-generator"));
22330
+ await prismaZodGenerator.generate(options);
23894
22331
  }
23895
22332
  if (config.withShield !== false) {
23896
22333
  const shieldOutputPath = import_node_path7.default.join(outputDir, "./shield");
@@ -23899,6 +22336,7 @@ async function generate(options) {
23899
22336
  generator: {
23900
22337
  ...options.generator,
23901
22338
  output: {
22339
+ fromEnvVar: null,
23902
22340
  ...options.generator.output,
23903
22341
  value: shieldOutputPath
23904
22342
  },