@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":"subscriptions.cjs","sources":["index.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"subscriptions.cjs","sources":["index.js"],"sourcesContent":["// This file is adapted from the graphql-ws npm package:\n// https://github.com/enisdenjo/graphql-ws\n//\n// Most of the file comes from that package's README; some other parts (such as\n// isLikeCloseEvent) come from its source.\n//\n// Here's the license of the original code:\n//\n// The MIT License (MIT)\n//\n// Copyright (c) 2020-2021 Denis Badurina\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\nimport { __assign, __extends } from \"tslib\";\nimport { print } from \"../../utilities/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport { isNonNullObject, Observable } from \"../../utilities/index.js\";\nimport { ApolloError } from \"../../errors/index.js\";\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close_event\nfunction isLikeCloseEvent(val) {\n return isNonNullObject(val) && \"code\" in val && \"reason\" in val;\n}\n// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event\nfunction isLikeErrorEvent(err) {\n var _a;\n return isNonNullObject(err) && ((_a = err.target) === null || _a === void 0 ? void 0 : _a.readyState) === WebSocket.CLOSED;\n}\nvar GraphQLWsLink = /** @class */ (function (_super) {\n __extends(GraphQLWsLink, _super);\n function GraphQLWsLink(client) {\n var _this = _super.call(this) || this;\n _this.client = client;\n return _this;\n }\n GraphQLWsLink.prototype.request = function (operation) {\n var _this = this;\n return new Observable(function (observer) {\n return _this.client.subscribe(__assign(__assign({}, operation), { query: print(operation.query) }), {\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: function (err) {\n if (err instanceof Error) {\n return observer.error(err);\n }\n var likeClose = isLikeCloseEvent(err);\n if (likeClose || isLikeErrorEvent(err)) {\n return observer.error(\n // reason will be available on clean closes\n new Error(\"Socket closed\".concat(likeClose ? \" with event \".concat(err.code) : \"\").concat(likeClose ? \" \".concat(err.reason) : \"\")));\n }\n return observer.error(new ApolloError({\n graphQLErrors: Array.isArray(err) ? err : [err],\n }));\n },\n });\n });\n };\n return GraphQLWsLink;\n}(ApolloLink));\nexport { G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LOSED;
|
|
16
16
|
}
|
|
17
|
-
var GraphQLWsLink =
|
|
17
|
+
var GraphQLWsLink = (function (_super) {
|
|
18
18
|
tslib.__extends(GraphQLWsLink, _super);
|
|
19
19
|
function GraphQLWsLink(client) {
|
|
20
20
|
var _this = _super.call(this) || this;
|
|
@@ -33,7 +33,8 @@ var GraphQLWsLink = (function (_super) {
|
|
|
33
33
|
}
|
|
34
34
|
var likeClose = isLikeCloseEvent(err);
|
|
35
35
|
if (likeClose || isLikeErrorEvent(err)) {
|
|
36
|
-
return observer.error(
|
|
36
|
+
return observer.error(
|
|
37
|
+
new Error("Socket closed".concat(likeClose ? " with event ".concat(err.code) : "").concat(likeClose ? " ".concat(err.reason) : "")));
|
|
37
38
|
}
|
|
38
39
|
return observer.error(new errors.ApolloError({
|
|
39
40
|
graphQLErrors: Array.isArray(err) ? err : [err],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOperation.js","sourceRoot":"","sources":["../../../src/link/utils/createOperation.ts"],"names":[],"mappings":";AAEA,MAAM,UAAU,eAAe,CAC7B,QAAa,EACb,SAAyB;IAEzB,IAAI,OAAO,gBAAQ,QAAQ,CAAE,CAAC;IAC9B,IAAM,UAAU,GAAG,UAAC,IAAS;QAC3B,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"createOperation.js","sourceRoot":"","sources":["../../../src/link/utils/createOperation.ts"],"names":[],"mappings":";AAEA,MAAM,UAAU,eAAe,CAC7B,QAAa,EACb,SAAyB;IAEzB,IAAI,OAAO,gBAAQ,QAAQ,CAAE,CAAC;IAC9B,IAAM,UAAU,GAAG,UAAC,IAAS;QAC3B,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;YAC/B,OAAO,yBAAQ,OAAO,GAAK,IAAI,CAAC,OAAO,CAAC,CAAE,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,OAAO,yBAAQ,OAAO,GAAK,IAAI,CAAE,CAAC;QACpC,CAAC;IACH,CAAC,CAAC;IACF,IAAM,UAAU,GAAG,cAAM,OAAA,cAAM,OAAO,EAAG,EAAhB,CAAgB,CAAC;IAE1C,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,YAAY,EAAE;QAC7C,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,UAAU;KAClB,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,YAAY,EAAE;QAC7C,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,UAAU;KAClB,CAAC,CAAC;IAEH,OAAO,SAAsB,CAAC;AAChC,CAAC","sourcesContent":["import type { GraphQLRequest, Operation } from \"../core/index.js\";\n\nexport function createOperation(\n starting: any,\n operation: GraphQLRequest\n): Operation {\n let context = { ...starting };\n const setContext = (next: any) => {\n if (typeof next === \"function\") {\n context = { ...context, ...next(context) };\n } else {\n context = { ...context, ...next };\n }\n };\n const getContext = () => ({ ...context });\n\n Object.defineProperty(operation, \"setContext\", {\n enumerable: false,\n value: setContext,\n });\n\n Object.defineProperty(operation, \"getContext\", {\n enumerable: false,\n value: getContext,\n });\n\n return operation as Operation;\n}\n"]}
|
|
@@ -5,6 +5,10 @@ export function filterOperationVariables(variables, query) {
|
|
|
5
5
|
var unusedNames = new Set(Object.keys(variables));
|
|
6
6
|
visit(query, {
|
|
7
7
|
Variable: function (node, _key, parent) {
|
|
8
|
+
// A variable type definition at the top level of a query is not
|
|
9
|
+
// enough to silence server-side errors about the variable being
|
|
10
|
+
// unused, so variable definitions do not count as usage.
|
|
11
|
+
// https://spec.graphql.org/draft/#sec-All-Variables-Used
|
|
8
12
|
if (parent &&
|
|
9
13
|
parent.kind !== "VariableDefinition") {
|
|
10
14
|
unusedNames.delete(node.name.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterOperationVariables.js","sourceRoot":"","sources":["../../../src/link/utils/filterOperationVariables.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,UAAU,wBAAwB,CACtC,SAA8B,EAC9B,KAAmB;IAEnB,IAAM,MAAM,gBAAQ,SAAS,CAAE,CAAC;IAChC,IAAM,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACpD,KAAK,CAAC,KAAK,EAAE;QACX,QAAQ,YAAC,IAAI,EAAE,IAAI,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"filterOperationVariables.js","sourceRoot":"","sources":["../../../src/link/utils/filterOperationVariables.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,UAAU,wBAAwB,CACtC,SAA8B,EAC9B,KAAmB;IAEnB,IAAM,MAAM,gBAAQ,SAAS,CAAE,CAAC;IAChC,IAAM,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACpD,KAAK,CAAC,KAAK,EAAE;QACX,QAAQ,YAAC,IAAI,EAAE,IAAI,EAAE,MAAM;YACzB,gEAAgE;YAChE,gEAAgE;YAChE,yDAAyD;YACzD,yDAAyD;YACzD,IACE,MAAM;gBACL,MAAiC,CAAC,IAAI,KAAK,oBAAoB,EAChE,CAAC;gBACD,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IACH,WAAW,CAAC,OAAO,CAAC,UAAC,IAAI;QACvB,OAAO,MAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { VariableDefinitionNode, DocumentNode } from \"graphql\";\nimport { visit } from \"graphql\";\n\nexport function filterOperationVariables(\n variables: Record<string, any>,\n query: DocumentNode\n) {\n const result = { ...variables };\n const unusedNames = new Set(Object.keys(variables));\n visit(query, {\n Variable(node, _key, parent) {\n // A variable type definition at the top level of a query is not\n // enough to silence server-side errors about the variable being\n // unused, so variable definitions do not count as usage.\n // https://spec.graphql.org/draft/#sec-All-Variables-Used\n if (\n parent &&\n (parent as VariableDefinitionNode).kind !== \"VariableDefinition\"\n ) {\n unusedNames.delete(node.name.value);\n }\n },\n });\n unusedNames.forEach((name) => {\n delete result![name];\n });\n return result;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toPromise.js","sourceRoot":"","sources":["../../../src/link/utils/toPromise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAG7D,MAAM,UAAU,SAAS,CAAI,UAAyB;IACpD,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,OAAO,IAAI,OAAO,CAAI,UAAC,OAAO,EAAE,MAAM;QACpC,UAAU,CAAC,SAAS,CAAC;YACnB,IAAI,EAAE,UAAC,IAAI;gBACT,IAAI,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"toPromise.js","sourceRoot":"","sources":["../../../src/link/utils/toPromise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAG7D,MAAM,UAAU,SAAS,CAAI,UAAyB;IACpD,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,OAAO,IAAI,OAAO,CAAI,UAAC,OAAO,EAAE,MAAM;QACpC,UAAU,CAAC,SAAS,CAAC;YACnB,IAAI,EAAE,UAAC,IAAI;gBACT,IAAI,SAAS,EAAE,CAAC;oBACd,SAAS,CAAC,IAAI,CACZ,mEAAmE,CACpE,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,SAAS,GAAG,IAAI,CAAC;oBACjB,OAAO,CAAC,IAAI,CAAC,CAAC;gBAChB,CAAC;YACH,CAAC;YACD,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { invariant } from \"../../utilities/globals/index.js\";\nimport type { Observable } from \"../../utilities/index.js\";\n\nexport function toPromise<R>(observable: Observable<R>): Promise<R> {\n let completed = false;\n return new Promise<R>((resolve, reject) => {\n observable.subscribe({\n next: (data) => {\n if (completed) {\n invariant.warn(\n `Promise Wrapper does not support multiple results from Observable`\n );\n } else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n"]}
|
|
@@ -6,10 +6,11 @@ export function transformOperation(operation) {
|
|
|
6
6
|
operationName: operation.operationName,
|
|
7
7
|
query: operation.query,
|
|
8
8
|
};
|
|
9
|
+
// Best guess at an operation name
|
|
9
10
|
if (!transformedOperation.operationName) {
|
|
10
11
|
transformedOperation.operationName =
|
|
11
|
-
typeof transformedOperation.query !== "string"
|
|
12
|
-
|
|
12
|
+
typeof transformedOperation.query !== "string" ?
|
|
13
|
+
getOperationName(transformedOperation.query) || undefined
|
|
13
14
|
: "";
|
|
14
15
|
}
|
|
15
16
|
return transformedOperation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformOperation.js","sourceRoot":"","sources":["../../../src/link/utils/transformOperation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,UAAU,kBAAkB,CAAC,SAAyB;IAC1D,IAAM,oBAAoB,GAAmB;QAC3C,SAAS,EAAE,SAAS,CAAC,SAAS,IAAI,EAAE;QACpC,UAAU,EAAE,SAAS,CAAC,UAAU,IAAI,EAAE;QACtC,aAAa,EAAE,SAAS,CAAC,aAAa;QACtC,KAAK,EAAE,SAAS,CAAC,KAAK;KACvB,CAAC;
|
|
1
|
+
{"version":3,"file":"transformOperation.js","sourceRoot":"","sources":["../../../src/link/utils/transformOperation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,UAAU,kBAAkB,CAAC,SAAyB;IAC1D,IAAM,oBAAoB,GAAmB;QAC3C,SAAS,EAAE,SAAS,CAAC,SAAS,IAAI,EAAE;QACpC,UAAU,EAAE,SAAS,CAAC,UAAU,IAAI,EAAE;QACtC,aAAa,EAAE,SAAS,CAAC,aAAa;QACtC,KAAK,EAAE,SAAS,CAAC,KAAK;KACvB,CAAC;IAEF,kCAAkC;IAClC,IAAI,CAAC,oBAAoB,CAAC,aAAa,EAAE,CAAC;QACxC,oBAAoB,CAAC,aAAa;YAChC,OAAO,oBAAoB,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC;gBAC9C,gBAAgB,CAAC,oBAAoB,CAAC,KAAK,CAAC,IAAI,SAAS;gBAC3D,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;IAED,OAAO,oBAAiC,CAAC;AAC3C,CAAC","sourcesContent":["import type { GraphQLRequest, Operation } from \"../core/index.js\";\nimport { getOperationName } from \"../../utilities/index.js\";\n\nexport function transformOperation(operation: GraphQLRequest): GraphQLRequest {\n const transformedOperation: GraphQLRequest = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n query: operation.query,\n };\n\n // Best guess at an operation name\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== \"string\" ?\n getOperationName(transformedOperation.query) || undefined\n : \"\";\n }\n\n return transformedOperation as Operation;\n}\n"]}
|
package/link/utils/utils.cjs
CHANGED
|
@@ -99,8 +99,8 @@ function transformOperation(operation) {
|
|
|
99
99
|
};
|
|
100
100
|
if (!transformedOperation.operationName) {
|
|
101
101
|
transformedOperation.operationName =
|
|
102
|
-
typeof transformedOperation.query !== "string"
|
|
103
|
-
|
|
102
|
+
typeof transformedOperation.query !== "string" ?
|
|
103
|
+
utilities.getOperationName(transformedOperation.query) || undefined
|
|
104
104
|
: "";
|
|
105
105
|
}
|
|
106
106
|
return transformedOperation;
|
package/link/utils/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["fromError.js","toPromise.js","fromPromise.js","throwServerError.js","validateOperation.js","createOperation.js","transformOperation.js","filterOperationVariables.js"],"sourcesContent":["import { Observable } from \"../../utilities/index.js\";\nexport function fromError(errorValue) {\n return new Observable(function (observer) {\n observer.error(errorValue);\n });\n}\n//# sourceMappingURL=fromError.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nexport function toPromise(observable) {\n var completed = false;\n return new Promise(function (resolve, reject) {\n observable.subscribe({\n next: function (data) {\n if (completed) {\n globalThis.__DEV__ !== false && invariant.warn(42);\n }\n else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n//# sourceMappingURL=toPromise.js.map","import { Observable } from \"../../utilities/index.js\";\nexport function fromPromise(promise) {\n return new Observable(function (observer) {\n promise\n .then(function (value) {\n observer.next(value);\n observer.complete();\n })\n .catch(observer.error.bind(observer));\n });\n}\n//# sourceMappingURL=fromPromise.js.map","export var throwServerError = function (response, result, message) {\n var error = new Error(message);\n error.name = \"ServerError\";\n error.response = response;\n error.statusCode = response.status;\n error.result = result;\n throw error;\n};\n//# sourceMappingURL=throwServerError.js.map","import { newInvariantError } from \"../../utilities/globals/index.js\";\nexport function validateOperation(operation) {\n var OPERATION_FIELDS = [\n \"query\",\n \"operationName\",\n \"variables\",\n \"extensions\",\n \"context\",\n ];\n for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {\n var key = _a[_i];\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw newInvariantError(43, key);\n }\n }\n return operation;\n}\n//# sourceMappingURL=validateOperation.js.map","import { __assign } from \"tslib\";\nexport function createOperation(starting, operation) {\n var context = __assign({}, starting);\n var setContext = function (next) {\n if (typeof next === \"function\") {\n context = __assign(__assign({}, context), next(context));\n }\n else {\n context = __assign(__assign({}, context), next);\n }\n };\n var getContext = function () { return (__assign({}, context)); };\n Object.defineProperty(operation, \"setContext\", {\n enumerable: false,\n value: setContext,\n });\n Object.defineProperty(operation, \"getContext\", {\n enumerable: false,\n value: getContext,\n });\n return operation;\n}\n//# sourceMappingURL=createOperation.js.map","import { getOperationName } from \"../../utilities/index.js\";\nexport function transformOperation(operation) {\n var transformedOperation = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n query: operation.query,\n };\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== \"string\"
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["fromError.js","toPromise.js","fromPromise.js","throwServerError.js","validateOperation.js","createOperation.js","transformOperation.js","filterOperationVariables.js"],"sourcesContent":["import { Observable } from \"../../utilities/index.js\";\nexport function fromError(errorValue) {\n return new Observable(function (observer) {\n observer.error(errorValue);\n });\n}\n//# sourceMappingURL=fromError.js.map","import { invariant } from \"../../utilities/globals/index.js\";\nexport function toPromise(observable) {\n var completed = false;\n return new Promise(function (resolve, reject) {\n observable.subscribe({\n next: function (data) {\n if (completed) {\n globalThis.__DEV__ !== false && invariant.warn(42);\n }\n else {\n completed = true;\n resolve(data);\n }\n },\n error: reject,\n });\n });\n}\n//# sourceMappingURL=toPromise.js.map","import { Observable } from \"../../utilities/index.js\";\nexport function fromPromise(promise) {\n return new Observable(function (observer) {\n promise\n .then(function (value) {\n observer.next(value);\n observer.complete();\n })\n .catch(observer.error.bind(observer));\n });\n}\n//# sourceMappingURL=fromPromise.js.map","export var throwServerError = function (response, result, message) {\n var error = new Error(message);\n error.name = \"ServerError\";\n error.response = response;\n error.statusCode = response.status;\n error.result = result;\n throw error;\n};\n//# sourceMappingURL=throwServerError.js.map","import { newInvariantError } from \"../../utilities/globals/index.js\";\nexport function validateOperation(operation) {\n var OPERATION_FIELDS = [\n \"query\",\n \"operationName\",\n \"variables\",\n \"extensions\",\n \"context\",\n ];\n for (var _i = 0, _a = Object.keys(operation); _i < _a.length; _i++) {\n var key = _a[_i];\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw newInvariantError(43, key);\n }\n }\n return operation;\n}\n//# sourceMappingURL=validateOperation.js.map","import { __assign } from \"tslib\";\nexport function createOperation(starting, operation) {\n var context = __assign({}, starting);\n var setContext = function (next) {\n if (typeof next === \"function\") {\n context = __assign(__assign({}, context), next(context));\n }\n else {\n context = __assign(__assign({}, context), next);\n }\n };\n var getContext = function () { return (__assign({}, context)); };\n Object.defineProperty(operation, \"setContext\", {\n enumerable: false,\n value: setContext,\n });\n Object.defineProperty(operation, \"getContext\", {\n enumerable: false,\n value: getContext,\n });\n return operation;\n}\n//# sourceMappingURL=createOperation.js.map","import { getOperationName } from \"../../utilities/index.js\";\nexport function transformOperation(operation) {\n var transformedOperation = {\n variables: operation.variables || {},\n extensions: operation.extensions || {},\n operationName: operation.operationName,\n query: operation.query,\n };\n // Best guess at an operation name\n if (!transformedOperation.operationName) {\n transformedOperation.operationName =\n typeof transformedOperation.query !== \"string\" ?\n getOperationName(transformedOperation.query) || undefined\n : \"\";\n }\n return transformedOperation;\n}\n//# sourceMappingURL=transformOperation.js.map","import { __assign } from \"tslib\";\nimport { visit } from \"graphql\";\nexport function filterOperationVariables(variables, query) {\n var result = __assign({}, variables);\n var unusedNames = new Set(Object.keys(variables));\n visit(query, {\n Variable: function (node, _key, parent) {\n // A variable type definition at the top level of a query is not\n // enough to silence server-side errors about the variable being\n // unused, so variable definitions do not count as usage.\n // https://spec.graphql.org/draft/#sec-All-Variables-Used\n if (parent &&\n parent.kind !== \"VariableDefinition\") {\n unusedNames.delete(node.name.value);\n }\n },\n });\n unusedNames.forEach(function (name) {\n delete result[name];\n });\n return result;\n}\n//# sourceMappingURL=filterOperationVariables.js.map"],"names":["Observable","invariant","newInvariantError","__assign","getOperationName","visit"],"mappings":";;;;;;;;;AACO,SAAS,SAAS,CAAC,UAAU,EAAE;AACtC,IAAI,OAAO,IAAIA,oBAAU,CAAC,UAAU,QAAQ,EAAE;AAC9C,QAAQ,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AACnC,KAAK,CAAC,CAAC;AACP;;ACJO,SAAS,SAAS,CA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jB,QAAQ,QAAQ,EAAE,UAAU,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE;AAKhD,YAAY,IAAI,MAAM;AACtB,gBAAgB,MAAM,CAAC,IAAI,KAAK,oBAAoB,EAAE;AACtD,gBAAgB,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACpD,aAAa;AACb,SAAS;AACT,KAAK,CAAC,CAAC;AACP,IAAI,WAAW,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE;AACxC,QAAQ,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;AAC5B,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,MAAM,CAAC;AAClB;;;;;;;;;;;"}
|
|
@@ -99,8 +99,8 @@ function transformOperation(operation) {
|
|
|
99
99
|
};
|
|
100
100
|
if (!transformedOperation.operationName) {
|
|
101
101
|
transformedOperation.operationName =
|
|
102
|
-
typeof transformedOperation.query !== "string"
|
|
103
|
-
|
|
102
|
+
typeof transformedOperation.query !== "string" ?
|
|
103
|
+
utilities.getOperationName(transformedOperation.query) || undefined
|
|
104
104
|
: "";
|
|
105
105
|
}
|
|
106
106
|
return transformedOperation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateOperation.js","sourceRoot":"","sources":["../../../src/link/utils/validateOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGrE,MAAM,UAAU,iBAAiB,CAAC,SAAyB;IACzD,IAAM,gBAAgB,GAAG;QACvB,OAAO;QACP,eAAe;QACf,WAAW;QACX,YAAY;QACZ,SAAS;KACV,CAAC;IACF,KAAgB,UAAsB,EAAtB,KAAA,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAtB,cAAsB,EAAtB,IAAsB,EAAE;
|
|
1
|
+
{"version":3,"file":"validateOperation.js","sourceRoot":"","sources":["../../../src/link/utils/validateOperation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAGrE,MAAM,UAAU,iBAAiB,CAAC,SAAyB;IACzD,IAAM,gBAAgB,GAAG;QACvB,OAAO;QACP,eAAe;QACf,WAAW;QACX,YAAY;QACZ,SAAS;KACV,CAAC;IACF,KAAgB,UAAsB,EAAtB,KAAA,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAtB,cAAsB,EAAtB,IAAsB,EAAE,CAAC;QAApC,IAAI,GAAG,SAAA;QACV,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,MAAM,iBAAiB,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { newInvariantError } from \"../../utilities/globals/index.js\";\nimport type { GraphQLRequest } from \"../core/index.js\";\n\nexport function validateOperation(operation: GraphQLRequest): GraphQLRequest {\n const OPERATION_FIELDS = [\n \"query\",\n \"operationName\",\n \"variables\",\n \"extensions\",\n \"context\",\n ];\n for (let key of Object.keys(operation)) {\n if (OPERATION_FIELDS.indexOf(key) < 0) {\n throw newInvariantError(`illegal argument: %s`, key);\n }\n }\n\n return operation;\n}\n"]}
|
package/link/ws/index.d.ts
CHANGED
|
@@ -4,9 +4,21 @@ import type { Operation, FetchResult } from "../core/index.js";
|
|
|
4
4
|
import { ApolloLink } from "../core/index.js";
|
|
5
5
|
import type { Observable } from "../../utilities/index.js";
|
|
6
6
|
export declare namespace WebSocketLink {
|
|
7
|
+
/**
|
|
8
|
+
* Configuration to use when constructing the subscription client (subscriptions-transport-ws).
|
|
9
|
+
*/
|
|
7
10
|
interface Configuration {
|
|
11
|
+
/**
|
|
12
|
+
* The endpoint to connect to.
|
|
13
|
+
*/
|
|
8
14
|
uri: string;
|
|
15
|
+
/**
|
|
16
|
+
* Options to pass when constructing the subscription client.
|
|
17
|
+
*/
|
|
9
18
|
options?: ClientOptions;
|
|
19
|
+
/**
|
|
20
|
+
* A custom WebSocket implementation to use.
|
|
21
|
+
*/
|
|
10
22
|
webSocketImpl?: any;
|
|
11
23
|
}
|
|
12
24
|
}
|
package/link/ws/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __extends } from "tslib";
|
|
2
2
|
import { SubscriptionClient } from "subscriptions-transport-ws";
|
|
3
3
|
import { ApolloLink } from "../core/index.js";
|
|
4
|
-
var WebSocketLink = (function (_super) {
|
|
4
|
+
var WebSocketLink = /** @class */ (function (_super) {
|
|
5
5
|
__extends(WebSocketLink, _super);
|
|
6
6
|
function WebSocketLink(paramsOrClient) {
|
|
7
7
|
var _this = _super.call(this) || this;
|
package/link/ws/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/ws/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA4B9C;IAAmC,iCAAU;IAG3C,uBACE,cAAgE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/link/ws/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA4B9C;IAAmC,iCAAU;IAG3C,uBACE,cAAgE;QAEhE,YAAA,MAAK,WAAE,SAAC;QAER,IAAI,cAAc,YAAY,kBAAkB,EAAE,CAAC;YACjD,KAAI,CAAC,kBAAkB,GAAG,cAAc,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,KAAI,CAAC,kBAAkB,GAAG,IAAI,kBAAkB,CAC9C,cAAc,CAAC,GAAG,EAClB,cAAc,CAAC,OAAO,EACtB,cAAc,CAAC,aAAa,CAC7B,CAAC;QACJ,CAAC;;IACH,CAAC;IAEM,+BAAO,GAAd,UAAe,SAAoB;QACjC,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CACpC,SAAS,CACiB,CAAC;IAC/B,CAAC;IACH,oBAAC;AAAD,CAAC,AAxBD,CAAmC,UAAU,GAwB5C","sourcesContent":["import type { ClientOptions } from \"subscriptions-transport-ws\";\nimport { SubscriptionClient } from \"subscriptions-transport-ws\";\n\nimport type { Operation, FetchResult } from \"../core/index.js\";\nimport { ApolloLink } from \"../core/index.js\";\nimport type { Observable } from \"../../utilities/index.js\";\n\nexport namespace WebSocketLink {\n /**\n * Configuration to use when constructing the subscription client (subscriptions-transport-ws).\n */\n export interface Configuration {\n /**\n * The endpoint to connect to.\n */\n uri: string;\n\n /**\n * Options to pass when constructing the subscription client.\n */\n options?: ClientOptions;\n\n /**\n * A custom WebSocket implementation to use.\n */\n webSocketImpl?: any;\n }\n}\n\n// For backwards compatibility.\nexport import WebSocketParams = WebSocketLink.Configuration;\n\nexport class WebSocketLink extends ApolloLink {\n private subscriptionClient: SubscriptionClient;\n\n constructor(\n paramsOrClient: WebSocketLink.Configuration | SubscriptionClient\n ) {\n super();\n\n if (paramsOrClient instanceof SubscriptionClient) {\n this.subscriptionClient = paramsOrClient;\n } else {\n this.subscriptionClient = new SubscriptionClient(\n paramsOrClient.uri,\n paramsOrClient.options,\n paramsOrClient.webSocketImpl\n );\n }\n }\n\n public request(operation: Operation): Observable<FetchResult> | null {\n return this.subscriptionClient.request(\n operation\n ) as Observable<FetchResult>;\n }\n}\n"]}
|
package/link/ws/ws.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var tslib = require('tslib');
|
|
|
6
6
|
var subscriptionsTransportWs = require('subscriptions-transport-ws');
|
|
7
7
|
var core = require('../core');
|
|
8
8
|
|
|
9
|
-
var WebSocketLink =
|
|
9
|
+
var WebSocketLink = (function (_super) {
|
|
10
10
|
tslib.__extends(WebSocketLink, _super);
|
|
11
11
|
function WebSocketLink(paramsOrClient) {
|
|
12
12
|
var _this = _super.call(this) || this;
|
package/link/ws/ws.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.cjs","sources":["index.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { SubscriptionClient } from \"subscriptions-transport-ws\";\nimport { ApolloLink } from \"../core/index.js\";\nvar WebSocketLink = (function (_super) {\n __extends(WebSocketLink, _super);\n function WebSocketLink(paramsOrClient) {\n var _this = _super.call(this) || this;\n if (paramsOrClient instanceof SubscriptionClient) {\n _this.subscriptionClient = paramsOrClient;\n }\n else {\n _this.subscriptionClient = new SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl);\n }\n return _this;\n }\n WebSocketLink.prototype.request = function (operation) {\n return this.subscriptionClient.request(operation);\n };\n return WebSocketLink;\n}(ApolloLink));\nexport { WebSocketLink };\n//# sourceMappingURL=index.js.map"],"names":["__extends","SubscriptionClient","ApolloLink"],"mappings":";;;;;;;;AAGG,IAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"ws.cjs","sources":["index.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { SubscriptionClient } from \"subscriptions-transport-ws\";\nimport { ApolloLink } from \"../core/index.js\";\nvar WebSocketLink = /** @class */ (function (_super) {\n __extends(WebSocketLink, _super);\n function WebSocketLink(paramsOrClient) {\n var _this = _super.call(this) || this;\n if (paramsOrClient instanceof SubscriptionClient) {\n _this.subscriptionClient = paramsOrClient;\n }\n else {\n _this.subscriptionClient = new SubscriptionClient(paramsOrClient.uri, paramsOrClient.options, paramsOrClient.webSocketImpl);\n }\n return _this;\n }\n WebSocketLink.prototype.request = function (operation) {\n return this.subscriptionClient.request(operation);\n };\n return WebSocketLink;\n}(ApolloLink));\nexport { WebSocketLink };\n//# sourceMappingURL=index.js.map"],"names":["__extends","SubscriptionClient","ApolloLink"],"mappings":";;;;;;;;AAGG,IAAC,aAAa,KAAkB,UAAU,MAAM,EAAE;AACrD,IAAIA,eAAS,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AACrC,IAAI,SAAS,aAAa,CAAC,cAAc,EAAE;AAC3C,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC9C,QAAQ,IAAI,cAAc,YAAYC,2CAAkB,EAAE;AAC1D,YAAY,KAAK,CAAC,kBAAkB,GAAG,cAAc,CAAC;AACtD,SAAS;AACT,aAAa;AACb,YAAY,KAAK,CAAC,kBAAkB,GAAG,IAAIA,2CAAkB,CAAC,cAAc,CAAC,GAAG,EAAE,cAAc,CAAC,OAAO,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;AACxI,SAAS;AACT,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,aAAa,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,SAAS,EAAE;AAC3D,QAAQ,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAC1D,KAAK,CAAC;AACN,IAAI,OAAO,aAAa,CAAC;AACzB,CAAC,CAACC,eAAU,CAAC;;;;"}
|
package/link/ws/ws.cjs.native.js
CHANGED
|
@@ -6,7 +6,7 @@ var tslib = require('tslib');
|
|
|
6
6
|
var subscriptionsTransportWs = require('subscriptions-transport-ws');
|
|
7
7
|
var core = require('../core');
|
|
8
8
|
|
|
9
|
-
var WebSocketLink =
|
|
9
|
+
var WebSocketLink = (function (_super) {
|
|
10
10
|
tslib.__extends(WebSocketLink, _super);
|
|
11
11
|
function WebSocketLink(paramsOrClient) {
|
|
12
12
|
var _this = _super.call(this) || this;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apollo/client",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.8",
|
|
4
4
|
"description": "A fully-featured caching GraphQL client.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"keywords": [
|
|
@@ -52,12 +52,11 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@graphql-typed-document-node/core": "^3.1.1",
|
|
55
|
-
"@wry/context": "^0.7.3",
|
|
56
55
|
"@wry/equality": "^0.5.6",
|
|
57
|
-
"@wry/trie": "^0.
|
|
56
|
+
"@wry/trie": "^0.5.0",
|
|
58
57
|
"graphql-tag": "^2.12.6",
|
|
59
58
|
"hoist-non-react-statics": "^3.3.2",
|
|
60
|
-
"optimism": "^0.
|
|
59
|
+
"optimism": "^0.18.0",
|
|
61
60
|
"prop-types": "^15.7.2",
|
|
62
61
|
"response-iterator": "^0.2.6",
|
|
63
62
|
"symbol-observable": "^4.0.0",
|
|
@@ -66,45 +65,45 @@
|
|
|
66
65
|
"zen-observable-ts": "^1.2.5"
|
|
67
66
|
},
|
|
68
67
|
"devDependencies": {
|
|
69
|
-
"@arethetypeswrong/cli": "0.
|
|
70
|
-
"@babel/parser": "7.23.
|
|
68
|
+
"@arethetypeswrong/cli": "0.13.2",
|
|
69
|
+
"@babel/parser": "7.23.4",
|
|
71
70
|
"@changesets/changelog-github": "0.4.8",
|
|
72
71
|
"@changesets/cli": "2.26.2",
|
|
73
|
-
"@graphql-tools/schema": "10.0.
|
|
74
|
-
"@microsoft/api-extractor": "7.38.
|
|
72
|
+
"@graphql-tools/schema": "10.0.2",
|
|
73
|
+
"@microsoft/api-extractor": "7.38.3",
|
|
75
74
|
"@rollup/plugin-node-resolve": "11.2.1",
|
|
76
|
-
"@size-limit/esbuild-why": "
|
|
77
|
-
"@size-limit/preset-small-lib": "
|
|
78
|
-
"@testing-library/jest-dom": "
|
|
79
|
-
"@testing-library/react": "14.
|
|
75
|
+
"@size-limit/esbuild-why": "11.0.0",
|
|
76
|
+
"@size-limit/preset-small-lib": "11.0.0",
|
|
77
|
+
"@testing-library/jest-dom": "6.1.4",
|
|
78
|
+
"@testing-library/react": "14.1.2",
|
|
80
79
|
"@testing-library/react-12": "npm:@testing-library/react@^12",
|
|
81
80
|
"@testing-library/user-event": "14.5.1",
|
|
82
81
|
"@tsconfig/node20": "20.1.2",
|
|
83
|
-
"@types/bytes": "3.1.
|
|
84
|
-
"@types/fetch-mock": "7.3.
|
|
82
|
+
"@types/bytes": "3.1.4",
|
|
83
|
+
"@types/fetch-mock": "7.3.8",
|
|
85
84
|
"@types/glob": "8.1.0",
|
|
86
|
-
"@types/hoist-non-react-statics": "3.3.
|
|
87
|
-
"@types/jest": "29.5.
|
|
88
|
-
"@types/lodash": "4.14.
|
|
89
|
-
"@types/node": "20.
|
|
90
|
-
"@types/node-fetch": "2.6.
|
|
91
|
-
"@types/react": "18.2.
|
|
92
|
-
"@types/react-dom": "18.2.
|
|
93
|
-
"@types/use-sync-external-store": "0.0.
|
|
94
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
95
|
-
"@typescript-eslint/parser": "6.
|
|
96
|
-
"@typescript-eslint/rule-tester": "6.
|
|
97
|
-
"@typescript-eslint/types": "6.
|
|
98
|
-
"@typescript-eslint/utils": "6.
|
|
99
|
-
"acorn": "8.
|
|
85
|
+
"@types/hoist-non-react-statics": "3.3.5",
|
|
86
|
+
"@types/jest": "29.5.10",
|
|
87
|
+
"@types/lodash": "4.14.202",
|
|
88
|
+
"@types/node": "20.10.0",
|
|
89
|
+
"@types/node-fetch": "2.6.9",
|
|
90
|
+
"@types/react": "18.2.38",
|
|
91
|
+
"@types/react-dom": "18.2.17",
|
|
92
|
+
"@types/use-sync-external-store": "0.0.6",
|
|
93
|
+
"@typescript-eslint/eslint-plugin": "6.12.0",
|
|
94
|
+
"@typescript-eslint/parser": "6.12.0",
|
|
95
|
+
"@typescript-eslint/rule-tester": "6.12.0",
|
|
96
|
+
"@typescript-eslint/types": "6.12.0",
|
|
97
|
+
"@typescript-eslint/utils": "6.12.0",
|
|
98
|
+
"acorn": "8.11.2",
|
|
100
99
|
"blob-polyfill": "7.0.20220408",
|
|
101
100
|
"bytes": "3.1.2",
|
|
102
|
-
"cross-fetch": "
|
|
103
|
-
"eslint": "8.
|
|
101
|
+
"cross-fetch": "4.0.0",
|
|
102
|
+
"eslint": "8.54.0",
|
|
104
103
|
"eslint-import-resolver-typescript": "3.6.1",
|
|
105
104
|
"eslint-plugin-import": "npm:@phryneas/eslint-plugin-import@2.27.5-pr.2813.2817.199971c",
|
|
106
|
-
"eslint-plugin-local-rules": "2.0.
|
|
107
|
-
"eslint-plugin-testing-library": "
|
|
105
|
+
"eslint-plugin-local-rules": "2.0.1",
|
|
106
|
+
"eslint-plugin-testing-library": "6.2.0",
|
|
108
107
|
"expect-type": "0.17.3",
|
|
109
108
|
"fetch-mock": "9.11.0",
|
|
110
109
|
"glob": "8.1.0",
|
|
@@ -114,28 +113,30 @@
|
|
|
114
113
|
"jest-environment-jsdom": "29.7.0",
|
|
115
114
|
"jest-junit": "16.0.0",
|
|
116
115
|
"lodash": "4.17.21",
|
|
117
|
-
"patch-package": "
|
|
118
|
-
"prettier": "3.0
|
|
116
|
+
"patch-package": "8.0.0",
|
|
117
|
+
"prettier": "3.1.0",
|
|
119
118
|
"react": "18.2.0",
|
|
120
119
|
"react-17": "npm:react@^17",
|
|
121
120
|
"react-dom": "18.2.0",
|
|
122
121
|
"react-dom-17": "npm:react-dom@^17",
|
|
123
|
-
"react-error-boundary": "
|
|
122
|
+
"react-error-boundary": "4.0.11",
|
|
124
123
|
"recast": "0.23.4",
|
|
125
124
|
"resolve": "1.22.8",
|
|
126
125
|
"rimraf": "5.0.5",
|
|
127
126
|
"rollup": "2.79.1",
|
|
127
|
+
"rollup-plugin-cleanup": "3.2.1",
|
|
128
128
|
"rollup-plugin-terser": "7.0.2",
|
|
129
129
|
"rxjs": "7.8.1",
|
|
130
|
-
"size-limit": "
|
|
130
|
+
"size-limit": "11.0.0",
|
|
131
131
|
"subscriptions-transport-ws": "0.11.0",
|
|
132
|
-
"terser": "5.
|
|
132
|
+
"terser": "5.24.0",
|
|
133
133
|
"ts-api-utils": "1.0.3",
|
|
134
134
|
"ts-jest": "29.1.1",
|
|
135
135
|
"ts-jest-resolver": "2.0.1",
|
|
136
|
+
"ts-morph": "20.0.0",
|
|
136
137
|
"ts-node": "10.9.1",
|
|
137
138
|
"typedoc": "0.25.0",
|
|
138
|
-
"typescript": "5.
|
|
139
|
+
"typescript": "5.3.2",
|
|
139
140
|
"wait-for-observables": "1.0.3",
|
|
140
141
|
"web-streams-polyfill": "3.2.1",
|
|
141
142
|
"whatwg-fetch": "3.6.19"
|
|
@@ -143,5 +144,15 @@
|
|
|
143
144
|
"publishConfig": {
|
|
144
145
|
"access": "public"
|
|
145
146
|
},
|
|
147
|
+
"files": [
|
|
148
|
+
"LICENSE",
|
|
149
|
+
"**/*.md",
|
|
150
|
+
"**/*.cjs",
|
|
151
|
+
"**/*.cjs.map",
|
|
152
|
+
"**/*.js",
|
|
153
|
+
"**/*.js.map",
|
|
154
|
+
"**/*.d.ts",
|
|
155
|
+
"**/*.json"
|
|
156
|
+
],
|
|
146
157
|
"type": "module"
|
|
147
158
|
}
|
|
@@ -3,6 +3,11 @@ import type { CacheKey } from "./types.js";
|
|
|
3
3
|
type Listener<TData> = (promise: Promise<ApolloQueryResult<TData>>) => void;
|
|
4
4
|
type FetchMoreOptions<TData> = Parameters<ObservableQuery<TData>["fetchMore"]>[0];
|
|
5
5
|
declare const QUERY_REFERENCE_SYMBOL: unique symbol;
|
|
6
|
+
/**
|
|
7
|
+
* A `QueryReference` is an opaque object returned by {@link useBackgroundQuery}.
|
|
8
|
+
* A child component reading the `QueryReference` via {@link useReadQuery} will
|
|
9
|
+
* suspend until the promise resolves.
|
|
10
|
+
*/
|
|
6
11
|
export interface QueryReference<TData = unknown> {
|
|
7
12
|
[QUERY_REFERENCE_SYMBOL]: InternalQueryReference<TData>;
|
|
8
13
|
}
|
|
@@ -23,7 +28,7 @@ export declare class InternalQueryReference<TData = unknown> {
|
|
|
23
28
|
promise: Promise<ApolloQueryResult<TData>>;
|
|
24
29
|
private subscription;
|
|
25
30
|
private listeners;
|
|
26
|
-
private autoDisposeTimeoutId
|
|
31
|
+
private autoDisposeTimeoutId?;
|
|
27
32
|
private status;
|
|
28
33
|
private resolve;
|
|
29
34
|
private reject;
|
|
@@ -18,7 +18,7 @@ var OBSERVED_CHANGED_OPTIONS = [
|
|
|
18
18
|
"refetchWritePolicy",
|
|
19
19
|
"returnPartialData",
|
|
20
20
|
];
|
|
21
|
-
var InternalQueryReference = (function () {
|
|
21
|
+
var InternalQueryReference = /** @class */ (function () {
|
|
22
22
|
function InternalQueryReference(observable, options) {
|
|
23
23
|
var _this = this;
|
|
24
24
|
this.listeners = new Set();
|
|
@@ -28,6 +28,8 @@ var InternalQueryReference = (function () {
|
|
|
28
28
|
this.handleError = this.handleError.bind(this);
|
|
29
29
|
this.dispose = this.dispose.bind(this);
|
|
30
30
|
this.observable = observable;
|
|
31
|
+
// Don't save this result as last result to prevent delivery of last result
|
|
32
|
+
// when first subscribing
|
|
31
33
|
this.result = observable.getCurrentResult(false);
|
|
32
34
|
this.key = options.key;
|
|
33
35
|
if (options.onDispose) {
|
|
@@ -54,12 +56,19 @@ var InternalQueryReference = (function () {
|
|
|
54
56
|
next: this.handleNext,
|
|
55
57
|
error: this.handleError,
|
|
56
58
|
});
|
|
59
|
+
// Start a timer that will automatically dispose of the query if the
|
|
60
|
+
// suspended resource does not use this queryRef in the given time. This
|
|
61
|
+
// helps prevent memory leaks when a component has unmounted before the
|
|
62
|
+
// query has finished loading.
|
|
57
63
|
var startDisposeTimer = function () {
|
|
58
64
|
var _a;
|
|
59
65
|
if (!_this.references) {
|
|
60
66
|
_this.autoDisposeTimeoutId = setTimeout(_this.dispose, (_a = options.autoDisposeTimeoutMs) !== null && _a !== void 0 ? _a : 30000);
|
|
61
67
|
}
|
|
62
68
|
};
|
|
69
|
+
// We wait until the request has settled to ensure we don't dispose of the
|
|
70
|
+
// query ref before the request finishes, otherwise we would leave the
|
|
71
|
+
// promise in a pending state rendering the suspense boundary indefinitely.
|
|
63
72
|
this.promise.then(startDisposeTimer, startDisposeTimer);
|
|
64
73
|
}
|
|
65
74
|
Object.defineProperty(InternalQueryReference.prototype, "watchQueryOptions", {
|
|
@@ -80,6 +89,7 @@ var InternalQueryReference = (function () {
|
|
|
80
89
|
}
|
|
81
90
|
disposed = true;
|
|
82
91
|
_this.references--;
|
|
92
|
+
// Wait before fully disposing in case the app is running in strict mode.
|
|
83
93
|
setTimeout(function () {
|
|
84
94
|
if (!_this.references) {
|
|
85
95
|
_this.dispose();
|
|
@@ -95,6 +105,8 @@ var InternalQueryReference = (function () {
|
|
|
95
105
|
};
|
|
96
106
|
InternalQueryReference.prototype.applyOptions = function (watchQueryOptions) {
|
|
97
107
|
var _a = this.watchQueryOptions, currentFetchPolicy = _a.fetchPolicy, currentCanonizeResults = _a.canonizeResults;
|
|
108
|
+
// "standby" is used when `skip` is set to `true`. Detect when we've
|
|
109
|
+
// enabled the query (i.e. `skip` is `false`) to execute a network request.
|
|
98
110
|
if (currentFetchPolicy === "standby" &&
|
|
99
111
|
currentFetchPolicy !== watchQueryOptions.fetchPolicy) {
|
|
100
112
|
this.initiateFetch(this.observable.reobserve(watchQueryOptions));
|
|
@@ -126,11 +138,14 @@ var InternalQueryReference = (function () {
|
|
|
126
138
|
this.onDispose();
|
|
127
139
|
};
|
|
128
140
|
InternalQueryReference.prototype.onDispose = function () {
|
|
141
|
+
// noop. overridable by options
|
|
129
142
|
};
|
|
130
143
|
InternalQueryReference.prototype.handleNext = function (result) {
|
|
131
144
|
var _a;
|
|
132
145
|
switch (this.status) {
|
|
133
146
|
case "loading": {
|
|
147
|
+
// Maintain the last successful `data` value if the next result does not
|
|
148
|
+
// have one.
|
|
134
149
|
if (result.data === void 0) {
|
|
135
150
|
result.data = this.result.data;
|
|
136
151
|
}
|
|
@@ -140,9 +155,14 @@ var InternalQueryReference = (function () {
|
|
|
140
155
|
break;
|
|
141
156
|
}
|
|
142
157
|
case "idle": {
|
|
158
|
+
// This occurs when switching to a result that is fully cached when this
|
|
159
|
+
// class is instantiated. ObservableQuery will run reobserve when
|
|
160
|
+
// subscribing, which delivers a result from the cache.
|
|
143
161
|
if (result.data === this.result.data) {
|
|
144
162
|
return;
|
|
145
163
|
}
|
|
164
|
+
// Maintain the last successful `data` value if the next result does not
|
|
165
|
+
// have one.
|
|
146
166
|
if (result.data === void 0) {
|
|
147
167
|
result.data = this.result.data;
|
|
148
168
|
}
|
|
@@ -180,6 +200,11 @@ var InternalQueryReference = (function () {
|
|
|
180
200
|
_this.reject = reject;
|
|
181
201
|
});
|
|
182
202
|
this.promise.catch(function () { });
|
|
203
|
+
// If the data returned from the fetch is deeply equal to the data already
|
|
204
|
+
// in the cache, `handleNext` will not be triggered leaving the promise we
|
|
205
|
+
// created in a pending state forever. To avoid this situtation, we attempt
|
|
206
|
+
// to resolve the promise if `handleNext` hasn't been run to ensure the
|
|
207
|
+
// promise is resolved correctly.
|
|
183
208
|
returnedPromise
|
|
184
209
|
.then(function (result) {
|
|
185
210
|
var _a;
|