@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/apollo-client.cjs
CHANGED
|
@@ -67,7 +67,7 @@ function shouldInclude(_a, variables) {
|
|
|
67
67
|
var evaledValue = false;
|
|
68
68
|
if (ifArgument.value.kind === 'Variable') {
|
|
69
69
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
70
|
-
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : tsInvariant.invariant(evaledValue !== void 0,
|
|
70
|
+
__DEV__ ? tsInvariant.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : tsInvariant.invariant(evaledValue !== void 0, 43);
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
73
|
evaledValue = ifArgument.value.value;
|
|
@@ -75,7 +75,6 @@ function shouldInclude(_a, variables) {
|
|
|
75
75
|
return directive.name.value === 'skip' ? !evaledValue : evaledValue;
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
var hasAnyDirectives = function (names, root) { return hasDirectives(names, root, false); };
|
|
79
78
|
function hasDirectives(names, root, all) {
|
|
80
79
|
var nameSet = new Set(names);
|
|
81
80
|
var uniqueCount = nameSet.size;
|
|
@@ -104,13 +103,13 @@ function getInclusionDirectives(directives) {
|
|
|
104
103
|
return;
|
|
105
104
|
var directiveArguments = directive.arguments;
|
|
106
105
|
var directiveName = directive.name.value;
|
|
107
|
-
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1,
|
|
106
|
+
__DEV__ ? tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(directiveArguments && directiveArguments.length === 1, 44);
|
|
108
107
|
var ifArgument = directiveArguments[0];
|
|
109
|
-
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if',
|
|
108
|
+
__DEV__ ? tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : tsInvariant.invariant(ifArgument.name && ifArgument.name.value === 'if', 45);
|
|
110
109
|
var ifValue = ifArgument.value;
|
|
111
110
|
__DEV__ ? tsInvariant.invariant(ifValue &&
|
|
112
111
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : tsInvariant.invariant(ifValue &&
|
|
113
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
112
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 46);
|
|
114
113
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
115
114
|
});
|
|
116
115
|
}
|
|
@@ -123,14 +122,14 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
123
122
|
document.definitions.forEach(function (definition) {
|
|
124
123
|
if (definition.kind === 'OperationDefinition') {
|
|
125
124
|
throw __DEV__ ? new tsInvariant.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
|
|
126
|
-
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(
|
|
125
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new tsInvariant.InvariantError(47);
|
|
127
126
|
}
|
|
128
127
|
if (definition.kind === 'FragmentDefinition') {
|
|
129
128
|
fragments.push(definition);
|
|
130
129
|
}
|
|
131
130
|
});
|
|
132
131
|
if (typeof actualFragmentName === 'undefined') {
|
|
133
|
-
__DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : tsInvariant.invariant(fragments.length === 1,
|
|
132
|
+
__DEV__ ? tsInvariant.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : tsInvariant.invariant(fragments.length === 1, 48);
|
|
134
133
|
actualFragmentName = fragments[0].name.value;
|
|
135
134
|
}
|
|
136
135
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -171,7 +170,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
171
170
|
return fragmentMap(fragmentName);
|
|
172
171
|
}
|
|
173
172
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
174
|
-
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(fragmentName)) : tsInvariant.invariant(fragment,
|
|
173
|
+
__DEV__ ? tsInvariant.invariant(fragment, "No fragment named ".concat(fragmentName)) : tsInvariant.invariant(fragment, 49);
|
|
175
174
|
return fragment || null;
|
|
176
175
|
}
|
|
177
176
|
default:
|
|
@@ -182,12 +181,6 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
182
181
|
function isNonNullObject(obj) {
|
|
183
182
|
return obj !== null && typeof obj === 'object';
|
|
184
183
|
}
|
|
185
|
-
function isPlainObject(obj) {
|
|
186
|
-
return (obj !== null &&
|
|
187
|
-
typeof obj === 'object' &&
|
|
188
|
-
(Object.getPrototypeOf(obj) === Object.prototype ||
|
|
189
|
-
Object.getPrototypeOf(obj) === null));
|
|
190
|
-
}
|
|
191
184
|
|
|
192
185
|
function makeReference(id) {
|
|
193
186
|
return { __ref: String(id) };
|
|
@@ -261,7 +254,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
261
254
|
else {
|
|
262
255
|
throw __DEV__ ? new tsInvariant.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
|
|
263
256
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
264
|
-
'overcome this limitation.') : new tsInvariant.InvariantError(
|
|
257
|
+
'overcome this limitation.') : new tsInvariant.InvariantError(58);
|
|
265
258
|
}
|
|
266
259
|
}
|
|
267
260
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -370,9 +363,7 @@ function resultKeyNameFromField(field) {
|
|
|
370
363
|
return field.alias ? field.alias.value : field.name.value;
|
|
371
364
|
}
|
|
372
365
|
function getTypenameFromResult(result, selectionSet, fragmentMap) {
|
|
373
|
-
|
|
374
|
-
return result.__typename;
|
|
375
|
-
}
|
|
366
|
+
var fragments;
|
|
376
367
|
for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {
|
|
377
368
|
var selection = _a[_i];
|
|
378
369
|
if (isField(selection)) {
|
|
@@ -380,7 +371,19 @@ function getTypenameFromResult(result, selectionSet, fragmentMap) {
|
|
|
380
371
|
return result[resultKeyNameFromField(selection)];
|
|
381
372
|
}
|
|
382
373
|
}
|
|
374
|
+
else if (fragments) {
|
|
375
|
+
fragments.push(selection);
|
|
376
|
+
}
|
|
383
377
|
else {
|
|
378
|
+
fragments = [selection];
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
if (typeof result.__typename === 'string') {
|
|
382
|
+
return result.__typename;
|
|
383
|
+
}
|
|
384
|
+
if (fragments) {
|
|
385
|
+
for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) {
|
|
386
|
+
var selection = fragments_1[_b];
|
|
384
387
|
var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);
|
|
385
388
|
if (typeof typename === 'string') {
|
|
386
389
|
return typename;
|
|
@@ -396,16 +399,16 @@ function isInlineFragment(selection) {
|
|
|
396
399
|
}
|
|
397
400
|
|
|
398
401
|
function checkDocument(doc) {
|
|
399
|
-
__DEV__ ? tsInvariant.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc && doc.kind === 'Document',
|
|
402
|
+
__DEV__ ? tsInvariant.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc && doc.kind === 'Document', 50);
|
|
400
403
|
var operations = doc.definitions
|
|
401
404
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
402
405
|
.map(function (definition) {
|
|
403
406
|
if (definition.kind !== 'OperationDefinition') {
|
|
404
|
-
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(
|
|
407
|
+
throw __DEV__ ? new tsInvariant.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new tsInvariant.InvariantError(51);
|
|
405
408
|
}
|
|
406
409
|
return definition;
|
|
407
410
|
});
|
|
408
|
-
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1,
|
|
411
|
+
__DEV__ ? tsInvariant.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : tsInvariant.invariant(operations.length <= 1, 52);
|
|
409
412
|
return doc;
|
|
410
413
|
}
|
|
411
414
|
function getOperationDefinition(doc) {
|
|
@@ -428,14 +431,14 @@ function getFragmentDefinitions(doc) {
|
|
|
428
431
|
}
|
|
429
432
|
function getQueryDefinition(doc) {
|
|
430
433
|
var queryDef = getOperationDefinition(doc);
|
|
431
|
-
__DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query',
|
|
434
|
+
__DEV__ ? tsInvariant.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : tsInvariant.invariant(queryDef && queryDef.operation === 'query', 53);
|
|
432
435
|
return queryDef;
|
|
433
436
|
}
|
|
434
437
|
function getFragmentDefinition(doc) {
|
|
435
|
-
__DEV__ ? tsInvariant.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc.kind === 'Document',
|
|
436
|
-
__DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1,
|
|
438
|
+
__DEV__ ? tsInvariant.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : tsInvariant.invariant(doc.kind === 'Document', 54);
|
|
439
|
+
__DEV__ ? tsInvariant.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : tsInvariant.invariant(doc.definitions.length <= 1, 55);
|
|
437
440
|
var fragmentDef = doc.definitions[0];
|
|
438
|
-
__DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition',
|
|
441
|
+
__DEV__ ? tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : tsInvariant.invariant(fragmentDef.kind === 'FragmentDefinition', 56);
|
|
439
442
|
return fragmentDef;
|
|
440
443
|
}
|
|
441
444
|
function getMainDefinition(queryDoc) {
|
|
@@ -458,7 +461,7 @@ function getMainDefinition(queryDoc) {
|
|
|
458
461
|
if (fragmentDefinition) {
|
|
459
462
|
return fragmentDefinition;
|
|
460
463
|
}
|
|
461
|
-
throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(
|
|
464
|
+
throw __DEV__ ? new tsInvariant.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new tsInvariant.InvariantError(57);
|
|
462
465
|
}
|
|
463
466
|
function getDefaultValues(definition) {
|
|
464
467
|
var defaultValues = Object.create(null);
|
|
@@ -817,6 +820,18 @@ var DeepMerger = (function () {
|
|
|
817
820
|
return DeepMerger;
|
|
818
821
|
}());
|
|
819
822
|
|
|
823
|
+
function createFulfilledPromise(value) {
|
|
824
|
+
var promise = Promise.resolve(value);
|
|
825
|
+
promise.status = 'fulfilled';
|
|
826
|
+
promise.value = value;
|
|
827
|
+
return promise;
|
|
828
|
+
}
|
|
829
|
+
function createRejectedPromise(reason) {
|
|
830
|
+
var promise = Promise.reject(reason);
|
|
831
|
+
promise.status = 'rejected';
|
|
832
|
+
promise.reason = reason;
|
|
833
|
+
return promise;
|
|
834
|
+
}
|
|
820
835
|
function isStatefulPromise(promise) {
|
|
821
836
|
return 'status' in promise;
|
|
822
837
|
}
|
|
@@ -1225,51 +1240,6 @@ function isNodeReadableStream(value) {
|
|
|
1225
1240
|
return !!value.pipe;
|
|
1226
1241
|
}
|
|
1227
1242
|
|
|
1228
|
-
function omitDeep(value, key) {
|
|
1229
|
-
return __omitDeep(value, key);
|
|
1230
|
-
}
|
|
1231
|
-
function __omitDeep(value, key, known) {
|
|
1232
|
-
if (known === void 0) { known = new Map(); }
|
|
1233
|
-
if (known.has(value)) {
|
|
1234
|
-
return known.get(value);
|
|
1235
|
-
}
|
|
1236
|
-
var modified = false;
|
|
1237
|
-
if (Array.isArray(value)) {
|
|
1238
|
-
var array_1 = [];
|
|
1239
|
-
known.set(value, array_1);
|
|
1240
|
-
value.forEach(function (value, index) {
|
|
1241
|
-
var result = __omitDeep(value, key, known);
|
|
1242
|
-
modified || (modified = result !== value);
|
|
1243
|
-
array_1[index] = result;
|
|
1244
|
-
});
|
|
1245
|
-
if (modified) {
|
|
1246
|
-
return array_1;
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
else if (isPlainObject(value)) {
|
|
1250
|
-
var obj_1 = Object.create(Object.getPrototypeOf(value));
|
|
1251
|
-
known.set(value, obj_1);
|
|
1252
|
-
Object.keys(value).forEach(function (k) {
|
|
1253
|
-
if (k === key) {
|
|
1254
|
-
modified = true;
|
|
1255
|
-
}
|
|
1256
|
-
else {
|
|
1257
|
-
var result = __omitDeep(value[k], key, known);
|
|
1258
|
-
modified || (modified = result !== value[k]);
|
|
1259
|
-
obj_1[k] = result;
|
|
1260
|
-
}
|
|
1261
|
-
});
|
|
1262
|
-
if (modified) {
|
|
1263
|
-
return obj_1;
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
return value;
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
function stripTypename(value) {
|
|
1270
|
-
return omitDeep(value, '__typename');
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
1243
|
function fromError(errorValue) {
|
|
1274
1244
|
return new zenObservableTs.Observable(function (observer) {
|
|
1275
1245
|
observer.error(errorValue);
|
|
@@ -1490,7 +1460,7 @@ var concat = ApolloLink.concat;
|
|
|
1490
1460
|
|
|
1491
1461
|
var execute = ApolloLink.execute;
|
|
1492
1462
|
|
|
1493
|
-
var version = '3.8.0-alpha.
|
|
1463
|
+
var version = '3.8.0-alpha.14';
|
|
1494
1464
|
|
|
1495
1465
|
function asyncIterator(source) {
|
|
1496
1466
|
var _a;
|
|
@@ -1892,7 +1862,7 @@ function selectHttpOptionsAndBodyInternal(operation, printer) {
|
|
|
1892
1862
|
options.headers = removeDuplicateHeaders(options.headers, http.preserveHeaderCase);
|
|
1893
1863
|
}
|
|
1894
1864
|
var operationName = operation.operationName, extensions = operation.extensions, variables = operation.variables, query = operation.query;
|
|
1895
|
-
var body = { operationName: operationName, variables:
|
|
1865
|
+
var body = { operationName: operationName, variables: variables };
|
|
1896
1866
|
if (http.includeExtensions)
|
|
1897
1867
|
body.extensions = extensions;
|
|
1898
1868
|
if (http.includeQuery)
|
|
@@ -3370,7 +3340,7 @@ var Policies = (function () {
|
|
|
3370
3340
|
var policy = typename && this.getTypePolicy(typename);
|
|
3371
3341
|
var keyFn = policy && policy.keyFn || this.config.dataIdFromObject;
|
|
3372
3342
|
while (keyFn) {
|
|
3373
|
-
var specifierOrId = keyFn(object, context);
|
|
3343
|
+
var specifierOrId = keyFn(tslib.__assign(tslib.__assign({}, object), storeObject), context);
|
|
3374
3344
|
if (isArray(specifierOrId)) {
|
|
3375
3345
|
keyFn = keyFieldsFnFromSpecifier(specifierOrId);
|
|
3376
3346
|
}
|
|
@@ -6724,24 +6694,29 @@ var contextKey = canUseSymbol
|
|
|
6724
6694
|
? Symbol.for('__APOLLO_CONTEXT__')
|
|
6725
6695
|
: '__APOLLO_CONTEXT__';
|
|
6726
6696
|
function getApolloContext() {
|
|
6727
|
-
|
|
6697
|
+
__DEV__ ? tsInvariant.invariant('createContext' in React__namespace, 'Invoking `getApolloContext` in an environment where `React.createContext` is not available.\n' +
|
|
6698
|
+
'The Apollo Client functionality you are trying to use is only available in React Client Components.\n' +
|
|
6699
|
+
'Please make sure to add "use client" at the top of your file.\n' +
|
|
6700
|
+
'For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components') : tsInvariant.invariant('createContext' in React__namespace, 29);
|
|
6701
|
+
var contextStorage = global$1[contextKey];
|
|
6702
|
+
if (!contextStorage) {
|
|
6703
|
+
contextStorage = global$1[contextKey] = new Map();
|
|
6704
|
+
}
|
|
6705
|
+
var context = contextStorage.get(React__namespace);
|
|
6728
6706
|
if (!context) {
|
|
6729
|
-
|
|
6730
|
-
value: context = React__namespace.createContext({}),
|
|
6731
|
-
enumerable: false,
|
|
6732
|
-
writable: false,
|
|
6733
|
-
configurable: true,
|
|
6734
|
-
});
|
|
6707
|
+
context = React__namespace.createContext({});
|
|
6735
6708
|
context.displayName = 'ApolloContext';
|
|
6709
|
+
contextStorage.set(React__namespace, context);
|
|
6736
6710
|
}
|
|
6737
6711
|
return context;
|
|
6738
6712
|
}
|
|
6713
|
+
var resetApolloContext = getApolloContext;
|
|
6739
6714
|
|
|
6740
6715
|
var ApolloConsumer = function (props) {
|
|
6741
6716
|
var ApolloContext = getApolloContext();
|
|
6742
6717
|
return (React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
6743
6718
|
__DEV__ ? tsInvariant.invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
|
|
6744
|
-
'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client,
|
|
6719
|
+
'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 28);
|
|
6745
6720
|
return props.children(context.client);
|
|
6746
6721
|
}));
|
|
6747
6722
|
};
|
|
@@ -6749,18 +6724,13 @@ var ApolloConsumer = function (props) {
|
|
|
6749
6724
|
var ApolloProvider = function (_a) {
|
|
6750
6725
|
var client = _a.client, suspenseCache = _a.suspenseCache, children = _a.children;
|
|
6751
6726
|
var ApolloContext = getApolloContext();
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
}
|
|
6760
|
-
__DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
6761
|
-
'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 30);
|
|
6762
|
-
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
6763
|
-
}));
|
|
6727
|
+
var parentContext = React__namespace.useContext(ApolloContext);
|
|
6728
|
+
var context = React__namespace.useMemo(function () {
|
|
6729
|
+
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client, suspenseCache: suspenseCache || parentContext.suspenseCache });
|
|
6730
|
+
}, [parentContext, client, suspenseCache]);
|
|
6731
|
+
__DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
6732
|
+
'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 30);
|
|
6733
|
+
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
6764
6734
|
};
|
|
6765
6735
|
|
|
6766
6736
|
function useApolloClient(override) {
|
|
@@ -6846,7 +6816,7 @@ function parser(document) {
|
|
|
6846
6816
|
var variables, type, name;
|
|
6847
6817
|
__DEV__ ? tsInvariant.invariant(!!document && !!document.kind, "Argument of ".concat(document, " passed to parser was not a valid GraphQL ") +
|
|
6848
6818
|
"DocumentNode. You may need to use 'graphql-tag' or another method " +
|
|
6849
|
-
"to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind,
|
|
6819
|
+
"to convert your operation into a document") : tsInvariant.invariant(!!document && !!document.kind, 37);
|
|
6850
6820
|
var fragments = [];
|
|
6851
6821
|
var queries = [];
|
|
6852
6822
|
var mutations = [];
|
|
@@ -6874,11 +6844,11 @@ function parser(document) {
|
|
|
6874
6844
|
__DEV__ ? tsInvariant.invariant(!fragments.length ||
|
|
6875
6845
|
(queries.length || mutations.length || subscriptions.length), "Passing only a fragment to 'graphql' is not yet supported. " +
|
|
6876
6846
|
"You must include a query, subscription or mutation as well") : tsInvariant.invariant(!fragments.length ||
|
|
6877
|
-
(queries.length || mutations.length || subscriptions.length),
|
|
6847
|
+
(queries.length || mutations.length || subscriptions.length), 38);
|
|
6878
6848
|
__DEV__ ? tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
|
|
6879
6849
|
"".concat(document, " had ").concat(queries.length, " queries, ").concat(subscriptions.length, " ") +
|
|
6880
6850
|
"subscriptions and ".concat(mutations.length, " mutations. ") +
|
|
6881
|
-
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1,
|
|
6851
|
+
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(queries.length + mutations.length + subscriptions.length <= 1, 39);
|
|
6882
6852
|
type = queries.length ? exports.DocumentType.Query : exports.DocumentType.Mutation;
|
|
6883
6853
|
if (!queries.length && !mutations.length)
|
|
6884
6854
|
type = exports.DocumentType.Subscription;
|
|
@@ -6889,7 +6859,7 @@ function parser(document) {
|
|
|
6889
6859
|
: subscriptions;
|
|
6890
6860
|
__DEV__ ? tsInvariant.invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. ".concat(document, " had ") +
|
|
6891
6861
|
"".concat(definitions.length, " definitions. ") +
|
|
6892
|
-
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1,
|
|
6862
|
+
"You can use 'compose' to join multiple operation types to a component") : tsInvariant.invariant(definitions.length === 1, 40);
|
|
6893
6863
|
var definition = definitions[0];
|
|
6894
6864
|
variables = definition.variableDefinitions || [];
|
|
6895
6865
|
if (definition.name && definition.name.kind === 'Name') {
|
|
@@ -6907,7 +6877,7 @@ function verifyDocumentType(document, type) {
|
|
|
6907
6877
|
var requiredOperationName = operationName(type);
|
|
6908
6878
|
var usedOperationName = operationName(operation.type);
|
|
6909
6879
|
__DEV__ ? tsInvariant.invariant(operation.type === type, "Running a ".concat(requiredOperationName, " requires a graphql ") +
|
|
6910
|
-
"".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type,
|
|
6880
|
+
"".concat(requiredOperationName, ", but a ").concat(usedOperationName, " was used instead.")) : tsInvariant.invariant(operation.type === type, 41);
|
|
6911
6881
|
}
|
|
6912
6882
|
|
|
6913
6883
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -7438,9 +7408,13 @@ function useSubscription(subscription, options) {
|
|
|
7438
7408
|
if (!observable) {
|
|
7439
7409
|
return;
|
|
7440
7410
|
}
|
|
7411
|
+
var subscriptionStopped = false;
|
|
7441
7412
|
var subscription = observable.subscribe({
|
|
7442
7413
|
next: function (fetchResult) {
|
|
7443
7414
|
var _a, _b;
|
|
7415
|
+
if (subscriptionStopped) {
|
|
7416
|
+
return;
|
|
7417
|
+
}
|
|
7444
7418
|
var result = {
|
|
7445
7419
|
loading: false,
|
|
7446
7420
|
data: fetchResult.data,
|
|
@@ -7463,26 +7437,33 @@ function useSubscription(subscription, options) {
|
|
|
7463
7437
|
},
|
|
7464
7438
|
error: function (error) {
|
|
7465
7439
|
var _a, _b;
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7440
|
+
if (!subscriptionStopped) {
|
|
7441
|
+
setResult({
|
|
7442
|
+
loading: false,
|
|
7443
|
+
data: void 0,
|
|
7444
|
+
error: error,
|
|
7445
|
+
variables: options === null || options === void 0 ? void 0 : options.variables,
|
|
7446
|
+
});
|
|
7447
|
+
(_b = (_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);
|
|
7448
|
+
}
|
|
7473
7449
|
},
|
|
7474
7450
|
complete: function () {
|
|
7475
7451
|
var _a, _b;
|
|
7476
|
-
if (
|
|
7477
|
-
ref.current.options.onComplete
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
ref.current.options.onSubscriptionComplete
|
|
7452
|
+
if (!subscriptionStopped) {
|
|
7453
|
+
if ((_a = ref.current.options) === null || _a === void 0 ? void 0 : _a.onComplete) {
|
|
7454
|
+
ref.current.options.onComplete();
|
|
7455
|
+
}
|
|
7456
|
+
else if ((_b = ref.current.options) === null || _b === void 0 ? void 0 : _b.onSubscriptionComplete) {
|
|
7457
|
+
ref.current.options.onSubscriptionComplete();
|
|
7458
|
+
}
|
|
7481
7459
|
}
|
|
7482
7460
|
},
|
|
7483
7461
|
});
|
|
7484
7462
|
return function () {
|
|
7485
|
-
|
|
7463
|
+
subscriptionStopped = true;
|
|
7464
|
+
setTimeout(function () {
|
|
7465
|
+
subscription.unsubscribe();
|
|
7466
|
+
});
|
|
7486
7467
|
};
|
|
7487
7468
|
}, [observable]);
|
|
7488
7469
|
return result;
|
|
@@ -7506,7 +7487,7 @@ function useReactiveVar(rv) {
|
|
|
7506
7487
|
function useFragment_experimental(options) {
|
|
7507
7488
|
var cache = useApolloClient().cache;
|
|
7508
7489
|
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"]);
|
|
7509
|
-
var diffOptions = tslib.__assign(tslib.__assign({}, rest), { id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
7490
|
+
var diffOptions = tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
7510
7491
|
var resultRef = React.useRef();
|
|
7511
7492
|
var latestDiff = cache.diff(diffOptions);
|
|
7512
7493
|
var getSnapshot = function () {
|
|
@@ -7574,47 +7555,51 @@ function useSuspenseCache(override) {
|
|
|
7574
7555
|
var suspenseCache = override || context.suspenseCache;
|
|
7575
7556
|
__DEV__ ? tsInvariant.invariant(suspenseCache, 'Could not find a "suspenseCache" in the context or passed in as an option. ' +
|
|
7576
7557
|
'Wrap the root component in an <ApolloProvider> and provide a suspenseCache, ' +
|
|
7577
|
-
'or pass a SuspenseCache instance in via options.') : tsInvariant.invariant(suspenseCache,
|
|
7558
|
+
'or pass a SuspenseCache instance in via options.') : tsInvariant.invariant(suspenseCache, 35);
|
|
7578
7559
|
return suspenseCache;
|
|
7579
7560
|
}
|
|
7580
7561
|
|
|
7581
7562
|
function useSuspenseQuery_experimental(query, options) {
|
|
7582
7563
|
if (options === void 0) { options = Object.create(null); }
|
|
7583
|
-
var didPreviouslySuspend = React.useRef(false);
|
|
7584
7564
|
var client = useApolloClient(options.client);
|
|
7585
7565
|
var suspenseCache = useSuspenseCache(options.suspenseCache);
|
|
7586
7566
|
var watchQueryOptions = useWatchQueryOptions({ query: query, options: options });
|
|
7587
|
-
var
|
|
7588
|
-
var
|
|
7589
|
-
var shouldSuspend = suspensePolicy === 'always' || !didPreviouslySuspend.current;
|
|
7567
|
+
var variables = watchQueryOptions.variables;
|
|
7568
|
+
var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
|
|
7590
7569
|
var cacheKey = [client, query, canonicalStringify(variables)].concat(queryKey);
|
|
7591
|
-
var
|
|
7570
|
+
var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
|
|
7592
7571
|
return client.watchQuery(watchQueryOptions);
|
|
7593
7572
|
});
|
|
7594
|
-
var
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
var refetch = React.useCallback(function (variables) {
|
|
7617
|
-
|
|
7573
|
+
var _b = React.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
|
|
7574
|
+
var promise = promiseCache.get(queryRef.key);
|
|
7575
|
+
if (!promise) {
|
|
7576
|
+
promise = queryRef.promise;
|
|
7577
|
+
promiseCache.set(queryRef.key, promise);
|
|
7578
|
+
}
|
|
7579
|
+
useTrackedQueryRefs(queryRef);
|
|
7580
|
+
React.useEffect(function () {
|
|
7581
|
+
return queryRef.listen(function (promise) {
|
|
7582
|
+
setPromiseCache(function (promiseCache) {
|
|
7583
|
+
return new Map(promiseCache).set(queryRef.key, promise);
|
|
7584
|
+
});
|
|
7585
|
+
});
|
|
7586
|
+
}, [queryRef]);
|
|
7587
|
+
var result = __use(promise);
|
|
7588
|
+
var fetchMore = React.useCallback(function (options) {
|
|
7589
|
+
var promise = queryRef.fetchMore(options);
|
|
7590
|
+
setPromiseCache(function (previousPromiseCache) {
|
|
7591
|
+
return new Map(previousPromiseCache).set(queryRef.key, promise);
|
|
7592
|
+
});
|
|
7593
|
+
return promise;
|
|
7594
|
+
}, [queryRef]);
|
|
7595
|
+
var refetch = React.useCallback(function (variables) {
|
|
7596
|
+
var promise = queryRef.refetch(variables);
|
|
7597
|
+
setPromiseCache(function (previousPromiseCache) {
|
|
7598
|
+
return new Map(previousPromiseCache).set(queryRef.key, promise);
|
|
7599
|
+
});
|
|
7600
|
+
return promise;
|
|
7601
|
+
}, [queryRef]);
|
|
7602
|
+
var subscribeToMore = React.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]);
|
|
7618
7603
|
return React.useMemo(function () {
|
|
7619
7604
|
return {
|
|
7620
7605
|
client: client,
|
|
@@ -7641,7 +7626,7 @@ function validateFetchPolicy(fetchPolicy) {
|
|
|
7641
7626
|
'no-cache',
|
|
7642
7627
|
'cache-and-network',
|
|
7643
7628
|
];
|
|
7644
|
-
__DEV__ ? tsInvariant.invariant(supportedFetchPolicies.includes(fetchPolicy), "The fetch policy `".concat(fetchPolicy, "` is not supported with suspense.")) : tsInvariant.invariant(supportedFetchPolicies.includes(fetchPolicy),
|
|
7629
|
+
__DEV__ ? tsInvariant.invariant(supportedFetchPolicies.includes(fetchPolicy), "The fetch policy `".concat(fetchPolicy, "` is not supported with suspense.")) : tsInvariant.invariant(supportedFetchPolicies.includes(fetchPolicy), 36);
|
|
7645
7630
|
}
|
|
7646
7631
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
7647
7632
|
if (fetchPolicy === 'no-cache' && returnPartialData) {
|
|
@@ -7653,79 +7638,123 @@ function toApolloError(result) {
|
|
|
7653
7638
|
? new ApolloError({ graphQLErrors: result.errors })
|
|
7654
7639
|
: result.error;
|
|
7655
7640
|
}
|
|
7656
|
-
function
|
|
7657
|
-
var
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
};
|
|
7641
|
+
function useTrackedQueryRefs(queryRef) {
|
|
7642
|
+
var trackedQueryRefs = React.useRef(new Set());
|
|
7643
|
+
trackedQueryRefs.current.add(queryRef);
|
|
7644
|
+
useStrictModeSafeCleanupEffect(function () {
|
|
7645
|
+
trackedQueryRefs.current.forEach(function (sub) { return sub.dispose(); });
|
|
7646
|
+
});
|
|
7662
7647
|
}
|
|
7663
7648
|
function useWatchQueryOptions(_a) {
|
|
7664
7649
|
var query = _a.query, options = _a.options;
|
|
7665
|
-
var watchQueryOptions = useDeepMemo(function () { return (tslib.__assign(tslib.__assign({}, options), { query: query, notifyOnNetworkStatusChange:
|
|
7650
|
+
var watchQueryOptions = useDeepMemo(function () { return (tslib.__assign(tslib.__assign({}, options), { query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 })); }, [options, query]);
|
|
7666
7651
|
if (__DEV__) {
|
|
7667
7652
|
validateOptions(watchQueryOptions);
|
|
7668
7653
|
}
|
|
7669
7654
|
return watchQueryOptions;
|
|
7670
7655
|
}
|
|
7671
|
-
function shouldUseCachedResult(result, _a) {
|
|
7672
|
-
var returnPartialData = _a.returnPartialData, fetchPolicy = _a.fetchPolicy;
|
|
7673
|
-
if (result.networkStatus === exports.NetworkStatus.refetch ||
|
|
7674
|
-
result.networkStatus === exports.NetworkStatus.fetchMore ||
|
|
7675
|
-
result.networkStatus === exports.NetworkStatus.error) {
|
|
7676
|
-
return false;
|
|
7677
|
-
}
|
|
7678
|
-
switch (fetchPolicy) {
|
|
7679
|
-
case void 0:
|
|
7680
|
-
case 'cache-first':
|
|
7681
|
-
case 'cache-and-network': {
|
|
7682
|
-
return Boolean(result.data && (!result.partial || returnPartialData));
|
|
7683
|
-
}
|
|
7684
|
-
default:
|
|
7685
|
-
return false;
|
|
7686
|
-
}
|
|
7687
|
-
}
|
|
7688
7656
|
|
|
7689
|
-
function
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7657
|
+
function useBackgroundQuery_experimental(query, options) {
|
|
7658
|
+
if (options === void 0) { options = Object.create(null); }
|
|
7659
|
+
var suspenseCache = useSuspenseCache(options.suspenseCache);
|
|
7660
|
+
var client = useApolloClient(options.client);
|
|
7661
|
+
var watchQueryOptions = useWatchQueryOptions({ query: query, options: options });
|
|
7662
|
+
var variables = watchQueryOptions.variables;
|
|
7663
|
+
var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
|
|
7664
|
+
var cacheKey = [client, query, canonicalStringify(variables)].concat(queryKey);
|
|
7665
|
+
var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
|
|
7666
|
+
return client.watchQuery(watchQueryOptions);
|
|
7667
|
+
});
|
|
7668
|
+
var _b = React.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
|
|
7669
|
+
useTrackedQueryRefs(queryRef);
|
|
7670
|
+
var fetchMore = React.useCallback(function (options) {
|
|
7671
|
+
var promise = queryRef.fetchMore(options);
|
|
7672
|
+
setPromiseCache(function (promiseCache) {
|
|
7673
|
+
return new Map(promiseCache).set(queryRef.key, promise);
|
|
7674
|
+
});
|
|
7675
|
+
return promise;
|
|
7676
|
+
}, [queryRef]);
|
|
7677
|
+
var refetch = React.useCallback(function (variables) {
|
|
7678
|
+
var promise = queryRef.refetch(variables);
|
|
7679
|
+
setPromiseCache(function (promiseCache) {
|
|
7680
|
+
return new Map(promiseCache).set(queryRef.key, promise);
|
|
7681
|
+
});
|
|
7682
|
+
return promise;
|
|
7683
|
+
}, [queryRef]);
|
|
7684
|
+
queryRef.promiseCache = promiseCache;
|
|
7685
|
+
return React.useMemo(function () {
|
|
7686
|
+
return [
|
|
7687
|
+
queryRef,
|
|
7688
|
+
{
|
|
7689
|
+
fetchMore: fetchMore,
|
|
7690
|
+
refetch: refetch,
|
|
7695
7691
|
},
|
|
7696
|
-
|
|
7692
|
+
];
|
|
7693
|
+
}, [queryRef, fetchMore, refetch]);
|
|
7694
|
+
}
|
|
7695
|
+
function useReadQuery_experimental(queryRef) {
|
|
7696
|
+
var _a = React.useState(0), forceUpdate = _a[1];
|
|
7697
|
+
__DEV__ ? tsInvariant.invariant(queryRef.promiseCache, 'It appears that `useReadQuery` was used outside of `useBackgroundQuery`. ' +
|
|
7698
|
+
'`useReadQuery` is only supported for use with `useBackgroundQuery`. ' +
|
|
7699
|
+
'Please ensure you are passing the `queryRef` returned from `useBackgroundQuery`.') : tsInvariant.invariant(queryRef.promiseCache, 34);
|
|
7700
|
+
var promise = queryRef.promiseCache.get(queryRef.key);
|
|
7701
|
+
if (!promise) {
|
|
7702
|
+
promise = queryRef.promise;
|
|
7703
|
+
queryRef.promiseCache.set(queryRef.key, promise);
|
|
7704
|
+
}
|
|
7705
|
+
React.useEffect(function () {
|
|
7706
|
+
return queryRef.listen(function (promise) {
|
|
7707
|
+
queryRef.promiseCache.set(queryRef.key, promise);
|
|
7708
|
+
forceUpdate(function (prevState) { return prevState + 1; });
|
|
7697
7709
|
});
|
|
7698
|
-
});
|
|
7710
|
+
}, [queryRef]);
|
|
7711
|
+
var result = __use(promise);
|
|
7712
|
+
return React.useMemo(function () {
|
|
7713
|
+
return {
|
|
7714
|
+
data: result.data,
|
|
7715
|
+
networkStatus: result.networkStatus,
|
|
7716
|
+
error: toApolloError(result),
|
|
7717
|
+
};
|
|
7718
|
+
}, [result]);
|
|
7699
7719
|
}
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
var
|
|
7704
|
-
function QuerySubscription(observable, options) {
|
|
7705
|
-
if (options === void 0) { options = Object.create(null); }
|
|
7720
|
+
|
|
7721
|
+
var QueryReference = (function () {
|
|
7722
|
+
function QueryReference(observable, options) {
|
|
7723
|
+
var _this = this;
|
|
7706
7724
|
var _a;
|
|
7707
7725
|
this.listeners = new Set();
|
|
7726
|
+
this.initialized = false;
|
|
7727
|
+
this.refetching = false;
|
|
7708
7728
|
this.listen = this.listen.bind(this);
|
|
7709
7729
|
this.handleNext = this.handleNext.bind(this);
|
|
7710
7730
|
this.handleError = this.handleError.bind(this);
|
|
7711
7731
|
this.dispose = this.dispose.bind(this);
|
|
7712
7732
|
this.observable = observable;
|
|
7713
|
-
this.result = observable.getCurrentResult();
|
|
7733
|
+
this.result = observable.getCurrentResult(false);
|
|
7734
|
+
this.key = options.key;
|
|
7714
7735
|
if (options.onDispose) {
|
|
7715
7736
|
this.onDispose = options.onDispose;
|
|
7716
7737
|
}
|
|
7738
|
+
if (isNetworkRequestSettled(this.result.networkStatus) ||
|
|
7739
|
+
(this.result.data &&
|
|
7740
|
+
(!this.result.partial || this.observable.options.returnPartialData))) {
|
|
7741
|
+
this.promise = createFulfilledPromise(this.result);
|
|
7742
|
+
this.initialized = true;
|
|
7743
|
+
this.refetching = false;
|
|
7744
|
+
}
|
|
7717
7745
|
this.subscription = observable.subscribe({
|
|
7718
7746
|
next: this.handleNext,
|
|
7719
7747
|
error: this.handleError,
|
|
7720
7748
|
});
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7749
|
+
if (!this.promise) {
|
|
7750
|
+
this.promise = new Promise(function (resolve, reject) {
|
|
7751
|
+
_this.resolve = resolve;
|
|
7752
|
+
_this.reject = reject;
|
|
7753
|
+
});
|
|
7754
|
+
}
|
|
7726
7755
|
this.autoDisposeTimeoutId = setTimeout(this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
|
|
7727
7756
|
}
|
|
7728
|
-
|
|
7757
|
+
QueryReference.prototype.listen = function (listener) {
|
|
7729
7758
|
var _this = this;
|
|
7730
7759
|
clearTimeout(this.autoDisposeTimeoutId);
|
|
7731
7760
|
this.listeners.add(listener);
|
|
@@ -7733,57 +7762,83 @@ var QuerySubscription = (function () {
|
|
|
7733
7762
|
_this.listeners.delete(listener);
|
|
7734
7763
|
};
|
|
7735
7764
|
};
|
|
7736
|
-
|
|
7737
|
-
this.
|
|
7738
|
-
|
|
7765
|
+
QueryReference.prototype.refetch = function (variables) {
|
|
7766
|
+
this.refetching = true;
|
|
7767
|
+
var promise = this.observable.refetch(variables);
|
|
7768
|
+
this.promise = promise;
|
|
7769
|
+
return promise;
|
|
7739
7770
|
};
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7771
|
+
QueryReference.prototype.fetchMore = function (options) {
|
|
7772
|
+
var promise = this.observable.fetchMore(options);
|
|
7773
|
+
this.promise = promise;
|
|
7774
|
+
return promise;
|
|
7743
7775
|
};
|
|
7744
|
-
|
|
7776
|
+
QueryReference.prototype.dispose = function () {
|
|
7745
7777
|
this.subscription.unsubscribe();
|
|
7746
7778
|
this.onDispose();
|
|
7747
7779
|
};
|
|
7748
|
-
|
|
7780
|
+
QueryReference.prototype.onDispose = function () {
|
|
7749
7781
|
};
|
|
7750
|
-
|
|
7751
|
-
if (
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7782
|
+
QueryReference.prototype.handleNext = function (result) {
|
|
7783
|
+
if (!this.initialized || this.refetching) {
|
|
7784
|
+
if (!isNetworkRequestSettled(result.networkStatus)) {
|
|
7785
|
+
return;
|
|
7786
|
+
}
|
|
7787
|
+
if (this.result.data && result.data === void 0) {
|
|
7788
|
+
result.data = this.result.data;
|
|
7789
|
+
}
|
|
7790
|
+
this.initialized = true;
|
|
7791
|
+
this.refetching = false;
|
|
7792
|
+
this.result = result;
|
|
7793
|
+
this.resolve(result);
|
|
7794
|
+
return;
|
|
7795
|
+
}
|
|
7796
|
+
if (result.data === this.result.data) {
|
|
7797
|
+
return;
|
|
7755
7798
|
}
|
|
7756
7799
|
this.result = result;
|
|
7757
|
-
this.
|
|
7800
|
+
this.promise = createFulfilledPromise(result);
|
|
7801
|
+
this.deliver(this.promise);
|
|
7758
7802
|
};
|
|
7759
|
-
|
|
7803
|
+
QueryReference.prototype.handleError = function (error) {
|
|
7760
7804
|
var result = tslib.__assign(tslib.__assign({}, this.result), { error: error, networkStatus: exports.NetworkStatus.error });
|
|
7761
7805
|
this.result = result;
|
|
7762
|
-
this.
|
|
7806
|
+
if (!this.initialized || this.refetching) {
|
|
7807
|
+
this.initialized = true;
|
|
7808
|
+
this.refetching = false;
|
|
7809
|
+
this.reject(error);
|
|
7810
|
+
return;
|
|
7811
|
+
}
|
|
7812
|
+
this.result = result;
|
|
7813
|
+
this.promise = result.data
|
|
7814
|
+
? createFulfilledPromise(result)
|
|
7815
|
+
: createRejectedPromise(result);
|
|
7816
|
+
this.deliver(this.promise);
|
|
7763
7817
|
};
|
|
7764
|
-
|
|
7765
|
-
this.listeners.forEach(function (listener) { return listener(
|
|
7818
|
+
QueryReference.prototype.deliver = function (promise) {
|
|
7819
|
+
this.listeners.forEach(function (listener) { return listener(promise); });
|
|
7766
7820
|
};
|
|
7767
|
-
return
|
|
7821
|
+
return QueryReference;
|
|
7768
7822
|
}());
|
|
7769
7823
|
|
|
7770
7824
|
var SuspenseCache = (function () {
|
|
7771
7825
|
function SuspenseCache(options) {
|
|
7772
7826
|
if (options === void 0) { options = Object.create(null); }
|
|
7773
7827
|
this.cacheKeys = new trie.Trie(canUseWeakMap, function (cacheKey) { return cacheKey; });
|
|
7774
|
-
this.
|
|
7828
|
+
this.queryRefs = new Map();
|
|
7775
7829
|
this.options = options;
|
|
7776
7830
|
}
|
|
7777
|
-
SuspenseCache.prototype.
|
|
7831
|
+
SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {
|
|
7778
7832
|
var _this = this;
|
|
7779
7833
|
var stableCacheKey = this.cacheKeys.lookupArray(cacheKey);
|
|
7780
|
-
if (!this.
|
|
7781
|
-
this.
|
|
7834
|
+
if (!this.queryRefs.has(stableCacheKey)) {
|
|
7835
|
+
this.queryRefs.set(stableCacheKey, new QueryReference(createObservable(), {
|
|
7836
|
+
key: stableCacheKey,
|
|
7782
7837
|
autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,
|
|
7783
|
-
onDispose: function () { return _this.
|
|
7838
|
+
onDispose: function () { return _this.queryRefs.delete(stableCacheKey); },
|
|
7784
7839
|
}));
|
|
7785
7840
|
}
|
|
7786
|
-
return this.
|
|
7841
|
+
return this.queryRefs.get(stableCacheKey);
|
|
7787
7842
|
};
|
|
7788
7843
|
return SuspenseCache;
|
|
7789
7844
|
}());
|
|
@@ -7828,7 +7883,7 @@ exports.mergeOptions = mergeOptions;
|
|
|
7828
7883
|
exports.operationName = operationName;
|
|
7829
7884
|
exports.parseAndCheckHttpResponse = parseAndCheckHttpResponse;
|
|
7830
7885
|
exports.parser = parser;
|
|
7831
|
-
exports.resetApolloContext =
|
|
7886
|
+
exports.resetApolloContext = resetApolloContext;
|
|
7832
7887
|
exports.rewriteURIForGET = rewriteURIForGET;
|
|
7833
7888
|
exports.selectHttpOptionsAndBody = selectHttpOptionsAndBody;
|
|
7834
7889
|
exports.selectHttpOptionsAndBodyInternal = selectHttpOptionsAndBodyInternal;
|
|
@@ -7838,11 +7893,13 @@ exports.split = split;
|
|
|
7838
7893
|
exports.throwServerError = throwServerError;
|
|
7839
7894
|
exports.toPromise = toPromise;
|
|
7840
7895
|
exports.useApolloClient = useApolloClient;
|
|
7896
|
+
exports.useBackgroundQuery_experimental = useBackgroundQuery_experimental;
|
|
7841
7897
|
exports.useFragment_experimental = useFragment_experimental;
|
|
7842
7898
|
exports.useLazyQuery = useLazyQuery;
|
|
7843
7899
|
exports.useMutation = useMutation;
|
|
7844
7900
|
exports.useQuery = useQuery;
|
|
7845
7901
|
exports.useReactiveVar = useReactiveVar;
|
|
7902
|
+
exports.useReadQuery_experimental = useReadQuery_experimental;
|
|
7846
7903
|
exports.useSubscription = useSubscription;
|
|
7847
7904
|
exports.useSuspenseQuery_experimental = useSuspenseQuery_experimental;
|
|
7848
7905
|
//# sourceMappingURL=apollo-client.cjs.map
|