@apollo/client 4.0.0-alpha.4 → 4.0.0-alpha.5
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.
- package/.changeset/eleven-kangaroos-jump.md +5 -0
- package/.changeset/forty-shrimps-fry.md +5 -0
- package/.changeset/grumpy-vans-type.md +5 -0
- package/.changeset/little-spoons-kick.md +7 -0
- package/.changeset/loud-cows-raise.md +7 -0
- package/.changeset/many-buses-allow.md +5 -0
- package/.changeset/poor-eels-punch.md +5 -0
- package/.changeset/pre.json +13 -0
- package/.changeset/real-teachers-peel.md +5 -0
- package/.changeset/slimy-chicken-melt.md +5 -0
- package/.changeset/thick-books-grin.md +5 -0
- package/.changeset/tough-rockets-allow.md +5 -0
- package/.changeset/tricky-tables-shave.md +5 -0
- package/.changeset/warm-ties-sit.md +7 -0
- package/CHANGELOG.md +40 -0
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +4 -4
- package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/core/ApolloClient.cjs +3 -3
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +4 -4
- package/__cjs/core/LocalState.cjs +2 -2
- package/__cjs/core/ObservableQuery.cjs +15 -12
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/QueryManager.cjs +57 -35
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +3 -3
- package/__cjs/core/types.d.cts +32 -0
- package/__cjs/invariantErrorCodes.cjs +57 -77
- package/__cjs/link/core/ApolloLink.cjs +2 -2
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/createHttpLink.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
- package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
- package/__cjs/link/persisted-queries/index.cjs +2 -2
- package/__cjs/link/utils/validateOperation.cjs +1 -1
- package/__cjs/masking/maskDefinition.cjs +2 -2
- package/__cjs/masking/maskFragment.cjs +2 -2
- package/__cjs/masking/maskOperation.cjs +1 -1
- package/__cjs/masking/utils.cjs +1 -1
- package/__cjs/react/context/ApolloConsumer.cjs +1 -1
- package/__cjs/react/context/ApolloContext.cjs +1 -1
- package/__cjs/react/context/ApolloContext.cjs.map +1 -1
- package/__cjs/react/context/ApolloContext.d.cts +2 -2
- package/__cjs/react/context/ApolloProvider.cjs +1 -1
- package/__cjs/react/hooks/internal/wrapHook.cjs +26 -5
- package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
- package/__cjs/react/hooks/internal/wrapHook.d.cts +3 -1
- package/__cjs/react/hooks/useMutation.cjs +14 -19
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +4 -4
- package/__cjs/react/hooks/useQuery.cjs +82 -187
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +4 -0
- package/__cjs/react/hooks/useSubscription.cjs +8 -57
- package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
- package/__cjs/react/hooks/useSubscription.d.cts +6 -42
- package/__cjs/react/hooks/useSuspenseQuery.cjs +2 -2
- package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
- package/__cjs/react/internal/index.cjs +3 -1
- package/__cjs/react/internal/index.cjs.map +1 -1
- package/__cjs/react/internal/index.d.cts +1 -0
- package/__cjs/react/ssr/getDataFromTree.cjs +43 -12
- package/__cjs/react/ssr/getDataFromTree.cjs.map +1 -1
- package/__cjs/react/ssr/getDataFromTree.d.cts +5 -0
- package/__cjs/react/ssr/index.cjs +1 -3
- package/__cjs/react/ssr/index.cjs.map +1 -1
- package/__cjs/react/ssr/index.d.cts +0 -1
- package/__cjs/react/ssr/useSSRQuery.cjs +60 -0
- package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -0
- package/__cjs/react/ssr/useSSRQuery.d.cts +5 -0
- package/__cjs/react/types/deprecated.d.cts +1 -1
- package/__cjs/react/types/types.documentation.d.cts +4 -12
- package/__cjs/testing/matchers/index.cjs +2 -0
- package/__cjs/testing/matchers/index.cjs.map +1 -1
- package/__cjs/testing/matchers/toEmitStrictTyped.cjs +42 -0
- package/__cjs/testing/matchers/toEmitStrictTyped.cjs.map +1 -0
- package/__cjs/testing/matchers/toEmitStrictTyped.d.cts +7 -0
- package/__cjs/testing/matchers/toEqualStrictTyped.cjs +2 -20
- package/__cjs/testing/matchers/toEqualStrictTyped.cjs.map +1 -1
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs +23 -0
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs.map +1 -0
- package/__cjs/testing/matchers/utils/getSerializableProperties.d.cts +2 -0
- package/__cjs/version.cjs +1 -1
- package/__cjs/version.d.cts +1 -1
- package/cache/core/cache.js +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.d.ts +4 -4
- package/core/ApolloClient.js +3 -3
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +2 -2
- package/core/ObservableQuery.js +15 -12
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.d.ts +3 -3
- package/core/QueryManager.js +58 -36
- package/core/QueryManager.js.map +1 -1
- package/core/types.d.ts +32 -0
- package/invariantErrorCodes.js +57 -77
- package/link/core/ApolloLink.js +2 -2
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/utils/validateOperation.js +1 -1
- package/masking/maskDefinition.js +2 -2
- package/masking/maskFragment.js +2 -2
- package/masking/maskOperation.js +1 -1
- package/masking/utils.js +1 -1
- package/package.json +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.d.ts +2 -2
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/hooks/internal/wrapHook.d.ts +3 -1
- package/react/hooks/internal/wrapHook.js +24 -5
- package/react/hooks/internal/wrapHook.js.map +1 -1
- package/react/hooks/useMutation.d.ts +4 -4
- package/react/hooks/useMutation.js +14 -19
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +4 -0
- package/react/hooks/useQuery.js +83 -188
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +6 -42
- package/react/hooks/useSubscription.js +7 -53
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +2 -2
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/internal/index.d.ts +1 -0
- package/react/internal/index.js +2 -1
- package/react/internal/index.js.map +1 -1
- package/react/ssr/getDataFromTree.d.ts +5 -0
- package/react/ssr/getDataFromTree.js +43 -12
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/index.d.ts +0 -1
- package/react/ssr/index.js +0 -1
- package/react/ssr/index.js.map +1 -1
- package/react/ssr/useSSRQuery.d.ts +5 -0
- package/react/ssr/useSSRQuery.js +56 -0
- package/react/ssr/useSSRQuery.js.map +1 -0
- package/react/types/deprecated.d.ts +1 -1
- package/react/types/types.documentation.d.ts +4 -12
- package/testing/matchers/index.js +2 -0
- package/testing/matchers/index.js.map +1 -1
- package/testing/matchers/toEmitStrictTyped.d.ts +7 -0
- package/testing/matchers/toEmitStrictTyped.js +38 -0
- package/testing/matchers/toEmitStrictTyped.js.map +1 -0
- package/testing/matchers/toEqualStrictTyped.js +1 -19
- package/testing/matchers/toEqualStrictTyped.js.map +1 -1
- package/testing/matchers/utils/getSerializableProperties.d.ts +2 -0
- package/testing/matchers/utils/getSerializableProperties.js +20 -0
- package/testing/matchers/utils/getSerializableProperties.js.map +1 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/__cjs/react/ssr/RenderPromises.cjs +0 -104
- package/__cjs/react/ssr/RenderPromises.cjs.map +0 -1
- package/__cjs/react/ssr/RenderPromises.d.cts +0 -25
- package/react/ssr/RenderPromises.d.ts +0 -25
- package/react/ssr/RenderPromises.js +0 -100
- package/react/ssr/RenderPromises.js.map +0 -1
package/core/types.d.ts
CHANGED
|
@@ -117,4 +117,36 @@ export interface Resolvers {
|
|
|
117
117
|
[field: string]: Resolver;
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
+
export interface MutateResult<TData = unknown> {
|
|
121
|
+
/**
|
|
122
|
+
* The data returned from your mutation. Can be `undefined` if `ignoreResults` is `true`.
|
|
123
|
+
*/
|
|
124
|
+
data: TData | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* If the mutation produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.
|
|
127
|
+
*
|
|
128
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
129
|
+
*/
|
|
130
|
+
error?: ErrorLike;
|
|
131
|
+
/**
|
|
132
|
+
* Custom extensions returned from the GraphQL server
|
|
133
|
+
*/
|
|
134
|
+
extensions?: Record<string, unknown>;
|
|
135
|
+
}
|
|
136
|
+
export interface SubscribeResult<TData = unknown> {
|
|
137
|
+
/**
|
|
138
|
+
* The data returned from your mutation. Can be `undefined` if `ignoreResults` is `true`.
|
|
139
|
+
*/
|
|
140
|
+
data: TData | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* If the mutation produces one or more errors, this object contains either an array of `graphQLErrors` or a single `networkError`. Otherwise, this value is `undefined`.
|
|
143
|
+
*
|
|
144
|
+
* For more information, see [Handling operation errors](https://www.apollographql.com/docs/react/data/error-handling/).
|
|
145
|
+
*/
|
|
146
|
+
error?: ErrorLike;
|
|
147
|
+
/**
|
|
148
|
+
* Custom extensions returned from the GraphQL server
|
|
149
|
+
*/
|
|
150
|
+
extensions?: Record<string, unknown>;
|
|
151
|
+
}
|
|
120
152
|
//# sourceMappingURL=types.d.ts.map
|
package/invariantErrorCodes.js
CHANGED
|
@@ -202,19 +202,19 @@ string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`
|
|
|
202
202
|
message: "The query has not been loaded. Please load the query."
|
|
203
203
|
},
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
36: {
|
|
206
206
|
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
207
207
|
condition: "!optionsRef.current.skip",
|
|
208
208
|
message: "A subscription that is skipped cannot be restarted."
|
|
209
209
|
},
|
|
210
210
|
|
|
211
|
-
|
|
211
|
+
37: {
|
|
212
212
|
file: "@apollo/client/react/hooks/useSuspenseQuery.js",
|
|
213
213
|
condition: "supportedFetchPolicies.includes(fetchPolicy)",
|
|
214
214
|
message: `The fetch policy \`%s\` is not supported with suspense.`
|
|
215
215
|
},
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
40: {
|
|
218
218
|
file: "@apollo/client/react/context/ApolloConsumer.js",
|
|
219
219
|
condition: "context && context.client",
|
|
220
220
|
|
|
@@ -222,7 +222,7 @@ string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`
|
|
|
222
222
|
"Wrap the root component in an <ApolloProvider>."
|
|
223
223
|
},
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
41: {
|
|
226
226
|
file: "@apollo/client/react/context/ApolloContext.js",
|
|
227
227
|
condition: "\"createContext\" in React",
|
|
228
228
|
|
|
@@ -233,7 +233,7 @@ string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`
|
|
|
233
233
|
"For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components"
|
|
234
234
|
},
|
|
235
235
|
|
|
236
|
-
|
|
236
|
+
42: {
|
|
237
237
|
file: "@apollo/client/react/context/ApolloProvider.js",
|
|
238
238
|
condition: "context.client",
|
|
239
239
|
|
|
@@ -241,36 +241,36 @@ string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`
|
|
|
241
241
|
'sure you pass in your client via the "client" prop.'
|
|
242
242
|
},
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
43: {
|
|
245
245
|
file: "@apollo/client/masking/maskDefinition.js",
|
|
246
246
|
condition: "fragment",
|
|
247
247
|
message: "Could not find fragment with name '%s'."
|
|
248
248
|
},
|
|
249
249
|
|
|
250
|
-
|
|
250
|
+
45: {
|
|
251
251
|
file: "@apollo/client/masking/maskFragment.js",
|
|
252
252
|
condition: "fragments.length === 1",
|
|
253
253
|
message: `Found %s fragments. \`fragmentName\` must be provided when there is not exactly 1 fragment.`
|
|
254
254
|
},
|
|
255
255
|
|
|
256
|
-
|
|
256
|
+
46: {
|
|
257
257
|
file: "@apollo/client/masking/maskFragment.js",
|
|
258
258
|
condition: "!!fragment",
|
|
259
259
|
message: `Could not find fragment with name "%s".`
|
|
260
260
|
},
|
|
261
261
|
|
|
262
|
-
|
|
262
|
+
47: {
|
|
263
263
|
file: "@apollo/client/masking/maskOperation.js",
|
|
264
264
|
condition: "definition",
|
|
265
265
|
message: "Expected a parsed GraphQL document with a query, mutation, or subscription."
|
|
266
266
|
},
|
|
267
267
|
|
|
268
|
-
|
|
268
|
+
49: {
|
|
269
269
|
file: "@apollo/client/link/utils/validateOperation.js",
|
|
270
270
|
message: `illegal argument: %s`
|
|
271
271
|
},
|
|
272
272
|
|
|
273
|
-
|
|
273
|
+
50: {
|
|
274
274
|
file: "@apollo/client/link/persisted-queries/index.js",
|
|
275
275
|
condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")",
|
|
276
276
|
|
|
@@ -279,13 +279,13 @@ string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql`
|
|
|
279
279
|
"parameter."
|
|
280
280
|
},
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
51: {
|
|
283
283
|
file: "@apollo/client/link/persisted-queries/index.js",
|
|
284
284
|
condition: "forward",
|
|
285
285
|
message: "PersistedQueryLink cannot be the last link in the chain."
|
|
286
286
|
},
|
|
287
287
|
|
|
288
|
-
|
|
288
|
+
52: {
|
|
289
289
|
file: "@apollo/client/link/http/checkFetcher.js",
|
|
290
290
|
condition: "fetcher || typeof fetch !== \"undefined\"",
|
|
291
291
|
|
|
@@ -303,23 +303,23 @@ const client = new ApolloClient({
|
|
|
303
303
|
`
|
|
304
304
|
},
|
|
305
305
|
|
|
306
|
-
|
|
306
|
+
54: {
|
|
307
307
|
file: "@apollo/client/link/http/parseAndCheckHttpResponse.js",
|
|
308
308
|
condition: "response.body && typeof response.body.getReader === \"function\"",
|
|
309
309
|
message: "Unknown type for `response.body`. Please use a `fetch` implementation that is WhatWG-compliant and that uses WhatWG ReadableStreams for `body`."
|
|
310
310
|
},
|
|
311
311
|
|
|
312
|
-
|
|
312
|
+
55: {
|
|
313
313
|
file: "@apollo/client/link/http/serializeFetchParameter.js",
|
|
314
314
|
message: `Network request failed. %s is not serializable: %s`
|
|
315
315
|
},
|
|
316
316
|
|
|
317
|
-
|
|
317
|
+
57: {
|
|
318
318
|
file: "@apollo/client/link/core/ApolloLink.js",
|
|
319
319
|
message: "request is not implemented"
|
|
320
320
|
},
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
58: {
|
|
323
323
|
file: "@apollo/client/core/ApolloClient.js",
|
|
324
324
|
|
|
325
325
|
message: "To initialize Apollo Client, you must specify a 'cache' property " +
|
|
@@ -327,7 +327,7 @@ const client = new ApolloClient({
|
|
|
327
327
|
"For more information, please visit: https://go.apollo.dev/c/docs"
|
|
328
328
|
},
|
|
329
329
|
|
|
330
|
-
|
|
330
|
+
59: {
|
|
331
331
|
file: "@apollo/client/core/ApolloClient.js",
|
|
332
332
|
condition: "options.fetchPolicy !== \"cache-and-network\"",
|
|
333
333
|
|
|
@@ -337,48 +337,48 @@ const client = new ApolloClient({
|
|
|
337
337
|
"using a different fetchPolicy, such as cache-first or network-only."
|
|
338
338
|
},
|
|
339
339
|
|
|
340
|
-
|
|
340
|
+
61: {
|
|
341
341
|
file: "@apollo/client/core/LocalState.js",
|
|
342
342
|
condition: "fragment",
|
|
343
343
|
message: `No fragment named %s`
|
|
344
344
|
},
|
|
345
345
|
|
|
346
|
-
|
|
346
|
+
62: {
|
|
347
347
|
file: "@apollo/client/core/LocalState.js",
|
|
348
348
|
condition: "fragment",
|
|
349
349
|
message: `No fragment named %s`
|
|
350
350
|
},
|
|
351
351
|
|
|
352
|
-
|
|
352
|
+
64: {
|
|
353
353
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
354
354
|
condition: "updateQuery",
|
|
355
355
|
message: "You must provide an `updateQuery` function when using `fetchMore` with a `no-cache` fetch policy."
|
|
356
356
|
},
|
|
357
357
|
|
|
358
|
-
|
|
358
|
+
66: {
|
|
359
359
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
360
360
|
condition: "pollInterval",
|
|
361
361
|
message: "Attempted to start a polling query without a polling interval."
|
|
362
362
|
},
|
|
363
363
|
|
|
364
|
-
|
|
364
|
+
68: {
|
|
365
365
|
file: "@apollo/client/core/QueryManager.js",
|
|
366
366
|
message: "QueryManager stopped while query was in flight"
|
|
367
367
|
},
|
|
368
368
|
|
|
369
|
-
|
|
369
|
+
69: {
|
|
370
370
|
file: "@apollo/client/core/QueryManager.js",
|
|
371
371
|
condition: "mutation",
|
|
372
372
|
message: "mutation option is required. You must specify your GraphQL document in the mutation option."
|
|
373
373
|
},
|
|
374
374
|
|
|
375
|
-
|
|
375
|
+
70: {
|
|
376
376
|
file: "@apollo/client/core/QueryManager.js",
|
|
377
377
|
condition: "fetchPolicy === \"network-only\" || fetchPolicy === \"no-cache\"",
|
|
378
378
|
message: "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."
|
|
379
379
|
},
|
|
380
380
|
|
|
381
|
-
|
|
381
|
+
71: {
|
|
382
382
|
file: "@apollo/client/core/QueryManager.js",
|
|
383
383
|
condition: "options.query",
|
|
384
384
|
|
|
@@ -386,81 +386,81 @@ const client = new ApolloClient({
|
|
|
386
386
|
"in the query option."
|
|
387
387
|
},
|
|
388
388
|
|
|
389
|
-
|
|
389
|
+
72: {
|
|
390
390
|
file: "@apollo/client/core/QueryManager.js",
|
|
391
391
|
condition: "options.query.kind === \"Document\"",
|
|
392
392
|
message: 'You must wrap the query string in a "gql" tag.'
|
|
393
393
|
},
|
|
394
394
|
|
|
395
|
-
|
|
395
|
+
73: {
|
|
396
396
|
file: "@apollo/client/core/QueryManager.js",
|
|
397
397
|
condition: "!options.returnPartialData",
|
|
398
398
|
message: "returnPartialData option only supported on watchQuery."
|
|
399
399
|
},
|
|
400
400
|
|
|
401
|
-
|
|
401
|
+
74: {
|
|
402
402
|
file: "@apollo/client/core/QueryManager.js",
|
|
403
403
|
condition: "!options.pollInterval",
|
|
404
404
|
message: "pollInterval option only supported on watchQuery."
|
|
405
405
|
},
|
|
406
406
|
|
|
407
|
-
|
|
407
|
+
75: {
|
|
408
408
|
file: "@apollo/client/core/QueryManager.js",
|
|
409
409
|
message: "Store reset while query was in flight (not completed in link chain)"
|
|
410
410
|
},
|
|
411
411
|
|
|
412
|
-
|
|
412
|
+
79: {
|
|
413
413
|
file: "@apollo/client/cache/inmemory/entityStore.js",
|
|
414
414
|
condition: "typeof dataId === \"string\"",
|
|
415
415
|
message: "store.merge expects a string ID"
|
|
416
416
|
},
|
|
417
417
|
|
|
418
|
-
|
|
418
|
+
82: {
|
|
419
419
|
file: "@apollo/client/cache/inmemory/key-extractor.js",
|
|
420
420
|
condition: "extracted !== void 0",
|
|
421
421
|
message: `Missing field '%s' while extracting keyFields from %s`
|
|
422
422
|
},
|
|
423
423
|
|
|
424
|
-
|
|
424
|
+
83: {
|
|
425
425
|
file: "@apollo/client/cache/inmemory/policies.js",
|
|
426
426
|
condition: "!old || old === which",
|
|
427
427
|
message: `Cannot change root %s __typename more than once`
|
|
428
428
|
},
|
|
429
429
|
|
|
430
|
-
|
|
430
|
+
86: {
|
|
431
431
|
file: "@apollo/client/cache/inmemory/policies.js",
|
|
432
432
|
message: "Cannot automatically merge arrays"
|
|
433
433
|
},
|
|
434
434
|
|
|
435
|
-
|
|
435
|
+
87: {
|
|
436
436
|
file: "@apollo/client/cache/inmemory/readFromStore.js",
|
|
437
437
|
message: `No fragment named %s`
|
|
438
438
|
},
|
|
439
439
|
|
|
440
|
-
|
|
440
|
+
88: {
|
|
441
441
|
file: "@apollo/client/cache/inmemory/readFromStore.js",
|
|
442
442
|
condition: "!isReference(value)",
|
|
443
443
|
message: `Missing selection set for object of type %s returned for query field %s`
|
|
444
444
|
},
|
|
445
445
|
|
|
446
|
-
|
|
446
|
+
89: {
|
|
447
447
|
file: "@apollo/client/cache/inmemory/writeToStore.js",
|
|
448
448
|
message: `Could not identify object %s`
|
|
449
449
|
},
|
|
450
450
|
|
|
451
|
-
|
|
451
|
+
91: {
|
|
452
452
|
file: "@apollo/client/cache/inmemory/writeToStore.js",
|
|
453
453
|
message: `No fragment named %s`
|
|
454
454
|
}
|
|
455
455
|
};
|
|
456
456
|
|
|
457
457
|
export const devDebug = {
|
|
458
|
-
|
|
458
|
+
60: {
|
|
459
459
|
file: "@apollo/client/core/ApolloClient.js",
|
|
460
460
|
message: `In client.refetchQueries, Promise.all promise rejected with error %o`
|
|
461
461
|
},
|
|
462
462
|
|
|
463
|
-
|
|
463
|
+
67: {
|
|
464
464
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
465
465
|
message: `Missing cache result fields: %o`
|
|
466
466
|
}
|
|
@@ -491,74 +491,54 @@ export const devWarn = {
|
|
|
491
491
|
"You may want to use the key parameter to specify a store key."
|
|
492
492
|
},
|
|
493
493
|
|
|
494
|
-
36: {
|
|
495
|
-
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
496
|
-
message: "'useSubscription' supports only the 'onSubscriptionData' or 'onData' option, but not both. Only the 'onData' option will be used."
|
|
497
|
-
},
|
|
498
|
-
|
|
499
|
-
37: {
|
|
500
|
-
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
501
|
-
message: "'onSubscriptionData' is deprecated and will be removed in a future major version. Please use the 'onData' option instead."
|
|
502
|
-
},
|
|
503
|
-
|
|
504
494
|
38: {
|
|
505
|
-
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
506
|
-
message: "'useSubscription' supports only the 'onSubscriptionComplete' or 'onComplete' option, but not both. Only the 'onComplete' option will be used."
|
|
507
|
-
},
|
|
508
|
-
|
|
509
|
-
39: {
|
|
510
|
-
file: "@apollo/client/react/hooks/useSubscription.js",
|
|
511
|
-
message: "'onSubscriptionComplete' is deprecated and will be removed in a future major version. Please use the 'onComplete' option instead."
|
|
512
|
-
},
|
|
513
|
-
|
|
514
|
-
42: {
|
|
515
495
|
file: "@apollo/client/react/hooks/useSuspenseQuery.js",
|
|
516
496
|
message: "Using `returnPartialData` with a `no-cache` fetch policy has no effect. To read partial data from the cache, consider using an alternate fetch policy."
|
|
517
497
|
},
|
|
518
498
|
|
|
519
|
-
|
|
499
|
+
44: {
|
|
520
500
|
file: "@apollo/client/masking/maskDefinition.js",
|
|
521
501
|
message: "Accessing unmasked field on %s at path '%s'. This field will not be available when masking is enabled. Please read the field from the fragment instead."
|
|
522
502
|
},
|
|
523
503
|
|
|
524
|
-
|
|
504
|
+
48: {
|
|
525
505
|
file: "@apollo/client/masking/utils.js",
|
|
526
506
|
message: "The configured cache does not support data masking which effectively disables it. Please use a cache that supports data masking or disable data masking to silence this warning."
|
|
527
507
|
},
|
|
528
508
|
|
|
529
|
-
|
|
509
|
+
53: {
|
|
530
510
|
file: "@apollo/client/link/http/createHttpLink.js",
|
|
531
511
|
message: "Multipart-subscriptions do not support @defer"
|
|
532
512
|
},
|
|
533
513
|
|
|
534
|
-
|
|
514
|
+
56: {
|
|
535
515
|
file: "@apollo/client/link/core/ApolloLink.js",
|
|
536
516
|
message: `You are calling concat on a terminating link, which will have no effect %o`
|
|
537
517
|
},
|
|
538
518
|
|
|
539
|
-
|
|
519
|
+
63: {
|
|
540
520
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
541
521
|
|
|
542
522
|
message: `Called refetch(%o) for query %o, which does not declare a $variables variable.
|
|
543
523
|
Did you mean to call refetch(variables) instead of refetch({ variables })?`
|
|
544
524
|
},
|
|
545
525
|
|
|
546
|
-
|
|
526
|
+
76: {
|
|
547
527
|
file: "@apollo/client/core/QueryManager.js",
|
|
548
528
|
message: `Unknown query named "%s" requested in refetchQueries options.include array`
|
|
549
529
|
},
|
|
550
530
|
|
|
551
|
-
|
|
531
|
+
77: {
|
|
552
532
|
file: "@apollo/client/core/QueryManager.js",
|
|
553
533
|
message: `Unknown anonymous query requested in refetchQueries options.include array`
|
|
554
534
|
},
|
|
555
535
|
|
|
556
|
-
|
|
536
|
+
78: {
|
|
557
537
|
file: "@apollo/client/core/QueryManager.js",
|
|
558
538
|
message: '[%s]: Fragments masked by data masking are inaccessible when using fetch policy "no-cache". Please add `@unmask` to each fragment spread to access the data.'
|
|
559
539
|
},
|
|
560
540
|
|
|
561
|
-
|
|
541
|
+
80: {
|
|
562
542
|
file: "@apollo/client/cache/inmemory/entityStore.js",
|
|
563
543
|
|
|
564
544
|
message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" +
|
|
@@ -566,24 +546,24 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`
|
|
|
566
546
|
"`toReference(object, true)`"
|
|
567
547
|
},
|
|
568
548
|
|
|
569
|
-
|
|
549
|
+
81: {
|
|
570
550
|
file: "@apollo/client/cache/inmemory/entityStore.js",
|
|
571
551
|
|
|
572
552
|
message: "cache.modify: Writing an array with a mix of both References and Objects will not result in the Objects being normalized correctly.\n" +
|
|
573
553
|
"Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`."
|
|
574
554
|
},
|
|
575
555
|
|
|
576
|
-
|
|
556
|
+
84: {
|
|
577
557
|
file: "@apollo/client/cache/inmemory/policies.js",
|
|
578
558
|
message: `Inferring subtype %s of supertype %s`
|
|
579
559
|
},
|
|
580
560
|
|
|
581
|
-
|
|
561
|
+
85: {
|
|
582
562
|
file: "@apollo/client/cache/inmemory/policies.js",
|
|
583
563
|
message: `Undefined 'from' passed to readField with arguments %s`
|
|
584
564
|
},
|
|
585
565
|
|
|
586
|
-
|
|
566
|
+
92: {
|
|
587
567
|
file: "@apollo/client/cache/inmemory/writeToStore.js",
|
|
588
568
|
|
|
589
569
|
message: `Cache data may be lost when replacing the %s field of a %s object.
|
|
@@ -602,7 +582,7 @@ For more information about these options, please refer to the documentation:
|
|
|
602
582
|
`
|
|
603
583
|
},
|
|
604
584
|
|
|
605
|
-
|
|
585
|
+
93: {
|
|
606
586
|
file: "@apollo/client/cache/core/cache.js",
|
|
607
587
|
message: "Could not identify object passed to `from` for '%s' fragment, either because the object is non-normalized or the key fields are missing. If you are masking this object, please ensure the key fields are requested by the parent object."
|
|
608
588
|
}
|
|
@@ -614,17 +594,17 @@ export const devError = {
|
|
|
614
594
|
message: `Could not find operation or fragment`
|
|
615
595
|
},
|
|
616
596
|
|
|
617
|
-
|
|
597
|
+
39: {
|
|
618
598
|
file: "@apollo/client/react/hooks/useSyncExternalStore.js",
|
|
619
599
|
message: "The result of getSnapshot should be cached to avoid an infinite loop"
|
|
620
600
|
},
|
|
621
601
|
|
|
622
|
-
|
|
602
|
+
65: {
|
|
623
603
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
624
604
|
message: "Unhandled GraphQL subscription error"
|
|
625
605
|
},
|
|
626
606
|
|
|
627
|
-
|
|
607
|
+
90: {
|
|
628
608
|
file: "@apollo/client/cache/inmemory/writeToStore.js",
|
|
629
609
|
message: `Missing field '%s' while writing result %o`
|
|
630
610
|
}
|
package/link/core/ApolloLink.js
CHANGED
|
@@ -46,7 +46,7 @@ export class ApolloLink {
|
|
|
46
46
|
static concat(first, second) {
|
|
47
47
|
const firstLink = toLink(first);
|
|
48
48
|
if (isTerminating(firstLink)) {
|
|
49
|
-
__DEV__ && invariant.warn(
|
|
49
|
+
__DEV__ && invariant.warn(56, firstLink);
|
|
50
50
|
return firstLink;
|
|
51
51
|
}
|
|
52
52
|
const nextLink = toLink(second);
|
|
@@ -75,7 +75,7 @@ export class ApolloLink {
|
|
|
75
75
|
return ApolloLink.concat(this, next);
|
|
76
76
|
}
|
|
77
77
|
request(operation, forward) {
|
|
78
|
-
throw newInvariantError(
|
|
78
|
+
throw newInvariantError(57);
|
|
79
79
|
}
|
|
80
80
|
onError(error, observer) {
|
|
81
81
|
if (observer && observer.error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { invariant } from "@apollo/client/utilities/invariant";
|
|
2
2
|
export const checkFetcher = (fetcher) => {
|
|
3
|
-
invariant(fetcher || typeof fetch !== "undefined",
|
|
3
|
+
invariant(fetcher || typeof fetch !== "undefined", 52);
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=checkFetcher.js.map
|
|
@@ -90,7 +90,7 @@ export const createHttpLink = (linkOptions = {}) => {
|
|
|
90
90
|
// Omit defer-specific headers if the user attempts to defer a selection
|
|
91
91
|
// set on a subscription and log a warning.
|
|
92
92
|
if (isSubscription && hasDefer) {
|
|
93
|
-
__DEV__ && invariant.warn(
|
|
93
|
+
__DEV__ && invariant.warn(53);
|
|
94
94
|
}
|
|
95
95
|
if (isSubscription) {
|
|
96
96
|
acceptHeader +=
|
|
@@ -22,7 +22,7 @@ export async function readMultipartBody(response, nextValue) {
|
|
|
22
22
|
: "-";
|
|
23
23
|
const boundary = `\r\n--${boundaryVal}`;
|
|
24
24
|
let buffer = "";
|
|
25
|
-
invariant(response.body && typeof response.body.getReader === "function",
|
|
25
|
+
invariant(response.body && typeof response.body.getReader === "function", 54);
|
|
26
26
|
const iterator = response.body.getReader();
|
|
27
27
|
let running = true;
|
|
28
28
|
while (running) {
|
|
@@ -5,7 +5,7 @@ export const serializeFetchParameter = (p, label) => {
|
|
|
5
5
|
serialized = JSON.stringify(p);
|
|
6
6
|
}
|
|
7
7
|
catch (e) {
|
|
8
|
-
const parseError = newInvariantError(
|
|
8
|
+
const parseError = newInvariantError(55, label, e.message);
|
|
9
9
|
parseError.parseError = e;
|
|
10
10
|
throw parseError;
|
|
11
11
|
}
|
|
@@ -43,7 +43,7 @@ export const createPersistedQueryLink = (options) => {
|
|
|
43
43
|
// hashing with something other than SHA-256.
|
|
44
44
|
invariant(options &&
|
|
45
45
|
(typeof options.sha256 === "function" ||
|
|
46
|
-
typeof options.generateHash === "function"),
|
|
46
|
+
typeof options.generateHash === "function"), 50);
|
|
47
47
|
const { sha256,
|
|
48
48
|
// If both a `sha256` and `generateHash` option are provided, the
|
|
49
49
|
// `sha256` option will be ignored. Developers can configure and
|
|
@@ -69,7 +69,7 @@ export const createPersistedQueryLink = (options) => {
|
|
|
69
69
|
return hash;
|
|
70
70
|
}
|
|
71
71
|
return Object.assign(new ApolloLink((operation, forward) => {
|
|
72
|
-
invariant(forward,
|
|
72
|
+
invariant(forward, 51);
|
|
73
73
|
const { query } = operation;
|
|
74
74
|
return new Observable((observer) => {
|
|
75
75
|
let subscription;
|
|
@@ -86,7 +86,7 @@ function maskSelectionSet(data, selectionSet, context, migration, path) {
|
|
|
86
86
|
const fragment = context.fragmentMap[fragmentName] ||
|
|
87
87
|
(context.fragmentMap[fragmentName] =
|
|
88
88
|
context.cache.lookupFragment(fragmentName));
|
|
89
|
-
invariant(fragment,
|
|
89
|
+
invariant(fragment, 43, fragmentName);
|
|
90
90
|
const mode = getFragmentMaskMode(selection);
|
|
91
91
|
if (mode !== "mask") {
|
|
92
92
|
value = maskSelectionSet(data, fragment.selectionSet, context, mode === "migrate", path);
|
|
@@ -112,7 +112,7 @@ function getAccessorWarningDescriptor(fieldName, value, path, operationName, ope
|
|
|
112
112
|
if (disableWarningsSlot.getValue()) {
|
|
113
113
|
return value;
|
|
114
114
|
}
|
|
115
|
-
__DEV__ && invariant.warn(
|
|
115
|
+
__DEV__ && invariant.warn(44, operationName ?
|
|
116
116
|
`${operationType} '${operationName}'`
|
|
117
117
|
: `anonymous ${operationType}`, `${path}.${fieldName}`.replace(/^\./, ""));
|
|
118
118
|
getValue = () => value;
|
package/masking/maskFragment.js
CHANGED
|
@@ -15,11 +15,11 @@ export function maskFragment(data, document, cache, fragmentName) {
|
|
|
15
15
|
}
|
|
16
16
|
const fragments = document.definitions.filter((node) => node.kind === Kind.FRAGMENT_DEFINITION);
|
|
17
17
|
if (typeof fragmentName === "undefined") {
|
|
18
|
-
invariant(fragments.length === 1,
|
|
18
|
+
invariant(fragments.length === 1, 45, fragments.length);
|
|
19
19
|
fragmentName = fragments[0].name.value;
|
|
20
20
|
}
|
|
21
21
|
const fragment = fragments.find((fragment) => fragment.name.value === fragmentName);
|
|
22
|
-
invariant(!!fragment,
|
|
22
|
+
invariant(!!fragment, 46, fragmentName);
|
|
23
23
|
if (data == null) {
|
|
24
24
|
// Maintain the original `null` or `undefined` value
|
|
25
25
|
return data;
|
package/masking/maskOperation.js
CHANGED
|
@@ -12,7 +12,7 @@ export function maskOperation(data, document, cache) {
|
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
14
|
const definition = getOperationDefinition(document);
|
|
15
|
-
invariant(definition,
|
|
15
|
+
invariant(definition, 47);
|
|
16
16
|
if (data == null) {
|
|
17
17
|
// Maintain the original `null` or `undefined` value
|
|
18
18
|
return data;
|
package/masking/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import { getApolloContext } from "./ApolloContext.js";
|
|
|
4
4
|
export const ApolloConsumer = (props) => {
|
|
5
5
|
const ApolloContext = getApolloContext();
|
|
6
6
|
return (React.createElement(ApolloContext.Consumer, null, (context) => {
|
|
7
|
-
invariant(context && context.client,
|
|
7
|
+
invariant(context && context.client, 40);
|
|
8
8
|
return props.children(context.client);
|
|
9
9
|
}));
|
|
10
10
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type * as ReactTypes from "react";
|
|
2
2
|
import type { ApolloClient } from "@apollo/client/core";
|
|
3
|
-
import type {
|
|
3
|
+
import type { HookWrappers, wrapperSymbol } from "@apollo/client/react/internal";
|
|
4
4
|
export interface ApolloContextValue {
|
|
5
5
|
client?: ApolloClient;
|
|
6
|
-
|
|
6
|
+
[wrapperSymbol]?: HookWrappers;
|
|
7
7
|
}
|
|
8
8
|
export declare function getApolloContext(): ReactTypes.Context<ApolloContextValue>;
|
|
9
9
|
//# sourceMappingURL=ApolloContext.d.ts.map
|
|
@@ -6,7 +6,7 @@ import { invariant } from "@apollo/client/utilities/invariant";
|
|
|
6
6
|
// context), a single Apollo context is created and tracked in global state.
|
|
7
7
|
const contextKey = Symbol.for("__APOLLO_CONTEXT__");
|
|
8
8
|
export function getApolloContext() {
|
|
9
|
-
invariant("createContext" in React,
|
|
9
|
+
invariant("createContext" in React, 41);
|
|
10
10
|
let context = React.createContext[contextKey];
|
|
11
11
|
if (!context) {
|
|
12
12
|
Object.defineProperty(React.createContext, contextKey, {
|