prisma-nestjs-graphql 20.0.3 → 21.0.0

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 CHANGED
@@ -78,6 +78,8 @@ Default: `@prisma/client`
78
78
 
79
79
  #### `combineScalarFilters`
80
80
 
81
+ DOESNT WORK IN v21+
82
+
81
83
  Combine nested/nullable scalar filters to single
82
84
  Type: `boolean`
83
85
  Default: `false`
@@ -372,6 +374,7 @@ For example:
372
374
  model Product {
373
375
  /// Old description
374
376
  /// @deprecated Use new name instead
377
+ /// @complexity 1
375
378
  oldName String
376
379
  }
377
380
  ```
@@ -388,6 +391,7 @@ export class Product {
388
391
  @Field(() => String, {
389
392
  description: 'Old description',
390
393
  deprecationReason: 'Use new name instead',
394
+ complexity: 1,
391
395
  })
392
396
  oldName: string;
393
397
  }
@@ -726,7 +730,7 @@ model User {
726
730
  export class User {}
727
731
  ```
728
732
 
729
- ### Using lirary in other generators
733
+ ### Using library in other generators
730
734
 
731
735
  ```ts
732
736
  import { generate } from 'prisma-nestjs-graphql/generate';
@@ -755,3 +759,8 @@ import { generate } from 'prisma-nestjs-graphql/generate';
755
759
  - JSON type for the code first approach - https://github.com/nestjs/graphql/issues/111#issuecomment-631452899
756
760
  - https://github.com/paljs/prisma-tools/tree/master/packages/plugins
757
761
  - https://github.com/wasp-lang/wasp
762
+
763
+ ## TODO
764
+
765
+ - keyof typeof SortOrder -> `SortOrder`
766
+ - dummy-createfriends.input.ts -> `create-friends`
package/generate.cjs CHANGED
@@ -16,13 +16,13 @@ var pluralize = require('pluralize');
16
16
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
17
17
  var require$1 = (
18
18
  false
19
- ? /* @__PURE__ */ module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('generate.cjs', document.baseURI).href)))
19
+ ? /* @__PURE__ */ module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('generate.cjs', document.baseURI).href)))
20
20
  : require
21
21
  );
22
22
 
23
- function isCreateManyReturn(name) {
23
+ function isManyAndReturnOutputType(name) {
24
24
  const lowerName = name.toLowerCase();
25
- if (lowerName.startsWith("createmany") && (lowerName.endsWith("andreturnoutputtype") || lowerName.endsWith("andreturn"))) {
25
+ if ((lowerName.startsWith("createmany") || lowerName.startsWith("updatemany")) && (lowerName.endsWith("andreturnoutputtype") || lowerName.endsWith("andreturn"))) {
26
26
  return true;
27
27
  }
28
28
  return false;
@@ -36,8 +36,7 @@ function argsType(field, args) {
36
36
  if (["queryRaw", "executeRaw"].includes(field.name)) {
37
37
  return;
38
38
  }
39
- if (isCreateManyReturn(field.name))
40
- return;
39
+ if (isManyAndReturnOutputType(field.name)) return;
41
40
  const { eventEmitter, typeNames, getModelName } = args;
42
41
  let className = pascalCase(`${field.name}Args`);
43
42
  const modelName = getModelName(className) || "";
@@ -61,7 +60,7 @@ function argsType(field, args) {
61
60
  const names = ["Count", "Avg", "Sum", "Min", "Max"];
62
61
  if (`${modelName}GroupByArgs` === inputType.name) {
63
62
  const byField = inputType.fields.find((f) => f.name === "by");
64
- if (byField == null ? void 0 : byField.inputTypes) {
63
+ if (byField?.inputTypes) {
65
64
  byField.inputTypes = byField.inputTypes.filter((inputType2) => inputType2.isList);
66
65
  }
67
66
  }
@@ -136,7 +135,7 @@ function isScalarFilter(inputType) {
136
135
  return result;
137
136
  }
138
137
  function postBegin(args) {
139
- const { schema, modelNames } = args;
138
+ const { modelNames, schema } = args;
140
139
  const inputTypes = schema.inputObjectTypes.prisma;
141
140
  const enumTypes = schema.enumTypes.model || [];
142
141
  const types = [
@@ -195,21 +194,18 @@ function createAggregateInput(args) {
195
194
  // eslint-disable-next-line unicorn/no-null
196
195
  constraints: { maxNumFields: null, minNumFields: null },
197
196
  name: className,
198
- fields: outputType.fields.map((x) => {
199
- var _a;
200
- return {
201
- name: x.name,
202
- isNullable: (_a = x.isNullable) != null ? _a : true,
203
- isRequired: false,
204
- inputTypes: [
205
- {
206
- isList: false,
207
- type: "true",
208
- location: "scalar"
209
- }
210
- ]
211
- };
212
- })
197
+ fields: outputType.fields.map((x) => ({
198
+ name: x.name,
199
+ isNullable: x.isNullable ?? true,
200
+ isRequired: false,
201
+ inputTypes: [
202
+ {
203
+ isList: false,
204
+ type: "true",
205
+ location: "scalar"
206
+ }
207
+ ]
208
+ }))
213
209
  };
214
210
  eventEmitter.emitSync("InputType", {
215
211
  ...args,
@@ -247,8 +243,8 @@ class ImportDeclarationMap extends Map {
247
243
  const value = {
248
244
  moduleSpecifier: from,
249
245
  namedImports: [],
250
- defaultImport: void 0,
251
- namespaceImport: void 0
246
+ defaultImport: undefined,
247
+ namespaceImport: undefined
252
248
  };
253
249
  if (namedImport === true && namespaceImport) {
254
250
  value.namedImports = [{ name: namespaceImport }];
@@ -281,9 +277,8 @@ async function generateFiles(args) {
281
277
  const { project, config, output, eventEmitter } = args;
282
278
  if (config.emitSingle) {
283
279
  const rootDirectory = project.getDirectory(output) || project.createDirectory(output);
284
- const sourceFile = rootDirectory.getSourceFile("index.ts") || rootDirectory.createSourceFile("index.ts", void 0, { overwrite: true });
280
+ const sourceFile = rootDirectory.getSourceFile("index.ts") || rootDirectory.createSourceFile("index.ts", undefined, { overwrite: true });
285
281
  const statements = project.getSourceFiles().flatMap((s) => {
286
- var _a, _b;
287
282
  if (s === sourceFile) {
288
283
  return [];
289
284
  }
@@ -296,7 +291,7 @@ async function generateFiles(args) {
296
291
  }
297
292
  for (const property of statement.properties || []) {
298
293
  for (const decorator of property.decorators || []) {
299
- const fullName = (_b = (_a = classDeclaration == null ? void 0 : classDeclaration.getProperty(property.name)) == null ? void 0 : _a.getDecorator(decorator.name)) == null ? void 0 : _b.getFullName();
294
+ const fullName = classDeclaration?.getProperty(property.name)?.getDecorator(decorator.name)?.getFullName();
300
295
  assert.ok(
301
296
  fullName,
302
297
  `Cannot get full name of decorator of class ${statement.name}`
@@ -435,11 +430,11 @@ function getGraphqlImport(args) {
435
430
  return { name: typeName, specifier: "@nestjs/graphql" };
436
431
  }
437
432
  case "DateTime": {
438
- return { name: "Date", specifier: void 0 };
433
+ return { name: "Date", specifier: undefined };
439
434
  }
440
435
  case "true":
441
436
  case "Boolean": {
442
- return { name: "Boolean", specifier: void 0 };
437
+ return { name: "Boolean", specifier: undefined };
443
438
  }
444
439
  case "Decimal": {
445
440
  return {
@@ -451,7 +446,7 @@ function getGraphqlImport(args) {
451
446
  return { name: "GraphQLJSON", specifier: "graphql-type-json" };
452
447
  }
453
448
  }
454
- return { name: "String", specifier: void 0 };
449
+ return { name: "String", specifier: undefined };
455
450
  }
456
451
  let sourceFileType = fileTypeByLocation(location);
457
452
  if (sourceFileType === "output" && fileType === "model") {
@@ -527,7 +522,7 @@ function getGraphqlInputType(inputTypes, pattern) {
527
522
  }
528
523
 
529
524
  function getPropertyType(args) {
530
- const { type, location } = args;
525
+ const { location, type } = args;
531
526
  switch (type) {
532
527
  case "Float":
533
528
  case "Int": {
@@ -552,7 +547,7 @@ function getPropertyType(args) {
552
547
  return ["null"];
553
548
  }
554
549
  case "Bytes": {
555
- return ["Buffer"];
550
+ return ["Uint8Array"];
556
551
  }
557
552
  case "BigInt": {
558
553
  return ["bigint", "number"];
@@ -603,15 +598,14 @@ function propertyStructure(args) {
603
598
  kind: tsMorph.StructureKind.Property,
604
599
  name,
605
600
  type,
606
- hasQuestionToken: hasQuestionToken != null ? hasQuestionToken : isNullable,
607
- hasExclamationToken: hasExclamationToken != null ? hasExclamationToken : !isNullable,
601
+ hasQuestionToken: hasQuestionToken ?? isNullable,
602
+ hasExclamationToken: hasExclamationToken ?? !isNullable,
608
603
  decorators: [],
609
604
  leadingTrivia: "\n"
610
605
  };
611
606
  }
612
607
 
613
608
  function inputType(args) {
614
- var _a, _b, _c, _d;
615
609
  const {
616
610
  classDecoratorName,
617
611
  classTransformerTypeModels,
@@ -666,33 +660,33 @@ function inputType(args) {
666
660
  if (inputTypes.length === 0) {
667
661
  continue;
668
662
  }
669
- const usePattern = (useInputType == null ? void 0 : useInputType.ALL) || (useInputType == null ? void 0 : useInputType[name]);
663
+ const usePattern = useInputType?.ALL || useInputType?.[name];
670
664
  const graphqlInputType = getGraphqlInputType(inputTypes, usePattern);
671
665
  const { isList, location, type } = graphqlInputType;
672
666
  const typeName = String(type);
673
- const settings = modelFieldSettings == null ? void 0 : modelFieldSettings.get(name);
674
- const propertySettings = settings == null ? void 0 : settings.getPropertyType({
667
+ const settings = modelFieldSettings?.get(name);
668
+ const propertySettings = settings?.getPropertyType({
675
669
  name: inputType2.name,
676
670
  input: true
677
671
  });
678
- const modelField = model == null ? void 0 : model.fields.find((f) => f.name === name);
679
- const isCustomsApplicable = typeName === (modelField == null ? void 0 : modelField.type);
672
+ const modelField = model?.fields.find((f) => f.name === name);
673
+ const isCustomsApplicable = typeName === modelField?.type;
680
674
  const atLeastKeys = model && getWhereUniqueAtLeastKeys(model);
681
675
  const whereUniqueInputType = isWhereUniqueInputType(typeName) && atLeastKeys && `Prisma.AtLeast<${typeName}, ${atLeastKeys.map((name2) => `'${name2}'`).join(" | ")}>`;
682
676
  const propertyType = lodash.castArray(
683
- (propertySettings == null ? void 0 : propertySettings.name) || whereUniqueInputType || getPropertyType({
677
+ propertySettings?.name || whereUniqueInputType || getPropertyType({
684
678
  location,
685
679
  type: typeName
686
680
  })
687
681
  );
688
682
  const hasExclamationToken = Boolean(
689
- isWhereUnique && config.unsafeCompatibleWhereUniqueInput && (atLeastKeys == null ? void 0 : atLeastKeys.includes(name))
683
+ isWhereUnique && config.unsafeCompatibleWhereUniqueInput && atLeastKeys?.includes(name)
690
684
  );
691
685
  const property = propertyStructure({
692
686
  name,
693
687
  isNullable: !isRequired,
694
- hasExclamationToken: hasExclamationToken || void 0,
695
- hasQuestionToken: hasExclamationToken ? false : void 0,
688
+ hasExclamationToken: hasExclamationToken || undefined,
689
+ hasQuestionToken: hasExclamationToken ? false : undefined,
696
690
  propertyType,
697
691
  isList
698
692
  });
@@ -705,13 +699,13 @@ function inputType(args) {
705
699
  importDeclarations.add("Prisma", config.prismaClientImport);
706
700
  }
707
701
  let graphqlType;
708
- const shouldHideField = (settings == null ? void 0 : settings.shouldHideField({
702
+ const shouldHideField = settings?.shouldHideField({
709
703
  name: inputType2.name,
710
704
  input: true
711
- })) || config.decorate.some(
705
+ }) || config.decorate.some(
712
706
  (d) => d.name === "HideField" && d.from === moduleSpecifier && d.isMatchField(name) && d.isMatchType(inputType2.name)
713
707
  );
714
- const fieldType = settings == null ? void 0 : settings.getFieldType({
708
+ const fieldType = settings?.getFieldType({
715
709
  name: inputType2.name,
716
710
  input: true
717
711
  });
@@ -748,7 +742,7 @@ function inputType(args) {
748
742
  arguments: [
749
743
  isList ? `() => [${graphqlType}]` : `() => ${graphqlType}`,
750
744
  JSON5.stringify({
751
- ...settings == null ? void 0 : settings.fieldArguments(),
745
+ ...settings?.fieldArguments(),
752
746
  nullable: !isRequired
753
747
  })
754
748
  ]
@@ -767,7 +761,7 @@ function inputType(args) {
767
761
  arguments: ["transformToDecimal"]
768
762
  }
769
763
  );
770
- } else if (location === "inputObjectTypes" && ((modelField == null ? void 0 : modelField.type) === "Decimal" || [
764
+ } else if (location === "inputObjectTypes" && (modelField?.type === "Decimal" || [
771
765
  "connect",
772
766
  "connectOrCreate",
773
767
  "create",
@@ -781,15 +775,15 @@ function inputType(args) {
781
775
  "updateMany",
782
776
  "upsert",
783
777
  "where"
784
- ].includes(name) || classTransformerTypeModels.has(getModelName(graphqlType) || "") || (modelField == null ? void 0 : modelField.kind) === "object" && models.get(modelField.type) && ((_a = models.get(modelField.type)) == null ? void 0 : _a.fields.some(
778
+ ].includes(name) || classTransformerTypeModels.has(getModelName(graphqlType) || "") || modelField?.kind === "object" && models.get(modelField.type) && models.get(modelField.type)?.fields.some(
785
779
  (field2) => field2.kind === "object" && classTransformerTypeModels.has(field2.type)
786
- )))) {
780
+ ))) {
787
781
  importDeclarations.add("Type", "class-transformer");
788
782
  property.decorators.push({ name: "Type", arguments: [`() => ${graphqlType}`] });
789
783
  }
790
784
  if (isCustomsApplicable) {
791
785
  for (const options of settings || []) {
792
- if ((_c = options.kind === "Decorator" && options.input && ((_b = options.match) == null ? void 0 : _b.call(options, name))) != null ? _c : true) {
786
+ if ((options.kind === "Decorator" && options.input && options.match?.(name)) ?? true) {
793
787
  property.decorators.push({
794
788
  name: options.name,
795
789
  arguments: options.arguments
@@ -803,7 +797,7 @@ function inputType(args) {
803
797
  if (decorate.isMatchField(name) && decorate.isMatchType(inputType2.name)) {
804
798
  property.decorators.push({
805
799
  name: decorate.name,
806
- arguments: (_d = decorate.arguments) == null ? void 0 : _d.map((x) => pupa(x, { propertyType }))
800
+ arguments: decorate.arguments?.map((x) => pupa(x, { propertyType }))
807
801
  });
808
802
  importDeclarations.create(decorate);
809
803
  }
@@ -826,10 +820,9 @@ class ObjectSettings extends Array {
826
820
  input = false,
827
821
  output = false
828
822
  }) {
829
- var _a;
830
823
  const hideField = this.find((s) => s.name === "HideField");
831
824
  return Boolean(
832
- (hideField == null ? void 0 : hideField.input) && input || (hideField == null ? void 0 : hideField.output) && output || ((_a = hideField == null ? void 0 : hideField.match) == null ? void 0 : _a.call(hideField, name))
825
+ hideField?.input && input || hideField?.output && output || hideField?.match?.(name)
833
826
  );
834
827
  }
835
828
  getFieldType({
@@ -839,16 +832,16 @@ class ObjectSettings extends Array {
839
832
  }) {
840
833
  const fieldType = this.find((s) => s.kind === "FieldType");
841
834
  if (!fieldType) {
842
- return void 0;
835
+ return undefined;
843
836
  }
844
837
  if (fieldType.match) {
845
- return fieldType.match(name) ? fieldType : void 0;
838
+ return fieldType.match(name) ? fieldType : undefined;
846
839
  }
847
840
  if (input && !fieldType.input) {
848
- return void 0;
841
+ return undefined;
849
842
  }
850
843
  if (output && !fieldType.output) {
851
- return void 0;
844
+ return undefined;
852
845
  }
853
846
  return fieldType;
854
847
  }
@@ -859,16 +852,16 @@ class ObjectSettings extends Array {
859
852
  }) {
860
853
  const propertyType = this.find((s) => s.kind === "PropertyType");
861
854
  if (!propertyType) {
862
- return void 0;
855
+ return undefined;
863
856
  }
864
857
  if (propertyType.match) {
865
- return propertyType.match(name) ? propertyType : void 0;
858
+ return propertyType.match(name) ? propertyType : undefined;
866
859
  }
867
860
  if (input && !propertyType.input) {
868
- return void 0;
861
+ return undefined;
869
862
  }
870
863
  if (output && !propertyType.output) {
871
- return void 0;
864
+ return undefined;
872
865
  }
873
866
  return propertyType;
874
867
  }
@@ -922,7 +915,7 @@ function createObjectSettings(args) {
922
915
  }
923
916
  return {
924
917
  settings: result,
925
- documentation: documentationLines.filter(Boolean).join("\n") || void 0
918
+ documentation: documentationLines.filter(Boolean).join("\n") || undefined
926
919
  };
927
920
  }
928
921
  function createSettingElement({
@@ -931,17 +924,23 @@ function createSettingElement({
931
924
  fieldElement,
932
925
  match
933
926
  }) {
934
- var _a, _b, _c, _d, _e;
935
927
  const result = {
936
928
  documentLine: "",
937
- element: void 0
929
+ element: undefined
938
930
  };
939
931
  if (line.startsWith("@deprecated")) {
940
932
  fieldElement.arguments["deprecationReason"] = lodash.trim(line.slice(11));
941
933
  result.element = fieldElement;
942
934
  return result;
943
935
  }
944
- const name = (_a = match == null ? void 0 : match.groups) == null ? void 0 : _a.name;
936
+ if (line.startsWith("@complexity")) {
937
+ let n = Number.parseInt(lodash.trim(line.slice(11)));
938
+ if (n !== n || n < 1) n = 1;
939
+ fieldElement.arguments["complexity"] = n;
940
+ result.element = fieldElement;
941
+ return result;
942
+ }
943
+ const name = match?.groups?.name;
945
944
  if (!(match && name)) {
946
945
  result.documentLine = line;
947
946
  return result;
@@ -960,14 +959,14 @@ function createSettingElement({
960
959
  Object.assign(element, hideFieldDecorator(match));
961
960
  return result;
962
961
  }
963
- if (["FieldType", "PropertyType"].includes(name) && ((_b = match.groups) == null ? void 0 : _b.args)) {
962
+ if (["FieldType", "PropertyType"].includes(name) && match.groups?.args) {
964
963
  const options2 = customType(match.groups.args);
965
964
  lodash.merge(element, options2.namespace && config.fields[options2.namespace], options2, {
966
965
  kind: name
967
966
  });
968
967
  return result;
969
968
  }
970
- if (name === "ObjectType" && ((_c = match.groups) == null ? void 0 : _c.args)) {
969
+ if (name === "ObjectType" && match.groups?.args) {
971
970
  element.kind = "ObjectType";
972
971
  const options2 = customType(match.groups.args);
973
972
  if (typeof options2[0] === "string" && options2[0]) {
@@ -982,7 +981,7 @@ function createSettingElement({
982
981
  };
983
982
  return result;
984
983
  }
985
- if (name === "Directive" && ((_d = match.groups) == null ? void 0 : _d.args)) {
984
+ if (name === "Directive" && match.groups?.args) {
986
985
  const options2 = customType(match.groups.args);
987
986
  lodash.merge(element, { model: true, from: "@nestjs/graphql" }, options2, {
988
987
  name,
@@ -996,13 +995,12 @@ function createSettingElement({
996
995
  element.namespaceImport = namespace;
997
996
  const options = {
998
997
  name,
999
- arguments: (((_e = match.groups) == null ? void 0 : _e.args) || "").split(",").map((s) => lodash.trim(s)).filter(Boolean)
998
+ arguments: (match.groups?.args || "").split(",").map((s) => lodash.trim(s)).filter(Boolean)
1000
999
  };
1001
1000
  lodash.merge(element, namespace && config.fields[namespace], options);
1002
1001
  return result;
1003
1002
  }
1004
1003
  function customType(args) {
1005
- var _a;
1006
1004
  const result = {};
1007
1005
  let options = parseArgs(args);
1008
1006
  if (typeof options === "string") {
@@ -1011,7 +1009,7 @@ function customType(args) {
1011
1009
  Object.assign(result, options);
1012
1010
  const namespace = getNamespace(options.name);
1013
1011
  result.namespace = namespace;
1014
- if ((_a = options.name) == null ? void 0 : _a.includes(".")) {
1012
+ if (options.name?.includes(".")) {
1015
1013
  result.namespaceImport = namespace;
1016
1014
  }
1017
1015
  if (typeof options.match === "string" || Array.isArray(options.match)) {
@@ -1020,16 +1018,15 @@ function customType(args) {
1020
1018
  return result;
1021
1019
  }
1022
1020
  function hideFieldDecorator(match) {
1023
- var _a;
1024
1021
  const result = {
1025
1022
  name: "HideField",
1026
1023
  arguments: [],
1027
1024
  from: "@nestjs/graphql",
1028
- defaultImport: void 0,
1029
- namespaceImport: void 0,
1030
- match: void 0
1025
+ defaultImport: undefined,
1026
+ namespaceImport: undefined,
1027
+ match: undefined
1031
1028
  };
1032
- if (!((_a = match.groups) == null ? void 0 : _a.args)) {
1029
+ if (!match.groups?.args) {
1033
1030
  result.output = true;
1034
1031
  return result;
1035
1032
  }
@@ -1062,8 +1059,8 @@ function parseArgs(string) {
1062
1059
  }
1063
1060
  }
1064
1061
  function getNamespace(name) {
1065
- if (name === void 0) {
1066
- return void 0;
1062
+ if (name === undefined) {
1063
+ return undefined;
1067
1064
  }
1068
1065
  let result = String(name);
1069
1066
  if (result.includes(".")) {
@@ -1104,13 +1101,12 @@ function modelData(model, args) {
1104
1101
  }
1105
1102
 
1106
1103
  function createComment(documentation, settings) {
1107
- var _a;
1108
1104
  const documentationLines = documentation.split("\n");
1109
1105
  const commentLines = ["/**"];
1110
1106
  for (const line of documentationLines) {
1111
1107
  commentLines.push(` * ${line}`);
1112
1108
  }
1113
- const deprecationReason = (_a = settings == null ? void 0 : settings.fieldArguments()) == null ? void 0 : _a.deprecationReason;
1109
+ const deprecationReason = settings?.fieldArguments()?.deprecationReason;
1114
1110
  if (deprecationReason) {
1115
1111
  commentLines.push(` * @deprecated ${deprecationReason}`);
1116
1112
  }
@@ -1124,10 +1120,8 @@ function getOutputTypeName(name) {
1124
1120
 
1125
1121
  const nestjsGraphql$1 = "@nestjs/graphql";
1126
1122
  function modelOutputType(outputType, args) {
1127
- var _a, _b, _c, _d, _e, _f;
1128
- const { getSourceFile, models, config, modelFields, fieldSettings, eventEmitter } = args;
1129
- if (isCreateManyReturn(outputType.name))
1130
- return;
1123
+ const { config, eventEmitter, fieldSettings, getSourceFile, modelFields, models } = args;
1124
+ if (isManyAndReturnOutputType(outputType.name)) return;
1131
1125
  const model = models.get(outputType.name);
1132
1126
  assert.ok(model, `Cannot find model by name ${outputType.name}`);
1133
1127
  const sourceFile = getSourceFile({
@@ -1141,15 +1135,15 @@ function modelOutputType(outputType, args) {
1141
1135
  );
1142
1136
  const importDeclarations = new ImportDeclarationMap();
1143
1137
  const classStructure = {
1144
- kind: tsMorph.StructureKind.Class,
1145
- isExported: true,
1146
- name: outputType.name,
1147
1138
  decorators: [
1148
1139
  {
1149
- name: "ObjectType",
1150
- arguments: []
1140
+ arguments: [],
1141
+ name: "ObjectType"
1151
1142
  }
1152
1143
  ],
1144
+ isExported: true,
1145
+ kind: tsMorph.StructureKind.Class,
1146
+ name: outputType.name,
1153
1147
  properties: []
1154
1148
  };
1155
1149
  sourceFileStructure.statements.push(classStructure);
@@ -1160,8 +1154,8 @@ function modelOutputType(outputType, args) {
1160
1154
  if (model.documentation) {
1161
1155
  const objectTypeOptions = {};
1162
1156
  const { documentation, settings } = createObjectSettings({
1163
- text: model.documentation,
1164
- config
1157
+ config,
1158
+ text: model.documentation
1165
1159
  });
1166
1160
  if (documentation) {
1167
1161
  if (!classStructure.leadingTrivia) {
@@ -1175,27 +1169,26 @@ function modelOutputType(outputType, args) {
1175
1169
  importDeclarations.add("Field", nestjsGraphql$1);
1176
1170
  importDeclarations.add("ObjectType", nestjsGraphql$1);
1177
1171
  for (const field of outputType.fields) {
1178
- if (config.omitModelsCount && field.name === "_count")
1179
- continue;
1172
+ if (config.omitModelsCount && field.name === "_count") continue;
1180
1173
  let fileType = "model";
1181
- const { location, isList, type, namespace } = field.outputType;
1174
+ const { isList, location, namespace, type } = field.outputType;
1182
1175
  let outputTypeName = String(type);
1183
1176
  if (namespace !== "model") {
1184
1177
  fileType = "output";
1185
1178
  outputTypeName = getOutputTypeName(outputTypeName);
1186
1179
  }
1187
- const modelField = (_a = modelFields.get(model.name)) == null ? void 0 : _a.get(field.name);
1188
- const settings = (_b = fieldSettings.get(model.name)) == null ? void 0 : _b.get(field.name);
1189
- const fieldType = settings == null ? void 0 : settings.getFieldType({
1180
+ const modelField = modelFields.get(model.name)?.get(field.name);
1181
+ const settings = fieldSettings.get(model.name)?.get(field.name);
1182
+ const fieldType = settings?.getFieldType({
1190
1183
  name: outputType.name,
1191
1184
  output: true
1192
1185
  });
1193
- const propertySettings = settings == null ? void 0 : settings.getPropertyType({
1186
+ const propertySettings = settings?.getPropertyType({
1194
1187
  name: outputType.name,
1195
1188
  output: true
1196
1189
  });
1197
1190
  const propertyType = lodash.castArray(
1198
- (propertySettings == null ? void 0 : propertySettings.name) || getPropertyType({
1191
+ propertySettings?.name || getPropertyType({
1199
1192
  location,
1200
1193
  type: outputTypeName
1201
1194
  })
@@ -1211,13 +1204,13 @@ function modelOutputType(outputType, args) {
1211
1204
  } else {
1212
1205
  const graphqlImport = getGraphqlImport({
1213
1206
  config,
1214
- sourceFile,
1215
1207
  fileType,
1208
+ getSourceFile,
1209
+ isId: modelField?.isId,
1216
1210
  location,
1217
- isId: modelField == null ? void 0 : modelField.isId,
1218
1211
  noTypeId: config.noTypeId,
1219
- typeName: outputTypeName,
1220
- getSourceFile
1212
+ sourceFile,
1213
+ typeName: outputTypeName
1221
1214
  });
1222
1215
  graphqlType = graphqlImport.name;
1223
1216
  if (graphqlImport.name !== outputType.name && graphqlImport.specifier) {
@@ -1225,49 +1218,49 @@ function modelOutputType(outputType, args) {
1225
1218
  }
1226
1219
  }
1227
1220
  const property = propertyStructure({
1228
- name: field.name,
1229
- isNullable: field.isNullable,
1230
1221
  hasExclamationToken: true,
1231
1222
  hasQuestionToken: location === "outputObjectTypes",
1232
- propertyType,
1233
- isList
1223
+ isList,
1224
+ isNullable: field.isNullable,
1225
+ name: field.name,
1226
+ propertyType
1234
1227
  });
1235
- if (typeof property.leadingTrivia === "string" && (modelField == null ? void 0 : modelField.documentation)) {
1228
+ if (typeof property.leadingTrivia === "string" && modelField?.documentation) {
1236
1229
  property.leadingTrivia += createComment(modelField.documentation, settings);
1237
1230
  }
1238
- (_c = classStructure.properties) == null ? void 0 : _c.push(property);
1231
+ classStructure.properties?.push(property);
1239
1232
  if (propertySettings) {
1240
1233
  importDeclarations.create({ ...propertySettings });
1241
1234
  } else if (propertyType.includes("Decimal")) {
1242
1235
  importDeclarations.add("Decimal", `${config.prismaClientImport}/runtime/library`);
1243
1236
  }
1244
1237
  assert.ok(property.decorators, "property.decorators is undefined");
1245
- const shouldHideField = (settings == null ? void 0 : settings.shouldHideField({ name: outputType.name, output: true })) || config.decorate.some(
1238
+ const shouldHideField = settings?.shouldHideField({ name: outputType.name, output: true }) || config.decorate.some(
1246
1239
  (d) => d.name === "HideField" && d.from === "@nestjs/graphql" && d.isMatchField(field.name) && d.isMatchType(outputTypeName)
1247
1240
  );
1248
1241
  if (shouldHideField) {
1249
1242
  importDeclarations.add("HideField", nestjsGraphql$1);
1250
- property.decorators.push({ name: "HideField", arguments: [] });
1243
+ property.decorators.push({ arguments: [], name: "HideField" });
1251
1244
  } else {
1252
1245
  property.decorators.push({
1253
- name: "Field",
1254
1246
  arguments: [
1255
1247
  isList ? `() => [${graphqlType}]` : `() => ${graphqlType}`,
1256
1248
  JSON5.stringify({
1257
- ...settings == null ? void 0 : settings.fieldArguments(),
1258
- nullable: Boolean(field.isNullable),
1249
+ ...settings?.fieldArguments(),
1259
1250
  defaultValue: ["number", "string", "boolean"].includes(
1260
- typeof (modelField == null ? void 0 : modelField.default)
1261
- ) ? modelField == null ? void 0 : modelField.default : void 0,
1262
- description: modelField == null ? void 0 : modelField.documentation
1251
+ typeof modelField?.default
1252
+ ) ? modelField?.default : undefined,
1253
+ description: modelField?.documentation,
1254
+ nullable: Boolean(field.isNullable)
1263
1255
  })
1264
- ]
1256
+ ],
1257
+ name: "Field"
1265
1258
  });
1266
1259
  for (const setting of settings || []) {
1267
- if (shouldBeDecorated(setting) && ((_e = (_d = setting.match) == null ? void 0 : _d.call(setting, field.name)) != null ? _e : true)) {
1260
+ if (shouldBeDecorated(setting) && (setting.match?.(field.name) ?? true)) {
1268
1261
  property.decorators.push({
1269
- name: setting.name,
1270
- arguments: setting.arguments
1262
+ arguments: setting.arguments,
1263
+ name: setting.name
1271
1264
  });
1272
1265
  assert.ok(setting.from, "Missed 'from' part in configuration or field setting");
1273
1266
  importDeclarations.create(setting);
@@ -1276,24 +1269,24 @@ function modelOutputType(outputType, args) {
1276
1269
  for (const decorate of config.decorate) {
1277
1270
  if (decorate.isMatchField(field.name) && decorate.isMatchType(outputTypeName)) {
1278
1271
  property.decorators.push({
1279
- name: decorate.name,
1280
- arguments: (_f = decorate.arguments) == null ? void 0 : _f.map((x) => pupa(x, { propertyType }))
1272
+ arguments: decorate.arguments?.map((x) => pupa(x, { propertyType })),
1273
+ name: decorate.name
1281
1274
  });
1282
1275
  importDeclarations.create(decorate);
1283
1276
  }
1284
1277
  }
1285
1278
  }
1286
1279
  eventEmitter.emitSync("ClassProperty", property, {
1287
- location,
1288
1280
  isList,
1281
+ location,
1289
1282
  propertyType
1290
1283
  });
1291
1284
  }
1292
1285
  for (const setting of modelSettings || []) {
1293
1286
  if (shouldBeDecorated(setting)) {
1294
1287
  classStructure.decorators.push({
1295
- name: setting.name,
1296
- arguments: setting.arguments
1288
+ arguments: setting.arguments,
1289
+ name: setting.name
1297
1290
  });
1298
1291
  importDeclarations.create(setting);
1299
1292
  }
@@ -1342,10 +1335,9 @@ function beforeInputType$1(args) {
1342
1335
  }
1343
1336
  }
1344
1337
  function beforeGenerateFiles$1(args) {
1345
- var _a;
1346
1338
  const { project } = args;
1347
1339
  for (const sourceFile of project.getSourceFiles()) {
1348
- const className = (_a = sourceFile.getClass(() => true)) == null ? void 0 : _a.getName();
1340
+ const className = sourceFile.getClass(() => true)?.getName();
1349
1341
  if (className && isAtomicOperation(className)) {
1350
1342
  project.removeSourceFile(sourceFile);
1351
1343
  }
@@ -1363,16 +1355,14 @@ function isListInput(typeName, model, field) {
1363
1355
 
1364
1356
  const nestjsGraphql = "@nestjs/graphql";
1365
1357
  function outputType(outputType2, args) {
1366
- var _a, _b, _c, _d, _e;
1367
1358
  const { getSourceFile, models, eventEmitter, fieldSettings, getModelName, config } = args;
1368
1359
  const importDeclarations = new ImportDeclarationMap();
1369
1360
  const fileType = "output";
1370
1361
  const modelName = getModelName(outputType2.name) || "";
1371
1362
  const model = models.get(modelName);
1372
1363
  const isAggregateOutput = model && /(?:Count|Avg|Sum|Min|Max)AggregateOutputType$/.test(outputType2.name) && String(outputType2.name).startsWith(model.name);
1373
- const isCountOutput = (model == null ? void 0 : model.name) && outputType2.name === `${model.name}CountOutputType`;
1374
- if (!config.emitBlocks.outputs && !isCountOutput)
1375
- return;
1364
+ const isCountOutput = model?.name && outputType2.name === `${model.name}CountOutputType`;
1365
+ if (!config.emitBlocks.outputs && !isCountOutput) return;
1376
1366
  outputType2.name = getOutputTypeName(outputType2.name);
1377
1367
  if (isAggregateOutput) {
1378
1368
  eventEmitter.emitSync("AggregateOutput", { ...args, outputType: outputType2 });
@@ -1398,15 +1388,15 @@ function outputType(outputType2, args) {
1398
1388
  for (const field of outputType2.fields) {
1399
1389
  const { location, isList, type } = field.outputType;
1400
1390
  const outputTypeName = getOutputTypeName(String(type));
1401
- const settings = isCountOutput ? void 0 : model && ((_a = fieldSettings.get(model.name)) == null ? void 0 : _a.get(field.name));
1402
- const propertySettings = settings == null ? void 0 : settings.getPropertyType({
1391
+ const settings = isCountOutput ? undefined : model && fieldSettings.get(model.name)?.get(field.name);
1392
+ const propertySettings = settings?.getPropertyType({
1403
1393
  name: outputType2.name,
1404
1394
  output: true
1405
1395
  });
1406
- const isCustomsApplicable = outputTypeName === ((_b = model == null ? void 0 : model.fields.find((f) => f.name === field.name)) == null ? void 0 : _b.type);
1396
+ const isCustomsApplicable = outputTypeName === model?.fields.find((f) => f.name === field.name)?.type;
1407
1397
  field.outputType.type = outputTypeName;
1408
1398
  const propertyType = lodash.castArray(
1409
- (propertySettings == null ? void 0 : propertySettings.name) || getPropertyType({
1399
+ propertySettings?.name || getPropertyType({
1410
1400
  location,
1411
1401
  type: outputTypeName
1412
1402
  })
@@ -1414,24 +1404,24 @@ function outputType(outputType2, args) {
1414
1404
  const property = propertyStructure({
1415
1405
  name: field.name,
1416
1406
  isNullable: field.isNullable,
1417
- hasQuestionToken: isCountOutput ? true : void 0,
1407
+ hasQuestionToken: isCountOutput ? true : undefined,
1418
1408
  propertyType,
1419
1409
  isList
1420
1410
  });
1421
- (_c = classStructure.properties) == null ? void 0 : _c.push(property);
1411
+ classStructure.properties?.push(property);
1422
1412
  if (propertySettings) {
1423
1413
  importDeclarations.create({ ...propertySettings });
1424
1414
  } else if (propertyType.includes("Decimal")) {
1425
1415
  importDeclarations.add("Decimal", `${config.prismaClientImport}/runtime/library`);
1426
1416
  }
1427
1417
  let graphqlType;
1428
- const shouldHideField = (settings == null ? void 0 : settings.shouldHideField({
1418
+ const shouldHideField = settings?.shouldHideField({
1429
1419
  name: outputType2.name,
1430
1420
  output: true
1431
- })) || config.decorate.some(
1421
+ }) || config.decorate.some(
1432
1422
  (d) => d.name === "HideField" && d.from === "@nestjs/graphql" && d.isMatchField(field.name) && d.isMatchType(outputTypeName)
1433
1423
  );
1434
- const fieldType = settings == null ? void 0 : settings.getFieldType({
1424
+ const fieldType = settings?.getFieldType({
1435
1425
  name: outputType2.name,
1436
1426
  output: true
1437
1427
  });
@@ -1470,14 +1460,14 @@ function outputType(outputType2, args) {
1470
1460
  arguments: [
1471
1461
  isList ? `() => [${graphqlType}]` : `() => ${graphqlType}`,
1472
1462
  JSON5.stringify({
1473
- ...settings == null ? void 0 : settings.fieldArguments(),
1463
+ ...settings?.fieldArguments(),
1474
1464
  nullable: Boolean(field.isNullable)
1475
1465
  })
1476
1466
  ]
1477
1467
  });
1478
1468
  if (isCustomsApplicable) {
1479
1469
  for (const options of settings || []) {
1480
- if ((_e = options.kind === "Decorator" && options.output && ((_d = options.match) == null ? void 0 : _d.call(options, field.name))) != null ? _e : true) {
1470
+ if ((options.kind === "Decorator" && options.output && options.match?.(field.name)) ?? true) {
1481
1471
  property.decorators.push({
1482
1472
  name: options.name,
1483
1473
  arguments: options.arguments
@@ -1504,8 +1494,7 @@ function purgeOutput(emitter) {
1504
1494
  emitter.on("End", end);
1505
1495
  }
1506
1496
  function begin({ project, output }) {
1507
- var _a;
1508
- const sourceFiles = (_a = project.getDirectory(output)) == null ? void 0 : _a.getDescendantSourceFiles();
1497
+ const sourceFiles = project.getDirectory(output)?.getDescendantSourceFiles();
1509
1498
  if (sourceFiles) {
1510
1499
  for (const sourceFile of sourceFiles) {
1511
1500
  sourceFile.delete();
@@ -1513,8 +1502,7 @@ function begin({ project, output }) {
1513
1502
  }
1514
1503
  }
1515
1504
  function end({ project, output }) {
1516
- var _a;
1517
- const directories = (_a = project.getDirectory(output)) == null ? void 0 : _a.getDescendantDirectories().filter((directory) => directory.getSourceFiles().length === 0).map((directory) => directory.getPath());
1505
+ const directories = project.getDirectory(output)?.getDescendantDirectories().filter((directory) => directory.getSourceFiles().length === 0).map((directory) => directory.getPath());
1518
1506
  for (const directory of directories || []) {
1519
1507
  try {
1520
1508
  gracefulFs.rmdirSync(directory);
@@ -1587,8 +1575,7 @@ function beforeGenerateFiles(args) {
1587
1575
  if (config.reExport === "All" /* All */) {
1588
1576
  const exportDeclarations = [];
1589
1577
  for (const directory of rootDirectory.getDirectories()) {
1590
- if (directory.getBaseName() === "node_modules")
1591
- continue;
1578
+ if (directory.getBaseName() === "node_modules") continue;
1592
1579
  const sourceFile = directory.getSourceFileOrThrow("index.ts");
1593
1580
  exportDeclarations.push(getExportDeclaration(rootDirectory, sourceFile));
1594
1581
  }
@@ -1619,8 +1606,7 @@ function getNamespaceExportDeclaration(directory, sourceDirectory) {
1619
1606
 
1620
1607
  function registerEnum(enumType, args) {
1621
1608
  const { getSourceFile, enums, config } = args;
1622
- if (!config.emitBlocks.prismaEnums && !enums[enumType.name])
1623
- return;
1609
+ if (!config.emitBlocks.prismaEnums && !enums[enumType.name]) return;
1624
1610
  const dataModelEnum = enums[enumType.name];
1625
1611
  const sourceFile = getSourceFile({
1626
1612
  name: enumType.name,
@@ -1645,7 +1631,7 @@ function registerEnum(enumType, args) {
1645
1631
  ...importDeclarations.toStatements(),
1646
1632
  enumStructure,
1647
1633
  "\n",
1648
- `registerEnumType(${enumType.name}, { name: '${enumType.name}', description: ${JSON.stringify(dataModelEnum == null ? void 0 : dataModelEnum.documentation)} })`
1634
+ `registerEnumType(${enumType.name}, { name: '${enumType.name}', description: ${JSON.stringify(dataModelEnum?.documentation)} })`
1649
1635
  ]
1650
1636
  });
1651
1637
  }
@@ -1673,7 +1659,14 @@ function warning(message) {
1673
1659
  }
1674
1660
  }
1675
1661
 
1676
- const allEmmittedBlocks = ["prismaEnums", "schemaEnums", "models", "inputs", "args", "outputs"];
1662
+ const allEmmittedBlocks = [
1663
+ "prismaEnums",
1664
+ "schemaEnums",
1665
+ "models",
1666
+ "inputs",
1667
+ "args",
1668
+ "outputs"
1669
+ ];
1677
1670
  const blocksDependencyMap = {
1678
1671
  enums: ["schemaEnums", "prismaEnums"],
1679
1672
  models: ["models", "schemaEnums"],
@@ -1687,18 +1680,18 @@ function createEmitBlocks(data) {
1687
1680
  }
1688
1681
  let blocksToEmit = {};
1689
1682
  for (const block of data) {
1690
- if (!Object.keys(blocksDependencyMap).includes(block))
1691
- continue;
1683
+ if (!Object.keys(blocksDependencyMap).includes(block)) continue;
1692
1684
  blocksToEmit = {
1693
1685
  ...blocksToEmit,
1694
- ...Object.fromEntries(blocksDependencyMap[block].map((block2) => [block2, true]))
1686
+ ...Object.fromEntries(
1687
+ blocksDependencyMap[block].map((block2) => [block2, true])
1688
+ )
1695
1689
  };
1696
1690
  }
1697
1691
  return blocksToEmit;
1698
1692
  }
1699
1693
 
1700
1694
  function createConfig(data) {
1701
- var _a;
1702
1695
  const config = lodash.merge({}, flat.unflatten(data, { delimiter: "_" }));
1703
1696
  const $warnings = [];
1704
1697
  const configOutputFilePattern = String(
@@ -1721,7 +1714,7 @@ function createConfig(data) {
1721
1714
  }
1722
1715
  const fields = Object.fromEntries(
1723
1716
  Object.entries(
1724
- (_a = config.fields) != null ? _a : {}
1717
+ config.fields ?? {}
1725
1718
  ).filter(({ 1: value }) => typeof value === "object").map(([name, value]) => {
1726
1719
  const fieldSetting = {
1727
1720
  arguments: [],
@@ -1740,8 +1733,7 @@ function createConfig(data) {
1740
1733
  config.decorate || {}
1741
1734
  );
1742
1735
  for (const element of configDecorate) {
1743
- if (!element)
1744
- continue;
1736
+ if (!element) continue;
1745
1737
  assert.ok(
1746
1738
  element.from && element.name,
1747
1739
  `Missed 'from' or 'name' part in configuration for decorate`
@@ -1754,7 +1746,7 @@ function createConfig(data) {
1754
1746
  namedImport: toBoolean(element.namedImport),
1755
1747
  defaultImport: toBoolean(element.defaultImport) ? true : element.defaultImport,
1756
1748
  namespaceImport: element.namespaceImport,
1757
- arguments: element.arguments ? JSON5.parse(element.arguments) : void 0
1749
+ arguments: element.arguments ? JSON5.parse(element.arguments) : undefined
1758
1750
  });
1759
1751
  }
1760
1752
  return {
@@ -1787,14 +1779,11 @@ const tsConfigFileExists = lodash.memoize((filePath) => {
1787
1779
  return gracefulFs.existsSync(filePath);
1788
1780
  });
1789
1781
  function createTsConfigFilePathValue(value) {
1790
- if (typeof value === "string")
1791
- return value;
1792
- if (tsConfigFileExists("tsconfig.json"))
1793
- return "tsconfig.json";
1782
+ if (typeof value === "string") return value;
1783
+ if (tsConfigFileExists("tsconfig.json")) return "tsconfig.json";
1794
1784
  }
1795
1785
  function createPrismaImport(value) {
1796
- if (typeof value === "string")
1797
- return value;
1786
+ if (typeof value === "string") return value;
1798
1787
  return "@prisma/client";
1799
1788
  }
1800
1789
  function createUseInputType(data) {
@@ -1805,7 +1794,7 @@ function createUseInputType(data) {
1805
1794
  for (const [typeName, useInputs] of Object.entries(data)) {
1806
1795
  const entry = {
1807
1796
  typeName,
1808
- ALL: void 0
1797
+ ALL: undefined
1809
1798
  };
1810
1799
  if (useInputs.ALL) {
1811
1800
  entry.ALL = useInputs.ALL;
@@ -1859,7 +1848,7 @@ function factoryGetSourceFile(args) {
1859
1848
  template: outputFilePattern
1860
1849
  });
1861
1850
  filePath = `${output}/${filePath}`;
1862
- return project.getSourceFile(filePath) || project.createSourceFile(filePath, void 0, { overwrite: true });
1851
+ return project.getSourceFile(filePath) || project.createSourceFile(filePath, undefined, { overwrite: true });
1863
1852
  };
1864
1853
  }
1865
1854
 
@@ -1870,7 +1859,7 @@ function createGetModelName(modelNames) {
1870
1859
  }
1871
1860
  }
1872
1861
  function getModelName(args) {
1873
- const { name, modelNames } = args;
1862
+ const { modelNames, name } = args;
1874
1863
  for (const keyword of splitKeywords) {
1875
1864
  const [test] = name.split(keyword, 1);
1876
1865
  if (modelNames.includes(test)) {
@@ -1904,7 +1893,6 @@ function getModelName(args) {
1904
1893
  return test;
1905
1894
  }
1906
1895
  }
1907
- return void 0;
1908
1896
  }
1909
1897
  const splitKeywords = [
1910
1898
  "CreateInput",
@@ -1948,7 +1936,9 @@ const splitKeywords = [
1948
1936
  "MaxOrderBy",
1949
1937
  "AvgOrderBy",
1950
1938
  "Create",
1951
- "Update"
1939
+ "Update",
1940
+ "ScalarRelationFilter",
1941
+ "NullableScalarRelationFilter"
1952
1942
  ].sort((a, b) => b.length - a.length);
1953
1943
  const endsWithKeywords = [
1954
1944
  "Aggregate",
@@ -1977,6 +1967,7 @@ const middleKeywords = [
1977
1967
  ["FindOne", "Args"],
1978
1968
  ["FindUnique", "Args"],
1979
1969
  ["UpdateMany", "Args"],
1970
+ ["UpdateMany", "AndReturnOutputType"],
1980
1971
  ["UpdateOne", "Args"],
1981
1972
  ["UpsertOne", "Args"],
1982
1973
  ["GroupBy", "Args"],
@@ -1985,9 +1976,8 @@ const middleKeywords = [
1985
1976
 
1986
1977
  const AwaitEventEmitter = require$1("await-event-emitter").default;
1987
1978
  async function generate(args) {
1988
- var _a;
1989
1979
  const { connectCallback, generator, skipAddOutputSourceFiles, dmmf } = args;
1990
- const generatorOutputValue = (_a = generator.output) == null ? void 0 : _a.value;
1980
+ const generatorOutputValue = generator.output?.value;
1991
1981
  assert.ok(generatorOutputValue, "Missing generator configuration: output");
1992
1982
  const config = createConfig(generator.config);
1993
1983
  const eventEmitter = new AwaitEventEmitter();
package/generate.d.ts CHANGED
@@ -37,6 +37,7 @@ declare namespace DMMF {
37
37
  models: Model[];
38
38
  enums: DatamodelEnum[];
39
39
  types: Model[];
40
+ indexes: Index[];
40
41
  }>;
41
42
  export type uniqueIndex = ReadonlyDeep_2<{
42
43
  name: string;
@@ -49,6 +50,7 @@ declare namespace DMMF {
49
50
  export type Model = ReadonlyDeep_2<{
50
51
  name: string;
51
52
  dbName: string | null;
53
+ schema: string | null;
52
54
  fields: Field[];
53
55
  uniqueFields: string[][];
54
56
  uniqueIndexes: uniqueIndex[];
@@ -74,6 +76,12 @@ declare namespace DMMF {
74
76
  * BigInt, Boolean, Bytes, DateTime, Decimal, Float, Int, JSON, String, $ModelName
75
77
  */
76
78
  type: string;
79
+ /**
80
+ * Native database type, if specified.
81
+ * For example, `@db.VarChar(191)` is encoded as `['VarChar', ['191']]`,
82
+ * `@db.Text` is encoded as `['Text', []]`.
83
+ */
84
+ nativeType?: [string, string[]] | null;
77
85
  dbName?: string | null;
78
86
  hasDefaultValue: boolean;
79
87
  default?: FieldDefault | FieldDefaultScalar | FieldDefaultScalar[];
@@ -85,9 +93,27 @@ declare namespace DMMF {
85
93
  }>;
86
94
  export type FieldDefault = ReadonlyDeep_2<{
87
95
  name: string;
88
- args: any[];
96
+ args: Array<string | number>;
89
97
  }>;
90
98
  export type FieldDefaultScalar = string | boolean | number;
99
+ export type Index = ReadonlyDeep_2<{
100
+ model: string;
101
+ type: IndexType;
102
+ isDefinedOnField: boolean;
103
+ name?: string;
104
+ dbName?: string;
105
+ algorithm?: string;
106
+ clustered?: boolean;
107
+ fields: IndexField[];
108
+ }>;
109
+ export type IndexType = 'id' | 'normal' | 'unique' | 'fulltext';
110
+ export type IndexField = ReadonlyDeep_2<{
111
+ name: string;
112
+ sortOrder?: SortOrder;
113
+ length?: number;
114
+ operatorClass?: string;
115
+ }>;
116
+ export type SortOrder = 'asc' | 'desc';
91
117
  export type Schema = ReadonlyDeep_2<{
92
118
  rootQueryType?: string;
93
119
  rootMutationType?: string;
@@ -181,6 +207,7 @@ declare namespace DMMF {
181
207
  createManyAndReturn?: string | null;
182
208
  update?: string | null;
183
209
  updateMany?: string | null;
210
+ updateManyAndReturn?: string | null;
184
211
  upsert?: string | null;
185
212
  delete?: string | null;
186
213
  deleteMany?: string | null;
@@ -201,6 +228,7 @@ declare namespace DMMF {
201
228
  createManyAndReturn = "createManyAndReturn",
202
229
  update = "update",
203
230
  updateMany = "updateMany",
231
+ updateManyAndReturn = "updateManyAndReturn",
204
232
  upsert = "upsert",
205
233
  delete = "delete",
206
234
  deleteMany = "deleteMany",
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "prisma-nestjs-graphql",
3
- "version": "20.0.3",
3
+ "version": "21.0.0",
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
  "bin": "bin.js",
7
- "repository": "https://github.com/unlight/nestjs-graphql-prisma.git",
8
- "bugs": {
9
- "url": "https://github.com/unlight/nestjs-graphql-prisma/issues"
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/unlight/prisma-nestjs-graphql.git"
10
10
  },
11
- "homepage": "https://github.com/unlight/nestjs-graphql-prisma#readme",
11
+ "homepage": "https://github.com/unlight/prisma-nestjs-graphql",
12
12
  "keywords": [
13
13
  "nestjs",
14
14
  "graphql",
@@ -62,14 +62,10 @@
62
62
  "config": {
63
63
  "commitizen": {
64
64
  "path": "node_modules/cz-customizable"
65
- },
66
- "ghooks": {
67
- "pre-commit": "precise-commits",
68
- "commit-msg": "sh Taskfile commit_lint"
69
65
  }
70
66
  },
71
67
  "dependencies": {
72
- "@prisma/generator-helper": "^5.14.0",
68
+ "@prisma/generator-helper": "5 - 6",
73
69
  "await-event-emitter": "^2.0.2",
74
70
  "filenamify": "4.X",
75
71
  "flat": "5.X",
@@ -77,75 +73,77 @@
77
73
  "graceful-fs": "^4.2.11",
78
74
  "json5": "^2.2.3",
79
75
  "lodash": "^4.17.21",
80
- "outmatch": "^0.7.0",
76
+ "outmatch": "^1.0.0",
81
77
  "pluralize": "^8.0.0",
82
78
  "pupa": "2.X",
83
- "ts-morph": ">=11 <=16"
79
+ "ts-morph": "11 - 16"
84
80
  },
85
81
  "devDependencies": {
86
- "@commitlint/cli": "^18.4.3",
87
- "@commitlint/config-conventional": "^18.4.3",
88
- "@nestjs/apollo": "^12.1.0",
89
- "@nestjs/common": "^10.3.8",
90
- "@nestjs/core": "^10.3.8",
91
- "@nestjs/graphql": "^12.1.1",
92
- "@nestjs/platform-express": "^10.3.8",
93
- "@paljs/plugins": "^6.0.7",
94
- "@prisma/client": "^5.14.0",
82
+ "@eslint/compat": "^1.2.5",
83
+ "@nestjs/apollo": "^13.0.1",
84
+ "@nestjs/common": "^11.0.1",
85
+ "@nestjs/core": "^11.0.1",
86
+ "@nestjs/graphql": "^13.0.1",
87
+ "@nestjs/platform-express": "^11.0.1",
88
+ "@paljs/plugins": "^8.1.0",
89
+ "@prisma/client": "5 - 6",
95
90
  "@semantic-release/changelog": "^6.0.3",
96
91
  "@semantic-release/git": "^10.0.1",
97
- "@semantic-release/github": "^9.2.5",
98
- "@swc/core": "^1.5.7",
99
- "@swc/helpers": "^0.5.11",
92
+ "@semantic-release/github": "^11.0.1",
93
+ "@swc/core": "^1.10.7",
94
+ "@swc/helpers": "^0.5.15",
100
95
  "@swc/register": "^0.1.10",
101
96
  "@types/flat": "^5.0.5",
102
97
  "@types/graceful-fs": "^4.1.9",
103
- "@types/lodash": "^4.17.4",
104
- "@types/mocha": "^10.0.6",
105
- "@types/node": "^20.12.12",
98
+ "@types/lodash": "^4.17.14",
99
+ "@types/mocha": "^10.0.10",
100
+ "@types/node": "^22.10.7",
106
101
  "@types/pluralize": "^0.0.33",
107
- "@typescript-eslint/eslint-plugin": "^6.14.0",
108
- "@typescript-eslint/parser": "^6.14.0",
102
+ "@typescript-eslint/eslint-plugin": "^8.20.0",
103
+ "@typescript-eslint/parser": "^8.20.0",
109
104
  "apollo-server-express": "^3.13.0",
110
- "c8": "^9.1.0",
105
+ "c8": "^10.1.3",
111
106
  "class-transformer": "^0.5.1",
112
107
  "class-validator": "^0.14.1",
113
- "commitizen": "^4.3.0",
114
- "cz-customizable": "^7.0.0",
108
+ "commitizen": "^4.3.1",
109
+ "conventional-changelog-conventionalcommits": "^8.0.0",
110
+ "cz-customizable": "^7.4.0",
115
111
  "decimal.js": "^10.4.3",
116
- "eslint": "^8.55.0",
112
+ "eslint": "^9.18.0",
113
+ "eslint-config-prettier": "^10.0.1",
117
114
  "eslint-import-resolver-node": "^0.3.9",
118
115
  "eslint-plugin-etc": "^2.0.3",
119
- "eslint-plugin-import": "^2.29.1",
116
+ "eslint-plugin-import": "^2.31.0",
120
117
  "eslint-plugin-only-warn": "^1.1.0",
121
- "eslint-plugin-prettier": "^5.1.3",
122
- "eslint-plugin-regexp": "^2.5.0",
123
- "eslint-plugin-simple-import-sort": "^10.0.0",
124
- "eslint-plugin-sort-class-members": "^1.20.0",
125
- "eslint-plugin-unicorn": "^53.0.0",
118
+ "eslint-plugin-perfectionist": "^4.6.0",
119
+ "eslint-plugin-prettier": "^5.2.2",
120
+ "eslint-plugin-regexp": "^2.7.0",
121
+ "eslint-plugin-simple-import-sort": "^12.1.1",
122
+ "eslint-plugin-sort-class-members": "^1.21.0",
123
+ "eslint-plugin-unicorn": "^56.0.1",
126
124
  "eslint-plugin-wix-editor": "^3.3.0",
127
125
  "expect": "^29.7.0",
128
- "git-branch-is": "^4.0.0",
129
- "graphql": "^16.8.1",
130
- "graphql-scalars": "^1.23.0",
126
+ "graphql": "^16.10.0",
127
+ "graphql-scalars": "^1.24.0",
131
128
  "graphql-type-json": "^0.3.2",
132
- "mocha": "^10.4.0",
129
+ "mocha": "^11.0.1",
133
130
  "ololog": "^1.1.175",
134
- "pkgroll": "^2.1.0",
131
+ "pkgroll": "^2.6.1",
135
132
  "precise-commits": "^1.0.2",
136
- "prettier": "^3.2.5",
137
- "prisma": "^5.14.0",
133
+ "prettier": "^3.4.2",
134
+ "prisma": "5 - 6",
138
135
  "prisma-graphql-type-decimal": "^3.0.0",
139
136
  "reflect-metadata": "^0.2.2",
140
137
  "request": "^2.88.2",
141
138
  "rxjs": "^7.8.1",
142
- "semantic-release": "^22.0.12",
139
+ "semantic-release": "^24.2.1",
143
140
  "simplytyped": "^3.3.0",
144
141
  "temp-dir": "2.X",
145
142
  "ts-node": "^10.9.2",
146
- "tslib": "^2.6.2",
147
- "type-fest": "^4.18.2",
148
- "typescript": "^5.4.5",
143
+ "tslib": "^2.8.1",
144
+ "type-fest": "^4.32.0",
145
+ "typescript": "^5.7.3",
146
+ "typescript-eslint": "^8.20.0",
149
147
  "watchexec-bin": "^1.0.0"
150
148
  }
151
149
  }