@stryke/prisma-trpc-generator 0.4.4 → 0.4.6
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 +16 -8
- package/dist/generator.js +16 -8
- package/dist/index.cjs +16 -8
- package/dist/index.js +16 -8
- package/package.json +1 -1
package/dist/generator.cjs
CHANGED
|
@@ -6853,10 +6853,8 @@ var ModelAction = /* @__PURE__ */ function(ModelAction2) {
|
|
|
6853
6853
|
ModelAction2["findMany"] = "findMany";
|
|
6854
6854
|
ModelAction2["create"] = "create";
|
|
6855
6855
|
ModelAction2["createMany"] = "createMany";
|
|
6856
|
-
ModelAction2["createManyAndReturn"] = "createManyAndReturn";
|
|
6857
6856
|
ModelAction2["update"] = "update";
|
|
6858
6857
|
ModelAction2["updateMany"] = "updateMany";
|
|
6859
|
-
ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
|
|
6860
6858
|
ModelAction2["upsert"] = "upsert";
|
|
6861
6859
|
ModelAction2["delete"] = "delete";
|
|
6862
6860
|
ModelAction2["deleteMany"] = "deleteMany";
|
|
@@ -6873,11 +6871,11 @@ var configBoolean = z.enum([
|
|
|
6873
6871
|
]).transform((arg) => JSON.parse(arg));
|
|
6874
6872
|
var configMiddleware = z.union([
|
|
6875
6873
|
configBoolean,
|
|
6876
|
-
z.string().default("
|
|
6874
|
+
z.string().default("../../../src/middleware")
|
|
6877
6875
|
]);
|
|
6878
6876
|
var configShield = z.union([
|
|
6879
6877
|
configBoolean,
|
|
6880
|
-
z.string().default("
|
|
6878
|
+
z.string().default("../../../src/shield")
|
|
6881
6879
|
]);
|
|
6882
6880
|
var modelActionEnum = z.nativeEnum(ModelAction);
|
|
6883
6881
|
var configSchema = z.object({
|
|
@@ -6885,7 +6883,7 @@ var configSchema = z.object({
|
|
|
6885
6883
|
withMiddleware: configMiddleware.default("true"),
|
|
6886
6884
|
withShield: configShield.default("true"),
|
|
6887
6885
|
withZod: configBoolean.default("true"),
|
|
6888
|
-
contextPath: z.string().default("
|
|
6886
|
+
contextPath: z.string().default("../../../src/context"),
|
|
6889
6887
|
trpcOptionsPath: z.string().optional(),
|
|
6890
6888
|
showModelNameInProcedure: configBoolean.default("true"),
|
|
6891
6889
|
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
@@ -11548,8 +11546,13 @@ async function generate(options) {
|
|
|
11548
11546
|
for (const [opType, opNameWithModel] of Object.entries(operations)) {
|
|
11549
11547
|
if ([
|
|
11550
11548
|
"findUnique",
|
|
11549
|
+
"findUniqueOrThrow",
|
|
11551
11550
|
"findFirst",
|
|
11551
|
+
"findFirstOrThrow",
|
|
11552
|
+
"findRaw",
|
|
11552
11553
|
"findMany",
|
|
11554
|
+
"aggregateRaw",
|
|
11555
|
+
"count",
|
|
11553
11556
|
"aggregate",
|
|
11554
11557
|
"groupBy"
|
|
11555
11558
|
].includes(opType)) {
|
|
@@ -11557,10 +11560,13 @@ async function generate(options) {
|
|
|
11557
11560
|
}
|
|
11558
11561
|
if ([
|
|
11559
11562
|
"createOne",
|
|
11563
|
+
"createMany",
|
|
11564
|
+
"createManyAndReturn",
|
|
11560
11565
|
"deleteOne",
|
|
11561
|
-
"updateOne",
|
|
11562
11566
|
"deleteMany",
|
|
11567
|
+
"updateOne",
|
|
11563
11568
|
"updateMany",
|
|
11569
|
+
"updateManyAndReturn",
|
|
11564
11570
|
"upsertOne"
|
|
11565
11571
|
].includes(opType)) {
|
|
11566
11572
|
mutations.push(opNameWithModel);
|
|
@@ -11650,8 +11656,10 @@ async function generate(options) {
|
|
|
11650
11656
|
);
|
|
11651
11657
|
for (const opType of modelActions) {
|
|
11652
11658
|
const opNameWithModel = operations[opType];
|
|
11653
|
-
|
|
11654
|
-
|
|
11659
|
+
if (opNameWithModel) {
|
|
11660
|
+
const baseOpType = opType.replace("OrThrow", "");
|
|
11661
|
+
generateProcedure(modelRouter, opNameWithModel, getInputTypeByOpName(baseOpType, model), model, opType, baseOpType, config);
|
|
11662
|
+
}
|
|
11655
11663
|
}
|
|
11656
11664
|
modelRouter.addStatements(
|
|
11657
11665
|
/* ts */
|
package/dist/generator.js
CHANGED
|
@@ -6858,10 +6858,8 @@ var ModelAction = /* @__PURE__ */ function(ModelAction2) {
|
|
|
6858
6858
|
ModelAction2["findMany"] = "findMany";
|
|
6859
6859
|
ModelAction2["create"] = "create";
|
|
6860
6860
|
ModelAction2["createMany"] = "createMany";
|
|
6861
|
-
ModelAction2["createManyAndReturn"] = "createManyAndReturn";
|
|
6862
6861
|
ModelAction2["update"] = "update";
|
|
6863
6862
|
ModelAction2["updateMany"] = "updateMany";
|
|
6864
|
-
ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
|
|
6865
6863
|
ModelAction2["upsert"] = "upsert";
|
|
6866
6864
|
ModelAction2["delete"] = "delete";
|
|
6867
6865
|
ModelAction2["deleteMany"] = "deleteMany";
|
|
@@ -6878,11 +6876,11 @@ var configBoolean = z.enum([
|
|
|
6878
6876
|
]).transform((arg) => JSON.parse(arg));
|
|
6879
6877
|
var configMiddleware = z.union([
|
|
6880
6878
|
configBoolean,
|
|
6881
|
-
z.string().default("
|
|
6879
|
+
z.string().default("../../../src/middleware")
|
|
6882
6880
|
]);
|
|
6883
6881
|
var configShield = z.union([
|
|
6884
6882
|
configBoolean,
|
|
6885
|
-
z.string().default("
|
|
6883
|
+
z.string().default("../../../src/shield")
|
|
6886
6884
|
]);
|
|
6887
6885
|
var modelActionEnum = z.nativeEnum(ModelAction);
|
|
6888
6886
|
var configSchema = z.object({
|
|
@@ -6890,7 +6888,7 @@ var configSchema = z.object({
|
|
|
6890
6888
|
withMiddleware: configMiddleware.default("true"),
|
|
6891
6889
|
withShield: configShield.default("true"),
|
|
6892
6890
|
withZod: configBoolean.default("true"),
|
|
6893
|
-
contextPath: z.string().default("
|
|
6891
|
+
contextPath: z.string().default("../../../src/context"),
|
|
6894
6892
|
trpcOptionsPath: z.string().optional(),
|
|
6895
6893
|
showModelNameInProcedure: configBoolean.default("true"),
|
|
6896
6894
|
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
@@ -11553,8 +11551,13 @@ async function generate(options) {
|
|
|
11553
11551
|
for (const [opType, opNameWithModel] of Object.entries(operations)) {
|
|
11554
11552
|
if ([
|
|
11555
11553
|
"findUnique",
|
|
11554
|
+
"findUniqueOrThrow",
|
|
11556
11555
|
"findFirst",
|
|
11556
|
+
"findFirstOrThrow",
|
|
11557
|
+
"findRaw",
|
|
11557
11558
|
"findMany",
|
|
11559
|
+
"aggregateRaw",
|
|
11560
|
+
"count",
|
|
11558
11561
|
"aggregate",
|
|
11559
11562
|
"groupBy"
|
|
11560
11563
|
].includes(opType)) {
|
|
@@ -11562,10 +11565,13 @@ async function generate(options) {
|
|
|
11562
11565
|
}
|
|
11563
11566
|
if ([
|
|
11564
11567
|
"createOne",
|
|
11568
|
+
"createMany",
|
|
11569
|
+
"createManyAndReturn",
|
|
11565
11570
|
"deleteOne",
|
|
11566
|
-
"updateOne",
|
|
11567
11571
|
"deleteMany",
|
|
11572
|
+
"updateOne",
|
|
11568
11573
|
"updateMany",
|
|
11574
|
+
"updateManyAndReturn",
|
|
11569
11575
|
"upsertOne"
|
|
11570
11576
|
].includes(opType)) {
|
|
11571
11577
|
mutations.push(opNameWithModel);
|
|
@@ -11655,8 +11661,10 @@ async function generate(options) {
|
|
|
11655
11661
|
);
|
|
11656
11662
|
for (const opType of modelActions) {
|
|
11657
11663
|
const opNameWithModel = operations[opType];
|
|
11658
|
-
|
|
11659
|
-
|
|
11664
|
+
if (opNameWithModel) {
|
|
11665
|
+
const baseOpType = opType.replace("OrThrow", "");
|
|
11666
|
+
generateProcedure(modelRouter, opNameWithModel, getInputTypeByOpName(baseOpType, model), model, opType, baseOpType, config);
|
|
11667
|
+
}
|
|
11660
11668
|
}
|
|
11661
11669
|
modelRouter.addStatements(
|
|
11662
11670
|
/* ts */
|
package/dist/index.cjs
CHANGED
|
@@ -6849,10 +6849,8 @@ var ModelAction = /* @__PURE__ */ function(ModelAction2) {
|
|
|
6849
6849
|
ModelAction2["findMany"] = "findMany";
|
|
6850
6850
|
ModelAction2["create"] = "create";
|
|
6851
6851
|
ModelAction2["createMany"] = "createMany";
|
|
6852
|
-
ModelAction2["createManyAndReturn"] = "createManyAndReturn";
|
|
6853
6852
|
ModelAction2["update"] = "update";
|
|
6854
6853
|
ModelAction2["updateMany"] = "updateMany";
|
|
6855
|
-
ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
|
|
6856
6854
|
ModelAction2["upsert"] = "upsert";
|
|
6857
6855
|
ModelAction2["delete"] = "delete";
|
|
6858
6856
|
ModelAction2["deleteMany"] = "deleteMany";
|
|
@@ -6869,11 +6867,11 @@ var configBoolean = z.enum([
|
|
|
6869
6867
|
]).transform((arg) => JSON.parse(arg));
|
|
6870
6868
|
var configMiddleware = z.union([
|
|
6871
6869
|
configBoolean,
|
|
6872
|
-
z.string().default("
|
|
6870
|
+
z.string().default("../../../src/middleware")
|
|
6873
6871
|
]);
|
|
6874
6872
|
var configShield = z.union([
|
|
6875
6873
|
configBoolean,
|
|
6876
|
-
z.string().default("
|
|
6874
|
+
z.string().default("../../../src/shield")
|
|
6877
6875
|
]);
|
|
6878
6876
|
var modelActionEnum = z.nativeEnum(ModelAction);
|
|
6879
6877
|
var configSchema = z.object({
|
|
@@ -6881,7 +6879,7 @@ var configSchema = z.object({
|
|
|
6881
6879
|
withMiddleware: configMiddleware.default("true"),
|
|
6882
6880
|
withShield: configShield.default("true"),
|
|
6883
6881
|
withZod: configBoolean.default("true"),
|
|
6884
|
-
contextPath: z.string().default("
|
|
6882
|
+
contextPath: z.string().default("../../../src/context"),
|
|
6885
6883
|
trpcOptionsPath: z.string().optional(),
|
|
6886
6884
|
showModelNameInProcedure: configBoolean.default("true"),
|
|
6887
6885
|
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
@@ -11544,8 +11542,13 @@ async function generate(options) {
|
|
|
11544
11542
|
for (const [opType, opNameWithModel] of Object.entries(operations)) {
|
|
11545
11543
|
if ([
|
|
11546
11544
|
"findUnique",
|
|
11545
|
+
"findUniqueOrThrow",
|
|
11547
11546
|
"findFirst",
|
|
11547
|
+
"findFirstOrThrow",
|
|
11548
|
+
"findRaw",
|
|
11548
11549
|
"findMany",
|
|
11550
|
+
"aggregateRaw",
|
|
11551
|
+
"count",
|
|
11549
11552
|
"aggregate",
|
|
11550
11553
|
"groupBy"
|
|
11551
11554
|
].includes(opType)) {
|
|
@@ -11553,10 +11556,13 @@ async function generate(options) {
|
|
|
11553
11556
|
}
|
|
11554
11557
|
if ([
|
|
11555
11558
|
"createOne",
|
|
11559
|
+
"createMany",
|
|
11560
|
+
"createManyAndReturn",
|
|
11556
11561
|
"deleteOne",
|
|
11557
|
-
"updateOne",
|
|
11558
11562
|
"deleteMany",
|
|
11563
|
+
"updateOne",
|
|
11559
11564
|
"updateMany",
|
|
11565
|
+
"updateManyAndReturn",
|
|
11560
11566
|
"upsertOne"
|
|
11561
11567
|
].includes(opType)) {
|
|
11562
11568
|
mutations.push(opNameWithModel);
|
|
@@ -11646,8 +11652,10 @@ async function generate(options) {
|
|
|
11646
11652
|
);
|
|
11647
11653
|
for (const opType of modelActions) {
|
|
11648
11654
|
const opNameWithModel = operations[opType];
|
|
11649
|
-
|
|
11650
|
-
|
|
11655
|
+
if (opNameWithModel) {
|
|
11656
|
+
const baseOpType = opType.replace("OrThrow", "");
|
|
11657
|
+
generateProcedure(modelRouter, opNameWithModel, getInputTypeByOpName(baseOpType, model), model, opType, baseOpType, config);
|
|
11658
|
+
}
|
|
11651
11659
|
}
|
|
11652
11660
|
modelRouter.addStatements(
|
|
11653
11661
|
/* ts */
|
package/dist/index.js
CHANGED
|
@@ -6854,10 +6854,8 @@ var ModelAction = /* @__PURE__ */ function(ModelAction2) {
|
|
|
6854
6854
|
ModelAction2["findMany"] = "findMany";
|
|
6855
6855
|
ModelAction2["create"] = "create";
|
|
6856
6856
|
ModelAction2["createMany"] = "createMany";
|
|
6857
|
-
ModelAction2["createManyAndReturn"] = "createManyAndReturn";
|
|
6858
6857
|
ModelAction2["update"] = "update";
|
|
6859
6858
|
ModelAction2["updateMany"] = "updateMany";
|
|
6860
|
-
ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
|
|
6861
6859
|
ModelAction2["upsert"] = "upsert";
|
|
6862
6860
|
ModelAction2["delete"] = "delete";
|
|
6863
6861
|
ModelAction2["deleteMany"] = "deleteMany";
|
|
@@ -6874,11 +6872,11 @@ var configBoolean = z.enum([
|
|
|
6874
6872
|
]).transform((arg) => JSON.parse(arg));
|
|
6875
6873
|
var configMiddleware = z.union([
|
|
6876
6874
|
configBoolean,
|
|
6877
|
-
z.string().default("
|
|
6875
|
+
z.string().default("../../../src/middleware")
|
|
6878
6876
|
]);
|
|
6879
6877
|
var configShield = z.union([
|
|
6880
6878
|
configBoolean,
|
|
6881
|
-
z.string().default("
|
|
6879
|
+
z.string().default("../../../src/shield")
|
|
6882
6880
|
]);
|
|
6883
6881
|
var modelActionEnum = z.nativeEnum(ModelAction);
|
|
6884
6882
|
var configSchema = z.object({
|
|
@@ -6886,7 +6884,7 @@ var configSchema = z.object({
|
|
|
6886
6884
|
withMiddleware: configMiddleware.default("true"),
|
|
6887
6885
|
withShield: configShield.default("true"),
|
|
6888
6886
|
withZod: configBoolean.default("true"),
|
|
6889
|
-
contextPath: z.string().default("
|
|
6887
|
+
contextPath: z.string().default("../../../src/context"),
|
|
6890
6888
|
trpcOptionsPath: z.string().optional(),
|
|
6891
6889
|
showModelNameInProcedure: configBoolean.default("true"),
|
|
6892
6890
|
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
@@ -11549,8 +11547,13 @@ async function generate(options) {
|
|
|
11549
11547
|
for (const [opType, opNameWithModel] of Object.entries(operations)) {
|
|
11550
11548
|
if ([
|
|
11551
11549
|
"findUnique",
|
|
11550
|
+
"findUniqueOrThrow",
|
|
11552
11551
|
"findFirst",
|
|
11552
|
+
"findFirstOrThrow",
|
|
11553
|
+
"findRaw",
|
|
11553
11554
|
"findMany",
|
|
11555
|
+
"aggregateRaw",
|
|
11556
|
+
"count",
|
|
11554
11557
|
"aggregate",
|
|
11555
11558
|
"groupBy"
|
|
11556
11559
|
].includes(opType)) {
|
|
@@ -11558,10 +11561,13 @@ async function generate(options) {
|
|
|
11558
11561
|
}
|
|
11559
11562
|
if ([
|
|
11560
11563
|
"createOne",
|
|
11564
|
+
"createMany",
|
|
11565
|
+
"createManyAndReturn",
|
|
11561
11566
|
"deleteOne",
|
|
11562
|
-
"updateOne",
|
|
11563
11567
|
"deleteMany",
|
|
11568
|
+
"updateOne",
|
|
11564
11569
|
"updateMany",
|
|
11570
|
+
"updateManyAndReturn",
|
|
11565
11571
|
"upsertOne"
|
|
11566
11572
|
].includes(opType)) {
|
|
11567
11573
|
mutations.push(opNameWithModel);
|
|
@@ -11651,8 +11657,10 @@ async function generate(options) {
|
|
|
11651
11657
|
);
|
|
11652
11658
|
for (const opType of modelActions) {
|
|
11653
11659
|
const opNameWithModel = operations[opType];
|
|
11654
|
-
|
|
11655
|
-
|
|
11660
|
+
if (opNameWithModel) {
|
|
11661
|
+
const baseOpType = opType.replace("OrThrow", "");
|
|
11662
|
+
generateProcedure(modelRouter, opNameWithModel, getInputTypeByOpName(baseOpType, model), model, opType, baseOpType, config);
|
|
11663
|
+
}
|
|
11656
11664
|
}
|
|
11657
11665
|
modelRouter.addStatements(
|
|
11658
11666
|
/* ts */
|