nuxeo-development-framework 5.8.3-rc2 → 5.8.3-rc4
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.
|
@@ -20,6 +20,10 @@ import * as i2 from '@angular/cdk/bidi';
|
|
|
20
20
|
import * as i1$3 from '@angular/common/http';
|
|
21
21
|
import { HttpClient, provideHttpClient, withInterceptorsFromDi, HttpHeaders, HttpStatusCode } from '@angular/common/http';
|
|
22
22
|
import { __decorate, __param } from 'tslib';
|
|
23
|
+
import Nuxeo from 'nuxeo';
|
|
24
|
+
import * as doFetch from 'nuxeo/lib/deps/fetch';
|
|
25
|
+
import * as Unmarshallers from 'nuxeo/lib/unmarshallers/unmarshallers';
|
|
26
|
+
import * as qs from 'querystring';
|
|
23
27
|
import * as i2$1 from 'keycloak-angular';
|
|
24
28
|
import { KeycloakAngularModule } from 'keycloak-angular';
|
|
25
29
|
import * as i3 from 'ngx-cookie-service';
|
|
@@ -574,12 +578,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImpor
|
|
|
574
578
|
}]
|
|
575
579
|
}], ctorParameters: () => [{ type: i1$3.HttpClient }] });
|
|
576
580
|
|
|
577
|
-
|
|
578
|
-
const doFetch$1 = require('nuxeo/lib/deps/fetch');
|
|
579
|
-
const Unmarshallers$1 = require('nuxeo/lib/unmarshallers/unmarshallers');
|
|
580
|
-
const Authentication$1 = require('nuxeo/lib/auth/auth');
|
|
581
|
-
const qs = require('querystring');
|
|
582
|
-
let NewNuxeoOverride = class NewNuxeoOverride extends Nuxeo$1 {
|
|
581
|
+
let NewNuxeoOverride = class NewNuxeoOverride extends Nuxeo {
|
|
583
582
|
constructor(opts = {}, environment, cookieService) {
|
|
584
583
|
super(opts);
|
|
585
584
|
this.environment = environment;
|
|
@@ -593,7 +592,7 @@ let NewNuxeoOverride = class NewNuxeoOverride extends Nuxeo$1 {
|
|
|
593
592
|
method: options.method,
|
|
594
593
|
headers: options.headers,
|
|
595
594
|
body: options.body,
|
|
596
|
-
signal: options.signal
|
|
595
|
+
signal: options.signal
|
|
597
596
|
};
|
|
598
597
|
if (opts.credentials) {
|
|
599
598
|
fetchOptions.credentials = opts.credentials;
|
|
@@ -601,13 +600,13 @@ let NewNuxeoOverride = class NewNuxeoOverride extends Nuxeo$1 {
|
|
|
601
600
|
else if (!this._auth) {
|
|
602
601
|
fetchOptions.credentials = 'include';
|
|
603
602
|
}
|
|
604
|
-
doFetch
|
|
603
|
+
doFetch(options.url, fetchOptions)
|
|
605
604
|
.then((res) => {
|
|
606
605
|
this._activeRequests -= 1;
|
|
607
606
|
if (res.status === 401 && !opts.refreshedAuthentication) {
|
|
608
607
|
// try re-authenticate
|
|
609
608
|
opts.refreshedAuthentication = true;
|
|
610
|
-
return this.refreshAccessToken()
|
|
609
|
+
return (this.refreshAccessToken()
|
|
611
610
|
// return Authentication.refreshAuthentication(this._baseURL, this._auth)
|
|
612
611
|
.then((refreshedToken) => {
|
|
613
612
|
// this.keycloak.getToken().then(refreshedAuth => {
|
|
@@ -629,9 +628,9 @@ let NewNuxeoOverride = class NewNuxeoOverride extends Nuxeo$1 {
|
|
|
629
628
|
this.logout();
|
|
630
629
|
this.login();
|
|
631
630
|
throw res;
|
|
632
|
-
});
|
|
631
|
+
}));
|
|
633
632
|
}
|
|
634
|
-
if (
|
|
633
|
+
if (!/^2/.test(`${res.status}`)) {
|
|
635
634
|
const error = new Error(res);
|
|
636
635
|
throw res;
|
|
637
636
|
}
|
|
@@ -641,12 +640,13 @@ let NewNuxeoOverride = class NewNuxeoOverride extends Nuxeo$1 {
|
|
|
641
640
|
const contentType = res.headers.get('content-type');
|
|
642
641
|
if (contentType && contentType.indexOf('application/json') === 0) {
|
|
643
642
|
options.nuxeo = this;
|
|
644
|
-
return resolve(res.json().then((json) => Unmarshallers
|
|
643
|
+
return resolve(res.json().then((json) => Unmarshallers.unmarshall(json, options, res)));
|
|
645
644
|
}
|
|
646
645
|
return resolve(res);
|
|
647
|
-
})
|
|
646
|
+
})
|
|
647
|
+
.catch((error) => {
|
|
648
648
|
this._activeRequests -= 1;
|
|
649
|
-
error.text().then(data => {
|
|
649
|
+
error.text().then((data) => {
|
|
650
650
|
let ret = {};
|
|
651
651
|
try {
|
|
652
652
|
ret = data ? JSON.parse(data) : {};
|
|
@@ -697,10 +697,10 @@ let NewNuxeoOverride = class NewNuxeoOverride extends Nuxeo$1 {
|
|
|
697
697
|
client_secret: clientSecret
|
|
698
698
|
};
|
|
699
699
|
// const url = baseURL.endsWith('/') ? baseURL : `${baseURL}/`;
|
|
700
|
-
return new Promise((resolve, reject) =>
|
|
700
|
+
return new Promise((resolve, reject) => doFetch(`${baseURL}/oauth2/token`, {
|
|
701
701
|
method: 'POST',
|
|
702
702
|
body: qs.stringify(body),
|
|
703
|
-
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
|
703
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
|
|
704
704
|
})
|
|
705
705
|
.then((res) => res.json())
|
|
706
706
|
.then((token) => {
|
|
@@ -709,18 +709,13 @@ let NewNuxeoOverride = class NewNuxeoOverride extends Nuxeo$1 {
|
|
|
709
709
|
}
|
|
710
710
|
return resolve(token);
|
|
711
711
|
})
|
|
712
|
-
.catch((e) => reject(e)))
|
|
712
|
+
.catch((e) => reject(e)));
|
|
713
713
|
}
|
|
714
|
-
;
|
|
715
714
|
};
|
|
716
715
|
NewNuxeoOverride = __decorate([
|
|
717
716
|
__param(1, Inject('environment'))
|
|
718
717
|
], NewNuxeoOverride);
|
|
719
718
|
|
|
720
|
-
const Nuxeo = require('nuxeo');
|
|
721
|
-
const doFetch = require('nuxeo/lib/deps/fetch');
|
|
722
|
-
const Unmarshallers = require('nuxeo/lib/unmarshallers/unmarshallers');
|
|
723
|
-
const Authentication = require('nuxeo/lib/auth/auth');
|
|
724
719
|
class NuxeoOverride extends Nuxeo {
|
|
725
720
|
constructor(opts = {}, keycloak) {
|
|
726
721
|
super(opts);
|
|
@@ -734,7 +729,7 @@ class NuxeoOverride extends Nuxeo {
|
|
|
734
729
|
method: options.method,
|
|
735
730
|
headers: options.headers,
|
|
736
731
|
body: options.body,
|
|
737
|
-
signal: options.signal
|
|
732
|
+
signal: options.signal
|
|
738
733
|
};
|
|
739
734
|
if (opts.credentials) {
|
|
740
735
|
fetchOptions.credentials = opts.credentials;
|
|
@@ -748,10 +743,11 @@ class NuxeoOverride extends Nuxeo {
|
|
|
748
743
|
if (res.status === 401 && !opts.refreshedAuthentication) {
|
|
749
744
|
// try re-authenticate
|
|
750
745
|
opts.refreshedAuthentication = true;
|
|
751
|
-
return this.keycloak
|
|
746
|
+
return this.keycloak
|
|
747
|
+
.updateToken()
|
|
752
748
|
.then((didRefresh) => {
|
|
753
749
|
if (didRefresh) {
|
|
754
|
-
this.keycloak.getToken().then(refreshedAuth => {
|
|
750
|
+
this.keycloak.getToken().then((refreshedAuth) => {
|
|
755
751
|
this._auth = refreshedAuth;
|
|
756
752
|
this._notifyAuthenticationRefreshed(refreshedAuth);
|
|
757
753
|
return resolve(this.http(opts));
|
|
@@ -766,7 +762,7 @@ class NuxeoOverride extends Nuxeo {
|
|
|
766
762
|
throw res;
|
|
767
763
|
});
|
|
768
764
|
}
|
|
769
|
-
if (
|
|
765
|
+
if (!/^2/.test(`${res.status}`)) {
|
|
770
766
|
const error = new Error(res);
|
|
771
767
|
throw res;
|
|
772
768
|
}
|
|
@@ -779,9 +775,10 @@ class NuxeoOverride extends Nuxeo {
|
|
|
779
775
|
return resolve(res.json().then((json) => Unmarshallers.unmarshall(json, options, res)));
|
|
780
776
|
}
|
|
781
777
|
return resolve(res);
|
|
782
|
-
})
|
|
778
|
+
})
|
|
779
|
+
.catch((error) => {
|
|
783
780
|
this._activeRequests -= 1;
|
|
784
|
-
error.text().then(data => {
|
|
781
|
+
error.text().then((data) => {
|
|
785
782
|
let ret = {};
|
|
786
783
|
try {
|
|
787
784
|
ret = data ? JSON.parse(data) : {};
|