diff --git a/examples/$/generated-clients/atlas/modules/SelectionSets.ts b/examples/$/generated-clients/atlas/modules/SelectionSets.ts index 7b50724dd..f54c52ce8 100644 --- a/examples/$/generated-clients/atlas/modules/SelectionSets.ts +++ b/examples/$/generated-clients/atlas/modules/SelectionSets.ts @@ -72,7 +72,9 @@ export interface Query { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | @@ -238,21 +240,23 @@ export interface Continent extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Continent { - export type code$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type code$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type code = $SelectionSet.NoArgsIndicator + export type code = $SelectionSet.Indicator.NoArgsIndicator export interface countries extends _RefDefs._Country {} export type countries$Expanded = countries - export type name$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type name$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type name = $SelectionSet.NoArgsIndicator + export type name = $SelectionSet.Indicator.NoArgsIndicator } // @@ -346,41 +350,43 @@ export interface Country extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Country { - export type awsRegion$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type awsRegion$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type awsRegion = $SelectionSet.NoArgsIndicator + export type awsRegion = $SelectionSet.Indicator.NoArgsIndicator - export type capital$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type capital$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type capital = $SelectionSet.NoArgsIndicator + export type capital = $SelectionSet.Indicator.NoArgsIndicator - export type code$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type code$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type code = $SelectionSet.NoArgsIndicator + export type code = $SelectionSet.Indicator.NoArgsIndicator export interface continent extends _RefDefs._Continent {} export type continent$Expanded = continent - export type currencies$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type currencies$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type currencies = $SelectionSet.NoArgsIndicator + export type currencies = $SelectionSet.Indicator.NoArgsIndicator - export type currency$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type currency$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type currency = $SelectionSet.NoArgsIndicator + export type currency = $SelectionSet.Indicator.NoArgsIndicator - export type emoji$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type emoji$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type emoji = $SelectionSet.NoArgsIndicator + export type emoji = $SelectionSet.Indicator.NoArgsIndicator - export type emojiU$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type emojiU$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type emojiU = $SelectionSet.NoArgsIndicator + export type emojiU = $SelectionSet.Indicator.NoArgsIndicator export interface languages extends _RefDefs._Language {} export type languages$Expanded = languages @@ -397,21 +403,21 @@ export namespace Country { } > - export type name$Expanded = $Utilities.UnionExpanded<$SelectionSet.ClientIndicator | name$SelectionSet> + export type name$Expanded = $Utilities.UnionExpanded<$SelectionSet.Indicator.ClientIndicator | name$SelectionSet> - export type name = $SelectionSet.ClientIndicator | name$SelectionSet + export type name = $SelectionSet.Indicator.ClientIndicator | name$SelectionSet - export type native$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type native$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type native = $SelectionSet.NoArgsIndicator + export type native = $SelectionSet.Indicator.NoArgsIndicator - export type phone$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type phone$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type phone = $SelectionSet.NoArgsIndicator + export type phone = $SelectionSet.Indicator.NoArgsIndicator - export type phones$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type phones$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type phones = $SelectionSet.NoArgsIndicator + export type phones = $SelectionSet.Indicator.NoArgsIndicator export interface states extends _RefDefs._State {} export type states$Expanded = states @@ -466,27 +472,29 @@ export interface Language extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Language { - export type code$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type code$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type code = $SelectionSet.NoArgsIndicator + export type code = $SelectionSet.Indicator.NoArgsIndicator - export type name$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type name$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type name = $SelectionSet.NoArgsIndicator + export type name = $SelectionSet.Indicator.NoArgsIndicator - export type native$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type native$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type native = $SelectionSet.NoArgsIndicator + export type native = $SelectionSet.Indicator.NoArgsIndicator - export type rtl$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type rtl$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type rtl = $SelectionSet.NoArgsIndicator + export type rtl = $SelectionSet.Indicator.NoArgsIndicator } // @@ -532,21 +540,23 @@ export interface State extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace State { - export type code$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type code$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type code = $SelectionSet.NoArgsIndicator + export type code = $SelectionSet.Indicator.NoArgsIndicator export interface country extends _RefDefs._Country {} export type country$Expanded = country - export type name$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type name$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type name = $SelectionSet.NoArgsIndicator + export type name = $SelectionSet.Indicator.NoArgsIndicator } // @@ -592,23 +602,25 @@ export interface Subdivision extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Subdivision { - export type code$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type code$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type code = $SelectionSet.NoArgsIndicator + export type code = $SelectionSet.Indicator.NoArgsIndicator - export type emoji$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type emoji$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type emoji = $SelectionSet.NoArgsIndicator + export type emoji = $SelectionSet.Indicator.NoArgsIndicator - export type name$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type name$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type name = $SelectionSet.NoArgsIndicator + export type name = $SelectionSet.Indicator.NoArgsIndicator } /** diff --git a/examples/$/generated-clients/pokemon/modules/SelectionSets.ts b/examples/$/generated-clients/pokemon/modules/SelectionSets.ts index b3bf6a9bf..fffa683e3 100644 --- a/examples/$/generated-clients/pokemon/modules/SelectionSets.ts +++ b/examples/$/generated-clients/pokemon/modules/SelectionSets.ts @@ -52,7 +52,9 @@ export interface Mutation { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | @@ -120,7 +122,9 @@ export interface Query { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | @@ -223,31 +227,33 @@ export interface Pokemon extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Pokemon { - export type attack$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type attack$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type attack = $SelectionSet.NoArgsIndicator + export type attack = $SelectionSet.Indicator.NoArgsIndicator - export type defense$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type defense$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type defense = $SelectionSet.NoArgsIndicator + export type defense = $SelectionSet.Indicator.NoArgsIndicator - export type hp$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type hp$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type hp = $SelectionSet.NoArgsIndicator + export type hp = $SelectionSet.Indicator.NoArgsIndicator - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator - export type name$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type name$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type name = $SelectionSet.NoArgsIndicator + export type name = $SelectionSet.Indicator.NoArgsIndicator export interface trainer extends _RefDefs._Trainer {} export type trainer$Expanded = trainer @@ -296,19 +302,21 @@ export interface Trainer extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Trainer { - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator - export type name$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type name$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type name = $SelectionSet.NoArgsIndicator + export type name = $SelectionSet.Indicator.NoArgsIndicator export interface pokemon extends _RefDefs._Pokemon {} export type pokemon$Expanded = pokemon diff --git a/src/layers/2_generator/code/SelectionSets.ts b/src/layers/2_generator/code/SelectionSets.ts index d0247bd33..5062efe55 100644 --- a/src/layers/2_generator/code/SelectionSets.ts +++ b/src/layers/2_generator/code/SelectionSets.ts @@ -274,12 +274,12 @@ const renderField = createCodeGenerator<{ field: GraphQLField }>( code.push( Helpers.type( `${nameRendered}$Expanded`, - `$Utilities.UnionExpanded<$SelectionSet.ClientIndicator | ${nameRendered}$SelectionSet>`, + `$Utilities.UnionExpanded<$SelectionSet.Indicator.ClientIndicator | ${nameRendered}$SelectionSet>`, ), ) code.push(``) code.push( - Helpers.type(nameRendered, `$SelectionSet.ClientIndicator | ${nameRendered}$SelectionSet`), + Helpers.type(nameRendered, `$SelectionSet.Indicator.ClientIndicator | ${nameRendered}$SelectionSet`), ) code.push(``) } else { @@ -290,9 +290,9 @@ const renderField = createCodeGenerator<{ field: GraphQLField }>( code.push(``) } } else { - code.push(Helpers.type(`${nameRendered}$Expanded`, `$SelectionSet.NoArgsIndicator$Expanded`)) + code.push(Helpers.type(`${nameRendered}$Expanded`, `$SelectionSet.Indicator.NoArgsIndicator$Expanded`)) code.push(``) - code.push(Helpers.type(nameRendered, `$SelectionSet.NoArgsIndicator`)) + code.push(Helpers.type(nameRendered, `$SelectionSet.Indicator.NoArgsIndicator`)) code.push(``) } } else { @@ -394,7 +394,7 @@ namespace Helpers { export const __typename = (kind: 'union' | 'interface' | 'object') => { return ` ${__typenameDoc(kind)} - ${outputFieldAlisable(`__typename`, `$SelectionSet.NoArgsIndicator`)} + ${outputFieldAlisable(`__typename`, `$SelectionSet.Indicator.NoArgsIndicator`)} ` } diff --git a/src/layers/3_SelectionSet/runtime/directives/directive.ts b/src/layers/3_SelectionSet/Directive/$print.ts similarity index 73% rename from src/layers/3_SelectionSet/runtime/directives/directive.ts rename to src/layers/3_SelectionSet/Directive/$print.ts index 3ff29830f..a4122de60 100644 --- a/src/layers/3_SelectionSet/runtime/directives/directive.ts +++ b/src/layers/3_SelectionSet/Directive/$print.ts @@ -1,13 +1,10 @@ -export interface DirectiveLike { - name: string - args: Record -} +import type { DirectiveLike } from './$types.js' export const toGraphQLDirective = (directive: DirectiveLike) => { return `@${directive.name}(${toGraphQLDirectiveArgs(directive.args)})` } -export const toGraphQLDirectiveArgs = (args: object) => { +export const toGraphQLDirectiveArgs = (args: DirectiveLike['args']) => { return Object.entries(args).filter(([_, v]) => v !== undefined).map(([k, clientValue]) => { // todo can directives receive custom scalars? const value = JSON.stringify(clientValue) diff --git a/src/layers/3_SelectionSet/Directive/$types.ts b/src/layers/3_SelectionSet/Directive/$types.ts new file mode 100644 index 000000000..fd0a71fed --- /dev/null +++ b/src/layers/3_SelectionSet/Directive/$types.ts @@ -0,0 +1,26 @@ +import { Defer } from './_defer.js' +import { Include } from './_include.js' +import { Skip } from './_skip.js' +import { Stream } from './_stream.js' + +export interface DirectiveDefinition { + name: string + create: (...args: any[]) => DirectiveLike +} + +export interface DirectiveLike { + name: string + args: object +} + +/** + * @see https://spec.graphql.org/draft/#sec-Type-System.Directives.Built-in-Directives + */ +export interface $Fields extends Defer.Field, Stream.Field, Include.Field, Skip.Field {} + +export const fieldToDef = { + $defer: Defer, + $stream: Stream, + $include: Include, + $skip: Skip, +} satisfies Record diff --git a/src/layers/3_SelectionSet/Directive/_.ts b/src/layers/3_SelectionSet/Directive/_.ts new file mode 100644 index 000000000..ad1abea64 --- /dev/null +++ b/src/layers/3_SelectionSet/Directive/_.ts @@ -0,0 +1,6 @@ +export * as Print from './$print.js' +export * from './$types.js' +export * from './_defer.js' +export * from './_include.js' +export * from './_skip.js' +export * from './_stream.js' diff --git a/src/layers/3_SelectionSet/Directive/__.ts b/src/layers/3_SelectionSet/Directive/__.ts new file mode 100644 index 000000000..f69857e39 --- /dev/null +++ b/src/layers/3_SelectionSet/Directive/__.ts @@ -0,0 +1 @@ +export * as Directive from './_.js' diff --git a/src/layers/3_SelectionSet/Directive/_defer.ts b/src/layers/3_SelectionSet/Directive/_defer.ts new file mode 100644 index 000000000..80ffbba60 --- /dev/null +++ b/src/layers/3_SelectionSet/Directive/_defer.ts @@ -0,0 +1 @@ +export * as Defer from './defer.js' diff --git a/src/layers/3_SelectionSet/Directive/_include.ts b/src/layers/3_SelectionSet/Directive/_include.ts new file mode 100644 index 000000000..c706fdeae --- /dev/null +++ b/src/layers/3_SelectionSet/Directive/_include.ts @@ -0,0 +1 @@ +export * as Include from './include.js' diff --git a/src/layers/3_SelectionSet/Directive/_skip.ts b/src/layers/3_SelectionSet/Directive/_skip.ts new file mode 100644 index 000000000..b77b95d23 --- /dev/null +++ b/src/layers/3_SelectionSet/Directive/_skip.ts @@ -0,0 +1 @@ +export * as Skip from './skip.js' diff --git a/src/layers/3_SelectionSet/Directive/_stream.ts b/src/layers/3_SelectionSet/Directive/_stream.ts new file mode 100644 index 000000000..85be0c54b --- /dev/null +++ b/src/layers/3_SelectionSet/Directive/_stream.ts @@ -0,0 +1 @@ +export * as Stream from './stream.js' diff --git a/src/layers/3_SelectionSet/Directive/defer.ts b/src/layers/3_SelectionSet/Directive/defer.ts new file mode 100644 index 000000000..839a0ad3d --- /dev/null +++ b/src/layers/3_SelectionSet/Directive/defer.ts @@ -0,0 +1,37 @@ +import type { DirectiveLike } from './$types.js' + +export const name = `defer` + +export interface Defer extends DirectiveLike { + name: typeof name + args: { + if: boolean + label: string | undefined + } +} + +export const create = (input: Input): Defer => { + const args = { + if: typeof input === `boolean` ? input : input.if === undefined ? true : input.if, + label: typeof input === `boolean` ? undefined : input.label, + } + return { + name, + args, + } +} + +/** + * @see https://github.com/graphql/graphql-wg/blob/main/rfcs/DeferStream.md#defer + */ +export type Input = boolean | { + if?: boolean + label?: string +} + +export interface Field { + /** + * https://spec.graphql.org/draft/#sec--defer + */ + $defer?: Input +} diff --git a/src/layers/3_SelectionSet/Directive/include.ts b/src/layers/3_SelectionSet/Directive/include.ts new file mode 100644 index 000000000..82d4db5d5 --- /dev/null +++ b/src/layers/3_SelectionSet/Directive/include.ts @@ -0,0 +1,43 @@ +import type { DirectiveLike } from './$types.js' + +export const name = `include` + +export interface Include extends DirectiveLike { + name: typeof name + args: { + if: boolean + } +} + +export const create = (input: Input): Include => { + const args = { + if: typeof input === `boolean` ? input : input.if === undefined ? true : input.if, + } + return { + name, + args, + } +} + +/** + * https://spec.graphql.org/draft/#sec--include + */ +export type Input = boolean | { + if?: boolean +} + +export interface Field { + /** + * https://spec.graphql.org/draft/#sec--include + */ + $include?: Input +} + +export namespace FieldStates { + export interface Positive { + $include: true | { if: true } + } + export interface Negative { + $include: false | { if: false } + } +} diff --git a/src/layers/3_SelectionSet/Directive/skip.ts b/src/layers/3_SelectionSet/Directive/skip.ts new file mode 100644 index 000000000..cc863d67f --- /dev/null +++ b/src/layers/3_SelectionSet/Directive/skip.ts @@ -0,0 +1,43 @@ +import type { DirectiveLike } from './$types.js' + +export const name = `skip` + +export interface Skip extends DirectiveLike { + name: typeof name + args: { + if: boolean + } +} + +export const create = (input: Input): Skip => { + const args = { + if: typeof input === `boolean` ? input : input.if === undefined ? true : input.if, + } + return { + name, + args, + } +} + +/** + * https://spec.graphql.org/draft/#sec--skip + */ +export type Input = boolean | { + if?: boolean +} + +export interface Field { + /** + * https://spec.graphql.org/draft/#sec--skip + */ + $skip?: Input +} + +export namespace FieldStates { + export interface Positive { + $skip: true | { if: true } + } + export interface Negative { + $skip: false | { if: false } + } +} diff --git a/src/layers/3_SelectionSet/Directive/stream.ts b/src/layers/3_SelectionSet/Directive/stream.ts new file mode 100644 index 000000000..5f2c088d0 --- /dev/null +++ b/src/layers/3_SelectionSet/Directive/stream.ts @@ -0,0 +1,40 @@ +import type { DirectiveLike } from './$types.js' + +export const name = `stream` + +export interface Stream extends DirectiveLike { + name: typeof name + args: { + if: boolean + label: string | undefined + initialCount: number | undefined + } +} + +export const create = (input: Input): Stream => { + const args = { + if: typeof input === `boolean` ? input : input.if === undefined ? true : input.if, + label: typeof input === `boolean` ? undefined : input.label, + initialCount: typeof input === `boolean` ? undefined : input.initialCount, + } + return { + name, + args, + } +} + +/** + * @see https://github.com/graphql/graphql-wg/blob/main/rfcs/DeferStream.md#stream + */ +export type Input = boolean | { + if?: boolean + label?: string + initialCount?: number +} + +export interface Field { + /** + * @see https://github.com/graphql/graphql-wg/blob/main/rfcs/DeferStream.md#stream + */ + $stream?: Input +} diff --git a/src/layers/3_SelectionSet/_.ts b/src/layers/3_SelectionSet/_.ts index cdec9c30d..f2bf8f3ab 100644 --- a/src/layers/3_SelectionSet/_.ts +++ b/src/layers/3_SelectionSet/_.ts @@ -1,3 +1,5 @@ -export * as Print from './encode.js' -export * as On from './runtime/on.js' +export * from './_indicator.js' +export type { Directive } from './Directive/__.js' +export * as On from './on.js' +export * as Print from './print.js' export * from './types.js' diff --git a/src/layers/3_SelectionSet/__snapshots__/encode.test.ts.snap b/src/layers/3_SelectionSet/__snapshots__/print.test.ts.snap similarity index 100% rename from src/layers/3_SelectionSet/__snapshots__/encode.test.ts.snap rename to src/layers/3_SelectionSet/__snapshots__/print.test.ts.snap diff --git a/src/layers/3_SelectionSet/_indicator.ts b/src/layers/3_SelectionSet/_indicator.ts new file mode 100644 index 000000000..33c390fee --- /dev/null +++ b/src/layers/3_SelectionSet/_indicator.ts @@ -0,0 +1 @@ +export * as Indicator from './indicator.js' diff --git a/src/layers/3_SelectionSet/helpers.ts b/src/layers/3_SelectionSet/helpers.ts index 5d8341da3..ffc0c2e6b 100644 --- a/src/layers/3_SelectionSet/helpers.ts +++ b/src/layers/3_SelectionSet/helpers.ts @@ -1,3 +1,3 @@ -export const isSpecialFieldName = (fieldName: string) => fieldName.startsWith(`$`) +export const isClientKey = (fieldName: string) => fieldName.startsWith(`$`) -export const isSelectFieldName = (fieldName: string) => !isSpecialFieldName(fieldName) +export const isSelectFieldName = (fieldName: string) => !isClientKey(fieldName) diff --git a/src/layers/3_SelectionSet/indicator.ts b/src/layers/3_SelectionSet/indicator.ts new file mode 100644 index 000000000..a82654edb --- /dev/null +++ b/src/layers/3_SelectionSet/indicator.ts @@ -0,0 +1,57 @@ +import type { Simplify } from 'type-fest' +import type { ExcludeNull, UnionExpanded } from '../../lib/prelude.js' +import type { Schema, SomeField } from '../1_Schema/__.js' +import type { Directive } from './_.js' +import type { Args } from './types.js' + +/** + * Should this field be selected? + */ +export type ClientIndicator = UnionExpanded + +export type ClientIndicatorPositive = true + +export type ClientIndicatorNegative = UnionExpanded + +export type Indicator = boolean + +export const isIndicator = (v: any): v is Indicator => { + return String(v) in indicator +} + +export const isPositiveIndicator = (v: any): v is ClientIndicatorPositive => { + return !(String(v) in negativeIndicator) +} + +const negativeIndicator = { + 'false': false, + 'undefined': undefined, +} + +const positiveIndicator = { + 'true': true, +} + +const indicator = { + ...negativeIndicator, + ...positiveIndicator, +} + +/** + * Field selection in general, with directives support too. + * If a field directive is given as an indicator then it implies "select this" e.g. `true`/`1`. + * Of course the semantics of the directive may change the derived type (e.g. `skip` means the field might not show up in the result set) + */ +export type NoArgsIndicator = ClientIndicator | Directive.$Fields + +export type NoArgsIndicator$Expanded = UnionExpanded> + +export type ArgsIndicator<$Args extends Schema.Args> = $Args['isFieldsAllNullable'] extends true + ? ({ $?: Args<$Args> } & Directive.$Fields) | ClientIndicator + : { $: Args<$Args> } & Directive.$Fields + +// dprint-ignore +export type IndicatorForField<$Field extends SomeField> = + $Field['args'] extends null + ? NoArgsIndicator + : ArgsIndicator> diff --git a/src/layers/3_SelectionSet/runtime/on.ts b/src/layers/3_SelectionSet/on.ts similarity index 72% rename from src/layers/3_SelectionSet/runtime/on.ts rename to src/layers/3_SelectionSet/on.ts index ce9320d1c..4a35b8681 100644 --- a/src/layers/3_SelectionSet/runtime/on.ts +++ b/src/layers/3_SelectionSet/on.ts @@ -1,6 +1,9 @@ +import type { OmitKeysWithPrefix } from '../../lib/prelude.js' +import type { Any } from './types.js' + export const prefix = `___on_` -export type prefix = typeof prefix +export type KeyPrefix = typeof prefix export const onPattern = new RegExp(`^${prefix}(?[A-Z][A-z_0-9]*)$`) @@ -24,3 +27,5 @@ export const parseClientOn = (field: string): null | On => { export const toGraphQLOn = (on: On) => { return `...on ${on.typeOrFragmentName}` } + +export type OmitOnTypeFragments<$Object extends Any> = OmitKeysWithPrefix<$Object, KeyPrefix> diff --git a/src/layers/3_SelectionSet/encode.test.ts b/src/layers/3_SelectionSet/print.test.ts similarity index 98% rename from src/layers/3_SelectionSet/encode.test.ts rename to src/layers/3_SelectionSet/print.test.ts index ae3b2cfa0..d86c41cfd 100644 --- a/src/layers/3_SelectionSet/encode.test.ts +++ b/src/layers/3_SelectionSet/print.test.ts @@ -4,8 +4,8 @@ import { db } from '../../../tests/_/db.js' import { $Index as schemaIndex } from '../../../tests/_/schema/generated/modules/SchemaRuntime.js' import type * as SelectionSets from '../../../tests/_/schema/generated/modules/SelectionSets.js' import { outputConfigDefault } from '../6_client/Settings/Config.js' -import type { Context } from './encode.js' -import { resolveRootType } from './encode.js' +import type { Context } from './print.js' +import { resolveRootType } from './print.js' // eslint-disable-next-line // @ts-ignore diff --git a/src/layers/3_SelectionSet/encode.ts b/src/layers/3_SelectionSet/print.ts similarity index 85% rename from src/layers/3_SelectionSet/encode.ts rename to src/layers/3_SelectionSet/print.ts index 4141936a8..2e33084c4 100644 --- a/src/layers/3_SelectionSet/encode.ts +++ b/src/layers/3_SelectionSet/print.ts @@ -1,29 +1,20 @@ import { RootTypeName } from '../../lib/graphql.js' -import { assertArray, assertObject, lowerCaseFirstLetter } from '../../lib/prelude.js' +import { assertArray, assertObject, entriesStrict, lowerCaseFirstLetter } from '../../lib/prelude.js' import { Schema } from '../1_Schema/__.js' import { readMaybeThunk } from '../1_Schema/core/helpers.js' import type { Config } from '../6_client/Settings/Config.js' -import type { SelectionSet } from './__.js' +import { Directive } from './Directive/__.js' import { isSelectFieldName } from './helpers.js' -import { parseClientDirectiveDefer } from './runtime/directives/defer.js' -import { toGraphQLDirective } from './runtime/directives/directive.js' -import { parseClientDirectiveInclude } from './runtime/directives/include.js' -import { parseClientDirectiveSkip } from './runtime/directives/skip.js' -import { parseClientDirectiveStream } from './runtime/directives/stream.js' +import type { Indicator } from './indicator.js' +import { isIndicator, isPositiveIndicator } from './indicator.js' +import { parseClientOn, toGraphQLOn } from './on.js' import { parseClientFieldItem } from './runtime/FieldItem.js' import { createFieldName } from './runtime/FieldName.js' -import type { Indicator } from './runtime/indicator.js' -import { isIndicator, isPositiveIndicator } from './runtime/indicator.js' -import { parseClientOn, toGraphQLOn } from './runtime/on.js' import { normalizeAlias } from './types.js' -type SpecialFields = { +interface SpecialFields extends Directive.$Fields { // todo - this requires having the schema at runtime to know which fields to select. // $scalars?: SelectionSet.Indicator - $include?: SelectionSet.Directive.IncludeField['$include'] - $skip?: SelectionSet.Directive.SkipField['$skip'] - $defer?: SelectionSet.Directive.DeferField['$defer'] - $stream?: SelectionSet.Directive.StreamField['$stream'] $?: Args } @@ -256,34 +247,23 @@ export const resolveField = ( return `${field.name} ${resolveFieldValue(context, schemaField, field.value)}` } -export const resolveOn = (field: string) => { +export const resolveOn = (field: string): string => { const on = parseClientOn(field) if (on) return toGraphQLOn(on) return field } -const resolveDirectives = (fieldValue: FieldValue) => { +const resolveDirectives = (fieldValue: FieldValue): string => { if (isIndicator(fieldValue)) return `` - const { $include, $skip, $defer, $stream } = fieldValue - - let directives = `` - - if ($stream !== undefined) { - directives += toGraphQLDirective(parseClientDirectiveStream($stream)) - } - - if ($defer !== undefined) { - directives += toGraphQLDirective(parseClientDirectiveDefer($defer)) - } - - if ($include !== undefined) { - directives += toGraphQLDirective(parseClientDirectiveInclude($include)) - } - - if ($skip !== undefined) { - directives += toGraphQLDirective(parseClientDirectiveSkip($skip)) - } - - return directives + return entriesStrict({ + $skip: fieldValue.$skip, + $include: fieldValue.$include, + $defer: fieldValue.$defer, + $stream: fieldValue.$stream, + }).reduce((code, [field, input]) => { + const def = Directive.fieldToDef[field] + code += Directive.Print.toGraphQLDirective(def.create(input)) + return code + }, ``) } diff --git a/src/layers/3_SelectionSet/runtime/FieldItem.ts b/src/layers/3_SelectionSet/runtime/FieldItem.ts index e9fb4dfec..f0cd0cb20 100644 --- a/src/layers/3_SelectionSet/runtime/FieldItem.ts +++ b/src/layers/3_SelectionSet/runtime/FieldItem.ts @@ -1,7 +1,7 @@ +import type { On } from '../on.js' +import { parseClientOn } from '../on.js' import type { FieldName } from './FieldName.js' import { createFieldName } from './FieldName.js' -import type { On } from './on.js' -import { parseClientOn } from './on.js' export type FieldItem = On | FieldName diff --git a/src/layers/3_SelectionSet/runtime/directives/defer.ts b/src/layers/3_SelectionSet/runtime/directives/defer.ts deleted file mode 100644 index 1de096bdb..000000000 --- a/src/layers/3_SelectionSet/runtime/directives/defer.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { Directive } from '../../types.js' - -const name = `defer` - -export const parseClientDirectiveDefer = (input: Directive.DeferField['$defer']) => { - const args = { - if: typeof input === `boolean` ? input : input.if === undefined ? true : input.if, - label: typeof input === `boolean` ? undefined : input.label, - } - return { - name, - args, - } -} diff --git a/src/layers/3_SelectionSet/runtime/directives/include.ts b/src/layers/3_SelectionSet/runtime/directives/include.ts deleted file mode 100644 index e49c633ae..000000000 --- a/src/layers/3_SelectionSet/runtime/directives/include.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Directive } from '../../types.js' - -const name = `include` - -export const parseClientDirectiveInclude = (input: Directive.IncludeField['$include']) => { - const args = { - if: typeof input === `boolean` ? input : input.if === undefined ? true : input.if, - } - return { - name, - args, - } -} diff --git a/src/layers/3_SelectionSet/runtime/directives/skip.ts b/src/layers/3_SelectionSet/runtime/directives/skip.ts deleted file mode 100644 index 022a26d09..000000000 --- a/src/layers/3_SelectionSet/runtime/directives/skip.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { Directive } from '../../types.js' - -const name = `skip` - -export const parseClientDirectiveSkip = (input: Directive.SkipField['$skip']) => { - const args = { - if: typeof input === `boolean` ? input : input.if === undefined ? true : input.if, - } - return { - name, - args, - } -} diff --git a/src/layers/3_SelectionSet/runtime/directives/stream.ts b/src/layers/3_SelectionSet/runtime/directives/stream.ts deleted file mode 100644 index 68fc91993..000000000 --- a/src/layers/3_SelectionSet/runtime/directives/stream.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { Directive } from '../../types.js' - -const name = `stream` - -export const parseClientDirectiveStream = (input: Directive.StreamField['$stream']) => { - const args = { - if: typeof input === `boolean` ? input : input.if === undefined ? true : input.if, - label: typeof input === `boolean` ? undefined : input.label, - initialCount: typeof input === `boolean` ? undefined : input.initialCount, - } - return { - name, - args, - } -} diff --git a/src/layers/3_SelectionSet/runtime/indicator.ts b/src/layers/3_SelectionSet/runtime/indicator.ts deleted file mode 100644 index fe1b5a611..000000000 --- a/src/layers/3_SelectionSet/runtime/indicator.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { ClientIndicatorPositive } from '../types.js' - -export type Indicator = 0 | 1 | boolean - -export const isIndicator = (v: any): v is Indicator => { - return String(v) in indicator -} - -export const isPositiveIndicator = (v: any): v is ClientIndicatorPositive => { - return !(String(v) in negativeIndicator) -} - -const negativeIndicator = { - '0': 0, - 'false': false, - 'undefined': undefined, -} - -const positiveIndicator = { - '1': 1, - 'true': true, -} - -const indicator = { - ...negativeIndicator, - ...positiveIndicator, -} diff --git a/src/layers/3_SelectionSet/types.ts b/src/layers/3_SelectionSet/types.ts index 0c420dcc6..ea6fad15e 100644 --- a/src/layers/3_SelectionSet/types.ts +++ b/src/layers/3_SelectionSet/types.ts @@ -1,174 +1,20 @@ -import type { Simplify } from 'type-fest' -import type { ExcludeNull, MaybeList, StringNonEmpty, UnionExpanded, Values } from '../../lib/prelude.js' import type { TSError } from '../../lib/TSError.js' -import type { OmitNullableFields, PickNullableFields, Schema, SomeField, SomeFields } from '../1_Schema/__.js' -import type { prefix } from './runtime/on.js' +import type { OmitNullableFields, PickNullableFields, Schema } from '../1_Schema/__.js' +import type { Indicator } from './_indicator.js' +import type { Directive } from './Directive/__.js' -export type Query<$Index extends Schema.Index> = RootViaObject<$Index, $Index['Root']['Query']> +export type Any = object -export type Mutation<$Index extends Schema.Index> = RootViaObject<$Index, $Index['Root']['Mutation']> - -export type Subscription<$Index extends Schema.Index> = RootViaObject<$Index, $Index['Root']['Subscription']> - -export type RootViaObject<$Index extends Schema.Index, $RootType extends null | Schema.Output.RootType> = - $RootType extends null ? never - : Object, $Index> - -export type Root<$Index extends Schema.Index, $RootTypeName extends Schema.RootTypeName> = RootViaObject< - $Index, - $Index['Root'][$RootTypeName] -> - -// dprint-ignore -export type Object<$Object extends Schema.Object$2, $Index extends Schema.Index> = - Fields<$Object['fields'], $Index> - -// dprint-ignore -type Fields<$Fields extends SomeFields, $Index extends Schema.Index> = - & - { - [Key in keyof $Fields]?: - // eslint-disable-next-line - // @ts-ignore excessive deep error, fixme? - Field<$Fields[Key], $Index> - } -/** - * Alias support. - * Allow every field to also be given as a key with this pattern `_as_: ...` - */ -// & -// { -// [ -// // It seems that non-empty string has a very high cost in TS. -// // Key in keyof $Fields & string as `${Key}_as_${StringNonEmpty}` -// Key in keyof $Fields & string as `${Key}_as_${string}` -// ]?: -// Field<$Fields[Key], $Index> -// } -& -{ - /** - * Inline fragments for field groups. - * @see https://spec.graphql.org/draft/#sec-Inline-Fragments - */ - ___?: MaybeList & Directive.$Fields> - /** - * Special property to select all scalars. - */ - $scalars?: ClientIndicator -} - -export type IsSelectScalarsWildcard = SS extends { $scalars: ClientIndicatorPositive } ? true : false - -type FieldOptions = { - /** - * When using root type field methods there is no point in directives since there can be - * no no peer fields with those function that by design target sending one root type field. - */ - hideDirectives?: boolean -} - -type FieldOptionsDefault = { hideDirectives: false } - -// dprint-ignore -export type Field<$Field extends SomeField, $Index extends Schema.Index, $Options extends FieldOptions = FieldOptionsDefault> = - Field_<$Field['type'], $Field, $Index, $Options> - -// dprint-ignore -export type Field_< - $type extends Schema.Output.Any, - $Field extends SomeField, - $Index extends Schema.Index, - $Options extends FieldOptions -> = - $type extends Schema.Output.Nullable ? Field_<$typeInner, $Field, $Index, $Options> : - $type extends Schema.Output.List ? Field_<$typeInner, $Field, $Index, $Options> : - $type extends Schema.__typename ? NoArgsIndicator : - $type extends Schema.Scalar.Any ? Indicator<$Field> : // eslint-disable - $type extends Schema.Enum ? Indicator<$Field> : - $type extends Schema.Object$2 ? Object<$type, $Index> & ($Options['hideDirectives'] extends true ? {} : Directive.$Fields) & Arguments<$Field> : - $type extends Schema.Union ? Union<$type, $Index> & Arguments<$Field> : - $type extends Schema.Interface ? Interface<$type, $Index> & Arguments<$Field> : - TSError<'Field', '$Field case not handled', { $Field: $Field }> -// dprint-ignore -type Arguments<$Field extends SomeField> = - $Field['args'] extends Schema.Args ? $Field['args']['isFieldsAllNullable'] extends true ? { $?: Args<$Field['args']> } : - { $: Args<$Field['args']> } : - {} - -// dprint-ignore -export type Interface<$Node extends Schema.Interface, $Index extends Schema.Index> = - & InterfaceDistributed<$Node['implementors'][number], $Index> - & Fields< - & $Node['fields'] - & { - __typename: $Node['implementors'][number]['fields']['__typename'] - }, - $Index - > - -// dprint-ignore -type InterfaceDistributed<$Node extends Schema.Object$2, $Index extends Schema.Index> = - $Node extends any - ? { - [$typename in $Node['fields']['__typename']['type']['type'] as `on${Capitalize<$typename>}`]?: - Object<$Node, $Index> & Directive.$Fields - } - : never - -// dprint-ignore -export type Union<$Node extends Schema.Union, $Index extends Schema.Index> = - & UnionDistributed<$Node['members'][number], $Index> - & { __typename?: NoArgsIndicator } - -// dprint-ignore -type UnionDistributed<$Object extends Schema.Object$2,$Index extends Schema.Index> = - $Object extends any - ? { - [$typename in $Object['fields']['__typename']['type']['type'] as `on${Capitalize<$typename>}`]?: - Object<$Object, $Index> & Directive.$Fields - } - : never - -/** - * Helpers - * --------------------------------------------------------------------------------------------------- - */ - -/** - * Unions - */ - -export type UnionFragmentExtractName = T extends `on${infer $Name}` ? $Name : never -export type UnionExtractFragmentNames = Values< - { - [Key in keyof T]: UnionFragmentExtractName - } -> -export type OmitOnTypeFragments = { - [$K in keyof T as $K extends `${prefix}${StringNonEmpty}` ? never : $K]: T[$K] -} - -/** - * Indicators - */ - -/** - * Should this field be selected? - */ -export type ClientIndicator = UnionExpanded -// todo bring back 1 | 0 in addition to true|false as generator options, defaulting to off -export type ClientIndicatorPositive = true -export type ClientIndicatorNegative = UnionExpanded +export type IsSelectScalarsWildcard = SS extends { $scalars: Indicator.ClientIndicatorPositive } ? true : false export type OmitNegativeIndicators<$SelectionSet> = { - [K in keyof $SelectionSet as $SelectionSet[K] extends ClientIndicatorNegative ? never : K]: $SelectionSet[K] + [K in keyof $SelectionSet as $SelectionSet[K] extends Indicator.ClientIndicatorNegative ? never : K]: $SelectionSet[K] } // dprint-ignore export type PickPositiveNonAliasIndicators<$SelectionSet> = { [ - $FieldExpression in keyof $SelectionSet as $SelectionSet[$FieldExpression] extends ClientIndicatorNegative + $FieldExpression in keyof $SelectionSet as $SelectionSet[$FieldExpression] extends Indicator.ClientIndicatorNegative ? never : $SelectionSet[$FieldExpression] extends any[] ? never @@ -176,22 +22,6 @@ export type PickPositiveNonAliasIndicators<$SelectionSet> = { ]: $SelectionSet[$FieldExpression] } -// dprint-ignore -export type Indicator<$Field extends SomeField> = - $Field['args'] extends null ? NoArgsIndicator : ArgsIndicator> - -/** - * Field selection in general, with directives support too. - * If a field directive is given as an indicator then it implies "select this" e.g. `true`/`1`. - * Of course the semantics of the directive may change the derived type (e.g. `skip` means the field might not show up in the result set) - */ -export type NoArgsIndicator = ClientIndicator | Directive.$Fields -export type NoArgsIndicator$Expanded = UnionExpanded> - -type ArgsIndicator<$Args extends Schema.Args> = $Args['isFieldsAllNullable'] extends true - ? ({ $?: Args<$Args> } & Directive.$Fields) | ClientIndicator - : { $: Args<$Args> } & Directive.$Fields - // dprint-ignore export type Args<$Args extends Schema.Args> = ArgFields<$Args['fields']> @@ -222,7 +52,7 @@ export namespace Bases { /** * Special property to select all scalars. */ - $scalars?: ClientIndicator + $scalars?: Indicator.ClientIndicator } } @@ -231,69 +61,6 @@ export namespace Bases { */ // dprint-ignore -export namespace Directive { -/** - * @see https://spec.graphql.org/draft/#sec-Type-System.Directives.Built-in-Directives - */ -export interface $Fields { - /** - * https://spec.graphql.org/draft/#sec--skip - */ - $skip?: Skip - /** - * https://spec.graphql.org/draft/#sec--include - */ - $include?: Include - /** - * @see https://github.com/graphql/graphql-wg/blob/main/rfcs/DeferStream.md#defer - */ - $defer?: Defer - /** - * @see https://github.com/graphql/graphql-wg/blob/main/rfcs/DeferStream.md#stream - */ - $stream?: Stream -} - -/** - * https://spec.graphql.org/draft/#sec--include - */ - export type Include = boolean | { if?: boolean } - export interface IncludeField { $include: Include } - export namespace Include { - export interface Positive { $include: true | { if: true } } - export interface Negative { $include: false | { if: false } } - } - -/** - * https://spec.graphql.org/draft/#sec--skip - */ - export type Skip = boolean | { if?: boolean } - export interface SkipField { $skip: Skip } - export namespace Skip { - export interface Positive { $skip: true | { if: true } } - export interface Negative { $skip: false | { if: false } } - } - -/** - * @see https://github.com/graphql/graphql-wg/blob/main/rfcs/DeferStream.md#defer - */ - export type Defer = boolean | { if?: boolean; label?: string } - export interface DeferField { $defer: Defer } - export namespace Defer { - export interface Positive { $defer: true | { if: true } } - export interface Negative { $defer: false | { if: false } } - } - -/** - * @see https://github.com/graphql/graphql-wg/blob/main/rfcs/DeferStream.md#stream - */ - export type Stream = boolean | { if?: boolean; label?: string; initialCount?: number } - export interface StreamField { $stream: Stream } - export namespace Stream { - export interface Positive { $stream: true | { if: true } } - export interface Negative { $stream: false | { if: false } } - } -} export type AliasInputOne<$SelectionSet = unknown> = [alias: string, selectionSet: $SelectionSet] diff --git a/src/layers/4_ResultSet/types.ts b/src/layers/4_ResultSet/types.ts index cf607a676..4e952b94e 100644 --- a/src/layers/4_ResultSet/types.ts +++ b/src/layers/4_ResultSet/types.ts @@ -4,7 +4,6 @@ import type { TSError } from '../../lib/TSError.js' import type { Schema, SomeField } from '../1_Schema/__.js' import type { PickScalarFields } from '../1_Schema/Output/Output.js' import type { SelectionSet } from '../3_SelectionSet/__.js' -import type { prefix } from '../3_SelectionSet/runtime/on.js' import type { PickPositiveNonAliasIndicators } from '../3_SelectionSet/types.js' export type RootViaObject< @@ -128,18 +127,18 @@ type HandleAliasExpressionSingle< } // dprint-ignore -export type Union<$SelectionSet, $Index extends Schema.Index, $Node extends Schema.Output.Union> = +export type Union<$SelectionSet extends SelectionSet.Any, $Index extends Schema.Index, $Node extends Schema.Output.Union> = OnTypeFragment<$SelectionSet, $Node['members'][number], $Index> // dprint-ignore -export type Interface<$SelectionSet, $Index extends Schema.Index, $Node extends Schema.Output.Interface> = +export type Interface<$SelectionSet extends SelectionSet.Any, $Index extends Schema.Index, $Node extends Schema.Output.Interface> = OnTypeFragment<$SelectionSet, $Node['implementors'][number], $Index> // dprint-ignore -type OnTypeFragment<$SelectionSet, $Node extends Schema.Output.Object$2, $Index extends Schema.Index> = +type OnTypeFragment<$SelectionSet extends SelectionSet.Any, $Node extends Schema.Output.Object$2, $Index extends Schema.Index> = $Node extends any // force distribution ? Object$< - GetKeyOr<$SelectionSet, `${prefix}${$Node['fields']['__typename']['type']['type']}`, {}> & SelectionSet.OmitOnTypeFragments<$SelectionSet>, + GetKeyOr<$SelectionSet, `${SelectionSet.On.KeyPrefix}${$Node['fields']['__typename']['type']['type']}`, {}> & SelectionSet.On.OmitOnTypeFragments<$SelectionSet>, $Index, $Node > @@ -148,7 +147,7 @@ type OnTypeFragment<$SelectionSet, $Node extends Schema.Output.Object$2, $Index // dprint-ignore export type Field<$SelectionSet, $Field extends SomeField, $Index extends Schema.Index> = Simplify< - $SelectionSet extends SelectionSet.Directive.Include.Negative | SelectionSet.Directive.Skip.Positive ? + $SelectionSet extends SelectionSet.Directive.Include.FieldStates.Negative | SelectionSet.Directive.Skip.FieldStates.Positive ? null : ( | FieldDirectiveInclude<$SelectionSet> @@ -159,7 +158,7 @@ export type Field<$SelectionSet, $Field extends SomeField, $Index extends Schema // dprint-ignore type FieldType< - $SelectionSet, + $SelectionSet extends SelectionSet.Any, $Type extends Schema.Output.Any, $Index extends Schema.Index > = @@ -168,21 +167,21 @@ type FieldType< $Type extends Schema.Output.List ? Array> : $Type extends Schema.Enum ? $Members[number] : $Type extends Schema.Scalar.Any ? ReturnType<$Type['codec']['decode']> : - $Type extends Schema.Object$2 ? Object$<$SelectionSet,$Index,$Type> : - $Type extends Schema.Interface ? Interface<$SelectionSet,$Index,$Type> : - $Type extends Schema.Union ? Union<$SelectionSet,$Index,$Type> : + $Type extends Schema.Object$2 ? Object$<$SelectionSet, $Index, $Type> : + $Type extends Schema.Interface ? Interface<$SelectionSet, $Index, $Type> : + $Type extends Schema.Union ? Union<$SelectionSet, $Index, $Type> : TSError<'FieldType', `Unknown type`, { $Type: $Type }> // dprint-ignore type FieldDirectiveInclude<$SelectionSet> = - $SelectionSet extends SelectionSet.Directive.IncludeField ? $SelectionSet extends SelectionSet.Directive.Include.Positive ? + $SelectionSet extends SelectionSet.Directive.Include.Field ? $SelectionSet extends SelectionSet.Directive.Include.FieldStates.Positive ? never : null : never // dprint-ignore type FieldDirectiveSkip<$SelectionSet> = - $SelectionSet extends SelectionSet.Directive.SkipField ? $SelectionSet extends SelectionSet.Directive.Skip.Negative ? + $SelectionSet extends SelectionSet.Directive.Skip.Field ? $SelectionSet extends SelectionSet.Directive.Skip.FieldStates.Negative ? never : null : never diff --git a/src/layers/5_core/core.ts b/src/layers/5_core/core.ts index 67d9fdb59..2326f2815 100644 --- a/src/layers/5_core/core.ts +++ b/src/layers/5_core/core.ts @@ -20,7 +20,7 @@ import { casesExhausted, throwNull } from '../../lib/prelude.js' import { execute } from '../0_functions/execute.js' import type { Schema } from '../1_Schema/__.js' import { SelectionSet } from '../3_SelectionSet/__.js' -import type { GraphQLObjectSelection } from '../3_SelectionSet/encode.js' +import type { GraphQLObjectSelection } from '../3_SelectionSet/print.js' import * as Result from '../4_ResultSet/customScalars.js' import type { GraffleExecutionResultVar } from '../6_client/client.js' import type { Config } from '../6_client/Settings/Config.js' diff --git a/src/layers/6_client/client.ts b/src/layers/6_client/client.ts index bcdadf060..5b4cd926c 100644 --- a/src/layers/6_client/client.ts +++ b/src/layers/6_client/client.ts @@ -11,7 +11,7 @@ import type { BaseInput, BaseInput_, TypedDocumentString } from '../0_functions/ import { Schema } from '../1_Schema/__.js' import { readMaybeThunk } from '../1_Schema/core/helpers.js' import type { GlobalRegistry } from '../2_generator/globalRegistry.js' -import type { DocumentObject, GraphQLObjectSelection } from '../3_SelectionSet/encode.js' +import type { DocumentObject, GraphQLObjectSelection } from '../3_SelectionSet/print.js' import { Core } from '../5_core/__.js' import { type HookDefEncode } from '../5_core/core.js' import { type InterfaceRaw, type TransportHttp } from '../5_core/types.js' diff --git a/src/layers/6_client/document.ts b/src/layers/6_client/document.ts index 23044a22e..fdc62dbdb 100644 --- a/src/layers/6_client/document.ts +++ b/src/layers/6_client/document.ts @@ -9,7 +9,7 @@ import { import type { FirstNonUnknownNever, IsKeyInObjectOptional, IsTupleMultiple, Values } from '../../lib/prelude.js' import type { Schema } from '../1_Schema/__.js' import { SelectionSet } from '../3_SelectionSet/__.js' -import type { Context, DocumentObject } from '../3_SelectionSet/encode.js' +import type { Context, DocumentObject } from '../3_SelectionSet/print.js' import type { ResultSet } from '../4_ResultSet/__.js' import type { ResolveOutputReturnRootType } from './handleOutput.js' import type { AddTypenameToSelectedRootTypeResultFields, Config } from './Settings/Config.js' diff --git a/src/lib/prelude.ts b/src/lib/prelude.ts index 8ebfb3947..99e575fa4 100644 --- a/src/lib/prelude.ts +++ b/src/lib/prelude.ts @@ -1,6 +1,7 @@ import type { IsEmptyObject, IsNever, IsUnknown, Simplify } from 'type-fest' import type { ConditionalSimplify, ConditionalSimplifyDeep } from 'type-fest/source/conditional-simplify.js' +import type { ExcludeUndefined } from 'type-fest/source/required-deep.js' /* eslint-disable */ export type RemoveIndex = { @@ -91,6 +92,10 @@ export const isRecordLikeObject = (value: unknown): value is Record>(obj: T) => Object.entries(obj) as [keyof T, T[keyof T]][] +// dprint-ignore +export const entriesStrict = >(obj: T): { [K in keyof T]: [K, ExcludeUndefined] }[keyof T][] => + Object.entries(obj).filter(([_, value]) => value !== undefined) as any + export const values = >(obj: T): T[keyof T][] => Object.values(obj) as T[keyof T][] export type ExactNonEmpty<$Value, $Constraint> = IsEmptyObject<$Value> extends true ? never : Exact<$Value, $Constraint> @@ -175,11 +180,11 @@ export type LetterUpper = | 'Y' | 'Z' -export type StringNonEmpty = `${Letter}${string}` +// export type StringNonEmpty = `${Letter}${string}` -export type MaybeList = T | T[] +// export type MaybeList = T | T[] -export type NotEmptyObject = keyof T extends never ? never : T +// export type NotEmptyObject = keyof T extends never ? never : T export type Values = T[keyof T] @@ -452,6 +457,9 @@ export type SuffixKeyNames<$Suffix extends string, $Object extends object> = { [$Key in keyof $Object & string as `${$Key}${$Suffix}`]: $Object[$Key] } +/** + * Force intellisense to show the given union type expanded. E.g. given `Foo = A | B` then show `A | B` instead of `Foo`. + */ export type UnionExpanded<$Union> = $Union export type mergeObjectArray = T extends [infer $First, ...infer $Rest extends any[]] @@ -469,7 +477,12 @@ export type IsEqual = A extends B ? B extends A ? true : false : false export type AssertIsEqual = IsEqual extends true ? true : never export const AssertIsEqual = ( - ..._: AssertIsEqual extends never ? [reason: { message: `Type B not equal to A`; A: A }] : [] + ..._: IsEqual extends false ? [reason: { + message: `Types not equal` + A: SimplifyDeep + B: SimplifyDeep + }] + : [] ) => undefined export type IfExtendsElse<$Type, $Extends, $Else> = $Type extends $Extends ? $Type : $Else @@ -535,5 +548,12 @@ export type IsKeyInObject = ? true : false -// type Test = IsKeyInObject<{a: 1}, 'a'> // true -// type Test2 = IsKeyInObject<{a: 1}, 'b'> // false +export type OmitKeysWithPrefix<$Object extends object, $Prefix extends string> = { + [ + $Key in keyof $Object as $Key extends `${$Prefix}${infer $Suffix extends string}` + ? $Suffix extends '' ? $Key : never + : $Key + ]: $Object[$Key] +} +AssertIsEqual, { a: 1; b: 2 }>() +AssertIsEqual, { b: 2 }>() diff --git a/tests/_/schema/generated/modules/SelectionSets.ts b/tests/_/schema/generated/modules/SelectionSets.ts index 62aa361e2..1fa60dc4d 100644 --- a/tests/_/schema/generated/modules/SelectionSets.ts +++ b/tests/_/schema/generated/modules/SelectionSets.ts @@ -57,19 +57,21 @@ export interface Mutation { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Mutation { - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator - export type idNonNull$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type idNonNull$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type idNonNull = $SelectionSet.NoArgsIndicator + export type idNonNull = $SelectionSet.Indicator.NoArgsIndicator } // @@ -305,7 +307,9 @@ export interface Query { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | @@ -325,10 +329,10 @@ export namespace Query { > export type InputObjectNested$Expanded = $Utilities.UnionExpanded< - $SelectionSet.ClientIndicator | InputObjectNested$SelectionSet + $SelectionSet.Indicator.ClientIndicator | InputObjectNested$SelectionSet > - export type InputObjectNested = $SelectionSet.ClientIndicator | InputObjectNested$SelectionSet + export type InputObjectNested = $SelectionSet.Indicator.ClientIndicator | InputObjectNested$SelectionSet export type InputObjectNestedNonNull$SelectionSetArguments = { input: _RefDefs._InputObjectNestedNonNull @@ -343,13 +347,13 @@ export namespace Query { export type InputObjectNestedNonNull$Expanded = InputObjectNestedNonNull - export type abcEnum$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type abcEnum$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type abcEnum = $SelectionSet.NoArgsIndicator + export type abcEnum = $SelectionSet.Indicator.NoArgsIndicator - export type date$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type date$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type date = $SelectionSet.NoArgsIndicator + export type date = $SelectionSet.Indicator.NoArgsIndicator export type dateArg$SelectionSetArguments = { date?: $Scalar.DateDecoded | undefined | null @@ -364,9 +368,11 @@ export namespace Query { } > - export type dateArg$Expanded = $Utilities.UnionExpanded<$SelectionSet.ClientIndicator | dateArg$SelectionSet> + export type dateArg$Expanded = $Utilities.UnionExpanded< + $SelectionSet.Indicator.ClientIndicator | dateArg$SelectionSet + > - export type dateArg = $SelectionSet.ClientIndicator | dateArg$SelectionSet + export type dateArg = $SelectionSet.Indicator.ClientIndicator | dateArg$SelectionSet export type dateArgInputObject$SelectionSetArguments = { input?: _RefDefs._InputObject | undefined | null @@ -382,10 +388,10 @@ export namespace Query { > export type dateArgInputObject$Expanded = $Utilities.UnionExpanded< - $SelectionSet.ClientIndicator | dateArgInputObject$SelectionSet + $SelectionSet.Indicator.ClientIndicator | dateArgInputObject$SelectionSet > - export type dateArgInputObject = $SelectionSet.ClientIndicator | dateArgInputObject$SelectionSet + export type dateArgInputObject = $SelectionSet.Indicator.ClientIndicator | dateArgInputObject$SelectionSet export type dateArgList$SelectionSetArguments = { date?: Array<$Scalar.DateDecoded | undefined | null> | undefined | null @@ -400,9 +406,11 @@ export namespace Query { } > - export type dateArgList$Expanded = $Utilities.UnionExpanded<$SelectionSet.ClientIndicator | dateArgList$SelectionSet> + export type dateArgList$Expanded = $Utilities.UnionExpanded< + $SelectionSet.Indicator.ClientIndicator | dateArgList$SelectionSet + > - export type dateArgList = $SelectionSet.ClientIndicator | dateArgList$SelectionSet + export type dateArgList = $SelectionSet.Indicator.ClientIndicator | dateArgList$SelectionSet export type dateArgNonNull$SelectionSetArguments = { date: $Scalar.DateDecoded @@ -445,17 +453,17 @@ export namespace Query { export interface dateInterface1 extends _RefDefs._DateInterface1 {} export type dateInterface1$Expanded = dateInterface1 - export type dateList$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type dateList$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type dateList = $SelectionSet.NoArgsIndicator + export type dateList = $SelectionSet.Indicator.NoArgsIndicator - export type dateListNonNull$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type dateListNonNull$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type dateListNonNull = $SelectionSet.NoArgsIndicator + export type dateListNonNull = $SelectionSet.Indicator.NoArgsIndicator - export type dateNonNull$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type dateNonNull$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type dateNonNull = $SelectionSet.NoArgsIndicator + export type dateNonNull = $SelectionSet.Indicator.NoArgsIndicator export interface dateObject1 extends _RefDefs._DateObject1 {} export type dateObject1$Expanded = dateObject1 @@ -474,17 +482,17 @@ export namespace Query { } > - export type error$Expanded = $Utilities.UnionExpanded<$SelectionSet.ClientIndicator | error$SelectionSet> + export type error$Expanded = $Utilities.UnionExpanded<$SelectionSet.Indicator.ClientIndicator | error$SelectionSet> - export type error = $SelectionSet.ClientIndicator | error$SelectionSet + export type error = $SelectionSet.Indicator.ClientIndicator | error$SelectionSet - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator - export type idNonNull$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type idNonNull$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type idNonNull = $SelectionSet.NoArgsIndicator + export type idNonNull = $SelectionSet.Indicator.NoArgsIndicator export interface $interface extends _RefDefs._Interface {} export type $interface$Expanded = $interface @@ -500,21 +508,21 @@ export namespace Query { } } export type interfaceWithArgs$Expanded = interfaceWithArgs - export type listInt$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type listInt$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type listInt = $SelectionSet.NoArgsIndicator + export type listInt = $SelectionSet.Indicator.NoArgsIndicator - export type listIntNonNull$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type listIntNonNull$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type listIntNonNull = $SelectionSet.NoArgsIndicator + export type listIntNonNull = $SelectionSet.Indicator.NoArgsIndicator - export type listListInt$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type listListInt$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type listListInt = $SelectionSet.NoArgsIndicator + export type listListInt = $SelectionSet.Indicator.NoArgsIndicator - export type listListIntNonNull$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type listListIntNonNull$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type listListIntNonNull = $SelectionSet.NoArgsIndicator + export type listListIntNonNull = $SelectionSet.Indicator.NoArgsIndicator export interface lowerCaseUnion extends _RefDefs._lowerCaseUnion {} export type lowerCaseUnion$Expanded = lowerCaseUnion @@ -562,9 +570,9 @@ export namespace Query { } } export type resultNonNull$Expanded = resultNonNull - export type $string$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type $string$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type $string = $SelectionSet.NoArgsIndicator + export type $string = $SelectionSet.Indicator.NoArgsIndicator export type stringWithArgEnum$SelectionSetArguments = { ABCEnum?: _RefDefs._ABCEnum | undefined | null @@ -580,10 +588,10 @@ export namespace Query { > export type stringWithArgEnum$Expanded = $Utilities.UnionExpanded< - $SelectionSet.ClientIndicator | stringWithArgEnum$SelectionSet + $SelectionSet.Indicator.ClientIndicator | stringWithArgEnum$SelectionSet > - export type stringWithArgEnum = $SelectionSet.ClientIndicator | stringWithArgEnum$SelectionSet + export type stringWithArgEnum = $SelectionSet.Indicator.ClientIndicator | stringWithArgEnum$SelectionSet export type stringWithArgInputObject$SelectionSetArguments = { input?: _RefDefs._InputObject | undefined | null @@ -599,10 +607,10 @@ export namespace Query { > export type stringWithArgInputObject$Expanded = $Utilities.UnionExpanded< - $SelectionSet.ClientIndicator | stringWithArgInputObject$SelectionSet + $SelectionSet.Indicator.ClientIndicator | stringWithArgInputObject$SelectionSet > - export type stringWithArgInputObject = $SelectionSet.ClientIndicator | stringWithArgInputObject$SelectionSet + export type stringWithArgInputObject = $SelectionSet.Indicator.ClientIndicator | stringWithArgInputObject$SelectionSet export type stringWithArgInputObjectRequired$SelectionSetArguments = { input: _RefDefs._InputObject @@ -635,10 +643,10 @@ export namespace Query { > export type stringWithArgs$Expanded = $Utilities.UnionExpanded< - $SelectionSet.ClientIndicator | stringWithArgs$SelectionSet + $SelectionSet.Indicator.ClientIndicator | stringWithArgs$SelectionSet > - export type stringWithArgs = $SelectionSet.ClientIndicator | stringWithArgs$SelectionSet + export type stringWithArgs = $SelectionSet.Indicator.ClientIndicator | stringWithArgs$SelectionSet export type stringWithListArg$SelectionSetArguments = { ints?: Array | undefined | null @@ -654,10 +662,10 @@ export namespace Query { > export type stringWithListArg$Expanded = $Utilities.UnionExpanded< - $SelectionSet.ClientIndicator | stringWithListArg$SelectionSet + $SelectionSet.Indicator.ClientIndicator | stringWithListArg$SelectionSet > - export type stringWithListArg = $SelectionSet.ClientIndicator | stringWithListArg$SelectionSet + export type stringWithListArg = $SelectionSet.Indicator.ClientIndicator | stringWithListArg$SelectionSet export type stringWithListArgRequired$SelectionSetArguments = { ints: Array @@ -804,13 +812,15 @@ export interface DateInterface1 extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } export namespace DateInterface1 { - export type date1$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type date1$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type date1 = $SelectionSet.NoArgsIndicator + export type date1 = $SelectionSet.Indicator.NoArgsIndicator } // -------------- @@ -838,13 +848,15 @@ export interface Error extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } export namespace Error { - export type message$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type message$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type message = $SelectionSet.NoArgsIndicator + export type message = $SelectionSet.Indicator.NoArgsIndicator } // -------------- @@ -872,13 +884,15 @@ export interface Interface extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } export namespace Interface { - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator } // @@ -932,15 +946,17 @@ export interface Bar extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Bar { - export type int$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type int$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type int = $SelectionSet.NoArgsIndicator + export type int = $SelectionSet.Indicator.NoArgsIndicator } // @@ -978,15 +994,17 @@ export interface DateObject1 extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace DateObject1 { - export type date1$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type date1$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type date1 = $SelectionSet.NoArgsIndicator + export type date1 = $SelectionSet.Indicator.NoArgsIndicator } // @@ -1024,15 +1042,17 @@ export interface DateObject2 extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace DateObject2 { - export type date2$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type date2$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type date2 = $SelectionSet.NoArgsIndicator + export type date2 = $SelectionSet.Indicator.NoArgsIndicator } // @@ -1074,19 +1094,21 @@ export interface ErrorOne extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace ErrorOne { - export type infoId$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type infoId$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type infoId = $SelectionSet.NoArgsIndicator + export type infoId = $SelectionSet.Indicator.NoArgsIndicator - export type message$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type message$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type message = $SelectionSet.NoArgsIndicator + export type message = $SelectionSet.Indicator.NoArgsIndicator } // @@ -1128,19 +1150,21 @@ export interface ErrorTwo extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace ErrorTwo { - export type infoInt$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type infoInt$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type infoInt = $SelectionSet.NoArgsIndicator + export type infoInt = $SelectionSet.Indicator.NoArgsIndicator - export type message$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type message$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type message = $SelectionSet.NoArgsIndicator + export type message = $SelectionSet.Indicator.NoArgsIndicator } // @@ -1181,15 +1205,17 @@ export interface Foo extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Foo { - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator } // @@ -1243,31 +1269,33 @@ export interface Object1 extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Object1 { - export type $boolean$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type $boolean$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type $boolean = $SelectionSet.NoArgsIndicator + export type $boolean = $SelectionSet.Indicator.NoArgsIndicator - export type float$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type float$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type float = $SelectionSet.NoArgsIndicator + export type float = $SelectionSet.Indicator.NoArgsIndicator - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator - export type int$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type int$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type int = $SelectionSet.NoArgsIndicator + export type int = $SelectionSet.Indicator.NoArgsIndicator - export type $string$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type $string$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type $string = $SelectionSet.NoArgsIndicator + export type $string = $SelectionSet.Indicator.NoArgsIndicator } // @@ -1309,19 +1337,21 @@ export interface Object1ImplementingInterface extends $SelectionSet.Bases.Object * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Object1ImplementingInterface { - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator - export type int$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type int$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type int = $SelectionSet.NoArgsIndicator + export type int = $SelectionSet.Indicator.NoArgsIndicator } // @@ -1365,19 +1395,21 @@ export interface Object2ImplementingInterface extends $SelectionSet.Bases.Object * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Object2ImplementingInterface { - export type $boolean$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type $boolean$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type $boolean = $SelectionSet.NoArgsIndicator + export type $boolean = $SelectionSet.Indicator.NoArgsIndicator - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator } // @@ -1419,15 +1451,17 @@ export interface ObjectNested extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace ObjectNested { - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator export interface $object extends _RefDefs._Object1 {} export type $object$Expanded = $object @@ -1468,7 +1502,9 @@ export interface ObjectUnion extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | @@ -1513,15 +1549,17 @@ export interface lowerCaseObject extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace lowerCaseObject { - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator } // @@ -1559,15 +1597,17 @@ export interface lowerCaseObject2 extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace lowerCaseObject2 { - export type int$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type int$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type int = $SelectionSet.NoArgsIndicator + export type int = $SelectionSet.Indicator.NoArgsIndicator } // @@ -1606,7 +1646,9 @@ export interface DateUnion { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } /** @@ -1632,7 +1674,9 @@ export interface FooBarUnion { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } export interface Result { @@ -1656,7 +1700,9 @@ export interface Result { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } export interface lowerCaseUnion { @@ -1679,7 +1725,9 @@ export interface lowerCaseUnion { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } /** diff --git a/tests/_/schemaMutationOnly/generated/modules/SelectionSets.ts b/tests/_/schemaMutationOnly/generated/modules/SelectionSets.ts index 0df9f8942..f29087bf3 100644 --- a/tests/_/schemaMutationOnly/generated/modules/SelectionSets.ts +++ b/tests/_/schemaMutationOnly/generated/modules/SelectionSets.ts @@ -56,19 +56,21 @@ export interface Mutation { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Mutation { - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator - export type idNonNull$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type idNonNull$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type idNonNull = $SelectionSet.NoArgsIndicator + export type idNonNull = $SelectionSet.Indicator.NoArgsIndicator } /** diff --git a/tests/_/schemaQueryOnly/generated/modules/SelectionSets.ts b/tests/_/schemaQueryOnly/generated/modules/SelectionSets.ts index e4601ae80..8f0f4f98f 100644 --- a/tests/_/schemaQueryOnly/generated/modules/SelectionSets.ts +++ b/tests/_/schemaQueryOnly/generated/modules/SelectionSets.ts @@ -56,19 +56,21 @@ export interface Query { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Query { - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator - export type idNonNull$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type idNonNull$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type idNonNull = $SelectionSet.NoArgsIndicator + export type idNonNull = $SelectionSet.Indicator.NoArgsIndicator } /** diff --git a/website/graffle/modules/SelectionSets.ts b/website/graffle/modules/SelectionSets.ts index f9d9fc77c..1c8fc015e 100644 --- a/website/graffle/modules/SelectionSets.ts +++ b/website/graffle/modules/SelectionSets.ts @@ -72,7 +72,9 @@ export interface Query { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | @@ -238,21 +240,23 @@ export interface Continent extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Continent { - export type code$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type code$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type code = $SelectionSet.NoArgsIndicator + export type code = $SelectionSet.Indicator.NoArgsIndicator export interface countries extends _RefDefs._Country {} export type countries$Expanded = countries - export type name$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type name$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type name = $SelectionSet.NoArgsIndicator + export type name = $SelectionSet.Indicator.NoArgsIndicator } // @@ -346,41 +350,43 @@ export interface Country extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Country { - export type awsRegion$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type awsRegion$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type awsRegion = $SelectionSet.NoArgsIndicator + export type awsRegion = $SelectionSet.Indicator.NoArgsIndicator - export type capital$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type capital$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type capital = $SelectionSet.NoArgsIndicator + export type capital = $SelectionSet.Indicator.NoArgsIndicator - export type code$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type code$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type code = $SelectionSet.NoArgsIndicator + export type code = $SelectionSet.Indicator.NoArgsIndicator export interface continent extends _RefDefs._Continent {} export type continent$Expanded = continent - export type currencies$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type currencies$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type currencies = $SelectionSet.NoArgsIndicator + export type currencies = $SelectionSet.Indicator.NoArgsIndicator - export type currency$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type currency$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type currency = $SelectionSet.NoArgsIndicator + export type currency = $SelectionSet.Indicator.NoArgsIndicator - export type emoji$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type emoji$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type emoji = $SelectionSet.NoArgsIndicator + export type emoji = $SelectionSet.Indicator.NoArgsIndicator - export type emojiU$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type emojiU$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type emojiU = $SelectionSet.NoArgsIndicator + export type emojiU = $SelectionSet.Indicator.NoArgsIndicator export interface languages extends _RefDefs._Language {} export type languages$Expanded = languages @@ -397,21 +403,21 @@ export namespace Country { } > - export type name$Expanded = $Utilities.UnionExpanded<$SelectionSet.ClientIndicator | name$SelectionSet> + export type name$Expanded = $Utilities.UnionExpanded<$SelectionSet.Indicator.ClientIndicator | name$SelectionSet> - export type name = $SelectionSet.ClientIndicator | name$SelectionSet + export type name = $SelectionSet.Indicator.ClientIndicator | name$SelectionSet - export type native$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type native$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type native = $SelectionSet.NoArgsIndicator + export type native = $SelectionSet.Indicator.NoArgsIndicator - export type phone$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type phone$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type phone = $SelectionSet.NoArgsIndicator + export type phone = $SelectionSet.Indicator.NoArgsIndicator - export type phones$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type phones$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type phones = $SelectionSet.NoArgsIndicator + export type phones = $SelectionSet.Indicator.NoArgsIndicator export interface states extends _RefDefs._State {} export type states$Expanded = states @@ -466,27 +472,29 @@ export interface Language extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Language { - export type code$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type code$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type code = $SelectionSet.NoArgsIndicator + export type code = $SelectionSet.Indicator.NoArgsIndicator - export type name$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type name$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type name = $SelectionSet.NoArgsIndicator + export type name = $SelectionSet.Indicator.NoArgsIndicator - export type native$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type native$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type native = $SelectionSet.NoArgsIndicator + export type native = $SelectionSet.Indicator.NoArgsIndicator - export type rtl$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type rtl$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type rtl = $SelectionSet.NoArgsIndicator + export type rtl = $SelectionSet.Indicator.NoArgsIndicator } // @@ -532,21 +540,23 @@ export interface State extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace State { - export type code$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type code$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type code = $SelectionSet.NoArgsIndicator + export type code = $SelectionSet.Indicator.NoArgsIndicator export interface country extends _RefDefs._Country {} export type country$Expanded = country - export type name$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type name$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type name = $SelectionSet.NoArgsIndicator + export type name = $SelectionSet.Indicator.NoArgsIndicator } // @@ -592,23 +602,25 @@ export interface Subdivision extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Subdivision { - export type code$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type code$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type code = $SelectionSet.NoArgsIndicator + export type code = $SelectionSet.Indicator.NoArgsIndicator - export type emoji$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type emoji$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type emoji = $SelectionSet.NoArgsIndicator + export type emoji = $SelectionSet.Indicator.NoArgsIndicator - export type name$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type name$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type name = $SelectionSet.NoArgsIndicator + export type name = $SelectionSet.Indicator.NoArgsIndicator } /** diff --git a/website/pokemon/modules/SelectionSets.ts b/website/pokemon/modules/SelectionSets.ts index 1a4f7dcaf..787b81b04 100644 --- a/website/pokemon/modules/SelectionSets.ts +++ b/website/pokemon/modules/SelectionSets.ts @@ -52,7 +52,9 @@ export interface Mutation { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | @@ -120,7 +122,9 @@ export interface Query { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | @@ -223,31 +227,33 @@ export interface Pokemon extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Pokemon { - export type attack$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type attack$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type attack = $SelectionSet.NoArgsIndicator + export type attack = $SelectionSet.Indicator.NoArgsIndicator - export type defense$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type defense$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type defense = $SelectionSet.NoArgsIndicator + export type defense = $SelectionSet.Indicator.NoArgsIndicator - export type hp$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type hp$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type hp = $SelectionSet.NoArgsIndicator + export type hp = $SelectionSet.Indicator.NoArgsIndicator - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator - export type name$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type name$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type name = $SelectionSet.NoArgsIndicator + export type name = $SelectionSet.Indicator.NoArgsIndicator export interface trainer extends _RefDefs._Trainer {} export type trainer$Expanded = trainer @@ -296,19 +302,21 @@ export interface Trainer extends $SelectionSet.Bases.ObjectLike { * * @see https://graphql.org/learn/queries/#meta-fields */ - __typename?: $SelectionSet.NoArgsIndicator$Expanded | $SelectionSet.AliasInput<$SelectionSet.NoArgsIndicator> + __typename?: + | $SelectionSet.Indicator.NoArgsIndicator$Expanded + | $SelectionSet.AliasInput<$SelectionSet.Indicator.NoArgsIndicator> } // ----------------------------------------| Fields Interfaces | export namespace Trainer { - export type id$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type id$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type id = $SelectionSet.NoArgsIndicator + export type id = $SelectionSet.Indicator.NoArgsIndicator - export type name$Expanded = $SelectionSet.NoArgsIndicator$Expanded + export type name$Expanded = $SelectionSet.Indicator.NoArgsIndicator$Expanded - export type name = $SelectionSet.NoArgsIndicator + export type name = $SelectionSet.Indicator.NoArgsIndicator export interface pokemon extends _RefDefs._Pokemon {} export type pokemon$Expanded = pokemon