@apollo/client 3.10.3 → 3.10.4

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 (74) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/apollo-client.cjs +106 -99
  3. package/apollo-client.cjs.map +1 -1
  4. package/apollo-client.min.cjs +1 -1
  5. package/cache/cache.cjs +81 -8
  6. package/cache/cache.cjs.map +1 -1
  7. package/cache/cache.cjs.native.js +81 -8
  8. package/cache/core/cache.js +8 -4
  9. package/cache/core/cache.js.map +1 -1
  10. package/core/ApolloClient.js +2 -1
  11. package/core/ApolloClient.js.map +1 -1
  12. package/core/ObservableQuery.js +1 -1
  13. package/core/ObservableQuery.js.map +1 -1
  14. package/core/QueryInfo.js +7 -11
  15. package/core/QueryInfo.js.map +1 -1
  16. package/core/core.cjs +5 -7
  17. package/core/core.cjs.map +1 -1
  18. package/core/core.cjs.native.js +5 -7
  19. package/dev/dev.cjs +32 -27
  20. package/dev/dev.cjs.map +1 -1
  21. package/dev/dev.cjs.native.js +32 -27
  22. package/invariantErrorCodes.js +32 -26
  23. package/package.json +1 -1
  24. package/react/hooks/hooks.cjs +3 -0
  25. package/react/hooks/hooks.cjs.map +1 -1
  26. package/react/hooks/hooks.cjs.native.js +3 -0
  27. package/react/hooks/useBackgroundQuery.d.ts +10 -13
  28. package/react/hooks/useBackgroundQuery.js.map +1 -1
  29. package/react/hooks/useLoadableQuery.d.ts +2 -2
  30. package/react/hooks/useLoadableQuery.js +2 -1
  31. package/react/hooks/useLoadableQuery.js.map +1 -1
  32. package/react/hooks/useQueryRefHandlers.d.ts +3 -3
  33. package/react/hooks/useQueryRefHandlers.js +3 -2
  34. package/react/hooks/useQueryRefHandlers.js.map +1 -1
  35. package/react/hooks/useReadQuery.d.ts +2 -2
  36. package/react/hooks/useReadQuery.js +2 -1
  37. package/react/hooks/useReadQuery.js.map +1 -1
  38. package/react/internal/cache/QueryReference.d.ts +68 -6
  39. package/react/internal/cache/QueryReference.js +4 -0
  40. package/react/internal/cache/QueryReference.js.map +1 -1
  41. package/react/internal/index.d.ts +2 -2
  42. package/react/internal/index.js +1 -1
  43. package/react/internal/index.js.map +1 -1
  44. package/react/internal/internal.cjs +92 -0
  45. package/react/internal/internal.cjs.map +1 -1
  46. package/react/internal/internal.cjs.native.js +92 -0
  47. package/react/parser/index.js +5 -5
  48. package/react/parser/parser.cjs +5 -5
  49. package/react/parser/parser.cjs.map +1 -1
  50. package/react/parser/parser.cjs.native.js +5 -5
  51. package/react/query-preloader/createQueryPreloader.d.ts +6 -6
  52. package/react/query-preloader/createQueryPreloader.js.map +1 -1
  53. package/react/types/types.d.ts +1 -1
  54. package/react/types/types.js.map +1 -1
  55. package/testing/core/core.cjs +4 -4
  56. package/testing/core/core.cjs.map +1 -1
  57. package/testing/core/core.cjs.native.js +4 -4
  58. package/testing/core/mocking/mockLink.js +5 -5
  59. package/testing/core/mocking/mockLink.js.map +1 -1
  60. package/testing/matchers/toBeDisposed.js +4 -13
  61. package/testing/matchers/toBeDisposed.js.map +1 -1
  62. package/utilities/globals/globals.cjs +1 -1
  63. package/utilities/globals/globals.cjs.map +1 -1
  64. package/utilities/globals/globals.cjs.native.js +1 -1
  65. package/utilities/graphql/DocumentTransform.js +1 -1
  66. package/utilities/graphql/directives.js +4 -4
  67. package/utilities/graphql/fragments.js +3 -3
  68. package/utilities/graphql/getFromAST.js +8 -8
  69. package/utilities/graphql/storeUtils.js +1 -1
  70. package/utilities/graphql/transform.js +2 -2
  71. package/utilities/utilities.cjs +19 -19
  72. package/utilities/utilities.cjs.map +1 -1
  73. package/utilities/utilities.cjs.native.js +19 -19
  74. package/version.js +1 -1
@@ -230,6 +230,12 @@ export const errorCodes = // This file is used by the error message display webs
230
230
  },
231
231
 
232
232
  59: {
233
+ file: "@apollo/client/react/internal/cache/QueryReference.js",
234
+ condition: "!queryRef || QUERY_REFERENCE_SYMBOL in queryRef",
235
+ message: "Expected a QueryRef object, but got something else instead."
236
+ },
237
+
238
+ 60: {
233
239
  file: "@apollo/client/react/parser/index.js",
234
240
  condition: "!!document && !!document.kind",
235
241
 
@@ -238,7 +244,7 @@ export const errorCodes = // This file is used by the error message display webs
238
244
  "to convert your operation into a document"
239
245
  },
240
246
 
241
- 60: {
247
+ 61: {
242
248
  file: "@apollo/client/react/parser/index.js",
243
249
  condition: "!fragments.length ||\n queries.length ||\n mutations.length ||\n subscriptions.length",
244
250
 
@@ -246,7 +252,7 @@ export const errorCodes = // This file is used by the error message display webs
246
252
  "You must include a query, subscription or mutation as well"
247
253
  },
248
254
 
249
- 61: {
255
+ 62: {
250
256
  file: "@apollo/client/react/parser/index.js",
251
257
  condition: "queries.length + mutations.length + subscriptions.length <= 1",
252
258
 
@@ -256,7 +262,7 @@ export const errorCodes = // This file is used by the error message display webs
256
262
  "You can use 'compose' to join multiple operation types to a component"
257
263
  },
258
264
 
259
- 62: {
265
+ 63: {
260
266
  file: "@apollo/client/react/parser/index.js",
261
267
  condition: "definitions.length === 1",
262
268
 
@@ -265,120 +271,120 @@ export const errorCodes = // This file is used by the error message display webs
265
271
  "You can use 'compose' to join multiple operation types to a component"
266
272
  },
267
273
 
268
- 63: {
274
+ 64: {
269
275
  file: "@apollo/client/react/parser/index.js",
270
276
  condition: "operation.type === type",
271
277
  message: "Running a %s requires a graphql " + "%s, but a %s was used instead."
272
278
  },
273
279
 
274
- 64: {
280
+ 65: {
275
281
  file: "@apollo/client/testing/core/mocking/mockLink.js",
276
- condition: "queryWithoutConnection",
282
+ condition: "queryWithoutClientOnlyDirectives",
277
283
  message: "query is required"
278
284
  },
279
285
 
280
- 65: {
286
+ 66: {
281
287
  file: "@apollo/client/testing/core/mocking/mockLink.js",
282
288
  condition: "mockedResponse.maxUsageCount > 0",
283
289
  message: "Mock response maxUsageCount must be greater than 0, %s given"
284
290
  },
285
291
 
286
- 66: {
292
+ 67: {
287
293
  file: "@apollo/client/utilities/graphql/DocumentTransform.js",
288
294
  condition: "Array.isArray(cacheKeys)",
289
295
  message: "`getCacheKey` must return an array or undefined"
290
296
  },
291
297
 
292
- 67: {
298
+ 68: {
293
299
  file: "@apollo/client/utilities/graphql/directives.js",
294
300
  condition: "evaledValue !== void 0",
295
301
  message: "Invalid variable referenced in @%s directive."
296
302
  },
297
303
 
298
- 68: {
304
+ 69: {
299
305
  file: "@apollo/client/utilities/graphql/directives.js",
300
306
  condition: "directiveArguments && directiveArguments.length === 1",
301
307
  message: "Incorrect number of arguments for the @%s directive."
302
308
  },
303
309
 
304
- 69: {
310
+ 70: {
305
311
  file: "@apollo/client/utilities/graphql/directives.js",
306
312
  condition: "ifArgument.name && ifArgument.name.value === \"if\"",
307
313
  message: "Invalid argument for the @%s directive."
308
314
  },
309
315
 
310
- 70: {
316
+ 71: {
311
317
  file: "@apollo/client/utilities/graphql/directives.js",
312
318
  condition: "ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\")",
313
319
  message: "Argument for the @%s directive must be a variable or a boolean value."
314
320
  },
315
321
 
316
- 71: {
322
+ 72: {
317
323
  file: "@apollo/client/utilities/graphql/fragments.js",
318
324
 
319
325
  message: "Found a %s operation%s. " +
320
326
  "No operations are allowed when using a fragment as a query. Only fragments are allowed."
321
327
  },
322
328
 
323
- 72: {
329
+ 73: {
324
330
  file: "@apollo/client/utilities/graphql/fragments.js",
325
331
  condition: "fragments.length === 1",
326
332
  message: "Found %s fragments. `fragmentName` must be provided when there is not exactly 1 fragment."
327
333
  },
328
334
 
329
- 73: {
335
+ 74: {
330
336
  file: "@apollo/client/utilities/graphql/fragments.js",
331
337
  condition: "fragment",
332
338
  message: "No fragment named %s"
333
339
  },
334
340
 
335
- 74: {
341
+ 75: {
336
342
  file: "@apollo/client/utilities/graphql/getFromAST.js",
337
343
  condition: "doc && doc.kind === \"Document\"",
338
344
  message: "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"
339
345
  },
340
346
 
341
- 75: {
347
+ 76: {
342
348
  file: "@apollo/client/utilities/graphql/getFromAST.js",
343
349
  message: "Schema type definitions not allowed in queries. Found: \"%s\""
344
350
  },
345
351
 
346
- 76: {
352
+ 77: {
347
353
  file: "@apollo/client/utilities/graphql/getFromAST.js",
348
354
  condition: "operations.length <= 1",
349
355
  message: "Ambiguous GraphQL document: contains %s operations"
350
356
  },
351
357
 
352
- 77: {
358
+ 78: {
353
359
  file: "@apollo/client/utilities/graphql/getFromAST.js",
354
360
  condition: "queryDef && queryDef.operation === \"query\"",
355
361
  message: "Must contain a query definition."
356
362
  },
357
363
 
358
- 78: {
364
+ 79: {
359
365
  file: "@apollo/client/utilities/graphql/getFromAST.js",
360
366
  condition: "doc.kind === \"Document\"",
361
367
  message: "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql"
362
368
  },
363
369
 
364
- 79: {
370
+ 80: {
365
371
  file: "@apollo/client/utilities/graphql/getFromAST.js",
366
372
  condition: "doc.definitions.length <= 1",
367
373
  message: "Fragment must have exactly one definition."
368
374
  },
369
375
 
370
- 80: {
376
+ 81: {
371
377
  file: "@apollo/client/utilities/graphql/getFromAST.js",
372
378
  condition: "fragmentDef.kind === \"FragmentDefinition\"",
373
379
  message: "Must be a fragment definition."
374
380
  },
375
381
 
376
- 81: {
382
+ 82: {
377
383
  file: "@apollo/client/utilities/graphql/getFromAST.js",
378
384
  message: "Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."
379
385
  },
380
386
 
381
- 82: {
387
+ 83: {
382
388
  file: "@apollo/client/utilities/graphql/storeUtils.js",
383
389
 
384
390
  message: "The inline argument \"%s\" of kind \"%s\"" +
@@ -492,7 +498,7 @@ export const devWarn = {
492
498
  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."
493
499
  },
494
500
 
495
- 84: {
501
+ 85: {
496
502
  file: "@apollo/client/utilities/graphql/transform.js",
497
503
 
498
504
  message: "Removing an @connection directive even though it does not have a key. " +
@@ -521,7 +527,7 @@ export const devError = {
521
527
  message: "The result of getSnapshot should be cached to avoid an infinite loop"
522
528
  },
523
529
 
524
- 83: {
530
+ 84: {
525
531
  file: "@apollo/client/utilities/graphql/transform.js",
526
532
  message: "Could not find operation or fragment"
527
533
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo/client",
3
- "version": "3.10.3",
3
+ "version": "3.10.4",
4
4
  "description": "A fully-featured caching GraphQL client.",
5
5
  "private": false,
6
6
  "keywords": [
@@ -975,6 +975,7 @@ function useLoadableQuery(query, options) {
975
975
  var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });
976
976
  var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
977
977
  var _b = React__namespace.useState(null), queryRef = _b[0], setQueryRef = _b[1];
978
+ internal.assertWrappedQueryRef(queryRef);
978
979
  var internalQueryRef = queryRef && internal.unwrapQueryRef(queryRef);
979
980
  if (queryRef && (internalQueryRef === null || internalQueryRef === void 0 ? void 0 : internalQueryRef.didChangeOptions(watchQueryOptions))) {
980
981
  var promise = internalQueryRef.applyOptions(watchQueryOptions);
@@ -1026,6 +1027,7 @@ function useQueryRefHandlers(queryRef) {
1026
1027
  : useApolloClient())(queryRef);
1027
1028
  }
1028
1029
  function _useQueryRefHandlers(queryRef) {
1030
+ internal.assertWrappedQueryRef(queryRef);
1029
1031
  var _a = React__namespace.useState(queryRef), previousQueryRef = _a[0], setPreviousQueryRef = _a[1];
1030
1032
  var _b = React__namespace.useState(queryRef), wrappedQueryRef = _b[0], setWrappedQueryRef = _b[1];
1031
1033
  var internalQueryRef = internal.unwrapQueryRef(queryRef);
@@ -1056,6 +1058,7 @@ function useReadQuery(queryRef) {
1056
1058
  : useApolloClient())(queryRef);
1057
1059
  }
1058
1060
  function _useReadQuery(queryRef) {
1061
+ internal.assertWrappedQueryRef(queryRef);
1059
1062
  var internalQueryRef = React__namespace.useMemo(function () { return internal.unwrapQueryRef(queryRef); }, [queryRef]);
1060
1063
  var getPromise = React__namespace.useCallback(function () { return internal.getWrappedPromise(queryRef); }, [queryRef]);
1061
1064
  if (internalQueryRef.disposed) {