@seniorsistemas/platform-components 5.1.3 → 5.2.0
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/bundles/seniorsistemas-platform-components.umd.js +38 -10
- package/bundles/seniorsistemas-platform-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-platform-components.umd.min.js +1 -1
- package/bundles/seniorsistemas-platform-components.umd.min.js.map +1 -1
- package/esm2015/modules/http-interceptor/http-interceptor.module.js +3 -2
- package/esm2015/modules/http-interceptor/http-interceptor.service.js +21 -11
- package/esm2015/modules/http-interceptor/index.js +2 -1
- package/esm2015/modules/http-interceptor/x-services-url.service.js +17 -0
- package/esm5/modules/http-interceptor/http-interceptor.module.js +3 -2
- package/esm5/modules/http-interceptor/http-interceptor.service.js +24 -11
- package/esm5/modules/http-interceptor/index.js +2 -1
- package/esm5/modules/http-interceptor/x-services-url.service.js +20 -0
- package/fesm2015/seniorsistemas-platform-components.js +33 -12
- package/fesm2015/seniorsistemas-platform-components.js.map +1 -1
- package/fesm5/seniorsistemas-platform-components.js +39 -12
- package/fesm5/seniorsistemas-platform-components.js.map +1 -1
- package/modules/http-interceptor/http-interceptor.service.d.ts +5 -2
- package/modules/http-interceptor/index.d.ts +1 -0
- package/modules/http-interceptor/x-services-url.service.d.ts +4 -0
- package/package.json +2 -2
- package/seniorsistemas-platform-components.metadata.json +1 -1
|
@@ -1853,27 +1853,54 @@
|
|
|
1853
1853
|
return RestUrl;
|
|
1854
1854
|
}());
|
|
1855
1855
|
|
|
1856
|
+
var XServicesUrl = /** @class */ (function () {
|
|
1857
|
+
function XServicesUrl() {
|
|
1858
|
+
}
|
|
1859
|
+
XServicesUrl.prototype.get = function () {
|
|
1860
|
+
return rxjs.defer(function () {
|
|
1861
|
+
var url = seniorPlatformData.service.getXServicesUrl();
|
|
1862
|
+
return rxjs.from(url);
|
|
1863
|
+
});
|
|
1864
|
+
};
|
|
1865
|
+
XServicesUrl = __decorate([
|
|
1866
|
+
core.Injectable()
|
|
1867
|
+
], XServicesUrl);
|
|
1868
|
+
return XServicesUrl;
|
|
1869
|
+
}());
|
|
1870
|
+
|
|
1856
1871
|
var HttpInterceptor = /** @class */ (function () {
|
|
1857
|
-
function HttpInterceptor(restUrl) {
|
|
1872
|
+
function HttpInterceptor(restUrl, xServicesUrl) {
|
|
1858
1873
|
this.restUrl = restUrl;
|
|
1874
|
+
this.xServicesUrl = xServicesUrl;
|
|
1859
1875
|
}
|
|
1860
1876
|
HttpInterceptor.prototype.intercept = function (originalReq, next) {
|
|
1877
|
+
var _this = this;
|
|
1861
1878
|
if (!originalReq.url.includes("://")) {
|
|
1862
|
-
var getRestUrl = this.restUrl.get();
|
|
1863
1879
|
var getAuthHeader = rxjs.defer(function () { return rxjs.from(seniorPlatformData.user.getAuthHeader()); });
|
|
1864
|
-
|
|
1880
|
+
if (/^\/?[^\/]+\/[^\/]+\/api\/(?:latest|v\d+)\/.+$/g.test(originalReq.url)) {
|
|
1881
|
+
var xUrl = this.xServicesUrl.get();
|
|
1882
|
+
return rxjs.forkJoin({ xUrl: xUrl, getAuthHeader: getAuthHeader }).pipe(operators.mergeMap(function (values) {
|
|
1883
|
+
return _this.injectBaseUrl(originalReq, next, values.xUrl, values.getAuthHeader);
|
|
1884
|
+
}));
|
|
1885
|
+
}
|
|
1886
|
+
var getRestUrl = this.restUrl.get();
|
|
1887
|
+
return rxjs.forkJoin({ getRestUrl: getRestUrl, getAuthHeader: getAuthHeader }).pipe(operators.mergeMap(function (values) {
|
|
1865
1888
|
var _a = __read(values, 2), bridgeUrl = _a[0], authHeader = _a[1];
|
|
1866
|
-
|
|
1867
|
-
url: bridgeUrl + originalReq.url,
|
|
1868
|
-
headers: originalReq.headers.set("Authorization", authHeader)
|
|
1869
|
-
});
|
|
1870
|
-
return next.handle(request);
|
|
1889
|
+
return _this.injectBaseUrl(originalReq, next, bridgeUrl, authHeader);
|
|
1871
1890
|
}));
|
|
1872
1891
|
}
|
|
1873
1892
|
return next.handle(originalReq);
|
|
1874
1893
|
};
|
|
1894
|
+
HttpInterceptor.prototype.injectBaseUrl = function (originalReq, next, baseUrl, authorization) {
|
|
1895
|
+
var request = originalReq.clone({
|
|
1896
|
+
url: baseUrl + originalReq.url,
|
|
1897
|
+
headers: originalReq.headers.set("Authorization", authorization)
|
|
1898
|
+
});
|
|
1899
|
+
return next.handle(request);
|
|
1900
|
+
};
|
|
1875
1901
|
HttpInterceptor.ctorParameters = function () { return [
|
|
1876
|
-
{ type: RestUrl }
|
|
1902
|
+
{ type: RestUrl },
|
|
1903
|
+
{ type: XServicesUrl }
|
|
1877
1904
|
]; };
|
|
1878
1905
|
HttpInterceptor = __decorate([
|
|
1879
1906
|
core.Injectable()
|
|
@@ -1887,7 +1914,7 @@
|
|
|
1887
1914
|
HttpInterceptorModule = __decorate([
|
|
1888
1915
|
core.NgModule({
|
|
1889
1916
|
imports: [http.HttpClientModule],
|
|
1890
|
-
providers: [RestUrl, { provide: http.HTTP_INTERCEPTORS, useClass: HttpInterceptor, multi: true }]
|
|
1917
|
+
providers: [RestUrl, XServicesUrl, { provide: http.HTTP_INTERCEPTORS, useClass: HttpInterceptor, multi: true }]
|
|
1891
1918
|
})
|
|
1892
1919
|
], HttpInterceptorModule);
|
|
1893
1920
|
return HttpInterceptorModule;
|
|
@@ -2647,6 +2674,7 @@
|
|
|
2647
2674
|
exports.TranslationsConfig = TranslationsConfig;
|
|
2648
2675
|
exports.TranslationsModule = TranslationsModule;
|
|
2649
2676
|
exports.USER_INFO = USER_INFO;
|
|
2677
|
+
exports.XServicesUrl = XServicesUrl;
|
|
2650
2678
|
exports.factory = factory;
|
|
2651
2679
|
exports.ɵa = fallback;
|
|
2652
2680
|
exports.ɵb = CalendarOptionsService;
|