Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pothos/plugin-simple-objects

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pothos/plugin-simple-objects - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

6

CHANGELOG.md
# Change Log
## 4.0.1
### Patch Changes
- d4f7705: Allow extending interfaces without re-defining all fields
## 4.0.0

@@ -4,0 +10,0 @@

12

dts/global-types.d.ts

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc