From 849dc394faa5a19e969b412ed7c91c29c89c4600 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Sat, 27 Apr 2024 16:52:04 -0400 Subject: [PATCH 1/2] refactor: organize dirs by layer --- src/cli/generate.ts | 2 +- src/entrypoints/alpha/client.ts | 4 ++-- src/entrypoints/alpha/scalars.ts | 2 +- src/entrypoints/alpha/schema.ts | 6 ++--- src/entrypoints/main.ts | 22 +++++++++---------- src/{Schema => layers/1_Schema}/Args.ts | 0 src/{Schema => layers/1_Schema}/Field.ts | 0 src/{Schema => layers/1_Schema}/Hybrid/_.ts | 0 src/{Schema => layers/1_Schema}/Hybrid/__.ts | 0 .../1_Schema}/Hybrid/types/Enum.ts | 0 .../1_Schema}/Hybrid/types/Scalar/Scalar.ts | 0 .../1_Schema}/Hybrid/types/Scalar/__.ts | 0 .../1_Schema}/Hybrid/types/Scalar/codec.ts | 0 .../Hybrid/types/Scalar/nativeScalarCodecs.ts | 0 .../1_Schema}/Input/Input.ts | 0 src/{Schema => layers/1_Schema}/Input/__.ts | 0 .../1_Schema}/Input/typeGroups.ts | 0 .../1_Schema}/Input/types/InputObject.ts | 0 .../1_Schema}/Input/types/List.ts | 0 .../1_Schema}/Input/types/Nullable.ts | 0 .../1_Schema}/Output/Output.ts | 2 +- src/{Schema => layers/1_Schema}/Output/__.ts | 0 .../1_Schema}/Output/typeGroups.ts | 0 .../1_Schema}/Output/types/Interface.ts | 0 .../1_Schema}/Output/types/List.ts | 0 .../1_Schema}/Output/types/Nullable.ts | 0 .../1_Schema}/Output/types/Object.ts | 0 .../1_Schema}/Output/types/Union.ts | 0 .../1_Schema}/Output/types/__typename.ts | 0 src/{Schema => layers/1_Schema}/_.ts | 0 src/{Schema => layers/1_Schema}/__.ts | 0 src/{Schema => layers/1_Schema}/core/Index.ts | 2 +- .../1_Schema}/core/Named/NamedType.test-d.ts | 0 .../1_Schema}/core/Named/NamedType.ts | 2 +- .../1_Schema}/core/Named/_.ts | 0 .../1_Schema}/core/Named/__.ts | 0 .../1_Schema}/core/helpers.ts | 0 .../__snapshots__/files.test.ts.snap | 2 +- .../__snapshots__/generator.test.ts.snap | 0 .../2_generator}/code/Error.ts | 0 .../2_generator}/code/Index.ts | 4 ++-- .../2_generator}/code/Scalar.ts | 0 .../2_generator}/code/SchemaBuildtime.ts | 8 +++---- .../2_generator}/code/SchemaRuntime.ts | 4 ++-- .../2_generator}/code/Select.ts | 0 .../2_generator}/code/generateCode.ts | 4 ++-- .../2_generator}/code/global.ts | 0 .../2_generator}/files.test.ts | 0 .../2_generator}/files.ts | 2 +- .../2_generator}/globalRegistry.ts | 4 ++-- .../3_IO}/ResultSet/ResultSet.test-d.ts | 4 ++-- .../3_IO}/ResultSet/ResultSet.ts | 8 +++---- src/{client => layers/3_IO}/ResultSet/__.ts | 0 .../3_IO}/SelectionSet/SelectionSet.test-d.ts | 2 +- .../3_IO}/SelectionSet/SelectionSet.ts | 6 ++--- src/{client => layers/3_IO}/SelectionSet/_.ts | 0 .../3_IO}/SelectionSet/__.ts | 0 .../toGraphQLDocumentString.test.ts.snap | 0 .../toGraphQLDocumentString.test.ts | 4 ++-- .../SelectionSet/toGraphQLDocumentString.ts | 10 ++++----- src/{client => layers/4_client}/Config.ts | 8 +++---- .../4_client}/RootTypeMethods.ts | 12 +++++----- .../4_client}/client.customScalar.test.ts | 6 ++--- .../4_client}/client.document.test-d.ts | 6 ++--- .../4_client}/client.document.test.ts | 6 ++--- .../4_client}/client.error.test-d.ts | 4 ++-- .../4_client}/client.input.test-d.ts | 4 ++-- .../4_client}/client.returnMode.test-d.ts | 6 ++--- .../4_client}/client.returnMode.test.ts | 8 +++---- .../client.rootTypeMethods.test-d.ts | 4 ++-- .../4_client}/client.rootTypeMethods.test.ts | 4 ++-- src/{client => layers/4_client}/client.ts | 20 ++++++++--------- .../4_client}/customScalars.ts | 16 +++++++------- src/{client => layers/4_client}/document.ts | 12 +++++----- src/{ => layers/4_select}/select.test-d.ts | 6 ++--- src/{ => layers/4_select}/select.test.ts | 2 +- src/{ => layers/4_select}/select.ts | 8 +++---- src/{raw => legacy}/classes/ClientError.ts | 0 src/{raw => legacy}/classes/GraphQLClient.ts | 0 .../functions/batchRequests.ts | 0 src/{raw => legacy}/functions/gql.ts | 0 src/{raw => legacy}/functions/rawRequest.ts | 0 src/{raw => legacy}/functions/request.ts | 0 .../helpers/analyzeDocument.ts | 0 .../helpers/defaultJsonSerializer.ts | 0 src/{raw => legacy}/helpers/runRequest.ts | 0 src/{raw => legacy}/helpers/types.ts | 0 src/{raw => legacy}/lib/graphql.ts | 0 tests/_/customScalarCodecs.ts | 4 ++-- tests/_/schema/generated/Scalar.ts | 2 +- tests/_/schemaGenerate.ts | 4 ++-- .../_/schemaMutationOnly/generated/Scalar.ts | 2 +- tests/_/schemaQueryOnly/generated/Scalar.ts | 2 +- tests/{raw => legacy}/__helpers.ts | 0 .../__snapshots__/document-node.test.ts.snap | 0 .../__snapshots__/gql.test.ts.snap | 0 tests/{raw => legacy}/batching.test.ts | 0 tests/{raw => legacy}/custom-fetch.test.ts | 0 tests/{raw => legacy}/document-node.test.ts | 0 tests/{raw => legacy}/endpoint.test.ts | 0 tests/{raw => legacy}/errorPolicy.test.ts | 0 tests/{raw => legacy}/fetch.test.ts | 0 tests/{raw => legacy}/general.test.ts | 0 tests/{raw => legacy}/gql.test.ts | 0 tests/{raw => legacy}/headers.test.ts | 0 tests/{raw => legacy}/httpMethod.test.ts | 2 +- tests/{raw => legacy}/json-serializer.test.ts | 2 +- tests/{raw => legacy}/signal.test.ts | 0 .../typed-document-node.test.ts | 0 109 files changed, 127 insertions(+), 127 deletions(-) rename src/{Schema => layers/1_Schema}/Args.ts (100%) rename src/{Schema => layers/1_Schema}/Field.ts (100%) rename src/{Schema => layers/1_Schema}/Hybrid/_.ts (100%) rename src/{Schema => layers/1_Schema}/Hybrid/__.ts (100%) rename src/{Schema => layers/1_Schema}/Hybrid/types/Enum.ts (100%) rename src/{Schema => layers/1_Schema}/Hybrid/types/Scalar/Scalar.ts (100%) rename src/{Schema => layers/1_Schema}/Hybrid/types/Scalar/__.ts (100%) rename src/{Schema => layers/1_Schema}/Hybrid/types/Scalar/codec.ts (100%) rename src/{Schema => layers/1_Schema}/Hybrid/types/Scalar/nativeScalarCodecs.ts (100%) rename src/{Schema => layers/1_Schema}/Input/Input.ts (100%) rename src/{Schema => layers/1_Schema}/Input/__.ts (100%) rename src/{Schema => layers/1_Schema}/Input/typeGroups.ts (100%) rename src/{Schema => layers/1_Schema}/Input/types/InputObject.ts (100%) rename src/{Schema => layers/1_Schema}/Input/types/List.ts (100%) rename src/{Schema => layers/1_Schema}/Input/types/Nullable.ts (100%) rename src/{Schema => layers/1_Schema}/Output/Output.ts (96%) rename src/{Schema => layers/1_Schema}/Output/__.ts (100%) rename src/{Schema => layers/1_Schema}/Output/typeGroups.ts (100%) rename src/{Schema => layers/1_Schema}/Output/types/Interface.ts (100%) rename src/{Schema => layers/1_Schema}/Output/types/List.ts (100%) rename src/{Schema => layers/1_Schema}/Output/types/Nullable.ts (100%) rename src/{Schema => layers/1_Schema}/Output/types/Object.ts (100%) rename src/{Schema => layers/1_Schema}/Output/types/Union.ts (100%) rename src/{Schema => layers/1_Schema}/Output/types/__typename.ts (100%) rename src/{Schema => layers/1_Schema}/_.ts (100%) rename src/{Schema => layers/1_Schema}/__.ts (100%) rename src/{Schema => layers/1_Schema}/core/Index.ts (89%) rename src/{Schema => layers/1_Schema}/core/Named/NamedType.test-d.ts (100%) rename src/{Schema => layers/1_Schema}/core/Named/NamedType.ts (92%) rename src/{Schema => layers/1_Schema}/core/Named/_.ts (100%) rename src/{Schema => layers/1_Schema}/core/Named/__.ts (100%) rename src/{Schema => layers/1_Schema}/core/helpers.ts (100%) rename src/{generator => layers/2_generator}/__snapshots__/files.test.ts.snap (99%) rename src/{generator => layers/2_generator}/__snapshots__/generator.test.ts.snap (100%) rename src/{generator => layers/2_generator}/code/Error.ts (100%) rename src/{generator => layers/2_generator}/code/Index.ts (97%) rename src/{generator => layers/2_generator}/code/Scalar.ts (100%) rename src/{generator => layers/2_generator}/code/SchemaBuildtime.ts (98%) rename src/{generator => layers/2_generator}/code/SchemaRuntime.ts (98%) rename src/{generator => layers/2_generator}/code/Select.ts (100%) rename src/{generator => layers/2_generator}/code/generateCode.ts (96%) rename src/{generator => layers/2_generator}/code/global.ts (100%) rename src/{generator => layers/2_generator}/files.test.ts (100%) rename src/{generator => layers/2_generator}/files.ts (97%) rename src/{ => layers/2_generator}/globalRegistry.ts (92%) rename src/{client => layers/3_IO}/ResultSet/ResultSet.test-d.ts (98%) rename src/{client => layers/3_IO}/ResultSet/ResultSet.ts (95%) rename src/{client => layers/3_IO}/ResultSet/__.ts (100%) rename src/{client => layers/3_IO}/SelectionSet/SelectionSet.test-d.ts (99%) rename src/{client => layers/3_IO}/SelectionSet/SelectionSet.ts (98%) rename src/{client => layers/3_IO}/SelectionSet/_.ts (100%) rename src/{client => layers/3_IO}/SelectionSet/__.ts (100%) rename src/{client => layers/3_IO}/SelectionSet/__snapshots__/toGraphQLDocumentString.test.ts.snap (100%) rename src/{client => layers/3_IO}/SelectionSet/toGraphQLDocumentString.test.ts (96%) rename src/{client => layers/3_IO}/SelectionSet/toGraphQLDocumentString.ts (97%) rename src/{client => layers/4_client}/Config.ts (93%) rename src/{client => layers/4_client}/RootTypeMethods.ts (92%) rename src/{client => layers/4_client}/client.customScalar.test.ts (96%) rename src/{client => layers/4_client}/client.document.test-d.ts (91%) rename src/{client => layers/4_client}/client.document.test.ts (93%) rename src/{client => layers/4_client}/client.error.test-d.ts (81%) rename src/{client => layers/4_client}/client.input.test-d.ts (88%) rename src/{client => layers/4_client}/client.returnMode.test-d.ts (97%) rename src/{client => layers/4_client}/client.returnMode.test.ts (97%) rename src/{client => layers/4_client}/client.rootTypeMethods.test-d.ts (93%) rename src/{client => layers/4_client}/client.rootTypeMethods.test.ts (96%) rename src/{client => layers/4_client}/client.ts (95%) rename src/{client => layers/4_client}/customScalars.ts (92%) rename src/{client => layers/4_client}/document.ts (92%) rename src/{ => layers/4_select}/select.test-d.ts (81%) rename src/{ => layers/4_select}/select.test.ts (86%) rename src/{ => layers/4_select}/select.ts (85%) rename src/{raw => legacy}/classes/ClientError.ts (100%) rename src/{raw => legacy}/classes/GraphQLClient.ts (100%) rename src/{raw => legacy}/functions/batchRequests.ts (100%) rename src/{raw => legacy}/functions/gql.ts (100%) rename src/{raw => legacy}/functions/rawRequest.ts (100%) rename src/{raw => legacy}/functions/request.ts (100%) rename src/{raw => legacy}/helpers/analyzeDocument.ts (100%) rename src/{raw => legacy}/helpers/defaultJsonSerializer.ts (100%) rename src/{raw => legacy}/helpers/runRequest.ts (100%) rename src/{raw => legacy}/helpers/types.ts (100%) rename src/{raw => legacy}/lib/graphql.ts (100%) rename tests/{raw => legacy}/__helpers.ts (100%) rename tests/{raw => legacy}/__snapshots__/document-node.test.ts.snap (100%) rename tests/{raw => legacy}/__snapshots__/gql.test.ts.snap (100%) rename tests/{raw => legacy}/batching.test.ts (100%) rename tests/{raw => legacy}/custom-fetch.test.ts (100%) rename tests/{raw => legacy}/document-node.test.ts (100%) rename tests/{raw => legacy}/endpoint.test.ts (100%) rename tests/{raw => legacy}/errorPolicy.test.ts (100%) rename tests/{raw => legacy}/fetch.test.ts (100%) rename tests/{raw => legacy}/general.test.ts (100%) rename tests/{raw => legacy}/gql.test.ts (100%) rename tests/{raw => legacy}/headers.test.ts (100%) rename tests/{raw => legacy}/httpMethod.test.ts (92%) rename tests/{raw => legacy}/json-serializer.test.ts (97%) rename tests/{raw => legacy}/signal.test.ts (100%) rename tests/{raw => legacy}/typed-document-node.test.ts (100%) diff --git a/src/cli/generate.ts b/src/cli/generate.ts index 97d50305a..7aa2dcb9c 100755 --- a/src/cli/generate.ts +++ b/src/cli/generate.ts @@ -3,7 +3,7 @@ import { Command } from '@molt/command' import * as Path from 'node:path' import { z } from 'zod' -import { generateFiles } from '../generator/files.js' +import { generateFiles } from '../layers/2_generator/files.js' const args = Command.create().description(`Generate a type safe GraphQL client.`) .parameter(`schema`, z.string().min(1).describe(`File path to where your GraphQL schema is.`)) diff --git a/src/entrypoints/alpha/client.ts b/src/entrypoints/alpha/client.ts index 9cf19885e..e619e2979 100644 --- a/src/entrypoints/alpha/client.ts +++ b/src/entrypoints/alpha/client.ts @@ -1,2 +1,2 @@ -export * from '../../client/client.js' -export { create as createSelect, select } from '../../select.js' +export * from '../../layers/4_client/client.js' +export { create as createSelect, select } from '../../layers/4_select/select.js' diff --git a/src/entrypoints/alpha/scalars.ts b/src/entrypoints/alpha/scalars.ts index c4eda2861..ff0f7eb4e 100644 --- a/src/entrypoints/alpha/scalars.ts +++ b/src/entrypoints/alpha/scalars.ts @@ -1 +1 @@ -export * from '../../Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../layers/1_Schema/Hybrid/types/Scalar/Scalar.js' diff --git a/src/entrypoints/alpha/schema.ts b/src/entrypoints/alpha/schema.ts index 0f47425e6..4812cc12e 100644 --- a/src/entrypoints/alpha/schema.ts +++ b/src/entrypoints/alpha/schema.ts @@ -1,3 +1,3 @@ -export { ResultSet } from '../../client/ResultSet/__.js' -export { SelectionSet } from '../../client/SelectionSet/__.js' -export * from '../../Schema/__.js' +export { ResultSet } from '../../layers/3_IO/ResultSet/__.js' +export { SelectionSet } from '../../layers/3_IO/SelectionSet/__.js' +export * from '../../layers/1_Schema/__.js' diff --git a/src/entrypoints/main.ts b/src/entrypoints/main.ts index 7fb7cd1c2..5d6fd790d 100644 --- a/src/entrypoints/main.ts +++ b/src/entrypoints/main.ts @@ -1,18 +1,18 @@ -import { ClientError } from '../raw/classes/ClientError.js' +import { ClientError } from '../legacy/classes/ClientError.js' import { type BatchRequestDocument, type BatchRequestsExtendedOptions, type BatchRequestsOptions, -} from '../raw/functions/batchRequests.js' -import type { RequestExtendedOptions } from '../raw/functions/request.js' -import { request } from '../raw/functions/request.js' -import type { GraphQLResponse, RequestMiddleware, ResponseMiddleware } from '../raw/helpers/types.js' -import type { RawRequestOptions, RequestDocument, RequestOptions, Variables } from '../raw/helpers/types.js' -export { GraphQLClient } from '../raw/classes/GraphQLClient.js' -export { batchRequests } from '../raw/functions/batchRequests.js' -export { gql } from '../raw/functions/gql.js' -export { rawRequest } from '../raw/functions/rawRequest.js' -export { analyzeDocument } from '../raw/helpers/analyzeDocument.js' +} from '../legacy/functions/batchRequests.js' +import type { RequestExtendedOptions } from '../legacy/functions/request.js' +import { request } from '../legacy/functions/request.js' +import type { GraphQLResponse, RequestMiddleware, ResponseMiddleware } from '../legacy/helpers/types.js' +import type { RawRequestOptions, RequestDocument, RequestOptions, Variables } from '../legacy/helpers/types.js' +export { GraphQLClient } from '../legacy/classes/GraphQLClient.js' +export { batchRequests } from '../legacy/functions/batchRequests.js' +export { gql } from '../legacy/functions/gql.js' +export { rawRequest } from '../legacy/functions/rawRequest.js' +export { analyzeDocument } from '../legacy/helpers/analyzeDocument.js' export { BatchRequestDocument, BatchRequestsExtendedOptions, diff --git a/src/Schema/Args.ts b/src/layers/1_Schema/Args.ts similarity index 100% rename from src/Schema/Args.ts rename to src/layers/1_Schema/Args.ts diff --git a/src/Schema/Field.ts b/src/layers/1_Schema/Field.ts similarity index 100% rename from src/Schema/Field.ts rename to src/layers/1_Schema/Field.ts diff --git a/src/Schema/Hybrid/_.ts b/src/layers/1_Schema/Hybrid/_.ts similarity index 100% rename from src/Schema/Hybrid/_.ts rename to src/layers/1_Schema/Hybrid/_.ts diff --git a/src/Schema/Hybrid/__.ts b/src/layers/1_Schema/Hybrid/__.ts similarity index 100% rename from src/Schema/Hybrid/__.ts rename to src/layers/1_Schema/Hybrid/__.ts diff --git a/src/Schema/Hybrid/types/Enum.ts b/src/layers/1_Schema/Hybrid/types/Enum.ts similarity index 100% rename from src/Schema/Hybrid/types/Enum.ts rename to src/layers/1_Schema/Hybrid/types/Enum.ts diff --git a/src/Schema/Hybrid/types/Scalar/Scalar.ts b/src/layers/1_Schema/Hybrid/types/Scalar/Scalar.ts similarity index 100% rename from src/Schema/Hybrid/types/Scalar/Scalar.ts rename to src/layers/1_Schema/Hybrid/types/Scalar/Scalar.ts diff --git a/src/Schema/Hybrid/types/Scalar/__.ts b/src/layers/1_Schema/Hybrid/types/Scalar/__.ts similarity index 100% rename from src/Schema/Hybrid/types/Scalar/__.ts rename to src/layers/1_Schema/Hybrid/types/Scalar/__.ts diff --git a/src/Schema/Hybrid/types/Scalar/codec.ts b/src/layers/1_Schema/Hybrid/types/Scalar/codec.ts similarity index 100% rename from src/Schema/Hybrid/types/Scalar/codec.ts rename to src/layers/1_Schema/Hybrid/types/Scalar/codec.ts diff --git a/src/Schema/Hybrid/types/Scalar/nativeScalarCodecs.ts b/src/layers/1_Schema/Hybrid/types/Scalar/nativeScalarCodecs.ts similarity index 100% rename from src/Schema/Hybrid/types/Scalar/nativeScalarCodecs.ts rename to src/layers/1_Schema/Hybrid/types/Scalar/nativeScalarCodecs.ts diff --git a/src/Schema/Input/Input.ts b/src/layers/1_Schema/Input/Input.ts similarity index 100% rename from src/Schema/Input/Input.ts rename to src/layers/1_Schema/Input/Input.ts diff --git a/src/Schema/Input/__.ts b/src/layers/1_Schema/Input/__.ts similarity index 100% rename from src/Schema/Input/__.ts rename to src/layers/1_Schema/Input/__.ts diff --git a/src/Schema/Input/typeGroups.ts b/src/layers/1_Schema/Input/typeGroups.ts similarity index 100% rename from src/Schema/Input/typeGroups.ts rename to src/layers/1_Schema/Input/typeGroups.ts diff --git a/src/Schema/Input/types/InputObject.ts b/src/layers/1_Schema/Input/types/InputObject.ts similarity index 100% rename from src/Schema/Input/types/InputObject.ts rename to src/layers/1_Schema/Input/types/InputObject.ts diff --git a/src/Schema/Input/types/List.ts b/src/layers/1_Schema/Input/types/List.ts similarity index 100% rename from src/Schema/Input/types/List.ts rename to src/layers/1_Schema/Input/types/List.ts diff --git a/src/Schema/Input/types/Nullable.ts b/src/layers/1_Schema/Input/types/Nullable.ts similarity index 100% rename from src/Schema/Input/types/Nullable.ts rename to src/layers/1_Schema/Input/types/Nullable.ts diff --git a/src/Schema/Output/Output.ts b/src/layers/1_Schema/Output/Output.ts similarity index 96% rename from src/Schema/Output/Output.ts rename to src/layers/1_Schema/Output/Output.ts index aead3c55f..4cf49c22e 100644 --- a/src/Schema/Output/Output.ts +++ b/src/layers/1_Schema/Output/Output.ts @@ -1,4 +1,4 @@ -import type { TSError } from '../../lib/TSError.js' +import type { TSError } from '../../../lib/TSError.js' import { readMaybeThunk } from '../core/helpers.js' import type { Any, Named } from './typeGroups.js' import type { __typename } from './types/__typename.js' diff --git a/src/Schema/Output/__.ts b/src/layers/1_Schema/Output/__.ts similarity index 100% rename from src/Schema/Output/__.ts rename to src/layers/1_Schema/Output/__.ts diff --git a/src/Schema/Output/typeGroups.ts b/src/layers/1_Schema/Output/typeGroups.ts similarity index 100% rename from src/Schema/Output/typeGroups.ts rename to src/layers/1_Schema/Output/typeGroups.ts diff --git a/src/Schema/Output/types/Interface.ts b/src/layers/1_Schema/Output/types/Interface.ts similarity index 100% rename from src/Schema/Output/types/Interface.ts rename to src/layers/1_Schema/Output/types/Interface.ts diff --git a/src/Schema/Output/types/List.ts b/src/layers/1_Schema/Output/types/List.ts similarity index 100% rename from src/Schema/Output/types/List.ts rename to src/layers/1_Schema/Output/types/List.ts diff --git a/src/Schema/Output/types/Nullable.ts b/src/layers/1_Schema/Output/types/Nullable.ts similarity index 100% rename from src/Schema/Output/types/Nullable.ts rename to src/layers/1_Schema/Output/types/Nullable.ts diff --git a/src/Schema/Output/types/Object.ts b/src/layers/1_Schema/Output/types/Object.ts similarity index 100% rename from src/Schema/Output/types/Object.ts rename to src/layers/1_Schema/Output/types/Object.ts diff --git a/src/Schema/Output/types/Union.ts b/src/layers/1_Schema/Output/types/Union.ts similarity index 100% rename from src/Schema/Output/types/Union.ts rename to src/layers/1_Schema/Output/types/Union.ts diff --git a/src/Schema/Output/types/__typename.ts b/src/layers/1_Schema/Output/types/__typename.ts similarity index 100% rename from src/Schema/Output/types/__typename.ts rename to src/layers/1_Schema/Output/types/__typename.ts diff --git a/src/Schema/_.ts b/src/layers/1_Schema/_.ts similarity index 100% rename from src/Schema/_.ts rename to src/layers/1_Schema/_.ts diff --git a/src/Schema/__.ts b/src/layers/1_Schema/__.ts similarity index 100% rename from src/Schema/__.ts rename to src/layers/1_Schema/__.ts diff --git a/src/Schema/core/Index.ts b/src/layers/1_Schema/core/Index.ts similarity index 89% rename from src/Schema/core/Index.ts rename to src/layers/1_Schema/core/Index.ts index aa56bd5bb..a6f7c78ac 100644 --- a/src/Schema/core/Index.ts +++ b/src/layers/1_Schema/core/Index.ts @@ -1,4 +1,4 @@ -import type { GlobalRegistry } from '../../globalRegistry.js' +import type { GlobalRegistry } from '../../2_generator/globalRegistry.js' import type { Output } from '../Output/__.js' export interface Index { diff --git a/src/Schema/core/Named/NamedType.test-d.ts b/src/layers/1_Schema/core/Named/NamedType.test-d.ts similarity index 100% rename from src/Schema/core/Named/NamedType.test-d.ts rename to src/layers/1_Schema/core/Named/NamedType.test-d.ts diff --git a/src/Schema/core/Named/NamedType.ts b/src/layers/1_Schema/core/Named/NamedType.ts similarity index 92% rename from src/Schema/core/Named/NamedType.ts rename to src/layers/1_Schema/core/Named/NamedType.ts index 628edb952..7c862a21d 100644 --- a/src/Schema/core/Named/NamedType.ts +++ b/src/layers/1_Schema/core/Named/NamedType.ts @@ -1,4 +1,4 @@ -import type { Digit, Letter } from '../../../lib/prelude.js' +import type { Digit, Letter } from '../../../../lib/prelude.js' /** * @see http://spec.graphql.org/draft/#sec-Names diff --git a/src/Schema/core/Named/_.ts b/src/layers/1_Schema/core/Named/_.ts similarity index 100% rename from src/Schema/core/Named/_.ts rename to src/layers/1_Schema/core/Named/_.ts diff --git a/src/Schema/core/Named/__.ts b/src/layers/1_Schema/core/Named/__.ts similarity index 100% rename from src/Schema/core/Named/__.ts rename to src/layers/1_Schema/core/Named/__.ts diff --git a/src/Schema/core/helpers.ts b/src/layers/1_Schema/core/helpers.ts similarity index 100% rename from src/Schema/core/helpers.ts rename to src/layers/1_Schema/core/helpers.ts diff --git a/src/generator/__snapshots__/files.test.ts.snap b/src/layers/2_generator/__snapshots__/files.test.ts.snap similarity index 99% rename from src/generator/__snapshots__/files.test.ts.snap rename to src/layers/2_generator/__snapshots__/files.test.ts.snap index 9e520e156..b3a68ef70 100644 --- a/src/generator/__snapshots__/files.test.ts.snap +++ b/src/layers/2_generator/__snapshots__/files.test.ts.snap @@ -518,7 +518,7 @@ export namespace Union { `; exports[`schema2 5`] = ` -"export * from '../../../../src/Schema/Hybrid/types/Scalar/Scalar.js' +"export * from '../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' export * from '../../customScalarCodecs.js' " `; diff --git a/src/generator/__snapshots__/generator.test.ts.snap b/src/layers/2_generator/__snapshots__/generator.test.ts.snap similarity index 100% rename from src/generator/__snapshots__/generator.test.ts.snap rename to src/layers/2_generator/__snapshots__/generator.test.ts.snap diff --git a/src/generator/code/Error.ts b/src/layers/2_generator/code/Error.ts similarity index 100% rename from src/generator/code/Error.ts rename to src/layers/2_generator/code/Error.ts diff --git a/src/generator/code/Index.ts b/src/layers/2_generator/code/Index.ts similarity index 97% rename from src/generator/code/Index.ts rename to src/layers/2_generator/code/Index.ts index 18bd18fe2..554c41a60 100644 --- a/src/generator/code/Index.ts +++ b/src/layers/2_generator/code/Index.ts @@ -1,6 +1,6 @@ import { isUnionType } from 'graphql' -import { Code } from '../../lib/Code.js' -import { hasMutation, hasQuery, hasSubscription, unwrapToNamed } from '../../lib/graphql.js' +import { Code } from '../../../lib/Code.js' +import { hasMutation, hasQuery, hasSubscription, unwrapToNamed } from '../../../lib/graphql.js' import type { Config } from './generateCode.js' import { moduleNameSchemaBuildtime } from './SchemaBuildtime.js' diff --git a/src/generator/code/Scalar.ts b/src/layers/2_generator/code/Scalar.ts similarity index 100% rename from src/generator/code/Scalar.ts rename to src/layers/2_generator/code/Scalar.ts diff --git a/src/generator/code/SchemaBuildtime.ts b/src/layers/2_generator/code/SchemaBuildtime.ts similarity index 98% rename from src/generator/code/SchemaBuildtime.ts rename to src/layers/2_generator/code/SchemaBuildtime.ts index 651cce20f..5a391be94 100644 --- a/src/generator/code/SchemaBuildtime.ts +++ b/src/layers/2_generator/code/SchemaBuildtime.ts @@ -8,7 +8,7 @@ import type { } from 'graphql' import { isEnumType, isListType, isNamedType } from 'graphql' import _ from 'json-bigint' -import { Code } from '../../lib/Code.js' +import { Code } from '../../../lib/Code.js' import type { AnyClass, AnyField, @@ -17,15 +17,15 @@ import type { Describable, NamedNameToClass, NameToClassNamedType, -} from '../../lib/graphql.js' +} from '../../../lib/graphql.js' import { getNodeDisplayName, isDeprecatableNode, isGraphQLOutputField, type NameToClass, unwrapToNonNull, -} from '../../lib/graphql.js' -import { entries, values } from '../../lib/prelude.js' +} from '../../../lib/graphql.js' +import { entries, values } from '../../../lib/prelude.js' import type { Config } from './generateCode.js' export const moduleNameSchemaBuildtime = `SchemaBuildtime` diff --git a/src/generator/code/SchemaRuntime.ts b/src/layers/2_generator/code/SchemaRuntime.ts similarity index 98% rename from src/generator/code/SchemaRuntime.ts rename to src/layers/2_generator/code/SchemaRuntime.ts index b35aa71d3..16b49fb10 100644 --- a/src/generator/code/SchemaRuntime.ts +++ b/src/layers/2_generator/code/SchemaRuntime.ts @@ -18,8 +18,8 @@ import { isScalarType, isUnionType, } from 'graphql' -import type { AnyClass, AnyGraphQLOutputField } from '../../lib/graphql.js' -import { hasMutation, hasQuery, hasSubscription, unwrapToNamed, unwrapToNonNull } from '../../lib/graphql.js' +import type { AnyClass, AnyGraphQLOutputField } from '../../../lib/graphql.js' +import { hasMutation, hasQuery, hasSubscription, unwrapToNamed, unwrapToNonNull } from '../../../lib/graphql.js' import type { Config } from './generateCode.js' import { moduleNameScalar } from './Scalar.js' diff --git a/src/generator/code/Select.ts b/src/layers/2_generator/code/Select.ts similarity index 100% rename from src/generator/code/Select.ts rename to src/layers/2_generator/code/Select.ts diff --git a/src/generator/code/generateCode.ts b/src/layers/2_generator/code/generateCode.ts similarity index 96% rename from src/generator/code/generateCode.ts rename to src/layers/2_generator/code/generateCode.ts index a84f7d370..a595237a7 100644 --- a/src/generator/code/generateCode.ts +++ b/src/layers/2_generator/code/generateCode.ts @@ -2,8 +2,8 @@ import type { Formatter } from '@dprint/formatter' import type { GraphQLObjectType, GraphQLSchema } from 'graphql' import { buildSchema } from 'graphql' import * as Path from 'node:path' -import type { TypeMapByKind } from '../../lib/graphql.js' -import { getTypeMapByKind } from '../../lib/graphql.js' +import type { TypeMapByKind } from '../../../lib/graphql.js' +import { getTypeMapByKind } from '../../../lib/graphql.js' import { generateError } from './Error.js' import { generateGlobal } from './global.js' import { generateIndex } from './Index.js' diff --git a/src/generator/code/global.ts b/src/layers/2_generator/code/global.ts similarity index 100% rename from src/generator/code/global.ts rename to src/layers/2_generator/code/global.ts diff --git a/src/generator/files.test.ts b/src/layers/2_generator/files.test.ts similarity index 100% rename from src/generator/files.test.ts rename to src/layers/2_generator/files.test.ts diff --git a/src/generator/files.ts b/src/layers/2_generator/files.ts similarity index 97% rename from src/generator/files.ts rename to src/layers/2_generator/files.ts index c34cafe14..1d389fca1 100644 --- a/src/generator/files.ts +++ b/src/layers/2_generator/files.ts @@ -3,7 +3,7 @@ import { getPath } from '@dprint/typescript' import _ from 'json-bigint' import fs from 'node:fs/promises' import * as Path from 'node:path' -import { fileExists } from '../lib/prelude.js' +import { fileExists } from '../../lib/prelude.js' import type { OptionsInput } from './code/generateCode.js' import { generateCode, type Input as GenerateInput } from './code/generateCode.js' diff --git a/src/globalRegistry.ts b/src/layers/2_generator/globalRegistry.ts similarity index 92% rename from src/globalRegistry.ts rename to src/layers/2_generator/globalRegistry.ts index 914e5ad58..fc5802cb5 100644 --- a/src/globalRegistry.ts +++ b/src/layers/2_generator/globalRegistry.ts @@ -1,5 +1,5 @@ -import type { TSError } from './lib/TSError.js' -import type { Schema } from './Schema/__.js' +import type { TSError } from '../../lib/TSError.js' +import type { Schema } from '../1_Schema/__.js' declare global { // todo some kind of distinct prefix diff --git a/src/client/ResultSet/ResultSet.test-d.ts b/src/layers/3_IO/ResultSet/ResultSet.test-d.ts similarity index 98% rename from src/client/ResultSet/ResultSet.test-d.ts rename to src/layers/3_IO/ResultSet/ResultSet.test-d.ts index 5a09140ae..ad270537f 100644 --- a/src/client/ResultSet/ResultSet.test-d.ts +++ b/src/layers/3_IO/ResultSet/ResultSet.test-d.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/ban-types */ import { expectTypeOf, test } from 'vitest' -import type { Index } from '../../../tests/_/schema/generated/Index.js' -import type * as Schema from '../../../tests/_/schema/generated/SchemaBuildtime.js' +import type { Index } from '../../../../tests/_/schema/generated/Index.js' +import type * as Schema from '../../../../tests/_/schema/generated/SchemaBuildtime.js' import type { SelectionSet } from '../SelectionSet/__.js' import type { ResultSet } from './__.js' diff --git a/src/client/ResultSet/ResultSet.ts b/src/layers/3_IO/ResultSet/ResultSet.ts similarity index 95% rename from src/client/ResultSet/ResultSet.ts rename to src/layers/3_IO/ResultSet/ResultSet.ts index 8bb8b7876..9d2e59537 100644 --- a/src/client/ResultSet/ResultSet.ts +++ b/src/layers/3_IO/ResultSet/ResultSet.ts @@ -1,10 +1,10 @@ /* eslint-disable @typescript-eslint/ban-types */ import type { Simplify } from 'type-fest' -import type { ExcludeNull, GetKeyOr, SimplifyDeep } from '../../lib/prelude.js' -import type { TSError } from '../../lib/TSError.js' -import type { Schema, SomeField } from '../../Schema/__.js' -import type { PickScalarFields } from '../../Schema/Output/Output.js' +import type { ExcludeNull, GetKeyOr, SimplifyDeep } from '../../../lib/prelude.js' +import type { TSError } from '../../../lib/TSError.js' +import type { Schema, SomeField } from '../../1_Schema/__.js' +import type { PickScalarFields } from '../../1_Schema/Output/Output.js' import type { SelectionSet } from '../SelectionSet/__.js' export type Query<$SelectionSet extends object, $Index extends Schema.Index> = Root<$SelectionSet, $Index, 'Query'> diff --git a/src/client/ResultSet/__.ts b/src/layers/3_IO/ResultSet/__.ts similarity index 100% rename from src/client/ResultSet/__.ts rename to src/layers/3_IO/ResultSet/__.ts diff --git a/src/client/SelectionSet/SelectionSet.test-d.ts b/src/layers/3_IO/SelectionSet/SelectionSet.test-d.ts similarity index 99% rename from src/client/SelectionSet/SelectionSet.test-d.ts rename to src/layers/3_IO/SelectionSet/SelectionSet.test-d.ts index dd670977d..2b46c88bf 100644 --- a/src/client/SelectionSet/SelectionSet.test-d.ts +++ b/src/layers/3_IO/SelectionSet/SelectionSet.test-d.ts @@ -1,5 +1,5 @@ import { assertType, expectTypeOf, test } from 'vitest' -import type { Index } from '../../../tests/_/schema/generated/Index.js' +import type { Index } from '../../../../tests/_/schema/generated/Index.js' import type { SelectionSet } from './__.js' type Q = SelectionSet.Query diff --git a/src/client/SelectionSet/SelectionSet.ts b/src/layers/3_IO/SelectionSet/SelectionSet.ts similarity index 98% rename from src/client/SelectionSet/SelectionSet.ts rename to src/layers/3_IO/SelectionSet/SelectionSet.ts index 5d035b391..37fb7f481 100644 --- a/src/client/SelectionSet/SelectionSet.ts +++ b/src/layers/3_IO/SelectionSet/SelectionSet.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/ban-types */ -import type { MaybeList, StringNonEmpty, Values } from '../../lib/prelude.js' -import type { TSError } from '../../lib/TSError.js' +import type { MaybeList, StringNonEmpty, Values } from '../../../lib/prelude.js' +import type { TSError } from '../../../lib/TSError.js' import type { InputFieldsAllNullable, OmitNullableFields, @@ -9,7 +9,7 @@ import type { Schema, SomeField, SomeFields, -} from '../../Schema/__.js' +} from '../../1_Schema/__.js' export type Query<$Index extends Schema.Index> = Root<$Index, 'Query'> diff --git a/src/client/SelectionSet/_.ts b/src/layers/3_IO/SelectionSet/_.ts similarity index 100% rename from src/client/SelectionSet/_.ts rename to src/layers/3_IO/SelectionSet/_.ts diff --git a/src/client/SelectionSet/__.ts b/src/layers/3_IO/SelectionSet/__.ts similarity index 100% rename from src/client/SelectionSet/__.ts rename to src/layers/3_IO/SelectionSet/__.ts diff --git a/src/client/SelectionSet/__snapshots__/toGraphQLDocumentString.test.ts.snap b/src/layers/3_IO/SelectionSet/__snapshots__/toGraphQLDocumentString.test.ts.snap similarity index 100% rename from src/client/SelectionSet/__snapshots__/toGraphQLDocumentString.test.ts.snap rename to src/layers/3_IO/SelectionSet/__snapshots__/toGraphQLDocumentString.test.ts.snap diff --git a/src/client/SelectionSet/toGraphQLDocumentString.test.ts b/src/layers/3_IO/SelectionSet/toGraphQLDocumentString.test.ts similarity index 96% rename from src/client/SelectionSet/toGraphQLDocumentString.test.ts rename to src/layers/3_IO/SelectionSet/toGraphQLDocumentString.test.ts index 9ccfe77af..61d6252c5 100644 --- a/src/client/SelectionSet/toGraphQLDocumentString.test.ts +++ b/src/layers/3_IO/SelectionSet/toGraphQLDocumentString.test.ts @@ -1,7 +1,7 @@ import { parse, print } from 'graphql' import { describe, expect, test } from 'vitest' -import type { Index } from '../../../tests/_/schema/generated/Index.js' -import { $Index as schemaIndex } from '../../../tests/_/schema/generated/SchemaRuntime.js' +import type { Index } from '../../../../tests/_/schema/generated/Index.js' +import { $Index as schemaIndex } from '../../../../tests/_/schema/generated/SchemaRuntime.js' import type { SelectionSet } from './__.js' import type { Context } from './toGraphQLDocumentString.js' import { rootTypeSelectionSet } from './toGraphQLDocumentString.js' diff --git a/src/client/SelectionSet/toGraphQLDocumentString.ts b/src/layers/3_IO/SelectionSet/toGraphQLDocumentString.ts similarity index 97% rename from src/client/SelectionSet/toGraphQLDocumentString.ts rename to src/layers/3_IO/SelectionSet/toGraphQLDocumentString.ts index 65258d4f0..e23763293 100644 --- a/src/client/SelectionSet/toGraphQLDocumentString.ts +++ b/src/layers/3_IO/SelectionSet/toGraphQLDocumentString.ts @@ -1,8 +1,8 @@ -import { RootTypeName } from '../../lib/graphql.js' -import { lowerCaseFirstLetter } from '../../lib/prelude.js' -import { Schema } from '../../Schema/__.js' -import { readMaybeThunk } from '../../Schema/core/helpers.js' -import type { ReturnModeType } from '../Config.js' +import { RootTypeName } from '../../../lib/graphql.js' +import { lowerCaseFirstLetter } from '../../../lib/prelude.js' +import { Schema } from '../../1_Schema/__.js' +import { readMaybeThunk } from '../../1_Schema/core/helpers.js' +import type { ReturnModeType } from '../../4_client/Config.js' import type { SelectionSet } from './__.js' import { aliasPattern, fragmentPattern } from './SelectionSet.js' diff --git a/src/client/Config.ts b/src/layers/4_client/Config.ts similarity index 93% rename from src/client/Config.ts rename to src/layers/4_client/Config.ts index fbfc8b9e0..e9ff96b10 100644 --- a/src/client/Config.ts +++ b/src/layers/4_client/Config.ts @@ -1,8 +1,8 @@ import type { ExecutionResult } from 'graphql' -import type { GlobalRegistry } from '../globalRegistry.js' -import type { GraphQLExecutionResultError } from '../lib/graphql.js' -import type { SetProperty } from '../lib/prelude.js' -import type { Schema } from '../Schema/__.js' +import type { GlobalRegistry } from '../2_generator/globalRegistry.js' +import type { GraphQLExecutionResultError } from '../../lib/graphql.js' +import type { SetProperty } from '../../lib/prelude.js' +import type { Schema } from '../1_Schema/__.js' export type ReturnModeType = | ReturnModeTypeGraphQL diff --git a/src/client/RootTypeMethods.ts b/src/layers/4_client/RootTypeMethods.ts similarity index 92% rename from src/client/RootTypeMethods.ts rename to src/layers/4_client/RootTypeMethods.ts index f9ee3678a..f145e52ac 100644 --- a/src/client/RootTypeMethods.ts +++ b/src/layers/4_client/RootTypeMethods.ts @@ -1,7 +1,7 @@ -import type { OperationName } from '../lib/graphql.js' -import type { Exact } from '../lib/prelude.js' -import type { TSError } from '../lib/TSError.js' -import type { InputFieldsAllNullable, Schema } from '../Schema/__.js' +import type { OperationName } from '../../lib/graphql.js' +import type { Exact } from '../../lib/prelude.js' +import type { TSError } from '../../lib/TSError.js' +import type { InputFieldsAllNullable, Schema } from '../1_Schema/__.js' import type { AugmentRootTypeSelectionWithTypename, Config, @@ -10,8 +10,8 @@ import type { ReturnModeRootField, ReturnModeRootType, } from './Config.js' -import type { ResultSet } from './ResultSet/__.js' -import type { SelectionSet } from './SelectionSet/__.js' +import type { ResultSet } from '../3_IO/ResultSet/__.js' +import type { SelectionSet } from '../3_IO/SelectionSet/__.js' type RootTypeFieldContext = { Config: Config diff --git a/src/client/client.customScalar.test.ts b/src/layers/4_client/client.customScalar.test.ts similarity index 96% rename from src/client/client.customScalar.test.ts rename to src/layers/4_client/client.customScalar.test.ts index b19ddcd61..88c20d402 100644 --- a/src/client/client.customScalar.test.ts +++ b/src/layers/4_client/client.customScalar.test.ts @@ -1,8 +1,8 @@ /* eslint-disable */ import { beforeEach, describe, expect, test } from 'vitest' -import { db } from '../../tests/_/db.js' -import { $Index as schemaIndex } from '../../tests/_/schema/generated/SchemaRuntime.js' -import { setupMockServer } from '../../tests/raw/__helpers.js' +import { db } from '../../../tests/_/db.js' +import { $Index as schemaIndex } from '../../../tests/_/schema/generated/SchemaRuntime.js' +import { setupMockServer } from '../../../tests/legacy/__helpers.js' import { create } from './client.js' const ctx = setupMockServer() diff --git a/src/client/client.document.test-d.ts b/src/layers/4_client/client.document.test-d.ts similarity index 91% rename from src/client/client.document.test-d.ts rename to src/layers/4_client/client.document.test-d.ts index a48192c3b..cd6e75a7d 100644 --- a/src/client/client.document.test-d.ts +++ b/src/layers/4_client/client.document.test-d.ts @@ -1,7 +1,7 @@ import { describe, expectTypeOf, test } from 'vitest' -import * as Schema from '../../tests/_/schema/schema.js' -import * as SchemaMutationOnly from '../../tests/_/schemaMutationOnly/schema.js' -import * as SchemaQueryOnly from '../../tests/_/schemaQueryOnly/schema.js' +import * as Schema from '../../../tests/_/schema/schema.js' +import * as SchemaMutationOnly from '../../../tests/_/schemaMutationOnly/schema.js' +import * as SchemaQueryOnly from '../../../tests/_/schemaQueryOnly/schema.js' import { create } from './client.js' const client = create({ schema: Schema.schema, schemaIndex: Schema.$Index }) diff --git a/src/client/client.document.test.ts b/src/layers/4_client/client.document.test.ts similarity index 93% rename from src/client/client.document.test.ts rename to src/layers/4_client/client.document.test.ts index 1e47049d0..cdcf91883 100644 --- a/src/client/client.document.test.ts +++ b/src/layers/4_client/client.document.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from 'vitest' -import { db } from '../../tests/_/db.js' -import { $Index } from '../../tests/_/schema/generated/SchemaRuntime.js' -import { schema } from '../../tests/_/schema/schema.js' +import { db } from '../../../tests/_/db.js' +import { $Index } from '../../../tests/_/schema/generated/SchemaRuntime.js' +import { schema } from '../../../tests/_/schema/schema.js' import { create } from './client.js' // todo test with custom scalars diff --git a/src/client/client.error.test-d.ts b/src/layers/4_client/client.error.test-d.ts similarity index 81% rename from src/client/client.error.test-d.ts rename to src/layers/4_client/client.error.test-d.ts index c365e313e..1201a4c53 100644 --- a/src/client/client.error.test-d.ts +++ b/src/layers/4_client/client.error.test-d.ts @@ -1,7 +1,7 @@ /* eslint-disable */ import { expectTypeOf, test } from 'vitest' -import { isError } from '../../tests/_/schema/generated/Error.js' -import * as Schema from '../../tests/_/schema/schema.js' +import { isError } from '../../../tests/_/schema/generated/Error.js' +import * as Schema from '../../../tests/_/schema/schema.js' import { create } from './client.js' const client = create({ schema: Schema.schema, schemaIndex: Schema.$Index }) diff --git a/src/client/client.input.test-d.ts b/src/layers/4_client/client.input.test-d.ts similarity index 88% rename from src/client/client.input.test-d.ts rename to src/layers/4_client/client.input.test-d.ts index 709b9872a..7fdd42ea8 100644 --- a/src/client/client.input.test-d.ts +++ b/src/layers/4_client/client.input.test-d.ts @@ -1,6 +1,6 @@ import { test } from 'vitest' -import { $Index } from '../../tests/_/schema/generated/SchemaRuntime.js' -import { schema } from '../../tests/_/schema/schema.js' +import { $Index } from '../../../tests/_/schema/generated/SchemaRuntime.js' +import { schema } from '../../../tests/_/schema/schema.js' import { create } from './client.js' test(`works`, () => { diff --git a/src/client/client.returnMode.test-d.ts b/src/layers/4_client/client.returnMode.test-d.ts similarity index 97% rename from src/client/client.returnMode.test-d.ts rename to src/layers/4_client/client.returnMode.test-d.ts index 9c29ef6d0..5851ecf4f 100644 --- a/src/client/client.returnMode.test-d.ts +++ b/src/layers/4_client/client.returnMode.test-d.ts @@ -3,9 +3,9 @@ import { ExecutionResult } from 'graphql' import { ObjMap } from 'graphql/jsutils/ObjMap.js' import { describe } from 'node:test' import { expectTypeOf, test } from 'vitest' -import { $Index as schemaIndex } from '../../tests/_/schema/generated/SchemaRuntime.js' -import { schema } from '../../tests/_/schema/schema.js' -import { GraphQLExecutionResultError } from '../lib/graphql.js' +import { $Index as schemaIndex } from '../../../tests/_/schema/generated/SchemaRuntime.js' +import { schema } from '../../../tests/_/schema/schema.js' +import { GraphQLExecutionResultError } from '../../lib/graphql.js' import { create } from './client.js' // dprint-ignore diff --git a/src/client/client.returnMode.test.ts b/src/layers/4_client/client.returnMode.test.ts similarity index 97% rename from src/client/client.returnMode.test.ts rename to src/layers/4_client/client.returnMode.test.ts index 2fcaa972b..229cd58a3 100644 --- a/src/client/client.returnMode.test.ts +++ b/src/layers/4_client/client.returnMode.test.ts @@ -1,9 +1,9 @@ /* eslint-disable */ import { describe, expect, test } from 'vitest' -import { db } from '../../tests/_/db.js' -import { $Index as schemaIndex } from '../../tests/_/schema/generated/SchemaRuntime.js' -import { schema } from '../../tests/_/schema/schema.js' -import { __typename } from '../Schema/_.js' +import { db } from '../../../tests/_/db.js' +import { $Index as schemaIndex } from '../../../tests/_/schema/generated/SchemaRuntime.js' +import { schema } from '../../../tests/_/schema/schema.js' +import { __typename } from '../1_Schema/_.js' import { create } from './client.js' // dprint-ignore diff --git a/src/client/client.rootTypeMethods.test-d.ts b/src/layers/4_client/client.rootTypeMethods.test-d.ts similarity index 93% rename from src/client/client.rootTypeMethods.test-d.ts rename to src/layers/4_client/client.rootTypeMethods.test-d.ts index 417088f93..68ba2ffa3 100644 --- a/src/client/client.rootTypeMethods.test-d.ts +++ b/src/layers/4_client/client.rootTypeMethods.test-d.ts @@ -1,7 +1,7 @@ /* eslint-disable */ import { expectTypeOf, test } from 'vitest' -import * as Schema from '../../tests/_/schema/schema.js' -import { GraphQLExecutionResultError } from '../lib/graphql.js' +import * as Schema from '../../../tests/_/schema/schema.js' +import { GraphQLExecutionResultError } from '../../lib/graphql.js' import { create } from './client.js' const client = create({ schema: Schema.schema, schemaIndex: Schema.$Index }) diff --git a/src/client/client.rootTypeMethods.test.ts b/src/layers/4_client/client.rootTypeMethods.test.ts similarity index 96% rename from src/client/client.rootTypeMethods.test.ts rename to src/layers/4_client/client.rootTypeMethods.test.ts index 5c8945fdb..a6d45978e 100644 --- a/src/client/client.rootTypeMethods.test.ts +++ b/src/layers/4_client/client.rootTypeMethods.test.ts @@ -1,6 +1,6 @@ import { describe, expect, test } from 'vitest' -import { db } from '../../tests/_/db.js' -import * as Schema from '../../tests/_/schema/schema.js' +import { db } from '../../../tests/_/db.js' +import * as Schema from '../../../tests/_/schema/schema.js' import { create } from './client.js' const client = create({ schema: Schema.schema, schemaIndex: Schema.$Index }) diff --git a/src/client/client.ts b/src/layers/4_client/client.ts similarity index 95% rename from src/client/client.ts rename to src/layers/4_client/client.ts index 5c3801815..ca77dec68 100644 --- a/src/client/client.ts +++ b/src/layers/4_client/client.ts @@ -1,14 +1,14 @@ import type { ExecutionResult } from 'graphql' import { type DocumentNode, execute, graphql, type GraphQLSchema } from 'graphql' import type { ExcludeUndefined } from 'type-fest/source/required-deep.js' -import request from '../entrypoints/main.js' -import type { GlobalRegistry } from '../globalRegistry.js' -import { Errors } from '../lib/errors/__.js' -import type { RootTypeName, Variables } from '../lib/graphql.js' -import { isPlainObject } from '../lib/prelude.js' -import type { Object$2 } from '../Schema/__.js' -import { Schema } from '../Schema/__.js' -import { readMaybeThunk } from '../Schema/core/helpers.js' +import request from '../../entrypoints/main.js' +import type { GlobalRegistry } from '../2_generator/globalRegistry.js' +import { Errors } from '../../lib/errors/__.js' +import type { RootTypeName, Variables } from '../../lib/graphql.js' +import { isPlainObject } from '../../lib/prelude.js' +import type { Object$2 } from '../1_Schema/__.js' +import { Schema } from '../1_Schema/__.js' +import { readMaybeThunk } from '../1_Schema/core/helpers.js' import type { ApplyInputDefaults, Config, @@ -20,8 +20,8 @@ import * as CustomScalars from './customScalars.js' import type { DocumentFn } from './document.js' import { rootTypeNameToOperationName, toDocumentString } from './document.js' import type { GetRootTypeMethods } from './RootTypeMethods.js' -import { SelectionSet } from './SelectionSet/__.js' -import type { Context, DocumentObject, GraphQLObjectSelection } from './SelectionSet/toGraphQLDocumentString.js' +import { SelectionSet } from '../3_IO/SelectionSet/__.js' +import type { Context, DocumentObject, GraphQLObjectSelection } from '../3_IO/SelectionSet/toGraphQLDocumentString.js' // dprint-ignore export type Client<$Index extends Schema.Index, $Config extends Config> = diff --git a/src/client/customScalars.ts b/src/layers/4_client/customScalars.ts similarity index 92% rename from src/client/customScalars.ts rename to src/layers/4_client/customScalars.ts index 1856e8e80..af306ed14 100644 --- a/src/client/customScalars.ts +++ b/src/layers/4_client/customScalars.ts @@ -1,12 +1,12 @@ import type { ExecutionResult } from 'graphql' -import { standardScalarTypeNames } from '../lib/graphql.js' -import { mapValues } from '../lib/prelude.js' -import type { Object$2, Schema } from '../Schema/__.js' -import { Output } from '../Schema/__.js' -import { readMaybeThunk } from '../Schema/core/helpers.js' -import type { SelectionSet } from './SelectionSet/__.js' -import type { Args } from './SelectionSet/SelectionSet.js' -import type { GraphQLObjectSelection } from './SelectionSet/toGraphQLDocumentString.js' +import { standardScalarTypeNames } from '../../lib/graphql.js' +import { mapValues } from '../../lib/prelude.js' +import type { Object$2, Schema } from '../1_Schema/__.js' +import { Output } from '../1_Schema/__.js' +import { readMaybeThunk } from '../1_Schema/core/helpers.js' +import type { SelectionSet } from '../3_IO/SelectionSet/__.js' +import type { Args } from '../3_IO/SelectionSet/SelectionSet.js' +import type { GraphQLObjectSelection } from '../3_IO/SelectionSet/toGraphQLDocumentString.js' namespace SSValue { export type Obj = { diff --git a/src/client/document.ts b/src/layers/4_client/document.ts similarity index 92% rename from src/client/document.ts rename to src/layers/4_client/document.ts index c758bb843..71b149596 100644 --- a/src/client/document.ts +++ b/src/layers/4_client/document.ts @@ -1,11 +1,11 @@ import type { MergeExclusive, NonEmptyObject } from 'type-fest' -import type { IsMultipleKeys } from '../lib/prelude.js' -import type { TSError } from '../lib/TSError.js' -import type { Schema } from '../Schema/__.js' +import type { IsMultipleKeys } from '../../lib/prelude.js' +import type { TSError } from '../../lib/TSError.js' +import type { Schema } from '../1_Schema/__.js' import type { AugmentRootTypeSelectionWithTypename, Config, OrThrowifyConfig, ReturnModeRootType } from './Config.js' -import type { ResultSet } from './ResultSet/__.js' -import { SelectionSet } from './SelectionSet/__.js' -import type { Context, DocumentObject } from './SelectionSet/toGraphQLDocumentString.js' +import type { ResultSet } from '../3_IO/ResultSet/__.js' +import { SelectionSet } from '../3_IO/SelectionSet/__.js' +import type { Context, DocumentObject } from '../3_IO/SelectionSet/toGraphQLDocumentString.js' // dprint-ignore export type DocumentFn<$Config extends Config, $Index extends Schema.Index> = diff --git a/src/select.test-d.ts b/src/layers/4_select/select.test-d.ts similarity index 81% rename from src/select.test-d.ts rename to src/layers/4_select/select.test-d.ts index 8231b5a55..348ba65fe 100644 --- a/src/select.test-d.ts +++ b/src/layers/4_select/select.test-d.ts @@ -1,7 +1,7 @@ import { describe, expect, expectTypeOf, it, test } from 'vitest' -import type { Index } from '../tests/_/schema/schema.js' -import type * as SchemaQueryOnly from '../tests/_/schemaQueryOnly/generated/Index.js' -import type { SelectionSet } from './client/SelectionSet/__.js' +import type { Index } from '../../../tests/_/schema/schema.js' +import type * as SchemaQueryOnly from '../../../tests/_/schemaQueryOnly/generated/Index.js' +import type { SelectionSet } from '../3_IO/SelectionSet/__.js' import { create } from './select.js' describe(`select`, () => { diff --git a/src/select.test.ts b/src/layers/4_select/select.test.ts similarity index 86% rename from src/select.test.ts rename to src/layers/4_select/select.test.ts index 9bfeaaf4b..e22f9053a 100644 --- a/src/select.test.ts +++ b/src/layers/4_select/select.test.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import type { Index } from '../tests/_/schema/schema.js' +import type { Index } from '../../../tests/_/schema/schema.js' import { create } from './select.js' const select = create() diff --git a/src/select.ts b/src/layers/4_select/select.ts similarity index 85% rename from src/select.ts rename to src/layers/4_select/select.ts index 6d5122069..b50c8cbc0 100644 --- a/src/select.ts +++ b/src/layers/4_select/select.ts @@ -1,7 +1,7 @@ -import type { SelectionSet } from './client/SelectionSet/__.js' -import type { RootTypeName } from './lib/graphql.js' -import type { Exact } from './lib/prelude.js' -import type { Schema } from './Schema/__.js' +import type { SelectionSet } from '../3_IO/SelectionSet/__.js' +import type { RootTypeName } from '../../lib/graphql.js' +import type { Exact } from '../../lib/prelude.js' +import type { Schema } from '../1_Schema/__.js' // dprint-ignore type TypeSelectionSets<$Index extends Schema.Index> = diff --git a/src/raw/classes/ClientError.ts b/src/legacy/classes/ClientError.ts similarity index 100% rename from src/raw/classes/ClientError.ts rename to src/legacy/classes/ClientError.ts diff --git a/src/raw/classes/GraphQLClient.ts b/src/legacy/classes/GraphQLClient.ts similarity index 100% rename from src/raw/classes/GraphQLClient.ts rename to src/legacy/classes/GraphQLClient.ts diff --git a/src/raw/functions/batchRequests.ts b/src/legacy/functions/batchRequests.ts similarity index 100% rename from src/raw/functions/batchRequests.ts rename to src/legacy/functions/batchRequests.ts diff --git a/src/raw/functions/gql.ts b/src/legacy/functions/gql.ts similarity index 100% rename from src/raw/functions/gql.ts rename to src/legacy/functions/gql.ts diff --git a/src/raw/functions/rawRequest.ts b/src/legacy/functions/rawRequest.ts similarity index 100% rename from src/raw/functions/rawRequest.ts rename to src/legacy/functions/rawRequest.ts diff --git a/src/raw/functions/request.ts b/src/legacy/functions/request.ts similarity index 100% rename from src/raw/functions/request.ts rename to src/legacy/functions/request.ts diff --git a/src/raw/helpers/analyzeDocument.ts b/src/legacy/helpers/analyzeDocument.ts similarity index 100% rename from src/raw/helpers/analyzeDocument.ts rename to src/legacy/helpers/analyzeDocument.ts diff --git a/src/raw/helpers/defaultJsonSerializer.ts b/src/legacy/helpers/defaultJsonSerializer.ts similarity index 100% rename from src/raw/helpers/defaultJsonSerializer.ts rename to src/legacy/helpers/defaultJsonSerializer.ts diff --git a/src/raw/helpers/runRequest.ts b/src/legacy/helpers/runRequest.ts similarity index 100% rename from src/raw/helpers/runRequest.ts rename to src/legacy/helpers/runRequest.ts diff --git a/src/raw/helpers/types.ts b/src/legacy/helpers/types.ts similarity index 100% rename from src/raw/helpers/types.ts rename to src/legacy/helpers/types.ts diff --git a/src/raw/lib/graphql.ts b/src/legacy/lib/graphql.ts similarity index 100% rename from src/raw/lib/graphql.ts rename to src/legacy/lib/graphql.ts diff --git a/tests/_/customScalarCodecs.ts b/tests/_/customScalarCodecs.ts index d335e8a90..114649350 100644 --- a/tests/_/customScalarCodecs.ts +++ b/tests/_/customScalarCodecs.ts @@ -1,5 +1,5 @@ -import { Scalar } from '../../src/Schema/__.js' -import type { Codec } from '../../src/Schema/Hybrid/types/Scalar/codec.js' +import { Scalar } from '../../src/layers/1_Schema/__.js' +import type { Codec } from '../../src/layers/1_Schema/Hybrid/types/Scalar/codec.js' export const Date = Scalar.scalar<'Date', Codec>(`Date`, { encode: value => value.toISOString(), diff --git a/tests/_/schema/generated/Scalar.ts b/tests/_/schema/generated/Scalar.ts index d10ce115b..2e11dcd1c 100644 --- a/tests/_/schema/generated/Scalar.ts +++ b/tests/_/schema/generated/Scalar.ts @@ -1,2 +1,2 @@ -export * from '../../../../src/Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' export * from '../../customScalarCodecs.js' diff --git a/tests/_/schemaGenerate.ts b/tests/_/schemaGenerate.ts index 623b51f66..3661d3ee4 100644 --- a/tests/_/schemaGenerate.ts +++ b/tests/_/schemaGenerate.ts @@ -2,8 +2,8 @@ import type { GraphQLSchema } from 'graphql' import { printSchema } from 'graphql' import fs from 'node:fs/promises' import { dirname, join } from 'node:path' -import type { OptionsInput } from '../../src/generator/code/generateCode.js' -import { generateFiles } from '../../src/generator/files.js' +import type { OptionsInput } from '../../src/layers/2_generator/code/generateCode.js' +import { generateFiles } from '../../src/layers/2_generator/files.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' diff --git a/tests/_/schemaMutationOnly/generated/Scalar.ts b/tests/_/schemaMutationOnly/generated/Scalar.ts index d10ce115b..2e11dcd1c 100644 --- a/tests/_/schemaMutationOnly/generated/Scalar.ts +++ b/tests/_/schemaMutationOnly/generated/Scalar.ts @@ -1,2 +1,2 @@ -export * from '../../../../src/Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' export * from '../../customScalarCodecs.js' diff --git a/tests/_/schemaQueryOnly/generated/Scalar.ts b/tests/_/schemaQueryOnly/generated/Scalar.ts index d10ce115b..2e11dcd1c 100644 --- a/tests/_/schemaQueryOnly/generated/Scalar.ts +++ b/tests/_/schemaQueryOnly/generated/Scalar.ts @@ -1,2 +1,2 @@ -export * from '../../../../src/Schema/Hybrid/types/Scalar/Scalar.js' +export * from '../../../../src/layers/1_Schema/Hybrid/types/Scalar/Scalar.js' export * from '../../customScalarCodecs.js' diff --git a/tests/raw/__helpers.ts b/tests/legacy/__helpers.ts similarity index 100% rename from tests/raw/__helpers.ts rename to tests/legacy/__helpers.ts diff --git a/tests/raw/__snapshots__/document-node.test.ts.snap b/tests/legacy/__snapshots__/document-node.test.ts.snap similarity index 100% rename from tests/raw/__snapshots__/document-node.test.ts.snap rename to tests/legacy/__snapshots__/document-node.test.ts.snap diff --git a/tests/raw/__snapshots__/gql.test.ts.snap b/tests/legacy/__snapshots__/gql.test.ts.snap similarity index 100% rename from tests/raw/__snapshots__/gql.test.ts.snap rename to tests/legacy/__snapshots__/gql.test.ts.snap diff --git a/tests/raw/batching.test.ts b/tests/legacy/batching.test.ts similarity index 100% rename from tests/raw/batching.test.ts rename to tests/legacy/batching.test.ts diff --git a/tests/raw/custom-fetch.test.ts b/tests/legacy/custom-fetch.test.ts similarity index 100% rename from tests/raw/custom-fetch.test.ts rename to tests/legacy/custom-fetch.test.ts diff --git a/tests/raw/document-node.test.ts b/tests/legacy/document-node.test.ts similarity index 100% rename from tests/raw/document-node.test.ts rename to tests/legacy/document-node.test.ts diff --git a/tests/raw/endpoint.test.ts b/tests/legacy/endpoint.test.ts similarity index 100% rename from tests/raw/endpoint.test.ts rename to tests/legacy/endpoint.test.ts diff --git a/tests/raw/errorPolicy.test.ts b/tests/legacy/errorPolicy.test.ts similarity index 100% rename from tests/raw/errorPolicy.test.ts rename to tests/legacy/errorPolicy.test.ts diff --git a/tests/raw/fetch.test.ts b/tests/legacy/fetch.test.ts similarity index 100% rename from tests/raw/fetch.test.ts rename to tests/legacy/fetch.test.ts diff --git a/tests/raw/general.test.ts b/tests/legacy/general.test.ts similarity index 100% rename from tests/raw/general.test.ts rename to tests/legacy/general.test.ts diff --git a/tests/raw/gql.test.ts b/tests/legacy/gql.test.ts similarity index 100% rename from tests/raw/gql.test.ts rename to tests/legacy/gql.test.ts diff --git a/tests/raw/headers.test.ts b/tests/legacy/headers.test.ts similarity index 100% rename from tests/raw/headers.test.ts rename to tests/legacy/headers.test.ts diff --git a/tests/raw/httpMethod.test.ts b/tests/legacy/httpMethod.test.ts similarity index 92% rename from tests/raw/httpMethod.test.ts rename to tests/legacy/httpMethod.test.ts index d1a75b918..08b61dd1f 100644 --- a/tests/raw/httpMethod.test.ts +++ b/tests/legacy/httpMethod.test.ts @@ -1,7 +1,7 @@ import { expect, test, vitest } from 'vitest' import { gql, GraphQLClient } from '../../src/entrypoints/main.js' import { CONTENT_TYPE_HEADER, statusCodes } from '../../src/lib/http.js' -import type { RequestConfig } from '../../src/raw/helpers/types.js' +import type { RequestConfig } from '../../src/legacy/helpers/types.js' test(`mutation forces a POST method even if input wants GET for query`, async () => { const fetch = vitest.fn().mockImplementation((_: string, requestConfig: RequestConfig) => { diff --git a/tests/raw/json-serializer.test.ts b/tests/legacy/json-serializer.test.ts similarity index 97% rename from tests/raw/json-serializer.test.ts rename to tests/legacy/json-serializer.test.ts index 841de00d5..b0e40c4eb 100644 --- a/tests/raw/json-serializer.test.ts +++ b/tests/legacy/json-serializer.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, test, vitest } from 'vitest' import { GraphQLClient } from '../../src/entrypoints/main.js' import { CONTENT_TYPE_HEADER, statusCodes } from '../../src/lib/http.js' -import type { Fetch, Variables } from '../../src/raw/helpers/types.js' +import type { Fetch, Variables } from '../../src/legacy/helpers/types.js' import { setupMockServer } from './__helpers.js' const ctx = setupMockServer() diff --git a/tests/raw/signal.test.ts b/tests/legacy/signal.test.ts similarity index 100% rename from tests/raw/signal.test.ts rename to tests/legacy/signal.test.ts diff --git a/tests/raw/typed-document-node.test.ts b/tests/legacy/typed-document-node.test.ts similarity index 100% rename from tests/raw/typed-document-node.test.ts rename to tests/legacy/typed-document-node.test.ts From 03adb2b0e0a0afc765e0bea2bf0a9cdd9d3e9939 Mon Sep 17 00:00:00 2001 From: Jason Kuhrt Date: Sat, 27 Apr 2024 16:53:18 -0400 Subject: [PATCH 2/2] format --- src/entrypoints/alpha/schema.ts | 2 +- src/layers/4_client/Config.ts | 2 +- src/layers/4_client/RootTypeMethods.ts | 4 ++-- src/layers/4_client/client.ts | 6 +++--- src/layers/4_client/document.ts | 2 +- src/layers/4_select/select.ts | 2 +- tests/legacy/httpMethod.test.ts | 2 +- tests/legacy/json-serializer.test.ts | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/entrypoints/alpha/schema.ts b/src/entrypoints/alpha/schema.ts index 4812cc12e..16d24cbe4 100644 --- a/src/entrypoints/alpha/schema.ts +++ b/src/entrypoints/alpha/schema.ts @@ -1,3 +1,3 @@ +export * from '../../layers/1_Schema/__.js' export { ResultSet } from '../../layers/3_IO/ResultSet/__.js' export { SelectionSet } from '../../layers/3_IO/SelectionSet/__.js' -export * from '../../layers/1_Schema/__.js' diff --git a/src/layers/4_client/Config.ts b/src/layers/4_client/Config.ts index e9ff96b10..c052af3bb 100644 --- a/src/layers/4_client/Config.ts +++ b/src/layers/4_client/Config.ts @@ -1,8 +1,8 @@ import type { ExecutionResult } from 'graphql' -import type { GlobalRegistry } from '../2_generator/globalRegistry.js' import type { GraphQLExecutionResultError } from '../../lib/graphql.js' import type { SetProperty } from '../../lib/prelude.js' import type { Schema } from '../1_Schema/__.js' +import type { GlobalRegistry } from '../2_generator/globalRegistry.js' export type ReturnModeType = | ReturnModeTypeGraphQL diff --git a/src/layers/4_client/RootTypeMethods.ts b/src/layers/4_client/RootTypeMethods.ts index f145e52ac..694d207d1 100644 --- a/src/layers/4_client/RootTypeMethods.ts +++ b/src/layers/4_client/RootTypeMethods.ts @@ -2,6 +2,8 @@ import type { OperationName } from '../../lib/graphql.js' import type { Exact } from '../../lib/prelude.js' import type { TSError } from '../../lib/TSError.js' import type { InputFieldsAllNullable, Schema } from '../1_Schema/__.js' +import type { ResultSet } from '../3_IO/ResultSet/__.js' +import type { SelectionSet } from '../3_IO/SelectionSet/__.js' import type { AugmentRootTypeSelectionWithTypename, Config, @@ -10,8 +12,6 @@ import type { ReturnModeRootField, ReturnModeRootType, } from './Config.js' -import type { ResultSet } from '../3_IO/ResultSet/__.js' -import type { SelectionSet } from '../3_IO/SelectionSet/__.js' type RootTypeFieldContext = { Config: Config diff --git a/src/layers/4_client/client.ts b/src/layers/4_client/client.ts index ca77dec68..893a68510 100644 --- a/src/layers/4_client/client.ts +++ b/src/layers/4_client/client.ts @@ -2,13 +2,15 @@ import type { ExecutionResult } from 'graphql' import { type DocumentNode, execute, graphql, type GraphQLSchema } from 'graphql' import type { ExcludeUndefined } from 'type-fest/source/required-deep.js' import request from '../../entrypoints/main.js' -import type { GlobalRegistry } from '../2_generator/globalRegistry.js' import { Errors } from '../../lib/errors/__.js' import type { RootTypeName, Variables } from '../../lib/graphql.js' import { isPlainObject } from '../../lib/prelude.js' import type { Object$2 } from '../1_Schema/__.js' import { Schema } from '../1_Schema/__.js' import { readMaybeThunk } from '../1_Schema/core/helpers.js' +import type { GlobalRegistry } from '../2_generator/globalRegistry.js' +import { SelectionSet } from '../3_IO/SelectionSet/__.js' +import type { Context, DocumentObject, GraphQLObjectSelection } from '../3_IO/SelectionSet/toGraphQLDocumentString.js' import type { ApplyInputDefaults, Config, @@ -20,8 +22,6 @@ import * as CustomScalars from './customScalars.js' import type { DocumentFn } from './document.js' import { rootTypeNameToOperationName, toDocumentString } from './document.js' import type { GetRootTypeMethods } from './RootTypeMethods.js' -import { SelectionSet } from '../3_IO/SelectionSet/__.js' -import type { Context, DocumentObject, GraphQLObjectSelection } from '../3_IO/SelectionSet/toGraphQLDocumentString.js' // dprint-ignore export type Client<$Index extends Schema.Index, $Config extends Config> = diff --git a/src/layers/4_client/document.ts b/src/layers/4_client/document.ts index 71b149596..cd627f5ce 100644 --- a/src/layers/4_client/document.ts +++ b/src/layers/4_client/document.ts @@ -2,10 +2,10 @@ import type { MergeExclusive, NonEmptyObject } from 'type-fest' import type { IsMultipleKeys } from '../../lib/prelude.js' import type { TSError } from '../../lib/TSError.js' import type { Schema } from '../1_Schema/__.js' -import type { AugmentRootTypeSelectionWithTypename, Config, OrThrowifyConfig, ReturnModeRootType } from './Config.js' import type { ResultSet } from '../3_IO/ResultSet/__.js' import { SelectionSet } from '../3_IO/SelectionSet/__.js' import type { Context, DocumentObject } from '../3_IO/SelectionSet/toGraphQLDocumentString.js' +import type { AugmentRootTypeSelectionWithTypename, Config, OrThrowifyConfig, ReturnModeRootType } from './Config.js' // dprint-ignore export type DocumentFn<$Config extends Config, $Index extends Schema.Index> = diff --git a/src/layers/4_select/select.ts b/src/layers/4_select/select.ts index b50c8cbc0..eb5108649 100644 --- a/src/layers/4_select/select.ts +++ b/src/layers/4_select/select.ts @@ -1,7 +1,7 @@ -import type { SelectionSet } from '../3_IO/SelectionSet/__.js' import type { RootTypeName } from '../../lib/graphql.js' import type { Exact } from '../../lib/prelude.js' import type { Schema } from '../1_Schema/__.js' +import type { SelectionSet } from '../3_IO/SelectionSet/__.js' // dprint-ignore type TypeSelectionSets<$Index extends Schema.Index> = diff --git a/tests/legacy/httpMethod.test.ts b/tests/legacy/httpMethod.test.ts index 08b61dd1f..832298624 100644 --- a/tests/legacy/httpMethod.test.ts +++ b/tests/legacy/httpMethod.test.ts @@ -1,7 +1,7 @@ import { expect, test, vitest } from 'vitest' import { gql, GraphQLClient } from '../../src/entrypoints/main.js' -import { CONTENT_TYPE_HEADER, statusCodes } from '../../src/lib/http.js' import type { RequestConfig } from '../../src/legacy/helpers/types.js' +import { CONTENT_TYPE_HEADER, statusCodes } from '../../src/lib/http.js' test(`mutation forces a POST method even if input wants GET for query`, async () => { const fetch = vitest.fn().mockImplementation((_: string, requestConfig: RequestConfig) => { diff --git a/tests/legacy/json-serializer.test.ts b/tests/legacy/json-serializer.test.ts index b0e40c4eb..8d18a8122 100644 --- a/tests/legacy/json-serializer.test.ts +++ b/tests/legacy/json-serializer.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, test, vitest } from 'vitest' import { GraphQLClient } from '../../src/entrypoints/main.js' -import { CONTENT_TYPE_HEADER, statusCodes } from '../../src/lib/http.js' import type { Fetch, Variables } from '../../src/legacy/helpers/types.js' +import { CONTENT_TYPE_HEADER, statusCodes } from '../../src/lib/http.js' import { setupMockServer } from './__helpers.js' const ctx = setupMockServer()