Skip to content

Commit

Permalink
refactor: start grouping document builder code
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt committed Oct 22, 2024
1 parent 01b9979 commit a3521fb
Show file tree
Hide file tree
Showing 62 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { mergeObjectArray, ValuesOrEmptyObject } from '../../lib/prelude.js'
import type { Schema } from '../../types/Schema/__.js'
import type { Select } from '../2_Select/__.js'
import type { Select } from '../Select/__.js'
import type { OutputField } from './OutputField.js'

// dprint-ignore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type GetKeyOr } from '../../lib/prelude.js'
import type { Schema } from '../../types/Schema/__.js'
import type { Select } from '../2_Select/__.js'
import type { Select } from '../Select/__.js'
import type { Object } from './OutputObject.js'

// dprint-ignore
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Simplify } from 'type-fest'
import type { TSErrorDescriptive } from '../../lib/ts-error.js'
import type { Schema } from '../../types/Schema/__.js'
import type { InlineType } from '../../types/SchemaDrivenDataMap/InlineType.js'
import type { Select } from '../2_Select/__.js'
import type { Select } from '../Select/__.js'
import type { Interface } from './Interface.js'
import type { Object } from './OutputObject.js'
import type { Union } from './Union.js'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Simplify } from 'type-fest'
import { type StringKeyof } from '../../lib/prelude.js'
import type { TSErrorDescriptive } from '../../lib/ts-error.js'
import type { Schema } from '../../types/Schema/__.js'
import type { Select } from '../2_Select/__.js'
import type { Select } from '../Select/__.js'
import type { Alias } from './Alias.js'
import type { OutputField } from './OutputField.js'
import type { ScalarsWildcard } from './ScalarsWildcard.js'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Schema, SchemaDrivenDataMap } from '../../../entrypoints/utilities-for-generated.js'
import type { Grafaid } from '../../../lib/grafaid/__.js'
import { Nodes } from '../../../lib/grafaid/_Nodes.js'
import type { Select } from '../../2_Select/__.js'
import type { Select } from '../../Select/__.js'
import { toGraphQLOperationDefinition } from './2_OperationDefinition.js'

const defaultOperationName = `$default`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Grafaid } from '../../../lib/grafaid/__.js'
import { Nodes } from '../../../lib/grafaid/_Nodes.js'
import type { SchemaDrivenDataMap } from '../../../types/SchemaDrivenDataMap/__.js'
import type { Select } from '../../2_Select/__.js'
import type { Select } from '../../Select/__.js'
import { createOperationContext } from '../context.js'
import { type GraphQLPreOperationMapper } from '../mapper.js'
import type { Options } from './1_Document.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Nodes } from '../../../lib/grafaid/_Nodes.js'
import type { SchemaDrivenDataMap } from '../../../types/SchemaDrivenDataMap/__.js'
import { Select } from '../../2_Select/__.js'
import { Select } from '../../Select/__.js'
import { type GraphQLPostOperationMapper } from '../mapper.js'
import { fromGraffleSelectionObjectLevel } from './4_GraffleSelectionObjectLevel.js'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Grafaid } from '../../../lib/grafaid/__.js'
import { Nodes } from '../../../lib/grafaid/_Nodes.js'
import { casesExhausted, isNonNull } from '../../../lib/prelude.js'
import type { SchemaDrivenDataMap } from '../../../types/SchemaDrivenDataMap/__.js'
import type { ParsedSelectionObjectLevel } from '../../2_Select/_.js'
import type { ParsedSelectionObjectLevel } from '../../Select/_.js'
import type { GraphQLPostOperationMapper } from '../mapper.js'
import { toGraphQLField } from './5_Field.js'
import { toGraphQLInlineFragments } from './5_InlineFragments.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Nodes } from '../../../lib/grafaid/_Nodes.js'
import { SchemaDrivenDataMap } from '../../../types/SchemaDrivenDataMap/__.js'
import { Select } from '../../2_Select/__.js'
import { Select } from '../../Select/__.js'
import type { GraphQLPostOperationMapper } from '../mapper.js'
import { collectForInlineFragmentLike } from './_collect.js'
import { toGraphQLArgument } from './Argument.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { SchemaDrivenDataMap } from '../../../entrypoints/utilities-for-generated.js'
import type { Grafaid } from '../../../lib/grafaid/__.js'
import { Nodes } from '../../../lib/grafaid/_Nodes.js'
import { Select } from '../../2_Select/__.js'
import { Select } from '../../Select/__.js'
import type { GraphQLPostOperationMapper } from '../mapper.js'
import { collectForInlineFragmentLike } from './_collect.js'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Nodes } from '../../../lib/grafaid/_Nodes.js'
import type { SchemaDrivenDataMap } from '../../../types/SchemaDrivenDataMap/__.js'
import { Select } from '../../2_Select/__.js'
import { Select } from '../../Select/__.js'
import { type GraphQLPostOperationMapper } from '../mapper.js'
import { toGraphQLValue } from './Value.js'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { SchemaDrivenDataMap } from '../../../entrypoints/utilities-for-generated.js'
import { Nodes } from '../../../lib/grafaid/_Nodes.js'
import type { Select } from '../../2_Select/__.js'
import type { Select } from '../../Select/__.js'
import type { GraphQLPostOperationMapper } from '../mapper.js'
import { toGraphQLValue } from './Value.js'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Grafaid } from '../../../lib/grafaid/__.js'
import type { SchemaDrivenDataMap } from '../../../types/SchemaDrivenDataMap/__.js'
import type { Select } from '../../2_Select/__.js'
import type { Select } from '../../Select/__.js'
import type { GraphQLPostOperationMapper } from '../mapper.js'
import { fromGraffleSelectionObjectLevel } from './4_GraffleSelectionObjectLevel.js'
import { toGraphQLDirective } from './Directive.js'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { schemaDrivenDataMap } from '../../../tests/_/schemas/kitchen-sink/graff
import type * as SelectionSets from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SelectionSets.js'
import { Grafaid } from '../../lib/grafaid/__.js'
import type { Schema } from '../../types/Schema/__.js'
import { Select } from '../2_Select/__.js'
import { Select } from '../Select/__.js'
import { toGraphQLDocument } from './nodes/1_Document.js'

type CasesDescriptiveQuery = [
Expand Down
2 changes: 1 addition & 1 deletion src/entrypoints/_Print.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { toGraphQLDocument as document } from '../layers/3_SelectGraphQLMapper/nodes/1_Document.js'
export { toGraphQLDocument as document } from '../documentBuilder/SelectGraphQLMapper/nodes/1_Document.js'
4 changes: 2 additions & 2 deletions src/entrypoints/schema.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { Select } from '../layers/2_Select/__.js'
export { InferResult } from '../layers/3_InferResult/__.js'
export { InferResult } from '../documentBuilder/InferResult/__.js'
export { Select } from '../documentBuilder/Select/__.js'
export * from '../types/Schema/__.js'
2 changes: 1 addition & 1 deletion src/entrypoints/utilities-for-generated.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { type Simplify } from 'type-fest'
export * from '../layers/2_Select/__.js'
export * from '../documentBuilder/Select/__.js'
export { type ClientContext } from '../layers/6_client/fluent.js'
export type {
ConfigGetOutputError,
Expand Down
4 changes: 2 additions & 2 deletions src/extensions/CustomScalars/decode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Date } from '../../../tests/_/fixtures/scalars.js'
import { createResponse, test } from '../../../tests/_/helpers.js'
import { db } from '../../../tests/_/schemas/db.js'
import type { Graffle } from '../../../tests/_/schemas/kitchen-sink/graffle/__.js'
import { Select } from '../../layers/2_Select/__.js'
import { SelectionSetGraphqlMapper } from '../../layers/3_SelectGraphQLMapper/__.js'
import { Select } from '../../documentBuilder/Select/__.js'
import { SelectionSetGraphqlMapper } from '../../documentBuilder/SelectGraphQLMapper/__.js'
import { Grafaid } from '../../lib/grafaid/__.js'

type TestCase = [
Expand Down
4 changes: 2 additions & 2 deletions src/extensions/CustomScalars/encode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { db } from '../../../tests/_/schemas/db.js'
import type { Graffle } from '../../../tests/_/schemas/kitchen-sink/graffle/__.js'
import { schemaDrivenDataMap } from '../../../tests/_/schemas/kitchen-sink/graffle/modules/SchemaDrivenDataMap.js'
import { Spy } from '../../../tests/_/SpyExtension.js'
import { Select } from '../../layers/2_Select/__.js'
import { SelectionSetGraphqlMapper } from '../../layers/3_SelectGraphQLMapper/__.js'
import { Select } from '../../documentBuilder/Select/__.js'
import { SelectionSetGraphqlMapper } from '../../documentBuilder/SelectGraphQLMapper/__.js'
import { Grafaid } from '../../lib/grafaid/__.js'

type TestCase = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from 'vitest'
import { normalizeOrThrow } from '../../layers/2_Select/document.js'
import { SelectionSetGraphqlMapper } from '../../layers/3_SelectGraphQLMapper/__.js'
import { normalizeOrThrow } from '../../documentBuilder/Select/document.js'
import { SelectionSetGraphqlMapper } from '../../documentBuilder/SelectGraphQLMapper/__.js'
import { graffleMappedResultToRequest } from '../../layers/5_request/core.js'
import { injectTypenameOnRootResultFields } from './injectTypenameOnRootResultFields.js'
import { GraffleSchemaErrors } from './tests/fixture/graffle/__.js'
Expand Down
2 changes: 1 addition & 1 deletion src/generator/generators/SelectionSets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// todo: on union fields, JSDoc that mentions the syntax `on*`

import { pick } from 'es-toolkit'
import { Select } from '../../layers/2_Select/__.js'
import { Select } from '../../documentBuilder/Select/__.js'
import { Code } from '../../lib/Code.js'
import { Grafaid } from '../../lib/grafaid/__.js'
import { analyzeArgsNullability } from '../../lib/grafaid/schema/args.js'
Expand Down
2 changes: 1 addition & 1 deletion src/layers/5_request/core.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { type ExecutionResult } from 'graphql'
import { SelectionSetGraphqlMapper } from '../../documentBuilder/SelectGraphQLMapper/__.js'
import { Anyware } from '../../lib/anyware/__.js'
import type { Grafaid } from '../../lib/grafaid/__.js'
import { getOperationDefinition, OperationTypeToAccessKind, print } from '../../lib/grafaid/document.js'
Expand All @@ -13,7 +14,6 @@ import {
} from '../../lib/grafaid/http/http.js'
import { mergeRequestInit, searchParamsAppendAll } from '../../lib/http.js'
import { casesExhausted, isString } from '../../lib/prelude.js'
import { SelectionSetGraphqlMapper } from '../3_SelectGraphQLMapper/__.js'
import type { GraffleExecutionResultVar } from '../6_client/handleOutput.js'
import type { Config } from '../6_client/Settings/Config.js'
import { MethodMode, type MethodModeGetReads } from '../6_client/transportHttp/request.js'
Expand Down
2 changes: 1 addition & 1 deletion src/layers/5_request/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { ExecutionResult, GraphQLSchema } from 'graphql'
import type { Select } from '../../documentBuilder/Select/__.js'
import type { Grafaid } from '../../lib/grafaid/__.js'
import type { getRequestEncodeSearchParameters, postRequestEncodeBody } from '../../lib/grafaid/http/http.js'
import type { httpMethodGet, httpMethodPost } from '../../lib/http.js'
import type { Select } from '../2_Select/__.js'
import type { ClientContext } from '../6_client/fluent.js'
import type { Config } from '../6_client/Settings/Config.js'
import type { MethodModeGetReads, MethodModePost } from '../6_client/transportHttp/request.js'
Expand Down
2 changes: 1 addition & 1 deletion src/layers/6_client/extension/extension.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Select } from '../../../documentBuilder/Select/__.js'
import type { Anyware } from '../../../lib/anyware/__.js'
import type { FnProperty } from '../../../lib/fluent/Fluent.js'
import type { AssertConstraint } from '../../../lib/prelude.js'
import type { TypeFunction } from '../../../lib/type-function/__.js'
import type { Fn } from '../../../lib/type-function/TypeFunction.js'
import type { GlobalRegistry } from '../../../types/GlobalRegistry/GlobalRegistry.js'
import type { Select } from '../../2_Select/__.js'
import type { RequestCore } from '../../5_request/__.js'
import type { Client } from '../client.js'
import type { ClientContext } from '../fluent.js'
Expand Down
4 changes: 2 additions & 2 deletions src/layers/6_client/requestMethods/document.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { UnionToTuple } from 'type-fest'
import type { InferResult } from '../../../documentBuilder/InferResult/__.js'
import type { Select } from '../../../documentBuilder/Select/__.js'
import type { Schema } from '../../../entrypoints/schema.js'
import type { IsTupleMultiple } from '../../../lib/prelude.js'
import type { Select } from '../../2_Select/__.js'
import type { InferResult } from '../../3_InferResult/__.js'
import type { ClientContext } from '../fluent.js'
import { type HandleOutput } from '../handleOutput.js'

Expand Down
2 changes: 1 addition & 1 deletion src/layers/6_client/requestMethods/requestMethods.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Select } from '../../../documentBuilder/Select/__.js'
import type { TypeFunction } from '../../../entrypoints/utilities-for-generated.js'
import type { Fluent } from '../../../lib/fluent/__.js'
import type { Grafaid } from '../../../lib/grafaid/__.js'
import { isSymbol } from '../../../lib/prelude.js'
import type { GlobalRegistry } from '../../../types/GlobalRegistry/GlobalRegistry.js'
import { Select } from '../../2_Select/__.js'
import { RequestCore } from '../../5_request/__.js'
import { type ClientContext, defineTerminus } from '../fluent.js'
import { handleOutput } from '../handleOutput.js'
Expand Down

0 comments on commit a3521fb

Please sign in to comment.