prisma-zod-generator 0.8.9 → 0.8.10
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/lib/helpers/helpers.d.ts +1 -1
- package/lib/helpers/helpers.js +4 -2
- package/lib/helpers/helpers.js.map +1 -1
- package/lib/helpers/index.d.ts +1 -0
- package/lib/helpers/index.js +1 -0
- package/lib/helpers/index.js.map +1 -1
- package/lib/helpers/whereUniqueInput-helpers.d.ts +2 -0
- package/lib/helpers/whereUniqueInput-helpers.js +22 -0
- package/lib/helpers/whereUniqueInput-helpers.js.map +1 -0
- package/package.json +1 -1
package/lib/helpers/helpers.d.ts
CHANGED
package/lib/helpers/helpers.js
CHANGED
|
@@ -5,11 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.resolveAddMissingInputObjectTypeOptions = exports.addMissingInputObjectTypes = void 0;
|
|
7
7
|
const transformer_1 = __importDefault(require("../transformer"));
|
|
8
|
-
const mongodb_helpers_1 = require("./mongodb-helpers");
|
|
9
8
|
const aggregate_helpers_1 = require("./aggregate-helpers");
|
|
10
|
-
const select_helpers_1 = require("./select-helpers");
|
|
11
9
|
const include_helpers_1 = require("./include-helpers");
|
|
12
10
|
const modelArgs_helpers_1 = require("./modelArgs-helpers");
|
|
11
|
+
const mongodb_helpers_1 = require("./mongodb-helpers");
|
|
12
|
+
const select_helpers_1 = require("./select-helpers");
|
|
13
|
+
const whereUniqueInput_helpers_1 = require("./whereUniqueInput-helpers");
|
|
13
14
|
function addMissingInputObjectTypes(inputObjectTypes, outputObjectTypes, models, modelOperations, dataSourceProvider, options) {
|
|
14
15
|
// TODO: remove once Prisma fix this issue: https://github.com/prisma/prisma/issues/14900
|
|
15
16
|
if (dataSourceProvider === 'mongodb') {
|
|
@@ -27,6 +28,7 @@ function addMissingInputObjectTypes(inputObjectTypes, outputObjectTypes, models,
|
|
|
27
28
|
(0, include_helpers_1.addMissingInputObjectTypesForInclude)(inputObjectTypes, models, options.isGenerateSelect);
|
|
28
29
|
transformer_1.default.setIsGenerateInclude(true);
|
|
29
30
|
}
|
|
31
|
+
(0, whereUniqueInput_helpers_1.changeOptionalToRequiredFields)(inputObjectTypes);
|
|
30
32
|
}
|
|
31
33
|
exports.addMissingInputObjectTypes = addMissingInputObjectTypes;
|
|
32
34
|
function resolveAddMissingInputObjectTypeOptions(generatorConfigOptions) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers/helpers.ts"],"names":[],"mappings":";;;;;;AACA,iEAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers/helpers.ts"],"names":[],"mappings":";;;;;;AACA,iEAAyC;AACzC,2DAA6E;AAC7E,uDAAyE;AACzE,2DAA6E;AAC7E,uDAAyF;AACzF,qDAAuE;AACvE,yEAA4E;AAO5E,SAAgB,0BAA0B,CACxC,gBAAkC,EAClC,iBAAoC,EACpC,MAAoB,EACpB,eAAoC,EACpC,kBAAiC,EACjC,OAAyC;IAEzC,yFAAyF;IACzF,IAAI,kBAAkB,KAAK,SAAS,EAAE;QACpC,IAAA,sEAAoD,EAClD,eAAe,EACf,iBAAiB,EACjB,gBAAgB,CACjB,CAAC;KACH;IACD,IAAA,0DAAsC,EAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAC5E,IAAI,OAAO,CAAC,gBAAgB,EAAE;QAC5B,IAAA,oDAAmC,EACjC,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,CACP,CAAC;QACF,qBAAW,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;KACvC;IACD,IAAI,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,EAAE;QACzD,IAAA,0DAAsC,EACpC,gBAAgB,EAChB,MAAM,EACN,OAAO,CAAC,gBAAgB,EACxB,OAAO,CAAC,iBAAiB,CAC1B,CAAC;KACH;IACD,IAAI,OAAO,CAAC,iBAAiB,EAAE;QAC7B,IAAA,sDAAoC,EAClC,gBAAgB,EAChB,MAAM,EACN,OAAO,CAAC,gBAAgB,CACzB,CAAC;QACF,qBAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;KACxC;IAED,IAAA,yDAA8B,EAAC,gBAAgB,CAAC,CAAC;AACnD,CAAC;AA3CD,gEA2CC;AAED,SAAgB,uCAAuC,CACrD,sBAA0C;IAE1C,OAAO;QACL,gBAAgB,EAAE,sBAAsB,CAAC,gBAAgB,KAAK,MAAM;QACpE,iBAAiB,EAAE,sBAAsB,CAAC,iBAAiB,KAAK,MAAM;KACvE,CAAC;AACJ,CAAC;AAPD,0FAOC"}
|
package/lib/helpers/index.d.ts
CHANGED
package/lib/helpers/index.js
CHANGED
|
@@ -18,4 +18,5 @@ __exportStar(require("./comments-helpers"), exports);
|
|
|
18
18
|
__exportStar(require("./helpers"), exports);
|
|
19
19
|
__exportStar(require("./model-helpers"), exports);
|
|
20
20
|
__exportStar(require("./mongodb-helpers"), exports);
|
|
21
|
+
__exportStar(require("./whereUniqueInput-helpers"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/lib/helpers/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,4CAA0B;AAC1B,kDAAgC;AAChC,oDAAkC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,4CAA0B;AAC1B,kDAAgC;AAChC,oDAAkC;AAClC,6DAA2C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.changeOptionalToRequiredFields = void 0;
|
|
4
|
+
function changeOptionalToRequiredFields(inputObjectTypes) {
|
|
5
|
+
inputObjectTypes.map((item) => {
|
|
6
|
+
var _a;
|
|
7
|
+
if (item.name.includes('WhereUniqueInput') &&
|
|
8
|
+
((_a = item.constraints.fields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
9
|
+
item.fields = item.fields.map((subItem) => {
|
|
10
|
+
var _a;
|
|
11
|
+
if ((_a = item.constraints.fields) === null || _a === void 0 ? void 0 : _a.includes(subItem.name)) {
|
|
12
|
+
subItem.isRequired = true;
|
|
13
|
+
return subItem;
|
|
14
|
+
}
|
|
15
|
+
return subItem;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return item;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.changeOptionalToRequiredFields = changeOptionalToRequiredFields;
|
|
22
|
+
//# sourceMappingURL=whereUniqueInput-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whereUniqueInput-helpers.js","sourceRoot":"","sources":["../../src/helpers/whereUniqueInput-helpers.ts"],"names":[],"mappings":";;;AAEA,SAAgB,8BAA8B,CAC5C,gBAAkC;IAElC,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;QAC5B,IACE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YACtC,CAAA,MAAA,IAAI,CAAC,WAAW,CAAC,MAAM,0CAAE,MAAO,IAAG,CAAC,EACpC;YACA,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;;gBACxC,IAAI,MAAA,IAAI,CAAC,WAAW,CAAC,MAAM,0CAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBACnD,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;oBAC1B,OAAO,OAAO,CAAC;iBAChB;gBACD,OAAO,OAAO,CAAC;YACjB,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAlBD,wEAkBC"}
|
package/package.json
CHANGED