prisma-nestjs-graphql 15.2.1 → 15.2.4
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/README.md +1 -1
- package/index.js +63 -2
- package/package.json +35 -35
package/README.md
CHANGED
|
@@ -659,7 +659,7 @@ export class User {}
|
|
|
659
659
|
## Resources
|
|
660
660
|
|
|
661
661
|
- Todo - https://github.com/unlight/prisma-nestjs-graphql/issues/2
|
|
662
|
-
- https://github.com/prisma/prisma/blob/
|
|
662
|
+
- https://github.com/prisma/prisma/blob/main/packages/client/src/generation/TSClient/TSClient.ts
|
|
663
663
|
- https://ts-ast-viewer.com/
|
|
664
664
|
- https://github.com/unlight/nestjs-graphql-prisma-realworld-example-app
|
|
665
665
|
- https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-schema/data-model
|
package/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var import_lodash = require("lodash");
|
|
|
29
29
|
function pascalCase(string) {
|
|
30
30
|
return (0, import_lodash.startCase)((0, import_lodash.camelCase)(string)).replace(/ /g, "");
|
|
31
31
|
}
|
|
32
|
+
__name(pascalCase, "pascalCase");
|
|
32
33
|
|
|
33
34
|
// src/handlers/args-type.ts
|
|
34
35
|
function argsType(field, args) {
|
|
@@ -101,18 +102,21 @@ function argsType(field, args) {
|
|
|
101
102
|
classDecoratorName: "ArgsType"
|
|
102
103
|
});
|
|
103
104
|
}
|
|
105
|
+
__name(argsType, "argsType");
|
|
104
106
|
|
|
105
107
|
// src/handlers/combine-scalar-filters.ts
|
|
106
108
|
function combineScalarFilters(eventEmitter) {
|
|
107
109
|
eventEmitter.on("BeforeInputType", beforeInputType);
|
|
108
110
|
eventEmitter.on("BeforeGenerateField", beforeGenerateField);
|
|
109
111
|
}
|
|
112
|
+
__name(combineScalarFilters, "combineScalarFilters");
|
|
110
113
|
function beforeInputType(args) {
|
|
111
114
|
const { inputType: inputType2 } = args;
|
|
112
115
|
if (isContainBogus(inputType2.name) && isScalarFilter(inputType2)) {
|
|
113
116
|
inputType2.name = replaceBogus(String(inputType2.name));
|
|
114
117
|
}
|
|
115
118
|
}
|
|
119
|
+
__name(beforeInputType, "beforeInputType");
|
|
116
120
|
function beforeGenerateField(field) {
|
|
117
121
|
for (const fieldInput of field.inputTypes) {
|
|
118
122
|
if (fieldInput.location !== "inputObjectTypes") {
|
|
@@ -124,12 +128,15 @@ function beforeGenerateField(field) {
|
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
130
|
}
|
|
131
|
+
__name(beforeGenerateField, "beforeGenerateField");
|
|
127
132
|
function replaceBogus(name) {
|
|
128
133
|
return name.replace(/(Nullable|Nested)/g, "");
|
|
129
134
|
}
|
|
135
|
+
__name(replaceBogus, "replaceBogus");
|
|
130
136
|
function isContainBogus(name) {
|
|
131
137
|
return name.startsWith("Nested") || name.includes("Nullable") && name.endsWith("Filter") || name.endsWith("NullableFilter");
|
|
132
138
|
}
|
|
139
|
+
__name(isContainBogus, "isContainBogus");
|
|
133
140
|
function isScalarFilter(inputType2) {
|
|
134
141
|
if (!inputType2.name.endsWith("Filter")) {
|
|
135
142
|
return false;
|
|
@@ -146,6 +153,7 @@ function isScalarFilter(inputType2) {
|
|
|
146
153
|
}
|
|
147
154
|
return result;
|
|
148
155
|
}
|
|
156
|
+
__name(isScalarFilter, "isScalarFilter");
|
|
149
157
|
|
|
150
158
|
// src/handlers/create-aggregate-input.ts
|
|
151
159
|
function createAggregateInput(args) {
|
|
@@ -180,11 +188,13 @@ function createAggregateInput(args) {
|
|
|
180
188
|
classDecoratorName: "InputType"
|
|
181
189
|
});
|
|
182
190
|
}
|
|
191
|
+
__name(createAggregateInput, "createAggregateInput");
|
|
183
192
|
|
|
184
193
|
// src/handlers/emit-single.ts
|
|
185
194
|
function emitSingle(emitter) {
|
|
186
195
|
emitter.on("ClassProperty", classProperty);
|
|
187
196
|
}
|
|
197
|
+
__name(emitSingle, "emitSingle");
|
|
188
198
|
function classProperty(property, eventArguments) {
|
|
189
199
|
const { location, isList, propertyType } = eventArguments;
|
|
190
200
|
if ([
|
|
@@ -198,6 +208,7 @@ function classProperty(property, eventArguments) {
|
|
|
198
208
|
}
|
|
199
209
|
}
|
|
200
210
|
}
|
|
211
|
+
__name(classProperty, "classProperty");
|
|
201
212
|
|
|
202
213
|
// src/handlers/generate-files.ts
|
|
203
214
|
var import_assert = require("assert");
|
|
@@ -262,6 +273,7 @@ var ImportDeclarationMap = class extends Map {
|
|
|
262
273
|
}
|
|
263
274
|
}
|
|
264
275
|
};
|
|
276
|
+
__name(ImportDeclarationMap, "ImportDeclarationMap");
|
|
265
277
|
|
|
266
278
|
// src/handlers/generate-files.ts
|
|
267
279
|
async function generateFiles(args) {
|
|
@@ -364,6 +376,7 @@ async function generateFiles(args) {
|
|
|
364
376
|
await project.save();
|
|
365
377
|
}
|
|
366
378
|
}
|
|
379
|
+
__name(generateFiles, "generateFiles");
|
|
367
380
|
|
|
368
381
|
// src/handlers/input-type.ts
|
|
369
382
|
var import_assert2 = require("assert");
|
|
@@ -384,6 +397,7 @@ function fileTypeByLocation(fieldLocation) {
|
|
|
384
397
|
}
|
|
385
398
|
return "object";
|
|
386
399
|
}
|
|
400
|
+
__name(fileTypeByLocation, "fileTypeByLocation");
|
|
387
401
|
|
|
388
402
|
// src/helpers/relative-path.ts
|
|
389
403
|
var import_get_relative_path = __toESM(require("get-relative-path"));
|
|
@@ -403,6 +417,7 @@ function relativePath(from, to) {
|
|
|
403
417
|
}
|
|
404
418
|
return result;
|
|
405
419
|
}
|
|
420
|
+
__name(relativePath, "relativePath");
|
|
406
421
|
|
|
407
422
|
// src/helpers/get-graphql-import.ts
|
|
408
423
|
function getGraphqlImport(args) {
|
|
@@ -468,6 +483,7 @@ function getGraphqlImport(args) {
|
|
|
468
483
|
specifier
|
|
469
484
|
};
|
|
470
485
|
}
|
|
486
|
+
__name(getGraphqlImport, "getGraphqlImport");
|
|
471
487
|
|
|
472
488
|
// src/helpers/get-graphql-input-type.ts
|
|
473
489
|
var import_lodash2 = require("lodash");
|
|
@@ -478,6 +494,7 @@ function getGraphqlInputType(inputTypes, pattern) {
|
|
|
478
494
|
"null",
|
|
479
495
|
"Null"
|
|
480
496
|
].includes(String(t.type)));
|
|
497
|
+
inputTypes = (0, import_lodash2.uniqWith)(inputTypes, import_lodash2.isEqual);
|
|
481
498
|
if (inputTypes.length === 1) {
|
|
482
499
|
return inputTypes[0];
|
|
483
500
|
}
|
|
@@ -517,6 +534,7 @@ function getGraphqlInputType(inputTypes, pattern) {
|
|
|
517
534
|
}
|
|
518
535
|
throw new TypeError(`Cannot get matching input type from ${inputTypes.map((x) => x.type).join(", ") || "zero length inputTypes"}`);
|
|
519
536
|
}
|
|
537
|
+
__name(getGraphqlInputType, "getGraphqlInputType");
|
|
520
538
|
|
|
521
539
|
// src/helpers/get-property-type.ts
|
|
522
540
|
function getPropertyType(args) {
|
|
@@ -584,6 +602,7 @@ function getPropertyType(args) {
|
|
|
584
602
|
"unknown"
|
|
585
603
|
];
|
|
586
604
|
}
|
|
605
|
+
__name(getPropertyType, "getPropertyType");
|
|
587
606
|
|
|
588
607
|
// src/helpers/property-structure.ts
|
|
589
608
|
var import_ts_morph3 = require("ts-morph");
|
|
@@ -600,6 +619,7 @@ function propertyStructure(args) {
|
|
|
600
619
|
leadingTrivia: "\n"
|
|
601
620
|
};
|
|
602
621
|
}
|
|
622
|
+
__name(propertyStructure, "propertyStructure");
|
|
603
623
|
|
|
604
624
|
// src/handlers/input-type.ts
|
|
605
625
|
function inputType(args) {
|
|
@@ -647,6 +667,9 @@ function inputType(args) {
|
|
|
647
667
|
field.inputTypes = field.inputTypes.filter((t) => !removeTypes.has(String(t.type)));
|
|
648
668
|
eventEmitter.emitSync("BeforeGenerateField", field, args);
|
|
649
669
|
const { inputTypes, isRequired, name } = field;
|
|
670
|
+
if (inputTypes.length === 0) {
|
|
671
|
+
continue;
|
|
672
|
+
}
|
|
650
673
|
const usePattern = (useInputType == null ? void 0 : useInputType.ALL) || (useInputType == null ? void 0 : useInputType[name]);
|
|
651
674
|
const graphqlInputType = getGraphqlInputType(inputTypes, usePattern);
|
|
652
675
|
const { isList, location, type } = graphqlInputType;
|
|
@@ -767,6 +790,7 @@ function inputType(args) {
|
|
|
767
790
|
]
|
|
768
791
|
});
|
|
769
792
|
}
|
|
793
|
+
__name(inputType, "inputType");
|
|
770
794
|
|
|
771
795
|
// src/helpers/object-settings.ts
|
|
772
796
|
var import_json52 = __toESM(require("json5"));
|
|
@@ -826,6 +850,7 @@ var ObjectSettings = class extends Array {
|
|
|
826
850
|
return resultArguments.map((x) => import_json52.default.stringify(x));
|
|
827
851
|
}
|
|
828
852
|
};
|
|
853
|
+
__name(ObjectSettings, "ObjectSettings");
|
|
829
854
|
function createObjectSettings(args) {
|
|
830
855
|
var _a, _b, _c, _d, _e;
|
|
831
856
|
const { config, text } = args;
|
|
@@ -898,6 +923,7 @@ function createObjectSettings(args) {
|
|
|
898
923
|
documentation: documentationLines.filter(Boolean).join("\\n") || void 0
|
|
899
924
|
};
|
|
900
925
|
}
|
|
926
|
+
__name(createObjectSettings, "createObjectSettings");
|
|
901
927
|
function customType(args) {
|
|
902
928
|
var _a;
|
|
903
929
|
const result = {};
|
|
@@ -920,6 +946,7 @@ function customType(args) {
|
|
|
920
946
|
}
|
|
921
947
|
return result;
|
|
922
948
|
}
|
|
949
|
+
__name(customType, "customType");
|
|
923
950
|
function hideFieldDecorator(match) {
|
|
924
951
|
var _a;
|
|
925
952
|
const result = {
|
|
@@ -953,6 +980,7 @@ function hideFieldDecorator(match) {
|
|
|
953
980
|
}
|
|
954
981
|
return result;
|
|
955
982
|
}
|
|
983
|
+
__name(hideFieldDecorator, "hideFieldDecorator");
|
|
956
984
|
function parseArgs(string) {
|
|
957
985
|
try {
|
|
958
986
|
return import_json52.default.parse(string);
|
|
@@ -964,6 +992,7 @@ function parseArgs(string) {
|
|
|
964
992
|
}
|
|
965
993
|
}
|
|
966
994
|
}
|
|
995
|
+
__name(parseArgs, "parseArgs");
|
|
967
996
|
function getNamespace(name) {
|
|
968
997
|
if (name === void 0) {
|
|
969
998
|
return void 0;
|
|
@@ -974,6 +1003,7 @@ function getNamespace(name) {
|
|
|
974
1003
|
}
|
|
975
1004
|
return result;
|
|
976
1005
|
}
|
|
1006
|
+
__name(getNamespace, "getNamespace");
|
|
977
1007
|
|
|
978
1008
|
// src/handlers/model-data.ts
|
|
979
1009
|
function modelData(model, args) {
|
|
@@ -996,6 +1026,7 @@ function modelData(model, args) {
|
|
|
996
1026
|
modelFieldsValue.set(field.name, field);
|
|
997
1027
|
}
|
|
998
1028
|
}
|
|
1029
|
+
__name(modelData, "modelData");
|
|
999
1030
|
|
|
1000
1031
|
// src/handlers/model-output-type.ts
|
|
1001
1032
|
var import_assert3 = require("assert");
|
|
@@ -1008,6 +1039,7 @@ var import_ts_morph5 = require("ts-morph");
|
|
|
1008
1039
|
function getOutputTypeName(name) {
|
|
1009
1040
|
return name.replace(/(?:OutputType|Output)$/, "");
|
|
1010
1041
|
}
|
|
1042
|
+
__name(getOutputTypeName, "getOutputTypeName");
|
|
1011
1043
|
|
|
1012
1044
|
// src/handlers/model-output-type.ts
|
|
1013
1045
|
var nestjsGraphql = "@nestjs/graphql";
|
|
@@ -1213,20 +1245,24 @@ function modelOutputType(outputType2, args) {
|
|
|
1213
1245
|
});
|
|
1214
1246
|
}
|
|
1215
1247
|
}
|
|
1248
|
+
__name(modelOutputType, "modelOutputType");
|
|
1216
1249
|
function shouldBeDecorated(setting) {
|
|
1217
1250
|
return setting.kind === "Decorator" && (setting.output || setting.model) && !(setting.output && setting.model);
|
|
1218
1251
|
}
|
|
1252
|
+
__name(shouldBeDecorated, "shouldBeDecorated");
|
|
1219
1253
|
function getExportDeclaration(name, statements) {
|
|
1220
1254
|
return statements.find((structure) => {
|
|
1221
1255
|
return structure.kind === import_ts_morph5.StructureKind.ExportDeclaration && structure.namedExports.some((o) => (o.alias || o.name) === name);
|
|
1222
1256
|
});
|
|
1223
1257
|
}
|
|
1258
|
+
__name(getExportDeclaration, "getExportDeclaration");
|
|
1224
1259
|
|
|
1225
1260
|
// src/handlers/no-atomic-operations.ts
|
|
1226
1261
|
function noAtomicOperations(eventEmitter) {
|
|
1227
1262
|
eventEmitter.on("BeforeInputType", beforeInputType2);
|
|
1228
1263
|
eventEmitter.on("BeforeGenerateFiles", beforeGenerateFiles);
|
|
1229
1264
|
}
|
|
1265
|
+
__name(noAtomicOperations, "noAtomicOperations");
|
|
1230
1266
|
function beforeInputType2(args) {
|
|
1231
1267
|
const { inputType: inputType1 } = args;
|
|
1232
1268
|
for (const field of inputType1.fields) {
|
|
@@ -1249,9 +1285,11 @@ function beforeGenerateFiles(args) {
|
|
|
1249
1285
|
}
|
|
1250
1286
|
}
|
|
1251
1287
|
}
|
|
1288
|
+
__name(beforeGenerateFiles, "beforeGenerateFiles");
|
|
1252
1289
|
function isAtomicOperation(name) {
|
|
1253
1290
|
return name.endsWith("FieldUpdateOperationsInput");
|
|
1254
1291
|
}
|
|
1292
|
+
__name(isAtomicOperation, "isAtomicOperation");
|
|
1255
1293
|
|
|
1256
1294
|
// src/handlers/output-type.ts
|
|
1257
1295
|
var import_assert4 = require("assert");
|
|
@@ -1405,6 +1443,7 @@ function outputType(outputType1, args) {
|
|
|
1405
1443
|
]
|
|
1406
1444
|
});
|
|
1407
1445
|
}
|
|
1446
|
+
__name(outputType, "outputType");
|
|
1408
1447
|
|
|
1409
1448
|
// src/handlers/purge-output.ts
|
|
1410
1449
|
var import_fs = require("fs");
|
|
@@ -1412,6 +1451,7 @@ function purgeOutput(emitter) {
|
|
|
1412
1451
|
emitter.on("Begin", begin);
|
|
1413
1452
|
emitter.on("End", end);
|
|
1414
1453
|
}
|
|
1454
|
+
__name(purgeOutput, "purgeOutput");
|
|
1415
1455
|
function begin({ project, output }) {
|
|
1416
1456
|
var _a;
|
|
1417
1457
|
const sourceFiles = (_a = project.getDirectory(output)) == null ? void 0 : _a.getDescendantSourceFiles();
|
|
@@ -1421,6 +1461,7 @@ function begin({ project, output }) {
|
|
|
1421
1461
|
}
|
|
1422
1462
|
}
|
|
1423
1463
|
}
|
|
1464
|
+
__name(begin, "begin");
|
|
1424
1465
|
async function end({ project, output }) {
|
|
1425
1466
|
var _a;
|
|
1426
1467
|
const directories = (_a = project.getDirectory(output)) == null ? void 0 : _a.getDescendantDirectories().filter((directory) => directory.getSourceFiles().length === 0).map((directory) => directory.getPath());
|
|
@@ -1431,6 +1472,7 @@ async function end({ project, output }) {
|
|
|
1431
1472
|
}
|
|
1432
1473
|
}
|
|
1433
1474
|
}
|
|
1475
|
+
__name(end, "end");
|
|
1434
1476
|
|
|
1435
1477
|
// src/handlers/re-export.ts
|
|
1436
1478
|
var import_ts_morph7 = require("ts-morph");
|
|
@@ -1444,6 +1486,7 @@ var ReExport;
|
|
|
1444
1486
|
function reExport(emitter) {
|
|
1445
1487
|
emitter.on("BeforeGenerateFiles", beforeGenerateFiles2);
|
|
1446
1488
|
}
|
|
1489
|
+
__name(reExport, "reExport");
|
|
1447
1490
|
function beforeGenerateFiles2(args) {
|
|
1448
1491
|
const { project, output, config } = args;
|
|
1449
1492
|
const rootDirectory = project.getDirectoryOrThrow(output);
|
|
@@ -1514,6 +1557,7 @@ function getNamespaceExportDeclaration(directory, sourceDirectory) {
|
|
|
1514
1557
|
moduleSpecifier: directory.getRelativePathAsModuleSpecifierTo(sourceDirectory)
|
|
1515
1558
|
};
|
|
1516
1559
|
}
|
|
1560
|
+
__name(getNamespaceExportDeclaration, "getNamespaceExportDeclaration");
|
|
1517
1561
|
|
|
1518
1562
|
// src/handlers/register-enum.ts
|
|
1519
1563
|
var import_ts_morph8 = require("ts-morph");
|
|
@@ -1551,11 +1595,13 @@ function registerEnum(enumType, args) {
|
|
|
1551
1595
|
]
|
|
1552
1596
|
});
|
|
1553
1597
|
}
|
|
1598
|
+
__name(registerEnum, "registerEnum");
|
|
1554
1599
|
|
|
1555
1600
|
// src/handlers/require-single-fields-in-whereunique-input.ts
|
|
1556
1601
|
function requireSingleFieldsInWhereUniqueInput(eventEmitter) {
|
|
1557
1602
|
eventEmitter.on("BeforeInputType", beforeInputType3);
|
|
1558
1603
|
}
|
|
1604
|
+
__name(requireSingleFieldsInWhereUniqueInput, "requireSingleFieldsInWhereUniqueInput");
|
|
1559
1605
|
function beforeInputType3(args) {
|
|
1560
1606
|
const { inputType: inputType2 } = args;
|
|
1561
1607
|
if (!isWhereUniqueInputType(inputType2.name) || inputType2.fields.length !== 1) {
|
|
@@ -1570,6 +1616,7 @@ __name(beforeInputType3, "beforeInputType");
|
|
|
1570
1616
|
function isWhereUniqueInputType(name) {
|
|
1571
1617
|
return name.endsWith("WhereUniqueInput");
|
|
1572
1618
|
}
|
|
1619
|
+
__name(isWhereUniqueInputType, "isWhereUniqueInputType");
|
|
1573
1620
|
|
|
1574
1621
|
// src/handlers/warning.ts
|
|
1575
1622
|
function warning(message) {
|
|
@@ -1580,6 +1627,7 @@ function warning(message) {
|
|
|
1580
1627
|
console.log("prisma-nestjs-graphql:", message);
|
|
1581
1628
|
}
|
|
1582
1629
|
}
|
|
1630
|
+
__name(warning, "warning");
|
|
1583
1631
|
|
|
1584
1632
|
// src/helpers/create-config.ts
|
|
1585
1633
|
var import_assert5 = require("assert");
|
|
@@ -1663,6 +1711,7 @@ function createConfig(data) {
|
|
|
1663
1711
|
decorate
|
|
1664
1712
|
};
|
|
1665
1713
|
}
|
|
1714
|
+
__name(createConfig, "createConfig");
|
|
1666
1715
|
var tsConfigFileExists = (0, import_lodash7.memoize)((filePath) => {
|
|
1667
1716
|
return (0, import_fs2.existsSync)(filePath);
|
|
1668
1717
|
});
|
|
@@ -1672,6 +1721,7 @@ function createTsConfigFilePathValue(value) {
|
|
|
1672
1721
|
if (tsConfigFileExists("tsconfig.json"))
|
|
1673
1722
|
return "tsconfig.json";
|
|
1674
1723
|
}
|
|
1724
|
+
__name(createTsConfigFilePathValue, "createTsConfigFilePathValue");
|
|
1675
1725
|
function createUseInputType(data) {
|
|
1676
1726
|
if (!data) {
|
|
1677
1727
|
return [];
|
|
@@ -1693,6 +1743,7 @@ function createUseInputType(data) {
|
|
|
1693
1743
|
}
|
|
1694
1744
|
return result;
|
|
1695
1745
|
}
|
|
1746
|
+
__name(createUseInputType, "createUseInputType");
|
|
1696
1747
|
function toBoolean(value) {
|
|
1697
1748
|
return [
|
|
1698
1749
|
"true",
|
|
@@ -1700,6 +1751,7 @@ function toBoolean(value) {
|
|
|
1700
1751
|
"on"
|
|
1701
1752
|
].includes(String(value));
|
|
1702
1753
|
}
|
|
1754
|
+
__name(toBoolean, "toBoolean");
|
|
1703
1755
|
|
|
1704
1756
|
// src/helpers/generate-file-name.ts
|
|
1705
1757
|
var import_lodash8 = require("lodash");
|
|
@@ -1734,11 +1786,12 @@ function generateFileName(args) {
|
|
|
1734
1786
|
}
|
|
1735
1787
|
});
|
|
1736
1788
|
}
|
|
1789
|
+
__name(generateFileName, "generateFileName");
|
|
1737
1790
|
|
|
1738
1791
|
// src/helpers/factory-get-source-file.ts
|
|
1739
1792
|
function factoryGetSourceFile(args1) {
|
|
1740
1793
|
const { outputFilePattern, output, getModelName: getModelName2, project } = args1;
|
|
1741
|
-
return function getSourceFile(args) {
|
|
1794
|
+
return /* @__PURE__ */ __name(function getSourceFile(args) {
|
|
1742
1795
|
const { name, type } = args;
|
|
1743
1796
|
let filePath = generateFileName({
|
|
1744
1797
|
getModelName: getModelName2,
|
|
@@ -1750,8 +1803,9 @@ function factoryGetSourceFile(args1) {
|
|
|
1750
1803
|
return project.getSourceFile(filePath) || project.createSourceFile(filePath, void 0, {
|
|
1751
1804
|
overwrite: true
|
|
1752
1805
|
});
|
|
1753
|
-
};
|
|
1806
|
+
}, "getSourceFile");
|
|
1754
1807
|
}
|
|
1808
|
+
__name(factoryGetSourceFile, "factoryGetSourceFile");
|
|
1755
1809
|
|
|
1756
1810
|
// src/helpers/get-model-name.ts
|
|
1757
1811
|
var import_lodash9 = require("lodash");
|
|
@@ -1763,7 +1817,9 @@ function createGetModelName(modelNames) {
|
|
|
1763
1817
|
name
|
|
1764
1818
|
});
|
|
1765
1819
|
}
|
|
1820
|
+
__name(tryGetName, "tryGetName");
|
|
1766
1821
|
}
|
|
1822
|
+
__name(createGetModelName, "createGetModelName");
|
|
1767
1823
|
function getModelName(args) {
|
|
1768
1824
|
const { name, modelNames } = args;
|
|
1769
1825
|
for (const keyword of splitKeywords) {
|
|
@@ -1801,6 +1857,7 @@ function getModelName(args) {
|
|
|
1801
1857
|
}
|
|
1802
1858
|
return void 0;
|
|
1803
1859
|
}
|
|
1860
|
+
__name(getModelName, "getModelName");
|
|
1804
1861
|
var splitKeywords = [
|
|
1805
1862
|
"CreateInput",
|
|
1806
1863
|
"CreateMany",
|
|
@@ -1986,6 +2043,9 @@ async function generate(args) {
|
|
|
1986
2043
|
for (const model of datamodel.models) {
|
|
1987
2044
|
await eventEmitter.emit("Model", model, eventArguments);
|
|
1988
2045
|
}
|
|
2046
|
+
for (const model1 of datamodel.types) {
|
|
2047
|
+
await eventEmitter.emit("Model", model1, eventArguments);
|
|
2048
|
+
}
|
|
1989
2049
|
await eventEmitter.emit("PostBegin", eventArguments);
|
|
1990
2050
|
for (const enumType of enumTypes.prisma.concat(enumTypes.model || [])) {
|
|
1991
2051
|
await eventEmitter.emit("EnumType", enumType, eventArguments);
|
|
@@ -2031,6 +2091,7 @@ async function generate(args) {
|
|
|
2031
2091
|
eventEmitter.off(name);
|
|
2032
2092
|
}
|
|
2033
2093
|
}
|
|
2094
|
+
__name(generate, "generate");
|
|
2034
2095
|
|
|
2035
2096
|
// src/index.ts
|
|
2036
2097
|
(0, import_generator_helper.generatorHandler)({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prisma-nestjs-graphql",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Generate object types, inputs, args, etc. from prisma schema file for usage with @nestjs/graphql module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"test": "npm run eslint && npm run tscheck && npm run test:cov",
|
|
25
|
-
"mocha": "node node_modules/mocha/bin/
|
|
26
|
-
"test:r": "mocha -r
|
|
25
|
+
"mocha": "node node_modules/mocha/bin/mocha",
|
|
26
|
+
"test:r": "npm run mocha -- -r ts-node/register src/**/*.spec.ts",
|
|
27
27
|
"test:cov": "c8 --reporter text --exclude \"**/*.spec.ts\" --exclude \"**/test/**\" npm run test:r -- --no-timeouts",
|
|
28
|
-
"test:w": "
|
|
28
|
+
"test:w": "npm run test:r -- --watch-files src --watch --timeout=10s",
|
|
29
29
|
"test:d": "ndb -r @swc/register node_modules/mocha/bin/_mocha --no-timeouts --watch-files src/**/*.ts --watch src/**/*.spec.ts",
|
|
30
30
|
"tscheck": "tsc --noEmit",
|
|
31
31
|
"tscheck:w": "npm run tscheck -- --watch",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@nestjs/apollo": "^10.0.
|
|
55
|
-
"@prisma/generator-helper": "^3.
|
|
54
|
+
"@nestjs/apollo": "^10.0.9",
|
|
55
|
+
"@prisma/generator-helper": "^3.13.0",
|
|
56
56
|
"await-event-emitter": "^2.0.2",
|
|
57
57
|
"filenamify": "4.X",
|
|
58
58
|
"flat": "^5.0.2",
|
|
59
59
|
"get-relative-path": "^1.0.2",
|
|
60
|
-
"json5": "^2.2.
|
|
60
|
+
"json5": "^2.2.1",
|
|
61
61
|
"lodash": "^4.17.21",
|
|
62
62
|
"outmatch": "^0.7.0",
|
|
63
63
|
"pluralize": "^8.0.0",
|
|
@@ -65,55 +65,55 @@
|
|
|
65
65
|
"ts-morph": ">=11"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@commitlint/cli": "^16.2.
|
|
69
|
-
"@commitlint/config-conventional": "^16.2.
|
|
70
|
-
"@nestjs/common": "^8.4.
|
|
71
|
-
"@nestjs/core": "^8.4.
|
|
72
|
-
"@nestjs/graphql": "^10.0.
|
|
73
|
-
"@nestjs/platform-express": "^8.4.
|
|
68
|
+
"@commitlint/cli": "^16.2.4",
|
|
69
|
+
"@commitlint/config-conventional": "^16.2.4",
|
|
70
|
+
"@nestjs/common": "^8.4.4",
|
|
71
|
+
"@nestjs/core": "^8.4.4",
|
|
72
|
+
"@nestjs/graphql": "^10.0.10",
|
|
73
|
+
"@nestjs/platform-express": "^8.4.4",
|
|
74
74
|
"@paljs/plugins": "^4.0.18",
|
|
75
|
-
"@prisma/client": "^3.
|
|
75
|
+
"@prisma/client": "^3.13.0",
|
|
76
76
|
"@semantic-release/changelog": "^6.0.1",
|
|
77
77
|
"@semantic-release/git": "^10.0.1",
|
|
78
|
-
"@swc/core": "^1.2.
|
|
79
|
-
"@swc/helpers": "^0.3.
|
|
78
|
+
"@swc/core": "^1.2.174",
|
|
79
|
+
"@swc/helpers": "^0.3.10",
|
|
80
80
|
"@swc/register": "^0.1.10",
|
|
81
81
|
"@types/flat": "^5.0.2",
|
|
82
|
-
"@types/lodash": "^4.14.
|
|
83
|
-
"@types/mocha": "^9.1.
|
|
84
|
-
"@types/node": "^17.0.
|
|
82
|
+
"@types/lodash": "^4.14.182",
|
|
83
|
+
"@types/mocha": "^9.1.1",
|
|
84
|
+
"@types/node": "^17.0.31",
|
|
85
85
|
"@types/pluralize": "^0.0.29",
|
|
86
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
87
|
-
"@typescript-eslint/parser": "^5.
|
|
88
|
-
"apollo-server-express": "^3.6.
|
|
89
|
-
"c8": "^7.11.
|
|
86
|
+
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
|
87
|
+
"@typescript-eslint/parser": "^5.21.0",
|
|
88
|
+
"apollo-server-express": "^3.6.7",
|
|
89
|
+
"c8": "^7.11.2",
|
|
90
90
|
"class-transformer": "^0.5.1",
|
|
91
91
|
"class-validator": "^0.13.2",
|
|
92
92
|
"commitizen": "^4.2.4",
|
|
93
93
|
"cz-customizable": "^6.3.0",
|
|
94
94
|
"decimal.js": "^10.3.1",
|
|
95
|
-
"eslint": "^8.
|
|
95
|
+
"eslint": "^8.14.0",
|
|
96
96
|
"eslint-import-resolver-node": "^0.3.6",
|
|
97
97
|
"eslint-plugin-etc": "^2.0.2",
|
|
98
|
-
"eslint-plugin-import": "^2.
|
|
98
|
+
"eslint-plugin-import": "^2.26.0",
|
|
99
99
|
"eslint-plugin-only-warn": "^1.0.3",
|
|
100
100
|
"eslint-plugin-prettier": "^4.0.0",
|
|
101
|
-
"eslint-plugin-regexp": "^1.
|
|
101
|
+
"eslint-plugin-regexp": "^1.7.0",
|
|
102
102
|
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
103
103
|
"eslint-plugin-sort-class-members": "^1.14.1",
|
|
104
|
-
"eslint-plugin-unicorn": "^
|
|
104
|
+
"eslint-plugin-unicorn": "^42.0.0",
|
|
105
105
|
"eslint-plugin-wix-editor": "^3.3.0",
|
|
106
|
-
"expect": "^
|
|
106
|
+
"expect": "^28.0.2",
|
|
107
107
|
"ghooks": "^2.0.4",
|
|
108
108
|
"git-branch-is": "^4.0.0",
|
|
109
|
-
"graphql": "^16.
|
|
110
|
-
"graphql-scalars": "^1.
|
|
109
|
+
"graphql": "^16.4.0",
|
|
110
|
+
"graphql-scalars": "^1.17.0",
|
|
111
111
|
"graphql-type-json": "^0.3.2",
|
|
112
|
-
"mocha": "^
|
|
112
|
+
"mocha": "^10.0.0",
|
|
113
113
|
"ololog": "^1.1.175",
|
|
114
114
|
"precise-commits": "^1.0.2",
|
|
115
|
-
"prettier": "^2.6.
|
|
116
|
-
"prisma": "^3.
|
|
115
|
+
"prettier": "^2.6.2",
|
|
116
|
+
"prisma": "^3.13.0",
|
|
117
117
|
"prisma-graphql-type-decimal": "^2.0.0",
|
|
118
118
|
"reflect-metadata": "^0.1.13",
|
|
119
119
|
"request": "^2.88.2",
|
|
@@ -123,8 +123,8 @@
|
|
|
123
123
|
"temp-dir": "^2.0.0",
|
|
124
124
|
"ts-node": "^10.7.0",
|
|
125
125
|
"ts-node-dev": "^1.1.8",
|
|
126
|
-
"tslib": "^2.
|
|
127
|
-
"typescript": "^4.6.
|
|
126
|
+
"tslib": "^2.4.0",
|
|
127
|
+
"typescript": "^4.6.4",
|
|
128
128
|
"watchexec-bin": "^1.0.0"
|
|
129
129
|
}
|
|
130
130
|
}
|