@leyyo/common 1.0.1 → 1.0.3
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/dist/assertion/common-assertion-impl.d.ts +3 -4
- package/dist/assertion/common-assertion-impl.js +9 -8
- package/dist/assertion/index-types.d.ts +6 -22
- package/dist/assertion/index.d.ts +0 -1
- package/dist/assertion/index.js +0 -1
- package/dist/error/common-error-impl.d.ts +6 -4
- package/dist/error/common-error-impl.js +8 -4
- package/dist/error/index-types.d.ts +5 -52
- package/dist/error/index.d.ts +0 -5
- package/dist/error/index.js +0 -5
- package/dist/{error → exception}/assertion-exception.d.ts +1 -1
- package/dist/{error → exception}/caused-exception.d.ts +1 -1
- package/dist/{error → exception}/developer-exception.d.ts +1 -1
- package/dist/{error → exception}/exception.d.ts +4 -3
- package/dist/{error → exception}/exception.js +4 -4
- package/dist/exception/index-types.d.ts +30 -0
- package/dist/exception/index.d.ts +6 -0
- package/dist/exception/index.js +22 -0
- package/dist/fqn/common-fqn-impl.d.ts +18 -0
- package/dist/fqn/common-fqn-impl.js +121 -0
- package/dist/fqn/index-types.d.ts +9 -0
- package/dist/fqn/index-types.js +2 -0
- package/dist/fqn/index.d.ts +2 -0
- package/dist/{callback → fqn}/index.js +1 -1
- package/dist/hook/common-hook-impl.d.ts +30 -0
- package/dist/hook/common-hook-impl.js +111 -0
- package/dist/hook/index-types.d.ts +56 -0
- package/dist/hook/index-types.js +2 -0
- package/dist/hook/index.d.ts +2 -0
- package/dist/hook/index.js +18 -0
- package/dist/index.d.ts +11 -5
- package/dist/index.js +19 -6
- package/dist/is/common-is-impl.js +6 -6
- package/dist/is/index-types.d.ts +2 -3
- package/dist/leyyo/index-types.d.ts +4 -2
- package/dist/leyyo/leyyo-impl.d.ts +4 -2
- package/dist/leyyo/leyyo-impl.js +53 -30
- package/dist/literal/country-code.d.ts +8 -0
- package/dist/literal/country-code.js +17 -0
- package/dist/literal/environment.d.ts +8 -0
- package/dist/literal/environment.js +7 -0
- package/dist/literal/http-method.d.ts +8 -0
- package/dist/literal/http-method.js +7 -0
- package/dist/literal/http-place.d.ts +8 -0
- package/dist/literal/http-place.js +7 -0
- package/dist/literal/index-types.d.ts +6 -0
- package/dist/literal/index-types.js +2 -0
- package/dist/literal/index.d.ts +16 -0
- package/dist/literal/index.js +32 -0
- package/dist/literal/key-value.d.ts +4 -0
- package/dist/literal/key-value.js +7 -0
- package/dist/literal/language-code.d.ts +8 -0
- package/dist/literal/language-code.js +12 -0
- package/dist/literal/locale-code.d.ts +10 -0
- package/dist/literal/locale-code.js +17 -0
- package/dist/literal/primitive.d.ts +8 -0
- package/dist/literal/primitive.js +7 -0
- package/dist/literal/real-value.d.ts +8 -0
- package/dist/literal/real-value.js +7 -0
- package/dist/literal/severity.d.ts +8 -0
- package/dist/literal/severity.js +7 -0
- package/dist/literal/storage-type.d.ts +8 -0
- package/dist/literal/storage-type.js +7 -0
- package/dist/literal/sys-class.d.ts +2 -0
- package/dist/literal/sys-class.js +19 -0
- package/dist/literal/sys-function.d.ts +2 -0
- package/dist/literal/sys-function.js +6 -0
- package/dist/literal/weak-false.d.ts +8 -0
- package/dist/literal/weak-false.js +7 -0
- package/dist/literal/weak-true.d.ts +8 -0
- package/dist/literal/weak-true.js +7 -0
- package/dist/log/common-log-impl.d.ts +3 -2
- package/dist/log/common-log-impl.js +6 -6
- package/dist/log/index-types.d.ts +2 -52
- package/dist/log/index-types.js +0 -1
- package/dist/log/index.d.ts +1 -1
- package/dist/log/index.js +1 -1
- package/dist/log/logger-impl.d.ts +3 -4
- package/dist/log/logger-impl.js +11 -8
- package/dist/{assertion → shared}/assert.js +1 -0
- package/dist/{aliases.d.ts → shared/index-aliases.d.ts} +1 -1
- package/dist/{constants.d.ts → shared/index-constants.d.ts} +1 -0
- package/dist/{constants.js → shared/index-constants.js} +2 -1
- package/dist/shared/index-types.d.ts +142 -0
- package/dist/shared/index-types.js +3 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.js +21 -0
- package/dist/storage/common-storage-impl.d.ts +3 -3
- package/dist/storage/common-storage-impl.js +3 -3
- package/dist/storage/index-types.d.ts +3 -13
- package/dist/storage/index.d.ts +0 -1
- package/dist/storage/index.js +0 -1
- package/dist/to/common-to-impl.d.ts +3 -3
- package/dist/to/common-to-impl.js +11 -11
- package/dist/to/index-types.d.ts +1 -30
- package/package.json +1 -1
- package/dist/callback/common-callback-impl.d.ts +0 -31
- package/dist/callback/common-callback-impl.js +0 -134
- package/dist/callback/index-types.d.ts +0 -73
- package/dist/callback/index.d.ts +0 -2
- package/dist/literals.d.ts +0 -106
- package/dist/literals.js +0 -81
- package/dist/{error → exception}/assertion-exception.js +0 -0
- package/dist/{error → exception}/caused-exception.js +0 -0
- package/dist/{error → exception}/developer-exception.js +0 -0
- package/dist/{callback → exception}/index-types.js +0 -0
- package/dist/{error → exception}/multiple-exception.d.ts +1 -1
- package/dist/{error → exception}/multiple-exception.js +0 -0
- package/dist/{assertion → shared}/assert.d.ts +1 -1
- /package/dist/{aliases.js → shared/index-aliases.js} +0 -0
- /package/dist/{storage → shared}/list.d.ts +0 -0
- /package/dist/{storage → shared}/list.js +0 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommonHookImpl = void 0;
|
|
4
|
+
const internal_1 = require("../internal");
|
|
5
|
+
const exception_1 = require("../exception");
|
|
6
|
+
// noinspection JSUnusedGlobalSymbols
|
|
7
|
+
class CommonHookImpl {
|
|
8
|
+
/**
|
|
9
|
+
* Default constructor
|
|
10
|
+
*
|
|
11
|
+
* Responsibilities
|
|
12
|
+
* - Create repositories => ie: callbacks
|
|
13
|
+
* - Trigger clear pending operation
|
|
14
|
+
* */
|
|
15
|
+
constructor() {
|
|
16
|
+
// clear after 1 minute
|
|
17
|
+
setTimeout(() => this._clearPending(), 60000);
|
|
18
|
+
}
|
|
19
|
+
$init(leyyo) {
|
|
20
|
+
this._waitingForCallbacks = leyyo.storage.newMap(`${internal_1.FQN_PCK}/waitingForCallbacks`);
|
|
21
|
+
this._attachedCallbacks = leyyo.storage.newMap(`${internal_1.FQN_PCK}/attachedCallbacks`);
|
|
22
|
+
this._waitingForProviders = leyyo.storage.newMap(`${internal_1.FQN_PCK}/waitingForProviders`);
|
|
23
|
+
this._definedProviders = leyyo.storage.newMap(`${internal_1.FQN_PCK}/definedProviders`);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Clear jobs in the queue which channel as pending
|
|
27
|
+
*
|
|
28
|
+
* Because the expected callback may not be defined
|
|
29
|
+
* */
|
|
30
|
+
_clearPending() {
|
|
31
|
+
for (const [channel,] of this._waitingForCallbacks.entries()) {
|
|
32
|
+
const rec = this._attachedCallbacks.get(channel);
|
|
33
|
+
if (rec && !rec.initialization) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
this._waitingForCallbacks.delete(channel);
|
|
37
|
+
console.log(`hook.cleared.pending => {channel: ${channel}}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
get $secure() {
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
attachCallback(channel, fn) {
|
|
44
|
+
if (!channel || typeof channel !== 'string') {
|
|
45
|
+
throw new Error(`hook.invalid.channel => {type: ${typeof channel}}`);
|
|
46
|
+
}
|
|
47
|
+
// callback attached
|
|
48
|
+
this._attachedCallbacks.set(channel, { fn });
|
|
49
|
+
// check waiting records, to be called
|
|
50
|
+
if (this._waitingForCallbacks.has(channel)) {
|
|
51
|
+
this._waitingForCallbacks.get(channel).forEach(item => {
|
|
52
|
+
fn(...item);
|
|
53
|
+
});
|
|
54
|
+
this._waitingForCallbacks.delete(channel);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
queueForCallback(channel, ...args) {
|
|
58
|
+
if (!channel || typeof channel !== 'string') {
|
|
59
|
+
throw new Error(`hook.invalid.channel => {type: ${typeof channel}}`);
|
|
60
|
+
}
|
|
61
|
+
// callback already exists
|
|
62
|
+
if (this._attachedCallbacks.has(channel)) {
|
|
63
|
+
const rec = this._attachedCallbacks.get(channel);
|
|
64
|
+
rec.fn(...args);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
// callback does not exist yet, so wait to be attached
|
|
68
|
+
if (this._waitingForCallbacks.has(channel)) {
|
|
69
|
+
this._waitingForCallbacks.get(channel).push(args);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
this._waitingForCallbacks.set(channel, [args]);
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
get $back() {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
whenProviderDefined(channel, consumer, callback) {
|
|
80
|
+
if (!channel || typeof channel !== 'string') {
|
|
81
|
+
throw new exception_1.DeveloperException(`hook.invalid.channel`, { type: typeof channel });
|
|
82
|
+
}
|
|
83
|
+
if (!this._waitingForProviders.has(channel)) {
|
|
84
|
+
this._waitingForProviders.set(channel, []);
|
|
85
|
+
}
|
|
86
|
+
if (this._definedProviders.has(channel)) {
|
|
87
|
+
const ins = this._definedProviders.get(channel);
|
|
88
|
+
if (ins.producer !== consumer) {
|
|
89
|
+
callback(ins);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
this._waitingForProviders.get(channel).push({ consumer, callback });
|
|
93
|
+
}
|
|
94
|
+
defineProvider(channel, producer, instance) {
|
|
95
|
+
if (!channel || typeof channel !== 'string') {
|
|
96
|
+
throw new exception_1.DeveloperException(`hook.invalid.channel`, { type: typeof channel });
|
|
97
|
+
}
|
|
98
|
+
const ins = Object.assign(Object.assign({}, instance), { producer });
|
|
99
|
+
this._definedProviders.set(channel, ins);
|
|
100
|
+
if (instance.proper) {
|
|
101
|
+
if (this._waitingForProviders.has(channel)) {
|
|
102
|
+
this._waitingForProviders.get(channel).forEach(item => {
|
|
103
|
+
if (item.consumer !== producer) {
|
|
104
|
+
item.callback(instance);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.CommonHookImpl = CommonHookImpl;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Arr, HookDefinedProvider, HookDefinedProviderLambda, InitLike, ShiftMain, ShiftSecure } from "../shared";
|
|
2
|
+
/**
|
|
3
|
+
* Hook interface, it collects all jobs and fire them when callback is defined
|
|
4
|
+
* */
|
|
5
|
+
export interface CommonHook extends ShiftSecure<CommonHookSecure> {
|
|
6
|
+
/**
|
|
7
|
+
* Attach a callback
|
|
8
|
+
*
|
|
9
|
+
* @param {string} channel
|
|
10
|
+
* @param {Function} fn
|
|
11
|
+
*
|
|
12
|
+
* Notes:
|
|
13
|
+
* - channel should be regular string
|
|
14
|
+
* - After attached, it should call all waiting calls in the queue
|
|
15
|
+
* */
|
|
16
|
+
attachCallback(channel: string, fn: Function): void;
|
|
17
|
+
/**
|
|
18
|
+
* Add a call into queue, which to be executed by appropriate callback
|
|
19
|
+
*
|
|
20
|
+
* @param {string} channel
|
|
21
|
+
* @param {Array<any>} args
|
|
22
|
+
* @returns {boolean} - channel exists?
|
|
23
|
+
*
|
|
24
|
+
* Notes:
|
|
25
|
+
* - channel should be regular string
|
|
26
|
+
* */
|
|
27
|
+
queueForCallback(channel: string, ...args: Arr): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Informs when callback is changed
|
|
30
|
+
*
|
|
31
|
+
* @param {string} channel
|
|
32
|
+
* @param {Function} consumer
|
|
33
|
+
* @param {HookDefinedProviderLambda} callback
|
|
34
|
+
*
|
|
35
|
+
* Notes:
|
|
36
|
+
* - channel should be regular string
|
|
37
|
+
* - callback should be regular function
|
|
38
|
+
* - channel should not be already defined
|
|
39
|
+
* */
|
|
40
|
+
whenProviderDefined<T extends HookDefinedProvider = HookDefinedProvider>(channel: string, consumer: Function, callback: HookDefinedProviderLambda<T>): void;
|
|
41
|
+
/**
|
|
42
|
+
* Defines a provider to replace temporary providers
|
|
43
|
+
*
|
|
44
|
+
* @param {string} channel
|
|
45
|
+
* @param {Function} producer
|
|
46
|
+
* @param {Object} instance
|
|
47
|
+
*
|
|
48
|
+
* Notes:
|
|
49
|
+
* - channel should be regular string
|
|
50
|
+
* */
|
|
51
|
+
defineProvider<T extends HookDefinedProvider = HookDefinedProvider>(channel: string, producer: Function, instance: T): void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Secure hook interface
|
|
55
|
+
* */
|
|
56
|
+
export type CommonHookSecure = ShiftMain<CommonHook> & InitLike;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./index-types"), exports);
|
|
18
|
+
__exportStar(require("./common-hook-impl"), exports);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
export * from './exception';
|
|
2
|
+
export * from './literal';
|
|
3
|
+
export * from './shared';
|
|
1
4
|
import { leyyo } from "./leyyo";
|
|
2
|
-
export * from './aliases';
|
|
3
|
-
export * from './constants';
|
|
4
|
-
export * from './literals';
|
|
5
5
|
declare const is: import("./is").CommonIs;
|
|
6
|
-
declare const
|
|
7
|
-
|
|
6
|
+
declare const hook: import("./hook").CommonHook;
|
|
7
|
+
declare const assertion: import("./assertion").CommonAssertion;
|
|
8
|
+
declare const storage: import("./storage").CommonStorage;
|
|
9
|
+
declare const to: import("./to").CommonTo;
|
|
10
|
+
declare const commonFqn: import("./fqn").CommonFqn;
|
|
11
|
+
declare const commonLog: import("./log").CommonLog;
|
|
12
|
+
declare const commonError: import("./error").CommonError;
|
|
13
|
+
export { leyyo, is, hook, assertion, storage, to, commonFqn, commonLog, commonError };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// noinspection JSUnusedGlobalSymbols
|
|
2
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
4
|
if (k2 === undefined) k2 = k;
|
|
4
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -14,13 +15,25 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
16
|
};
|
|
16
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
+
exports.commonError = exports.commonLog = exports.commonFqn = exports.to = exports.storage = exports.assertion = exports.hook = exports.is = exports.leyyo = void 0;
|
|
19
|
+
__exportStar(require("./exception"), exports);
|
|
20
|
+
__exportStar(require("./literal"), exports);
|
|
21
|
+
__exportStar(require("./shared"), exports);
|
|
18
22
|
const leyyo_1 = require("./leyyo");
|
|
19
23
|
Object.defineProperty(exports, "leyyo", { enumerable: true, get: function () { return leyyo_1.leyyo; } });
|
|
20
|
-
__exportStar(require("./aliases"), exports);
|
|
21
|
-
__exportStar(require("./constants"), exports);
|
|
22
|
-
__exportStar(require("./literals"), exports);
|
|
23
24
|
const is = leyyo_1.leyyo.is;
|
|
24
25
|
exports.is = is;
|
|
25
|
-
const
|
|
26
|
-
exports.
|
|
26
|
+
const hook = leyyo_1.leyyo.hook;
|
|
27
|
+
exports.hook = hook;
|
|
28
|
+
const assertion = leyyo_1.leyyo.assertion;
|
|
29
|
+
exports.assertion = assertion;
|
|
30
|
+
const storage = leyyo_1.leyyo.storage;
|
|
31
|
+
exports.storage = storage;
|
|
32
|
+
const to = leyyo_1.leyyo.to;
|
|
33
|
+
exports.to = to;
|
|
34
|
+
const commonFqn = leyyo_1.leyyo.fqn;
|
|
35
|
+
exports.commonFqn = commonFqn;
|
|
36
|
+
const commonLog = leyyo_1.leyyo.log;
|
|
37
|
+
exports.commonLog = commonLog;
|
|
38
|
+
const commonError = leyyo_1.leyyo.error;
|
|
39
|
+
exports.commonError = commonError;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommonIsImpl = void 0;
|
|
4
|
-
const
|
|
4
|
+
const literal_1 = require("../literal");
|
|
5
5
|
// noinspection JSUnusedGlobalSymbols, JSUnusedLocalSymbols
|
|
6
6
|
/** @inheritDoc */
|
|
7
7
|
class CommonIsImpl {
|
|
@@ -12,15 +12,15 @@ class CommonIsImpl {
|
|
|
12
12
|
}
|
|
13
13
|
/** @inheritDoc */
|
|
14
14
|
primitive(value) {
|
|
15
|
-
return
|
|
15
|
+
return literal_1.PrimitiveItems.includes((typeof value));
|
|
16
16
|
}
|
|
17
17
|
/** @inheritDoc */
|
|
18
18
|
realValue(value) {
|
|
19
|
-
return
|
|
19
|
+
return literal_1.RealValueItems.includes((typeof value));
|
|
20
20
|
}
|
|
21
21
|
/** @inheritDoc */
|
|
22
22
|
key(value) {
|
|
23
|
-
return
|
|
23
|
+
return literal_1.KeyValueItems.includes((typeof value));
|
|
24
24
|
}
|
|
25
25
|
/** @inheritDoc */
|
|
26
26
|
object(value) {
|
|
@@ -65,13 +65,13 @@ class CommonIsImpl {
|
|
|
65
65
|
/** @inheritDoc */
|
|
66
66
|
true(value) {
|
|
67
67
|
return (value === true) ||
|
|
68
|
-
(this.text(value) &&
|
|
68
|
+
(this.text(value) && literal_1.WeakTrueItems.includes(value.toLowerCase())) ||
|
|
69
69
|
(this.number(value) && value > 0);
|
|
70
70
|
}
|
|
71
71
|
/** @inheritDoc */
|
|
72
72
|
false(value) {
|
|
73
73
|
return (value === false) ||
|
|
74
|
-
(this.text(value) &&
|
|
74
|
+
(this.text(value) && literal_1.WeakFalseItems.includes(value.toLowerCase())) ||
|
|
75
75
|
(this.number(value) && value <= 0);
|
|
76
76
|
}
|
|
77
77
|
// endregion is
|
package/dist/is/index-types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitLike, ShiftMain, ShiftSecure } from "../
|
|
1
|
+
import { InitLike, ShiftMain, ShiftSecure } from "../shared";
|
|
2
2
|
/**
|
|
3
3
|
* Basic is commands to easy use
|
|
4
4
|
* */
|
|
@@ -141,5 +141,4 @@ export interface CommonIs extends ShiftSecure<CommonIsSecure> {
|
|
|
141
141
|
* */
|
|
142
142
|
false(value: any): boolean;
|
|
143
143
|
}
|
|
144
|
-
export
|
|
145
|
-
}
|
|
144
|
+
export type CommonIsSecure = ShiftMain<CommonIs> & InitLike;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommonHook } from "../hook";
|
|
2
2
|
import { CommonIs } from "../is";
|
|
3
3
|
import { CommonAssertion } from "../assertion";
|
|
4
4
|
import { CommonError } from "../error";
|
|
5
5
|
import { CommonLog } from "../log";
|
|
6
6
|
import { CommonStorage } from "../storage";
|
|
7
7
|
import { CommonTo } from "../to";
|
|
8
|
+
import { CommonFqn } from "../fqn";
|
|
8
9
|
export interface Leyyo {
|
|
9
10
|
readonly is: CommonIs;
|
|
10
|
-
readonly
|
|
11
|
+
readonly hook: CommonHook;
|
|
11
12
|
readonly assertion: CommonAssertion;
|
|
12
13
|
readonly error: CommonError;
|
|
13
14
|
readonly log: CommonLog;
|
|
14
15
|
readonly storage: CommonStorage;
|
|
15
16
|
readonly to: CommonTo;
|
|
17
|
+
readonly fqn: CommonFqn;
|
|
16
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommonHook } from "../hook";
|
|
2
2
|
import { Leyyo } from "./index-types";
|
|
3
3
|
import { CommonIs } from "../is";
|
|
4
4
|
import { CommonAssertion } from "../assertion";
|
|
@@ -6,14 +6,16 @@ import { CommonError } from "../error";
|
|
|
6
6
|
import { CommonLog } from "../log";
|
|
7
7
|
import { CommonStorage } from "../storage";
|
|
8
8
|
import { CommonTo } from "../to";
|
|
9
|
+
import { CommonFqn } from "../fqn";
|
|
9
10
|
export declare class LeyyoImpl implements Leyyo {
|
|
10
|
-
readonly
|
|
11
|
+
readonly hook: CommonHook;
|
|
11
12
|
readonly is: CommonIs;
|
|
12
13
|
readonly assertion: CommonAssertion;
|
|
13
14
|
readonly error: CommonError;
|
|
14
15
|
readonly log: CommonLog;
|
|
15
16
|
readonly storage: CommonStorage;
|
|
16
17
|
readonly to: CommonTo;
|
|
18
|
+
readonly fqn: CommonFqn;
|
|
17
19
|
constructor();
|
|
18
20
|
private init;
|
|
19
21
|
private postInit;
|
package/dist/leyyo/leyyo-impl.js
CHANGED
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.leyyo = exports.LeyyoImpl = void 0;
|
|
4
|
-
const
|
|
7
|
+
const hook_1 = require("../hook");
|
|
5
8
|
const is_1 = require("../is");
|
|
6
9
|
const assertion_1 = require("../assertion");
|
|
7
10
|
const error_1 = require("../error");
|
|
8
11
|
const log_1 = require("../log");
|
|
9
12
|
const storage_1 = require("../storage");
|
|
10
13
|
const to_1 = require("../to");
|
|
11
|
-
const
|
|
14
|
+
const shared_1 = require("../shared");
|
|
12
15
|
const internal_1 = require("../internal");
|
|
13
|
-
const
|
|
16
|
+
const literal_1 = require("../literal");
|
|
17
|
+
const exception_1 = require("../exception");
|
|
18
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
19
|
+
const fqn_1 = require("../fqn");
|
|
14
20
|
class LeyyoImpl {
|
|
15
21
|
constructor() {
|
|
16
22
|
this.is = new is_1.CommonIsImpl();
|
|
17
23
|
this.storage = new storage_1.CommonStorageImpl();
|
|
18
|
-
this.
|
|
19
|
-
this.log = new log_1.CommonLogImpl(); //
|
|
20
|
-
this.error = new error_1.CommonErrorImpl(); //
|
|
21
|
-
this.assertion = new assertion_1.CommonAssertionImpl(); // is,
|
|
22
|
-
this.to = new to_1.CommonToImpl(); // is,
|
|
24
|
+
this.hook = new hook_1.CommonHookImpl(); // storage
|
|
25
|
+
this.log = new log_1.CommonLogImpl(); // hook
|
|
26
|
+
this.error = new error_1.CommonErrorImpl(); // hook
|
|
27
|
+
this.assertion = new assertion_1.CommonAssertionImpl(); // is, hook
|
|
28
|
+
this.to = new to_1.CommonToImpl(); // is, hook, assertion
|
|
29
|
+
this.fqn = new fqn_1.CommonFqnImpl(); // hook
|
|
23
30
|
this.init();
|
|
24
31
|
this.postInit();
|
|
25
32
|
this.initFqnRegister();
|
|
@@ -29,42 +36,58 @@ class LeyyoImpl {
|
|
|
29
36
|
init() {
|
|
30
37
|
this.is.$secure.$init(this);
|
|
31
38
|
this.storage.$secure.$init(this);
|
|
32
|
-
this.
|
|
39
|
+
this.hook.$secure.$init(this);
|
|
33
40
|
this.log.$secure.$init(this);
|
|
34
41
|
this.error.$secure.$init(this);
|
|
35
42
|
this.assertion.$secure.$init(this);
|
|
36
43
|
this.to.$secure.$init(this);
|
|
37
44
|
}
|
|
38
45
|
postInit() {
|
|
39
|
-
(0,
|
|
46
|
+
(0, shared_1.$$setLeyyo)(this);
|
|
40
47
|
log_1.LoggerImpl.$setLeyyo(this);
|
|
41
|
-
|
|
48
|
+
exception_1.Exception.$setLeyyo(this);
|
|
42
49
|
}
|
|
43
50
|
initFqnRegister() {
|
|
44
|
-
this.
|
|
45
|
-
this.
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
48
|
-
this.
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
51
|
+
this.fqn.register(null, is_1.CommonIsImpl, 'class', internal_1.FQN_PCK);
|
|
52
|
+
this.fqn.register(null, storage_1.CommonStorageImpl, 'class', internal_1.FQN_PCK);
|
|
53
|
+
this.fqn.register(null, hook_1.CommonHookImpl, 'class', internal_1.FQN_PCK);
|
|
54
|
+
this.fqn.register(null, fqn_1.CommonFqnImpl, 'class', internal_1.FQN_PCK);
|
|
55
|
+
this.fqn.register(null, log_1.CommonLogImpl, 'class', internal_1.FQN_PCK);
|
|
56
|
+
this.fqn.register(null, error_1.CommonErrorImpl, 'class', internal_1.FQN_PCK);
|
|
57
|
+
this.fqn.register(null, assertion_1.CommonAssertionImpl, 'class', internal_1.FQN_PCK);
|
|
58
|
+
this.fqn.register(null, to_1.CommonToImpl, 'class', internal_1.FQN_PCK);
|
|
59
|
+
this.fqn.register(null, shared_1.List, 'class', internal_1.FQN_PCK);
|
|
60
|
+
this.fqn.register(null, log_1.LoggerImpl, 'class', internal_1.FQN_PCK);
|
|
61
|
+
this.fqn.register(null, node_assert_1.default, 'function', internal_1.FQN_PCK);
|
|
54
62
|
}
|
|
55
63
|
initErrorRegister() {
|
|
56
|
-
[
|
|
57
|
-
this.
|
|
58
|
-
this.
|
|
64
|
+
[exception_1.Exception, exception_1.AssertionException, exception_1.CausedException, exception_1.DeveloperException, exception_1.MultipleException].forEach(cls => {
|
|
65
|
+
this.fqn.register(null, cls, 'class', internal_1.FQN_PCK);
|
|
66
|
+
this.error.register(cls);
|
|
59
67
|
});
|
|
60
68
|
}
|
|
61
69
|
initEnumRegister() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
const enumMap = {
|
|
71
|
+
Primitive: literal_1.PrimitiveItems,
|
|
72
|
+
StorageType: literal_1.StorageTypeItems,
|
|
73
|
+
RealValue: literal_1.RealValueItems,
|
|
74
|
+
KeyValue: literal_1.KeyValueItems,
|
|
75
|
+
WeakTrue: literal_1.WeakTrueItems,
|
|
76
|
+
WeakFalse: literal_1.WeakFalseItems,
|
|
77
|
+
HttpMethod: literal_1.HttpMethodItems,
|
|
78
|
+
HttpPlace: literal_1.HttpPlaceItems,
|
|
79
|
+
Severity: literal_1.SeverityItems,
|
|
80
|
+
Environment: literal_1.EnvironmentItems,
|
|
81
|
+
CountryCode: literal_1.CountryCodeItems,
|
|
82
|
+
LanguageCode: literal_1.LanguageCodeItems,
|
|
83
|
+
LocaleCode: literal_1.LocaleCodeItems,
|
|
84
|
+
SysClass: literal_1.SysClassItems,
|
|
85
|
+
SysFunction: literal_1.SysFunctionItems,
|
|
86
|
+
};
|
|
87
|
+
for (const [name, value] of Object.entries(enumMap)) {
|
|
88
|
+
this.fqn.register(name, value, 'enum', internal_1.FQN_PCK);
|
|
89
|
+
this.hook.queueForCallback(shared_1.LY_PENDING_ENUM_REGISTER, value);
|
|
90
|
+
}
|
|
68
91
|
}
|
|
69
92
|
}
|
|
70
93
|
exports.LeyyoImpl = LeyyoImpl;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Country code items
|
|
3
|
+
* */
|
|
4
|
+
export declare const CountryCodeItems: readonly ["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BM", "BN", "BO", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CS", "CU", "CV", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "ST", "SV", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"];
|
|
5
|
+
/**
|
|
6
|
+
* Country code
|
|
7
|
+
* */
|
|
8
|
+
export type CountryCode = typeof CountryCodeItems[number];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CountryCodeItems = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Country code items
|
|
6
|
+
* */
|
|
7
|
+
exports.CountryCodeItems = ['AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AN', 'AO', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AW', 'AX',
|
|
8
|
+
'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BM', 'BN', 'BO', 'BR', 'BS', 'BT', 'BV', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD',
|
|
9
|
+
'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CS', 'CU', 'CV', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC',
|
|
10
|
+
'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GG', 'GH', 'GI', 'GL', 'GM', 'GN',
|
|
11
|
+
'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN', 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IM', 'IN', 'IO', 'IQ', 'IR', 'IS',
|
|
12
|
+
'IT', 'JE', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS',
|
|
13
|
+
'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'MG', 'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX',
|
|
14
|
+
'MY', 'MZ', 'NA', 'NC', 'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM',
|
|
15
|
+
'PN', 'PR', 'PS', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM',
|
|
16
|
+
'SN', 'SO', 'SR', 'ST', 'SV', 'SY', 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ',
|
|
17
|
+
'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW'];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './country-code';
|
|
2
|
+
export * from './environment';
|
|
3
|
+
export * from './http-method';
|
|
4
|
+
export * from './http-place';
|
|
5
|
+
export * from './key-value';
|
|
6
|
+
export * from './language-code';
|
|
7
|
+
export * from './locale-code';
|
|
8
|
+
export * from './primitive';
|
|
9
|
+
export * from './real-value';
|
|
10
|
+
export * from './severity';
|
|
11
|
+
export * from './storage-type';
|
|
12
|
+
export * from './sys-class';
|
|
13
|
+
export * from './sys-function';
|
|
14
|
+
export * from './weak-false';
|
|
15
|
+
export * from './weak-true';
|
|
16
|
+
export * from './index-types';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./country-code"), exports);
|
|
18
|
+
__exportStar(require("./environment"), exports);
|
|
19
|
+
__exportStar(require("./http-method"), exports);
|
|
20
|
+
__exportStar(require("./http-place"), exports);
|
|
21
|
+
__exportStar(require("./key-value"), exports);
|
|
22
|
+
__exportStar(require("./language-code"), exports);
|
|
23
|
+
__exportStar(require("./locale-code"), exports);
|
|
24
|
+
__exportStar(require("./primitive"), exports);
|
|
25
|
+
__exportStar(require("./real-value"), exports);
|
|
26
|
+
__exportStar(require("./severity"), exports);
|
|
27
|
+
__exportStar(require("./storage-type"), exports);
|
|
28
|
+
__exportStar(require("./sys-class"), exports);
|
|
29
|
+
__exportStar(require("./sys-function"), exports);
|
|
30
|
+
__exportStar(require("./weak-false"), exports);
|
|
31
|
+
__exportStar(require("./weak-true"), exports);
|
|
32
|
+
__exportStar(require("./index-types"), exports);
|