nuxeo-development-framework 5.0.6 → 5.0.8
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 +53 -31
- package/bundles/nuxeo-development-framework.umd.js.map +1 -1
- package/esm2015/lib/components/pdf-tron/pdftron/pdftron.component.js +3 -2
- package/esm2015/lib/shared/services/base/cache-base.service.js +36 -18
- package/esm2015/lib/shared/services/base/config/default-ttl-config.js +4 -2
- package/esm2015/lib/shared/services/base/constants/default-cache-options.js +2 -1
- package/esm2015/lib/shared/services/base/models/cache-info-model.js +1 -1
- package/fesm2015/nuxeo-development-framework.js +40 -18
- package/fesm2015/nuxeo-development-framework.js.map +1 -1
- package/lib/shared/services/base/config/default-ttl-config.d.ts +2 -0
- package/lib/shared/services/base/constants/default-cache-options.d.ts +1 -0
- package/lib/shared/services/base/models/cache-info-model.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3340,6 +3340,7 @@
|
|
|
3340
3340
|
EXCLUDE_KEYS_WHEN_UPDATE: ["contextParameters"],
|
|
3341
3341
|
CHILDREN_PATH: "contextParameters.children.entries",
|
|
3342
3342
|
PARENT_KEY: "parentRef",
|
|
3343
|
+
ENABLE_QUICK_REFRESH: false,
|
|
3343
3344
|
REQUEST: function () {
|
|
3344
3345
|
return rxjs.of();
|
|
3345
3346
|
},
|
|
@@ -3371,10 +3372,12 @@
|
|
|
3371
3372
|
TTL: 3,
|
|
3372
3373
|
UNIT: exports.CachingExpiryUnit.MONTHS,
|
|
3373
3374
|
AUTO_CHECK: true,
|
|
3374
|
-
RETRY: 3
|
|
3375
|
+
RETRY: 3,
|
|
3376
|
+
QUICK_REFRESH: 1,
|
|
3377
|
+
QUICK_REFRESH_UNIT: exports.CachingExpiryUnit.HOURS
|
|
3375
3378
|
};
|
|
3376
3379
|
|
|
3377
|
-
var _CacheBaseService_instances, _CacheBaseService_fetchedItems, _CacheBaseService_handleCacheItems, _CacheBaseService_findNode, _CacheBaseService_findLargestDate, _CacheBaseService_handleFetchedItems, _CacheBaseService_addItemsTo, _CacheBaseService_prepareOptions, _CacheBaseService_prepareConfig, _CacheBaseService_add1SecondToModifiedDate, _CacheBaseService_clear, _CacheBaseService_validateTTLForKey, _CacheBaseService_setItemInMap, _CacheBaseService_getItem, _CacheBaseService_setItem;
|
|
3380
|
+
var _CacheBaseService_instances, _CacheBaseService_fetchedItems, _CacheBaseService_handleCacheItems, _CacheBaseService_findNode, _CacheBaseService_findLargestDate, _CacheBaseService_handleFetchedItems, _CacheBaseService_addItemsTo, _CacheBaseService_prepareOptions, _CacheBaseService_prepareConfig, _CacheBaseService_add1SecondToModifiedDate, _CacheBaseService_clear, _CacheBaseService_validateTTLForKey, _CacheBaseService_validateQuickRefresh, _CacheBaseService_validateTimeDifference, _CacheBaseService_setItemInMap, _CacheBaseService_getItem, _CacheBaseService_setItem;
|
|
3378
3381
|
var CacheBaseService = /** @class */ (function () {
|
|
3379
3382
|
function CacheBaseService(userPreferencesService, utilityService) {
|
|
3380
3383
|
this.userPreferencesService = userPreferencesService;
|
|
@@ -3428,35 +3431,42 @@
|
|
|
3428
3431
|
}
|
|
3429
3432
|
};
|
|
3430
3433
|
CacheBaseService.prototype.validateTTLForKey = function (firstFetchingDate) {
|
|
3431
|
-
|
|
3432
|
-
return;
|
|
3433
|
-
var momentDate1 = moment__namespace(new Date(firstFetchingDate));
|
|
3434
|
-
var momentDate2 = moment__namespace(new Date());
|
|
3435
|
-
var difference = momentDate2.diff(momentDate1, DEFAULT_TTL_CONFIG.UNIT);
|
|
3436
|
-
return difference >= DEFAULT_TTL_CONFIG.TTL;
|
|
3434
|
+
return __classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_validateTimeDifference).call(this, firstFetchingDate, DEFAULT_TTL_CONFIG.UNIT, DEFAULT_TTL_CONFIG.TTL);
|
|
3437
3435
|
};
|
|
3438
3436
|
return CacheBaseService;
|
|
3439
3437
|
}());
|
|
3440
3438
|
_CacheBaseService_fetchedItems = new WeakMap(), _CacheBaseService_instances = new WeakSet(), _CacheBaseService_handleCacheItems = function _CacheBaseService_handleCacheItems(options) {
|
|
3441
|
-
var
|
|
3439
|
+
var _l, _m, _o;
|
|
3442
3440
|
var _this = this;
|
|
3443
3441
|
var observable;
|
|
3444
3442
|
__classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_prepareOptions).call(this, options);
|
|
3445
3443
|
var cachedItem = __classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_getItem).call(this, options);
|
|
3446
3444
|
if (cachedItem) {
|
|
3447
3445
|
__classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_setItemInMap).call(this, options.cacheKey, Object.assign(Object.assign({}, cachedItem), { fetchingItemsFromTheServer: false, onFinishFetching: new rxjs.Subject(), request: options.request }));
|
|
3448
|
-
var
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3446
|
+
var shouldRefresh = __classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_validateQuickRefresh).call(this, __classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].firstFetchingDate);
|
|
3447
|
+
if (options.enableQuickRefresh || shouldRefresh) {
|
|
3448
|
+
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].firstFetchingDate = new Date().toISOString();
|
|
3449
|
+
var params = (_l = {},
|
|
3450
|
+
_l[options.pageKey] = 0,
|
|
3451
|
+
_l[options.minCompareDateKey] = __classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_add1SecondToModifiedDate).call(this, new Date(__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].lastModifiedDate)).toISOString(),
|
|
3452
|
+
_l);
|
|
3453
|
+
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].params = params;
|
|
3454
|
+
observable = options.request(params);
|
|
3455
|
+
}
|
|
3456
|
+
else {
|
|
3457
|
+
var item = __classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey];
|
|
3458
|
+
observable = rxjs.of(_cloneDeep__default["default"]((_m = {},
|
|
3459
|
+
_m[options.mappedDataKey] = item.data,
|
|
3460
|
+
_m[options.lastModifiedDateKey] = item.lastModifiedDate,
|
|
3461
|
+
_m[options.resultsCount] = item[options.resultsCount],
|
|
3462
|
+
_m))).pipe(operators.delay(100));
|
|
3463
|
+
}
|
|
3454
3464
|
}
|
|
3455
3465
|
else {
|
|
3456
3466
|
__classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_setItemInMap).call(this, options.cacheKey);
|
|
3457
3467
|
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].request = options.request;
|
|
3458
3468
|
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].firstFetchingDate = new Date().toISOString();
|
|
3459
|
-
observable = options.request((
|
|
3469
|
+
observable = options.request((_o = {}, _o[options.pageKey] = 0, _o));
|
|
3460
3470
|
}
|
|
3461
3471
|
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].fetchingItemsFromTheServer = true;
|
|
3462
3472
|
return observable.pipe(operators.retry(DEFAULT_TTL_CONFIG.RETRY), operators.expand(function (results) {
|
|
@@ -3481,12 +3491,12 @@
|
|
|
3481
3491
|
}
|
|
3482
3492
|
return _fetchedItems;
|
|
3483
3493
|
}), operators.map(function (res) {
|
|
3484
|
-
var
|
|
3485
|
-
var result = _cloneDeep__default["default"]((
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3494
|
+
var _l;
|
|
3495
|
+
var result = _cloneDeep__default["default"]((_l = {},
|
|
3496
|
+
_l[options.mappedDataKey] = res.data,
|
|
3497
|
+
_l[options.lastModifiedDateKey] = res.lastModifiedDate,
|
|
3498
|
+
_l[options.resultsCount] = res[options.resultsCount],
|
|
3499
|
+
_l));
|
|
3490
3500
|
res.onFinishFetching.next(result);
|
|
3491
3501
|
res.onFinishFetching.complete();
|
|
3492
3502
|
return result;
|
|
@@ -3494,7 +3504,7 @@
|
|
|
3494
3504
|
throw er;
|
|
3495
3505
|
}));
|
|
3496
3506
|
}, _CacheBaseService_findNode = function _CacheBaseService_findNode(items, uniqueCompareKey, childrenPath, value) {
|
|
3497
|
-
var e_1,
|
|
3507
|
+
var e_1, _l;
|
|
3498
3508
|
try {
|
|
3499
3509
|
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
|
|
3500
3510
|
var node = items_1_1.value;
|
|
@@ -3513,7 +3523,7 @@
|
|
|
3513
3523
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3514
3524
|
finally {
|
|
3515
3525
|
try {
|
|
3516
|
-
if (items_1_1 && !items_1_1.done && (
|
|
3526
|
+
if (items_1_1 && !items_1_1.done && (_l = items_1.return)) _l.call(items_1);
|
|
3517
3527
|
}
|
|
3518
3528
|
finally { if (e_1) throw e_1.error; }
|
|
3519
3529
|
}
|
|
@@ -3522,7 +3532,7 @@
|
|
|
3522
3532
|
var _this = this;
|
|
3523
3533
|
var largestDate = null;
|
|
3524
3534
|
var traverse = function (node) {
|
|
3525
|
-
var e_2,
|
|
3535
|
+
var e_2, _l;
|
|
3526
3536
|
if (!node)
|
|
3527
3537
|
return;
|
|
3528
3538
|
var children = _this.utilityService.getValue(node, childrenPath);
|
|
@@ -3540,7 +3550,7 @@
|
|
|
3540
3550
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3541
3551
|
finally {
|
|
3542
3552
|
try {
|
|
3543
|
-
if (children_1_1 && !children_1_1.done && (
|
|
3553
|
+
if (children_1_1 && !children_1_1.done && (_l = children_1.return)) _l.call(children_1);
|
|
3544
3554
|
}
|
|
3545
3555
|
finally { if (e_2) throw e_2.error; }
|
|
3546
3556
|
}
|
|
@@ -3549,7 +3559,7 @@
|
|
|
3549
3559
|
nodeList.forEach(function (node) { return traverse(node); });
|
|
3550
3560
|
return largestDate;
|
|
3551
3561
|
}, _CacheBaseService_handleFetchedItems = function _CacheBaseService_handleFetchedItems(options, res) {
|
|
3552
|
-
var
|
|
3562
|
+
var _l;
|
|
3553
3563
|
var _this = this;
|
|
3554
3564
|
var _a;
|
|
3555
3565
|
if ((_a = __classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].data) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -3588,7 +3598,7 @@
|
|
|
3588
3598
|
__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].resultsCount = res[options.resultsCount];
|
|
3589
3599
|
}
|
|
3590
3600
|
if (res[options.totalPageKey] - res[options.pageKey] > 1) {
|
|
3591
|
-
return __classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].request(Object.assign(Object.assign({}, (__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].params || {})), (
|
|
3601
|
+
return __classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].request(Object.assign(Object.assign({}, (__classPrivateFieldGet(this, _CacheBaseService_fetchedItems, "f")[options.cacheKey].params || {})), (_l = {}, _l[options.pageKey] = res[options.pageKey] + 1, _l)));
|
|
3592
3602
|
}
|
|
3593
3603
|
else {
|
|
3594
3604
|
return null;
|
|
@@ -3615,12 +3625,15 @@
|
|
|
3615
3625
|
options.excludeKeysWhenUpdate = options.excludeKeysWhenUpdate || DEFAULT_CACHE_OPTIONS.EXCLUDE_KEYS_WHEN_UPDATE;
|
|
3616
3626
|
options.childrenPath = options.childrenPath || DEFAULT_CACHE_OPTIONS.CHILDREN_PATH;
|
|
3617
3627
|
options.parentKey = options.parentKey || DEFAULT_CACHE_OPTIONS.PARENT_KEY;
|
|
3628
|
+
options.enableQuickRefresh = options.enableQuickRefresh || DEFAULT_CACHE_OPTIONS.ENABLE_QUICK_REFRESH;
|
|
3618
3629
|
}, _CacheBaseService_prepareConfig = function _CacheBaseService_prepareConfig() {
|
|
3619
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3630
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
3620
3631
|
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;
|
|
3621
3632
|
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;
|
|
3622
3633
|
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';
|
|
3623
|
-
DEFAULT_TTL_CONFIG.
|
|
3634
|
+
DEFAULT_TTL_CONFIG.QUICK_REFRESH = ((_h = (_g = EnvManager.environment) === null || _g === void 0 ? void 0 : _g.cache) === null || _h === void 0 ? void 0 : _h.quickRefresh) || DEFAULT_TTL_CONFIG.QUICK_REFRESH;
|
|
3635
|
+
DEFAULT_TTL_CONFIG.QUICK_REFRESH_UNIT =
|
|
3636
|
+
((_k = (_j = EnvManager.environment) === null || _j === void 0 ? void 0 : _j.cache) === null || _k === void 0 ? void 0 : _k.quickRefreshUnit) || DEFAULT_TTL_CONFIG.QUICK_REFRESH_UNIT;
|
|
3624
3637
|
}, _CacheBaseService_add1SecondToModifiedDate = function _CacheBaseService_add1SecondToModifiedDate(date) {
|
|
3625
3638
|
var newDate = new Date(date.getTime());
|
|
3626
3639
|
newDate.setSeconds(newDate.getSeconds() + 1);
|
|
@@ -3636,6 +3649,14 @@
|
|
|
3636
3649
|
var _a;
|
|
3637
3650
|
if (this.validateTTLForKey((_a = __classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_getItem).call(this, options)) === null || _a === void 0 ? void 0 : _a.firstFetchingDate))
|
|
3638
3651
|
__classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_clear).call(this, options.userName, options.cacheKey);
|
|
3652
|
+
}, _CacheBaseService_validateQuickRefresh = function _CacheBaseService_validateQuickRefresh(date) {
|
|
3653
|
+
return __classPrivateFieldGet(this, _CacheBaseService_instances, "m", _CacheBaseService_validateTimeDifference).call(this, date, DEFAULT_TTL_CONFIG.QUICK_REFRESH_UNIT, DEFAULT_TTL_CONFIG.QUICK_REFRESH);
|
|
3654
|
+
}, _CacheBaseService_validateTimeDifference = function _CacheBaseService_validateTimeDifference(date, unit, threshold) {
|
|
3655
|
+
if (!date)
|
|
3656
|
+
return;
|
|
3657
|
+
var momentDate1 = moment__namespace(new Date(date));
|
|
3658
|
+
var momentDate2 = moment__namespace();
|
|
3659
|
+
return momentDate2.diff(momentDate1, unit) >= threshold;
|
|
3639
3660
|
}, _CacheBaseService_setItemInMap = function _CacheBaseService_setItemInMap(key, val) {
|
|
3640
3661
|
var empty = {
|
|
3641
3662
|
data: [],
|
|
@@ -30835,9 +30856,10 @@
|
|
|
30835
30856
|
display: 'block'
|
|
30836
30857
|
});
|
|
30837
30858
|
}, _PdftronComponent_afterLoadWebViewer = function _PdftronComponent_afterLoadWebViewer(instance) {
|
|
30859
|
+
var _a, _b;
|
|
30838
30860
|
this.isArabic ? instance.setLanguage('ar') : instance.setLanguage('en');
|
|
30839
30861
|
this.pdftronService.instance = this.webViewerInstance = instance;
|
|
30840
|
-
if (this.correspondance.facets.indexOf('ctocr') > -1) {
|
|
30862
|
+
if (this.correspondance.facets.indexOf('ctocr') > -1 && ((_b = (_a = this.correspondance) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b['ctocr:recognizedJson'])) {
|
|
30841
30863
|
this.fileWithOcr = true;
|
|
30842
30864
|
this.pages = JSON.parse(this.correspondance.properties['ctocr:recognizedJson']);
|
|
30843
30865
|
// override search funtion to use our search in ocr not defult search
|