@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
@@ -2,14 +2,32 @@ import { TxtEnDecoderSingleton } from "./txt-en-decoder.js";
2
2
 
3
3
  export type CoerceBinaryInput = string | ArrayBufferLike | ArrayBufferView | Uint8Array; // | SharedArrayBuffer
4
4
 
5
+ /**
6
+ * Type guard to check if a value is an ArrayBuffer.
7
+ *
8
+ * @param value - The value to check
9
+ * @returns True if the value is an ArrayBuffer
10
+ */
5
11
  export function isArrayBuffer(value: unknown): value is ArrayBuffer {
6
12
  return value instanceof ArrayBuffer || Object.prototype.toString.call(value) === "[object ArrayBuffer]";
7
13
  }
8
14
 
15
+ /**
16
+ * Type guard to check if a value is a Uint8Array.
17
+ *
18
+ * @param value - The value to check
19
+ * @returns True if the value is a Uint8Array
20
+ */
9
21
  export function isUint8Array(value: unknown): value is Uint8Array {
10
22
  return value instanceof Uint8Array || Object.prototype.toString.call(value) === "[object Uint8Array]";
11
23
  }
12
24
 
25
+ /**
26
+ * Converts various binary input types (including Blob) to Uint8Array asynchronously.
27
+ *
28
+ * @param input - String, ArrayBuffer, ArrayBufferView, Uint8Array, or Blob to convert
29
+ * @returns Promise resolving to Uint8Array
30
+ */
13
31
  export async function top_uint8(input: CoerceBinaryInput | Blob): Promise<Uint8Array> {
14
32
  if (input instanceof Blob) {
15
33
  return new Uint8Array(await input.arrayBuffer());
@@ -17,6 +35,15 @@ export async function top_uint8(input: CoerceBinaryInput | Blob): Promise<Uint8A
17
35
  return to_uint8(input);
18
36
  }
19
37
 
38
+ /**
39
+ * Converts various binary input types to Uint8Array synchronously.
40
+ *
41
+ * Handles strings (encoding with TextEncoder), ArrayBuffers, and ArrayBufferViews.
42
+ *
43
+ * @param input - String, ArrayBuffer, ArrayBufferView, or Uint8Array to convert
44
+ * @param encoder - Optional TextEncoder instance (uses singleton if not provided)
45
+ * @returns Uint8Array representation of the input
46
+ */
20
47
  export function to_uint8(input: CoerceBinaryInput, encoder?: TextEncoder): Uint8Array {
21
48
  if (typeof input === "string") {
22
49
  return (encoder ?? TxtEnDecoderSingleton()).encode(input);
@@ -32,6 +59,13 @@ export function to_uint8(input: CoerceBinaryInput, encoder?: TextEncoder): Uint8
32
59
  return new Uint8Array(input as unknown as ArrayBufferLike);
33
60
  }
34
61
 
62
+ /**
63
+ * Converts various binary input types to Blob.
64
+ *
65
+ * @param input - String, ArrayBuffer, ArrayBufferView, Uint8Array, or Blob to convert
66
+ * @param encoder - Optional TextEncoder instance (uses singleton if not provided)
67
+ * @returns Blob representation of the input
68
+ */
35
69
  export function to_blob(input: CoerceBinaryInput | Blob, encoder?: TextEncoder): Blob {
36
70
  if (input instanceof Blob) {
37
71
  return input;
@@ -40,6 +74,13 @@ export function to_blob(input: CoerceBinaryInput | Blob, encoder?: TextEncoder):
40
74
  return new Blob([ab]);
41
75
  }
42
76
 
77
+ /**
78
+ * Converts various binary input types to ArrayBuffer.
79
+ *
80
+ * @param input - String, ArrayBuffer, ArrayBufferView, or Uint8Array to convert
81
+ * @param encoder - Optional TextEncoder instance (uses singleton if not provided)
82
+ * @returns ArrayBuffer representation of the input
83
+ */
43
84
  export function to_arraybuf(input: CoerceBinaryInput, encoder?: TextEncoder): ArrayBuffer {
44
85
  if (input instanceof ArrayBuffer) {
45
86
  return input;
package/src/crypto.ts CHANGED
@@ -123,6 +123,41 @@ function digestSHA256(crypto: typeof globalThis.crypto): (data: Uint8Array) => P
123
123
  };
124
124
  }
125
125
 
126
+ /**
127
+ * Creates a CryptoRuntime abstraction with optional custom implementations.
128
+ *
129
+ * Provides a unified crypto interface that works across different JavaScript
130
+ * runtimes (browsers, Node.js, Deno, CF Workers). Automatically uses the global
131
+ * Web Crypto API when available, with fallback implementations that throw errors
132
+ * for unavailable operations. Allows overriding any method for testing or
133
+ * custom implementations.
134
+ *
135
+ * @param cryptoOpts - Optional custom implementations for crypto operations
136
+ * @returns CryptoRuntime instance with crypto operations
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * // Use default global crypto
141
+ * const crypto = toCryptoRuntime();
142
+ * const hash = await crypto.digestSHA256(new Uint8Array([1, 2, 3]));
143
+ * const randomData = crypto.randomBytes(16);
144
+ *
145
+ * // Override for testing
146
+ * const mockCrypto = toCryptoRuntime({
147
+ * randomBytes: (size) => new Uint8Array(size).fill(42),
148
+ * digestSHA256: async (data) => new ArrayBuffer(32)
149
+ * });
150
+ *
151
+ * // Encrypt/decrypt with AES-GCM
152
+ * const key = await crypto.importKey(
153
+ * 'raw',
154
+ * new Uint8Array(32),
155
+ * { name: 'AES-GCM' },
156
+ * false,
157
+ * ['encrypt', 'decrypt']
158
+ * );
159
+ * ```
160
+ */
126
161
  export function toCryptoRuntime(cryptoOpts: Partial<CryptoRuntime> = {}): CryptoRuntime {
127
162
  let crypto: typeof globalThis.crypto;
128
163
  if (!globalThis.crypto || !globalThis.crypto.subtle) {
package/src/future.ts CHANGED
@@ -1,5 +1,30 @@
1
1
  import { Lazy } from "./resolve-once.js";
2
2
 
3
+ /**
4
+ * A Promise that can be resolved or rejected externally after creation.
5
+ *
6
+ * Future provides a way to create a Promise whose resolution is controlled
7
+ * externally rather than in the executor function. This is useful for
8
+ * coordinating async operations, implementing custom async primitives,
9
+ * or bridging callback-based APIs to promises.
10
+ *
11
+ * @template T - The type of the resolved value
12
+ * @template CTX - Optional context type for additional data
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const future = new Future<string>();
17
+ *
18
+ * // Later, resolve it from anywhere
19
+ * future.resolve('hello');
20
+ *
21
+ * // Or reject it
22
+ * future.reject(new Error('failed'));
23
+ *
24
+ * // Use it like a promise
25
+ * const result = await future.asPromise();
26
+ * ```
27
+ */
3
28
  export class Future<T, CTX = void> {
4
29
  // readonly id = Math.random();
5
30
  readonly #promise: Promise<T>;
@@ -19,16 +44,35 @@ export class Future<T, CTX = void> {
19
44
  });
20
45
  }
21
46
 
22
- // the id is not cryptographically secure, but good enough for transaction id
47
+ /**
48
+ * Lazily-generated unique identifier for this Future.
49
+ * Not cryptographically secure, but suitable for transaction/debug tracking.
50
+ */
23
51
  readonly id: () => string = Lazy(() => Math.random().toString(36).substring(2) + Date.now().toString(36));
24
52
 
53
+ /**
54
+ * Returns the underlying Promise that will be resolved or rejected.
55
+ *
56
+ * @returns The Promise representation of this Future
57
+ */
25
58
  asPromise(): Promise<T> {
26
59
  return this.#promise;
27
60
  }
28
61
 
62
+ /**
63
+ * Resolves the Future with the given value.
64
+ *
65
+ * @param value - The value to resolve the Promise with
66
+ */
29
67
  resolve(value: T): void {
30
68
  this.#resolveFn(value);
31
69
  }
70
+
71
+ /**
72
+ * Rejects the Future with the given reason.
73
+ *
74
+ * @param reason - The reason for rejection (typically an Error)
75
+ */
32
76
  reject(reason: unknown): void {
33
77
  this.#rejectFn(reason);
34
78
  }
@@ -84,9 +84,42 @@ function hasForEach(unk: unknown): unk is HeaderForeach {
84
84
  return typeof (unk as Headers).forEach == "function";
85
85
  }
86
86
 
87
+ /**
88
+ * HTTP header container with multi-value support and type-safe operations.
89
+ *
90
+ * HttpHeader provides a comprehensive API for managing HTTP headers with
91
+ * support for multiple values per header name. All header names are normalized
92
+ * to lowercase for case-insensitive comparison. Supports conversion to/from
93
+ * various formats including native Headers, plain objects, and arrays.
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * const headers = new HttpHeader();
98
+ * headers.Add('Content-Type', 'application/json');
99
+ * headers.Add('Accept', ['application/json', 'text/html']);
100
+ *
101
+ * const value = headers.Get('content-type'); // Case-insensitive
102
+ * const allAccept = headers.Values('accept'); // ['application/json', 'text/html']
103
+ *
104
+ * // Merge multiple header sources
105
+ * const merged = HttpHeader.from(
106
+ * { 'User-Agent': 'MyApp/1.0' },
107
+ * new Headers({ 'Authorization': 'Bearer token' })
108
+ * );
109
+ * ```
110
+ */
87
111
  export class HttpHeader {
88
112
  readonly _headers: Map<string, Set<string>> = new Map<string, Set<string>>();
89
113
 
114
+ /**
115
+ * Converts various header formats to HttpHeader instance.
116
+ *
117
+ * Accepts Headers, arrays, objects, or existing HttpHeader instances.
118
+ * Automatically handles comma-separated values and normalizes header names.
119
+ *
120
+ * @param headers - Headers in any supported format
121
+ * @returns HttpHeader instance
122
+ */
90
123
  static coerce(headers: CoercedHeadersInit): HttpHeader {
91
124
  if (headers instanceof HttpHeader) {
92
125
  return headers;
@@ -123,6 +156,22 @@ export class HttpHeader {
123
156
  }
124
157
  return h;
125
158
  }
159
+
160
+ /**
161
+ * Creates HttpHeader by merging multiple header sources.
162
+ *
163
+ * @param headersArgs - One or more header sources to merge
164
+ * @returns New HttpHeader with all headers merged
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * const headers = HttpHeader.from(
169
+ * { 'Content-Type': 'application/json' },
170
+ * new Headers({ 'Authorization': 'Bearer token' }),
171
+ * [['X-Custom', 'value']]
172
+ * );
173
+ * ```
174
+ */
126
175
  static from(...headersArgs: CoercedHeadersInit[]): HttpHeader {
127
176
  return headersArgs.map((headers) => HttpHeader.coerce(headers)).reduce((acc, cur) => acc.MergeInplace(cur), new HttpHeader());
128
177
  }
@@ -138,10 +187,24 @@ export class HttpHeader {
138
187
  _key(key: string): string {
139
188
  return key.toLowerCase();
140
189
  }
190
+
191
+ /**
192
+ * Gets all values for a header (case-insensitive).
193
+ *
194
+ * @param key - Header name
195
+ * @returns Array of all values for the header
196
+ */
141
197
  Values(key: string): string[] {
142
198
  const values = this._headers.get(this._key(key));
143
199
  return values ? Array.from(values) : [];
144
200
  }
201
+
202
+ /**
203
+ * Gets the first value for a header (case-insensitive).
204
+ *
205
+ * @param key - Header name
206
+ * @returns First value or undefined if not present
207
+ */
145
208
  Get(key: string): string | undefined {
146
209
  const values = this._headers.get(this._key(key));
147
210
  if (values === undefined || values.size === 0) {
@@ -149,6 +212,14 @@ export class HttpHeader {
149
212
  }
150
213
  return values.values().next().value as string;
151
214
  }
215
+
216
+ /**
217
+ * Sets a header, replacing any existing values.
218
+ *
219
+ * @param key - Header name
220
+ * @param valueOr - Single value or array of values
221
+ * @returns This HttpHeader instance for chaining
222
+ */
152
223
  Set(key: string, valueOr: string | string[]): HttpHeader {
153
224
  const value = new Set((Array.isArray(valueOr) ? valueOr : [valueOr]).map((v) => v.trim()).filter((v) => v !== ""));
154
225
  if (value.size > 0) {
@@ -158,6 +229,14 @@ export class HttpHeader {
158
229
  }
159
230
  return this;
160
231
  }
232
+
233
+ /**
234
+ * Adds value(s) to a header, preserving existing values.
235
+ *
236
+ * @param key - Header name
237
+ * @param value - Single value, array of values, or undefined
238
+ * @returns This HttpHeader instance for chaining
239
+ */
161
240
  Add(key: string, value: string | string[] | undefined): HttpHeader {
162
241
  if (typeof value === "undefined") {
163
242
  return this;
@@ -176,18 +255,88 @@ export class HttpHeader {
176
255
  }, values);
177
256
  return this;
178
257
  }
258
+
259
+ /**
260
+ * Deletes a header.
261
+ *
262
+ * @param ey - Header name to delete
263
+ * @returns This HttpHeader instance for chaining
264
+ */
179
265
  Del(ey: string): HttpHeader {
180
266
  this._headers.delete(this._key(ey));
181
267
  return this;
182
268
  }
269
+
270
+ /**
271
+ * Returns all headers as key-value array pairs.
272
+ *
273
+ * Each entry is a tuple of [headerName, values[]] where headerName is
274
+ * lowercase and values is an array of all values for that header.
275
+ * Headers with no values are excluded.
276
+ *
277
+ * @returns Array of [name, values] tuples
278
+ *
279
+ * @example
280
+ * ```typescript
281
+ * const headers = new HttpHeader();
282
+ * headers.Add('Accept', ['application/json', 'text/html']);
283
+ * headers.Add('Content-Type', 'application/json');
284
+ *
285
+ * const items = headers.Items();
286
+ * // [
287
+ * // ['accept', ['application/json', 'text/html']],
288
+ * // ['content-type', ['application/json']]
289
+ * // ]
290
+ * ```
291
+ */
183
292
  Items(): [string, string[]][] {
184
293
  return Array.from(this._headers)
185
294
  .filter(([_, vs]) => vs.size > 0)
186
295
  .map(([k, vs]) => [k, Array.from(vs)]);
187
296
  }
297
+
298
+ /**
299
+ * Returns all headers as sorted key-value array pairs.
300
+ *
301
+ * Same as Items() but sorted alphabetically by header name.
302
+ *
303
+ * @returns Array of [name, values] tuples sorted by name
304
+ *
305
+ * @example
306
+ * ```typescript
307
+ * const headers = new HttpHeader();
308
+ * headers.Add('Content-Type', 'application/json');
309
+ * headers.Add('Accept', 'text/html');
310
+ *
311
+ * const sorted = headers.SortItems();
312
+ * // [
313
+ * // ['accept', ['text/html']],
314
+ * // ['content-type', ['application/json']]
315
+ * // ]
316
+ * ```
317
+ */
188
318
  SortItems(): [string, string[]][] {
189
319
  return this.Items().sort(([[a]], [[b]]) => a.localeCompare(b));
190
320
  }
321
+
322
+ /**
323
+ * Creates a deep copy of the HttpHeader instance.
324
+ *
325
+ * @returns New HttpHeader with the same headers
326
+ *
327
+ * @example
328
+ * ```typescript
329
+ * const original = new HttpHeader();
330
+ * original.Add('Content-Type', 'application/json');
331
+ *
332
+ * const copy = original.Clone();
333
+ * copy.Add('Accept', 'text/html');
334
+ *
335
+ * // original is unchanged
336
+ * original.Get('Accept'); // undefined
337
+ * copy.Get('Accept'); // 'text/html'
338
+ * ```
339
+ */
191
340
  Clone(): HttpHeader {
192
341
  const clone = new HttpHeader();
193
342
  for (const [key, values] of this._headers.entries()) {
@@ -195,6 +344,27 @@ export class HttpHeader {
195
344
  }
196
345
  return clone;
197
346
  }
347
+ /**
348
+ * Converts headers to a plain object with string array values.
349
+ *
350
+ * Each header name maps to an array of all its values. Useful for
351
+ * serialization or when working with APIs that expect this format.
352
+ *
353
+ * @returns Object with header names as keys and string arrays as values
354
+ *
355
+ * @example
356
+ * ```typescript
357
+ * const headers = new HttpHeader();
358
+ * headers.Add('Accept', ['application/json', 'text/html']);
359
+ * headers.Add('Content-Type', 'application/json');
360
+ *
361
+ * const obj = headers.AsRecordStringStringArray();
362
+ * // {
363
+ * // 'accept': ['application/json', 'text/html'],
364
+ * // 'content-type': ['application/json']
365
+ * // }
366
+ * ```
367
+ */
198
368
  AsRecordStringStringArray(): Record<string, string[]> {
199
369
  const obj: Record<string, string[]> = {};
200
370
  for (const [key, values] of this._headers.entries()) {
@@ -202,6 +372,28 @@ export class HttpHeader {
202
372
  }
203
373
  return obj;
204
374
  }
375
+
376
+ /**
377
+ * Converts headers to a plain object with comma-separated string values.
378
+ *
379
+ * Multiple values for the same header are joined with ", ". Useful for
380
+ * compatibility with APIs that expect single string values per header.
381
+ *
382
+ * @returns Object with header names as keys and comma-separated strings as values
383
+ *
384
+ * @example
385
+ * ```typescript
386
+ * const headers = new HttpHeader();
387
+ * headers.Add('Accept', ['application/json', 'text/html']);
388
+ * headers.Add('Content-Type', 'application/json');
389
+ *
390
+ * const obj = headers.AsRecordStringString();
391
+ * // {
392
+ * // 'accept': 'application/json, text/html',
393
+ * // 'content-type': 'application/json'
394
+ * // }
395
+ * ```
396
+ */
205
397
  AsRecordStringString(): Record<string, string> {
206
398
  const obj: Record<string, string> = {};
207
399
  for (const [key, values] of this._headers.entries()) {
@@ -209,7 +401,29 @@ export class HttpHeader {
209
401
  }
210
402
  return obj;
211
403
  }
212
- // Need for CF own HeadersInit type
404
+
405
+ /**
406
+ * Converts headers to HeadersInit format with only first value per header.
407
+ *
408
+ * Only the first value is used when multiple values exist for a header.
409
+ * Needed for Cloudflare Workers' HeadersInit type compatibility.
410
+ *
411
+ * @template H - HeadersInit type (for type compatibility)
412
+ * @returns Object compatible with HeadersInit
413
+ *
414
+ * @example
415
+ * ```typescript
416
+ * const headers = new HttpHeader();
417
+ * headers.Add('Accept', ['application/json', 'text/html']);
418
+ * headers.Add('Content-Type', 'application/json');
419
+ *
420
+ * const init = headers.AsHeaderInit();
421
+ * // {
422
+ * // 'accept': 'application/json', // only first value
423
+ * // 'content-type': 'application/json'
424
+ * // }
425
+ * ```
426
+ */
213
427
  AsHeaderInit<H extends HeadersInit>(): H {
214
428
  const obj: Record<string, string> = {};
215
429
  for (const [key, values] of this._headers.entries()) {
@@ -220,9 +434,49 @@ export class HttpHeader {
220
434
  }
221
435
  return obj as H;
222
436
  }
437
+
438
+ /**
439
+ * Converts to native Headers implementation.
440
+ *
441
+ * Multiple values are joined with ", " as per HTTP spec.
442
+ *
443
+ * @returns HeadersImpl instance compatible with standard Headers interface
444
+ *
445
+ * @example
446
+ * ```typescript
447
+ * const headers = new HttpHeader();
448
+ * headers.Add('Content-Type', 'application/json');
449
+ *
450
+ * const nativeHeaders = headers.AsHeaders();
451
+ * nativeHeaders.get('content-type'); // 'application/json'
452
+ * ```
453
+ */
223
454
  AsHeaders(): HeadersImpl {
224
455
  return new HeadersImpl(this._asStringString());
225
456
  }
457
+
458
+ /**
459
+ * Merges other headers into this instance (in-place mutation).
460
+ *
461
+ * Adds all headers from the provided sources to this instance.
462
+ * If headers already exist, values are added (not replaced).
463
+ *
464
+ * @param other - One or more header sources to merge
465
+ * @returns This HttpHeader instance for chaining
466
+ *
467
+ * @example
468
+ * ```typescript
469
+ * const headers = new HttpHeader();
470
+ * headers.Add('Content-Type', 'application/json');
471
+ *
472
+ * headers.MergeInplace(
473
+ * { 'Accept': 'text/html' },
474
+ * new Headers({ 'Authorization': 'Bearer token' })
475
+ * );
476
+ *
477
+ * // headers now contains all three headers
478
+ * ```
479
+ */
226
480
  MergeInplace(...other: CoercedHeadersInit[]): HttpHeader {
227
481
  for (const h of other.map((h) => HttpHeader.coerce(h))) {
228
482
  for (const [key, values] of h.Items()) {
@@ -231,6 +485,28 @@ export class HttpHeader {
231
485
  }
232
486
  return this;
233
487
  }
488
+
489
+ /**
490
+ * Merges other headers, returning a new instance.
491
+ *
492
+ * Creates a clone of this instance and merges the provided headers into it.
493
+ * The original instance remains unchanged.
494
+ *
495
+ * @param other - One or more header sources to merge
496
+ * @returns New HttpHeader with merged headers
497
+ *
498
+ * @example
499
+ * ```typescript
500
+ * const headers1 = new HttpHeader();
501
+ * headers1.Add('Content-Type', 'application/json');
502
+ *
503
+ * const headers2 = headers1.Merge({ 'Accept': 'text/html' });
504
+ *
505
+ * // headers1 is unchanged
506
+ * headers1.Get('Accept'); // undefined
507
+ * headers2.Get('Accept'); // 'text/html'
508
+ * ```
509
+ */
234
510
  Merge(...other: CoercedHeadersInit[]): HttpHeader {
235
511
  return this.Clone().MergeInplace(...other);
236
512
  }
package/src/index.ts CHANGED
@@ -31,9 +31,7 @@ export * from "./mutable-url.js";
31
31
  export * from "./poller.js";
32
32
  export * from "./on-func.js";
33
33
  export * from "./timeouted.js";
34
+ export * from "./promise-sleep.js";
34
35
 
35
- // ugly
36
+ // ugly not really esm but how could that work otherwise?
36
37
  export * as utils from "./utils/index.js";
37
- // import * as utils from "./utils/index.js";
38
-
39
- // export const param = utils.param;
package/src/is-json.ts CHANGED
@@ -7,6 +7,27 @@ export interface IsJSONResult<T> {
7
7
  readonly parsed?: T;
8
8
  }
9
9
 
10
+ /**
11
+ * Checks if a string contains valid JSON and optionally parses it.
12
+ *
13
+ * Uses a regex pre-check to quickly eliminate non-JSON strings before attempting
14
+ * to parse. Returns both a boolean flag and the parsed result if successful.
15
+ *
16
+ * @template T - The expected type of the parsed JSON (default: unknown)
17
+ * @param str - The string to check and parse
18
+ * @returns Object with isJSON boolean and optional parsed value
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * const result = isJSON<{ name: string }>('{"name": "Alice"}');
23
+ * if (result.isJSON) {
24
+ * console.log(result.parsed.name); // "Alice"
25
+ * }
26
+ *
27
+ * const invalid = isJSON('not json');
28
+ * console.log(invalid.isJSON); // false
29
+ * ```
30
+ */
10
31
  export function isJSON<T = unknown>(str: string): IsJSONResult<T> {
11
32
  if (possibleJSONre.test(str)) {
12
33
  try {
package/src/is-promise.ts CHANGED
@@ -7,6 +7,25 @@ export type Promisable<T> = T | Promise<T>;
7
7
 
8
8
  export type NonPromise<T> = T extends Promise<never> ? never : T;
9
9
 
10
+ /**
11
+ * Type guard to check if a value is a Promise or Promise-like (thenable).
12
+ *
13
+ * Checks both for instanceof Promise and for objects with then/catch/finally methods,
14
+ * allowing it to work with Promise-like objects from different execution contexts.
15
+ *
16
+ * @template R - The Promise type
17
+ * @template T - The resolved value type
18
+ * @param a - The value to check
19
+ * @returns True if the value is a Promise or thenable
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const value: unknown = fetchData();
24
+ * if (isPromise(value)) {
25
+ * const result = await value;
26
+ * }
27
+ * ```
28
+ */
10
29
  export function isPromise<R extends Promise<T>, T>(a: unknown): a is R {
11
30
  const mayBe = a as { then: () => void; catch: () => void; finally: () => void };
12
31
  return (
@@ -21,6 +40,13 @@ export function isPromise<R extends Promise<T>, T>(a: unknown): a is R {
21
40
  );
22
41
  }
23
42
 
43
+ /**
44
+ * Type guard to check if a value is NOT a Promise.
45
+ *
46
+ * @template T - The value type
47
+ * @param a - The value to check
48
+ * @returns The value cast to type T if it's not a Promise
49
+ */
24
50
  export function isNotPromise<T>(a: T): T {
25
51
  return !isPromise(a) as T;
26
52
  }
@@ -11,6 +11,25 @@ interface MutableLRUParam<T, K> {
11
11
 
12
12
  export type LRUParam<T = string, K = string> = Readonly<MutableLRUParam<T, K>>;
13
13
 
14
+ /**
15
+ * A Set implementation with Least Recently Used (LRU) eviction policy.
16
+ *
17
+ * LRUSet maintains a set of values with automatic eviction of least recently
18
+ * accessed items when capacity limits are reached. Items are moved to the end
19
+ * of the access order when accessed.
20
+ *
21
+ * @template T - The type of values in the set
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const cache = new LRUSet<string>({ maxEntries: 3 });
26
+ * cache.add('a');
27
+ * cache.add('b');
28
+ * cache.add('c');
29
+ * cache.add('d'); // 'a' is evicted
30
+ * console.log(cache.has('a')); // false
31
+ * ```
32
+ */
14
33
  export class LRUSet<T> {
15
34
  readonly #lruMap: LRUMap<T, T>;
16
35
 
@@ -84,6 +103,33 @@ function defaultRefresh<V, K>(param: LRUParam<V, K>, map: LRUMap<K, V>): void {
84
103
  }
85
104
  }
86
105
 
106
+ /**
107
+ * A Map implementation with Least Recently Used (LRU) eviction policy.
108
+ *
109
+ * LRUMap maintains key-value pairs with automatic eviction of least recently
110
+ * accessed items when capacity limits are reached. Provides configurable
111
+ * eviction and refresh strategies, event callbacks, and access statistics.
112
+ *
113
+ * @template K - The type of keys in the map
114
+ * @template V - The type of values in the map
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * const cache = new LRUMap<string, number>({ maxEntries: 100 });
119
+ *
120
+ * // Add items
121
+ * cache.set('key1', 42);
122
+ * cache.set('key2', 100);
123
+ *
124
+ * // Get items (updates access order)
125
+ * const value = cache.get('key1');
126
+ *
127
+ * // Listen for evictions
128
+ * const unregister = cache.onDelete((key, value) => {
129
+ * console.log(`Evicted: ${key} = ${value}`);
130
+ * });
131
+ * ```
132
+ */
87
133
  export class LRUMap<K, V> {
88
134
  private _map: Map<K, LRUItem<V>> = new Map<K, LRUItem<V>>();
89
135
  private param: MutableLRUParam<V, K>;