@adviser/cement 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +201 -0
- package/README.md +39 -0
- package/adviser-cement-0.0.1.tgz +0 -0
- package/file_service.d.ts +17 -0
- package/file_service.d.ts.map +1 -0
- package/file_service.js +3 -0
- package/file_service.js.map +1 -0
- package/index.d.ts +10 -0
- package/index.d.ts.map +1 -0
- package/index.js +26 -0
- package/index.js.map +1 -0
- package/logger.d.ts +31 -0
- package/logger.d.ts.map +1 -0
- package/logger.js +11 -0
- package/logger.js.map +1 -0
- package/logger.test.d.ts +2 -0
- package/logger.test.d.ts.map +1 -0
- package/logger.test.js +228 -0
- package/logger.test.js.map +1 -0
- package/logger_impl.d.ts +46 -0
- package/logger_impl.d.ts.map +1 -0
- package/logger_impl.js +260 -0
- package/logger_impl.js.map +1 -0
- package/mock_file_service.d.ts +20 -0
- package/mock_file_service.d.ts.map +1 -0
- package/mock_file_service.js +80 -0
- package/mock_file_service.js.map +1 -0
- package/node_file_service.d.ts +15 -0
- package/node_file_service.d.ts.map +1 -0
- package/node_file_service.js +78 -0
- package/node_file_service.js.map +1 -0
- package/node_sys_abstraction.d.ts +91 -0
- package/node_sys_abstraction.d.ts.map +1 -0
- package/node_sys_abstraction.js +265 -0
- package/node_sys_abstraction.js.map +1 -0
- package/node_sys_abstraction.test.d.ts +2 -0
- package/node_sys_abstraction.test.d.ts.map +1 -0
- package/node_sys_abstraction.test.js +123 -0
- package/node_sys_abstraction.test.js.map +1 -0
- package/package.json +40 -0
- package/sys_abstraction.d.ts +35 -0
- package/sys_abstraction.d.ts.map +1 -0
- package/sys_abstraction.js +35 -0
- package/sys_abstraction.js.map +1 -0
- package/test/log_collector.d.ts +22 -0
- package/test/log_collector.d.ts.map +1 -0
- package/test/log_collector.js +65 -0
- package/test/log_collector.js.map +1 -0
- package/test/mock_logger.d.ts +13 -0
- package/test/mock_logger.d.ts.map +1 -0
- package/test/mock_logger.js +23 -0
- package/test/mock_logger.js.map +1 -0
- package/test/mock_logger.test.d.ts +2 -0
- package/test/mock_logger.test.d.ts.map +1 -0
- package/test/mock_logger.test.js +49 -0
- package/test/mock_logger.test.js.map +1 -0
- package/test/test-exit-handler.d.ts +1 -0
- package/test/test-exit-handler.d.ts.map +1 -0
- package/test/test-exit-handler.js +76 -0
- package/test/test-exit-handler.js.map +1 -0
- package/time.d.ts +13 -0
- package/time.d.ts.map +1 -0
- package/time.js +18 -0
- package/time.js.map +1 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.MockLogger = void 0;
|
4
|
+
const logger_impl_1 = require("../logger_impl");
|
5
|
+
const log_collector_1 = require("./log_collector");
|
6
|
+
function MockLogger(params) {
|
7
|
+
const lc = new log_collector_1.LogCollector();
|
8
|
+
let modNames = ["MockLogger"];
|
9
|
+
if (typeof (params === null || params === void 0 ? void 0 : params.moduleName) === "string") {
|
10
|
+
modNames = [params === null || params === void 0 ? void 0 : params.moduleName];
|
11
|
+
}
|
12
|
+
else if (Array.isArray(params === null || params === void 0 ? void 0 : params.moduleName)) {
|
13
|
+
modNames = [...params.moduleName, ...modNames];
|
14
|
+
}
|
15
|
+
const logger = new logger_impl_1.LoggerImpl({ out: lc, sys: params === null || params === void 0 ? void 0 : params.sys }).With().Module(modNames[0]).Logger();
|
16
|
+
!(params === null || params === void 0 ? void 0 : params.disableDebug) && logger.SetDebug(...modNames);
|
17
|
+
return {
|
18
|
+
logCollector: lc,
|
19
|
+
logger,
|
20
|
+
};
|
21
|
+
}
|
22
|
+
exports.MockLogger = MockLogger;
|
23
|
+
//# sourceMappingURL=mock_logger.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mock_logger.js","sourceRoot":"","sources":["../../src/test/mock_logger.ts"],"names":[],"mappings":";;;AACA,gDAA4C;AAE5C,mDAA+C;AAO/C,SAAgB,UAAU,CAAC,MAI1B;IACC,MAAM,EAAE,GAAG,IAAI,4BAAY,EAAE,CAAC;IAC9B,IAAI,QAAQ,GAAG,CAAC,YAAY,CAAC,CAAC;IAC9B,IAAI,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAA,KAAK,QAAQ,EAAE,CAAC;QAC3C,QAAQ,GAAG,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAC,CAAC;IAClC,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAC,EAAE,CAAC;QAC7C,QAAQ,GAAG,CAAC,GAAG,MAAO,CAAC,UAAU,EAAE,GAAG,QAAQ,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,wBAAU,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjG,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,CAAA,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC;IACtD,OAAO;QACL,YAAY,EAAE,EAAE;QAChB,MAAM;KACP,CAAC;AACJ,CAAC;AAlBD,gCAkBC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mock_logger.test.d.ts","sourceRoot":"","sources":["../../src/test/mock_logger.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const mock_logger_1 = require("./mock_logger");
|
4
|
+
describe("logger", () => {
|
5
|
+
it("with logcollector", async () => {
|
6
|
+
const l = (0, mock_logger_1.MockLogger)();
|
7
|
+
l.logger.Debug().Str("bla1", "blub1").Msg("hello1");
|
8
|
+
l.logger.Info().Str("bla2", "blub2").Msg("hello2");
|
9
|
+
await l.logger.Flush();
|
10
|
+
expect(l.logCollector.Logs()).toEqual([
|
11
|
+
{ level: "debug", bla1: "blub1", msg: "hello1", module: "MockLogger" },
|
12
|
+
{ level: "info", bla2: "blub2", msg: "hello2", module: "MockLogger" },
|
13
|
+
]);
|
14
|
+
});
|
15
|
+
it("with logcollector disableDebug", async () => {
|
16
|
+
const l = (0, mock_logger_1.MockLogger)({
|
17
|
+
disableDebug: true,
|
18
|
+
});
|
19
|
+
l.logger.Debug().Str("bla1", "blub1").Msg("hello1");
|
20
|
+
l.logger.Info().Str("bla2", "blub2").Msg("hello2");
|
21
|
+
await l.logger.Flush();
|
22
|
+
expect(l.logCollector.Logs()).toEqual([{ level: "info", bla2: "blub2", msg: "hello2", module: "MockLogger" }]);
|
23
|
+
});
|
24
|
+
it("with logcollector moduleName", async () => {
|
25
|
+
const l = (0, mock_logger_1.MockLogger)({
|
26
|
+
moduleName: "test",
|
27
|
+
});
|
28
|
+
l.logger.Debug().Str("bla1", "blub1").Msg("hello1");
|
29
|
+
l.logger.Info().Str("bla2", "blub2").Msg("hello2");
|
30
|
+
await l.logger.Flush();
|
31
|
+
expect(l.logCollector.Logs()).toEqual([
|
32
|
+
{ level: "debug", bla1: "blub1", msg: "hello1", module: "test" },
|
33
|
+
{ level: "info", bla2: "blub2", msg: "hello2", module: "test" },
|
34
|
+
]);
|
35
|
+
});
|
36
|
+
it("with logcollector [moduleName]", async () => {
|
37
|
+
const l = (0, mock_logger_1.MockLogger)({
|
38
|
+
moduleName: ["test", "wurst"],
|
39
|
+
});
|
40
|
+
l.logger.Debug().Str("bla1", "blub1").Msg("hello1");
|
41
|
+
l.logger.With().Module("wurst").Logger().Debug().Str("bla2", "blub2").Msg("hello2");
|
42
|
+
await l.logger.Flush();
|
43
|
+
expect(l.logCollector.Logs()).toEqual([
|
44
|
+
{ level: "debug", bla1: "blub1", msg: "hello1", module: "test" },
|
45
|
+
{ level: "debug", bla2: "blub2", msg: "hello2", module: "wurst" },
|
46
|
+
]);
|
47
|
+
});
|
48
|
+
});
|
49
|
+
//# sourceMappingURL=mock_logger.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mock_logger.test.js","sourceRoot":"","sources":["../../src/test/mock_logger.test.ts"],"names":[],"mappings":";;AAAA,+CAA2C;AAE3C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;QACjC,MAAM,CAAC,GAAG,IAAA,wBAAU,GAAE,CAAC;QACvB,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACpD,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnD,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACvB,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC;YACpC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE;YACtE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE;SACtE,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,CAAC,GAAG,IAAA,wBAAU,EAAC;YACnB,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QACH,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,MAAM,EA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EH,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,CAAC,GAAG,IAAA,wBAAU,EAAC;YACnB,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;SAC9B,CAAC,CAAC;QACH,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACpD,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACpF,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACvB,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC;YACpC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE;YAChE,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE;SAClE,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
//# sourceMappingURL=test-exit-handler.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"test-exit-handler.d.ts","sourceRoot":"","sources":["../../src/test/test-exit-handler.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,76 @@
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
+
}) : function(o, v) {
|
16
|
+
o["default"] = v;
|
17
|
+
});
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
+
if (mod && mod.__esModule) return mod;
|
20
|
+
var result = {};
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
+
__setModuleDefault(result, mod);
|
23
|
+
return result;
|
24
|
+
};
|
25
|
+
(async () => {
|
26
|
+
const sa = await Promise.resolve().then(() => __importStar(require("../node_sys_abstraction")));
|
27
|
+
const my = new sa.NodeSysAbstraction();
|
28
|
+
const larg = process.argv[process.argv.length - 1];
|
29
|
+
console.log(JSON.stringify({
|
30
|
+
larg,
|
31
|
+
pid: process.pid,
|
32
|
+
}));
|
33
|
+
my.System().OnExit(async () => {
|
34
|
+
await my.Time().Sleep(100);
|
35
|
+
console.log(JSON.stringify({
|
36
|
+
larg,
|
37
|
+
pid: process.pid,
|
38
|
+
msg: "Called OnExit 1",
|
39
|
+
}));
|
40
|
+
});
|
41
|
+
my.System().OnExit(async () => {
|
42
|
+
await my.Time().Sleep(200);
|
43
|
+
console.log(JSON.stringify({
|
44
|
+
larg,
|
45
|
+
pid: process.pid,
|
46
|
+
msg: "Called OnExit 2",
|
47
|
+
}));
|
48
|
+
});
|
49
|
+
switch (larg) {
|
50
|
+
case "sigint":
|
51
|
+
await my.Time().Sleep(100);
|
52
|
+
process.kill(process.pid, "SIGINT");
|
53
|
+
await my.Time().Sleep(1000000);
|
54
|
+
break;
|
55
|
+
case "sigquit":
|
56
|
+
await my.Time().Sleep(100);
|
57
|
+
process.kill(process.pid, "SIGQUIT");
|
58
|
+
await my.Time().Sleep(1000000);
|
59
|
+
break;
|
60
|
+
case "sigterm":
|
61
|
+
await my.Time().Sleep(100);
|
62
|
+
process.kill(process.pid, "SIGTERM");
|
63
|
+
await my.Time().Sleep(1000000);
|
64
|
+
break;
|
65
|
+
case "throw":
|
66
|
+
await my.Time().Sleep(100);
|
67
|
+
throw new Error("throwing");
|
68
|
+
case "sleep":
|
69
|
+
await my.Time().Sleep(3000);
|
70
|
+
break;
|
71
|
+
case "exit24":
|
72
|
+
default:
|
73
|
+
my.System().Exit(24);
|
74
|
+
}
|
75
|
+
})();
|
76
|
+
//# sourceMappingURL=test-exit-handler.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"test-exit-handler.js","sourceRoot":"","sources":["../../src/test/test-exit-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,CAAC,KAAK,IAAI,EAAE;IACV,MAAM,EAAE,GAAG,wDAAa,yBAAyB,GAAC,CAAC;IAEnD,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,kBAAkB,EAAE,CAAC;IAEvC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CAAC;QACb,IAAI;QACJ,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CACH,CAAC;IAEF,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3B,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SA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AO;YACV,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;QAC9B,KAAK,OAAO;YACV,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC5B,MAAM;QACR,KAAK,QAAQ,CAAC;QACd;YACE,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
|
package/time.d.ts
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
export declare abstract class Time {
|
2
|
+
abstract Now(): Date;
|
3
|
+
abstract Sleep(duration: Duration): Promise<void>;
|
4
|
+
TimeSince(start: Date): Duration;
|
5
|
+
}
|
6
|
+
export type Duration = number;
|
7
|
+
export declare enum TimeUnits {
|
8
|
+
Microsecond = 1,
|
9
|
+
Second = 1000,
|
10
|
+
Minute = 60000,
|
11
|
+
Hour = 3600000
|
12
|
+
}
|
13
|
+
//# sourceMappingURL=time.d.ts.map
|
package/time.d.ts.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":"AAAA,8BAAsB,IAAI;IACxB,QAAQ,CAAC,GAAG,IAAI,IAAI;IACpB,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IACjD,SAAS,CAAC,KAAK,EAAE,IAAI,GAAG,QAAQ;CAIjC;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,oBAAY,SAAS;IACnB,WAAW,IAAI;IACf,MAAM,OAAqB;IAC3B,MAAM,QAAc;IACpB,IAAI,UAAc;CACnB"}
|
package/time.js
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.TimeUnits = exports.Time = void 0;
|
4
|
+
class Time {
|
5
|
+
TimeSince(start) {
|
6
|
+
const now = this.Now();
|
7
|
+
return now.getTime() - start.getTime();
|
8
|
+
}
|
9
|
+
}
|
10
|
+
exports.Time = Time;
|
11
|
+
var TimeUnits;
|
12
|
+
(function (TimeUnits) {
|
13
|
+
TimeUnits[TimeUnits["Microsecond"] = 1] = "Microsecond";
|
14
|
+
TimeUnits[TimeUnits["Second"] = 1000] = "Second";
|
15
|
+
TimeUnits[TimeUnits["Minute"] = 60000] = "Minute";
|
16
|
+
TimeUnits[TimeUnits["Hour"] = 3600000] = "Hour";
|
17
|
+
})(TimeUnits || (exports.TimeUnits = TimeUnits = {}));
|
18
|
+
//# sourceMappingURL=time.js.map
|
package/time.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":";;;AAAA,MAAsB,IAAI;IAGxB,SAAS,CAAC,KAAW;QACnB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;IACzC,CAAC;CACF;AAPD,oBAOC;AAID,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,uDAAe,CAAA;IACf,gDAA2B,CAAA;IAC3B,iDAAoB,CAAA;IACpB,+CAAkB,CAAA;AACpB,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB"}
|