@alfresco/adf-process-services-cloud 9.2.0-37447095944 → 9.2.0-37457766199
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.
|
@@ -14,13 +14,14 @@ import * as i2 from '@angular/material/progress-spinner';
|
|
|
14
14
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
|
15
15
|
import * as i6$1 from '@angular/material/core';
|
|
16
16
|
import { DateAdapter, MAT_DATE_FORMATS, MatLineModule, MatOptionModule } from '@angular/material/core';
|
|
17
|
-
import {
|
|
17
|
+
import { ApolloLink, InMemoryCache, gql } from '@apollo/client/core';
|
|
18
18
|
import { createClient } from 'graphql-ws';
|
|
19
19
|
import { GraphQLWsLink } from '@apollo/client/link/subscriptions';
|
|
20
20
|
import { Apollo } from 'apollo-angular';
|
|
21
21
|
import { HttpLink } from 'apollo-angular/http';
|
|
22
22
|
import { Kind, OperationTypeNode } from 'graphql';
|
|
23
|
-
import {
|
|
23
|
+
import { ErrorLink } from '@apollo/client/link/error';
|
|
24
|
+
import { CombinedGraphQLErrors, CombinedProtocolErrors } from '@apollo/client/errors';
|
|
24
25
|
import { RetryLink } from '@apollo/client/link/retry';
|
|
25
26
|
import { getMainDefinition } from '@apollo/client/utilities';
|
|
26
27
|
import { add, endOfDay, startOfDay, endOfYear, startOfYear, endOfWeek, startOfWeek, endOfMonth, startOfMonth, endOfQuarter, startOfQuarter, isValid, set, addDays, parseISO, getTime } from 'date-fns';
|
|
@@ -1902,7 +1903,7 @@ class WebSocketService {
|
|
|
1902
1903
|
initSubscriptions(options) {
|
|
1903
1904
|
this.createGraphQLWsLink(options);
|
|
1904
1905
|
this.createHttpLinkHandler(options);
|
|
1905
|
-
const link = split(({ query }) => {
|
|
1906
|
+
const link = ApolloLink.split(({ query }) => {
|
|
1906
1907
|
const definition = getMainDefinition(query);
|
|
1907
1908
|
return definition.kind === Kind.OPERATION_DEFINITION && definition.operation === OperationTypeNode.SUBSCRIPTION;
|
|
1908
1909
|
}, this.wsLink, this.httpLinkHandler);
|
|
@@ -1915,16 +1916,22 @@ class WebSocketService {
|
|
|
1915
1916
|
}));
|
|
1916
1917
|
return forward(operation);
|
|
1917
1918
|
};
|
|
1918
|
-
const errorLink =
|
|
1919
|
-
if (
|
|
1920
|
-
for (const
|
|
1921
|
-
|
|
1919
|
+
const errorLink = new ErrorLink(({ error, operation, forward }) => {
|
|
1920
|
+
if (CombinedGraphQLErrors.is(error)) {
|
|
1921
|
+
for (const { message, locations, path, extensions } of error.errors) {
|
|
1922
|
+
console.error(`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`);
|
|
1923
|
+
if (extensions?.['code'] === 'UNAUTHENTICATED') {
|
|
1922
1924
|
return authLink(operation, forward);
|
|
1923
1925
|
}
|
|
1924
1926
|
}
|
|
1925
1927
|
}
|
|
1926
|
-
if (
|
|
1927
|
-
|
|
1928
|
+
else if (CombinedProtocolErrors.is(error)) {
|
|
1929
|
+
for (const { message, extensions } of error.errors) {
|
|
1930
|
+
console.error(`[Protocol error]: Message: ${message}, Extensions: ${JSON.stringify(extensions)}`);
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
else {
|
|
1934
|
+
console.error(`[Network error]: ${error}`);
|
|
1928
1935
|
}
|
|
1929
1936
|
return undefined;
|
|
1930
1937
|
});
|
|
@@ -1940,10 +1947,7 @@ class WebSocketService {
|
|
|
1940
1947
|
}
|
|
1941
1948
|
});
|
|
1942
1949
|
this.apollo.createNamed(options.apolloClientName, {
|
|
1943
|
-
|
|
1944
|
-
Authorization: `Bearer ${this.authService.getToken()}`
|
|
1945
|
-
},
|
|
1946
|
-
link: from$1([authLink, retryLink, errorLink, link]),
|
|
1950
|
+
link: ApolloLink.from([new ApolloLink(authLink), retryLink, errorLink, link]),
|
|
1947
1951
|
cache: new InMemoryCache({ merge: true })
|
|
1948
1952
|
});
|
|
1949
1953
|
}
|