@adviser/cement 0.4.61 → 0.4.63

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 (448) hide show
  1. package/cjs/app-context.cjs.map +1 -1
  2. package/cjs/app-context.d.ts.map +1 -1
  3. package/cjs/base-sys-abstraction.cjs.map +1 -1
  4. package/cjs/base-sys-abstraction.d.ts.map +1 -1
  5. package/cjs/bin2text.cjs.map +1 -1
  6. package/cjs/bin2text.d.ts.map +1 -1
  7. package/cjs/coerce-binary.cjs.map +1 -1
  8. package/cjs/coerce-binary.d.ts.map +1 -1
  9. package/cjs/crypto.cjs.map +1 -1
  10. package/cjs/crypto.d.ts.map +1 -1
  11. package/cjs/future.cjs.map +1 -1
  12. package/cjs/future.d.ts.map +1 -1
  13. package/cjs/http_header.cjs.map +1 -1
  14. package/cjs/http_header.d.ts.map +1 -1
  15. package/cjs/index.cjs +1 -0
  16. package/cjs/index.cjs.map +1 -1
  17. package/cjs/index.d.ts +1 -0
  18. package/cjs/index.d.ts.map +1 -1
  19. package/cjs/is-json.cjs.map +1 -1
  20. package/cjs/is-json.d.ts.map +1 -1
  21. package/cjs/is-promise.cjs.map +1 -1
  22. package/cjs/is-promise.d.ts.map +1 -1
  23. package/cjs/lru-map-set.cjs.map +1 -1
  24. package/cjs/lru-map-set.d.ts.map +1 -1
  25. package/cjs/on-func.cjs.map +1 -1
  26. package/cjs/on-func.d.ts.map +1 -1
  27. package/cjs/on-func.test.cjs +1 -1
  28. package/cjs/on-func.test.cjs.map +1 -1
  29. package/cjs/option.cjs.map +1 -1
  30. package/cjs/option.d.ts.map +1 -1
  31. package/cjs/poller.cjs +9 -4
  32. package/cjs/poller.cjs.map +1 -1
  33. package/cjs/poller.d.ts +9 -2
  34. package/cjs/poller.d.ts.map +1 -1
  35. package/cjs/poller.test.cjs +1 -1
  36. package/cjs/poller.test.cjs.map +1 -1
  37. package/cjs/{utils/promise-sleep.cjs → promise-sleep.cjs} +1 -1
  38. package/cjs/promise-sleep.cjs.map +1 -0
  39. package/cjs/promise-sleep.d.ts.map +1 -0
  40. package/cjs/promise-sleep.test.cjs.map +1 -0
  41. package/cjs/promise-sleep.test.d.ts.map +1 -0
  42. package/cjs/resolve-once.cjs +84 -6
  43. package/cjs/resolve-once.cjs.map +1 -1
  44. package/cjs/resolve-once.d.ts +36 -3
  45. package/cjs/resolve-once.d.ts.map +1 -1
  46. package/cjs/result.cjs.map +1 -1
  47. package/cjs/result.d.ts.map +1 -1
  48. package/cjs/runtime.cjs.map +1 -1
  49. package/cjs/runtime.d.ts.map +1 -1
  50. package/cjs/sys-env.cjs.map +1 -1
  51. package/cjs/sys-env.d.ts.map +1 -1
  52. package/cjs/timeouted.cjs +1 -1
  53. package/cjs/timeouted.cjs.map +1 -1
  54. package/cjs/timeouted.d.ts.map +1 -1
  55. package/cjs/tracer.cjs.map +1 -1
  56. package/cjs/tracer.d.ts.map +1 -1
  57. package/cjs/txt-en-decoder.cjs +2 -5
  58. package/cjs/txt-en-decoder.cjs.map +1 -1
  59. package/cjs/txt-en-decoder.d.ts +1 -1
  60. package/cjs/txt-en-decoder.d.ts.map +1 -1
  61. package/cjs/uri.cjs.map +1 -1
  62. package/cjs/uri.d.ts.map +1 -1
  63. package/cjs/utils/coerce-uint8.cjs.map +1 -1
  64. package/cjs/utils/coerce-uint8.d.ts.map +1 -1
  65. package/cjs/utils/console-write-stream.cjs.map +1 -1
  66. package/cjs/utils/console-write-stream.d.ts.map +1 -1
  67. package/cjs/utils/consume.cjs.map +1 -1
  68. package/cjs/utils/consume.d.ts.map +1 -1
  69. package/cjs/utils/fanout-write-stream.cjs.map +1 -1
  70. package/cjs/utils/fanout-write-stream.d.ts.map +1 -1
  71. package/cjs/utils/get-params-result.cjs.map +1 -1
  72. package/cjs/utils/get-params-result.d.ts.map +1 -1
  73. package/cjs/utils/index.cjs +0 -1
  74. package/cjs/utils/index.cjs.map +1 -1
  75. package/cjs/utils/index.d.ts +0 -1
  76. package/cjs/utils/index.d.ts.map +1 -1
  77. package/cjs/utils/rebuffer.cjs.map +1 -1
  78. package/cjs/utils/rebuffer.d.ts.map +1 -1
  79. package/cjs/utils/relative-path.cjs.map +1 -1
  80. package/cjs/utils/relative-path.d.ts.map +1 -1
  81. package/cjs/utils/sorted-object.cjs.map +1 -1
  82. package/cjs/utils/sorted-object.d.ts.map +1 -1
  83. package/cjs/utils/stream-map.cjs.map +1 -1
  84. package/cjs/utils/stream-map.d.ts.map +1 -1
  85. package/cjs/utils/stream2string.cjs.map +1 -1
  86. package/cjs/utils/stream2string.d.ts.map +1 -1
  87. package/cjs/utils/string2stream.cjs.map +1 -1
  88. package/cjs/utils/string2stream.d.ts.map +1 -1
  89. package/cjs/utils/stripper.cjs.map +1 -1
  90. package/cjs/utils/stripper.d.ts.map +1 -1
  91. package/cjs/utils/to-sorted.cjs.map +1 -1
  92. package/cjs/utils/to-sorted.d.ts.map +1 -1
  93. package/cjs/utils/uint8array-equal.cjs.map +1 -1
  94. package/cjs/utils/uint8array-equal.d.ts.map +1 -1
  95. package/cjs/version.cjs +1 -1
  96. package/deno.json +1 -1
  97. package/esm/app-context.d.ts.map +1 -1
  98. package/esm/app-context.js.map +1 -1
  99. package/esm/base-sys-abstraction.d.ts.map +1 -1
  100. package/esm/base-sys-abstraction.js.map +1 -1
  101. package/esm/bin2text.d.ts.map +1 -1
  102. package/esm/bin2text.js.map +1 -1
  103. package/esm/coerce-binary.d.ts.map +1 -1
  104. package/esm/coerce-binary.js.map +1 -1
  105. package/esm/crypto.d.ts.map +1 -1
  106. package/esm/crypto.js.map +1 -1
  107. package/esm/future.d.ts.map +1 -1
  108. package/esm/future.js.map +1 -1
  109. package/esm/http_header.d.ts.map +1 -1
  110. package/esm/http_header.js.map +1 -1
  111. package/esm/index.d.ts +1 -0
  112. package/esm/index.d.ts.map +1 -1
  113. package/esm/index.js +1 -0
  114. package/esm/index.js.map +1 -1
  115. package/esm/is-json.d.ts.map +1 -1
  116. package/esm/is-json.js.map +1 -1
  117. package/esm/is-promise.d.ts.map +1 -1
  118. package/esm/is-promise.js.map +1 -1
  119. package/esm/lru-map-set.d.ts.map +1 -1
  120. package/esm/lru-map-set.js.map +1 -1
  121. package/esm/on-func.d.ts.map +1 -1
  122. package/esm/on-func.js.map +1 -1
  123. package/esm/on-func.test.js +1 -1
  124. package/esm/on-func.test.js.map +1 -1
  125. package/esm/option.d.ts.map +1 -1
  126. package/esm/option.js.map +1 -1
  127. package/esm/poller.d.ts +9 -2
  128. package/esm/poller.d.ts.map +1 -1
  129. package/esm/poller.js +9 -4
  130. package/esm/poller.js.map +1 -1
  131. package/esm/poller.test.js +1 -1
  132. package/esm/poller.test.js.map +1 -1
  133. package/esm/promise-sleep.d.ts.map +1 -0
  134. package/{ts/esm/utils → esm}/promise-sleep.js +1 -1
  135. package/esm/promise-sleep.js.map +1 -0
  136. package/esm/promise-sleep.test.d.ts.map +1 -0
  137. package/esm/promise-sleep.test.js.map +1 -0
  138. package/esm/resolve-once.d.ts +36 -3
  139. package/esm/resolve-once.d.ts.map +1 -1
  140. package/esm/resolve-once.js +84 -6
  141. package/esm/resolve-once.js.map +1 -1
  142. package/esm/result.d.ts.map +1 -1
  143. package/esm/result.js.map +1 -1
  144. package/esm/runtime.d.ts.map +1 -1
  145. package/esm/runtime.js.map +1 -1
  146. package/esm/sys-env.d.ts.map +1 -1
  147. package/esm/sys-env.js.map +1 -1
  148. package/esm/timeouted.d.ts.map +1 -1
  149. package/esm/timeouted.js +1 -1
  150. package/esm/timeouted.js.map +1 -1
  151. package/esm/tracer.d.ts.map +1 -1
  152. package/esm/tracer.js.map +1 -1
  153. package/esm/txt-en-decoder.d.ts +1 -1
  154. package/esm/txt-en-decoder.d.ts.map +1 -1
  155. package/esm/txt-en-decoder.js +2 -5
  156. package/esm/txt-en-decoder.js.map +1 -1
  157. package/esm/uri.d.ts.map +1 -1
  158. package/esm/uri.js.map +1 -1
  159. package/esm/utils/coerce-uint8.d.ts.map +1 -1
  160. package/esm/utils/coerce-uint8.js.map +1 -1
  161. package/esm/utils/console-write-stream.d.ts.map +1 -1
  162. package/esm/utils/console-write-stream.js.map +1 -1
  163. package/esm/utils/consume.d.ts.map +1 -1
  164. package/esm/utils/consume.js.map +1 -1
  165. package/esm/utils/fanout-write-stream.d.ts.map +1 -1
  166. package/esm/utils/fanout-write-stream.js.map +1 -1
  167. package/esm/utils/get-params-result.d.ts.map +1 -1
  168. package/esm/utils/get-params-result.js.map +1 -1
  169. package/esm/utils/index.d.ts +0 -1
  170. package/esm/utils/index.d.ts.map +1 -1
  171. package/esm/utils/index.js +0 -1
  172. package/esm/utils/index.js.map +1 -1
  173. package/esm/utils/rebuffer.d.ts.map +1 -1
  174. package/esm/utils/rebuffer.js.map +1 -1
  175. package/esm/utils/relative-path.d.ts.map +1 -1
  176. package/esm/utils/relative-path.js.map +1 -1
  177. package/esm/utils/sorted-object.d.ts.map +1 -1
  178. package/esm/utils/sorted-object.js.map +1 -1
  179. package/esm/utils/stream-map.d.ts.map +1 -1
  180. package/esm/utils/stream-map.js.map +1 -1
  181. package/esm/utils/stream2string.d.ts.map +1 -1
  182. package/esm/utils/stream2string.js.map +1 -1
  183. package/esm/utils/string2stream.d.ts.map +1 -1
  184. package/esm/utils/string2stream.js.map +1 -1
  185. package/esm/utils/stripper.d.ts.map +1 -1
  186. package/esm/utils/stripper.js.map +1 -1
  187. package/esm/utils/to-sorted.d.ts.map +1 -1
  188. package/esm/utils/to-sorted.js.map +1 -1
  189. package/esm/utils/uint8array-equal.d.ts.map +1 -1
  190. package/esm/utils/uint8array-equal.js.map +1 -1
  191. package/esm/version.js +1 -1
  192. package/package.json +5 -2
  193. package/src/app-context.ts +111 -5
  194. package/src/base-sys-abstraction.ts +244 -0
  195. package/src/bin2text.ts +37 -0
  196. package/src/coerce-binary.ts +41 -0
  197. package/src/crypto.ts +35 -0
  198. package/src/future.ts +45 -1
  199. package/src/http_header.ts +277 -1
  200. package/src/index.ts +2 -4
  201. package/src/is-json.ts +21 -0
  202. package/src/is-promise.ts +26 -0
  203. package/src/lru-map-set.ts +46 -0
  204. package/src/on-func.ts +38 -0
  205. package/src/option.ts +27 -0
  206. package/src/poller.ts +66 -18
  207. package/src/{utils/promise-sleep.ts → promise-sleep.ts} +33 -5
  208. package/src/resolve-once.ts +588 -42
  209. package/src/result.ts +50 -0
  210. package/src/runtime.ts +75 -2
  211. package/src/sys-env.ts +57 -0
  212. package/src/timeouted.ts +93 -1
  213. package/src/tracer.ts +41 -0
  214. package/src/txt-en-decoder.ts +2 -5
  215. package/src/uri.ts +76 -4
  216. package/src/utils/coerce-uint8.ts +60 -0
  217. package/src/utils/console-write-stream.ts +34 -0
  218. package/src/utils/consume.ts +106 -0
  219. package/src/utils/fanout-write-stream.ts +45 -0
  220. package/src/utils/get-params-result.ts +37 -0
  221. package/src/utils/index.ts +0 -1
  222. package/src/utils/rebuffer.ts +42 -0
  223. package/src/utils/relative-path.ts +108 -0
  224. package/src/utils/sorted-object.ts +50 -0
  225. package/src/utils/stream-map.ts +90 -0
  226. package/src/utils/stream2string.ts +35 -0
  227. package/src/utils/string2stream.ts +30 -0
  228. package/src/utils/stripper.ts +34 -0
  229. package/src/utils/to-sorted.ts +34 -0
  230. package/src/utils/uint8array-equal.ts +20 -0
  231. package/ts/cjs/app-context.d.ts.map +1 -1
  232. package/ts/cjs/app-context.js.map +1 -1
  233. package/ts/cjs/base-sys-abstraction.d.ts.map +1 -1
  234. package/ts/cjs/base-sys-abstraction.js.map +1 -1
  235. package/ts/cjs/bin2text.d.ts.map +1 -1
  236. package/ts/cjs/bin2text.js.map +1 -1
  237. package/ts/cjs/coerce-binary.d.ts.map +1 -1
  238. package/ts/cjs/coerce-binary.js.map +1 -1
  239. package/ts/cjs/crypto.d.ts.map +1 -1
  240. package/ts/cjs/crypto.js.map +1 -1
  241. package/ts/cjs/future.d.ts.map +1 -1
  242. package/ts/cjs/future.js.map +1 -1
  243. package/ts/cjs/http_header.d.ts.map +1 -1
  244. package/ts/cjs/http_header.js.map +1 -1
  245. package/ts/cjs/index.d.ts +1 -0
  246. package/ts/cjs/index.d.ts.map +1 -1
  247. package/ts/cjs/index.js +1 -0
  248. package/ts/cjs/index.js.map +1 -1
  249. package/ts/cjs/is-json.d.ts.map +1 -1
  250. package/ts/cjs/is-json.js.map +1 -1
  251. package/ts/cjs/is-promise.d.ts.map +1 -1
  252. package/ts/cjs/is-promise.js.map +1 -1
  253. package/ts/cjs/lru-map-set.d.ts.map +1 -1
  254. package/ts/cjs/lru-map-set.js.map +1 -1
  255. package/ts/cjs/on-func.d.ts.map +1 -1
  256. package/ts/cjs/on-func.js.map +1 -1
  257. package/ts/cjs/on-func.test.js +1 -1
  258. package/ts/cjs/on-func.test.js.map +1 -1
  259. package/ts/cjs/option.d.ts.map +1 -1
  260. package/ts/cjs/option.js.map +1 -1
  261. package/ts/cjs/poller.d.ts +9 -2
  262. package/ts/cjs/poller.d.ts.map +1 -1
  263. package/ts/cjs/poller.js +9 -4
  264. package/ts/cjs/poller.js.map +1 -1
  265. package/ts/cjs/poller.test.js +1 -1
  266. package/ts/cjs/poller.test.js.map +1 -1
  267. package/ts/cjs/promise-sleep.d.ts.map +1 -0
  268. package/ts/cjs/{utils/promise-sleep.js → promise-sleep.js} +1 -1
  269. package/ts/cjs/promise-sleep.js.map +1 -0
  270. package/ts/cjs/promise-sleep.test.d.ts.map +1 -0
  271. package/ts/cjs/promise-sleep.test.js.map +1 -0
  272. package/ts/cjs/resolve-once.d.ts +36 -3
  273. package/ts/cjs/resolve-once.d.ts.map +1 -1
  274. package/ts/cjs/resolve-once.js +84 -6
  275. package/ts/cjs/resolve-once.js.map +1 -1
  276. package/ts/cjs/result.d.ts.map +1 -1
  277. package/ts/cjs/result.js.map +1 -1
  278. package/ts/cjs/runtime.d.ts.map +1 -1
  279. package/ts/cjs/runtime.js.map +1 -1
  280. package/ts/cjs/sys-env.d.ts.map +1 -1
  281. package/ts/cjs/sys-env.js.map +1 -1
  282. package/ts/cjs/timeouted.d.ts.map +1 -1
  283. package/ts/cjs/timeouted.js +1 -1
  284. package/ts/cjs/timeouted.js.map +1 -1
  285. package/ts/cjs/tracer.d.ts.map +1 -1
  286. package/ts/cjs/tracer.js.map +1 -1
  287. package/ts/cjs/txt-en-decoder.d.ts +1 -1
  288. package/ts/cjs/txt-en-decoder.d.ts.map +1 -1
  289. package/ts/cjs/txt-en-decoder.js +2 -5
  290. package/ts/cjs/txt-en-decoder.js.map +1 -1
  291. package/ts/cjs/uri.d.ts.map +1 -1
  292. package/ts/cjs/uri.js.map +1 -1
  293. package/ts/cjs/utils/coerce-uint8.d.ts.map +1 -1
  294. package/ts/cjs/utils/coerce-uint8.js.map +1 -1
  295. package/ts/cjs/utils/console-write-stream.d.ts.map +1 -1
  296. package/ts/cjs/utils/console-write-stream.js.map +1 -1
  297. package/ts/cjs/utils/consume.d.ts.map +1 -1
  298. package/ts/cjs/utils/consume.js.map +1 -1
  299. package/ts/cjs/utils/fanout-write-stream.d.ts.map +1 -1
  300. package/ts/cjs/utils/fanout-write-stream.js.map +1 -1
  301. package/ts/cjs/utils/get-params-result.d.ts.map +1 -1
  302. package/ts/cjs/utils/get-params-result.js.map +1 -1
  303. package/ts/cjs/utils/index.d.ts +0 -1
  304. package/ts/cjs/utils/index.d.ts.map +1 -1
  305. package/ts/cjs/utils/index.js +0 -1
  306. package/ts/cjs/utils/index.js.map +1 -1
  307. package/ts/cjs/utils/rebuffer.d.ts.map +1 -1
  308. package/ts/cjs/utils/rebuffer.js.map +1 -1
  309. package/ts/cjs/utils/relative-path.d.ts.map +1 -1
  310. package/ts/cjs/utils/relative-path.js.map +1 -1
  311. package/ts/cjs/utils/sorted-object.d.ts.map +1 -1
  312. package/ts/cjs/utils/sorted-object.js.map +1 -1
  313. package/ts/cjs/utils/stream-map.d.ts.map +1 -1
  314. package/ts/cjs/utils/stream-map.js.map +1 -1
  315. package/ts/cjs/utils/stream2string.d.ts.map +1 -1
  316. package/ts/cjs/utils/stream2string.js.map +1 -1
  317. package/ts/cjs/utils/string2stream.d.ts.map +1 -1
  318. package/ts/cjs/utils/string2stream.js.map +1 -1
  319. package/ts/cjs/utils/stripper.d.ts.map +1 -1
  320. package/ts/cjs/utils/stripper.js.map +1 -1
  321. package/ts/cjs/utils/to-sorted.d.ts.map +1 -1
  322. package/ts/cjs/utils/to-sorted.js.map +1 -1
  323. package/ts/cjs/utils/uint8array-equal.d.ts.map +1 -1
  324. package/ts/cjs/utils/uint8array-equal.js.map +1 -1
  325. package/ts/cjs/version.js +1 -1
  326. package/ts/esm/app-context.d.ts.map +1 -1
  327. package/ts/esm/app-context.js.map +1 -1
  328. package/ts/esm/base-sys-abstraction.d.ts.map +1 -1
  329. package/ts/esm/base-sys-abstraction.js.map +1 -1
  330. package/ts/esm/bin2text.d.ts.map +1 -1
  331. package/ts/esm/bin2text.js.map +1 -1
  332. package/ts/esm/coerce-binary.d.ts.map +1 -1
  333. package/ts/esm/coerce-binary.js.map +1 -1
  334. package/ts/esm/crypto.d.ts.map +1 -1
  335. package/ts/esm/crypto.js.map +1 -1
  336. package/ts/esm/future.d.ts.map +1 -1
  337. package/ts/esm/future.js.map +1 -1
  338. package/ts/esm/http_header.d.ts.map +1 -1
  339. package/ts/esm/http_header.js.map +1 -1
  340. package/ts/esm/index.d.ts +1 -0
  341. package/ts/esm/index.d.ts.map +1 -1
  342. package/ts/esm/index.js +1 -0
  343. package/ts/esm/index.js.map +1 -1
  344. package/ts/esm/is-json.d.ts.map +1 -1
  345. package/ts/esm/is-json.js.map +1 -1
  346. package/ts/esm/is-promise.d.ts.map +1 -1
  347. package/ts/esm/is-promise.js.map +1 -1
  348. package/ts/esm/lru-map-set.d.ts.map +1 -1
  349. package/ts/esm/lru-map-set.js.map +1 -1
  350. package/ts/esm/on-func.d.ts.map +1 -1
  351. package/ts/esm/on-func.js.map +1 -1
  352. package/ts/esm/on-func.test.js +1 -1
  353. package/ts/esm/on-func.test.js.map +1 -1
  354. package/ts/esm/option.d.ts.map +1 -1
  355. package/ts/esm/option.js.map +1 -1
  356. package/ts/esm/poller.d.ts +9 -2
  357. package/ts/esm/poller.d.ts.map +1 -1
  358. package/ts/esm/poller.js +9 -4
  359. package/ts/esm/poller.js.map +1 -1
  360. package/ts/esm/poller.test.js +1 -1
  361. package/ts/esm/poller.test.js.map +1 -1
  362. package/ts/esm/promise-sleep.d.ts.map +1 -0
  363. package/{esm/utils → ts/esm}/promise-sleep.js +1 -1
  364. package/ts/esm/promise-sleep.js.map +1 -0
  365. package/ts/esm/promise-sleep.test.d.ts.map +1 -0
  366. package/ts/esm/promise-sleep.test.js.map +1 -0
  367. package/ts/esm/resolve-once.d.ts +36 -3
  368. package/ts/esm/resolve-once.d.ts.map +1 -1
  369. package/ts/esm/resolve-once.js +84 -6
  370. package/ts/esm/resolve-once.js.map +1 -1
  371. package/ts/esm/result.d.ts.map +1 -1
  372. package/ts/esm/result.js.map +1 -1
  373. package/ts/esm/runtime.d.ts.map +1 -1
  374. package/ts/esm/runtime.js.map +1 -1
  375. package/ts/esm/sys-env.d.ts.map +1 -1
  376. package/ts/esm/sys-env.js.map +1 -1
  377. package/ts/esm/timeouted.d.ts.map +1 -1
  378. package/ts/esm/timeouted.js +1 -1
  379. package/ts/esm/timeouted.js.map +1 -1
  380. package/ts/esm/tracer.d.ts.map +1 -1
  381. package/ts/esm/tracer.js.map +1 -1
  382. package/ts/esm/txt-en-decoder.d.ts +1 -1
  383. package/ts/esm/txt-en-decoder.d.ts.map +1 -1
  384. package/ts/esm/txt-en-decoder.js +2 -5
  385. package/ts/esm/txt-en-decoder.js.map +1 -1
  386. package/ts/esm/uri.d.ts.map +1 -1
  387. package/ts/esm/uri.js.map +1 -1
  388. package/ts/esm/utils/coerce-uint8.d.ts.map +1 -1
  389. package/ts/esm/utils/coerce-uint8.js.map +1 -1
  390. package/ts/esm/utils/console-write-stream.d.ts.map +1 -1
  391. package/ts/esm/utils/console-write-stream.js.map +1 -1
  392. package/ts/esm/utils/consume.d.ts.map +1 -1
  393. package/ts/esm/utils/consume.js.map +1 -1
  394. package/ts/esm/utils/fanout-write-stream.d.ts.map +1 -1
  395. package/ts/esm/utils/fanout-write-stream.js.map +1 -1
  396. package/ts/esm/utils/get-params-result.d.ts.map +1 -1
  397. package/ts/esm/utils/get-params-result.js.map +1 -1
  398. package/ts/esm/utils/index.d.ts +0 -1
  399. package/ts/esm/utils/index.d.ts.map +1 -1
  400. package/ts/esm/utils/index.js +0 -1
  401. package/ts/esm/utils/index.js.map +1 -1
  402. package/ts/esm/utils/rebuffer.d.ts.map +1 -1
  403. package/ts/esm/utils/rebuffer.js.map +1 -1
  404. package/ts/esm/utils/relative-path.d.ts.map +1 -1
  405. package/ts/esm/utils/relative-path.js.map +1 -1
  406. package/ts/esm/utils/sorted-object.d.ts.map +1 -1
  407. package/ts/esm/utils/sorted-object.js.map +1 -1
  408. package/ts/esm/utils/stream-map.d.ts.map +1 -1
  409. package/ts/esm/utils/stream-map.js.map +1 -1
  410. package/ts/esm/utils/stream2string.d.ts.map +1 -1
  411. package/ts/esm/utils/stream2string.js.map +1 -1
  412. package/ts/esm/utils/string2stream.d.ts.map +1 -1
  413. package/ts/esm/utils/string2stream.js.map +1 -1
  414. package/ts/esm/utils/stripper.d.ts.map +1 -1
  415. package/ts/esm/utils/stripper.js.map +1 -1
  416. package/ts/esm/utils/to-sorted.d.ts.map +1 -1
  417. package/ts/esm/utils/to-sorted.js.map +1 -1
  418. package/ts/esm/utils/uint8array-equal.d.ts.map +1 -1
  419. package/ts/esm/utils/uint8array-equal.js.map +1 -1
  420. package/ts/esm/version.js +1 -1
  421. package/cjs/utils/promise-sleep.cjs.map +0 -1
  422. package/cjs/utils/promise-sleep.d.ts.map +0 -1
  423. package/cjs/utils/promise-sleep.test.cjs.map +0 -1
  424. package/cjs/utils/promise-sleep.test.d.ts.map +0 -1
  425. package/esm/utils/promise-sleep.d.ts.map +0 -1
  426. package/esm/utils/promise-sleep.js.map +0 -1
  427. package/esm/utils/promise-sleep.test.d.ts.map +0 -1
  428. package/esm/utils/promise-sleep.test.js.map +0 -1
  429. package/ts/cjs/utils/promise-sleep.d.ts.map +0 -1
  430. package/ts/cjs/utils/promise-sleep.js.map +0 -1
  431. package/ts/cjs/utils/promise-sleep.test.d.ts.map +0 -1
  432. package/ts/cjs/utils/promise-sleep.test.js.map +0 -1
  433. package/ts/esm/utils/promise-sleep.d.ts.map +0 -1
  434. package/ts/esm/utils/promise-sleep.js.map +0 -1
  435. package/ts/esm/utils/promise-sleep.test.d.ts.map +0 -1
  436. package/ts/esm/utils/promise-sleep.test.js.map +0 -1
  437. /package/cjs/{utils/promise-sleep.d.ts → promise-sleep.d.ts} +0 -0
  438. /package/cjs/{utils/promise-sleep.test.cjs → promise-sleep.test.cjs} +0 -0
  439. /package/cjs/{utils/promise-sleep.test.d.ts → promise-sleep.test.d.ts} +0 -0
  440. /package/esm/{utils/promise-sleep.d.ts → promise-sleep.d.ts} +0 -0
  441. /package/esm/{utils/promise-sleep.test.d.ts → promise-sleep.test.d.ts} +0 -0
  442. /package/esm/{utils/promise-sleep.test.js → promise-sleep.test.js} +0 -0
  443. /package/ts/cjs/{utils/promise-sleep.d.ts → promise-sleep.d.ts} +0 -0
  444. /package/ts/cjs/{utils/promise-sleep.test.d.ts → promise-sleep.test.d.ts} +0 -0
  445. /package/ts/cjs/{utils/promise-sleep.test.js → promise-sleep.test.js} +0 -0
  446. /package/ts/esm/{utils/promise-sleep.d.ts → promise-sleep.d.ts} +0 -0
  447. /package/ts/esm/{utils/promise-sleep.test.d.ts → promise-sleep.test.d.ts} +0 -0
  448. /package/ts/esm/{utils/promise-sleep.test.js → promise-sleep.test.js} +0 -0
package/src/result.ts CHANGED
@@ -1,5 +1,32 @@
1
1
  import { isPromise } from "./is-promise.js";
2
2
 
3
+ /**
4
+ * Result type for representing success (Ok) or failure (Err) values.
5
+ *
6
+ * Result is a type-safe way to handle operations that can fail, similar to Rust's
7
+ * Result type. It forces explicit handling of both success and error cases without
8
+ * throwing exceptions.
9
+ *
10
+ * @template T - The type of the success value
11
+ * @template E - The type of the error (default: Error)
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * function divide(a: number, b: number): Result<number> {
16
+ * if (b === 0) {
17
+ * return Result.Err('Division by zero');
18
+ * }
19
+ * return Result.Ok(a / b);
20
+ * }
21
+ *
22
+ * const result = divide(10, 2);
23
+ * if (result.isOk()) {
24
+ * console.log('Result:', result.unwrap());
25
+ * } else {
26
+ * console.error('Error:', result.unwrap_err());
27
+ * }
28
+ * ```
29
+ */
3
30
  export abstract class Result<T, E = Error> {
4
31
  static Ok<T = void>(...args: T[]): Result<T, Error> {
5
32
  return args.length >= 1 ? new ResultOK<T>(args[0]) : new ResultOK<T>(undefined as unknown as T);
@@ -95,6 +122,29 @@ export type WithoutResult<T> = T extends Result<infer U> ? U : T;
95
122
  // type WithoutPromise<T> = T extends Promise<infer U> ? U : T;
96
123
  type WithResult<T> = T extends Promise<infer U> ? Promise<Result<U>> : Result<T>;
97
124
 
125
+ /**
126
+ * Wraps a function to convert thrown exceptions into Result.Err values.
127
+ *
128
+ * Executes the provided function and returns Result.Ok on success or Result.Err
129
+ * on thrown exceptions. Supports both synchronous and asynchronous functions.
130
+ *
131
+ * @template FN - Function type that returns T or Promise<T>
132
+ * @template T - The return type of the function
133
+ * @param fn - Function to execute with exception handling
134
+ * @returns Result<T> for sync functions, Promise<Result<T>> for async functions
135
+ *
136
+ * @example
137
+ * ```typescript
138
+ * const result = exception2Result(() => {
139
+ * return JSON.parse('invalid json');
140
+ * });
141
+ * // result is Result.Err with parse error
142
+ *
143
+ * const asyncResult = await exception2Result(async () => {
144
+ * return await fetch('/api/data');
145
+ * });
146
+ * ```
147
+ */
98
148
  export function exception2Result<FN extends () => Promise<T> | T, T>(fn: FN): WithResult<ReturnType<FN>> {
99
149
  try {
100
150
  const res = fn();
package/src/runtime.ts CHANGED
@@ -1,11 +1,51 @@
1
+ /**
2
+ * Runtime environment detection result.
3
+ *
4
+ * Provides boolean flags indicating which JavaScript runtime environment
5
+ * the code is currently executing in. Only one flag should be true at a time,
6
+ * allowing for runtime-specific behavior and feature detection.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const runtime = runtimeFn();
11
+ * if (runtime.isNodeIsh) {
12
+ * console.log('Running in Node.js or Bun');
13
+ * } else if (runtime.isBrowser) {
14
+ * console.log('Running in a browser');
15
+ * }
16
+ * ```
17
+ */
1
18
  export interface Runtime {
19
+ /** True if running in Node.js or Node-compatible runtime (e.g., Bun) */
2
20
  isNodeIsh: boolean;
21
+ /** True if running in a web browser */
3
22
  isBrowser: boolean;
23
+ /** True if running in Deno */
4
24
  isDeno: boolean;
25
+ /** True if running in React Native */
5
26
  isReactNative: boolean;
27
+ /** True if running in Cloudflare Workers */
6
28
  isCFWorker: boolean;
7
29
  }
8
30
 
31
+ /**
32
+ * Checks if a nested property path exists on an object.
33
+ *
34
+ * Recursively traverses dot-separated property paths to determine if they exist
35
+ * and are truthy. Used internally for runtime environment detection by checking
36
+ * for environment-specific global objects.
37
+ *
38
+ * @param value - Dot-separated property path to check (e.g., "process.versions.node")
39
+ * @param ref - Object to check properties on (defaults to globalThis)
40
+ * @returns True if the full path exists and all values are truthy
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * isSet("process.versions.node"); // true in Node.js
45
+ * isSet("Deno"); // true in Deno
46
+ * isSet("navigator.userAgent"); // true in browsers
47
+ * ```
48
+ */
9
49
  function isSet(value: string, ref: Record<string, unknown> = globalThis): boolean {
10
50
  const [head, ...tail] = value.split(".");
11
51
  if (["object", "function"].includes(typeof ref) && ref && ["object", "function"].includes(typeof ref[head]) && ref[head]) {
@@ -17,8 +57,41 @@ function isSet(value: string, ref: Record<string, unknown> = globalThis): boolea
17
57
  return false;
18
58
  }
19
59
 
20
- // caches.default or WebSocketPair
21
-
60
+ /**
61
+ * Detects the current JavaScript runtime environment.
62
+ *
63
+ * Performs feature detection to identify which runtime environment the code
64
+ * is executing in. Checks for environment-specific global objects and APIs
65
+ * in priority order:
66
+ * 1. Cloudflare Workers (caches.default + WebSocketPair)
67
+ * 2. React Native (navigator.product === "ReactNative")
68
+ * 3. Deno (global Deno object)
69
+ * 4. Node.js (process.versions.node)
70
+ * 5. Browser (none of the above)
71
+ *
72
+ * The detection is mutually exclusive - only one environment flag will be true.
73
+ *
74
+ * @returns Runtime object with boolean flags for each environment
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const runtime = runtimeFn();
79
+ *
80
+ * if (runtime.isNodeIsh) {
81
+ * // Use Node.js APIs
82
+ * const fs = require('fs');
83
+ * } else if (runtime.isBrowser) {
84
+ * // Use browser APIs
85
+ * console.log(window.location.href);
86
+ * } else if (runtime.isDeno) {
87
+ * // Use Deno APIs
88
+ * const file = await Deno.readTextFile('./config.json');
89
+ * } else if (runtime.isCFWorker) {
90
+ * // Use Cloudflare Workers APIs
91
+ * const cache = caches.default;
92
+ * }
93
+ * ```
94
+ */
22
95
  export function runtimeFn(): Runtime {
23
96
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
97
  const gt: any = globalThis;
package/src/sys-env.ts CHANGED
@@ -49,6 +49,26 @@ const envActions: { id: string; fn: EnvFactoryFn }[] = [
49
49
  { id: "browser", fn: (opts: Partial<EnvFactoryOpts>): EnvActions => BrowserEnvActions.new(opts) },
50
50
  ];
51
51
 
52
+ /**
53
+ * Registers a custom environment action factory.
54
+ *
55
+ * Allows registration of platform-specific environment implementations.
56
+ * The factory is added to the beginning of the search list and will be
57
+ * tried first when creating new Env instances.
58
+ *
59
+ * @param fn - Factory function that creates EnvActions for a platform
60
+ * @returns Unregister function to remove the factory
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const unregister = registerEnvAction((opts) => {
65
+ * return new CustomEnvActions(opts);
66
+ * });
67
+ *
68
+ * // Later, remove the factory
69
+ * unregister();
70
+ * ```
71
+ */
52
72
  export function registerEnvAction(fn: EnvFactoryFn): () => void {
53
73
  const id = `id-${Math.random()}`;
54
74
  envActions.unshift({ id, fn });
@@ -63,6 +83,43 @@ export function registerEnvAction(fn: EnvFactoryFn): () => void {
63
83
  }
64
84
 
65
85
  const _envFactories = new KeyedResolvOnce<Env>();
86
+
87
+ /**
88
+ * Creates a platform-appropriate environment variable interface.
89
+ *
90
+ * Automatically detects the runtime environment (Node.js, Deno, browser,
91
+ * Cloudflare Workers) and returns an Env instance with platform-specific
92
+ * implementations. Supports preset values, change notifications, and
93
+ * type-safe multi-key retrieval.
94
+ *
95
+ * @param opts - Optional configuration:
96
+ * - symbol: Key for browser environment storage (default: "CP_ENV")
97
+ * - presetEnv: Map of preset environment variables
98
+ * - testPatchImportMetaEnv: Test values to patch into import.meta.env
99
+ * - id: Identifier for caching/reinitialization
100
+ *
101
+ * @returns Env instance for the detected platform
102
+ * @throws Error if no compatible environment is detected
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * const env = envFactory();
107
+ *
108
+ * // Get single value
109
+ * const apiKey = env.get('API_KEY');
110
+ *
111
+ * // Get multiple values with Result
112
+ * const config = env.gets('DB_HOST', 'DB_PORT', 'DB_NAME');
113
+ * if (config.isOk()) {
114
+ * const { DB_HOST, DB_PORT, DB_NAME } = config.unwrap();
115
+ * }
116
+ *
117
+ * // Listen for changes
118
+ * env.onSet((key, value) => {
119
+ * console.log(`${key} changed to ${value}`);
120
+ * }, 'API_KEY'); // Optional: filter by specific keys
121
+ * ```
122
+ */
66
123
  export function envFactory(opts: Partial<EnvFactoryOpts> = {}): Env {
67
124
  const found = envActions.find((fi) => fi.fn(opts).active());
68
125
  if (!found) {
package/src/timeouted.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Future } from "./future.js";
2
2
  import { isPromise } from "./is-promise.js";
3
- import { sleep } from "./utils/promise-sleep.js";
3
+ import { sleep } from "./promise-sleep.js";
4
4
 
5
5
  export interface PurTimeoutResultSuccess<T> {
6
6
  readonly state: "success";
@@ -61,22 +61,58 @@ export interface TimeoutActionOptions<CTX> {
61
61
  // TYPE GUARDS
62
62
  // ============================================================================
63
63
 
64
+ /**
65
+ * Type guard to check if a TimeoutResult represents a successful completion.
66
+ *
67
+ * @template T - The type of the result value
68
+ * @param result - The TimeoutResult to check
69
+ * @returns True if the result state is "success"
70
+ */
64
71
  export function isSuccess<T>(result: TimeoutResult<T>): result is TimeoutResultSuccess<T> {
65
72
  return result.state === "success";
66
73
  }
67
74
 
75
+ /**
76
+ * Type guard to check if a TimeoutResult represents a timeout.
77
+ *
78
+ * @template T - The type of the result value
79
+ * @param result - The TimeoutResult to check
80
+ * @returns True if the result state is "timeout"
81
+ */
68
82
  export function isTimeout<T>(result: TimeoutResult<T>): result is TimeoutResultTimeout<T> {
69
83
  return result.state === "timeout";
70
84
  }
71
85
 
86
+ /**
87
+ * Type guard to check if a TimeoutResult was aborted via AbortSignal.
88
+ *
89
+ * @template T - The type of the result value
90
+ * @param result - The TimeoutResult to check
91
+ * @returns True if the result state is "aborted"
92
+ */
72
93
  export function isAborted<T>(result: TimeoutResult<T>): result is TimeoutResultAborted<T> {
73
94
  return result.state === "aborted";
74
95
  }
75
96
 
97
+ /**
98
+ * Type guard to check if a TimeoutResult represents an error during execution.
99
+ *
100
+ * @template T - The type of the result value
101
+ * @param result - The TimeoutResult to check
102
+ * @returns True if the result state is "error"
103
+ */
76
104
  export function isError<T>(result: TimeoutResult<T>): result is TimeoutResultError<T> {
77
105
  return result.state === "error";
78
106
  }
79
107
 
108
+ /**
109
+ * Extracts the value from a successful TimeoutResult or throws an error.
110
+ *
111
+ * @template T - The type of the result value
112
+ * @param result - The TimeoutResult to unwrap
113
+ * @returns The success value
114
+ * @throws Error if the result is not in success state
115
+ */
80
116
  export function unwrap<T>(result: TimeoutResult<T>): T {
81
117
  if (isSuccess(result)) {
82
118
  return result.value;
@@ -84,10 +120,66 @@ export function unwrap<T>(result: TimeoutResult<T>): T {
84
120
  throw new Error(`TimeoutResult is not success: ${result.state}`);
85
121
  }
86
122
 
123
+ /**
124
+ * Extracts the value from a successful TimeoutResult or returns a default value.
125
+ *
126
+ * @template T - The type of the result value
127
+ * @param result - The TimeoutResult to unwrap
128
+ * @param defaultValue - The value to return if result is not successful
129
+ * @returns The success value or the default value
130
+ */
87
131
  export function unwrapOr<T>(result: TimeoutResult<T>, defaultValue: T): T {
88
132
  return isSuccess(result) ? result.value : defaultValue;
89
133
  }
90
134
 
135
+ /**
136
+ * Executes an action with comprehensive timeout and abort handling.
137
+ *
138
+ * Wraps a promise or async function with timeout, abort signal, and error handling capabilities.
139
+ * The action can be controlled via AbortController and will properly clean up resources.
140
+ *
141
+ * @template T - The type of the action's result value
142
+ * @template CTX - Optional context type passed through to callbacks
143
+ * @param action - Either a Promise or a function that receives an AbortController and returns a Promise
144
+ * @param options - Optional configuration:
145
+ * - timeout: Timeout duration in milliseconds (default: 30000). Set to 0 or negative to disable.
146
+ * - signal: External AbortSignal to link for cancellation
147
+ * - controller: External AbortController to use instead of creating a new one
148
+ * - ctx: Context object passed through in the result
149
+ * - onTimeout: Callback invoked when timeout occurs
150
+ * - onAbort: Callback invoked when aborted (with abort reason)
151
+ * - onError: Callback invoked when action throws an error
152
+ * - onAbortAction: Callback for cleanup when action needs to be aborted
153
+ *
154
+ * @returns Promise resolving to a TimeoutResult containing:
155
+ * - state: "success" | "timeout" | "aborted" | "error"
156
+ * - value (if success), error (if error), or reason (if aborted)
157
+ * - duration: Elapsed time in milliseconds
158
+ * - ctx: The context object if provided
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * // With a function that can be aborted
163
+ * const result = await timeouted(
164
+ * async (controller) => {
165
+ * return fetch(url, { signal: controller.signal });
166
+ * },
167
+ * { timeout: 5000 }
168
+ * );
169
+ *
170
+ * if (isSuccess(result)) {
171
+ * console.log('Request completed:', result.value);
172
+ * } else if (isTimeout(result)) {
173
+ * console.log('Request timed out after', result.duration, 'ms');
174
+ * }
175
+ *
176
+ * // With a direct promise
177
+ * const result2 = await timeouted(
178
+ * fetch(url),
179
+ * { timeout: 3000 }
180
+ * );
181
+ * ```
182
+ */
91
183
  export async function timeouted<T, CTX = void>(
92
184
  action: TimeoutAction<T>,
93
185
  options: Partial<TimeoutActionOptions<CTX>> = {},
package/src/tracer.ts CHANGED
@@ -24,6 +24,24 @@ export type TraceCtxParam = {
24
24
  }> &
25
25
  Record<string, unknown>;
26
26
 
27
+ /**
28
+ * Represents a single metric value that can be tracked and accumulated.
29
+ *
30
+ * Metrics can store any type of value and support addition operations
31
+ * for numbers and arrays. Used within the tracing system to collect
32
+ * performance data and custom measurements.
33
+ *
34
+ * @template T - The type of the metric value
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * const counter = new Metric<number>('/api/requests');
39
+ * counter.set(0);
40
+ * counter.add(1);
41
+ * counter.add(5);
42
+ * console.log(counter.value); // 6
43
+ * ```
44
+ */
27
45
  export class Metric<T> {
28
46
  value?: T;
29
47
  readonly path: string;
@@ -55,6 +73,29 @@ export class Metric<T> {
55
73
 
56
74
  export type MetricMap = Map<string, Metric<unknown>>;
57
75
 
76
+ /**
77
+ * Container for managing multiple metrics within a trace span.
78
+ *
79
+ * Metrics provides hierarchical metric management with path-based access.
80
+ * Metrics can be defined at absolute paths (starting with /) or relative
81
+ * to the current trace span. Supports JSON serialization of all metrics.
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const metrics = new Metrics(traceNode);
86
+ *
87
+ * // Absolute path
88
+ * const totalRequests = metrics.get<number>('/api/total_requests');
89
+ * totalRequests.set(100);
90
+ *
91
+ * // Relative path (uses trace node's root path)
92
+ * const spanRequests = metrics.get<number>('requests');
93
+ * spanRequests.add(1);
94
+ *
95
+ * // Export as JSON
96
+ * const data = metrics.toJSON();
97
+ * ```
98
+ */
58
99
  export class Metrics {
59
100
  readonly tracenode: TraceNode;
60
101
  private readonly map: MetricMap;
@@ -1,4 +1,4 @@
1
- import { ResolveOnce } from "./resolve-once.js";
1
+ import { Lazy } from "./resolve-once.js";
2
2
  import { Result } from "./result.js";
3
3
  import { coerceIntoUint8, ToUInt8 } from "./utils/coerce-uint8.js";
4
4
 
@@ -50,7 +50,4 @@ class TxtOps implements TxtEnDecoder {
50
50
  }
51
51
  }
52
52
 
53
- const txtEnDecoder = new ResolveOnce<TxtEnDecoder>();
54
- export function TxtEnDecoderSingleton(): TxtEnDecoder {
55
- return txtEnDecoder.once(() => new TxtOps());
56
- }
53
+ export const TxtEnDecoderSingleton: () => TxtEnDecoder = Lazy((): TxtEnDecoder => new TxtOps());
package/src/uri.ts CHANGED
@@ -16,9 +16,6 @@ export interface IsURIResult {
16
16
  readonly uri?: URI;
17
17
  }
18
18
 
19
- /** @xdeprecated use param from get-params-result */
20
- // export const key = param;
21
-
22
19
  /*
23
20
  if KeyParam is a Object
24
21
  if the right side is a string, it is the default value
@@ -172,6 +169,24 @@ function ensureURLWithDefaultProto<T>(
172
169
  }
173
170
  }
174
171
 
172
+ /**
173
+ * Type guard to check if a value is a URL object.
174
+ *
175
+ * Checks both for instanceof URL and for objects with URL-like properties
176
+ * (searchParams object with sort method, hash string), allowing it to work
177
+ * with URL objects from different execution contexts.
178
+ *
179
+ * @param value - The value to check
180
+ * @returns True if the value is a URL or URL-like object
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * const value: unknown = new URL('https://example.com');
185
+ * if (isURL(value)) {
186
+ * console.log(value.hostname); // "example.com"
187
+ * }
188
+ * ```
189
+ */
175
190
  export function isURL(value: unknown): value is URL {
176
191
  return (
177
192
  value instanceof URL ||
@@ -263,6 +278,31 @@ function setParams(
263
278
  return out.toString();
264
279
  }
265
280
 
281
+ /**
282
+ * Mutable builder for constructing and manipulating URIs.
283
+ *
284
+ * BuildURI provides a fluent API for constructing URIs by chaining method calls.
285
+ * Unlike URI, BuildURI is mutable and allows modification of all URI components
286
+ * (protocol, hostname, port, pathname, search params, hash).
287
+ *
288
+ * @example
289
+ * ```typescript
290
+ * const uri = BuildURI.from('https://example.com')
291
+ * .pathname('/api/users')
292
+ * .setParam('page', '1')
293
+ * .setParam('limit', '10')
294
+ * .toString();
295
+ * // Result: "https://example.com/api/users?limit=10&page=1"
296
+ *
297
+ * // Building from scratch
298
+ * const uri2 = BuildURI.from()
299
+ * .protocol('https')
300
+ * .hostname('api.example.com')
301
+ * .port('8080')
302
+ * .pathname('/v1/data')
303
+ * .URI(); // Convert to immutable URI
304
+ * ```
305
+ */
266
306
  export class BuildURI implements URIInterface<BuildURI> {
267
307
  _url: WritableURL; // pathname needs this
268
308
  private constructor(url: WritableURL) {
@@ -493,7 +533,39 @@ export const hasHostPartProtocols: Set<string> = new Set<string>(["http", "https
493
533
  const uriInstances = new KeyedResolvOnce<URI>({
494
534
  lru: { maxEntries: 1000 },
495
535
  });
496
- // non mutable URL Implementation
536
+
537
+ /**
538
+ * Immutable URI representation with type-safe parameter handling.
539
+ *
540
+ * URI provides a read-only view of a URL with convenient methods for accessing
541
+ * components and query parameters. All URI instances are cached for performance.
542
+ * Use BuildURI for mutable construction and URI for immutable references.
543
+ *
544
+ * @example
545
+ * ```typescript
546
+ * const uri = URI.from('https://example.com/path?key=value&foo=bar');
547
+ *
548
+ * // Access components
549
+ * console.log(uri.protocol); // "https:"
550
+ * console.log(uri.hostname); // "example.com"
551
+ * console.log(uri.pathname); // "/path"
552
+ *
553
+ * // Query parameters
554
+ * const key = uri.getParam('key'); // "value"
555
+ * const missing = uri.getParam('missing', 'default'); // "default"
556
+ *
557
+ * // Type-safe parameter extraction with Result
558
+ * const result = uri.getParamsResult('key', 'foo');
559
+ * if (result.isOk()) {
560
+ * const { key, foo } = result.unwrap();
561
+ * }
562
+ *
563
+ * // Build a modified version
564
+ * const modified = uri.build()
565
+ * .setParam('new', 'param')
566
+ * .URI();
567
+ * ```
568
+ */
497
569
  export class URI implements URIInterface<URI> {
498
570
  static protocolHasHostpart(protocol: string): () => void {
499
571
  protocol = protocol.replace(/:$/, "");
@@ -18,6 +18,37 @@ export type ToUInt8Async = ToUInt8Plain | Blob;
18
18
  export type ToUInt8 = ToUInt8Plain | Result<ToUInt8Plain>;
19
19
  export type AsyncToUInt8 = ToUInt8Async | Result<ToUInt8Async> | Promise<ToUInt8Async> | Promise<Result<ToUInt8Async>>;
20
20
 
21
+ /**
22
+ * Coerces various binary types into Uint8Array with Result-based error handling.
23
+ *
24
+ * Converts ArrayBuffer, ArrayBufferView, Node.js Buffer, or Result-wrapped values
25
+ * into Uint8Array. Returns Result.Err for unsupported types like Blob (use
26
+ * asyncCoerceIntoUint8 for Blobs). Handles Result-wrapped inputs by unwrapping
27
+ * and recursively coercing.
28
+ *
29
+ * @param raw - Binary data to coerce (ArrayBuffer, TypedArray, Buffer, or Result-wrapped)
30
+ * @returns Result.Ok with Uint8Array or Result.Err with error message
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * // ArrayBuffer
35
+ * const result1 = coerceIntoUint8(new ArrayBuffer(10));
36
+ * if (result1.isOk()) {
37
+ * const bytes = result1.unwrap(); // Uint8Array
38
+ * }
39
+ *
40
+ * // TypedArray
41
+ * const result2 = coerceIntoUint8(new Int32Array([1, 2, 3]));
42
+ *
43
+ * // Result-wrapped input
44
+ * const wrapped = Result.Ok(new ArrayBuffer(5));
45
+ * const result3 = coerceIntoUint8(wrapped); // Unwraps and converts
46
+ *
47
+ * // Blob not supported (use asyncCoerceIntoUint8)
48
+ * const result4 = coerceIntoUint8(new Blob(['data']));
49
+ * // Returns Result.Err("Blob not supported")
50
+ * ```
51
+ */
21
52
  export function coerceIntoUint8(raw: ToUInt8): Result<Uint8Array> {
22
53
  if (raw instanceof ArrayBuffer) {
23
54
  return Result.Ok(new Uint8Array(raw));
@@ -43,6 +74,35 @@ export function coerceIntoUint8(raw: ToUInt8): Result<Uint8Array> {
43
74
  return Result.Err("Not a Uint8Array");
44
75
  }
45
76
 
77
+ /**
78
+ * Asynchronously coerces various binary types including Blob into Uint8Array.
79
+ *
80
+ * Handles all types supported by coerceIntoUint8 plus async operations:
81
+ * - Promise-wrapped values
82
+ * - Blob (converts via arrayBuffer())
83
+ * - Result-wrapped Promises
84
+ *
85
+ * @param raw - Binary data or Promise thereof (including Blob)
86
+ * @returns Promise resolving to Result.Ok with Uint8Array or Result.Err
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * // Blob support
91
+ * const blob = new Blob(['Hello, World!']);
92
+ * const result1 = await asyncCoerceIntoUint8(blob);
93
+ * if (result1.isOk()) {
94
+ * const bytes = result1.unwrap();
95
+ * }
96
+ *
97
+ * // Promise-wrapped
98
+ * const promise = fetch('/data').then(r => r.arrayBuffer());
99
+ * const result2 = await asyncCoerceIntoUint8(promise);
100
+ *
101
+ * // Result-wrapped Promise
102
+ * const wrapped = Promise.resolve(Result.Ok(new ArrayBuffer(10)));
103
+ * const result3 = await asyncCoerceIntoUint8(wrapped);
104
+ * ```
105
+ */
46
106
  export async function asyncCoerceIntoUint8(raw: AsyncToUInt8): Promise<Result<Uint8Array>> {
47
107
  let resolved = await raw;
48
108
  if (resolved instanceof Blob) {
@@ -1,5 +1,11 @@
1
1
  import { TxtEnDecoderSingleton } from "../txt-en-decoder.js";
2
2
 
3
+ /**
4
+ * WritableStreamDefaultWriter that writes to console with automatic JSON parsing.
5
+ *
6
+ * Decodes Uint8Array chunks to strings, attempts JSON parsing to extract log levels,
7
+ * and routes output to appropriate console methods (log, warn, error).
8
+ */
3
9
  export class ConsoleWriterStreamDefaultWriter implements WritableStreamDefaultWriter<Uint8Array> {
4
10
  readonly desiredSize: number | null = null;
5
11
  // readonly decoder: TextDecoder = new TextDecoder();
@@ -57,6 +63,34 @@ export interface ConsoleWriterStreamParams {
57
63
  warn(...args: unknown[]): void;
58
64
  }
59
65
 
66
+ /**
67
+ * WritableStream that outputs to console with JSON log-level parsing.
68
+ *
69
+ * Decodes stream chunks and attempts to parse as JSON to extract log levels.
70
+ * Routes messages to console.log/warn/error based on parsed level field.
71
+ * Falls back to console.log for non-JSON content. Useful for structured logging.
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const consoleStream = new ConsoleWriterStream();
76
+ * const writer = consoleStream.getWriter();
77
+ *
78
+ * // JSON with level field
79
+ * await writer.write(
80
+ * new TextEncoder().encode('{"level":"error","msg":"Failed"}')
81
+ * ); // Outputs to console.error
82
+ *
83
+ * // Plain text
84
+ * await writer.write(
85
+ * new TextEncoder().encode('Hello')
86
+ * ); // Outputs to console.log
87
+ *
88
+ * // Custom console methods
89
+ * const custom = new ConsoleWriterStream({
90
+ * error: (msg) => saveToFile('error.log', msg)
91
+ * });
92
+ * ```
93
+ */
60
94
  export class ConsoleWriterStream implements WritableStream<Uint8Array> {
61
95
  locked = false;
62
96
  _writer?: WritableStreamDefaultWriter<Uint8Array>;