@adviser/cement 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. package/base_sys_abstraction-BCdXJHNa.d.ts +21 -0
  2. package/base_sys_abstraction-BYZvxqsW.d.cts +21 -0
  3. package/chunk-J2IM7FHM.js +65 -0
  4. package/chunk-J2IM7FHM.js.map +1 -0
  5. package/chunk-MWAFFTM4.js +82 -0
  6. package/chunk-MWAFFTM4.js.map +1 -0
  7. package/chunk-PZTL4UNG.js +233 -0
  8. package/chunk-PZTL4UNG.js.map +1 -0
  9. package/index.cjs +987 -0
  10. package/index.cjs.map +1 -0
  11. package/index.d.cts +196 -0
  12. package/index.d.ts +196 -11
  13. package/index.js +611 -26
  14. package/index.js.map +1 -1
  15. package/node/index.cjs +436 -0
  16. package/node/index.cjs.map +1 -0
  17. package/node/index.d.cts +47 -0
  18. package/node/index.d.ts +47 -4
  19. package/node/index.js +215 -17
  20. package/node/index.js.map +1 -1
  21. package/package.json +34 -8
  22. package/sys_abstraction-CjljYIkv.d.cts +65 -0
  23. package/sys_abstraction-CjljYIkv.d.ts +65 -0
  24. package/utils/index.cjs +270 -0
  25. package/utils/index.cjs.map +1 -0
  26. package/utils/index.d.cts +33 -0
  27. package/utils/index.d.ts +33 -6
  28. package/utils/index.js +232 -20
  29. package/utils/index.js.map +1 -1
  30. package/web/index.cjs +286 -0
  31. package/web/index.cjs.map +1 -0
  32. package/web/index.d.cts +6 -0
  33. package/web/index.d.ts +6 -2
  34. package/web/index.js +7 -16
  35. package/web/index.js.map +1 -1
  36. package/base_sys_abstraction.d.ts +0 -79
  37. package/base_sys_abstraction.d.ts.map +0 -1
  38. package/base_sys_abstraction.js +0 -186
  39. package/base_sys_abstraction.js.map +0 -1
  40. package/base_sys_abstraction.test.d.ts +0 -2
  41. package/base_sys_abstraction.test.d.ts.map +0 -1
  42. package/base_sys_abstraction.test.js +0 -77
  43. package/base_sys_abstraction.test.js.map +0 -1
  44. package/file_service.d.ts +0 -18
  45. package/file_service.d.ts.map +0 -1
  46. package/file_service.js +0 -3
  47. package/file_service.js.map +0 -1
  48. package/future.d.ts +0 -8
  49. package/future.d.ts.map +0 -1
  50. package/future.js +0 -42
  51. package/future.js.map +0 -1
  52. package/future.test.d.ts +0 -2
  53. package/future.test.d.ts.map +0 -1
  54. package/future.test.js +0 -30
  55. package/future.test.js.map +0 -1
  56. package/index.d.ts.map +0 -1
  57. package/logger.d.ts +0 -36
  58. package/logger.d.ts.map +0 -1
  59. package/logger.js +0 -11
  60. package/logger.js.map +0 -1
  61. package/logger.test.d.ts +0 -2
  62. package/logger.test.d.ts.map +0 -1
  63. package/logger.test.js +0 -372
  64. package/logger.test.js.map +0 -1
  65. package/logger_impl.d.ts +0 -64
  66. package/logger_impl.d.ts.map +0 -1
  67. package/logger_impl.js +0 -331
  68. package/logger_impl.js.map +0 -1
  69. package/node/index.d.ts.map +0 -1
  70. package/node/mock_file_service.d.ts +0 -11
  71. package/node/mock_file_service.d.ts.map +0 -1
  72. package/node/mock_file_service.js +0 -38
  73. package/node/mock_file_service.js.map +0 -1
  74. package/node/mock_file_service.test.d.ts +0 -2
  75. package/node/mock_file_service.test.d.ts.map +0 -1
  76. package/node/mock_file_service.test.js +0 -19
  77. package/node/mock_file_service.test.js.map +0 -1
  78. package/node/node_file_service.d.ts +0 -16
  79. package/node/node_file_service.d.ts.map +0 -1
  80. package/node/node_file_service.js +0 -84
  81. package/node/node_file_service.js.map +0 -1
  82. package/node/node_sys_abstraction.d.ts +0 -21
  83. package/node/node_sys_abstraction.d.ts.map +0 -1
  84. package/node/node_sys_abstraction.js +0 -101
  85. package/node/node_sys_abstraction.js.map +0 -1
  86. package/node/node_sys_abstraction.test.d.ts +0 -2
  87. package/node/node_sys_abstraction.test.d.ts.map +0 -1
  88. package/node/node_sys_abstraction.test.js +0 -57
  89. package/node/node_sys_abstraction.test.js.map +0 -1
  90. package/option.d.ts +0 -25
  91. package/option.d.ts.map +0 -1
  92. package/option.js +0 -53
  93. package/option.js.map +0 -1
  94. package/result.d.ts +0 -31
  95. package/result.d.ts.map +0 -1
  96. package/result.js +0 -69
  97. package/result.js.map +0 -1
  98. package/result.test.d.ts +0 -2
  99. package/result.test.d.ts.map +0 -1
  100. package/result.test.js +0 -39
  101. package/result.test.js.map +0 -1
  102. package/sys_abstraction.d.ts +0 -35
  103. package/sys_abstraction.d.ts.map +0 -1
  104. package/sys_abstraction.js +0 -35
  105. package/sys_abstraction.js.map +0 -1
  106. package/test/log_collector.d.ts +0 -22
  107. package/test/log_collector.d.ts.map +0 -1
  108. package/test/log_collector.js +0 -66
  109. package/test/log_collector.js.map +0 -1
  110. package/test/mock_logger.d.ts +0 -13
  111. package/test/mock_logger.d.ts.map +0 -1
  112. package/test/mock_logger.js +0 -30
  113. package/test/mock_logger.js.map +0 -1
  114. package/test/mock_logger.test.d.ts +0 -2
  115. package/test/mock_logger.test.d.ts.map +0 -1
  116. package/test/mock_logger.test.js +0 -49
  117. package/test/mock_logger.test.js.map +0 -1
  118. package/test/test-exit-handler.d.ts +0 -1
  119. package/test/test-exit-handler.d.ts.map +0 -1
  120. package/test/test-exit-handler.js +0 -76
  121. package/test/test-exit-handler.js.map +0 -1
  122. package/time.d.ts +0 -13
  123. package/time.d.ts.map +0 -1
  124. package/time.js +0 -18
  125. package/time.js.map +0 -1
  126. package/utils/index.d.ts.map +0 -1
  127. package/utils/rebuffer.d.ts +0 -3
  128. package/utils/rebuffer.d.ts.map +0 -1
  129. package/utils/rebuffer.js +0 -65
  130. package/utils/rebuffer.js.map +0 -1
  131. package/utils/rebuffer.test.d.ts +0 -2
  132. package/utils/rebuffer.test.d.ts.map +0 -1
  133. package/utils/rebuffer.test.js +0 -79
  134. package/utils/rebuffer.test.js.map +0 -1
  135. package/utils/stream2string.d.ts +0 -3
  136. package/utils/stream2string.d.ts.map +0 -1
  137. package/utils/stream2string.js +0 -53
  138. package/utils/stream2string.js.map +0 -1
  139. package/utils/stream2string.test.d.ts +0 -2
  140. package/utils/stream2string.test.d.ts.map +0 -1
  141. package/utils/stream2string.test.js +0 -31
  142. package/utils/stream2string.test.js.map +0 -1
  143. package/utils/stream_map.d.ts +0 -9
  144. package/utils/stream_map.d.ts.map +0 -1
  145. package/utils/stream_map.js +0 -67
  146. package/utils/stream_map.js.map +0 -1
  147. package/utils/stream_map.test.d.ts +0 -2
  148. package/utils/stream_map.test.d.ts.map +0 -1
  149. package/utils/stream_map.test.js +0 -89
  150. package/utils/stream_map.test.js.map +0 -1
  151. package/utils/stream_test_helper.d.ts +0 -15
  152. package/utils/stream_test_helper.d.ts.map +0 -1
  153. package/utils/stream_test_helper.js +0 -42
  154. package/utils/stream_test_helper.js.map +0 -1
  155. package/utils/string2stream.d.ts +0 -3
  156. package/utils/string2stream.d.ts.map +0 -1
  157. package/utils/string2stream.js +0 -18
  158. package/utils/string2stream.js.map +0 -1
  159. package/utils/string2stream.test.d.ts +0 -2
  160. package/utils/string2stream.test.d.ts.map +0 -1
  161. package/utils/string2stream.test.js +0 -9
  162. package/utils/string2stream.test.js.map +0 -1
  163. package/web/index.d.ts.map +0 -1
  164. package/web/web_sys_abstraction.d.ts +0 -4
  165. package/web/web_sys_abstraction.d.ts.map +0 -1
  166. package/web/web_sys_abstraction.js +0 -65
  167. package/web/web_sys_abstraction.js.map +0 -1
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const node_sys_abstraction_1 = require("./node/node_sys_abstraction");
4
- const sys_abstraction_1 = require("./sys_abstraction");
5
- const web_sys_abstraction_1 = require("./web/web_sys_abstraction");
6
- for (const abstraction of [
7
- { name: "NodeSysAbstraction", fn: node_sys_abstraction_1.NodeSysAbstraction },
8
- { name: "WebSysAbstraction", fn: web_sys_abstraction_1.WebSysAbstraction },
9
- ]) {
10
- describe(abstraction.name, () => {
11
- it("IdService UUID", () => {
12
- const sys = abstraction.fn();
13
- const id1 = sys.NextId();
14
- const id2 = sys.NextId();
15
- expect(id1).not.toEqual(id2);
16
- });
17
- it("IdService explict UUID", () => {
18
- const sys = abstraction.fn({ IdMode: sys_abstraction_1.IDMode.UUID });
19
- const id1 = sys.NextId();
20
- const id2 = sys.NextId();
21
- expect(id1).not.toEqual(id2);
22
- });
23
- it("IdService const", () => {
24
- const sys = abstraction.fn({ IdMode: sys_abstraction_1.IDMode.CONST });
25
- const id1 = sys.NextId();
26
- const id2 = sys.NextId();
27
- expect(id1).toEqual(id2);
28
- });
29
- it("IdService set", () => {
30
- for (let i = 0; i < 10; i++) {
31
- const sys = abstraction.fn({ IdMode: sys_abstraction_1.IDMode.STEP });
32
- const id1 = sys.NextId();
33
- const id2 = sys.NextId();
34
- expect(id1).toEqual("STEPId-0");
35
- expect(id2).toEqual("STEPId-1");
36
- }
37
- });
38
- it("time sleep", async () => {
39
- const sys = abstraction.fn();
40
- const start = sys.Time().Now();
41
- await sys.Time().Sleep(100);
42
- expect(sys.Time().TimeSince(start)).toBeGreaterThan(90);
43
- });
44
- it("time sleep const", async () => {
45
- const sys = abstraction.fn({ TimeMode: sys_abstraction_1.TimeMode.REAL });
46
- const start = new Date();
47
- await sys.Time().Sleep(100);
48
- const end = new Date();
49
- expect(end.getTime() - start.getTime()).toBeGreaterThan(90);
50
- });
51
- it("time sleep step", async () => {
52
- const sys = abstraction.fn({ TimeMode: sys_abstraction_1.TimeMode.STEP });
53
- const start = sys.Time().Now();
54
- await sys.Time().Sleep(86400500);
55
- expect(sys.Time().Now().getTime() - start.getTime()).toEqual(86401500);
56
- });
57
- it("const random", () => {
58
- const sys = abstraction.fn({ RandomMode: sys_abstraction_1.RandomMode.CONST });
59
- expect(sys.Random0ToValue(10)).toEqual(5);
60
- expect(sys.Random0ToValue(10)).toEqual(5);
61
- });
62
- it("step random", () => {
63
- const sys = abstraction.fn({ RandomMode: sys_abstraction_1.RandomMode.STEP });
64
- expect(sys.Random0ToValue(10000)).toEqual(1);
65
- expect(sys.Random0ToValue(10000)).toEqual(2);
66
- });
67
- it("random", () => {
68
- const sys = abstraction.fn({});
69
- for (let i = 0; i < 100; i++) {
70
- const val = sys.Random0ToValue(10);
71
- expect(val).toBeGreaterThanOrEqual(0);
72
- expect(val).toBeLessThanOrEqual(10);
73
- }
74
- });
75
- });
76
- }
77
- //# sourceMappingURL=base_sys_abstraction.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base_sys_abstraction.test.js","sourceRoot":"","sources":["../src/base_sys_abstraction.test.ts"],"names":[],"mappings":";;AAAA,sEAAiE;AACjE,uDAAiE;AACjE,mEAA8D;AAE9D,KAAK,MAAM,WAAW,IAAI;IACxB,EAAE,IAAI,EAAE,oBAAoB,EAAE,EAAE,EAAE,yCAAkB,EAAE;IACtD,EAAE,IAAI,EAAE,mBAAmB,EAAE,EAAE,EAAE,uCAAiB,EAAE;CACrD,EAAE,CAAC;IACF,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE;QAC9B,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;YACxB,MAAM,GAAG,GAAG,WAAW,CAAC,EAAE,EAAE,CAAC;YAC7B,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;YACzB,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;YAChC,MAAM,GAAG,GAAG,WAAW,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,wBAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YACpD,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;YACzB,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QAEH,EAAE,CA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AAc,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;YACrB,MAAM,GAAG,GAAG,WAAW,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,4BAAU,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5D,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC7C,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YAChB,MAAM,GAAG,GAAG,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;YAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC7B,MAAM,GAAG,GAAG,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;gBACnC,MAAM,CAAC,GAAG,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;gBACtC,MAAM,CAAC,GAAG,CAAC,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;YACtC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
package/file_service.d.ts DELETED
@@ -1,18 +0,0 @@
1
- export interface NamedWritableStream {
2
- readonly name: string;
3
- readonly stream: WritableStream<Uint8Array>;
4
- }
5
- export interface FileService {
6
- readonly baseDir: string;
7
- create(fname: string): Promise<NamedWritableStream>;
8
- readFileString(fname: string): Promise<string>;
9
- writeFileString(fname: string, content: string): Promise<void>;
10
- abs(fname: string): string;
11
- join(...paths: string[]): string;
12
- relative(from: string, to?: string): string;
13
- dirname(fname: string): string;
14
- basename(fname: string): string;
15
- nodeImport(fname: string): string;
16
- isAbsolute(fname: string): boolean;
17
- }
18
- //# sourceMappingURL=file_service.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file_service.d.ts","sourceRoot":"","sources":["../src/file_service.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACpD,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/D,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAE3B,IAAI,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAEjC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE5C,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAElC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CACpC"}
package/file_service.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=file_service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file_service.js","sourceRoot":"","sources":["../src/file_service.ts"],"names":[],"mappings":""}
package/future.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export declare class Future<T> {
2
- #private;
3
- constructor();
4
- asPromise(): Promise<T>;
5
- resolve(value: T): void;
6
- reject(reason: unknown): void;
7
- }
8
- //# sourceMappingURL=future.d.ts.map
package/future.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"future.d.ts","sourceRoot":"","sources":["../src/future.ts"],"names":[],"mappings":"AAAA,qBAAa,MAAM,CAAC,CAAC;;;IAgBb,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC;IAI7B,OAAO,CAAC,KAAK,EAAE,CAAC;IAGhB,MAAM,CAAC,MAAM,EAAE,OAAO;CAGvB"}
package/future.js DELETED
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
- if (kind === "m") throw new TypeError("Private method is not writable");
4
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
6
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
- };
8
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
- };
13
- var _Future_promise, _Future_resolveFn, _Future_rejectFn;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.Future = void 0;
16
- class Future {
17
- constructor() {
18
- _Future_promise.set(this, void 0);
19
- _Future_resolveFn.set(this, () => {
20
- throw new Error("This Promise is not working as expected.");
21
- });
22
- _Future_rejectFn.set(this, () => {
23
- throw new Error("This Promise is not working as expected.");
24
- });
25
- __classPrivateFieldSet(this, _Future_promise, new Promise((resolve, reject) => {
26
- __classPrivateFieldSet(this, _Future_resolveFn, resolve, "f");
27
- __classPrivateFieldSet(this, _Future_rejectFn, reject, "f");
28
- }), "f");
29
- }
30
- async asPromise() {
31
- return __classPrivateFieldGet(this, _Future_promise, "f");
32
- }
33
- resolve(value) {
34
- __classPrivateFieldGet(this, _Future_resolveFn, "f").call(this, value);
35
- }
36
- reject(reason) {
37
- __classPrivateFieldGet(this, _Future_rejectFn, "f").call(this, reason);
38
- }
39
- }
40
- exports.Future = Future;
41
- _Future_promise = new WeakMap(), _Future_resolveFn = new WeakMap(), _Future_rejectFn = new WeakMap();
42
- //# sourceMappingURL=future.js.map
package/future.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"future.js","sourceRoot":"","sources":["../src/future.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,MAAa,MAAM;IASjB;QARS,kCAAqB;QAC9B,4BAAiC,GAAG,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC,EAAC;QACF,2BAAuC,GAAG,EAAE;YAC1C,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC,EAAC;QAGA,uBAAA,IAAI,mBAAY,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACjD,uBAAA,IAAI,qBAAc,OAAO,MAAA,CAAC;YAC1B,uBAAA,IAAI,oBAAa,MAAM,MAAA,CAAC;QAC1B,CAAC,CAAC,MAAA,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS;QACb,OAAO,uBAAA,IAAI,uBAAS,CAAC;IACvB,CAAC;IAED,OAAO,CAAC,KAAQ;QACd,uBAAA,IAAI,yBAAW,MAAf,IAAI,EAAY,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,MAAM,CAAC,MAAe;QACpB,uBAAA,IAAI,wBAAU,MAAd,IAAI,EAAW,MAAM,CAAC,CAAC;IACzB,CAAC;CACF;AA1BD,wBA0BC"}
package/future.test.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=future.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"future.test.d.ts","sourceRoot":"","sources":["../src/future.test.ts"],"names":[],"mappings":""}
package/future.test.js DELETED
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const future_1 = require("./future");
4
- it("Create Future Happy", async () => {
5
- const future = new future_1.Future();
6
- const promise = future.asPromise();
7
- expect(promise).toBeInstanceOf(Promise);
8
- const asynced = new Promise((resolve, reject) => {
9
- promise.then(resolve).catch(reject);
10
- });
11
- future.resolve("Hello World");
12
- expect(await asynced).toBe("Hello World");
13
- });
14
- it("Create Future Sad", async () => {
15
- const future = new future_1.Future();
16
- const promise = future.asPromise();
17
- expect(promise).toBeInstanceOf(Promise);
18
- const asynced = new Promise((resolve, reject) => {
19
- promise.then(resolve).catch(reject);
20
- });
21
- future.reject("Sad World");
22
- try {
23
- await asynced;
24
- expect("Why").toBe("Sad World");
25
- }
26
- catch (error) {
27
- expect(error).toBe("Sad World");
28
- }
29
- });
30
- //# sourceMappingURL=future.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"future.test.js","sourceRoot":"","sources":["../src/future.test.ts"],"names":[],"mappings":";;AAAA,qCAAkC;AAElC,EAAE,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;IACnC,MAAM,MAAM,GAAG,IAAI,eAAM,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IACnC,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAExC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC9C,OAAO,CAAC,IAAI,CAAC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Ac,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
package/logger.d.ts DELETED
@@ -1,36 +0,0 @@
1
- export declare enum Level {
2
- WARN = "warn",
3
- DEBUG = "debug",
4
- INFO = "info",
5
- ERROR = "error"
6
- }
7
- export interface LoggerInterface<R> {
8
- Module(key: string): R;
9
- EnableLevel(level: Level, ...modules: string[]): R;
10
- DisableLevel(level: Level, ...modules: string[]): R;
11
- SetDebug(...modules: (string | string[])[]): R;
12
- Str(key: string, value: string): R;
13
- Error(): R;
14
- Warn(): R;
15
- Debug(): R;
16
- Log(): R;
17
- WithLevel(level: Level): R;
18
- Err(err: unknown): R;
19
- Info(): R;
20
- Timestamp(): R;
21
- Any(key: string, value: unknown): R;
22
- Dur(key: string, nsec: number): R;
23
- Uint64(key: string, value: number): R;
24
- }
25
- export interface WithLogger extends LoggerInterface<WithLogger> {
26
- Logger(): Logger;
27
- }
28
- export interface AsError {
29
- AsError(): Error;
30
- }
31
- export interface Logger extends LoggerInterface<Logger> {
32
- With(): WithLogger;
33
- Msg(...args: string[]): AsError;
34
- Flush(): Promise<void>;
35
- }
36
- //# sourceMappingURL=logger.d.ts.map
package/logger.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,oBAAY,KAAK;IACf,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC;IAEvB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IACnD,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;IAEpD,QAAQ,CAAC,GAAG,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IAE/C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC;IACnC,KAAK,IAAI,CAAC,CAAC;IACX,IAAI,IAAI,CAAC,CAAC;IACV,KAAK,IAAI,CAAC,CAAC;IACX,GAAG,IAAI,CAAC,CAAC;IACT,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC;IAE3B,GAAG,CAAC,GAAG,EAAE,OAAO,GAAG,CAAC,CAAC;IACrB,IAAI,IAAI,CAAC,CAAC;IACV,SAAS,IAAI,CAAC,CAAC;IACf,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC;IACpC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC;IAClC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC;CACvC;AACD,MAAM,WAAW,UAAW,SAAQ,eAAe,CAAC,UAAU,CAAC;IAC7D,MAAM,IAAI,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,OAAO,IAAI,KAAK,CAAC;CAClB;AAED,MAAM,WAAW,MAAO,SAAQ,eAAe,CAAC,MAAM,CAAC;IACrD,IAAI,IAAI,UAAU,CAAC;IAEnB,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAChC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
package/logger.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Level = void 0;
4
- var Level;
5
- (function (Level) {
6
- Level["WARN"] = "warn";
7
- Level["DEBUG"] = "debug";
8
- Level["INFO"] = "info";
9
- Level["ERROR"] = "error";
10
- })(Level || (exports.Level = Level = {}));
11
- //# sourceMappingURL=logger.js.map
package/logger.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;AAAA,IAAY,KAKX;AALD,WAAY,KAAK;IACf,sBAAa,CAAA;IACb,wBAAe,CAAA;IACf,sBAAa,CAAA;IACb,wBAAe,CAAA;AACjB,CAAC,EALW,KAAK,qBAAL,KAAK,QAKhB"}
package/logger.test.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=logger.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.test.d.ts","sourceRoot":"","sources":["../src/logger.test.ts"],"names":[],"mappings":""}
package/logger.test.js DELETED
@@ -1,372 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const logger_impl_1 = require("./logger_impl");
4
- const log_collector_1 = require("./test/log_collector");
5
- const logger_1 = require("./logger");
6
- const sys_abstraction_1 = require("./sys_abstraction");
7
- const web_sys_abstraction_1 = require("./web/web_sys_abstraction");
8
- const base_sys_abstraction_1 = require("./base_sys_abstraction");
9
- describe("TestLogger", () => {
10
- let logCollector;
11
- let logger;
12
- beforeEach(() => {
13
- logCollector = new log_collector_1.LogCollector();
14
- logger = new logger_impl_1.LoggerImpl({
15
- out: logCollector,
16
- sys: (0, web_sys_abstraction_1.WebSysAbstraction)({ TimeMode: sys_abstraction_1.TimeMode.STEP }),
17
- levelHandler: new logger_impl_1.LevelHandlerImpl(),
18
- });
19
- });
20
- describe("Error()", () => {
21
- it("should set the level attribute to error", async () => {
22
- logger.Error().Msg("");
23
- await logger.Flush();
24
- expect(logCollector.Logs()).toEqual([{ level: "error" }]);
25
- });
26
- it("should set the error message", async () => {
27
- logger.Err(new Error("test")).Msg("");
28
- await logger.Flush();
29
- expect(logCollector.Logs()).toEqual([{ error: "test" }]);
30
- });
31
- it("should set the error from string", async () => {
32
- logger.Err("test").Msg("");
33
- await logger.Flush();
34
- expect(logCollector.Logs()).toEqual([{ error: "test" }]);
35
- });
36
- it("should set the error from bool", async () => {
37
- logger.Err(false).Msg("");
38
- await logger.Flush();
39
- expect(logCollector.Logs()).toEqual([{ error: "false" }]);
40
- });
41
- });
42
- describe("Info()", () => {
43
- it("should set the level attribute to info", async () => {
44
- logger.Info().Msg("");
45
- await logger.Flush();
46
- expect(logCollector.Logs()).toEqual([{ level: "info" }]);
47
- });
48
- });
49
- describe("Any()", () => {
50
- it("should set the Any attribute", async () => {
51
- logger.Any("key", "value").Msg("");
52
- await logger.Flush();
53
- expect(logCollector.Logs()).toEqual([{ key: "value" }]);
54
- });
55
- });
56
- describe("Dur()", () => {
57
- it("should set the Dur attribute", async () => {
58
- logger.Dur("key", 123).Msg("");
59
- await logger.Flush();
60
- expect(logCollector.Logs()).toEqual([{ key: "123ms" }]);
61
- });
62
- });
63
- describe("Uint64()", () => {
64
- it("should set the Uint64 / number attribute", async () => {
65
- logger.Uint64("Hey", 123).Msg("");
66
- await logger.Flush();
67
- expect(logCollector.Logs()).toEqual([{ Hey: 123 }]);
68
- });
69
- });
70
- describe("Str()", () => {
71
- it("should set the String attribute", async () => {
72
- logger.Str("key", "value").Msg("");
73
- await logger.Flush();
74
- expect(logCollector.Logs()).toEqual([{ key: "value" }]);
75
- });
76
- });
77
- describe("With()", () => {
78
- it("should return a new logger with the same attributes", async () => {
79
- const log = logger.With().Str("key", "value").Logger();
80
- const newLogger = log.With().Str("str", "str").Logger();
81
- logger.Msg("logger1");
82
- logger.Msg("logger2");
83
- newLogger.Msg("newLogger1");
84
- newLogger.Msg("newLogger2");
85
- log.Info().Msg("log1");
86
- log.Info().Msg("log2");
87
- await log.Flush();
88
- expect(logCollector.Logs()).toEqual([
89
- { msg: "logger1" },
90
- { msg: "logger2" },
91
- { key: "value", msg: "newLogger1", str: "str" },
92
- { key: "value", msg: "newLogger2", str: "str" },
93
- { level: "info", key: "value", msg: "log1" },
94
- { level: "info", key: "value", msg: "log2" },
95
- ]);
96
- });
97
- });
98
- describe("Timestamp()", () => {
99
- it("should set the Timestamp attribute", async () => {
100
- const WithConstant = logger.With().Str("key", "withconstant").Str("key1", "anotherone").Logger();
101
- const timelog = WithConstant.With().Timestamp().Str("key", "withconstant2").Logger();
102
- timelog.Msg("1");
103
- timelog.Msg("2");
104
- timelog.Timestamp().Msg("3");
105
- await timelog.Flush();
106
- const timer = (0, base_sys_abstraction_1.TimeFactory)(sys_abstraction_1.TimeMode.STEP);
107
- expect(logCollector.Logs()).toEqual([
108
- {
109
- key: "withconstant2",
110
- key1: "anotherone",
111
- ts: timer.Now().toISOString(),
112
- msg: "1",
113
- },
114
- {
115
- key: "withconstant2",
116
- key1: "anotherone",
117
- ts: timer.Now().toISOString(),
118
- msg: "2",
119
- },
120
- {
121
- key: "withconstant2",
122
- key1: "anotherone",
123
- ts: timer.Now().toISOString(),
124
- msg: "3",
125
- },
126
- ]);
127
- });
128
- it("should NOT set the Timestamp attribute", async () => {
129
- const timelog = logger.With().Logger();
130
- timelog.Msg("1");
131
- timelog.Msg("2");
132
- timelog.Timestamp().Msg("3");
133
- await timelog.Flush();
134
- const timer = (0, base_sys_abstraction_1.TimeFactory)(sys_abstraction_1.TimeMode.STEP);
135
- expect(logCollector.Logs()).toEqual([
136
- { msg: "1" },
137
- { msg: "2" },
138
- {
139
- ts: timer.Now().toISOString(),
140
- msg: "3",
141
- },
142
- ]);
143
- });
144
- });
145
- it("remove empty msg", async () => {
146
- const log = logger;
147
- log.Warn().Msg();
148
- await log.Flush();
149
- expect(logCollector.Logs()).toEqual([{ level: "warn" }]);
150
- });
151
- it("check log level", async () => {
152
- const log = logger.With().Module("test").Logger().With().Logger();
153
- log.Warn().Msg("Warn");
154
- log.Info().Msg("Info");
155
- log.Error().Msg("Error");
156
- log.Log().Msg("Log");
157
- log.WithLevel(logger_1.Level.ERROR).Msg("WithLevel");
158
- log.Debug().Str("should", "reset").Msg("Debug");
159
- log.Info().Str("what", "the").Msg("Simple");
160
- await log.Flush();
161
- const expected = [
162
- { msg: "Warn", level: "warn", module: "test" },
163
- { msg: "Info", level: "info", module: "test" },
164
- { msg: "Error", level: "error", module: "test" },
165
- { msg: "Log", module: "test" },
166
- { msg: "WithLevel", level: "error", module: "test" },
167
- { level: "info", module: "test", msg: "Simple", what: "the" },
168
- ];
169
- expect(logCollector.Logs()).toEqual(expected);
170
- logCollector.Logs().splice(0, logCollector.Logs().length);
171
- logger.With().Logger().SetDebug("test");
172
- log.Debug().Msg("Debug1");
173
- await log.Flush();
174
- expect(logCollector.Logs()).toEqual([...expected, { msg: "Debug1", level: "debug", module: "test" }]);
175
- });
176
- it("should flush all logs", async () => {
177
- const log = new logger_impl_1.LoggerImpl();
178
- log.Info().Msg("1");
179
- log.Info().Msg("2");
180
- await log.Flush();
181
- log.Info().Msg("DONE");
182
- return log.Flush();
183
- });
184
- it("carry debug", async () => {
185
- const log = logger;
186
- log.Module("xxx").SetDebug("yyy", ["i , xxx"]);
187
- log.Debug().Msg("Debug1");
188
- const next1 = log.With().Str("next1", "meno").Logger();
189
- next1.Debug().Msg("Next1");
190
- const next2 = next1.With().Str("next2", "meno").Logger();
191
- next2.Debug().Msg("Next2");
192
- next2.Module("zzz");
193
- next2.Debug().Msg("Next3");
194
- log.Debug().Msg("Top");
195
- next1.Debug().Msg("Next1");
196
- await log.Flush();
197
- expect(logCollector.Logs()).toEqual([
198
- {
199
- level: "debug",
200
- module: "xxx",
201
- msg: "Debug1",
202
- },
203
- {
204
- level: "debug",
205
- module: "xxx",
206
- msg: "Next1",
207
- next1: "meno",
208
- },
209
- {
210
- level: "debug",
211
- module: "xxx",
212
- msg: "Next2",
213
- next1: "meno",
214
- next2: "meno",
215
- },
216
- {
217
- level: "debug",
218
- module: "xxx",
219
- msg: "Top",
220
- },
221
- {
222
- level: "debug",
223
- module: "xxx",
224
- msg: "Next1",
225
- next1: "meno",
226
- },
227
- ]);
228
- });
229
- it("should return an Error on Msg", async () => {
230
- const log = logger;
231
- log.Module("xxx").SetDebug("xxx");
232
- log.Debug().Msg("Debug1");
233
- expect(JSON.parse(log.Debug().Msg("Debug2").AsError().message)).toEqual({
234
- level: "debug",
235
- module: "xxx",
236
- msg: "Debug2",
237
- });
238
- expect(JSON.parse(log.Info().Msg("Info2").AsError().message)).toEqual({
239
- level: "info",
240
- module: "xxx",
241
- msg: "Info2",
242
- });
243
- await log.Flush();
244
- expect(logCollector.Logs()).toEqual([
245
- {
246
- level: "debug",
247
- module: "xxx",
248
- msg: "Debug1",
249
- },
250
- {
251
- level: "debug",
252
- module: "xxx",
253
- msg: "Debug2",
254
- },
255
- {
256
- level: "info",
257
- module: "xxx",
258
- msg: "Info2",
259
- },
260
- ]);
261
- });
262
- it("top should enable modules wildcard", async () => {
263
- const log = logger;
264
- const xxxModule = log.With().Module("xxx").Logger();
265
- log.Debug().Msg("log-Msg0");
266
- xxxModule.Debug().Msg("xxx-log-Msg0");
267
- log.EnableLevel(logger_1.Level.DEBUG);
268
- log.Debug().Msg("log-Msg");
269
- xxxModule.Debug().Msg("xxx-log-Msg");
270
- const yyyModule = log.With().Module("yyy").Logger();
271
- yyyModule.Debug().Msg("yyy-log-Msg");
272
- log.DisableLevel(logger_1.Level.DEBUG);
273
- yyyModule.Debug().Msg("yyy-log-Msg1");
274
- log.Debug().Msg("log-Msg1");
275
- xxxModule.Debug().Msg("xxx-log-Msg1");
276
- await log.Flush();
277
- expect(logCollector.Logs()).toEqual([
278
- {
279
- level: "debug",
280
- msg: "log-Msg",
281
- },
282
- {
283
- level: "debug",
284
- module: "xxx",
285
- msg: "xxx-log-Msg",
286
- },
287
- {
288
- level: "debug",
289
- module: "yyy",
290
- msg: "yyy-log-Msg",
291
- },
292
- ]);
293
- });
294
- it("down should enable modules wildcard", async () => {
295
- const log = logger;
296
- const xxxModule = log.With().Module("xxx").Logger();
297
- log.Debug().Msg("log-Msg");
298
- xxxModule.Debug().Msg("xxx-log-Msg");
299
- xxxModule.EnableLevel(logger_1.Level.DEBUG);
300
- log.Debug().Msg("log-Msg1");
301
- xxxModule.Debug().Msg("xxx-log-Msg1");
302
- const yyyModule = log.With().Module("yyy").Logger();
303
- yyyModule.Debug().Msg("yyy-log-Msg");
304
- yyyModule.DisableLevel(logger_1.Level.DEBUG);
305
- log.Debug().Msg("log-Msg2");
306
- xxxModule.Debug().Msg("xxx-log-Msg2");
307
- yyyModule.Debug().Msg("yyy-log-Msg2");
308
- await log.Flush();
309
- expect(logCollector.Logs()).toEqual([
310
- {
311
- level: "debug",
312
- msg: "log-Msg1",
313
- },
314
- {
315
- level: "debug",
316
- module: "xxx",
317
- msg: "xxx-log-Msg1",
318
- },
319
- {
320
- level: "debug",
321
- module: "yyy",
322
- msg: "yyy-log-Msg",
323
- },
324
- ]);
325
- });
326
- it("global set debug on modules", async () => {
327
- const log = logger;
328
- const xxxModule = log.With().Module("xxx").Logger();
329
- log.Debug().Msg("log-Msg");
330
- xxxModule.Debug().Msg("xxx-log-Msg");
331
- await log.Flush();
332
- expect(logCollector.Logs()).toEqual([]);
333
- xxxModule.EnableLevel(logger_1.Level.DEBUG, "yyy", "xxx");
334
- const yyyModule = log.With().Module("yyy").Logger();
335
- yyyModule.Debug().Msg("yyy-log-Msg");
336
- xxxModule.Debug().Msg("xxx-log-Msg1");
337
- log.Debug().Msg("log-Msg1");
338
- yyyModule.DisableLevel(logger_1.Level.DEBUG, "yyy");
339
- yyyModule.Debug().Msg("yyy-log-Msg1");
340
- xxxModule.Debug().Msg("xxx-log-Msg2");
341
- log.Debug().Msg("log-Msg3");
342
- await log.Flush();
343
- expect(logCollector.Logs()).toEqual([
344
- {
345
- level: "debug",
346
- module: "yyy",
347
- msg: "yyy-log-Msg",
348
- },
349
- {
350
- level: "debug",
351
- module: "xxx",
352
- msg: "xxx-log-Msg1",
353
- },
354
- {
355
- level: "debug",
356
- module: "xxx",
357
- msg: "xxx-log-Msg2",
358
- },
359
- ]);
360
- });
361
- it("global Check", async () => {
362
- const g1 = new logger_impl_1.LoggerImpl().EnableLevel(logger_1.Level.DEBUG);
363
- const g2 = new logger_impl_1.LoggerImpl();
364
- const g3 = g2.With().Module("X").Logger();
365
- expect(g1._levelHandler).toBe(g2._levelHandler);
366
- expect(g1._levelHandler).toBe(g3._levelHandler);
367
- expect(g1._levelHandler._globalLevels.has(logger_1.Level.DEBUG)).toBeTruthy();
368
- expect(g2._levelHandler._globalLevels.has(logger_1.Level.DEBUG)).toBeTruthy();
369
- expect(g3._levelHandler._globalLevels.has(logger_1.Level.DEBUG)).toBeTruthy();
370
- });
371
- });
372
- //# sourceMappingURL=logger.test.js.map