@apollo/client 3.8.0-beta.6 → 3.8.0-beta.7
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 +201 -189
- 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 +2 -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 +2 -3
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +2 -3
- 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/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.map +1 -1
- 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 +5 -5
- 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 +14 -14
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +2 -2
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +2 -2
- 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 +2 -2
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +2 -2
- 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 +14 -10
- package/react/cache/QueryReference.d.ts +7 -6
- 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 +3 -3
- 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/index.d.ts +1 -1
- package/react/cache/index.d.ts.map +1 -1
- package/react/cache/index.js +1 -1
- package/react/cache/index.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 +4 -5
- 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 +2 -2
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +2 -2
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs +9 -2
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +9 -2
- 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 +146 -129
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +146 -129
- 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 +13 -13
- 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/useSuspenseCache.d.ts +1 -1
- package/react/hooks/useSuspenseCache.d.ts.map +1 -1
- package/react/hooks/useSuspenseCache.js +4 -4
- package/react/hooks/useSuspenseCache.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 +26 -29
- 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 +1 -1
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs.map +1 -1
- package/react/react.cjs +82 -51
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +82 -51
- package/react/ssr/RenderPromises.d.ts +2 -2
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/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.map +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 +3 -3
- 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 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts.map +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js +2 -2
- 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 +7 -7
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +5 -5
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs.map +1 -1
- 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 +3 -3
- package/utilities/graphql/DocumentTransform.js.map +1 -1
- package/utilities/graphql/directives.js +1 -1
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.js +1 -1
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.js +2 -2
- 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 +3 -3
- 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 +4 -4
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +4 -4
- 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/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
|
@@ -704,7 +704,7 @@ var ObjectCanon = (function () {
|
|
|
704
704
|
var node = this.pool.lookupArray(array);
|
|
705
705
|
if (!node.array) {
|
|
706
706
|
this.known.add(node.array = array);
|
|
707
|
-
if (
|
|
707
|
+
if (globalThis.__DEV__ !== false) {
|
|
708
708
|
Object.freeze(array);
|
|
709
709
|
}
|
|
710
710
|
}
|
|
@@ -729,7 +729,7 @@ var ObjectCanon = (function () {
|
|
|
729
729
|
keys.sorted.forEach(function (key, i) {
|
|
730
730
|
obj_1[key] = array_1[firstValueIndex_1 + i];
|
|
731
731
|
});
|
|
732
|
-
if (
|
|
732
|
+
if (globalThis.__DEV__ !== false) {
|
|
733
733
|
Object.freeze(obj_1);
|
|
734
734
|
}
|
|
735
735
|
}
|
|
@@ -996,7 +996,7 @@ var StoreReader = (function () {
|
|
|
996
996
|
context: context,
|
|
997
997
|
}), i);
|
|
998
998
|
}
|
|
999
|
-
if (
|
|
999
|
+
if (globalThis.__DEV__ !== false) {
|
|
1000
1000
|
assertSelectionSetForIdValue(context.store, field, item);
|
|
1001
1001
|
}
|
|
1002
1002
|
return item;
|
|
@@ -1441,7 +1441,7 @@ var Policies = (function () {
|
|
|
1441
1441
|
if (supertypeSet.has(supertype)) {
|
|
1442
1442
|
if (!typenameSupertypeSet.has(supertype)) {
|
|
1443
1443
|
if (checkingFuzzySubtypes) {
|
|
1444
|
-
|
|
1444
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(4, typename, supertype);
|
|
1445
1445
|
}
|
|
1446
1446
|
typenameSupertypeSet.add(supertype);
|
|
1447
1447
|
}
|
|
@@ -1594,8 +1594,8 @@ function normalizeReadFieldOptions(readFieldArgs, objectOrReference, variables)
|
|
|
1594
1594
|
options.from = objectOrReference;
|
|
1595
1595
|
}
|
|
1596
1596
|
}
|
|
1597
|
-
if (
|
|
1598
|
-
|
|
1597
|
+
if (globalThis.__DEV__ !== false && options.from === void 0) {
|
|
1598
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(5, utilities.stringifyForDisplay(Array.from(readFieldArgs)));
|
|
1599
1599
|
}
|
|
1600
1600
|
if (void 0 === options.variables) {
|
|
1601
1601
|
options.variables = variables;
|
|
@@ -1678,7 +1678,7 @@ var StoreWriter = (function () {
|
|
|
1678
1678
|
}
|
|
1679
1679
|
storeObject = applied;
|
|
1680
1680
|
}
|
|
1681
|
-
if (
|
|
1681
|
+
if (globalThis.__DEV__ !== false && !context.overwrite) {
|
|
1682
1682
|
var fieldsWithSelectionSets_1 = Object.create(null);
|
|
1683
1683
|
fieldNodeSet.forEach(function (field) {
|
|
1684
1684
|
if (field.selectionSet) {
|
|
@@ -1766,12 +1766,12 @@ var StoreWriter = (function () {
|
|
|
1766
1766
|
_a[storeFieldName] = incomingValue,
|
|
1767
1767
|
_a));
|
|
1768
1768
|
}
|
|
1769
|
-
else if (
|
|
1769
|
+
else if (globalThis.__DEV__ !== false &&
|
|
1770
1770
|
!context.clientOnly &&
|
|
1771
1771
|
!context.deferred &&
|
|
1772
1772
|
!utilities.addTypenameToDocument.added(field) &&
|
|
1773
1773
|
!policies.getReadFunction(typename, field.name.value)) {
|
|
1774
|
-
|
|
1774
|
+
globalThis.__DEV__ !== false && globals.invariant.error(10, utilities.resultKeyNameFromField(field), result);
|
|
1775
1775
|
}
|
|
1776
1776
|
});
|
|
1777
1777
|
try {
|
|
@@ -1820,7 +1820,7 @@ var StoreWriter = (function () {
|
|
|
1820
1820
|
StoreWriter.prototype.processFieldValue = function (value, field, context, mergeTree) {
|
|
1821
1821
|
var _this = this;
|
|
1822
1822
|
if (!field.selectionSet || value === null) {
|
|
1823
|
-
return
|
|
1823
|
+
return globalThis.__DEV__ !== false ? utilities.cloneDeep(value) : value;
|
|
1824
1824
|
}
|
|
1825
1825
|
if (utilities.isArray(value)) {
|
|
1826
1826
|
return value.map(function (item, i) {
|
|
@@ -2011,7 +2011,7 @@ function warnAboutDataLoss(existingRef, incomingObj, storeFieldName, store) {
|
|
|
2011
2011
|
}
|
|
2012
2012
|
});
|
|
2013
2013
|
}
|
|
2014
|
-
|
|
2014
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(12, fieldName, parentType, childTypenames.length
|
|
2015
2015
|
? "either ensure all objects of type " + childTypenames.join(" and ") + " have an ID or a custom merge function, or "
|
|
2016
2016
|
: "", typeDotName, existing, incoming);
|
|
2017
2017
|
}
|
|
@@ -2171,7 +2171,7 @@ var InMemoryCache = (function (_super) {
|
|
|
2171
2171
|
return this.policies.identify(object)[0];
|
|
2172
2172
|
}
|
|
2173
2173
|
catch (e) {
|
|
2174
|
-
|
|
2174
|
+
globalThis.__DEV__ !== false && globals.invariant.warn(e);
|
|
2175
2175
|
}
|
|
2176
2176
|
};
|
|
2177
2177
|
InMemoryCache.prototype.evict = function (options) {
|
package/cache/core/cache.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DocumentNode } from 'graphql';
|
|
2
|
-
import type { StoreObject, Reference } from '../../utilities';
|
|
3
|
-
import type { DataProxy } from './types/DataProxy';
|
|
4
|
-
import type { Cache } from './types/Cache';
|
|
2
|
+
import type { StoreObject, Reference } from '../../utilities/index.js';
|
|
3
|
+
import type { DataProxy } from './types/DataProxy.js';
|
|
4
|
+
import type { Cache } from './types/Cache.js';
|
|
5
5
|
export type Transaction<T> = (c: ApolloCache<T>) => void;
|
|
6
6
|
export declare abstract class ApolloCache<TSerialized> implements DataProxy {
|
|
7
7
|
readonly assumeImmutableResults: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/cache/core/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/cache/core/cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EAAC,MAAM,0BAA0B,CAAC;AAI7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAEzD,8BAAsB,WAAW,CAAC,WAAW,CAAE,YAAW,SAAS;IACjE,SAAgB,sBAAsB,EAAE,OAAO,CAAS;aAIxC,IAAI,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,EAChD,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK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K,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,EACjD,OAAO,EAAE,KAAK,CAAC,qBAAqB,CAAC,KAAK,EAAE,UAAU,CAAC,EACvD,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG,IAAI,GAAG,IAAI,GAClD,KAAK,GAAG,IAAI;CAWhB"}
|
package/cache/core/cache.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import { wrap } from 'optimism';
|
|
3
|
-
import { getFragmentQueryDocument, } from
|
|
3
|
+
import { getFragmentQueryDocument, } from '../../utilities/index.js';
|
|
4
4
|
var ApolloCache = (function () {
|
|
5
5
|
function ApolloCache() {
|
|
6
6
|
this.assumeImmutableResults = false;
|
package/cache/core/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/cache/core/cache.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAKhC,OAAO,EACL,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AAMzB;IAAA;QACkB,2BAAsB,GAAY,KAAK,CAAC;QAkIhD,mBAAc,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC;IAoE1D,CAAC;IAhJQ,2BAAK,GAAZ,UAAgB,OAAoC;QAApD,iBAUC;QATC,IAAM,YAAY,GAChB,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAC7D,OAAO,CAAC,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC/C,IAAI,YAAe,CAAC;QACpB,IAAI,CAAC,kBAAkB,CACrB,cAAM,OAAA,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,KAAI,CAAC,EAAnC,CAAmC,EACz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CAAC,aAAa,uBAAyB,OAAO,KAAE,IAAI,MAAA,IAAG,CAAC;gBAC7D,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IACH,kBAAC;AAAD,CAAC,AAvMD,IAuMC","sourcesContent":["import type { DocumentNode } from 'graphql';\nimport { wrap } from 'optimism';\n\nimport type {\n StoreObject,\n Reference} from '../../utilities';\nimport {\n getFragmentQueryDocument,\n} from '../../utilities';\nimport type { DataProxy } from './types/DataProxy';\nimport type { Cache } from './types/Cache';\n\nexport type Transaction<T> = (c: ApolloCache<T>) => void;\n\nexport abstract class ApolloCache<TSerialized> implements DataProxy {\n public readonly assumeImmutableResults: boolean = false;\n\n // required to implement\n // core API\n public abstract read<TData = any, TVariables = any>(\n query: Cache.ReadOptions<TVariables, TData>,\n ): TData | null;\n public abstract write<TData = any, TVariables = any>(\n write: Cache.WriteOptions<TData, TVariables>,\n ): Reference | undefined;\n public abstract diff<T>(query: Cache.DiffOptions): Cache.DiffResult<T>;\n public abstract watch<TData = any, TVariables = any>(\n watch: Cache.WatchOptions<TData, TVariables>,\n ): () => void;\n\n // Empty the cache and restart all current watches (unless\n // options.discardWatches is true).\n public abstract reset(options?: Cache.ResetOptions): Promise<void>;\n\n // Remove whole objects from the cache by passing just options.id, or\n // specific fields by passing options.field and/or options.args. If no\n // options.args are provided, all fields matching options.field (even\n // those with arguments) will be removed. Returns true iff any data was\n // removed from the cache.\n public abstract evict(options: Cache.EvictOptions): boolean;\n\n // initializer / offline / ssr API\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public abstract restore(\n serializedState: TSerialized,\n ): ApolloCache<TSerialized>;\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public abstract extract(optimistic?: boolean): TSerialized;\n\n // Optimistic API\n\n public abstract removeOptimistic(id: string): void;\n\n // Transactional API\n\n // The batch method is intended to replace/subsume both performTransaction\n // and recordOptimisticTransaction, but performTransaction came first, so we\n // provide a default batch implementation that's just another way of calling\n // performTransaction. Subclasses of ApolloCache (such as InMemoryCache) can\n // override the batch method to do more interesting things with its options.\n public batch<U>(options: Cache.BatchOptions<this, U>): U {\n const optimisticId =\n typeof options.optimistic === \"string\" ? options.optimistic :\n options.optimistic === false ? null : void 0;\n let updateResult: U;\n this.performTransaction(\n () => updateResult = options.update(this),\n optimisticId,\n );\n return updateResult!;\n }\n\n public abstract performTransaction(\n transaction: Transaction<TSerialized>,\n // Although subclasses may implement recordOptimisticTransaction\n // however they choose, the default implementation simply calls\n // performTransaction with a string as the second argument, allowing\n // performTransaction to handle both optimistic and non-optimistic\n // (broadcast-batching) transactions. Passing null for optimisticId is\n // also allowed, and indicates that performTransaction should apply\n // the transaction non-optimistically (ignoring optimistic data).\n optimisticId?: string | null,\n ): void;\n\n public recordOptimisticTransaction(\n transaction: Transaction<TSerialized>,\n optimisticId: string,\n ) {\n this.performTransaction(transaction, optimisticId);\n }\n\n // Optional API\n\n // Called once per input document, allowing the cache to make static changes\n // to the query, such as adding __typename fields.\n public transformDocument(document: DocumentNode): DocumentNode {\n return document;\n }\n\n // Called before each ApolloLink request, allowing the cache to make dynamic\n // changes to the query, such as filling in missing fragment definitions.\n public transformForLink(document: DocumentNode): DocumentNode {\n return document;\n }\n\n public identify(object: StoreObject | Reference): string | undefined {\n return;\n }\n\n public gc(): string[] {\n return [];\n }\n\n public modify<Entity extends Record<string, any> = Record<string, any>>(options: Cache.ModifyOptions<Entity>): boolean {\n return false;\n }\n\n // DataProxy API\n /**\n *\n * @param options\n * @param optimistic\n */\n public readQuery<QueryType, TVariables = any>(\n options: Cache.ReadQueryOptions<QueryType, TVariables>,\n optimistic = !!options.optimistic,\n ): QueryType | null {\n return this.read({\n ...options,\n rootId: options.id || 'ROOT_QUERY',\n optimistic,\n });\n }\n\n // Make sure we compute the same (===) fragment query document every\n // time we receive the same fragment in readFragment.\n private getFragmentDoc = wrap(getFragmentQueryDocument);\n\n public readFragment<FragmentType, TVariables = any>(\n options: Cache.ReadFragmentOptions<FragmentType, TVariables>,\n optimistic = !!options.optimistic,\n ): FragmentType | null {\n return this.read({\n ...options,\n query: this.getFragmentDoc(options.fragment, options.fragmentName),\n rootId: options.id,\n optimistic,\n });\n }\n\n public writeQuery<TData = any, TVariables = any>({\n id,\n data,\n ...options\n }: Cache.WriteQueryOptions<TData, TVariables>): Reference | undefined {\n return this.write(Object.assign(options, {\n dataId: id || 'ROOT_QUERY',\n result: data,\n }));\n }\n\n public writeFragment<TData = any, TVariables = any>({\n id,\n data,\n fragment,\n fragmentName,\n ...options\n }: Cache.WriteFragmentOptions<TData, TVariables>): Reference | undefined {\n return this.write(Object.assign(options, {\n query: this.getFragmentDoc(fragment, fragmentName),\n dataId: id,\n result: data,\n }));\n }\n\n public updateQuery<TData = any, TVariables = any>(\n options: Cache.UpdateQueryOptions<TData, TVariables>,\n update: (data: TData | null) => TData | null | void,\n ): TData | null {\n return this.batch({\n update(cache) {\n const value = cache.readQuery<TData, TVariables>(options);\n const data = update(value);\n if (data === void 0 || data === null) return value;\n cache.writeQuery<TData, TVariables>({ ...options, data });\n return data;\n },\n });\n }\n\n public updateFragment<TData = any, TVariables = any>(\n options: Cache.UpdateFragmentOptions<TData, TVariables>,\n update: (data: TData | null) => TData | null | void,\n ): TData | null {\n return this.batch({\n update(cache) {\n const value = cache.readFragment<TData, TVariables>(options);\n const data = update(value);\n if (data === void 0 || data === null) return value;\n cache.writeFragment<TData, TVariables>({ ...options, data });\n return data;\n },\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/cache/core/cache.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAKhC,OAAO,EACL,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAMlC;IAAA;QACkB,2BAAsB,GAAY,KAAK,CAAC;QAkIhD,mBA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C,UAAU,uBAAyB,OAAO,KAAE,IAAI,MAAA,IAAG,CAAC;gBAC1D,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAEM,oCAAc,GAArB,UACE,OAAuD,EACvD,MAAmD;QAEnD,OAAO,IAAI,CAAC,KAAK,CAAC;YAChB,MAAM,YAAC,KAAK;gBACV,IAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAoB,OAAO,CAAC,CAAC;gBAC7D,IAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC3B,IAAI,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,KAAK,IAAI;oBAAE,OAAO,KAAK,CAAC;gBACnD,KAAK,CAAC,aAAa,uBAAyB,OAAO,KAAE,IAAI,MAAA,IAAG,CAAC;gBAC7D,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IACH,kBAAC;AAAD,CAAC,AAvMD,IAuMC","sourcesContent":["import type { DocumentNode } from 'graphql';\nimport { wrap } from 'optimism';\n\nimport type {\n StoreObject,\n Reference} from '../../utilities/index.js';\nimport {\n getFragmentQueryDocument,\n} from '../../utilities/index.js';\nimport type { DataProxy } from './types/DataProxy.js';\nimport type { Cache } from './types/Cache.js';\n\nexport type Transaction<T> = (c: ApolloCache<T>) => void;\n\nexport abstract class ApolloCache<TSerialized> implements DataProxy {\n public readonly assumeImmutableResults: boolean = false;\n\n // required to implement\n // core API\n public abstract read<TData = any, TVariables = any>(\n query: Cache.ReadOptions<TVariables, TData>,\n ): TData | null;\n public abstract write<TData = any, TVariables = any>(\n write: Cache.WriteOptions<TData, TVariables>,\n ): Reference | undefined;\n public abstract diff<T>(query: Cache.DiffOptions): Cache.DiffResult<T>;\n public abstract watch<TData = any, TVariables = any>(\n watch: Cache.WatchOptions<TData, TVariables>,\n ): () => void;\n\n // Empty the cache and restart all current watches (unless\n // options.discardWatches is true).\n public abstract reset(options?: Cache.ResetOptions): Promise<void>;\n\n // Remove whole objects from the cache by passing just options.id, or\n // specific fields by passing options.field and/or options.args. If no\n // options.args are provided, all fields matching options.field (even\n // those with arguments) will be removed. Returns true iff any data was\n // removed from the cache.\n public abstract evict(options: Cache.EvictOptions): boolean;\n\n // initializer / offline / ssr API\n /**\n * Replaces existing state in the cache (if any) with the values expressed by\n * `serializedState`.\n *\n * Called when hydrating a cache (server side rendering, or offline storage),\n * and also (potentially) during hot reloads.\n */\n public abstract restore(\n serializedState: TSerialized,\n ): ApolloCache<TSerialized>;\n\n /**\n * Exposes the cache's complete state, in a serializable format for later restoration.\n */\n public abstract extract(optimistic?: boolean): TSerialized;\n\n // Optimistic API\n\n public abstract removeOptimistic(id: string): void;\n\n // Transactional API\n\n // The batch method is intended to replace/subsume both performTransaction\n // and recordOptimisticTransaction, but performTransaction came first, so we\n // provide a default batch implementation that's just another way of calling\n // performTransaction. Subclasses of ApolloCache (such as InMemoryCache) can\n // override the batch method to do more interesting things with its options.\n public batch<U>(options: Cache.BatchOptions<this, U>): U {\n const optimisticId =\n typeof options.optimistic === \"string\" ? options.optimistic :\n options.optimistic === false ? null : void 0;\n let updateResult: U;\n this.performTransaction(\n () => updateResult = options.update(this),\n optimisticId,\n );\n return updateResult!;\n }\n\n public abstract performTransaction(\n transaction: Transaction<TSerialized>,\n // Although subclasses may implement recordOptimisticTransaction\n // however they choose, the default implementation simply calls\n // performTransaction with a string as the second argument, allowing\n // performTransaction to handle both optimistic and non-optimistic\n // (broadcast-batching) transactions. Passing null for optimisticId is\n // also allowed, and indicates that performTransaction should apply\n // the transaction non-optimistically (ignoring optimistic data).\n optimisticId?: string | null,\n ): void;\n\n public recordOptimisticTransaction(\n transaction: Transaction<TSerialized>,\n optimisticId: string,\n ) {\n this.performTransaction(transaction, optimisticId);\n }\n\n // Optional API\n\n // Called once per input document, allowing the cache to make static changes\n // to the query, such as adding __typename fields.\n public transformDocument(document: DocumentNode): DocumentNode {\n return document;\n }\n\n // Called before each ApolloLink request, allowing the cache to make dynamic\n // changes to the query, such as filling in missing fragment definitions.\n public transformForLink(document: DocumentNode): DocumentNode {\n return document;\n }\n\n public identify(object: StoreObject | Reference): string | undefined {\n return;\n }\n\n public gc(): string[] {\n return [];\n }\n\n public modify<Entity extends Record<string, any> = Record<string, any>>(options: Cache.ModifyOptions<Entity>): boolean {\n return false;\n }\n\n // DataProxy API\n /**\n *\n * @param options\n * @param optimistic\n */\n public readQuery<QueryType, TVariables = any>(\n options: Cache.ReadQueryOptions<QueryType, TVariables>,\n optimistic = !!options.optimistic,\n ): QueryType | null {\n return this.read({\n ...options,\n rootId: options.id || 'ROOT_QUERY',\n optimistic,\n });\n }\n\n // Make sure we compute the same (===) fragment query document every\n // time we receive the same fragment in readFragment.\n private getFragmentDoc = wrap(getFragmentQueryDocument);\n\n public readFragment<FragmentType, TVariables = any>(\n options: Cache.ReadFragmentOptions<FragmentType, TVariables>,\n optimistic = !!options.optimistic,\n ): FragmentType | null {\n return this.read({\n ...options,\n query: this.getFragmentDoc(options.fragment, options.fragmentName),\n rootId: options.id,\n optimistic,\n });\n }\n\n public writeQuery<TData = any, TVariables = any>({\n id,\n data,\n ...options\n }: Cache.WriteQueryOptions<TData, TVariables>): Reference | undefined {\n return this.write(Object.assign(options, {\n dataId: id || 'ROOT_QUERY',\n result: data,\n }));\n }\n\n public writeFragment<TData = any, TVariables = any>({\n id,\n data,\n fragment,\n fragmentName,\n ...options\n }: Cache.WriteFragmentOptions<TData, TVariables>): Reference | undefined {\n return this.write(Object.assign(options, {\n query: this.getFragmentDoc(fragment, fragmentName),\n dataId: id,\n result: data,\n }));\n }\n\n public updateQuery<TData = any, TVariables = any>(\n options: Cache.UpdateQueryOptions<TData, TVariables>,\n update: (data: TData | null) => TData | null | void,\n ): TData | null {\n return this.batch({\n update(cache) {\n const value = cache.readQuery<TData, TVariables>(options);\n const data = update(value);\n if (data === void 0 || data === null) return value;\n cache.writeQuery<TData, TVariables>({ ...options, data });\n return data;\n },\n });\n }\n\n public updateFragment<TData = any, TVariables = any>(\n options: Cache.UpdateFragmentOptions<TData, TVariables>,\n update: (data: TData | null) => TData | null | void,\n ): TData | null {\n return this.batch({\n update(cache) {\n const value = cache.readFragment<TData, TVariables>(options);\n const data = update(value);\n if (data === void 0 || data === null) return value;\n cache.writeFragment<TData, TVariables>({ ...options, data });\n return data;\n },\n });\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DataProxy } from './DataProxy';
|
|
2
|
-
import type { AllFieldsModifier, Modifiers } from './common';
|
|
3
|
-
import type { ApolloCache } from '../cache';
|
|
1
|
+
import { DataProxy } from './DataProxy.js';
|
|
2
|
+
import type { AllFieldsModifier, Modifiers } from './common.js';
|
|
3
|
+
import type { ApolloCache } from '../cache.js';
|
|
4
4
|
export declare namespace Cache {
|
|
5
5
|
type WatchCallback<TData = any> = (diff: Cache.DiffResult<TData>, lastDiff?: Cache.DiffResult<TData>) => void;
|
|
6
6
|
interface ReadOptions<TVariables = any, TData = any> extends DataProxy.Query<TVariables, TData> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../../../src/cache/core/types/Cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../../../src/cache/core/types/Cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,yBAAiB,KAAK,CAAC;IACrB,KAAY,aAAa,CAAC,KAAK,GAAG,GAAG,IAAI,CACvC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,EAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,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AAG,SAAS,CAAC,kBAAkB,CAAC;IAChE,MAAM,QAAQ,qBAAqB,GAAG,SAAS,CAAC,qBAAqB,CAAC;IACtE,MAAM,QAAQ,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;CAC7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../../../src/cache/core/types/Cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Cache.js","sourceRoot":"","sources":["../../../../src/cache/core/types/Cache.ts"],"names":[],"mappings":"AACgE,CAAC;AAGjE,MAAM,KAAW,KAAK,CA0GrB;AA1GD,WAAiB,KAAK;AA0GtB,CAAC,EA1GgB,KAAK,KAAL,KAAK,QA0GrB","sourcesContent":["import { DataProxy } from './DataProxy.js';\nimport type { AllFieldsModifier, Modifiers } from './common.js';;\nimport type { ApolloCache } from '../cache.js';\n\nexport namespace Cache {\n export type WatchCallback<TData = any> = (\n diff: Cache.DiffResult<TData>,\n lastDiff?: Cache.DiffResult<TData>,\n ) => void;\n\n export interface ReadOptions<TVariables = any, TData = any>\n extends DataProxy.Query<TVariables, TData> {\n rootId?: string;\n previousResult?: any;\n optimistic: boolean;\n returnPartialData?: boolean;\n canonizeResults?: boolean;\n }\n\n export interface WriteOptions<TResult = any, TVariables = any>\n extends Omit<DataProxy.Query<TVariables, TResult>, \"id\">,\n Omit<DataProxy.WriteOptions<TResult>, \"data\">\n {\n dataId?: string;\n result: TResult;\n }\n\n export interface DiffOptions<\n TData = any,\n TVariables = any,\n > extends Omit<ReadOptions<TVariables, TData>, \"rootId\"> {\n // The DiffOptions interface is currently just an alias for\n // ReadOptions, though DiffOptions used to be responsible for\n // declaring the returnPartialData option.\n }\n\n export interface WatchOptions<\n TData = any,\n TVariables = any,\n > extends DiffOptions<TData, TVariables> {\n watcher?: object;\n immediate?: boolean;\n callback: WatchCallback<TData>;\n lastDiff?: DiffResult<TData>;\n }\n\n export interface EvictOptions {\n id?: string;\n fieldName?: string;\n args?: Record<string, any>;\n broadcast?: boolean;\n }\n\n // Although you can call cache.reset() without options, its behavior can be\n // configured by passing a Cache.ResetOptions object.\n export interface ResetOptions {\n discardWatches?: boolean;\n }\n\n export interface ModifyOptions<Entity extends Record<string, any> = Record<string, any>> {\n id?: string;\n fields: Modifiers<Entity> | AllFieldsModifier<Entity>;\n optimistic?: boolean;\n broadcast?: boolean;\n }\n\n export interface BatchOptions<\n TCache extends ApolloCache<any>,\n TUpdateResult = void,\n > {\n // Same as the first parameter of performTransaction, except the cache\n // argument will have the subclass type rather than ApolloCache.\n update(cache: TCache): TUpdateResult;\n\n // Passing a string for this option creates a new optimistic layer, with the\n // given string as its layer.id, just like passing a string for the\n // optimisticId parameter of performTransaction. Passing true is the same as\n // passing undefined to performTransaction (running the batch operation\n // against the current top layer of the cache), and passing false is the\n // same as passing null (running the operation against root/non-optimistic\n // cache data).\n optimistic?: string | boolean;\n\n // If you specify the ID of an optimistic layer using this option, that\n // layer will be removed as part of the batch transaction, triggering at\n // most one broadcast for both the transaction and the removal of the layer.\n // Note: this option is needed because calling cache.removeOptimistic during\n // the transaction function may not be not safe, since any modifications to\n // cache layers may be discarded after the transaction finishes.\n removeOptimistic?: string;\n\n // If you want to find out which watched queries were invalidated during\n // this batch operation, pass this optional callback function. Returning\n // false from the callback will prevent broadcasting this result.\n onWatchUpdated?: (\n this: TCache,\n watch: Cache.WatchOptions,\n diff: Cache.DiffResult<any>,\n lastDiff: Cache.DiffResult<any> | undefined,\n ) => any;\n }\n\n export import DiffResult = DataProxy.DiffResult;\n export import ReadQueryOptions = DataProxy.ReadQueryOptions;\n export import ReadFragmentOptions = DataProxy.ReadFragmentOptions;\n export import WriteQueryOptions = DataProxy.WriteQueryOptions;\n export import WriteFragmentOptions = DataProxy.WriteFragmentOptions;\n export import UpdateQueryOptions = DataProxy.UpdateQueryOptions;\n export import UpdateFragmentOptions = DataProxy.UpdateFragmentOptions;\n export import Fragment = DataProxy.Fragment;\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DocumentNode } from 'graphql';
|
|
2
2
|
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
3
|
-
import type { MissingFieldError } from './common';
|
|
4
|
-
import type { Reference } from '../../../utilities';
|
|
3
|
+
import type { MissingFieldError } from './common.js';
|
|
4
|
+
import type { Reference } from '../../../utilities/index.js';
|
|
5
5
|
export declare namespace DataProxy {
|
|
6
6
|
interface Query<TVariables, TData> {
|
|
7
7
|
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataProxy.d.ts","sourceRoot":"","sources":["../../../../src/cache/core/types/DataProxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"DataProxy.d.ts","sourceRoot":"","sources":["../../../../src/cache/core/types/DataProxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D,yBAAiB,SAAS,CAAC;IACzB,UAAiB,KAAK,CAAC,UAAU,EAAE,KAAK;QAMtC,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAK3D,SAAS,CAAC,EAAE,UAAU,CAAC;QAOvB,EAAE,CAAC,EAAE,MAAM,CAAC;KACb;IAED,UAAiB,QAAQ,CAAC,UAAU,EAAE,KAAK;QAMzC,EAAE,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AAC,KAAK,EAAE,UAAU,CACtD,SAAQ,IAAI,CAAC,CACX,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,GACtC,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,CACxC,EAAE,MAAM,CAAC;KAAG;IAEf,KAAY,UAAU,CAAC,CAAC,IAAI;QAC1B,MAAM,CAAC,EAAE,CAAC,CAAC;QACX,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;QAC9B,yBAAyB,CAAC,EAAE,OAAO,CAAC;KACrC,CAAA;CACF;AAQD,MAAM,WAAW,SAAS;IAIxB,SAAS,CAAC,SAAS,EAAE,UAAU,GAAG,GAAG,EACnC,OAAO,EAAE,SAAS,CAAC,gBAAgB,CAAC,SAAS,EAAE,UAAU,CAAC,EAC1D,UAAU,CAAC,EAAE,OAAO,GACnB,SAAS,GAAG,IAAI,CAAC;IAOpB,YAAY,CAAC,YAAY,EAAE,UAAU,GAAG,GAAG,EACzC,OAAO,EAAE,SAAS,CAAC,mBAAmB,CAAC,YAAY,EAAE,UAAU,CAAC,EAChE,UAAU,CAAC,EAAE,OAAO,GACnB,YAAY,GAAG,IAAI,CAAC;IAKvB,UAAU,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,EACtC,OAAO,EAAE,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,GACtD,SAAS,GAAG,SAAS,CAAC;IAOzB,aAAa,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,EACzC,OAAO,EAAE,SAAS,CAAC,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,GACzD,SAAS,GAAG,SAAS,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataProxy.js","sourceRoot":"","sources":["../../../../src/cache/core/types/DataProxy.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode } from 'graphql'; // ignore-comment eslint-disable-line import/no-extraneous-dependencies, import/no-unresolved\nimport type { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport type { MissingFieldError } from './common';\nimport type { Reference } from '../../../utilities';\n\nexport namespace DataProxy {\n export interface Query<TVariables, TData> {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag from `graphql-tag`. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n /**\n * The root id to be used. Defaults to \"ROOT_QUERY\", which is the ID of the\n * root query object. This property makes writeQuery capable of writing data\n * to any object in the cache.\n */\n id?: string;\n }\n\n export interface Fragment<TVariables, TData> {\n /**\n * The root id to be used. This id should take the same form as the\n * value returned by your `dataIdFromObject` function. If a value with your\n * id does not exist in the store, `null` will be returned.\n */\n id?: string;\n\n /**\n * A GraphQL document created using the `gql` template string tag from\n * `graphql-tag` with one or more fragments which will be used to determine\n * the shape of data to read. If you provide more than one fragment in this\n * document then you must also specify `fragmentName` to select a single.\n */\n fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * The name of the fragment in your GraphQL document to be used. If you do\n * not provide a `fragmentName` and there is only one fragment in your\n * `fragment` document then that fragment will be used.\n */\n fragmentName?: string;\n\n /**\n * Any variables that your GraphQL fragments depend on.\n */\n variables?: TVariables;\n }\n\n export interface ReadQueryOptions<TData, TVariables>\n extends Query<TVariables, TData> {\n /**\n * Whether to return incomplete data rather than null.\n * Defaults to false.\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted. Defaults to false.\n */\n optimistic?: boolean;\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n }\n\n export interface ReadFragmentOptions<TData, TVariables>\n extends Fragment<TVariables, TData> {\n /**\n * Whether to return incomplete data rather than null.\n * Defaults to false.\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted. Defaults to false.\n */\n optimistic?: boolean;\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n }\n\n export interface WriteOptions<TData> {\n /**\n * The data you will be writing to the store.\n */\n data: TData;\n /**\n * Whether to notify query watchers (default: true).\n */\n broadcast?: boolean;\n /**\n * When true, ignore existing field data rather than merging it with\n * incoming data (default: false).\n */\n overwrite?: boolean;\n }\n\n export interface WriteQueryOptions<TData, TVariables>\n extends Query<TVariables, TData>, WriteOptions<TData> {}\n\n export interface WriteFragmentOptions<TData, TVariables>\n extends Fragment<TVariables, TData>, WriteOptions<TData> {}\n\n export interface UpdateQueryOptions<TData, TVariables>\n extends Omit<(\n ReadQueryOptions<TData, TVariables> &\n WriteQueryOptions<TData, TVariables>\n ), 'data'> {}\n\n export interface UpdateFragmentOptions<TData, TVariables>\n extends Omit<(\n ReadFragmentOptions<TData, TVariables> &\n WriteFragmentOptions<TData, TVariables>\n ), 'data'> {}\n\n export type DiffResult<T> = {\n result?: T;\n complete?: boolean;\n missing?: MissingFieldError[];\n fromOptimisticTransaction?: boolean;\n }\n}\n\n/**\n * A proxy to the normalized data living in our store. This interface allows a\n * user to read and write denormalized data which feels natural to the user\n * whilst in the background this data is being converted into the normalized\n * store format.\n */\nexport interface DataProxy {\n /**\n * Reads a GraphQL query from the root query id.\n */\n readQuery<QueryType, TVariables = any>(\n options: DataProxy.ReadQueryOptions<QueryType, TVariables>,\n optimistic?: boolean,\n ): QueryType | null;\n\n /**\n * Reads a GraphQL fragment from any arbitrary id. If there is more than\n * one fragment in the provided document then a `fragmentName` must be\n * provided to select the correct fragment.\n */\n readFragment<FragmentType, TVariables = any>(\n options: DataProxy.ReadFragmentOptions<FragmentType, TVariables>,\n optimistic?: boolean,\n ): FragmentType | null;\n\n /**\n * Writes a GraphQL query to the root query id.\n */\n writeQuery<TData = any, TVariables = any>(\n options: DataProxy.WriteQueryOptions<TData, TVariables>,\n ): Reference | undefined;\n\n /**\n * Writes a GraphQL fragment to any arbitrary id. If there is more than\n * one fragment in the provided document then a `fragmentName` must be\n * provided to select the correct fragment.\n */\n writeFragment<TData = any, TVariables = any>(\n options: DataProxy.WriteFragmentOptions<TData, TVariables>,\n ): Reference | undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DataProxy.js","sourceRoot":"","sources":["../../../../src/cache/core/types/DataProxy.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode } from 'graphql'; // ignore-comment eslint-disable-line import/no-extraneous-dependencies, import/no-unresolved\nimport type { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport type { MissingFieldError } from './common.js';\nimport type { Reference } from '../../../utilities/index.js';\n\nexport namespace DataProxy {\n export interface Query<TVariables, TData> {\n /**\n * The GraphQL query shape to be used constructed using the `gql` template\n * string tag from `graphql-tag`. The query will be used to determine the\n * shape of the data to be read.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Any variables that the GraphQL query may depend on.\n */\n variables?: TVariables;\n\n /**\n * The root id to be used. Defaults to \"ROOT_QUERY\", which is the ID of the\n * root query object. This property makes writeQuery capable of writing data\n * to any object in the cache.\n */\n id?: string;\n }\n\n export interface Fragment<TVariables, TData> {\n /**\n * The root id to be used. This id should take the same form as the\n * value returned by your `dataIdFromObject` function. If a value with your\n * id does not exist in the store, `null` will be returned.\n */\n id?: string;\n\n /**\n * A GraphQL document created using the `gql` template string tag from\n * `graphql-tag` with one or more fragments which will be used to determine\n * the shape of data to read. If you provide more than one fragment in this\n * document then you must also specify `fragmentName` to select a single.\n */\n fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * The name of the fragment in your GraphQL document to be used. If you do\n * not provide a `fragmentName` and there is only one fragment in your\n * `fragment` document then that fragment will be used.\n */\n fragmentName?: string;\n\n /**\n * Any variables that your GraphQL fragments depend on.\n */\n variables?: TVariables;\n }\n\n export interface ReadQueryOptions<TData, TVariables>\n extends Query<TVariables, TData> {\n /**\n * Whether to return incomplete data rather than null.\n * Defaults to false.\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted. Defaults to false.\n */\n optimistic?: boolean;\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n }\n\n export interface ReadFragmentOptions<TData, TVariables>\n extends Fragment<TVariables, TData> {\n /**\n * Whether to return incomplete data rather than null.\n * Defaults to false.\n */\n returnPartialData?: boolean;\n /**\n * Whether to read from optimistic or non-optimistic cache data. If\n * this named option is provided, the optimistic parameter of the\n * readQuery method can be omitted. Defaults to false.\n */\n optimistic?: boolean;\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n }\n\n export interface WriteOptions<TData> {\n /**\n * The data you will be writing to the store.\n */\n data: TData;\n /**\n * Whether to notify query watchers (default: true).\n */\n broadcast?: boolean;\n /**\n * When true, ignore existing field data rather than merging it with\n * incoming data (default: false).\n */\n overwrite?: boolean;\n }\n\n export interface WriteQueryOptions<TData, TVariables>\n extends Query<TVariables, TData>, WriteOptions<TData> {}\n\n export interface WriteFragmentOptions<TData, TVariables>\n extends Fragment<TVariables, TData>, WriteOptions<TData> {}\n\n export interface UpdateQueryOptions<TData, TVariables>\n extends Omit<(\n ReadQueryOptions<TData, TVariables> &\n WriteQueryOptions<TData, TVariables>\n ), 'data'> {}\n\n export interface UpdateFragmentOptions<TData, TVariables>\n extends Omit<(\n ReadFragmentOptions<TData, TVariables> &\n WriteFragmentOptions<TData, TVariables>\n ), 'data'> {}\n\n export type DiffResult<T> = {\n result?: T;\n complete?: boolean;\n missing?: MissingFieldError[];\n fromOptimisticTransaction?: boolean;\n }\n}\n\n/**\n * A proxy to the normalized data living in our store. This interface allows a\n * user to read and write denormalized data which feels natural to the user\n * whilst in the background this data is being converted into the normalized\n * store format.\n */\nexport interface DataProxy {\n /**\n * Reads a GraphQL query from the root query id.\n */\n readQuery<QueryType, TVariables = any>(\n options: DataProxy.ReadQueryOptions<QueryType, TVariables>,\n optimistic?: boolean,\n ): QueryType | null;\n\n /**\n * Reads a GraphQL fragment from any arbitrary id. If there is more than\n * one fragment in the provided document then a `fragmentName` must be\n * provided to select the correct fragment.\n */\n readFragment<FragmentType, TVariables = any>(\n options: DataProxy.ReadFragmentOptions<FragmentType, TVariables>,\n optimistic?: boolean,\n ): FragmentType | null;\n\n /**\n * Writes a GraphQL query to the root query id.\n */\n writeQuery<TData = any, TVariables = any>(\n options: DataProxy.WriteQueryOptions<TData, TVariables>,\n ): Reference | undefined;\n\n /**\n * Writes a GraphQL fragment to any arbitrary id. If there is more than\n * one fragment in the provided document then a `fragmentName` must be\n * provided to select the correct fragment.\n */\n writeFragment<TData = any, TVariables = any>(\n options: DataProxy.WriteFragmentOptions<TData, TVariables>,\n ): Reference | undefined;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DocumentNode, FieldNode } from 'graphql';
|
|
2
|
-
import type { Reference, StoreObject, StoreValue, isReference } from '../../../utilities';
|
|
3
|
-
import type { StorageType } from '../../inmemory/policies';
|
|
2
|
+
import type { Reference, StoreObject, StoreValue, isReference } from '../../../utilities/index.js';
|
|
3
|
+
import type { StorageType } from '../../inmemory/policies.js';
|
|
4
4
|
export type SafeReadonly<T> = T extends object ? Readonly<T> : T;
|
|
5
5
|
export type MissingTree = string | {
|
|
6
6
|
readonly [key: string]: MissingTree;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/cache/core/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEvD,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,UAAU,EACV,WAAW,EACZ,MAAM,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/cache/core/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEvD,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,UAAU,EACV,WAAW,EACZ,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAS9D,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAEjE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IACjC,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;CACrC,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,KAAK;aAExB,OAAO,EAAE,MAAM;aACf,IAAI,EAAE,WAAW,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;aAC1C,KAAK,EAAE,YAAY;aACnB,SAAS,CAAC;gBAHV,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,WAAW,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC1C,KAAK,EAAE,YAAY,EACnB,SAAS,CAAC,iCAAqB;IAmBjD,SAAgB,OAAO,EAAE,WAAW,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAA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AK,GAAL,KAAK,CAAc;QACnB,eAAS,GAAT,SAAS,CAAsB;QAK/C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAI,CAAC,IAAI,CAAC,EAAE;YAC5B,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,OAAO,CAAC;YAC5B,KAAK,IAAI,CAAC,GAAG,KAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE;gBAC9C,KAAI,CAAC,OAAO,aAAK,GAAC,KAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAG,KAAI,CAAC,OAAO,KAAE,CAAC;aACjD;SACF;aAAM;YACL,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,IAAI,CAAC;SAC1B;QAIA,KAAY,CAAC,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC;;IACxD,CAAC;IAGH,wBAAC;AAAD,CAAC,AAzBD,CAAuC,KAAK,GAyB3C","sourcesContent":["import type { DocumentNode, FieldNode } from 'graphql';\n\nimport type {\n Reference,\n StoreObject,\n StoreValue,\n isReference,\n} from '../../../utilities';\n\nimport type { StorageType } from '../../inmemory/policies';\n\n// The Readonly<T> type only really works for object types, since it marks\n// all of the object's properties as readonly, but there are many cases when\n// a generic type parameter like TExisting might be a string or some other\n// primitive type, in which case we need to avoid wrapping it with Readonly.\n// SafeReadonly<string> collapses to just string, which makes string\n// assignable to SafeReadonly<any>, whereas string is not assignable to\n// Readonly<any>, somewhat surprisingly.\nexport type SafeReadonly<T> = T extends object ? Readonly<T> : T;\n\nexport type MissingTree = string | {\n readonly [key: string]: MissingTree;\n};\n\nexport class MissingFieldError extends Error {\n constructor(\n public readonly message: string,\n public readonly path: MissingTree | Array<string | number>,\n public readonly query: DocumentNode,\n public readonly variables?: Record<string, any>,\n ) {\n // 'Error' breaks prototype chain here\n super(message);\n\n if (Array.isArray(this.path)) {\n this.missing = this.message;\n for (let i = this.path.length - 1; i >= 0; --i) {\n this.missing = { [this.path[i]]: this.missing };\n }\n } else {\n this.missing = this.path;\n }\n\n // We're not using `Object.setPrototypeOf` here as it isn't fully supported\n // on Android (see issue #3236).\n (this as any).__proto__ = MissingFieldError.prototype;\n }\n\n public readonly missing: MissingTree;\n}\n\nexport interface FieldSpecifier {\n typename?: string;\n fieldName: string;\n field?: FieldNode;\n args?: Record<string, any>;\n variables?: Record<string, any>;\n}\n\nexport interface ReadFieldOptions extends FieldSpecifier {\n from?: StoreObject | Reference;\n}\n\nexport interface ReadFieldFunction {\n <V = StoreValue>(options: ReadFieldOptions): SafeReadonly<V> | undefined;\n <V = StoreValue>(\n fieldName: string,\n from?: StoreObject | Reference,\n ): SafeReadonly<V> | undefined;\n}\n\nexport type ToReferenceFunction = (\n objOrIdOrRef: StoreObject | string | Reference,\n mergeIntoStore?: boolean,\n) => Reference | undefined;\n\nexport type CanReadFunction = (value: StoreValue) => boolean;\n\ndeclare const _deleteModifier: unique symbol;\nexport interface DeleteModifier { [_deleteModifier]: true }\ndeclare const _invalidateModifier: unique symbol;\nexport interface InvalidateModifier { [_invalidateModifier]: true}\n\nexport type ModifierDetails = {\n DELETE: DeleteModifier;\n INVALIDATE: InvalidateModifier;\n fieldName: string;\n storeFieldName: string;\n readField: ReadFieldFunction;\n canRead: CanReadFunction;\n isReference: typeof isReference;\n toReference: ToReferenceFunction;\n storage: StorageType;\n}\n\nexport type Modifier<T> = (\n value: T,\n details: ModifierDetails\n) => T | DeleteModifier | InvalidateModifier;\n\ntype StoreObjectValueMaybeReference<StoreVal>
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/cache/core/types/common.ts"],"names":[],"mappings":";AAwBA;IAAuC,qCAAK;IAC1C,2BACkB,OAAe,EACf,IAA0C,EAC1C,KAAmB,EACnB,SAA+B;;QAJjD,YAOE,kBAAM,OAAO,CAAC,SAcf;QApBiB,aAAO,GAAP,OAAO,CAAQ;QACf,UAAI,GAAJ,IAAI,CAAsC;QAC1C,WAAK,GAAL,KAAK,CAAc;QACnB,eAAS,GAAT,SAAS,CAAsB;QAK/C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAI,CAAC,IAAI,CAAC,EAAE;YAC5B,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,OAAO,CAAC;YAC5B,KAAK,IAAI,CAAC,GAAG,KAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE;gBAC9C,KAAI,CAAC,OAAO,aAAK,GAAC,KAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAG,KAAI,CAAC,OAAO,KAAE,CAAC;aACjD;SACF;aAAM;YACL,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,IAAI,CAAC;SAC1B;QAIA,KAAY,CAAC,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC;;IACxD,CAAC;IAGH,wBAAC;AAAD,CAAC,AAzBD,CAAuC,KAAK,GAyB3C","sourcesContent":["import type { DocumentNode, FieldNode } from 'graphql';\n\nimport type {\n Reference,\n StoreObject,\n StoreValue,\n isReference,\n} from '../../../utilities/index.js';\n\nimport type { StorageType } from '../../inmemory/policies.js';\n\n// The Readonly<T> type only really works for object types, since it marks\n// all of the object's properties as readonly, but there are many cases when\n// a generic type parameter like TExisting might be a string or some other\n// primitive type, in which case we need to avoid wrapping it with Readonly.\n// SafeReadonly<string> collapses to just string, which makes string\n// assignable to SafeReadonly<any>, whereas string is not assignable to\n// Readonly<any>, somewhat surprisingly.\nexport type SafeReadonly<T> = T extends object ? Readonly<T> : T;\n\nexport type MissingTree = string | {\n readonly [key: string]: MissingTree;\n};\n\nexport class MissingFieldError extends Error {\n constructor(\n public readonly message: string,\n public readonly path: MissingTree | Array<string | number>,\n public readonly query: DocumentNode,\n public readonly variables?: Record<string, any>,\n ) {\n // 'Error' breaks prototype chain here\n super(message);\n\n if (Array.isArray(this.path)) {\n this.missing = this.message;\n for (let i = this.path.length - 1; i >= 0; --i) {\n this.missing = { [this.path[i]]: this.missing };\n }\n } else {\n this.missing = this.path;\n }\n\n // We're not using `Object.setPrototypeOf` here as it isn't fully supported\n // on Android (see issue #3236).\n (this as any).__proto__ = MissingFieldError.prototype;\n }\n\n public readonly missing: MissingTree;\n}\n\nexport interface FieldSpecifier {\n typename?: string;\n fieldName: string;\n field?: FieldNode;\n args?: Record<string, any>;\n variables?: Record<string, any>;\n}\n\nexport interface ReadFieldOptions extends FieldSpecifier {\n from?: StoreObject | Reference;\n}\n\nexport interface ReadFieldFunction {\n <V = StoreValue>(options: ReadFieldOptions): SafeReadonly<V> | undefined;\n <V = StoreValue>(\n fieldName: string,\n from?: StoreObject | Reference,\n ): SafeReadonly<V> | undefined;\n}\n\nexport type ToReferenceFunction = (\n objOrIdOrRef: StoreObject | string | Reference,\n mergeIntoStore?: boolean,\n) => Reference | undefined;\n\nexport type CanReadFunction = (value: StoreValue) => boolean;\n\ndeclare const _deleteModifier: unique symbol;\nexport interface DeleteModifier { [_deleteModifier]: true }\ndeclare const _invalidateModifier: unique symbol;\nexport interface InvalidateModifier { [_invalidateModifier]: true}\n\nexport type ModifierDetails = {\n DELETE: DeleteModifier;\n INVALIDATE: InvalidateModifier;\n fieldName: string;\n storeFieldName: string;\n readField: ReadFieldFunction;\n canRead: CanReadFunction;\n isReference: typeof isReference;\n toReference: ToReferenceFunction;\n storage: StorageType;\n}\n\nexport type Modifier<T> = (\n value: T,\n details: ModifierDetails\n) => T | DeleteModifier | InvalidateModifier;\n\ntype StoreObjectValueMaybeReference<StoreVal> =\n StoreVal extends Record<string, any>[]\n ? Readonly<StoreVal> | readonly Reference[]\n : StoreVal extends Record<string, any>\n ? StoreVal | Reference\n : StoreVal;\n\nexport type AllFieldsModifier<\n Entity extends Record<string, any>\n> = Modifier<Entity[keyof Entity] extends infer Value ?\n StoreObjectValueMaybeReference<Exclude<Value, undefined>>\n : never>;\n\nexport type Modifiers<\n T extends Record<string, any> = Record<string, unknown>\n> = Partial<{\n [FieldName in keyof T]: Modifier<\n StoreObjectValueMaybeReference<Exclude<T[FieldName], undefined>>\n >;\n}>;\n"]}
|
package/cache/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import '../utilities/globals';
|
|
2
|
-
export { Transaction, ApolloCache } from './core/cache';
|
|
3
|
-
export { Cache } from './core/types/Cache';
|
|
4
|
-
export { DataProxy } from './core/types/DataProxy';
|
|
5
|
-
export { MissingTree, Modifier, Modifiers, ModifierDetails, MissingFieldError, ReadFieldOptions } from './core/types/common';
|
|
6
|
-
export { Reference, isReference, makeReference, } from '../utilities';
|
|
7
|
-
export { EntityStore } from './inmemory/entityStore';
|
|
8
|
-
export { fieldNameFromStoreName, defaultDataIdFromObject, } from './inmemory/helpers';
|
|
9
|
-
export { InMemoryCache, } from './inmemory/inMemoryCache';
|
|
10
|
-
export { ReactiveVar, makeVar, cacheSlot, } from './inmemory/reactiveVars';
|
|
11
|
-
export { TypePolicies, TypePolicy, FieldPolicy, FieldReadFunction, FieldMergeFunction, FieldFunctionOptions, PossibleTypesMap, Policies, } from './inmemory/policies';
|
|
12
|
-
export { canonicalStringify, } from './inmemory/object-canon';
|
|
13
|
-
export { FragmentRegistryAPI, createFragmentRegistry, } from './inmemory/fragmentRegistry';
|
|
14
|
-
export * from './inmemory/types';
|
|
1
|
+
import '../utilities/globals/index.js';
|
|
2
|
+
export { Transaction, ApolloCache } from './core/cache.js';
|
|
3
|
+
export { Cache } from './core/types/Cache.js';
|
|
4
|
+
export { DataProxy } from './core/types/DataProxy.js';
|
|
5
|
+
export { MissingTree, Modifier, Modifiers, ModifierDetails, MissingFieldError, ReadFieldOptions } from './core/types/common.js';
|
|
6
|
+
export { Reference, isReference, makeReference, } from '../utilities/index.js';
|
|
7
|
+
export { EntityStore } from './inmemory/entityStore.js';
|
|
8
|
+
export { fieldNameFromStoreName, defaultDataIdFromObject, } from './inmemory/helpers.js';
|
|
9
|
+
export { InMemoryCache, } from './inmemory/inMemoryCache.js';
|
|
10
|
+
export { ReactiveVar, makeVar, cacheSlot, } from './inmemory/reactiveVars.js';
|
|
11
|
+
export { TypePolicies, TypePolicy, FieldPolicy, FieldReadFunction, FieldMergeFunction, FieldFunctionOptions, PossibleTypesMap, Policies, } from './inmemory/policies.js';
|
|
12
|
+
export { canonicalStringify, } from './inmemory/object-canon.js';
|
|
13
|
+
export { FragmentRegistryAPI, createFragmentRegistry, } from './inmemory/fragmentRegistry.js';
|
|
14
|
+
export * from './inmemory/types.js';
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
package/cache/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EACL,WAAW,EACX,QAAQ,EACR,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,SAAS,EACT,WAAW,EACX,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EACL,aAAa,GACd,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,WAAW,EACX,OAAO,EACP,SAAS,GACV,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,QAAQ,GACT,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,gCAAgC,CAAC;AAExC,cAAc,qBAAqB,CAAC"}
|
package/cache/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { ApolloCache } from
|
|
3
|
-
export { Cache } from
|
|
4
|
-
export { MissingFieldError } from
|
|
5
|
-
export { isReference, makeReference, } from
|
|
6
|
-
export { EntityStore } from
|
|
7
|
-
export { fieldNameFromStoreName, defaultDataIdFromObject, } from
|
|
8
|
-
export { InMemoryCache, } from
|
|
9
|
-
export { makeVar, cacheSlot, } from
|
|
10
|
-
export { Policies, } from
|
|
11
|
-
export { canonicalStringify, } from
|
|
12
|
-
export { createFragmentRegistry, } from
|
|
13
|
-
export * from
|
|
1
|
+
import '../utilities/globals/index.js';
|
|
2
|
+
export { ApolloCache } from './core/cache.js';
|
|
3
|
+
export { Cache } from './core/types/Cache.js';
|
|
4
|
+
export { MissingFieldError } from './core/types/common.js';
|
|
5
|
+
export { isReference, makeReference, } from '../utilities/index.js';
|
|
6
|
+
export { EntityStore } from './inmemory/entityStore.js';
|
|
7
|
+
export { fieldNameFromStoreName, defaultDataIdFromObject, } from './inmemory/helpers.js';
|
|
8
|
+
export { InMemoryCache, } from './inmemory/inMemoryCache.js';
|
|
9
|
+
export { makeVar, cacheSlot, } from './inmemory/reactiveVars.js';
|
|
10
|
+
export { Policies, } from './inmemory/policies.js';
|
|
11
|
+
export { canonicalStringify, } from './inmemory/object-canon.js';
|
|
12
|
+
export { createFragmentRegistry, } from './inmemory/fragmentRegistry.js';
|
|
13
|
+
export * from './inmemory/types.js';
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/cache/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAC;AAEvC,OAAO,EAAe,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAKL,iBAAiB,EAElB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAEL,WAAW,EACX,aAAa,GACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EACL,aAAa,GACd,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,OAAO,EACP,SAAS,GACV,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAQL,QAAQ,GACT,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAEL,sBAAsB,GACvB,MAAM,gCAAgC,CAAC;AAExC,cAAc,qBAAqB,CAAC","sourcesContent":["import '../utilities/globals/index.js';\n\nexport { Transaction, ApolloCache } from './core/cache.js';\nexport { Cache } from './core/types/Cache.js';\nexport { DataProxy } from './core/types/DataProxy.js';\nexport {\n MissingTree,\n Modifier,\n Modifiers,\n ModifierDetails,\n MissingFieldError,\n ReadFieldOptions\n} from './core/types/common.js';\n\nexport {\n Reference,\n isReference,\n makeReference,\n} from '../utilities/index.js';\n\nexport { EntityStore } from './inmemory/entityStore.js';\nexport {\n fieldNameFromStoreName,\n defaultDataIdFromObject,\n} from './inmemory/helpers.js'\n\nexport {\n InMemoryCache,\n} from './inmemory/inMemoryCache.js';\n\nexport {\n ReactiveVar,\n makeVar,\n cacheSlot,\n} from './inmemory/reactiveVars.js';\n\nexport {\n TypePolicies,\n TypePolicy,\n FieldPolicy,\n FieldReadFunction,\n FieldMergeFunction,\n FieldFunctionOptions,\n PossibleTypesMap,\n Policies,\n} from './inmemory/policies.js';\n\nexport {\n canonicalStringify,\n} from './inmemory/object-canon.js';\n\nexport {\n FragmentRegistryAPI,\n createFragmentRegistry,\n} from './inmemory/fragmentRegistry.js';\n\nexport * from './inmemory/types.js';\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Trie } from '@wry/trie';
|
|
2
|
-
import type { StoreValue, StoreObject, Reference } from '../../utilities';
|
|
3
|
-
import type { NormalizedCache, NormalizedCacheObject } from './types';
|
|
4
|
-
import type { Policies, StorageType } from './policies';
|
|
5
|
-
import type { Cache } from '../core/types/Cache';
|
|
6
|
-
import type { SafeReadonly, Modifier, Modifiers, ToReferenceFunction, CanReadFunction } from '../core/types/common';
|
|
2
|
+
import type { StoreValue, StoreObject, Reference } from '../../utilities/index.js';
|
|
3
|
+
import type { NormalizedCache, NormalizedCacheObject } from './types.js';
|
|
4
|
+
import type { Policies, StorageType } from './policies.js';
|
|
5
|
+
import type { Cache } from '../core/types/Cache.js';
|
|
6
|
+
import type { SafeReadonly, Modifier, Modifiers, ToReferenceFunction, CanReadFunction } from '../core/types/common.js';
|
|
7
7
|
export declare abstract class EntityStore implements NormalizedCache {
|
|
8
8
|
readonly policies: Policies;
|
|
9
9
|
readonly group: CacheGroup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityStore.d.ts","sourceRoot":"","sources":["../../../src/cache/inmemory/entityStore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,SAAS,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"entityStore.d.ts","sourceRoot":"","sources":["../../../src/cache/inmemory/entityStore.ts"],"names":[],"m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IAQrD,UAAU,IAAI,WAAW;CAKjC;AAMD,cAAM,KAAM,SAAQ,KAAK;gBACX,IAAI,EAAE,WAAW,CAAC,IAAI;IAS3B,WAAW;IAKX,KAAK;CAQb;AAiBD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW,CAGtE"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __assign, __extends, __rest } from "tslib";
|
|
2
|
-
import { invariant } from
|
|
2
|
+
import { invariant } from '../../utilities/globals/index.js';
|
|
3
3
|
import { dep } from 'optimism';
|
|
4
4
|
import { equal } from '@wry/equality';
|
|
5
5
|
import { Trie } from '@wry/trie';
|
|
6
|
-
import { isReference, makeReference, DeepMerger, maybeDeepFreeze, canUseWeakMap, isNonNullObject, } from
|
|
7
|
-
import { hasOwn, fieldNameFromStoreName } from
|
|
6
|
+
import { isReference, makeReference, DeepMerger, maybeDeepFreeze, canUseWeakMap, isNonNullObject, } from '../../utilities/index.js';
|
|
7
|
+
import { hasOwn, fieldNameFromStoreName } from './helpers.js';
|
|
8
8
|
var DELETE = Object.create(null);
|
|
9
9
|
var delModifier = function () { return DELETE; };
|
|
10
10
|
var INVALIDATE = Object.create(null);
|