@apollo/client 4.0.6 → 4.1.0-alpha.1
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/CHANGELOG.md +43 -4
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +19 -0
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs +3 -0
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +1 -0
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/key-extractor.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.cjs +4 -4
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
- package/__cjs/cache/inmemory/writeToStore.cjs +5 -5
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/core/ApolloClient.cjs +14 -13
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +12 -0
- package/__cjs/core/ObservableQuery.cjs +157 -110
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +1 -0
- package/__cjs/core/QueryManager.cjs +19 -17
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/incremental/handlers/defer20220824.cjs +20 -9
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
- package/__cjs/incremental/handlers/defer20220824.d.cts +14 -5
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs +181 -0
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs.map +1 -0
- package/__cjs/incremental/handlers/graphql17Alpha9.d.cts +97 -0
- package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
- package/__cjs/incremental/index.cjs +3 -1
- package/__cjs/incremental/index.cjs.map +1 -1
- package/__cjs/incremental/index.d.cts +1 -0
- package/__cjs/invariantErrorCodes.cjs +75 -59
- package/__cjs/link/core/ApolloLink.cjs +3 -3
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
- package/__cjs/link/persisted-queries/index.cjs +2 -2
- package/__cjs/link/ws/index.cjs +1 -1
- package/__cjs/local-state/LocalState.cjs +28 -14
- package/__cjs/local-state/LocalState.cjs.map +1 -1
- package/__cjs/local-state/LocalState.d.cts +3 -2
- package/__cjs/react/hooks/useReactiveVar.cjs +1 -2
- package/__cjs/react/hooks/useReactiveVar.cjs.map +1 -1
- package/__cjs/react/hooks/useReactiveVar.d.cts +1 -2
- package/__cjs/react/internal/cache/QueryReference.cjs +16 -0
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +1 -0
- package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockLink.d.cts +1 -3
- package/__cjs/utilities/internal/DeepMerger.cjs +10 -1
- package/__cjs/utilities/internal/DeepMerger.cjs.map +1 -1
- package/__cjs/utilities/internal/DeepMerger.d.cts +14 -2
- package/__cjs/utilities/internal/getStoreKeyName.cjs +1 -0
- package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
- package/__cjs/version.cjs +1 -1
- package/__cjs/version.cjs.map +1 -1
- package/cache/core/cache.d.ts +19 -0
- package/cache/core/cache.js +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +1 -0
- package/cache/inmemory/inMemoryCache.js +3 -0
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/writeToStore.js +5 -5
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +12 -0
- package/core/ApolloClient.js +14 -13
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +1 -0
- package/core/ObservableQuery.js +159 -112
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.js +19 -17
- package/core/QueryManager.js.map +1 -1
- package/incremental/handlers/defer20220824.d.ts +14 -5
- package/incremental/handlers/defer20220824.js +20 -9
- package/incremental/handlers/defer20220824.js.map +1 -1
- package/incremental/handlers/graphql17Alpha9.d.ts +97 -0
- package/incremental/handlers/graphql17Alpha9.js +177 -0
- package/incremental/handlers/graphql17Alpha9.js.map +1 -0
- package/incremental/handlers/notImplemented.js +1 -1
- package/incremental/index.d.ts +1 -0
- package/incremental/index.js +3 -2
- package/incremental/index.js.map +1 -1
- package/invariantErrorCodes.js +75 -59
- package/link/core/ApolloLink.js +3 -3
- package/link/http/checkFetcher.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/ws/index.js +1 -1
- package/local-state/LocalState.d.ts +3 -2
- package/local-state/LocalState.js +28 -14
- package/local-state/LocalState.js.map +1 -1
- package/package.json +1 -1
- package/react/hooks/useReactiveVar.d.ts +1 -2
- package/react/hooks/useReactiveVar.js +1 -2
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks-compiled/useReactiveVar.d.ts +1 -2
- package/react/hooks-compiled/useReactiveVar.js +1 -2
- package/react/hooks-compiled/useReactiveVar.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +1 -0
- package/react/internal/cache/QueryReference.js +16 -0
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +1 -3
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/utilities/internal/DeepMerger.d.ts +14 -2
- package/utilities/internal/DeepMerger.js +10 -1
- package/utilities/internal/DeepMerger.js.map +1 -1
- package/utilities/internal/getStoreKeyName.js +1 -0
- package/utilities/internal/getStoreKeyName.js.map +1 -1
- package/utilities/internal/globals/global.js +2 -2
- package/utilities/internal/globals/global.js.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
|
@@ -278,24 +278,24 @@ you have an infinite render loop in your application.`
|
|
|
278
278
|
message: "No fragment named %s"
|
|
279
279
|
},
|
|
280
280
|
|
|
281
|
-
|
|
281
|
+
55: {
|
|
282
282
|
file: "@apollo/client/__cjs/local-state/LocalState.cjs",
|
|
283
283
|
message: "Could not resolve __typename on object %o returned from resolver '%s'. '__typename' needs to be returned to properly resolve child fields."
|
|
284
284
|
},
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
56: {
|
|
287
287
|
file: "@apollo/client/__cjs/local-state/LocalState.cjs",
|
|
288
288
|
condition: "fragment",
|
|
289
289
|
message: `No fragment named %s`
|
|
290
290
|
},
|
|
291
291
|
|
|
292
|
-
|
|
292
|
+
57: {
|
|
293
293
|
file: "@apollo/client/__cjs/local-state/LocalState.cjs",
|
|
294
294
|
condition: "cache.fragmentMatches",
|
|
295
295
|
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`."
|
|
296
296
|
},
|
|
297
297
|
|
|
298
|
-
|
|
298
|
+
59: {
|
|
299
299
|
file: "@apollo/client/__cjs/link/persisted-queries/index.cjs",
|
|
300
300
|
condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")",
|
|
301
301
|
|
|
@@ -304,13 +304,13 @@ you have an infinite render loop in your application.`
|
|
|
304
304
|
"parameter."
|
|
305
305
|
},
|
|
306
306
|
|
|
307
|
-
|
|
307
|
+
60: {
|
|
308
308
|
file: "@apollo/client/__cjs/link/persisted-queries/index.cjs",
|
|
309
309
|
condition: "forward",
|
|
310
310
|
message: "PersistedQueryLink cannot be the last link in the chain."
|
|
311
311
|
},
|
|
312
312
|
|
|
313
|
-
|
|
313
|
+
61: {
|
|
314
314
|
file: "@apollo/client/__cjs/link/http/checkFetcher.cjs",
|
|
315
315
|
condition: "fetcher || typeof fetch !== \"undefined\"",
|
|
316
316
|
|
|
@@ -328,24 +328,30 @@ const client = new ApolloClient({
|
|
|
328
328
|
`
|
|
329
329
|
},
|
|
330
330
|
|
|
331
|
-
|
|
331
|
+
62: {
|
|
332
332
|
file: "@apollo/client/__cjs/link/http/parseAndCheckHttpResponse.cjs",
|
|
333
333
|
condition: "response.body && typeof response.body.getReader === \"function\"",
|
|
334
334
|
message: "Unknown type for `response.body`. Please use a `fetch` implementation that is WhatWG-compliant and that uses WhatWG ReadableStreams for `body`."
|
|
335
335
|
},
|
|
336
336
|
|
|
337
|
-
|
|
337
|
+
65: {
|
|
338
338
|
file: "@apollo/client/__cjs/link/core/ApolloLink.cjs",
|
|
339
339
|
message: "request is not implemented"
|
|
340
340
|
},
|
|
341
341
|
|
|
342
|
-
|
|
342
|
+
66: {
|
|
343
|
+
file: "@apollo/client/__cjs/incremental/handlers/graphql17Alpha9.cjs",
|
|
344
|
+
condition: "pending",
|
|
345
|
+
message: "Could not find pending chunk for incremental value. Please file an issue for the Apollo Client team to investigate."
|
|
346
|
+
},
|
|
347
|
+
|
|
348
|
+
67: {
|
|
343
349
|
file: "@apollo/client/__cjs/incremental/handlers/notImplemented.cjs",
|
|
344
350
|
condition: "!(0, internal_1.hasDirectives)([\"defer\"], request.query)",
|
|
345
351
|
message: "`@defer` is not supported without specifying an incremental handler. Please pass a handler as the `incrementalHandler` option to the `ApolloClient` constructor."
|
|
346
352
|
},
|
|
347
353
|
|
|
348
|
-
|
|
354
|
+
68: {
|
|
349
355
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
350
356
|
condition: "options.cache",
|
|
351
357
|
|
|
@@ -354,7 +360,7 @@ const client = new ApolloClient({
|
|
|
354
360
|
"For more information, please visit: https://go.apollo.dev/c/docs"
|
|
355
361
|
},
|
|
356
362
|
|
|
357
|
-
|
|
363
|
+
69: {
|
|
358
364
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
359
365
|
condition: "options.link",
|
|
360
366
|
|
|
@@ -363,7 +369,7 @@ const client = new ApolloClient({
|
|
|
363
369
|
"For more information, please visit: https://go.apollo.dev/c/docs"
|
|
364
370
|
},
|
|
365
371
|
|
|
366
|
-
|
|
372
|
+
70: {
|
|
367
373
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
368
374
|
condition: "options.fetchPolicy !== \"cache-and-network\"",
|
|
369
375
|
|
|
@@ -373,7 +379,7 @@ const client = new ApolloClient({
|
|
|
373
379
|
"using a different fetchPolicy, such as cache-first or network-only."
|
|
374
380
|
},
|
|
375
381
|
|
|
376
|
-
|
|
382
|
+
71: {
|
|
377
383
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
378
384
|
condition: "options.fetchPolicy !== \"standby\"",
|
|
379
385
|
|
|
@@ -382,7 +388,7 @@ const client = new ApolloClient({
|
|
|
382
388
|
"as cache-first or network-only."
|
|
383
389
|
},
|
|
384
390
|
|
|
385
|
-
|
|
391
|
+
72: {
|
|
386
392
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
387
393
|
condition: "options.query",
|
|
388
394
|
|
|
@@ -390,158 +396,158 @@ const client = new ApolloClient({
|
|
|
390
396
|
"in the query option."
|
|
391
397
|
},
|
|
392
398
|
|
|
393
|
-
|
|
399
|
+
73: {
|
|
394
400
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
395
401
|
condition: "options.query.kind === \"Document\"",
|
|
396
402
|
message: 'You must wrap the query string in a "gql" tag.'
|
|
397
403
|
},
|
|
398
404
|
|
|
399
|
-
|
|
405
|
+
74: {
|
|
400
406
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
401
407
|
condition: "!options.returnPartialData",
|
|
402
408
|
message: "returnPartialData option only supported on watchQuery."
|
|
403
409
|
},
|
|
404
410
|
|
|
405
|
-
|
|
411
|
+
75: {
|
|
406
412
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
407
413
|
condition: "!options.pollInterval",
|
|
408
414
|
message: "pollInterval option only supported on watchQuery."
|
|
409
415
|
},
|
|
410
416
|
|
|
411
|
-
|
|
417
|
+
76: {
|
|
412
418
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
413
419
|
condition: "!options.notifyOnNetworkStatusChange",
|
|
414
420
|
message: "notifyOnNetworkStatusChange option only supported on watchQuery."
|
|
415
421
|
},
|
|
416
422
|
|
|
417
|
-
|
|
423
|
+
77: {
|
|
418
424
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
419
425
|
condition: "optionsWithDefaults.mutation",
|
|
420
426
|
message: "The `mutation` option is required. Please provide a GraphQL document in the `mutation` option."
|
|
421
427
|
},
|
|
422
428
|
|
|
423
|
-
|
|
429
|
+
78: {
|
|
424
430
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
425
431
|
condition: "optionsWithDefaults.fetchPolicy === \"network-only\" ||\n optionsWithDefaults.fetchPolicy === \"no-cache\"",
|
|
426
432
|
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
433
|
},
|
|
428
434
|
|
|
429
|
-
|
|
435
|
+
81: {
|
|
430
436
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
431
437
|
condition: "this.options.fetchPolicy !== \"cache-only\"",
|
|
432
438
|
message: "Cannot execute `fetchMore` for 'cache-only' query '%s'. Please use a different fetch policy."
|
|
433
439
|
},
|
|
434
440
|
|
|
435
|
-
|
|
441
|
+
82: {
|
|
436
442
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
437
443
|
condition: "updateQuery",
|
|
438
444
|
message: "You must provide an `updateQuery` function when using `fetchMore` with a `no-cache` fetch policy."
|
|
439
445
|
},
|
|
440
446
|
|
|
441
|
-
|
|
447
|
+
86: {
|
|
442
448
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
443
449
|
message: "QueryManager stopped while query was in flight"
|
|
444
450
|
},
|
|
445
451
|
|
|
446
|
-
|
|
452
|
+
87: {
|
|
447
453
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
448
454
|
condition: "this.localState",
|
|
449
455
|
message: "Mutation '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
|
|
450
456
|
},
|
|
451
457
|
|
|
452
|
-
|
|
458
|
+
88: {
|
|
453
459
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
454
460
|
message: "Store reset while query was in flight (not completed in link chain)"
|
|
455
461
|
},
|
|
456
462
|
|
|
457
|
-
|
|
463
|
+
91: {
|
|
458
464
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
459
465
|
condition: "!this.getDocumentInfo(query).hasClientExports || this.localState",
|
|
460
466
|
message: "Subscription '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
|
|
461
467
|
},
|
|
462
468
|
|
|
463
|
-
|
|
469
|
+
92: {
|
|
464
470
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
465
471
|
condition: "this.localState",
|
|
466
472
|
message: "%s '%s' contains `@client` fields but local state has not been configured."
|
|
467
473
|
},
|
|
468
474
|
|
|
469
|
-
|
|
475
|
+
93: {
|
|
470
476
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
471
477
|
condition: "!hasIncrementalDirective",
|
|
472
478
|
message: "%s '%s' contains `@client` and `@defer` directives. These cannot be used together."
|
|
473
479
|
},
|
|
474
480
|
|
|
475
|
-
|
|
481
|
+
94: {
|
|
476
482
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
477
483
|
condition: "this.localState",
|
|
478
484
|
message: "Query '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
|
|
479
485
|
},
|
|
480
486
|
|
|
481
|
-
|
|
487
|
+
96: {
|
|
482
488
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
483
489
|
condition: "this.localState",
|
|
484
490
|
message: "Query '%s' contains `@client` fields but local state has not been configured."
|
|
485
491
|
},
|
|
486
492
|
|
|
487
|
-
|
|
493
|
+
97: {
|
|
488
494
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
489
495
|
condition: "didEmitValue",
|
|
490
496
|
message: "The link chain completed without emitting a value. This is likely unintentional and should be updated to emit a value before completing."
|
|
491
497
|
},
|
|
492
498
|
|
|
493
|
-
|
|
499
|
+
98: {
|
|
494
500
|
file: "@apollo/client/__cjs/cache/inmemory/entityStore.cjs",
|
|
495
501
|
condition: "typeof dataId === \"string\"",
|
|
496
502
|
message: "store.merge expects a string ID"
|
|
497
503
|
},
|
|
498
504
|
|
|
499
|
-
|
|
505
|
+
101: {
|
|
500
506
|
file: "@apollo/client/__cjs/cache/inmemory/key-extractor.cjs",
|
|
501
507
|
condition: "extracted !== void 0",
|
|
502
508
|
message: `Missing field '%s' while extracting keyFields from %s`
|
|
503
509
|
},
|
|
504
510
|
|
|
505
|
-
|
|
511
|
+
102: {
|
|
506
512
|
file: "@apollo/client/__cjs/cache/inmemory/policies.cjs",
|
|
507
513
|
condition: "!old || old === which",
|
|
508
514
|
message: `Cannot change root %s __typename more than once`
|
|
509
515
|
},
|
|
510
516
|
|
|
511
|
-
|
|
517
|
+
105: {
|
|
512
518
|
file: "@apollo/client/__cjs/cache/inmemory/policies.cjs",
|
|
513
519
|
message: "Cannot automatically merge arrays"
|
|
514
520
|
},
|
|
515
521
|
|
|
516
|
-
|
|
522
|
+
106: {
|
|
517
523
|
file: "@apollo/client/__cjs/cache/inmemory/readFromStore.cjs",
|
|
518
524
|
message: `No fragment named %s`
|
|
519
525
|
},
|
|
520
526
|
|
|
521
|
-
|
|
527
|
+
107: {
|
|
522
528
|
file: "@apollo/client/__cjs/cache/inmemory/readFromStore.cjs",
|
|
523
529
|
condition: "!(0, utilities_1.isReference)(value)",
|
|
524
530
|
message: `Missing selection set for object of type %s returned for query field %s`
|
|
525
531
|
},
|
|
526
532
|
|
|
527
|
-
|
|
533
|
+
108: {
|
|
528
534
|
file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs",
|
|
529
535
|
message: `Could not identify object %s`
|
|
530
536
|
},
|
|
531
537
|
|
|
532
|
-
|
|
538
|
+
110: {
|
|
533
539
|
file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs",
|
|
534
540
|
message: `No fragment named %s`
|
|
535
541
|
}
|
|
536
542
|
};
|
|
537
543
|
|
|
538
544
|
exports.devDebug = {
|
|
539
|
-
|
|
545
|
+
79: {
|
|
540
546
|
file: "@apollo/client/__cjs/core/ApolloClient.cjs",
|
|
541
547
|
message: `In client.refetchQueries, Promise.all promise rejected with error %o`
|
|
542
548
|
},
|
|
543
549
|
|
|
544
|
-
|
|
550
|
+
85: {
|
|
545
551
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
546
552
|
message: `Missing cache result fields: %o`
|
|
547
553
|
}
|
|
@@ -577,30 +583,40 @@ exports.devWarn = {
|
|
|
577
583
|
|
|
578
584
|
50: {
|
|
579
585
|
file: "@apollo/client/__cjs/local-state/LocalState.cjs",
|
|
580
|
-
message: "The '%s'
|
|
586
|
+
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
587
|
},
|
|
582
588
|
|
|
583
589
|
51: {
|
|
584
590
|
file: "@apollo/client/__cjs/local-state/LocalState.cjs",
|
|
585
|
-
message: "
|
|
591
|
+
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
592
|
},
|
|
587
593
|
|
|
588
594
|
52: {
|
|
595
|
+
file: "@apollo/client/__cjs/local-state/LocalState.cjs",
|
|
596
|
+
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."
|
|
597
|
+
},
|
|
598
|
+
|
|
599
|
+
53: {
|
|
600
|
+
file: "@apollo/client/__cjs/local-state/LocalState.cjs",
|
|
601
|
+
message: "The '%s' field had no cached value and only forced resolvers were run. The value was set to `null`."
|
|
602
|
+
},
|
|
603
|
+
|
|
604
|
+
54: {
|
|
589
605
|
file: "@apollo/client/__cjs/local-state/LocalState.cjs",
|
|
590
606
|
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
607
|
},
|
|
592
608
|
|
|
593
|
-
|
|
609
|
+
58: {
|
|
594
610
|
file: "@apollo/client/__cjs/link/ws/index.cjs",
|
|
595
611
|
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
612
|
},
|
|
597
613
|
|
|
598
|
-
|
|
614
|
+
63: {
|
|
599
615
|
file: "@apollo/client/__cjs/link/core/ApolloLink.cjs",
|
|
600
616
|
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
617
|
},
|
|
602
618
|
|
|
603
|
-
|
|
619
|
+
64: {
|
|
604
620
|
file: "@apollo/client/__cjs/link/core/ApolloLink.cjs",
|
|
605
621
|
|
|
606
622
|
message: "The terminating link provided to `ApolloLink.execute` called `forward` instead of handling the request. " +
|
|
@@ -609,34 +625,34 @@ exports.devWarn = {
|
|
|
609
625
|
"If you are using a split link, ensure each branch contains a terminating link that handles the request."
|
|
610
626
|
},
|
|
611
627
|
|
|
612
|
-
|
|
628
|
+
80: {
|
|
613
629
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
614
630
|
|
|
615
631
|
message: `Called refetch(%o) for query %o, which does not declare a $variables variable.
|
|
616
632
|
Did you mean to call refetch(variables) instead of refetch({ variables })?`
|
|
617
633
|
},
|
|
618
634
|
|
|
619
|
-
|
|
635
|
+
84: {
|
|
620
636
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
621
637
|
message: "Cannot poll on 'cache-only' query '%s' and as such, polling is disabled. Please use a different fetch policy."
|
|
622
638
|
},
|
|
623
639
|
|
|
624
|
-
|
|
640
|
+
89: {
|
|
625
641
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
626
642
|
message: `Unknown query named "%s" requested in refetchQueries options.include array`
|
|
627
643
|
},
|
|
628
644
|
|
|
629
|
-
|
|
645
|
+
90: {
|
|
630
646
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
631
647
|
message: `Unknown anonymous query requested in refetchQueries options.include array`
|
|
632
648
|
},
|
|
633
649
|
|
|
634
|
-
|
|
650
|
+
95: {
|
|
635
651
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
636
652
|
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
653
|
},
|
|
638
654
|
|
|
639
|
-
|
|
655
|
+
99: {
|
|
640
656
|
file: "@apollo/client/__cjs/cache/inmemory/entityStore.cjs",
|
|
641
657
|
|
|
642
658
|
message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" +
|
|
@@ -644,24 +660,24 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`
|
|
|
644
660
|
"`toReference(object, true)`"
|
|
645
661
|
},
|
|
646
662
|
|
|
647
|
-
|
|
663
|
+
100: {
|
|
648
664
|
file: "@apollo/client/__cjs/cache/inmemory/entityStore.cjs",
|
|
649
665
|
|
|
650
666
|
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
667
|
"Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`."
|
|
652
668
|
},
|
|
653
669
|
|
|
654
|
-
|
|
670
|
+
103: {
|
|
655
671
|
file: "@apollo/client/__cjs/cache/inmemory/policies.cjs",
|
|
656
672
|
message: `Inferring subtype %s of supertype %s`
|
|
657
673
|
},
|
|
658
674
|
|
|
659
|
-
|
|
675
|
+
104: {
|
|
660
676
|
file: "@apollo/client/__cjs/cache/inmemory/policies.cjs",
|
|
661
677
|
message: `Undefined 'from' passed to readField with arguments %s`
|
|
662
678
|
},
|
|
663
679
|
|
|
664
|
-
|
|
680
|
+
111: {
|
|
665
681
|
file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs",
|
|
666
682
|
|
|
667
683
|
message: `Cache data may be lost when replacing the %s field of a %s object.
|
|
@@ -680,7 +696,7 @@ For more information about these options, please refer to the documentation:
|
|
|
680
696
|
`
|
|
681
697
|
},
|
|
682
698
|
|
|
683
|
-
|
|
699
|
+
112: {
|
|
684
700
|
file: "@apollo/client/__cjs/cache/core/cache.cjs",
|
|
685
701
|
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
702
|
}
|
|
@@ -697,12 +713,12 @@ exports.devError = {
|
|
|
697
713
|
message: "The result of getSnapshot should be cached to avoid an infinite loop"
|
|
698
714
|
},
|
|
699
715
|
|
|
700
|
-
|
|
716
|
+
83: {
|
|
701
717
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
702
718
|
message: "Unhandled GraphQL subscription error"
|
|
703
719
|
},
|
|
704
720
|
|
|
705
|
-
|
|
721
|
+
109: {
|
|
706
722
|
file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs",
|
|
707
723
|
message: `Missing field '%s' while writing result %o`
|
|
708
724
|
}
|
|
@@ -107,7 +107,7 @@ class ApolloLink {
|
|
|
107
107
|
const result = test(operation);
|
|
108
108
|
if (environment_1.__DEV__) {
|
|
109
109
|
if (typeof result !== "boolean") {
|
|
110
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
110
|
+
__DEV__ && invariant_1.invariant.warn(63, result);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
return result ?
|
|
@@ -149,7 +149,7 @@ class ApolloLink {
|
|
|
149
149
|
static execute(link, request, context) {
|
|
150
150
|
return link.request((0, utils_1.createOperation)(request, context), () => {
|
|
151
151
|
if (environment_1.__DEV__) {
|
|
152
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
152
|
+
__DEV__ && invariant_1.invariant.warn(64);
|
|
153
153
|
}
|
|
154
154
|
return rxjs_1.EMPTY;
|
|
155
155
|
});
|
|
@@ -253,7 +253,7 @@ class ApolloLink {
|
|
|
253
253
|
* > request instead.
|
|
254
254
|
*/
|
|
255
255
|
request(operation, forward) {
|
|
256
|
-
throw (0, invariant_1.newInvariantError)(
|
|
256
|
+
throw (0, invariant_1.newInvariantError)(65);
|
|
257
257
|
}
|
|
258
258
|
/**
|
|
259
259
|
* @internal
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.checkFetcher = void 0;
|
|
4
4
|
const invariant_1 = require("@apollo/client/utilities/invariant");
|
|
5
5
|
const checkFetcher = (fetcher) => {
|
|
6
|
-
(0, invariant_1.invariant)(fetcher || typeof fetch !== "undefined",
|
|
6
|
+
(0, invariant_1.invariant)(fetcher || typeof fetch !== "undefined", 61);
|
|
7
7
|
};
|
|
8
8
|
exports.checkFetcher = checkFetcher;
|
|
9
9
|
//# sourceMappingURL=checkFetcher.cjs.map
|
|
@@ -37,7 +37,7 @@ async function* consumeMultipartBody(response) {
|
|
|
37
37
|
/;\s*boundary=(?:'([^']+)'|"([^"]+)"|([^"'].+?))\s*(?:;|$)/i);
|
|
38
38
|
const boundary = "\r\n--" + (match?.findLast((val) => !!val) || "-");
|
|
39
39
|
let buffer = "";
|
|
40
|
-
(0, invariant_1.invariant)(response.body && typeof response.body.getReader === "function",
|
|
40
|
+
(0, invariant_1.invariant)(response.body && typeof response.body.getReader === "function", 62);
|
|
41
41
|
const stream = response.body;
|
|
42
42
|
const reader = stream.getReader();
|
|
43
43
|
let done = false;
|
|
@@ -70,7 +70,7 @@ class PersistedQueryLink extends link_1.ApolloLink {
|
|
|
70
70
|
// hashing with something other than SHA-256.
|
|
71
71
|
(0, invariant_1.invariant)(options &&
|
|
72
72
|
(typeof options.sha256 === "function" ||
|
|
73
|
-
typeof options.generateHash === "function"),
|
|
73
|
+
typeof options.generateHash === "function"), 59);
|
|
74
74
|
const { sha256,
|
|
75
75
|
// If both a `sha256` and `generateHash` option are provided, the
|
|
76
76
|
// `sha256` option will be ignored. Developers can configure and
|
|
@@ -96,7 +96,7 @@ class PersistedQueryLink extends link_1.ApolloLink {
|
|
|
96
96
|
return hash;
|
|
97
97
|
}
|
|
98
98
|
super((operation, forward) => {
|
|
99
|
-
(0, invariant_1.invariant)(forward,
|
|
99
|
+
(0, invariant_1.invariant)(forward, 60);
|
|
100
100
|
const { query } = operation;
|
|
101
101
|
return new rxjs_1.Observable((observer) => {
|
|
102
102
|
let subscription;
|
package/__cjs/link/ws/index.cjs
CHANGED
|
@@ -39,7 +39,7 @@ class WebSocketLink extends link_1.ApolloLink {
|
|
|
39
39
|
constructor(paramsOrClient) {
|
|
40
40
|
super();
|
|
41
41
|
if (environment_1.__DEV__) {
|
|
42
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
42
|
+
__DEV__ && invariant_1.invariant.warn(58);
|
|
43
43
|
}
|
|
44
44
|
if (paramsOrClient instanceof subscriptions_transport_ws_1.SubscriptionClient) {
|
|
45
45
|
this.subscriptionClient = paramsOrClient;
|
|
@@ -71,7 +71,7 @@ class LocalState {
|
|
|
71
71
|
addResolvers(resolvers) {
|
|
72
72
|
this.resolvers = (0, internal_1.mergeDeep)(this.resolvers, resolvers);
|
|
73
73
|
}
|
|
74
|
-
async execute({ document, client, context, remoteResult, variables = {}, onlyRunForcedResolvers = false, returnPartialData = false, }) {
|
|
74
|
+
async execute({ document, client, context, remoteResult, variables = {}, onlyRunForcedResolvers = false, returnPartialData = false, fetchPolicy, }) {
|
|
75
75
|
if (environment_1.__DEV__) {
|
|
76
76
|
(0, invariant_1.invariant)((0, internal_1.hasDirectives)(["client"], document), 47);
|
|
77
77
|
validateCacheImplementation(client.cache);
|
|
@@ -85,12 +85,14 @@ class LocalState {
|
|
|
85
85
|
}
|
|
86
86
|
const { selectionsToResolve, exportedVariableDefs, operationDefinition, fragmentMap, } = this.collectQueryDetail(document);
|
|
87
87
|
const rootValue = remoteResult ? remoteResult.data : {};
|
|
88
|
-
const diff =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
const diff = fetchPolicy === "no-cache" ?
|
|
89
|
+
{ result: null, complete: false }
|
|
90
|
+
: client.cache.diff({
|
|
91
|
+
query: toQueryOperation(document),
|
|
92
|
+
variables,
|
|
93
|
+
returnPartialData: true,
|
|
94
|
+
optimistic: false,
|
|
95
|
+
});
|
|
94
96
|
const requestContext = { ...client.defaultContext, ...context };
|
|
95
97
|
const execContext = {
|
|
96
98
|
client,
|
|
@@ -112,6 +114,7 @@ class LocalState {
|
|
|
112
114
|
exportedVariableDefs,
|
|
113
115
|
diff,
|
|
114
116
|
returnPartialData,
|
|
117
|
+
fetchPolicy,
|
|
115
118
|
};
|
|
116
119
|
const localResult = await this.resolveSelectionSet(operationDefinition.selectionSet, false, rootValue, execContext, []);
|
|
117
120
|
const errors = (remoteResult?.errors ?? []).concat(execContext.errors);
|
|
@@ -248,7 +251,8 @@ class LocalState {
|
|
|
248
251
|
return this.resolveSelectionSet(field.selectionSet, false, result, execContext, path);
|
|
249
252
|
}
|
|
250
253
|
async resolveClientField(field, isClientFieldDescendant, rootValue, execContext, parentSelectionSet, path) {
|
|
251
|
-
const { client, diff, variables, operationDefinition, phase,
|
|
254
|
+
const { client, diff, variables, operationDefinition, phase, onlyRunForcedResolvers, fetchPolicy, } = execContext;
|
|
255
|
+
let { returnPartialData } = execContext;
|
|
252
256
|
const isRootField = parentSelectionSet === operationDefinition.selectionSet;
|
|
253
257
|
const fieldName = field.name.value;
|
|
254
258
|
const typename = isRootField ?
|
|
@@ -270,7 +274,17 @@ class LocalState {
|
|
|
270
274
|
if (fieldFromCache !== undefined) {
|
|
271
275
|
return fieldFromCache;
|
|
272
276
|
}
|
|
277
|
+
if (client.cache.resolvesClientField?.(typename, fieldName)) {
|
|
278
|
+
if (fetchPolicy === "no-cache") {
|
|
279
|
+
__DEV__ && invariant_1.invariant.warn(50, resolverName);
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
// assume the cache will handle returning the correct value
|
|
283
|
+
returnPartialData = true;
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
273
286
|
if (!returnPartialData) {
|
|
287
|
+
__DEV__ && invariant_1.invariant.warn(51, resolverName);
|
|
274
288
|
return null;
|
|
275
289
|
}
|
|
276
290
|
});
|
|
@@ -336,13 +350,13 @@ class LocalState {
|
|
|
336
350
|
if (result === undefined && !returnPartialData) {
|
|
337
351
|
if (environment_1.__DEV__ && phase === "resolve") {
|
|
338
352
|
if (resolver && !onlyRunForcedResolvers) {
|
|
339
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
353
|
+
__DEV__ && invariant_1.invariant.warn(52, resolverName);
|
|
340
354
|
}
|
|
341
355
|
else if (onlyRunForcedResolvers) {
|
|
342
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
356
|
+
__DEV__ && invariant_1.invariant.warn(53, resolverName);
|
|
343
357
|
}
|
|
344
358
|
else {
|
|
345
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
359
|
+
__DEV__ && invariant_1.invariant.warn(54, fieldName, rootValue);
|
|
346
360
|
}
|
|
347
361
|
}
|
|
348
362
|
result = null;
|
|
@@ -354,7 +368,7 @@ class LocalState {
|
|
|
354
368
|
return this.resolveSubSelectedArray(field, true, result, execContext, path);
|
|
355
369
|
}
|
|
356
370
|
if (phase === "resolve" && !result.__typename) {
|
|
357
|
-
this.addError((0, invariant_1.newInvariantError)(
|
|
371
|
+
this.addError((0, invariant_1.newInvariantError)(55, result, resolverName), path, execContext, { resolver: resolverName });
|
|
358
372
|
return null;
|
|
359
373
|
}
|
|
360
374
|
return this.resolveSelectionSet(field.selectionSet, true, result, execContext, path);
|
|
@@ -465,7 +479,7 @@ class LocalState {
|
|
|
465
479
|
},
|
|
466
480
|
FragmentSpread(spread, _, __, ___, ancestors) {
|
|
467
481
|
const fragment = fragmentMap[spread.name.value];
|
|
468
|
-
(0, invariant_1.invariant)(fragment,
|
|
482
|
+
(0, invariant_1.invariant)(fragment, 56, spread.name.value);
|
|
469
483
|
const { selectionsToResolve: fragmentSelections } = traverse(fragment);
|
|
470
484
|
if (fragmentSelections.size > 0) {
|
|
471
485
|
// Fragment for this spread contains @client directive (either directly or transitively)
|
|
@@ -525,7 +539,7 @@ function getExportedVariableName(directive) {
|
|
|
525
539
|
}
|
|
526
540
|
}
|
|
527
541
|
function validateCacheImplementation(cache) {
|
|
528
|
-
(0, invariant_1.invariant)(cache.fragmentMatches,
|
|
542
|
+
(0, invariant_1.invariant)(cache.fragmentMatches, 57);
|
|
529
543
|
}
|
|
530
544
|
function getCacheResultAtPath(diff, path) {
|
|
531
545
|
if (diff.result === null) {
|