@gambalabs/apollo 6.0.0-alpha.17 → 6.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,202 @@
1
+ import { ClientOptions } from 'graphql-ws';
2
+ import { HttpOptions, DefaultOptions, InMemoryCacheConfig } from '@apollo/client';
3
+ import { CookieOptions } from 'nuxt/app';
4
+
5
+ type CookieAttributes = Omit< CookieOptions, 'encode' | 'decode' | 'expires' | 'default'>;
6
+
7
+ type Pusher = {
8
+ cluster: string;
9
+ wsHost: string;
10
+ wsPort: number;
11
+ forceTLS: boolean;
12
+ channelEndpoint: string;
13
+ pusherAppKey: string;
14
+ activityTimeout: number;
15
+ }
16
+
17
+ type ClientConfig = {
18
+ /**
19
+ * The GraphQL endpoint.
20
+ * @type {string}
21
+ */
22
+ httpEndpoint: string;
23
+
24
+ /**
25
+ * Provide a GraphQL endpoint to be used client-side. Overrides `httpEndpoint`.
26
+ * @type {string}
27
+ **/
28
+ browserHttpEndpoint?: string;
29
+
30
+ /**
31
+ * Provide additional configuration for the `HttpLink`.
32
+ * See https://www.apollographql.com/docs/link/links/http.html#options
33
+ * @type {HttpOptions}
34
+ **/
35
+ httpLinkOptions?: Omit<HttpOptions, 'uri'>;
36
+
37
+ /**
38
+ * Provide additional configuration for the `GraphQLWsLink`.
39
+ * See https://github.com/enisdenjo/graphql-ws/blob/master/docs/interfaces/client.ClientOptions.md
40
+ **/
41
+ wsLinkOptions?: Omit<ClientOptions, 'url' | 'connectionParams'>;
42
+
43
+ /**
44
+ * Specify a websocket endpoint to be used for subscriptions.
45
+ * The `wss` protocol is recommended in production.
46
+ * @type {string}
47
+ **/
48
+ wsEndpoint?: string;
49
+
50
+ /**
51
+ * Specify if the client should solely use WebSocket.
52
+ * requires `wsEndpoint`.
53
+ * @type {boolean}
54
+ * @default false
55
+ **/
56
+ websocketsOnly?: boolean;
57
+
58
+ /**
59
+ * Specify a pusher config to be used for subscriptions.
60
+ * @type {Pusher}
61
+ **/
62
+ pusher?: Pusher
63
+
64
+ /**
65
+ * Specify if the client should be able to connect to the Apollo Client Devtools in production mode.
66
+ * @type {boolean}
67
+ * @default false
68
+ **/
69
+ connectToDevTools?: boolean;
70
+
71
+ /**
72
+ * Configure default options to be applied to the apollo client.
73
+ **/
74
+ defaultOptions?: DefaultOptions;
75
+
76
+ /**
77
+ * Configure the in-memory cache.
78
+ **/
79
+ inMemoryCacheOptions?: InMemoryCacheConfig;
80
+
81
+ /**
82
+ * Specify the name under which the token will be stored.
83
+ * as in either a cookie or localStorage.
84
+ * @type {string}
85
+ * @default "apollo:<client-name>.token"
86
+ */
87
+ tokenName?: string;
88
+
89
+ /**
90
+ * Specify if the auth token should be stored in `cookie` or `localStorage`.
91
+ * `Cookie` storage is required for SSR.
92
+ * @type {string}
93
+ * @default "cookie"
94
+ **/
95
+ tokenStorage?: 'cookie' | 'localStorage';
96
+
97
+ /**
98
+ * Specify the Authentication scheme.
99
+ * @type {string}
100
+ * @default "Bearer"
101
+ **/
102
+ authType?: string | null;
103
+
104
+ /**
105
+ * Name of the Authentication token header.
106
+ * @type {string}
107
+ * @default "Authorization"
108
+ */
109
+ authHeader?: string;
110
+
111
+ /**
112
+ * Configuration for the auth cookie.
113
+ **/
114
+ cookieAttributes?: CookieAttributes;
115
+
116
+ /**
117
+ * Name of the CSRF token header.
118
+ * @type {string}
119
+ * @default "X-CSRF-TOKEN"
120
+ */
121
+ csrfHeader?: string
122
+
123
+ /**
124
+ * Enable automatic persisted queries.
125
+ * @type {boolean}
126
+ * @default false
127
+ */
128
+ persistedQueries?: boolean
129
+ };
130
+
131
+ interface NuxtApolloConfig<T = false> {
132
+ /**
133
+ * Determine if vue-apollo composables should be automatically imported.
134
+ * @type {boolean}
135
+ * @default true
136
+ **/
137
+ autoImports?: boolean;
138
+
139
+ /**
140
+ * Configuration of the Apollo clients.
141
+ **/
142
+ clients?: Record< string, T extends false ? string | ClientConfig : ClientConfig >;
143
+
144
+ /**
145
+ * Default options to be applied to all Apollo clients.
146
+ * This is useful for setting global defaults, and is overridden by `defaultOptions` passed directly to clients.
147
+ **/
148
+ defaultOptions?: DefaultOptions;
149
+
150
+ /**
151
+ * Pass cookies from the browser to the GraphQL API in SSR mode.
152
+ *
153
+ * @type boolean
154
+ * @default true
155
+ * */
156
+ proxyCookies?: boolean;
157
+
158
+ /**
159
+ * Specify the Authentication scheme.
160
+ * @type {string}
161
+ * @default 'Bearer'
162
+ **/
163
+ authType?: string;
164
+
165
+ /**
166
+ * Name of the Authentication token header.
167
+ * @type {string}
168
+ * @default "Authorization"
169
+ */
170
+ authHeader?: string;
171
+
172
+ /**
173
+ * Name of the CSRF token header.
174
+ * @type {string}
175
+ * @default "X-CSRF-TOKEN"
176
+ */
177
+ csrfHeader?: string;
178
+
179
+ /**
180
+ * Specify if the auth token should be stored in `cookie` or `localStorage`.
181
+ * `Cookie` storage is required for SSR.
182
+ * @type {string}
183
+ * @default "cookie"
184
+ **/
185
+ tokenStorage?: 'cookie' | 'localStorage';
186
+
187
+ /**
188
+ * Configuration for the auth cookie.
189
+ **/
190
+ cookieAttributes?: CookieAttributes;
191
+
192
+ /**
193
+ * Apollo client awareness instructs the client to send two additional headers
194
+ * `apollographql-client-name` and `apollographql-client-version` in each HTTP request.
195
+ * This behavior is disabled by default.
196
+ * @type {boolean}
197
+ * @default false
198
+ */
199
+ clientAwareness?: boolean
200
+ }
201
+
202
+ export type { ClientConfig as C, NuxtApolloConfig as N };
@@ -0,0 +1,20 @@
1
+
2
+ import type { ModuleOptions, ModuleRuntimeConfig, ModulePublicRuntimeConfig } from './module.js'
3
+
4
+
5
+ declare module '@nuxt/schema' {
6
+ interface NuxtConfig { ['apollo']?: Partial<ModuleOptions> }
7
+ interface NuxtOptions { ['apollo']?: ModuleOptions }
8
+ interface RuntimeConfig extends ModuleRuntimeConfig {}
9
+ interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
10
+ }
11
+
12
+ declare module 'nuxt/schema' {
13
+ interface NuxtConfig { ['apollo']?: Partial<ModuleOptions> }
14
+ interface NuxtOptions { ['apollo']?: ModuleOptions }
15
+ interface RuntimeConfig extends ModuleRuntimeConfig {}
16
+ interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
17
+ }
18
+
19
+
20
+ export type { ErrorResponse } from './module.js'
package/dist/types.d.ts CHANGED
@@ -1,10 +1,20 @@
1
1
 
2
- import { ModuleOptions } from './module'
2
+ import type { ModuleOptions, ModuleRuntimeConfig, ModulePublicRuntimeConfig } from './module'
3
+
3
4
 
4
5
  declare module '@nuxt/schema' {
5
6
  interface NuxtConfig { ['apollo']?: Partial<ModuleOptions> }
6
7
  interface NuxtOptions { ['apollo']?: ModuleOptions }
8
+ interface RuntimeConfig extends ModuleRuntimeConfig {}
9
+ interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
10
+ }
11
+
12
+ declare module 'nuxt/schema' {
13
+ interface NuxtConfig { ['apollo']?: Partial<ModuleOptions> }
14
+ interface NuxtOptions { ['apollo']?: ModuleOptions }
15
+ interface RuntimeConfig extends ModuleRuntimeConfig {}
16
+ interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
7
17
  }
8
18
 
9
19
 
10
- export { ErrorResponse } from './module'
20
+ export type { ErrorResponse } from './module'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gambalabs/apollo",
3
- "version": "6.0.0-alpha.17",
3
+ "version": "6.0.0-alpha.20",
4
4
  "license": "MIT",
5
5
  "repository": "https://github.com/GambaLabs/apollo",
6
6
  "homepage": "https://apollo.nuxtjs.org",
@@ -9,6 +9,10 @@
9
9
  ".": {
10
10
  "types": "./dist/types.d.ts",
11
11
  "import": "./dist/module.mjs"
12
+ },
13
+ "./config": {
14
+ "types": "./dist/config.d.ts",
15
+ "import": "./dist/config.mjs"
12
16
  }
13
17
  },
14
18
  "main": "./dist/module.mjs",
@@ -17,29 +21,30 @@
17
21
  "dist"
18
22
  ],
19
23
  "dependencies": {
20
- "@apollo/client": "^3.8.7",
21
- "@nuxt/kit": "^3.8.2",
24
+ "@apollo/client": "^3.9.5",
25
+ "@nuxt/kit": "^3.10.3",
22
26
  "@rollup/plugin-graphql": "^2.0.4",
23
- "@vue/apollo-composable": "4.0.0-beta.4",
27
+ "@vue/apollo-composable": "^4.0.1",
24
28
  "apollo-upload-client": "^18.0.1",
25
29
  "crypto-hash": "^2.0.1",
26
- "defu": "^6.1.3",
27
- "destr": "^1.2.2",
30
+ "@vue/apollo-option": "^4.0.0",
31
+ "defu": "^6.1.4",
32
+ "destr": "^2.0.3",
28
33
  "graphql": "^16.8.1",
29
34
  "graphql-tag": "^2.12.6",
30
- "graphql-ws": "^5.14.2",
35
+ "graphql-ws": "^5.15.0",
31
36
  "jiti": "^1.21.0",
32
37
  "ohash": "^1.1.3",
33
38
  "pusher-js": "^8.3.0"
34
39
  },
35
40
  "devDependencies": {
36
- "@nuxt/module-builder": "^0.2.1",
37
- "@nuxt/schema": "^3.8.2",
38
- "@nuxt/ui": "^0.4.1",
41
+ "@nuxt/module-builder": "^0.5.5",
42
+ "@nuxt/schema": "^3.10.3",
43
+ "@nuxt/ui": "^2.14.1",
39
44
  "@nuxtjs/eslint-config-typescript": "^12.1.0",
40
- "@types/node": "^18.18.13",
41
- "eslint": "^8.54.0",
42
- "nuxt": "^3.8.2"
45
+ "@types/node": "^20.11.24",
46
+ "eslint": "^8.57.0",
47
+ "nuxt": "^3.10.3"
43
48
  },
44
49
  "publishConfig": {
45
50
  "access": "public"
@@ -47,12 +52,14 @@
47
52
  "resolutions": {
48
53
  "@nuxtjs/apollo": "link:."
49
54
  },
50
- "packageManager": "pnpm@7.29.1",
55
+ "packageManager": "pnpm@8.15.2",
51
56
  "scripts": {
52
- "build": "nuxt-module-build",
57
+ "build": "nuxt-module-build build",
53
58
  "dev": "nuxi dev playground --dotenv .env --host",
54
59
  "dev:build": "nuxi build playground",
55
- "dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
60
+ "dev:prepare": "nuxt-module-build build --stub && nuxi prepare playground",
61
+ "lint": "eslint --ext .js,.ts,.vue --ignore-path .gitignore .",
62
+ "lint:fix": "eslint --fix --ext .js,.ts,.vue --ignore-path .gitignore .",
56
63
  "release": "standard-version --prerelease alpha && git push --follow-tags && pnpm publish --tag next"
57
64
  }
58
65
  }