@stryke/prisma-trpc-generator 0.11.5 → 0.11.7
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 +7 -7
- package/dist/generator.js +7 -7
- package/dist/index.cjs +7 -7
- package/dist/index.js +7 -7
- package/package.json +1 -1
package/dist/generator.cjs
CHANGED
|
@@ -11013,7 +11013,7 @@ ${this.generateExportSchemaStatement(`${lowerCaseFirst(name)}`, `z.enum(${JSON.s
|
|
|
11013
11013
|
if (lines.length === 0) {
|
|
11014
11014
|
return [];
|
|
11015
11015
|
}
|
|
11016
|
-
let alternatives = lines.
|
|
11016
|
+
let alternatives = lines.reduce((result, inputType) => {
|
|
11017
11017
|
if (inputType.type === "String") {
|
|
11018
11018
|
result.push(this.wrapWithZodValidators("z.string()", field));
|
|
11019
11019
|
} else if (inputType.type === "Int" || inputType.type === "Float" || inputType.type === "Decimal") {
|
|
@@ -11085,7 +11085,7 @@ ${this.generateExportSchemaStatement(`${lowerCaseFirst(name)}`, `z.enum(${JSON.s
|
|
|
11085
11085
|
const schema = inputType.type === this.name ? objectSchemaLine : isEnum ? enumSchemaLine : objectSchemaLine;
|
|
11086
11086
|
const arr = inputType.isList ? ".array()" : "";
|
|
11087
11087
|
const opt = !field.isRequired ? ".optional()" : "";
|
|
11088
|
-
const nullable = field.inputTypes.
|
|
11088
|
+
const nullable = field.inputTypes.some((inputType2) => inputType2?.type === "Null") ? ".nullable()" : "";
|
|
11089
11089
|
return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}` : `z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}`;
|
|
11090
11090
|
}
|
|
11091
11091
|
generateFieldValidators(zodStringWithMainType, field) {
|
|
@@ -11528,7 +11528,7 @@ function generateModelIncludeInputObjectTypes(models, isGenerateSelect) {
|
|
|
11528
11528
|
},
|
|
11529
11529
|
{
|
|
11530
11530
|
isList: false,
|
|
11531
|
-
type: isList ? `${type}FindManyArgs` : `${type}
|
|
11531
|
+
type: isList ? `${type}FindManyArgs` : `${type}DefaultArgs`,
|
|
11532
11532
|
location: "inputObjectTypes",
|
|
11533
11533
|
namespace: "prisma"
|
|
11534
11534
|
}
|
|
@@ -11629,7 +11629,7 @@ function generateModelArgsInputObjectTypes(models, isGenerateSelect, isGenerateI
|
|
|
11629
11629
|
fields.push(includeField);
|
|
11630
11630
|
}
|
|
11631
11631
|
const modelArgsInputObjectType = {
|
|
11632
|
-
name: `${modelName}
|
|
11632
|
+
name: `${modelName}DefaultArgs`,
|
|
11633
11633
|
constraints: {
|
|
11634
11634
|
maxNumFields: null,
|
|
11635
11635
|
minNumFields: null
|
|
@@ -11696,7 +11696,7 @@ function generateModelCountOutputTypeArgsInputObjectTypes(modelCountOutputTypes)
|
|
|
11696
11696
|
for (const modelCountOutputType of modelCountOutputTypes) {
|
|
11697
11697
|
const { name: modelCountOutputTypeName } = modelCountOutputType;
|
|
11698
11698
|
const modelCountOutputTypeArgsInputObjectType = {
|
|
11699
|
-
name: `${modelCountOutputTypeName}
|
|
11699
|
+
name: `${modelCountOutputTypeName}CountArgs`,
|
|
11700
11700
|
constraints: {
|
|
11701
11701
|
maxNumFields: null,
|
|
11702
11702
|
minNumFields: null
|
|
@@ -11745,7 +11745,7 @@ function generateModelSelectInputObjectTypes(models) {
|
|
|
11745
11745
|
if (isRelationField) {
|
|
11746
11746
|
const schemaArgInputType = {
|
|
11747
11747
|
isList: false,
|
|
11748
|
-
type: isList ? `${type}FindManyArgs` : `${type}
|
|
11748
|
+
type: isList ? `${type}FindManyArgs` : `${type}DefaultArgs`,
|
|
11749
11749
|
location: "inputObjectTypes",
|
|
11750
11750
|
namespace: "prisma"
|
|
11751
11751
|
};
|
|
@@ -11768,7 +11768,7 @@ function generateModelSelectInputObjectTypes(models) {
|
|
|
11768
11768
|
},
|
|
11769
11769
|
{
|
|
11770
11770
|
isList: false,
|
|
11771
|
-
type: `${modelName}
|
|
11771
|
+
type: `${modelName}CountOutputTypeDefaultArgs`,
|
|
11772
11772
|
location: "inputObjectTypes",
|
|
11773
11773
|
namespace: "prisma"
|
|
11774
11774
|
}
|
package/dist/generator.js
CHANGED
|
@@ -11018,7 +11018,7 @@ ${this.generateExportSchemaStatement(`${lowerCaseFirst(name)}`, `z.enum(${JSON.s
|
|
|
11018
11018
|
if (lines.length === 0) {
|
|
11019
11019
|
return [];
|
|
11020
11020
|
}
|
|
11021
|
-
let alternatives = lines.
|
|
11021
|
+
let alternatives = lines.reduce((result, inputType) => {
|
|
11022
11022
|
if (inputType.type === "String") {
|
|
11023
11023
|
result.push(this.wrapWithZodValidators("z.string()", field));
|
|
11024
11024
|
} else if (inputType.type === "Int" || inputType.type === "Float" || inputType.type === "Decimal") {
|
|
@@ -11090,7 +11090,7 @@ ${this.generateExportSchemaStatement(`${lowerCaseFirst(name)}`, `z.enum(${JSON.s
|
|
|
11090
11090
|
const schema = inputType.type === this.name ? objectSchemaLine : isEnum ? enumSchemaLine : objectSchemaLine;
|
|
11091
11091
|
const arr = inputType.isList ? ".array()" : "";
|
|
11092
11092
|
const opt = !field.isRequired ? ".optional()" : "";
|
|
11093
|
-
const nullable = field.inputTypes.
|
|
11093
|
+
const nullable = field.inputTypes.some((inputType2) => inputType2?.type === "Null") ? ".nullable()" : "";
|
|
11094
11094
|
return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}` : `z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}`;
|
|
11095
11095
|
}
|
|
11096
11096
|
generateFieldValidators(zodStringWithMainType, field) {
|
|
@@ -11533,7 +11533,7 @@ function generateModelIncludeInputObjectTypes(models, isGenerateSelect) {
|
|
|
11533
11533
|
},
|
|
11534
11534
|
{
|
|
11535
11535
|
isList: false,
|
|
11536
|
-
type: isList ? `${type}FindManyArgs` : `${type}
|
|
11536
|
+
type: isList ? `${type}FindManyArgs` : `${type}DefaultArgs`,
|
|
11537
11537
|
location: "inputObjectTypes",
|
|
11538
11538
|
namespace: "prisma"
|
|
11539
11539
|
}
|
|
@@ -11634,7 +11634,7 @@ function generateModelArgsInputObjectTypes(models, isGenerateSelect, isGenerateI
|
|
|
11634
11634
|
fields.push(includeField);
|
|
11635
11635
|
}
|
|
11636
11636
|
const modelArgsInputObjectType = {
|
|
11637
|
-
name: `${modelName}
|
|
11637
|
+
name: `${modelName}DefaultArgs`,
|
|
11638
11638
|
constraints: {
|
|
11639
11639
|
maxNumFields: null,
|
|
11640
11640
|
minNumFields: null
|
|
@@ -11701,7 +11701,7 @@ function generateModelCountOutputTypeArgsInputObjectTypes(modelCountOutputTypes)
|
|
|
11701
11701
|
for (const modelCountOutputType of modelCountOutputTypes) {
|
|
11702
11702
|
const { name: modelCountOutputTypeName } = modelCountOutputType;
|
|
11703
11703
|
const modelCountOutputTypeArgsInputObjectType = {
|
|
11704
|
-
name: `${modelCountOutputTypeName}
|
|
11704
|
+
name: `${modelCountOutputTypeName}CountArgs`,
|
|
11705
11705
|
constraints: {
|
|
11706
11706
|
maxNumFields: null,
|
|
11707
11707
|
minNumFields: null
|
|
@@ -11750,7 +11750,7 @@ function generateModelSelectInputObjectTypes(models) {
|
|
|
11750
11750
|
if (isRelationField) {
|
|
11751
11751
|
const schemaArgInputType = {
|
|
11752
11752
|
isList: false,
|
|
11753
|
-
type: isList ? `${type}FindManyArgs` : `${type}
|
|
11753
|
+
type: isList ? `${type}FindManyArgs` : `${type}DefaultArgs`,
|
|
11754
11754
|
location: "inputObjectTypes",
|
|
11755
11755
|
namespace: "prisma"
|
|
11756
11756
|
};
|
|
@@ -11773,7 +11773,7 @@ function generateModelSelectInputObjectTypes(models) {
|
|
|
11773
11773
|
},
|
|
11774
11774
|
{
|
|
11775
11775
|
isList: false,
|
|
11776
|
-
type: `${modelName}
|
|
11776
|
+
type: `${modelName}CountOutputTypeDefaultArgs`,
|
|
11777
11777
|
location: "inputObjectTypes",
|
|
11778
11778
|
namespace: "prisma"
|
|
11779
11779
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -11009,7 +11009,7 @@ ${this.generateExportSchemaStatement(`${lowerCaseFirst(name)}`, `z.enum(${JSON.s
|
|
|
11009
11009
|
if (lines.length === 0) {
|
|
11010
11010
|
return [];
|
|
11011
11011
|
}
|
|
11012
|
-
let alternatives = lines.
|
|
11012
|
+
let alternatives = lines.reduce((result, inputType) => {
|
|
11013
11013
|
if (inputType.type === "String") {
|
|
11014
11014
|
result.push(this.wrapWithZodValidators("z.string()", field));
|
|
11015
11015
|
} else if (inputType.type === "Int" || inputType.type === "Float" || inputType.type === "Decimal") {
|
|
@@ -11081,7 +11081,7 @@ ${this.generateExportSchemaStatement(`${lowerCaseFirst(name)}`, `z.enum(${JSON.s
|
|
|
11081
11081
|
const schema = inputType.type === this.name ? objectSchemaLine : isEnum ? enumSchemaLine : objectSchemaLine;
|
|
11082
11082
|
const arr = inputType.isList ? ".array()" : "";
|
|
11083
11083
|
const opt = !field.isRequired ? ".optional()" : "";
|
|
11084
|
-
const nullable = field.inputTypes.
|
|
11084
|
+
const nullable = field.inputTypes.some((inputType2) => inputType2?.type === "Null") ? ".nullable()" : "";
|
|
11085
11085
|
return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}` : `z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}`;
|
|
11086
11086
|
}
|
|
11087
11087
|
generateFieldValidators(zodStringWithMainType, field) {
|
|
@@ -11524,7 +11524,7 @@ function generateModelIncludeInputObjectTypes(models, isGenerateSelect) {
|
|
|
11524
11524
|
},
|
|
11525
11525
|
{
|
|
11526
11526
|
isList: false,
|
|
11527
|
-
type: isList ? `${type}FindManyArgs` : `${type}
|
|
11527
|
+
type: isList ? `${type}FindManyArgs` : `${type}DefaultArgs`,
|
|
11528
11528
|
location: "inputObjectTypes",
|
|
11529
11529
|
namespace: "prisma"
|
|
11530
11530
|
}
|
|
@@ -11625,7 +11625,7 @@ function generateModelArgsInputObjectTypes(models, isGenerateSelect, isGenerateI
|
|
|
11625
11625
|
fields.push(includeField);
|
|
11626
11626
|
}
|
|
11627
11627
|
const modelArgsInputObjectType = {
|
|
11628
|
-
name: `${modelName}
|
|
11628
|
+
name: `${modelName}DefaultArgs`,
|
|
11629
11629
|
constraints: {
|
|
11630
11630
|
maxNumFields: null,
|
|
11631
11631
|
minNumFields: null
|
|
@@ -11692,7 +11692,7 @@ function generateModelCountOutputTypeArgsInputObjectTypes(modelCountOutputTypes)
|
|
|
11692
11692
|
for (const modelCountOutputType of modelCountOutputTypes) {
|
|
11693
11693
|
const { name: modelCountOutputTypeName } = modelCountOutputType;
|
|
11694
11694
|
const modelCountOutputTypeArgsInputObjectType = {
|
|
11695
|
-
name: `${modelCountOutputTypeName}
|
|
11695
|
+
name: `${modelCountOutputTypeName}CountArgs`,
|
|
11696
11696
|
constraints: {
|
|
11697
11697
|
maxNumFields: null,
|
|
11698
11698
|
minNumFields: null
|
|
@@ -11741,7 +11741,7 @@ function generateModelSelectInputObjectTypes(models) {
|
|
|
11741
11741
|
if (isRelationField) {
|
|
11742
11742
|
const schemaArgInputType = {
|
|
11743
11743
|
isList: false,
|
|
11744
|
-
type: isList ? `${type}FindManyArgs` : `${type}
|
|
11744
|
+
type: isList ? `${type}FindManyArgs` : `${type}DefaultArgs`,
|
|
11745
11745
|
location: "inputObjectTypes",
|
|
11746
11746
|
namespace: "prisma"
|
|
11747
11747
|
};
|
|
@@ -11764,7 +11764,7 @@ function generateModelSelectInputObjectTypes(models) {
|
|
|
11764
11764
|
},
|
|
11765
11765
|
{
|
|
11766
11766
|
isList: false,
|
|
11767
|
-
type: `${modelName}
|
|
11767
|
+
type: `${modelName}CountOutputTypeDefaultArgs`,
|
|
11768
11768
|
location: "inputObjectTypes",
|
|
11769
11769
|
namespace: "prisma"
|
|
11770
11770
|
}
|
package/dist/index.js
CHANGED
|
@@ -11014,7 +11014,7 @@ ${this.generateExportSchemaStatement(`${lowerCaseFirst(name)}`, `z.enum(${JSON.s
|
|
|
11014
11014
|
if (lines.length === 0) {
|
|
11015
11015
|
return [];
|
|
11016
11016
|
}
|
|
11017
|
-
let alternatives = lines.
|
|
11017
|
+
let alternatives = lines.reduce((result, inputType) => {
|
|
11018
11018
|
if (inputType.type === "String") {
|
|
11019
11019
|
result.push(this.wrapWithZodValidators("z.string()", field));
|
|
11020
11020
|
} else if (inputType.type === "Int" || inputType.type === "Float" || inputType.type === "Decimal") {
|
|
@@ -11086,7 +11086,7 @@ ${this.generateExportSchemaStatement(`${lowerCaseFirst(name)}`, `z.enum(${JSON.s
|
|
|
11086
11086
|
const schema = inputType.type === this.name ? objectSchemaLine : isEnum ? enumSchemaLine : objectSchemaLine;
|
|
11087
11087
|
const arr = inputType.isList ? ".array()" : "";
|
|
11088
11088
|
const opt = !field.isRequired ? ".optional()" : "";
|
|
11089
|
-
const nullable = field.inputTypes.
|
|
11089
|
+
const nullable = field.inputTypes.some((inputType2) => inputType2?.type === "Null") ? ".nullable()" : "";
|
|
11090
11090
|
return inputsLength === 1 ? ` ${field.name}: z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}` : `z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}${nullable}`;
|
|
11091
11091
|
}
|
|
11092
11092
|
generateFieldValidators(zodStringWithMainType, field) {
|
|
@@ -11529,7 +11529,7 @@ function generateModelIncludeInputObjectTypes(models, isGenerateSelect) {
|
|
|
11529
11529
|
},
|
|
11530
11530
|
{
|
|
11531
11531
|
isList: false,
|
|
11532
|
-
type: isList ? `${type}FindManyArgs` : `${type}
|
|
11532
|
+
type: isList ? `${type}FindManyArgs` : `${type}DefaultArgs`,
|
|
11533
11533
|
location: "inputObjectTypes",
|
|
11534
11534
|
namespace: "prisma"
|
|
11535
11535
|
}
|
|
@@ -11630,7 +11630,7 @@ function generateModelArgsInputObjectTypes(models, isGenerateSelect, isGenerateI
|
|
|
11630
11630
|
fields.push(includeField);
|
|
11631
11631
|
}
|
|
11632
11632
|
const modelArgsInputObjectType = {
|
|
11633
|
-
name: `${modelName}
|
|
11633
|
+
name: `${modelName}DefaultArgs`,
|
|
11634
11634
|
constraints: {
|
|
11635
11635
|
maxNumFields: null,
|
|
11636
11636
|
minNumFields: null
|
|
@@ -11697,7 +11697,7 @@ function generateModelCountOutputTypeArgsInputObjectTypes(modelCountOutputTypes)
|
|
|
11697
11697
|
for (const modelCountOutputType of modelCountOutputTypes) {
|
|
11698
11698
|
const { name: modelCountOutputTypeName } = modelCountOutputType;
|
|
11699
11699
|
const modelCountOutputTypeArgsInputObjectType = {
|
|
11700
|
-
name: `${modelCountOutputTypeName}
|
|
11700
|
+
name: `${modelCountOutputTypeName}CountArgs`,
|
|
11701
11701
|
constraints: {
|
|
11702
11702
|
maxNumFields: null,
|
|
11703
11703
|
minNumFields: null
|
|
@@ -11746,7 +11746,7 @@ function generateModelSelectInputObjectTypes(models) {
|
|
|
11746
11746
|
if (isRelationField) {
|
|
11747
11747
|
const schemaArgInputType = {
|
|
11748
11748
|
isList: false,
|
|
11749
|
-
type: isList ? `${type}FindManyArgs` : `${type}
|
|
11749
|
+
type: isList ? `${type}FindManyArgs` : `${type}DefaultArgs`,
|
|
11750
11750
|
location: "inputObjectTypes",
|
|
11751
11751
|
namespace: "prisma"
|
|
11752
11752
|
};
|
|
@@ -11769,7 +11769,7 @@ function generateModelSelectInputObjectTypes(models) {
|
|
|
11769
11769
|
},
|
|
11770
11770
|
{
|
|
11771
11771
|
isList: false,
|
|
11772
|
-
type: `${modelName}
|
|
11772
|
+
type: `${modelName}CountOutputTypeDefaultArgs`,
|
|
11773
11773
|
location: "inputObjectTypes",
|
|
11774
11774
|
namespace: "prisma"
|
|
11775
11775
|
}
|