@apollo/client 4.0.0-rc.8 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2488 -0
- package/README.md +6 -2
- package/__cjs/cache/inmemory/inMemoryCache.cjs +2 -2
- package/__cjs/cache/inmemory/inMemoryCache.cjs.map +1 -1
- package/__cjs/cache/inmemory/policies.cjs +18 -12
- package/__cjs/cache/inmemory/policies.cjs.map +1 -1
- package/__cjs/cache/inmemory/writeToStore.cjs +1 -1
- package/__cjs/cache/inmemory/writeToStore.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.cjs +1 -1
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/core/ObservableQuery.d.cts +1 -1
- package/__cjs/core/QueryInfo.cjs +2 -6
- package/__cjs/core/QueryInfo.cjs.map +1 -1
- package/__cjs/core/index.cjs.map +1 -1
- package/__cjs/core/index.d.cts +1 -1
- package/__cjs/incremental/handlers/defer20220824.cjs.map +1 -1
- package/__cjs/incremental/handlers/defer20220824.d.cts +9 -6
- package/__cjs/incremental/handlers/notImplemented.cjs.map +1 -1
- package/__cjs/incremental/handlers/notImplemented.d.cts +11 -0
- package/__cjs/link/batch/batchLink.cjs +30 -2
- package/__cjs/link/batch/batchLink.cjs.map +1 -1
- package/__cjs/link/batch/batchLink.d.cts +69 -2
- package/__cjs/link/batch-http/BaseBatchHttpLink.cjs +156 -0
- package/__cjs/link/batch-http/BaseBatchHttpLink.cjs.map +1 -0
- package/__cjs/link/batch-http/BaseBatchHttpLink.d.cts +68 -0
- package/__cjs/link/batch-http/batchHttpLink.cjs +3 -128
- package/__cjs/link/batch-http/batchHttpLink.cjs.map +1 -1
- package/__cjs/link/batch-http/batchHttpLink.d.cts +4 -20
- package/__cjs/link/batch-http/index.cjs +2 -1
- package/__cjs/link/batch-http/index.cjs.map +1 -1
- package/__cjs/link/batch-http/index.d.cts +2 -1
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs +3 -3
- package/__cjs/link/client-awareness/ClientAwarenessLink.cjs.map +1 -1
- package/__cjs/link/client-awareness/ClientAwarenessLink.d.cts +20 -1
- package/__cjs/link/context/index.cjs +19 -0
- package/__cjs/link/context/index.cjs.map +1 -1
- package/__cjs/link/context/index.d.cts +64 -2
- package/__cjs/link/core/ApolloLink.cjs.map +1 -1
- package/__cjs/link/core/ApolloLink.d.cts +5 -2
- package/__cjs/link/core/types.d.cts +0 -4
- package/__cjs/link/http/BaseHttpLink.cjs +59 -8
- package/__cjs/link/http/BaseHttpLink.cjs.map +1 -1
- package/__cjs/link/http/BaseHttpLink.d.cts +256 -2
- package/__cjs/link/http/HttpLink.cjs +1 -1
- package/__cjs/link/http/HttpLink.cjs.map +1 -1
- package/__cjs/link/http/HttpLink.d.cts +5 -208
- package/__cjs/link/http/rewriteURIForGET.cjs.map +1 -1
- package/__cjs/link/http/rewriteURIForGET.d.cts +2 -2
- package/__cjs/link/http/selectHttpOptionsAndBody.cjs.map +1 -1
- package/__cjs/link/http/selectHttpOptionsAndBody.d.cts +7 -7
- package/__cjs/link/index.cjs.map +1 -1
- package/__cjs/link/index.d.cts +2 -1
- package/__cjs/link/persisted-queries/index.cjs +16 -0
- package/__cjs/link/persisted-queries/index.cjs.map +1 -1
- package/__cjs/link/persisted-queries/index.d.cts +181 -0
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs +48 -0
- package/__cjs/link/remove-typename/removeTypenameFromVariables.cjs.map +1 -1
- package/__cjs/link/remove-typename/removeTypenameFromVariables.d.cts +115 -0
- package/__cjs/link/retry/retryLink.cjs +25 -3
- package/__cjs/link/retry/retryLink.cjs.map +1 -1
- package/__cjs/link/retry/retryLink.d.cts +82 -9
- package/__cjs/link/schema/index.cjs +20 -0
- package/__cjs/link/schema/index.cjs.map +1 -1
- package/__cjs/link/schema/index.d.cts +128 -6
- package/__cjs/link/ws/index.cjs +18 -0
- package/__cjs/link/ws/index.cjs.map +1 -1
- package/__cjs/link/ws/index.d.cts +56 -5
- package/__cjs/local-state/LocalState.cjs.map +1 -1
- package/__cjs/masking/GraphQLCodegenDataMasking.d.cts +10 -42
- package/__cjs/masking/PreserveTypes.cjs +3 -0
- package/__cjs/masking/PreserveTypes.cjs.map +1 -0
- package/__cjs/masking/PreserveTypes.d.cts +26 -0
- package/__cjs/masking/index.cjs.map +1 -1
- package/__cjs/masking/index.d.cts +1 -1
- package/__cjs/masking/internal/types.d.cts +0 -1
- package/__cjs/masking/types.d.cts +6 -23
- package/__cjs/react/hooks/useBackgroundQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useBackgroundQuery.d.cts +2 -1
- package/__cjs/react/hooks/useLazyQuery.d.cts +1 -1
- package/__cjs/react/hooks/useLoadableQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useLoadableQuery.d.cts +2 -1
- package/__cjs/react/hooks/useQuery.d.cts +1 -1
- package/__cjs/react/hooks/useQueryRefHandlers.cjs.map +1 -1
- package/__cjs/react/hooks/useQueryRefHandlers.d.cts +2 -1
- package/__cjs/react/hooks/useReadQuery.cjs.map +1 -1
- package/__cjs/react/hooks/useReadQuery.d.cts +1 -1
- package/__cjs/react/hooks/useSyncExternalStore.cjs +2 -6
- package/__cjs/react/hooks/useSyncExternalStore.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.cjs.map +1 -1
- package/__cjs/react/query-preloader/createQueryPreloader.d.cts +1 -1
- package/__cjs/react/types/deprecated.d.cts +1 -1
- package/__cjs/react/types/types.documentation.d.cts +1 -1
- package/__cjs/testing/core/mocking/mockSubscriptionLink.d.cts +1 -1
- package/__cjs/testing/react/MockedProvider.cjs.map +1 -1
- package/__cjs/testing/react/MockedProvider.d.cts +5 -0
- package/__cjs/utilities/common/stripTypename.cjs +11 -0
- package/__cjs/utilities/common/stripTypename.cjs.map +1 -1
- package/__cjs/utilities/common/stripTypename.d.cts +11 -0
- package/__cjs/utilities/graphql/DocumentTransform.cjs +84 -1
- package/__cjs/utilities/graphql/DocumentTransform.cjs.map +1 -1
- package/__cjs/utilities/graphql/DocumentTransform.d.cts +94 -5
- package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs +27 -0
- package/__cjs/utilities/graphql/isFormattedExecutionResult.cjs.map +1 -1
- package/__cjs/utilities/graphql/isFormattedExecutionResult.d.cts +27 -0
- package/__cjs/utilities/graphql/operations.cjs +54 -3
- package/__cjs/utilities/graphql/operations.cjs.map +1 -1
- package/__cjs/utilities/graphql/operations.d.cts +54 -3
- package/__cjs/utilities/graphql/storeUtils.cjs +9 -0
- package/__cjs/utilities/graphql/storeUtils.cjs.map +1 -1
- package/__cjs/utilities/graphql/storeUtils.d.cts +9 -0
- package/__cjs/utilities/graphql/transform.cjs +12 -1
- package/__cjs/utilities/graphql/transform.cjs.map +1 -1
- package/__cjs/utilities/graphql/transform.d.cts +12 -1
- package/__cjs/utilities/internal/canonicalStringify.cjs +30 -7
- package/__cjs/utilities/internal/canonicalStringify.cjs.map +1 -1
- package/__cjs/utilities/internal/canonicalStringify.d.cts +30 -7
- package/__cjs/utilities/internal/getMainDefinition.cjs +36 -8
- package/__cjs/utilities/internal/getMainDefinition.cjs.map +1 -1
- package/__cjs/utilities/internal/getMainDefinition.d.cts +36 -8
- package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs +2 -6
- package/__cjs/utilities/internal/removeDirectivesFromDocument.cjs.map +1 -1
- package/__cjs/utilities/internal/types/DocumentationTypes.d.cts +1 -1
- package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
- package/__cjs/v4-migration.cjs +9 -0
- package/__cjs/v4-migration.cjs.map +1 -0
- package/__cjs/v4-migration.d.cts +826 -0
- package/__cjs/version.cjs +1 -1
- package/__cjs/version.cjs.map +1 -1
- package/cache/inmemory/inMemoryCache.js +2 -2
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/policies.js +18 -12
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/writeToStore.js +1 -1
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ObservableQuery.d.ts +1 -1
- package/core/ObservableQuery.js +1 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.js +1 -2
- package/core/QueryInfo.js.map +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js.map +1 -1
- package/incremental/handlers/defer20220824.d.ts +9 -6
- package/incremental/handlers/defer20220824.js.map +1 -1
- package/incremental/handlers/notImplemented.d.ts +11 -0
- package/incremental/handlers/notImplemented.js.map +1 -1
- package/legacyEntryPoints/v4-migration/index.d.ts +1 -0
- package/legacyEntryPoints/v4-migration/index.js +1 -0
- package/legacyEntryPoints/v4-migration/v4-migration.cjs +1 -0
- package/legacyEntryPoints/v4-migration/v4-migration.d.cts +1 -0
- package/link/batch/batchLink.d.ts +69 -2
- package/link/batch/batchLink.js +30 -2
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch-http/BaseBatchHttpLink.d.ts +68 -0
- package/link/batch-http/BaseBatchHttpLink.js +152 -0
- package/link/batch-http/BaseBatchHttpLink.js.map +1 -0
- package/link/batch-http/batchHttpLink.d.ts +5 -21
- package/link/batch-http/batchHttpLink.js +1 -125
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/batch-http/index.d.ts +2 -1
- package/link/batch-http/index.js +2 -1
- package/link/batch-http/index.js.map +1 -1
- package/link/client-awareness/ClientAwarenessLink.d.ts +21 -2
- package/link/client-awareness/ClientAwarenessLink.js +3 -3
- package/link/client-awareness/ClientAwarenessLink.js.map +1 -1
- package/link/context/index.d.ts +65 -3
- package/link/context/index.js +19 -0
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +5 -2
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/types.d.ts +0 -4
- package/link/core/types.js.map +1 -1
- package/link/http/BaseHttpLink.d.ts +257 -3
- package/link/http/BaseHttpLink.js +59 -8
- package/link/http/BaseHttpLink.js.map +1 -1
- package/link/http/HttpLink.d.ts +6 -209
- package/link/http/HttpLink.js +1 -1
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +2 -2
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +7 -7
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/index.d.ts +2 -1
- package/link/index.js.map +1 -1
- package/link/persisted-queries/index.d.ts +182 -1
- package/link/persisted-queries/index.js +16 -0
- package/link/persisted-queries/index.js.map +1 -1
- package/link/remove-typename/removeTypenameFromVariables.d.ts +115 -0
- package/link/remove-typename/removeTypenameFromVariables.js +48 -0
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -1
- package/link/retry/retryLink.d.ts +83 -10
- package/link/retry/retryLink.js +25 -3
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +129 -7
- package/link/schema/index.js +20 -0
- package/link/schema/index.js.map +1 -1
- package/link/ws/index.d.ts +56 -5
- package/link/ws/index.js +18 -0
- package/link/ws/index.js.map +1 -1
- package/local-state/LocalState.js.map +1 -1
- package/masking/GraphQLCodegenDataMasking.d.ts +10 -42
- package/masking/GraphQLCodegenDataMasking.js.map +1 -1
- package/masking/PreserveTypes.d.ts +26 -0
- package/masking/PreserveTypes.js +2 -0
- package/masking/PreserveTypes.js.map +1 -0
- package/masking/index.d.ts +1 -1
- package/masking/index.js.map +1 -1
- package/masking/internal/types.d.ts +0 -1
- package/masking/internal/types.js.map +1 -1
- package/masking/types.d.ts +6 -23
- package/masking/types.js.map +1 -1
- package/package.json +8 -2
- package/react/hooks/useBackgroundQuery.d.ts +2 -1
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +1 -1
- package/react/hooks/useLoadableQuery.d.ts +2 -1
- package/react/hooks/useLoadableQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts +1 -1
- package/react/hooks/useQueryRefHandlers.d.ts +2 -1
- package/react/hooks/useQueryRefHandlers.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +1 -1
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSyncExternalStore.js +1 -1
- package/react/hooks/useSyncExternalStore.js.map +1 -1
- package/react/hooks-compiled/useBackgroundQuery.d.ts +2 -1
- package/react/hooks-compiled/useBackgroundQuery.js.map +1 -1
- package/react/hooks-compiled/useLazyQuery.d.ts +1 -1
- package/react/hooks-compiled/useLoadableQuery.d.ts +2 -1
- package/react/hooks-compiled/useLoadableQuery.js.map +1 -1
- package/react/hooks-compiled/useQuery.d.ts +1 -1
- package/react/hooks-compiled/useQueryRefHandlers.d.ts +2 -1
- package/react/hooks-compiled/useQueryRefHandlers.js.map +1 -1
- package/react/hooks-compiled/useReadQuery.d.ts +1 -1
- package/react/hooks-compiled/useReadQuery.js.map +1 -1
- package/react/hooks-compiled/useSyncExternalStore.js +1 -1
- package/react/hooks-compiled/useSyncExternalStore.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.d.ts +1 -1
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/types/deprecated.d.ts +1 -1
- package/react/types/deprecated.js.map +1 -1
- package/react/types/types.documentation.d.ts +1 -1
- package/react/types/types.documentation.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +1 -1
- package/testing/react/MockedProvider.d.ts +5 -0
- package/testing/react/MockedProvider.js.map +1 -1
- package/utilities/common/stripTypename.d.ts +11 -0
- package/utilities/common/stripTypename.js +11 -0
- package/utilities/common/stripTypename.js.map +1 -1
- package/utilities/graphql/DocumentTransform.d.ts +94 -5
- package/utilities/graphql/DocumentTransform.js +84 -1
- package/utilities/graphql/DocumentTransform.js.map +1 -1
- package/utilities/graphql/isFormattedExecutionResult.d.ts +27 -0
- package/utilities/graphql/isFormattedExecutionResult.js +27 -0
- package/utilities/graphql/isFormattedExecutionResult.js.map +1 -1
- package/utilities/graphql/operations.d.ts +54 -3
- package/utilities/graphql/operations.js +54 -3
- package/utilities/graphql/operations.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +9 -0
- package/utilities/graphql/storeUtils.js +9 -0
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts +12 -1
- package/utilities/graphql/transform.js +12 -1
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/internal/canonicalStringify.d.ts +30 -7
- package/utilities/internal/canonicalStringify.js +30 -7
- package/utilities/internal/canonicalStringify.js.map +1 -1
- package/utilities/internal/getMainDefinition.d.ts +37 -9
- package/utilities/internal/getMainDefinition.js +36 -8
- package/utilities/internal/getMainDefinition.js.map +1 -1
- package/utilities/internal/removeDirectivesFromDocument.js +1 -2
- package/utilities/internal/removeDirectivesFromDocument.js.map +1 -1
- package/utilities/internal/types/DocumentationTypes.d.ts +1 -1
- package/utilities/subscriptions/relay/index.js.map +1 -1
- package/v4-migration.d.ts +826 -0
- package/v4-migration.js +8 -0
- package/v4-migration.js.map +1 -0
- package/version.js +1 -1
- package/version.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/link/ws/index.ts"],"sourcesContent":["import type { Observable } from \"rxjs\";\nimport type { ClientOptions } from \"subscriptions-transport-ws\";\nimport { SubscriptionClient } from \"subscriptions-transport-ws\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nexport declare namespace WebSocketLink {\n /**\n * Configuration
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/link/ws/index.ts"],"sourcesContent":["import type { Observable } from \"rxjs\";\nimport type { ClientOptions } from \"subscriptions-transport-ws\";\nimport { SubscriptionClient } from \"subscriptions-transport-ws\";\n\nimport { ApolloLink } from \"@apollo/client/link\";\nimport { __DEV__ } from \"@apollo/client/utilities/environment\";\nimport { invariant } from \"@apollo/client/utilities/invariant\";\n\nexport declare namespace WebSocketLink {\n /**\n * Configuration options for creating a `WebSocketLink` instance.\n *\n * @remarks\n *\n * These configuration options are used when creating a `WebSocketLink` without\n * providing an existing `SubscriptionClient` instance. The options are passed\n * directly to the `SubscriptionClient` constructor from the `subscriptions-transport-ws`\n * library.\n */\n export interface Configuration {\n /**\n * The WebSocket endpoint URI to connect to.\n *\n * This should be a valid WebSocket URI (starting with `ws://` or `wss://`)\n * that points to your GraphQL subscription endpoint.\n *\n * @example \"ws://localhost:4000/subscriptions\"\n * @example \"wss://api.example.com/graphql\"\n */\n uri: string;\n\n /**\n * Configuration options passed to the underlying `SubscriptionClient`.\n *\n * These options configure the WebSocket connection behavior, including\n * reconnection settings, connection parameters, and event handlers.\n *\n * For a complete list of available options, see the\n * [supported `subscriptions-transport-ws` options](https://github.com/apollographql/subscriptions-transport-ws/blob/master/src/client.ts#L61-L71).\n */\n options?: ClientOptions;\n\n /**\n * A custom WebSocket implementation to use for the connection.\n *\n * This is useful in environments that don't have native WebSocket support.\n * You can provide a WebSocket polyfill or implementation that conforms to\n * the W3C WebSocket API.\n *\n * @example\n *\n * ```ts\n * import WebSocket from \"ws\";\n *\n * const wsLink = new WebSocketLink({\n * uri: \"ws://localhost:4000/subscriptions\",\n * webSocketImpl: WebSocket,\n * });\n * ```\n */\n webSocketImpl?: any;\n }\n}\n\n/**\n * `WebSocketLink` is a terminating link that executes GraphQL operations over\n * WebSocket connections using the `subscriptions-transport-ws` library. It's\n * primarily used for GraphQL subscriptions but can also handle queries and\n * mutations.\n *\n * @example\n *\n * ```ts\n * import { WebSocketLink } from \"@apollo/client/link/ws\";\n * import { SubscriptionClient } from \"subscriptions-transport-ws\";\n *\n * const wsLink = new WebSocketLink(\n * new SubscriptionClient(\"ws://localhost:4000/subscriptions\", {\n * reconnect: true,\n * })\n * );\n * ```\n *\n * @deprecated `WebSocketLink` uses the deprecated and unmaintained\n * `subscriptions-transport-ws` library. This link is no longer maintained and\n * will be removed in a future major version of Apollo Client. We recommend\n * switching to `GraphQLWsLink`, which uses the [`graphql-ws` library](https://the-guild.dev/graphql/ws) to\n * send GraphQL operations through WebSocket connections.\n */\nexport class WebSocketLink extends ApolloLink {\n private subscriptionClient: SubscriptionClient;\n\n constructor(\n paramsOrClient: WebSocketLink.Configuration | SubscriptionClient\n ) {\n super();\n\n if (__DEV__) {\n invariant.warn(\n \"`WebSocketLink` uses the deprecated and unmaintained `subscriptions-transport-ws` library. This link is no longer maintained and will be removed in a future major version of Apollo Client. We recommend switching to `GraphQLWsLink` which uses the `graphql-ws` library to send GraphQL operations through WebSocket connections (https://the-guild.dev/graphql/ws).\"\n );\n }\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(\n operation: ApolloLink.Operation\n ): Observable<ApolloLink.Result> {\n return this.subscriptionClient.request(\n operation\n ) as Observable<ApolloLink.Result>;\n }\n}\n"],"names":[],"mappings":";;;;;;;AAEA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAEA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkC,CAAC,CAAnC,CAAA,CAAA,CAAA,CAAA,CAAA,CAA0C,CACpC,CADN,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACe,CACuB;IACpC;AACF;AAhCA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;"}
|
|
@@ -4,25 +4,76 @@ import { SubscriptionClient } from "subscriptions-transport-ws";
|
|
|
4
4
|
import { ApolloLink } from "@apollo/client/link";
|
|
5
5
|
export declare namespace WebSocketLink {
|
|
6
6
|
/**
|
|
7
|
-
* Configuration
|
|
7
|
+
* Configuration options for creating a `WebSocketLink` instance.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
*
|
|
11
|
+
* These configuration options are used when creating a `WebSocketLink` without
|
|
12
|
+
* providing an existing `SubscriptionClient` instance. The options are passed
|
|
13
|
+
* directly to the `SubscriptionClient` constructor from the `subscriptions-transport-ws`
|
|
14
|
+
* library.
|
|
8
15
|
*/
|
|
9
16
|
interface Configuration {
|
|
10
17
|
/**
|
|
11
|
-
* The endpoint to connect to.
|
|
18
|
+
* The WebSocket endpoint URI to connect to.
|
|
19
|
+
*
|
|
20
|
+
* This should be a valid WebSocket URI (starting with `ws://` or `wss://`)
|
|
21
|
+
* that points to your GraphQL subscription endpoint.
|
|
22
|
+
*
|
|
23
|
+
* @example "ws://localhost:4000/subscriptions"
|
|
24
|
+
* @example "wss://api.example.com/graphql"
|
|
12
25
|
*/
|
|
13
26
|
uri: string;
|
|
14
27
|
/**
|
|
15
|
-
*
|
|
28
|
+
* Configuration options passed to the underlying `SubscriptionClient`.
|
|
29
|
+
*
|
|
30
|
+
* These options configure the WebSocket connection behavior, including
|
|
31
|
+
* reconnection settings, connection parameters, and event handlers.
|
|
32
|
+
*
|
|
33
|
+
* For a complete list of available options, see the
|
|
34
|
+
* [supported `subscriptions-transport-ws` options](https://github.com/apollographql/subscriptions-transport-ws/blob/master/src/client.ts#L61-L71).
|
|
16
35
|
*/
|
|
17
36
|
options?: ClientOptions;
|
|
18
37
|
/**
|
|
19
|
-
* A custom WebSocket implementation to use.
|
|
38
|
+
* A custom WebSocket implementation to use for the connection.
|
|
39
|
+
*
|
|
40
|
+
* This is useful in environments that don't have native WebSocket support.
|
|
41
|
+
* You can provide a WebSocket polyfill or implementation that conforms to
|
|
42
|
+
* the W3C WebSocket API.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* import WebSocket from "ws";
|
|
48
|
+
*
|
|
49
|
+
* const wsLink = new WebSocketLink({
|
|
50
|
+
* uri: "ws://localhost:4000/subscriptions",
|
|
51
|
+
* webSocketImpl: WebSocket,
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
20
54
|
*/
|
|
21
55
|
webSocketImpl?: any;
|
|
22
56
|
}
|
|
23
57
|
}
|
|
24
|
-
export import WebSocketParams = WebSocketLink.Configuration;
|
|
25
58
|
/**
|
|
59
|
+
* `WebSocketLink` is a terminating link that executes GraphQL operations over
|
|
60
|
+
* WebSocket connections using the `subscriptions-transport-ws` library. It's
|
|
61
|
+
* primarily used for GraphQL subscriptions but can also handle queries and
|
|
62
|
+
* mutations.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
*
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { WebSocketLink } from "@apollo/client/link/ws";
|
|
68
|
+
* import { SubscriptionClient } from "subscriptions-transport-ws";
|
|
69
|
+
*
|
|
70
|
+
* const wsLink = new WebSocketLink(
|
|
71
|
+
* new SubscriptionClient("ws://localhost:4000/subscriptions", {
|
|
72
|
+
* reconnect: true,
|
|
73
|
+
* })
|
|
74
|
+
* );
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
26
77
|
* @deprecated `WebSocketLink` uses the deprecated and unmaintained
|
|
27
78
|
* `subscriptions-transport-ws` library. This link is no longer maintained and
|
|
28
79
|
* will be removed in a future major version of Apollo Client. We recommend
|