@zajno/common 1.5.9 → 1.6.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/coverage/clover.xml +182 -116
- package/coverage/coverage-final.json +14 -10
- package/coverage/lcov-report/index.html +44 -29
- package/coverage/lcov-report/src/__tests__/helpers/expect.ts.html +94 -0
- package/coverage/lcov-report/src/__tests__/helpers/index.html +18 -3
- package/coverage/lcov-report/src/__tests__/helpers/main.ts.html +2 -2
- package/coverage/lcov-report/src/async/arrays.ts.html +1 -1
- package/coverage/lcov-report/src/async/index.html +1 -1
- package/coverage/lcov-report/src/async/timeout.ts.html +13 -13
- package/coverage/lcov-report/src/cache.ts.html +6 -6
- package/coverage/lcov-report/src/dates/calc.ts.html +1 -1
- package/coverage/lcov-report/src/dates/convert.ts.html +1 -1
- package/coverage/lcov-report/src/dates/datex.ts.html +1 -1
- package/coverage/lcov-report/src/dates/format.ts.html +1 -1
- package/coverage/lcov-report/src/dates/index.html +1 -1
- package/coverage/lcov-report/src/dates/index.ts.html +1 -1
- package/coverage/lcov-report/src/dates/parse.ts.html +1 -1
- package/coverage/lcov-report/src/dates/period.ts.html +1 -1
- package/coverage/lcov-report/src/dates/shift.ts.html +1 -1
- package/coverage/lcov-report/src/dates/types.ts.html +1 -1
- package/coverage/lcov-report/src/dates/yearDate.ts.html +1 -1
- package/coverage/lcov-report/src/disposer.ts.html +1 -1
- package/coverage/lcov-report/src/enumHelper.ts.html +1 -1
- package/coverage/lcov-report/src/event.ts.html +6 -6
- package/coverage/lcov-report/src/fields/index.html +1 -1
- package/coverage/lcov-report/src/fields/update.ts.html +1 -1
- package/coverage/lcov-report/src/functions.ts.html +1 -1
- package/coverage/lcov-report/src/index.html +11 -26
- package/coverage/lcov-report/src/lazy/index.html +161 -0
- package/coverage/lcov-report/src/lazy/lazy.ts.html +181 -0
- package/coverage/lcov-report/src/lazy/light.ts.html +172 -0
- package/coverage/lcov-report/src/lazy/observable.ts.html +184 -0
- package/coverage/lcov-report/src/lazy/promise.ts.html +229 -0
- package/coverage/lcov-report/src/lazy/singleton.ts.html +181 -0
- package/coverage/lcov-report/src/lazy.light.ts.html +1 -1
- package/coverage/lcov-report/src/logger/batch.ts.html +1 -1
- package/coverage/lcov-report/src/logger/console.ts.html +1 -1
- package/coverage/lcov-report/src/logger/index.html +1 -1
- package/coverage/lcov-report/src/logger/index.ts.html +8 -8
- package/coverage/lcov-report/src/logger/named.ts.html +12 -12
- package/coverage/lcov-report/src/logger/proxy.ts.html +4 -4
- package/coverage/lcov-report/src/math/arrays.ts.html +1 -1
- package/coverage/lcov-report/src/math/calc.ts.html +1 -1
- package/coverage/lcov-report/src/math/distribution.ts.html +1 -1
- package/coverage/lcov-report/src/math/index.html +1 -1
- package/coverage/lcov-report/src/math/index.ts.html +1 -1
- package/coverage/lcov-report/src/observersMap.ts.html +1 -1
- package/coverage/lcov-report/src/observingCache.ts.html +1 -1
- package/coverage/lcov-report/src/queue/index.html +14 -14
- package/coverage/lcov-report/src/queue/parallel.ts.html +20 -8
- package/coverage/lcov-report/src/tempoCache.ts.html +1 -1
- package/coverage/lcov-report/src/transitionObserver.ts.html +1 -1
- package/coverage/lcov-report/src/types.ts.html +1 -1
- package/coverage/lcov-report/src/validation/ValidationErrors.ts.html +1 -1
- package/coverage/lcov-report/src/validation/creditCard.ts.html +1 -1
- package/coverage/lcov-report/src/validation/helpers.ts.html +1 -1
- package/coverage/lcov-report/src/validation/index.html +1 -1
- package/coverage/lcov-report/src/validation/index.ts.html +1 -1
- package/coverage/lcov-report/src/validation/types.ts.html +1 -1
- package/coverage/lcov-report/src/validation/validators.ts.html +3 -3
- package/coverage/lcov-report/src/validation/wrappers.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/CommonModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/FlagModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/LoadingModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/MultiSelectModel.ts.html +2 -2
- package/coverage/lcov-report/src/viewModels/NumberModel.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/SelectModel.ts.html +2 -2
- package/coverage/lcov-report/src/viewModels/TextModel.ts.html +4 -4
- package/coverage/lcov-report/src/viewModels/Validatable.ts.html +1 -1
- package/coverage/lcov-report/src/viewModels/index.html +5 -5
- package/coverage/lcov-report/src/viewModels/wrappers.ts.html +1 -1
- package/coverage/lcov.info +358 -228
- package/lib/cache.js.map +1 -1
- package/lib/lazy/index.d.ts +10 -0
- package/lib/lazy/index.d.ts.map +1 -0
- package/lib/lazy/index.js +23 -0
- package/lib/lazy/index.js.map +1 -0
- package/lib/lazy/light.d.ts +8 -0
- package/lib/lazy/light.d.ts.map +1 -0
- package/lib/lazy/light.js +23 -0
- package/lib/lazy/light.js.map +1 -0
- package/lib/lazy/observable.d.ts +9 -0
- package/lib/lazy/observable.d.ts.map +1 -0
- package/lib/lazy/observable.js +30 -0
- package/lib/lazy/observable.js.map +1 -0
- package/lib/{lazy.d.ts → lazy/promise.d.ts} +4 -14
- package/lib/lazy/promise.d.ts.map +1 -0
- package/lib/lazy/promise.js +39 -0
- package/lib/lazy/promise.js.map +1 -0
- package/lib/lazy/singleton.d.ts +13 -0
- package/lib/lazy/singleton.d.ts.map +1 -0
- package/lib/lazy/singleton.js +29 -0
- package/lib/lazy/singleton.js.map +1 -0
- package/lib/lazy.light.d.ts +1 -7
- package/lib/lazy.light.d.ts.map +1 -1
- package/lib/lazy.light.js +5 -20
- package/lib/lazy.light.js.map +1 -1
- package/lib/queue/parallel.d.ts +2 -0
- package/lib/queue/parallel.d.ts.map +1 -1
- package/lib/queue/parallel.js +3 -0
- package/lib/queue/parallel.js.map +1 -1
- package/lib/services/localization/LocalaziedValidationErrors.js.map +1 -1
- package/lib/services/localization/LocalizationManager.js.map +1 -1
- package/lib/unsubscriber.d.ts.map +1 -1
- package/lib/unsubscriber.js +1 -0
- package/lib/unsubscriber.js.map +1 -1
- package/lib/validation/validators.js +2 -2
- package/lib/validation/validators.js.map +1 -1
- package/lib/viewModels/MultiSelectModel.js +2 -2
- package/lib/viewModels/MultiSelectModel.js.map +1 -1
- package/lib/viewModels/PromptModal.js.map +1 -1
- package/lib/viewModels/SelectModel.js +2 -2
- package/lib/viewModels/SelectModel.js.map +1 -1
- package/lib/viewModels/TextModel.js.map +1 -1
- package/package.json +15 -16
- package/src/__tests__/helpers/expect.ts +3 -0
- package/src/__tests__/helpers/main.ts +1 -1
- package/src/lazy/__tests__/lazy.test.ts +94 -0
- package/src/lazy/index.ts +33 -0
- package/src/lazy/light.ts +29 -0
- package/src/lazy/observable.ts +33 -0
- package/src/lazy/promise.ts +48 -0
- package/src/lazy/singleton.ts +32 -0
- package/src/lazy.light.ts +4 -25
- package/src/logger/__tests__/logger.test.ts +7 -7
- package/src/queue/parallel.ts +4 -0
- package/src/unsubscriber.ts +3 -0
- package/src/validation/__tests__/validator.test.ts +1 -1
- package/src/validation/validators.ts +2 -2
- package/src/viewModels/MultiSelectModel.ts +1 -1
- package/src/viewModels/SelectModel.ts +1 -1
- package/yarn.lock +585 -488
- package/lib/lazy.d.ts.map +0 -1
- package/lib/lazy.js +0 -87
- package/lib/lazy.js.map +0 -1
- package/src/lazy.ts +0 -86
package/lib/lazy.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../src/lazy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,MAAM,CAAC,OAAO,OAAO,IAAI,CAAC,CAAC,CAAE,YAAW,WAAW;IAKnC,OAAO,CAAC,QAAQ;IAF5B,OAAO,CAAC,SAAS,CAAW;gBAER,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC;IAIvC,IAAI,QAAQ,YAAqC;IAEjD,IAAI,KAAK,MAKR;IAED,OAAO;IAIP,KAAK;IAIL,OAAO,aAAsB;CAChC;AAED,qBAAa,WAAW,CAAC,CAAC,CAAE,YAAW,WAAW;IAY1C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAV5B,OAAO,CAAC,SAAS,CAAW;IAG5B,OAAO,CAAC,KAAK,CAAS;IAEtB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAoB;gBAGf,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EAC1B,OAAO,GAAE,CAAQ;IAMtC,IAAI,IAAI,YAAyB;IAEjC,IAAI,OAAO,eAGV;IAED,GAAG;IAWH,OAAO,CAAC,WAAW,CAMjB;IAGF,KAAK;IAML,OAAO,aAAsB;CAChC"}
|
package/lib/lazy.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LazyPromise = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const mobx_1 = require("mobx");
|
|
6
|
-
class Lazy {
|
|
7
|
-
constructor(_factory) {
|
|
8
|
-
this._factory = _factory;
|
|
9
|
-
this._instance = null;
|
|
10
|
-
this.dispose = () => this.reset();
|
|
11
|
-
(0, mobx_1.makeObservable)(this);
|
|
12
|
-
}
|
|
13
|
-
get hasValue() { return this._instance != null; }
|
|
14
|
-
get value() {
|
|
15
|
-
if (!this._instance) {
|
|
16
|
-
this._instance = this._factory();
|
|
17
|
-
}
|
|
18
|
-
return this._instance;
|
|
19
|
-
}
|
|
20
|
-
prewarm() {
|
|
21
|
-
return this.value;
|
|
22
|
-
}
|
|
23
|
-
reset() {
|
|
24
|
-
this._instance = null;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
tslib_1.__decorate([
|
|
28
|
-
mobx_1.observable.ref,
|
|
29
|
-
tslib_1.__metadata("design:type", Object)
|
|
30
|
-
], Lazy.prototype, "_instance", void 0);
|
|
31
|
-
exports.default = Lazy;
|
|
32
|
-
class LazyPromise {
|
|
33
|
-
constructor(_factory, initial = null) {
|
|
34
|
-
this._factory = _factory;
|
|
35
|
-
this.initial = initial;
|
|
36
|
-
this._instance = null;
|
|
37
|
-
this._busy = false;
|
|
38
|
-
this._loaded = false;
|
|
39
|
-
this._promise = null;
|
|
40
|
-
this.setInstance = (res) => {
|
|
41
|
-
const wasBusy = this._busy;
|
|
42
|
-
this._busy = false;
|
|
43
|
-
this._loaded = wasBusy;
|
|
44
|
-
this._instance = wasBusy ? res : null;
|
|
45
|
-
};
|
|
46
|
-
this.dispose = () => this.reset();
|
|
47
|
-
(0, mobx_1.makeObservable)(this);
|
|
48
|
-
this._instance = initial;
|
|
49
|
-
}
|
|
50
|
-
get busy() { return this._busy; }
|
|
51
|
-
get promise() {
|
|
52
|
-
return this._promise;
|
|
53
|
-
}
|
|
54
|
-
get() {
|
|
55
|
-
if (!this._loaded && !this._busy) {
|
|
56
|
-
this._busy = true;
|
|
57
|
-
this._promise = this._factory();
|
|
58
|
-
this._promise.then(this.setInstance);
|
|
59
|
-
}
|
|
60
|
-
return this._instance;
|
|
61
|
-
}
|
|
62
|
-
reset() {
|
|
63
|
-
this._busy = false;
|
|
64
|
-
this._instance = this.initial;
|
|
65
|
-
this._loaded = false;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
tslib_1.__decorate([
|
|
69
|
-
mobx_1.observable.ref,
|
|
70
|
-
tslib_1.__metadata("design:type", Object)
|
|
71
|
-
], LazyPromise.prototype, "_instance", void 0);
|
|
72
|
-
tslib_1.__decorate([
|
|
73
|
-
mobx_1.observable,
|
|
74
|
-
tslib_1.__metadata("design:type", Object)
|
|
75
|
-
], LazyPromise.prototype, "_busy", void 0);
|
|
76
|
-
tslib_1.__decorate([
|
|
77
|
-
mobx_1.action,
|
|
78
|
-
tslib_1.__metadata("design:type", Object)
|
|
79
|
-
], LazyPromise.prototype, "setInstance", void 0);
|
|
80
|
-
tslib_1.__decorate([
|
|
81
|
-
mobx_1.action,
|
|
82
|
-
tslib_1.__metadata("design:type", Function),
|
|
83
|
-
tslib_1.__metadata("design:paramtypes", []),
|
|
84
|
-
tslib_1.__metadata("design:returntype", void 0)
|
|
85
|
-
], LazyPromise.prototype, "reset", null);
|
|
86
|
-
exports.LazyPromise = LazyPromise;
|
|
87
|
-
//# sourceMappingURL=lazy.js.map
|
package/lib/lazy.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lazy.js","sourceRoot":"","sources":["../src/lazy.ts"],"names":[],"mappings":";;;;AACA,+BAA0D;AAE1D,MAAqB,IAAI;IAKrB,YAAoB,QAAmB;QAAnB,aAAQ,GAAR,QAAQ,CAAW;QAF/B,cAAS,GAAM,IAAI,CAAC;QAuB5B,YAAO,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QApBzB,IAAA,qBAAc,EAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,IAAI,QAAQ,KAAK,OAAO,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC;IAEjD,IAAI,KAAK;QACL,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;SACpC;QACD,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,OAAO;QACH,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,KAAK;QACD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC1B,CAAC;CAGJ;AAxBG;IADC,iBAAU,CAAC,GAAG;;uCACa;AAHhC,uBA2BC;AAED,MAAa,WAAW;IAWpB,YACqB,QAA0B,EAC1B,UAAa,IAAI;QADjB,aAAQ,GAAR,QAAQ,CAAkB;QAC1B,YAAO,GAAP,OAAO,CAAU;QAV9B,cAAS,GAAM,IAAI,CAAC;QAGpB,UAAK,GAAG,KAAK,CAAC;QAEd,YAAO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;;;;wCAKN;AAlDL,kCAqDC"}
|
package/src/lazy.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { IDisposable } from 'disposer';
|
|
2
|
-
import { observable, makeObservable, action } from 'mobx';
|
|
3
|
-
|
|
4
|
-
export default class Lazy<T> implements IDisposable {
|
|
5
|
-
|
|
6
|
-
@observable.ref
|
|
7
|
-
private _instance: T = null;
|
|
8
|
-
|
|
9
|
-
constructor(private _factory: (() => T)) {
|
|
10
|
-
makeObservable(this);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
get hasValue() { return this._instance != null; }
|
|
14
|
-
|
|
15
|
-
get value() {
|
|
16
|
-
if (!this._instance) {
|
|
17
|
-
this._instance = this._factory();
|
|
18
|
-
}
|
|
19
|
-
return this._instance;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
prewarm() {
|
|
23
|
-
return this.value;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
reset() {
|
|
27
|
-
this._instance = null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
dispose = () => this.reset();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export class LazyPromise<T> implements IDisposable {
|
|
34
|
-
|
|
35
|
-
@observable.ref
|
|
36
|
-
private _instance: T = null;
|
|
37
|
-
|
|
38
|
-
@observable
|
|
39
|
-
private _busy = false;
|
|
40
|
-
|
|
41
|
-
private _loaded = false;
|
|
42
|
-
private _promise: Promise<T> = null;
|
|
43
|
-
|
|
44
|
-
constructor(
|
|
45
|
-
private readonly _factory: () => Promise<T>,
|
|
46
|
-
private readonly initial: T = null,
|
|
47
|
-
) {
|
|
48
|
-
makeObservable(this);
|
|
49
|
-
this._instance = initial;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
get busy() { return this._busy; }
|
|
53
|
-
|
|
54
|
-
get promise() {
|
|
55
|
-
|
|
56
|
-
return this._promise;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
get() {
|
|
60
|
-
if (!this._loaded && !this._busy) {
|
|
61
|
-
this._busy = true;
|
|
62
|
-
this._promise = this._factory();
|
|
63
|
-
this._promise.then(this.setInstance);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return this._instance;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
@action
|
|
70
|
-
private setInstance = (res: T) => {
|
|
71
|
-
const wasBusy = this._busy;
|
|
72
|
-
|
|
73
|
-
this._busy = false;
|
|
74
|
-
this._loaded = wasBusy;
|
|
75
|
-
this._instance = wasBusy ? res : null;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
@action
|
|
79
|
-
reset() {
|
|
80
|
-
this._busy = false;
|
|
81
|
-
this._instance = this.initial;
|
|
82
|
-
this._loaded = false;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
dispose = () => this.reset();
|
|
86
|
-
}
|