@pothos/plugin-prisma 4.9.0 → 4.9.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 (88) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dts/global-types.d.ts +2 -2
  3. package/dts/global-types.d.ts.map +1 -1
  4. package/dts/index.d.ts +3 -3
  5. package/dts/index.d.ts.map +1 -1
  6. package/dts/model-loader.d.ts.map +1 -1
  7. package/dts/object-ref.d.ts +1 -1
  8. package/dts/object-ref.d.ts.map +1 -1
  9. package/dts/prisma-field-builder.d.ts.map +1 -1
  10. package/dts/util/cursors.d.ts.map +1 -1
  11. package/dts/util/get-client.d.ts.map +1 -1
  12. package/dts/util/map-query.d.ts.map +1 -1
  13. package/esm/field-builder.js +2 -2
  14. package/esm/field-builder.js.map +1 -1
  15. package/esm/generator.js +22 -8
  16. package/esm/generator.js.map +1 -1
  17. package/esm/global-types.d.ts +2 -2
  18. package/esm/global-types.d.ts.map +1 -1
  19. package/esm/global-types.js.map +1 -1
  20. package/esm/index.d.ts +3 -3
  21. package/esm/index.d.ts.map +1 -1
  22. package/esm/index.js +2 -2
  23. package/esm/index.js.map +1 -1
  24. package/esm/interface-ref.js.map +1 -1
  25. package/esm/model-loader.d.ts.map +1 -1
  26. package/esm/model-loader.js +2 -2
  27. package/esm/model-loader.js.map +1 -1
  28. package/esm/object-ref.d.ts +1 -1
  29. package/esm/object-ref.d.ts.map +1 -1
  30. package/esm/object-ref.js +1 -1
  31. package/esm/object-ref.js.map +1 -1
  32. package/esm/prisma-field-builder.d.ts.map +1 -1
  33. package/esm/prisma-field-builder.js +6 -7
  34. package/esm/prisma-field-builder.js.map +1 -1
  35. package/esm/schema-builder.js.map +1 -1
  36. package/esm/util/cursors.d.ts.map +1 -1
  37. package/esm/util/cursors.js +1 -1
  38. package/esm/util/cursors.js.map +1 -1
  39. package/esm/util/get-client.d.ts.map +1 -1
  40. package/esm/util/get-client.js.map +1 -1
  41. package/esm/util/map-query.d.ts.map +1 -1
  42. package/esm/util/map-query.js +2 -2
  43. package/esm/util/map-query.js.map +1 -1
  44. package/lib/connection-helpers.js +3 -3
  45. package/lib/connection-helpers.js.map +1 -1
  46. package/lib/generator.js +21 -7
  47. package/lib/generator.js.map +1 -1
  48. package/lib/index.js +16 -16
  49. package/lib/index.js.map +1 -1
  50. package/lib/interface-ref.js.map +1 -1
  51. package/lib/model-loader.js +1 -1
  52. package/lib/model-loader.js.map +1 -1
  53. package/lib/object-ref.js +3 -3
  54. package/lib/object-ref.js.map +1 -1
  55. package/lib/prisma-field-builder.js +1 -2
  56. package/lib/prisma-field-builder.js.map +1 -1
  57. package/lib/schema-builder.js.map +1 -1
  58. package/lib/util/cursors.js +15 -15
  59. package/lib/util/cursors.js.map +1 -1
  60. package/lib/util/datamodel.js +9 -9
  61. package/lib/util/datamodel.js.map +1 -1
  62. package/lib/util/description.js +3 -3
  63. package/lib/util/description.js.map +1 -1
  64. package/lib/util/get-client.js +4 -4
  65. package/lib/util/get-client.js.map +1 -1
  66. package/lib/util/loader-map.js +4 -4
  67. package/lib/util/loader-map.js.map +1 -1
  68. package/lib/util/map-query.js +4 -4
  69. package/lib/util/map-query.js.map +1 -1
  70. package/lib/util/relation-map.js +3 -3
  71. package/lib/util/relation-map.js.map +1 -1
  72. package/lib/util/selections.js +7 -7
  73. package/lib/util/selections.js.map +1 -1
  74. package/lib/util/usage.js +5 -5
  75. package/lib/util/usage.js.map +1 -1
  76. package/package.json +10 -10
  77. package/src/field-builder.ts +2 -2
  78. package/src/generator.ts +29 -10
  79. package/src/global-types.ts +13 -14
  80. package/src/index.ts +3 -4
  81. package/src/model-loader.ts +4 -4
  82. package/src/object-ref.ts +2 -2
  83. package/src/prisma-field-builder.ts +8 -11
  84. package/src/schema-builder.ts +0 -3
  85. package/src/types.ts +16 -16
  86. package/src/util/cursors.ts +2 -2
  87. package/src/util/get-client.ts +1 -1
  88. package/src/util/map-query.ts +5 -5
@@ -1,11 +1,8 @@
1
1
  import './global-types';
2
2
  import SchemaBuilder, {
3
3
  brandWithType,
4
- completeValue,
5
- type FieldRef,
6
4
  type InterfaceRef,
7
5
  type OutputType,
8
- PothosError,
9
6
  type SchemaTypes,
10
7
  } from '@pothos/core';
11
8
  import type { GraphQLResolveInfo } from 'graphql';
package/src/types.ts CHANGED
@@ -27,9 +27,9 @@ import type { PrismaInterfaceRef, PrismaRef } from './interface-ref';
27
27
  import type { PrismaObjectFieldBuilder } from './prisma-field-builder';
28
28
 
29
29
  export interface PrismaDelegate {
30
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
30
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
31
31
  findUniqueOrThrow?: (...args: any[]) => Promise<unknown>;
32
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
32
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
33
33
  findUnique: (...args: any[]) => Promise<unknown>;
34
34
  }
35
35
 
@@ -86,7 +86,7 @@ export type PrismaObjectFieldOptions<
86
86
  ShapeFromSelection<
87
87
  Types,
88
88
  ExtractModel<Types, ParentShape>,
89
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
89
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
90
90
  { select: Select extends (...args: any[]) => infer S ? S : Select }
91
91
  >,
92
92
  > = PothosSchemaTypes.ObjectFieldOptions<Types, Shape, Type, Nullable, Args, ResolveReturnShape> &
@@ -435,7 +435,7 @@ export type RelatedFieldOptions<
435
435
  info: GraphQLResolveInfo,
436
436
  ) => MaybePromise<ShapeWithNullability<Types, Model['Relations'][Field]['Shape'], Nullable>>;
437
437
  description?: string | false;
438
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
438
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
439
439
  type?: PrismaRef<any, TypesForRelation<Types, Model, Field>>;
440
440
  query?: QueryForField<Types, Args, Model['Include'][Field & keyof Model['Include']]>;
441
441
  onNull?:
@@ -458,7 +458,7 @@ export type RelatedFieldOptions<
458
458
  export type VariantFieldOptions<
459
459
  Types extends SchemaTypes,
460
460
  Model extends PrismaModelTypes,
461
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
461
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
462
462
  Variant extends PrismaRef<any, Model>,
463
463
  Args extends InputFieldMap,
464
464
  isNull,
@@ -504,11 +504,11 @@ export type RelationCountOptions<
504
504
  export type PrismaFieldOptions<
505
505
  Types extends SchemaTypes,
506
506
  ParentShape,
507
- Type extends // biome-ignore lint/suspicious/noExplicitAny: <explanation>
507
+ Type extends // biome-ignore lint/suspicious/noExplicitAny: this is fine
508
508
  | PrismaRef<any, PrismaModelTypes>
509
509
  | keyof Types['PrismaTypes']
510
510
  | [keyof Types['PrismaTypes']]
511
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
511
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
512
512
  | [PrismaRef<any, PrismaModelTypes>],
513
513
  Model extends PrismaModelTypes,
514
514
  Param extends TypeParam<Types>,
@@ -530,7 +530,7 @@ export type PrismaFieldOptions<
530
530
  ? Omit<FieldOptions, InferredFieldOptionKeys | 'type'> & {
531
531
  type: Type;
532
532
  resolve: FieldOptions extends {
533
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
533
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
534
534
  resolve?: (parent: infer Parent, ...args: any[]) => unknown;
535
535
  }
536
536
  ? PrismaFieldResolver<Types, Model, Parent, Param, Args, Nullable, ResolveReturnShape>
@@ -544,11 +544,11 @@ export type PrismaFieldWithInputOptions<
544
544
  Kind extends FieldKind,
545
545
  Args extends InputFieldMap,
546
546
  Fields extends InputFieldMap,
547
- Type extends // biome-ignore lint/suspicious/noExplicitAny: <explanation>
547
+ Type extends // biome-ignore lint/suspicious/noExplicitAny: this is fine
548
548
  | PrismaRef<any, PrismaModelTypes>
549
549
  | keyof Types['PrismaTypes']
550
550
  | [keyof Types['PrismaTypes']]
551
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
551
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
552
552
  | [PrismaRef<any, PrismaModelTypes>],
553
553
  Model extends PrismaModelTypes,
554
554
  Param extends TypeParam<Types>,
@@ -616,9 +616,9 @@ export type PrismaFieldResolver<
616
616
  export type PrismaConnectionFieldOptions<
617
617
  Types extends SchemaTypes,
618
618
  ParentShape,
619
- Type extends // biome-ignore lint/suspicious/noExplicitAny: <explanation>
619
+ Type extends // biome-ignore lint/suspicious/noExplicitAny: this is fine
620
620
  | PrismaInterfaceRef<any, PrismaModelTypes>
621
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
621
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
622
622
  | PrismaRef<any, PrismaModelTypes>
623
623
  | keyof Types['PrismaTypes'],
624
624
  Model extends PrismaModelTypes,
@@ -741,7 +741,7 @@ export type RelatedConnectionOptions<
741
741
  } & {
742
742
  description?: string | false;
743
743
  query?: QueryForField<Types, Args, Model['Include'][Field & keyof Model['Include']]>;
744
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
744
+ // biome-ignore lint/suspicious/noExplicitAny: this is fine
745
745
  type?: PrismaRef<any, TypesForRelation<Types, Model, Field>>;
746
746
  cursor: CursorFromRelation<Model, Field>;
747
747
  defaultSize?: number | ((args: ConnectionArgs, ctx: Types['Context']) => number);
@@ -848,7 +848,7 @@ type InferModelShape<Model> = Simplify<
848
848
  // Infer relations for a given model
849
849
  type InferRelations<Model> = {
850
850
  [K in keyof Model]: {
851
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
851
+ // biome-ignore lint/suspicious/noExplicitAny: matching against any is okay
852
852
  Shape: Model[K] extends any[] ? InferModelShape<Model[K][0]>[] : InferModelShape<Model[K]>;
853
853
  Name: InferField<InferItemOfArray<Model[K]>, 'name'>;
854
854
  Nullable: IsNullable<Model[K]>;
@@ -857,7 +857,7 @@ type InferRelations<Model> = {
857
857
 
858
858
  // Create a list of keys that represent array relations
859
859
  type InferRelationList<Model> = {
860
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
860
+ // biome-ignore lint/suspicious/noExplicitAny: matching against any is okay
861
861
  [K in keyof Model as Model[K] extends any[] ? K : never]: K;
862
862
  };
863
863
 
@@ -869,7 +869,7 @@ type InferItemOfArray<T> = T extends Array<infer U> ? U : T;
869
869
 
870
870
  // Infers the composites of a given model
871
871
  type InferComposites<Model> = {
872
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
872
+ // biome-ignore lint/suspicious/noExplicitAny: matching against any is okay
873
873
  [K in keyof Model]: Model[K] extends any[]
874
874
  ? Simplify<
875
875
  InferField<Model[K][0], 'scalars'> & InferComposites<InferField<Model[K][0], 'composites'>>
@@ -1,9 +1,9 @@
1
1
  import {
2
+ decodeBase64,
3
+ encodeBase64,
2
4
  type MaybePromise,
3
5
  PothosValidationError,
4
6
  type SchemaTypes,
5
- decodeBase64,
6
- encodeBase64,
7
7
  } from '@pothos/core';
8
8
  import { getModel } from './datamodel';
9
9
  import type { DMMFField } from './get-client';
@@ -1,4 +1,4 @@
1
- import { type SchemaTypes, createContextCache } from '@pothos/core';
1
+ import { createContextCache, type SchemaTypes } from '@pothos/core';
2
2
  import type { PrismaClient } from '../types';
3
3
 
4
4
  export interface DMMFField {
@@ -1,4 +1,4 @@
1
- import { PothosValidationError, getMappedArgumentValues } from '@pothos/core';
1
+ import { getMappedArgumentValues, PothosValidationError } from '@pothos/core';
2
2
  import {
3
3
  type FieldNode,
4
4
  type FragmentDefinitionNode,
@@ -10,13 +10,13 @@ import {
10
10
  type GraphQLObjectType,
11
11
  type GraphQLResolveInfo,
12
12
  GraphQLSkipDirective,
13
- type InlineFragmentNode,
14
- Kind,
15
- type SelectionSetNode,
16
13
  getDirectiveValues,
17
14
  getNamedType,
15
+ type InlineFragmentNode,
18
16
  isInterfaceType,
19
17
  isObjectType,
18
+ Kind,
19
+ type SelectionSetNode,
20
20
  } from 'graphql';
21
21
  import type {
22
22
  FieldSelection,
@@ -28,9 +28,9 @@ import type {
28
28
  import { setLoaderMappings } from './loader-map';
29
29
  import type { FieldMap } from './relation-map';
30
30
  import {
31
- type SelectionState,
32
31
  createState,
33
32
  mergeSelection,
33
+ type SelectionState,
34
34
  selectionCompatible,
35
35
  selectionToQuery,
36
36
  } from './selections';