@pothos/plugin-simple-objects
Advanced tools
Comparing version 4.0.0 to 4.0.1
# Change Log | ||
## 4.0.1 | ||
### Patch Changes | ||
- d4f7705: Allow extending interfaces without re-defining all fields | ||
## 4.0.0 | ||
@@ -4,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { FieldMap, FieldNullability, InputFieldMap, InterfaceFieldsShape, InterfaceParam, Normalize, ObjectFieldsShape, ParentShape, SchemaTypes, TypeParam } from '@pothos/core'; | ||
import { FieldMap, FieldNullability, InputFieldMap, InterfaceFieldsShape, InterfaceParam, Normalize, ObjectFieldsShape, ParentShape, SchemaTypes, TypeParam, UnionToIntersection } from '@pothos/core'; | ||
import { OutputShapeFromFields, SimpleObjectFieldsShape } from './types'; | ||
@@ -10,4 +10,4 @@ import type { PothosSimpleObjectsPlugin } from '.'; | ||
interface SchemaBuilder<Types extends SchemaTypes> { | ||
simpleObject: <Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape extends Normalize<OutputShapeFromFields<Fields> & ParentShape<Types, Interfaces[number]>>>(name: string, options: SimpleObjectTypeOptions<Types, Interfaces, Fields, Shape>, fields?: ObjectFieldsShape<Types, Shape>) => ObjectRef<Types, Shape>; | ||
simpleInterface: <Fields extends FieldMap, Shape extends OutputShapeFromFields<Fields>, Interfaces extends InterfaceParam<Types>[]>(name: string, options: SimpleInterfaceTypeOptions<Types, Fields, Shape, Interfaces>, fields?: InterfaceFieldsShape<Types, Shape>) => InterfaceRef<Types, Shape>; | ||
simpleObject: <Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape extends Normalize<OutputShapeFromFields<Fields> & UnionToIntersection<ParentShape<Types, Interfaces[number]>>>>(name: string, options: SimpleObjectTypeOptions<Types, Interfaces, Fields, Shape>, fields?: ObjectFieldsShape<Types, Shape>) => ObjectRef<Types, Shape>; | ||
simpleInterface: <Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape extends Normalize<OutputShapeFromFields<Fields> & UnionToIntersection<ParentShape<Types, Interfaces[number]>>>>(name: string, options: SimpleInterfaceTypeOptions<Types, Interfaces, Fields, Shape>, fields?: InterfaceFieldsShape<Types, Shape>) => InterfaceRef<Types, Shape>; | ||
} | ||
@@ -22,6 +22,8 @@ interface PothosKindToGraphQLType { | ||
} | ||
type SimpleObjectTypeOptions<Types extends SchemaTypes, Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape> = Omit<ObjectTypeOptions<Types, Shape> | ObjectTypeWithInterfaceOptions<Types, Shape, Interfaces>, 'fields'> & { | ||
type SimpleObjectTypeOptions<Types extends SchemaTypes, Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape> = Omit<ObjectTypeOptions<Types, Shape> | ObjectTypeWithInterfaceOptions<Types, Shape, Interfaces>, 'fields' | 'interfaces'> & { | ||
interfaces?: (() => Interfaces) | Interfaces; | ||
fields?: SimpleObjectFieldsShape<Types, Fields>; | ||
}; | ||
interface SimpleInterfaceTypeOptions<Types extends SchemaTypes, Fields extends FieldMap, Shape extends OutputShapeFromFields<Fields>, Interfaces extends InterfaceParam<Types>[]> extends Omit<InterfaceTypeOptions<Types, Shape, Interfaces>, 'args' | 'fields'> { | ||
interface SimpleInterfaceTypeOptions<Types extends SchemaTypes, Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape> extends Omit<InterfaceTypeOptions<Types, Shape, Interfaces>, 'fields' | 'interfaces'> { | ||
interfaces?: (() => Interfaces) | Interfaces; | ||
fields?: SimpleObjectFieldsShape<Types, Fields>; | ||
@@ -28,0 +30,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { FieldMap, FieldNullability, InputFieldMap, InterfaceFieldsShape, InterfaceParam, Normalize, ObjectFieldsShape, ParentShape, SchemaTypes, TypeParam } from '@pothos/core'; | ||
import { FieldMap, FieldNullability, InputFieldMap, InterfaceFieldsShape, InterfaceParam, Normalize, ObjectFieldsShape, ParentShape, SchemaTypes, TypeParam, UnionToIntersection } from '@pothos/core'; | ||
import { OutputShapeFromFields, SimpleObjectFieldsShape } from './types.js'; | ||
@@ -10,4 +10,4 @@ import type { PothosSimpleObjectsPlugin } from './index.js'; | ||
interface SchemaBuilder<Types extends SchemaTypes> { | ||
simpleObject: <Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape extends Normalize<OutputShapeFromFields<Fields> & ParentShape<Types, Interfaces[number]>>>(name: string, options: SimpleObjectTypeOptions<Types, Interfaces, Fields, Shape>, fields?: ObjectFieldsShape<Types, Shape>) => ObjectRef<Types, Shape>; | ||
simpleInterface: <Fields extends FieldMap, Shape extends OutputShapeFromFields<Fields>, Interfaces extends InterfaceParam<Types>[]>(name: string, options: SimpleInterfaceTypeOptions<Types, Fields, Shape, Interfaces>, fields?: InterfaceFieldsShape<Types, Shape>) => InterfaceRef<Types, Shape>; | ||
simpleObject: <Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape extends Normalize<OutputShapeFromFields<Fields> & UnionToIntersection<ParentShape<Types, Interfaces[number]>>>>(name: string, options: SimpleObjectTypeOptions<Types, Interfaces, Fields, Shape>, fields?: ObjectFieldsShape<Types, Shape>) => ObjectRef<Types, Shape>; | ||
simpleInterface: <Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape extends Normalize<OutputShapeFromFields<Fields> & UnionToIntersection<ParentShape<Types, Interfaces[number]>>>>(name: string, options: SimpleInterfaceTypeOptions<Types, Interfaces, Fields, Shape>, fields?: InterfaceFieldsShape<Types, Shape>) => InterfaceRef<Types, Shape>; | ||
} | ||
@@ -22,6 +22,8 @@ interface PothosKindToGraphQLType { | ||
} | ||
type SimpleObjectTypeOptions<Types extends SchemaTypes, Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape> = Omit<ObjectTypeOptions<Types, Shape> | ObjectTypeWithInterfaceOptions<Types, Shape, Interfaces>, "fields"> & { | ||
type SimpleObjectTypeOptions<Types extends SchemaTypes, Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape> = Omit<ObjectTypeOptions<Types, Shape> | ObjectTypeWithInterfaceOptions<Types, Shape, Interfaces>, "fields" | "interfaces"> & { | ||
interfaces?: (() => Interfaces) | Interfaces; | ||
fields?: SimpleObjectFieldsShape<Types, Fields>; | ||
}; | ||
interface SimpleInterfaceTypeOptions<Types extends SchemaTypes, Fields extends FieldMap, Shape extends OutputShapeFromFields<Fields>, Interfaces extends InterfaceParam<Types>[]> extends Omit<InterfaceTypeOptions<Types, Shape, Interfaces>, "args" | "fields"> { | ||
interface SimpleInterfaceTypeOptions<Types extends SchemaTypes, Interfaces extends InterfaceParam<Types>[], Fields extends FieldMap, Shape> extends Omit<InterfaceTypeOptions<Types, Shape, Interfaces>, "fields" | "interfaces"> { | ||
interfaces?: (() => Interfaces) | Interfaces; | ||
fields?: SimpleObjectFieldsShape<Types, Fields>; | ||
@@ -28,0 +30,0 @@ } |
{ | ||
"name": "@pothos/plugin-simple-objects", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "A Pothos plugin for defining objects and interfaces without ts definitions for those types", | ||
@@ -45,4 +45,4 @@ "main": "./lib/index.js", | ||
"graphql-tag": "^2.12.6", | ||
"@pothos/core": "4.0.0", | ||
"@pothos/test-utils": "2.0.0" | ||
"@pothos/test-utils": "2.0.0", | ||
"@pothos/core": "4.0.0" | ||
}, | ||
@@ -49,0 +49,0 @@ "gitHead": "9dfe52f1975f41a111e01bf96a20033a914e2acc", |
@@ -13,2 +13,3 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
TypeParam, | ||
UnionToIntersection, | ||
} from '@pothos/core'; | ||
@@ -29,3 +30,4 @@ import { OutputShapeFromFields, SimpleObjectFieldsShape } from './types'; | ||
Shape extends Normalize< | ||
OutputShapeFromFields<Fields> & ParentShape<Types, Interfaces[number]> | ||
OutputShapeFromFields<Fields> & | ||
UnionToIntersection<ParentShape<Types, Interfaces[number]>> | ||
>, | ||
@@ -39,8 +41,11 @@ >( | ||
simpleInterface: < | ||
Interfaces extends InterfaceParam<Types>[], | ||
Fields extends FieldMap, | ||
Shape extends OutputShapeFromFields<Fields>, | ||
Interfaces extends InterfaceParam<Types>[], | ||
Shape extends Normalize< | ||
OutputShapeFromFields<Fields> & | ||
UnionToIntersection<ParentShape<Types, Interfaces[number]>> | ||
>, | ||
>( | ||
name: string, | ||
options: SimpleInterfaceTypeOptions<Types, Fields, Shape, Interfaces>, | ||
options: SimpleInterfaceTypeOptions<Types, Interfaces, Fields, Shape>, | ||
fields?: InterfaceFieldsShape<Types, Shape>, | ||
@@ -90,4 +95,5 @@ ) => InterfaceRef<Types, Shape>; | ||
ObjectTypeOptions<Types, Shape> | ObjectTypeWithInterfaceOptions<Types, Shape, Interfaces>, | ||
'fields' | ||
'fields' | 'interfaces' | ||
> & { | ||
interfaces?: (() => Interfaces) | Interfaces; | ||
fields?: SimpleObjectFieldsShape<Types, Fields>; | ||
@@ -98,6 +104,7 @@ }; | ||
Types extends SchemaTypes, | ||
Interfaces extends InterfaceParam<Types>[], | ||
Fields extends FieldMap, | ||
Shape extends OutputShapeFromFields<Fields>, | ||
Interfaces extends InterfaceParam<Types>[], | ||
> extends Omit<InterfaceTypeOptions<Types, Shape, Interfaces>, 'args' | 'fields'> { | ||
Shape, | ||
> extends Omit<InterfaceTypeOptions<Types, Shape, Interfaces>, 'fields' | 'interfaces'> { | ||
interfaces?: (() => Interfaces) | Interfaces; | ||
fields?: SimpleObjectFieldsShape<Types, Fields>; | ||
@@ -104,0 +111,0 @@ } |
@@ -13,2 +13,3 @@ import './global-types'; | ||
SchemaTypes, | ||
UnionToIntersection, | ||
} from '@pothos/core'; | ||
@@ -32,3 +33,4 @@ import { OutputShapeFromFields } from './types'; | ||
Shape extends Normalize< | ||
OutputShapeFromFields<Fields> & ParentShape<SchemaTypes, Interfaces[number]> | ||
OutputShapeFromFields<Fields> & | ||
UnionToIntersection<ParentShape<SchemaTypes, Interfaces[number]>> | ||
>, | ||
@@ -52,8 +54,11 @@ >( | ||
proto.simpleInterface = function simpleInterface< | ||
Interfaces extends InterfaceParam<SchemaTypes>[], | ||
Fields extends FieldMap, | ||
Shape extends OutputShapeFromFields<Fields>, | ||
Interfaces extends InterfaceParam<SchemaTypes>[], | ||
Shape extends Normalize< | ||
OutputShapeFromFields<Fields> & | ||
UnionToIntersection<ParentShape<SchemaTypes, Interfaces[number]>> | ||
>, | ||
>( | ||
name: string, | ||
options: PothosSchemaTypes.SimpleInterfaceTypeOptions<SchemaTypes, Fields, Shape, Interfaces>, | ||
options: PothosSchemaTypes.SimpleInterfaceTypeOptions<SchemaTypes, Interfaces, Fields, Shape>, | ||
extraFields?: InterfaceFieldsShape<SchemaTypes, Shape>, | ||
@@ -60,0 +65,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
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
41219
380