@stryke/prisma-trpc-generator 0.10.0 → 0.10.1
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 +5 -9
- package/dist/generator.js +5 -9
- package/dist/index.cjs +5 -9
- package/dist/index.js +5 -9
- package/package.json +1 -1
package/dist/generator.cjs
CHANGED
|
@@ -10705,7 +10705,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10705
10705
|
if (lines.length === 0) {
|
|
10706
10706
|
return [];
|
|
10707
10707
|
}
|
|
10708
|
-
let alternatives = lines.reduce((result, inputType) => {
|
|
10708
|
+
let alternatives = lines.slice(0, 1).reduce((result, inputType) => {
|
|
10709
10709
|
if (inputType.type === "String") {
|
|
10710
10710
|
result.push(this.wrapWithZodValidators("z.string()", field));
|
|
10711
10711
|
} else if (inputType.type === "Int" || inputType.type === "Float" || inputType.type === "Decimal") {
|
|
@@ -10729,7 +10729,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10729
10729
|
if (inputType.type !== this.name && typeof inputType.type === "string") {
|
|
10730
10730
|
this.addSchemaImport(inputType.type);
|
|
10731
10731
|
}
|
|
10732
|
-
result.push(this.generatePrismaStringLine(field, lines.length));
|
|
10732
|
+
result.push(this.generatePrismaStringLine(field, inputType, lines.length));
|
|
10733
10733
|
}
|
|
10734
10734
|
}
|
|
10735
10735
|
return result;
|
|
@@ -10768,11 +10768,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10768
10768
|
addSchemaImport(name) {
|
|
10769
10769
|
this.schemaImports.add(name);
|
|
10770
10770
|
}
|
|
10771
|
-
generatePrismaStringLine(field, inputsLength) {
|
|
10772
|
-
if (field.inputTypes.length === 0 || !field.inputTypes[0]) {
|
|
10773
|
-
return "";
|
|
10774
|
-
}
|
|
10775
|
-
const inputType = field.inputTypes[0];
|
|
10771
|
+
generatePrismaStringLine(field, inputType, inputsLength) {
|
|
10776
10772
|
const isEnum = inputType.location === "enumTypes";
|
|
10777
10773
|
const inputTypeString = inputType.type;
|
|
10778
10774
|
const { isModelQueryType, modelName, queryName } = this.checkIsModelQueryType(inputTypeString);
|
|
@@ -10898,8 +10894,8 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10898
10894
|
};
|
|
10899
10895
|
}
|
|
10900
10896
|
resolveModelQuerySchemaName(modelName, queryName) {
|
|
10901
|
-
const modelNameCapitalized =
|
|
10902
|
-
const queryNameCapitalized =
|
|
10897
|
+
const modelNameCapitalized = upperCaseFirst(modelName);
|
|
10898
|
+
const queryNameCapitalized = upperCaseFirst(queryName);
|
|
10903
10899
|
return `${modelNameCapitalized}${queryNameCapitalized}Schema`;
|
|
10904
10900
|
}
|
|
10905
10901
|
wrapWithZodUnion(zodStringFields) {
|
package/dist/generator.js
CHANGED
|
@@ -10710,7 +10710,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10710
10710
|
if (lines.length === 0) {
|
|
10711
10711
|
return [];
|
|
10712
10712
|
}
|
|
10713
|
-
let alternatives = lines.reduce((result, inputType) => {
|
|
10713
|
+
let alternatives = lines.slice(0, 1).reduce((result, inputType) => {
|
|
10714
10714
|
if (inputType.type === "String") {
|
|
10715
10715
|
result.push(this.wrapWithZodValidators("z.string()", field));
|
|
10716
10716
|
} else if (inputType.type === "Int" || inputType.type === "Float" || inputType.type === "Decimal") {
|
|
@@ -10734,7 +10734,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10734
10734
|
if (inputType.type !== this.name && typeof inputType.type === "string") {
|
|
10735
10735
|
this.addSchemaImport(inputType.type);
|
|
10736
10736
|
}
|
|
10737
|
-
result.push(this.generatePrismaStringLine(field, lines.length));
|
|
10737
|
+
result.push(this.generatePrismaStringLine(field, inputType, lines.length));
|
|
10738
10738
|
}
|
|
10739
10739
|
}
|
|
10740
10740
|
return result;
|
|
@@ -10773,11 +10773,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10773
10773
|
addSchemaImport(name) {
|
|
10774
10774
|
this.schemaImports.add(name);
|
|
10775
10775
|
}
|
|
10776
|
-
generatePrismaStringLine(field, inputsLength) {
|
|
10777
|
-
if (field.inputTypes.length === 0 || !field.inputTypes[0]) {
|
|
10778
|
-
return "";
|
|
10779
|
-
}
|
|
10780
|
-
const inputType = field.inputTypes[0];
|
|
10776
|
+
generatePrismaStringLine(field, inputType, inputsLength) {
|
|
10781
10777
|
const isEnum = inputType.location === "enumTypes";
|
|
10782
10778
|
const inputTypeString = inputType.type;
|
|
10783
10779
|
const { isModelQueryType, modelName, queryName } = this.checkIsModelQueryType(inputTypeString);
|
|
@@ -10903,8 +10899,8 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10903
10899
|
};
|
|
10904
10900
|
}
|
|
10905
10901
|
resolveModelQuerySchemaName(modelName, queryName) {
|
|
10906
|
-
const modelNameCapitalized =
|
|
10907
|
-
const queryNameCapitalized =
|
|
10902
|
+
const modelNameCapitalized = upperCaseFirst(modelName);
|
|
10903
|
+
const queryNameCapitalized = upperCaseFirst(queryName);
|
|
10908
10904
|
return `${modelNameCapitalized}${queryNameCapitalized}Schema`;
|
|
10909
10905
|
}
|
|
10910
10906
|
wrapWithZodUnion(zodStringFields) {
|
package/dist/index.cjs
CHANGED
|
@@ -10701,7 +10701,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10701
10701
|
if (lines.length === 0) {
|
|
10702
10702
|
return [];
|
|
10703
10703
|
}
|
|
10704
|
-
let alternatives = lines.reduce((result, inputType) => {
|
|
10704
|
+
let alternatives = lines.slice(0, 1).reduce((result, inputType) => {
|
|
10705
10705
|
if (inputType.type === "String") {
|
|
10706
10706
|
result.push(this.wrapWithZodValidators("z.string()", field));
|
|
10707
10707
|
} else if (inputType.type === "Int" || inputType.type === "Float" || inputType.type === "Decimal") {
|
|
@@ -10725,7 +10725,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10725
10725
|
if (inputType.type !== this.name && typeof inputType.type === "string") {
|
|
10726
10726
|
this.addSchemaImport(inputType.type);
|
|
10727
10727
|
}
|
|
10728
|
-
result.push(this.generatePrismaStringLine(field, lines.length));
|
|
10728
|
+
result.push(this.generatePrismaStringLine(field, inputType, lines.length));
|
|
10729
10729
|
}
|
|
10730
10730
|
}
|
|
10731
10731
|
return result;
|
|
@@ -10764,11 +10764,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10764
10764
|
addSchemaImport(name) {
|
|
10765
10765
|
this.schemaImports.add(name);
|
|
10766
10766
|
}
|
|
10767
|
-
generatePrismaStringLine(field, inputsLength) {
|
|
10768
|
-
if (field.inputTypes.length === 0 || !field.inputTypes[0]) {
|
|
10769
|
-
return "";
|
|
10770
|
-
}
|
|
10771
|
-
const inputType = field.inputTypes[0];
|
|
10767
|
+
generatePrismaStringLine(field, inputType, inputsLength) {
|
|
10772
10768
|
const isEnum = inputType.location === "enumTypes";
|
|
10773
10769
|
const inputTypeString = inputType.type;
|
|
10774
10770
|
const { isModelQueryType, modelName, queryName } = this.checkIsModelQueryType(inputTypeString);
|
|
@@ -10894,8 +10890,8 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10894
10890
|
};
|
|
10895
10891
|
}
|
|
10896
10892
|
resolveModelQuerySchemaName(modelName, queryName) {
|
|
10897
|
-
const modelNameCapitalized =
|
|
10898
|
-
const queryNameCapitalized =
|
|
10893
|
+
const modelNameCapitalized = upperCaseFirst(modelName);
|
|
10894
|
+
const queryNameCapitalized = upperCaseFirst(queryName);
|
|
10899
10895
|
return `${modelNameCapitalized}${queryNameCapitalized}Schema`;
|
|
10900
10896
|
}
|
|
10901
10897
|
wrapWithZodUnion(zodStringFields) {
|
package/dist/index.js
CHANGED
|
@@ -10706,7 +10706,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10706
10706
|
if (lines.length === 0) {
|
|
10707
10707
|
return [];
|
|
10708
10708
|
}
|
|
10709
|
-
let alternatives = lines.reduce((result, inputType) => {
|
|
10709
|
+
let alternatives = lines.slice(0, 1).reduce((result, inputType) => {
|
|
10710
10710
|
if (inputType.type === "String") {
|
|
10711
10711
|
result.push(this.wrapWithZodValidators("z.string()", field));
|
|
10712
10712
|
} else if (inputType.type === "Int" || inputType.type === "Float" || inputType.type === "Decimal") {
|
|
@@ -10730,7 +10730,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10730
10730
|
if (inputType.type !== this.name && typeof inputType.type === "string") {
|
|
10731
10731
|
this.addSchemaImport(inputType.type);
|
|
10732
10732
|
}
|
|
10733
|
-
result.push(this.generatePrismaStringLine(field, lines.length));
|
|
10733
|
+
result.push(this.generatePrismaStringLine(field, inputType, lines.length));
|
|
10734
10734
|
}
|
|
10735
10735
|
}
|
|
10736
10736
|
return result;
|
|
@@ -10769,11 +10769,7 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10769
10769
|
addSchemaImport(name) {
|
|
10770
10770
|
this.schemaImports.add(name);
|
|
10771
10771
|
}
|
|
10772
|
-
generatePrismaStringLine(field, inputsLength) {
|
|
10773
|
-
if (field.inputTypes.length === 0 || !field.inputTypes[0]) {
|
|
10774
|
-
return "";
|
|
10775
|
-
}
|
|
10776
|
-
const inputType = field.inputTypes[0];
|
|
10772
|
+
generatePrismaStringLine(field, inputType, inputsLength) {
|
|
10777
10773
|
const isEnum = inputType.location === "enumTypes";
|
|
10778
10774
|
const inputTypeString = inputType.type;
|
|
10779
10775
|
const { isModelQueryType, modelName, queryName } = this.checkIsModelQueryType(inputTypeString);
|
|
@@ -10899,8 +10895,8 @@ ${this.generateExportSchemaStatement(`${name}`, `z.enum(${JSON.stringify(values)
|
|
|
10899
10895
|
};
|
|
10900
10896
|
}
|
|
10901
10897
|
resolveModelQuerySchemaName(modelName, queryName) {
|
|
10902
|
-
const modelNameCapitalized =
|
|
10903
|
-
const queryNameCapitalized =
|
|
10898
|
+
const modelNameCapitalized = upperCaseFirst(modelName);
|
|
10899
|
+
const queryNameCapitalized = upperCaseFirst(queryName);
|
|
10904
10900
|
return `${modelNameCapitalized}${queryNameCapitalized}Schema`;
|
|
10905
10901
|
}
|
|
10906
10902
|
wrapWithZodUnion(zodStringFields) {
|