@alfresco/adf-process-services-cloud 9.2.0-37283605383 → 9.2.0-37332903076

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 { split, InMemoryCache, from as from$1, gql } from '@apollo/client/core';
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 { onError } from '@apollo/client/link/error';
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,20 @@ class WebSocketService {
1915
1916
  }));
1916
1917
  return forward(operation);
1917
1918
  };
1918
- const errorLink = onError(({ graphQLErrors, networkError, operation, forward }) => {
1919
- if (graphQLErrors) {
1920
- for (const error of graphQLErrors) {
1921
- if (error.extensions?.['code'] === 'UNAUTHENTICATED') {
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 (networkError) {
1927
- console.error(`[Network error]: ${networkError}`);
1928
+ else if (CombinedProtocolErrors.is(error)) {
1929
+ error.errors.forEach(({ message, extensions }) => console.error(`[Protocol error]: Message: ${message}, Extensions: ${JSON.stringify(extensions)}`));
1930
+ }
1931
+ else {
1932
+ console.error(`[Network error]: ${error}`);
1928
1933
  }
1929
1934
  return undefined;
1930
1935
  });
@@ -1940,10 +1945,7 @@ class WebSocketService {
1940
1945
  }
1941
1946
  });
1942
1947
  this.apollo.createNamed(options.apolloClientName, {
1943
- headers: {
1944
- Authorization: `Bearer ${this.authService.getToken()}`
1945
- },
1946
- link: from$1([authLink, retryLink, errorLink, link]),
1948
+ link: ApolloLink.from([new ApolloLink(authLink), retryLink, errorLink, link]),
1947
1949
  cache: new InMemoryCache({ merge: true })
1948
1950
  });
1949
1951
  }