From 0d4534cc6ad8260a8980dc6115cfcd4d88b83c44 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Sun, 27 Oct 2024 12:45:11 -0400 Subject: [PATCH] feat(generator): allow controling case of generated client (#1229) --- .../transport-http_method-get.ts | 2 +- package.json | 2 +- pnpm-lock.yaml | 6 +- src/documentBuilder/InferResult/__.test-d.ts | 4 +- .../SelectGraphQLMapper/toGraphQL.test.ts | 4 +- src/extensions/CustomScalars/encode.test.ts | 2 +- .../SchemaErrors/tests/fixture/graffle/_.ts | 10 +- .../tests/fixture/graffle/modules/Client.ts | 5 - .../tests/fixture/graffle/modules/Global.ts | 22 - .../graffle/modules/MethodsDocument.ts | 19 - .../tests/fixture/graffle/modules/Select.ts | 158 ------ .../tests/fixture/graffle/modules/client.ts | 4 + .../graffle/modules/{Data.ts => data.ts} | 0 .../tests/fixture/graffle/modules/global.ts | 22 + .../graffle/modules/methods-document.ts | 20 + .../{MethodsRoot.ts => methods-root.ts} | 232 ++++---- .../{MethodsSelect.ts => methods-select.ts} | 48 +- .../graffle/modules/{Scalar.ts => scalar.ts} | 0 ...enDataMap.ts => schema-driven-data-map.ts} | 12 +- .../graffle/modules/{Schema.ts => schema.ts} | 8 +- .../tests/fixture/graffle/modules/select.ts | 166 ++++++ .../{SelectionSets.ts => selection-sets.ts} | 0 src/generator/cli/generate.ts | 10 +- src/generator/config/config.ts | 36 +- src/generator/config/defaults.ts | 4 + src/generator/config/input.ts | 24 +- .../__snapshots__/generate.test.ts.snap | 536 +++++++++--------- src/generator/generator/generate.test.ts | 4 +- src/generator/generator/generate.ts | 4 +- src/generator/generators/Client.ts | 12 +- src/generator/generators/MethodsDocument.ts | 35 +- src/generator/generators/MethodsRoot.ts | 14 +- src/generator/generators/MethodsSelect.ts | 17 +- src/generator/generators/Scalar.ts | 6 +- src/generator/generators/Schema.ts | 28 +- .../generators/SchemaDrivenDataMap.ts | 8 +- src/generator/generators/Select.ts | 31 +- .../generators/SelectionSets.test-d.ts | 2 +- src/generator/generators/SelectionSets.ts | 16 +- src/generator/generators/_.ts | 27 +- src/generator/generators/__.ts | 4 +- src/generator/generators/global.ts | 24 +- src/generator/helpers/helpers.ts | 0 src/generator/helpers/identifiers.ts | 13 +- src/generator/helpers/moduleGenerator.ts | 31 + src/lib/Code.ts | 16 +- tests/_/schemas/generate.ts | 2 +- tests/_/schemas/kitchen-sink/graffle/_.ts | 10 +- .../kitchen-sink/graffle/modules/Client.ts | 5 - .../kitchen-sink/graffle/modules/Global.ts | 22 - .../graffle/modules/MethodsDocument.ts | 19 - .../kitchen-sink/graffle/modules/Select.ts | 158 ------ .../kitchen-sink/graffle/modules/client.ts | 4 + .../graffle/modules/{Data.ts => data.ts} | 0 .../kitchen-sink/graffle/modules/global.ts | 22 + .../graffle/modules/methods-document.ts | 20 + .../{MethodsRoot.ts => methods-root.ts} | 232 ++++---- .../{MethodsSelect.ts => methods-select.ts} | 48 +- .../graffle/modules/{Scalar.ts => scalar.ts} | 0 ...enDataMap.ts => schema-driven-data-map.ts} | 12 +- .../graffle/modules/{Schema.ts => schema.ts} | 8 +- .../kitchen-sink/graffle/modules/select.ts | 166 ++++++ .../{SelectionSets.ts => selection-sets.ts} | 0 tests/_/schemas/mutation-only/graffle/_.ts | 10 +- .../mutation-only/graffle/modules/Client.ts | 5 - .../mutation-only/graffle/modules/Global.ts | 22 - .../graffle/modules/MethodsDocument.ts | 19 - .../graffle/modules/RuntimeCustomScalars.ts | 153 ----- .../mutation-only/graffle/modules/client.ts | 4 + .../graffle/modules/{Data.ts => data.ts} | 0 .../mutation-only/graffle/modules/global.ts | 22 + .../graffle/modules/methods-document.ts | 20 + .../{MethodsRoot.ts => methods-root.ts} | 16 +- .../{MethodsSelect.ts => methods-select.ts} | 6 +- .../graffle/modules/{Scalar.ts => scalar.ts} | 0 ...enDataMap.ts => schema-driven-data-map.ts} | 12 +- .../graffle/modules/{Schema.ts => schema.ts} | 6 +- .../graffle/modules/{Select.ts => select.ts} | 12 +- .../{SelectionSets.ts => selection-sets.ts} | 0 tests/_/schemas/pokemon/graffle/_.ts | 10 +- .../schemas/pokemon/graffle/modules/Client.ts | 5 - .../schemas/pokemon/graffle/modules/Global.ts | 25 - .../graffle/modules/MethodsDocument.ts | 19 - .../graffle/modules/RuntimeCustomScalars.ts | 381 ------------- .../schemas/pokemon/graffle/modules/Select.ts | 108 ---- .../schemas/pokemon/graffle/modules/client.ts | 4 + .../graffle/modules/{Data.ts => data.ts} | 0 .../schemas/pokemon/graffle/modules/global.ts | 25 + .../graffle/modules/methods-document.ts | 20 + .../{MethodsRoot.ts => methods-root.ts} | 44 +- .../{MethodsSelect.ts => methods-select.ts} | 28 +- .../graffle/modules/{Scalar.ts => scalar.ts} | 0 ...enDataMap.ts => schema-driven-data-map.ts} | 12 +- .../graffle/modules/{Schema.ts => schema.ts} | 8 +- .../schemas/pokemon/graffle/modules/select.ts | 108 ++++ .../{SelectionSets.ts => selection-sets.ts} | 0 tests/_/schemas/query-only/graffle/_.ts | 10 +- .../query-only/graffle/modules/Client.ts | 5 - .../query-only/graffle/modules/Global.ts | 22 - .../graffle/modules/MethodsDocument.ts | 19 - .../graffle/modules/RuntimeCustomScalars.ts | 153 ----- .../query-only/graffle/modules/client.ts | 4 + .../graffle/modules/{Data.ts => data.ts} | 0 .../query-only/graffle/modules/global.ts | 22 + .../graffle/modules/methods-document.ts | 20 + .../{MethodsRoot.ts => methods-root.ts} | 16 +- .../{MethodsSelect.ts => methods-select.ts} | 6 +- .../graffle/modules/{Scalar.ts => scalar.ts} | 0 ...enDataMap.ts => schema-driven-data-map.ts} | 12 +- .../graffle/modules/{Schema.ts => schema.ts} | 6 +- .../graffle/modules/{Select.ts => select.ts} | 12 +- .../{SelectionSets.ts => selection-sets.ts} | 0 website/graffle/_.ts | 10 +- website/graffle/modules/Client.ts | 7 +- website/graffle/modules/Global.ts | 20 +- website/graffle/modules/MethodsDocument.ts | 19 - website/graffle/modules/Schema.ts | 6 +- website/graffle/modules/SchemaRuntime.ts | 154 ----- website/graffle/modules/Select.ts | 42 +- website/graffle/modules/methods-document.ts | 20 + .../{MethodsRoot.ts => methods-root.ts} | 32 +- .../{MethodsSelect.ts => methods-select.ts} | 16 +- ...enDataMap.ts => schema-driven-data-map.ts} | 12 +- .../{SelectionSets.ts => selection-sets.ts} | 0 website/pokemon/_.ts | 10 +- website/pokemon/modules/Client.ts | 7 +- website/pokemon/modules/Global.ts | 20 +- website/pokemon/modules/MethodsDocument.ts | 19 - .../pokemon/modules/RuntimeCustomScalars.ts | 108 ---- website/pokemon/modules/Schema.ts | 8 +- website/pokemon/modules/SchemaRuntime.ts | 228 -------- website/pokemon/modules/Select.ts | 72 +-- website/pokemon/modules/methods-document.ts | 20 + .../{MethodsRoot.ts => methods-root.ts} | 44 +- .../{MethodsSelect.ts => methods-select.ts} | 30 +- ...enDataMap.ts => schema-driven-data-map.ts} | 12 +- .../{SelectionSets.ts => selection-sets.ts} | 0 137 files changed, 1837 insertions(+), 2866 deletions(-) delete mode 100644 src/extensions/SchemaErrors/tests/fixture/graffle/modules/Client.ts delete mode 100644 src/extensions/SchemaErrors/tests/fixture/graffle/modules/Global.ts delete mode 100644 src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsDocument.ts delete mode 100644 src/extensions/SchemaErrors/tests/fixture/graffle/modules/Select.ts create mode 100644 src/extensions/SchemaErrors/tests/fixture/graffle/modules/client.ts rename src/extensions/SchemaErrors/tests/fixture/graffle/modules/{Data.ts => data.ts} (100%) create mode 100644 src/extensions/SchemaErrors/tests/fixture/graffle/modules/global.ts create mode 100644 src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-document.ts rename src/extensions/SchemaErrors/tests/fixture/graffle/modules/{MethodsRoot.ts => methods-root.ts} (59%) rename src/extensions/SchemaErrors/tests/fixture/graffle/modules/{MethodsSelect.ts => methods-select.ts} (54%) rename src/extensions/SchemaErrors/tests/fixture/graffle/modules/{Scalar.ts => scalar.ts} (100%) rename src/extensions/SchemaErrors/tests/fixture/graffle/modules/{SchemaDrivenDataMap.ts => schema-driven-data-map.ts} (98%) rename src/extensions/SchemaErrors/tests/fixture/graffle/modules/{Schema.ts => schema.ts} (99%) create mode 100644 src/extensions/SchemaErrors/tests/fixture/graffle/modules/select.ts rename src/extensions/SchemaErrors/tests/fixture/graffle/modules/{SelectionSets.ts => selection-sets.ts} (100%) create mode 100644 src/generator/helpers/helpers.ts delete mode 100644 tests/_/schemas/kitchen-sink/graffle/modules/Client.ts delete mode 100644 tests/_/schemas/kitchen-sink/graffle/modules/Global.ts delete mode 100644 tests/_/schemas/kitchen-sink/graffle/modules/MethodsDocument.ts delete mode 100644 tests/_/schemas/kitchen-sink/graffle/modules/Select.ts create mode 100644 tests/_/schemas/kitchen-sink/graffle/modules/client.ts rename tests/_/schemas/kitchen-sink/graffle/modules/{Data.ts => data.ts} (100%) create mode 100644 tests/_/schemas/kitchen-sink/graffle/modules/global.ts create mode 100644 tests/_/schemas/kitchen-sink/graffle/modules/methods-document.ts rename tests/_/schemas/kitchen-sink/graffle/modules/{MethodsRoot.ts => methods-root.ts} (59%) rename tests/_/schemas/kitchen-sink/graffle/modules/{MethodsSelect.ts => methods-select.ts} (53%) rename tests/_/schemas/kitchen-sink/graffle/modules/{Scalar.ts => scalar.ts} (100%) rename tests/_/schemas/kitchen-sink/graffle/modules/{SchemaDrivenDataMap.ts => schema-driven-data-map.ts} (98%) rename tests/_/schemas/kitchen-sink/graffle/modules/{Schema.ts => schema.ts} (99%) create mode 100644 tests/_/schemas/kitchen-sink/graffle/modules/select.ts rename tests/_/schemas/kitchen-sink/graffle/modules/{SelectionSets.ts => selection-sets.ts} (100%) delete mode 100644 tests/_/schemas/mutation-only/graffle/modules/Client.ts delete mode 100644 tests/_/schemas/mutation-only/graffle/modules/Global.ts delete mode 100644 tests/_/schemas/mutation-only/graffle/modules/MethodsDocument.ts delete mode 100644 tests/_/schemas/mutation-only/graffle/modules/RuntimeCustomScalars.ts create mode 100644 tests/_/schemas/mutation-only/graffle/modules/client.ts rename tests/_/schemas/mutation-only/graffle/modules/{Data.ts => data.ts} (100%) create mode 100644 tests/_/schemas/mutation-only/graffle/modules/global.ts create mode 100644 tests/_/schemas/mutation-only/graffle/modules/methods-document.ts rename tests/_/schemas/mutation-only/graffle/modules/{MethodsRoot.ts => methods-root.ts} (66%) rename tests/_/schemas/mutation-only/graffle/modules/{MethodsSelect.ts => methods-select.ts} (85%) rename tests/_/schemas/mutation-only/graffle/modules/{Scalar.ts => scalar.ts} (100%) rename tests/_/schemas/mutation-only/graffle/modules/{SchemaDrivenDataMap.ts => schema-driven-data-map.ts} (95%) rename tests/_/schemas/mutation-only/graffle/modules/{Schema.ts => schema.ts} (98%) rename tests/_/schemas/mutation-only/graffle/modules/{Select.ts => select.ts} (83%) rename tests/_/schemas/mutation-only/graffle/modules/{SelectionSets.ts => selection-sets.ts} (100%) delete mode 100644 tests/_/schemas/pokemon/graffle/modules/Client.ts delete mode 100644 tests/_/schemas/pokemon/graffle/modules/Global.ts delete mode 100644 tests/_/schemas/pokemon/graffle/modules/MethodsDocument.ts delete mode 100644 tests/_/schemas/pokemon/graffle/modules/RuntimeCustomScalars.ts delete mode 100644 tests/_/schemas/pokemon/graffle/modules/Select.ts create mode 100644 tests/_/schemas/pokemon/graffle/modules/client.ts rename tests/_/schemas/pokemon/graffle/modules/{Data.ts => data.ts} (100%) create mode 100644 tests/_/schemas/pokemon/graffle/modules/global.ts create mode 100644 tests/_/schemas/pokemon/graffle/modules/methods-document.ts rename tests/_/schemas/pokemon/graffle/modules/{MethodsRoot.ts => methods-root.ts} (62%) rename tests/_/schemas/pokemon/graffle/modules/{MethodsSelect.ts => methods-select.ts} (60%) rename tests/_/schemas/pokemon/graffle/modules/{Scalar.ts => scalar.ts} (100%) rename tests/_/schemas/pokemon/graffle/modules/{SchemaDrivenDataMap.ts => schema-driven-data-map.ts} (98%) rename tests/_/schemas/pokemon/graffle/modules/{Schema.ts => schema.ts} (99%) create mode 100644 tests/_/schemas/pokemon/graffle/modules/select.ts rename tests/_/schemas/pokemon/graffle/modules/{SelectionSets.ts => selection-sets.ts} (100%) delete mode 100644 tests/_/schemas/query-only/graffle/modules/Client.ts delete mode 100644 tests/_/schemas/query-only/graffle/modules/Global.ts delete mode 100644 tests/_/schemas/query-only/graffle/modules/MethodsDocument.ts delete mode 100644 tests/_/schemas/query-only/graffle/modules/RuntimeCustomScalars.ts create mode 100644 tests/_/schemas/query-only/graffle/modules/client.ts rename tests/_/schemas/query-only/graffle/modules/{Data.ts => data.ts} (100%) create mode 100644 tests/_/schemas/query-only/graffle/modules/global.ts create mode 100644 tests/_/schemas/query-only/graffle/modules/methods-document.ts rename tests/_/schemas/query-only/graffle/modules/{MethodsRoot.ts => methods-root.ts} (67%) rename tests/_/schemas/query-only/graffle/modules/{MethodsSelect.ts => methods-select.ts} (86%) rename tests/_/schemas/query-only/graffle/modules/{Scalar.ts => scalar.ts} (100%) rename tests/_/schemas/query-only/graffle/modules/{SchemaDrivenDataMap.ts => schema-driven-data-map.ts} (95%) rename tests/_/schemas/query-only/graffle/modules/{Schema.ts => schema.ts} (98%) rename tests/_/schemas/query-only/graffle/modules/{Select.ts => select.ts} (84%) rename tests/_/schemas/query-only/graffle/modules/{SelectionSets.ts => selection-sets.ts} (100%) delete mode 100644 website/graffle/modules/MethodsDocument.ts delete mode 100644 website/graffle/modules/SchemaRuntime.ts create mode 100644 website/graffle/modules/methods-document.ts rename website/graffle/modules/{MethodsRoot.ts => methods-root.ts} (64%) rename website/graffle/modules/{MethodsSelect.ts => methods-select.ts} (70%) rename website/graffle/modules/{SchemaDrivenDataMap.ts => schema-driven-data-map.ts} (97%) rename website/graffle/modules/{SelectionSets.ts => selection-sets.ts} (100%) delete mode 100644 website/pokemon/modules/MethodsDocument.ts delete mode 100644 website/pokemon/modules/RuntimeCustomScalars.ts delete mode 100644 website/pokemon/modules/SchemaRuntime.ts create mode 100644 website/pokemon/modules/methods-document.ts rename website/pokemon/modules/{MethodsRoot.ts => methods-root.ts} (62%) rename website/pokemon/modules/{MethodsSelect.ts => methods-select.ts} (60%) rename website/pokemon/modules/{SchemaDrivenDataMap.ts => schema-driven-data-map.ts} (98%) rename website/pokemon/modules/{SelectionSets.ts => selection-sets.ts} (100%) diff --git a/examples/10_transport-http/transport-http_method-get.ts b/examples/10_transport-http/transport-http_method-get.ts index 984a752b5..333202d42 100644 --- a/examples/10_transport-http/transport-http_method-get.ts +++ b/examples/10_transport-http/transport-http_method-get.ts @@ -15,7 +15,7 @@ const graffle = Pokemon }) .anyware(async ({ exchange }) => { show(exchange.input.request) - return exchange() + return await exchange() }) // The following request will use an HTTP POST method because it is diff --git a/package.json b/package.json index 3db2f0057..c616864e8 100644 --- a/package.json +++ b/package.json @@ -126,6 +126,7 @@ "dependencies": { "@graphql-typed-document-node/core": "^3.2.0", "@molt/command": "^0.9.0", + "es-toolkit": "^1.26.1", "is-plain-obj": "^4.1.0" }, "peerDependencies": { @@ -171,7 +172,6 @@ "doctoc": "^2.2.1", "dprint": "^0.47.4", "dripip": "^0.10.0", - "es-toolkit": "^1.26.1", "eslint": "^9.13.0", "eslint-config-prisma": "^0.6.0", "eslint-plugin-deprecation": "^3.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0d885b638..0a70edee0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@molt/command': specifier: ^0.9.0 version: 0.9.0 + es-toolkit: + specifier: ^1.26.1 + version: 1.26.1 is-plain-obj: specifier: ^4.1.0 version: 4.1.0 @@ -81,9 +84,6 @@ importers: dripip: specifier: ^0.10.0 version: 0.10.0 - es-toolkit: - specifier: ^1.26.1 - version: 1.26.1 eslint: specifier: ^9.13.0 version: 9.13.0 diff --git a/src/documentBuilder/InferResult/__.test-d.ts b/src/documentBuilder/InferResult/__.test-d.ts index f9e2bc8bb..5a53e2cb9 100644 --- a/src/documentBuilder/InferResult/__.test-d.ts +++ b/src/documentBuilder/InferResult/__.test-d.ts @@ -1,7 +1,7 @@ import type { Date } from '../../../tests/_/fixtures/scalars.js' import type { db } from '../../../tests/_/schemas/db.js' -import type { Schema } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/Schema.js' -import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.js' +import type { Schema } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/schema.js' +import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/selection-sets.js' import { assertEqual } from '../../lib/assert-equal.js' import type { Registry } from '../../types/Schema/nodes/Scalar/helpers.js' import type { InferResult } from './__.js' diff --git a/src/documentBuilder/SelectGraphQLMapper/toGraphQL.test.ts b/src/documentBuilder/SelectGraphQLMapper/toGraphQL.test.ts index 53436d712..9eb424505 100644 --- a/src/documentBuilder/SelectGraphQLMapper/toGraphQL.test.ts +++ b/src/documentBuilder/SelectGraphQLMapper/toGraphQL.test.ts @@ -1,8 +1,8 @@ import { expect, test } from 'vitest' import { Date } from '../../../tests/_/fixtures/scalars.js' import { db } from '../../../tests/_/schemas/db.js' -import { schemaDrivenDataMap } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SchemaDrivenDataMap.js' -import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.js' +import { schemaDrivenDataMap } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/schema-driven-data-map.js' +import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/selection-sets.js' import { Grafaid } from '../../lib/grafaid/__.js' import type { Schema } from '../../types/Schema/__.js' import { Select } from '../Select/__.js' diff --git a/src/extensions/CustomScalars/encode.test.ts b/src/extensions/CustomScalars/encode.test.ts index e28df0d03..ef66225f0 100644 --- a/src/extensions/CustomScalars/encode.test.ts +++ b/src/extensions/CustomScalars/encode.test.ts @@ -3,7 +3,7 @@ import { Date } from '../../../tests/_/fixtures/scalars.js' import { test } from '../../../tests/_/helpers.js' import { db } from '../../../tests/_/schemas/db.js' import type { Graffle } from '../../../tests/_/schemas/kitchen-sink/graffle/__.js' -import { schemaDrivenDataMap } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SchemaDrivenDataMap.js' +import { schemaDrivenDataMap } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/schema-driven-data-map.js' import { Spy } from '../../../tests/_/SpyExtension.js' import { Select } from '../../documentBuilder/Select/__.js' import { SelectionSetGraphqlMapper } from '../../documentBuilder/SelectGraphQLMapper/__.js' diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/_.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/_.ts index d27e9e3d3..260860931 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/_.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/_.ts @@ -2,9 +2,9 @@ // It at least helps with Twoslash wherein without this import here Twoslash will not include the global module. // In real TypeScript projects it seems the global module is included automatically. But there could be certain tsconfig // setups where this still indeed does help. -import './modules/Global.js' +import './modules/global.js' -export { create } from './modules/Client.js' -export { schemaDrivenDataMap } from './modules/SchemaDrivenDataMap.js' -export { Select } from './modules/Select.js' -export * as SelectionSets from './modules/SelectionSets.js' +export { create } from './modules/client.js' +export { schemaDrivenDataMap } from './modules/schema-driven-data-map.js' +export { Select } from './modules/select.js' +export * as SelectionSets from './modules/selection-sets.js' diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Client.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Client.ts deleted file mode 100644 index 86b18f2a1..000000000 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Client.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createPrefilled } from '../../../../../../entrypoints/client.js' -import { defaultSchemaUrl } from './Data.js' -import { Name } from './Data.js' -import { schemaDrivenDataMap } from './SchemaDrivenDataMap.js' -export const create = createPrefilled(Name, schemaDrivenDataMap, defaultSchemaUrl) diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Global.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Global.ts deleted file mode 100644 index 67de0d545..000000000 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Global.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type * as Data from './Data.js' -import type * as MethodsDocument from './MethodsDocument.js' -import type * as MethodsRoot from './MethodsRoot.js' -import type * as MethodsSelect from './MethodsSelect.js' -import type { Schema } from './Schema.js' - -declare global { - export namespace GraffleGlobal { - export interface Clients { - GraffleSchemaErrors: { - name: Data.Name - schema: Schema - interfaces: { - MethodsSelect: MethodsSelect.$MethodsSelect - Document: MethodsDocument.BuilderMethodsDocumentFn - Root: MethodsRoot.BuilderMethodsRootFn - } - defaultSchemaUrl: null - } - } - } -} diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsDocument.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsDocument.ts deleted file mode 100644 index b40a5a23c..000000000 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsDocument.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type * as Utilities from '../../../../../../entrypoints/utilities-for-generated.js' -import type { Schema } from './Schema.js' -import type * as SelectionSets from './SelectionSets.js' -export interface Document<$Context extends Utilities.ClientContext> { - <$Document>( - document: Utilities.ExactNonEmpty<$Document, SelectionSets.$Document<$Context['scalars']>>, - ): Utilities.DocumentRunner< - $Context, - Schema, - // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as - // Satisfying the constraint on the DocumentRunner type. - $Document - > -} - -export interface BuilderMethodsDocumentFn extends Utilities.TypeFunction.Fn { - // @ts-expect-error parameter is Untyped. - return: Document -} diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Select.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Select.ts deleted file mode 100644 index ce6a778a2..000000000 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Select.ts +++ /dev/null @@ -1,158 +0,0 @@ -import type { OperationTypeNode } from 'graphql' -import type { InferResult } from '../../../../../../entrypoints/schema.js' -import * as Data from './Data.js' -import type { Schema } from './Schema.js' -import type * as SelectionSets from './SelectionSets.js' - -// -// -// -// -// -// -// ================================================================================================== -// Runtime -// ================================================================================================== -// -// -// -// -// -// -import { createSelect } from '../../../../../../entrypoints/client.js' -export const Select = createSelect(Data.Name) - -// -// -// -// -// -// -// ================================================================================================== -// Buildtime -// ================================================================================================== -// -// -// -// -// -// - -export namespace Select { - // Root - // -------------------------------------------------------------------------------------------------- - // - export type Query<$SelectionSet extends SelectionSets.Query> = InferResult.Operation< - $SelectionSet, - Schema, - OperationTypeNode.QUERY - > - export type Mutation<$SelectionSet extends SelectionSets.Mutation> = InferResult.Operation< - $SelectionSet, - Schema, - OperationTypeNode.MUTATION - > - // OutputObject - // -------------------------------------------------------------------------------------------------- - // - export type Bar<$SelectionSet extends SelectionSets.Bar> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['Bar'] - > - export type DateObject1<$SelectionSet extends SelectionSets.DateObject1> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['DateObject1'] - > - export type DateObject2<$SelectionSet extends SelectionSets.DateObject2> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['DateObject2'] - > - export type ErrorOne<$SelectionSet extends SelectionSets.ErrorOne> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['ErrorOne'] - > - export type ErrorTwo<$SelectionSet extends SelectionSets.ErrorTwo> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['ErrorTwo'] - > - export type Foo<$SelectionSet extends SelectionSets.Foo> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['Foo'] - > - export type Object1<$SelectionSet extends SelectionSets.Object1> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['Object1'] - > - export type Object1ImplementingInterface<$SelectionSet extends SelectionSets.Object1ImplementingInterface> = - InferResult.OutputObject<$SelectionSet, Schema, Schema['allTypes']['Object1ImplementingInterface']> - export type Object2ImplementingInterface<$SelectionSet extends SelectionSets.Object2ImplementingInterface> = - InferResult.OutputObject<$SelectionSet, Schema, Schema['allTypes']['Object2ImplementingInterface']> - export type ObjectNested<$SelectionSet extends SelectionSets.ObjectNested> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['ObjectNested'] - > - export type ObjectUnion<$SelectionSet extends SelectionSets.ObjectUnion> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['ObjectUnion'] - > - export type lowerCaseObject<$SelectionSet extends SelectionSets.lowerCaseObject> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['lowerCaseObject'] - > - export type lowerCaseObject2<$SelectionSet extends SelectionSets.lowerCaseObject2> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['lowerCaseObject2'] - > - // Union - // -------------------------------------------------------------------------------------------------- - // - export type DateUnion<$SelectionSet extends SelectionSets.DateUnion> = InferResult.Union< - $SelectionSet, - Schema, - Schema['allTypes']['DateUnion'] - > - export type FooBarUnion<$SelectionSet extends SelectionSets.FooBarUnion> = InferResult.Union< - $SelectionSet, - Schema, - Schema['allTypes']['FooBarUnion'] - > - export type Result<$SelectionSet extends SelectionSets.Result> = InferResult.Union< - $SelectionSet, - Schema, - Schema['allTypes']['Result'] - > - export type lowerCaseUnion<$SelectionSet extends SelectionSets.lowerCaseUnion> = InferResult.Union< - $SelectionSet, - Schema, - Schema['allTypes']['lowerCaseUnion'] - > - // Interface - // -------------------------------------------------------------------------------------------------- - // - export type DateInterface1<$SelectionSet extends SelectionSets.DateInterface1> = InferResult.Interface< - $SelectionSet, - Schema, - Schema['allTypes']['DateInterface1'] - > - export type Error<$SelectionSet extends SelectionSets.Error> = InferResult.Interface< - $SelectionSet, - Schema, - Schema['allTypes']['Error'] - > - export type Interface<$SelectionSet extends SelectionSets.Interface> = InferResult.Interface< - $SelectionSet, - Schema, - Schema['allTypes']['Interface'] - > -} diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/client.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/client.ts new file mode 100644 index 000000000..835ef291e --- /dev/null +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/client.ts @@ -0,0 +1,4 @@ +import { createPrefilled } from '../../../../../../entrypoints/client.js' +import * as $$Data from './data.js' +import * as $$SchemaDrivenDataMap from './schema-driven-data-map.js' +export const create = createPrefilled($$Data.Name, $$SchemaDrivenDataMap.schemaDrivenDataMap, $$Data.defaultSchemaUrl) diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Data.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/data.ts similarity index 100% rename from src/extensions/SchemaErrors/tests/fixture/graffle/modules/Data.ts rename to src/extensions/SchemaErrors/tests/fixture/graffle/modules/data.ts diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/global.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/global.ts new file mode 100644 index 000000000..9cbdeae45 --- /dev/null +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/global.ts @@ -0,0 +1,22 @@ +import * as $$Data from './data.js' +import * as $$MethodsDocument from './methods-document.js' +import * as $$MethodsRoot from './methods-root.js' +import * as $$MethodsSelect from './methods-select.js' +import * as $$Schema from './schema.js' + +declare global { + export namespace GraffleGlobal { + export interface Clients { + GraffleSchemaErrors: { + name: $$Data.Name + schema: $$Schema.Schema + interfaces: { + MethodsSelect: $$MethodsSelect.$MethodsSelect + Document: $$MethodsDocument.BuilderMethodsDocumentFn + Root: $$MethodsRoot.BuilderMethodsRootFn + } + defaultSchemaUrl: null + } + } + } +} diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-document.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-document.ts new file mode 100644 index 000000000..6b2021469 --- /dev/null +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-document.ts @@ -0,0 +1,20 @@ +import type * as $$Utilities from '../../../../../../entrypoints/utilities-for-generated.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' + +export interface Document<$Context extends $$Utilities.ClientContext> { + <$Document>( + document: $$Utilities.ExactNonEmpty<$Document, $$SelectionSets.$Document<$Context['scalars']>>, + ): $$Utilities.DocumentRunner< + $Context, + $$Schema.Schema, + // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as + // Satisfying the constraint on the DocumentRunner type. + $Document + > +} + +export interface BuilderMethodsDocumentFn extends $$Utilities.TypeFunction.Fn { + // @ts-expect-error parameter is Untyped. + return: Document +} diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsRoot.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-root.ts similarity index 59% rename from src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsRoot.ts rename to src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-root.ts index 58bf3998f..3ce8ccc72 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsRoot.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-root.ts @@ -1,16 +1,16 @@ import type { InferResult } from '../../../../../../entrypoints/schema.js' import type * as $$Utilities from '../../../../../../entrypoints/utilities-for-generated.js' -import type { Schema } from './Schema.js' -import type * as SelectionSet from './SelectionSets.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' export interface QueryMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationQuery<$SelectionSet, Schema<$Context['scalars']>> + InferResult.OperationQuery<$SelectionSet, $$Schema.Schema<$Context['scalars']>> > > > @@ -25,24 +25,24 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > InputObjectNested: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.InputObjectNested<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.InputObjectNested<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ InputObjectNested: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ InputObjectNested: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'InputObjectNested' > > > InputObjectNestedNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.InputObjectNestedNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.InputObjectNestedNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ InputObjectNestedNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ InputObjectNestedNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'InputObjectNestedNonNull' > > @@ -51,456 +51,462 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { * Query enum field documentation. */ abcEnum: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.abcEnum<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.abcEnum<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ abcEnum: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ abcEnum: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'abcEnum' > > > argInputObjectCircular: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.argInputObjectCircular<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.argInputObjectCircular<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ argInputObjectCircular: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ argInputObjectCircular: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'argInputObjectCircular' > > > date: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.date<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.date<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ date: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ date: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'date' > > > dateArg: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArg<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArg<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArg: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArg: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArg' > > > dateArgInputObject: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgInputObject<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgInputObject<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgInputObject: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgInputObject: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgInputObject' > > > dateArgList: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgList<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgList' > > > dateArgNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgNonNull' > > > dateArgNonNullList: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullList<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgNonNullList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgNonNullList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgNonNullList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgNonNullList' > > > dateArgNonNullListNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullListNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact< + $SelectionSet, + $$SelectionSets.Query.dateArgNonNullListNonNull<$Context['scalars']> + >, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgNonNullListNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgNonNullListNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgNonNullListNonNull' > > > dateInterface1: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateInterface1<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateInterface1<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateInterface1: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateInterface1: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateInterface1' > > > dateList: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateList<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateList' > > > dateListList: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateListList<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateListList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateListList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateListList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateListList' > > > dateListNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateListNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateListNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateListNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateListNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateListNonNull' > > > dateNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateNonNull' > > > dateObject1: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateObject1<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateObject1<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateObject1: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateObject1: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateObject1' > > > dateUnion: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateUnion<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateUnion<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateUnion: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateUnion: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateUnion' > > > error: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.error<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.error<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ error: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ error: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'error' > > > id: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.id<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.id<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ id: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ id: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'id' > > > idNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.idNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ idNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ idNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'idNonNull' > > > interface: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$interface<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$interface<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ interface: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ interface: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'interface' > > > interfaceNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.interfaceNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.interfaceNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ interfaceNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ interfaceNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'interfaceNonNull' > > > interfaceWithArgs: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.interfaceWithArgs<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.interfaceWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ interfaceWithArgs: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ interfaceWithArgs: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'interfaceWithArgs' > > > listInt: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listInt<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listInt<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ listInt: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ listInt: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'listInt' > > > listIntNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listIntNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listIntNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ listIntNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ listIntNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'listIntNonNull' > > > listListInt: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listListInt<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listListInt<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ listListInt: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ listListInt: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'listListInt' > > > listListIntNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listListIntNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listListIntNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ listListIntNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ listListIntNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'listListIntNonNull' > > > lowerCaseUnion: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.lowerCaseUnion<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.lowerCaseUnion<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ lowerCaseUnion: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ lowerCaseUnion: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'lowerCaseUnion' > > > object: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$object<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$object<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ object: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ object: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'object' > > > objectList: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectList<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectList' > > > objectListNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectListNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectListNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectListNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectListNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectListNonNull' > > > objectNested: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectNested<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectNested<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectNested: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectNested: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectNested' > > > objectNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectNonNull' > > > objectWithArgs: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectWithArgs<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectWithArgs: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectWithArgs: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectWithArgs' > > > result: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.result<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.result<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ result: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ result: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'result' > > > resultNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.resultNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.resultNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ resultNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ resultNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'resultNonNull' > > > string: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$string<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$string<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ string: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ string: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'string' > > > stringWithArgEnum: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgEnum<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithArgEnum<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithArgEnum: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithArgEnum: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithArgEnum' > > > stringWithArgInputObject: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgInputObject<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact< + $SelectionSet, + $$SelectionSets.Query.stringWithArgInputObject<$Context['scalars']> + >, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithArgInputObject: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithArgInputObject: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithArgInputObject' > > @@ -509,13 +515,16 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { stringWithArgInputObjectRequired: <$SelectionSet>( selectionSet: $$Utilities.Exact< $SelectionSet, - SelectionSet.Query.stringWithArgInputObjectRequired<$Context['scalars']> + $$SelectionSets.Query.stringWithArgInputObjectRequired<$Context['scalars']> >, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithArgInputObjectRequired: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery< + { stringWithArgInputObjectRequired: $SelectionSet }, + $$Schema.Schema<$Context['scalars']> + >, 'stringWithArgInputObjectRequired' > > @@ -524,108 +533,111 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { * The given arguments are reflected back as a JSON string. */ stringWithArgs: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgs<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithArgs: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithArgs: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithArgs' > > > stringWithListArg: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithListArg<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithListArg<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithListArg: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithListArg: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithListArg' > > > stringWithListArgRequired: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithListArgRequired<$Context['scalars']>>, + selectionSet: $$Utilities.Exact< + $SelectionSet, + $$SelectionSets.Query.stringWithListArgRequired<$Context['scalars']> + >, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithListArgRequired: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithListArgRequired: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithListArgRequired' > > > stringWithRequiredArg: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithRequiredArg<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithRequiredArg<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithRequiredArg: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithRequiredArg: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithRequiredArg' > > > unionFooBar: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBar<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBar<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionFooBar: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionFooBar: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionFooBar' > > > unionFooBarNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBarNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBarNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionFooBarNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionFooBarNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionFooBarNonNull' > > > unionFooBarWithArgs: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBarWithArgs<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBarWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionFooBarWithArgs: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionFooBarWithArgs: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionFooBarWithArgs' > > > unionObject: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionObject<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionObject<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionObject: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionObject: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionObject' > > > unionObjectNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionObjectNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionObjectNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionObjectNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionObjectNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionObjectNonNull' > > @@ -634,12 +646,12 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { export interface MutationMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationMutation<$SelectionSet, Schema<$Context['scalars']>> + InferResult.OperationMutation<$SelectionSet, $$Schema.Schema<$Context['scalars']>> > > > @@ -654,24 +666,24 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > id: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.id<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.id<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationMutation<{ id: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationMutation<{ id: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'id' > > > idNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.idNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationMutation<{ idNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationMutation<{ idNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'idNonNull' > > diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsSelect.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-select.ts similarity index 54% rename from src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsSelect.ts rename to src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-select.ts index 23e78868d..9a24c175d 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/MethodsSelect.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/methods-select.ts @@ -1,5 +1,5 @@ -import type * as $Utilities from '../../../../../../entrypoints/utilities-for-generated.js' -import type * as $SelectionSets from './SelectionSets.js' +import type * as $$Utilities from '../../../../../../entrypoints/utilities-for-generated.js' +import * as $$SelectionSets from './selection-sets.js' // // @@ -59,11 +59,11 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Query>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet } export interface Mutation { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Mutation>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>): $SelectionSet } // @@ -83,59 +83,59 @@ export interface Mutation { // export interface Bar { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Bar>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Bar>): $SelectionSet } export interface DateObject1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateObject1>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject1>): $SelectionSet } export interface DateObject2 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateObject2>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject2>): $SelectionSet } export interface ErrorOne { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ErrorOne>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorOne>): $SelectionSet } export interface ErrorTwo { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ErrorTwo>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorTwo>): $SelectionSet } export interface Foo { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Foo>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Foo>): $SelectionSet } export interface Object1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Object1>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1>): $SelectionSet } export interface Object1ImplementingInterface { <$SelectionSet>( - selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Object1ImplementingInterface>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1ImplementingInterface>, ): $SelectionSet } export interface Object2ImplementingInterface { <$SelectionSet>( - selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Object2ImplementingInterface>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object2ImplementingInterface>, ): $SelectionSet } export interface ObjectNested { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ObjectNested>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectNested>): $SelectionSet } export interface ObjectUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ObjectUnion>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectUnion>): $SelectionSet } export interface lowerCaseObject { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseObject>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject>): $SelectionSet } export interface lowerCaseObject2 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseObject2>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject2>): $SelectionSet } // @@ -155,19 +155,19 @@ export interface lowerCaseObject2 { // export interface DateUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateUnion>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateUnion>): $SelectionSet } export interface FooBarUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.FooBarUnion>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.FooBarUnion>): $SelectionSet } export interface Result { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Result>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Result>): $SelectionSet } export interface lowerCaseUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseUnion>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseUnion>): $SelectionSet } // @@ -187,13 +187,13 @@ export interface lowerCaseUnion { // export interface DateInterface1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateInterface1>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateInterface1>): $SelectionSet } export interface Error { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Error>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Error>): $SelectionSet } export interface Interface { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Interface>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Interface>): $SelectionSet } diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Scalar.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/scalar.ts similarity index 100% rename from src/extensions/SchemaErrors/tests/fixture/graffle/modules/Scalar.ts rename to src/extensions/SchemaErrors/tests/fixture/graffle/modules/scalar.ts diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/SchemaDrivenDataMap.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/schema-driven-data-map.ts similarity index 98% rename from src/extensions/SchemaErrors/tests/fixture/graffle/modules/SchemaDrivenDataMap.ts rename to src/extensions/SchemaErrors/tests/fixture/graffle/modules/schema-driven-data-map.ts index 364e1e835..821000680 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/SchemaDrivenDataMap.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/schema-driven-data-map.ts @@ -1,5 +1,5 @@ import type * as $$Utilities from '../../../../../../entrypoints/utilities-for-generated.js' -import * as $Scalar from './Scalar.js' +import * as $$Scalar from './scalar.js' // // // @@ -16,15 +16,15 @@ import * as $Scalar from './Scalar.js' // // -const Boolean = $Scalar.Boolean +const Boolean = $$Scalar.Boolean -const Float = $Scalar.Float +const Float = $$Scalar.Float -const ID = $Scalar.ID +const ID = $$Scalar.ID -const Int = $Scalar.Int +const Int = $$Scalar.Int -const String = $Scalar.String +const String = $$Scalar.String // // diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Schema.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/schema.ts similarity index 99% rename from src/extensions/SchemaErrors/tests/fixture/graffle/modules/Schema.ts rename to src/extensions/SchemaErrors/tests/fixture/graffle/modules/schema.ts index 6cef13de8..651df90c3 100644 --- a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/Schema.ts +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/schema.ts @@ -1,7 +1,7 @@ import type { Schema as $ } from '../../../../../../entrypoints/utilities-for-generated.js' import type * as $$Utilities from '../../../../../../entrypoints/utilities-for-generated.js' -import type * as Data from './Data.js' -import type * as $Scalar from './Scalar.js' +import * as $$Data from './data.js' +import * as $$Scalar from './scalar.js' export namespace Schema { // @@ -1543,7 +1543,7 @@ export namespace Schema { // -------------------------------------------------------------------------------------------------- // - export type Date = $Scalar.Date + export type Date = $$Scalar.Date // // @@ -1672,7 +1672,7 @@ export namespace Schema { export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.Registry = $$Utilities.Schema.Scalar.Registry.Empty> extends $ { - name: Data.Name + name: $$Data.Name operationsAvailable: ['query', 'mutation'] RootUnion: | Schema.Query diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/select.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/select.ts new file mode 100644 index 000000000..befd2d321 --- /dev/null +++ b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/select.ts @@ -0,0 +1,166 @@ +import type { OperationTypeNode } from 'graphql' +import type { InferResult } from '../../../../../../entrypoints/schema.js' +import * as $$Data from './data.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' + +// +// +// +// +// +// +// ================================================================================================== +// Runtime +// ================================================================================================== +// +// +// +// +// +// +import { createSelect } from '../../../../../../entrypoints/client.js' +export const Select = createSelect($$Data.Name) + +// +// +// +// +// +// +// ================================================================================================== +// Buildtime +// ================================================================================================== +// +// +// +// +// +// + +export namespace Select { + // Root + // -------------------------------------------------------------------------------------------------- + // + export type Query<$SelectionSet extends $$SelectionSets.Query> = InferResult.Operation< + $SelectionSet, + $$Schema.Schema, + OperationTypeNode.QUERY + > + export type Mutation<$SelectionSet extends $$SelectionSets.Mutation> = InferResult.Operation< + $SelectionSet, + $$Schema.Schema, + OperationTypeNode.MUTATION + > + // OutputObject + // -------------------------------------------------------------------------------------------------- + // + export type Bar<$SelectionSet extends $$SelectionSets.Bar> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Bar'] + > + export type DateObject1<$SelectionSet extends $$SelectionSets.DateObject1> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['DateObject1'] + > + export type DateObject2<$SelectionSet extends $$SelectionSets.DateObject2> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['DateObject2'] + > + export type ErrorOne<$SelectionSet extends $$SelectionSets.ErrorOne> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['ErrorOne'] + > + export type ErrorTwo<$SelectionSet extends $$SelectionSets.ErrorTwo> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['ErrorTwo'] + > + export type Foo<$SelectionSet extends $$SelectionSets.Foo> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Foo'] + > + export type Object1<$SelectionSet extends $$SelectionSets.Object1> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Object1'] + > + export type Object1ImplementingInterface<$SelectionSet extends $$SelectionSets.Object1ImplementingInterface> = + InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Object1ImplementingInterface'] + > + export type Object2ImplementingInterface<$SelectionSet extends $$SelectionSets.Object2ImplementingInterface> = + InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Object2ImplementingInterface'] + > + export type ObjectNested<$SelectionSet extends $$SelectionSets.ObjectNested> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['ObjectNested'] + > + export type ObjectUnion<$SelectionSet extends $$SelectionSets.ObjectUnion> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['ObjectUnion'] + > + export type lowerCaseObject<$SelectionSet extends $$SelectionSets.lowerCaseObject> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['lowerCaseObject'] + > + export type lowerCaseObject2<$SelectionSet extends $$SelectionSets.lowerCaseObject2> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['lowerCaseObject2'] + > + // Union + // -------------------------------------------------------------------------------------------------- + // + export type DateUnion<$SelectionSet extends $$SelectionSets.DateUnion> = InferResult.Union< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['DateUnion'] + > + export type FooBarUnion<$SelectionSet extends $$SelectionSets.FooBarUnion> = InferResult.Union< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['FooBarUnion'] + > + export type Result<$SelectionSet extends $$SelectionSets.Result> = InferResult.Union< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Result'] + > + export type lowerCaseUnion<$SelectionSet extends $$SelectionSets.lowerCaseUnion> = InferResult.Union< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['lowerCaseUnion'] + > + // Interface + // -------------------------------------------------------------------------------------------------- + // + export type DateInterface1<$SelectionSet extends $$SelectionSets.DateInterface1> = InferResult.Interface< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['DateInterface1'] + > + export type Error<$SelectionSet extends $$SelectionSets.Error> = InferResult.Interface< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Error'] + > + export type Interface<$SelectionSet extends $$SelectionSets.Interface> = InferResult.Interface< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Interface'] + > +} diff --git a/src/extensions/SchemaErrors/tests/fixture/graffle/modules/SelectionSets.ts b/src/extensions/SchemaErrors/tests/fixture/graffle/modules/selection-sets.ts similarity index 100% rename from src/extensions/SchemaErrors/tests/fixture/graffle/modules/SelectionSets.ts rename to src/extensions/SchemaErrors/tests/fixture/graffle/modules/selection-sets.ts diff --git a/src/generator/cli/generate.ts b/src/generator/cli/generate.ts index 1729afdbf..f4dac0ca4 100755 --- a/src/generator/cli/generate.ts +++ b/src/generator/cli/generate.ts @@ -6,6 +6,7 @@ import { z } from 'zod' import { toAbsolutePath } from '../../lib/fsp.js' import { isError, urlParseSafe } from '../../lib/prelude.js' import { Generator } from '../__.js' +import { type Input, OutputCase } from '../config/input.js' const args = Command.create().description(`Generate a type safe GraphQL client.`) .parameter( @@ -43,6 +44,12 @@ const args = Command.create().description(`Generate a type safe GraphQL client.` `Directory path for where to output the generated TypeScript files. By default will be './graffle' in the project root.`, ), ) + .parameter( + `outputCase`, + z.nativeEnum(OutputCase).default(`kebab`).describe( + `The case format to use for the generated file names.`, + ), + ) .parameter( `format`, z.boolean().describe( @@ -91,10 +98,11 @@ const currentWorkingDirectory = configModule.path ? Path.dirname(configModule.pa // --- Merge Inputs --- -const input = { +const input: Input = { ...configModule.builder?._.input, currentWorkingDirectory, schema, + outputCase: args.outputCase, } if (defaultSchemaUrl !== undefined) input.defaultSchemaUrl = defaultSchemaUrl diff --git a/src/generator/config/config.ts b/src/generator/config/config.ts index 3388aa216..8d497a445 100644 --- a/src/generator/config/config.ts +++ b/src/generator/config/config.ts @@ -8,13 +8,14 @@ import { Grafaid } from '../../lib/grafaid/__.js' import { isString } from '../../lib/prelude.js' import { type Formatter, getTypeScriptFormatter, passthroughFormatter } from '../../lib/typescript-formatter.js' import type { Extension } from '../extension/types.js' -import { defaultLibraryPaths } from './defaults.js' +import { defaultLibraryPaths, defaultOutputCase } from './defaults.js' import { defaultName } from './defaults.js' -import type { Input, InputLibraryPaths, InputLint } from './input.js' +import type { Input, InputLibraryPaths, InputLint, InputOutputCase } from './input.js' export interface Config { fs: Fs name: string + outputCase: InputOutputCase lint: Required schema: ConfigSchema runtimeFeatures: { @@ -40,7 +41,7 @@ export interface Config { inputs: { root: string schema: null | string - customScalarCodecs: string + scalars: string } outputs: { sdl: null | string @@ -49,7 +50,7 @@ export interface Config { } } imports: { - customScalarCodecs: string + scalars: string grafflePackage: Required } } @@ -64,6 +65,10 @@ interface ConfigSchema { } export const createConfig = async (input: Input): Promise => { + // --- Output Case --- + + const outputCase = input.outputCase ?? defaultOutputCase + // --- Paths --- const cwd = input.currentWorkingDirectory ?? process.cwd() @@ -76,21 +81,21 @@ export const createConfig = async (input: Input): Promise => { const outputDirPathModules = Path.join(outputDirPathRoot, `/modules`) - const inputPathCustomScalarCodecs = input.customScalarCodecs - ? toAbsolutePath(cwd, input.customScalarCodecs) - : Path.join(sourceDirPath, `customScalarCodecs.ts`) + const inputPathScalars = input.scalars + ? toAbsolutePath(cwd, input.scalars) + : Path.join(sourceDirPath, `scalars` + `.ts`) - const isCustomScalarsModuleExists = await fileExists(inputPathCustomScalarCodecs) - if (!isCustomScalarsModuleExists && input.customScalarCodecs) { + const isCustomScalarsModuleExists = await fileExists(inputPathScalars) + if (!isCustomScalarsModuleExists && input.scalars) { // dprint-ignore throw new Error( - `Custom scalar codecs file not found. Given path: ${String(input.customScalarCodecs)}. Resolved to and looked at: ${inputPathCustomScalarCodecs}`, + `Custom scalar codecs file not found. Given path: ${String(input.scalars)}. Resolved to and looked at: ${inputPathScalars}`, ) } - const customScalarsImportPath = Path.relative( + const scalarsImportPath = Path.relative( outputDirPathModules, - inputPathCustomScalarCodecs.replace(/\.ts$/, `.js`), + inputPathScalars.replace(/\.ts$/, `.js`), ) // --- Schema --- @@ -167,7 +172,9 @@ To suppress this warning disable formatting in one of the following ways: : null // --- Fs --- + const fs = input.fs ?? await import(`node:fs/promises`) + // --- Config --- // const customScalarsEnabled = input.customScalars ?? false @@ -175,6 +182,7 @@ To suppress this warning disable formatting in one of the following ways: return { fs, extensions: input.extensions ?? [], + outputCase, lint, formatter, runtimeFeatures: { @@ -202,11 +210,11 @@ To suppress this warning disable formatting in one of the following ways: inputs: { root: sourceDirPath, schema: schema.sdlFilePath, - customScalarCodecs: inputPathCustomScalarCodecs, + scalars: inputPathScalars, }, }, imports: { - customScalarCodecs: customScalarsImportPath, + scalars: scalarsImportPath, grafflePackage: ConfigManager.mergeDefaults( defaultLibraryPaths, libraryPaths, diff --git a/src/generator/config/defaults.ts b/src/generator/config/defaults.ts index 2f7c0a143..48ec08cea 100644 --- a/src/generator/config/defaults.ts +++ b/src/generator/config/defaults.ts @@ -1,3 +1,5 @@ +import type { InputOutputCase } from './input.js' + export const defaultName = `default` export const defaultLibraryPaths = { @@ -6,3 +8,5 @@ export const defaultLibraryPaths = { schema: `graffle/schema`, utilitiesForGenerated: `graffle/utilities-for-generated`, } + +export const defaultOutputCase: InputOutputCase = `kebab` diff --git a/src/generator/config/input.ts b/src/generator/config/input.ts index e9aaede0d..a35f1cc29 100644 --- a/src/generator/config/input.ts +++ b/src/generator/config/input.ts @@ -12,11 +12,27 @@ export interface InputLint { missingCustomScalarCodec?: boolean } +export const OutputCase = { + pascal: `pascal`, + camel: `camel`, + kebab: `kebab`, + snake: `snake`, +} as const +export type InputOutputCase = keyof typeof OutputCase + export interface Input { /** - * File system API to use. By default uses the Node.js file system API. + * File system API to use. + * + * By default uses the Node.js file system API. */ fs?: Fs + /** + * What naming convention to use for generated files and directories. + * + * @defaultValue `kebab` + */ + outputCase?: InputOutputCase /** * The name of the client. This will affect: * @@ -105,11 +121,11 @@ export interface Input { */ sourceDirPath?: string /** - * File path to your custom scalar codecs module. + * File path to your scalars module. * - * If not set, Graffle will look for a file called `customScalarCodecs.ts` in the project directory. + * If not set, Graffle will look for a file called `scalars.ts` in the project directory. */ - customScalarCodecs?: string + scalars?: string /** * Override import paths to graffle package within the generated code. * Used by Graffle test suite to have generated clients point to source diff --git a/src/generator/generator/__snapshots__/generate.test.ts.snap b/src/generator/generator/__snapshots__/generate.test.ts.snap index 1b1448248..42a94a3d4 100644 --- a/src/generator/generator/__snapshots__/generate.test.ts.snap +++ b/src/generator/generator/__snapshots__/generate.test.ts.snap @@ -5,12 +5,12 @@ exports[`kitchen-sink generated modules > _.ts 1`] = ` // It at least helps with Twoslash wherein without this import here Twoslash will not include the global module. // In real TypeScript projects it seems the global module is included automatically. But there could be certain tsconfig // setups where this still indeed does help. -import './modules/Global.js' +import './modules/global.js' -export { create } from './modules/Client.js' -export { schemaDrivenDataMap } from './modules/SchemaDrivenDataMap.js' -export { Select } from './modules/Select.js' -export * as SelectionSets from './modules/SelectionSets.js' +export { create } from './modules/client.js' +export { schemaDrivenDataMap } from './modules/schema-driven-data-map.js' +export { Select } from './modules/select.js' +export * as SelectionSets from './modules/selection-sets.js' " `; @@ -19,16 +19,15 @@ exports[`kitchen-sink generated modules > __.ts 1`] = ` " `; -exports[`kitchen-sink generated modules > modules/Client.ts 1`] = ` +exports[`kitchen-sink generated modules > modules/client.ts 1`] = ` "import { createPrefilled } from '../../../../../../src/entrypoints/client.js' -import { defaultSchemaUrl } from './Data.js' -import { Name } from './Data.js' -import { schemaDrivenDataMap } from './SchemaDrivenDataMap.js' -export const create = createPrefilled(Name, schemaDrivenDataMap, defaultSchemaUrl) +import * as $$Data from './data.js' +import * as $$SchemaDrivenDataMap from './schema-driven-data-map.js' +export const create = createPrefilled($$Data.Name, $$SchemaDrivenDataMap.schemaDrivenDataMap, $$Data.defaultSchemaUrl) " `; -exports[`kitchen-sink generated modules > modules/Data.ts 1`] = ` +exports[`kitchen-sink generated modules > modules/data.ts 1`] = ` "export const Name = \`default\` export type Name = 'default' @@ -36,23 +35,23 @@ export const defaultSchemaUrl = undefined " `; -exports[`kitchen-sink generated modules > modules/Global.ts 1`] = ` -"import type * as Data from './Data.js' -import type * as MethodsDocument from './MethodsDocument.js' -import type * as MethodsRoot from './MethodsRoot.js' -import type * as MethodsSelect from './MethodsSelect.js' -import type { Schema } from './Schema.js' +exports[`kitchen-sink generated modules > modules/global.ts 1`] = ` +"import * as $$Data from './data.js' +import * as $$MethodsDocument from './methods-document.js' +import * as $$MethodsRoot from './methods-root.js' +import * as $$MethodsSelect from './methods-select.js' +import * as $$Schema from './schema.js' declare global { export namespace GraffleGlobal { export interface Clients { default: { - name: Data.Name - schema: Schema + name: $$Data.Name + schema: $$Schema.Schema interfaces: { - MethodsSelect: MethodsSelect.$MethodsSelect - Document: MethodsDocument.BuilderMethodsDocumentFn - Root: MethodsRoot.BuilderMethodsRootFn + MethodsSelect: $$MethodsSelect.$MethodsSelect + Document: $$MethodsDocument.BuilderMethodsDocumentFn + Root: $$MethodsRoot.BuilderMethodsRootFn } defaultSchemaUrl: null } @@ -62,43 +61,44 @@ declare global { " `; -exports[`kitchen-sink generated modules > modules/MethodsDocument.ts 1`] = ` -"import type * as Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type { Schema } from './Schema.js' -import type * as SelectionSets from './SelectionSets.js' -export interface Document<$Context extends Utilities.ClientContext> { +exports[`kitchen-sink generated modules > modules/methods-document.ts 1`] = ` +"import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' + +export interface Document<$Context extends $$Utilities.ClientContext> { <$Document>( - document: Utilities.ExactNonEmpty<$Document, SelectionSets.$Document<$Context['scalars']>>, - ): Utilities.DocumentRunner< + document: $$Utilities.ExactNonEmpty<$Document, $$SelectionSets.$Document<$Context['scalars']>>, + ): $$Utilities.DocumentRunner< $Context, - Schema, + $$Schema.Schema, // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as // Satisfying the constraint on the DocumentRunner type. $Document > } -export interface BuilderMethodsDocumentFn extends Utilities.TypeFunction.Fn { +export interface BuilderMethodsDocumentFn extends $$Utilities.TypeFunction.Fn { // @ts-expect-error parameter is Untyped. return: Document } " `; -exports[`kitchen-sink generated modules > modules/MethodsRoot.ts 1`] = ` +exports[`kitchen-sink generated modules > modules/methods-root.ts 1`] = ` "import type { InferResult } from '../../../../../../src/entrypoints/schema.js' import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type { Schema } from './Schema.js' -import type * as SelectionSet from './SelectionSets.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' export interface QueryMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationQuery<$SelectionSet, Schema<$Context['scalars']>> + InferResult.OperationQuery<$SelectionSet, $$Schema.Schema<$Context['scalars']>> > > > @@ -113,24 +113,24 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > InputObjectNested: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.InputObjectNested<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.InputObjectNested<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ InputObjectNested: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ InputObjectNested: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'InputObjectNested' > > > InputObjectNestedNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.InputObjectNestedNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.InputObjectNestedNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ InputObjectNestedNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ InputObjectNestedNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'InputObjectNestedNonNull' > > @@ -139,456 +139,462 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { * Query enum field documentation. */ abcEnum: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.abcEnum<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.abcEnum<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ abcEnum: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ abcEnum: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'abcEnum' > > > argInputObjectCircular: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.argInputObjectCircular<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.argInputObjectCircular<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ argInputObjectCircular: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ argInputObjectCircular: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'argInputObjectCircular' > > > date: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.date<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.date<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ date: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ date: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'date' > > > dateArg: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArg<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArg<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArg: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArg: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArg' > > > dateArgInputObject: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgInputObject<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgInputObject<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgInputObject: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgInputObject: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgInputObject' > > > dateArgList: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgList<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgList' > > > dateArgNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgNonNull' > > > dateArgNonNullList: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullList<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgNonNullList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgNonNullList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgNonNullList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgNonNullList' > > > dateArgNonNullListNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullListNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact< + $SelectionSet, + $$SelectionSets.Query.dateArgNonNullListNonNull<$Context['scalars']> + >, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgNonNullListNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgNonNullListNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgNonNullListNonNull' > > > dateInterface1: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateInterface1<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateInterface1<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateInterface1: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateInterface1: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateInterface1' > > > dateList: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateList<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateList' > > > dateListList: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateListList<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateListList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateListList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateListList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateListList' > > > dateListNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateListNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateListNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateListNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateListNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateListNonNull' > > > dateNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateNonNull' > > > dateObject1: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateObject1<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateObject1<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateObject1: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateObject1: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateObject1' > > > dateUnion: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateUnion<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateUnion<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateUnion: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateUnion: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateUnion' > > > error: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.error<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.error<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ error: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ error: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'error' > > > id: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.id<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.id<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ id: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ id: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'id' > > > idNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.idNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ idNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ idNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'idNonNull' > > > interface: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$interface<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$interface<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ interface: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ interface: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'interface' > > > interfaceNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.interfaceNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.interfaceNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ interfaceNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ interfaceNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'interfaceNonNull' > > > interfaceWithArgs: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.interfaceWithArgs<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.interfaceWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ interfaceWithArgs: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ interfaceWithArgs: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'interfaceWithArgs' > > > listInt: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listInt<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listInt<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ listInt: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ listInt: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'listInt' > > > listIntNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listIntNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listIntNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ listIntNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ listIntNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'listIntNonNull' > > > listListInt: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listListInt<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listListInt<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ listListInt: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ listListInt: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'listListInt' > > > listListIntNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listListIntNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listListIntNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ listListIntNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ listListIntNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'listListIntNonNull' > > > lowerCaseUnion: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.lowerCaseUnion<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.lowerCaseUnion<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ lowerCaseUnion: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ lowerCaseUnion: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'lowerCaseUnion' > > > object: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$object<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$object<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ object: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ object: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'object' > > > objectList: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectList<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectList' > > > objectListNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectListNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectListNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectListNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectListNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectListNonNull' > > > objectNested: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectNested<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectNested<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectNested: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectNested: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectNested' > > > objectNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectNonNull' > > > objectWithArgs: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectWithArgs<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectWithArgs: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectWithArgs: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectWithArgs' > > > result: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.result<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.result<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ result: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ result: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'result' > > > resultNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.resultNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.resultNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ resultNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ resultNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'resultNonNull' > > > string: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$string<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$string<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ string: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ string: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'string' > > > stringWithArgEnum: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgEnum<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithArgEnum<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithArgEnum: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithArgEnum: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithArgEnum' > > > stringWithArgInputObject: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgInputObject<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact< + $SelectionSet, + $$SelectionSets.Query.stringWithArgInputObject<$Context['scalars']> + >, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithArgInputObject: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithArgInputObject: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithArgInputObject' > > @@ -597,13 +603,16 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { stringWithArgInputObjectRequired: <$SelectionSet>( selectionSet: $$Utilities.Exact< $SelectionSet, - SelectionSet.Query.stringWithArgInputObjectRequired<$Context['scalars']> + $$SelectionSets.Query.stringWithArgInputObjectRequired<$Context['scalars']> >, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithArgInputObjectRequired: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery< + { stringWithArgInputObjectRequired: $SelectionSet }, + $$Schema.Schema<$Context['scalars']> + >, 'stringWithArgInputObjectRequired' > > @@ -612,108 +621,111 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { * The given arguments are reflected back as a JSON string. */ stringWithArgs: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgs<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithArgs: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithArgs: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithArgs' > > > stringWithListArg: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithListArg<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithListArg<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithListArg: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithListArg: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithListArg' > > > stringWithListArgRequired: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithListArgRequired<$Context['scalars']>>, + selectionSet: $$Utilities.Exact< + $SelectionSet, + $$SelectionSets.Query.stringWithListArgRequired<$Context['scalars']> + >, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithListArgRequired: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithListArgRequired: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithListArgRequired' > > > stringWithRequiredArg: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithRequiredArg<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithRequiredArg<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithRequiredArg: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithRequiredArg: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithRequiredArg' > > > unionFooBar: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBar<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBar<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionFooBar: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionFooBar: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionFooBar' > > > unionFooBarNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBarNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBarNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionFooBarNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionFooBarNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionFooBarNonNull' > > > unionFooBarWithArgs: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBarWithArgs<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBarWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionFooBarWithArgs: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionFooBarWithArgs: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionFooBarWithArgs' > > > unionObject: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionObject<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionObject<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionObject: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionObject: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionObject' > > > unionObjectNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionObjectNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionObjectNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionObjectNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionObjectNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionObjectNonNull' > > @@ -722,12 +734,12 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { export interface MutationMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationMutation<$SelectionSet, Schema<$Context['scalars']>> + InferResult.OperationMutation<$SelectionSet, $$Schema.Schema<$Context['scalars']>> > > > @@ -742,24 +754,24 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > id: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.id<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.id<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationMutation<{ id: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationMutation<{ id: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'id' > > > idNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.idNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationMutation<{ idNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationMutation<{ idNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'idNonNull' > > @@ -778,9 +790,9 @@ export interface BuilderMethodsRootFn extends $$Utilities.TypeFunction.Fn { " `; -exports[`kitchen-sink generated modules > modules/MethodsSelect.ts 1`] = ` -"import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type * as $SelectionSets from './SelectionSets.js' +exports[`kitchen-sink generated modules > modules/methods-select.ts 1`] = ` +"import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import * as $$SelectionSets from './selection-sets.js' // // @@ -840,11 +852,11 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Query>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet } export interface Mutation { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Mutation>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>): $SelectionSet } // @@ -864,59 +876,59 @@ export interface Mutation { // export interface Bar { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Bar>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Bar>): $SelectionSet } export interface DateObject1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateObject1>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject1>): $SelectionSet } export interface DateObject2 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateObject2>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject2>): $SelectionSet } export interface ErrorOne { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ErrorOne>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorOne>): $SelectionSet } export interface ErrorTwo { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ErrorTwo>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorTwo>): $SelectionSet } export interface Foo { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Foo>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Foo>): $SelectionSet } export interface Object1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Object1>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1>): $SelectionSet } export interface Object1ImplementingInterface { <$SelectionSet>( - selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Object1ImplementingInterface>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1ImplementingInterface>, ): $SelectionSet } export interface Object2ImplementingInterface { <$SelectionSet>( - selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Object2ImplementingInterface>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object2ImplementingInterface>, ): $SelectionSet } export interface ObjectNested { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ObjectNested>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectNested>): $SelectionSet } export interface ObjectUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ObjectUnion>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectUnion>): $SelectionSet } export interface lowerCaseObject { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseObject>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject>): $SelectionSet } export interface lowerCaseObject2 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseObject2>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject2>): $SelectionSet } // @@ -936,19 +948,19 @@ export interface lowerCaseObject2 { // export interface DateUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateUnion>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateUnion>): $SelectionSet } export interface FooBarUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.FooBarUnion>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.FooBarUnion>): $SelectionSet } export interface Result { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Result>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Result>): $SelectionSet } export interface lowerCaseUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseUnion>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseUnion>): $SelectionSet } // @@ -968,20 +980,20 @@ export interface lowerCaseUnion { // export interface DateInterface1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateInterface1>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateInterface1>): $SelectionSet } export interface Error { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Error>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Error>): $SelectionSet } export interface Interface { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Interface>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Interface>): $SelectionSet } " `; -exports[`kitchen-sink generated modules > modules/Scalar.ts 1`] = ` +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' @@ -1002,11 +1014,11 @@ export type Date = $$Utilities.Schema.Scalar.ScalarCodecless<'Date'> " `; -exports[`kitchen-sink generated modules > modules/Schema.ts 1`] = ` +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 $Scalar from './Scalar.js' +import * as $$Data from './data.js' +import * as $$Scalar from './scalar.js' export namespace Schema { // @@ -2548,7 +2560,7 @@ export namespace Schema { // -------------------------------------------------------------------------------------------------- // - export type Date = $Scalar.Date + export type Date = $$Scalar.Date // // @@ -2677,7 +2689,7 @@ export namespace Schema { export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.Registry = $$Utilities.Schema.Scalar.Registry.Empty> extends $ { - name: Data.Name + name: $$Data.Name operationsAvailable: ['query', 'mutation'] RootUnion: | Schema.Query @@ -2745,9 +2757,9 @@ export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.Registry = $$ " `; -exports[`kitchen-sink generated modules > modules/SchemaDrivenDataMap.ts 1`] = ` +exports[`kitchen-sink generated modules > modules/schema-driven-data-map.ts 1`] = ` "import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import * as $Scalar from './Scalar.js' +import * as $$Scalar from './scalar.js' // // // @@ -2764,15 +2776,15 @@ import * as $Scalar from './Scalar.js' // // -const Boolean = $Scalar.Boolean +const Boolean = $$Scalar.Boolean -const Float = $Scalar.Float +const Float = $$Scalar.Float -const ID = $Scalar.ID +const ID = $$Scalar.ID -const Int = $Scalar.Int +const Int = $$Scalar.Int -const String = $Scalar.String +const String = $$Scalar.String // // @@ -3481,12 +3493,12 @@ export { $schemaDrivenDataMap as schemaDrivenDataMap } " `; -exports[`kitchen-sink generated modules > modules/Select.ts 1`] = ` +exports[`kitchen-sink generated modules > modules/select.ts 1`] = ` "import type { OperationTypeNode } from 'graphql' import type { InferResult } from '../../../../../../src/entrypoints/schema.js' -import * as Data from './Data.js' -import type { Schema } from './Schema.js' -import type * as SelectionSets from './SelectionSets.js' +import * as $$Data from './data.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' // // @@ -3504,7 +3516,7 @@ import type * as SelectionSets from './SelectionSets.js' // // import { createSelect } from '../../../../../../src/entrypoints/client.js' -export const Select = createSelect(Data.Name) +export const Select = createSelect($$Data.Name) // // @@ -3526,124 +3538,132 @@ export namespace Select { // Root // -------------------------------------------------------------------------------------------------- // - export type Query<$SelectionSet extends SelectionSets.Query> = InferResult.Operation< + export type Query<$SelectionSet extends $$SelectionSets.Query> = InferResult.Operation< $SelectionSet, - Schema, + $$Schema.Schema, OperationTypeNode.QUERY > - export type Mutation<$SelectionSet extends SelectionSets.Mutation> = InferResult.Operation< + export type Mutation<$SelectionSet extends $$SelectionSets.Mutation> = InferResult.Operation< $SelectionSet, - Schema, + $$Schema.Schema, OperationTypeNode.MUTATION > // OutputObject // -------------------------------------------------------------------------------------------------- // - export type Bar<$SelectionSet extends SelectionSets.Bar> = InferResult.OutputObject< + export type Bar<$SelectionSet extends $$SelectionSets.Bar> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema['allTypes']['Bar'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['Bar'] > - export type DateObject1<$SelectionSet extends SelectionSets.DateObject1> = InferResult.OutputObject< + export type DateObject1<$SelectionSet extends $$SelectionSets.DateObject1> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema['allTypes']['DateObject1'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['DateObject1'] > - export type DateObject2<$SelectionSet extends SelectionSets.DateObject2> = InferResult.OutputObject< + export type DateObject2<$SelectionSet extends $$SelectionSets.DateObject2> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema['allTypes']['DateObject2'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['DateObject2'] > - export type ErrorOne<$SelectionSet extends SelectionSets.ErrorOne> = InferResult.OutputObject< + export type ErrorOne<$SelectionSet extends $$SelectionSets.ErrorOne> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema['allTypes']['ErrorOne'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['ErrorOne'] > - export type ErrorTwo<$SelectionSet extends SelectionSets.ErrorTwo> = InferResult.OutputObject< + export type ErrorTwo<$SelectionSet extends $$SelectionSets.ErrorTwo> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema['allTypes']['ErrorTwo'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['ErrorTwo'] > - export type Foo<$SelectionSet extends SelectionSets.Foo> = InferResult.OutputObject< + export type Foo<$SelectionSet extends $$SelectionSets.Foo> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema['allTypes']['Foo'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['Foo'] > - export type Object1<$SelectionSet extends SelectionSets.Object1> = InferResult.OutputObject< + export type Object1<$SelectionSet extends $$SelectionSets.Object1> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema['allTypes']['Object1'] - > - export type Object1ImplementingInterface<$SelectionSet extends SelectionSets.Object1ImplementingInterface> = - InferResult.OutputObject<$SelectionSet, Schema, Schema['allTypes']['Object1ImplementingInterface']> - export type Object2ImplementingInterface<$SelectionSet extends SelectionSets.Object2ImplementingInterface> = - InferResult.OutputObject<$SelectionSet, Schema, Schema['allTypes']['Object2ImplementingInterface']> - export type ObjectNested<$SelectionSet extends SelectionSets.ObjectNested> = InferResult.OutputObject< + $$Schema.Schema, + $$Schema.Schema['allTypes']['Object1'] + > + export type Object1ImplementingInterface<$SelectionSet extends $$SelectionSets.Object1ImplementingInterface> = + InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Object1ImplementingInterface'] + > + export type Object2ImplementingInterface<$SelectionSet extends $$SelectionSets.Object2ImplementingInterface> = + InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Object2ImplementingInterface'] + > + export type ObjectNested<$SelectionSet extends $$SelectionSets.ObjectNested> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema['allTypes']['ObjectNested'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['ObjectNested'] > - export type ObjectUnion<$SelectionSet extends SelectionSets.ObjectUnion> = InferResult.OutputObject< + export type ObjectUnion<$SelectionSet extends $$SelectionSets.ObjectUnion> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema['allTypes']['ObjectUnion'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['ObjectUnion'] > - export type lowerCaseObject<$SelectionSet extends SelectionSets.lowerCaseObject> = InferResult.OutputObject< + export type lowerCaseObject<$SelectionSet extends $$SelectionSets.lowerCaseObject> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema['allTypes']['lowerCaseObject'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['lowerCaseObject'] > - export type lowerCaseObject2<$SelectionSet extends SelectionSets.lowerCaseObject2> = InferResult.OutputObject< + export type lowerCaseObject2<$SelectionSet extends $$SelectionSets.lowerCaseObject2> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema['allTypes']['lowerCaseObject2'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['lowerCaseObject2'] > // Union // -------------------------------------------------------------------------------------------------- // - export type DateUnion<$SelectionSet extends SelectionSets.DateUnion> = InferResult.Union< + export type DateUnion<$SelectionSet extends $$SelectionSets.DateUnion> = InferResult.Union< $SelectionSet, - Schema, - Schema['allTypes']['DateUnion'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['DateUnion'] > - export type FooBarUnion<$SelectionSet extends SelectionSets.FooBarUnion> = InferResult.Union< + export type FooBarUnion<$SelectionSet extends $$SelectionSets.FooBarUnion> = InferResult.Union< $SelectionSet, - Schema, - Schema['allTypes']['FooBarUnion'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['FooBarUnion'] > - export type Result<$SelectionSet extends SelectionSets.Result> = InferResult.Union< + export type Result<$SelectionSet extends $$SelectionSets.Result> = InferResult.Union< $SelectionSet, - Schema, - Schema['allTypes']['Result'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['Result'] > - export type lowerCaseUnion<$SelectionSet extends SelectionSets.lowerCaseUnion> = InferResult.Union< + export type lowerCaseUnion<$SelectionSet extends $$SelectionSets.lowerCaseUnion> = InferResult.Union< $SelectionSet, - Schema, - Schema['allTypes']['lowerCaseUnion'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['lowerCaseUnion'] > // Interface // -------------------------------------------------------------------------------------------------- // - export type DateInterface1<$SelectionSet extends SelectionSets.DateInterface1> = InferResult.Interface< + export type DateInterface1<$SelectionSet extends $$SelectionSets.DateInterface1> = InferResult.Interface< $SelectionSet, - Schema, - Schema['allTypes']['DateInterface1'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['DateInterface1'] > - export type Error<$SelectionSet extends SelectionSets.Error> = InferResult.Interface< + export type Error<$SelectionSet extends $$SelectionSets.Error> = InferResult.Interface< $SelectionSet, - Schema, - Schema['allTypes']['Error'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['Error'] > - export type Interface<$SelectionSet extends SelectionSets.Interface> = InferResult.Interface< + export type Interface<$SelectionSet extends $$SelectionSets.Interface> = InferResult.Interface< $SelectionSet, - Schema, - Schema['allTypes']['Interface'] + $$Schema.Schema, + $$Schema.Schema['allTypes']['Interface'] > } " `; -exports[`kitchen-sink generated modules > modules/SelectionSets.ts 1`] = ` +exports[`kitchen-sink generated modules > modules/selection-sets.ts 1`] = ` "import type { Select as $Select } from '../../../../../../src/entrypoints/schema.js' import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' @@ -7280,8 +7300,8 @@ export namespace $NamedTypes { exports[`root-types-mapped 1`] = ` "import type { Schema as $ } from 'graffle/utilities-for-generated' import type * as $$Utilities from 'graffle/utilities-for-generated' -import type * as Data from './Data.js' -import type * as $Scalar from './Scalar.js' +import * as $$Data from './data.js' +import * as $$Scalar from './scalar.js' export namespace Schema { // @@ -7512,7 +7532,7 @@ export namespace Schema { export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.Registry = $$Utilities.Schema.Scalar.Registry.Empty> extends $ { - name: Data.Name + name: $$Data.Name operationsAvailable: ['query'] RootUnion: Schema.QueryRoot Root: { @@ -7535,17 +7555,17 @@ export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.Registry = $$ exports[`root-types-mapped 2`] = ` "import type { InferResult } from 'graffle/schema' import type * as $$Utilities from 'graffle/utilities-for-generated' -import type { Schema } from './Schema.js' -import type * as SelectionSet from './SelectionSets.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' export interface QueryRootMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.QueryRoot<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.QueryRoot<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationQuery<$SelectionSet, Schema<$Context['scalars']>> + InferResult.OperationQuery<$SelectionSet, $$Schema.Schema<$Context['scalars']>> > > > @@ -7560,12 +7580,12 @@ export interface QueryRootMethods<$Context extends $$Utilities.ClientContext> { > id: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.QueryRoot.id<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.QueryRoot.id<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ id: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ id: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'id' > > diff --git a/src/generator/generator/generate.test.ts b/src/generator/generator/generate.test.ts index 7f49aff1f..81bf298bb 100644 --- a/src/generator/generator/generate.test.ts +++ b/src/generator/generator/generate.test.ts @@ -32,12 +32,12 @@ test(`root-types-mapped`, async () => { }, }) - const SchemaTs = Memfs.fs.readFileSync(`./graffle/modules/Schema.ts`, `utf8`) + const SchemaTs = Memfs.fs.readFileSync(`./graffle/modules/schema.ts`, `utf8`) expect(SchemaTs).includes(`operationsAvailable: ['query']`) expect(SchemaTs).includes(`RootUnion: Schema.QueryRoot`) expect(SchemaTs).toMatchSnapshot() - const MethodsRootTs = Memfs.fs.readFileSync(`./graffle/modules/MethodsRoot.ts`, `utf8`) + const MethodsRootTs = Memfs.fs.readFileSync(`./graffle/modules/methods-root.ts`, `utf8`) expect(MethodsRootTs).includes(`__typename: 'QueryRoot'`) expect(MethodsRootTs).includes(`InferResult.OperationQuery<$SelectionSet`) expect(MethodsRootTs).toMatchSnapshot() diff --git a/src/generator/generator/generate.ts b/src/generator/generator/generate.ts index df413ded7..488f751ee 100644 --- a/src/generator/generator/generate.ts +++ b/src/generator/generator/generate.ts @@ -13,6 +13,7 @@ import { ModuleGeneratorSchema } from '../generators/Schema.js' import { ModuleGeneratorSchemaDrivenDataMap } from '../generators/SchemaDrivenDataMap.js' import { ModuleGeneratorSelect } from '../generators/Select.js' import { ModuleGeneratorSelectionSets } from '../generators/SelectionSets.js' +import { getFileName, isExportsModule } from '../helpers/moduleGenerator.js' const moduleGenerators = [ ModuleGeneratorGlobal, @@ -55,9 +56,8 @@ export const generate = async (input: Input) => { await Promise.all( generatedModules.map((generatedModule) => { - const isExportsModule = generatedModule.name.match(/^_+$/) !== null // dprint-ignore - const filePath = `${config.paths.project.outputs.root}/${isExportsModule ? `` : `modules/`}${generatedModule.name}.ts` + const filePath = `${config.paths.project.outputs.root}/${isExportsModule(generatedModule.name) ? `` : `modules/`}${getFileName(config, generatedModule)}` return config.fs.writeFile(filePath, generatedModule.content) }), ) diff --git a/src/generator/generators/Client.ts b/src/generator/generators/Client.ts index fa39aaa25..f8e44284d 100644 --- a/src/generator/generators/Client.ts +++ b/src/generator/generators/Client.ts @@ -1,16 +1,18 @@ -import { createModuleGenerator } from '../helpers/moduleGenerator.js' +import { identifiers } from '../helpers/identifiers.js' +import { createModuleGenerator, importModuleGenerator } from '../helpers/moduleGenerator.js' import { ModuleGeneratorData } from './Data.js' import { ModuleGeneratorSchemaDrivenDataMap } from './SchemaDrivenDataMap.js' export const ModuleGeneratorClient = createModuleGenerator( `Client`, ({ config, code }) => { + code(importModuleGenerator(config, ModuleGeneratorSchemaDrivenDataMap)) + code(importModuleGenerator(config, ModuleGeneratorData)) code( `import { createPrefilled } from '${config.paths.imports.grafflePackage.client}'`, - `import { defaultSchemaUrl } from './${ModuleGeneratorData.name}.js'`, - `import { schemaDrivenDataMap } from './${ModuleGeneratorSchemaDrivenDataMap.name}.js'`, - `import { Name } from './${ModuleGeneratorData.name}.js'`, ) - code(`export const create = createPrefilled(Name, schemaDrivenDataMap, defaultSchemaUrl)`) + code( + `export const create = createPrefilled(${identifiers.$$Data}.Name, ${identifiers.$$SchemaDrivenDataMap}.schemaDrivenDataMap, ${identifiers.$$Data}.defaultSchemaUrl)`, + ) }, ) diff --git a/src/generator/generators/MethodsDocument.ts b/src/generator/generators/MethodsDocument.ts index 51b04fa40..887cb09a0 100644 --- a/src/generator/generators/MethodsDocument.ts +++ b/src/generator/generators/MethodsDocument.ts @@ -1,30 +1,37 @@ // todo remove use of Utils.Aug when schema errors not in use // todo jsdoc +import { Code } from '../../lib/Code.js' import { identifiers } from '../helpers/identifiers.js' -import { createModuleGenerator } from '../helpers/moduleGenerator.js' +import { createModuleGenerator, importModuleGenerator } from '../helpers/moduleGenerator.js' import { ModuleGeneratorSchema } from './Schema.js' import { ModuleGeneratorSelectionSets } from './SelectionSets.js' export const ModuleGeneratorMethodsDocument = createModuleGenerator( `MethodsDocument`, ({ config, code }) => { + code(importModuleGenerator(config, ModuleGeneratorSelectionSets)) + code(importModuleGenerator(config, ModuleGeneratorSchema)) code(` - import type * as SelectionSets from './${ModuleGeneratorSelectionSets.name}.js' - import type * as Utilities from '${config.paths.imports.grafflePackage.utilitiesForGenerated}' - import type { ${identifiers.Schema} } from './${ModuleGeneratorSchema.name}.js' + import type * as ${identifiers.$$Utilities} from '${config.paths.imports.grafflePackage.utilitiesForGenerated}' `) - code(`export interface Document<$Context extends Utilities.ClientContext> { - <$Document>(document: Utilities.ExactNonEmpty<$Document, SelectionSets.$Document<$Context['scalars']>>): Utilities.DocumentRunner< - $Context, - ${identifiers.Schema}, - // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as - // Satisfying the constraint on the DocumentRunner type. - $Document - > - }`) + code() + code(Code.tsInterface({ + name: `Document`, + parameters: [`$Context extends ${identifiers.$$Utilities}.ClientContext`], + // dprint-ignore + block: ` + <$Document>(document: ${identifiers.$$Utilities}.ExactNonEmpty<$Document, ${identifiers.$$SelectionSets}.$Document<$Context['scalars']>>): ${identifiers.$$Utilities}.DocumentRunner< + $Context, + ${identifiers.$$Schema}.${identifiers.Schema}, + // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as + // Satisfying the constraint on the DocumentRunner type. + $Document + > + `, + })) code() code(` - export interface BuilderMethodsDocumentFn extends Utilities.TypeFunction.Fn { + export interface BuilderMethodsDocumentFn extends ${identifiers.$$Utilities}.TypeFunction.Fn { // @ts-expect-error parameter is Untyped. return: Document } diff --git a/src/generator/generators/MethodsRoot.ts b/src/generator/generators/MethodsRoot.ts index 88216c88b..4fdb34770 100644 --- a/src/generator/generators/MethodsRoot.ts +++ b/src/generator/generators/MethodsRoot.ts @@ -3,7 +3,7 @@ import { Grafaid } from '../../lib/grafaid/__.js' import { capitalizeFirstLetter, entries } from '../../lib/prelude.js' import type { Config } from '../config/config.js' import { identifiers } from '../helpers/identifiers.js' -import { createModuleGenerator } from '../helpers/moduleGenerator.js' +import { createModuleGenerator, importModuleGenerator } from '../helpers/moduleGenerator.js' import { createCodeGenerator } from '../helpers/moduleGeneratorRunner.js' import { renderDocumentation, renderName } from '../helpers/render.js' import { ModuleGeneratorSchema } from './Schema.js' @@ -12,11 +12,11 @@ import { ModuleGeneratorSelectionSets } from './SelectionSets.js' export const ModuleGeneratorMethodsRoot = createModuleGenerator( `MethodsRoot`, ({ config, code }) => { + code(importModuleGenerator(config, ModuleGeneratorSelectionSets)) + code(importModuleGenerator(config, ModuleGeneratorSchema)) code( `import type * as ${identifiers.$$Utilities} from '${config.paths.imports.grafflePackage.utilitiesForGenerated}';`, `import type { InferResult } from '${config.paths.imports.grafflePackage.schema}'`, - `import type { ${identifiers.Schema} } from './${ModuleGeneratorSchema.name}.js'`, - `import type * as SelectionSet from './${ModuleGeneratorSelectionSets.name}.js'`, ) code() code() @@ -52,12 +52,12 @@ const renderRootType = createCodeGenerator<{ node: Grafaid.Schema.ObjectType }>( // dprint-ignore code(` export interface ${node.name}Methods<$Context extends ${identifiers.$$Utilities}.ClientContext> { - $batch: <$SelectionSet>(selectionSet: ${identifiers.$$Utilities}.Exact<$SelectionSet, SelectionSet.${node.name}<$Context['scalars']>>) => + $batch: <$SelectionSet>(selectionSet: ${identifiers.$$Utilities}.Exact<$SelectionSet, ${identifiers.$$SelectionSets}.${node.name}<$Context['scalars']>>) => Promise< ${identifiers.$$Utilities}.Simplify< ${identifiers.$$Utilities}.HandleOutput< $Context, - InferResult.Operation${capitalizeFirstLetter(operationType)}<$SelectionSet, ${identifiers.Schema}<$Context['scalars']>> + InferResult.Operation${capitalizeFirstLetter(operationType)}<$SelectionSet, ${identifiers.$$Schema}.${identifiers.Schema}<$Context['scalars']>> > > > @@ -88,12 +88,12 @@ const renderFieldMethods = createCodeGenerator<{ node: Grafaid.Schema.ObjectType const operationType = getOperationTypeOrThrow(config, node) // dprint-ignore code(` - ${field.name}: <$SelectionSet>(selectionSet${isOptional ? `?` : ``}: ${identifiers.$$Utilities}.Exact<$SelectionSet, SelectionSet.${renderName(node)}.${renderName(field)}<$Context['scalars']>>) => + ${field.name}: <$SelectionSet>(selectionSet${isOptional ? `?` : ``}: ${identifiers.$$Utilities}.Exact<$SelectionSet, ${identifiers.$$SelectionSets}.${renderName(node)}.${renderName(field)}<$Context['scalars']>>) => Promise< ${identifiers.$$Utilities}.Simplify< ${identifiers.$$Utilities}.HandleOutputGraffleRootField< $Context, - InferResult.Operation${capitalizeFirstLetter(operationType)}<{ ${field.name}: $SelectionSet}, ${identifiers.Schema}<$Context['scalars']>>, + InferResult.Operation${capitalizeFirstLetter(operationType)}<{ ${field.name}: $SelectionSet}, ${identifiers.$$Schema}.${identifiers.Schema}<$Context['scalars']>>, '${field.name}' > > diff --git a/src/generator/generators/MethodsSelect.ts b/src/generator/generators/MethodsSelect.ts index f3e3fcc8f..5edbfd883 100644 --- a/src/generator/generators/MethodsSelect.ts +++ b/src/generator/generators/MethodsSelect.ts @@ -2,7 +2,8 @@ import { Code } from '../../lib/Code.js' import { entries, pick, values } from '../../lib/prelude.js' import { Tex } from '../../lib/tex/__.js' -import { createModuleGenerator } from '../helpers/moduleGenerator.js' +import { identifiers } from '../helpers/identifiers.js' +import { createModuleGenerator, importModuleGenerator } from '../helpers/moduleGenerator.js' import { renderName } from '../helpers/render.js' import { ModuleGeneratorSelectionSets } from './SelectionSets.js' @@ -12,14 +13,16 @@ export const ModuleGeneratorMethodsSelect = createModuleGenerator( const kindMap = pick(config.schema.kindMap.list, [`Root`, `OutputObject`, `Union`, `Interface`]) const kinds = entries(kindMap) - code(`import type * as $SelectionSets from './${ModuleGeneratorSelectionSets.name}.js'`) - code(`import type * as $Utilities from '${config.paths.imports.grafflePackage.utilitiesForGenerated}'`) + code(importModuleGenerator(config, ModuleGeneratorSelectionSets)) + code( + `import type * as ${identifiers.$$Utilities} from '${config.paths.imports.grafflePackage.utilitiesForGenerated}'`, + ) code() code(Tex.title1(`Select Methods Interface`)) code() code(Code.tsInterface({ name: `$MethodsSelect`, - fields: values(kindMap).flatMap(type => { + block: values(kindMap).flatMap(type => { return type.map(type => { return [type.name, renderName(type)] as const }) @@ -32,8 +35,10 @@ export const ModuleGeneratorMethodsSelect = createModuleGenerator( for (const type of kind) { code(Code.tsInterface({ name: type.name, - fields: ` - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.${renderName(type)}>): + block: ` + <$SelectionSet>(selectionSet: ${identifiers.$$Utilities}.Exact<$SelectionSet, $$SelectionSets.${ + renderName(type) + }>): $SelectionSet `, })) diff --git a/src/generator/generators/Scalar.ts b/src/generator/generators/Scalar.ts index d256b5450..5a54ce129 100644 --- a/src/generator/generators/Scalar.ts +++ b/src/generator/generators/Scalar.ts @@ -16,11 +16,11 @@ export const ModuleGeneratorScalar = createModuleGenerator( code() if (Grafaid.Schema.KindMap.hasCustomScalars(config.schema.kindMap) && config.options.customScalars) { - code(`import * as ${identifiers.CustomScalars} from '${config.paths.imports.customScalarCodecs}'`) + code(`import * as ${identifiers.CustomScalars} from '${config.paths.imports.scalars}'`) code() - code(`export * from '${config.paths.imports.customScalarCodecs}'`) + code(`export * from '${config.paths.imports.scalars}'`) const names = config.schema.kindMap.list.ScalarCustom.map((scalar) => scalar.name).join(`, `) - code(`export { ${names} } from '${config.paths.imports.customScalarCodecs}'`) + code(`export { ${names} } from '${config.paths.imports.scalars}'`) for (const scalar of config.schema.kindMap.list.ScalarCustom) { code(typeTitle2(`custom scalar type`)(scalar)) code() diff --git a/src/generator/generators/Schema.ts b/src/generator/generators/Schema.ts index dc6c6bb09..5ee6b4c86 100644 --- a/src/generator/generators/Schema.ts +++ b/src/generator/generators/Schema.ts @@ -3,7 +3,7 @@ import { Grafaid } from '../../lib/grafaid/__.js' import { entries, isObjectEmpty, values } from '../../lib/prelude.js' import { Tex } from '../../lib/tex/__.js' import { identifiers } from '../helpers/identifiers.js' -import { createModuleGenerator } from '../helpers/moduleGenerator.js' +import { createModuleGenerator, importModuleGenerator } from '../helpers/moduleGenerator.js' import { type CodeGenerator, createCodeGenerator } from '../helpers/moduleGeneratorRunner.js' import { getTsDocContents, renderInlineType, renderName } from '../helpers/render.js' import type { KindRenderers } from '../helpers/types.js' @@ -18,10 +18,10 @@ export const ModuleGeneratorSchema = createModuleGenerator( // todo methods root is unused code(` - import type * as Data from './${ModuleGeneratorData.name}.js' + ${importModuleGenerator(config, ModuleGeneratorData)} + ${importModuleGenerator(config, ModuleGeneratorScalar)} import type { Schema as $ } from '${config.paths.imports.grafflePackage.utilitiesForGenerated}' import type * as ${identifiers.$$Utilities} from '${config.paths.imports.grafflePackage.utilitiesForGenerated}' - import type * as $Scalar from './${ModuleGeneratorScalar.name}.js' `) code() @@ -85,7 +85,7 @@ const OutputObject = createCodeGenerator<{ type: Grafaid.Schema.ObjectType }>(({ tsDoc: getTsDocContents(config, type), name: type.name, extends: `$.OutputObject`, - fields: { + block: { name: Code.string(type.name), fields: interfaceFields, }, @@ -98,7 +98,7 @@ const OutputObject = createCodeGenerator<{ type: Grafaid.Schema.ObjectType }>(({ export: true, name: `__typename`, extends: `$.OutputField`, - fields: { + block: { name: Code.string(`__typename`), arguments: {}, inlineType: `[1]`, @@ -116,7 +116,7 @@ const OutputObject = createCodeGenerator<{ type: Grafaid.Schema.ObjectType }>(({ export: true, name: field.name, extends: `$.OutputField`, - fields: { + block: { name: Code.string(field.name), arguments: Object.fromEntries(field.args.map(arg => { return [ @@ -150,7 +150,7 @@ const Enum = createCodeGenerator<{ type: Grafaid.Schema.EnumType }>(({ config, c export: true, name: type.name, extends: `$.Enum`, - fields: { + block: { name: Code.string(type.name), members: Code.tsTuple(type.getValues().map((_) => Code.string(_.name))), membersUnion: Code.tsUnionItems(type.getValues().map((_) => Code.string(_.name))), @@ -165,7 +165,7 @@ const InputObject = createCodeGenerator<{ type: Grafaid.Schema.InputObjectType } tsDoc: getTsDocContents(config, type), name: type.name, extends: `$.InputObject`, - fields: { + block: { name: Code.string(type.name), isAllFieldsNullable: Code.boolean(Grafaid.Schema.isAllInputObjectFieldsNullable(type)), fields: Object.fromEntries( @@ -186,7 +186,7 @@ const InputObject = createCodeGenerator<{ type: Grafaid.Schema.InputObjectType } tsDoc: getTsDocContents(config, field), name: field.name, extends: `$.InputField`, - fields: { + block: { name: Code.string(field.name), inlineType: renderInlineType(field.type), namedType: namedTypesTypeReference(namedType), @@ -204,7 +204,7 @@ const ScalarStandard = createCodeGenerator<{ type: Grafaid.Schema.ScalarType }>( }) const ScalarCustom = createCodeGenerator<{ type: Grafaid.Schema.ScalarType }>(({ code, type }) => { - code(Code.esmExport(Code.tsType(type.name, `$Scalar.${type.name}`))) + code(Code.esmExport(Code.tsType(type.name, `$$Scalar.${type.name}`))) code() }) @@ -215,7 +215,7 @@ const Union = createCodeGenerator<{ type: Grafaid.Schema.UnionType }>(({ config, export: true, name: type.name, extends: `$.Union`, - fields: { + block: { name: Code.string(type.name), members: Code.tsTuple(memberNames), membersUnion: Code.tsUnionItems(memberNames), @@ -232,7 +232,7 @@ const Interface = createCodeGenerator<{ type: Grafaid.Schema.InterfaceType }>(({ tsDoc: getTsDocContents(config, type), name: type.name, extends: `$.Interface`, - fields: { + block: { name: Code.string(type.name), implementors: Code.tsTuple(implementorNames), implementorsUnion: Code.tsUnionItems(implementorNames), @@ -269,7 +269,7 @@ export const SchemaGenerator = createCodeGenerator( const enums = kindMap.list.Enum.map(_ => [_.name, `${identifiers.Schema}.${_.name}`]) const operationsAvailable = entries(kindMap.index.Root).filter(_ => _[1] !== null).map(_ => _[0]) const schema: Code.TermObject = { - name: `Data.Name`, + name: `$$Data.Name`, operationsAvailable: Code.tsTuple(operationsAvailable.map(_ => Code.string(_))), RootUnion: Code.tsUnionItems(kindMap.list.Root.map(_ => `${identifiers.Schema}.${_.name}`)), Root: { @@ -319,7 +319,7 @@ export const SchemaGenerator = createCodeGenerator( parameters: `$Scalars extends ${identifiers.$$Utilities}.Schema.Scalar.Registry = ${identifiers.$$Utilities}.Schema.Scalar.Registry.Empty`, extends: `$`, - fields: schema, + block: schema, }), ) }, diff --git a/src/generator/generators/SchemaDrivenDataMap.ts b/src/generator/generators/SchemaDrivenDataMap.ts index 4292a9a01..9fcd701d3 100644 --- a/src/generator/generators/SchemaDrivenDataMap.ts +++ b/src/generator/generators/SchemaDrivenDataMap.ts @@ -5,7 +5,7 @@ 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 { createModuleGenerator, importModuleGenerator } from '../helpers/moduleGenerator.js' import { createCodeGenerator } from '../helpers/moduleGeneratorRunner.js' import { renderInlineType } from '../helpers/render.js' import type { KindRenderers } from '../helpers/types.js' @@ -25,7 +25,7 @@ export const ModuleGeneratorSchemaDrivenDataMap = createModuleGenerator( const kinds = entries(kindMap) code(` - import * as ${identifiers.$Scalar} from './${ModuleGeneratorScalar.name}.js' + ${importModuleGenerator(config, ModuleGeneratorScalar)} import type * as ${identifiers.$$Utilities} from '${config.paths.imports.grafflePackage.utilitiesForGenerated}' `) @@ -156,7 +156,7 @@ const ScalarType = createCodeGenerator< { type: Grafaid.Schema.ScalarType } >( ({ code, type }) => { - code(Code.termConst(type.name, `${identifiers.$Scalar}.${type.name}`)) + code(Code.termConst(type.name, `${identifiers.$$Scalar}.${type.name}`)) }, ) @@ -165,7 +165,7 @@ const ScalarTypeCustom = createCodeGenerator< >( ({ config, code, type }) => { if (config.options.isImportsCustomScalars) { - code(Code.termConst(type.name, `${identifiers.$Scalar}.${type.name}`)) + code(Code.termConst(type.name, `${identifiers.$$Scalar}.${type.name}`)) } else { code(Code.termConst(type.name, Code.string(type.name))) } diff --git a/src/generator/generators/Select.ts b/src/generator/generators/Select.ts index 97fe24dce..478cffe32 100644 --- a/src/generator/generators/Select.ts +++ b/src/generator/generators/Select.ts @@ -2,7 +2,7 @@ import { entries } from '../../lib/prelude.js' import { Tex } from '../../lib/tex/__.js' import { identifiers } from '../helpers/identifiers.js' -import { createModuleGenerator } from '../helpers/moduleGenerator.js' +import { createModuleGenerator, importModuleGenerator } from '../helpers/moduleGenerator.js' import { renderName } from '../helpers/render.js' import { ModuleGeneratorData } from './Data.js' import { ModuleGeneratorSchema } from './Schema.js' @@ -11,22 +11,23 @@ import { ModuleGeneratorSelectionSets } from './SelectionSets.js' export const ModuleGeneratorSelect = createModuleGenerator( `Select`, ({ config, code }) => { + const iSchema = `${identifiers.$$Schema}.Schema` const enumMemberName = { query: `QUERY `, mutation: `MUTATION`, subscription: `SUBSCRIPTION`, } as const code(` - import * as Data from './${ModuleGeneratorData.name}.js' + ${importModuleGenerator(config, ModuleGeneratorData)} + ${importModuleGenerator(config, ModuleGeneratorSchema)} + ${importModuleGenerator(config, ModuleGeneratorSelectionSets)} import type { OperationTypeNode } from 'graphql' - import type { ${identifiers.Schema} } from './${ModuleGeneratorSchema.name}.js' import type { InferResult } from '${config.paths.imports.grafflePackage.schema}' - import type * as SelectionSets from './${ModuleGeneratorSelectionSets.name}.js' `) code() code(Tex.title1(`Runtime`)) code(`import { createSelect } from '${config.paths.imports.grafflePackage.client}'`) - code(`export const Select = createSelect(Data.Name)`) + code(`export const Select = createSelect(${identifiers.$$Data}.Name)`) code() code(Tex.title1(`Buildtime`)) code() @@ -35,32 +36,30 @@ export const ModuleGeneratorSelect = createModuleGenerator( code( ...entries(config.schema.kindMap.index.Root).map(([operationType, type]) => { if (!type) return null - return `export type ${type.name}<$SelectionSet extends SelectionSets.${ + return `export type ${type.name}<$SelectionSet extends $$SelectionSets.${ renderName(type) - }> = InferResult.Operation<$SelectionSet, ${identifiers.Schema}, OperationTypeNode.${ - enumMemberName[operationType] - }>` + }> = InferResult.Operation<$SelectionSet, ${iSchema}, OperationTypeNode.${enumMemberName[operationType]}>` }), ) code(Tex.title2(`OutputObject`)) code(...config.schema.kindMap.list.OutputObject.map((type) => { - return `export type ${type.name}<$SelectionSet extends SelectionSets.${ + return `export type ${type.name}<$SelectionSet extends $$SelectionSets.${ renderName(type) - }> = InferResult.OutputObject<$SelectionSet, ${identifiers.Schema}, ${identifiers.Schema}['allTypes']['${type.name}']>` + }> = InferResult.OutputObject<$SelectionSet, ${iSchema}, ${iSchema}['allTypes']['${type.name}']>` })) code(Tex.title2(`Union`)) code(...config.schema.kindMap.list.Union.map((type) => { - return `export type ${type.name}<$SelectionSet extends SelectionSets.${ + return `export type ${type.name}<$SelectionSet extends $$SelectionSets.${ renderName(type) - }> = InferResult.Union<$SelectionSet, ${identifiers.Schema}, ${identifiers.Schema}['allTypes']['${type.name}']>` + }> = InferResult.Union<$SelectionSet, ${iSchema}, ${iSchema}['allTypes']['${type.name}']>` })) code(Tex.title2(`Interface`)) code(...config.schema.kindMap.list.Interface.map((type) => { - return `export type ${type.name}<$SelectionSet extends SelectionSets.${ + return `export type ${type.name}<$SelectionSet extends $$SelectionSets.${ renderName(type) - }> = InferResult.Interface<$SelectionSet, ${identifiers.Schema}, ${identifiers.Schema}['allTypes']['${type.name}']>` + }> = InferResult.Interface<$SelectionSet, ${iSchema}, ${iSchema}['allTypes']['${type.name}']>` })) - code(`}`) // namespace Select + code(`}`) }, ) diff --git a/src/generator/generators/SelectionSets.test-d.ts b/src/generator/generators/SelectionSets.test-d.ts index d5a16c085..55ee50520 100644 --- a/src/generator/generators/SelectionSets.test-d.ts +++ b/src/generator/generators/SelectionSets.test-d.ts @@ -1,7 +1,7 @@ import { assertType, test } from 'vitest' import type { Date } from '../../../tests/_/fixtures/scalars.js' import { db } from '../../../tests/_/schemas/db.js' -import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.js' +import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/selection-sets.js' import type { Schema } from '../../types/Schema/__.js' type Q = SelectionSets.Query diff --git a/src/generator/generators/SelectionSets.ts b/src/generator/generators/SelectionSets.ts index a0c2b7253..e8b98a40d 100644 --- a/src/generator/generators/SelectionSets.ts +++ b/src/generator/generators/SelectionSets.ts @@ -47,7 +47,7 @@ export const ModuleGeneratorSelectionSets = createModuleGenerator( name: `$Document`, parameters: $ScalarsTypeParameter, // dprint-ignore - fields: ` + block: ` ${config.schema.kindMap.index.Root.query ? `query?: Record>` : ``} ${config.schema.kindMap.index.Root.mutation ? `mutation?: Record>` : ``} `, @@ -104,7 +104,7 @@ const Union = createCodeGenerator<{ type: Grafaid.Schema.UnionType }>( tsDoc: getTsDocContents(config, type), name: type.name, parameters: $ScalarsTypeParameter, - fields: ` + block: ` ${H.__typenameField(`union`)} ${fragmentsInlineType} ${H.fragmentInlineField(type)} @@ -132,7 +132,7 @@ const InputObject = createCodeGenerator<{ type: Grafaid.Schema.InputObjectType } tsDoc: getTsDocContents(config, type), name: type.name, parameters: $ScalarsTypeParameter, - fields: values(type.getFields()).map(field => getInputFieldLike(config, field)), + block: values(type.getFields()).map(field => getInputFieldLike(config, field)), })) }, ) @@ -155,7 +155,7 @@ const Interface = createCodeGenerator<{ type: Grafaid.Schema.InterfaceType }>( name: type.name, parameters: $ScalarsTypeParameter, extends: [`$Select.Bases.ObjectLike`], - fields: ` + block: ` ${fieldsRendered} ${onTypesRendered} ${H.fragmentInlineField(type)} @@ -207,7 +207,7 @@ const OutputObject = createCodeGenerator<{ type: Grafaid.Schema.ObjectType }>( name: type.name, parameters: $ScalarsTypeParameter, extends: [extendsClause], - fields: ` + block: ` ${fieldKeys} ${H.fragmentInlineField(type)} ${H.__typenameField(`object`)} @@ -276,7 +276,7 @@ const renderOutputField = createCodeGenerator<{ field: Grafaid.Schema.Field getInputFieldLike(config, arg)), + block: field.args.map(arg => getInputFieldLike(config, arg)), })) code() } @@ -456,7 +456,7 @@ namespace H { name: `${renderName(node)}${fragmentInlineNameSuffix}`, parameters: $ScalarsTypeParameter, extends: [forwardTypeParameter$Scalars(node), `$Select.Directive.$Groups.InlineFragment.Fields`], - fields: {}, + block: {}, }) } diff --git a/src/generator/generators/_.ts b/src/generator/generators/_.ts index 72a2feeb1..1764969fe 100644 --- a/src/generator/generators/_.ts +++ b/src/generator/generators/_.ts @@ -1,23 +1,26 @@ -import { createModuleGenerator } from '../helpers/moduleGenerator.js' +import { createModuleGenerator, getImportName } from '../helpers/moduleGenerator.js' import { ModuleGeneratorClient } from './Client.js' +import { ModuleGeneratorGlobal } from './global.js' import { ModuleGeneratorSchemaDrivenDataMap } from './SchemaDrivenDataMap.js' import { ModuleGeneratorSelect } from './Select.js' import { ModuleGeneratorSelectionSets } from './SelectionSets.js' export const ModuleGenerator_ = createModuleGenerator( `_`, - ({ code }) => { + ({ code, config }) => { + code(` + // We import the global module for good measure although it is not clear it is always needed. + // It at least helps with Twoslash wherein without this import here Twoslash will not include the global module. + // In real TypeScript projects it seems the global module is included automatically. But there could be certain tsconfig + // setups where this still indeed does help. + import './modules/${getImportName(config, ModuleGeneratorGlobal)}' + `) + code() code( - `// We import the global module for good measure although it is not clear it is always needed.`, - `// It at least helps with Twoslash wherein without this import here Twoslash will not include the global module.`, - `// In real TypeScript projects it seems the global module is included automatically. But there could be certain tsconfig`, - `// setups where this still indeed does help.`, - `import './modules/Global.js'`, - ``, - `export { Select } from './modules/${ModuleGeneratorSelect.name}.js'`, - `export { create } from './modules/${ModuleGeneratorClient.name}.js'`, - `export * as SelectionSets from './modules/${ModuleGeneratorSelectionSets.name}.js'`, - `export { schemaDrivenDataMap } from './modules/${ModuleGeneratorSchemaDrivenDataMap.name}.js'`, + `export { Select } from './modules/${getImportName(config, ModuleGeneratorSelect)}'`, + `export { create } from './modules/${getImportName(config, ModuleGeneratorClient)}'`, + `export * as SelectionSets from './modules/${getImportName(config, ModuleGeneratorSelectionSets)}'`, + `export { schemaDrivenDataMap } from './modules/${getImportName(config, ModuleGeneratorSchemaDrivenDataMap)}'`, ) return code diff --git a/src/generator/generators/__.ts b/src/generator/generators/__.ts index 0f9d13f95..2d1fbc855 100644 --- a/src/generator/generators/__.ts +++ b/src/generator/generators/__.ts @@ -1,6 +1,6 @@ import { capitalizeFirstLetter } from '../../lib/prelude.js' import { defaultName } from '../config/defaults.js' -import { createModuleGenerator } from '../helpers/moduleGenerator.js' +import { createModuleGenerator, getImportName } from '../helpers/moduleGenerator.js' import { ModuleGenerator_ } from './_.js' // todo remove, use config.name simply, any processing, do in config constructor @@ -11,7 +11,7 @@ export const ModuleGenerator__ = createModuleGenerator( ({ config, code }) => { const namespace = config.name === defaultName ? defaultNamespace : capitalizeFirstLetter(config.name) code( - `export * as ${namespace} from './${ModuleGenerator_.name}.js'`, + `export * as ${namespace} from './${getImportName(config, ModuleGenerator_)}'`, ) return code }, diff --git a/src/generator/generators/global.ts b/src/generator/generators/global.ts index fa0ed32e1..057676881 100644 --- a/src/generator/generators/global.ts +++ b/src/generator/generators/global.ts @@ -1,6 +1,6 @@ import { Code } from '../../lib/Code.js' import { identifiers } from '../helpers/identifiers.js' -import { createModuleGenerator } from '../helpers/moduleGenerator.js' +import { createModuleGenerator, importModuleGenerator } from '../helpers/moduleGenerator.js' import { ModuleGeneratorData } from './Data.js' import { ModuleGeneratorMethodsDocument } from './MethodsDocument.js' import { ModuleGeneratorMethodsRoot } from './MethodsRoot.js' @@ -10,13 +10,11 @@ import { ModuleGeneratorSchema } from './Schema.js' export const ModuleGeneratorGlobal = createModuleGenerator( `Global`, ({ config, code }) => { - code( - `import type * as Data from './${ModuleGeneratorData.name}.js'`, - `import type * as MethodsSelect from './${ModuleGeneratorMethodsSelect.name}.js'`, - `import type * as MethodsDocument from './${ModuleGeneratorMethodsDocument.name}.js'`, - `import type * as MethodsRoot from './${ModuleGeneratorMethodsRoot.name}.js'`, - `import type { ${identifiers.Schema} } from './${ModuleGeneratorSchema.name}.js'`, - ) + code(importModuleGenerator(config, ModuleGeneratorData)) + code(importModuleGenerator(config, ModuleGeneratorMethodsSelect)) + code(importModuleGenerator(config, ModuleGeneratorMethodsDocument)) + code(importModuleGenerator(config, ModuleGeneratorMethodsRoot)) + code(importModuleGenerator(config, ModuleGeneratorSchema)) code() const defaultSchemaUrlTsDoc = config.options.defaultSchemaUrl @@ -25,12 +23,12 @@ export const ModuleGeneratorGlobal = createModuleGenerator( const Clients = Code.termObjectFields({ [config.name]: { - name: `Data.Name`, - schema: identifiers.Schema, + name: `${identifiers.$$Data}.Name`, + schema: `${identifiers.$$Schema}.${identifiers.Schema}`, interfaces: { - MethodsSelect: `MethodsSelect.$MethodsSelect`, - Document: `MethodsDocument.BuilderMethodsDocumentFn`, - Root: `MethodsRoot.BuilderMethodsRootFn`, + MethodsSelect: `${identifiers.$$MethodsSelect}.$MethodsSelect`, + Document: `${identifiers.$$MethodsDocument}.BuilderMethodsDocumentFn`, + Root: `${identifiers.$$MethodsRoot}.BuilderMethodsRootFn`, }, defaultSchemaUrl: { $TS_DOC: defaultSchemaUrlTsDoc, diff --git a/src/generator/helpers/helpers.ts b/src/generator/helpers/helpers.ts new file mode 100644 index 000000000..e69de29bb diff --git a/src/generator/helpers/identifiers.ts b/src/generator/helpers/identifiers.ts index b9d364b7a..3e989bf28 100644 --- a/src/generator/helpers/identifiers.ts +++ b/src/generator/helpers/identifiers.ts @@ -1,9 +1,14 @@ export const identifiers = { - Schema: `Schema`, - $Schema: `$Schema`, + $$Schema: `$$Schema`, + $$Scalar: `$$Scalar`, + $$SelectionSets: `$$SelectionSets`, + $$MethodsSelect: `$$MethodsSelect`, + $$MethodsDocument: `$$MethodsDocument`, + $$MethodsRoot: `$$MethodsRoot`, + $$Data: `$$Data`, + $$SchemaDrivenDataMap: `$$SchemaDrivenDataMap`, $$Utilities: `$$Utilities`, - MethodsRoot: `MethodsRoot`, - $Scalar: `$Scalar`, + Schema: `Schema`, CustomScalars: `CustomScalars`, StandardScalar: `StandardScalar`, } diff --git a/src/generator/helpers/moduleGenerator.ts b/src/generator/helpers/moduleGenerator.ts index 47fe3f1ae..fc8a1129f 100644 --- a/src/generator/helpers/moduleGenerator.ts +++ b/src/generator/helpers/moduleGenerator.ts @@ -1,3 +1,5 @@ +import { camelCase, kebabCase, pascalCase, snakeCase } from 'es-toolkit' +import type { Config } from '../config/config.js' import { createCodeGenerator, type ModuleGeneratorRunner, @@ -41,3 +43,32 @@ export const createModuleGenerator: FactoryModuleGenerator = (name, runnerImplem generate, } } + +export const importModuleGenerator = (config: Config, generator: ModuleGenerator) => { + return `import * as $$${pascalCase(generator.name)} from './${getImportName(config, generator)}'` +} + +export const getBaseName = (config: Config, generator: ModuleGenerator | GeneratedModule) => { + return isExportsModule(generator.name) + ? generator.name + : caseFormatters[config.outputCase](generator.name) +} + +export const getFileName = (config: Config, generator: ModuleGenerator | GeneratedModule) => { + const name = getBaseName(config, generator) + return `${name}.ts` +} + +export const getImportName = (config: Config, generator: ModuleGenerator | GeneratedModule) => { + const name = getBaseName(config, generator) + return `${name}.js` +} + +export const caseFormatters = { + pascal: pascalCase, + camel: camelCase, + kebab: kebabCase, + snake: snakeCase, +} + +export const isExportsModule = (name: string) => name.match(/^_+$/) !== null diff --git a/src/lib/Code.ts b/src/lib/Code.ts index 4456bd455..258812807 100644 --- a/src/lib/Code.ts +++ b/src/lib/Code.ts @@ -214,13 +214,13 @@ export namespace Code { interface InterfaceDefinitionInput extends TypeDefinitionInput { extends?: ExtendsClauseInput - fields?: FieldsInput + block?: FieldsInput } type FieldsInput = string | TermObject | (readonly [name: string, field: string | DirectiveField])[] export const tsInterface = ( - { name, parameters, extends: extends_, fields, tsDoc, export: export_ }: InterfaceDefinitionInput, + { name, parameters, extends: extends_, block, tsDoc, export: export_ }: InterfaceDefinitionInput, ) => { const tsDoc_ = tsDoc ? TSDoc(tsDoc) + `\n` : `` const export__ = export_ === false ? `` : `export ` @@ -230,12 +230,12 @@ export namespace Code { const extends___ = extends__.length > 0 ? ` extends ${extends__.join(`, `)}` : `` - const block = typeof fields === `string` - ? `{${fields}}` - : Array.isArray(fields) - ? termObject(Object.fromEntries(fields)) - : termObject(fields ?? {}) - return `${tsDoc_} ${export__} interface ${name_} ${typeParametersClause} ${extends___} ${block}` + const block_ = typeof block === `string` + ? `{${block}}` + : Array.isArray(block) + ? termObject(Object.fromEntries(block)) + : termObject(block ?? {}) + return `${tsDoc_} ${export__} interface ${name_} ${typeParametersClause} ${extends___} ${block_}` } export const esmExport = (thing: string) => { diff --git a/tests/_/schemas/generate.ts b/tests/_/schemas/generate.ts index ff3dbe139..9cab5293d 100644 --- a/tests/_/schemas/generate.ts +++ b/tests/_/schemas/generate.ts @@ -62,6 +62,6 @@ await generate({ await generate({ dirName: `kitchen-sink`, // input: { - // // customScalarCodecs: `./kitchen-sink/customScalarCodecs.ts`, + // // scalars: `./kitchen-sink/scalars.ts`, // }, }) diff --git a/tests/_/schemas/kitchen-sink/graffle/_.ts b/tests/_/schemas/kitchen-sink/graffle/_.ts index d27e9e3d3..260860931 100644 --- a/tests/_/schemas/kitchen-sink/graffle/_.ts +++ b/tests/_/schemas/kitchen-sink/graffle/_.ts @@ -2,9 +2,9 @@ // It at least helps with Twoslash wherein without this import here Twoslash will not include the global module. // In real TypeScript projects it seems the global module is included automatically. But there could be certain tsconfig // setups where this still indeed does help. -import './modules/Global.js' +import './modules/global.js' -export { create } from './modules/Client.js' -export { schemaDrivenDataMap } from './modules/SchemaDrivenDataMap.js' -export { Select } from './modules/Select.js' -export * as SelectionSets from './modules/SelectionSets.js' +export { create } from './modules/client.js' +export { schemaDrivenDataMap } from './modules/schema-driven-data-map.js' +export { Select } from './modules/select.js' +export * as SelectionSets from './modules/selection-sets.js' diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/Client.ts b/tests/_/schemas/kitchen-sink/graffle/modules/Client.ts deleted file mode 100644 index 9080daf87..000000000 --- a/tests/_/schemas/kitchen-sink/graffle/modules/Client.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createPrefilled } from '../../../../../../src/entrypoints/client.js' -import { defaultSchemaUrl } from './Data.js' -import { Name } from './Data.js' -import { schemaDrivenDataMap } from './SchemaDrivenDataMap.js' -export const create = createPrefilled(Name, schemaDrivenDataMap, defaultSchemaUrl) diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/Global.ts b/tests/_/schemas/kitchen-sink/graffle/modules/Global.ts deleted file mode 100644 index 5e242e36f..000000000 --- a/tests/_/schemas/kitchen-sink/graffle/modules/Global.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type * as Data from './Data.js' -import type * as MethodsDocument from './MethodsDocument.js' -import type * as MethodsRoot from './MethodsRoot.js' -import type * as MethodsSelect from './MethodsSelect.js' -import type { Schema } from './Schema.js' - -declare global { - export namespace GraffleGlobal { - export interface Clients { - default: { - name: Data.Name - schema: Schema - interfaces: { - MethodsSelect: MethodsSelect.$MethodsSelect - Document: MethodsDocument.BuilderMethodsDocumentFn - Root: MethodsRoot.BuilderMethodsRootFn - } - defaultSchemaUrl: null - } - } - } -} diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/MethodsDocument.ts b/tests/_/schemas/kitchen-sink/graffle/modules/MethodsDocument.ts deleted file mode 100644 index f12a02bd5..000000000 --- a/tests/_/schemas/kitchen-sink/graffle/modules/MethodsDocument.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type * as Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type { Schema } from './Schema.js' -import type * as SelectionSets from './SelectionSets.js' -export interface Document<$Context extends Utilities.ClientContext> { - <$Document>( - document: Utilities.ExactNonEmpty<$Document, SelectionSets.$Document<$Context['scalars']>>, - ): Utilities.DocumentRunner< - $Context, - Schema, - // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as - // Satisfying the constraint on the DocumentRunner type. - $Document - > -} - -export interface BuilderMethodsDocumentFn extends Utilities.TypeFunction.Fn { - // @ts-expect-error parameter is Untyped. - return: Document -} diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/Select.ts b/tests/_/schemas/kitchen-sink/graffle/modules/Select.ts deleted file mode 100644 index 49d882ca5..000000000 --- a/tests/_/schemas/kitchen-sink/graffle/modules/Select.ts +++ /dev/null @@ -1,158 +0,0 @@ -import type { OperationTypeNode } from 'graphql' -import type { InferResult } from '../../../../../../src/entrypoints/schema.js' -import * as Data from './Data.js' -import type { Schema } from './Schema.js' -import type * as SelectionSets from './SelectionSets.js' - -// -// -// -// -// -// -// ================================================================================================== -// Runtime -// ================================================================================================== -// -// -// -// -// -// -import { createSelect } from '../../../../../../src/entrypoints/client.js' -export const Select = createSelect(Data.Name) - -// -// -// -// -// -// -// ================================================================================================== -// Buildtime -// ================================================================================================== -// -// -// -// -// -// - -export namespace Select { - // Root - // -------------------------------------------------------------------------------------------------- - // - export type Query<$SelectionSet extends SelectionSets.Query> = InferResult.Operation< - $SelectionSet, - Schema, - OperationTypeNode.QUERY - > - export type Mutation<$SelectionSet extends SelectionSets.Mutation> = InferResult.Operation< - $SelectionSet, - Schema, - OperationTypeNode.MUTATION - > - // OutputObject - // -------------------------------------------------------------------------------------------------- - // - export type Bar<$SelectionSet extends SelectionSets.Bar> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['Bar'] - > - export type DateObject1<$SelectionSet extends SelectionSets.DateObject1> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['DateObject1'] - > - export type DateObject2<$SelectionSet extends SelectionSets.DateObject2> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['DateObject2'] - > - export type ErrorOne<$SelectionSet extends SelectionSets.ErrorOne> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['ErrorOne'] - > - export type ErrorTwo<$SelectionSet extends SelectionSets.ErrorTwo> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['ErrorTwo'] - > - export type Foo<$SelectionSet extends SelectionSets.Foo> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['Foo'] - > - export type Object1<$SelectionSet extends SelectionSets.Object1> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['Object1'] - > - export type Object1ImplementingInterface<$SelectionSet extends SelectionSets.Object1ImplementingInterface> = - InferResult.OutputObject<$SelectionSet, Schema, Schema['allTypes']['Object1ImplementingInterface']> - export type Object2ImplementingInterface<$SelectionSet extends SelectionSets.Object2ImplementingInterface> = - InferResult.OutputObject<$SelectionSet, Schema, Schema['allTypes']['Object2ImplementingInterface']> - export type ObjectNested<$SelectionSet extends SelectionSets.ObjectNested> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['ObjectNested'] - > - export type ObjectUnion<$SelectionSet extends SelectionSets.ObjectUnion> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['ObjectUnion'] - > - export type lowerCaseObject<$SelectionSet extends SelectionSets.lowerCaseObject> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['lowerCaseObject'] - > - export type lowerCaseObject2<$SelectionSet extends SelectionSets.lowerCaseObject2> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['lowerCaseObject2'] - > - // Union - // -------------------------------------------------------------------------------------------------- - // - export type DateUnion<$SelectionSet extends SelectionSets.DateUnion> = InferResult.Union< - $SelectionSet, - Schema, - Schema['allTypes']['DateUnion'] - > - export type FooBarUnion<$SelectionSet extends SelectionSets.FooBarUnion> = InferResult.Union< - $SelectionSet, - Schema, - Schema['allTypes']['FooBarUnion'] - > - export type Result<$SelectionSet extends SelectionSets.Result> = InferResult.Union< - $SelectionSet, - Schema, - Schema['allTypes']['Result'] - > - export type lowerCaseUnion<$SelectionSet extends SelectionSets.lowerCaseUnion> = InferResult.Union< - $SelectionSet, - Schema, - Schema['allTypes']['lowerCaseUnion'] - > - // Interface - // -------------------------------------------------------------------------------------------------- - // - export type DateInterface1<$SelectionSet extends SelectionSets.DateInterface1> = InferResult.Interface< - $SelectionSet, - Schema, - Schema['allTypes']['DateInterface1'] - > - export type Error<$SelectionSet extends SelectionSets.Error> = InferResult.Interface< - $SelectionSet, - Schema, - Schema['allTypes']['Error'] - > - export type Interface<$SelectionSet extends SelectionSets.Interface> = InferResult.Interface< - $SelectionSet, - Schema, - Schema['allTypes']['Interface'] - > -} diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/client.ts b/tests/_/schemas/kitchen-sink/graffle/modules/client.ts new file mode 100644 index 000000000..bed02983a --- /dev/null +++ b/tests/_/schemas/kitchen-sink/graffle/modules/client.ts @@ -0,0 +1,4 @@ +import { createPrefilled } from '../../../../../../src/entrypoints/client.js' +import * as $$Data from './data.js' +import * as $$SchemaDrivenDataMap from './schema-driven-data-map.js' +export const create = createPrefilled($$Data.Name, $$SchemaDrivenDataMap.schemaDrivenDataMap, $$Data.defaultSchemaUrl) diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/Data.ts b/tests/_/schemas/kitchen-sink/graffle/modules/data.ts similarity index 100% rename from tests/_/schemas/kitchen-sink/graffle/modules/Data.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/data.ts diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/global.ts b/tests/_/schemas/kitchen-sink/graffle/modules/global.ts new file mode 100644 index 000000000..51f43ce41 --- /dev/null +++ b/tests/_/schemas/kitchen-sink/graffle/modules/global.ts @@ -0,0 +1,22 @@ +import * as $$Data from './data.js' +import * as $$MethodsDocument from './methods-document.js' +import * as $$MethodsRoot from './methods-root.js' +import * as $$MethodsSelect from './methods-select.js' +import * as $$Schema from './schema.js' + +declare global { + export namespace GraffleGlobal { + export interface Clients { + default: { + name: $$Data.Name + schema: $$Schema.Schema + interfaces: { + MethodsSelect: $$MethodsSelect.$MethodsSelect + Document: $$MethodsDocument.BuilderMethodsDocumentFn + Root: $$MethodsRoot.BuilderMethodsRootFn + } + defaultSchemaUrl: null + } + } + } +} diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/methods-document.ts b/tests/_/schemas/kitchen-sink/graffle/modules/methods-document.ts new file mode 100644 index 000000000..af8ae82d4 --- /dev/null +++ b/tests/_/schemas/kitchen-sink/graffle/modules/methods-document.ts @@ -0,0 +1,20 @@ +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' + +export interface Document<$Context extends $$Utilities.ClientContext> { + <$Document>( + document: $$Utilities.ExactNonEmpty<$Document, $$SelectionSets.$Document<$Context['scalars']>>, + ): $$Utilities.DocumentRunner< + $Context, + $$Schema.Schema, + // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as + // Satisfying the constraint on the DocumentRunner type. + $Document + > +} + +export interface BuilderMethodsDocumentFn extends $$Utilities.TypeFunction.Fn { + // @ts-expect-error parameter is Untyped. + return: Document +} diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/MethodsRoot.ts b/tests/_/schemas/kitchen-sink/graffle/modules/methods-root.ts similarity index 59% rename from tests/_/schemas/kitchen-sink/graffle/modules/MethodsRoot.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/methods-root.ts index 749efd35c..2bcc5cef9 100644 --- a/tests/_/schemas/kitchen-sink/graffle/modules/MethodsRoot.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/methods-root.ts @@ -1,16 +1,16 @@ import type { InferResult } from '../../../../../../src/entrypoints/schema.js' import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type { Schema } from './Schema.js' -import type * as SelectionSet from './SelectionSets.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' export interface QueryMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationQuery<$SelectionSet, Schema<$Context['scalars']>> + InferResult.OperationQuery<$SelectionSet, $$Schema.Schema<$Context['scalars']>> > > > @@ -25,24 +25,24 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > InputObjectNested: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.InputObjectNested<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.InputObjectNested<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ InputObjectNested: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ InputObjectNested: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'InputObjectNested' > > > InputObjectNestedNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.InputObjectNestedNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.InputObjectNestedNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ InputObjectNestedNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ InputObjectNestedNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'InputObjectNestedNonNull' > > @@ -51,456 +51,462 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { * Query enum field documentation. */ abcEnum: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.abcEnum<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.abcEnum<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ abcEnum: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ abcEnum: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'abcEnum' > > > argInputObjectCircular: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.argInputObjectCircular<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.argInputObjectCircular<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ argInputObjectCircular: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ argInputObjectCircular: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'argInputObjectCircular' > > > date: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.date<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.date<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ date: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ date: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'date' > > > dateArg: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArg<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArg<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArg: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArg: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArg' > > > dateArgInputObject: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgInputObject<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgInputObject<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgInputObject: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgInputObject: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgInputObject' > > > dateArgList: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgList<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgList' > > > dateArgNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgNonNull' > > > dateArgNonNullList: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullList<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateArgNonNullList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgNonNullList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgNonNullList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgNonNullList' > > > dateArgNonNullListNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullListNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact< + $SelectionSet, + $$SelectionSets.Query.dateArgNonNullListNonNull<$Context['scalars']> + >, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateArgNonNullListNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateArgNonNullListNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateArgNonNullListNonNull' > > > dateInterface1: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateInterface1<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateInterface1<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateInterface1: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateInterface1: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateInterface1' > > > dateList: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateList<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateList' > > > dateListList: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateListList<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateListList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateListList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateListList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateListList' > > > dateListNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateListNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateListNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateListNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateListNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateListNonNull' > > > dateNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateNonNull' > > > dateObject1: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateObject1<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateObject1<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateObject1: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateObject1: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateObject1' > > > dateUnion: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.dateUnion<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.dateUnion<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ dateUnion: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ dateUnion: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'dateUnion' > > > error: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.error<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.error<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ error: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ error: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'error' > > > id: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.id<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.id<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ id: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ id: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'id' > > > idNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.idNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ idNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ idNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'idNonNull' > > > interface: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$interface<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$interface<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ interface: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ interface: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'interface' > > > interfaceNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.interfaceNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.interfaceNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ interfaceNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ interfaceNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'interfaceNonNull' > > > interfaceWithArgs: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.interfaceWithArgs<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.interfaceWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ interfaceWithArgs: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ interfaceWithArgs: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'interfaceWithArgs' > > > listInt: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listInt<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listInt<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ listInt: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ listInt: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'listInt' > > > listIntNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listIntNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listIntNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ listIntNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ listIntNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'listIntNonNull' > > > listListInt: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listListInt<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listListInt<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ listListInt: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ listListInt: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'listListInt' > > > listListIntNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.listListIntNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.listListIntNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ listListIntNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ listListIntNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'listListIntNonNull' > > > lowerCaseUnion: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.lowerCaseUnion<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.lowerCaseUnion<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ lowerCaseUnion: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ lowerCaseUnion: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'lowerCaseUnion' > > > object: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$object<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$object<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ object: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ object: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'object' > > > objectList: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectList<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectList<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectList: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectList: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectList' > > > objectListNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectListNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectListNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectListNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectListNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectListNonNull' > > > objectNested: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectNested<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectNested<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectNested: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectNested: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectNested' > > > objectNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectNonNull' > > > objectWithArgs: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.objectWithArgs<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.objectWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ objectWithArgs: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ objectWithArgs: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'objectWithArgs' > > > result: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.result<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.result<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ result: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ result: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'result' > > > resultNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.resultNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.resultNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ resultNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ resultNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'resultNonNull' > > > string: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.$string<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.$string<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ string: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ string: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'string' > > > stringWithArgEnum: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgEnum<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithArgEnum<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithArgEnum: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithArgEnum: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithArgEnum' > > > stringWithArgInputObject: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgInputObject<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact< + $SelectionSet, + $$SelectionSets.Query.stringWithArgInputObject<$Context['scalars']> + >, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithArgInputObject: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithArgInputObject: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithArgInputObject' > > @@ -509,13 +515,16 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { stringWithArgInputObjectRequired: <$SelectionSet>( selectionSet: $$Utilities.Exact< $SelectionSet, - SelectionSet.Query.stringWithArgInputObjectRequired<$Context['scalars']> + $$SelectionSets.Query.stringWithArgInputObjectRequired<$Context['scalars']> >, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithArgInputObjectRequired: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery< + { stringWithArgInputObjectRequired: $SelectionSet }, + $$Schema.Schema<$Context['scalars']> + >, 'stringWithArgInputObjectRequired' > > @@ -524,108 +533,111 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { * The given arguments are reflected back as a JSON string. */ stringWithArgs: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithArgs<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithArgs: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithArgs: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithArgs' > > > stringWithListArg: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithListArg<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithListArg<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithListArg: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithListArg: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithListArg' > > > stringWithListArgRequired: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithListArgRequired<$Context['scalars']>>, + selectionSet: $$Utilities.Exact< + $SelectionSet, + $$SelectionSets.Query.stringWithListArgRequired<$Context['scalars']> + >, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithListArgRequired: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithListArgRequired: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithListArgRequired' > > > stringWithRequiredArg: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.stringWithRequiredArg<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.stringWithRequiredArg<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ stringWithRequiredArg: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ stringWithRequiredArg: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'stringWithRequiredArg' > > > unionFooBar: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBar<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBar<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionFooBar: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionFooBar: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionFooBar' > > > unionFooBarNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBarNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBarNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionFooBarNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionFooBarNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionFooBarNonNull' > > > unionFooBarWithArgs: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionFooBarWithArgs<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionFooBarWithArgs<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionFooBarWithArgs: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionFooBarWithArgs: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionFooBarWithArgs' > > > unionObject: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionObject<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionObject<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionObject: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionObject: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionObject' > > > unionObjectNonNull: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.unionObjectNonNull<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.unionObjectNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ unionObjectNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ unionObjectNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'unionObjectNonNull' > > @@ -634,12 +646,12 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { export interface MutationMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationMutation<$SelectionSet, Schema<$Context['scalars']>> + InferResult.OperationMutation<$SelectionSet, $$Schema.Schema<$Context['scalars']>> > > > @@ -654,24 +666,24 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > id: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.id<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.id<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationMutation<{ id: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationMutation<{ id: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'id' > > > idNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.idNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationMutation<{ idNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationMutation<{ idNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'idNonNull' > > diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/MethodsSelect.ts b/tests/_/schemas/kitchen-sink/graffle/modules/methods-select.ts similarity index 53% rename from tests/_/schemas/kitchen-sink/graffle/modules/MethodsSelect.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/methods-select.ts index c3ddd85cc..b6e45a5e1 100644 --- a/tests/_/schemas/kitchen-sink/graffle/modules/MethodsSelect.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/methods-select.ts @@ -1,5 +1,5 @@ -import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type * as $SelectionSets from './SelectionSets.js' +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import * as $$SelectionSets from './selection-sets.js' // // @@ -59,11 +59,11 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Query>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet } export interface Mutation { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Mutation>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>): $SelectionSet } // @@ -83,59 +83,59 @@ export interface Mutation { // export interface Bar { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Bar>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Bar>): $SelectionSet } export interface DateObject1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateObject1>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject1>): $SelectionSet } export interface DateObject2 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateObject2>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateObject2>): $SelectionSet } export interface ErrorOne { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ErrorOne>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorOne>): $SelectionSet } export interface ErrorTwo { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ErrorTwo>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ErrorTwo>): $SelectionSet } export interface Foo { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Foo>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Foo>): $SelectionSet } export interface Object1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Object1>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1>): $SelectionSet } export interface Object1ImplementingInterface { <$SelectionSet>( - selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Object1ImplementingInterface>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object1ImplementingInterface>, ): $SelectionSet } export interface Object2ImplementingInterface { <$SelectionSet>( - selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Object2ImplementingInterface>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Object2ImplementingInterface>, ): $SelectionSet } export interface ObjectNested { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ObjectNested>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectNested>): $SelectionSet } export interface ObjectUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ObjectUnion>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.ObjectUnion>): $SelectionSet } export interface lowerCaseObject { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseObject>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject>): $SelectionSet } export interface lowerCaseObject2 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseObject2>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseObject2>): $SelectionSet } // @@ -155,19 +155,19 @@ export interface lowerCaseObject2 { // export interface DateUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateUnion>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateUnion>): $SelectionSet } export interface FooBarUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.FooBarUnion>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.FooBarUnion>): $SelectionSet } export interface Result { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Result>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Result>): $SelectionSet } export interface lowerCaseUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseUnion>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.lowerCaseUnion>): $SelectionSet } // @@ -187,13 +187,13 @@ export interface lowerCaseUnion { // export interface DateInterface1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateInterface1>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.DateInterface1>): $SelectionSet } export interface Error { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Error>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Error>): $SelectionSet } export interface Interface { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Interface>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Interface>): $SelectionSet } diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/Scalar.ts b/tests/_/schemas/kitchen-sink/graffle/modules/scalar.ts similarity index 100% rename from tests/_/schemas/kitchen-sink/graffle/modules/Scalar.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/scalar.ts diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/SchemaDrivenDataMap.ts b/tests/_/schemas/kitchen-sink/graffle/modules/schema-driven-data-map.ts similarity index 98% rename from tests/_/schemas/kitchen-sink/graffle/modules/SchemaDrivenDataMap.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/schema-driven-data-map.ts index e53a31ae8..3ddb9a1b5 100644 --- a/tests/_/schemas/kitchen-sink/graffle/modules/SchemaDrivenDataMap.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/schema-driven-data-map.ts @@ -1,5 +1,5 @@ import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import * as $Scalar from './Scalar.js' +import * as $$Scalar from './scalar.js' // // // @@ -16,15 +16,15 @@ import * as $Scalar from './Scalar.js' // // -const Boolean = $Scalar.Boolean +const Boolean = $$Scalar.Boolean -const Float = $Scalar.Float +const Float = $$Scalar.Float -const ID = $Scalar.ID +const ID = $$Scalar.ID -const Int = $Scalar.Int +const Int = $$Scalar.Int -const String = $Scalar.String +const String = $$Scalar.String // // diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/Schema.ts b/tests/_/schemas/kitchen-sink/graffle/modules/schema.ts similarity index 99% rename from tests/_/schemas/kitchen-sink/graffle/modules/Schema.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/schema.ts index 337a1678c..56eeb4684 100644 --- a/tests/_/schemas/kitchen-sink/graffle/modules/Schema.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/schema.ts @@ -1,7 +1,7 @@ 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 $Scalar from './Scalar.js' +import * as $$Data from './data.js' +import * as $$Scalar from './scalar.js' export namespace Schema { // @@ -1543,7 +1543,7 @@ export namespace Schema { // -------------------------------------------------------------------------------------------------- // - export type Date = $Scalar.Date + export type Date = $$Scalar.Date // // @@ -1672,7 +1672,7 @@ export namespace Schema { export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.Registry = $$Utilities.Schema.Scalar.Registry.Empty> extends $ { - name: Data.Name + name: $$Data.Name operationsAvailable: ['query', 'mutation'] RootUnion: | Schema.Query diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/select.ts b/tests/_/schemas/kitchen-sink/graffle/modules/select.ts new file mode 100644 index 000000000..38ba9c49a --- /dev/null +++ b/tests/_/schemas/kitchen-sink/graffle/modules/select.ts @@ -0,0 +1,166 @@ +import type { OperationTypeNode } from 'graphql' +import type { InferResult } from '../../../../../../src/entrypoints/schema.js' +import * as $$Data from './data.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' + +// +// +// +// +// +// +// ================================================================================================== +// Runtime +// ================================================================================================== +// +// +// +// +// +// +import { createSelect } from '../../../../../../src/entrypoints/client.js' +export const Select = createSelect($$Data.Name) + +// +// +// +// +// +// +// ================================================================================================== +// Buildtime +// ================================================================================================== +// +// +// +// +// +// + +export namespace Select { + // Root + // -------------------------------------------------------------------------------------------------- + // + export type Query<$SelectionSet extends $$SelectionSets.Query> = InferResult.Operation< + $SelectionSet, + $$Schema.Schema, + OperationTypeNode.QUERY + > + export type Mutation<$SelectionSet extends $$SelectionSets.Mutation> = InferResult.Operation< + $SelectionSet, + $$Schema.Schema, + OperationTypeNode.MUTATION + > + // OutputObject + // -------------------------------------------------------------------------------------------------- + // + export type Bar<$SelectionSet extends $$SelectionSets.Bar> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Bar'] + > + export type DateObject1<$SelectionSet extends $$SelectionSets.DateObject1> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['DateObject1'] + > + export type DateObject2<$SelectionSet extends $$SelectionSets.DateObject2> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['DateObject2'] + > + export type ErrorOne<$SelectionSet extends $$SelectionSets.ErrorOne> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['ErrorOne'] + > + export type ErrorTwo<$SelectionSet extends $$SelectionSets.ErrorTwo> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['ErrorTwo'] + > + export type Foo<$SelectionSet extends $$SelectionSets.Foo> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Foo'] + > + export type Object1<$SelectionSet extends $$SelectionSets.Object1> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Object1'] + > + export type Object1ImplementingInterface<$SelectionSet extends $$SelectionSets.Object1ImplementingInterface> = + InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Object1ImplementingInterface'] + > + export type Object2ImplementingInterface<$SelectionSet extends $$SelectionSets.Object2ImplementingInterface> = + InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Object2ImplementingInterface'] + > + export type ObjectNested<$SelectionSet extends $$SelectionSets.ObjectNested> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['ObjectNested'] + > + export type ObjectUnion<$SelectionSet extends $$SelectionSets.ObjectUnion> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['ObjectUnion'] + > + export type lowerCaseObject<$SelectionSet extends $$SelectionSets.lowerCaseObject> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['lowerCaseObject'] + > + export type lowerCaseObject2<$SelectionSet extends $$SelectionSets.lowerCaseObject2> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['lowerCaseObject2'] + > + // Union + // -------------------------------------------------------------------------------------------------- + // + export type DateUnion<$SelectionSet extends $$SelectionSets.DateUnion> = InferResult.Union< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['DateUnion'] + > + export type FooBarUnion<$SelectionSet extends $$SelectionSets.FooBarUnion> = InferResult.Union< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['FooBarUnion'] + > + export type Result<$SelectionSet extends $$SelectionSets.Result> = InferResult.Union< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Result'] + > + export type lowerCaseUnion<$SelectionSet extends $$SelectionSets.lowerCaseUnion> = InferResult.Union< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['lowerCaseUnion'] + > + // Interface + // -------------------------------------------------------------------------------------------------- + // + export type DateInterface1<$SelectionSet extends $$SelectionSets.DateInterface1> = InferResult.Interface< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['DateInterface1'] + > + export type Error<$SelectionSet extends $$SelectionSets.Error> = InferResult.Interface< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Error'] + > + export type Interface<$SelectionSet extends $$SelectionSets.Interface> = InferResult.Interface< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Interface'] + > +} diff --git a/tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.ts b/tests/_/schemas/kitchen-sink/graffle/modules/selection-sets.ts similarity index 100% rename from tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/selection-sets.ts diff --git a/tests/_/schemas/mutation-only/graffle/_.ts b/tests/_/schemas/mutation-only/graffle/_.ts index d27e9e3d3..260860931 100644 --- a/tests/_/schemas/mutation-only/graffle/_.ts +++ b/tests/_/schemas/mutation-only/graffle/_.ts @@ -2,9 +2,9 @@ // It at least helps with Twoslash wherein without this import here Twoslash will not include the global module. // In real TypeScript projects it seems the global module is included automatically. But there could be certain tsconfig // setups where this still indeed does help. -import './modules/Global.js' +import './modules/global.js' -export { create } from './modules/Client.js' -export { schemaDrivenDataMap } from './modules/SchemaDrivenDataMap.js' -export { Select } from './modules/Select.js' -export * as SelectionSets from './modules/SelectionSets.js' +export { create } from './modules/client.js' +export { schemaDrivenDataMap } from './modules/schema-driven-data-map.js' +export { Select } from './modules/select.js' +export * as SelectionSets from './modules/selection-sets.js' diff --git a/tests/_/schemas/mutation-only/graffle/modules/Client.ts b/tests/_/schemas/mutation-only/graffle/modules/Client.ts deleted file mode 100644 index 9080daf87..000000000 --- a/tests/_/schemas/mutation-only/graffle/modules/Client.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createPrefilled } from '../../../../../../src/entrypoints/client.js' -import { defaultSchemaUrl } from './Data.js' -import { Name } from './Data.js' -import { schemaDrivenDataMap } from './SchemaDrivenDataMap.js' -export const create = createPrefilled(Name, schemaDrivenDataMap, defaultSchemaUrl) diff --git a/tests/_/schemas/mutation-only/graffle/modules/Global.ts b/tests/_/schemas/mutation-only/graffle/modules/Global.ts deleted file mode 100644 index bc46bba37..000000000 --- a/tests/_/schemas/mutation-only/graffle/modules/Global.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type * as Data from './Data.js' -import type * as MethodsDocument from './MethodsDocument.js' -import type * as MethodsRoot from './MethodsRoot.js' -import type * as MethodsSelect from './MethodsSelect.js' -import type { Schema } from './Schema.js' - -declare global { - export namespace GraffleGlobal { - export interface Clients { - MutationOnly: { - name: Data.Name - schema: Schema - interfaces: { - MethodsSelect: MethodsSelect.$MethodsSelect - Document: MethodsDocument.BuilderMethodsDocumentFn - Root: MethodsRoot.BuilderMethodsRootFn - } - defaultSchemaUrl: null - } - } - } -} diff --git a/tests/_/schemas/mutation-only/graffle/modules/MethodsDocument.ts b/tests/_/schemas/mutation-only/graffle/modules/MethodsDocument.ts deleted file mode 100644 index f12a02bd5..000000000 --- a/tests/_/schemas/mutation-only/graffle/modules/MethodsDocument.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type * as Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type { Schema } from './Schema.js' -import type * as SelectionSets from './SelectionSets.js' -export interface Document<$Context extends Utilities.ClientContext> { - <$Document>( - document: Utilities.ExactNonEmpty<$Document, SelectionSets.$Document<$Context['scalars']>>, - ): Utilities.DocumentRunner< - $Context, - Schema, - // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as - // Satisfying the constraint on the DocumentRunner type. - $Document - > -} - -export interface BuilderMethodsDocumentFn extends Utilities.TypeFunction.Fn { - // @ts-expect-error parameter is Untyped. - return: Document -} diff --git a/tests/_/schemas/mutation-only/graffle/modules/RuntimeCustomScalars.ts b/tests/_/schemas/mutation-only/graffle/modules/RuntimeCustomScalars.ts deleted file mode 100644 index 56dc44044..000000000 --- a/tests/_/schemas/mutation-only/graffle/modules/RuntimeCustomScalars.ts +++ /dev/null @@ -1,153 +0,0 @@ -import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import * as CustomScalars from './Scalar.js' -// -// -// -// -// -// -// ================================================================================================== -// GraphQLEnumType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLEnumTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLInputObjectType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLInputObjectTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLObjectType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLObjectTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLInterfaceType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLInterfaceTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLUnionType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLUnionTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLRootType -// ================================================================================================== -// -// -// -// -// -// - -const Mutation: $Utilities.SchemaDrivenDataMap.OutputObject = { - f: { - id: {}, - idNonNull: {}, - }, -} - -// -// -// -// -// -// -// ================================================================================================== -// Reference Assignments -// (avoids circular assignment issues) -// ================================================================================================== -// -// -// -// -// -// - -// None of your types have references to other non-scalar/enum types. - -// -// -// -// -// -// -// ================================================================================================== -// Index -// ================================================================================================== -// -// -// -// -// -// - -export const $index = { - Mutation, -} diff --git a/tests/_/schemas/mutation-only/graffle/modules/client.ts b/tests/_/schemas/mutation-only/graffle/modules/client.ts new file mode 100644 index 000000000..bed02983a --- /dev/null +++ b/tests/_/schemas/mutation-only/graffle/modules/client.ts @@ -0,0 +1,4 @@ +import { createPrefilled } from '../../../../../../src/entrypoints/client.js' +import * as $$Data from './data.js' +import * as $$SchemaDrivenDataMap from './schema-driven-data-map.js' +export const create = createPrefilled($$Data.Name, $$SchemaDrivenDataMap.schemaDrivenDataMap, $$Data.defaultSchemaUrl) diff --git a/tests/_/schemas/mutation-only/graffle/modules/Data.ts b/tests/_/schemas/mutation-only/graffle/modules/data.ts similarity index 100% rename from tests/_/schemas/mutation-only/graffle/modules/Data.ts rename to tests/_/schemas/mutation-only/graffle/modules/data.ts diff --git a/tests/_/schemas/mutation-only/graffle/modules/global.ts b/tests/_/schemas/mutation-only/graffle/modules/global.ts new file mode 100644 index 000000000..45bf17ef1 --- /dev/null +++ b/tests/_/schemas/mutation-only/graffle/modules/global.ts @@ -0,0 +1,22 @@ +import * as $$Data from './data.js' +import * as $$MethodsDocument from './methods-document.js' +import * as $$MethodsRoot from './methods-root.js' +import * as $$MethodsSelect from './methods-select.js' +import * as $$Schema from './schema.js' + +declare global { + export namespace GraffleGlobal { + export interface Clients { + MutationOnly: { + name: $$Data.Name + schema: $$Schema.Schema + interfaces: { + MethodsSelect: $$MethodsSelect.$MethodsSelect + Document: $$MethodsDocument.BuilderMethodsDocumentFn + Root: $$MethodsRoot.BuilderMethodsRootFn + } + defaultSchemaUrl: null + } + } + } +} diff --git a/tests/_/schemas/mutation-only/graffle/modules/methods-document.ts b/tests/_/schemas/mutation-only/graffle/modules/methods-document.ts new file mode 100644 index 000000000..af8ae82d4 --- /dev/null +++ b/tests/_/schemas/mutation-only/graffle/modules/methods-document.ts @@ -0,0 +1,20 @@ +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' + +export interface Document<$Context extends $$Utilities.ClientContext> { + <$Document>( + document: $$Utilities.ExactNonEmpty<$Document, $$SelectionSets.$Document<$Context['scalars']>>, + ): $$Utilities.DocumentRunner< + $Context, + $$Schema.Schema, + // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as + // Satisfying the constraint on the DocumentRunner type. + $Document + > +} + +export interface BuilderMethodsDocumentFn extends $$Utilities.TypeFunction.Fn { + // @ts-expect-error parameter is Untyped. + return: Document +} diff --git a/tests/_/schemas/mutation-only/graffle/modules/MethodsRoot.ts b/tests/_/schemas/mutation-only/graffle/modules/methods-root.ts similarity index 66% rename from tests/_/schemas/mutation-only/graffle/modules/MethodsRoot.ts rename to tests/_/schemas/mutation-only/graffle/modules/methods-root.ts index 34d80197b..405bac1dd 100644 --- a/tests/_/schemas/mutation-only/graffle/modules/MethodsRoot.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/methods-root.ts @@ -1,16 +1,16 @@ import type { InferResult } from '../../../../../../src/entrypoints/schema.js' import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type { Schema } from './Schema.js' -import type * as SelectionSet from './SelectionSets.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' export interface MutationMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationMutation<$SelectionSet, Schema<$Context['scalars']>> + InferResult.OperationMutation<$SelectionSet, $$Schema.Schema<$Context['scalars']>> > > > @@ -25,24 +25,24 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > id: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.id<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.id<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationMutation<{ id: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationMutation<{ id: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'id' > > > idNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.idNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationMutation<{ idNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationMutation<{ idNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'idNonNull' > > diff --git a/tests/_/schemas/mutation-only/graffle/modules/MethodsSelect.ts b/tests/_/schemas/mutation-only/graffle/modules/methods-select.ts similarity index 85% rename from tests/_/schemas/mutation-only/graffle/modules/MethodsSelect.ts rename to tests/_/schemas/mutation-only/graffle/modules/methods-select.ts index f8fc9c2b1..076aa0042 100644 --- a/tests/_/schemas/mutation-only/graffle/modules/MethodsSelect.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/methods-select.ts @@ -1,5 +1,5 @@ -import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type * as $SelectionSets from './SelectionSets.js' +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import * as $$SelectionSets from './selection-sets.js' // // @@ -38,7 +38,7 @@ export interface $MethodsSelect { // export interface Mutation { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Mutation>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>): $SelectionSet } // diff --git a/tests/_/schemas/mutation-only/graffle/modules/Scalar.ts b/tests/_/schemas/mutation-only/graffle/modules/scalar.ts similarity index 100% rename from tests/_/schemas/mutation-only/graffle/modules/Scalar.ts rename to tests/_/schemas/mutation-only/graffle/modules/scalar.ts diff --git a/tests/_/schemas/mutation-only/graffle/modules/SchemaDrivenDataMap.ts b/tests/_/schemas/mutation-only/graffle/modules/schema-driven-data-map.ts similarity index 95% rename from tests/_/schemas/mutation-only/graffle/modules/SchemaDrivenDataMap.ts rename to tests/_/schemas/mutation-only/graffle/modules/schema-driven-data-map.ts index 03a51f428..b5d3e4114 100644 --- a/tests/_/schemas/mutation-only/graffle/modules/SchemaDrivenDataMap.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/schema-driven-data-map.ts @@ -1,5 +1,5 @@ import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import * as $Scalar from './Scalar.js' +import * as $$Scalar from './scalar.js' // // // @@ -16,15 +16,15 @@ import * as $Scalar from './Scalar.js' // // -const Boolean = $Scalar.Boolean +const Boolean = $$Scalar.Boolean -const Float = $Scalar.Float +const Float = $$Scalar.Float -const ID = $Scalar.ID +const ID = $$Scalar.ID -const Int = $Scalar.Int +const Int = $$Scalar.Int -const String = $Scalar.String +const String = $$Scalar.String // // diff --git a/tests/_/schemas/mutation-only/graffle/modules/Schema.ts b/tests/_/schemas/mutation-only/graffle/modules/schema.ts similarity index 98% rename from tests/_/schemas/mutation-only/graffle/modules/Schema.ts rename to tests/_/schemas/mutation-only/graffle/modules/schema.ts index 6090bde90..5d042a292 100644 --- a/tests/_/schemas/mutation-only/graffle/modules/Schema.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/schema.ts @@ -1,7 +1,7 @@ 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 $Scalar from './Scalar.js' +import * as $$Data from './data.js' +import * as $$Scalar from './scalar.js' export namespace Schema { // @@ -254,7 +254,7 @@ export namespace Schema { export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.Registry = $$Utilities.Schema.Scalar.Registry.Empty> extends $ { - name: Data.Name + name: $$Data.Name operationsAvailable: ['mutation'] RootUnion: Schema.Mutation Root: { diff --git a/tests/_/schemas/mutation-only/graffle/modules/Select.ts b/tests/_/schemas/mutation-only/graffle/modules/select.ts similarity index 83% rename from tests/_/schemas/mutation-only/graffle/modules/Select.ts rename to tests/_/schemas/mutation-only/graffle/modules/select.ts index 345bcc8a9..a5ccc9e37 100644 --- a/tests/_/schemas/mutation-only/graffle/modules/Select.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/select.ts @@ -1,8 +1,8 @@ import type { OperationTypeNode } from 'graphql' import type { InferResult } from '../../../../../../src/entrypoints/schema.js' -import * as Data from './Data.js' -import type { Schema } from './Schema.js' -import type * as SelectionSets from './SelectionSets.js' +import * as $$Data from './data.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' // // @@ -20,7 +20,7 @@ import type * as SelectionSets from './SelectionSets.js' // // import { createSelect } from '../../../../../../src/entrypoints/client.js' -export const Select = createSelect(Data.Name) +export const Select = createSelect($$Data.Name) // // @@ -42,9 +42,9 @@ export namespace Select { // Root // -------------------------------------------------------------------------------------------------- // - export type Mutation<$SelectionSet extends SelectionSets.Mutation> = InferResult.Operation< + export type Mutation<$SelectionSet extends $$SelectionSets.Mutation> = InferResult.Operation< $SelectionSet, - Schema, + $$Schema.Schema, OperationTypeNode.MUTATION > // OutputObject diff --git a/tests/_/schemas/mutation-only/graffle/modules/SelectionSets.ts b/tests/_/schemas/mutation-only/graffle/modules/selection-sets.ts similarity index 100% rename from tests/_/schemas/mutation-only/graffle/modules/SelectionSets.ts rename to tests/_/schemas/mutation-only/graffle/modules/selection-sets.ts diff --git a/tests/_/schemas/pokemon/graffle/_.ts b/tests/_/schemas/pokemon/graffle/_.ts index d27e9e3d3..260860931 100644 --- a/tests/_/schemas/pokemon/graffle/_.ts +++ b/tests/_/schemas/pokemon/graffle/_.ts @@ -2,9 +2,9 @@ // It at least helps with Twoslash wherein without this import here Twoslash will not include the global module. // In real TypeScript projects it seems the global module is included automatically. But there could be certain tsconfig // setups where this still indeed does help. -import './modules/Global.js' +import './modules/global.js' -export { create } from './modules/Client.js' -export { schemaDrivenDataMap } from './modules/SchemaDrivenDataMap.js' -export { Select } from './modules/Select.js' -export * as SelectionSets from './modules/SelectionSets.js' +export { create } from './modules/client.js' +export { schemaDrivenDataMap } from './modules/schema-driven-data-map.js' +export { Select } from './modules/select.js' +export * as SelectionSets from './modules/selection-sets.js' diff --git a/tests/_/schemas/pokemon/graffle/modules/Client.ts b/tests/_/schemas/pokemon/graffle/modules/Client.ts deleted file mode 100644 index 9080daf87..000000000 --- a/tests/_/schemas/pokemon/graffle/modules/Client.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createPrefilled } from '../../../../../../src/entrypoints/client.js' -import { defaultSchemaUrl } from './Data.js' -import { Name } from './Data.js' -import { schemaDrivenDataMap } from './SchemaDrivenDataMap.js' -export const create = createPrefilled(Name, schemaDrivenDataMap, defaultSchemaUrl) diff --git a/tests/_/schemas/pokemon/graffle/modules/Global.ts b/tests/_/schemas/pokemon/graffle/modules/Global.ts deleted file mode 100644 index 7cca17d3f..000000000 --- a/tests/_/schemas/pokemon/graffle/modules/Global.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type * as Data from './Data.js' -import type * as MethodsDocument from './MethodsDocument.js' -import type * as MethodsRoot from './MethodsRoot.js' -import type * as MethodsSelect from './MethodsSelect.js' -import type { Schema } from './Schema.js' - -declare global { - export namespace GraffleGlobal { - export interface Clients { - Pokemon: { - name: Data.Name - schema: Schema - interfaces: { - MethodsSelect: MethodsSelect.$MethodsSelect - Document: MethodsDocument.BuilderMethodsDocumentFn - Root: MethodsRoot.BuilderMethodsRootFn - } - /** - * http://localhost:3000/graphql - */ - defaultSchemaUrl: string - } - } - } -} diff --git a/tests/_/schemas/pokemon/graffle/modules/MethodsDocument.ts b/tests/_/schemas/pokemon/graffle/modules/MethodsDocument.ts deleted file mode 100644 index f12a02bd5..000000000 --- a/tests/_/schemas/pokemon/graffle/modules/MethodsDocument.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type * as Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type { Schema } from './Schema.js' -import type * as SelectionSets from './SelectionSets.js' -export interface Document<$Context extends Utilities.ClientContext> { - <$Document>( - document: Utilities.ExactNonEmpty<$Document, SelectionSets.$Document<$Context['scalars']>>, - ): Utilities.DocumentRunner< - $Context, - Schema, - // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as - // Satisfying the constraint on the DocumentRunner type. - $Document - > -} - -export interface BuilderMethodsDocumentFn extends Utilities.TypeFunction.Fn { - // @ts-expect-error parameter is Untyped. - return: Document -} diff --git a/tests/_/schemas/pokemon/graffle/modules/RuntimeCustomScalars.ts b/tests/_/schemas/pokemon/graffle/modules/RuntimeCustomScalars.ts deleted file mode 100644 index bfbe140ce..000000000 --- a/tests/_/schemas/pokemon/graffle/modules/RuntimeCustomScalars.ts +++ /dev/null @@ -1,381 +0,0 @@ -import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import * as CustomScalars from './Scalar.js' -// -// -// -// -// -// -// ================================================================================================== -// GraphQLEnumType -// ================================================================================================== -// -// -// -// -// -// - -const BattleWildResult: $Utilities.SchemaDrivenDataMap.Enum = { - k: 'enum', - n: 'BattleWildResult', -} - -const PokemonType: $Utilities.SchemaDrivenDataMap.Enum = { - k: 'enum', - n: 'PokemonType', -} - -const TrainerClass: $Utilities.SchemaDrivenDataMap.Enum = { - k: 'enum', - n: 'TrainerClass', -} - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLInputObjectType -// ================================================================================================== -// -// -// -// -// -// - -const DateFilter: $Utilities.SchemaDrivenDataMap.InputObject = { - n: 'DateFilter', - f: { - gte: {}, - lte: {}, - }, -} - -const PokemonFilter: $Utilities.SchemaDrivenDataMap.InputObject = { - n: 'PokemonFilter', - f: { - birthday: {}, - name: {}, - }, -} - -const StringFilter: $Utilities.SchemaDrivenDataMap.InputObject = { - n: 'StringFilter', - f: { - contains: {}, - in: {}, - }, -} - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLObjectType -// ================================================================================================== -// -// -// -// -// -// - -const BattleRoyale: $Utilities.SchemaDrivenDataMap.OutputObject = { - f: { - combatants: { - // nt: CombatantMultiPokemon, <-- Assigned later to avoid potential circular dependency. - }, - date: {}, - id: {}, - winner: { - // nt: Trainer, <-- Assigned later to avoid potential circular dependency. - }, - }, -} - -const BattleTrainer: $Utilities.SchemaDrivenDataMap.OutputObject = { - f: { - combatant1: { - // nt: CombatantSinglePokemon, <-- Assigned later to avoid potential circular dependency. - }, - combatant2: { - // nt: CombatantSinglePokemon, <-- Assigned later to avoid potential circular dependency. - }, - date: {}, - id: {}, - winner: { - // nt: Trainer, <-- Assigned later to avoid potential circular dependency. - }, - }, -} - -const BattleWild: $Utilities.SchemaDrivenDataMap.OutputObject = { - f: { - date: {}, - id: {}, - pokemon: { - // nt: Pokemon, <-- Assigned later to avoid potential circular dependency. - }, - result: {}, - trainer: { - // nt: Trainer, <-- Assigned later to avoid potential circular dependency. - }, - wildPokemons: { - // nt: Pokemon, <-- Assigned later to avoid potential circular dependency. - }, - }, -} - -const CombatantMultiPokemon: $Utilities.SchemaDrivenDataMap.OutputObject = { - f: { - pokemons: { - // nt: Pokemon, <-- Assigned later to avoid potential circular dependency. - }, - trainer: { - // nt: Trainer, <-- Assigned later to avoid potential circular dependency. - }, - }, -} - -const CombatantSinglePokemon: $Utilities.SchemaDrivenDataMap.OutputObject = { - f: { - pokemon: { - // nt: Pokemon, <-- Assigned later to avoid potential circular dependency. - }, - trainer: { - // nt: Trainer, <-- Assigned later to avoid potential circular dependency. - }, - }, -} - -const Patron: $Utilities.SchemaDrivenDataMap.OutputObject = { - f: { - id: {}, - money: {}, - name: {}, - }, -} - -const Pokemon: $Utilities.SchemaDrivenDataMap.OutputObject = { - f: { - attack: {}, - birthday: {}, - defense: {}, - hp: {}, - id: {}, - name: {}, - trainer: { - // nt: Trainer, <-- Assigned later to avoid potential circular dependency. - }, - type: {}, - }, -} - -const Trainer: $Utilities.SchemaDrivenDataMap.OutputObject = { - f: { - class: {}, - fans: { - // nt: Patron, <-- Assigned later to avoid potential circular dependency. - }, - id: {}, - name: {}, - pokemon: { - // nt: Pokemon, <-- Assigned later to avoid potential circular dependency. - }, - }, -} - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLInterfaceType -// ================================================================================================== -// -// -// -// -// -// - -const Being = { f: {} } - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLUnionType -// ================================================================================================== -// -// -// -// -// -// - -const Battle = { f: {} } - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLRootType -// ================================================================================================== -// -// -// -// -// -// - -const Mutation: $Utilities.SchemaDrivenDataMap.OutputObject = { - f: { - addPokemon: { - a: { - attack: { - it: [0], - nt: CustomScalars.Int, - }, - defense: { - it: [0], - nt: CustomScalars.Int, - }, - hp: { - it: [0], - nt: CustomScalars.Int, - }, - name: { - it: [1], - nt: CustomScalars.String, - }, - type: { - it: [1], - nt: PokemonType, - }, - }, - // nt: Pokemon, <-- Assigned later to avoid potential circular dependency. - }, - }, -} - -const Query: $Utilities.SchemaDrivenDataMap.OutputObject = { - f: { - battles: { - // nt: Battle, <-- Assigned later to avoid potential circular dependency. - }, - beings: { - // nt: Being, <-- Assigned later to avoid potential circular dependency. - }, - pokemon: { - // nt: Pokemon, <-- Assigned later to avoid potential circular dependency. - }, - pokemonByName: { - a: { - name: { - it: [1], - nt: CustomScalars.String, - }, - }, - // nt: Pokemon, <-- Assigned later to avoid potential circular dependency. - }, - pokemons: { - a: { - filter: { - it: [0], - nt: PokemonFilter, - }, - }, - // nt: Pokemon, <-- Assigned later to avoid potential circular dependency. - }, - trainerByName: { - a: { - name: { - it: [1], - nt: CustomScalars.String, - }, - }, - // nt: Trainer, <-- Assigned later to avoid potential circular dependency. - }, - trainers: { - // nt: Trainer, <-- Assigned later to avoid potential circular dependency. - }, - }, -} - -// -// -// -// -// -// -// ================================================================================================== -// Reference Assignments -// (avoids circular assignment issues) -// ================================================================================================== -// -// -// -// -// -// - -BattleRoyale.f['combatants']!.nt = CombatantMultiPokemon -BattleRoyale.f['winner']!.nt = Trainer -BattleTrainer.f['combatant1']!.nt = CombatantSinglePokemon -BattleTrainer.f['combatant2']!.nt = CombatantSinglePokemon -BattleTrainer.f['winner']!.nt = Trainer -BattleWild.f['pokemon']!.nt = Pokemon -BattleWild.f['trainer']!.nt = Trainer -BattleWild.f['wildPokemons']!.nt = Pokemon -CombatantMultiPokemon.f['pokemons']!.nt = Pokemon -CombatantMultiPokemon.f['trainer']!.nt = Trainer -CombatantSinglePokemon.f['pokemon']!.nt = Pokemon -CombatantSinglePokemon.f['trainer']!.nt = Trainer -Pokemon.f['trainer']!.nt = Trainer -Trainer.f['fans']!.nt = Patron -Trainer.f['pokemon']!.nt = Pokemon -Mutation.f['addPokemon']!.nt = Pokemon -Query.f['battles']!.nt = Battle -Query.f['beings']!.nt = Being -Query.f['pokemon']!.nt = Pokemon -Query.f['pokemonByName']!.nt = Pokemon -Query.f['pokemons']!.nt = Pokemon -Query.f['trainerByName']!.nt = Trainer -Query.f['trainers']!.nt = Trainer - -// -// -// -// -// -// -// ================================================================================================== -// Index -// ================================================================================================== -// -// -// -// -// -// - -export const $index = { - Mutation, - Query, -} diff --git a/tests/_/schemas/pokemon/graffle/modules/Select.ts b/tests/_/schemas/pokemon/graffle/modules/Select.ts deleted file mode 100644 index 3833f714a..000000000 --- a/tests/_/schemas/pokemon/graffle/modules/Select.ts +++ /dev/null @@ -1,108 +0,0 @@ -import type { OperationTypeNode } from 'graphql' -import type { InferResult } from '../../../../../../src/entrypoints/schema.js' -import * as Data from './Data.js' -import type { Schema } from './Schema.js' -import type * as SelectionSets from './SelectionSets.js' - -// -// -// -// -// -// -// ================================================================================================== -// Runtime -// ================================================================================================== -// -// -// -// -// -// -import { createSelect } from '../../../../../../src/entrypoints/client.js' -export const Select = createSelect(Data.Name) - -// -// -// -// -// -// -// ================================================================================================== -// Buildtime -// ================================================================================================== -// -// -// -// -// -// - -export namespace Select { - // Root - // -------------------------------------------------------------------------------------------------- - // - export type Query<$SelectionSet extends SelectionSets.Query> = InferResult.Operation< - $SelectionSet, - Schema, - OperationTypeNode.QUERY - > - export type Mutation<$SelectionSet extends SelectionSets.Mutation> = InferResult.Operation< - $SelectionSet, - Schema, - OperationTypeNode.MUTATION - > - // OutputObject - // -------------------------------------------------------------------------------------------------- - // - export type BattleRoyale<$SelectionSet extends SelectionSets.BattleRoyale> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['BattleRoyale'] - > - export type BattleTrainer<$SelectionSet extends SelectionSets.BattleTrainer> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['BattleTrainer'] - > - export type BattleWild<$SelectionSet extends SelectionSets.BattleWild> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['BattleWild'] - > - export type CombatantMultiPokemon<$SelectionSet extends SelectionSets.CombatantMultiPokemon> = - InferResult.OutputObject<$SelectionSet, Schema, Schema['allTypes']['CombatantMultiPokemon']> - export type CombatantSinglePokemon<$SelectionSet extends SelectionSets.CombatantSinglePokemon> = - InferResult.OutputObject<$SelectionSet, Schema, Schema['allTypes']['CombatantSinglePokemon']> - export type Patron<$SelectionSet extends SelectionSets.Patron> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['Patron'] - > - export type Pokemon<$SelectionSet extends SelectionSets.Pokemon> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['Pokemon'] - > - export type Trainer<$SelectionSet extends SelectionSets.Trainer> = InferResult.OutputObject< - $SelectionSet, - Schema, - Schema['allTypes']['Trainer'] - > - // Union - // -------------------------------------------------------------------------------------------------- - // - export type Battle<$SelectionSet extends SelectionSets.Battle> = InferResult.Union< - $SelectionSet, - Schema, - Schema['allTypes']['Battle'] - > - // Interface - // -------------------------------------------------------------------------------------------------- - // - export type Being<$SelectionSet extends SelectionSets.Being> = InferResult.Interface< - $SelectionSet, - Schema, - Schema['allTypes']['Being'] - > -} diff --git a/tests/_/schemas/pokemon/graffle/modules/client.ts b/tests/_/schemas/pokemon/graffle/modules/client.ts new file mode 100644 index 000000000..bed02983a --- /dev/null +++ b/tests/_/schemas/pokemon/graffle/modules/client.ts @@ -0,0 +1,4 @@ +import { createPrefilled } from '../../../../../../src/entrypoints/client.js' +import * as $$Data from './data.js' +import * as $$SchemaDrivenDataMap from './schema-driven-data-map.js' +export const create = createPrefilled($$Data.Name, $$SchemaDrivenDataMap.schemaDrivenDataMap, $$Data.defaultSchemaUrl) diff --git a/tests/_/schemas/pokemon/graffle/modules/Data.ts b/tests/_/schemas/pokemon/graffle/modules/data.ts similarity index 100% rename from tests/_/schemas/pokemon/graffle/modules/Data.ts rename to tests/_/schemas/pokemon/graffle/modules/data.ts diff --git a/tests/_/schemas/pokemon/graffle/modules/global.ts b/tests/_/schemas/pokemon/graffle/modules/global.ts new file mode 100644 index 000000000..636a61c2b --- /dev/null +++ b/tests/_/schemas/pokemon/graffle/modules/global.ts @@ -0,0 +1,25 @@ +import * as $$Data from './data.js' +import * as $$MethodsDocument from './methods-document.js' +import * as $$MethodsRoot from './methods-root.js' +import * as $$MethodsSelect from './methods-select.js' +import * as $$Schema from './schema.js' + +declare global { + export namespace GraffleGlobal { + export interface Clients { + Pokemon: { + name: $$Data.Name + schema: $$Schema.Schema + interfaces: { + MethodsSelect: $$MethodsSelect.$MethodsSelect + Document: $$MethodsDocument.BuilderMethodsDocumentFn + Root: $$MethodsRoot.BuilderMethodsRootFn + } + /** + * http://localhost:3000/graphql + */ + defaultSchemaUrl: string + } + } + } +} diff --git a/tests/_/schemas/pokemon/graffle/modules/methods-document.ts b/tests/_/schemas/pokemon/graffle/modules/methods-document.ts new file mode 100644 index 000000000..af8ae82d4 --- /dev/null +++ b/tests/_/schemas/pokemon/graffle/modules/methods-document.ts @@ -0,0 +1,20 @@ +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' + +export interface Document<$Context extends $$Utilities.ClientContext> { + <$Document>( + document: $$Utilities.ExactNonEmpty<$Document, $$SelectionSets.$Document<$Context['scalars']>>, + ): $$Utilities.DocumentRunner< + $Context, + $$Schema.Schema, + // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as + // Satisfying the constraint on the DocumentRunner type. + $Document + > +} + +export interface BuilderMethodsDocumentFn extends $$Utilities.TypeFunction.Fn { + // @ts-expect-error parameter is Untyped. + return: Document +} diff --git a/tests/_/schemas/pokemon/graffle/modules/MethodsRoot.ts b/tests/_/schemas/pokemon/graffle/modules/methods-root.ts similarity index 62% rename from tests/_/schemas/pokemon/graffle/modules/MethodsRoot.ts rename to tests/_/schemas/pokemon/graffle/modules/methods-root.ts index 49034403d..96d4c88a6 100644 --- a/tests/_/schemas/pokemon/graffle/modules/MethodsRoot.ts +++ b/tests/_/schemas/pokemon/graffle/modules/methods-root.ts @@ -1,16 +1,16 @@ import type { InferResult } from '../../../../../../src/entrypoints/schema.js' import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type { Schema } from './Schema.js' -import type * as SelectionSet from './SelectionSets.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' export interface QueryMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationQuery<$SelectionSet, Schema<$Context['scalars']>> + InferResult.OperationQuery<$SelectionSet, $$Schema.Schema<$Context['scalars']>> > > > @@ -25,84 +25,84 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > battles: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.battles<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.battles<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ battles: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ battles: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'battles' > > > beings: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.beings<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.beings<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ beings: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ beings: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'beings' > > > pokemon: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.pokemon<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemon<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ pokemon: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ pokemon: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'pokemon' > > > pokemonByName: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.pokemonByName<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemonByName<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ pokemonByName: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ pokemonByName: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'pokemonByName' > > > pokemons: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.pokemons<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemons<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ pokemons: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ pokemons: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'pokemons' > > > trainerByName: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.trainerByName<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.trainerByName<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ trainerByName: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ trainerByName: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'trainerByName' > > > trainers: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.trainers<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.trainers<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ trainers: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ trainers: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'trainers' > > @@ -111,12 +111,12 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { export interface MutationMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationMutation<$SelectionSet, Schema<$Context['scalars']>> + InferResult.OperationMutation<$SelectionSet, $$Schema.Schema<$Context['scalars']>> > > > @@ -131,12 +131,12 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { > addPokemon: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.addPokemon<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.addPokemon<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationMutation<{ addPokemon: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationMutation<{ addPokemon: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'addPokemon' > > diff --git a/tests/_/schemas/pokemon/graffle/modules/MethodsSelect.ts b/tests/_/schemas/pokemon/graffle/modules/methods-select.ts similarity index 60% rename from tests/_/schemas/pokemon/graffle/modules/MethodsSelect.ts rename to tests/_/schemas/pokemon/graffle/modules/methods-select.ts index 80ada538c..bc83fcdd4 100644 --- a/tests/_/schemas/pokemon/graffle/modules/MethodsSelect.ts +++ b/tests/_/schemas/pokemon/graffle/modules/methods-select.ts @@ -1,5 +1,5 @@ -import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type * as $SelectionSets from './SelectionSets.js' +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import * as $$SelectionSets from './selection-sets.js' // // @@ -49,11 +49,11 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Query>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet } export interface Mutation { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Mutation>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>): $SelectionSet } // @@ -73,35 +73,35 @@ export interface Mutation { // export interface BattleRoyale { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.BattleRoyale>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleRoyale>): $SelectionSet } export interface BattleTrainer { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.BattleTrainer>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleTrainer>): $SelectionSet } export interface BattleWild { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.BattleWild>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleWild>): $SelectionSet } export interface CombatantMultiPokemon { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.CombatantMultiPokemon>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.CombatantMultiPokemon>): $SelectionSet } export interface CombatantSinglePokemon { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.CombatantSinglePokemon>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.CombatantSinglePokemon>): $SelectionSet } export interface Patron { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Patron>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Patron>): $SelectionSet } export interface Pokemon { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Pokemon>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Pokemon>): $SelectionSet } export interface Trainer { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Trainer>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Trainer>): $SelectionSet } // @@ -121,7 +121,7 @@ export interface Trainer { // export interface Battle { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Battle>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Battle>): $SelectionSet } // @@ -141,5 +141,5 @@ export interface Battle { // export interface Being { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Being>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Being>): $SelectionSet } diff --git a/tests/_/schemas/pokemon/graffle/modules/Scalar.ts b/tests/_/schemas/pokemon/graffle/modules/scalar.ts similarity index 100% rename from tests/_/schemas/pokemon/graffle/modules/Scalar.ts rename to tests/_/schemas/pokemon/graffle/modules/scalar.ts diff --git a/tests/_/schemas/pokemon/graffle/modules/SchemaDrivenDataMap.ts b/tests/_/schemas/pokemon/graffle/modules/schema-driven-data-map.ts similarity index 98% rename from tests/_/schemas/pokemon/graffle/modules/SchemaDrivenDataMap.ts rename to tests/_/schemas/pokemon/graffle/modules/schema-driven-data-map.ts index 9cc1d9ec5..b5e42807b 100644 --- a/tests/_/schemas/pokemon/graffle/modules/SchemaDrivenDataMap.ts +++ b/tests/_/schemas/pokemon/graffle/modules/schema-driven-data-map.ts @@ -1,5 +1,5 @@ import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import * as $Scalar from './Scalar.js' +import * as $$Scalar from './scalar.js' // // // @@ -16,15 +16,15 @@ import * as $Scalar from './Scalar.js' // // -const Boolean = $Scalar.Boolean +const Boolean = $$Scalar.Boolean -const Float = $Scalar.Float +const Float = $$Scalar.Float -const ID = $Scalar.ID +const ID = $$Scalar.ID -const Int = $Scalar.Int +const Int = $$Scalar.Int -const String = $Scalar.String +const String = $$Scalar.String // // diff --git a/tests/_/schemas/pokemon/graffle/modules/Schema.ts b/tests/_/schemas/pokemon/graffle/modules/schema.ts similarity index 99% rename from tests/_/schemas/pokemon/graffle/modules/Schema.ts rename to tests/_/schemas/pokemon/graffle/modules/schema.ts index 4b8cedda1..d674d7b58 100644 --- a/tests/_/schemas/pokemon/graffle/modules/Schema.ts +++ b/tests/_/schemas/pokemon/graffle/modules/schema.ts @@ -1,7 +1,7 @@ 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 $Scalar from './Scalar.js' +import * as $$Data from './data.js' +import * as $$Scalar from './scalar.js' export namespace Schema { // @@ -928,7 +928,7 @@ export namespace Schema { // -------------------------------------------------------------------------------------------------- // - export type Date = $Scalar.Date + export type Date = $$Scalar.Date // // @@ -1047,7 +1047,7 @@ export namespace Schema { export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.Registry = $$Utilities.Schema.Scalar.Registry.Empty> extends $ { - name: Data.Name + name: $$Data.Name operationsAvailable: ['query', 'mutation'] RootUnion: | Schema.Query diff --git a/tests/_/schemas/pokemon/graffle/modules/select.ts b/tests/_/schemas/pokemon/graffle/modules/select.ts new file mode 100644 index 000000000..c1b62970b --- /dev/null +++ b/tests/_/schemas/pokemon/graffle/modules/select.ts @@ -0,0 +1,108 @@ +import type { OperationTypeNode } from 'graphql' +import type { InferResult } from '../../../../../../src/entrypoints/schema.js' +import * as $$Data from './data.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' + +// +// +// +// +// +// +// ================================================================================================== +// Runtime +// ================================================================================================== +// +// +// +// +// +// +import { createSelect } from '../../../../../../src/entrypoints/client.js' +export const Select = createSelect($$Data.Name) + +// +// +// +// +// +// +// ================================================================================================== +// Buildtime +// ================================================================================================== +// +// +// +// +// +// + +export namespace Select { + // Root + // -------------------------------------------------------------------------------------------------- + // + export type Query<$SelectionSet extends $$SelectionSets.Query> = InferResult.Operation< + $SelectionSet, + $$Schema.Schema, + OperationTypeNode.QUERY + > + export type Mutation<$SelectionSet extends $$SelectionSets.Mutation> = InferResult.Operation< + $SelectionSet, + $$Schema.Schema, + OperationTypeNode.MUTATION + > + // OutputObject + // -------------------------------------------------------------------------------------------------- + // + export type BattleRoyale<$SelectionSet extends $$SelectionSets.BattleRoyale> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['BattleRoyale'] + > + export type BattleTrainer<$SelectionSet extends $$SelectionSets.BattleTrainer> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['BattleTrainer'] + > + export type BattleWild<$SelectionSet extends $$SelectionSets.BattleWild> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['BattleWild'] + > + export type CombatantMultiPokemon<$SelectionSet extends $$SelectionSets.CombatantMultiPokemon> = + InferResult.OutputObject<$SelectionSet, $$Schema.Schema, $$Schema.Schema['allTypes']['CombatantMultiPokemon']> + export type CombatantSinglePokemon<$SelectionSet extends $$SelectionSets.CombatantSinglePokemon> = + InferResult.OutputObject<$SelectionSet, $$Schema.Schema, $$Schema.Schema['allTypes']['CombatantSinglePokemon']> + export type Patron<$SelectionSet extends $$SelectionSets.Patron> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Patron'] + > + export type Pokemon<$SelectionSet extends $$SelectionSets.Pokemon> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Pokemon'] + > + export type Trainer<$SelectionSet extends $$SelectionSets.Trainer> = InferResult.OutputObject< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Trainer'] + > + // Union + // -------------------------------------------------------------------------------------------------- + // + export type Battle<$SelectionSet extends $$SelectionSets.Battle> = InferResult.Union< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Battle'] + > + // Interface + // -------------------------------------------------------------------------------------------------- + // + export type Being<$SelectionSet extends $$SelectionSets.Being> = InferResult.Interface< + $SelectionSet, + $$Schema.Schema, + $$Schema.Schema['allTypes']['Being'] + > +} diff --git a/tests/_/schemas/pokemon/graffle/modules/SelectionSets.ts b/tests/_/schemas/pokemon/graffle/modules/selection-sets.ts similarity index 100% rename from tests/_/schemas/pokemon/graffle/modules/SelectionSets.ts rename to tests/_/schemas/pokemon/graffle/modules/selection-sets.ts diff --git a/tests/_/schemas/query-only/graffle/_.ts b/tests/_/schemas/query-only/graffle/_.ts index d27e9e3d3..260860931 100644 --- a/tests/_/schemas/query-only/graffle/_.ts +++ b/tests/_/schemas/query-only/graffle/_.ts @@ -2,9 +2,9 @@ // It at least helps with Twoslash wherein without this import here Twoslash will not include the global module. // In real TypeScript projects it seems the global module is included automatically. But there could be certain tsconfig // setups where this still indeed does help. -import './modules/Global.js' +import './modules/global.js' -export { create } from './modules/Client.js' -export { schemaDrivenDataMap } from './modules/SchemaDrivenDataMap.js' -export { Select } from './modules/Select.js' -export * as SelectionSets from './modules/SelectionSets.js' +export { create } from './modules/client.js' +export { schemaDrivenDataMap } from './modules/schema-driven-data-map.js' +export { Select } from './modules/select.js' +export * as SelectionSets from './modules/selection-sets.js' diff --git a/tests/_/schemas/query-only/graffle/modules/Client.ts b/tests/_/schemas/query-only/graffle/modules/Client.ts deleted file mode 100644 index 9080daf87..000000000 --- a/tests/_/schemas/query-only/graffle/modules/Client.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createPrefilled } from '../../../../../../src/entrypoints/client.js' -import { defaultSchemaUrl } from './Data.js' -import { Name } from './Data.js' -import { schemaDrivenDataMap } from './SchemaDrivenDataMap.js' -export const create = createPrefilled(Name, schemaDrivenDataMap, defaultSchemaUrl) diff --git a/tests/_/schemas/query-only/graffle/modules/Global.ts b/tests/_/schemas/query-only/graffle/modules/Global.ts deleted file mode 100644 index 1e3ecabb7..000000000 --- a/tests/_/schemas/query-only/graffle/modules/Global.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type * as Data from './Data.js' -import type * as MethodsDocument from './MethodsDocument.js' -import type * as MethodsRoot from './MethodsRoot.js' -import type * as MethodsSelect from './MethodsSelect.js' -import type { Schema } from './Schema.js' - -declare global { - export namespace GraffleGlobal { - export interface Clients { - QueryOnly: { - name: Data.Name - schema: Schema - interfaces: { - MethodsSelect: MethodsSelect.$MethodsSelect - Document: MethodsDocument.BuilderMethodsDocumentFn - Root: MethodsRoot.BuilderMethodsRootFn - } - defaultSchemaUrl: null - } - } - } -} diff --git a/tests/_/schemas/query-only/graffle/modules/MethodsDocument.ts b/tests/_/schemas/query-only/graffle/modules/MethodsDocument.ts deleted file mode 100644 index f12a02bd5..000000000 --- a/tests/_/schemas/query-only/graffle/modules/MethodsDocument.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type * as Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type { Schema } from './Schema.js' -import type * as SelectionSets from './SelectionSets.js' -export interface Document<$Context extends Utilities.ClientContext> { - <$Document>( - document: Utilities.ExactNonEmpty<$Document, SelectionSets.$Document<$Context['scalars']>>, - ): Utilities.DocumentRunner< - $Context, - Schema, - // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as - // Satisfying the constraint on the DocumentRunner type. - $Document - > -} - -export interface BuilderMethodsDocumentFn extends Utilities.TypeFunction.Fn { - // @ts-expect-error parameter is Untyped. - return: Document -} diff --git a/tests/_/schemas/query-only/graffle/modules/RuntimeCustomScalars.ts b/tests/_/schemas/query-only/graffle/modules/RuntimeCustomScalars.ts deleted file mode 100644 index 18a509fa7..000000000 --- a/tests/_/schemas/query-only/graffle/modules/RuntimeCustomScalars.ts +++ /dev/null @@ -1,153 +0,0 @@ -import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import * as CustomScalars from './Scalar.js' -// -// -// -// -// -// -// ================================================================================================== -// GraphQLEnumType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLEnumTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLInputObjectType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLInputObjectTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLObjectType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLObjectTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLInterfaceType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLInterfaceTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLUnionType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLUnionTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLRootType -// ================================================================================================== -// -// -// -// -// -// - -const Query: $Utilities.SchemaDrivenDataMap.OutputObject = { - f: { - id: {}, - idNonNull: {}, - }, -} - -// -// -// -// -// -// -// ================================================================================================== -// Reference Assignments -// (avoids circular assignment issues) -// ================================================================================================== -// -// -// -// -// -// - -// None of your types have references to other non-scalar/enum types. - -// -// -// -// -// -// -// ================================================================================================== -// Index -// ================================================================================================== -// -// -// -// -// -// - -export const $index = { - Query, -} diff --git a/tests/_/schemas/query-only/graffle/modules/client.ts b/tests/_/schemas/query-only/graffle/modules/client.ts new file mode 100644 index 000000000..bed02983a --- /dev/null +++ b/tests/_/schemas/query-only/graffle/modules/client.ts @@ -0,0 +1,4 @@ +import { createPrefilled } from '../../../../../../src/entrypoints/client.js' +import * as $$Data from './data.js' +import * as $$SchemaDrivenDataMap from './schema-driven-data-map.js' +export const create = createPrefilled($$Data.Name, $$SchemaDrivenDataMap.schemaDrivenDataMap, $$Data.defaultSchemaUrl) diff --git a/tests/_/schemas/query-only/graffle/modules/Data.ts b/tests/_/schemas/query-only/graffle/modules/data.ts similarity index 100% rename from tests/_/schemas/query-only/graffle/modules/Data.ts rename to tests/_/schemas/query-only/graffle/modules/data.ts diff --git a/tests/_/schemas/query-only/graffle/modules/global.ts b/tests/_/schemas/query-only/graffle/modules/global.ts new file mode 100644 index 000000000..c6e0f2d15 --- /dev/null +++ b/tests/_/schemas/query-only/graffle/modules/global.ts @@ -0,0 +1,22 @@ +import * as $$Data from './data.js' +import * as $$MethodsDocument from './methods-document.js' +import * as $$MethodsRoot from './methods-root.js' +import * as $$MethodsSelect from './methods-select.js' +import * as $$Schema from './schema.js' + +declare global { + export namespace GraffleGlobal { + export interface Clients { + QueryOnly: { + name: $$Data.Name + schema: $$Schema.Schema + interfaces: { + MethodsSelect: $$MethodsSelect.$MethodsSelect + Document: $$MethodsDocument.BuilderMethodsDocumentFn + Root: $$MethodsRoot.BuilderMethodsRootFn + } + defaultSchemaUrl: null + } + } + } +} diff --git a/tests/_/schemas/query-only/graffle/modules/methods-document.ts b/tests/_/schemas/query-only/graffle/modules/methods-document.ts new file mode 100644 index 000000000..af8ae82d4 --- /dev/null +++ b/tests/_/schemas/query-only/graffle/modules/methods-document.ts @@ -0,0 +1,20 @@ +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' + +export interface Document<$Context extends $$Utilities.ClientContext> { + <$Document>( + document: $$Utilities.ExactNonEmpty<$Document, $$SelectionSets.$Document<$Context['scalars']>>, + ): $$Utilities.DocumentRunner< + $Context, + $$Schema.Schema, + // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as + // Satisfying the constraint on the DocumentRunner type. + $Document + > +} + +export interface BuilderMethodsDocumentFn extends $$Utilities.TypeFunction.Fn { + // @ts-expect-error parameter is Untyped. + return: Document +} diff --git a/tests/_/schemas/query-only/graffle/modules/MethodsRoot.ts b/tests/_/schemas/query-only/graffle/modules/methods-root.ts similarity index 67% rename from tests/_/schemas/query-only/graffle/modules/MethodsRoot.ts rename to tests/_/schemas/query-only/graffle/modules/methods-root.ts index d9c12a74c..a38f9ddfa 100644 --- a/tests/_/schemas/query-only/graffle/modules/MethodsRoot.ts +++ b/tests/_/schemas/query-only/graffle/modules/methods-root.ts @@ -1,16 +1,16 @@ import type { InferResult } from '../../../../../../src/entrypoints/schema.js' import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type { Schema } from './Schema.js' -import type * as SelectionSet from './SelectionSets.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' export interface QueryMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query<$Context['scalars']>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationQuery<$SelectionSet, Schema<$Context['scalars']>> + InferResult.OperationQuery<$SelectionSet, $$Schema.Schema<$Context['scalars']>> > > > @@ -25,24 +25,24 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { > id: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.id<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.id<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ id: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ id: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'id' > > > idNonNull: <$SelectionSet>( - selectionSet?: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.idNonNull<$Context['scalars']>>, + selectionSet?: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.idNonNull<$Context['scalars']>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ idNonNull: $SelectionSet }, Schema<$Context['scalars']>>, + InferResult.OperationQuery<{ idNonNull: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, 'idNonNull' > > diff --git a/tests/_/schemas/query-only/graffle/modules/MethodsSelect.ts b/tests/_/schemas/query-only/graffle/modules/methods-select.ts similarity index 86% rename from tests/_/schemas/query-only/graffle/modules/MethodsSelect.ts rename to tests/_/schemas/query-only/graffle/modules/methods-select.ts index 150d1f4c3..aa927f1e3 100644 --- a/tests/_/schemas/query-only/graffle/modules/MethodsSelect.ts +++ b/tests/_/schemas/query-only/graffle/modules/methods-select.ts @@ -1,5 +1,5 @@ -import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import type * as $SelectionSets from './SelectionSets.js' +import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' +import * as $$SelectionSets from './selection-sets.js' // // @@ -38,7 +38,7 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Query>): $SelectionSet + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet } // diff --git a/tests/_/schemas/query-only/graffle/modules/Scalar.ts b/tests/_/schemas/query-only/graffle/modules/scalar.ts similarity index 100% rename from tests/_/schemas/query-only/graffle/modules/Scalar.ts rename to tests/_/schemas/query-only/graffle/modules/scalar.ts diff --git a/tests/_/schemas/query-only/graffle/modules/SchemaDrivenDataMap.ts b/tests/_/schemas/query-only/graffle/modules/schema-driven-data-map.ts similarity index 95% rename from tests/_/schemas/query-only/graffle/modules/SchemaDrivenDataMap.ts rename to tests/_/schemas/query-only/graffle/modules/schema-driven-data-map.ts index 503ab65f0..ee11a9d47 100644 --- a/tests/_/schemas/query-only/graffle/modules/SchemaDrivenDataMap.ts +++ b/tests/_/schemas/query-only/graffle/modules/schema-driven-data-map.ts @@ -1,5 +1,5 @@ import type * as $$Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' -import * as $Scalar from './Scalar.js' +import * as $$Scalar from './scalar.js' // // // @@ -16,15 +16,15 @@ import * as $Scalar from './Scalar.js' // // -const Boolean = $Scalar.Boolean +const Boolean = $$Scalar.Boolean -const Float = $Scalar.Float +const Float = $$Scalar.Float -const ID = $Scalar.ID +const ID = $$Scalar.ID -const Int = $Scalar.Int +const Int = $$Scalar.Int -const String = $Scalar.String +const String = $$Scalar.String // // diff --git a/tests/_/schemas/query-only/graffle/modules/Schema.ts b/tests/_/schemas/query-only/graffle/modules/schema.ts similarity index 98% rename from tests/_/schemas/query-only/graffle/modules/Schema.ts rename to tests/_/schemas/query-only/graffle/modules/schema.ts index 40cd45967..4d598bad7 100644 --- a/tests/_/schemas/query-only/graffle/modules/Schema.ts +++ b/tests/_/schemas/query-only/graffle/modules/schema.ts @@ -1,7 +1,7 @@ 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 $Scalar from './Scalar.js' +import * as $$Data from './data.js' +import * as $$Scalar from './scalar.js' export namespace Schema { // @@ -254,7 +254,7 @@ export namespace Schema { export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.Registry = $$Utilities.Schema.Scalar.Registry.Empty> extends $ { - name: Data.Name + name: $$Data.Name operationsAvailable: ['query'] RootUnion: Schema.Query Root: { diff --git a/tests/_/schemas/query-only/graffle/modules/Select.ts b/tests/_/schemas/query-only/graffle/modules/select.ts similarity index 84% rename from tests/_/schemas/query-only/graffle/modules/Select.ts rename to tests/_/schemas/query-only/graffle/modules/select.ts index 74d06db5d..041366980 100644 --- a/tests/_/schemas/query-only/graffle/modules/Select.ts +++ b/tests/_/schemas/query-only/graffle/modules/select.ts @@ -1,8 +1,8 @@ import type { OperationTypeNode } from 'graphql' import type { InferResult } from '../../../../../../src/entrypoints/schema.js' -import * as Data from './Data.js' -import type { Schema } from './Schema.js' -import type * as SelectionSets from './SelectionSets.js' +import * as $$Data from './data.js' +import * as $$Schema from './schema.js' +import * as $$SelectionSets from './selection-sets.js' // // @@ -20,7 +20,7 @@ import type * as SelectionSets from './SelectionSets.js' // // import { createSelect } from '../../../../../../src/entrypoints/client.js' -export const Select = createSelect(Data.Name) +export const Select = createSelect($$Data.Name) // // @@ -42,9 +42,9 @@ export namespace Select { // Root // -------------------------------------------------------------------------------------------------- // - export type Query<$SelectionSet extends SelectionSets.Query> = InferResult.Operation< + export type Query<$SelectionSet extends $$SelectionSets.Query> = InferResult.Operation< $SelectionSet, - Schema, + $$Schema.Schema, OperationTypeNode.QUERY > // OutputObject diff --git a/tests/_/schemas/query-only/graffle/modules/SelectionSets.ts b/tests/_/schemas/query-only/graffle/modules/selection-sets.ts similarity index 100% rename from tests/_/schemas/query-only/graffle/modules/SelectionSets.ts rename to tests/_/schemas/query-only/graffle/modules/selection-sets.ts diff --git a/website/graffle/_.ts b/website/graffle/_.ts index dbebc63cb..e634c5952 100644 --- a/website/graffle/_.ts +++ b/website/graffle/_.ts @@ -2,9 +2,9 @@ // It at least helps with Twoslash wherein without this import here Twoslash will not include the global module. // In real TypeScript projects it seems the global module is included automatically. But there could be certain tsconfig // setups where this still indeed does help. -import "./modules/Global.js"; +import "./modules/global.js"; -export { create } from "./modules/Client.js"; -export { schemaDrivenDataMap } from "./modules/SchemaDrivenDataMap.js"; -export { Select } from "./modules/Select.js"; -export * as SelectionSets from "./modules/SelectionSets.js"; +export { create } from "./modules/client.js"; +export { schemaDrivenDataMap } from "./modules/schema-driven-data-map.js"; +export { Select } from "./modules/select.js"; +export * as SelectionSets from "./modules/selection-sets.js"; diff --git a/website/graffle/modules/Client.ts b/website/graffle/modules/Client.ts index b8c827873..526ad247e 100644 --- a/website/graffle/modules/Client.ts +++ b/website/graffle/modules/Client.ts @@ -1,5 +1,4 @@ import { createPrefilled } from "graffle/client"; -import { defaultSchemaUrl } from "./Data.js"; -import { Name } from "./Data.js"; -import { schemaDrivenDataMap } from "./SchemaDrivenDataMap.js"; -export const create = createPrefilled(Name, schemaDrivenDataMap, defaultSchemaUrl); +import * as $$Data from "./data.js"; +import * as $$SchemaDrivenDataMap from "./schema-driven-data-map.js"; +export const create = createPrefilled($$Data.Name, $$SchemaDrivenDataMap.schemaDrivenDataMap, $$Data.defaultSchemaUrl); diff --git a/website/graffle/modules/Global.ts b/website/graffle/modules/Global.ts index 89ac0455b..ebb76b682 100644 --- a/website/graffle/modules/Global.ts +++ b/website/graffle/modules/Global.ts @@ -1,19 +1,19 @@ -import type * as Data from "./Data.js"; -import type * as MethodsDocument from "./MethodsDocument.js"; -import type * as MethodsRoot from "./MethodsRoot.js"; -import type * as MethodsSelect from "./MethodsSelect.js"; -import type { Schema } from "./Schema.js"; +import * as $$Data from "./data.js"; +import * as $$MethodsDocument from "./methods-document.js"; +import * as $$MethodsRoot from "./methods-root.js"; +import * as $$MethodsSelect from "./methods-select.js"; +import * as $$Schema from "./schema.js"; declare global { export namespace GraffleGlobal { export interface Clients { default: { - name: Data.Name; - schema: Schema; + name: $$Data.Name; + schema: $$Schema.Schema; interfaces: { - MethodsSelect: MethodsSelect.$MethodsSelect; - Document: MethodsDocument.BuilderMethodsDocumentFn; - Root: MethodsRoot.BuilderMethodsRootFn; + MethodsSelect: $$MethodsSelect.$MethodsSelect; + Document: $$MethodsDocument.BuilderMethodsDocumentFn; + Root: $$MethodsRoot.BuilderMethodsRootFn; }; defaultSchemaUrl: null; }; diff --git a/website/graffle/modules/MethodsDocument.ts b/website/graffle/modules/MethodsDocument.ts deleted file mode 100644 index f0f74d3c9..000000000 --- a/website/graffle/modules/MethodsDocument.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type * as Utilities from "graffle/utilities-for-generated"; -import type { Schema } from "./Schema.js"; -import type * as SelectionSets from "./SelectionSets.js"; -export interface Document<$Context extends Utilities.ClientContext> { - <$Document>( - document: Utilities.ExactNonEmpty<$Document, SelectionSets.$Document<$Context["scalars"]>>, - ): Utilities.DocumentRunner< - $Context, - Schema, - // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as - // Satisfying the constraint on the DocumentRunner type. - $Document - >; -} - -export interface BuilderMethodsDocumentFn extends Utilities.TypeFunction.Fn { - // @ts-expect-error parameter is Untyped. - return: Document; -} diff --git a/website/graffle/modules/Schema.ts b/website/graffle/modules/Schema.ts index 0a9728721..3e33b36f5 100644 --- a/website/graffle/modules/Schema.ts +++ b/website/graffle/modules/Schema.ts @@ -1,7 +1,7 @@ import type { Schema as $ } from "graffle/utilities-for-generated"; import type * as $$Utilities from "graffle/utilities-for-generated"; -import type * as Data from "./Data.js"; -import type * as $Scalar from "./Scalar.js"; +import * as $$Data from "./data.js"; +import * as $$Scalar from "./scalar.js"; export namespace Schema { // @@ -812,7 +812,7 @@ export namespace Schema { export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.Registry = $$Utilities.Schema.Scalar.Registry.Empty> extends $ { - name: Data.Name; + name: $$Data.Name; operationsAvailable: ["query"]; RootUnion: Schema.Query; Root: { diff --git a/website/graffle/modules/SchemaRuntime.ts b/website/graffle/modules/SchemaRuntime.ts deleted file mode 100644 index e5648df29..000000000 --- a/website/graffle/modules/SchemaRuntime.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* eslint-disable */ -import * as $ from 'graffle/schema' -import * as Data from './Data.js' -import * as $Scalar from './Scalar.js' -import { $index as $customScalarsIndex } from './SchemaDrivenDataMa' -import type { Index } from './SchemaIndex.js' -export const $defaultSchemaUrl = new URL('https://countries.trevorblades.com/graphql') - -export const ContinentFilterInput = $.InputObject(`ContinentFilterInput`, { - code: $.Input.Field(() => $.Input.Nullable(StringQueryOperatorInput)), -}, true) - -export const CountryFilterInput = $.InputObject(`CountryFilterInput`, { - code: $.Input.Field(() => $.Input.Nullable(StringQueryOperatorInput)), - continent: $.Input.Field(() => $.Input.Nullable(StringQueryOperatorInput)), - currency: $.Input.Field(() => $.Input.Nullable(StringQueryOperatorInput)), - name: $.Input.Field(() => $.Input.Nullable(StringQueryOperatorInput)), -}, true) - -export const LanguageFilterInput = $.InputObject(`LanguageFilterInput`, { - code: $.Input.Field(() => $.Input.Nullable(StringQueryOperatorInput)), -}, true) - -export const StringQueryOperatorInput = $.InputObject(`StringQueryOperatorInput`, { - eq: $.Input.Field($.Input.Nullable($Scalar.String)), - in: $.Input.Field($.Input.Nullable($.Input.List($Scalar.String))), - ne: $.Input.Field($.Input.Nullable($Scalar.String)), - nin: $.Input.Field($.Input.Nullable($.Input.List($Scalar.String))), - regex: $.Input.Field($.Input.Nullable($Scalar.String)), -}, true) -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const Continent = $.Object$(`Continent`, { - code: $.field('code', $Scalar.ID), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - countries: $.field('countries', $.Output.List(() => Country)), - name: $.field('name', $Scalar.String), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const Country = $.Object$(`Country`, { - awsRegion: $.field('awsRegion', $Scalar.String), - capital: $.field('capital', $.Output.Nullable($Scalar.String)), - code: $.field('code', $Scalar.ID), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - continent: $.field('continent', () => Continent), - currencies: $.field('currencies', $.Output.List($Scalar.String)), - currency: $.field('currency', $.Output.Nullable($Scalar.String)), - emoji: $.field('emoji', $Scalar.String), - emojiU: $.field('emojiU', $Scalar.String), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - languages: $.field('languages', $.Output.List(() => Language)), - name: $.field('name', $Scalar.String, $.Args({ lang: $.Input.Field($.Input.Nullable($Scalar.String)) }, true)), - native: $.field('native', $Scalar.String), - phone: $.field('phone', $Scalar.String), - phones: $.field('phones', $.Output.List($Scalar.String)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - states: $.field('states', $.Output.List(() => State)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - subdivisions: $.field('subdivisions', $.Output.List(() => Subdivision)), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const Language = $.Object$(`Language`, { - code: $.field('code', $Scalar.ID), - name: $.field('name', $Scalar.String), - native: $.field('native', $Scalar.String), - rtl: $.field('rtl', $Scalar.Boolean), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const State = $.Object$(`State`, { - code: $.field('code', $.Output.Nullable($Scalar.String)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - country: $.field('country', () => Country), - name: $.field('name', $Scalar.String), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const Subdivision = $.Object$(`Subdivision`, { - code: $.field('code', $Scalar.ID), - emoji: $.field('emoji', $.Output.Nullable($Scalar.String)), - name: $.field('name', $Scalar.String), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const Query = $.Object$(`Query`, { - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - continent: $.field( - 'continent', - $.Output.Nullable(() => Continent), - $.Args({ code: $.Input.Field($Scalar.ID) }, false), - ), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - continents: $.field( - 'continents', - $.Output.List(() => Continent), - $.Args({ filter: $.Input.Field($.Input.Nullable(ContinentFilterInput)) }, true), - ), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - countries: $.field( - 'countries', - $.Output.List(() => Country), - $.Args({ filter: $.Input.Field($.Input.Nullable(CountryFilterInput)) }, true), - ), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - country: $.field('country', $.Output.Nullable(() => Country), $.Args({ code: $.Input.Field($Scalar.ID) }, false)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - language: $.field('language', $.Output.Nullable(() => Language), $.Args({ code: $.Input.Field($Scalar.ID) }, false)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - languages: $.field( - 'languages', - $.Output.List(() => Language), - $.Args({ filter: $.Input.Field($.Input.Nullable(LanguageFilterInput)) }, true), - ), -}) -export const $Index: Index = { - name: Data.Name, - operationsAvailable: ['Query'] as const, - RootUnion: undefined as any, // Type level only. - Root: { - Query, - Mutation: null, - Subscription: null, - }, - allTypes: { - Query, - Continent, - Country, - Language, - State, - Subdivision, - }, - objects: { - Continent, - Country, - Language, - State, - Subdivision, - }, - unions: {}, - interfaces: {}, - customScalars: { - input: $customScalarsIndex, - }, - error: { - objects: {}, - objectsTypename: {}, - rootResultFields: { - Mutation: {}, - Subscription: {}, - Query: {}, - }, - }, -} diff --git a/website/graffle/modules/Select.ts b/website/graffle/modules/Select.ts index d1734b6b4..0dfbe6581 100644 --- a/website/graffle/modules/Select.ts +++ b/website/graffle/modules/Select.ts @@ -1,8 +1,8 @@ import type { InferResult } from "graffle/schema"; import type { OperationTypeNode } from "graphql"; -import * as Data from "./Data.js"; -import type { Schema } from "./Schema.js"; -import type * as SelectionSets from "./SelectionSets.js"; +import * as $$Data from "./data.js"; +import * as $$Schema from "./schema.js"; +import * as $$SelectionSets from "./selection-sets.js"; // // @@ -20,7 +20,7 @@ import type * as SelectionSets from "./SelectionSets.js"; // // import { createSelect } from "graffle/client"; -export const Select = createSelect(Data.Name); +export const Select = createSelect($$Data.Name); // // @@ -42,38 +42,38 @@ export namespace Select { // Root // -------------------------------------------------------------------------------------------------- // - export type Query<$SelectionSet extends SelectionSets.Query> = InferResult.Operation< + export type Query<$SelectionSet extends $$SelectionSets.Query> = InferResult.Operation< $SelectionSet, - Schema, + $$Schema.Schema, OperationTypeNode.QUERY >; // OutputObject // -------------------------------------------------------------------------------------------------- // - export type Continent<$SelectionSet extends SelectionSets.Continent> = InferResult.OutputObject< + export type Continent<$SelectionSet extends $$SelectionSets.Continent> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema["allTypes"]["Continent"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["Continent"] >; - export type Country<$SelectionSet extends SelectionSets.Country> = InferResult.OutputObject< + export type Country<$SelectionSet extends $$SelectionSets.Country> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema["allTypes"]["Country"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["Country"] >; - export type Language<$SelectionSet extends SelectionSets.Language> = InferResult.OutputObject< + export type Language<$SelectionSet extends $$SelectionSets.Language> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema["allTypes"]["Language"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["Language"] >; - export type State<$SelectionSet extends SelectionSets.State> = InferResult.OutputObject< + export type State<$SelectionSet extends $$SelectionSets.State> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema["allTypes"]["State"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["State"] >; - export type Subdivision<$SelectionSet extends SelectionSets.Subdivision> = InferResult.OutputObject< + export type Subdivision<$SelectionSet extends $$SelectionSets.Subdivision> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema["allTypes"]["Subdivision"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["Subdivision"] >; // Union // -------------------------------------------------------------------------------------------------- diff --git a/website/graffle/modules/methods-document.ts b/website/graffle/modules/methods-document.ts new file mode 100644 index 000000000..2806f0e85 --- /dev/null +++ b/website/graffle/modules/methods-document.ts @@ -0,0 +1,20 @@ +import type * as $$Utilities from "graffle/utilities-for-generated"; +import * as $$Schema from "./schema.js"; +import * as $$SelectionSets from "./selection-sets.js"; + +export interface Document<$Context extends $$Utilities.ClientContext> { + <$Document>( + document: $$Utilities.ExactNonEmpty<$Document, $$SelectionSets.$Document<$Context["scalars"]>>, + ): $$Utilities.DocumentRunner< + $Context, + $$Schema.Schema, + // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as + // Satisfying the constraint on the DocumentRunner type. + $Document + >; +} + +export interface BuilderMethodsDocumentFn extends $$Utilities.TypeFunction.Fn { + // @ts-expect-error parameter is Untyped. + return: Document; +} diff --git a/website/graffle/modules/MethodsRoot.ts b/website/graffle/modules/methods-root.ts similarity index 64% rename from website/graffle/modules/MethodsRoot.ts rename to website/graffle/modules/methods-root.ts index f30c97215..dc2e5d042 100644 --- a/website/graffle/modules/MethodsRoot.ts +++ b/website/graffle/modules/methods-root.ts @@ -1,16 +1,16 @@ import type { InferResult } from "graffle/schema"; import type * as $$Utilities from "graffle/utilities-for-generated"; -import type { Schema } from "./Schema.js"; -import type * as SelectionSet from "./SelectionSets.js"; +import * as $$Schema from "./schema.js"; +import * as $$SelectionSets from "./selection-sets.js"; export interface QueryMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationQuery<$SelectionSet, Schema<$Context["scalars"]>> + InferResult.OperationQuery<$SelectionSet, $$Schema.Schema<$Context["scalars"]>> > > >; @@ -25,72 +25,72 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { >; continent: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.continent<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.continent<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ continent: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ continent: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "continent" > > >; continents: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.continents<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.continents<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ continents: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ continents: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "continents" > > >; countries: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.countries<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.countries<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ countries: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ countries: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "countries" > > >; country: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.country<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.country<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ country: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ country: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "country" > > >; language: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.language<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.language<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ language: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ language: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "language" > > >; languages: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.languages<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.languages<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ languages: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ languages: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "languages" > > diff --git a/website/graffle/modules/MethodsSelect.ts b/website/graffle/modules/methods-select.ts similarity index 70% rename from website/graffle/modules/MethodsSelect.ts rename to website/graffle/modules/methods-select.ts index ed90d373f..ac199c2d9 100644 --- a/website/graffle/modules/MethodsSelect.ts +++ b/website/graffle/modules/methods-select.ts @@ -1,5 +1,5 @@ -import type * as $Utilities from "graffle/utilities-for-generated"; -import type * as $SelectionSets from "./SelectionSets.js"; +import type * as $$Utilities from "graffle/utilities-for-generated"; +import * as $$SelectionSets from "./selection-sets.js"; // // @@ -43,7 +43,7 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Query>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet; } // @@ -63,23 +63,23 @@ export interface Query { // export interface Continent { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Continent>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Continent>): $SelectionSet; } export interface Country { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Country>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Country>): $SelectionSet; } export interface Language { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Language>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Language>): $SelectionSet; } export interface State { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.State>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.State>): $SelectionSet; } export interface Subdivision { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Subdivision>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Subdivision>): $SelectionSet; } // diff --git a/website/graffle/modules/SchemaDrivenDataMap.ts b/website/graffle/modules/schema-driven-data-map.ts similarity index 97% rename from website/graffle/modules/SchemaDrivenDataMap.ts rename to website/graffle/modules/schema-driven-data-map.ts index 78f8860c3..4ea220518 100644 --- a/website/graffle/modules/SchemaDrivenDataMap.ts +++ b/website/graffle/modules/schema-driven-data-map.ts @@ -1,5 +1,5 @@ import type * as $$Utilities from "graffle/utilities-for-generated"; -import * as $Scalar from "./Scalar.js"; +import * as $$Scalar from "./scalar.js"; // // // @@ -16,15 +16,15 @@ import * as $Scalar from "./Scalar.js"; // // -const Boolean = $Scalar.Boolean; +const Boolean = $$Scalar.Boolean; -const Float = $Scalar.Float; +const Float = $$Scalar.Float; -const ID = $Scalar.ID; +const ID = $$Scalar.ID; -const Int = $Scalar.Int; +const Int = $$Scalar.Int; -const String = $Scalar.String; +const String = $$Scalar.String; // // diff --git a/website/graffle/modules/SelectionSets.ts b/website/graffle/modules/selection-sets.ts similarity index 100% rename from website/graffle/modules/SelectionSets.ts rename to website/graffle/modules/selection-sets.ts diff --git a/website/pokemon/_.ts b/website/pokemon/_.ts index dbebc63cb..e634c5952 100644 --- a/website/pokemon/_.ts +++ b/website/pokemon/_.ts @@ -2,9 +2,9 @@ // It at least helps with Twoslash wherein without this import here Twoslash will not include the global module. // In real TypeScript projects it seems the global module is included automatically. But there could be certain tsconfig // setups where this still indeed does help. -import "./modules/Global.js"; +import "./modules/global.js"; -export { create } from "./modules/Client.js"; -export { schemaDrivenDataMap } from "./modules/SchemaDrivenDataMap.js"; -export { Select } from "./modules/Select.js"; -export * as SelectionSets from "./modules/SelectionSets.js"; +export { create } from "./modules/client.js"; +export { schemaDrivenDataMap } from "./modules/schema-driven-data-map.js"; +export { Select } from "./modules/select.js"; +export * as SelectionSets from "./modules/selection-sets.js"; diff --git a/website/pokemon/modules/Client.ts b/website/pokemon/modules/Client.ts index b8c827873..526ad247e 100644 --- a/website/pokemon/modules/Client.ts +++ b/website/pokemon/modules/Client.ts @@ -1,5 +1,4 @@ import { createPrefilled } from "graffle/client"; -import { defaultSchemaUrl } from "./Data.js"; -import { Name } from "./Data.js"; -import { schemaDrivenDataMap } from "./SchemaDrivenDataMap.js"; -export const create = createPrefilled(Name, schemaDrivenDataMap, defaultSchemaUrl); +import * as $$Data from "./data.js"; +import * as $$SchemaDrivenDataMap from "./schema-driven-data-map.js"; +export const create = createPrefilled($$Data.Name, $$SchemaDrivenDataMap.schemaDrivenDataMap, $$Data.defaultSchemaUrl); diff --git a/website/pokemon/modules/Global.ts b/website/pokemon/modules/Global.ts index bde6052b7..1df710f08 100644 --- a/website/pokemon/modules/Global.ts +++ b/website/pokemon/modules/Global.ts @@ -1,19 +1,19 @@ -import type * as Data from "./Data.js"; -import type * as MethodsDocument from "./MethodsDocument.js"; -import type * as MethodsRoot from "./MethodsRoot.js"; -import type * as MethodsSelect from "./MethodsSelect.js"; -import type { Schema } from "./Schema.js"; +import * as $$Data from "./data.js"; +import * as $$MethodsDocument from "./methods-document.js"; +import * as $$MethodsRoot from "./methods-root.js"; +import * as $$MethodsSelect from "./methods-select.js"; +import * as $$Schema from "./schema.js"; declare global { export namespace GraffleGlobal { export interface Clients { Pokemon: { - name: Data.Name; - schema: Schema; + name: $$Data.Name; + schema: $$Schema.Schema; interfaces: { - MethodsSelect: MethodsSelect.$MethodsSelect; - Document: MethodsDocument.BuilderMethodsDocumentFn; - Root: MethodsRoot.BuilderMethodsRootFn; + MethodsSelect: $$MethodsSelect.$MethodsSelect; + Document: $$MethodsDocument.BuilderMethodsDocumentFn; + Root: $$MethodsRoot.BuilderMethodsRootFn; }; /** * http://localhost:3000/graphql diff --git a/website/pokemon/modules/MethodsDocument.ts b/website/pokemon/modules/MethodsDocument.ts deleted file mode 100644 index f0f74d3c9..000000000 --- a/website/pokemon/modules/MethodsDocument.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type * as Utilities from "graffle/utilities-for-generated"; -import type { Schema } from "./Schema.js"; -import type * as SelectionSets from "./SelectionSets.js"; -export interface Document<$Context extends Utilities.ClientContext> { - <$Document>( - document: Utilities.ExactNonEmpty<$Document, SelectionSets.$Document<$Context["scalars"]>>, - ): Utilities.DocumentRunner< - $Context, - Schema, - // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as - // Satisfying the constraint on the DocumentRunner type. - $Document - >; -} - -export interface BuilderMethodsDocumentFn extends Utilities.TypeFunction.Fn { - // @ts-expect-error parameter is Untyped. - return: Document; -} diff --git a/website/pokemon/modules/RuntimeCustomScalars.ts b/website/pokemon/modules/RuntimeCustomScalars.ts deleted file mode 100644 index 13aee9e4b..000000000 --- a/website/pokemon/modules/RuntimeCustomScalars.ts +++ /dev/null @@ -1,108 +0,0 @@ -import * as CustomScalars from './Scalar.js' -// -// -// -// -// -// -// ================================================================================================== -// GraphQLInputObjectType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLInputObjectTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLObjectType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLObjectTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLInterfaceType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLInterfaceTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLUnionType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLUnionTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// GraphQLRootType -// ================================================================================================== -// -// -// -// -// -// - -// None of your GraphQLRootTypes have custom scalars. - -// -// -// -// -// -// -// ================================================================================================== -// Index -// ================================================================================================== -// -// -// -// -// -// - -export const $index = {} diff --git a/website/pokemon/modules/Schema.ts b/website/pokemon/modules/Schema.ts index 1cc47e4ba..3eec31b9d 100644 --- a/website/pokemon/modules/Schema.ts +++ b/website/pokemon/modules/Schema.ts @@ -1,7 +1,7 @@ import type { Schema as $ } from "graffle/utilities-for-generated"; import type * as $$Utilities from "graffle/utilities-for-generated"; -import type * as Data from "./Data.js"; -import type * as $Scalar from "./Scalar.js"; +import * as $$Data from "./data.js"; +import * as $$Scalar from "./scalar.js"; export namespace Schema { // @@ -928,7 +928,7 @@ export namespace Schema { // -------------------------------------------------------------------------------------------------- // - export type Date = $Scalar.Date; + export type Date = $$Scalar.Date; // // @@ -1047,7 +1047,7 @@ export namespace Schema { export interface Schema<$Scalars extends $$Utilities.Schema.Scalar.Registry = $$Utilities.Schema.Scalar.Registry.Empty> extends $ { - name: Data.Name; + name: $$Data.Name; operationsAvailable: ["query", "mutation"]; RootUnion: | Schema.Query diff --git a/website/pokemon/modules/SchemaRuntime.ts b/website/pokemon/modules/SchemaRuntime.ts deleted file mode 100644 index d4edf9aa8..000000000 --- a/website/pokemon/modules/SchemaRuntime.ts +++ /dev/null @@ -1,228 +0,0 @@ -/* eslint-disable */ -import * as $ from 'graffle/schema' -import * as Data from './Data.js' -import * as $Scalar from './Scalar.js' -import { $index as $customScalarsIndex } from './SchemaDrivenDataMap.js' -import type { Index } from './SchemaIndex.js' -export const $defaultSchemaUrl = new URL('http://localhost:3000/graphql') -export const BattleWildResult = $.Enum(`BattleWildResult`, [`pokemonsCaptured`, `pokemonsDefeated`, `trainerDefeated`]) -export const PokemonType = $.Enum(`PokemonType`, [`bug`, `electric`, `fire`, `grass`, `water`]) -export const TrainerClass = $.Enum(`TrainerClass`, [ - `bugCatcher`, - `camper`, - `picnicker`, - `psychic`, - `psychicMedium`, - `psychicYoungster`, - `sailor`, - `superNerd`, - `tamer`, - `teamRocketGrunt`, - `triathlete`, - `youngster`, - `youth`, -]) -export const DateFilter = $.InputObject(`DateFilter`, { - gte: $.Input.Field($.Input.Nullable($Scalar.Float)), - lte: $.Input.Field($.Input.Nullable($Scalar.Float)), -}, true) - -export const PokemonFilter = $.InputObject(`PokemonFilter`, { - birthday: $.Input.Field(() => $.Input.Nullable(DateFilter)), - name: $.Input.Field(() => $.Input.Nullable(StringFilter)), -}, true) - -export const StringFilter = $.InputObject(`StringFilter`, { - contains: $.Input.Field($.Input.Nullable($Scalar.String)), - in: $.Input.Field($.Input.Nullable($.Input.List($Scalar.String))), -}, true) -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const BattleRoyale = $.Object$(`BattleRoyale`, { - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - combatants: $.field('combatants', $.Output.Nullable($.Output.List(() => CombatantMultiPokemon))), - date: $.field('date', $.Output.Nullable($Scalar.Float)), - id: $.field('id', $.Output.Nullable($Scalar.ID)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - winner: $.field('winner', $.Output.Nullable(() => Trainer)), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const BattleTrainer = $.Object$(`BattleTrainer`, { - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - combatant1: $.field('combatant1', $.Output.Nullable(() => CombatantSinglePokemon)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - combatant2: $.field('combatant2', $.Output.Nullable(() => CombatantSinglePokemon)), - date: $.field('date', $.Output.Nullable($Scalar.Float)), - id: $.field('id', $.Output.Nullable($Scalar.ID)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - winner: $.field('winner', $.Output.Nullable(() => Trainer)), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const BattleWild = $.Object$(`BattleWild`, { - date: $.field('date', $.Output.Nullable($Scalar.Float)), - id: $.field('id', $.Output.Nullable($Scalar.ID)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - pokemon: $.field('pokemon', $.Output.Nullable(() => Pokemon)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - result: $.field('result', $.Output.Nullable(BattleWildResult)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - trainer: $.field('trainer', $.Output.Nullable(() => Trainer)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - wildPokemons: $.field('wildPokemons', $.Output.Nullable($.Output.List(() => Pokemon))), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const CombatantMultiPokemon = $.Object$(`CombatantMultiPokemon`, { - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - pokemons: $.field('pokemons', $.Output.Nullable($.Output.List(() => Pokemon))), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - trainer: $.field('trainer', $.Output.Nullable(() => Trainer)), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const CombatantSinglePokemon = $.Object$(`CombatantSinglePokemon`, { - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - pokemon: $.field('pokemon', $.Output.Nullable(() => Pokemon)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - trainer: $.field('trainer', $.Output.Nullable(() => Trainer)), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const Patron = $.Object$(`Patron`, { - id: $.field('id', $.Output.Nullable($Scalar.ID)), - money: $.field('money', $.Output.Nullable($Scalar.Int)), - name: $.field('name', $.Output.Nullable($Scalar.String)), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const Pokemon = $.Object$(`Pokemon`, { - attack: $.field('attack', $.Output.Nullable($Scalar.Int)), - birthday: $.field('birthday', $.Output.Nullable($Scalar.Int)), - defense: $.field('defense', $.Output.Nullable($Scalar.Int)), - hp: $.field('hp', $.Output.Nullable($Scalar.Int)), - id: $.field('id', $.Output.Nullable($Scalar.ID)), - name: $.field('name', $.Output.Nullable($Scalar.String)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - trainer: $.field('trainer', $.Output.Nullable(() => Trainer)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - type: $.field('type', $.Output.Nullable(PokemonType)), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const Trainer = $.Object$(`Trainer`, { - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - class: $.field('class', $.Output.Nullable(TrainerClass)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - fans: $.field('fans', $.Output.Nullable($.Output.List(() => Patron))), - id: $.field('id', $.Output.Nullable($Scalar.ID)), - name: $.field('name', $.Output.Nullable($Scalar.String)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - pokemon: $.field('pokemon', $.Output.Nullable($.Output.List(() => Pokemon))), -}) -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const Battle = $.Union(`Battle`, [BattleRoyale, BattleTrainer, BattleWild]) -export const Being = $.Interface(`Being`, { - id: $.field('id', $.Output.Nullable($Scalar.ID)), - name: $.field('name', $.Output.Nullable($Scalar.String)), -}, [Patron, Pokemon, Trainer]) -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const Mutation = $.Object$(`Mutation`, { - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - addPokemon: $.field( - 'addPokemon', - $.Output.Nullable(() => Pokemon), - $.Args({ - attack: $.Input.Field($.Input.Nullable($Scalar.Int)), - defense: $.Input.Field($.Input.Nullable($Scalar.Int)), - hp: $.Input.Field($.Input.Nullable($Scalar.Int)), - name: $.Input.Field($Scalar.String), - type: $.Input.Field(PokemonType), - }, false), - ), -}) - -// @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. -export const Query = $.Object$(`Query`, { - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - battles: $.field('battles', $.Output.List(() => Battle)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - beings: $.field('beings', $.Output.List(() => Being)), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - pokemon: $.field('pokemon', $.Output.Nullable($.Output.List(() => Pokemon))), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - pokemonByName: $.field( - 'pokemonByName', - $.Output.Nullable($.Output.List(() => Pokemon)), - $.Args({ name: $.Input.Field($Scalar.String) }, false), - ), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - pokemons: $.field( - 'pokemons', - $.Output.Nullable($.Output.List(() => Pokemon)), - $.Args({ filter: $.Input.Field($.Input.Nullable(PokemonFilter)) }, true), - ), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - trainerByName: $.field( - 'trainerByName', - $.Output.Nullable(() => Trainer), - $.Args({ name: $.Input.Field($Scalar.String) }, false), - ), - // @ts-ignore - circular types cannot infer. Ignore in case there are any. This comment is always added, it does not indicate if this particular type could infer or not. - trainers: $.field('trainers', $.Output.Nullable($.Output.List(() => Trainer))), -}) -export const $Index: Index = { - name: Data.Name, - operationsAvailable: ['Mutation', 'Query'] as const, - RootUnion: undefined as any, // Type level only. - Root: { - Query, - Mutation, - Subscription: null, - }, - allTypes: { - Mutation, - Query, - Battle, - BattleRoyale, - BattleTrainer, - BattleWild, - CombatantMultiPokemon, - CombatantSinglePokemon, - Patron, - Pokemon, - Trainer, - Being, - BattleWildResult, - PokemonType, - TrainerClass, - }, - objects: { - BattleRoyale, - BattleTrainer, - BattleWild, - CombatantMultiPokemon, - CombatantSinglePokemon, - Patron, - Pokemon, - Trainer, - }, - unions: { - Battle, - }, - interfaces: { - Being, - }, - customScalars: { - input: $customScalarsIndex, - }, - error: { - objects: {}, - objectsTypename: {}, - rootResultFields: { - Subscription: {}, - Mutation: {}, - Query: {}, - }, - }, -} diff --git a/website/pokemon/modules/Select.ts b/website/pokemon/modules/Select.ts index 06bba5604..8ed488e89 100644 --- a/website/pokemon/modules/Select.ts +++ b/website/pokemon/modules/Select.ts @@ -1,8 +1,8 @@ import type { InferResult } from "graffle/schema"; import type { OperationTypeNode } from "graphql"; -import * as Data from "./Data.js"; -import type { Schema } from "./Schema.js"; -import type * as SelectionSets from "./SelectionSets.js"; +import * as $$Data from "./data.js"; +import * as $$Schema from "./schema.js"; +import * as $$SelectionSets from "./selection-sets.js"; // // @@ -20,7 +20,7 @@ import type * as SelectionSets from "./SelectionSets.js"; // // import { createSelect } from "graffle/client"; -export const Select = createSelect(Data.Name); +export const Select = createSelect($$Data.Name); // // @@ -42,67 +42,67 @@ export namespace Select { // Root // -------------------------------------------------------------------------------------------------- // - export type Query<$SelectionSet extends SelectionSets.Query> = InferResult.Operation< + export type Query<$SelectionSet extends $$SelectionSets.Query> = InferResult.Operation< $SelectionSet, - Schema, + $$Schema.Schema, OperationTypeNode.QUERY >; - export type Mutation<$SelectionSet extends SelectionSets.Mutation> = InferResult.Operation< + export type Mutation<$SelectionSet extends $$SelectionSets.Mutation> = InferResult.Operation< $SelectionSet, - Schema, + $$Schema.Schema, OperationTypeNode.MUTATION >; // OutputObject // -------------------------------------------------------------------------------------------------- // - export type BattleRoyale<$SelectionSet extends SelectionSets.BattleRoyale> = InferResult.OutputObject< + export type BattleRoyale<$SelectionSet extends $$SelectionSets.BattleRoyale> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema["allTypes"]["BattleRoyale"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["BattleRoyale"] >; - export type BattleTrainer<$SelectionSet extends SelectionSets.BattleTrainer> = InferResult.OutputObject< + export type BattleTrainer<$SelectionSet extends $$SelectionSets.BattleTrainer> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema["allTypes"]["BattleTrainer"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["BattleTrainer"] >; - export type BattleWild<$SelectionSet extends SelectionSets.BattleWild> = InferResult.OutputObject< + export type BattleWild<$SelectionSet extends $$SelectionSets.BattleWild> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema["allTypes"]["BattleWild"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["BattleWild"] >; - export type CombatantMultiPokemon<$SelectionSet extends SelectionSets.CombatantMultiPokemon> = - InferResult.OutputObject<$SelectionSet, Schema, Schema["allTypes"]["CombatantMultiPokemon"]>; - export type CombatantSinglePokemon<$SelectionSet extends SelectionSets.CombatantSinglePokemon> = - InferResult.OutputObject<$SelectionSet, Schema, Schema["allTypes"]["CombatantSinglePokemon"]>; - export type Patron<$SelectionSet extends SelectionSets.Patron> = InferResult.OutputObject< + export type CombatantMultiPokemon<$SelectionSet extends $$SelectionSets.CombatantMultiPokemon> = + InferResult.OutputObject<$SelectionSet, $$Schema.Schema, $$Schema.Schema["allTypes"]["CombatantMultiPokemon"]>; + export type CombatantSinglePokemon<$SelectionSet extends $$SelectionSets.CombatantSinglePokemon> = + InferResult.OutputObject<$SelectionSet, $$Schema.Schema, $$Schema.Schema["allTypes"]["CombatantSinglePokemon"]>; + export type Patron<$SelectionSet extends $$SelectionSets.Patron> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema["allTypes"]["Patron"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["Patron"] >; - export type Pokemon<$SelectionSet extends SelectionSets.Pokemon> = InferResult.OutputObject< + export type Pokemon<$SelectionSet extends $$SelectionSets.Pokemon> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema["allTypes"]["Pokemon"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["Pokemon"] >; - export type Trainer<$SelectionSet extends SelectionSets.Trainer> = InferResult.OutputObject< + export type Trainer<$SelectionSet extends $$SelectionSets.Trainer> = InferResult.OutputObject< $SelectionSet, - Schema, - Schema["allTypes"]["Trainer"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["Trainer"] >; // Union // -------------------------------------------------------------------------------------------------- // - export type Battle<$SelectionSet extends SelectionSets.Battle> = InferResult.Union< + export type Battle<$SelectionSet extends $$SelectionSets.Battle> = InferResult.Union< $SelectionSet, - Schema, - Schema["allTypes"]["Battle"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["Battle"] >; // Interface // -------------------------------------------------------------------------------------------------- // - export type Being<$SelectionSet extends SelectionSets.Being> = InferResult.Interface< + export type Being<$SelectionSet extends $$SelectionSets.Being> = InferResult.Interface< $SelectionSet, - Schema, - Schema["allTypes"]["Being"] + $$Schema.Schema, + $$Schema.Schema["allTypes"]["Being"] >; } diff --git a/website/pokemon/modules/methods-document.ts b/website/pokemon/modules/methods-document.ts new file mode 100644 index 000000000..2806f0e85 --- /dev/null +++ b/website/pokemon/modules/methods-document.ts @@ -0,0 +1,20 @@ +import type * as $$Utilities from "graffle/utilities-for-generated"; +import * as $$Schema from "./schema.js"; +import * as $$SelectionSets from "./selection-sets.js"; + +export interface Document<$Context extends $$Utilities.ClientContext> { + <$Document>( + document: $$Utilities.ExactNonEmpty<$Document, $$SelectionSets.$Document<$Context["scalars"]>>, + ): $$Utilities.DocumentRunner< + $Context, + $$Schema.Schema, + // @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as + // Satisfying the constraint on the DocumentRunner type. + $Document + >; +} + +export interface BuilderMethodsDocumentFn extends $$Utilities.TypeFunction.Fn { + // @ts-expect-error parameter is Untyped. + return: Document; +} diff --git a/website/pokemon/modules/MethodsRoot.ts b/website/pokemon/modules/methods-root.ts similarity index 62% rename from website/pokemon/modules/MethodsRoot.ts rename to website/pokemon/modules/methods-root.ts index 84b5e15da..a8fb7ad80 100644 --- a/website/pokemon/modules/MethodsRoot.ts +++ b/website/pokemon/modules/methods-root.ts @@ -1,16 +1,16 @@ import type { InferResult } from "graffle/schema"; import type * as $$Utilities from "graffle/utilities-for-generated"; -import type { Schema } from "./Schema.js"; -import type * as SelectionSet from "./SelectionSets.js"; +import * as $$Schema from "./schema.js"; +import * as $$SelectionSets from "./selection-sets.js"; export interface QueryMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationQuery<$SelectionSet, Schema<$Context["scalars"]>> + InferResult.OperationQuery<$SelectionSet, $$Schema.Schema<$Context["scalars"]>> > > >; @@ -25,84 +25,84 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { >; battles: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.battles<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.battles<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ battles: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ battles: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "battles" > > >; beings: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.beings<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.beings<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ beings: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ beings: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "beings" > > >; pokemon: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.pokemon<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemon<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ pokemon: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ pokemon: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "pokemon" > > >; pokemonByName: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.pokemonByName<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemonByName<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ pokemonByName: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ pokemonByName: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "pokemonByName" > > >; pokemons: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.pokemons<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemons<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ pokemons: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ pokemons: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "pokemons" > > >; trainerByName: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.trainerByName<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.trainerByName<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ trainerByName: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ trainerByName: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "trainerByName" > > >; trainers: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Query.trainers<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.trainers<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationQuery<{ trainers: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationQuery<{ trainers: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "trainers" > > @@ -111,12 +111,12 @@ export interface QueryMethods<$Context extends $$Utilities.ClientContext> { export interface MutationMethods<$Context extends $$Utilities.ClientContext> { $batch: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutput< $Context, - InferResult.OperationMutation<$SelectionSet, Schema<$Context["scalars"]>> + InferResult.OperationMutation<$SelectionSet, $$Schema.Schema<$Context["scalars"]>> > > >; @@ -131,12 +131,12 @@ export interface MutationMethods<$Context extends $$Utilities.ClientContext> { >; addPokemon: <$SelectionSet>( - selectionSet: $$Utilities.Exact<$SelectionSet, SelectionSet.Mutation.addPokemon<$Context["scalars"]>>, + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.addPokemon<$Context["scalars"]>>, ) => Promise< $$Utilities.Simplify< $$Utilities.HandleOutputGraffleRootField< $Context, - InferResult.OperationMutation<{ addPokemon: $SelectionSet }, Schema<$Context["scalars"]>>, + InferResult.OperationMutation<{ addPokemon: $SelectionSet }, $$Schema.Schema<$Context["scalars"]>>, "addPokemon" > > diff --git a/website/pokemon/modules/MethodsSelect.ts b/website/pokemon/modules/methods-select.ts similarity index 60% rename from website/pokemon/modules/MethodsSelect.ts rename to website/pokemon/modules/methods-select.ts index 2c43a310a..fedd399dd 100644 --- a/website/pokemon/modules/MethodsSelect.ts +++ b/website/pokemon/modules/methods-select.ts @@ -1,5 +1,5 @@ -import type * as $Utilities from "graffle/utilities-for-generated"; -import type * as $SelectionSets from "./SelectionSets.js"; +import type * as $$Utilities from "graffle/utilities-for-generated"; +import * as $$SelectionSets from "./selection-sets.js"; // // @@ -49,11 +49,11 @@ export interface $MethodsSelect { // export interface Query { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Query>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query>): $SelectionSet; } export interface Mutation { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Mutation>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation>): $SelectionSet; } // @@ -73,35 +73,37 @@ export interface Mutation { // export interface BattleRoyale { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.BattleRoyale>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleRoyale>): $SelectionSet; } export interface BattleTrainer { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.BattleTrainer>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleTrainer>): $SelectionSet; } export interface BattleWild { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.BattleWild>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.BattleWild>): $SelectionSet; } export interface CombatantMultiPokemon { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.CombatantMultiPokemon>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.CombatantMultiPokemon>): $SelectionSet; } export interface CombatantSinglePokemon { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.CombatantSinglePokemon>): $SelectionSet; + <$SelectionSet>( + selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.CombatantSinglePokemon>, + ): $SelectionSet; } export interface Patron { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Patron>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Patron>): $SelectionSet; } export interface Pokemon { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Pokemon>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Pokemon>): $SelectionSet; } export interface Trainer { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Trainer>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Trainer>): $SelectionSet; } // @@ -121,7 +123,7 @@ export interface Trainer { // export interface Battle { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Battle>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Battle>): $SelectionSet; } // @@ -141,5 +143,5 @@ export interface Battle { // export interface Being { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Being>): $SelectionSet; + <$SelectionSet>(selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Being>): $SelectionSet; } diff --git a/website/pokemon/modules/SchemaDrivenDataMap.ts b/website/pokemon/modules/schema-driven-data-map.ts similarity index 98% rename from website/pokemon/modules/SchemaDrivenDataMap.ts rename to website/pokemon/modules/schema-driven-data-map.ts index 961d8329e..302428f6e 100644 --- a/website/pokemon/modules/SchemaDrivenDataMap.ts +++ b/website/pokemon/modules/schema-driven-data-map.ts @@ -1,5 +1,5 @@ import type * as $$Utilities from "graffle/utilities-for-generated"; -import * as $Scalar from "./Scalar.js"; +import * as $$Scalar from "./scalar.js"; // // // @@ -16,15 +16,15 @@ import * as $Scalar from "./Scalar.js"; // // -const Float = $Scalar.Float; +const Float = $$Scalar.Float; -const ID = $Scalar.ID; +const ID = $$Scalar.ID; -const String = $Scalar.String; +const String = $$Scalar.String; -const Int = $Scalar.Int; +const Int = $$Scalar.Int; -const Boolean = $Scalar.Boolean; +const Boolean = $$Scalar.Boolean; // // diff --git a/website/pokemon/modules/SelectionSets.ts b/website/pokemon/modules/selection-sets.ts similarity index 100% rename from website/pokemon/modules/SelectionSets.ts rename to website/pokemon/modules/selection-sets.ts