@apollo/client 4.0.0-rc.0 → 4.0.0-rc.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 +47 -0
- package/__cjs/cache/core/cache.cjs +1 -1
- package/__cjs/cache/index.cjs.map +1 -1
- package/__cjs/cache/index.d.cts +1 -1
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/inMemoryCache.cjs +2 -7
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- 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/readFromStore.cjs +4 -6
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/readFromStore.d.cts +0 -1
- package/__cjs/cache/inmemory/types.d.cts +0 -5
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/core/ApolloClient.cjs +14 -21
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +0 -7
- package/__cjs/core/ObservableQuery.cjs +6 -6
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryManager.cjs +13 -12
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/watchQueryOptions.d.cts +7 -7
- package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
- package/__cjs/invariantErrorCodes.cjs +59 -64
- package/__cjs/link/core/ApolloLink.cjs +2 -2
- package/__cjs/link/core/types.d.cts +3 -1
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
- package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
- package/__cjs/link/persisted-queries/index.cjs +2 -2
- package/__cjs/link/utils/validateOperation.cjs +2 -1
- package/__cjs/link/utils/validateOperation.cjs.map +1 -1
- package/__cjs/local-state/LocalState.cjs +6 -9
- package/__cjs/local-state/LocalState.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.cjs.map +1 -1
- package/__cjs/react/hooks/useMutation.d.cts +2 -2
- package/__cjs/react/hooks/useQuery.cjs +11 -3
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.cjs +2 -2
- package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.d.cts +2 -6
- package/__cjs/utilities/index.cjs +3 -1
- package/__cjs/utilities/index.cjs.map +1 -1
- package/__cjs/utilities/index.d.cts +1 -0
- package/__cjs/utilities/internal/getMainDefinition.cjs +1 -6
- package/__cjs/utilities/internal/getMainDefinition.cjs.map +1 -1
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.js +1 -1
- package/cache/index.d.ts +1 -1
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/inMemoryCache.js +2 -7
- 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/readFromStore.d.ts +0 -1
- package/cache/inmemory/readFromStore.js +4 -6
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +0 -5
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.d.ts +0 -7
- package/core/ApolloClient.js +14 -21
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.js +6 -6
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +13 -12
- package/core/QueryManager.js.map +1 -1
- package/core/watchQueryOptions.d.ts +7 -7
- package/incremental/handlers/notImplemented.js +1 -1
- package/invariantErrorCodes.js +59 -64
- package/link/core/ApolloLink.js +2 -2
- package/link/core/types.d.ts +3 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/utils/validateOperation.js +2 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/local-state/LocalState.js +6 -9
- package/local-state/LocalState.js.map +1 -1
- package/package.json +1 -1
- package/react/hooks/useMutation.d.ts +2 -2
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.js +12 -4
- package/react/hooks/useQuery.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +2 -6
- package/testing/react/MockedProvider.js +2 -2
- package/testing/react/MockedProvider.js.map +1 -1
- package/utilities/index.d.ts +1 -0
- package/utilities/index.js +1 -0
- package/utilities/index.js.map +1 -1
- package/utilities/internal/getMainDefinition.js +1 -6
- package/utilities/internal/getMainDefinition.js.map +1 -1
- package/version.js +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { TypedDocumentNode } from "@graphql-typed-document-node/core";
|
|
2
2
|
import type { DocumentNode } from "graphql";
|
|
3
3
|
import type { ApolloCache } from "@apollo/client/cache";
|
|
4
|
+
import type { IgnoreModifier } from "@apollo/client/cache";
|
|
4
5
|
import type { Unmasked } from "@apollo/client/masking";
|
|
5
6
|
import type { DeepPartial } from "@apollo/client/utilities";
|
|
6
7
|
import type { NoInfer, VariablesOption } from "@apollo/client/utilities/internal";
|
|
7
|
-
import type { IgnoreModifier } from "../cache/core/types/common.js";
|
|
8
8
|
import type { ObservableQuery } from "./ObservableQuery.js";
|
|
9
9
|
import type { DefaultContext, InternalRefetchQueriesInclude, MutationQueryReducersMap, MutationUpdaterFunction, NormalizedExecutionResult, OnQueryUpdated, OperationVariables } from "./types.js";
|
|
10
10
|
/**
|
|
@@ -205,19 +205,19 @@ export interface UpdateQueryMapFn<TData = unknown, TVariables = OperationVariabl
|
|
|
205
205
|
(
|
|
206
206
|
/**
|
|
207
207
|
* @deprecated This value is not type-safe and may contain partial data. This
|
|
208
|
-
* argument will be removed in
|
|
209
|
-
*
|
|
208
|
+
* argument will be removed in Apollo Client v5. Use `options.previousData`
|
|
209
|
+
* instead for a more type-safe value.
|
|
210
210
|
*/
|
|
211
|
-
unsafePreviousData: Unmasked<TData
|
|
211
|
+
unsafePreviousData: DeepPartial<Unmasked<TData>>, options: UpdateQueryOptions<TData, TVariables>): Unmasked<TData> | void;
|
|
212
212
|
}
|
|
213
213
|
export type SubscribeToMoreUpdateQueryFn<TData = unknown, TVariables extends OperationVariables = OperationVariables, TSubscriptionData = TData> = {
|
|
214
214
|
(
|
|
215
215
|
/**
|
|
216
216
|
* @deprecated This value is not type-safe and may contain partial data. This
|
|
217
|
-
* argument will be removed in
|
|
218
|
-
*
|
|
217
|
+
* argument will be removed in Apollo Client v5. Use `options.previousData`
|
|
218
|
+
* instead for a more type-safe value.
|
|
219
219
|
*/
|
|
220
|
-
unsafePreviousData: Unmasked<TData
|
|
220
|
+
unsafePreviousData: DeepPartial<Unmasked<TData>>, options: UpdateQueryOptions<TData, TVariables> & {
|
|
221
221
|
subscriptionData: {
|
|
222
222
|
data: Unmasked<TSubscriptionData>;
|
|
223
223
|
};
|
package/invariantErrorCodes.js
CHANGED
|
@@ -277,29 +277,29 @@ you have an infinite render loop in your application.`
|
|
|
277
277
|
message: "No fragment named %s"
|
|
278
278
|
},
|
|
279
279
|
|
|
280
|
-
|
|
280
|
+
54: {
|
|
281
281
|
file: "@apollo/client/local-state/LocalState.js",
|
|
282
282
|
message: "Could not resolve __typename on object %o returned from resolver '%s'. '__typename' needs to be returned to properly resolve child fields."
|
|
283
283
|
},
|
|
284
284
|
|
|
285
|
-
|
|
285
|
+
55: {
|
|
286
286
|
file: "@apollo/client/local-state/LocalState.js",
|
|
287
287
|
condition: "fragment",
|
|
288
288
|
message: `No fragment named %s`
|
|
289
289
|
},
|
|
290
290
|
|
|
291
|
-
|
|
291
|
+
56: {
|
|
292
292
|
file: "@apollo/client/local-state/LocalState.js",
|
|
293
293
|
condition: "cache.fragmentMatches",
|
|
294
294
|
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`."
|
|
295
295
|
},
|
|
296
296
|
|
|
297
|
-
|
|
297
|
+
57: {
|
|
298
298
|
file: "@apollo/client/link/utils/validateOperation.js",
|
|
299
299
|
message: `illegal argument: %s`
|
|
300
300
|
},
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
58: {
|
|
303
303
|
file: "@apollo/client/link/persisted-queries/index.js",
|
|
304
304
|
condition: "options &&\n (typeof options.sha256 === \"function\" ||\n typeof options.generateHash === \"function\")",
|
|
305
305
|
|
|
@@ -308,13 +308,13 @@ you have an infinite render loop in your application.`
|
|
|
308
308
|
"parameter."
|
|
309
309
|
},
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
59: {
|
|
312
312
|
file: "@apollo/client/link/persisted-queries/index.js",
|
|
313
313
|
condition: "forward",
|
|
314
314
|
message: "PersistedQueryLink cannot be the last link in the chain."
|
|
315
315
|
},
|
|
316
316
|
|
|
317
|
-
|
|
317
|
+
60: {
|
|
318
318
|
file: "@apollo/client/link/http/checkFetcher.js",
|
|
319
319
|
condition: "fetcher || typeof fetch !== \"undefined\"",
|
|
320
320
|
|
|
@@ -332,29 +332,29 @@ const client = new ApolloClient({
|
|
|
332
332
|
`
|
|
333
333
|
},
|
|
334
334
|
|
|
335
|
-
|
|
335
|
+
61: {
|
|
336
336
|
file: "@apollo/client/link/http/parseAndCheckHttpResponse.js",
|
|
337
337
|
condition: "response.body && typeof response.body.getReader === \"function\"",
|
|
338
338
|
message: "Unknown type for `response.body`. Please use a `fetch` implementation that is WhatWG-compliant and that uses WhatWG ReadableStreams for `body`."
|
|
339
339
|
},
|
|
340
340
|
|
|
341
|
-
|
|
341
|
+
62: {
|
|
342
342
|
file: "@apollo/client/link/http/serializeFetchParameter.js",
|
|
343
343
|
message: `Network request failed. %s is not serializable: %s`
|
|
344
344
|
},
|
|
345
345
|
|
|
346
|
-
|
|
346
|
+
64: {
|
|
347
347
|
file: "@apollo/client/link/core/ApolloLink.js",
|
|
348
348
|
message: "request is not implemented"
|
|
349
349
|
},
|
|
350
350
|
|
|
351
|
-
|
|
351
|
+
65: {
|
|
352
352
|
file: "@apollo/client/incremental/handlers/notImplemented.js",
|
|
353
353
|
condition: "!hasDirectives([\"defer\"], request.query)",
|
|
354
354
|
message: "`@defer` is not supported without specifying an incremental handler. Please pass a handler as the `incrementalHandler` option to the `ApolloClient` constructor."
|
|
355
355
|
},
|
|
356
356
|
|
|
357
|
-
|
|
357
|
+
66: {
|
|
358
358
|
file: "@apollo/client/core/ApolloClient.js",
|
|
359
359
|
condition: "options.cache",
|
|
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
|
-
|
|
366
|
+
67: {
|
|
367
367
|
file: "@apollo/client/core/ApolloClient.js",
|
|
368
368
|
condition: "options.link",
|
|
369
369
|
|
|
@@ -372,7 +372,7 @@ const client = new ApolloClient({
|
|
|
372
372
|
"For more information, please visit: https://go.apollo.dev/c/docs"
|
|
373
373
|
},
|
|
374
374
|
|
|
375
|
-
|
|
375
|
+
68: {
|
|
376
376
|
file: "@apollo/client/core/ApolloClient.js",
|
|
377
377
|
condition: "options.fetchPolicy !== \"cache-and-network\"",
|
|
378
378
|
|
|
@@ -382,7 +382,7 @@ const client = new ApolloClient({
|
|
|
382
382
|
"using a different fetchPolicy, such as cache-first or network-only."
|
|
383
383
|
},
|
|
384
384
|
|
|
385
|
-
|
|
385
|
+
69: {
|
|
386
386
|
file: "@apollo/client/core/ApolloClient.js",
|
|
387
387
|
condition: "options.fetchPolicy !== \"standby\"",
|
|
388
388
|
|
|
@@ -391,7 +391,7 @@ const client = new ApolloClient({
|
|
|
391
391
|
"as cache-first or network-only."
|
|
392
392
|
},
|
|
393
393
|
|
|
394
|
-
|
|
394
|
+
70: {
|
|
395
395
|
file: "@apollo/client/core/ApolloClient.js",
|
|
396
396
|
condition: "options.query",
|
|
397
397
|
|
|
@@ -399,158 +399,158 @@ const client = new ApolloClient({
|
|
|
399
399
|
"in the query option."
|
|
400
400
|
},
|
|
401
401
|
|
|
402
|
-
|
|
402
|
+
71: {
|
|
403
403
|
file: "@apollo/client/core/ApolloClient.js",
|
|
404
404
|
condition: "options.query.kind === \"Document\"",
|
|
405
405
|
message: 'You must wrap the query string in a "gql" tag.'
|
|
406
406
|
},
|
|
407
407
|
|
|
408
|
-
|
|
408
|
+
72: {
|
|
409
409
|
file: "@apollo/client/core/ApolloClient.js",
|
|
410
410
|
condition: "!options.returnPartialData",
|
|
411
411
|
message: "returnPartialData option only supported on watchQuery."
|
|
412
412
|
},
|
|
413
413
|
|
|
414
|
-
|
|
414
|
+
73: {
|
|
415
415
|
file: "@apollo/client/core/ApolloClient.js",
|
|
416
416
|
condition: "!options.pollInterval",
|
|
417
417
|
message: "pollInterval option only supported on watchQuery."
|
|
418
418
|
},
|
|
419
419
|
|
|
420
|
-
|
|
420
|
+
74: {
|
|
421
421
|
file: "@apollo/client/core/ApolloClient.js",
|
|
422
422
|
condition: "!options.notifyOnNetworkStatusChange",
|
|
423
423
|
message: "notifyOnNetworkStatusChange option only supported on watchQuery."
|
|
424
424
|
},
|
|
425
425
|
|
|
426
|
-
|
|
426
|
+
75: {
|
|
427
427
|
file: "@apollo/client/core/ApolloClient.js",
|
|
428
428
|
condition: "optionsWithDefaults.mutation",
|
|
429
429
|
message: "The `mutation` option is required. Please provide a GraphQL document in the `mutation` option."
|
|
430
430
|
},
|
|
431
431
|
|
|
432
|
-
|
|
432
|
+
76: {
|
|
433
433
|
file: "@apollo/client/core/ApolloClient.js",
|
|
434
434
|
condition: "optionsWithDefaults.fetchPolicy === \"network-only\" ||\n optionsWithDefaults.fetchPolicy === \"no-cache\"",
|
|
435
435
|
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."
|
|
436
436
|
},
|
|
437
437
|
|
|
438
|
-
|
|
438
|
+
79: {
|
|
439
439
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
440
440
|
condition: "this.options.fetchPolicy !== \"cache-only\"",
|
|
441
441
|
message: "Cannot execute `fetchMore` for 'cache-only' query '%s'. Please use a different fetch policy."
|
|
442
442
|
},
|
|
443
443
|
|
|
444
|
-
|
|
444
|
+
80: {
|
|
445
445
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
446
446
|
condition: "updateQuery",
|
|
447
447
|
message: "You must provide an `updateQuery` function when using `fetchMore` with a `no-cache` fetch policy."
|
|
448
448
|
},
|
|
449
449
|
|
|
450
|
-
|
|
450
|
+
84: {
|
|
451
451
|
file: "@apollo/client/core/QueryManager.js",
|
|
452
452
|
message: "QueryManager stopped while query was in flight"
|
|
453
453
|
},
|
|
454
454
|
|
|
455
|
-
|
|
455
|
+
85: {
|
|
456
456
|
file: "@apollo/client/core/QueryManager.js",
|
|
457
457
|
condition: "this.localState",
|
|
458
458
|
message: "Mutation '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
|
|
459
459
|
},
|
|
460
460
|
|
|
461
|
-
|
|
461
|
+
86: {
|
|
462
462
|
file: "@apollo/client/core/QueryManager.js",
|
|
463
463
|
message: "Store reset while query was in flight (not completed in link chain)"
|
|
464
464
|
},
|
|
465
465
|
|
|
466
|
-
|
|
466
|
+
89: {
|
|
467
467
|
file: "@apollo/client/core/QueryManager.js",
|
|
468
468
|
condition: "!this.getDocumentInfo(query).hasClientExports || this.localState",
|
|
469
469
|
message: "Subscription '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
|
|
470
470
|
},
|
|
471
471
|
|
|
472
|
-
|
|
472
|
+
90: {
|
|
473
473
|
file: "@apollo/client/core/QueryManager.js",
|
|
474
474
|
condition: "this.localState",
|
|
475
475
|
message: "%s '%s' contains `@client` fields but local state has not been configured."
|
|
476
476
|
},
|
|
477
477
|
|
|
478
|
-
|
|
478
|
+
91: {
|
|
479
479
|
file: "@apollo/client/core/QueryManager.js",
|
|
480
480
|
condition: "!hasIncrementalDirective",
|
|
481
481
|
message: "%s '%s' contains `@client` and `@defer` directives. These cannot be used together."
|
|
482
482
|
},
|
|
483
483
|
|
|
484
|
-
|
|
484
|
+
92: {
|
|
485
485
|
file: "@apollo/client/core/QueryManager.js",
|
|
486
486
|
condition: "this.localState",
|
|
487
487
|
message: "Query '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
|
|
488
488
|
},
|
|
489
489
|
|
|
490
|
-
|
|
490
|
+
94: {
|
|
491
491
|
file: "@apollo/client/core/QueryManager.js",
|
|
492
492
|
condition: "this.localState",
|
|
493
493
|
message: "Query '%s' contains `@client` fields but local state has not been configured."
|
|
494
494
|
},
|
|
495
495
|
|
|
496
|
-
|
|
496
|
+
95: {
|
|
497
497
|
file: "@apollo/client/core/QueryManager.js",
|
|
498
498
|
condition: "didEmitValue",
|
|
499
499
|
message: "The link chain completed without emitting a value. This is likely unintentional and should be updated to emit a value before completing."
|
|
500
500
|
},
|
|
501
501
|
|
|
502
|
-
|
|
502
|
+
96: {
|
|
503
503
|
file: "@apollo/client/cache/inmemory/entityStore.js",
|
|
504
504
|
condition: "typeof dataId === \"string\"",
|
|
505
505
|
message: "store.merge expects a string ID"
|
|
506
506
|
},
|
|
507
507
|
|
|
508
|
-
|
|
508
|
+
99: {
|
|
509
509
|
file: "@apollo/client/cache/inmemory/key-extractor.js",
|
|
510
510
|
condition: "extracted !== void 0",
|
|
511
511
|
message: `Missing field '%s' while extracting keyFields from %s`
|
|
512
512
|
},
|
|
513
513
|
|
|
514
|
-
|
|
514
|
+
100: {
|
|
515
515
|
file: "@apollo/client/cache/inmemory/policies.js",
|
|
516
516
|
condition: "!old || old === which",
|
|
517
517
|
message: `Cannot change root %s __typename more than once`
|
|
518
518
|
},
|
|
519
519
|
|
|
520
|
-
|
|
520
|
+
103: {
|
|
521
521
|
file: "@apollo/client/cache/inmemory/policies.js",
|
|
522
522
|
message: "Cannot automatically merge arrays"
|
|
523
523
|
},
|
|
524
524
|
|
|
525
|
-
|
|
525
|
+
104: {
|
|
526
526
|
file: "@apollo/client/cache/inmemory/readFromStore.js",
|
|
527
527
|
message: `No fragment named %s`
|
|
528
528
|
},
|
|
529
529
|
|
|
530
|
-
|
|
530
|
+
105: {
|
|
531
531
|
file: "@apollo/client/cache/inmemory/readFromStore.js",
|
|
532
532
|
condition: "!isReference(value)",
|
|
533
533
|
message: `Missing selection set for object of type %s returned for query field %s`
|
|
534
534
|
},
|
|
535
535
|
|
|
536
|
-
|
|
536
|
+
106: {
|
|
537
537
|
file: "@apollo/client/cache/inmemory/writeToStore.js",
|
|
538
538
|
message: `Could not identify object %s`
|
|
539
539
|
},
|
|
540
540
|
|
|
541
|
-
|
|
541
|
+
108: {
|
|
542
542
|
file: "@apollo/client/cache/inmemory/writeToStore.js",
|
|
543
543
|
message: `No fragment named %s`
|
|
544
544
|
}
|
|
545
545
|
};
|
|
546
546
|
|
|
547
547
|
export const devDebug = {
|
|
548
|
-
|
|
548
|
+
77: {
|
|
549
549
|
file: "@apollo/client/core/ApolloClient.js",
|
|
550
550
|
message: `In client.refetchQueries, Promise.all promise rejected with error %o`
|
|
551
551
|
},
|
|
552
552
|
|
|
553
|
-
|
|
553
|
+
83: {
|
|
554
554
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
555
555
|
message: `Missing cache result fields: %o`
|
|
556
556
|
}
|
|
@@ -585,58 +585,53 @@ export const devWarn = {
|
|
|
585
585
|
},
|
|
586
586
|
|
|
587
587
|
51: {
|
|
588
|
-
file: "@apollo/client/local-state/LocalState.js",
|
|
589
|
-
message: "Could not find a resolver for the '%s' field. The field value has been set to `null`."
|
|
590
|
-
},
|
|
591
|
-
|
|
592
|
-
52: {
|
|
593
588
|
file: "@apollo/client/local-state/LocalState.js",
|
|
594
589
|
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."
|
|
595
590
|
},
|
|
596
591
|
|
|
597
|
-
|
|
592
|
+
52: {
|
|
598
593
|
file: "@apollo/client/local-state/LocalState.js",
|
|
599
594
|
message: "The '%s' field had no cached value and only forced resolvers were run. The value was set to `null`."
|
|
600
595
|
},
|
|
601
596
|
|
|
602
|
-
|
|
597
|
+
53: {
|
|
603
598
|
file: "@apollo/client/local-state/LocalState.js",
|
|
604
599
|
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."
|
|
605
600
|
},
|
|
606
601
|
|
|
607
|
-
|
|
602
|
+
63: {
|
|
608
603
|
file: "@apollo/client/link/core/ApolloLink.js",
|
|
609
604
|
message: `You are calling concat on a terminating link, which will have no effect %o`
|
|
610
605
|
},
|
|
611
606
|
|
|
612
|
-
|
|
607
|
+
78: {
|
|
613
608
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
614
609
|
|
|
615
610
|
message: `Called refetch(%o) for query %o, which does not declare a $variables variable.
|
|
616
611
|
Did you mean to call refetch(variables) instead of refetch({ variables })?`
|
|
617
612
|
},
|
|
618
613
|
|
|
619
|
-
|
|
614
|
+
82: {
|
|
620
615
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
621
616
|
message: "Cannot poll on 'cache-only' query '%s' and as such, polling is disabled. Please use a different fetch policy."
|
|
622
617
|
},
|
|
623
618
|
|
|
624
|
-
|
|
619
|
+
87: {
|
|
625
620
|
file: "@apollo/client/core/QueryManager.js",
|
|
626
621
|
message: `Unknown query named "%s" requested in refetchQueries options.include array`
|
|
627
622
|
},
|
|
628
623
|
|
|
629
|
-
|
|
624
|
+
88: {
|
|
630
625
|
file: "@apollo/client/core/QueryManager.js",
|
|
631
626
|
message: `Unknown anonymous query requested in refetchQueries options.include array`
|
|
632
627
|
},
|
|
633
628
|
|
|
634
|
-
|
|
629
|
+
93: {
|
|
635
630
|
file: "@apollo/client/core/QueryManager.js",
|
|
636
631
|
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
632
|
},
|
|
638
633
|
|
|
639
|
-
|
|
634
|
+
97: {
|
|
640
635
|
file: "@apollo/client/cache/inmemory/entityStore.js",
|
|
641
636
|
|
|
642
637
|
message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" +
|
|
@@ -644,24 +639,24 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`
|
|
|
644
639
|
"`toReference(object, true)`"
|
|
645
640
|
},
|
|
646
641
|
|
|
647
|
-
|
|
642
|
+
98: {
|
|
648
643
|
file: "@apollo/client/cache/inmemory/entityStore.js",
|
|
649
644
|
|
|
650
645
|
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
646
|
"Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`."
|
|
652
647
|
},
|
|
653
648
|
|
|
654
|
-
|
|
649
|
+
101: {
|
|
655
650
|
file: "@apollo/client/cache/inmemory/policies.js",
|
|
656
651
|
message: `Inferring subtype %s of supertype %s`
|
|
657
652
|
},
|
|
658
653
|
|
|
659
|
-
|
|
654
|
+
102: {
|
|
660
655
|
file: "@apollo/client/cache/inmemory/policies.js",
|
|
661
656
|
message: `Undefined 'from' passed to readField with arguments %s`
|
|
662
657
|
},
|
|
663
658
|
|
|
664
|
-
|
|
659
|
+
109: {
|
|
665
660
|
file: "@apollo/client/cache/inmemory/writeToStore.js",
|
|
666
661
|
|
|
667
662
|
message: `Cache data may be lost when replacing the %s field of a %s object.
|
|
@@ -680,7 +675,7 @@ For more information about these options, please refer to the documentation:
|
|
|
680
675
|
`
|
|
681
676
|
},
|
|
682
677
|
|
|
683
|
-
|
|
678
|
+
110: {
|
|
684
679
|
file: "@apollo/client/cache/core/cache.js",
|
|
685
680
|
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
681
|
}
|
|
@@ -697,12 +692,12 @@ export const devError = {
|
|
|
697
692
|
message: "The result of getSnapshot should be cached to avoid an infinite loop"
|
|
698
693
|
},
|
|
699
694
|
|
|
700
|
-
|
|
695
|
+
81: {
|
|
701
696
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
702
697
|
message: "Unhandled GraphQL subscription error"
|
|
703
698
|
},
|
|
704
699
|
|
|
705
|
-
|
|
700
|
+
107: {
|
|
706
701
|
file: "@apollo/client/cache/inmemory/writeToStore.js",
|
|
707
702
|
message: `Missing field '%s' while writing result %o`
|
|
708
703
|
}
|
package/link/core/ApolloLink.js
CHANGED
|
@@ -46,7 +46,7 @@ export class ApolloLink {
|
|
|
46
46
|
static concat(first, second) {
|
|
47
47
|
const firstLink = toLink(first);
|
|
48
48
|
if (isTerminating(firstLink)) {
|
|
49
|
-
__DEV__ && invariant.warn(
|
|
49
|
+
__DEV__ && invariant.warn(63, firstLink);
|
|
50
50
|
return firstLink;
|
|
51
51
|
}
|
|
52
52
|
const nextLink = toLink(second);
|
|
@@ -75,7 +75,7 @@ export class ApolloLink {
|
|
|
75
75
|
return ApolloLink.concat(this, next);
|
|
76
76
|
}
|
|
77
77
|
request(operation, forward) {
|
|
78
|
-
throw newInvariantError(
|
|
78
|
+
throw newInvariantError(64);
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
81
|
* @internal
|
package/link/core/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FormattedExecutionResult, GraphQLFormattedError } from "graphql";
|
|
1
|
+
import type { FormattedExecutionResult, GraphQLFormattedError, OperationTypeNode } from "graphql";
|
|
2
2
|
import type { DocumentNode } from "graphql";
|
|
3
3
|
import type { Observable } from "rxjs";
|
|
4
4
|
import type { ApolloClient, DefaultContext } from "@apollo/client";
|
|
@@ -11,6 +11,7 @@ export interface GraphQLRequest<TVariables = Record<string, any>> {
|
|
|
11
11
|
query: DocumentNode;
|
|
12
12
|
variables?: TVariables;
|
|
13
13
|
operationName?: string;
|
|
14
|
+
operationType?: OperationTypeNode;
|
|
14
15
|
context?: DefaultContext;
|
|
15
16
|
extensions?: Record<string, any>;
|
|
16
17
|
}
|
|
@@ -18,6 +19,7 @@ export interface Operation {
|
|
|
18
19
|
query: DocumentNode;
|
|
19
20
|
variables: Record<string, any>;
|
|
20
21
|
operationName: string;
|
|
22
|
+
operationType: OperationTypeNode | undefined;
|
|
21
23
|
extensions: Record<string, any>;
|
|
22
24
|
setContext: {
|
|
23
25
|
(context: Partial<OperationContext>): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { invariant } from "@apollo/client/utilities/invariant";
|
|
2
2
|
export const checkFetcher = (fetcher) => {
|
|
3
|
-
invariant(fetcher || typeof fetch !== "undefined",
|
|
3
|
+
invariant(fetcher || typeof fetch !== "undefined", 60);
|
|
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",
|
|
36
|
+
invariant(response.body && typeof response.body.getReader === "function", 61);
|
|
37
37
|
const reader = response.body.getReader();
|
|
38
38
|
let done = false;
|
|
39
39
|
let value;
|
|
@@ -5,7 +5,7 @@ export const serializeFetchParameter = (p, label) => {
|
|
|
5
5
|
serialized = JSON.stringify(p);
|
|
6
6
|
}
|
|
7
7
|
catch (e) {
|
|
8
|
-
const parseError = newInvariantError(
|
|
8
|
+
const parseError = newInvariantError(62, label, e.message);
|
|
9
9
|
parseError.parseError = e;
|
|
10
10
|
throw parseError;
|
|
11
11
|
}
|
|
@@ -50,7 +50,7 @@ export class PersistedQueryLink extends ApolloLink {
|
|
|
50
50
|
// hashing with something other than SHA-256.
|
|
51
51
|
invariant(options &&
|
|
52
52
|
(typeof options.sha256 === "function" ||
|
|
53
|
-
typeof options.generateHash === "function"),
|
|
53
|
+
typeof options.generateHash === "function"), 58);
|
|
54
54
|
const { sha256,
|
|
55
55
|
// If both a `sha256` and `generateHash` option are provided, the
|
|
56
56
|
// `sha256` option will be ignored. Developers can configure and
|
|
@@ -76,7 +76,7 @@ export class PersistedQueryLink extends ApolloLink {
|
|
|
76
76
|
return hash;
|
|
77
77
|
}
|
|
78
78
|
super((operation, forward) => {
|
|
79
|
-
invariant(forward,
|
|
79
|
+
invariant(forward, 59);
|
|
80
80
|
const { query } = operation;
|
|
81
81
|
return new Observable((observer) => {
|
|
82
82
|
let subscription;
|
|
@@ -3,13 +3,14 @@ export function validateOperation(operation) {
|
|
|
3
3
|
const OPERATION_FIELDS = [
|
|
4
4
|
"query",
|
|
5
5
|
"operationName",
|
|
6
|
+
"operationType",
|
|
6
7
|
"variables",
|
|
7
8
|
"extensions",
|
|
8
9
|
"context",
|
|
9
10
|
];
|
|
10
11
|
for (let key of Object.keys(operation)) {
|
|
11
12
|
if (OPERATION_FIELDS.indexOf(key) < 0) {
|
|
12
|
-
throw newInvariantError(
|
|
13
|
+
throw newInvariantError(57, key);
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
return operation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateOperation.js","sources":["../../../src/link/utils/validateOperation.ts"],"sourcesContent":["import type { GraphQLRequest } from \"@apollo/client/link\";\nimport { newInvariantError } from \"@apollo/client/utilities/invariant\";\n\nexport function validateOperation(operation: GraphQLRequest): GraphQLRequest {\n const OPERATION_FIELDS = [\n \"query\",\n \"operationName\",\n \"variables\",\n \"extensions\",\n \"context\",\n ];\n for (let key of Object.keys(operation)) {\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw newInvariantError(`illegal argument: %s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A,EAAA,CAAO,CAAP,CAAA,EAAW,CAAX,CAAA,EAAA,CAAA,EAAkB,CAAlB,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAC,CAAzB,CAAA,CAAA,CAA6B,CAAC,CAA9B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuC,CAAC,EAAE;QACtC,CAAJ,EAAA,CAAQ,CAAR,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAC,CAAzB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgC,CAAC,CAAjC,CAAA,CAAoC,EAApC,EAAwC,CAAC,EAAE;YACrC,CAAN,CAAA,CAAA,CAAA,EAAY,CAAZ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,MAAsD,CAAtD,CAAA,EAA0D;QACtD;IACF;IAEA,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB;AAClB;"}
|
|
1
|
+
{"version":3,"file":"validateOperation.js","sources":["../../../src/link/utils/validateOperation.ts"],"sourcesContent":["import type { GraphQLRequest } from \"@apollo/client/link\";\nimport { newInvariantError } from \"@apollo/client/utilities/invariant\";\n\nexport function validateOperation(operation: GraphQLRequest): GraphQLRequest {\n const OPERATION_FIELDS = [\n \"query\",\n \"operationName\",\n \"operationType\",\n \"variables\",\n \"extensions\",\n \"context\",\n ];\n for (let key of Object.keys(operation)) {\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw newInvariantError(`illegal argument: %s`, key);\n }\n }\n\n return operation;\n}\n"],"names":[],"mappings":"AACA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,EAAE,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA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,CAAA,CAAA,CAAA,CAAwB,CAAC,CAAzB,CAAA,CAAA,CAA6B,CAAC,CAA9B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAuC,CAAC,EAAE;QACtC,CAAJ,EAAA,CAAQ,CAAR,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB,CAAC,CAAzB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgC,CAAC,CAAjC,CAAA,CAAoC,EAApC,EAAwC,CAAC,EAAE;YACrC,CAAN,CAAA,CAAA,CAAA,EAAY,CAAZ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,MAAsD,CAAtD,CAAA,EAA0D;QACtD;IACF;IAEA,CAAF,CAAA,CAAA,CAAA,CAAA,EAAS,CAAT,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB;AAClB;"}
|
|
@@ -218,9 +218,6 @@ export class LocalState {
|
|
|
218
218
|
return fieldFromCache;
|
|
219
219
|
}
|
|
220
220
|
if (!returnPartialData) {
|
|
221
|
-
if (__DEV__) {
|
|
222
|
-
__DEV__ && invariant.warn(51, resolverName);
|
|
223
|
-
}
|
|
224
221
|
return null;
|
|
225
222
|
}
|
|
226
223
|
});
|
|
@@ -286,13 +283,13 @@ export class LocalState {
|
|
|
286
283
|
if (result === undefined && !returnPartialData) {
|
|
287
284
|
if (__DEV__ && phase === "resolve") {
|
|
288
285
|
if (resolver && !onlyRunForcedResolvers) {
|
|
289
|
-
__DEV__ && invariant.warn(
|
|
286
|
+
__DEV__ && invariant.warn(51, resolverName);
|
|
290
287
|
}
|
|
291
288
|
else if (onlyRunForcedResolvers) {
|
|
292
|
-
__DEV__ && invariant.warn(
|
|
289
|
+
__DEV__ && invariant.warn(52, resolverName);
|
|
293
290
|
}
|
|
294
291
|
else {
|
|
295
|
-
__DEV__ && invariant.warn(
|
|
292
|
+
__DEV__ && invariant.warn(53, fieldName, rootValue);
|
|
296
293
|
}
|
|
297
294
|
}
|
|
298
295
|
result = null;
|
|
@@ -304,7 +301,7 @@ export class LocalState {
|
|
|
304
301
|
return this.resolveSubSelectedArray(field, true, result, execContext, path);
|
|
305
302
|
}
|
|
306
303
|
if (phase === "resolve" && !result.__typename) {
|
|
307
|
-
this.addError(newInvariantError(
|
|
304
|
+
this.addError(newInvariantError(54, result, resolverName), path, execContext, { resolver: resolverName });
|
|
308
305
|
return null;
|
|
309
306
|
}
|
|
310
307
|
return this.resolveSelectionSet(field.selectionSet, true, result, execContext, path);
|
|
@@ -415,7 +412,7 @@ export class LocalState {
|
|
|
415
412
|
},
|
|
416
413
|
FragmentSpread(spread, _, __, ___, ancestors) {
|
|
417
414
|
const fragment = fragmentMap[spread.name.value];
|
|
418
|
-
invariant(fragment,
|
|
415
|
+
invariant(fragment, 55, spread.name.value);
|
|
419
416
|
const { selectionsToResolve: fragmentSelections } = traverse(fragment);
|
|
420
417
|
if (fragmentSelections.size > 0) {
|
|
421
418
|
// Fragment for this spread contains @client directive (either directly or transitively)
|
|
@@ -474,7 +471,7 @@ function getExportedVariableName(directive) {
|
|
|
474
471
|
}
|
|
475
472
|
}
|
|
476
473
|
function validateCacheImplementation(cache) {
|
|
477
|
-
invariant(cache.fragmentMatches,
|
|
474
|
+
invariant(cache.fragmentMatches, 56);
|
|
478
475
|
}
|
|
479
476
|
function getCacheResultAtPath(diff, path) {
|
|
480
477
|
if (diff.result === null) {
|