@apollo/client 4.3.0-alpha.6 → 4.3.0-alpha.8
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 +24 -0
- package/__cjs/cache/core/cache.cjs +25 -1
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +19 -1
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/inMemoryCache.cjs +10 -0
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +5 -1
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +5 -5
- package/__cjs/cache/inmemory/readFromStore.cjs +3 -3
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/core/ApolloClient.cjs +14 -14
- package/__cjs/core/ObservableQuery.cjs +173 -61
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +3 -6
- package/__cjs/core/QueryInfo.cjs +11 -125
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +0 -24
- package/__cjs/core/QueryManager.cjs +23 -15
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/RefetchEventManager.cjs +3 -3
- package/__cjs/incremental/handlers/graphql17Alpha9.cjs +1 -1
- package/__cjs/incremental/handlers/notImplemented.cjs +1 -1
- package/__cjs/invariantErrorCodes.cjs +141 -115
- package/__cjs/link/core/ApolloLink.cjs +3 -3
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +2 -2
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs.map +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 +11 -11
- package/__cjs/masking/maskDefinition.cjs +2 -2
- package/__cjs/masking/maskFragment.cjs +2 -2
- package/__cjs/masking/maskOperation.cjs +1 -1
- package/__cjs/masking/utils.cjs +3 -3
- package/__cjs/react/context/ApolloContext.cjs +1 -1
- package/__cjs/react/context/ApolloProvider.cjs +1 -1
- package/__cjs/react/hooks/internal/validateSuspenseHookOptions.cjs +2 -2
- package/__cjs/react/hooks/useApolloClient.cjs +1 -1
- package/__cjs/react/hooks/useLazyQuery.cjs +2 -2
- package/__cjs/react/hooks/useLoadableQuery.cjs +2 -2
- package/__cjs/react/hooks/useSubscription.cjs +1 -1
- package/__cjs/react/hooks/useSyncExternalStore.cjs +1 -1
- package/__cjs/react/internal/cache/QueryReference.cjs +1 -1
- package/__cjs/react/ssr/prerenderStatic.cjs +2 -2
- package/__cjs/testing/core/mocking/mockLink.cjs +4 -4
- package/__cjs/utilities/graphql/DocumentTransform.cjs +1 -1
- package/__cjs/utilities/internal/capitalize.cjs +12 -0
- package/__cjs/utilities/internal/capitalize.cjs.map +1 -0
- package/__cjs/utilities/internal/capitalize.d.cts +7 -0
- package/__cjs/utilities/internal/coerceScalarFieldsToParsed.cjs +69 -0
- package/__cjs/utilities/internal/coerceScalarFieldsToParsed.cjs.map +1 -0
- package/__cjs/utilities/internal/coerceScalarFieldsToParsed.d.cts +9 -0
- package/__cjs/utilities/internal/getFragmentDefinition.cjs +3 -3
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs +1 -1
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +2 -2
- package/__cjs/utilities/internal/getMainDefinition.cjs +1 -1
- package/__cjs/utilities/internal/getQueryDefinition.cjs +1 -1
- package/__cjs/utilities/internal/index.cjs +6 -2
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +2 -0
- package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +1 -1
- package/__cjs/utilities/internal/shouldInclude.cjs +4 -4
- package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +1 -1
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.d.ts +19 -1
- package/cache/core/cache.js +26 -2
- package/cache/core/cache.js.map +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/inMemoryCache.d.ts +5 -1
- package/cache/inmemory/inMemoryCache.js +10 -0
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +5 -5
- package/cache/inmemory/readFromStore.js +3 -3
- package/cache/inmemory/writeToStore.js +4 -4
- package/core/ApolloClient.js +14 -14
- package/core/ObservableQuery.d.ts +3 -6
- package/core/ObservableQuery.js +169 -61
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +1 -25
- package/core/QueryInfo.js +11 -125
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.js +24 -16
- package/core/QueryManager.js.map +1 -1
- package/core/RefetchEventManager.js +3 -3
- package/incremental/handlers/graphql17Alpha9.js +1 -1
- package/incremental/handlers/notImplemented.js +1 -1
- package/invariantErrorCodes.js +141 -115
- package/link/core/ApolloLink.js +3 -3
- package/link/http/checkFetcher.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js +2 -2
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/ws/index.js +1 -1
- package/local-state/LocalState.js +11 -11
- package/masking/maskDefinition.js +2 -2
- package/masking/maskFragment.js +2 -2
- package/masking/maskOperation.js +1 -1
- package/masking/utils.js +3 -3
- package/package.json +1 -1
- package/react/context/ApolloContext.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/hooks/internal/validateSuspenseHookOptions.js +2 -2
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useLazyQuery.js +2 -2
- package/react/hooks/useLoadableQuery.js +2 -2
- package/react/hooks/useSubscription.js +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/hooks-compiled/internal/validateSuspenseHookOptions.js +2 -2
- package/react/hooks-compiled/useApolloClient.js +1 -1
- package/react/hooks-compiled/useLazyQuery.js +2 -2
- package/react/hooks-compiled/useLoadableQuery.js +2 -2
- package/react/hooks-compiled/useSubscription.js +1 -1
- package/react/hooks-compiled/useSyncExternalStore.js +1 -1
- package/react/internal/cache/QueryReference.js +1 -1
- package/react/ssr/prerenderStatic.js +2 -2
- package/testing/core/mocking/mockLink.js +4 -4
- package/utilities/graphql/DocumentTransform.js +1 -1
- package/utilities/internal/capitalize.d.ts +7 -0
- package/utilities/internal/capitalize.js +9 -0
- package/utilities/internal/capitalize.js.map +1 -0
- package/utilities/internal/coerceScalarFieldsToParsed.d.ts +9 -0
- package/utilities/internal/coerceScalarFieldsToParsed.js +66 -0
- package/utilities/internal/coerceScalarFieldsToParsed.js.map +1 -0
- package/utilities/internal/getFragmentDefinition.js +3 -3
- package/utilities/internal/getFragmentFromSelection.js +1 -1
- package/utilities/internal/getFragmentFromSelection.js.map +1 -1
- package/utilities/internal/getFragmentQueryDocument.js +2 -2
- package/utilities/internal/getMainDefinition.js +1 -1
- package/utilities/internal/getQueryDefinition.js +1 -1
- 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/removeDirectivesFromDocument.js +1 -1
- package/utilities/internal/shouldInclude.js +4 -4
- package/utilities/internal/valueToObjectRepresentation.js +1 -1
- package/version.js +1 -1
|
@@ -106,7 +106,7 @@ class QueryManager {
|
|
|
106
106
|
*/
|
|
107
107
|
stop() {
|
|
108
108
|
this.obsQueries.forEach((oq) => oq.stop());
|
|
109
|
-
this.cancelPendingFetches((0, invariant_1.newInvariantError)(
|
|
109
|
+
this.cancelPendingFetches((0, invariant_1.newInvariantError)(92));
|
|
110
110
|
}
|
|
111
111
|
cancelPendingFetches(error) {
|
|
112
112
|
this.fetchCancelFns.forEach((cancel) => cancel(error));
|
|
@@ -121,7 +121,7 @@ class QueryManager {
|
|
|
121
121
|
if (environment_1.__DEV__) {
|
|
122
122
|
(0, invariant_1.invariant)(
|
|
123
123
|
this.localState,
|
|
124
|
-
|
|
124
|
+
93,
|
|
125
125
|
(0, internal_1.getOperationName)(mutation, "(anonymous)")
|
|
126
126
|
);
|
|
127
127
|
}
|
|
@@ -356,7 +356,7 @@ class QueryManager {
|
|
|
356
356
|
// depend on values that previously existed in the data portion of the
|
|
357
357
|
// store. So, we cancel the promises and observers that we have issued
|
|
358
358
|
// so far and not yet resolved (in the case of queries).
|
|
359
|
-
this.cancelPendingFetches((0, invariant_1.newInvariantError)(
|
|
359
|
+
this.cancelPendingFetches((0, invariant_1.newInvariantError)(94));
|
|
360
360
|
this.obsQueries.forEach((observableQuery) => {
|
|
361
361
|
// Set loading to true so listeners don't trigger unless they want
|
|
362
362
|
// results with partial data.
|
|
@@ -426,10 +426,10 @@ class QueryManager {
|
|
|
426
426
|
if (!included) {
|
|
427
427
|
const queryName = queryNames.get(nameOrQueryString);
|
|
428
428
|
if (queryName) {
|
|
429
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
429
|
+
__DEV__ && invariant_1.invariant.warn(95, queryName);
|
|
430
430
|
}
|
|
431
431
|
else {
|
|
432
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
432
|
+
__DEV__ && invariant_1.invariant.warn(96);
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
});
|
|
@@ -458,7 +458,7 @@ class QueryManager {
|
|
|
458
458
|
if (environment_1.__DEV__) {
|
|
459
459
|
(0, invariant_1.invariant)(
|
|
460
460
|
!this.getDocumentInfo(query).hasClientExports || this.localState,
|
|
461
|
-
|
|
461
|
+
97,
|
|
462
462
|
(0, internal_1.getOperationName)(query, "(anonymous)")
|
|
463
463
|
);
|
|
464
464
|
}
|
|
@@ -603,14 +603,14 @@ class QueryManager {
|
|
|
603
603
|
if (environment_1.__DEV__) {
|
|
604
604
|
(0, invariant_1.invariant)(
|
|
605
605
|
this.localState,
|
|
606
|
-
|
|
606
|
+
98,
|
|
607
607
|
operation[0].toUpperCase() + operation.slice(1),
|
|
608
608
|
operationName ?? "(anonymous)"
|
|
609
609
|
);
|
|
610
610
|
}
|
|
611
611
|
(0, invariant_1.invariant)(
|
|
612
612
|
!hasIncrementalDirective,
|
|
613
|
-
|
|
613
|
+
99,
|
|
614
614
|
operation[0].toUpperCase() + operation.slice(1),
|
|
615
615
|
operationName ?? "(anonymous)"
|
|
616
616
|
);
|
|
@@ -653,7 +653,6 @@ class QueryManager {
|
|
|
653
653
|
});
|
|
654
654
|
const hasErrors = (0, internal_1.graphQLResultHasError)(result);
|
|
655
655
|
if (hasErrors && errorPolicy === "none") {
|
|
656
|
-
queryInfo.resetLastWrite();
|
|
657
656
|
observableQuery?.["resetNotifications"]();
|
|
658
657
|
const error = new errors_1.CombinedGraphQLErrors(removeStreamDetailsFromExtensions(result));
|
|
659
658
|
dataStateErrorCache_js_1.dataStateErrorCache.set(error, dataState);
|
|
@@ -688,7 +687,6 @@ class QueryManager {
|
|
|
688
687
|
return aqr;
|
|
689
688
|
}), (0, rxjs_2.catchError)((error) => {
|
|
690
689
|
if (errorPolicy === "none") {
|
|
691
|
-
queryInfo.resetLastWrite();
|
|
692
690
|
observableQuery?.["resetNotifications"]();
|
|
693
691
|
throw error;
|
|
694
692
|
}
|
|
@@ -782,7 +780,7 @@ class QueryManager {
|
|
|
782
780
|
if (environment_1.__DEV__) {
|
|
783
781
|
(0, invariant_1.invariant)(
|
|
784
782
|
this.localState,
|
|
785
|
-
|
|
783
|
+
100,
|
|
786
784
|
(0, internal_1.getOperationName)(normalized.query, "(anonymous)")
|
|
787
785
|
);
|
|
788
786
|
}
|
|
@@ -958,7 +956,7 @@ class QueryManager {
|
|
|
958
956
|
!this.noCacheWarningsByCause.has(cause)) {
|
|
959
957
|
this.noCacheWarningsByCause.add(cause);
|
|
960
958
|
__DEV__ && invariant_1.invariant.warn(
|
|
961
|
-
|
|
959
|
+
101,
|
|
962
960
|
(0, internal_1.getOperationName)(document, `Unnamed ${operationType ?? "operation"}`)
|
|
963
961
|
);
|
|
964
962
|
}
|
|
@@ -1025,7 +1023,7 @@ class QueryManager {
|
|
|
1025
1023
|
if (environment_1.__DEV__) {
|
|
1026
1024
|
(0, invariant_1.invariant)(
|
|
1027
1025
|
this.localState,
|
|
1028
|
-
|
|
1026
|
+
102,
|
|
1029
1027
|
(0, internal_1.getOperationName)(query, "(anonymous)")
|
|
1030
1028
|
);
|
|
1031
1029
|
}
|
|
@@ -1125,7 +1123,17 @@ class QueryManager {
|
|
|
1125
1123
|
}),
|
|
1126
1124
|
};
|
|
1127
1125
|
case "no-cache":
|
|
1128
|
-
return {
|
|
1126
|
+
return {
|
|
1127
|
+
fromLink: true,
|
|
1128
|
+
observable: resultsFromLink().pipe((0, rxjs_2.map)((notification) => {
|
|
1129
|
+
if (notification.kind === "N" &&
|
|
1130
|
+
notification.value.data != null &&
|
|
1131
|
+
this.cache.configuresScalars()) {
|
|
1132
|
+
notification.value.data = (0, internal_1.coerceScalarFieldsToParsed)(notification.value.data, query, this.cache);
|
|
1133
|
+
}
|
|
1134
|
+
return notification;
|
|
1135
|
+
})),
|
|
1136
|
+
};
|
|
1129
1137
|
case "standby":
|
|
1130
1138
|
return { fromLink: false, observable: rxjs_2.EMPTY };
|
|
1131
1139
|
}
|
|
@@ -1139,7 +1147,7 @@ function validateDidEmitValue() {
|
|
|
1139
1147
|
didEmitValue = true;
|
|
1140
1148
|
},
|
|
1141
1149
|
complete() {
|
|
1142
|
-
(0, invariant_1.invariant)(didEmitValue,
|
|
1150
|
+
(0, invariant_1.invariant)(didEmitValue, 103);
|
|
1143
1151
|
},
|
|
1144
1152
|
});
|
|
1145
1153
|
}
|