@allgemein/base 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/Constants.d.ts +11 -0
- package/Constants.js +15 -0
- package/Constants.js.map +1 -0
- package/LICENSE +23 -0
- package/MetaArgs.d.ts +9 -0
- package/MetaArgs.js +21 -0
- package/MetaArgs.js.map +1 -0
- package/MetadataStorage.d.ts +17 -0
- package/MetadataStorage.js +47 -0
- package/MetadataStorage.js.map +1 -0
- package/README.md +6 -0
- package/browser.d.ts +2 -0
- package/browser.js +32 -0
- package/browser.js.map +1 -0
- package/exceptions/NestedException.d.ts +11 -0
- package/exceptions/NestedException.js +31 -0
- package/exceptions/NestedException.js.map +1 -0
- package/exceptions/NotSupportedError.d.ts +3 -0
- package/exceptions/NotSupportedError.js +11 -0
- package/exceptions/NotSupportedError.js.map +1 -0
- package/exceptions/NotYetImplementedError.d.ts +3 -0
- package/exceptions/NotYetImplementedError.js +11 -0
- package/exceptions/NotYetImplementedError.js.map +1 -0
- package/exceptions/TodoException.d.ts +3 -0
- package/exceptions/TodoException.js +11 -0
- package/exceptions/TodoException.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.js +36 -0
- package/index.js.map +1 -0
- package/locking/LockFactory.d.ts +15 -0
- package/locking/LockFactory.js +60 -0
- package/locking/LockFactory.js.map +1 -0
- package/locking/Semaphore.d.ts +45 -0
- package/locking/Semaphore.js +108 -0
- package/locking/Semaphore.js.map +1 -0
- package/logging/AbstractLogger.d.ts +24 -0
- package/logging/AbstractLogger.js +73 -0
- package/logging/AbstractLogger.js.map +1 -0
- package/logging/ConsoleLogger.d.ts +4 -0
- package/logging/ConsoleLogger.js +31 -0
- package/logging/ConsoleLogger.js.map +1 -0
- package/logging/ILogLevel.d.ts +4 -0
- package/logging/ILogLevel.js +4 -0
- package/logging/ILogLevel.js.map +1 -0
- package/logging/ILoggerApi.d.ts +12 -0
- package/logging/ILoggerApi.js +4 -0
- package/logging/ILoggerApi.js.map +1 -0
- package/logging/ILoggerOptions.d.ts +7 -0
- package/logging/ILoggerOptions.js +4 -0
- package/logging/ILoggerOptions.js.map +1 -0
- package/logging/Logger.d.ts +23 -0
- package/logging/Logger.js +66 -0
- package/logging/Logger.js.map +1 -0
- package/package.json +63 -0
- package/shared.d.ts +20 -0
- package/shared.js +47 -0
- package/shared.js.map +1 -0
- package/utils/ClassLoader.d.ts +28 -0
- package/utils/ClassLoader.js +183 -0
- package/utils/ClassLoader.js.map +1 -0
- package/utils/ClassUtils.d.ts +5 -0
- package/utils/ClassUtils.js +50 -0
- package/utils/ClassUtils.js.map +1 -0
- package/utils/CryptUtils.d.ts +10 -0
- package/utils/CryptUtils.js +64 -0
- package/utils/CryptUtils.js.map +1 -0
- package/utils/FileUtils.d.ts +14 -0
- package/utils/FileUtils.js +99 -0
- package/utils/FileUtils.js.map +1 -0
- package/utils/JsonUtils.d.ts +5 -0
- package/utils/JsonUtils.js +35 -0
- package/utils/JsonUtils.js.map +1 -0
- package/utils/PlatformUtils.d.ts +97 -0
- package/utils/PlatformUtils.js +288 -0
- package/utils/PlatformUtils.js.map +1 -0
- package/utils/PlatformUtilsBrowser.d.ts +86 -0
- package/utils/PlatformUtilsBrowser.js +177 -0
- package/utils/PlatformUtilsBrowser.js.map +1 -0
- package/utils/Serializer.d.ts +9 -0
- package/utils/Serializer.js +84 -0
- package/utils/Serializer.js.map +1 -0
- package/utils/TreeUtils.d.ts +12 -0
- package/utils/TreeUtils.js +110 -0
- package/utils/TreeUtils.js.map +1 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ILoggerApi } from './ILoggerApi';
|
|
2
|
+
import { ILogLevel } from './ILogLevel';
|
|
3
|
+
import { ILoggerOptions } from './ILoggerOptions';
|
|
4
|
+
export declare abstract class AbstractLogger implements ILoggerApi {
|
|
5
|
+
private levelInc;
|
|
6
|
+
protected levels: ILogLevel[];
|
|
7
|
+
protected logLevel: number;
|
|
8
|
+
protected _enable: boolean;
|
|
9
|
+
protected options: ILoggerOptions;
|
|
10
|
+
constructor(opts: ILoggerOptions);
|
|
11
|
+
isEnabled(set?: boolean): boolean;
|
|
12
|
+
disable(): void;
|
|
13
|
+
enable(): void;
|
|
14
|
+
findLevel(m: string | number): ILogLevel;
|
|
15
|
+
addLevel(name: string): void;
|
|
16
|
+
getLevel(): ILogLevel;
|
|
17
|
+
setLevel(level: number | string): void;
|
|
18
|
+
debug(...msg: any[]): void;
|
|
19
|
+
error(...msg: any[]): void;
|
|
20
|
+
info(...msg: any[]): void;
|
|
21
|
+
abstract log(level: number | string, ...msg: any[]): void;
|
|
22
|
+
trace(...msg: any[]): void;
|
|
23
|
+
warn(...msg: any[]): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractLogger = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const Constants_1 = require("../Constants");
|
|
6
|
+
class AbstractLogger {
|
|
7
|
+
constructor(opts) {
|
|
8
|
+
this.levelInc = 0;
|
|
9
|
+
this.levels = [];
|
|
10
|
+
this.logLevel = 0;
|
|
11
|
+
this._enable = true;
|
|
12
|
+
this.options = opts;
|
|
13
|
+
this.addLevel(Constants_1.C_ERROR);
|
|
14
|
+
this.addLevel(Constants_1.C_WARN);
|
|
15
|
+
this.addLevel(Constants_1.C_INFO);
|
|
16
|
+
this.addLevel(Constants_1.C_DEBUG);
|
|
17
|
+
this.addLevel(Constants_1.C_TRACE);
|
|
18
|
+
if (opts.level) {
|
|
19
|
+
this.logLevel = this.findLevel(opts.level).nr;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
this.logLevel = this.findLevel(Constants_1.C_INFO).nr;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
isEnabled(set = null) {
|
|
26
|
+
if (!lodash_1.isNull(set)) {
|
|
27
|
+
this._enable = set;
|
|
28
|
+
}
|
|
29
|
+
return this._enable;
|
|
30
|
+
}
|
|
31
|
+
disable() {
|
|
32
|
+
this._enable = false;
|
|
33
|
+
}
|
|
34
|
+
enable() {
|
|
35
|
+
this._enable = true;
|
|
36
|
+
}
|
|
37
|
+
findLevel(m) {
|
|
38
|
+
return this.levels.find(x => lodash_1.isNumber(m) ? x.nr === m : x.name.toLowerCase() === m.toLowerCase());
|
|
39
|
+
}
|
|
40
|
+
addLevel(name) {
|
|
41
|
+
this.levels.push({ nr: this.levelInc++, name: name.toLowerCase() });
|
|
42
|
+
}
|
|
43
|
+
getLevel() {
|
|
44
|
+
return lodash_1.find(this.levels, l => l.nr === this.logLevel);
|
|
45
|
+
}
|
|
46
|
+
setLevel(level) {
|
|
47
|
+
const l = this.findLevel(level);
|
|
48
|
+
if (l) {
|
|
49
|
+
this.logLevel = l.nr;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
throw new Error('can\'t find given log level entry ' + level);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
debug(...msg) {
|
|
56
|
+
this.log(Constants_1.C_DEBUG, ...msg);
|
|
57
|
+
}
|
|
58
|
+
error(...msg) {
|
|
59
|
+
this.log(Constants_1.C_ERROR, ...msg);
|
|
60
|
+
}
|
|
61
|
+
info(...msg) {
|
|
62
|
+
this.log(Constants_1.C_INFO, ...msg);
|
|
63
|
+
}
|
|
64
|
+
trace(...msg) {
|
|
65
|
+
this.log(Constants_1.C_TRACE, ...msg);
|
|
66
|
+
}
|
|
67
|
+
warn(...msg) {
|
|
68
|
+
this.log(Constants_1.C_WARN, ...msg);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.AbstractLogger = AbstractLogger;
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=AbstractLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/logging/AbstractLogger.ts"],"names":[],"mappings":";;;AAAA,mCAA8C;AAG9C,4CAAu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FC","file":"AbstractLogger.js","sourcesContent":["import {isNull, isNumber, find} from 'lodash';\nimport {ILoggerApi} from './ILoggerApi';\nimport {ILogLevel} from './ILogLevel';\nimport {C_DEBUG, C_ERROR, C_INFO, C_TRACE, C_WARN} from '../Constants';\nimport {ILoggerOptions} from './ILoggerOptions';\n\n\nexport abstract class AbstractLogger implements ILoggerApi {\n\n private levelInc = 0;\n\n protected levels: ILogLevel[] = [];\n\n protected logLevel: number = 0;\n\n protected _enable: boolean = true;\n\n protected options: ILoggerOptions;\n\n\n constructor(opts: ILoggerOptions) {\n this.options = opts;\n this.addLevel(C_ERROR);\n this.addLevel(C_WARN);\n this.addLevel(C_INFO);\n this.addLevel(C_DEBUG);\n this.addLevel(C_TRACE);\n\n\n if (opts.level) {\n this.logLevel = this.findLevel(opts.level).nr;\n } else {\n this.logLevel = this.findLevel(C_INFO).nr;\n }\n\n }\n\n isEnabled(set: boolean = null): boolean {\n if (!isNull(set)) {\n this._enable = set;\n }\n return this._enable;\n }\n\n disable() {\n this._enable = false;\n }\n\n enable() {\n this._enable = true;\n }\n\n findLevel(m: string | number) {\n return this.levels.find(x => isNumber(m) ? x.nr === m : x.name.toLowerCase() === m.toLowerCase());\n }\n\n addLevel(name: string) {\n this.levels.push({nr: this.levelInc++, name: name.toLowerCase()});\n }\n\n\n getLevel(): ILogLevel {\n return find(this.levels, l => l.nr === this.logLevel);\n }\n\n setLevel(level: number | string): void {\n const l = this.findLevel(level);\n if (l) {\n this.logLevel = l.nr;\n } else {\n throw new Error('can\\'t find given log level entry ' + level);\n }\n }\n\n debug(...msg: any[]): void {\n this.log(C_DEBUG, ...msg);\n }\n\n\n error(...msg: any[]): void {\n this.log(C_ERROR, ...msg);\n }\n\n\n info(...msg: any[]): void {\n this.log(C_INFO, ...msg);\n }\n\n\n abstract log(level: number | string, ...msg: any[]): void ;\n\n\n trace(...msg: any[]): void {\n this.log(C_TRACE, ...msg);\n }\n\n\n warn(...msg: any[]): void {\n this.log(C_WARN, ...msg);\n }\n\n\n}\n"],"sourceRoot":".."}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConsoleLogger = void 0;
|
|
4
|
+
const AbstractLogger_1 = require("./AbstractLogger");
|
|
5
|
+
const Constants_1 = require("../Constants");
|
|
6
|
+
class ConsoleLogger extends AbstractLogger_1.AbstractLogger {
|
|
7
|
+
log(level, ...msg) {
|
|
8
|
+
if (!this._enable) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const l = this.findLevel(level);
|
|
12
|
+
const ll = this.getLevel();
|
|
13
|
+
if (l && l.nr <= ll.nr) {
|
|
14
|
+
if (l.name === Constants_1.C_ERROR) {
|
|
15
|
+
console.error(...msg);
|
|
16
|
+
}
|
|
17
|
+
else if (l.name === Constants_1.C_WARN) {
|
|
18
|
+
console.warn(...msg);
|
|
19
|
+
}
|
|
20
|
+
else if (l.name === Constants_1.C_TRACE) {
|
|
21
|
+
console.log(...msg);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
console.log(...msg);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ConsoleLogger = ConsoleLogger;
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=ConsoleLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/logging/ConsoleLogger.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAChD,4CAAsD;AAGtD,MAAa,aAAc,SAAQ,+BAAc;IAE/C,GAAG,CAAC,KAAsB,EAAE,GAAG,GAAU;QACvC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;SACR;QACD,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAChC,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE3B,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE;YACtB,IAAI,CAAC,CAAC,IAAI,KAAK,mBAAO,EAAE;gBACtB,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;aACvB;iBAAM,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAM,EAAE;gBAC5B,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;aACtB;iBAAM,IAAI,CAAC,CAAC,IAAI,KAAK,mBAAO,EAAE;gBAC7B,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;aACrB;iBAAM;gBACL,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;aACrB;SACF;IACH,CAAC;CAEF;AAtBD,sCAsBC","file":"ConsoleLogger.js","sourcesContent":["import {AbstractLogger} from './AbstractLogger';\nimport {C_ERROR, C_TRACE, C_WARN} from '../Constants';\n\n\nexport class ConsoleLogger extends AbstractLogger {\n\n log(level: number | string, ...msg: any[]): void {\n if (!this._enable) {\n return;\n }\n const l = this.findLevel(level);\n const ll = this.getLevel();\n\n if (l && l.nr <= ll.nr) {\n if (l.name === C_ERROR) {\n console.error(...msg);\n } else if (l.name === C_WARN) {\n console.warn(...msg);\n } else if (l.name === C_TRACE) {\n console.log(...msg);\n } else {\n console.log(...msg);\n }\n }\n }\n\n}\n"],"sourceRoot":".."}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/logging/ILogLevel.ts"],"names":[],"mappings":"","file":"ILogLevel.js","sourcesContent":["export interface ILogLevel {\n nr: number;\n name: string;\n\n\n}\n"],"sourceRoot":".."}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ILogLevel } from './ILogLevel';
|
|
2
|
+
export interface ILoggerApi {
|
|
3
|
+
isEnabled(set?: boolean): boolean;
|
|
4
|
+
log(level: number | string, ...msg: any[]): void;
|
|
5
|
+
info(...msg: any[]): void;
|
|
6
|
+
warn(...msg: any[]): void;
|
|
7
|
+
error(...msg: any[]): void;
|
|
8
|
+
debug(...msg: any[]): void;
|
|
9
|
+
trace(...msg: any[]): void;
|
|
10
|
+
getLevel(): ILogLevel;
|
|
11
|
+
setLevel(level: number | string): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/logging/ILoggerApi.ts"],"names":[],"mappings":"","file":"ILoggerApi.js","sourcesContent":["import {ILogLevel} from './ILogLevel';\n\nexport interface ILoggerApi {\n\n isEnabled(set?: boolean): boolean;\n\n log(level: number | string, ...msg: any[]): void;\n\n info(...msg: any[]): void;\n\n warn(...msg: any[]): void;\n\n error(...msg: any[]): void;\n\n debug(...msg: any[]): void;\n\n trace(...msg: any[]): void;\n\n getLevel(): ILogLevel;\n\n setLevel(level: number | string): void;\n\n}\n"],"sourceRoot":".."}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/logging/ILoggerOptions.ts"],"names":[],"mappings":"","file":"ILoggerOptions.js","sourcesContent":["export interface ILoggerOptions {\n context: string;\n type: string;\n override?: boolean;\n level?: number;\n\n [k: string]: any;\n}\n"],"sourceRoot":".."}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ILoggerApi } from './ILoggerApi';
|
|
2
|
+
import { ILoggerOptions } from './ILoggerOptions';
|
|
3
|
+
export declare class Logger {
|
|
4
|
+
private constructor();
|
|
5
|
+
private static _self;
|
|
6
|
+
private loggerTypes;
|
|
7
|
+
private instances;
|
|
8
|
+
static $(): Logger;
|
|
9
|
+
static addType(type: string, cls: Function): void;
|
|
10
|
+
static getLogger(opts?: ILoggerOptions): ILoggerApi;
|
|
11
|
+
static log(level?: number | string, ...msg: any[]): void;
|
|
12
|
+
static error(...msg: any[]): void;
|
|
13
|
+
static warn(...msg: any[]): void;
|
|
14
|
+
static info(...msg: any[]): void;
|
|
15
|
+
static debug(...msg: any[]): void;
|
|
16
|
+
static trace(...msg: any[]): void;
|
|
17
|
+
getInstances(): {
|
|
18
|
+
[key: string]: ILoggerApi;
|
|
19
|
+
};
|
|
20
|
+
getTypes(): {
|
|
21
|
+
[k: string]: Function;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logger = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const ConsoleLogger_1 = require("./ConsoleLogger");
|
|
6
|
+
const Constants_1 = require("../Constants");
|
|
7
|
+
const DEFAULT = {
|
|
8
|
+
context: Constants_1.C_DEFAULT,
|
|
9
|
+
type: Constants_1.C_CONSOLE
|
|
10
|
+
};
|
|
11
|
+
class Logger {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.loggerTypes = {
|
|
14
|
+
console: ConsoleLogger_1.ConsoleLogger
|
|
15
|
+
};
|
|
16
|
+
this.instances = {};
|
|
17
|
+
}
|
|
18
|
+
static $() {
|
|
19
|
+
if (!this._self) {
|
|
20
|
+
this._self = new Logger();
|
|
21
|
+
}
|
|
22
|
+
return this._self;
|
|
23
|
+
}
|
|
24
|
+
static addType(type, cls) {
|
|
25
|
+
this.$().loggerTypes[type] = cls;
|
|
26
|
+
}
|
|
27
|
+
static getLogger(opts = DEFAULT) {
|
|
28
|
+
if (!this.$().instances[opts.context] || lodash_1.get(opts, 'override', false)) {
|
|
29
|
+
const type = this.$().loggerTypes[opts.type];
|
|
30
|
+
if (type) {
|
|
31
|
+
this.$().instances[opts.context] = Reflect.construct(type, [opts]);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.$().instances[opts.context] = Reflect.construct(ConsoleLogger_1.ConsoleLogger, [opts]);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return this.$().instances[opts.context];
|
|
38
|
+
}
|
|
39
|
+
static log(level = Constants_1.C_INFO, ...msg) {
|
|
40
|
+
this.getLogger().log(level, ...msg);
|
|
41
|
+
}
|
|
42
|
+
static error(...msg) {
|
|
43
|
+
this.log(Constants_1.C_ERROR, ...msg);
|
|
44
|
+
}
|
|
45
|
+
static warn(...msg) {
|
|
46
|
+
this.log(Constants_1.C_WARN, ...msg);
|
|
47
|
+
}
|
|
48
|
+
static info(...msg) {
|
|
49
|
+
this.log(Constants_1.C_INFO, ...msg);
|
|
50
|
+
}
|
|
51
|
+
static debug(...msg) {
|
|
52
|
+
this.log(Constants_1.C_DEBUG, ...msg);
|
|
53
|
+
}
|
|
54
|
+
static trace(...msg) {
|
|
55
|
+
this.log(Constants_1.C_TRACE, ...msg);
|
|
56
|
+
}
|
|
57
|
+
getInstances() {
|
|
58
|
+
return this.instances;
|
|
59
|
+
}
|
|
60
|
+
getTypes() {
|
|
61
|
+
return this.loggerTypes;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.Logger = Logger;
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=Logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/logging/Logger.ts"],"names":[],"mappings":";;;AAAA,mCAA2B;AAE3B,mDAA8C;AAC9C,4CAA6F;AAI7F,MAAM,OAAO,GAAmB;IAC9B,OAAO,EAAE,qBAAS;IAClB,IAAI,EAAE,qBAAS;CAEhB,CAAC;AAEF,MAAa,MAAM;IAEjB;QAMQ,gBAAW,GAA8B;YAC/C,OAAO,EAAE,6BAAa;SACvB,CAAC;QAEM,cAAS,GAAkC,EAAE,CAAC;IARtD,CAAC;IAUD,MAAM,CAAC,CAAC;QACN,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACf,IAAI,CAAC,KAAK,GAAG,IAAI,MAAM,EAAE,CAAC;SAC3B;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,IAAY,EAAE,GAAa;QACxC,IAAI,CAA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,GAAU;QACvB,IAAI,CAAC,GAAG,CAAC,kBAAM,EAAE,GAAG,GAAG,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,GAAU;QACxB,IAAI,CAAC,GAAG,CAAC,mBAAO,EAAE,GAAG,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,GAAU;QACxB,IAAI,CAAC,GAAG,CAAC,mBAAO,EAAE,GAAG,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CAEF;AAvED,wBAuEC","file":"Logger.js","sourcesContent":["import {get} from 'lodash';\nimport {ILoggerApi} from './ILoggerApi';\nimport {ConsoleLogger} from './ConsoleLogger';\nimport {C_CONSOLE, C_DEBUG, C_DEFAULT, C_ERROR, C_INFO, C_TRACE, C_WARN} from '../Constants';\nimport {ILoggerOptions} from './ILoggerOptions';\n\n\nconst DEFAULT: ILoggerOptions = {\n context: C_DEFAULT,\n type: C_CONSOLE\n\n};\n\nexport class Logger {\n\n private constructor() {\n\n }\n\n private static _self: Logger;\n\n private loggerTypes: { [k: string]: Function } = {\n console: ConsoleLogger\n };\n\n private instances: { [key: string]: ILoggerApi } = {};\n\n static $() {\n if (!this._self) {\n this._self = new Logger();\n }\n return this._self;\n }\n\n static addType(type: string, cls: Function) {\n this.$().loggerTypes[type] = cls;\n }\n\n static getLogger(opts: ILoggerOptions = DEFAULT) {\n if (!this.$().instances[opts.context] || get(opts, 'override', false)) {\n const type = this.$().loggerTypes[opts.type];\n if (type) {\n this.$().instances[opts.context] = Reflect.construct(type, [opts]);\n } else {\n this.$().instances[opts.context] = Reflect.construct(ConsoleLogger, [opts]);\n }\n\n }\n return this.$().instances[opts.context];\n }\n\n\n static log(level: number | string = C_INFO, ...msg: any[]) {\n this.getLogger().log(level, ...msg);\n }\n\n static error(...msg: any[]) {\n this.log(C_ERROR, ...msg);\n }\n\n static warn(...msg: any[]) {\n this.log(C_WARN, ...msg);\n }\n\n static info(...msg: any[]) {\n this.log(C_INFO, ...msg);\n }\n\n static debug(...msg: any[]) {\n this.log(C_DEBUG, ...msg);\n }\n\n static trace(...msg: any[]) {\n this.log(C_TRACE, ...msg);\n }\n\n getInstances() {\n return this.instances;\n }\n\n getTypes() {\n return this.loggerTypes;\n }\n\n}\n"],"sourceRoot":".."}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@allgemein/base",
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "Library for commons moduls.",
|
|
5
|
+
"main": "./index.js",
|
|
6
|
+
"private": false,
|
|
7
|
+
"browser": {
|
|
8
|
+
"./index.js": "./browser.js"
|
|
9
|
+
},
|
|
10
|
+
"directories": {
|
|
11
|
+
"doc": "docs/de"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "nyc mocha test/functional/*.spec.ts",
|
|
15
|
+
"posttest": "nyc report --reporter=json && codecov -f coverage/*.json"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/allgemein-node/base.git"
|
|
20
|
+
},
|
|
21
|
+
"author": "Robert Kania",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"keywords": [
|
|
24
|
+
"commons",
|
|
25
|
+
"typescript"
|
|
26
|
+
],
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/allgemein-node/base/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/allgemein-node/base#readme",
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@allgemein/packaging": "^1.1.1",
|
|
33
|
+
"@testdeck/mocha": "^0.1.2",
|
|
34
|
+
"@types/chai": "^4.2.18",
|
|
35
|
+
"@types/expect": "^24.3.0",
|
|
36
|
+
"@types/glob": "^7.1.3",
|
|
37
|
+
"@types/lodash": "^4.14.169",
|
|
38
|
+
"@types/mocha": "^8.2.2",
|
|
39
|
+
"@types/node": "^15.3.1",
|
|
40
|
+
"chai": "^4.3.4",
|
|
41
|
+
"codecov": "^3.8.2",
|
|
42
|
+
"codelyzer": "^6.0.2",
|
|
43
|
+
"del": "6.0.0",
|
|
44
|
+
"gulp": "4.0.2",
|
|
45
|
+
"gulp-bump": "^3.2.0",
|
|
46
|
+
"gulp-clean": "^0.4.0",
|
|
47
|
+
"gulp-replace": "^1.1.3",
|
|
48
|
+
"gulp-shell": "0.8.0",
|
|
49
|
+
"gulp-sourcemaps": "3.0.0",
|
|
50
|
+
"gulp-typescript": "5.0.1",
|
|
51
|
+
"merge-stream": "^2.0.0",
|
|
52
|
+
"mocha": "^8.4.0",
|
|
53
|
+
"nyc": "^15.1.0",
|
|
54
|
+
"reflect-metadata": "^0.1.13",
|
|
55
|
+
"std-mocks": "^1.0.1",
|
|
56
|
+
"ts-node": "^9.1.1",
|
|
57
|
+
"tslint": "^6.1.3",
|
|
58
|
+
"typescript": "4.2.4"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"lodash": "^4.17.21"
|
|
62
|
+
}
|
|
63
|
+
}
|
package/shared.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { C_DEFAULT, __SOURCE__, C_CONSOLE, C_DEBUG, C_ERROR, C_INFO, C_TRACE, C_WARN, ISO8601, StringOrFunction } from './Constants';
|
|
2
|
+
export { MetaArgs } from './MetaArgs';
|
|
3
|
+
export { MetadataStorage } from './MetadataStorage';
|
|
4
|
+
export { AbstractLogger } from './logging/AbstractLogger';
|
|
5
|
+
export { ConsoleLogger } from './logging/ConsoleLogger';
|
|
6
|
+
export { ILoggerApi } from './logging/ILoggerApi';
|
|
7
|
+
export { ILoggerOptions } from './logging/ILoggerOptions';
|
|
8
|
+
export { ILogLevel } from './logging/ILogLevel';
|
|
9
|
+
export { Logger } from './logging/Logger';
|
|
10
|
+
export { NestedException } from './exceptions/NestedException';
|
|
11
|
+
export { TodoException } from './exceptions/TodoException';
|
|
12
|
+
export { NotYetImplementedError } from './exceptions/NotYetImplementedError';
|
|
13
|
+
export { NotSupportedError } from './exceptions/NotSupportedError';
|
|
14
|
+
export { ClassUtils } from './utils/ClassUtils';
|
|
15
|
+
export { CryptUtils } from './utils/CryptUtils';
|
|
16
|
+
export { TreeUtils } from './utils/TreeUtils';
|
|
17
|
+
export { JsonUtils } from './utils/JsonUtils';
|
|
18
|
+
export { Serializer } from './utils/Serializer';
|
|
19
|
+
export { LockFactory } from './locking/LockFactory';
|
|
20
|
+
export { Semaphore } from './locking/Semaphore';
|
package/shared.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Semaphore = exports.LockFactory = exports.Serializer = exports.JsonUtils = exports.TreeUtils = exports.CryptUtils = exports.ClassUtils = exports.NotSupportedError = exports.NotYetImplementedError = exports.TodoException = exports.NestedException = exports.Logger = exports.ConsoleLogger = exports.AbstractLogger = exports.MetadataStorage = exports.MetaArgs = exports.ISO8601 = exports.C_WARN = exports.C_TRACE = exports.C_INFO = exports.C_ERROR = exports.C_DEBUG = exports.C_CONSOLE = exports.__SOURCE__ = exports.C_DEFAULT = void 0;
|
|
4
|
+
var Constants_1 = require("./Constants");
|
|
5
|
+
Object.defineProperty(exports, "C_DEFAULT", { enumerable: true, get: function () { return Constants_1.C_DEFAULT; } });
|
|
6
|
+
Object.defineProperty(exports, "__SOURCE__", { enumerable: true, get: function () { return Constants_1.__SOURCE__; } });
|
|
7
|
+
Object.defineProperty(exports, "C_CONSOLE", { enumerable: true, get: function () { return Constants_1.C_CONSOLE; } });
|
|
8
|
+
Object.defineProperty(exports, "C_DEBUG", { enumerable: true, get: function () { return Constants_1.C_DEBUG; } });
|
|
9
|
+
Object.defineProperty(exports, "C_ERROR", { enumerable: true, get: function () { return Constants_1.C_ERROR; } });
|
|
10
|
+
Object.defineProperty(exports, "C_INFO", { enumerable: true, get: function () { return Constants_1.C_INFO; } });
|
|
11
|
+
Object.defineProperty(exports, "C_TRACE", { enumerable: true, get: function () { return Constants_1.C_TRACE; } });
|
|
12
|
+
Object.defineProperty(exports, "C_WARN", { enumerable: true, get: function () { return Constants_1.C_WARN; } });
|
|
13
|
+
Object.defineProperty(exports, "ISO8601", { enumerable: true, get: function () { return Constants_1.ISO8601; } });
|
|
14
|
+
var MetaArgs_1 = require("./MetaArgs");
|
|
15
|
+
Object.defineProperty(exports, "MetaArgs", { enumerable: true, get: function () { return MetaArgs_1.MetaArgs; } });
|
|
16
|
+
var MetadataStorage_1 = require("./MetadataStorage");
|
|
17
|
+
Object.defineProperty(exports, "MetadataStorage", { enumerable: true, get: function () { return MetadataStorage_1.MetadataStorage; } });
|
|
18
|
+
var AbstractLogger_1 = require("./logging/AbstractLogger");
|
|
19
|
+
Object.defineProperty(exports, "AbstractLogger", { enumerable: true, get: function () { return AbstractLogger_1.AbstractLogger; } });
|
|
20
|
+
var ConsoleLogger_1 = require("./logging/ConsoleLogger");
|
|
21
|
+
Object.defineProperty(exports, "ConsoleLogger", { enumerable: true, get: function () { return ConsoleLogger_1.ConsoleLogger; } });
|
|
22
|
+
var Logger_1 = require("./logging/Logger");
|
|
23
|
+
Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return Logger_1.Logger; } });
|
|
24
|
+
var NestedException_1 = require("./exceptions/NestedException");
|
|
25
|
+
Object.defineProperty(exports, "NestedException", { enumerable: true, get: function () { return NestedException_1.NestedException; } });
|
|
26
|
+
var TodoException_1 = require("./exceptions/TodoException");
|
|
27
|
+
Object.defineProperty(exports, "TodoException", { enumerable: true, get: function () { return TodoException_1.TodoException; } });
|
|
28
|
+
var NotYetImplementedError_1 = require("./exceptions/NotYetImplementedError");
|
|
29
|
+
Object.defineProperty(exports, "NotYetImplementedError", { enumerable: true, get: function () { return NotYetImplementedError_1.NotYetImplementedError; } });
|
|
30
|
+
var NotSupportedError_1 = require("./exceptions/NotSupportedError");
|
|
31
|
+
Object.defineProperty(exports, "NotSupportedError", { enumerable: true, get: function () { return NotSupportedError_1.NotSupportedError; } });
|
|
32
|
+
var ClassUtils_1 = require("./utils/ClassUtils");
|
|
33
|
+
Object.defineProperty(exports, "ClassUtils", { enumerable: true, get: function () { return ClassUtils_1.ClassUtils; } });
|
|
34
|
+
var CryptUtils_1 = require("./utils/CryptUtils");
|
|
35
|
+
Object.defineProperty(exports, "CryptUtils", { enumerable: true, get: function () { return CryptUtils_1.CryptUtils; } });
|
|
36
|
+
var TreeUtils_1 = require("./utils/TreeUtils");
|
|
37
|
+
Object.defineProperty(exports, "TreeUtils", { enumerable: true, get: function () { return TreeUtils_1.TreeUtils; } });
|
|
38
|
+
var JsonUtils_1 = require("./utils/JsonUtils");
|
|
39
|
+
Object.defineProperty(exports, "JsonUtils", { enumerable: true, get: function () { return JsonUtils_1.JsonUtils; } });
|
|
40
|
+
var Serializer_1 = require("./utils/Serializer");
|
|
41
|
+
Object.defineProperty(exports, "Serializer", { enumerable: true, get: function () { return Serializer_1.Serializer; } });
|
|
42
|
+
var LockFactory_1 = require("./locking/LockFactory");
|
|
43
|
+
Object.defineProperty(exports, "LockFactory", { enumerable: true, get: function () { return LockFactory_1.LockFactory; } });
|
|
44
|
+
var Semaphore_1 = require("./locking/Semaphore");
|
|
45
|
+
Object.defineProperty(exports, "Semaphore", { enumerable: true, get: function () { return Semaphore_1.Semaphore; } });
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=shared.js.map
|
package/shared.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/shared.ts"],"names":[],"mappings":";;;AAAA,yCAEqB;AADnB,sGAAA,SAAS,OAAA;AAAE,uGAAA,UAAU,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,oGAAA,OAAO,OAAA;AAAE,oGAAA,OAAO,OAAA;AAAE,mGAAA,MAAM,OAAA;AAAE,oGAAA,OAAO,OAAA;AAAE,mGAAA,MAAM,OAAA;AAAE,oGAAA,OAAO,OAAA;AAEtF,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,qDAAkD;AAA1C,kHAAA,eAAe,OAAA;AAEvB,2DAAwD;AAAhD,gHAAA,cAAc,OAAA;AACtB,yDAAsD;AAA9C,8GAAA,aAAa,OAAA;AAIrB,2CAAwC;AAAhC,gGAAA,MAAM,OAAA;AAEd,gEAA6D;AAArD,kHAAA,eAAe,OAAA;AACvB,4DAAyD;AAAjD,8GAAA,aAAa,OAAA;AACrB,8EAA2E;AAAnE,gIAAA,sBAAsB,OAAA;AAC9B,oEAAiE;AAAzD,sHAAA,iBAAiB,OAAA;AAEzB,iDAA8C;AAAtC,wGAAA,UAAU,OAAA;AAClB,iDAA8C;AAAtC,wGAAA,UAAU,OAAA;AAClB,+CAA4C;AAApC,sGAAA,SAAS,OAAA;AACjB,+CAA4C;AAApC,sGAAA,SAAS,OAAA;AACjB,iDAA8C;AAAtC,wGAAA,UAAU,OAAA;AAElB,qDAAkD;AAA1C,0GAAA,WAAW,OAAA;AACnB,iDAA8C;AAAtC,sGAAA,SAAS,OAAA","file":"shared.js","sourcesContent":["export {\n C_DEFAULT, __SOURCE__, C_CONSOLE, C_DEBUG, C_ERROR, C_INFO, C_TRACE, C_WARN, ISO8601, StringOrFunction\n} from './Constants';\nexport {MetaArgs} from './MetaArgs';\nexport {MetadataStorage} from './MetadataStorage';\n\nexport {AbstractLogger} from './logging/AbstractLogger';\nexport {ConsoleLogger} from './logging/ConsoleLogger';\nexport {ILoggerApi} from './logging/ILoggerApi';\nexport {ILoggerOptions} from './logging/ILoggerOptions';\nexport {ILogLevel} from './logging/ILogLevel';\nexport {Logger} from './logging/Logger';\n\nexport {NestedException} from './exceptions/NestedException';\nexport {TodoException} from './exceptions/TodoException';\nexport {NotYetImplementedError} from './exceptions/NotYetImplementedError';\nexport {NotSupportedError} from './exceptions/NotSupportedError';\n\nexport {ClassUtils} from './utils/ClassUtils';\nexport {CryptUtils} from './utils/CryptUtils';\nexport {TreeUtils} from './utils/TreeUtils';\nexport {JsonUtils} from './utils/JsonUtils';\nexport {Serializer} from './utils/Serializer';\n\nexport {LockFactory} from './locking/LockFactory';\nexport {Semaphore} from './locking/Semaphore';\n\n"],"sourceRoot":"."}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @see https://github.com/typeorm/typeorm/blob/master/src/util/DirectoryExportedClassesLoader.ts
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
import { StringOrFunction } from '../Constants';
|
|
7
|
+
/**
|
|
8
|
+
* Loads all exported classes from the given directory.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ClassLoader {
|
|
11
|
+
static importClassesFromAny(o: StringOrFunction[]): Function[];
|
|
12
|
+
static importClassesFromAnyAsync(o: StringOrFunction[]): Promise<Function[]>;
|
|
13
|
+
static importClassesFromDirectories(directories: string[], formats?: string[]): Function[];
|
|
14
|
+
static importClassesFromDirectoriesAsync(directories: string[], formats?: string[]): Promise<Function[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Loads all json files from the given directory.
|
|
17
|
+
*/
|
|
18
|
+
static importJsonsFromDirectories(directories: string[], format?: string): any[];
|
|
19
|
+
/**
|
|
20
|
+
* Loads all json files from the given directory.
|
|
21
|
+
*/
|
|
22
|
+
static importJsonsFromDirectoriesAsync(directories: string[], format?: string): Promise<any[]>;
|
|
23
|
+
static getSource(cls: Function): string;
|
|
24
|
+
static getClassName(klass: string | Function): string;
|
|
25
|
+
static getFunction(klass: string | Function): Function;
|
|
26
|
+
private static filterClasses;
|
|
27
|
+
private static loadFileClasses;
|
|
28
|
+
}
|