-
Notifications
You must be signed in to change notification settings - Fork 202
Expand file tree
/
Copy pathtypes.d.ts
More file actions
175 lines (149 loc) · 4.36 KB
/
types.d.ts
File metadata and controls
175 lines (149 loc) · 4.36 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import type { ClientOptions } from 'graphql-ws'
import type { HttpOptions, DefaultOptions, InMemoryCacheConfig } from '@apollo/client'
import type { CookieOptions } from 'nuxt/app'
export type { ErrorResponse } from '@apollo/client/link/error'
type CookieAttributes = Omit< CookieOptions, 'encode' | 'decode' | 'expires' | 'default'>;
export type ClientConfig = {
/**
* The GraphQL endpoint.
* @type {string}
*/
httpEndpoint: string;
/**
* Provide a GraphQL endpoint to be used client-side. Overrides `httpEndpoint`.
* @type {string}
**/
browserHttpEndpoint?: string;
/**
* Provide additional configuration for the `HttpLink`.
* See https://www.apollographql.com/docs/link/links/http.html#options
* @type {HttpOptions}
**/
httpLinkOptions?: Omit<HttpOptions, 'uri'>;
/**
* Provide additional configuration for the `GraphQLWsLink`.
* See https://github.com/enisdenjo/graphql-ws/blob/master/docs/interfaces/client.ClientOptions.md
**/
wsLinkOptions?: Omit<ClientOptions, 'url' | 'connectionParams'>;
/**
* Specify a websocket endpoint to be used for subscriptions.
* The `wss` protocol is recommended in production.
* @type {string}
**/
wsEndpoint?: string;
// Enable Automatic Query persisting with Apollo Engine
// persisting?: boolean
/**
* Specify if the client should solely use WebSocket.
* requires `wsEndpoint`.
* @type {boolean}
* @default false
**/
websocketsOnly?: boolean;
/**
* Specify if the client should be able to connect to the Apollo Client Devtools in production mode.
* @type {boolean}
* @default false
**/
connectToDevTools?: boolean;
/**
* Configure default options to be applied to the apollo client.
**/
defaultOptions?: DefaultOptions;
/**
* Configure the in-memory cache.
**/
inMemoryCacheOptions?: InMemoryCacheConfig;
/**
* Specify the name under which the token will be stored.
* as in either a cookie or localStorage.
* @type {string}
* @default "apollo:<client-name>.token"
*/
tokenName?: string;
/**
* Specify if the auth token should be stored in `cookie` or `localStorage`.
* `Cookie` storage is required for SSR.
* @type {string}
* @default "cookie"
**/
tokenStorage?: 'cookie' | 'localStorage';
/**
* Specify the Authentication scheme.
* @type {string}
* @default "Bearer"
**/
authType?: string | null;
/**
* Name of the Authentication token header.
* @type {string}
* @default "Authorization"
*/
authHeader?: string;
/**
* Configuration for the auth cookie.
**/
cookieAttributes?: CookieAttributes;
};
export interface NuxtApolloConfig<T = false> {
/**
* Determine if vue-apollo composables should be automatically imported.
* @type {boolean}
* @default true
**/
autoImports?: boolean;
/**
* Configuration of the Apollo clients.
**/
clients?: Record< string, T extends false ? string | ClientConfig : ClientConfig >;
/**
* Default options to be applied to all Apollo clients.
* This is useful for setting global defaults, and is overridden by `defaultOptions` passed directly to clients.
**/
defaultOptions?: DefaultOptions;
/**
* Pass cookies from the browser to the GraphQL API in SSR mode.
*
* @type boolean
* @default true
* */
proxyCookies?: boolean;
/**
* Specify the Authentication scheme.
* @type {string}
* @default 'Bearer'
**/
authType?: string;
/**
* Name of the Authentication token header.
* @type {string}
* @default "Authorization"
*/
authHeader?: string;
/**
* Specify if the auth token should be stored in `cookie` or `localStorage`.
* `Cookie` storage is required for SSR.
* @type {string}
* @default "cookie"
**/
tokenStorage?: 'cookie' | 'localStorage';
/**
* Configuration for the auth cookie.
**/
cookieAttributes?: CookieAttributes;
/**
* Apollo client awareness instructs the client to send two additional headers
* `apollographql-client-name` and `apollographql-client-version` in each HTTP request.
* This behavior is disabled by default.
* @type {boolean}
* @default false
*/
clientAwareness?: boolean
/**
* If false, Apollo Client sends every created query to the server,
* even if a completely identical query is already in flight.
* @type {boolean}
* @default true
**/
queryDeduplication?: boolean;
}