Skip to content

Commit

Permalink
feat(extension/document-builder): make document-builder an extension (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt authored Dec 30, 2024
1 parent 32fad71 commit 6417878
Show file tree
Hide file tree
Showing 152 changed files with 8,523 additions and 10,267 deletions.
4,524 changes: 1,015 additions & 3,509 deletions bundle-sizes/bare/bundle-stats.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle-sizes/bare/bundle-visualization.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle-sizes/bare/bundle.js

Large diffs are not rendered by default.

4,385 changes: 2,166 additions & 2,219 deletions bundle-sizes/basic/bundle-stats.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle-sizes/basic/bundle-visualization.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle-sizes/basic/bundle.js

Large diffs are not rendered by default.

3,790 changes: 1,865 additions & 1,925 deletions bundle-sizes/minimal/bundle-stats.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle-sizes/minimal/bundle-visualization.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundle-sizes/minimal/bundle.js

Large diffs are not rendered by default.

22 changes: 13 additions & 9 deletions examples/$/graffle/modules/client.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { DocumentBuilder } from 'graffle/extensions/document-builder'
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.empty,
name: $$Data.Name,
schemaMap: $$SchemaDrivenDataMap.schemaDrivenDataMap,
scalars: $$Scalar.$registry,
},
TransportHttp({
url: $$Data.defaultSchemaUrl,
}),
$$Utilities.useReducer(
{
...$$Utilities.Context.States.empty,
name: $$Data.Name,
schemaMap: $$SchemaDrivenDataMap.schemaDrivenDataMap,
scalars: $$Scalar.$registry,
},
TransportHttp({
url: $$Data.defaultSchemaUrl,
}),
),
DocumentBuilder(),
)

export const create = $$Utilities.createConstructorWithContext(
Expand Down
43 changes: 33 additions & 10 deletions examples/$/graffle/modules/methods-root.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
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'
Expand All @@ -12,7 +11,10 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
& (null | {})
& $$Utilities.HandleOutput<
$Context,
InferResult.OperationQuery<$$Utilities.AssertExtendsObject<$SelectionSet>, $$Schema.Schema<$Context['scalars']>>
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
$$Utilities.AssertExtendsObject<$SelectionSet>,
$$Schema.Schema<$Context['scalars']>
>
>
>
>
Expand All @@ -36,7 +38,10 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
$Context,
InferResult.OperationQuery<{ battles: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>,
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
{ battles: $SelectionSet },
$$Schema.Schema<$Context['scalars']>
>,
'battles'
>
>
Expand All @@ -50,7 +55,10 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
$Context,
InferResult.OperationQuery<{ beings: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>,
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
{ beings: $SelectionSet },
$$Schema.Schema<$Context['scalars']>
>,
'beings'
>
>
Expand All @@ -64,7 +72,10 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
$Context,
InferResult.OperationQuery<{ pokemonByName: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>,
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
{ pokemonByName: $SelectionSet },
$$Schema.Schema<$Context['scalars']>
>,
'pokemonByName'
>
>
Expand All @@ -78,7 +89,10 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
$Context,
InferResult.OperationQuery<{ pokemons: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>,
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
{ pokemons: $SelectionSet },
$$Schema.Schema<$Context['scalars']>
>,
'pokemons'
>
>
Expand All @@ -92,7 +106,10 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
$Context,
InferResult.OperationQuery<{ trainerByName: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>,
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
{ trainerByName: $SelectionSet },
$$Schema.Schema<$Context['scalars']>
>,
'trainerByName'
>
>
Expand All @@ -106,7 +123,10 @@ export interface QueryMethods<$Context extends $$Utilities.Context> {
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
$Context,
InferResult.OperationQuery<{ trainers: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>,
$$Utilities.DocumentBuilder.InferResult.OperationQuery<
{ trainers: $SelectionSet },
$$Schema.Schema<$Context['scalars']>
>,
'trainers'
>
>
Expand All @@ -122,7 +142,7 @@ export interface MutationMethods<$Context extends $$Utilities.Context> {
& (null | {})
& $$Utilities.HandleOutput<
$Context,
InferResult.OperationMutation<
$$Utilities.DocumentBuilder.InferResult.OperationMutation<
$$Utilities.AssertExtendsObject<$SelectionSet>,
$$Schema.Schema<$Context['scalars']>
>
Expand All @@ -149,7 +169,10 @@ export interface MutationMethods<$Context extends $$Utilities.Context> {
& (null | {})
& $$Utilities.HandleOutputGraffleRootField<
$Context,
InferResult.OperationMutation<{ addPokemon: $SelectionSet }, $$Schema.Schema<$Context['scalars']>>,
$$Utilities.DocumentBuilder.InferResult.OperationMutation<
{ addPokemon: $SelectionSet },
$$Schema.Schema<$Context['scalars']>
>,
'addPokemon'
>
>
Expand Down
93 changes: 52 additions & 41 deletions examples/$/graffle/modules/select.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { InferResult } from 'graffle/schema'
import type * as $$Utilities from 'graffle/utilities-for-generated'
import type { OperationTypeNode } from 'graphql'
import * as $$Data from './data.js'
import * as $$Schema from './schema.js'
Expand Down Expand Up @@ -42,65 +42,76 @@ export namespace Select {
// Root
// --------------------------------------------------------------------------------------------------
//
export type Query<$SelectionSet extends $$SelectionSets.Query> = InferResult.Operation<
export type Query<$SelectionSet extends $$SelectionSets.Query> = $$Utilities.DocumentBuilder.InferResult.Operation<
$SelectionSet,
$$Schema.Schema,
OperationTypeNode.QUERY
>
export type Mutation<$SelectionSet extends $$SelectionSets.Mutation> = InferResult.Operation<
$SelectionSet,
$$Schema.Schema,
OperationTypeNode.MUTATION
>
export type Mutation<$SelectionSet extends $$SelectionSets.Mutation> =
$$Utilities.DocumentBuilder.InferResult.Operation<$SelectionSet, $$Schema.Schema, OperationTypeNode.MUTATION>
// OutputObject
// --------------------------------------------------------------------------------------------------
//
export type BattleRoyale<$SelectionSet extends $$SelectionSets.BattleRoyale> = InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['BattleRoyale']
>
export type BattleTrainer<$SelectionSet extends $$SelectionSets.BattleTrainer> = InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['BattleTrainer']
>
export type BattleWild<$SelectionSet extends $$SelectionSets.BattleWild> = InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['BattleWild']
>
export type BattleRoyale<$SelectionSet extends $$SelectionSets.BattleRoyale> =
$$Utilities.DocumentBuilder.InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['BattleRoyale']
>
export type BattleTrainer<$SelectionSet extends $$SelectionSets.BattleTrainer> =
$$Utilities.DocumentBuilder.InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['BattleTrainer']
>
export type BattleWild<$SelectionSet extends $$SelectionSets.BattleWild> =
$$Utilities.DocumentBuilder.InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['BattleWild']
>
export type CombatantMultiPokemon<$SelectionSet extends $$SelectionSets.CombatantMultiPokemon> =
InferResult.OutputObjectLike<$SelectionSet, $$Schema.Schema, $$Schema.Schema['allTypes']['CombatantMultiPokemon']>
$$Utilities.DocumentBuilder.InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['CombatantMultiPokemon']
>
export type CombatantSinglePokemon<$SelectionSet extends $$SelectionSets.CombatantSinglePokemon> =
InferResult.OutputObjectLike<$SelectionSet, $$Schema.Schema, $$Schema.Schema['allTypes']['CombatantSinglePokemon']>
export type Patron<$SelectionSet extends $$SelectionSets.Patron> = InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['Patron']
>
export type Pokemon<$SelectionSet extends $$SelectionSets.Pokemon> = InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['Pokemon']
>
export type Trainer<$SelectionSet extends $$SelectionSets.Trainer> = InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['Trainer']
>
$$Utilities.DocumentBuilder.InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['CombatantSinglePokemon']
>
export type Patron<$SelectionSet extends $$SelectionSets.Patron> =
$$Utilities.DocumentBuilder.InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['Patron']
>
export type Pokemon<$SelectionSet extends $$SelectionSets.Pokemon> =
$$Utilities.DocumentBuilder.InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['Pokemon']
>
export type Trainer<$SelectionSet extends $$SelectionSets.Trainer> =
$$Utilities.DocumentBuilder.InferResult.OutputObjectLike<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['Trainer']
>
// Union
// --------------------------------------------------------------------------------------------------
//
export type Battle<$SelectionSet extends $$SelectionSets.Battle> = InferResult.Union<
export type Battle<$SelectionSet extends $$SelectionSets.Battle> = $$Utilities.DocumentBuilder.InferResult.Union<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['Battle']
>
// Interface
// --------------------------------------------------------------------------------------------------
//
export type Being<$SelectionSet extends $$SelectionSets.Being> = InferResult.Interface<
export type Being<$SelectionSet extends $$SelectionSets.Being> = $$Utilities.DocumentBuilder.InferResult.Interface<
$SelectionSet,
$$Schema.Schema,
$$Schema.Schema['allTypes']['Being']
Expand Down
Loading

0 comments on commit 6417878

Please sign in to comment.