@pothos/plugin-prisma 3.58.0 → 3.59.1

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 (70) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dts/connection-helpers.d.ts +6 -6
  3. package/dts/connection-helpers.d.ts.map +1 -1
  4. package/dts/global-types.d.ts +13 -13
  5. package/dts/global-types.d.ts.map +1 -1
  6. package/dts/index.d.ts.map +1 -1
  7. package/dts/interface-ref.d.ts +1 -1
  8. package/dts/interface-ref.d.ts.map +1 -1
  9. package/dts/model-loader.d.ts +32 -13
  10. package/dts/model-loader.d.ts.map +1 -1
  11. package/dts/object-ref.d.ts.map +1 -1
  12. package/dts/prisma-field-builder.d.ts +18 -18
  13. package/dts/prisma-field-builder.d.ts.map +1 -1
  14. package/dts/types.d.ts +30 -30
  15. package/dts/types.d.ts.map +1 -1
  16. package/dts/util/loader-map.d.ts +1 -1
  17. package/dts/util/loader-map.d.ts.map +1 -1
  18. package/dts/util/map-query.d.ts +2 -2
  19. package/dts/util/map-query.d.ts.map +1 -1
  20. package/esm/connection-helpers.d.ts +6 -6
  21. package/esm/connection-helpers.d.ts.map +1 -1
  22. package/esm/global-types.d.ts +13 -13
  23. package/esm/global-types.d.ts.map +1 -1
  24. package/esm/index.d.ts.map +1 -1
  25. package/esm/index.js +2 -9
  26. package/esm/index.js.map +1 -1
  27. package/esm/interface-ref.d.ts +1 -1
  28. package/esm/interface-ref.d.ts.map +1 -1
  29. package/esm/interface-ref.js.map +1 -1
  30. package/esm/model-loader.d.ts +32 -13
  31. package/esm/model-loader.d.ts.map +1 -1
  32. package/esm/model-loader.js +82 -27
  33. package/esm/model-loader.js.map +1 -1
  34. package/esm/object-ref.d.ts.map +1 -1
  35. package/esm/object-ref.js.map +1 -1
  36. package/esm/prisma-field-builder.d.ts +28 -28
  37. package/esm/prisma-field-builder.d.ts.map +1 -1
  38. package/esm/prisma-field-builder.js.map +1 -1
  39. package/esm/types.d.ts +30 -30
  40. package/esm/types.d.ts.map +1 -1
  41. package/esm/util/loader-map.d.ts +1 -1
  42. package/esm/util/loader-map.d.ts.map +1 -1
  43. package/esm/util/loader-map.js +1 -1
  44. package/esm/util/loader-map.js.map +1 -1
  45. package/esm/util/map-query.d.ts +2 -2
  46. package/esm/util/map-query.d.ts.map +1 -1
  47. package/esm/util/map-query.js +10 -2
  48. package/esm/util/map-query.js.map +1 -1
  49. package/lib/index.js +1 -8
  50. package/lib/index.js.map +1 -1
  51. package/lib/interface-ref.js.map +1 -1
  52. package/lib/model-loader.js +81 -27
  53. package/lib/model-loader.js.map +1 -1
  54. package/lib/object-ref.js.map +1 -1
  55. package/lib/prisma-field-builder.js.map +1 -1
  56. package/lib/util/loader-map.js +1 -1
  57. package/lib/util/loader-map.js.map +1 -1
  58. package/lib/util/map-query.js +9 -1
  59. package/lib/util/map-query.js.map +1 -1
  60. package/package.json +6 -6
  61. package/src/connection-helpers.ts +5 -5
  62. package/src/global-types.ts +11 -11
  63. package/src/index.ts +8 -18
  64. package/src/interface-ref.ts +3 -2
  65. package/src/model-loader.ts +118 -41
  66. package/src/object-ref.ts +2 -0
  67. package/src/prisma-field-builder.ts +42 -32
  68. package/src/types.ts +52 -50
  69. package/src/util/loader-map.ts +1 -1
  70. package/src/util/map-query.ts +16 -3
@@ -4,12 +4,15 @@ import {
4
4
  FieldNode,
5
5
  FragmentDefinitionNode,
6
6
  getArgumentValues,
7
+ getDirectiveValues,
7
8
  getNamedType,
8
9
  GraphQLField,
10
+ GraphQLIncludeDirective,
9
11
  GraphQLInterfaceType,
10
12
  GraphQLNamedType,
11
13
  GraphQLObjectType,
12
14
  GraphQLResolveInfo,
15
+ GraphQLSkipDirective,
13
16
  InlineFragmentNode,
14
17
  isInterfaceType,
15
18
  isObjectType,
@@ -198,7 +201,7 @@ function resolveIndirectInclude(
198
201
  }
199
202
 
200
203
  function addNestedSelections(
201
- type: GraphQLObjectType | GraphQLInterfaceType,
204
+ type: GraphQLInterfaceType | GraphQLObjectType,
202
205
  context: object,
203
206
  info: GraphQLResolveInfo,
204
207
  state: SelectionState,
@@ -260,7 +263,7 @@ function addNestedSelections(
260
263
  }
261
264
 
262
265
  function addFieldSelection(
263
- type: GraphQLObjectType | GraphQLInterfaceType,
266
+ type: GraphQLInterfaceType | GraphQLObjectType,
264
267
  context: object,
265
268
  info: GraphQLResolveInfo,
266
269
  state: SelectionState,
@@ -271,6 +274,16 @@ function addFieldSelection(
271
274
  return;
272
275
  }
273
276
 
277
+ const skip = getDirectiveValues(GraphQLSkipDirective, selection, info.variableValues);
278
+ if (skip?.if === true) {
279
+ return;
280
+ }
281
+
282
+ const include = getDirectiveValues(GraphQLIncludeDirective, selection, info.variableValues);
283
+ if (include?.if === false) {
284
+ return;
285
+ }
286
+
274
287
  const field = type.getFields()[selection.name.value];
275
288
 
276
289
  if (!field) {
@@ -397,7 +410,7 @@ export function queryFromInfo<T extends SelectionMap['select'] | undefined = und
397
410
  path?: string[];
398
411
  paths?: string[][];
399
412
  withUsageCheck?: boolean;
400
- }): { select: T } | { include?: {} } {
413
+ }): { include?: {} } | { select: T } {
401
414
  const returnType = getNamedType(info.returnType);
402
415
  const type = typeName ? info.schema.getTypeMap()[typeName] : returnType;
403
416