@pothos/plugin-prisma 3.35.1 → 3.35.3
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 +12 -0
- package/esm/field-builder.d.ts +2 -0
- package/esm/{dts/field-builder.d.ts.map → field-builder.d.ts.map} +0 -0
- package/esm/generator.d.ts +2 -0
- package/esm/{dts/generator.d.ts.map → generator.d.ts.map} +0 -0
- package/esm/global-types.d.ts +123 -0
- package/esm/{dts/global-types.d.ts.map → global-types.d.ts.map} +0 -0
- package/esm/{dts/index.d.ts → index.d.ts} +7 -7
- package/esm/{dts/index.d.ts.map → index.d.ts.map} +0 -0
- package/esm/{dts/model-loader.d.ts → model-loader.d.ts} +4 -3
- package/esm/{dts/model-loader.d.ts.map → model-loader.d.ts.map} +0 -0
- package/esm/node-ref.d.ts +5 -0
- package/esm/{dts/node-ref.d.ts.map → node-ref.d.ts.map} +0 -0
- package/esm/{dts/object-ref.d.ts → object-ref.d.ts} +2 -2
- package/esm/{dts/object-ref.d.ts.map → object-ref.d.ts.map} +0 -0
- package/esm/{dts/prisma-field-builder.d.ts → prisma-field-builder.d.ts} +58 -28
- package/esm/{dts/prisma-field-builder.d.ts.map → prisma-field-builder.d.ts.map} +0 -0
- package/esm/schema-builder.d.ts +2 -0
- package/esm/{dts/schema-builder.d.ts.map → schema-builder.d.ts.map} +0 -0
- package/esm/{dts/types.d.ts → types.d.ts} +81 -65
- package/esm/{dts/types.d.ts.map → types.d.ts.map} +0 -0
- package/esm/{dts/util → util}/cursors.d.ts +1 -1
- package/esm/{dts/util → util}/cursors.d.ts.map +0 -0
- package/esm/{dts/util → util}/datamodel.d.ts +3 -3
- package/esm/{dts/util → util}/datamodel.d.ts.map +0 -0
- package/esm/{dts/util → util}/deep-equal.d.ts +1 -1
- package/esm/{dts/util → util}/deep-equal.d.ts.map +0 -0
- package/esm/{dts/util → util}/description.d.ts +1 -1
- package/esm/{dts/util → util}/description.d.ts.map +0 -0
- package/esm/{dts/util → util}/get-client.d.ts +3 -3
- package/esm/{dts/util → util}/get-client.d.ts.map +0 -0
- package/esm/{dts/util → util}/loader-map.d.ts +4 -4
- package/esm/{dts/util → util}/loader-map.d.ts.map +0 -0
- package/esm/{dts/util → util}/map-query.d.ts +4 -4
- package/esm/{dts/util → util}/map-query.d.ts.map +0 -0
- package/esm/{dts/util → util}/relation-map.d.ts +3 -2
- package/esm/{dts/util → util}/relation-map.d.ts.map +0 -0
- package/esm/{dts/util → util}/selections.d.ts +4 -4
- package/esm/{dts/util → util}/selections.d.ts.map +0 -0
- package/package.json +9 -9
- package/esm/dts/field-builder.d.ts +0 -2
- package/esm/dts/generator.d.ts +0 -2
- package/esm/dts/global-types.d.ts +0 -94
- package/esm/dts/node-ref.d.ts +0 -5
- package/esm/dts/schema-builder.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.35.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3a82d645: Apply esm transform to esm d.ts definitions
|
|
8
|
+
|
|
9
|
+
## 3.35.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 218fc68b: Fix script for copying ems d.ts definitions
|
|
14
|
+
|
|
3
15
|
## 3.35.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { FieldKind, FieldNullability, FieldRef, InputFieldMap, InputFieldRef, InterfaceParam, NormalizeArgs, OutputType, PluginName, SchemaTypes, ShapeFromTypeParam, TypeParam } from '@pothos/core';
|
|
2
|
+
import PrismaNodeRef from './node-ref.js';
|
|
3
|
+
import { prismaModelKey, PrismaObjectRef } from './object-ref.js';
|
|
4
|
+
import { PrismaObjectFieldBuilder as InternalPrismaObjectFieldBuilder } from './prisma-field-builder.js';
|
|
5
|
+
import { PrismaClient, PrismaConnectionFieldOptions, PrismaFieldOptions, PrismaFieldWithInputOptions, PrismaModelTypes, PrismaNodeOptions, PrismaObjectFieldOptions, PrismaObjectTypeOptions, ShapeFromConnection, ShapeFromSelection } from './types.js';
|
|
6
|
+
import type { PrismaPlugin } from './index.js';
|
|
7
|
+
declare global {
|
|
8
|
+
export namespace PothosSchemaTypes {
|
|
9
|
+
interface Plugins<Types extends SchemaTypes> {
|
|
10
|
+
prisma: PrismaPlugin<Types>;
|
|
11
|
+
}
|
|
12
|
+
interface SchemaBuilderOptions<Types extends SchemaTypes> {
|
|
13
|
+
prisma: {
|
|
14
|
+
filterConnectionTotalCount?: boolean;
|
|
15
|
+
client: PrismaClient;
|
|
16
|
+
exposeDescriptions?: boolean | {
|
|
17
|
+
models?: boolean;
|
|
18
|
+
fields?: boolean;
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
filterConnectionTotalCount?: boolean;
|
|
22
|
+
client: (ctx: Types["Context"]) => PrismaClient;
|
|
23
|
+
dmmf: {
|
|
24
|
+
datamodel: unknown;
|
|
25
|
+
};
|
|
26
|
+
exposeDescriptions?: boolean | {
|
|
27
|
+
models?: boolean;
|
|
28
|
+
fields?: boolean;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
interface UserSchemaTypes {
|
|
33
|
+
PrismaTypes: {};
|
|
34
|
+
}
|
|
35
|
+
interface ExtendDefaultTypes<PartialTypes extends Partial<UserSchemaTypes>> {
|
|
36
|
+
PrismaTypes: PartialTypes["PrismaTypes"] & {};
|
|
37
|
+
}
|
|
38
|
+
interface PothosKindToGraphQLType {
|
|
39
|
+
PrismaObject: "Object";
|
|
40
|
+
}
|
|
41
|
+
interface FieldOptionsByKind<Types extends SchemaTypes, ParentShape, Type extends TypeParam<Types>, Nullable extends FieldNullability<Type>, Args extends InputFieldMap, ResolveShape, ResolveReturnShape> {
|
|
42
|
+
PrismaObject: PrismaObjectFieldOptions<Types, ParentShape, Type, Nullable, Args, ResolveShape, ResolveReturnShape>;
|
|
43
|
+
}
|
|
44
|
+
interface SchemaBuilder<Types extends SchemaTypes> {
|
|
45
|
+
prismaObject: <Name extends keyof Types["PrismaTypes"], Interfaces extends InterfaceParam<Types>[], FindUnique, Model extends PrismaModelTypes & Types["PrismaTypes"][Name], Include = unknown, Select = unknown>(name: Name, options: PrismaObjectTypeOptions<Types, Model, Interfaces, FindUnique, Include, Select, ShapeFromSelection<Model, {
|
|
46
|
+
select: Select;
|
|
47
|
+
include: Include;
|
|
48
|
+
}>>) => PrismaObjectRef<Model, ShapeFromSelection<Model, {
|
|
49
|
+
select: Select;
|
|
50
|
+
include: Include;
|
|
51
|
+
}>>;
|
|
52
|
+
prismaNode: "relay" extends PluginName ? <Name extends keyof Types["PrismaTypes"], Interfaces extends InterfaceParam<Types>[] = [
|
|
53
|
+
], Include = unknown, Select = unknown, UniqueField = unknown>(name: Name, options: PrismaNodeOptions<Types, Types["PrismaTypes"][Name] & PrismaModelTypes, Interfaces, Include, Select, ShapeFromSelection<PrismaModelTypes & Types["PrismaTypes"][Name], {
|
|
54
|
+
select: Select;
|
|
55
|
+
include: Include;
|
|
56
|
+
}>, UniqueField>) => PrismaNodeRef<Types["PrismaTypes"][Name] & PrismaModelTypes, ShapeFromSelection<PrismaModelTypes & Types["PrismaTypes"][Name], {
|
|
57
|
+
select: Select;
|
|
58
|
+
include: Include;
|
|
59
|
+
}>> : "@pothos/plugin-relay is required to use this method";
|
|
60
|
+
}
|
|
61
|
+
interface RootFieldBuilder<Types extends SchemaTypes, ParentShape, Kind extends FieldKind = FieldKind> {
|
|
62
|
+
prismaField: <Args extends InputFieldMap, TypeParam extends PrismaObjectRef<PrismaModelTypes> | keyof Types["PrismaTypes"] | [
|
|
63
|
+
keyof Types["PrismaTypes"]
|
|
64
|
+
] | [
|
|
65
|
+
PrismaObjectRef<PrismaModelTypes>
|
|
66
|
+
], Nullable extends FieldNullability<Type>, ResolveShape, ResolveReturnShape, Type extends TypeParam extends [
|
|
67
|
+
unknown
|
|
68
|
+
] ? [
|
|
69
|
+
ObjectRef<Model["Shape"]>
|
|
70
|
+
] : ObjectRef<Model["Shape"]>, Model extends PrismaModelTypes = PrismaModelTypes & (TypeParam extends [
|
|
71
|
+
keyof Types["PrismaTypes"]
|
|
72
|
+
] ? Types["PrismaTypes"][TypeParam[0]] : TypeParam extends [
|
|
73
|
+
PrismaObjectRef<PrismaModelTypes>
|
|
74
|
+
] ? TypeParam[0][typeof prismaModelKey] : TypeParam extends PrismaObjectRef<PrismaModelTypes> ? TypeParam[typeof prismaModelKey] : TypeParam extends keyof Types["PrismaTypes"] ? Types["PrismaTypes"][TypeParam] : never)>(options: PrismaFieldOptions<Types, ParentShape, TypeParam, Model, Type, Args, Nullable, ResolveShape, ResolveReturnShape, Kind>) => FieldRef<ShapeFromTypeParam<Types, Type, Nullable>>;
|
|
75
|
+
prismaConnection: "relay" extends PluginName ? <Type extends PrismaObjectRef<PrismaModelTypes> | keyof Types["PrismaTypes"], Nullable extends boolean, ResolveReturnShape, Args extends InputFieldMap = {}, Model extends PrismaModelTypes = Type extends PrismaObjectRef<infer T> ? T : PrismaModelTypes & Types["PrismaTypes"][Type & keyof Types["PrismaTypes"]]>(options: PrismaConnectionFieldOptions<Types, ParentShape, Type, Model, ObjectRef<Model["Shape"]>, Nullable, Args, ResolveReturnShape, Kind>, ...args: NormalizeArgs<[
|
|
76
|
+
connectionOptions: ConnectionObjectOptions<Types, ObjectRef<Model["Shape"]>, false, false, ResolveReturnShape>,
|
|
77
|
+
edgeOptions: ConnectionEdgeObjectOptions<Types, ObjectRef<Model["Shape"]>, false, ResolveReturnShape>
|
|
78
|
+
], 0>) => FieldRef<ShapeFromConnection<ConnectionShapeHelper<Types, Model["Shape"], Nullable>>> : "@pothos/plugin-relay is required to use this method";
|
|
79
|
+
prismaFieldWithInput: "prisma" extends PluginName ? <Fields extends Record<string, InputFieldRef<unknown, "InputObject">>, TypeParam extends PrismaObjectRef<PrismaModelTypes> | keyof Types["PrismaTypes"] | [
|
|
80
|
+
keyof Types["PrismaTypes"]
|
|
81
|
+
] | [
|
|
82
|
+
PrismaObjectRef<PrismaModelTypes>
|
|
83
|
+
], Type extends TypeParam extends [
|
|
84
|
+
unknown
|
|
85
|
+
] ? [
|
|
86
|
+
ObjectRef<Model["Shape"]>
|
|
87
|
+
] : ObjectRef<Model["Shape"]>, ResolveShape, ResolveReturnShape, ArgRequired extends boolean, Args extends Record<string, InputFieldRef<unknown, "Arg">> = {}, Nullable extends FieldNullability<Type> = Types["DefaultFieldNullability"], InputName extends string = "input", Model extends PrismaModelTypes = PrismaModelTypes & (TypeParam extends [
|
|
88
|
+
keyof Types["PrismaTypes"]
|
|
89
|
+
] ? Types["PrismaTypes"][TypeParam[0]] : TypeParam extends [
|
|
90
|
+
PrismaObjectRef<PrismaModelTypes>
|
|
91
|
+
] ? TypeParam[0][typeof prismaModelKey] : TypeParam extends PrismaObjectRef<PrismaModelTypes> ? TypeParam[typeof prismaModelKey] : TypeParam extends keyof Types["PrismaTypes"] ? Types["PrismaTypes"][TypeParam] : never)>(options: PrismaFieldWithInputOptions<Types, ParentShape, Kind, Args, Fields, TypeParam, Model, Type, Nullable, InputName, ResolveShape, ResolveReturnShape, boolean extends ArgRequired ? (Types & {
|
|
92
|
+
WithInputArgRequired: boolean;
|
|
93
|
+
})["WithInputArgRequired"] : ArgRequired>) => FieldRef<ShapeFromTypeParam<Types, Type, Nullable>> : "@pothos/plugin-prisma is required to use this method";
|
|
94
|
+
}
|
|
95
|
+
interface ConnectionFieldOptions<Types extends SchemaTypes, ParentShape, Type extends OutputType<Types>, Nullable extends boolean, EdgeNullability extends FieldNullability<[
|
|
96
|
+
unknown
|
|
97
|
+
]>, NodeNullability extends boolean, Args extends InputFieldMap, ResolveReturnShape> {
|
|
98
|
+
}
|
|
99
|
+
interface ConnectionObjectOptions<Types extends SchemaTypes, Type extends OutputType<Types>, EdgeNullability extends FieldNullability<[
|
|
100
|
+
unknown
|
|
101
|
+
]>, NodeNullability extends boolean, Resolved> {
|
|
102
|
+
}
|
|
103
|
+
interface ConnectionEdgeObjectOptions<Types extends SchemaTypes, Type extends OutputType<Types>, NodeNullability extends boolean, Resolved> {
|
|
104
|
+
}
|
|
105
|
+
interface DefaultConnectionArguments {
|
|
106
|
+
first?: number | null | undefined;
|
|
107
|
+
last?: number | null | undefined;
|
|
108
|
+
before?: string | null | undefined;
|
|
109
|
+
after?: string | null | undefined;
|
|
110
|
+
}
|
|
111
|
+
interface ConnectionShapeHelper<Types extends SchemaTypes, T, Nullable> {
|
|
112
|
+
}
|
|
113
|
+
interface ScopeAuthFieldAuthScopes<Types extends SchemaTypes, Parent, Args extends {} = {}> {
|
|
114
|
+
}
|
|
115
|
+
interface ScopeAuthContextForAuth<Types extends SchemaTypes, Scopes extends {}> {
|
|
116
|
+
}
|
|
117
|
+
interface PrismaObjectFieldBuilder<Types extends SchemaTypes, Model extends PrismaModelTypes, NeedsResolve extends boolean, Shape extends object = Model["Shape"]> extends InternalPrismaObjectFieldBuilder<Types, Model, NeedsResolve, Shape>, RootFieldBuilder<Types, Shape, "PrismaObject"> {
|
|
118
|
+
}
|
|
119
|
+
interface FieldWithInputBaseOptions<Types extends SchemaTypes, Args extends Record<string, InputFieldRef<unknown, "Arg">>, Fields extends Record<string, InputFieldRef<unknown, "InputObject">>, InputName extends string, ArgRequired extends boolean> {
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=global-types.d.ts.map
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import './global-types';
|
|
2
|
-
import './schema-builder';
|
|
1
|
+
import './global-types.js';
|
|
2
|
+
import './schema-builder.js';
|
|
3
3
|
import { GraphQLFieldResolver } from 'graphql';
|
|
4
4
|
import SchemaBuilder, { BasePlugin, BuildCache, PothosOutputFieldConfig, SchemaTypes } from '@pothos/core';
|
|
5
|
-
import { PrismaModelTypes } from './types';
|
|
6
|
-
import { queryFromInfo } from './util/map-query';
|
|
7
|
-
export * from './types';
|
|
5
|
+
import { PrismaModelTypes } from './types.js';
|
|
6
|
+
import { queryFromInfo } from './util/map-query.js';
|
|
7
|
+
export * from './types.js';
|
|
8
8
|
declare const pluginName: "prisma";
|
|
9
9
|
export default pluginName;
|
|
10
10
|
export { queryFromInfo };
|
|
@@ -13,6 +13,6 @@ export declare const ObjectFieldBuilder: new <Types extends SchemaTypes, Model e
|
|
|
13
13
|
export declare class PrismaPlugin<Types extends SchemaTypes> extends BasePlugin<Types> {
|
|
14
14
|
constructor(cache: BuildCache<Types>);
|
|
15
15
|
onOutputFieldConfig(fieldConfig: PothosOutputFieldConfig<Types>): PothosOutputFieldConfig<Types> | null;
|
|
16
|
-
wrapResolve(resolver: GraphQLFieldResolver<unknown, Types[
|
|
16
|
+
wrapResolve(resolver: GraphQLFieldResolver<unknown, Types["Context"], object, unknown>, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object>;
|
|
17
17
|
}
|
|
18
|
-
//# sourceMappingURL=index.d.ts.map
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObjectRef, SchemaTypes } from '@pothos/core';
|
|
2
|
-
import { SelectionState } from './util/selections';
|
|
2
|
+
import { SelectionState } from './util/selections.js';
|
|
3
3
|
export declare class ModelLoader {
|
|
4
4
|
model: object;
|
|
5
5
|
builder: PothosSchemaTypes.SchemaBuilder<never>;
|
|
@@ -10,7 +10,8 @@ export declare class ModelLoader {
|
|
|
10
10
|
state: SelectionState;
|
|
11
11
|
}>;
|
|
12
12
|
constructor(model: object, builder: PothosSchemaTypes.SchemaBuilder<never>, modelName: string, findUnique: (model: Record<string, unknown>, ctx: {}) => unknown);
|
|
13
|
-
static forRef<Types extends SchemaTypes>(ref: ObjectRef<unknown>, modelName: string, findUnique: ((model: Record<string, unknown>, ctx: {}) => unknown) | undefined, builder: PothosSchemaTypes.SchemaBuilder<Types>): import("@pothos/core").ContextCache<ModelLoader, object, [
|
|
13
|
+
static forRef<Types extends SchemaTypes>(ref: ObjectRef<unknown>, modelName: string, findUnique: ((model: Record<string, unknown>, ctx: {}) => unknown) | undefined, builder: PothosSchemaTypes.SchemaBuilder<Types>): import("@pothos/core").ContextCache<ModelLoader, object, [
|
|
14
|
+
]>;
|
|
14
15
|
static getFindUnique(findBy: {
|
|
15
16
|
name: string | null;
|
|
16
17
|
fields: string[];
|
|
@@ -26,4 +27,4 @@ export declare class ModelLoader {
|
|
|
26
27
|
loadSelection(selection: SelectionState, context: object): Promise<Record<string, unknown>>;
|
|
27
28
|
initLoad(state: SelectionState, context: {}): Promise<Record<string, unknown>>;
|
|
28
29
|
}
|
|
29
|
-
//# sourceMappingURL=model-loader.d.ts.map
|
|
30
|
+
//# sourceMappingURL=model-loader.d.ts.map
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { abstractReturnShapeKey, ObjectRef } from '@pothos/core';
|
|
2
|
-
import type { PrismaModelTypes, WithBrand } from './types';
|
|
2
|
+
import type { PrismaModelTypes, WithBrand } from './types.js';
|
|
3
3
|
export declare const prismaModelKey: unique symbol;
|
|
4
4
|
export declare class PrismaObjectRef<Model extends PrismaModelTypes, T = {}> extends ObjectRef<T> {
|
|
5
5
|
[prismaModelKey]: Model;
|
|
@@ -9,4 +9,4 @@ export declare class PrismaObjectRef<Model extends PrismaModelTypes, T = {}> ext
|
|
|
9
9
|
} : WithBrand<V>;
|
|
10
10
|
hasBrand(value: unknown): boolean;
|
|
11
11
|
}
|
|
12
|
-
//# sourceMappingURL=object-ref.d.ts.map
|
|
12
|
+
//# sourceMappingURL=object-ref.d.ts.map
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CompatibleTypes, FieldKind, FieldRef, InputFieldMap, NormalizeArgs, ObjectRef, PluginName, SchemaTypes, ShapeFromTypeParam, TypeParam } from '@pothos/core';
|
|
2
|
-
import { PrismaObjectRef } from './object-ref';
|
|
3
|
-
import { PrismaModelTypes, RelatedConnectionOptions, RelatedFieldOptions, RelationCountOptions, ShapeFromConnection, VariantFieldOptions } from './types';
|
|
4
|
-
import { FieldMap } from './util/relation-map';
|
|
2
|
+
import { PrismaObjectRef } from './object-ref.js';
|
|
3
|
+
import { PrismaModelTypes, RelatedConnectionOptions, RelatedFieldOptions, RelationCountOptions, ShapeFromConnection, VariantFieldOptions } from './types.js';
|
|
4
|
+
import { FieldMap } from './util/relation-map.js';
|
|
5
5
|
declare const RootBuilder: {
|
|
6
6
|
new <Types extends SchemaTypes, Shape, Kind extends FieldKind>(name: string, builder: PothosSchemaTypes.SchemaBuilder<Types>, kind: FieldKind, graphqlKind: PothosSchemaTypes.PothosKindToGraphQLType[FieldKind]): PothosSchemaTypes.RootFieldBuilder<Types, Shape, Kind>;
|
|
7
7
|
};
|
|
@@ -11,7 +11,7 @@ declare type ContextForAuth<Types extends SchemaTypes, Scopes extends {} = {}> =
|
|
|
11
11
|
declare type FieldAuthScopes<Types extends SchemaTypes, Parent, Args extends {} = {}> = PothosSchemaTypes.ScopeAuthFieldAuthScopes<Types, Parent, Args> extends {
|
|
12
12
|
Scopes: infer T;
|
|
13
13
|
} ? T : never;
|
|
14
|
-
export declare class PrismaObjectFieldBuilder<Types extends SchemaTypes, Model extends PrismaModelTypes, NeedsResolve extends boolean, Shape extends object = Model[
|
|
14
|
+
export declare class PrismaObjectFieldBuilder<Types extends SchemaTypes, Model extends PrismaModelTypes, NeedsResolve extends boolean, Shape extends object = Model["Shape"]> extends RootBuilder<Types, Shape, "PrismaObject"> {
|
|
15
15
|
model: string;
|
|
16
16
|
prismaFieldMap: FieldMap;
|
|
17
17
|
exposeBoolean: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, Model["Shape"], "Boolean", Nullable>>(name?: Name | undefined, options?: (Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, "Boolean", Nullable, {}, ResolveReturnShape>, "type" | "description" | "resolve" | "select"> & {
|
|
@@ -29,43 +29,73 @@ export declare class PrismaObjectFieldBuilder<Types extends SchemaTypes, Model e
|
|
|
29
29
|
exposeString: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, Model["Shape"], "String", Nullable>>(name?: Name | undefined, options?: (Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, "String", Nullable, {}, ResolveReturnShape>, "type" | "description" | "resolve" | "select"> & {
|
|
30
30
|
description?: string | false | undefined;
|
|
31
31
|
}) | undefined) => FieldRef<import("@pothos/core").FieldNullability<"String"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("String" extends infer T ? T extends "String" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("@pothos/core").BaseEnum ? import("@pothos/core").ValuesFromEnum<T> : never : never : never) | null | undefined : "String" extends infer T ? T extends "String" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("@pothos/core").BaseEnum ? import("@pothos/core").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("String" extends infer T ? T extends "String" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("@pothos/core").BaseEnum ? import("@pothos/core").ValuesFromEnum<T> : never : never : never) | null | undefined : "String" extends infer T ? T extends "String" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("@pothos/core").BaseEnum ? import("@pothos/core").ValuesFromEnum<T> : never : never : never, "PrismaObject">;
|
|
32
|
-
exposeBooleanList: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, Model["Shape"], [
|
|
32
|
+
exposeBooleanList: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, Model["Shape"], [
|
|
33
|
+
"Boolean"
|
|
34
|
+
], Nullable>>(name?: Name | undefined, options?: (Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, [
|
|
35
|
+
"Boolean"
|
|
36
|
+
], Nullable, {}, ResolveReturnShape>, "type" | "description" | "resolve" | "select"> & {
|
|
33
37
|
description?: string | false | undefined;
|
|
34
|
-
}) | undefined) => FieldRef<ShapeFromTypeParam<Types, [
|
|
35
|
-
|
|
38
|
+
}) | undefined) => FieldRef<ShapeFromTypeParam<Types, [
|
|
39
|
+
"Boolean"
|
|
40
|
+
], Nullable>, "PrismaObject">;
|
|
41
|
+
exposeFloatList: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, Model["Shape"], [
|
|
42
|
+
"Float"
|
|
43
|
+
], Nullable>>(name?: Name | undefined, options?: (Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, [
|
|
44
|
+
"Float"
|
|
45
|
+
], Nullable, {}, ResolveReturnShape>, "type" | "description" | "resolve" | "select"> & {
|
|
36
46
|
description?: string | false | undefined;
|
|
37
|
-
}) | undefined) => FieldRef<ShapeFromTypeParam<Types, [
|
|
38
|
-
|
|
47
|
+
}) | undefined) => FieldRef<ShapeFromTypeParam<Types, [
|
|
48
|
+
"Float"
|
|
49
|
+
], Nullable>, "PrismaObject">;
|
|
50
|
+
exposeIntList: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, Model["Shape"], [
|
|
51
|
+
"Int"
|
|
52
|
+
], Nullable>>(name?: Name | undefined, options?: (Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, [
|
|
53
|
+
"Int"
|
|
54
|
+
], Nullable, {}, ResolveReturnShape>, "type" | "description" | "resolve" | "select"> & {
|
|
39
55
|
description?: string | false | undefined;
|
|
40
|
-
}) | undefined) => FieldRef<ShapeFromTypeParam<Types, [
|
|
41
|
-
|
|
56
|
+
}) | undefined) => FieldRef<ShapeFromTypeParam<Types, [
|
|
57
|
+
"Int"
|
|
58
|
+
], Nullable>, "PrismaObject">;
|
|
59
|
+
exposeIDList: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, Model["Shape"], [
|
|
60
|
+
"ID"
|
|
61
|
+
], Nullable>>(name?: Name | undefined, options?: (Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, [
|
|
62
|
+
"ID"
|
|
63
|
+
], Nullable, {}, ResolveReturnShape>, "type" | "description" | "resolve" | "select"> & {
|
|
42
64
|
description?: string | false | undefined;
|
|
43
|
-
}) | undefined) => FieldRef<ShapeFromTypeParam<Types, [
|
|
44
|
-
|
|
65
|
+
}) | undefined) => FieldRef<ShapeFromTypeParam<Types, [
|
|
66
|
+
"ID"
|
|
67
|
+
], Nullable>, "PrismaObject">;
|
|
68
|
+
exposeStringList: <Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, Model["Shape"], [
|
|
69
|
+
"String"
|
|
70
|
+
], Nullable>>(name?: Name | undefined, options?: (Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, [
|
|
71
|
+
"String"
|
|
72
|
+
], Nullable, {}, ResolveReturnShape>, "type" | "description" | "resolve" | "select"> & {
|
|
45
73
|
description?: string | false | undefined;
|
|
46
|
-
}) | undefined) => FieldRef<ShapeFromTypeParam<Types, [
|
|
47
|
-
|
|
74
|
+
}) | undefined) => FieldRef<ShapeFromTypeParam<Types, [
|
|
75
|
+
"String"
|
|
76
|
+
], Nullable>, "PrismaObject">;
|
|
77
|
+
withAuth: "scopeAuth" extends PluginName ? <Scopes extends FieldAuthScopes<Types, Shape, Record<string, unknown>>>(scopes: Scopes) => PothosSchemaTypes.PrismaObjectFieldBuilder<Omit<Types, "Context"> & {
|
|
48
78
|
Context: ContextForAuth<Types, Scopes>;
|
|
49
|
-
}, Model, NeedsResolve, Shape> :
|
|
50
|
-
relatedConnection:
|
|
79
|
+
}, Model, NeedsResolve, Shape> : "@pothos/plugin-scope-auth is required to use this method";
|
|
80
|
+
relatedConnection: "relay" extends PluginName ? <Field extends Model["ListRelations"], Nullable extends boolean, Args extends InputFieldMap, ResolveReturnShape>(field: Field, options: RelatedConnectionOptions<Types, Model, Field, Nullable, Args, NeedsResolve>, ...args: NormalizeArgs<[
|
|
51
81
|
connectionOptions: PothosSchemaTypes.ConnectionObjectOptions<Types, ObjectRef<Shape>, false, false, ResolveReturnShape>,
|
|
52
82
|
edgeOptions: PothosSchemaTypes.ConnectionEdgeObjectOptions<Types, ObjectRef<Shape>, false, ResolveReturnShape>
|
|
53
|
-
], 0>) => FieldRef<ShapeFromConnection<PothosSchemaTypes.ConnectionShapeHelper<Types, Shape, Nullable>>> :
|
|
83
|
+
], 0>) => FieldRef<ShapeFromConnection<PothosSchemaTypes.ConnectionShapeHelper<Types, Shape, Nullable>>> : "@pothos/plugin-relay is required to use this method";
|
|
54
84
|
constructor(name: string, builder: PothosSchemaTypes.SchemaBuilder<Types>, model: string, fieldMap: FieldMap);
|
|
55
|
-
relation<Field extends Model[
|
|
85
|
+
relation<Field extends Model["RelationName"], Nullable extends boolean, Args extends InputFieldMap, ResolveReturnShape>(name: Field, ...allArgs: NormalizeArgs<[
|
|
56
86
|
options: RelatedFieldOptions<Types, Model, Field, Nullable, Args, ResolveReturnShape, NeedsResolve, Shape>
|
|
57
|
-
]>): FieldRef<Model[
|
|
58
|
-
relationCount<Field extends Model[
|
|
59
|
-
options: RelationCountOptions<Types, Shape, NeedsResolve, Model[
|
|
60
|
-
]>): FieldRef<number,
|
|
61
|
-
variant<Variant extends Model[
|
|
87
|
+
]>): FieldRef<Model["Relations"][Field]["Shape"], "Object">;
|
|
88
|
+
relationCount<Field extends Model["RelationName"]>(name: Field, ...allArgs: NormalizeArgs<[
|
|
89
|
+
options: RelationCountOptions<Types, Shape, NeedsResolve, Model["Relations"][Field]["Types"]["Where"]>
|
|
90
|
+
]>): FieldRef<number, "Object">;
|
|
91
|
+
variant<Variant extends Model["Name"] | PrismaObjectRef<Model>, Args extends InputFieldMap, Nullable>(variant: Variant, ...allArgs: NormalizeArgs<[
|
|
62
92
|
options: VariantFieldOptions<Types, Model, Variant extends PrismaObjectRef<Model> ? Variant : PrismaObjectRef<Model>, Args, Nullable, Shape>
|
|
63
|
-
]>): FieldRef<Model[
|
|
64
|
-
expose<Type extends TypeParam<Types>, Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, Model[
|
|
93
|
+
]>): FieldRef<Model["Shape"], "Object">;
|
|
94
|
+
expose<Type extends TypeParam<Types>, Nullable extends boolean, ResolveReturnShape, Name extends CompatibleTypes<Types, Model["Shape"], Type, Nullable>>(...args: NormalizeArgs<[
|
|
65
95
|
name: Name,
|
|
66
|
-
options: Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, Type, Nullable, {}, ResolveReturnShape>,
|
|
96
|
+
options: Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, Type, Nullable, {}, ResolveReturnShape>, "resolve" | "select">
|
|
67
97
|
]>): FieldRef<ShapeFromTypeParam<Types, Type, Nullable>, "PrismaObject">;
|
|
68
98
|
private createExpose;
|
|
69
99
|
}
|
|
70
100
|
export {};
|
|
71
|
-
//# sourceMappingURL=prisma-field-builder.d.ts.map
|
|
101
|
+
//# sourceMappingURL=prisma-field-builder.d.ts.map
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FieldNode, GraphQLResolveInfo } from 'graphql';
|
|
2
2
|
import { FieldKind, FieldMap, FieldNullability, FieldOptionsFromKind, InputFieldMap, InputFieldRef, InputFieldsFromShape, InputShapeFromFields, InterfaceParam, ListResolveValue, MaybePromise, Normalize, ObjectRef, OutputShape, OutputType, SchemaTypes, ShapeFromTypeParam, ShapeWithNullability, typeBrandKey, TypeParam } from '@pothos/core';
|
|
3
|
-
import type { PrismaObjectFieldBuilder } from './field-builder';
|
|
4
|
-
import { PrismaObjectRef } from './object-ref';
|
|
3
|
+
import type { PrismaObjectFieldBuilder } from './field-builder.js';
|
|
4
|
+
import { PrismaObjectRef } from './object-ref.js';
|
|
5
5
|
export interface PrismaDelegate {
|
|
6
6
|
findUniqueOrThrow?: (...args: any[]) => Promise<unknown>;
|
|
7
7
|
findUnique: (...args: any[]) => Promise<unknown>;
|
|
@@ -27,13 +27,13 @@ export interface PrismaModelTypes {
|
|
|
27
27
|
}
|
|
28
28
|
declare type ExtractModel<Types extends SchemaTypes, ParentShape> = ParentShape extends {
|
|
29
29
|
[prismaModelName]?: infer Name;
|
|
30
|
-
} ? Types[
|
|
30
|
+
} ? Types["PrismaTypes"][Name & keyof Types["PrismaTypes"]] extends infer Model ? Model extends PrismaModelTypes ? Model : never : never : never;
|
|
31
31
|
export declare type PrismaObjectFieldOptions<Types extends SchemaTypes, ParentShape, Type extends TypeParam<Types>, Nullable extends FieldNullability<Type>, Args extends InputFieldMap, Select, ResolveReturnShape> = PothosSchemaTypes.ObjectFieldOptions<Types, unknown extends Select ? ParentShape : ParentShape & ShapeFromSelection<ExtractModel<Types, ParentShape>, {
|
|
32
32
|
select: Select extends (...args: any[]) => infer S ? S : Select;
|
|
33
33
|
}>, Type, Nullable, Args, ResolveReturnShape> & {
|
|
34
|
-
select?: Select & (ExtractModel<Types, ParentShape>[
|
|
34
|
+
select?: Select & (ExtractModel<Types, ParentShape>["Select"] | ((args: InputShapeFromFields<Args>, ctx: Types["Context"], nestedSelection: <Selection extends boolean | {}>(selection?: Selection, path?: string[]) => Selection) => ExtractModel<Types, ParentShape>["Select"]));
|
|
35
35
|
};
|
|
36
|
-
declare type PrismaObjectFieldsShape<Types extends SchemaTypes, Model extends PrismaModelTypes, NeedsResolve extends boolean, Shape extends object, Select> = Model[
|
|
36
|
+
declare type PrismaObjectFieldsShape<Types extends SchemaTypes, Model extends PrismaModelTypes, NeedsResolve extends boolean, Shape extends object, Select> = Model["Select"] extends Select ? (t: PrismaObjectFieldBuilder<Types, Model, NeedsResolve, Shape>) => FieldMap : (t: PrismaSelectionFieldBuilder<Types, Model, Shape>) => FieldMap;
|
|
37
37
|
declare type PrismaSelectionFieldBuilder<Types extends SchemaTypes, Model extends PrismaModelTypes, Shape extends object> = PrismaObjectFieldBuilder<Types, Model, false, Shape>;
|
|
38
38
|
interface BaseSelection {
|
|
39
39
|
include?: unknown;
|
|
@@ -42,7 +42,7 @@ interface BaseSelection {
|
|
|
42
42
|
export declare type SelectedKeys<T> = {
|
|
43
43
|
[K in keyof T]: T[K] extends false ? never : K;
|
|
44
44
|
}[keyof T];
|
|
45
|
-
export declare type ShapeFromSelection<Model extends PrismaModelTypes, Selection> = Normalize<Selection extends BaseSelection ? unknown extends Selection[
|
|
45
|
+
export declare type ShapeFromSelection<Model extends PrismaModelTypes, Selection> = Normalize<Selection extends BaseSelection ? unknown extends Selection["select"] ? Model["Shape"] & RelationShapeFromInclude<Model, Selection["include"]> : Pick<Model["Shape"], SelectedKeys<Selection["select"]>> & RelationShapeFromInclude<Model, Selection["select"]> & ("_count" extends keyof Selection["select"] ? ShapeFromCount<Selection["select"]["_count"]> : {}) : Model["Shape"]>;
|
|
46
46
|
export declare type ShapeFromCount<Selection> = Selection extends true ? {
|
|
47
47
|
_count: number;
|
|
48
48
|
} : Selection extends {
|
|
@@ -53,21 +53,21 @@ export declare type ShapeFromCount<Selection> = Selection extends true ? {
|
|
|
53
53
|
};
|
|
54
54
|
} : never;
|
|
55
55
|
declare type RelationShapeFromInclude<Model extends PrismaModelTypes, Include> = Normalize<{
|
|
56
|
-
[K in SelectedKeys<Include> as K extends Model[
|
|
56
|
+
[K in SelectedKeys<Include> as K extends Model["RelationName"] ? K : never]: K extends keyof Model["Relations"] ? Model["Relations"][K]["Shape"] extends unknown[] ? ShapeFromSelection<Model["Relations"][K]["Types"], Include[K]>[] : ShapeFromSelection<Model["Relations"][K]["Types"], Include[K]> : unknown;
|
|
57
57
|
}>;
|
|
58
|
-
export declare type PrismaObjectTypeOptions<Types extends SchemaTypes, Model extends PrismaModelTypes, Interfaces extends InterfaceParam<Types>[], FindUnique, Include, Select, Shape extends object> = NameOrVariant & Omit<PothosSchemaTypes.ObjectTypeOptions<Types, Shape> | PothosSchemaTypes.ObjectTypeWithInterfaceOptions<Types, Shape, Interfaces>,
|
|
58
|
+
export declare type PrismaObjectTypeOptions<Types extends SchemaTypes, Model extends PrismaModelTypes, Interfaces extends InterfaceParam<Types>[], FindUnique, Include, Select, Shape extends object> = NameOrVariant & Omit<PothosSchemaTypes.ObjectTypeOptions<Types, Shape> | PothosSchemaTypes.ObjectTypeWithInterfaceOptions<Types, Shape, Interfaces>, "fields" | "description"> & {
|
|
59
59
|
description?: string | false;
|
|
60
60
|
fields?: PrismaObjectFieldsShape<Types, Model, FindUnique extends null ? true : false, Shape & (FindUnique extends null ? {} : {
|
|
61
|
-
[prismaModelName]?: Model[
|
|
61
|
+
[prismaModelName]?: Model["Name"];
|
|
62
62
|
}), Select>;
|
|
63
63
|
} & ({
|
|
64
|
-
include?: Include & Model[
|
|
64
|
+
include?: Include & Model["Include"];
|
|
65
65
|
select?: never;
|
|
66
|
-
findUnique?: FindUnique & (((parent: Shape, context: Types[
|
|
66
|
+
findUnique?: FindUnique & (((parent: Shape, context: Types["Context"]) => Model["WhereUnique"]) | null);
|
|
67
67
|
} | {
|
|
68
|
-
select: Model[
|
|
68
|
+
select: Model["Select"] & Select;
|
|
69
69
|
include?: never;
|
|
70
|
-
findUnique?: (parent: Shape, context: Types[
|
|
70
|
+
findUnique?: (parent: Shape, context: Types["Context"]) => Model["WhereUnique"];
|
|
71
71
|
});
|
|
72
72
|
declare type NameOrVariant = {
|
|
73
73
|
name?: never;
|
|
@@ -76,111 +76,127 @@ declare type NameOrVariant = {
|
|
|
76
76
|
name?: string;
|
|
77
77
|
variant?: never;
|
|
78
78
|
};
|
|
79
|
-
export declare type PrismaNodeOptions<Types extends SchemaTypes, Model extends PrismaModelTypes, Interfaces extends InterfaceParam<Types>[], Include, Select, Shape extends object, UniqueField> = NameOrVariant & Omit<PothosSchemaTypes.ObjectTypeOptions<Types, Shape> | PothosSchemaTypes.ObjectTypeWithInterfaceOptions<Types, Shape, Interfaces>,
|
|
80
|
-
id: Omit<FieldOptionsFromKind<Types, Shape,
|
|
79
|
+
export declare type PrismaNodeOptions<Types extends SchemaTypes, Model extends PrismaModelTypes, Interfaces extends InterfaceParam<Types>[], Include, Select, Shape extends object, UniqueField> = NameOrVariant & Omit<PothosSchemaTypes.ObjectTypeOptions<Types, Shape> | PothosSchemaTypes.ObjectTypeWithInterfaceOptions<Types, Shape, Interfaces>, "fields" | "isTypeOf"> & {
|
|
80
|
+
id: Omit<FieldOptionsFromKind<Types, Shape, "ID", false, {}, "Object", OutputShape<Types, "ID">, MaybePromise<OutputShape<Types, "ID">>>, "args" | "nullable" | "resolve" | "type"> & ({
|
|
81
81
|
field?: never;
|
|
82
|
-
resolve: (parent: Shape, context: Types[
|
|
82
|
+
resolve: (parent: Shape, context: Types["Context"]) => MaybePromise<OutputShape<Types, "ID">>;
|
|
83
83
|
} | {
|
|
84
84
|
resolve?: never;
|
|
85
|
-
field: UniqueField extends keyof Model[
|
|
85
|
+
field: UniqueField extends keyof Model["WhereUnique"] ? UniqueField : keyof Model["WhereUnique"];
|
|
86
86
|
});
|
|
87
87
|
fields?: PrismaObjectFieldsShape<Types, Model, false, Shape & {
|
|
88
|
-
[prismaModelName]?: Model[
|
|
88
|
+
[prismaModelName]?: Model["Name"];
|
|
89
89
|
}, Select>;
|
|
90
90
|
} & (UniqueField extends string ? {
|
|
91
|
-
findUnique?: (id: string, context: Types[
|
|
91
|
+
findUnique?: (id: string, context: Types["Context"]) => Model["WhereUnique"];
|
|
92
92
|
} : {
|
|
93
|
-
findUnique: (id: string, context: Types[
|
|
93
|
+
findUnique: (id: string, context: Types["Context"]) => Model["WhereUnique"];
|
|
94
94
|
}) & ({
|
|
95
|
-
include?: Include & Model[
|
|
95
|
+
include?: Include & Model["Include"];
|
|
96
96
|
select?: never;
|
|
97
97
|
} | {
|
|
98
|
-
select: Model[
|
|
98
|
+
select: Model["Select"] & Select;
|
|
99
99
|
include?: never;
|
|
100
100
|
});
|
|
101
101
|
declare type QueryForField<Types extends SchemaTypes, Args extends InputFieldMap, Include> = Include extends {
|
|
102
102
|
where?: unknown;
|
|
103
|
-
} ? Omit<Include,
|
|
104
|
-
declare type QueryFromRelation<Model extends PrismaModelTypes, Field extends keyof Model[
|
|
103
|
+
} ? Omit<Include, "include" | "select"> | ((args: InputShapeFromFields<Args>, ctx: Types["Context"]) => Omit<Include, "include" | "select">) : never;
|
|
104
|
+
declare type QueryFromRelation<Model extends PrismaModelTypes, Field extends keyof Model["Include"]> = Model["Include"][Field] extends infer Include ? Include extends {
|
|
105
105
|
include?: infer I;
|
|
106
106
|
select?: infer S;
|
|
107
107
|
} ? {
|
|
108
108
|
include?: NonNullable<I>;
|
|
109
109
|
select?: NonNullable<S>;
|
|
110
110
|
} : never : never;
|
|
111
|
-
declare type CursorFromRelation<Model extends PrismaModelTypes, Field extends Model[
|
|
111
|
+
declare type CursorFromRelation<Model extends PrismaModelTypes, Field extends Model["ListRelations"]> = Field extends keyof Model["Include"] ? Model["Include"][Field] extends infer Include ? Include extends {
|
|
112
112
|
cursor?: infer T;
|
|
113
113
|
} ? keyof T : never : never : never;
|
|
114
|
-
declare type RefForRelation<Model extends PrismaModelTypes, Field extends keyof Model[
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
declare type RefForRelation<Model extends PrismaModelTypes, Field extends keyof Model["Relations"]> = Model["Relations"][Field] extends unknown[] ? [
|
|
115
|
+
ObjectRef<Model["Relations"][Field]>
|
|
116
|
+
] : ObjectRef<Model["Relations"][Field]>;
|
|
117
|
+
export declare type RelatedFieldOptions<Types extends SchemaTypes, Model extends PrismaModelTypes, Field extends keyof Model["Relations"], Nullable extends boolean, Args extends InputFieldMap, ResolveReturnShape, NeedsResolve extends boolean, Shape> = Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, RefForRelation<Model, Field>, Nullable, Args, ResolveReturnShape>, "resolve" | "type" | "description"> & (NeedsResolve extends false ? {
|
|
118
|
+
resolve?: (query: QueryFromRelation<Model, Field & keyof Model["Include"]>, parent: Shape, args: InputShapeFromFields<Args>, context: Types["Context"], info: GraphQLResolveInfo) => MaybePromise<ShapeWithNullability<Types, Model["Relations"][Field]["Shape"], Nullable>>;
|
|
117
119
|
} : {
|
|
118
|
-
resolve: (query: QueryFromRelation<Model, Field & keyof Model[
|
|
120
|
+
resolve: (query: QueryFromRelation<Model, Field & keyof Model["Include"]>, parent: Shape, args: InputShapeFromFields<Args>, context: Types["Context"], info: GraphQLResolveInfo) => MaybePromise<ShapeWithNullability<Types, Model["Relations"][Field]["Shape"], Nullable>>;
|
|
119
121
|
}) & {
|
|
120
122
|
description?: string | false;
|
|
121
|
-
type?: PrismaObjectRef<Model[
|
|
122
|
-
query?: QueryForField<Types, Args, Model[
|
|
123
|
+
type?: PrismaObjectRef<Model["Relations"][Field]["Types"]>;
|
|
124
|
+
query?: QueryForField<Types, Args, Model["Include"][Field & keyof Model["Include"]]>;
|
|
123
125
|
};
|
|
124
|
-
export declare type VariantFieldOptions<Types extends SchemaTypes, Model extends PrismaModelTypes, Variant extends PrismaObjectRef<Model>, Args extends InputFieldMap, isNull, Shape> = Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, Variant, unknown extends isNull ? false : true, Args, Model[
|
|
125
|
-
isNull?: isNull & ((parent: Shape, args: InputShapeFromFields<Args>, context: Types[
|
|
126
|
+
export declare type VariantFieldOptions<Types extends SchemaTypes, Model extends PrismaModelTypes, Variant extends PrismaObjectRef<Model>, Args extends InputFieldMap, isNull, Shape> = Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, Variant, unknown extends isNull ? false : true, Args, Model["Shape"]>, "resolve" | "type"> & {
|
|
127
|
+
isNull?: isNull & ((parent: Shape, args: InputShapeFromFields<Args>, context: Types["Context"], info: GraphQLResolveInfo) => MaybePromise<boolean>);
|
|
126
128
|
};
|
|
127
|
-
export declare type RelationCountOptions<Types extends SchemaTypes, Shape, NeedsResolve extends boolean, Where> = Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape,
|
|
128
|
-
where?: Where | ((args: {}, context: Types[
|
|
129
|
-
resolve?: (parent: Shape, args: {}, context: Types[
|
|
129
|
+
export declare type RelationCountOptions<Types extends SchemaTypes, Shape, NeedsResolve extends boolean, Where> = Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Shape, "Int", false, {}, number>, "resolve" | "type"> & (NeedsResolve extends false ? {
|
|
130
|
+
where?: Where | ((args: {}, context: Types["Context"]) => Where);
|
|
131
|
+
resolve?: (parent: Shape, args: {}, context: Types["Context"], info: GraphQLResolveInfo) => MaybePromise<number>;
|
|
130
132
|
} : {
|
|
131
|
-
where?: Where | ((args: {}, context: Types[
|
|
132
|
-
resolve: (parent: Shape, args: {}, context: Types[
|
|
133
|
+
where?: Where | ((args: {}, context: Types["Context"]) => Where);
|
|
134
|
+
resolve: (parent: Shape, args: {}, context: Types["Context"], info: GraphQLResolveInfo) => MaybePromise<number>;
|
|
133
135
|
});
|
|
134
|
-
export declare type PrismaFieldOptions<Types extends SchemaTypes, ParentShape, Type extends PrismaObjectRef<PrismaModelTypes> | keyof Types[
|
|
136
|
+
export declare type PrismaFieldOptions<Types extends SchemaTypes, ParentShape, Type extends PrismaObjectRef<PrismaModelTypes> | keyof Types["PrismaTypes"] | [
|
|
137
|
+
keyof Types["PrismaTypes"]
|
|
138
|
+
] | [
|
|
139
|
+
PrismaObjectRef<PrismaModelTypes>
|
|
140
|
+
], Model extends PrismaModelTypes, Param extends TypeParam<Types>, Args extends InputFieldMap, Nullable extends FieldNullability<Param>, ResolveShape, ResolveReturnShape, Kind extends FieldKind = FieldKind> = FieldOptionsFromKind<Types, ParentShape, Param, Nullable, Args, Kind, ResolveShape, ResolveReturnShape> extends infer FieldOptions ? Omit<FieldOptions, "resolve" | "type"> & {
|
|
135
141
|
type: Type;
|
|
136
142
|
resolve: FieldOptions extends {
|
|
137
143
|
resolve?: (parent: infer Parent, ...args: any[]) => unknown;
|
|
138
144
|
} ? PrismaFieldResolver<Types, Model, Parent, Param, Args, Nullable, ResolveReturnShape> : PrismaFieldResolver<Types, Model, ParentShape, Param, Args, Nullable, ResolveReturnShape>;
|
|
139
145
|
} : never;
|
|
140
|
-
export declare type PrismaFieldWithInputOptions<Types extends SchemaTypes, ParentShape, Kind extends FieldKind, Args extends Record<string, InputFieldRef<unknown,
|
|
146
|
+
export declare type PrismaFieldWithInputOptions<Types extends SchemaTypes, ParentShape, Kind extends FieldKind, Args extends Record<string, InputFieldRef<unknown, "Arg">>, Fields extends Record<string, InputFieldRef<unknown, "InputObject">>, Type extends PrismaObjectRef<PrismaModelTypes> | keyof Types["PrismaTypes"] | [
|
|
147
|
+
keyof Types["PrismaTypes"]
|
|
148
|
+
] | [
|
|
149
|
+
PrismaObjectRef<PrismaModelTypes>
|
|
150
|
+
], Model extends PrismaModelTypes, Param extends TypeParam<Types>, Nullable extends FieldNullability<Param>, InputName extends string, ResolveShape, ResolveReturnShape, ArgRequired extends boolean> = Omit<PrismaFieldOptions<Types, ParentShape, Type, Model, Param, {
|
|
141
151
|
[K in InputName]: InputFieldRef<InputShapeFromFields<Fields> | (true extends ArgRequired ? never : null | undefined)>;
|
|
142
|
-
} & Args, Nullable, ResolveShape, ResolveReturnShape, Kind>,
|
|
152
|
+
} & Args, Nullable, ResolveShape, ResolveReturnShape, Kind>, "args"> & PothosSchemaTypes.FieldWithInputBaseOptions<Types, {
|
|
143
153
|
[K in InputName]: InputFieldRef<InputShapeFromFields<Fields> | (true extends ArgRequired ? never : null | undefined)>;
|
|
144
154
|
} & Args, Fields, InputName, ArgRequired>;
|
|
145
155
|
export declare type PrismaFieldResolver<Types extends SchemaTypes, Model extends PrismaModelTypes, Parent, Param extends TypeParam<Types>, Args extends InputFieldMap, Nullable extends FieldNullability<Param>, ResolveReturnShape> = (query: {
|
|
146
|
-
include?: Model[
|
|
147
|
-
select?: Model[
|
|
148
|
-
}, parent: Parent, args: InputShapeFromFields<Args>, context: Types[
|
|
149
|
-
|
|
156
|
+
include?: Model["Include"];
|
|
157
|
+
select?: Model["Select"];
|
|
158
|
+
}, parent: Parent, args: InputShapeFromFields<Args>, context: Types["Context"], info: GraphQLResolveInfo) => ShapeFromTypeParam<Types, Param, Nullable> extends infer Shape ? [
|
|
159
|
+
Shape
|
|
160
|
+
] extends [
|
|
161
|
+
[
|
|
162
|
+
readonly (infer Item)[] | null | undefined
|
|
163
|
+
]
|
|
164
|
+
] ? ListResolveValue<Shape, Item, ResolveReturnShape> : MaybePromise<Shape> : never;
|
|
165
|
+
export declare type PrismaConnectionFieldOptions<Types extends SchemaTypes, ParentShape, Type extends PrismaObjectRef<PrismaModelTypes> | keyof Types["PrismaTypes"], Model extends PrismaModelTypes, Param extends OutputType<Types>, Nullable extends boolean, Args extends InputFieldMap, ResolveReturnShape, Kind extends FieldKind> = Omit<PothosSchemaTypes.ConnectionFieldOptions<Types, ParentShape, Param, Nullable, false, false, Args, ResolveReturnShape>, "resolve" | "type"> & Omit<FieldOptionsFromKind<Types, ParentShape, Param, Nullable, (InputFieldMap extends Args ? {} : Args) & InputFieldsFromShape<PothosSchemaTypes.DefaultConnectionArguments>, Kind, ParentShape, ResolveReturnShape>, "args" | "resolve" | "type"> & (InputShapeFromFields<Args> & PothosSchemaTypes.DefaultConnectionArguments extends infer ConnectionArgs ? {
|
|
150
166
|
type: Type;
|
|
151
|
-
cursor: string & keyof Model[
|
|
152
|
-
defaultSize?: number | ((args: ConnectionArgs, ctx: Types[
|
|
153
|
-
maxSize?: number | ((args: ConnectionArgs, ctx: Types[
|
|
167
|
+
cursor: string & keyof Model["WhereUnique"];
|
|
168
|
+
defaultSize?: number | ((args: ConnectionArgs, ctx: Types["Context"]) => number);
|
|
169
|
+
maxSize?: number | ((args: ConnectionArgs, ctx: Types["Context"]) => number);
|
|
154
170
|
resolve: (query: {
|
|
155
|
-
include?: Model[
|
|
156
|
-
cursor?: Model[
|
|
171
|
+
include?: Model["Include"];
|
|
172
|
+
cursor?: Model["WhereUnique"];
|
|
157
173
|
take: number;
|
|
158
174
|
skip: number;
|
|
159
|
-
}, parent: ParentShape, args: ConnectionArgs, context: Types[
|
|
160
|
-
totalCount?: (parent: ParentShape, args: ConnectionArgs, context: Types[
|
|
175
|
+
}, parent: ParentShape, args: ConnectionArgs, context: Types["Context"], info: GraphQLResolveInfo) => MaybePromise<Model["Shape"][]>;
|
|
176
|
+
totalCount?: (parent: ParentShape, args: ConnectionArgs, context: Types["Context"], info: GraphQLResolveInfo) => MaybePromise<number>;
|
|
161
177
|
} : never);
|
|
162
|
-
export declare type RelatedConnectionOptions<Types extends SchemaTypes, Model extends PrismaModelTypes, Field extends Model[
|
|
178
|
+
export declare type RelatedConnectionOptions<Types extends SchemaTypes, Model extends PrismaModelTypes, Field extends Model["ListRelations"], Nullable extends boolean, Args extends InputFieldMap, NeedsResolve extends boolean> = Omit<PothosSchemaTypes.ObjectFieldOptions<Types, Model["Shape"], ObjectRef<unknown>, Nullable, (InputFieldMap extends Args ? {} : Args) & InputFieldsFromShape<PothosSchemaTypes.DefaultConnectionArguments>, unknown>, "resolve" | "type" | "args" | "description"> & Omit<PothosSchemaTypes.ConnectionFieldOptions<Types, Model["Shape"], ObjectRef<unknown>, false, false, Nullable, Args, unknown>, "resolve" | "type"> & (InputShapeFromFields<Args> & PothosSchemaTypes.DefaultConnectionArguments extends infer ConnectionArgs ? {
|
|
163
179
|
description?: string | false;
|
|
164
|
-
query?: QueryForField<Types, Args, Model[
|
|
165
|
-
type?: PrismaObjectRef<Model[
|
|
180
|
+
query?: QueryForField<Types, Args, Model["Include"][Field & keyof Model["Include"]]>;
|
|
181
|
+
type?: PrismaObjectRef<Model["Relations"][Field]["Types"]>;
|
|
166
182
|
cursor: CursorFromRelation<Model, Field>;
|
|
167
|
-
defaultSize?: number | ((args: ConnectionArgs, ctx: Types[
|
|
168
|
-
maxSize?: number | ((args: ConnectionArgs, ctx: Types[
|
|
183
|
+
defaultSize?: number | ((args: ConnectionArgs, ctx: Types["Context"]) => number);
|
|
184
|
+
maxSize?: number | ((args: ConnectionArgs, ctx: Types["Context"]) => number);
|
|
169
185
|
totalCount?: NeedsResolve extends false ? boolean : false;
|
|
170
186
|
} & (NeedsResolve extends false ? {
|
|
171
187
|
resolve?: (query: {
|
|
172
|
-
include?: Model[
|
|
173
|
-
cursor?: Model[
|
|
188
|
+
include?: Model["Include"];
|
|
189
|
+
cursor?: Model["WhereUnique"];
|
|
174
190
|
take: number;
|
|
175
191
|
skip: number;
|
|
176
|
-
}, parent: Model[
|
|
192
|
+
}, parent: Model["Shape"], args: ConnectionArgs, context: Types["Context"], info: GraphQLResolveInfo) => MaybePromise<Model["Relations"][Field & keyof Model["Relations"]]["Shape"]>;
|
|
177
193
|
} : {
|
|
178
194
|
resolve: (query: {
|
|
179
|
-
include?: Model[
|
|
180
|
-
cursor?: Model[
|
|
195
|
+
include?: Model["Include"];
|
|
196
|
+
cursor?: Model["WhereUnique"];
|
|
181
197
|
take: number;
|
|
182
198
|
skip: number;
|
|
183
|
-
}, parent: Model[
|
|
199
|
+
}, parent: Model["Shape"], args: ConnectionArgs, context: Types["Context"], info: GraphQLResolveInfo) => MaybePromise<Model["Relations"][Field & keyof Model["Relations"]]["Shape"]>;
|
|
184
200
|
}) : never);
|
|
185
201
|
export declare type WithBrand<T> = T & {
|
|
186
202
|
[typeBrandKey]: string;
|
|
@@ -207,6 +223,6 @@ export interface IndirectInclude {
|
|
|
207
223
|
}
|
|
208
224
|
export declare type ShapeFromConnection<T> = T extends {
|
|
209
225
|
shape: unknown;
|
|
210
|
-
} ? T[
|
|
226
|
+
} ? T["shape"] : never;
|
|
211
227
|
export {};
|
|
212
|
-
//# sourceMappingURL=types.d.ts.map
|
|
228
|
+
//# sourceMappingURL=types.d.ts.map
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ObjectRef, SchemaTypes } from '@pothos/core';
|
|
2
|
-
import { PrismaObjectRef } from '../object-ref';
|
|
3
|
-
import { PrismaClient, PrismaDelegate, PrismaModelTypes } from '../types';
|
|
2
|
+
import { PrismaObjectRef } from '../object-ref.js';
|
|
3
|
+
import { PrismaClient, PrismaDelegate, PrismaModelTypes } from '../types.js';
|
|
4
4
|
export declare const refMap: WeakMap<object, Map<string, PrismaObjectRef<PrismaModelTypes, {}>>>;
|
|
5
5
|
export declare const findUniqueMap: WeakMap<object, Map<ObjectRef<unknown, unknown>, ((args: unknown, ctx: {}) => unknown) | null>>;
|
|
6
6
|
export declare const includeForRefMap: WeakMap<object, Map<ObjectRef<unknown, unknown>, Record<string, unknown> | null>>;
|
|
@@ -21,4 +21,4 @@ export declare function getModel<Types extends SchemaTypes>(name: string, builde
|
|
|
21
21
|
documentation?: string | undefined;
|
|
22
22
|
};
|
|
23
23
|
export declare function getDelegateFromModel(client: PrismaClient, model: string): PrismaDelegate;
|
|
24
|
-
//# sourceMappingURL=datamodel.d.ts.map
|
|
24
|
+
//# sourceMappingURL=datamodel.d.ts.map
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function deepEqual(left: unknown, right: unknown, ignore?: Set<string>): boolean;
|
|
2
|
-
//# sourceMappingURL=deep-equal.d.ts.map
|
|
2
|
+
//# sourceMappingURL=deep-equal.d.ts.map
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SchemaTypes } from '@pothos/core';
|
|
2
2
|
export declare function getFieldDescription<Types extends SchemaTypes>(model: string, builder: PothosSchemaTypes.SchemaBuilder<Types>, fieldName: string, description?: string | false): string | undefined;
|
|
3
3
|
export declare function getModelDescription<Types extends SchemaTypes>(model: string, builder: PothosSchemaTypes.SchemaBuilder<Types>, description?: string | false): string | undefined;
|
|
4
|
-
//# sourceMappingURL=description.d.ts.map
|
|
4
|
+
//# sourceMappingURL=description.d.ts.map
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchemaTypes } from '@pothos/core';
|
|
2
|
-
import { PrismaClient } from '../types';
|
|
2
|
+
import { PrismaClient } from '../types.js';
|
|
3
3
|
export interface DMMFField {
|
|
4
4
|
type: string;
|
|
5
5
|
kind: string;
|
|
@@ -27,7 +27,7 @@ interface DMMF {
|
|
|
27
27
|
}[];
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
export declare function getClient<Types extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<Types>, context: Types[
|
|
30
|
+
export declare function getClient<Types extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<Types>, context: Types["Context"]): PrismaClient;
|
|
31
31
|
export declare function getDMMF<Types extends SchemaTypes>(builder: PothosSchemaTypes.SchemaBuilder<Types>): DMMF;
|
|
32
32
|
export {};
|
|
33
|
-
//# sourceMappingURL=get-client.d.ts.map
|
|
33
|
+
//# sourceMappingURL=get-client.d.ts.map
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphQLResolveInfo } from 'graphql';
|
|
2
|
-
import { LoaderMappings } from '../types';
|
|
3
|
-
export declare function cacheKey(type: string, path: GraphQLResolveInfo[
|
|
2
|
+
import { LoaderMappings } from '../types.js';
|
|
3
|
+
export declare function cacheKey(type: string, path: GraphQLResolveInfo["path"], subPath: string[]): string;
|
|
4
4
|
export declare function setLoaderMappings(ctx: object, info: GraphQLResolveInfo, value: LoaderMappings): void;
|
|
5
|
-
export declare function getLoaderMapping(ctx: object, path: GraphQLResolveInfo[
|
|
6
|
-
//# sourceMappingURL=loader-map.d.ts.map
|
|
5
|
+
export declare function getLoaderMapping(ctx: object, path: GraphQLResolveInfo["path"], type: string): LoaderMappings | null;
|
|
6
|
+
//# sourceMappingURL=loader-map.d.ts.map
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GraphQLNamedType, GraphQLResolveInfo } from 'graphql';
|
|
2
|
-
import { SelectionMap } from '../types';
|
|
3
|
-
import { SelectionState } from './selections';
|
|
4
|
-
export declare function queryFromInfo<T extends SelectionMap[
|
|
2
|
+
import { SelectionMap } from '../types.js';
|
|
3
|
+
import { SelectionState } from './selections.js';
|
|
4
|
+
export declare function queryFromInfo<T extends SelectionMap["select"] | undefined = undefined>({ context, info, typeName, select, path, }: {
|
|
5
5
|
context: object;
|
|
6
6
|
info: GraphQLResolveInfo;
|
|
7
7
|
typeName?: string;
|
|
@@ -14,4 +14,4 @@ export declare function queryFromInfo<T extends SelectionMap['select'] | undefin
|
|
|
14
14
|
};
|
|
15
15
|
export declare function selectionStateFromInfo(context: object, info: GraphQLResolveInfo, typeName?: string): SelectionState;
|
|
16
16
|
export declare function getIndirectType(type: GraphQLNamedType, info: GraphQLResolveInfo): GraphQLNamedType;
|
|
17
|
-
//# sourceMappingURL=map-query.d.ts.map
|
|
17
|
+
//# sourceMappingURL=map-query.d.ts.map
|
|
File without changes
|
|
@@ -6,6 +6,7 @@ export interface FieldMap {
|
|
|
6
6
|
export declare type RelationMap = Map<string, FieldMap>;
|
|
7
7
|
export declare const getRelationMap: import("@pothos/core").ContextCache<RelationMap, {
|
|
8
8
|
datamodel: unknown;
|
|
9
|
-
}, [
|
|
9
|
+
}, [
|
|
10
|
+
]>;
|
|
10
11
|
export declare function createRelationMap({ models }: DMMF.Datamodel): RelationMap;
|
|
11
|
-
//# sourceMappingURL=relation-map.d.ts.map
|
|
12
|
+
//# sourceMappingURL=relation-map.d.ts.map
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LoaderMappings, SelectionMap } from '../types';
|
|
2
|
-
import { FieldMap } from './relation-map';
|
|
3
|
-
export declare type SelectionMode =
|
|
1
|
+
import { LoaderMappings, SelectionMap } from '../types.js';
|
|
2
|
+
import { FieldMap } from './relation-map.js';
|
|
3
|
+
export declare type SelectionMode = "select" | "include";
|
|
4
4
|
export interface SelectionState {
|
|
5
5
|
fieldMap: FieldMap;
|
|
6
6
|
query: object;
|
|
@@ -17,4 +17,4 @@ export declare function mergeState(state: SelectionState, newState: SelectionSta
|
|
|
17
17
|
export declare function createState(fieldMap: FieldMap, mode: SelectionMode, parent?: SelectionState): SelectionState;
|
|
18
18
|
export declare function mergeSelection(state: SelectionState, { select, include, ...query }: SelectionMap): void;
|
|
19
19
|
export declare function selectionToQuery(state: SelectionState): SelectionMap;
|
|
20
|
-
//# sourceMappingURL=selections.d.ts.map
|
|
20
|
+
//# sourceMappingURL=selections.d.ts.map
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pothos/plugin-prisma",
|
|
3
|
-
"version": "3.35.
|
|
3
|
+
"version": "3.35.3",
|
|
4
4
|
"description": "A Pothos plugin for more efficient integration with prisma",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./dts/index.d.ts",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"typescript": ">=4.7.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@pothos/core": "3.22.
|
|
56
|
-
"@pothos/plugin-complexity": "3.11.
|
|
57
|
-
"@pothos/plugin-errors": "3.8.
|
|
58
|
-
"@pothos/plugin-relay": "3.28.
|
|
59
|
-
"@pothos/plugin-simple-objects": "3.6.
|
|
60
|
-
"@pothos/test-utils": "1.4.
|
|
55
|
+
"@pothos/core": "3.22.4",
|
|
56
|
+
"@pothos/plugin-complexity": "3.11.3",
|
|
57
|
+
"@pothos/plugin-errors": "3.8.3",
|
|
58
|
+
"@pothos/plugin-relay": "3.28.3",
|
|
59
|
+
"@pothos/plugin-simple-objects": "3.6.3",
|
|
60
|
+
"@pothos/test-utils": "1.4.2",
|
|
61
61
|
"@prisma/client": "^4.4.0",
|
|
62
62
|
"graphql": "16.6.0",
|
|
63
63
|
"graphql-tag": "^2.12.6",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"build": "pnpm build:clean && pnpm build:cjs && pnpm build:dts && pnpm build:esm",
|
|
70
70
|
"build:clean": "git clean -dfX esm lib",
|
|
71
71
|
"build:cjs": "swc src -d lib --config-file ../../.swcrc -C module.type=commonjs",
|
|
72
|
-
"build:esm": "cp -r dts
|
|
72
|
+
"build:esm": "cp -r dts/* esm/ && swc src -d esm --config-file ../../.swcrc -C module.type=es6 && pnpm esm:extensions",
|
|
73
73
|
"build:dts": "tsc",
|
|
74
74
|
"esm:extensions": "TS_NODE_PROJECT=../../tsconfig.json node -r @swc-node/register ../../scripts/esm-transformer.ts",
|
|
75
|
-
"test": "pnpm vitest --run"
|
|
75
|
+
"test": "pnpm vitest --run --segfault-retry=3"
|
|
76
76
|
}
|
|
77
77
|
}
|
package/esm/dts/generator.d.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { FieldKind, FieldNullability, FieldRef, InputFieldMap, InputFieldRef, InterfaceParam, NormalizeArgs, OutputType, PluginName, SchemaTypes, ShapeFromTypeParam, TypeParam } from '@pothos/core';
|
|
2
|
-
import PrismaNodeRef from './node-ref';
|
|
3
|
-
import { prismaModelKey, PrismaObjectRef } from './object-ref';
|
|
4
|
-
import { PrismaObjectFieldBuilder as InternalPrismaObjectFieldBuilder } from './prisma-field-builder';
|
|
5
|
-
import { PrismaClient, PrismaConnectionFieldOptions, PrismaFieldOptions, PrismaFieldWithInputOptions, PrismaModelTypes, PrismaNodeOptions, PrismaObjectFieldOptions, PrismaObjectTypeOptions, ShapeFromConnection, ShapeFromSelection } from './types';
|
|
6
|
-
import type { PrismaPlugin } from '.';
|
|
7
|
-
declare global {
|
|
8
|
-
export namespace PothosSchemaTypes {
|
|
9
|
-
interface Plugins<Types extends SchemaTypes> {
|
|
10
|
-
prisma: PrismaPlugin<Types>;
|
|
11
|
-
}
|
|
12
|
-
interface SchemaBuilderOptions<Types extends SchemaTypes> {
|
|
13
|
-
prisma: {
|
|
14
|
-
filterConnectionTotalCount?: boolean;
|
|
15
|
-
client: PrismaClient;
|
|
16
|
-
exposeDescriptions?: boolean | {
|
|
17
|
-
models?: boolean;
|
|
18
|
-
fields?: boolean;
|
|
19
|
-
};
|
|
20
|
-
} | {
|
|
21
|
-
filterConnectionTotalCount?: boolean;
|
|
22
|
-
client: (ctx: Types['Context']) => PrismaClient;
|
|
23
|
-
dmmf: {
|
|
24
|
-
datamodel: unknown;
|
|
25
|
-
};
|
|
26
|
-
exposeDescriptions?: boolean | {
|
|
27
|
-
models?: boolean;
|
|
28
|
-
fields?: boolean;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
interface UserSchemaTypes {
|
|
33
|
-
PrismaTypes: {};
|
|
34
|
-
}
|
|
35
|
-
interface ExtendDefaultTypes<PartialTypes extends Partial<UserSchemaTypes>> {
|
|
36
|
-
PrismaTypes: PartialTypes['PrismaTypes'] & {};
|
|
37
|
-
}
|
|
38
|
-
interface PothosKindToGraphQLType {
|
|
39
|
-
PrismaObject: 'Object';
|
|
40
|
-
}
|
|
41
|
-
interface FieldOptionsByKind<Types extends SchemaTypes, ParentShape, Type extends TypeParam<Types>, Nullable extends FieldNullability<Type>, Args extends InputFieldMap, ResolveShape, ResolveReturnShape> {
|
|
42
|
-
PrismaObject: PrismaObjectFieldOptions<Types, ParentShape, Type, Nullable, Args, ResolveShape, ResolveReturnShape>;
|
|
43
|
-
}
|
|
44
|
-
interface SchemaBuilder<Types extends SchemaTypes> {
|
|
45
|
-
prismaObject: <Name extends keyof Types['PrismaTypes'], Interfaces extends InterfaceParam<Types>[], FindUnique, Model extends PrismaModelTypes & Types['PrismaTypes'][Name], Include = unknown, Select = unknown>(name: Name, options: PrismaObjectTypeOptions<Types, Model, Interfaces, FindUnique, Include, Select, ShapeFromSelection<Model, {
|
|
46
|
-
select: Select;
|
|
47
|
-
include: Include;
|
|
48
|
-
}>>) => PrismaObjectRef<Model, ShapeFromSelection<Model, {
|
|
49
|
-
select: Select;
|
|
50
|
-
include: Include;
|
|
51
|
-
}>>;
|
|
52
|
-
prismaNode: 'relay' extends PluginName ? <Name extends keyof Types['PrismaTypes'], Interfaces extends InterfaceParam<Types>[] = [], Include = unknown, Select = unknown, UniqueField = unknown>(name: Name, options: PrismaNodeOptions<Types, Types['PrismaTypes'][Name] & PrismaModelTypes, Interfaces, Include, Select, ShapeFromSelection<PrismaModelTypes & Types['PrismaTypes'][Name], {
|
|
53
|
-
select: Select;
|
|
54
|
-
include: Include;
|
|
55
|
-
}>, UniqueField>) => PrismaNodeRef<Types['PrismaTypes'][Name] & PrismaModelTypes, ShapeFromSelection<PrismaModelTypes & Types['PrismaTypes'][Name], {
|
|
56
|
-
select: Select;
|
|
57
|
-
include: Include;
|
|
58
|
-
}>> : '@pothos/plugin-relay is required to use this method';
|
|
59
|
-
}
|
|
60
|
-
interface RootFieldBuilder<Types extends SchemaTypes, ParentShape, Kind extends FieldKind = FieldKind> {
|
|
61
|
-
prismaField: <Args extends InputFieldMap, TypeParam extends PrismaObjectRef<PrismaModelTypes> | keyof Types['PrismaTypes'] | [keyof Types['PrismaTypes']] | [PrismaObjectRef<PrismaModelTypes>], Nullable extends FieldNullability<Type>, ResolveShape, ResolveReturnShape, Type extends TypeParam extends [unknown] ? [ObjectRef<Model['Shape']>] : ObjectRef<Model['Shape']>, Model extends PrismaModelTypes = PrismaModelTypes & (TypeParam extends [keyof Types['PrismaTypes']] ? Types['PrismaTypes'][TypeParam[0]] : TypeParam extends [PrismaObjectRef<PrismaModelTypes>] ? TypeParam[0][typeof prismaModelKey] : TypeParam extends PrismaObjectRef<PrismaModelTypes> ? TypeParam[typeof prismaModelKey] : TypeParam extends keyof Types['PrismaTypes'] ? Types['PrismaTypes'][TypeParam] : never)>(options: PrismaFieldOptions<Types, ParentShape, TypeParam, Model, Type, Args, Nullable, ResolveShape, ResolveReturnShape, Kind>) => FieldRef<ShapeFromTypeParam<Types, Type, Nullable>>;
|
|
62
|
-
prismaConnection: 'relay' extends PluginName ? <Type extends PrismaObjectRef<PrismaModelTypes> | keyof Types['PrismaTypes'], Nullable extends boolean, ResolveReturnShape, Args extends InputFieldMap = {}, Model extends PrismaModelTypes = Type extends PrismaObjectRef<infer T> ? T : PrismaModelTypes & Types['PrismaTypes'][Type & keyof Types['PrismaTypes']]>(options: PrismaConnectionFieldOptions<Types, ParentShape, Type, Model, ObjectRef<Model['Shape']>, Nullable, Args, ResolveReturnShape, Kind>, ...args: NormalizeArgs<[
|
|
63
|
-
connectionOptions: ConnectionObjectOptions<Types, ObjectRef<Model['Shape']>, false, false, ResolveReturnShape>,
|
|
64
|
-
edgeOptions: ConnectionEdgeObjectOptions<Types, ObjectRef<Model['Shape']>, false, ResolveReturnShape>
|
|
65
|
-
], 0>) => FieldRef<ShapeFromConnection<ConnectionShapeHelper<Types, Model['Shape'], Nullable>>> : '@pothos/plugin-relay is required to use this method';
|
|
66
|
-
prismaFieldWithInput: 'prisma' extends PluginName ? <Fields extends Record<string, InputFieldRef<unknown, 'InputObject'>>, TypeParam extends PrismaObjectRef<PrismaModelTypes> | keyof Types['PrismaTypes'] | [keyof Types['PrismaTypes']] | [PrismaObjectRef<PrismaModelTypes>], Type extends TypeParam extends [unknown] ? [ObjectRef<Model['Shape']>] : ObjectRef<Model['Shape']>, ResolveShape, ResolveReturnShape, ArgRequired extends boolean, Args extends Record<string, InputFieldRef<unknown, 'Arg'>> = {}, Nullable extends FieldNullability<Type> = Types['DefaultFieldNullability'], InputName extends string = 'input', Model extends PrismaModelTypes = PrismaModelTypes & (TypeParam extends [keyof Types['PrismaTypes']] ? Types['PrismaTypes'][TypeParam[0]] : TypeParam extends [PrismaObjectRef<PrismaModelTypes>] ? TypeParam[0][typeof prismaModelKey] : TypeParam extends PrismaObjectRef<PrismaModelTypes> ? TypeParam[typeof prismaModelKey] : TypeParam extends keyof Types['PrismaTypes'] ? Types['PrismaTypes'][TypeParam] : never)>(options: PrismaFieldWithInputOptions<Types, ParentShape, Kind, Args, Fields, TypeParam, Model, Type, Nullable, InputName, ResolveShape, ResolveReturnShape, boolean extends ArgRequired ? (Types & {
|
|
67
|
-
WithInputArgRequired: boolean;
|
|
68
|
-
})['WithInputArgRequired'] : ArgRequired>) => FieldRef<ShapeFromTypeParam<Types, Type, Nullable>> : '@pothos/plugin-prisma is required to use this method';
|
|
69
|
-
}
|
|
70
|
-
interface ConnectionFieldOptions<Types extends SchemaTypes, ParentShape, Type extends OutputType<Types>, Nullable extends boolean, EdgeNullability extends FieldNullability<[unknown]>, NodeNullability extends boolean, Args extends InputFieldMap, ResolveReturnShape> {
|
|
71
|
-
}
|
|
72
|
-
interface ConnectionObjectOptions<Types extends SchemaTypes, Type extends OutputType<Types>, EdgeNullability extends FieldNullability<[unknown]>, NodeNullability extends boolean, Resolved> {
|
|
73
|
-
}
|
|
74
|
-
interface ConnectionEdgeObjectOptions<Types extends SchemaTypes, Type extends OutputType<Types>, NodeNullability extends boolean, Resolved> {
|
|
75
|
-
}
|
|
76
|
-
interface DefaultConnectionArguments {
|
|
77
|
-
first?: number | null | undefined;
|
|
78
|
-
last?: number | null | undefined;
|
|
79
|
-
before?: string | null | undefined;
|
|
80
|
-
after?: string | null | undefined;
|
|
81
|
-
}
|
|
82
|
-
interface ConnectionShapeHelper<Types extends SchemaTypes, T, Nullable> {
|
|
83
|
-
}
|
|
84
|
-
interface ScopeAuthFieldAuthScopes<Types extends SchemaTypes, Parent, Args extends {} = {}> {
|
|
85
|
-
}
|
|
86
|
-
interface ScopeAuthContextForAuth<Types extends SchemaTypes, Scopes extends {}> {
|
|
87
|
-
}
|
|
88
|
-
interface PrismaObjectFieldBuilder<Types extends SchemaTypes, Model extends PrismaModelTypes, NeedsResolve extends boolean, Shape extends object = Model['Shape']> extends InternalPrismaObjectFieldBuilder<Types, Model, NeedsResolve, Shape>, RootFieldBuilder<Types, Shape, 'PrismaObject'> {
|
|
89
|
-
}
|
|
90
|
-
interface FieldWithInputBaseOptions<Types extends SchemaTypes, Args extends Record<string, InputFieldRef<unknown, 'Arg'>>, Fields extends Record<string, InputFieldRef<unknown, 'InputObject'>>, InputName extends string, ArgRequired extends boolean> {
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=global-types.d.ts.map
|
package/esm/dts/node-ref.d.ts
DELETED