-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
parameters.ts
41 lines (32 loc) · 1.07 KB
/
parameters.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import type { DocumentNode } from '@apollo/client'
import type { Transform } from './generic'
import type { GraphQLOptions, RestfulOptions } from './options'
import type { KnownSchema } from './schemas'
export type PackedDocumentNode = Omit<DocumentNode, 'definitions' | 'loc'> & {
definitions: string[]
source?: string
}
export type HeadlessParameter = string | PackedDocumentNode | ApiParameters
export interface HeadlessParameters {
[name: string]: HeadlessParameter
}
export interface VariableParameters {
[name: string]: KnownSchema
}
export interface BaseParameters {
base?: string
variables?: VariableParameters
defaults?: Record<string, unknown>
transforms?: Record<string, Transform>
autoFetchOnInit?: boolean
}
export interface GraphQLParameters extends BaseParameters {
query: PackedDocumentNode
config?: GraphQLOptions
}
export interface RestfulParameters extends BaseParameters {
query: string
config?: RestfulOptions
convertToFormData?: boolean
}
export type ApiParameters = GraphQLParameters | RestfulParameters