@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.
- package/{base-sys-abstraction-CR_Z-Ceg.d.ts → base-sys-abstraction-CKI4xiRR.d.ts} +4 -4
- package/{base-sys-abstraction-DWtPI7Kg.d.cts → base-sys-abstraction-DLnSeH4s.d.cts} +4 -4
- package/cf/index.cjs +298 -284
- package/cf/index.cjs.map +1 -1
- package/cf/index.d.cts +4 -18
- package/cf/index.d.ts +4 -18
- package/cf/index.js +39 -6
- package/cf/index.js.map +1 -1
- package/{chunk-P6LDM7PY.js → chunk-4QRZPFED.js} +112 -506
- package/chunk-4QRZPFED.js.map +1 -0
- package/{chunk-HFP74WLI.js → chunk-4U6TAOIU.js} +5 -4
- package/chunk-4U6TAOIU.js.map +1 -0
- package/{chunk-PRCFKZR7.js → chunk-6AG3MRNY.js} +22 -170
- package/chunk-6AG3MRNY.js.map +1 -0
- package/{chunk-A7OPSHUV.js → chunk-LRJXXDF5.js} +11 -4
- package/chunk-LRJXXDF5.js.map +1 -0
- package/chunk-OIIUVSUX.js +88 -0
- package/chunk-OIIUVSUX.js.map +1 -0
- package/chunk-QDDO6NOK.js +194 -0
- package/chunk-QDDO6NOK.js.map +1 -0
- package/deno/index.cjs +274 -166
- package/deno/index.cjs.map +1 -1
- package/deno/index.d.cts +4 -24
- package/deno/index.d.ts +4 -24
- package/deno/index.js +174 -8
- package/deno/index.js.map +1 -1
- package/get-params-result-Bhy5997x.d.cts +61 -0
- package/get-params-result-Bhy5997x.d.ts +61 -0
- package/{index-CfSl8Gmj.d.ts → index-1R-hTV11.d.ts} +5 -50
- package/{index-BfZxTAe_.d.cts → index-98HXQB3i.d.cts} +5 -50
- package/{index-Q3phXzYr.d.cts → index-BMCdndbY.d.cts} +28 -23
- package/{index-tIGZMHTc.d.ts → index-IrV5jK1W.d.ts} +28 -23
- package/index.cjs +327 -430
- package/index.cjs.map +1 -1
- package/index.d.cts +13 -11
- package/index.d.ts +13 -11
- package/index.js +18 -12
- package/index.js.map +1 -1
- package/node/index.cjs +247 -139
- package/node/index.cjs.map +1 -1
- package/node/index.d.cts +4 -17
- package/node/index.d.ts +4 -17
- package/node/index.js +183 -12
- package/node/index.js.map +1 -1
- package/package.json +1 -1
- package/src/base-sys-abstraction.ts +8 -6
- package/src/cf/cf-env-actions.ts +53 -0
- package/src/cf/cf-sys-abstraction.ts +1 -53
- package/src/cf-test-main.ts +5 -0
- package/src/deno/deno-env-actions.ts +57 -0
- package/src/deno/deno-file-service.ts +1 -1
- package/src/deno/deno-sys-abstraction.ts +1 -57
- package/src/http_header.ts +1 -1
- package/src/index.ts +3 -0
- package/src/jsr.json +1 -1
- package/src/log-writer-impl.ts +10 -5
- package/src/logger-impl.ts +9 -8
- package/src/logger.ts +4 -5
- package/src/node/mock-file-service.ts +4 -4
- package/src/node/node-env-actions.ts +45 -0
- package/src/node/node-sys-abstraction.ts +1 -45
- package/src/resolve-once.ts +6 -5
- package/src/runtime.ts +3 -3
- package/src/sys-env.ts +64 -4
- package/src/test/log-write-stream.ts +2 -1
- package/src/tracer.ts +4 -6
- package/src/uri.ts +4 -69
- package/src/utils/console-write-stream.ts +4 -3
- package/src/utils/fanout-write-stream.ts +1 -1
- package/src/utils/get-params-result.ts +71 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/rebuffer.ts +27 -21
- package/src/utils/relative-path.ts +1 -1
- package/src/utils/stream2string.ts +2 -2
- package/src/utils/stripper.ts +2 -2
- package/src/version.ts +2 -2
- package/src/web/web-env-actions.ts +41 -0
- package/src/web/web-sys-abstraction.ts +2 -42
- package/{sys-abstraction-GNnBj2sz.d.cts → sys-abstraction-BRDT_TIU.d.cts} +8 -1
- package/{sys-abstraction-GNnBj2sz.d.ts → sys-abstraction-Bd0EzwO6.d.ts} +8 -1
- package/test/index.cjs +460 -578
- package/test/index.cjs.map +1 -1
- package/test/index.d.cts +3 -3
- package/test/index.d.ts +3 -3
- package/test/index.js +5 -4
- package/ts/smoke/smoke.d.ts +2 -0
- package/ts/smoke/smoke.d.ts.map +1 -0
- package/ts/smoke/smoke.js +33 -0
- package/ts/smoke/smoke.js.map +1 -0
- package/ts/{base-sys-abstraction.d.ts → src/base-sys-abstraction.d.ts} +2 -2
- package/ts/src/base-sys-abstraction.d.ts.map +1 -0
- package/ts/{base-sys-abstraction.js → src/base-sys-abstraction.js} +4 -2
- package/ts/src/base-sys-abstraction.js.map +1 -0
- package/ts/src/base-sys-abstraction.test.d.ts.map +1 -0
- package/ts/src/base-sys-abstraction.test.js.map +1 -0
- package/ts/src/bin2text.d.ts.map +1 -0
- package/ts/src/bin2text.js.map +1 -0
- package/ts/{bin2text.test.d.ts.map → src/bin2text.test.d.ts.map} +1 -1
- package/ts/src/bin2text.test.js.map +1 -0
- package/ts/src/cf/cf-env-actions.d.ts +16 -0
- package/ts/src/cf/cf-env-actions.d.ts.map +1 -0
- package/ts/{cf/cf-sys-abstraction.js → src/cf/cf-env-actions.js} +1 -30
- package/ts/src/cf/cf-env-actions.js.map +1 -0
- package/ts/src/cf/cf-sys-abstraction.d.ts +11 -0
- package/ts/src/cf/cf-sys-abstraction.d.ts.map +1 -0
- package/ts/src/cf/cf-sys-abstraction.js +30 -0
- package/ts/src/cf/cf-sys-abstraction.js.map +1 -0
- package/ts/src/cf/index.d.ts.map +1 -0
- package/ts/src/cf/index.js.map +1 -0
- package/ts/src/cf-test-main.d.ts +5 -0
- package/ts/src/cf-test-main.d.ts.map +1 -0
- package/ts/src/cf-test-main.js +6 -0
- package/ts/src/cf-test-main.js.map +1 -0
- package/ts/src/crypto.d.ts.map +1 -0
- package/ts/src/crypto.js.map +1 -0
- package/ts/{crypto.test.d.ts.map → src/crypto.test.d.ts.map} +1 -1
- package/ts/{crypto.test.js → src/crypto.test.js} +8 -1
- package/ts/src/crypto.test.js.map +1 -0
- package/ts/src/deno/deno-env-actions.d.ts +23 -0
- package/ts/src/deno/deno-env-actions.d.ts.map +1 -0
- package/ts/src/deno/deno-env-actions.js +46 -0
- package/ts/src/deno/deno-env-actions.js.map +1 -0
- package/ts/src/deno/deno-file-service.d.ts.map +1 -0
- package/ts/src/deno/deno-file-service.js.map +1 -0
- package/ts/{deno → src/deno}/deno-sys-abstraction.d.ts +1 -22
- package/ts/src/deno/deno-sys-abstraction.d.ts.map +1 -0
- package/ts/{deno → src/deno}/deno-sys-abstraction.js +0 -45
- package/ts/src/deno/deno-sys-abstraction.js.map +1 -0
- package/ts/src/deno/index.d.ts.map +1 -0
- package/ts/src/deno/index.js.map +1 -0
- package/ts/src/file-service.d.ts.map +1 -0
- package/ts/{file-service.js.map → src/file-service.js.map} +1 -1
- package/ts/src/future.d.ts.map +1 -0
- package/ts/src/future.js.map +1 -0
- package/ts/{future.test.d.ts.map → src/future.test.d.ts.map} +1 -1
- package/ts/src/future.test.js.map +1 -0
- package/ts/src/http_header.d.ts.map +1 -0
- package/ts/src/http_header.js.map +1 -0
- package/ts/src/http_header.test.d.ts.map +1 -0
- package/ts/src/http_header.test.js.map +1 -0
- package/ts/{index.d.ts → src/index.d.ts} +2 -0
- package/ts/src/index.d.ts.map +1 -0
- package/ts/{index.js → src/index.js} +2 -0
- package/ts/src/index.js.map +1 -0
- package/ts/src/log-level-impl.d.ts.map +1 -0
- package/ts/src/log-level-impl.js.map +1 -0
- package/ts/src/log-writer-impl.d.ts.map +1 -0
- package/ts/{log-writer-impl.js → src/log-writer-impl.js} +4 -2
- package/ts/src/log-writer-impl.js.map +1 -0
- package/ts/{logger-impl.d.ts → src/logger-impl.d.ts} +1 -1
- package/ts/src/logger-impl.d.ts.map +1 -0
- package/ts/{logger-impl.js → src/logger-impl.js} +2 -3
- package/ts/src/logger-impl.js.map +1 -0
- package/ts/{logger.d.ts → src/logger.d.ts} +1 -1
- package/ts/src/logger.d.ts.map +1 -0
- package/ts/src/logger.js.map +1 -0
- package/ts/{logger.test.d.ts.map → src/logger.test.d.ts.map} +1 -1
- package/ts/{logger.test.js → src/logger.test.js} +4 -4
- package/ts/src/logger.test.js.map +1 -0
- package/ts/src/node/index.d.ts.map +1 -0
- package/ts/src/node/index.js.map +1 -0
- package/ts/src/node/mock-file-service.d.ts.map +1 -0
- package/ts/{node → src/node}/mock-file-service.js +4 -4
- package/ts/src/node/mock-file-service.js.map +1 -0
- package/ts/src/node/mock-file-service.test.d.ts.map +1 -0
- package/ts/src/node/mock-file-service.test.js.map +1 -0
- package/ts/src/node/node-env-actions.d.ts +15 -0
- package/ts/src/node/node-env-actions.d.ts.map +1 -0
- package/ts/src/node/node-env-actions.js +44 -0
- package/ts/src/node/node-env-actions.js.map +1 -0
- package/ts/src/node/node-file-service.d.ts.map +1 -0
- package/ts/src/node/node-file-service.js.map +1 -0
- package/ts/{node → src/node}/node-sys-abstraction.d.ts +1 -14
- package/ts/src/node/node-sys-abstraction.d.ts.map +1 -0
- package/ts/{node → src/node}/node-sys-abstraction.js +0 -43
- package/ts/src/node/node-sys-abstraction.js.map +1 -0
- package/ts/src/node/node-sys-abstraction.test.d.ts.map +1 -0
- package/ts/src/node/node-sys-abstraction.test.js.map +1 -0
- package/ts/src/option.d.ts.map +1 -0
- package/ts/src/option.js.map +1 -0
- package/ts/{resolve-once.d.ts → src/resolve-once.d.ts} +1 -1
- package/ts/src/resolve-once.d.ts.map +1 -0
- package/ts/{resolve-once.js → src/resolve-once.js} +5 -4
- package/ts/src/resolve-once.js.map +1 -0
- package/ts/src/resolve-once.test.d.ts.map +1 -0
- package/ts/{resolve-once.test.js → src/resolve-once.test.js} +20 -24
- package/ts/src/resolve-once.test.js.map +1 -0
- package/ts/src/result.d.ts.map +1 -0
- package/ts/src/result.js.map +1 -0
- package/ts/{result.test.d.ts.map → src/result.test.d.ts.map} +1 -1
- package/ts/{result.test.js → src/result.test.js} +2 -4
- package/ts/src/result.test.js.map +1 -0
- package/ts/src/runtime.d.ts.map +1 -0
- package/ts/src/runtime.js.map +1 -0
- package/ts/src/sys-abstraction.d.ts.map +1 -0
- package/ts/src/sys-abstraction.js.map +1 -0
- package/ts/{sys-env.d.ts → src/sys-env.d.ts} +7 -0
- package/ts/src/sys-env.d.ts.map +1 -0
- package/ts/{sys-env.js → src/sys-env.js} +57 -4
- package/ts/src/sys-env.js.map +1 -0
- package/ts/{sys-env.test.d.ts.map → src/sys-env.test.d.ts.map} +1 -1
- package/ts/{sys-env.test.js → src/sys-env.test.js} +70 -2
- package/ts/src/sys-env.test.js.map +1 -0
- package/ts/src/test/index.d.ts.map +1 -0
- package/ts/src/test/index.js.map +1 -0
- package/ts/src/test/log-write-stream.d.ts.map +1 -0
- package/ts/src/test/log-write-stream.js.map +1 -0
- package/ts/src/test/mock-logger.d.ts.map +1 -0
- package/ts/src/test/mock-logger.js.map +1 -0
- package/ts/src/test/mock-logger.test.d.ts.map +1 -0
- package/ts/src/test/mock-logger.test.js.map +1 -0
- package/ts/src/test/test-exit-handler.d.ts.map +1 -0
- package/ts/{test → src/test}/test-exit-handler.js +8 -3
- package/ts/src/test/test-exit-handler.js.map +1 -0
- package/ts/src/time.d.ts.map +1 -0
- package/ts/src/time.js.map +1 -0
- package/ts/src/tracer.d.ts.map +1 -0
- package/ts/src/tracer.js.map +1 -0
- package/ts/{tracer.test.d.ts.map → src/tracer.test.d.ts.map} +1 -1
- package/ts/{tracer.test.js → src/tracer.test.js} +5 -5
- package/ts/src/tracer.test.js.map +1 -0
- package/ts/src/txt-en-decoder.d.ts.map +1 -0
- package/ts/src/txt-en-decoder.js.map +1 -0
- package/ts/{uri.d.ts → src/uri.d.ts} +2 -13
- package/ts/src/uri.d.ts.map +1 -0
- package/ts/{uri.js → src/uri.js} +2 -56
- package/ts/src/uri.js.map +1 -0
- package/ts/{uri.test.d.ts.map → src/uri.test.d.ts.map} +1 -1
- package/ts/{uri.test.js → src/uri.test.js} +7 -7
- package/ts/src/uri.test.js.map +1 -0
- package/ts/{utils → src/utils}/console-write-stream.d.ts +1 -1
- package/ts/src/utils/console-write-stream.d.ts.map +1 -0
- package/ts/{utils → src/utils}/console-write-stream.js +4 -3
- package/ts/src/utils/console-write-stream.js.map +1 -0
- package/ts/{utils → src/utils}/fanout-write-stream.d.ts +1 -1
- package/ts/src/utils/fanout-write-stream.d.ts.map +1 -0
- package/ts/src/utils/fanout-write-stream.js.map +1 -0
- package/ts/src/utils/get-params-result.d.ts +19 -0
- package/ts/src/utils/get-params-result.d.ts.map +1 -0
- package/ts/src/utils/get-params-result.js +58 -0
- package/ts/src/utils/get-params-result.js.map +1 -0
- package/ts/{utils → src/utils}/index.d.ts +1 -0
- package/ts/src/utils/index.d.ts.map +1 -0
- package/ts/{utils → src/utils}/index.js +1 -0
- package/ts/src/utils/index.js.map +1 -0
- package/ts/src/utils/rebuffer.d.ts.map +1 -0
- package/ts/{utils → src/utils}/rebuffer.js +7 -1
- package/ts/src/utils/rebuffer.js.map +1 -0
- package/ts/src/utils/rebuffer.test.d.ts.map +1 -0
- package/ts/src/utils/rebuffer.test.js.map +1 -0
- package/ts/src/utils/relative-path.d.ts.map +1 -0
- package/ts/src/utils/relative-path.js.map +1 -0
- package/ts/src/utils/relative-path.test.d.ts.map +1 -0
- package/ts/src/utils/relative-path.test.js.map +1 -0
- package/ts/src/utils/stream-map.d.ts.map +1 -0
- package/ts/src/utils/stream-map.js.map +1 -0
- package/ts/src/utils/stream-map.test.d.ts.map +1 -0
- package/ts/src/utils/stream-map.test.js.map +1 -0
- package/ts/src/utils/stream-test-helper.d.ts.map +1 -0
- package/ts/{utils → src/utils}/stream-test-helper.js +18 -10
- package/ts/src/utils/stream-test-helper.js.map +1 -0
- package/ts/src/utils/stream2string.d.ts.map +1 -0
- package/ts/src/utils/stream2string.js.map +1 -0
- package/ts/src/utils/stream2string.test.d.ts.map +1 -0
- package/ts/src/utils/stream2string.test.js.map +1 -0
- package/ts/src/utils/string2stream.d.ts.map +1 -0
- package/ts/src/utils/string2stream.js.map +1 -0
- package/ts/src/utils/string2stream.test.d.ts.map +1 -0
- package/ts/src/utils/string2stream.test.js.map +1 -0
- package/ts/src/utils/stripper.d.ts +3 -0
- package/ts/src/utils/stripper.d.ts.map +1 -0
- package/ts/src/utils/stripper.js.map +1 -0
- package/ts/src/utils/stripper.test.d.ts.map +1 -0
- package/ts/src/utils/stripper.test.js.map +1 -0
- package/ts/src/version.d.ts.map +1 -0
- package/ts/src/version.js.map +1 -0
- package/ts/src/web/index.d.ts.map +1 -0
- package/ts/src/web/index.js.map +1 -0
- package/ts/src/web/web-env-actions.d.ts +14 -0
- package/ts/src/web/web-env-actions.d.ts.map +1 -0
- package/ts/src/web/web-env-actions.js +35 -0
- package/ts/src/web/web-env-actions.js.map +1 -0
- package/ts/{web → src/web}/web-sys-abstraction.d.ts +1 -14
- package/ts/src/web/web-sys-abstraction.d.ts.map +1 -0
- package/ts/{web → src/web}/web-sys-abstraction.js +0 -34
- package/ts/src/web/web-sys-abstraction.js.map +1 -0
- package/ts/vitest.browser.config.d.ts +3 -0
- package/ts/vitest.browser.config.d.ts.map +1 -0
- package/ts/vitest.browser.config.js +17 -0
- package/ts/vitest.browser.config.js.map +1 -0
- package/ts/vitest.cf-runtime.config.d.ts +3 -0
- package/ts/vitest.cf-runtime.config.d.ts.map +1 -0
- package/ts/vitest.cf-runtime.config.js +16 -0
- package/ts/vitest.cf-runtime.config.js.map +1 -0
- package/ts/vitest.config.d.ts +3 -0
- package/ts/vitest.config.d.ts.map +1 -0
- package/ts/vitest.config.js +8 -0
- package/ts/vitest.config.js.map +1 -0
- package/ts/vitest.node.config.d.ts +3 -0
- package/ts/vitest.node.config.d.ts.map +1 -0
- package/ts/vitest.node.config.js +11 -0
- package/ts/vitest.node.config.js.map +1 -0
- package/ts/vitest.workspace.d.ts +3 -0
- package/ts/vitest.workspace.d.ts.map +1 -0
- package/ts/vitest.workspace.js +6 -0
- package/ts/vitest.workspace.js.map +1 -0
- package/utils/index.cjs +150 -3
- package/utils/index.cjs.map +1 -1
- package/utils/index.d.cts +2 -2
- package/utils/index.d.ts +2 -2
- package/utils/index.js +8 -3
- package/web/index.cjs +251 -239
- package/web/index.cjs.map +1 -1
- package/web/index.d.cts +5 -17
- package/web/index.d.ts +5 -17
- package/web/index.js +3 -4
- package/chunk-A7OPSHUV.js.map +0 -1
- package/chunk-HFP74WLI.js.map +0 -1
- package/chunk-P6LDM7PY.js.map +0 -1
- package/chunk-PPS4L4VW.js +0 -38
- package/chunk-PPS4L4VW.js.map +0 -1
- package/chunk-PRCFKZR7.js.map +0 -1
- package/ts/base-sys-abstraction.d.ts.map +0 -1
- package/ts/base-sys-abstraction.js.map +0 -1
- package/ts/base-sys-abstraction.test.d.ts.map +0 -1
- package/ts/base-sys-abstraction.test.js.map +0 -1
- package/ts/bin2text.d.ts.map +0 -1
- package/ts/bin2text.js.map +0 -1
- package/ts/bin2text.test.js.map +0 -1
- package/ts/cf/cf-sys-abstraction.d.ts +0 -25
- package/ts/cf/cf-sys-abstraction.d.ts.map +0 -1
- package/ts/cf/cf-sys-abstraction.js.map +0 -1
- package/ts/cf/index.d.ts.map +0 -1
- package/ts/cf/index.js.map +0 -1
- package/ts/crypto.d.ts.map +0 -1
- package/ts/crypto.js.map +0 -1
- package/ts/crypto.test.js.map +0 -1
- package/ts/deno/deno-file-service.d.ts.map +0 -1
- package/ts/deno/deno-file-service.js.map +0 -1
- package/ts/deno/deno-sys-abstraction.d.ts.map +0 -1
- package/ts/deno/deno-sys-abstraction.js.map +0 -1
- package/ts/deno/index.d.ts.map +0 -1
- package/ts/deno/index.js.map +0 -1
- package/ts/file-service.d.ts.map +0 -1
- package/ts/future.d.ts.map +0 -1
- package/ts/future.js.map +0 -1
- package/ts/future.test.js.map +0 -1
- package/ts/http_header.d.ts.map +0 -1
- package/ts/http_header.js.map +0 -1
- package/ts/http_header.test.d.ts.map +0 -1
- package/ts/http_header.test.js.map +0 -1
- package/ts/index.d.ts.map +0 -1
- package/ts/index.js.map +0 -1
- package/ts/log-level-impl.d.ts.map +0 -1
- package/ts/log-level-impl.js.map +0 -1
- package/ts/log-writer-impl.d.ts.map +0 -1
- package/ts/log-writer-impl.js.map +0 -1
- package/ts/logger-impl.d.ts.map +0 -1
- package/ts/logger-impl.js.map +0 -1
- package/ts/logger.d.ts.map +0 -1
- package/ts/logger.js.map +0 -1
- package/ts/logger.test.js.map +0 -1
- package/ts/node/index.d.ts.map +0 -1
- package/ts/node/index.js.map +0 -1
- package/ts/node/mock-file-service.d.ts.map +0 -1
- package/ts/node/mock-file-service.js.map +0 -1
- package/ts/node/mock-file-service.test.d.ts.map +0 -1
- package/ts/node/mock-file-service.test.js.map +0 -1
- package/ts/node/node-file-service.d.ts.map +0 -1
- package/ts/node/node-file-service.js.map +0 -1
- package/ts/node/node-sys-abstraction.d.ts.map +0 -1
- package/ts/node/node-sys-abstraction.js.map +0 -1
- package/ts/node/node-sys-abstraction.test.d.ts.map +0 -1
- package/ts/node/node-sys-abstraction.test.js.map +0 -1
- package/ts/option.d.ts.map +0 -1
- package/ts/option.js.map +0 -1
- package/ts/resolve-once.d.ts.map +0 -1
- package/ts/resolve-once.js.map +0 -1
- package/ts/resolve-once.test.d.ts.map +0 -1
- package/ts/resolve-once.test.js.map +0 -1
- package/ts/result.d.ts.map +0 -1
- package/ts/result.js.map +0 -1
- package/ts/result.test.js.map +0 -1
- package/ts/runtime.d.ts.map +0 -1
- package/ts/runtime.js.map +0 -1
- package/ts/sys-abstraction.d.ts.map +0 -1
- package/ts/sys-abstraction.js.map +0 -1
- package/ts/sys-env.d.ts.map +0 -1
- package/ts/sys-env.js.map +0 -1
- package/ts/sys-env.test.js.map +0 -1
- package/ts/test/index.d.ts.map +0 -1
- package/ts/test/index.js.map +0 -1
- package/ts/test/log-write-stream.d.ts.map +0 -1
- package/ts/test/log-write-stream.js.map +0 -1
- package/ts/test/mock-logger.d.ts.map +0 -1
- package/ts/test/mock-logger.js.map +0 -1
- package/ts/test/mock-logger.test.d.ts.map +0 -1
- package/ts/test/mock-logger.test.js.map +0 -1
- package/ts/test/test-exit-handler.d.ts.map +0 -1
- package/ts/test/test-exit-handler.js.map +0 -1
- package/ts/time.d.ts.map +0 -1
- package/ts/time.js.map +0 -1
- package/ts/tracer.d.ts.map +0 -1
- package/ts/tracer.js.map +0 -1
- package/ts/tracer.test.js.map +0 -1
- package/ts/txt-en-decoder.d.ts.map +0 -1
- package/ts/txt-en-decoder.js.map +0 -1
- package/ts/uri.d.ts.map +0 -1
- package/ts/uri.js.map +0 -1
- package/ts/uri.test.js.map +0 -1
- package/ts/utils/console-write-stream.d.ts.map +0 -1
- package/ts/utils/console-write-stream.js.map +0 -1
- package/ts/utils/fanout-write-stream.d.ts.map +0 -1
- package/ts/utils/fanout-write-stream.js.map +0 -1
- package/ts/utils/index.d.ts.map +0 -1
- package/ts/utils/index.js.map +0 -1
- package/ts/utils/rebuffer.d.ts.map +0 -1
- package/ts/utils/rebuffer.js.map +0 -1
- package/ts/utils/rebuffer.test.d.ts.map +0 -1
- package/ts/utils/rebuffer.test.js.map +0 -1
- package/ts/utils/relative-path.d.ts.map +0 -1
- package/ts/utils/relative-path.js.map +0 -1
- package/ts/utils/relative-path.test.d.ts.map +0 -1
- package/ts/utils/relative-path.test.js.map +0 -1
- package/ts/utils/stream-map.d.ts.map +0 -1
- package/ts/utils/stream-map.js.map +0 -1
- package/ts/utils/stream-map.test.d.ts.map +0 -1
- package/ts/utils/stream-map.test.js.map +0 -1
- package/ts/utils/stream-test-helper.d.ts.map +0 -1
- package/ts/utils/stream-test-helper.js.map +0 -1
- package/ts/utils/stream2string.d.ts.map +0 -1
- package/ts/utils/stream2string.js.map +0 -1
- package/ts/utils/stream2string.test.d.ts.map +0 -1
- package/ts/utils/stream2string.test.js.map +0 -1
- package/ts/utils/string2stream.d.ts.map +0 -1
- package/ts/utils/string2stream.js.map +0 -1
- package/ts/utils/string2stream.test.d.ts.map +0 -1
- package/ts/utils/string2stream.test.js.map +0 -1
- package/ts/utils/stripper.d.ts +0 -3
- package/ts/utils/stripper.d.ts.map +0 -1
- package/ts/utils/stripper.js.map +0 -1
- package/ts/utils/stripper.test.d.ts.map +0 -1
- package/ts/utils/stripper.test.js.map +0 -1
- package/ts/version.d.ts.map +0 -1
- package/ts/version.js.map +0 -1
- package/ts/web/index.d.ts.map +0 -1
- package/ts/web/index.js.map +0 -1
- package/ts/web/web-sys-abstraction.d.ts.map +0 -1
- package/ts/web/web-sys-abstraction.js.map +0 -1
- package/txt-en-decoder-CZYJUju2.d.cts +0 -11
- package/txt-en-decoder-CZYJUju2.d.ts +0 -11
- /package/ts/{base-sys-abstraction.test.d.ts → src/base-sys-abstraction.test.d.ts} +0 -0
- /package/ts/{base-sys-abstraction.test.js → src/base-sys-abstraction.test.js} +0 -0
- /package/ts/{bin2text.d.ts → src/bin2text.d.ts} +0 -0
- /package/ts/{bin2text.js → src/bin2text.js} +0 -0
- /package/ts/{bin2text.test.d.ts → src/bin2text.test.d.ts} +0 -0
- /package/ts/{bin2text.test.js → src/bin2text.test.js} +0 -0
- /package/ts/{cf → src/cf}/index.d.ts +0 -0
- /package/ts/{cf → src/cf}/index.js +0 -0
- /package/ts/{crypto.d.ts → src/crypto.d.ts} +0 -0
- /package/ts/{crypto.js → src/crypto.js} +0 -0
- /package/ts/{crypto.test.d.ts → src/crypto.test.d.ts} +0 -0
- /package/ts/{deno → src/deno}/deno-file-service.d.ts +0 -0
- /package/ts/{deno → src/deno}/deno-file-service.js +0 -0
- /package/ts/{deno → src/deno}/index.d.ts +0 -0
- /package/ts/{deno → src/deno}/index.js +0 -0
- /package/ts/{file-service.d.ts → src/file-service.d.ts} +0 -0
- /package/ts/{file-service.js → src/file-service.js} +0 -0
- /package/ts/{future.d.ts → src/future.d.ts} +0 -0
- /package/ts/{future.js → src/future.js} +0 -0
- /package/ts/{future.test.d.ts → src/future.test.d.ts} +0 -0
- /package/ts/{future.test.js → src/future.test.js} +0 -0
- /package/ts/{http_header.d.ts → src/http_header.d.ts} +0 -0
- /package/ts/{http_header.js → src/http_header.js} +0 -0
- /package/ts/{http_header.test.d.ts → src/http_header.test.d.ts} +0 -0
- /package/ts/{http_header.test.js → src/http_header.test.js} +0 -0
- /package/ts/{log-level-impl.d.ts → src/log-level-impl.d.ts} +0 -0
- /package/ts/{log-level-impl.js → src/log-level-impl.js} +0 -0
- /package/ts/{log-writer-impl.d.ts → src/log-writer-impl.d.ts} +0 -0
- /package/ts/{logger.js → src/logger.js} +0 -0
- /package/ts/{logger.test.d.ts → src/logger.test.d.ts} +0 -0
- /package/ts/{node → src/node}/index.d.ts +0 -0
- /package/ts/{node → src/node}/index.js +0 -0
- /package/ts/{node → src/node}/mock-file-service.d.ts +0 -0
- /package/ts/{node → src/node}/mock-file-service.test.d.ts +0 -0
- /package/ts/{node → src/node}/mock-file-service.test.js +0 -0
- /package/ts/{node → src/node}/node-file-service.d.ts +0 -0
- /package/ts/{node → src/node}/node-file-service.js +0 -0
- /package/ts/{node → src/node}/node-sys-abstraction.test.d.ts +0 -0
- /package/ts/{node → src/node}/node-sys-abstraction.test.js +0 -0
- /package/ts/{option.d.ts → src/option.d.ts} +0 -0
- /package/ts/{option.js → src/option.js} +0 -0
- /package/ts/{resolve-once.test.d.ts → src/resolve-once.test.d.ts} +0 -0
- /package/ts/{result.d.ts → src/result.d.ts} +0 -0
- /package/ts/{result.js → src/result.js} +0 -0
- /package/ts/{result.test.d.ts → src/result.test.d.ts} +0 -0
- /package/ts/{runtime.d.ts → src/runtime.d.ts} +0 -0
- /package/ts/{runtime.js → src/runtime.js} +0 -0
- /package/ts/{sys-abstraction.d.ts → src/sys-abstraction.d.ts} +0 -0
- /package/ts/{sys-abstraction.js → src/sys-abstraction.js} +0 -0
- /package/ts/{sys-env.test.d.ts → src/sys-env.test.d.ts} +0 -0
- /package/ts/{test → src/test}/index.d.ts +0 -0
- /package/ts/{test → src/test}/index.js +0 -0
- /package/ts/{test → src/test}/log-write-stream.d.ts +0 -0
- /package/ts/{test → src/test}/log-write-stream.js +0 -0
- /package/ts/{test → src/test}/mock-logger.d.ts +0 -0
- /package/ts/{test → src/test}/mock-logger.js +0 -0
- /package/ts/{test → src/test}/mock-logger.test.d.ts +0 -0
- /package/ts/{test → src/test}/mock-logger.test.js +0 -0
- /package/ts/{test → src/test}/test-exit-handler.d.ts +0 -0
- /package/ts/{time.d.ts → src/time.d.ts} +0 -0
- /package/ts/{time.js → src/time.js} +0 -0
- /package/ts/{tracer.d.ts → src/tracer.d.ts} +0 -0
- /package/ts/{tracer.js → src/tracer.js} +0 -0
- /package/ts/{tracer.test.d.ts → src/tracer.test.d.ts} +0 -0
- /package/ts/{txt-en-decoder.d.ts → src/txt-en-decoder.d.ts} +0 -0
- /package/ts/{txt-en-decoder.js → src/txt-en-decoder.js} +0 -0
- /package/ts/{uri.test.d.ts → src/uri.test.d.ts} +0 -0
- /package/ts/{utils → src/utils}/fanout-write-stream.js +0 -0
- /package/ts/{utils → src/utils}/rebuffer.d.ts +0 -0
- /package/ts/{utils → src/utils}/rebuffer.test.d.ts +0 -0
- /package/ts/{utils → src/utils}/rebuffer.test.js +0 -0
- /package/ts/{utils → src/utils}/relative-path.d.ts +0 -0
- /package/ts/{utils → src/utils}/relative-path.js +0 -0
- /package/ts/{utils → src/utils}/relative-path.test.d.ts +0 -0
- /package/ts/{utils → src/utils}/relative-path.test.js +0 -0
- /package/ts/{utils → src/utils}/stream-map.d.ts +0 -0
- /package/ts/{utils → src/utils}/stream-map.js +0 -0
- /package/ts/{utils → src/utils}/stream-map.test.d.ts +0 -0
- /package/ts/{utils → src/utils}/stream-map.test.js +0 -0
- /package/ts/{utils → src/utils}/stream-test-helper.d.ts +0 -0
- /package/ts/{utils → src/utils}/stream2string.d.ts +0 -0
- /package/ts/{utils → src/utils}/stream2string.js +0 -0
- /package/ts/{utils → src/utils}/stream2string.test.d.ts +0 -0
- /package/ts/{utils → src/utils}/stream2string.test.js +0 -0
- /package/ts/{utils → src/utils}/string2stream.d.ts +0 -0
- /package/ts/{utils → src/utils}/string2stream.js +0 -0
- /package/ts/{utils → src/utils}/string2stream.test.d.ts +0 -0
- /package/ts/{utils → src/utils}/string2stream.test.js +0 -0
- /package/ts/{utils → src/utils}/stripper.js +0 -0
- /package/ts/{utils → src/utils}/stripper.test.d.ts +0 -0
- /package/ts/{utils → src/utils}/stripper.test.js +0 -0
- /package/ts/{version.d.ts → src/version.d.ts} +0 -0
- /package/ts/{version.js → src/version.js} +0 -0
- /package/ts/{web → src/web}/index.d.ts +0 -0
- /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
|
-
|
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-
|
2
|
-
import { NodeEnvActions } from "./node/node-
|
3
|
-
import { BrowserEnvActions } from "./web/web-
|
4
|
-
import { CFEnvActions } from "./cf/cf-
|
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
|
-
|
42
|
-
this.value = 0 as any;
|
41
|
+
this.value = 0 as T;
|
43
42
|
}
|
44
|
-
|
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
|
-
|
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
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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
|
+
}
|
package/src/utils/index.ts
CHANGED
package/src/utils/rebuffer.ts
CHANGED
@@ -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
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
-
|
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
|
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);
|
package/src/utils/stripper.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export type StripCommand = string | RegExp;
|
2
2
|
|
3
|
-
export function stripper<T extends
|
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]
|
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,
|
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
|
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
|
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
|
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 };
|