@pothos/plugin-prisma 4.8.2 → 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.
- package/CHANGELOG.md +13 -0
- package/dts/global-types.d.ts +2 -2
- package/dts/global-types.d.ts.map +1 -1
- package/dts/index.d.ts +3 -3
- package/dts/index.d.ts.map +1 -1
- package/dts/model-loader.d.ts.map +1 -1
- package/dts/object-ref.d.ts +1 -1
- package/dts/object-ref.d.ts.map +1 -1
- package/dts/prisma-field-builder.d.ts.map +1 -1
- package/dts/util/cursors.d.ts.map +1 -1
- package/dts/util/get-client.d.ts.map +1 -1
- package/dts/util/map-query.d.ts.map +1 -1
- package/esm/field-builder.js +2 -2
- package/esm/field-builder.js.map +1 -1
- package/esm/generator.js +12 -7
- package/esm/generator.js.map +1 -1
- package/esm/global-types.d.ts +2 -2
- package/esm/global-types.d.ts.map +1 -1
- package/esm/global-types.js.map +1 -1
- package/esm/index.d.ts +3 -3
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -2
- package/esm/index.js.map +1 -1
- package/esm/interface-ref.js.map +1 -1
- package/esm/model-loader.d.ts.map +1 -1
- package/esm/model-loader.js +2 -2
- package/esm/model-loader.js.map +1 -1
- package/esm/object-ref.d.ts +1 -1
- package/esm/object-ref.d.ts.map +1 -1
- package/esm/object-ref.js +1 -1
- package/esm/object-ref.js.map +1 -1
- package/esm/prisma-field-builder.d.ts.map +1 -1
- package/esm/prisma-field-builder.js +6 -7
- package/esm/prisma-field-builder.js.map +1 -1
- package/esm/schema-builder.js.map +1 -1
- package/esm/util/cursors.d.ts.map +1 -1
- package/esm/util/cursors.js +1 -1
- package/esm/util/cursors.js.map +1 -1
- package/esm/util/get-client.d.ts.map +1 -1
- package/esm/util/get-client.js.map +1 -1
- package/esm/util/map-query.d.ts.map +1 -1
- package/esm/util/map-query.js +2 -2
- package/esm/util/map-query.js.map +1 -1
- package/lib/connection-helpers.js +3 -3
- package/lib/connection-helpers.js.map +1 -1
- package/lib/generator.js +12 -7
- package/lib/generator.js.map +1 -1
- package/lib/index.js +16 -16
- package/lib/index.js.map +1 -1
- package/lib/interface-ref.js.map +1 -1
- package/lib/model-loader.js +1 -1
- package/lib/model-loader.js.map +1 -1
- package/lib/object-ref.js +3 -3
- package/lib/object-ref.js.map +1 -1
- package/lib/prisma-field-builder.js +1 -2
- package/lib/prisma-field-builder.js.map +1 -1
- package/lib/schema-builder.js.map +1 -1
- package/lib/util/cursors.js +15 -15
- package/lib/util/cursors.js.map +1 -1
- package/lib/util/datamodel.js +9 -9
- package/lib/util/datamodel.js.map +1 -1
- package/lib/util/description.js +3 -3
- package/lib/util/description.js.map +1 -1
- package/lib/util/get-client.js +4 -4
- package/lib/util/get-client.js.map +1 -1
- package/lib/util/loader-map.js +4 -4
- package/lib/util/loader-map.js.map +1 -1
- package/lib/util/map-query.js +4 -4
- package/lib/util/map-query.js.map +1 -1
- package/lib/util/relation-map.js +3 -3
- package/lib/util/relation-map.js.map +1 -1
- package/lib/util/selections.js +7 -7
- package/lib/util/selections.js.map +1 -1
- package/lib/util/usage.js +5 -5
- package/lib/util/usage.js.map +1 -1
- package/package.json +10 -10
- package/src/field-builder.ts +2 -2
- package/src/generator.ts +20 -11
- package/src/global-types.ts +13 -14
- package/src/index.ts +3 -4
- package/src/model-loader.ts +4 -4
- package/src/object-ref.ts +2 -2
- package/src/prisma-field-builder.ts +8 -11
- package/src/schema-builder.ts +0 -3
- package/src/types.ts +16 -16
- package/src/util/cursors.ts +2 -2
- package/src/util/get-client.ts +1 -1
- package/src/util/map-query.ts +5 -5
package/src/schema-builder.ts
CHANGED
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:
|
|
30
|
+
// biome-ignore lint/suspicious/noExplicitAny: this is fine
|
|
31
31
|
findUniqueOrThrow?: (...args: any[]) => Promise<unknown>;
|
|
32
|
-
// biome-ignore lint/suspicious/noExplicitAny:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
619
|
+
Type extends // biome-ignore lint/suspicious/noExplicitAny: this is fine
|
|
620
620
|
| PrismaInterfaceRef<any, PrismaModelTypes>
|
|
621
|
-
// biome-ignore lint/suspicious/noExplicitAny:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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'>>
|
package/src/util/cursors.ts
CHANGED
package/src/util/get-client.ts
CHANGED
package/src/util/map-query.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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';
|