@apollo/client 4.0.0-alpha.13 → 4.0.0-alpha.15
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/.changeset/beige-spiders-hope.md +5 -0
- package/.changeset/curvy-flies-accept.md +5 -0
- package/.changeset/few-crabs-move.md +6 -0
- package/.changeset/funny-boats-wink.md +35 -0
- package/.changeset/gold-oranges-double.md +5 -0
- package/.changeset/little-parrots-bow.md +14 -0
- package/.changeset/olive-cougars-ring.md +9 -0
- package/.changeset/poor-spiders-hunt.md +23 -0
- package/.changeset/pre.json +20 -0
- package/.changeset/selfish-spoons-approve.md +44 -0
- package/.changeset/serious-items-develop.md +17 -0
- package/.changeset/sixty-bats-cry.md +6 -0
- package/.changeset/slimy-ants-bake.md +5 -0
- package/.changeset/sour-colts-tell.md +5 -0
- package/.changeset/sour-guests-poke.md +5 -0
- package/.changeset/spotty-mugs-poke.md +5 -0
- package/.changeset/strange-walls-march.md +5 -0
- package/.changeset/strong-rivers-fry.md +34 -0
- package/.changeset/stupid-pumpkins-travel.md +13 -0
- package/.changeset/thirty-pens-jump.md +5 -0
- package/.changeset/wicked-kiwis-buy.md +5 -0
- package/CHANGELOG.md +213 -0
- package/__cjs/cache/core/cache.cjs +9 -7
- package/__cjs/cache/core/cache.cjs.map +1 -1
- package/__cjs/cache/core/cache.d.cts +9 -7
- package/__cjs/cache/inmemory/entityStore.cjs +3 -3
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/inMemoryCache.d.cts +9 -7
- package/__cjs/cache/inmemory/key-extractor.cjs +1 -1
- package/__cjs/cache/inmemory/policies.cjs +4 -4
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/readFromStore.cjs +2 -2
- package/__cjs/cache/inmemory/readFromStore.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.cjs +4 -4
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/core/ApolloClient.cjs +23 -45
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +9 -21
- package/__cjs/core/ObservableQuery.cjs +564 -340
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +95 -33
- package/__cjs/core/QueryInfo.cjs +109 -179
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/QueryInfo.d.cts +9 -14
- package/__cjs/core/QueryManager.cjs +168 -108
- package/__cjs/core/QueryManager.cjs.map +1 -1
- package/__cjs/core/QueryManager.d.cts +12 -8
- package/__cjs/core/index.cjs +2 -1
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +2 -3
- package/__cjs/core/types.d.cts +18 -6
- package/__cjs/errors/LinkError.cjs +5 -1
- package/__cjs/errors/LinkError.cjs.map +1 -1
- package/__cjs/errors/LinkError.d.cts +5 -1
- package/__cjs/errors/LocalStateError.cjs +27 -0
- package/__cjs/errors/LocalStateError.cjs.map +1 -0
- package/__cjs/errors/LocalStateError.d.cts +20 -0
- package/__cjs/errors/index.cjs +5 -1
- package/__cjs/errors/index.cjs.map +1 -1
- package/__cjs/errors/index.d.cts +2 -0
- package/__cjs/invariantErrorCodes.cjs +130 -57
- package/__cjs/link/core/ApolloLink.cjs +17 -11
- package/__cjs/link/core/ApolloLink.cjs.map +1 -1
- package/__cjs/link/core/ApolloLink.d.cts +15 -9
- package/__cjs/link/http/checkFetcher.cjs +1 -1
- package/__cjs/link/http/createHttpLink.cjs +1 -1
- package/__cjs/link/http/parseAndCheckHttpResponse.cjs +1 -1
- package/__cjs/link/http/serializeFetchParameter.cjs +1 -1
- package/__cjs/link/persisted-queries/index.cjs +2 -2
- package/__cjs/link/utils/transformOperation.cjs +1 -1
- package/__cjs/link/utils/transformOperation.cjs.map +1 -1
- package/__cjs/link/utils/validateOperation.cjs +1 -1
- package/__cjs/local-state/LocalState.cjs +535 -0
- package/__cjs/local-state/LocalState.cjs.map +1 -0
- package/__cjs/local-state/LocalState.d.cts +89 -0
- package/__cjs/local-state/index.cjs +6 -0
- package/__cjs/local-state/index.cjs.map +1 -0
- package/__cjs/local-state/index.d.cts +2 -0
- package/__cjs/masking/maskFragment.cjs +5 -1
- package/__cjs/masking/maskFragment.cjs.map +1 -1
- package/__cjs/masking/maskFragment.d.cts +5 -1
- package/__cjs/masking/maskOperation.cjs +5 -1
- package/__cjs/masking/maskOperation.cjs.map +1 -1
- package/__cjs/masking/maskOperation.d.cts +5 -1
- package/__cjs/masking/utils.cjs +5 -1
- package/__cjs/masking/utils.cjs.map +1 -1
- package/__cjs/masking/utils.d.cts +5 -1
- package/__cjs/react/hooks/internal/wrapHook.cjs +36 -34
- package/__cjs/react/hooks/internal/wrapHook.cjs.map +1 -1
- package/__cjs/react/hooks/internal/wrapHook.d.cts +42 -38
- package/__cjs/react/hooks/useQuery.cjs +10 -25
- package/__cjs/react/hooks/useQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useQuery.d.cts +0 -1
- package/__cjs/react/internal/cache/QueryReference.cjs +6 -9
- package/__cjs/react/internal/cache/QueryReference.cjs.map +1 -1
- package/__cjs/react/internal/cache/QueryReference.d.cts +25 -7
- package/__cjs/react/ssr/prerenderStatic.cjs +7 -0
- package/__cjs/react/ssr/prerenderStatic.cjs.map +1 -1
- package/__cjs/react/ssr/useSSRQuery.cjs +11 -2
- package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockLink.cjs +7 -9
- package/__cjs/testing/core/mocking/mockLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockLink.d.cts +29 -22
- package/__cjs/testing/core/mocking/mockSubscriptionLink.cjs +0 -4
- package/__cjs/testing/core/mocking/mockSubscriptionLink.cjs.map +1 -1
- package/__cjs/testing/core/mocking/mockSubscriptionLink.d.cts +7 -6
- package/__cjs/testing/core/types/deprecated.cjs +3 -0
- package/__cjs/testing/core/types/deprecated.cjs.map +1 -0
- package/__cjs/testing/core/types/deprecated.d.cts +10 -0
- package/__cjs/testing/index.cjs +6 -13
- package/__cjs/testing/index.cjs.map +1 -1
- package/__cjs/testing/index.d.cts +3 -2
- package/__cjs/testing/internal/ObservableStream.cjs +13 -1
- package/__cjs/testing/internal/ObservableStream.cjs.map +1 -1
- package/__cjs/testing/internal/ObservableStream.d.cts +12 -1
- package/__cjs/testing/internal/disposables/withCleanup.cjs +5 -1
- package/__cjs/testing/internal/disposables/withCleanup.cjs.map +1 -1
- package/__cjs/testing/internal/disposables/withCleanup.d.cts +5 -1
- package/__cjs/testing/internal/index.cjs +3 -1
- package/__cjs/testing/internal/index.cjs.map +1 -1
- package/__cjs/testing/internal/index.d.cts +1 -0
- package/__cjs/testing/internal/scenarios/index.cjs +4 -4
- package/__cjs/testing/internal/scenarios/index.cjs.map +1 -1
- package/__cjs/testing/internal/scenarios/index.d.cts +8 -8
- package/__cjs/testing/{core → internal}/wait.cjs +0 -4
- package/__cjs/testing/internal/wait.cjs.map +1 -0
- package/__cjs/testing/{core → internal}/wait.d.cts +0 -1
- package/__cjs/testing/matchers/index.cjs +2 -2
- package/__cjs/testing/matchers/index.cjs.map +1 -1
- package/__cjs/testing/matchers/toEmitTypedValue.cjs +1 -1
- package/__cjs/testing/matchers/toEmitTypedValue.cjs.map +1 -1
- package/__cjs/testing/matchers/toEmitTypedValue.d.cts +6 -1
- package/__cjs/testing/matchers/toRerenderWithSimilarSnapshot.cjs +31 -18
- package/__cjs/testing/matchers/toRerenderWithSimilarSnapshot.cjs.map +1 -1
- package/__cjs/testing/matchers/toRerenderWithSimilarSnapshot.d.cts +13 -6
- package/__cjs/testing/matchers/toStrictEqualTyped.cjs +1 -1
- package/__cjs/testing/matchers/toStrictEqualTyped.cjs.map +1 -1
- package/__cjs/testing/matchers/toStrictEqualTyped.d.cts +4 -0
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs +14 -2
- package/__cjs/testing/matchers/utils/getSerializableProperties.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.cjs +4 -4
- package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.d.cts +4 -5
- package/__cjs/utilities/graphql/DocumentTransform.cjs +10 -6
- package/__cjs/utilities/graphql/DocumentTransform.cjs.map +1 -1
- package/__cjs/utilities/graphql/DocumentTransform.d.cts +10 -6
- package/__cjs/utilities/internal/DeepMerger.cjs +5 -1
- package/__cjs/utilities/internal/DeepMerger.cjs.map +1 -1
- package/__cjs/utilities/internal/DeepMerger.d.cts +5 -1
- package/__cjs/utilities/internal/argumentsObjectFromField.cjs +5 -1
- package/__cjs/utilities/internal/argumentsObjectFromField.cjs.map +1 -1
- package/__cjs/utilities/internal/argumentsObjectFromField.d.cts +5 -1
- package/__cjs/utilities/internal/caches.cjs +24 -20
- package/__cjs/utilities/internal/caches.cjs.map +1 -1
- package/__cjs/utilities/internal/caches.d.cts +32 -24
- package/__cjs/utilities/internal/canUseDOM.cjs +5 -1
- package/__cjs/utilities/internal/canUseDOM.cjs.map +1 -1
- package/__cjs/utilities/internal/canUseDOM.d.cts +5 -1
- package/__cjs/utilities/internal/checkDocument.cjs +6 -3
- package/__cjs/utilities/internal/checkDocument.cjs.map +1 -1
- package/__cjs/utilities/internal/checkDocument.d.cts +6 -3
- package/__cjs/utilities/internal/cloneDeep.cjs +6 -4
- package/__cjs/utilities/internal/cloneDeep.cjs.map +1 -1
- package/__cjs/utilities/internal/cloneDeep.d.cts +6 -4
- package/__cjs/utilities/internal/compact.cjs +7 -5
- package/__cjs/utilities/internal/compact.cjs.map +1 -1
- package/__cjs/utilities/internal/compact.d.cts +7 -5
- package/__cjs/utilities/internal/createFragmentMap.cjs +7 -4
- package/__cjs/utilities/internal/createFragmentMap.cjs.map +1 -1
- package/__cjs/utilities/internal/createFragmentMap.d.cts +7 -4
- package/__cjs/utilities/internal/createFulfilledPromise.cjs +5 -1
- package/__cjs/utilities/internal/createFulfilledPromise.cjs.map +1 -1
- package/__cjs/utilities/internal/createFulfilledPromise.d.cts +5 -1
- package/__cjs/utilities/internal/createRejectedPromise.cjs +5 -1
- package/__cjs/utilities/internal/createRejectedPromise.cjs.map +1 -1
- package/__cjs/utilities/internal/createRejectedPromise.d.cts +5 -1
- package/__cjs/utilities/internal/dealias.cjs +21 -0
- package/__cjs/utilities/internal/dealias.cjs.map +1 -0
- package/__cjs/utilities/internal/dealias.d.cts +5 -0
- package/__cjs/utilities/internal/decoratePromise.cjs +5 -1
- package/__cjs/utilities/internal/decoratePromise.cjs.map +1 -1
- package/__cjs/utilities/internal/decoratePromise.d.cts +5 -1
- package/__cjs/utilities/internal/deepFreeze.cjs +5 -1
- package/__cjs/utilities/internal/deepFreeze.cjs.map +1 -1
- package/__cjs/utilities/internal/deepFreeze.d.cts +5 -1
- package/__cjs/utilities/internal/filterMap.cjs +31 -0
- package/__cjs/utilities/internal/filterMap.cjs.map +1 -0
- package/__cjs/utilities/internal/filterMap.d.cts +4 -0
- package/__cjs/utilities/internal/getDefaultValues.cjs +5 -1
- package/__cjs/utilities/internal/getDefaultValues.cjs.map +1 -1
- package/__cjs/utilities/internal/getDefaultValues.d.cts +5 -1
- package/__cjs/utilities/internal/getFragmentDefinition.cjs +5 -1
- package/__cjs/utilities/internal/getFragmentDefinition.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentDefinition.d.cts +5 -1
- package/__cjs/utilities/internal/getFragmentDefinitions.cjs +5 -1
- package/__cjs/utilities/internal/getFragmentDefinitions.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentDefinitions.d.cts +5 -1
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs +5 -1
- package/__cjs/utilities/internal/getFragmentFromSelection.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentFromSelection.d.cts +5 -1
- package/__cjs/utilities/internal/getFragmentQueryDocument.cjs +25 -23
- package/__cjs/utilities/internal/getFragmentQueryDocument.cjs.map +1 -1
- package/__cjs/utilities/internal/getFragmentQueryDocument.d.cts +25 -23
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.cjs +5 -1
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.cjs.map +1 -1
- package/__cjs/utilities/internal/getGraphQLErrorsFromResult.d.cts +5 -1
- package/__cjs/utilities/internal/getMainDefinition.cjs +8 -6
- package/__cjs/utilities/internal/getMainDefinition.cjs.map +1 -1
- package/__cjs/utilities/internal/getMainDefinition.d.cts +8 -6
- package/__cjs/utilities/internal/getMemoryInternals.cjs +15 -9
- package/__cjs/utilities/internal/getMemoryInternals.cjs.map +1 -1
- package/__cjs/utilities/internal/getMemoryInternals.d.cts +15 -9
- package/__cjs/utilities/internal/getOperationDefinition.cjs +5 -1
- package/__cjs/utilities/internal/getOperationDefinition.cjs.map +1 -1
- package/__cjs/utilities/internal/getOperationDefinition.d.cts +5 -1
- package/__cjs/utilities/internal/getOperationName.cjs +7 -5
- package/__cjs/utilities/internal/getOperationName.cjs.map +1 -1
- package/__cjs/utilities/internal/getOperationName.d.cts +6 -2
- package/__cjs/utilities/internal/getQueryDefinition.cjs +5 -1
- package/__cjs/utilities/internal/getQueryDefinition.cjs.map +1 -1
- package/__cjs/utilities/internal/getQueryDefinition.d.cts +5 -1
- package/__cjs/utilities/internal/getStoreKeyName.cjs +5 -1
- package/__cjs/utilities/internal/getStoreKeyName.cjs.map +1 -1
- package/__cjs/utilities/internal/getStoreKeyName.d.cts +5 -1
- package/__cjs/utilities/internal/graphQLResultHasError.cjs +5 -1
- package/__cjs/utilities/internal/graphQLResultHasError.cjs.map +1 -1
- package/__cjs/utilities/internal/graphQLResultHasError.d.cts +5 -1
- package/__cjs/utilities/internal/hasDirectives.cjs +5 -1
- package/__cjs/utilities/internal/hasDirectives.cjs.map +1 -1
- package/__cjs/utilities/internal/hasDirectives.d.cts +5 -1
- package/__cjs/utilities/internal/hasForcedResolvers.cjs +23 -0
- package/__cjs/utilities/internal/hasForcedResolvers.cjs.map +1 -0
- package/__cjs/utilities/internal/hasForcedResolvers.d.cts +3 -0
- package/__cjs/utilities/internal/index.cjs +8 -4
- package/__cjs/utilities/internal/index.cjs.map +1 -1
- package/__cjs/utilities/internal/index.d.cts +3 -1
- package/__cjs/utilities/internal/isArray.cjs +6 -4
- package/__cjs/utilities/internal/isArray.cjs.map +1 -1
- package/__cjs/utilities/internal/isArray.d.cts +6 -4
- package/__cjs/utilities/internal/isDocumentNode.cjs +5 -1
- package/__cjs/utilities/internal/isDocumentNode.cjs.map +1 -1
- package/__cjs/utilities/internal/isDocumentNode.d.cts +5 -1
- package/__cjs/utilities/internal/isExecutionPatchIncrementalResult.cjs +5 -1
- package/__cjs/utilities/internal/isExecutionPatchIncrementalResult.cjs.map +1 -1
- package/__cjs/utilities/internal/isExecutionPatchIncrementalResult.d.cts +5 -1
- package/__cjs/utilities/internal/isExecutionPatchIninitialResult.cjs +5 -1
- package/__cjs/utilities/internal/isExecutionPatchIninitialResult.cjs.map +1 -1
- package/__cjs/utilities/internal/isExecutionPatchIninitialResult.d.cts +5 -1
- package/__cjs/utilities/internal/isExecutionPatchResult.cjs +5 -1
- package/__cjs/utilities/internal/isExecutionPatchResult.cjs.map +1 -1
- package/__cjs/utilities/internal/isExecutionPatchResult.d.cts +5 -1
- package/__cjs/utilities/internal/isField.cjs +5 -1
- package/__cjs/utilities/internal/isField.cjs.map +1 -1
- package/__cjs/utilities/internal/isField.d.cts +5 -1
- package/__cjs/utilities/internal/isNonEmptyArray.cjs +5 -1
- package/__cjs/utilities/internal/isNonEmptyArray.cjs.map +1 -1
- package/__cjs/utilities/internal/isNonEmptyArray.d.cts +5 -1
- package/__cjs/utilities/internal/isNonNullObject.cjs +5 -1
- package/__cjs/utilities/internal/isNonNullObject.cjs.map +1 -1
- package/__cjs/utilities/internal/isNonNullObject.d.cts +5 -1
- package/__cjs/utilities/internal/isPlainObject.cjs +5 -1
- package/__cjs/utilities/internal/isPlainObject.cjs.map +1 -1
- package/__cjs/utilities/internal/isPlainObject.d.cts +5 -1
- package/__cjs/utilities/internal/makeReference.cjs +5 -1
- package/__cjs/utilities/internal/makeReference.cjs.map +1 -1
- package/__cjs/utilities/internal/makeReference.d.cts +5 -1
- package/__cjs/utilities/internal/makeUniqueId.cjs +7 -5
- package/__cjs/utilities/internal/makeUniqueId.cjs.map +1 -1
- package/__cjs/utilities/internal/makeUniqueId.d.cts +7 -5
- package/__cjs/utilities/internal/maybeDeepFreeze.cjs +5 -1
- package/__cjs/utilities/internal/maybeDeepFreeze.cjs.map +1 -1
- package/__cjs/utilities/internal/maybeDeepFreeze.d.cts +5 -1
- package/__cjs/utilities/internal/mergeDeep.cjs +5 -1
- package/__cjs/utilities/internal/mergeDeep.cjs.map +1 -1
- package/__cjs/utilities/internal/mergeDeep.d.cts +5 -1
- package/__cjs/utilities/internal/mergeDeepArray.cjs +5 -1
- package/__cjs/utilities/internal/mergeDeepArray.cjs.map +1 -1
- package/__cjs/utilities/internal/mergeDeepArray.d.cts +5 -1
- package/__cjs/utilities/internal/mergeIncrementalData.cjs +5 -1
- package/__cjs/utilities/internal/mergeIncrementalData.cjs.map +1 -1
- package/__cjs/utilities/internal/mergeIncrementalData.d.cts +5 -1
- package/__cjs/utilities/internal/mergeOptions.cjs +5 -1
- package/__cjs/utilities/internal/mergeOptions.cjs.map +1 -1
- package/__cjs/utilities/internal/mergeOptions.d.cts +5 -1
- package/__cjs/utilities/internal/omitDeep.cjs +5 -1
- package/__cjs/utilities/internal/omitDeep.cjs.map +1 -1
- package/__cjs/utilities/internal/omitDeep.d.cts +5 -1
- package/__cjs/utilities/internal/onAnyEvent.cjs +5 -1
- package/__cjs/utilities/internal/onAnyEvent.cjs.map +1 -1
- package/__cjs/utilities/internal/onAnyEvent.d.cts +5 -1
- package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +5 -1
- package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs.map +1 -1
- package/__cjs/utilities/internal/removeDirectivesFromDocument.d.cts +5 -1
- package/__cjs/utilities/internal/resultKeyNameFromField.cjs +5 -1
- package/__cjs/utilities/internal/resultKeyNameFromField.cjs.map +1 -1
- package/__cjs/utilities/internal/resultKeyNameFromField.d.cts +5 -1
- package/__cjs/utilities/internal/shouldInclude.cjs +5 -1
- package/__cjs/utilities/internal/shouldInclude.cjs.map +1 -1
- package/__cjs/utilities/internal/shouldInclude.d.cts +5 -1
- package/__cjs/utilities/internal/storeKeyNameFromField.cjs +5 -1
- package/__cjs/utilities/internal/storeKeyNameFromField.cjs.map +1 -1
- package/__cjs/utilities/internal/storeKeyNameFromField.d.cts +5 -1
- package/__cjs/utilities/internal/stringifyForDisplay.cjs +5 -1
- package/__cjs/utilities/internal/stringifyForDisplay.cjs.map +1 -1
- package/__cjs/utilities/internal/stringifyForDisplay.d.cts +5 -1
- package/__cjs/utilities/internal/toQueryResult.cjs +5 -1
- package/__cjs/utilities/internal/toQueryResult.cjs.map +1 -1
- package/__cjs/utilities/internal/toQueryResult.d.cts +5 -1
- package/__cjs/utilities/internal/types/DecoratedPromise.d.cts +5 -1
- package/__cjs/utilities/internal/types/DeepOmit.d.cts +5 -1
- package/__cjs/utilities/internal/types/DeepPartial.d.cts +5 -1
- package/__cjs/utilities/internal/types/FragmentMap.d.cts +6 -4
- package/__cjs/utilities/internal/types/FragmentMapFunction.d.cts +5 -1
- package/__cjs/utilities/internal/types/FulfilledPromise.d.cts +5 -1
- package/__cjs/utilities/internal/types/IsAny.d.cts +5 -1
- package/__cjs/utilities/internal/types/PendingPromise.d.cts +5 -1
- package/__cjs/utilities/internal/types/Prettify.d.cts +5 -1
- package/__cjs/utilities/internal/types/Primitive.d.cts +5 -1
- package/__cjs/utilities/internal/types/RejectedPromise.d.cts +5 -1
- package/__cjs/utilities/internal/types/RemoveIndexSignature.d.cts +5 -1
- package/__cjs/utilities/internal/types/VariablesOption.d.cts +5 -1
- package/__cjs/utilities/internal/valueToObjectRepresentation.cjs +5 -1
- package/__cjs/utilities/internal/valueToObjectRepresentation.cjs.map +1 -1
- package/__cjs/utilities/internal/valueToObjectRepresentation.d.cts +5 -1
- package/__cjs/version.cjs +1 -1
- package/cache/core/cache.d.ts +9 -7
- package/cache/core/cache.js +9 -7
- package/cache/core/cache.js.map +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/inMemoryCache.d.ts +9 -7
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/writeToStore.js +4 -4
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +9 -21
- package/core/ApolloClient.js +23 -45
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.d.ts +95 -33
- package/core/ObservableQuery.js +569 -345
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +9 -14
- package/core/QueryInfo.js +109 -179
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +12 -8
- package/core/QueryManager.js +151 -110
- package/core/QueryManager.js.map +1 -1
- package/core/index.d.ts +2 -3
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/core/types.d.ts +18 -6
- package/errors/LinkError.d.ts +5 -1
- package/errors/LinkError.js +5 -1
- package/errors/LinkError.js.map +1 -1
- package/errors/LocalStateError.d.ts +20 -0
- package/errors/LocalStateError.js +23 -0
- package/errors/LocalStateError.js.map +1 -0
- package/errors/index.d.ts +2 -0
- package/errors/index.js +2 -0
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +130 -57
- package/legacyEntryPoints/local-state/index.d.ts +1 -0
- package/legacyEntryPoints/local-state/index.js +1 -0
- package/legacyEntryPoints/local-state/local-state.cjs +1 -0
- package/legacyEntryPoints/local-state/local-state.d.cts +1 -0
- package/link/core/ApolloLink.d.ts +15 -9
- package/link/core/ApolloLink.js +17 -11
- package/link/core/ApolloLink.js.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/createHttpLink.js +1 -1
- package/link/http/parseAndCheckHttpResponse.js +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/utils/transformOperation.js +1 -1
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/local-state/LocalState.d.ts +89 -0
- package/local-state/LocalState.js +527 -0
- package/local-state/LocalState.js.map +1 -0
- package/local-state/index.d.ts +2 -0
- package/local-state/index.js +2 -0
- package/local-state/index.js.map +1 -0
- package/masking/maskFragment.d.ts +5 -1
- package/masking/maskFragment.js +5 -1
- package/masking/maskFragment.js.map +1 -1
- package/masking/maskOperation.d.ts +5 -1
- package/masking/maskOperation.js +5 -1
- package/masking/maskOperation.js.map +1 -1
- package/masking/utils.d.ts +5 -1
- package/masking/utils.js +5 -1
- package/masking/utils.js.map +1 -1
- package/package.json +7 -155
- package/react/hooks/internal/wrapHook.d.ts +42 -38
- package/react/hooks/internal/wrapHook.js +36 -34
- package/react/hooks/internal/wrapHook.js.map +1 -1
- package/react/hooks/useQuery.d.ts +0 -1
- package/react/hooks/useQuery.js +10 -25
- package/react/hooks/useQuery.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +25 -7
- package/react/internal/cache/QueryReference.js +6 -9
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/ssr/prerenderStatic.js +7 -0
- package/react/ssr/prerenderStatic.js.map +1 -1
- package/react/ssr/useSSRQuery.js +11 -2
- package/react/ssr/useSSRQuery.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +29 -22
- package/testing/core/mocking/mockLink.js +9 -10
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +7 -6
- package/testing/core/mocking/mockSubscriptionLink.js +0 -3
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/types/deprecated.d.ts +10 -0
- package/testing/core/types/deprecated.js +2 -0
- package/testing/core/types/deprecated.js.map +1 -0
- package/testing/index.d.ts +3 -2
- package/testing/index.js +2 -1
- package/testing/index.js.map +1 -1
- package/testing/internal/ObservableStream.d.ts +12 -1
- package/testing/internal/ObservableStream.js +13 -1
- package/testing/internal/ObservableStream.js.map +1 -1
- package/testing/internal/disposables/withCleanup.d.ts +5 -1
- package/testing/internal/disposables/withCleanup.js +5 -1
- package/testing/internal/disposables/withCleanup.js.map +1 -1
- package/testing/internal/index.d.ts +1 -0
- package/testing/internal/index.js +2 -1
- package/testing/internal/index.js.map +1 -1
- package/testing/internal/scenarios/index.d.ts +8 -8
- package/testing/internal/scenarios/index.js +4 -4
- package/testing/internal/scenarios/index.js.map +1 -1
- package/testing/{core → internal}/wait.d.ts +0 -1
- package/testing/{core → internal}/wait.js +0 -3
- package/testing/internal/wait.js.map +1 -0
- package/testing/matchers/index.js +2 -2
- package/testing/matchers/index.js.map +1 -1
- package/testing/matchers/toEmitTypedValue.d.ts +6 -1
- package/testing/matchers/toEmitTypedValue.js +1 -1
- package/testing/matchers/toEmitTypedValue.js.map +1 -1
- package/testing/matchers/toRerenderWithSimilarSnapshot.d.ts +13 -6
- package/testing/matchers/toRerenderWithSimilarSnapshot.js +30 -15
- package/testing/matchers/toRerenderWithSimilarSnapshot.js.map +1 -1
- package/testing/matchers/toStrictEqualTyped.d.ts +4 -0
- package/testing/matchers/toStrictEqualTyped.js +1 -1
- package/testing/matchers/toStrictEqualTyped.js.map +1 -1
- package/testing/matchers/utils/getSerializableProperties.js +14 -2
- package/testing/matchers/utils/getSerializableProperties.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +4 -5
- package/testing/react/MockedProvider.js +3 -3
- package/testing/react/MockedProvider.js.map +1 -1
- package/utilities/graphql/DocumentTransform.d.ts +10 -6
- package/utilities/graphql/DocumentTransform.js +10 -6
- package/utilities/graphql/DocumentTransform.js.map +1 -1
- package/utilities/internal/DeepMerger.d.ts +5 -1
- package/utilities/internal/DeepMerger.js +5 -1
- package/utilities/internal/DeepMerger.js.map +1 -1
- package/utilities/internal/argumentsObjectFromField.d.ts +5 -1
- package/utilities/internal/argumentsObjectFromField.js +5 -1
- package/utilities/internal/argumentsObjectFromField.js.map +1 -1
- package/utilities/internal/caches.d.ts +32 -24
- package/utilities/internal/caches.js +24 -20
- package/utilities/internal/caches.js.map +1 -1
- package/utilities/internal/canUseDOM.d.ts +5 -1
- package/utilities/internal/canUseDOM.js +5 -1
- package/utilities/internal/canUseDOM.js.map +1 -1
- package/utilities/internal/checkDocument.d.ts +6 -3
- package/utilities/internal/checkDocument.js +6 -3
- package/utilities/internal/checkDocument.js.map +1 -1
- package/utilities/internal/cloneDeep.d.ts +6 -4
- package/utilities/internal/cloneDeep.js +6 -4
- package/utilities/internal/cloneDeep.js.map +1 -1
- package/utilities/internal/compact.d.ts +7 -5
- package/utilities/internal/compact.js +7 -5
- package/utilities/internal/compact.js.map +1 -1
- package/utilities/internal/createFragmentMap.d.ts +7 -4
- package/utilities/internal/createFragmentMap.js +7 -4
- package/utilities/internal/createFragmentMap.js.map +1 -1
- package/utilities/internal/createFulfilledPromise.d.ts +5 -1
- package/utilities/internal/createFulfilledPromise.js +5 -1
- package/utilities/internal/createFulfilledPromise.js.map +1 -1
- package/utilities/internal/createRejectedPromise.d.ts +5 -1
- package/utilities/internal/createRejectedPromise.js +5 -1
- package/utilities/internal/createRejectedPromise.js.map +1 -1
- package/utilities/internal/dealias.d.ts +5 -0
- package/utilities/internal/dealias.js +18 -0
- package/utilities/internal/dealias.js.map +1 -0
- package/utilities/internal/decoratePromise.d.ts +5 -1
- package/utilities/internal/decoratePromise.js +5 -1
- package/utilities/internal/decoratePromise.js.map +1 -1
- package/utilities/internal/deepFreeze.d.ts +5 -1
- package/utilities/internal/deepFreeze.js +5 -1
- package/utilities/internal/deepFreeze.js.map +1 -1
- package/utilities/internal/filterMap.d.ts +4 -0
- package/utilities/internal/filterMap.js +28 -0
- package/utilities/internal/filterMap.js.map +1 -0
- package/utilities/internal/getDefaultValues.d.ts +5 -1
- package/utilities/internal/getDefaultValues.js +5 -1
- package/utilities/internal/getDefaultValues.js.map +1 -1
- package/utilities/internal/getFragmentDefinition.d.ts +5 -1
- package/utilities/internal/getFragmentDefinition.js +5 -1
- package/utilities/internal/getFragmentDefinition.js.map +1 -1
- package/utilities/internal/getFragmentDefinitions.d.ts +5 -1
- package/utilities/internal/getFragmentDefinitions.js +5 -1
- package/utilities/internal/getFragmentDefinitions.js.map +1 -1
- package/utilities/internal/getFragmentFromSelection.d.ts +5 -1
- package/utilities/internal/getFragmentFromSelection.js +5 -1
- package/utilities/internal/getFragmentFromSelection.js.map +1 -1
- package/utilities/internal/getFragmentQueryDocument.d.ts +25 -23
- package/utilities/internal/getFragmentQueryDocument.js +25 -23
- package/utilities/internal/getFragmentQueryDocument.js.map +1 -1
- package/utilities/internal/getGraphQLErrorsFromResult.d.ts +5 -1
- package/utilities/internal/getGraphQLErrorsFromResult.js +5 -1
- package/utilities/internal/getGraphQLErrorsFromResult.js.map +1 -1
- package/utilities/internal/getMainDefinition.d.ts +8 -6
- package/utilities/internal/getMainDefinition.js +8 -6
- package/utilities/internal/getMainDefinition.js.map +1 -1
- package/utilities/internal/getMemoryInternals.d.ts +15 -9
- package/utilities/internal/getMemoryInternals.js +15 -9
- package/utilities/internal/getMemoryInternals.js.map +1 -1
- package/utilities/internal/getOperationDefinition.d.ts +5 -1
- package/utilities/internal/getOperationDefinition.js +5 -1
- package/utilities/internal/getOperationDefinition.js.map +1 -1
- package/utilities/internal/getOperationName.d.ts +6 -2
- package/utilities/internal/getOperationName.js +7 -5
- package/utilities/internal/getOperationName.js.map +1 -1
- package/utilities/internal/getQueryDefinition.d.ts +5 -1
- package/utilities/internal/getQueryDefinition.js +5 -1
- package/utilities/internal/getQueryDefinition.js.map +1 -1
- package/utilities/internal/getStoreKeyName.d.ts +5 -1
- package/utilities/internal/getStoreKeyName.js +5 -1
- package/utilities/internal/getStoreKeyName.js.map +1 -1
- package/utilities/internal/globals/global.js +2 -2
- package/utilities/internal/globals/global.js.map +1 -1
- package/utilities/internal/graphQLResultHasError.d.ts +5 -1
- package/utilities/internal/graphQLResultHasError.js +5 -1
- package/utilities/internal/graphQLResultHasError.js.map +1 -1
- package/utilities/internal/hasDirectives.d.ts +5 -1
- package/utilities/internal/hasDirectives.js +5 -1
- package/utilities/internal/hasDirectives.js.map +1 -1
- package/utilities/internal/hasForcedResolvers.d.ts +3 -0
- package/utilities/internal/hasForcedResolvers.js +20 -0
- package/utilities/internal/hasForcedResolvers.js.map +1 -0
- package/utilities/internal/index.d.ts +3 -1
- package/utilities/internal/index.js +3 -1
- package/utilities/internal/index.js.map +1 -1
- package/utilities/internal/isArray.d.ts +6 -4
- package/utilities/internal/isArray.js +6 -4
- package/utilities/internal/isArray.js.map +1 -1
- package/utilities/internal/isDocumentNode.d.ts +5 -1
- package/utilities/internal/isDocumentNode.js +5 -1
- package/utilities/internal/isDocumentNode.js.map +1 -1
- package/utilities/internal/isExecutionPatchIncrementalResult.d.ts +5 -1
- package/utilities/internal/isExecutionPatchIncrementalResult.js +5 -1
- package/utilities/internal/isExecutionPatchIncrementalResult.js.map +1 -1
- package/utilities/internal/isExecutionPatchIninitialResult.d.ts +5 -1
- package/utilities/internal/isExecutionPatchIninitialResult.js +5 -1
- package/utilities/internal/isExecutionPatchIninitialResult.js.map +1 -1
- package/utilities/internal/isExecutionPatchResult.d.ts +5 -1
- package/utilities/internal/isExecutionPatchResult.js +5 -1
- package/utilities/internal/isExecutionPatchResult.js.map +1 -1
- package/utilities/internal/isField.d.ts +5 -1
- package/utilities/internal/isField.js +5 -1
- package/utilities/internal/isField.js.map +1 -1
- package/utilities/internal/isNonEmptyArray.d.ts +5 -1
- package/utilities/internal/isNonEmptyArray.js +5 -1
- package/utilities/internal/isNonEmptyArray.js.map +1 -1
- package/utilities/internal/isNonNullObject.d.ts +5 -1
- package/utilities/internal/isNonNullObject.js +5 -1
- package/utilities/internal/isNonNullObject.js.map +1 -1
- package/utilities/internal/isPlainObject.d.ts +5 -1
- package/utilities/internal/isPlainObject.js +5 -1
- package/utilities/internal/isPlainObject.js.map +1 -1
- package/utilities/internal/makeReference.d.ts +5 -1
- package/utilities/internal/makeReference.js +5 -1
- package/utilities/internal/makeReference.js.map +1 -1
- package/utilities/internal/makeUniqueId.d.ts +7 -5
- package/utilities/internal/makeUniqueId.js +7 -5
- package/utilities/internal/makeUniqueId.js.map +1 -1
- package/utilities/internal/maybeDeepFreeze.d.ts +5 -1
- package/utilities/internal/maybeDeepFreeze.js +5 -1
- package/utilities/internal/maybeDeepFreeze.js.map +1 -1
- package/utilities/internal/mergeDeep.d.ts +5 -1
- package/utilities/internal/mergeDeep.js +5 -1
- package/utilities/internal/mergeDeep.js.map +1 -1
- package/utilities/internal/mergeDeepArray.d.ts +5 -1
- package/utilities/internal/mergeDeepArray.js +5 -1
- package/utilities/internal/mergeDeepArray.js.map +1 -1
- package/utilities/internal/mergeIncrementalData.d.ts +5 -1
- package/utilities/internal/mergeIncrementalData.js +5 -1
- package/utilities/internal/mergeIncrementalData.js.map +1 -1
- package/utilities/internal/mergeOptions.d.ts +5 -1
- package/utilities/internal/mergeOptions.js +5 -1
- package/utilities/internal/mergeOptions.js.map +1 -1
- package/utilities/internal/omitDeep.d.ts +5 -1
- package/utilities/internal/omitDeep.js +5 -1
- package/utilities/internal/omitDeep.js.map +1 -1
- package/utilities/internal/onAnyEvent.d.ts +5 -1
- package/utilities/internal/onAnyEvent.js +5 -1
- package/utilities/internal/onAnyEvent.js.map +1 -1
- package/utilities/internal/removeDirectivesFromDocument.d.ts +5 -1
- package/utilities/internal/removeDirectivesFromDocument.js +5 -1
- package/utilities/internal/removeDirectivesFromDocument.js.map +1 -1
- package/utilities/internal/resultKeyNameFromField.d.ts +5 -1
- package/utilities/internal/resultKeyNameFromField.js +5 -1
- package/utilities/internal/resultKeyNameFromField.js.map +1 -1
- package/utilities/internal/shouldInclude.d.ts +5 -1
- package/utilities/internal/shouldInclude.js +5 -1
- package/utilities/internal/shouldInclude.js.map +1 -1
- package/utilities/internal/storeKeyNameFromField.d.ts +5 -1
- package/utilities/internal/storeKeyNameFromField.js +5 -1
- package/utilities/internal/storeKeyNameFromField.js.map +1 -1
- package/utilities/internal/stringifyForDisplay.d.ts +5 -1
- package/utilities/internal/stringifyForDisplay.js +5 -1
- package/utilities/internal/stringifyForDisplay.js.map +1 -1
- package/utilities/internal/toQueryResult.d.ts +5 -1
- package/utilities/internal/toQueryResult.js +5 -1
- package/utilities/internal/toQueryResult.js.map +1 -1
- package/utilities/internal/types/DecoratedPromise.d.ts +5 -1
- package/utilities/internal/types/DeepOmit.d.ts +5 -1
- package/utilities/internal/types/DeepPartial.d.ts +5 -1
- package/utilities/internal/types/FragmentMap.d.ts +6 -4
- package/utilities/internal/types/FragmentMapFunction.d.ts +5 -1
- package/utilities/internal/types/FulfilledPromise.d.ts +5 -1
- package/utilities/internal/types/IsAny.d.ts +5 -1
- package/utilities/internal/types/PendingPromise.d.ts +5 -1
- package/utilities/internal/types/Prettify.d.ts +5 -1
- package/utilities/internal/types/Primitive.d.ts +5 -1
- package/utilities/internal/types/RejectedPromise.d.ts +5 -1
- package/utilities/internal/types/RemoveIndexSignature.d.ts +5 -1
- package/utilities/internal/types/VariablesOption.d.ts +5 -1
- package/utilities/internal/valueToObjectRepresentation.d.ts +5 -1
- package/utilities/internal/valueToObjectRepresentation.js +5 -1
- package/utilities/internal/valueToObjectRepresentation.js.map +1 -1
- package/version.js +1 -1
- package/__cjs/core/LocalState.cjs +0 -355
- package/__cjs/core/LocalState.cjs.map +0 -1
- package/__cjs/core/LocalState.d.cts +0 -53
- package/__cjs/testing/core/index.cjs +0 -20
- package/__cjs/testing/core/index.cjs.map +0 -1
- package/__cjs/testing/core/index.d.cts +0 -7
- package/__cjs/testing/core/mocking/mockClient.cjs +0 -17
- package/__cjs/testing/core/mocking/mockClient.cjs.map +0 -1
- package/__cjs/testing/core/mocking/mockClient.d.cts +0 -4
- package/__cjs/testing/core/wait.cjs.map +0 -1
- package/__cjs/testing/core/withConsoleSpy.cjs +0 -33
- package/__cjs/testing/core/withConsoleSpy.cjs.map +0 -1
- package/__cjs/testing/core/withConsoleSpy.d.cts +0 -7
- package/__cjs/utilities/internal/removeClientSetsFromDocument.cjs +0 -21
- package/__cjs/utilities/internal/removeClientSetsFromDocument.cjs.map +0 -1
- package/__cjs/utilities/internal/removeClientSetsFromDocument.d.cts +0 -8
- package/core/LocalState.d.ts +0 -53
- package/core/LocalState.js +0 -351
- package/core/LocalState.js.map +0 -1
- package/legacyEntryPoints/testing/core/core.cjs +0 -1
- package/legacyEntryPoints/testing/core/core.d.cts +0 -1
- package/legacyEntryPoints/testing/core/index.d.ts +0 -1
- package/legacyEntryPoints/testing/core/index.js +0 -1
- package/testing/core/index.d.ts +0 -7
- package/testing/core/index.js +0 -6
- package/testing/core/index.js.map +0 -1
- package/testing/core/mocking/mockClient.d.ts +0 -4
- package/testing/core/mocking/mockClient.js +0 -14
- package/testing/core/mocking/mockClient.js.map +0 -1
- package/testing/core/wait.js.map +0 -1
- package/testing/core/withConsoleSpy.d.ts +0 -7
- package/testing/core/withConsoleSpy.js +0 -28
- package/testing/core/withConsoleSpy.js.map +0 -1
- package/utilities/internal/removeClientSetsFromDocument.d.ts +0 -8
- package/utilities/internal/removeClientSetsFromDocument.js +0 -18
- package/utilities/internal/removeClientSetsFromDocument.js.map +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
`ObservableQuery` will now keep previous `data` around when emitting a `loading` state, unless `query` or `variables` changed.
|
|
6
|
+
Note that `@exports` variables are not taken into account for this, so `data` will stay around even if they change.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": minor
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Revamp local resolvers and fix several issues from the existing `resolvers` option.
|
|
6
|
+
- Throwing errors in a resolver will set the field value as `null` and add an error to the response's `errors` array.
|
|
7
|
+
- Remote results are dealiased before they are passed as the parent object to a resolver so that you can access fields by their field name.
|
|
8
|
+
- You can now specify a `context` function that you can use to customize the `requestContext` given to resolvers.
|
|
9
|
+
- The `LocalState` class accepts a `Resolvers` generic that provides autocompletion and type checking against your resolver types to ensure your resolvers are type-safe.
|
|
10
|
+
- `data: null` is now handled correctly and does not call your local resolvers when the server does not provide a result.
|
|
11
|
+
- Additional warnings have been added to provide hints when resolvers behave unexpectedly.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { LocalState } from "@apollo/client/local-state";
|
|
15
|
+
|
|
16
|
+
import { Resolvers } from "./path/to/local-resolvers-types.ts";
|
|
17
|
+
|
|
18
|
+
// LocalState now accepts a `Resolvers` generic.
|
|
19
|
+
const localState = new LocalState<Resolvers>({
|
|
20
|
+
// The return value of this funciton
|
|
21
|
+
context: (options) => ({
|
|
22
|
+
// ...
|
|
23
|
+
}),
|
|
24
|
+
resolvers: {
|
|
25
|
+
// ...
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// You may also pass a `ContextValue` generic used to ensure the `context`
|
|
30
|
+
// function returns the correct type. This type is inferred from your resolvers
|
|
31
|
+
// if not provided.
|
|
32
|
+
new LocalState<Resolvers, ContextValue>({
|
|
33
|
+
// ...
|
|
34
|
+
});
|
|
35
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Removes the `resolvers` option from `ApolloClient`. Local resolvers have instead been moved to the new `LocalState` instance which is assigned to the `localState` option in `ApolloClient`. To migrate, move the `resolvers` values into a `LocalState` instance and assign that instance to `localState`.
|
|
6
|
+
|
|
7
|
+
```diff
|
|
8
|
+
new ApolloClient({
|
|
9
|
+
- resolvers: { /* ... */ }
|
|
10
|
+
+ localState: new LocalState({
|
|
11
|
+
+ resolvers: { /* ... */ }
|
|
12
|
+
+ }),
|
|
13
|
+
});
|
|
14
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": minor
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Move `MockLink` types to `MockLink` namespace. This affects the `MockedResponse`, `MockLinkOptions`, and `ResultFunction` types. These types are still exported but are deprecated in favor of the namespace. To migrate, use the types on the `MockLink` namespace instead.
|
|
6
|
+
|
|
7
|
+
```diff
|
|
8
|
+
import {
|
|
9
|
+
- MockedResponse,
|
|
10
|
+
- MockLinkOptions,
|
|
11
|
+
- ResultFunction,
|
|
12
|
+
+ MockLink
|
|
13
|
+
} from "@apollo/client/testing";
|
|
14
|
+
|
|
15
|
+
- const mocks: MockedResponse = [];
|
|
16
|
+
+ const mocks: MockLink.MockedResponse = [];
|
|
17
|
+
|
|
18
|
+
- const result: ResultFunction = () => {/* ... */ }
|
|
19
|
+
+ const result: MockLink.ResultFunction = () => {/* ... */ }
|
|
20
|
+
|
|
21
|
+
- const options: MockLinkOptions = {}
|
|
22
|
+
+ const options: MockLink.Options = {}
|
|
23
|
+
```
|
package/.changeset/pre.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"afraid-grapes-call",
|
|
9
9
|
"afraid-moons-arrive",
|
|
10
10
|
"beige-mirrors-talk",
|
|
11
|
+
"beige-spiders-hope",
|
|
11
12
|
"brave-moons-juggle",
|
|
12
13
|
"brave-radios-wait",
|
|
13
14
|
"bright-ads-share",
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
"cool-bikes-shake",
|
|
20
21
|
"cool-kiwis-hunt",
|
|
21
22
|
"cuddly-spiders-tie",
|
|
23
|
+
"curvy-flies-accept",
|
|
22
24
|
"curvy-pianos-count",
|
|
23
25
|
"dirty-cobras-change",
|
|
24
26
|
"dirty-eagles-poke",
|
|
@@ -27,6 +29,7 @@
|
|
|
27
29
|
"eighty-squids-fix",
|
|
28
30
|
"eleven-kangaroos-jump",
|
|
29
31
|
"empty-rabbits-move",
|
|
32
|
+
"few-crabs-move",
|
|
30
33
|
"fluffy-shoes-applaud",
|
|
31
34
|
"forty-hairs-occur",
|
|
32
35
|
"forty-shrimps-fry",
|
|
@@ -35,6 +38,7 @@
|
|
|
35
38
|
"four-ghosts-watch",
|
|
36
39
|
"fresh-moose-hope",
|
|
37
40
|
"friendly-olives-refuse",
|
|
41
|
+
"funny-boats-wink",
|
|
38
42
|
"funny-jeans-invent",
|
|
39
43
|
"funny-terms-deny",
|
|
40
44
|
"fuzzy-seahorses-hunt",
|
|
@@ -43,6 +47,7 @@
|
|
|
43
47
|
"gentle-waves-cough",
|
|
44
48
|
"giant-apes-thank",
|
|
45
49
|
"giant-bags-share",
|
|
50
|
+
"gold-oranges-double",
|
|
46
51
|
"good-dolphins-peel",
|
|
47
52
|
"gorgeous-chefs-tap",
|
|
48
53
|
"great-roses-jog",
|
|
@@ -62,6 +67,7 @@
|
|
|
62
67
|
"light-apes-rescue",
|
|
63
68
|
"light-dolphins-taste",
|
|
64
69
|
"light-sloths-end",
|
|
70
|
+
"little-parrots-bow",
|
|
65
71
|
"little-spoons-kick",
|
|
66
72
|
"loud-cows-raise",
|
|
67
73
|
"lucky-hats-push",
|
|
@@ -81,11 +87,13 @@
|
|
|
81
87
|
"ninety-bags-bake",
|
|
82
88
|
"odd-chicken-hide",
|
|
83
89
|
"odd-lemons-relax",
|
|
90
|
+
"olive-cougars-ring",
|
|
84
91
|
"orange-suits-laugh",
|
|
85
92
|
"perfect-ducks-reflect",
|
|
86
93
|
"perfect-vans-give",
|
|
87
94
|
"polite-bees-care",
|
|
88
95
|
"poor-eels-punch",
|
|
96
|
+
"poor-spiders-hunt",
|
|
89
97
|
"popular-games-sleep",
|
|
90
98
|
"purple-bears-flash",
|
|
91
99
|
"purple-lions-cough",
|
|
@@ -95,6 +103,8 @@
|
|
|
95
103
|
"rich-eagles-cross",
|
|
96
104
|
"rich-kids-carry",
|
|
97
105
|
"rude-fans-study",
|
|
106
|
+
"selfish-spoons-approve",
|
|
107
|
+
"serious-items-develop",
|
|
98
108
|
"serious-moons-juggle",
|
|
99
109
|
"seven-dragons-repair",
|
|
100
110
|
"seven-foxes-melt",
|
|
@@ -106,6 +116,8 @@
|
|
|
106
116
|
"short-tomatoes-attend",
|
|
107
117
|
"silly-knives-exist",
|
|
108
118
|
"silly-seas-confess",
|
|
119
|
+
"sixty-bats-cry",
|
|
120
|
+
"slimy-ants-bake",
|
|
109
121
|
"slimy-chicken-melt",
|
|
110
122
|
"slimy-maps-press",
|
|
111
123
|
"slow-ravens-explain",
|
|
@@ -117,9 +129,15 @@
|
|
|
117
129
|
"smooth-coins-collect",
|
|
118
130
|
"smooth-pens-reply",
|
|
119
131
|
"soft-mails-clean",
|
|
132
|
+
"sour-colts-tell",
|
|
133
|
+
"sour-guests-poke",
|
|
120
134
|
"sour-kids-deliver",
|
|
121
135
|
"sour-pillows-guess",
|
|
136
|
+
"spotty-mugs-poke",
|
|
122
137
|
"strange-seahorses-impress",
|
|
138
|
+
"strange-walls-march",
|
|
139
|
+
"strong-rivers-fry",
|
|
140
|
+
"stupid-pumpkins-travel",
|
|
123
141
|
"swift-rivers-share",
|
|
124
142
|
"tall-bikes-develop",
|
|
125
143
|
"tall-cups-suffer",
|
|
@@ -128,6 +146,7 @@
|
|
|
128
146
|
"tender-swans-flash",
|
|
129
147
|
"thick-books-grin",
|
|
130
148
|
"thin-peas-hear",
|
|
149
|
+
"thirty-pens-jump",
|
|
131
150
|
"tidy-pandas-punch",
|
|
132
151
|
"tidy-squids-poke",
|
|
133
152
|
"tough-rockets-allow",
|
|
@@ -139,6 +158,7 @@
|
|
|
139
158
|
"unlucky-sheep-change",
|
|
140
159
|
"warm-ties-sit",
|
|
141
160
|
"wicked-forks-double",
|
|
161
|
+
"wicked-kiwis-buy",
|
|
142
162
|
"witty-paws-marry",
|
|
143
163
|
"yellow-cats-judge",
|
|
144
164
|
"young-phones-fold",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Move internal testing utilities in `@apollo/client/testing` to `@apollo/client/testing/internal` and remove deprecated testing utilities. Some of the testing utilities exported from the `@apollo/client/testing` endpoint were not considered stable. As a result of this change, testing utilities or types exported from `@apollo/client/testing` are now considered stable and will not undergo breaking changes.
|
|
6
|
+
|
|
7
|
+
The following APIs were removed. To migrate, update usages of the following APIs as such:
|
|
8
|
+
|
|
9
|
+
**`createMockClient`**
|
|
10
|
+
|
|
11
|
+
```diff
|
|
12
|
+
- const client = createMockClient(data, query, variables);
|
|
13
|
+
+ const client = new ApolloClient({
|
|
14
|
+
+ cache: new InMemoryCache(),
|
|
15
|
+
+ link: new MockLink([
|
|
16
|
+
+ {
|
|
17
|
+
+ request: { query, variables },
|
|
18
|
+
+ result: { data },
|
|
19
|
+
+ }
|
|
20
|
+
+ ]),
|
|
21
|
+
+ });
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**`mockObservableLink`**
|
|
25
|
+
|
|
26
|
+
```diff
|
|
27
|
+
- const link = mockObservableLink();
|
|
28
|
+
+ const link = new MockSubscriptionLink();
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**`mockSingleLink`**
|
|
32
|
+
|
|
33
|
+
```diff
|
|
34
|
+
- const link = mockSingleLink({
|
|
35
|
+
- request: { query, variables },
|
|
36
|
+
- result: { data },
|
|
37
|
+
- });
|
|
38
|
+
+ const link = new MockLink([
|
|
39
|
+
+ {
|
|
40
|
+
+ request: { query, variables },
|
|
41
|
+
+ result: { data },
|
|
42
|
+
+ }
|
|
43
|
+
+ ]);
|
|
44
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Third-party caches must now implement the `fragmentMatches` API. Additionally `fragmentMatches` must be able to handle both `InlineFragmentNode` and `FragmentDefinitionNode` nodes.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
class MyCache extends ApolloCache {
|
|
9
|
+
// This is now required
|
|
10
|
+
public fragmentMatches(
|
|
11
|
+
fragment: InlineFragmentNode | FragmentDefinitionNode,
|
|
12
|
+
typename: string
|
|
13
|
+
): boolean {
|
|
14
|
+
return // ... logic to determine if typename matches fragment
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Reworked the logic for then a loading state is triggered. If the link chain responds synchronously, a loading state will be omitted, otherwise it will be triggered.
|
|
6
|
+
If local resolvers are used, the time window for "sync vs async" starts as soon as `@exports` variables are resolved.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
The resolver function's `context` argument (the 3rd argument) has changed to provide additional information without the possibility of name clashes. Previously the `context` argument would spread request context and override the `client` and `cache` properties to give access to both inside of a resolver. The `context` argument takes now takes the following shape:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
{
|
|
9
|
+
// the request context. By default `TContextValue` is of type `DefaultContext`,
|
|
10
|
+
// but can be changed if a `context` function is provided.
|
|
11
|
+
requestContext: TContextValue,
|
|
12
|
+
// The client instance making the request
|
|
13
|
+
client: ApolloClient,
|
|
14
|
+
// Whether the resolver is run as a result of gathering exported variables
|
|
15
|
+
// or resolving the value as part of the result
|
|
16
|
+
phase: "exports" | "resolve"
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
To migrate, pull any request context from `requestContext` and the `cache` from the `client` property:
|
|
21
|
+
|
|
22
|
+
```diff
|
|
23
|
+
new LocalState({
|
|
24
|
+
resolvers: {
|
|
25
|
+
Query: {
|
|
26
|
+
- myResolver: (parent, args, { someValue, cache }) => {
|
|
27
|
+
+ myResolver: (parent, args, { requestContext, client }) => {
|
|
28
|
+
+ const someValue = requestContext.someValue;
|
|
29
|
+
+ const cache = client.cache;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
"@apollo/client": major
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Apollo Client no longer ships with support for `@client` fields out-of-the-box and now must be opt-in. To opt in to use `@client` fields, pass an instantiated `LocalState` instance to the `localState` option. If a query contains `@client` and local state hasn't been configured, an error will be thrown.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { LocalState } from "@apollo/client/local-state";
|
|
9
|
+
|
|
10
|
+
new ApolloClient({
|
|
11
|
+
localState: new LocalState(),
|
|
12
|
+
});
|
|
13
|
+
```
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,212 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 4.0.0-alpha.15
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#12639](https://github.com/apollographql/apollo-client/pull/12639) [`1bdf489`](https://github.com/apollographql/apollo-client/commit/1bdf4893abb173c97877c71012afa15f9d3da8e6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Move internal testing utilities in `@apollo/client/testing` to `@apollo/client/testing/internal` and remove deprecated testing utilities. Some of the testing utilities exported from the `@apollo/client/testing` endpoint were not considered stable. As a result of this change, testing utilities or types exported from `@apollo/client/testing` are now considered stable and will not undergo breaking changes.
|
|
8
|
+
|
|
9
|
+
The following APIs were removed. To migrate, update usages of the following APIs as such:
|
|
10
|
+
|
|
11
|
+
**`createMockClient`**
|
|
12
|
+
|
|
13
|
+
```diff
|
|
14
|
+
- const client = createMockClient(data, query, variables);
|
|
15
|
+
+ const client = new ApolloClient({
|
|
16
|
+
+ cache: new InMemoryCache(),
|
|
17
|
+
+ link: new MockLink([
|
|
18
|
+
+ {
|
|
19
|
+
+ request: { query, variables },
|
|
20
|
+
+ result: { data },
|
|
21
|
+
+ }
|
|
22
|
+
+ ]),
|
|
23
|
+
+ });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**`mockObservableLink`**
|
|
27
|
+
|
|
28
|
+
```diff
|
|
29
|
+
- const link = mockObservableLink();
|
|
30
|
+
+ const link = new MockSubscriptionLink();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**`mockSingleLink`**
|
|
34
|
+
|
|
35
|
+
```diff
|
|
36
|
+
- const link = mockSingleLink({
|
|
37
|
+
- request: { query, variables },
|
|
38
|
+
- result: { data },
|
|
39
|
+
- });
|
|
40
|
+
+ const link = new MockLink([
|
|
41
|
+
+ {
|
|
42
|
+
+ request: { query, variables },
|
|
43
|
+
+ result: { data },
|
|
44
|
+
+ }
|
|
45
|
+
+ ]);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- [#12637](https://github.com/apollographql/apollo-client/pull/12637) [`d2a60d4`](https://github.com/apollographql/apollo-client/commit/d2a60d45e734a2518dad2443f85d82553cd6456a) Thanks [@phryneas](https://github.com/phryneas)! - `useQuery`: only advance `previousData` if `data` actually changed
|
|
49
|
+
|
|
50
|
+
- [#12631](https://github.com/apollographql/apollo-client/pull/12631) [`b147cac`](https://github.com/apollographql/apollo-client/commit/b147cac5c96c44bfc3deb72c12c7521981584c12) Thanks [@phryneas](https://github.com/phryneas)! - `ObservableQuery` will now return a `loading: false` state for `fetchPolicy` `standby`, even before subscription
|
|
51
|
+
|
|
52
|
+
- [#12639](https://github.com/apollographql/apollo-client/pull/12639) [`1bdf489`](https://github.com/apollographql/apollo-client/commit/1bdf4893abb173c97877c71012afa15f9d3da8e6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove the `@apollo/client/testing/core` entrypoint in favor of `@apollo/client/testing`.
|
|
53
|
+
|
|
54
|
+
### Minor Changes
|
|
55
|
+
|
|
56
|
+
- [#12639](https://github.com/apollographql/apollo-client/pull/12639) [`1bdf489`](https://github.com/apollographql/apollo-client/commit/1bdf4893abb173c97877c71012afa15f9d3da8e6) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Move `MockLink` types to `MockLink` namespace. This affects the `MockedResponse`, `MockLinkOptions`, and `ResultFunction` types. These types are still exported but are deprecated in favor of the namespace. To migrate, use the types on the `MockLink` namespace instead.
|
|
57
|
+
|
|
58
|
+
```diff
|
|
59
|
+
import {
|
|
60
|
+
- MockedResponse,
|
|
61
|
+
- MockLinkOptions,
|
|
62
|
+
- ResultFunction,
|
|
63
|
+
+ MockLink
|
|
64
|
+
} from "@apollo/client/testing";
|
|
65
|
+
|
|
66
|
+
- const mocks: MockedResponse = [];
|
|
67
|
+
+ const mocks: MockLink.MockedResponse = [];
|
|
68
|
+
|
|
69
|
+
- const result: ResultFunction = () => {/* ... */ }
|
|
70
|
+
+ const result: MockLink.ResultFunction = () => {/* ... */ }
|
|
71
|
+
|
|
72
|
+
- const options: MockLinkOptions = {}
|
|
73
|
+
+ const options: MockLink.Options = {}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- [#12631](https://github.com/apollographql/apollo-client/pull/12631) [`b147cac`](https://github.com/apollographql/apollo-client/commit/b147cac5c96c44bfc3deb72c12c7521981584c12) Thanks [@phryneas](https://github.com/phryneas)! - When updating `skip` from `false` to `true` in `useQuery`, retain `data` if it is available rather than setting it to `undefined`.
|
|
79
|
+
|
|
80
|
+
- [#12631](https://github.com/apollographql/apollo-client/pull/12631) [`b147cac`](https://github.com/apollographql/apollo-client/commit/b147cac5c96c44bfc3deb72c12c7521981584c12) Thanks [@phryneas](https://github.com/phryneas)! - The `error` property is no longer present when `skip` is `true` in `useQuery`.
|
|
81
|
+
|
|
82
|
+
## 4.0.0-alpha.14
|
|
83
|
+
|
|
84
|
+
### Major Changes
|
|
85
|
+
|
|
86
|
+
- [#12614](https://github.com/apollographql/apollo-client/pull/12614) [`d2851e2`](https://github.com/apollographql/apollo-client/commit/d2851e2c74541995760a86904b1e3ab4bd736e62) Thanks [@jerelmiller](https://github.com/jerelmiller)! - The `getCacheKey` function is no longer available from `operation.getContext()` in the link chain. Use `operation.client.cache.identify(obj)` in the link chain instead.
|
|
87
|
+
|
|
88
|
+
- [#12556](https://github.com/apollographql/apollo-client/pull/12556) [`c3fceda`](https://github.com/apollographql/apollo-client/commit/c3fceda86c5e0f499d0b5fa54ea7dc4c4391ae2c) Thanks [@phryneas](https://github.com/phryneas)! - `ObservableQuery` will now keep previous `data` around when emitting a `loading` state, unless `query` or `variables` changed.
|
|
89
|
+
Note that `@exports` variables are not taken into account for this, so `data` will stay around even if they change.
|
|
90
|
+
|
|
91
|
+
- [#12556](https://github.com/apollographql/apollo-client/pull/12556) [`c3fceda`](https://github.com/apollographql/apollo-client/commit/c3fceda86c5e0f499d0b5fa54ea7dc4c4391ae2c) Thanks [@phryneas](https://github.com/phryneas)! - Removed `getLastResult`, `getLastError` and `resetLastResults` from `ObservableQuery`
|
|
92
|
+
|
|
93
|
+
- [#12614](https://github.com/apollographql/apollo-client/pull/12614) [`d2851e2`](https://github.com/apollographql/apollo-client/commit/d2851e2c74541995760a86904b1e3ab4bd736e62) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Removes the `resolvers` option from `ApolloClient`. Local resolvers have instead been moved to the new `LocalState` instance which is assigned to the `localState` option in `ApolloClient`. To migrate, move the `resolvers` values into a `LocalState` instance and assign that instance to `localState`.
|
|
94
|
+
|
|
95
|
+
```diff
|
|
96
|
+
new ApolloClient({
|
|
97
|
+
- resolvers: { /* ... */ }
|
|
98
|
+
+ localState: new LocalState({
|
|
99
|
+
+ resolvers: { /* ... */ }
|
|
100
|
+
+ }),
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- [#12614](https://github.com/apollographql/apollo-client/pull/12614) [`d2851e2`](https://github.com/apollographql/apollo-client/commit/d2851e2c74541995760a86904b1e3ab4bd736e62) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove local resolvers APIs from `ApolloClient` in favor of `localState`. Methods removed are:
|
|
105
|
+
|
|
106
|
+
- `addResolvers`
|
|
107
|
+
- `getResolvers`
|
|
108
|
+
- `setResolvers`
|
|
109
|
+
- `setLocalStateFragmentMatcher`
|
|
110
|
+
|
|
111
|
+
- [#12614](https://github.com/apollographql/apollo-client/pull/12614) [`d2851e2`](https://github.com/apollographql/apollo-client/commit/d2851e2c74541995760a86904b1e3ab4bd736e62) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Third-party caches must now implement the `fragmentMatches` API. Additionally `fragmentMatches` must be able to handle both `InlineFragmentNode` and `FragmentDefinitionNode` nodes.
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
class MyCache extends ApolloCache {
|
|
115
|
+
// This is now required
|
|
116
|
+
public fragmentMatches(
|
|
117
|
+
fragment: InlineFragmentNode | FragmentDefinitionNode,
|
|
118
|
+
typename: string
|
|
119
|
+
): boolean {
|
|
120
|
+
return; // ... logic to determine if typename matches fragment
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
- [#12556](https://github.com/apollographql/apollo-client/pull/12556) [`c3fceda`](https://github.com/apollographql/apollo-client/commit/c3fceda86c5e0f499d0b5fa54ea7dc4c4391ae2c) Thanks [@phryneas](https://github.com/phryneas)! - Reworked the logic for then a loading state is triggered. If the link chain responds synchronously, a loading state will be omitted, otherwise it will be triggered.
|
|
126
|
+
If local resolvers are used, the time window for "sync vs async" starts as soon as `@exports` variables are resolved.
|
|
127
|
+
|
|
128
|
+
- [#12556](https://github.com/apollographql/apollo-client/pull/12556) [`c3fceda`](https://github.com/apollographql/apollo-client/commit/c3fceda86c5e0f499d0b5fa54ea7dc4c4391ae2c) Thanks [@phryneas](https://github.com/phryneas)! - Dropped the `saveAsLastResult` argument from `ObservableQuery.getCurrentResult`
|
|
129
|
+
|
|
130
|
+
- [#12614](https://github.com/apollographql/apollo-client/pull/12614) [`d2851e2`](https://github.com/apollographql/apollo-client/commit/d2851e2c74541995760a86904b1e3ab4bd736e62) Thanks [@jerelmiller](https://github.com/jerelmiller)! - The resolver function's `context` argument (the 3rd argument) has changed to provide additional information without the possibility of name clashes. Previously the `context` argument would spread request context and override the `client` and `cache` properties to give access to both inside of a resolver. The `context` argument takes now takes the following shape:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
{
|
|
134
|
+
// the request context. By default `TContextValue` is of type `DefaultContext`,
|
|
135
|
+
// but can be changed if a `context` function is provided.
|
|
136
|
+
requestContext: TContextValue,
|
|
137
|
+
// The client instance making the request
|
|
138
|
+
client: ApolloClient,
|
|
139
|
+
// Whether the resolver is run as a result of gathering exported variables
|
|
140
|
+
// or resolving the value as part of the result
|
|
141
|
+
phase: "exports" | "resolve"
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
To migrate, pull any request context from `requestContext` and the `cache` from the `client` property:
|
|
146
|
+
|
|
147
|
+
```diff
|
|
148
|
+
new LocalState({
|
|
149
|
+
resolvers: {
|
|
150
|
+
Query: {
|
|
151
|
+
- myResolver: (parent, args, { someValue, cache }) => {
|
|
152
|
+
+ myResolver: (parent, args, { requestContext, client }) => {
|
|
153
|
+
+ const someValue = requestContext.someValue;
|
|
154
|
+
+ const cache = client.cache;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- [#12614](https://github.com/apollographql/apollo-client/pull/12614) [`d2851e2`](https://github.com/apollographql/apollo-client/commit/d2851e2c74541995760a86904b1e3ab4bd736e62) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Apollo Client no longer ships with support for `@client` fields out-of-the-box and now must be opt-in. To opt in to use `@client` fields, pass an instantiated `LocalState` instance to the `localState` option. If a query contains `@client` and local state hasn't been configured, an error will be thrown.
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
import { LocalState } from "@apollo/client/local-state";
|
|
165
|
+
|
|
166
|
+
new ApolloClient({
|
|
167
|
+
localState: new LocalState(),
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
- [#12614](https://github.com/apollographql/apollo-client/pull/12614) [`d2851e2`](https://github.com/apollographql/apollo-client/commit/d2851e2c74541995760a86904b1e3ab4bd736e62) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove the `fragmentMatcher` option from `ApolloClient`. Custom fragment matchers used with local state are no longer supported. Fragment matching is now performed by the configured `cache` via the `cache.fragmentMatches` API.
|
|
172
|
+
|
|
173
|
+
- [#12556](https://github.com/apollographql/apollo-client/pull/12556) [`c3fceda`](https://github.com/apollographql/apollo-client/commit/c3fceda86c5e0f499d0b5fa54ea7dc4c4391ae2c) Thanks [@phryneas](https://github.com/phryneas)! - A call to `ObservableQuery.setVariables` with different variables or a `ObservableQuery.refetch` call will always now guarantee that a value will be emitted from the observable, even if it is deep equal to the previous value.
|
|
174
|
+
|
|
175
|
+
### Minor Changes
|
|
176
|
+
|
|
177
|
+
- [#12614](https://github.com/apollographql/apollo-client/pull/12614) [`d2851e2`](https://github.com/apollographql/apollo-client/commit/d2851e2c74541995760a86904b1e3ab4bd736e62) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Revamp local resolvers and fix several issues from the existing `resolvers` option.
|
|
178
|
+
|
|
179
|
+
- Throwing errors in a resolver will set the field value as `null` and add an error to the response's `errors` array.
|
|
180
|
+
- Remote results are dealiased before they are passed as the parent object to a resolver so that you can access fields by their field name.
|
|
181
|
+
- You can now specify a `context` function that you can use to customize the `requestContext` given to resolvers.
|
|
182
|
+
- The `LocalState` class accepts a `Resolvers` generic that provides autocompletion and type checking against your resolver types to ensure your resolvers are type-safe.
|
|
183
|
+
- `data: null` is now handled correctly and does not call your local resolvers when the server does not provide a result.
|
|
184
|
+
- Additional warnings have been added to provide hints when resolvers behave unexpectedly.
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
import { LocalState } from "@apollo/client/local-state";
|
|
188
|
+
|
|
189
|
+
import { Resolvers } from "./path/to/local-resolvers-types.ts";
|
|
190
|
+
|
|
191
|
+
// LocalState now accepts a `Resolvers` generic.
|
|
192
|
+
const localState = new LocalState<Resolvers>({
|
|
193
|
+
// The return value of this funciton
|
|
194
|
+
context: (options) => ({
|
|
195
|
+
// ...
|
|
196
|
+
}),
|
|
197
|
+
resolvers: {
|
|
198
|
+
// ...
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// You may also pass a `ContextValue` generic used to ensure the `context`
|
|
203
|
+
// function returns the correct type. This type is inferred from your resolvers
|
|
204
|
+
// if not provided.
|
|
205
|
+
new LocalState<Resolvers, ContextValue>({
|
|
206
|
+
// ...
|
|
207
|
+
});
|
|
208
|
+
```
|
|
209
|
+
|
|
3
210
|
## 4.0.0-alpha.13
|
|
4
211
|
|
|
5
212
|
### Major Changes
|
|
@@ -1015,6 +1222,12 @@
|
|
|
1015
1222
|
|
|
1016
1223
|
- [#12384](https://github.com/apollographql/apollo-client/pull/12384) [`6aa6fd3`](https://github.com/apollographql/apollo-client/commit/6aa6fd316cfdb31ebbe3e3133cca2965604e7ca1) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Don't emit a partial cache result from `cache-only` queries when `returnPartialData` is `false`.
|
|
1017
1224
|
|
|
1225
|
+
## 3.13.8
|
|
1226
|
+
|
|
1227
|
+
### Patch Changes
|
|
1228
|
+
|
|
1229
|
+
- [#12567](https://github.com/apollographql/apollo-client/pull/12567) [`c19d415`](https://github.com/apollographql/apollo-client/commit/c19d41513cac0cc143aa7358f26c89c9408da102) Thanks [@thearchitector](https://github.com/thearchitector)! - Fix in-flight multipart urql subscription cancellation
|
|
1230
|
+
|
|
1018
1231
|
## 3.13.7
|
|
1019
1232
|
|
|
1020
1233
|
### Patch Changes
|
|
@@ -94,7 +94,7 @@ class ApolloCache {
|
|
|
94
94
|
if (environment_1.__DEV__) {
|
|
95
95
|
const actualFragmentName = fragmentName || (0, internal_1.getFragmentDefinition)(fragment).name.value;
|
|
96
96
|
if (!id) {
|
|
97
|
-
__DEV__ && invariant_1.invariant.warn(
|
|
97
|
+
__DEV__ && invariant_1.invariant.warn(109, actualFragmentName);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
const diffOptions = {
|
|
@@ -193,12 +193,14 @@ class ApolloCache {
|
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
/**
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
* @experimental
|
|
197
|
+
* @internal
|
|
198
|
+
* This is not a stable API - it is used in development builds to expose
|
|
199
|
+
* information to the DevTools.
|
|
200
|
+
* Use at your own risk!
|
|
201
|
+
*
|
|
202
|
+
* @deprecated This is an internal API and should not be used directly. This can be removed or changed at any time.
|
|
203
|
+
*/
|
|
202
204
|
getMemoryInternals;
|
|
203
205
|
}
|
|
204
206
|
exports.ApolloCache = ApolloCache;
|