@adviser/cement 0.4.7 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (505) hide show
  1. package/base-basic-sys-abstraction.test.d.ts +2 -0
  2. package/base-basic-sys-abstraction.test.d.ts.map +1 -0
  3. package/base-basic-sys-abstraction.test.js +88 -0
  4. package/base-basic-sys-abstraction.test.js.map +1 -0
  5. package/{base-sys-abstraction-h0dB3nZ5.d.ts → base-sys-abstraction.d.ts} +23 -22
  6. package/base-sys-abstraction.d.ts.map +1 -0
  7. package/base-sys-abstraction.js +193 -0
  8. package/base-sys-abstraction.js.map +1 -0
  9. package/bin2text.d.ts +3 -0
  10. package/bin2text.d.ts.map +1 -0
  11. package/bin2text.js +43 -0
  12. package/bin2text.js.map +1 -0
  13. package/bin2text.test.d.ts +2 -0
  14. package/bin2text.test.d.ts.map +1 -0
  15. package/bin2text.test.js +51 -0
  16. package/bin2text.test.js.map +1 -0
  17. package/cf/cf-basic-sys-abstraction.d.ts +14 -0
  18. package/cf/cf-basic-sys-abstraction.d.ts.map +1 -0
  19. package/cf/cf-basic-sys-abstraction.js +67 -0
  20. package/cf/cf-basic-sys-abstraction.js.map +1 -0
  21. package/cf/cf-env-actions.d.ts +16 -0
  22. package/cf/cf-env-actions.d.ts.map +1 -0
  23. package/cf/cf-env-actions.js +53 -0
  24. package/cf/cf-env-actions.js.map +1 -0
  25. package/cf/index.d.ts +3 -30
  26. package/cf/index.d.ts.map +1 -0
  27. package/cf/index.js +2 -11
  28. package/cf/index.js.map +1 -1
  29. package/cf-test-main.d.ts +5 -0
  30. package/cf-test-main.d.ts.map +1 -0
  31. package/cf-test-main.js +12 -0
  32. package/cf-test-main.js.map +1 -0
  33. package/coerce-binary.d.ts +6 -0
  34. package/coerce-binary.d.ts.map +1 -0
  35. package/coerce-binary.js +32 -0
  36. package/coerce-binary.js.map +1 -0
  37. package/coerce-binary.test.d.ts +2 -0
  38. package/coerce-binary.test.d.ts.map +1 -0
  39. package/coerce-binary.test.js +39 -0
  40. package/coerce-binary.test.js.map +1 -0
  41. package/crypto.d.ts +76 -0
  42. package/crypto.d.ts.map +1 -0
  43. package/crypto.js +22 -0
  44. package/crypto.js.map +1 -0
  45. package/crypto.test.d.ts +2 -0
  46. package/crypto.test.d.ts.map +1 -0
  47. package/crypto.test.js +21 -0
  48. package/crypto.test.js.map +1 -0
  49. package/deno/deno-basic-sys-abstraction.d.ts +14 -0
  50. package/deno/deno-basic-sys-abstraction.d.ts.map +1 -0
  51. package/deno/deno-basic-sys-abstraction.js +35 -0
  52. package/deno/deno-basic-sys-abstraction.js.map +1 -0
  53. package/deno/deno-env-actions.d.ts +23 -0
  54. package/deno/deno-env-actions.d.ts.map +1 -0
  55. package/deno/deno-env-actions.js +40 -0
  56. package/deno/deno-env-actions.js.map +1 -0
  57. package/deno/deno-file-service.d.ts +17 -0
  58. package/deno/deno-file-service.d.ts.map +1 -0
  59. package/deno/deno-file-service.js +67 -0
  60. package/deno/deno-file-service.js.map +1 -0
  61. package/deno/deno-sys-abstraction.d.ts +19 -0
  62. package/deno/deno-sys-abstraction.d.ts.map +1 -0
  63. package/deno/deno-sys-abstraction.js +96 -0
  64. package/deno/deno-sys-abstraction.js.map +1 -0
  65. package/deno/index.d.ts +3 -37
  66. package/deno/index.d.ts.map +1 -0
  67. package/deno/index.js +2 -179
  68. package/deno/index.js.map +1 -1
  69. package/file-service.d.ts +17 -0
  70. package/file-service.d.ts.map +1 -0
  71. package/file-service.js +2 -0
  72. package/file-service.js.map +1 -0
  73. package/future.d.ts +8 -0
  74. package/future.d.ts.map +1 -0
  75. package/future.js +25 -0
  76. package/future.js.map +1 -0
  77. package/future.test.d.ts +2 -0
  78. package/future.test.d.ts.map +1 -0
  79. package/future.test.js +32 -0
  80. package/future.test.js.map +1 -0
  81. package/http_header.d.ts +29 -0
  82. package/http_header.d.ts.map +1 -0
  83. package/http_header.js +157 -0
  84. package/http_header.js.map +1 -0
  85. package/http_header.test.d.ts +2 -0
  86. package/http_header.test.d.ts.map +1 -0
  87. package/http_header.test.js +96 -0
  88. package/http_header.test.js.map +1 -0
  89. package/index.d.ts +29 -396
  90. package/index.d.ts.map +1 -0
  91. package/index.js +28 -609
  92. package/index.js.map +1 -1
  93. package/is-promise.d.ts +4 -0
  94. package/is-promise.d.ts.map +1 -0
  95. package/is-promise.js +10 -0
  96. package/is-promise.js.map +1 -0
  97. package/is-promise.test.d.ts +2 -0
  98. package/is-promise.test.d.ts.map +1 -0
  99. package/is-promise.test.js +48 -0
  100. package/is-promise.test.js.map +1 -0
  101. package/json-en-decoder.d.ts +12 -0
  102. package/json-en-decoder.d.ts.map +1 -0
  103. package/json-en-decoder.js +42 -0
  104. package/json-en-decoder.js.map +1 -0
  105. package/json-en-decoder.test.d.ts +2 -0
  106. package/json-en-decoder.test.d.ts.map +1 -0
  107. package/json-en-decoder.test.js +18 -0
  108. package/json-en-decoder.test.js.map +1 -0
  109. package/log-level-impl.d.ts +17 -0
  110. package/log-level-impl.d.ts.map +1 -0
  111. package/log-level-impl.js +75 -0
  112. package/log-level-impl.js.map +1 -0
  113. package/log-writer-impl.d.ts +11 -0
  114. package/log-writer-impl.d.ts.map +1 -0
  115. package/log-writer-impl.js +52 -0
  116. package/log-writer-impl.js.map +1 -0
  117. package/logger-impl.d.ts +75 -0
  118. package/logger-impl.d.ts.map +1 -0
  119. package/logger-impl.js +505 -0
  120. package/logger-impl.js.map +1 -0
  121. package/logger.d.ts +97 -0
  122. package/logger.d.ts.map +1 -0
  123. package/logger.js +150 -0
  124. package/logger.js.map +1 -0
  125. package/logger.test.d.ts +2 -0
  126. package/logger.test.d.ts.map +1 -0
  127. package/logger.test.js +1577 -0
  128. package/logger.test.js.map +1 -0
  129. package/lru-map-set.d.ts +33 -0
  130. package/lru-map-set.d.ts.map +1 -0
  131. package/lru-map-set.js +116 -0
  132. package/lru-map-set.js.map +1 -0
  133. package/lru-map-set.test.d.ts +2 -0
  134. package/lru-map-set.test.d.ts.map +1 -0
  135. package/lru-map-set.test.js +81 -0
  136. package/lru-map-set.test.js.map +1 -0
  137. package/node/index.d.ts +4 -45
  138. package/node/index.d.ts.map +1 -0
  139. package/node/index.js +3 -222
  140. package/node/index.js.map +1 -1
  141. package/node/mock-file-service.d.ts +11 -0
  142. package/node/mock-file-service.d.ts.map +1 -0
  143. package/node/mock-file-service.js +31 -0
  144. package/node/mock-file-service.js.map +1 -0
  145. package/node/mock-file-service.test.d.ts +2 -0
  146. package/node/mock-file-service.test.d.ts.map +1 -0
  147. package/node/mock-file-service.test.js +31 -0
  148. package/node/mock-file-service.test.js.map +1 -0
  149. package/node/node-basic-sys-abstraction.d.ts +25 -0
  150. package/node/node-basic-sys-abstraction.d.ts.map +1 -0
  151. package/node/node-basic-sys-abstraction.js +45 -0
  152. package/node/node-basic-sys-abstraction.js.map +1 -0
  153. package/node/node-env-actions.d.ts +15 -0
  154. package/node/node-env-actions.d.ts.map +1 -0
  155. package/node/node-env-actions.js +38 -0
  156. package/node/node-env-actions.js.map +1 -0
  157. package/node/node-file-service.d.ts +16 -0
  158. package/node/node-file-service.d.ts.map +1 -0
  159. package/node/node-file-service.js +72 -0
  160. package/node/node-file-service.js.map +1 -0
  161. package/node/node-sys-abstraction.d.ts +19 -0
  162. package/node/node-sys-abstraction.d.ts.map +1 -0
  163. package/node/node-sys-abstraction.js +95 -0
  164. package/node/node-sys-abstraction.js.map +1 -0
  165. package/node/node-sys-abstraction.test.d.ts +2 -0
  166. package/node/node-sys-abstraction.test.d.ts.map +1 -0
  167. package/node/node-sys-abstraction.test.js +83 -0
  168. package/node/node-sys-abstraction.test.js.map +1 -0
  169. package/option.d.ts +26 -0
  170. package/option.d.ts.map +1 -0
  171. package/option.js +54 -0
  172. package/option.js.map +1 -0
  173. package/package.json +4 -10
  174. package/path-ops.d.ts +7 -0
  175. package/path-ops.d.ts.map +1 -0
  176. package/path-ops.js +35 -0
  177. package/path-ops.js.map +1 -0
  178. package/path-ops.test.d.ts +2 -0
  179. package/path-ops.test.d.ts.map +1 -0
  180. package/path-ops.test.js +39 -0
  181. package/path-ops.test.js.map +1 -0
  182. package/resolve-once.d.ts +59 -0
  183. package/resolve-once.d.ts.map +1 -0
  184. package/resolve-once.js +212 -0
  185. package/resolve-once.js.map +1 -0
  186. package/resolve-once.test.d.ts +2 -0
  187. package/resolve-once.test.d.ts.map +1 -0
  188. package/resolve-once.test.js +392 -0
  189. package/resolve-once.test.js.map +1 -0
  190. package/result.d.ts +34 -0
  191. package/result.d.ts.map +1 -0
  192. package/result.js +94 -0
  193. package/result.js.map +1 -0
  194. package/result.test.d.ts +2 -0
  195. package/result.test.d.ts.map +1 -0
  196. package/result.test.js +83 -0
  197. package/result.test.js.map +1 -0
  198. package/runtime.d.ts +9 -0
  199. package/runtime.d.ts.map +1 -0
  200. package/runtime.js +33 -0
  201. package/runtime.js.map +1 -0
  202. package/src/jsr.json +1 -1
  203. package/src/uri.ts +62 -37
  204. package/sys-abstraction.d.ts +43 -0
  205. package/sys-abstraction.d.ts.map +1 -0
  206. package/sys-abstraction.js +28 -0
  207. package/sys-abstraction.js.map +1 -0
  208. package/sys-env.d.ts +46 -0
  209. package/sys-env.d.ts.map +1 -0
  210. package/sys-env.js +161 -0
  211. package/sys-env.js.map +1 -0
  212. package/sys-env.test.d.ts +2 -0
  213. package/sys-env.test.d.ts.map +1 -0
  214. package/sys-env.test.js +170 -0
  215. package/sys-env.test.js.map +1 -0
  216. package/test/index.d.ts +3 -4
  217. package/test/index.d.ts.map +1 -0
  218. package/test/index.js +2 -13
  219. package/test/index.js.map +1 -1
  220. package/test/log-write-stream.d.ts +27 -0
  221. package/test/log-write-stream.d.ts.map +1 -0
  222. package/test/log-write-stream.js +78 -0
  223. package/test/log-write-stream.js.map +1 -0
  224. package/test/mock-logger.d.ts +14 -0
  225. package/test/mock-logger.d.ts.map +1 -0
  226. package/test/mock-logger.js +29 -0
  227. package/test/mock-logger.js.map +1 -0
  228. package/test/mock-logger.test.d.ts +2 -0
  229. package/test/mock-logger.test.d.ts.map +1 -0
  230. package/test/mock-logger.test.js +63 -0
  231. package/test/mock-logger.test.js.map +1 -0
  232. package/test/test-exit-handler.d.ts +2 -0
  233. package/test/test-exit-handler.d.ts.map +1 -0
  234. package/test/test-exit-handler.js +61 -0
  235. package/test/test-exit-handler.js.map +1 -0
  236. package/time.d.ts +14 -0
  237. package/time.d.ts.map +1 -0
  238. package/time.js +13 -0
  239. package/time.js.map +1 -0
  240. package/tracer.d.ts +59 -0
  241. package/tracer.d.ts.map +1 -0
  242. package/tracer.js +174 -0
  243. package/tracer.js.map +1 -0
  244. package/tracer.test.d.ts +2 -0
  245. package/tracer.test.d.ts.map +1 -0
  246. package/tracer.test.js +304 -0
  247. package/tracer.test.js.map +1 -0
  248. package/ts/smoke/smoke.js +1 -1
  249. package/ts/smoke/smoke.js.map +1 -1
  250. package/ts/src/base-sys-abstraction.js +20 -8
  251. package/ts/src/base-sys-abstraction.js.map +1 -1
  252. package/ts/src/cf/cf-basic-sys-abstraction.js +3 -3
  253. package/ts/src/cf/cf-basic-sys-abstraction.js.map +1 -1
  254. package/ts/src/cf/cf-env-actions.js +3 -1
  255. package/ts/src/cf/cf-env-actions.js.map +1 -1
  256. package/ts/src/coerce-binary.js +1 -1
  257. package/ts/src/coerce-binary.js.map +1 -1
  258. package/ts/src/deno/deno-basic-sys-abstraction.js +3 -3
  259. package/ts/src/deno/deno-basic-sys-abstraction.js.map +1 -1
  260. package/ts/src/deno/deno-env-actions.js +3 -9
  261. package/ts/src/deno/deno-env-actions.js.map +1 -1
  262. package/ts/src/deno/deno-file-service.js +2 -0
  263. package/ts/src/deno/deno-file-service.js.map +1 -1
  264. package/ts/src/deno/deno-sys-abstraction.js +21 -21
  265. package/ts/src/deno/deno-sys-abstraction.js.map +1 -1
  266. package/ts/src/future.js +13 -26
  267. package/ts/src/future.js.map +1 -1
  268. package/ts/src/http_header.js +2 -3
  269. package/ts/src/http_header.js.map +1 -1
  270. package/ts/src/json-en-decoder.js +3 -2
  271. package/ts/src/json-en-decoder.js.map +1 -1
  272. package/ts/src/log-level-impl.js +4 -6
  273. package/ts/src/log-level-impl.js.map +1 -1
  274. package/ts/src/log-writer-impl.js +9 -5
  275. package/ts/src/log-writer-impl.js.map +1 -1
  276. package/ts/src/logger-impl.js +15 -5
  277. package/ts/src/logger-impl.js.map +1 -1
  278. package/ts/src/logger.js +3 -3
  279. package/ts/src/logger.js.map +1 -1
  280. package/ts/src/logger.test.js +7 -19
  281. package/ts/src/logger.test.js.map +1 -1
  282. package/ts/src/lru-map-set.js +3 -1
  283. package/ts/src/lru-map-set.js.map +1 -1
  284. package/ts/src/node/mock-file-service.js +1 -4
  285. package/ts/src/node/mock-file-service.js.map +1 -1
  286. package/ts/src/node/node-basic-sys-abstraction.js +4 -3
  287. package/ts/src/node/node-basic-sys-abstraction.js.map +1 -1
  288. package/ts/src/node/node-env-actions.js +3 -9
  289. package/ts/src/node/node-env-actions.js.map +1 -1
  290. package/ts/src/node/node-file-service.js +1 -0
  291. package/ts/src/node/node-file-service.js.map +1 -1
  292. package/ts/src/node/node-sys-abstraction.js +21 -21
  293. package/ts/src/node/node-sys-abstraction.js.map +1 -1
  294. package/ts/src/option.js +1 -0
  295. package/ts/src/option.js.map +1 -1
  296. package/ts/src/path-ops.js +21 -30
  297. package/ts/src/path-ops.js.map +1 -1
  298. package/ts/src/resolve-once.js +17 -13
  299. package/ts/src/resolve-once.js.map +1 -1
  300. package/ts/src/result.js +2 -0
  301. package/ts/src/result.js.map +1 -1
  302. package/ts/src/sys-abstraction.js +1 -1
  303. package/ts/src/sys-abstraction.js.map +1 -1
  304. package/ts/src/sys-env.js +2 -1
  305. package/ts/src/sys-env.js.map +1 -1
  306. package/ts/src/sys-env.test.js +6 -19
  307. package/ts/src/sys-env.test.js.map +1 -1
  308. package/ts/src/test/log-write-stream.js +10 -6
  309. package/ts/src/test/log-write-stream.js.map +1 -1
  310. package/ts/src/test/mock-logger.js +6 -6
  311. package/ts/src/test/mock-logger.js.map +1 -1
  312. package/ts/src/test/test-exit-handler.js +1 -2
  313. package/ts/src/test/test-exit-handler.js.map +1 -1
  314. package/ts/src/tracer.js +10 -3
  315. package/ts/src/tracer.js.map +1 -1
  316. package/ts/src/tracer.test.js +5 -9
  317. package/ts/src/tracer.test.js.map +1 -1
  318. package/ts/src/txt-en-decoder.js +2 -4
  319. package/ts/src/txt-en-decoder.js.map +1 -1
  320. package/ts/src/types.js +2 -6
  321. package/ts/src/types.js.map +1 -1
  322. package/ts/src/uri.d.ts +4 -0
  323. package/ts/src/uri.d.ts.map +1 -1
  324. package/ts/src/uri.js +54 -34
  325. package/ts/src/uri.js.map +1 -1
  326. package/ts/src/uri.test.js +27 -0
  327. package/ts/src/uri.test.js.map +1 -1
  328. package/ts/src/utils/console-write-stream.js +8 -5
  329. package/ts/src/utils/console-write-stream.js.map +1 -1
  330. package/ts/src/utils/fanout-write-stream.js +4 -1
  331. package/ts/src/utils/fanout-write-stream.js.map +1 -1
  332. package/ts/src/utils/rebuffer.test.js +1 -1
  333. package/ts/src/utils/rebuffer.test.js.map +1 -1
  334. package/ts/src/utils/relative-path.js +1 -0
  335. package/ts/src/utils/relative-path.js.map +1 -1
  336. package/ts/src/utils/stream-map.test.js +1 -1
  337. package/ts/src/utils/stream-map.test.js.map +1 -1
  338. package/ts/src/web/web-basic-sys-abstraction.js +3 -3
  339. package/ts/src/web/web-basic-sys-abstraction.js.map +1 -1
  340. package/ts/src/web/web-env-actions.js +2 -1
  341. package/ts/src/web/web-env-actions.js.map +1 -1
  342. package/txt-en-decoder.d.ts +11 -0
  343. package/txt-en-decoder.d.ts.map +1 -0
  344. package/txt-en-decoder.js +37 -0
  345. package/txt-en-decoder.js.map +1 -0
  346. package/txt-en-decoder.test.d.ts +2 -0
  347. package/txt-en-decoder.test.d.ts.map +1 -0
  348. package/txt-en-decoder.test.js +48 -0
  349. package/txt-en-decoder.test.js.map +1 -0
  350. package/types.d.ts +16 -0
  351. package/types.d.ts.map +1 -0
  352. package/types.js +11 -0
  353. package/types.js.map +1 -0
  354. package/uri.d.ts +137 -0
  355. package/uri.d.ts.map +1 -0
  356. package/uri.js +567 -0
  357. package/uri.js.map +1 -0
  358. package/uri.test.d.ts +2 -0
  359. package/uri.test.d.ts.map +1 -0
  360. package/uri.test.js +633 -0
  361. package/uri.test.js.map +1 -0
  362. package/utils/coerce-uint8.d.ts +8 -0
  363. package/utils/coerce-uint8.d.ts.map +1 -0
  364. package/utils/coerce-uint8.js +34 -0
  365. package/utils/coerce-uint8.js.map +1 -0
  366. package/utils/console-write-stream.d.ts +21 -0
  367. package/utils/console-write-stream.d.ts.map +1 -0
  368. package/utils/console-write-stream.js +66 -0
  369. package/utils/console-write-stream.js.map +1 -0
  370. package/utils/fanout-write-stream.d.ts +12 -0
  371. package/utils/fanout-write-stream.d.ts.map +1 -0
  372. package/utils/fanout-write-stream.js +27 -0
  373. package/utils/fanout-write-stream.js.map +1 -0
  374. package/utils/get-params-result.d.ts +8 -0
  375. package/utils/get-params-result.d.ts.map +1 -0
  376. package/utils/get-params-result.js +45 -0
  377. package/utils/get-params-result.js.map +1 -0
  378. package/utils/index.d.ts +12 -3
  379. package/utils/index.d.ts.map +1 -0
  380. package/utils/index.js +11 -50
  381. package/utils/index.js.map +1 -1
  382. package/utils/rebuffer.d.ts +3 -0
  383. package/utils/rebuffer.d.ts.map +1 -0
  384. package/utils/rebuffer.js +66 -0
  385. package/utils/rebuffer.js.map +1 -0
  386. package/utils/rebuffer.test.d.ts +2 -0
  387. package/utils/rebuffer.test.d.ts.map +1 -0
  388. package/utils/rebuffer.test.js +77 -0
  389. package/utils/rebuffer.test.js.map +1 -0
  390. package/utils/relative-path.d.ts +18 -0
  391. package/utils/relative-path.d.ts.map +1 -0
  392. package/utils/relative-path.js +148 -0
  393. package/utils/relative-path.js.map +1 -0
  394. package/utils/relative-path.test.d.ts +2 -0
  395. package/utils/relative-path.test.d.ts.map +1 -0
  396. package/utils/relative-path.test.js +187 -0
  397. package/utils/relative-path.test.js.map +1 -0
  398. package/utils/sorted-objec.test.d.ts +2 -0
  399. package/utils/sorted-objec.test.d.ts.map +1 -0
  400. package/utils/sorted-objec.test.js +20 -0
  401. package/utils/sorted-objec.test.js.map +1 -0
  402. package/utils/sorted-object.d.ts +4 -0
  403. package/utils/sorted-object.d.ts.map +1 -0
  404. package/utils/sorted-object.js +16 -0
  405. package/utils/sorted-object.js.map +1 -0
  406. package/utils/stream-map.d.ts +9 -0
  407. package/utils/stream-map.d.ts.map +1 -0
  408. package/utils/stream-map.js +63 -0
  409. package/utils/stream-map.js.map +1 -0
  410. package/utils/stream-map.test.d.ts +2 -0
  411. package/utils/stream-map.test.d.ts.map +1 -0
  412. package/utils/stream-map.test.js +87 -0
  413. package/utils/stream-map.test.js.map +1 -0
  414. package/utils/stream-test-helper.d.ts +17 -0
  415. package/utils/stream-test-helper.d.ts.map +1 -0
  416. package/utils/stream-test-helper.js +45 -0
  417. package/utils/stream-test-helper.js.map +1 -0
  418. package/utils/stream2string.d.ts +3 -0
  419. package/utils/stream2string.d.ts.map +1 -0
  420. package/utils/stream2string.js +48 -0
  421. package/utils/stream2string.js.map +1 -0
  422. package/utils/stream2string.test.d.ts +2 -0
  423. package/utils/stream2string.test.d.ts.map +1 -0
  424. package/utils/stream2string.test.js +29 -0
  425. package/utils/stream2string.test.js.map +1 -0
  426. package/utils/string2stream.d.ts +4 -0
  427. package/utils/string2stream.d.ts.map +1 -0
  428. package/utils/string2stream.js +13 -0
  429. package/utils/string2stream.js.map +1 -0
  430. package/utils/string2stream.test.d.ts +2 -0
  431. package/utils/string2stream.test.d.ts.map +1 -0
  432. package/utils/string2stream.test.js +6 -0
  433. package/utils/string2stream.test.js.map +1 -0
  434. package/utils/stripper.d.ts +3 -0
  435. package/utils/stripper.d.ts.map +1 -0
  436. package/utils/stripper.js +59 -0
  437. package/utils/stripper.js.map +1 -0
  438. package/utils/stripper.test.d.ts +2 -0
  439. package/utils/stripper.test.d.ts.map +1 -0
  440. package/utils/stripper.test.js +128 -0
  441. package/utils/stripper.test.js.map +1 -0
  442. package/utils/uint8array-equal.d.ts +2 -0
  443. package/utils/uint8array-equal.d.ts.map +1 -0
  444. package/utils/uint8array-equal.js +12 -0
  445. package/utils/uint8array-equal.js.map +1 -0
  446. package/version.d.ts +2 -0
  447. package/version.d.ts.map +1 -0
  448. package/version.js +4 -0
  449. package/version.js.map +1 -0
  450. package/web/index.d.ts +2 -7
  451. package/web/index.d.ts.map +1 -0
  452. package/web/index.js +1 -7
  453. package/web/index.js.map +1 -1
  454. package/web/web-basic-sys-abstraction.d.ts +4 -0
  455. package/web/web-basic-sys-abstraction.d.ts.map +1 -0
  456. package/web/web-basic-sys-abstraction.js +45 -0
  457. package/web/web-basic-sys-abstraction.js.map +1 -0
  458. package/web/web-env-actions.d.ts +14 -0
  459. package/web/web-env-actions.d.ts.map +1 -0
  460. package/web/web-env-actions.js +36 -0
  461. package/web/web-env-actions.js.map +1 -0
  462. package/base-sys-abstraction-DgTynXGV.d.cts +0 -95
  463. package/cf/index.cjs +0 -1110
  464. package/cf/index.cjs.map +0 -1
  465. package/cf/index.d.cts +0 -30
  466. package/chunk-2DWEYXJH.js +0 -1681
  467. package/chunk-2DWEYXJH.js.map +0 -1
  468. package/chunk-FOALXQST.js +0 -89
  469. package/chunk-FOALXQST.js.map +0 -1
  470. package/chunk-FURW5CDL.js +0 -792
  471. package/chunk-FURW5CDL.js.map +0 -1
  472. package/chunk-NJMNJYN2.js +0 -270
  473. package/chunk-NJMNJYN2.js.map +0 -1
  474. package/chunk-NTOGMD33.js +0 -684
  475. package/chunk-NTOGMD33.js.map +0 -1
  476. package/deno/index.cjs +0 -1280
  477. package/deno/index.cjs.map +0 -1
  478. package/deno/index.d.cts +0 -37
  479. package/get-params-result-4xHM5s4_.d.cts +0 -71
  480. package/get-params-result-4xHM5s4_.d.ts +0 -71
  481. package/index-CMLb7JSe.d.ts +0 -97
  482. package/index-DH243CLH.d.cts +0 -297
  483. package/index-LQOsS7gM.d.cts +0 -97
  484. package/index-RMC1sv15.d.ts +0 -297
  485. package/index.cjs +0 -4009
  486. package/index.cjs.map +0 -1
  487. package/index.d.cts +0 -396
  488. package/metafile-cjs.json +0 -1
  489. package/metafile-esm.json +0 -1
  490. package/node/index.cjs +0 -1335
  491. package/node/index.cjs.map +0 -1
  492. package/node/index.d.cts +0 -45
  493. package/stripper-BpBUUZ9p.d.cts +0 -4
  494. package/stripper-BpBUUZ9p.d.ts +0 -4
  495. package/sys-abstraction-CeAxxg9H.d.ts +0 -117
  496. package/sys-abstraction-DDAwGTnk.d.cts +0 -117
  497. package/test/index.cjs +0 -2994
  498. package/test/index.cjs.map +0 -1
  499. package/test/index.d.cts +0 -4
  500. package/utils/index.cjs +0 -778
  501. package/utils/index.cjs.map +0 -1
  502. package/utils/index.d.cts +0 -3
  503. package/web/index.cjs +0 -1153
  504. package/web/index.cjs.map +0 -1
  505. package/web/index.d.cts +0 -7
package/chunk-2DWEYXJH.js DELETED
@@ -1,1681 +0,0 @@
1
- import {
2
- FanoutWriteStream,
3
- stripper
4
- } from "./chunk-FOALXQST.js";
5
- import {
6
- BasicSysAbstractionFactory
7
- } from "./chunk-FURW5CDL.js";
8
- import {
9
- Future,
10
- Result,
11
- TxtEnDecoderSingleton,
12
- exception2Result,
13
- getParamsResult,
14
- isPromise
15
- } from "./chunk-NTOGMD33.js";
16
-
17
- // src/test/log-write-stream.ts
18
- var LogWriteStream = class {
19
- constructor(bufferArr) {
20
- this._resolveClosed = new Future();
21
- this.closed = this._resolveClosed.asPromise();
22
- this.desiredSize = null;
23
- this.ready = Promise.resolve(void 0);
24
- this._bufferArr = bufferArr;
25
- }
26
- // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
27
- abort(reason) {
28
- throw new Error("Method not implemented.");
29
- }
30
- async close() {
31
- await this.closed;
32
- return Promise.resolve(void 0);
33
- }
34
- releaseLock() {
35
- }
36
- async write(chunk) {
37
- if (chunk) {
38
- this._bufferArr.push(chunk);
39
- }
40
- return Promise.resolve(void 0);
41
- }
42
- };
43
- var LogCollector = class {
44
- constructor(pass, txtEnDe) {
45
- this.locked = false;
46
- this._bufferArr = [];
47
- this._pass = pass;
48
- this._txtEnDe = txtEnDe || TxtEnDecoderSingleton();
49
- }
50
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
51
- abort(reason) {
52
- throw new Error("Method not implemented.");
53
- }
54
- async close() {
55
- if (this._writer) {
56
- const ret = await this._writer.close();
57
- this._writer = void 0;
58
- return ret;
59
- }
60
- return Promise.resolve(void 0);
61
- }
62
- getWriter() {
63
- if (!this._writer) {
64
- const dests = [new LogWriteStream(this._bufferArr)];
65
- if (this._pass) {
66
- dests.push(this._pass);
67
- }
68
- this._writer = new FanoutWriteStream(dests);
69
- }
70
- return this._writer;
71
- }
72
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
- Logs(notJsonLine = false) {
74
- if (!this._writer) {
75
- return [];
76
- }
77
- const jsonNlStr = this._txtEnDe.decode(
78
- new Uint8Array(
79
- function* (res) {
80
- for (const x of res) {
81
- yield* x;
82
- }
83
- }(this._bufferArr)
84
- )
85
- );
86
- if (!notJsonLine) {
87
- const splitStr = jsonNlStr.split("\n");
88
- const filterStr = splitStr.filter((a) => a.length);
89
- const mapStr = filterStr.map((a) => JSON.parse(a));
90
- return mapStr;
91
- }
92
- return jsonNlStr.split("\n").filter((a) => a.length);
93
- }
94
- };
95
-
96
- // src/bin2text.ts
97
- function bin2text(hex, lineFn, size = 0) {
98
- const arr = new Uint8Array(hex.buffer, hex.byteOffset, hex.byteLength);
99
- let cutted = " ";
100
- if (size == 0) {
101
- size = arr.length;
102
- }
103
- size = Math.min(size, arr.length);
104
- const cols = 16;
105
- for (let line = 0; line < size; line += cols) {
106
- if (line + cols <= size || arr.length == size) {
107
- } else {
108
- line = arr.length - arr.length % cols;
109
- size = arr.length;
110
- cutted = ">>";
111
- }
112
- const l = [line.toString(16).padStart(4, "0"), cutted];
113
- for (let col = 0; col < cols; col++) {
114
- if (line + col < size) {
115
- l.push(arr[line + col].toString(16).padStart(2, "0"));
116
- } else {
117
- l.push(" ");
118
- }
119
- l.push(" ");
120
- }
121
- for (let col = 0; col < cols; col++) {
122
- if (line + col < size) {
123
- const ch = arr[line + col];
124
- l.push(ch >= 32 && ch < 127 ? String.fromCharCode(ch) : ".");
125
- }
126
- }
127
- lineFn(l.join(""));
128
- }
129
- }
130
- function bin2string(hex, size = 0) {
131
- const collector = [];
132
- bin2text(
133
- hex,
134
- (line) => {
135
- collector.push(line);
136
- },
137
- size
138
- );
139
- return collector.join("\n");
140
- }
141
-
142
- // src/logger.ts
143
- var Level = {
144
- WARN: "warn",
145
- DEBUG: "debug",
146
- INFO: "info",
147
- ERROR: "error"
148
- };
149
- var LogValue = class {
150
- constructor(fn) {
151
- this.fn = fn;
152
- }
153
- value() {
154
- try {
155
- return this.fn();
156
- } catch (e) {
157
- return `LogValue:${e.message}`;
158
- }
159
- }
160
- toJSON() {
161
- return this.value();
162
- }
163
- };
164
- function asyncLogValue(val) {
165
- throw new Error("Not implemented");
166
- }
167
- function logValue(val, ctx) {
168
- return logValueInternal(val, {
169
- ...ctx,
170
- state: ctx.state || /* @__PURE__ */ new Set([Math.random()])
171
- });
172
- }
173
- function logValueInternal(val, ctx) {
174
- var _a, _b;
175
- ctx = {
176
- ...ctx,
177
- state: ctx.state || /* @__PURE__ */ new Set([Math.random()])
178
- };
179
- switch (typeof val) {
180
- case "function":
181
- return new LogValue(val);
182
- case "string": {
183
- try {
184
- const ret = JSON.parse(val);
185
- if (typeof ret === "object" && ret !== null) {
186
- return logValueInternal(ret, ctx);
187
- }
188
- } catch (e) {
189
- try {
190
- const url = new URL(val);
191
- return new LogValue(() => url.toString());
192
- } catch (e2) {
193
- }
194
- }
195
- if (val.match(/[\n\r]/)) {
196
- const lines = val.split(/[\n\r]+/).map((v) => v.trim());
197
- return new LogValue(() => lines);
198
- }
199
- return new LogValue(() => val.toString());
200
- }
201
- case "number":
202
- return new LogValue(() => val);
203
- case "boolean":
204
- return new LogValue(() => val);
205
- case "object": {
206
- if (val === null) {
207
- return new LogValue(() => "null");
208
- }
209
- if (ArrayBuffer.isView(val)) {
210
- try {
211
- const decoder = new TextDecoder();
212
- const asStr = decoder.decode(val);
213
- const obj = JSON.parse(asStr);
214
- return logValueInternal(obj, ctx);
215
- } catch (e) {
216
- return logValueInternal(bin2string(val, 512), ctx);
217
- }
218
- }
219
- if (Array.isArray(val)) {
220
- return new LogValue(
221
- () => val.map((v) => logValue(v, { ...ctx, state: void 0 }).value())
222
- );
223
- }
224
- if (val instanceof Headers) {
225
- return new LogValue(() => Object.fromEntries(val.entries()));
226
- }
227
- if (val instanceof ReadableStream) {
228
- return new LogValue(() => ">Stream<");
229
- }
230
- if (isPromise(val)) {
231
- return new LogValue(() => ">Promise<");
232
- }
233
- if ((_a = ctx.state) == null ? void 0 : _a.has(val)) {
234
- return new LogValue(() => "...");
235
- }
236
- (_b = ctx.state) == null ? void 0 : _b.add(val);
237
- if (typeof val.toJSON === "function") {
238
- return new LogValue(() => val.toJSON());
239
- }
240
- const res = {};
241
- const typedVal = val;
242
- for (const key in typedVal) {
243
- if (ctx.ignoreAttr.IsSome() && ctx.ignoreAttr.unwrap().test(key)) {
244
- continue;
245
- }
246
- const element = typedVal[key];
247
- if (element instanceof LogValue) {
248
- res[key] = element;
249
- } else {
250
- if (typeof element !== "function") {
251
- res[key] = logValueInternal(element, ctx);
252
- }
253
- }
254
- }
255
- return new LogValue(() => res);
256
- }
257
- default:
258
- if (!val) {
259
- return new LogValue(() => "--Falsy--");
260
- }
261
- throw new Error(`Invalid type:${typeof val}`);
262
- }
263
- }
264
- function IsLogger(obj) {
265
- return typeof obj === "object" && [
266
- "Module",
267
- "EnableLevel",
268
- "DisableLevel",
269
- "SetDebug",
270
- "Str",
271
- "Error",
272
- "Warn",
273
- "Debug",
274
- "Log",
275
- "WithLevel",
276
- "Err",
277
- "Info",
278
- "Timestamp",
279
- "Any",
280
- "Dur",
281
- "Uint64"
282
- ].map((fn) => typeof obj[fn] === "function").reduce((a, b) => a && b, true);
283
- }
284
-
285
- // src/option.ts
286
- var Option = class _Option {
287
- static Some(t) {
288
- return new Some(t);
289
- }
290
- static None() {
291
- return new None();
292
- }
293
- static Is(t) {
294
- return t instanceof _Option;
295
- }
296
- static From(t) {
297
- if (!t) {
298
- return new None();
299
- }
300
- return new Some(t);
301
- }
302
- IsNone() {
303
- return this.is_none();
304
- }
305
- IsSome() {
306
- return this.is_some();
307
- }
308
- Unwrap() {
309
- return this.unwrap();
310
- }
311
- };
312
- var Some = class extends Option {
313
- constructor(_t) {
314
- super();
315
- this._t = _t;
316
- }
317
- is_none() {
318
- return false;
319
- }
320
- is_some() {
321
- return true;
322
- }
323
- unwrap() {
324
- return this._t;
325
- }
326
- };
327
- var None = class extends Option {
328
- is_none() {
329
- return true;
330
- }
331
- is_some() {
332
- return false;
333
- }
334
- unwrap() {
335
- throw new Error("None.unwrap");
336
- }
337
- };
338
-
339
- // src/log-level-impl.ts
340
- var LevelHandlerImpl = class {
341
- constructor() {
342
- this._globalLevels = /* @__PURE__ */ new Set([Level.INFO, Level.ERROR, Level.WARN]);
343
- this._modules = /* @__PURE__ */ new Map();
344
- this.ignoreAttr = Option.Some(/^_/);
345
- this.isStackExposed = false;
346
- }
347
- enableLevel(level, ...modules) {
348
- if (modules.length == 0) {
349
- this._globalLevels.add(level);
350
- return;
351
- }
352
- this.forModules(
353
- level,
354
- (p) => {
355
- this._modules.set(p, /* @__PURE__ */ new Set([...this._globalLevels, level]));
356
- },
357
- ...modules
358
- );
359
- }
360
- disableLevel(level, ...modules) {
361
- if (modules.length == 0) {
362
- this._globalLevels.delete(level);
363
- return;
364
- }
365
- this.forModules(
366
- level,
367
- (p) => {
368
- this._modules.delete(p);
369
- },
370
- ...modules
371
- );
372
- }
373
- setExposeStack(enable) {
374
- this.isStackExposed = !!enable;
375
- }
376
- setIgnoreAttr(re) {
377
- this.ignoreAttr = Option.From(re);
378
- }
379
- forModules(level, fnAction, ...modules) {
380
- for (const m of modules.flat()) {
381
- if (typeof m !== "string") {
382
- continue;
383
- }
384
- const parts = m.split(",").map((s) => s.trim()).filter((s) => s.length);
385
- for (const p of parts) {
386
- fnAction(p);
387
- }
388
- }
389
- }
390
- setDebug(...modules) {
391
- this.forModules(
392
- Level.DEBUG,
393
- (p) => {
394
- this._modules.set(p, /* @__PURE__ */ new Set([...this._globalLevels, Level.DEBUG]));
395
- },
396
- ...modules
397
- );
398
- }
399
- isEnabled(ilevel, module) {
400
- const level = ilevel;
401
- if (typeof module === "string") {
402
- const levels = this._modules.get(module);
403
- if (levels && levels.has(level)) {
404
- return true;
405
- }
406
- }
407
- const wlevel = this._modules.get("*");
408
- if (wlevel && typeof level === "string") {
409
- if (wlevel.has(level)) {
410
- return true;
411
- }
412
- }
413
- if (typeof level !== "string") {
414
- return true;
415
- }
416
- return this._globalLevels.has(level);
417
- }
418
- };
419
- var levelSingleton = new LevelHandlerImpl();
420
- function LevelHandlerSingleton() {
421
- return levelSingleton;
422
- }
423
-
424
- // src/logger-impl.ts
425
- import YAML from "yaml";
426
-
427
- // src/utils/relative-path.ts
428
- var PartType = {
429
- Slash: 1,
430
- Root: 3,
431
- Up: 4,
432
- Noop: 8
433
- // RootUp = 0x8 /* ../ */,
434
- };
435
- var Path = class {
436
- constructor(parts = []) {
437
- this.parts = parts;
438
- }
439
- toString() {
440
- return this.parts.map((part) => {
441
- if (typeof part === "string") {
442
- return part;
443
- } else {
444
- switch (part) {
445
- case PartType.Slash:
446
- case PartType.Root:
447
- return "/";
448
- case PartType.Up:
449
- return "..";
450
- default:
451
- return part;
452
- }
453
- }
454
- }).join("");
455
- }
456
- add(part) {
457
- if (this.parts.includes(PartType.Root) && part === PartType.Root) {
458
- throw new Error("Cannot add absolute part to absolute path");
459
- }
460
- const last = this.parts[this.parts.length - 1];
461
- if (last & PartType.Slash && part === PartType.Slash) {
462
- return;
463
- }
464
- switch (part) {
465
- case ".":
466
- this.parts.push(PartType.Noop);
467
- return;
468
- case "..":
469
- part = PartType.Up;
470
- }
471
- if (last === PartType.Noop && part === PartType.Slash) {
472
- if (last === PartType.Noop) {
473
- this.parts.pop();
474
- }
475
- return;
476
- }
477
- this.parts.push(part);
478
- }
479
- };
480
- function splitPath(path) {
481
- const p = new Path();
482
- if (path === "") {
483
- return p;
484
- }
485
- for (let count = 0; path.length; count++) {
486
- if (path.match(/^\/+/)) {
487
- if (count === 0) {
488
- p.add(PartType.Root);
489
- } else {
490
- p.add(PartType.Slash);
491
- }
492
- path = path.replace(/^\/+/, "");
493
- } else {
494
- const part = path.replace(/\/.*$/, "");
495
- p.add(part);
496
- path = path.replace(/^[^/]+/, "");
497
- }
498
- }
499
- return p;
500
- }
501
- function pathJoin(...paths) {
502
- let prev = "";
503
- const res = [];
504
- for (let i = 0; i < paths.length; i++) {
505
- const path = paths[i];
506
- if (path === "") {
507
- continue;
508
- }
509
- if (!(prev.endsWith("/") || path.startsWith("/"))) {
510
- if (prev !== "") {
511
- res.push("/");
512
- }
513
- res.push(path);
514
- } else {
515
- res.push(path);
516
- }
517
- prev = path;
518
- }
519
- return res.join("");
520
- }
521
- function relativePath(path, relative) {
522
- const relativeParts = splitPath(relative);
523
- let result;
524
- if (relativeParts.parts[0] === PartType.Root) {
525
- result = relative;
526
- } else {
527
- result = pathJoin(path, relative);
528
- }
529
- const unoptPath = splitPath(result);
530
- const out = [];
531
- let topUp = false;
532
- for (const part of unoptPath.parts) {
533
- switch (part) {
534
- case PartType.Root:
535
- out.push(PartType.Root);
536
- break;
537
- case PartType.Up:
538
- if (out.length && !topUp) {
539
- const last = out.length - 1;
540
- if (typeof out[last] === "string" && out[last - 1] == PartType.Root) {
541
- out.pop();
542
- } else {
543
- out.pop();
544
- out.pop();
545
- }
546
- if (out.length === 0) {
547
- topUp = !topUp ? true : topUp;
548
- out.push(PartType.Up);
549
- }
550
- } else {
551
- out.push(PartType.Up);
552
- }
553
- break;
554
- case PartType.Slash:
555
- if (!(out[out.length - 1] & PartType.Slash)) {
556
- out.push(PartType.Slash);
557
- }
558
- break;
559
- default:
560
- out.push(part);
561
- break;
562
- }
563
- }
564
- return new Path(out).toString();
565
- }
566
-
567
- // src/uri.ts
568
- function match(iref, ioth) {
569
- const mr = {
570
- score: 0,
571
- protocol: false,
572
- hostname: false,
573
- port: false,
574
- pathname: false,
575
- pathParts: [],
576
- params: {}
577
- };
578
- const ref = URI.from(iref);
579
- const oth = URI.from(ioth);
580
- if (ref.protocol === oth.protocol) {
581
- mr.score += 1;
582
- mr.protocol = true;
583
- }
584
- try {
585
- const refH = ref.hostname;
586
- const refP = ref.port;
587
- if (refH === oth.hostname) {
588
- mr.score += 1;
589
- mr.hostname = true;
590
- }
591
- if (refP.length && refP === oth.port) {
592
- mr.score += 1;
593
- mr.port = true;
594
- }
595
- } catch (e) {
596
- }
597
- if (ref.pathname.length && ref.pathname !== "/") {
598
- const pref = ref.pathname.split("/").filter((p) => p.length);
599
- const poth = oth.pathname.split("/").filter((p) => p.length);
600
- for (let i = 0; i < pref.length && i < poth.length; i++) {
601
- if (poth[i] === pref[i]) {
602
- mr.score += 1;
603
- mr.pathname = true;
604
- mr.pathParts.push(pref[i]);
605
- }
606
- }
607
- }
608
- for (const [key, value] of ref.getParams) {
609
- if (oth.getParam(key) === value) {
610
- mr.score += 1;
611
- mr.params[key] = value;
612
- }
613
- }
614
- return mr;
615
- }
616
- function coerceKey(key, def) {
617
- if (typeof key === "object") {
618
- const keys = Object.keys(key);
619
- if (keys.length !== 1) {
620
- throw new Error(`Invalid key: ${JSON.stringify(key)}`);
621
- }
622
- return { key: keys[0], def: key[keys[0]] };
623
- }
624
- return { key, def };
625
- }
626
- function resolveHash(hash) {
627
- const searchParams = new URLSearchParams(hash.replace(/^#/, ""));
628
- return {
629
- getParam: (k) => {
630
- const ret = searchParams.get(k);
631
- return ret === null ? void 0 : ret;
632
- }
633
- };
634
- }
635
- function falsy2undef(value) {
636
- return value === void 0 || value === null ? void 0 : value;
637
- }
638
- function ensureURLWithDefaultProto(url, defaultProtocol) {
639
- if (!url) {
640
- return new MutableURL(`${defaultProtocol}//`);
641
- }
642
- if (typeof url === "string") {
643
- try {
644
- return new MutableURL(url);
645
- } catch (e) {
646
- return new MutableURL(`${defaultProtocol}//${url}`);
647
- }
648
- } else {
649
- return new MutableURL(url.toString());
650
- }
651
- }
652
- function isURL(value) {
653
- return value instanceof URL || !!value && typeof value.searchParams === "object" && typeof value.searchParams.sort === "function" && typeof value.hash === "string";
654
- }
655
- var customInspectSymbol = Symbol.for("nodejs.util.inspect.custom");
656
- var MutableURL = class _MutableURL extends URL {
657
- // override readonly hash: string;
658
- constructor(urlStr) {
659
- super("defect://does.not.exist");
660
- const partedURL = urlStr.split(":");
661
- this._hasHostpart = hasHostPartProtocols.has(partedURL[0]);
662
- let hostPartUrl = ["http", ...partedURL.slice(1)].join(":");
663
- if (!this._hasHostpart) {
664
- const pathname = hostPartUrl.replace(/http:\/\/[/]*/, "").replace(/[#?].*$/, "");
665
- hostPartUrl = hostPartUrl.replace(/http:\/\//, `http://localhost/${pathname}`);
666
- }
667
- try {
668
- this._sysURL = new URL(hostPartUrl);
669
- } catch (ie) {
670
- const e = ie;
671
- e.message = `${e.message} for URL: ${urlStr}`;
672
- throw e;
673
- }
674
- this._protocol = `${partedURL[0]}:`;
675
- if (this._hasHostpart) {
676
- this._pathname = this._sysURL.pathname;
677
- } else {
678
- this._pathname = urlStr.replace(new RegExp(`^${this._protocol}//`), "").replace(/[#?].*$/, "");
679
- }
680
- }
681
- [customInspectSymbol]() {
682
- return this.toString();
683
- }
684
- clone() {
685
- return new _MutableURL(this.toString());
686
- }
687
- get host() {
688
- if (!this._hasHostpart) {
689
- throw new Error(
690
- `you can use hostname only if protocol is ${this.toString()} ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`
691
- );
692
- }
693
- return this._sysURL.host;
694
- }
695
- get port() {
696
- if (!this._hasHostpart) {
697
- throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
698
- }
699
- return this._sysURL.port;
700
- }
701
- set port(p) {
702
- if (!this._hasHostpart) {
703
- throw new Error(`you can use port only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
704
- }
705
- this._sysURL.port = p;
706
- }
707
- get hostname() {
708
- if (!this._hasHostpart) {
709
- throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
710
- }
711
- return this._sysURL.hostname;
712
- }
713
- set hostname(h) {
714
- if (!this._hasHostpart) {
715
- throw new Error(`you can use hostname only if protocol is ${JSON.stringify(Array.from(hasHostPartProtocols.keys()))}`);
716
- }
717
- this._sysURL.hostname = h;
718
- }
719
- set pathname(p) {
720
- this._pathname = p;
721
- }
722
- get pathname() {
723
- return this._pathname;
724
- }
725
- get protocol() {
726
- return this._protocol;
727
- }
728
- set protocol(p) {
729
- if (!p.endsWith(":")) {
730
- p = `${p}:`;
731
- }
732
- this._protocol = p;
733
- }
734
- get hash() {
735
- return this._sysURL.hash;
736
- }
737
- set hash(h) {
738
- this._sysURL.hash = h;
739
- }
740
- get searchParams() {
741
- return this._sysURL.searchParams;
742
- }
743
- get search() {
744
- let search = "";
745
- if (this._sysURL.searchParams.size) {
746
- for (const [key, value] of Array.from(this._sysURL.searchParams.entries()).sort((a, b) => a[0].localeCompare(b[0]))) {
747
- search += `${!search.length ? "?" : "&"}${key}=${encodeURIComponent(value)}`;
748
- }
749
- }
750
- return search;
751
- }
752
- toString() {
753
- const search = this.search;
754
- let hostpart = "";
755
- if (this._hasHostpart) {
756
- hostpart = this._sysURL.hostname;
757
- if (this._sysURL.port) {
758
- hostpart += `:${this._sysURL.port}`;
759
- }
760
- if (!this._pathname.startsWith("/")) {
761
- hostpart += "/";
762
- }
763
- }
764
- return `${this._protocol}//${hostpart}${this._pathname}${search}${this.hash}`;
765
- }
766
- };
767
- function from(fac, strURLUri, defaultProtocol) {
768
- switch (typeof falsy2undef(strURLUri)) {
769
- case "undefined":
770
- return fac(new MutableURL(`${defaultProtocol}///`));
771
- case "string":
772
- return fac(ensureURLWithDefaultProto(strURLUri, defaultProtocol));
773
- case "object":
774
- if (BuildURI.is(strURLUri)) {
775
- return fac(new MutableURL(strURLUri._url.toString()));
776
- } else if (URI.is(strURLUri)) {
777
- return fac(new MutableURL(strURLUri._url.toString()));
778
- } else if (isURL(strURLUri)) {
779
- return fac(new MutableURL(strURLUri.toString()));
780
- }
781
- throw new Error(`unknown object type: ${strURLUri}`);
782
- default:
783
- throw new Error(`Invalid argument: ${typeof strURLUri}`);
784
- }
785
- }
786
- function getParamResult(key, val, msgFn = (key2) => {
787
- return `missing parameter: ${key2}`;
788
- }) {
789
- if (val === void 0) {
790
- return Result.Err(msgFn(key));
791
- }
792
- return Result.Ok(val);
793
- }
794
- var BuildURI = class _BuildURI {
795
- // pathname needs this
796
- constructor(url) {
797
- this._url = url;
798
- }
799
- static is(value) {
800
- return value instanceof _BuildURI || !!value && typeof value.delParam === "function" && typeof value.setParam === "function";
801
- }
802
- static from(strURLUri, defaultProtocol = "file:") {
803
- return from((url) => new _BuildURI(url), strURLUri, defaultProtocol);
804
- }
805
- match(other) {
806
- return match(this.URI(), URI.from(other));
807
- }
808
- port(p) {
809
- this._url.port = p;
810
- return this;
811
- }
812
- hostname(h) {
813
- this._url.hostname = h;
814
- return this;
815
- }
816
- protocol(p) {
817
- if (!p.endsWith(":")) {
818
- p = `${p}:`;
819
- }
820
- this._url.protocol = p;
821
- return this;
822
- }
823
- pathname(p) {
824
- this._url.pathname = p;
825
- return this;
826
- }
827
- hash(h) {
828
- this._url.hash = h;
829
- return this;
830
- }
831
- // could pass a relative path or a full URL
832
- // if relative path, it will be appended to the current path
833
- resolve(p) {
834
- if (!p) {
835
- return this;
836
- }
837
- if (typeof p === "string") {
838
- if (!p.match(/^[a-zA-Z0-9]+:/)) {
839
- if (p.startsWith("/")) {
840
- this.pathname(p);
841
- return this;
842
- }
843
- return this.appendRelative(p);
844
- }
845
- }
846
- this._url = new MutableURL(p.toString());
847
- return this;
848
- }
849
- appendRelative(p) {
850
- const appendUrl = URI.from(p);
851
- const pathname = "./" + appendUrl.pathname;
852
- const basePath = this._url.pathname;
853
- this.pathname(relativePath(basePath, pathname));
854
- for (const [key, value] of appendUrl.getParams) {
855
- this.setParam(key, value);
856
- }
857
- return this;
858
- }
859
- cleanParams(...remove) {
860
- const keys = new Set(remove.flat());
861
- for (const key of Array.from(this._url.searchParams.keys())) {
862
- if (keys.size === 0 || keys.has(key)) {
863
- this._url.searchParams.delete(key);
864
- }
865
- }
866
- return this;
867
- }
868
- hashParams(val, mode = "reset") {
869
- let preset;
870
- switch (mode) {
871
- case "reset":
872
- this._url.hash = "";
873
- preset = {};
874
- break;
875
- case "merge":
876
- default:
877
- preset = Object.fromEntries(new URLSearchParams(this._url.hash.replace(/^#/, "")).entries());
878
- break;
879
- }
880
- const out = new URLSearchParams("");
881
- for (const [key, value] of Object.entries({ ...preset, ...val }).sort((a, b) => a[0].localeCompare(b[0]))) {
882
- switch (typeof value) {
883
- case "string":
884
- out.set(key, value);
885
- break;
886
- case "number":
887
- out.set(key, value.toString());
888
- break;
889
- case "boolean":
890
- out.set(key, value ? "true" : "false");
891
- break;
892
- default:
893
- if (value instanceof Date) {
894
- out.set(key, value.toISOString());
895
- } else {
896
- console.error(`unsupported type: ${typeof value} ignore key: ${key}`);
897
- }
898
- break;
899
- }
900
- }
901
- this._url.hash = out.toString();
902
- return this;
903
- }
904
- delParam(key) {
905
- this._url.searchParams.delete(key);
906
- return this;
907
- }
908
- defParam(key, str) {
909
- if (!this._url.searchParams.has(key)) {
910
- this._url.searchParams.set(key, str);
911
- }
912
- return this;
913
- }
914
- setParam(key, str) {
915
- this._url.searchParams.set(key, str);
916
- return this;
917
- }
918
- hasParam(key) {
919
- return this._url.searchParams.has(key);
920
- }
921
- get getParams() {
922
- return this._url.searchParams.entries();
923
- }
924
- getParam(key, def) {
925
- const { key: k, def: d } = coerceKey(key, def);
926
- let val = this._url.searchParams.get(k);
927
- if (!falsy2undef(val) && d) {
928
- val = d;
929
- }
930
- return falsy2undef(val);
931
- }
932
- getParamResult(key, msgFn) {
933
- return getParamResult(key, this.getParam(key), msgFn);
934
- }
935
- getParamsResult(...keys) {
936
- return getParamsResult(keys, this);
937
- }
938
- getHashParams(...keys) {
939
- return getParamsResult(keys, resolveHash(this._url.hash));
940
- }
941
- toString() {
942
- this._url.searchParams.sort();
943
- return this._url.toString();
944
- }
945
- toJSON() {
946
- return this.toString();
947
- }
948
- asURL() {
949
- return this.URI().asURL();
950
- }
951
- asObj(...strips) {
952
- return this.URI().asObj(...strips);
953
- }
954
- clone() {
955
- return _BuildURI.from(this.toString());
956
- }
957
- URI() {
958
- return URI.from(this._url);
959
- }
960
- };
961
- function isCoerceURI(value) {
962
- if (!value) {
963
- return false;
964
- }
965
- if (isURL(value)) {
966
- return true;
967
- }
968
- if (URI.is(value)) {
969
- return true;
970
- }
971
- if (BuildURI.is(value)) {
972
- return true;
973
- }
974
- if (typeof value === "string") {
975
- return true;
976
- }
977
- return false;
978
- }
979
- var hasHostPartProtocols = /* @__PURE__ */ new Set(["http", "https", "ws", "wss"]);
980
- var URI = class _URI {
981
- static protocolHasHostpart(protocol) {
982
- protocol = protocol.replace(/:$/, "");
983
- hasHostPartProtocols.add(protocol);
984
- return () => {
985
- hasHostPartProtocols.delete(protocol);
986
- };
987
- }
988
- match(other) {
989
- return match(this, other);
990
- }
991
- // if no protocol is provided, default to file:
992
- static merge(into, from2, defaultProtocol = "file:") {
993
- const intoUrl = BuildURI.from(into, defaultProtocol);
994
- const fromUrl = _URI.from(from2, defaultProtocol);
995
- intoUrl.protocol(fromUrl.protocol);
996
- const fPath = fromUrl.pathname;
997
- if (!(fPath.length === 0 || fPath === "/" || fPath === "./")) {
998
- intoUrl.pathname(fromUrl.pathname);
999
- }
1000
- for (const [key, value] of fromUrl.getParams) {
1001
- intoUrl.setParam(key, value);
1002
- }
1003
- return intoUrl.URI();
1004
- }
1005
- static is(value) {
1006
- return value instanceof _URI || !!value && typeof value.asURL === "function" && typeof value.getParam === "function" && typeof value.hasParam === "function";
1007
- }
1008
- // if no protocol is provided, default to file:
1009
- static from(strURLUri, defaultProtocol = "file:") {
1010
- return from((url) => new _URI(url), strURLUri, defaultProtocol);
1011
- }
1012
- static fromResult(strURLUri, defaultProtocol = "file:") {
1013
- return exception2Result(() => from((url) => new _URI(url), strURLUri, defaultProtocol));
1014
- }
1015
- constructor(url) {
1016
- this._url = url.clone();
1017
- }
1018
- build() {
1019
- return BuildURI.from(this._url);
1020
- }
1021
- get hostname() {
1022
- return this._url.hostname;
1023
- }
1024
- get onlyHostAndSchema() {
1025
- return this.build().pathname("").cleanParams().hash("").toString();
1026
- }
1027
- get withoutHostAndSchema() {
1028
- return this._url.pathname + this._url.search + this._url.hash;
1029
- }
1030
- // get password(): string {
1031
- // return this._url.password;
1032
- // }
1033
- get port() {
1034
- return this._url.port;
1035
- }
1036
- get host() {
1037
- return this._url.host;
1038
- }
1039
- // get username(): string {
1040
- // return this._url.username;
1041
- // }
1042
- // get search(): string {
1043
- // return this._url.search;
1044
- // }
1045
- get protocol() {
1046
- return this._url.protocol;
1047
- }
1048
- get pathname() {
1049
- return this._url.pathname;
1050
- }
1051
- get hash() {
1052
- return this._url.hash;
1053
- }
1054
- // get host(): string {
1055
- // return this._url.host;
1056
- // }
1057
- get getParams() {
1058
- return this._url.searchParams.entries();
1059
- }
1060
- get getHashes() {
1061
- return new URLSearchParams(this._url.hash.slice("#".length)).entries();
1062
- }
1063
- hasParam(key) {
1064
- return this._url.searchParams.has(key);
1065
- }
1066
- getParam(key, def) {
1067
- const { key: k, def: d } = coerceKey(key, def);
1068
- let val = this._url.searchParams.get(k);
1069
- if (!falsy2undef(val) && d) {
1070
- val = d;
1071
- }
1072
- return falsy2undef(val);
1073
- }
1074
- getParamResult(key, msgFn) {
1075
- return getParamResult(key, this.getParam(key), msgFn);
1076
- }
1077
- getParamsResult(...keys) {
1078
- return getParamsResult(keys, this);
1079
- }
1080
- getHashParams(...keys) {
1081
- return getParamsResult(keys, resolveHash(this._url.hash));
1082
- }
1083
- clone() {
1084
- return new _URI(this._url);
1085
- }
1086
- asURL() {
1087
- return this._url.clone();
1088
- }
1089
- toString() {
1090
- return this._url.toString();
1091
- }
1092
- toJSON() {
1093
- return this.toString();
1094
- }
1095
- asObj(...strips) {
1096
- const pathURI = {
1097
- style: "path",
1098
- protocol: this.protocol,
1099
- pathname: this.pathname,
1100
- searchParams: Object.fromEntries(this.getParams)
1101
- };
1102
- if (hasHostPartProtocols.has(this.protocol.replace(/:$/, ""))) {
1103
- return stripper(strips, {
1104
- ...pathURI,
1105
- style: "host",
1106
- hostname: this.hostname,
1107
- port: this.port
1108
- });
1109
- }
1110
- return stripper(strips, pathURI);
1111
- }
1112
- };
1113
-
1114
- // src/log-writer-impl.ts
1115
- var LogWriterStream = class {
1116
- constructor(out) {
1117
- this._toFlush = [];
1118
- this._flushIsRunning = false;
1119
- this._flushDoneFns = [];
1120
- this._out = out;
1121
- this._id = Math.random();
1122
- }
1123
- write(encoded) {
1124
- const my = async () => {
1125
- try {
1126
- const writer = this._out.getWriter();
1127
- await writer.ready;
1128
- await writer.write(encoded);
1129
- writer.releaseLock();
1130
- } catch (err) {
1131
- console.error("Chunk error:", err);
1132
- }
1133
- };
1134
- this._toFlush.push(my);
1135
- this._flush();
1136
- }
1137
- _flush(toFlush = void 0, done) {
1138
- if (done) {
1139
- this._flushDoneFns.push(done);
1140
- }
1141
- if (this._toFlush.length == 0) {
1142
- this._flushIsRunning = false;
1143
- this._flushDoneFns.forEach((fn) => fn());
1144
- this._flushDoneFns = [];
1145
- return;
1146
- }
1147
- if (!toFlush && this._toFlush.length == 1 && !this._flushIsRunning) {
1148
- this._flushIsRunning = true;
1149
- } else if (!toFlush) {
1150
- return;
1151
- }
1152
- const my = this._toFlush.shift();
1153
- my == null ? void 0 : my().catch((e) => {
1154
- console.error("Flush error:", e);
1155
- }).finally(() => {
1156
- this._flush(this._toFlush);
1157
- });
1158
- }
1159
- };
1160
-
1161
- // src/logger-impl.ts
1162
- function getLen(value, lvs) {
1163
- if (Array.isArray(value)) {
1164
- return logValue(() => value.length, lvs);
1165
- } else if (typeof value === "string") {
1166
- return logValue(() => value.length, lvs);
1167
- } else if (typeof value === "object" && value !== null) {
1168
- if (typeof value.size === "number") {
1169
- return logValue(() => value.size, lvs);
1170
- } else if (typeof value.length === "number") {
1171
- return logValue(() => value.length, lvs);
1172
- }
1173
- return logValue(() => Object.keys(value).length, lvs);
1174
- }
1175
- return logValue(() => -1, lvs);
1176
- }
1177
- function toLogValue(lop) {
1178
- if (lop && typeof lop.then === "function") {
1179
- throw new Error("async logValue Not implemented");
1180
- }
1181
- return lop;
1182
- }
1183
- var JSONFormatter = class {
1184
- constructor(txtEnde, space) {
1185
- this._txtEnDe = txtEnde;
1186
- this._space = space;
1187
- }
1188
- format(attr) {
1189
- let ret;
1190
- try {
1191
- ret = JSON.stringify(attr, null, this._space);
1192
- } catch (e) {
1193
- ret = JSON.stringify({ internal: { message: e.message, stack: e.stack } });
1194
- }
1195
- return this._txtEnDe.encode(ret + "\n");
1196
- }
1197
- };
1198
- var YAMLFormatter = class {
1199
- constructor(txtEnde, space) {
1200
- this._txtEnDe = txtEnde;
1201
- this._space = space;
1202
- }
1203
- format(attr) {
1204
- return this._txtEnDe.encode("---\n" + YAML.stringify(attr, null, this._space) + "\n");
1205
- }
1206
- };
1207
- function toLogValueCtx(lvh) {
1208
- return {
1209
- ignoreAttr: lvh.ignoreAttr
1210
- };
1211
- }
1212
- var LoggerImpl = class _LoggerImpl {
1213
- // readonly _id: string = "logger-" + Math.random().toString(36)
1214
- constructor(params) {
1215
- this._attributes = {};
1216
- if (!params) {
1217
- params = {};
1218
- }
1219
- if (!params.sys) {
1220
- this._sys = BasicSysAbstractionFactory();
1221
- } else {
1222
- this._sys = params.sys;
1223
- }
1224
- if (!params.txtEnDe) {
1225
- this._txtEnDe = TxtEnDecoderSingleton();
1226
- } else {
1227
- this._txtEnDe = params.txtEnDe;
1228
- }
1229
- if (!params.formatter) {
1230
- this._formatter = new JSONFormatter(this._txtEnDe);
1231
- } else {
1232
- this._formatter = params.formatter;
1233
- }
1234
- if (params.logWriter) {
1235
- this._logWriter = params.logWriter;
1236
- } else {
1237
- if (!params.out) {
1238
- this._logWriter = new LogWriterStream(this._sys.Stdout());
1239
- } else {
1240
- this._logWriter = new LogWriterStream(params.out);
1241
- }
1242
- }
1243
- if (!params.withAttributes) {
1244
- this._withAttributes = {};
1245
- } else {
1246
- this._withAttributes = { ...params.withAttributes };
1247
- }
1248
- this._attributes = { ...this._withAttributes };
1249
- if (params.levelHandler) {
1250
- this.levelHandler = params.levelHandler;
1251
- } else {
1252
- this.levelHandler = LevelHandlerSingleton();
1253
- }
1254
- }
1255
- TxtEnDe() {
1256
- return this._txtEnDe;
1257
- }
1258
- Attributes() {
1259
- return JSON.parse(JSON.stringify(this._attributes, null));
1260
- }
1261
- SetExposeStack(enable) {
1262
- this.levelHandler.setExposeStack(enable);
1263
- return this;
1264
- }
1265
- EnableLevel(level, ...modules) {
1266
- this.levelHandler.enableLevel(level, ...modules);
1267
- return this;
1268
- }
1269
- DisableLevel(level, ...modules) {
1270
- this.levelHandler.disableLevel(level, ...modules);
1271
- return this;
1272
- }
1273
- Module(key) {
1274
- this._attributes["module"] = logValue(key, toLogValueCtx(this.levelHandler));
1275
- this._withAttributes["module"] = logValue(key, toLogValueCtx(this.levelHandler));
1276
- return this;
1277
- }
1278
- // if the string is "*" it will enable for all modules
1279
- SetDebug(...modules) {
1280
- this.levelHandler.setDebug(...modules);
1281
- return this;
1282
- }
1283
- SetIgnoreAttribute(re) {
1284
- this.levelHandler.setIgnoreAttr(re);
1285
- return this;
1286
- }
1287
- SetFormatter(formatter) {
1288
- this._formatter = formatter;
1289
- return this;
1290
- }
1291
- Timestamp() {
1292
- this._attributes["ts"] = logValue(() => this._sys.Time().Now().toISOString(), toLogValueCtx(this.levelHandler));
1293
- return this;
1294
- }
1295
- Warn() {
1296
- this._attributes["level"] = logValue(Level.WARN, toLogValueCtx(this.levelHandler));
1297
- return this;
1298
- }
1299
- Log() {
1300
- return this;
1301
- }
1302
- Debug() {
1303
- this._attributes["level"] = logValue(Level.DEBUG, toLogValueCtx(this.levelHandler));
1304
- return this;
1305
- }
1306
- Error() {
1307
- this._attributes["level"] = logValue(Level.ERROR, toLogValueCtx(this.levelHandler));
1308
- return this;
1309
- }
1310
- Info() {
1311
- this._attributes["level"] = logValue(Level.INFO, toLogValueCtx(this.levelHandler));
1312
- return this;
1313
- }
1314
- Err(err) {
1315
- var _a;
1316
- let key = "error";
1317
- if (Result.Is(err)) {
1318
- if (err.isOk()) {
1319
- key = "noerror";
1320
- err = err.Ok();
1321
- } else {
1322
- err = err.Err();
1323
- }
1324
- }
1325
- if (err instanceof Error) {
1326
- if (err.cause) {
1327
- this.coerceKey(key, {
1328
- message: err.message,
1329
- cause: err.cause
1330
- });
1331
- } else {
1332
- this._attributes[key] = logValue(err.message, toLogValueCtx(this.levelHandler));
1333
- }
1334
- if (this.levelHandler.isStackExposed) {
1335
- this._attributes["stack"] = logValue(
1336
- (_a = err.stack) == null ? void 0 : _a.split(/[\r\n]+/).map((s) => s.trim()),
1337
- toLogValueCtx(this.levelHandler)
1338
- );
1339
- }
1340
- } else {
1341
- this.Any(key, err);
1342
- }
1343
- return this;
1344
- }
1345
- WithLevel(l) {
1346
- this._attributes["level"] = logValue(l, toLogValueCtx(this.levelHandler));
1347
- return this;
1348
- }
1349
- Ref(key, action) {
1350
- if (typeof action === "function") {
1351
- this._attributes[key] = logValue(action, toLogValueCtx(this.levelHandler));
1352
- } else if (typeof action.toString === "function") {
1353
- this._attributes[key] = logValue(() => action.toString(), toLogValueCtx(this.levelHandler));
1354
- } else {
1355
- this._attributes[key] = logValue("INVALID REF", toLogValueCtx(this.levelHandler));
1356
- }
1357
- return this;
1358
- }
1359
- Bool(key, value) {
1360
- this.coerceKey(key, !!value);
1361
- return this;
1362
- }
1363
- Http(...mix) {
1364
- const key = mix.find((x) => typeof x === "string");
1365
- mix = mix.filter((x) => typeof x !== "string");
1366
- const resErrors = mix.filter((x) => Result.Is(x) && x.isErr());
1367
- if (resErrors.length) {
1368
- this.Err(resErrors.map((x) => x.Err().message).join("\n"));
1369
- return this;
1370
- }
1371
- const req = mix.map((reqOrResult) => Result.Is(reqOrResult) ? reqOrResult.Ok() : reqOrResult).find((req2) => typeof req2.status !== "number");
1372
- const res = mix.map((resOrResult) => Result.Is(resOrResult) ? resOrResult.Ok() : resOrResult).find((res2) => typeof res2.status === "number");
1373
- let reqAndOrres;
1374
- if (res && req) {
1375
- reqAndOrres = { res, req };
1376
- } else if (!res && !req) {
1377
- reqAndOrres = void 0;
1378
- } else if (res) {
1379
- reqAndOrres = res;
1380
- } else if (req) {
1381
- reqAndOrres = req;
1382
- }
1383
- if (reqAndOrres) {
1384
- this.Any(key || "Http", reqAndOrres);
1385
- }
1386
- return this;
1387
- }
1388
- Pair(x) {
1389
- for (const key of Object.keys(x)) {
1390
- const value = x[key];
1391
- if (value instanceof LogValue) {
1392
- this._attributes[key] = value;
1393
- continue;
1394
- }
1395
- if (Result.Is(value)) {
1396
- this.Result(key, value);
1397
- continue;
1398
- }
1399
- this.Any(key, value);
1400
- }
1401
- return this;
1402
- }
1403
- Result(key, res) {
1404
- if (res.isOk()) {
1405
- this._attributes[key] = logValue(res.Ok(), toLogValueCtx(this.levelHandler));
1406
- } else {
1407
- this.Err(res.Err());
1408
- }
1409
- return this;
1410
- }
1411
- Len(value, key = "len") {
1412
- this._attributes[key] = getLen(value, toLogValueCtx(this.levelHandler));
1413
- return this;
1414
- }
1415
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1416
- Hash(value, key = "hash") {
1417
- throw new Error("Not implemented");
1418
- }
1419
- Url(url, key = "url") {
1420
- this.Ref(key, () => URI.from(url).toString());
1421
- return this;
1422
- }
1423
- coerceKey(key, value) {
1424
- if (typeof key === "string") {
1425
- this._attributes[key] = logValue(value, toLogValueCtx(this.levelHandler));
1426
- } else {
1427
- this.Pair(key);
1428
- }
1429
- }
1430
- Str(key, value) {
1431
- this.coerceKey(key, value);
1432
- return this;
1433
- }
1434
- Any(key, value) {
1435
- this.coerceKey(key, value);
1436
- return this;
1437
- }
1438
- Dur(key, nsec) {
1439
- this._attributes[key] = logValue(`${nsec}ms`, toLogValueCtx(this.levelHandler));
1440
- return this;
1441
- }
1442
- Uint64(key, value) {
1443
- this.coerceKey(key, value);
1444
- return this;
1445
- }
1446
- Int(key, value) {
1447
- return this.Uint64(key, value);
1448
- }
1449
- async Flush() {
1450
- return new Promise((resolve) => {
1451
- this._logWriter._flush(void 0, resolve);
1452
- });
1453
- }
1454
- With() {
1455
- return new WithLoggerBuilder(
1456
- new _LoggerImpl({
1457
- logWriter: this._logWriter,
1458
- sys: this._sys,
1459
- levelHandler: this.levelHandler,
1460
- formatter: this._formatter,
1461
- withAttributes: {
1462
- module: this._attributes["module"],
1463
- ...this._withAttributes
1464
- }
1465
- })
1466
- );
1467
- }
1468
- _resetAttributes(fn) {
1469
- const ret = fn();
1470
- Object.keys(this._attributes).forEach((key) => {
1471
- delete this._attributes[key];
1472
- });
1473
- Object.assign(this._attributes, this._withAttributes);
1474
- return ret;
1475
- }
1476
- Msg(...args) {
1477
- const fnError = this._resetAttributes(() => {
1478
- var _a, _b;
1479
- const doWrite = this.levelHandler.isEnabled(
1480
- (_a = toLogValue(this._attributes["level"])) == null ? void 0 : _a.value(),
1481
- (_b = toLogValue(this._attributes["module"])) == null ? void 0 : _b.value()
1482
- );
1483
- this._attributes["msg"] = logValue(args.join(" "), toLogValueCtx(this.levelHandler));
1484
- const msg = this._attributes["msg"].value();
1485
- if (typeof msg === "string" && !msg.trim().length) {
1486
- delete this._attributes["msg"];
1487
- }
1488
- let fnRet = () => this._formatter.format({ ...this._attributes });
1489
- if (doWrite) {
1490
- const encoded = fnRet();
1491
- this._logWriter.write(encoded);
1492
- fnRet = () => encoded;
1493
- }
1494
- return fnRet;
1495
- });
1496
- const asError = () => new Error(this._txtEnDe.decode(fnError()));
1497
- return {
1498
- ResultError: () => Result.Err(asError()),
1499
- AsError: asError
1500
- };
1501
- }
1502
- };
1503
- var WithLoggerBuilder = class {
1504
- constructor(li) {
1505
- this._li = li;
1506
- this.levelHandler = li.levelHandler;
1507
- }
1508
- TxtEnDe() {
1509
- return this._li.TxtEnDe();
1510
- }
1511
- Logger() {
1512
- Object.assign(this._li._withAttributes, this._li._attributes);
1513
- return this._li;
1514
- }
1515
- Attributes() {
1516
- return { ...this._li._attributes };
1517
- }
1518
- SetExposeStack(enable) {
1519
- this._li.levelHandler.setExposeStack(enable);
1520
- return this;
1521
- }
1522
- SetIgnoreAttribute(re) {
1523
- this._li.levelHandler.setIgnoreAttr(re);
1524
- return this;
1525
- }
1526
- SetFormatter(fmt) {
1527
- this._li.SetFormatter(fmt);
1528
- return this;
1529
- }
1530
- EnableLevel(level, ...modules) {
1531
- this._li.levelHandler.enableLevel(level, ...modules);
1532
- return this;
1533
- }
1534
- DisableLevel(level, ...modules) {
1535
- this._li.levelHandler.enableLevel(level, ...modules);
1536
- return this;
1537
- }
1538
- Module(key) {
1539
- this._li.Module(key);
1540
- return this;
1541
- }
1542
- SetDebug(...modules) {
1543
- this._li.SetDebug(...modules);
1544
- return this;
1545
- }
1546
- Http(...mix) {
1547
- this._li.Http(...mix);
1548
- return this;
1549
- }
1550
- Pair(x) {
1551
- this._li.Pair(x);
1552
- return this;
1553
- }
1554
- Str(key, value) {
1555
- this._li.Str(key, value);
1556
- return this;
1557
- }
1558
- Len(value, key) {
1559
- this._li.Len(value, key);
1560
- return this;
1561
- }
1562
- Hash(value, key) {
1563
- this._li.Hash(value, key);
1564
- return this;
1565
- }
1566
- Ref(key, action) {
1567
- this._li.Ref(key, action);
1568
- return this;
1569
- }
1570
- Bool(key, value) {
1571
- this._li.Bool(key, value);
1572
- return this;
1573
- }
1574
- Result(key, res) {
1575
- this._li.Result(key, res);
1576
- return this;
1577
- }
1578
- Url(url, key) {
1579
- this._li.Url(url, key);
1580
- return this;
1581
- }
1582
- Int(key, value) {
1583
- this._li.Int(key, value);
1584
- return this;
1585
- }
1586
- Log() {
1587
- this._li.Log();
1588
- return this;
1589
- }
1590
- WithLevel(level) {
1591
- this._li.WithLevel(level);
1592
- return this;
1593
- }
1594
- Error() {
1595
- this._li.Error();
1596
- return this;
1597
- }
1598
- Warn() {
1599
- this._li.Error();
1600
- return this;
1601
- }
1602
- Debug() {
1603
- this._li.Debug();
1604
- return this;
1605
- }
1606
- Err(err) {
1607
- this._li.Err(err);
1608
- return this;
1609
- }
1610
- Info() {
1611
- this._li.Info();
1612
- return this;
1613
- }
1614
- Timestamp() {
1615
- this._li.Timestamp();
1616
- return this;
1617
- }
1618
- Any(key, value) {
1619
- this._li.Any(key, value);
1620
- return this;
1621
- }
1622
- Dur(key, nsec) {
1623
- this._li.Dur(key, nsec);
1624
- return this;
1625
- }
1626
- Uint64(key, value) {
1627
- this._li.Uint64(key, value);
1628
- return this;
1629
- }
1630
- };
1631
-
1632
- // src/test/mock-logger.ts
1633
- function MockLogger(params) {
1634
- const lc = new LogCollector(params == null ? void 0 : params.pass);
1635
- let modNames = ["MockLogger"];
1636
- if (typeof (params == null ? void 0 : params.moduleName) === "string") {
1637
- modNames = [params == null ? void 0 : params.moduleName];
1638
- } else if (Array.isArray(params == null ? void 0 : params.moduleName)) {
1639
- modNames = [...params.moduleName, ...modNames];
1640
- }
1641
- const logger = new LoggerImpl({
1642
- out: lc,
1643
- sys: params == null ? void 0 : params.sys,
1644
- levelHandler: new LevelHandlerImpl()
1645
- }).With().Module(modNames[0]).Logger();
1646
- if (!(params == null ? void 0 : params.disableDebug)) {
1647
- logger.SetDebug(...modNames);
1648
- }
1649
- return {
1650
- logCollector: lc,
1651
- logger
1652
- };
1653
- }
1654
-
1655
- export {
1656
- bin2text,
1657
- bin2string,
1658
- Level,
1659
- LogValue,
1660
- asyncLogValue,
1661
- logValue,
1662
- IsLogger,
1663
- isURL,
1664
- MutableURL,
1665
- BuildURI,
1666
- isCoerceURI,
1667
- hasHostPartProtocols,
1668
- URI,
1669
- Option,
1670
- Some,
1671
- None,
1672
- LevelHandlerImpl,
1673
- LevelHandlerSingleton,
1674
- JSONFormatter,
1675
- YAMLFormatter,
1676
- LoggerImpl,
1677
- LogWriteStream,
1678
- LogCollector,
1679
- MockLogger
1680
- };
1681
- //# sourceMappingURL=chunk-2DWEYXJH.js.map