Skip to content

Commit

Permalink
feat(config): prefill schema URL (#1016)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt authored Aug 4, 2024
1 parent 3866f11 commit c1f08d0
Show file tree
Hide file tree
Showing 36 changed files with 243 additions and 482 deletions.
4 changes: 1 addition & 3 deletions examples/config-fetch.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* eslint-disable */
import { SocialStudies } from './generated-clients/SocialStudies/__.js'

// todo: if used introspection query to get schema, then default schema to that URL.
// todo: https://github.com/jasonkuhrt/graphql-request/issues/1015
const socialStudies = SocialStudies.create({ schema: `https://countries.trevorblades.com/graphql` })
const socialStudies = SocialStudies.create()
.use({
name: `CustomFetch`,
anyware: async ({ exchange }) => {
Expand Down
1 change: 0 additions & 1 deletion examples/config-http-headers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { SocialStudies } from './generated-clients/SocialStudies/__.js'

const socialStudies = SocialStudies.create({
schema: `https://countries.trevorblades.com/graphql`,
headers: {
authorization: `Bearer MY_TOKEN`,
},
Expand Down
4 changes: 2 additions & 2 deletions examples/generated-clients/SocialStudies/Client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createPrefilled } from '../../../src/entrypoints/alpha/client.js'

import { $Index } from './SchemaRuntime.js'
import { $defaultSchemaUrl, $Index } from './SchemaRuntime.js'

export const create = createPrefilled(`SocialStudies`, $Index)
export const create = createPrefilled(`SocialStudies`, $Index, $defaultSchemaUrl)
4 changes: 4 additions & 0 deletions examples/generated-clients/SocialStudies/Global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ declare global {
featureOptions: {
schemaErrors: true
}
/**
* https://countries.trevorblades.com/graphql
*/
defaultSchemaUrl: string
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions examples/generated-clients/SocialStudies/SchemaRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import * as $ from '../../../src/entrypoints/alpha/schema.js'
import * as $Scalar from './Scalar.js'

export const $defaultSchemaUrl = new URL('https://countries.trevorblades.com/graphql')

export const ContinentFilterInput = $.InputObject(`ContinentFilterInput`, {
code: $.Input.field(() => $.Input.Nullable(StringQueryOperatorInput)),
})
Expand Down
5 changes: 0 additions & 5 deletions examples/generated-clients/countries/Client.ts

This file was deleted.

14 changes: 0 additions & 14 deletions examples/generated-clients/countries/Error.ts

This file was deleted.

15 changes: 0 additions & 15 deletions examples/generated-clients/countries/Global.ts

This file was deleted.

30 changes: 0 additions & 30 deletions examples/generated-clients/countries/Index.ts

This file was deleted.

1 change: 0 additions & 1 deletion examples/generated-clients/countries/Scalar.ts

This file was deleted.

154 changes: 0 additions & 154 deletions examples/generated-clients/countries/SchemaBuildtime.ts

This file was deleted.

124 changes: 0 additions & 124 deletions examples/generated-clients/countries/SchemaRuntime.ts

This file was deleted.

Loading

0 comments on commit c1f08d0

Please sign in to comment.