@adviser/cement 0.0.0-jsr-t1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (320) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +39 -0
  3. package/base-sys-abstraction-BkEiLHl0.d.ts +193 -0
  4. package/base-sys-abstraction-Qj7pkY1N.d.cts +193 -0
  5. package/chunk-7KFVMTOS.js +311 -0
  6. package/chunk-7KFVMTOS.js.map +1 -0
  7. package/chunk-GES3MUGV.js +92 -0
  8. package/chunk-GES3MUGV.js.map +1 -0
  9. package/chunk-Q65HLCNL.js +601 -0
  10. package/chunk-Q65HLCNL.js.map +1 -0
  11. package/chunk-WMMUXBDX.js +87 -0
  12. package/chunk-WMMUXBDX.js.map +1 -0
  13. package/index-Q3phXzYr.d.cts +75 -0
  14. package/index-tIGZMHTc.d.ts +75 -0
  15. package/index.cjs +2593 -0
  16. package/index.cjs.map +1 -0
  17. package/index.d.cts +532 -0
  18. package/index.d.ts +532 -0
  19. package/index.js +1533 -0
  20. package/index.js.map +1 -0
  21. package/node/index.cjs +924 -0
  22. package/node/index.cjs.map +1 -0
  23. package/node/index.d.cts +65 -0
  24. package/node/index.d.ts +65 -0
  25. package/node/index.js +398 -0
  26. package/node/index.js.map +1 -0
  27. package/package.json +81 -0
  28. package/src/base-sys-abstraction.test.ts +95 -0
  29. package/src/base-sys-abstraction.ts +242 -0
  30. package/src/bin2text.test.ts +59 -0
  31. package/src/bin2text.ts +47 -0
  32. package/src/crypto.test.ts +15 -0
  33. package/src/crypto.ts +125 -0
  34. package/src/file-service.ts +24 -0
  35. package/src/future.test.ts +32 -0
  36. package/src/future.ts +27 -0
  37. package/src/index.ts +22 -0
  38. package/src/jsr.json +20 -0
  39. package/src/log-level-impl.ts +87 -0
  40. package/src/log-writer-impl.ts +58 -0
  41. package/src/logger-impl.ts +498 -0
  42. package/src/logger.test.ts +1132 -0
  43. package/src/logger.ts +208 -0
  44. package/src/node/deno-file-service.ts +92 -0
  45. package/src/node/deno-sys-abstraction.ts +133 -0
  46. package/src/node/index.ts +4 -0
  47. package/src/node/mock-file-service.ts +45 -0
  48. package/src/node/node-file-service.ts +91 -0
  49. package/src/node/node-sys-abstraction.ts +121 -0
  50. package/src/option.ts +60 -0
  51. package/src/resolve-once.test.ts +321 -0
  52. package/src/resolve-once.ts +179 -0
  53. package/src/result.test.ts +102 -0
  54. package/src/result.ts +165 -0
  55. package/src/runtime.ts +36 -0
  56. package/src/sys-abstraction.ts +53 -0
  57. package/src/sys-env.test.ts +53 -0
  58. package/src/sys-env.ts +216 -0
  59. package/src/test/log-write-stream.ts +95 -0
  60. package/src/test/mock-logger.ts +40 -0
  61. package/src/time.ts +20 -0
  62. package/src/tracer.test.ts +314 -0
  63. package/src/tracer.ts +222 -0
  64. package/src/txt-en-decoder.ts +21 -0
  65. package/src/uri.test.ts +155 -0
  66. package/src/uri.ts +421 -0
  67. package/src/utils/console-write-stream.ts +72 -0
  68. package/src/utils/fanout-write-stream.ts +32 -0
  69. package/src/utils/index.ts +6 -0
  70. package/src/utils/rebuffer.ts +75 -0
  71. package/src/utils/stream-map.ts +67 -0
  72. package/src/utils/stream2string.ts +47 -0
  73. package/src/utils/string2stream.ts +14 -0
  74. package/src/version.ts +3 -0
  75. package/src/web/index.ts +1 -0
  76. package/src/web/web-sys-abstraction.ts +80 -0
  77. package/ts/LICENSE +201 -0
  78. package/ts/README.md +39 -0
  79. package/ts/base-sys-abstraction.d.ts +84 -0
  80. package/ts/base-sys-abstraction.d.ts.map +1 -0
  81. package/ts/base-sys-abstraction.js +178 -0
  82. package/ts/base-sys-abstraction.js.map +1 -0
  83. package/ts/base-sys-abstraction.test.d.ts +2 -0
  84. package/ts/base-sys-abstraction.test.d.ts.map +1 -0
  85. package/ts/base-sys-abstraction.test.js +82 -0
  86. package/ts/base-sys-abstraction.test.js.map +1 -0
  87. package/ts/bin2text.d.ts +3 -0
  88. package/ts/bin2text.d.ts.map +1 -0
  89. package/ts/bin2text.js +43 -0
  90. package/ts/bin2text.js.map +1 -0
  91. package/ts/bin2text.test.d.ts +2 -0
  92. package/ts/bin2text.test.d.ts.map +1 -0
  93. package/ts/bin2text.test.js +51 -0
  94. package/ts/bin2text.test.js.map +1 -0
  95. package/ts/crypto.d.ts +76 -0
  96. package/ts/crypto.d.ts.map +1 -0
  97. package/ts/crypto.js +22 -0
  98. package/ts/crypto.js.map +1 -0
  99. package/ts/crypto.test.d.ts +2 -0
  100. package/ts/crypto.test.d.ts.map +1 -0
  101. package/ts/crypto.test.js +14 -0
  102. package/ts/crypto.test.js.map +1 -0
  103. package/ts/file-service.d.ts +17 -0
  104. package/ts/file-service.d.ts.map +1 -0
  105. package/ts/file-service.js +2 -0
  106. package/ts/file-service.js.map +1 -0
  107. package/ts/future.d.ts +8 -0
  108. package/ts/future.d.ts.map +1 -0
  109. package/ts/future.js +38 -0
  110. package/ts/future.js.map +1 -0
  111. package/ts/future.test.d.ts +2 -0
  112. package/ts/future.test.d.ts.map +1 -0
  113. package/ts/future.test.js +28 -0
  114. package/ts/future.test.js.map +1 -0
  115. package/ts/index.d.ts +23 -0
  116. package/ts/index.d.ts.map +1 -0
  117. package/ts/index.js +23 -0
  118. package/ts/index.js.map +1 -0
  119. package/ts/log-level-impl.d.ts +14 -0
  120. package/ts/log-level-impl.d.ts.map +1 -0
  121. package/ts/log-level-impl.js +72 -0
  122. package/ts/log-level-impl.js.map +1 -0
  123. package/ts/log-writer-impl.d.ts +10 -0
  124. package/ts/log-writer-impl.d.ts.map +1 -0
  125. package/ts/log-writer-impl.js +45 -0
  126. package/ts/log-writer-impl.js.map +1 -0
  127. package/ts/logger-impl.d.ts +71 -0
  128. package/ts/logger-impl.d.ts.map +1 -0
  129. package/ts/logger-impl.js +412 -0
  130. package/ts/logger-impl.js.map +1 -0
  131. package/ts/logger.d.ts +84 -0
  132. package/ts/logger.d.ts.map +1 -0
  133. package/ts/logger.js +114 -0
  134. package/ts/logger.js.map +1 -0
  135. package/ts/logger.test.d.ts +2 -0
  136. package/ts/logger.test.d.ts.map +1 -0
  137. package/ts/logger.test.js +1023 -0
  138. package/ts/logger.test.js.map +1 -0
  139. package/ts/node/deno-file-service.d.ts +17 -0
  140. package/ts/node/deno-file-service.d.ts.map +1 -0
  141. package/ts/node/deno-file-service.js +65 -0
  142. package/ts/node/deno-file-service.js.map +1 -0
  143. package/ts/node/deno-sys-abstraction.d.ts +22 -0
  144. package/ts/node/deno-sys-abstraction.d.ts.map +1 -0
  145. package/ts/node/deno-sys-abstraction.js +101 -0
  146. package/ts/node/deno-sys-abstraction.js.map +1 -0
  147. package/ts/node/index.d.ts +5 -0
  148. package/ts/node/index.d.ts.map +1 -0
  149. package/ts/node/index.js +5 -0
  150. package/ts/node/index.js.map +1 -0
  151. package/ts/node/mock-file-service.d.ts +11 -0
  152. package/ts/node/mock-file-service.d.ts.map +1 -0
  153. package/ts/node/mock-file-service.js +34 -0
  154. package/ts/node/mock-file-service.js.map +1 -0
  155. package/ts/node/mock-file-service.test.d.ts +2 -0
  156. package/ts/node/mock-file-service.test.d.ts.map +1 -0
  157. package/ts/node/mock-file-service.test.js +31 -0
  158. package/ts/node/mock-file-service.test.js.map +1 -0
  159. package/ts/node/node-file-service.d.ts +16 -0
  160. package/ts/node/node-file-service.d.ts.map +1 -0
  161. package/ts/node/node-file-service.js +71 -0
  162. package/ts/node/node-file-service.js.map +1 -0
  163. package/ts/node/node-sys-abstraction.d.ts +22 -0
  164. package/ts/node/node-sys-abstraction.d.ts.map +1 -0
  165. package/ts/node/node-sys-abstraction.js +99 -0
  166. package/ts/node/node-sys-abstraction.js.map +1 -0
  167. package/ts/node/node-sys-abstraction.test.d.ts +2 -0
  168. package/ts/node/node-sys-abstraction.test.d.ts.map +1 -0
  169. package/ts/node/node-sys-abstraction.test.js +87 -0
  170. package/ts/node/node-sys-abstraction.test.js.map +1 -0
  171. package/ts/option.d.ts +25 -0
  172. package/ts/option.d.ts.map +1 -0
  173. package/ts/option.js +47 -0
  174. package/ts/option.js.map +1 -0
  175. package/ts/resolve-once.d.ts +46 -0
  176. package/ts/resolve-once.d.ts.map +1 -0
  177. package/ts/resolve-once.js +152 -0
  178. package/ts/resolve-once.js.map +1 -0
  179. package/ts/resolve-once.test.d.ts +2 -0
  180. package/ts/resolve-once.test.d.ts.map +1 -0
  181. package/ts/resolve-once.test.js +283 -0
  182. package/ts/resolve-once.test.js.map +1 -0
  183. package/ts/result.d.ts +34 -0
  184. package/ts/result.d.ts.map +1 -0
  185. package/ts/result.js +85 -0
  186. package/ts/result.js.map +1 -0
  187. package/ts/result.test.d.ts +2 -0
  188. package/ts/result.test.d.ts.map +1 -0
  189. package/ts/result.test.js +79 -0
  190. package/ts/result.test.js.map +1 -0
  191. package/ts/runtime.d.ts +8 -0
  192. package/ts/runtime.d.ts.map +1 -0
  193. package/ts/runtime.js +26 -0
  194. package/ts/runtime.js.map +1 -0
  195. package/ts/sys-abstraction.d.ts +36 -0
  196. package/ts/sys-abstraction.d.ts.map +1 -0
  197. package/ts/sys-abstraction.js +31 -0
  198. package/ts/sys-abstraction.js.map +1 -0
  199. package/ts/sys-env.d.ts +48 -0
  200. package/ts/sys-env.d.ts.map +1 -0
  201. package/ts/sys-env.js +176 -0
  202. package/ts/sys-env.js.map +1 -0
  203. package/ts/sys-env.test.d.ts +2 -0
  204. package/ts/sys-env.test.d.ts.map +1 -0
  205. package/ts/sys-env.test.js +51 -0
  206. package/ts/sys-env.test.js.map +1 -0
  207. package/ts/test/log-write-stream.d.ts +27 -0
  208. package/ts/test/log-write-stream.d.ts.map +1 -0
  209. package/ts/test/log-write-stream.js +74 -0
  210. package/ts/test/log-write-stream.js.map +1 -0
  211. package/ts/test/mock-logger.d.ts +14 -0
  212. package/ts/test/mock-logger.d.ts.map +1 -0
  213. package/ts/test/mock-logger.js +29 -0
  214. package/ts/test/mock-logger.js.map +1 -0
  215. package/ts/test/mock-logger.test.d.ts +2 -0
  216. package/ts/test/mock-logger.test.d.ts.map +1 -0
  217. package/ts/test/mock-logger.test.js +63 -0
  218. package/ts/test/mock-logger.test.js.map +1 -0
  219. package/ts/test/test-exit-handler.d.ts +2 -0
  220. package/ts/test/test-exit-handler.d.ts.map +1 -0
  221. package/ts/test/test-exit-handler.js +57 -0
  222. package/ts/test/test-exit-handler.js.map +1 -0
  223. package/ts/time.d.ts +13 -0
  224. package/ts/time.d.ts.map +1 -0
  225. package/ts/time.js +14 -0
  226. package/ts/time.js.map +1 -0
  227. package/ts/tracer.d.ts +59 -0
  228. package/ts/tracer.d.ts.map +1 -0
  229. package/ts/tracer.js +148 -0
  230. package/ts/tracer.js.map +1 -0
  231. package/ts/tracer.test.d.ts +2 -0
  232. package/ts/tracer.test.d.ts.map +1 -0
  233. package/ts/tracer.test.js +311 -0
  234. package/ts/tracer.test.js.map +1 -0
  235. package/ts/txt-en-decoder.d.ts +10 -0
  236. package/ts/txt-en-decoder.d.ts.map +1 -0
  237. package/ts/txt-en-decoder.js +15 -0
  238. package/ts/txt-en-decoder.js.map +1 -0
  239. package/ts/uri.d.ts +67 -0
  240. package/ts/uri.d.ts.map +1 -0
  241. package/ts/uri.js +283 -0
  242. package/ts/uri.js.map +1 -0
  243. package/ts/uri.test.d.ts +2 -0
  244. package/ts/uri.test.d.ts.map +1 -0
  245. package/ts/uri.test.js +119 -0
  246. package/ts/uri.test.js.map +1 -0
  247. package/ts/utils/console-write-stream.d.ts +21 -0
  248. package/ts/utils/console-write-stream.d.ts.map +1 -0
  249. package/ts/utils/console-write-stream.js +62 -0
  250. package/ts/utils/console-write-stream.js.map +1 -0
  251. package/ts/utils/fanout-write-stream.d.ts +12 -0
  252. package/ts/utils/fanout-write-stream.d.ts.map +1 -0
  253. package/ts/utils/fanout-write-stream.js +24 -0
  254. package/ts/utils/fanout-write-stream.js.map +1 -0
  255. package/ts/utils/index.d.ts +7 -0
  256. package/ts/utils/index.d.ts.map +1 -0
  257. package/ts/utils/index.js +7 -0
  258. package/ts/utils/index.js.map +1 -0
  259. package/ts/utils/rebuffer.d.ts +3 -0
  260. package/ts/utils/rebuffer.d.ts.map +1 -0
  261. package/ts/utils/rebuffer.js +60 -0
  262. package/ts/utils/rebuffer.js.map +1 -0
  263. package/ts/utils/rebuffer.test.d.ts +2 -0
  264. package/ts/utils/rebuffer.test.d.ts.map +1 -0
  265. package/ts/utils/rebuffer.test.js +77 -0
  266. package/ts/utils/rebuffer.test.js.map +1 -0
  267. package/ts/utils/stream-map.d.ts +9 -0
  268. package/ts/utils/stream-map.d.ts.map +1 -0
  269. package/ts/utils/stream-map.js +62 -0
  270. package/ts/utils/stream-map.js.map +1 -0
  271. package/ts/utils/stream-map.test.d.ts +2 -0
  272. package/ts/utils/stream-map.test.d.ts.map +1 -0
  273. package/ts/utils/stream-map.test.js +87 -0
  274. package/ts/utils/stream-map.test.js.map +1 -0
  275. package/ts/utils/stream-test-helper.d.ts +17 -0
  276. package/ts/utils/stream-test-helper.d.ts.map +1 -0
  277. package/ts/utils/stream-test-helper.js +37 -0
  278. package/ts/utils/stream-test-helper.js.map +1 -0
  279. package/ts/utils/stream2string.d.ts +3 -0
  280. package/ts/utils/stream2string.d.ts.map +1 -0
  281. package/ts/utils/stream2string.js +48 -0
  282. package/ts/utils/stream2string.js.map +1 -0
  283. package/ts/utils/stream2string.test.d.ts +2 -0
  284. package/ts/utils/stream2string.test.d.ts.map +1 -0
  285. package/ts/utils/stream2string.test.js +29 -0
  286. package/ts/utils/stream2string.test.js.map +1 -0
  287. package/ts/utils/string2stream.d.ts +4 -0
  288. package/ts/utils/string2stream.d.ts.map +1 -0
  289. package/ts/utils/string2stream.js +13 -0
  290. package/ts/utils/string2stream.js.map +1 -0
  291. package/ts/utils/string2stream.test.d.ts +2 -0
  292. package/ts/utils/string2stream.test.d.ts.map +1 -0
  293. package/ts/utils/string2stream.test.js +6 -0
  294. package/ts/utils/string2stream.test.js.map +1 -0
  295. package/ts/version.d.ts +2 -0
  296. package/ts/version.d.ts.map +1 -0
  297. package/ts/version.js +4 -0
  298. package/ts/version.js.map +1 -0
  299. package/ts/web/index.d.ts +2 -0
  300. package/ts/web/index.d.ts.map +1 -0
  301. package/ts/web/index.js +2 -0
  302. package/ts/web/index.js.map +1 -0
  303. package/ts/web/web-sys-abstraction.d.ts +4 -0
  304. package/ts/web/web-sys-abstraction.d.ts.map +1 -0
  305. package/ts/web/web-sys-abstraction.js +64 -0
  306. package/ts/web/web-sys-abstraction.js.map +1 -0
  307. package/txt-en-decoder-CZYJUju2.d.cts +11 -0
  308. package/txt-en-decoder-CZYJUju2.d.ts +11 -0
  309. package/utils/index.cjs +341 -0
  310. package/utils/index.cjs.map +1 -0
  311. package/utils/index.d.cts +2 -0
  312. package/utils/index.d.ts +2 -0
  313. package/utils/index.js +32 -0
  314. package/utils/index.js.map +1 -0
  315. package/web/index.cjs +593 -0
  316. package/web/index.cjs.map +1 -0
  317. package/web/index.d.cts +6 -0
  318. package/web/index.d.ts +6 -0
  319. package/web/index.js +9 -0
  320. package/web/index.js.map +1 -0
package/index.d.cts ADDED
@@ -0,0 +1,532 @@
1
+ import { S as SysAbstraction, T as Time } from './base-sys-abstraction-Qj7pkY1N.cjs';
2
+ export { r as BaseSysAbstraction, o as BaseSysAbstractionParams, B as BrowserEnvActions, C as ConstTime, D as Duration, f as Env, d as EnvActions, e as EnvFactoryOpts, h as EnvImpl, E as EnvMap, p as ExitHandler, q as ExitService, F as FileService, I as IDMode, n as IdService, N as NamedWritableStream, O as OnSetItem, R as RandomMode, m as RandomService, k as StepTime, b as String2TimeMode, j as SysTime, c as SystemService, l as TimeFactory, a as TimeMode, i as TimeUnits, V as VoidFunc, s as WrapperSysAbstraction, W as WrapperSysAbstractionParams, g as envFactory } from './base-sys-abstraction-Qj7pkY1N.cjs';
3
+ import { T as TxtEnDecoder } from './txt-en-decoder-CZYJUju2.cjs';
4
+ export { U as Utf8EnDecoder, a as Utf8EnDecoderSingleton } from './txt-en-decoder-CZYJUju2.cjs';
5
+ export { i as utils } from './index-Q3phXzYr.cjs';
6
+
7
+ declare abstract class Result<T, E = Error> {
8
+ static Ok<T = void>(t: T): Result<T, Error>;
9
+ static Err<T, E extends Error = Error>(t: E | string): Result<T, E>;
10
+ static Is<T>(t: unknown): t is Result<T>;
11
+ isOk(): boolean;
12
+ isErr(): boolean;
13
+ Ok(): T;
14
+ Err(): E;
15
+ abstract is_ok(): boolean;
16
+ abstract is_err(): boolean;
17
+ abstract unwrap(): T;
18
+ abstract unwrap_err(): E;
19
+ }
20
+ declare class ResultOK<T> extends Result<T, Error> {
21
+ private _t;
22
+ constructor(t: T);
23
+ is_ok(): boolean;
24
+ is_err(): boolean;
25
+ unwrap_err(): Error;
26
+ unwrap(): T;
27
+ }
28
+ declare class ResultError<T extends Error> extends Result<never, T> {
29
+ private _error;
30
+ constructor(t: T);
31
+ is_ok(): boolean;
32
+ is_err(): boolean;
33
+ unwrap(): never;
34
+ unwrap_err(): T;
35
+ }
36
+ type WithoutResult<T> = T extends Result<infer U> ? U : T;
37
+ type WithResult<T> = T extends Promise<infer U> ? Promise<Result<U>> : Result<T>;
38
+ declare function exception2Result<FN extends () => Promise<T> | T, T>(fn: FN): WithResult<ReturnType<FN>>;
39
+
40
+ type NullOrUndef = null | undefined;
41
+ declare function isURL(value: unknown): value is URL;
42
+ declare class MutableURL extends URL {
43
+ private readonly _sysURL;
44
+ private _protocol;
45
+ private _pathname;
46
+ private _hasHostpart;
47
+ readonly hash: string;
48
+ constructor(urlStr: string);
49
+ clone(): MutableURL;
50
+ get host(): string;
51
+ get port(): string;
52
+ set port(p: string);
53
+ get hostname(): string;
54
+ set hostname(h: string);
55
+ set pathname(p: string);
56
+ get pathname(): string;
57
+ get protocol(): string;
58
+ set protocol(p: string);
59
+ get searchParams(): URLSearchParams;
60
+ toString(): string;
61
+ }
62
+ declare class BuildURI {
63
+ _url: MutableURL;
64
+ private constructor();
65
+ static is(value: unknown): value is BuildURI;
66
+ static from(strURLUri?: CoerceURI, defaultProtocol?: string): BuildURI;
67
+ port(p: string): BuildURI;
68
+ hostname(h: string): BuildURI;
69
+ protocol(p: string): BuildURI;
70
+ pathname(p: string): BuildURI;
71
+ delParam(key: string): BuildURI;
72
+ defParam(key: string, str: string): BuildURI;
73
+ setParam(key: string, str: string): BuildURI;
74
+ hasParam(key: string): boolean;
75
+ getParam(key: string): string | undefined;
76
+ toString(): string;
77
+ toJSON(): string;
78
+ URI(): URI;
79
+ }
80
+ type CoerceURI = string | URI | MutableURL | URL | BuildURI | NullOrUndef;
81
+ declare const protocols: Set<string>;
82
+ declare class URI {
83
+ static protocolHasHostpart(protocol: string): () => void;
84
+ static merge(into: CoerceURI, from: CoerceURI, defaultProtocol?: string): URI;
85
+ static is(value: unknown): value is URI;
86
+ static from(strURLUri?: CoerceURI, defaultProtocol?: string): URI;
87
+ static fromResult(strURLUri?: CoerceURI, defaultProtocol?: string): Result<URI>;
88
+ readonly _url: MutableURL;
89
+ private constructor();
90
+ build(): BuildURI;
91
+ get hostname(): string;
92
+ get port(): string;
93
+ get host(): string;
94
+ get protocol(): string;
95
+ get pathname(): string;
96
+ get getParams(): Iterable<[string, string]>;
97
+ hasParam(key: string): boolean;
98
+ getParam(key: string): string | undefined;
99
+ clone(): URI;
100
+ asURL(): URL;
101
+ toString(): string;
102
+ toJSON(): string;
103
+ }
104
+
105
+ declare enum Level {
106
+ WARN = "warn",
107
+ DEBUG = "debug",
108
+ INFO = "info",
109
+ ERROR = "error"
110
+ }
111
+ type Serialized = string | number | boolean;
112
+ type FnSerialized = () => Serialized | Serialized[];
113
+ declare class LogValue {
114
+ readonly fn: FnSerialized;
115
+ constructor(fn: FnSerialized);
116
+ value(): Serialized | Serialized[];
117
+ toJSON(): Serialized | Serialized[];
118
+ }
119
+ type LogSerializable = Record<string, LogValue | Promise<LogValue>>;
120
+ declare function removeSelfRef(lineEnd?: string): (key: unknown, val: unknown) => unknown;
121
+ declare function asyncLogValue(val: () => Promise<Serialized>): Promise<LogValue>;
122
+ type LogValueArg = LogValue | Serialized | Serialized[] | FnSerialized | undefined | null;
123
+ declare function logValue(val: LogValueArg, state?: Set<unknown>): LogValue;
124
+ interface Sized {
125
+ size: number;
126
+ }
127
+ interface Lengthed {
128
+ length: number;
129
+ }
130
+ type SizeOrLength = Sized | Lengthed;
131
+ interface LogFormatter {
132
+ format(attr: LogSerializable): Uint8Array;
133
+ }
134
+ interface LevelHandler {
135
+ enableLevel(level: Level, ...modules: string[]): void;
136
+ disableLevel(level: Level, ...modules: string[]): void;
137
+ setExposeStack(enable?: boolean): void;
138
+ isStackExposed: boolean;
139
+ setDebug(...modules: (string | string[])[]): void;
140
+ isEnabled(ilevel: unknown, module: unknown): boolean;
141
+ }
142
+ interface LoggerInterface<R> {
143
+ TxtEnDe(): TxtEnDecoder;
144
+ Module(key: string): R;
145
+ EnableLevel(level: Level, ...modules: string[]): R;
146
+ DisableLevel(level: Level, ...modules: string[]): R;
147
+ Attributes(): Record<string, unknown>;
148
+ SetDebug(...modules: (string | string[])[]): R;
149
+ SetExposeStack(enable?: boolean): R;
150
+ SetFormatter(fmt: LogFormatter): R;
151
+ Ref(key: string, action: {
152
+ toString: () => string;
153
+ } | FnSerialized): R;
154
+ Result<T>(key: string, res: Result<T>): R;
155
+ Url(url: CoerceURI, key?: string): R;
156
+ Len(value: unknown, key?: string): R;
157
+ Hash(value: unknown, key?: string): R;
158
+ Str(key: string, value?: string): R;
159
+ Error(): R;
160
+ Warn(): R;
161
+ Debug(): R;
162
+ Log(): R;
163
+ WithLevel(level: Level): R;
164
+ Err(err: unknown | Result<unknown> | Error): R;
165
+ Info(): R;
166
+ Timestamp(): R;
167
+ Any(key: string, value: unknown): R;
168
+ Dur(key: string, nsec: number): R;
169
+ Uint64(key: string, value: number): R;
170
+ Int(key: string, value: number): R;
171
+ Bool(key: string, value: unknown): R;
172
+ }
173
+ declare function IsLogger(obj: unknown): obj is Logger;
174
+ interface WithLogger extends LoggerInterface<WithLogger> {
175
+ Logger(): Logger;
176
+ }
177
+ interface AsError {
178
+ AsError(): Error;
179
+ }
180
+ interface Logger extends LoggerInterface<Logger> {
181
+ With(): WithLogger;
182
+ Msg(...args: string[]): AsError;
183
+ Flush(): Promise<void>;
184
+ }
185
+
186
+ declare class LogWriterStream {
187
+ readonly _out: WritableStream<Uint8Array>;
188
+ readonly _toFlush: (() => Promise<void>)[];
189
+ constructor(out: WritableStream<Uint8Array>);
190
+ write(encoded: Uint8Array): void;
191
+ _flushIsRunning: boolean;
192
+ _flushDoneFns: (() => void)[];
193
+ _flush(toFlush?: (() => Promise<void>)[] | undefined, done?: () => void): void;
194
+ }
195
+
196
+ declare class JSONFormatter implements LogFormatter {
197
+ private readonly _txtEnDe;
198
+ private readonly _space?;
199
+ constructor(txtEnde: TxtEnDecoder, space?: number);
200
+ format(attr: LogSerializable): Uint8Array;
201
+ }
202
+ declare class YAMLFormatter implements LogFormatter {
203
+ private readonly _txtEnDe;
204
+ private readonly _space?;
205
+ constructor(txtEnde: TxtEnDecoder, space?: number);
206
+ format(attr: LogSerializable): Uint8Array;
207
+ }
208
+ interface LoggerImplParams {
209
+ readonly out?: WritableStream<Uint8Array>;
210
+ readonly logWriter?: LogWriterStream;
211
+ readonly sys?: SysAbstraction;
212
+ readonly withAttributes?: LogSerializable;
213
+ readonly levelHandler?: LevelHandler;
214
+ readonly txtEnDe?: TxtEnDecoder;
215
+ readonly formatter?: LogFormatter;
216
+ }
217
+ declare class LoggerImpl implements Logger {
218
+ readonly _sys: SysAbstraction;
219
+ readonly _attributes: LogSerializable;
220
+ readonly _withAttributes: LogSerializable;
221
+ readonly _logWriter: LogWriterStream;
222
+ readonly _levelHandler: LevelHandler;
223
+ readonly _txtEnDe: TxtEnDecoder;
224
+ _formatter: LogFormatter;
225
+ constructor(params?: LoggerImplParams);
226
+ TxtEnDe(): TxtEnDecoder;
227
+ Attributes(): Record<string, unknown>;
228
+ SetExposeStack(enable?: boolean): Logger;
229
+ EnableLevel(level: Level, ...modules: string[]): Logger;
230
+ DisableLevel(level: Level, ...modules: string[]): Logger;
231
+ Module(key: string): Logger;
232
+ SetDebug(...modules: (string | string[])[]): Logger;
233
+ SetFormatter(formatter: LogFormatter): Logger;
234
+ Timestamp(): Logger;
235
+ Warn(): Logger;
236
+ Log(): Logger;
237
+ Debug(): Logger;
238
+ Error(): Logger;
239
+ Info(): Logger;
240
+ Err(err: unknown | Result<unknown> | Error): Logger;
241
+ WithLevel(l: Level): Logger;
242
+ Ref(key: string, action: {
243
+ toString: () => string;
244
+ } | FnSerialized): Logger;
245
+ Bool(key: string, value: unknown): Logger;
246
+ Result<T>(key: string, res: Result<T, Error>): Logger;
247
+ Len(value: unknown, key?: string): Logger;
248
+ Hash(value: unknown, key?: string): Logger;
249
+ Url(url: CoerceURI, key?: string): Logger;
250
+ Str(key: string, value?: string): Logger;
251
+ Any(key: string, value?: string | number | boolean | LogSerializable): Logger;
252
+ Dur(key: string, nsec: number): Logger;
253
+ Uint64(key: string, value: number): Logger;
254
+ Int(key: string, value: number): Logger;
255
+ Flush(): Promise<void>;
256
+ With(): WithLogger;
257
+ _resetAttributes(fn: () => () => Uint8Array): () => Uint8Array;
258
+ Msg(...args: string[]): AsError;
259
+ }
260
+
261
+ declare class Future<T> {
262
+ #private;
263
+ constructor();
264
+ asPromise(): Promise<T>;
265
+ resolve(value: T): void;
266
+ reject(reason: unknown): void;
267
+ }
268
+
269
+ declare class LogWriteStream implements WritableStreamDefaultWriter<Uint8Array> {
270
+ private readonly _bufferArr;
271
+ constructor(bufferArr: Uint8Array[]);
272
+ readonly _resolveClosed: Future<undefined>;
273
+ readonly closed: Promise<undefined>;
274
+ readonly desiredSize: number | null;
275
+ readonly ready: Promise<undefined>;
276
+ abort(reason?: any): Promise<void>;
277
+ close(): Promise<void>;
278
+ releaseLock(): void;
279
+ write(chunk?: Uint8Array): Promise<void>;
280
+ }
281
+ declare class LogCollector implements WritableStream<Uint8Array> {
282
+ readonly locked: boolean;
283
+ private _writer?;
284
+ private readonly _pass?;
285
+ private readonly _bufferArr;
286
+ private readonly _txtEnDe;
287
+ constructor(pass?: WritableStreamDefaultWriter<Uint8Array>, txtEnDe?: TxtEnDecoder);
288
+ abort(reason?: Uint8Array): Promise<void>;
289
+ close(): Promise<void>;
290
+ getWriter(): WritableStreamDefaultWriter<Uint8Array>;
291
+ Logs(notJsonLine?: boolean): any[];
292
+ }
293
+
294
+ interface MockLoggerReturn {
295
+ readonly logger: Logger;
296
+ readonly logCollector: LogCollector;
297
+ }
298
+ declare function MockLogger(params?: {
299
+ readonly sys?: SysAbstraction;
300
+ readonly pass?: WritableStreamDefaultWriter<Uint8Array>;
301
+ moduleName?: string | string[];
302
+ readonly disableDebug?: boolean;
303
+ }): MockLoggerReturn;
304
+
305
+ declare class LevelHandlerImpl implements LevelHandler {
306
+ readonly _globalLevels: Set<Level>;
307
+ readonly _modules: Map<string, Set<Level>>;
308
+ isStackExposed: boolean;
309
+ enableLevel(level: Level, ...modules: string[]): void;
310
+ disableLevel(level: Level, ...modules: string[]): void;
311
+ setExposeStack(enable?: boolean): void;
312
+ forModules(level: Level, fnAction: (p: string) => void, ...modules: (string | string[])[]): void;
313
+ setDebug(...modules: (string | string[])[]): void;
314
+ isEnabled(ilevel: unknown, module: unknown): boolean;
315
+ }
316
+ declare function LevelHandlerSingleton(): LevelHandler;
317
+
318
+ declare abstract class Option<T> {
319
+ static Some<T>(t: T): Option<T>;
320
+ static None<T>(): Option<T>;
321
+ static Is<T>(t: unknown): t is Option<T>;
322
+ IsNone(): boolean;
323
+ IsSome(): boolean;
324
+ Unwrap(): T;
325
+ abstract is_none(): boolean;
326
+ abstract is_some(): boolean;
327
+ abstract unwrap(): T;
328
+ }
329
+ declare class Some<T> extends Option<T> {
330
+ private _t;
331
+ constructor(_t: T);
332
+ is_none(): boolean;
333
+ is_some(): boolean;
334
+ unwrap(): T;
335
+ }
336
+ declare class None<T> extends Option<T> {
337
+ is_none(): boolean;
338
+ is_some(): boolean;
339
+ unwrap(): T;
340
+ }
341
+ type WithoutOption<T> = T extends Option<infer U> ? U : T;
342
+
343
+ type TraceCtx = {
344
+ readonly spanId: string;
345
+ readonly time: Time;
346
+ readonly parent: TraceNode;
347
+ readonly metrics: Map<string, Metric<unknown>>;
348
+ readonly logger?: Logger;
349
+ } & Record<string, unknown>;
350
+ type CleanCtx = {
351
+ readonly spanId: string;
352
+ } & Record<string, unknown>;
353
+ type TraceCtxParam = {
354
+ readonly spanId: string;
355
+ } & Partial<{
356
+ readonly time: Time;
357
+ readonly parent: TraceNode;
358
+ readonly logger: Logger;
359
+ }> & Record<string, unknown>;
360
+ declare class Metric<T> {
361
+ value?: T;
362
+ readonly path: string;
363
+ constructor(path: string);
364
+ set(value: T): void;
365
+ add<R extends number | ArrayLike<T>>(value: R): void;
366
+ }
367
+ type MetricMap = Map<string, Metric<unknown>>;
368
+ declare class Metrics {
369
+ readonly tracenode: TraceNode;
370
+ private readonly map;
371
+ readonly spanRefs: MetricMap;
372
+ constructor(tracenode: TraceNode);
373
+ toJSON(): Record<string, unknown>;
374
+ get<T>(ipath: string): Metric<T>;
375
+ }
376
+ interface Invokaction {
377
+ readonly result: "success" | "error";
378
+ readonly start: number;
379
+ readonly end: number;
380
+ readonly metrics?: Metrics;
381
+ }
382
+ type TraceNodeMap = Map<string, TraceNode>;
383
+ declare class TraceNode {
384
+ readonly childs: TraceNodeMap;
385
+ readonly invokations: Invokaction[];
386
+ readonly spanId: string;
387
+ readonly ctx: TraceCtx;
388
+ readonly metrics: Metrics;
389
+ static root(time: Time, logger?: Logger): TraceNode;
390
+ constructor(ctx: TraceCtx);
391
+ getRootPath(rpath?: string[]): string;
392
+ invokes(): {
393
+ ctx: CleanCtx;
394
+ invokations: Invokaction[];
395
+ };
396
+ ctxWith(spanId: string, logger?: Logger): TraceCtxParam;
397
+ span<V extends (trace: TraceNode) => Promise<T> | T, T>(inSpanId: string | TraceCtxParam, fn: V): ReturnType<V>;
398
+ }
399
+
400
+ interface ResolveSeqItem<T, C> {
401
+ readonly future: Future<T>;
402
+ readonly fn: (c: C) => Promise<T>;
403
+ readonly id?: number;
404
+ }
405
+ declare class ResolveSeq<T, C = void> {
406
+ readonly ctx: C;
407
+ constructor(ctx?: C);
408
+ reset(): void;
409
+ _step(item?: ResolveSeqItem<T, C> | undefined): Promise<void>;
410
+ readonly _seqFutures: ResolveSeqItem<T, C>[];
411
+ add(fn: (c: C) => Promise<T>, id?: number): Promise<T>;
412
+ }
413
+ declare class ResolveOnce<T, CTX = void> {
414
+ _onceDone: boolean;
415
+ readonly _onceFutures: Future<T>[];
416
+ _onceOk: boolean;
417
+ _onceValue?: T;
418
+ _onceError?: Error;
419
+ _isPromise: boolean;
420
+ readonly ctx: CTX;
421
+ constructor(ctx?: CTX);
422
+ get ready(): boolean;
423
+ reset(): void;
424
+ once<R>(fn: (c: CTX) => R): R;
425
+ }
426
+ declare class Keyed<T extends {
427
+ reset: () => void;
428
+ }, K = string> {
429
+ private readonly _map;
430
+ readonly factory: (key: K) => T;
431
+ constructor(factory: (key: K) => T);
432
+ asyncGet(key: () => Promise<K>): Promise<T>;
433
+ get(key: K | (() => K)): T;
434
+ unget(key: K): void;
435
+ reset(): void;
436
+ }
437
+ declare class KeyedResolvOnce<T, K = string> extends Keyed<ResolveOnce<T, K>, K> {
438
+ constructor();
439
+ }
440
+ declare class KeyedResolvSeq<T, K = string> extends Keyed<ResolveSeq<T, K>, K> {
441
+ constructor();
442
+ }
443
+
444
+ interface Runtime {
445
+ isNodeIsh: boolean;
446
+ isBrowser: boolean;
447
+ isDeno: boolean;
448
+ isReactNative: boolean;
449
+ }
450
+ declare function runtimeFn(): Runtime;
451
+
452
+ interface CTJsonWebKey {
453
+ alg?: string;
454
+ crv?: string;
455
+ d?: string;
456
+ dp?: string;
457
+ dq?: string;
458
+ e?: string;
459
+ ext?: boolean;
460
+ k?: string;
461
+ key_ops?: string[];
462
+ kty?: string;
463
+ n?: string;
464
+ oth?: RsaOtherPrimesInfo[];
465
+ p?: string;
466
+ q?: string;
467
+ qi?: string;
468
+ use?: string;
469
+ x?: string;
470
+ y?: string;
471
+ }
472
+ type CTKeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
473
+ type CTKeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey";
474
+ interface CTAlgorithm {
475
+ name: string;
476
+ }
477
+ type CTAlgorithmIdentifier = CTAlgorithm | string;
478
+ interface CTRsaHashedImportParams extends CTAlgorithm {
479
+ hash: CTAlgorithmIdentifier;
480
+ }
481
+ type CTNamedCurve = string;
482
+ interface CTEcKeyImportParams extends CTAlgorithm {
483
+ namedCurve: CTNamedCurve;
484
+ }
485
+ interface CTHmacImportParams extends CTAlgorithm {
486
+ hash: CTAlgorithmIdentifier;
487
+ length?: number;
488
+ }
489
+ interface CTAesKeyAlgorithm extends CTAlgorithm {
490
+ length: number;
491
+ }
492
+ type CTKeyType = "private" | "public" | "secret";
493
+ interface CTCryptoKey {
494
+ readonly algorithm: CTAlgorithm;
495
+ readonly extractable: boolean;
496
+ readonly type: CTKeyType;
497
+ readonly usages: CTKeyUsage[];
498
+ }
499
+ interface CTArrayBufferTypes {
500
+ ArrayBuffer: ArrayBuffer;
501
+ }
502
+ type CTArrayBufferLike = CTArrayBufferTypes[keyof CTArrayBufferTypes];
503
+ interface CTArrayBufferView {
504
+ buffer: CTArrayBufferLike;
505
+ byteLength: number;
506
+ byteOffset: number;
507
+ }
508
+ type CTBufferSource = CTArrayBufferView | ArrayBuffer;
509
+ interface CryptoRuntime {
510
+ importKey(format: CTKeyFormat, keyData: CTJsonWebKey | CTBufferSource, algorithm: CTAlgorithmIdentifier | CTRsaHashedImportParams | CTEcKeyImportParams | CTHmacImportParams | CTAesKeyAlgorithm, extractable: boolean, keyUsages: CTKeyUsage[]): Promise<CTCryptoKey>;
511
+ exportKey(format: CTKeyFormat, key: CTCryptoKey): Promise<CTJsonWebKey | ArrayBuffer>;
512
+ decrypt(algo: {
513
+ name: string;
514
+ iv: Uint8Array;
515
+ tagLength: number;
516
+ }, key: CTCryptoKey, data: Uint8Array): Promise<ArrayBuffer>;
517
+ encrypt(algo: {
518
+ name: string;
519
+ iv: Uint8Array;
520
+ tagLength: number;
521
+ }, key: CTCryptoKey, data: Uint8Array): Promise<ArrayBuffer>;
522
+ digestSHA256(data: Uint8Array): Promise<ArrayBuffer>;
523
+ randomBytes(size: number): Uint8Array;
524
+ }
525
+ declare function toCryptoRuntime(cryptoOpts?: Partial<CryptoRuntime>): CryptoRuntime;
526
+
527
+ declare function bin2text(hex: ArrayBufferView, lineFn: (line: string) => void, size?: number): void;
528
+ declare function bin2string(hex: ArrayBufferView, size?: number): string;
529
+
530
+ declare const VERSION: string;
531
+
532
+ export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CleanCtx, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, type Invokaction, IsLogger, JSONFormatter, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LevelHandlerSingleton, LogCollector, type LogFormatter, type LogSerializable, LogValue, type LogValueArg, LogWriteStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, Metric, type MetricMap, Metrics, MockLogger, type MockLoggerReturn, MutableURL, None, Option, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, Time, type TraceCtx, type TraceCtxParam, TraceNode, type TraceNodeMap, TxtEnDecoder, URI, VERSION, type WithLogger, type WithoutOption, type WithoutResult, YAMLFormatter, asyncLogValue, bin2string, bin2text, exception2Result, isURL, logValue, protocols, removeSelfRef, runtimeFn, toCryptoRuntime };