@apollo/client 3.8.0 → 3.8.2
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 +715 -587
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +253 -191
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +253 -191
- package/cache/core/cache.d.ts +4 -4
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js +10 -7
- 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 +0 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +6 -6
- package/cache/core/types/DataProxy.d.ts.map +1 -1
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/core/types/common.d.ts +3 -3
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/index.d.ts +20 -20
- 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 +6 -6
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +38 -30
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fixPolyfills.native.d.ts.map +1 -1
- package/cache/inmemory/fixPolyfills.native.js +10 -9
- package/cache/inmemory/fixPolyfills.native.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.d.ts.map +1 -1
- package/cache/inmemory/fragmentRegistry.js +6 -4
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +6 -6
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js +16 -14
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +9 -9
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +29 -33
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.d.ts.map +1 -1
- package/cache/inmemory/key-extractor.js +55 -49
- 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 +5 -5
- 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 +74 -45
- 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 +5 -5
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +7 -7
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +21 -17
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +7 -7
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/types.js +0 -2
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +7 -7
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +40 -30
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/setup.d.ts +2 -2
- package/config/jest/setup.js +5 -5
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.d.ts +11 -11
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +64 -50
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +6 -6
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +17 -16
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +12 -10
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +57 -38
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +11 -11
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +28 -34
- 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 +117 -93
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +255 -199
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +255 -199
- package/core/networkStatus.js.map +1 -1
- package/core/types.d.ts +13 -13
- package/core/types.d.ts.map +1 -1
- package/core/types.js +0 -1
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +11 -11
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +44 -40
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +44 -40
- package/errors/errors.cjs +7 -5
- package/errors/errors.cjs.map +1 -1
- package/errors/errors.cjs.native.js +7 -5
- package/errors/index.d.ts +4 -4
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +9 -7
- package/errors/index.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/invariantErrorCodes.d.ts.map +1 -1
- package/invariantErrorCodes.js +36 -36
- package/invariantErrorCodes.js.map +1 -1
- package/link/batch/batch.cjs +4 -4
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +4 -4
- package/link/batch/batchLink.d.ts +6 -6
- package/link/batch/batchLink.d.ts.map +1 -1
- package/link/batch/batchLink.js +4 -4
- 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 +4 -4
- package/link/batch/batching.js.map +1 -1
- package/link/batch/index.d.ts +1 -1
- package/link/batch/index.js +1 -1
- package/link/batch/index.js.map +1 -1
- package/link/batch-http/batch-http.cjs +13 -11
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +13 -11
- package/link/batch-http/batchHttpLink.d.ts +6 -6
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +17 -15
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/batch-http/index.d.ts +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.js +2 -2
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +3 -3
- 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.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.js +1 -1
- package/link/core/empty.js.map +1 -1
- package/link/core/execute.d.ts +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.js +1 -1
- package/link/core/from.js.map +1 -1
- package/link/core/index.d.ts +8 -8
- 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.js +1 -1
- package/link/core/split.js.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 +5 -5
- 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.js +2 -2
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.d.ts +1 -1
- package/link/http/checkFetcher.d.ts.map +1 -1
- package/link/http/checkFetcher.js +2 -2
- 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 +27 -26
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/createSignalIfSupported.js +1 -1
- package/link/http/createSignalIfSupported.js.map +1 -1
- package/link/http/http.cjs +64 -41
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +64 -41
- package/link/http/index.d.ts +13 -13
- package/link/http/index.js +10 -10
- package/link/http/index.js.map +1 -1
- package/link/http/iterators/nodeStream.d.ts.map +1 -1
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +2 -2
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/responseIterator.d.ts.map +1 -1
- package/link/http/responseIterator.js +20 -1
- package/link/http/responseIterator.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +1 -1
- package/link/http/rewriteURIForGET.js +12 -12
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +5 -5
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +8 -7
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.d.ts +1 -1
- package/link/http/selectURI.js +2 -2
- package/link/http/selectURI.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.d.ts +4 -4
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +26 -25
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +22 -17
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +22 -17
- package/link/retry/delayFunction.d.ts +1 -1
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/index.d.ts +1 -1
- package/link/retry/index.js +1 -1
- package/link/retry/index.js.map +1 -1
- package/link/retry/retry.cjs +2 -2
- package/link/retry/retry.cjs.map +1 -1
- package/link/retry/retry.cjs.native.js +2 -2
- package/link/retry/retryFunction.d.ts +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 +6 -6
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +4 -4
- package/link/schema/index.d.ts.map +1 -1
- package/link/schema/index.js +13 -8
- package/link/schema/index.js.map +1 -1
- package/link/schema/schema.cjs +10 -5
- package/link/schema/schema.cjs.map +1 -1
- package/link/schema/schema.cjs.native.js +10 -5
- 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.js +3 -3
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/filterOperationVariables.d.ts +1 -1
- package/link/utils/filterOperationVariables.js +2 -2
- package/link/utils/filterOperationVariables.js.map +1 -1
- package/link/utils/fromError.d.ts +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.js +1 -1
- package/link/utils/fromPromise.js.map +1 -1
- package/link/utils/index.d.ts +10 -10
- package/link/utils/index.js +9 -9
- package/link/utils/index.js.map +1 -1
- package/link/utils/throwServerError.js +1 -1
- package/link/utils/throwServerError.js.map +1 -1
- package/link/utils/toPromise.d.ts +1 -1
- package/link/utils/toPromise.js +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/transformOperation.d.ts +1 -1
- package/link/utils/transformOperation.js +3 -3
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/utils.cjs +12 -12
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +12 -12
- package/link/utils/validateOperation.d.ts +1 -1
- package/link/utils/validateOperation.js +6 -6
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +5 -5
- package/link/ws/index.js +2 -2
- package/link/ws/index.js.map +1 -1
- package/link/ws/ws.cjs.map +1 -1
- package/package.json +27 -27
- package/react/cache/QueryReference.d.ts +1 -1
- package/react/cache/QueryReference.d.ts.map +1 -1
- package/react/cache/QueryReference.js +2 -0
- package/react/cache/QueryReference.js.map +1 -1
- package/react/hooks/constants.js +1 -1
- package/react/hooks/constants.js.map +1 -1
- package/react/hooks/hooks.cjs +10 -21
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +10 -21
- package/react/hooks/useBackgroundQuery.d.ts +1 -1
- package/react/hooks/useBackgroundQuery.d.ts.map +1 -1
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +1 -8
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.d.ts.map +1 -1
- package/react/hooks/useReactiveVar.js +7 -12
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +1 -1
- package/react/hooks/useReadQuery.d.ts.map +1 -1
- package/react/hooks/useReadQuery.js +1 -1
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +1 -1
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/react.cjs +2 -0
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +2 -0
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +37 -28
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +37 -28
- package/testing/core/itAsync.d.ts.map +1 -1
- package/testing/core/itAsync.js +8 -4
- package/testing/core/itAsync.js.map +1 -1
- package/testing/core/mocking/mockClient.d.ts +3 -3
- package/testing/core/mocking/mockClient.d.ts.map +1 -1
- package/testing/core/mocking/mockClient.js +6 -4
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/core/mocking/mockFetch.d.ts +1 -1
- package/testing/core/mocking/mockFetch.d.ts.map +1 -1
- package/testing/core/mocking/mockFetch.js +3 -3
- package/testing/core/mocking/mockFetch.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 +24 -23
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts +2 -2
- 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.js +4 -4
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
- package/testing/core/mocking/mockWatchQuery.js +2 -2
- package/testing/core/mocking/mockWatchQuery.js.map +1 -1
- package/testing/core/observableToPromise.d.ts +3 -3
- package/testing/core/observableToPromise.d.ts.map +1 -1
- package/testing/core/observableToPromise.js +8 -4
- 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 +5 -3
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/core/wait.js.map +1 -1
- package/testing/core/withConsoleSpy.d.ts.map +1 -1
- package/testing/core/withConsoleSpy.js.map +1 -1
- package/testing/core/wrap.d.ts.map +1 -1
- package/testing/core/wrap.js +14 -12
- package/testing/core/wrap.js.map +1 -1
- package/testing/index.d.ts +4 -4
- package/testing/index.js +3 -3
- package/testing/index.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 +10 -11
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +3 -5
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +3 -5
- package/utilities/common/canUse.d.ts.map +1 -1
- package/utilities/common/canUse.js +4 -5
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/cloneDeep.js +2 -2
- package/utilities/common/cloneDeep.js.map +1 -1
- package/utilities/common/compact.d.ts +1 -1
- package/utilities/common/compact.js.map +1 -1
- package/utilities/common/filterInPlace.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.js +1 -1
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeDeep.js +3 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts.map +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/common/objects.js +2 -2
- package/utilities/common/objects.js.map +1 -1
- package/utilities/common/stringifyForDisplay.d.ts.map +1 -1
- package/utilities/common/stringifyForDisplay.js +3 -1
- package/utilities/common/stringifyForDisplay.js.map +1 -1
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js +3 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +8 -4
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +8 -4
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +1 -1
- package/utilities/globals/index.js.map +1 -1
- package/utilities/globals/invariantWrappers.js +1 -1
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/globals/maybe.d.ts.map +1 -1
- package/utilities/globals/maybe.js.map +1 -1
- package/utilities/graphql/directives.d.ts +1 -1
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +17 -13
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +12 -12
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts +1 -1
- package/utilities/graphql/getFromAST.js +16 -16
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +2 -2
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +36 -34
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +48 -32
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +0 -1
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +0 -1
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js +5 -9
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/Observable.d.ts +4 -4
- package/utilities/observables/Observable.d.ts.map +1 -1
- package/utilities/observables/Observable.js +6 -4
- package/utilities/observables/Observable.js.map +1 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js +5 -2
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/policies/pagination.d.ts +1 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +9 -7
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/types/IsStrictlyAny.d.ts +2 -2
- package/utilities/types/IsStrictlyAny.d.ts.map +1 -1
- package/utilities/types/IsStrictlyAny.js.map +1 -1
- package/utilities/utilities.cjs +147 -147
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +147 -147
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/utilities/common/responseIterator.d.ts +0 -10
- package/utilities/common/responseIterator.d.ts.map +0 -1
- package/utilities/common/responseIterator.js +0 -21
- package/utilities/common/responseIterator.js.map +0 -1
package/react/types/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/types/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from \"react\";\nimport type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type {\n Observable,\n ObservableSubscription,\n} from \"../../utilities/index.js\";\nimport type { FetchResult } from \"../../link/core/index.js\";\nimport type { ApolloError } from \"../../errors/index.js\";\nimport type {\n ApolloCache,\n ApolloClient,\n DefaultContext,\n FetchPolicy,\n MutationOptions,\n NetworkStatus,\n ObservableQuery,\n OperationVariables,\n InternalRefetchQueriesInclude,\n WatchQueryOptions,\n WatchQueryFetchPolicy,\n} from \"../../core/index.js\";\nimport type { SuspenseCache } from \"../cache/index.js\";\n\n/* QueryReference type */\n\nexport type { QueryReference } from \"../cache/QueryReference.js\";\n\n/* Common types */\n\nexport type { DefaultContext as Context } from \"../../core/index.js\";\n\nexport type CommonOptions<TOptions> = TOptions & {\n client?: ApolloClient<object>;\n};\n\n/* Query types */\n\nexport interface BaseQueryOptions<\n TVariables extends OperationVariables = OperationVariables\n> extends Omit<WatchQueryOptions<TVariables>, \"query\"> {\n ssr?: boolean;\n client?: ApolloClient<any>;\n context?: DefaultContext;\n}\n\nexport interface QueryFunctionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends BaseQueryOptions<TVariables> {\n skip?: boolean;\n onCompleted?: (data: TData) => void;\n onError?: (error: ApolloError) => void;\n\n // Default WatchQueryOptions for this useQuery, providing initial values for\n // unspecified options, superseding client.defaultOptions.watchQuery (option\n // by option, not whole), but never overriding options previously passed to\n // useQuery (or options added/modified later by other means).\n // TODO What about about default values that are expensive to evaluate?\n defaultOptions?: Partial<WatchQueryOptions<TVariables, TData>>;\n}\n\nexport type ObservableQueryFields<\n TData,\n TVariables extends OperationVariables\n> = Pick<\n ObservableQuery<TData, TVariables>,\n | \"startPolling\"\n | \"stopPolling\"\n | \"subscribeToMore\"\n | \"updateQuery\"\n | \"refetch\"\n | \"reobserve\"\n | \"variables\"\n | \"fetchMore\"\n>;\n\nexport interface QueryResult<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends ObservableQueryFields<TData, TVariables> {\n client: ApolloClient<any>;\n observable: ObservableQuery<TData, TVariables>;\n data: TData | undefined;\n previousData?: TData;\n error?: ApolloError;\n loading: boolean;\n networkStatus: NetworkStatus;\n called: boolean;\n}\n\nexport interface QueryDataOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends QueryFunctionOptions<TData, TVariables> {\n children?: (result: QueryResult<TData, TVariables>) => ReactNode;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface QueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends QueryFunctionOptions<TData, TVariables> {}\n\nexport interface LazyQueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends Omit<QueryHookOptions<TData, TVariables>, \"skip\"> {}\n\nexport interface LazyQueryHookExecOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends LazyQueryHookOptions<TData, TVariables> {\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport type SuspenseQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface SuspenseQueryHookOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n> extends Pick<\n QueryHookOptions<TData, TVariables>,\n | \"client\"\n | \"variables\"\n | \"errorPolicy\"\n | \"context\"\n | \"canonizeResults\"\n | \"returnPartialData\"\n | \"refetchWritePolicy\"\n > {\n fetchPolicy?: SuspenseQueryHookFetchPolicy;\n suspenseCache?: SuspenseCache;\n queryKey?: string | number | any[];\n\n /**\n * If `true`, the query is not executed. The default value is `false`.\n *\n * @deprecated We recommend using `skipToken` in place of the `skip` option as\n * it is more type-safe.\n *\n * @example Recommended usage of `skipToken`:\n * ```ts\n * import { skipToken, useSuspenseQuery } from '@apollo/client';\n *\n * const { data } = useSuspenseQuery(query, id ? { variables: { id } } : skipToken);\n * ```\n */\n skip?: boolean;\n}\n\nexport type BackgroundQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface BackgroundQueryHookOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables\n> extends Pick<\n QueryHookOptions<TData, TVariables>,\n | \"client\"\n | \"variables\"\n | \"errorPolicy\"\n | \"context\"\n | \"canonizeResults\"\n | \"returnPartialData\"\n | \"refetchWritePolicy\"\n > {\n fetchPolicy?: BackgroundQueryHookFetchPolicy;\n suspenseCache?: SuspenseCache;\n queryKey?: string | number | any[];\n\n /**\n * If `true`, the query is not executed. The default value is `false`.\n *\n * @deprecated We recommend using `skipToken` in place of the `skip` option as\n * it is more type-safe.\n *\n * @example Recommended usage of `skipToken`:\n * ```ts\n * import { skipToken, useBackgroundQuery } from '@apollo/client';\n *\n * const [queryRef] = useBackgroundQuery(query, id ? { variables: { id } } : skipToken);\n * ```\n */\n skip?: boolean;\n}\n\n/**\n * @deprecated TODO Delete this unused interface.\n */\nexport interface QueryLazyOptions<TVariables> {\n variables?: TVariables;\n context?: DefaultContext;\n}\n\n/**\n * @deprecated TODO Delete this unused type alias.\n */\nexport type LazyQueryResult<\n TData,\n TVariables extends OperationVariables\n> = QueryResult<TData, TVariables>;\n\n/**\n * @deprecated TODO Delete this unused type alias.\n */\nexport type QueryTuple<\n TData,\n TVariables extends OperationVariables\n> = LazyQueryResultTuple<TData, TVariables>;\n\nexport type LazyQueryExecFunction<\n TData,\n TVariables extends OperationVariables\n> = (\n options?: Partial<LazyQueryHookExecOptions<TData, TVariables>>\n) => Promise<QueryResult<TData, TVariables>>;\n\nexport type LazyQueryResultTuple<\n TData,\n TVariables extends OperationVariables\n> = [LazyQueryExecFunction<TData, TVariables>, QueryResult<TData, TVariables>];\n\n/* Mutation types */\n\nexport type RefetchQueriesFunction = (\n ...args: any[]\n) => InternalRefetchQueriesInclude;\n\nexport interface BaseMutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>\n> extends Omit<\n MutationOptions<TData, TVariables, TContext, TCache>,\n \"mutation\"\n > {\n client?: ApolloClient<object>;\n notifyOnNetworkStatusChange?: boolean;\n onCompleted?: (data: TData, clientOptions?: BaseMutationOptions) => void;\n onError?: (error: ApolloError, clientOptions?: BaseMutationOptions) => void;\n ignoreResults?: boolean;\n}\n\nexport interface MutationFunctionOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface MutationResult<TData = any> {\n data?: TData | null;\n error?: ApolloError;\n loading: boolean;\n called: boolean;\n client: ApolloClient<object>;\n reset(): void;\n}\n\nexport declare type MutationFunction<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>\n> = (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n) => Promise<FetchResult<TData>>;\n\nexport interface MutationHookOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {}\n\nexport interface MutationDataOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport type MutationTuple<\n TData,\n TVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>\n> = [\n (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n // TODO This FetchResult<TData> seems strange here, as opposed to an\n // ApolloQueryResult<TData>\n ) => Promise<FetchResult<TData>>,\n MutationResult<TData>\n];\n\n/* Subscription types */\n\nexport interface OnDataOptions<TData = any> {\n client: ApolloClient<object>;\n data: SubscriptionResult<TData>;\n}\n\nexport interface OnSubscriptionDataOptions<TData = any> {\n client: ApolloClient<object>;\n subscriptionData: SubscriptionResult<TData>;\n}\n\nexport interface BaseSubscriptionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> {\n variables?: TVariables;\n fetchPolicy?: FetchPolicy;\n shouldResubscribe?:\n | boolean\n | ((options: BaseSubscriptionOptions<TData, TVariables>) => boolean);\n client?: ApolloClient<object>;\n skip?: boolean;\n context?: DefaultContext;\n onComplete?: () => void;\n onData?: (options: OnDataOptions<TData>) => any;\n /**\n * @deprecated Use onData instead\n */\n onSubscriptionData?: (options: OnSubscriptionDataOptions<TData>) => any;\n onError?: (error: ApolloError) => void;\n /**\n * @deprecated Use onComplete instead\n */\n onSubscriptionComplete?: () => void;\n}\n\nexport interface SubscriptionResult<TData = any, TVariables = any> {\n loading: boolean;\n data?: TData;\n error?: ApolloError;\n // This was added by the legacy useSubscription type, and is tested in unit\n // tests, but probably shouldn’t be added to the result.\n variables?: TVariables;\n}\n\nexport interface SubscriptionHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends BaseSubscriptionOptions<TData, TVariables> {}\n\nexport interface SubscriptionDataOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends BaseSubscriptionOptions<TData, TVariables> {\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children?: null | ((result: SubscriptionResult<TData>) => JSX.Element | null);\n}\n\nexport interface SubscriptionCurrentObservable {\n query?: Observable<any>;\n subscription?: ObservableSubscription;\n}\n\n/**\nHelper type that allows using a type in a way that cannot be \"widened\" by inference on the value it is used on.\n\nThis type was first suggested [in this Github discussion](https://github.com/microsoft/TypeScript/issues/14829#issuecomment-504042546).\n\nExample usage:\n```ts\nexport function useQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: QueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> = Object.create(null),\n)\n```\nIn this case, `TData` and `TVariables` should be inferred from `query`, but never widened from something in `options`.\n\nSo, in this code example:\n```ts\ndeclare const typedNode: TypedDocumentNode<{ foo: string}, { bar: number }>\nconst { variables } = useQuery(typedNode, { variables: { bar: 4, nonExistingVariable: \"string\" } });\n```\nWithout the use of `NoInfer`, `variables` would now be of the type `{ bar: number, nonExistingVariable: \"string\" }`.\nWith `NoInfer`, it will instead give an error on `nonExistingVariable`.\n */\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/types/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from \"react\";\nimport type { DocumentNode } from \"graphql\";\nimport type { TypedDocumentNode } from \"@graphql-typed-document-node/core\";\n\nimport type {\n Observable,\n ObservableSubscription,\n} from \"../../utilities/index.js\";\nimport type { FetchResult } from \"../../link/core/index.js\";\nimport type { ApolloError } from \"../../errors/index.js\";\nimport type {\n ApolloCache,\n ApolloClient,\n DefaultContext,\n FetchPolicy,\n MutationOptions,\n NetworkStatus,\n ObservableQuery,\n OperationVariables,\n InternalRefetchQueriesInclude,\n WatchQueryOptions,\n WatchQueryFetchPolicy,\n} from \"../../core/index.js\";\nimport type { SuspenseCache } from \"../cache/index.js\";\n\n/* QueryReference type */\n\nexport type { QueryReference } from \"../cache/QueryReference.js\";\n\n/* Common types */\n\nexport type { DefaultContext as Context } from \"../../core/index.js\";\n\nexport type CommonOptions<TOptions> = TOptions & {\n client?: ApolloClient<object>;\n};\n\n/* Query types */\n\nexport interface BaseQueryOptions<\n TVariables extends OperationVariables = OperationVariables,\n> extends Omit<WatchQueryOptions<TVariables>, \"query\"> {\n ssr?: boolean;\n client?: ApolloClient<any>;\n context?: DefaultContext;\n}\n\nexport interface QueryFunctionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseQueryOptions<TVariables> {\n skip?: boolean;\n onCompleted?: (data: TData) => void;\n onError?: (error: ApolloError) => void;\n\n // Default WatchQueryOptions for this useQuery, providing initial values for\n // unspecified options, superseding client.defaultOptions.watchQuery (option\n // by option, not whole), but never overriding options previously passed to\n // useQuery (or options added/modified later by other means).\n // TODO What about about default values that are expensive to evaluate?\n defaultOptions?: Partial<WatchQueryOptions<TVariables, TData>>;\n}\n\nexport type ObservableQueryFields<\n TData,\n TVariables extends OperationVariables,\n> = Pick<\n ObservableQuery<TData, TVariables>,\n | \"startPolling\"\n | \"stopPolling\"\n | \"subscribeToMore\"\n | \"updateQuery\"\n | \"refetch\"\n | \"reobserve\"\n | \"variables\"\n | \"fetchMore\"\n>;\n\nexport interface QueryResult<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends ObservableQueryFields<TData, TVariables> {\n client: ApolloClient<any>;\n observable: ObservableQuery<TData, TVariables>;\n data: TData | undefined;\n previousData?: TData;\n error?: ApolloError;\n loading: boolean;\n networkStatus: NetworkStatus;\n called: boolean;\n}\n\nexport interface QueryDataOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryFunctionOptions<TData, TVariables> {\n children?: (result: QueryResult<TData, TVariables>) => ReactNode;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface QueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends QueryFunctionOptions<TData, TVariables> {}\n\nexport interface LazyQueryHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends Omit<QueryHookOptions<TData, TVariables>, \"skip\"> {}\n\nexport interface LazyQueryHookExecOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends LazyQueryHookOptions<TData, TVariables> {\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport type SuspenseQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface SuspenseQueryHookOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> extends Pick<\n QueryHookOptions<TData, TVariables>,\n | \"client\"\n | \"variables\"\n | \"errorPolicy\"\n | \"context\"\n | \"canonizeResults\"\n | \"returnPartialData\"\n | \"refetchWritePolicy\"\n > {\n fetchPolicy?: SuspenseQueryHookFetchPolicy;\n suspenseCache?: SuspenseCache;\n queryKey?: string | number | any[];\n\n /**\n * If `true`, the query is not executed. The default value is `false`.\n *\n * @deprecated We recommend using `skipToken` in place of the `skip` option as\n * it is more type-safe.\n *\n * @example Recommended usage of `skipToken`:\n * ```ts\n * import { skipToken, useSuspenseQuery } from '@apollo/client';\n *\n * const { data } = useSuspenseQuery(query, id ? { variables: { id } } : skipToken);\n * ```\n */\n skip?: boolean;\n}\n\nexport type BackgroundQueryHookFetchPolicy = Extract<\n WatchQueryFetchPolicy,\n \"cache-first\" | \"network-only\" | \"no-cache\" | \"cache-and-network\"\n>;\n\nexport interface BackgroundQueryHookOptions<\n TData = unknown,\n TVariables extends OperationVariables = OperationVariables,\n> extends Pick<\n QueryHookOptions<TData, TVariables>,\n | \"client\"\n | \"variables\"\n | \"errorPolicy\"\n | \"context\"\n | \"canonizeResults\"\n | \"returnPartialData\"\n | \"refetchWritePolicy\"\n > {\n fetchPolicy?: BackgroundQueryHookFetchPolicy;\n suspenseCache?: SuspenseCache;\n queryKey?: string | number | any[];\n\n /**\n * If `true`, the query is not executed. The default value is `false`.\n *\n * @deprecated We recommend using `skipToken` in place of the `skip` option as\n * it is more type-safe.\n *\n * @example Recommended usage of `skipToken`:\n * ```ts\n * import { skipToken, useBackgroundQuery } from '@apollo/client';\n *\n * const [queryRef] = useBackgroundQuery(query, id ? { variables: { id } } : skipToken);\n * ```\n */\n skip?: boolean;\n}\n\n/**\n * @deprecated TODO Delete this unused interface.\n */\nexport interface QueryLazyOptions<TVariables> {\n variables?: TVariables;\n context?: DefaultContext;\n}\n\n/**\n * @deprecated TODO Delete this unused type alias.\n */\nexport type LazyQueryResult<\n TData,\n TVariables extends OperationVariables,\n> = QueryResult<TData, TVariables>;\n\n/**\n * @deprecated TODO Delete this unused type alias.\n */\nexport type QueryTuple<\n TData,\n TVariables extends OperationVariables,\n> = LazyQueryResultTuple<TData, TVariables>;\n\nexport type LazyQueryExecFunction<\n TData,\n TVariables extends OperationVariables,\n> = (\n options?: Partial<LazyQueryHookExecOptions<TData, TVariables>>\n) => Promise<QueryResult<TData, TVariables>>;\n\nexport type LazyQueryResultTuple<\n TData,\n TVariables extends OperationVariables,\n> = [LazyQueryExecFunction<TData, TVariables>, QueryResult<TData, TVariables>];\n\n/* Mutation types */\n\nexport type RefetchQueriesFunction = (\n ...args: any[]\n) => InternalRefetchQueriesInclude;\n\nexport interface BaseMutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends Omit<\n MutationOptions<TData, TVariables, TContext, TCache>,\n \"mutation\"\n > {\n client?: ApolloClient<object>;\n notifyOnNetworkStatusChange?: boolean;\n onCompleted?: (data: TData, clientOptions?: BaseMutationOptions) => void;\n onError?: (error: ApolloError, clientOptions?: BaseMutationOptions) => void;\n ignoreResults?: boolean;\n}\n\nexport interface MutationFunctionOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface MutationResult<TData = any> {\n data?: TData | null;\n error?: ApolloError;\n loading: boolean;\n called: boolean;\n client: ApolloClient<object>;\n reset(): void;\n}\n\nexport declare type MutationFunction<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> = (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n) => Promise<FetchResult<TData>>;\n\nexport interface MutationHookOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {}\n\nexport interface MutationDataOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport type MutationTuple<\n TData,\n TVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> = [\n (\n options?: MutationFunctionOptions<TData, TVariables, TContext, TCache>\n // TODO This FetchResult<TData> seems strange here, as opposed to an\n // ApolloQueryResult<TData>\n ) => Promise<FetchResult<TData>>,\n MutationResult<TData>,\n];\n\n/* Subscription types */\n\nexport interface OnDataOptions<TData = any> {\n client: ApolloClient<object>;\n data: SubscriptionResult<TData>;\n}\n\nexport interface OnSubscriptionDataOptions<TData = any> {\n client: ApolloClient<object>;\n subscriptionData: SubscriptionResult<TData>;\n}\n\nexport interface BaseSubscriptionOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> {\n variables?: TVariables;\n fetchPolicy?: FetchPolicy;\n shouldResubscribe?:\n | boolean\n | ((options: BaseSubscriptionOptions<TData, TVariables>) => boolean);\n client?: ApolloClient<object>;\n skip?: boolean;\n context?: DefaultContext;\n onComplete?: () => void;\n onData?: (options: OnDataOptions<TData>) => any;\n /**\n * @deprecated Use onData instead\n */\n onSubscriptionData?: (options: OnSubscriptionDataOptions<TData>) => any;\n onError?: (error: ApolloError) => void;\n /**\n * @deprecated Use onComplete instead\n */\n onSubscriptionComplete?: () => void;\n}\n\nexport interface SubscriptionResult<TData = any, TVariables = any> {\n loading: boolean;\n data?: TData;\n error?: ApolloError;\n // This was added by the legacy useSubscription type, and is tested in unit\n // tests, but probably shouldn’t be added to the result.\n variables?: TVariables;\n}\n\nexport interface SubscriptionHookOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseSubscriptionOptions<TData, TVariables> {}\n\nexport interface SubscriptionDataOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n> extends BaseSubscriptionOptions<TData, TVariables> {\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children?: null | ((result: SubscriptionResult<TData>) => JSX.Element | null);\n}\n\nexport interface SubscriptionCurrentObservable {\n query?: Observable<any>;\n subscription?: ObservableSubscription;\n}\n\n/**\nHelper type that allows using a type in a way that cannot be \"widened\" by inference on the value it is used on.\n\nThis type was first suggested [in this Github discussion](https://github.com/microsoft/TypeScript/issues/14829#issuecomment-504042546).\n\nExample usage:\n```ts\nexport function useQuery<\n TData = any,\n TVariables extends OperationVariables = OperationVariables,\n>(\n query: DocumentNode | TypedDocumentNode<TData, TVariables>,\n options: QueryHookOptions<NoInfer<TData>, NoInfer<TVariables>> = Object.create(null),\n)\n```\nIn this case, `TData` and `TVariables` should be inferred from `query`, but never widened from something in `options`.\n\nSo, in this code example:\n```ts\ndeclare const typedNode: TypedDocumentNode<{ foo: string}, { bar: number }>\nconst { variables } = useQuery(typedNode, { variables: { bar: 4, nonExistingVariable: \"string\" } });\n```\nWithout the use of `NoInfer`, `variables` would now be of the type `{ bar: number, nonExistingVariable: \"string\" }`.\nWith `NoInfer`, it will instead give an error on `nonExistingVariable`.\n */\nexport type NoInfer<T> = [T][T extends any ? 0 : never];\n"]}
|
package/testing/core/core.cjs
CHANGED
|
@@ -21,9 +21,8 @@ var MockLink = (function (_super) {
|
|
|
21
21
|
function MockLink(mockedResponses, addTypename, options) {
|
|
22
22
|
if (addTypename === void 0) { addTypename = true; }
|
|
23
23
|
if (options === void 0) { options = Object.create(null); }
|
|
24
|
-
var _this = this;
|
|
25
24
|
var _a;
|
|
26
|
-
_this = _super.call(this) || this;
|
|
25
|
+
var _this = _super.call(this) || this;
|
|
27
26
|
_this.addTypename = true;
|
|
28
27
|
_this.showWarnings = true;
|
|
29
28
|
_this.mockedResponsesByKey = {};
|
|
@@ -53,24 +52,26 @@ var MockLink = (function (_super) {
|
|
|
53
52
|
var unmatchedVars = [];
|
|
54
53
|
var requestVariables = operation.variables || {};
|
|
55
54
|
var mockedResponses = this.mockedResponsesByKey[key];
|
|
56
|
-
var responseIndex = mockedResponses
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
var responseIndex = mockedResponses
|
|
56
|
+
? mockedResponses.findIndex(function (res, index) {
|
|
57
|
+
var mockedResponseVars = res.request.variables || {};
|
|
58
|
+
if (equality.equal(requestVariables, mockedResponseVars)) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
unmatchedVars.push(mockedResponseVars);
|
|
62
|
+
return false;
|
|
63
|
+
})
|
|
64
|
+
: -1;
|
|
65
|
+
var response = responseIndex >= 0 ? mockedResponses[responseIndex] : void 0;
|
|
67
66
|
var configError;
|
|
68
67
|
if (!response) {
|
|
69
|
-
configError = new Error("No more mocked responses for the query: ".concat(utilities.print(operation.query), "\nExpected variables: ").concat(utilities.stringifyForDisplay(operation.variables), "\n").concat(unmatchedVars.length > 0
|
|
68
|
+
configError = new Error("No more mocked responses for the query: ".concat(utilities.print(operation.query), "\nExpected variables: ").concat(utilities.stringifyForDisplay(operation.variables), "\n").concat(unmatchedVars.length > 0
|
|
69
|
+
? "\nFailed to match ".concat(unmatchedVars.length, " mock").concat(unmatchedVars.length === 1 ? "" : "s", " for this query. The mocked response had the following variables:\n").concat(unmatchedVars.map(function (d) { return " ".concat(utilities.stringifyForDisplay(d)); }).join("\n"), "\n")
|
|
70
|
+
: ""));
|
|
70
71
|
if (this.showWarnings) {
|
|
71
72
|
console.warn(configError.message +
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
"\nThis typically indicates a configuration error in your mocks " +
|
|
74
|
+
"setup, usually due to a typo or mismatched variable.");
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
else {
|
|
@@ -102,14 +103,14 @@ var MockLink = (function (_super) {
|
|
|
102
103
|
}
|
|
103
104
|
else {
|
|
104
105
|
if (response.result) {
|
|
105
|
-
observer.next(typeof response.result ===
|
|
106
|
+
observer.next(typeof response.result === "function"
|
|
106
107
|
? response.result()
|
|
107
108
|
: response.result);
|
|
108
109
|
}
|
|
109
110
|
observer.complete();
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
|
-
}, response && response.delay || 0);
|
|
113
|
+
}, (response && response.delay) || 0);
|
|
113
114
|
return function () {
|
|
114
115
|
clearTimeout(timer);
|
|
115
116
|
};
|
|
@@ -135,7 +136,7 @@ function mockSingleLink() {
|
|
|
135
136
|
}
|
|
136
137
|
var maybeTypename = mockedResponses[mockedResponses.length - 1];
|
|
137
138
|
var mocks = mockedResponses.slice(0, mockedResponses.length - 1);
|
|
138
|
-
if (typeof maybeTypename !==
|
|
139
|
+
if (typeof maybeTypename !== "boolean") {
|
|
139
140
|
mocks = mockedResponses;
|
|
140
141
|
maybeTypename = true;
|
|
141
142
|
}
|
|
@@ -168,7 +169,7 @@ var MockSubscriptionLink = (function (_super) {
|
|
|
168
169
|
setTimeout(function () {
|
|
169
170
|
var observers = _this.observers;
|
|
170
171
|
if (!observers.length)
|
|
171
|
-
throw new Error(
|
|
172
|
+
throw new Error("subscription torn down");
|
|
172
173
|
observers.forEach(function (observer) {
|
|
173
174
|
if (result.result && observer.next)
|
|
174
175
|
observer.next(result.result);
|
|
@@ -182,7 +183,7 @@ var MockSubscriptionLink = (function (_super) {
|
|
|
182
183
|
MockSubscriptionLink.prototype.simulateComplete = function () {
|
|
183
184
|
var observers = this.observers;
|
|
184
185
|
if (!observers.length)
|
|
185
|
-
throw new Error(
|
|
186
|
+
throw new Error("subscription torn down");
|
|
186
187
|
observers.forEach(function (observer) {
|
|
187
188
|
if (observer.complete)
|
|
188
189
|
observer.complete();
|
|
@@ -206,7 +207,9 @@ function createMockClient(data, query, variables) {
|
|
|
206
207
|
link: mockSingleLink({
|
|
207
208
|
request: { query: query, variables: variables },
|
|
208
209
|
result: { data: data },
|
|
209
|
-
}).setOnError(function (error) {
|
|
210
|
+
}).setOnError(function (error) {
|
|
211
|
+
throw error;
|
|
212
|
+
}),
|
|
210
213
|
cache: new cache.InMemoryCache({ addTypename: false }),
|
|
211
214
|
});
|
|
212
215
|
}
|
|
@@ -215,9 +218,11 @@ function subscribeAndCount(reject, observable, cb) {
|
|
|
215
218
|
var queue = Promise.resolve();
|
|
216
219
|
var handleCount = 0;
|
|
217
220
|
var subscription = utilities.asyncMap(observable, function (result) {
|
|
218
|
-
return queue = queue
|
|
221
|
+
return (queue = queue
|
|
222
|
+
.then(function () {
|
|
219
223
|
return cb(++handleCount, result);
|
|
220
|
-
})
|
|
224
|
+
})
|
|
225
|
+
.catch(error));
|
|
221
226
|
}).subscribe({ error: error });
|
|
222
227
|
function error(e) {
|
|
223
228
|
subscription.unsubscribe();
|
|
@@ -227,10 +232,14 @@ function subscribeAndCount(reject, observable, cb) {
|
|
|
227
232
|
}
|
|
228
233
|
|
|
229
234
|
function wrap(key) {
|
|
230
|
-
return function (message, callback, timeout) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
235
|
+
return function (message, callback, timeout) {
|
|
236
|
+
return (key ? it[key] : it)(message, function () {
|
|
237
|
+
var _this = this;
|
|
238
|
+
return new Promise(function (resolve, reject) {
|
|
239
|
+
return callback.call(_this, resolve, reject);
|
|
240
|
+
});
|
|
241
|
+
}, timeout);
|
|
242
|
+
};
|
|
234
243
|
}
|
|
235
244
|
var wrappedIt = wrap();
|
|
236
245
|
var itAsync = Object.assign(function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.cjs","sources":["mocking/mockLink.js","mocking/mockSubscriptionLink.js","mocking/mockClient.js","subscribeAndCount.js","itAsync.js","wait.js","withConsoleSpy.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { invariant } from '../../../utilities/globals/index.js';\nimport { equal } from '@wry/equality';\nimport { ApolloLink } from '../../../link/core/index.js';\nimport { Observable, addTypenameToDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, cloneDeep, stringifyForDisplay, print } from '../../../utilities/index.js';\nfunction requestToKey(request, addTypename) {\n var queryString = request.query &&\n print(addTypename ? addTypenameToDocument(request.query) : request.query);\n var requestKey = { query: queryString };\n return JSON.stringify(requestKey);\n}\nvar MockLink = (function (_super) {\n __extends(MockLink, _super);\n function MockLink(mockedResponses, addTypename, options) {\n if (addTypename === void 0) { addTypename = true; }\n if (options === void 0) { options = Object.create(null); }\n var _this = this;\n var _a;\n _this = _super.call(this) || this;\n _this.addTypename = true;\n _this.showWarnings = true;\n _this.mockedResponsesByKey = {};\n _this.addTypename = addTypename;\n _this.showWarnings = (_a = options.showWarnings) !== null && _a !== void 0 ? _a : true;\n if (mockedResponses) {\n mockedResponses.forEach(function (mockedResponse) {\n _this.addMockedResponse(mockedResponse);\n });\n }\n return _this;\n }\n MockLink.prototype.addMockedResponse = function (mockedResponse) {\n var normalizedMockedResponse = this.normalizeMockedResponse(mockedResponse);\n var key = requestToKey(normalizedMockedResponse.request, this.addTypename);\n var mockedResponses = this.mockedResponsesByKey[key];\n if (!mockedResponses) {\n mockedResponses = [];\n this.mockedResponsesByKey[key] = mockedResponses;\n }\n mockedResponses.push(normalizedMockedResponse);\n };\n MockLink.prototype.request = function (operation) {\n var _this = this;\n this.operation = operation;\n var key = requestToKey(operation, this.addTypename);\n var unmatchedVars = [];\n var requestVariables = operation.variables || {};\n var mockedResponses = this.mockedResponsesByKey[key];\n var responseIndex = mockedResponses ? mockedResponses.findIndex(function (res, index) {\n var mockedResponseVars = res.request.variables || {};\n if (equal(requestVariables, mockedResponseVars)) {\n return true;\n }\n unmatchedVars.push(mockedResponseVars);\n return false;\n }) : -1;\n var response = responseIndex >= 0\n ? mockedResponses[responseIndex]\n : void 0;\n var configError;\n if (!response) {\n configError = new Error(\"No more mocked responses for the query: \".concat(print(operation.query), \"\\nExpected variables: \").concat(stringifyForDisplay(operation.variables), \"\\n\").concat(unmatchedVars.length > 0 ? \"\\nFailed to match \".concat(unmatchedVars.length, \" mock\").concat(unmatchedVars.length === 1 ? \"\" : \"s\", \" for this query. The mocked response had the following variables:\\n\").concat(unmatchedVars.map(function (d) { return \" \".concat(stringifyForDisplay(d)); }).join('\\n'), \"\\n\") : \"\"));\n if (this.showWarnings) {\n console.warn(configError.message +\n '\\nThis typically indicates a configuration error in your mocks ' +\n 'setup, usually due to a typo or mismatched variable.');\n }\n }\n else {\n mockedResponses.splice(responseIndex, 1);\n var newData = response.newData;\n if (newData) {\n response.result = newData();\n mockedResponses.push(response);\n }\n if (!response.result && !response.error) {\n configError = new Error(\"Mocked response should contain either result or error: \".concat(key));\n }\n }\n return new Observable(function (observer) {\n var timer = setTimeout(function () {\n if (configError) {\n try {\n if (_this.onError(configError, observer) !== false) {\n throw configError;\n }\n }\n catch (error) {\n observer.error(error);\n }\n }\n else if (response) {\n if (response.error) {\n observer.error(response.error);\n }\n else {\n if (response.result) {\n observer.next(typeof response.result === 'function'\n ? response.result()\n : response.result);\n }\n observer.complete();\n }\n }\n }, response && response.delay || 0);\n return function () {\n clearTimeout(timer);\n };\n });\n };\n MockLink.prototype.normalizeMockedResponse = function (mockedResponse) {\n var newMockedResponse = cloneDeep(mockedResponse);\n var queryWithoutConnection = removeConnectionDirectiveFromDocument(newMockedResponse.request.query);\n invariant(queryWithoutConnection, 62);\n newMockedResponse.request.query = queryWithoutConnection;\n var query = removeClientSetsFromDocument(newMockedResponse.request.query);\n if (query) {\n newMockedResponse.request.query = query;\n }\n return newMockedResponse;\n };\n return MockLink;\n}(ApolloLink));\nexport { MockLink };\nexport function mockSingleLink() {\n var mockedResponses = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n mockedResponses[_i] = arguments[_i];\n }\n var maybeTypename = mockedResponses[mockedResponses.length - 1];\n var mocks = mockedResponses.slice(0, mockedResponses.length - 1);\n if (typeof maybeTypename !== 'boolean') {\n mocks = mockedResponses;\n maybeTypename = true;\n }\n return new MockLink(mocks, maybeTypename);\n}\n//# sourceMappingURL=mockLink.js.map","import { __extends } from \"tslib\";\nimport { Observable } from '../../../utilities/index.js';\nimport { ApolloLink } from '../../../link/core/index.js';\nvar MockSubscriptionLink = (function (_super) {\n __extends(MockSubscriptionLink, _super);\n function MockSubscriptionLink() {\n var _this = _super.call(this) || this;\n _this.unsubscribers = [];\n _this.setups = [];\n _this.observers = [];\n return _this;\n }\n MockSubscriptionLink.prototype.request = function (operation) {\n var _this = this;\n this.operation = operation;\n return new Observable(function (observer) {\n _this.setups.forEach(function (x) { return x(); });\n _this.observers.push(observer);\n return function () {\n _this.unsubscribers.forEach(function (x) { return x(); });\n };\n });\n };\n MockSubscriptionLink.prototype.simulateResult = function (result, complete) {\n var _this = this;\n if (complete === void 0) { complete = false; }\n setTimeout(function () {\n var observers = _this.observers;\n if (!observers.length)\n throw new Error('subscription torn down');\n observers.forEach(function (observer) {\n if (result.result && observer.next)\n observer.next(result.result);\n if (result.error && observer.error)\n observer.error(result.error);\n if (complete && observer.complete)\n observer.complete();\n });\n }, result.delay || 0);\n };\n MockSubscriptionLink.prototype.simulateComplete = function () {\n var observers = this.observers;\n if (!observers.length)\n throw new Error('subscription torn down');\n observers.forEach(function (observer) {\n if (observer.complete)\n observer.complete();\n });\n };\n MockSubscriptionLink.prototype.onSetup = function (listener) {\n this.setups = this.setups.concat([listener]);\n };\n MockSubscriptionLink.prototype.onUnsubscribe = function (listener) {\n this.unsubscribers = this.unsubscribers.concat([listener]);\n };\n return MockSubscriptionLink;\n}(ApolloLink));\nexport { MockSubscriptionLink };\nexport function mockObservableLink() {\n return new MockSubscriptionLink();\n}\n//# sourceMappingURL=mockSubscriptionLink.js.map","import { ApolloClient } from '../../../core/index.js';\nimport { InMemoryCache } from '../../../cache/index.js';\nimport { mockSingleLink } from './mockLink.js';\nexport function createMockClient(data, query, variables) {\n if (variables === void 0) { variables = {}; }\n return new ApolloClient({\n link: mockSingleLink({\n request: { query: query, variables: variables },\n result: { data: data },\n }).setOnError(function (error) { throw error; }),\n cache: new InMemoryCache({ addTypename: false }),\n });\n}\n//# sourceMappingURL=mockClient.js.map","import { asyncMap } from '../../utilities/index.js';\nexport default function subscribeAndCount(reject, observable, cb) {\n var queue = Promise.resolve();\n var handleCount = 0;\n var subscription = asyncMap(observable, function (result) {\n return queue = queue.then(function () {\n return cb(++handleCount, result);\n }).catch(error);\n }).subscribe({ error: error });\n function error(e) {\n subscription.unsubscribe();\n reject(e);\n }\n return subscription;\n}\n//# sourceMappingURL=subscribeAndCount.js.map","function wrap(key) {\n return function (message, callback, timeout) { return (key ? it[key] : it)(message, function () {\n var _this = this;\n return new Promise(function (resolve, reject) { return callback.call(_this, resolve, reject); });\n }, timeout); };\n}\nvar wrappedIt = wrap();\nexport var itAsync = Object.assign(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return wrappedIt.apply(this, args);\n}, {\n only: wrap(\"only\"),\n skip: wrap(\"skip\"),\n todo: wrap(\"todo\"),\n});\n//# sourceMappingURL=itAsync.js.map","import { __awaiter, __generator } from \"tslib\";\nexport function wait(ms) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2, new Promise(function (resolve) { return setTimeout(resolve, ms); })];\n });\n });\n}\nexport function tick() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2, wait(0)];\n });\n });\n}\n//# sourceMappingURL=wait.js.map","function wrapTestFunction(fn, consoleMethodName) {\n return function () {\n var _this = this;\n var args = arguments;\n var spy = jest.spyOn(console, consoleMethodName);\n spy.mockImplementation(function () { });\n return new Promise(function (resolve) {\n resolve(fn === null || fn === void 0 ? void 0 : fn.apply(_this, args));\n }).finally(function () {\n expect(spy).toMatchSnapshot();\n spy.mockReset();\n });\n };\n}\nexport function withErrorSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"error\");\n return it.apply(void 0, args);\n}\nexport function withWarningSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"warn\");\n return it.apply(void 0, args);\n}\nexport function withLogSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"log\");\n return it.apply(void 0, args);\n}\n//# sourceMappingURL=withConsoleSpy.js.map"],"names":["print","addTypenameToDocument","__extends","equal","stringifyForDisplay","Observable","cloneDeep","removeConnectionDirectiveFromDocument","invariant","removeClientSetsFromDocument","ApolloLink","ApolloClient","InMemoryCache","asyncMap","__awaiter","__generator"],"mappings":";;;;;;;;;;;;AAKA,SAAS,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE;AAC5C,IAAI,IAAI,WAAW,GAAG,OAAO,CAAC,KAAK;AACnC,QAAQA,eAAK,CAAC,WAAW,GAAGC,+BAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAClF,IAAI,IAAI,UAAU,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAC5C,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC;AACE,IAAC,QAAQ,IAAI,UAAU,MAAM,EAAE;AAClC,IAAIC,eAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;A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AAE,EAAE;AAClD,QAAQ,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;AACrC,KAAK;AACL,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAChD,IAAI,OAAO,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AACM,SAAS,UAAU,CAAC,EAAE,EAAE;AAC/B,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;AAClB,IAAI,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE;AAClD,QAAQ,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;AACrC,KAAK;AACL,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC/C,IAAI,OAAO,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;AAClC;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"core.cjs","sources":["mocking/mockLink.js","mocking/mockSubscriptionLink.js","mocking/mockClient.js","subscribeAndCount.js","itAsync.js","wait.js","withConsoleSpy.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { invariant } from \"../../../utilities/globals/index.js\";\nimport { equal } from \"@wry/equality\";\nimport { ApolloLink } from \"../../../link/core/index.js\";\nimport { Observable, addTypenameToDocument, removeClientSetsFromDocument, removeConnectionDirectiveFromDocument, cloneDeep, stringifyForDisplay, print, } from \"../../../utilities/index.js\";\nfunction requestToKey(request, addTypename) {\n var queryString = request.query &&\n print(addTypename ? addTypenameToDocument(request.query) : request.query);\n var requestKey = { query: queryString };\n return JSON.stringify(requestKey);\n}\nvar MockLink = (function (_super) {\n __extends(MockLink, _super);\n function MockLink(mockedResponses, addTypename, options) {\n if (addTypename === void 0) { addTypename = true; }\n if (options === void 0) { options = Object.create(null); }\n var _a;\n var _this = _super.call(this) || this;\n _this.addTypename = true;\n _this.showWarnings = true;\n _this.mockedResponsesByKey = {};\n _this.addTypename = addTypename;\n _this.showWarnings = (_a = options.showWarnings) !== null && _a !== void 0 ? _a : true;\n if (mockedResponses) {\n mockedResponses.forEach(function (mockedResponse) {\n _this.addMockedResponse(mockedResponse);\n });\n }\n return _this;\n }\n MockLink.prototype.addMockedResponse = function (mockedResponse) {\n var normalizedMockedResponse = this.normalizeMockedResponse(mockedResponse);\n var key = requestToKey(normalizedMockedResponse.request, this.addTypename);\n var mockedResponses = this.mockedResponsesByKey[key];\n if (!mockedResponses) {\n mockedResponses = [];\n this.mockedResponsesByKey[key] = mockedResponses;\n }\n mockedResponses.push(normalizedMockedResponse);\n };\n MockLink.prototype.request = function (operation) {\n var _this = this;\n this.operation = operation;\n var key = requestToKey(operation, this.addTypename);\n var unmatchedVars = [];\n var requestVariables = operation.variables || {};\n var mockedResponses = this.mockedResponsesByKey[key];\n var responseIndex = mockedResponses\n ? mockedResponses.findIndex(function (res, index) {\n var mockedResponseVars = res.request.variables || {};\n if (equal(requestVariables, mockedResponseVars)) {\n return true;\n }\n unmatchedVars.push(mockedResponseVars);\n return false;\n })\n : -1;\n var response = responseIndex >= 0 ? mockedResponses[responseIndex] : void 0;\n var configError;\n if (!response) {\n configError = new Error(\"No more mocked responses for the query: \".concat(print(operation.query), \"\\nExpected variables: \").concat(stringifyForDisplay(operation.variables), \"\\n\").concat(unmatchedVars.length > 0\n ? \"\\nFailed to match \".concat(unmatchedVars.length, \" mock\").concat(unmatchedVars.length === 1 ? \"\" : \"s\", \" for this query. The mocked response had the following variables:\\n\").concat(unmatchedVars.map(function (d) { return \" \".concat(stringifyForDisplay(d)); }).join(\"\\n\"), \"\\n\")\n : \"\"));\n if (this.showWarnings) {\n console.warn(configError.message +\n \"\\nThis typically indicates a configuration error in your mocks \" +\n \"setup, usually due to a typo or mismatched variable.\");\n }\n }\n else {\n mockedResponses.splice(responseIndex, 1);\n var newData = response.newData;\n if (newData) {\n response.result = newData();\n mockedResponses.push(response);\n }\n if (!response.result && !response.error) {\n configError = new Error(\"Mocked response should contain either result or error: \".concat(key));\n }\n }\n return new Observable(function (observer) {\n var timer = setTimeout(function () {\n if (configError) {\n try {\n if (_this.onError(configError, observer) !== false) {\n throw configError;\n }\n }\n catch (error) {\n observer.error(error);\n }\n }\n else if (response) {\n if (response.error) {\n observer.error(response.error);\n }\n else {\n if (response.result) {\n observer.next(typeof response.result === \"function\"\n ? response.result()\n : response.result);\n }\n observer.complete();\n }\n }\n }, (response && response.delay) || 0);\n return function () {\n clearTimeout(timer);\n };\n });\n };\n MockLink.prototype.normalizeMockedResponse = function (mockedResponse) {\n var newMockedResponse = cloneDeep(mockedResponse);\n var queryWithoutConnection = removeConnectionDirectiveFromDocument(newMockedResponse.request.query);\n invariant(queryWithoutConnection, 62);\n newMockedResponse.request.query = queryWithoutConnection;\n var query = removeClientSetsFromDocument(newMockedResponse.request.query);\n if (query) {\n newMockedResponse.request.query = query;\n }\n return newMockedResponse;\n };\n return MockLink;\n}(ApolloLink));\nexport { MockLink };\nexport function mockSingleLink() {\n var mockedResponses = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n mockedResponses[_i] = arguments[_i];\n }\n var maybeTypename = mockedResponses[mockedResponses.length - 1];\n var mocks = mockedResponses.slice(0, mockedResponses.length - 1);\n if (typeof maybeTypename !== \"boolean\") {\n mocks = mockedResponses;\n maybeTypename = true;\n }\n return new MockLink(mocks, maybeTypename);\n}\n//# sourceMappingURL=mockLink.js.map","import { __extends } from \"tslib\";\nimport { Observable } from \"../../../utilities/index.js\";\nimport { ApolloLink } from \"../../../link/core/index.js\";\nvar MockSubscriptionLink = (function (_super) {\n __extends(MockSubscriptionLink, _super);\n function MockSubscriptionLink() {\n var _this = _super.call(this) || this;\n _this.unsubscribers = [];\n _this.setups = [];\n _this.observers = [];\n return _this;\n }\n MockSubscriptionLink.prototype.request = function (operation) {\n var _this = this;\n this.operation = operation;\n return new Observable(function (observer) {\n _this.setups.forEach(function (x) { return x(); });\n _this.observers.push(observer);\n return function () {\n _this.unsubscribers.forEach(function (x) { return x(); });\n };\n });\n };\n MockSubscriptionLink.prototype.simulateResult = function (result, complete) {\n var _this = this;\n if (complete === void 0) { complete = false; }\n setTimeout(function () {\n var observers = _this.observers;\n if (!observers.length)\n throw new Error(\"subscription torn down\");\n observers.forEach(function (observer) {\n if (result.result && observer.next)\n observer.next(result.result);\n if (result.error && observer.error)\n observer.error(result.error);\n if (complete && observer.complete)\n observer.complete();\n });\n }, result.delay || 0);\n };\n MockSubscriptionLink.prototype.simulateComplete = function () {\n var observers = this.observers;\n if (!observers.length)\n throw new Error(\"subscription torn down\");\n observers.forEach(function (observer) {\n if (observer.complete)\n observer.complete();\n });\n };\n MockSubscriptionLink.prototype.onSetup = function (listener) {\n this.setups = this.setups.concat([listener]);\n };\n MockSubscriptionLink.prototype.onUnsubscribe = function (listener) {\n this.unsubscribers = this.unsubscribers.concat([listener]);\n };\n return MockSubscriptionLink;\n}(ApolloLink));\nexport { MockSubscriptionLink };\nexport function mockObservableLink() {\n return new MockSubscriptionLink();\n}\n//# sourceMappingURL=mockSubscriptionLink.js.map","import { ApolloClient } from \"../../../core/index.js\";\nimport { InMemoryCache } from \"../../../cache/index.js\";\nimport { mockSingleLink } from \"./mockLink.js\";\nexport function createMockClient(data, query, variables) {\n if (variables === void 0) { variables = {}; }\n return new ApolloClient({\n link: mockSingleLink({\n request: { query: query, variables: variables },\n result: { data: data },\n }).setOnError(function (error) {\n throw error;\n }),\n cache: new InMemoryCache({ addTypename: false }),\n });\n}\n//# sourceMappingURL=mockClient.js.map","import { asyncMap } from \"../../utilities/index.js\";\nexport default function subscribeAndCount(reject, observable, cb) {\n var queue = Promise.resolve();\n var handleCount = 0;\n var subscription = asyncMap(observable, function (result) {\n return (queue = queue\n .then(function () {\n return cb(++handleCount, result);\n })\n .catch(error));\n }).subscribe({ error: error });\n function error(e) {\n subscription.unsubscribe();\n reject(e);\n }\n return subscription;\n}\n//# sourceMappingURL=subscribeAndCount.js.map","function wrap(key) {\n return function (message, callback, timeout) {\n return (key ? it[key] : it)(message, function () {\n var _this = this;\n return new Promise(function (resolve, reject) {\n return callback.call(_this, resolve, reject);\n });\n }, timeout);\n };\n}\nvar wrappedIt = wrap();\nexport var itAsync = Object.assign(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return wrappedIt.apply(this, args);\n}, {\n only: wrap(\"only\"),\n skip: wrap(\"skip\"),\n todo: wrap(\"todo\"),\n});\n//# sourceMappingURL=itAsync.js.map","import { __awaiter, __generator } from \"tslib\";\nexport function wait(ms) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2, new Promise(function (resolve) { return setTimeout(resolve, ms); })];\n });\n });\n}\nexport function tick() {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n return [2, wait(0)];\n });\n });\n}\n//# sourceMappingURL=wait.js.map","function wrapTestFunction(fn, consoleMethodName) {\n return function () {\n var _this = this;\n var args = arguments;\n var spy = jest.spyOn(console, consoleMethodName);\n spy.mockImplementation(function () { });\n return new Promise(function (resolve) {\n resolve(fn === null || fn === void 0 ? void 0 : fn.apply(_this, args));\n }).finally(function () {\n expect(spy).toMatchSnapshot();\n spy.mockReset();\n });\n };\n}\nexport function withErrorSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"error\");\n return it.apply(void 0, args);\n}\nexport function withWarningSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"warn\");\n return it.apply(void 0, args);\n}\nexport function withLogSpy(it) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n args[1] = wrapTestFunction(args[1], \"log\");\n return it.apply(void 0, args);\n}\n//# sourceMappingURL=withConsoleSpy.js.map"],"names":["print","addTypenameToDocument","__extends","equal","stringifyForDisplay","Observable","cloneDeep","removeConnectionDirectiveFromDocument","invariant","removeClientSetsFromDocument","ApolloLink","ApolloClient","InMemoryCache","asyncMap","__awaiter","__generator"],"mappings":";;;;;;;;;;;;AAKA,SAAS,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE;AAC5C,IAAI,IAAI,WAAW,GAAG,OAAO,CAAC,KAAK;AACnC,QAAQA,eAAK,CAAC,WAAW,GAAGC,+BAAqB,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAClF,IAAI,IAAI,UAAU,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAC5C,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC;AACE,IAAC,QAAQ,IAAI,UAAU,MAAM,EAAE;AAClC,IAAIC,eAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAChC,IAAI,SAAS,QAAQ,CAAC,eAAe,EAAE,WAAW,EAAE,OAAO,EAAE;AAC7D,QAAQ,IAAI,WAAW,KAAK,KAAK,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAAC,EAAE;AAC3D,QAAQ,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE;AAClE,QAAQ,IAAI,EAAE,CAAC;AACf,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC9C,QAAQ,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;AACjC,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,KAAK,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,SAAS,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE;AAClD,QAAQ,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;AACrC,KAAK;AACL,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC/C,IAAI,OAAO,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;AAClC;;;;;;;;;;;;;;;"}
|
|
@@ -21,9 +21,8 @@ var MockLink = (function (_super) {
|
|
|
21
21
|
function MockLink(mockedResponses, addTypename, options) {
|
|
22
22
|
if (addTypename === void 0) { addTypename = true; }
|
|
23
23
|
if (options === void 0) { options = Object.create(null); }
|
|
24
|
-
var _this = this;
|
|
25
24
|
var _a;
|
|
26
|
-
_this = _super.call(this) || this;
|
|
25
|
+
var _this = _super.call(this) || this;
|
|
27
26
|
_this.addTypename = true;
|
|
28
27
|
_this.showWarnings = true;
|
|
29
28
|
_this.mockedResponsesByKey = {};
|
|
@@ -53,24 +52,26 @@ var MockLink = (function (_super) {
|
|
|
53
52
|
var unmatchedVars = [];
|
|
54
53
|
var requestVariables = operation.variables || {};
|
|
55
54
|
var mockedResponses = this.mockedResponsesByKey[key];
|
|
56
|
-
var responseIndex = mockedResponses
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
var responseIndex = mockedResponses
|
|
56
|
+
? mockedResponses.findIndex(function (res, index) {
|
|
57
|
+
var mockedResponseVars = res.request.variables || {};
|
|
58
|
+
if (equality.equal(requestVariables, mockedResponseVars)) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
unmatchedVars.push(mockedResponseVars);
|
|
62
|
+
return false;
|
|
63
|
+
})
|
|
64
|
+
: -1;
|
|
65
|
+
var response = responseIndex >= 0 ? mockedResponses[responseIndex] : void 0;
|
|
67
66
|
var configError;
|
|
68
67
|
if (!response) {
|
|
69
|
-
configError = new Error("No more mocked responses for the query: ".concat(utilities.print(operation.query), "\nExpected variables: ").concat(utilities.stringifyForDisplay(operation.variables), "\n").concat(unmatchedVars.length > 0
|
|
68
|
+
configError = new Error("No more mocked responses for the query: ".concat(utilities.print(operation.query), "\nExpected variables: ").concat(utilities.stringifyForDisplay(operation.variables), "\n").concat(unmatchedVars.length > 0
|
|
69
|
+
? "\nFailed to match ".concat(unmatchedVars.length, " mock").concat(unmatchedVars.length === 1 ? "" : "s", " for this query. The mocked response had the following variables:\n").concat(unmatchedVars.map(function (d) { return " ".concat(utilities.stringifyForDisplay(d)); }).join("\n"), "\n")
|
|
70
|
+
: ""));
|
|
70
71
|
if (this.showWarnings) {
|
|
71
72
|
console.warn(configError.message +
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
"\nThis typically indicates a configuration error in your mocks " +
|
|
74
|
+
"setup, usually due to a typo or mismatched variable.");
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
else {
|
|
@@ -102,14 +103,14 @@ var MockLink = (function (_super) {
|
|
|
102
103
|
}
|
|
103
104
|
else {
|
|
104
105
|
if (response.result) {
|
|
105
|
-
observer.next(typeof response.result ===
|
|
106
|
+
observer.next(typeof response.result === "function"
|
|
106
107
|
? response.result()
|
|
107
108
|
: response.result);
|
|
108
109
|
}
|
|
109
110
|
observer.complete();
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
|
-
}, response && response.delay || 0);
|
|
113
|
+
}, (response && response.delay) || 0);
|
|
113
114
|
return function () {
|
|
114
115
|
clearTimeout(timer);
|
|
115
116
|
};
|
|
@@ -135,7 +136,7 @@ function mockSingleLink() {
|
|
|
135
136
|
}
|
|
136
137
|
var maybeTypename = mockedResponses[mockedResponses.length - 1];
|
|
137
138
|
var mocks = mockedResponses.slice(0, mockedResponses.length - 1);
|
|
138
|
-
if (typeof maybeTypename !==
|
|
139
|
+
if (typeof maybeTypename !== "boolean") {
|
|
139
140
|
mocks = mockedResponses;
|
|
140
141
|
maybeTypename = true;
|
|
141
142
|
}
|
|
@@ -168,7 +169,7 @@ var MockSubscriptionLink = (function (_super) {
|
|
|
168
169
|
setTimeout(function () {
|
|
169
170
|
var observers = _this.observers;
|
|
170
171
|
if (!observers.length)
|
|
171
|
-
throw new Error(
|
|
172
|
+
throw new Error("subscription torn down");
|
|
172
173
|
observers.forEach(function (observer) {
|
|
173
174
|
if (result.result && observer.next)
|
|
174
175
|
observer.next(result.result);
|
|
@@ -182,7 +183,7 @@ var MockSubscriptionLink = (function (_super) {
|
|
|
182
183
|
MockSubscriptionLink.prototype.simulateComplete = function () {
|
|
183
184
|
var observers = this.observers;
|
|
184
185
|
if (!observers.length)
|
|
185
|
-
throw new Error(
|
|
186
|
+
throw new Error("subscription torn down");
|
|
186
187
|
observers.forEach(function (observer) {
|
|
187
188
|
if (observer.complete)
|
|
188
189
|
observer.complete();
|
|
@@ -206,7 +207,9 @@ function createMockClient(data, query, variables) {
|
|
|
206
207
|
link: mockSingleLink({
|
|
207
208
|
request: { query: query, variables: variables },
|
|
208
209
|
result: { data: data },
|
|
209
|
-
}).setOnError(function (error) {
|
|
210
|
+
}).setOnError(function (error) {
|
|
211
|
+
throw error;
|
|
212
|
+
}),
|
|
210
213
|
cache: new cache.InMemoryCache({ addTypename: false }),
|
|
211
214
|
});
|
|
212
215
|
}
|
|
@@ -215,9 +218,11 @@ function subscribeAndCount(reject, observable, cb) {
|
|
|
215
218
|
var queue = Promise.resolve();
|
|
216
219
|
var handleCount = 0;
|
|
217
220
|
var subscription = utilities.asyncMap(observable, function (result) {
|
|
218
|
-
return queue = queue
|
|
221
|
+
return (queue = queue
|
|
222
|
+
.then(function () {
|
|
219
223
|
return cb(++handleCount, result);
|
|
220
|
-
})
|
|
224
|
+
})
|
|
225
|
+
.catch(error));
|
|
221
226
|
}).subscribe({ error: error });
|
|
222
227
|
function error(e) {
|
|
223
228
|
subscription.unsubscribe();
|
|
@@ -227,10 +232,14 @@ function subscribeAndCount(reject, observable, cb) {
|
|
|
227
232
|
}
|
|
228
233
|
|
|
229
234
|
function wrap(key) {
|
|
230
|
-
return function (message, callback, timeout) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
235
|
+
return function (message, callback, timeout) {
|
|
236
|
+
return (key ? it[key] : it)(message, function () {
|
|
237
|
+
var _this = this;
|
|
238
|
+
return new Promise(function (resolve, reject) {
|
|
239
|
+
return callback.call(_this, resolve, reject);
|
|
240
|
+
});
|
|
241
|
+
}, timeout);
|
|
242
|
+
};
|
|
234
243
|
}
|
|
235
244
|
var wrappedIt = wrap();
|
|
236
245
|
var itAsync = Object.assign(function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itAsync.d.ts","sourceRoot":"","sources":["../../../src/testing/core/itAsync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"itAsync.d.ts","sourceRoot":"","sources":["../../../src/testing/core/itAsync.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,OAAO,mDAlBK,GAAG,KAAK,IAAI,oBACb,GAAG,KAAK,IAAI,KAC3B,GAAG;oBAJC,MAAM,gCAEM,GAAG,KAAK,IAAI,oBACb,GAAG,KAAK,IAAI,KAC3B,GAAG,YACE,MAAM;oBALP,MAAM,gCAEM,GAAG,KAAK,IAAI,oBACb,GAAG,KAAK,IAAI,KAC3B,GAAG,YACE,MAAM;oBALP,MAAM,gCAEM,GAAG,KAAK,IAAI,oBACb,GAAG,KAAK,IAAI,KAC3B,GAAG,YACE,MAAM;CAwBnB,CAAC"}
|
package/testing/core/itAsync.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
function wrap(key) {
|
|
2
|
-
return function (message, callback, timeout) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
return function (message, callback, timeout) {
|
|
3
|
+
return (key ? it[key] : it)(message, function () {
|
|
4
|
+
var _this = this;
|
|
5
|
+
return new Promise(function (resolve, reject) {
|
|
6
|
+
return callback.call(_this, resolve, reject);
|
|
7
|
+
});
|
|
8
|
+
}, timeout);
|
|
9
|
+
};
|
|
6
10
|
}
|
|
7
11
|
var wrappedIt = wrap();
|
|
8
12
|
export var itAsync = Object.assign(function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itAsync.js","sourceRoot":"","sources":["../../../src/testing/core/itAsync.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,CAAC,GAA8B;IAC1C,OAAO,UACL,OAAe,EACf,QAGQ,EACR,OAAgB,
|
|
1
|
+
{"version":3,"file":"itAsync.js","sourceRoot":"","sources":["../../../src/testing/core/itAsync.ts"],"names":[],"mappings":"AAAA,SAAS,IAAI,CAAC,GAA8B;IAC1C,OAAO,UACL,OAAe,EACf,QAGQ,EACR,OAAgB;QAEhB,OAAA,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAClB,OAAO,EACP;YAAA,iBAIC;YAHC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;gBACjC,OAAA,QAAQ,CAAC,IAAI,CAAC,KAAI,EAAE,OAAO,EAAE,MAAM,CAAC;YAApC,CAAoC,CACrC,CAAC;QACJ,CAAC,EACD,OAAO,CACR;IARD,CAQC,CAAC;AACN,CAAC;AAED,IAAM,SAAS,GAAG,IAAI,EAAE,CAAC;AAEzB,MAAM,CAAC,IAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAClC;IAAU,cAAqC;SAArC,UAAqC,EAArC,qBAAqC,EAArC,IAAqC;QAArC,yBAAqC;;IAC7C,OAAO,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC,EACD;IACE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;CACnB,CACF,CAAC","sourcesContent":["function wrap(key?: \"only\" | \"skip\" | \"todo\") {\n return (\n message: string,\n callback: (\n resolve: (result?: any) => void,\n reject: (reason?: any) => void\n ) => any,\n timeout?: number\n ) =>\n (key ? it[key] : it)(\n message,\n function () {\n return new Promise((resolve, reject) =>\n callback.call(this, resolve, reject)\n );\n },\n timeout\n );\n}\n\nconst wrappedIt = wrap();\n\nexport const itAsync = Object.assign(\n function (...args: Parameters<typeof wrappedIt>) {\n return wrappedIt.apply(this, args);\n },\n {\n only: wrap(\"only\"),\n skip: wrap(\"skip\"),\n todo: wrap(\"todo\"),\n }\n);\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DocumentNode } from
|
|
2
|
-
import { ApolloClient } from
|
|
3
|
-
import type { NormalizedCacheObject } from
|
|
1
|
+
import type { DocumentNode } from "graphql";
|
|
2
|
+
import { ApolloClient } from "../../../core/index.js";
|
|
3
|
+
import type { NormalizedCacheObject } from "../../../cache/index.js";
|
|
4
4
|
export declare function createMockClient<TData>(data: TData, query: DocumentNode, variables?: {}): ApolloClient<NormalizedCacheObject>;
|
|
5
5
|
//# sourceMappingURL=mockClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockClient.d.ts","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAIrE,wBAAgB,gBAAgB,CAAC,KAAK,EACpC,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,YAAY,EACnB,SAAS,KAAK,GACb,YAAY,CAAC,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"mockClient.d.ts","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAIrE,wBAAgB,gBAAgB,CAAC,KAAK,EACpC,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,YAAY,EACnB,SAAS,KAAK,GACb,YAAY,CAAC,qBAAqB,CAAC,CAUrC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { ApolloClient } from
|
|
2
|
-
import { InMemoryCache } from
|
|
3
|
-
import { mockSingleLink } from
|
|
1
|
+
import { ApolloClient } from "../../../core/index.js";
|
|
2
|
+
import { InMemoryCache } from "../../../cache/index.js";
|
|
3
|
+
import { mockSingleLink } from "./mockLink.js";
|
|
4
4
|
export function createMockClient(data, query, variables) {
|
|
5
5
|
if (variables === void 0) { variables = {}; }
|
|
6
6
|
return new ApolloClient({
|
|
7
7
|
link: mockSingleLink({
|
|
8
8
|
request: { query: query, variables: variables },
|
|
9
9
|
result: { data: data },
|
|
10
|
-
}).setOnError(function (error) {
|
|
10
|
+
}).setOnError(function (error) {
|
|
11
|
+
throw error;
|
|
12
|
+
}),
|
|
11
13
|
cache: new InMemoryCache({ addTypename: false }),
|
|
12
14
|
});
|
|
13
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockClient.js","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,UAAU,gBAAgB,CAC9B,IAAW,EACX,KAAmB,EACnB,SAAc;IAAd,0BAAA,EAAA,cAAc;IAEd,OAAO,IAAI,YAAY,CAAC;QACtB,IAAI,EAAE,cAAc,CAAC;YACnB,OAAO,EAAE,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE;YAC7B,MAAM,EAAE,EAAE,IAAI,MAAA,EAAE;SACjB,CAAC,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"mockClient.js","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockClient.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,UAAU,gBAAgB,CAC9B,IAAW,EACX,KAAmB,EACnB,SAAc;IAAd,0BAAA,EAAA,cAAc;IAEd,OAAO,IAAI,YAAY,CAAC;QACtB,IAAI,EAAE,cAAc,CAAC;YACnB,OAAO,EAAE,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE;YAC7B,MAAM,EAAE,EAAE,IAAI,MAAA,EAAE;SACjB,CAAC,CAAC,UAAU,CAAC,UAAC,KAAK;YAClB,MAAM,KAAK,CAAC;QACd,CAAC,CAAC;QACF,KAAK,EAAE,IAAI,aAAa,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;KACjD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { DocumentNode } from \"graphql\";\n\nimport { ApolloClient } from \"../../../core/index.js\";\nimport type { NormalizedCacheObject } from \"../../../cache/index.js\";\nimport { InMemoryCache } from \"../../../cache/index.js\";\nimport { mockSingleLink } from \"./mockLink.js\";\n\nexport function createMockClient<TData>(\n data: TData,\n query: DocumentNode,\n variables = {}\n): ApolloClient<NormalizedCacheObject> {\n return new ApolloClient({\n link: mockSingleLink({\n request: { query, variables },\n result: { data },\n }).setOnError((error) => {\n throw error;\n }),\n cache: new InMemoryCache({ addTypename: false }),\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mockFetch.d.ts","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockFetch.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAKtB,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,GAAG,GACZ,eAAe,CAYjB;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,oBAAoB,CAA2C;gBAE3D,GAAG,eAAe,EAAE,mBAAmB,EAAE;IAQ9C,iBAAiB,CAAC,cAAc,EAAE,mBAAmB;IAYrD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW;
|
|
1
|
+
{"version":3,"file":"mockFetch.d.ts","sourceRoot":"","sources":["../../../../src/testing/core/mocking/mockFetch.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAC;AAKtB,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,GAAG,GACZ,eAAe,CAYjB;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,oBAAoB,CAA2C;gBAE3D,GAAG,eAAe,EAAE,mBAAmB,EAAE;IAQ9C,iBAAiB,CAAC,cAAc,EAAE,mBAAmB;IAYrD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW;IAyBpC,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,MAAM;IAUxD,QAAQ;CAGhB;AAoBD,wBAAgB,eAAe,CAAC,GAAG,eAAe,EAAE,mBAAmB,EAAE,OAExE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __spreadArray } from "tslib";
|
|
2
|
-
import
|
|
2
|
+
import "whatwg-fetch";
|
|
3
3
|
export function createMockedIResponse(result, options) {
|
|
4
4
|
var status = (options && options.status) || 200;
|
|
5
5
|
var statusText = (options && options.statusText) || undefined;
|
|
@@ -14,11 +14,11 @@ export function createMockedIResponse(result, options) {
|
|
|
14
14
|
}
|
|
15
15
|
var MockFetch = (function () {
|
|
16
16
|
function MockFetch() {
|
|
17
|
+
var _this = this;
|
|
17
18
|
var mockedResponses = [];
|
|
18
19
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
19
20
|
mockedResponses[_i] = arguments[_i];
|
|
20
21
|
}
|
|
21
|
-
var _this = this;
|
|
22
22
|
this.mockedResponsesByKey = {};
|
|
23
23
|
mockedResponses.forEach(function (mockedResponse) {
|
|
24
24
|
_this.addMockedResponse(mockedResponse);
|
|
@@ -67,7 +67,7 @@ function sortByKey(obj) {
|
|
|
67
67
|
.reduce(function (ret, key) {
|
|
68
68
|
var _a;
|
|
69
69
|
return Object.assign((_a = {},
|
|
70
|
-
_a[key] = Object.prototype.toString.call(obj[key]).slice(8, -1) ===
|
|
70
|
+
_a[key] = Object.prototype.toString.call(obj[key]).slice(8, -1) === "Object"
|
|
71
71
|
? sortByKey(obj[key])
|
|
72
72
|
: obj[key],
|
|
73
73
|
_a), ret);
|