-
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.
- Loading branch information
1 parent
06d3990
commit 23d6080
Showing
67 changed files
with
1,474 additions
and
351 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
File renamed without changes.
File renamed without changes.
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,27 @@ | ||
/** | ||
* This example shows how to write batches of GraphQL root fields (aka. entrypoints) in the TypeScript interface. | ||
*/ | ||
|
||
import { Pokemon } from '../$/generated-clients/pokemon/__.js' | ||
import { showJson } from '../$/helpers.js' | ||
|
||
const pokemon = Pokemon.create() | ||
|
||
// dprint-ignore | ||
const pokemons = await pokemon.query.$batch({ | ||
// ^^^^^^ | ||
pokemonByName: { | ||
//^^^^^^^^^^^^^ | ||
$: { name: `Pikachu` }, | ||
name: true, | ||
id: true, | ||
}, | ||
trainerByName: { | ||
//^^^^^^^^^^^^^ | ||
$: { name: `Ash` }, | ||
name: true, | ||
id: true, | ||
}, | ||
}) | ||
|
||
showJson(pokemons) |
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,42 @@ | ||
/** | ||
* This example shows how to use special fields to write GraphQL document directives. | ||
*/ | ||
|
||
// import { parse, print } from 'graphql' | ||
import { Pokemon } from '../$/generated-clients/pokemon/__.js' | ||
import { showJson } from '../$/helpers.js' | ||
|
||
const pokemon = Pokemon.create() | ||
// .anyware(({ pack }) => { | ||
// console.log(print(parse(pack.input.query))) | ||
// return pack() | ||
// }) | ||
|
||
const pokemons = await pokemon.query.$batch({ | ||
___: { | ||
// $skip: true, | ||
// $defer: true, | ||
pokemons: { | ||
name: true, | ||
}, | ||
}, | ||
trainers: { | ||
// $stream: { | ||
// if: true, | ||
// initialCount: 0, | ||
// label: `trainers`, | ||
// }, | ||
name: true, | ||
id: { | ||
$skip: true, | ||
}, | ||
pokemon: { | ||
id: { | ||
$include: false, | ||
}, | ||
name: true, | ||
}, | ||
}, | ||
}) | ||
|
||
showJson(pokemons) |
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,12 @@ | ||
/** | ||
* This example shows how to use dedicated root field methods to easily operate on one GraphQL root field at at time. If you need to work with multiple root fields, check out the `batch` example. | ||
*/ | ||
|
||
import { Pokemon } from '../$/generated-clients/pokemon/__.js' | ||
import { showJson } from '../$/helpers.js' | ||
|
||
const pokemon = Pokemon.create() | ||
|
||
const pokemons = await pokemon.query.pokemons({ name: true }) | ||
|
||
showJson(pokemons) |
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
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
examples/__outputs__/55_generated/generated_batch.output.txt
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,13 @@ | ||
---------------------------------------- SHOW ---------------------------------------- | ||
{ | ||
"pokemonByName": [ | ||
{ | ||
"name": "Pikachu", | ||
"id": 1 | ||
} | ||
], | ||
"trainerByName": { | ||
"name": "Ash", | ||
"id": 1 | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
examples/__outputs__/55_generated/generated_directive.output.txt
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,38 @@ | ||
---------------------------------------- SHOW ---------------------------------------- | ||
{ | ||
"trainers": [ | ||
{ | ||
"name": "Ash", | ||
"pokemon": [ | ||
{ | ||
"name": "Pikachu" | ||
}, | ||
{ | ||
"name": "Charizard" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Misty", | ||
"pokemon": [ | ||
{ | ||
"name": "Squirtle" | ||
} | ||
] | ||
} | ||
], | ||
"pokemons": [ | ||
{ | ||
"name": "Pikachu" | ||
}, | ||
{ | ||
"name": "Charizard" | ||
}, | ||
{ | ||
"name": "Squirtle" | ||
}, | ||
{ | ||
"name": "Bulbasaur" | ||
} | ||
] | ||
} |
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
examples/__outputs__/55_generated/generated_root-field.output.txt
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,15 @@ | ||
---------------------------------------- SHOW ---------------------------------------- | ||
[ | ||
{ | ||
"name": "Pikachu" | ||
}, | ||
{ | ||
"name": "Charizard" | ||
}, | ||
{ | ||
"name": "Squirtle" | ||
}, | ||
{ | ||
"name": "Bulbasaur" | ||
} | ||
] |
Oops, something went wrong.