@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,21 +0,0 @@
1
- import { SysAbstraction, SystemService, VoidFunc } from "../sys_abstraction";
2
- import { ExitHandler, ExitService, WrapperSysAbstractionParams } from "../base_sys_abstraction";
3
- export declare class ExitServiceImpl implements ExitService {
4
- constructor();
5
- _exitHandlers: ExitHandler[];
6
- injectExitHandlers(hdls: ExitHandler[]): void;
7
- invoked: boolean;
8
- readonly _handleExit: () => Promise<void>;
9
- exit(code: number): void;
10
- }
11
- export declare class NodeSystemService implements SystemService {
12
- static readonly _exitHandlers: ExitHandler[];
13
- readonly _exitService: ExitService;
14
- constructor();
15
- Env(): Record<string, string>;
16
- Args(): string[];
17
- OnExit(hdl: VoidFunc): VoidFunc;
18
- Exit(code: number): void;
19
- }
20
- export declare function NodeSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction;
21
- //# sourceMappingURL=node_sys_abstraction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node_sys_abstraction.d.ts","sourceRoot":"","sources":["../../src/node/node_sys_abstraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAEL,WAAW,EACX,WAAW,EAEX,2BAA2B,EAC5B,MAAM,yBAAyB,CAAC;AAGjC,qBAAa,eAAgB,YAAW,WAAW;;IA0BjD,aAAa,EAAE,WAAW,EAAE,CAAM;IAClC,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI;IAI7C,OAAO,UAAS;IAChB,QAAQ,CAAC,WAAW,QAAa,QAAQ,IAAI,CAAC,CAkB5C;IAEF,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAWzB;AAED,qBAAa,iBAAkB,YAAW,aAAa;IACrD,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,WAAW,EAAE,CAAM;IAClD,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAyB;;IAK3D,GAAG;IAIH,IAAI;IAIJ,MAAM,CAAC,GAAG,EAAE,QAAQ,GAAG,QAAQ;IAW/B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAGzB;AAGD,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,2BAA2B,GAAG,cAAc,CAQtF"}
@@ -1,101 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NodeSysAbstraction = exports.NodeSystemService = exports.ExitServiceImpl = void 0;
4
- const base_sys_abstraction_1 = require("../base_sys_abstraction");
5
- const node_file_service_1 = require("./node_file_service");
6
- class ExitServiceImpl {
7
- constructor() {
8
- this._exitHandlers = [];
9
- this.invoked = false;
10
- this._handleExit = async () => {
11
- if (this.invoked) {
12
- return;
13
- }
14
- this.invoked = true;
15
- for (const h of this._exitHandlers) {
16
- try {
17
- const ret = h.hdl();
18
- if (typeof ret.then === "function") {
19
- await ret;
20
- }
21
- }
22
- finally {
23
- }
24
- }
25
- };
26
- process.on("unhandledRejection", (reason, p) => {
27
- this.exit(19);
28
- });
29
- process.on("uncaughtException", (error) => {
30
- this.exit(18);
31
- });
32
- process.on("close", () => {
33
- this.exit(0);
34
- });
35
- process.on("exit", () => {
36
- this.exit(0);
37
- });
38
- process.on("SIGQUIT", () => {
39
- this.exit(3);
40
- });
41
- process.on("SIGINT", () => {
42
- this.exit(2);
43
- });
44
- process.on("SIGTERM", () => {
45
- this.exit(9);
46
- });
47
- }
48
- injectExitHandlers(hdls) {
49
- this._exitHandlers = hdls;
50
- }
51
- exit(code) {
52
- this._handleExit()
53
- .then(() => {
54
- process.exit(code);
55
- })
56
- .catch((err) => {
57
- console.error("ExitService: failed to handle exit", err);
58
- process.exit(code);
59
- });
60
- }
61
- }
62
- exports.ExitServiceImpl = ExitServiceImpl;
63
- class NodeSystemService {
64
- constructor() {
65
- this._exitService = new ExitServiceImpl();
66
- this._exitService.injectExitHandlers(NodeSystemService._exitHandlers);
67
- }
68
- Env() {
69
- return process.env;
70
- }
71
- Args() {
72
- return process.argv;
73
- }
74
- OnExit(hdl) {
75
- const id = crypto.randomUUID();
76
- NodeSystemService._exitHandlers.push({ hdl, id });
77
- return () => {
78
- const idx = NodeSystemService._exitHandlers.findIndex((h) => h.id === id);
79
- if (idx >= 0) {
80
- NodeSystemService._exitHandlers.splice(idx, 1);
81
- }
82
- };
83
- }
84
- Exit(code) {
85
- this._exitService.exit(code);
86
- }
87
- }
88
- exports.NodeSystemService = NodeSystemService;
89
- NodeSystemService._exitHandlers = [];
90
- let my = undefined;
91
- function NodeSysAbstraction(param) {
92
- if (!my) {
93
- my = new base_sys_abstraction_1.BaseSysAbstraction({
94
- FileSystem: new node_file_service_1.NodeFileService(),
95
- SystemService: new NodeSystemService(),
96
- });
97
- }
98
- return new base_sys_abstraction_1.WrapperSysAbstraction(my, param);
99
- }
100
- exports.NodeSysAbstraction = NodeSysAbstraction;
101
- //# sourceMappingURL=node_sys_abstraction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node_sys_abstraction.js","sourceRoot":"","sources":["../../src/node/node_sys_abstraction.ts"],"names":[],"mappings":";;;AACA,kEAMiC;AACjC,2DAAsD;AAEtD,MAAa,eAAe;IAC1B;QAyBA,kBAAa,GAAkB,EAAE,CAAC;QAKlC,YAAO,GAAG,KAAK,CAAC;QACP,gBAAW,GAAG,KAAK,IAAmB,EAAE;YAC/C,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBAEjB,OAAO;YACT,CAAC;YACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnC,IAAI,CAAC;oBAEH,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;oBAEpB,IAAI,OAAQ,GAAqB,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;wBACtD,MAAM,GAAG,CAAC;oBACZ,CAAC;gBACH,CAAC;wBAAS,CAAC;gBAEX,CAAC;YACH,CAAC;QACH,CAAC,CAAC;QA/CA,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,MAAc,EAAE,CAAmB,EAAE,EAAE;YACvE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAY,EAAE,EAAE;YAC/C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACvB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACf,CAAC,CAAC,CAAC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AM,CAAC,GAAa;QAClB,MAAM,EAAE,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QAC/B,iBAAiB,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;QAClD,OAAO,GAAG,EAAE;YACV,MAAM,GAAG,GAAG,iBAAiB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YAC1E,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;gBACb,iBAAiB,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACjD,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,IAAY;QACf,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;;AA5BH,8CA6BC;AA5BiB,+BAAa,GAAkB,EAAE,AAApB,CAAqB;AA8BpD,IAAI,EAAE,GAAmC,SAAS,CAAC;AACnD,SAAgB,kBAAkB,CAAC,KAAmC;IACpE,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,EAAE,GAAG,IAAI,yCAAkB,CAAC;YAC1B,UAAU,EAAE,IAAI,mCAAe,EAAE;YACjC,aAAa,EAAE,IAAI,iBAAiB,EAAE;SACvC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,4CAAqB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC;AARD,gDAQC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=node_sys_abstraction.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node_sys_abstraction.test.d.ts","sourceRoot":"","sources":["../../src/node/node_sys_abstraction.test.ts"],"names":[],"mappings":""}
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const node_child_process_1 = require("node:child_process");
4
- function exitHandler(errCode, larg, done) {
5
- return (err, stdout, stderr) => {
6
- if (err) {
7
- expect(err.code).toBe(errCode);
8
- }
9
- if (stdout) {
10
- const res = stdout
11
- .toString()
12
- .split("\n")
13
- .filter((line) => line.trim())
14
- .map((line) => {
15
- const out = JSON.parse(line);
16
- return out;
17
- })
18
- .map((obj) => {
19
- delete obj.pid;
20
- return obj;
21
- });
22
- expect(res).toEqual([
23
- {
24
- larg: larg,
25
- },
26
- {
27
- larg: larg,
28
- msg: "Called OnExit 1",
29
- },
30
- {
31
- larg: larg,
32
- msg: "Called OnExit 2",
33
- },
34
- ]);
35
- done();
36
- }
37
- if (stderr) {
38
- expect(stderr).toEqual({});
39
- }
40
- };
41
- }
42
- it("just-exit", (done) => {
43
- (0, node_child_process_1.exec)("tsx src/test/test-exit-handler.ts exit24", exitHandler(24, "exit24", done));
44
- });
45
- it("throw", (done) => {
46
- (0, node_child_process_1.exec)("tsx src/test/test-exit-handler.ts throw", exitHandler(19, "throw", done));
47
- });
48
- it("via sigint", (done) => {
49
- (0, node_child_process_1.exec)("tsx src/test/test-exit-handler.ts sigint", exitHandler(2, "sigint", done));
50
- });
51
- it("via sigterm", (done) => {
52
- (0, node_child_process_1.exec)("tsx src/test/test-exit-handler.ts sigterm", exitHandler(9, "sigterm", done));
53
- });
54
- it("via sigquit", (done) => {
55
- (0, node_child_process_1.exec)("tsx src/test/test-exit-handler.ts sigquit", exitHandler(3, "sigquit", done));
56
- });
57
- //# sourceMappingURL=node_sys_abstraction.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node_sys_abstraction.test.js","sourceRoot":"","sources":["../../src/node/node_sys_abstraction.test.ts"],"names":[],"mappings":";;AAAA,2DAAyD;AAEzD,SAAS,WAAW,CAAC,OAAe,EAAE,IAAY,EAAE,IAAgB;IAClE,OAAO,CAAC,GAAyB,EAAE,MAAuB,EAAE,MAAuB,EAAE,EAAE;QACrF,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,C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AAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;AAClF,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;IACxB,IAAA,yBAAI,EAAC,0CAA0C,EAAE,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;AACnF,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;IACzB,IAAA,yBAAI,EAAC,2CAA2C,EAAE,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;AACrF,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE;IACzB,IAAA,yBAAI,EAAC,2CAA2C,EAAE,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;AACrF,CAAC,CAAC,CAAC"}
package/option.d.ts DELETED
@@ -1,25 +0,0 @@
1
- export declare abstract class Option<T> {
2
- static Some<T>(t: T): Option<T>;
3
- static None<T>(): Option<T>;
4
- static Is<T>(t: unknown): t is Option<T>;
5
- IsNone(): boolean;
6
- IsSome(): boolean;
7
- Unwrap(): T;
8
- abstract is_none(): boolean;
9
- abstract is_some(): boolean;
10
- abstract unwrap(): T;
11
- }
12
- export declare class Some<T> extends Option<T> {
13
- private _t;
14
- constructor(_t: T);
15
- is_none(): boolean;
16
- is_some(): boolean;
17
- unwrap(): T;
18
- }
19
- export declare class None<T> extends Option<T> {
20
- is_none(): boolean;
21
- is_some(): boolean;
22
- unwrap(): T;
23
- }
24
- export type WithoutOption<T> = T extends Option<infer U> ? U : T;
25
- //# sourceMappingURL=option.d.ts.map
package/option.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"option.d.ts","sourceRoot":"","sources":["../src/option.ts"],"names":[],"mappings":"AAAA,8BAAsB,MAAM,CAAC,CAAC;IAC5B,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAI/B,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;IAI3B,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC;IAIxC,MAAM,IAAI,OAAO;IAIjB,MAAM,IAAI,OAAO;IAGjB,MAAM,IAAI,CAAC;IAIX,QAAQ,CAAC,OAAO,IAAI,OAAO;IAC3B,QAAQ,CAAC,OAAO,IAAI,OAAO;IAC3B,QAAQ,CAAC,MAAM,IAAI,CAAC;CACrB;AAED,qBAAa,IAAI,CAAC,CAAC,CAAE,SAAQ,MAAM,CAAC,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,CAAI;gBACF,EAAE,EAAE,CAAC;IAKjB,OAAO,IAAI,OAAO;IAGlB,OAAO,IAAI,OAAO;IAGlB,MAAM,IAAI,CAAC;CAGZ;AAED,qBAAa,IAAI,CAAC,CAAC,CAAE,SAAQ,MAAM,CAAC,CAAC,CAAC;IACpC,OAAO,IAAI,OAAO;IAGlB,OAAO,IAAI,OAAO;IAGlB,MAAM,IAAI,CAAC;CAGZ;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC"}
package/option.js DELETED
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.None = exports.Some = exports.Option = void 0;
4
- class Option {
5
- static Some(t) {
6
- return new Some(t);
7
- }
8
- static None() {
9
- return new None();
10
- }
11
- static Is(t) {
12
- return t instanceof Option;
13
- }
14
- IsNone() {
15
- return this.is_none();
16
- }
17
- IsSome() {
18
- return this.is_some();
19
- }
20
- Unwrap() {
21
- return this.unwrap();
22
- }
23
- }
24
- exports.Option = Option;
25
- class Some extends Option {
26
- constructor(_t) {
27
- super();
28
- this._t = _t;
29
- }
30
- is_none() {
31
- return false;
32
- }
33
- is_some() {
34
- return true;
35
- }
36
- unwrap() {
37
- return this._t;
38
- }
39
- }
40
- exports.Some = Some;
41
- class None extends Option {
42
- is_none() {
43
- return true;
44
- }
45
- is_some() {
46
- return false;
47
- }
48
- unwrap() {
49
- throw new Error("None.unwrap");
50
- }
51
- }
52
- exports.None = None;
53
- //# sourceMappingURL=option.js.map
package/option.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"option.js","sourceRoot":"","sources":["../src/option.ts"],"names":[],"mappings":";;;AAAA,MAAsB,MAAM;IAC1B,MAAM,CAAC,IAAI,CAAI,CAAI;QACjB,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,IAAI;QACT,OAAO,IAAI,IAAI,EAAE,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,EAAE,CAAI,CAAU;QACrB,OAAO,CAAC,YAAY,MAAM,CAAC;IAC7B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;CAKF;AA3BD,wBA2BC;AAED,MAAa,IAAQ,SAAQ,MAAS;IAEpC,YAAY,EAAK;QACf,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO;QACL,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;CACF;AAhBD,oBAgBC;AAED,MAAa,IAAQ,SAAQ,MAAS;IACpC,OAAO;QACL,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO;QACL,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC;CACF;AAVD,oBAUC"}
package/result.d.ts DELETED
@@ -1,31 +0,0 @@
1
- export declare abstract class Result<T, E = Error> {
2
- static Ok<T>(t: T): Result<T, Error>;
3
- static Err<T extends Error = Error>(t: T | string): Result<never, T>;
4
- static Is<T>(t: unknown): t is Result<T>;
5
- isOk(): boolean;
6
- isErr(): boolean;
7
- Ok(): T;
8
- Err(): E;
9
- abstract is_ok(): boolean;
10
- abstract is_err(): boolean;
11
- abstract unwrap(): T;
12
- abstract unwrap_err(): E;
13
- }
14
- export declare class ResultOK<T> extends Result<T, Error> {
15
- private _t;
16
- constructor(t: T);
17
- is_ok(): boolean;
18
- is_err(): boolean;
19
- unwrap_err(): Error;
20
- unwrap(): T;
21
- }
22
- export declare class ResultError<T extends Error> extends Result<never, T> {
23
- private _error;
24
- constructor(t: T);
25
- is_ok(): boolean;
26
- is_err(): boolean;
27
- unwrap(): never;
28
- unwrap_err(): T;
29
- }
30
- export type WithoutResult<T> = T extends Result<infer U> ? U : T;
31
- //# sourceMappingURL=result.d.ts.map
package/result.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA,8BAAsB,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK;IACvC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC;IAGpC,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAMpE,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC;IAIxC,IAAI,IAAI,OAAO;IAGf,KAAK,IAAI,OAAO;IAIhB,EAAE,IAAI,CAAC;IAGP,GAAG,IAAI,CAAC;IAIR,QAAQ,CAAC,KAAK,IAAI,OAAO;IACzB,QAAQ,CAAC,MAAM,IAAI,OAAO;IAC1B,QAAQ,CAAC,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,UAAU,IAAI,CAAC;CACzB;AAED,qBAAa,QAAQ,CAAC,CAAC,CAAE,SAAQ,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC;IAC/C,OAAO,CAAC,EAAE,CAAI;gBACF,CAAC,EAAE,CAAC;IAIhB,KAAK,IAAI,OAAO;IAGhB,MAAM,IAAI,OAAO;IAGjB,UAAU,IAAI,KAAK;IAGnB,MAAM,IAAI,CAAC;CAGZ;AAED,qBAAa,WAAW,CAAC,CAAC,SAAS,KAAK,CAAE,SAAQ,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAChE,OAAO,CAAC,MAAM,CAAI;gBACN,CAAC,EAAE,CAAC;IAIhB,KAAK,IAAI,OAAO;IAGhB,MAAM,IAAI,OAAO;IAGjB,MAAM,IAAI,KAAK;IAGf,UAAU,IAAI,CAAC;CAGhB;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC"}
package/result.js DELETED
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResultError = exports.ResultOK = exports.Result = void 0;
4
- class Result {
5
- static Ok(t) {
6
- return new ResultOK(t);
7
- }
8
- static Err(t) {
9
- if (typeof t === "string") {
10
- return new ResultError(new Error(t));
11
- }
12
- return new ResultError(t);
13
- }
14
- static Is(t) {
15
- return t instanceof Result;
16
- }
17
- isOk() {
18
- return this.is_ok();
19
- }
20
- isErr() {
21
- return this.is_err();
22
- }
23
- Ok() {
24
- return this.unwrap();
25
- }
26
- Err() {
27
- return this.unwrap_err();
28
- }
29
- }
30
- exports.Result = Result;
31
- class ResultOK extends Result {
32
- constructor(t) {
33
- super();
34
- this._t = t;
35
- }
36
- is_ok() {
37
- return true;
38
- }
39
- is_err() {
40
- return false;
41
- }
42
- unwrap_err() {
43
- throw new Error("Result is Ok");
44
- }
45
- unwrap() {
46
- return this._t;
47
- }
48
- }
49
- exports.ResultOK = ResultOK;
50
- class ResultError extends Result {
51
- constructor(t) {
52
- super();
53
- this._error = t;
54
- }
55
- is_ok() {
56
- return false;
57
- }
58
- is_err() {
59
- return true;
60
- }
61
- unwrap() {
62
- throw new Error(`Result is Err: ${this._error}`);
63
- }
64
- unwrap_err() {
65
- return this._error;
66
- }
67
- }
68
- exports.ResultError = ResultError;
69
- //# sourceMappingURL=result.js.map
package/result.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"result.js","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":";;;AAAA,MAAsB,MAAM;IAC1B,MAAM,CAAC,EAAE,CAAI,CAAI;QACf,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,MAAM,CAAC,GAAG,CAA0B,CAAa;QAC/C,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;YAC1B,OAAO,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC,CAAC,CAAM,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACD,MAAM,CAAC,EAAE,CAAI,CAAU;QACrB,OAAO,CAAC,YAAY,MAAM,CAAC;IAC7B,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IACD,KAAK;QACH,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;IAED,EAAE;QACA,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;IACD,GAAG;QACD,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;CAMF;AAhCD,wBAgCC;AAED,MAAa,QAAY,SAAQ,MAAgB;IAE/C,YAAY,CAAI;QACd,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IACd,CAAC;IACD,KAAK;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM;QACJ,OAAO,KAAK,CAAC;IACf,CAAC;IACD,UAAU;QACR,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;IAClC,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;CACF;AAlBD,4BAkBC;AAED,MAAa,WAA6B,SAAQ,MAAgB;IAEhE,YAAY,CAAI;QACd,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC;IACD,KAAK;QACH,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,kBAAkB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAlBD,kCAkBC"}
package/result.test.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=result.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result.test.d.ts","sourceRoot":"","sources":["../src/result.test.ts"],"names":[],"mappings":""}
package/result.test.js DELETED
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const result_1 = require("./result");
4
- it("ResultOk", () => {
5
- const result = result_1.Result.Ok(1);
6
- expect(result.isOk()).toBe(true);
7
- expect(result.is_ok()).toBe(true);
8
- expect(result.Ok()).toBe(1);
9
- expect(result.unwrap()).toBe(1);
10
- expect(result.isErr()).toBe(false);
11
- expect(result.is_err()).toBe(false);
12
- expect(() => result.Err()).toThrow();
13
- expect(() => result.unwrap_err()).toThrow();
14
- });
15
- it("ResultErr", () => {
16
- const result = result_1.Result.Err("xxx");
17
- expect(result.isOk()).toBe(false);
18
- expect(result.is_ok()).toBe(false);
19
- expect(result.Err().message).toEqual("xxx");
20
- expect(result.unwrap_err().message).toBe("xxx");
21
- expect(result.isErr()).toBe(true);
22
- expect(result.is_err()).toBe(true);
23
- expect(() => result.Ok()).toThrow();
24
- expect(() => result.unwrap()).toThrow();
25
- });
26
- class xResult {
27
- }
28
- it("is Result", () => {
29
- expect(result_1.Result.Is(result_1.Result.Ok(1))).toBe(true);
30
- expect(result_1.Result.Is(result_1.Result.Err("xxx"))).toEqual(true);
31
- expect(result_1.Result.Is(new xResult())).toBe(false);
32
- });
33
- it("WithoutResult", () => {
34
- const result = result_1.Result.Ok({ a: 1 });
35
- const a1 = {};
36
- a1.a = 1;
37
- expect(a1.a).toEqual(1);
38
- });
39
- //# sourceMappingURL=result.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result.test.js","sourceRoot":"","sources":["../src/result.test.ts"],"names":[],"mappings":";;AAAA,qCAAiD;AAEjD,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE;IAClB,MAAM,MAAM,GAAG,eAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC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;AAC1C,CAAC,CAAC,CAAC;AAGH,MAAM,OAAO;CAAG;AAChB,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;IACnB,MAAM,CAAC,eAAM,CAAC,EAAE,CAAC,eAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,eAAM,CAAC,EAAE,CAAC,eAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,eAAM,CAAC,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/C,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;IACvB,MAAM,MAAM,GAAG,eAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACnC,MAAM,EAAE,GAA0C,EAAE,CAAC;IACrD,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IACT,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC"}
@@ -1,35 +0,0 @@
1
- import { FileService } from "./file_service";
2
- import { Time } from "./time";
3
- export declare enum TimeMode {
4
- REAL = "real",
5
- CONST = "const",
6
- STEP = "step"
7
- }
8
- export declare enum RandomMode {
9
- CONST = "const",
10
- STEP = "step",
11
- RANDOM = "random"
12
- }
13
- export declare enum IDMode {
14
- UUID = "uuid",
15
- CONST = "const",
16
- STEP = "step"
17
- }
18
- export declare function String2TimeMode(s?: string): TimeMode;
19
- export type VoidFunc = () => void | Promise<void>;
20
- export interface SystemService {
21
- Env(): Record<string, string>;
22
- Args(): string[];
23
- OnExit(hdl: VoidFunc): VoidFunc;
24
- Exit(code: number): void;
25
- }
26
- export interface SysAbstraction {
27
- Time(): Time;
28
- Stdout(): WritableStream<Uint8Array>;
29
- Stderr(): WritableStream<Uint8Array>;
30
- NextId(): string;
31
- Random0ToValue(value: number): number;
32
- System(): SystemService;
33
- FileSystem(): FileService;
34
- }
35
- //# sourceMappingURL=sys_abstraction.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sys_abstraction.d.ts","sourceRoot":"","sources":["../src/sys_abstraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,oBAAY,UAAU;IACpB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED,oBAAY,MAAM;IAChB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,wBAAgB,eAAe,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ,CAWpD;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAElD,MAAM,WAAW,aAAa;IAC5B,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,MAAM,CAAC,GAAG,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAChC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,IAAI,IAAI,CAAC;IACb,MAAM,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC;IACrC,MAAM,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC;IACrC,MAAM,IAAI,MAAM,CAAC;IACjB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,MAAM,IAAI,aAAa,CAAC;IACxB,UAAU,IAAI,WAAW,CAAC;CAC3B"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.String2TimeMode = exports.IDMode = exports.RandomMode = exports.TimeMode = void 0;
4
- var TimeMode;
5
- (function (TimeMode) {
6
- TimeMode["REAL"] = "real";
7
- TimeMode["CONST"] = "const";
8
- TimeMode["STEP"] = "step";
9
- })(TimeMode || (exports.TimeMode = TimeMode = {}));
10
- var RandomMode;
11
- (function (RandomMode) {
12
- RandomMode["CONST"] = "const";
13
- RandomMode["STEP"] = "step";
14
- RandomMode["RANDOM"] = "random";
15
- })(RandomMode || (exports.RandomMode = RandomMode = {}));
16
- var IDMode;
17
- (function (IDMode) {
18
- IDMode["UUID"] = "uuid";
19
- IDMode["CONST"] = "const";
20
- IDMode["STEP"] = "step";
21
- })(IDMode || (exports.IDMode = IDMode = {}));
22
- function String2TimeMode(s) {
23
- switch (s === null || s === void 0 ? void 0 : s.toLowerCase()) {
24
- case "real":
25
- return TimeMode.REAL;
26
- case "const":
27
- return TimeMode.CONST;
28
- case "step":
29
- return TimeMode.STEP;
30
- default:
31
- return TimeMode.REAL;
32
- }
33
- }
34
- exports.String2TimeMode = String2TimeMode;
35
- //# sourceMappingURL=sys_abstraction.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sys_abstraction.js","sourceRoot":"","sources":["../src/sys_abstraction.ts"],"names":[],"mappings":";;;AAGA,IAAY,QAIX;AAJD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,2BAAe,CAAA;IACf,yBAAa,CAAA;AACf,CAAC,EAJW,QAAQ,wBAAR,QAAQ,QAInB;AAED,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,6BAAe,CAAA;IACf,2BAAa,CAAA;IACb,+BAAiB,CAAA;AACnB,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAED,IAAY,MAIX;AAJD,WAAY,MAAM;IAChB,uBAAa,CAAA;IACb,yBAAe,CAAA;IACf,uBAAa,CAAA;AACf,CAAC,EAJW,MAAM,sBAAN,MAAM,QAIjB;AAED,SAAgB,eAAe,CAAC,CAAU;IACxC,QAAQ,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,WAAW,EAAE,EAAE,CAAC;QACzB,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,KAAK,OAAO;YACV,OAAO,QAAQ,CAAC,KAAK,CAAC;QACxB,KAAK,MAAM;YACT,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB;YACE,OAAO,QAAQ,CAAC,IAAI,CAAC;IACzB,CAAC;AACH,CAAC;AAXD,0CAWC"}
@@ -1,22 +0,0 @@
1
- declare class LogWriter implements WritableStreamDefaultWriter<Uint8Array> {
2
- readonly _bufferArr: Uint8Array[];
3
- _resolveClosed: (value?: PromiseLike<undefined>) => void;
4
- closed: Promise<undefined>;
5
- desiredSize: number | null;
6
- ready: Promise<undefined>;
7
- constructor();
8
- abort(reason?: any): Promise<void>;
9
- close(): Promise<void>;
10
- releaseLock(): void;
11
- write(chunk?: Uint8Array): Promise<void>;
12
- }
13
- export declare class LogCollector implements WritableStream<Uint8Array> {
14
- readonly locked: boolean;
15
- _writer?: LogWriter;
16
- abort(reason?: Uint8Array): Promise<void>;
17
- close(): Promise<void>;
18
- getWriter(): WritableStreamDefaultWriter<Uint8Array>;
19
- Logs(): any[];
20
- }
21
- export {};
22
- //# sourceMappingURL=log_collector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"log_collector.d.ts","sourceRoot":"","sources":["../../src/test/log_collector.ts"],"names":[],"mappings":"AAAA,cAAM,SAAU,YAAW,2BAA2B,CAAC,UAAU,CAAC;IAChE,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,CAAM;IAEvC,cAAc,EAAE,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC;IACzD,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAQ;IAClC,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC,CAA8B;;IAYvD,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAGlC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,WAAW,IAAI,IAAI;IAGnB,KAAK,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAIzC;AAED,qBAAa,YAAa,YAAW,cAAc,CAAC,UAAU,CAAC;IAC7D,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAS;IACjC,OAAO,CAAC,EAAE,SAAS,CAAC;IAGpB,KAAK,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAInC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAS5B,SAAS,IAAI,2BAA2B,CAAC,UAAU,CAAC;IAQpD,IAAI,IAAI,GAAG,EAAE;CAkBd"}
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LogCollector = void 0;
4
- class LogWriter {
5
- constructor() {
6
- this._bufferArr = [];
7
- this.desiredSize = null;
8
- this.ready = Promise.resolve(undefined);
9
- this._resolveClosed = () => {
10
- };
11
- this.closed = new Promise((resolve) => {
12
- this._resolveClosed = resolve;
13
- });
14
- }
15
- abort(reason) {
16
- throw new Error("Method not implemented.");
17
- }
18
- close() {
19
- this._resolveClosed();
20
- return Promise.resolve(undefined);
21
- }
22
- releaseLock() {
23
- }
24
- write(chunk) {
25
- chunk && this._bufferArr.push(chunk);
26
- return Promise.resolve(undefined);
27
- }
28
- }
29
- class LogCollector {
30
- constructor() {
31
- this.locked = false;
32
- }
33
- abort(reason) {
34
- throw new Error("Method not implemented.");
35
- }
36
- async close() {
37
- if (this._writer) {
38
- const ret = await this._writer.close();
39
- this._writer = undefined;
40
- return ret;
41
- }
42
- return Promise.resolve(undefined);
43
- }
44
- getWriter() {
45
- if (!this._writer) {
46
- this._writer = new LogWriter();
47
- }
48
- return this._writer;
49
- }
50
- Logs() {
51
- if (!this._writer) {
52
- return [];
53
- }
54
- const jsonNlStr = new TextDecoder().decode(new Uint8Array((function* (res) {
55
- for (const x of res) {
56
- yield* x;
57
- }
58
- })(this._writer._bufferArr)));
59
- const splitStr = jsonNlStr.split("\n");
60
- const filterStr = splitStr.filter((a) => a.length);
61
- const mapStr = filterStr.map((a) => JSON.parse(a));
62
- return mapStr;
63
- }
64
- }
65
- exports.LogCollector = LogCollector;
66
- //# sourceMappingURL=log_collector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"log_collector.js","sourceRoot":"","sources":["../../src/test/log_collector.ts"],"names":[],"mappings":";;;AAAA,MAAM,SAAS;IAQb;QAPS,eAAU,GAAiB,EAAE,CAAC;QAIvC,gBAAW,GAAkB,IAAI,CAAC;QAClC,UAAK,GAAuB,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAGrD,IAAI,CAAC,cAAc,GAAG,GAAG,EAAE;QAE3B,CAAC,CAAC;QACF,IAAI,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACpC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;IAGD,KAAK,CAAC,MAAY;QAChB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK;QACH,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IACD,WAAW;IAEX,CAAC;IACD,KAAK,CAAC,KAAkB;QACtB,KAAK,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,OAAO,CAAC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,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA5CD,oCA4CC"}
@@ -1,13 +0,0 @@
1
- import { Logger } from "../logger";
2
- import { SysAbstraction } from "../sys_abstraction";
3
- import { LogCollector } from "./log_collector";
4
- export interface MockLoggerReturn {
5
- readonly logger: Logger;
6
- readonly logCollector: LogCollector;
7
- }
8
- export declare function MockLogger(params?: {
9
- readonly sys?: SysAbstraction;
10
- moduleName?: string | string[];
11
- readonly disableDebug?: boolean;
12
- }): MockLoggerReturn;
13
- //# sourceMappingURL=mock_logger.d.ts.map