@apollo/client 3.8.0-alpha.12 → 3.8.0-alpha.14
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/apollo-client.cjs +272 -215
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +1 -1
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +1 -1
- package/cache/core/cache.d.ts +4 -4
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +2 -2
- package/cache/core/types/Cache.d.ts.map +1 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +4 -4
- 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 +3 -3
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +5 -5
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.d.ts +1 -1
- package/cache/inmemory/fragmentRegistry.d.ts.map +1 -1
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +6 -5
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +5 -5
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.d.ts +1 -1
- package/cache/inmemory/key-extractor.d.ts.map +1 -1
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/policies.d.ts +7 -6
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +1 -1
- 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/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +6 -6
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +6 -6
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +6 -6
- package/cache/inmemory/writeToStore.d.ts.map +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 +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +6 -6
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +1 -1
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +9 -8
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +9 -9
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +6 -6
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +1 -1
- package/core/equalByQuery.d.ts +2 -2
- package/core/equalByQuery.d.ts.map +1 -1
- package/core/equalByQuery.js.map +1 -1
- package/core/types.d.ts +11 -11
- package/core/types.d.ts.map +1 -1
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +6 -6
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/errors/index.d.ts +4 -4
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +41 -29
- package/link/batch/batchLink.d.ts +4 -3
- package/link/batch/batchLink.d.ts.map +1 -1
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.d.ts +1 -1
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batchHttpLink.d.ts +3 -2
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/context/index.d.ts +3 -2
- package/link/context/index.d.ts.map +1 -1
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +3 -2
- package/link/core/ApolloLink.d.ts.map +1 -1
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/types.d.ts +4 -3
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/error/index.d.ts +4 -3
- package/link/error/index.d.ts.map +1 -1
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +3 -2
- package/link/http/HttpLink.d.ts.map +1 -1
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/createHttpLink.d.ts +1 -1
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +1 -1
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +1 -1
- package/link/http/iterators/nodeStream.d.ts +1 -1
- package/link/http/iterators/nodeStream.d.ts.map +1 -1
- package/link/http/iterators/nodeStream.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.d.ts +1 -1
- package/link/http/responseIterator.d.ts.map +1 -1
- package/link/http/responseIterator.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +1 -1
- package/link/http/rewriteURIForGET.d.ts.map +1 -1
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +3 -2
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +1 -2
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.d.ts +1 -1
- package/link/http/selectURI.d.ts.map +1 -1
- package/link/http/selectURI.js.map +1 -1
- package/link/persisted-queries/index.d.ts +4 -3
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +12 -13
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +12 -13
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +12 -13
- package/link/remove-typename/index.d.ts +2 -0
- package/link/remove-typename/index.d.ts.map +1 -0
- package/link/remove-typename/index.js +2 -0
- package/link/remove-typename/index.js.map +1 -0
- package/link/remove-typename/package.json +8 -0
- package/link/remove-typename/remove-typename.cjs +70 -0
- package/link/remove-typename/remove-typename.cjs.map +1 -0
- package/link/remove-typename/remove-typename.cjs.native.js +70 -0
- package/link/remove-typename/removeTypenameFromVariables.d.ts +11 -0
- package/link/remove-typename/removeTypenameFromVariables.d.ts.map +1 -0
- package/link/remove-typename/removeTypenameFromVariables.js +62 -0
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -0
- package/link/retry/delayFunction.d.ts +1 -1
- package/link/retry/delayFunction.d.ts.map +1 -1
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/retryFunction.d.ts +1 -1
- package/link/retry/retryFunction.d.ts.map +1 -1
- package/link/retry/retryFunction.js.map +1 -1
- package/link/retry/retryLink.d.ts +4 -3
- package/link/retry/retryLink.d.ts.map +1 -1
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +3 -2
- package/link/schema/index.d.ts.map +1 -1
- package/link/schema/index.js.map +1 -1
- package/link/subscriptions/index.d.ts +2 -1
- package/link/subscriptions/index.d.ts.map +1 -1
- package/link/subscriptions/index.js +2 -2
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs +1 -1
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/link/subscriptions/subscriptions.cjs.native.js +1 -1
- package/link/utils/createOperation.d.ts +1 -1
- package/link/utils/createOperation.d.ts.map +1 -1
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/filterOperationVariables.d.ts +1 -1
- package/link/utils/filterOperationVariables.d.ts.map +1 -1
- package/link/utils/filterOperationVariables.js.map +1 -1
- package/link/utils/throwServerError.d.ts +1 -1
- package/link/utils/throwServerError.d.ts.map +1 -1
- package/link/utils/throwServerError.js.map +1 -1
- package/link/utils/toPromise.d.ts +1 -1
- package/link/utils/toPromise.d.ts.map +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/transformOperation.d.ts +1 -1
- package/link/utils/transformOperation.d.ts.map +1 -1
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/validateOperation.d.ts +1 -1
- package/link/utils/validateOperation.d.ts.map +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +5 -3
- package/link/ws/index.d.ts.map +1 -1
- package/link/ws/index.js.map +1 -1
- package/package.json +26 -22
- package/react/cache/{QuerySubscription.d.ts → QueryReference.d.ts} +15 -7
- package/react/cache/QueryReference.d.ts.map +1 -0
- package/react/cache/QueryReference.js +107 -0
- package/react/cache/QueryReference.js.map +1 -0
- package/react/cache/SuspenseCache.d.ts +5 -5
- package/react/cache/SuspenseCache.d.ts.map +1 -1
- package/react/cache/SuspenseCache.js +8 -7
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/cache/types.d.ts +2 -0
- package/react/cache/types.d.ts.map +1 -0
- package/react/cache/types.js +2 -0
- package/react/cache/types.js.map +1 -0
- package/react/components/Mutation.d.ts +2 -2
- package/react/components/Mutation.d.ts.map +1 -1
- package/react/components/Mutation.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 +4 -4
- package/react/components/types.d.ts.map +1 -1
- package/react/components/types.js.map +1 -1
- package/react/context/ApolloConsumer.d.ts +1 -1
- package/react/context/ApolloConsumer.d.ts.map +1 -1
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +10 -3
- package/react/context/ApolloContext.d.ts.map +1 -1
- package/react/context/ApolloContext.js +13 -8
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +2 -2
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +8 -12
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs +22 -21
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +22 -21
- package/react/context/index.d.ts +1 -1
- package/react/context/index.d.ts.map +1 -1
- package/react/context/index.js +1 -1
- package/react/context/index.js.map +1 -1
- package/react/hoc/graphql.d.ts +3 -3
- package/react/hoc/graphql.d.ts.map +1 -1
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts +2 -2
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/mutation-hoc.d.ts +4 -4
- 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 +2 -2
- 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 +2 -2
- 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 +4 -4
- package/react/hoc/types.d.ts.map +1 -1
- package/react/hoc/types.js.map +1 -1
- package/react/hoc/withApollo.d.ts +1 -1
- package/react/hoc/withApollo.d.ts.map +1 -1
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +133 -69
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +133 -69
- package/react/hooks/index.d.ts +2 -1
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +2 -1
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/internal/useDeepMemo.d.ts +1 -1
- package/react/hooks/internal/useDeepMemo.d.ts.map +1 -1
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts +1 -1
- package/react/hooks/useApolloClient.d.ts.map +1 -1
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +18 -0
- package/react/hooks/useBackgroundQuery.d.ts.map +1 -0
- package/react/hooks/useBackgroundQuery.js +71 -0
- package/react/hooks/useBackgroundQuery.js.map +1 -0
- package/react/hooks/useFragment.d.ts +13 -8
- package/react/hooks/useFragment.d.ts.map +1 -1
- package/react/hooks/useFragment.js +1 -1
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +4 -4
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +4 -4
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +1 -1
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +3 -3
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +2 -2
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.d.ts +1 -1
- package/react/hooks/useReactiveVar.d.ts.map +1 -1
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +4 -4
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +25 -13
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseCache.d.ts +1 -1
- package/react/hooks/useSuspenseCache.d.ts.map +1 -1
- package/react/hooks/useSuspenseCache.js +1 -1
- package/react/hooks/useSuspenseCache.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +29 -7
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js +44 -59
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/parser/index.d.ts +1 -1
- package/react/parser/index.d.ts.map +1 -1
- package/react/parser/index.js +5 -5
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +5 -5
- package/react/react.cjs +73 -51
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +73 -51
- package/react/ssr/RenderPromises.d.ts +2 -2
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/renderToStringWithData.d.ts +1 -1
- package/react/ssr/renderToStringWithData.d.ts.map +1 -1
- package/react/ssr/renderToStringWithData.js.map +1 -1
- package/react/types/types.d.ts +9 -11
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +1 -1
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +1 -1
- package/testing/core/mocking/mockClient.d.ts +2 -2
- package/testing/core/mocking/mockClient.d.ts.map +1 -1
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +2 -1
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +2 -2
- 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.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +2 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
- package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -1
- 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/subscribeAndCount.d.ts +1 -1
- package/testing/core/subscribeAndCount.d.ts.map +1 -1
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +7 -6
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js.map +1 -1
- package/utilities/common/compact.d.ts +1 -1
- package/utilities/common/compact.d.ts.map +1 -1
- package/utilities/common/compact.js.map +1 -1
- package/utilities/common/errorHandling.d.ts +1 -1
- package/utilities/common/errorHandling.d.ts.map +1 -1
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/incrementalResult.d.ts +1 -1
- package/utilities/common/incrementalResult.d.ts.map +1 -1
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/omitDeep.d.ts +10 -2
- package/utilities/common/omitDeep.d.ts.map +1 -1
- package/utilities/common/omitDeep.js +22 -10
- package/utilities/common/omitDeep.js.map +1 -1
- package/utilities/common/responseIterator.d.ts +2 -2
- package/utilities/common/responseIterator.d.ts.map +1 -1
- package/utilities/common/responseIterator.js.map +1 -1
- package/utilities/common/stripTypename.d.ts +9 -1
- package/utilities/common/stripTypename.d.ts.map +1 -1
- package/utilities/common/stripTypename.js +3 -2
- package/utilities/common/stripTypename.js.map +1 -1
- package/utilities/globals/global.d.ts +6 -3
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/graphql/directives.d.ts +1 -1
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +4 -4
- 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 +3 -3
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts +1 -1
- package/utilities/graphql/getFromAST.d.ts.map +1 -1
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +2 -2
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +14 -4
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +3 -2
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +1 -1
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.d.ts +2 -1
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/Observable.d.ts +2 -1
- package/utilities/observables/Observable.d.ts.map +1 -1
- package/utilities/observables/Observable.js +1 -1
- package/utilities/observables/Observable.js.map +1 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.d.ts +1 -1
- package/utilities/observables/iteration.d.ts.map +1 -1
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/policies/pagination.d.ts +1 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/promises/decoration.d.ts +2 -0
- package/utilities/promises/decoration.d.ts.map +1 -1
- package/utilities/promises/decoration.js +12 -0
- package/utilities/promises/decoration.js.map +1 -1
- package/utilities/types/DeepOmit.d.ts +4 -3
- package/utilities/types/DeepOmit.d.ts.map +1 -1
- package/utilities/types/DeepOmit.js.map +1 -1
- package/utilities/types/DeepPartial.d.ts +12 -0
- package/utilities/types/DeepPartial.d.ts.map +1 -0
- package/utilities/types/DeepPartial.js +2 -0
- package/utilities/types/DeepPartial.js.map +1 -0
- package/utilities/types/Primitive.d.ts +2 -0
- package/utilities/types/Primitive.d.ts.map +1 -0
- package/utilities/types/Primitive.js +2 -0
- package/utilities/types/Primitive.js.map +1 -0
- package/utilities/utilities.cjs +68 -31
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +68 -31
- package/version.js +1 -1
- package/react/cache/QuerySubscription.d.ts.map +0 -1
- package/react/cache/QuerySubscription.js +0 -88
- package/react/cache/QuerySubscription.js.map +0 -1
package/react/hooks/hooks.cjs
CHANGED
|
@@ -8,8 +8,8 @@ var context = require('../context');
|
|
|
8
8
|
var tslib = require('tslib');
|
|
9
9
|
var utilities = require('../../utilities');
|
|
10
10
|
var equality = require('@wry/equality');
|
|
11
|
-
var core = require('../../core');
|
|
12
11
|
var errors = require('../../errors');
|
|
12
|
+
var core = require('../../core');
|
|
13
13
|
var parser = require('../parser');
|
|
14
14
|
var cache = require('../../cache');
|
|
15
15
|
|
|
@@ -248,7 +248,7 @@ var InternalState = (function () {
|
|
|
248
248
|
toMerge.push(this.queryHookOptions.defaultOptions);
|
|
249
249
|
}
|
|
250
250
|
toMerge.push(utilities.compact(this.observable && this.observable.options, this.watchQueryOptions));
|
|
251
|
-
return toMerge.reduce(
|
|
251
|
+
return toMerge.reduce(utilities.mergeOptions);
|
|
252
252
|
};
|
|
253
253
|
InternalState.prototype.createWatchQueryOptions = function (_a) {
|
|
254
254
|
var _b;
|
|
@@ -466,7 +466,7 @@ function useMutation(mutation, options) {
|
|
|
466
466
|
});
|
|
467
467
|
}
|
|
468
468
|
var mutationId = ++ref.current.mutationId;
|
|
469
|
-
var clientOptions =
|
|
469
|
+
var clientOptions = utilities.mergeOptions(baseOptions, executeOptions);
|
|
470
470
|
return client.mutate(clientOptions).then(function (response) {
|
|
471
471
|
var _a;
|
|
472
472
|
var data = response.data, errors$1 = response.errors;
|
|
@@ -612,9 +612,13 @@ function useSubscription(subscription, options) {
|
|
|
612
612
|
if (!observable) {
|
|
613
613
|
return;
|
|
614
614
|
}
|
|
615
|
+
var subscriptionStopped = false;
|
|
615
616
|
var subscription = observable.subscribe({
|
|
616
617
|
next: function (fetchResult) {
|
|
617
618
|
var _a, _b;
|
|
619
|
+
if (subscriptionStopped) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
618
622
|
var result = {
|
|
619
623
|
loading: false,
|
|
620
624
|
data: fetchResult.data,
|
|
@@ -637,26 +641,33 @@ function useSubscription(subscription, options) {
|
|
|
637
641
|
},
|
|
638
642
|
error: function (error) {
|
|
639
643
|
var _a, _b;
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
644
|
+
if (!subscriptionStopped) {
|
|
645
|
+
setResult({
|
|
646
|
+
loading: false,
|
|
647
|
+
data: void 0,
|
|
648
|
+
error: error,
|
|
649
|
+
variables: options === null || options === void 0 ? void 0 : options.variables,
|
|
650
|
+
});
|
|
651
|
+
(_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
652
|
+
}
|
|
647
653
|
},
|
|
648
654
|
complete: function () {
|
|
649
655
|
var _a, _b;
|
|
650
|
-
if (
|
|
651
|
-
ref.current.options.onComplete
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
ref.current.options.onSubscriptionComplete
|
|
656
|
+
if (!subscriptionStopped) {
|
|
657
|
+
if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) {
|
|
658
|
+
ref.current.options.onComplete();
|
|
659
|
+
}
|
|
660
|
+
else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) {
|
|
661
|
+
ref.current.options.onSubscriptionComplete();
|
|
662
|
+
}
|
|
655
663
|
}
|
|
656
664
|
},
|
|
657
665
|
});
|
|
658
666
|
return function () {
|
|
659
|
-
|
|
667
|
+
subscriptionStopped = true;
|
|
668
|
+
setTimeout(function () {
|
|
669
|
+
subscription.unsubscribe();
|
|
670
|
+
});
|
|
660
671
|
};
|
|
661
672
|
}, [observable]);
|
|
662
673
|
return result;
|
|
@@ -680,7 +691,7 @@ function useReactiveVar(rv) {
|
|
|
680
691
|
function useFragment_experimental(options) {
|
|
681
692
|
var cache = useApolloClient().cache;
|
|
682
693
|
var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a, rest = tslib.__rest(options, ["fragment", "fragmentName", "from", "optimistic"]);
|
|
683
|
-
var diffOptions = tslib.__assign(tslib.__assign({}, rest), { id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
694
|
+
var diffOptions = tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
684
695
|
var resultRef = React.useRef();
|
|
685
696
|
var latestDiff = cache.diff(diffOptions);
|
|
686
697
|
var getSnapshot = function () {
|
|
@@ -748,47 +759,51 @@ function useSuspenseCache(override) {
|
|
|
748
759
|
var suspenseCache = override || context$1.suspenseCache;
|
|
749
760
|
globals.__DEV__ ? globals.invariant(suspenseCache, 'Could not find a "suspenseCache" in the context or passed in as an option. ' +
|
|
750
761
|
'Wrap the root component in an <ApolloProvider> and provide a suspenseCache, ' +
|
|
751
|
-
'or pass a SuspenseCache instance in via options.') : globals.invariant(suspenseCache,
|
|
762
|
+
'or pass a SuspenseCache instance in via options.') : globals.invariant(suspenseCache, 35);
|
|
752
763
|
return suspenseCache;
|
|
753
764
|
}
|
|
754
765
|
|
|
755
766
|
function useSuspenseQuery_experimental(query, options) {
|
|
756
767
|
if (options === void 0) { options = Object.create(null); }
|
|
757
|
-
var didPreviouslySuspend = React.useRef(false);
|
|
758
768
|
var client = useApolloClient(options.client);
|
|
759
769
|
var suspenseCache = useSuspenseCache(options.suspenseCache);
|
|
760
770
|
var watchQueryOptions = useWatchQueryOptions({ query: query, options: options });
|
|
761
|
-
var
|
|
762
|
-
var
|
|
763
|
-
var shouldSuspend = suspensePolicy === 'always' || !didPreviouslySuspend.current;
|
|
771
|
+
var variables = watchQueryOptions.variables;
|
|
772
|
+
var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
|
|
764
773
|
var cacheKey = [client, query, cache.canonicalStringify(variables)].concat(queryKey);
|
|
765
|
-
var
|
|
774
|
+
var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
|
|
766
775
|
return client.watchQuery(watchQueryOptions);
|
|
767
776
|
});
|
|
768
|
-
var
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
if (!equality.equal(variables, previousVariables.current)) {
|
|
774
|
-
if (result.networkStatus !== core.NetworkStatus.ready) {
|
|
775
|
-
result = tslib.__assign(tslib.__assign({}, result), { data: previousData.current, networkStatus: core.NetworkStatus.setVariables });
|
|
776
|
-
}
|
|
777
|
-
previousVariables.current = variables;
|
|
778
|
-
previousData.current = result.data;
|
|
777
|
+
var _b = React.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
|
|
778
|
+
var promise = promiseCache.get(queryRef.key);
|
|
779
|
+
if (!promise) {
|
|
780
|
+
promise = queryRef.promise;
|
|
781
|
+
promiseCache.set(queryRef.key, promise);
|
|
779
782
|
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
})
|
|
786
|
-
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
var fetchMore = React.useCallback(function (options) {
|
|
790
|
-
|
|
791
|
-
|
|
783
|
+
useTrackedQueryRefs(queryRef);
|
|
784
|
+
React.useEffect(function () {
|
|
785
|
+
return queryRef.listen(function (promise) {
|
|
786
|
+
setPromiseCache(function (promiseCache) {
|
|
787
|
+
return new Map(promiseCache).set(queryRef.key, promise);
|
|
788
|
+
});
|
|
789
|
+
});
|
|
790
|
+
}, [queryRef]);
|
|
791
|
+
var result = __use(promise);
|
|
792
|
+
var fetchMore = React.useCallback(function (options) {
|
|
793
|
+
var promise = queryRef.fetchMore(options);
|
|
794
|
+
setPromiseCache(function (previousPromiseCache) {
|
|
795
|
+
return new Map(previousPromiseCache).set(queryRef.key, promise);
|
|
796
|
+
});
|
|
797
|
+
return promise;
|
|
798
|
+
}, [queryRef]);
|
|
799
|
+
var refetch = React.useCallback(function (variables) {
|
|
800
|
+
var promise = queryRef.refetch(variables);
|
|
801
|
+
setPromiseCache(function (previousPromiseCache) {
|
|
802
|
+
return new Map(previousPromiseCache).set(queryRef.key, promise);
|
|
803
|
+
});
|
|
804
|
+
return promise;
|
|
805
|
+
}, [queryRef]);
|
|
806
|
+
var subscribeToMore = React.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]);
|
|
792
807
|
return React.useMemo(function () {
|
|
793
808
|
return {
|
|
794
809
|
client: client,
|
|
@@ -815,7 +830,7 @@ function validateFetchPolicy(fetchPolicy) {
|
|
|
815
830
|
'no-cache',
|
|
816
831
|
'cache-and-network',
|
|
817
832
|
];
|
|
818
|
-
globals.__DEV__ ? globals.invariant(supportedFetchPolicies.includes(fetchPolicy), "The fetch policy `".concat(fetchPolicy, "` is not supported with suspense.")) : globals.invariant(supportedFetchPolicies.includes(fetchPolicy),
|
|
833
|
+
globals.__DEV__ ? globals.invariant(supportedFetchPolicies.includes(fetchPolicy), "The fetch policy `".concat(fetchPolicy, "` is not supported with suspense.")) : globals.invariant(supportedFetchPolicies.includes(fetchPolicy), 36);
|
|
819
834
|
}
|
|
820
835
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
821
836
|
if (fetchPolicy === 'no-cache' && returnPartialData) {
|
|
@@ -827,45 +842,94 @@ function toApolloError(result) {
|
|
|
827
842
|
? new core.ApolloError({ graphQLErrors: result.errors })
|
|
828
843
|
: result.error;
|
|
829
844
|
}
|
|
830
|
-
function
|
|
831
|
-
var
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
};
|
|
845
|
+
function useTrackedQueryRefs(queryRef) {
|
|
846
|
+
var trackedQueryRefs = React.useRef(new Set());
|
|
847
|
+
trackedQueryRefs.current.add(queryRef);
|
|
848
|
+
useStrictModeSafeCleanupEffect(function () {
|
|
849
|
+
trackedQueryRefs.current.forEach(function (sub) { return sub.dispose(); });
|
|
850
|
+
});
|
|
836
851
|
}
|
|
837
852
|
function useWatchQueryOptions(_a) {
|
|
838
853
|
var query = _a.query, options = _a.options;
|
|
839
|
-
var watchQueryOptions = useDeepMemo(function () { return (tslib.__assign(tslib.__assign({}, options), { query: query, notifyOnNetworkStatusChange:
|
|
854
|
+
var watchQueryOptions = useDeepMemo(function () { return (tslib.__assign(tslib.__assign({}, options), { query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 })); }, [options, query]);
|
|
840
855
|
if (globals.__DEV__) {
|
|
841
856
|
validateOptions(watchQueryOptions);
|
|
842
857
|
}
|
|
843
858
|
return watchQueryOptions;
|
|
844
859
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
if (
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
+
|
|
861
|
+
function useBackgroundQuery_experimental(query, options) {
|
|
862
|
+
if (options === void 0) { options = Object.create(null); }
|
|
863
|
+
var suspenseCache = useSuspenseCache(options.suspenseCache);
|
|
864
|
+
var client = useApolloClient(options.client);
|
|
865
|
+
var watchQueryOptions = useWatchQueryOptions({ query: query, options: options });
|
|
866
|
+
var variables = watchQueryOptions.variables;
|
|
867
|
+
var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
|
|
868
|
+
var cacheKey = [client, query, cache.canonicalStringify(variables)].concat(queryKey);
|
|
869
|
+
var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
|
|
870
|
+
return client.watchQuery(watchQueryOptions);
|
|
871
|
+
});
|
|
872
|
+
var _b = React.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
|
|
873
|
+
useTrackedQueryRefs(queryRef);
|
|
874
|
+
var fetchMore = React.useCallback(function (options) {
|
|
875
|
+
var promise = queryRef.fetchMore(options);
|
|
876
|
+
setPromiseCache(function (promiseCache) {
|
|
877
|
+
return new Map(promiseCache).set(queryRef.key, promise);
|
|
878
|
+
});
|
|
879
|
+
return promise;
|
|
880
|
+
}, [queryRef]);
|
|
881
|
+
var refetch = React.useCallback(function (variables) {
|
|
882
|
+
var promise = queryRef.refetch(variables);
|
|
883
|
+
setPromiseCache(function (promiseCache) {
|
|
884
|
+
return new Map(promiseCache).set(queryRef.key, promise);
|
|
885
|
+
});
|
|
886
|
+
return promise;
|
|
887
|
+
}, [queryRef]);
|
|
888
|
+
queryRef.promiseCache = promiseCache;
|
|
889
|
+
return React.useMemo(function () {
|
|
890
|
+
return [
|
|
891
|
+
queryRef,
|
|
892
|
+
{
|
|
893
|
+
fetchMore: fetchMore,
|
|
894
|
+
refetch: refetch,
|
|
895
|
+
},
|
|
896
|
+
];
|
|
897
|
+
}, [queryRef, fetchMore, refetch]);
|
|
898
|
+
}
|
|
899
|
+
function useReadQuery_experimental(queryRef) {
|
|
900
|
+
var _a = React.useState(0), forceUpdate = _a[1];
|
|
901
|
+
globals.__DEV__ ? globals.invariant(queryRef.promiseCache, 'It appears that `useReadQuery` was used outside of `useBackgroundQuery`. ' +
|
|
902
|
+
'`useReadQuery` is only supported for use with `useBackgroundQuery`. ' +
|
|
903
|
+
'Please ensure you are passing the `queryRef` returned from `useBackgroundQuery`.') : globals.invariant(queryRef.promiseCache, 34);
|
|
904
|
+
var promise = queryRef.promiseCache.get(queryRef.key);
|
|
905
|
+
if (!promise) {
|
|
906
|
+
promise = queryRef.promise;
|
|
907
|
+
queryRef.promiseCache.set(queryRef.key, promise);
|
|
860
908
|
}
|
|
909
|
+
React.useEffect(function () {
|
|
910
|
+
return queryRef.listen(function (promise) {
|
|
911
|
+
queryRef.promiseCache.set(queryRef.key, promise);
|
|
912
|
+
forceUpdate(function (prevState) { return prevState + 1; });
|
|
913
|
+
});
|
|
914
|
+
}, [queryRef]);
|
|
915
|
+
var result = __use(promise);
|
|
916
|
+
return React.useMemo(function () {
|
|
917
|
+
return {
|
|
918
|
+
data: result.data,
|
|
919
|
+
networkStatus: result.networkStatus,
|
|
920
|
+
error: toApolloError(result),
|
|
921
|
+
};
|
|
922
|
+
}, [result]);
|
|
861
923
|
}
|
|
862
924
|
|
|
863
925
|
exports.useApolloClient = useApolloClient;
|
|
926
|
+
exports.useBackgroundQuery_experimental = useBackgroundQuery_experimental;
|
|
864
927
|
exports.useFragment_experimental = useFragment_experimental;
|
|
865
928
|
exports.useLazyQuery = useLazyQuery;
|
|
866
929
|
exports.useMutation = useMutation;
|
|
867
930
|
exports.useQuery = useQuery;
|
|
868
931
|
exports.useReactiveVar = useReactiveVar;
|
|
932
|
+
exports.useReadQuery_experimental = useReadQuery_experimental;
|
|
869
933
|
exports.useSubscription = useSubscription;
|
|
870
934
|
exports.useSuspenseQuery_experimental = useSuspenseQuery_experimental;
|
|
871
935
|
//# sourceMappingURL=hooks.cjs.map
|