@pothos/core
Advanced tools
Comparing version 3.19.1 to 3.20.0
# Change Log | ||
## 3.20.0 | ||
### Minor Changes | ||
- d67764b5: Make options objecst on toSchema, queryType, and mutationType optional | ||
## 3.19.1 | ||
@@ -4,0 +10,0 @@ |
@@ -9,3 +9,3 @@ import { GraphQLScalarSerializer, GraphQLScalarType, GraphQLSchema } from 'graphql'; | ||
import UnionRef from './refs/union'; | ||
import type { AbstractReturnShape, BaseEnum, EnumParam, EnumTypeOptions, EnumValues, InputFieldMap, InputFieldsFromShape, InputShape, InputShapeFromFields, InterfaceFieldsShape, InterfaceFieldThunk, InterfaceParam, InterfaceTypeOptions, MutationFieldsShape, MutationFieldThunk, NormalizeSchemeBuilderOptions, ObjectFieldsShape, ObjectFieldThunk, ObjectParam, ObjectTypeOptions, OutputShape, ParentShape, PluginConstructorMap, QueryFieldsShape, QueryFieldThunk, ScalarName, SchemaTypes, ShapeFromEnumValues, SubscriptionFieldsShape, SubscriptionFieldThunk, ValuesFromEnum } from './types'; | ||
import type { AbstractReturnShape, BaseEnum, EnumParam, EnumTypeOptions, EnumValues, InputFieldMap, InputFieldsFromShape, InputShape, InputShapeFromFields, InterfaceFieldsShape, InterfaceFieldThunk, InterfaceParam, InterfaceTypeOptions, MutationFieldsShape, MutationFieldThunk, NormalizeArgs, NormalizeSchemeBuilderOptions, ObjectFieldsShape, ObjectFieldThunk, ObjectParam, ObjectTypeOptions, OutputShape, ParentShape, PluginConstructorMap, QueryFieldsShape, QueryFieldThunk, ScalarName, SchemaTypes, ShapeFromEnumValues, SubscriptionFieldsShape, SubscriptionFieldThunk, ValuesFromEnum } from './types'; | ||
export default class SchemaBuilder<Types extends SchemaTypes> { | ||
@@ -23,9 +23,18 @@ static plugins: Partial<PluginConstructorMap<SchemaTypes>>; | ||
objectField<Type extends ObjectParam<Types>>(ref: Type, fieldName: string, field: ObjectFieldThunk<Types, ParentShape<Types, Type>>): void; | ||
queryType(options: PothosSchemaTypes.QueryTypeOptions<Types>, fields?: QueryFieldsShape<Types>): void; | ||
queryType(...args: NormalizeArgs<[ | ||
options?: PothosSchemaTypes.QueryTypeOptions<Types>, | ||
fields?: QueryFieldsShape<Types> | ||
]>): void; | ||
queryFields(fields: QueryFieldsShape<Types>): void; | ||
queryField(name: string, field: QueryFieldThunk<Types>): void; | ||
mutationType(options: PothosSchemaTypes.MutationTypeOptions<Types>, fields?: MutationFieldsShape<Types>): void; | ||
mutationType(...args: NormalizeArgs<[ | ||
options?: PothosSchemaTypes.MutationTypeOptions<Types>, | ||
fields?: MutationFieldsShape<Types> | ||
]>): void; | ||
mutationFields(fields: MutationFieldsShape<Types>): void; | ||
mutationField(name: string, field: MutationFieldThunk<Types>): void; | ||
subscriptionType(options: PothosSchemaTypes.SubscriptionTypeOptions<Types>, fields?: SubscriptionFieldsShape<Types>): void; | ||
subscriptionType(...args: NormalizeArgs<[ | ||
options?: PothosSchemaTypes.SubscriptionTypeOptions<Types>, | ||
fields?: SubscriptionFieldsShape<Types> | ||
]>): void; | ||
subscriptionFields(fields: SubscriptionFieldsShape<Types>): void; | ||
@@ -47,4 +56,4 @@ subscriptionField(name: string, field: SubscriptionFieldThunk<Types>): void; | ||
interfaceRef<T>(name: string): ImplementableInterfaceRef<Types, T>; | ||
toSchema(options: PothosSchemaTypes.BuildSchemaOptions<Types>): GraphQLSchema; | ||
toSchema(...args: NormalizeArgs<[options?: PothosSchemaTypes.BuildSchemaOptions<Types>]>): GraphQLSchema; | ||
} | ||
//# sourceMappingURL=builder.d.ts.map |
@@ -76,3 +76,4 @@ import { GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt, GraphQLSchema, GraphQLString, lexicographicSortSchema } from 'graphql'; | ||
} | ||
queryType(options, fields) { | ||
queryType(...args) { | ||
const [options = {}, fields] = args; | ||
const config = { | ||
@@ -102,3 +103,4 @@ kind: "Query", | ||
} | ||
mutationType(options, fields) { | ||
mutationType(...args) { | ||
const [options = {}, fields] = args; | ||
const config = { | ||
@@ -128,3 +130,4 @@ kind: "Mutation", | ||
} | ||
subscriptionType(options, fields) { | ||
subscriptionType(...args) { | ||
const [options = {}, fields] = args; | ||
const config = { | ||
@@ -294,3 +297,4 @@ kind: "Subscription", | ||
} | ||
toSchema(options) { | ||
toSchema(...args) { | ||
const [options = {}] = args; | ||
const { directives, extensions } = options; | ||
@@ -297,0 +301,0 @@ const scalars = [ |
@@ -128,3 +128,4 @@ "use strict"; | ||
} | ||
queryType(options, fields) { | ||
queryType(...args) { | ||
const [options = {}, fields] = args; | ||
const config = { | ||
@@ -154,3 +155,4 @@ kind: 'Query', | ||
} | ||
mutationType(options, fields) { | ||
mutationType(...args) { | ||
const [options = {}, fields] = args; | ||
const config = { | ||
@@ -180,3 +182,4 @@ kind: 'Mutation', | ||
} | ||
subscriptionType(options, fields) { | ||
subscriptionType(...args) { | ||
const [options = {}, fields] = args; | ||
const config = { | ||
@@ -346,3 +349,4 @@ kind: 'Subscription', | ||
} | ||
toSchema(options) { | ||
toSchema(...args) { | ||
const [options = {}] = args; | ||
const { directives , extensions } = options; | ||
@@ -349,0 +353,0 @@ const scalars = [ |
{ | ||
"name": "@pothos/core", | ||
"version": "3.19.1", | ||
"version": "3.20.0", | ||
"description": "Pothos (formerly GiraphQL) is a plugin based schema builder for creating code-first GraphQL schemas in typescript", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -38,3 +38,3 @@  | ||
const server = createServer({ | ||
schema: builder.toSchema({}), | ||
schema: builder.toSchema(), | ||
}); | ||
@@ -41,0 +41,0 @@ |
@@ -46,2 +46,3 @@ import { | ||
MutationFieldThunk, | ||
NormalizeArgs, | ||
NormalizeSchemeBuilderOptions, | ||
@@ -203,3 +204,8 @@ ObjectFieldsShape, | ||
queryType(options: PothosSchemaTypes.QueryTypeOptions<Types>, fields?: QueryFieldsShape<Types>) { | ||
queryType( | ||
...args: NormalizeArgs< | ||
[options?: PothosSchemaTypes.QueryTypeOptions<Types>, fields?: QueryFieldsShape<Types>] | ||
> | ||
) { | ||
const [options = {}, fields] = args; | ||
const config: PothosQueryTypeConfig = { | ||
@@ -236,5 +242,7 @@ kind: 'Query', | ||
mutationType( | ||
options: PothosSchemaTypes.MutationTypeOptions<Types>, | ||
fields?: MutationFieldsShape<Types>, | ||
...args: NormalizeArgs< | ||
[options?: PothosSchemaTypes.MutationTypeOptions<Types>, fields?: MutationFieldsShape<Types>] | ||
> | ||
) { | ||
const [options = {}, fields] = args; | ||
const config: PothosMutationTypeConfig = { | ||
@@ -271,5 +279,10 @@ kind: 'Mutation', | ||
subscriptionType( | ||
options: PothosSchemaTypes.SubscriptionTypeOptions<Types>, | ||
fields?: SubscriptionFieldsShape<Types>, | ||
...args: NormalizeArgs< | ||
[ | ||
options?: PothosSchemaTypes.SubscriptionTypeOptions<Types>, | ||
fields?: SubscriptionFieldsShape<Types>, | ||
] | ||
> | ||
) { | ||
const [options = {}, fields] = args; | ||
const config: PothosSubscriptionTypeConfig = { | ||
@@ -560,3 +573,4 @@ kind: 'Subscription', | ||
toSchema(options: PothosSchemaTypes.BuildSchemaOptions<Types>) { | ||
toSchema(...args: NormalizeArgs<[options?: PothosSchemaTypes.BuildSchemaOptions<Types>]>) { | ||
const [options = {}] = args; | ||
const { directives, extensions } = options; | ||
@@ -563,0 +577,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
867810
12019