@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/node/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/node/mock-file-service.ts"],"sourcesContent":["import { NamedWritableStream } from \"../file-service.js\";\nimport { NodeFileService } from \"./node-file-service.js\";\n\nexport interface FileCollector {\n readonly name: string;\n content: string;\n}\n\nexport class MockFileService extends NodeFileService {\n readonly files = {} as Record<string, FileCollector>;\n\n // override abs(fname: string): string {\n // return this.join(\"/mock/\", fname);\n // }\n\n override async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!this.isAbsolute(fname)) {\n oName = await this.abs(fname);\n }\n\n const fc = {\n name: oName,\n content: \"\",\n };\n this.files[oName] = fc;\n this.files[fname] = fc;\n const decoder = new TextDecoder();\n\n return {\n name: oName,\n stream: new WritableStream<Uint8Array>({\n write(chunk): void {\n fc.content = fc.content + decoder.decode(chunk);\n },\n close(): void {\n // do nothing\n },\n abort(): void {\n throw new Error(\"not implemented\");\n },\n }),\n };\n }\n}\n"],"mappings":";;;;;;;;;;AAQO,IAAM,kBAAN,cAA8B,gBAAgB;AAAA,EAA9C;AAAA;AACL,SAAS,QAAQ,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlB,MAAe,OAAO,OAA6C;AACjE,QAAI,QAAQ;AACZ,QAAI,CAAC,KAAK,WAAW,KAAK,GAAG;AAC3B,cAAQ,MAAM,KAAK,IAAI,KAAK;AAAA,IAC9B;AAEA,UAAM,KAAK;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AACA,SAAK,MAAM,KAAK,IAAI;AACpB,SAAK,MAAM,KAAK,IAAI;AACpB,UAAM,UAAU,IAAI,YAAY;AAEhC,WAAO;AAAA,MACL,MAAM;AAAA,MACN,QAAQ,IAAI,eAA2B;AAAA,QACrC,MAAM,OAAa;AACjB,aAAG,UAAU,GAAG,UAAU,QAAQ,OAAO,KAAK;AAAA,QAChD;AAAA,QACA,QAAc;AAAA,QAEd;AAAA,QACA,QAAc;AACZ,gBAAM,IAAI,MAAM,iBAAiB;AAAA,QACnC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
|
1
|
+
{"version":3,"sources":["../../../src/node/node-file-service.ts","../../../src/node/node-sys-abstraction.ts","../../../src/node/mock-file-service.ts"],"sourcesContent":["import path from \"node:path\";\nimport fs from \"node:fs\";\nimport process from \"node:process\";\nimport { FileService, NamedWritableStream } from \"../file-service.js\";\nimport { TxtEnDecoder, Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\n\nexport class NodeFileService implements FileService {\n readonly baseDir: string;\n constructor(baseDir: string = process.cwd()) {\n this.baseDir = this.abs(baseDir);\n }\n\n // nodeImport(fname: string): string {\n // // console.log('nodeImport:'+ fname);\n // if (path.isAbsolute(fname)) {\n // return fname;\n // } else {\n // return \"./\" + path.normalize(fname);\n // }\n // }\n\n readFileString(fname: string): Promise<string> {\n return fs.promises.readFile(fname, { encoding: \"utf-8\" });\n }\n\n dirname(fname: string): string {\n return path.dirname(fname);\n }\n basename(fname: string): string {\n return path.basename(fname);\n }\n\n join(...paths: string[]): string {\n return path.join(...paths);\n }\n\n relative(from: string, to?: string): string {\n if (to === undefined) {\n to = from;\n from = process.cwd();\n }\n const ret = path.relative(from, to);\n // console.log('relative:'+ from + \" -> \" + to + \"= \" + ret);\n return ret;\n }\n\n abs(fname: string): string {\n if (path.isAbsolute(fname)) {\n return fname;\n } else {\n const cwd = process.cwd();\n return path.resolve(cwd, fname);\n }\n }\n\n isAbsolute(fname: string): boolean {\n return path.isAbsolute(fname);\n }\n\n async writeFileString(fname: string, content: string, ende: TxtEnDecoder = Utf8EnDecoderSingleton()): Promise<void> {\n const o = await this.create(fname);\n const wr = o.stream.getWriter();\n await wr.write(ende.encode(content));\n await wr.close();\n }\n\n async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!path.isAbsolute(fname)) {\n oName = this.abs(fname);\n }\n\n const base = path.dirname(oName);\n await fs.promises.mkdir(base, { recursive: true });\n const out = fs.createWriteStream(oName);\n return {\n name: oName,\n stream: new WritableStream<Uint8Array>({\n write(chunk): void {\n out.write(chunk);\n },\n close(): void {\n out.close();\n },\n abort(): void {\n throw new Error(\"not implemented\");\n },\n }),\n };\n }\n}\n","import { SysAbstraction, SystemService, VoidFunc } from \"../sys-abstraction.js\";\nimport {\n BaseSysAbstraction,\n ExitHandler,\n ExitService,\n WrapperSysAbstraction,\n WrapperSysAbstractionParams,\n} from \"../base-sys-abstraction.js\";\nimport { NodeFileService } from \"./node-file-service.js\";\nimport { Env, envFactory } from \"../sys-env.js\";\nimport { Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\nimport process from \"node:process\";\n\nexport class NodeExitServiceImpl implements ExitService {\n constructor() {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n process.on(\"unhandledRejection\", (reason: string, p: Promise<unknown>) => {\n this.exit(19);\n });\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n process.on(\"uncaughtException\", (error: Error) => {\n this.exit(18);\n });\n process.on(\"close\", () => {\n this.exit(0);\n });\n process.on(\"exit\", () => {\n this.exit(0);\n });\n process.on(\"SIGQUIT\", () => {\n this.exit(3);\n });\n process.on(\"SIGINT\", () => {\n this.exit(2);\n });\n process.on(\"SIGTERM\", () => {\n this.exit(9);\n });\n }\n _exitHandlers: ExitHandler[] = [];\n injectExitHandlers(hdls: ExitHandler[]): void {\n // console.log(\"ExitService: injecting exit handlers\", hdls)\n this._exitHandlers = hdls;\n }\n invoked = false;\n readonly _handleExit = async (): Promise<void> => {\n if (this.invoked) {\n // console.error(\"ExitService: already invoked\");\n return;\n }\n this.invoked = true;\n for (const h of this._exitHandlers) {\n try {\n // console.log(`ExitService: calling handler ${h.id}`)\n const ret = h.hdl();\n // console.log(`ExitService: called handler ${h.id}`, ret)\n if (typeof (ret as Promise<void>).then === \"function\") {\n await ret;\n }\n } finally {\n // ignore\n }\n }\n };\n\n exit(code: number): void {\n // console.log(\"ExitService: exit called\", code)\n this._handleExit()\n .then(() => {\n process.exit(code);\n })\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(\"ExitService: failed to handle exit\", err);\n process.exit(code);\n });\n }\n}\n\nexport class NodeSystemService implements SystemService {\n static readonly _exitHandlers: ExitHandler[] = [];\n readonly _exitService: ExitService = new NodeExitServiceImpl();\n constructor() {\n this._exitService.injectExitHandlers(NodeSystemService._exitHandlers);\n }\n\n Env(): Env {\n return envFactory();\n }\n\n Args(): string[] {\n return process.argv;\n }\n\n OnExit(hdl: VoidFunc): VoidFunc {\n const id = crypto.randomUUID();\n NodeSystemService._exitHandlers.push({ hdl, id });\n return () => {\n const idx = NodeSystemService._exitHandlers.findIndex((h) => h.id === id);\n if (idx >= 0) {\n NodeSystemService._exitHandlers.splice(idx, 1);\n }\n };\n }\n\n Exit(code: number): void {\n this._exitService.exit(code);\n }\n}\n\nlet my: BaseSysAbstraction | undefined = undefined;\nexport function NodeSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {\n if (!my) {\n my = new BaseSysAbstraction({\n TxtEnDecoder: param?.TxtEnDecoder || Utf8EnDecoderSingleton(),\n FileSystem: new NodeFileService(),\n SystemService: new NodeSystemService(),\n });\n }\n return new WrapperSysAbstraction(my, param);\n}\n","import { NamedWritableStream } from \"../file-service.js\";\nimport { NodeFileService } from \"./node-file-service.js\";\n\nexport interface FileCollector {\n readonly name: string;\n content: string;\n}\n\nexport class MockFileService extends NodeFileService {\n readonly files = {} as Record<string, FileCollector>;\n\n // override abs(fname: string): string {\n // return this.join(\"/mock/\", fname);\n // }\n\n override create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!this.isAbsolute(fname)) {\n oName = this.abs(fname);\n }\n\n const fc = {\n name: oName,\n content: \"\",\n };\n this.files[oName] = fc;\n this.files[fname] = fc;\n const decoder = new TextDecoder();\n\n return Promise.resolve({\n name: oName,\n stream: new WritableStream<Uint8Array>({\n write(chunk): void {\n fc.content = fc.content + decoder.decode(chunk);\n },\n close(): void {\n // do nothing\n },\n abort(): void {\n throw new Error(\"not implemented\");\n },\n }),\n });\n }\n}\n"],"mappings":"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","names":["process"]}
|
package/package.json
CHANGED
@@ -152,16 +152,16 @@ function consumeReadableStream(
|
|
152
152
|
});
|
153
153
|
}
|
154
154
|
|
155
|
-
function CFWriteableStream(writeFn: (chunk: Uint8Array) => Promise<void>): WritableStream {
|
156
|
-
const ts = new TransformStream();
|
155
|
+
function CFWriteableStream(writeFn: (chunk: Uint8Array) => Promise<void>): WritableStream<Uint8Array> {
|
156
|
+
const ts = new TransformStream<Uint8Array, Uint8Array>();
|
157
157
|
consumeReadableStream(ts.readable.getReader(), writeFn);
|
158
158
|
return ts.writable;
|
159
159
|
}
|
160
160
|
|
161
161
|
export class BaseSysAbstraction {
|
162
162
|
readonly _time: SysTime = new SysTime();
|
163
|
-
readonly _stdout: WritableStream
|
164
|
-
readonly _stderr: WritableStream
|
163
|
+
readonly _stdout: WritableStream<Uint8Array>;
|
164
|
+
readonly _stderr: WritableStream<Uint8Array>;
|
165
165
|
|
166
166
|
readonly _idService: IdService = new IdService();
|
167
167
|
readonly _randomService: RandomService = new RandomService(RandomMode.RANDOM);
|
@@ -174,15 +174,17 @@ export class BaseSysAbstraction {
|
|
174
174
|
this._systemService = params.SystemService;
|
175
175
|
this._txtEnDe = params.TxtEnDecoder;
|
176
176
|
const decoder = this._txtEnDe;
|
177
|
-
this._stdout = CFWriteableStream(
|
177
|
+
this._stdout = CFWriteableStream((chunk) => {
|
178
178
|
const decoded = decoder.decode(chunk);
|
179
179
|
// eslint-disable-next-line no-console
|
180
180
|
console.log(decoded.trimEnd());
|
181
|
+
return Promise.resolve();
|
181
182
|
});
|
182
|
-
this._stderr = CFWriteableStream(
|
183
|
+
this._stderr = CFWriteableStream((chunk) => {
|
183
184
|
const decoded = decoder.decode(chunk);
|
184
185
|
// eslint-disable-next-line no-console
|
185
186
|
console.error(decoded.trimEnd());
|
187
|
+
return Promise.resolve();
|
186
188
|
});
|
187
189
|
/* this is not CF worker compatible
|
188
190
|
this._stdout = new WritableStream({
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { ResolveOnce } from "../resolve-once.js";
|
2
|
+
import { runtimeFn } from "../runtime.js";
|
3
|
+
import { EnvActions, EnvImpl, EnvFactoryOpts, Env } from "../sys-env.js";
|
4
|
+
|
5
|
+
const once = new ResolveOnce<CFEnvActions>();
|
6
|
+
export class CFEnvActions implements EnvActions {
|
7
|
+
readonly injectOnRegister: Record<string, string> = {};
|
8
|
+
readonly cfEnv: Map<string, string>;
|
9
|
+
env?: EnvImpl;
|
10
|
+
static new(opts: Partial<EnvFactoryOpts>): EnvActions {
|
11
|
+
return once.once(() => new CFEnvActions(opts));
|
12
|
+
}
|
13
|
+
static inject(o: Record<string, string>): void {
|
14
|
+
const env = CFEnvActions.new({}) as CFEnvActions;
|
15
|
+
for (const key in o) {
|
16
|
+
const value = o[key];
|
17
|
+
if (typeof value === "string") {
|
18
|
+
if (env.env) {
|
19
|
+
env.env.set(key, value);
|
20
|
+
} else {
|
21
|
+
env.injectOnRegister[key] = value;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
private constructor(env: Partial<EnvFactoryOpts>) {
|
27
|
+
this.cfEnv = new Map<string, string>(Object.entries(env.presetEnv || {}));
|
28
|
+
}
|
29
|
+
active(): boolean {
|
30
|
+
return runtimeFn().isCFWorker;
|
31
|
+
}
|
32
|
+
register(env: Env): Env {
|
33
|
+
this.env = env as EnvImpl;
|
34
|
+
for (const key in this.injectOnRegister) {
|
35
|
+
env.set(key, this.injectOnRegister[key]);
|
36
|
+
}
|
37
|
+
return env;
|
38
|
+
}
|
39
|
+
get(key: string): string | undefined {
|
40
|
+
return this.cfEnv.get(key);
|
41
|
+
}
|
42
|
+
set(key: string, value?: string): void {
|
43
|
+
if (value) {
|
44
|
+
this.cfEnv.set(key, value);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
delete(key: string): void {
|
48
|
+
this.cfEnv.delete(key);
|
49
|
+
}
|
50
|
+
keys(): string[] {
|
51
|
+
return Array.from(this.cfEnv.keys());
|
52
|
+
}
|
53
|
+
}
|
@@ -1,61 +1,9 @@
|
|
1
1
|
import { BaseSysAbstraction, WrapperSysAbstraction, WrapperSysAbstractionParams } from "../base-sys-abstraction.js";
|
2
|
-
import { ResolveOnce } from "../resolve-once.js";
|
3
|
-
import { runtimeFn } from "../runtime.js";
|
4
2
|
import { SysAbstraction, SystemService, VoidFunc } from "../sys-abstraction.js";
|
5
|
-
import { Env,
|
3
|
+
import { Env, envFactory } from "../sys-env.js";
|
6
4
|
import { Utf8EnDecoderSingleton } from "../txt-en-decoder.js";
|
7
5
|
import { WebFileService } from "../web/web-sys-abstraction.js";
|
8
6
|
|
9
|
-
const once = new ResolveOnce<CFEnvActions>();
|
10
|
-
export class CFEnvActions implements EnvActions {
|
11
|
-
readonly injectOnRegister: Record<string, string> = {};
|
12
|
-
readonly cfEnv: Map<string, string>;
|
13
|
-
env?: EnvImpl;
|
14
|
-
static new(opts: Partial<EnvFactoryOpts>): EnvActions {
|
15
|
-
return once.once(() => new CFEnvActions(opts));
|
16
|
-
}
|
17
|
-
static inject(o: Record<string, string>): void {
|
18
|
-
const env = CFEnvActions.new({}) as CFEnvActions;
|
19
|
-
for (const key in o) {
|
20
|
-
const value = o[key];
|
21
|
-
if (typeof value === "string") {
|
22
|
-
if (env.env) {
|
23
|
-
env.env.set(key, value);
|
24
|
-
} else {
|
25
|
-
env.injectOnRegister[key] = value;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
}
|
30
|
-
private constructor(env: Partial<EnvFactoryOpts>) {
|
31
|
-
this.cfEnv = new Map<string, string>(Object.entries(env.presetEnv || {}));
|
32
|
-
}
|
33
|
-
active(): boolean {
|
34
|
-
return runtimeFn().isCFWorker;
|
35
|
-
}
|
36
|
-
register(env: Env): Env {
|
37
|
-
this.env = env as EnvImpl;
|
38
|
-
for (const key in this.injectOnRegister) {
|
39
|
-
env.set(key, this.injectOnRegister[key]);
|
40
|
-
}
|
41
|
-
return env;
|
42
|
-
}
|
43
|
-
get(key: string): string | undefined {
|
44
|
-
return this.cfEnv.get(key);
|
45
|
-
}
|
46
|
-
set(key: string, value?: string): void {
|
47
|
-
if (value) {
|
48
|
-
this.cfEnv.set(key, value);
|
49
|
-
}
|
50
|
-
}
|
51
|
-
delete(key: string): void {
|
52
|
-
this.cfEnv.delete(key);
|
53
|
-
}
|
54
|
-
keys(): string[] {
|
55
|
-
return Array.from(this.cfEnv.keys());
|
56
|
-
}
|
57
|
-
}
|
58
|
-
|
59
7
|
export class CFSystemService implements SystemService {
|
60
8
|
Env(): Env {
|
61
9
|
return envFactory();
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import { ResolveOnce } from "../resolve-once.js";
|
2
|
+
import { runtimeFn } from "../runtime.js";
|
3
|
+
import { Env, EnvActions, EnvFactoryOpts } from "../sys-env.js";
|
4
|
+
|
5
|
+
interface DenoEnv {
|
6
|
+
get: (key: string) => string | undefined;
|
7
|
+
toObject: () => Record<string, string>;
|
8
|
+
set: (key: string, value: string) => void;
|
9
|
+
has: (key: string) => boolean;
|
10
|
+
delete: (key: string) => void;
|
11
|
+
}
|
12
|
+
|
13
|
+
const once = new ResolveOnce<DenoEnvActions>();
|
14
|
+
export class DenoEnvActions implements EnvActions {
|
15
|
+
readonly #deno = globalThis as unknown as {
|
16
|
+
Deno: {
|
17
|
+
env: DenoEnv;
|
18
|
+
};
|
19
|
+
};
|
20
|
+
|
21
|
+
static new(opts: Partial<EnvFactoryOpts>): EnvActions {
|
22
|
+
return once.once(() => new DenoEnvActions(opts));
|
23
|
+
}
|
24
|
+
|
25
|
+
get _env(): DenoEnv {
|
26
|
+
return this.#deno.Deno.env;
|
27
|
+
}
|
28
|
+
|
29
|
+
readonly opts: Partial<EnvFactoryOpts>;
|
30
|
+
private constructor(opts: Partial<EnvFactoryOpts>) {
|
31
|
+
this.opts = opts;
|
32
|
+
}
|
33
|
+
|
34
|
+
register(env: Env): Env {
|
35
|
+
for (const key of env.keys()) {
|
36
|
+
this._env.set(key, env.get(key) || "");
|
37
|
+
}
|
38
|
+
return env;
|
39
|
+
}
|
40
|
+
active(): boolean {
|
41
|
+
return runtimeFn().isDeno;
|
42
|
+
}
|
43
|
+
keys(): string[] {
|
44
|
+
return Object.keys(this._env.toObject());
|
45
|
+
}
|
46
|
+
get(key: string): string | undefined {
|
47
|
+
return this._env.get(key);
|
48
|
+
}
|
49
|
+
set(key: string, value?: string): void {
|
50
|
+
if (value) {
|
51
|
+
this._env.set(key, value);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
delete(key: string): void {
|
55
|
+
this._env.delete(key);
|
56
|
+
}
|
57
|
+
}
|
@@ -6,7 +6,7 @@ const Deno = (globalThis as unknown as { Deno: unknown }).Deno as {
|
|
6
6
|
cwd(): string;
|
7
7
|
readFile(fname: string): Promise<Uint8Array>;
|
8
8
|
mkdir(base: string, options: { recursive: boolean }): Promise<void>;
|
9
|
-
open(fname: string, options: { write: boolean; create: boolean; truncate: boolean }): Promise<WritableStream
|
9
|
+
open(fname: string, options: { write: boolean; create: boolean; truncate: boolean }): Promise<WritableStream<Uint8Array>>;
|
10
10
|
};
|
11
11
|
|
12
12
|
export class DenoFileService implements FileService {
|
@@ -5,10 +5,8 @@ import {
|
|
5
5
|
WrapperSysAbstractionParams,
|
6
6
|
WrapperSysAbstraction,
|
7
7
|
} from "../base-sys-abstraction.js";
|
8
|
-
import { ResolveOnce } from "../resolve-once.js";
|
9
|
-
import { runtimeFn } from "../runtime.js";
|
10
8
|
import { SysAbstraction, SystemService, VoidFunc } from "../sys-abstraction.js";
|
11
|
-
import { Env,
|
9
|
+
import { Env, envFactory } from "../sys-env.js";
|
12
10
|
import { Utf8EnDecoderSingleton } from "../txt-en-decoder.js";
|
13
11
|
// import * as process from "node:process";
|
14
12
|
import { DenoFileService } from "./deno-file-service.js";
|
@@ -19,60 +17,6 @@ const Deno = (globalThis as unknown as { Deno: unknown }).Deno as {
|
|
19
17
|
args: string[];
|
20
18
|
};
|
21
19
|
|
22
|
-
interface DenoEnv {
|
23
|
-
get: (key: string) => string | undefined;
|
24
|
-
toObject: () => Record<string, string>;
|
25
|
-
set: (key: string, value: string) => void;
|
26
|
-
has: (key: string) => boolean;
|
27
|
-
delete: (key: string) => void;
|
28
|
-
}
|
29
|
-
|
30
|
-
const once = new ResolveOnce<DenoEnvActions>();
|
31
|
-
export class DenoEnvActions implements EnvActions {
|
32
|
-
readonly #deno = globalThis as unknown as {
|
33
|
-
Deno: {
|
34
|
-
env: DenoEnv;
|
35
|
-
};
|
36
|
-
};
|
37
|
-
|
38
|
-
static new(opts: Partial<EnvFactoryOpts>): EnvActions {
|
39
|
-
return once.once(() => new DenoEnvActions(opts));
|
40
|
-
}
|
41
|
-
|
42
|
-
get _env(): DenoEnv {
|
43
|
-
return this.#deno.Deno.env;
|
44
|
-
}
|
45
|
-
|
46
|
-
readonly opts: Partial<EnvFactoryOpts>;
|
47
|
-
private constructor(opts: Partial<EnvFactoryOpts>) {
|
48
|
-
this.opts = opts;
|
49
|
-
}
|
50
|
-
|
51
|
-
register(env: Env): Env {
|
52
|
-
for (const key of env.keys()) {
|
53
|
-
this._env.set(key, env.get(key) || "");
|
54
|
-
}
|
55
|
-
return env;
|
56
|
-
}
|
57
|
-
active(): boolean {
|
58
|
-
return runtimeFn().isDeno;
|
59
|
-
}
|
60
|
-
keys(): string[] {
|
61
|
-
return Object.keys(this._env.toObject());
|
62
|
-
}
|
63
|
-
get(key: string): string | undefined {
|
64
|
-
return this._env.get(key);
|
65
|
-
}
|
66
|
-
set(key: string, value?: string): void {
|
67
|
-
if (value) {
|
68
|
-
this._env.set(key, value);
|
69
|
-
}
|
70
|
-
}
|
71
|
-
delete(key: string): void {
|
72
|
-
this._env.delete(key);
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
20
|
export class DenoExitServiceImpl implements ExitService {
|
77
21
|
constructor() {
|
78
22
|
globalThis.addEventListener("unhandledrejection", (e) => {
|
package/src/http_header.ts
CHANGED
package/src/index.ts
CHANGED
package/src/jsr.json
CHANGED
package/src/log-writer-impl.ts
CHANGED
@@ -14,7 +14,7 @@ export class LogWriterStream {
|
|
14
14
|
const writer = this._out.getWriter();
|
15
15
|
await writer.ready;
|
16
16
|
await writer.write(encoded);
|
17
|
-
|
17
|
+
writer.releaseLock();
|
18
18
|
} catch (err) {
|
19
19
|
// eslint-disable-next-line no-console
|
20
20
|
console.error("Chunk error:", err);
|
@@ -50,9 +50,14 @@ export class LogWriterStream {
|
|
50
50
|
|
51
51
|
// console.log(">>>Msg:", this._toFlush.length)
|
52
52
|
const my = this._toFlush.shift();
|
53
|
-
my?.()
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
my?.()
|
54
|
+
.catch((e) => {
|
55
|
+
// eslint-disable-next-line no-console
|
56
|
+
console.error("Flush error:", e);
|
57
|
+
})
|
58
|
+
.finally(() => {
|
59
|
+
// console.log("<<<Msg:", this._toFlush.length)
|
60
|
+
this._flush(this._toFlush);
|
61
|
+
});
|
57
62
|
}
|
58
63
|
}
|
package/src/logger-impl.ts
CHANGED
@@ -13,7 +13,6 @@ import {
|
|
13
13
|
Sized,
|
14
14
|
Lengthed,
|
15
15
|
LogValue,
|
16
|
-
asyncLogValue,
|
17
16
|
LevelHandler,
|
18
17
|
LogFormatter,
|
19
18
|
LogValueArg,
|
@@ -176,7 +175,7 @@ export class LoggerImpl implements Logger {
|
|
176
175
|
}
|
177
176
|
|
178
177
|
Attributes(): Record<string, unknown> {
|
179
|
-
return JSON.parse(JSON.stringify(this._attributes, null))
|
178
|
+
return JSON.parse(JSON.stringify(this._attributes, null)) as Record<string, unknown>;
|
180
179
|
// return Array.from(Object.entries(this._attributes)).reduce(
|
181
180
|
// (acc, [key, value]) => {
|
182
181
|
// if (value instanceof LogValue) {
|
@@ -246,7 +245,7 @@ export class LoggerImpl implements Logger {
|
|
246
245
|
this._attributes["level"] = logValue(Level.INFO, toLogValueCtx(this.levelHandler));
|
247
246
|
return this;
|
248
247
|
}
|
249
|
-
Err(err:
|
248
|
+
Err<T>(err: T | Result<T> | Error): Logger {
|
250
249
|
let key = "error";
|
251
250
|
if (Result.Is(err)) {
|
252
251
|
if (err.isOk()) {
|
@@ -356,11 +355,13 @@ export class LoggerImpl implements Logger {
|
|
356
355
|
return this;
|
357
356
|
}
|
358
357
|
|
358
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
359
359
|
Hash(value: unknown, key = "hash"): Logger {
|
360
|
-
|
361
|
-
|
362
|
-
)
|
363
|
-
|
360
|
+
throw new Error("Not implemented");
|
361
|
+
// this._attributes[key] = asyncLogValue(
|
362
|
+
// async () => `${getLen(value, toLogValueCtx(this.levelHandler)).value()}:${await hash(value)}`,
|
363
|
+
// );
|
364
|
+
// return this;
|
364
365
|
}
|
365
366
|
|
366
367
|
Url(url: CoerceURI, key = "url"): Logger {
|
@@ -592,7 +593,7 @@ class WithLoggerBuilder implements WithLogger {
|
|
592
593
|
this._li.Timestamp();
|
593
594
|
return this;
|
594
595
|
}
|
595
|
-
Any(key: string | Record<string, unknown>, value?:
|
596
|
+
Any<T>(key: string | Record<string, unknown>, value?: T | LogSerializable): WithLogger {
|
596
597
|
this._li.Any(key, value);
|
597
598
|
return this;
|
598
599
|
}
|
package/src/logger.ts
CHANGED
@@ -75,7 +75,7 @@ function logValueInternal(val: LogValueArg, ctx: LogValueStateInternal): LogValu
|
|
75
75
|
return new LogValue(val);
|
76
76
|
case "string": {
|
77
77
|
try {
|
78
|
-
const ret = JSON.parse(val);
|
78
|
+
const ret = JSON.parse(val) as LogValueArg;
|
79
79
|
if (typeof ret === "object" && ret !== null) {
|
80
80
|
return logValueInternal(ret, ctx);
|
81
81
|
}
|
@@ -108,7 +108,7 @@ function logValueInternal(val: LogValueArg, ctx: LogValueStateInternal): LogValu
|
|
108
108
|
// should be injected
|
109
109
|
const decoder = new TextDecoder();
|
110
110
|
const asStr = decoder.decode(val);
|
111
|
-
const obj = JSON.parse(asStr);
|
111
|
+
const obj = JSON.parse(asStr) as LogValueArg;
|
112
112
|
return logValueInternal(obj, ctx);
|
113
113
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
114
114
|
} catch (e) {
|
@@ -239,7 +239,7 @@ export interface LoggerInterface<R> {
|
|
239
239
|
Log(): R;
|
240
240
|
WithLevel(level: Level): R;
|
241
241
|
|
242
|
-
Err(err:
|
242
|
+
Err<T>(err: T | Result<T> | Error): R; // could be Error, or something which coerces to string
|
243
243
|
Info(): R;
|
244
244
|
Timestamp(): R;
|
245
245
|
Dur(key: string, nsec: number): R;
|
@@ -266,8 +266,7 @@ export function IsLogger(obj: unknown): obj is Logger {
|
|
266
266
|
"Dur",
|
267
267
|
"Uint64",
|
268
268
|
]
|
269
|
-
|
270
|
-
.map((fn) => typeof (obj as any)[fn] === "function")
|
269
|
+
.map((fn) => typeof (obj as Record<string, unknown>)[fn] === "function")
|
271
270
|
.reduce((a, b) => a && b, true)
|
272
271
|
);
|
273
272
|
}
|
@@ -13,10 +13,10 @@ export class MockFileService extends NodeFileService {
|
|
13
13
|
// return this.join("/mock/", fname);
|
14
14
|
// }
|
15
15
|
|
16
|
-
override
|
16
|
+
override create(fname: string): Promise<NamedWritableStream> {
|
17
17
|
let oName = fname;
|
18
18
|
if (!this.isAbsolute(fname)) {
|
19
|
-
oName =
|
19
|
+
oName = this.abs(fname);
|
20
20
|
}
|
21
21
|
|
22
22
|
const fc = {
|
@@ -27,7 +27,7 @@ export class MockFileService extends NodeFileService {
|
|
27
27
|
this.files[fname] = fc;
|
28
28
|
const decoder = new TextDecoder();
|
29
29
|
|
30
|
-
return {
|
30
|
+
return Promise.resolve({
|
31
31
|
name: oName,
|
32
32
|
stream: new WritableStream<Uint8Array>({
|
33
33
|
write(chunk): void {
|
@@ -40,6 +40,6 @@ export class MockFileService extends NodeFileService {
|
|
40
40
|
throw new Error("not implemented");
|
41
41
|
},
|
42
42
|
}),
|
43
|
-
};
|
43
|
+
});
|
44
44
|
}
|
45
45
|
}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { ResolveOnce } from "../resolve-once.js";
|
2
|
+
import { runtimeFn } from "../runtime.js";
|
3
|
+
import { Env, EnvActions, EnvFactoryOpts } from "../sys-env.js";
|
4
|
+
|
5
|
+
const once = new ResolveOnce<NodeEnvActions>();
|
6
|
+
export class NodeEnvActions implements EnvActions {
|
7
|
+
readonly #node = globalThis as unknown as { process: { env: Record<string, string> } };
|
8
|
+
|
9
|
+
static new(opts: Partial<EnvFactoryOpts>): EnvActions {
|
10
|
+
return once.once(() => new NodeEnvActions(opts));
|
11
|
+
}
|
12
|
+
|
13
|
+
readonly opts: Partial<EnvFactoryOpts>;
|
14
|
+
private constructor(opts: Partial<EnvFactoryOpts>) {
|
15
|
+
this.opts = opts;
|
16
|
+
}
|
17
|
+
|
18
|
+
register(env: Env): Env {
|
19
|
+
for (const key of env.keys()) {
|
20
|
+
this._env[key] = env.get(key) || "";
|
21
|
+
}
|
22
|
+
return env;
|
23
|
+
}
|
24
|
+
|
25
|
+
active(): boolean {
|
26
|
+
return runtimeFn().isNodeIsh;
|
27
|
+
// typeof this.#node === "object" && typeof this.#node.process === "object" && typeof this.#node.process.env === "object";
|
28
|
+
}
|
29
|
+
readonly _env: Record<string, string> = this.active() ? this.#node.process.env : {};
|
30
|
+
keys(): string[] {
|
31
|
+
return Object.keys(this._env);
|
32
|
+
}
|
33
|
+
get(key: string): string | undefined {
|
34
|
+
return this._env[key];
|
35
|
+
}
|
36
|
+
set(key: string, value?: string): void {
|
37
|
+
if (value) {
|
38
|
+
this._env[key] = value;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
delete(key: string): void {
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
43
|
+
delete this._env[key];
|
44
|
+
}
|
45
|
+
}
|
@@ -7,53 +7,9 @@ import {
|
|
7
7
|
WrapperSysAbstractionParams,
|
8
8
|
} from "../base-sys-abstraction.js";
|
9
9
|
import { NodeFileService } from "./node-file-service.js";
|
10
|
-
import { Env,
|
10
|
+
import { Env, envFactory } from "../sys-env.js";
|
11
11
|
import { Utf8EnDecoderSingleton } from "../txt-en-decoder.js";
|
12
12
|
import process from "node:process";
|
13
|
-
import { runtimeFn } from "../runtime.js";
|
14
|
-
import { ResolveOnce } from "../resolve-once.js";
|
15
|
-
|
16
|
-
const once = new ResolveOnce<NodeEnvActions>();
|
17
|
-
export class NodeEnvActions implements EnvActions {
|
18
|
-
readonly #node = globalThis as unknown as { process: { env: Record<string, string> } };
|
19
|
-
|
20
|
-
static new(opts: Partial<EnvFactoryOpts>): EnvActions {
|
21
|
-
return once.once(() => new NodeEnvActions(opts));
|
22
|
-
}
|
23
|
-
|
24
|
-
readonly opts: Partial<EnvFactoryOpts>;
|
25
|
-
private constructor(opts: Partial<EnvFactoryOpts>) {
|
26
|
-
this.opts = opts;
|
27
|
-
}
|
28
|
-
|
29
|
-
register(env: Env): Env {
|
30
|
-
for (const key of env.keys()) {
|
31
|
-
this._env[key] = env.get(key) || "";
|
32
|
-
}
|
33
|
-
return env;
|
34
|
-
}
|
35
|
-
|
36
|
-
active(): boolean {
|
37
|
-
return runtimeFn().isNodeIsh;
|
38
|
-
// typeof this.#node === "object" && typeof this.#node.process === "object" && typeof this.#node.process.env === "object";
|
39
|
-
}
|
40
|
-
readonly _env: Record<string, string> = this.active() ? this.#node.process.env : {};
|
41
|
-
keys(): string[] {
|
42
|
-
return Object.keys(this._env);
|
43
|
-
}
|
44
|
-
get(key: string): string | undefined {
|
45
|
-
return this._env[key];
|
46
|
-
}
|
47
|
-
set(key: string, value?: string): void {
|
48
|
-
if (value) {
|
49
|
-
this._env[key] = value;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
delete(key: string): void {
|
53
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
54
|
-
delete this._env[key];
|
55
|
-
}
|
56
|
-
}
|
57
13
|
|
58
14
|
export class NodeExitServiceImpl implements ExitService {
|
59
15
|
constructor() {
|
package/src/resolve-once.ts
CHANGED
@@ -14,10 +14,10 @@ export class ResolveSeq<T, C = void> {
|
|
14
14
|
reset(): void {
|
15
15
|
/* noop */
|
16
16
|
}
|
17
|
-
|
17
|
+
_step(item?: ResolveSeqItem<T, C>): Promise<void> {
|
18
18
|
if (!item) {
|
19
19
|
// done
|
20
|
-
return;
|
20
|
+
return Promise.resolve();
|
21
21
|
}
|
22
22
|
item
|
23
23
|
.fn(this.ctx)
|
@@ -25,15 +25,16 @@ export class ResolveSeq<T, C = void> {
|
|
25
25
|
.catch((e) => item.future.reject(e as Error))
|
26
26
|
.finally(() => {
|
27
27
|
this._seqFutures.shift();
|
28
|
-
this._step(this._seqFutures[0]);
|
28
|
+
void this._step(this._seqFutures[0]);
|
29
29
|
});
|
30
|
+
return Promise.resolve();
|
30
31
|
}
|
31
32
|
readonly _seqFutures: ResolveSeqItem<T, C>[] = [];
|
32
33
|
async add(fn: (c: C) => Promise<T>, id?: number): Promise<T> {
|
33
34
|
const future = new Future<T>();
|
34
35
|
this._seqFutures.push({ future, fn, id });
|
35
36
|
if (this._seqFutures.length === 1) {
|
36
|
-
this._step(this._seqFutures[0]);
|
37
|
+
void this._step(this._seqFutures[0]);
|
37
38
|
}
|
38
39
|
return future.asPromise();
|
39
40
|
}
|
@@ -99,7 +100,7 @@ export class ResolveOnce<T, CTX = void> {
|
|
99
100
|
this._onceFutures.length = 0;
|
100
101
|
};
|
101
102
|
const catchFn = (e: Error): void => {
|
102
|
-
this._onceError = e
|
103
|
+
this._onceError = e;
|
103
104
|
this._onceOk = false;
|
104
105
|
this._onceValue = undefined;
|
105
106
|
this._onceDone = true;
|