@apollo/client 3.8.0-alpha.0 → 3.8.0-alpha.10
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/README.md +10 -8
- package/apollo-client.cjs +595 -339
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +54 -44
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +54 -44
- package/cache/core/cache.d.ts +1 -1
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +3 -2
- package/cache/core/types/DataProxy.d.ts.map +1 -1
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/core/types/common.d.ts +7 -7
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +1 -1
- package/cache/inmemory/helpers.d.ts +2 -2
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js +2 -2
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +3 -2
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/object-canon.d.ts +0 -1
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +1 -1
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts +12 -12
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +15 -4
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +1 -1
- package/cache/inmemory/reactiveVars.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +2 -2
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +1 -1
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +4 -4
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +1 -1
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +1 -1
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +10 -9
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +11 -5
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +12 -7
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +71 -17
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +7 -6
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +7 -4
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +1 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +3 -16
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +7 -7
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +72 -37
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +265 -100
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +265 -100
- package/core/index.js +2 -2
- package/core/index.js.map +1 -1
- package/core/types.d.ts +21 -17
- package/core/types.d.ts.map +1 -1
- package/core/types.js +1 -0
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +11 -11
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/errors/index.d.ts +2 -2
- package/errors/index.d.ts.map +1 -1
- package/invariantErrorCodes.js +36 -35
- package/link/batch/batch.cjs +5 -3
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +5 -3
- package/link/batch/batching.d.ts +2 -2
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js +5 -3
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batch-http.cjs +12 -2
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +12 -2
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +13 -3
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/context/index.d.ts +2 -1
- package/link/context/index.d.ts.map +1 -1
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.js +2 -2
- package/link/core/core.cjs +2 -2
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +2 -2
- package/link/core/types.d.ts +15 -15
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/http/checkFetcher.js +2 -2
- package/link/http/createHttpLink.d.ts +0 -1
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +10 -2
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +20 -38
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +20 -38
- package/link/http/iterators/async.js.map +1 -1
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/iterators/promise.js.map +1 -1
- package/link/http/iterators/reader.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/responseIterator.js +1 -1
- package/link/http/responseIterator.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +2 -2
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +3 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.d.ts.map +1 -1
- package/link/http/serializeFetchParameter.js +2 -2
- package/link/persisted-queries/index.d.ts +2 -2
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +3 -3
- package/link/persisted-queries/persisted-queries.cjs +3 -3
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +3 -3
- package/link/utils/throwServerError.d.ts +1 -1
- package/link/utils/throwServerError.d.ts.map +1 -1
- package/link/utils/toPromise.js +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js +2 -2
- package/package.json +29 -27
- package/react/cache/SuspenseCache.d.ts +1 -1
- package/react/cache/SuspenseCache.d.ts.map +1 -1
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/components/Query.d.ts +2 -2
- package/react/components/Query.d.ts.map +1 -1
- package/react/components/Query.js.map +1 -1
- package/react/components/Subscription.d.ts +2 -2
- package/react/components/Subscription.d.ts.map +1 -1
- package/react/components/Subscription.js.map +1 -1
- package/react/components/types.d.ts +2 -2
- package/react/components/types.d.ts.map +1 -1
- package/react/components/types.js.map +1 -1
- package/react/context/ApolloConsumer.js +2 -2
- package/react/context/ApolloProvider.js +2 -2
- package/react/context/context.cjs +4 -4
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +4 -4
- package/react/hoc/graphql.d.ts +2 -1
- package/react/hoc/graphql.d.ts.map +1 -1
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts +1 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +2 -2
- package/react/hoc/hoc.cjs +4 -4
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +4 -4
- package/react/hoc/mutation-hoc.d.ts +2 -2
- package/react/hoc/mutation-hoc.d.ts.map +1 -1
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.d.ts +1 -1
- package/react/hoc/query-hoc.d.ts.map +1 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.d.ts +1 -1
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/types.d.ts +6 -6
- package/react/hoc/types.d.ts.map +1 -1
- package/react/hoc/types.js.map +1 -1
- package/react/hoc/withApollo.js +2 -2
- package/react/hooks/hooks.cjs +154 -72
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +154 -72
- package/react/hooks/internal/index.d.ts +1 -0
- package/react/hooks/internal/index.d.ts.map +1 -1
- package/react/hooks/internal/index.js +1 -0
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +3 -0
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +6 -0
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -0
- package/react/hooks/useApolloClient.js +2 -2
- package/react/hooks/useFragment.d.ts +4 -2
- package/react/hooks/useFragment.d.ts.map +1 -1
- package/react/hooks/useFragment.js +9 -8
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +2 -2
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js +22 -8
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +2 -2
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +9 -8
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +6 -5
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +21 -7
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +2 -3
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +1 -2
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseCache.d.ts +2 -1
- package/react/hooks/useSuspenseCache.d.ts.map +1 -1
- package/react/hooks/useSuspenseCache.js +7 -5
- package/react/hooks/useSuspenseCache.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +11 -4
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js +80 -34
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.d.ts +1 -1
- package/react/hooks/useSyncExternalStore.d.ts.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/hooks/useSyncExternalStore.js.map +1 -1
- package/react/parser/index.js +6 -6
- package/react/parser/parser.cjs +10 -10
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +10 -10
- package/react/ssr/RenderPromises.d.ts +4 -4
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/getDataFromTree.d.ts +1 -1
- package/react/ssr/getDataFromTree.d.ts.map +1 -1
- package/react/types/types.d.ts +26 -23
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +30 -3
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +30 -3
- package/testing/core/index.d.ts +2 -1
- package/testing/core/index.d.ts.map +1 -1
- package/testing/core/index.js +1 -0
- package/testing/core/index.js.map +1 -1
- package/testing/core/itAsync.js.map +1 -1
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +8 -4
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +14 -4
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
- package/testing/core/mocking/mockQueryManager.js +3 -3
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -1
- package/testing/core/mocking/mockWatchQuery.js +4 -5
- package/testing/core/mocking/mockWatchQuery.js.map +1 -1
- package/testing/core/observableToPromise.d.ts +2 -2
- package/testing/core/observableToPromise.d.ts.map +1 -1
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/core/wait.d.ts +3 -0
- package/testing/core/wait.d.ts.map +1 -0
- package/testing/core/wait.js +16 -0
- package/testing/core/wait.js.map +1 -0
- package/testing/react/MockedProvider.d.ts +1 -0
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +2 -2
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +2 -2
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +2 -2
- package/utilities/common/arrays.d.ts +1 -0
- package/utilities/common/arrays.d.ts.map +1 -1
- package/utilities/common/arrays.js +1 -0
- package/utilities/common/arrays.js.map +1 -1
- package/utilities/common/cloneDeep.js.map +1 -1
- package/utilities/common/errorHandling.d.ts +3 -2
- package/utilities/common/errorHandling.d.ts.map +1 -1
- package/utilities/common/errorHandling.js +18 -1
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/incrementalResult.d.ts +5 -2
- package/utilities/common/incrementalResult.d.ts.map +1 -1
- package/utilities/common/incrementalResult.js +29 -1
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.d.ts +0 -1
- package/utilities/common/maybeDeepFreeze.d.ts.map +1 -1
- package/utilities/common/maybeDeepFreeze.js +1 -1
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts +2 -2
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeOptions.d.ts +3 -3
- package/utilities/common/mergeOptions.d.ts.map +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/globals/DEV.d.ts +1 -1
- package/utilities/globals/DEV.d.ts.map +1 -1
- package/utilities/globals/DEV.js +1 -17
- package/utilities/globals/DEV.js.map +1 -1
- package/utilities/globals/global.d.ts +5 -2
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +5 -22
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +5 -22
- package/utilities/globals/index.d.ts +1 -1
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +1 -4
- package/utilities/globals/index.js.map +1 -1
- package/utilities/graphql/directives.d.ts +2 -2
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +1 -1
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +1 -1
- package/utilities/graphql/getFromAST.d.ts.map +1 -1
- package/utilities/graphql/getFromAST.js +8 -4
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +3 -3
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts +9 -9
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +168 -91
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +2 -0
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +2 -0
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.d.ts +5 -5
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js +2 -2
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/policies/pagination.d.ts +7 -7
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/types/IsStrictlyAny.d.ts +3 -3
- package/utilities/types/IsStrictlyAny.d.ts.map +1 -1
- package/utilities/utilities.cjs +271 -123
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +271 -123
- package/version.js +1 -1
package/cache/cache.cjs
CHANGED
|
@@ -123,7 +123,6 @@ var hasOwn = Object.prototype.hasOwnProperty;
|
|
|
123
123
|
function isNullish(value) {
|
|
124
124
|
return value === null || value === void 0;
|
|
125
125
|
}
|
|
126
|
-
var isArray = Array.isArray;
|
|
127
126
|
function defaultDataIdFromObject(_a, context) {
|
|
128
127
|
var __typename = _a.__typename, id = _a.id, _id = _a._id;
|
|
129
128
|
if (typeof __typename === "string") {
|
|
@@ -167,7 +166,7 @@ function fieldNameFromStoreName(storeFieldName) {
|
|
|
167
166
|
}
|
|
168
167
|
function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
169
168
|
if (utilities.isNonNullObject(result)) {
|
|
170
|
-
return isArray(result)
|
|
169
|
+
return utilities.isArray(result)
|
|
171
170
|
? result.every(function (item) { return selectionSetMatchesResult(selectionSet, item, variables); })
|
|
172
171
|
: selectionSet.selections.every(function (field) {
|
|
173
172
|
if (utilities.isField(field) && utilities.shouldInclude(field, variables)) {
|
|
@@ -184,7 +183,7 @@ function selectionSetMatchesResult(selectionSet, result, variables) {
|
|
|
184
183
|
function storeValueIsStoreObject(value) {
|
|
185
184
|
return utilities.isNonNullObject(value) &&
|
|
186
185
|
!utilities.isReference(value) &&
|
|
187
|
-
!isArray(value);
|
|
186
|
+
!utilities.isArray(value);
|
|
188
187
|
}
|
|
189
188
|
function makeProcessedFieldsMerger() {
|
|
190
189
|
return new utilities.DeepMerger;
|
|
@@ -289,7 +288,7 @@ exports.EntityStore = (function () {
|
|
|
289
288
|
: newer;
|
|
290
289
|
if (!incoming)
|
|
291
290
|
return;
|
|
292
|
-
__DEV__ ? globals.invariant(typeof dataId === "string", "store.merge expects a string ID") : globals.invariant(typeof dataId === "string", 1);
|
|
291
|
+
globals.__DEV__ ? globals.invariant(typeof dataId === "string", "store.merge expects a string ID") : globals.invariant(typeof dataId === "string", 1);
|
|
293
292
|
var merged = new utilities.DeepMerger(storeObjectReconciler).merge(existing, incoming);
|
|
294
293
|
this.data[dataId] = merged;
|
|
295
294
|
if (merged !== existing) {
|
|
@@ -664,7 +663,7 @@ function supportsResultCaching(store) {
|
|
|
664
663
|
|
|
665
664
|
function shallowCopy(value) {
|
|
666
665
|
if (utilities.isNonNullObject(value)) {
|
|
667
|
-
return isArray(value)
|
|
666
|
+
return utilities.isArray(value)
|
|
668
667
|
? value.slice(0)
|
|
669
668
|
: tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
670
669
|
}
|
|
@@ -704,7 +703,7 @@ var ObjectCanon = (function () {
|
|
|
704
703
|
var node = this.pool.lookupArray(array);
|
|
705
704
|
if (!node.array) {
|
|
706
705
|
this.known.add(node.array = array);
|
|
707
|
-
if (__DEV__) {
|
|
706
|
+
if (globals.__DEV__) {
|
|
708
707
|
Object.freeze(array);
|
|
709
708
|
}
|
|
710
709
|
}
|
|
@@ -729,7 +728,7 @@ var ObjectCanon = (function () {
|
|
|
729
728
|
keys.sorted.forEach(function (key, i) {
|
|
730
729
|
obj_1[key] = array_1[firstValueIndex_1 + i];
|
|
731
730
|
});
|
|
732
|
-
if (__DEV__) {
|
|
731
|
+
if (globals.__DEV__) {
|
|
733
732
|
Object.freeze(obj_1);
|
|
734
733
|
}
|
|
735
734
|
}
|
|
@@ -916,7 +915,7 @@ var StoreReader = (function () {
|
|
|
916
915
|
_a));
|
|
917
916
|
}
|
|
918
917
|
}
|
|
919
|
-
else if (isArray(fieldValue)) {
|
|
918
|
+
else if (utilities.isArray(fieldValue)) {
|
|
920
919
|
fieldValue = handleMissing(_this.executeSubSelectedArray({
|
|
921
920
|
field: selection,
|
|
922
921
|
array: fieldValue,
|
|
@@ -944,7 +943,7 @@ var StoreReader = (function () {
|
|
|
944
943
|
else {
|
|
945
944
|
var fragment = utilities.getFragmentFromSelection(selection, context.lookupFragment);
|
|
946
945
|
if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
947
|
-
throw __DEV__ ? new globals.InvariantError("No fragment named ".concat(selection.name.value)) : new globals.InvariantError(5);
|
|
946
|
+
throw globals.__DEV__ ? new globals.InvariantError("No fragment named ".concat(selection.name.value)) : new globals.InvariantError(5);
|
|
948
947
|
}
|
|
949
948
|
if (fragment && policies.fragmentMatches(fragment, typename)) {
|
|
950
949
|
fragment.selectionSet.selections.forEach(workSet.add, workSet);
|
|
@@ -980,7 +979,7 @@ var StoreReader = (function () {
|
|
|
980
979
|
if (item === null) {
|
|
981
980
|
return null;
|
|
982
981
|
}
|
|
983
|
-
if (isArray(item)) {
|
|
982
|
+
if (utilities.isArray(item)) {
|
|
984
983
|
return handleMissing(_this.executeSubSelectedArray({
|
|
985
984
|
field: field,
|
|
986
985
|
array: item,
|
|
@@ -996,7 +995,7 @@ var StoreReader = (function () {
|
|
|
996
995
|
context: context,
|
|
997
996
|
}), i);
|
|
998
997
|
}
|
|
999
|
-
if (__DEV__) {
|
|
998
|
+
if (globals.__DEV__) {
|
|
1000
999
|
assertSelectionSetForIdValue(context.store, field, item);
|
|
1001
1000
|
}
|
|
1002
1001
|
return item;
|
|
@@ -1025,7 +1024,7 @@ function assertSelectionSetForIdValue(store, field, fieldValue) {
|
|
|
1025
1024
|
var workSet_1 = new Set([fieldValue]);
|
|
1026
1025
|
workSet_1.forEach(function (value) {
|
|
1027
1026
|
if (utilities.isNonNullObject(value)) {
|
|
1028
|
-
__DEV__ ? globals.invariant(!utilities.isReference(value), "Missing selection set for object of type ".concat(getTypenameFromStoreObject(store, value), " returned for query field ").concat(field.name.value)) : globals.invariant(!utilities.isReference(value), 6);
|
|
1027
|
+
globals.__DEV__ ? globals.invariant(!utilities.isReference(value), "Missing selection set for object of type ".concat(getTypenameFromStoreObject(store, value), " returned for query field ").concat(field.name.value)) : globals.invariant(!utilities.isReference(value), 6);
|
|
1029
1028
|
Object.values(value).forEach(workSet_1.add, workSet_1);
|
|
1030
1029
|
}
|
|
1031
1030
|
});
|
|
@@ -1112,7 +1111,7 @@ function keyFieldsFnFromSpecifier(specifier) {
|
|
|
1112
1111
|
hasOwn.call(object, schemaKeyPath[0])) {
|
|
1113
1112
|
extracted = extractKeyPath(object, schemaKeyPath, extractKey);
|
|
1114
1113
|
}
|
|
1115
|
-
__DEV__ ? globals.invariant(extracted !== void 0, "Missing field '".concat(schemaKeyPath.join('.'), "' while extracting keyFields from ").concat(JSON.stringify(object))) : globals.invariant(extracted !== void 0, 2);
|
|
1114
|
+
globals.__DEV__ ? globals.invariant(extracted !== void 0, "Missing field '".concat(schemaKeyPath.join('.'), "' while extracting keyFields from ").concat(JSON.stringify(object))) : globals.invariant(extracted !== void 0, 2);
|
|
1116
1115
|
return extracted;
|
|
1117
1116
|
});
|
|
1118
1117
|
return "".concat(context.typename, ":").concat(JSON.stringify(keyObject));
|
|
@@ -1174,13 +1173,13 @@ function getSpecifierPaths(spec) {
|
|
|
1174
1173
|
var paths_1 = info.paths = [];
|
|
1175
1174
|
var currentPath_1 = [];
|
|
1176
1175
|
spec.forEach(function (s, i) {
|
|
1177
|
-
if (isArray(s)) {
|
|
1176
|
+
if (utilities.isArray(s)) {
|
|
1178
1177
|
getSpecifierPaths(s).forEach(function (p) { return paths_1.push(currentPath_1.concat(p)); });
|
|
1179
1178
|
currentPath_1.length = 0;
|
|
1180
1179
|
}
|
|
1181
1180
|
else {
|
|
1182
1181
|
currentPath_1.push(s);
|
|
1183
|
-
if (!isArray(spec[i + 1])) {
|
|
1182
|
+
if (!utilities.isArray(spec[i + 1])) {
|
|
1184
1183
|
paths_1.push(currentPath_1.slice(0));
|
|
1185
1184
|
currentPath_1.length = 0;
|
|
1186
1185
|
}
|
|
@@ -1195,14 +1194,14 @@ function extractKey(object, key) {
|
|
|
1195
1194
|
function extractKeyPath(object, path, extract) {
|
|
1196
1195
|
extract = extract || extractKey;
|
|
1197
1196
|
return normalize(path.reduce(function reducer(obj, key) {
|
|
1198
|
-
return isArray(obj)
|
|
1197
|
+
return utilities.isArray(obj)
|
|
1199
1198
|
? obj.map(function (child) { return reducer(child, key); })
|
|
1200
1199
|
: obj && extract(obj, key);
|
|
1201
1200
|
}, object));
|
|
1202
1201
|
}
|
|
1203
1202
|
function normalize(value) {
|
|
1204
1203
|
if (utilities.isNonNullObject(value)) {
|
|
1205
|
-
if (isArray(value)) {
|
|
1204
|
+
if (utilities.isArray(value)) {
|
|
1206
1205
|
return value.map(normalize);
|
|
1207
1206
|
}
|
|
1208
1207
|
return collectSpecifierPaths(Object.keys(value).sort(), function (path) { return extractKeyPath(value, path); });
|
|
@@ -1265,7 +1264,7 @@ var Policies = (function () {
|
|
|
1265
1264
|
var keyFn = policy && policy.keyFn || this.config.dataIdFromObject;
|
|
1266
1265
|
while (keyFn) {
|
|
1267
1266
|
var specifierOrId = keyFn(object, context);
|
|
1268
|
-
if (isArray(specifierOrId)) {
|
|
1267
|
+
if (utilities.isArray(specifierOrId)) {
|
|
1269
1268
|
keyFn = keyFieldsFnFromSpecifier(specifierOrId);
|
|
1270
1269
|
}
|
|
1271
1270
|
else {
|
|
@@ -1308,7 +1307,7 @@ var Policies = (function () {
|
|
|
1308
1307
|
setMerge(existing, incoming.merge);
|
|
1309
1308
|
existing.keyFn =
|
|
1310
1309
|
keyFields === false ? nullKeyFieldsFn :
|
|
1311
|
-
isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) :
|
|
1310
|
+
utilities.isArray(keyFields) ? keyFieldsFnFromSpecifier(keyFields) :
|
|
1312
1311
|
typeof keyFields === "function" ? keyFields :
|
|
1313
1312
|
existing.keyFn;
|
|
1314
1313
|
if (fields) {
|
|
@@ -1322,7 +1321,7 @@ var Policies = (function () {
|
|
|
1322
1321
|
var keyArgs = incoming.keyArgs, read = incoming.read, merge = incoming.merge;
|
|
1323
1322
|
existing.keyFn =
|
|
1324
1323
|
keyArgs === false ? simpleKeyArgsFn :
|
|
1325
|
-
isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) :
|
|
1324
|
+
utilities.isArray(keyArgs) ? keyArgsFnFromSpecifier(keyArgs) :
|
|
1326
1325
|
typeof keyArgs === "function" ? keyArgs :
|
|
1327
1326
|
existing.keyFn;
|
|
1328
1327
|
if (typeof read === "function") {
|
|
@@ -1341,7 +1340,7 @@ var Policies = (function () {
|
|
|
1341
1340
|
var rootId = "ROOT_" + which.toUpperCase();
|
|
1342
1341
|
var old = this.rootTypenamesById[rootId];
|
|
1343
1342
|
if (typename !== old) {
|
|
1344
|
-
__DEV__ ? globals.invariant(!old || old === which, "Cannot change root ".concat(which, " __typename more than once")) : globals.invariant(!old || old === which, 3);
|
|
1343
|
+
globals.__DEV__ ? globals.invariant(!old || old === which, "Cannot change root ".concat(which, " __typename more than once")) : globals.invariant(!old || old === which, 3);
|
|
1345
1344
|
if (old)
|
|
1346
1345
|
delete this.rootIdsByTypename[old];
|
|
1347
1346
|
this.rootIdsByTypename[typename] = rootId;
|
|
@@ -1367,9 +1366,20 @@ var Policies = (function () {
|
|
|
1367
1366
|
if (!hasOwn.call(this.typePolicies, typename)) {
|
|
1368
1367
|
var policy_1 = this.typePolicies[typename] = Object.create(null);
|
|
1369
1368
|
policy_1.fields = Object.create(null);
|
|
1370
|
-
var
|
|
1371
|
-
if (
|
|
1372
|
-
|
|
1369
|
+
var supertypes_1 = this.supertypeMap.get(typename);
|
|
1370
|
+
if (!supertypes_1 && this.fuzzySubtypes.size) {
|
|
1371
|
+
supertypes_1 = this.getSupertypeSet(typename, true);
|
|
1372
|
+
this.fuzzySubtypes.forEach(function (regExp, fuzzy) {
|
|
1373
|
+
if (regExp.test(typename)) {
|
|
1374
|
+
var fuzzySupertypes = _this.supertypeMap.get(fuzzy);
|
|
1375
|
+
if (fuzzySupertypes) {
|
|
1376
|
+
fuzzySupertypes.forEach(function (supertype) { return supertypes_1.add(supertype); });
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
if (supertypes_1 && supertypes_1.size) {
|
|
1382
|
+
supertypes_1.forEach(function (supertype) {
|
|
1373
1383
|
var _a = _this.getTypePolicy(supertype), fields = _a.fields, rest = tslib.__rest(_a, ["fields"]);
|
|
1374
1384
|
Object.assign(policy_1, rest);
|
|
1375
1385
|
Object.assign(policy_1.fields, fields);
|
|
@@ -1425,7 +1435,7 @@ var Policies = (function () {
|
|
|
1425
1435
|
if (supertypeSet.has(supertype)) {
|
|
1426
1436
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
1427
1437
|
if (checkingFuzzySubtypes) {
|
|
1428
|
-
__DEV__ && globals.invariant.warn("Inferring subtype ".concat(typename, " of supertype ").concat(supertype));
|
|
1438
|
+
globals.__DEV__ && globals.invariant.warn("Inferring subtype ".concat(typename, " of supertype ").concat(supertype));
|
|
1429
1439
|
}
|
|
1430
1440
|
typenameSupertypeSet.add(supertype);
|
|
1431
1441
|
}
|
|
@@ -1467,7 +1477,7 @@ var Policies = (function () {
|
|
|
1467
1477
|
var args = argsFromFieldSpecifier(fieldSpec);
|
|
1468
1478
|
while (keyFn) {
|
|
1469
1479
|
var specifierOrString = keyFn(args, context);
|
|
1470
|
-
if (isArray(specifierOrString)) {
|
|
1480
|
+
if (utilities.isArray(specifierOrString)) {
|
|
1471
1481
|
keyFn = keyArgsFnFromSpecifier(specifierOrString);
|
|
1472
1482
|
}
|
|
1473
1483
|
else {
|
|
@@ -1578,8 +1588,8 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
1578
1588
|
options.from = objectOrReference;
|
|
1579
1589
|
}
|
|
1580
1590
|
}
|
|
1581
|
-
if (__DEV__ && options.from === void 0) {
|
|
1582
|
-
__DEV__ && globals.invariant.warn("Undefined 'from' passed to readField with arguments ".concat(utilities.stringifyForDisplay(Array.from(readFieldArgs))));
|
|
1591
|
+
if (globals.__DEV__ && options.from === void 0) {
|
|
1592
|
+
globals.__DEV__ && globals.invariant.warn("Undefined 'from' passed to readField with arguments ".concat(utilities.stringifyForDisplay(Array.from(readFieldArgs))));
|
|
1583
1593
|
}
|
|
1584
1594
|
if (void 0 === options.variables) {
|
|
1585
1595
|
options.variables = variables;
|
|
@@ -1588,8 +1598,8 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
1588
1598
|
}
|
|
1589
1599
|
function makeMergeObjectsFunction(store) {
|
|
1590
1600
|
return function mergeObjects(existing, incoming) {
|
|
1591
|
-
if (isArray(existing) || isArray(incoming)) {
|
|
1592
|
-
throw __DEV__ ? new globals.InvariantError("Cannot automatically merge arrays") : new globals.InvariantError(4);
|
|
1601
|
+
if (utilities.isArray(existing) || utilities.isArray(incoming)) {
|
|
1602
|
+
throw globals.__DEV__ ? new globals.InvariantError("Cannot automatically merge arrays") : new globals.InvariantError(4);
|
|
1593
1603
|
}
|
|
1594
1604
|
if (utilities.isNonNullObject(existing) &&
|
|
1595
1605
|
utilities.isNonNullObject(incoming)) {
|
|
@@ -1650,7 +1660,7 @@ var StoreWriter = (function () {
|
|
|
1650
1660
|
context: context,
|
|
1651
1661
|
});
|
|
1652
1662
|
if (!utilities.isReference(ref)) {
|
|
1653
|
-
throw __DEV__ ? new globals.InvariantError("Could not identify object ".concat(JSON.stringify(result))) : new globals.InvariantError(7);
|
|
1663
|
+
throw globals.__DEV__ ? new globals.InvariantError("Could not identify object ".concat(JSON.stringify(result))) : new globals.InvariantError(7);
|
|
1654
1664
|
}
|
|
1655
1665
|
context.incomingById.forEach(function (_a, dataId) {
|
|
1656
1666
|
var storeObject = _a.storeObject, mergeTree = _a.mergeTree, fieldNodeSet = _a.fieldNodeSet;
|
|
@@ -1662,7 +1672,7 @@ var StoreWriter = (function () {
|
|
|
1662
1672
|
}
|
|
1663
1673
|
storeObject = applied;
|
|
1664
1674
|
}
|
|
1665
|
-
if (__DEV__ && !context.overwrite) {
|
|
1675
|
+
if (globals.__DEV__ && !context.overwrite) {
|
|
1666
1676
|
var fieldsWithSelectionSets_1 = Object.create(null);
|
|
1667
1677
|
fieldNodeSet.forEach(function (field) {
|
|
1668
1678
|
if (field.selectionSet) {
|
|
@@ -1750,12 +1760,12 @@ var StoreWriter = (function () {
|
|
|
1750
1760
|
_a[storeFieldName] = incomingValue,
|
|
1751
1761
|
_a));
|
|
1752
1762
|
}
|
|
1753
|
-
else if (__DEV__ &&
|
|
1763
|
+
else if (globals.__DEV__ &&
|
|
1754
1764
|
!context.clientOnly &&
|
|
1755
1765
|
!context.deferred &&
|
|
1756
1766
|
!utilities.addTypenameToDocument.added(field) &&
|
|
1757
1767
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
1758
|
-
__DEV__ && globals.invariant.error("Missing field '".concat(utilities.resultKeyNameFromField(field), "' while writing result ").concat(JSON.stringify(result, null, 2)).substring(0, 1000));
|
|
1768
|
+
globals.__DEV__ && globals.invariant.error("Missing field '".concat(utilities.resultKeyNameFromField(field), "' while writing result ").concat(JSON.stringify(result, null, 2)).substring(0, 1000));
|
|
1759
1769
|
}
|
|
1760
1770
|
});
|
|
1761
1771
|
try {
|
|
@@ -1804,9 +1814,9 @@ var StoreWriter = (function () {
|
|
|
1804
1814
|
StoreWriter.prototype.processFieldValue = function (value, field, context, mergeTree) {
|
|
1805
1815
|
var _this = this;
|
|
1806
1816
|
if (!field.selectionSet || value === null) {
|
|
1807
|
-
return __DEV__ ? utilities.cloneDeep(value) : value;
|
|
1817
|
+
return globals.__DEV__ ? utilities.cloneDeep(value) : value;
|
|
1808
1818
|
}
|
|
1809
|
-
if (isArray(value)) {
|
|
1819
|
+
if (utilities.isArray(value)) {
|
|
1810
1820
|
return value.map(function (item, i) {
|
|
1811
1821
|
var value = _this.processFieldValue(item, field, context, getChildMergeTree(mergeTree, i));
|
|
1812
1822
|
maybeRecycleChildMergeTree(mergeTree, i);
|
|
@@ -1859,7 +1869,7 @@ var StoreWriter = (function () {
|
|
|
1859
1869
|
else {
|
|
1860
1870
|
var fragment = utilities.getFragmentFromSelection(selection, context.lookupFragment);
|
|
1861
1871
|
if (!fragment && selection.kind === graphql.Kind.FRAGMENT_SPREAD) {
|
|
1862
|
-
throw __DEV__ ? new globals.InvariantError("No fragment named ".concat(selection.name.value)) : new globals.InvariantError(8);
|
|
1872
|
+
throw globals.__DEV__ ? new globals.InvariantError("No fragment named ".concat(selection.name.value)) : new globals.InvariantError(8);
|
|
1863
1873
|
}
|
|
1864
1874
|
if (fragment &&
|
|
1865
1875
|
policies.fragmentMatches(fragment, typename, result, context.variables)) {
|
|
@@ -1874,7 +1884,7 @@ var StoreWriter = (function () {
|
|
|
1874
1884
|
var _a;
|
|
1875
1885
|
var _this = this;
|
|
1876
1886
|
if (mergeTree.map.size && !utilities.isReference(incoming)) {
|
|
1877
|
-
var e_1 = (!isArray(incoming) &&
|
|
1887
|
+
var e_1 = (!utilities.isArray(incoming) &&
|
|
1878
1888
|
(utilities.isReference(existing) || storeValueIsStoreObject(existing))) ? existing : void 0;
|
|
1879
1889
|
var i_1 = incoming;
|
|
1880
1890
|
if (e_1 && !getStorageArgs) {
|
|
@@ -1882,7 +1892,7 @@ var StoreWriter = (function () {
|
|
|
1882
1892
|
}
|
|
1883
1893
|
var changedFields_1;
|
|
1884
1894
|
var getValue_1 = function (from, name) {
|
|
1885
|
-
return isArray(from)
|
|
1895
|
+
return utilities.isArray(from)
|
|
1886
1896
|
? (typeof name === "number" ? from[name] : void 0)
|
|
1887
1897
|
: context.store.getFieldValue(from, String(name));
|
|
1888
1898
|
};
|
|
@@ -1904,7 +1914,7 @@ var StoreWriter = (function () {
|
|
|
1904
1914
|
}
|
|
1905
1915
|
});
|
|
1906
1916
|
if (changedFields_1) {
|
|
1907
|
-
incoming = (isArray(i_1) ? i_1.slice(0) : tslib.__assign({}, i_1));
|
|
1917
|
+
incoming = (utilities.isArray(i_1) ? i_1.slice(0) : tslib.__assign({}, i_1));
|
|
1908
1918
|
changedFields_1.forEach(function (value, name) {
|
|
1909
1919
|
incoming[name] = value;
|
|
1910
1920
|
});
|
|
@@ -1985,8 +1995,8 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
1985
1995
|
return;
|
|
1986
1996
|
warnings.add(typeDotName);
|
|
1987
1997
|
var childTypenames = [];
|
|
1988
|
-
if (!isArray(existing) &&
|
|
1989
|
-
!isArray(incoming)) {
|
|
1998
|
+
if (!utilities.isArray(existing) &&
|
|
1999
|
+
!utilities.isArray(incoming)) {
|
|
1990
2000
|
[existing, incoming].forEach(function (child) {
|
|
1991
2001
|
var typename = store.getFieldValue(child, "__typename");
|
|
1992
2002
|
if (typeof typename === "string" &&
|
|
@@ -1995,7 +2005,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
1995
2005
|
}
|
|
1996
2006
|
});
|
|
1997
2007
|
}
|
|
1998
|
-
__DEV__ && globals.invariant.warn("Cache data may be lost when replacing the ".concat(fieldName, " field of a ").concat(parentType, " object.\n\nTo address this problem (which is not a bug in Apollo Client), ").concat(childTypenames.length
|
|
2008
|
+
globals.__DEV__ && globals.invariant.warn("Cache data may be lost when replacing the ".concat(fieldName, " field of a ").concat(parentType, " object.\n\nTo address this problem (which is not a bug in Apollo Client), ").concat(childTypenames.length
|
|
1999
2009
|
? "either ensure all objects of type " +
|
|
2000
2010
|
childTypenames.join(" and ") + " have an ID or a custom merge function, or "
|
|
2001
2011
|
: "", "define a custom merge function for the ").concat(typeDotName, " field, so InMemoryCache can safely merge these objects:\n\n existing: ").concat(JSON.stringify(existing).slice(0, 1000), "\n incoming: ").concat(JSON.stringify(incoming).slice(0, 1000), "\n\nFor more information about these options, please refer to the documentation:\n\n * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers\n * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects\n"));
|
|
@@ -2155,7 +2165,7 @@ var InMemoryCache = (function (_super) {
|
|
|
2155
2165
|
return this.policies.identify(object)[0];
|
|
2156
2166
|
}
|
|
2157
2167
|
catch (e) {
|
|
2158
|
-
__DEV__ && globals.invariant.warn(e);
|
|
2168
|
+
globals.__DEV__ && globals.invariant.warn(e);
|
|
2159
2169
|
}
|
|
2160
2170
|
};
|
|
2161
2171
|
InMemoryCache.prototype.evict = function (options) {
|