diff --git a/.github/ISSUE_TEMPLATE/config.yaml b/.github/ISSUE_TEMPLATE/config.yaml index fcb1adecd..4278ef6ae 100644 --- a/.github/ISSUE_TEMPLATE/config.yaml +++ b/.github/ISSUE_TEMPLATE/config.yaml @@ -3,4 +3,4 @@ blank_issues_enabled: false contact_links: - name: ✋ Question about: You have a question about something you're not sure about - url: https://github.com/jasonkuhrt/graffle/discussions/new + url: https://github.com/graffle-js/graffle/discussions/new diff --git a/examples/30_gql/gql_gql-string_gql-typed__gql-string-typed.ts b/examples/30_gql/gql_gql-string_gql-typed__gql-string-typed.ts index 991028c70..5d304c8ce 100644 --- a/examples/30_gql/gql_gql-string_gql-typed__gql-string-typed.ts +++ b/examples/30_gql/gql_gql-string_gql-typed__gql-string-typed.ts @@ -15,7 +15,7 @@ const graffle = Graffle.create({ * @remarks Typically this type would come from your code generation tool. * * @see https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#documentmode - * @see https://github.com/jasonkuhrt/graffle/issues/997 + * @see https://github.com/graffle-js/graffle/issues/997 */ type Document = TypedDocument.String< { diff --git a/package.json b/package.json index 2787bb1bb..5f49a38ee 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ ], "repository": { "type": "git", - "url": "https://github.com/jasonkuhrt/graffle.git" + "url": "https://github.com/graffle-js/graffle.git" }, "keywords": [ "graphql", @@ -65,9 +65,9 @@ }, "license": "MIT", "bugs": { - "url": "https://github.com/jasonkuhrt/graffle/issues" + "url": "https://github.com/graffle-js/graffle/issues" }, - "homepage": "https://github.com/jasonkuhrt/graffle", + "homepage": "https://github.com/graffle-js/graffle", "scripts": { "serve:pokemon": "tsx tests/_/services/pokemonManual.ts", "gen:graffle": "pnpm gen:graffle:tests && pnpm build && cd website && pnpm gen:graffle", diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsRoot.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsRoot.ts index 45dddf352..dd9e160d4 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsRoot.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsRoot.ts @@ -24,6 +24,7 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > > > + id: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.id<$Context['scalars']>>, ) => Promise< @@ -35,6 +36,7 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > > > + idNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.idNonNull<$Context['scalars']>>, ) => Promise< @@ -68,6 +70,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + InputObjectNested: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.InputObjectNested<$Context['scalars']>>, ) => Promise< @@ -79,6 +82,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + InputObjectNestedNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.InputObjectNestedNonNull<$Context['scalars']>>, ) => Promise< @@ -104,6 +108,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + argInputObjectCircular: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.argInputObjectCircular<$Context['scalars']>>, ) => Promise< @@ -115,6 +120,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + date: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.date<$Context['scalars']>>, ) => Promise< @@ -126,6 +132,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArg: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArg<$Context['scalars']>>, ) => Promise< @@ -137,6 +144,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgInputObject: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgInputObject<$Context['scalars']>>, ) => Promise< @@ -148,6 +156,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgList: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgList<$Context['scalars']>>, ) => Promise< @@ -159,6 +168,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNull<$Context['scalars']>>, ) => Promise< @@ -170,6 +180,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgNonNullList: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullList<$Context['scalars']>>, ) => Promise< @@ -181,6 +192,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgNonNullListNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullListNonNull<$Context['scalars']>>, ) => Promise< @@ -192,6 +204,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateInterface1: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateInterface1<$Context['scalars']>>, ) => Promise< @@ -203,6 +216,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateList: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateList<$Context['scalars']>>, ) => Promise< @@ -214,6 +228,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateListList: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateListList<$Context['scalars']>>, ) => Promise< @@ -225,6 +240,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateListNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateListNonNull<$Context['scalars']>>, ) => Promise< @@ -236,6 +252,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateNonNull<$Context['scalars']>>, ) => Promise< @@ -247,6 +264,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateObject1: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateObject1<$Context['scalars']>>, ) => Promise< @@ -258,6 +276,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateUnion: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateUnion<$Context['scalars']>>, ) => Promise< @@ -269,6 +288,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + error: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.error<$Context['scalars']>>, ) => Promise< @@ -280,6 +300,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + id: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.id<$Context['scalars']>>, ) => Promise< @@ -291,6 +312,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + idNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.idNonNull<$Context['scalars']>>, ) => Promise< @@ -302,6 +324,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + interface: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$interface<$Context['scalars']>>, ) => Promise< @@ -313,6 +336,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + interfaceNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.interfaceNonNull<$Context['scalars']>>, ) => Promise< @@ -324,6 +348,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + interfaceWithArgs: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.interfaceWithArgs<$Context['scalars']>>, ) => Promise< @@ -335,6 +360,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + listInt: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listInt<$Context['scalars']>>, ) => Promise< @@ -346,6 +372,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + listIntNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listIntNonNull<$Context['scalars']>>, ) => Promise< @@ -357,6 +384,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + listListInt: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listListInt<$Context['scalars']>>, ) => Promise< @@ -368,6 +396,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + listListIntNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listListIntNonNull<$Context['scalars']>>, ) => Promise< @@ -379,6 +408,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + lowerCaseUnion: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.lowerCaseUnion<$Context['scalars']>>, ) => Promise< @@ -390,6 +420,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + object: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$object<$Context['scalars']>>, ) => Promise< @@ -401,6 +432,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectList: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectList<$Context['scalars']>>, ) => Promise< @@ -412,6 +444,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectListNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectListNonNull<$Context['scalars']>>, ) => Promise< @@ -423,6 +456,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectNested: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectNested<$Context['scalars']>>, ) => Promise< @@ -434,6 +468,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectNonNull<$Context['scalars']>>, ) => Promise< @@ -445,6 +480,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectWithArgs: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectWithArgs<$Context['scalars']>>, ) => Promise< @@ -456,6 +492,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + result: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.result<$Context['scalars']>>, ) => Promise< @@ -467,6 +504,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + resultNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.resultNonNull<$Context['scalars']>>, ) => Promise< @@ -478,6 +516,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + string: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$string<$Context['scalars']>>, ) => Promise< @@ -489,6 +528,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithArgEnum: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgEnum<$Context['scalars']>>, ) => Promise< @@ -500,6 +540,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithArgInputObject: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgInputObject<$Context['scalars']>>, ) => Promise< @@ -511,6 +552,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithArgInputObjectRequired: <$SelectionSet>( selectionSet: $$Utilities.Exact< $SelectionSet, @@ -539,6 +581,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithListArg: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithListArg<$Context['scalars']>>, ) => Promise< @@ -550,6 +593,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithListArgRequired: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithListArgRequired<$Context['scalars']>>, ) => Promise< @@ -561,6 +605,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithRequiredArg: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithRequiredArg<$Context['scalars']>>, ) => Promise< @@ -572,6 +617,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionFooBar: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBar<$Context['scalars']>>, ) => Promise< @@ -583,6 +629,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionFooBarNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBarNonNull<$Context['scalars']>>, ) => Promise< @@ -594,6 +641,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionFooBarWithArgs: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBarWithArgs<$Context['scalars']>>, ) => Promise< @@ -605,6 +653,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionObject: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionObject<$Context['scalars']>>, ) => Promise< @@ -616,6 +665,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionObjectNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionObjectNonNull<$Context['scalars']>>, ) => Promise< diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Schema.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Schema.ts index ae0c26345..be107138e 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Schema.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Schema.ts @@ -3,6 +3,7 @@ import type * as $$Utilities from '../../../../../../entrypoints/utilities-for-g import type * as Data from './Data.js' import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' + export namespace Schema { // // @@ -20,209 +21,681 @@ export namespace Schema { // // - export type Mutation = $.StandardTypes.Mutation<{ - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - idNonNull: $.OutputField<'idNonNull', $Scalar.ID, null> - }> + // Mutation + // -------------------------------------------------------------------------------------------------- + // + + export interface Mutation extends $.OutputObject { + name: 'Mutation' + fields: { + __typename: Mutation.__typename + id: Mutation.id + idNonNull: Mutation.idNonNull + } + } + + export namespace Mutation { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Mutation' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface idNonNull extends $.OutputField { + name: 'idNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + } + + // Query + // -------------------------------------------------------------------------------------------------- + // + + export interface Query extends $.OutputObject { + name: 'Query' + fields: { + __typename: Query.__typename + InputObjectNested: Query.InputObjectNested + InputObjectNestedNonNull: Query.InputObjectNestedNonNull + abcEnum: Query.abcEnum + argInputObjectCircular: Query.argInputObjectCircular + date: Query.date + dateArg: Query.dateArg + dateArgInputObject: Query.dateArgInputObject + dateArgList: Query.dateArgList + dateArgNonNull: Query.dateArgNonNull + dateArgNonNullList: Query.dateArgNonNullList + dateArgNonNullListNonNull: Query.dateArgNonNullListNonNull + dateInterface1: Query.dateInterface1 + dateList: Query.dateList + dateListList: Query.dateListList + dateListNonNull: Query.dateListNonNull + dateNonNull: Query.dateNonNull + dateObject1: Query.dateObject1 + dateUnion: Query.dateUnion + error: Query.error + id: Query.id + idNonNull: Query.idNonNull + interface: Query.$interface + interfaceNonNull: Query.interfaceNonNull + interfaceWithArgs: Query.interfaceWithArgs + listInt: Query.listInt + listIntNonNull: Query.listIntNonNull + listListInt: Query.listListInt + listListIntNonNull: Query.listListIntNonNull + lowerCaseUnion: Query.lowerCaseUnion + object: Query.$object + objectList: Query.objectList + objectListNonNull: Query.objectListNonNull + objectNested: Query.objectNested + objectNonNull: Query.objectNonNull + objectWithArgs: Query.objectWithArgs + result: Query.result + resultNonNull: Query.resultNonNull + string: Query.$string + stringWithArgEnum: Query.stringWithArgEnum + stringWithArgInputObject: Query.stringWithArgInputObject + stringWithArgInputObjectRequired: Query.stringWithArgInputObjectRequired + stringWithArgs: Query.stringWithArgs + stringWithListArg: Query.stringWithListArg + stringWithListArgRequired: Query.stringWithListArgRequired + stringWithRequiredArg: Query.stringWithRequiredArg + unionFooBar: Query.unionFooBar + unionFooBarNonNull: Query.unionFooBarNonNull + unionFooBarWithArgs: Query.unionFooBarWithArgs + unionObject: Query.unionObject + unionObjectNonNull: Query.unionObjectNonNull + } + } + + export namespace Query { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Query' + } + } + + export interface InputObjectNested extends $.OutputField { + name: 'InputObjectNested' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [0] + namedType: $$NamedTypes.$$InputObjectNested + } + } + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface InputObjectNestedNonNull extends $.OutputField { + name: 'InputObjectNestedNonNull' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [1] + namedType: $$NamedTypes.$$InputObjectNestedNonNull + } + } + inlineType: [0] + namedType: $$NamedTypes.$$ID + } - export type Query = $.StandardTypes.Query<{ - InputObjectNested: $.OutputField< - 'InputObjectNested', - $.Nullable<$Scalar.ID>, - $.Args<{ - input: $.InputField<$.Nullable> - }, true> - > - InputObjectNestedNonNull: $.OutputField< - 'InputObjectNestedNonNull', - $.Nullable<$Scalar.ID>, - $.Args<{ - input: $.InputField - }, false> - > /** * Query enum field documentation. */ - abcEnum: $.OutputField<'abcEnum', $.Nullable, null> - argInputObjectCircular: $.OutputField< - 'argInputObjectCircular', - $.Nullable<$Scalar.String>, - $.Args<{ - input: $.InputField<$.Nullable> - }, true> - > - date: $.OutputField<'date', $.Nullable<$Scalar.Date>, null> - dateArg: $.OutputField< - 'dateArg', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$.Nullable<$Scalar.Date>> - }, true> - > - dateArgInputObject: $.OutputField< - 'dateArgInputObject', - $.Nullable<$Scalar.Date>, - $.Args<{ - input: $.InputField<$.Nullable> - }, true> - > - dateArgList: $.OutputField< - 'dateArgList', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$.Nullable<$.List<$Scalar.Date>>> - }, true> - > - dateArgNonNull: $.OutputField< - 'dateArgNonNull', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$Scalar.Date> - }, false> - > - dateArgNonNullList: $.OutputField< - 'dateArgNonNullList', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$.List<$.Nullable<$Scalar.Date>>> - }, false> - > - dateArgNonNullListNonNull: $.OutputField< - 'dateArgNonNullListNonNull', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$.List<$Scalar.Date>> - }, false> - > - dateInterface1: $.OutputField<'dateInterface1', $.Nullable, null> - dateList: $.OutputField<'dateList', $.Nullable<$.List<$Scalar.Date>>, null> - dateListList: $.OutputField<'dateListList', $.Nullable<$.List<$.List<$Scalar.Date>>>, null> - dateListNonNull: $.OutputField<'dateListNonNull', $.List<$Scalar.Date>, null> - dateNonNull: $.OutputField<'dateNonNull', $Scalar.Date, null> - dateObject1: $.OutputField<'dateObject1', $.Nullable, null> - dateUnion: $.OutputField<'dateUnion', $.Nullable, null> - error: $.OutputField< - 'error', - $.Nullable<$Scalar.String>, - $.Args<{ - case: $.InputField<$.Nullable<$Scalar.String>> - }, true> - > - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - idNonNull: $.OutputField<'idNonNull', $Scalar.ID, null> - interface: $.OutputField<'interface', $.Nullable, null> - interfaceNonNull: $.OutputField<'interfaceNonNull', Interface, null> - interfaceWithArgs: $.OutputField< - 'interfaceWithArgs', - $.Nullable, - $.Args<{ - id: $.InputField<$Scalar.ID> - }, false> - > - listInt: $.OutputField<'listInt', $.Nullable<$.List<$.Nullable<$Scalar.Int>>>, null> - listIntNonNull: $.OutputField<'listIntNonNull', $.List<$Scalar.Int>, null> - listListInt: $.OutputField<'listListInt', $.Nullable<$.List<$.Nullable<$.List<$.Nullable<$Scalar.Int>>>>>, null> - listListIntNonNull: $.OutputField<'listListIntNonNull', $.List<$.List<$Scalar.Int>>, null> - lowerCaseUnion: $.OutputField<'lowerCaseUnion', $.Nullable, null> - object: $.OutputField<'object', $.Nullable, null> - objectList: $.OutputField<'objectList', $.Nullable<$.List>, null> - objectListNonNull: $.OutputField<'objectListNonNull', $.List, null> - objectNested: $.OutputField<'objectNested', $.Nullable, null> - objectNonNull: $.OutputField<'objectNonNull', Object1, null> - objectWithArgs: $.OutputField< - 'objectWithArgs', - $.Nullable, - $.Args<{ - boolean: $.InputField<$.Nullable<$Scalar.Boolean>> - float: $.InputField<$.Nullable<$Scalar.Float>> - id: $.InputField<$.Nullable<$Scalar.ID>> - int: $.InputField<$.Nullable<$Scalar.Int>> - string: $.InputField<$.Nullable<$Scalar.String>> - }, true> - > - result: $.OutputField< - 'result', - $.Nullable, - $.Args<{ - case: $.InputField - }, false> - > - resultNonNull: $.OutputField< - 'resultNonNull', - Result, - $.Args<{ - case: $.InputField<$.Nullable> - }, true> - > - string: $.OutputField<'string', $.Nullable<$Scalar.String>, null> - stringWithArgEnum: $.OutputField< - 'stringWithArgEnum', - $.Nullable<$Scalar.String>, - $.Args<{ - ABCEnum: $.InputField<$.Nullable> - }, true> - > - stringWithArgInputObject: $.OutputField< - 'stringWithArgInputObject', - $.Nullable<$Scalar.String>, - $.Args<{ - input: $.InputField<$.Nullable> - }, true> - > - stringWithArgInputObjectRequired: $.OutputField< - 'stringWithArgInputObjectRequired', - $.Nullable<$Scalar.String>, - $.Args<{ - input: $.InputField - }, false> - > + export interface abcEnum extends $.OutputField { + name: 'abcEnum' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ABCEnum + } + + export interface argInputObjectCircular extends $.OutputField { + name: 'argInputObjectCircular' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [0] + namedType: $$NamedTypes.$$InputObjectCircular + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface date extends $.OutputField { + name: 'date' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArg extends $.OutputField { + name: 'dateArg' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgInputObject extends $.OutputField { + name: 'dateArgInputObject' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [0] + namedType: $$NamedTypes.$$InputObject + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgList extends $.OutputField { + name: 'dateArgList' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgNonNull extends $.OutputField { + name: 'dateArgNonNull' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [1] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgNonNullList extends $.OutputField { + name: 'dateArgNonNullList' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [1, [0]] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgNonNullListNonNull extends $.OutputField { + name: 'dateArgNonNullListNonNull' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateInterface1 extends $.OutputField { + name: 'dateInterface1' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$DateInterface1 + } + + export interface dateList extends $.OutputField { + name: 'dateList' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Date + } + + export interface dateListList extends $.OutputField { + name: 'dateListList' + arguments: {} + inlineType: [0, [1, [1]]] + namedType: $$NamedTypes.$$Date + } + + export interface dateListNonNull extends $.OutputField { + name: 'dateListNonNull' + arguments: {} + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Date + } + + export interface dateNonNull extends $.OutputField { + name: 'dateNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$Date + } + + export interface dateObject1 extends $.OutputField { + name: 'dateObject1' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$DateObject1 + } + + export interface dateUnion extends $.OutputField { + name: 'dateUnion' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$DateUnion + } + + export interface error extends $.OutputField { + name: 'error' + arguments: { + case: { + kind: 'InputField' + name: 'case' + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface idNonNull extends $.OutputField { + name: 'idNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + + export interface $interface extends $.OutputField { + name: 'interface' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Interface + } + + export interface interfaceNonNull extends $.OutputField { + name: 'interfaceNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$Interface + } + + export interface interfaceWithArgs extends $.OutputField { + name: 'interfaceWithArgs' + arguments: { + id: { + kind: 'InputField' + name: 'id' + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Interface + } + + export interface listInt extends $.OutputField { + name: 'listInt' + arguments: {} + inlineType: [0, [0]] + namedType: $$NamedTypes.$$Int + } + + export interface listIntNonNull extends $.OutputField { + name: 'listIntNonNull' + arguments: {} + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Int + } + + export interface listListInt extends $.OutputField { + name: 'listListInt' + arguments: {} + inlineType: [0, [0, [0]]] + namedType: $$NamedTypes.$$Int + } + + export interface listListIntNonNull extends $.OutputField { + name: 'listListIntNonNull' + arguments: {} + inlineType: [1, [1, [1]]] + namedType: $$NamedTypes.$$Int + } + + export interface lowerCaseUnion extends $.OutputField { + name: 'lowerCaseUnion' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$lowerCaseUnion + } + + export interface $object extends $.OutputField { + name: 'object' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Object1 + } + + export interface objectList extends $.OutputField { + name: 'objectList' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Object1 + } + + export interface objectListNonNull extends $.OutputField { + name: 'objectListNonNull' + arguments: {} + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Object1 + } + + export interface objectNested extends $.OutputField { + name: 'objectNested' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ObjectNested + } + + export interface objectNonNull extends $.OutputField { + name: 'objectNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$Object1 + } + + export interface objectWithArgs extends $.OutputField { + name: 'objectWithArgs' + arguments: { + boolean: { + kind: 'InputField' + name: 'boolean' + inlineType: [0] + namedType: $$NamedTypes.$$Boolean + } + float: { + kind: 'InputField' + name: 'float' + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + id: { + kind: 'InputField' + name: 'id' + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + int: { + kind: 'InputField' + name: 'int' + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + string: { + kind: 'InputField' + name: 'string' + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Object1 + } + + export interface result extends $.OutputField { + name: 'result' + arguments: { + case: { + kind: 'InputField' + name: 'case' + inlineType: [1] + namedType: $$NamedTypes.$$Case + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Result + } + + export interface resultNonNull extends $.OutputField { + name: 'resultNonNull' + arguments: { + case: { + kind: 'InputField' + name: 'case' + inlineType: [0] + namedType: $$NamedTypes.$$Case + } + } + inlineType: [1] + namedType: $$NamedTypes.$$Result + } + + export interface $string extends $.OutputField { + name: 'string' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithArgEnum extends $.OutputField { + name: 'stringWithArgEnum' + arguments: { + ABCEnum: { + kind: 'InputField' + name: 'ABCEnum' + inlineType: [0] + namedType: $$NamedTypes.$$ABCEnum + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithArgInputObject extends $.OutputField { + name: 'stringWithArgInputObject' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [0] + namedType: $$NamedTypes.$$InputObject + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithArgInputObjectRequired extends $.OutputField { + name: 'stringWithArgInputObjectRequired' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [1] + namedType: $$NamedTypes.$$InputObject + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + /** * The given arguments are reflected back as a JSON string. */ - stringWithArgs: $.OutputField< - 'stringWithArgs', - $.Nullable<$Scalar.String>, - $.Args<{ - boolean: $.InputField<$.Nullable<$Scalar.Boolean>> - float: $.InputField<$.Nullable<$Scalar.Float>> - id: $.InputField<$.Nullable<$Scalar.ID>> - int: $.InputField<$.Nullable<$Scalar.Int>> - string: $.InputField<$.Nullable<$Scalar.String>> - }, true> - > - stringWithListArg: $.OutputField< - 'stringWithListArg', - $.Nullable<$Scalar.String>, - $.Args<{ - ints: $.InputField<$.Nullable<$.List<$.Nullable<$Scalar.Int>>>> - }, true> - > - stringWithListArgRequired: $.OutputField< - 'stringWithListArgRequired', - $.Nullable<$Scalar.String>, - $.Args<{ - ints: $.InputField<$.List<$Scalar.Int>> - }, false> - > - stringWithRequiredArg: $.OutputField< - 'stringWithRequiredArg', - $.Nullable<$Scalar.String>, - $.Args<{ - string: $.InputField<$Scalar.String> - }, false> - > - unionFooBar: $.OutputField<'unionFooBar', $.Nullable, null> - unionFooBarNonNull: $.OutputField<'unionFooBarNonNull', FooBarUnion, null> - unionFooBarWithArgs: $.OutputField< - 'unionFooBarWithArgs', - $.Nullable, - $.Args<{ - id: $.InputField<$.Nullable<$Scalar.ID>> - }, true> - > - unionObject: $.OutputField<'unionObject', $.Nullable, null> - unionObjectNonNull: $.OutputField<'unionObjectNonNull', ObjectUnion, null> - }> + export interface stringWithArgs extends $.OutputField { + name: 'stringWithArgs' + arguments: { + boolean: { + kind: 'InputField' + name: 'boolean' + inlineType: [0] + namedType: $$NamedTypes.$$Boolean + } + float: { + kind: 'InputField' + name: 'float' + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + id: { + kind: 'InputField' + name: 'id' + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + /** + * @deprecated Example of argument deprecation reason here. + */ + int: { + kind: 'InputField' + name: 'int' + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + /** + * Example of some argument documentation here. + */ + string: { + kind: 'InputField' + name: 'string' + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithListArg extends $.OutputField { + name: 'stringWithListArg' + arguments: { + ints: { + kind: 'InputField' + name: 'ints' + inlineType: [0, [0]] + namedType: $$NamedTypes.$$Int + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithListArgRequired extends $.OutputField { + name: 'stringWithListArgRequired' + arguments: { + ints: { + kind: 'InputField' + name: 'ints' + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Int + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithRequiredArg extends $.OutputField { + name: 'stringWithRequiredArg' + arguments: { + string: { + kind: 'InputField' + name: 'string' + inlineType: [1] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface unionFooBar extends $.OutputField { + name: 'unionFooBar' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$FooBarUnion + } + + export interface unionFooBarNonNull extends $.OutputField { + name: 'unionFooBarNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$FooBarUnion + } + + export interface unionFooBarWithArgs extends $.OutputField { + name: 'unionFooBarWithArgs' + arguments: { + id: { + kind: 'InputField' + name: 'id' + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + } + inlineType: [0] + namedType: $$NamedTypes.$$FooBarUnion + } + + export interface unionObject extends $.OutputField { + name: 'unionObject' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ObjectUnion + } + + export interface unionObjectNonNull extends $.OutputField { + name: 'unionObjectNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$ObjectUnion + } + } // // @@ -240,75 +713,496 @@ export namespace Schema { // // - export type Bar = $.OutputObject<'Bar', { - int: $.OutputField<'int', $.Nullable<$Scalar.Int>, null> - }> + // Bar + // -------------------------------------------------------------------------------------------------- + // + + export interface Bar extends $.OutputObject { + name: 'Bar' + fields: { + __typename: Bar.__typename + int: Bar.int + } + } + + export namespace Bar { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Bar' + } + } + + export interface int extends $.OutputField { + name: 'int' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + } + + // DateObject1 + // -------------------------------------------------------------------------------------------------- + // + + export interface DateObject1 extends $.OutputObject { + name: 'DateObject1' + fields: { + __typename: DateObject1.__typename + date1: DateObject1.date1 + } + } + + export namespace DateObject1 { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'DateObject1' + } + } + + export interface date1 extends $.OutputField { + name: 'date1' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + } + + // DateObject2 + // -------------------------------------------------------------------------------------------------- + // + + export interface DateObject2 extends $.OutputObject { + name: 'DateObject2' + fields: { + __typename: DateObject2.__typename + date2: DateObject2.date2 + } + } - export type DateObject1 = $.OutputObject<'DateObject1', { - date1: $.OutputField<'date1', $.Nullable<$Scalar.Date>, null> - }> + export namespace DateObject2 { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'DateObject2' + } + } - export type DateObject2 = $.OutputObject<'DateObject2', { - date2: $.OutputField<'date2', $.Nullable<$Scalar.Date>, null> - }> + export interface date2 extends $.OutputField { + name: 'date2' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + } - export type ErrorOne = $.OutputObject<'ErrorOne', { - infoId: $.OutputField<'infoId', $.Nullable<$Scalar.ID>, null> - message: $.OutputField<'message', $Scalar.String, null> - }> + // ErrorOne + // -------------------------------------------------------------------------------------------------- + // - export type ErrorTwo = $.OutputObject<'ErrorTwo', { - infoInt: $.OutputField<'infoInt', $.Nullable<$Scalar.Int>, null> - message: $.OutputField<'message', $Scalar.String, null> - }> + export interface ErrorOne extends $.OutputObject { + name: 'ErrorOne' + fields: { + __typename: ErrorOne.__typename + infoId: ErrorOne.infoId + message: ErrorOne.message + } + } + + export namespace ErrorOne { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'ErrorOne' + } + } + + export interface infoId extends $.OutputField { + name: 'infoId' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface message extends $.OutputField { + name: 'message' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$String + } + } + + // ErrorTwo + // -------------------------------------------------------------------------------------------------- + // + + export interface ErrorTwo extends $.OutputObject { + name: 'ErrorTwo' + fields: { + __typename: ErrorTwo.__typename + infoInt: ErrorTwo.infoInt + message: ErrorTwo.message + } + } + + export namespace ErrorTwo { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'ErrorTwo' + } + } + + export interface infoInt extends $.OutputField { + name: 'infoInt' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + + export interface message extends $.OutputField { + name: 'message' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$String + } + } + + // Foo + // -------------------------------------------------------------------------------------------------- + // /** * Object documentation. */ - export type Foo = $.OutputObject<'Foo', { + export interface Foo extends $.OutputObject { + name: 'Foo' + fields: { + __typename: Foo.__typename + id: Foo.id + } + } + + export namespace Foo { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Foo' + } + } + /** * Field documentation. * * @deprecated Field a is deprecated. */ - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - }> + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + } + + // Object1 + // -------------------------------------------------------------------------------------------------- + // + + export interface Object1 extends $.OutputObject { + name: 'Object1' + fields: { + __typename: Object1.__typename + ABCEnum: Object1.ABCEnum + boolean: Object1.$boolean + float: Object1.float + id: Object1.id + int: Object1.int + string: Object1.$string + } + } + + export namespace Object1 { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Object1' + } + } + + export interface ABCEnum extends $.OutputField { + name: 'ABCEnum' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ABCEnum + } + + export interface $boolean extends $.OutputField { + name: 'boolean' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Boolean + } + + export interface float extends $.OutputField { + name: 'float' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface int extends $.OutputField { + name: 'int' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + + export interface $string extends $.OutputField { + name: 'string' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + + // Object1ImplementingInterface + // -------------------------------------------------------------------------------------------------- + // - export type Object1 = $.OutputObject<'Object1', { - ABCEnum: $.OutputField<'ABCEnum', $.Nullable, null> - boolean: $.OutputField<'boolean', $.Nullable<$Scalar.Boolean>, null> - float: $.OutputField<'float', $.Nullable<$Scalar.Float>, null> - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - int: $.OutputField<'int', $.Nullable<$Scalar.Int>, null> - string: $.OutputField<'string', $.Nullable<$Scalar.String>, null> - }> + export interface Object1ImplementingInterface extends $.OutputObject { + name: 'Object1ImplementingInterface' + fields: { + __typename: Object1ImplementingInterface.__typename + id: Object1ImplementingInterface.id + int: Object1ImplementingInterface.int + } + } + + export namespace Object1ImplementingInterface { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Object1ImplementingInterface' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface int extends $.OutputField { + name: 'int' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + } + + // Object2ImplementingInterface + // -------------------------------------------------------------------------------------------------- + // + + export interface Object2ImplementingInterface extends $.OutputObject { + name: 'Object2ImplementingInterface' + fields: { + __typename: Object2ImplementingInterface.__typename + boolean: Object2ImplementingInterface.$boolean + id: Object2ImplementingInterface.id + } + } + + export namespace Object2ImplementingInterface { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Object2ImplementingInterface' + } + } + + export interface $boolean extends $.OutputField { + name: 'boolean' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Boolean + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + } + + // ObjectNested + // -------------------------------------------------------------------------------------------------- + // + + export interface ObjectNested extends $.OutputObject { + name: 'ObjectNested' + fields: { + __typename: ObjectNested.__typename + id: ObjectNested.id + object: ObjectNested.$object + } + } + + export namespace ObjectNested { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'ObjectNested' + } + } - export type Object1ImplementingInterface = $.OutputObject<'Object1ImplementingInterface', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - int: $.OutputField<'int', $.Nullable<$Scalar.Int>, null> - }> + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface $object extends $.OutputField { + name: 'object' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Object1 + } + } - export type Object2ImplementingInterface = $.OutputObject<'Object2ImplementingInterface', { - boolean: $.OutputField<'boolean', $.Nullable<$Scalar.Boolean>, null> - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - }> + // ObjectUnion + // -------------------------------------------------------------------------------------------------- + // + + export interface ObjectUnion extends $.OutputObject { + name: 'ObjectUnion' + fields: { + __typename: ObjectUnion.__typename + fooBarUnion: ObjectUnion.fooBarUnion + } + } + + export namespace ObjectUnion { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'ObjectUnion' + } + } + + export interface fooBarUnion extends $.OutputField { + name: 'fooBarUnion' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$FooBarUnion + } + } + + // lowerCaseObject + // -------------------------------------------------------------------------------------------------- + // + + export interface lowerCaseObject extends $.OutputObject { + name: 'lowerCaseObject' + fields: { + __typename: lowerCaseObject.__typename + id: lowerCaseObject.id + } + } + + export namespace lowerCaseObject { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'lowerCaseObject' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + } - export type ObjectNested = $.OutputObject<'ObjectNested', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - object: $.OutputField<'object', $.Nullable, null> - }> + // lowerCaseObject2 + // -------------------------------------------------------------------------------------------------- + // - export type ObjectUnion = $.OutputObject<'ObjectUnion', { - fooBarUnion: $.OutputField<'fooBarUnion', $.Nullable, null> - }> + export interface lowerCaseObject2 extends $.OutputObject { + name: 'lowerCaseObject2' + fields: { + __typename: lowerCaseObject2.__typename + int: lowerCaseObject2.int + } + } - export type lowerCaseObject = $.OutputObject<'lowerCaseObject', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - }> + export namespace lowerCaseObject2 { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'lowerCaseObject2' + } + } - export type lowerCaseObject2 = $.OutputObject<'lowerCaseObject2', { - int: $.OutputField<'int', $.Nullable<$Scalar.Int>, null> - }> + export interface int extends $.OutputField { + name: 'int' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + } // // @@ -326,25 +1220,113 @@ export namespace Schema { // // - export type InputObject = $.InputObject<'InputObject', { - date: $.InputField<$.Nullable<$Scalar.Date>> - dateRequired: $.InputField<$Scalar.Date> - id: $.InputField<$.Nullable<$Scalar.ID>> - idRequired: $.InputField<$Scalar.ID> - }, true> + // InputObject + // -------------------------------------------------------------------------------------------------- + // + + export interface InputObject extends $.InputObject { + name: 'InputObject' + isAllFieldsNullable: true + fields: { + date: InputObject.date + dateRequired: InputObject.dateRequired + id: InputObject.id + idRequired: InputObject.idRequired + } + } + + export namespace InputObject { + export interface date extends $.InputField { + name: 'date' + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateRequired extends $.InputField { + name: 'dateRequired' + inlineType: [1] + namedType: $$NamedTypes.$$Date + } + + export interface id extends $.InputField { + name: 'id' + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface idRequired extends $.InputField { + name: 'idRequired' + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + } + + // InputObjectCircular + // -------------------------------------------------------------------------------------------------- + // + + export interface InputObjectCircular extends $.InputObject { + name: 'InputObjectCircular' + isAllFieldsNullable: true + fields: { + circular: InputObjectCircular.circular + date: InputObjectCircular.date + } + } + + export namespace InputObjectCircular { + export interface circular extends $.InputField { + name: 'circular' + inlineType: [0] + namedType: $$NamedTypes.$$InputObjectCircular + } + + export interface date extends $.InputField { + name: 'date' + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + } + + // InputObjectNested + // -------------------------------------------------------------------------------------------------- + // + + export interface InputObjectNested extends $.InputObject { + name: 'InputObjectNested' + isAllFieldsNullable: true + fields: { + InputObject: InputObjectNested.InputObject + } + } - export type InputObjectCircular = $.InputObject<'InputObjectCircular', { - circular: $.InputField<$.Nullable> - date: $.InputField<$.Nullable<$Scalar.Date>> - }, true> + export namespace InputObjectNested { + export interface InputObject extends $.InputField { + name: 'InputObject' + inlineType: [0] + namedType: $$NamedTypes.$$InputObject + } + } - export type InputObjectNested = $.InputObject<'InputObjectNested', { - InputObject: $.InputField<$.Nullable> - }, true> + // InputObjectNestedNonNull + // -------------------------------------------------------------------------------------------------- + // + + export interface InputObjectNestedNonNull extends $.InputObject { + name: 'InputObjectNestedNonNull' + isAllFieldsNullable: false + fields: { + InputObject: InputObjectNestedNonNull.InputObject + } + } - export type InputObjectNestedNonNull = $.InputObject<'InputObjectNestedNonNull', { - InputObject: $.InputField - }, false> + export namespace InputObjectNestedNonNull { + export interface InputObject extends $.InputField { + name: 'InputObject' + inlineType: [1] + namedType: $$NamedTypes.$$InputObject + } + } // // @@ -362,17 +1344,50 @@ export namespace Schema { // // - export type DateInterface1 = $.Interface<'DateInterface1', { - date1: $.OutputField<'date1', $.Nullable<$Scalar.Date>, null> - }, [DateObject1]> + // DateInterface1 + // -------------------------------------------------------------------------------------------------- + // - export type Error = $.Interface<'Error', { - message: $.OutputField<'message', $Scalar.String, null> - }, [ErrorOne, ErrorTwo]> + export interface DateInterface1 extends $.Interface { + name: 'DateInterface1' + implementors: [DateObject1] + implementorsUnion: DateObject1 + implementorsIndex: { + DateObject1: DateObject1 + } + } - export type Interface = $.Interface<'Interface', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - }, [Object1ImplementingInterface, Object2ImplementingInterface]> + // Error + // -------------------------------------------------------------------------------------------------- + // + + export interface Error extends $.Interface { + name: 'Error' + implementors: [ErrorOne, ErrorTwo] + implementorsUnion: + | ErrorOne + | ErrorTwo + implementorsIndex: { + ErrorOne: ErrorOne + ErrorTwo: ErrorTwo + } + } + + // Interface + // -------------------------------------------------------------------------------------------------- + // + + export interface Interface extends $.Interface { + name: 'Interface' + implementors: [Object1ImplementingInterface, Object2ImplementingInterface] + implementorsUnion: + | Object1ImplementingInterface + | Object2ImplementingInterface + implementorsIndex: { + Object1ImplementingInterface: Object1ImplementingInterface + Object2ImplementingInterface: Object2ImplementingInterface + } + } // // @@ -390,16 +1405,74 @@ export namespace Schema { // // - export type DateUnion = $.Union<'DateUnion', [DateObject1, DateObject2]> + // DateUnion + // -------------------------------------------------------------------------------------------------- + // + + export interface DateUnion extends $.Union { + name: 'DateUnion' + members: [DateObject1, DateObject2] + membersUnion: + | DateObject1 + | DateObject2 + membersIndex: { + DateObject1: DateObject1 + DateObject2: DateObject2 + } + } + + // FooBarUnion + // -------------------------------------------------------------------------------------------------- + // /** * Union documentation. */ - export type FooBarUnion = $.Union<'FooBarUnion', [Bar, Foo]> + export interface FooBarUnion extends $.Union { + name: 'FooBarUnion' + members: [Bar, Foo] + membersUnion: + | Bar + | Foo + membersIndex: { + Bar: Bar + Foo: Foo + } + } + + // Result + // -------------------------------------------------------------------------------------------------- + // + + export interface Result extends $.Union { + name: 'Result' + members: [ErrorOne, ErrorTwo, Object1] + membersUnion: + | ErrorOne + | ErrorTwo + | Object1 + membersIndex: { + ErrorOne: ErrorOne + ErrorTwo: ErrorTwo + Object1: Object1 + } + } - export type Result = $.Union<'Result', [ErrorOne, ErrorTwo, Object1]> + // lowerCaseUnion + // -------------------------------------------------------------------------------------------------- + // - export type lowerCaseUnion = $.Union<'lowerCaseUnion', [lowerCaseObject, lowerCaseObject2]> + export interface lowerCaseUnion extends $.Union { + name: 'lowerCaseUnion' + members: [lowerCaseObject, lowerCaseObject2] + membersUnion: + | lowerCaseObject + | lowerCaseObject2 + membersIndex: { + lowerCaseObject: lowerCaseObject + lowerCaseObject2: lowerCaseObject2 + } + } // // @@ -417,6 +1490,10 @@ export namespace Schema { // // + // ABCEnum + // -------------------------------------------------------------------------------------------------- + // + /** * Enum documentation. * @@ -425,9 +1502,156 @@ export namespace Schema { * "B" - Enum B member documentation. * "C" - (DEPRECATED: Enum value C is deprecated.) */ - export type ABCEnum = $.Enum<'ABCEnum', ['A', 'B', 'C']> + export interface ABCEnum extends $.Enum { + name: 'ABCEnum' + members: ['A', 'B', 'C'] + membersUnion: + | 'A' + | 'B' + | 'C' + } + + // Case + // -------------------------------------------------------------------------------------------------- + // - export type Case = $.Enum<'Case', ['ErrorOne', 'ErrorTwo', 'Object1']> + export interface Case extends $.Enum { + name: 'Case' + members: ['ErrorOne', 'ErrorTwo', 'Object1'] + membersUnion: + | 'ErrorOne' + | 'ErrorTwo' + | 'Object1' + } + + // + // + // + // + // + // + // ================================================================================================== + // ScalarCustom + // ================================================================================================== + // + // + // + // + // + // + + // Date + // -------------------------------------------------------------------------------------------------- + // + + export type Date = $Scalar.Date + + // + // + // + // + // + // + // ================================================================================================== + // ScalarStandard + // ================================================================================================== + // + // + // + // + // + // + + // Boolean + // -------------------------------------------------------------------------------------------------- + // + + export type Boolean = $.StandardTypes.Boolean + + // Float + // -------------------------------------------------------------------------------------------------- + // + + export type Float = $.StandardTypes.Float + + // ID + // -------------------------------------------------------------------------------------------------- + // + + export type ID = $.StandardTypes.ID + + // Int + // -------------------------------------------------------------------------------------------------- + // + + export type Int = $.StandardTypes.Int + + // String + // -------------------------------------------------------------------------------------------------- + // + + export type String = $.StandardTypes.String + + // + // + // + // + // + // + // ================================================================================================== + // Named Types Index + // ================================================================================================== + // + // + // + // + // + // + + /** + * [1] These definitions serve to allow field selection interfaces to extend their respective object type without + * name clashing between the field name and the object name. + * + * For example imagine `Query.Foo` field with type also called `Foo`. Our generated interfaces for each field + * would end up with an error of `export interface Foo extends Foo ...` + */ + + namespace $$NamedTypes { + export type $$Mutation = Mutation + export type $$Query = Query + export type $$Bar = Bar + export type $$DateObject1 = DateObject1 + export type $$DateObject2 = DateObject2 + export type $$ErrorOne = ErrorOne + export type $$ErrorTwo = ErrorTwo + export type $$Foo = Foo + export type $$Object1 = Object1 + export type $$Object1ImplementingInterface = Object1ImplementingInterface + export type $$Object2ImplementingInterface = Object2ImplementingInterface + export type $$ObjectNested = ObjectNested + export type $$ObjectUnion = ObjectUnion + export type $$lowerCaseObject = lowerCaseObject + export type $$lowerCaseObject2 = lowerCaseObject2 + export type $$InputObject = InputObject + export type $$InputObjectCircular = InputObjectCircular + export type $$InputObjectNested = InputObjectNested + export type $$InputObjectNestedNonNull = InputObjectNestedNonNull + export type $$DateInterface1 = DateInterface1 + export type $$Error = Error + export type $$Interface = Interface + export type $$DateUnion = DateUnion + export type $$FooBarUnion = FooBarUnion + export type $$Result = Result + export type $$lowerCaseUnion = lowerCaseUnion + export type $$ABCEnum = ABCEnum + export type $$Case = Case + export type $$Date = Date + export type $$Boolean = Boolean + export type $$Float = Float + export type $$ID = ID + export type $$Int = Int + export type $$String = String + } } // @@ -445,7 +1669,8 @@ export namespace Schema { // // // -export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $$Utilities.Schema { + +export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $ { name: Data.Name RootTypesPresent: ['Mutation', 'Query'] RootUnion: Schema.Mutation | Schema.Query diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/SelectionSets.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/SelectionSets.ts index 2efcbc73b..c5c6e3883 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/SelectionSets.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/SelectionSets.ts @@ -448,7 +448,9 @@ export namespace Query { $?: InputObjectNested$Arguments<$Scalars> } - export interface InputObjectNested$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface InputObjectNested$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input?: $NamedTypes.$InputObjectNested<$Scalars> | undefined | null } @@ -479,7 +481,9 @@ export namespace Query { $: InputObjectNestedNonNull$Arguments<$Scalars> } - export interface InputObjectNestedNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface InputObjectNestedNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input: $NamedTypes.$InputObjectNestedNonNull<$Scalars> } @@ -532,7 +536,9 @@ export namespace Query { $?: argInputObjectCircular$Arguments<$Scalars> } - export interface argInputObjectCircular$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface argInputObjectCircular$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input?: $NamedTypes.$InputObjectCircular<$Scalars> | undefined | null } @@ -586,7 +592,9 @@ export namespace Query { $?: dateArg$Arguments<$Scalars> } - export interface dateArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date?: | $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> @@ -622,7 +630,9 @@ export namespace Query { $?: dateArgInputObject$Arguments<$Scalars> } - export interface dateArgInputObject$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgInputObject$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input?: $NamedTypes.$InputObject<$Scalars> | undefined | null } @@ -654,7 +664,9 @@ export namespace Query { $?: dateArgList$Arguments<$Scalars> } - export interface dateArgList$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgList$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date?: | Array< | $$Utilities.Schema.Scalar.GetDecoded< @@ -694,7 +706,9 @@ export namespace Query { $: dateArgNonNull$Arguments<$Scalars> } - export interface dateArgNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date: $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> > @@ -725,7 +739,9 @@ export namespace Query { $: dateArgNonNullList$Arguments<$Scalars> } - export interface dateArgNonNullList$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgNonNullList$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date: Array< | $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> @@ -761,7 +777,9 @@ export namespace Query { $: dateArgNonNullListNonNull$Arguments<$Scalars> } - export interface dateArgNonNullListNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgNonNullListNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date: Array< | $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> @@ -948,7 +966,9 @@ export namespace Query { $?: error$Arguments<$Scalars> } - export interface error$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface error$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { case?: string | undefined | null } @@ -1062,7 +1082,9 @@ export namespace Query { $: interfaceWithArgs$Arguments<$Scalars> } - export interface interfaceWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface interfaceWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { id: string } @@ -1304,11 +1326,17 @@ export namespace Query { $?: objectWithArgs$Arguments<$Scalars> } - export interface objectWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface objectWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { boolean?: boolean | undefined | null + float?: number | undefined | null + id?: string | undefined | null + int?: number | undefined | null + string?: string | undefined | null } @@ -1336,7 +1364,9 @@ export namespace Query { $: result$Arguments<$Scalars> } - export interface result$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface result$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { $case: $NamedTypes.$Case } @@ -1366,7 +1396,9 @@ export namespace Query { $?: resultNonNull$Arguments<$Scalars> } - export interface resultNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface resultNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { $case?: $NamedTypes.$Case | undefined | null } @@ -1418,7 +1450,9 @@ export namespace Query { $?: stringWithArgEnum$Arguments<$Scalars> } - export interface stringWithArgEnum$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithArgEnum$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { $ABCEnum?: $NamedTypes.$ABCEnum | undefined | null } @@ -1450,7 +1484,9 @@ export namespace Query { $?: stringWithArgInputObject$Arguments<$Scalars> } - export interface stringWithArgInputObject$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithArgInputObject$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input?: $NamedTypes.$InputObject<$Scalars> | undefined | null } @@ -1481,9 +1517,9 @@ export namespace Query { $: stringWithArgInputObjectRequired$Arguments<$Scalars> } - export interface stringWithArgInputObjectRequired$Arguments< - $Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}, - > { + export interface stringWithArgInputObjectRequired$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input: $NamedTypes.$InputObject<$Scalars> } @@ -1514,11 +1550,21 @@ export namespace Query { $?: stringWithArgs$Arguments<$Scalars> } - export interface stringWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { boolean?: boolean | undefined | null + float?: number | undefined | null + id?: string | undefined | null + /** + * @deprecated Example of argument deprecation reason here. + */ int?: number | undefined | null + /** + * Example of some argument documentation here. + */ string?: string | undefined | null } @@ -1549,7 +1595,9 @@ export namespace Query { $?: stringWithListArg$Arguments<$Scalars> } - export interface stringWithListArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithListArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { ints?: Array | undefined | null } @@ -1580,7 +1628,9 @@ export namespace Query { $: stringWithListArgRequired$Arguments<$Scalars> } - export interface stringWithListArgRequired$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithListArgRequired$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { ints: Array } @@ -1610,7 +1660,9 @@ export namespace Query { $: stringWithRequiredArg$Arguments<$Scalars> } - export interface stringWithRequiredArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithRequiredArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { string: string } @@ -1682,7 +1734,9 @@ export namespace Query { $?: unionFooBarWithArgs$Arguments<$Scalars> } - export interface unionFooBarWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface unionFooBarWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { id?: string | undefined | null } @@ -1792,15 +1846,19 @@ export interface InputObject<$Scalars extends $$Utilities.Schema.Scalar.ScalarMa > | undefined | null + dateRequired: $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> > + id?: string | undefined | null + idRequired: string } export interface InputObjectCircular<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { circular?: $NamedTypes.$InputObjectCircular<$Scalars> | undefined | null + date?: | $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> diff --git a/src/generator/generator/__snapshots__/generate.test.ts.snap b/src/generator/generator/__snapshots__/generate.test.ts.snap index 14d6476df..ccf6f6cd3 100644 --- a/src/generator/generator/__snapshots__/generate.test.ts.snap +++ b/src/generator/generator/__snapshots__/generate.test.ts.snap @@ -115,6 +115,7 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > > > + id: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.id<$Context['scalars']>>, ) => Promise< @@ -126,6 +127,7 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > > > + idNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.idNonNull<$Context['scalars']>>, ) => Promise< @@ -159,6 +161,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + InputObjectNested: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.InputObjectNested<$Context['scalars']>>, ) => Promise< @@ -170,6 +173,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + InputObjectNestedNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.InputObjectNestedNonNull<$Context['scalars']>>, ) => Promise< @@ -195,6 +199,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + argInputObjectCircular: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.argInputObjectCircular<$Context['scalars']>>, ) => Promise< @@ -206,6 +211,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + date: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.date<$Context['scalars']>>, ) => Promise< @@ -217,6 +223,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArg: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArg<$Context['scalars']>>, ) => Promise< @@ -228,6 +235,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgInputObject: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgInputObject<$Context['scalars']>>, ) => Promise< @@ -239,6 +247,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgList: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgList<$Context['scalars']>>, ) => Promise< @@ -250,6 +259,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNull<$Context['scalars']>>, ) => Promise< @@ -261,6 +271,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgNonNullList: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullList<$Context['scalars']>>, ) => Promise< @@ -272,6 +283,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgNonNullListNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullListNonNull<$Context['scalars']>>, ) => Promise< @@ -283,6 +295,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateInterface1: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateInterface1<$Context['scalars']>>, ) => Promise< @@ -294,6 +307,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateList: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateList<$Context['scalars']>>, ) => Promise< @@ -305,6 +319,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateListList: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateListList<$Context['scalars']>>, ) => Promise< @@ -316,6 +331,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateListNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateListNonNull<$Context['scalars']>>, ) => Promise< @@ -327,6 +343,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateNonNull<$Context['scalars']>>, ) => Promise< @@ -338,6 +355,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateObject1: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateObject1<$Context['scalars']>>, ) => Promise< @@ -349,6 +367,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateUnion: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateUnion<$Context['scalars']>>, ) => Promise< @@ -360,6 +379,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + error: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.error<$Context['scalars']>>, ) => Promise< @@ -371,6 +391,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + id: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.id<$Context['scalars']>>, ) => Promise< @@ -382,6 +403,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + idNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.idNonNull<$Context['scalars']>>, ) => Promise< @@ -393,6 +415,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + interface: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$interface<$Context['scalars']>>, ) => Promise< @@ -404,6 +427,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + interfaceNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.interfaceNonNull<$Context['scalars']>>, ) => Promise< @@ -415,6 +439,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + interfaceWithArgs: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.interfaceWithArgs<$Context['scalars']>>, ) => Promise< @@ -426,6 +451,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + listInt: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listInt<$Context['scalars']>>, ) => Promise< @@ -437,6 +463,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + listIntNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listIntNonNull<$Context['scalars']>>, ) => Promise< @@ -448,6 +475,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + listListInt: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listListInt<$Context['scalars']>>, ) => Promise< @@ -459,6 +487,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + listListIntNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listListIntNonNull<$Context['scalars']>>, ) => Promise< @@ -470,6 +499,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + lowerCaseUnion: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.lowerCaseUnion<$Context['scalars']>>, ) => Promise< @@ -481,6 +511,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + object: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$object<$Context['scalars']>>, ) => Promise< @@ -492,6 +523,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectList: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectList<$Context['scalars']>>, ) => Promise< @@ -503,6 +535,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectListNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectListNonNull<$Context['scalars']>>, ) => Promise< @@ -514,6 +547,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectNested: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectNested<$Context['scalars']>>, ) => Promise< @@ -525,6 +559,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectNonNull<$Context['scalars']>>, ) => Promise< @@ -536,6 +571,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectWithArgs: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectWithArgs<$Context['scalars']>>, ) => Promise< @@ -547,6 +583,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + result: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.result<$Context['scalars']>>, ) => Promise< @@ -558,6 +595,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + resultNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.resultNonNull<$Context['scalars']>>, ) => Promise< @@ -569,6 +607,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + string: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$string<$Context['scalars']>>, ) => Promise< @@ -580,6 +619,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithArgEnum: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgEnum<$Context['scalars']>>, ) => Promise< @@ -591,6 +631,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithArgInputObject: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgInputObject<$Context['scalars']>>, ) => Promise< @@ -602,6 +643,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithArgInputObjectRequired: <$SelectionSet>( selectionSet: $$Utilities.Exact< $SelectionSet, @@ -630,6 +672,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithListArg: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithListArg<$Context['scalars']>>, ) => Promise< @@ -641,6 +684,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithListArgRequired: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithListArgRequired<$Context['scalars']>>, ) => Promise< @@ -652,6 +696,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithRequiredArg: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithRequiredArg<$Context['scalars']>>, ) => Promise< @@ -663,6 +708,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionFooBar: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBar<$Context['scalars']>>, ) => Promise< @@ -674,6 +720,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionFooBarNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBarNonNull<$Context['scalars']>>, ) => Promise< @@ -685,6 +732,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionFooBarWithArgs: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBarWithArgs<$Context['scalars']>>, ) => Promise< @@ -696,6 +744,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionObject: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionObject<$Context['scalars']>>, ) => Promise< @@ -707,6 +756,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionObjectNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionObjectNonNull<$Context['scalars']>>, ) => Promise< @@ -901,68 +951,1392 @@ export interface Result { <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Result>): $SelectionSet } -export interface lowerCaseUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseUnion>): $SelectionSet -} +export interface lowerCaseUnion { + <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseUnion>): $SelectionSet +} + +// +// +// +// +// +// +// ================================================================================================== +// Interface +// ================================================================================================== +// +// +// +// +// +// + +export interface DateInterface1 { + <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateInterface1>): $SelectionSet +} + +export interface Error { + <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Error>): $SelectionSet +} + +export interface Interface { + <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Interface>): $SelectionSet +} +" +`; + +exports[`kitchen-sink generated modules > modules/Scalar.ts 1`] = ` +"import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' + +export * from '../../../../../../src/types/Schema/StandardTypes/scalar.js' + +// +// +// +// +// CUSTOM SCALAR TYPE +// DATE +// -------------------------------------------------------------------------------------------------- +// Date +// -------------------------------------------------------------------------------------------------- +// +// + +export type Date = $$Utilities.Schema.Scalar.ScalarCodecless<'Date'> +" +`; + +exports[`kitchen-sink generated modules > modules/Schema.ts 1`] = ` +"import type { Schema as $ } from '../../../../../../src/entrypoints/utilities-for-generated.js' +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import type * as Data from './Data.js' +import type * as MethodsRoot from './MethodsRoot.js' +import type * as $Scalar from './Scalar.js' + +export namespace Schema { + // + // + // + // + // + // + // ================================================================================================== + // Root + // ================================================================================================== + // + // + // + // + // + // + + // Mutation + // -------------------------------------------------------------------------------------------------- + // + + export interface Mutation extends $.OutputObject { + name: 'Mutation' + fields: { + __typename: Mutation.__typename + id: Mutation.id + idNonNull: Mutation.idNonNull + } + } + + export namespace Mutation { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Mutation' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface idNonNull extends $.OutputField { + name: 'idNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + } + + // Query + // -------------------------------------------------------------------------------------------------- + // + + export interface Query extends $.OutputObject { + name: 'Query' + fields: { + __typename: Query.__typename + InputObjectNested: Query.InputObjectNested + InputObjectNestedNonNull: Query.InputObjectNestedNonNull + abcEnum: Query.abcEnum + argInputObjectCircular: Query.argInputObjectCircular + date: Query.date + dateArg: Query.dateArg + dateArgInputObject: Query.dateArgInputObject + dateArgList: Query.dateArgList + dateArgNonNull: Query.dateArgNonNull + dateArgNonNullList: Query.dateArgNonNullList + dateArgNonNullListNonNull: Query.dateArgNonNullListNonNull + dateInterface1: Query.dateInterface1 + dateList: Query.dateList + dateListList: Query.dateListList + dateListNonNull: Query.dateListNonNull + dateNonNull: Query.dateNonNull + dateObject1: Query.dateObject1 + dateUnion: Query.dateUnion + error: Query.error + id: Query.id + idNonNull: Query.idNonNull + interface: Query.$interface + interfaceNonNull: Query.interfaceNonNull + interfaceWithArgs: Query.interfaceWithArgs + listInt: Query.listInt + listIntNonNull: Query.listIntNonNull + listListInt: Query.listListInt + listListIntNonNull: Query.listListIntNonNull + lowerCaseUnion: Query.lowerCaseUnion + object: Query.$object + objectList: Query.objectList + objectListNonNull: Query.objectListNonNull + objectNested: Query.objectNested + objectNonNull: Query.objectNonNull + objectWithArgs: Query.objectWithArgs + result: Query.result + resultNonNull: Query.resultNonNull + string: Query.$string + stringWithArgEnum: Query.stringWithArgEnum + stringWithArgInputObject: Query.stringWithArgInputObject + stringWithArgInputObjectRequired: Query.stringWithArgInputObjectRequired + stringWithArgs: Query.stringWithArgs + stringWithListArg: Query.stringWithListArg + stringWithListArgRequired: Query.stringWithListArgRequired + stringWithRequiredArg: Query.stringWithRequiredArg + unionFooBar: Query.unionFooBar + unionFooBarNonNull: Query.unionFooBarNonNull + unionFooBarWithArgs: Query.unionFooBarWithArgs + unionObject: Query.unionObject + unionObjectNonNull: Query.unionObjectNonNull + } + } + + export namespace Query { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Query' + } + } + + export interface InputObjectNested extends $.OutputField { + name: 'InputObjectNested' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [0] + namedType: $$NamedTypes.$$InputObjectNested + } + } + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface InputObjectNestedNonNull extends $.OutputField { + name: 'InputObjectNestedNonNull' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [1] + namedType: $$NamedTypes.$$InputObjectNestedNonNull + } + } + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + /** + * Query enum field documentation. + */ + export interface abcEnum extends $.OutputField { + name: 'abcEnum' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ABCEnum + } + + export interface argInputObjectCircular extends $.OutputField { + name: 'argInputObjectCircular' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [0] + namedType: $$NamedTypes.$$InputObjectCircular + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface date extends $.OutputField { + name: 'date' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArg extends $.OutputField { + name: 'dateArg' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgInputObject extends $.OutputField { + name: 'dateArgInputObject' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [0] + namedType: $$NamedTypes.$$InputObject + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgList extends $.OutputField { + name: 'dateArgList' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgNonNull extends $.OutputField { + name: 'dateArgNonNull' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [1] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgNonNullList extends $.OutputField { + name: 'dateArgNonNullList' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [1, [0]] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgNonNullListNonNull extends $.OutputField { + name: 'dateArgNonNullListNonNull' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateInterface1 extends $.OutputField { + name: 'dateInterface1' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$DateInterface1 + } + + export interface dateList extends $.OutputField { + name: 'dateList' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Date + } + + export interface dateListList extends $.OutputField { + name: 'dateListList' + arguments: {} + inlineType: [0, [1, [1]]] + namedType: $$NamedTypes.$$Date + } + + export interface dateListNonNull extends $.OutputField { + name: 'dateListNonNull' + arguments: {} + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Date + } + + export interface dateNonNull extends $.OutputField { + name: 'dateNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$Date + } + + export interface dateObject1 extends $.OutputField { + name: 'dateObject1' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$DateObject1 + } + + export interface dateUnion extends $.OutputField { + name: 'dateUnion' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$DateUnion + } + + export interface error extends $.OutputField { + name: 'error' + arguments: { + case: { + kind: 'InputField' + name: 'case' + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface idNonNull extends $.OutputField { + name: 'idNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + + export interface $interface extends $.OutputField { + name: 'interface' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Interface + } + + export interface interfaceNonNull extends $.OutputField { + name: 'interfaceNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$Interface + } + + export interface interfaceWithArgs extends $.OutputField { + name: 'interfaceWithArgs' + arguments: { + id: { + kind: 'InputField' + name: 'id' + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Interface + } + + export interface listInt extends $.OutputField { + name: 'listInt' + arguments: {} + inlineType: [0, [0]] + namedType: $$NamedTypes.$$Int + } + + export interface listIntNonNull extends $.OutputField { + name: 'listIntNonNull' + arguments: {} + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Int + } + + export interface listListInt extends $.OutputField { + name: 'listListInt' + arguments: {} + inlineType: [0, [0, [0]]] + namedType: $$NamedTypes.$$Int + } + + export interface listListIntNonNull extends $.OutputField { + name: 'listListIntNonNull' + arguments: {} + inlineType: [1, [1, [1]]] + namedType: $$NamedTypes.$$Int + } + + export interface lowerCaseUnion extends $.OutputField { + name: 'lowerCaseUnion' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$lowerCaseUnion + } + + export interface $object extends $.OutputField { + name: 'object' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Object1 + } + + export interface objectList extends $.OutputField { + name: 'objectList' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Object1 + } + + export interface objectListNonNull extends $.OutputField { + name: 'objectListNonNull' + arguments: {} + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Object1 + } + + export interface objectNested extends $.OutputField { + name: 'objectNested' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ObjectNested + } + + export interface objectNonNull extends $.OutputField { + name: 'objectNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$Object1 + } + + export interface objectWithArgs extends $.OutputField { + name: 'objectWithArgs' + arguments: { + boolean: { + kind: 'InputField' + name: 'boolean' + inlineType: [0] + namedType: $$NamedTypes.$$Boolean + } + float: { + kind: 'InputField' + name: 'float' + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + id: { + kind: 'InputField' + name: 'id' + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + int: { + kind: 'InputField' + name: 'int' + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + string: { + kind: 'InputField' + name: 'string' + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Object1 + } + + export interface result extends $.OutputField { + name: 'result' + arguments: { + case: { + kind: 'InputField' + name: 'case' + inlineType: [1] + namedType: $$NamedTypes.$$Case + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Result + } + + export interface resultNonNull extends $.OutputField { + name: 'resultNonNull' + arguments: { + case: { + kind: 'InputField' + name: 'case' + inlineType: [0] + namedType: $$NamedTypes.$$Case + } + } + inlineType: [1] + namedType: $$NamedTypes.$$Result + } + + export interface $string extends $.OutputField { + name: 'string' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithArgEnum extends $.OutputField { + name: 'stringWithArgEnum' + arguments: { + ABCEnum: { + kind: 'InputField' + name: 'ABCEnum' + inlineType: [0] + namedType: $$NamedTypes.$$ABCEnum + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithArgInputObject extends $.OutputField { + name: 'stringWithArgInputObject' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [0] + namedType: $$NamedTypes.$$InputObject + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithArgInputObjectRequired extends $.OutputField { + name: 'stringWithArgInputObjectRequired' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [1] + namedType: $$NamedTypes.$$InputObject + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + /** + * The given arguments are reflected back as a JSON string. + */ + export interface stringWithArgs extends $.OutputField { + name: 'stringWithArgs' + arguments: { + boolean: { + kind: 'InputField' + name: 'boolean' + inlineType: [0] + namedType: $$NamedTypes.$$Boolean + } + float: { + kind: 'InputField' + name: 'float' + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + id: { + kind: 'InputField' + name: 'id' + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + /** + * @deprecated Example of argument deprecation reason here. + */ + int: { + kind: 'InputField' + name: 'int' + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + /** + * Example of some argument documentation here. + */ + string: { + kind: 'InputField' + name: 'string' + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithListArg extends $.OutputField { + name: 'stringWithListArg' + arguments: { + ints: { + kind: 'InputField' + name: 'ints' + inlineType: [0, [0]] + namedType: $$NamedTypes.$$Int + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithListArgRequired extends $.OutputField { + name: 'stringWithListArgRequired' + arguments: { + ints: { + kind: 'InputField' + name: 'ints' + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Int + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithRequiredArg extends $.OutputField { + name: 'stringWithRequiredArg' + arguments: { + string: { + kind: 'InputField' + name: 'string' + inlineType: [1] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface unionFooBar extends $.OutputField { + name: 'unionFooBar' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$FooBarUnion + } + + export interface unionFooBarNonNull extends $.OutputField { + name: 'unionFooBarNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$FooBarUnion + } + + export interface unionFooBarWithArgs extends $.OutputField { + name: 'unionFooBarWithArgs' + arguments: { + id: { + kind: 'InputField' + name: 'id' + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + } + inlineType: [0] + namedType: $$NamedTypes.$$FooBarUnion + } + + export interface unionObject extends $.OutputField { + name: 'unionObject' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ObjectUnion + } + + export interface unionObjectNonNull extends $.OutputField { + name: 'unionObjectNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$ObjectUnion + } + } + + // + // + // + // + // + // + // ================================================================================================== + // OutputObject + // ================================================================================================== + // + // + // + // + // + // + + // Bar + // -------------------------------------------------------------------------------------------------- + // + + export interface Bar extends $.OutputObject { + name: 'Bar' + fields: { + __typename: Bar.__typename + int: Bar.int + } + } + + export namespace Bar { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Bar' + } + } + + export interface int extends $.OutputField { + name: 'int' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + } + + // DateObject1 + // -------------------------------------------------------------------------------------------------- + // + + export interface DateObject1 extends $.OutputObject { + name: 'DateObject1' + fields: { + __typename: DateObject1.__typename + date1: DateObject1.date1 + } + } + + export namespace DateObject1 { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'DateObject1' + } + } + + export interface date1 extends $.OutputField { + name: 'date1' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + } + + // DateObject2 + // -------------------------------------------------------------------------------------------------- + // + + export interface DateObject2 extends $.OutputObject { + name: 'DateObject2' + fields: { + __typename: DateObject2.__typename + date2: DateObject2.date2 + } + } + + export namespace DateObject2 { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'DateObject2' + } + } + + export interface date2 extends $.OutputField { + name: 'date2' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + } + + // ErrorOne + // -------------------------------------------------------------------------------------------------- + // + + export interface ErrorOne extends $.OutputObject { + name: 'ErrorOne' + fields: { + __typename: ErrorOne.__typename + infoId: ErrorOne.infoId + message: ErrorOne.message + } + } + + export namespace ErrorOne { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'ErrorOne' + } + } + + export interface infoId extends $.OutputField { + name: 'infoId' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface message extends $.OutputField { + name: 'message' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$String + } + } + + // ErrorTwo + // -------------------------------------------------------------------------------------------------- + // + + export interface ErrorTwo extends $.OutputObject { + name: 'ErrorTwo' + fields: { + __typename: ErrorTwo.__typename + infoInt: ErrorTwo.infoInt + message: ErrorTwo.message + } + } + + export namespace ErrorTwo { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'ErrorTwo' + } + } + + export interface infoInt extends $.OutputField { + name: 'infoInt' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + + export interface message extends $.OutputField { + name: 'message' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$String + } + } + + // Foo + // -------------------------------------------------------------------------------------------------- + // + + /** + * Object documentation. + */ + export interface Foo extends $.OutputObject { + name: 'Foo' + fields: { + __typename: Foo.__typename + id: Foo.id + } + } + + export namespace Foo { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Foo' + } + } + + /** + * Field documentation. + * + * @deprecated Field a is deprecated. + */ + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + } + + // Object1 + // -------------------------------------------------------------------------------------------------- + // + + export interface Object1 extends $.OutputObject { + name: 'Object1' + fields: { + __typename: Object1.__typename + ABCEnum: Object1.ABCEnum + boolean: Object1.$boolean + float: Object1.float + id: Object1.id + int: Object1.int + string: Object1.$string + } + } + + export namespace Object1 { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Object1' + } + } + + export interface ABCEnum extends $.OutputField { + name: 'ABCEnum' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ABCEnum + } + + export interface $boolean extends $.OutputField { + name: 'boolean' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Boolean + } + + export interface float extends $.OutputField { + name: 'float' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface int extends $.OutputField { + name: 'int' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + + export interface $string extends $.OutputField { + name: 'string' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + + // Object1ImplementingInterface + // -------------------------------------------------------------------------------------------------- + // + + export interface Object1ImplementingInterface extends $.OutputObject { + name: 'Object1ImplementingInterface' + fields: { + __typename: Object1ImplementingInterface.__typename + id: Object1ImplementingInterface.id + int: Object1ImplementingInterface.int + } + } + + export namespace Object1ImplementingInterface { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Object1ImplementingInterface' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface int extends $.OutputField { + name: 'int' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + } + + // Object2ImplementingInterface + // -------------------------------------------------------------------------------------------------- + // + + export interface Object2ImplementingInterface extends $.OutputObject { + name: 'Object2ImplementingInterface' + fields: { + __typename: Object2ImplementingInterface.__typename + boolean: Object2ImplementingInterface.$boolean + id: Object2ImplementingInterface.id + } + } + + export namespace Object2ImplementingInterface { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Object2ImplementingInterface' + } + } + + export interface $boolean extends $.OutputField { + name: 'boolean' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Boolean + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + } + + // ObjectNested + // -------------------------------------------------------------------------------------------------- + // + + export interface ObjectNested extends $.OutputObject { + name: 'ObjectNested' + fields: { + __typename: ObjectNested.__typename + id: ObjectNested.id + object: ObjectNested.$object + } + } + + export namespace ObjectNested { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'ObjectNested' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface $object extends $.OutputField { + name: 'object' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Object1 + } + } + + // ObjectUnion + // -------------------------------------------------------------------------------------------------- + // + + export interface ObjectUnion extends $.OutputObject { + name: 'ObjectUnion' + fields: { + __typename: ObjectUnion.__typename + fooBarUnion: ObjectUnion.fooBarUnion + } + } + + export namespace ObjectUnion { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'ObjectUnion' + } + } + + export interface fooBarUnion extends $.OutputField { + name: 'fooBarUnion' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$FooBarUnion + } + } + + // lowerCaseObject + // -------------------------------------------------------------------------------------------------- + // + + export interface lowerCaseObject extends $.OutputObject { + name: 'lowerCaseObject' + fields: { + __typename: lowerCaseObject.__typename + id: lowerCaseObject.id + } + } + + export namespace lowerCaseObject { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'lowerCaseObject' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + } + + // lowerCaseObject2 + // -------------------------------------------------------------------------------------------------- + // + + export interface lowerCaseObject2 extends $.OutputObject { + name: 'lowerCaseObject2' + fields: { + __typename: lowerCaseObject2.__typename + int: lowerCaseObject2.int + } + } + + export namespace lowerCaseObject2 { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'lowerCaseObject2' + } + } + + export interface int extends $.OutputField { + name: 'int' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + } + + // + // + // + // + // + // + // ================================================================================================== + // InputObject + // ================================================================================================== + // + // + // + // + // + // + + // InputObject + // -------------------------------------------------------------------------------------------------- + // + + export interface InputObject extends $.InputObject { + name: 'InputObject' + isAllFieldsNullable: true + fields: { + date: InputObject.date + dateRequired: InputObject.dateRequired + id: InputObject.id + idRequired: InputObject.idRequired + } + } + + export namespace InputObject { + export interface date extends $.InputField { + name: 'date' + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateRequired extends $.InputField { + name: 'dateRequired' + inlineType: [1] + namedType: $$NamedTypes.$$Date + } + + export interface id extends $.InputField { + name: 'id' + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface idRequired extends $.InputField { + name: 'idRequired' + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + } + + // InputObjectCircular + // -------------------------------------------------------------------------------------------------- + // + + export interface InputObjectCircular extends $.InputObject { + name: 'InputObjectCircular' + isAllFieldsNullable: true + fields: { + circular: InputObjectCircular.circular + date: InputObjectCircular.date + } + } -// -// -// -// -// -// -// ================================================================================================== -// Interface -// ================================================================================================== -// -// -// -// -// -// + export namespace InputObjectCircular { + export interface circular extends $.InputField { + name: 'circular' + inlineType: [0] + namedType: $$NamedTypes.$$InputObjectCircular + } -export interface DateInterface1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateInterface1>): $SelectionSet -} + export interface date extends $.InputField { + name: 'date' + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + } -export interface Error { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Error>): $SelectionSet -} + // InputObjectNested + // -------------------------------------------------------------------------------------------------- + // -export interface Interface { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Interface>): $SelectionSet -} -" -`; + export interface InputObjectNested extends $.InputObject { + name: 'InputObjectNested' + isAllFieldsNullable: true + fields: { + InputObject: InputObjectNested.InputObject + } + } -exports[`kitchen-sink generated modules > modules/Scalar.ts 1`] = ` -"import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' + export namespace InputObjectNested { + export interface InputObject extends $.InputField { + name: 'InputObject' + inlineType: [0] + namedType: $$NamedTypes.$$InputObject + } + } -export * from '../../../../../../src/types/Schema/StandardTypes/scalar.js' + // InputObjectNestedNonNull + // -------------------------------------------------------------------------------------------------- + // -// -// -// -// -// CUSTOM SCALAR TYPE -// DATE -// -------------------------------------------------------------------------------------------------- -// Date -// -------------------------------------------------------------------------------------------------- -// -// + export interface InputObjectNestedNonNull extends $.InputObject { + name: 'InputObjectNestedNonNull' + isAllFieldsNullable: false + fields: { + InputObject: InputObjectNestedNonNull.InputObject + } + } -export type Date = $$Utilities.Schema.Scalar.ScalarCodecless<'Date'> -" -`; + export namespace InputObjectNestedNonNull { + export interface InputObject extends $.InputField { + name: 'InputObject' + inlineType: [1] + namedType: $$NamedTypes.$$InputObject + } + } -exports[`kitchen-sink generated modules > modules/Schema.ts 1`] = ` -"import type { Schema as $ } from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type * as Data from './Data.js' -import type * as MethodsRoot from './MethodsRoot.js' -import type * as $Scalar from './Scalar.js' -export namespace Schema { // // // @@ -970,7 +2344,7 @@ export namespace Schema { // // // ================================================================================================== - // Root + // Interface // ================================================================================================== // // @@ -979,209 +2353,50 @@ export namespace Schema { // // - export type Mutation = $.StandardTypes.Mutation<{ - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - idNonNull: $.OutputField<'idNonNull', $Scalar.ID, null> - }> + // DateInterface1 + // -------------------------------------------------------------------------------------------------- + // - export type Query = $.StandardTypes.Query<{ - InputObjectNested: $.OutputField< - 'InputObjectNested', - $.Nullable<$Scalar.ID>, - $.Args<{ - input: $.InputField<$.Nullable> - }, true> - > - InputObjectNestedNonNull: $.OutputField< - 'InputObjectNestedNonNull', - $.Nullable<$Scalar.ID>, - $.Args<{ - input: $.InputField - }, false> - > - /** - * Query enum field documentation. - */ - abcEnum: $.OutputField<'abcEnum', $.Nullable, null> - argInputObjectCircular: $.OutputField< - 'argInputObjectCircular', - $.Nullable<$Scalar.String>, - $.Args<{ - input: $.InputField<$.Nullable> - }, true> - > - date: $.OutputField<'date', $.Nullable<$Scalar.Date>, null> - dateArg: $.OutputField< - 'dateArg', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$.Nullable<$Scalar.Date>> - }, true> - > - dateArgInputObject: $.OutputField< - 'dateArgInputObject', - $.Nullable<$Scalar.Date>, - $.Args<{ - input: $.InputField<$.Nullable> - }, true> - > - dateArgList: $.OutputField< - 'dateArgList', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$.Nullable<$.List<$Scalar.Date>>> - }, true> - > - dateArgNonNull: $.OutputField< - 'dateArgNonNull', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$Scalar.Date> - }, false> - > - dateArgNonNullList: $.OutputField< - 'dateArgNonNullList', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$.List<$.Nullable<$Scalar.Date>>> - }, false> - > - dateArgNonNullListNonNull: $.OutputField< - 'dateArgNonNullListNonNull', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$.List<$Scalar.Date>> - }, false> - > - dateInterface1: $.OutputField<'dateInterface1', $.Nullable, null> - dateList: $.OutputField<'dateList', $.Nullable<$.List<$Scalar.Date>>, null> - dateListList: $.OutputField<'dateListList', $.Nullable<$.List<$.List<$Scalar.Date>>>, null> - dateListNonNull: $.OutputField<'dateListNonNull', $.List<$Scalar.Date>, null> - dateNonNull: $.OutputField<'dateNonNull', $Scalar.Date, null> - dateObject1: $.OutputField<'dateObject1', $.Nullable, null> - dateUnion: $.OutputField<'dateUnion', $.Nullable, null> - error: $.OutputField< - 'error', - $.Nullable<$Scalar.String>, - $.Args<{ - case: $.InputField<$.Nullable<$Scalar.String>> - }, true> - > - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - idNonNull: $.OutputField<'idNonNull', $Scalar.ID, null> - interface: $.OutputField<'interface', $.Nullable, null> - interfaceNonNull: $.OutputField<'interfaceNonNull', Interface, null> - interfaceWithArgs: $.OutputField< - 'interfaceWithArgs', - $.Nullable, - $.Args<{ - id: $.InputField<$Scalar.ID> - }, false> - > - listInt: $.OutputField<'listInt', $.Nullable<$.List<$.Nullable<$Scalar.Int>>>, null> - listIntNonNull: $.OutputField<'listIntNonNull', $.List<$Scalar.Int>, null> - listListInt: $.OutputField<'listListInt', $.Nullable<$.List<$.Nullable<$.List<$.Nullable<$Scalar.Int>>>>>, null> - listListIntNonNull: $.OutputField<'listListIntNonNull', $.List<$.List<$Scalar.Int>>, null> - lowerCaseUnion: $.OutputField<'lowerCaseUnion', $.Nullable, null> - object: $.OutputField<'object', $.Nullable, null> - objectList: $.OutputField<'objectList', $.Nullable<$.List>, null> - objectListNonNull: $.OutputField<'objectListNonNull', $.List, null> - objectNested: $.OutputField<'objectNested', $.Nullable, null> - objectNonNull: $.OutputField<'objectNonNull', Object1, null> - objectWithArgs: $.OutputField< - 'objectWithArgs', - $.Nullable, - $.Args<{ - boolean: $.InputField<$.Nullable<$Scalar.Boolean>> - float: $.InputField<$.Nullable<$Scalar.Float>> - id: $.InputField<$.Nullable<$Scalar.ID>> - int: $.InputField<$.Nullable<$Scalar.Int>> - string: $.InputField<$.Nullable<$Scalar.String>> - }, true> - > - result: $.OutputField< - 'result', - $.Nullable, - $.Args<{ - case: $.InputField - }, false> - > - resultNonNull: $.OutputField< - 'resultNonNull', - Result, - $.Args<{ - case: $.InputField<$.Nullable> - }, true> - > - string: $.OutputField<'string', $.Nullable<$Scalar.String>, null> - stringWithArgEnum: $.OutputField< - 'stringWithArgEnum', - $.Nullable<$Scalar.String>, - $.Args<{ - ABCEnum: $.InputField<$.Nullable> - }, true> - > - stringWithArgInputObject: $.OutputField< - 'stringWithArgInputObject', - $.Nullable<$Scalar.String>, - $.Args<{ - input: $.InputField<$.Nullable> - }, true> - > - stringWithArgInputObjectRequired: $.OutputField< - 'stringWithArgInputObjectRequired', - $.Nullable<$Scalar.String>, - $.Args<{ - input: $.InputField - }, false> - > - /** - * The given arguments are reflected back as a JSON string. - */ - stringWithArgs: $.OutputField< - 'stringWithArgs', - $.Nullable<$Scalar.String>, - $.Args<{ - boolean: $.InputField<$.Nullable<$Scalar.Boolean>> - float: $.InputField<$.Nullable<$Scalar.Float>> - id: $.InputField<$.Nullable<$Scalar.ID>> - int: $.InputField<$.Nullable<$Scalar.Int>> - string: $.InputField<$.Nullable<$Scalar.String>> - }, true> - > - stringWithListArg: $.OutputField< - 'stringWithListArg', - $.Nullable<$Scalar.String>, - $.Args<{ - ints: $.InputField<$.Nullable<$.List<$.Nullable<$Scalar.Int>>>> - }, true> - > - stringWithListArgRequired: $.OutputField< - 'stringWithListArgRequired', - $.Nullable<$Scalar.String>, - $.Args<{ - ints: $.InputField<$.List<$Scalar.Int>> - }, false> - > - stringWithRequiredArg: $.OutputField< - 'stringWithRequiredArg', - $.Nullable<$Scalar.String>, - $.Args<{ - string: $.InputField<$Scalar.String> - }, false> - > - unionFooBar: $.OutputField<'unionFooBar', $.Nullable, null> - unionFooBarNonNull: $.OutputField<'unionFooBarNonNull', FooBarUnion, null> - unionFooBarWithArgs: $.OutputField< - 'unionFooBarWithArgs', - $.Nullable, - $.Args<{ - id: $.InputField<$.Nullable<$Scalar.ID>> - }, true> - > - unionObject: $.OutputField<'unionObject', $.Nullable, null> - unionObjectNonNull: $.OutputField<'unionObjectNonNull', ObjectUnion, null> - }> + export interface DateInterface1 extends $.Interface { + name: 'DateInterface1' + implementors: [DateObject1] + implementorsUnion: DateObject1 + implementorsIndex: { + DateObject1: DateObject1 + } + } + + // Error + // -------------------------------------------------------------------------------------------------- + // + + export interface Error extends $.Interface { + name: 'Error' + implementors: [ErrorOne, ErrorTwo] + implementorsUnion: + | ErrorOne + | ErrorTwo + implementorsIndex: { + ErrorOne: ErrorOne + ErrorTwo: ErrorTwo + } + } + + // Interface + // -------------------------------------------------------------------------------------------------- + // + + export interface Interface extends $.Interface { + name: 'Interface' + implementors: [Object1ImplementingInterface, Object2ImplementingInterface] + implementorsUnion: + | Object1ImplementingInterface + | Object2ImplementingInterface + implementorsIndex: { + Object1ImplementingInterface: Object1ImplementingInterface + Object2ImplementingInterface: Object2ImplementingInterface + } + } // // @@ -1190,7 +2405,7 @@ export namespace Schema { // // // ================================================================================================== - // OutputObject + // Union // ================================================================================================== // // @@ -1199,75 +2414,74 @@ export namespace Schema { // // - export type Bar = $.OutputObject<'Bar', { - int: $.OutputField<'int', $.Nullable<$Scalar.Int>, null> - }> - - export type DateObject1 = $.OutputObject<'DateObject1', { - date1: $.OutputField<'date1', $.Nullable<$Scalar.Date>, null> - }> - - export type DateObject2 = $.OutputObject<'DateObject2', { - date2: $.OutputField<'date2', $.Nullable<$Scalar.Date>, null> - }> + // DateUnion + // -------------------------------------------------------------------------------------------------- + // - export type ErrorOne = $.OutputObject<'ErrorOne', { - infoId: $.OutputField<'infoId', $.Nullable<$Scalar.ID>, null> - message: $.OutputField<'message', $Scalar.String, null> - }> + export interface DateUnion extends $.Union { + name: 'DateUnion' + members: [DateObject1, DateObject2] + membersUnion: + | DateObject1 + | DateObject2 + membersIndex: { + DateObject1: DateObject1 + DateObject2: DateObject2 + } + } - export type ErrorTwo = $.OutputObject<'ErrorTwo', { - infoInt: $.OutputField<'infoInt', $.Nullable<$Scalar.Int>, null> - message: $.OutputField<'message', $Scalar.String, null> - }> + // FooBarUnion + // -------------------------------------------------------------------------------------------------- + // /** - * Object documentation. + * Union documentation. */ - export type Foo = $.OutputObject<'Foo', { - /** - * Field documentation. - * - * @deprecated Field a is deprecated. - */ - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - }> - - export type Object1 = $.OutputObject<'Object1', { - ABCEnum: $.OutputField<'ABCEnum', $.Nullable, null> - boolean: $.OutputField<'boolean', $.Nullable<$Scalar.Boolean>, null> - float: $.OutputField<'float', $.Nullable<$Scalar.Float>, null> - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - int: $.OutputField<'int', $.Nullable<$Scalar.Int>, null> - string: $.OutputField<'string', $.Nullable<$Scalar.String>, null> - }> - - export type Object1ImplementingInterface = $.OutputObject<'Object1ImplementingInterface', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - int: $.OutputField<'int', $.Nullable<$Scalar.Int>, null> - }> - - export type Object2ImplementingInterface = $.OutputObject<'Object2ImplementingInterface', { - boolean: $.OutputField<'boolean', $.Nullable<$Scalar.Boolean>, null> - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - }> + export interface FooBarUnion extends $.Union { + name: 'FooBarUnion' + members: [Bar, Foo] + membersUnion: + | Bar + | Foo + membersIndex: { + Bar: Bar + Foo: Foo + } + } - export type ObjectNested = $.OutputObject<'ObjectNested', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - object: $.OutputField<'object', $.Nullable, null> - }> + // Result + // -------------------------------------------------------------------------------------------------- + // - export type ObjectUnion = $.OutputObject<'ObjectUnion', { - fooBarUnion: $.OutputField<'fooBarUnion', $.Nullable, null> - }> + export interface Result extends $.Union { + name: 'Result' + members: [ErrorOne, ErrorTwo, Object1] + membersUnion: + | ErrorOne + | ErrorTwo + | Object1 + membersIndex: { + ErrorOne: ErrorOne + ErrorTwo: ErrorTwo + Object1: Object1 + } + } - export type lowerCaseObject = $.OutputObject<'lowerCaseObject', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - }> + // lowerCaseUnion + // -------------------------------------------------------------------------------------------------- + // - export type lowerCaseObject2 = $.OutputObject<'lowerCaseObject2', { - int: $.OutputField<'int', $.Nullable<$Scalar.Int>, null> - }> + export interface lowerCaseUnion extends $.Union { + name: 'lowerCaseUnion' + members: [lowerCaseObject, lowerCaseObject2] + membersUnion: + | lowerCaseObject + | lowerCaseObject2 + membersIndex: { + lowerCaseObject: lowerCaseObject + lowerCaseObject2: lowerCaseObject2 + } + } // // @@ -1276,7 +2490,7 @@ export namespace Schema { // // // ================================================================================================== - // InputObject + // Enum // ================================================================================================== // // @@ -1285,25 +2499,39 @@ export namespace Schema { // // - export type InputObject = $.InputObject<'InputObject', { - date: $.InputField<$.Nullable<$Scalar.Date>> - dateRequired: $.InputField<$Scalar.Date> - id: $.InputField<$.Nullable<$Scalar.ID>> - idRequired: $.InputField<$Scalar.ID> - }, true> + // ABCEnum + // -------------------------------------------------------------------------------------------------- + // - export type InputObjectCircular = $.InputObject<'InputObjectCircular', { - circular: $.InputField<$.Nullable> - date: $.InputField<$.Nullable<$Scalar.Date>> - }, true> + /** + * Enum documentation. + * + * Members + * "A" - (DEPRECATED: Enum value A is deprecated.) + * "B" - Enum B member documentation. + * "C" - (DEPRECATED: Enum value C is deprecated.) + */ + export interface ABCEnum extends $.Enum { + name: 'ABCEnum' + members: ['A', 'B', 'C'] + membersUnion: + | 'A' + | 'B' + | 'C' + } - export type InputObjectNested = $.InputObject<'InputObjectNested', { - InputObject: $.InputField<$.Nullable> - }, true> + // Case + // -------------------------------------------------------------------------------------------------- + // - export type InputObjectNestedNonNull = $.InputObject<'InputObjectNestedNonNull', { - InputObject: $.InputField - }, false> + export interface Case extends $.Enum { + name: 'Case' + members: ['ErrorOne', 'ErrorTwo', 'Object1'] + membersUnion: + | 'ErrorOne' + | 'ErrorTwo' + | 'Object1' + } // // @@ -1312,7 +2540,7 @@ export namespace Schema { // // // ================================================================================================== - // Interface + // ScalarCustom // ================================================================================================== // // @@ -1321,17 +2549,11 @@ export namespace Schema { // // - export type DateInterface1 = $.Interface<'DateInterface1', { - date1: $.OutputField<'date1', $.Nullable<$Scalar.Date>, null> - }, [DateObject1]> - - export type Error = $.Interface<'Error', { - message: $.OutputField<'message', $Scalar.String, null> - }, [ErrorOne, ErrorTwo]> + // Date + // -------------------------------------------------------------------------------------------------- + // - export type Interface = $.Interface<'Interface', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - }, [Object1ImplementingInterface, Object2ImplementingInterface]> + export type Date = $Scalar.Date // // @@ -1340,7 +2562,7 @@ export namespace Schema { // // // ================================================================================================== - // Union + // ScalarStandard // ================================================================================================== // // @@ -1349,16 +2571,35 @@ export namespace Schema { // // - export type DateUnion = $.Union<'DateUnion', [DateObject1, DateObject2]> + // Boolean + // -------------------------------------------------------------------------------------------------- + // - /** - * Union documentation. - */ - export type FooBarUnion = $.Union<'FooBarUnion', [Bar, Foo]> + export type Boolean = $.StandardTypes.Boolean + + // Float + // -------------------------------------------------------------------------------------------------- + // - export type Result = $.Union<'Result', [ErrorOne, ErrorTwo, Object1]> + export type Float = $.StandardTypes.Float - export type lowerCaseUnion = $.Union<'lowerCaseUnion', [lowerCaseObject, lowerCaseObject2]> + // ID + // -------------------------------------------------------------------------------------------------- + // + + export type ID = $.StandardTypes.ID + + // Int + // -------------------------------------------------------------------------------------------------- + // + + export type Int = $.StandardTypes.Int + + // String + // -------------------------------------------------------------------------------------------------- + // + + export type String = $.StandardTypes.String // // @@ -1367,7 +2608,7 @@ export namespace Schema { // // // ================================================================================================== - // Enum + // Named Types Index // ================================================================================================== // // @@ -1377,16 +2618,49 @@ export namespace Schema { // /** - * Enum documentation. + * [1] These definitions serve to allow field selection interfaces to extend their respective object type without + * name clashing between the field name and the object name. * - * Members - * "A" - (DEPRECATED: Enum value A is deprecated.) - * "B" - Enum B member documentation. - * "C" - (DEPRECATED: Enum value C is deprecated.) - */ - export type ABCEnum = $.Enum<'ABCEnum', ['A', 'B', 'C']> - - export type Case = $.Enum<'Case', ['ErrorOne', 'ErrorTwo', 'Object1']> + * For example imagine \`Query.Foo\` field with type also called \`Foo\`. Our generated interfaces for each field + * would end up with an error of \`export interface Foo extends Foo ...\` + */ + + namespace $$NamedTypes { + export type $$Mutation = Mutation + export type $$Query = Query + export type $$Bar = Bar + export type $$DateObject1 = DateObject1 + export type $$DateObject2 = DateObject2 + export type $$ErrorOne = ErrorOne + export type $$ErrorTwo = ErrorTwo + export type $$Foo = Foo + export type $$Object1 = Object1 + export type $$Object1ImplementingInterface = Object1ImplementingInterface + export type $$Object2ImplementingInterface = Object2ImplementingInterface + export type $$ObjectNested = ObjectNested + export type $$ObjectUnion = ObjectUnion + export type $$lowerCaseObject = lowerCaseObject + export type $$lowerCaseObject2 = lowerCaseObject2 + export type $$InputObject = InputObject + export type $$InputObjectCircular = InputObjectCircular + export type $$InputObjectNested = InputObjectNested + export type $$InputObjectNestedNonNull = InputObjectNestedNonNull + export type $$DateInterface1 = DateInterface1 + export type $$Error = Error + export type $$Interface = Interface + export type $$DateUnion = DateUnion + export type $$FooBarUnion = FooBarUnion + export type $$Result = Result + export type $$lowerCaseUnion = lowerCaseUnion + export type $$ABCEnum = ABCEnum + export type $$Case = Case + export type $$Date = Date + export type $$Boolean = Boolean + export type $$Float = Float + export type $$ID = ID + export type $$Int = Int + export type $$String = String + } } // @@ -1404,7 +2678,8 @@ export namespace Schema { // // // -export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $$Utilities.Schema { + +export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $ { name: Data.Name RootTypesPresent: ['Mutation', 'Query'] RootUnion: Schema.Mutation | Schema.Query @@ -2811,7 +4086,9 @@ export namespace Query { $?: InputObjectNested$Arguments<$Scalars> } - export interface InputObjectNested$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface InputObjectNested$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input?: $NamedTypes.$InputObjectNested<$Scalars> | undefined | null } @@ -2842,7 +4119,9 @@ export namespace Query { $: InputObjectNestedNonNull$Arguments<$Scalars> } - export interface InputObjectNestedNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface InputObjectNestedNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input: $NamedTypes.$InputObjectNestedNonNull<$Scalars> } @@ -2895,7 +4174,9 @@ export namespace Query { $?: argInputObjectCircular$Arguments<$Scalars> } - export interface argInputObjectCircular$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface argInputObjectCircular$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input?: $NamedTypes.$InputObjectCircular<$Scalars> | undefined | null } @@ -2949,7 +4230,9 @@ export namespace Query { $?: dateArg$Arguments<$Scalars> } - export interface dateArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date?: | $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> @@ -2985,7 +4268,9 @@ export namespace Query { $?: dateArgInputObject$Arguments<$Scalars> } - export interface dateArgInputObject$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgInputObject$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input?: $NamedTypes.$InputObject<$Scalars> | undefined | null } @@ -3017,7 +4302,9 @@ export namespace Query { $?: dateArgList$Arguments<$Scalars> } - export interface dateArgList$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgList$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date?: | Array< | $$Utilities.Schema.Scalar.GetDecoded< @@ -3057,7 +4344,9 @@ export namespace Query { $: dateArgNonNull$Arguments<$Scalars> } - export interface dateArgNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date: $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> > @@ -3088,7 +4377,9 @@ export namespace Query { $: dateArgNonNullList$Arguments<$Scalars> } - export interface dateArgNonNullList$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgNonNullList$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date: Array< | $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> @@ -3124,7 +4415,9 @@ export namespace Query { $: dateArgNonNullListNonNull$Arguments<$Scalars> } - export interface dateArgNonNullListNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgNonNullListNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date: Array< | $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> @@ -3311,7 +4604,9 @@ export namespace Query { $?: error$Arguments<$Scalars> } - export interface error$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface error$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { case?: string | undefined | null } @@ -3425,7 +4720,9 @@ export namespace Query { $: interfaceWithArgs$Arguments<$Scalars> } - export interface interfaceWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface interfaceWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { id: string } @@ -3667,11 +4964,17 @@ export namespace Query { $?: objectWithArgs$Arguments<$Scalars> } - export interface objectWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface objectWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { boolean?: boolean | undefined | null + float?: number | undefined | null + id?: string | undefined | null + int?: number | undefined | null + string?: string | undefined | null } @@ -3699,7 +5002,9 @@ export namespace Query { $: result$Arguments<$Scalars> } - export interface result$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface result$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { $case: $NamedTypes.$Case } @@ -3729,7 +5034,9 @@ export namespace Query { $?: resultNonNull$Arguments<$Scalars> } - export interface resultNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface resultNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { $case?: $NamedTypes.$Case | undefined | null } @@ -3781,7 +5088,9 @@ export namespace Query { $?: stringWithArgEnum$Arguments<$Scalars> } - export interface stringWithArgEnum$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithArgEnum$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { $ABCEnum?: $NamedTypes.$ABCEnum | undefined | null } @@ -3813,7 +5122,9 @@ export namespace Query { $?: stringWithArgInputObject$Arguments<$Scalars> } - export interface stringWithArgInputObject$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithArgInputObject$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input?: $NamedTypes.$InputObject<$Scalars> | undefined | null } @@ -3844,9 +5155,9 @@ export namespace Query { $: stringWithArgInputObjectRequired$Arguments<$Scalars> } - export interface stringWithArgInputObjectRequired$Arguments< - $Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}, - > { + export interface stringWithArgInputObjectRequired$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input: $NamedTypes.$InputObject<$Scalars> } @@ -3877,11 +5188,21 @@ export namespace Query { $?: stringWithArgs$Arguments<$Scalars> } - export interface stringWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { boolean?: boolean | undefined | null + float?: number | undefined | null + id?: string | undefined | null + /** + * @deprecated Example of argument deprecation reason here. + */ int?: number | undefined | null + /** + * Example of some argument documentation here. + */ string?: string | undefined | null } @@ -3912,7 +5233,9 @@ export namespace Query { $?: stringWithListArg$Arguments<$Scalars> } - export interface stringWithListArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithListArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { ints?: Array | undefined | null } @@ -3943,7 +5266,9 @@ export namespace Query { $: stringWithListArgRequired$Arguments<$Scalars> } - export interface stringWithListArgRequired$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithListArgRequired$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { ints: Array } @@ -3973,7 +5298,9 @@ export namespace Query { $: stringWithRequiredArg$Arguments<$Scalars> } - export interface stringWithRequiredArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithRequiredArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { string: string } @@ -4045,7 +5372,9 @@ export namespace Query { $?: unionFooBarWithArgs$Arguments<$Scalars> } - export interface unionFooBarWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface unionFooBarWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { id?: string | undefined | null } @@ -4155,15 +5484,19 @@ export interface InputObject<$Scalars extends $$Utilities.Schema.Scalar.ScalarMa > | undefined | null + dateRequired: $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> > + id?: string | undefined | null + idRequired: string } export interface InputObjectCircular<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { circular?: $NamedTypes.$InputObjectCircular<$Scalars> | undefined | null + date?: | $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> diff --git a/src/generator/generator/generate.ts b/src/generator/generator/generate.ts index 288628873..5f775f449 100644 --- a/src/generator/generator/generate.ts +++ b/src/generator/generator/generate.ts @@ -37,12 +37,14 @@ const moduleGenerators = [ export const generate = async (input: Input) => { const config = await createConfig(input) - const generatedModules = moduleGenerators - .map(generator => generator.generate(config)) - .map(code => ({ - ...code, - content: config.formatter.formatText(code.content), - })) + const generatedModules = await Promise.all( + moduleGenerators + .map(generator => generator.generate(config)) + .map(async code => ({ + ...code, + content: await config.formatter.formatText(code.content), + })), + ) if (config.paths.project.outputs.sdl && config.schema.via !== `sdl`) { await fs.writeFile(config.paths.project.outputs.sdl, config.schema.sdl) diff --git a/src/generator/generators/MethodsSelect.ts b/src/generator/generators/MethodsSelect.ts index 3890e8f64..93fc3751c 100644 --- a/src/generator/generators/MethodsSelect.ts +++ b/src/generator/generators/MethodsSelect.ts @@ -2,8 +2,9 @@ import { pick } from 'es-toolkit' import { Grafaid } from '../../lib/grafaid/__.js' import { entries } from '../../lib/prelude.js' +import { Tex } from '../../lib/tex/__.js' import { createModuleGenerator } from '../helpers/moduleGenerator.js' -import { renderName, title1 } from '../helpers/render.js' +import { renderName } from '../helpers/render.js' import { ModuleGeneratorSelectionSets } from './SelectionSets.js' export const ModuleGeneratorMethodsSelect = createModuleGenerator( @@ -15,10 +16,8 @@ export const ModuleGeneratorMethodsSelect = createModuleGenerator( code(`import type * as $SelectionSets from './${ModuleGeneratorSelectionSets.name}.js'`) code(`import type * as $Utilities from '${config.paths.imports.grafflePackage.utilitiesForGenerated}'`) code() - - code(title1(`Select Methods Interface`)) + code(Tex.title1(`Select Methods Interface`)) code() - code(`export interface $MethodsSelect {`) for (const [_, kind] of kinds) { for (const type of kind) { @@ -31,7 +30,7 @@ export const ModuleGeneratorMethodsSelect = createModuleGenerator( for (const [name, kind] of kinds) { const titleText = Grafaid.Schema.isRootType(kind[0]!) ? `Root` : name - code(title1(titleText)) + code(Tex.title1(titleText)) code() for (const graphqlType of kind) { diff --git a/src/generator/generators/Schema.ts b/src/generator/generators/Schema.ts index 1666d4d74..644ed5625 100644 --- a/src/generator/generators/Schema.ts +++ b/src/generator/generators/Schema.ts @@ -1,12 +1,12 @@ -import { omit } from 'es-toolkit' import { Code } from '../../lib/Code.js' import { Grafaid } from '../../lib/grafaid/__.js' import { entries, isObjectEmpty, values } from '../../lib/prelude.js' -import type { Config } from '../config/config.js' +import { Tex } from '../../lib/tex/__.js' import { identifiers } from '../helpers/identifiers.js' import { createModuleGenerator } from '../helpers/moduleGenerator.js' -import { createCodeGenerator } from '../helpers/moduleGeneratorRunner.js' -import { getDocumentation, title1 } from '../helpers/render.js' +import { type CodeGenerator, createCodeGenerator } from '../helpers/moduleGeneratorRunner.js' +import { getTsDocContents, renderInlineType, renderName } from '../helpers/render.js' +import type { KindRenderers } from '../helpers/types.js' import { ModuleGeneratorData } from './Data.js' import { ModuleGeneratorMethodsRoot } from './MethodsRoot.js' import { ModuleGeneratorScalar } from './Scalar.js' @@ -14,7 +14,7 @@ import { ModuleGeneratorScalar } from './Scalar.js' export const ModuleGeneratorSchema = createModuleGenerator( `Schema`, ({ config, code }) => { - const kindMap = omit(config.schema.kindMap, [`ScalarCustom`, `ScalarStandard`]) + const kindMap = config.schema.kindMap // omit(config.schema.kindMap, [`ScalarCustom`, `ScalarStandard`]) const kinds = entries(kindMap) // todo methods root is unused @@ -25,20 +25,47 @@ export const ModuleGeneratorSchema = createModuleGenerator( import type * as ${identifiers.$$Utilities} from '${config.paths.imports.grafflePackage.utilitiesForGenerated}' import type * as $Scalar from './${ModuleGeneratorScalar.name}.js' `) + code() code(`export namespace ${identifiers.Schema} {`) - for (const [name, types] of kinds) { - code() - code(title1(name)) + + for (const [kindName, kind] of kinds) { + const renderer = kindRenderers[kindName] as CodeGenerator<{ type: Grafaid.Schema.Types }> + code(Tex.title1(kindName)) code() - code( - types.length === 0 - ? `// -- no types --\n` - : types - .map((_) => dispatchToConcreteRenderer(config, _)) - .join(`\n\n`), - ) + for (const type of kind) { + code(Tex.title2(type.name)) + code() + code(renderer({ config, type })) + code() + } } + + code(Tex.title1(`Named Types Index`)) + code() + code(` + /** + * [1] These definitions serve to allow field selection interfaces to extend their respective object type without + * name clashing between the field name and the object name. + * + * For example imagine \`Query.Foo\` field with type also called \`Foo\`. Our generated interfaces for each field + * would end up with an error of \`export interface Foo extends Foo ...\` + */ + `) + code() + code( + Code.tsNamespace( + `$$NamedTypes`, + kinds + .map(([, type]) => type) + .flat() + .map((type) => { + return Code.esmExport(Code.tsType(`$$${type.name}`, renderName(type))) + }).join(`\n`), + ), + ) + code() + code(`}`) code() @@ -46,9 +73,197 @@ export const ModuleGeneratorSchema = createModuleGenerator( }, ) +const OutputObject = createCodeGenerator<{ type: Grafaid.Schema.ObjectType }>(({ config, code, type }) => { + const interfaceFields = Object.fromEntries( + [[`__typename`, `${renderName(type)}.__typename`]].concat( + values(type.getFields()).map((field) => { + const name = field.name + const fieldTypeReference = `${renderName(type.name)}.${renderName(field.name)}` + return [name, fieldTypeReference] + }), + ), + ) + code(Code.tsInterface$({ + tsDoc: getTsDocContents(config, type), + name: type.name, + extends: `$.OutputObject`, + fields: { + name: Code.string(type.name), + fields: interfaceFields, + }, + })) + code() + + code(Code.esmExport(Code.tsNamespace( + type.name, + [Code.tsInterface$({ + export: true, + name: `__typename`, + extends: `$.OutputField`, + fields: { + name: Code.string(`__typename`), + arguments: {}, + inlineType: `[1]`, + namedType: { + kind: Code.string(`__typename`), + value: Code.string(type.name), + }, + }, + })].concat( + values(type.getFields()) + .map((field) => { + const namedType = Grafaid.Schema.getNamedType(field.type) + return Code.tsInterface$({ + tsDoc: getTsDocContents(config, field), + export: true, + name: field.name, + extends: `$.OutputField`, + fields: { + name: Code.string(field.name), + arguments: Object.fromEntries(field.args.map(arg => { + return [ + arg.name, + Code.directiveField({ + $TS_DOC: getTsDocContents(config, arg), + $VALUE: { + kind: Code.string(`InputField`), + name: Code.string(arg.name), + inlineType: renderInlineType(arg.type), + namedType: namedTypesTypeReference(Grafaid.Schema.getNamedType(arg.type)), + }, + }), + ] + })), + inlineType: renderInlineType(field.type), + namedType: namedTypesTypeReference(namedType), + }, + }) + }), + ) + .join(`\n\n`), + ))) + code() +}) + +const Enum = createCodeGenerator<{ type: Grafaid.Schema.EnumType }>(({ config, code, type }) => { + code( + Code.tsInterface$({ + tsDoc: getTsDocContents(config, type), + export: true, + name: type.name, + extends: `$.Enum`, + fields: { + name: Code.string(type.name), + members: Code.tsTuple(type.getValues().map((_) => Code.string(_.name))), + membersUnion: Code.tsUnionItems(type.getValues().map((_) => Code.string(_.name))), + }, + }), + ) + code() +}) +const InputObject = createCodeGenerator<{ type: Grafaid.Schema.InputObjectType }>(({ config, code, type }) => { + code( + Code.tsInterface$({ + tsDoc: getTsDocContents(config, type), + name: type.name, + extends: `$.InputObject`, + fields: { + name: Code.string(type.name), + isAllFieldsNullable: Code.boolean(Grafaid.Schema.isAllInputObjectFieldsNullable(type)), + fields: Object.fromEntries( + values(type.getFields()).map(field => { + return [field.name, `${renderName(type)}.${renderName(field)}`] + }), + ), + }, + }), + ) + code() + code(Code.esmExport(Code.tsNamespace( + type.name, + values(type.getFields()) + .map((field) => { + const namedType = Grafaid.Schema.getNamedType(field.type) + return Code.tsInterface$({ + tsDoc: getTsDocContents(config, field), + name: field.name, + extends: `$.InputField`, + fields: { + name: Code.string(field.name), + inlineType: renderInlineType(field.type), + namedType: namedTypesTypeReference(namedType), + }, + }) + }) + .join(`\n\n`), + ))) + code() +}) + +const ScalarStandard = createCodeGenerator<{ type: Grafaid.Schema.ScalarType }>(({ code, type }) => { + code(Code.esmExport(Code.tsType(type.name, `$.StandardTypes.${type.name}`))) + code() +}) + +const ScalarCustom = createCodeGenerator<{ type: Grafaid.Schema.ScalarType }>(({ code, type }) => { + code(Code.esmExport(Code.tsType(type.name, `$Scalar.${type.name}`))) + code() +}) + +const Union = createCodeGenerator<{ type: Grafaid.Schema.UnionType }>(({ config, code, type }) => { + const memberNames = type.getTypes().map((_) => renderName(_)) + code(Code.tsInterface$({ + tsDoc: getTsDocContents(config, type), + export: true, + name: type.name, + extends: `$.Union`, + fields: { + name: Code.string(type.name), + members: Code.tsTuple(memberNames), + membersUnion: Code.tsUnionItems(memberNames), + membersIndex: Object.fromEntries(memberNames.map(n => [n, renderName(n)])), + }, + })) + code() +}) + +const Interface = createCodeGenerator<{ type: Grafaid.Schema.InterfaceType }>(({ config, code, type }) => { + const implementorTypes = Grafaid.Schema.KindMap.getInterfaceImplementors(config.schema.kindMap, type) + const implementorNames = implementorTypes.map((_) => _.name) + code(Code.tsInterface$({ + tsDoc: getTsDocContents(config, type), + name: type.name, + extends: `$.Interface`, + fields: { + name: Code.string(type.name), + implementors: Code.tsTuple(implementorNames), + implementorsUnion: Code.tsUnionItems(implementorNames), + implementorsIndex: Object.fromEntries(implementorNames.map(n => [n, renderName(n)])), + }, + })) + code() +}) + +const kindRenderers = { + Root: OutputObject, + OutputObject, + Union, + Interface, + Enum, + InputObject, + ScalarStandard, + ScalarCustom, +} satisfies KindRenderers + +const namedTypesTypeReference = (name: string | Grafaid.Schema.NamedTypes) => { + const name_ = typeof name === `string` ? name : name.name + return `$$NamedTypes.$$${name_}` +} + export const SchemaGenerator = createCodeGenerator( ({ config, code }) => { - code(title1(`Schema`)) + code(Tex.title1(`Schema`)) + code() const rootTypesPresence = { Query: Grafaid.Schema.KindMap.hasQuery(config.schema.kindMap), @@ -56,17 +271,11 @@ export const SchemaGenerator = createCodeGenerator( Subscription: Grafaid.Schema.KindMap.hasSubscription(config.schema.kindMap), } - const root = config.schema.kindMap.Root.map(_ => [_.name, `${identifiers.Schema}.${_.name}`] as const) - - const objects = config.schema.kindMap.OutputObject.map(_ => [_.name, `${identifiers.Schema}.${_.name}`] as const) - const unions = config.schema.kindMap.Union.map(_ => [_.name, `${identifiers.Schema}.${_.name}`] as const) - const interfaces = config.schema.kindMap.Interface.map( - _ => [_.name, `${identifiers.Schema}.${_.name}`] as const, - ) - const enums = config.schema.kindMap.Enum.map( - _ => [_.name, `${identifiers.Schema}.${_.name}`] as const, - ) - + const root = config.schema.kindMap.Root.map(_ => [_.name, `${identifiers.Schema}.${_.name}`]) + const objects = config.schema.kindMap.OutputObject.map(_ => [_.name, `${identifiers.Schema}.${_.name}`]) + const unions = config.schema.kindMap.Union.map(_ => [_.name, `${identifiers.Schema}.${_.name}`]) + const interfaces = config.schema.kindMap.Interface.map(_ => [_.name, `${identifiers.Schema}.${_.name}`]) + const enums = config.schema.kindMap.Enum.map(_ => [_.name, `${identifiers.Schema}.${_.name}`]) const schema: Code.TermObject = { name: `Data.Name`, RootTypesPresent: `[${config.schema.kindMap.Root.map((_) => Code.string(_.name)).join(`, `)}]`, @@ -77,16 +286,16 @@ export const SchemaGenerator = createCodeGenerator( Mutation: rootTypesPresence.Mutation ? `${identifiers.Schema}.Mutation` : null, Subscription: rootTypesPresence.Subscription ? `${identifiers.Schema}.Subscription` : null, }, - allTypes: Code.objectFromEntries([ + allTypes: Object.fromEntries([ ...root, ...enums, ...objects, ...unions, ...interfaces, ]), - objects: Code.objectFromEntries(objects), - unions: Code.objectFromEntries(unions), - interfaces: Code.objectFromEntries(interfaces), + objects: Object.fromEntries(objects), + unions: Object.fromEntries(unions), + interfaces: Object.fromEntries(interfaces), scalars: `$Scalars`, extensions: `${identifiers.$$Utilities}.GlobalRegistry.TypeExtensions`, } @@ -106,229 +315,12 @@ export const SchemaGenerator = createCodeGenerator( // --- code( - `export interface ${identifiers.Schema}<$Scalars extends ${identifiers.$$Utilities}.Schema.Scalar.ScalarMap = {}> extends ${identifiers.$$Utilities}.Schema - ${Code.termObject(schema)} - `, + Code.tsInterface$({ + name: identifiers.Schema, + typeParameters: `$Scalars extends ${identifiers.$$Utilities}.Schema.Scalar.ScalarMap = {}`, + extends: `$`, + fields: schema, + }), ) }, ) - -type AnyGraphQLFieldsType = - | Grafaid.Schema.ObjectType - | Grafaid.Schema.InterfaceType - | Grafaid.Schema.InputObjectType - -const defineReferenceRenderers = < - $Renderers extends { [ClassName in keyof Grafaid.Schema.NamedNameToClass]: any }, ->( - renderers: { - [ClassName in keyof $Renderers]: ( - config: Config, - node: ClassName extends keyof Grafaid.Schema.NamedNameToClass - ? InstanceType - : never, - ) => string - }, -) => renderers - -const defineConcreteRenderers = < - $Renderers extends { [ClassName in keyof Grafaid.Schema.NameToClassNamedType]: any }, ->( - renderers: { - [ClassName in keyof $Renderers]: ( - config: Config, - node: ClassName extends keyof Grafaid.Schema.NameToClassNamedType - ? InstanceType - : never, - ) => string - }, -): { - [ClassName in keyof $Renderers]: ( - node: ClassName extends keyof Grafaid.Schema.NameToClass - ? InstanceType | null | undefined - : never, - ) => string -} => { - return Object.fromEntries( - Object.entries(renderers).map(([key, renderer]) => { - return [ - key, - (config: Config, node: any) => { - if (!node) return `` - return renderer(config, node) - }, - ] - }), - ) as any -} - -const dispatchToReferenceRenderer = (config: Config, type: Grafaid.Schema.Types): string => { - const renderer = (referenceRenderers as any)[type.constructor.name] - if (!renderer) throw new Error(`No renderer found for class: ${type.constructor.name}`) - return renderer(config, type as any) -} - -const referenceRenderers = defineReferenceRenderers({ - GraphQLEnumType: (_, node) => node.name, - GraphQLInputObjectType: (_, node) => node.name, - GraphQLInterfaceType: (_, node) => node.name, - GraphQLObjectType: (_, node) => node.name, - GraphQLUnionType: (_, node) => node.name, - GraphQLScalarType: (_, node) => `$Scalar.${node.name}`, -}) - -const dispatchToConcreteRenderer = ( - config: Config, - node: Grafaid.Schema.NamedTypes, -): string => { - // @ts-expect-error lookup - const renderer = concreteRenderers[node.constructor.name] - if (!renderer) { - throw new Error(`No renderer found for class: ${node.constructor.name}`) - } - return renderer(config, node) -} - -const concreteRenderers = defineConcreteRenderers({ - GraphQLEnumType: (config, node) => - Code.TSDocWithBlock( - getDocumentation(config, node), - Code.export$( - Code.type( - node.name, - `$.Enum<${Code.string(node.name)}, ${Code.tuple(node.getValues().map((_) => Code.string(_.name)))} >`, - ), - ), - ), - GraphQLInputObjectType: (config, node) => { - const doc = getDocumentation(config, node) - const isAllFieldsNullable = Grafaid.Schema.isAllInputObjectFieldsNullable(node) - const source = Code.export$( - Code.type( - node.name, - `$.InputObject<${Code.string(node.name)}, ${renderInputFields(config, node)}, ${ - Code.boolean(isAllFieldsNullable) - }>`, - ), - ) - return Code.TSDocWithBlock(doc, source) - }, - GraphQLInterfaceType: (config, node) => { - const implementors = Grafaid.Schema.KindMap.getInterfaceImplementors(config.schema.kindMap, node) - return Code.TSDocWithBlock( - getDocumentation(config, node), - Code.export$(Code.type( - node.name, - `$.Interface<${Code.string(node.name)}, ${renderOutputFields(config, node)}, ${ - Code.tuple(implementors.map(_ => _.name)) - }>`, - )), - ) - }, - GraphQLObjectType: (config, node) => { - const maybeRootTypeName = (Grafaid.Schema.RootTypeName as Record)[node.name] - const type = maybeRootTypeName - ? `$.StandardTypes.${maybeRootTypeName}<${renderOutputFields(config, node)}>` - : `$.OutputObject<${Code.string(node.name)}, ${renderOutputFields(config, node)}>` - const doc = getDocumentation(config, node) - const source = Code.export$(Code.type(node.name, type)) - return Code.TSDocWithBlock(doc, source) - }, - GraphQLScalarType: () => ``, - GraphQLUnionType: (config, node) => - Code.TSDocWithBlock( - getDocumentation(config, node), - Code.export$( - Code.type( - node.name, - `$.Union<${Code.string(node.name)},${ - Code.tuple( - node - .getTypes() - .map( - (_) => dispatchToReferenceRenderer(config, _), - ), - ) - }>`, - ), - ), - ), -}) - -const renderOutputFields = (config: Config, node: AnyGraphQLFieldsType): string => { - return Code.object(Code.fields([ - ...values(node.getFields()).map((field) => - Code.TSDocWithBlock( - getDocumentation(config, field), - Code.field(field.name, renderOutputField(config, field)), - ) - ), - ])) -} - -const renderInputFields = (config: Config, node: AnyGraphQLFieldsType): string => { - return Code.object(Code.fields([ - ...values(node.getFields()).map((field) => - Code.TSDocWithBlock( - getDocumentation(config, field), - Code.field(field.name, renderInputField(config, field)), - ) - ), - ])) -} - -const renderOutputField = (config: Config, field: Grafaid.Schema.InputOrOutputField): string => { - const type = buildType(config, field.type) - - const args = Grafaid.Schema.isOutputField(field) && field.args.length > 0 - ? renderArgs(config, field.args) - : null - - return `$.OutputField<'${field.name}', ${type}${args ? `, ${args}` : `, null`}>` -} - -const renderInputField = (config: Config, field: Grafaid.Schema.InputOrOutputField): string => { - return `$.InputField<${buildType(config, field.type)}>` -} - -const buildType = (config: Config, node: Grafaid.Schema.Types) => { - // const ns = direction === `input` ? `Input` : `Output` - const nullable = Grafaid.Schema.isNullableType(node) - const nodeInner = Grafaid.Schema.getNullableType(node) - - if (Grafaid.Schema.isNamedType(nodeInner)) { - const namedTypeReference = dispatchToReferenceRenderer(config, nodeInner) - // const namedTypeCode = `_.Named<${namedTypeReference}>` - const namedTypeCode = namedTypeReference - return nullable - ? `$.Nullable<${namedTypeCode}>` - : namedTypeCode - } - - if (Grafaid.Schema.isListType(nodeInner)) { - const fieldType = `$.List<${buildType(config, nodeInner.ofType)}>` as any as string - return nullable - ? `$.Nullable<${fieldType}>` - : fieldType - } - - throw new Error(`Unhandled type: ${String(node)}`) -} - -const renderArgs = (config: Config, args: readonly Grafaid.Schema.Argument[]) => { - const code = `$.Args<${ - Code.object( - Code.fields( - args.map((arg) => renderArg(config, arg)), - ), - ) - }, ${Code.boolean(Grafaid.Schema.Args.isAllArgsNullable(args))}>` - return code -} - -const renderArg = (config: Config, arg: Grafaid.Schema.Argument) => { - // const { nullable } = unwrapToNonNull(arg.type) - // hasRequiredArgs = hasRequiredArgs || !nullable - const type = buildType(config, arg.type) - return Code.field(arg.name, `$.InputField<${type}>`) -} diff --git a/src/generator/generators/SchemaDrivenDataMap.ts b/src/generator/generators/SchemaDrivenDataMap.ts index 4617e324a..2b45aa2ca 100644 --- a/src/generator/generators/SchemaDrivenDataMap.ts +++ b/src/generator/generators/SchemaDrivenDataMap.ts @@ -1,12 +1,13 @@ import { Code } from '../../lib/Code.js' import { Grafaid } from '../../lib/grafaid/__.js' import { entries } from '../../lib/prelude.js' -import { nullabilityFlags, propertyNames } from '../../types/SchemaDrivenDataMap/SchemaDrivenDataMap.js' +import { Tex } from '../../lib/tex/__.js' +import { propertyNames } from '../../types/SchemaDrivenDataMap/SchemaDrivenDataMap.js' import type { Config } from '../config/config.js' import { identifiers } from '../helpers/identifiers.js' import { createModuleGenerator } from '../helpers/moduleGenerator.js' import { createCodeGenerator } from '../helpers/moduleGeneratorRunner.js' -import { title1 } from '../helpers/render.js' +import { renderInlineType } from '../helpers/render.js' import type { KindRenderers } from '../helpers/types.js' import { ModuleGeneratorScalar } from './Scalar.js' @@ -26,7 +27,7 @@ export const ModuleGeneratorSchemaDrivenDataMap = createModuleGenerator( const referenceAssignments: ReferenceAssignments = [] for (const [kindName, nodes] of kinds) { - code(title1(kindName)) + code(Tex.title1(kindName)) code() if (nodes.length === 0) { code(`// None of your ${kindName}s have custom scalars.`) @@ -39,7 +40,7 @@ export const ModuleGeneratorSchemaDrivenDataMap = createModuleGenerator( code() } - code(title1(`Reference Assignments`, `(avoids circular assignment issues)`)) + code(Tex.title1(`Reference Assignments`, `(avoids circular assignment issues)`)) code() if (referenceAssignments.length === 0) { code(`// None of your types have references to other non-scalar/enum types.`) @@ -49,7 +50,7 @@ export const ModuleGeneratorSchemaDrivenDataMap = createModuleGenerator( } code() - code(title1(`Index`)) + code(Tex.title1(`Index`)) code() code(`const $schemaDrivenDataMap: ${identifiers.$$Utilities}.SchemaDrivenDataMap =`) code(Code.termObject({ @@ -259,7 +260,7 @@ const ObjectType = createCodeGenerator< ofItemA[propertyNames.nt] = argType.name // For variables, we need to know the variable type to write it out, so we always need the inline type. if (config.runtimeFeatures.operationVariables) { - ofItemA[propertyNames.it] = inlineType(arg.type) + ofItemA[propertyNames.it] = renderInlineType(arg.type) } } } @@ -384,19 +385,3 @@ const kindRenders = { OutputObject: ObjectType, Root: ObjectType, } satisfies KindRenderers - -const inlineType = (type: Grafaid.Schema.InputTypes): string => { - const [ofType, nonNull] = Grafaid.Schema.isNonNullType(type) - ? [type.ofType, true] - : [type, false] - - const nullFlag = nonNull - ? nullabilityFlags.nonNull - : nullabilityFlags.nullable - - const rest = Grafaid.Schema.isListType(ofType) - ? inlineType(ofType.ofType) - : `` - - return `[${nullFlag.toString()}, ${rest}]` -} diff --git a/src/generator/generators/Select.ts b/src/generator/generators/Select.ts index 540da1ff2..fe7ea8b83 100644 --- a/src/generator/generators/Select.ts +++ b/src/generator/generators/Select.ts @@ -1,7 +1,8 @@ // todo jsdoc +import { Tex } from '../../lib/tex/__.js' import { identifiers } from '../helpers/identifiers.js' import { createModuleGenerator } from '../helpers/moduleGenerator.js' -import { renderName, title1, typeTitle } from '../helpers/render.js' +import { renderName, typeTitle } from '../helpers/render.js' import { ModuleGeneratorData } from './Data.js' import { ModuleGeneratorSchema } from './Schema.js' import { ModuleGeneratorSelectionSets } from './SelectionSets.js' @@ -15,12 +16,12 @@ export const ModuleGeneratorSelect = createModuleGenerator( code(`import type * as SelectionSets from './${ModuleGeneratorSelectionSets.name}.js'`) code() - code(title1(`Runtime`)) + code(Tex.title1(`Runtime`)) code(`import { createSelect } from '${config.paths.imports.grafflePackage.client}'`) code(`export const Select = createSelect(Data.Name)`) code() - code(title1(`Buildtime`)) + code(Tex.title1(`Buildtime`)) code() code(`export namespace Select {`) diff --git a/src/generator/generators/SelectionSets.ts b/src/generator/generators/SelectionSets.ts index 68526b578..453c7c5ef 100644 --- a/src/generator/generators/SelectionSets.ts +++ b/src/generator/generators/SelectionSets.ts @@ -7,12 +7,13 @@ import { Code } from '../../lib/Code.js' import { Grafaid } from '../../lib/grafaid/__.js' import { analyzeArgsNullability } from '../../lib/grafaid/schema/args.js' import { RootTypeName } from '../../lib/grafaid/schema/schema.js' -import { entries, isString } from '../../lib/prelude.js' -import { borderThinFullWidth } from '../../lib/text.js' +import { entries } from '../../lib/prelude.js' +import { Tex } from '../../lib/tex/__.js' +import { borderThin } from '../../lib/tex/tex.js' import { identifiers } from '../helpers/identifiers.js' import { createModuleGenerator } from '../helpers/moduleGenerator.js' import { createCodeGenerator } from '../helpers/moduleGeneratorRunner.js' -import { getDocumentation, renderDocumentation, renderName, title1, typeTitle2SelectionSet } from '../helpers/render.js' +import { getTsDocContents, renderDocumentation, renderName, typeTitle2SelectionSet } from '../helpers/render.js' import type { KindRenderers } from '../helpers/types.js' import { ModuleGeneratorScalar } from './Scalar.js' @@ -33,7 +34,7 @@ export const ModuleGeneratorSelectionSets = createModuleGenerator( code(`import type * as $Scalar from './${ModuleGeneratorScalar.name}.js'`) } code() - code(title1(`Document`)) + code(Tex.title1(`Document`)) code() code( `// Prefix with $ because this is not a schema type. A user could have a schema type named "Document" that this would conflict with.`, @@ -47,7 +48,7 @@ export const ModuleGeneratorSelectionSets = createModuleGenerator( code() kindEntries.forEach(([name, kind]) => { - code(title1(name)) + code(Tex.title1(name)) code() kind.forEach(type => { code(kindRenderMap[name]({ config, type: type as never })) @@ -80,13 +81,16 @@ const renderKindUnion = createCodeGenerator<{ type: Grafaid.Schema.UnionType }>( .join( `\n`, ) - code(` - export interface ${renderName(type)}<${$ScalarsTypeParameter}> { + code(Code.tsInterface$({ + export: true, + name: type.name, + typeParameters: $ScalarsTypeParameter, + fields: ` ${fragmentsInlineType} ${H.fragmentInlineField(type)} ${H.__typenameField(`union`)} - } - `) + `, + })) code(H.fragmentInlineInterface(type)) code() @@ -132,7 +136,7 @@ const renderKindInterface = createCodeGenerator<{ type: Grafaid.Schema.Interface code() code(`// Interface Type: ${type.name}`) - code(`// ${borderThinFullWidth}`) + code(`// ${borderThin}`) code() const doc = renderDocumentation(config, type) @@ -209,7 +213,7 @@ const renderKindOutputObject = createCodeGenerator<{ type: Grafaid.Schema.Object code(` export namespace ${renderName(type)} { - ${fields.map((field) => renderOutputField({ config, field })).join(`\n// ${borderThinFullWidth}\n\n`)} + ${fields.map((field) => renderOutputField({ config, field })).join(`\n// ${borderThin}\n\n`)} } `) code() @@ -241,7 +245,7 @@ const renderOutputField = createCodeGenerator<{ field: Grafaid.Schema.Field renderArgumentLike({ config, arg })).join(`\n`) - code(H.tsInterface(argumentsName, null, fields)) + code(Code.tsInterface$({ + export: true, + name: H.referenceSig(argumentsName), + extends: `$Select.Bases.Base`, + fields, + })) code() } code(`// --- expanded ---`) code() - code(H.tsTypeExpanded(field, Code.unionItems([indicator, selectionSetRef]))) + code(H.tsTypeExpanded(field, Code.tsUnionItems([indicator, selectionSetRef]))) code() code() @@ -307,8 +321,8 @@ const renderArgumentLike = createCodeGenerator<{ arg: Grafaid.Schema.Argument | ? Select.Arguments.enumKeyPrefix : `` const typeRendered = renderArgumentType(arg.type) - const tsDoc = getDocumentation(config, arg) - code(tsDoc) + const tsDoc = getTsDocContents(config, arg) + code(Code.TSDoc(tsDoc)) code(`${enumKeyPrefix}${arg.name}${H.propOpt(arg.type)}: ${typeRendered}`) }, ) @@ -384,13 +398,6 @@ namespace H { return `${type} | Array<${type}>` } - export const tsInterface = (name: Name, extendsClause: null | (string | null)[], fields: string) => { - const extendsClause_ = extendsClause - ? ` extends ${isString(extendsClause) ? extendsClause : extendsClause.join(`, `)}` - : `` - return `export interface ${referenceSig(name)} ${extendsClause_} { ${fields} }` - } - export const tsType = (name: Name, type: string) => { return tsTypeTerminal(referenceSig(name), type) } diff --git a/src/generator/generators/global.ts b/src/generator/generators/global.ts index bbc06d665..7426926f9 100644 --- a/src/generator/generators/global.ts +++ b/src/generator/generators/global.ts @@ -25,7 +25,7 @@ export const ModuleGeneratorGlobal = createModuleGenerator( code() const defaultSchemaUrlTsDoc = config.options.defaultSchemaUrl - ? `\n${Code.TSDoc(config.options.defaultSchemaUrl.href)}` + ? config.options.defaultSchemaUrl.href : `` const Clients = Code.termObjectFields({ diff --git a/src/generator/helpers/render.ts b/src/generator/helpers/render.ts index 13217279a..713ba24c9 100644 --- a/src/generator/helpers/render.ts +++ b/src/generator/helpers/render.ts @@ -1,27 +1,23 @@ import { Code } from '../../lib/Code.js' import { Grafaid } from '../../lib/grafaid/__.js' -import { borderThickFullWidth, borderThinFullWidth, centerTo } from '../../lib/text.js' +import { Tex } from '../../lib/tex/__.js' +import { SchemaDrivenDataMap } from '../../types/SchemaDrivenDataMap/__.js' import type { Config } from '../config/config.js' -export const title1 = (title: string, subTitle?: string) => { - const titleDecorated = ` - // - // - // - // - // - // - // ${borderThickFullWidth} - // ${centerTo(borderThickFullWidth, title)}${subTitle ? `\n// ${centerTo(borderThickFullWidth, subTitle)}` : ``} - // ${borderThickFullWidth} - // - // - // - // - // - // - ` - return titleDecorated +export const renderInlineType = (type: Grafaid.Schema.Types): string => { + const [ofType, nonNull] = Grafaid.Schema.isNonNullType(type) + ? [type.ofType, true] + : [type, false] + + const nullFlag = nonNull + ? SchemaDrivenDataMap.nullabilityFlags.nonNull + : SchemaDrivenDataMap.nullabilityFlags.nullable + + const rest = Grafaid.Schema.isListType(ofType) + ? renderInlineType(ofType.ofType) + : `` + + return `[${nullFlag.toString()}, ${rest}]` } export const typeTitle2 = (category: string) => (type: Grafaid.Schema.NamedTypes) => { @@ -37,9 +33,9 @@ export const typeTitle2 = (category: string) => (type: Grafaid.Schema.NamedTypes // // ${category.toUpperCase()} // ${typeLabel.toUpperCase()} - // ${borderThinFullWidth} - // ${centerTo(borderThinFullWidth, type.name)} - // ${borderThinFullWidth} + // ${Tex.borderThin} + // ${Tex.centerTo(Tex.borderThin, type.name)} + // ${Tex.borderThin} // // `.trim() @@ -66,9 +62,9 @@ const defaultDescription = (node: Grafaid.Schema.DescribableTypes) => { } export const renderDocumentation = (config: Config, node: Grafaid.Schema.DescribableTypes) => { - return Code.TSDoc(getDocumentation(config, node)) + return Code.TSDoc(getTsDocContents(config, node)) } -export const getDocumentation = (config: Config, node: Grafaid.Schema.DescribableTypes) => { +export const getTsDocContents = (config: Config, node: Grafaid.Schema.DescribableTypes) => { const generalDescription = node.description ?? (config.options.TSDoc.noDocPolicy === `message` ? defaultDescription(node) : null) @@ -121,14 +117,14 @@ export const getDocumentation = (config: Config, node: Grafaid.Schema.Describabl * this guards against GraphQL type or property names that * would be illegal in TypeScript such as `namespace` or `interface`. */ -export const renderName = (type: string | Grafaid.Schema.NamedTypes | Grafaid.Schema.Field) => { - if (typeof type === `string`) { - return type - } +export const renderName = (type: string | Grafaid.Schema.NamedTypes | Grafaid.Schema.FieldTypes) => { + const name_ = typeof type === `string` ? type : type.name - if (Code.reservedTypeScriptInterfaceNames.includes(type.name as any)) { - return `$${type.name}` + if (Code.reservedTypeScriptInterfaceNames.includes(name_ as any)) { + // todo this could name clash with $ prefix imports. + // either make imports use $$ or put the $ here in suffix. + return `$${name_}` } - return type.name + return name_ } diff --git a/src/layers/3_InferResult/Alias.ts b/src/layers/3_InferResult/Alias.ts index 68a863fba..25ed76a57 100644 --- a/src/layers/3_InferResult/Alias.ts +++ b/src/layers/3_InferResult/Alias.ts @@ -1,13 +1,13 @@ import type { mergeObjectArray, ValuesOrEmptyObject } from '../../lib/prelude.js' import type { Schema } from '../../types/Schema/__.js' import type { Select } from '../2_Select/__.js' -import type { Field } from './Field.js' +import type { OutputField } from './OutputField.js' // dprint-ignore export type Alias< - $SelectionSet, $Schema extends Schema, - $Node extends Schema.OutputObject + $Node extends Schema.OutputObject, + $SelectionSet, > = ValuesOrEmptyObject< { @@ -54,5 +54,5 @@ type InferSelectAliasOne< $Schema extends Schema, $Node extends Schema.OutputObject, > = { - [_ in $SelectAliasOne[0]]: Field<$SelectAliasOne[1], $Node['fields'][$FieldName], $Schema> + [_ in $SelectAliasOne[0]]: OutputField<$SelectAliasOne[1], $Node['fields'][$FieldName], $Schema> } diff --git a/src/layers/3_InferResult/Field.ts b/src/layers/3_InferResult/Field.ts deleted file mode 100644 index e58de406c..000000000 --- a/src/layers/3_InferResult/Field.ts +++ /dev/null @@ -1,57 +0,0 @@ -import type { Simplify } from 'type-fest' -import type { TSErrorDescriptive } from '../../lib/ts-error.js' -import type { Schema } from '../../types/Schema/__.js' -import type { Select } from '../2_Select/__.js' -import type { Interface } from './Interface.js' -import type { Object } from './Object.js' -import type { Union } from './Union.js' - -// dprint-ignore -export type Field<$SelectionSet, $Field extends Schema.SomeField, $Schema extends Schema> = - Simplify< - $SelectionSet extends Select.Directive.Include.FieldStates.Negative | Select.Directive.Skip.FieldStates.Positive ? - null : - ( - | FieldDirectiveInclude<$SelectionSet> - | FieldDirectiveSkip<$SelectionSet> - | FieldType, $Field['type'], $Schema> - ) - > - -// dprint-ignore -type FieldType< - $SelectionSet, - $Type extends Schema.OutputTypes, - $Schema extends Schema -> = - $Type extends Schema.__typename ? $Value : - $Type extends Schema.Nullable ? null | FieldType<$SelectionSet, $InnerType, $Schema> : - $Type extends Schema.List ? Array> : - $Type extends Schema.Enum ? $Members[number] : - $Type extends Schema.Scalar ? ReturnType<$Type['codec']['decode']> : - $Type extends Schema.Scalar.ScalarCodecless ? ReturnType['codec']['decode']> : - $Type extends Schema.OutputObject ? Object<$SelectionSet, $Schema, $Type> : - $Type extends Schema.Interface ? Interface<$SelectionSet, $Schema, $Type> : - $Type extends Schema.Union ? Union<$SelectionSet, $Schema, $Type> : - TSErrorDescriptive<'FieldType', `Unknown type`, { $Type: $Type; $SelectionSet: $SelectionSet; $Schema:$Schema }> - -// dprint-ignore -type GetCodecForCodecless< - $Type extends Schema.Scalar.ScalarCodecless, - $Schema extends Schema -> = - $Type['name'] extends keyof $Schema['scalars'] - ? $Schema['scalars'][$Type['name']] - : Schema.Scalar.String - -// dprint-ignore -type FieldDirectiveInclude<$SelectionSet> = - $SelectionSet extends Select.Directive.Include.Field ? $SelectionSet extends Select.Directive.Include.FieldStates.Positive ? never - : null - : never - -// dprint-ignore -type FieldDirectiveSkip<$SelectionSet> = - $SelectionSet extends Select.Directive.Skip.Field ? $SelectionSet extends Select.Directive.Skip.FieldStates.Negative ? never - : null - : never diff --git a/src/layers/3_InferResult/InlineFragment.ts b/src/layers/3_InferResult/InlineFragment.ts index 5b93db490..013bfaadc 100644 --- a/src/layers/3_InferResult/InlineFragment.ts +++ b/src/layers/3_InferResult/InlineFragment.ts @@ -1,7 +1,7 @@ import { type GetKeyOr } from '../../lib/prelude.js' import type { Schema } from '../../types/Schema/__.js' import type { Select } from '../2_Select/__.js' -import type { Object } from './Object.js' +import type { Object } from './OutputObject.js' // dprint-ignore export type InlineFragmentTypeConditional<$SelectionSet, $Node extends Schema.OutputObject, $Schema extends Schema> = @@ -9,7 +9,7 @@ export type InlineFragmentTypeConditional<$SelectionSet, $Node extends Schema.Ou ? Object< & GetKeyOr< $SelectionSet, - `${Select.InlineFragment.TypeConditionalKeyPrefix}${$Node['fields']['__typename']['type']['type']}`, + `${Select.InlineFragment.TypeConditionalKeyPrefix}${$Node['name']}`, {} > & Select.InlineFragment.OmitInlineFragmentsWithTypeConditions<$SelectionSet>, diff --git a/src/layers/3_InferResult/Interface.ts b/src/layers/3_InferResult/Interface.ts index 4db398410..403051f6d 100644 --- a/src/layers/3_InferResult/Interface.ts +++ b/src/layers/3_InferResult/Interface.ts @@ -3,4 +3,4 @@ import type { InlineFragmentTypeConditional } from './InlineFragment.js' // dprint-ignore export type Interface<$SelectionSet, $Schema extends Schema, $Node extends Schema.Interface> = - InlineFragmentTypeConditional<$SelectionSet, $Node['implementors'][number], $Schema> + InlineFragmentTypeConditional<$SelectionSet, $Node['implementorsUnion'], $Schema> diff --git a/src/layers/3_InferResult/OutputField.ts b/src/layers/3_InferResult/OutputField.ts new file mode 100644 index 000000000..610541c97 --- /dev/null +++ b/src/layers/3_InferResult/OutputField.ts @@ -0,0 +1,59 @@ +import type { Simplify } from 'type-fest' +import type { TSErrorDescriptive } from '../../lib/ts-error.js' +import type { Schema } from '../../types/Schema/__.js' +import type { InlineType } from '../../types/SchemaDrivenDataMap/InlineType.js' +import type { Select } from '../2_Select/__.js' +import type { Interface } from './Interface.js' +import type { Object } from './OutputObject.js' +import type { Union } from './Union.js' + +// dprint-ignore +export type OutputField<$SelectionSet, $Field extends Schema.OutputField, $Schema extends Schema> = + Simplify< + $SelectionSet extends Select.Directive.Include.FieldStates.Negative | Select.Directive.Skip.FieldStates.Positive ? + null : + ( + | FieldDirectiveInclude<$SelectionSet> + | FieldDirectiveSkip<$SelectionSet> + | InlineType.Infer< + $Field['inlineType'], + FieldType<$Schema, Omit<$SelectionSet, '$'>, $Field['namedType']> + > + ) + > + +// dprint-ignore +type FieldType< + $Schema extends Schema, + $SelectionSet, + $Type extends Schema.NamedOutputTypes, +> = + $Type extends Schema.OutputObject ? Object<$SelectionSet, $Schema, $Type> : + $Type extends Schema.Scalar ? ReturnType<$Type['codec']['decode']> : // TODO use TS compiler API to extract this type at build time. + $Type extends Schema.Scalar.ScalarCodecless ? ReturnType['codec']['decode']> : + $Type extends Schema.__typename ? $Type['value'] : + $Type extends Schema.Enum ? $Type['membersUnion'] : + $Type extends Schema.Interface ? Interface<$SelectionSet, $Schema, $Type> : + $Type extends Schema.Union ? Union<$SelectionSet, $Schema, $Type> : + TSErrorDescriptive<'FieldType', `Unknown type`, { $Type: $Type; $SelectionSet: $SelectionSet; $Schema:$Schema }> + +// dprint-ignore +type GetCodecForCodecless< + $Type extends Schema.Scalar.ScalarCodecless, + $Schema extends Schema +> = + $Type['name'] extends keyof $Schema['scalars'] + ? $Schema['scalars'][$Type['name']] + : Schema.Scalar.String + +// dprint-ignore +type FieldDirectiveInclude<$SelectionSet> = + $SelectionSet extends Select.Directive.Include.Field ? $SelectionSet extends Select.Directive.Include.FieldStates.Positive ? never + : null + : never + +// dprint-ignore +type FieldDirectiveSkip<$SelectionSet> = + $SelectionSet extends Select.Directive.Skip.Field ? $SelectionSet extends Select.Directive.Skip.FieldStates.Negative ? never + : null + : never diff --git a/src/layers/3_InferResult/Object.ts b/src/layers/3_InferResult/OutputObject.ts similarity index 87% rename from src/layers/3_InferResult/Object.ts rename to src/layers/3_InferResult/OutputObject.ts index d038426ca..b78edd45c 100644 --- a/src/layers/3_InferResult/Object.ts +++ b/src/layers/3_InferResult/OutputObject.ts @@ -4,7 +4,7 @@ import type { TSErrorDescriptive } from '../../lib/ts-error.js' import type { Schema } from '../../types/Schema/__.js' import type { Select } from '../2_Select/__.js' import type { Alias } from './Alias.js' -import type { Field } from './Field.js' +import type { OutputField } from './OutputField.js' import type { ScalarsWildcard } from './ScalarsWildcard.js' // dprint-ignore @@ -15,7 +15,7 @@ export type Object<$SelectionSet, $Schema extends Schema, $Node extends Schema.O : Simplify< & SelectionNonSelectAlias<$SelectionSet, $Schema, $Node> - & Alias<$SelectionSet, $Schema, $Node> + & Alias<$Schema, $Node, $SelectionSet> > // dprint-ignore @@ -23,14 +23,14 @@ type SelectionNonSelectAlias<$SelectionSet , $Schema extends Schema, $SchemaNode { [$Key in PickSelectsPositiveIndicatorAndNotSelectAlias<$SelectionSet>]: $Key extends keyof $SchemaNode['fields'] - ? Field<$SelectionSet[$Key], $SchemaNode['fields'][$Key], $Schema> + ? OutputField<$SelectionSet[$Key], $SchemaNode['fields'][$Key], $Schema> : Errors.UnknownFieldName<$Key, $SchemaNode> } // dprint-ignore export namespace Errors { export type UnknownFieldName<$FieldName extends string, $Object extends Schema.StandardTypes.RootType | Schema.OutputObject> = - TSErrorDescriptive<'Object', `field "${$FieldName}" does not exist on object "${$Object['fields']['__typename']['type']['type']}"`> + TSErrorDescriptive<'Object', `field "${$FieldName}" does not exist on object "${$Object['name']}"`> } // dprint-ignore diff --git a/src/layers/3_InferResult/ScalarsWildcard.ts b/src/layers/3_InferResult/ScalarsWildcard.ts index a6452f15c..922309abc 100644 --- a/src/layers/3_InferResult/ScalarsWildcard.ts +++ b/src/layers/3_InferResult/ScalarsWildcard.ts @@ -1,19 +1,19 @@ import type { Schema } from '../../types/Schema/__.js' -import type { Field } from './Field.js' +import type { OutputField } from './OutputField.js' export type ScalarsWildcard< $SelectionSet, $Schema extends Schema, $Node extends Schema.OutputObject, > = { - [$Key in keyof PickScalarFields<$Node>]: Field<$SelectionSet, $Node['fields'][$Key], $Schema> + [$Key in keyof PickScalarFields<$Node>]: OutputField<$SelectionSet, $Node['fields'][$Key], $Schema> } // dprint-ignore type PickScalarFields<$Object extends Schema.OutputObject> = { [ $Key in keyof $Object['fields'] - as Schema.GetNamedType<$Object['fields'][$Key]['type']> extends Schema.ScalarLikeTypes + as Schema.GetNamedType<$Object['fields'][$Key]['namedType']> extends Schema.ScalarLikeTypes ? $Key : never ]: $Object['fields'][$Key] diff --git a/src/layers/3_InferResult/Union.ts b/src/layers/3_InferResult/Union.ts index d463a5377..9e3482ca5 100644 --- a/src/layers/3_InferResult/Union.ts +++ b/src/layers/3_InferResult/Union.ts @@ -2,5 +2,5 @@ import type { Schema } from '../../types/Schema/__.js' import type { InlineFragmentTypeConditional } from './InlineFragment.js' // dprint-ignore -export type Union<$SelectionSet, $Schema extends Schema, $Type extends Schema.Union> = - InlineFragmentTypeConditional<$SelectionSet, $Type['members'][number], $Schema> +export type Union<$SelectionSet, $Schema extends Schema, $Node extends Schema.Union> = + InlineFragmentTypeConditional<$SelectionSet, $Node['membersUnion'], $Schema> diff --git a/src/layers/3_InferResult/_.ts b/src/layers/3_InferResult/_.ts index 68a7ab614..92f637cb2 100644 --- a/src/layers/3_InferResult/_.ts +++ b/src/layers/3_InferResult/_.ts @@ -1,7 +1,7 @@ export * from './Alias.js' -export * from './Field.js' export * from './Interface.js' -export * from './Object.js' +export * from './OutputField.js' +export * from './OutputObject.js' export * from './root.js' export * from './ScalarsWildcard.js' export * from './Union.js' diff --git a/src/layers/3_InferResult/__.test-d.ts b/src/layers/3_InferResult/__.test-d.ts index 13ef1491f..f273ef7dc 100644 --- a/src/layers/3_InferResult/__.test-d.ts +++ b/src/layers/3_InferResult/__.test-d.ts @@ -4,7 +4,7 @@ import type { Schema } from '../../../tests/_/schemas/kitchen-sink/graffle/modul import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.js' import { assertEqual } from '../../lib/assert-equal.js' import type { InferResult } from './__.js' -import type { PickSelectsPositiveIndicatorAndNotSelectAlias } from './Object.js' +import type { PickSelectsPositiveIndicatorAndNotSelectAlias } from './OutputObject.js' type $<$SelectionSet extends SelectionSets.Query> = InferResult.Query<$SelectionSet, Schema> diff --git a/src/layers/3_InferResult/root.ts b/src/layers/3_InferResult/root.ts index ee20cc94c..05cf1c262 100644 --- a/src/layers/3_InferResult/root.ts +++ b/src/layers/3_InferResult/root.ts @@ -1,7 +1,7 @@ import type { Grafaid } from '../../lib/grafaid/__.js' import { type ExcludeNull } from '../../lib/prelude.js' import type { Schema } from '../../types/Schema/__.js' -import type { Object } from './Object.js' +import type { Object } from './OutputObject.js' export type RootViaObject< $SelectionSet, @@ -10,7 +10,7 @@ export type RootViaObject< > = Root< $SelectionSet, $Schema, - $RootType['fields']['__typename']['type']['type'] + $RootType['name'] > // dprint-ignore diff --git a/src/lib/Code.ts b/src/lib/Code.ts index 7539381b2..83d3eb83b 100644 --- a/src/lib/Code.ts +++ b/src/lib/Code.ts @@ -1,13 +1,19 @@ -import { entries, isString } from './prelude.js' -import { linesPrepend, linesTrim } from './text.js' +import { renderName } from '../generator/helpers/render.js' +import { entries, isString, toArray } from './prelude.js' +import { linesPrepend, linesTrim } from './tex/tex.js' type FieldTuple = [k: string, v: string | null, tsDoc?: string | null] export namespace Code { - export const field = (name: string, type: string, options?: { tsDoc?: string | null; optional?: boolean }) => { + export const field = ( + name: string, + type: string | TermObject, + options?: { tsDoc?: string | null; optional?: boolean }, + ) => { const tsDoc = options?.tsDoc ? TSDoc(options.tsDoc) + `\n` : `` const optional = options?.optional ? `?` : `` - return `${tsDoc}${name}${optional}: ${type}` + const type_ = typeof type === `string` ? type : termObject(type) + return `${tsDoc}${name}${optional}: ${type_}` } export interface DirectiveTermObject { $spread?: string[] @@ -38,8 +44,10 @@ export namespace Code { type Field = TermPrimitive | DirectiveTermObject | TermObject + export const directiveField = (input: { $TS_DOC?: null | string; $VALUE: Field }): DirectiveField => input + interface DirectiveField { - $TS_DOC?: string + $TS_DOC?: string | null $VALUE: Field } @@ -74,27 +82,27 @@ export namespace Code { } export const termObjectFields = (object: TermObject | DirectiveTermObject): string => - termFieldsFromTuples( - entries(object).map(([key, value]): FieldTuple => { + entries(object) + .map(([key, value]): FieldTuple => { if (value === null) return [key, null] const [valueNormalized, tsDoc] = isDirectiveTermObject(value) ? [directiveTermObject(value), null] : isDirectiveField(value) - ? [termObjectField(value.$VALUE), value.$TS_DOC] + ? [termObjectField(value.$VALUE), value.$TS_DOC ? TSDoc(value.$TS_DOC) : null] : isString(value) || typeof value === `number` || typeof value === `boolean` ? [String(value), null] : [termObject(value as any), null] return [key, valueNormalized, tsDoc] - }), - ) + }) + .map(termFieldFromTuple) + .join(`\n`) const termObjectField = (field: Field): string => { if (isFieldPrimitive(field)) return String(field) return termObject(field) } - export const termFieldsFromTuples = (fields: FieldTuple[]) => fields.map(termFieldFromTuple).join(`\n`) export const termList = (value: string[]) => `[${value.join(`, `)}]` export const termFieldFromTuple = (tuple: FieldTuple) => Code.termField(tuple[0], tuple[1], { tsDoc: tuple[2] }) export const termField = ( @@ -111,9 +119,9 @@ export namespace Code { // type export const nullable = (type: string) => `${type} | null` - export const union = (name: string, types: string[]) => `type ${name} =\n| ${Code.unionItems(types)}` - export const unionItems = (types: (string | null)[]) => types.filter(_ => _ !== null).join(`\n| `) - export const tuple = (types: string[]) => termList(types) + export const union = (name: string, types: string[]) => `type ${name} =\n| ${Code.tsUnionItems(types)}` + export const tsUnionItems = (types: (string | null)[]) => types.filter(_ => _ !== null).join(`\n| `) + export const tsTuple = (types: string[]) => termList(types) export const list = (type: string) => `Array<${type}>` export const optionalField = (name: string, type: string) => Code.field(name, type, { optional: true }) export const fields = (fieldTypes: string[]) => fieldTypes.join(`\n`) @@ -139,21 +147,72 @@ export namespace Code { ), ) } - export const type = (name: string, type: string) => `type ${name} = ${type}` - export const interface$ = (name: string, object: string) => `interface ${name} ${object}` - export const export$ = (thing: string) => `export ${thing}` - export const namespace = (name: string, content: string) => `namespace ${name} ${Code.object(content)}` + + export const tsType = (name: string, type: string | TermObject) => { + const type_ = typeof type === `string` ? type : termObject(type) + return `type ${renderName(name)} = ${type_}` + } + + type TypeParametersInput = string | null | (string | null)[] + + const tsTypeParameters = (typeParameters: TypeParametersInput): string => { + if (typeParameters === null) return `` + if (Array.isArray(typeParameters) && typeParameters.length === 0) return `` + return `<${toArray(typeParameters).filter(_ => _ !== null).join(`, `)}>` + } + + type ExtendsClauseInput = string | null | (string | null)[] + + export const tsInterface = ( + name: string, + typeParameters: TypeParametersInput, + extendsClause: ExtendsClauseInput, + fields: string | TermObject, + ) => { + return tsInterface$({ + name, + typeParameters, + extends: extendsClause, + fields, + }) + } + + export const tsInterface$ = ( + { name, typeParameters, extends: extends_, fields, tsDoc, export: export_ }: { + name: string + typeParameters?: TypeParametersInput + extends?: ExtendsClauseInput + fields?: string | TermObject + tsDoc?: string | null + export?: boolean + }, + ) => { + const tsDoc_ = tsDoc ? TSDoc(tsDoc) + `\n` : `` + const export__ = export_ === false ? `` : `export ` + const typeParametersClause = tsTypeParameters(typeParameters ?? null) + const extends__ = toArray(extends_).filter(_ => Boolean(_)) + const extends___ = extends__.length > 0 + ? ` extends ${extends__.join(`, `)}` + : `` + const block = typeof fields === `string` ? `{${fields}}` : termObject(fields ?? {}) + const name_ = renderName(name) + return `${tsDoc_} ${export__} interface ${name_} ${typeParametersClause} ${extends___} ${block}` + } + + export const esmExport = (thing: string) => { + return `export ${thing}` + } + + export const tsNamespace = (name: string, content: string) => { + return `namespace ${renderName(name)} ${Code.object(content)}` + } // term or type export const propertyAccess = (object: string, name: string) => `${object}.${name}` export const string = (str: string) => `"${str}"` export const block = (content: string) => `{\n${content}\n}` export const boolean = (value: boolean) => value ? `true` : `false` - export const TSDoc = <$Content extends string | null>(content: $Content): $Content => { - return (content === null ? null : `/**\n${linesPrepend(`* `, linesTrim(content)) || `*`}\n*/`) as $Content - } - export const TSDocWithBlock = (content: string | null, block: string) => { - const tsDoc = TSDoc(content) - return tsDoc === null ? block : `${tsDoc}\n${block}` + export const TSDoc = (content: string | null): string => { + return content === null ? `` : `/**\n${linesPrepend(`* `, linesTrim(content)) || `*`}\n*/` } export const group = (...content: string[]) => content.join(`\n`) diff --git a/src/lib/grafaid/http/http.ts b/src/lib/grafaid/http/http.ts index 740542916..9efdb84c4 100644 --- a/src/lib/grafaid/http/http.ts +++ b/src/lib/grafaid/http/http.ts @@ -33,7 +33,7 @@ export const parseExecutionResult = (result: unknown): ExecutionResult => { ) } - // todo add test coverage for case of null. @see https://github.com/jasonkuhrt/graffle/issues/739 + // todo add test coverage for case of null. @see https://github.com/graffle-js/graffle/issues/739 if (`data` in result) { if (!isRecordLikeObject(result.data) && result.data !== null) { throw new Error(`Invalid execution result: data is not plain object`) // prettier-ignore diff --git a/src/lib/grafaid/schema/schema.ts b/src/lib/grafaid/schema/schema.ts index fcccfb9b3..8d187874b 100644 --- a/src/lib/grafaid/schema/schema.ts +++ b/src/lib/grafaid/schema/schema.ts @@ -89,6 +89,7 @@ export const NameToClass = { ...NamedNameToClass, } as const +export type FieldTypes = GraphQLField | GraphQLInputField export type DescribableTypes = | GraphQLNamedType | InputOrOutputField diff --git a/src/lib/prelude.ts b/src/lib/prelude.ts index 6de6c526e..45a781578 100644 --- a/src/lib/prelude.ts +++ b/src/lib/prelude.ts @@ -617,3 +617,5 @@ export const isDate = (value: unknown): value is Date => { export const isObjectEmpty = (object: Record) => { return Object.keys(object).length === 0 } + +export const toArray = (value: T | T[]) => Array.isArray(value) ? value : [value] diff --git a/src/lib/tex/__.ts b/src/lib/tex/__.ts new file mode 100644 index 000000000..180536fd1 --- /dev/null +++ b/src/lib/tex/__.ts @@ -0,0 +1 @@ +export * as Tex from './tex.js' diff --git a/src/lib/text.ts b/src/lib/tex/tex.ts similarity index 53% rename from src/lib/text.ts rename to src/lib/tex/tex.ts index 07142d20a..90ce78a4c 100644 --- a/src/lib/text.ts +++ b/src/lib/tex/tex.ts @@ -15,8 +15,40 @@ export const indent = (size: number, value: string) => { return `${indentSpace}${value}` } -export const borderThickFullWidth = +export const borderThick = `==================================================================================================` -export const borderThinFullWidth = +export const borderThin = `--------------------------------------------------------------------------------------------------` + +export const title1 = (title: string, subTitle?: string) => { + const subTitle_ = subTitle ? `\n// ${centerTo(borderThick, subTitle)}` : `` + const titleDecorated = ` + // + // + // + // + // + // + // ${borderThick} + // ${centerTo(borderThick, title)}${subTitle_} + // ${borderThick} + // + // + // + // + // + // + ` + return titleDecorated +} + +export const title2 = (title: string, subTitle?: string) => { + const subTitle_ = subTitle ? `\n// ${centerTo(borderThick, subTitle)}` : `` + const titleDecorated = ` + // ${centerTo(borderThick, title)}${subTitle_} + // ${borderThin} + // + ` + return titleDecorated +} diff --git a/src/lib/typescript-formatter.ts b/src/lib/typescript-formatter.ts index 15fd88ffc..f5f1b5bd4 100644 --- a/src/lib/typescript-formatter.ts +++ b/src/lib/typescript-formatter.ts @@ -1,11 +1,11 @@ import fs from 'node:fs/promises' export interface Formatter { - formatText(content: string, customFormatterConfig?: object): string + formatText(content: string, customFormatterConfig?: object): Promise } export const passthroughFormatter: Formatter = { - formatText: (content) => content, + formatText: (content) => Promise.resolve(content), } export const getTypescriptFormatterOrPassthrough = async (): Promise => { @@ -28,7 +28,7 @@ export const getTypeScriptFormatter = async (): Promise => { semiColons: `asi`, } return { - formatText: (content, customFormatterConfig) => { + formatText: async (content, customFormatterConfig) => { const config = { ...defaultDprintConfig, ...customFormatterConfig, @@ -36,7 +36,11 @@ export const getTypeScriptFormatter = async (): Promise => { try { return formatter.formatText(`memory.ts`, content, config) } catch (error) { - console.log(`----------\n\n\n\n${content}\n\n\n\n----------`) + if (process.env[`DEBUG`]) { + const path = `./syntax-error.ts` + await fs.writeFile(path, content) + console.log(`Wrote contents to ${path} for debugging.`) + } throw error } }, diff --git a/src/types/Schema/StandardTypes/object.ts b/src/types/Schema/StandardTypes/object.ts index b8311bf9f..779e1dfd4 100644 --- a/src/types/Schema/StandardTypes/object.ts +++ b/src/types/Schema/StandardTypes/object.ts @@ -1,16 +1,16 @@ import type { Grafaid } from '../../../lib/grafaid/__.js' -import type { OutputObject, SomeFields } from '../_.js' +import type { OutputFields, OutputObject } from '../_.js' export interface Query< - $Fields extends SomeFields = SomeFields, + $Fields extends OutputFields = OutputFields, > extends OutputObject {} export interface Mutation< - $Fields extends SomeFields = SomeFields, + $Fields extends OutputFields = OutputFields, > extends OutputObject {} export interface Subscription< - $Fields extends SomeFields = SomeFields, + $Fields extends OutputFields = OutputFields, > extends OutputObject {} export type RootType = Query | Mutation | Subscription diff --git a/src/types/Schema/nodes/Enum.ts b/src/types/Schema/nodes/Enum.ts index 4df46fcc6..dc7d9cf70 100644 --- a/src/types/Schema/nodes/Enum.ts +++ b/src/types/Schema/nodes/Enum.ts @@ -5,4 +5,5 @@ export interface Enum< kind: 'Enum' name: $Name members: $Members + membersUnion: $Members[number] } diff --git a/src/types/Schema/nodes/InputField.ts b/src/types/Schema/nodes/InputField.ts index 51248270b..2e1bdeaee 100644 --- a/src/types/Schema/nodes/InputField.ts +++ b/src/types/Schema/nodes/InputField.ts @@ -1,9 +1,15 @@ -import type { InputTypes } from '../typeGroups.js' +import type { InlineType } from '../../SchemaDrivenDataMap/InlineType.js' +import type { NamedInputTypes } from '../typeGroups.js' export interface InputField< - $Type extends InputTypes, -> // $NamedType extends NamedOutputTypes, -{ - type: $Type - // namedType: $NamedType + $Name extends string = string, + $InlineType extends InlineType = InlineType, + $NamedType extends NamedInputTypes = NamedInputTypes, +> { + kind: 'InputField' + name: $Name + inlineType: $InlineType + namedType: $NamedType } + +export type InputFields = Record diff --git a/src/types/Schema/nodes/InputObject.ts b/src/types/Schema/nodes/InputObject.ts index 0d33de3a6..f0f0aa1aa 100644 --- a/src/types/Schema/nodes/InputObject.ts +++ b/src/types/Schema/nodes/InputObject.ts @@ -1,4 +1,4 @@ -export type InputFields = Record +import type { InputFields } from './InputField.js' export interface InputObject< $Name extends string = string, diff --git a/src/types/Schema/nodes/Interface.ts b/src/types/Schema/nodes/Interface.ts index d86266d5d..c03cdeeb2 100644 --- a/src/types/Schema/nodes/Interface.ts +++ b/src/types/Schema/nodes/Interface.ts @@ -1,13 +1,15 @@ +import type { OutputFields } from './OutputField.js' import type { OutputObject } from './OutputObject.js' export type Interface< $Name extends string = string, - // $Fields extends SomeFields = SomeFields, - $Fields extends any = any, + $Fields extends OutputFields = OutputFields, $Implementors extends [OutputObject, ...OutputObject[]] = [OutputObject, ...OutputObject[]], > = { kind: 'Interface' name: $Name fields: $Fields implementors: $Implementors + implementorsUnion: $Implementors[number] + implementorsIndex: Record<$Implementors[number]['name'], $Implementors[number]> } diff --git a/src/types/Schema/nodes/OutputField.ts b/src/types/Schema/nodes/OutputField.ts index 9bc3c23cd..8f6450169 100644 --- a/src/types/Schema/nodes/OutputField.ts +++ b/src/types/Schema/nodes/OutputField.ts @@ -1,39 +1,20 @@ -import type { Scalar } from '../_.js' -import type { OutputTypes } from '../typeGroups.js' -import type { Args } from './Args.js' -import type { Enum } from './Enum.js' -import type { Interface } from './Interface.js' -import type { List } from './List.js' -import type { Nullable } from './Nullable.js' -import type { OutputObject } from './OutputObject.js' -import type { ScalarCodecless } from './Scalar/_.js' -import type { Union } from './Union.js' +import type { InlineType } from '../../SchemaDrivenDataMap/InlineType.js' +import type { __typename } from '../_.js' +import type { NamedOutputTypes } from '../typeGroups.js' +import type { InputFields } from './InputField.js' export type OutputField< - $Name extends string, - $Type extends OutputTypes, - $Args extends Args | null, -> // $NamedType extends NamedOutputTypes, - = { + $Name extends string = string, + $Arguments extends InputFields | null = InputFields | null, + $InlineType extends InlineType = InlineType, + $NamedType extends NamedOutputTypes = NamedOutputTypes, +> = { name: $Name - args: $Args - type: $Type - // namedType: $NamedType + arguments: $Arguments + inlineType: $InlineType + namedType: $NamedType } -type FieldType = - | Enum - | Scalar - | ScalarCodecless - | List - | Nullable - | OutputObject - | Union - | Interface | null>>, [any, ...any[]]> - -// todo test non null interface fields -export type SomeField = OutputField | null> - -export type SomeFields<$Keys extends SomeKey = SomeKey> = Record<$Keys, SomeField> - -type SomeKey = string | number | symbol +export type OutputFields = { + [key: string]: OutputField +} diff --git a/src/types/Schema/nodes/OutputObject.ts b/src/types/Schema/nodes/OutputObject.ts index f2eb417e0..198955bbb 100644 --- a/src/types/Schema/nodes/OutputObject.ts +++ b/src/types/Schema/nodes/OutputObject.ts @@ -1,12 +1,13 @@ import type { __typename } from './__typename.js' -import type { OutputField, SomeFields } from './OutputField.js' +import type { OutputField, OutputFields } from './OutputField.js' export interface OutputObject< $Name extends string = string, - $Fields extends SomeFields = SomeFields, + $Fields extends OutputFields = OutputFields, > { kind: 'Object' + name: $Name fields: { - __typename: OutputField<'__typename', __typename<$Name>, null> + __typename: OutputField<'__typename', {}, [1], __typename<$Name>> } & $Fields } diff --git a/src/types/Schema/nodes/Union.ts b/src/types/Schema/nodes/Union.ts index a572b4ad8..da9538e61 100644 --- a/src/types/Schema/nodes/Union.ts +++ b/src/types/Schema/nodes/Union.ts @@ -7,16 +7,6 @@ export type Union< kind: `Union` name: $Name members: $Members + membersUnion: $Members[number] + membersIndex: Record<$Members[number]['name'], $Members[number]> } - -export const Union = < - $Name extends string, - $Members extends [OutputObject, ...OutputObject[]], ->( - name: $Name, - members: $Members, -): Union<$Name, $Members> => ({ - kind: `Union`, - name, - members, -}) diff --git a/src/types/Schema/nodes/__typename.ts b/src/types/Schema/nodes/__typename.ts index 6a00bd8d8..c350c5f76 100644 --- a/src/types/Schema/nodes/__typename.ts +++ b/src/types/Schema/nodes/__typename.ts @@ -1,4 +1,4 @@ export interface __typename<$TypeName extends string = string> { - kind: 'typename' - type: $TypeName + kind: '__typename' + value: $TypeName } diff --git a/src/types/Schema/typeGroups.ts b/src/types/Schema/typeGroups.ts index 8062104df..3e5a4c582 100644 --- a/src/types/Schema/typeGroups.ts +++ b/src/types/Schema/typeGroups.ts @@ -22,6 +22,7 @@ export type NamedOutputTypes = | Union | Scalar | Scalar.ScalarCodecless + | __typename export type InputTypes = | InlineTypes diff --git a/src/types/SchemaDrivenDataMap/InlineType.ts b/src/types/SchemaDrivenDataMap/InlineType.ts index 18527a85e..a986a972f 100644 --- a/src/types/SchemaDrivenDataMap/InlineType.ts +++ b/src/types/SchemaDrivenDataMap/InlineType.ts @@ -6,8 +6,24 @@ * The outer most tuple DOES NOT represent a list, but the nullability of the named type itself. E.g. `[0]` would indicate * that a scalar field is nullable while `[1]` would indicate that it is non-nullable. */ -export type InlineType = [Nullable | NonNull, InlineType?] +export type InlineType = [InlineType.Nullable | InlineType.NonNull, InlineType?] -export type Nullable = 0 +export namespace InlineType { + export type Nullable = 0 -export type NonNull = 1 + export type NonNull = 1 + + export type NullabilityFlagTypes = { + 0: null + 1: never + } + + // dprint-ignore + export type Infer<$InlineType extends InlineType, $NamedType> = + | NullabilityFlagTypes[$InlineType[0]] + | ( + $InlineType[1] extends InlineType + ? Array> + : $NamedType + ) +} diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/MethodsRoot.ts b/tests/_/schemas/kitchen-sink/graffle/modules/MethodsRoot.ts index 3df8e6077..f5dc34592 100644 --- a/tests/_/schemas/kitchen-sink/graffle/modules/MethodsRoot.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/MethodsRoot.ts @@ -24,6 +24,7 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > > > + id: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.id<$Context['scalars']>>, ) => Promise< @@ -35,6 +36,7 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > > > + idNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.idNonNull<$Context['scalars']>>, ) => Promise< @@ -68,6 +70,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + InputObjectNested: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.InputObjectNested<$Context['scalars']>>, ) => Promise< @@ -79,6 +82,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + InputObjectNestedNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.InputObjectNestedNonNull<$Context['scalars']>>, ) => Promise< @@ -104,6 +108,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + argInputObjectCircular: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.argInputObjectCircular<$Context['scalars']>>, ) => Promise< @@ -115,6 +120,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + date: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.date<$Context['scalars']>>, ) => Promise< @@ -126,6 +132,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArg: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArg<$Context['scalars']>>, ) => Promise< @@ -137,6 +144,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgInputObject: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgInputObject<$Context['scalars']>>, ) => Promise< @@ -148,6 +156,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgList: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgList<$Context['scalars']>>, ) => Promise< @@ -159,6 +168,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNull<$Context['scalars']>>, ) => Promise< @@ -170,6 +180,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgNonNullList: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullList<$Context['scalars']>>, ) => Promise< @@ -181,6 +192,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateArgNonNullListNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullListNonNull<$Context['scalars']>>, ) => Promise< @@ -192,6 +204,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateInterface1: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateInterface1<$Context['scalars']>>, ) => Promise< @@ -203,6 +216,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateList: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateList<$Context['scalars']>>, ) => Promise< @@ -214,6 +228,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateListList: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateListList<$Context['scalars']>>, ) => Promise< @@ -225,6 +240,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateListNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateListNonNull<$Context['scalars']>>, ) => Promise< @@ -236,6 +252,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateNonNull<$Context['scalars']>>, ) => Promise< @@ -247,6 +264,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateObject1: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateObject1<$Context['scalars']>>, ) => Promise< @@ -258,6 +276,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + dateUnion: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateUnion<$Context['scalars']>>, ) => Promise< @@ -269,6 +288,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + error: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.error<$Context['scalars']>>, ) => Promise< @@ -280,6 +300,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + id: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.id<$Context['scalars']>>, ) => Promise< @@ -291,6 +312,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + idNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.idNonNull<$Context['scalars']>>, ) => Promise< @@ -302,6 +324,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + interface: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$interface<$Context['scalars']>>, ) => Promise< @@ -313,6 +336,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + interfaceNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.interfaceNonNull<$Context['scalars']>>, ) => Promise< @@ -324,6 +348,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + interfaceWithArgs: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.interfaceWithArgs<$Context['scalars']>>, ) => Promise< @@ -335,6 +360,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + listInt: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listInt<$Context['scalars']>>, ) => Promise< @@ -346,6 +372,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + listIntNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listIntNonNull<$Context['scalars']>>, ) => Promise< @@ -357,6 +384,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + listListInt: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listListInt<$Context['scalars']>>, ) => Promise< @@ -368,6 +396,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + listListIntNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listListIntNonNull<$Context['scalars']>>, ) => Promise< @@ -379,6 +408,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + lowerCaseUnion: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.lowerCaseUnion<$Context['scalars']>>, ) => Promise< @@ -390,6 +420,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + object: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$object<$Context['scalars']>>, ) => Promise< @@ -401,6 +432,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectList: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectList<$Context['scalars']>>, ) => Promise< @@ -412,6 +444,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectListNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectListNonNull<$Context['scalars']>>, ) => Promise< @@ -423,6 +456,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectNested: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectNested<$Context['scalars']>>, ) => Promise< @@ -434,6 +468,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectNonNull<$Context['scalars']>>, ) => Promise< @@ -445,6 +480,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + objectWithArgs: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectWithArgs<$Context['scalars']>>, ) => Promise< @@ -456,6 +492,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + result: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.result<$Context['scalars']>>, ) => Promise< @@ -467,6 +504,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + resultNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.resultNonNull<$Context['scalars']>>, ) => Promise< @@ -478,6 +516,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + string: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$string<$Context['scalars']>>, ) => Promise< @@ -489,6 +528,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithArgEnum: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgEnum<$Context['scalars']>>, ) => Promise< @@ -500,6 +540,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithArgInputObject: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgInputObject<$Context['scalars']>>, ) => Promise< @@ -511,6 +552,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithArgInputObjectRequired: <$SelectionSet>( selectionSet: $$Utilities.Exact< $SelectionSet, @@ -539,6 +581,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithListArg: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithListArg<$Context['scalars']>>, ) => Promise< @@ -550,6 +593,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithListArgRequired: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithListArgRequired<$Context['scalars']>>, ) => Promise< @@ -561,6 +605,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + stringWithRequiredArg: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithRequiredArg<$Context['scalars']>>, ) => Promise< @@ -572,6 +617,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionFooBar: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBar<$Context['scalars']>>, ) => Promise< @@ -583,6 +629,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionFooBarNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBarNonNull<$Context['scalars']>>, ) => Promise< @@ -594,6 +641,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionFooBarWithArgs: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBarWithArgs<$Context['scalars']>>, ) => Promise< @@ -605,6 +653,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionObject: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionObject<$Context['scalars']>>, ) => Promise< @@ -616,6 +665,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + unionObjectNonNull: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionObjectNonNull<$Context['scalars']>>, ) => Promise< diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/Schema.ts b/tests/_/schemas/kitchen-sink/graffle/modules/Schema.ts index c0e669a3d..5a2e9aab5 100644 --- a/tests/_/schemas/kitchen-sink/graffle/modules/Schema.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/Schema.ts @@ -3,6 +3,7 @@ import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-f import type * as Data from './Data.js' import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' + export namespace Schema { // // @@ -20,209 +21,681 @@ export namespace Schema { // // - export type Mutation = $.StandardTypes.Mutation<{ - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - idNonNull: $.OutputField<'idNonNull', $Scalar.ID, null> - }> + // Mutation + // -------------------------------------------------------------------------------------------------- + // + + export interface Mutation extends $.OutputObject { + name: 'Mutation' + fields: { + __typename: Mutation.__typename + id: Mutation.id + idNonNull: Mutation.idNonNull + } + } + + export namespace Mutation { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Mutation' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface idNonNull extends $.OutputField { + name: 'idNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + } + + // Query + // -------------------------------------------------------------------------------------------------- + // + + export interface Query extends $.OutputObject { + name: 'Query' + fields: { + __typename: Query.__typename + InputObjectNested: Query.InputObjectNested + InputObjectNestedNonNull: Query.InputObjectNestedNonNull + abcEnum: Query.abcEnum + argInputObjectCircular: Query.argInputObjectCircular + date: Query.date + dateArg: Query.dateArg + dateArgInputObject: Query.dateArgInputObject + dateArgList: Query.dateArgList + dateArgNonNull: Query.dateArgNonNull + dateArgNonNullList: Query.dateArgNonNullList + dateArgNonNullListNonNull: Query.dateArgNonNullListNonNull + dateInterface1: Query.dateInterface1 + dateList: Query.dateList + dateListList: Query.dateListList + dateListNonNull: Query.dateListNonNull + dateNonNull: Query.dateNonNull + dateObject1: Query.dateObject1 + dateUnion: Query.dateUnion + error: Query.error + id: Query.id + idNonNull: Query.idNonNull + interface: Query.$interface + interfaceNonNull: Query.interfaceNonNull + interfaceWithArgs: Query.interfaceWithArgs + listInt: Query.listInt + listIntNonNull: Query.listIntNonNull + listListInt: Query.listListInt + listListIntNonNull: Query.listListIntNonNull + lowerCaseUnion: Query.lowerCaseUnion + object: Query.$object + objectList: Query.objectList + objectListNonNull: Query.objectListNonNull + objectNested: Query.objectNested + objectNonNull: Query.objectNonNull + objectWithArgs: Query.objectWithArgs + result: Query.result + resultNonNull: Query.resultNonNull + string: Query.$string + stringWithArgEnum: Query.stringWithArgEnum + stringWithArgInputObject: Query.stringWithArgInputObject + stringWithArgInputObjectRequired: Query.stringWithArgInputObjectRequired + stringWithArgs: Query.stringWithArgs + stringWithListArg: Query.stringWithListArg + stringWithListArgRequired: Query.stringWithListArgRequired + stringWithRequiredArg: Query.stringWithRequiredArg + unionFooBar: Query.unionFooBar + unionFooBarNonNull: Query.unionFooBarNonNull + unionFooBarWithArgs: Query.unionFooBarWithArgs + unionObject: Query.unionObject + unionObjectNonNull: Query.unionObjectNonNull + } + } + + export namespace Query { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Query' + } + } + + export interface InputObjectNested extends $.OutputField { + name: 'InputObjectNested' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [0] + namedType: $$NamedTypes.$$InputObjectNested + } + } + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface InputObjectNestedNonNull extends $.OutputField { + name: 'InputObjectNestedNonNull' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [1] + namedType: $$NamedTypes.$$InputObjectNestedNonNull + } + } + inlineType: [0] + namedType: $$NamedTypes.$$ID + } - export type Query = $.StandardTypes.Query<{ - InputObjectNested: $.OutputField< - 'InputObjectNested', - $.Nullable<$Scalar.ID>, - $.Args<{ - input: $.InputField<$.Nullable> - }, true> - > - InputObjectNestedNonNull: $.OutputField< - 'InputObjectNestedNonNull', - $.Nullable<$Scalar.ID>, - $.Args<{ - input: $.InputField - }, false> - > /** * Query enum field documentation. */ - abcEnum: $.OutputField<'abcEnum', $.Nullable, null> - argInputObjectCircular: $.OutputField< - 'argInputObjectCircular', - $.Nullable<$Scalar.String>, - $.Args<{ - input: $.InputField<$.Nullable> - }, true> - > - date: $.OutputField<'date', $.Nullable<$Scalar.Date>, null> - dateArg: $.OutputField< - 'dateArg', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$.Nullable<$Scalar.Date>> - }, true> - > - dateArgInputObject: $.OutputField< - 'dateArgInputObject', - $.Nullable<$Scalar.Date>, - $.Args<{ - input: $.InputField<$.Nullable> - }, true> - > - dateArgList: $.OutputField< - 'dateArgList', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$.Nullable<$.List<$Scalar.Date>>> - }, true> - > - dateArgNonNull: $.OutputField< - 'dateArgNonNull', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$Scalar.Date> - }, false> - > - dateArgNonNullList: $.OutputField< - 'dateArgNonNullList', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$.List<$.Nullable<$Scalar.Date>>> - }, false> - > - dateArgNonNullListNonNull: $.OutputField< - 'dateArgNonNullListNonNull', - $.Nullable<$Scalar.Date>, - $.Args<{ - date: $.InputField<$.List<$Scalar.Date>> - }, false> - > - dateInterface1: $.OutputField<'dateInterface1', $.Nullable, null> - dateList: $.OutputField<'dateList', $.Nullable<$.List<$Scalar.Date>>, null> - dateListList: $.OutputField<'dateListList', $.Nullable<$.List<$.List<$Scalar.Date>>>, null> - dateListNonNull: $.OutputField<'dateListNonNull', $.List<$Scalar.Date>, null> - dateNonNull: $.OutputField<'dateNonNull', $Scalar.Date, null> - dateObject1: $.OutputField<'dateObject1', $.Nullable, null> - dateUnion: $.OutputField<'dateUnion', $.Nullable, null> - error: $.OutputField< - 'error', - $.Nullable<$Scalar.String>, - $.Args<{ - case: $.InputField<$.Nullable<$Scalar.String>> - }, true> - > - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - idNonNull: $.OutputField<'idNonNull', $Scalar.ID, null> - interface: $.OutputField<'interface', $.Nullable, null> - interfaceNonNull: $.OutputField<'interfaceNonNull', Interface, null> - interfaceWithArgs: $.OutputField< - 'interfaceWithArgs', - $.Nullable, - $.Args<{ - id: $.InputField<$Scalar.ID> - }, false> - > - listInt: $.OutputField<'listInt', $.Nullable<$.List<$.Nullable<$Scalar.Int>>>, null> - listIntNonNull: $.OutputField<'listIntNonNull', $.List<$Scalar.Int>, null> - listListInt: $.OutputField<'listListInt', $.Nullable<$.List<$.Nullable<$.List<$.Nullable<$Scalar.Int>>>>>, null> - listListIntNonNull: $.OutputField<'listListIntNonNull', $.List<$.List<$Scalar.Int>>, null> - lowerCaseUnion: $.OutputField<'lowerCaseUnion', $.Nullable, null> - object: $.OutputField<'object', $.Nullable, null> - objectList: $.OutputField<'objectList', $.Nullable<$.List>, null> - objectListNonNull: $.OutputField<'objectListNonNull', $.List, null> - objectNested: $.OutputField<'objectNested', $.Nullable, null> - objectNonNull: $.OutputField<'objectNonNull', Object1, null> - objectWithArgs: $.OutputField< - 'objectWithArgs', - $.Nullable, - $.Args<{ - boolean: $.InputField<$.Nullable<$Scalar.Boolean>> - float: $.InputField<$.Nullable<$Scalar.Float>> - id: $.InputField<$.Nullable<$Scalar.ID>> - int: $.InputField<$.Nullable<$Scalar.Int>> - string: $.InputField<$.Nullable<$Scalar.String>> - }, true> - > - result: $.OutputField< - 'result', - $.Nullable, - $.Args<{ - case: $.InputField - }, false> - > - resultNonNull: $.OutputField< - 'resultNonNull', - Result, - $.Args<{ - case: $.InputField<$.Nullable> - }, true> - > - string: $.OutputField<'string', $.Nullable<$Scalar.String>, null> - stringWithArgEnum: $.OutputField< - 'stringWithArgEnum', - $.Nullable<$Scalar.String>, - $.Args<{ - ABCEnum: $.InputField<$.Nullable> - }, true> - > - stringWithArgInputObject: $.OutputField< - 'stringWithArgInputObject', - $.Nullable<$Scalar.String>, - $.Args<{ - input: $.InputField<$.Nullable> - }, true> - > - stringWithArgInputObjectRequired: $.OutputField< - 'stringWithArgInputObjectRequired', - $.Nullable<$Scalar.String>, - $.Args<{ - input: $.InputField - }, false> - > + export interface abcEnum extends $.OutputField { + name: 'abcEnum' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ABCEnum + } + + export interface argInputObjectCircular extends $.OutputField { + name: 'argInputObjectCircular' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [0] + namedType: $$NamedTypes.$$InputObjectCircular + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface date extends $.OutputField { + name: 'date' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArg extends $.OutputField { + name: 'dateArg' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgInputObject extends $.OutputField { + name: 'dateArgInputObject' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [0] + namedType: $$NamedTypes.$$InputObject + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgList extends $.OutputField { + name: 'dateArgList' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgNonNull extends $.OutputField { + name: 'dateArgNonNull' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [1] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgNonNullList extends $.OutputField { + name: 'dateArgNonNullList' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [1, [0]] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateArgNonNullListNonNull extends $.OutputField { + name: 'dateArgNonNullListNonNull' + arguments: { + date: { + kind: 'InputField' + name: 'date' + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Date + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + + export interface dateInterface1 extends $.OutputField { + name: 'dateInterface1' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$DateInterface1 + } + + export interface dateList extends $.OutputField { + name: 'dateList' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Date + } + + export interface dateListList extends $.OutputField { + name: 'dateListList' + arguments: {} + inlineType: [0, [1, [1]]] + namedType: $$NamedTypes.$$Date + } + + export interface dateListNonNull extends $.OutputField { + name: 'dateListNonNull' + arguments: {} + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Date + } + + export interface dateNonNull extends $.OutputField { + name: 'dateNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$Date + } + + export interface dateObject1 extends $.OutputField { + name: 'dateObject1' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$DateObject1 + } + + export interface dateUnion extends $.OutputField { + name: 'dateUnion' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$DateUnion + } + + export interface error extends $.OutputField { + name: 'error' + arguments: { + case: { + kind: 'InputField' + name: 'case' + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface idNonNull extends $.OutputField { + name: 'idNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + + export interface $interface extends $.OutputField { + name: 'interface' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Interface + } + + export interface interfaceNonNull extends $.OutputField { + name: 'interfaceNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$Interface + } + + export interface interfaceWithArgs extends $.OutputField { + name: 'interfaceWithArgs' + arguments: { + id: { + kind: 'InputField' + name: 'id' + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Interface + } + + export interface listInt extends $.OutputField { + name: 'listInt' + arguments: {} + inlineType: [0, [0]] + namedType: $$NamedTypes.$$Int + } + + export interface listIntNonNull extends $.OutputField { + name: 'listIntNonNull' + arguments: {} + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Int + } + + export interface listListInt extends $.OutputField { + name: 'listListInt' + arguments: {} + inlineType: [0, [0, [0]]] + namedType: $$NamedTypes.$$Int + } + + export interface listListIntNonNull extends $.OutputField { + name: 'listListIntNonNull' + arguments: {} + inlineType: [1, [1, [1]]] + namedType: $$NamedTypes.$$Int + } + + export interface lowerCaseUnion extends $.OutputField { + name: 'lowerCaseUnion' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$lowerCaseUnion + } + + export interface $object extends $.OutputField { + name: 'object' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Object1 + } + + export interface objectList extends $.OutputField { + name: 'objectList' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Object1 + } + + export interface objectListNonNull extends $.OutputField { + name: 'objectListNonNull' + arguments: {} + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Object1 + } + + export interface objectNested extends $.OutputField { + name: 'objectNested' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ObjectNested + } + + export interface objectNonNull extends $.OutputField { + name: 'objectNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$Object1 + } + + export interface objectWithArgs extends $.OutputField { + name: 'objectWithArgs' + arguments: { + boolean: { + kind: 'InputField' + name: 'boolean' + inlineType: [0] + namedType: $$NamedTypes.$$Boolean + } + float: { + kind: 'InputField' + name: 'float' + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + id: { + kind: 'InputField' + name: 'id' + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + int: { + kind: 'InputField' + name: 'int' + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + string: { + kind: 'InputField' + name: 'string' + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Object1 + } + + export interface result extends $.OutputField { + name: 'result' + arguments: { + case: { + kind: 'InputField' + name: 'case' + inlineType: [1] + namedType: $$NamedTypes.$$Case + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Result + } + + export interface resultNonNull extends $.OutputField { + name: 'resultNonNull' + arguments: { + case: { + kind: 'InputField' + name: 'case' + inlineType: [0] + namedType: $$NamedTypes.$$Case + } + } + inlineType: [1] + namedType: $$NamedTypes.$$Result + } + + export interface $string extends $.OutputField { + name: 'string' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithArgEnum extends $.OutputField { + name: 'stringWithArgEnum' + arguments: { + ABCEnum: { + kind: 'InputField' + name: 'ABCEnum' + inlineType: [0] + namedType: $$NamedTypes.$$ABCEnum + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithArgInputObject extends $.OutputField { + name: 'stringWithArgInputObject' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [0] + namedType: $$NamedTypes.$$InputObject + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithArgInputObjectRequired extends $.OutputField { + name: 'stringWithArgInputObjectRequired' + arguments: { + input: { + kind: 'InputField' + name: 'input' + inlineType: [1] + namedType: $$NamedTypes.$$InputObject + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + /** * The given arguments are reflected back as a JSON string. */ - stringWithArgs: $.OutputField< - 'stringWithArgs', - $.Nullable<$Scalar.String>, - $.Args<{ - boolean: $.InputField<$.Nullable<$Scalar.Boolean>> - float: $.InputField<$.Nullable<$Scalar.Float>> - id: $.InputField<$.Nullable<$Scalar.ID>> - int: $.InputField<$.Nullable<$Scalar.Int>> - string: $.InputField<$.Nullable<$Scalar.String>> - }, true> - > - stringWithListArg: $.OutputField< - 'stringWithListArg', - $.Nullable<$Scalar.String>, - $.Args<{ - ints: $.InputField<$.Nullable<$.List<$.Nullable<$Scalar.Int>>>> - }, true> - > - stringWithListArgRequired: $.OutputField< - 'stringWithListArgRequired', - $.Nullable<$Scalar.String>, - $.Args<{ - ints: $.InputField<$.List<$Scalar.Int>> - }, false> - > - stringWithRequiredArg: $.OutputField< - 'stringWithRequiredArg', - $.Nullable<$Scalar.String>, - $.Args<{ - string: $.InputField<$Scalar.String> - }, false> - > - unionFooBar: $.OutputField<'unionFooBar', $.Nullable, null> - unionFooBarNonNull: $.OutputField<'unionFooBarNonNull', FooBarUnion, null> - unionFooBarWithArgs: $.OutputField< - 'unionFooBarWithArgs', - $.Nullable, - $.Args<{ - id: $.InputField<$.Nullable<$Scalar.ID>> - }, true> - > - unionObject: $.OutputField<'unionObject', $.Nullable, null> - unionObjectNonNull: $.OutputField<'unionObjectNonNull', ObjectUnion, null> - }> + export interface stringWithArgs extends $.OutputField { + name: 'stringWithArgs' + arguments: { + boolean: { + kind: 'InputField' + name: 'boolean' + inlineType: [0] + namedType: $$NamedTypes.$$Boolean + } + float: { + kind: 'InputField' + name: 'float' + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + id: { + kind: 'InputField' + name: 'id' + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + /** + * @deprecated Example of argument deprecation reason here. + */ + int: { + kind: 'InputField' + name: 'int' + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + /** + * Example of some argument documentation here. + */ + string: { + kind: 'InputField' + name: 'string' + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithListArg extends $.OutputField { + name: 'stringWithListArg' + arguments: { + ints: { + kind: 'InputField' + name: 'ints' + inlineType: [0, [0]] + namedType: $$NamedTypes.$$Int + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithListArgRequired extends $.OutputField { + name: 'stringWithListArgRequired' + arguments: { + ints: { + kind: 'InputField' + name: 'ints' + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Int + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface stringWithRequiredArg extends $.OutputField { + name: 'stringWithRequiredArg' + arguments: { + string: { + kind: 'InputField' + name: 'string' + inlineType: [1] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface unionFooBar extends $.OutputField { + name: 'unionFooBar' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$FooBarUnion + } + + export interface unionFooBarNonNull extends $.OutputField { + name: 'unionFooBarNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$FooBarUnion + } + + export interface unionFooBarWithArgs extends $.OutputField { + name: 'unionFooBarWithArgs' + arguments: { + id: { + kind: 'InputField' + name: 'id' + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + } + inlineType: [0] + namedType: $$NamedTypes.$$FooBarUnion + } + + export interface unionObject extends $.OutputField { + name: 'unionObject' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ObjectUnion + } + + export interface unionObjectNonNull extends $.OutputField { + name: 'unionObjectNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$ObjectUnion + } + } // // @@ -240,75 +713,496 @@ export namespace Schema { // // - export type Bar = $.OutputObject<'Bar', { - int: $.OutputField<'int', $.Nullable<$Scalar.Int>, null> - }> + // Bar + // -------------------------------------------------------------------------------------------------- + // + + export interface Bar extends $.OutputObject { + name: 'Bar' + fields: { + __typename: Bar.__typename + int: Bar.int + } + } - export type DateObject1 = $.OutputObject<'DateObject1', { - date1: $.OutputField<'date1', $.Nullable<$Scalar.Date>, null> - }> + export namespace Bar { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Bar' + } + } - export type DateObject2 = $.OutputObject<'DateObject2', { - date2: $.OutputField<'date2', $.Nullable<$Scalar.Date>, null> - }> + export interface int extends $.OutputField { + name: 'int' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + } - export type ErrorOne = $.OutputObject<'ErrorOne', { - infoId: $.OutputField<'infoId', $.Nullable<$Scalar.ID>, null> - message: $.OutputField<'message', $Scalar.String, null> - }> + // DateObject1 + // -------------------------------------------------------------------------------------------------- + // - export type ErrorTwo = $.OutputObject<'ErrorTwo', { - infoInt: $.OutputField<'infoInt', $.Nullable<$Scalar.Int>, null> - message: $.OutputField<'message', $Scalar.String, null> - }> + export interface DateObject1 extends $.OutputObject { + name: 'DateObject1' + fields: { + __typename: DateObject1.__typename + date1: DateObject1.date1 + } + } + + export namespace DateObject1 { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'DateObject1' + } + } + + export interface date1 extends $.OutputField { + name: 'date1' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + } + + // DateObject2 + // -------------------------------------------------------------------------------------------------- + // + + export interface DateObject2 extends $.OutputObject { + name: 'DateObject2' + fields: { + __typename: DateObject2.__typename + date2: DateObject2.date2 + } + } + + export namespace DateObject2 { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'DateObject2' + } + } + + export interface date2 extends $.OutputField { + name: 'date2' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + } + + // ErrorOne + // -------------------------------------------------------------------------------------------------- + // + + export interface ErrorOne extends $.OutputObject { + name: 'ErrorOne' + fields: { + __typename: ErrorOne.__typename + infoId: ErrorOne.infoId + message: ErrorOne.message + } + } + + export namespace ErrorOne { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'ErrorOne' + } + } + + export interface infoId extends $.OutputField { + name: 'infoId' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface message extends $.OutputField { + name: 'message' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$String + } + } + + // ErrorTwo + // -------------------------------------------------------------------------------------------------- + // + + export interface ErrorTwo extends $.OutputObject { + name: 'ErrorTwo' + fields: { + __typename: ErrorTwo.__typename + infoInt: ErrorTwo.infoInt + message: ErrorTwo.message + } + } + + export namespace ErrorTwo { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'ErrorTwo' + } + } + + export interface infoInt extends $.OutputField { + name: 'infoInt' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + + export interface message extends $.OutputField { + name: 'message' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$String + } + } + + // Foo + // -------------------------------------------------------------------------------------------------- + // /** * Object documentation. */ - export type Foo = $.OutputObject<'Foo', { + export interface Foo extends $.OutputObject { + name: 'Foo' + fields: { + __typename: Foo.__typename + id: Foo.id + } + } + + export namespace Foo { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Foo' + } + } + /** * Field documentation. * * @deprecated Field a is deprecated. */ - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - }> + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + } + + // Object1 + // -------------------------------------------------------------------------------------------------- + // + + export interface Object1 extends $.OutputObject { + name: 'Object1' + fields: { + __typename: Object1.__typename + ABCEnum: Object1.ABCEnum + boolean: Object1.$boolean + float: Object1.float + id: Object1.id + int: Object1.int + string: Object1.$string + } + } + + export namespace Object1 { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Object1' + } + } + + export interface ABCEnum extends $.OutputField { + name: 'ABCEnum' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ABCEnum + } + + export interface $boolean extends $.OutputField { + name: 'boolean' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Boolean + } + + export interface float extends $.OutputField { + name: 'float' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface int extends $.OutputField { + name: 'int' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + + export interface $string extends $.OutputField { + name: 'string' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + + // Object1ImplementingInterface + // -------------------------------------------------------------------------------------------------- + // + + export interface Object1ImplementingInterface extends $.OutputObject { + name: 'Object1ImplementingInterface' + fields: { + __typename: Object1ImplementingInterface.__typename + id: Object1ImplementingInterface.id + int: Object1ImplementingInterface.int + } + } + + export namespace Object1ImplementingInterface { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Object1ImplementingInterface' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface int extends $.OutputField { + name: 'int' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + } + + // Object2ImplementingInterface + // -------------------------------------------------------------------------------------------------- + // + + export interface Object2ImplementingInterface extends $.OutputObject { + name: 'Object2ImplementingInterface' + fields: { + __typename: Object2ImplementingInterface.__typename + boolean: Object2ImplementingInterface.$boolean + id: Object2ImplementingInterface.id + } + } + + export namespace Object2ImplementingInterface { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Object2ImplementingInterface' + } + } + + export interface $boolean extends $.OutputField { + name: 'boolean' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Boolean + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + } + + // ObjectNested + // -------------------------------------------------------------------------------------------------- + // + + export interface ObjectNested extends $.OutputObject { + name: 'ObjectNested' + fields: { + __typename: ObjectNested.__typename + id: ObjectNested.id + object: ObjectNested.$object + } + } + + export namespace ObjectNested { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'ObjectNested' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface $object extends $.OutputField { + name: 'object' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Object1 + } + } - export type Object1 = $.OutputObject<'Object1', { - ABCEnum: $.OutputField<'ABCEnum', $.Nullable, null> - boolean: $.OutputField<'boolean', $.Nullable<$Scalar.Boolean>, null> - float: $.OutputField<'float', $.Nullable<$Scalar.Float>, null> - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - int: $.OutputField<'int', $.Nullable<$Scalar.Int>, null> - string: $.OutputField<'string', $.Nullable<$Scalar.String>, null> - }> + // ObjectUnion + // -------------------------------------------------------------------------------------------------- + // + + export interface ObjectUnion extends $.OutputObject { + name: 'ObjectUnion' + fields: { + __typename: ObjectUnion.__typename + fooBarUnion: ObjectUnion.fooBarUnion + } + } + + export namespace ObjectUnion { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'ObjectUnion' + } + } + + export interface fooBarUnion extends $.OutputField { + name: 'fooBarUnion' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$FooBarUnion + } + } + + // lowerCaseObject + // -------------------------------------------------------------------------------------------------- + // + + export interface lowerCaseObject extends $.OutputObject { + name: 'lowerCaseObject' + fields: { + __typename: lowerCaseObject.__typename + id: lowerCaseObject.id + } + } - export type Object1ImplementingInterface = $.OutputObject<'Object1ImplementingInterface', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - int: $.OutputField<'int', $.Nullable<$Scalar.Int>, null> - }> + export namespace lowerCaseObject { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'lowerCaseObject' + } + } - export type Object2ImplementingInterface = $.OutputObject<'Object2ImplementingInterface', { - boolean: $.OutputField<'boolean', $.Nullable<$Scalar.Boolean>, null> - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - }> + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + } - export type ObjectNested = $.OutputObject<'ObjectNested', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - object: $.OutputField<'object', $.Nullable, null> - }> + // lowerCaseObject2 + // -------------------------------------------------------------------------------------------------- + // - export type ObjectUnion = $.OutputObject<'ObjectUnion', { - fooBarUnion: $.OutputField<'fooBarUnion', $.Nullable, null> - }> + export interface lowerCaseObject2 extends $.OutputObject { + name: 'lowerCaseObject2' + fields: { + __typename: lowerCaseObject2.__typename + int: lowerCaseObject2.int + } + } - export type lowerCaseObject = $.OutputObject<'lowerCaseObject', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - }> + export namespace lowerCaseObject2 { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'lowerCaseObject2' + } + } - export type lowerCaseObject2 = $.OutputObject<'lowerCaseObject2', { - int: $.OutputField<'int', $.Nullable<$Scalar.Int>, null> - }> + export interface int extends $.OutputField { + name: 'int' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + } // // @@ -326,25 +1220,113 @@ export namespace Schema { // // - export type InputObject = $.InputObject<'InputObject', { - date: $.InputField<$.Nullable<$Scalar.Date>> - dateRequired: $.InputField<$Scalar.Date> - id: $.InputField<$.Nullable<$Scalar.ID>> - idRequired: $.InputField<$Scalar.ID> - }, true> + // InputObject + // -------------------------------------------------------------------------------------------------- + // + + export interface InputObject extends $.InputObject { + name: 'InputObject' + isAllFieldsNullable: true + fields: { + date: InputObject.date + dateRequired: InputObject.dateRequired + id: InputObject.id + idRequired: InputObject.idRequired + } + } - export type InputObjectCircular = $.InputObject<'InputObjectCircular', { - circular: $.InputField<$.Nullable> - date: $.InputField<$.Nullable<$Scalar.Date>> - }, true> + export namespace InputObject { + export interface date extends $.InputField { + name: 'date' + inlineType: [0] + namedType: $$NamedTypes.$$Date + } - export type InputObjectNested = $.InputObject<'InputObjectNested', { - InputObject: $.InputField<$.Nullable> - }, true> + export interface dateRequired extends $.InputField { + name: 'dateRequired' + inlineType: [1] + namedType: $$NamedTypes.$$Date + } - export type InputObjectNestedNonNull = $.InputObject<'InputObjectNestedNonNull', { - InputObject: $.InputField - }, false> + export interface id extends $.InputField { + name: 'id' + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface idRequired extends $.InputField { + name: 'idRequired' + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + } + + // InputObjectCircular + // -------------------------------------------------------------------------------------------------- + // + + export interface InputObjectCircular extends $.InputObject { + name: 'InputObjectCircular' + isAllFieldsNullable: true + fields: { + circular: InputObjectCircular.circular + date: InputObjectCircular.date + } + } + + export namespace InputObjectCircular { + export interface circular extends $.InputField { + name: 'circular' + inlineType: [0] + namedType: $$NamedTypes.$$InputObjectCircular + } + + export interface date extends $.InputField { + name: 'date' + inlineType: [0] + namedType: $$NamedTypes.$$Date + } + } + + // InputObjectNested + // -------------------------------------------------------------------------------------------------- + // + + export interface InputObjectNested extends $.InputObject { + name: 'InputObjectNested' + isAllFieldsNullable: true + fields: { + InputObject: InputObjectNested.InputObject + } + } + + export namespace InputObjectNested { + export interface InputObject extends $.InputField { + name: 'InputObject' + inlineType: [0] + namedType: $$NamedTypes.$$InputObject + } + } + + // InputObjectNestedNonNull + // -------------------------------------------------------------------------------------------------- + // + + export interface InputObjectNestedNonNull extends $.InputObject { + name: 'InputObjectNestedNonNull' + isAllFieldsNullable: false + fields: { + InputObject: InputObjectNestedNonNull.InputObject + } + } + + export namespace InputObjectNestedNonNull { + export interface InputObject extends $.InputField { + name: 'InputObject' + inlineType: [1] + namedType: $$NamedTypes.$$InputObject + } + } // // @@ -362,17 +1344,50 @@ export namespace Schema { // // - export type DateInterface1 = $.Interface<'DateInterface1', { - date1: $.OutputField<'date1', $.Nullable<$Scalar.Date>, null> - }, [DateObject1]> + // DateInterface1 + // -------------------------------------------------------------------------------------------------- + // - export type Error = $.Interface<'Error', { - message: $.OutputField<'message', $Scalar.String, null> - }, [ErrorOne, ErrorTwo]> + export interface DateInterface1 extends $.Interface { + name: 'DateInterface1' + implementors: [DateObject1] + implementorsUnion: DateObject1 + implementorsIndex: { + DateObject1: DateObject1 + } + } + + // Error + // -------------------------------------------------------------------------------------------------- + // - export type Interface = $.Interface<'Interface', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - }, [Object1ImplementingInterface, Object2ImplementingInterface]> + export interface Error extends $.Interface { + name: 'Error' + implementors: [ErrorOne, ErrorTwo] + implementorsUnion: + | ErrorOne + | ErrorTwo + implementorsIndex: { + ErrorOne: ErrorOne + ErrorTwo: ErrorTwo + } + } + + // Interface + // -------------------------------------------------------------------------------------------------- + // + + export interface Interface extends $.Interface { + name: 'Interface' + implementors: [Object1ImplementingInterface, Object2ImplementingInterface] + implementorsUnion: + | Object1ImplementingInterface + | Object2ImplementingInterface + implementorsIndex: { + Object1ImplementingInterface: Object1ImplementingInterface + Object2ImplementingInterface: Object2ImplementingInterface + } + } // // @@ -390,16 +1405,74 @@ export namespace Schema { // // - export type DateUnion = $.Union<'DateUnion', [DateObject1, DateObject2]> + // DateUnion + // -------------------------------------------------------------------------------------------------- + // + + export interface DateUnion extends $.Union { + name: 'DateUnion' + members: [DateObject1, DateObject2] + membersUnion: + | DateObject1 + | DateObject2 + membersIndex: { + DateObject1: DateObject1 + DateObject2: DateObject2 + } + } + + // FooBarUnion + // -------------------------------------------------------------------------------------------------- + // /** * Union documentation. */ - export type FooBarUnion = $.Union<'FooBarUnion', [Bar, Foo]> + export interface FooBarUnion extends $.Union { + name: 'FooBarUnion' + members: [Bar, Foo] + membersUnion: + | Bar + | Foo + membersIndex: { + Bar: Bar + Foo: Foo + } + } - export type Result = $.Union<'Result', [ErrorOne, ErrorTwo, Object1]> + // Result + // -------------------------------------------------------------------------------------------------- + // - export type lowerCaseUnion = $.Union<'lowerCaseUnion', [lowerCaseObject, lowerCaseObject2]> + export interface Result extends $.Union { + name: 'Result' + members: [ErrorOne, ErrorTwo, Object1] + membersUnion: + | ErrorOne + | ErrorTwo + | Object1 + membersIndex: { + ErrorOne: ErrorOne + ErrorTwo: ErrorTwo + Object1: Object1 + } + } + + // lowerCaseUnion + // -------------------------------------------------------------------------------------------------- + // + + export interface lowerCaseUnion extends $.Union { + name: 'lowerCaseUnion' + members: [lowerCaseObject, lowerCaseObject2] + membersUnion: + | lowerCaseObject + | lowerCaseObject2 + membersIndex: { + lowerCaseObject: lowerCaseObject + lowerCaseObject2: lowerCaseObject2 + } + } // // @@ -417,6 +1490,10 @@ export namespace Schema { // // + // ABCEnum + // -------------------------------------------------------------------------------------------------- + // + /** * Enum documentation. * @@ -425,9 +1502,156 @@ export namespace Schema { * "B" - Enum B member documentation. * "C" - (DEPRECATED: Enum value C is deprecated.) */ - export type ABCEnum = $.Enum<'ABCEnum', ['A', 'B', 'C']> + export interface ABCEnum extends $.Enum { + name: 'ABCEnum' + members: ['A', 'B', 'C'] + membersUnion: + | 'A' + | 'B' + | 'C' + } + + // Case + // -------------------------------------------------------------------------------------------------- + // + + export interface Case extends $.Enum { + name: 'Case' + members: ['ErrorOne', 'ErrorTwo', 'Object1'] + membersUnion: + | 'ErrorOne' + | 'ErrorTwo' + | 'Object1' + } - export type Case = $.Enum<'Case', ['ErrorOne', 'ErrorTwo', 'Object1']> + // + // + // + // + // + // + // ================================================================================================== + // ScalarCustom + // ================================================================================================== + // + // + // + // + // + // + + // Date + // -------------------------------------------------------------------------------------------------- + // + + export type Date = $Scalar.Date + + // + // + // + // + // + // + // ================================================================================================== + // ScalarStandard + // ================================================================================================== + // + // + // + // + // + // + + // Boolean + // -------------------------------------------------------------------------------------------------- + // + + export type Boolean = $.StandardTypes.Boolean + + // Float + // -------------------------------------------------------------------------------------------------- + // + + export type Float = $.StandardTypes.Float + + // ID + // -------------------------------------------------------------------------------------------------- + // + + export type ID = $.StandardTypes.ID + + // Int + // -------------------------------------------------------------------------------------------------- + // + + export type Int = $.StandardTypes.Int + + // String + // -------------------------------------------------------------------------------------------------- + // + + export type String = $.StandardTypes.String + + // + // + // + // + // + // + // ================================================================================================== + // Named Types Index + // ================================================================================================== + // + // + // + // + // + // + + /** + * [1] These definitions serve to allow field selection interfaces to extend their respective object type without + * name clashing between the field name and the object name. + * + * For example imagine `Query.Foo` field with type also called `Foo`. Our generated interfaces for each field + * would end up with an error of `export interface Foo extends Foo ...` + */ + + namespace $$NamedTypes { + export type $$Mutation = Mutation + export type $$Query = Query + export type $$Bar = Bar + export type $$DateObject1 = DateObject1 + export type $$DateObject2 = DateObject2 + export type $$ErrorOne = ErrorOne + export type $$ErrorTwo = ErrorTwo + export type $$Foo = Foo + export type $$Object1 = Object1 + export type $$Object1ImplementingInterface = Object1ImplementingInterface + export type $$Object2ImplementingInterface = Object2ImplementingInterface + export type $$ObjectNested = ObjectNested + export type $$ObjectUnion = ObjectUnion + export type $$lowerCaseObject = lowerCaseObject + export type $$lowerCaseObject2 = lowerCaseObject2 + export type $$InputObject = InputObject + export type $$InputObjectCircular = InputObjectCircular + export type $$InputObjectNested = InputObjectNested + export type $$InputObjectNestedNonNull = InputObjectNestedNonNull + export type $$DateInterface1 = DateInterface1 + export type $$Error = Error + export type $$Interface = Interface + export type $$DateUnion = DateUnion + export type $$FooBarUnion = FooBarUnion + export type $$Result = Result + export type $$lowerCaseUnion = lowerCaseUnion + export type $$ABCEnum = ABCEnum + export type $$Case = Case + export type $$Date = Date + export type $$Boolean = Boolean + export type $$Float = Float + export type $$ID = ID + export type $$Int = Int + export type $$String = String + } } // @@ -445,7 +1669,8 @@ export namespace Schema { // // // -export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $$Utilities.Schema { + +export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $ { name: Data.Name RootTypesPresent: ['Mutation', 'Query'] RootUnion: Schema.Mutation | Schema.Query diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.ts b/tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.ts index da9388386..02dece106 100644 --- a/tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.ts @@ -448,7 +448,9 @@ export namespace Query { $?: InputObjectNested$Arguments<$Scalars> } - export interface InputObjectNested$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface InputObjectNested$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input?: $NamedTypes.$InputObjectNested<$Scalars> | undefined | null } @@ -479,7 +481,9 @@ export namespace Query { $: InputObjectNestedNonNull$Arguments<$Scalars> } - export interface InputObjectNestedNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface InputObjectNestedNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input: $NamedTypes.$InputObjectNestedNonNull<$Scalars> } @@ -532,7 +536,9 @@ export namespace Query { $?: argInputObjectCircular$Arguments<$Scalars> } - export interface argInputObjectCircular$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface argInputObjectCircular$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input?: $NamedTypes.$InputObjectCircular<$Scalars> | undefined | null } @@ -586,7 +592,9 @@ export namespace Query { $?: dateArg$Arguments<$Scalars> } - export interface dateArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date?: | $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> @@ -622,7 +630,9 @@ export namespace Query { $?: dateArgInputObject$Arguments<$Scalars> } - export interface dateArgInputObject$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgInputObject$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input?: $NamedTypes.$InputObject<$Scalars> | undefined | null } @@ -654,7 +664,9 @@ export namespace Query { $?: dateArgList$Arguments<$Scalars> } - export interface dateArgList$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgList$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date?: | Array< | $$Utilities.Schema.Scalar.GetDecoded< @@ -694,7 +706,9 @@ export namespace Query { $: dateArgNonNull$Arguments<$Scalars> } - export interface dateArgNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date: $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> > @@ -725,7 +739,9 @@ export namespace Query { $: dateArgNonNullList$Arguments<$Scalars> } - export interface dateArgNonNullList$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgNonNullList$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date: Array< | $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> @@ -761,7 +777,9 @@ export namespace Query { $: dateArgNonNullListNonNull$Arguments<$Scalars> } - export interface dateArgNonNullListNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface dateArgNonNullListNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { date: Array< | $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> @@ -948,7 +966,9 @@ export namespace Query { $?: error$Arguments<$Scalars> } - export interface error$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface error$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { case?: string | undefined | null } @@ -1062,7 +1082,9 @@ export namespace Query { $: interfaceWithArgs$Arguments<$Scalars> } - export interface interfaceWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface interfaceWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { id: string } @@ -1304,11 +1326,17 @@ export namespace Query { $?: objectWithArgs$Arguments<$Scalars> } - export interface objectWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface objectWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { boolean?: boolean | undefined | null + float?: number | undefined | null + id?: string | undefined | null + int?: number | undefined | null + string?: string | undefined | null } @@ -1336,7 +1364,9 @@ export namespace Query { $: result$Arguments<$Scalars> } - export interface result$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface result$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { $case: $NamedTypes.$Case } @@ -1366,7 +1396,9 @@ export namespace Query { $?: resultNonNull$Arguments<$Scalars> } - export interface resultNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface resultNonNull$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { $case?: $NamedTypes.$Case | undefined | null } @@ -1418,7 +1450,9 @@ export namespace Query { $?: stringWithArgEnum$Arguments<$Scalars> } - export interface stringWithArgEnum$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithArgEnum$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { $ABCEnum?: $NamedTypes.$ABCEnum | undefined | null } @@ -1450,7 +1484,9 @@ export namespace Query { $?: stringWithArgInputObject$Arguments<$Scalars> } - export interface stringWithArgInputObject$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithArgInputObject$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input?: $NamedTypes.$InputObject<$Scalars> | undefined | null } @@ -1481,9 +1517,9 @@ export namespace Query { $: stringWithArgInputObjectRequired$Arguments<$Scalars> } - export interface stringWithArgInputObjectRequired$Arguments< - $Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}, - > { + export interface stringWithArgInputObjectRequired$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { input: $NamedTypes.$InputObject<$Scalars> } @@ -1514,11 +1550,21 @@ export namespace Query { $?: stringWithArgs$Arguments<$Scalars> } - export interface stringWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { boolean?: boolean | undefined | null + float?: number | undefined | null + id?: string | undefined | null + /** + * @deprecated Example of argument deprecation reason here. + */ int?: number | undefined | null + /** + * Example of some argument documentation here. + */ string?: string | undefined | null } @@ -1549,7 +1595,9 @@ export namespace Query { $?: stringWithListArg$Arguments<$Scalars> } - export interface stringWithListArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithListArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { ints?: Array | undefined | null } @@ -1580,7 +1628,9 @@ export namespace Query { $: stringWithListArgRequired$Arguments<$Scalars> } - export interface stringWithListArgRequired$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithListArgRequired$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { ints: Array } @@ -1610,7 +1660,9 @@ export namespace Query { $: stringWithRequiredArg$Arguments<$Scalars> } - export interface stringWithRequiredArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface stringWithRequiredArg$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { string: string } @@ -1682,7 +1734,9 @@ export namespace Query { $?: unionFooBarWithArgs$Arguments<$Scalars> } - export interface unionFooBarWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface unionFooBarWithArgs$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { id?: string | undefined | null } @@ -1792,15 +1846,19 @@ export interface InputObject<$Scalars extends $$Utilities.Schema.Scalar.ScalarMa > | undefined | null + dateRequired: $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> > + id?: string | undefined | null + idRequired: string } export interface InputObjectCircular<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { circular?: $NamedTypes.$InputObjectCircular<$Scalars> | undefined | null + date?: | $$Utilities.Schema.Scalar.GetDecoded< $$Utilities.Schema.Scalar.LookupCustomScalarOrFallbackToString<'Date', $Scalars> diff --git a/tests/_/schemas/kitchen-sink/graffle/schema.graphql b/tests/_/schemas/kitchen-sink/graffle/schema.graphql index f0d473e66..022cebc68 100644 --- a/tests/_/schemas/kitchen-sink/graffle/schema.graphql +++ b/tests/_/schemas/kitchen-sink/graffle/schema.graphql @@ -162,7 +162,15 @@ type Query { stringWithArgInputObjectRequired(input: InputObject!): String """The given arguments are reflected back as a JSON string.""" - stringWithArgs(boolean: Boolean, float: Float, id: ID, int: Int, string: String): String + stringWithArgs( + boolean: Boolean + float: Float + id: ID + int: Int @deprecated(reason: "Example of argument deprecation reason here.") + + """Example of some argument documentation here.""" + string: String + ): String stringWithListArg(ints: [Int]): String stringWithListArgRequired(ints: [Int!]!): String stringWithRequiredArg(string: String!): String diff --git a/tests/_/schemas/kitchen-sink/schema.ts b/tests/_/schemas/kitchen-sink/schema.ts index 7ec9acfab..4d7af7555 100644 --- a/tests/_/schemas/kitchen-sink/schema.ts +++ b/tests/_/schemas/kitchen-sink/schema.ts @@ -302,8 +302,8 @@ builder.queryType({ type: `String`, description: `The given arguments are reflected back as a JSON string.`, args: { - string: t.arg.string(), - int: t.arg.int(), + string: t.arg.string({ description: `Example of some argument documentation here.` }), + int: t.arg.int({ deprecationReason: `Example of argument deprecation reason here.` }), float: t.arg.float(), boolean: t.arg.boolean(), id: t.arg.id(), diff --git a/tests/_/schemas/mutation-only/graffle/modules/MethodsRoot.ts b/tests/_/schemas/mutation-only/graffle/modules/MethodsRoot.ts index 93b9cef0a..32809a11a 100644 --- a/tests/_/schemas/mutation-only/graffle/modules/MethodsRoot.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/MethodsRoot.ts @@ -24,6 +24,7 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > > > + id: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.id<$Context['scalars']>>, ) => Promise< @@ -35,6 +36,7 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > > > + idNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.idNonNull<$Context['scalars']>>, ) => Promise< diff --git a/tests/_/schemas/mutation-only/graffle/modules/Schema.ts b/tests/_/schemas/mutation-only/graffle/modules/Schema.ts index d911b95f1..11f5467ec 100644 --- a/tests/_/schemas/mutation-only/graffle/modules/Schema.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/Schema.ts @@ -3,6 +3,7 @@ import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-f import type * as Data from './Data.js' import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' + export namespace Schema { // // @@ -20,10 +21,44 @@ export namespace Schema { // // - export type Mutation = $.StandardTypes.Mutation<{ - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - idNonNull: $.OutputField<'idNonNull', $Scalar.ID, null> - }> + // Mutation + // -------------------------------------------------------------------------------------------------- + // + + export interface Mutation extends $.OutputObject { + name: 'Mutation' + fields: { + __typename: Mutation.__typename + id: Mutation.id + idNonNull: Mutation.idNonNull + } + } + + export namespace Mutation { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Mutation' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface idNonNull extends $.OutputField { + name: 'idNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + } // // @@ -41,8 +76,6 @@ export namespace Schema { // // - // -- no types -- - // // // @@ -59,8 +92,6 @@ export namespace Schema { // // - // -- no types -- - // // // @@ -77,8 +108,6 @@ export namespace Schema { // // - // -- no types -- - // // // @@ -95,8 +124,6 @@ export namespace Schema { // // - // -- no types -- - // // // @@ -113,7 +140,100 @@ export namespace Schema { // // - // -- no types -- + // + // + // + // + // + // + // ================================================================================================== + // ScalarCustom + // ================================================================================================== + // + // + // + // + // + // + + // + // + // + // + // + // + // ================================================================================================== + // ScalarStandard + // ================================================================================================== + // + // + // + // + // + // + + // Boolean + // -------------------------------------------------------------------------------------------------- + // + + export type Boolean = $.StandardTypes.Boolean + + // Float + // -------------------------------------------------------------------------------------------------- + // + + export type Float = $.StandardTypes.Float + + // ID + // -------------------------------------------------------------------------------------------------- + // + + export type ID = $.StandardTypes.ID + + // Int + // -------------------------------------------------------------------------------------------------- + // + + export type Int = $.StandardTypes.Int + + // String + // -------------------------------------------------------------------------------------------------- + // + + export type String = $.StandardTypes.String + + // + // + // + // + // + // + // ================================================================================================== + // Named Types Index + // ================================================================================================== + // + // + // + // + // + // + + /** + * [1] These definitions serve to allow field selection interfaces to extend their respective object type without + * name clashing between the field name and the object name. + * + * For example imagine `Query.Foo` field with type also called `Foo`. Our generated interfaces for each field + * would end up with an error of `export interface Foo extends Foo ...` + */ + + namespace $$NamedTypes { + export type $$Mutation = Mutation + export type $$Boolean = Boolean + export type $$Float = Float + export type $$ID = ID + export type $$Int = Int + export type $$String = String + } } // @@ -131,7 +251,8 @@ export namespace Schema { // // // -export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $$Utilities.Schema { + +export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $ { name: Data.Name RootTypesPresent: ['Mutation'] RootUnion: Schema.Mutation diff --git a/tests/_/schemas/pokemon/graffle/modules/Global.ts b/tests/_/schemas/pokemon/graffle/modules/Global.ts index d6045172e..7cca17d3f 100644 --- a/tests/_/schemas/pokemon/graffle/modules/Global.ts +++ b/tests/_/schemas/pokemon/graffle/modules/Global.ts @@ -15,7 +15,6 @@ declare global { Document: MethodsDocument.BuilderMethodsDocumentFn Root: MethodsRoot.BuilderMethodsRootFn } - /** * http://localhost:3000/graphql */ diff --git a/tests/_/schemas/pokemon/graffle/modules/MethodsRoot.ts b/tests/_/schemas/pokemon/graffle/modules/MethodsRoot.ts index 23f429613..a1d1ea680 100644 --- a/tests/_/schemas/pokemon/graffle/modules/MethodsRoot.ts +++ b/tests/_/schemas/pokemon/graffle/modules/MethodsRoot.ts @@ -24,6 +24,7 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > > > + addPokemon: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.addPokemon<$Context['scalars']>>, ) => Promise< @@ -57,6 +58,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + battles: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.battles<$Context['scalars']>>, ) => Promise< @@ -68,6 +70,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + beings: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.beings<$Context['scalars']>>, ) => Promise< @@ -79,6 +82,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + pokemon: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.pokemon<$Context['scalars']>>, ) => Promise< @@ -90,6 +94,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + pokemonByName: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.pokemonByName<$Context['scalars']>>, ) => Promise< @@ -101,6 +106,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + pokemons: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.pokemons<$Context['scalars']>>, ) => Promise< @@ -112,6 +118,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + trainerByName: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.trainerByName<$Context['scalars']>>, ) => Promise< @@ -123,6 +130,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + trainers: <$SelectionSet>( selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.trainers<$Context['scalars']>>, ) => Promise< diff --git a/tests/_/schemas/pokemon/graffle/modules/Schema.ts b/tests/_/schemas/pokemon/graffle/modules/Schema.ts index fccbce32f..f4c521267 100644 --- a/tests/_/schemas/pokemon/graffle/modules/Schema.ts +++ b/tests/_/schemas/pokemon/graffle/modules/Schema.ts @@ -3,6 +3,7 @@ import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-f import type * as Data from './Data.js' import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' + export namespace Schema { // // @@ -20,47 +21,167 @@ export namespace Schema { // // - export type Mutation = $.StandardTypes.Mutation<{ - addPokemon: $.OutputField< - 'addPokemon', - $.Nullable, - $.Args<{ - attack: $.InputField<$.Nullable<$Scalar.Int>> - defense: $.InputField<$.Nullable<$Scalar.Int>> - hp: $.InputField<$.Nullable<$Scalar.Int>> - name: $.InputField<$Scalar.String> - type: $.InputField - }, false> - > - }> + // Mutation + // -------------------------------------------------------------------------------------------------- + // + + export interface Mutation extends $.OutputObject { + name: 'Mutation' + fields: { + __typename: Mutation.__typename + addPokemon: Mutation.addPokemon + } + } + + export namespace Mutation { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Mutation' + } + } + + export interface addPokemon extends $.OutputField { + name: 'addPokemon' + arguments: { + attack: { + kind: 'InputField' + name: 'attack' + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + defense: { + kind: 'InputField' + name: 'defense' + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + hp: { + kind: 'InputField' + name: 'hp' + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + name: { + kind: 'InputField' + name: 'name' + inlineType: [1] + namedType: $$NamedTypes.$$String + } + type: { + kind: 'InputField' + name: 'type' + inlineType: [1] + namedType: $$NamedTypes.$$PokemonType + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Pokemon + } + } + + // Query + // -------------------------------------------------------------------------------------------------- + // + + export interface Query extends $.OutputObject { + name: 'Query' + fields: { + __typename: Query.__typename + battles: Query.battles + beings: Query.beings + pokemon: Query.pokemon + pokemonByName: Query.pokemonByName + pokemons: Query.pokemons + trainerByName: Query.trainerByName + trainers: Query.trainers + } + } + + export namespace Query { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Query' + } + } - export type Query = $.StandardTypes.Query<{ - battles: $.OutputField<'battles', $.List, null> - beings: $.OutputField<'beings', $.List, null> - pokemon: $.OutputField<'pokemon', $.Nullable<$.List>, null> - pokemonByName: $.OutputField< - 'pokemonByName', - $.Nullable<$.List>, - $.Args<{ - name: $.InputField<$Scalar.String> - }, false> - > - pokemons: $.OutputField< - 'pokemons', - $.Nullable<$.List>, - $.Args<{ - filter: $.InputField<$.Nullable> - }, true> - > - trainerByName: $.OutputField< - 'trainerByName', - $.Nullable, - $.Args<{ - name: $.InputField<$Scalar.String> - }, false> - > - trainers: $.OutputField<'trainers', $.Nullable<$.List>, null> - }> + export interface battles extends $.OutputField { + name: 'battles' + arguments: {} + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Battle + } + + export interface beings extends $.OutputField { + name: 'beings' + arguments: {} + inlineType: [1, [1]] + namedType: $$NamedTypes.$$Being + } + + export interface pokemon extends $.OutputField { + name: 'pokemon' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Pokemon + } + + export interface pokemonByName extends $.OutputField { + name: 'pokemonByName' + arguments: { + name: { + kind: 'InputField' + name: 'name' + inlineType: [1] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Pokemon + } + + export interface pokemons extends $.OutputField { + name: 'pokemons' + arguments: { + filter: { + kind: 'InputField' + name: 'filter' + inlineType: [0] + namedType: $$NamedTypes.$$PokemonFilter + } + } + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Pokemon + } + + export interface trainerByName extends $.OutputField { + name: 'trainerByName' + arguments: { + name: { + kind: 'InputField' + name: 'name' + inlineType: [1] + namedType: $$NamedTypes.$$String + } + } + inlineType: [0] + namedType: $$NamedTypes.$$Trainer + } + + export interface trainers extends $.OutputField { + name: 'trainers' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Trainer + } + } // // @@ -78,64 +199,469 @@ export namespace Schema { // // - export type BattleRoyale = $.OutputObject<'BattleRoyale', { - combatants: $.OutputField<'combatants', $.Nullable<$.List>, null> - date: $.OutputField<'date', $.Nullable<$Scalar.Float>, null> - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - winner: $.OutputField<'winner', $.Nullable, null> - }> + // BattleRoyale + // -------------------------------------------------------------------------------------------------- + // + + export interface BattleRoyale extends $.OutputObject { + name: 'BattleRoyale' + fields: { + __typename: BattleRoyale.__typename + combatants: BattleRoyale.combatants + date: BattleRoyale.date + id: BattleRoyale.id + winner: BattleRoyale.winner + } + } + + export namespace BattleRoyale { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'BattleRoyale' + } + } + + export interface combatants extends $.OutputField { + name: 'combatants' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$CombatantMultiPokemon + } + + export interface date extends $.OutputField { + name: 'date' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface winner extends $.OutputField { + name: 'winner' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Trainer + } + } + + // BattleTrainer + // -------------------------------------------------------------------------------------------------- + // + + export interface BattleTrainer extends $.OutputObject { + name: 'BattleTrainer' + fields: { + __typename: BattleTrainer.__typename + combatant1: BattleTrainer.combatant1 + combatant2: BattleTrainer.combatant2 + date: BattleTrainer.date + id: BattleTrainer.id + winner: BattleTrainer.winner + } + } + + export namespace BattleTrainer { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'BattleTrainer' + } + } + + export interface combatant1 extends $.OutputField { + name: 'combatant1' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$CombatantSinglePokemon + } + + export interface combatant2 extends $.OutputField { + name: 'combatant2' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$CombatantSinglePokemon + } + + export interface date extends $.OutputField { + name: 'date' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface winner extends $.OutputField { + name: 'winner' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Trainer + } + } + + // BattleWild + // -------------------------------------------------------------------------------------------------- + // + + export interface BattleWild extends $.OutputObject { + name: 'BattleWild' + fields: { + __typename: BattleWild.__typename + date: BattleWild.date + id: BattleWild.id + pokemon: BattleWild.pokemon + result: BattleWild.result + trainer: BattleWild.trainer + wildPokemons: BattleWild.wildPokemons + } + } + + export namespace BattleWild { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'BattleWild' + } + } + + export interface date extends $.OutputField { + name: 'date' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface pokemon extends $.OutputField { + name: 'pokemon' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Pokemon + } + + export interface result extends $.OutputField { + name: 'result' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$BattleWildResult + } + + export interface trainer extends $.OutputField { + name: 'trainer' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Trainer + } + + export interface wildPokemons extends $.OutputField { + name: 'wildPokemons' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Pokemon + } + } + + // CombatantMultiPokemon + // -------------------------------------------------------------------------------------------------- + // + + export interface CombatantMultiPokemon extends $.OutputObject { + name: 'CombatantMultiPokemon' + fields: { + __typename: CombatantMultiPokemon.__typename + pokemons: CombatantMultiPokemon.pokemons + trainer: CombatantMultiPokemon.trainer + } + } + + export namespace CombatantMultiPokemon { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'CombatantMultiPokemon' + } + } + + export interface pokemons extends $.OutputField { + name: 'pokemons' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Pokemon + } + + export interface trainer extends $.OutputField { + name: 'trainer' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Trainer + } + } + + // CombatantSinglePokemon + // -------------------------------------------------------------------------------------------------- + // + + export interface CombatantSinglePokemon extends $.OutputObject { + name: 'CombatantSinglePokemon' + fields: { + __typename: CombatantSinglePokemon.__typename + pokemon: CombatantSinglePokemon.pokemon + trainer: CombatantSinglePokemon.trainer + } + } + + export namespace CombatantSinglePokemon { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'CombatantSinglePokemon' + } + } + + export interface pokemon extends $.OutputField { + name: 'pokemon' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Pokemon + } + + export interface trainer extends $.OutputField { + name: 'trainer' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Trainer + } + } + + // Patron + // -------------------------------------------------------------------------------------------------- + // + + export interface Patron extends $.OutputObject { + name: 'Patron' + fields: { + __typename: Patron.__typename + id: Patron.id + money: Patron.money + name: Patron.name + } + } + + export namespace Patron { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Patron' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface money extends $.OutputField { + name: 'money' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + + export interface name extends $.OutputField { + name: 'name' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$String + } + } + + // Pokemon + // -------------------------------------------------------------------------------------------------- + // + + export interface Pokemon extends $.OutputObject { + name: 'Pokemon' + fields: { + __typename: Pokemon.__typename + attack: Pokemon.attack + birthday: Pokemon.birthday + defense: Pokemon.defense + hp: Pokemon.hp + id: Pokemon.id + name: Pokemon.name + trainer: Pokemon.trainer + type: Pokemon.type + } + } + + export namespace Pokemon { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Pokemon' + } + } + + export interface attack extends $.OutputField { + name: 'attack' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + + export interface birthday extends $.OutputField { + name: 'birthday' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } + + export interface defense extends $.OutputField { + name: 'defense' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } - export type BattleTrainer = $.OutputObject<'BattleTrainer', { - combatant1: $.OutputField<'combatant1', $.Nullable, null> - combatant2: $.OutputField<'combatant2', $.Nullable, null> - date: $.OutputField<'date', $.Nullable<$Scalar.Float>, null> - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - winner: $.OutputField<'winner', $.Nullable, null> - }> + export interface hp extends $.OutputField { + name: 'hp' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Int + } - export type BattleWild = $.OutputObject<'BattleWild', { - date: $.OutputField<'date', $.Nullable<$Scalar.Float>, null> - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - pokemon: $.OutputField<'pokemon', $.Nullable, null> - result: $.OutputField<'result', $.Nullable, null> - trainer: $.OutputField<'trainer', $.Nullable, null> - wildPokemons: $.OutputField<'wildPokemons', $.Nullable<$.List>, null> - }> + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } - export type CombatantMultiPokemon = $.OutputObject<'CombatantMultiPokemon', { - pokemons: $.OutputField<'pokemons', $.Nullable<$.List>, null> - trainer: $.OutputField<'trainer', $.Nullable, null> - }> + export interface name extends $.OutputField { + name: 'name' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$String + } - export type CombatantSinglePokemon = $.OutputObject<'CombatantSinglePokemon', { - pokemon: $.OutputField<'pokemon', $.Nullable, null> - trainer: $.OutputField<'trainer', $.Nullable, null> - }> + export interface trainer extends $.OutputField { + name: 'trainer' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$Trainer + } - export type Patron = $.OutputObject<'Patron', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - money: $.OutputField<'money', $.Nullable<$Scalar.Int>, null> - name: $.OutputField<'name', $.Nullable<$Scalar.String>, null> - }> + export interface type extends $.OutputField { + name: 'type' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$PokemonType + } + } + + // Trainer + // -------------------------------------------------------------------------------------------------- + // + + export interface Trainer extends $.OutputObject { + name: 'Trainer' + fields: { + __typename: Trainer.__typename + class: Trainer.$class + fans: Trainer.fans + id: Trainer.id + name: Trainer.name + pokemon: Trainer.pokemon + } + } + + export namespace Trainer { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Trainer' + } + } - export type Pokemon = $.OutputObject<'Pokemon', { - attack: $.OutputField<'attack', $.Nullable<$Scalar.Int>, null> - birthday: $.OutputField<'birthday', $.Nullable<$Scalar.Int>, null> - defense: $.OutputField<'defense', $.Nullable<$Scalar.Int>, null> - hp: $.OutputField<'hp', $.Nullable<$Scalar.Int>, null> - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - name: $.OutputField<'name', $.Nullable<$Scalar.String>, null> - trainer: $.OutputField<'trainer', $.Nullable, null> - type: $.OutputField<'type', $.Nullable, null> - }> + export interface $class extends $.OutputField { + name: 'class' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$TrainerClass + } - export type Trainer = $.OutputObject<'Trainer', { - class: $.OutputField<'class', $.Nullable, null> - fans: $.OutputField<'fans', $.Nullable<$.List>, null> - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - name: $.OutputField<'name', $.Nullable<$Scalar.String>, null> - pokemon: $.OutputField<'pokemon', $.Nullable<$.List>, null> - }> + export interface fans extends $.OutputField { + name: 'fans' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Patron + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface name extends $.OutputField { + name: 'name' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface pokemon extends $.OutputField { + name: 'pokemon' + arguments: {} + inlineType: [0, [1]] + namedType: $$NamedTypes.$$Pokemon + } + } // // @@ -153,20 +679,86 @@ export namespace Schema { // // - export type DateFilter = $.InputObject<'DateFilter', { - gte: $.InputField<$.Nullable<$Scalar.Float>> - lte: $.InputField<$.Nullable<$Scalar.Float>> - }, true> + // DateFilter + // -------------------------------------------------------------------------------------------------- + // - export type PokemonFilter = $.InputObject<'PokemonFilter', { - birthday: $.InputField<$.Nullable> - name: $.InputField<$.Nullable> - }, true> + export interface DateFilter extends $.InputObject { + name: 'DateFilter' + isAllFieldsNullable: true + fields: { + gte: DateFilter.gte + lte: DateFilter.lte + } + } - export type StringFilter = $.InputObject<'StringFilter', { - contains: $.InputField<$.Nullable<$Scalar.String>> - in: $.InputField<$.Nullable<$.List<$Scalar.String>>> - }, true> + export namespace DateFilter { + export interface gte extends $.InputField { + name: 'gte' + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + + export interface lte extends $.InputField { + name: 'lte' + inlineType: [0] + namedType: $$NamedTypes.$$Float + } + } + + // PokemonFilter + // -------------------------------------------------------------------------------------------------- + // + + export interface PokemonFilter extends $.InputObject { + name: 'PokemonFilter' + isAllFieldsNullable: true + fields: { + birthday: PokemonFilter.birthday + name: PokemonFilter.name + } + } + + export namespace PokemonFilter { + export interface birthday extends $.InputField { + name: 'birthday' + inlineType: [0] + namedType: $$NamedTypes.$$DateFilter + } + + export interface name extends $.InputField { + name: 'name' + inlineType: [0] + namedType: $$NamedTypes.$$StringFilter + } + } + + // StringFilter + // -------------------------------------------------------------------------------------------------- + // + + export interface StringFilter extends $.InputObject { + name: 'StringFilter' + isAllFieldsNullable: true + fields: { + contains: StringFilter.contains + in: StringFilter.$in + } + } + + export namespace StringFilter { + export interface contains extends $.InputField { + name: 'contains' + inlineType: [0] + namedType: $$NamedTypes.$$String + } + + export interface $in extends $.InputField { + name: 'in' + inlineType: [0, [1]] + namedType: $$NamedTypes.$$String + } + } // // @@ -184,10 +776,23 @@ export namespace Schema { // // - export type Being = $.Interface<'Being', { - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - name: $.OutputField<'name', $.Nullable<$Scalar.String>, null> - }, [Patron, Pokemon, Trainer]> + // Being + // -------------------------------------------------------------------------------------------------- + // + + export interface Being extends $.Interface { + name: 'Being' + implementors: [Patron, Pokemon, Trainer] + implementorsUnion: + | Patron + | Pokemon + | Trainer + implementorsIndex: { + Patron: Patron + Pokemon: Pokemon + Trainer: Trainer + } + } // // @@ -205,7 +810,23 @@ export namespace Schema { // // - export type Battle = $.Union<'Battle', [BattleRoyale, BattleTrainer, BattleWild]> + // Battle + // -------------------------------------------------------------------------------------------------- + // + + export interface Battle extends $.Union { + name: 'Battle' + members: [BattleRoyale, BattleTrainer, BattleWild] + membersUnion: + | BattleRoyale + | BattleTrainer + | BattleWild + membersIndex: { + BattleRoyale: BattleRoyale + BattleTrainer: BattleTrainer + BattleWild: BattleWild + } + } // // @@ -223,13 +844,41 @@ export namespace Schema { // // - export type BattleWildResult = $.Enum<'BattleWildResult', ['pokemonsCaptured', 'pokemonsDefeated', 'trainerDefeated']> + // BattleWildResult + // -------------------------------------------------------------------------------------------------- + // + + export interface BattleWildResult extends $.Enum { + name: 'BattleWildResult' + members: ['pokemonsCaptured', 'pokemonsDefeated', 'trainerDefeated'] + membersUnion: + | 'pokemonsCaptured' + | 'pokemonsDefeated' + | 'trainerDefeated' + } + + // PokemonType + // -------------------------------------------------------------------------------------------------- + // + + export interface PokemonType extends $.Enum { + name: 'PokemonType' + members: ['bug', 'electric', 'fire', 'grass', 'water'] + membersUnion: + | 'bug' + | 'electric' + | 'fire' + | 'grass' + | 'water' + } - export type PokemonType = $.Enum<'PokemonType', ['bug', 'electric', 'fire', 'grass', 'water']> + // TrainerClass + // -------------------------------------------------------------------------------------------------- + // - export type TrainerClass = $.Enum< - 'TrainerClass', - [ + export interface TrainerClass extends $.Enum { + name: 'TrainerClass' + members: [ 'bugCatcher', 'camper', 'picnicker', @@ -244,7 +893,133 @@ export namespace Schema { 'youngster', 'youth', ] - > + membersUnion: + | 'bugCatcher' + | 'camper' + | 'picnicker' + | 'psychic' + | 'psychicMedium' + | 'psychicYoungster' + | 'sailor' + | 'superNerd' + | 'tamer' + | 'teamRocketGrunt' + | 'triathlete' + | 'youngster' + | 'youth' + } + + // + // + // + // + // + // + // ================================================================================================== + // ScalarCustom + // ================================================================================================== + // + // + // + // + // + // + + // + // + // + // + // + // + // ================================================================================================== + // ScalarStandard + // ================================================================================================== + // + // + // + // + // + // + + // Boolean + // -------------------------------------------------------------------------------------------------- + // + + export type Boolean = $.StandardTypes.Boolean + + // Float + // -------------------------------------------------------------------------------------------------- + // + + export type Float = $.StandardTypes.Float + + // ID + // -------------------------------------------------------------------------------------------------- + // + + export type ID = $.StandardTypes.ID + + // Int + // -------------------------------------------------------------------------------------------------- + // + + export type Int = $.StandardTypes.Int + + // String + // -------------------------------------------------------------------------------------------------- + // + + export type String = $.StandardTypes.String + + // + // + // + // + // + // + // ================================================================================================== + // Named Types Index + // ================================================================================================== + // + // + // + // + // + // + + /** + * [1] These definitions serve to allow field selection interfaces to extend their respective object type without + * name clashing between the field name and the object name. + * + * For example imagine `Query.Foo` field with type also called `Foo`. Our generated interfaces for each field + * would end up with an error of `export interface Foo extends Foo ...` + */ + + namespace $$NamedTypes { + export type $$Mutation = Mutation + export type $$Query = Query + export type $$BattleRoyale = BattleRoyale + export type $$BattleTrainer = BattleTrainer + export type $$BattleWild = BattleWild + export type $$CombatantMultiPokemon = CombatantMultiPokemon + export type $$CombatantSinglePokemon = CombatantSinglePokemon + export type $$Patron = Patron + export type $$Pokemon = Pokemon + export type $$Trainer = Trainer + export type $$DateFilter = DateFilter + export type $$PokemonFilter = PokemonFilter + export type $$StringFilter = StringFilter + export type $$Being = Being + export type $$Battle = Battle + export type $$BattleWildResult = BattleWildResult + export type $$PokemonType = PokemonType + export type $$TrainerClass = TrainerClass + export type $$Boolean = Boolean + export type $$Float = Float + export type $$ID = ID + export type $$Int = Int + export type $$String = String + } } // @@ -262,7 +1037,8 @@ export namespace Schema { // // // -export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $$Utilities.Schema { + +export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $ { name: Data.Name RootTypesPresent: ['Mutation', 'Query'] RootUnion: Schema.Mutation | Schema.Query diff --git a/tests/_/schemas/pokemon/graffle/modules/SelectionSets.ts b/tests/_/schemas/pokemon/graffle/modules/SelectionSets.ts index 6af56c0a6..6d22da4a8 100644 --- a/tests/_/schemas/pokemon/graffle/modules/SelectionSets.ts +++ b/tests/_/schemas/pokemon/graffle/modules/SelectionSets.ts @@ -99,11 +99,17 @@ export namespace Mutation { $: addPokemon$Arguments<$Scalars> } - export interface addPokemon$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface addPokemon$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { attack?: number | undefined | null + defense?: number | undefined | null + hp?: number | undefined | null + name: string + $type: $NamedTypes.$PokemonType } @@ -262,7 +268,9 @@ export namespace Query { $: pokemonByName$Arguments<$Scalars> } - export interface pokemonByName$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface pokemonByName$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { name: string } @@ -290,7 +298,9 @@ export namespace Query { $?: pokemons$Arguments<$Scalars> } - export interface pokemons$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface pokemons$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { filter?: $NamedTypes.$PokemonFilter<$Scalars> | undefined | null } @@ -320,7 +330,9 @@ export namespace Query { $: trainerByName$Arguments<$Scalars> } - export interface trainerByName$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { + export interface trainerByName$Arguments<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> + extends $Select.Bases.Base + { name: string } @@ -408,16 +420,19 @@ export type TrainerClass = export interface DateFilter<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { gte?: number | undefined | null + lte?: number | undefined | null } export interface PokemonFilter<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { birthday?: $NamedTypes.$DateFilter<$Scalars> | undefined | null + name?: $NamedTypes.$StringFilter<$Scalars> | undefined | null } export interface StringFilter<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> { contains?: string | undefined | null + in?: Array | undefined | null } diff --git a/tests/_/schemas/query-only/graffle/modules/MethodsRoot.ts b/tests/_/schemas/query-only/graffle/modules/MethodsRoot.ts index d848429f0..4d073407d 100644 --- a/tests/_/schemas/query-only/graffle/modules/MethodsRoot.ts +++ b/tests/_/schemas/query-only/graffle/modules/MethodsRoot.ts @@ -24,6 +24,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + id: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.id<$Context['scalars']>>, ) => Promise< @@ -35,6 +36,7 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > > > + idNonNull: <$SelectionSet>( selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.idNonNull<$Context['scalars']>>, ) => Promise< diff --git a/tests/_/schemas/query-only/graffle/modules/Schema.ts b/tests/_/schemas/query-only/graffle/modules/Schema.ts index 6383aa11f..b393133de 100644 --- a/tests/_/schemas/query-only/graffle/modules/Schema.ts +++ b/tests/_/schemas/query-only/graffle/modules/Schema.ts @@ -3,6 +3,7 @@ import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-f import type * as Data from './Data.js' import type * as MethodsRoot from './MethodsRoot.js' import type * as $Scalar from './Scalar.js' + export namespace Schema { // // @@ -20,10 +21,44 @@ export namespace Schema { // // - export type Query = $.StandardTypes.Query<{ - id: $.OutputField<'id', $.Nullable<$Scalar.ID>, null> - idNonNull: $.OutputField<'idNonNull', $Scalar.ID, null> - }> + // Query + // -------------------------------------------------------------------------------------------------- + // + + export interface Query extends $.OutputObject { + name: 'Query' + fields: { + __typename: Query.__typename + id: Query.id + idNonNull: Query.idNonNull + } + } + + export namespace Query { + export interface __typename extends $.OutputField { + name: '__typename' + arguments: {} + inlineType: [1] + namedType: { + kind: '__typename' + value: 'Query' + } + } + + export interface id extends $.OutputField { + name: 'id' + arguments: {} + inlineType: [0] + namedType: $$NamedTypes.$$ID + } + + export interface idNonNull extends $.OutputField { + name: 'idNonNull' + arguments: {} + inlineType: [1] + namedType: $$NamedTypes.$$ID + } + } // // @@ -41,8 +76,6 @@ export namespace Schema { // // - // -- no types -- - // // // @@ -59,8 +92,6 @@ export namespace Schema { // // - // -- no types -- - // // // @@ -77,8 +108,6 @@ export namespace Schema { // // - // -- no types -- - // // // @@ -95,8 +124,6 @@ export namespace Schema { // // - // -- no types -- - // // // @@ -113,7 +140,100 @@ export namespace Schema { // // - // -- no types -- + // + // + // + // + // + // + // ================================================================================================== + // ScalarCustom + // ================================================================================================== + // + // + // + // + // + // + + // + // + // + // + // + // + // ================================================================================================== + // ScalarStandard + // ================================================================================================== + // + // + // + // + // + // + + // Boolean + // -------------------------------------------------------------------------------------------------- + // + + export type Boolean = $.StandardTypes.Boolean + + // Float + // -------------------------------------------------------------------------------------------------- + // + + export type Float = $.StandardTypes.Float + + // ID + // -------------------------------------------------------------------------------------------------- + // + + export type ID = $.StandardTypes.ID + + // Int + // -------------------------------------------------------------------------------------------------- + // + + export type Int = $.StandardTypes.Int + + // String + // -------------------------------------------------------------------------------------------------- + // + + export type String = $.StandardTypes.String + + // + // + // + // + // + // + // ================================================================================================== + // Named Types Index + // ================================================================================================== + // + // + // + // + // + // + + /** + * [1] These definitions serve to allow field selection interfaces to extend their respective object type without + * name clashing between the field name and the object name. + * + * For example imagine `Query.Foo` field with type also called `Foo`. Our generated interfaces for each field + * would end up with an error of `export interface Foo extends Foo ...` + */ + + namespace $$NamedTypes { + export type $$Query = Query + export type $$Boolean = Boolean + export type $$Float = Float + export type $$ID = ID + export type $$Int = Int + export type $$String = String + } } // @@ -131,7 +251,8 @@ export namespace Schema { // // // -export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $$Utilities.Schema { + +export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.ScalarMap = {}> extends $ { name: Data.Name RootTypesPresent: ['Query'] RootUnion: Schema.Query diff --git a/website/.vitepress/config.ts b/website/.vitepress/config.ts index cc78958de..13a55d07e 100644 --- a/website/.vitepress/config.ts +++ b/website/.vitepress/config.ts @@ -133,7 +133,7 @@ export default defineConfig({ ...sidebars, }, socialLinks: [ - { icon: 'github', link: 'https://github.com/jasonkuhrt/graffle' }, + { icon: 'github', link: 'https://github.com/graffle-js/graffle' }, ], }, }) diff --git a/website/.vitepress/theme/components/MyLayout.vue b/website/.vitepress/theme/components/MyLayout.vue index 241ac5e2f..49ae36022 100644 --- a/website/.vitepress/theme/components/MyLayout.vue +++ b/website/.vitepress/theme/components/MyLayout.vue @@ -6,7 +6,7 @@ const { Layout } = DefaultTheme diff --git a/website/content/_snippets/examples/gql/gql-string-typed.detail.md b/website/content/_snippets/examples/gql/gql-string-typed.detail.md index baf15977c..c468b452c 100644 --- a/website/content/_snippets/examples/gql/gql-string-typed.detail.md +++ b/website/content/_snippets/examples/gql/gql-string-typed.detail.md @@ -15,7 +15,7 @@ const graffle = Graffle.create({ * @remarks Typically this type would come from your code generation tool. * * @see https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#documentmode - * @see https://github.com/jasonkuhrt/graffle/issues/997 + * @see https://github.com/graffle-js/graffle/issues/997 */ type Document = TypedDocument.String< { diff --git a/website/content/_snippets/examples/gql/gql-string-typed.md b/website/content/_snippets/examples/gql/gql-string-typed.md index bf92a8445..628a1d598 100644 --- a/website/content/_snippets/examples/gql/gql-string-typed.md +++ b/website/content/_snippets/examples/gql/gql-string-typed.md @@ -13,7 +13,7 @@ const graffle = Graffle.create({ * @remarks Typically this type would come from your code generation tool. * * @see https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#documentmode - * @see https://github.com/jasonkuhrt/graffle/issues/997 + * @see https://github.com/graffle-js/graffle/issues/997 */ type Document = TypedDocument.String< { diff --git a/website/content/examples/01_about/pokemon-schema.md b/website/content/examples/01_about/pokemon-schema.md index e8e633693..b6e7af8d3 100644 --- a/website/content/examples/01_about/pokemon-schema.md +++ b/website/content/examples/01_about/pokemon-schema.md @@ -6,6 +6,6 @@ aside: false This is the GraphQL schema used in all examples throughout the Graffle documentation. It is provided here for reference. For example you may want to keep it open to the side as you study various examples to better understand their context. -You can find its implementation in the repo at [tests/_/schemas/pokemon/schema.ts](https://github.com/jasonkuhrt/graffle/tree/main/tests/_/schemas/pokemon/schema.ts). +You can find its implementation in the repo at [tests/_/schemas/pokemon/schema.ts](https://github.com/graffle-js/graffle/tree/main/tests/_/schemas/pokemon/schema.ts). <<< ../../../../tests/_/schemas/pokemon/graffle/schema.graphql diff --git a/website/content/examples/30_gql/gql-string-typed.md b/website/content/examples/30_gql/gql-string-typed.md index f61d17b7c..593aa5958 100644 --- a/website/content/examples/30_gql/gql-string-typed.md +++ b/website/content/examples/30_gql/gql-string-typed.md @@ -20,7 +20,7 @@ const graffle = Graffle.create({ * @remarks Typically this type would come from your code generation tool. * * @see https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#documentmode - * @see https://github.com/jasonkuhrt/graffle/issues/997 + * @see https://github.com/graffle-js/graffle/issues/997 */ type Document = TypedDocument.String< { diff --git a/website/content/examples/index.md b/website/content/examples/index.md index 88b1eb732..f409884b7 100644 --- a/website/content/examples/index.md +++ b/website/content/examples/index.md @@ -6,7 +6,7 @@ Welcome to Graffle's collection of examples. Here you will find an assortment of 2. [Twoslash](https://twoslash.netlify.app) is used so take advantage! Hover over code parts to see their types. This also gives you access to JSDoc which Graffle uses. You will find useful details in it, at a resolution that is not covered in the website docs. -3. The source code for all examples can be found in the Graffle repository [here](https://github.com/jasonkuhrt/graffle/tree/main/examples). You can try any example out locally instantly by simply running: +3. The source code for all examples can be found in the Graffle repository [here](https://github.com/graffle-js/graffle/tree/main/examples). You can try any example out locally instantly by simply running: ```sh npx graffle try diff --git a/website/content/guides/20_methods/40_batch.md b/website/content/guides/20_methods/40_batch.md index cbc0be14e..7c1fedae3 100644 --- a/website/content/guides/20_methods/40_batch.md +++ b/website/content/guides/20_methods/40_batch.md @@ -6,7 +6,7 @@ The `$batch` method appears on the client interface for every root type in the G > [!Note] > This is not the same thing as [request batching](https://the-guild.dev/graphql/yoga-server/docs/features/request-batching). -> That is a feature [Graffle does not yet support](https://github.com/jasonkuhrt/graffle/issues/1017). +> That is a feature [Graffle does not yet support](https://github.com/graffle-js/graffle/issues/1017). For example the [pokemon schema](../../examples/01_about/pokemon-schema.md) has these two root fields: