From c819f20768cb68a664ecbadc1ad649c73af0d5a9 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Mon, 18 Nov 2024 15:22:56 -0500 Subject: [PATCH 1/5] fix(document-builder): infer object inline fragments --- .../InferResult/OutputField.ts | 23 ++-- .../InferResult/OutputObject.ts | 73 +++++++++--- src/documentBuilder/InferResult/__.test-d.ts | 9 ++ src/documentBuilder/InferResult/directive.ts | 37 ++++++ src/documentBuilder/InferResult/operation.ts | 8 +- .../Select/Directive/include.ts | 3 + src/documentBuilder/Select/Directive/skip.ts | 3 + src/documentBuilder/Select/InlineFragment.ts | 1 + src/documentBuilder/Select/document.ts | 16 +-- .../requestMethods/document.ts | 1 - .../requestMethods/requestMethods.test-d.ts | 4 +- .../fixture/graffle/modules/methods-root.ts | 108 +++++++++--------- .../fixture/graffle/modules/methods-select.ts | 72 ++++++++---- src/generator/generators/MethodsRoot.ts | 4 +- src/generator/generators/MethodsSelect.ts | 2 +- src/lib/prelude.ts | 3 + .../graffle/modules/methods-root.ts | 108 +++++++++--------- .../graffle/modules/methods-select.ts | 72 ++++++++---- .../graffle/modules/methods-root.ts | 6 +- .../graffle/modules/methods-select.ts | 4 +- .../pokemon/graffle/modules/methods-root.ts | 18 +-- .../pokemon/graffle/modules/methods-select.ts | 36 ++++-- .../graffle/modules/methods-root.ts | 6 +- .../graffle/modules/methods-select.ts | 2 +- website/graffle/modules/methods-root.ts | 18 +-- website/graffle/modules/methods-select.ts | 38 ++++-- 26 files changed, 427 insertions(+), 248 deletions(-) create mode 100644 src/documentBuilder/InferResult/directive.ts diff --git a/src/documentBuilder/InferResult/OutputField.ts b/src/documentBuilder/InferResult/OutputField.ts index 0f9749144..800a7d45f 100644 --- a/src/documentBuilder/InferResult/OutputField.ts +++ b/src/documentBuilder/InferResult/OutputField.ts @@ -3,15 +3,16 @@ import type { TSErrorDescriptive } from '../../lib/ts-error.js' import type { Schema } from '../../types/Schema/__.js' import type { InlineType } from '../../types/SchemaDrivenDataMap/InlineType.js' import type { Select } from '../Select/__.js' +import type { FieldDirectiveInclude, FieldDirectiveSkip } from './directive.js' import type { Interface } from './Interface.js' import type { OutputObject } from './OutputObject.js' import type { Union } from './Union.js' // dprint-ignore export type OutputField<$SelectionSet, $Field extends Schema.OutputField, $Schema extends Schema> = - $SelectionSet extends Select.Directive.Include.FieldStates.Negative | Select.Directive.Skip.FieldStates.Positive ? - null : - ( + $SelectionSet extends Select.Directive.Include.FieldStates.Negative | Select.Directive.Skip.FieldStates.Positive + ? null + : ( | FieldDirectiveInclude<$SelectionSet> | FieldDirectiveSkip<$SelectionSet> | SimplifyNullable< @@ -28,7 +29,9 @@ type FieldType< $SelectionSet, $Node extends Schema.NamedOutputTypes, > = - $Node extends Schema.OutputObject ? OutputObject<$SelectionSet, $Schema, $Node> : + $Node extends Schema.OutputObject ? $SelectionSet extends object + ? OutputObject<$SelectionSet, $Schema, $Node> + : TSErrorDescriptive<'FieldType', 'When $Node extends Schema.OutputObject then $SelectionSet must extend object', { $Type: $Node; $SelectionSet: $SelectionSet; $Schema:$Schema } > : $Node extends Schema.Scalar ? Schema.Scalar.GetDecoded<$Node> : // TODO use TS compiler API to extract this type at build time. $Node extends Schema.Scalar.ScalarCodecless ? Schema.Scalar.GetDecoded> : $Node extends Schema.__typename ? $Node['value'] : @@ -45,15 +48,3 @@ type GetCodecForCodecless< $Node['name'] extends keyof $Schema['scalarRegistry']['map'] ? $Schema['scalarRegistry']['map'][$Node['name']] : Schema.Scalar.String - -// dprint-ignore -type FieldDirectiveInclude<$SelectionSet> = - $SelectionSet extends Select.Directive.Include.Field ? $SelectionSet extends Select.Directive.Include.FieldStates.Positive ? never - : null - : never - -// dprint-ignore -type FieldDirectiveSkip<$SelectionSet> = - $SelectionSet extends Select.Directive.Skip.Field ? $SelectionSet extends Select.Directive.Skip.FieldStates.Negative ? never - : null - : never diff --git a/src/documentBuilder/InferResult/OutputObject.ts b/src/documentBuilder/InferResult/OutputObject.ts index dbecca3f7..090ca3d70 100644 --- a/src/documentBuilder/InferResult/OutputObject.ts +++ b/src/documentBuilder/InferResult/OutputObject.ts @@ -1,37 +1,84 @@ -import type { SimplifyExcept, StringKeyof } from '../../lib/prelude.js' +import type { IsNever } from 'type-fest' +import type { AssertExtendsObject, GetOrNever, SimplifyExcept, StringKeyof } from '../../lib/prelude.js' import type { TSErrorDescriptive } from '../../lib/ts-error.js' import type { Schema } from '../../types/Schema/__.js' import type { Select } from '../Select/__.js' import type { Alias } from './Alias.js' +import type { IsNeverViaDirective, IsNullableViaDirective, OmitDirectiveAndArgumentKeys } from './directive.js' import type { OutputField } from './OutputField.js' import type { ScalarsWildcard } from './ScalarsWildcard.js' // dprint-ignore -export type OutputObject<$SelectionSet, $Schema extends Schema, $Node extends Schema.OutputObject> = +export type OutputObject< + $SelectionSet extends object, + $Schema extends Schema, + $Node extends Schema.OutputObject +> = + SimplifyExcept< + $Schema['scalars']['typesDecoded'], + & OutputObject_<$SelectionSet, $Schema, $Node> + & InlineFragmentKeys<$SelectionSet, $Schema, $Node> + > + +// dprint-ignore +export type OutputObject_< + $SelectionSet extends object, + $Schema extends Schema, + $Node extends Schema.OutputObject, +> = Select.SelectScalarsWildcard.IsSelectScalarsWildcard<$SelectionSet> extends true + // todo this needs to be an extension and/or only available when sddm is present // todo what about when scalars wildcard is combined with other fields like relations? ? ScalarsWildcard<$SelectionSet, $Schema, $Node> - : SimplifyExcept< - $Schema['scalars']['typesDecoded'], - & NonAlias<$SelectionSet, $Schema, $Node> + : + & NonAliasKeys<$SelectionSet, $Schema, $Node> & Alias<$Schema, $Node, $SelectionSet> - > -type NonAlias<$SelectionSet, $Schema extends Schema, $Node extends Schema.OutputObject> = { - [$Key in PickSelectsPositiveIndicatorAndNotSelectAlias<$SelectionSet>]: $Key extends keyof $Node['fields'] - ? OutputField<$SelectionSet[$Key], $Node['fields'][$Key], $Schema> - : Errors.UnknownFieldName<$Key, $Node> +// dprint-ignore +type NonAliasKeys<$SelectionSet, $Schema extends Schema, $Node extends Schema.OutputObject> = { + [$Key in PickSelectsPositiveIndicatorAndNotSelectAlias<$SelectionSet>]: + $Key extends keyof $Node['fields'] + ? OutputField<$SelectionSet[$Key], $Node['fields'][$Key], $Schema> + : Errors.UnknownFieldName<$Key, $Node> +} + +// dprint-ignore +type InlineFragmentKeys<$SelectionSet extends object, $Schema extends Schema, $Node extends Schema.OutputObject> = + InlineFragmentKey_< + AssertExtendsObject< + GetOrNever<$SelectionSet, Select.InlineFragment.Key> + >, + $Schema, + $Node + > + +// dprint-ignore +type InlineFragmentKey_<$SelectionSet extends object, $Schema extends Schema, $Node extends Schema.OutputObject> = + IsNever<$SelectionSet> extends true + ? {} + : IsNeverViaDirective<$SelectionSet> extends true + ? {} + : IsNullableViaDirective<$SelectionSet> extends true + ? MakeObjectSelectionResultNullable< + OutputObject_, $Schema, $Node> + > + : OutputObject_, $Schema, $Node> + +type MakeObjectSelectionResultNullable<$Result extends object> = { + [_ in keyof $Result]: null | $Result[_] } // dprint-ignore export type PickSelectsPositiveIndicatorAndNotSelectAlias<$SelectionSet> = StringKeyof< { [ - $FieldName in keyof $SelectionSet as $SelectionSet[$FieldName] extends Select.Indicator.Negative + $Key in keyof $SelectionSet as $SelectionSet[$Key] extends Select.Indicator.Negative ? never - : $SelectionSet[$FieldName] extends any[] + : $SelectionSet[$Key] extends any[] ? never - : $FieldName + : $Key extends Select.InlineFragment.Key + ? never + : $Key ]: 0 } > diff --git a/src/documentBuilder/InferResult/__.test-d.ts b/src/documentBuilder/InferResult/__.test-d.ts index 601127972..6b5e201f3 100644 --- a/src/documentBuilder/InferResult/__.test-d.ts +++ b/src/documentBuilder/InferResult/__.test-d.ts @@ -113,6 +113,7 @@ assertEqual< // union fragment assertEqual<$<{ unionFooBar: { ___on_Foo: { id: ['id2', true] } } }>, { unionFooBar: null | {} | { id2: null|string } }>() + // Directive @include // On scalar non-nullable assertEqual<$<{ idNonNull: { $include: boolean } }>, { idNonNull: null|string }>() @@ -153,6 +154,14 @@ assertEqual<$<{ id: { $skip: true } }>, { id: null }>() assertEqual<$<{ stringWithArgs: true }>, { stringWithArgs: null | string }>() assertEqual<$<{ stringWithArgs: { $: { string: '' } } }>, { stringWithArgs: null | string }>() +// Inline Fragment + +assertEqual<$<{ ___: { id: true }}> , { id: null | string }>() +assertEqual<$<{ ___: { $include: false; id: true }}> , {}>() +assertEqual<$<{ ___: { $skip: true; id: true }}> , {}>() +assertEqual<$<{ ___: { $skip: boolean; idNonNull: true; listIntNonNull:true }}> , { idNonNull: string | null; listIntNonNull: number[] | null }>() +assertEqual<$<{ ___: { $include: boolean; idNonNull: true; listIntNonNull:true }}> , { idNonNull: string | null; listIntNonNull: number[] | null }>() + // Errors // @ts-expect-error invalid query type Result = $<{ id2: true }> diff --git a/src/documentBuilder/InferResult/directive.ts b/src/documentBuilder/InferResult/directive.ts new file mode 100644 index 000000000..e8a2230c7 --- /dev/null +++ b/src/documentBuilder/InferResult/directive.ts @@ -0,0 +1,37 @@ +import type { Select } from '../Select/__.js' + +// dprint-ignore +export type IsNeverViaDirective<$SelectionSet> = + $SelectionSet extends NeverSelection + ? true + : false + +// dprint-ignore +export type IsNullableViaDirective<$SelectionSet> = + $SelectionSet extends NullableSelection + ? true + : false + +type NeverSelection = Select.Directive.Include.FieldStates.Negative | Select.Directive.Skip.FieldStates.Positive + +type NullableSelection = + | Select.Directive.Include.FieldStates.Variable + | Select.Directive.Skip.FieldStates.Variable + +// dprint-ignore +export type FieldDirectiveInclude<$SelectionSet> = + $SelectionSet extends Select.Directive.Include.Field ? $SelectionSet extends Select.Directive.Include.FieldStates.Positive ? never + : null + : never + +// dprint-ignore +export type FieldDirectiveSkip<$SelectionSet> = + $SelectionSet extends Select.Directive.Skip.Field ? $SelectionSet extends Select.Directive.Skip.FieldStates.Negative ? never + : null + : never + +export type OmitDirectiveAndArgumentKeys<$SelectionSet extends object> = { + [$Key in keyof $SelectionSet as IsArgumentsOrDirectiveKey<$Key> extends true ? never : $Key]: $SelectionSet[$Key] +} + +type IsArgumentsOrDirectiveKey<$Key extends PropertyKey> = $Key extends `$${string}` ? true : false diff --git a/src/documentBuilder/InferResult/operation.ts b/src/documentBuilder/InferResult/operation.ts index f15b1a741..50ac8889b 100644 --- a/src/documentBuilder/InferResult/operation.ts +++ b/src/documentBuilder/InferResult/operation.ts @@ -5,19 +5,19 @@ import type { Schema } from '../../types/Schema/__.js' import type { OutputObject } from './OutputObject.js' // dprint-ignore -export type OperationQuery<$SelectionSet, $Schema extends Schema> = +export type OperationQuery<$SelectionSet extends object, $Schema extends Schema> = Operation<$SelectionSet, $Schema, OperationTypeNode.QUERY> // dprint-ignore -export type OperationMutation<$SelectionSet, $Schema extends Schema> = +export type OperationMutation<$SelectionSet extends object, $Schema extends Schema> = Operation<$SelectionSet, $Schema, OperationTypeNode.MUTATION> // dprint-ignore -export type OperationSubscription<$SelectionSet, $Schema extends Schema> = +export type OperationSubscription<$SelectionSet extends object, $Schema extends Schema> = Operation<$SelectionSet, $Schema, OperationTypeNode.SUBSCRIPTION> export type Operation< - $SelectionSet, + $SelectionSet extends object, $Schema extends Schema, $OperationType extends Grafaid.Document.OperationTypeNode, > = OutputObject<$SelectionSet, $Schema, ExcludeNull<$Schema['Root'][$OperationType]>> diff --git a/src/documentBuilder/Select/Directive/include.ts b/src/documentBuilder/Select/Directive/include.ts index 331b4bb98..a5a306fee 100644 --- a/src/documentBuilder/Select/Directive/include.ts +++ b/src/documentBuilder/Select/Directive/include.ts @@ -48,4 +48,7 @@ export namespace FieldStates { export interface Negative { $include: false | { if: false } } + export interface Variable { + $include: boolean | { if: boolean } + } } diff --git a/src/documentBuilder/Select/Directive/skip.ts b/src/documentBuilder/Select/Directive/skip.ts index 0664a79e0..1a3e3c5a6 100644 --- a/src/documentBuilder/Select/Directive/skip.ts +++ b/src/documentBuilder/Select/Directive/skip.ts @@ -34,4 +34,7 @@ export namespace FieldStates { export interface Negative { $skip: false | { if: false } } + export interface Variable { + $skip: boolean | { if: boolean } + } } diff --git a/src/documentBuilder/Select/InlineFragment.ts b/src/documentBuilder/Select/InlineFragment.ts index 58adf94e4..89af3c6f8 100644 --- a/src/documentBuilder/Select/InlineFragment.ts +++ b/src/documentBuilder/Select/InlineFragment.ts @@ -2,6 +2,7 @@ import type { OmitKeysWithPrefix } from '../../lib/prelude.js' import type { AnySelectionSet } from './selectionSet.js' export const prefix = `___` +export type Key = typeof prefix export const typeConditionPRefix = `${prefix}on_` diff --git a/src/documentBuilder/Select/document.ts b/src/documentBuilder/Select/document.ts index 7b2b4551c..aa6eb96fe 100644 --- a/src/documentBuilder/Select/document.ts +++ b/src/documentBuilder/Select/document.ts @@ -1,6 +1,6 @@ import type { OperationTypeNode } from 'graphql' import { Grafaid } from '../../lib/grafaid/__.js' -import type { FirstNonUnknownNever, Values } from '../../lib/prelude.js' +import type { AssertExtendsObject, FirstNonUnknownNever, Values } from '../../lib/prelude.js' import type { Select } from './__.js' export type OperationName = string @@ -40,12 +40,14 @@ export type GetOperationType<$Document extends SomeDocument, $Name extends strin // dprint-ignore export type GetOperation<$Document extends SomeDocument, $Name extends string> = - FirstNonUnknownNever<[ - // @ts-expect-error could be unknown - $Document[OperationTypeNode.MUTATION][$Name], - // @ts-expect-error could be unknown - $Document[OperationTypeNode.QUERY][$Name] - ]> + AssertExtendsObject< + FirstNonUnknownNever<[ + // @ts-expect-error could be unknown + $Document[OperationTypeNode.MUTATION][$Name], + // @ts-expect-error could be unknown + $Document[OperationTypeNode.QUERY][$Name] + ]> + > export interface OperationNormalized { name: string | null diff --git a/src/documentBuilder/requestMethods/document.ts b/src/documentBuilder/requestMethods/document.ts index 547595749..3e94f3700 100644 --- a/src/documentBuilder/requestMethods/document.ts +++ b/src/documentBuilder/requestMethods/document.ts @@ -27,7 +27,6 @@ export type DocumentRunner< Select.Document.GetOperationType<$$Document, $Name> > > - // & {} > > } diff --git a/src/documentBuilder/requestMethods/requestMethods.test-d.ts b/src/documentBuilder/requestMethods/requestMethods.test-d.ts index 49b356263..aaada9c02 100644 --- a/src/documentBuilder/requestMethods/requestMethods.test-d.ts +++ b/src/documentBuilder/requestMethods/requestMethods.test-d.ts @@ -13,7 +13,7 @@ test(`query`, async () => { // scalar expectTypeOf(await graffle.query.id()).toEqualTypeOf() // scalar none-nullable - expectTypeOf(await graffle.query.idNonNull()).toEqualTypeOf() + expectTypeOf(await graffle.query.idNonNull()).toEqualTypeOf() // scalar with optional arguments expectTypeOf>().toEqualTypeOf<[input?: Graffle.SelectionSets.Query.stringWithArgs]>() // scalar with required arguments @@ -23,7 +23,7 @@ test(`query`, async () => { // scalar with explicit indicators // positive indicator - expectTypeOf(await graffle.query.idNonNull(true)).toEqualTypeOf() + expectTypeOf(await graffle.query.idNonNull(true)).toEqualTypeOf() // negative indicator // todo // expectTypeOf(await graffle.query.idNonNull(false)).toEqualTypeOf() diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-root.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-root.ts index 93dfa88fa..711041999 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-root.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-root.ts @@ -4,7 +4,7 @@ import * as $$Schema from './schema.js' import * as $$SelectionSets from './selection-sets.js' export interface QueryMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -25,7 +25,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - InputObjectNested: <$SelectionSet>( + InputObjectNested: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.InputObjectNested<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -38,7 +38,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - InputObjectNestedNonNull: <$SelectionSet>( + InputObjectNestedNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.InputObjectNestedNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -53,7 +53,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { /** * Query enum field documentation. */ - abcEnum: <$SelectionSet>( + abcEnum: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.abcEnum<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -66,7 +66,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - argInputObjectCircular: <$SelectionSet>( + argInputObjectCircular: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.argInputObjectCircular<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -79,7 +79,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - date: <$SelectionSet>( + date: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.date<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -92,7 +92,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArg: <$SelectionSet>( + dateArg: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArg<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -105,7 +105,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgInputObject: <$SelectionSet>( + dateArgInputObject: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgInputObject<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -118,7 +118,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgList: <$SelectionSet>( + dateArgList: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -131,7 +131,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgNonNull: <$SelectionSet>( + dateArgNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -144,7 +144,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgNonNullList: <$SelectionSet>( + dateArgNonNullList: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgNonNullList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -157,7 +157,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgNonNullListNonNull: <$SelectionSet>( + dateArgNonNullListNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact< $SelectionSet, $$SelectionSets.Query.dateArgNonNullListNonNull<$Context['scalars']> @@ -173,7 +173,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateInterface1: <$SelectionSet>( + dateInterface1: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateInterface1<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -186,7 +186,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateList: <$SelectionSet>( + dateList: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -199,7 +199,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateListList: <$SelectionSet>( + dateListList: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateListList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -212,7 +212,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateListNonNull: <$SelectionSet>( + dateListNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateListNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -225,7 +225,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateNonNull: <$SelectionSet>( + dateNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -238,7 +238,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateObject1: <$SelectionSet>( + dateObject1: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateObject1<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -251,7 +251,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateUnion: <$SelectionSet>( + dateUnion: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateUnion<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -264,7 +264,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - error: <$SelectionSet>( + error: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.error<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -277,7 +277,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - id: <$SelectionSet>( + id: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.id<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -290,7 +290,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - idNonNull: <$SelectionSet>( + idNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -303,7 +303,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - interface: <$SelectionSet>( + interface: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$interface<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -316,7 +316,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - interfaceNonNull: <$SelectionSet>( + interfaceNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.interfaceNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -329,7 +329,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - interfaceWithArgs: <$SelectionSet>( + interfaceWithArgs: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.interfaceWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -342,7 +342,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - listInt: <$SelectionSet>( + listInt: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listInt<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -355,7 +355,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - listIntNonNull: <$SelectionSet>( + listIntNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listIntNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -368,7 +368,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - listListInt: <$SelectionSet>( + listListInt: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listListInt<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -381,7 +381,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - listListIntNonNull: <$SelectionSet>( + listListIntNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listListIntNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -394,7 +394,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - lowerCaseUnion: <$SelectionSet>( + lowerCaseUnion: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.lowerCaseUnion<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -407,7 +407,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - object: <$SelectionSet>( + object: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$object<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -420,7 +420,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectList: <$SelectionSet>( + objectList: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -433,7 +433,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectListNonNull: <$SelectionSet>( + objectListNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectListNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -446,7 +446,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectNested: <$SelectionSet>( + objectNested: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectNested<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -459,7 +459,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectNonNull: <$SelectionSet>( + objectNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -472,7 +472,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectWithArgs: <$SelectionSet>( + objectWithArgs: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -485,7 +485,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - result: <$SelectionSet>( + result: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.result<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -498,7 +498,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - resultNonNull: <$SelectionSet>( + resultNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.resultNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -511,7 +511,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - string: <$SelectionSet>( + string: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$string<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -524,7 +524,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithArgEnum: <$SelectionSet>( + stringWithArgEnum: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithArgEnum<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -537,7 +537,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithArgInputObject: <$SelectionSet>( + stringWithArgInputObject: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact< $SelectionSet, $$SelectionSets.Query.stringWithArgInputObject<$Context['scalars']> @@ -553,7 +553,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithArgInputObjectRequired: <$SelectionSet>( + stringWithArgInputObjectRequired: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact< $SelectionSet, $$SelectionSets.Query.stringWithArgInputObjectRequired<$Context['scalars']> @@ -574,7 +574,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { /** * The given arguments are reflected back as a JSON string. */ - stringWithArgs: <$SelectionSet>( + stringWithArgs: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -587,7 +587,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithListArg: <$SelectionSet>( + stringWithListArg: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithListArg<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -600,7 +600,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithListArgRequired: <$SelectionSet>( + stringWithListArgRequired: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact< $SelectionSet, $$SelectionSets.Query.stringWithListArgRequired<$Context['scalars']> @@ -616,7 +616,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithRequiredArg: <$SelectionSet>( + stringWithRequiredArg: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithRequiredArg<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -629,7 +629,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionFooBar: <$SelectionSet>( + unionFooBar: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBar<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -642,7 +642,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionFooBarNonNull: <$SelectionSet>( + unionFooBarNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBarNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -655,7 +655,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionFooBarWithArgs: <$SelectionSet>( + unionFooBarWithArgs: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBarWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -668,7 +668,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionObject: <$SelectionSet>( + unionObject: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionObject<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -681,7 +681,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionObjectNonNull: <$SelectionSet>( + unionObjectNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionObjectNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -696,7 +696,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { } export interface MutationMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -717,7 +717,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> { > > - id: <$SelectionSet>( + id: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.id<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -730,7 +730,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> { > > - idNonNull: <$SelectionSet>( + idNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-select.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-select.ts index 9a24c175d..2171b9d56 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-select.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-select.ts @@ -59,11 +59,13 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet } export interface Mutation { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>, + ): $SelectionSet } // @@ -83,59 +85,75 @@ export interface Mutation { // export interface Bar { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Bar>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Bar>): $SelectionSet } export interface DateObject1 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject1>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject1>, + ): $SelectionSet } export interface DateObject2 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject2>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject2>, + ): $SelectionSet } export interface ErrorOne { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorOne>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorOne>, + ): $SelectionSet } export interface ErrorTwo { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorTwo>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorTwo>, + ): $SelectionSet } export interface Foo { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Foo>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Foo>): $SelectionSet } export interface Object1 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1>): $SelectionSet } export interface Object1ImplementingInterface { - <$SelectionSet>( + <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1ImplementingInterface>, ): $SelectionSet } export interface Object2ImplementingInterface { - <$SelectionSet>( + <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object2ImplementingInterface>, ): $SelectionSet } export interface ObjectNested { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectNested>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectNested>, + ): $SelectionSet } export interface ObjectUnion { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectUnion>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectUnion>, + ): $SelectionSet } export interface lowerCaseObject { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject>, + ): $SelectionSet } export interface lowerCaseObject2 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject2>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject2>, + ): $SelectionSet } // @@ -155,19 +173,25 @@ export interface lowerCaseObject2 { // export interface DateUnion { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateUnion>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateUnion>, + ): $SelectionSet } export interface FooBarUnion { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.FooBarUnion>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.FooBarUnion>, + ): $SelectionSet } export interface Result { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Result>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Result>): $SelectionSet } export interface lowerCaseUnion { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseUnion>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseUnion>, + ): $SelectionSet } // @@ -187,13 +211,17 @@ export interface lowerCaseUnion { // export interface DateInterface1 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateInterface1>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateInterface1>, + ): $SelectionSet } export interface Error { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Error>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Error>): $SelectionSet } export interface Interface { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Interface>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Interface>, + ): $SelectionSet } diff --git a/src/generator/generators/MethodsRoot.ts b/src/generator/generators/MethodsRoot.ts index 6b65ed8e3..828ea71dd 100644 --- a/src/generator/generators/MethodsRoot.ts +++ b/src/generator/generators/MethodsRoot.ts @@ -52,7 +52,7 @@ const renderRootType = createCodeGenerator<{ node: Grafaid.Schema.ObjectType }>( // dprint-ignore code(` export interface ${node.name}Methods<$Context extends ${identifiers.$$Utilities}.Context> { - $batch: <$SelectionSet>(selectionSet: ${identifiers.$$Utilities}.Exact<$SelectionSet, ${identifiers.$$SelectionSets}.${node.name}<$Context['scalars']>>) => + $batch: <$SelectionSet extends object>(selectionSet: ${identifiers.$$Utilities}.Exact<$SelectionSet, ${identifiers.$$SelectionSets}.${node.name}<$Context['scalars']>>) => Promise< ${identifiers.$$Utilities}.SimplifyExcept< $Context['scalars']['typesDecoded'], @@ -89,7 +89,7 @@ const renderFieldMethods = createCodeGenerator<{ node: Grafaid.Schema.ObjectType const operationType = getOperationTypeOrThrow(config, node) // dprint-ignore code(` - ${field.name}: <$SelectionSet>(selectionSet${isOptional ? `?` : ``}: ${identifiers.$$Utilities}.Exact<$SelectionSet, ${identifiers.$$SelectionSets}.${renderName(node)}.${renderName(field)}<$Context['scalars']>>) => + ${field.name}: <$SelectionSet extends object>(selectionSet${isOptional ? `?` : ``}: ${identifiers.$$Utilities}.Exact<$SelectionSet, ${identifiers.$$SelectionSets}.${renderName(node)}.${renderName(field)}<$Context['scalars']>>) => Promise< ${identifiers.$$Utilities}.SimplifyExcept< $Context['scalars']['typesDecoded'], diff --git a/src/generator/generators/MethodsSelect.ts b/src/generator/generators/MethodsSelect.ts index 5edbfd883..3c2d45745 100644 --- a/src/generator/generators/MethodsSelect.ts +++ b/src/generator/generators/MethodsSelect.ts @@ -36,7 +36,7 @@ export const ModuleGeneratorMethodsSelect = createModuleGenerator( code(Code.tsInterface({ name: type.name, block: ` - <$SelectionSet>(selectionSet: ${identifiers.$$Utilities}.Exact<$SelectionSet, $$SelectionSets.${ + <$SelectionSet extends object>(selectionSet: ${identifiers.$$Utilities}.Exact<$SelectionSet, $$SelectionSets.${ renderName(type) }>): $SelectionSet diff --git a/src/lib/prelude.ts b/src/lib/prelude.ts index bd443d8c1..4dcb8559a 100644 --- a/src/lib/prelude.ts +++ b/src/lib/prelude.ts @@ -660,6 +660,9 @@ export type GetOrNever<$O extends object, $P extends string> = ? $O[$P] : never +// dprint-ignore +export type AssertExtendsObject<$Type> =AssertExtends<$Type, object> + // dprint-ignore export type AssertExtends<$Type, $Constraint> = $Type extends $Constraint diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/methods-root.ts b/tests/_/schemas/kitchen-sink/graffle/modules/methods-root.ts index d121fb1e1..75363d9e2 100644 --- a/tests/_/schemas/kitchen-sink/graffle/modules/methods-root.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/methods-root.ts @@ -4,7 +4,7 @@ import * as $$Schema from './schema.js' import * as $$SelectionSets from './selection-sets.js' export interface QueryMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -25,7 +25,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - InputObjectNested: <$SelectionSet>( + InputObjectNested: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.InputObjectNested<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -38,7 +38,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - InputObjectNestedNonNull: <$SelectionSet>( + InputObjectNestedNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.InputObjectNestedNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -53,7 +53,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { /** * Query enum field documentation. */ - abcEnum: <$SelectionSet>( + abcEnum: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.abcEnum<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -66,7 +66,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - argInputObjectCircular: <$SelectionSet>( + argInputObjectCircular: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.argInputObjectCircular<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -79,7 +79,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - date: <$SelectionSet>( + date: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.date<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -92,7 +92,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArg: <$SelectionSet>( + dateArg: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArg<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -105,7 +105,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgInputObject: <$SelectionSet>( + dateArgInputObject: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgInputObject<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -118,7 +118,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgList: <$SelectionSet>( + dateArgList: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -131,7 +131,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgNonNull: <$SelectionSet>( + dateArgNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -144,7 +144,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgNonNullList: <$SelectionSet>( + dateArgNonNullList: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgNonNullList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -157,7 +157,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgNonNullListNonNull: <$SelectionSet>( + dateArgNonNullListNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact< $SelectionSet, $$SelectionSets.Query.dateArgNonNullListNonNull<$Context['scalars']> @@ -173,7 +173,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateInterface1: <$SelectionSet>( + dateInterface1: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateInterface1<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -186,7 +186,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateList: <$SelectionSet>( + dateList: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -199,7 +199,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateListList: <$SelectionSet>( + dateListList: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateListList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -212,7 +212,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateListNonNull: <$SelectionSet>( + dateListNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateListNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -225,7 +225,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateNonNull: <$SelectionSet>( + dateNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -238,7 +238,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateObject1: <$SelectionSet>( + dateObject1: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateObject1<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -251,7 +251,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateUnion: <$SelectionSet>( + dateUnion: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateUnion<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -264,7 +264,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - error: <$SelectionSet>( + error: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.error<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -277,7 +277,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - id: <$SelectionSet>( + id: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.id<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -290,7 +290,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - idNonNull: <$SelectionSet>( + idNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -303,7 +303,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - interface: <$SelectionSet>( + interface: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$interface<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -316,7 +316,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - interfaceNonNull: <$SelectionSet>( + interfaceNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.interfaceNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -329,7 +329,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - interfaceWithArgs: <$SelectionSet>( + interfaceWithArgs: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.interfaceWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -342,7 +342,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - listInt: <$SelectionSet>( + listInt: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listInt<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -355,7 +355,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - listIntNonNull: <$SelectionSet>( + listIntNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listIntNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -368,7 +368,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - listListInt: <$SelectionSet>( + listListInt: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listListInt<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -381,7 +381,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - listListIntNonNull: <$SelectionSet>( + listListIntNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listListIntNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -394,7 +394,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - lowerCaseUnion: <$SelectionSet>( + lowerCaseUnion: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.lowerCaseUnion<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -407,7 +407,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - object: <$SelectionSet>( + object: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$object<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -420,7 +420,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectList: <$SelectionSet>( + objectList: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -433,7 +433,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectListNonNull: <$SelectionSet>( + objectListNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectListNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -446,7 +446,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectNested: <$SelectionSet>( + objectNested: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectNested<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -459,7 +459,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectNonNull: <$SelectionSet>( + objectNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -472,7 +472,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectWithArgs: <$SelectionSet>( + objectWithArgs: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -485,7 +485,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - result: <$SelectionSet>( + result: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.result<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -498,7 +498,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - resultNonNull: <$SelectionSet>( + resultNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.resultNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -511,7 +511,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - string: <$SelectionSet>( + string: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$string<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -524,7 +524,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithArgEnum: <$SelectionSet>( + stringWithArgEnum: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithArgEnum<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -537,7 +537,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithArgInputObject: <$SelectionSet>( + stringWithArgInputObject: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact< $SelectionSet, $$SelectionSets.Query.stringWithArgInputObject<$Context['scalars']> @@ -553,7 +553,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithArgInputObjectRequired: <$SelectionSet>( + stringWithArgInputObjectRequired: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact< $SelectionSet, $$SelectionSets.Query.stringWithArgInputObjectRequired<$Context['scalars']> @@ -574,7 +574,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { /** * The given arguments are reflected back as a JSON string. */ - stringWithArgs: <$SelectionSet>( + stringWithArgs: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -587,7 +587,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithListArg: <$SelectionSet>( + stringWithListArg: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithListArg<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -600,7 +600,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithListArgRequired: <$SelectionSet>( + stringWithListArgRequired: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact< $SelectionSet, $$SelectionSets.Query.stringWithListArgRequired<$Context['scalars']> @@ -616,7 +616,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithRequiredArg: <$SelectionSet>( + stringWithRequiredArg: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithRequiredArg<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -629,7 +629,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionFooBar: <$SelectionSet>( + unionFooBar: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBar<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -642,7 +642,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionFooBarNonNull: <$SelectionSet>( + unionFooBarNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBarNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -655,7 +655,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionFooBarWithArgs: <$SelectionSet>( + unionFooBarWithArgs: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBarWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -668,7 +668,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionObject: <$SelectionSet>( + unionObject: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionObject<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -681,7 +681,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionObjectNonNull: <$SelectionSet>( + unionObjectNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionObjectNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -696,7 +696,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { } export interface MutationMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -717,7 +717,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> { > > - id: <$SelectionSet>( + id: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.id<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -730,7 +730,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> { > > - idNonNull: <$SelectionSet>( + idNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/methods-select.ts b/tests/_/schemas/kitchen-sink/graffle/modules/methods-select.ts index b6e45a5e1..ab46d292a 100644 --- a/tests/_/schemas/kitchen-sink/graffle/modules/methods-select.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/methods-select.ts @@ -59,11 +59,13 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet } export interface Mutation { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>, + ): $SelectionSet } // @@ -83,59 +85,75 @@ export interface Mutation { // export interface Bar { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Bar>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Bar>): $SelectionSet } export interface DateObject1 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject1>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject1>, + ): $SelectionSet } export interface DateObject2 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject2>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject2>, + ): $SelectionSet } export interface ErrorOne { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorOne>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorOne>, + ): $SelectionSet } export interface ErrorTwo { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorTwo>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorTwo>, + ): $SelectionSet } export interface Foo { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Foo>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Foo>): $SelectionSet } export interface Object1 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1>): $SelectionSet } export interface Object1ImplementingInterface { - <$SelectionSet>( + <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1ImplementingInterface>, ): $SelectionSet } export interface Object2ImplementingInterface { - <$SelectionSet>( + <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object2ImplementingInterface>, ): $SelectionSet } export interface ObjectNested { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectNested>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectNested>, + ): $SelectionSet } export interface ObjectUnion { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectUnion>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectUnion>, + ): $SelectionSet } export interface lowerCaseObject { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject>, + ): $SelectionSet } export interface lowerCaseObject2 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject2>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject2>, + ): $SelectionSet } // @@ -155,19 +173,25 @@ export interface lowerCaseObject2 { // export interface DateUnion { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateUnion>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateUnion>, + ): $SelectionSet } export interface FooBarUnion { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.FooBarUnion>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.FooBarUnion>, + ): $SelectionSet } export interface Result { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Result>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Result>): $SelectionSet } export interface lowerCaseUnion { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseUnion>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseUnion>, + ): $SelectionSet } // @@ -187,13 +211,17 @@ export interface lowerCaseUnion { // export interface DateInterface1 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateInterface1>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateInterface1>, + ): $SelectionSet } export interface Error { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Error>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Error>): $SelectionSet } export interface Interface { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Interface>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Interface>, + ): $SelectionSet } diff --git a/tests/_/schemas/mutation-only/graffle/modules/methods-root.ts b/tests/_/schemas/mutation-only/graffle/modules/methods-root.ts index 11b0e360d..d28958190 100644 --- a/tests/_/schemas/mutation-only/graffle/modules/methods-root.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/methods-root.ts @@ -4,7 +4,7 @@ import * as $$Schema from './schema.js' import * as $$SelectionSets from './selection-sets.js' export interface MutationMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -25,7 +25,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> { > > - id: <$SelectionSet>( + id: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.id<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -38,7 +38,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> { > > - idNonNull: <$SelectionSet>( + idNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< diff --git a/tests/_/schemas/mutation-only/graffle/modules/methods-select.ts b/tests/_/schemas/mutation-only/graffle/modules/methods-select.ts index 076aa0042..2e5ee55a3 100644 --- a/tests/_/schemas/mutation-only/graffle/modules/methods-select.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/methods-select.ts @@ -38,7 +38,9 @@ export interface $MethodsSelect { // export interface Mutation { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>, + ): $SelectionSet } // diff --git a/tests/_/schemas/pokemon/graffle/modules/methods-root.ts b/tests/_/schemas/pokemon/graffle/modules/methods-root.ts index c3445693d..8fe6efc8a 100644 --- a/tests/_/schemas/pokemon/graffle/modules/methods-root.ts +++ b/tests/_/schemas/pokemon/graffle/modules/methods-root.ts @@ -4,7 +4,7 @@ import * as $$Schema from './schema.js' import * as $$SelectionSets from './selection-sets.js' export interface QueryMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -25,7 +25,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - battles: <$SelectionSet>( + battles: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.battles<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -38,7 +38,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - beings: <$SelectionSet>( + beings: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.beings<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -51,7 +51,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - pokemonByName: <$SelectionSet>( + pokemonByName: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemonByName<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -64,7 +64,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - pokemons: <$SelectionSet>( + pokemons: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemons<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -77,7 +77,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - trainerByName: <$SelectionSet>( + trainerByName: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.trainerByName<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -90,7 +90,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - trainers: <$SelectionSet>( + trainers: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.trainers<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -105,7 +105,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { } export interface MutationMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -126,7 +126,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> { > > - addPokemon: <$SelectionSet>( + addPokemon: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.addPokemon<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< diff --git a/tests/_/schemas/pokemon/graffle/modules/methods-select.ts b/tests/_/schemas/pokemon/graffle/modules/methods-select.ts index bc83fcdd4..00b66fd25 100644 --- a/tests/_/schemas/pokemon/graffle/modules/methods-select.ts +++ b/tests/_/schemas/pokemon/graffle/modules/methods-select.ts @@ -49,11 +49,13 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet } export interface Mutation { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>, + ): $SelectionSet } // @@ -73,35 +75,45 @@ export interface Mutation { // export interface BattleRoyale { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleRoyale>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleRoyale>, + ): $SelectionSet } export interface BattleTrainer { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleTrainer>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleTrainer>, + ): $SelectionSet } export interface BattleWild { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleWild>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleWild>, + ): $SelectionSet } export interface CombatantMultiPokemon { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.CombatantMultiPokemon>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.CombatantMultiPokemon>, + ): $SelectionSet } export interface CombatantSinglePokemon { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.CombatantSinglePokemon>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.CombatantSinglePokemon>, + ): $SelectionSet } export interface Patron { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Patron>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Patron>): $SelectionSet } export interface Pokemon { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Pokemon>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Pokemon>): $SelectionSet } export interface Trainer { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Trainer>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Trainer>): $SelectionSet } // @@ -121,7 +133,7 @@ export interface Trainer { // export interface Battle { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Battle>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Battle>): $SelectionSet } // @@ -141,5 +153,5 @@ export interface Battle { // export interface Being { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Being>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Being>): $SelectionSet } diff --git a/tests/_/schemas/query-only/graffle/modules/methods-root.ts b/tests/_/schemas/query-only/graffle/modules/methods-root.ts index ee5707cb1..7b0d149d2 100644 --- a/tests/_/schemas/query-only/graffle/modules/methods-root.ts +++ b/tests/_/schemas/query-only/graffle/modules/methods-root.ts @@ -4,7 +4,7 @@ import * as $$Schema from './schema.js' import * as $$SelectionSets from './selection-sets.js' export interface QueryMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -25,7 +25,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - id: <$SelectionSet>( + id: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.id<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -38,7 +38,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - idNonNull: <$SelectionSet>( + idNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< diff --git a/tests/_/schemas/query-only/graffle/modules/methods-select.ts b/tests/_/schemas/query-only/graffle/modules/methods-select.ts index aa927f1e3..1b9192f5e 100644 --- a/tests/_/schemas/query-only/graffle/modules/methods-select.ts +++ b/tests/_/schemas/query-only/graffle/modules/methods-select.ts @@ -38,7 +38,7 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet } // diff --git a/website/graffle/modules/methods-root.ts b/website/graffle/modules/methods-root.ts index 18d032885..3b0f4e022 100644 --- a/website/graffle/modules/methods-root.ts +++ b/website/graffle/modules/methods-root.ts @@ -4,7 +4,7 @@ import * as $$Schema from "./schema.js"; import * as $$SelectionSets from "./selection-sets.js"; export interface QueryMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context["scalars"]>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -25,7 +25,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > >; - battles: <$SelectionSet>( + battles: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.battles<$Context["scalars"]>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -38,7 +38,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > >; - beings: <$SelectionSet>( + beings: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.beings<$Context["scalars"]>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -51,7 +51,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > >; - pokemonByName: <$SelectionSet>( + pokemonByName: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemonByName<$Context["scalars"]>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -64,7 +64,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > >; - pokemons: <$SelectionSet>( + pokemons: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemons<$Context["scalars"]>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -77,7 +77,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > >; - trainerByName: <$SelectionSet>( + trainerByName: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.trainerByName<$Context["scalars"]>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -90,7 +90,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > >; - trainers: <$SelectionSet>( + trainers: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.trainers<$Context["scalars"]>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -105,7 +105,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { } export interface MutationMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context["scalars"]>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -126,7 +126,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> { > >; - addPokemon: <$SelectionSet>( + addPokemon: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.addPokemon<$Context["scalars"]>>, ) => Promise< $$Utilities.SimplifyExcept< diff --git a/website/graffle/modules/methods-select.ts b/website/graffle/modules/methods-select.ts index fedd399dd..17d4d5004 100644 --- a/website/graffle/modules/methods-select.ts +++ b/website/graffle/modules/methods-select.ts @@ -49,11 +49,13 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet; + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet; } export interface Mutation { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>): $SelectionSet; + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>, + ): $SelectionSet; } // @@ -73,37 +75,49 @@ export interface Mutation { // export interface BattleRoyale { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleRoyale>): $SelectionSet; + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleRoyale>, + ): $SelectionSet; } export interface BattleTrainer { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleTrainer>): $SelectionSet; + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleTrainer>, + ): $SelectionSet; } export interface BattleWild { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleWild>): $SelectionSet; + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleWild>, + ): $SelectionSet; } export interface CombatantMultiPokemon { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.CombatantMultiPokemon>): $SelectionSet; + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.CombatantMultiPokemon>, + ): $SelectionSet; } export interface CombatantSinglePokemon { - <$SelectionSet>( + <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.CombatantSinglePokemon>, ): $SelectionSet; } export interface Patron { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Patron>): $SelectionSet; + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Patron>): $SelectionSet; } export interface Pokemon { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Pokemon>): $SelectionSet; + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Pokemon>, + ): $SelectionSet; } export interface Trainer { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Trainer>): $SelectionSet; + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Trainer>, + ): $SelectionSet; } // @@ -123,7 +137,7 @@ export interface Trainer { // export interface Battle { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Battle>): $SelectionSet; + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Battle>): $SelectionSet; } // @@ -143,5 +157,5 @@ export interface Battle { // export interface Being { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Being>): $SelectionSet; + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Being>): $SelectionSet; } From 35a50b5d8e6bb83d9384a171f3b538662a098285 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Mon, 18 Nov 2024 15:25:18 -0500 Subject: [PATCH 2/5] snaps --- .../__snapshots__/generate.test.ts.snap | 184 ++++++++++-------- 1 file changed, 106 insertions(+), 78 deletions(-) diff --git a/src/generator/generator/__snapshots__/generate.test.ts.snap b/src/generator/generator/__snapshots__/generate.test.ts.snap index 01a8fc54d..72ed214e8 100644 --- a/src/generator/generator/__snapshots__/generate.test.ts.snap +++ b/src/generator/generator/__snapshots__/generate.test.ts.snap @@ -160,7 +160,7 @@ import * as $$Schema from './schema.js' import * as $$SelectionSets from './selection-sets.js' export interface QueryMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -181,7 +181,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - InputObjectNested: <$SelectionSet>( + InputObjectNested: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.InputObjectNested<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -194,7 +194,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - InputObjectNestedNonNull: <$SelectionSet>( + InputObjectNestedNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.InputObjectNestedNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -209,7 +209,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { /** * Query enum field documentation. */ - abcEnum: <$SelectionSet>( + abcEnum: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.abcEnum<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -222,7 +222,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - argInputObjectCircular: <$SelectionSet>( + argInputObjectCircular: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.argInputObjectCircular<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -235,7 +235,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - date: <$SelectionSet>( + date: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.date<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -248,7 +248,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArg: <$SelectionSet>( + dateArg: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArg<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -261,7 +261,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgInputObject: <$SelectionSet>( + dateArgInputObject: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgInputObject<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -274,7 +274,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgList: <$SelectionSet>( + dateArgList: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -287,7 +287,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgNonNull: <$SelectionSet>( + dateArgNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -300,7 +300,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgNonNullList: <$SelectionSet>( + dateArgNonNullList: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgNonNullList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -313,7 +313,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateArgNonNullListNonNull: <$SelectionSet>( + dateArgNonNullListNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact< $SelectionSet, $$SelectionSets.Query.dateArgNonNullListNonNull<$Context['scalars']> @@ -329,7 +329,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateInterface1: <$SelectionSet>( + dateInterface1: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateInterface1<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -342,7 +342,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateList: <$SelectionSet>( + dateList: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -355,7 +355,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateListList: <$SelectionSet>( + dateListList: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateListList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -368,7 +368,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateListNonNull: <$SelectionSet>( + dateListNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateListNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -381,7 +381,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateNonNull: <$SelectionSet>( + dateNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -394,7 +394,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateObject1: <$SelectionSet>( + dateObject1: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateObject1<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -407,7 +407,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - dateUnion: <$SelectionSet>( + dateUnion: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateUnion<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -420,7 +420,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - error: <$SelectionSet>( + error: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.error<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -433,7 +433,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - id: <$SelectionSet>( + id: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.id<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -446,7 +446,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - idNonNull: <$SelectionSet>( + idNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -459,7 +459,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - interface: <$SelectionSet>( + interface: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$interface<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -472,7 +472,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - interfaceNonNull: <$SelectionSet>( + interfaceNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.interfaceNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -485,7 +485,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - interfaceWithArgs: <$SelectionSet>( + interfaceWithArgs: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.interfaceWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -498,7 +498,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - listInt: <$SelectionSet>( + listInt: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listInt<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -511,7 +511,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - listIntNonNull: <$SelectionSet>( + listIntNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listIntNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -524,7 +524,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - listListInt: <$SelectionSet>( + listListInt: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listListInt<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -537,7 +537,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - listListIntNonNull: <$SelectionSet>( + listListIntNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listListIntNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -550,7 +550,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - lowerCaseUnion: <$SelectionSet>( + lowerCaseUnion: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.lowerCaseUnion<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -563,7 +563,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - object: <$SelectionSet>( + object: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$object<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -576,7 +576,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectList: <$SelectionSet>( + objectList: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectList<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -589,7 +589,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectListNonNull: <$SelectionSet>( + objectListNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectListNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -602,7 +602,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectNested: <$SelectionSet>( + objectNested: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectNested<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -615,7 +615,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectNonNull: <$SelectionSet>( + objectNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -628,7 +628,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - objectWithArgs: <$SelectionSet>( + objectWithArgs: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -641,7 +641,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - result: <$SelectionSet>( + result: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.result<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -654,7 +654,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - resultNonNull: <$SelectionSet>( + resultNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.resultNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -667,7 +667,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - string: <$SelectionSet>( + string: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$string<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -680,7 +680,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithArgEnum: <$SelectionSet>( + stringWithArgEnum: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithArgEnum<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -693,7 +693,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithArgInputObject: <$SelectionSet>( + stringWithArgInputObject: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact< $SelectionSet, $$SelectionSets.Query.stringWithArgInputObject<$Context['scalars']> @@ -709,7 +709,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithArgInputObjectRequired: <$SelectionSet>( + stringWithArgInputObjectRequired: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact< $SelectionSet, $$SelectionSets.Query.stringWithArgInputObjectRequired<$Context['scalars']> @@ -730,7 +730,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { /** * The given arguments are reflected back as a JSON string. */ - stringWithArgs: <$SelectionSet>( + stringWithArgs: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -743,7 +743,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithListArg: <$SelectionSet>( + stringWithListArg: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithListArg<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -756,7 +756,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithListArgRequired: <$SelectionSet>( + stringWithListArgRequired: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact< $SelectionSet, $$SelectionSets.Query.stringWithListArgRequired<$Context['scalars']> @@ -772,7 +772,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - stringWithRequiredArg: <$SelectionSet>( + stringWithRequiredArg: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithRequiredArg<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -785,7 +785,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionFooBar: <$SelectionSet>( + unionFooBar: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBar<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -798,7 +798,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionFooBarNonNull: <$SelectionSet>( + unionFooBarNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBarNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -811,7 +811,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionFooBarWithArgs: <$SelectionSet>( + unionFooBarWithArgs: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBarWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -824,7 +824,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionObject: <$SelectionSet>( + unionObject: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionObject<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -837,7 +837,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { > > - unionObjectNonNull: <$SelectionSet>( + unionObjectNonNull: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionObjectNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -852,7 +852,7 @@ export interface QueryMethods<$Context extends $$Utilities.Context> { } export interface MutationMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -873,7 +873,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> { > > - id: <$SelectionSet>( + id: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.id<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -886,7 +886,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> { > > - idNonNull: <$SelectionSet>( + idNonNull: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.SimplifyExcept< @@ -974,11 +974,13 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet } export interface Mutation { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>, + ): $SelectionSet } // @@ -998,59 +1000,75 @@ export interface Mutation { // export interface Bar { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Bar>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Bar>): $SelectionSet } export interface DateObject1 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject1>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject1>, + ): $SelectionSet } export interface DateObject2 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject2>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject2>, + ): $SelectionSet } export interface ErrorOne { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorOne>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorOne>, + ): $SelectionSet } export interface ErrorTwo { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorTwo>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorTwo>, + ): $SelectionSet } export interface Foo { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Foo>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Foo>): $SelectionSet } export interface Object1 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1>): $SelectionSet } export interface Object1ImplementingInterface { - <$SelectionSet>( + <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1ImplementingInterface>, ): $SelectionSet } export interface Object2ImplementingInterface { - <$SelectionSet>( + <$SelectionSet extends object>( selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object2ImplementingInterface>, ): $SelectionSet } export interface ObjectNested { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectNested>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectNested>, + ): $SelectionSet } export interface ObjectUnion { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectUnion>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectUnion>, + ): $SelectionSet } export interface lowerCaseObject { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject>, + ): $SelectionSet } export interface lowerCaseObject2 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject2>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject2>, + ): $SelectionSet } // @@ -1070,19 +1088,25 @@ export interface lowerCaseObject2 { // export interface DateUnion { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateUnion>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateUnion>, + ): $SelectionSet } export interface FooBarUnion { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.FooBarUnion>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.FooBarUnion>, + ): $SelectionSet } export interface Result { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Result>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Result>): $SelectionSet } export interface lowerCaseUnion { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseUnion>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseUnion>, + ): $SelectionSet } // @@ -1102,15 +1126,19 @@ export interface lowerCaseUnion { // export interface DateInterface1 { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateInterface1>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateInterface1>, + ): $SelectionSet } export interface Error { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Error>): $SelectionSet + <$SelectionSet extends object>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Error>): $SelectionSet } export interface Interface { - <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Interface>): $SelectionSet + <$SelectionSet extends object>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Interface>, + ): $SelectionSet } " `; @@ -7722,7 +7750,7 @@ import type * as $$Utilities from "graffle/utilities-for-generated"; import type { InferResult } from "graffle/schema"; export interface QueryRootMethods<$Context extends $$Utilities.Context> { - $batch: <$SelectionSet>( + $batch: <$SelectionSet extends object>( selectionSet: $$Utilities.Exact< $SelectionSet, $$SelectionSets.QueryRoot<$Context["scalars"]> @@ -7749,7 +7777,7 @@ export interface QueryRootMethods<$Context extends $$Utilities.Context> { > >; - id: <$SelectionSet>( + id: <$SelectionSet extends object>( selectionSet?: $$Utilities.Exact< $SelectionSet, $$SelectionSets.QueryRoot.id<$Context["scalars"]> From 7e5c3aeee321162aa0467bd9dfdc2ffacb3ffa63 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Mon, 18 Nov 2024 15:28:42 -0500 Subject: [PATCH 3/5] refactor --- .../InferResult/OutputObject.ts | 22 ++++++++++++++++--- src/documentBuilder/InferResult/__.test-d.ts | 9 -------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/documentBuilder/InferResult/OutputObject.ts b/src/documentBuilder/InferResult/OutputObject.ts index 090ca3d70..298c9efa4 100644 --- a/src/documentBuilder/InferResult/OutputObject.ts +++ b/src/documentBuilder/InferResult/OutputObject.ts @@ -1,4 +1,5 @@ import type { IsNever } from 'type-fest' +import { assertEqual } from '../../lib/assert-equal.js' import type { AssertExtendsObject, GetOrNever, SimplifyExcept, StringKeyof } from '../../lib/prelude.js' import type { TSErrorDescriptive } from '../../lib/ts-error.js' import type { Schema } from '../../types/Schema/__.js' @@ -21,7 +22,7 @@ export type OutputObject< > // dprint-ignore -export type OutputObject_< +type OutputObject_< $SelectionSet extends object, $Schema extends Schema, $Node extends Schema.OutputObject, @@ -36,7 +37,7 @@ export type OutputObject_< // dprint-ignore type NonAliasKeys<$SelectionSet, $Schema extends Schema, $Node extends Schema.OutputObject> = { - [$Key in PickSelectsPositiveIndicatorAndNotSelectAlias<$SelectionSet>]: + [$Key in PickPositiveIndicatorAndNotAlias<$SelectionSet>]: $Key extends keyof $Node['fields'] ? OutputField<$SelectionSet[$Key], $Node['fields'][$Key], $Schema> : Errors.UnknownFieldName<$Key, $Node> @@ -69,7 +70,7 @@ type MakeObjectSelectionResultNullable<$Result extends object> = { } // dprint-ignore -export type PickSelectsPositiveIndicatorAndNotSelectAlias<$SelectionSet> = StringKeyof< +type PickPositiveIndicatorAndNotAlias<$SelectionSet> = StringKeyof< { [ $Key in keyof $SelectionSet as $SelectionSet[$Key] extends Select.Indicator.Negative @@ -89,3 +90,18 @@ export namespace Errors { $Object extends Schema.OutputObject, > = TSErrorDescriptive<'Object', `field "${$FieldName}" does not exist on object "${$Object['name']}"`> } + +// +// +// +// Internal Tests +// +// +// +// dprint-ignore +{ + +assertEqual , 'a'>() +assertEqual , 'b'>() + +} diff --git a/src/documentBuilder/InferResult/__.test-d.ts b/src/documentBuilder/InferResult/__.test-d.ts index 6b5e201f3..8402b319c 100644 --- a/src/documentBuilder/InferResult/__.test-d.ts +++ b/src/documentBuilder/InferResult/__.test-d.ts @@ -6,7 +6,6 @@ import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graff import { assertEqual } from '../../lib/assert-equal.js' import type { Registry } from '../../types/Schema/nodes/Scalar/helpers.js' import type { InferResult } from './__.js' -import type { PickSelectsPositiveIndicatorAndNotSelectAlias } from './OutputObject.js' type $<$SelectionSet extends SelectionSets.Query> = Simplify> @@ -17,14 +16,6 @@ type $WithDate<$SelectionSet extends SelectionSets.Query<$Registry>> = InferResu Schema<$Registry> > -// dprint-ignore -{ - -assertEqual, 'a'>() -assertEqual, 'b'>() - -} - // dprint-ignore { From fc2f386d434adda2d6cbb6552d87cbff7dd0ada3 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Mon, 18 Nov 2024 15:30:21 -0500 Subject: [PATCH 4/5] ex snap --- ...on_introspection__introspection.output.txt | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/examples/__outputs__/60_extension/extension_introspection__introspection.output.txt b/examples/__outputs__/60_extension/extension_introspection__introspection.output.txt index ec88d2640..76b3b3fdc 100644 --- a/examples/__outputs__/60_extension/extension_introspection__introspection.output.txt +++ b/examples/__outputs__/60_extension/extension_introspection__introspection.output.txt @@ -546,7 +546,11 @@ name: 'attack', description: null, args: [], - type: { kind: 'SCALAR', name: 'Int', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Int', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -554,7 +558,11 @@ name: 'birthday', description: null, args: [], - type: { kind: 'SCALAR', name: 'Date', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Date', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -562,7 +570,11 @@ name: 'defense', description: null, args: [], - type: { kind: 'SCALAR', name: 'Int', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Int', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -570,7 +582,11 @@ name: 'hp', description: null, args: [], - type: { kind: 'SCALAR', name: 'Int', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Int', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -578,7 +594,11 @@ name: 'id', description: null, args: [], - type: { kind: 'SCALAR', name: 'ID', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'ID', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -586,7 +606,11 @@ name: 'name', description: null, args: [], - type: { kind: 'SCALAR', name: 'String', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'String', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -602,7 +626,11 @@ name: 'type', description: null, args: [], - type: { kind: 'ENUM', name: 'PokemonType', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'ENUM', name: 'PokemonType', ofType: null } + }, isDeprecated: false, deprecationReason: null } From f38654fcce2a6b447feedb54792fbae0a2573c3e Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Mon, 18 Nov 2024 15:31:54 -0500 Subject: [PATCH 5/5] fix ex tests --- ...tension_headers__dynamicHeaders.output.txt | 2 +- .../20_output/output_envelope.output.txt | 2 +- ...on_opentelemetry__opentelemetry.output.txt | 58 +++++++++---------- .../extension/introspection.detail.md | 42 +++++++++++--- .../examples/extension/introspection.md | 42 +++++++++++--- .../extension/opentelemetry.detail.md | 58 +++++++++---------- .../examples/extension/opentelemetry.md | 58 +++++++++---------- .../examples/output/envelope.detail.md | 2 +- .../_snippets/examples/output/envelope.md | 2 +- .../transport-http/dynamic-headers.detail.md | 2 +- .../transport-http/dynamic-headers.md | 2 +- .../10_transport-http/dynamic-headers.md | 2 +- .../content/examples/20_output/envelope.md | 2 +- .../examples/60_extension/introspection.md | 42 +++++++++++--- .../examples/60_extension/opentelemetry.md | 58 +++++++++---------- 15 files changed, 229 insertions(+), 145 deletions(-) diff --git a/examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt b/examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt index 97dd42920..9b96dea80 100644 --- a/examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt +++ b/examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt @@ -4,7 +4,7 @@ headers: Headers { accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8', 'content-type': 'application/json', - 'x-sent-at-time': '1731942324944' + 'x-sent-at-time': '1731961845707' }, method: 'post', url: 'http://localhost:3000/graphql', diff --git a/examples/__outputs__/20_output/output_envelope.output.txt b/examples/__outputs__/20_output/output_envelope.output.txt index 7616f821e..b856c7ff4 100644 --- a/examples/__outputs__/20_output/output_envelope.output.txt +++ b/examples/__outputs__/20_output/output_envelope.output.txt @@ -16,7 +16,7 @@ headers: Headers { 'content-type': 'application/graphql-response+json; charset=utf-8', 'content-length': '142', - date: 'Mon, 18 Nov 2024 15:05:25 GMT', + date: 'Mon, 18 Nov 2024 20:30:46 GMT', connection: 'keep-alive', 'keep-alive': 'timeout=5' }, diff --git a/examples/__outputs__/60_extension/extension_opentelemetry__opentelemetry.output.txt b/examples/__outputs__/60_extension/extension_opentelemetry__opentelemetry.output.txt index 221d9e8e6..f886da7d3 100644 --- a/examples/__outputs__/60_extension/extension_opentelemetry__opentelemetry.output.txt +++ b/examples/__outputs__/60_extension/extension_opentelemetry__opentelemetry.output.txt @@ -9,14 +9,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'encode', - id: '1c887e1c1ec9a2f0', + id: 'b4ac64f2faa2f565', kind: 0, - timestamp: 1731942325967000, - duration: 1660.917, + timestamp: 1731961846500000, + duration: 1634.667, attributes: {}, status: { code: 0 }, events: [], @@ -33,14 +33,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'pack', - id: 'a809cd5489d8667e', + id: '53e4263bd960a2e0', kind: 0, - timestamp: 1731942325969000, - duration: 25164.041, + timestamp: 1731961846508000, + duration: 16836.25, attributes: {}, status: { code: 0 }, events: [], @@ -57,14 +57,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'exchange', - id: 'b0a98d222477503a', + id: '49774b87c330f8a6', kind: 0, - timestamp: 1731942325995000, - duration: 20493.166, + timestamp: 1731961846525000, + duration: 100583.459, attributes: {}, status: { code: 0 }, events: [], @@ -81,14 +81,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'unpack', - id: '653173e30aed7697', + id: 'b2ab76711cac0cda', kind: 0, - timestamp: 1731942326016000, - duration: 951.5, + timestamp: 1731961846626000, + duration: 949.5, attributes: {}, status: { code: 0 }, events: [], @@ -105,14 +105,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'decode', - id: 'fb042b294d2cd179', + id: '02b77d59425b58b8', kind: 0, - timestamp: 1731942326017000, - duration: 441.958, + timestamp: 1731961846627000, + duration: 445, attributes: {}, status: { code: 0 }, events: [], @@ -129,14 +129,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', parentId: undefined, traceState: undefined, name: 'request', - id: '209715d4b5564e5f', + id: '832b1b8dea636439', kind: 0, - timestamp: 1731942325966000, - duration: 51312.625, + timestamp: 1731961846499000, + duration: 128745.833, attributes: {}, status: { code: 0 }, events: [], diff --git a/website/content/_snippets/examples/extension/introspection.detail.md b/website/content/_snippets/examples/extension/introspection.detail.md index 9f7426a3c..919b67b30 100644 --- a/website/content/_snippets/examples/extension/introspection.detail.md +++ b/website/content/_snippets/examples/extension/introspection.detail.md @@ -564,7 +564,11 @@ console.log(data) name: 'attack', description: null, args: [], - type: { kind: 'SCALAR', name: 'Int', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Int', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -572,7 +576,11 @@ console.log(data) name: 'birthday', description: null, args: [], - type: { kind: 'SCALAR', name: 'Date', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Date', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -580,7 +588,11 @@ console.log(data) name: 'defense', description: null, args: [], - type: { kind: 'SCALAR', name: 'Int', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Int', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -588,7 +600,11 @@ console.log(data) name: 'hp', description: null, args: [], - type: { kind: 'SCALAR', name: 'Int', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Int', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -596,7 +612,11 @@ console.log(data) name: 'id', description: null, args: [], - type: { kind: 'SCALAR', name: 'ID', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'ID', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -604,7 +624,11 @@ console.log(data) name: 'name', description: null, args: [], - type: { kind: 'SCALAR', name: 'String', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'String', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -620,7 +644,11 @@ console.log(data) name: 'type', description: null, args: [], - type: { kind: 'ENUM', name: 'PokemonType', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'ENUM', name: 'PokemonType', ofType: null } + }, isDeprecated: false, deprecationReason: null } diff --git a/website/content/_snippets/examples/extension/introspection.md b/website/content/_snippets/examples/extension/introspection.md index 316608190..894dce9c6 100644 --- a/website/content/_snippets/examples/extension/introspection.md +++ b/website/content/_snippets/examples/extension/introspection.md @@ -562,7 +562,11 @@ console.log(data) name: 'attack', description: null, args: [], - type: { kind: 'SCALAR', name: 'Int', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Int', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -570,7 +574,11 @@ console.log(data) name: 'birthday', description: null, args: [], - type: { kind: 'SCALAR', name: 'Date', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Date', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -578,7 +586,11 @@ console.log(data) name: 'defense', description: null, args: [], - type: { kind: 'SCALAR', name: 'Int', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Int', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -586,7 +598,11 @@ console.log(data) name: 'hp', description: null, args: [], - type: { kind: 'SCALAR', name: 'Int', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Int', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -594,7 +610,11 @@ console.log(data) name: 'id', description: null, args: [], - type: { kind: 'SCALAR', name: 'ID', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'ID', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -602,7 +622,11 @@ console.log(data) name: 'name', description: null, args: [], - type: { kind: 'SCALAR', name: 'String', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'String', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -618,7 +642,11 @@ console.log(data) name: 'type', description: null, args: [], - type: { kind: 'ENUM', name: 'PokemonType', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'ENUM', name: 'PokemonType', ofType: null } + }, isDeprecated: false, deprecationReason: null } diff --git a/website/content/_snippets/examples/extension/opentelemetry.detail.md b/website/content/_snippets/examples/extension/opentelemetry.detail.md index 8349f1ab7..d20edf844 100644 --- a/website/content/_snippets/examples/extension/opentelemetry.detail.md +++ b/website/content/_snippets/examples/extension/opentelemetry.detail.md @@ -37,14 +37,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'encode', - id: '1c887e1c1ec9a2f0', + id: 'b4ac64f2faa2f565', kind: 0, - timestamp: 1731942325967000, - duration: 1660.917, + timestamp: 1731961846500000, + duration: 1634.667, attributes: {}, status: { code: 0 }, events: [], @@ -64,14 +64,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'pack', - id: 'a809cd5489d8667e', + id: '53e4263bd960a2e0', kind: 0, - timestamp: 1731942325969000, - duration: 25164.041, + timestamp: 1731961846508000, + duration: 16836.25, attributes: {}, status: { code: 0 }, events: [], @@ -91,14 +91,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'exchange', - id: 'b0a98d222477503a', + id: '49774b87c330f8a6', kind: 0, - timestamp: 1731942325995000, - duration: 20493.166, + timestamp: 1731961846525000, + duration: 100583.459, attributes: {}, status: { code: 0 }, events: [], @@ -118,14 +118,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'unpack', - id: '653173e30aed7697', + id: 'b2ab76711cac0cda', kind: 0, - timestamp: 1731942326016000, - duration: 951.5, + timestamp: 1731961846626000, + duration: 949.5, attributes: {}, status: { code: 0 }, events: [], @@ -145,14 +145,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'decode', - id: 'fb042b294d2cd179', + id: '02b77d59425b58b8', kind: 0, - timestamp: 1731942326017000, - duration: 441.958, + timestamp: 1731961846627000, + duration: 445, attributes: {}, status: { code: 0 }, events: [], @@ -172,14 +172,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', parentId: undefined, traceState: undefined, name: 'request', - id: '209715d4b5564e5f', + id: '832b1b8dea636439', kind: 0, - timestamp: 1731942325966000, - duration: 51312.625, + timestamp: 1731961846499000, + duration: 128745.833, attributes: {}, status: { code: 0 }, events: [], diff --git a/website/content/_snippets/examples/extension/opentelemetry.md b/website/content/_snippets/examples/extension/opentelemetry.md index c1b4fd7c0..b72e62da3 100644 --- a/website/content/_snippets/examples/extension/opentelemetry.md +++ b/website/content/_snippets/examples/extension/opentelemetry.md @@ -35,14 +35,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'encode', - id: '1c887e1c1ec9a2f0', + id: 'b4ac64f2faa2f565', kind: 0, - timestamp: 1731942325967000, - duration: 1660.917, + timestamp: 1731961846500000, + duration: 1634.667, attributes: {}, status: { code: 0 }, events: [], @@ -62,14 +62,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'pack', - id: 'a809cd5489d8667e', + id: '53e4263bd960a2e0', kind: 0, - timestamp: 1731942325969000, - duration: 25164.041, + timestamp: 1731961846508000, + duration: 16836.25, attributes: {}, status: { code: 0 }, events: [], @@ -89,14 +89,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'exchange', - id: 'b0a98d222477503a', + id: '49774b87c330f8a6', kind: 0, - timestamp: 1731942325995000, - duration: 20493.166, + timestamp: 1731961846525000, + duration: 100583.459, attributes: {}, status: { code: 0 }, events: [], @@ -116,14 +116,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'unpack', - id: '653173e30aed7697', + id: 'b2ab76711cac0cda', kind: 0, - timestamp: 1731942326016000, - duration: 951.5, + timestamp: 1731961846626000, + duration: 949.5, attributes: {}, status: { code: 0 }, events: [], @@ -143,14 +143,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'decode', - id: 'fb042b294d2cd179', + id: '02b77d59425b58b8', kind: 0, - timestamp: 1731942326017000, - duration: 441.958, + timestamp: 1731961846627000, + duration: 445, attributes: {}, status: { code: 0 }, events: [], @@ -170,14 +170,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', parentId: undefined, traceState: undefined, name: 'request', - id: '209715d4b5564e5f', + id: '832b1b8dea636439', kind: 0, - timestamp: 1731942325966000, - duration: 51312.625, + timestamp: 1731961846499000, + duration: 128745.833, attributes: {}, status: { code: 0 }, events: [], diff --git a/website/content/_snippets/examples/output/envelope.detail.md b/website/content/_snippets/examples/output/envelope.detail.md index c4ef5a696..ee395973d 100644 --- a/website/content/_snippets/examples/output/envelope.detail.md +++ b/website/content/_snippets/examples/output/envelope.detail.md @@ -38,7 +38,7 @@ console.log(result) headers: Headers { 'content-type': 'application/graphql-response+json; charset=utf-8', 'content-length': '142', - date: 'Mon, 18 Nov 2024 15:05:25 GMT', + date: 'Mon, 18 Nov 2024 20:30:46 GMT', connection: 'keep-alive', 'keep-alive': 'timeout=5' }, diff --git a/website/content/_snippets/examples/output/envelope.md b/website/content/_snippets/examples/output/envelope.md index 7828a9846..a857364a0 100644 --- a/website/content/_snippets/examples/output/envelope.md +++ b/website/content/_snippets/examples/output/envelope.md @@ -36,7 +36,7 @@ console.log(result) headers: Headers { 'content-type': 'application/graphql-response+json; charset=utf-8', 'content-length': '142', - date: 'Mon, 18 Nov 2024 15:05:25 GMT', + date: 'Mon, 18 Nov 2024 20:30:46 GMT', connection: 'keep-alive', 'keep-alive': 'timeout=5' }, diff --git a/website/content/_snippets/examples/transport-http/dynamic-headers.detail.md b/website/content/_snippets/examples/transport-http/dynamic-headers.detail.md index 5b8806032..38859f467 100644 --- a/website/content/_snippets/examples/transport-http/dynamic-headers.detail.md +++ b/website/content/_snippets/examples/transport-http/dynamic-headers.detail.md @@ -39,7 +39,7 @@ await graffle.gql`{ pokemons { name } }`.send() headers: Headers { accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8', 'content-type': 'application/json', - 'x-sent-at-time': '1731942324944' + 'x-sent-at-time': '1731961845707' }, method: 'post', url: 'http://localhost:3000/graphql', diff --git a/website/content/_snippets/examples/transport-http/dynamic-headers.md b/website/content/_snippets/examples/transport-http/dynamic-headers.md index 9d69a1817..5fa96afe0 100644 --- a/website/content/_snippets/examples/transport-http/dynamic-headers.md +++ b/website/content/_snippets/examples/transport-http/dynamic-headers.md @@ -37,7 +37,7 @@ await graffle.gql`{ pokemons { name } }`.send() headers: Headers { accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8', 'content-type': 'application/json', - 'x-sent-at-time': '1731942324944' + 'x-sent-at-time': '1731961845707' }, method: 'post', url: 'http://localhost:3000/graphql', diff --git a/website/content/examples/10_transport-http/dynamic-headers.md b/website/content/examples/10_transport-http/dynamic-headers.md index 6896d1525..8afa1b81e 100644 --- a/website/content/examples/10_transport-http/dynamic-headers.md +++ b/website/content/examples/10_transport-http/dynamic-headers.md @@ -44,7 +44,7 @@ await graffle.gql`{ pokemons { name } }`.send() headers: Headers { accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8', 'content-type': 'application/json', - 'x-sent-at-time': '1731942324944' + 'x-sent-at-time': '1731961845707' }, method: 'post', url: 'http://localhost:3000/graphql', diff --git a/website/content/examples/20_output/envelope.md b/website/content/examples/20_output/envelope.md index 6655c858e..9b82cdf65 100644 --- a/website/content/examples/20_output/envelope.md +++ b/website/content/examples/20_output/envelope.md @@ -43,7 +43,7 @@ console.log(result) headers: Headers { 'content-type': 'application/graphql-response+json; charset=utf-8', 'content-length': '142', - date: 'Mon, 18 Nov 2024 15:05:25 GMT', + date: 'Mon, 18 Nov 2024 20:30:46 GMT', connection: 'keep-alive', 'keep-alive': 'timeout=5' }, diff --git a/website/content/examples/60_extension/introspection.md b/website/content/examples/60_extension/introspection.md index 75ec5abe8..2525c65fe 100644 --- a/website/content/examples/60_extension/introspection.md +++ b/website/content/examples/60_extension/introspection.md @@ -569,7 +569,11 @@ console.log(data) name: 'attack', description: null, args: [], - type: { kind: 'SCALAR', name: 'Int', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Int', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -577,7 +581,11 @@ console.log(data) name: 'birthday', description: null, args: [], - type: { kind: 'SCALAR', name: 'Date', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Date', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -585,7 +593,11 @@ console.log(data) name: 'defense', description: null, args: [], - type: { kind: 'SCALAR', name: 'Int', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Int', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -593,7 +605,11 @@ console.log(data) name: 'hp', description: null, args: [], - type: { kind: 'SCALAR', name: 'Int', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'Int', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -601,7 +617,11 @@ console.log(data) name: 'id', description: null, args: [], - type: { kind: 'SCALAR', name: 'ID', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'ID', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -609,7 +629,11 @@ console.log(data) name: 'name', description: null, args: [], - type: { kind: 'SCALAR', name: 'String', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'SCALAR', name: 'String', ofType: null } + }, isDeprecated: false, deprecationReason: null }, @@ -625,7 +649,11 @@ console.log(data) name: 'type', description: null, args: [], - type: { kind: 'ENUM', name: 'PokemonType', ofType: null }, + type: { + kind: 'NON_NULL', + name: null, + ofType: { kind: 'ENUM', name: 'PokemonType', ofType: null } + }, isDeprecated: false, deprecationReason: null } diff --git a/website/content/examples/60_extension/opentelemetry.md b/website/content/examples/60_extension/opentelemetry.md index d6b07fa62..0b45502e7 100644 --- a/website/content/examples/60_extension/opentelemetry.md +++ b/website/content/examples/60_extension/opentelemetry.md @@ -40,14 +40,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'encode', - id: '1c887e1c1ec9a2f0', + id: 'b4ac64f2faa2f565', kind: 0, - timestamp: 1731942325967000, - duration: 1660.917, + timestamp: 1731961846500000, + duration: 1634.667, attributes: {}, status: { code: 0 }, events: [], @@ -67,14 +67,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'pack', - id: 'a809cd5489d8667e', + id: '53e4263bd960a2e0', kind: 0, - timestamp: 1731942325969000, - duration: 25164.041, + timestamp: 1731961846508000, + duration: 16836.25, attributes: {}, status: { code: 0 }, events: [], @@ -94,14 +94,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'exchange', - id: 'b0a98d222477503a', + id: '49774b87c330f8a6', kind: 0, - timestamp: 1731942325995000, - duration: 20493.166, + timestamp: 1731961846525000, + duration: 100583.459, attributes: {}, status: { code: 0 }, events: [], @@ -121,14 +121,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'unpack', - id: '653173e30aed7697', + id: 'b2ab76711cac0cda', kind: 0, - timestamp: 1731942326016000, - duration: 951.5, + timestamp: 1731961846626000, + duration: 949.5, attributes: {}, status: { code: 0 }, events: [], @@ -148,14 +148,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', - parentId: '209715d4b5564e5f', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', + parentId: '832b1b8dea636439', traceState: undefined, name: 'decode', - id: 'fb042b294d2cd179', + id: '02b77d59425b58b8', kind: 0, - timestamp: 1731942326017000, - duration: 441.958, + timestamp: 1731961846627000, + duration: 445, attributes: {}, status: { code: 0 }, events: [], @@ -175,14 +175,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: 'd1df7288d6e61f6468a98edf7a68ef88', + traceId: 'b3ebc1b598698f83310bd235fcb07eab', parentId: undefined, traceState: undefined, name: 'request', - id: '209715d4b5564e5f', + id: '832b1b8dea636439', kind: 0, - timestamp: 1731942325966000, - duration: 51312.625, + timestamp: 1731961846499000, + duration: 128745.833, attributes: {}, status: { code: 0 }, events: [],