@sumaris-net/ngx-components 2.0.5 → 2.0.7
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.
- package/esm2020/src/app/core/graphql/graphql.service.mjs +14 -9
- package/fesm2015/sumaris-net.ngx-components.mjs +32 -23
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +12 -7
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/graphql/graphql.service.d.ts +3 -2
|
@@ -15553,6 +15553,7 @@ class GraphqlService extends StartableService {
|
|
|
15553
15553
|
this.connectionParams = {};
|
|
15554
15554
|
this.onNetworkError = new Subject();
|
|
15555
15555
|
this.customErrors = {};
|
|
15556
|
+
this.onResetAuth = new Subject();
|
|
15556
15557
|
this._debug = !environment.production;
|
|
15557
15558
|
this._defaultFetchPolicy = environment.apolloFetchPolicy;
|
|
15558
15559
|
// Listen network status
|
|
@@ -15572,7 +15573,7 @@ class GraphqlService extends StartableService {
|
|
|
15572
15573
|
get defaultFetchPolicy() {
|
|
15573
15574
|
return this._defaultFetchPolicy;
|
|
15574
15575
|
}
|
|
15575
|
-
setAuthToken(token) {
|
|
15576
|
+
async setAuthToken(token) {
|
|
15576
15577
|
if (token) {
|
|
15577
15578
|
console.debug('[graphql] Apply token authentication to headers');
|
|
15578
15579
|
this.connectionParams.authToken = token;
|
|
@@ -15581,11 +15582,10 @@ class GraphqlService extends StartableService {
|
|
|
15581
15582
|
else if (this.connectionParams.authToken) {
|
|
15582
15583
|
console.debug('[graphql] Remove token authentication from headers');
|
|
15583
15584
|
delete this.connectionParams.authToken;
|
|
15584
|
-
|
|
15585
|
-
this.clearCache();
|
|
15585
|
+
await this.clearCache();
|
|
15586
15586
|
}
|
|
15587
15587
|
}
|
|
15588
|
-
setAuthBasic(basic) {
|
|
15588
|
+
async setAuthBasic(basic) {
|
|
15589
15589
|
if (basic) {
|
|
15590
15590
|
console.debug('[graphql] Apply basic authentication to headers');
|
|
15591
15591
|
this.connectionParams.authBasic = basic;
|
|
@@ -15594,8 +15594,7 @@ class GraphqlService extends StartableService {
|
|
|
15594
15594
|
else if (this.connectionParams.authBasic) {
|
|
15595
15595
|
console.debug('[graphql] Remove basic authentication from headers');
|
|
15596
15596
|
delete this.connectionParams.authBasic;
|
|
15597
|
-
|
|
15598
|
-
this.clearCache();
|
|
15597
|
+
await this.clearCache();
|
|
15599
15598
|
}
|
|
15600
15599
|
}
|
|
15601
15600
|
/**
|
|
@@ -16005,9 +16004,15 @@ class GraphqlService extends StartableService {
|
|
|
16005
16004
|
const storage = new StorageServiceWrapper(this.storage);
|
|
16006
16005
|
let client = this.apollo.client;
|
|
16007
16006
|
if (!client) {
|
|
16008
|
-
console.debug('[
|
|
16007
|
+
console.debug('[graphql] Creating Apollo GraphQL client...');
|
|
16009
16008
|
// Websocket link
|
|
16010
16009
|
const wsLink = new GraphQLWsLink(createClient(this.wsParams));
|
|
16010
|
+
this.onResetAuth
|
|
16011
|
+
.pipe(takeUntil(this.stopSubject))
|
|
16012
|
+
.subscribe(() => {
|
|
16013
|
+
console.info('[graphql] Closing websocket client, to force unauth');
|
|
16014
|
+
wsLink.client.dispose();
|
|
16015
|
+
});
|
|
16011
16016
|
// Retry when failed link
|
|
16012
16017
|
const retryLink = new RetryLink();
|
|
16013
16018
|
const authLink = new ApolloLink((operation, forward) => {
|