@apollo/client 4.1.0-alpha.0 → 4.1.0-alpha.2

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 (75) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/__cjs/cache/core/cache.cjs +1 -1
  3. package/__cjs/cache/core/cache.cjs.map +1 -1
  4. package/__cjs/cache/core/cache.d.cts +19 -0
  5. package/__cjs/cache/inmemory/entityStore.cjs +3 -3
  6. package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
  7. package/__cjs/cache/inmemory/inMemoryCache.cjs +3 -0
  8. package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
  9. package/__cjs/cache/inmemory/inMemoryCache.d.cts +1 -0
  10. package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
  11. package/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
  12. package/__cjs/cache/inmemory/policies.cjs +4 -4
  13. package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
  14. package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
  15. package/__cjs/core/ApolloClient.cjs +14 -13
  16. package/__cjs/core/ApolloClient.cjs.map +1 -1
  17. package/__cjs/core/ApolloClient.d.cts +12 -0
  18. package/__cjs/core/ObservableQuery.cjs +6 -6
  19. package/__cjs/core/QueryManager.cjs +19 -17
  20. package/__cjs/core/QueryManager.cjs.map +1 -1
  21. package/__cjs/incremental/handlers/graphql17Alpha9.cjs +1 -1
  22. package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
  23. package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -1
  24. package/__cjs/invariantErrorCodes.cjs +72 -62
  25. package/__cjs/link/core/ApolloLink.cjs +3 -3
  26. package/__cjs/link/http/checkFetcher.cjs +1 -1
  27. package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
  28. package/__cjs/link/persisted-queries/index.cjs +2 -2
  29. package/__cjs/link/ws/index.cjs +1 -1
  30. package/__cjs/local-state/LocalState.cjs +28 -14
  31. package/__cjs/local-state/LocalState.cjs.map +1 -1
  32. package/__cjs/local-state/LocalState.d.cts +3 -2
  33. package/__cjs/react/hooks/useMutation.cjs +7 -1
  34. package/__cjs/react/hooks/useMutation.cjs.map +1 -1
  35. package/__cjs/react/hooks/useMutation.d.cts +13 -1
  36. package/__cjs/version.cjs +1 -1
  37. package/cache/core/cache.d.ts +19 -0
  38. package/cache/core/cache.js +1 -1
  39. package/cache/core/cache.js.map +1 -1
  40. package/cache/inmemory/entityStore.js +3 -3
  41. package/cache/inmemory/entityStore.js.map +1 -1
  42. package/cache/inmemory/inMemoryCache.d.ts +1 -0
  43. package/cache/inmemory/inMemoryCache.js +3 -0
  44. package/cache/inmemory/inMemoryCache.js.map +1 -1
  45. package/cache/inmemory/key-extractor.js +1 -1
  46. package/cache/inmemory/key-extractor.js.map +1 -1
  47. package/cache/inmemory/policies.js +4 -4
  48. package/cache/inmemory/readFromStore.js +2 -2
  49. package/cache/inmemory/writeToStore.js +4 -4
  50. package/core/ApolloClient.d.ts +12 -0
  51. package/core/ApolloClient.js +14 -13
  52. package/core/ApolloClient.js.map +1 -1
  53. package/core/ObservableQuery.js +6 -6
  54. package/core/QueryManager.js +19 -17
  55. package/core/QueryManager.js.map +1 -1
  56. package/incremental/handlers/graphql17Alpha9.js +1 -1
  57. package/incremental/handlers/notImplemented.js +1 -1
  58. package/incremental/handlers/notImplemented.js.map +1 -1
  59. package/invariantErrorCodes.js +72 -62
  60. package/link/core/ApolloLink.js +3 -3
  61. package/link/http/checkFetcher.js +1 -1
  62. package/link/http/parseAndCheckHttpResponse.js +1 -1
  63. package/link/persisted-queries/index.js +2 -2
  64. package/link/ws/index.js +1 -1
  65. package/local-state/LocalState.d.ts +3 -2
  66. package/local-state/LocalState.js +28 -14
  67. package/local-state/LocalState.js.map +1 -1
  68. package/package.json +1 -1
  69. package/react/hooks/useMutation.d.ts +13 -1
  70. package/react/hooks/useMutation.js +7 -1
  71. package/react/hooks/useMutation.js.map +1 -1
  72. package/react/hooks-compiled/useMutation.d.ts +13 -1
  73. package/react/hooks-compiled/useMutation.js +5 -1
  74. package/react/hooks-compiled/useMutation.js.map +1 -1
  75. package/version.js +1 -1
@@ -33,7 +33,7 @@ class IncrementalRequest {
33
33
  if (hasIncrementalChunks(chunk)) {
34
34
  for (const incremental of chunk.incremental) {
35
35
  const pending = this.pending.find(({ id }) => incremental.id === id);
36
- invariant(pending, 64);
36
+ invariant(pending, 66);
37
37
  const path = pending.path.concat(incremental.subPath ?? []);
38
38
  let data;
39
39
  let arrayMerge = "truncate";
@@ -5,7 +5,7 @@ export class NotImplementedHandler {
5
5
  return false;
6
6
  }
7
7
  prepareRequest(request) {
8
- invariant(!hasDirectives(["defer"], request.query), 65);
8
+ invariant(!hasDirectives(["defer", "stream"], request.query), 67);
9
9
  return request;
10
10
  }
11
11
  extractErrors() { }
@@ -1 +1 @@
1
- {"version":3,"file":"notImplemented.js","sources":["../../../src/incremental/handlers/notImplemented.ts"],"sourcesContent":["import type { ApolloLink } from \"@apollo/client/link\";\nimport type { HKT } from \"@apollo/client/utilities\";\nimport { hasDirectives } from \"@apollo/client/utilities/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport type { Incremental } from \"../types.js\";\n\nexport declare namespace NotImplementedHandler {\n interface NotImplementedResult extends HKT {\n arg1: unknown; // TData\n arg2: unknown; // TExtensions\n return: never;\n }\n export interface TypeOverrides {\n AdditionalApolloLinkResultTypes: NotImplementedResult;\n }\n}\n\nexport class NotImplementedHandler implements Incremental.Handler<never> {\n isIncrementalResult(_: any): _ is never {\n return false;\n }\n prepareRequest(request: ApolloLink.Request) {\n invariant(\n !hasDirectives([\"defer\"], request.query),\n \"`@defer` is not supported without specifying an incremental handler. Please pass a handler as the `incrementalHandler` option to the `ApolloClient` constructor.\"\n );\n\n return request;\n }\n extractErrors() {}\n // This code path can never be reached, so we won't implement it.\n startRequest = undefined as any;\n}\n"],"names":[],"mappings":"AAEA,C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AjB,CAAA,CAAA,CAAA,CAAA,CAAA,CAA4C,EAA5C;QACI,CAAJ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EACM,CAAC,CADP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACoB,CAAC,CAAC,CADtB,CAAA,CAAA,CAAA,CAAA,CAAA,CAC6B,CAAC,EAAE,CADhC,CAAA,CAAA,CAAA,CAAA,CAAA,CACuC,CAAC,CADxC,CAAA,CAAA,CAAA,CAC6C,MAExC;QAED,CAAJ,CAAA,CAAA,CAAA,CAAA,EAAW,CAAX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB;IAChB;IACA,CAAF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAf,EAAA,EAAmB;IACjB,CAAF,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA;IACE,CAAF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAiB,CAAjB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiC;AACjC;"}
1
+ {"version":3,"file":"notImplemented.js","sources":["../../../src/incremental/handlers/notImplemented.ts"],"sourcesContent":["import type { ApolloLink } from \"@apollo/client/link\";\nimport type { HKT } from \"@apollo/client/utilities\";\nimport { hasDirectives } from \"@apollo/client/utilities/internal\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nimport type { Incremental } from \"../types.js\";\n\nexport declare namespace NotImplementedHandler {\n interface NotImplementedResult extends HKT {\n arg1: unknown; // TData\n arg2: unknown; // TExtensions\n return: never;\n }\n export interface TypeOverrides {\n AdditionalApolloLinkResultTypes: NotImplementedResult;\n }\n}\n\nexport class NotImplementedHandler implements Incremental.Handler<never> {\n isIncrementalResult(_: any): _ is never {\n return false;\n }\n prepareRequest(request: ApolloLink.Request) {\n invariant(\n !hasDirectives([\"defer\", \"stream\"], request.query),\n \"`@defer` and `@stream` are not supported without specifying an incremental handler. Please pass a handler as the `incrementalHandler` option to the `ApolloClient` constructor.\"\n );\n\n return request;\n }\n extractErrors() {}\n // This code path can never be reached, so we won't implement it.\n startRequest = undefined as any;\n}\n"],"names":[],"mappings":"AAEA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAA8B,CAA9B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiE;AACjE,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,EAA0B,CAA1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8D;AAe9D,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CA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CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA;IACE,CAAF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAiB,CAAjB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiC;AACjC;"}
@@ -272,24 +272,24 @@ you have an infinite render loop in your application.`
272
272
  message: "No fragment named %s"
273
273
  },
274
274
 
275
- 53: {
275
+ 55: {
276
276
  file: "@apollo/client/local-state/LocalState.js",
277
277
  message: "Could not resolve __typename on object %o returned from resolver '%s'. '__typename' needs to be returned to properly resolve child fields."
278
278
  },
279
279
 
280
- 54: {
280
+ 56: {
281
281
  file: "@apollo/client/local-state/LocalState.js",
282
282
  condition: "fragment",
283
283
  message: `No fragment named %s`
284
284
  },
285
285
 
286
- 55: {
286
+ 57: {
287
287
  file: "@apollo/client/local-state/LocalState.js",
288
288
  condition: "cache.fragmentMatches",
289
289
  message: "The configured cache does not support fragment matching which will lead to incorrect results when executing local resolvers. Please use a cache that implements `fragmetMatches`."
290
290
  },
291
291
 
292
- 57: {
292
+ 59: {
293
293
  file: "@apollo/client/link/persisted-queries/index.js",
294
294
  condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")",
295
295
 
@@ -298,13 +298,13 @@ you have an infinite render loop in your application.`
298
298
  "parameter."
299
299
  },
300
300
 
301
- 58: {
301
+ 60: {
302
302
  file: "@apollo/client/link/persisted-queries/index.js",
303
303
  condition: "forward",
304
304
  message: "PersistedQueryLink cannot be the last link in the chain."
305
305
  },
306
306
 
307
- 59: {
307
+ 61: {
308
308
  file: "@apollo/client/link/http/checkFetcher.js",
309
309
  condition: "fetcher || typeof fetch !== \"undefined\"",
310
310
 
@@ -322,30 +322,30 @@ const client = new ApolloClient({
322
322
  `
323
323
  },
324
324
 
325
- 60: {
325
+ 62: {
326
326
  file: "@apollo/client/link/http/parseAndCheckHttpResponse.js",
327
327
  condition: "response.body && typeof response.body.getReader === \"function\"",
328
328
  message: "Unknown type for `response.body`. Please use a `fetch` implementation that is WhatWG-compliant and that uses WhatWG ReadableStreams for `body`."
329
329
  },
330
330
 
331
- 63: {
331
+ 65: {
332
332
  file: "@apollo/client/link/core/ApolloLink.js",
333
333
  message: "request is not implemented"
334
334
  },
335
335
 
336
- 64: {
336
+ 66: {
337
337
  file: "@apollo/client/incremental/handlers/graphql17Alpha9.js",
338
338
  condition: "pending",
339
339
  message: "Could not find pending chunk for incremental value. Please file an issue for the Apollo Client team to investigate."
340
340
  },
341
341
 
342
- 65: {
342
+ 67: {
343
343
  file: "@apollo/client/incremental/handlers/notImplemented.js",
344
- condition: "!hasDirectives([\"defer\"], request.query)",
345
- message: "`@defer` is not supported without specifying an incremental handler. Please pass a handler as the `incrementalHandler` option to the `ApolloClient` constructor."
344
+ condition: "!hasDirectives([\"defer\", \"stream\"], request.query)",
345
+ message: "`@defer` and `@stream` are not supported without specifying an incremental handler. Please pass a handler as the `incrementalHandler` option to the `ApolloClient` constructor."
346
346
  },
347
347
 
348
- 66: {
348
+ 68: {
349
349
  file: "@apollo/client/core/ApolloClient.js",
350
350
  condition: "options.cache",
351
351
 
@@ -354,7 +354,7 @@ const client = new ApolloClient({
354
354
  "For more information, please visit: https://go.apollo.dev/c/docs"
355
355
  },
356
356
 
357
- 67: {
357
+ 69: {
358
358
  file: "@apollo/client/core/ApolloClient.js",
359
359
  condition: "options.link",
360
360
 
@@ -363,7 +363,7 @@ const client = new ApolloClient({
363
363
  "For more information, please visit: https://go.apollo.dev/c/docs"
364
364
  },
365
365
 
366
- 68: {
366
+ 70: {
367
367
  file: "@apollo/client/core/ApolloClient.js",
368
368
  condition: "options.fetchPolicy !== \"cache-and-network\"",
369
369
 
@@ -373,7 +373,7 @@ const client = new ApolloClient({
373
373
  "using a different fetchPolicy, such as cache-first or network-only."
374
374
  },
375
375
 
376
- 69: {
376
+ 71: {
377
377
  file: "@apollo/client/core/ApolloClient.js",
378
378
  condition: "options.fetchPolicy !== \"standby\"",
379
379
 
@@ -382,7 +382,7 @@ const client = new ApolloClient({
382
382
  "as cache-first or network-only."
383
383
  },
384
384
 
385
- 70: {
385
+ 72: {
386
386
  file: "@apollo/client/core/ApolloClient.js",
387
387
  condition: "options.query",
388
388
 
@@ -390,158 +390,158 @@ const client = new ApolloClient({
390
390
  "in the query option."
391
391
  },
392
392
 
393
- 71: {
393
+ 73: {
394
394
  file: "@apollo/client/core/ApolloClient.js",
395
395
  condition: "options.query.kind === \"Document\"",
396
396
  message: 'You must wrap the query string in a "gql" tag.'
397
397
  },
398
398
 
399
- 72: {
399
+ 74: {
400
400
  file: "@apollo/client/core/ApolloClient.js",
401
401
  condition: "!options.returnPartialData",
402
402
  message: "returnPartialData option only supported on watchQuery."
403
403
  },
404
404
 
405
- 73: {
405
+ 75: {
406
406
  file: "@apollo/client/core/ApolloClient.js",
407
407
  condition: "!options.pollInterval",
408
408
  message: "pollInterval option only supported on watchQuery."
409
409
  },
410
410
 
411
- 74: {
411
+ 76: {
412
412
  file: "@apollo/client/core/ApolloClient.js",
413
413
  condition: "!options.notifyOnNetworkStatusChange",
414
414
  message: "notifyOnNetworkStatusChange option only supported on watchQuery."
415
415
  },
416
416
 
417
- 75: {
417
+ 77: {
418
418
  file: "@apollo/client/core/ApolloClient.js",
419
419
  condition: "optionsWithDefaults.mutation",
420
420
  message: "The `mutation` option is required. Please provide a GraphQL document in the `mutation` option."
421
421
  },
422
422
 
423
- 76: {
423
+ 78: {
424
424
  file: "@apollo/client/core/ApolloClient.js",
425
425
  condition: "optionsWithDefaults.fetchPolicy === \"network-only\" ||\n optionsWithDefaults.fetchPolicy === \"no-cache\"",
426
426
  message: "Mutations only support 'network-only' or 'no-cache' fetch policies. The default 'network-only' behavior automatically writes mutation results to the cache. Passing 'no-cache' skips the cache write."
427
427
  },
428
428
 
429
- 79: {
429
+ 81: {
430
430
  file: "@apollo/client/core/ObservableQuery.js",
431
431
  condition: "this.options.fetchPolicy !== \"cache-only\"",
432
432
  message: "Cannot execute `fetchMore` for 'cache-only' query '%s'. Please use a different fetch policy."
433
433
  },
434
434
 
435
- 80: {
435
+ 82: {
436
436
  file: "@apollo/client/core/ObservableQuery.js",
437
437
  condition: "updateQuery",
438
438
  message: "You must provide an `updateQuery` function when using `fetchMore` with a `no-cache` fetch policy."
439
439
  },
440
440
 
441
- 84: {
441
+ 86: {
442
442
  file: "@apollo/client/core/QueryManager.js",
443
443
  message: "QueryManager stopped while query was in flight"
444
444
  },
445
445
 
446
- 85: {
446
+ 87: {
447
447
  file: "@apollo/client/core/QueryManager.js",
448
448
  condition: "this.localState",
449
449
  message: "Mutation '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
450
450
  },
451
451
 
452
- 86: {
452
+ 88: {
453
453
  file: "@apollo/client/core/QueryManager.js",
454
454
  message: "Store reset while query was in flight (not completed in link chain)"
455
455
  },
456
456
 
457
- 89: {
457
+ 91: {
458
458
  file: "@apollo/client/core/QueryManager.js",
459
459
  condition: "!this.getDocumentInfo(query).hasClientExports || this.localState",
460
460
  message: "Subscription '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
461
461
  },
462
462
 
463
- 90: {
463
+ 92: {
464
464
  file: "@apollo/client/core/QueryManager.js",
465
465
  condition: "this.localState",
466
466
  message: "%s '%s' contains `@client` fields but local state has not been configured."
467
467
  },
468
468
 
469
- 91: {
469
+ 93: {
470
470
  file: "@apollo/client/core/QueryManager.js",
471
471
  condition: "!hasIncrementalDirective",
472
472
  message: "%s '%s' contains `@client` and `@defer` directives. These cannot be used together."
473
473
  },
474
474
 
475
- 92: {
475
+ 94: {
476
476
  file: "@apollo/client/core/QueryManager.js",
477
477
  condition: "this.localState",
478
478
  message: "Query '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
479
479
  },
480
480
 
481
- 94: {
481
+ 96: {
482
482
  file: "@apollo/client/core/QueryManager.js",
483
483
  condition: "this.localState",
484
484
  message: "Query '%s' contains `@client` fields but local state has not been configured."
485
485
  },
486
486
 
487
- 95: {
487
+ 97: {
488
488
  file: "@apollo/client/core/QueryManager.js",
489
489
  condition: "didEmitValue",
490
490
  message: "The link chain completed without emitting a value. This is likely unintentional and should be updated to emit a value before completing."
491
491
  },
492
492
 
493
- 96: {
493
+ 98: {
494
494
  file: "@apollo/client/cache/inmemory/entityStore.js",
495
495
  condition: "typeof dataId === \"string\"",
496
496
  message: "store.merge expects a string ID"
497
497
  },
498
498
 
499
- 99: {
499
+ 101: {
500
500
  file: "@apollo/client/cache/inmemory/key-extractor.js",
501
501
  condition: "extracted !== void 0",
502
502
  message: `Missing field '%s' while extracting keyFields from %s`
503
503
  },
504
504
 
505
- 100: {
505
+ 102: {
506
506
  file: "@apollo/client/cache/inmemory/policies.js",
507
507
  condition: "!old || old === which",
508
508
  message: `Cannot change root %s __typename more than once`
509
509
  },
510
510
 
511
- 103: {
511
+ 105: {
512
512
  file: "@apollo/client/cache/inmemory/policies.js",
513
513
  message: "Cannot automatically merge arrays"
514
514
  },
515
515
 
516
- 104: {
516
+ 106: {
517
517
  file: "@apollo/client/cache/inmemory/readFromStore.js",
518
518
  message: `No fragment named %s`
519
519
  },
520
520
 
521
- 105: {
521
+ 107: {
522
522
  file: "@apollo/client/cache/inmemory/readFromStore.js",
523
523
  condition: "!isReference(value)",
524
524
  message: `Missing selection set for object of type %s returned for query field %s`
525
525
  },
526
526
 
527
- 106: {
527
+ 108: {
528
528
  file: "@apollo/client/cache/inmemory/writeToStore.js",
529
529
  message: `Could not identify object %s`
530
530
  },
531
531
 
532
- 108: {
532
+ 110: {
533
533
  file: "@apollo/client/cache/inmemory/writeToStore.js",
534
534
  message: `No fragment named %s`
535
535
  }
536
536
  };
537
537
 
538
538
  export const devDebug = {
539
- 77: {
539
+ 79: {
540
540
  file: "@apollo/client/core/ApolloClient.js",
541
541
  message: `In client.refetchQueries, Promise.all promise rejected with error %o`
542
542
  },
543
543
 
544
- 83: {
544
+ 85: {
545
545
  file: "@apollo/client/core/ObservableQuery.js",
546
546
  message: `Missing cache result fields: %o`
547
547
  }
@@ -577,30 +577,40 @@ export const devWarn = {
577
577
 
578
578
  50: {
579
579
  file: "@apollo/client/local-state/LocalState.js",
580
- message: "The '%s' resolver returned `undefined` instead of a value. This is likely a bug in the resolver. If you didn't mean to return a value, return `null` instead."
580
+ message: "The '%s' field resolves the value from the cache, for example from a 'read' function, but a 'no-cache' fetch policy was used. The field value has been set to `null`. Either define a local resolver or use a fetch policy that uses the cache to ensure the field is resolved correctly."
581
581
  },
582
582
 
583
583
  51: {
584
584
  file: "@apollo/client/local-state/LocalState.js",
585
- message: "The '%s' field had no cached value and only forced resolvers were run. The value was set to `null`."
585
+ message: "Could not find a resolver for the '%s' field nor does the cache resolve the field. The field value has been set to `null`. Either define a resolver for the field or ensure the cache can resolve the value, for example, by adding a 'read' function to a field policy in 'InMemoryCache'."
586
586
  },
587
587
 
588
588
  52: {
589
+ file: "@apollo/client/local-state/LocalState.js",
590
+ message: "The '%s' resolver returned `undefined` instead of a value. This is likely a bug in the resolver. If you didn't mean to return a value, return `null` instead."
591
+ },
592
+
593
+ 53: {
594
+ file: "@apollo/client/local-state/LocalState.js",
595
+ message: "The '%s' field had no cached value and only forced resolvers were run. The value was set to `null`."
596
+ },
597
+
598
+ 54: {
589
599
  file: "@apollo/client/local-state/LocalState.js",
590
600
  message: "The '%s' field on object %o returned `undefined` instead of a value. The parent resolver did not include the property in the returned value and there was no resolver defined for the field."
591
601
  },
592
602
 
593
- 56: {
603
+ 58: {
594
604
  file: "@apollo/client/link/ws/index.js",
595
605
  message: "`WebSocketLink` uses the deprecated and unmaintained `subscriptions-transport-ws` library. This link is no longer maintained and will be removed in a future major version of Apollo Client. We recommend switching to `GraphQLWsLink` which uses the `graphql-ws` library to send GraphQL operations through WebSocket connections (https://the-guild.dev/graphql/ws)."
596
606
  },
597
607
 
598
- 61: {
608
+ 63: {
599
609
  file: "@apollo/client/link/core/ApolloLink.js",
600
610
  message: "[ApolloLink.split]: The test function returned a non-boolean value which could result in subtle bugs (e.g. such as using an `async` function which always returns a truthy value). Got `%o`."
601
611
  },
602
612
 
603
- 62: {
613
+ 64: {
604
614
  file: "@apollo/client/link/core/ApolloLink.js",
605
615
 
606
616
  message: "The terminating link provided to `ApolloLink.execute` called `forward` instead of handling the request. " +
@@ -609,34 +619,34 @@ export const devWarn = {
609
619
  "If you are using a split link, ensure each branch contains a terminating link that handles the request."
610
620
  },
611
621
 
612
- 78: {
622
+ 80: {
613
623
  file: "@apollo/client/core/ObservableQuery.js",
614
624
 
615
625
  message: `Called refetch(%o) for query %o, which does not declare a $variables variable.
616
626
  Did you mean to call refetch(variables) instead of refetch({ variables })?`
617
627
  },
618
628
 
619
- 82: {
629
+ 84: {
620
630
  file: "@apollo/client/core/ObservableQuery.js",
621
631
  message: "Cannot poll on 'cache-only' query '%s' and as such, polling is disabled. Please use a different fetch policy."
622
632
  },
623
633
 
624
- 87: {
634
+ 89: {
625
635
  file: "@apollo/client/core/QueryManager.js",
626
636
  message: `Unknown query named "%s" requested in refetchQueries options.include array`
627
637
  },
628
638
 
629
- 88: {
639
+ 90: {
630
640
  file: "@apollo/client/core/QueryManager.js",
631
641
  message: `Unknown anonymous query requested in refetchQueries options.include array`
632
642
  },
633
643
 
634
- 93: {
644
+ 95: {
635
645
  file: "@apollo/client/core/QueryManager.js",
636
646
  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.'
637
647
  },
638
648
 
639
- 97: {
649
+ 99: {
640
650
  file: "@apollo/client/cache/inmemory/entityStore.js",
641
651
 
642
652
  message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" +
@@ -644,24 +654,24 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`
644
654
  "`toReference(object, true)`"
645
655
  },
646
656
 
647
- 98: {
657
+ 100: {
648
658
  file: "@apollo/client/cache/inmemory/entityStore.js",
649
659
 
650
660
  message: "cache.modify: Writing an array with a mix of both References and Objects will not result in the Objects being normalized correctly.\n" +
651
661
  "Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`."
652
662
  },
653
663
 
654
- 101: {
664
+ 103: {
655
665
  file: "@apollo/client/cache/inmemory/policies.js",
656
666
  message: `Inferring subtype %s of supertype %s`
657
667
  },
658
668
 
659
- 102: {
669
+ 104: {
660
670
  file: "@apollo/client/cache/inmemory/policies.js",
661
671
  message: `Undefined 'from' passed to readField with arguments %s`
662
672
  },
663
673
 
664
- 109: {
674
+ 111: {
665
675
  file: "@apollo/client/cache/inmemory/writeToStore.js",
666
676
 
667
677
  message: `Cache data may be lost when replacing the %s field of a %s object.
@@ -680,7 +690,7 @@ For more information about these options, please refer to the documentation:
680
690
  `
681
691
  },
682
692
 
683
- 110: {
693
+ 112: {
684
694
  file: "@apollo/client/cache/core/cache.js",
685
695
  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."
686
696
  }
@@ -697,12 +707,12 @@ export const devError = {
697
707
  message: "The result of getSnapshot should be cached to avoid an infinite loop"
698
708
  },
699
709
 
700
- 81: {
710
+ 83: {
701
711
  file: "@apollo/client/core/ObservableQuery.js",
702
712
  message: "Unhandled GraphQL subscription error"
703
713
  },
704
714
 
705
- 107: {
715
+ 109: {
706
716
  file: "@apollo/client/cache/inmemory/writeToStore.js",
707
717
  message: `Missing field '%s' while writing result %o`
708
718
  }
@@ -100,7 +100,7 @@ export class ApolloLink {
100
100
  const result = test(operation);
101
101
  if (__DEV__) {
102
102
  if (typeof result !== "boolean") {
103
- __DEV__ && invariant.warn(61, result);
103
+ __DEV__ && invariant.warn(63, result);
104
104
  }
105
105
  }
106
106
  return result ?
@@ -142,7 +142,7 @@ export class ApolloLink {
142
142
  static execute(link, request, context) {
143
143
  return link.request(createOperation(request, context), () => {
144
144
  if (__DEV__) {
145
- __DEV__ && invariant.warn(62);
145
+ __DEV__ && invariant.warn(64);
146
146
  }
147
147
  return EMPTY;
148
148
  });
@@ -246,7 +246,7 @@ export class ApolloLink {
246
246
  * > request instead.
247
247
  */
248
248
  request(operation, forward) {
249
- throw newInvariantError(63);
249
+ throw newInvariantError(65);
250
250
  }
251
251
  /**
252
252
  * @internal
@@ -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", 59);
3
+ invariant(fetcher || typeof fetch !== "undefined", 61);
4
4
  };
5
5
  //# sourceMappingURL=checkFetcher.js.map
@@ -33,7 +33,7 @@ async function* consumeMultipartBody(response) {
33
33
  /;\s*boundary=(?:'([^']+)'|"([^"]+)"|([^"'].+?))\s*(?:;|$)/i);
34
34
  const boundary = "\r\n--" + (match?.findLast((val) => !!val) || "-");
35
35
  let buffer = "";
36
- invariant(response.body && typeof response.body.getReader === "function", 60);
36
+ invariant(response.body && typeof response.body.getReader === "function", 62);
37
37
  const stream = response.body;
38
38
  const reader = stream.getReader();
39
39
  let done = false;
@@ -66,7 +66,7 @@ export class PersistedQueryLink extends ApolloLink {
66
66
  // hashing with something other than SHA-256.
67
67
  invariant(options &&
68
68
  (typeof options.sha256 === "function" ||
69
- typeof options.generateHash === "function"), 57);
69
+ typeof options.generateHash === "function"), 59);
70
70
  const { sha256,
71
71
  // If both a `sha256` and `generateHash` option are provided, the
72
72
  // `sha256` option will be ignored. Developers can configure and
@@ -92,7 +92,7 @@ export class PersistedQueryLink extends ApolloLink {
92
92
  return hash;
93
93
  }
94
94
  super((operation, forward) => {
95
- invariant(forward, 58);
95
+ invariant(forward, 60);
96
96
  const { query } = operation;
97
97
  return new Observable((observer) => {
98
98
  let subscription;
package/link/ws/index.js CHANGED
@@ -32,7 +32,7 @@ export class WebSocketLink extends ApolloLink {
32
32
  constructor(paramsOrClient) {
33
33
  super();
34
34
  if (__DEV__) {
35
- __DEV__ && invariant.warn(56);
35
+ __DEV__ && invariant.warn(58);
36
36
  }
37
37
  if (paramsOrClient instanceof SubscriptionClient) {
38
38
  this.subscriptionClient = paramsOrClient;
@@ -1,5 +1,5 @@
1
1
  import type { DocumentNode, FieldNode, FormattedExecutionResult } from "graphql";
2
- import type { ApolloClient, DefaultContext, OperationVariables, TypedDocumentNode } from "@apollo/client";
2
+ import type { ApolloClient, DefaultContext, OperationVariables, TypedDocumentNode, WatchQueryFetchPolicy } from "@apollo/client";
3
3
  import type { FragmentMap, NoInfer, RemoveIndexSignature } from "@apollo/client/utilities/internal";
4
4
  type InferContextValueFromResolvers<TResolvers> = TResolvers extends {
5
5
  [typename: string]: infer TFieldResolvers;
@@ -155,7 +155,7 @@ export declare class LocalState<TResolvers extends LocalState.Resolvers = LocalS
155
155
  * ```
156
156
  */
157
157
  addResolvers(resolvers: TResolvers): void;
158
- execute<TData = unknown, TVariables extends OperationVariables = OperationVariables>({ document, client, context, remoteResult, variables, onlyRunForcedResolvers, returnPartialData, }: {
158
+ execute<TData = unknown, TVariables extends OperationVariables = OperationVariables>({ document, client, context, remoteResult, variables, onlyRunForcedResolvers, returnPartialData, fetchPolicy, }: {
159
159
  document: DocumentNode | TypedDocumentNode<TData, TVariables>;
160
160
  client: ApolloClient;
161
161
  context: DefaultContext | undefined;
@@ -163,6 +163,7 @@ export declare class LocalState<TResolvers extends LocalState.Resolvers = LocalS
163
163
  variables: TVariables | undefined;
164
164
  onlyRunForcedResolvers?: boolean;
165
165
  returnPartialData?: boolean;
166
+ fetchPolicy: WatchQueryFetchPolicy;
166
167
  }): Promise<FormattedExecutionResult<TData>>;
167
168
  getExportedVariables<TVariables extends OperationVariables = OperationVariables>({ document, client, context, variables, }: {
168
169
  document: DocumentNode | TypedDocumentNode<any, TVariables>;