@punks/backend-core 0.0.55 → 0.0.57
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/cjs/index.js +36 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/abstractions/logging.d.ts +7 -7
- package/dist/cjs/types/logging/utils.d.ts +2 -0
- package/dist/cjs/types/utils/array.d.ts +1 -0
- package/dist/esm/index.js +36 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/abstractions/logging.d.ts +7 -7
- package/dist/esm/types/logging/utils.d.ts +2 -0
- package/dist/esm/types/utils/array.d.ts +1 -0
- package/dist/index.d.ts +9 -8
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -33,16 +33,16 @@ var winston__namespace = /*#__PURE__*/_interopNamespace(winston);
|
|
|
33
33
|
|
|
34
34
|
exports.LogLevel = void 0;
|
|
35
35
|
(function (LogLevel) {
|
|
36
|
-
LogLevel[
|
|
37
|
-
LogLevel[
|
|
38
|
-
LogLevel[
|
|
39
|
-
LogLevel[
|
|
40
|
-
LogLevel[
|
|
36
|
+
LogLevel["Debug"] = "debug";
|
|
37
|
+
LogLevel["Info"] = "info";
|
|
38
|
+
LogLevel["Warn"] = "warn";
|
|
39
|
+
LogLevel["Error"] = "error";
|
|
40
|
+
LogLevel["Fatal"] = "fatal";
|
|
41
41
|
})(exports.LogLevel || (exports.LogLevel = {}));
|
|
42
42
|
exports.MetaSerializationType = void 0;
|
|
43
43
|
(function (MetaSerializationType) {
|
|
44
|
-
MetaSerializationType[
|
|
45
|
-
MetaSerializationType[
|
|
44
|
+
MetaSerializationType["None"] = "none";
|
|
45
|
+
MetaSerializationType["JSON"] = "json";
|
|
46
46
|
})(exports.MetaSerializationType || (exports.MetaSerializationType = {}));
|
|
47
47
|
|
|
48
48
|
const range = (start, end) => {
|
|
@@ -63,6 +63,17 @@ const toItemsDict = (array, keySelector, elementSelector) => {
|
|
|
63
63
|
}
|
|
64
64
|
return data;
|
|
65
65
|
};
|
|
66
|
+
const toArrayDict = (array, keySelector) => {
|
|
67
|
+
const data = {};
|
|
68
|
+
for (const item of array) {
|
|
69
|
+
const key = keySelector(item);
|
|
70
|
+
if (!data[key]) {
|
|
71
|
+
data[key] = [];
|
|
72
|
+
}
|
|
73
|
+
data[key].push(item);
|
|
74
|
+
}
|
|
75
|
+
return data;
|
|
76
|
+
};
|
|
66
77
|
const toMap = (array, key) => {
|
|
67
78
|
const map = new Map();
|
|
68
79
|
array.forEach((x) => map.set(key(x), x));
|
|
@@ -28435,6 +28446,21 @@ const excelParse = (file, options) => {
|
|
|
28435
28446
|
.map((x) => aggregateRow(header, x, options));
|
|
28436
28447
|
};
|
|
28437
28448
|
|
|
28449
|
+
const getLevelValue = (level) => {
|
|
28450
|
+
switch (level) {
|
|
28451
|
+
case exports.LogLevel.Debug:
|
|
28452
|
+
return 0;
|
|
28453
|
+
case exports.LogLevel.Info:
|
|
28454
|
+
return 1;
|
|
28455
|
+
case exports.LogLevel.Warn:
|
|
28456
|
+
return 2;
|
|
28457
|
+
case exports.LogLevel.Error:
|
|
28458
|
+
return 3;
|
|
28459
|
+
case exports.LogLevel.Fatal:
|
|
28460
|
+
return 4;
|
|
28461
|
+
}
|
|
28462
|
+
};
|
|
28463
|
+
|
|
28438
28464
|
class InternalLogger {
|
|
28439
28465
|
constructor(loggerName, container) {
|
|
28440
28466
|
this.loggerName = loggerName;
|
|
@@ -28459,7 +28485,8 @@ class InternalLogger {
|
|
|
28459
28485
|
this.getEnabledInstances(exports.LogLevel.Error).forEach((x) => x.provider.exception(this.loggerName, message, error, this.serializeMeta(x.options, meta)));
|
|
28460
28486
|
}
|
|
28461
28487
|
getEnabledInstances(level) {
|
|
28462
|
-
return this.container.instances.filter((x) => x.options.enabled &&
|
|
28488
|
+
return this.container.instances.filter((x) => x.options.enabled &&
|
|
28489
|
+
getLevelValue(x.options.level) <= getLevelValue(level));
|
|
28463
28490
|
}
|
|
28464
28491
|
serializeMeta(options, meta) {
|
|
28465
28492
|
if (meta && typeof meta === "string") {
|
|
@@ -28680,6 +28707,7 @@ exports.sort = sort;
|
|
|
28680
28707
|
exports.splitPath = splitPath;
|
|
28681
28708
|
exports.subArrays = subArrays;
|
|
28682
28709
|
exports.subtractTime = subtractTime;
|
|
28710
|
+
exports.toArrayDict = toArrayDict;
|
|
28683
28711
|
exports.toCamelCase = toCamelCase;
|
|
28684
28712
|
exports.toDict = toDict;
|
|
28685
28713
|
exports.toItemsDict = toItemsDict;
|