@apollo/client 3.8.0-beta.6 → 3.8.0-rc.0
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 +416 -398
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +12 -12
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +12 -12
- package/cache/core/cache.d.ts +3 -3
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +3 -3
- 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 +2 -2
- 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 +2 -2
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/index.d.ts +14 -14
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +13 -13
- package/cache/index.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 +3 -3
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +5 -5
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +8 -8
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +13 -13
- 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/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +2 -3
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts +6 -6
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +9 -9
- 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 +7 -7
- 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 +10 -10
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/setup.d.ts +1 -1
- package/config/jest/setup.d.ts.map +1 -1
- package/config/jest/setup.js +7 -2
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.d.ts +10 -10
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +10 -10
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +5 -5
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +3 -3
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +10 -10
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +11 -11
- 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 +4 -4
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +10 -10
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +17 -17
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +25 -24
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +25 -24
- package/core/equalByQuery.d.ts +2 -2
- package/core/equalByQuery.d.ts.map +1 -1
- package/core/equalByQuery.js +9 -8
- package/core/equalByQuery.js.map +1 -1
- package/core/index.d.ts +13 -13
- package/core/index.d.ts.map +1 -1
- package/core/index.js +12 -13
- package/core/index.js.map +1 -1
- package/core/types.d.ts +10 -10
- package/core/types.d.ts.map +1 -1
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +4 -4
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +29 -39
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +29 -39
- package/dev/index.d.ts +3 -3
- package/dev/index.d.ts.map +1 -1
- package/dev/index.js +3 -3
- package/dev/index.js.map +1 -1
- package/dev/loadDevMessages.js +2 -2
- package/dev/loadDevMessages.js.map +1 -1
- package/dev/loadErrorMessageHandler.d.ts +1 -1
- package/dev/loadErrorMessageHandler.d.ts.map +1 -1
- package/dev/loadErrorMessageHandler.js +2 -2
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/dev/loadErrorMessages.js +2 -2
- package/dev/loadErrorMessages.js.map +1 -1
- package/errors/errors.cjs.map +1 -1
- package/errors/index.d.ts +4 -4
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +2 -2
- package/errors/index.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/invariantErrorCodes.js +27 -36
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batchLink.d.ts +5 -5
- package/link/batch/batchLink.d.ts.map +1 -1
- package/link/batch/batchLink.js +3 -3
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.d.ts +2 -2
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js +1 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch/index.d.ts +1 -1
- package/link/batch/index.d.ts.map +1 -1
- package/link/batch/index.js +1 -1
- package/link/batch/index.js.map +1 -1
- package/link/batch-http/batch-http.cjs +5 -7
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +5 -7
- package/link/batch-http/batchHttpLink.d.ts +5 -5
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +10 -12
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/batch-http/index.d.ts +1 -1
- package/link/batch-http/index.d.ts.map +1 -1
- package/link/batch-http/index.js +1 -1
- package/link/batch-http/index.js.map +1 -1
- package/link/context/context.cjs.map +1 -1
- package/link/context/index.d.ts +3 -3
- package/link/context/index.d.ts.map +1 -1
- package/link/context/index.js +2 -2
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +3 -3
- package/link/core/ApolloLink.d.ts.map +1 -1
- package/link/core/ApolloLink.js +4 -4
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/concat.d.ts +1 -1
- package/link/core/concat.d.ts.map +1 -1
- package/link/core/concat.js +1 -1
- package/link/core/concat.js.map +1 -1
- package/link/core/core.cjs +1 -1
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +1 -1
- package/link/core/empty.d.ts +1 -1
- package/link/core/empty.d.ts.map +1 -1
- package/link/core/empty.js +1 -1
- package/link/core/empty.js.map +1 -1
- package/link/core/execute.d.ts +1 -1
- package/link/core/execute.d.ts.map +1 -1
- package/link/core/execute.js +1 -1
- package/link/core/execute.js.map +1 -1
- package/link/core/from.d.ts +1 -1
- package/link/core/from.d.ts.map +1 -1
- package/link/core/from.js +1 -1
- package/link/core/from.js.map +1 -1
- package/link/core/index.d.ts +8 -8
- package/link/core/index.d.ts.map +1 -1
- package/link/core/index.js +8 -8
- package/link/core/index.js.map +1 -1
- package/link/core/split.d.ts +1 -1
- package/link/core/split.d.ts.map +1 -1
- package/link/core/split.js +1 -1
- package/link/core/split.js.map +1 -1
- package/link/core/types.d.ts +2 -2
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/error/error.cjs.map +1 -1
- package/link/error/index.d.ts +4 -4
- package/link/error/index.d.ts.map +1 -1
- package/link/error/index.js +2 -2
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +3 -3
- package/link/http/HttpLink.d.ts.map +1 -1
- package/link/http/HttpLink.js +2 -2
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.d.ts +2 -2
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +28 -23
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/createSignalIfSupported.d.ts.map +1 -1
- package/link/http/createSignalIfSupported.js.map +1 -1
- package/link/http/http.cjs +49 -62
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +49 -62
- package/link/http/index.d.ts +10 -10
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +10 -10
- package/link/http/index.js.map +1 -1
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/iterators/promise.js.map +1 -1
- package/link/http/iterators/reader.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts +4 -5
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +34 -53
- package/link/http/parseAndCheckHttpResponse.js.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 +1 -1
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +2 -2
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +1 -1
- 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/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.d.ts.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.d.ts +3 -3
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +4 -4
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/remove-typename/index.d.ts +1 -1
- package/link/remove-typename/index.d.ts.map +1 -1
- package/link/remove-typename/index.js +1 -1
- package/link/remove-typename/index.js.map +1 -1
- package/link/remove-typename/remove-typename.cjs.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts +1 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.js +2 -2
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- 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/index.d.ts +1 -1
- package/link/retry/index.d.ts.map +1 -1
- package/link/retry/index.js +1 -1
- package/link/retry/index.js.map +1 -1
- package/link/retry/retry.cjs.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 +5 -5
- package/link/retry/retryLink.d.ts.map +1 -1
- package/link/retry/retryLink.js +4 -4
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +3 -3
- package/link/schema/index.d.ts.map +1 -1
- package/link/schema/index.js +2 -2
- package/link/schema/index.js.map +1 -1
- package/link/schema/schema.cjs.map +1 -1
- package/link/subscriptions/index.d.ts +3 -3
- package/link/subscriptions/index.d.ts.map +1 -1
- package/link/subscriptions/index.js +1 -1
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs.map +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/fromError.d.ts +1 -1
- package/link/utils/fromError.d.ts.map +1 -1
- package/link/utils/fromError.js +1 -1
- package/link/utils/fromError.js.map +1 -1
- package/link/utils/fromPromise.d.ts +1 -1
- package/link/utils/fromPromise.d.ts.map +1 -1
- package/link/utils/fromPromise.js +1 -1
- package/link/utils/fromPromise.js.map +1 -1
- package/link/utils/index.d.ts +9 -9
- package/link/utils/index.d.ts.map +1 -1
- package/link/utils/index.js +9 -9
- package/link/utils/index.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 +2 -2
- 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 +1 -1
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/utils.cjs +1 -1
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +1 -1
- package/link/utils/validateOperation.d.ts +1 -1
- package/link/utils/validateOperation.d.ts.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +3 -3
- package/link/ws/index.d.ts.map +1 -1
- package/link/ws/index.js +1 -1
- package/link/ws/index.js.map +1 -1
- package/link/ws/ws.cjs.map +1 -1
- package/package.json +20 -16
- package/react/cache/QueryReference.d.ts +8 -7
- package/react/cache/QueryReference.d.ts.map +1 -1
- package/react/cache/QueryReference.js +84 -53
- package/react/cache/QueryReference.js.map +1 -1
- package/react/cache/SuspenseCache.d.ts +4 -5
- package/react/cache/SuspenseCache.d.ts.map +1 -1
- package/react/cache/SuspenseCache.js +2 -2
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/cache/getSuspenseCache.d.ts +16 -0
- package/react/cache/getSuspenseCache.d.ts.map +1 -0
- package/react/cache/getSuspenseCache.js +10 -0
- package/react/cache/getSuspenseCache.js.map +1 -0
- package/react/cache/index.d.ts +6 -1
- package/react/cache/index.d.ts.map +1 -1
- package/react/cache/index.js +15 -1
- package/react/cache/index.js.map +1 -1
- package/react/cache/types.d.ts +2 -1
- package/react/cache/types.d.ts.map +1 -1
- package/react/cache/types.js.map +1 -1
- package/react/components/Mutation.d.ts +3 -3
- package/react/components/Mutation.d.ts.map +1 -1
- package/react/components/Mutation.js +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 +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 +1 -1
- package/react/components/Subscription.js.map +1 -1
- package/react/components/components.cjs.map +1 -1
- package/react/components/index.d.ts +4 -4
- package/react/components/index.d.ts.map +1 -1
- package/react/components/index.js +4 -4
- package/react/components/index.js.map +1 -1
- package/react/components/types.d.ts +2 -2
- 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 +2 -2
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +3 -6
- package/react/context/ApolloContext.d.ts.map +1 -1
- package/react/context/ApolloContext.js +11 -4
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +1 -3
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +5 -5
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs +12 -5
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +12 -5
- package/react/context/index.d.ts +4 -4
- package/react/context/index.d.ts.map +1 -1
- package/react/context/index.js +4 -4
- package/react/context/index.js.map +1 -1
- package/react/hoc/graphql.d.ts +2 -2
- package/react/hoc/graphql.d.ts.map +1 -1
- package/react/hoc/graphql.js +4 -4
- 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 +1 -1
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/index.d.ts +7 -7
- package/react/hoc/index.d.ts.map +1 -1
- package/react/hoc/index.js +7 -7
- package/react/hoc/index.js.map +1 -1
- package/react/hoc/mutation-hoc.d.ts +3 -3
- package/react/hoc/mutation-hoc.d.ts.map +1 -1
- package/react/hoc/mutation-hoc.js +3 -3
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.d.ts +1 -1
- package/react/hoc/query-hoc.d.ts.map +1 -1
- package/react/hoc/query-hoc.js +3 -3
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.d.ts +1 -1
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.js +3 -3
- 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 +2 -2
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +279 -231
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +279 -231
- package/react/hooks/index.d.ts +11 -11
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +11 -11
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/internal/__use.js +2 -2
- package/react/hooks/internal/__use.js.map +1 -1
- package/react/hooks/internal/index.d.ts +3 -4
- package/react/hooks/internal/index.d.ts.map +1 -1
- package/react/hooks/internal/index.js +3 -4
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useDeepMemo.js +2 -2
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +2 -2
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +4 -4
- package/react/hooks/internal/useIsomorphicLayoutEffect.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 +4 -4
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +5 -5
- package/react/hooks/useBackgroundQuery.d.ts.map +1 -1
- package/react/hooks/useBackgroundQuery.js +19 -15
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.d.ts +4 -4
- package/react/hooks/useFragment.d.ts.map +1 -1
- package/react/hooks/useFragment.js +2 -2
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +2 -2
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js +9 -9
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +2 -2
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +10 -10
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +4 -4
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +17 -17
- 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 +3 -3
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +3 -3
- package/react/hooks/useReadQuery.d.ts.map +1 -1
- package/react/hooks/useReadQuery.js +5 -5
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +2 -2
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +14 -14
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +4 -6
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js +33 -33
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +4 -4
- package/react/hooks/useSyncExternalStore.js.map +1 -1
- package/react/index.d.ts +6 -6
- package/react/index.d.ts.map +1 -1
- package/react/index.js +6 -6
- package/react/index.js.map +1 -1
- package/react/parser/index.js +6 -6
- 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 +96 -54
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +96 -54
- 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/getDataFromTree.js +2 -2
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/index.d.ts +3 -3
- package/react/ssr/index.d.ts.map +1 -1
- package/react/ssr/index.js +3 -3
- package/react/ssr/index.js.map +1 -1
- package/react/ssr/renderToStringWithData.js +1 -1
- package/react/ssr/renderToStringWithData.js.map +1 -1
- package/react/ssr/ssr.cjs.map +1 -1
- package/react/types/types.d.ts +7 -7
- 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/index.d.ts +7 -7
- package/testing/core/index.d.ts.map +1 -1
- package/testing/core/index.js +7 -7
- package/testing/core/index.js.map +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 +3 -3
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +3 -3
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +4 -4
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts +3 -3
- package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
- package/testing/core/mocking/mockQueryManager.js +3 -3
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +3 -3
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js +2 -2
- 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 +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 +1 -1
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/index.d.ts +3 -3
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +3 -3
- package/testing/index.js.map +1 -1
- package/testing/matchers/index.js +2 -2
- package/testing/matchers/index.js.map +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts +1 -2
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts.map +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js +12 -6
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
- package/testing/matchers/toMatchDocument.d.ts +1 -1
- package/testing/matchers/toMatchDocument.d.ts.map +1 -1
- package/testing/matchers/toMatchDocument.js +1 -1
- package/testing/matchers/toMatchDocument.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +6 -9
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +8 -10
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +4 -6
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +4 -6
- package/utilities/common/canUse.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/maybeDeepFreeze.d.ts.map +1 -1
- package/utilities/common/maybeDeepFreeze.js +3 -4
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts +1 -1
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts +1 -1
- package/utilities/common/mergeOptions.d.ts.map +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/common/omitDeep.d.ts +1 -1
- package/utilities/common/omitDeep.d.ts.map +1 -1
- package/utilities/common/omitDeep.js +1 -1
- package/utilities/common/omitDeep.js.map +1 -1
- package/utilities/common/responseIterator.js.map +1 -1
- package/utilities/common/stringifyForDisplay.js.map +1 -1
- package/utilities/common/stripTypename.d.ts +1 -1
- package/utilities/common/stripTypename.d.ts.map +1 -1
- package/utilities/common/stripTypename.js +1 -1
- package/utilities/common/stripTypename.js.map +1 -1
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +4 -16
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +4 -16
- package/utilities/globals/index.d.ts +5 -6
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +2 -5
- package/utilities/globals/index.js.map +1 -1
- package/utilities/globals/invariantWrappers.d.ts +1 -1
- package/utilities/globals/invariantWrappers.d.ts.map +1 -1
- package/utilities/globals/invariantWrappers.js +3 -3
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/graphql/DocumentTransform.js +4 -4
- package/utilities/graphql/DocumentTransform.js.map +1 -1
- package/utilities/graphql/directives.js +5 -5
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.js +4 -4
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.js +10 -10
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/operations.d.ts +1 -1
- package/utilities/graphql/operations.d.ts.map +1 -1
- package/utilities/graphql/operations.js +1 -1
- package/utilities/graphql/operations.js.map +1 -1
- package/utilities/graphql/print.js +1 -1
- package/utilities/graphql/print.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +1 -1
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +4 -4
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.js +7 -7
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +34 -34
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +32 -32
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.d.ts +2 -2
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/asyncMap.d.ts +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/observables/subclassing.d.ts +1 -1
- package/utilities/observables/subclassing.d.ts.map +1 -1
- package/utilities/observables/subclassing.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 +1 -1
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/types/DeepOmit.d.ts +1 -1
- package/utilities/types/DeepOmit.d.ts.map +1 -1
- package/utilities/types/DeepOmit.js.map +1 -1
- package/utilities/types/DeepPartial.d.ts +1 -1
- package/utilities/types/DeepPartial.d.ts.map +1 -1
- package/utilities/types/DeepPartial.js.map +1 -1
- package/utilities/utilities.cjs +21 -21
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +21 -21
- package/version.js +1 -1
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts +0 -2
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.d.ts.map +0 -1
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.js +0 -11
- package/react/hooks/internal/useStrictModeSafeCleanupEffect.js.map +0 -1
- package/react/hooks/useSuspenseCache.d.ts +0 -3
- package/react/hooks/useSuspenseCache.d.ts.map +0 -1
- package/react/hooks/useSuspenseCache.js +0 -10
- package/react/hooks/useSuspenseCache.js.map +0 -1
- package/utilities/globals/DEV.d.ts +0 -3
- package/utilities/globals/DEV.d.ts.map +0 -1
- package/utilities/globals/DEV.js +0 -4
- package/utilities/globals/DEV.js.map +0 -1
- package/utilities/globals/fix-graphql.d.ts +0 -2
- package/utilities/globals/fix-graphql.d.ts.map +0 -1
- package/utilities/globals/fix-graphql.js +0 -6
- package/utilities/globals/fix-graphql.js.map +0 -1
package/apollo-client.cjs
CHANGED
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var tslib = require('tslib');
|
|
6
|
-
var process$1 = require('ts-invariant/process');
|
|
7
|
-
var graphql = require('graphql');
|
|
8
|
-
var equal = require('@wry/equality');
|
|
9
6
|
var invariant$1 = require('ts-invariant');
|
|
7
|
+
var equal = require('@wry/equality');
|
|
8
|
+
var graphql = require('graphql');
|
|
10
9
|
var zenObservableTs = require('zen-observable-ts');
|
|
11
10
|
require('symbol-observable');
|
|
12
11
|
var optimism = require('optimism');
|
|
@@ -29,12 +28,11 @@ function _interopNamespace(e) {
|
|
|
29
28
|
return Object.freeze(n);
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
33
31
|
var invariant__default = /*#__PURE__*/_interopDefaultLegacy(invariant$1);
|
|
32
|
+
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
34
33
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
35
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
36
34
|
|
|
37
|
-
var version = '3.8.0-
|
|
35
|
+
var version = '3.8.0-rc.0';
|
|
38
36
|
|
|
39
37
|
function maybe(thunk) {
|
|
40
38
|
try {
|
|
@@ -46,8 +44,7 @@ function maybe(thunk) {
|
|
|
46
44
|
var global$1 = (maybe(function () { return globalThis; }) ||
|
|
47
45
|
maybe(function () { return window; }) ||
|
|
48
46
|
maybe(function () { return self; }) ||
|
|
49
|
-
maybe(function () { return global; }) ||
|
|
50
|
-
maybe(function () { return maybe.constructor("return this")(); }));
|
|
47
|
+
maybe(function () { return global; }) || maybe(function () { return maybe.constructor("return this")(); }));
|
|
51
48
|
|
|
52
49
|
var prefixCounts = new Map();
|
|
53
50
|
function makeUniqueId(prefix) {
|
|
@@ -111,17 +108,6 @@ function getErrorMsg(message, messageArgs) {
|
|
|
111
108
|
}))));
|
|
112
109
|
}
|
|
113
110
|
|
|
114
|
-
var DEV = ("__DEV__" in global$1
|
|
115
|
-
? Boolean(global$1.__DEV__)
|
|
116
|
-
: maybe(function () { return process.env.NODE_ENV; }) !== "production");
|
|
117
|
-
|
|
118
|
-
function removeTemporaryGlobals() {
|
|
119
|
-
return typeof graphql.Source === "function" ? process$1.remove() : process$1.remove();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
var __DEV__ = DEV;
|
|
123
|
-
removeTemporaryGlobals();
|
|
124
|
-
|
|
125
111
|
function shouldInclude(_a, variables) {
|
|
126
112
|
var directives = _a.directives;
|
|
127
113
|
if (!directives || !directives.length) {
|
|
@@ -132,7 +118,7 @@ function shouldInclude(_a, variables) {
|
|
|
132
118
|
var evaledValue = false;
|
|
133
119
|
if (ifArgument.value.kind === 'Variable') {
|
|
134
120
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
135
|
-
invariant(evaledValue !== void 0,
|
|
121
|
+
invariant(evaledValue !== void 0, 64, directive.name.value);
|
|
136
122
|
}
|
|
137
123
|
else {
|
|
138
124
|
evaledValue = ifArgument.value.value;
|
|
@@ -168,12 +154,12 @@ function getInclusionDirectives(directives) {
|
|
|
168
154
|
return;
|
|
169
155
|
var directiveArguments = directive.arguments;
|
|
170
156
|
var directiveName = directive.name.value;
|
|
171
|
-
invariant(directiveArguments && directiveArguments.length === 1,
|
|
157
|
+
invariant(directiveArguments && directiveArguments.length === 1, 65, directiveName);
|
|
172
158
|
var ifArgument = directiveArguments[0];
|
|
173
|
-
invariant(ifArgument.name && ifArgument.name.value === 'if',
|
|
159
|
+
invariant(ifArgument.name && ifArgument.name.value === 'if', 66, directiveName);
|
|
174
160
|
var ifValue = ifArgument.value;
|
|
175
161
|
invariant(ifValue &&
|
|
176
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
162
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 67, directiveName);
|
|
177
163
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
178
164
|
});
|
|
179
165
|
}
|
|
@@ -200,7 +186,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
200
186
|
document.definitions.forEach(function (definition) {
|
|
201
187
|
if (definition.kind === 'OperationDefinition') {
|
|
202
188
|
throw newInvariantError(
|
|
203
|
-
|
|
189
|
+
68,
|
|
204
190
|
definition.operation,
|
|
205
191
|
definition.name ? " named '".concat(definition.name.value, "'") : ''
|
|
206
192
|
);
|
|
@@ -210,7 +196,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
210
196
|
}
|
|
211
197
|
});
|
|
212
198
|
if (typeof actualFragmentName === 'undefined') {
|
|
213
|
-
invariant(fragments.length === 1,
|
|
199
|
+
invariant(fragments.length === 1, 69, fragments.length);
|
|
214
200
|
actualFragmentName = fragments[0].name.value;
|
|
215
201
|
}
|
|
216
202
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -251,7 +237,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
251
237
|
return fragmentMap(fragmentName);
|
|
252
238
|
}
|
|
253
239
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
254
|
-
invariant(fragment,
|
|
240
|
+
invariant(fragment, 70, fragmentName);
|
|
255
241
|
return fragment || null;
|
|
256
242
|
}
|
|
257
243
|
default:
|
|
@@ -329,7 +315,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
329
315
|
argObj[name.value] = null;
|
|
330
316
|
}
|
|
331
317
|
else {
|
|
332
|
-
throw newInvariantError(
|
|
318
|
+
throw newInvariantError(79, name.value, value.kind);
|
|
333
319
|
}
|
|
334
320
|
}
|
|
335
321
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -474,16 +460,16 @@ function isInlineFragment(selection) {
|
|
|
474
460
|
}
|
|
475
461
|
|
|
476
462
|
function checkDocument(doc) {
|
|
477
|
-
invariant(doc && doc.kind === 'Document',
|
|
463
|
+
invariant(doc && doc.kind === 'Document', 71);
|
|
478
464
|
var operations = doc.definitions
|
|
479
465
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
480
466
|
.map(function (definition) {
|
|
481
467
|
if (definition.kind !== 'OperationDefinition') {
|
|
482
|
-
throw newInvariantError(
|
|
468
|
+
throw newInvariantError(72, definition.kind);
|
|
483
469
|
}
|
|
484
470
|
return definition;
|
|
485
471
|
});
|
|
486
|
-
invariant(operations.length <= 1,
|
|
472
|
+
invariant(operations.length <= 1, 73, operations.length);
|
|
487
473
|
return doc;
|
|
488
474
|
}
|
|
489
475
|
function getOperationDefinition(doc) {
|
|
@@ -506,14 +492,14 @@ function getFragmentDefinitions(doc) {
|
|
|
506
492
|
}
|
|
507
493
|
function getQueryDefinition(doc) {
|
|
508
494
|
var queryDef = getOperationDefinition(doc);
|
|
509
|
-
invariant(queryDef && queryDef.operation === 'query',
|
|
495
|
+
invariant(queryDef && queryDef.operation === 'query', 74);
|
|
510
496
|
return queryDef;
|
|
511
497
|
}
|
|
512
498
|
function getFragmentDefinition(doc) {
|
|
513
|
-
invariant(doc.kind === 'Document',
|
|
514
|
-
invariant(doc.definitions.length <= 1,
|
|
499
|
+
invariant(doc.kind === 'Document', 75);
|
|
500
|
+
invariant(doc.definitions.length <= 1, 76);
|
|
515
501
|
var fragmentDef = doc.definitions[0];
|
|
516
|
-
invariant(fragmentDef.kind === 'FragmentDefinition',
|
|
502
|
+
invariant(fragmentDef.kind === 'FragmentDefinition', 77);
|
|
517
503
|
return fragmentDef;
|
|
518
504
|
}
|
|
519
505
|
function getMainDefinition(queryDoc) {
|
|
@@ -536,7 +522,7 @@ function getMainDefinition(queryDoc) {
|
|
|
536
522
|
if (fragmentDefinition) {
|
|
537
523
|
return fragmentDefinition;
|
|
538
524
|
}
|
|
539
|
-
throw newInvariantError(
|
|
525
|
+
throw newInvariantError(78);
|
|
540
526
|
}
|
|
541
527
|
function getDefaultValues(definition) {
|
|
542
528
|
var defaultValues = Object.create(null);
|
|
@@ -608,7 +594,7 @@ var DocumentTransform = (function () {
|
|
|
608
594
|
return;
|
|
609
595
|
var cacheKeys = this.getCacheKey(document);
|
|
610
596
|
if (cacheKeys) {
|
|
611
|
-
invariant(Array.isArray(cacheKeys),
|
|
597
|
+
invariant(Array.isArray(cacheKeys), 63);
|
|
612
598
|
return this.stableCacheKeys.lookupArray(cacheKeys);
|
|
613
599
|
}
|
|
614
600
|
};
|
|
@@ -701,7 +687,7 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
701
687
|
return getInUseByFragmentName(ancestor.name.value);
|
|
702
688
|
}
|
|
703
689
|
}
|
|
704
|
-
__DEV__ && invariant.error(
|
|
690
|
+
globalThis.__DEV__ !== false && invariant.error(80);
|
|
705
691
|
return null;
|
|
706
692
|
};
|
|
707
693
|
var operationCount = 0;
|
|
@@ -1054,7 +1040,7 @@ function deepFreeze(value) {
|
|
|
1054
1040
|
return value;
|
|
1055
1041
|
}
|
|
1056
1042
|
function shallowFreeze(obj) {
|
|
1057
|
-
if (__DEV__ && !Object.isFrozen(obj)) {
|
|
1043
|
+
if (globalThis.__DEV__ !== false && !Object.isFrozen(obj)) {
|
|
1058
1044
|
try {
|
|
1059
1045
|
Object.freeze(obj);
|
|
1060
1046
|
}
|
|
@@ -1067,7 +1053,7 @@ function shallowFreeze(obj) {
|
|
|
1067
1053
|
return obj;
|
|
1068
1054
|
}
|
|
1069
1055
|
function maybeDeepFreeze(obj) {
|
|
1070
|
-
if (__DEV__) {
|
|
1056
|
+
if (globalThis.__DEV__ !== false) {
|
|
1071
1057
|
deepFreeze(obj);
|
|
1072
1058
|
}
|
|
1073
1059
|
return obj;
|
|
@@ -1379,7 +1365,7 @@ function toPromise(observable) {
|
|
|
1379
1365
|
observable.subscribe({
|
|
1380
1366
|
next: function (data) {
|
|
1381
1367
|
if (completed) {
|
|
1382
|
-
__DEV__ && invariant.warn(40);
|
|
1368
|
+
globalThis.__DEV__ !== false && invariant.warn(40);
|
|
1383
1369
|
}
|
|
1384
1370
|
else {
|
|
1385
1371
|
completed = true;
|
|
@@ -1529,7 +1515,7 @@ var ApolloLink = (function () {
|
|
|
1529
1515
|
ApolloLink.concat = function (first, second) {
|
|
1530
1516
|
var firstLink = toLink(first);
|
|
1531
1517
|
if (isTerminating(firstLink)) {
|
|
1532
|
-
__DEV__ && invariant.warn(33, firstLink);
|
|
1518
|
+
globalThis.__DEV__ !== false && invariant.warn(33, firstLink);
|
|
1533
1519
|
return firstLink;
|
|
1534
1520
|
}
|
|
1535
1521
|
var nextLink = toLink(second);
|
|
@@ -1759,13 +1745,13 @@ var ApolloError = (function (_super) {
|
|
|
1759
1745
|
}(Error));
|
|
1760
1746
|
|
|
1761
1747
|
var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
1762
|
-
function readMultipartBody(response,
|
|
1763
|
-
var _a
|
|
1748
|
+
function readMultipartBody(response, nextValue) {
|
|
1749
|
+
var _a;
|
|
1764
1750
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
1765
|
-
var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running,
|
|
1766
|
-
var
|
|
1767
|
-
return tslib.__generator(this, function (
|
|
1768
|
-
switch (
|
|
1751
|
+
var decoder, contentType, delimiter, boundaryVal, boundary, buffer, iterator, running, _b, value, done, chunk, searchFrom, bi, message, i, headers, contentType_1, body, result, next;
|
|
1752
|
+
var _c, _d;
|
|
1753
|
+
return tslib.__generator(this, function (_e) {
|
|
1754
|
+
switch (_e.label) {
|
|
1769
1755
|
case 0:
|
|
1770
1756
|
if (TextDecoder === undefined) {
|
|
1771
1757
|
throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");
|
|
@@ -1780,12 +1766,12 @@ function readMultipartBody(response, observer) {
|
|
|
1780
1766
|
buffer = "";
|
|
1781
1767
|
iterator = responseIterator(response);
|
|
1782
1768
|
running = true;
|
|
1783
|
-
|
|
1769
|
+
_e.label = 1;
|
|
1784
1770
|
case 1:
|
|
1785
1771
|
if (!running) return [3, 3];
|
|
1786
1772
|
return [4, iterator.next()];
|
|
1787
1773
|
case 2:
|
|
1788
|
-
|
|
1774
|
+
_b = _e.sent(), value = _b.value, done = _b.done;
|
|
1789
1775
|
chunk = typeof value === "string" ? value : decoder.decode(value);
|
|
1790
1776
|
searchFrom = buffer.length - boundary.length + 1;
|
|
1791
1777
|
running = !done;
|
|
@@ -1793,10 +1779,10 @@ function readMultipartBody(response, observer) {
|
|
|
1793
1779
|
bi = buffer.indexOf(boundary, searchFrom);
|
|
1794
1780
|
while (bi > -1) {
|
|
1795
1781
|
message = void 0;
|
|
1796
|
-
|
|
1782
|
+
_c = [
|
|
1797
1783
|
buffer.slice(0, bi),
|
|
1798
1784
|
buffer.slice(bi + boundary.length),
|
|
1799
|
-
], message =
|
|
1785
|
+
], message = _c[0], buffer = _c[1];
|
|
1800
1786
|
i = message.indexOf("\r\n\r\n");
|
|
1801
1787
|
headers = parseHeaders(message.slice(0, i));
|
|
1802
1788
|
contentType_1 = headers["content-type"];
|
|
@@ -1806,43 +1792,36 @@ function readMultipartBody(response, observer) {
|
|
|
1806
1792
|
}
|
|
1807
1793
|
body = message.slice(i);
|
|
1808
1794
|
if (body) {
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
next = tslib.__assign({}, result.payload);
|
|
1820
|
-
}
|
|
1821
|
-
if ("errors" in result) {
|
|
1822
|
-
next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_h = {}, _h[PROTOCOL_ERRORS_SYMBOL] = result.errors, _h)) });
|
|
1823
|
-
}
|
|
1824
|
-
(_b = observer.next) === null || _b === void 0 ? void 0 : _b.call(observer, next);
|
|
1795
|
+
result = parseJsonBody(response, body);
|
|
1796
|
+
if (Object.keys(result).length > 1 ||
|
|
1797
|
+
"data" in result ||
|
|
1798
|
+
"incremental" in result ||
|
|
1799
|
+
"errors" in result ||
|
|
1800
|
+
"payload" in result) {
|
|
1801
|
+
if (isApolloPayloadResult(result)) {
|
|
1802
|
+
next = {};
|
|
1803
|
+
if ("payload" in result) {
|
|
1804
|
+
next = tslib.__assign({}, result.payload);
|
|
1825
1805
|
}
|
|
1826
|
-
|
|
1827
|
-
|
|
1806
|
+
if ("errors" in result) {
|
|
1807
|
+
next = tslib.__assign(tslib.__assign({}, next), { extensions: tslib.__assign(tslib.__assign({}, ("extensions" in next ? next.extensions : null)), (_d = {}, _d[PROTOCOL_ERRORS_SYMBOL] = result.errors, _d)) });
|
|
1828
1808
|
}
|
|
1809
|
+
nextValue(next);
|
|
1829
1810
|
}
|
|
1830
|
-
else
|
|
1831
|
-
|
|
1832
|
-
!result.hasNext) {
|
|
1833
|
-
(_d = observer.complete) === null || _d === void 0 ? void 0 : _d.call(observer);
|
|
1811
|
+
else {
|
|
1812
|
+
nextValue(result);
|
|
1834
1813
|
}
|
|
1835
1814
|
}
|
|
1836
|
-
|
|
1837
|
-
|
|
1815
|
+
else if (Object.keys(result).length === 1 &&
|
|
1816
|
+
"hasNext" in result &&
|
|
1817
|
+
!result.hasNext) {
|
|
1818
|
+
return [2];
|
|
1838
1819
|
}
|
|
1839
1820
|
}
|
|
1840
1821
|
bi = buffer.indexOf(boundary);
|
|
1841
1822
|
}
|
|
1842
1823
|
return [3, 1];
|
|
1843
|
-
case 3:
|
|
1844
|
-
(_e = observer.complete) === null || _e === void 0 ? void 0 : _e.call(observer);
|
|
1845
|
-
return [2];
|
|
1824
|
+
case 3: return [2];
|
|
1846
1825
|
}
|
|
1847
1826
|
});
|
|
1848
1827
|
});
|
|
@@ -1884,22 +1863,10 @@ function parseJsonBody(response, bodyText) {
|
|
|
1884
1863
|
}
|
|
1885
1864
|
}
|
|
1886
1865
|
function handleError(err, observer) {
|
|
1887
|
-
var _a, _b;
|
|
1888
|
-
if (err.name === "AbortError")
|
|
1889
|
-
return;
|
|
1890
1866
|
if (err.result && err.result.errors && err.result.data) {
|
|
1891
|
-
|
|
1867
|
+
observer.next(err.result);
|
|
1892
1868
|
}
|
|
1893
|
-
|
|
1894
|
-
}
|
|
1895
|
-
function readJsonBody(response, operation, observer) {
|
|
1896
|
-
parseAndCheckHttpResponse(operation)(response)
|
|
1897
|
-
.then(function (result) {
|
|
1898
|
-
var _a, _b;
|
|
1899
|
-
(_a = observer.next) === null || _a === void 0 ? void 0 : _a.call(observer, result);
|
|
1900
|
-
(_b = observer.complete) === null || _b === void 0 ? void 0 : _b.call(observer);
|
|
1901
|
-
})
|
|
1902
|
-
.catch(function (err) { return handleError(err, observer); });
|
|
1869
|
+
observer.error(err);
|
|
1903
1870
|
}
|
|
1904
1871
|
function parseAndCheckHttpResponse(operations) {
|
|
1905
1872
|
return function (response) {
|
|
@@ -2083,7 +2050,7 @@ var backupFetch = maybe(function () { return fetch; });
|
|
|
2083
2050
|
var createHttpLink = function (linkOptions) {
|
|
2084
2051
|
if (linkOptions === void 0) { linkOptions = {}; }
|
|
2085
2052
|
var _a = linkOptions.uri, uri = _a === void 0 ? '/graphql' : _a, preferredFetch = linkOptions.fetch, _b = linkOptions.print, print = _b === void 0 ? defaultPrinter : _b, includeExtensions = linkOptions.includeExtensions, preserveHeaderCase = linkOptions.preserveHeaderCase, useGETForQueries = linkOptions.useGETForQueries, _c = linkOptions.includeUnusedVariables, includeUnusedVariables = _c === void 0 ? false : _c, requestOptions = tslib.__rest(linkOptions, ["uri", "fetch", "print", "includeExtensions", "preserveHeaderCase", "useGETForQueries", "includeUnusedVariables"]);
|
|
2086
|
-
if (__DEV__) {
|
|
2053
|
+
if (globalThis.__DEV__ !== false) {
|
|
2087
2054
|
checkFetcher(preferredFetch || backupFetch);
|
|
2088
2055
|
}
|
|
2089
2056
|
var linkConfig = {
|
|
@@ -2124,11 +2091,9 @@ var createHttpLink = function (linkOptions) {
|
|
|
2124
2091
|
body.variables = filterOperationVariables(body.variables, operation.query);
|
|
2125
2092
|
}
|
|
2126
2093
|
var controller;
|
|
2127
|
-
if (!options.signal) {
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
if (controller)
|
|
2131
|
-
options.signal = signal;
|
|
2094
|
+
if (!options.signal && typeof AbortController !== 'undefined') {
|
|
2095
|
+
controller = new AbortController();
|
|
2096
|
+
options.signal = controller.signal;
|
|
2132
2097
|
}
|
|
2133
2098
|
var definitionIsMutation = function (d) {
|
|
2134
2099
|
return d.kind === 'OperationDefinition' && d.operation === 'mutation';
|
|
@@ -2146,7 +2111,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2146
2111
|
options.headers = options.headers || {};
|
|
2147
2112
|
var acceptHeader = "multipart/mixed;";
|
|
2148
2113
|
if (isSubscription && hasDefer) {
|
|
2149
|
-
__DEV__ && invariant.warn(36);
|
|
2114
|
+
globalThis.__DEV__ !== false && invariant.warn(36);
|
|
2150
2115
|
}
|
|
2151
2116
|
if (isSubscription) {
|
|
2152
2117
|
acceptHeader += 'boundary=graphql;subscriptionSpec=1.0,application/json';
|
|
@@ -2157,7 +2122,7 @@ var createHttpLink = function (linkOptions) {
|
|
|
2157
2122
|
options.headers.accept = acceptHeader;
|
|
2158
2123
|
}
|
|
2159
2124
|
if (options.method === 'GET') {
|
|
2160
|
-
var
|
|
2125
|
+
var _c = rewriteURIForGET(chosenURI, body), newURI = _c.newURI, parseError = _c.parseError;
|
|
2161
2126
|
if (parseError) {
|
|
2162
2127
|
return fromError(parseError);
|
|
2163
2128
|
}
|
|
@@ -2173,19 +2138,27 @@ var createHttpLink = function (linkOptions) {
|
|
|
2173
2138
|
}
|
|
2174
2139
|
return new zenObservableTs.Observable(function (observer) {
|
|
2175
2140
|
var currentFetch = preferredFetch || maybe(function () { return fetch; }) || backupFetch;
|
|
2141
|
+
var observerNext = observer.next.bind(observer);
|
|
2176
2142
|
currentFetch(chosenURI, options)
|
|
2177
2143
|
.then(function (response) {
|
|
2178
2144
|
var _a;
|
|
2179
2145
|
operation.setContext({ response: response });
|
|
2180
2146
|
var ctype = (_a = response.headers) === null || _a === void 0 ? void 0 : _a.get('content-type');
|
|
2181
2147
|
if (ctype !== null && /^multipart\/mixed/i.test(ctype)) {
|
|
2182
|
-
return readMultipartBody(response,
|
|
2148
|
+
return readMultipartBody(response, observerNext);
|
|
2183
2149
|
}
|
|
2184
2150
|
else {
|
|
2185
|
-
return
|
|
2151
|
+
return parseAndCheckHttpResponse(operation)(response).then(observerNext);
|
|
2186
2152
|
}
|
|
2187
2153
|
})
|
|
2188
|
-
.
|
|
2154
|
+
.then(function () {
|
|
2155
|
+
controller = undefined;
|
|
2156
|
+
observer.complete();
|
|
2157
|
+
})
|
|
2158
|
+
.catch(function (err) {
|
|
2159
|
+
controller = undefined;
|
|
2160
|
+
handleError(err, observer);
|
|
2161
|
+
});
|
|
2189
2162
|
return function () {
|
|
2190
2163
|
if (controller)
|
|
2191
2164
|
controller.abort();
|
|
@@ -2898,7 +2871,7 @@ var ObjectCanon = (function () {
|
|
|
2898
2871
|
var node = this.pool.lookupArray(array);
|
|
2899
2872
|
if (!node.array) {
|
|
2900
2873
|
this.known.add(node.array = array);
|
|
2901
|
-
if (__DEV__) {
|
|
2874
|
+
if (globalThis.__DEV__ !== false) {
|
|
2902
2875
|
Object.freeze(array);
|
|
2903
2876
|
}
|
|
2904
2877
|
}
|
|
@@ -2923,7 +2896,7 @@ var ObjectCanon = (function () {
|
|
|
2923
2896
|
keys.sorted.forEach(function (key, i) {
|
|
2924
2897
|
obj_1[key] = array_1[firstValueIndex_1 + i];
|
|
2925
2898
|
});
|
|
2926
|
-
if (__DEV__) {
|
|
2899
|
+
if (globalThis.__DEV__ !== false) {
|
|
2927
2900
|
Object.freeze(obj_1);
|
|
2928
2901
|
}
|
|
2929
2902
|
}
|
|
@@ -3190,7 +3163,7 @@ var StoreReader = (function () {
|
|
|
3190
3163
|
context: context,
|
|
3191
3164
|
}), i);
|
|
3192
3165
|
}
|
|
3193
|
-
if (__DEV__) {
|
|
3166
|
+
if (globalThis.__DEV__ !== false) {
|
|
3194
3167
|
assertSelectionSetForIdValue(context.store, field, item);
|
|
3195
3168
|
}
|
|
3196
3169
|
return item;
|
|
@@ -3635,7 +3608,7 @@ var Policies = (function () {
|
|
|
3635
3608
|
if (supertypeSet.has(supertype)) {
|
|
3636
3609
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
3637
3610
|
if (checkingFuzzySubtypes) {
|
|
3638
|
-
__DEV__ && invariant.warn(4, typename, supertype);
|
|
3611
|
+
globalThis.__DEV__ !== false && invariant.warn(4, typename, supertype);
|
|
3639
3612
|
}
|
|
3640
3613
|
typenameSupertypeSet.add(supertype);
|
|
3641
3614
|
}
|
|
@@ -3788,8 +3761,8 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
3788
3761
|
options.from = objectOrReference;
|
|
3789
3762
|
}
|
|
3790
3763
|
}
|
|
3791
|
-
if (__DEV__ && options.from === void 0) {
|
|
3792
|
-
__DEV__ && invariant.warn(5, stringifyForDisplay(Array.from(readFieldArgs)));
|
|
3764
|
+
if (globalThis.__DEV__ !== false && options.from === void 0) {
|
|
3765
|
+
globalThis.__DEV__ !== false && invariant.warn(5, stringifyForDisplay(Array.from(readFieldArgs)));
|
|
3793
3766
|
}
|
|
3794
3767
|
if (void 0 === options.variables) {
|
|
3795
3768
|
options.variables = variables;
|
|
@@ -3872,7 +3845,7 @@ var StoreWriter = (function () {
|
|
|
3872
3845
|
}
|
|
3873
3846
|
storeObject = applied;
|
|
3874
3847
|
}
|
|
3875
|
-
if (__DEV__ && !context.overwrite) {
|
|
3848
|
+
if (globalThis.__DEV__ !== false && !context.overwrite) {
|
|
3876
3849
|
var fieldsWithSelectionSets_1 = Object.create(null);
|
|
3877
3850
|
fieldNodeSet.forEach(function (field) {
|
|
3878
3851
|
if (field.selectionSet) {
|
|
@@ -3960,12 +3933,12 @@ var StoreWriter = (function () {
|
|
|
3960
3933
|
_a[storeFieldName] = incomingValue,
|
|
3961
3934
|
_a));
|
|
3962
3935
|
}
|
|
3963
|
-
else if (__DEV__ &&
|
|
3936
|
+
else if (globalThis.__DEV__ !== false &&
|
|
3964
3937
|
!context.clientOnly &&
|
|
3965
3938
|
!context.deferred &&
|
|
3966
3939
|
!addTypenameToDocument.added(field) &&
|
|
3967
3940
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
3968
|
-
__DEV__ && invariant.error(10, resultKeyNameFromField(field), result);
|
|
3941
|
+
globalThis.__DEV__ !== false && invariant.error(10, resultKeyNameFromField(field), result);
|
|
3969
3942
|
}
|
|
3970
3943
|
});
|
|
3971
3944
|
try {
|
|
@@ -4014,7 +3987,7 @@ var StoreWriter = (function () {
|
|
|
4014
3987
|
StoreWriter.prototype.processFieldValue = function (value, field, context, mergeTree) {
|
|
4015
3988
|
var _this = this;
|
|
4016
3989
|
if (!field.selectionSet || value === null) {
|
|
4017
|
-
return __DEV__ ? cloneDeep(value) : value;
|
|
3990
|
+
return globalThis.__DEV__ !== false ? cloneDeep(value) : value;
|
|
4018
3991
|
}
|
|
4019
3992
|
if (isArray(value)) {
|
|
4020
3993
|
return value.map(function (item, i) {
|
|
@@ -4205,7 +4178,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
4205
4178
|
}
|
|
4206
4179
|
});
|
|
4207
4180
|
}
|
|
4208
|
-
__DEV__ && invariant.warn(12, fieldName, parentType, childTypenames.length
|
|
4181
|
+
globalThis.__DEV__ !== false && invariant.warn(12, fieldName, parentType, childTypenames.length
|
|
4209
4182
|
? "either ensure all objects of type " + childTypenames.join(" and ") + " have an ID or a custom merge function, or "
|
|
4210
4183
|
: "", typeDotName, existing, incoming);
|
|
4211
4184
|
}
|
|
@@ -4365,7 +4338,7 @@ var InMemoryCache = (function (_super) {
|
|
|
4365
4338
|
return this.policies.identify(object)[0];
|
|
4366
4339
|
}
|
|
4367
4340
|
catch (e) {
|
|
4368
|
-
__DEV__ && invariant.warn(e);
|
|
4341
|
+
globalThis.__DEV__ !== false && invariant.warn(e);
|
|
4369
4342
|
}
|
|
4370
4343
|
};
|
|
4371
4344
|
InMemoryCache.prototype.evict = function (options) {
|
|
@@ -4528,10 +4501,11 @@ function isNetworkRequestSettled(networkStatus) {
|
|
|
4528
4501
|
function equalByQuery(query, _a, _b, variables) {
|
|
4529
4502
|
var aData = _a.data, aRest = tslib.__rest(_a, ["data"]);
|
|
4530
4503
|
var bData = _b.data, bRest = tslib.__rest(_b, ["data"]);
|
|
4531
|
-
return equal__default(aRest, bRest) &&
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4504
|
+
return (equal__default(aRest, bRest) &&
|
|
4505
|
+
equalBySelectionSet(getMainDefinition(query).selectionSet, aData, bData, {
|
|
4506
|
+
fragmentMap: createFragmentMap(getFragmentDefinitions(query)),
|
|
4507
|
+
variables: variables,
|
|
4508
|
+
}));
|
|
4535
4509
|
}
|
|
4536
4510
|
function equalBySelectionSet(selectionSet, aResult, bResult, context) {
|
|
4537
4511
|
if (aResult === bResult) {
|
|
@@ -4583,10 +4557,10 @@ function equalBySelectionSet(selectionSet, aResult, bResult, context) {
|
|
|
4583
4557
|
});
|
|
4584
4558
|
}
|
|
4585
4559
|
function selectionHasNonreactiveDirective(selection) {
|
|
4586
|
-
return !!selection.directives && selection.directives.some(directiveIsNonreactive);
|
|
4560
|
+
return (!!selection.directives && selection.directives.some(directiveIsNonreactive));
|
|
4587
4561
|
}
|
|
4588
4562
|
function directiveIsNonreactive(dir) {
|
|
4589
|
-
return dir.name.value ===
|
|
4563
|
+
return dir.name.value === 'nonreactive';
|
|
4590
4564
|
}
|
|
4591
4565
|
|
|
4592
4566
|
var assign = Object.assign, hasOwnProperty$2 = Object.hasOwnProperty;
|
|
@@ -4701,7 +4675,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4701
4675
|
else {
|
|
4702
4676
|
result.partial = true;
|
|
4703
4677
|
}
|
|
4704
|
-
if (__DEV__ &&
|
|
4678
|
+
if (globalThis.__DEV__ !== false &&
|
|
4705
4679
|
!diff.complete &&
|
|
4706
4680
|
!this.options.partialRefetch &&
|
|
4707
4681
|
!result.loading &&
|
|
@@ -4761,11 +4735,11 @@ var ObservableQuery = (function (_super) {
|
|
|
4761
4735
|
else {
|
|
4762
4736
|
reobserveOptions.fetchPolicy = 'network-only';
|
|
4763
4737
|
}
|
|
4764
|
-
if (__DEV__ && variables && hasOwnProperty$2.call(variables, "variables")) {
|
|
4738
|
+
if (globalThis.__DEV__ !== false && variables && hasOwnProperty$2.call(variables, "variables")) {
|
|
4765
4739
|
var queryDef = getQueryDefinition(this.query);
|
|
4766
4740
|
var vars = queryDef.variableDefinitions;
|
|
4767
4741
|
if (!vars || !vars.some(function (v) { return v.variable.name.value === "variables"; })) {
|
|
4768
|
-
__DEV__ && invariant.warn(
|
|
4742
|
+
globalThis.__DEV__ !== false && invariant.warn(
|
|
4769
4743
|
18,
|
|
4770
4744
|
variables,
|
|
4771
4745
|
((_a = queryDef.name) === null || _a === void 0 ? void 0 : _a.value) || queryDef
|
|
@@ -4857,7 +4831,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4857
4831
|
options.onError(err);
|
|
4858
4832
|
return;
|
|
4859
4833
|
}
|
|
4860
|
-
__DEV__ && invariant.error(19, err);
|
|
4834
|
+
globalThis.__DEV__ !== false && invariant.error(19, err);
|
|
4861
4835
|
},
|
|
4862
4836
|
});
|
|
4863
4837
|
this.subscriptions.add(subscription);
|
|
@@ -5112,11 +5086,11 @@ function reobserveCacheFirst(obsQuery) {
|
|
|
5112
5086
|
return obsQuery.reobserve();
|
|
5113
5087
|
}
|
|
5114
5088
|
function defaultSubscriptionObserverErrorCallback(error) {
|
|
5115
|
-
__DEV__ && invariant.error(21, error.message, error.stack);
|
|
5089
|
+
globalThis.__DEV__ !== false && invariant.error(21, error.message, error.stack);
|
|
5116
5090
|
}
|
|
5117
5091
|
function logMissingFieldErrors(missing) {
|
|
5118
|
-
if (__DEV__ && missing) {
|
|
5119
|
-
__DEV__ && invariant.debug(22, missing);
|
|
5092
|
+
if (globalThis.__DEV__ !== false && missing) {
|
|
5093
|
+
globalThis.__DEV__ !== false && invariant.debug(22, missing);
|
|
5120
5094
|
}
|
|
5121
5095
|
}
|
|
5122
5096
|
function skipCacheDataFor(fetchPolicy) {
|
|
@@ -6000,7 +5974,7 @@ var QueryManager = (function () {
|
|
|
6000
5974
|
_this.markMutationResult(tslib.__assign(tslib.__assign({}, mutation), { result: { data: data } }), cache);
|
|
6001
5975
|
}
|
|
6002
5976
|
catch (error) {
|
|
6003
|
-
__DEV__ && invariant.error(error);
|
|
5977
|
+
globalThis.__DEV__ !== false && invariant.error(error);
|
|
6004
5978
|
}
|
|
6005
5979
|
}, mutation.mutationId);
|
|
6006
5980
|
};
|
|
@@ -6183,10 +6157,10 @@ var QueryManager = (function () {
|
|
|
6183
6157
|
queries.set(queryId, oq);
|
|
6184
6158
|
});
|
|
6185
6159
|
}
|
|
6186
|
-
if (__DEV__ && queryNamesAndDocs.size) {
|
|
6160
|
+
if (globalThis.__DEV__ !== false && queryNamesAndDocs.size) {
|
|
6187
6161
|
queryNamesAndDocs.forEach(function (included, nameOrDoc) {
|
|
6188
6162
|
if (!included) {
|
|
6189
|
-
__DEV__ && invariant.warn(typeof nameOrDoc === "string" ? 31 : 32, nameOrDoc);
|
|
6163
|
+
globalThis.__DEV__ !== false && invariant.warn(typeof nameOrDoc === "string" ? 31 : 32, nameOrDoc);
|
|
6190
6164
|
}
|
|
6191
6165
|
});
|
|
6192
6166
|
}
|
|
@@ -6502,7 +6476,7 @@ var QueryManager = (function () {
|
|
|
6502
6476
|
var resultsFromCache = function (diff, networkStatus) {
|
|
6503
6477
|
if (networkStatus === void 0) { networkStatus = queryInfo.networkStatus || exports.NetworkStatus.loading; }
|
|
6504
6478
|
var data = diff.result;
|
|
6505
|
-
if (__DEV__ &&
|
|
6479
|
+
if (globalThis.__DEV__ !== false &&
|
|
6506
6480
|
!returnPartialData &&
|
|
6507
6481
|
!equal.equal(data, {})) {
|
|
6508
6482
|
logMissingFieldErrors(diff.missing);
|
|
@@ -6605,7 +6579,7 @@ var ApolloClient = (function () {
|
|
|
6605
6579
|
}
|
|
6606
6580
|
var uri = options.uri, credentials = options.credentials, headers = options.headers, cache = options.cache, documentTransform = options.documentTransform, _a = options.ssrMode, ssrMode = _a === void 0 ? false : _a, _b = options.ssrForceFetchDelay, ssrForceFetchDelay = _b === void 0 ? 0 : _b, _c = options.connectToDevTools, connectToDevTools = _c === void 0 ? typeof window === 'object' &&
|
|
6607
6581
|
!window.__APOLLO_CLIENT__ &&
|
|
6608
|
-
__DEV__ : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? cache.assumeImmutableResults : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version;
|
|
6582
|
+
globalThis.__DEV__ !== false : _c, _d = options.queryDeduplication, queryDeduplication = _d === void 0 ? true : _d, defaultOptions = options.defaultOptions, _e = options.assumeImmutableResults, assumeImmutableResults = _e === void 0 ? cache.assumeImmutableResults : _e, resolvers = options.resolvers, typeDefs = options.typeDefs, fragmentMatcher = options.fragmentMatcher, clientAwarenessName = options.name, clientAwarenessVersion = options.version;
|
|
6609
6583
|
var link = options.link;
|
|
6610
6584
|
if (!link) {
|
|
6611
6585
|
link = uri
|
|
@@ -6629,7 +6603,7 @@ var ApolloClient = (function () {
|
|
|
6629
6603
|
if (connectToDevTools && typeof window === 'object') {
|
|
6630
6604
|
window.__APOLLO_CLIENT__ = this;
|
|
6631
6605
|
}
|
|
6632
|
-
if (!hasSuggestedDevtools && connectToDevTools && __DEV__) {
|
|
6606
|
+
if (!hasSuggestedDevtools && connectToDevTools && globalThis.__DEV__ !== false) {
|
|
6633
6607
|
hasSuggestedDevtools = true;
|
|
6634
6608
|
if (typeof window !== 'undefined' &&
|
|
6635
6609
|
window.document &&
|
|
@@ -6648,7 +6622,7 @@ var ApolloClient = (function () {
|
|
|
6648
6622
|
}
|
|
6649
6623
|
}
|
|
6650
6624
|
if (url) {
|
|
6651
|
-
__DEV__ && invariant.log("Download the Apollo DevTools for a better development " +
|
|
6625
|
+
globalThis.__DEV__ !== false && invariant.log("Download the Apollo DevTools for a better development " +
|
|
6652
6626
|
"experience: %s", url);
|
|
6653
6627
|
}
|
|
6654
6628
|
}
|
|
@@ -6801,7 +6775,7 @@ var ApolloClient = (function () {
|
|
|
6801
6775
|
result.queries = queries;
|
|
6802
6776
|
result.results = results;
|
|
6803
6777
|
result.catch(function (error) {
|
|
6804
|
-
__DEV__ && invariant.debug(15, error);
|
|
6778
|
+
globalThis.__DEV__ !== false && invariant.debug(15, error);
|
|
6805
6779
|
});
|
|
6806
6780
|
return result;
|
|
6807
6781
|
};
|
|
@@ -6838,8 +6812,15 @@ var contextKey = canUseSymbol
|
|
|
6838
6812
|
: '__APOLLO_CONTEXT__';
|
|
6839
6813
|
function getApolloContext() {
|
|
6840
6814
|
invariant('createContext' in React__namespace, 43);
|
|
6841
|
-
var contextStorage = global$1[contextKey] || (global$1[contextKey] =
|
|
6842
|
-
|
|
6815
|
+
var contextStorage = global$1[contextKey] || (global$1[contextKey] = new Map());
|
|
6816
|
+
var value = contextStorage.get(React__namespace.createContext);
|
|
6817
|
+
if (!value) {
|
|
6818
|
+
value = Object.assign(React__namespace.createContext({}), {
|
|
6819
|
+
displayName: 'ApolloContext',
|
|
6820
|
+
});
|
|
6821
|
+
contextStorage.set(React__namespace.createContext, value);
|
|
6822
|
+
}
|
|
6823
|
+
return value;
|
|
6843
6824
|
}
|
|
6844
6825
|
var resetApolloContext = getApolloContext;
|
|
6845
6826
|
|
|
@@ -6852,18 +6833,18 @@ var ApolloConsumer = function (props) {
|
|
|
6852
6833
|
};
|
|
6853
6834
|
|
|
6854
6835
|
var ApolloProvider = function (_a) {
|
|
6855
|
-
var client = _a.client,
|
|
6836
|
+
var client = _a.client, children = _a.children;
|
|
6856
6837
|
var ApolloContext = getApolloContext();
|
|
6857
6838
|
var parentContext = React__namespace.useContext(ApolloContext);
|
|
6858
6839
|
var context = React__namespace.useMemo(function () {
|
|
6859
|
-
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client
|
|
6860
|
-
}, [parentContext, client
|
|
6840
|
+
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client });
|
|
6841
|
+
}, [parentContext, client]);
|
|
6861
6842
|
invariant(context.client, 44);
|
|
6862
6843
|
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
6863
6844
|
};
|
|
6864
6845
|
|
|
6865
6846
|
function useApolloClient(override) {
|
|
6866
|
-
var context =
|
|
6847
|
+
var context = React__namespace.useContext(getApolloContext());
|
|
6867
6848
|
var client = override || context.client;
|
|
6868
6849
|
invariant(!!client, 47);
|
|
6869
6850
|
return client;
|
|
@@ -6874,11 +6855,11 @@ var uSESKey = "useSyncExternalStore";
|
|
|
6874
6855
|
var realHook$1 = React__namespace[uSESKey];
|
|
6875
6856
|
var useSyncExternalStore = realHook$1 || (function (subscribe, getSnapshot, getServerSnapshot) {
|
|
6876
6857
|
var value = getSnapshot();
|
|
6877
|
-
if (__DEV__ &&
|
|
6858
|
+
if (globalThis.__DEV__ !== false &&
|
|
6878
6859
|
!didWarnUncachedGetSnapshot &&
|
|
6879
6860
|
value !== getSnapshot()) {
|
|
6880
6861
|
didWarnUncachedGetSnapshot = true;
|
|
6881
|
-
__DEV__ && invariant.error(
|
|
6862
|
+
globalThis.__DEV__ !== false && invariant.error(56);
|
|
6882
6863
|
}
|
|
6883
6864
|
var _a = React__namespace.useState({ inst: { value: value, getSnapshot: getSnapshot } }), inst = _a[0].inst, forceUpdate = _a[1];
|
|
6884
6865
|
if (canUseLayoutEffect) {
|
|
@@ -6941,7 +6922,7 @@ function parser(document) {
|
|
|
6941
6922
|
if (cached)
|
|
6942
6923
|
return cached;
|
|
6943
6924
|
var variables, type, name;
|
|
6944
|
-
invariant(!!document && !!document.kind,
|
|
6925
|
+
invariant(!!document && !!document.kind, 57, document);
|
|
6945
6926
|
var fragments = [];
|
|
6946
6927
|
var queries = [];
|
|
6947
6928
|
var mutations = [];
|
|
@@ -6967,10 +6948,10 @@ function parser(document) {
|
|
|
6967
6948
|
}
|
|
6968
6949
|
}
|
|
6969
6950
|
invariant(!fragments.length ||
|
|
6970
|
-
(queries.length || mutations.length || subscriptions.length),
|
|
6951
|
+
(queries.length || mutations.length || subscriptions.length), 58);
|
|
6971
6952
|
invariant(
|
|
6972
6953
|
queries.length + mutations.length + subscriptions.length <= 1,
|
|
6973
|
-
|
|
6954
|
+
59,
|
|
6974
6955
|
document,
|
|
6975
6956
|
queries.length,
|
|
6976
6957
|
subscriptions.length,
|
|
@@ -6984,7 +6965,7 @@ function parser(document) {
|
|
|
6984
6965
|
: mutations.length
|
|
6985
6966
|
? mutations
|
|
6986
6967
|
: subscriptions;
|
|
6987
|
-
invariant(definitions.length === 1,
|
|
6968
|
+
invariant(definitions.length === 1, 60, document, definitions.length);
|
|
6988
6969
|
var definition = definitions[0];
|
|
6989
6970
|
variables = definition.variableDefinitions || [];
|
|
6990
6971
|
if (definition.name && definition.name.kind === 'Name') {
|
|
@@ -7003,7 +6984,7 @@ function verifyDocumentType(document, type) {
|
|
|
7003
6984
|
var usedOperationName = operationName(operation.type);
|
|
7004
6985
|
invariant(
|
|
7005
6986
|
operation.type === type,
|
|
7006
|
-
|
|
6987
|
+
61,
|
|
7007
6988
|
requiredOperationName,
|
|
7008
6989
|
requiredOperationName,
|
|
7009
6990
|
usedOperationName
|
|
@@ -7016,14 +6997,14 @@ function useQuery(query, options) {
|
|
|
7016
6997
|
return useInternalState(useApolloClient(options.client), query).useQuery(options);
|
|
7017
6998
|
}
|
|
7018
6999
|
function useInternalState(client, query) {
|
|
7019
|
-
var stateRef =
|
|
7000
|
+
var stateRef = React__namespace.useRef();
|
|
7020
7001
|
if (!stateRef.current ||
|
|
7021
7002
|
client !== stateRef.current.client ||
|
|
7022
7003
|
query !== stateRef.current.query) {
|
|
7023
7004
|
stateRef.current = new InternalState(client, query, stateRef.current);
|
|
7024
7005
|
}
|
|
7025
7006
|
var state = stateRef.current;
|
|
7026
|
-
var _a =
|
|
7007
|
+
var _a = React__namespace.useState(0); _a[0]; var setTick = _a[1];
|
|
7027
7008
|
state.forceUpdate = function () {
|
|
7028
7009
|
setTick(function (tick) { return tick + 1; });
|
|
7029
7010
|
};
|
|
@@ -7054,7 +7035,7 @@ var InternalState = (function () {
|
|
|
7054
7035
|
}
|
|
7055
7036
|
}
|
|
7056
7037
|
InternalState.prototype.forceUpdate = function () {
|
|
7057
|
-
__DEV__ && invariant.warn(48);
|
|
7038
|
+
globalThis.__DEV__ !== false && invariant.warn(48);
|
|
7058
7039
|
};
|
|
7059
7040
|
InternalState.prototype.executeQuery = function (options) {
|
|
7060
7041
|
var _this = this;
|
|
@@ -7084,10 +7065,10 @@ var InternalState = (function () {
|
|
|
7084
7065
|
};
|
|
7085
7066
|
InternalState.prototype.useQuery = function (options) {
|
|
7086
7067
|
var _this = this;
|
|
7087
|
-
this.renderPromises =
|
|
7068
|
+
this.renderPromises = React__namespace.useContext(getApolloContext()).renderPromises;
|
|
7088
7069
|
this.useOptions(options);
|
|
7089
7070
|
var obsQuery = this.useObservableQuery();
|
|
7090
|
-
var result = useSyncExternalStore(
|
|
7071
|
+
var result = useSyncExternalStore(React__namespace.useCallback(function () {
|
|
7091
7072
|
if (_this.renderPromises) {
|
|
7092
7073
|
return function () { };
|
|
7093
7074
|
}
|
|
@@ -7217,7 +7198,7 @@ var InternalState = (function () {
|
|
|
7217
7198
|
&& this.renderPromises.getSSRObservable(this.watchQueryOptions)
|
|
7218
7199
|
|| this.observable
|
|
7219
7200
|
|| this.client.watchQuery(this.getObsQueryOptions());
|
|
7220
|
-
this.obsQueryFields =
|
|
7201
|
+
this.obsQueryFields = React__namespace.useMemo(function () { return ({
|
|
7221
7202
|
refetch: obsQuery.refetch.bind(obsQuery),
|
|
7222
7203
|
reobserve: obsQuery.reobserve.bind(obsQuery),
|
|
7223
7204
|
fetchMore: obsQuery.fetchMore.bind(obsQuery),
|
|
@@ -7259,7 +7240,7 @@ var InternalState = (function () {
|
|
|
7259
7240
|
_this.onCompleted(result.data);
|
|
7260
7241
|
}
|
|
7261
7242
|
}).catch(function (error) {
|
|
7262
|
-
__DEV__ && invariant.warn(error);
|
|
7243
|
+
globalThis.__DEV__ !== false && invariant.warn(error);
|
|
7263
7244
|
});
|
|
7264
7245
|
}
|
|
7265
7246
|
};
|
|
@@ -7311,9 +7292,9 @@ var EAGER_METHODS = [
|
|
|
7311
7292
|
];
|
|
7312
7293
|
function useLazyQuery(query, options) {
|
|
7313
7294
|
var _a;
|
|
7314
|
-
var execOptionsRef =
|
|
7315
|
-
var optionsRef =
|
|
7316
|
-
var queryRef =
|
|
7295
|
+
var execOptionsRef = React__namespace.useRef();
|
|
7296
|
+
var optionsRef = React__namespace.useRef();
|
|
7297
|
+
var queryRef = React__namespace.useRef();
|
|
7317
7298
|
var merged = mergeOptions(options, execOptionsRef.current || {});
|
|
7318
7299
|
var document = (_a = merged === null || merged === void 0 ? void 0 : merged.query) !== null && _a !== void 0 ? _a : query;
|
|
7319
7300
|
optionsRef.current = merged;
|
|
@@ -7325,7 +7306,7 @@ function useLazyQuery(query, options) {
|
|
|
7325
7306
|
var result = Object.assign(useQueryResult, {
|
|
7326
7307
|
called: !!execOptionsRef.current,
|
|
7327
7308
|
});
|
|
7328
|
-
var eagerMethods =
|
|
7309
|
+
var eagerMethods = React__namespace.useMemo(function () {
|
|
7329
7310
|
var eagerMethods = {};
|
|
7330
7311
|
var _loop_1 = function (key) {
|
|
7331
7312
|
var method = result[key];
|
|
@@ -7344,7 +7325,7 @@ function useLazyQuery(query, options) {
|
|
|
7344
7325
|
return eagerMethods;
|
|
7345
7326
|
}, []);
|
|
7346
7327
|
Object.assign(result, eagerMethods);
|
|
7347
|
-
var execute =
|
|
7328
|
+
var execute = React__namespace.useCallback(function (executeOptions) {
|
|
7348
7329
|
execOptionsRef.current = executeOptions ? tslib.__assign(tslib.__assign({}, executeOptions), { fetchPolicy: executeOptions.fetchPolicy || initialFetchPolicy }) : {
|
|
7349
7330
|
fetchPolicy: initialFetchPolicy,
|
|
7350
7331
|
};
|
|
@@ -7361,12 +7342,12 @@ function useLazyQuery(query, options) {
|
|
|
7361
7342
|
function useMutation(mutation, options) {
|
|
7362
7343
|
var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);
|
|
7363
7344
|
verifyDocumentType(mutation, exports.DocumentType.Mutation);
|
|
7364
|
-
var _a =
|
|
7345
|
+
var _a = React__namespace.useState({
|
|
7365
7346
|
called: false,
|
|
7366
7347
|
loading: false,
|
|
7367
7348
|
client: client,
|
|
7368
7349
|
}), result = _a[0], setResult = _a[1];
|
|
7369
|
-
var ref =
|
|
7350
|
+
var ref = React__namespace.useRef({
|
|
7370
7351
|
result: result,
|
|
7371
7352
|
mutationId: 0,
|
|
7372
7353
|
isMounted: true,
|
|
@@ -7377,7 +7358,7 @@ function useMutation(mutation, options) {
|
|
|
7377
7358
|
{
|
|
7378
7359
|
Object.assign(ref.current, { client: client, options: options, mutation: mutation });
|
|
7379
7360
|
}
|
|
7380
|
-
var execute =
|
|
7361
|
+
var execute = React__namespace.useCallback(function (executeOptions) {
|
|
7381
7362
|
if (executeOptions === void 0) { executeOptions = {}; }
|
|
7382
7363
|
var _a = ref.current, options = _a.options, mutation = _a.mutation;
|
|
7383
7364
|
var baseOptions = tslib.__assign(tslib.__assign({}, options), { mutation: mutation });
|
|
@@ -7438,12 +7419,12 @@ function useMutation(mutation, options) {
|
|
|
7438
7419
|
throw error;
|
|
7439
7420
|
});
|
|
7440
7421
|
}, []);
|
|
7441
|
-
var reset =
|
|
7422
|
+
var reset = React__namespace.useCallback(function () {
|
|
7442
7423
|
if (ref.current.isMounted) {
|
|
7443
7424
|
setResult({ called: false, loading: false, client: client });
|
|
7444
7425
|
}
|
|
7445
7426
|
}, []);
|
|
7446
|
-
|
|
7427
|
+
React__namespace.useEffect(function () {
|
|
7447
7428
|
ref.current.isMounted = true;
|
|
7448
7429
|
return function () {
|
|
7449
7430
|
ref.current.isMounted = false;
|
|
@@ -7453,10 +7434,10 @@ function useMutation(mutation, options) {
|
|
|
7453
7434
|
}
|
|
7454
7435
|
|
|
7455
7436
|
function useSubscription(subscription, options) {
|
|
7456
|
-
var hasIssuedDeprecationWarningRef =
|
|
7437
|
+
var hasIssuedDeprecationWarningRef = React__namespace.useRef(false);
|
|
7457
7438
|
var client = useApolloClient(options === null || options === void 0 ? void 0 : options.client);
|
|
7458
7439
|
verifyDocumentType(subscription, exports.DocumentType.Subscription);
|
|
7459
|
-
var _a =
|
|
7440
|
+
var _a = React__namespace.useState({
|
|
7460
7441
|
loading: !(options === null || options === void 0 ? void 0 : options.skip),
|
|
7461
7442
|
error: void 0,
|
|
7462
7443
|
data: void 0,
|
|
@@ -7465,13 +7446,13 @@ function useSubscription(subscription, options) {
|
|
|
7465
7446
|
if (!hasIssuedDeprecationWarningRef.current) {
|
|
7466
7447
|
hasIssuedDeprecationWarningRef.current = true;
|
|
7467
7448
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionData) {
|
|
7468
|
-
__DEV__ && invariant.warn(options.onData ? 50 : 51);
|
|
7449
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onData ? 50 : 51);
|
|
7469
7450
|
}
|
|
7470
7451
|
if (options === null || options === void 0 ? void 0 : options.onSubscriptionComplete) {
|
|
7471
|
-
__DEV__ && invariant.warn(options.onComplete ? 52 : 53);
|
|
7452
|
+
globalThis.__DEV__ !== false && invariant.warn(options.onComplete ? 52 : 53);
|
|
7472
7453
|
}
|
|
7473
7454
|
}
|
|
7474
|
-
var _b =
|
|
7455
|
+
var _b = React__namespace.useState(function () {
|
|
7475
7456
|
if (options === null || options === void 0 ? void 0 : options.skip) {
|
|
7476
7457
|
return null;
|
|
7477
7458
|
}
|
|
@@ -7482,14 +7463,14 @@ function useSubscription(subscription, options) {
|
|
|
7482
7463
|
context: options === null || options === void 0 ? void 0 : options.context,
|
|
7483
7464
|
});
|
|
7484
7465
|
}), observable = _b[0], setObservable = _b[1];
|
|
7485
|
-
var canResetObservableRef =
|
|
7486
|
-
|
|
7466
|
+
var canResetObservableRef = React__namespace.useRef(false);
|
|
7467
|
+
React__namespace.useEffect(function () {
|
|
7487
7468
|
return function () {
|
|
7488
7469
|
canResetObservableRef.current = true;
|
|
7489
7470
|
};
|
|
7490
7471
|
}, []);
|
|
7491
|
-
var ref =
|
|
7492
|
-
|
|
7472
|
+
var ref = React__namespace.useRef({ client: client, subscription: subscription, options: options });
|
|
7473
|
+
React__namespace.useEffect(function () {
|
|
7493
7474
|
var _a, _b, _c, _d;
|
|
7494
7475
|
var shouldResubscribe = options === null || options === void 0 ? void 0 : options.shouldResubscribe;
|
|
7495
7476
|
if (typeof shouldResubscribe === 'function') {
|
|
@@ -7530,7 +7511,7 @@ function useSubscription(subscription, options) {
|
|
|
7530
7511
|
}
|
|
7531
7512
|
Object.assign(ref.current, { client: client, subscription: subscription, options: options });
|
|
7532
7513
|
}, [client, subscription, options, canResetObservableRef.current]);
|
|
7533
|
-
|
|
7514
|
+
React__namespace.useEffect(function () {
|
|
7534
7515
|
if (!observable) {
|
|
7535
7516
|
return;
|
|
7536
7517
|
}
|
|
@@ -7597,8 +7578,8 @@ function useSubscription(subscription, options) {
|
|
|
7597
7578
|
|
|
7598
7579
|
function useReactiveVar(rv) {
|
|
7599
7580
|
var value = rv();
|
|
7600
|
-
var setValue =
|
|
7601
|
-
|
|
7581
|
+
var setValue = React__namespace.useState(value)[1];
|
|
7582
|
+
React__namespace.useEffect(function () {
|
|
7602
7583
|
var probablySameValue = rv();
|
|
7603
7584
|
if (value !== probablySameValue) {
|
|
7604
7585
|
setValue(probablySameValue);
|
|
@@ -7614,7 +7595,7 @@ function useFragment(options) {
|
|
|
7614
7595
|
var cache = useApolloClient().cache;
|
|
7615
7596
|
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"]);
|
|
7616
7597
|
var diffOptions = tslib.__assign(tslib.__assign({}, rest), { returnPartialData: true, id: typeof from === "string" ? from : cache.identify(from), query: cache["getFragmentDoc"](fragment, fragmentName), optimistic: optimistic });
|
|
7617
|
-
var resultRef =
|
|
7598
|
+
var resultRef = React__namespace.useRef();
|
|
7618
7599
|
var latestDiff = cache.diff(diffOptions);
|
|
7619
7600
|
var getSnapshot = function () {
|
|
7620
7601
|
var latestDiffToResult = diffToResult(latestDiff);
|
|
@@ -7644,25 +7625,15 @@ function diffToResult(diff) {
|
|
|
7644
7625
|
}
|
|
7645
7626
|
|
|
7646
7627
|
function useDeepMemo(memoFn, deps) {
|
|
7647
|
-
var ref =
|
|
7628
|
+
var ref = React__namespace.useRef();
|
|
7648
7629
|
if (!ref.current || !equal.equal(ref.current.deps, deps)) {
|
|
7649
7630
|
ref.current = { value: memoFn(), deps: deps };
|
|
7650
7631
|
}
|
|
7651
7632
|
return ref.current.value;
|
|
7652
7633
|
}
|
|
7653
7634
|
|
|
7654
|
-
function useStrictModeSafeCleanupEffect(cleanup) {
|
|
7655
|
-
var timeout;
|
|
7656
|
-
React.useEffect(function () {
|
|
7657
|
-
clearTimeout(timeout);
|
|
7658
|
-
return function () {
|
|
7659
|
-
timeout = setTimeout(cleanup);
|
|
7660
|
-
};
|
|
7661
|
-
}, []);
|
|
7662
|
-
}
|
|
7663
|
-
|
|
7664
7635
|
var useKey = 'use';
|
|
7665
|
-
var realHook =
|
|
7636
|
+
var realHook = React__namespace[useKey];
|
|
7666
7637
|
var __use = realHook ||
|
|
7667
7638
|
function __use(promise) {
|
|
7668
7639
|
var statefulPromise = wrapPromiseWithState(promise);
|
|
@@ -7676,25 +7647,238 @@ var __use = realHook ||
|
|
|
7676
7647
|
}
|
|
7677
7648
|
};
|
|
7678
7649
|
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7650
|
+
var QUERY_REFERENCE_SYMBOL = Symbol();
|
|
7651
|
+
var OBSERVED_CHANGED_OPTIONS = [
|
|
7652
|
+
'canonizeResults',
|
|
7653
|
+
'context',
|
|
7654
|
+
'errorPolicy',
|
|
7655
|
+
'fetchPolicy',
|
|
7656
|
+
'refetchWritePolicy',
|
|
7657
|
+
'returnPartialData',
|
|
7658
|
+
];
|
|
7659
|
+
var InternalQueryReference = (function () {
|
|
7660
|
+
function InternalQueryReference(observable, options) {
|
|
7661
|
+
var _this = this;
|
|
7662
|
+
var _a;
|
|
7663
|
+
this.listeners = new Set();
|
|
7664
|
+
this.status = 'loading';
|
|
7665
|
+
this.references = 0;
|
|
7666
|
+
this.listen = this.listen.bind(this);
|
|
7667
|
+
this.handleNext = this.handleNext.bind(this);
|
|
7668
|
+
this.handleError = this.handleError.bind(this);
|
|
7669
|
+
this.initiateFetch = this.initiateFetch.bind(this);
|
|
7670
|
+
this.dispose = this.dispose.bind(this);
|
|
7671
|
+
this.observable = observable;
|
|
7672
|
+
this.result = observable.getCurrentResult(false);
|
|
7673
|
+
this.key = options.key;
|
|
7674
|
+
if (options.onDispose) {
|
|
7675
|
+
this.onDispose = options.onDispose;
|
|
7676
|
+
}
|
|
7677
|
+
if (isNetworkRequestSettled(this.result.networkStatus) ||
|
|
7678
|
+
(this.result.data &&
|
|
7679
|
+
(!this.result.partial || this.watchQueryOptions.returnPartialData))) {
|
|
7680
|
+
this.promise = createFulfilledPromise(this.result);
|
|
7681
|
+
this.status = 'idle';
|
|
7682
|
+
}
|
|
7683
|
+
else {
|
|
7684
|
+
this.promise = new Promise(function (resolve, reject) {
|
|
7685
|
+
_this.resolve = resolve;
|
|
7686
|
+
_this.reject = reject;
|
|
7687
|
+
});
|
|
7688
|
+
}
|
|
7689
|
+
this.subscription = observable
|
|
7690
|
+
.filter(function (_a) {
|
|
7691
|
+
var data = _a.data;
|
|
7692
|
+
return !equal.equal(data, {});
|
|
7693
|
+
})
|
|
7694
|
+
.subscribe({
|
|
7695
|
+
next: this.handleNext,
|
|
7696
|
+
error: this.handleError,
|
|
7697
|
+
});
|
|
7698
|
+
this.autoDisposeTimeoutId = setTimeout(this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
|
|
7699
|
+
}
|
|
7700
|
+
Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", {
|
|
7701
|
+
get: function () {
|
|
7702
|
+
return this.observable.options;
|
|
7703
|
+
},
|
|
7704
|
+
enumerable: false,
|
|
7705
|
+
configurable: true
|
|
7706
|
+
});
|
|
7707
|
+
InternalQueryReference.prototype.retain = function () {
|
|
7708
|
+
var _this = this;
|
|
7709
|
+
this.references++;
|
|
7710
|
+
clearTimeout(this.autoDisposeTimeoutId);
|
|
7711
|
+
var disposed = false;
|
|
7712
|
+
return function () {
|
|
7713
|
+
if (disposed) {
|
|
7714
|
+
return;
|
|
7715
|
+
}
|
|
7716
|
+
disposed = true;
|
|
7717
|
+
_this.references--;
|
|
7718
|
+
setTimeout(function () {
|
|
7719
|
+
if (!_this.references) {
|
|
7720
|
+
_this.dispose();
|
|
7721
|
+
}
|
|
7722
|
+
});
|
|
7723
|
+
};
|
|
7724
|
+
};
|
|
7725
|
+
InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) {
|
|
7726
|
+
var _this = this;
|
|
7727
|
+
return OBSERVED_CHANGED_OPTIONS.some(function (option) {
|
|
7728
|
+
return !equal.equal(_this.watchQueryOptions[option], watchQueryOptions[option]);
|
|
7729
|
+
});
|
|
7730
|
+
};
|
|
7731
|
+
InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) {
|
|
7732
|
+
var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults;
|
|
7733
|
+
if (currentFetchPolicy === 'standby' &&
|
|
7734
|
+
currentFetchPolicy !== watchQueryOptions.fetchPolicy) {
|
|
7735
|
+
this.observable.reobserve(watchQueryOptions);
|
|
7736
|
+
this.initiateFetch();
|
|
7737
|
+
}
|
|
7738
|
+
else {
|
|
7739
|
+
this.observable.silentSetOptions(watchQueryOptions);
|
|
7740
|
+
if (currentCanonizeResults !== watchQueryOptions.canonizeResults) {
|
|
7741
|
+
this.result = tslib.__assign(tslib.__assign({}, this.result), this.observable.getCurrentResult());
|
|
7742
|
+
this.promise = createFulfilledPromise(this.result);
|
|
7743
|
+
}
|
|
7744
|
+
}
|
|
7745
|
+
return this.promise;
|
|
7746
|
+
};
|
|
7747
|
+
InternalQueryReference.prototype.listen = function (listener) {
|
|
7748
|
+
var _this = this;
|
|
7749
|
+
this.listeners.add(listener);
|
|
7750
|
+
return function () {
|
|
7751
|
+
_this.listeners.delete(listener);
|
|
7752
|
+
};
|
|
7753
|
+
};
|
|
7754
|
+
InternalQueryReference.prototype.refetch = function (variables) {
|
|
7755
|
+
var promise = this.observable.refetch(variables);
|
|
7756
|
+
this.initiateFetch();
|
|
7757
|
+
return promise;
|
|
7758
|
+
};
|
|
7759
|
+
InternalQueryReference.prototype.fetchMore = function (options) {
|
|
7760
|
+
var promise = this.observable.fetchMore(options);
|
|
7761
|
+
this.initiateFetch();
|
|
7762
|
+
return promise;
|
|
7763
|
+
};
|
|
7764
|
+
InternalQueryReference.prototype.dispose = function () {
|
|
7765
|
+
this.subscription.unsubscribe();
|
|
7766
|
+
this.onDispose();
|
|
7767
|
+
};
|
|
7768
|
+
InternalQueryReference.prototype.onDispose = function () {
|
|
7769
|
+
};
|
|
7770
|
+
InternalQueryReference.prototype.handleNext = function (result) {
|
|
7771
|
+
var _a;
|
|
7772
|
+
switch (this.status) {
|
|
7773
|
+
case 'loading': {
|
|
7774
|
+
if (result.data === void 0) {
|
|
7775
|
+
result.data = this.result.data;
|
|
7776
|
+
}
|
|
7777
|
+
this.status = 'idle';
|
|
7778
|
+
this.result = result;
|
|
7779
|
+
(_a = this.resolve) === null || _a === void 0 ? void 0 : _a.call(this, result);
|
|
7780
|
+
break;
|
|
7781
|
+
}
|
|
7782
|
+
case 'idle': {
|
|
7783
|
+
if (result.data === this.result.data) {
|
|
7784
|
+
return;
|
|
7785
|
+
}
|
|
7786
|
+
if (result.data === void 0) {
|
|
7787
|
+
result.data = this.result.data;
|
|
7788
|
+
}
|
|
7789
|
+
this.result = result;
|
|
7790
|
+
this.promise = createFulfilledPromise(result);
|
|
7791
|
+
this.deliver(this.promise);
|
|
7792
|
+
break;
|
|
7793
|
+
}
|
|
7794
|
+
}
|
|
7795
|
+
};
|
|
7796
|
+
InternalQueryReference.prototype.handleError = function (error) {
|
|
7797
|
+
var _a;
|
|
7798
|
+
switch (this.status) {
|
|
7799
|
+
case 'loading': {
|
|
7800
|
+
this.status = 'idle';
|
|
7801
|
+
(_a = this.reject) === null || _a === void 0 ? void 0 : _a.call(this, error);
|
|
7802
|
+
break;
|
|
7803
|
+
}
|
|
7804
|
+
case 'idle': {
|
|
7805
|
+
this.promise = createRejectedPromise(error);
|
|
7806
|
+
this.deliver(this.promise);
|
|
7807
|
+
}
|
|
7808
|
+
}
|
|
7809
|
+
};
|
|
7810
|
+
InternalQueryReference.prototype.deliver = function (promise) {
|
|
7811
|
+
this.listeners.forEach(function (listener) { return listener(promise); });
|
|
7812
|
+
};
|
|
7813
|
+
InternalQueryReference.prototype.initiateFetch = function () {
|
|
7814
|
+
var _this = this;
|
|
7815
|
+
this.status = 'loading';
|
|
7816
|
+
this.promise = new Promise(function (resolve, reject) {
|
|
7817
|
+
_this.resolve = resolve;
|
|
7818
|
+
_this.reject = reject;
|
|
7819
|
+
});
|
|
7820
|
+
this.promise.catch(function () { });
|
|
7821
|
+
};
|
|
7822
|
+
return InternalQueryReference;
|
|
7823
|
+
}());
|
|
7824
|
+
|
|
7825
|
+
var SuspenseCache$1 = (function () {
|
|
7826
|
+
function SuspenseCache(options) {
|
|
7827
|
+
if (options === void 0) { options = Object.create(null); }
|
|
7828
|
+
this.queryRefs = new trie.Trie(canUseWeakMap);
|
|
7829
|
+
this.options = options;
|
|
7830
|
+
}
|
|
7831
|
+
SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {
|
|
7832
|
+
var ref = this.queryRefs.lookupArray(cacheKey);
|
|
7833
|
+
if (!ref.current) {
|
|
7834
|
+
ref.current = new InternalQueryReference(createObservable(), {
|
|
7835
|
+
key: cacheKey,
|
|
7836
|
+
autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,
|
|
7837
|
+
onDispose: function () {
|
|
7838
|
+
delete ref.current;
|
|
7839
|
+
},
|
|
7840
|
+
});
|
|
7841
|
+
}
|
|
7842
|
+
return ref.current;
|
|
7843
|
+
};
|
|
7844
|
+
return SuspenseCache;
|
|
7845
|
+
}());
|
|
7846
|
+
|
|
7847
|
+
var suspenseCacheSymbol = Symbol.for('apollo.suspenseCache');
|
|
7848
|
+
function getSuspenseCache(client) {
|
|
7849
|
+
var _a;
|
|
7850
|
+
if (!client[suspenseCacheSymbol]) {
|
|
7851
|
+
client[suspenseCacheSymbol] = new SuspenseCache$1((_a = client.defaultOptions.react) === null || _a === void 0 ? void 0 : _a.suspense);
|
|
7852
|
+
}
|
|
7853
|
+
return client[suspenseCacheSymbol];
|
|
7684
7854
|
}
|
|
7685
7855
|
|
|
7856
|
+
var SuspenseCache = (function (_super) {
|
|
7857
|
+
tslib.__extends(SuspenseCache, _super);
|
|
7858
|
+
function SuspenseCache() {
|
|
7859
|
+
_super.call(this) || this;
|
|
7860
|
+
throw new Error('It is no longer necessary to create a `SuspenseCache` instance and pass it into the `ApolloProvider`.\n' +
|
|
7861
|
+
'Please remove this code from your application. \n\n' +
|
|
7862
|
+
'This export will be removed with the final 3.8 release.');
|
|
7863
|
+
}
|
|
7864
|
+
return SuspenseCache;
|
|
7865
|
+
}(SuspenseCache$1));
|
|
7866
|
+
|
|
7686
7867
|
function useSuspenseQuery(query, options) {
|
|
7687
7868
|
if (options === void 0) { options = Object.create(null); }
|
|
7688
7869
|
var client = useApolloClient(options.client);
|
|
7689
|
-
var suspenseCache =
|
|
7870
|
+
var suspenseCache = getSuspenseCache(client);
|
|
7690
7871
|
var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });
|
|
7691
7872
|
var fetchPolicy = watchQueryOptions.fetchPolicy, variables = watchQueryOptions.variables;
|
|
7692
7873
|
var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
|
|
7693
|
-
var cacheKey =
|
|
7874
|
+
var cacheKey = tslib.__spreadArray([
|
|
7875
|
+
query,
|
|
7876
|
+
canonicalStringify(variables)
|
|
7877
|
+
], [].concat(queryKey), true);
|
|
7694
7878
|
var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
|
|
7695
7879
|
return client.watchQuery(watchQueryOptions);
|
|
7696
7880
|
});
|
|
7697
|
-
var _b =
|
|
7881
|
+
var _b = React__namespace.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
|
|
7698
7882
|
var promise = promiseCache.get(queryRef.key);
|
|
7699
7883
|
if (queryRef.didChangeOptions(watchQueryOptions)) {
|
|
7700
7884
|
promise = queryRef.applyOptions(watchQueryOptions);
|
|
@@ -7704,15 +7888,19 @@ function useSuspenseQuery(query, options) {
|
|
|
7704
7888
|
promise = queryRef.promise;
|
|
7705
7889
|
promiseCache.set(queryRef.key, promise);
|
|
7706
7890
|
}
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7891
|
+
React__namespace.useEffect(function () {
|
|
7892
|
+
var dispose = queryRef.retain();
|
|
7893
|
+
var removeListener = queryRef.listen(function (promise) {
|
|
7710
7894
|
setPromiseCache(function (promiseCache) {
|
|
7711
7895
|
return new Map(promiseCache).set(queryRef.key, promise);
|
|
7712
7896
|
});
|
|
7713
7897
|
});
|
|
7898
|
+
return function () {
|
|
7899
|
+
removeListener();
|
|
7900
|
+
dispose();
|
|
7901
|
+
};
|
|
7714
7902
|
}, [queryRef]);
|
|
7715
|
-
var skipResult =
|
|
7903
|
+
var skipResult = React__namespace.useMemo(function () {
|
|
7716
7904
|
var error = toApolloError(queryRef.result);
|
|
7717
7905
|
return {
|
|
7718
7906
|
loading: false,
|
|
@@ -7722,22 +7910,22 @@ function useSuspenseQuery(query, options) {
|
|
|
7722
7910
|
};
|
|
7723
7911
|
}, [queryRef.result]);
|
|
7724
7912
|
var result = fetchPolicy === 'standby' ? skipResult : __use(promise);
|
|
7725
|
-
var fetchMore =
|
|
7913
|
+
var fetchMore = React__namespace.useCallback(function (options) {
|
|
7726
7914
|
var promise = queryRef.fetchMore(options);
|
|
7727
7915
|
setPromiseCache(function (previousPromiseCache) {
|
|
7728
|
-
return new Map(previousPromiseCache).set(queryRef.key, promise);
|
|
7916
|
+
return new Map(previousPromiseCache).set(queryRef.key, queryRef.promise);
|
|
7729
7917
|
});
|
|
7730
7918
|
return promise;
|
|
7731
7919
|
}, [queryRef]);
|
|
7732
|
-
var refetch =
|
|
7920
|
+
var refetch = React__namespace.useCallback(function (variables) {
|
|
7733
7921
|
var promise = queryRef.refetch(variables);
|
|
7734
7922
|
setPromiseCache(function (previousPromiseCache) {
|
|
7735
|
-
return new Map(previousPromiseCache).set(queryRef.key, promise);
|
|
7923
|
+
return new Map(previousPromiseCache).set(queryRef.key, queryRef.promise);
|
|
7736
7924
|
});
|
|
7737
7925
|
return promise;
|
|
7738
7926
|
}, [queryRef]);
|
|
7739
|
-
var subscribeToMore =
|
|
7740
|
-
return
|
|
7927
|
+
var subscribeToMore = React__namespace.useCallback(function (options) { return queryRef.observable.subscribeToMore(options); }, [queryRef]);
|
|
7928
|
+
return React__namespace.useMemo(function () {
|
|
7741
7929
|
return {
|
|
7742
7930
|
client: client,
|
|
7743
7931
|
data: result.data,
|
|
@@ -7763,11 +7951,11 @@ function validateFetchPolicy(fetchPolicy) {
|
|
|
7763
7951
|
'no-cache',
|
|
7764
7952
|
'cache-and-network',
|
|
7765
7953
|
];
|
|
7766
|
-
invariant(supportedFetchPolicies.includes(fetchPolicy),
|
|
7954
|
+
invariant(supportedFetchPolicies.includes(fetchPolicy), 54, fetchPolicy);
|
|
7767
7955
|
}
|
|
7768
7956
|
function validatePartialDataReturn(fetchPolicy, returnPartialData) {
|
|
7769
7957
|
if (fetchPolicy === 'no-cache' && returnPartialData) {
|
|
7770
|
-
__DEV__ && invariant.warn(
|
|
7958
|
+
globalThis.__DEV__ !== false && invariant.warn(55);
|
|
7771
7959
|
}
|
|
7772
7960
|
}
|
|
7773
7961
|
function toApolloError(result) {
|
|
@@ -7775,13 +7963,6 @@ function toApolloError(result) {
|
|
|
7775
7963
|
? new ApolloError({ graphQLErrors: result.errors })
|
|
7776
7964
|
: result.error;
|
|
7777
7965
|
}
|
|
7778
|
-
function useTrackedQueryRefs(queryRef) {
|
|
7779
|
-
var trackedQueryRefs = React.useRef(new Set());
|
|
7780
|
-
trackedQueryRefs.current.add(queryRef);
|
|
7781
|
-
useStrictModeSafeCleanupEffect(function () {
|
|
7782
|
-
trackedQueryRefs.current.forEach(function (sub) { return sub.dispose(); });
|
|
7783
|
-
});
|
|
7784
|
-
}
|
|
7785
7966
|
function useWatchQueryOptions(_a) {
|
|
7786
7967
|
var client = _a.client, query = _a.query, options = _a.options;
|
|
7787
7968
|
return useDeepMemo(function () {
|
|
@@ -7790,7 +7971,7 @@ function useWatchQueryOptions(_a) {
|
|
|
7790
7971
|
((_a = client.defaultOptions.watchQuery) === null || _a === void 0 ? void 0 : _a.fetchPolicy) ||
|
|
7791
7972
|
'cache-first';
|
|
7792
7973
|
var watchQueryOptions = tslib.__assign(tslib.__assign({}, options), { fetchPolicy: fetchPolicy, query: query, notifyOnNetworkStatusChange: false, nextFetchPolicy: void 0 });
|
|
7793
|
-
if (__DEV__) {
|
|
7974
|
+
if (globalThis.__DEV__ !== false) {
|
|
7794
7975
|
validateOptions(watchQueryOptions);
|
|
7795
7976
|
}
|
|
7796
7977
|
if (options.skip) {
|
|
@@ -7800,183 +7981,42 @@ function useWatchQueryOptions(_a) {
|
|
|
7800
7981
|
}, [client, options, query]);
|
|
7801
7982
|
}
|
|
7802
7983
|
|
|
7803
|
-
var QUERY_REFERENCE_SYMBOL = Symbol();
|
|
7804
|
-
var OBSERVED_CHANGED_OPTIONS = [
|
|
7805
|
-
'canonizeResults',
|
|
7806
|
-
'context',
|
|
7807
|
-
'errorPolicy',
|
|
7808
|
-
'fetchPolicy',
|
|
7809
|
-
'refetchWritePolicy',
|
|
7810
|
-
'returnPartialData',
|
|
7811
|
-
];
|
|
7812
|
-
var InternalQueryReference = (function () {
|
|
7813
|
-
function InternalQueryReference(observable, options) {
|
|
7814
|
-
var _this = this;
|
|
7815
|
-
var _a;
|
|
7816
|
-
this.listeners = new Set();
|
|
7817
|
-
this.initialized = false;
|
|
7818
|
-
this.refetching = false;
|
|
7819
|
-
this.listen = this.listen.bind(this);
|
|
7820
|
-
this.handleNext = this.handleNext.bind(this);
|
|
7821
|
-
this.handleError = this.handleError.bind(this);
|
|
7822
|
-
this.dispose = this.dispose.bind(this);
|
|
7823
|
-
this.observable = observable;
|
|
7824
|
-
this.result = observable.getCurrentResult(false);
|
|
7825
|
-
this.key = options.key;
|
|
7826
|
-
if (options.onDispose) {
|
|
7827
|
-
this.onDispose = options.onDispose;
|
|
7828
|
-
}
|
|
7829
|
-
if (isNetworkRequestSettled(this.result.networkStatus) ||
|
|
7830
|
-
(this.result.data &&
|
|
7831
|
-
(!this.result.partial || this.observable.options.returnPartialData))) {
|
|
7832
|
-
this.promise = createFulfilledPromise(this.result);
|
|
7833
|
-
this.initialized = true;
|
|
7834
|
-
this.refetching = false;
|
|
7835
|
-
}
|
|
7836
|
-
this.subscription = observable.subscribe({
|
|
7837
|
-
next: this.handleNext,
|
|
7838
|
-
error: this.handleError,
|
|
7839
|
-
});
|
|
7840
|
-
if (!this.promise) {
|
|
7841
|
-
this.promise = new Promise(function (resolve, reject) {
|
|
7842
|
-
_this.resolve = resolve;
|
|
7843
|
-
_this.reject = reject;
|
|
7844
|
-
});
|
|
7845
|
-
}
|
|
7846
|
-
this.autoDisposeTimeoutId = setTimeout(this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
|
|
7847
|
-
}
|
|
7848
|
-
Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", {
|
|
7849
|
-
get: function () {
|
|
7850
|
-
return this.observable.options;
|
|
7851
|
-
},
|
|
7852
|
-
enumerable: false,
|
|
7853
|
-
configurable: true
|
|
7854
|
-
});
|
|
7855
|
-
InternalQueryReference.prototype.didChangeOptions = function (watchQueryOptions) {
|
|
7856
|
-
var _this = this;
|
|
7857
|
-
return OBSERVED_CHANGED_OPTIONS.some(function (option) {
|
|
7858
|
-
return !equal.equal(_this.watchQueryOptions[option], watchQueryOptions[option]);
|
|
7859
|
-
});
|
|
7860
|
-
};
|
|
7861
|
-
InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) {
|
|
7862
|
-
var currentFetchPolicy = this.watchQueryOptions.fetchPolicy;
|
|
7863
|
-
if (currentFetchPolicy === 'standby' &&
|
|
7864
|
-
currentFetchPolicy !== watchQueryOptions.fetchPolicy) {
|
|
7865
|
-
this.promise = this.observable.reobserve(watchQueryOptions);
|
|
7866
|
-
}
|
|
7867
|
-
else {
|
|
7868
|
-
this.observable.silentSetOptions(watchQueryOptions);
|
|
7869
|
-
this.result = tslib.__assign(tslib.__assign({}, this.result), this.observable.getCurrentResult());
|
|
7870
|
-
this.promise = createFulfilledPromise(this.result);
|
|
7871
|
-
}
|
|
7872
|
-
return this.promise;
|
|
7873
|
-
};
|
|
7874
|
-
InternalQueryReference.prototype.listen = function (listener) {
|
|
7875
|
-
var _this = this;
|
|
7876
|
-
clearTimeout(this.autoDisposeTimeoutId);
|
|
7877
|
-
this.listeners.add(listener);
|
|
7878
|
-
return function () {
|
|
7879
|
-
_this.listeners.delete(listener);
|
|
7880
|
-
};
|
|
7881
|
-
};
|
|
7882
|
-
InternalQueryReference.prototype.refetch = function (variables) {
|
|
7883
|
-
this.refetching = true;
|
|
7884
|
-
var promise = this.observable.refetch(variables);
|
|
7885
|
-
this.promise = promise;
|
|
7886
|
-
return promise;
|
|
7887
|
-
};
|
|
7888
|
-
InternalQueryReference.prototype.fetchMore = function (options) {
|
|
7889
|
-
var promise = this.observable.fetchMore(options);
|
|
7890
|
-
this.promise = promise;
|
|
7891
|
-
return promise;
|
|
7892
|
-
};
|
|
7893
|
-
InternalQueryReference.prototype.reobserve = function (watchQueryOptions) {
|
|
7894
|
-
var promise = this.observable.reobserve(watchQueryOptions);
|
|
7895
|
-
this.promise = promise;
|
|
7896
|
-
return promise;
|
|
7897
|
-
};
|
|
7898
|
-
InternalQueryReference.prototype.dispose = function () {
|
|
7899
|
-
this.subscription.unsubscribe();
|
|
7900
|
-
this.onDispose();
|
|
7901
|
-
};
|
|
7902
|
-
InternalQueryReference.prototype.onDispose = function () {
|
|
7903
|
-
};
|
|
7904
|
-
InternalQueryReference.prototype.handleNext = function (result) {
|
|
7905
|
-
if (!this.initialized || this.refetching) {
|
|
7906
|
-
if (!isNetworkRequestSettled(result.networkStatus)) {
|
|
7907
|
-
return;
|
|
7908
|
-
}
|
|
7909
|
-
if (this.result.data && result.data === void 0) {
|
|
7910
|
-
result.data = this.result.data;
|
|
7911
|
-
}
|
|
7912
|
-
this.initialized = true;
|
|
7913
|
-
this.refetching = false;
|
|
7914
|
-
this.result = result;
|
|
7915
|
-
if (this.resolve) {
|
|
7916
|
-
this.resolve(result);
|
|
7917
|
-
}
|
|
7918
|
-
return;
|
|
7919
|
-
}
|
|
7920
|
-
if (result.data === this.result.data) {
|
|
7921
|
-
return;
|
|
7922
|
-
}
|
|
7923
|
-
this.result = result;
|
|
7924
|
-
this.promise = createFulfilledPromise(result);
|
|
7925
|
-
this.deliver(this.promise);
|
|
7926
|
-
};
|
|
7927
|
-
InternalQueryReference.prototype.handleError = function (error) {
|
|
7928
|
-
var result = tslib.__assign(tslib.__assign({}, this.result), { error: error, networkStatus: exports.NetworkStatus.error });
|
|
7929
|
-
this.result = result;
|
|
7930
|
-
if (!this.initialized || this.refetching) {
|
|
7931
|
-
this.initialized = true;
|
|
7932
|
-
this.refetching = false;
|
|
7933
|
-
if (this.reject) {
|
|
7934
|
-
this.reject(error);
|
|
7935
|
-
}
|
|
7936
|
-
return;
|
|
7937
|
-
}
|
|
7938
|
-
this.promise = createRejectedPromise(error);
|
|
7939
|
-
this.deliver(this.promise);
|
|
7940
|
-
};
|
|
7941
|
-
InternalQueryReference.prototype.deliver = function (promise) {
|
|
7942
|
-
this.listeners.forEach(function (listener) { return listener(promise); });
|
|
7943
|
-
};
|
|
7944
|
-
return InternalQueryReference;
|
|
7945
|
-
}());
|
|
7946
|
-
|
|
7947
7984
|
function useBackgroundQuery(query, options) {
|
|
7948
7985
|
if (options === void 0) { options = Object.create(null); }
|
|
7949
|
-
var suspenseCache = useSuspenseCache(options.suspenseCache);
|
|
7950
7986
|
var client = useApolloClient(options.client);
|
|
7987
|
+
var suspenseCache = getSuspenseCache(client);
|
|
7951
7988
|
var watchQueryOptions = useWatchQueryOptions({ client: client, query: query, options: options });
|
|
7952
7989
|
var variables = watchQueryOptions.variables;
|
|
7953
7990
|
var _a = options.queryKey, queryKey = _a === void 0 ? [] : _a;
|
|
7954
|
-
var cacheKey =
|
|
7991
|
+
var cacheKey = tslib.__spreadArray([
|
|
7992
|
+
query,
|
|
7993
|
+
canonicalStringify(variables)
|
|
7994
|
+
], [].concat(queryKey), true);
|
|
7955
7995
|
var queryRef = suspenseCache.getQueryRef(cacheKey, function () {
|
|
7956
7996
|
return client.watchQuery(watchQueryOptions);
|
|
7957
7997
|
});
|
|
7958
|
-
var _b =
|
|
7998
|
+
var _b = React__namespace.useState(function () { return new Map([[queryRef.key, queryRef.promise]]); }), promiseCache = _b[0], setPromiseCache = _b[1];
|
|
7959
7999
|
if (queryRef.didChangeOptions(watchQueryOptions)) {
|
|
7960
8000
|
var promise = queryRef.applyOptions(watchQueryOptions);
|
|
7961
8001
|
promiseCache.set(queryRef.key, promise);
|
|
7962
8002
|
}
|
|
7963
|
-
|
|
7964
|
-
var fetchMore =
|
|
8003
|
+
React__namespace.useEffect(function () { return queryRef.retain(); }, [queryRef]);
|
|
8004
|
+
var fetchMore = React__namespace.useCallback(function (options) {
|
|
7965
8005
|
var promise = queryRef.fetchMore(options);
|
|
7966
8006
|
setPromiseCache(function (promiseCache) {
|
|
7967
|
-
return new Map(promiseCache).set(queryRef.key, promise);
|
|
8007
|
+
return new Map(promiseCache).set(queryRef.key, queryRef.promise);
|
|
7968
8008
|
});
|
|
7969
8009
|
return promise;
|
|
7970
8010
|
}, [queryRef]);
|
|
7971
|
-
var refetch =
|
|
8011
|
+
var refetch = React__namespace.useCallback(function (variables) {
|
|
7972
8012
|
var promise = queryRef.refetch(variables);
|
|
7973
8013
|
setPromiseCache(function (promiseCache) {
|
|
7974
|
-
return new Map(promiseCache).set(queryRef.key, promise);
|
|
8014
|
+
return new Map(promiseCache).set(queryRef.key, queryRef.promise);
|
|
7975
8015
|
});
|
|
7976
8016
|
return promise;
|
|
7977
8017
|
}, [queryRef]);
|
|
7978
8018
|
queryRef.promiseCache = promiseCache;
|
|
7979
|
-
return
|
|
8019
|
+
return React__namespace.useMemo(function () {
|
|
7980
8020
|
var _a;
|
|
7981
8021
|
return [
|
|
7982
8022
|
(_a = {}, _a[QUERY_REFERENCE_SYMBOL] = queryRef, _a),
|
|
@@ -7989,10 +8029,10 @@ function useBackgroundQuery(query, options) {
|
|
|
7989
8029
|
}
|
|
7990
8030
|
|
|
7991
8031
|
function useReadQuery(queryRef) {
|
|
7992
|
-
var _a =
|
|
8032
|
+
var _a = React__namespace.useState(0), forceUpdate = _a[1];
|
|
7993
8033
|
var internalQueryRef = queryRef[QUERY_REFERENCE_SYMBOL];
|
|
7994
8034
|
invariant__default(internalQueryRef.promiseCache, 49);
|
|
7995
|
-
var skipResult =
|
|
8035
|
+
var skipResult = React__namespace.useMemo(function () {
|
|
7996
8036
|
var error = toApolloError(internalQueryRef.result);
|
|
7997
8037
|
return {
|
|
7998
8038
|
loading: false,
|
|
@@ -8006,7 +8046,7 @@ function useReadQuery(queryRef) {
|
|
|
8006
8046
|
promise = internalQueryRef.promise;
|
|
8007
8047
|
internalQueryRef.promiseCache.set(internalQueryRef.key, promise);
|
|
8008
8048
|
}
|
|
8009
|
-
|
|
8049
|
+
React__namespace.useEffect(function () {
|
|
8010
8050
|
return internalQueryRef.listen(function (promise) {
|
|
8011
8051
|
internalQueryRef.promiseCache.set(internalQueryRef.key, promise);
|
|
8012
8052
|
forceUpdate(function (prevState) { return prevState + 1; });
|
|
@@ -8015,7 +8055,7 @@ function useReadQuery(queryRef) {
|
|
|
8015
8055
|
var result = internalQueryRef.watchQueryOptions.fetchPolicy === 'standby'
|
|
8016
8056
|
? skipResult
|
|
8017
8057
|
: __use(promise);
|
|
8018
|
-
return
|
|
8058
|
+
return React__namespace.useMemo(function () {
|
|
8019
8059
|
return {
|
|
8020
8060
|
data: result.data,
|
|
8021
8061
|
networkStatus: result.networkStatus,
|
|
@@ -8024,28 +8064,6 @@ function useReadQuery(queryRef) {
|
|
|
8024
8064
|
}, [result]);
|
|
8025
8065
|
}
|
|
8026
8066
|
|
|
8027
|
-
var SuspenseCache = (function () {
|
|
8028
|
-
function SuspenseCache(options) {
|
|
8029
|
-
if (options === void 0) { options = Object.create(null); }
|
|
8030
|
-
this.queryRefs = new trie.Trie(canUseWeakMap);
|
|
8031
|
-
this.options = options;
|
|
8032
|
-
}
|
|
8033
|
-
SuspenseCache.prototype.getQueryRef = function (cacheKey, createObservable) {
|
|
8034
|
-
var ref = this.queryRefs.lookupArray(cacheKey);
|
|
8035
|
-
if (!ref.current) {
|
|
8036
|
-
ref.current = new InternalQueryReference(createObservable(), {
|
|
8037
|
-
key: cacheKey,
|
|
8038
|
-
autoDisposeTimeoutMs: this.options.autoDisposeTimeoutMs,
|
|
8039
|
-
onDispose: function () {
|
|
8040
|
-
delete ref.current;
|
|
8041
|
-
},
|
|
8042
|
-
});
|
|
8043
|
-
}
|
|
8044
|
-
return ref.current;
|
|
8045
|
-
};
|
|
8046
|
-
return SuspenseCache;
|
|
8047
|
-
}());
|
|
8048
|
-
|
|
8049
8067
|
exports.setLogVerbosity = invariant$1.setVerbosity;
|
|
8050
8068
|
exports.Observable = zenObservableTs.Observable;
|
|
8051
8069
|
exports.disableExperimentalFragmentVariables = graphqlTag.disableExperimentalFragmentVariables;
|