@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
|
@@ -204,7 +204,7 @@ export class Policies {
|
|
|
204
204
|
const rootId = "ROOT_" + which.toUpperCase();
|
|
205
205
|
const old = this.rootTypenamesById[rootId];
|
|
206
206
|
if (typename !== old) {
|
|
207
|
-
invariant(!old || old === which,
|
|
207
|
+
invariant(!old || old === which, 103, which);
|
|
208
208
|
// First, delete any old __typename associated with this rootId from
|
|
209
209
|
// rootIdsByTypename.
|
|
210
210
|
if (old)
|
|
@@ -347,7 +347,7 @@ export class Policies {
|
|
|
347
347
|
if (supertypeSet.has(supertype)) {
|
|
348
348
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
349
349
|
if (checkingFuzzySubtypes) {
|
|
350
|
-
__DEV__ && invariant.warn(
|
|
350
|
+
__DEV__ && invariant.warn(104, typename, supertype);
|
|
351
351
|
}
|
|
352
352
|
// Record positive results for faster future lookup.
|
|
353
353
|
// Unfortunately, we cannot safely cache negative results,
|
|
@@ -519,7 +519,7 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
|
|
|
519
519
|
const fieldName = fieldNameFromStoreName(storeFieldName);
|
|
520
520
|
const variables = fieldSpec.variables || context.variables;
|
|
521
521
|
const { toReference, canRead } = context.store;
|
|
522
|
-
|
|
522
|
+
const options = {
|
|
523
523
|
args: argsFromFieldSpecifier(fieldSpec),
|
|
524
524
|
field: fieldSpec.field || null,
|
|
525
525
|
fieldName,
|
|
@@ -535,6 +535,15 @@ function makeFieldFunctionOptions(policies, objectOrReference, fieldSpec, contex
|
|
|
535
535
|
},
|
|
536
536
|
mergeObjects: makeMergeObjectsFunction(context.store),
|
|
537
537
|
};
|
|
538
|
+
// Make `extensions` only available in `merge` functions, but not `read`
|
|
539
|
+
// functions since we currently only support merge functions. Even though
|
|
540
|
+
// `context.extensions` will result in `undefined`, we don't want the key to
|
|
541
|
+
// exist in the options object to avoid the appearance that its supported in
|
|
542
|
+
// `read` functions.
|
|
543
|
+
if ("extensions" in context) {
|
|
544
|
+
options.extensions = context.extensions;
|
|
545
|
+
}
|
|
546
|
+
return options;
|
|
538
547
|
}
|
|
539
548
|
export function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables) {
|
|
540
549
|
const { 0: fieldNameOrOptions, 1: from, length: argc } = readFieldArgs;
|
|
@@ -557,7 +566,7 @@ export function normalizeReadFieldOptions(readFieldArgs, objectOrReference, vari
|
|
|
557
566
|
}
|
|
558
567
|
}
|
|
559
568
|
if (__DEV__ && options.from === void 0) {
|
|
560
|
-
__DEV__ && invariant.warn(
|
|
569
|
+
__DEV__ && invariant.warn(105, stringifyForDisplay(Array.from(readFieldArgs)));
|
|
561
570
|
}
|
|
562
571
|
if (void 0 === options.variables) {
|
|
563
572
|
options.variables = variables;
|
|
@@ -567,7 +576,7 @@ export function normalizeReadFieldOptions(readFieldArgs, objectOrReference, vari
|
|
|
567
576
|
function makeMergeObjectsFunction(store) {
|
|
568
577
|
return function mergeObjects(existing, incoming) {
|
|
569
578
|
if (isArray(existing) || isArray(incoming)) {
|
|
570
|
-
throw newInvariantError(
|
|
579
|
+
throw newInvariantError(106);
|
|
571
580
|
}
|
|
572
581
|
// These dynamic checks are necessary because the parameters of a
|
|
573
582
|
// custom merge function can easily have the any type, so the type
|