@stryke/prisma-trpc-generator 0.4.6 → 0.4.8
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 +17 -4
- package/dist/generator.js +17 -4
- package/dist/index.cjs +17 -4
- package/dist/index.js +17 -4
- package/package.json +1 -1
package/dist/generator.cjs
CHANGED
|
@@ -6853,8 +6853,10 @@ var ModelAction = /* @__PURE__ */ function(ModelAction2) {
|
|
|
6853
6853
|
ModelAction2["findMany"] = "findMany";
|
|
6854
6854
|
ModelAction2["create"] = "create";
|
|
6855
6855
|
ModelAction2["createMany"] = "createMany";
|
|
6856
|
+
ModelAction2["createManyAndReturn"] = "createManyAndReturn";
|
|
6856
6857
|
ModelAction2["update"] = "update";
|
|
6857
6858
|
ModelAction2["updateMany"] = "updateMany";
|
|
6859
|
+
ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
|
|
6858
6860
|
ModelAction2["upsert"] = "upsert";
|
|
6859
6861
|
ModelAction2["delete"] = "delete";
|
|
6860
6862
|
ModelAction2["deleteMany"] = "deleteMany";
|
|
@@ -6871,11 +6873,11 @@ var configBoolean = z.enum([
|
|
|
6871
6873
|
]).transform((arg) => JSON.parse(arg));
|
|
6872
6874
|
var configMiddleware = z.union([
|
|
6873
6875
|
configBoolean,
|
|
6874
|
-
z.string().default("
|
|
6876
|
+
z.string().default("../src/trpc/middleware")
|
|
6875
6877
|
]);
|
|
6876
6878
|
var configShield = z.union([
|
|
6877
6879
|
configBoolean,
|
|
6878
|
-
z.string().default("
|
|
6880
|
+
z.string().default("../src/trpc/shield")
|
|
6879
6881
|
]);
|
|
6880
6882
|
var modelActionEnum = z.nativeEnum(ModelAction);
|
|
6881
6883
|
var configSchema = z.object({
|
|
@@ -6883,7 +6885,7 @@ var configSchema = z.object({
|
|
|
6883
6885
|
withMiddleware: configMiddleware.default("true"),
|
|
6884
6886
|
withShield: configShield.default("true"),
|
|
6885
6887
|
withZod: configBoolean.default("true"),
|
|
6886
|
-
contextPath: z.string().default("
|
|
6888
|
+
contextPath: z.string().default("../src/trpc/context"),
|
|
6887
6889
|
trpcOptionsPath: z.string().optional(),
|
|
6888
6890
|
showModelNameInProcedure: configBoolean.default("true"),
|
|
6889
6891
|
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
@@ -7795,6 +7797,9 @@ var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
|
|
|
7795
7797
|
case "createMany":
|
|
7796
7798
|
inputType = `${modelName}CreateManySchema`;
|
|
7797
7799
|
break;
|
|
7800
|
+
case "createManyAndReturn":
|
|
7801
|
+
inputType = `${modelName}CreateManyAndReturnSchema`;
|
|
7802
|
+
break;
|
|
7798
7803
|
case "deleteOne":
|
|
7799
7804
|
inputType = `${modelName}DeleteOneSchema`;
|
|
7800
7805
|
break;
|
|
@@ -7807,6 +7812,9 @@ var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
|
|
|
7807
7812
|
case "updateMany":
|
|
7808
7813
|
inputType = `${modelName}UpdateManySchema`;
|
|
7809
7814
|
break;
|
|
7815
|
+
case "updateManyAndReturn":
|
|
7816
|
+
inputType = `${modelName}UpdateManyAndReturnSchema`;
|
|
7817
|
+
break;
|
|
7810
7818
|
case "upsertOne":
|
|
7811
7819
|
inputType = `${modelName}UpsertSchema`;
|
|
7812
7820
|
break;
|
|
@@ -7841,10 +7849,12 @@ var getProcedureTypeByOpName = /* @__PURE__ */ __name((opName) => {
|
|
|
7841
7849
|
break;
|
|
7842
7850
|
case "createOne":
|
|
7843
7851
|
case "createMany":
|
|
7852
|
+
case "createManyAndReturn":
|
|
7844
7853
|
case "deleteOne":
|
|
7845
7854
|
case "updateOne":
|
|
7846
7855
|
case "deleteMany":
|
|
7847
7856
|
case "updateMany":
|
|
7857
|
+
case "updateManyAndReturn":
|
|
7848
7858
|
case "upsertOne":
|
|
7849
7859
|
procType = "mutation";
|
|
7850
7860
|
break;
|
|
@@ -11630,7 +11640,10 @@ async function generate(options) {
|
|
|
11630
11640
|
consoleLog(`Skipping model ${model} as it is hidden`);
|
|
11631
11641
|
continue;
|
|
11632
11642
|
}
|
|
11633
|
-
const modelActions = Object.keys(operations).filter((opType) =>
|
|
11643
|
+
const modelActions = Object.keys(operations).filter((opType) => (
|
|
11644
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
11645
|
+
config.generateModelActions.some((generateModelAction) => generateModelAction === opType.replace("One", ""))
|
|
11646
|
+
));
|
|
11634
11647
|
if (!modelActions.length) {
|
|
11635
11648
|
consoleLog(`Skipping model ${model} as it has no actions to generate`);
|
|
11636
11649
|
continue;
|
package/dist/generator.js
CHANGED
|
@@ -6858,8 +6858,10 @@ var ModelAction = /* @__PURE__ */ function(ModelAction2) {
|
|
|
6858
6858
|
ModelAction2["findMany"] = "findMany";
|
|
6859
6859
|
ModelAction2["create"] = "create";
|
|
6860
6860
|
ModelAction2["createMany"] = "createMany";
|
|
6861
|
+
ModelAction2["createManyAndReturn"] = "createManyAndReturn";
|
|
6861
6862
|
ModelAction2["update"] = "update";
|
|
6862
6863
|
ModelAction2["updateMany"] = "updateMany";
|
|
6864
|
+
ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
|
|
6863
6865
|
ModelAction2["upsert"] = "upsert";
|
|
6864
6866
|
ModelAction2["delete"] = "delete";
|
|
6865
6867
|
ModelAction2["deleteMany"] = "deleteMany";
|
|
@@ -6876,11 +6878,11 @@ var configBoolean = z.enum([
|
|
|
6876
6878
|
]).transform((arg) => JSON.parse(arg));
|
|
6877
6879
|
var configMiddleware = z.union([
|
|
6878
6880
|
configBoolean,
|
|
6879
|
-
z.string().default("
|
|
6881
|
+
z.string().default("../src/trpc/middleware")
|
|
6880
6882
|
]);
|
|
6881
6883
|
var configShield = z.union([
|
|
6882
6884
|
configBoolean,
|
|
6883
|
-
z.string().default("
|
|
6885
|
+
z.string().default("../src/trpc/shield")
|
|
6884
6886
|
]);
|
|
6885
6887
|
var modelActionEnum = z.nativeEnum(ModelAction);
|
|
6886
6888
|
var configSchema = z.object({
|
|
@@ -6888,7 +6890,7 @@ var configSchema = z.object({
|
|
|
6888
6890
|
withMiddleware: configMiddleware.default("true"),
|
|
6889
6891
|
withShield: configShield.default("true"),
|
|
6890
6892
|
withZod: configBoolean.default("true"),
|
|
6891
|
-
contextPath: z.string().default("
|
|
6893
|
+
contextPath: z.string().default("../src/trpc/context"),
|
|
6892
6894
|
trpcOptionsPath: z.string().optional(),
|
|
6893
6895
|
showModelNameInProcedure: configBoolean.default("true"),
|
|
6894
6896
|
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
@@ -7800,6 +7802,9 @@ var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
|
|
|
7800
7802
|
case "createMany":
|
|
7801
7803
|
inputType = `${modelName}CreateManySchema`;
|
|
7802
7804
|
break;
|
|
7805
|
+
case "createManyAndReturn":
|
|
7806
|
+
inputType = `${modelName}CreateManyAndReturnSchema`;
|
|
7807
|
+
break;
|
|
7803
7808
|
case "deleteOne":
|
|
7804
7809
|
inputType = `${modelName}DeleteOneSchema`;
|
|
7805
7810
|
break;
|
|
@@ -7812,6 +7817,9 @@ var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
|
|
|
7812
7817
|
case "updateMany":
|
|
7813
7818
|
inputType = `${modelName}UpdateManySchema`;
|
|
7814
7819
|
break;
|
|
7820
|
+
case "updateManyAndReturn":
|
|
7821
|
+
inputType = `${modelName}UpdateManyAndReturnSchema`;
|
|
7822
|
+
break;
|
|
7815
7823
|
case "upsertOne":
|
|
7816
7824
|
inputType = `${modelName}UpsertSchema`;
|
|
7817
7825
|
break;
|
|
@@ -7846,10 +7854,12 @@ var getProcedureTypeByOpName = /* @__PURE__ */ __name((opName) => {
|
|
|
7846
7854
|
break;
|
|
7847
7855
|
case "createOne":
|
|
7848
7856
|
case "createMany":
|
|
7857
|
+
case "createManyAndReturn":
|
|
7849
7858
|
case "deleteOne":
|
|
7850
7859
|
case "updateOne":
|
|
7851
7860
|
case "deleteMany":
|
|
7852
7861
|
case "updateMany":
|
|
7862
|
+
case "updateManyAndReturn":
|
|
7853
7863
|
case "upsertOne":
|
|
7854
7864
|
procType = "mutation";
|
|
7855
7865
|
break;
|
|
@@ -11635,7 +11645,10 @@ async function generate(options) {
|
|
|
11635
11645
|
consoleLog(`Skipping model ${model} as it is hidden`);
|
|
11636
11646
|
continue;
|
|
11637
11647
|
}
|
|
11638
|
-
const modelActions = Object.keys(operations).filter((opType) =>
|
|
11648
|
+
const modelActions = Object.keys(operations).filter((opType) => (
|
|
11649
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
11650
|
+
config.generateModelActions.some((generateModelAction) => generateModelAction === opType.replace("One", ""))
|
|
11651
|
+
));
|
|
11639
11652
|
if (!modelActions.length) {
|
|
11640
11653
|
consoleLog(`Skipping model ${model} as it has no actions to generate`);
|
|
11641
11654
|
continue;
|
package/dist/index.cjs
CHANGED
|
@@ -6849,8 +6849,10 @@ var ModelAction = /* @__PURE__ */ function(ModelAction2) {
|
|
|
6849
6849
|
ModelAction2["findMany"] = "findMany";
|
|
6850
6850
|
ModelAction2["create"] = "create";
|
|
6851
6851
|
ModelAction2["createMany"] = "createMany";
|
|
6852
|
+
ModelAction2["createManyAndReturn"] = "createManyAndReturn";
|
|
6852
6853
|
ModelAction2["update"] = "update";
|
|
6853
6854
|
ModelAction2["updateMany"] = "updateMany";
|
|
6855
|
+
ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
|
|
6854
6856
|
ModelAction2["upsert"] = "upsert";
|
|
6855
6857
|
ModelAction2["delete"] = "delete";
|
|
6856
6858
|
ModelAction2["deleteMany"] = "deleteMany";
|
|
@@ -6867,11 +6869,11 @@ var configBoolean = z.enum([
|
|
|
6867
6869
|
]).transform((arg) => JSON.parse(arg));
|
|
6868
6870
|
var configMiddleware = z.union([
|
|
6869
6871
|
configBoolean,
|
|
6870
|
-
z.string().default("
|
|
6872
|
+
z.string().default("../src/trpc/middleware")
|
|
6871
6873
|
]);
|
|
6872
6874
|
var configShield = z.union([
|
|
6873
6875
|
configBoolean,
|
|
6874
|
-
z.string().default("
|
|
6876
|
+
z.string().default("../src/trpc/shield")
|
|
6875
6877
|
]);
|
|
6876
6878
|
var modelActionEnum = z.nativeEnum(ModelAction);
|
|
6877
6879
|
var configSchema = z.object({
|
|
@@ -6879,7 +6881,7 @@ var configSchema = z.object({
|
|
|
6879
6881
|
withMiddleware: configMiddleware.default("true"),
|
|
6880
6882
|
withShield: configShield.default("true"),
|
|
6881
6883
|
withZod: configBoolean.default("true"),
|
|
6882
|
-
contextPath: z.string().default("
|
|
6884
|
+
contextPath: z.string().default("../src/trpc/context"),
|
|
6883
6885
|
trpcOptionsPath: z.string().optional(),
|
|
6884
6886
|
showModelNameInProcedure: configBoolean.default("true"),
|
|
6885
6887
|
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
@@ -7791,6 +7793,9 @@ var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
|
|
|
7791
7793
|
case "createMany":
|
|
7792
7794
|
inputType = `${modelName}CreateManySchema`;
|
|
7793
7795
|
break;
|
|
7796
|
+
case "createManyAndReturn":
|
|
7797
|
+
inputType = `${modelName}CreateManyAndReturnSchema`;
|
|
7798
|
+
break;
|
|
7794
7799
|
case "deleteOne":
|
|
7795
7800
|
inputType = `${modelName}DeleteOneSchema`;
|
|
7796
7801
|
break;
|
|
@@ -7803,6 +7808,9 @@ var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
|
|
|
7803
7808
|
case "updateMany":
|
|
7804
7809
|
inputType = `${modelName}UpdateManySchema`;
|
|
7805
7810
|
break;
|
|
7811
|
+
case "updateManyAndReturn":
|
|
7812
|
+
inputType = `${modelName}UpdateManyAndReturnSchema`;
|
|
7813
|
+
break;
|
|
7806
7814
|
case "upsertOne":
|
|
7807
7815
|
inputType = `${modelName}UpsertSchema`;
|
|
7808
7816
|
break;
|
|
@@ -7837,10 +7845,12 @@ var getProcedureTypeByOpName = /* @__PURE__ */ __name((opName) => {
|
|
|
7837
7845
|
break;
|
|
7838
7846
|
case "createOne":
|
|
7839
7847
|
case "createMany":
|
|
7848
|
+
case "createManyAndReturn":
|
|
7840
7849
|
case "deleteOne":
|
|
7841
7850
|
case "updateOne":
|
|
7842
7851
|
case "deleteMany":
|
|
7843
7852
|
case "updateMany":
|
|
7853
|
+
case "updateManyAndReturn":
|
|
7844
7854
|
case "upsertOne":
|
|
7845
7855
|
procType = "mutation";
|
|
7846
7856
|
break;
|
|
@@ -11626,7 +11636,10 @@ async function generate(options) {
|
|
|
11626
11636
|
consoleLog(`Skipping model ${model} as it is hidden`);
|
|
11627
11637
|
continue;
|
|
11628
11638
|
}
|
|
11629
|
-
const modelActions = Object.keys(operations).filter((opType) =>
|
|
11639
|
+
const modelActions = Object.keys(operations).filter((opType) => (
|
|
11640
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
11641
|
+
config.generateModelActions.some((generateModelAction) => generateModelAction === opType.replace("One", ""))
|
|
11642
|
+
));
|
|
11630
11643
|
if (!modelActions.length) {
|
|
11631
11644
|
consoleLog(`Skipping model ${model} as it has no actions to generate`);
|
|
11632
11645
|
continue;
|
package/dist/index.js
CHANGED
|
@@ -6854,8 +6854,10 @@ var ModelAction = /* @__PURE__ */ function(ModelAction2) {
|
|
|
6854
6854
|
ModelAction2["findMany"] = "findMany";
|
|
6855
6855
|
ModelAction2["create"] = "create";
|
|
6856
6856
|
ModelAction2["createMany"] = "createMany";
|
|
6857
|
+
ModelAction2["createManyAndReturn"] = "createManyAndReturn";
|
|
6857
6858
|
ModelAction2["update"] = "update";
|
|
6858
6859
|
ModelAction2["updateMany"] = "updateMany";
|
|
6860
|
+
ModelAction2["updateManyAndReturn"] = "updateManyAndReturn";
|
|
6859
6861
|
ModelAction2["upsert"] = "upsert";
|
|
6860
6862
|
ModelAction2["delete"] = "delete";
|
|
6861
6863
|
ModelAction2["deleteMany"] = "deleteMany";
|
|
@@ -6872,11 +6874,11 @@ var configBoolean = z.enum([
|
|
|
6872
6874
|
]).transform((arg) => JSON.parse(arg));
|
|
6873
6875
|
var configMiddleware = z.union([
|
|
6874
6876
|
configBoolean,
|
|
6875
|
-
z.string().default("
|
|
6877
|
+
z.string().default("../src/trpc/middleware")
|
|
6876
6878
|
]);
|
|
6877
6879
|
var configShield = z.union([
|
|
6878
6880
|
configBoolean,
|
|
6879
|
-
z.string().default("
|
|
6881
|
+
z.string().default("../src/trpc/shield")
|
|
6880
6882
|
]);
|
|
6881
6883
|
var modelActionEnum = z.nativeEnum(ModelAction);
|
|
6882
6884
|
var configSchema = z.object({
|
|
@@ -6884,7 +6886,7 @@ var configSchema = z.object({
|
|
|
6884
6886
|
withMiddleware: configMiddleware.default("true"),
|
|
6885
6887
|
withShield: configShield.default("true"),
|
|
6886
6888
|
withZod: configBoolean.default("true"),
|
|
6887
|
-
contextPath: z.string().default("
|
|
6889
|
+
contextPath: z.string().default("../src/trpc/context"),
|
|
6888
6890
|
trpcOptionsPath: z.string().optional(),
|
|
6889
6891
|
showModelNameInProcedure: configBoolean.default("true"),
|
|
6890
6892
|
generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
|
|
@@ -7796,6 +7798,9 @@ var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
|
|
|
7796
7798
|
case "createMany":
|
|
7797
7799
|
inputType = `${modelName}CreateManySchema`;
|
|
7798
7800
|
break;
|
|
7801
|
+
case "createManyAndReturn":
|
|
7802
|
+
inputType = `${modelName}CreateManyAndReturnSchema`;
|
|
7803
|
+
break;
|
|
7799
7804
|
case "deleteOne":
|
|
7800
7805
|
inputType = `${modelName}DeleteOneSchema`;
|
|
7801
7806
|
break;
|
|
@@ -7808,6 +7813,9 @@ var getInputTypeByOpName = /* @__PURE__ */ __name((opName, modelName) => {
|
|
|
7808
7813
|
case "updateMany":
|
|
7809
7814
|
inputType = `${modelName}UpdateManySchema`;
|
|
7810
7815
|
break;
|
|
7816
|
+
case "updateManyAndReturn":
|
|
7817
|
+
inputType = `${modelName}UpdateManyAndReturnSchema`;
|
|
7818
|
+
break;
|
|
7811
7819
|
case "upsertOne":
|
|
7812
7820
|
inputType = `${modelName}UpsertSchema`;
|
|
7813
7821
|
break;
|
|
@@ -7842,10 +7850,12 @@ var getProcedureTypeByOpName = /* @__PURE__ */ __name((opName) => {
|
|
|
7842
7850
|
break;
|
|
7843
7851
|
case "createOne":
|
|
7844
7852
|
case "createMany":
|
|
7853
|
+
case "createManyAndReturn":
|
|
7845
7854
|
case "deleteOne":
|
|
7846
7855
|
case "updateOne":
|
|
7847
7856
|
case "deleteMany":
|
|
7848
7857
|
case "updateMany":
|
|
7858
|
+
case "updateManyAndReturn":
|
|
7849
7859
|
case "upsertOne":
|
|
7850
7860
|
procType = "mutation";
|
|
7851
7861
|
break;
|
|
@@ -11631,7 +11641,10 @@ async function generate(options) {
|
|
|
11631
11641
|
consoleLog(`Skipping model ${model} as it is hidden`);
|
|
11632
11642
|
continue;
|
|
11633
11643
|
}
|
|
11634
|
-
const modelActions = Object.keys(operations).filter((opType) =>
|
|
11644
|
+
const modelActions = Object.keys(operations).filter((opType) => (
|
|
11645
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
11646
|
+
config.generateModelActions.some((generateModelAction) => generateModelAction === opType.replace("One", ""))
|
|
11647
|
+
));
|
|
11635
11648
|
if (!modelActions.length) {
|
|
11636
11649
|
consoleLog(`Skipping model ${model} as it has no actions to generate`);
|
|
11637
11650
|
continue;
|