nuxeo-development-framework 4.5.1 → 4.5.2
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/nuxeo-development-framework.umd.js +224 -217
- package/bundles/nuxeo-development-framework.umd.js.map +1 -1
- package/esm2015/lib/core/core.module.js +21 -4
- package/esm2015/lib/core/services/user/user-preferences.service.js +23 -23
- package/esm2015/lib/nuxeo-development-framework.module.js +9 -10
- package/esm2015/lib/shared/components/nuxeo-dialog/nuxeo.dialog.js +5 -2
- package/esm2015/lib/shared/services/base/base.service.js +4 -1
- package/esm2015/lib/shared/services/base/cache-base.service.js +48 -64
- package/fesm2015/nuxeo-development-framework.js +87 -80
- package/fesm2015/nuxeo-development-framework.js.map +1 -1
- package/lib/core/core.module.d.ts +1 -1
- package/lib/core/services/user/user-preferences.service.d.ts +6 -6
- package/lib/nuxeo-development-framework.module.d.ts +2 -3
- package/lib/shared/components/nuxeo-dialog/nuxeo.dialog.d.ts +2 -1
- package/lib/shared/services/base/base.service.d.ts +1 -0
- package/lib/shared/services/base/cache-base.service.d.ts +5 -4
- package/package.json +1 -1
|
@@ -2,8 +2,6 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Component, NgModule, Injectable, Inject, InjectionToken, Optional, Directive, ChangeDetectorRef, Input, ContentChild, ViewChild, EventEmitter, Output, HostListener, Pipe, ViewEncapsulation, Self, SkipSelf, ChangeDetectionStrategy, ViewContainerRef, forwardRef, APP_INITIALIZER, TemplateRef } from '@angular/core';
|
|
3
3
|
import * as i4$1 from '@angular/common';
|
|
4
4
|
import { CommonModule, APP_BASE_HREF, DatePipe, registerLocaleData, DOCUMENT } from '@angular/common';
|
|
5
|
-
import * as i1$2 from '@angular/common/http';
|
|
6
|
-
import { HttpClientModule, HttpClient, HttpHeaders } from '@angular/common/http';
|
|
7
5
|
import * as i2$6 from '@angular/forms';
|
|
8
6
|
import { FormsModule, ReactiveFormsModule, FormBuilder, Validators, ControlContainer, NgForm, FormGroup, FormControl, NG_VALUE_ACCESSOR, FormArray } from '@angular/forms';
|
|
9
7
|
import { __awaiter, __classPrivateFieldGet, __decorate, __param, __classPrivateFieldSet } from 'tslib';
|
|
@@ -20,6 +18,8 @@ import * as i1$1 from 'ngx-toastr';
|
|
|
20
18
|
import { Toast, ToastrModule } from 'ngx-toastr';
|
|
21
19
|
import CryptoJS from 'crypto-js';
|
|
22
20
|
import * as i4 from '@angular/cdk/bidi';
|
|
21
|
+
import * as i1$2 from '@angular/common/http';
|
|
22
|
+
import { HttpClient, HttpClientModule, HttpHeaders } from '@angular/common/http';
|
|
23
23
|
import * as i2 from 'keycloak-angular';
|
|
24
24
|
import { KeycloakAngularModule } from 'keycloak-angular';
|
|
25
25
|
import * as i3 from 'ngx-cookie-service';
|
|
@@ -152,14 +152,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
152
152
|
class NuxeoDevelopmentFrameworkModule {
|
|
153
153
|
}
|
|
154
154
|
NuxeoDevelopmentFrameworkModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NuxeoDevelopmentFrameworkModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
155
|
-
NuxeoDevelopmentFrameworkModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NuxeoDevelopmentFrameworkModule, declarations: [NuxeoDevelopmentFrameworkComponent], imports: [CommonModule,
|
|
156
|
-
NuxeoDevelopmentFrameworkModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NuxeoDevelopmentFrameworkModule, imports: [[CommonModule,
|
|
155
|
+
NuxeoDevelopmentFrameworkModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NuxeoDevelopmentFrameworkModule, declarations: [NuxeoDevelopmentFrameworkComponent], imports: [CommonModule, FormsModule, ReactiveFormsModule], exports: [NuxeoDevelopmentFrameworkComponent] });
|
|
156
|
+
NuxeoDevelopmentFrameworkModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NuxeoDevelopmentFrameworkModule, imports: [[CommonModule, FormsModule, ReactiveFormsModule]] });
|
|
157
157
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NuxeoDevelopmentFrameworkModule, decorators: [{
|
|
158
158
|
type: NgModule,
|
|
159
159
|
args: [{
|
|
160
160
|
declarations: [NuxeoDevelopmentFrameworkComponent],
|
|
161
|
-
imports: [CommonModule,
|
|
162
|
-
exports: [NuxeoDevelopmentFrameworkComponent]
|
|
161
|
+
imports: [CommonModule, FormsModule, ReactiveFormsModule],
|
|
162
|
+
exports: [NuxeoDevelopmentFrameworkComponent]
|
|
163
163
|
}]
|
|
164
164
|
}] });
|
|
165
165
|
|
|
@@ -312,7 +312,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
312
312
|
}], ctorParameters: function () { return []; } });
|
|
313
313
|
|
|
314
314
|
var _UserPreferencesService_instances, _UserPreferencesService_encrypt, _UserPreferencesService_decrypt, _UserPreferencesService_encryptKey_get, _UserPreferencesService_enableEncryption_get;
|
|
315
|
-
const ENCRYPT_KEY =
|
|
315
|
+
const ENCRYPT_KEY = '_ndf_';
|
|
316
316
|
var UserPreferenceValues;
|
|
317
317
|
(function (UserPreferenceValues) {
|
|
318
318
|
UserPreferenceValues["Locale"] = "locale";
|
|
@@ -324,8 +324,8 @@ class UserPreferencesService {
|
|
|
324
324
|
this.storage = storage;
|
|
325
325
|
_UserPreferencesService_instances.add(this);
|
|
326
326
|
this.defaults = {
|
|
327
|
-
locale:
|
|
328
|
-
expandedSidenav: true
|
|
327
|
+
locale: 'en',
|
|
328
|
+
expandedSidenav: true
|
|
329
329
|
};
|
|
330
330
|
this.userPreferenceStatus = this.defaults;
|
|
331
331
|
this.onChangeSubject = new BehaviorSubject(this.userPreferenceStatus);
|
|
@@ -339,12 +339,12 @@ class UserPreferencesService {
|
|
|
339
339
|
if (this.locale) {
|
|
340
340
|
const locale = this.locale || this.getDefaultLocale();
|
|
341
341
|
this.set(UserPreferenceValues.Locale, locale);
|
|
342
|
-
this.set(
|
|
342
|
+
this.set('textOrientation', (yield this.getLanguageByKey(locale)).dir || 'ltr');
|
|
343
343
|
}
|
|
344
344
|
else {
|
|
345
345
|
const locale = this.locale || this.getDefaultLocale();
|
|
346
346
|
this.setWithoutStore(UserPreferenceValues.Locale, locale);
|
|
347
|
-
this.setWithoutStore(
|
|
347
|
+
this.setWithoutStore('textOrientation', (yield this.getLanguageByKey(locale)).dir || 'ltr');
|
|
348
348
|
}
|
|
349
349
|
});
|
|
350
350
|
}
|
|
@@ -362,8 +362,8 @@ class UserPreferencesService {
|
|
|
362
362
|
* @param defaultValue Default to return if the property is not found
|
|
363
363
|
* @returns Preference property
|
|
364
364
|
*/
|
|
365
|
-
get(property, defaultValue) {
|
|
366
|
-
const key = this.getPropertyKey(property);
|
|
365
|
+
get(property, defaultValue, withoutUser) {
|
|
366
|
+
const key = withoutUser ? property : this.getPropertyKey(property);
|
|
367
367
|
const value = this.storage.getItem(key);
|
|
368
368
|
if (value === undefined || value === null) {
|
|
369
369
|
return defaultValue;
|
|
@@ -375,11 +375,11 @@ class UserPreferencesService {
|
|
|
375
375
|
* @param property Name of the property
|
|
376
376
|
* @param value New value for the property
|
|
377
377
|
*/
|
|
378
|
-
set(property, value) {
|
|
378
|
+
set(property, value, withoutUser) {
|
|
379
379
|
if (!property) {
|
|
380
380
|
return;
|
|
381
381
|
}
|
|
382
|
-
this.storage.setItem(this.getPropertyKey(property), __classPrivateFieldGet(this, _UserPreferencesService_instances, "m", _UserPreferencesService_encrypt).call(this, value));
|
|
382
|
+
this.storage.setItem(withoutUser ? property : this.getPropertyKey(property), __classPrivateFieldGet(this, _UserPreferencesService_instances, "m", _UserPreferencesService_encrypt).call(this, value));
|
|
383
383
|
this.userPreferenceStatus[property] = value;
|
|
384
384
|
this.onChangeSubject.next(this.userPreferenceStatus);
|
|
385
385
|
}
|
|
@@ -400,25 +400,25 @@ class UserPreferencesService {
|
|
|
400
400
|
* @param property Name of the property
|
|
401
401
|
* @returns True if the item is present, false otherwise
|
|
402
402
|
*/
|
|
403
|
-
hasItem(property) {
|
|
403
|
+
hasItem(property, withoutUser) {
|
|
404
404
|
if (!property) {
|
|
405
405
|
return false;
|
|
406
406
|
}
|
|
407
|
-
return this.storage.hasItem(this.getPropertyKey(property));
|
|
407
|
+
return this.storage.hasItem(withoutUser ? property : this.getPropertyKey(property));
|
|
408
408
|
}
|
|
409
409
|
/**
|
|
410
410
|
* Gets the active storage prefix for preferences.
|
|
411
411
|
* @returns Storage prefix
|
|
412
412
|
*/
|
|
413
413
|
getStoragePrefix() {
|
|
414
|
-
return this.storage.getItem(
|
|
414
|
+
return this.storage.getItem('USER_PROFILE') || 'GUEST';
|
|
415
415
|
}
|
|
416
416
|
/**
|
|
417
417
|
* Sets the active storage prefix for preferences.
|
|
418
418
|
* @param value Name of the prefix
|
|
419
419
|
*/
|
|
420
420
|
setStoragePrefix(value) {
|
|
421
|
-
this.storage.setItem(
|
|
421
|
+
this.storage.setItem('USER_PROFILE', value || 'GUEST');
|
|
422
422
|
this.initUserPreferenceStatus();
|
|
423
423
|
}
|
|
424
424
|
/**
|
|
@@ -441,7 +441,7 @@ class UserPreferencesService {
|
|
|
441
441
|
* @returns Default locale language code
|
|
442
442
|
*/
|
|
443
443
|
getDefaultLocale() {
|
|
444
|
-
return this.translate.getBrowserCultureLang() ||
|
|
444
|
+
return this.translate.getBrowserCultureLang() || 'en';
|
|
445
445
|
}
|
|
446
446
|
getLanguageByKey(key) {
|
|
447
447
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -462,14 +462,14 @@ _UserPreferencesService_instances = new WeakSet(), _UserPreferencesService_encry
|
|
|
462
462
|
}, _UserPreferencesService_encryptKey_get = function _UserPreferencesService_encryptKey_get() {
|
|
463
463
|
return EnvManager.environment.encryptKey || ENCRYPT_KEY;
|
|
464
464
|
}, _UserPreferencesService_enableEncryption_get = function _UserPreferencesService_enableEncryption_get() {
|
|
465
|
-
return EnvManager.environment.enableEncryption ==
|
|
465
|
+
return EnvManager.environment.enableEncryption == 'YES' || false;
|
|
466
466
|
};
|
|
467
467
|
UserPreferencesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UserPreferencesService, deps: [{ token: i1.TranslateService }, { token: LocalStoragService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
468
|
-
UserPreferencesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UserPreferencesService, providedIn:
|
|
468
|
+
UserPreferencesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UserPreferencesService, providedIn: 'root' });
|
|
469
469
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: UserPreferencesService, decorators: [{
|
|
470
470
|
type: Injectable,
|
|
471
471
|
args: [{
|
|
472
|
-
providedIn:
|
|
472
|
+
providedIn: 'root'
|
|
473
473
|
}]
|
|
474
474
|
}], ctorParameters: function () { return [{ type: i1.TranslateService }, { type: LocalStoragService }]; } });
|
|
475
475
|
|
|
@@ -1824,7 +1824,7 @@ class NdfNuxeoDialog extends BaseComponent {
|
|
|
1824
1824
|
}
|
|
1825
1825
|
}
|
|
1826
1826
|
NdfNuxeoDialog.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NdfNuxeoDialog, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
1827
|
-
NdfNuxeoDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: NdfNuxeoDialog, selector: "ndf-nuxeo-dialog", inputs: { dialogTitle: "dialogTitle", subTitle: "subTitle", panelClass: "panelClass", loaderMode: "loaderMode" }, queries: [{ propertyName: "contentTemplate", first: true, predicate: ["contentTemplate"], descendants: true }, { propertyName: "actionsTemplate", first: true, predicate: ["actionsTemplate"], descendants: true }], viewQueries: [{ propertyName: "dialogBody", first: true, predicate: ["dialogBody"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div
|
|
1827
|
+
NdfNuxeoDialog.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: NdfNuxeoDialog, selector: "ndf-nuxeo-dialog", inputs: { dialogTitle: "dialogTitle", subTitle: "subTitle", panelClass: "panelClass", loaderMode: "loaderMode" }, queries: [{ propertyName: "contentTemplate", first: true, predicate: ["contentTemplate"], descendants: true }, { propertyName: "actionsTemplate", first: true, predicate: ["actionsTemplate"], descendants: true }, { propertyName: "footerTemplate", first: true, predicate: ["footerTemplate"], descendants: true }], viewQueries: [{ propertyName: "dialogBody", first: true, predicate: ["dialogBody"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div SetDirRtl class=\"ndf-dialog-wrapper flex flex-col h-full\" [class]=\"data?.dialogConfig?.panelClass ?? panelClass\">\r\n\t<div\r\n\t\tclass=\"dialog-header flex h-20 p-6 justify-between items-center w-full bg-vapor text-blue-munsell text-xl not-italic font-bold leading-7\"\r\n\t>\r\n\t\t<div class=\"flex flex-col\">\r\n\t\t\t<span>{{ data?.dialogConfig?.title || dialogTitle }}</span>\r\n\t\t\t<span class=\"text-base font-normal\">{{ data?.dialogConfig?.subTitle || subTitle }}</span>\r\n\t\t</div>\r\n\t\t<button\r\n\t\t\tclass=\"flex items-center justify-center rounded-full bg-anti-flash-white w-10 h-10\"\r\n\t\t\t(click)=\"executeAction()\"\r\n\t\t\tmatTooltip=\"{{'BUTTONS.CLOSE' | translate}}\"\r\n\t\t>\r\n\t\t\t<mat-icon class=\"icon-size-3.5\" [svgIcon]=\"'icons:cancel-icon'\"> </mat-icon>\r\n\t\t</button>\r\n\t</div>\r\n\t<div\r\n\t\t#dialogBody\r\n\t\tclass=\"dialog-body flex flex-col gap-y-4 p-6 overflow-y-auto relative z-99\"\r\n\t\t[ngClass]=\"{'overflow-hidden': loading}\"\r\n\t>\r\n\t\t<ng-container *ngTemplateOutlet=\"data?.dialogConfig?.contentTemplate || contentTemplate\"></ng-container>\r\n\t\t<ng-container *ngIf=\"loading\">\r\n\t\t\t<div class=\"ndf-dialog-overlay z-999\" [ngStyle]=\"{'top': dialogBodyTopOffset + 'px'}\"></div>\r\n\t\t\t<div\r\n\t\t\t\tclass=\"ndf-dialog-loader z-9999\"\r\n\t\t\t\t*ngIf=\"loaderMode === 'spinner'\"\r\n\t\t\t\t[ngStyle]=\"{'top': dialogBodyTopOffset + 'px'}\"\r\n\t\t\t>\r\n\t\t\t\t<mat-spinner [value]=\"90\" [strokeWidth]=\"4\" overlay=\"true\" [diameter]=\"40\" color=\"primary\"> </mat-spinner>\r\n\t\t\t</div>\r\n\t\t\t<div class=\"block w-full h-px absolute inset-0 z-9999\" *ngIf=\"loaderMode === 'progressBar'\">\r\n\t\t\t\t<mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\r\n\t\t\t</div>\r\n\t\t</ng-container>\r\n\t</div>\r\n\t<div class=\"flex w-full justify-between p-6 pt-0 gap-x-4\">\r\n\t\t<span>\r\n\t\t\t<ng-container *ngTemplateOutlet=\"footerTemplate; context: { dialog: this }\"></ng-container>\r\n\t\t</span>\r\n\t\t<span class=\"flex gap-x-4\">\r\n\t\t\t<button class=\"cancelation-button\" (click)=\"executeAction()\">{{\"BUTTONS.CANCEL\" | translate}}</button>\r\n\t\t\t<ng-container\r\n\t\t\t\t*ngTemplateOutlet=\"(data?.dialogConfig?.actionsTemplate || actionsTemplate); context: { dialog: this }\"\r\n\t\t\t></ng-container>\r\n\t\t</span>\r\n\t</div>\r\n</div>\r\n", styles: ["::ng-deep .ndf-dialog .mat-dialog-container{overflow:hidden!important;border-radius:8px!important}.ndf-dialog-wrapper .dialog-body{height:100%;max-height:var(--dialog-body-max-height, calc(100vh - 208px))}.ndf-dialog-wrapper .dialog-body .ndf-dialog-overlay,.ndf-dialog-wrapper .dialog-body .ndf-dialog-loader{display:flex;width:100%;height:100%;align-items:center;justify-content:center;position:absolute;left:0px;bottom:0px;right:0px}.ndf-dialog-wrapper .dialog-body .ndf-dialog-overlay{background-color:#cbd5e166}:host{height:100%;display:block}\n"], components: [{ type: i2$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3$1.MatSpinner, selector: "mat-spinner", inputs: ["color"] }], directives: [{ type: SetDirRtlDirective, selector: "[SetDirRtl]" }, { type: i2$2.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltipPosition", "matTooltipDisabled", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { type: i4$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i4$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], pipes: { "translate": i1.TranslatePipe } });
|
|
1828
1828
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NdfNuxeoDialog, decorators: [{
|
|
1829
1829
|
type: Component,
|
|
1830
1830
|
args: [{
|
|
@@ -1846,6 +1846,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
1846
1846
|
}], actionsTemplate: [{
|
|
1847
1847
|
type: ContentChild,
|
|
1848
1848
|
args: ['actionsTemplate']
|
|
1849
|
+
}], footerTemplate: [{
|
|
1850
|
+
type: ContentChild,
|
|
1851
|
+
args: ['footerTemplate']
|
|
1849
1852
|
}], dialogBody: [{
|
|
1850
1853
|
type: ViewChild,
|
|
1851
1854
|
args: ['dialogBody']
|
|
@@ -2586,10 +2589,10 @@ class CacheBaseService {
|
|
|
2586
2589
|
.filter((key) => {
|
|
2587
2590
|
var _a;
|
|
2588
2591
|
const options = {
|
|
2589
|
-
cacheKey: key.replace(prefix,
|
|
2592
|
+
cacheKey: key.replace(prefix, ''),
|
|
2590
2593
|
userName: userName,
|
|
2591
2594
|
request: DEFAULT_CACHE_OPTIONS.REQUEST,
|
|
2592
|
-
prepareDataBeforeCaching: DEFAULT_CACHE_OPTIONS.PREPARE_DATA
|
|
2595
|
+
prepareDataBeforeCaching: DEFAULT_CACHE_OPTIONS.PREPARE_DATA
|
|
2593
2596
|
};
|
|
2594
2597
|
const firstFetchingDate = (_a = __classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_getItem).call(this, options)) === null || _a === void 0 ? void 0 : _a.firstFetchingDate;
|
|
2595
2598
|
if (!firstFetchingDate)
|
|
@@ -2614,6 +2617,14 @@ class CacheBaseService {
|
|
|
2614
2617
|
return __classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].onFinishFetching.asObservable();
|
|
2615
2618
|
}
|
|
2616
2619
|
}
|
|
2620
|
+
validateTTLForKey(firstFetchingDate) {
|
|
2621
|
+
if (!firstFetchingDate)
|
|
2622
|
+
return;
|
|
2623
|
+
const momentDate1 = moment$4(new Date(firstFetchingDate));
|
|
2624
|
+
const momentDate2 = moment$4(new Date());
|
|
2625
|
+
const difference = momentDate2.diff(momentDate1, DEFAULT_TTL_CONFIG.UNIT);
|
|
2626
|
+
return difference >= DEFAULT_TTL_CONFIG.TTL;
|
|
2627
|
+
}
|
|
2617
2628
|
}
|
|
2618
2629
|
_CacheBaseService_fetchedItems = new WeakMap(), _CacheBaseService_instances = new WeakSet(), _CacheBaseService_handleCacheItems = function _CacheBaseService_handleCacheItems(options) {
|
|
2619
2630
|
let observable;
|
|
@@ -2623,7 +2634,7 @@ _CacheBaseService_fetchedItems = new WeakMap(), _CacheBaseService_instances = ne
|
|
|
2623
2634
|
__classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_setItemInMap).call(this, options.cacheKey, Object.assign(Object.assign({}, cachedItem), { fetchingItemsFromTheServer: false, onFinishFetching: new Subject(), request: options.request }));
|
|
2624
2635
|
const params = {
|
|
2625
2636
|
[options.pageKey]: 0,
|
|
2626
|
-
[options.minCompareDateKey]: __classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_add1SecondToModifiedDate).call(this, new Date(__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].lastModifiedDate)).toISOString()
|
|
2637
|
+
[options.minCompareDateKey]: __classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_add1SecondToModifiedDate).call(this, new Date(__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].lastModifiedDate)).toISOString()
|
|
2627
2638
|
};
|
|
2628
2639
|
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].params = params;
|
|
2629
2640
|
observable = options.request(params);
|
|
@@ -2631,8 +2642,7 @@ _CacheBaseService_fetchedItems = new WeakMap(), _CacheBaseService_instances = ne
|
|
|
2631
2642
|
else {
|
|
2632
2643
|
__classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_setItemInMap).call(this, options.cacheKey);
|
|
2633
2644
|
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].request = options.request;
|
|
2634
|
-
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].firstFetchingDate =
|
|
2635
|
-
new Date().toISOString();
|
|
2645
|
+
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].firstFetchingDate = new Date().toISOString();
|
|
2636
2646
|
observable = options.request({ [options.pageKey]: 0 });
|
|
2637
2647
|
}
|
|
2638
2648
|
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].fetchingItemsFromTheServer = true;
|
|
@@ -2653,7 +2663,7 @@ _CacheBaseService_fetchedItems = new WeakMap(), _CacheBaseService_instances = ne
|
|
|
2653
2663
|
data: _fetchedItems.data,
|
|
2654
2664
|
lastModifiedDate: _fetchedItems.lastModifiedDate,
|
|
2655
2665
|
firstFetchingDate: _fetchedItems.firstFetchingDate,
|
|
2656
|
-
resultsCount: _fetchedItems[options.resultsCount]
|
|
2666
|
+
resultsCount: _fetchedItems[options.resultsCount]
|
|
2657
2667
|
}, options);
|
|
2658
2668
|
}
|
|
2659
2669
|
return _fetchedItems;
|
|
@@ -2661,7 +2671,7 @@ _CacheBaseService_fetchedItems = new WeakMap(), _CacheBaseService_instances = ne
|
|
|
2661
2671
|
const result = _cloneDeep({
|
|
2662
2672
|
[options.mappedDataKey]: res.data,
|
|
2663
2673
|
[options.lastModifiedDateKey]: res.lastModifiedDate,
|
|
2664
|
-
[options.resultsCount]: res[options.resultsCount]
|
|
2674
|
+
[options.resultsCount]: res[options.resultsCount]
|
|
2665
2675
|
});
|
|
2666
2676
|
res.onFinishFetching.next(result);
|
|
2667
2677
|
res.onFinishFetching.complete();
|
|
@@ -2690,8 +2700,7 @@ _CacheBaseService_fetchedItems = new WeakMap(), _CacheBaseService_instances = ne
|
|
|
2690
2700
|
return;
|
|
2691
2701
|
const children = this.utilityService.getValue(node, childrenPath);
|
|
2692
2702
|
const nodeDate = this.utilityService.getValue(node, datePath);
|
|
2693
|
-
if (nodeDate &&
|
|
2694
|
-
(!largestDate || new Date(nodeDate) > new Date(largestDate))) {
|
|
2703
|
+
if (nodeDate && (!largestDate || new Date(nodeDate) > new Date(largestDate))) {
|
|
2695
2704
|
largestDate = nodeDate;
|
|
2696
2705
|
}
|
|
2697
2706
|
if (children === null || children === void 0 ? void 0 : children.length) {
|
|
@@ -2737,8 +2746,7 @@ _CacheBaseService_fetchedItems = new WeakMap(), _CacheBaseService_instances = ne
|
|
|
2737
2746
|
else {
|
|
2738
2747
|
res[options.mappedDataKey] = options.prepareDataBeforeCaching(res[options.mappedDataKey]);
|
|
2739
2748
|
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].data = res[options.mappedDataKey];
|
|
2740
|
-
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].resultsCount =
|
|
2741
|
-
res[options.resultsCount];
|
|
2749
|
+
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].resultsCount = res[options.resultsCount];
|
|
2742
2750
|
}
|
|
2743
2751
|
if (res[options.totalPageKey] - res[options.pageKey] > 1) {
|
|
2744
2752
|
return __classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].request(Object.assign(Object.assign({}, (__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].params || {})), { [options.pageKey]: res[options.pageKey] + 1 }));
|
|
@@ -2756,44 +2764,29 @@ _CacheBaseService_fetchedItems = new WeakMap(), _CacheBaseService_instances = ne
|
|
|
2756
2764
|
data.push(...options.prepareDataBeforeCaching([item]));
|
|
2757
2765
|
}
|
|
2758
2766
|
}, _CacheBaseService_prepareOptions = function _CacheBaseService_prepareOptions(options) {
|
|
2759
|
-
options.prepareDataBeforeCaching =
|
|
2760
|
-
options.prepareDataBeforeCaching || DEFAULT_CACHE_OPTIONS.PREPARE_DATA;
|
|
2767
|
+
options.prepareDataBeforeCaching = options.prepareDataBeforeCaching || DEFAULT_CACHE_OPTIONS.PREPARE_DATA;
|
|
2761
2768
|
options.pageKey = options.pageKey || DEFAULT_CACHE_OPTIONS.PAGE_KEY;
|
|
2762
|
-
options.totalPageKey =
|
|
2763
|
-
|
|
2764
|
-
options.
|
|
2765
|
-
|
|
2766
|
-
options.
|
|
2767
|
-
|
|
2768
|
-
options.
|
|
2769
|
-
|
|
2770
|
-
options.
|
|
2771
|
-
options.minCompareDateKey || DEFAULT_CACHE_OPTIONS.MIN_COMPARE_DATE_KEY;
|
|
2772
|
-
options.lastModifiedDateKey =
|
|
2773
|
-
options.lastModifiedDateKey || DEFAULT_CACHE_OPTIONS.LAST_MODIFIED_KEY;
|
|
2774
|
-
options.lastModifiedDatePath =
|
|
2775
|
-
options.lastModifiedDatePath || DEFAULT_CACHE_OPTIONS.LAST_MODIFIED_PATH;
|
|
2776
|
-
options.excludeKeysWhenUpdate =
|
|
2777
|
-
options.excludeKeysWhenUpdate ||
|
|
2778
|
-
DEFAULT_CACHE_OPTIONS.EXCLUDE_KEYS_WHEN_UPDATE;
|
|
2779
|
-
options.childrenPath =
|
|
2780
|
-
options.childrenPath || DEFAULT_CACHE_OPTIONS.CHILDREN_PATH;
|
|
2769
|
+
options.totalPageKey = options.totalPageKey || DEFAULT_CACHE_OPTIONS.TOTAL_PAGE_KEY;
|
|
2770
|
+
options.resultsCount = options.resultsCount || DEFAULT_CACHE_OPTIONS.RESULTS_COUNT_KEY;
|
|
2771
|
+
options.mappedDataKey = options.mappedDataKey || DEFAULT_CACHE_OPTIONS.MAPPED_DATA_KEY;
|
|
2772
|
+
options.uniqueCompareKey = options.uniqueCompareKey || DEFAULT_CACHE_OPTIONS.UNIQUE_COMPARE_KEY;
|
|
2773
|
+
options.minCompareDateKey = options.minCompareDateKey || DEFAULT_CACHE_OPTIONS.MIN_COMPARE_DATE_KEY;
|
|
2774
|
+
options.lastModifiedDateKey = options.lastModifiedDateKey || DEFAULT_CACHE_OPTIONS.LAST_MODIFIED_KEY;
|
|
2775
|
+
options.lastModifiedDatePath = options.lastModifiedDatePath || DEFAULT_CACHE_OPTIONS.LAST_MODIFIED_PATH;
|
|
2776
|
+
options.excludeKeysWhenUpdate = options.excludeKeysWhenUpdate || DEFAULT_CACHE_OPTIONS.EXCLUDE_KEYS_WHEN_UPDATE;
|
|
2777
|
+
options.childrenPath = options.childrenPath || DEFAULT_CACHE_OPTIONS.CHILDREN_PATH;
|
|
2781
2778
|
options.parentKey = options.parentKey || DEFAULT_CACHE_OPTIONS.PARENT_KEY;
|
|
2782
2779
|
}, _CacheBaseService_prepareConfig = function _CacheBaseService_prepareConfig() {
|
|
2783
2780
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2784
|
-
DEFAULT_TTL_CONFIG.TTL =
|
|
2785
|
-
|
|
2786
|
-
DEFAULT_TTL_CONFIG.
|
|
2787
|
-
|
|
2788
|
-
DEFAULT_TTL_CONFIG.AUTO_CHECK =
|
|
2789
|
-
((_f = (_e = EnvManager.environment) === null || _e === void 0 ? void 0 : _e.cache) === null || _f === void 0 ? void 0 : _f.autoCheck) == "YES";
|
|
2790
|
-
DEFAULT_TTL_CONFIG.RETRY =
|
|
2791
|
-
((_h = (_g = EnvManager.environment) === null || _g === void 0 ? void 0 : _g.cache) === null || _h === void 0 ? void 0 : _h.retry) || DEFAULT_TTL_CONFIG.RETRY;
|
|
2781
|
+
DEFAULT_TTL_CONFIG.TTL = ((_b = (_a = EnvManager.environment) === null || _a === void 0 ? void 0 : _a.cache) === null || _b === void 0 ? void 0 : _b.ttl) || DEFAULT_TTL_CONFIG.TTL;
|
|
2782
|
+
DEFAULT_TTL_CONFIG.UNIT = ((_d = (_c = EnvManager.environment) === null || _c === void 0 ? void 0 : _c.cache) === null || _d === void 0 ? void 0 : _d.ttlUnit) || DEFAULT_TTL_CONFIG.UNIT;
|
|
2783
|
+
DEFAULT_TTL_CONFIG.AUTO_CHECK = ((_f = (_e = EnvManager.environment) === null || _e === void 0 ? void 0 : _e.cache) === null || _f === void 0 ? void 0 : _f.autoCheck) == 'YES';
|
|
2784
|
+
DEFAULT_TTL_CONFIG.RETRY = ((_h = (_g = EnvManager.environment) === null || _g === void 0 ? void 0 : _g.cache) === null || _h === void 0 ? void 0 : _h.retry) || DEFAULT_TTL_CONFIG.RETRY;
|
|
2792
2785
|
}, _CacheBaseService_add1SecondToModifiedDate = function _CacheBaseService_add1SecondToModifiedDate(date) {
|
|
2793
2786
|
let newDate = new Date(date.getTime());
|
|
2794
2787
|
newDate.setSeconds(newDate.getSeconds() + 1);
|
|
2795
2788
|
return newDate;
|
|
2796
|
-
}, _CacheBaseService_clear = function _CacheBaseService_clear(userName, keyOrAll =
|
|
2789
|
+
}, _CacheBaseService_clear = function _CacheBaseService_clear(userName, keyOrAll = '') {
|
|
2797
2790
|
Object.keys(window.localStorage)
|
|
2798
2791
|
.filter((q) => q.startsWith(`${userName}__${DEFAULT_CACHE_OPTIONS.PREFIX}${keyOrAll}`))
|
|
2799
2792
|
.forEach((key) => {
|
|
@@ -2801,22 +2794,16 @@ _CacheBaseService_fetchedItems = new WeakMap(), _CacheBaseService_instances = ne
|
|
|
2801
2794
|
});
|
|
2802
2795
|
}, _CacheBaseService_validateTTLForKey = function _CacheBaseService_validateTTLForKey(options) {
|
|
2803
2796
|
var _a;
|
|
2804
|
-
|
|
2805
|
-
if (!firstFetchingDate)
|
|
2806
|
-
return;
|
|
2807
|
-
const momentDate1 = moment$4(new Date(firstFetchingDate));
|
|
2808
|
-
const momentDate2 = moment$4(new Date());
|
|
2809
|
-
const difference = momentDate2.diff(momentDate1, DEFAULT_TTL_CONFIG.UNIT);
|
|
2810
|
-
if (difference >= DEFAULT_TTL_CONFIG.TTL)
|
|
2797
|
+
if (this.validateTTLForKey((_a = __classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_getItem).call(this, options)) === null || _a === void 0 ? void 0 : _a.firstFetchingDate))
|
|
2811
2798
|
__classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_clear).call(this, options.userName, options.cacheKey);
|
|
2812
2799
|
}, _CacheBaseService_setItemInMap = function _CacheBaseService_setItemInMap(key, val) {
|
|
2813
2800
|
const empty = {
|
|
2814
2801
|
data: [],
|
|
2815
|
-
firstFetchingDate:
|
|
2816
|
-
lastModifiedDate:
|
|
2802
|
+
firstFetchingDate: '',
|
|
2803
|
+
lastModifiedDate: '',
|
|
2817
2804
|
resultsCount: 0,
|
|
2818
2805
|
fetchingItemsFromTheServer: false,
|
|
2819
|
-
onFinishFetching: new Subject()
|
|
2806
|
+
onFinishFetching: new Subject()
|
|
2820
2807
|
};
|
|
2821
2808
|
let value = val ? val : empty;
|
|
2822
2809
|
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[key] = value;
|
|
@@ -2840,11 +2827,11 @@ _CacheBaseService_fetchedItems = new WeakMap(), _CacheBaseService_instances = ne
|
|
|
2840
2827
|
}
|
|
2841
2828
|
};
|
|
2842
2829
|
CacheBaseService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CacheBaseService, deps: [{ token: UserPreferencesService }, { token: UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2843
|
-
CacheBaseService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CacheBaseService, providedIn:
|
|
2830
|
+
CacheBaseService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CacheBaseService, providedIn: 'root' });
|
|
2844
2831
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: CacheBaseService, decorators: [{
|
|
2845
2832
|
type: Injectable,
|
|
2846
2833
|
args: [{
|
|
2847
|
-
providedIn:
|
|
2834
|
+
providedIn: 'root'
|
|
2848
2835
|
}]
|
|
2849
2836
|
}], ctorParameters: function () { return [{ type: UserPreferencesService }, { type: UtilityService }]; } });
|
|
2850
2837
|
|
|
@@ -2997,6 +2984,9 @@ class BaseService extends HttpBaseService {
|
|
|
2997
2984
|
hasItemInCache(key) {
|
|
2998
2985
|
return __classPrivateFieldGet(this, _BaseService_cacheBaseService, "f").hasItem(key);
|
|
2999
2986
|
}
|
|
2987
|
+
validateTTLForKey(firstFetchingDate) {
|
|
2988
|
+
return __classPrivateFieldGet(this, _BaseService_cacheBaseService, "f").validateTTLForKey(firstFetchingDate);
|
|
2989
|
+
}
|
|
3000
2990
|
cachedQuery(options) {
|
|
3001
2991
|
const request = (params) => {
|
|
3002
2992
|
return this.query({
|
|
@@ -28793,7 +28783,12 @@ class NuxeoCoreModule {
|
|
|
28793
28783
|
}
|
|
28794
28784
|
NuxeoCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NuxeoCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
28795
28785
|
NuxeoCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NuxeoCoreModule, imports: [CommonModule, i1$6.TreeviewModule, HttpClientModule, i1.TranslateModule, i1$1.ToastrModule, KeycloakAngularModule,
|
|
28796
|
-
RxReactiveFormsModule], exports: [KeycloakAngularModule,
|
|
28786
|
+
RxReactiveFormsModule], exports: [KeycloakAngularModule,
|
|
28787
|
+
HttpClientModule,
|
|
28788
|
+
TranslateModule,
|
|
28789
|
+
TreeviewModule,
|
|
28790
|
+
ToastrModule,
|
|
28791
|
+
RxReactiveFormsModule] });
|
|
28797
28792
|
NuxeoCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NuxeoCoreModule, providers: [
|
|
28798
28793
|
TranslateStore,
|
|
28799
28794
|
TranslateService,
|
|
@@ -28822,7 +28817,12 @@ NuxeoCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version
|
|
|
28822
28817
|
}),
|
|
28823
28818
|
KeycloakAngularModule,
|
|
28824
28819
|
RxReactiveFormsModule
|
|
28825
|
-
], KeycloakAngularModule,
|
|
28820
|
+
], KeycloakAngularModule,
|
|
28821
|
+
HttpClientModule,
|
|
28822
|
+
TranslateModule,
|
|
28823
|
+
TreeviewModule,
|
|
28824
|
+
ToastrModule,
|
|
28825
|
+
RxReactiveFormsModule] });
|
|
28826
28826
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NuxeoCoreModule, decorators: [{
|
|
28827
28827
|
type: NgModule,
|
|
28828
28828
|
args: [{
|
|
@@ -28838,7 +28838,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
28838
28838
|
KeycloakAngularModule,
|
|
28839
28839
|
RxReactiveFormsModule
|
|
28840
28840
|
],
|
|
28841
|
-
exports: [
|
|
28841
|
+
exports: [
|
|
28842
|
+
KeycloakAngularModule,
|
|
28843
|
+
HttpClientModule,
|
|
28844
|
+
TranslateModule,
|
|
28845
|
+
TreeviewModule,
|
|
28846
|
+
ToastrModule,
|
|
28847
|
+
RxReactiveFormsModule
|
|
28848
|
+
],
|
|
28842
28849
|
providers: [
|
|
28843
28850
|
TranslateStore,
|
|
28844
28851
|
TranslateService,
|