-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: preset entrypoints (#1280)
- Loading branch information
1 parent
40d8961
commit d19d399
Showing
208 changed files
with
5,815 additions
and
387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// We import the global module for good measure although it is not clear it is always needed. | ||
// It at least helps with Twoslash wherein without this import here Twoslash will not include the global module. | ||
// In real TypeScript projects it seems the global module is included automatically. But there could be certain tsconfig | ||
// setups where this still indeed does help. | ||
import './modules/global.js' | ||
|
||
export { create } from './modules/client.js' | ||
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js' | ||
export { Select } from './modules/select.js' | ||
export * as SelectionSets from './modules/selection-sets.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * as Graffle from './_.js' | ||
export { schemaDrivenDataMap as schemaMap } from './modules/schema-driven-data-map.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { TransportHttp } from 'graffle/extensions/transport-http' | ||
import * as $$Utilities from 'graffle/utilities-for-generated' | ||
import * as $$Data from './data.js' | ||
import * as $$Scalar from './scalar.js' | ||
import * as $$SchemaDrivenDataMap from './schema-driven-data-map.js' | ||
|
||
const context = $$Utilities.useReducer( | ||
{ | ||
...$$Utilities.Context.States.contextEmpty, | ||
name: $$Data.Name, | ||
schemaMap: $$SchemaDrivenDataMap.schemaDrivenDataMap, | ||
scalars: $$Scalar.$registry, | ||
}, | ||
TransportHttp({ | ||
url: $$Data.defaultSchemaUrl, | ||
}), | ||
) | ||
|
||
export const create = $$Utilities.createConstructorWithContext( | ||
context, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const Name = `default` | ||
export type Name = 'default' | ||
|
||
export const defaultSchemaUrl = new URL('http://localhost:3000/graphql') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as $$Data from './data.js' | ||
import * as $$MethodsDocument from './methods-document.js' | ||
import * as $$MethodsRoot from './methods-root.js' | ||
import * as $$MethodsSelect from './methods-select.js' | ||
import * as $$Schema from './schema.js' | ||
|
||
declare global { | ||
export namespace GraffleGlobal { | ||
export interface Clients { | ||
default: { | ||
name: $$Data.Name | ||
schema: $$Schema.Schema | ||
interfaces: { | ||
MethodsSelect: $$MethodsSelect.$MethodsSelect | ||
Document: $$MethodsDocument.BuilderMethodsDocumentFn | ||
Root: $$MethodsRoot.BuilderMethodsRootFn | ||
} | ||
/** | ||
* http://localhost:3000/graphql | ||
*/ | ||
defaultSchemaUrl: string | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type * as $$Utilities from 'graffle/utilities-for-generated' | ||
import * as $$Schema from './schema.js' | ||
import * as $$SelectionSets from './selection-sets.js' | ||
|
||
export interface Document<$Context extends $$Utilities.Context> { | ||
<$Document>( | ||
document: $$Utilities.ExactNonEmpty<$Document, $$SelectionSets.$Document<$Context['scalars']>>, | ||
): $$Utilities.DocumentRunner< | ||
$Context, | ||
$$Schema.Schema, | ||
// @ts-expect-error We use Exact instead of constraint on this function. TypeScript does not see that as | ||
// Satisfying the constraint on the DocumentRunner type. | ||
$Document | ||
> | ||
} | ||
|
||
export interface BuilderMethodsDocumentFn extends $$Utilities.TypeFunction { | ||
// @ts-expect-error parameter is Untyped. | ||
return: Document<this['params']> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
import type { InferResult } from 'graffle/schema' | ||
import type * as $$Utilities from 'graffle/utilities-for-generated' | ||
import * as $$Schema from './schema.js' | ||
import * as $$SelectionSets from './selection-sets.js' | ||
|
||
export interface QueryMethods<$Context extends $$Utilities.Context> { | ||
$batch: $$Utilities.ClientTransports.PreflightCheck< | ||
$Context, | ||
<$SelectionSet>( | ||
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query<$Context['scalars']>>, | ||
) => Promise< | ||
& (null | {}) | ||
& $$Utilities.HandleOutput< | ||
$Context, | ||
InferResult.OperationQuery<$$Utilities.AssertExtendsObject<$SelectionSet>, $$Schema.Schema<$Context['scalars']>> | ||
> | ||
> | ||
> | ||
__typename: $$Utilities.ClientTransports.PreflightCheck< | ||
$Context, | ||
() => Promise< | ||
& (null | {}) | ||
& $$Utilities.HandleOutputGraffleRootField< | ||
$Context, | ||
{ __typename: 'Query' }, | ||
'__typename' | ||
> | ||
> | ||
> | ||
|
||
battles: $$Utilities.ClientTransports.PreflightCheck< | ||
$Context, | ||
<$SelectionSet>( | ||
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.battles<$Context['scalars']>>, | ||
) => Promise< | ||
& (null | {}) | ||
& $$Utilities.HandleOutputGraffleRootField< | ||
$Context, | ||
InferResult.OperationQuery<{ battles: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, | ||
'battles' | ||
> | ||
> | ||
> | ||
|
||
beings: $$Utilities.ClientTransports.PreflightCheck< | ||
$Context, | ||
<$SelectionSet>( | ||
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.beings<$Context['scalars']>>, | ||
) => Promise< | ||
& (null | {}) | ||
& $$Utilities.HandleOutputGraffleRootField< | ||
$Context, | ||
InferResult.OperationQuery<{ beings: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, | ||
'beings' | ||
> | ||
> | ||
> | ||
|
||
pokemonByName: $$Utilities.ClientTransports.PreflightCheck< | ||
$Context, | ||
<$SelectionSet>( | ||
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemonByName<$Context['scalars']>>, | ||
) => Promise< | ||
& (null | {}) | ||
& $$Utilities.HandleOutputGraffleRootField< | ||
$Context, | ||
InferResult.OperationQuery<{ pokemonByName: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, | ||
'pokemonByName' | ||
> | ||
> | ||
> | ||
|
||
pokemons: $$Utilities.ClientTransports.PreflightCheck< | ||
$Context, | ||
<$SelectionSet>( | ||
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.pokemons<$Context['scalars']>>, | ||
) => Promise< | ||
& (null | {}) | ||
& $$Utilities.HandleOutputGraffleRootField< | ||
$Context, | ||
InferResult.OperationQuery<{ pokemons: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, | ||
'pokemons' | ||
> | ||
> | ||
> | ||
|
||
trainerByName: $$Utilities.ClientTransports.PreflightCheck< | ||
$Context, | ||
<$SelectionSet>( | ||
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.trainerByName<$Context['scalars']>>, | ||
) => Promise< | ||
& (null | {}) | ||
& $$Utilities.HandleOutputGraffleRootField< | ||
$Context, | ||
InferResult.OperationQuery<{ trainerByName: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, | ||
'trainerByName' | ||
> | ||
> | ||
> | ||
|
||
trainers: $$Utilities.ClientTransports.PreflightCheck< | ||
$Context, | ||
<$SelectionSet>( | ||
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Query.trainers<$Context['scalars']>>, | ||
) => Promise< | ||
& (null | {}) | ||
& $$Utilities.HandleOutputGraffleRootField< | ||
$Context, | ||
InferResult.OperationQuery<{ trainers: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, | ||
'trainers' | ||
> | ||
> | ||
> | ||
} | ||
|
||
export interface MutationMethods<$Context extends $$Utilities.Context> { | ||
$batch: $$Utilities.ClientTransports.PreflightCheck< | ||
$Context, | ||
<$SelectionSet>( | ||
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation<$Context['scalars']>>, | ||
) => Promise< | ||
& (null | {}) | ||
& $$Utilities.HandleOutput< | ||
$Context, | ||
InferResult.OperationMutation< | ||
$$Utilities.AssertExtendsObject<$SelectionSet>, | ||
$$Schema.Schema<$Context['scalars']> | ||
> | ||
> | ||
> | ||
> | ||
__typename: $$Utilities.ClientTransports.PreflightCheck< | ||
$Context, | ||
() => Promise< | ||
& (null | {}) | ||
& $$Utilities.HandleOutputGraffleRootField< | ||
$Context, | ||
{ __typename: 'Mutation' }, | ||
'__typename' | ||
> | ||
> | ||
> | ||
|
||
addPokemon: $$Utilities.ClientTransports.PreflightCheck< | ||
$Context, | ||
<$SelectionSet>( | ||
selectionSet: $$Utilities.Exact<$SelectionSet, $$SelectionSets.Mutation.addPokemon<$Context['scalars']>>, | ||
) => Promise< | ||
& (null | {}) | ||
& $$Utilities.HandleOutputGraffleRootField< | ||
$Context, | ||
InferResult.OperationMutation<{ addPokemon: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>, | ||
'addPokemon' | ||
> | ||
> | ||
> | ||
} | ||
|
||
export interface BuilderMethodsRoot<$Context extends $$Utilities.Context> { | ||
query: QueryMethods<$Context> | ||
mutation: MutationMethods<$Context> | ||
} | ||
|
||
export interface BuilderMethodsRootFn extends $$Utilities.TypeFunction { | ||
// @ts-expect-error parameter is Untyped. | ||
return: BuilderMethodsRoot<this['params']> | ||
} |
Oops, something went wrong.