prisma-nestjs-graphql 15.2.5 → 15.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +23 -0
  2. package/index.js +6 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -281,6 +281,29 @@ data!: UserCreateInput;
281
281
 
282
282
  ```
283
283
 
284
+ Add `@HideField()` decorator to nested types:
285
+
286
+ ```
287
+ decorate_3_type = "*CreateNestedOneWithoutUserInput"
288
+ decorate_3_field = "!(create)"
289
+ decorate_3_name = "HideField"
290
+ decorate_3_from = "@nestjs/graphql"
291
+ decorate_3_arguments = "[]"
292
+ ```
293
+
294
+ May generate following class:
295
+
296
+ ```ts
297
+ @Field(() => ProfileCreateWithoutUserInput, { nullable: true })
298
+ create?: ProfileCreateWithoutUserInput;
299
+
300
+ @HideField()
301
+ connectOrCreate?: ProfileCreateOrConnectWithoutUserInput;
302
+
303
+ @HideField()
304
+ connect?: ProfileWhereUniqueInput;
305
+ ```
306
+
284
307
  #### `graphqlScalars`
285
308
 
286
309
  Allow to set custom graphql type for Prisma scalar type.
package/index.js CHANGED
@@ -695,14 +695,14 @@ function inputType(args) {
695
695
  importDeclarations.create({
696
696
  ...propertySettings
697
697
  });
698
- } else if (!propertySettings && propertyType.includes("Decimal")) {
698
+ } else if (propertyType.includes("Decimal")) {
699
699
  importDeclarations.add("Decimal", "@prisma/client/runtime");
700
700
  }
701
701
  let graphqlType;
702
- const shouldHideField = settings == null ? void 0 : settings.shouldHideField({
702
+ const shouldHideField = (settings == null ? void 0 : settings.shouldHideField({
703
703
  name: inputType1.name,
704
704
  input: true
705
- });
705
+ })) || config.decorate.some((d) => d.name === "HideField" && d.from === "@nestjs/graphql" && d.isMatchField(name) && d.isMatchType(inputType1.name));
706
706
  const fieldType = settings == null ? void 0 : settings.getFieldType({
707
707
  name: inputType1.name,
708
708
  input: true
@@ -1357,14 +1357,14 @@ function outputType(outputType1, args) {
1357
1357
  importDeclarations.create({
1358
1358
  ...propertySettings
1359
1359
  });
1360
- } else if (!propertySettings && propertyType.includes("Decimal")) {
1360
+ } else if (propertyType.includes("Decimal")) {
1361
1361
  importDeclarations.add("Decimal", "@prisma/client/runtime");
1362
1362
  }
1363
1363
  let graphqlType;
1364
- const shouldHideField = settings == null ? void 0 : settings.shouldHideField({
1364
+ const shouldHideField = (settings == null ? void 0 : settings.shouldHideField({
1365
1365
  name: outputType1.name,
1366
1366
  output: true
1367
- });
1367
+ })) || config.decorate.some((d) => d.name === "HideField" && d.from === "@nestjs/graphql" && d.isMatchField(field.name) && d.isMatchType(outputTypeName));
1368
1368
  const fieldType = settings == null ? void 0 : settings.getFieldType({
1369
1369
  name: outputType1.name,
1370
1370
  output: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prisma-nestjs-graphql",
3
- "version": "15.2.5",
3
+ "version": "15.2.6",
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",