chore(deps): remove deprecated subscriptions-transport-ws
The package is no longer maintained and was only reachable via the Apollo WebSocketLink in app/plugins/apollo.ts. No Subscription type exists in the schema and no subscription operations are defined, so the ws split branch was dead code. Drop WebSocketLink, the split() routing, and the direct dependency. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+2
-28
@@ -1,7 +1,5 @@
|
||||
import { ApolloClient, ApolloLink, createHttpLink, from, InMemoryCache, split } from '@apollo/client/core'
|
||||
import { ApolloClient, ApolloLink, createHttpLink, from, InMemoryCache } from '@apollo/client/core'
|
||||
import { setContext } from '@apollo/client/link/context'
|
||||
import { WebSocketLink } from '@apollo/client/link/ws'
|
||||
import { getMainDefinition } from '@apollo/client/utilities'
|
||||
import type { GetTokenSilentlyOptions } from '@auth0/auth0-spa-js'
|
||||
import type { Auth0VueClient } from '@auth0/auth0-vue'
|
||||
import { SpanKind, TraceFlags } from '@opentelemetry/api'
|
||||
@@ -11,7 +9,6 @@ import { defineNuxtPlugin, useNuxtApp } from '#app'
|
||||
import { envConfig } from '~/utils/environment'
|
||||
|
||||
const apiUrl = envConfig(window.location.hostname).apiUrl
|
||||
const wsUrl = apiUrl.replace(/^http/, 'ws')
|
||||
|
||||
const cache = new InMemoryCache({
|
||||
typePolicies: {
|
||||
@@ -42,19 +39,6 @@ const httpLink = createHttpLink({
|
||||
uri: apiUrl,
|
||||
})
|
||||
|
||||
const wsLink = new WebSocketLink({
|
||||
uri: wsUrl,
|
||||
options: {
|
||||
reconnect: true,
|
||||
lazy: true,
|
||||
connectionParams: () => {
|
||||
return getToken({}).then((token) => ({
|
||||
authToken: token,
|
||||
}))
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const authLink = setContext(async (_, { headers }) => {
|
||||
return await getToken({}).then((token) => ({
|
||||
headers: {
|
||||
@@ -86,17 +70,7 @@ const createSpanLink = new ApolloLink((operation, forward) => {
|
||||
const link =
|
||||
from([
|
||||
createSpanLink,
|
||||
split(
|
||||
({ query }) => {
|
||||
const definition = getMainDefinition(query)
|
||||
return (
|
||||
definition.kind === 'OperationDefinition' &&
|
||||
definition.operation === 'subscription'
|
||||
)
|
||||
},
|
||||
authLink.concat(wsLink),
|
||||
authLink.concat(httpLink),
|
||||
),
|
||||
authLink.concat(httpLink),
|
||||
])
|
||||
|
||||
const instance = new ApolloClient({
|
||||
|
||||
Reference in New Issue
Block a user