-
Notifications
You must be signed in to change notification settings - Fork 2
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
d4279f4
commit 8b426b3
Showing
3 changed files
with
96 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export type RawField = { | ||
name: string | ||
type: RawType | ||
} | ||
export type RawType = { | ||
name: string | null | undefined | ||
kind: string | ||
ofType?: RawType | null | undefined | ||
fields?: Array<RawField> | null | undefined | ||
} | ||
export type Field = { | ||
name: string | ||
type: Type | ||
parent: Type | ||
} | ||
export type Type = { | ||
name: string | null | undefined | ||
kind: string | ||
ofType?: Type | null | undefined | ||
fields?: | ||
| { | ||
[name: string]: Field | ||
} | ||
| null | ||
| undefined | ||
parents?: Array<Field> | ||
} | ||
export type Types = { | ||
[name: string]: Type | ||
} |
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 { ApolloClient } from 'apollo-client' | ||
import type { Types } from './getSchemaTypes' | ||
import typesQuery, { TypeMetadata } from './typesQuery' | ||
export { typesQuery } | ||
export type { TypeMetadata } | ||
|
||
type Term = [string, any, string | null | undefined] | [string, any] | [string] | ||
|
||
declare const refetch: { | ||
( | ||
client: unknown, | ||
typenameOrTerms: string | ReadonlyArray<Term>, | ||
predicate?: any | null, | ||
idField?: string | ||
): Promise<any> | ||
fetchTypeMetadata(client: ApolloClient<any>): Promise<Types> | ||
setTypeMetadata(metadata: Promise<TypeMetadata> | TypeMetadata): void | ||
} | ||
|
||
export default refetch |
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,46 @@ | ||
import { DocumentNode } from 'graphql' | ||
declare const typesQuery: DocumentNode | ||
export default typesQuery | ||
|
||
type __TypeKind = | ||
| 'SCALAR' | ||
| 'OBJECT' | ||
| 'INTERFACE' | ||
| 'UNION' | ||
| 'ENUM' | ||
| 'INPUT_OBJECT' | ||
| 'LIST' | ||
| 'NON_NULL' | ||
|
||
export type TypeMetadata = { | ||
data: { | ||
__schema: { | ||
types: Array<{ | ||
name: string | null | undefined | ||
fields: Array<{ | ||
name: string | ||
type: | ||
| { | ||
name: string | null | undefined | ||
kind: __TypeKind | ||
ofType: | ||
| { | ||
name: string | null | undefined | ||
kind: __TypeKind | ||
ofType: | ||
| { | ||
name: string | null | undefined | ||
} | ||
| null | ||
| undefined | ||
} | ||
| null | ||
| undefined | ||
} | ||
| null | ||
| undefined | ||
}> | ||
}> | ||
} | ||
} | ||
} |