@adviser/cement 0.3.3 → 0.3.5

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 (546) hide show
  1. package/{base-sys-abstraction-CR_Z-Ceg.d.ts → base-sys-abstraction-CKI4xiRR.d.ts} +4 -4
  2. package/{base-sys-abstraction-DWtPI7Kg.d.cts → base-sys-abstraction-DLnSeH4s.d.cts} +4 -4
  3. package/cf/index.cjs +298 -284
  4. package/cf/index.cjs.map +1 -1
  5. package/cf/index.d.cts +4 -18
  6. package/cf/index.d.ts +4 -18
  7. package/cf/index.js +39 -6
  8. package/cf/index.js.map +1 -1
  9. package/{chunk-P6LDM7PY.js → chunk-4QRZPFED.js} +112 -506
  10. package/chunk-4QRZPFED.js.map +1 -0
  11. package/{chunk-HFP74WLI.js → chunk-4U6TAOIU.js} +5 -4
  12. package/chunk-4U6TAOIU.js.map +1 -0
  13. package/{chunk-PRCFKZR7.js → chunk-6AG3MRNY.js} +22 -170
  14. package/chunk-6AG3MRNY.js.map +1 -0
  15. package/{chunk-A7OPSHUV.js → chunk-LRJXXDF5.js} +11 -4
  16. package/chunk-LRJXXDF5.js.map +1 -0
  17. package/chunk-OIIUVSUX.js +88 -0
  18. package/chunk-OIIUVSUX.js.map +1 -0
  19. package/chunk-QDDO6NOK.js +194 -0
  20. package/chunk-QDDO6NOK.js.map +1 -0
  21. package/deno/index.cjs +274 -166
  22. package/deno/index.cjs.map +1 -1
  23. package/deno/index.d.cts +4 -24
  24. package/deno/index.d.ts +4 -24
  25. package/deno/index.js +174 -8
  26. package/deno/index.js.map +1 -1
  27. package/get-params-result-Bhy5997x.d.cts +61 -0
  28. package/get-params-result-Bhy5997x.d.ts +61 -0
  29. package/{index-CfSl8Gmj.d.ts → index-1R-hTV11.d.ts} +5 -50
  30. package/{index-BfZxTAe_.d.cts → index-98HXQB3i.d.cts} +5 -50
  31. package/{index-Q3phXzYr.d.cts → index-BMCdndbY.d.cts} +28 -23
  32. package/{index-tIGZMHTc.d.ts → index-IrV5jK1W.d.ts} +28 -23
  33. package/index.cjs +327 -430
  34. package/index.cjs.map +1 -1
  35. package/index.d.cts +13 -11
  36. package/index.d.ts +13 -11
  37. package/index.js +18 -12
  38. package/index.js.map +1 -1
  39. package/node/index.cjs +247 -139
  40. package/node/index.cjs.map +1 -1
  41. package/node/index.d.cts +4 -17
  42. package/node/index.d.ts +4 -17
  43. package/node/index.js +183 -12
  44. package/node/index.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/base-sys-abstraction.ts +8 -6
  47. package/src/cf/cf-env-actions.ts +53 -0
  48. package/src/cf/cf-sys-abstraction.ts +1 -53
  49. package/src/cf-test-main.ts +5 -0
  50. package/src/deno/deno-env-actions.ts +57 -0
  51. package/src/deno/deno-file-service.ts +1 -1
  52. package/src/deno/deno-sys-abstraction.ts +1 -57
  53. package/src/http_header.ts +1 -1
  54. package/src/index.ts +3 -0
  55. package/src/jsr.json +1 -1
  56. package/src/log-writer-impl.ts +10 -5
  57. package/src/logger-impl.ts +9 -8
  58. package/src/logger.ts +4 -5
  59. package/src/node/mock-file-service.ts +4 -4
  60. package/src/node/node-env-actions.ts +45 -0
  61. package/src/node/node-sys-abstraction.ts +1 -45
  62. package/src/resolve-once.ts +6 -5
  63. package/src/runtime.ts +3 -3
  64. package/src/sys-env.ts +64 -4
  65. package/src/test/log-write-stream.ts +2 -1
  66. package/src/tracer.ts +4 -6
  67. package/src/uri.ts +4 -69
  68. package/src/utils/console-write-stream.ts +4 -3
  69. package/src/utils/fanout-write-stream.ts +1 -1
  70. package/src/utils/get-params-result.ts +71 -0
  71. package/src/utils/index.ts +1 -0
  72. package/src/utils/rebuffer.ts +27 -21
  73. package/src/utils/relative-path.ts +1 -1
  74. package/src/utils/stream2string.ts +2 -2
  75. package/src/utils/stripper.ts +2 -2
  76. package/src/version.ts +2 -2
  77. package/src/web/web-env-actions.ts +41 -0
  78. package/src/web/web-sys-abstraction.ts +2 -42
  79. package/{sys-abstraction-GNnBj2sz.d.cts → sys-abstraction-BRDT_TIU.d.cts} +8 -1
  80. package/{sys-abstraction-GNnBj2sz.d.ts → sys-abstraction-Bd0EzwO6.d.ts} +8 -1
  81. package/test/index.cjs +460 -578
  82. package/test/index.cjs.map +1 -1
  83. package/test/index.d.cts +3 -3
  84. package/test/index.d.ts +3 -3
  85. package/test/index.js +5 -4
  86. package/ts/smoke/smoke.d.ts +2 -0
  87. package/ts/smoke/smoke.d.ts.map +1 -0
  88. package/ts/smoke/smoke.js +33 -0
  89. package/ts/smoke/smoke.js.map +1 -0
  90. package/ts/{base-sys-abstraction.d.ts → src/base-sys-abstraction.d.ts} +2 -2
  91. package/ts/src/base-sys-abstraction.d.ts.map +1 -0
  92. package/ts/{base-sys-abstraction.js → src/base-sys-abstraction.js} +4 -2
  93. package/ts/src/base-sys-abstraction.js.map +1 -0
  94. package/ts/src/base-sys-abstraction.test.d.ts.map +1 -0
  95. package/ts/src/base-sys-abstraction.test.js.map +1 -0
  96. package/ts/src/bin2text.d.ts.map +1 -0
  97. package/ts/src/bin2text.js.map +1 -0
  98. package/ts/{bin2text.test.d.ts.map → src/bin2text.test.d.ts.map} +1 -1
  99. package/ts/src/bin2text.test.js.map +1 -0
  100. package/ts/src/cf/cf-env-actions.d.ts +16 -0
  101. package/ts/src/cf/cf-env-actions.d.ts.map +1 -0
  102. package/ts/{cf/cf-sys-abstraction.js → src/cf/cf-env-actions.js} +1 -30
  103. package/ts/src/cf/cf-env-actions.js.map +1 -0
  104. package/ts/src/cf/cf-sys-abstraction.d.ts +11 -0
  105. package/ts/src/cf/cf-sys-abstraction.d.ts.map +1 -0
  106. package/ts/src/cf/cf-sys-abstraction.js +30 -0
  107. package/ts/src/cf/cf-sys-abstraction.js.map +1 -0
  108. package/ts/src/cf/index.d.ts.map +1 -0
  109. package/ts/src/cf/index.js.map +1 -0
  110. package/ts/src/cf-test-main.d.ts +5 -0
  111. package/ts/src/cf-test-main.d.ts.map +1 -0
  112. package/ts/src/cf-test-main.js +6 -0
  113. package/ts/src/cf-test-main.js.map +1 -0
  114. package/ts/src/crypto.d.ts.map +1 -0
  115. package/ts/src/crypto.js.map +1 -0
  116. package/ts/{crypto.test.d.ts.map → src/crypto.test.d.ts.map} +1 -1
  117. package/ts/{crypto.test.js → src/crypto.test.js} +8 -1
  118. package/ts/src/crypto.test.js.map +1 -0
  119. package/ts/src/deno/deno-env-actions.d.ts +23 -0
  120. package/ts/src/deno/deno-env-actions.d.ts.map +1 -0
  121. package/ts/src/deno/deno-env-actions.js +46 -0
  122. package/ts/src/deno/deno-env-actions.js.map +1 -0
  123. package/ts/src/deno/deno-file-service.d.ts.map +1 -0
  124. package/ts/src/deno/deno-file-service.js.map +1 -0
  125. package/ts/{deno → src/deno}/deno-sys-abstraction.d.ts +1 -22
  126. package/ts/src/deno/deno-sys-abstraction.d.ts.map +1 -0
  127. package/ts/{deno → src/deno}/deno-sys-abstraction.js +0 -45
  128. package/ts/src/deno/deno-sys-abstraction.js.map +1 -0
  129. package/ts/src/deno/index.d.ts.map +1 -0
  130. package/ts/src/deno/index.js.map +1 -0
  131. package/ts/src/file-service.d.ts.map +1 -0
  132. package/ts/{file-service.js.map → src/file-service.js.map} +1 -1
  133. package/ts/src/future.d.ts.map +1 -0
  134. package/ts/src/future.js.map +1 -0
  135. package/ts/{future.test.d.ts.map → src/future.test.d.ts.map} +1 -1
  136. package/ts/src/future.test.js.map +1 -0
  137. package/ts/src/http_header.d.ts.map +1 -0
  138. package/ts/src/http_header.js.map +1 -0
  139. package/ts/src/http_header.test.d.ts.map +1 -0
  140. package/ts/src/http_header.test.js.map +1 -0
  141. package/ts/{index.d.ts → src/index.d.ts} +2 -0
  142. package/ts/src/index.d.ts.map +1 -0
  143. package/ts/{index.js → src/index.js} +2 -0
  144. package/ts/src/index.js.map +1 -0
  145. package/ts/src/log-level-impl.d.ts.map +1 -0
  146. package/ts/src/log-level-impl.js.map +1 -0
  147. package/ts/src/log-writer-impl.d.ts.map +1 -0
  148. package/ts/{log-writer-impl.js → src/log-writer-impl.js} +4 -2
  149. package/ts/src/log-writer-impl.js.map +1 -0
  150. package/ts/{logger-impl.d.ts → src/logger-impl.d.ts} +1 -1
  151. package/ts/src/logger-impl.d.ts.map +1 -0
  152. package/ts/{logger-impl.js → src/logger-impl.js} +2 -3
  153. package/ts/src/logger-impl.js.map +1 -0
  154. package/ts/{logger.d.ts → src/logger.d.ts} +1 -1
  155. package/ts/src/logger.d.ts.map +1 -0
  156. package/ts/src/logger.js.map +1 -0
  157. package/ts/{logger.test.d.ts.map → src/logger.test.d.ts.map} +1 -1
  158. package/ts/{logger.test.js → src/logger.test.js} +4 -4
  159. package/ts/src/logger.test.js.map +1 -0
  160. package/ts/src/node/index.d.ts.map +1 -0
  161. package/ts/src/node/index.js.map +1 -0
  162. package/ts/src/node/mock-file-service.d.ts.map +1 -0
  163. package/ts/{node → src/node}/mock-file-service.js +4 -4
  164. package/ts/src/node/mock-file-service.js.map +1 -0
  165. package/ts/src/node/mock-file-service.test.d.ts.map +1 -0
  166. package/ts/src/node/mock-file-service.test.js.map +1 -0
  167. package/ts/src/node/node-env-actions.d.ts +15 -0
  168. package/ts/src/node/node-env-actions.d.ts.map +1 -0
  169. package/ts/src/node/node-env-actions.js +44 -0
  170. package/ts/src/node/node-env-actions.js.map +1 -0
  171. package/ts/src/node/node-file-service.d.ts.map +1 -0
  172. package/ts/src/node/node-file-service.js.map +1 -0
  173. package/ts/{node → src/node}/node-sys-abstraction.d.ts +1 -14
  174. package/ts/src/node/node-sys-abstraction.d.ts.map +1 -0
  175. package/ts/{node → src/node}/node-sys-abstraction.js +0 -43
  176. package/ts/src/node/node-sys-abstraction.js.map +1 -0
  177. package/ts/src/node/node-sys-abstraction.test.d.ts.map +1 -0
  178. package/ts/src/node/node-sys-abstraction.test.js.map +1 -0
  179. package/ts/src/option.d.ts.map +1 -0
  180. package/ts/src/option.js.map +1 -0
  181. package/ts/{resolve-once.d.ts → src/resolve-once.d.ts} +1 -1
  182. package/ts/src/resolve-once.d.ts.map +1 -0
  183. package/ts/{resolve-once.js → src/resolve-once.js} +5 -4
  184. package/ts/src/resolve-once.js.map +1 -0
  185. package/ts/src/resolve-once.test.d.ts.map +1 -0
  186. package/ts/{resolve-once.test.js → src/resolve-once.test.js} +20 -24
  187. package/ts/src/resolve-once.test.js.map +1 -0
  188. package/ts/src/result.d.ts.map +1 -0
  189. package/ts/src/result.js.map +1 -0
  190. package/ts/{result.test.d.ts.map → src/result.test.d.ts.map} +1 -1
  191. package/ts/{result.test.js → src/result.test.js} +2 -4
  192. package/ts/src/result.test.js.map +1 -0
  193. package/ts/src/runtime.d.ts.map +1 -0
  194. package/ts/src/runtime.js.map +1 -0
  195. package/ts/src/sys-abstraction.d.ts.map +1 -0
  196. package/ts/src/sys-abstraction.js.map +1 -0
  197. package/ts/{sys-env.d.ts → src/sys-env.d.ts} +7 -0
  198. package/ts/src/sys-env.d.ts.map +1 -0
  199. package/ts/{sys-env.js → src/sys-env.js} +57 -4
  200. package/ts/src/sys-env.js.map +1 -0
  201. package/ts/{sys-env.test.d.ts.map → src/sys-env.test.d.ts.map} +1 -1
  202. package/ts/{sys-env.test.js → src/sys-env.test.js} +70 -2
  203. package/ts/src/sys-env.test.js.map +1 -0
  204. package/ts/src/test/index.d.ts.map +1 -0
  205. package/ts/src/test/index.js.map +1 -0
  206. package/ts/src/test/log-write-stream.d.ts.map +1 -0
  207. package/ts/src/test/log-write-stream.js.map +1 -0
  208. package/ts/src/test/mock-logger.d.ts.map +1 -0
  209. package/ts/src/test/mock-logger.js.map +1 -0
  210. package/ts/src/test/mock-logger.test.d.ts.map +1 -0
  211. package/ts/src/test/mock-logger.test.js.map +1 -0
  212. package/ts/src/test/test-exit-handler.d.ts.map +1 -0
  213. package/ts/{test → src/test}/test-exit-handler.js +8 -3
  214. package/ts/src/test/test-exit-handler.js.map +1 -0
  215. package/ts/src/time.d.ts.map +1 -0
  216. package/ts/src/time.js.map +1 -0
  217. package/ts/src/tracer.d.ts.map +1 -0
  218. package/ts/src/tracer.js.map +1 -0
  219. package/ts/{tracer.test.d.ts.map → src/tracer.test.d.ts.map} +1 -1
  220. package/ts/{tracer.test.js → src/tracer.test.js} +5 -5
  221. package/ts/src/tracer.test.js.map +1 -0
  222. package/ts/src/txt-en-decoder.d.ts.map +1 -0
  223. package/ts/src/txt-en-decoder.js.map +1 -0
  224. package/ts/{uri.d.ts → src/uri.d.ts} +2 -13
  225. package/ts/src/uri.d.ts.map +1 -0
  226. package/ts/{uri.js → src/uri.js} +2 -56
  227. package/ts/src/uri.js.map +1 -0
  228. package/ts/{uri.test.d.ts.map → src/uri.test.d.ts.map} +1 -1
  229. package/ts/{uri.test.js → src/uri.test.js} +7 -7
  230. package/ts/src/uri.test.js.map +1 -0
  231. package/ts/{utils → src/utils}/console-write-stream.d.ts +1 -1
  232. package/ts/src/utils/console-write-stream.d.ts.map +1 -0
  233. package/ts/{utils → src/utils}/console-write-stream.js +4 -3
  234. package/ts/src/utils/console-write-stream.js.map +1 -0
  235. package/ts/{utils → src/utils}/fanout-write-stream.d.ts +1 -1
  236. package/ts/src/utils/fanout-write-stream.d.ts.map +1 -0
  237. package/ts/src/utils/fanout-write-stream.js.map +1 -0
  238. package/ts/src/utils/get-params-result.d.ts +19 -0
  239. package/ts/src/utils/get-params-result.d.ts.map +1 -0
  240. package/ts/src/utils/get-params-result.js +58 -0
  241. package/ts/src/utils/get-params-result.js.map +1 -0
  242. package/ts/{utils → src/utils}/index.d.ts +1 -0
  243. package/ts/src/utils/index.d.ts.map +1 -0
  244. package/ts/{utils → src/utils}/index.js +1 -0
  245. package/ts/src/utils/index.js.map +1 -0
  246. package/ts/src/utils/rebuffer.d.ts.map +1 -0
  247. package/ts/{utils → src/utils}/rebuffer.js +7 -1
  248. package/ts/src/utils/rebuffer.js.map +1 -0
  249. package/ts/src/utils/rebuffer.test.d.ts.map +1 -0
  250. package/ts/src/utils/rebuffer.test.js.map +1 -0
  251. package/ts/src/utils/relative-path.d.ts.map +1 -0
  252. package/ts/src/utils/relative-path.js.map +1 -0
  253. package/ts/src/utils/relative-path.test.d.ts.map +1 -0
  254. package/ts/src/utils/relative-path.test.js.map +1 -0
  255. package/ts/src/utils/stream-map.d.ts.map +1 -0
  256. package/ts/src/utils/stream-map.js.map +1 -0
  257. package/ts/src/utils/stream-map.test.d.ts.map +1 -0
  258. package/ts/src/utils/stream-map.test.js.map +1 -0
  259. package/ts/src/utils/stream-test-helper.d.ts.map +1 -0
  260. package/ts/{utils → src/utils}/stream-test-helper.js +18 -10
  261. package/ts/src/utils/stream-test-helper.js.map +1 -0
  262. package/ts/src/utils/stream2string.d.ts.map +1 -0
  263. package/ts/src/utils/stream2string.js.map +1 -0
  264. package/ts/src/utils/stream2string.test.d.ts.map +1 -0
  265. package/ts/src/utils/stream2string.test.js.map +1 -0
  266. package/ts/src/utils/string2stream.d.ts.map +1 -0
  267. package/ts/src/utils/string2stream.js.map +1 -0
  268. package/ts/src/utils/string2stream.test.d.ts.map +1 -0
  269. package/ts/src/utils/string2stream.test.js.map +1 -0
  270. package/ts/src/utils/stripper.d.ts +3 -0
  271. package/ts/src/utils/stripper.d.ts.map +1 -0
  272. package/ts/src/utils/stripper.js.map +1 -0
  273. package/ts/src/utils/stripper.test.d.ts.map +1 -0
  274. package/ts/src/utils/stripper.test.js.map +1 -0
  275. package/ts/src/version.d.ts.map +1 -0
  276. package/ts/src/version.js.map +1 -0
  277. package/ts/src/web/index.d.ts.map +1 -0
  278. package/ts/src/web/index.js.map +1 -0
  279. package/ts/src/web/web-env-actions.d.ts +14 -0
  280. package/ts/src/web/web-env-actions.d.ts.map +1 -0
  281. package/ts/src/web/web-env-actions.js +35 -0
  282. package/ts/src/web/web-env-actions.js.map +1 -0
  283. package/ts/{web → src/web}/web-sys-abstraction.d.ts +1 -14
  284. package/ts/src/web/web-sys-abstraction.d.ts.map +1 -0
  285. package/ts/{web → src/web}/web-sys-abstraction.js +0 -34
  286. package/ts/src/web/web-sys-abstraction.js.map +1 -0
  287. package/ts/vitest.browser.config.d.ts +3 -0
  288. package/ts/vitest.browser.config.d.ts.map +1 -0
  289. package/ts/vitest.browser.config.js +17 -0
  290. package/ts/vitest.browser.config.js.map +1 -0
  291. package/ts/vitest.cf-runtime.config.d.ts +3 -0
  292. package/ts/vitest.cf-runtime.config.d.ts.map +1 -0
  293. package/ts/vitest.cf-runtime.config.js +16 -0
  294. package/ts/vitest.cf-runtime.config.js.map +1 -0
  295. package/ts/vitest.config.d.ts +3 -0
  296. package/ts/vitest.config.d.ts.map +1 -0
  297. package/ts/vitest.config.js +8 -0
  298. package/ts/vitest.config.js.map +1 -0
  299. package/ts/vitest.node.config.d.ts +3 -0
  300. package/ts/vitest.node.config.d.ts.map +1 -0
  301. package/ts/vitest.node.config.js +11 -0
  302. package/ts/vitest.node.config.js.map +1 -0
  303. package/ts/vitest.workspace.d.ts +3 -0
  304. package/ts/vitest.workspace.d.ts.map +1 -0
  305. package/ts/vitest.workspace.js +6 -0
  306. package/ts/vitest.workspace.js.map +1 -0
  307. package/utils/index.cjs +150 -3
  308. package/utils/index.cjs.map +1 -1
  309. package/utils/index.d.cts +2 -2
  310. package/utils/index.d.ts +2 -2
  311. package/utils/index.js +8 -3
  312. package/web/index.cjs +251 -239
  313. package/web/index.cjs.map +1 -1
  314. package/web/index.d.cts +5 -17
  315. package/web/index.d.ts +5 -17
  316. package/web/index.js +3 -4
  317. package/chunk-A7OPSHUV.js.map +0 -1
  318. package/chunk-HFP74WLI.js.map +0 -1
  319. package/chunk-P6LDM7PY.js.map +0 -1
  320. package/chunk-PPS4L4VW.js +0 -38
  321. package/chunk-PPS4L4VW.js.map +0 -1
  322. package/chunk-PRCFKZR7.js.map +0 -1
  323. package/ts/base-sys-abstraction.d.ts.map +0 -1
  324. package/ts/base-sys-abstraction.js.map +0 -1
  325. package/ts/base-sys-abstraction.test.d.ts.map +0 -1
  326. package/ts/base-sys-abstraction.test.js.map +0 -1
  327. package/ts/bin2text.d.ts.map +0 -1
  328. package/ts/bin2text.js.map +0 -1
  329. package/ts/bin2text.test.js.map +0 -1
  330. package/ts/cf/cf-sys-abstraction.d.ts +0 -25
  331. package/ts/cf/cf-sys-abstraction.d.ts.map +0 -1
  332. package/ts/cf/cf-sys-abstraction.js.map +0 -1
  333. package/ts/cf/index.d.ts.map +0 -1
  334. package/ts/cf/index.js.map +0 -1
  335. package/ts/crypto.d.ts.map +0 -1
  336. package/ts/crypto.js.map +0 -1
  337. package/ts/crypto.test.js.map +0 -1
  338. package/ts/deno/deno-file-service.d.ts.map +0 -1
  339. package/ts/deno/deno-file-service.js.map +0 -1
  340. package/ts/deno/deno-sys-abstraction.d.ts.map +0 -1
  341. package/ts/deno/deno-sys-abstraction.js.map +0 -1
  342. package/ts/deno/index.d.ts.map +0 -1
  343. package/ts/deno/index.js.map +0 -1
  344. package/ts/file-service.d.ts.map +0 -1
  345. package/ts/future.d.ts.map +0 -1
  346. package/ts/future.js.map +0 -1
  347. package/ts/future.test.js.map +0 -1
  348. package/ts/http_header.d.ts.map +0 -1
  349. package/ts/http_header.js.map +0 -1
  350. package/ts/http_header.test.d.ts.map +0 -1
  351. package/ts/http_header.test.js.map +0 -1
  352. package/ts/index.d.ts.map +0 -1
  353. package/ts/index.js.map +0 -1
  354. package/ts/log-level-impl.d.ts.map +0 -1
  355. package/ts/log-level-impl.js.map +0 -1
  356. package/ts/log-writer-impl.d.ts.map +0 -1
  357. package/ts/log-writer-impl.js.map +0 -1
  358. package/ts/logger-impl.d.ts.map +0 -1
  359. package/ts/logger-impl.js.map +0 -1
  360. package/ts/logger.d.ts.map +0 -1
  361. package/ts/logger.js.map +0 -1
  362. package/ts/logger.test.js.map +0 -1
  363. package/ts/node/index.d.ts.map +0 -1
  364. package/ts/node/index.js.map +0 -1
  365. package/ts/node/mock-file-service.d.ts.map +0 -1
  366. package/ts/node/mock-file-service.js.map +0 -1
  367. package/ts/node/mock-file-service.test.d.ts.map +0 -1
  368. package/ts/node/mock-file-service.test.js.map +0 -1
  369. package/ts/node/node-file-service.d.ts.map +0 -1
  370. package/ts/node/node-file-service.js.map +0 -1
  371. package/ts/node/node-sys-abstraction.d.ts.map +0 -1
  372. package/ts/node/node-sys-abstraction.js.map +0 -1
  373. package/ts/node/node-sys-abstraction.test.d.ts.map +0 -1
  374. package/ts/node/node-sys-abstraction.test.js.map +0 -1
  375. package/ts/option.d.ts.map +0 -1
  376. package/ts/option.js.map +0 -1
  377. package/ts/resolve-once.d.ts.map +0 -1
  378. package/ts/resolve-once.js.map +0 -1
  379. package/ts/resolve-once.test.d.ts.map +0 -1
  380. package/ts/resolve-once.test.js.map +0 -1
  381. package/ts/result.d.ts.map +0 -1
  382. package/ts/result.js.map +0 -1
  383. package/ts/result.test.js.map +0 -1
  384. package/ts/runtime.d.ts.map +0 -1
  385. package/ts/runtime.js.map +0 -1
  386. package/ts/sys-abstraction.d.ts.map +0 -1
  387. package/ts/sys-abstraction.js.map +0 -1
  388. package/ts/sys-env.d.ts.map +0 -1
  389. package/ts/sys-env.js.map +0 -1
  390. package/ts/sys-env.test.js.map +0 -1
  391. package/ts/test/index.d.ts.map +0 -1
  392. package/ts/test/index.js.map +0 -1
  393. package/ts/test/log-write-stream.d.ts.map +0 -1
  394. package/ts/test/log-write-stream.js.map +0 -1
  395. package/ts/test/mock-logger.d.ts.map +0 -1
  396. package/ts/test/mock-logger.js.map +0 -1
  397. package/ts/test/mock-logger.test.d.ts.map +0 -1
  398. package/ts/test/mock-logger.test.js.map +0 -1
  399. package/ts/test/test-exit-handler.d.ts.map +0 -1
  400. package/ts/test/test-exit-handler.js.map +0 -1
  401. package/ts/time.d.ts.map +0 -1
  402. package/ts/time.js.map +0 -1
  403. package/ts/tracer.d.ts.map +0 -1
  404. package/ts/tracer.js.map +0 -1
  405. package/ts/tracer.test.js.map +0 -1
  406. package/ts/txt-en-decoder.d.ts.map +0 -1
  407. package/ts/txt-en-decoder.js.map +0 -1
  408. package/ts/uri.d.ts.map +0 -1
  409. package/ts/uri.js.map +0 -1
  410. package/ts/uri.test.js.map +0 -1
  411. package/ts/utils/console-write-stream.d.ts.map +0 -1
  412. package/ts/utils/console-write-stream.js.map +0 -1
  413. package/ts/utils/fanout-write-stream.d.ts.map +0 -1
  414. package/ts/utils/fanout-write-stream.js.map +0 -1
  415. package/ts/utils/index.d.ts.map +0 -1
  416. package/ts/utils/index.js.map +0 -1
  417. package/ts/utils/rebuffer.d.ts.map +0 -1
  418. package/ts/utils/rebuffer.js.map +0 -1
  419. package/ts/utils/rebuffer.test.d.ts.map +0 -1
  420. package/ts/utils/rebuffer.test.js.map +0 -1
  421. package/ts/utils/relative-path.d.ts.map +0 -1
  422. package/ts/utils/relative-path.js.map +0 -1
  423. package/ts/utils/relative-path.test.d.ts.map +0 -1
  424. package/ts/utils/relative-path.test.js.map +0 -1
  425. package/ts/utils/stream-map.d.ts.map +0 -1
  426. package/ts/utils/stream-map.js.map +0 -1
  427. package/ts/utils/stream-map.test.d.ts.map +0 -1
  428. package/ts/utils/stream-map.test.js.map +0 -1
  429. package/ts/utils/stream-test-helper.d.ts.map +0 -1
  430. package/ts/utils/stream-test-helper.js.map +0 -1
  431. package/ts/utils/stream2string.d.ts.map +0 -1
  432. package/ts/utils/stream2string.js.map +0 -1
  433. package/ts/utils/stream2string.test.d.ts.map +0 -1
  434. package/ts/utils/stream2string.test.js.map +0 -1
  435. package/ts/utils/string2stream.d.ts.map +0 -1
  436. package/ts/utils/string2stream.js.map +0 -1
  437. package/ts/utils/string2stream.test.d.ts.map +0 -1
  438. package/ts/utils/string2stream.test.js.map +0 -1
  439. package/ts/utils/stripper.d.ts +0 -3
  440. package/ts/utils/stripper.d.ts.map +0 -1
  441. package/ts/utils/stripper.js.map +0 -1
  442. package/ts/utils/stripper.test.d.ts.map +0 -1
  443. package/ts/utils/stripper.test.js.map +0 -1
  444. package/ts/version.d.ts.map +0 -1
  445. package/ts/version.js.map +0 -1
  446. package/ts/web/index.d.ts.map +0 -1
  447. package/ts/web/index.js.map +0 -1
  448. package/ts/web/web-sys-abstraction.d.ts.map +0 -1
  449. package/ts/web/web-sys-abstraction.js.map +0 -1
  450. package/txt-en-decoder-CZYJUju2.d.cts +0 -11
  451. package/txt-en-decoder-CZYJUju2.d.ts +0 -11
  452. /package/ts/{base-sys-abstraction.test.d.ts → src/base-sys-abstraction.test.d.ts} +0 -0
  453. /package/ts/{base-sys-abstraction.test.js → src/base-sys-abstraction.test.js} +0 -0
  454. /package/ts/{bin2text.d.ts → src/bin2text.d.ts} +0 -0
  455. /package/ts/{bin2text.js → src/bin2text.js} +0 -0
  456. /package/ts/{bin2text.test.d.ts → src/bin2text.test.d.ts} +0 -0
  457. /package/ts/{bin2text.test.js → src/bin2text.test.js} +0 -0
  458. /package/ts/{cf → src/cf}/index.d.ts +0 -0
  459. /package/ts/{cf → src/cf}/index.js +0 -0
  460. /package/ts/{crypto.d.ts → src/crypto.d.ts} +0 -0
  461. /package/ts/{crypto.js → src/crypto.js} +0 -0
  462. /package/ts/{crypto.test.d.ts → src/crypto.test.d.ts} +0 -0
  463. /package/ts/{deno → src/deno}/deno-file-service.d.ts +0 -0
  464. /package/ts/{deno → src/deno}/deno-file-service.js +0 -0
  465. /package/ts/{deno → src/deno}/index.d.ts +0 -0
  466. /package/ts/{deno → src/deno}/index.js +0 -0
  467. /package/ts/{file-service.d.ts → src/file-service.d.ts} +0 -0
  468. /package/ts/{file-service.js → src/file-service.js} +0 -0
  469. /package/ts/{future.d.ts → src/future.d.ts} +0 -0
  470. /package/ts/{future.js → src/future.js} +0 -0
  471. /package/ts/{future.test.d.ts → src/future.test.d.ts} +0 -0
  472. /package/ts/{future.test.js → src/future.test.js} +0 -0
  473. /package/ts/{http_header.d.ts → src/http_header.d.ts} +0 -0
  474. /package/ts/{http_header.js → src/http_header.js} +0 -0
  475. /package/ts/{http_header.test.d.ts → src/http_header.test.d.ts} +0 -0
  476. /package/ts/{http_header.test.js → src/http_header.test.js} +0 -0
  477. /package/ts/{log-level-impl.d.ts → src/log-level-impl.d.ts} +0 -0
  478. /package/ts/{log-level-impl.js → src/log-level-impl.js} +0 -0
  479. /package/ts/{log-writer-impl.d.ts → src/log-writer-impl.d.ts} +0 -0
  480. /package/ts/{logger.js → src/logger.js} +0 -0
  481. /package/ts/{logger.test.d.ts → src/logger.test.d.ts} +0 -0
  482. /package/ts/{node → src/node}/index.d.ts +0 -0
  483. /package/ts/{node → src/node}/index.js +0 -0
  484. /package/ts/{node → src/node}/mock-file-service.d.ts +0 -0
  485. /package/ts/{node → src/node}/mock-file-service.test.d.ts +0 -0
  486. /package/ts/{node → src/node}/mock-file-service.test.js +0 -0
  487. /package/ts/{node → src/node}/node-file-service.d.ts +0 -0
  488. /package/ts/{node → src/node}/node-file-service.js +0 -0
  489. /package/ts/{node → src/node}/node-sys-abstraction.test.d.ts +0 -0
  490. /package/ts/{node → src/node}/node-sys-abstraction.test.js +0 -0
  491. /package/ts/{option.d.ts → src/option.d.ts} +0 -0
  492. /package/ts/{option.js → src/option.js} +0 -0
  493. /package/ts/{resolve-once.test.d.ts → src/resolve-once.test.d.ts} +0 -0
  494. /package/ts/{result.d.ts → src/result.d.ts} +0 -0
  495. /package/ts/{result.js → src/result.js} +0 -0
  496. /package/ts/{result.test.d.ts → src/result.test.d.ts} +0 -0
  497. /package/ts/{runtime.d.ts → src/runtime.d.ts} +0 -0
  498. /package/ts/{runtime.js → src/runtime.js} +0 -0
  499. /package/ts/{sys-abstraction.d.ts → src/sys-abstraction.d.ts} +0 -0
  500. /package/ts/{sys-abstraction.js → src/sys-abstraction.js} +0 -0
  501. /package/ts/{sys-env.test.d.ts → src/sys-env.test.d.ts} +0 -0
  502. /package/ts/{test → src/test}/index.d.ts +0 -0
  503. /package/ts/{test → src/test}/index.js +0 -0
  504. /package/ts/{test → src/test}/log-write-stream.d.ts +0 -0
  505. /package/ts/{test → src/test}/log-write-stream.js +0 -0
  506. /package/ts/{test → src/test}/mock-logger.d.ts +0 -0
  507. /package/ts/{test → src/test}/mock-logger.js +0 -0
  508. /package/ts/{test → src/test}/mock-logger.test.d.ts +0 -0
  509. /package/ts/{test → src/test}/mock-logger.test.js +0 -0
  510. /package/ts/{test → src/test}/test-exit-handler.d.ts +0 -0
  511. /package/ts/{time.d.ts → src/time.d.ts} +0 -0
  512. /package/ts/{time.js → src/time.js} +0 -0
  513. /package/ts/{tracer.d.ts → src/tracer.d.ts} +0 -0
  514. /package/ts/{tracer.js → src/tracer.js} +0 -0
  515. /package/ts/{tracer.test.d.ts → src/tracer.test.d.ts} +0 -0
  516. /package/ts/{txt-en-decoder.d.ts → src/txt-en-decoder.d.ts} +0 -0
  517. /package/ts/{txt-en-decoder.js → src/txt-en-decoder.js} +0 -0
  518. /package/ts/{uri.test.d.ts → src/uri.test.d.ts} +0 -0
  519. /package/ts/{utils → src/utils}/fanout-write-stream.js +0 -0
  520. /package/ts/{utils → src/utils}/rebuffer.d.ts +0 -0
  521. /package/ts/{utils → src/utils}/rebuffer.test.d.ts +0 -0
  522. /package/ts/{utils → src/utils}/rebuffer.test.js +0 -0
  523. /package/ts/{utils → src/utils}/relative-path.d.ts +0 -0
  524. /package/ts/{utils → src/utils}/relative-path.js +0 -0
  525. /package/ts/{utils → src/utils}/relative-path.test.d.ts +0 -0
  526. /package/ts/{utils → src/utils}/relative-path.test.js +0 -0
  527. /package/ts/{utils → src/utils}/stream-map.d.ts +0 -0
  528. /package/ts/{utils → src/utils}/stream-map.js +0 -0
  529. /package/ts/{utils → src/utils}/stream-map.test.d.ts +0 -0
  530. /package/ts/{utils → src/utils}/stream-map.test.js +0 -0
  531. /package/ts/{utils → src/utils}/stream-test-helper.d.ts +0 -0
  532. /package/ts/{utils → src/utils}/stream2string.d.ts +0 -0
  533. /package/ts/{utils → src/utils}/stream2string.js +0 -0
  534. /package/ts/{utils → src/utils}/stream2string.test.d.ts +0 -0
  535. /package/ts/{utils → src/utils}/stream2string.test.js +0 -0
  536. /package/ts/{utils → src/utils}/string2stream.d.ts +0 -0
  537. /package/ts/{utils → src/utils}/string2stream.js +0 -0
  538. /package/ts/{utils → src/utils}/string2stream.test.d.ts +0 -0
  539. /package/ts/{utils → src/utils}/string2stream.test.js +0 -0
  540. /package/ts/{utils → src/utils}/stripper.js +0 -0
  541. /package/ts/{utils → src/utils}/stripper.test.d.ts +0 -0
  542. /package/ts/{utils → src/utils}/stripper.test.js +0 -0
  543. /package/ts/{version.d.ts → src/version.d.ts} +0 -0
  544. /package/ts/{version.js → src/version.js} +0 -0
  545. /package/ts/{web → src/web}/index.d.ts +0 -0
  546. /package/ts/{web → src/web}/index.js +0 -0
package/src/runtime.ts CHANGED
@@ -6,14 +6,13 @@ export interface Runtime {
6
6
  isCFWorker: boolean;
7
7
  }
8
8
 
9
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
- function isSet(value: string, ref: any = globalThis): boolean {
9
+ function isSet(value: string, ref: Record<string, unknown> = globalThis): boolean {
11
10
  const [head, ...tail] = value.split(".");
12
11
  if (["object", "function"].includes(typeof ref) && ref && ["object", "function"].includes(typeof ref[head]) && ref[head]) {
13
12
  if (tail.length <= 1) {
14
13
  return true;
15
14
  }
16
- return isSet(tail.join("."), ref[head]);
15
+ return isSet(tail.join("."), ref[head] as Record<string, unknown>);
17
16
  }
18
17
  return false;
19
18
  }
@@ -24,6 +23,7 @@ export function runtimeFn(): Runtime {
24
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
24
  const gt: any = globalThis;
26
25
  let isReactNative =
26
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
27
27
  isSet("navigator.product") && typeof gt["navigator"] === "object" && gt["navigator"]["product"] === "ReactNative";
28
28
  let isNodeIsh = false;
29
29
  if (!isSet("Deno")) {
package/src/sys-env.ts CHANGED
@@ -1,8 +1,12 @@
1
- import { DenoEnvActions } from "./deno/deno-sys-abstraction.js";
2
- import { NodeEnvActions } from "./node/node-sys-abstraction.js";
3
- import { BrowserEnvActions } from "./web/web-sys-abstraction.js";
4
- import { CFEnvActions } from "./cf/cf-sys-abstraction.js";
1
+ import { DenoEnvActions } from "./deno/deno-env-actions.js";
2
+ import { NodeEnvActions } from "./node/node-env-actions.js";
3
+ import { BrowserEnvActions } from "./web/web-env-actions.js";
4
+ import { CFEnvActions } from "./cf/cf-env-actions.js";
5
5
  import { KeyedResolvOnce } from "./resolve-once.js";
6
+ import { Result } from "./result.js";
7
+ import { getParamsResult, KeysParam } from "./utils/get-params-result.js";
8
+
9
+ export type EnvTuple = ([string, string] | [string, string][] | Record<string, string> | Iterator<[string, string]>)[];
6
10
 
7
11
  export interface EnvMap {
8
12
  get(key: string): string | undefined;
@@ -28,6 +32,9 @@ export interface OnSetItem {
28
32
 
29
33
  export interface Env extends EnvMap {
30
34
  onSet(fn: OnSetFn, ...filter: string[]): void;
35
+
36
+ gets(...kparams: KeysParam): Result<Record<string, string>>;
37
+ sets(...keys: EnvTuple): void;
31
38
  }
32
39
 
33
40
  export type EnvFactoryFn = (opts: Partial<EnvFactoryOpts>) => EnvActions;
@@ -66,12 +73,65 @@ export function envFactory(opts: Partial<EnvFactoryOpts> = {}): Env {
66
73
  });
67
74
  }
68
75
 
76
+ function isIterable(obj: unknown): obj is Iterable<[string, string]> {
77
+ // checks for null and undefined
78
+ if (obj == null) {
79
+ return false;
80
+ }
81
+ return typeof (obj as Record<symbol, unknown>)[Symbol.iterator] === "function";
82
+ }
83
+
69
84
  export class EnvImpl implements Env {
70
85
  readonly _map: EnvMap;
71
86
  constructor(map: EnvMap, opts: Partial<EnvFactoryOpts> = {}) {
72
87
  this._map = map;
73
88
  this._updatePresets(opts.presetEnv);
74
89
  }
90
+ gets(...kparams: KeysParam): Result<Record<string, string>> {
91
+ return getParamsResult(kparams, {
92
+ getParam: (k) => this.get(k),
93
+ });
94
+ }
95
+ sets(...keys: EnvTuple): void {
96
+ keys.forEach((key) => {
97
+ if (Array.isArray(key)) {
98
+ if (key.length === 2) {
99
+ const [k, v] = key;
100
+ if (typeof k === "string" && typeof v === "string") {
101
+ this.set(k, v);
102
+ return;
103
+ }
104
+ }
105
+ for (const item of key) {
106
+ if (Array.isArray(item)) {
107
+ // [string, string]
108
+ if (item.length === 2) {
109
+ const [k, v] = item;
110
+ if (typeof k === "string" && typeof v === "string") {
111
+ this.set(k, v);
112
+ }
113
+ }
114
+ }
115
+ }
116
+ } else {
117
+ if (isIterable(key)) {
118
+ for (const [k, v] of key) {
119
+ if (typeof k === "string" && typeof v === "string") {
120
+ this.set(k, v);
121
+ }
122
+ }
123
+ } else {
124
+ const rKey = key as Record<string, string>;
125
+ for (const k in rKey) {
126
+ const v = rKey[k];
127
+ if (typeof k === "string" && typeof v === "string") {
128
+ this.set(k, v);
129
+ }
130
+ }
131
+ }
132
+ }
133
+ });
134
+ }
75
135
  _updatePresets(presetEnv?: Map<string, string>): void {
76
136
  if (!presetEnv) {
77
137
  return;
@@ -61,7 +61,7 @@ export class LogCollector implements WritableStream<Uint8Array> {
61
61
 
62
62
  getWriter(): WritableStreamDefaultWriter<Uint8Array> {
63
63
  if (!this._writer) {
64
- const dests: WritableStreamDefaultWriter[] = [new LogWriteStream(this._bufferArr)];
64
+ const dests: WritableStreamDefaultWriter<Uint8Array>[] = [new LogWriteStream(this._bufferArr)];
65
65
  if (this._pass) {
66
66
  dests.push(this._pass);
67
67
  }
@@ -87,6 +87,7 @@ export class LogCollector implements WritableStream<Uint8Array> {
87
87
  if (!notJsonLine) {
88
88
  const splitStr = jsonNlStr.split("\n");
89
89
  const filterStr = splitStr.filter((a) => a.length);
90
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
90
91
  const mapStr = filterStr.map((a) => JSON.parse(a));
91
92
  return mapStr;
92
93
  }
package/src/tracer.ts CHANGED
@@ -38,14 +38,12 @@ export class Metric<T> {
38
38
  add<R extends number | ArrayLike<T>>(value: R): void {
39
39
  if (typeof value === "number") {
40
40
  if (this.value === undefined) {
41
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
- this.value = 0 as any;
41
+ this.value = 0 as T;
43
42
  }
44
- (this.value as number) = ((this.value as number) + value) as number;
43
+ this.value = ((this.value as number) + value) as T;
45
44
  } else if (Array.isArray(value)) {
46
45
  if (!Array.isArray(this.value)) {
47
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
- this.value = [] as any;
46
+ this.value = [] as T;
49
47
  }
50
48
  (this.value as T[]).push(...value);
51
49
  } else {
@@ -145,7 +143,7 @@ export class TraceNode {
145
143
  const spanRefs = this.metrics.toJSON.call({ map: this.metrics.spanRefs });
146
144
  const metricsRefs = Object.keys(spanRefs).length > 0 ? { metricRefs: spanRefs } : {};
147
145
  return {
148
- ctx: cleanCtx as CleanCtx,
146
+ ctx: cleanCtx,
149
147
  invokations: this.invokations,
150
148
  ...metricsRefs,
151
149
  };
package/src/uri.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { exception2Result, Result } from "./result.js";
2
+ import { getParamsResult, KeysParam, param } from "./utils/get-params-result.js";
2
3
  import { relativePath } from "./utils/relative-path.js";
3
4
  import { StripCommand, stripper } from "./utils/stripper.js";
4
5
 
@@ -6,30 +7,14 @@ type NullOrUndef = null | undefined;
6
7
 
7
8
  type OneKey<K extends string, V = string> = Record<K, V>;
8
9
 
9
- export type MsgFn = (...keys: string[]) => string;
10
+ /** @deprecated use param from get-params-result */
11
+ export const key = param;
12
+
10
13
  /*
11
14
  if KeyParam is a Object
12
15
  if the right side is a string, it is the default value
13
16
  if the right side is a !string | REQUIRED, it is required
14
17
  */
15
- class _REQUIRED {
16
- readonly val = "REQUIRED";
17
- }
18
- class _OPTIONAL {
19
- readonly val = "OPTIONAL";
20
- }
21
-
22
- interface _key {
23
- readonly REQUIRED: _REQUIRED;
24
- readonly OPTIONAL: _OPTIONAL;
25
- }
26
-
27
- export const key: _key = {
28
- REQUIRED: new _REQUIRED(),
29
- OPTIONAL: new _OPTIONAL(),
30
- };
31
-
32
- export type KeysParam = (string | MsgFn | Record<string, _REQUIRED | _OPTIONAL | unknown>)[];
33
18
 
34
19
  // type ReturnType<T extends (...args: KeysParam) => unknown> = T extends (...args: KeysParam) => infer R ? R : unknown;
35
20
 
@@ -272,56 +257,6 @@ function getParamResult(
272
257
  return Result.Ok(val);
273
258
  }
274
259
 
275
- function getParamsResult(
276
- keys: KeysParam,
277
- getParam: { getParam: (key: string) => string | undefined },
278
- ): Result<Record<string, string>> {
279
- const keyDef = keys.flat().reduce(
280
- (acc, i) => {
281
- if (typeof i === "string") {
282
- acc.push({ key: i, def: undefined, isOptional: false });
283
- } else if (typeof i === "object") {
284
- acc.push(
285
- ...Object.keys(i).map((k) => ({
286
- key: k,
287
- def: typeof i[k] === "string" ? i[k] : undefined,
288
- isOptional: i[k] instanceof _OPTIONAL,
289
- })),
290
- );
291
- }
292
- return acc;
293
- },
294
- [] as { key: string; def?: string; isOptional: boolean }[],
295
- );
296
- //.filter((k) => typeof k === "string");
297
- const msgFn =
298
- keys.find((k) => typeof k === "function") ||
299
- ((...keys: string[]): string => {
300
- const msg = keys.join(",");
301
- return `missing parameters: ${msg}`;
302
- });
303
- const errors: string[] = [];
304
- const result: Record<string, string> = {};
305
- for (const kd of keyDef) {
306
- const val = getParam.getParam(kd.key);
307
- if (val === undefined) {
308
- if (typeof kd.def === "string") {
309
- result[kd.key] = kd.def;
310
- } else {
311
- if (!kd.isOptional) {
312
- errors.push(kd.key);
313
- }
314
- }
315
- } else {
316
- result[kd.key] = val;
317
- }
318
- }
319
- if (errors.length) {
320
- return Result.Err(msgFn(...errors));
321
- }
322
- return Result.Ok(result);
323
- }
324
-
325
260
  export class BuildURI implements URIInterface<BuildURI> {
326
261
  _url: MutableURL; // pathname needs this
327
262
  private constructor(url: MutableURL) {
@@ -23,7 +23,7 @@ export class ConsoleWriterStreamDefaultWriter implements WritableStreamDefaultWr
23
23
  this.ready = Promise.resolve(undefined);
24
24
  this.closed = Promise.resolve(undefined);
25
25
  }
26
- async write(chunk?: Uint8Array | undefined): Promise<void> {
26
+ write(chunk?: Uint8Array): Promise<void> {
27
27
  let strObj: string | { level: string } = this.decoder.decode(chunk).trimEnd();
28
28
  let output = "log";
29
29
  try {
@@ -46,6 +46,7 @@ export class ConsoleWriterStreamDefaultWriter implements WritableStreamDefaultWr
46
46
  // eslint-disable-next-line no-console
47
47
  console.log(strObj);
48
48
  }
49
+ return Promise.resolve();
49
50
  }
50
51
  }
51
52
 
@@ -56,8 +57,8 @@ export class ConsoleWriterStream implements WritableStream<Uint8Array> {
56
57
  abort(reason?: any): Promise<void> {
57
58
  throw new Error("Method not implemented.");
58
59
  }
59
- async close(): Promise<void> {
60
- return;
60
+ close(): Promise<void> {
61
+ return Promise.resolve();
61
62
  }
62
63
  getWriter(): WritableStreamDefaultWriter<Uint8Array> {
63
64
  if (this.locked) {
@@ -24,7 +24,7 @@ export class FanoutWriteStream implements WritableStreamDefaultWriter<Uint8Array
24
24
  this._writers.map((w) => w.releaseLock());
25
25
  }
26
26
 
27
- write(chunk?: Uint8Array | undefined): Promise<void> {
27
+ write(chunk?: Uint8Array): Promise<void> {
28
28
  return Promise.all(this._writers.map((w) => w.write(chunk))).then(() => {
29
29
  /* do nothing */
30
30
  });
@@ -0,0 +1,71 @@
1
+ import { Result } from "../result.js";
2
+
3
+ class _REQUIRED {
4
+ readonly val = "REQUIRED";
5
+ }
6
+ class _OPTIONAL {
7
+ readonly val = "OPTIONAL";
8
+ }
9
+
10
+ export interface Param {
11
+ readonly REQUIRED: _REQUIRED;
12
+ readonly OPTIONAL: _OPTIONAL;
13
+ }
14
+
15
+ export const param: Param = {
16
+ REQUIRED: new _REQUIRED(),
17
+ OPTIONAL: new _OPTIONAL(),
18
+ };
19
+
20
+ export type MsgFn = (...keys: string[]) => string;
21
+ export type KeysParam = (string | MsgFn | Record<string, _REQUIRED | _OPTIONAL | number | string | boolean | undefined | null>)[];
22
+
23
+ export function getParamsResult(
24
+ keys: KeysParam,
25
+ getParam: { getParam: (key: string) => string | undefined },
26
+ ): Result<Record<string, string>> {
27
+ const keyDef = keys.flat().reduce(
28
+ (acc, i) => {
29
+ if (typeof i === "string") {
30
+ acc.push({ key: i, def: undefined, isOptional: false });
31
+ } else if (typeof i === "object") {
32
+ acc.push(
33
+ ...Object.keys(i).map((k) => ({
34
+ key: k,
35
+ def: typeof i[k] === "string" ? i[k] : undefined,
36
+ isOptional: i[k] === param.OPTIONAL,
37
+ })),
38
+ );
39
+ }
40
+ return acc;
41
+ },
42
+ [] as { key: string; def?: string; isOptional: boolean }[],
43
+ );
44
+ //.filter((k) => typeof k === "string");
45
+ const msgFn =
46
+ keys.find((k) => typeof k === "function") ||
47
+ ((...keys: string[]): string => {
48
+ const msg = keys.join(",");
49
+ return `missing parameters: ${msg}`;
50
+ });
51
+ const errors: string[] = [];
52
+ const result: Record<string, string> = {};
53
+ for (const kd of keyDef) {
54
+ const val = getParam.getParam(kd.key);
55
+ if (val === undefined) {
56
+ if (typeof kd.def === "string") {
57
+ result[kd.key] = kd.def;
58
+ } else {
59
+ if (!kd.isOptional) {
60
+ errors.push(kd.key);
61
+ }
62
+ }
63
+ } else {
64
+ result[kd.key] = val;
65
+ }
66
+ }
67
+ if (errors.length) {
68
+ return Result.Err(msgFn(...errors));
69
+ }
70
+ return Result.Ok(result);
71
+ }
@@ -4,3 +4,4 @@ export * from "./stream2string.js";
4
4
  export * from "./string2stream.js";
5
5
  export * from "./console-write-stream.js";
6
6
  export * from "./fanout-write-stream.js";
7
+ export * from "./get-params-result.js";
@@ -33,29 +33,35 @@ interface pumpState {
33
33
  }
34
34
 
35
35
  function pump(ps: pumpState, controller: ReadableStreamDefaultController<Uint8Array>, next: () => void): void {
36
- ps.reader.read().then(({ done, value }) => {
37
- if (done) {
38
- if (ps.tmpLen > 0) {
39
- controller.enqueue(reChunk(ps.tmp, ps.tmpLen).chunk);
36
+ ps.reader
37
+ .read()
38
+ .then(({ done, value }) => {
39
+ if (done) {
40
+ if (ps.tmpLen > 0) {
41
+ controller.enqueue(reChunk(ps.tmp, ps.tmpLen).chunk);
42
+ }
43
+ controller.close();
44
+ next();
45
+ return;
40
46
  }
41
- controller.close();
42
- next();
43
- return;
44
- }
45
- if (ps.tmpLen + value.length > ps.chunkSize) {
46
- ps.tmp.push(value);
47
- const res = reChunk(ps.tmp, ps.chunkSize);
48
- controller.enqueue(res.chunk);
49
- ps.tmp = [res.rest];
50
- ps.tmpLen = res.rest.length;
47
+ if (ps.tmpLen + value.length > ps.chunkSize) {
48
+ ps.tmp.push(value);
49
+ const res = reChunk(ps.tmp, ps.chunkSize);
50
+ controller.enqueue(res.chunk);
51
+ ps.tmp = [res.rest];
52
+ ps.tmpLen = res.rest.length;
53
+ next();
54
+ return;
55
+ } else if (value.length) {
56
+ ps.tmp.push(value);
57
+ ps.tmpLen += value.length;
58
+ }
59
+ pump(ps, controller, next);
60
+ })
61
+ .catch((err) => {
62
+ controller.error(err);
51
63
  next();
52
- return;
53
- } else if (value.length) {
54
- ps.tmp.push(value);
55
- ps.tmpLen += value.length;
56
- }
57
- pump(ps, controller, next);
58
- });
64
+ });
59
65
  }
60
66
 
61
67
  export function rebuffer(a: ReadableStream<Uint8Array>, chunkSize: number): ReadableStream<Uint8Array> {
@@ -38,7 +38,7 @@ export class Path {
38
38
  if (this.parts.includes(PartType.Root) && part === PartType.Root) {
39
39
  throw new Error("Cannot add absolute part to absolute path");
40
40
  }
41
- const last = this.parts[this.parts.length - 1] as number;
41
+ const last = this.parts[this.parts.length - 1] as PartType;
42
42
  if (last & PartType.Slash && part === PartType.Slash) {
43
43
  return;
44
44
  }
@@ -19,7 +19,7 @@ export async function stream2string(stream?: ReadableStream<Uint8Array> | null,
19
19
  rSize += read.value.length;
20
20
  res += block;
21
21
  } catch (err) {
22
- return Promise.reject(err);
22
+ return Promise.reject(err as Error);
23
23
  }
24
24
  }
25
25
  return Promise.resolve(res);
@@ -40,7 +40,7 @@ export async function stream2uint8array(stream?: ReadableStream<Uint8Array> | nu
40
40
  }
41
41
  res = new Uint8Array([...res, ...value]);
42
42
  } catch (err) {
43
- return Promise.reject(err);
43
+ return Promise.reject(err as Error);
44
44
  }
45
45
  }
46
46
  return Promise.resolve(res);
@@ -1,6 +1,6 @@
1
1
  export type StripCommand = string | RegExp;
2
2
 
3
- export function stripper<T extends unknown | ArrayLike<unknown>>(
3
+ export function stripper<T extends ArrayLike<S> | S, S>(
4
4
  strip: StripCommand | StripCommand[],
5
5
  obj: T,
6
6
  ): T extends ArrayLike<unknown> ? Record<string, unknown>[] : Record<string, unknown> {
@@ -49,7 +49,7 @@ function localStripper<T>(path: string | undefined, restrips: RegExp[], obj: T):
49
49
  }
50
50
  if (typeof ret[key] === "object") {
51
51
  if (Array.isArray(ret[key])) {
52
- ret[key] = ret[key].reduce((acc, v, i) => {
52
+ ret[key] = ret[key].reduce((acc: unknown[], v, i) => {
53
53
  const toDelete = matcher(key, `${nextPath}[${i}]`);
54
54
  if (!toDelete) {
55
55
  acc.push(localStripper(`${nextPath}[${i}]`, restrips, v));
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
- export const VERSION = Object.keys({
1
+ export const VERSION: string = Object.keys({
2
2
  __packageVersion__: "xxxx",
3
- })[0] as string;
3
+ })[0];
@@ -0,0 +1,41 @@
1
+ import { ResolveOnce } from "../resolve-once.js";
2
+ import { EnvActions, EnvFactoryOpts, Env } from "../sys-env.js";
3
+
4
+ const once = new ResolveOnce<BrowserEnvActions>();
5
+ export class BrowserEnvActions implements EnvActions {
6
+ readonly env: Map<string, string> = new Map<string, string>();
7
+ readonly opts: Partial<EnvFactoryOpts>;
8
+
9
+ static new(opts: Partial<EnvFactoryOpts>): EnvActions {
10
+ return once.once(() => new BrowserEnvActions(opts));
11
+ }
12
+
13
+ private constructor(opts: Partial<EnvFactoryOpts>) {
14
+ this.opts = opts;
15
+ }
16
+
17
+ get(key: string): string | undefined {
18
+ return this.env.get(key);
19
+ }
20
+ set(key: string, value?: string): void {
21
+ if (value) {
22
+ this.env.set(key, value);
23
+ }
24
+ }
25
+ delete(key: string): void {
26
+ this.env.delete(key);
27
+ }
28
+ keys(): string[] {
29
+ return Array.from(this.env.keys());
30
+ }
31
+ active(): boolean {
32
+ return true; // that should work on every runtime
33
+ }
34
+
35
+ register(env: Env): Env {
36
+ const sym = Symbol.for(this.opts.symbol || "CP_ENV");
37
+ const browser = globalThis as unknown as Record<symbol, Env>;
38
+ browser[sym] = env;
39
+ return env;
40
+ }
41
+ }
@@ -1,49 +1,9 @@
1
1
  import { BaseSysAbstraction, WrapperSysAbstraction, WrapperSysAbstractionParams } from "../base-sys-abstraction.js";
2
2
  import { FileService, NamedWritableStream } from "../file-service.js";
3
- import { ResolveOnce } from "../resolve-once.js";
4
3
  import { SysAbstraction, SystemService, VoidFunc } from "../sys-abstraction.js";
5
- import { Env, EnvActions, envFactory, EnvFactoryOpts } from "../sys-env.js";
4
+ import { Env, envFactory } from "../sys-env.js";
6
5
  import { Utf8EnDecoderSingleton } from "../txt-en-decoder.js";
7
6
 
8
- const once = new ResolveOnce<BrowserEnvActions>();
9
- export class BrowserEnvActions implements EnvActions {
10
- readonly env: Map<string, string> = new Map<string, string>();
11
- readonly opts: Partial<EnvFactoryOpts>;
12
-
13
- static new(opts: Partial<EnvFactoryOpts>): EnvActions {
14
- return once.once(() => new BrowserEnvActions(opts));
15
- }
16
-
17
- private constructor(opts: Partial<EnvFactoryOpts>) {
18
- this.opts = opts;
19
- }
20
-
21
- get(key: string): string | undefined {
22
- return this.env.get(key);
23
- }
24
- set(key: string, value?: string): void {
25
- if (value) {
26
- this.env.set(key, value);
27
- }
28
- }
29
- delete(key: string): void {
30
- this.env.delete(key);
31
- }
32
- keys(): string[] {
33
- return Array.from(this.env.keys());
34
- }
35
- active(): boolean {
36
- return true; // that should work on every runtime
37
- }
38
-
39
- register(env: Env): Env {
40
- const sym = Symbol.for(this.opts.symbol || "CP_ENV");
41
- const browser = globalThis as unknown as Record<symbol, Env>;
42
- browser[sym] = env;
43
- return env;
44
- }
45
- }
46
-
47
7
  export class WebFileService implements FileService {
48
8
  get baseDir(): string {
49
9
  throw new Error("basedir-Method not implemented.");
@@ -69,7 +29,7 @@ export class WebFileService implements FileService {
69
29
  throw new Error("join-Method not implemented.");
70
30
  }
71
31
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
72
- relative(from: string, to?: string | undefined): string {
32
+ relative(from: string, to?: string): string {
73
33
  throw new Error("relative-Method not implemented.");
74
34
  }
75
35
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -1,3 +1,5 @@
1
+ import { K as KeysParam, R as Result } from './get-params-result-Bhy5997x.cjs';
2
+
1
3
  interface NamedWritableStream {
2
4
  readonly name: string;
3
5
  readonly stream: WritableStream<Uint8Array>;
@@ -15,6 +17,7 @@ interface FileService {
15
17
  isAbsolute(fname: string): boolean;
16
18
  }
17
19
 
20
+ type EnvTuple = ([string, string] | [string, string][] | Record<string, string> | Iterator<[string, string]>)[];
18
21
  interface EnvMap {
19
22
  get(key: string): string | undefined;
20
23
  set(key: string, value?: string): void;
@@ -36,6 +39,8 @@ interface OnSetItem {
36
39
  }
37
40
  interface Env extends EnvMap {
38
41
  onSet(fn: OnSetFn, ...filter: string[]): void;
42
+ gets(...kparams: KeysParam): Result<Record<string, string>>;
43
+ sets(...keys: EnvTuple): void;
39
44
  }
40
45
  type EnvFactoryFn = (opts: Partial<EnvFactoryOpts>) => EnvActions;
41
46
  declare function registerEnvAction(fn: EnvFactoryFn): () => void;
@@ -43,6 +48,8 @@ declare function envFactory(opts?: Partial<EnvFactoryOpts>): Env;
43
48
  declare class EnvImpl implements Env {
44
49
  readonly _map: EnvMap;
45
50
  constructor(map: EnvMap, opts?: Partial<EnvFactoryOpts>);
51
+ gets(...kparams: KeysParam): Result<Record<string, string>>;
52
+ sets(...keys: EnvTuple): void;
46
53
  _updatePresets(presetEnv?: Map<string, string>): void;
47
54
  _applyOnSet(onSet: OnSetItem[], key?: string, value?: string): void;
48
55
  readonly _onSet: OnSetItem[];
@@ -99,4 +106,4 @@ interface SysAbstraction {
99
106
  FileSystem(): FileService;
100
107
  }
101
108
 
102
- export { type Duration as D, type EnvActions as E, type FileService as F, IDMode as I, type NamedWritableStream as N, type OnSetItem as O, RandomMode as R, type SystemService as S, Time as T, type VoidFunc as V, EnvImpl as a, type EnvFactoryOpts as b, type Env as c, type SysAbstraction as d, TimeMode as e, String2TimeMode as f, type EnvMap as g, type EnvFactoryFn as h, envFactory as i, TimeUnits as j, registerEnvAction as r };
109
+ export { type Duration as D, type Env as E, type FileService as F, IDMode as I, type NamedWritableStream as N, type OnSetItem as O, RandomMode as R, type SystemService as S, Time as T, type VoidFunc as V, type SysAbstraction as a, TimeMode as b, String2TimeMode as c, type EnvTuple as d, type EnvMap as e, type EnvActions as f, type EnvFactoryOpts as g, type EnvFactoryFn as h, envFactory as i, EnvImpl as j, TimeUnits as k, registerEnvAction as r };
@@ -1,3 +1,5 @@
1
+ import { K as KeysParam, R as Result } from './get-params-result-Bhy5997x.js';
2
+
1
3
  interface NamedWritableStream {
2
4
  readonly name: string;
3
5
  readonly stream: WritableStream<Uint8Array>;
@@ -15,6 +17,7 @@ interface FileService {
15
17
  isAbsolute(fname: string): boolean;
16
18
  }
17
19
 
20
+ type EnvTuple = ([string, string] | [string, string][] | Record<string, string> | Iterator<[string, string]>)[];
18
21
  interface EnvMap {
19
22
  get(key: string): string | undefined;
20
23
  set(key: string, value?: string): void;
@@ -36,6 +39,8 @@ interface OnSetItem {
36
39
  }
37
40
  interface Env extends EnvMap {
38
41
  onSet(fn: OnSetFn, ...filter: string[]): void;
42
+ gets(...kparams: KeysParam): Result<Record<string, string>>;
43
+ sets(...keys: EnvTuple): void;
39
44
  }
40
45
  type EnvFactoryFn = (opts: Partial<EnvFactoryOpts>) => EnvActions;
41
46
  declare function registerEnvAction(fn: EnvFactoryFn): () => void;
@@ -43,6 +48,8 @@ declare function envFactory(opts?: Partial<EnvFactoryOpts>): Env;
43
48
  declare class EnvImpl implements Env {
44
49
  readonly _map: EnvMap;
45
50
  constructor(map: EnvMap, opts?: Partial<EnvFactoryOpts>);
51
+ gets(...kparams: KeysParam): Result<Record<string, string>>;
52
+ sets(...keys: EnvTuple): void;
46
53
  _updatePresets(presetEnv?: Map<string, string>): void;
47
54
  _applyOnSet(onSet: OnSetItem[], key?: string, value?: string): void;
48
55
  readonly _onSet: OnSetItem[];
@@ -99,4 +106,4 @@ interface SysAbstraction {
99
106
  FileSystem(): FileService;
100
107
  }
101
108
 
102
- export { type Duration as D, type EnvActions as E, type FileService as F, IDMode as I, type NamedWritableStream as N, type OnSetItem as O, RandomMode as R, type SystemService as S, Time as T, type VoidFunc as V, EnvImpl as a, type EnvFactoryOpts as b, type Env as c, type SysAbstraction as d, TimeMode as e, String2TimeMode as f, type EnvMap as g, type EnvFactoryFn as h, envFactory as i, TimeUnits as j, registerEnvAction as r };
109
+ export { type Duration as D, type Env as E, type FileService as F, IDMode as I, type NamedWritableStream as N, type OnSetItem as O, RandomMode as R, type SystemService as S, Time as T, type VoidFunc as V, type SysAbstraction as a, TimeMode as b, String2TimeMode as c, type EnvTuple as d, type EnvMap as e, type EnvActions as f, type EnvFactoryOpts as g, type EnvFactoryFn as h, envFactory as i, EnvImpl as j, TimeUnits as k, registerEnvAction as r };