@adviser/cement 0.1.11 → 0.1.13

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 +986 -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 +610 -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
package/index.js CHANGED
@@ -1,27 +1,611 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./file_service"), exports);
18
- __exportStar(require("./logger_impl"), exports);
19
- __exportStar(require("./logger"), exports);
20
- __exportStar(require("./sys_abstraction"), exports);
21
- __exportStar(require("./time"), exports);
22
- __exportStar(require("./test/log_collector"), exports);
23
- __exportStar(require("./test/mock_logger"), exports);
24
- __exportStar(require("./result"), exports);
25
- __exportStar(require("./option"), exports);
26
- __exportStar(require("./future"), exports);
1
+ import {
2
+ WebSysAbstraction
3
+ } from "./chunk-MWAFFTM4.js";
4
+ import {
5
+ IDMode,
6
+ RandomMode,
7
+ String2TimeMode,
8
+ Time,
9
+ TimeMode,
10
+ TimeUnits
11
+ } from "./chunk-PZTL4UNG.js";
12
+ import {
13
+ __privateAdd,
14
+ __privateGet,
15
+ __privateSet,
16
+ __spreadValues,
17
+ __yieldStar
18
+ } from "./chunk-J2IM7FHM.js";
19
+
20
+ // src/logger.ts
21
+ var Level = /* @__PURE__ */ ((Level2) => {
22
+ Level2["WARN"] = "warn";
23
+ Level2["DEBUG"] = "debug";
24
+ Level2["INFO"] = "info";
25
+ Level2["ERROR"] = "error";
26
+ return Level2;
27
+ })(Level || {});
28
+
29
+ // src/logger_impl.ts
30
+ var encoder = new TextEncoder();
31
+ var LevelHandlerImpl = class {
32
+ constructor() {
33
+ this._globalLevels = /* @__PURE__ */ new Set(["info" /* INFO */, "error" /* ERROR */, "warn" /* WARN */]);
34
+ this._modules = /* @__PURE__ */ new Map();
35
+ }
36
+ enableLevel(level, ...modules) {
37
+ if (modules.length == 0) {
38
+ this._globalLevels.add(level);
39
+ return;
40
+ }
41
+ this.forModules(
42
+ level,
43
+ (p) => {
44
+ this._modules.set(p, /* @__PURE__ */ new Set([...this._globalLevels, level]));
45
+ },
46
+ ...modules
47
+ );
48
+ }
49
+ disableLevel(level, ...modules) {
50
+ if (modules.length == 0) {
51
+ this._globalLevels.delete(level);
52
+ return;
53
+ }
54
+ this.forModules(
55
+ level,
56
+ (p) => {
57
+ this._modules.delete(p);
58
+ },
59
+ ...modules
60
+ );
61
+ }
62
+ forModules(level, fnAction, ...modules) {
63
+ for (const m of modules.flat()) {
64
+ const parts = m.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
65
+ for (const p of parts) {
66
+ fnAction(p);
67
+ }
68
+ }
69
+ }
70
+ setDebug(...modules) {
71
+ this.forModules(
72
+ "debug" /* DEBUG */,
73
+ (p) => {
74
+ this._modules.set(p, /* @__PURE__ */ new Set([...this._globalLevels, "debug" /* DEBUG */]));
75
+ },
76
+ ...modules
77
+ );
78
+ }
79
+ isEnabled(ilevel, module) {
80
+ const level = ilevel;
81
+ if (module !== void 0) {
82
+ const levels = this._modules.get(module);
83
+ if (levels && levels.has(level)) {
84
+ return true;
85
+ }
86
+ }
87
+ if (level === void 0) {
88
+ return true;
89
+ }
90
+ return this._globalLevels.has(level);
91
+ }
92
+ };
93
+ var levelSingleton = new LevelHandlerImpl();
94
+ var LogWriter = class {
95
+ constructor(out) {
96
+ this._toFlush = [];
97
+ this._flushIsRunning = false;
98
+ this._flushDoneFns = Array();
99
+ this._out = out;
100
+ }
101
+ write(encoded) {
102
+ const my = async () => {
103
+ try {
104
+ const writer = this._out.getWriter();
105
+ await writer.ready;
106
+ await writer.write(encoded);
107
+ await writer.releaseLock();
108
+ } catch (err) {
109
+ console.error("Chunk error:", err);
110
+ }
111
+ };
112
+ this._toFlush.push(my);
113
+ this._flush();
114
+ }
115
+ _flush(toFlush = void 0, done) {
116
+ if (done) {
117
+ this._flushDoneFns.push(done);
118
+ }
119
+ if (this._toFlush.length == 0) {
120
+ this._flushIsRunning = false;
121
+ this._flushDoneFns.forEach((fn) => fn());
122
+ this._flushDoneFns = [];
123
+ return;
124
+ }
125
+ if (!toFlush && this._toFlush.length == 1 && !this._flushIsRunning) {
126
+ this._flushIsRunning = true;
127
+ } else if (!toFlush) {
128
+ return;
129
+ }
130
+ const my = this._toFlush.shift();
131
+ my == null ? void 0 : my().finally(() => {
132
+ this._flush(this._toFlush);
133
+ });
134
+ }
135
+ };
136
+ var LoggerImpl = class _LoggerImpl {
137
+ // readonly _id: string = "logger-" + Math.random().toString(36)
138
+ constructor(params) {
139
+ this._attributes = {};
140
+ if (!params) {
141
+ params = {};
142
+ }
143
+ if (!params.sys) {
144
+ this._sys = WebSysAbstraction();
145
+ } else {
146
+ this._sys = params.sys;
147
+ }
148
+ if (params.logWriter) {
149
+ this._logWriter = params.logWriter;
150
+ } else {
151
+ if (!params.out) {
152
+ this._logWriter = new LogWriter(this._sys.Stdout());
153
+ } else {
154
+ this._logWriter = new LogWriter(params.out);
155
+ }
156
+ }
157
+ if (!params.withAttributes) {
158
+ this._withAttributes = {};
159
+ } else {
160
+ this._withAttributes = __spreadValues({}, params.withAttributes);
161
+ }
162
+ this._attributes = __spreadValues({}, this._withAttributes);
163
+ if (params.levelHandler) {
164
+ this._levelHandler = params.levelHandler;
165
+ } else {
166
+ this._levelHandler = levelSingleton;
167
+ }
168
+ }
169
+ EnableLevel(level, ...modules) {
170
+ this._levelHandler.enableLevel(level, ...modules);
171
+ return this;
172
+ }
173
+ DisableLevel(level, ...modules) {
174
+ this._levelHandler.disableLevel(level, ...modules);
175
+ return this;
176
+ }
177
+ Module(key) {
178
+ this._attributes["module"] = key;
179
+ this._withAttributes["module"] = key;
180
+ return this;
181
+ }
182
+ SetDebug(...modules) {
183
+ this._levelHandler.setDebug(...modules);
184
+ return this;
185
+ }
186
+ Timestamp() {
187
+ this._attributes["ts"] = this._sys.Time().Now().toISOString();
188
+ return this;
189
+ }
190
+ Warn() {
191
+ this._attributes["level"] = "warn" /* WARN */;
192
+ return this;
193
+ }
194
+ Log() {
195
+ return this;
196
+ }
197
+ Debug() {
198
+ this._attributes["level"] = "debug" /* DEBUG */;
199
+ return this;
200
+ }
201
+ Error() {
202
+ this._attributes["level"] = "error" /* ERROR */;
203
+ return this;
204
+ }
205
+ Info() {
206
+ this._attributes["level"] = "info" /* INFO */;
207
+ return this;
208
+ }
209
+ Err(err) {
210
+ if (err instanceof Error) {
211
+ this._attributes["error"] = err.message;
212
+ } else {
213
+ this._attributes["error"] = "" + err;
214
+ }
215
+ return this;
216
+ }
217
+ WithLevel(l) {
218
+ this._attributes["level"] = l;
219
+ return this;
220
+ }
221
+ Str(key, value) {
222
+ this._attributes[key] = value;
223
+ return this;
224
+ }
225
+ Any(key, value) {
226
+ this._attributes[key] = value;
227
+ return this;
228
+ }
229
+ Dur(key, nsec) {
230
+ this._attributes[key] = `${nsec}ms`;
231
+ return this;
232
+ }
233
+ Uint64(key, value) {
234
+ this._attributes[key] = value;
235
+ return this;
236
+ }
237
+ async Flush() {
238
+ return new Promise((resolve) => {
239
+ this._logWriter._flush(void 0, resolve);
240
+ });
241
+ }
242
+ With() {
243
+ return new WithLoggerBuilder(
244
+ new _LoggerImpl({
245
+ logWriter: this._logWriter,
246
+ sys: this._sys,
247
+ levelHandler: this._levelHandler,
248
+ withAttributes: __spreadValues({
249
+ module: this._attributes["module"]
250
+ }, this._withAttributes)
251
+ })
252
+ );
253
+ }
254
+ _resetAttributes(fn) {
255
+ const ret = fn();
256
+ Object.keys(this._attributes).forEach((key) => {
257
+ delete this._attributes[key];
258
+ });
259
+ Object.assign(this._attributes, this._withAttributes);
260
+ return ret;
261
+ }
262
+ Msg(...args) {
263
+ const error = this._resetAttributes(() => {
264
+ const doWrite = this._levelHandler.isEnabled(this._attributes["level"], this._attributes["module"]);
265
+ this._attributes["msg"] = args.join(" ");
266
+ if (typeof this._attributes["msg"] === "string" && !this._attributes["msg"].trim().length) {
267
+ delete this._attributes["msg"];
268
+ }
269
+ if (this._attributes["ts"] === "ETERNITY") {
270
+ this.Timestamp();
271
+ }
272
+ const str = JSON.stringify(this._attributes);
273
+ if (doWrite) {
274
+ const encoded = encoder.encode(str + "\n");
275
+ this._logWriter.write(encoded);
276
+ }
277
+ return new Error(str);
278
+ });
279
+ return {
280
+ AsError: () => error
281
+ };
282
+ }
283
+ };
284
+ var WithLoggerBuilder = class {
285
+ constructor(li) {
286
+ this._li = li;
287
+ }
288
+ Logger() {
289
+ Object.assign(this._li._withAttributes, this._li._attributes);
290
+ return this._li;
291
+ }
292
+ EnableLevel(level, ...modules) {
293
+ this._li._levelHandler.enableLevel(level, ...modules);
294
+ return this;
295
+ }
296
+ DisableLevel(level, ...modules) {
297
+ this._li._levelHandler.enableLevel(level, ...modules);
298
+ return this;
299
+ }
300
+ Module(key) {
301
+ this._li.Module(key);
302
+ return this;
303
+ }
304
+ SetDebug(...modules) {
305
+ this._li.SetDebug(...modules);
306
+ return this;
307
+ }
308
+ Str(key, value) {
309
+ this._li.Str(key, value);
310
+ return this;
311
+ }
312
+ Log() {
313
+ this._li.Log();
314
+ return this;
315
+ }
316
+ WithLevel(level) {
317
+ this._li.WithLevel(level);
318
+ return this;
319
+ }
320
+ Error() {
321
+ this._li.Error();
322
+ return this;
323
+ }
324
+ Warn() {
325
+ this._li.Error();
326
+ return this;
327
+ }
328
+ Debug() {
329
+ this._li.Debug();
330
+ return this;
331
+ }
332
+ Err(err) {
333
+ this._li.Err(err);
334
+ return this;
335
+ }
336
+ Info() {
337
+ this._li.Info();
338
+ return this;
339
+ }
340
+ Timestamp() {
341
+ this._li._attributes["ts"] = "ETERNITY";
342
+ return this;
343
+ }
344
+ Any(key, value) {
345
+ this._li.Any(key, value);
346
+ return this;
347
+ }
348
+ Dur(key, nsec) {
349
+ this._li.Dur(key, nsec);
350
+ return this;
351
+ }
352
+ Uint64(key, value) {
353
+ this._li.Uint64(key, value);
354
+ return this;
355
+ }
356
+ };
357
+
358
+ // src/test/log_collector.ts
359
+ var LogWriter2 = class {
360
+ constructor() {
361
+ this._bufferArr = [];
362
+ this.desiredSize = null;
363
+ this.ready = Promise.resolve(void 0);
364
+ this._resolveClosed = () => {
365
+ };
366
+ this.closed = new Promise((resolve) => {
367
+ this._resolveClosed = resolve;
368
+ });
369
+ }
370
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
371
+ abort(reason) {
372
+ throw new Error("Method not implemented.");
373
+ }
374
+ close() {
375
+ this._resolveClosed();
376
+ return Promise.resolve(void 0);
377
+ }
378
+ releaseLock() {
379
+ }
380
+ write(chunk) {
381
+ chunk && this._bufferArr.push(chunk);
382
+ return Promise.resolve(void 0);
383
+ }
384
+ };
385
+ var LogCollector = class {
386
+ constructor() {
387
+ this.locked = false;
388
+ }
389
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
390
+ abort(reason) {
391
+ throw new Error("Method not implemented.");
392
+ }
393
+ async close() {
394
+ if (this._writer) {
395
+ const ret = await this._writer.close();
396
+ this._writer = void 0;
397
+ return ret;
398
+ }
399
+ return Promise.resolve(void 0);
400
+ }
401
+ getWriter() {
402
+ if (!this._writer) {
403
+ this._writer = new LogWriter2();
404
+ }
405
+ return this._writer;
406
+ }
407
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
408
+ Logs() {
409
+ if (!this._writer) {
410
+ return [];
411
+ }
412
+ const jsonNlStr = new TextDecoder().decode(
413
+ new Uint8Array(
414
+ function* (res) {
415
+ for (const x of res) {
416
+ yield* __yieldStar(x);
417
+ }
418
+ }(this._writer._bufferArr)
419
+ )
420
+ );
421
+ const splitStr = jsonNlStr.split("\n");
422
+ const filterStr = splitStr.filter((a) => a.length);
423
+ const mapStr = filterStr.map((a) => JSON.parse(a));
424
+ return mapStr;
425
+ }
426
+ };
427
+
428
+ // src/test/mock_logger.ts
429
+ function MockLogger(params) {
430
+ const lc = new LogCollector();
431
+ let modNames = ["MockLogger"];
432
+ if (typeof (params == null ? void 0 : params.moduleName) === "string") {
433
+ modNames = [params == null ? void 0 : params.moduleName];
434
+ } else if (Array.isArray(params == null ? void 0 : params.moduleName)) {
435
+ modNames = [...params.moduleName, ...modNames];
436
+ }
437
+ const logger = new LoggerImpl({
438
+ out: lc,
439
+ sys: params == null ? void 0 : params.sys,
440
+ levelHandler: new LevelHandlerImpl()
441
+ }).With().Module(modNames[0]).Logger();
442
+ !(params == null ? void 0 : params.disableDebug) && logger.SetDebug(...modNames);
443
+ return {
444
+ logCollector: lc,
445
+ logger
446
+ };
447
+ }
448
+
449
+ // src/result.ts
450
+ var Result = class _Result {
451
+ static Ok(t) {
452
+ return new ResultOK(t);
453
+ }
454
+ static Err(t) {
455
+ if (typeof t === "string") {
456
+ return new ResultError(new Error(t));
457
+ }
458
+ return new ResultError(t);
459
+ }
460
+ static Is(t) {
461
+ return t instanceof _Result;
462
+ }
463
+ isOk() {
464
+ return this.is_ok();
465
+ }
466
+ isErr() {
467
+ return this.is_err();
468
+ }
469
+ Ok() {
470
+ return this.unwrap();
471
+ }
472
+ Err() {
473
+ return this.unwrap_err();
474
+ }
475
+ };
476
+ var ResultOK = class extends Result {
477
+ constructor(t) {
478
+ super();
479
+ this._t = t;
480
+ }
481
+ is_ok() {
482
+ return true;
483
+ }
484
+ is_err() {
485
+ return false;
486
+ }
487
+ unwrap_err() {
488
+ throw new Error("Result is Ok");
489
+ }
490
+ unwrap() {
491
+ return this._t;
492
+ }
493
+ };
494
+ var ResultError = class extends Result {
495
+ constructor(t) {
496
+ super();
497
+ this._error = t;
498
+ }
499
+ is_ok() {
500
+ return false;
501
+ }
502
+ is_err() {
503
+ return true;
504
+ }
505
+ unwrap() {
506
+ throw new Error(`Result is Err: ${this._error}`);
507
+ }
508
+ unwrap_err() {
509
+ return this._error;
510
+ }
511
+ };
512
+
513
+ // src/option.ts
514
+ var Option = class _Option {
515
+ static Some(t) {
516
+ return new Some(t);
517
+ }
518
+ static None() {
519
+ return new None();
520
+ }
521
+ static Is(t) {
522
+ return t instanceof _Option;
523
+ }
524
+ IsNone() {
525
+ return this.is_none();
526
+ }
527
+ IsSome() {
528
+ return this.is_some();
529
+ }
530
+ Unwrap() {
531
+ return this.unwrap();
532
+ }
533
+ };
534
+ var Some = class extends Option {
535
+ constructor(_t) {
536
+ super();
537
+ this._t = _t;
538
+ }
539
+ is_none() {
540
+ return false;
541
+ }
542
+ is_some() {
543
+ return true;
544
+ }
545
+ unwrap() {
546
+ return this._t;
547
+ }
548
+ };
549
+ var None = class extends Option {
550
+ is_none() {
551
+ return true;
552
+ }
553
+ is_some() {
554
+ return false;
555
+ }
556
+ unwrap() {
557
+ throw new Error("None.unwrap");
558
+ }
559
+ };
560
+
561
+ // src/future.ts
562
+ var _promise, _resolveFn, _rejectFn;
563
+ var Future = class {
564
+ constructor() {
565
+ __privateAdd(this, _promise);
566
+ __privateAdd(this, _resolveFn, () => {
567
+ throw new Error("This Promise is not working as expected.");
568
+ });
569
+ __privateAdd(this, _rejectFn, () => {
570
+ throw new Error("This Promise is not working as expected.");
571
+ });
572
+ __privateSet(this, _promise, new Promise((resolve, reject) => {
573
+ __privateSet(this, _resolveFn, resolve);
574
+ __privateSet(this, _rejectFn, reject);
575
+ }));
576
+ }
577
+ async asPromise() {
578
+ return __privateGet(this, _promise);
579
+ }
580
+ resolve(value) {
581
+ __privateGet(this, _resolveFn).call(this, value);
582
+ }
583
+ reject(reason) {
584
+ __privateGet(this, _rejectFn).call(this, reason);
585
+ }
586
+ };
587
+ _promise = new WeakMap();
588
+ _resolveFn = new WeakMap();
589
+ _rejectFn = new WeakMap();
590
+ export {
591
+ Future,
592
+ IDMode,
593
+ Level,
594
+ LevelHandlerImpl,
595
+ LogCollector,
596
+ LogWriter,
597
+ LoggerImpl,
598
+ MockLogger,
599
+ None,
600
+ Option,
601
+ RandomMode,
602
+ Result,
603
+ ResultError,
604
+ ResultOK,
605
+ Some,
606
+ String2TimeMode,
607
+ Time,
608
+ TimeMode,
609
+ TimeUnits
610
+ };
27
611
  //# sourceMappingURL=index.js.map