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

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,14 +14,13 @@ 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 { ApolloLink, InMemoryCache, gql } from '@apollo/client/core';
17
+ import { split, InMemoryCache, from as from$1, 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 { ErrorLink } from '@apollo/client/link/error';
24
- import { CombinedGraphQLErrors, CombinedProtocolErrors } from '@apollo/client/errors';
23
+ import { onError } from '@apollo/client/link/error';
25
24
  import { RetryLink } from '@apollo/client/link/retry';
26
25
  import { getMainDefinition } from '@apollo/client/utilities';
27
26
  import { add, endOfDay, startOfDay, endOfYear, startOfYear, endOfWeek, startOfWeek, endOfMonth, startOfMonth, endOfQuarter, startOfQuarter, isValid, set, addDays, parseISO, getTime } from 'date-fns';
@@ -1903,7 +1902,7 @@ class WebSocketService {
1903
1902
  initSubscriptions(options) {
1904
1903
  this.createGraphQLWsLink(options);
1905
1904
  this.createHttpLinkHandler(options);
1906
- const link = ApolloLink.split(({ query }) => {
1905
+ const link = split(({ query }) => {
1907
1906
  const definition = getMainDefinition(query);
1908
1907
  return definition.kind === Kind.OPERATION_DEFINITION && definition.operation === OperationTypeNode.SUBSCRIPTION;
1909
1908
  }, this.wsLink, this.httpLinkHandler);
@@ -1916,20 +1915,16 @@ class WebSocketService {
1916
1915
  }));
1917
1916
  return forward(operation);
1918
1917
  };
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') {
1918
+ const errorLink = onError(({ graphQLErrors, networkError, operation, forward }) => {
1919
+ if (graphQLErrors) {
1920
+ for (const error of graphQLErrors) {
1921
+ if (error.extensions?.['code'] === 'UNAUTHENTICATED') {
1924
1922
  return authLink(operation, forward);
1925
1923
  }
1926
1924
  }
1927
1925
  }
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}`);
1926
+ if (networkError) {
1927
+ console.error(`[Network error]: ${networkError}`);
1933
1928
  }
1934
1929
  return undefined;
1935
1930
  });
@@ -1945,7 +1940,10 @@ class WebSocketService {
1945
1940
  }
1946
1941
  });
1947
1942
  this.apollo.createNamed(options.apolloClientName, {
1948
- link: ApolloLink.from([new ApolloLink(authLink), retryLink, errorLink, link]),
1943
+ headers: {
1944
+ Authorization: `Bearer ${this.authService.getToken()}`
1945
+ },
1946
+ link: from$1([authLink, retryLink, errorLink, link]),
1949
1947
  cache: new InMemoryCache({ merge: true })
1950
1948
  });
1951
1949
  }