@apollo/client 4.1.0-alpha.8 → 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 +45 -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/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/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
|
@@ -212,7 +212,7 @@ class Policies {
|
|
|
212
212
|
const rootId = "ROOT_" + which.toUpperCase();
|
|
213
213
|
const old = this.rootTypenamesById[rootId];
|
|
214
214
|
if (typename !== old) {
|
|
215
|
-
(0, invariant_1.invariant)(!old || old === which,
|
|
215
|
+
(0, invariant_1.invariant)(!old || old === which, 103, which);
|
|
216
216
|
// First, delete any old __typename associated with this rootId from
|
|
217
217
|
// rootIdsByTypename.
|
|
218
218
|
if (old)
|
|
@@ -355,7 +355,7 @@ class Policies {
|
|
|
355
355
|
if (supertypeSet.has(supertype)) {
|
|
356
356
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
357
357
|
if (checkingFuzzySubtypes) {
|
|
358
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
358
|
+
__DEV__ && invariant_1.invariant.warn(104, typename, supertype);
|
|
359
359
|
}
|
|
360
360
|
// Record positive results for faster future lookup.
|
|
361
361
|
// Unfortunately, we cannot safely cache negative results,
|
|
@@ -528,7 +528,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
|
|
|
528
528
|
const fieldName = (0, helpers_js_1.fieldNameFromStoreName)(storeFieldName);
|
|
529
529
|
const variables = fieldSpec.variables || context.variables;
|
|
530
530
|
const { toReference, canRead } = context.store;
|
|
531
|
-
|
|
531
|
+
const options = {
|
|
532
532
|
args: argsFromFieldSpecifier(fieldSpec),
|
|
533
533
|
field: fieldSpec.field || null,
|
|
534
534
|
fieldName,
|
|
@@ -544,6 +544,15 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
|
|
|
544
544
|
},
|
|
545
545
|
mergeObjects: makeMergeObjectsFunction(context.store),
|
|
546
546
|
};
|
|
547
|
+
// Make `extensions` only available in `merge` functions, but not `read`
|
|
548
|
+
// functions since we currently only support merge functions. Even though
|
|
549
|
+
// `context.extensions` will result in `undefined`, we don't want the key to
|
|
550
|
+
// exist in the options object to avoid the appearance that its supported in
|
|
551
|
+
// `read` functions.
|
|
552
|
+
if ("extensions" in context) {
|
|
553
|
+
options.extensions = context.extensions;
|
|
554
|
+
}
|
|
555
|
+
return options;
|
|
547
556
|
}
|
|
548
557
|
function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables) {
|
|
549
558
|
const { 0: fieldNameOrOptions, 1: from, length: argc } = readFieldArgs;
|
|
@@ -566,7 +575,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
566
575
|
}
|
|
567
576
|
}
|
|
568
577
|
if (environment_1.__DEV__ && options.from === void 0) {
|
|
569
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
578
|
+
__DEV__ && invariant_1.invariant.warn(105, (0, internal_1.stringifyForDisplay)(Array.from(readFieldArgs)));
|
|
570
579
|
}
|
|
571
580
|
if (void 0 === options.variables) {
|
|
572
581
|
options.variables = variables;
|
|
@@ -576,7 +585,7 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
576
585
|
function makeMergeObjectsFunction(store) {
|
|
577
586
|
return function mergeObjects(existing, incoming) {
|
|
578
587
|
if ((0, internal_1.isArray)(existing) || (0, internal_1.isArray)(incoming)) {
|
|
579
|
-
throw (0, invariant_1.newInvariantError)(
|
|
588
|
+
throw (0, invariant_1.newInvariantError)(106);
|
|
580
589
|
}
|
|
581
590
|
// These dynamic checks are necessary because the parameters of a
|
|
582
591
|
// custom merge function can easily have the any type, so the type
|