@alfresco/adf-process-services-cloud 9.2.0-33655778504 → 9.2.0-33748917016
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.
|
@@ -1868,7 +1868,6 @@ class WebSocketService {
|
|
|
1868
1868
|
this.httpLink = inject(HttpLink);
|
|
1869
1869
|
this.authService = inject(AuthenticationService);
|
|
1870
1870
|
this.appConfigService = inject(AppConfigService);
|
|
1871
|
-
this.subscriptionProtocol = 'graphql-ws';
|
|
1872
1871
|
}
|
|
1873
1872
|
getSubscription(options) {
|
|
1874
1873
|
const { apolloClientName, subscriptionOptions } = options;
|
|
@@ -1906,8 +1905,7 @@ class WebSocketService {
|
|
|
1906
1905
|
operation.setContext(({ headers }) => ({
|
|
1907
1906
|
headers: {
|
|
1908
1907
|
...headers,
|
|
1909
|
-
|
|
1910
|
-
...(this.subscriptionProtocol === 'transport-ws' && { 'X-Authorization': `Bearer ${this.authService.getToken()}` })
|
|
1908
|
+
Authorization: `Bearer ${this.authService.getToken()}`
|
|
1911
1909
|
}
|
|
1912
1910
|
}));
|
|
1913
1911
|
return forward(operation);
|
|
@@ -1915,14 +1913,15 @@ class WebSocketService {
|
|
|
1915
1913
|
const errorLink = onError(({ graphQLErrors, networkError, operation, forward }) => {
|
|
1916
1914
|
if (graphQLErrors) {
|
|
1917
1915
|
for (const error of graphQLErrors) {
|
|
1918
|
-
if (error.extensions
|
|
1919
|
-
authLink(operation, forward);
|
|
1916
|
+
if (error.extensions?.['code'] === 'UNAUTHENTICATED') {
|
|
1917
|
+
return authLink(operation, forward);
|
|
1920
1918
|
}
|
|
1921
1919
|
}
|
|
1922
1920
|
}
|
|
1923
1921
|
if (networkError) {
|
|
1924
1922
|
console.error(`[Network error]: ${networkError}`);
|
|
1925
1923
|
}
|
|
1924
|
+
return undefined;
|
|
1926
1925
|
});
|
|
1927
1926
|
const retryLink = new RetryLink({
|
|
1928
1927
|
delay: {
|
|
@@ -1937,28 +1936,31 @@ class WebSocketService {
|
|
|
1937
1936
|
});
|
|
1938
1937
|
this.apollo.createNamed(options.apolloClientName, {
|
|
1939
1938
|
headers: {
|
|
1940
|
-
|
|
1941
|
-
...(this.subscriptionProtocol === 'transport-ws' && { 'X-Authorization': `Bearer ${this.authService.getToken()}` })
|
|
1939
|
+
Authorization: `Bearer ${this.authService.getToken()}`
|
|
1942
1940
|
},
|
|
1943
1941
|
link: from$1([authLink, retryLink, errorLink, link]),
|
|
1944
1942
|
cache: new InMemoryCache({ merge: true })
|
|
1945
1943
|
});
|
|
1946
1944
|
}
|
|
1947
1945
|
createGraphQLWsLink(options) {
|
|
1948
|
-
this.wsLink = new GraphQLWsLink(
|
|
1946
|
+
this.wsLink = new GraphQLWsLink(this.createWsClient({
|
|
1949
1947
|
url: this.createWsUrl(options.wsUrl) + '/v2/ws/graphql',
|
|
1950
1948
|
connectionParams: () => ({
|
|
1951
1949
|
Authorization: 'Bearer ' + this.authService.getToken()
|
|
1952
1950
|
}),
|
|
1953
1951
|
on: {
|
|
1954
|
-
error: () =>
|
|
1955
|
-
this.apollo.removeClient(options.apolloClientName);
|
|
1956
|
-
this.initSubscriptions(options);
|
|
1957
|
-
}
|
|
1952
|
+
error: () => this.reconnect(options)
|
|
1958
1953
|
},
|
|
1959
1954
|
lazy: true
|
|
1960
1955
|
}));
|
|
1961
1956
|
}
|
|
1957
|
+
createWsClient(clientOptions) {
|
|
1958
|
+
return createClient(clientOptions);
|
|
1959
|
+
}
|
|
1960
|
+
reconnect(options) {
|
|
1961
|
+
this.apollo.removeClient(options.apolloClientName);
|
|
1962
|
+
this.initSubscriptions(options);
|
|
1963
|
+
}
|
|
1962
1964
|
createHttpLinkHandler(options) {
|
|
1963
1965
|
this.httpLinkHandler = options.httpUrl
|
|
1964
1966
|
? this.httpLink.create({
|