diff --git a/eslint.config.js b/eslint.config.js index 7a1a0d859..66553538a 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -8,6 +8,7 @@ export default tsEslint.config({ 'vite.config.ts', 'vitest*.config.ts', '**/generated/**/*', + 'tests/_/schemas/*/graffle/**/*', '**/$/**/*', 'legacy/**/*', 'build/**/*', diff --git a/examples/$/generated-clients/pokemon/modules/Scalar.ts b/examples/$/generated-clients/pokemon/modules/Scalar.ts deleted file mode 100644 index 12c22e212..000000000 --- a/examples/$/generated-clients/pokemon/modules/Scalar.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../../../../src/entrypoints/scalars.js' diff --git a/examples/$/schemas/pokemon/generateSdl.ts b/examples/$/schemas/pokemon/generateSdl.ts deleted file mode 100644 index 157a0959e..000000000 --- a/examples/$/schemas/pokemon/generateSdl.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { printSchema } from 'graphql' -import { writeFileSync } from 'node:fs' -import { dirname, join } from 'node:path' -import { fileURLToPath } from 'node:url' -import { schema } from './schema.js' - -const __filename = fileURLToPath(import.meta.url) -const __dirname = dirname(__filename) - -const sdl = printSchema(schema) -const path = join(__dirname, `./schema.graphql`) -writeFileSync(path, sdl) - -console.log(`GraphQL SDL has been written to ${path}`) diff --git a/examples/10_transport-http/transport-http_method-get.ts b/examples/10_transport-http/transport-http_method-get.ts index b51bae5bc..0c8d406e3 100644 --- a/examples/10_transport-http/transport-http_method-get.ts +++ b/examples/10_transport-http/transport-http_method-get.ts @@ -3,7 +3,7 @@ * to be sent over HTTP GET method. Note write-kind operations (mutation) are still sent over HTTP POST method. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { show } from '../$/helpers.js' const graffle = Pokemon diff --git a/examples/20_output/output_default.ts b/examples/20_output/output_default.ts index 92015b615..00555f185 100644 --- a/examples/20_output/output_default.ts +++ b/examples/20_output/output_default.ts @@ -2,7 +2,7 @@ * This example shows the default output behavior. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { show } from '../$/helpers.js' const pokemon = Pokemon.create() diff --git a/examples/20_output/output_envelope.ts b/examples/20_output/output_envelope.ts index 1758f392f..1c5fba04d 100644 --- a/examples/20_output/output_envelope.ts +++ b/examples/20_output/output_envelope.ts @@ -2,7 +2,7 @@ * This example shows how to configure output to use the envelope. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { show } from '../$/helpers.js' const pokemon = Pokemon.create({ diff --git a/examples/20_output/output_envelope_envelope-error__envelope-error.ts b/examples/20_output/output_envelope_envelope-error__envelope-error.ts index a37013f0d..8505d5756 100644 --- a/examples/20_output/output_envelope_envelope-error__envelope-error.ts +++ b/examples/20_output/output_envelope_envelope-error__envelope-error.ts @@ -2,7 +2,7 @@ * This example shows how to configure output to embed errors into the envelope. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { show } from '../$/helpers.js' // dprint-ignore diff --git a/examples/20_output/output_envelope_envelope_error-throw__envelope-error-throw.ts b/examples/20_output/output_envelope_envelope_error-throw__envelope-error-throw.ts index 31e9c46cd..2daff3d89 100644 --- a/examples/20_output/output_envelope_envelope_error-throw__envelope-error-throw.ts +++ b/examples/20_output/output_envelope_envelope_error-throw__envelope-error-throw.ts @@ -2,7 +2,7 @@ * This example shows how to configure output to throw errors even when using the envelope. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' // dprint-ignore const pokemon = Pokemon diff --git a/examples/20_output/output_return-error.ts b/examples/20_output/output_return-error.ts index 5a9f48fd7..244a43902 100644 --- a/examples/20_output/output_return-error.ts +++ b/examples/20_output/output_return-error.ts @@ -2,7 +2,7 @@ * This example shows how to configure output to have errors returned instead of e.g. thrown. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { show } from '../$/helpers.js' // dprint-ignore diff --git a/examples/20_output/output_return-error_return-error-execution__return-error-execution.ts b/examples/20_output/output_return-error_return-error-execution__return-error-execution.ts index 7040ae70c..0681be9ad 100644 --- a/examples/20_output/output_return-error_return-error-execution__return-error-execution.ts +++ b/examples/20_output/output_return-error_return-error-execution__return-error-execution.ts @@ -2,7 +2,7 @@ * This example shows how to configure output to have only certain kinds of errors returned while others thrown. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { show } from '../$/show.js' const pokemon = Pokemon diff --git a/examples/55_generated/generated_alias.ts b/examples/55_generated/generated_alias.ts index 14fb5af56..6d00ced2c 100644 --- a/examples/55_generated/generated_alias.ts +++ b/examples/55_generated/generated_alias.ts @@ -2,7 +2,7 @@ * This example shows how to write GraphQL aliases in the TypeScript interface. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { showJson } from '../$/helpers.js' const pokemon = Pokemon.create() diff --git a/examples/55_generated/generated_arguments.ts b/examples/55_generated/generated_arguments.ts index 4ae137701..c19cab0ed 100644 --- a/examples/55_generated/generated_arguments.ts +++ b/examples/55_generated/generated_arguments.ts @@ -2,7 +2,7 @@ * This example shows how to write field arguments in TypeScript interface. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { showJson } from '../$/helpers.js' const atlas = Pokemon.create() diff --git a/examples/55_generated/generated_batch.ts b/examples/55_generated/generated_batch.ts index c08410a75..fcc0bd5da 100644 --- a/examples/55_generated/generated_batch.ts +++ b/examples/55_generated/generated_batch.ts @@ -2,7 +2,7 @@ * This example shows how to write batches of GraphQL root fields (aka. entrypoints) in the TypeScript interface. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { showJson } from '../$/helpers.js' const pokemon = Pokemon.create() diff --git a/examples/55_generated/generated_directive.ts b/examples/55_generated/generated_directive.ts index e62631d44..34e78ad5a 100644 --- a/examples/55_generated/generated_directive.ts +++ b/examples/55_generated/generated_directive.ts @@ -3,7 +3,7 @@ */ // import { parse, print } from 'graphql' -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { showJson } from '../$/helpers.js' const pokemon = Pokemon.create() diff --git a/examples/55_generated/generated_document.ts b/examples/55_generated/generated_document.ts index fe58df827..ed869367e 100644 --- a/examples/55_generated/generated_document.ts +++ b/examples/55_generated/generated_document.ts @@ -2,7 +2,7 @@ * This example shows how to write whole GraphQL documents in the TypeScript interface. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { showJson } from '../$/helpers.js' const pokemon = Pokemon.create() diff --git a/examples/55_generated/generated_interface.ts b/examples/55_generated/generated_interface.ts index 444a2a13d..f676bd2ab 100644 --- a/examples/55_generated/generated_interface.ts +++ b/examples/55_generated/generated_interface.ts @@ -2,7 +2,7 @@ * This example shows how to work with interface types. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { show } from '../$/helpers.js' const pokemon = Pokemon.create() diff --git a/examples/55_generated/generated_root-field.ts b/examples/55_generated/generated_root-field.ts index 2028fbb41..c4ed190bc 100644 --- a/examples/55_generated/generated_root-field.ts +++ b/examples/55_generated/generated_root-field.ts @@ -2,7 +2,7 @@ * This example shows how to use dedicated root field methods to easily operate on one GraphQL root field at at time. If you need to work with multiple root fields, check out the `batch` example. */ -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { showJson } from '../$/helpers.js' const pokemon = Pokemon.create() diff --git a/examples/60_extension/extension_opentelemetry__opentelemetry.ts b/examples/60_extension/extension_opentelemetry__opentelemetry.ts index e271a8307..7e9a73d00 100644 --- a/examples/60_extension/extension_opentelemetry__opentelemetry.ts +++ b/examples/60_extension/extension_opentelemetry__opentelemetry.ts @@ -1,7 +1,7 @@ import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base' import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node' import { Opentelemetry } from '../../src/entrypoints/extensions.js' -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { interceptAndShowOutput, show } from '../$/helpers.js' interceptAndShowOutput() diff --git a/examples/60_extension/extension_throws__throws.ts b/examples/60_extension/extension_throws__throws.ts index 9abac4947..5a13af224 100644 --- a/examples/60_extension/extension_throws__throws.ts +++ b/examples/60_extension/extension_throws__throws.ts @@ -3,7 +3,7 @@ */ import { Throws } from '../../src/entrypoints/extensions.js' -import { Pokemon } from '../$/generated-clients/pokemon/__.js' +import { Pokemon } from '../../tests/_/schemas/pokemon/graffle/__.js' import { interceptAndShowUncaughtErrors, show } from '../$/show.js' interceptAndShowUncaughtErrors() diff --git a/examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt b/examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt index 2010ea008..499be74dd 100644 --- a/examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt +++ b/examples/__outputs__/10_transport-http/transport-http_extension_headers__dynamicHeaders.output.txt @@ -4,7 +4,7 @@ headers: Headers { accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8', 'content-type': 'application/json', - 'x-sent-at-time': '1727408110664' + 'x-sent-at-time': '1727447640287' }, signal: undefined, method: 'post', diff --git a/examples/__outputs__/20_output/output_envelope.output.txt b/examples/__outputs__/20_output/output_envelope.output.txt index a34899bb7..72efcf762 100644 --- a/examples/__outputs__/20_output/output_envelope.output.txt +++ b/examples/__outputs__/20_output/output_envelope.output.txt @@ -16,7 +16,7 @@ headers: Headers { 'content-type': 'application/graphql-response+json; charset=utf-8', 'content-length': '104', - date: 'Fri, 27 Sep 2024 03:35:11 GMT', + date: 'Fri, 27 Sep 2024 14:34:00 GMT', connection: 'keep-alive', 'keep-alive': 'timeout=5' }, diff --git a/examples/__outputs__/60_extension/extension_opentelemetry__opentelemetry.output.txt b/examples/__outputs__/60_extension/extension_opentelemetry__opentelemetry.output.txt index eb945985d..099afb7de 100644 --- a/examples/__outputs__/60_extension/extension_opentelemetry__opentelemetry.output.txt +++ b/examples/__outputs__/60_extension/extension_opentelemetry__opentelemetry.output.txt @@ -9,14 +9,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'encode', - id: '288e327eea7ce997', + id: 'b198600c41de0595', kind: 0, - timestamp: 1727408111781000, - duration: 539.958, + timestamp: 1727447640559000, + duration: 638.625, attributes: {}, status: { code: 0 }, events: [], @@ -33,14 +33,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'pack', - id: 'b1df38e68926a3a5', + id: '83bc7ce70496db8d', kind: 0, - timestamp: 1727408111783000, - duration: 10846, + timestamp: 1727447640562000, + duration: 11628.625, attributes: {}, status: { code: 0 }, events: [], @@ -57,14 +57,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'exchange', - id: '85f8c97a5cdf40a0', + id: 'd80122be49daa52a', kind: 0, - timestamp: 1727408111794000, - duration: 27046.959, + timestamp: 1727447640574000, + duration: 20500.166, attributes: {}, status: { code: 0 }, events: [], @@ -81,14 +81,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'unpack', - id: '8fbff8ada118f8e4', + id: '0f3bf53d3bb99cfa', kind: 0, - timestamp: 1727408111822000, - duration: 1130.334, + timestamp: 1727447640594000, + duration: 1112.417, attributes: {}, status: { code: 0 }, events: [], @@ -105,14 +105,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'decode', - id: '3c8f702427e6a774', + id: 'cfbb77f628c19bb9', kind: 0, - timestamp: 1727408111823000, - duration: 194.166, + timestamp: 1727447640596000, + duration: 184.583, attributes: {}, status: { code: 0 }, events: [], @@ -129,14 +129,14 @@ } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', parentId: undefined, traceState: undefined, name: 'request', - id: '2e4746bd4a491302', + id: '235586747a904981', kind: 0, - timestamp: 1727408111780000, - duration: 43205.584, + timestamp: 1727447640558000, + duration: 37586.041, attributes: {}, status: { code: 0 }, events: [], diff --git a/package.json b/package.json index 6cebf6653..0e7a3128d 100644 --- a/package.json +++ b/package.json @@ -70,11 +70,9 @@ "homepage": "https://github.com/jasonkuhrt/graffle", "scripts": { "serve:pokemon": "tsx tests/_/services/pokemonManual.ts", - "gen:graffle": "pnpm gen:test:schema && pnpm gen:graffle:examples && pnpm build && cd website && pnpm gen:graffle", + "gen:graffle": "tsx tests/_/schemas/generate.ts && pnpm build && cd website && pnpm gen:graffle", "graffle": "tsx ./src/cli/generate.ts", - "gen:test:schema": "tsx tests/_/schemaGenerate.ts", "gen:examples": "tsx scripts/generate-examples-derivatives/generate.ts && pnpm format", - "gen:graffle:examples": "tsx './examples/$/schemas/pokemon/generateSdl.ts' && pnpm graffle --name Pokemon --defaultSchemaUrl http://localhost:3000/graphql --schema './examples/$/schemas/pokemon/schema.graphql' --output './examples/$/generated-clients/pokemon' --libraryPathClient ../../../../../src/entrypoints/client.js --libraryPathSchema ../../../../../src/entrypoints/schema.js --libraryPathScalars ../../../../../src/entrypoints/scalars.js --libraryPathUtilitiesForGenerated ../../../../../src/entrypoints/utilities-for-generated.js", "dev": "rm -rf dist && tsc --watch", "format": "pnpm build:docs && dprint fmt", "lint": "eslint . --fix", diff --git a/scripts/generate-examples-derivatives/generate-docs.ts b/scripts/generate-examples-derivatives/generate-docs.ts index a8f315190..9f5652686 100644 --- a/scripts/generate-examples-derivatives/generate-docs.ts +++ b/scripts/generate-examples-derivatives/generate-docs.ts @@ -128,6 +128,7 @@ const generateExampleLinksSnippets = async (examplesTransformed: ExampleTransfor const transformRewriteGraffleImports = (example: Example) => { const newContent = example.file.content + .replaceAll(/from '.+\/tests\/_\/schemas\/(.*)\/graffle\/(.+)\.js'/g, `from './$1/$2.js'`) .replaceAll( /from '.*entrypoints\/main.js'/g, `from 'graffle'`, @@ -136,20 +137,7 @@ const transformRewriteGraffleImports = (example: Example) => { /from '.*entrypoints\/(.*?).js'/g, `from 'graffle/$1'`, ) - .replaceAll( - /\.js$/g, - ``, - ) - .replaceAll( - `import { Atlas } from '../$/generated-clients/atlas/__.js'`, - `import { Graffle as Atlas } from './graffle/__.js'`, - ) - .replaceAll( - /import ({[^}]+}) from '.*\/generated-clients\/([^/]+)\/__\.js'/g, - `// ---cut--- -import $1 from './$2/__.js'`, - ) - // Any remaining $ imports are entirely removed. + // Any $ imports are entirely removed. .replaceAll(/import.*'.*\$.*'\n/g, ``) return { diff --git a/scripts/generate-examples-derivatives/generate-outputs.ts b/scripts/generate-examples-derivatives/generate-outputs.ts index 624ed68ca..eccdc70b6 100644 --- a/scripts/generate-examples-derivatives/generate-outputs.ts +++ b/scripts/generate-examples-derivatives/generate-outputs.ts @@ -1,7 +1,7 @@ import * as FS from 'node:fs/promises' import * as Path from 'node:path' -import { schema } from '../../examples/$/schemas/pokemon/schema.js' import { serveSchema } from '../../tests/_/lib/serveSchema.js' +import { schema } from '../../tests/_/schemas/pokemon/schema.js' import { deleteFiles } from '../lib/deleteFiles.js' import { directories, readExampleFiles, runExample } from './helpers.js' diff --git a/src/layers/2_SelectionSet/print.test.ts b/src/layers/2_SelectionSet/print.test.ts index e7816b462..3117d9cb3 100644 --- a/src/layers/2_SelectionSet/print.test.ts +++ b/src/layers/2_SelectionSet/print.test.ts @@ -1,8 +1,8 @@ import { parse, print } from 'graphql' import { describe, expect, test } from 'vitest' -import { db } from '../../../tests/_/db.js' -import { $Index as schemaIndex } from '../../../tests/_/schema/generated/modules/SchemaRuntime.js' -import type * as SelectionSets from '../../../tests/_/schema/generated/modules/SelectionSets.js' +import { db } from '../../../tests/_/schemas/db.js' +import { $Index as schemaIndex } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SchemaRuntime.js' +import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.js' import { outputConfigDefault } from '../6_client/Settings/Config.js' import type { Context } from './print.js' import { rootType } from './print.js' diff --git a/src/layers/2_SelectionSet/types.test-d.ts b/src/layers/2_SelectionSet/types.test-d.ts index e59bf7f7d..d3b94f53b 100644 --- a/src/layers/2_SelectionSet/types.test-d.ts +++ b/src/layers/2_SelectionSet/types.test-d.ts @@ -1,5 +1,5 @@ import { assertType, test } from 'vitest' -import type * as SelectionSets from '../../../tests/_/schema/generated/modules/SelectionSets.js' +import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.js' type Q = SelectionSets.Query diff --git a/src/layers/3_ResultSet/decode.test.ts b/src/layers/3_ResultSet/decode.test.ts index 2761f2e10..9e5dd7735 100644 --- a/src/layers/3_ResultSet/decode.test.ts +++ b/src/layers/3_ResultSet/decode.test.ts @@ -1,6 +1,6 @@ import { expect, test } from 'vitest' -import { $Index } from '../../../tests/_/schema/generated/modules/SchemaRuntime.js' -import type * as SelectionSets from '../../../tests/_/schema/generated/modules/SelectionSets.js' +import { $Index } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SchemaRuntime.js' +import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.js' import { decode } from './decode.js' test.each<[selectionSet: SelectionSets.Query, data: object]>([ diff --git a/src/layers/3_ResultSet/infer.test-d.ts b/src/layers/3_ResultSet/infer.test-d.ts index 8edc811e5..5ffedcb15 100644 --- a/src/layers/3_ResultSet/infer.test-d.ts +++ b/src/layers/3_ResultSet/infer.test-d.ts @@ -1,7 +1,7 @@ import { test } from 'vitest' -import type * as Schema from '../../../tests/_/schema/generated/modules/SchemaBuildtime.js' -import type { Index } from '../../../tests/_/schema/generated/modules/SchemaIndex.js' -import type * as SelectionSets from '../../../tests/_/schema/generated/modules/SelectionSets.js' +import type * as Schema from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SchemaBuildtime.js' +import type { Index } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SchemaIndex.js' +import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.js' import { AssertIsEqual } from '../../lib/prelude.js' import type { ResultSet } from './__.js' diff --git a/src/layers/4_generator/__snapshots__/files.test.ts.snap b/src/layers/4_generator/__snapshots__/files.test.ts.snap index 07ce1a305..0484eab52 100644 --- a/src/layers/4_generator/__snapshots__/files.test.ts.snap +++ b/src/layers/4_generator/__snapshots__/files.test.ts.snap @@ -1,7 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`schema2 1`] = ` -"import { createPrefilled } from '../../../../../src/entrypoints/client.js' +"import { createPrefilled } from '../../../../../../src/entrypoints/client.js' import { $defaultSchemaUrl, $Index } from './SchemaRuntime.js' export const create = createPrefilled(\`default\`, $Index, $defaultSchemaUrl) @@ -45,7 +45,7 @@ export const isError = <$Value>(value: $Value): value is Include<$Value, ErrorOb `; exports[`schema2 5`] = ` -"import type { ResultSet } from '../../../../../src/entrypoints/schema.js' +"import type { ResultSet } from '../../../../../../src/entrypoints/schema.js' import * as Data from './Data.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSets from './SelectionSets.js' @@ -65,7 +65,7 @@ import type * as SelectionSets from './SelectionSets.js' // // // -import { createSelect } from '../../../../../src/entrypoints/client.js' +import { createSelect } from '../../../../../../src/entrypoints/client.js' export const Select = createSelect(Data.Name) // @@ -283,7 +283,7 @@ export interface Index { `; exports[`schema2 7`] = ` -"import type * as $ from '../../../../../src/entrypoints/schema.js' +"import type * as $ from '../../../../../../src/entrypoints/schema.js' import type * as $Scalar from './Scalar.ts' // ------------------------------------------------------------ // @@ -608,12 +608,12 @@ export namespace Union { `; exports[`schema2 8`] = ` -"import type { Schema } from '../../../../../src/entrypoints/schema.js' -import * as CustomScalars from '../../../customScalarCodecs.js' +"import type { Schema } from '../../../../../../src/entrypoints/schema.js' +import * as CustomScalars from '../../../../customScalarCodecs.js' -export * from '../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' -export * from '../../../customScalarCodecs.js' -export { Date } from '../../../customScalarCodecs.js' +export * from '../../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../customScalarCodecs.js' +export { Date } from '../../../../customScalarCodecs.js' // // @@ -638,7 +638,7 @@ export type DateEncoded = Schema.Scalar.GetEncoded exports[`schema2 9`] = ` "/* eslint-disable */ -import * as $ from '../../../../../src/entrypoints/schema.js' +import * as $ from '../../../../../../src/entrypoints/schema.js' import * as Data from './Data.js' import * as $Scalar from './Scalar.js' import type { Index } from './SchemaIndex.js' diff --git a/src/layers/4_generator/files.test.ts b/src/layers/4_generator/files.test.ts index 58aaf42d8..c3f01511e 100644 --- a/src/layers/4_generator/files.test.ts +++ b/src/layers/4_generator/files.test.ts @@ -3,30 +3,30 @@ import { expect, test } from 'vitest' test(`schema2`, async () => { expect( - await readFile(`./tests/_/schema/generated/modules/Client.ts`, `utf8`), + await readFile(`./tests/_/schemas/kitchen-sink/graffle/modules/Client.ts`, `utf8`), ).toMatchSnapshot() expect( - await readFile(`./tests/_/schema/generated/__.ts`, `utf8`), + await readFile(`./tests/_/schemas/kitchen-sink/graffle/__.ts`, `utf8`), ).toMatchSnapshot() expect( - await readFile(`./tests/_/schema/generated/_.ts`, `utf8`), + await readFile(`./tests/_/schemas/kitchen-sink/graffle/_.ts`, `utf8`), ).toMatchSnapshot() expect( - await readFile(`./tests/_/schema/generated/modules/Error.ts`, `utf8`), + await readFile(`./tests/_/schemas/kitchen-sink/graffle/modules/Error.ts`, `utf8`), ).toMatchSnapshot() expect( - await readFile(`./tests/_/schema/generated/modules/Select.ts`, `utf8`), + await readFile(`./tests/_/schemas/kitchen-sink/graffle/modules/Select.ts`, `utf8`), ).toMatchSnapshot() expect( - await readFile(`./tests/_/schema/generated/modules/SchemaIndex.ts`, `utf8`), + await readFile(`./tests/_/schemas/kitchen-sink/graffle/modules/SchemaIndex.ts`, `utf8`), ).toMatchSnapshot() expect( - await readFile(`./tests/_/schema/generated/modules/SchemaBuildtime.ts`, `utf8`), + await readFile(`./tests/_/schemas/kitchen-sink/graffle/modules/SchemaBuildtime.ts`, `utf8`), ).toMatchSnapshot() expect( - await readFile(`./tests/_/schema/generated/modules/Scalar.ts`, `utf8`), + await readFile(`./tests/_/schemas/kitchen-sink/graffle/modules/Scalar.ts`, `utf8`), ).toMatchSnapshot() expect( - await readFile(`./tests/_/schema/generated/modules/SchemaRuntime.ts`, `utf8`), + await readFile(`./tests/_/schemas/kitchen-sink/graffle/modules/SchemaRuntime.ts`, `utf8`), ).toMatchSnapshot() }) diff --git a/src/layers/6_client/Settings/client.create.config.output.test-d.ts b/src/layers/6_client/Settings/client.create.config.output.test-d.ts index f451c6518..84887c6c7 100644 --- a/src/layers/6_client/Settings/client.create.config.output.test-d.ts +++ b/src/layers/6_client/Settings/client.create.config.output.test-d.ts @@ -2,8 +2,8 @@ import { type ExecutionResult } from 'graphql' import { describe } from 'node:test' import { expectTypeOf, test } from 'vitest' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' -import { schema } from '../../../../tests/_/schema/schema.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import { schema } from '../../../../tests/_/schemas/kitchen-sink/schema.js' import { type GraphQLExecutionResultError } from '../../../lib/graphql.js' import { AssertIsEqual } from '../../../lib/prelude.js' import type { ErrorsOther } from '../client.js' diff --git a/src/layers/6_client/Settings/client.input.test-d.ts b/src/layers/6_client/Settings/client.input.test-d.ts index fd862684e..7043fe1f3 100644 --- a/src/layers/6_client/Settings/client.input.test-d.ts +++ b/src/layers/6_client/Settings/client.input.test-d.ts @@ -1,7 +1,7 @@ import { test } from 'vitest' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' -import { schema } from '../../../../tests/_/schema/schema.js' -import { QueryOnly } from '../../../../tests/_/schemaQueryOnly/generated/__.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import { schema } from '../../../../tests/_/schemas/kitchen-sink/schema.js' +import { QueryOnly } from '../../../../tests/_/schemas/query-only/graffle/__.js' test(`works`, () => { Graffle.create({ schema, output: { errors: { schema: `throw` } } }) diff --git a/src/layers/6_client/client.customScalar.test.ts b/src/layers/6_client/client.customScalar.test.ts index bb8103d46..e598754e1 100644 --- a/src/layers/6_client/client.customScalar.test.ts +++ b/src/layers/6_client/client.customScalar.test.ts @@ -1,8 +1,8 @@ /* eslint-disable */ import { describe, expect } from 'vitest' -import { db } from '../../../tests/_/db.js' import { createResponse, test } from '../../../tests/_/helpers.js' -import { Graffle } from '../../../tests/_/schema/generated/__.js' +import { db } from '../../../tests/_/schemas/db.js' +import { Graffle } from '../../../tests/_/schemas/kitchen-sink/graffle/__.js' const date0Encoded = db.date0.toISOString() diff --git a/src/layers/6_client/client.error.test-d.ts b/src/layers/6_client/client.error.test-d.ts index ecb83a149..4d83e0f46 100644 --- a/src/layers/6_client/client.error.test-d.ts +++ b/src/layers/6_client/client.error.test-d.ts @@ -1,8 +1,8 @@ /* eslint-disable */ import { expectTypeOf, test } from 'vitest' -import { Graffle } from '../../../tests/_/schema/generated/__.js' -import { isError } from '../../../tests/_/schema/generated/modules/Error.js' -import * as Schema from '../../../tests/_/schema/schema.js' +import { Graffle } from '../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import { isError } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/Error.js' +import * as Schema from '../../../tests/_/schemas/kitchen-sink/schema.js' const graffle = Graffle.create({ schema: Schema.schema, output: { errors: { schema: false } } }) diff --git a/src/layers/6_client/client.test.ts b/src/layers/6_client/client.test.ts index 1ab3f6ee9..de426eccd 100644 --- a/src/layers/6_client/client.test.ts +++ b/src/layers/6_client/client.test.ts @@ -1,7 +1,7 @@ import { describe, expect, expectTypeOf } from 'vitest' import { createResponse, test } from '../../../tests/_/helpers.js' -import { Graffle as Graffle2 } from '../../../tests/_/schema/generated/__.js' -import { schema } from '../../../tests/_/schema/schema.js' +import { Graffle as Graffle2 } from '../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import { schema } from '../../../tests/_/schemas/kitchen-sink/schema.js' import { Graffle } from '../../entrypoints/main.js' import { Throws } from '../7_extensions/Throws/Throws.js' diff --git a/src/layers/6_client/client.transport-http.test.ts b/src/layers/6_client/client.transport-http.test.ts index 9e9dcb899..91dbb63a4 100644 --- a/src/layers/6_client/client.transport-http.test.ts +++ b/src/layers/6_client/client.transport-http.test.ts @@ -1,7 +1,7 @@ import { describe, expect, expectTypeOf } from 'vitest' -import { Pokemon } from '../../../examples/$/generated-clients/pokemon/__.js' import { createResponse, test } from '../../../tests/_/helpers.js' import { serveSchema } from '../../../tests/_/lib/serveSchema.js' +import { Pokemon } from '../../../tests/_/schemas/pokemon/graffle/__.js' import { Graffle } from '../../entrypoints/main.js' import { ACCEPT_REC, CONTENT_TYPE_REC } from '../../lib/graphqlHTTP.js' import { Transport } from '../5_core/types.js' @@ -32,7 +32,7 @@ test(`anyware hooks are typed to http transport`, () => { }) }) -import { schema as schemaPokemon } from '../../../examples/$/schemas/pokemon/schema.js' +import { schema as schemaPokemon } from '../../../tests/_/schemas/pokemon/schema.js' test(`when envelope is used then response property is present even if relying on schema url default`, async () => { const service = await serveSchema({ schema: schemaPokemon }) diff --git a/src/layers/6_client/client.transport-memory.test.ts b/src/layers/6_client/client.transport-memory.test.ts index 1d21a864c..810ab7f05 100644 --- a/src/layers/6_client/client.transport-memory.test.ts +++ b/src/layers/6_client/client.transport-memory.test.ts @@ -1,6 +1,6 @@ import { expectTypeOf } from 'vitest' import { test } from '../../../tests/_/helpers.js' -import { schema } from '../../../tests/_/schema/schema.js' +import { schema } from '../../../tests/_/schemas/kitchen-sink/schema.js' import { Graffle } from '../../entrypoints/main.js' import { Transport } from '../5_core/types.js' diff --git a/src/layers/6_client/extension/use.test.ts b/src/layers/6_client/extension/use.test.ts index c3255ad6b..e86872d78 100644 --- a/src/layers/6_client/extension/use.test.ts +++ b/src/layers/6_client/extension/use.test.ts @@ -1,8 +1,8 @@ /* eslint-disable */ import { describe, expect } from 'vitest' -import { db } from '../../../../tests/_/db.js' import { createResponse, test } from '../../../../tests/_/helpers.js' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' +import { db } from '../../../../tests/_/schemas/db.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' import { oops } from '../../../lib/anyware/specHelpers.js' import { Throws } from '../../7_extensions/Throws/Throws.js' diff --git a/src/layers/6_client/raw/client.raw.test-d.ts b/src/layers/6_client/raw/client.raw.test-d.ts index 63cb8a620..ac58a068c 100644 --- a/src/layers/6_client/raw/client.raw.test-d.ts +++ b/src/layers/6_client/raw/client.raw.test-d.ts @@ -1,8 +1,8 @@ /* eslint-disable */ import { describe, expectTypeOf } from 'vitest' import { test } from '../../../../tests/_/helpers.js' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' -import { schema } from '../../../../tests/_/schema/schema.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import { schema } from '../../../../tests/_/schemas/kitchen-sink/schema.js' import { gql } from '../../6_helpers/gql.js' import type { RawResolveOutputReturnRootType } from '../handleOutput.js' diff --git a/src/layers/6_client/raw/client.raw.test.ts b/src/layers/6_client/raw/client.raw.test.ts index 163abb09e..642a0e540 100644 --- a/src/layers/6_client/raw/client.raw.test.ts +++ b/src/layers/6_client/raw/client.raw.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect } from 'vitest' import { test } from '../../../../tests/_/helpers.js' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' -import { schema } from '../../../../tests/_/schema/schema.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import { schema } from '../../../../tests/_/schemas/kitchen-sink/schema.js' import { createExtension } from '../extension/extension.js' // todo test with custom scalars diff --git a/src/layers/6_client/raw/client.rawString.test-d.ts b/src/layers/6_client/raw/client.rawString.test-d.ts index 56e29d543..3c41d30cb 100644 --- a/src/layers/6_client/raw/client.rawString.test-d.ts +++ b/src/layers/6_client/raw/client.rawString.test-d.ts @@ -1,8 +1,8 @@ /* eslint-disable */ import { describe, expectTypeOf } from 'vitest' import { test } from '../../../../tests/_/helpers.js' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' -import { schema } from '../../../../tests/_/schema/schema.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import { schema } from '../../../../tests/_/schemas/kitchen-sink/schema.js' import type { TypedDocumentString } from '../../0_functions/types.js' import type { Envelope, RawResolveOutputReturnRootType } from '../handleOutput.js' diff --git a/src/layers/6_client/requestMethods/client.batch.test.ts b/src/layers/6_client/requestMethods/client.batch.test.ts index 3107a24f7..8b5408da2 100644 --- a/src/layers/6_client/requestMethods/client.batch.test.ts +++ b/src/layers/6_client/requestMethods/client.batch.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from 'vitest' -import { db } from '../../../../tests/_/db.js' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' -import * as Schema from '../../../../tests/_/schema/schema.js' +import { db } from '../../../../tests/_/schemas/db.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import * as Schema from '../../../../tests/_/schemas/kitchen-sink/schema.js' const graffle = Graffle.create({ schema: Schema.schema }) diff --git a/src/layers/6_client/requestMethods/client.rootMethods.test-d.ts b/src/layers/6_client/requestMethods/client.rootMethods.test-d.ts index b07fa50e2..70333ad8a 100644 --- a/src/layers/6_client/requestMethods/client.rootMethods.test-d.ts +++ b/src/layers/6_client/requestMethods/client.rootMethods.test-d.ts @@ -1,7 +1,7 @@ /* eslint-disable */ import { expectTypeOf, test } from 'vitest' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' -import * as Schema from '../../../../tests/_/schema/schema.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import * as Schema from '../../../../tests/_/schemas/kitchen-sink/schema.js' const graffle = Graffle.create({ schema: Schema.schema }) diff --git a/src/layers/6_client/requestMethods/client.rootMethods.test.ts b/src/layers/6_client/requestMethods/client.rootMethods.test.ts index 78744aab1..d995a09ee 100644 --- a/src/layers/6_client/requestMethods/client.rootMethods.test.ts +++ b/src/layers/6_client/requestMethods/client.rootMethods.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from 'vitest' -import { db } from '../../../../tests/_/db.js' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' -import * as Schema from '../../../../tests/_/schema/schema.js' +import { db } from '../../../../tests/_/schemas/db.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import * as Schema from '../../../../tests/_/schemas/kitchen-sink/schema.js' const graffle = Graffle.create({ schema: Schema.schema }) diff --git a/src/layers/6_client/requestMethods/document.test-d.ts b/src/layers/6_client/requestMethods/document.test-d.ts index 1a52bba3f..5b9e0997a 100644 --- a/src/layers/6_client/requestMethods/document.test-d.ts +++ b/src/layers/6_client/requestMethods/document.test-d.ts @@ -1,10 +1,10 @@ import { expectTypeOf, test } from 'vitest' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' -import * as Schema from '../../../../tests/_/schema/schema.js' -import { MutationOnly } from '../../../../tests/_/schemaMutationOnly/generated/__.js' -import * as SchemaMutationOnly from '../../../../tests/_/schemaMutationOnly/schema.js' -import { QueryOnly } from '../../../../tests/_/schemaQueryOnly/generated/__.js' -import * as SchemaQueryOnly from '../../../../tests/_/schemaQueryOnly/schema.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import * as Schema from '../../../../tests/_/schemas/kitchen-sink/schema.js' +import { MutationOnly } from '../../../../tests/_/schemas/mutation-only/graffle/__.js' +import * as SchemaMutationOnly from '../../../../tests/_/schemas/mutation-only/schema.js' +import { QueryOnly } from '../../../../tests/_/schemas/query-only/graffle/__.js' +import * as SchemaQueryOnly from '../../../../tests/_/schemas/query-only/schema.js' const graffle = Graffle.create({ schema: Schema.schema }) diff --git a/src/layers/6_client/requestMethods/document.test.ts b/src/layers/6_client/requestMethods/document.test.ts index 7aab2aeb7..392a4e3f9 100644 --- a/src/layers/6_client/requestMethods/document.test.ts +++ b/src/layers/6_client/requestMethods/document.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from 'vitest' -import { db } from '../../../../tests/_/db.js' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' -import { schema } from '../../../../tests/_/schema/schema.js' +import { db } from '../../../../tests/_/schemas/db.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import { schema } from '../../../../tests/_/schemas/kitchen-sink/schema.js' import type { Errors } from '../../../lib/errors/__.js' // todo test with custom scalars diff --git a/src/layers/7_extensions/Throws/Throws.test-d.ts b/src/layers/7_extensions/Throws/Throws.test-d.ts index 19d24c9ce..91428a5ee 100644 --- a/src/layers/7_extensions/Throws/Throws.test-d.ts +++ b/src/layers/7_extensions/Throws/Throws.test-d.ts @@ -1,6 +1,6 @@ import { describe, expectTypeOf, test } from 'vitest' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' -import { schema } from '../../../../tests/_/schema/schema.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import { schema } from '../../../../tests/_/schemas/kitchen-sink/schema.js' import { Throws } from './Throws.js' const graffle = Graffle.create({ schema }).use(Throws()) diff --git a/src/layers/7_extensions/Throws/Throws.test.ts b/src/layers/7_extensions/Throws/Throws.test.ts index 8511a0983..ccb8a5cd0 100644 --- a/src/layers/7_extensions/Throws/Throws.test.ts +++ b/src/layers/7_extensions/Throws/Throws.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from 'vitest' -import { db } from '../../../../tests/_/db.js' -import { Graffle } from '../../../../tests/_/schema/generated/__.js' -import { schema } from '../../../../tests/_/schema/schema.js' +import { db } from '../../../../tests/_/schemas/db.js' +import { Graffle } from '../../../../tests/_/schemas/kitchen-sink/graffle/__.js' +import { schema } from '../../../../tests/_/schemas/kitchen-sink/schema.js' import { Throws } from './Throws.js' const graffle = Graffle.create({ schema }).use(Throws()) diff --git a/src/layers/7_extensions/Upload/Upload.test.ts b/src/layers/7_extensions/Upload/Upload.test.ts index c2ac94beb..8e02b07d8 100644 --- a/src/layers/7_extensions/Upload/Upload.test.ts +++ b/src/layers/7_extensions/Upload/Upload.test.ts @@ -2,7 +2,7 @@ // @vitest-environment node import { afterAll, beforeAll, beforeEach, expect, test } from 'vitest' -import { schema } from '../../../../tests/_/schemaUpload/schema.js' +import { schema } from '../../../../tests/_/schemas/upload/schema.js' import { Graffle } from '../../../entrypoints/main.js' import { Upload } from './Upload.js' diff --git a/src/lib/anyware/__.test-d.ts b/src/lib/anyware/__.test-d.ts index f5cf0cfb2..f071c935d 100644 --- a/src/lib/anyware/__.test-d.ts +++ b/src/lib/anyware/__.test-d.ts @@ -1,7 +1,7 @@ /* eslint-disable */ import { describe, expectTypeOf, test } from 'vitest' -import { Result } from '../../../tests/_/schema/generated/modules/SchemaRuntime.js' +import { Result } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SchemaRuntime.js' import { ContextualError } from '../errors/ContextualError.js' import { type MaybePromise } from '../prelude.js' import { Anyware } from './__.js' diff --git a/tests/_/schema/generated/modules/RootMethods.ts b/tests/_/schema/generated/modules/RootMethods.ts deleted file mode 100644 index 229c6f784..000000000 --- a/tests/_/schema/generated/modules/RootMethods.ts +++ /dev/null @@ -1,516 +0,0 @@ -import type { ResultSet } from '../../../../../src/entrypoints/schema.js' -import type * as Utils from '../../../../../src/entrypoints/utilities-for-generated.js' -import type { Index } from './SchemaIndex.js' -import type * as SelectionSet from './SelectionSets.js' - -type Aug< - $Config extends Utils.Config, - $RootTypeName extends Index['RootTypesPresent'][number], - $Selection, -> = Utils.ConfigGetOutputError<$Config, 'schema'> extends 'throw' - ? (keyof $Selection & Index['error']['rootResultFields'][$RootTypeName]) extends never ? $Selection - : $Selection & Utils.SelectionSet.TypenameSelection - : $Selection - -export interface QueryMethods<$Config extends Utils.Config> { - $batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query>) => Promise< - Utils.ResolveOutputReturnRootType< - $Config, - Index, - ResultSet.Query< - Aug<$Config, 'Query', $SelectionSet>, - Index - > - > - > - __typename: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - '__typename', - 'Query' - > - > - InputObjectNested: <$SelectionSet>( - args?: Utils.Exact<$SelectionSet, SelectionSet.Query.InputObjectNested$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'InputObjectNested', - ResultSet.Field - > - > - InputObjectNestedNonNull: <$SelectionSet>( - args: Utils.Exact<$SelectionSet, SelectionSet.Query.InputObjectNestedNonNull$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'InputObjectNestedNonNull', - ResultSet.Field - > - > - /** - * Query enum field documentation. - */ - abcEnum: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.abcEnum>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'abcEnum', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['abcEnum'], Index> - > - > - date: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'date', - ResultSet.Field - > - > - dateArg: <$SelectionSet>( - args?: Utils.Exact<$SelectionSet, SelectionSet.Query.dateArg$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'dateArg', - ResultSet.Field - > - > - dateArgInputObject: <$SelectionSet>( - args?: Utils.Exact<$SelectionSet, SelectionSet.Query.dateArgInputObject$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'dateArgInputObject', - ResultSet.Field - > - > - dateArgList: <$SelectionSet>( - args?: Utils.Exact<$SelectionSet, SelectionSet.Query.dateArgList$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'dateArgList', - ResultSet.Field - > - > - dateArgNonNull: <$SelectionSet>( - args: Utils.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNull$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'dateArgNonNull', - ResultSet.Field - > - > - dateArgNonNullList: <$SelectionSet>( - args: Utils.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullList$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'dateArgNonNullList', - ResultSet.Field - > - > - dateArgNonNullListNonNull: <$SelectionSet>( - args: Utils.Exact<$SelectionSet, SelectionSet.Query.dateArgNonNullListNonNull$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'dateArgNonNullListNonNull', - ResultSet.Field - > - > - dateInterface1: <$SelectionSet>( - selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.dateInterface1>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'dateInterface1', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['dateInterface1'], Index> - > - > - dateList: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'dateList', - ResultSet.Field - > - > - dateListNonNull: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'dateListNonNull', - ResultSet.Field - > - > - dateNonNull: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'dateNonNull', - ResultSet.Field - > - > - dateObject1: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.dateObject1>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'dateObject1', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['dateObject1'], Index> - > - > - dateUnion: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.dateUnion>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'dateUnion', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['dateUnion'], Index> - > - > - error: <$SelectionSet>(args?: Utils.Exact<$SelectionSet, SelectionSet.Query.error$SelectionSetArguments>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'error', - ResultSet.Field - > - > - id: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'id', - ResultSet.Field - > - > - idNonNull: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'idNonNull', - ResultSet.Field - > - > - interface: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.$interface>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'interface', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['interface'], Index> - > - > - interfaceNonNull: <$SelectionSet>( - selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.interfaceNonNull>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'interfaceNonNull', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['interfaceNonNull'], Index> - > - > - interfaceWithArgs: <$SelectionSet>( - selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.interfaceWithArgs>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'interfaceWithArgs', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['interfaceWithArgs'], Index> - > - > - listInt: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'listInt', - ResultSet.Field - > - > - listIntNonNull: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'listIntNonNull', - ResultSet.Field - > - > - listListInt: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'listListInt', - ResultSet.Field - > - > - listListIntNonNull: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'listListIntNonNull', - ResultSet.Field - > - > - lowerCaseUnion: <$SelectionSet>( - selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.lowerCaseUnion>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'lowerCaseUnion', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['lowerCaseUnion'], Index> - > - > - object: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.$object>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'object', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['object'], Index> - > - > - objectList: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.objectList>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'objectList', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['objectList'], Index> - > - > - objectListNonNull: <$SelectionSet>( - selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.objectListNonNull>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'objectListNonNull', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['objectListNonNull'], Index> - > - > - objectNested: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.objectNested>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'objectNested', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['objectNested'], Index> - > - > - objectNonNull: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.objectNonNull>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'objectNonNull', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['objectNonNull'], Index> - > - > - objectWithArgs: <$SelectionSet>( - selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.objectWithArgs>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'objectWithArgs', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['objectWithArgs'], Index> - > - > - result: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.result>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'result', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['result'], Index> - > - > - resultNonNull: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.resultNonNull>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'resultNonNull', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['resultNonNull'], Index> - > - > - string: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'string', - ResultSet.Field - > - > - stringWithArgEnum: <$SelectionSet>( - args?: Utils.Exact<$SelectionSet, SelectionSet.Query.stringWithArgEnum$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'stringWithArgEnum', - ResultSet.Field - > - > - stringWithArgInputObject: <$SelectionSet>( - args?: Utils.Exact<$SelectionSet, SelectionSet.Query.stringWithArgInputObject$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'stringWithArgInputObject', - ResultSet.Field - > - > - stringWithArgInputObjectRequired: <$SelectionSet>( - args: Utils.Exact<$SelectionSet, SelectionSet.Query.stringWithArgInputObjectRequired$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'stringWithArgInputObjectRequired', - ResultSet.Field - > - > - stringWithArgs: <$SelectionSet>( - args?: Utils.Exact<$SelectionSet, SelectionSet.Query.stringWithArgs$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'stringWithArgs', - ResultSet.Field - > - > - stringWithListArg: <$SelectionSet>( - args?: Utils.Exact<$SelectionSet, SelectionSet.Query.stringWithListArg$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'stringWithListArg', - ResultSet.Field - > - > - stringWithListArgRequired: <$SelectionSet>( - args: Utils.Exact<$SelectionSet, SelectionSet.Query.stringWithListArgRequired$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'stringWithListArgRequired', - ResultSet.Field - > - > - stringWithRequiredArg: <$SelectionSet>( - args: Utils.Exact<$SelectionSet, SelectionSet.Query.stringWithRequiredArg$SelectionSetArguments>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'stringWithRequiredArg', - ResultSet.Field - > - > - unionFooBar: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.unionFooBar>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'unionFooBar', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['unionFooBar'], Index> - > - > - unionFooBarNonNull: <$SelectionSet>( - selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.unionFooBarNonNull>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'unionFooBarNonNull', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['unionFooBarNonNull'], Index> - > - > - unionFooBarWithArgs: <$SelectionSet>( - selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.unionFooBarWithArgs>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'unionFooBarWithArgs', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['unionFooBarWithArgs'], Index> - > - > - unionObject: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.unionObject>) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'unionObject', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['unionObject'], Index> - > - > - unionObjectNonNull: <$SelectionSet>( - selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query.unionObjectNonNull>, - ) => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'unionObjectNonNull', - ResultSet.Field<$SelectionSet, Index['Root']['Query']['fields']['unionObjectNonNull'], Index> - > - > -} - -export interface MutationMethods<$Config extends Utils.Config> { - $batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Mutation>) => Promise< - Utils.ResolveOutputReturnRootType< - $Config, - Index, - ResultSet.Mutation< - Aug<$Config, 'Mutation', $SelectionSet>, - Index - > - > - > - __typename: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - '__typename', - 'Mutation' - > - > - id: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'id', - ResultSet.Field - > - > - idNonNull: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'idNonNull', - ResultSet.Field - > - > -} - -export interface BuilderMethodsRoot<$Config extends Utils.Config> { - mutation: MutationMethods<$Config> - query: QueryMethods<$Config> -} - -export interface BuilderMethodsRootFn extends Utils.HKT.Fn { - // @ts-expect-error parameter is Untyped. - return: BuilderMethodsRoot -} diff --git a/tests/_/schema/generated/modules/SelectMethods.ts b/tests/_/schema/generated/modules/SelectMethods.ts deleted file mode 100644 index cc1bb30e5..000000000 --- a/tests/_/schema/generated/modules/SelectMethods.ts +++ /dev/null @@ -1,199 +0,0 @@ -import type * as $Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' -import type * as $SelectionSets from './SelectionSets.js' - -// -// -// -// -// -// -// ================================================================================================== -// Select Methods Interface -// ================================================================================================== -// -// -// -// -// -// - -export interface $MethodsSelect { - Mutation: Mutation - Query: Query - Bar: Bar - DateObject1: DateObject1 - DateObject2: DateObject2 - ErrorOne: ErrorOne - ErrorTwo: ErrorTwo - Foo: Foo - Object1: Object1 - Object1ImplementingInterface: Object1ImplementingInterface - Object2ImplementingInterface: Object2ImplementingInterface - ObjectNested: ObjectNested - ObjectUnion: ObjectUnion - lowerCaseObject: lowerCaseObject - lowerCaseObject2: lowerCaseObject2 - DateUnion: DateUnion - FooBarUnion: FooBarUnion - Result: Result - lowerCaseUnion: lowerCaseUnion - DateInterface1: DateInterface1 - Error: Error - Interface: Interface -} - -// -// -// -// -// -// -// ================================================================================================== -// Root -// ================================================================================================== -// -// -// -// -// -// - -export interface Mutation { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Mutation>): $SelectionSet -} - -export interface Query { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Query>): $SelectionSet -} - -// -// -// -// -// -// -// ================================================================================================== -// Object -// ================================================================================================== -// -// -// -// -// -// - -export interface Bar { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Bar>): $SelectionSet -} - -export interface DateObject1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateObject1>): $SelectionSet -} - -export interface DateObject2 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateObject2>): $SelectionSet -} - -export interface ErrorOne { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ErrorOne>): $SelectionSet -} - -export interface ErrorTwo { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ErrorTwo>): $SelectionSet -} - -export interface Foo { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Foo>): $SelectionSet -} - -export interface Object1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Object1>): $SelectionSet -} - -export interface Object1ImplementingInterface { - <$SelectionSet>( - selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Object1ImplementingInterface>, - ): $SelectionSet -} - -export interface Object2ImplementingInterface { - <$SelectionSet>( - selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Object2ImplementingInterface>, - ): $SelectionSet -} - -export interface ObjectNested { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ObjectNested>): $SelectionSet -} - -export interface ObjectUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.ObjectUnion>): $SelectionSet -} - -export interface lowerCaseObject { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseObject>): $SelectionSet -} - -export interface lowerCaseObject2 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseObject2>): $SelectionSet -} - -// -// -// -// -// -// -// ================================================================================================== -// Union -// ================================================================================================== -// -// -// -// -// -// - -export interface DateUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateUnion>): $SelectionSet -} - -export interface FooBarUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.FooBarUnion>): $SelectionSet -} - -export interface Result { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Result>): $SelectionSet -} - -export interface lowerCaseUnion { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.lowerCaseUnion>): $SelectionSet -} - -// -// -// -// -// -// -// ================================================================================================== -// Interface -// ================================================================================================== -// -// -// -// -// -// - -export interface DateInterface1 { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.DateInterface1>): $SelectionSet -} - -export interface Error { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Error>): $SelectionSet -} - -export interface Interface { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Interface>): $SelectionSet -} diff --git a/tests/_/schemaGenerate.ts b/tests/_/schemaGenerate.ts deleted file mode 100644 index 228aa47d1..000000000 --- a/tests/_/schemaGenerate.ts +++ /dev/null @@ -1,54 +0,0 @@ -import type { GraphQLSchema } from 'graphql' -import { printSchema } from 'graphql' -import fs from 'node:fs/promises' -import { dirname, join } from 'node:path' -import { generateFiles } from '../../src/layers/4_generator/files.js' -import type { OptionsInput } from '../../src/layers/4_generator/generateCode.js' -import { schema as schema } from './schema/schema.js' -import { schema as schemaMutationOnly } from './schemaMutationOnly/schema.js' -import { schema as schemaQueryOnly } from './schemaQueryOnly/schema.js' - -const generate = async ( - input: { schema: GraphQLSchema; outputSchemaPath: string; name?: string; options?: OptionsInput }, -) => { - const sourceDirPath = dirname(input.outputSchemaPath) - await fs.writeFile( - input.outputSchemaPath, - printSchema(input.schema), - ) - await generateFiles({ - sourceSchema: { type: `sdl` }, - sourceDirPath, - sourceCustomScalarCodecsFilePath: join(`./tests/_/customScalarCodecs.ts`), - outputDirPath: join(sourceDirPath, `/generated`), - code: { - libraryPaths: { - client: `../../../../../src/entrypoints/client.js`, - schema: `../../../../../src/entrypoints/schema.js`, - scalars: `../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js`, - utilitiesForGenerated: `../../../../../src/entrypoints/utilities-for-generated.js`, - }, - }, - name: input.name, - ...input.options, - }) - console.log(`generated at`, sourceDirPath) -} - -await generate({ - name: `QueryOnly`, - schema: schemaQueryOnly, - outputSchemaPath: `./tests/_/schemaQueryOnly/schema.graphql`, -}) - -await generate({ - name: `MutationOnly`, - schema: schemaMutationOnly, - outputSchemaPath: `./tests/_/schemaMutationOnly/schema.graphql`, -}) - -await generate({ - schema, - outputSchemaPath: `./tests/_/schema/schema.graphql`, - options: { errorTypeNamePattern: /^Error.+/ }, -}) diff --git a/tests/_/schemaMutationOnly/generated/modules/RootMethods.ts b/tests/_/schemaMutationOnly/generated/modules/RootMethods.ts deleted file mode 100644 index a076414f3..000000000 --- a/tests/_/schemaMutationOnly/generated/modules/RootMethods.ts +++ /dev/null @@ -1,59 +0,0 @@ -import type { ResultSet } from '../../../../../src/entrypoints/schema.js' -import type * as Utils from '../../../../../src/entrypoints/utilities-for-generated.js' -import type { Index } from './SchemaIndex.js' -import type * as SelectionSet from './SelectionSets.js' - -type Aug< - $Config extends Utils.Config, - $RootTypeName extends Index['RootTypesPresent'][number], - $Selection, -> = Utils.ConfigGetOutputError<$Config, 'schema'> extends 'throw' - ? (keyof $Selection & Index['error']['rootResultFields'][$RootTypeName]) extends never ? $Selection - : $Selection & Utils.SelectionSet.TypenameSelection - : $Selection - -export interface MutationMethods<$Config extends Utils.Config> { - $batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Mutation>) => Promise< - Utils.ResolveOutputReturnRootType< - $Config, - Index, - ResultSet.Mutation< - Aug<$Config, 'Mutation', $SelectionSet>, - Index - > - > - > - __typename: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - '__typename', - 'Mutation' - > - > - id: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'id', - ResultSet.Field - > - > - idNonNull: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'idNonNull', - ResultSet.Field - > - > -} - -export interface BuilderMethodsRoot<$Config extends Utils.Config> { - mutation: MutationMethods<$Config> -} - -export interface BuilderMethodsRootFn extends Utils.HKT.Fn { - // @ts-expect-error parameter is Untyped. - return: BuilderMethodsRoot -} diff --git a/tests/_/schemaMutationOnly/generated/modules/Scalar.ts b/tests/_/schemaMutationOnly/generated/modules/Scalar.ts deleted file mode 100644 index 37e5ce95a..000000000 --- a/tests/_/schemaMutationOnly/generated/modules/Scalar.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from '../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' -export * from '../../../customScalarCodecs.js' -export {} from '../../../customScalarCodecs.js' diff --git a/tests/_/schemaMutationOnly/generated/modules/SelectMethods.ts b/tests/_/schemaMutationOnly/generated/modules/SelectMethods.ts deleted file mode 100644 index 704bcb2c2..000000000 --- a/tests/_/schemaMutationOnly/generated/modules/SelectMethods.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type * as $Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' -import type * as $SelectionSets from './SelectionSets.js' - -// -// -// -// -// -// -// ================================================================================================== -// Select Methods Interface -// ================================================================================================== -// -// -// -// -// -// - -export interface $MethodsSelect { - Mutation: Mutation -} - -// -// -// -// -// -// -// ================================================================================================== -// Root -// ================================================================================================== -// -// -// -// -// -// - -export interface Mutation { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Mutation>): $SelectionSet -} diff --git a/tests/_/schemaQueryOnly/generated/modules/RootMethods.ts b/tests/_/schemaQueryOnly/generated/modules/RootMethods.ts deleted file mode 100644 index 559264c96..000000000 --- a/tests/_/schemaQueryOnly/generated/modules/RootMethods.ts +++ /dev/null @@ -1,59 +0,0 @@ -import type { ResultSet } from '../../../../../src/entrypoints/schema.js' -import type * as Utils from '../../../../../src/entrypoints/utilities-for-generated.js' -import type { Index } from './SchemaIndex.js' -import type * as SelectionSet from './SelectionSets.js' - -type Aug< - $Config extends Utils.Config, - $RootTypeName extends Index['RootTypesPresent'][number], - $Selection, -> = Utils.ConfigGetOutputError<$Config, 'schema'> extends 'throw' - ? (keyof $Selection & Index['error']['rootResultFields'][$RootTypeName]) extends never ? $Selection - : $Selection & Utils.SelectionSet.TypenameSelection - : $Selection - -export interface QueryMethods<$Config extends Utils.Config> { - $batch: <$SelectionSet>(selectionSet: Utils.Exact<$SelectionSet, SelectionSet.Query>) => Promise< - Utils.ResolveOutputReturnRootType< - $Config, - Index, - ResultSet.Query< - Aug<$Config, 'Query', $SelectionSet>, - Index - > - > - > - __typename: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - '__typename', - 'Query' - > - > - id: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'id', - ResultSet.Field - > - > - idNonNull: () => Promise< - Utils.ResolveOutputReturnRootField< - $Config, - Index, - 'idNonNull', - ResultSet.Field - > - > -} - -export interface BuilderMethodsRoot<$Config extends Utils.Config> { - query: QueryMethods<$Config> -} - -export interface BuilderMethodsRootFn extends Utils.HKT.Fn { - // @ts-expect-error parameter is Untyped. - return: BuilderMethodsRoot -} diff --git a/tests/_/schemaQueryOnly/generated/modules/Scalar.ts b/tests/_/schemaQueryOnly/generated/modules/Scalar.ts deleted file mode 100644 index 37e5ce95a..000000000 --- a/tests/_/schemaQueryOnly/generated/modules/Scalar.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from '../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' -export * from '../../../customScalarCodecs.js' -export {} from '../../../customScalarCodecs.js' diff --git a/tests/_/schemaQueryOnly/generated/modules/SelectMethods.ts b/tests/_/schemaQueryOnly/generated/modules/SelectMethods.ts deleted file mode 100644 index a98f1ead0..000000000 --- a/tests/_/schemaQueryOnly/generated/modules/SelectMethods.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type * as $Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' -import type * as $SelectionSets from './SelectionSets.js' - -// -// -// -// -// -// -// ================================================================================================== -// Select Methods Interface -// ================================================================================================== -// -// -// -// -// -// - -export interface $MethodsSelect { - Query: Query -} - -// -// -// -// -// -// -// ================================================================================================== -// Root -// ================================================================================================== -// -// -// -// -// -// - -export interface Query { - <$SelectionSet>(selectionSet: $Utilities.Exact<$SelectionSet, $SelectionSets.Query>): $SelectionSet -} diff --git a/tests/_/db.ts b/tests/_/schemas/db.ts similarity index 95% rename from tests/_/db.ts rename to tests/_/schemas/db.ts index 16de60b8d..808648a40 100644 --- a/tests/_/db.ts +++ b/tests/_/schemas/db.ts @@ -1,5 +1,5 @@ import { GraphQLError } from 'graphql' -import { Errors } from '../../src/lib/errors/__.js' +import { Errors } from '../../../src/lib/errors/__.js' const date0 = new Date(0) diff --git a/tests/_/schemas/generate.ts b/tests/_/schemas/generate.ts new file mode 100644 index 000000000..5d7e73dfc --- /dev/null +++ b/tests/_/schemas/generate.ts @@ -0,0 +1,64 @@ +import { pascalCase } from 'es-toolkit' +import { printSchema } from 'graphql' +import fs from 'node:fs/promises' +import { dirname, join } from 'node:path' +import { generateFiles } from '../../../src/layers/4_generator/files.js' +import type { OptionsInput } from '../../../src/layers/4_generator/generateCode.js' + +const generate = async ( + input: { + dirName: string + name?: boolean + options?: OptionsInput + defaultSchemaUrl?: URL + }, +) => { + const name = input.name === false ? undefined : pascalCase(input.dirName) + + const rootDir = join(`./tests/_/schemas/`, input.dirName) + const outputSchemaPath = join(rootDir, `schema.graphql`) + const sourceDirPath = dirname(outputSchemaPath) + const outputDirPath = join(rootDir, `/graffle`) + + const { schema } = await import(`./${input.dirName}/schema.js`) + + await fs.writeFile(outputSchemaPath, printSchema(schema)) + + await generateFiles({ + sourceSchema: { type: `sdl` }, + sourceDirPath, + defaultSchemaUrl: input.defaultSchemaUrl, + sourceCustomScalarCodecsFilePath: join(`./tests/_/customScalarCodecs.ts`), + outputDirPath, + code: { + libraryPaths: { + client: `../../../../../../src/entrypoints/client.js`, + schema: `../../../../../../src/entrypoints/schema.js`, + scalars: `../../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js`, + utilitiesForGenerated: `../../../../../../src/entrypoints/utilities-for-generated.js`, + }, + }, + name, + ...input.options, + }) + console.log(`generated at`, sourceDirPath) +} + +await generate({ + dirName: `pokemon`, + defaultSchemaUrl: new URL(`http://localhost:3000/graphql`), +}) + +await generate({ + dirName: `query-only`, +}) + +await generate({ + dirName: `mutation-only`, +}) + +await generate({ + dirName: `kitchen-sink`, + name: false, + options: { errorTypeNamePattern: /^Error.+/ }, +}) diff --git a/examples/$/generated-clients/pokemon/_.ts b/tests/_/schemas/kitchen-sink/graffle/_.ts similarity index 100% rename from examples/$/generated-clients/pokemon/_.ts rename to tests/_/schemas/kitchen-sink/graffle/_.ts diff --git a/tests/_/schema/generated/__.ts b/tests/_/schemas/kitchen-sink/graffle/__.ts similarity index 100% rename from tests/_/schema/generated/__.ts rename to tests/_/schemas/kitchen-sink/graffle/__.ts diff --git a/tests/_/schema/generated/modules/Client.ts b/tests/_/schemas/kitchen-sink/graffle/modules/Client.ts similarity index 64% rename from tests/_/schema/generated/modules/Client.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/Client.ts index b78bf3879..44d3c2d07 100644 --- a/tests/_/schema/generated/modules/Client.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/Client.ts @@ -1,4 +1,4 @@ -import { createPrefilled } from '../../../../../src/entrypoints/client.js' +import { createPrefilled } from '../../../../../../src/entrypoints/client.js' import { $defaultSchemaUrl, $Index } from './SchemaRuntime.js' export const create = createPrefilled(`default`, $Index, $defaultSchemaUrl) diff --git a/tests/_/schema/generated/modules/Data.ts b/tests/_/schemas/kitchen-sink/graffle/modules/Data.ts similarity index 100% rename from tests/_/schema/generated/modules/Data.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/Data.ts diff --git a/tests/_/schema/generated/modules/Error.ts b/tests/_/schemas/kitchen-sink/graffle/modules/Error.ts similarity index 100% rename from tests/_/schema/generated/modules/Error.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/Error.ts diff --git a/tests/_/schema/generated/modules/Global.ts b/tests/_/schemas/kitchen-sink/graffle/modules/Global.ts similarity index 100% rename from tests/_/schema/generated/modules/Global.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/Global.ts diff --git a/examples/$/generated-clients/pokemon/modules/MethodsDocument.ts b/tests/_/schemas/kitchen-sink/graffle/modules/MethodsDocument.ts similarity index 89% rename from examples/$/generated-clients/pokemon/modules/MethodsDocument.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/MethodsDocument.ts index 8418391be..8250eccb9 100644 --- a/examples/$/generated-clients/pokemon/modules/MethodsDocument.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/MethodsDocument.ts @@ -1,4 +1,4 @@ -import type * as Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' +import type * as Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSets from './SelectionSets.js' diff --git a/tests/_/schema/generated/modules/MethodsRoot.ts b/tests/_/schemas/kitchen-sink/graffle/modules/MethodsRoot.ts similarity index 99% rename from tests/_/schema/generated/modules/MethodsRoot.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/MethodsRoot.ts index c8c2313a1..517163a27 100644 --- a/tests/_/schema/generated/modules/MethodsRoot.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/MethodsRoot.ts @@ -1,5 +1,5 @@ -import type { ResultSet } from '../../../../../src/entrypoints/schema.js' -import type * as Utils from '../../../../../src/entrypoints/utilities-for-generated.js' +import type { ResultSet } from '../../../../../../src/entrypoints/schema.js' +import type * as Utils from '../../../../../../src/entrypoints/utilities-for-generated.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSet from './SelectionSets.js' diff --git a/tests/_/schema/generated/modules/MethodsSelect.ts b/tests/_/schemas/kitchen-sink/graffle/modules/MethodsSelect.ts similarity index 98% rename from tests/_/schema/generated/modules/MethodsSelect.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/MethodsSelect.ts index cc1bb30e5..8f12ae488 100644 --- a/tests/_/schema/generated/modules/MethodsSelect.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/MethodsSelect.ts @@ -1,4 +1,4 @@ -import type * as $Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' +import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' import type * as $SelectionSets from './SelectionSets.js' // diff --git a/tests/_/schema/generated/modules/Scalar.ts b/tests/_/schemas/kitchen-sink/graffle/modules/Scalar.ts similarity index 64% rename from tests/_/schema/generated/modules/Scalar.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/Scalar.ts index 2451b2127..a018bde50 100644 --- a/tests/_/schema/generated/modules/Scalar.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/Scalar.ts @@ -1,9 +1,9 @@ -import type { Schema } from '../../../../../src/entrypoints/schema.js' -import * as CustomScalars from '../../../customScalarCodecs.js' +import type { Schema } from '../../../../../../src/entrypoints/schema.js' +import * as CustomScalars from '../../../../customScalarCodecs.js' -export * from '../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' -export * from '../../../customScalarCodecs.js' -export { Date } from '../../../customScalarCodecs.js' +export * from '../../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../customScalarCodecs.js' +export { Date } from '../../../../customScalarCodecs.js' // // diff --git a/tests/_/schema/generated/modules/SchemaBuildtime.ts b/tests/_/schemas/kitchen-sink/graffle/modules/SchemaBuildtime.ts similarity index 99% rename from tests/_/schema/generated/modules/SchemaBuildtime.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/SchemaBuildtime.ts index e774be9d7..21f8aafa5 100644 --- a/tests/_/schema/generated/modules/SchemaBuildtime.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/SchemaBuildtime.ts @@ -1,4 +1,4 @@ -import type * as $ from '../../../../../src/entrypoints/schema.js' +import type * as $ from '../../../../../../src/entrypoints/schema.js' import type * as $Scalar from './Scalar.ts' // ------------------------------------------------------------ // diff --git a/tests/_/schema/generated/modules/SchemaIndex.ts b/tests/_/schemas/kitchen-sink/graffle/modules/SchemaIndex.ts similarity index 100% rename from tests/_/schema/generated/modules/SchemaIndex.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/SchemaIndex.ts diff --git a/tests/_/schema/generated/modules/SchemaRuntime.ts b/tests/_/schemas/kitchen-sink/graffle/modules/SchemaRuntime.ts similarity index 99% rename from tests/_/schema/generated/modules/SchemaRuntime.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/SchemaRuntime.ts index 7b70c23eb..f7f5852a4 100644 --- a/tests/_/schema/generated/modules/SchemaRuntime.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/SchemaRuntime.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import * as $ from '../../../../../src/entrypoints/schema.js' +import * as $ from '../../../../../../src/entrypoints/schema.js' import * as Data from './Data.js' import * as $Scalar from './Scalar.js' import type { Index } from './SchemaIndex.js' diff --git a/tests/_/schema/generated/modules/Select.ts b/tests/_/schemas/kitchen-sink/graffle/modules/Select.ts similarity index 96% rename from tests/_/schema/generated/modules/Select.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/Select.ts index 25c81b9dd..372ea3984 100644 --- a/tests/_/schema/generated/modules/Select.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/Select.ts @@ -1,4 +1,4 @@ -import type { ResultSet } from '../../../../../src/entrypoints/schema.js' +import type { ResultSet } from '../../../../../../src/entrypoints/schema.js' import * as Data from './Data.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSets from './SelectionSets.js' @@ -18,7 +18,7 @@ import type * as SelectionSets from './SelectionSets.js' // // // -import { createSelect } from '../../../../../src/entrypoints/client.js' +import { createSelect } from '../../../../../../src/entrypoints/client.js' export const Select = createSelect(Data.Name) // diff --git a/tests/_/schema/generated/modules/SelectionSets.ts b/tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.ts similarity index 99% rename from tests/_/schema/generated/modules/SelectionSets.ts rename to tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.ts index 629860fac..1d031ef3f 100644 --- a/tests/_/schema/generated/modules/SelectionSets.ts +++ b/tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.ts @@ -1,5 +1,5 @@ -import type { SelectionSet as $SelectionSet } from '../../../../../src/entrypoints/schema.js' -import type * as $Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' +import type { SelectionSet as $SelectionSet } from '../../../../../../src/entrypoints/schema.js' +import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' import type * as $Scalar from './Scalar.js' // diff --git a/tests/_/schema/schema.graphql b/tests/_/schemas/kitchen-sink/schema.graphql similarity index 100% rename from tests/_/schema/schema.graphql rename to tests/_/schemas/kitchen-sink/schema.graphql diff --git a/tests/_/schema/schema.ts b/tests/_/schemas/kitchen-sink/schema.ts similarity index 98% rename from tests/_/schema/schema.ts rename to tests/_/schemas/kitchen-sink/schema.ts index 389225416..599c1c972 100644 --- a/tests/_/schema/schema.ts +++ b/tests/_/schemas/kitchen-sink/schema.ts @@ -431,6 +431,3 @@ builder.queryType({ }) export const schema = builder.toSchema({ sortSchema: true }) - -export type { Index } from './generated/modules/SchemaIndex.js' -export { $Index } from './generated/modules/SchemaRuntime.js' diff --git a/tests/_/schema/generated/_.ts b/tests/_/schemas/mutation-only/graffle/_.ts similarity index 100% rename from tests/_/schema/generated/_.ts rename to tests/_/schemas/mutation-only/graffle/_.ts diff --git a/tests/_/schemaMutationOnly/generated/__.ts b/tests/_/schemas/mutation-only/graffle/__.ts similarity index 100% rename from tests/_/schemaMutationOnly/generated/__.ts rename to tests/_/schemas/mutation-only/graffle/__.ts diff --git a/tests/_/schemaMutationOnly/generated/modules/Client.ts b/tests/_/schemas/mutation-only/graffle/modules/Client.ts similarity index 65% rename from tests/_/schemaMutationOnly/generated/modules/Client.ts rename to tests/_/schemas/mutation-only/graffle/modules/Client.ts index 100d77dfd..1041a03ed 100644 --- a/tests/_/schemaMutationOnly/generated/modules/Client.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/Client.ts @@ -1,4 +1,4 @@ -import { createPrefilled } from '../../../../../src/entrypoints/client.js' +import { createPrefilled } from '../../../../../../src/entrypoints/client.js' import { $defaultSchemaUrl, $Index } from './SchemaRuntime.js' export const create = createPrefilled(`MutationOnly`, $Index, $defaultSchemaUrl) diff --git a/tests/_/schemaMutationOnly/generated/modules/Data.ts b/tests/_/schemas/mutation-only/graffle/modules/Data.ts similarity index 100% rename from tests/_/schemaMutationOnly/generated/modules/Data.ts rename to tests/_/schemas/mutation-only/graffle/modules/Data.ts diff --git a/examples/$/generated-clients/pokemon/modules/Error.ts b/tests/_/schemas/mutation-only/graffle/modules/Error.ts similarity index 100% rename from examples/$/generated-clients/pokemon/modules/Error.ts rename to tests/_/schemas/mutation-only/graffle/modules/Error.ts diff --git a/tests/_/schemaMutationOnly/generated/modules/Global.ts b/tests/_/schemas/mutation-only/graffle/modules/Global.ts similarity index 100% rename from tests/_/schemaMutationOnly/generated/modules/Global.ts rename to tests/_/schemas/mutation-only/graffle/modules/Global.ts diff --git a/tests/_/schemaMutationOnly/generated/modules/MethodsDocument.ts b/tests/_/schemas/mutation-only/graffle/modules/MethodsDocument.ts similarity index 88% rename from tests/_/schemaMutationOnly/generated/modules/MethodsDocument.ts rename to tests/_/schemas/mutation-only/graffle/modules/MethodsDocument.ts index 9dfbba88d..84c60ef79 100644 --- a/tests/_/schemaMutationOnly/generated/modules/MethodsDocument.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/MethodsDocument.ts @@ -1,4 +1,4 @@ -import type * as Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' +import type * as Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSets from './SelectionSets.js' diff --git a/tests/_/schemaMutationOnly/generated/modules/MethodsRoot.ts b/tests/_/schemas/mutation-only/graffle/modules/MethodsRoot.ts similarity index 89% rename from tests/_/schemaMutationOnly/generated/modules/MethodsRoot.ts rename to tests/_/schemas/mutation-only/graffle/modules/MethodsRoot.ts index b38f990e7..944e870ae 100644 --- a/tests/_/schemaMutationOnly/generated/modules/MethodsRoot.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/MethodsRoot.ts @@ -1,5 +1,5 @@ -import type { ResultSet } from '../../../../../src/entrypoints/schema.js' -import type * as Utils from '../../../../../src/entrypoints/utilities-for-generated.js' +import type { ResultSet } from '../../../../../../src/entrypoints/schema.js' +import type * as Utils from '../../../../../../src/entrypoints/utilities-for-generated.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSet from './SelectionSets.js' diff --git a/tests/_/schemaMutationOnly/generated/modules/MethodsSelect.ts b/tests/_/schemas/mutation-only/graffle/modules/MethodsSelect.ts similarity index 89% rename from tests/_/schemaMutationOnly/generated/modules/MethodsSelect.ts rename to tests/_/schemas/mutation-only/graffle/modules/MethodsSelect.ts index 704bcb2c2..24587dab8 100644 --- a/tests/_/schemaMutationOnly/generated/modules/MethodsSelect.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/MethodsSelect.ts @@ -1,4 +1,4 @@ -import type * as $Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' +import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' import type * as $SelectionSets from './SelectionSets.js' // diff --git a/tests/_/schemas/mutation-only/graffle/modules/Scalar.ts b/tests/_/schemas/mutation-only/graffle/modules/Scalar.ts new file mode 100644 index 000000000..d504fd23d --- /dev/null +++ b/tests/_/schemas/mutation-only/graffle/modules/Scalar.ts @@ -0,0 +1,3 @@ +export * from '../../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../customScalarCodecs.js' +export {} from '../../../../customScalarCodecs.js' diff --git a/tests/_/schemaMutationOnly/generated/modules/SchemaBuildtime.ts b/tests/_/schemas/mutation-only/graffle/modules/SchemaBuildtime.ts similarity index 95% rename from tests/_/schemaMutationOnly/generated/modules/SchemaBuildtime.ts rename to tests/_/schemas/mutation-only/graffle/modules/SchemaBuildtime.ts index 119d08095..172af1d93 100644 --- a/tests/_/schemaMutationOnly/generated/modules/SchemaBuildtime.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/SchemaBuildtime.ts @@ -1,4 +1,4 @@ -import type * as $ from '../../../../../src/entrypoints/schema.js' +import type * as $ from '../../../../../../src/entrypoints/schema.js' import type * as $Scalar from './Scalar.ts' // ------------------------------------------------------------ // diff --git a/tests/_/schemaMutationOnly/generated/modules/SchemaIndex.ts b/tests/_/schemas/mutation-only/graffle/modules/SchemaIndex.ts similarity index 100% rename from tests/_/schemaMutationOnly/generated/modules/SchemaIndex.ts rename to tests/_/schemas/mutation-only/graffle/modules/SchemaIndex.ts diff --git a/tests/_/schemaMutationOnly/generated/modules/SchemaRuntime.ts b/tests/_/schemas/mutation-only/graffle/modules/SchemaRuntime.ts similarity index 93% rename from tests/_/schemaMutationOnly/generated/modules/SchemaRuntime.ts rename to tests/_/schemas/mutation-only/graffle/modules/SchemaRuntime.ts index 7649ced1d..3658bf355 100644 --- a/tests/_/schemaMutationOnly/generated/modules/SchemaRuntime.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/SchemaRuntime.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import * as $ from '../../../../../src/entrypoints/schema.js' +import * as $ from '../../../../../../src/entrypoints/schema.js' import * as Data from './Data.js' import * as $Scalar from './Scalar.js' import type { Index } from './SchemaIndex.js' diff --git a/tests/_/schemaMutationOnly/generated/modules/Select.ts b/tests/_/schemas/mutation-only/graffle/modules/Select.ts similarity index 88% rename from tests/_/schemaMutationOnly/generated/modules/Select.ts rename to tests/_/schemas/mutation-only/graffle/modules/Select.ts index 2829ff082..6f0226583 100644 --- a/tests/_/schemaMutationOnly/generated/modules/Select.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/Select.ts @@ -1,4 +1,4 @@ -import type { ResultSet } from '../../../../../src/entrypoints/schema.js' +import type { ResultSet } from '../../../../../../src/entrypoints/schema.js' import * as Data from './Data.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSets from './SelectionSets.js' @@ -18,7 +18,7 @@ import type * as SelectionSets from './SelectionSets.js' // // // -import { createSelect } from '../../../../../src/entrypoints/client.js' +import { createSelect } from '../../../../../../src/entrypoints/client.js' export const Select = createSelect(Data.Name) // diff --git a/tests/_/schemaMutationOnly/generated/modules/SelectionSets.ts b/tests/_/schemas/mutation-only/graffle/modules/SelectionSets.ts similarity index 95% rename from tests/_/schemaMutationOnly/generated/modules/SelectionSets.ts rename to tests/_/schemas/mutation-only/graffle/modules/SelectionSets.ts index f78e2946d..e75355bf9 100644 --- a/tests/_/schemaMutationOnly/generated/modules/SelectionSets.ts +++ b/tests/_/schemas/mutation-only/graffle/modules/SelectionSets.ts @@ -1,5 +1,5 @@ -import type { SelectionSet as $SelectionSet } from '../../../../../src/entrypoints/schema.js' -import type * as $Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' +import type { SelectionSet as $SelectionSet } from '../../../../../../src/entrypoints/schema.js' +import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' // // diff --git a/tests/_/schemaMutationOnly/schema.graphql b/tests/_/schemas/mutation-only/schema.graphql similarity index 100% rename from tests/_/schemaMutationOnly/schema.graphql rename to tests/_/schemas/mutation-only/schema.graphql diff --git a/tests/_/schemaMutationOnly/schema.ts b/tests/_/schemas/mutation-only/schema.ts similarity index 72% rename from tests/_/schemaMutationOnly/schema.ts rename to tests/_/schemas/mutation-only/schema.ts index a7e3d0b49..26822e6f7 100644 --- a/tests/_/schemaMutationOnly/schema.ts +++ b/tests/_/schemas/mutation-only/schema.ts @@ -13,6 +13,3 @@ builder.mutationType({ export const schema = builder.toSchema({ sortSchema: true, }) - -export type { Index } from './generated/modules/SchemaIndex.js' -export { $Index } from './generated/modules/SchemaRuntime.js' diff --git a/examples/$/schemas/pokemon/data.ts b/tests/_/schemas/pokemon/data.ts similarity index 78% rename from examples/$/schemas/pokemon/data.ts rename to tests/_/schemas/pokemon/data.ts index dd621d650..0b62c7db7 100644 --- a/examples/$/schemas/pokemon/data.ts +++ b/tests/_/schemas/pokemon/data.ts @@ -1,29 +1,29 @@ const day = 1000 * 60 * 60 * 24 -const year = day * 365.25 +// const year = day * 365.25 export namespace DatabaseServer { export const TrainerClass = { - youngster: 'youngster', - bugCatcher: 'bugCatcher', - camper: 'camper', - picnicker: 'picnicker', - psychic: 'psychic', - psychicMedium: 'psychicMedium', - psychicYoungster: 'psychicYoungster', - sailor: 'sailor', - superNerd: 'superNerd', - tamer: 'tamer', - triathlete: 'triathlete', - youth: 'youth', - teamRocketGrunt: 'teamRocketGrunt', + youngster: `youngster`, + bugCatcher: `bugCatcher`, + camper: `camper`, + picnicker: `picnicker`, + psychic: `psychic`, + psychicMedium: `psychicMedium`, + psychicYoungster: `psychicYoungster`, + sailor: `sailor`, + superNerd: `superNerd`, + tamer: `tamer`, + triathlete: `triathlete`, + youth: `youth`, + teamRocketGrunt: `teamRocketGrunt`, } as const export type TrainerClass = (typeof TrainerClass)[keyof typeof TrainerClass] export const PokemonType = { - electric: 'electric', - fire: 'fire', - water: 'water', - grass: 'grass', + electric: `electric`, + fire: `fire`, + water: `water`, + grass: `grass`, } as const export type PokemonType = typeof PokemonType[keyof typeof PokemonType] @@ -77,7 +77,7 @@ export namespace DatabaseServer { export const tenant = (tenantName?: string): Database => { if (!tenantName) { - return databases['$default']! + return databases[`$default`]! } let database = databases[tenantName] @@ -103,10 +103,10 @@ export namespace DatabaseServer { // dprint-ignore database.pokemon.push( - { id: 1, name: `Pikachu`, type: `electric`, hp: 35, attack: 55, defense: 40, trainerId: 1, birthday: new Date('1850').getTime(), kind: `Pokemon` }, + { id: 1, name: `Pikachu`, type: `electric`, hp: 35, attack: 55, defense: 40, trainerId: 1, birthday: new Date(`1850`).getTime(), kind: `Pokemon` }, { id: 2, name: `Charizard`, type: `fire`, hp: 78, attack: 84, defense: 78, trainerId: 1, birthday: new Date(Date.now() - day * 5).getTime(), kind: `Pokemon` }, - { id: 3, name: `Squirtle`, type: `water`, hp: 44, attack: 48, defense: 65, trainerId: 2, birthday: new Date('1910').getTime(), kind: `Pokemon` }, - { id: 4, name: `Bulbasaur`, type: `grass`, hp: 45, attack: 49, defense: 49, trainerId: null, birthday: new Date('2000').getTime(), kind: `Pokemon` }, + { id: 3, name: `Squirtle`, type: `water`, hp: 44, attack: 48, defense: 65, trainerId: 2, birthday: new Date(`1910`).getTime(), kind: `Pokemon` }, + { id: 4, name: `Bulbasaur`, type: `grass`, hp: 45, attack: 49, defense: 49, trainerId: null, birthday: new Date(`2000`).getTime(), kind: `Pokemon` }, ) } } diff --git a/tests/_/schemaMutationOnly/generated/_.ts b/tests/_/schemas/pokemon/graffle/_.ts similarity index 100% rename from tests/_/schemaMutationOnly/generated/_.ts rename to tests/_/schemas/pokemon/graffle/_.ts diff --git a/examples/$/generated-clients/pokemon/__.ts b/tests/_/schemas/pokemon/graffle/__.ts similarity index 100% rename from examples/$/generated-clients/pokemon/__.ts rename to tests/_/schemas/pokemon/graffle/__.ts diff --git a/examples/$/generated-clients/pokemon/modules/Client.ts b/tests/_/schemas/pokemon/graffle/modules/Client.ts similarity index 64% rename from examples/$/generated-clients/pokemon/modules/Client.ts rename to tests/_/schemas/pokemon/graffle/modules/Client.ts index 65f8e0b72..67d31a6e2 100644 --- a/examples/$/generated-clients/pokemon/modules/Client.ts +++ b/tests/_/schemas/pokemon/graffle/modules/Client.ts @@ -1,4 +1,4 @@ -import { createPrefilled } from '../../../../../src/entrypoints/client.js' +import { createPrefilled } from '../../../../../../src/entrypoints/client.js' import { $defaultSchemaUrl, $Index } from './SchemaRuntime.js' export const create = createPrefilled(`Pokemon`, $Index, $defaultSchemaUrl) diff --git a/examples/$/generated-clients/pokemon/modules/Data.ts b/tests/_/schemas/pokemon/graffle/modules/Data.ts similarity index 100% rename from examples/$/generated-clients/pokemon/modules/Data.ts rename to tests/_/schemas/pokemon/graffle/modules/Data.ts diff --git a/tests/_/schemaMutationOnly/generated/modules/Error.ts b/tests/_/schemas/pokemon/graffle/modules/Error.ts similarity index 100% rename from tests/_/schemaMutationOnly/generated/modules/Error.ts rename to tests/_/schemas/pokemon/graffle/modules/Error.ts diff --git a/examples/$/generated-clients/pokemon/modules/Global.ts b/tests/_/schemas/pokemon/graffle/modules/Global.ts similarity index 96% rename from examples/$/generated-clients/pokemon/modules/Global.ts rename to tests/_/schemas/pokemon/graffle/modules/Global.ts index 53cdb8cd9..e5961f4af 100644 --- a/examples/$/generated-clients/pokemon/modules/Global.ts +++ b/tests/_/schemas/pokemon/graffle/modules/Global.ts @@ -17,7 +17,7 @@ declare global { index: Index customScalars: {} featureOptions: { - schemaErrors: true + schemaErrors: false } /** * http://localhost:3000/graphql diff --git a/tests/_/schema/generated/modules/MethodsDocument.ts b/tests/_/schemas/pokemon/graffle/modules/MethodsDocument.ts similarity index 89% rename from tests/_/schema/generated/modules/MethodsDocument.ts rename to tests/_/schemas/pokemon/graffle/modules/MethodsDocument.ts index 8418391be..8250eccb9 100644 --- a/tests/_/schema/generated/modules/MethodsDocument.ts +++ b/tests/_/schemas/pokemon/graffle/modules/MethodsDocument.ts @@ -1,4 +1,4 @@ -import type * as Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' +import type * as Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSets from './SelectionSets.js' diff --git a/examples/$/generated-clients/pokemon/modules/MethodsRoot.ts b/tests/_/schemas/pokemon/graffle/modules/MethodsRoot.ts similarity index 95% rename from examples/$/generated-clients/pokemon/modules/MethodsRoot.ts rename to tests/_/schemas/pokemon/graffle/modules/MethodsRoot.ts index 3196f7240..9ff56bbe9 100644 --- a/examples/$/generated-clients/pokemon/modules/MethodsRoot.ts +++ b/tests/_/schemas/pokemon/graffle/modules/MethodsRoot.ts @@ -1,5 +1,5 @@ -import type { ResultSet } from '../../../../../src/entrypoints/schema.js' -import type * as Utils from '../../../../../src/entrypoints/utilities-for-generated.js' +import type { ResultSet } from '../../../../../../src/entrypoints/schema.js' +import type * as Utils from '../../../../../../src/entrypoints/utilities-for-generated.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSet from './SelectionSets.js' diff --git a/examples/$/generated-clients/pokemon/modules/MethodsSelect.ts b/tests/_/schemas/pokemon/graffle/modules/MethodsSelect.ts similarity index 95% rename from examples/$/generated-clients/pokemon/modules/MethodsSelect.ts rename to tests/_/schemas/pokemon/graffle/modules/MethodsSelect.ts index 682556d2a..12e510314 100644 --- a/examples/$/generated-clients/pokemon/modules/MethodsSelect.ts +++ b/tests/_/schemas/pokemon/graffle/modules/MethodsSelect.ts @@ -1,4 +1,4 @@ -import type * as $Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' +import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' import type * as $SelectionSets from './SelectionSets.js' // diff --git a/tests/_/schemas/pokemon/graffle/modules/Scalar.ts b/tests/_/schemas/pokemon/graffle/modules/Scalar.ts new file mode 100644 index 000000000..d504fd23d --- /dev/null +++ b/tests/_/schemas/pokemon/graffle/modules/Scalar.ts @@ -0,0 +1,3 @@ +export * from '../../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../customScalarCodecs.js' +export {} from '../../../../customScalarCodecs.js' diff --git a/examples/$/generated-clients/pokemon/modules/SchemaBuildtime.ts b/tests/_/schemas/pokemon/graffle/modules/SchemaBuildtime.ts similarity index 97% rename from examples/$/generated-clients/pokemon/modules/SchemaBuildtime.ts rename to tests/_/schemas/pokemon/graffle/modules/SchemaBuildtime.ts index 4ddac55b4..e4186ca2a 100644 --- a/examples/$/generated-clients/pokemon/modules/SchemaBuildtime.ts +++ b/tests/_/schemas/pokemon/graffle/modules/SchemaBuildtime.ts @@ -1,5 +1,5 @@ -import type * as $ from '../../../../../src/entrypoints/schema.js' -import type * as $Scalar from './Scalar.ts' +import type * as $ from '../../../../../../src/entrypoints/schema.js' +import type * as $Scalar from './Scalar.js' // ------------------------------------------------------------ // // Root // diff --git a/examples/$/generated-clients/pokemon/modules/SchemaIndex.ts b/tests/_/schemas/pokemon/graffle/modules/SchemaIndex.ts similarity index 100% rename from examples/$/generated-clients/pokemon/modules/SchemaIndex.ts rename to tests/_/schemas/pokemon/graffle/modules/SchemaIndex.ts diff --git a/examples/$/generated-clients/pokemon/modules/SchemaRuntime.ts b/tests/_/schemas/pokemon/graffle/modules/SchemaRuntime.ts similarity index 99% rename from examples/$/generated-clients/pokemon/modules/SchemaRuntime.ts rename to tests/_/schemas/pokemon/graffle/modules/SchemaRuntime.ts index 0673f9e79..9604f3393 100644 --- a/examples/$/generated-clients/pokemon/modules/SchemaRuntime.ts +++ b/tests/_/schemas/pokemon/graffle/modules/SchemaRuntime.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import * as $ from '../../../../../src/entrypoints/schema.js' +import * as $ from '../../../../../../src/entrypoints/schema.js' import * as Data from './Data.js' import * as $Scalar from './Scalar.js' import type { Index } from './SchemaIndex.js' diff --git a/examples/$/generated-clients/pokemon/modules/Select.ts b/tests/_/schemas/pokemon/graffle/modules/Select.ts similarity index 92% rename from examples/$/generated-clients/pokemon/modules/Select.ts rename to tests/_/schemas/pokemon/graffle/modules/Select.ts index b86f36598..adb93694f 100644 --- a/examples/$/generated-clients/pokemon/modules/Select.ts +++ b/tests/_/schemas/pokemon/graffle/modules/Select.ts @@ -1,4 +1,4 @@ -import type { ResultSet } from '../../../../../src/entrypoints/schema.js' +import type { ResultSet } from '../../../../../../src/entrypoints/schema.js' import * as Data from './Data.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSets from './SelectionSets.js' @@ -18,7 +18,7 @@ import type * as SelectionSets from './SelectionSets.js' // // // -import { createSelect } from '../../../../../src/entrypoints/client.js' +import { createSelect } from '../../../../../../src/entrypoints/client.js' export const Select = createSelect(Data.Name) // diff --git a/examples/$/generated-clients/pokemon/modules/SelectionSets.ts b/tests/_/schemas/pokemon/graffle/modules/SelectionSets.ts similarity index 99% rename from examples/$/generated-clients/pokemon/modules/SelectionSets.ts rename to tests/_/schemas/pokemon/graffle/modules/SelectionSets.ts index f26d39f79..2bf1271ae 100644 --- a/examples/$/generated-clients/pokemon/modules/SelectionSets.ts +++ b/tests/_/schemas/pokemon/graffle/modules/SelectionSets.ts @@ -1,5 +1,5 @@ -import type { SelectionSet as $SelectionSet } from '../../../../../src/entrypoints/schema.js' -import type * as $Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' +import type { SelectionSet as $SelectionSet } from '../../../../../../src/entrypoints/schema.js' +import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' // // diff --git a/examples/$/schemas/pokemon/schema.graphql b/tests/_/schemas/pokemon/schema.graphql similarity index 100% rename from examples/$/schemas/pokemon/schema.graphql rename to tests/_/schemas/pokemon/schema.graphql diff --git a/examples/$/schemas/pokemon/schema.ts b/tests/_/schemas/pokemon/schema.ts similarity index 97% rename from examples/$/schemas/pokemon/schema.ts rename to tests/_/schemas/pokemon/schema.ts index aba9f0e10..0ae5daef4 100644 --- a/examples/$/schemas/pokemon/schema.ts +++ b/tests/_/schemas/pokemon/schema.ts @@ -19,7 +19,7 @@ export const builder = new SchemaBuilder<{ const TrainerClass = builder.enumType(`TrainerClass`, { values: Object.values(DatabaseServer.TrainerClass) }) -const Being = builder.interfaceRef('Being').implement({ +const Being = builder.interfaceRef(`Being`).implement({ resolveType: (value) => { return value.kind }, @@ -185,7 +185,7 @@ builder.mutationField(`addPokemon`, (t) => args: { name: t.arg.string({ required: true, - validate: { minLength: [1, { message: 'Pokemon name cannot be empty.' }] }, + validate: { minLength: [1, { message: `Pokemon name cannot be empty.` }] }, }), type: t.arg({ type: PokemonType, required: true }), hp: t.arg.int({ required: false }), diff --git a/tests/_/schemaQueryOnly/generated/_.ts b/tests/_/schemas/query-only/graffle/_.ts similarity index 100% rename from tests/_/schemaQueryOnly/generated/_.ts rename to tests/_/schemas/query-only/graffle/_.ts diff --git a/tests/_/schemaQueryOnly/generated/__.ts b/tests/_/schemas/query-only/graffle/__.ts similarity index 100% rename from tests/_/schemaQueryOnly/generated/__.ts rename to tests/_/schemas/query-only/graffle/__.ts diff --git a/tests/_/schemaQueryOnly/generated/modules/Client.ts b/tests/_/schemas/query-only/graffle/modules/Client.ts similarity index 64% rename from tests/_/schemaQueryOnly/generated/modules/Client.ts rename to tests/_/schemas/query-only/graffle/modules/Client.ts index a5daaa448..4ef12a6a1 100644 --- a/tests/_/schemaQueryOnly/generated/modules/Client.ts +++ b/tests/_/schemas/query-only/graffle/modules/Client.ts @@ -1,4 +1,4 @@ -import { createPrefilled } from '../../../../../src/entrypoints/client.js' +import { createPrefilled } from '../../../../../../src/entrypoints/client.js' import { $defaultSchemaUrl, $Index } from './SchemaRuntime.js' export const create = createPrefilled(`QueryOnly`, $Index, $defaultSchemaUrl) diff --git a/tests/_/schemaQueryOnly/generated/modules/Data.ts b/tests/_/schemas/query-only/graffle/modules/Data.ts similarity index 100% rename from tests/_/schemaQueryOnly/generated/modules/Data.ts rename to tests/_/schemas/query-only/graffle/modules/Data.ts diff --git a/tests/_/schemaQueryOnly/generated/modules/Error.ts b/tests/_/schemas/query-only/graffle/modules/Error.ts similarity index 100% rename from tests/_/schemaQueryOnly/generated/modules/Error.ts rename to tests/_/schemas/query-only/graffle/modules/Error.ts diff --git a/tests/_/schemaQueryOnly/generated/modules/Global.ts b/tests/_/schemas/query-only/graffle/modules/Global.ts similarity index 100% rename from tests/_/schemaQueryOnly/generated/modules/Global.ts rename to tests/_/schemas/query-only/graffle/modules/Global.ts diff --git a/tests/_/schemaQueryOnly/generated/modules/MethodsDocument.ts b/tests/_/schemas/query-only/graffle/modules/MethodsDocument.ts similarity index 88% rename from tests/_/schemaQueryOnly/generated/modules/MethodsDocument.ts rename to tests/_/schemas/query-only/graffle/modules/MethodsDocument.ts index c4e21a6bb..423ea16a5 100644 --- a/tests/_/schemaQueryOnly/generated/modules/MethodsDocument.ts +++ b/tests/_/schemas/query-only/graffle/modules/MethodsDocument.ts @@ -1,4 +1,4 @@ -import type * as Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' +import type * as Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSets from './SelectionSets.js' diff --git a/tests/_/schemaQueryOnly/generated/modules/MethodsRoot.ts b/tests/_/schemas/query-only/graffle/modules/MethodsRoot.ts similarity index 88% rename from tests/_/schemaQueryOnly/generated/modules/MethodsRoot.ts rename to tests/_/schemas/query-only/graffle/modules/MethodsRoot.ts index 435c1a735..1b1c59ae5 100644 --- a/tests/_/schemaQueryOnly/generated/modules/MethodsRoot.ts +++ b/tests/_/schemas/query-only/graffle/modules/MethodsRoot.ts @@ -1,5 +1,5 @@ -import type { ResultSet } from '../../../../../src/entrypoints/schema.js' -import type * as Utils from '../../../../../src/entrypoints/utilities-for-generated.js' +import type { ResultSet } from '../../../../../../src/entrypoints/schema.js' +import type * as Utils from '../../../../../../src/entrypoints/utilities-for-generated.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSet from './SelectionSets.js' diff --git a/tests/_/schemaQueryOnly/generated/modules/MethodsSelect.ts b/tests/_/schemas/query-only/graffle/modules/MethodsSelect.ts similarity index 89% rename from tests/_/schemaQueryOnly/generated/modules/MethodsSelect.ts rename to tests/_/schemas/query-only/graffle/modules/MethodsSelect.ts index a98f1ead0..02343247d 100644 --- a/tests/_/schemaQueryOnly/generated/modules/MethodsSelect.ts +++ b/tests/_/schemas/query-only/graffle/modules/MethodsSelect.ts @@ -1,4 +1,4 @@ -import type * as $Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' +import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' import type * as $SelectionSets from './SelectionSets.js' // diff --git a/tests/_/schemas/query-only/graffle/modules/Scalar.ts b/tests/_/schemas/query-only/graffle/modules/Scalar.ts new file mode 100644 index 000000000..d504fd23d --- /dev/null +++ b/tests/_/schemas/query-only/graffle/modules/Scalar.ts @@ -0,0 +1,3 @@ +export * from '../../../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../customScalarCodecs.js' +export {} from '../../../../customScalarCodecs.js' diff --git a/tests/_/schemaQueryOnly/generated/modules/SchemaBuildtime.ts b/tests/_/schemas/query-only/graffle/modules/SchemaBuildtime.ts similarity index 95% rename from tests/_/schemaQueryOnly/generated/modules/SchemaBuildtime.ts rename to tests/_/schemas/query-only/graffle/modules/SchemaBuildtime.ts index f3188ba3a..1055f9053 100644 --- a/tests/_/schemaQueryOnly/generated/modules/SchemaBuildtime.ts +++ b/tests/_/schemas/query-only/graffle/modules/SchemaBuildtime.ts @@ -1,4 +1,4 @@ -import type * as $ from '../../../../../src/entrypoints/schema.js' +import type * as $ from '../../../../../../src/entrypoints/schema.js' import type * as $Scalar from './Scalar.ts' // ------------------------------------------------------------ // diff --git a/tests/_/schemaQueryOnly/generated/modules/SchemaIndex.ts b/tests/_/schemas/query-only/graffle/modules/SchemaIndex.ts similarity index 100% rename from tests/_/schemaQueryOnly/generated/modules/SchemaIndex.ts rename to tests/_/schemas/query-only/graffle/modules/SchemaIndex.ts diff --git a/tests/_/schemaQueryOnly/generated/modules/SchemaRuntime.ts b/tests/_/schemas/query-only/graffle/modules/SchemaRuntime.ts similarity index 93% rename from tests/_/schemaQueryOnly/generated/modules/SchemaRuntime.ts rename to tests/_/schemas/query-only/graffle/modules/SchemaRuntime.ts index 4b6638170..3d997f293 100644 --- a/tests/_/schemaQueryOnly/generated/modules/SchemaRuntime.ts +++ b/tests/_/schemas/query-only/graffle/modules/SchemaRuntime.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import * as $ from '../../../../../src/entrypoints/schema.js' +import * as $ from '../../../../../../src/entrypoints/schema.js' import * as Data from './Data.js' import * as $Scalar from './Scalar.js' import type { Index } from './SchemaIndex.js' diff --git a/tests/_/schemaQueryOnly/generated/modules/Select.ts b/tests/_/schemas/query-only/graffle/modules/Select.ts similarity index 87% rename from tests/_/schemaQueryOnly/generated/modules/Select.ts rename to tests/_/schemas/query-only/graffle/modules/Select.ts index b164d684b..6ad4361eb 100644 --- a/tests/_/schemaQueryOnly/generated/modules/Select.ts +++ b/tests/_/schemas/query-only/graffle/modules/Select.ts @@ -1,4 +1,4 @@ -import type { ResultSet } from '../../../../../src/entrypoints/schema.js' +import type { ResultSet } from '../../../../../../src/entrypoints/schema.js' import * as Data from './Data.js' import type { Index } from './SchemaIndex.js' import type * as SelectionSets from './SelectionSets.js' @@ -18,7 +18,7 @@ import type * as SelectionSets from './SelectionSets.js' // // // -import { createSelect } from '../../../../../src/entrypoints/client.js' +import { createSelect } from '../../../../../../src/entrypoints/client.js' export const Select = createSelect(Data.Name) // diff --git a/tests/_/schemaQueryOnly/generated/modules/SelectionSets.ts b/tests/_/schemas/query-only/graffle/modules/SelectionSets.ts similarity index 95% rename from tests/_/schemaQueryOnly/generated/modules/SelectionSets.ts rename to tests/_/schemas/query-only/graffle/modules/SelectionSets.ts index 6ee24d3e5..0c392dc7c 100644 --- a/tests/_/schemaQueryOnly/generated/modules/SelectionSets.ts +++ b/tests/_/schemas/query-only/graffle/modules/SelectionSets.ts @@ -1,5 +1,5 @@ -import type { SelectionSet as $SelectionSet } from '../../../../../src/entrypoints/schema.js' -import type * as $Utilities from '../../../../../src/entrypoints/utilities-for-generated.js' +import type { SelectionSet as $SelectionSet } from '../../../../../../src/entrypoints/schema.js' +import type * as $Utilities from '../../../../../../src/entrypoints/utilities-for-generated.js' // // diff --git a/tests/_/schemaQueryOnly/schema.graphql b/tests/_/schemas/query-only/schema.graphql similarity index 100% rename from tests/_/schemaQueryOnly/schema.graphql rename to tests/_/schemas/query-only/schema.graphql diff --git a/tests/_/schemaQueryOnly/schema.ts b/tests/_/schemas/query-only/schema.ts similarity index 72% rename from tests/_/schemaQueryOnly/schema.ts rename to tests/_/schemas/query-only/schema.ts index 039d6c75c..72cbd1858 100644 --- a/tests/_/schemaQueryOnly/schema.ts +++ b/tests/_/schemas/query-only/schema.ts @@ -13,6 +13,3 @@ builder.queryType({ export const schema = builder.toSchema({ sortSchema: true, }) - -export type { Index } from './generated/modules/SchemaIndex.js' -export { $Index } from './generated/modules/SchemaRuntime.js' diff --git a/tests/_/schemaUpload/schema.ts b/tests/_/schemas/upload/schema.ts similarity index 100% rename from tests/_/schemaUpload/schema.ts rename to tests/_/schemas/upload/schema.ts diff --git a/tests/_/services/pokemonManual.ts b/tests/_/services/pokemonManual.ts index 31ffcda0c..dda3d881f 100644 --- a/tests/_/services/pokemonManual.ts +++ b/tests/_/services/pokemonManual.ts @@ -1,4 +1,4 @@ -import { schema } from '../../../examples/$/schemas/pokemon/schema.js' import { serveSchema } from '../lib/serveSchema.js' +import { schema } from '../schemas/pokemon/schema.js' await serveSchema({ schema, log: true }) diff --git a/tests/_/services/pokemonVitest.ts b/tests/_/services/pokemonVitest.ts index 1f5082328..ac395ce23 100644 --- a/tests/_/services/pokemonVitest.ts +++ b/tests/_/services/pokemonVitest.ts @@ -1,6 +1,6 @@ import type { GlobalSetupContext } from 'vitest/node' -import { schema } from '../../../examples/$/schemas/pokemon/schema.js' import { serveSchema } from '../lib/serveSchema.js' +import { schema } from '../schemas/pokemon/schema.js' declare module 'vitest' { export interface ProvidedContext { diff --git a/website/content/_snippets/examples/extension/opentelemetry.detail.md b/website/content/_snippets/examples/extension/opentelemetry.detail.md index 88c9c2f49..624cf4149 100644 --- a/website/content/_snippets/examples/extension/opentelemetry.detail.md +++ b/website/content/_snippets/examples/extension/opentelemetry.detail.md @@ -8,7 +8,6 @@ import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base' import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node' import { Opentelemetry } from 'graffle/extensions' -// ---cut--- import { Pokemon } from './pokemon/__.js' // Setup Opentelemetry @@ -38,14 +37,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'encode', - id: '288e327eea7ce997', + id: 'b198600c41de0595', kind: 0, - timestamp: 1727408111781000, - duration: 539.958, + timestamp: 1727447640559000, + duration: 638.625, attributes: {}, status: { code: 0 }, events: [], @@ -65,14 +64,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'pack', - id: 'b1df38e68926a3a5', + id: '83bc7ce70496db8d', kind: 0, - timestamp: 1727408111783000, - duration: 10846, + timestamp: 1727447640562000, + duration: 11628.625, attributes: {}, status: { code: 0 }, events: [], @@ -92,14 +91,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'exchange', - id: '85f8c97a5cdf40a0', + id: 'd80122be49daa52a', kind: 0, - timestamp: 1727408111794000, - duration: 27046.959, + timestamp: 1727447640574000, + duration: 20500.166, attributes: {}, status: { code: 0 }, events: [], @@ -119,14 +118,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'unpack', - id: '8fbff8ada118f8e4', + id: '0f3bf53d3bb99cfa', kind: 0, - timestamp: 1727408111822000, - duration: 1130.334, + timestamp: 1727447640594000, + duration: 1112.417, attributes: {}, status: { code: 0 }, events: [], @@ -146,14 +145,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'decode', - id: '3c8f702427e6a774', + id: 'cfbb77f628c19bb9', kind: 0, - timestamp: 1727408111823000, - duration: 194.166, + timestamp: 1727447640596000, + duration: 184.583, attributes: {}, status: { code: 0 }, events: [], @@ -173,14 +172,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', parentId: undefined, traceState: undefined, name: 'request', - id: '2e4746bd4a491302', + id: '235586747a904981', kind: 0, - timestamp: 1727408111780000, - duration: 43205.584, + timestamp: 1727447640558000, + duration: 37586.041, attributes: {}, status: { code: 0 }, events: [], diff --git a/website/content/_snippets/examples/extension/opentelemetry.md b/website/content/_snippets/examples/extension/opentelemetry.md index ebf24b157..25df187bb 100644 --- a/website/content/_snippets/examples/extension/opentelemetry.md +++ b/website/content/_snippets/examples/extension/opentelemetry.md @@ -6,7 +6,6 @@ import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base' import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node' import { Opentelemetry } from 'graffle/extensions' -// ---cut--- import { Pokemon } from './pokemon/__.js' // Setup Opentelemetry @@ -36,14 +35,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'encode', - id: '288e327eea7ce997', + id: 'b198600c41de0595', kind: 0, - timestamp: 1727408111781000, - duration: 539.958, + timestamp: 1727447640559000, + duration: 638.625, attributes: {}, status: { code: 0 }, events: [], @@ -63,14 +62,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'pack', - id: 'b1df38e68926a3a5', + id: '83bc7ce70496db8d', kind: 0, - timestamp: 1727408111783000, - duration: 10846, + timestamp: 1727447640562000, + duration: 11628.625, attributes: {}, status: { code: 0 }, events: [], @@ -90,14 +89,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'exchange', - id: '85f8c97a5cdf40a0', + id: 'd80122be49daa52a', kind: 0, - timestamp: 1727408111794000, - duration: 27046.959, + timestamp: 1727447640574000, + duration: 20500.166, attributes: {}, status: { code: 0 }, events: [], @@ -117,14 +116,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'unpack', - id: '8fbff8ada118f8e4', + id: '0f3bf53d3bb99cfa', kind: 0, - timestamp: 1727408111822000, - duration: 1130.334, + timestamp: 1727447640594000, + duration: 1112.417, attributes: {}, status: { code: 0 }, events: [], @@ -144,14 +143,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'decode', - id: '3c8f702427e6a774', + id: 'cfbb77f628c19bb9', kind: 0, - timestamp: 1727408111823000, - duration: 194.166, + timestamp: 1727447640596000, + duration: 184.583, attributes: {}, status: { code: 0 }, events: [], @@ -171,14 +170,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', parentId: undefined, traceState: undefined, name: 'request', - id: '2e4746bd4a491302', + id: '235586747a904981', kind: 0, - timestamp: 1727408111780000, - duration: 43205.584, + timestamp: 1727447640558000, + duration: 37586.041, attributes: {}, status: { code: 0 }, events: [], diff --git a/website/content/_snippets/examples/extension/throws.detail.md b/website/content/_snippets/examples/extension/throws.detail.md index 03b3f75cd..ba76ff3a2 100644 --- a/website/content/_snippets/examples/extension/throws.detail.md +++ b/website/content/_snippets/examples/extension/throws.detail.md @@ -6,7 +6,6 @@ ```ts twoslash import { Throws } from 'graffle/extensions' -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/_snippets/examples/extension/throws.md b/website/content/_snippets/examples/extension/throws.md index 15973250a..135eb8a14 100644 --- a/website/content/_snippets/examples/extension/throws.md +++ b/website/content/_snippets/examples/extension/throws.md @@ -4,7 +4,6 @@ ```ts twoslash import { Throws } from 'graffle/extensions' -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/_snippets/examples/generated/alias.detail.md b/website/content/_snippets/examples/generated/alias.detail.md index e34fa64de..37092bcc9 100644 --- a/website/content/_snippets/examples/generated/alias.detail.md +++ b/website/content/_snippets/examples/generated/alias.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/alias.md b/website/content/_snippets/examples/generated/alias.md index 9dbeb0a50..00f473d64 100644 --- a/website/content/_snippets/examples/generated/alias.md +++ b/website/content/_snippets/examples/generated/alias.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/arguments.detail.md b/website/content/_snippets/examples/generated/arguments.detail.md index 9386a74ad..a04d80a0a 100644 --- a/website/content/_snippets/examples/generated/arguments.detail.md +++ b/website/content/_snippets/examples/generated/arguments.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const atlas = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/arguments.md b/website/content/_snippets/examples/generated/arguments.md index 239dd3a1e..731d46eb1 100644 --- a/website/content/_snippets/examples/generated/arguments.md +++ b/website/content/_snippets/examples/generated/arguments.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const atlas = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/batch.detail.md b/website/content/_snippets/examples/generated/batch.detail.md index 8dd8709e3..d73d57697 100644 --- a/website/content/_snippets/examples/generated/batch.detail.md +++ b/website/content/_snippets/examples/generated/batch.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/batch.md b/website/content/_snippets/examples/generated/batch.md index 78c798349..fd656a04e 100644 --- a/website/content/_snippets/examples/generated/batch.md +++ b/website/content/_snippets/examples/generated/batch.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/directive.detail.md b/website/content/_snippets/examples/generated/directive.detail.md index f188a7b75..741db90b0 100644 --- a/website/content/_snippets/examples/generated/directive.detail.md +++ b/website/content/_snippets/examples/generated/directive.detail.md @@ -6,7 +6,6 @@ ```ts twoslash // import { parse, print } from 'graphql' -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/directive.md b/website/content/_snippets/examples/generated/directive.md index 312e827d5..a70de6ff1 100644 --- a/website/content/_snippets/examples/generated/directive.md +++ b/website/content/_snippets/examples/generated/directive.md @@ -4,7 +4,6 @@ ```ts twoslash // import { parse, print } from 'graphql' -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/document.detail.md b/website/content/_snippets/examples/generated/document.detail.md index 86eade795..86eaa0508 100644 --- a/website/content/_snippets/examples/generated/document.detail.md +++ b/website/content/_snippets/examples/generated/document.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/document.md b/website/content/_snippets/examples/generated/document.md index 29439abb2..dba0c39c2 100644 --- a/website/content/_snippets/examples/generated/document.md +++ b/website/content/_snippets/examples/generated/document.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/interface.detail.md b/website/content/_snippets/examples/generated/interface.detail.md index 1f390523c..5ce90945a 100644 --- a/website/content/_snippets/examples/generated/interface.detail.md +++ b/website/content/_snippets/examples/generated/interface.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/interface.md b/website/content/_snippets/examples/generated/interface.md index 188380991..34fb6e32c 100644 --- a/website/content/_snippets/examples/generated/interface.md +++ b/website/content/_snippets/examples/generated/interface.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/root-field.detail.md b/website/content/_snippets/examples/generated/root-field.detail.md index fd26c32f9..cfe20d92c 100644 --- a/website/content/_snippets/examples/generated/root-field.detail.md +++ b/website/content/_snippets/examples/generated/root-field.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/generated/root-field.md b/website/content/_snippets/examples/generated/root-field.md index ed4d1b2ea..e20c395bd 100644 --- a/website/content/_snippets/examples/generated/root-field.md +++ b/website/content/_snippets/examples/generated/root-field.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/output/default.detail.md b/website/content/_snippets/examples/output/default.detail.md index d1012f066..e84f11b9f 100644 --- a/website/content/_snippets/examples/output/default.detail.md +++ b/website/content/_snippets/examples/output/default.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/output/default.md b/website/content/_snippets/examples/output/default.md index b04bb6ebd..0b696be0b 100644 --- a/website/content/_snippets/examples/output/default.md +++ b/website/content/_snippets/examples/output/default.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/_snippets/examples/output/envelope-error-throw.detail.md b/website/content/_snippets/examples/output/envelope-error-throw.detail.md index c6e354c42..1b84767fe 100644 --- a/website/content/_snippets/examples/output/envelope-error-throw.detail.md +++ b/website/content/_snippets/examples/output/envelope-error-throw.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/_snippets/examples/output/envelope-error-throw.md b/website/content/_snippets/examples/output/envelope-error-throw.md index c5d726b07..4db2494de 100644 --- a/website/content/_snippets/examples/output/envelope-error-throw.md +++ b/website/content/_snippets/examples/output/envelope-error-throw.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/_snippets/examples/output/envelope-error.detail.md b/website/content/_snippets/examples/output/envelope-error.detail.md index b498f7e60..96af4f9a5 100644 --- a/website/content/_snippets/examples/output/envelope-error.detail.md +++ b/website/content/_snippets/examples/output/envelope-error.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/_snippets/examples/output/envelope-error.md b/website/content/_snippets/examples/output/envelope-error.md index 0af8a680d..cf74b2655 100644 --- a/website/content/_snippets/examples/output/envelope-error.md +++ b/website/content/_snippets/examples/output/envelope-error.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/_snippets/examples/output/envelope.detail.md b/website/content/_snippets/examples/output/envelope.detail.md index 4da403854..a22efbb9d 100644 --- a/website/content/_snippets/examples/output/envelope.detail.md +++ b/website/content/_snippets/examples/output/envelope.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create({ @@ -39,7 +38,7 @@ console.log(result) headers: Headers { 'content-type': 'application/graphql-response+json; charset=utf-8', 'content-length': '104', - date: 'Fri, 27 Sep 2024 03:35:11 GMT', + date: 'Fri, 27 Sep 2024 14:34:00 GMT', connection: 'keep-alive', 'keep-alive': 'timeout=5' }, diff --git a/website/content/_snippets/examples/output/envelope.md b/website/content/_snippets/examples/output/envelope.md index 1f569defd..90e4eef60 100644 --- a/website/content/_snippets/examples/output/envelope.md +++ b/website/content/_snippets/examples/output/envelope.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create({ @@ -37,7 +36,7 @@ console.log(result) headers: Headers { 'content-type': 'application/graphql-response+json; charset=utf-8', 'content-length': '104', - date: 'Fri, 27 Sep 2024 03:35:11 GMT', + date: 'Fri, 27 Sep 2024 14:34:00 GMT', connection: 'keep-alive', 'keep-alive': 'timeout=5' }, diff --git a/website/content/_snippets/examples/output/return-error-execution.detail.md b/website/content/_snippets/examples/output/return-error-execution.detail.md index 5d948a734..b6f4958d4 100644 --- a/website/content/_snippets/examples/output/return-error-execution.detail.md +++ b/website/content/_snippets/examples/output/return-error-execution.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/_snippets/examples/output/return-error-execution.md b/website/content/_snippets/examples/output/return-error-execution.md index 486e5e845..3eb6d9ffc 100644 --- a/website/content/_snippets/examples/output/return-error-execution.md +++ b/website/content/_snippets/examples/output/return-error-execution.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/_snippets/examples/output/return-error.detail.md b/website/content/_snippets/examples/output/return-error.detail.md index c233dea64..99c1d334e 100644 --- a/website/content/_snippets/examples/output/return-error.detail.md +++ b/website/content/_snippets/examples/output/return-error.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/_snippets/examples/output/return-error.md b/website/content/_snippets/examples/output/return-error.md index 15c222168..fb46cbf74 100644 --- a/website/content/_snippets/examples/output/return-error.md +++ b/website/content/_snippets/examples/output/return-error.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/_snippets/examples/transport-http/dynamic-headers.detail.md b/website/content/_snippets/examples/transport-http/dynamic-headers.detail.md index 347e45be4..2d3c54ea7 100644 --- a/website/content/_snippets/examples/transport-http/dynamic-headers.detail.md +++ b/website/content/_snippets/examples/transport-http/dynamic-headers.detail.md @@ -38,7 +38,7 @@ await graffle.rawString({ document: `{ pokemons { name } }` }) headers: Headers { accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8', 'content-type': 'application/json', - 'x-sent-at-time': '1727408110664' + 'x-sent-at-time': '1727447640287' }, signal: undefined, method: 'post', diff --git a/website/content/_snippets/examples/transport-http/dynamic-headers.md b/website/content/_snippets/examples/transport-http/dynamic-headers.md index 0b80a18d5..90f2eae07 100644 --- a/website/content/_snippets/examples/transport-http/dynamic-headers.md +++ b/website/content/_snippets/examples/transport-http/dynamic-headers.md @@ -36,7 +36,7 @@ await graffle.rawString({ document: `{ pokemons { name } }` }) headers: Headers { accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8', 'content-type': 'application/json', - 'x-sent-at-time': '1727408110664' + 'x-sent-at-time': '1727447640287' }, signal: undefined, method: 'post', diff --git a/website/content/_snippets/examples/transport-http/method-get.detail.md b/website/content/_snippets/examples/transport-http/method-get.detail.md index 9ef6fb3e0..357d936f6 100644 --- a/website/content/_snippets/examples/transport-http/method-get.detail.md +++ b/website/content/_snippets/examples/transport-http/method-get.detail.md @@ -5,7 +5,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const graffle = Pokemon diff --git a/website/content/_snippets/examples/transport-http/method-get.md b/website/content/_snippets/examples/transport-http/method-get.md index 9cf0b3959..0ea651a70 100644 --- a/website/content/_snippets/examples/transport-http/method-get.md +++ b/website/content/_snippets/examples/transport-http/method-get.md @@ -3,7 +3,6 @@ ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const graffle = Pokemon diff --git a/website/content/_snippets/schema.graphql b/website/content/_snippets/schema.graphql new file mode 100644 index 000000000..27a2ead99 --- /dev/null +++ b/website/content/_snippets/schema.graphql @@ -0,0 +1,80 @@ +interface Being { + id: Int + name: String +} + +input DateFilter { + gte: Float + lte: Float +} + +type Mutation { + addPokemon(attack: Int, defense: Int, hp: Int, name: String!, type: PokemonType!): Pokemon +} + +type Patron implements Being { + id: Int + money: Int + name: String +} + +type Pokemon implements Being { + attack: Int + birthday: Int + defense: Int + hp: Int + id: Int + name: String + trainer: Trainer + type: PokemonType +} + +input PokemonFilter { + birthday: DateFilter + name: StringFilter +} + +enum PokemonType { + electric + fire + grass + water +} + +type Query { + beings: [Being!]! + pokemon: [Pokemon!] + pokemonByName(name: String!): [Pokemon!] + pokemons(filter: PokemonFilter): [Pokemon!] + trainerByName(name: String!): Trainer + trainers: [Trainer!] +} + +input StringFilter { + contains: String + in: [String!] +} + +type Trainer implements Being { + class: TrainerClass + fans: [Patron!] + id: Int + name: String + pokemon: [Pokemon!] +} + +enum TrainerClass { + bugCatcher + camper + picnicker + psychic + psychicMedium + psychicYoungster + sailor + superNerd + tamer + teamRocketGrunt + triathlete + youngster + youth +} \ No newline at end of file diff --git a/website/content/examples/10_transport-http/dynamic-headers.md b/website/content/examples/10_transport-http/dynamic-headers.md index 73d038d11..e47c52e0f 100644 --- a/website/content/examples/10_transport-http/dynamic-headers.md +++ b/website/content/examples/10_transport-http/dynamic-headers.md @@ -43,7 +43,7 @@ await graffle.rawString({ document: `{ pokemons { name } }` }) headers: Headers { accept: 'application/graphql-response+json; charset=utf-8, application/json; charset=utf-8', 'content-type': 'application/json', - 'x-sent-at-time': '1727408110664' + 'x-sent-at-time': '1727447640287' }, signal: undefined, method: 'post', diff --git a/website/content/examples/10_transport-http/method-get.md b/website/content/examples/10_transport-http/method-get.md index 7831cd96f..1676c2ac4 100644 --- a/website/content/examples/10_transport-http/method-get.md +++ b/website/content/examples/10_transport-http/method-get.md @@ -9,7 +9,6 @@ to be sent over HTTP GET method. Note write-kind operations (mutation) are still ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const graffle = Pokemon diff --git a/website/content/examples/20_output/default.md b/website/content/examples/20_output/default.md index 3c8173e84..36717b56c 100644 --- a/website/content/examples/20_output/default.md +++ b/website/content/examples/20_output/default.md @@ -8,7 +8,6 @@ This example shows the default output behavior. ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/examples/20_output/envelope-error-throw.md b/website/content/examples/20_output/envelope-error-throw.md index 96d22a962..416cde31a 100644 --- a/website/content/examples/20_output/envelope-error-throw.md +++ b/website/content/examples/20_output/envelope-error-throw.md @@ -8,7 +8,6 @@ This example shows how to configure output to throw errors even when using the e ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/examples/20_output/envelope-error.md b/website/content/examples/20_output/envelope-error.md index bbe8bb10c..b7b46e83b 100644 --- a/website/content/examples/20_output/envelope-error.md +++ b/website/content/examples/20_output/envelope-error.md @@ -8,7 +8,6 @@ This example shows how to configure output to embed errors into the envelope. ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/examples/20_output/envelope.md b/website/content/examples/20_output/envelope.md index a8b6da71a..f89c7d8d5 100644 --- a/website/content/examples/20_output/envelope.md +++ b/website/content/examples/20_output/envelope.md @@ -8,7 +8,6 @@ This example shows how to configure output to use the envelope. ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create({ @@ -44,7 +43,7 @@ console.log(result) headers: Headers { 'content-type': 'application/graphql-response+json; charset=utf-8', 'content-length': '104', - date: 'Fri, 27 Sep 2024 03:35:11 GMT', + date: 'Fri, 27 Sep 2024 14:34:00 GMT', connection: 'keep-alive', 'keep-alive': 'timeout=5' }, diff --git a/website/content/examples/20_output/return-error-execution.md b/website/content/examples/20_output/return-error-execution.md index 113aeeebb..cd55b1689 100644 --- a/website/content/examples/20_output/return-error-execution.md +++ b/website/content/examples/20_output/return-error-execution.md @@ -8,7 +8,6 @@ This example shows how to configure output to have only certain kinds of errors ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/examples/20_output/return-error.md b/website/content/examples/20_output/return-error.md index 397f54f5b..5354bffcf 100644 --- a/website/content/examples/20_output/return-error.md +++ b/website/content/examples/20_output/return-error.md @@ -8,7 +8,6 @@ This example shows how to configure output to have errors returned instead of e. ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/content/examples/55_generated/alias.md b/website/content/examples/55_generated/alias.md index 7edd7a36e..67f348707 100644 --- a/website/content/examples/55_generated/alias.md +++ b/website/content/examples/55_generated/alias.md @@ -8,7 +8,6 @@ This example shows how to write GraphQL aliases in the TypeScript interface. ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/examples/55_generated/arguments.md b/website/content/examples/55_generated/arguments.md index 3408f8c96..d563090e7 100644 --- a/website/content/examples/55_generated/arguments.md +++ b/website/content/examples/55_generated/arguments.md @@ -8,7 +8,6 @@ This example shows how to write field arguments in TypeScript interface. ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const atlas = Pokemon.create() diff --git a/website/content/examples/55_generated/batch.md b/website/content/examples/55_generated/batch.md index d28847016..f7fee9857 100644 --- a/website/content/examples/55_generated/batch.md +++ b/website/content/examples/55_generated/batch.md @@ -8,7 +8,6 @@ This example shows how to write batches of GraphQL root fields (aka. entrypoints ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/examples/55_generated/directive.md b/website/content/examples/55_generated/directive.md index 28556cd9a..483442313 100644 --- a/website/content/examples/55_generated/directive.md +++ b/website/content/examples/55_generated/directive.md @@ -9,7 +9,6 @@ This example shows how to use special fields to write GraphQL document directive ```ts twoslash // import { parse, print } from 'graphql' -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/examples/55_generated/document.md b/website/content/examples/55_generated/document.md index 004407fd8..41e63a30a 100644 --- a/website/content/examples/55_generated/document.md +++ b/website/content/examples/55_generated/document.md @@ -8,7 +8,6 @@ This example shows how to write whole GraphQL documents in the TypeScript interf ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/examples/55_generated/interface.md b/website/content/examples/55_generated/interface.md index d77f6eb99..2bd260b8d 100644 --- a/website/content/examples/55_generated/interface.md +++ b/website/content/examples/55_generated/interface.md @@ -8,7 +8,6 @@ This example shows how to work with interface types. ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/examples/55_generated/root-field.md b/website/content/examples/55_generated/root-field.md index 5ed8f0dca..85901ec19 100644 --- a/website/content/examples/55_generated/root-field.md +++ b/website/content/examples/55_generated/root-field.md @@ -8,7 +8,6 @@ This example shows how to use dedicated root field methods to easily operate on ```ts twoslash -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon.create() diff --git a/website/content/examples/60_extension/opentelemetry.md b/website/content/examples/60_extension/opentelemetry.md index a1340d1ab..3c4c15694 100644 --- a/website/content/examples/60_extension/opentelemetry.md +++ b/website/content/examples/60_extension/opentelemetry.md @@ -9,7 +9,6 @@ aside: false import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base' import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node' import { Opentelemetry } from 'graffle/extensions' -// ---cut--- import { Pokemon } from './pokemon/__.js' // Setup Opentelemetry @@ -41,14 +40,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'encode', - id: '288e327eea7ce997', + id: 'b198600c41de0595', kind: 0, - timestamp: 1727408111781000, - duration: 539.958, + timestamp: 1727447640559000, + duration: 638.625, attributes: {}, status: { code: 0 }, events: [], @@ -68,14 +67,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'pack', - id: 'b1df38e68926a3a5', + id: '83bc7ce70496db8d', kind: 0, - timestamp: 1727408111783000, - duration: 10846, + timestamp: 1727447640562000, + duration: 11628.625, attributes: {}, status: { code: 0 }, events: [], @@ -95,14 +94,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'exchange', - id: '85f8c97a5cdf40a0', + id: 'd80122be49daa52a', kind: 0, - timestamp: 1727408111794000, - duration: 27046.959, + timestamp: 1727447640574000, + duration: 20500.166, attributes: {}, status: { code: 0 }, events: [], @@ -122,14 +121,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'unpack', - id: '8fbff8ada118f8e4', + id: '0f3bf53d3bb99cfa', kind: 0, - timestamp: 1727408111822000, - duration: 1130.334, + timestamp: 1727447640594000, + duration: 1112.417, attributes: {}, status: { code: 0 }, events: [], @@ -149,14 +148,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', - parentId: '2e4746bd4a491302', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', + parentId: '235586747a904981', traceState: undefined, name: 'decode', - id: '3c8f702427e6a774', + id: 'cfbb77f628c19bb9', kind: 0, - timestamp: 1727408111823000, - duration: 194.166, + timestamp: 1727447640596000, + duration: 184.583, attributes: {}, status: { code: 0 }, events: [], @@ -176,14 +175,14 @@ console.log(data) } }, instrumentationScope: { name: 'graffle', version: undefined, schemaUrl: undefined }, - traceId: '955a83e23fd481c11e99476809785250', + traceId: '9039f59347f6f75a8d39d0b53a9995e0', parentId: undefined, traceState: undefined, name: 'request', - id: '2e4746bd4a491302', + id: '235586747a904981', kind: 0, - timestamp: 1727408111780000, - duration: 43205.584, + timestamp: 1727447640558000, + duration: 37586.041, attributes: {}, status: { code: 0 }, events: [], diff --git a/website/content/examples/60_extension/throws.md b/website/content/examples/60_extension/throws.md index 5fd1f51d5..5ffd9e41a 100644 --- a/website/content/examples/60_extension/throws.md +++ b/website/content/examples/60_extension/throws.md @@ -9,7 +9,6 @@ This example shows how to use the Or Throw extension to throw errors for one-off ```ts twoslash import { Throws } from 'graffle/extensions' -// ---cut--- import { Pokemon } from './pokemon/__.js' const pokemon = Pokemon diff --git a/website/package.json b/website/package.json index 1d48a35d1..36a90a716 100644 --- a/website/package.json +++ b/website/package.json @@ -4,7 +4,7 @@ "dev": "vitepress dev", "build": "vitepress build", "preview": "vitepress preview", - "gen:graffle": "graffle --schema https://countries.trevorblades.com/graphql && graffle --defaultSchemaUrl http://localhost:3000/graphql --schema ../examples/$/schemas/pokemon/schema.graphql --name Pokemon --output ./pokemon" + "gen:graffle": "graffle --schema https://countries.trevorblades.com/graphql && graffle --defaultSchemaUrl http://localhost:3000/graphql --schema ../tests/_/schemas/pokemon/schema.graphql --name Pokemon --output ./pokemon" }, "devDependencies": { "vitepress": "^1.3.4"