@apollo/client 4.1.0-alpha.7 → 4.1.0-alpha.9
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 +51 -0
- package/__cjs/cache/core/cache.cjs +64 -24
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +47 -0
- package/__cjs/cache/core/types/Cache.d.cts +38 -0
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/entityStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.cjs +47 -0
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +47 -0
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +14 -5
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.d.cts +5 -0
- package/__cjs/cache/inmemory/readFromStore.cjs +3 -3
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/types.d.cts +1 -0
- package/__cjs/cache/inmemory/writeToStore.cjs +6 -5
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.d.cts +2 -1
- package/__cjs/core/ApolloClient.cjs +14 -14
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +21 -1
- package/__cjs/core/ObservableQuery.cjs +22 -8
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +1 -0
- package/__cjs/core/QueryInfo.cjs +3 -0
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryManager.cjs +27 -17
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +18 -2
- package/__cjs/invariantErrorCodes.cjs +39 -33
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +13 -1
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -1
- package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +1 -1
- package/__cjs/link/error/index.cjs +1 -1
- package/__cjs/link/error/index.cjs.map +1 -1
- package/__cjs/link/error/index.d.cts +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +1 -1
- package/__cjs/react/hooks/useLazyQuery.cjs +1 -0
- package/__cjs/react/hooks/useLazyQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.cjs +7 -4
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useSuspenseQuery.cjs +2 -0
- package/__cjs/react/hooks/useSuspenseQuery.cjs.map +1 -1
- package/__cjs/utilities/internal/checkDocument.cjs +2 -4
- package/__cjs/utilities/internal/checkDocument.cjs.map +1 -1
- package/__cjs/utilities/internal/constants.cjs +21 -0
- package/__cjs/utilities/internal/constants.cjs.map +1 -0
- package/__cjs/utilities/internal/constants.d.cts +18 -0
- package/__cjs/utilities/internal/index.cjs +6 -1
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +2 -0
- package/__cjs/utilities/internal/mapObservableFragment.cjs +27 -0
- package/__cjs/utilities/internal/mapObservableFragment.cjs.map +1 -0
- package/__cjs/utilities/internal/mapObservableFragment.d.cts +3 -0
- package/__cjs/utilities/internal/memoize.cjs +31 -0
- package/__cjs/utilities/internal/memoize.cjs.map +1 -0
- package/__cjs/utilities/internal/memoize.d.cts +8 -0
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.d.ts +47 -0
- package/cache/core/cache.js +65 -25
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +38 -0
- package/cache/core/types/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 +47 -0
- package/cache/inmemory/inMemoryCache.js +47 -0
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.d.ts +5 -0
- package/cache/inmemory/policies.js +14 -5
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +3 -3
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +1 -0
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +2 -1
- package/cache/inmemory/writeToStore.js +6 -5
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +21 -1
- package/core/ApolloClient.js +15 -15
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +1 -0
- package/core/ObservableQuery.js +23 -9
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.js +3 -0
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +18 -2
- package/core/QueryManager.js +28 -18
- package/core/QueryManager.js.map +1 -1
- package/invariantErrorCodes.js +39 -33
- package/link/client-awareness/ClientAwarenessLink.d.ts +1 -1
- package/link/client-awareness/ClientAwarenessLink.js +13 -1
- package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
- package/link/error/index.d.ts +1 -1
- package/link/error/index.js +1 -1
- package/link/error/index.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/package.json +1 -1
- package/react/hooks/useLazyQuery.js +2 -1
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useQuery.js +8 -5
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +2 -0
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.js +2 -1
- package/react/hooks-compiled/useLazyQuery.js.map +1 -1
- package/react/hooks-compiled/useQuery.js +9 -5
- package/react/hooks-compiled/useQuery.js.map +1 -1
- package/react/hooks-compiled/useSuspenseQuery.js +3 -1
- package/react/hooks-compiled/useSuspenseQuery.js.map +1 -1
- package/utilities/internal/checkDocument.js +2 -4
- package/utilities/internal/checkDocument.js.map +1 -1
- package/utilities/internal/constants.d.ts +18 -0
- package/utilities/internal/constants.js +18 -0
- package/utilities/internal/constants.js.map +1 -0
- package/utilities/internal/index.d.ts +2 -0
- package/utilities/internal/index.js +2 -0
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/mapObservableFragment.d.ts +3 -0
- package/utilities/internal/mapObservableFragment.js +24 -0
- package/utilities/internal/mapObservableFragment.js.map +1 -0
- package/utilities/internal/memoize.d.ts +8 -0
- package/utilities/internal/memoize.js +28 -0
- package/utilities/internal/memoize.js.map +1 -0
- package/version.js +1 -1
|
@@ -8,10 +8,11 @@ import type { ApolloLink } from "@apollo/client/link";
|
|
|
8
8
|
import type { LocalState } from "@apollo/client/local-state";
|
|
9
9
|
import type { MaybeMasked } from "@apollo/client/masking";
|
|
10
10
|
import { DocumentTransform } from "@apollo/client/utilities";
|
|
11
|
+
import { extensionsSymbol } from "@apollo/client/utilities/internal";
|
|
11
12
|
import type { ApolloClient } from "./ApolloClient.cjs";
|
|
12
13
|
import { NetworkStatus } from "./networkStatus.cjs";
|
|
13
14
|
import { ObservableQuery } from "./ObservableQuery.cjs";
|
|
14
|
-
import type { DefaultContext, InternalRefetchQueriesInclude, InternalRefetchQueriesMap, InternalRefetchQueriesOptions, OperationVariables, QueryNotification, SubscriptionObservable } from "./types.cjs";
|
|
15
|
+
import type { DataState, DefaultContext, InternalRefetchQueriesInclude, InternalRefetchQueriesMap, InternalRefetchQueriesOptions, OperationVariables, QueryNotification, SubscriptionObservable } from "./types.cjs";
|
|
15
16
|
import type { ErrorPolicy, MutationFetchPolicy, WatchQueryFetchPolicy } from "./watchQueryOptions.cjs";
|
|
16
17
|
interface MutationStoreValue {
|
|
17
18
|
mutation: DocumentNode;
|
|
@@ -62,6 +63,11 @@ interface QueryManagerOptions {
|
|
|
62
63
|
localState: LocalState | undefined;
|
|
63
64
|
incrementalHandler: Incremental.Handler;
|
|
64
65
|
}
|
|
66
|
+
export declare namespace QueryManager {
|
|
67
|
+
type Result<TData, TStates extends DataState<TData>["dataState"] = DataState<TData>["dataState"]> = ObservableQuery.Result<TData, TStates> & {
|
|
68
|
+
[extensionsSymbol]?: Record<string, unknown>;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
65
71
|
export declare class QueryManager {
|
|
66
72
|
defaultOptions: ApolloClient.DefaultOptions;
|
|
67
73
|
readonly client: ApolloClient;
|
|
@@ -130,12 +136,22 @@ export declare class QueryManager {
|
|
|
130
136
|
}>;
|
|
131
137
|
private getObservableFromLink;
|
|
132
138
|
private getResultsFromLink;
|
|
133
|
-
fetchObservableWithInfo<TData, TVariables extends OperationVariables>(options: ApolloClient.WatchQueryOptions<TData, TVariables>, { networkStatus, query, fetchQueryOperator, onCacheHit, observableQuery, }: {
|
|
139
|
+
fetchObservableWithInfo<TData, TVariables extends OperationVariables>(options: ApolloClient.WatchQueryOptions<TData, TVariables>, { networkStatus, query, fetchQueryOperator, onCacheHit, observableQuery, exposeExtensions, }: {
|
|
134
140
|
networkStatus?: NetworkStatus;
|
|
135
141
|
query?: DocumentNode;
|
|
136
142
|
fetchQueryOperator?: <T>(source: Observable<T>) => Observable<T>;
|
|
137
143
|
onCacheHit?: () => void;
|
|
138
144
|
observableQuery?: ObservableQuery<TData, TVariables> | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Attach `extensions` to the result object so that it is accessible by
|
|
147
|
+
* the calling code without being exposed to the emitted result.
|
|
148
|
+
*
|
|
149
|
+
* @remarks
|
|
150
|
+
* Used by e.g. `fetchMore` to add `extensions` to the `cache.writeQuery`
|
|
151
|
+
* call since it uses a `no-cache` query and cannot be written in
|
|
152
|
+
* `QueryInfo`.
|
|
153
|
+
*/
|
|
154
|
+
exposeExtensions?: boolean;
|
|
139
155
|
}): ObservableAndInfo<TData>;
|
|
140
156
|
refetchQueries<TResult>({ updateCache, include, optimistic, removeOptimistic, onQueryUpdated, }: InternalRefetchQueriesOptions<ApolloCache, TResult>): InternalRefetchQueriesMap<TResult>;
|
|
141
157
|
private noCacheWarningsByCause;
|
|
@@ -432,110 +432,116 @@ const client = new ApolloClient({
|
|
|
432
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."
|
|
433
433
|
},
|
|
434
434
|
|
|
435
|
-
|
|
435
|
+
80: {
|
|
436
|
+
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
437
|
+
condition: "fetchPolicy === \"standby\"",
|
|
438
|
+
message: "The `variablesUnknown` option can only be used together with a `standby` fetch policy."
|
|
439
|
+
},
|
|
440
|
+
|
|
441
|
+
82: {
|
|
436
442
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
437
443
|
condition: "this.options.fetchPolicy !== \"cache-only\"",
|
|
438
444
|
message: "Cannot execute `fetchMore` for 'cache-only' query '%s'. Please use a different fetch policy."
|
|
439
445
|
},
|
|
440
446
|
|
|
441
|
-
|
|
447
|
+
83: {
|
|
442
448
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
443
449
|
condition: "updateQuery",
|
|
444
450
|
message: "You must provide an `updateQuery` function when using `fetchMore` with a `no-cache` fetch policy."
|
|
445
451
|
},
|
|
446
452
|
|
|
447
|
-
|
|
453
|
+
87: {
|
|
448
454
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
449
455
|
message: "QueryManager stopped while query was in flight"
|
|
450
456
|
},
|
|
451
457
|
|
|
452
|
-
|
|
458
|
+
88: {
|
|
453
459
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
454
460
|
condition: "this.localState",
|
|
455
461
|
message: "Mutation '%s' contains `@client` fields with variables provided by `@export` but local state has not been configured."
|
|
456
462
|
},
|
|
457
463
|
|
|
458
|
-
|
|
464
|
+
89: {
|
|
459
465
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
460
466
|
message: "Store reset while query was in flight (not completed in link chain)"
|
|
461
467
|
},
|
|
462
468
|
|
|
463
|
-
|
|
469
|
+
92: {
|
|
464
470
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
465
471
|
condition: "!this.getDocumentInfo(query).hasClientExports || this.localState",
|
|
466
472
|
message: "Subscription '%s' contains `@client` fields with variables provided by `@export` 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: "this.localState",
|
|
472
478
|
message: "%s '%s' contains `@client` fields but local state has not been configured."
|
|
473
479
|
},
|
|
474
480
|
|
|
475
|
-
|
|
481
|
+
94: {
|
|
476
482
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
477
483
|
condition: "!hasIncrementalDirective",
|
|
478
484
|
message: "%s '%s' contains `@client` and `@defer` directives. These cannot be used together."
|
|
479
485
|
},
|
|
480
486
|
|
|
481
|
-
|
|
487
|
+
95: {
|
|
482
488
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
483
489
|
condition: "this.localState",
|
|
484
490
|
message: "Query '%s' contains `@client` fields with variables provided by `@export` 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: "this.localState",
|
|
490
496
|
message: "Query '%s' contains `@client` fields but local state has not been configured."
|
|
491
497
|
},
|
|
492
498
|
|
|
493
|
-
|
|
499
|
+
98: {
|
|
494
500
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
495
501
|
condition: "didEmitValue",
|
|
496
502
|
message: "The link chain completed without emitting a value. This is likely unintentional and should be updated to emit a value before completing."
|
|
497
503
|
},
|
|
498
504
|
|
|
499
|
-
|
|
505
|
+
99: {
|
|
500
506
|
file: "@apollo/client/__cjs/cache/inmemory/entityStore.cjs",
|
|
501
507
|
condition: "typeof dataId === \"string\"",
|
|
502
508
|
message: "store.merge expects a string ID"
|
|
503
509
|
},
|
|
504
510
|
|
|
505
|
-
|
|
511
|
+
102: {
|
|
506
512
|
file: "@apollo/client/__cjs/cache/inmemory/key-extractor.cjs",
|
|
507
513
|
condition: "extracted !== void 0",
|
|
508
514
|
message: `Missing field '%s' while extracting keyFields from %s`
|
|
509
515
|
},
|
|
510
516
|
|
|
511
|
-
|
|
517
|
+
103: {
|
|
512
518
|
file: "@apollo/client/__cjs/cache/inmemory/policies.cjs",
|
|
513
519
|
condition: "!old || old === which",
|
|
514
520
|
message: `Cannot change root %s __typename more than once`
|
|
515
521
|
},
|
|
516
522
|
|
|
517
|
-
|
|
523
|
+
106: {
|
|
518
524
|
file: "@apollo/client/__cjs/cache/inmemory/policies.cjs",
|
|
519
525
|
message: "Cannot automatically merge arrays"
|
|
520
526
|
},
|
|
521
527
|
|
|
522
|
-
|
|
528
|
+
107: {
|
|
523
529
|
file: "@apollo/client/__cjs/cache/inmemory/readFromStore.cjs",
|
|
524
530
|
message: `No fragment named %s`
|
|
525
531
|
},
|
|
526
532
|
|
|
527
|
-
|
|
533
|
+
108: {
|
|
528
534
|
file: "@apollo/client/__cjs/cache/inmemory/readFromStore.cjs",
|
|
529
535
|
condition: "!(0, utilities_1.isReference)(value)",
|
|
530
536
|
message: `Missing selection set for object of type %s returned for query field %s`
|
|
531
537
|
},
|
|
532
538
|
|
|
533
|
-
|
|
539
|
+
109: {
|
|
534
540
|
file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs",
|
|
535
541
|
message: `Could not identify object %s`
|
|
536
542
|
},
|
|
537
543
|
|
|
538
|
-
|
|
544
|
+
111: {
|
|
539
545
|
file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs",
|
|
540
546
|
message: `No fragment named %s`
|
|
541
547
|
}
|
|
@@ -547,7 +553,7 @@ exports.devDebug = {
|
|
|
547
553
|
message: `In client.refetchQueries, Promise.all promise rejected with error %o`
|
|
548
554
|
},
|
|
549
555
|
|
|
550
|
-
|
|
556
|
+
86: {
|
|
551
557
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
552
558
|
message: `Missing cache result fields: %o`
|
|
553
559
|
}
|
|
@@ -625,34 +631,34 @@ exports.devWarn = {
|
|
|
625
631
|
"If you are using a split link, ensure each branch contains a terminating link that handles the request."
|
|
626
632
|
},
|
|
627
633
|
|
|
628
|
-
|
|
634
|
+
81: {
|
|
629
635
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
630
636
|
|
|
631
637
|
message: `Called refetch(%o) for query %o, which does not declare a $variables variable.
|
|
632
638
|
Did you mean to call refetch(variables) instead of refetch({ variables })?`
|
|
633
639
|
},
|
|
634
640
|
|
|
635
|
-
|
|
641
|
+
85: {
|
|
636
642
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
637
643
|
message: "Cannot poll on 'cache-only' query '%s' and as such, polling is disabled. Please use a different fetch policy."
|
|
638
644
|
},
|
|
639
645
|
|
|
640
|
-
|
|
646
|
+
90: {
|
|
641
647
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
642
648
|
message: `Unknown query named "%s" requested in refetchQueries options.include array`
|
|
643
649
|
},
|
|
644
650
|
|
|
645
|
-
|
|
651
|
+
91: {
|
|
646
652
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
647
653
|
message: `Unknown anonymous query requested in refetchQueries options.include array`
|
|
648
654
|
},
|
|
649
655
|
|
|
650
|
-
|
|
656
|
+
96: {
|
|
651
657
|
file: "@apollo/client/__cjs/core/QueryManager.cjs",
|
|
652
658
|
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.'
|
|
653
659
|
},
|
|
654
660
|
|
|
655
|
-
|
|
661
|
+
100: {
|
|
656
662
|
file: "@apollo/client/__cjs/cache/inmemory/entityStore.cjs",
|
|
657
663
|
|
|
658
664
|
message: "cache.modify: You are trying to write a Reference that is not part of the store: %o\n" +
|
|
@@ -660,24 +666,24 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`
|
|
|
660
666
|
"`toReference(object, true)`"
|
|
661
667
|
},
|
|
662
668
|
|
|
663
|
-
|
|
669
|
+
101: {
|
|
664
670
|
file: "@apollo/client/__cjs/cache/inmemory/entityStore.cjs",
|
|
665
671
|
|
|
666
672
|
message: "cache.modify: Writing an array with a mix of both References and Objects will not result in the Objects being normalized correctly.\n" +
|
|
667
673
|
"Please convert the object instance %o to a Reference before writing it to the cache by calling `toReference(object, true)`."
|
|
668
674
|
},
|
|
669
675
|
|
|
670
|
-
|
|
676
|
+
104: {
|
|
671
677
|
file: "@apollo/client/__cjs/cache/inmemory/policies.cjs",
|
|
672
678
|
message: `Inferring subtype %s of supertype %s`
|
|
673
679
|
},
|
|
674
680
|
|
|
675
|
-
|
|
681
|
+
105: {
|
|
676
682
|
file: "@apollo/client/__cjs/cache/inmemory/policies.cjs",
|
|
677
683
|
message: `Undefined 'from' passed to readField with arguments %s`
|
|
678
684
|
},
|
|
679
685
|
|
|
680
|
-
|
|
686
|
+
112: {
|
|
681
687
|
file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs",
|
|
682
688
|
|
|
683
689
|
message: `Cache data may be lost when replacing the %s field of a %s object.
|
|
@@ -696,7 +702,7 @@ For more information about these options, please refer to the documentation:
|
|
|
696
702
|
`
|
|
697
703
|
},
|
|
698
704
|
|
|
699
|
-
|
|
705
|
+
113: {
|
|
700
706
|
file: "@apollo/client/__cjs/cache/core/cache.cjs",
|
|
701
707
|
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."
|
|
702
708
|
}
|
|
@@ -713,12 +719,12 @@ exports.devError = {
|
|
|
713
719
|
message: "The result of getSnapshot should be cached to avoid an infinite loop"
|
|
714
720
|
},
|
|
715
721
|
|
|
716
|
-
|
|
722
|
+
84: {
|
|
717
723
|
file: "@apollo/client/__cjs/core/ObservableQuery.cjs",
|
|
718
724
|
message: "Unhandled GraphQL subscription error"
|
|
719
725
|
},
|
|
720
726
|
|
|
721
|
-
|
|
727
|
+
110: {
|
|
722
728
|
file: "@apollo/client/__cjs/cache/inmemory/writeToStore.cjs",
|
|
723
729
|
message: `Missing field '%s' while writing result %o`
|
|
724
730
|
}
|
|
@@ -45,7 +45,7 @@ class ClientAwarenessLink extends link_1.ApolloLink {
|
|
|
45
45
|
{
|
|
46
46
|
const { name, version, transport = "headers", } = (0, internal_1.compact)({}, clientOptions.clientAwareness, options.clientAwareness, context.clientAwareness);
|
|
47
47
|
if (transport === "headers") {
|
|
48
|
-
operation.setContext(({ headers
|
|
48
|
+
operation.setContext(({ headers }) => {
|
|
49
49
|
return {
|
|
50
50
|
headers: (0, internal_1.compact)(
|
|
51
51
|
// setting these first so that they can be overridden by user-provided headers
|
|
@@ -69,6 +69,18 @@ class ClientAwarenessLink extends link_1.ApolloLink {
|
|
|
69
69
|
},
|
|
70
70
|
}, operation.extensions);
|
|
71
71
|
}
|
|
72
|
+
if (transport === "headers") {
|
|
73
|
+
operation.setContext(({ headers }) => {
|
|
74
|
+
return {
|
|
75
|
+
headers: (0, internal_1.compact)(
|
|
76
|
+
// setting these first so that they can be overridden by user-provided headers
|
|
77
|
+
{
|
|
78
|
+
"apollographql-library-name": "@apollo/client",
|
|
79
|
+
"apollographql-library-version": client.version,
|
|
80
|
+
}, headers),
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
}
|
|
72
84
|
}
|
|
73
85
|
return forward(operation);
|
|
74
86
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientAwarenessLink.cjs","sources":["../../../../src/link/client-awareness/ClientAwarenessLink.ts"],"sourcesContent":["import { ApolloLink } from \"@apollo/client/link\";\nimport { compact } from \"@apollo/client/utilities/internal\";\n\nexport declare namespace ClientAwarenessLink {\n /**\n * Options passed to `ClientAwarenessLink` through [request context](https://apollographql.com/docs/react/api/link/introduction#managing-context). Previous\n * non-terminating links in the link chain also can set these values to\n * customize the behavior of `ClientAwarenessLink` for each operation.\n *\n * > [!NOTE]\n * > Some of these values can also be provided to the `ClientAwarenessLink`\n * > constructor. If a value is provided to both, the value in `context` takes\n * > precedence.\n */\n export interface ContextOptions {\n /** {@inheritDoc @apollo/client/link/client-awareness!ClientAwarenessLink.Options#clientAwareness:member} */\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n }\n\n export interface ClientAwarenessOptions {\n /**\n * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This option can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.\n */\n name?: string;\n /**\n * A custom version that identifies the current version of this particular client (e.g., `1.2`). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client.\n *\n * This option can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.\n */\n version?: string;\n /**\n * Determines how `name` and `version` are sent in outgoing requests.\n *\n * If `name` and `version` are not provided, this option will be ignored.\n * (These options can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.)\n *\n * - If set to `\"headers\"`, `name` and `version` will be sent in the request headers as `apollographql-client-name` and `apollographql-client-version`, respectively.\n * - If set to `false`, `name` and `version` will not be included in outgoing requests.\n *\n * @defaultValue \"headers\"\n */\n transport?: \"headers\" | false;\n }\n export interface EnhancedClientAwarenessOptions {\n /**\n * Determines how the the version information of Apollo Client is sent in outgoing requests.\n *\n * - If set to `\"extensions\"`, library `name` and `version` will be sent in an object in the request extensions as `clientLibrary`.\n * - If set to `false`, library name and version will not be included in outgoing requests.\n *\n * @defaultValue \"extensions\"\n */\n transport?: \"extensions\" | false;\n }\n\n export interface Options {\n /**\n * Configures the \"client awareness\" feature.\n * This feature allows you to identify distinct applications in Apollo Studio\n * and Apollo Server logs (and other monitoring or analytics tools) by adding\n * information about the your application to outgoing requests.\n */\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n /**\n * Configures the \"enhanced client awareness\" feature.\n * This feature allows you to identify the version of the Apollo Client library\n * used in your application in Apollo Studio (and other monitoring or analytics tools)\n * by adding information about the Apollo Client library to outgoing requests.\n */\n enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;\n }\n}\n\n/**\n * `ClientAwarenessLink` provides support for providing client awareness\n * features.\n *\n * @remarks\n *\n * Client awareness adds identifying information about the client to HTTP\n * requests for use with metrics reporting tools, such as [Apollo GraphOS](https://apollographql.com/docs/graphos/platform).\n * It is included in the functionality of [`HttpLink`](https://apollographql.com/docs/react/api/link/apollo-link-http) by default.\n *\n * Client awareness distinguishes between user-provided client awareness\n * (provided by the `clientAwareness` option) and enhanced client awareness\n * (provided by the `enhancedClientAwareness` option). User-provided client\n * awareness enables you to set a customized client name and version for\n * identification in metrics reporting tools. Enhanced client awareness enables\n * the identification of the Apollo Client package name and version.\n *\n * @example\n *\n * ```ts\n * import { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\n *\n * const link = new ClientAwarenessLink({\n * clientAwareness: {\n * name: \"My Client\",\n * version: \"1\",\n * },\n * enhancedClientAwareness: {\n * transport: \"extensions\",\n * },\n * });\n * ```\n */\nexport class ClientAwarenessLink extends ApolloLink {\n constructor(options: ClientAwarenessLink.Options = {}) {\n super((operation, forward) => {\n const client = operation.client;\n\n const clientOptions = client[\"queryManager\"].clientOptions;\n const context = operation.getContext();\n {\n const {\n name,\n version,\n transport = \"headers\",\n } = compact(\n {},\n clientOptions.clientAwareness,\n options.clientAwareness,\n context.clientAwareness\n );\n\n if (transport === \"headers\") {\n operation.setContext(({ headers, extensions }) => {\n return {\n headers: compact(\n // setting these first so that they can be overridden by user-provided headers\n {\n \"apollographql-client-name\": name,\n \"apollographql-client-version\": version,\n },\n headers\n ),\n };\n });\n }\n }\n {\n const { transport = \"extensions\" } = compact(\n {},\n clientOptions.enhancedClientAwareness,\n options.enhancedClientAwareness\n );\n if (transport === \"extensions\") {\n operation.extensions = compact(\n // setting these first so that it can be overridden by user-provided extensions\n {\n clientLibrary: {\n name: \"@apollo/client\",\n version: client.version,\n },\n },\n operation.extensions\n );\n }\n }\n\n return forward(operation);\n });\n }\n}\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,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;AACA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AA4EA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCA,CAAA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,CAAA,CAAA,CAAA,CAAoB,CAAC,CAArB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA8B,CAAC;QAC3B,CAAC,CAAC;IACJ;AACF;AAzDA,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,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
1
|
+
{"version":3,"file":"ClientAwarenessLink.cjs","sources":["../../../../src/link/client-awareness/ClientAwarenessLink.ts"],"sourcesContent":["import { ApolloLink } from \"@apollo/client/link\";\nimport { compact } from \"@apollo/client/utilities/internal\";\n\nexport declare namespace ClientAwarenessLink {\n /**\n * Options passed to `ClientAwarenessLink` through [request context](https://apollographql.com/docs/react/api/link/introduction#managing-context). Previous\n * non-terminating links in the link chain also can set these values to\n * customize the behavior of `ClientAwarenessLink` for each operation.\n *\n * > [!NOTE]\n * > Some of these values can also be provided to the `ClientAwarenessLink`\n * > constructor. If a value is provided to both, the value in `context` takes\n * > precedence.\n */\n export interface ContextOptions {\n /** {@inheritDoc @apollo/client/link/client-awareness!ClientAwarenessLink.Options#clientAwareness:member} */\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n }\n\n export interface ClientAwarenessOptions {\n /**\n * A custom name (e.g., `iOS`) that identifies this particular client among your set of clients. Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This option can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.\n */\n name?: string;\n /**\n * A custom version that identifies the current version of this particular client (e.g., `1.2`). Apollo Server and Apollo Studio use this property as part of the [client awareness](https://www.apollographql.com/docs/apollo-server/monitoring/metrics#identifying-distinct-clients) feature.\n *\n * This is **not** the version of Apollo Client that you are using, but rather any version string that helps you differentiate between versions of your client.\n *\n * This option can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.\n */\n version?: string;\n /**\n * Determines how `name` and `version` are sent in outgoing requests.\n *\n * If `name` and `version` are not provided, this option will be ignored.\n * (These options can either be set as part of the Apollo Client constructor call or when manually constructing a `HttpLink`, `BatchHttpLink` or `ClientAwarenessLink`.)\n *\n * - If set to `\"headers\"`, `name` and `version` will be sent in the request headers as `apollographql-client-name` and `apollographql-client-version`, respectively.\n * - If set to `false`, `name` and `version` will not be included in outgoing requests.\n *\n * @defaultValue \"headers\"\n */\n transport?: \"headers\" | false;\n }\n export interface EnhancedClientAwarenessOptions {\n /**\n * Determines how the the version information of Apollo Client is sent in outgoing requests.\n *\n * - If set to `\"extensions\"`, library `name` and `version` will be sent in an object in the request extensions as `clientLibrary`.\n * - If set to `false`, library name and version will not be included in outgoing requests.\n *\n * @defaultValue \"extensions\"\n */\n transport?: \"headers\" | \"extensions\" | false;\n }\n\n export interface Options {\n /**\n * Configures the \"client awareness\" feature.\n * This feature allows you to identify distinct applications in Apollo Studio\n * and Apollo Server logs (and other monitoring or analytics tools) by adding\n * information about the your application to outgoing requests.\n */\n clientAwareness?: ClientAwarenessLink.ClientAwarenessOptions;\n /**\n * Configures the \"enhanced client awareness\" feature.\n * This feature allows you to identify the version of the Apollo Client library\n * used in your application in Apollo Studio (and other monitoring or analytics tools)\n * by adding information about the Apollo Client library to outgoing requests.\n */\n enhancedClientAwareness?: ClientAwarenessLink.EnhancedClientAwarenessOptions;\n }\n}\n\n/**\n * `ClientAwarenessLink` provides support for providing client awareness\n * features.\n *\n * @remarks\n *\n * Client awareness adds identifying information about the client to HTTP\n * requests for use with metrics reporting tools, such as [Apollo GraphOS](https://apollographql.com/docs/graphos/platform).\n * It is included in the functionality of [`HttpLink`](https://apollographql.com/docs/react/api/link/apollo-link-http) by default.\n *\n * Client awareness distinguishes between user-provided client awareness\n * (provided by the `clientAwareness` option) and enhanced client awareness\n * (provided by the `enhancedClientAwareness` option). User-provided client\n * awareness enables you to set a customized client name and version for\n * identification in metrics reporting tools. Enhanced client awareness enables\n * the identification of the Apollo Client package name and version.\n *\n * @example\n *\n * ```ts\n * import { ClientAwarenessLink } from \"@apollo/client/link/client-awareness\";\n *\n * const link = new ClientAwarenessLink({\n * clientAwareness: {\n * name: \"My Client\",\n * version: \"1\",\n * },\n * enhancedClientAwareness: {\n * transport: \"extensions\",\n * },\n * });\n * ```\n */\nexport class ClientAwarenessLink extends ApolloLink {\n constructor(options: ClientAwarenessLink.Options = {}) {\n super((operation, forward) => {\n const client = operation.client;\n\n const clientOptions = client[\"queryManager\"].clientOptions;\n const context = operation.getContext();\n {\n const {\n name,\n version,\n transport = \"headers\",\n } = compact(\n {},\n clientOptions.clientAwareness,\n options.clientAwareness,\n context.clientAwareness\n );\n\n if (transport === \"headers\") {\n operation.setContext(({ headers }) => {\n return {\n headers: compact(\n // setting these first so that they can be overridden by user-provided headers\n {\n \"apollographql-client-name\": name,\n \"apollographql-client-version\": version,\n },\n headers\n ),\n };\n });\n }\n }\n {\n const { transport = \"extensions\" } = compact(\n {},\n clientOptions.enhancedClientAwareness,\n options.enhancedClientAwareness\n );\n if (transport === \"extensions\") {\n operation.extensions = compact(\n // setting these first so that it can be overridden by user-provided extensions\n {\n clientLibrary: {\n name: \"@apollo/client\",\n version: client.version,\n },\n },\n operation.extensions\n );\n }\n\n if (transport === \"headers\") {\n operation.setContext(({ headers }) => {\n return {\n headers: compact(\n // setting these first so that they can be overridden by user-provided headers\n {\n \"apollographql-library-name\": \"@apollo/client\",\n \"apollographql-library-version\": client.version,\n },\n headers\n ),\n };\n });\n }\n }\n\n return forward(operation);\n });\n }\n}\n"],"names":[],"mappings":";;;AAAA,CAAA,CAAA,CAAA,CAAA,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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -19,7 +19,7 @@ function onError(errorHandler) {
|
|
|
19
19
|
* @remarks
|
|
20
20
|
*
|
|
21
21
|
* This link is used after the GraphQL operation completes and execution is
|
|
22
|
-
* moving back up your [link chain](https://apollographql.com/docs/react/introduction#handling-a-response). The `errorHandler` function should
|
|
22
|
+
* moving back up your [link chain](https://apollographql.com/docs/react/api/link/introduction#handling-a-response). The `errorHandler` function should
|
|
23
23
|
* not return a value unless you want to [retry the operation](https://apollographql.com/docs/react/data/error-handling#retrying-operations).
|
|
24
24
|
*
|
|
25
25
|
* For more information on the types of errors that might be encountered, see
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/link/error/index.ts"],"sourcesContent":["import type { Subscription } from \"rxjs\";\nimport { Observable } from \"rxjs\";\n\nimport type { ErrorLike } from \"@apollo/client\";\nimport {\n CombinedGraphQLErrors,\n graphQLResultHasProtocolErrors,\n PROTOCOL_ERRORS_SYMBOL,\n toErrorLike,\n} from \"@apollo/client/errors\";\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace ErrorLink {\n // Using a different namespace name to avoid clash with\n // `ApolloLink.DocumentationTypes`\n export namespace ErrorLinkDocumentationTypes {\n /**\n * Callback that is called by `ErrorLink` when an error occurs from a\n * downstream link in link chain.\n *\n * @param options - The options object provided by `ErrorLink` to the error\n * handler when an error occurs.\n */\n export function ErrorHandler(\n options: ErrorHandlerOptions\n ): Observable<ApolloLink.Result> | void;\n }\n\n /** {@inheritDoc @apollo/client/link/error!ErrorLink.ErrorLinkDocumentationTypes.ErrorHandler:function(1)} */\n export interface ErrorHandler {\n (options: ErrorHandlerOptions): Observable<ApolloLink.Result> | void;\n }\n\n /**\n * The object provided to the `ErrorHandler` callback function.\n */\n export interface ErrorHandlerOptions {\n /**\n * The error that occurred during the operation execution. This can be a\n * `CombinedGraphQLErrors` instance (for GraphQL errors) or another error\n * type (for network errors).\n *\n * Use `CombinedGraphQLErrors.is(error)` to check if it's a GraphQL error with an `errors` array.\n */\n error: ErrorLike;\n /**\n * The raw GraphQL result from the server (if available), which may include\n * partial data alongside errors.\n */\n result?: ApolloLink.Result;\n\n /** The details of the GraphQL operation that produced an error. */\n operation: ApolloLink.Operation;\n\n /**\n * A function that calls the next link in the link chain. Calling\n * `return forward(operation)` in your `ErrorLink` callback\n * [retries the operation](../../data/error-handling#retrying-operations), returning a new observable for the\n * upstream link to subscribe to.\n */\n forward: ApolloLink.ForwardFunction;\n }\n}\n\n/**\n * @deprecated\n * Use `ErrorLink` from `@apollo/client/link/error` instead.\n */\nexport function onError(errorHandler: ErrorLink.ErrorHandler) {\n return new ErrorLink(errorHandler);\n}\n\n/**\n * Use the `ErrorLink` to perform custom logic when a [GraphQL or network error](https://apollographql.com/docs/react/data/error-handling)\n * occurs.\n *\n * @remarks\n *\n * This link is used after the GraphQL operation completes and execution is\n * moving back up your [link chain](https://apollographql.com/docs/react/introduction#handling-a-response). The `errorHandler` function should\n * not return a value unless you want to [retry the operation](https://apollographql.com/docs/react/data/error-handling#retrying-operations).\n *\n * For more information on the types of errors that might be encountered, see\n * the guide on [error handling](https://apollographql.com/docs/react/data/error-handling).\n *\n * @example\n *\n * ```ts\n * import { ErrorLink } from \"@apollo/client/link/error\";\n * import {\n * CombinedGraphQLErrors,\n * CombinedProtocolErrors,\n * } from \"@apollo/client/errors\";\n *\n * // Log any GraphQL errors, protocol errors, or network error that occurred\n * const errorLink = new ErrorLink(({ error, operation }) => {\n * if (CombinedGraphQLErrors.is(error)) {\n * error.errors.forEach(({ message, locations, path }) =>\n * console.log(\n * `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`\n * )\n * );\n * } else if (CombinedProtocolErrors.is(error)) {\n * error.errors.forEach(({ message, extensions }) =>\n * console.log(\n * `[Protocol error]: Message: ${message}, Extensions: ${JSON.stringify(\n * extensions\n * )}`\n * )\n * );\n * } else {\n * console.error(`[Network error]: ${error}`);\n * }\n * });\n * ```\n */\nexport class ErrorLink extends ApolloLink {\n constructor(errorHandler: ErrorLink.ErrorHandler) {\n super((operation, forward) => {\n return new Observable((observer) => {\n let sub: Subscription | undefined;\n let retriedSub: Subscription | undefined;\n let retriedResult: ReturnType<ErrorLink.ErrorHandler>;\n\n try {\n sub = forward(operation).subscribe({\n next: (result) => {\n const handler =\n operation.client[\"queryManager\"].incrementalHandler;\n const errors =\n handler.isIncrementalResult(result) ?\n handler.extractErrors(result)\n : result.errors;\n if (errors) {\n retriedResult = errorHandler({\n error: new CombinedGraphQLErrors(result, errors),\n result,\n operation,\n forward,\n });\n } else if (graphQLResultHasProtocolErrors(result)) {\n retriedResult = errorHandler({\n error: result.extensions[PROTOCOL_ERRORS_SYMBOL],\n result,\n operation,\n forward,\n });\n }\n\n retriedSub = retriedResult?.subscribe(observer);\n\n if (!retriedSub) {\n observer.next(result);\n }\n },\n error: (error) => {\n retriedResult = errorHandler({\n operation,\n error: toErrorLike(error),\n forward,\n });\n retriedSub = retriedResult?.subscribe(observer);\n\n if (!retriedSub) {\n observer.error(error);\n }\n },\n complete: () => {\n // disable the previous sub from calling complete on observable\n // if retry is in flight.\n if (!retriedResult) {\n observer.complete();\n }\n },\n });\n } catch (e) {\n errorHandler({ error: toErrorLike(e), operation, forward });\n observer.error(e);\n }\n\n return () => {\n if (sub) sub.unsubscribe();\n if (retriedSub) retriedSub.unsubscribe();\n };\n });\n });\n }\n}\n"],"names":[],"mappings":";;;AAoEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EA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,CAAA,CAAA,CAAwB,CAAC,CAAC,CAAC;gBACnB;gBAEA,CAAR,CAAA,CAAA,CAAA,CAAA,EAAe,CAAf,EAAkB,CAAlB,EAAA;oBACU,CAAV,EAAA,CAAc,CAAd,CAAA,CAAiB;wBAAE,CAAnB,CAAA,CAAsB,CAAC,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkC,CAAlC,CAAoC;oBAC1B,CAAV,EAAA,CAAc,CAAd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB;wBAAE,CAA1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoC,CAAC,CAArC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgD,CAAhD,CAAkD;gBAC1C,CAAC;YACH,CAAC,CAAC;QACJ,CAAC,CAAC;IACJ;AACF;AAvEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/link/error/index.ts"],"sourcesContent":["import type { Subscription } from \"rxjs\";\nimport { Observable } from \"rxjs\";\n\nimport type { ErrorLike } from \"@apollo/client\";\nimport {\n CombinedGraphQLErrors,\n graphQLResultHasProtocolErrors,\n PROTOCOL_ERRORS_SYMBOL,\n toErrorLike,\n} from \"@apollo/client/errors\";\nimport { ApolloLink } from \"@apollo/client/link\";\n\nexport declare namespace ErrorLink {\n // Using a different namespace name to avoid clash with\n // `ApolloLink.DocumentationTypes`\n export namespace ErrorLinkDocumentationTypes {\n /**\n * Callback that is called by `ErrorLink` when an error occurs from a\n * downstream link in link chain.\n *\n * @param options - The options object provided by `ErrorLink` to the error\n * handler when an error occurs.\n */\n export function ErrorHandler(\n options: ErrorHandlerOptions\n ): Observable<ApolloLink.Result> | void;\n }\n\n /** {@inheritDoc @apollo/client/link/error!ErrorLink.ErrorLinkDocumentationTypes.ErrorHandler:function(1)} */\n export interface ErrorHandler {\n (options: ErrorHandlerOptions): Observable<ApolloLink.Result> | void;\n }\n\n /**\n * The object provided to the `ErrorHandler` callback function.\n */\n export interface ErrorHandlerOptions {\n /**\n * The error that occurred during the operation execution. This can be a\n * `CombinedGraphQLErrors` instance (for GraphQL errors) or another error\n * type (for network errors).\n *\n * Use `CombinedGraphQLErrors.is(error)` to check if it's a GraphQL error with an `errors` array.\n */\n error: ErrorLike;\n /**\n * The raw GraphQL result from the server (if available), which may include\n * partial data alongside errors.\n */\n result?: ApolloLink.Result;\n\n /** The details of the GraphQL operation that produced an error. */\n operation: ApolloLink.Operation;\n\n /**\n * A function that calls the next link in the link chain. Calling\n * `return forward(operation)` in your `ErrorLink` callback\n * [retries the operation](../../data/error-handling#retrying-operations), returning a new observable for the\n * upstream link to subscribe to.\n */\n forward: ApolloLink.ForwardFunction;\n }\n}\n\n/**\n * @deprecated\n * Use `ErrorLink` from `@apollo/client/link/error` instead.\n */\nexport function onError(errorHandler: ErrorLink.ErrorHandler) {\n return new ErrorLink(errorHandler);\n}\n\n/**\n * Use the `ErrorLink` to perform custom logic when a [GraphQL or network error](https://apollographql.com/docs/react/data/error-handling)\n * occurs.\n *\n * @remarks\n *\n * This link is used after the GraphQL operation completes and execution is\n * moving back up your [link chain](https://apollographql.com/docs/react/api/link/introduction#handling-a-response). The `errorHandler` function should\n * not return a value unless you want to [retry the operation](https://apollographql.com/docs/react/data/error-handling#retrying-operations).\n *\n * For more information on the types of errors that might be encountered, see\n * the guide on [error handling](https://apollographql.com/docs/react/data/error-handling).\n *\n * @example\n *\n * ```ts\n * import { ErrorLink } from \"@apollo/client/link/error\";\n * import {\n * CombinedGraphQLErrors,\n * CombinedProtocolErrors,\n * } from \"@apollo/client/errors\";\n *\n * // Log any GraphQL errors, protocol errors, or network error that occurred\n * const errorLink = new ErrorLink(({ error, operation }) => {\n * if (CombinedGraphQLErrors.is(error)) {\n * error.errors.forEach(({ message, locations, path }) =>\n * console.log(\n * `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`\n * )\n * );\n * } else if (CombinedProtocolErrors.is(error)) {\n * error.errors.forEach(({ message, extensions }) =>\n * console.log(\n * `[Protocol error]: Message: ${message}, Extensions: ${JSON.stringify(\n * extensions\n * )}`\n * )\n * );\n * } else {\n * console.error(`[Network error]: ${error}`);\n * }\n * });\n * ```\n */\nexport class ErrorLink extends ApolloLink {\n constructor(errorHandler: ErrorLink.ErrorHandler) {\n super((operation, forward) => {\n return new Observable((observer) => {\n let sub: Subscription | undefined;\n let retriedSub: Subscription | undefined;\n let retriedResult: ReturnType<ErrorLink.ErrorHandler>;\n\n try {\n sub = forward(operation).subscribe({\n next: (result) => {\n const handler =\n operation.client[\"queryManager\"].incrementalHandler;\n const errors =\n handler.isIncrementalResult(result) ?\n handler.extractErrors(result)\n : result.errors;\n if (errors) {\n retriedResult = errorHandler({\n error: new CombinedGraphQLErrors(result, errors),\n result,\n operation,\n forward,\n });\n } else if (graphQLResultHasProtocolErrors(result)) {\n retriedResult = errorHandler({\n error: result.extensions[PROTOCOL_ERRORS_SYMBOL],\n result,\n operation,\n forward,\n });\n }\n\n retriedSub = retriedResult?.subscribe(observer);\n\n if (!retriedSub) {\n observer.next(result);\n }\n },\n error: (error) => {\n retriedResult = errorHandler({\n operation,\n error: toErrorLike(error),\n forward,\n });\n retriedSub = retriedResult?.subscribe(observer);\n\n if (!retriedSub) {\n observer.error(error);\n }\n },\n complete: () => {\n // disable the previous sub from calling complete on observable\n // if retry is in flight.\n if (!retriedResult) {\n observer.complete();\n }\n },\n });\n } catch (e) {\n errorHandler({ error: toErrorLike(e), operation, forward });\n observer.error(e);\n }\n\n return () => {\n if (sub) sub.unsubscribe();\n if (retriedSub) retriedSub.unsubscribe();\n };\n });\n });\n }\n}\n"],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A,CAAA,CAAA,CAAA,EAAA,CAAoE,CAAC;oBAC3D,CAAV,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkB,CAAC,CAAnB,CAAA,CAAA,CAAA,CAAwB,CAAC,CAAC,CAAC;gBACnB;gBAEA,CAAR,CAAA,CAAA,CAAA,CAAA,EAAe,CAAf,EAAkB,CAAlB,EAAA;oBACU,CAAV,EAAA,CAAc,CAAd,CAAA,CAAiB;wBAAE,CAAnB,CAAA,CAAsB,CAAC,CAAvB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkC,CAAlC,CAAoC;oBAC1B,CAAV,EAAA,CAAc,CAAd,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAwB;wBAAE,CAA1B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAoC,CAAC,CAArC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgD,CAAhD,CAAkD;gBAC1C,CAAC;YACH,CAAC,CAAC;QACJ,CAAC,CAAC;IACJ;AACF;AAvEA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -62,7 +62,7 @@ export declare function onError(errorHandler: ErrorLink.ErrorHandler): ErrorLink
|
|
|
62
62
|
* @remarks
|
|
63
63
|
*
|
|
64
64
|
* This link is used after the GraphQL operation completes and execution is
|
|
65
|
-
* moving back up your [link chain](https://apollographql.com/docs/react/introduction#handling-a-response). The `errorHandler` function should
|
|
65
|
+
* moving back up your [link chain](https://apollographql.com/docs/react/api/link/introduction#handling-a-response). The `errorHandler` function should
|
|
66
66
|
* not return a value unless you want to [retry the operation](https://apollographql.com/docs/react/data/error-handling#retrying-operations).
|
|
67
67
|
*
|
|
68
68
|
* For more information on the types of errors that might be encountered, see
|
|
@@ -35,7 +35,7 @@ async function* consumeMultipartBody(response) {
|
|
|
35
35
|
(?:;|$) # match a semicolon or end of string
|
|
36
36
|
*/
|
|
37
37
|
/;\s*boundary=(?:'([^']+)'|"([^"]+)"|([^"'].+?))\s*(?:;|$)/i);
|
|
38
|
-
const boundary = "\r\n--" + (match
|
|
38
|
+
const boundary = "\r\n--" + (match ? match[1] ?? match[2] ?? match[3] ?? "-" : "-");
|
|
39
39
|
let buffer = "";
|
|
40
40
|
(0, invariant_1.invariant)(response.body && typeof response.body.getReader === "function", 62);
|
|
41
41
|
const stream = response.body;
|