@apollo/client 3.8.7 → 3.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +14 -0
- package/CHANGELOG.md +3357 -0
- package/apollo-client.cjs +314 -316
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +133 -152
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +133 -152
- package/cache/core/cache.d.ts +10 -0
- package/cache/core/cache.js +17 -5
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +1 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +92 -0
- package/cache/core/types/common.js +4 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.js +190 -29
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fixPolyfills.js +9 -0
- package/cache/inmemory/fixPolyfills.js.map +1 -1
- package/cache/inmemory/fixPolyfills.native.js +12 -0
- package/cache/inmemory/fixPolyfills.native.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.js +23 -12
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.js +20 -11
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.js +161 -8
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.js +72 -4
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/object-canon.js +91 -3
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.js +193 -43
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.js +20 -2
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +4 -0
- package/cache/inmemory/readFromStore.js +54 -9
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +28 -0
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.js +152 -25
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/setup.js +2 -0
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.d.ts +264 -3
- package/core/ApolloClient.js +235 -7
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +4 -6
- package/core/LocalState.js +56 -18
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +25 -0
- package/core/ObservableQuery.js +239 -30
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +3 -3
- package/core/QueryInfo.js +116 -13
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +4 -0
- package/core/QueryManager.js +229 -33
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +112 -103
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +112 -103
- package/core/equalByQuery.js +20 -1
- package/core/equalByQuery.js.map +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +19 -0
- package/core/index.js.map +1 -1
- package/core/networkStatus.d.ts +39 -0
- package/core/networkStatus.js +39 -0
- package/core/networkStatus.js.map +1 -1
- package/core/types.d.ts +9 -0
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +225 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +5 -111
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +5 -111
- package/dev/loadErrorMessageHandler.js.map +1 -1
- package/errors/errors.cjs +1 -1
- package/errors/errors.cjs.map +1 -1
- package/errors/errors.cjs.native.js +1 -1
- package/errors/index.js +14 -1
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +1 -0
- package/link/batch/batch.cjs +2 -2
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +2 -2
- package/link/batch/batchLink.d.ts +21 -0
- package/link/batch/batchLink.js +2 -1
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.js +24 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batch-http.cjs +3 -2
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +3 -2
- package/link/batch-http/batchHttpLink.d.ts +4 -0
- package/link/batch-http/batchHttpLink.js +53 -2
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/context/context.cjs.map +1 -1
- package/link/context/index.js +1 -0
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.js +12 -5
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs +5 -5
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +5 -5
- package/link/error/error.cjs +1 -1
- package/link/error/error.cjs.map +1 -1
- package/link/error/error.cjs.native.js +1 -1
- package/link/error/index.d.ts +3 -0
- package/link/error/index.js +4 -1
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +0 -2
- package/link/http/HttpLink.js +1 -1
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.js +23 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/createSignalIfSupported.d.ts +5 -0
- package/link/http/createSignalIfSupported.js +5 -0
- package/link/http/createSignalIfSupported.js.map +1 -1
- package/link/http/http.cjs +14 -12
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +14 -12
- package/link/http/index.js +2 -1
- package/link/http/index.js.map +1 -1
- package/link/http/iterators/async.d.ts +4 -0
- package/link/http/iterators/async.js +4 -0
- package/link/http/iterators/async.js.map +1 -1
- package/link/http/iterators/nodeStream.d.ts +4 -0
- package/link/http/iterators/nodeStream.js +4 -0
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/iterators/promise.d.ts +4 -0
- package/link/http/iterators/promise.js +4 -0
- package/link/http/iterators/promise.js.map +1 -1
- package/link/http/iterators/reader.d.ts +4 -0
- package/link/http/iterators/reader.js +4 -0
- package/link/http/iterators/reader.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +51 -10
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/responseIterator.d.ts +4 -0
- package/link/http/responseIterator.js +6 -0
- package/link/http/responseIterator.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +1 -1
- package/link/http/rewriteURIForGET.js +10 -0
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +45 -0
- package/link/http/selectHttpOptionsAndBody.js +23 -0
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.js.map +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.js +34 -4
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +4 -4
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +4 -4
- package/link/remove-typename/remove-typename.cjs +12 -9
- package/link/remove-typename/remove-typename.cjs.map +1 -1
- package/link/remove-typename/remove-typename.cjs.native.js +12 -9
- package/link/remove-typename/removeTypenameFromVariables.js +12 -9
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/retry/delayFunction.d.ts +29 -0
- package/link/retry/delayFunction.js +6 -0
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/retry.cjs +5 -5
- package/link/retry/retry.cjs.map +1 -1
- package/link/retry/retry.cjs.native.js +5 -5
- package/link/retry/retryFunction.d.ts +20 -0
- package/link/retry/retryLink.d.ts +6 -0
- package/link/retry/retryLink.js +31 -6
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +13 -0
- package/link/schema/index.js +3 -3
- package/link/schema/index.js.map +1 -1
- package/link/schema/schema.cjs +3 -3
- package/link/schema/schema.cjs.map +1 -1
- package/link/schema/schema.cjs.native.js +3 -3
- package/link/subscriptions/index.js +35 -2
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs +3 -2
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/link/subscriptions/subscriptions.cjs.native.js +3 -2
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/filterOperationVariables.js +4 -0
- package/link/utils/filterOperationVariables.js.map +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/transformOperation.js +3 -2
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/utils.cjs +2 -2
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +2 -2
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +12 -0
- package/link/ws/index.js +1 -1
- package/link/ws/index.js.map +1 -1
- package/link/ws/ws.cjs +1 -1
- package/link/ws/ws.cjs.map +1 -1
- package/link/ws/ws.cjs.native.js +1 -1
- package/package.json +49 -38
- package/react/cache/QueryReference.d.ts +6 -1
- package/react/cache/QueryReference.js +26 -1
- package/react/cache/QueryReference.js.map +1 -1
- package/react/cache/SuspenseCache.d.ts +10 -0
- package/react/cache/SuspenseCache.js +1 -1
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/cache/getSuspenseCache.js.map +1 -1
- package/react/context/ApolloContext.d.ts +5 -0
- package/react/context/ApolloContext.js +10 -3
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/context.cjs +1 -3
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +1 -3
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.js +3 -1
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs +9 -17
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +9 -17
- package/react/hoc/mutation-hoc.js +9 -4
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.js +10 -4
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.js +10 -4
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/withApollo.js +3 -4
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +30 -22
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +30 -22
- package/react/hooks/internal/__use.js +5 -0
- package/react/hooks/internal/__use.js.map +1 -1
- package/react/hooks/internal/index.js +1 -0
- package/react/hooks/internal/index.js.map +1 -1
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +6 -3
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -1
- package/react/hooks/useBackgroundQuery.js +6 -0
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useFragment.js +4 -3
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.js +13 -4
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.js +8 -3
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +11 -0
- package/react/hooks/useQuery.js +137 -5
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.js +5 -0
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +19 -0
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSubscription.js +5 -0
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseQuery.js +11 -5
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +53 -1
- package/react/hooks/useSyncExternalStore.js.map +1 -1
- package/react/parser/index.js +4 -5
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +2 -4
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +2 -4
- package/react/ssr/RenderPromises.js +21 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/getDataFromTree.js +18 -3
- package/react/ssr/getDataFromTree.js.map +1 -1
- package/react/ssr/ssr.cjs +6 -4
- package/react/ssr/ssr.cjs.map +1 -1
- package/react/ssr/ssr.cjs.native.js +6 -4
- package/react/types/types.d.ts +66 -0
- package/testing/core/core.cjs +14 -11
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +14 -11
- package/testing/core/itAsync.d.ts +1 -1
- package/testing/core/itAsync.js.map +1 -1
- package/testing/core/mocking/mockFetch.d.ts +2 -2
- package/testing/core/mocking/mockFetch.js +8 -4
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.js +17 -7
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.js +2 -0
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js.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 +17 -3
- package/testing/core/observableToPromise.js +5 -0
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/core/subscribeAndCount.js +3 -0
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/core/wait.js +2 -2
- package/testing/core/wait.js.map +1 -1
- package/testing/core/withConsoleSpy.d.ts +3 -0
- package/testing/core/withConsoleSpy.js +7 -1
- package/testing/core/withConsoleSpy.js.map +1 -1
- package/testing/core/wrap.js +2 -0
- package/testing/core/wrap.js.map +1 -1
- package/testing/internal/ObservableStream.js +14 -14
- package/testing/internal/ObservableStream.js.map +1 -1
- package/testing/internal/disposables/spyOnConsole.d.ts +1 -0
- package/testing/internal/disposables/spyOnConsole.js +2 -0
- package/testing/internal/disposables/spyOnConsole.js.map +1 -1
- package/testing/internal/disposables/withCleanup.d.ts +1 -0
- package/testing/internal/disposables/withCleanup.js +3 -0
- package/testing/internal/disposables/withCleanup.js.map +1 -1
- package/testing/internal/profile/Render.d.ts +28 -0
- package/testing/internal/profile/Render.js +12 -1
- package/testing/internal/profile/Render.js.map +1 -1
- package/testing/internal/profile/profile.d.ts +44 -7
- package/testing/internal/profile/profile.js +63 -51
- package/testing/internal/profile/profile.js.map +1 -1
- package/testing/internal/profile/traces.d.ts +4 -0
- package/testing/internal/profile/traces.js +9 -5
- package/testing/internal/profile/traces.js.map +1 -1
- package/testing/matchers/ProfiledComponent.js +27 -22
- package/testing/matchers/ProfiledComponent.js.map +1 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.js.map +1 -1
- package/testing/matchers/toMatchDocument.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +4 -0
- package/testing/react/MockedProvider.js +6 -2
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +4 -2
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +4 -2
- package/utilities/common/arrays.js +1 -0
- package/utilities/common/arrays.js.map +1 -1
- package/utilities/common/canUse.js +16 -1
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/cloneDeep.d.ts +3 -0
- package/utilities/common/cloneDeep.js +5 -0
- package/utilities/common/cloneDeep.js.map +1 -1
- package/utilities/common/compact.d.ts +4 -0
- package/utilities/common/compact.js +4 -0
- package/utilities/common/compact.js.map +1 -1
- package/utilities/common/errorHandling.js +1 -3
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/incrementalResult.js +3 -0
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/makeUniqueId.js +2 -0
- package/utilities/common/makeUniqueId.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.js +3 -0
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.js +12 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/common/omitDeep.js.map +1 -1
- package/utilities/globals/global.js +7 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +4 -5
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +4 -5
- package/utilities/globals/index.d.ts +4 -0
- package/utilities/globals/index.js +7 -0
- package/utilities/globals/index.js.map +1 -1
- package/utilities/globals/invariantWrappers.d.ts +40 -0
- package/utilities/globals/invariantWrappers.js +11 -3
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/globals/maybe.js.map +1 -1
- package/utilities/graphql/DocumentTransform.js +19 -6
- package/utilities/graphql/DocumentTransform.js.map +1 -1
- package/utilities/graphql/directives.js +3 -0
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +25 -0
- package/utilities/graphql/fragments.js +36 -0
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts +5 -0
- package/utilities/graphql/getFromAST.js +9 -0
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/print.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +14 -0
- package/utilities/graphql/storeUtils.js +7 -2
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.js +106 -7
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/observables/Concast.d.ts +1 -1
- package/utilities/observables/Concast.js +84 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/Observable.js +6 -0
- package/utilities/observables/Observable.js.map +1 -1
- package/utilities/observables/asyncMap.js +12 -3
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.js +3 -0
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/observables/subclassing.js +14 -0
- package/utilities/observables/subclassing.js.map +1 -1
- package/utilities/policies/pagination.js +47 -3
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/promises/decoration.js +1 -0
- package/utilities/promises/decoration.js.map +1 -1
- package/utilities/types/DeepOmit.js.map +1 -1
- package/utilities/types/DeepPartial.d.ts +1 -1
- package/utilities/types/DeepPartial.js +4 -0
- package/utilities/types/DeepPartial.js.map +1 -1
- package/utilities/types/IsStrictlyAny.js.map +1 -1
- package/utilities/types/TODO.d.ts +3 -0
- package/utilities/types/TODO.js +2 -0
- package/utilities/types/TODO.js.map +1 -0
- package/utilities/utilities.cjs +31 -27
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +31 -27
- package/version.js +1 -1
- package/cache/core/cache.d.ts.map +0 -1
- package/cache/core/types/Cache.d.ts.map +0 -1
- package/cache/core/types/DataProxy.d.ts.map +0 -1
- package/cache/core/types/common.d.ts.map +0 -1
- package/cache/index.d.ts.map +0 -1
- package/cache/inmemory/entityStore.d.ts.map +0 -1
- package/cache/inmemory/fixPolyfills.d.ts.map +0 -1
- package/cache/inmemory/fixPolyfills.native.d.ts.map +0 -1
- package/cache/inmemory/fragmentRegistry.d.ts.map +0 -1
- package/cache/inmemory/helpers.d.ts.map +0 -1
- package/cache/inmemory/inMemoryCache.d.ts.map +0 -1
- package/cache/inmemory/key-extractor.d.ts.map +0 -1
- package/cache/inmemory/object-canon.d.ts.map +0 -1
- package/cache/inmemory/policies.d.ts.map +0 -1
- package/cache/inmemory/reactiveVars.d.ts.map +0 -1
- package/cache/inmemory/readFromStore.d.ts.map +0 -1
- package/cache/inmemory/types.d.ts.map +0 -1
- package/cache/inmemory/writeToStore.d.ts.map +0 -1
- package/config/jest/setup.d.ts.map +0 -1
- package/core/ApolloClient.d.ts.map +0 -1
- package/core/LocalState.d.ts.map +0 -1
- package/core/ObservableQuery.d.ts.map +0 -1
- package/core/QueryInfo.d.ts.map +0 -1
- package/core/QueryManager.d.ts.map +0 -1
- package/core/equalByQuery.d.ts.map +0 -1
- package/core/index.d.ts.map +0 -1
- package/core/networkStatus.d.ts.map +0 -1
- package/core/types.d.ts.map +0 -1
- package/core/watchQueryOptions.d.ts.map +0 -1
- package/dev/index.d.ts.map +0 -1
- package/dev/loadDevMessages.d.ts.map +0 -1
- package/dev/loadErrorMessageHandler.d.ts.map +0 -1
- package/dev/loadErrorMessages.d.ts.map +0 -1
- package/errors/index.d.ts.map +0 -1
- package/index.d.ts.map +0 -1
- package/invariantErrorCodes.d.ts.map +0 -1
- package/link/batch/batchLink.d.ts.map +0 -1
- package/link/batch/batching.d.ts.map +0 -1
- package/link/batch/index.d.ts.map +0 -1
- package/link/batch-http/batchHttpLink.d.ts.map +0 -1
- package/link/batch-http/index.d.ts.map +0 -1
- package/link/context/index.d.ts.map +0 -1
- package/link/core/ApolloLink.d.ts.map +0 -1
- package/link/core/concat.d.ts.map +0 -1
- package/link/core/empty.d.ts.map +0 -1
- package/link/core/execute.d.ts.map +0 -1
- package/link/core/from.d.ts.map +0 -1
- package/link/core/index.d.ts.map +0 -1
- package/link/core/split.d.ts.map +0 -1
- package/link/core/types.d.ts.map +0 -1
- package/link/error/index.d.ts.map +0 -1
- package/link/http/HttpLink.d.ts.map +0 -1
- package/link/http/checkFetcher.d.ts.map +0 -1
- package/link/http/createHttpLink.d.ts.map +0 -1
- package/link/http/createSignalIfSupported.d.ts.map +0 -1
- package/link/http/index.d.ts.map +0 -1
- package/link/http/iterators/async.d.ts.map +0 -1
- package/link/http/iterators/nodeStream.d.ts.map +0 -1
- package/link/http/iterators/promise.d.ts.map +0 -1
- package/link/http/iterators/reader.d.ts.map +0 -1
- package/link/http/parseAndCheckHttpResponse.d.ts.map +0 -1
- package/link/http/responseIterator.d.ts.map +0 -1
- package/link/http/rewriteURIForGET.d.ts.map +0 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +0 -1
- package/link/http/selectURI.d.ts.map +0 -1
- package/link/http/serializeFetchParameter.d.ts.map +0 -1
- package/link/persisted-queries/index.d.ts.map +0 -1
- package/link/remove-typename/index.d.ts.map +0 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts.map +0 -1
- package/link/retry/delayFunction.d.ts.map +0 -1
- package/link/retry/index.d.ts.map +0 -1
- package/link/retry/retryFunction.d.ts.map +0 -1
- package/link/retry/retryLink.d.ts.map +0 -1
- package/link/schema/index.d.ts.map +0 -1
- package/link/subscriptions/index.d.ts.map +0 -1
- package/link/utils/createOperation.d.ts.map +0 -1
- package/link/utils/filterOperationVariables.d.ts.map +0 -1
- package/link/utils/fromError.d.ts.map +0 -1
- package/link/utils/fromPromise.d.ts.map +0 -1
- package/link/utils/index.d.ts.map +0 -1
- package/link/utils/throwServerError.d.ts.map +0 -1
- package/link/utils/toPromise.d.ts.map +0 -1
- package/link/utils/transformOperation.d.ts.map +0 -1
- package/link/utils/validateOperation.d.ts.map +0 -1
- package/link/ws/index.d.ts.map +0 -1
- package/react/cache/QueryReference.d.ts.map +0 -1
- package/react/cache/SuspenseCache.d.ts.map +0 -1
- package/react/cache/getSuspenseCache.d.ts.map +0 -1
- package/react/cache/index.d.ts.map +0 -1
- package/react/cache/types.d.ts.map +0 -1
- package/react/components/Mutation.d.ts.map +0 -1
- package/react/components/Query.d.ts.map +0 -1
- package/react/components/Subscription.d.ts.map +0 -1
- package/react/components/index.d.ts.map +0 -1
- package/react/components/types.d.ts.map +0 -1
- package/react/context/ApolloConsumer.d.ts.map +0 -1
- package/react/context/ApolloContext.d.ts.map +0 -1
- package/react/context/ApolloProvider.d.ts.map +0 -1
- package/react/context/index.d.ts.map +0 -1
- package/react/hoc/graphql.d.ts.map +0 -1
- package/react/hoc/hoc-utils.d.ts.map +0 -1
- package/react/hoc/index.d.ts.map +0 -1
- package/react/hoc/mutation-hoc.d.ts.map +0 -1
- package/react/hoc/query-hoc.d.ts.map +0 -1
- package/react/hoc/subscription-hoc.d.ts.map +0 -1
- package/react/hoc/types.d.ts.map +0 -1
- package/react/hoc/withApollo.d.ts.map +0 -1
- package/react/hooks/constants.d.ts.map +0 -1
- package/react/hooks/index.d.ts.map +0 -1
- package/react/hooks/internal/__use.d.ts.map +0 -1
- package/react/hooks/internal/index.d.ts.map +0 -1
- package/react/hooks/internal/useDeepMemo.d.ts.map +0 -1
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +0 -1
- package/react/hooks/useApolloClient.d.ts.map +0 -1
- package/react/hooks/useBackgroundQuery.d.ts.map +0 -1
- package/react/hooks/useFragment.d.ts.map +0 -1
- package/react/hooks/useLazyQuery.d.ts.map +0 -1
- package/react/hooks/useMutation.d.ts.map +0 -1
- package/react/hooks/useQuery.d.ts.map +0 -1
- package/react/hooks/useReactiveVar.d.ts.map +0 -1
- package/react/hooks/useReadQuery.d.ts.map +0 -1
- package/react/hooks/useSubscription.d.ts.map +0 -1
- package/react/hooks/useSuspenseQuery.d.ts.map +0 -1
- package/react/hooks/useSyncExternalStore.d.ts.map +0 -1
- package/react/index.d.ts.map +0 -1
- package/react/parser/index.d.ts.map +0 -1
- package/react/ssr/RenderPromises.d.ts.map +0 -1
- package/react/ssr/getDataFromTree.d.ts.map +0 -1
- package/react/ssr/index.d.ts.map +0 -1
- package/react/ssr/renderToStringWithData.d.ts.map +0 -1
- package/react/types/types.d.ts.map +0 -1
- package/testing/core/index.d.ts.map +0 -1
- package/testing/core/itAsync.d.ts.map +0 -1
- package/testing/core/mocking/mockClient.d.ts.map +0 -1
- package/testing/core/mocking/mockFetch.d.ts.map +0 -1
- package/testing/core/mocking/mockLink.d.ts.map +0 -1
- package/testing/core/mocking/mockQueryManager.d.ts.map +0 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +0 -1
- package/testing/core/mocking/mockWatchQuery.d.ts.map +0 -1
- package/testing/core/observableToPromise.d.ts.map +0 -1
- package/testing/core/subscribeAndCount.d.ts.map +0 -1
- package/testing/core/wait.d.ts.map +0 -1
- package/testing/core/withConsoleSpy.d.ts.map +0 -1
- package/testing/core/wrap.d.ts.map +0 -1
- package/testing/index.d.ts.map +0 -1
- package/testing/internal/ObservableStream.d.ts.map +0 -1
- package/testing/internal/disposables/index.d.ts.map +0 -1
- package/testing/internal/disposables/spyOnConsole.d.ts.map +0 -1
- package/testing/internal/disposables/withCleanup.d.ts.map +0 -1
- package/testing/internal/index.d.ts.map +0 -1
- package/testing/internal/profile/Render.d.ts.map +0 -1
- package/testing/internal/profile/index.d.ts.map +0 -1
- package/testing/internal/profile/profile.d.ts.map +0 -1
- package/testing/internal/profile/traces.d.ts.map +0 -1
- package/testing/matchers/ProfiledComponent.d.ts.map +0 -1
- package/testing/matchers/index.d.ts.map +0 -1
- package/testing/matchers/toHaveSuspenseCacheEntryUsing.d.ts.map +0 -1
- package/testing/matchers/toMatchDocument.d.ts.map +0 -1
- package/testing/react/MockedProvider.d.ts.map +0 -1
- package/utilities/common/arrays.d.ts.map +0 -1
- package/utilities/common/canUse.d.ts.map +0 -1
- package/utilities/common/cloneDeep.d.ts.map +0 -1
- package/utilities/common/compact.d.ts.map +0 -1
- package/utilities/common/errorHandling.d.ts.map +0 -1
- package/utilities/common/filterInPlace.d.ts +0 -2
- package/utilities/common/filterInPlace.d.ts.map +0 -1
- package/utilities/common/filterInPlace.js +0 -11
- package/utilities/common/filterInPlace.js.map +0 -1
- package/utilities/common/incrementalResult.d.ts.map +0 -1
- package/utilities/common/makeUniqueId.d.ts.map +0 -1
- package/utilities/common/maybeDeepFreeze.d.ts.map +0 -1
- package/utilities/common/mergeDeep.d.ts.map +0 -1
- package/utilities/common/mergeOptions.d.ts.map +0 -1
- package/utilities/common/objects.d.ts.map +0 -1
- package/utilities/common/omitDeep.d.ts.map +0 -1
- package/utilities/common/stringifyForDisplay.d.ts.map +0 -1
- package/utilities/common/stripTypename.d.ts.map +0 -1
- package/utilities/globals/global.d.ts.map +0 -1
- package/utilities/globals/index.d.ts.map +0 -1
- package/utilities/globals/invariantWrappers.d.ts.map +0 -1
- package/utilities/globals/maybe.d.ts.map +0 -1
- package/utilities/graphql/DocumentTransform.d.ts.map +0 -1
- package/utilities/graphql/directives.d.ts.map +0 -1
- package/utilities/graphql/fragments.d.ts.map +0 -1
- package/utilities/graphql/getFromAST.d.ts.map +0 -1
- package/utilities/graphql/operations.d.ts.map +0 -1
- package/utilities/graphql/print.d.ts.map +0 -1
- package/utilities/graphql/storeUtils.d.ts.map +0 -1
- package/utilities/graphql/transform.d.ts.map +0 -1
- package/utilities/index.d.ts.map +0 -1
- package/utilities/observables/Concast.d.ts.map +0 -1
- package/utilities/observables/Observable.d.ts.map +0 -1
- package/utilities/observables/asyncMap.d.ts.map +0 -1
- package/utilities/observables/iteration.d.ts.map +0 -1
- package/utilities/observables/subclassing.d.ts.map +0 -1
- package/utilities/policies/pagination.d.ts.map +0 -1
- package/utilities/promises/decoration.d.ts.map +0 -1
- package/utilities/types/DeepOmit.d.ts.map +0 -1
- package/utilities/types/DeepPartial.d.ts.map +0 -1
- package/utilities/types/IsStrictlyAny.d.ts.map +0 -1
- package/utilities/types/Primitive.d.ts.map +0 -1
- package/version.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../src/utilities/policies/pagination.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAMnD,MAAM,UAAU,gBAAgB,CAC9B,OAAwB;IAAxB,wBAAA,EAAA,eAAwB;IAExB,OAAO;QACL,OAAO,SAAA;QACP,KAAK,YAAC,QAAQ,EAAE,QAAQ;YACtB,OAAO,QAAQ,CAAC,CAAC,iCAAK,QAAQ,SAAK,QAAQ,QAAE,CAAC,CAAC,QAAQ,CAAC;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC;AAMD,MAAM,UAAU,qBAAqB,CACnC,OAAwB;IAAxB,wBAAA,EAAA,eAAwB;IAExB,OAAO;QACL,OAAO,SAAA;QACP,KAAK,YAAC,QAAQ,EAAE,QAAQ,EAAE,EAAQ;gBAAN,IAAI,UAAA;YAC9B,IAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,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K,OAAA,EACL,QAAQ,UAAA,IACR;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAGD,IAAM,SAAS,GAAG,UAAC,GAAwB,IAAK,OAAA,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,EAAtB,CAAsB,CAAC;AACvE,IAAM,SAAS,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AAExC,SAAS,aAAa;IACpB,OAAO;QACL,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE;YACR,eAAe,EAAE,KAAK;YACtB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE;SACd;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { __rest } from \"tslib\";\n\nimport type { FieldPolicy, Reference } from \"../../cache/index.js\";\nimport { mergeDeep } from \"../common/mergeDeep.js\";\n\ntype KeyArgs = FieldPolicy<any>[\"keyArgs\"];\n\n// A very basic pagination field policy that always concatenates new\n// results onto the existing array, without examining options.args.\nexport function concatPagination<T = Reference>(\n keyArgs: KeyArgs = false\n): FieldPolicy<T[]> {\n return {\n keyArgs,\n merge(existing, incoming) {\n return existing ? [...existing, ...incoming] : incoming;\n },\n };\n}\n\n// A basic field policy that uses options.args.{offset,limit} to splice\n// the incoming data into the existing array. If your arguments are called\n// something different (like args.{start,count}), feel free to copy/paste\n// this implementation and make the appropriate changes.\nexport function offsetLimitPagination<T = Reference>(\n keyArgs: KeyArgs = false\n): FieldPolicy<T[]> {\n return {\n keyArgs,\n merge(existing, incoming, { args }) {\n const merged = existing ? existing.slice(0) : [];\n\n if (incoming) {\n if (args) {\n // Assume an offset of 0 if args.offset omitted.\n const { offset = 0 } = args;\n for (let i = 0; i < incoming.length; ++i) {\n merged[offset + i] = incoming[i];\n }\n } else {\n // It's unusual (probably a mistake) for a paginated field not\n // to receive any arguments, so you might prefer to throw an\n // exception here, instead of recovering by appending incoming\n // onto the existing array.\n merged.push.apply(merged, incoming);\n }\n }\n\n return merged;\n },\n };\n}\n\n// Whether TRelayEdge<TNode> is a normalized Reference or a non-normalized\n// object, it needs a .cursor property where the relayStylePagination\n// merge function can store cursor strings taken from pageInfo. Storing an\n// extra reference.cursor property should be safe, and is easier than\n// attempting to update the cursor field of the normalized StoreObject\n// that the reference refers to, or managing edge wrapper objects\n// (something I attempted in #7023, but abandoned because of #7088).\nexport type TRelayEdge<TNode> =\n | {\n cursor?: string;\n node: TNode;\n }\n | (Reference & { cursor?: string });\n\nexport type TRelayPageInfo = {\n hasPreviousPage: boolean;\n hasNextPage: boolean;\n startCursor: string;\n endCursor: string;\n};\n\nexport type TExistingRelay<TNode> = Readonly<{\n edges: TRelayEdge<TNode>[];\n pageInfo: TRelayPageInfo;\n}>;\n\nexport type TIncomingRelay<TNode> = {\n edges?: TRelayEdge<TNode>[];\n pageInfo?: TRelayPageInfo;\n};\n\nexport type RelayFieldPolicy<TNode> = FieldPolicy<\n TExistingRelay<TNode> | null,\n TIncomingRelay<TNode> | null,\n TIncomingRelay<TNode> | null\n>;\n\n// As proof of the flexibility of field policies, this function generates\n// one that handles Relay-style pagination, without Apollo Client knowing\n// anything about connections, edges, cursors, or pageInfo objects.\nexport function relayStylePagination<TNode extends Reference = Reference>(\n keyArgs: KeyArgs = false\n): RelayFieldPolicy<TNode> {\n return {\n keyArgs,\n\n read(existing, { canRead, readField }) {\n if (!existing) return existing;\n\n const edges: TRelayEdge<TNode>[] = [];\n let firstEdgeCursor = \"\";\n let lastEdgeCursor = \"\";\n existing.edges.forEach((edge) => {\n // Edges themselves could be Reference objects, so it's important\n // to use readField to access the edge.edge.node property.\n if (canRead(readField(\"node\", edge))) {\n edges.push(edge);\n if (edge.cursor) {\n firstEdgeCursor = firstEdgeCursor || edge.cursor || \"\";\n lastEdgeCursor = edge.cursor || lastEdgeCursor;\n }\n }\n });\n\n if (edges.length > 1 && firstEdgeCursor === lastEdgeCursor) {\n firstEdgeCursor = \"\";\n }\n\n const { startCursor, endCursor } = existing.pageInfo || {};\n\n return {\n // Some implementations return additional Connection fields, such\n // as existing.totalCount. These fields are saved by the merge\n // function, so the read function should also preserve them.\n ...getExtras(existing),\n edges,\n pageInfo: {\n ...existing.pageInfo,\n // If existing.pageInfo.{start,end}Cursor are undefined or \"\", default\n // to firstEdgeCursor and/or lastEdgeCursor.\n startCursor: startCursor || firstEdgeCursor,\n endCursor: endCursor || lastEdgeCursor,\n },\n };\n },\n\n merge(existing, incoming, { args, isReference, readField }) {\n if (!existing) {\n existing = makeEmptyData();\n }\n\n if (!incoming) {\n return existing;\n }\n\n const incomingEdges = incoming.edges\n ? incoming.edges.map((edge) => {\n if (isReference((edge = { ...edge }))) {\n // In case edge is a Reference, we read out its cursor field and\n // store it as an extra property of the Reference object.\n edge.cursor = readField<string>(\"cursor\", edge);\n }\n return edge;\n })\n : [];\n\n if (incoming.pageInfo) {\n const { pageInfo } = incoming;\n const { startCursor, endCursor } = pageInfo;\n const firstEdge = incomingEdges[0];\n const lastEdge = incomingEdges[incomingEdges.length - 1];\n // In case we did not request the cursor field for edges in this\n // query, we can still infer cursors from pageInfo.\n if (firstEdge && startCursor) {\n firstEdge.cursor = startCursor;\n }\n if (lastEdge && endCursor) {\n lastEdge.cursor = endCursor;\n }\n // Cursors can also come from edges, so we default\n // pageInfo.{start,end}Cursor to {first,last}Edge.cursor.\n const firstCursor = firstEdge && firstEdge.cursor;\n if (firstCursor && !startCursor) {\n incoming = mergeDeep(incoming, {\n pageInfo: {\n startCursor: firstCursor,\n },\n });\n }\n const lastCursor = lastEdge && lastEdge.cursor;\n if (lastCursor && !endCursor) {\n incoming = mergeDeep(incoming, {\n pageInfo: {\n endCursor: lastCursor,\n },\n });\n }\n }\n\n let prefix = existing.edges;\n let suffix: typeof prefix = [];\n\n if (args && args.after) {\n // This comparison does not need to use readField(\"cursor\", edge),\n // because we stored the cursor field of any Reference edges as an\n // extra property of the Reference object.\n const index = prefix.findIndex((edge) => edge.cursor === args.after);\n if (index >= 0) {\n prefix = prefix.slice(0, index + 1);\n // suffix = []; // already true\n }\n } else if (args && args.before) {\n const index = prefix.findIndex((edge) => edge.cursor === args.before);\n suffix = index < 0 ? prefix : prefix.slice(index);\n prefix = [];\n } else if (incoming.edges) {\n // If we have neither args.after nor args.before, the incoming\n // edges cannot be spliced into the existing edges, so they must\n // replace the existing edges. See #6592 for a motivating example.\n prefix = [];\n }\n\n const edges = [...prefix, ...incomingEdges, ...suffix];\n\n const pageInfo: TRelayPageInfo = {\n // The ordering of these two ...spreads may be surprising, but it\n // makes sense because we want to combine PageInfo properties with a\n // preference for existing values, *unless* the existing values are\n // overridden by the logic below, which is permitted only when the\n // incoming page falls at the beginning or end of the data.\n ...incoming.pageInfo,\n ...existing.pageInfo,\n };\n\n if (incoming.pageInfo) {\n const {\n hasPreviousPage,\n hasNextPage,\n startCursor,\n endCursor,\n ...extras\n } = incoming.pageInfo;\n\n // If incoming.pageInfo had any extra non-standard properties,\n // assume they should take precedence over any existing properties\n // of the same name, regardless of where this page falls with\n // respect to the existing data.\n Object.assign(pageInfo, extras);\n\n // Keep existing.pageInfo.has{Previous,Next}Page unless the\n // placement of the incoming edges means incoming.hasPreviousPage\n // or incoming.hasNextPage should become the new values for those\n // properties in existing.pageInfo. Note that these updates are\n // only permitted when the beginning or end of the incoming page\n // coincides with the beginning or end of the existing data, as\n // determined using prefix.length and suffix.length.\n if (!prefix.length) {\n if (void 0 !== hasPreviousPage)\n pageInfo.hasPreviousPage = hasPreviousPage;\n if (void 0 !== startCursor) pageInfo.startCursor = startCursor;\n }\n if (!suffix.length) {\n if (void 0 !== hasNextPage) pageInfo.hasNextPage = hasNextPage;\n if (void 0 !== endCursor) pageInfo.endCursor = endCursor;\n }\n }\n\n return {\n ...getExtras(existing),\n ...getExtras(incoming),\n edges,\n pageInfo,\n };\n },\n };\n}\n\n// Returns any unrecognized properties of the given object.\nconst getExtras = (obj: Record<string, any>) => __rest(obj, notExtras);\nconst notExtras = [\"edges\", \"pageInfo\"];\n\nfunction makeEmptyData(): TExistingRelay<any> {\n return {\n edges: [],\n pageInfo: {\n hasPreviousPage: false,\n hasNextPage: true,\n startCursor: \"\",\n endCursor: \"\",\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../src/utilities/policies/pagination.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,oEAAoE;AACpE,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAC9B,OAAwB;IAAxB,wBAAA,EAAA,eAAwB;IAExB,OAAO;QACL,OAAO,SAAA;QACP,KAAK,YAAC,QAAQ,EAAE,QAAQ;YACtB,OAAO,QAAQ,CAAC,CAAC,iCAAK,QAAQ,SAAK,QAAQ,QAAE,CAAC,CAAC,QAAQ,CAAC;QAC1D,CAAC;KACF,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,0EAA0E;AAC1E,yEAAyE;AACzE,wDAAwD;AACxD,MAAM,UAAU,qBAAqB,CACnC,OAAwB;IAAxB,wBAAA,EAAA,eAAwB;IAExB,OAAO;QACL,OAAO,SAAA;QACP,KAAK,YAAC,QAAQ,EAAE,QAAQ,EAAE,EAAQ;gBAAN,IAAI,UAAA;YAC9B,IAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAEjD,IAAI,QAAQ,EAAE,CAAC;gBACb,IAAI,IAAI,EAAE,CAAC;oBACT,gDAAgD;oBACxC,IAAA,KAAe,IAAI,OAAT,EAAV,MAAM,mBAAG,CAAC,KAAA,CAAU;oBAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;wBACzC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,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AG,eAAe,CAAC;oBAC7C,IAAI,KAAK,CAAC,KAAK,WAAW;wBAAE,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;gBACjE,CAAC;gBACD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;oBACnB,IAAI,KAAK,CAAC,KAAK,WAAW;wBAAE,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;oBAC/D,IAAI,KAAK,CAAC,KAAK,SAAS;wBAAE,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC;gBAC3D,CAAC;YACH,CAAC;YAED,sCACK,SAAS,CAAC,QAAQ,CAAC,GACnB,SAAS,CAAC,QAAQ,CAAC,KACtB,KAAK,OAAA,EACL,QAAQ,UAAA,IACR;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,2DAA2D;AAC3D,IAAM,SAAS,GAAG,UAAC,GAAwB,IAAK,OAAA,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,EAAtB,CAAsB,CAAC;AACvE,IAAM,SAAS,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AAExC,SAAS,aAAa;IACpB,OAAO;QACL,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE;YACR,eAAe,EAAE,KAAK;YACtB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,EAAE;YACf,SAAS,EAAE,EAAE;SACd;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { __rest } from \"tslib\";\n\nimport type { FieldPolicy, Reference } from \"../../cache/index.js\";\nimport { mergeDeep } from \"../common/mergeDeep.js\";\n\ntype KeyArgs = FieldPolicy<any>[\"keyArgs\"];\n\n// A very basic pagination field policy that always concatenates new\n// results onto the existing array, without examining options.args.\nexport function concatPagination<T = Reference>(\n keyArgs: KeyArgs = false\n): FieldPolicy<T[]> {\n return {\n keyArgs,\n merge(existing, incoming) {\n return existing ? [...existing, ...incoming] : incoming;\n },\n };\n}\n\n// A basic field policy that uses options.args.{offset,limit} to splice\n// the incoming data into the existing array. If your arguments are called\n// something different (like args.{start,count}), feel free to copy/paste\n// this implementation and make the appropriate changes.\nexport function offsetLimitPagination<T = Reference>(\n keyArgs: KeyArgs = false\n): FieldPolicy<T[]> {\n return {\n keyArgs,\n merge(existing, incoming, { args }) {\n const merged = existing ? existing.slice(0) : [];\n\n if (incoming) {\n if (args) {\n // Assume an offset of 0 if args.offset omitted.\n const { offset = 0 } = args;\n for (let i = 0; i < incoming.length; ++i) {\n merged[offset + i] = incoming[i];\n }\n } else {\n // It's unusual (probably a mistake) for a paginated field not\n // to receive any arguments, so you might prefer to throw an\n // exception here, instead of recovering by appending incoming\n // onto the existing array.\n merged.push(...incoming);\n }\n }\n\n return merged;\n },\n };\n}\n\n// Whether TRelayEdge<TNode> is a normalized Reference or a non-normalized\n// object, it needs a .cursor property where the relayStylePagination\n// merge function can store cursor strings taken from pageInfo. Storing an\n// extra reference.cursor property should be safe, and is easier than\n// attempting to update the cursor field of the normalized StoreObject\n// that the reference refers to, or managing edge wrapper objects\n// (something I attempted in #7023, but abandoned because of #7088).\nexport type TRelayEdge<TNode> =\n | {\n cursor?: string;\n node: TNode;\n }\n | (Reference & { cursor?: string });\n\nexport type TRelayPageInfo = {\n hasPreviousPage: boolean;\n hasNextPage: boolean;\n startCursor: string;\n endCursor: string;\n};\n\nexport type TExistingRelay<TNode> = Readonly<{\n edges: TRelayEdge<TNode>[];\n pageInfo: TRelayPageInfo;\n}>;\n\nexport type TIncomingRelay<TNode> = {\n edges?: TRelayEdge<TNode>[];\n pageInfo?: TRelayPageInfo;\n};\n\nexport type RelayFieldPolicy<TNode> = FieldPolicy<\n TExistingRelay<TNode> | null,\n TIncomingRelay<TNode> | null,\n TIncomingRelay<TNode> | null\n>;\n\n// As proof of the flexibility of field policies, this function generates\n// one that handles Relay-style pagination, without Apollo Client knowing\n// anything about connections, edges, cursors, or pageInfo objects.\nexport function relayStylePagination<TNode extends Reference = Reference>(\n keyArgs: KeyArgs = false\n): RelayFieldPolicy<TNode> {\n return {\n keyArgs,\n\n read(existing, { canRead, readField }) {\n if (!existing) return existing;\n\n const edges: TRelayEdge<TNode>[] = [];\n let firstEdgeCursor = \"\";\n let lastEdgeCursor = \"\";\n existing.edges.forEach((edge) => {\n // Edges themselves could be Reference objects, so it's important\n // to use readField to access the edge.edge.node property.\n if (canRead(readField(\"node\", edge))) {\n edges.push(edge);\n if (edge.cursor) {\n firstEdgeCursor = firstEdgeCursor || edge.cursor || \"\";\n lastEdgeCursor = edge.cursor || lastEdgeCursor;\n }\n }\n });\n\n if (edges.length > 1 && firstEdgeCursor === lastEdgeCursor) {\n firstEdgeCursor = \"\";\n }\n\n const { startCursor, endCursor } = existing.pageInfo || {};\n\n return {\n // Some implementations return additional Connection fields, such\n // as existing.totalCount. These fields are saved by the merge\n // function, so the read function should also preserve them.\n ...getExtras(existing),\n edges,\n pageInfo: {\n ...existing.pageInfo,\n // If existing.pageInfo.{start,end}Cursor are undefined or \"\", default\n // to firstEdgeCursor and/or lastEdgeCursor.\n startCursor: startCursor || firstEdgeCursor,\n endCursor: endCursor || lastEdgeCursor,\n },\n };\n },\n\n merge(existing, incoming, { args, isReference, readField }) {\n if (!existing) {\n existing = makeEmptyData();\n }\n\n if (!incoming) {\n return existing;\n }\n\n const incomingEdges =\n incoming.edges ?\n incoming.edges.map((edge) => {\n if (isReference((edge = { ...edge }))) {\n // In case edge is a Reference, we read out its cursor field and\n // store it as an extra property of the Reference object.\n edge.cursor = readField<string>(\"cursor\", edge);\n }\n return edge;\n })\n : [];\n\n if (incoming.pageInfo) {\n const { pageInfo } = incoming;\n const { startCursor, endCursor } = pageInfo;\n const firstEdge = incomingEdges[0];\n const lastEdge = incomingEdges[incomingEdges.length - 1];\n // In case we did not request the cursor field for edges in this\n // query, we can still infer cursors from pageInfo.\n if (firstEdge && startCursor) {\n firstEdge.cursor = startCursor;\n }\n if (lastEdge && endCursor) {\n lastEdge.cursor = endCursor;\n }\n // Cursors can also come from edges, so we default\n // pageInfo.{start,end}Cursor to {first,last}Edge.cursor.\n const firstCursor = firstEdge && firstEdge.cursor;\n if (firstCursor && !startCursor) {\n incoming = mergeDeep(incoming, {\n pageInfo: {\n startCursor: firstCursor,\n },\n });\n }\n const lastCursor = lastEdge && lastEdge.cursor;\n if (lastCursor && !endCursor) {\n incoming = mergeDeep(incoming, {\n pageInfo: {\n endCursor: lastCursor,\n },\n });\n }\n }\n\n let prefix = existing.edges;\n let suffix: typeof prefix = [];\n\n if (args && args.after) {\n // This comparison does not need to use readField(\"cursor\", edge),\n // because we stored the cursor field of any Reference edges as an\n // extra property of the Reference object.\n const index = prefix.findIndex((edge) => edge.cursor === args.after);\n if (index >= 0) {\n prefix = prefix.slice(0, index + 1);\n // suffix = []; // already true\n }\n } else if (args && args.before) {\n const index = prefix.findIndex((edge) => edge.cursor === args.before);\n suffix = index < 0 ? prefix : prefix.slice(index);\n prefix = [];\n } else if (incoming.edges) {\n // If we have neither args.after nor args.before, the incoming\n // edges cannot be spliced into the existing edges, so they must\n // replace the existing edges. See #6592 for a motivating example.\n prefix = [];\n }\n\n const edges = [...prefix, ...incomingEdges, ...suffix];\n\n const pageInfo: TRelayPageInfo = {\n // The ordering of these two ...spreads may be surprising, but it\n // makes sense because we want to combine PageInfo properties with a\n // preference for existing values, *unless* the existing values are\n // overridden by the logic below, which is permitted only when the\n // incoming page falls at the beginning or end of the data.\n ...incoming.pageInfo,\n ...existing.pageInfo,\n };\n\n if (incoming.pageInfo) {\n const {\n hasPreviousPage,\n hasNextPage,\n startCursor,\n endCursor,\n ...extras\n } = incoming.pageInfo;\n\n // If incoming.pageInfo had any extra non-standard properties,\n // assume they should take precedence over any existing properties\n // of the same name, regardless of where this page falls with\n // respect to the existing data.\n Object.assign(pageInfo, extras);\n\n // Keep existing.pageInfo.has{Previous,Next}Page unless the\n // placement of the incoming edges means incoming.hasPreviousPage\n // or incoming.hasNextPage should become the new values for those\n // properties in existing.pageInfo. Note that these updates are\n // only permitted when the beginning or end of the incoming page\n // coincides with the beginning or end of the existing data, as\n // determined using prefix.length and suffix.length.\n if (!prefix.length) {\n if (void 0 !== hasPreviousPage)\n pageInfo.hasPreviousPage = hasPreviousPage;\n if (void 0 !== startCursor) pageInfo.startCursor = startCursor;\n }\n if (!suffix.length) {\n if (void 0 !== hasNextPage) pageInfo.hasNextPage = hasNextPage;\n if (void 0 !== endCursor) pageInfo.endCursor = endCursor;\n }\n }\n\n return {\n ...getExtras(existing),\n ...getExtras(incoming),\n edges,\n pageInfo,\n };\n },\n };\n}\n\n// Returns any unrecognized properties of the given object.\nconst getExtras = (obj: Record<string, any>) => __rest(obj, notExtras);\nconst notExtras = [\"edges\", \"pageInfo\"];\n\nfunction makeEmptyData(): TExistingRelay<any> {\n return {\n edges: [],\n pageInfo: {\n hasPreviousPage: false,\n hasNextPage: true,\n startCursor: \"\",\n endCursor: \"\",\n },\n };\n}\n"]}
|
|
@@ -6,6 +6,7 @@ export function createFulfilledPromise(value) {
|
|
|
6
6
|
}
|
|
7
7
|
export function createRejectedPromise(reason) {
|
|
8
8
|
var promise = Promise.reject(reason);
|
|
9
|
+
// prevent potential edge cases leaking unhandled error rejections
|
|
9
10
|
promise.catch(function () { });
|
|
10
11
|
promise.status = "rejected";
|
|
11
12
|
promise.reason = reason;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decoration.js","sourceRoot":"","sources":["../../../src/utilities/promises/decoration.ts"],"names":[],"mappings":"AAmBA,MAAM,UAAU,sBAAsB,CAAS,KAAa;IAC1D,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAA6B,CAAC;IAEnE,OAAO,CAAC,MAAM,GAAG,WAAW,CAAC;IAC7B,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IAEtB,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAmB,MAAe;IACrE,IAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAA4B,CAAC;
|
|
1
|
+
{"version":3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AAoD,CAAC;YAEvD,eAAe,CAAC,MAAM,GAAG,UAAU,CAAC;YACpC,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC;QAClC,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,OAAmC,CAAC;AAC7C,CAAC","sourcesContent":["export interface PendingPromise<TValue> extends Promise<TValue> {\n status: \"pending\";\n}\n\nexport interface FulfilledPromise<TValue> extends Promise<TValue> {\n status: \"fulfilled\";\n value: TValue;\n}\n\nexport interface RejectedPromise<TValue> extends Promise<TValue> {\n status: \"rejected\";\n reason: unknown;\n}\n\nexport type PromiseWithState<TValue> =\n | PendingPromise<TValue>\n | FulfilledPromise<TValue>\n | RejectedPromise<TValue>;\n\nexport function createFulfilledPromise<TValue>(value: TValue) {\n const promise = Promise.resolve(value) as FulfilledPromise<TValue>;\n\n promise.status = \"fulfilled\";\n promise.value = value;\n\n return promise;\n}\n\nexport function createRejectedPromise<TValue = unknown>(reason: unknown) {\n const promise = Promise.reject(reason) as RejectedPromise<TValue>;\n\n // prevent potential edge cases leaking unhandled error rejections\n promise.catch(() => {});\n\n promise.status = \"rejected\";\n promise.reason = reason;\n\n return promise;\n}\n\nexport function isStatefulPromise<TValue>(\n promise: Promise<TValue>\n): promise is PromiseWithState<TValue> {\n return \"status\" in promise;\n}\n\nexport function wrapPromiseWithState<TValue>(\n promise: Promise<TValue>\n): PromiseWithState<TValue> {\n if (isStatefulPromise(promise)) {\n return promise;\n }\n\n const pendingPromise = promise as PendingPromise<TValue>;\n pendingPromise.status = \"pending\";\n\n pendingPromise.then(\n (value) => {\n if (pendingPromise.status === \"pending\") {\n const fulfilledPromise =\n pendingPromise as unknown as FulfilledPromise<TValue>;\n\n fulfilledPromise.status = \"fulfilled\";\n fulfilledPromise.value = value;\n }\n },\n (reason: unknown) => {\n if (pendingPromise.status === \"pending\") {\n const rejectedPromise =\n pendingPromise as unknown as RejectedPromise<TValue>;\n\n rejectedPromise.status = \"rejected\";\n rejectedPromise.reason = reason;\n }\n }\n );\n\n return promise as PromiseWithState<TValue>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeepOmit.js","sourceRoot":"","sources":["../../../src/utilities/types/DeepOmit.ts"],"names":[],"mappings":"","sourcesContent":["import type { Primitive } from \"./Primitive.js\";\n\n// DeepOmit primitives include functions since these are unmodified.\ntype DeepOmitPrimitive = Primitive | Function;\n\nexport type DeepOmitArray<T extends any[], K> = {\n [P in keyof T]: DeepOmit<T[P], K>;\n};\n\n// Unfortunately there is one major flaw in this type: This will omit properties\n// from class instances in the return type even though our omitDeep helper\n// ignores class instances, therefore resulting in a type mismatch between\n// the return value and the runtime value.\n//\n// It is not currently possible with TypeScript to distinguish between plain\n// objects and class instances.\n// https://github.com/microsoft/TypeScript/issues/29063\n//\n// This should be fine as of the time of this writing until omitDeep gets\n// broader use since this utility is only used to strip __typename from\n// `variables`; a case in which class instances are invalid anyways.\nexport type DeepOmit<T, K>
|
|
1
|
+
{"version":3,"file":"DeepOmit.js","sourceRoot":"","sources":["../../../src/utilities/types/DeepOmit.ts"],"names":[],"mappings":"","sourcesContent":["import type { Primitive } from \"./Primitive.js\";\n\n// DeepOmit primitives include functions since these are unmodified.\ntype DeepOmitPrimitive = Primitive | Function;\n\nexport type DeepOmitArray<T extends any[], K> = {\n [P in keyof T]: DeepOmit<T[P], K>;\n};\n\n// Unfortunately there is one major flaw in this type: This will omit properties\n// from class instances in the return type even though our omitDeep helper\n// ignores class instances, therefore resulting in a type mismatch between\n// the return value and the runtime value.\n//\n// It is not currently possible with TypeScript to distinguish between plain\n// objects and class instances.\n// https://github.com/microsoft/TypeScript/issues/29063\n//\n// This should be fine as of the time of this writing until omitDeep gets\n// broader use since this utility is only used to strip __typename from\n// `variables`; a case in which class instances are invalid anyways.\nexport type DeepOmit<T, K> =\n T extends DeepOmitPrimitive ? T\n : {\n [P in Exclude<keyof T, K>]: T[P] extends infer TP ?\n TP extends DeepOmitPrimitive ? TP\n : TP extends any[] ? DeepOmitArray<TP, K>\n : DeepOmit<TP, K>\n : never;\n };\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Primitive } from "./Primitive.js";
|
|
2
2
|
type DeepPartialPrimitive = Primitive | Date | RegExp;
|
|
3
|
-
export type DeepPartial<T> = T extends DeepPartialPrimitive ? T : T extends Map<infer TKey, infer TValue> ? DeepPartialMap<TKey, TValue> : T extends ReadonlyMap<infer TKey, infer TValue> ? DeepPartialReadonlyMap<TKey, TValue> : T extends Set<infer TItem> ? DeepPartialSet<TItem> : T extends ReadonlySet<infer TItem> ? DeepPartialReadonlySet<TItem> : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends ReadonlyArray<infer TItem> ? TItem[] extends T ? readonly TItem[] extends T ? ReadonlyArray<DeepPartial<TItem | undefined>> : Array<DeepPartial<TItem | undefined>> : DeepPartialObject<T> : DeepPartialObject<T> : unknown;
|
|
3
|
+
export type DeepPartial<T> = T extends DeepPartialPrimitive ? T : T extends Map<infer TKey, infer TValue> ? DeepPartialMap<TKey, TValue> : T extends ReadonlyMap<infer TKey, infer TValue> ? DeepPartialReadonlyMap<TKey, TValue> : T extends Set<infer TItem> ? DeepPartialSet<TItem> : T extends ReadonlySet<infer TItem> ? DeepPartialReadonlySet<TItem> : T extends (...args: any[]) => unknown ? T | undefined : T extends object ? T extends (ReadonlyArray<infer TItem>) ? TItem[] extends (T) ? readonly TItem[] extends T ? ReadonlyArray<DeepPartial<TItem | undefined>> : Array<DeepPartial<TItem | undefined>> : DeepPartialObject<T> : DeepPartialObject<T> : unknown;
|
|
4
4
|
type DeepPartialMap<TKey, TValue> = {} & Map<DeepPartial<TKey>, DeepPartial<TValue>>;
|
|
5
5
|
type DeepPartialReadonlyMap<TKey, TValue> = {} & ReadonlyMap<DeepPartial<TKey>, DeepPartial<TValue>>;
|
|
6
6
|
type DeepPartialSet<T> = {} & Set<DeepPartial<T>>;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
// Inspired by type-fest PartialDeep: https://github.com/sindresorhus/type-fest/blob/9feb8c89be9a0f2f688bf2f497230298a8e2472e/source/partial-deep.d.ts
|
|
2
|
+
//
|
|
3
|
+
// We're including the license to give credit to the original implementation.
|
|
4
|
+
// https://github.com/sindresorhus/type-fest/blob/main/license-mit
|
|
1
5
|
export {};
|
|
2
6
|
//# sourceMappingURL=DeepPartial.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeepPartial.js","sourceRoot":"","sources":["../../../src/utilities/types/DeepPartial.ts"],"names":[],"mappings":"","sourcesContent":["// Inspired by type-fest PartialDeep: https://github.com/sindresorhus/type-fest/blob/9feb8c89be9a0f2f688bf2f497230298a8e2472e/source/partial-deep.d.ts\n//\n// We're including the license to give credit to the original implementation.\n// https://github.com/sindresorhus/type-fest/blob/main/license-mit\n\n/*\n * MIT License\n *\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nimport type { Primitive } from \"./Primitive.js\";\n\ntype DeepPartialPrimitive = Primitive | Date | RegExp;\n\nexport type DeepPartial<T>
|
|
1
|
+
{"version":3,"file":"DeepPartial.js","sourceRoot":"","sources":["../../../src/utilities/types/DeepPartial.ts"],"names":[],"mappings":"AAAA,sJAAsJ;AACtJ,EAAE;AACF,6EAA6E;AAC7E,kEAAkE","sourcesContent":["// Inspired by type-fest PartialDeep: https://github.com/sindresorhus/type-fest/blob/9feb8c89be9a0f2f688bf2f497230298a8e2472e/source/partial-deep.d.ts\n//\n// We're including the license to give credit to the original implementation.\n// https://github.com/sindresorhus/type-fest/blob/main/license-mit\n\n/*\n * MIT License\n *\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nimport type { Primitive } from \"./Primitive.js\";\n\ntype DeepPartialPrimitive = Primitive | Date | RegExp;\n\nexport type DeepPartial<T> =\n T extends DeepPartialPrimitive ? T\n : T extends Map<infer TKey, infer TValue> ? DeepPartialMap<TKey, TValue>\n : T extends ReadonlyMap<infer TKey, infer TValue> ?\n DeepPartialReadonlyMap<TKey, TValue>\n : T extends Set<infer TItem> ? DeepPartialSet<TItem>\n : T extends ReadonlySet<infer TItem> ? DeepPartialReadonlySet<TItem>\n : T extends (...args: any[]) => unknown ? T | undefined\n : T extends object ?\n T extends (\n ReadonlyArray<infer TItem> // Test for arrays/tuples\n ) ?\n TItem[] extends (\n T // Test for non-tuples\n ) ?\n readonly TItem[] extends T ?\n ReadonlyArray<DeepPartial<TItem | undefined>>\n : Array<DeepPartial<TItem | undefined>>\n : DeepPartialObject<T>\n : DeepPartialObject<T>\n : unknown;\n\ntype DeepPartialMap<TKey, TValue> = {} & Map<\n DeepPartial<TKey>,\n DeepPartial<TValue>\n>;\n\ntype DeepPartialReadonlyMap<TKey, TValue> = {} & ReadonlyMap<\n DeepPartial<TKey>,\n DeepPartial<TValue>\n>;\n\ntype DeepPartialSet<T> = {} & Set<DeepPartial<T>>;\ntype DeepPartialReadonlySet<T> = {} & ReadonlySet<DeepPartial<T>>;\n\ntype DeepPartialObject<T extends object> = {\n [K in keyof T]?: DeepPartial<T[K]>;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IsStrictlyAny.js","sourceRoot":"","sources":["../../../src/utilities/types/IsStrictlyAny.ts"],"names":[],"mappings":"","sourcesContent":["// Returns true if T is any, or false for any other type.\n// Inspired by https://stackoverflow.com/a/61625296/128454.\nexport type IsStrictlyAny<T>
|
|
1
|
+
{"version":3,"file":"IsStrictlyAny.js","sourceRoot":"","sources":["../../../src/utilities/types/IsStrictlyAny.ts"],"names":[],"mappings":"","sourcesContent":["// Returns true if T is any, or false for any other type.\n// Inspired by https://stackoverflow.com/a/61625296/128454.\nexport type IsStrictlyAny<T> =\n UnionToIntersection<UnionForAny<T>> extends never ? true : false;\n\n// If (and only if) T is any, the union 'a' | 1 is returned here, representing\n// both branches of this conditional type. Only UnionForAny<any> produces this\n// union type; all other inputs produce the 1 literal type.\ntype UnionForAny<T> = T extends never ? \"a\" : 1;\n\n// If that 'a' | 1 union is then passed to UnionToIntersection, the result\n// should be 'a' & 1, which TypeScript simplifies to the never type, since the\n// literal type 'a' and the literal type 1 are incompatible. More explanation of\n// this helper type: https://stackoverflow.com/a/50375286/62076.\ntype UnionToIntersection<U> =\n (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I\n : never;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TODO.js","sourceRoot":"","sources":["../../../src/utilities/types/TODO.ts"],"names":[],"mappings":"","sourcesContent":["/** @internal */\nexport type TODO = any;\n"]}
|
package/utilities/utilities.cjs
CHANGED
|
@@ -88,7 +88,8 @@ var canUseWeakSet = typeof WeakSet === "function";
|
|
|
88
88
|
var canUseSymbol = typeof Symbol === "function" && typeof Symbol.for === "function";
|
|
89
89
|
var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;
|
|
90
90
|
var canUseDOM = typeof globals.maybe(function () { return window.document.createElement; }) === "function";
|
|
91
|
-
var usingJSDOM =
|
|
91
|
+
var usingJSDOM =
|
|
92
|
+
globals.maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false;
|
|
92
93
|
var canUseLayoutEffect = canUseDOM && !usingJSDOM;
|
|
93
94
|
|
|
94
95
|
function isNonNullObject(obj) {
|
|
@@ -279,8 +280,8 @@ var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
|
|
|
279
280
|
directives["connection"]["key"]) {
|
|
280
281
|
if (directives["connection"]["filter"] &&
|
|
281
282
|
directives["connection"]["filter"].length > 0) {
|
|
282
|
-
var filterKeys = directives["connection"]["filter"]
|
|
283
|
-
|
|
283
|
+
var filterKeys = directives["connection"]["filter"] ?
|
|
284
|
+
directives["connection"]["filter"]
|
|
284
285
|
: [];
|
|
285
286
|
filterKeys.sort();
|
|
286
287
|
var filteredArgs_1 = {};
|
|
@@ -463,12 +464,10 @@ function getDefaultValues(definition) {
|
|
|
463
464
|
function identity(document) {
|
|
464
465
|
return document;
|
|
465
466
|
}
|
|
466
|
-
var DocumentTransform =
|
|
467
|
+
var DocumentTransform = (function () {
|
|
467
468
|
function DocumentTransform(transform, options) {
|
|
468
469
|
if (options === void 0) { options = Object.create(null); }
|
|
469
|
-
this.resultCache = canUseWeakSet
|
|
470
|
-
? new WeakSet()
|
|
471
|
-
: new Set();
|
|
470
|
+
this.resultCache = canUseWeakSet ? new WeakSet() : new Set();
|
|
472
471
|
this.transform = transform;
|
|
473
472
|
if (options.getCacheKey) {
|
|
474
473
|
this.getCacheKey = options.getCacheKey;
|
|
@@ -488,7 +487,8 @@ var DocumentTransform = (function () {
|
|
|
488
487
|
return new DocumentTransform(function (document) {
|
|
489
488
|
var documentTransform = predicate(document) ? left : right;
|
|
490
489
|
return documentTransform.transformDocument(document);
|
|
491
|
-
},
|
|
490
|
+
},
|
|
491
|
+
{ cache: false });
|
|
492
492
|
};
|
|
493
493
|
DocumentTransform.prototype.transformDocument = function (document) {
|
|
494
494
|
if (this.resultCache.has(document)) {
|
|
@@ -510,7 +510,8 @@ var DocumentTransform = (function () {
|
|
|
510
510
|
var _this = this;
|
|
511
511
|
return new DocumentTransform(function (document) {
|
|
512
512
|
return otherTransform.transformDocument(_this.transformDocument(document));
|
|
513
|
-
},
|
|
513
|
+
},
|
|
514
|
+
{ cache: false });
|
|
514
515
|
};
|
|
515
516
|
DocumentTransform.prototype.getStableCacheEntry = function (document) {
|
|
516
517
|
if (!this.stableCacheKeys)
|
|
@@ -555,8 +556,8 @@ function isEmpty(op, fragmentMap) {
|
|
|
555
556
|
}));
|
|
556
557
|
}
|
|
557
558
|
function nullIfDocIsEmpty(doc) {
|
|
558
|
-
return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))
|
|
559
|
-
|
|
559
|
+
return (isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))) ?
|
|
560
|
+
null
|
|
560
561
|
: doc;
|
|
561
562
|
}
|
|
562
563
|
function getDirectiveMatcher(configs) {
|
|
@@ -676,7 +677,8 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
676
677
|
if (node === originalNode) {
|
|
677
678
|
return node;
|
|
678
679
|
}
|
|
679
|
-
if (
|
|
680
|
+
if (
|
|
681
|
+
operationCount > 0 &&
|
|
680
682
|
node.selectionSet.selections.every(function (selection) {
|
|
681
683
|
return selection.kind === graphql.Kind.FIELD &&
|
|
682
684
|
selection.name.value === "__typename";
|
|
@@ -731,7 +733,8 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
731
733
|
});
|
|
732
734
|
});
|
|
733
735
|
var fragmentWillBeRemoved = function (fragmentName) {
|
|
734
|
-
return !!(
|
|
736
|
+
return !!(
|
|
737
|
+
(!allFragmentNamesUsed.has(fragmentName) ||
|
|
735
738
|
getInUseByFragmentName(fragmentName).removed));
|
|
736
739
|
};
|
|
737
740
|
var enterVisitor = {
|
|
@@ -747,7 +750,8 @@ function removeDirectivesFromDocument(directives, doc) {
|
|
|
747
750
|
OperationDefinition: {
|
|
748
751
|
leave: function (node) {
|
|
749
752
|
if (node.variableDefinitions) {
|
|
750
|
-
var usedVariableNames_1 = populateTransitiveVars(
|
|
753
|
+
var usedVariableNames_1 = populateTransitiveVars(
|
|
754
|
+
getInUseByOperationName(node.name && node.name.value)).transitiveVars;
|
|
751
755
|
if (usedVariableNames_1.size < node.variableDefinitions.length) {
|
|
752
756
|
return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions.filter(function (varDef) {
|
|
753
757
|
return usedVariableNames_1.has(varDef.variable.name.value);
|
|
@@ -825,8 +829,9 @@ function removeArgumentsFromDocument(config, doc) {
|
|
|
825
829
|
return nullIfDocIsEmpty(graphql.visit(doc, {
|
|
826
830
|
OperationDefinition: {
|
|
827
831
|
enter: function (node) {
|
|
828
|
-
return tslib.__assign(tslib.__assign({}, node), {
|
|
829
|
-
|
|
832
|
+
return tslib.__assign(tslib.__assign({}, node), {
|
|
833
|
+
variableDefinitions: node.variableDefinitions ?
|
|
834
|
+
node.variableDefinitions.filter(function (varDef) {
|
|
830
835
|
return !config.some(function (arg) { return arg.name === varDef.variable.name.value; });
|
|
831
836
|
})
|
|
832
837
|
: [] });
|
|
@@ -932,7 +937,7 @@ function mergeDeepArray(sources) {
|
|
|
932
937
|
var defaultReconciler = function (target, source, property) {
|
|
933
938
|
return this.merge(target[property], source[property]);
|
|
934
939
|
};
|
|
935
|
-
var DeepMerger =
|
|
940
|
+
var DeepMerger = (function () {
|
|
936
941
|
function DeepMerger(reconciler) {
|
|
937
942
|
if (reconciler === void 0) { reconciler = defaultReconciler; }
|
|
938
943
|
this.reconciler = reconciler;
|
|
@@ -1040,7 +1045,8 @@ function relayStylePagination(keyArgs) {
|
|
|
1040
1045
|
firstEdgeCursor = "";
|
|
1041
1046
|
}
|
|
1042
1047
|
var _b = existing.pageInfo || {}, startCursor = _b.startCursor, endCursor = _b.endCursor;
|
|
1043
|
-
return tslib.__assign(tslib.__assign({}, getExtras(existing)), { edges: edges, pageInfo: tslib.__assign(tslib.__assign({}, existing.pageInfo), {
|
|
1048
|
+
return tslib.__assign(tslib.__assign({}, getExtras(existing)), { edges: edges, pageInfo: tslib.__assign(tslib.__assign({}, existing.pageInfo), {
|
|
1049
|
+
startCursor: startCursor || firstEdgeCursor, endCursor: endCursor || lastEdgeCursor }) });
|
|
1044
1050
|
},
|
|
1045
1051
|
merge: function (existing, incoming, _a) {
|
|
1046
1052
|
var args = _a.args, isReference = _a.isReference, readField = _a.readField;
|
|
@@ -1050,8 +1056,8 @@ function relayStylePagination(keyArgs) {
|
|
|
1050
1056
|
if (!incoming) {
|
|
1051
1057
|
return existing;
|
|
1052
1058
|
}
|
|
1053
|
-
var incomingEdges = incoming.edges
|
|
1054
|
-
|
|
1059
|
+
var incomingEdges = incoming.edges ?
|
|
1060
|
+
incoming.edges.map(function (edge) {
|
|
1055
1061
|
if (isReference((edge = tslib.__assign({}, edge)))) {
|
|
1056
1062
|
edge.cursor = readField("cursor", edge);
|
|
1057
1063
|
}
|
|
@@ -1258,8 +1264,8 @@ function asyncMap(observable, mapFn, catchFn) {
|
|
|
1258
1264
|
return function (arg) {
|
|
1259
1265
|
if (examiner) {
|
|
1260
1266
|
var both = function () {
|
|
1261
|
-
return observer.closed
|
|
1262
|
-
|
|
1267
|
+
return observer.closed ?
|
|
1268
|
+
0
|
|
1263
1269
|
: examiner(arg);
|
|
1264
1270
|
};
|
|
1265
1271
|
promiseQueue = promiseQueue.then(both, both).then(function (result) { return observer.next(result); }, function (error) { return observer.error(error); });
|
|
@@ -1273,7 +1279,7 @@ function asyncMap(observable, mapFn, catchFn) {
|
|
|
1273
1279
|
next: makeCallback(mapFn, "next"),
|
|
1274
1280
|
error: makeCallback(catchFn, "error"),
|
|
1275
1281
|
complete: function () {
|
|
1276
|
-
|
|
1282
|
+
promiseQueue.then(function () { return observer.complete(); });
|
|
1277
1283
|
},
|
|
1278
1284
|
};
|
|
1279
1285
|
var sub = observable.subscribe(handler);
|
|
@@ -1295,7 +1301,7 @@ function fixObservableSubclass(subclass) {
|
|
|
1295
1301
|
function isPromiseLike(value) {
|
|
1296
1302
|
return value && typeof value.then === "function";
|
|
1297
1303
|
}
|
|
1298
|
-
var Concast =
|
|
1304
|
+
var Concast = (function (_super) {
|
|
1299
1305
|
tslib.__extends(Concast, _super);
|
|
1300
1306
|
function Concast(sources) {
|
|
1301
1307
|
var _this = _super.call(this, function (observer) {
|
|
@@ -1458,9 +1464,7 @@ function graphQLResultHasError(result) {
|
|
|
1458
1464
|
return isNonEmptyArray(errors);
|
|
1459
1465
|
}
|
|
1460
1466
|
function getGraphQLErrorsFromResult(result) {
|
|
1461
|
-
var graphQLErrors = isNonEmptyArray(result.errors)
|
|
1462
|
-
? result.errors.slice(0)
|
|
1463
|
-
: [];
|
|
1467
|
+
var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];
|
|
1464
1468
|
if (isExecutionPatchIncrementalResult(result) &&
|
|
1465
1469
|
isNonEmptyArray(result.incremental)) {
|
|
1466
1470
|
result.incremental.forEach(function (incrementalResult) {
|