@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.
Files changed (168) hide show
  1. package/.changeset/eleven-kangaroos-jump.md +5 -0
  2. package/.changeset/forty-shrimps-fry.md +5 -0
  3. package/.changeset/grumpy-vans-type.md +5 -0
  4. package/.changeset/little-spoons-kick.md +7 -0
  5. package/.changeset/loud-cows-raise.md +7 -0
  6. package/.changeset/many-buses-allow.md +5 -0
  7. package/.changeset/poor-eels-punch.md +5 -0
  8. package/.changeset/pre.json +13 -0
  9. package/.changeset/real-teachers-peel.md +5 -0
  10. package/.changeset/slimy-chicken-melt.md +5 -0
  11. package/.changeset/thick-books-grin.md +5 -0
  12. package/.changeset/tough-rockets-allow.md +5 -0
  13. package/.changeset/tricky-tables-shave.md +5 -0
  14. package/.changeset/warm-ties-sit.md +7 -0
  15. package/CHANGELOG.md +40 -0
  16. package/__cjs/cache/core/cache.cjs +1 -1
  17. package/__cjs/cache/inmemory/entityStore.cjs +3 -3
  18. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  19. package/__cjs/cache/inmemory/policies.cjs +4 -4
  20. package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
  21. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  22. package/__cjs/core/ApolloClient.cjs +3 -3
  23. package/__cjs/core/ApolloClient.cjs.map +1 -1
  24. package/__cjs/core/ApolloClient.d.cts +4 -4
  25. package/__cjs/core/LocalState.cjs +2 -2
  26. package/__cjs/core/ObservableQuery.cjs +15 -12
  27. package/__cjs/core/ObservableQuery.cjs.map +1 -1
  28. package/__cjs/core/QueryManager.cjs +57 -35
  29. package/__cjs/core/QueryManager.cjs.map +1 -1
  30. package/__cjs/core/QueryManager.d.cts +3 -3
  31. package/__cjs/core/types.d.cts +32 -0
  32. package/__cjs/invariantErrorCodes.cjs +57 -77
  33. package/__cjs/link/core/ApolloLink.cjs +2 -2
  34. package/__cjs/link/http/checkFetcher.cjs +1 -1
  35. package/__cjs/link/http/createHttpLink.cjs +1 -1
  36. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  37. package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
  38. package/__cjs/link/persisted-queries/index.cjs +2 -2
  39. package/__cjs/link/utils/validateOperation.cjs +1 -1
  40. package/__cjs/masking/maskDefinition.cjs +2 -2
  41. package/__cjs/masking/maskFragment.cjs +2 -2
  42. package/__cjs/masking/maskOperation.cjs +1 -1
  43. package/__cjs/masking/utils.cjs +1 -1
  44. package/__cjs/react/context/ApolloConsumer.cjs +1 -1
  45. package/__cjs/react/context/ApolloContext.cjs +1 -1
  46. package/__cjs/react/context/ApolloContext.cjs.map +1 -1
  47. package/__cjs/react/context/ApolloContext.d.cts +2 -2
  48. package/__cjs/react/context/ApolloProvider.cjs +1 -1
  49. package/__cjs/react/hooks/internal/wrapHook.cjs +26 -5
  50. package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
  51. package/__cjs/react/hooks/internal/wrapHook.d.cts +3 -1
  52. package/__cjs/react/hooks/useMutation.cjs +14 -19
  53. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  54. package/__cjs/react/hooks/useMutation.d.cts +4 -4
  55. package/__cjs/react/hooks/useQuery.cjs +82 -187
  56. package/__cjs/react/hooks/useQuery.cjs.map +1 -1
  57. package/__cjs/react/hooks/useQuery.d.cts +4 -0
  58. package/__cjs/react/hooks/useSubscription.cjs +8 -57
  59. package/__cjs/react/hooks/useSubscription.cjs.map +1 -1
  60. package/__cjs/react/hooks/useSubscription.d.cts +6 -42
  61. package/__cjs/react/hooks/useSuspenseQuery.cjs +2 -2
  62. package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
  63. package/__cjs/react/internal/index.cjs +3 -1
  64. package/__cjs/react/internal/index.cjs.map +1 -1
  65. package/__cjs/react/internal/index.d.cts +1 -0
  66. package/__cjs/react/ssr/getDataFromTree.cjs +43 -12
  67. package/__cjs/react/ssr/getDataFromTree.cjs.map +1 -1
  68. package/__cjs/react/ssr/getDataFromTree.d.cts +5 -0
  69. package/__cjs/react/ssr/index.cjs +1 -3
  70. package/__cjs/react/ssr/index.cjs.map +1 -1
  71. package/__cjs/react/ssr/index.d.cts +0 -1
  72. package/__cjs/react/ssr/useSSRQuery.cjs +60 -0
  73. package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -0
  74. package/__cjs/react/ssr/useSSRQuery.d.cts +5 -0
  75. package/__cjs/react/types/deprecated.d.cts +1 -1
  76. package/__cjs/react/types/types.documentation.d.cts +4 -12
  77. package/__cjs/testing/matchers/index.cjs +2 -0
  78. package/__cjs/testing/matchers/index.cjs.map +1 -1
  79. package/__cjs/testing/matchers/toEmitStrictTyped.cjs +42 -0
  80. package/__cjs/testing/matchers/toEmitStrictTyped.cjs.map +1 -0
  81. package/__cjs/testing/matchers/toEmitStrictTyped.d.cts +7 -0
  82. package/__cjs/testing/matchers/toEqualStrictTyped.cjs +2 -20
  83. package/__cjs/testing/matchers/toEqualStrictTyped.cjs.map +1 -1
  84. package/__cjs/testing/matchers/utils/getSerializableProperties.cjs +23 -0
  85. package/__cjs/testing/matchers/utils/getSerializableProperties.cjs.map +1 -0
  86. package/__cjs/testing/matchers/utils/getSerializableProperties.d.cts +2 -0
  87. package/__cjs/version.cjs +1 -1
  88. package/__cjs/version.d.cts +1 -1
  89. package/cache/core/cache.js +1 -1
  90. package/cache/inmemory/entityStore.js +3 -3
  91. package/cache/inmemory/key-extractor.js +1 -1
  92. package/cache/inmemory/policies.js +4 -4
  93. package/cache/inmemory/readFromStore.js +2 -2
  94. package/cache/inmemory/writeToStore.js +4 -4
  95. package/core/ApolloClient.d.ts +4 -4
  96. package/core/ApolloClient.js +3 -3
  97. package/core/ApolloClient.js.map +1 -1
  98. package/core/LocalState.js +2 -2
  99. package/core/ObservableQuery.js +15 -12
  100. package/core/ObservableQuery.js.map +1 -1
  101. package/core/QueryManager.d.ts +3 -3
  102. package/core/QueryManager.js +58 -36
  103. package/core/QueryManager.js.map +1 -1
  104. package/core/types.d.ts +32 -0
  105. package/invariantErrorCodes.js +57 -77
  106. package/link/core/ApolloLink.js +2 -2
  107. package/link/http/checkFetcher.js +1 -1
  108. package/link/http/createHttpLink.js +1 -1
  109. package/link/http/parseAndCheckHttpResponse.js +1 -1
  110. package/link/http/serializeFetchParameter.js +1 -1
  111. package/link/persisted-queries/index.js +2 -2
  112. package/link/utils/validateOperation.js +1 -1
  113. package/masking/maskDefinition.js +2 -2
  114. package/masking/maskFragment.js +2 -2
  115. package/masking/maskOperation.js +1 -1
  116. package/masking/utils.js +1 -1
  117. package/package.json +1 -1
  118. package/react/context/ApolloConsumer.js +1 -1
  119. package/react/context/ApolloContext.d.ts +2 -2
  120. package/react/context/ApolloContext.js +1 -1
  121. package/react/context/ApolloContext.js.map +1 -1
  122. package/react/context/ApolloProvider.js +1 -1
  123. package/react/hooks/internal/wrapHook.d.ts +3 -1
  124. package/react/hooks/internal/wrapHook.js +24 -5
  125. package/react/hooks/internal/wrapHook.js.map +1 -1
  126. package/react/hooks/useMutation.d.ts +4 -4
  127. package/react/hooks/useMutation.js +14 -19
  128. package/react/hooks/useMutation.js.map +1 -1
  129. package/react/hooks/useQuery.d.ts +4 -0
  130. package/react/hooks/useQuery.js +83 -188
  131. package/react/hooks/useQuery.js.map +1 -1
  132. package/react/hooks/useSubscription.d.ts +6 -42
  133. package/react/hooks/useSubscription.js +7 -53
  134. package/react/hooks/useSubscription.js.map +1 -1
  135. package/react/hooks/useSuspenseQuery.js +2 -2
  136. package/react/hooks/useSyncExternalStore.js +1 -1
  137. package/react/internal/index.d.ts +1 -0
  138. package/react/internal/index.js +2 -1
  139. package/react/internal/index.js.map +1 -1
  140. package/react/ssr/getDataFromTree.d.ts +5 -0
  141. package/react/ssr/getDataFromTree.js +43 -12
  142. package/react/ssr/getDataFromTree.js.map +1 -1
  143. package/react/ssr/index.d.ts +0 -1
  144. package/react/ssr/index.js +0 -1
  145. package/react/ssr/index.js.map +1 -1
  146. package/react/ssr/useSSRQuery.d.ts +5 -0
  147. package/react/ssr/useSSRQuery.js +56 -0
  148. package/react/ssr/useSSRQuery.js.map +1 -0
  149. package/react/types/deprecated.d.ts +1 -1
  150. package/react/types/types.documentation.d.ts +4 -12
  151. package/testing/matchers/index.js +2 -0
  152. package/testing/matchers/index.js.map +1 -1
  153. package/testing/matchers/toEmitStrictTyped.d.ts +7 -0
  154. package/testing/matchers/toEmitStrictTyped.js +38 -0
  155. package/testing/matchers/toEmitStrictTyped.js.map +1 -0
  156. package/testing/matchers/toEqualStrictTyped.js +1 -19
  157. package/testing/matchers/toEqualStrictTyped.js.map +1 -1
  158. package/testing/matchers/utils/getSerializableProperties.d.ts +2 -0
  159. package/testing/matchers/utils/getSerializableProperties.js +20 -0
  160. package/testing/matchers/utils/getSerializableProperties.js.map +1 -0
  161. package/version.d.ts +1 -1
  162. package/version.js +1 -1
  163. package/__cjs/react/ssr/RenderPromises.cjs +0 -104
  164. package/__cjs/react/ssr/RenderPromises.cjs.map +0 -1
  165. package/__cjs/react/ssr/RenderPromises.d.cts +0 -25
  166. package/react/ssr/RenderPromises.d.ts +0 -25
  167. package/react/ssr/RenderPromises.js +0 -100
  168. 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
@@ -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
- 40: {
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
- 41: {
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
- 44: {
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
- 45: {
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
- 46: {
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
- 47: {
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
- 49: {
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
- 50: {
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
- 51: {
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
- 53: {
268
+ 49: {
269
269
  file: "@apollo/client/link/utils/validateOperation.js",
270
270
  message: `illegal argument: %s`
271
271
  },
272
272
 
273
- 54: {
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
- 55: {
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
- 56: {
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
- 58: {
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
- 59: {
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
- 61: {
317
+ 57: {
318
318
  file: "@apollo/client/link/core/ApolloLink.js",
319
319
  message: "request is not implemented"
320
320
  },
321
321
 
322
- 62: {
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
- 63: {
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
- 65: {
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
- 66: {
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
- 68: {
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
- 70: {
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
- 72: {
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
- 73: {
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
- 74: {
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
- 75: {
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
- 76: {
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
- 77: {
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
- 78: {
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
- 79: {
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
- 83: {
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
- 86: {
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
- 87: {
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
- 90: {
430
+ 86: {
431
431
  file: "@apollo/client/cache/inmemory/policies.js",
432
432
  message: "Cannot automatically merge arrays"
433
433
  },
434
434
 
435
- 91: {
435
+ 87: {
436
436
  file: "@apollo/client/cache/inmemory/readFromStore.js",
437
437
  message: `No fragment named %s`
438
438
  },
439
439
 
440
- 92: {
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
- 93: {
446
+ 89: {
447
447
  file: "@apollo/client/cache/inmemory/writeToStore.js",
448
448
  message: `Could not identify object %s`
449
449
  },
450
450
 
451
- 95: {
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
- 64: {
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
- 71: {
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
- 48: {
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
- 52: {
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
- 57: {
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
- 60: {
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
- 67: {
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
- 80: {
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
- 81: {
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
- 82: {
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
- 84: {
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
- 85: {
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
- 88: {
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
- 89: {
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
- 96: {
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
- 97: {
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
- 43: {
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
- 69: {
602
+ 65: {
623
603
  file: "@apollo/client/core/ObservableQuery.js",
624
604
  message: "Unhandled GraphQL subscription error"
625
605
  },
626
606
 
627
- 94: {
607
+ 90: {
628
608
  file: "@apollo/client/cache/inmemory/writeToStore.js",
629
609
  message: `Missing field '%s' while writing result %o`
630
610
  }
@@ -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(60, firstLink);
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(61);
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", 56);
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(57);
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", 58);
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(59, label, e.message);
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"), 54);
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, 55);
72
+ invariant(forward, 51);
73
73
  const { query } = operation;
74
74
  return new Observable((observer) => {
75
75
  let subscription;
@@ -9,7 +9,7 @@ export function validateOperation(operation) {
9
9
  ];
10
10
  for (let key of Object.keys(operation)) {
11
11
  if (OPERATION_FIELDS.indexOf(key) < 0) {
12
- throw newInvariantError(53, key);
12
+ throw newInvariantError(49, key);
13
13
  }
14
14
  }
15
15
  return operation;
@@ -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, 47, fragmentName);
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(48, operationName ?
115
+ __DEV__ && invariant.warn(44, operationName ?
116
116
  `${operationType} '${operationName}'`
117
117
  : `anonymous ${operationType}`, `${path}.${fieldName}`.replace(/^\./, ""));
118
118
  getValue = () => value;
@@ -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, 49, fragments.length);
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, 50, fragmentName);
22
+ invariant(!!fragment, 46, fragmentName);
23
23
  if (data == null) {
24
24
  // Maintain the original `null` or `undefined` value
25
25
  return data;
@@ -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, 51);
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
@@ -9,7 +9,7 @@ let issuedWarning = false;
9
9
  export function warnOnImproperCacheImplementation() {
10
10
  if (!issuedWarning) {
11
11
  issuedWarning = true;
12
- __DEV__ && invariant.warn(52);
12
+ __DEV__ && invariant.warn(48);
13
13
  }
14
14
  }
15
15
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/client",
3
- "version": "4.0.0-alpha.4",
3
+ "version": "4.0.0-alpha.5",
4
4
  "description": "A fully-featured caching GraphQL client.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -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, 44);
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 { RenderPromises } from "@apollo/client/react/ssr";
3
+ import type { HookWrappers, wrapperSymbol } from "@apollo/client/react/internal";
4
4
  export interface ApolloContextValue {
5
5
  client?: ApolloClient;
6
- renderPromises?: RenderPromises;
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, 45);
9
+ invariant("createContext" in React, 41);
10
10
  let context = React.createContext[contextKey];
11
11
  if (!context) {
12
12
  Object.defineProperty(React.createContext, contextKey, {