@pothos/core
Advanced tools
Comparing version 3.28.0 to 3.29.0
# Change Log | ||
## 3.29.0 | ||
### Minor Changes | ||
- f9b0e2eb: Add onPrepare hook to buildCache | ||
## 3.28.0 | ||
@@ -4,0 +10,0 @@ |
@@ -25,3 +25,3 @@ import { GraphQLScalarSerializer, GraphQLScalarType, GraphQLSchema } from 'graphql'; | ||
fields?: QueryFieldsShape<Types> | ||
], 0>): ObjectRef<"Query" extends infer T ? T extends "Query" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends BaseEnum ? ValuesFromEnum<T> : never : never : never, "Query" extends infer T_1 ? T_1 extends "Query" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends BaseEnum ? ValuesFromEnum<T_1> : never : never : never>; | ||
], 0>): ObjectRef<OutputShape<Types, "Query">, "Query" extends infer T ? T extends "Query" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends BaseEnum ? ValuesFromEnum<T> : never : never : never>; | ||
queryFields(fields: QueryFieldsShape<Types>): void; | ||
@@ -28,0 +28,0 @@ queryField(name: string, field: QueryFieldThunk<Types>): void; |
@@ -8,3 +8,3 @@ import FieldRef from './refs/field'; | ||
private fields; | ||
private addFieldFns; | ||
private pendingActions; | ||
private refsToName; | ||
@@ -14,4 +14,2 @@ private scalarsToRefs; | ||
private pendingFields; | ||
private pendingInterfaces; | ||
private pendingUnionTypes; | ||
private pendingRefResolutions; | ||
@@ -57,2 +55,3 @@ private fieldRefCallbacks; | ||
prepareForBuild(): void; | ||
onPrepare(cb: () => void): void; | ||
addFields(typeRef: ConfigurableRef<Types>, fields: FieldMap | InputFieldMap | (() => FieldMap | InputFieldMap)): void; | ||
@@ -59,0 +58,0 @@ getImplementers(ref: ConfigurableRef<Types> | string): PothosObjectTypeConfig[]; |
@@ -11,3 +11,3 @@ import { CompatibleTypes, ExposeNullability, FieldKind, FieldNullability, FieldOptionsFromKind, NormalizeArgs, SchemaTypes, TypeParam } from '../types'; | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, 'Boolean', Nullable, {}, Kind, ParentShape, ResolveReturnShape>, 'resolve' | 'type' | 'nullable'> & ExposeNullability<Types, 'Boolean', ParentShape, Name, Nullable> | ||
]>): import("..").FieldRef<FieldNullability<"Boolean"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("..").FieldRef<FieldNullability<"Boolean"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T_1 ? T_1 extends "Boolean" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("Boolean" extends infer T_2 ? T_2 extends "Boolean" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "Boolean" extends infer T_3 ? T_3 extends "Boolean" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -20,3 +20,3 @@ * Create a Float field from a numeric property on the parent object | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, 'Float', Nullable, {}, Kind, ParentShape, ResolveReturnShape>, 'resolve' | 'type' | 'nullable'> & ExposeNullability<Types, 'Float', ParentShape, Name, Nullable> | ||
]>): import("..").FieldRef<FieldNullability<"Float"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("..").FieldRef<FieldNullability<"Float"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T_1 ? T_1 extends "Float" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("Float" extends infer T_2 ? T_2 extends "Float" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "Float" extends infer T_3 ? T_3 extends "Float" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -29,3 +29,3 @@ * Create an ID field from a property on the parent object | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, 'ID', Nullable, {}, Kind, ParentShape, ResolveReturnShape>, 'resolve' | 'type' | 'nullable'> & ExposeNullability<Types, 'ID', ParentShape, Name, Nullable> | ||
]>): import("..").FieldRef<FieldNullability<"ID"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("..").FieldRef<FieldNullability<"ID"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T_1 ? T_1 extends "ID" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("ID" extends infer T_2 ? T_2 extends "ID" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "ID" extends infer T_3 ? T_3 extends "ID" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -38,3 +38,3 @@ * Create an Int field from a numeric property on the parent object | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, 'Int', Nullable, {}, Kind, ParentShape, ResolveReturnShape>, 'resolve' | 'type' | 'nullable'> & ExposeNullability<Types, 'Int', ParentShape, Name, Nullable> | ||
]>): import("..").FieldRef<FieldNullability<"Int"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("..").FieldRef<FieldNullability<"Int"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T_1 ? T_1 extends "Int" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("Int" extends infer T_2 ? T_2 extends "Int" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "Int" extends infer T_3 ? T_3 extends "Int" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -47,3 +47,3 @@ * Create a String field from a string property on the parent object | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, 'String', Nullable, {}, Kind, ParentShape, ResolveReturnShape>, 'resolve' | 'type' | 'nullable'> & ExposeNullability<Types, 'String', ParentShape, Name, Nullable> | ||
]>): import("..").FieldRef<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("../types").BaseEnum ? import("../types").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("../types").BaseEnum ? import("../types").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("../types").BaseEnum ? import("../types").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("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("..").FieldRef<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("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "String" extends infer T_1 ? T_1 extends "String" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("String" extends infer T_2 ? T_2 extends "String" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "String" extends infer T_3 ? T_3 extends "String" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -50,0 +50,0 @@ * Create a Boolean list field from a boolean[] property on the parent object |
@@ -13,3 +13,3 @@ import InputFieldRef from '../refs/input-field'; | ||
*/ | ||
boolean: <Req extends FieldRequiredness<"Boolean">>(...args: NormalizeArgs<[options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "Boolean", Req>[Kind], "type">], 0>) => InputFieldRef<FieldRequiredness<"Boolean"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Req extends true ? "Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined, Kind>; | ||
boolean: <Req extends FieldRequiredness<"Boolean">>(...args: NormalizeArgs<[options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "Boolean", Req>[Kind], "type">], 0>) => InputFieldRef<FieldRequiredness<"Boolean"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T_1 ? T_1 extends "Boolean" ? T_1 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Req extends true ? "Boolean" extends infer T_2 ? T_2 extends "Boolean" ? T_2 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never : ("Boolean" extends infer T_3 ? T_3 extends "Boolean" ? T_3 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never) | null | undefined, Kind>; | ||
/** | ||
@@ -19,3 +19,3 @@ * Create a Float input field | ||
*/ | ||
float: <Req extends FieldRequiredness<"Float">>(...args: NormalizeArgs<[options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "Float", Req>[Kind], "type">], 0>) => InputFieldRef<FieldRequiredness<"Float"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T ? T extends "Float" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Req extends true ? "Float" extends infer T ? T extends "Float" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined, Kind>; | ||
float: <Req extends FieldRequiredness<"Float">>(...args: NormalizeArgs<[options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "Float", Req>[Kind], "type">], 0>) => InputFieldRef<FieldRequiredness<"Float"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T_1 ? T_1 extends "Float" ? T_1 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Req extends true ? "Float" extends infer T_2 ? T_2 extends "Float" ? T_2 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never : ("Float" extends infer T_3 ? T_3 extends "Float" ? T_3 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never) | null | undefined, Kind>; | ||
/** | ||
@@ -25,3 +25,3 @@ * Create a ID input field | ||
*/ | ||
id: <Req extends FieldRequiredness<"ID">>(...args: NormalizeArgs<[options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "ID", Req>[Kind], "type">], 0>) => InputFieldRef<FieldRequiredness<"ID"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T ? T extends "ID" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Req extends true ? "ID" extends infer T ? T extends "ID" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined, Kind>; | ||
id: <Req extends FieldRequiredness<"ID">>(...args: NormalizeArgs<[options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "ID", Req>[Kind], "type">], 0>) => InputFieldRef<FieldRequiredness<"ID"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T_1 ? T_1 extends "ID" ? T_1 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Req extends true ? "ID" extends infer T_2 ? T_2 extends "ID" ? T_2 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never : ("ID" extends infer T_3 ? T_3 extends "ID" ? T_3 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never) | null | undefined, Kind>; | ||
/** | ||
@@ -31,3 +31,3 @@ * Create a Int input field | ||
*/ | ||
int: <Req extends FieldRequiredness<"Int">>(...args: NormalizeArgs<[options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "Int", Req>[Kind], "type">], 0>) => InputFieldRef<FieldRequiredness<"Int"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T ? T extends "Int" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Req extends true ? "Int" extends infer T ? T extends "Int" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined, Kind>; | ||
int: <Req extends FieldRequiredness<"Int">>(...args: NormalizeArgs<[options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "Int", Req>[Kind], "type">], 0>) => InputFieldRef<FieldRequiredness<"Int"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T_1 ? T_1 extends "Int" ? T_1 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Req extends true ? "Int" extends infer T_2 ? T_2 extends "Int" ? T_2 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never : ("Int" extends infer T_3 ? T_3 extends "Int" ? T_3 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never) | null | undefined, Kind>; | ||
/** | ||
@@ -37,3 +37,3 @@ * Create a String input field | ||
*/ | ||
string: <Req extends FieldRequiredness<"String">>(...args: NormalizeArgs<[options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "String", Req>[Kind], "type">], 0>) => InputFieldRef<FieldRequiredness<"String"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("String" extends infer T ? T extends "String" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "String" extends infer T ? T extends "String" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Req extends true ? "String" extends infer T ? T extends "String" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : ("String" extends infer T ? T extends "String" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined, Kind>; | ||
string: <Req extends FieldRequiredness<"String">>(...args: NormalizeArgs<[options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "String", Req>[Kind], "type">], 0>) => InputFieldRef<FieldRequiredness<"String"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("String" extends infer T ? T extends "String" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "String" extends infer T_1 ? T_1 extends "String" ? T_1 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Req extends true ? "String" extends infer T_2 ? T_2 extends "String" ? T_2 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never : ("String" extends infer T_3 ? T_3 extends "String" ? T_3 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never) | null | undefined, Kind>; | ||
/** | ||
@@ -40,0 +40,0 @@ * Create a Boolean list input field |
@@ -13,3 +13,3 @@ import ListRef from '../refs/list'; | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, 'Boolean', Nullable, Args, Kind, ResolveShape, ResolveReturnShape>, 'type'> | ||
]>): import("..").FieldRef<FieldNullability<"Boolean"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("..").FieldRef<FieldNullability<"Boolean"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T_1 ? T_1 extends "Boolean" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("Boolean" extends infer T_2 ? T_2 extends "Boolean" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "Boolean" extends infer T_3 ? T_3 extends "Boolean" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -21,3 +21,3 @@ * Create a Float field | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, 'Float', Nullable, Args, Kind, ResolveShape, ResolveReturnShape>, 'type'> | ||
]>): import("..").FieldRef<FieldNullability<"Float"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("..").FieldRef<FieldNullability<"Float"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T_1 ? T_1 extends "Float" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("Float" extends infer T_2 ? T_2 extends "Float" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "Float" extends infer T_3 ? T_3 extends "Float" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -29,3 +29,3 @@ * Create a ID field | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, 'ID', Nullable, Args, Kind, ResolveShape, ResolveReturnShape>, 'type'> | ||
]>): import("..").FieldRef<FieldNullability<"ID"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("..").FieldRef<FieldNullability<"ID"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T_1 ? T_1 extends "ID" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("ID" extends infer T_2 ? T_2 extends "ID" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "ID" extends infer T_3 ? T_3 extends "ID" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -37,3 +37,3 @@ * Create a Int field | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, 'Int', Nullable, Args, Kind, ResolveShape, ResolveReturnShape>, 'type'> | ||
]>): import("..").FieldRef<FieldNullability<"Int"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("..").FieldRef<FieldNullability<"Int"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T_1 ? T_1 extends "Int" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("Int" extends infer T_2 ? T_2 extends "Int" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "Int" extends infer T_3 ? T_3 extends "Int" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -45,3 +45,3 @@ * Create a String field | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, 'String', Nullable, Args, Kind, ResolveShape, ResolveReturnShape>, 'type'> | ||
]>): import("..").FieldRef<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("../types").BaseEnum ? import("../types").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("../types").BaseEnum ? import("../types").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("../types").BaseEnum ? import("../types").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("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("..").FieldRef<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("../types").BaseEnum ? import("../types").ValuesFromEnum<T> : never : never : never) | null | undefined : "String" extends infer T_1 ? T_1 extends "String" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("String" extends infer T_2 ? T_2 extends "String" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "String" extends infer T_3 ? T_3 extends "String" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types").BaseEnum ? import("../types").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -48,0 +48,0 @@ * Create a Boolean list field |
@@ -14,4 +14,4 @@ import { GraphQLFieldResolver, GraphQLIsTypeOfFn, GraphQLSchema, GraphQLTypeResolver } from 'graphql'; | ||
afterBuild(schema: GraphQLSchema): GraphQLSchema; | ||
wrapResolve(resolve: GraphQLFieldResolver<unknown, Types['Context'], object>, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object, unknown>; | ||
wrapSubscribe(subscribe: GraphQLFieldResolver<unknown, Types['Context'], object> | undefined, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object, unknown> | undefined; | ||
wrapResolve(resolve: GraphQLFieldResolver<unknown, Types['Context'], object>, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object>; | ||
wrapSubscribe(subscribe: GraphQLFieldResolver<unknown, Types['Context'], object> | undefined, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object> | undefined; | ||
wrapResolveType(resolveType: GraphQLTypeResolver<unknown, Types['Context']>, typeConfig: PothosInterfaceTypeConfig | PothosUnionTypeConfig): GraphQLTypeResolver<unknown, Types["Context"]>; | ||
@@ -18,0 +18,0 @@ wrapIsTypeOf(isTypeOf: GraphQLIsTypeOfFn<unknown, Types['Context']> | undefined, typeConfig: PothosObjectTypeConfig): GraphQLIsTypeOfFn<unknown, Types["Context"]> | undefined; |
@@ -14,3 +14,3 @@ import { InputType, InputTypeParam, OutputType, SchemaTypes, TypeParam } from '../types'; | ||
export declare function brandWithType<Types extends SchemaTypes>(val: unknown, type: OutputType<Types>): void; | ||
export declare function getTypeBrand(val: unknown): import("../types").BaseEnum | (new (...args: any[]) => any) | "String" | "ID" | "Int" | "Float" | "Boolean" | null; | ||
export declare function getTypeBrand(val: unknown): OutputType<SchemaTypes> | null; | ||
export declare function unwrapListParam<Types extends SchemaTypes>(param: TypeParam<Types> | InputTypeParam<Types>): OutputType<Types> | InputType<Types>; | ||
@@ -17,0 +17,0 @@ export declare function unwrapOutputListParam<Types extends SchemaTypes>(param: TypeParam<Types>): OutputType<Types>; |
@@ -1,2 +0,16 @@ | ||
/* eslint-disable no-continue */ import { defaultFieldResolver, defaultTypeResolver, GraphQLBoolean, GraphQLEnumType, GraphQLFloat, GraphQLID, GraphQLInputObjectType, GraphQLInt, GraphQLInterfaceType, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLScalarType, GraphQLString, GraphQLUnionType } from 'graphql'; | ||
/* eslint-disable no-continue */ function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { defaultFieldResolver, defaultTypeResolver, GraphQLBoolean, GraphQLEnumType, GraphQLFloat, GraphQLID, GraphQLInputObjectType, GraphQLInt, GraphQLInterfaceType, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLScalarType, GraphQLString, GraphQLUnionType } from 'graphql'; | ||
import { PothosError, PothosSchemaError } from './errors.js'; | ||
@@ -472,8 +486,14 @@ import { MergedPlugins } from './plugins/index.js'; | ||
constructor(builder, options) { | ||
this.types = new Map(); | ||
this.implementers = new Map(); | ||
this.typeConfigs = new Map(); | ||
this.enumValueConfigs = new Map(); | ||
this.outputFieldConfigs = new Map(); | ||
this.inputFieldConfigs = new Map(); | ||
_defineProperty(this, "types", new Map()); | ||
_defineProperty(this, "builder", void 0); | ||
_defineProperty(this, "plugin", void 0); | ||
_defineProperty(this, "options", void 0); | ||
_defineProperty(this, "configStore", void 0); | ||
_defineProperty(this, "pluginMap", void 0); | ||
_defineProperty(this, "pluginList", void 0); | ||
_defineProperty(this, "implementers", new Map()); | ||
_defineProperty(this, "typeConfigs", new Map()); | ||
_defineProperty(this, "enumValueConfigs", new Map()); | ||
_defineProperty(this, "outputFieldConfigs", new Map()); | ||
_defineProperty(this, "inputFieldConfigs", new Map()); | ||
this.builder = builder; | ||
@@ -480,0 +500,0 @@ this.configStore = builder.configStore; |
@@ -25,3 +25,3 @@ import { GraphQLScalarSerializer, GraphQLScalarType, GraphQLSchema } from 'graphql'; | ||
fields?: QueryFieldsShape<Types> | ||
], 0>): ObjectRef<"Query" extends infer T ? T extends "Query" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends BaseEnum ? ValuesFromEnum<T> : never : never : never, "Query" extends infer T_1 ? T_1 extends "Query" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends BaseEnum ? ValuesFromEnum<T_1> : never : never : never>; | ||
], 0>): ObjectRef<OutputShape<Types, "Query">, "Query" extends infer T ? T extends "Query" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends BaseEnum ? ValuesFromEnum<T> : never : never : never>; | ||
queryFields(fields: QueryFieldsShape<Types>): void; | ||
@@ -28,0 +28,0 @@ queryField(name: string, field: QueryFieldThunk<Types>): void; |
@@ -0,1 +1,15 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt, GraphQLSchema, GraphQLString, lexicographicSortSchema } from 'graphql'; | ||
@@ -333,2 +347,6 @@ import BuildCache from './build-cache.js'; | ||
constructor(options) { | ||
_defineProperty(this, "configStore", void 0); | ||
_defineProperty(this, "options", void 0); | ||
_defineProperty(this, "defaultFieldNullability", void 0); | ||
_defineProperty(this, "defaultInputFieldRequiredness", void 0); | ||
this.options = options; | ||
@@ -342,5 +360,5 @@ this.configStore = new ConfigStore(); | ||
} | ||
SchemaBuilder.plugins = {}; | ||
SchemaBuilder.allowPluginReRegistration = false; | ||
_defineProperty(SchemaBuilder, "plugins", {}); | ||
_defineProperty(SchemaBuilder, "allowPluginReRegistration", false); | ||
export { SchemaBuilder as default }; | ||
//# sourceMappingURL=builder.js.map |
@@ -8,3 +8,3 @@ import FieldRef from './refs/field.js'; | ||
private fields; | ||
private addFieldFns; | ||
private pendingActions; | ||
private refsToName; | ||
@@ -14,4 +14,2 @@ private scalarsToRefs; | ||
private pendingFields; | ||
private pendingInterfaces; | ||
private pendingUnionTypes; | ||
private pendingRefResolutions; | ||
@@ -57,2 +55,3 @@ private fieldRefCallbacks; | ||
prepareForBuild(): void; | ||
onPrepare(cb: () => void): void; | ||
addFields(typeRef: ConfigurableRef<Types>, fields: FieldMap | InputFieldMap | (() => FieldMap | InputFieldMap)): void; | ||
@@ -59,0 +58,0 @@ getImplementers(ref: ConfigurableRef<Types> | string): PothosObjectTypeConfig[]; |
@@ -1,2 +0,16 @@ | ||
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */ /* eslint-disable node/no-callback-literal */ import { GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt, GraphQLString } from 'graphql'; | ||
/* eslint-disable @typescript-eslint/no-redundant-type-constituents */ /* eslint-disable node/no-callback-literal */ function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt, GraphQLString } from 'graphql'; | ||
import { PothosError, PothosSchemaError } from './errors.js'; | ||
@@ -18,13 +32,3 @@ import BaseTypeRef from './refs/base.js'; | ||
addUnionTypes(typeName, unionTypes) { | ||
if (typeof unionTypes === "function" && this.pending) { | ||
if (this.pendingUnionTypes.has(typeName)) { | ||
this.pendingUnionTypes.get(typeName).push(unionTypes); | ||
} | ||
else { | ||
this.pendingUnionTypes.set(typeName, [ | ||
unionTypes | ||
]); | ||
} | ||
} | ||
else { | ||
this.onPrepare(() => { | ||
const typeConfig = this.getTypeConfig(typeName); | ||
@@ -38,16 +42,6 @@ if (typeConfig.graphqlKind !== "Union") { | ||
]; | ||
} | ||
}); | ||
} | ||
addInterfaces(typeName, interfaces) { | ||
if (typeof interfaces === "function" && this.pending) { | ||
if (this.pendingInterfaces.has(typeName)) { | ||
this.pendingInterfaces.get(typeName).push(interfaces); | ||
} | ||
else { | ||
this.pendingInterfaces.set(typeName, [ | ||
interfaces | ||
]); | ||
} | ||
} | ||
else { | ||
this.onPrepare(() => { | ||
const typeConfig = this.getTypeConfig(typeName); | ||
@@ -61,3 +55,3 @@ if (typeConfig.graphqlKind !== "Object" && typeConfig.graphqlKind !== "Interface" || typeConfig.kind === "Query" || typeConfig.kind === "Mutation" || typeConfig.kind === "Subscription") { | ||
]; | ||
} | ||
}); | ||
} | ||
@@ -252,9 +246,5 @@ addFieldRef(ref, // We need to be able to resolve the types kind before configuring the field | ||
this.pending = false; | ||
const fns = this.addFieldFns; | ||
const interfaces = this.pendingInterfaces; | ||
const unions = this.pendingUnionTypes; | ||
this.addFieldFns = []; | ||
this.pendingInterfaces = new Map(); | ||
this.pendingUnionTypes = new Map(); | ||
fns.forEach((fn) => void fn()); | ||
const { pendingActions } = this; | ||
this.pendingActions = []; | ||
pendingActions.forEach((fn) => void fn()); | ||
if (this.pendingRefResolutions.size > 0) { | ||
@@ -265,23 +255,16 @@ throw new PothosSchemaError(`Missing implementations for some references (${[ | ||
} | ||
for (const [typeName, unionFns] of unions) { | ||
for (const fn of unionFns) { | ||
this.addUnionTypes(typeName, fn); | ||
} | ||
} | ||
for (const [typeName, interfacesFns] of interfaces) { | ||
for (const fn of interfacesFns) { | ||
this.addInterfaces(typeName, fn); | ||
} | ||
} | ||
} | ||
addFields(typeRef, fields) { | ||
onPrepare(cb) { | ||
if (this.pending) { | ||
this.addFieldFns.push(() => void this.addFields(typeRef, fields)); | ||
this.pendingActions.push(cb); | ||
} | ||
else { | ||
this.onTypeConfig(typeRef, (config) => { | ||
this.buildFields(typeRef, typeof fields === "function" ? fields() : fields); | ||
}); | ||
cb(); | ||
} | ||
} | ||
addFields(typeRef, fields) { | ||
this.onPrepare(() => void this.onTypeConfig(typeRef, (config) => { | ||
this.buildFields(typeRef, typeof fields === "function" ? fields() : fields); | ||
})); | ||
} | ||
getImplementers(ref) { | ||
@@ -344,15 +327,13 @@ const typeConfig = this.getTypeConfig(ref, "Interface"); | ||
constructor() { | ||
this.typeConfigs = new Map(); | ||
this.fieldRefs = new WeakMap(); | ||
this.fields = new Map(); | ||
this.addFieldFns = []; | ||
this.refsToName = new Map(); | ||
this.scalarsToRefs = new Map(); | ||
this.fieldRefsToConfigs = new Map(); | ||
this.pendingFields = new Map(); | ||
this.pendingInterfaces = new Map(); | ||
this.pendingUnionTypes = new Map(); | ||
this.pendingRefResolutions = new Map(); | ||
this.fieldRefCallbacks = new Map(); | ||
this.pending = true; | ||
_defineProperty(this, "typeConfigs", new Map()); | ||
_defineProperty(this, "fieldRefs", new WeakMap()); | ||
_defineProperty(this, "fields", new Map()); | ||
_defineProperty(this, "pendingActions", []); | ||
_defineProperty(this, "refsToName", new Map()); | ||
_defineProperty(this, "scalarsToRefs", new Map()); | ||
_defineProperty(this, "fieldRefsToConfigs", new Map()); | ||
_defineProperty(this, "pendingFields", new Map()); | ||
_defineProperty(this, "pendingRefResolutions", new Map()); | ||
_defineProperty(this, "fieldRefCallbacks", new Map()); | ||
_defineProperty(this, "pending", true); | ||
const scalars = [ | ||
@@ -359,0 +340,0 @@ GraphQLID, |
@@ -0,1 +1,15 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { defaultFieldResolver } from 'graphql'; | ||
@@ -60,2 +74,6 @@ import { PothosSchemaError } from '../errors.js'; | ||
constructor(name, builder, kind, graphqlKind) { | ||
_defineProperty(this, "typename", void 0); | ||
_defineProperty(this, "builder", void 0); | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, "graphqlKind", void 0); | ||
this.typename = name; | ||
@@ -62,0 +80,0 @@ this.builder = builder; |
@@ -11,3 +11,3 @@ import { CompatibleTypes, ExposeNullability, FieldKind, FieldNullability, FieldOptionsFromKind, NormalizeArgs, SchemaTypes, TypeParam } from '../types/index.js'; | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, "Boolean", Nullable, {}, Kind, ParentShape, ResolveReturnShape>, "resolve" | "type" | "nullable"> & ExposeNullability<Types, "Boolean", ParentShape, Name, Nullable> | ||
]>): import("../index.js").FieldRef<FieldNullability<"Boolean"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("../index.js").FieldRef<FieldNullability<"Boolean"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T_1 ? T_1 extends "Boolean" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("Boolean" extends infer T_2 ? T_2 extends "Boolean" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "Boolean" extends infer T_3 ? T_3 extends "Boolean" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -20,3 +20,3 @@ * Create a Float field from a numeric property on the parent object | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, "Float", Nullable, {}, Kind, ParentShape, ResolveReturnShape>, "resolve" | "type" | "nullable"> & ExposeNullability<Types, "Float", ParentShape, Name, Nullable> | ||
]>): import("../index.js").FieldRef<FieldNullability<"Float"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("../index.js").FieldRef<FieldNullability<"Float"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T_1 ? T_1 extends "Float" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("Float" extends infer T_2 ? T_2 extends "Float" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "Float" extends infer T_3 ? T_3 extends "Float" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -29,3 +29,3 @@ * Create an ID field from a property on the parent object | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, "ID", Nullable, {}, Kind, ParentShape, ResolveReturnShape>, "resolve" | "type" | "nullable"> & ExposeNullability<Types, "ID", ParentShape, Name, Nullable> | ||
]>): import("../index.js").FieldRef<FieldNullability<"ID"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("../index.js").FieldRef<FieldNullability<"ID"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T_1 ? T_1 extends "ID" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("ID" extends infer T_2 ? T_2 extends "ID" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "ID" extends infer T_3 ? T_3 extends "ID" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -38,3 +38,3 @@ * Create an Int field from a numeric property on the parent object | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, "Int", Nullable, {}, Kind, ParentShape, ResolveReturnShape>, "resolve" | "type" | "nullable"> & ExposeNullability<Types, "Int", ParentShape, Name, Nullable> | ||
]>): import("../index.js").FieldRef<FieldNullability<"Int"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("../index.js").FieldRef<FieldNullability<"Int"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T_1 ? T_1 extends "Int" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("Int" extends infer T_2 ? T_2 extends "Int" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "Int" extends infer T_3 ? T_3 extends "Int" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -47,3 +47,3 @@ * Create a String field from a string property on the parent object | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, "String", Nullable, {}, Kind, ParentShape, ResolveReturnShape>, "resolve" | "type" | "nullable"> & ExposeNullability<Types, "String", ParentShape, Name, Nullable> | ||
]>): import("../index.js").FieldRef<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("../types/index.js").BaseEnum ? import("../types/index.js").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("../types/index.js").BaseEnum ? import("../types/index.js").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("../types/index.js").BaseEnum ? import("../types/index.js").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("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("../index.js").FieldRef<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("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "String" extends infer T_1 ? T_1 extends "String" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("String" extends infer T_2 ? T_2 extends "String" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "String" extends infer T_3 ? T_3 extends "String" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -50,0 +50,0 @@ * Create a Boolean list field from a boolean[] property on the parent object |
@@ -15,3 +15,3 @@ import InputFieldRef from '../refs/input-field.js'; | ||
options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "Boolean", Req>[Kind], "type"> | ||
], 0>) => InputFieldRef<FieldRequiredness<"Boolean"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Req extends true ? "Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined, Kind>; | ||
], 0>) => InputFieldRef<FieldRequiredness<"Boolean"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T_1 ? T_1 extends "Boolean" ? T_1 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Req extends true ? "Boolean" extends infer T_2 ? T_2 extends "Boolean" ? T_2 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never : ("Boolean" extends infer T_3 ? T_3 extends "Boolean" ? T_3 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never) | null | undefined, Kind>; | ||
/** | ||
@@ -23,3 +23,3 @@ * Create a Float input field | ||
options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "Float", Req>[Kind], "type"> | ||
], 0>) => InputFieldRef<FieldRequiredness<"Float"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T ? T extends "Float" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Req extends true ? "Float" extends infer T ? T extends "Float" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined, Kind>; | ||
], 0>) => InputFieldRef<FieldRequiredness<"Float"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T_1 ? T_1 extends "Float" ? T_1 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Req extends true ? "Float" extends infer T_2 ? T_2 extends "Float" ? T_2 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never : ("Float" extends infer T_3 ? T_3 extends "Float" ? T_3 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never) | null | undefined, Kind>; | ||
/** | ||
@@ -31,3 +31,3 @@ * Create a ID input field | ||
options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "ID", Req>[Kind], "type"> | ||
], 0>) => InputFieldRef<FieldRequiredness<"ID"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T ? T extends "ID" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Req extends true ? "ID" extends infer T ? T extends "ID" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined, Kind>; | ||
], 0>) => InputFieldRef<FieldRequiredness<"ID"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T_1 ? T_1 extends "ID" ? T_1 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Req extends true ? "ID" extends infer T_2 ? T_2 extends "ID" ? T_2 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never : ("ID" extends infer T_3 ? T_3 extends "ID" ? T_3 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never) | null | undefined, Kind>; | ||
/** | ||
@@ -39,3 +39,3 @@ * Create a Int input field | ||
options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "Int", Req>[Kind], "type"> | ||
], 0>) => InputFieldRef<FieldRequiredness<"Int"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T ? T extends "Int" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Req extends true ? "Int" extends infer T ? T extends "Int" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined, Kind>; | ||
], 0>) => InputFieldRef<FieldRequiredness<"Int"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T_1 ? T_1 extends "Int" ? T_1 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Req extends true ? "Int" extends infer T_2 ? T_2 extends "Int" ? T_2 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never : ("Int" extends infer T_3 ? T_3 extends "Int" ? T_3 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never) | null | undefined, Kind>; | ||
/** | ||
@@ -47,3 +47,3 @@ * Create a String input field | ||
options: Omit<PothosSchemaTypes.InputFieldOptionsByKind<Types, "String", Req>[Kind], "type"> | ||
], 0>) => InputFieldRef<FieldRequiredness<"String"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("String" extends infer T ? T extends "String" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "String" extends infer T ? T extends "String" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Req extends true ? "String" extends infer T ? T extends "String" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : ("String" extends infer T ? T extends "String" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined, Kind>; | ||
], 0>) => InputFieldRef<FieldRequiredness<"String"> extends Req ? Types["DefaultInputFieldRequiredness"] extends false ? ("String" extends infer T ? T extends "String" ? T extends keyof Types["inputShapes"] ? Types["inputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "String" extends infer T_1 ? T_1 extends "String" ? T_1 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Req extends true ? "String" extends infer T_2 ? T_2 extends "String" ? T_2 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never : ("String" extends infer T_3 ? T_3 extends "String" ? T_3 extends keyof Types["inputShapes"] ? Types["inputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never) | null | undefined, Kind>; | ||
/** | ||
@@ -50,0 +50,0 @@ * Create a Boolean list input field |
@@ -0,1 +1,15 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import InputFieldRef from '../refs/input-field.js'; | ||
@@ -47,56 +61,59 @@ import InputListRef from '../refs/input-list.js'; | ||
constructor(builder, kind, typename) { | ||
_defineProperty(this, "builder", void 0); | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, "typename", void 0); | ||
/** | ||
* Create a Boolean input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.boolean = this.helper("Boolean"); | ||
*/ _defineProperty(this, "boolean", this.helper("Boolean")); | ||
/** | ||
* Create a Float input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.float = this.helper("Float"); | ||
*/ _defineProperty(this, "float", this.helper("Float")); | ||
/** | ||
* Create a ID input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.id = this.helper("ID"); | ||
*/ _defineProperty(this, "id", this.helper("ID")); | ||
/** | ||
* Create a Int input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.int = this.helper("Int"); | ||
*/ _defineProperty(this, "int", this.helper("Int")); | ||
/** | ||
* Create a String input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.string = this.helper("String"); | ||
*/ _defineProperty(this, "string", this.helper("String")); | ||
/** | ||
* Create a Boolean list input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.booleanList = this.helper([ | ||
*/ _defineProperty(this, "booleanList", this.helper([ | ||
"Boolean" | ||
]); | ||
])); | ||
/** | ||
* Create a Float list input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.floatList = this.helper([ | ||
*/ _defineProperty(this, "floatList", this.helper([ | ||
"Float" | ||
]); | ||
])); | ||
/** | ||
* Create a ID list input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.idList = this.helper([ | ||
*/ _defineProperty(this, "idList", this.helper([ | ||
"ID" | ||
]); | ||
])); | ||
/** | ||
* Create a Int list input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.intList = this.helper([ | ||
*/ _defineProperty(this, "intList", this.helper([ | ||
"Int" | ||
]); | ||
])); | ||
/** | ||
* Create a String list input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.stringList = this.helper([ | ||
*/ _defineProperty(this, "stringList", this.helper([ | ||
"String" | ||
]); | ||
])); | ||
var _options_required; | ||
this.listRef = (type, options) => { | ||
_defineProperty(this, "listRef", (type, options) => { | ||
return new InputListRef(type, (_options_required = options === null || options === void 0 ? void 0 : options.required) !== null && _options_required !== void 0 ? _options_required : true); | ||
}; | ||
}); | ||
this.builder = builder; | ||
@@ -103,0 +120,0 @@ this.kind = kind; |
@@ -13,3 +13,3 @@ import ListRef from '../refs/list.js'; | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, "Boolean", Nullable, Args, Kind, ResolveShape, ResolveReturnShape>, "type"> | ||
]>): import("../index.js").FieldRef<FieldNullability<"Boolean"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("../index.js").FieldRef<FieldNullability<"Boolean"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Boolean" extends infer T ? T extends "Boolean" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Boolean" extends infer T_1 ? T_1 extends "Boolean" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("Boolean" extends infer T_2 ? T_2 extends "Boolean" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "Boolean" extends infer T_3 ? T_3 extends "Boolean" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -21,3 +21,3 @@ * Create a Float field | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, "Float", Nullable, Args, Kind, ResolveShape, ResolveReturnShape>, "type"> | ||
]>): import("../index.js").FieldRef<FieldNullability<"Float"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("../index.js").FieldRef<FieldNullability<"Float"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Float" extends infer T ? T extends "Float" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Float" extends infer T_1 ? T_1 extends "Float" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("Float" extends infer T_2 ? T_2 extends "Float" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "Float" extends infer T_3 ? T_3 extends "Float" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -29,3 +29,3 @@ * Create a ID field | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, "ID", Nullable, Args, Kind, ResolveShape, ResolveReturnShape>, "type"> | ||
]>): import("../index.js").FieldRef<FieldNullability<"ID"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("../index.js").FieldRef<FieldNullability<"ID"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("ID" extends infer T ? T extends "ID" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "ID" extends infer T_1 ? T_1 extends "ID" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("ID" extends infer T_2 ? T_2 extends "ID" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "ID" extends infer T_3 ? T_3 extends "ID" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -37,3 +37,3 @@ * Create a Int field | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, "Int", Nullable, Args, Kind, ResolveShape, ResolveReturnShape>, "type"> | ||
]>): import("../index.js").FieldRef<FieldNullability<"Int"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never : Nullable extends true ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("../index.js").FieldRef<FieldNullability<"Int"> extends Nullable ? Types["DefaultFieldNullability"] extends true ? ("Int" extends infer T ? T extends "Int" ? T extends keyof Types["outputShapes"] ? Types["outputShapes"][T] : T extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "Int" extends infer T_1 ? T_1 extends "Int" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("Int" extends infer T_2 ? T_2 extends "Int" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "Int" extends infer T_3 ? T_3 extends "Int" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -45,3 +45,3 @@ * Create a String field | ||
options: Omit<FieldOptionsFromKind<Types, ParentShape, "String", Nullable, Args, Kind, ResolveShape, ResolveReturnShape>, "type"> | ||
]>): import("../index.js").FieldRef<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("../types/index.js").BaseEnum ? import("../types/index.js").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("../types/index.js").BaseEnum ? import("../types/index.js").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("../types/index.js").BaseEnum ? import("../types/index.js").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("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never, Kind>; | ||
]>): import("../index.js").FieldRef<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("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T> : never : never : never) | null | undefined : "String" extends infer T_1 ? T_1 extends "String" ? T_1 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_1] : T_1 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_1> : never : never : never : Nullable extends true ? ("String" extends infer T_2 ? T_2 extends "String" ? T_2 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_2] : T_2 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_2> : never : never : never) | null | undefined : "String" extends infer T_3 ? T_3 extends "String" ? T_3 extends keyof Types["outputShapes"] ? Types["outputShapes"][T_3] : T_3 extends import("../types/index.js").BaseEnum ? import("../types/index.js").ValuesFromEnum<T_3> : never : never : never, Kind>; | ||
/** | ||
@@ -48,0 +48,0 @@ * Create a Boolean list field |
@@ -0,1 +1,15 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import ListRef from '../refs/list.js'; | ||
@@ -137,3 +151,3 @@ import BaseFieldUtil from './base.js'; | ||
super(...args); | ||
this.arg = new InputFieldBuilder(this.builder, "Arg", this.typename).argBuilder(); | ||
_defineProperty(this, "arg", new InputFieldBuilder(this.builder, "Arg", this.typename).argBuilder()); | ||
} | ||
@@ -140,0 +154,0 @@ } |
@@ -14,4 +14,4 @@ import { GraphQLFieldResolver, GraphQLIsTypeOfFn, GraphQLSchema, GraphQLTypeResolver } from 'graphql'; | ||
afterBuild(schema: GraphQLSchema): GraphQLSchema; | ||
wrapResolve(resolve: GraphQLFieldResolver<unknown, Types["Context"], object>, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object, unknown>; | ||
wrapSubscribe(subscribe: GraphQLFieldResolver<unknown, Types["Context"], object> | undefined, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object, unknown> | undefined; | ||
wrapResolve(resolve: GraphQLFieldResolver<unknown, Types["Context"], object>, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object>; | ||
wrapSubscribe(subscribe: GraphQLFieldResolver<unknown, Types["Context"], object> | undefined, fieldConfig: PothosOutputFieldConfig<Types>): GraphQLFieldResolver<unknown, Types["Context"], object> | undefined; | ||
wrapResolveType(resolveType: GraphQLTypeResolver<unknown, Types["Context"]>, typeConfig: PothosInterfaceTypeConfig | PothosUnionTypeConfig): GraphQLTypeResolver<unknown, Types["Context"]>; | ||
@@ -18,0 +18,0 @@ wrapIsTypeOf(isTypeOf: GraphQLIsTypeOfFn<unknown, Types["Context"]> | undefined, typeConfig: PothosObjectTypeConfig): GraphQLIsTypeOfFn<unknown, Types["Context"]> | undefined; |
@@ -0,1 +1,15 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { BasePlugin } from './plugin.js'; | ||
@@ -37,2 +51,3 @@ export class MergedPlugins extends BasePlugin { | ||
super(buildCache, "PothosMergedPlugin"); | ||
_defineProperty(this, "plugins", void 0); | ||
this.plugins = plugins; | ||
@@ -39,0 +54,0 @@ } |
@@ -0,1 +1,15 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { PothosError } from '../errors.js'; | ||
@@ -101,3 +115,7 @@ import { createContextCache } from '../utils/context-cache.js'; | ||
constructor(buildCache, name) { | ||
this.requestDataMap = createContextCache((ctx) => this.createRequestData(ctx)); | ||
_defineProperty(this, "name", void 0); | ||
_defineProperty(this, "builder", void 0); | ||
_defineProperty(this, "buildCache", void 0); | ||
_defineProperty(this, "options", void 0); | ||
_defineProperty(this, "requestDataMap", createContextCache((ctx) => this.createRequestData(ctx))); | ||
this.name = name; | ||
@@ -104,0 +122,0 @@ this.builder = buildCache.builder; |
@@ -0,1 +1,15 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
class BaseTypeRef { | ||
@@ -6,2 +20,4 @@ toString() { | ||
constructor(kind, name) { | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, "name", void 0); | ||
this.kind = kind; | ||
@@ -8,0 +24,0 @@ this.name = name; |
@@ -0,1 +1,15 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import ScalarRef from './scalar.js'; | ||
@@ -5,2 +19,3 @@ class BuiltinScalarRef extends ScalarRef { | ||
super(type.name); | ||
_defineProperty(this, "type", void 0); | ||
this.type = type; | ||
@@ -7,0 +22,0 @@ } |
@@ -0,7 +1,24 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { inputShapeKey, outputShapeKey } from '../types/index.js'; | ||
import BaseTypeRef from './base.js'; | ||
let _outputShapeKey = outputShapeKey, _inputShapeKey = inputShapeKey; | ||
class EnumRef extends BaseTypeRef { | ||
constructor(name) { | ||
super("Enum", name); | ||
this.kind = "Enum"; | ||
_defineProperty(this, "kind", "Enum"); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _inputShapeKey, void 0); | ||
} | ||
@@ -8,0 +25,0 @@ } |
@@ -0,2 +1,17 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { outputFieldShapeKey } from '../types/index.js'; | ||
let _outputFieldShapeKey = outputFieldShapeKey; | ||
class FieldRef { | ||
@@ -10,2 +25,6 @@ toString() { | ||
constructor(kind, parentTypename) { | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, "parentTypename", void 0); | ||
_defineProperty(this, "fieldName", void 0); | ||
_defineProperty(this, _outputFieldShapeKey, void 0); | ||
this.kind = kind; | ||
@@ -12,0 +31,0 @@ this.parentTypename = parentTypename; |
@@ -0,2 +1,17 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { inputFieldShapeKey } from '../types/index.js'; | ||
let _inputFieldShapeKey = inputFieldShapeKey; | ||
class InputFieldRef { | ||
@@ -18,2 +33,7 @@ toString() { | ||
constructor(kind, parentTypename) { | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, "parentTypename", void 0); | ||
_defineProperty(this, "fieldName", void 0); | ||
_defineProperty(this, "argFor", void 0); | ||
_defineProperty(this, _inputFieldShapeKey, void 0); | ||
this.kind = kind; | ||
@@ -20,0 +40,0 @@ this.parentTypename = parentTypename; |
@@ -0,7 +1,25 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { inputShapeKey } from '../types/index.js'; | ||
import BaseTypeRef from './base.js'; | ||
let _inputShapeKey = inputShapeKey; | ||
class InputObjectRef extends BaseTypeRef { | ||
constructor(listType, required) { | ||
super("InputList", `InputList<${String(listType)}>`); | ||
this.kind = "InputList"; | ||
_defineProperty(this, "kind", "InputList"); | ||
_defineProperty(this, _inputShapeKey, void 0); | ||
_defineProperty(this, "listType", void 0); | ||
_defineProperty(this, "required", void 0); | ||
this.listType = listType; | ||
@@ -8,0 +26,0 @@ this.required = required; |
@@ -1,7 +0,23 @@ | ||
/* eslint-disable max-classes-per-file */ import { inputShapeKey } from '../types/index.js'; | ||
/* eslint-disable max-classes-per-file */ function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { inputShapeKey } from '../types/index.js'; | ||
import BaseTypeRef from './base.js'; | ||
let _inputShapeKey = inputShapeKey; | ||
class InputObjectRef extends BaseTypeRef { | ||
constructor(name) { | ||
super("InputObject", name); | ||
this.kind = "InputObject"; | ||
_defineProperty(this, "kind", "InputObject"); | ||
_defineProperty(this, _inputShapeKey, void 0); | ||
} | ||
@@ -17,2 +33,3 @@ } | ||
super(name); | ||
_defineProperty(this, "builder", void 0); | ||
this.builder = builder; | ||
@@ -19,0 +36,0 @@ } |
@@ -0,6 +1,23 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { inputShapeKey } from '../types/index.js'; | ||
import BaseTypeRef from './base.js'; | ||
let _inputShapeKey = inputShapeKey; | ||
class InputTypeRef extends BaseTypeRef { | ||
constructor(kind, name) { | ||
super(kind, name); | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, _inputShapeKey, void 0); | ||
this.kind = kind; | ||
@@ -7,0 +24,0 @@ } |
@@ -1,7 +0,24 @@ | ||
/* eslint-disable max-classes-per-file */ import { outputShapeKey, parentShapeKey } from '../types/index.js'; | ||
/* eslint-disable max-classes-per-file */ function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { outputShapeKey, parentShapeKey } from '../types/index.js'; | ||
import BaseTypeRef from './base.js'; | ||
let _outputShapeKey = outputShapeKey, _parentShapeKey = parentShapeKey; | ||
class InterfaceRef extends BaseTypeRef { | ||
constructor(name) { | ||
super("Interface", name); | ||
this.kind = "Interface"; | ||
_defineProperty(this, "kind", "Interface"); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _parentShapeKey, void 0); | ||
} | ||
@@ -16,2 +33,3 @@ } | ||
super(name); | ||
_defineProperty(this, "builder", void 0); | ||
this.builder = builder; | ||
@@ -18,0 +36,0 @@ } |
@@ -0,7 +1,26 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { outputShapeKey, parentShapeKey } from '../types/index.js'; | ||
import BaseTypeRef from './base.js'; | ||
let _outputShapeKey = outputShapeKey, _parentShapeKey = parentShapeKey; | ||
class ListRef extends BaseTypeRef { | ||
constructor(listType, nullable) { | ||
super("List", `List<${String(listType)}>`); | ||
this.kind = "List"; | ||
_defineProperty(this, "kind", "List"); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _parentShapeKey, void 0); | ||
_defineProperty(this, "listType", void 0); | ||
_defineProperty(this, "nullable", void 0); | ||
this.listType = listType; | ||
@@ -8,0 +27,0 @@ this.nullable = nullable; |
@@ -1,7 +0,24 @@ | ||
/* eslint-disable max-classes-per-file */ import { outputShapeKey, parentShapeKey } from '../types/index.js'; | ||
/* eslint-disable max-classes-per-file */ function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { outputShapeKey, parentShapeKey } from '../types/index.js'; | ||
import BaseTypeRef from './base.js'; | ||
let _outputShapeKey = outputShapeKey, _parentShapeKey = parentShapeKey; | ||
class ObjectRef extends BaseTypeRef { | ||
constructor(name) { | ||
super("Object", name); | ||
this.kind = "Object"; | ||
_defineProperty(this, "kind", "Object"); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _parentShapeKey, void 0); | ||
} | ||
@@ -16,2 +33,3 @@ } | ||
super(name); | ||
_defineProperty(this, "builder", void 0); | ||
this.builder = builder; | ||
@@ -18,0 +36,0 @@ } |
@@ -0,6 +1,24 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { outputShapeKey, parentShapeKey } from '../types/index.js'; | ||
import BaseTypeRef from './base.js'; | ||
let _outputShapeKey = outputShapeKey, _parentShapeKey = parentShapeKey; | ||
class OutputTypeRef extends BaseTypeRef { | ||
constructor(kind, name) { | ||
super(kind, name); | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _parentShapeKey, void 0); | ||
this.kind = kind; | ||
@@ -7,0 +25,0 @@ } |
@@ -0,7 +1,25 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { inputShapeKey, outputShapeKey, parentShapeKey } from '../types/index.js'; | ||
import BaseTypeRef from './base.js'; | ||
let _outputShapeKey = outputShapeKey, _parentShapeKey = parentShapeKey, _inputShapeKey = inputShapeKey; | ||
class ScalarRef extends BaseTypeRef { | ||
constructor(name) { | ||
super("Scalar", name); | ||
this.kind = "Scalar"; | ||
_defineProperty(this, "kind", "Scalar"); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _parentShapeKey, void 0); | ||
_defineProperty(this, _inputShapeKey, void 0); | ||
} | ||
@@ -8,0 +26,0 @@ } |
@@ -0,7 +1,24 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} | ||
else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
import { outputShapeKey, parentShapeKey } from '../types/type-params.js'; | ||
import BaseTypeRef from './base.js'; | ||
let _outputShapeKey = outputShapeKey, _parentShapeKey = parentShapeKey; | ||
class UnionRef extends BaseTypeRef { | ||
constructor(name) { | ||
super("Union", name); | ||
this.kind = "Union"; | ||
_defineProperty(this, "kind", "Union"); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _parentShapeKey, void 0); | ||
} | ||
@@ -8,0 +25,0 @@ } |
@@ -14,3 +14,3 @@ import { InputType, InputTypeParam, OutputType, SchemaTypes, TypeParam } from '../types/index.js'; | ||
export declare function brandWithType<Types extends SchemaTypes>(val: unknown, type: OutputType<Types>): void; | ||
export declare function getTypeBrand(val: unknown): import("../types/index.js").BaseEnum | (new (...args: any[]) => any) | "String" | "ID" | "Int" | "Float" | "Boolean" | null; | ||
export declare function getTypeBrand(val: unknown): OutputType<SchemaTypes> | null; | ||
export declare function unwrapListParam<Types extends SchemaTypes>(param: TypeParam<Types> | InputTypeParam<Types>): OutputType<Types> | InputType<Types>; | ||
@@ -17,0 +17,0 @@ export declare function unwrapOutputListParam<Types extends SchemaTypes>(param: TypeParam<Types>): OutputType<Types>; |
@@ -16,2 +16,15 @@ /* eslint-disable no-continue */ "use strict"; | ||
const _utils = require("./utils"); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -484,8 +497,14 @@ return obj && obj.__esModule ? obj : { | ||
constructor(builder, options){ | ||
this.types = new Map(); | ||
this.implementers = new Map(); | ||
this.typeConfigs = new Map(); | ||
this.enumValueConfigs = new Map(); | ||
this.outputFieldConfigs = new Map(); | ||
this.inputFieldConfigs = new Map(); | ||
_defineProperty(this, "types", new Map()); | ||
_defineProperty(this, "builder", void 0); | ||
_defineProperty(this, "plugin", void 0); | ||
_defineProperty(this, "options", void 0); | ||
_defineProperty(this, "configStore", void 0); | ||
_defineProperty(this, "pluginMap", void 0); | ||
_defineProperty(this, "pluginList", void 0); | ||
_defineProperty(this, "implementers", new Map()); | ||
_defineProperty(this, "typeConfigs", new Map()); | ||
_defineProperty(this, "enumValueConfigs", new Map()); | ||
_defineProperty(this, "outputFieldConfigs", new Map()); | ||
_defineProperty(this, "inputFieldConfigs", new Map()); | ||
this.builder = builder; | ||
@@ -492,0 +511,0 @@ this.configStore = builder.configStore; |
@@ -27,2 +27,15 @@ "use strict"; | ||
const _utils = require("./utils"); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -386,2 +399,6 @@ return obj && obj.__esModule ? obj : { | ||
constructor(options){ | ||
_defineProperty(this, "configStore", void 0); | ||
_defineProperty(this, "options", void 0); | ||
_defineProperty(this, "defaultFieldNullability", void 0); | ||
_defineProperty(this, "defaultInputFieldRequiredness", void 0); | ||
this.options = options; | ||
@@ -395,5 +412,5 @@ this.configStore = new _configStore.default(); | ||
} | ||
SchemaBuilder.plugins = {}; | ||
SchemaBuilder.allowPluginReRegistration = false; | ||
_defineProperty(SchemaBuilder, "plugins", {}); | ||
_defineProperty(SchemaBuilder, "allowPluginReRegistration", false); | ||
//# sourceMappingURL=builder.js.map |
@@ -18,2 +18,15 @@ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */ /* eslint-disable node/no-callback-literal */ "use strict"; | ||
const _utils = require("./utils"); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -32,11 +45,3 @@ return obj && obj.__esModule ? obj : { | ||
addUnionTypes(typeName, unionTypes) { | ||
if (typeof unionTypes === 'function' && this.pending) { | ||
if (this.pendingUnionTypes.has(typeName)) { | ||
this.pendingUnionTypes.get(typeName).push(unionTypes); | ||
} else { | ||
this.pendingUnionTypes.set(typeName, [ | ||
unionTypes | ||
]); | ||
} | ||
} else { | ||
this.onPrepare(()=>{ | ||
const typeConfig = this.getTypeConfig(typeName); | ||
@@ -50,14 +55,6 @@ if (typeConfig.graphqlKind !== 'Union') { | ||
]; | ||
} | ||
}); | ||
} | ||
addInterfaces(typeName, interfaces) { | ||
if (typeof interfaces === 'function' && this.pending) { | ||
if (this.pendingInterfaces.has(typeName)) { | ||
this.pendingInterfaces.get(typeName).push(interfaces); | ||
} else { | ||
this.pendingInterfaces.set(typeName, [ | ||
interfaces | ||
]); | ||
} | ||
} else { | ||
this.onPrepare(()=>{ | ||
const typeConfig = this.getTypeConfig(typeName); | ||
@@ -71,3 +68,3 @@ if (typeConfig.graphqlKind !== 'Object' && typeConfig.graphqlKind !== 'Interface' || typeConfig.kind === 'Query' || typeConfig.kind === 'Mutation' || typeConfig.kind === 'Subscription') { | ||
]; | ||
} | ||
}); | ||
} | ||
@@ -254,9 +251,5 @@ addFieldRef(ref, // We need to be able to resolve the types kind before configuring the field | ||
this.pending = false; | ||
const fns = this.addFieldFns; | ||
const interfaces = this.pendingInterfaces; | ||
const unions = this.pendingUnionTypes; | ||
this.addFieldFns = []; | ||
this.pendingInterfaces = new Map(); | ||
this.pendingUnionTypes = new Map(); | ||
fns.forEach((fn)=>void fn()); | ||
const { pendingActions } = this; | ||
this.pendingActions = []; | ||
pendingActions.forEach((fn)=>void fn()); | ||
if (this.pendingRefResolutions.size > 0) { | ||
@@ -267,22 +260,15 @@ throw new _errors.PothosSchemaError(`Missing implementations for some references (${[ | ||
} | ||
for (const [typeName, unionFns] of unions){ | ||
for (const fn of unionFns){ | ||
this.addUnionTypes(typeName, fn); | ||
} | ||
} | ||
for (const [typeName, interfacesFns] of interfaces){ | ||
for (const fn of interfacesFns){ | ||
this.addInterfaces(typeName, fn); | ||
} | ||
} | ||
} | ||
addFields(typeRef, fields) { | ||
onPrepare(cb) { | ||
if (this.pending) { | ||
this.addFieldFns.push(()=>void this.addFields(typeRef, fields)); | ||
this.pendingActions.push(cb); | ||
} else { | ||
this.onTypeConfig(typeRef, (config)=>{ | ||
this.buildFields(typeRef, typeof fields === 'function' ? fields() : fields); | ||
}); | ||
cb(); | ||
} | ||
} | ||
addFields(typeRef, fields) { | ||
this.onPrepare(()=>void this.onTypeConfig(typeRef, (config)=>{ | ||
this.buildFields(typeRef, typeof fields === 'function' ? fields() : fields); | ||
})); | ||
} | ||
getImplementers(ref) { | ||
@@ -344,15 +330,13 @@ const typeConfig = this.getTypeConfig(ref, 'Interface'); | ||
constructor(){ | ||
this.typeConfigs = new Map(); | ||
this.fieldRefs = new WeakMap(); | ||
this.fields = new Map(); | ||
this.addFieldFns = []; | ||
this.refsToName = new Map(); | ||
this.scalarsToRefs = new Map(); | ||
this.fieldRefsToConfigs = new Map(); | ||
this.pendingFields = new Map(); | ||
this.pendingInterfaces = new Map(); | ||
this.pendingUnionTypes = new Map(); | ||
this.pendingRefResolutions = new Map(); | ||
this.fieldRefCallbacks = new Map(); | ||
this.pending = true; | ||
_defineProperty(this, "typeConfigs", new Map()); | ||
_defineProperty(this, "fieldRefs", new WeakMap()); | ||
_defineProperty(this, "fields", new Map()); | ||
_defineProperty(this, "pendingActions", []); | ||
_defineProperty(this, "refsToName", new Map()); | ||
_defineProperty(this, "scalarsToRefs", new Map()); | ||
_defineProperty(this, "fieldRefsToConfigs", new Map()); | ||
_defineProperty(this, "pendingFields", new Map()); | ||
_defineProperty(this, "pendingRefResolutions", new Map()); | ||
_defineProperty(this, "fieldRefCallbacks", new Map()); | ||
_defineProperty(this, "pending", true); | ||
const scalars = [ | ||
@@ -359,0 +343,0 @@ _graphql.GraphQLID, |
@@ -13,2 +13,15 @@ "use strict"; | ||
const _utils = require("../utils"); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -74,2 +87,6 @@ return obj && obj.__esModule ? obj : { | ||
constructor(name, builder, kind, graphqlKind){ | ||
_defineProperty(this, "typename", void 0); | ||
_defineProperty(this, "builder", void 0); | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, "graphqlKind", void 0); | ||
this.typename = name; | ||
@@ -76,0 +93,0 @@ this.builder = builder; |
@@ -12,2 +12,15 @@ "use strict"; | ||
const _utils = require("../utils"); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -61,56 +74,59 @@ return obj && obj.__esModule ? obj : { | ||
constructor(builder, kind, typename){ | ||
_defineProperty(this, "builder", void 0); | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, "typename", void 0); | ||
/** | ||
* Create a Boolean input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.boolean = this.helper('Boolean'); | ||
*/ _defineProperty(this, "boolean", this.helper('Boolean')); | ||
/** | ||
* Create a Float input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.float = this.helper('Float'); | ||
*/ _defineProperty(this, "float", this.helper('Float')); | ||
/** | ||
* Create a ID input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.id = this.helper('ID'); | ||
*/ _defineProperty(this, "id", this.helper('ID')); | ||
/** | ||
* Create a Int input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.int = this.helper('Int'); | ||
*/ _defineProperty(this, "int", this.helper('Int')); | ||
/** | ||
* Create a String input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.string = this.helper('String'); | ||
*/ _defineProperty(this, "string", this.helper('String')); | ||
/** | ||
* Create a Boolean list input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.booleanList = this.helper([ | ||
*/ _defineProperty(this, "booleanList", this.helper([ | ||
'Boolean' | ||
]); | ||
])); | ||
/** | ||
* Create a Float list input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.floatList = this.helper([ | ||
*/ _defineProperty(this, "floatList", this.helper([ | ||
'Float' | ||
]); | ||
])); | ||
/** | ||
* Create a ID list input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.idList = this.helper([ | ||
*/ _defineProperty(this, "idList", this.helper([ | ||
'ID' | ||
]); | ||
])); | ||
/** | ||
* Create a Int list input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.intList = this.helper([ | ||
*/ _defineProperty(this, "intList", this.helper([ | ||
'Int' | ||
]); | ||
])); | ||
/** | ||
* Create a String list input field | ||
* @param {PothosSchemaTypes.InputFieldOptions} [options={}] - Options for this field | ||
*/ this.stringList = this.helper([ | ||
*/ _defineProperty(this, "stringList", this.helper([ | ||
'String' | ||
]); | ||
])); | ||
var _options_required; | ||
this.listRef = (type, options)=>{ | ||
_defineProperty(this, "listRef", (type, options)=>{ | ||
return new _inputList.default(type, (_options_required = options === null || options === void 0 ? void 0 : options.required) !== null && _options_required !== void 0 ? _options_required : true); | ||
}; | ||
}); | ||
this.builder = builder; | ||
@@ -117,0 +133,0 @@ this.kind = kind; |
@@ -12,2 +12,15 @@ "use strict"; | ||
const _input = /*#__PURE__*/ _interopRequireDefault(require("./input")); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -151,3 +164,3 @@ return obj && obj.__esModule ? obj : { | ||
super(...args); | ||
this.arg = new _input.default(this.builder, 'Arg', this.typename).argBuilder(); | ||
_defineProperty(this, "arg", new _input.default(this.builder, 'Arg', this.typename).argBuilder()); | ||
} | ||
@@ -154,0 +167,0 @@ } |
@@ -10,2 +10,15 @@ "use strict"; | ||
const _plugin = require("./plugin"); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
class MergedPlugins extends _plugin.BasePlugin { | ||
@@ -46,2 +59,3 @@ onTypeConfig(typeConfig) { | ||
super(buildCache, 'PothosMergedPlugin'); | ||
_defineProperty(this, "plugins", void 0); | ||
this.plugins = plugins; | ||
@@ -48,0 +62,0 @@ } |
@@ -11,2 +11,15 @@ "use strict"; | ||
const _contextCache = require("../utils/context-cache"); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
const runCache = new WeakMap(); | ||
@@ -110,3 +123,7 @@ class BasePlugin { | ||
constructor(buildCache, name){ | ||
this.requestDataMap = (0, _contextCache.createContextCache)((ctx)=>this.createRequestData(ctx)); | ||
_defineProperty(this, "name", void 0); | ||
_defineProperty(this, "builder", void 0); | ||
_defineProperty(this, "buildCache", void 0); | ||
_defineProperty(this, "options", void 0); | ||
_defineProperty(this, "requestDataMap", (0, _contextCache.createContextCache)((ctx)=>this.createRequestData(ctx))); | ||
this.name = name; | ||
@@ -113,0 +130,0 @@ this.builder = buildCache.builder; |
@@ -9,2 +9,15 @@ "use strict"; | ||
}); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
class BaseTypeRef { | ||
@@ -15,2 +28,4 @@ toString() { | ||
constructor(kind, name){ | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, "name", void 0); | ||
this.kind = kind; | ||
@@ -17,0 +32,0 @@ this.name = name; |
@@ -10,2 +10,15 @@ "use strict"; | ||
const _scalar = /*#__PURE__*/ _interopRequireDefault(require("./scalar")); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -19,2 +32,3 @@ return obj && obj.__esModule ? obj : { | ||
super(type.name); | ||
_defineProperty(this, "type", void 0); | ||
this.type = type; | ||
@@ -21,0 +35,0 @@ } |
@@ -11,2 +11,15 @@ "use strict"; | ||
const _base = /*#__PURE__*/ _interopRequireDefault(require("./base")); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -17,6 +30,9 @@ return obj && obj.__esModule ? obj : { | ||
} | ||
let _outputShapeKey = _types.outputShapeKey, _inputShapeKey = _types.inputShapeKey; | ||
class EnumRef extends _base.default { | ||
constructor(name){ | ||
super('Enum', name); | ||
this.kind = 'Enum'; | ||
_defineProperty(this, "kind", 'Enum'); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _inputShapeKey, void 0); | ||
} | ||
@@ -23,0 +39,0 @@ } |
@@ -10,2 +10,16 @@ "use strict"; | ||
const _types = require("../types"); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
let _outputFieldShapeKey = _types.outputFieldShapeKey; | ||
class FieldRef { | ||
@@ -19,2 +33,6 @@ toString() { | ||
constructor(kind, parentTypename){ | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, "parentTypename", void 0); | ||
_defineProperty(this, "fieldName", void 0); | ||
_defineProperty(this, _outputFieldShapeKey, void 0); | ||
this.kind = kind; | ||
@@ -21,0 +39,0 @@ this.parentTypename = parentTypename; |
@@ -10,2 +10,16 @@ "use strict"; | ||
const _types = require("../types"); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
let _inputFieldShapeKey = _types.inputFieldShapeKey; | ||
class InputFieldRef { | ||
@@ -27,2 +41,7 @@ toString() { | ||
constructor(kind, parentTypename){ | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, "parentTypename", void 0); | ||
_defineProperty(this, "fieldName", void 0); | ||
_defineProperty(this, "argFor", void 0); | ||
_defineProperty(this, _inputFieldShapeKey, void 0); | ||
this.kind = kind; | ||
@@ -29,0 +48,0 @@ this.parentTypename = parentTypename; |
@@ -11,2 +11,15 @@ "use strict"; | ||
const _base = /*#__PURE__*/ _interopRequireDefault(require("./base")); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -17,6 +30,10 @@ return obj && obj.__esModule ? obj : { | ||
} | ||
let _inputShapeKey = _types.inputShapeKey; | ||
class InputObjectRef extends _base.default { | ||
constructor(listType, required){ | ||
super('InputList', `InputList<${String(listType)}>`); | ||
this.kind = 'InputList'; | ||
_defineProperty(this, "kind", 'InputList'); | ||
_defineProperty(this, _inputShapeKey, void 0); | ||
_defineProperty(this, "listType", void 0); | ||
_defineProperty(this, "required", void 0); | ||
this.listType = listType; | ||
@@ -23,0 +40,0 @@ this.required = required; |
@@ -17,2 +17,15 @@ /* eslint-disable max-classes-per-file */ "use strict"; | ||
const _base = /*#__PURE__*/ _interopRequireDefault(require("./base")); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -23,6 +36,8 @@ return obj && obj.__esModule ? obj : { | ||
} | ||
let _inputShapeKey = _types.inputShapeKey; | ||
class InputObjectRef extends _base.default { | ||
constructor(name){ | ||
super('InputObject', name); | ||
this.kind = 'InputObject'; | ||
_defineProperty(this, "kind", 'InputObject'); | ||
_defineProperty(this, _inputShapeKey, void 0); | ||
} | ||
@@ -37,2 +52,3 @@ } | ||
super(name); | ||
_defineProperty(this, "builder", void 0); | ||
this.builder = builder; | ||
@@ -39,0 +55,0 @@ } |
@@ -11,2 +11,15 @@ "use strict"; | ||
const _base = /*#__PURE__*/ _interopRequireDefault(require("./base")); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -17,5 +30,8 @@ return obj && obj.__esModule ? obj : { | ||
} | ||
let _inputShapeKey = _types.inputShapeKey; | ||
class InputTypeRef extends _base.default { | ||
constructor(kind, name){ | ||
super(kind, name); | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, _inputShapeKey, void 0); | ||
this.kind = kind; | ||
@@ -22,0 +38,0 @@ } |
@@ -17,2 +17,15 @@ /* eslint-disable max-classes-per-file */ "use strict"; | ||
const _base = /*#__PURE__*/ _interopRequireDefault(require("./base")); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -23,6 +36,9 @@ return obj && obj.__esModule ? obj : { | ||
} | ||
let _outputShapeKey = _types.outputShapeKey, _parentShapeKey = _types.parentShapeKey; | ||
class InterfaceRef extends _base.default { | ||
constructor(name){ | ||
super('Interface', name); | ||
this.kind = 'Interface'; | ||
_defineProperty(this, "kind", 'Interface'); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _parentShapeKey, void 0); | ||
} | ||
@@ -36,2 +52,3 @@ } | ||
super(name); | ||
_defineProperty(this, "builder", void 0); | ||
this.builder = builder; | ||
@@ -38,0 +55,0 @@ } |
@@ -11,2 +11,15 @@ "use strict"; | ||
const _base = /*#__PURE__*/ _interopRequireDefault(require("./base")); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -17,6 +30,11 @@ return obj && obj.__esModule ? obj : { | ||
} | ||
let _outputShapeKey = _types.outputShapeKey, _parentShapeKey = _types.parentShapeKey; | ||
class ListRef extends _base.default { | ||
constructor(listType, nullable){ | ||
super('List', `List<${String(listType)}>`); | ||
this.kind = 'List'; | ||
_defineProperty(this, "kind", 'List'); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _parentShapeKey, void 0); | ||
_defineProperty(this, "listType", void 0); | ||
_defineProperty(this, "nullable", void 0); | ||
this.listType = listType; | ||
@@ -23,0 +41,0 @@ this.nullable = nullable; |
@@ -17,2 +17,15 @@ /* eslint-disable max-classes-per-file */ "use strict"; | ||
const _base = /*#__PURE__*/ _interopRequireDefault(require("./base")); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -23,6 +36,9 @@ return obj && obj.__esModule ? obj : { | ||
} | ||
let _outputShapeKey = _types.outputShapeKey, _parentShapeKey = _types.parentShapeKey; | ||
class ObjectRef extends _base.default { | ||
constructor(name){ | ||
super('Object', name); | ||
this.kind = 'Object'; | ||
_defineProperty(this, "kind", 'Object'); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _parentShapeKey, void 0); | ||
} | ||
@@ -36,2 +52,3 @@ } | ||
super(name); | ||
_defineProperty(this, "builder", void 0); | ||
this.builder = builder; | ||
@@ -38,0 +55,0 @@ } |
@@ -11,2 +11,15 @@ "use strict"; | ||
const _base = /*#__PURE__*/ _interopRequireDefault(require("./base")); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -17,5 +30,9 @@ return obj && obj.__esModule ? obj : { | ||
} | ||
let _outputShapeKey = _types.outputShapeKey, _parentShapeKey = _types.parentShapeKey; | ||
class OutputTypeRef extends _base.default { | ||
constructor(kind, name){ | ||
super(kind, name); | ||
_defineProperty(this, "kind", void 0); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _parentShapeKey, void 0); | ||
this.kind = kind; | ||
@@ -22,0 +39,0 @@ } |
@@ -11,2 +11,15 @@ "use strict"; | ||
const _base = /*#__PURE__*/ _interopRequireDefault(require("./base")); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -17,6 +30,10 @@ return obj && obj.__esModule ? obj : { | ||
} | ||
let _outputShapeKey = _types.outputShapeKey, _parentShapeKey = _types.parentShapeKey, _inputShapeKey = _types.inputShapeKey; | ||
class ScalarRef extends _base.default { | ||
constructor(name){ | ||
super('Scalar', name); | ||
this.kind = 'Scalar'; | ||
_defineProperty(this, "kind", 'Scalar'); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _parentShapeKey, void 0); | ||
_defineProperty(this, _inputShapeKey, void 0); | ||
} | ||
@@ -23,0 +40,0 @@ } |
@@ -11,2 +11,15 @@ "use strict"; | ||
const _base = /*#__PURE__*/ _interopRequireDefault(require("./base")); | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function _interopRequireDefault(obj) { | ||
@@ -17,6 +30,9 @@ return obj && obj.__esModule ? obj : { | ||
} | ||
let _outputShapeKey = _typeParams.outputShapeKey, _parentShapeKey = _typeParams.parentShapeKey; | ||
class UnionRef extends _base.default { | ||
constructor(name){ | ||
super('Union', name); | ||
this.kind = 'Union'; | ||
_defineProperty(this, "kind", 'Union'); | ||
_defineProperty(this, _outputShapeKey, void 0); | ||
_defineProperty(this, _parentShapeKey, void 0); | ||
} | ||
@@ -23,0 +39,0 @@ } |
{ | ||
"name": "@pothos/core", | ||
"version": "3.28.0", | ||
"version": "3.29.0", | ||
"description": "Pothos (formerly GiraphQL) is a plugin based schema builder for creating code-first GraphQL schemas in typescript", | ||
@@ -41,6 +41,6 @@ "main": "./lib/index.js", | ||
"devDependencies": { | ||
"@pothos/test-utils": "1.4.7", | ||
"graphql": "16.6.0", | ||
"graphql-scalars": "^1.20.1", | ||
"graphql-tag": "^2.12.6", | ||
"@pothos/test-utils": "1.4.7" | ||
"graphql-scalars": "^1.20.4", | ||
"graphql-tag": "^2.12.6" | ||
}, | ||
@@ -47,0 +47,0 @@ "gitHead": "9dfe52f1975f41a111e01bf96a20033a914e2acc", |
@@ -54,3 +54,3 @@ /* eslint-disable @typescript-eslint/no-redundant-type-constituents */ | ||
private addFieldFns: (() => void)[] = []; | ||
private pendingActions: (() => void)[] = []; | ||
@@ -65,6 +65,2 @@ private refsToName = new Map<ConfigurableRef<Types>, string>(); | ||
private pendingInterfaces = new Map<string, (() => InterfaceParam<Types>[])[]>(); | ||
private pendingUnionTypes = new Map<string, (() => ObjectParam<Types>[])[]>(); | ||
private pendingRefResolutions = new Map< | ||
@@ -107,9 +103,3 @@ ConfigurableRef<Types>, | ||
addUnionTypes(typeName: string, unionTypes: ObjectParam<Types>[] | (() => ObjectParam<Types>[])) { | ||
if (typeof unionTypes === 'function' && this.pending) { | ||
if (this.pendingUnionTypes.has(typeName)) { | ||
this.pendingUnionTypes.get(typeName)!.push(unionTypes); | ||
} else { | ||
this.pendingUnionTypes.set(typeName, [unionTypes]); | ||
} | ||
} else { | ||
this.onPrepare(() => { | ||
const typeConfig = this.getTypeConfig(typeName); | ||
@@ -129,3 +119,3 @@ | ||
]; | ||
} | ||
}); | ||
} | ||
@@ -137,9 +127,3 @@ | ||
) { | ||
if (typeof interfaces === 'function' && this.pending) { | ||
if (this.pendingInterfaces.has(typeName)) { | ||
this.pendingInterfaces.get(typeName)!.push(interfaces); | ||
} else { | ||
this.pendingInterfaces.set(typeName, [interfaces]); | ||
} | ||
} else { | ||
this.onPrepare(() => { | ||
const typeConfig = this.getTypeConfig(typeName); | ||
@@ -164,3 +148,3 @@ | ||
]; | ||
} | ||
}); | ||
} | ||
@@ -451,11 +435,7 @@ | ||
const fns = this.addFieldFns; | ||
const interfaces = this.pendingInterfaces; | ||
const unions = this.pendingUnionTypes; | ||
const { pendingActions } = this; | ||
this.addFieldFns = []; | ||
this.pendingInterfaces = new Map(); | ||
this.pendingUnionTypes = new Map(); | ||
this.pendingActions = []; | ||
fns.forEach((fn) => void fn()); | ||
pendingActions.forEach((fn) => void fn()); | ||
@@ -469,14 +449,10 @@ if (this.pendingRefResolutions.size > 0) { | ||
} | ||
} | ||
for (const [typeName, unionFns] of unions) { | ||
for (const fn of unionFns) { | ||
this.addUnionTypes(typeName, fn); | ||
} | ||
onPrepare(cb: () => void) { | ||
if (this.pending) { | ||
this.pendingActions.push(cb); | ||
} else { | ||
cb(); | ||
} | ||
for (const [typeName, interfacesFns] of interfaces) { | ||
for (const fn of interfacesFns) { | ||
this.addInterfaces(typeName, fn); | ||
} | ||
} | ||
} | ||
@@ -488,9 +464,8 @@ | ||
) { | ||
if (this.pending) { | ||
this.addFieldFns.push(() => void this.addFields(typeRef, fields)); | ||
} else { | ||
this.onTypeConfig(typeRef, (config) => { | ||
this.buildFields(typeRef, typeof fields === 'function' ? fields() : fields); | ||
}); | ||
} | ||
this.onPrepare( | ||
() => | ||
void this.onTypeConfig(typeRef, (config) => { | ||
this.buildFields(typeRef, typeof fields === 'function' ? fields() : fields); | ||
}), | ||
); | ||
} | ||
@@ -497,0 +472,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1045228
15460