@powerlines/core 0.48.27 → 0.48.29
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/dist/api-DTCbbtSH.d.cts +6 -0
- package/dist/api-DTCbbtSH.d.cts.map +1 -0
- package/dist/api-DTCbbtSH.d.mts +6 -0
- package/dist/api-DTCbbtSH.d.mts.map +1 -0
- package/dist/base-context-BmxgDD3S.d.mts +79 -0
- package/dist/base-context-BmxgDD3S.d.mts.map +1 -0
- package/dist/base-context-mHoSEqHf.d.cts +79 -0
- package/dist/base-context-mHoSEqHf.d.cts.map +1 -0
- package/dist/{_virtual/_rolldown/runtime.cjs → chunk-C_NdSu1c.cjs} +6 -9
- package/dist/commands-DzGd8pnR.d.cts +5 -0
- package/dist/commands-DzGd8pnR.d.cts.map +1 -0
- package/dist/commands-DzGd8pnR.d.mts +5 -0
- package/dist/commands-DzGd8pnR.d.mts.map +1 -0
- package/dist/config-BnV_o0Es.d.cts +2461 -0
- package/dist/config-BnV_o0Es.d.cts.map +1 -0
- package/dist/config-DKeDSykZ.d.cts +138 -0
- package/dist/config-DKeDSykZ.d.cts.map +1 -0
- package/dist/config-DbOP5nVu.d.mts +138 -0
- package/dist/config-DbOP5nVu.d.mts.map +1 -0
- package/dist/config-DboKmDhl.d.mts +2461 -0
- package/dist/config-DboKmDhl.d.mts.map +1 -0
- package/dist/constants/api.cjs +0 -8
- package/dist/constants/api.d.cts +2 -6
- package/dist/constants/api.d.mts +2 -8
- package/dist/constants/api.mjs +0 -8
- package/dist/constants/api.mjs.map +1 -1
- package/dist/constants/commands.cjs +0 -8
- package/dist/constants/commands.d.cts +2 -5
- package/dist/constants/commands.d.mts +2 -7
- package/dist/constants/commands.mjs +0 -8
- package/dist/constants/commands.mjs.map +1 -1
- package/dist/constants/devtools.cjs +0 -8
- package/dist/constants/devtools.d.cts +2 -13
- package/dist/constants/devtools.d.mts +2 -15
- package/dist/constants/devtools.mjs +0 -8
- package/dist/constants/devtools.mjs.map +1 -1
- package/dist/constants/environments.cjs +0 -8
- package/dist/constants/environments.d.cts +2 -10
- package/dist/constants/environments.d.mts +2 -12
- package/dist/constants/environments.mjs +0 -8
- package/dist/constants/environments.mjs.map +1 -1
- package/dist/constants/extensions.cjs +0 -8
- package/dist/constants/extensions.d.cts +2 -5
- package/dist/constants/extensions.d.mts +2 -7
- package/dist/constants/extensions.mjs +0 -8
- package/dist/constants/extensions.mjs.map +1 -1
- package/dist/constants/fs.cjs +0 -8
- package/dist/constants/fs.d.cts +2 -7
- package/dist/constants/fs.d.mts +2 -9
- package/dist/constants/fs.mjs +0 -8
- package/dist/constants/fs.mjs.map +1 -1
- package/dist/constants/hooks.cjs +0 -8
- package/dist/constants/hooks.d.cts +2 -5
- package/dist/constants/hooks.d.mts +2 -7
- package/dist/constants/hooks.mjs +0 -8
- package/dist/constants/hooks.mjs.map +1 -1
- package/dist/constants/index.cjs +0 -8
- package/dist/constants/index.d.cts +10 -10
- package/dist/constants/index.d.mts +10 -12
- package/dist/constants/index.mjs +0 -8
- package/dist/constants/log-level.cjs +0 -8
- package/dist/constants/log-level.d.cts +2 -67
- package/dist/constants/log-level.d.mts +2 -69
- package/dist/constants/log-level.mjs +0 -8
- package/dist/constants/log-level.mjs.map +1 -1
- package/dist/constants/meta.cjs +0 -8
- package/dist/constants/meta.d.cts +2 -6
- package/dist/constants/meta.d.mts +2 -8
- package/dist/constants/meta.mjs +0 -8
- package/dist/constants/meta.mjs.map +1 -1
- package/dist/constants/plugin.cjs +0 -8
- package/dist/constants/plugin.d.cts +2 -9
- package/dist/constants/plugin.d.mts +2 -11
- package/dist/constants/plugin.mjs +0 -8
- package/dist/constants/plugin.mjs.map +1 -1
- package/dist/context/base-context.cjs +2 -10
- package/dist/context/base-context.d.cts +2 -81
- package/dist/context/base-context.d.mts +2 -83
- package/dist/context/base-context.mjs +0 -8
- package/dist/context/base-context.mjs.map +1 -1
- package/dist/context/context.cjs +2 -10
- package/dist/context/context.d.cts +2 -373
- package/dist/context/context.d.mts +2 -375
- package/dist/context/context.mjs +0 -8
- package/dist/context/context.mjs.map +1 -1
- package/dist/context/environment-context.cjs +0 -8
- package/dist/context/environment-context.d.cts +2 -5
- package/dist/context/environment-context.d.cts.map +1 -1
- package/dist/context/environment-context.d.mts +2 -7
- package/dist/context/environment-context.d.mts.map +1 -1
- package/dist/context/environment-context.mjs +0 -8
- package/dist/context/environment-context.mjs.map +1 -1
- package/dist/context/execution-context.cjs +2 -10
- package/dist/context/execution-context.d.cts +2 -6
- package/dist/context/execution-context.d.cts.map +1 -1
- package/dist/context/execution-context.d.mts +2 -8
- package/dist/context/execution-context.d.mts.map +1 -1
- package/dist/context/execution-context.mjs +0 -8
- package/dist/context/execution-context.mjs.map +1 -1
- package/dist/context/index.cjs +0 -8
- package/dist/context/index.d.cts +2 -2
- package/dist/context/index.d.mts +2 -4
- package/dist/context/index.mjs +0 -8
- package/dist/context/plugin-context.cjs +0 -8
- package/dist/context/plugin-context.d.cts +1 -3
- package/dist/context/plugin-context.d.cts.map +1 -1
- package/dist/context/plugin-context.d.mts +1 -5
- package/dist/context/plugin-context.d.mts.map +1 -1
- package/dist/context/plugin-context.mjs +0 -8
- package/dist/context/plugin-context.mjs.map +1 -1
- package/dist/context-C6oL3mPw.d.mts +368 -0
- package/dist/context-C6oL3mPw.d.mts.map +1 -0
- package/dist/context-DcY6YqBQ.d.cts +368 -0
- package/dist/context-DcY6YqBQ.d.cts.map +1 -0
- package/dist/context-helpers-BKxpDArS.d.mts +15 -0
- package/dist/context-helpers-BKxpDArS.d.mts.map +1 -0
- package/dist/context-helpers-zXovPE7i.d.cts +15 -0
- package/dist/context-helpers-zXovPE7i.d.cts.map +1 -0
- package/dist/devtools-h0du-bSj.d.cts +13 -0
- package/dist/devtools-h0du-bSj.d.cts.map +1 -0
- package/dist/devtools-h0du-bSj.d.mts +13 -0
- package/dist/devtools-h0du-bSj.d.mts.map +1 -0
- package/dist/entry-BC_V2K2U.d.cts +46 -0
- package/dist/entry-BC_V2K2U.d.cts.map +1 -0
- package/dist/entry-CHIaWcmk.d.mts +46 -0
- package/dist/entry-CHIaWcmk.d.mts.map +1 -0
- package/dist/environments-BYv_kHRG.d.cts +10 -0
- package/dist/environments-BYv_kHRG.d.cts.map +1 -0
- package/dist/environments-BYv_kHRG.d.mts +10 -0
- package/dist/environments-BYv_kHRG.d.mts.map +1 -0
- package/dist/events-NA1XM2Vz.d.cts +10 -0
- package/dist/events-NA1XM2Vz.d.cts.map +1 -0
- package/dist/events-NA1XM2Vz.d.mts +10 -0
- package/dist/events-NA1XM2Vz.d.mts.map +1 -0
- package/dist/extensions-ctxXzgay.d.cts +5 -0
- package/dist/extensions-ctxXzgay.d.cts.map +1 -0
- package/dist/extensions-ctxXzgay.d.mts +5 -0
- package/dist/extensions-ctxXzgay.d.mts.map +1 -0
- package/dist/file-header-Co9oo7aI.d.cts +41 -0
- package/dist/file-header-Co9oo7aI.d.cts.map +1 -0
- package/dist/file-header-rHqeXgRV.d.mts +41 -0
- package/dist/file-header-rHqeXgRV.d.mts.map +1 -0
- package/dist/format-Cf-cgZ-s.d.cts +24 -0
- package/dist/format-Cf-cgZ-s.d.cts.map +1 -0
- package/dist/format-IQPqgWIe.d.mts +24 -0
- package/dist/format-IQPqgWIe.d.mts.map +1 -0
- package/dist/fs-BzXT5ZPj.d.cts +7 -0
- package/dist/fs-BzXT5ZPj.d.cts.map +1 -0
- package/dist/fs-BzXT5ZPj.d.mts +7 -0
- package/dist/fs-BzXT5ZPj.d.mts.map +1 -0
- package/dist/{schemas/fs.cjs → fs-C2lru696.cjs} +38 -16
- package/dist/{schemas/fs.mjs → fs-DqLn15uU.mjs} +2 -10
- package/dist/fs-DqLn15uU.mjs.map +1 -0
- package/dist/generate-types-CDkVosrS.d.cts +65 -0
- package/dist/generate-types-CDkVosrS.d.cts.map +1 -0
- package/dist/generate-types-Dw6p3cB_.d.mts +65 -0
- package/dist/generate-types-Dw6p3cB_.d.mts.map +1 -0
- package/dist/helpers-CrRRFQl5.d.mts +22 -0
- package/dist/helpers-CrRRFQl5.d.mts.map +1 -0
- package/dist/helpers-DBLIQW3U.d.cts +22 -0
- package/dist/helpers-DBLIQW3U.d.cts.map +1 -0
- package/dist/hooks-Dhc3ahex.d.cts +5 -0
- package/dist/hooks-Dhc3ahex.d.cts.map +1 -0
- package/dist/hooks-Dhc3ahex.d.mts +5 -0
- package/dist/hooks-Dhc3ahex.d.mts.map +1 -0
- package/dist/index-BKZ67WMa.d.cts +1 -0
- package/dist/index-BKZ67WMa.d.mts +1 -0
- package/dist/index-BVVgDSdq.d.cts +1 -0
- package/dist/index-BVVgDSdq.d.mts +1 -0
- package/dist/index-Den-MsLx.d.cts +1 -0
- package/dist/index-Den-MsLx.d.mts +1 -0
- package/dist/index-DmtQKWjk.d.cts +1 -0
- package/dist/index-DmtQKWjk.d.mts +1 -0
- package/dist/index-LtpXjuJR.d.mts +25 -0
- package/dist/index-LtpXjuJR.d.mts.map +1 -0
- package/dist/index-_6s0AX1B.d.cts +1 -0
- package/dist/index-_6s0AX1B.d.mts +1 -0
- package/dist/index-xk4vSgtB.d.cts +25 -0
- package/dist/index-xk4vSgtB.d.cts.map +1 -0
- package/dist/index.cjs +1 -9
- package/dist/index.d.cts +24 -32
- package/dist/index.d.mts +24 -34
- package/dist/index.mjs +1 -9
- package/dist/install-dependencies-CCjZfS9Y.d.mts +12 -0
- package/dist/install-dependencies-CCjZfS9Y.d.mts.map +1 -0
- package/dist/install-dependencies-CyeYsrfz.d.cts +12 -0
- package/dist/install-dependencies-CyeYsrfz.d.cts.map +1 -0
- package/dist/lib/config.cjs +2 -10
- package/dist/lib/config.d.cts +2 -140
- package/dist/lib/config.d.mts +2 -142
- package/dist/lib/config.mjs +0 -8
- package/dist/lib/config.mjs.map +1 -1
- package/dist/lib/context-helpers.cjs +0 -8
- package/dist/lib/context-helpers.d.cts +2 -16
- package/dist/lib/context-helpers.d.mts +2 -18
- package/dist/lib/context-helpers.mjs +0 -8
- package/dist/lib/context-helpers.mjs.map +1 -1
- package/dist/lib/entry.cjs +0 -8
- package/dist/lib/entry.d.cts +2 -47
- package/dist/lib/entry.d.mts +2 -49
- package/dist/lib/entry.mjs +0 -8
- package/dist/lib/entry.mjs.map +1 -1
- package/dist/lib/environment.cjs +2 -10
- package/dist/lib/environment.d.cts +1 -2
- package/dist/lib/environment.d.cts.map +1 -1
- package/dist/lib/environment.d.mts +1 -4
- package/dist/lib/environment.d.mts.map +1 -1
- package/dist/lib/environment.mjs +0 -8
- package/dist/lib/environment.mjs.map +1 -1
- package/dist/lib/events.cjs +0 -8
- package/dist/lib/events.d.cts +2 -10
- package/dist/lib/events.d.mts +2 -12
- package/dist/lib/events.mjs +0 -8
- package/dist/lib/events.mjs.map +1 -1
- package/dist/lib/generate-types.cjs +0 -8
- package/dist/lib/generate-types.d.cts +2 -66
- package/dist/lib/generate-types.d.mts +2 -68
- package/dist/lib/generate-types.mjs +0 -8
- package/dist/lib/generate-types.mjs.map +1 -1
- package/dist/lib/hooks.cjs +2 -10
- package/dist/lib/hooks.d.cts +2 -28
- package/dist/lib/hooks.d.mts +2 -30
- package/dist/lib/hooks.mjs +0 -8
- package/dist/lib/hooks.mjs.map +1 -1
- package/dist/lib/index.cjs +1 -9
- package/dist/lib/index.d.cts +23 -23
- package/dist/lib/index.d.mts +23 -25
- package/dist/lib/index.mjs +1 -9
- package/dist/lib/install-dependencies.cjs +0 -8
- package/dist/lib/install-dependencies.d.cts +2 -12
- package/dist/lib/install-dependencies.d.mts +2 -14
- package/dist/lib/install-dependencies.mjs +0 -8
- package/dist/lib/install-dependencies.mjs.map +1 -1
- package/dist/lib/meta.cjs +0 -8
- package/dist/lib/meta.d.cts +2 -33
- package/dist/lib/meta.d.mts +2 -35
- package/dist/lib/meta.mjs +0 -8
- package/dist/lib/meta.mjs.map +1 -1
- package/dist/lib/plugins.cjs +2 -10
- package/dist/lib/plugins.d.cts +2 -39
- package/dist/lib/plugins.d.mts +2 -41
- package/dist/lib/plugins.mjs +0 -8
- package/dist/lib/plugins.mjs.map +1 -1
- package/dist/lib/resolver.cjs +2 -10
- package/dist/lib/resolver.d.cts +2 -20
- package/dist/lib/resolver.d.mts +2 -22
- package/dist/lib/resolver.mjs +0 -8
- package/dist/lib/resolver.mjs.map +1 -1
- package/dist/lib/schemas.cjs +1 -9
- package/dist/lib/schemas.d.cts +1 -1
- package/dist/lib/schemas.d.mts +1 -3
- package/dist/lib/schemas.mjs +1 -9
- package/dist/lib/streaming-channel.cjs +0 -8
- package/dist/lib/streaming-channel.d.cts +2 -126
- package/dist/lib/streaming-channel.d.mts +2 -128
- package/dist/lib/streaming-channel.mjs +0 -8
- package/dist/lib/streaming-channel.mjs.map +1 -1
- package/dist/lib/typescript/index.cjs +0 -8
- package/dist/lib/typescript/index.d.cts +2 -2
- package/dist/lib/typescript/index.d.mts +2 -4
- package/dist/lib/typescript/index.mjs +0 -8
- package/dist/lib/typescript/ts-morph.cjs +2 -10
- package/dist/lib/typescript/ts-morph.d.cts +2 -38
- package/dist/lib/typescript/ts-morph.d.mts +2 -40
- package/dist/lib/typescript/ts-morph.mjs +0 -8
- package/dist/lib/typescript/ts-morph.mjs.map +1 -1
- package/dist/lib/typescript/tsconfig.cjs +4 -12
- package/dist/lib/typescript/tsconfig.d.cts +2 -77
- package/dist/lib/typescript/tsconfig.d.mts +2 -79
- package/dist/lib/typescript/tsconfig.mjs +0 -8
- package/dist/lib/typescript/tsconfig.mjs.map +1 -1
- package/dist/lib/unplugin/helpers.cjs +0 -8
- package/dist/lib/unplugin/helpers.d.cts +2 -23
- package/dist/lib/unplugin/helpers.d.mts +2 -25
- package/dist/lib/unplugin/helpers.mjs +0 -8
- package/dist/lib/unplugin/helpers.mjs.map +1 -1
- package/dist/lib/unplugin/index.cjs +0 -8
- package/dist/lib/unplugin/index.d.cts +3 -3
- package/dist/lib/unplugin/index.d.mts +3 -5
- package/dist/lib/unplugin/index.mjs +0 -8
- package/dist/lib/unplugin/module-resolution.cjs +2 -10
- package/dist/lib/unplugin/module-resolution.d.cts +2 -41
- package/dist/lib/unplugin/module-resolution.d.mts +2 -43
- package/dist/lib/unplugin/module-resolution.mjs +0 -8
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +0 -8
- package/dist/lib/unplugin/plugin.d.cts +2 -40
- package/dist/lib/unplugin/plugin.d.mts +2 -42
- package/dist/lib/unplugin/plugin.mjs +0 -8
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/lib/utilities/file-header.cjs +0 -8
- package/dist/lib/utilities/file-header.d.cts +2 -41
- package/dist/lib/utilities/file-header.d.mts +2 -43
- package/dist/lib/utilities/file-header.mjs +0 -8
- package/dist/lib/utilities/file-header.mjs.map +1 -1
- package/dist/lib/utilities/format.cjs +2 -10
- package/dist/lib/utilities/format.d.cts +2 -24
- package/dist/lib/utilities/format.d.mts +2 -26
- package/dist/lib/utilities/format.mjs +0 -8
- package/dist/lib/utilities/format.mjs.map +1 -1
- package/dist/lib/utilities/index.cjs +0 -8
- package/dist/lib/utilities/index.d.cts +5 -5
- package/dist/lib/utilities/index.d.mts +5 -7
- package/dist/lib/utilities/index.mjs +0 -8
- package/dist/lib/utilities/source-file.cjs +2 -10
- package/dist/lib/utilities/source-file.d.cts +2 -30
- package/dist/lib/utilities/source-file.d.mts +2 -32
- package/dist/lib/utilities/source-file.mjs +0 -8
- package/dist/lib/utilities/source-file.mjs.map +1 -1
- package/dist/lib/utilities/source-map.cjs +2 -10
- package/dist/lib/utilities/source-map.d.cts +2 -16
- package/dist/lib/utilities/source-map.d.mts +2 -18
- package/dist/lib/utilities/source-map.mjs +0 -8
- package/dist/lib/utilities/source-map.mjs.map +1 -1
- package/dist/lib/utilities/write-file.cjs +0 -8
- package/dist/lib/utilities/write-file.d.cts +2 -15
- package/dist/lib/utilities/write-file.d.mts +2 -17
- package/dist/lib/utilities/write-file.mjs +0 -8
- package/dist/lib/utilities/write-file.mjs.map +1 -1
- package/dist/lib/vfs.cjs +3 -11
- package/dist/lib/vfs.d.cts +2 -321
- package/dist/lib/vfs.d.mts +2 -323
- package/dist/lib/vfs.mjs +1 -9
- package/dist/lib/vfs.mjs.map +1 -1
- package/dist/log-level-BC8g4BBL.d.cts +67 -0
- package/dist/log-level-BC8g4BBL.d.cts.map +1 -0
- package/dist/log-level-BC8g4BBL.d.mts +67 -0
- package/dist/log-level-BC8g4BBL.d.mts.map +1 -0
- package/dist/meta-CdDd2ykC.d.cts +33 -0
- package/dist/meta-CdDd2ykC.d.cts.map +1 -0
- package/dist/meta-CfTCHU_o.d.mts +33 -0
- package/dist/meta-CfTCHU_o.d.mts.map +1 -0
- package/dist/meta-QA_SN1j3.d.cts +6 -0
- package/dist/meta-QA_SN1j3.d.cts.map +1 -0
- package/dist/meta-QA_SN1j3.d.mts +6 -0
- package/dist/meta-QA_SN1j3.d.mts.map +1 -0
- package/dist/module-resolution-CRMNPsdn.d.mts +40 -0
- package/dist/module-resolution-CRMNPsdn.d.mts.map +1 -0
- package/dist/module-resolution-D-w-EZaK.d.cts +40 -0
- package/dist/module-resolution-D-w-EZaK.d.cts.map +1 -0
- package/dist/plugin-B_b7XqaN.d.mts +39 -0
- package/dist/plugin-B_b7XqaN.d.mts.map +1 -0
- package/dist/plugin-CzV-aFwU.d.cts +39 -0
- package/dist/plugin-CzV-aFwU.d.cts.map +1 -0
- package/dist/plugin-base.cjs +0 -8
- package/dist/plugin-base.d.cts +1 -3
- package/dist/plugin-base.d.cts.map +1 -1
- package/dist/plugin-base.d.mts +1 -5
- package/dist/plugin-base.d.mts.map +1 -1
- package/dist/plugin-base.mjs +0 -8
- package/dist/plugin-base.mjs.map +1 -1
- package/dist/plugin-fhBG7SSQ.d.cts +9 -0
- package/dist/plugin-fhBG7SSQ.d.cts.map +1 -0
- package/dist/plugin-fhBG7SSQ.d.mts +9 -0
- package/dist/plugin-fhBG7SSQ.d.mts.map +1 -0
- package/dist/plugin-utils/build-helpers.cjs +0 -8
- package/dist/plugin-utils/build-helpers.d.cts +1 -2
- package/dist/plugin-utils/build-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/build-helpers.d.mts +1 -4
- package/dist/plugin-utils/build-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/build-helpers.mjs +0 -8
- package/dist/plugin-utils/build-helpers.mjs.map +1 -1
- package/dist/plugin-utils/combine-plugins.cjs +0 -8
- package/dist/plugin-utils/combine-plugins.d.cts +1 -1
- package/dist/plugin-utils/combine-plugins.d.mts +1 -3
- package/dist/plugin-utils/combine-plugins.d.mts.map +1 -1
- package/dist/plugin-utils/combine-plugins.mjs +0 -8
- package/dist/plugin-utils/combine-plugins.mjs.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +0 -8
- package/dist/plugin-utils/context-helpers.d.cts +1 -1
- package/dist/plugin-utils/context-helpers.d.mts +1 -3
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs +0 -8
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/docs-helper.cjs +0 -8
- package/dist/plugin-utils/docs-helper.d.mts +0 -2
- package/dist/plugin-utils/docs-helper.d.mts.map +1 -1
- package/dist/plugin-utils/docs-helper.mjs +0 -8
- package/dist/plugin-utils/docs-helper.mjs.map +1 -1
- package/dist/plugin-utils/enable-plugin.cjs +0 -8
- package/dist/plugin-utils/enable-plugin.d.cts +1 -2
- package/dist/plugin-utils/enable-plugin.d.cts.map +1 -1
- package/dist/plugin-utils/enable-plugin.d.mts +1 -4
- package/dist/plugin-utils/enable-plugin.d.mts.map +1 -1
- package/dist/plugin-utils/enable-plugin.mjs +0 -8
- package/dist/plugin-utils/enable-plugin.mjs.map +1 -1
- package/dist/plugin-utils/extend.cjs +0 -8
- package/dist/plugin-utils/extend.d.cts +1 -3
- package/dist/plugin-utils/extend.d.cts.map +1 -1
- package/dist/plugin-utils/extend.d.mts +1 -5
- package/dist/plugin-utils/extend.d.mts.map +1 -1
- package/dist/plugin-utils/extend.mjs +0 -8
- package/dist/plugin-utils/extend.mjs.map +1 -1
- package/dist/plugin-utils/filter.cjs +2 -10
- package/dist/plugin-utils/filter.d.cts +1 -1
- package/dist/plugin-utils/filter.d.mts +1 -3
- package/dist/plugin-utils/filter.d.mts.map +1 -1
- package/dist/plugin-utils/filter.mjs +0 -8
- package/dist/plugin-utils/filter.mjs.map +1 -1
- package/dist/plugin-utils/format-package-json.cjs +0 -8
- package/dist/plugin-utils/format-package-json.d.cts +1 -1
- package/dist/plugin-utils/format-package-json.d.mts +1 -3
- package/dist/plugin-utils/format-package-json.d.mts.map +1 -1
- package/dist/plugin-utils/format-package-json.mjs +0 -8
- package/dist/plugin-utils/format-package-json.mjs.map +1 -1
- package/dist/plugin-utils/format.cjs +0 -8
- package/dist/plugin-utils/format.d.mts +0 -2
- package/dist/plugin-utils/format.d.mts.map +1 -1
- package/dist/plugin-utils/format.mjs +0 -8
- package/dist/plugin-utils/format.mjs.map +1 -1
- package/dist/plugin-utils/get-config-path.cjs +0 -8
- package/dist/plugin-utils/get-config-path.d.cts +1 -1
- package/dist/plugin-utils/get-config-path.d.mts +1 -3
- package/dist/plugin-utils/get-config-path.d.mts.map +1 -1
- package/dist/plugin-utils/get-config-path.mjs +0 -8
- package/dist/plugin-utils/get-config-path.mjs.map +1 -1
- package/dist/plugin-utils/helpers.cjs +0 -8
- package/dist/plugin-utils/helpers.d.cts +1 -5
- package/dist/plugin-utils/helpers.d.cts.map +1 -1
- package/dist/plugin-utils/helpers.d.mts +1 -7
- package/dist/plugin-utils/helpers.d.mts.map +1 -1
- package/dist/plugin-utils/helpers.mjs +0 -8
- package/dist/plugin-utils/helpers.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +0 -8
- package/dist/plugin-utils/index.d.mts +0 -2
- package/dist/plugin-utils/index.mjs +0 -8
- package/dist/plugin-utils/install.cjs +0 -8
- package/dist/plugin-utils/install.d.cts +1 -1
- package/dist/plugin-utils/install.d.mts +1 -3
- package/dist/plugin-utils/install.d.mts.map +1 -1
- package/dist/plugin-utils/install.mjs +0 -8
- package/dist/plugin-utils/install.mjs.map +1 -1
- package/dist/plugin-utils/logging.cjs +2 -10
- package/dist/plugin-utils/logging.d.cts +1 -3
- package/dist/plugin-utils/logging.d.cts.map +1 -1
- package/dist/plugin-utils/logging.d.mts +1 -5
- package/dist/plugin-utils/logging.d.mts.map +1 -1
- package/dist/plugin-utils/logging.mjs +0 -8
- package/dist/plugin-utils/logging.mjs.map +1 -1
- package/dist/plugin-utils/merge.cjs +2 -10
- package/dist/plugin-utils/merge.d.cts +1 -3
- package/dist/plugin-utils/merge.d.cts.map +1 -1
- package/dist/plugin-utils/merge.d.mts +1 -5
- package/dist/plugin-utils/merge.d.mts.map +1 -1
- package/dist/plugin-utils/merge.mjs +0 -8
- package/dist/plugin-utils/merge.mjs.map +1 -1
- package/dist/plugin-utils/modules.cjs +0 -8
- package/dist/plugin-utils/modules.d.cts +1 -1
- package/dist/plugin-utils/modules.d.mts +1 -3
- package/dist/plugin-utils/modules.d.mts.map +1 -1
- package/dist/plugin-utils/modules.mjs +0 -8
- package/dist/plugin-utils/modules.mjs.map +1 -1
- package/dist/plugin-utils/paths.cjs +0 -8
- package/dist/plugin-utils/paths.d.cts +1 -1
- package/dist/plugin-utils/paths.d.mts +1 -3
- package/dist/plugin-utils/paths.d.mts.map +1 -1
- package/dist/plugin-utils/paths.mjs +0 -8
- package/dist/plugin-utils/paths.mjs.map +1 -1
- package/dist/plugin-utils/virtual.cjs +0 -8
- package/dist/plugin-utils/virtual.d.mts +0 -2
- package/dist/plugin-utils/virtual.d.mts.map +1 -1
- package/dist/plugin-utils/virtual.mjs +0 -8
- package/dist/plugin-utils/virtual.mjs.map +1 -1
- package/dist/plugins-DfL1fBZi.d.cts +37 -0
- package/dist/plugins-DfL1fBZi.d.cts.map +1 -0
- package/dist/plugins-zG2X2LA8.d.mts +37 -0
- package/dist/plugins-zG2X2LA8.d.mts.map +1 -0
- package/dist/resolver-CdBAh8dA.d.mts +19 -0
- package/dist/resolver-CdBAh8dA.d.mts.map +1 -0
- package/dist/resolver-CfCl--Eh.d.cts +19 -0
- package/dist/resolver-CfCl--Eh.d.cts.map +1 -0
- package/dist/{schemas/fs.d.cts → schemas-Zvqwdrw_.d.cts} +2 -2
- package/dist/schemas-Zvqwdrw_.d.cts.map +1 -0
- package/dist/{schemas/fs.d.mts → schemas-Zvqwdrw_.d.mts} +2 -4
- package/dist/schemas-Zvqwdrw_.d.mts.map +1 -0
- package/dist/source-file-CLw13fKE.d.mts +30 -0
- package/dist/source-file-CLw13fKE.d.mts.map +1 -0
- package/dist/source-file-CuuHaBL5.d.cts +30 -0
- package/dist/source-file-CuuHaBL5.d.cts.map +1 -0
- package/dist/source-map-Cy0aqSpe.d.mts +16 -0
- package/dist/source-map-Cy0aqSpe.d.mts.map +1 -0
- package/dist/source-map-HU4IoICc.d.cts +16 -0
- package/dist/source-map-HU4IoICc.d.cts.map +1 -0
- package/dist/storage/base.cjs +0 -8
- package/dist/storage/base.d.cts +1 -2
- package/dist/storage/base.d.cts.map +1 -1
- package/dist/storage/base.d.mts +1 -4
- package/dist/storage/base.d.mts.map +1 -1
- package/dist/storage/base.mjs +0 -8
- package/dist/storage/base.mjs.map +1 -1
- package/dist/storage/file-system.cjs +0 -8
- package/dist/storage/file-system.d.cts +1 -1
- package/dist/storage/file-system.d.mts +1 -3
- package/dist/storage/file-system.d.mts.map +1 -1
- package/dist/storage/file-system.mjs +0 -8
- package/dist/storage/file-system.mjs.map +1 -1
- package/dist/storage/helpers.cjs +0 -8
- package/dist/storage/helpers.d.mts +0 -2
- package/dist/storage/helpers.d.mts.map +1 -1
- package/dist/storage/helpers.mjs +0 -8
- package/dist/storage/helpers.mjs.map +1 -1
- package/dist/storage/index.cjs +0 -8
- package/dist/storage/index.d.mts +0 -2
- package/dist/storage/index.mjs +0 -8
- package/dist/storage/virtual.cjs +0 -8
- package/dist/storage/virtual.d.cts +1 -1
- package/dist/storage/virtual.d.cts.map +1 -1
- package/dist/storage/virtual.d.mts +1 -3
- package/dist/storage/virtual.d.mts.map +1 -1
- package/dist/storage/virtual.mjs +0 -8
- package/dist/storage/virtual.mjs.map +1 -1
- package/dist/streaming-channel-CiyFd_6l.d.cts +126 -0
- package/dist/streaming-channel-CiyFd_6l.d.cts.map +1 -0
- package/dist/streaming-channel-CiyFd_6l.d.mts +126 -0
- package/dist/streaming-channel-CiyFd_6l.d.mts.map +1 -0
- package/dist/ts-morph-BGgjbOgM.d.cts +38 -0
- package/dist/ts-morph-BGgjbOgM.d.cts.map +1 -0
- package/dist/ts-morph-zLvdifpA.d.mts +38 -0
- package/dist/ts-morph-zLvdifpA.d.mts.map +1 -0
- package/dist/tsconfig-DExoZEQ0.d.cts +75 -0
- package/dist/tsconfig-DExoZEQ0.d.cts.map +1 -0
- package/dist/tsconfig-De09cBeX.d.mts +75 -0
- package/dist/tsconfig-De09cBeX.d.mts.map +1 -0
- package/dist/vfs-B9Vhnajc.d.cts +320 -0
- package/dist/vfs-B9Vhnajc.d.cts.map +1 -0
- package/dist/vfs-Dl6nPqdS.d.mts +320 -0
- package/dist/vfs-Dl6nPqdS.d.mts.map +1 -0
- package/dist/write-file-BVMnXVPo.d.cts +15 -0
- package/dist/write-file-BVMnXVPo.d.cts.map +1 -0
- package/dist/write-file-CWf9Xxwd.d.mts +15 -0
- package/dist/write-file-CWf9Xxwd.d.mts.map +1 -0
- package/package.json +17 -17
- package/dist/constants/api.d.cts.map +0 -1
- package/dist/constants/api.d.mts.map +0 -1
- package/dist/constants/commands.d.cts.map +0 -1
- package/dist/constants/commands.d.mts.map +0 -1
- package/dist/constants/devtools.d.cts.map +0 -1
- package/dist/constants/devtools.d.mts.map +0 -1
- package/dist/constants/environments.d.cts.map +0 -1
- package/dist/constants/environments.d.mts.map +0 -1
- package/dist/constants/extensions.d.cts.map +0 -1
- package/dist/constants/extensions.d.mts.map +0 -1
- package/dist/constants/fs.d.cts.map +0 -1
- package/dist/constants/fs.d.mts.map +0 -1
- package/dist/constants/hooks.d.cts.map +0 -1
- package/dist/constants/hooks.d.mts.map +0 -1
- package/dist/constants/log-level.d.cts.map +0 -1
- package/dist/constants/log-level.d.mts.map +0 -1
- package/dist/constants/meta.d.cts.map +0 -1
- package/dist/constants/meta.d.mts.map +0 -1
- package/dist/constants/plugin.d.cts.map +0 -1
- package/dist/constants/plugin.d.mts.map +0 -1
- package/dist/context/base-context.d.cts.map +0 -1
- package/dist/context/base-context.d.mts.map +0 -1
- package/dist/context/context.d.cts.map +0 -1
- package/dist/context/context.d.mts.map +0 -1
- package/dist/lib/config.d.cts.map +0 -1
- package/dist/lib/config.d.mts.map +0 -1
- package/dist/lib/context-helpers.d.cts.map +0 -1
- package/dist/lib/context-helpers.d.mts.map +0 -1
- package/dist/lib/entry.d.cts.map +0 -1
- package/dist/lib/entry.d.mts.map +0 -1
- package/dist/lib/events.d.cts.map +0 -1
- package/dist/lib/events.d.mts.map +0 -1
- package/dist/lib/generate-types.d.cts.map +0 -1
- package/dist/lib/generate-types.d.mts.map +0 -1
- package/dist/lib/hooks.d.cts.map +0 -1
- package/dist/lib/hooks.d.mts.map +0 -1
- package/dist/lib/install-dependencies.d.cts.map +0 -1
- package/dist/lib/install-dependencies.d.mts.map +0 -1
- package/dist/lib/meta.d.cts.map +0 -1
- package/dist/lib/meta.d.mts.map +0 -1
- package/dist/lib/plugins.d.cts.map +0 -1
- package/dist/lib/plugins.d.mts.map +0 -1
- package/dist/lib/resolver.d.cts.map +0 -1
- package/dist/lib/resolver.d.mts.map +0 -1
- package/dist/lib/streaming-channel.d.cts.map +0 -1
- package/dist/lib/streaming-channel.d.mts.map +0 -1
- package/dist/lib/typescript/ts-morph.d.cts.map +0 -1
- package/dist/lib/typescript/ts-morph.d.mts.map +0 -1
- package/dist/lib/typescript/tsconfig.d.cts.map +0 -1
- package/dist/lib/typescript/tsconfig.d.mts.map +0 -1
- package/dist/lib/unplugin/helpers.d.cts.map +0 -1
- package/dist/lib/unplugin/helpers.d.mts.map +0 -1
- package/dist/lib/unplugin/module-resolution.d.cts.map +0 -1
- package/dist/lib/unplugin/module-resolution.d.mts.map +0 -1
- package/dist/lib/unplugin/plugin.d.cts.map +0 -1
- package/dist/lib/unplugin/plugin.d.mts.map +0 -1
- package/dist/lib/utilities/file-header.d.cts.map +0 -1
- package/dist/lib/utilities/file-header.d.mts.map +0 -1
- package/dist/lib/utilities/format.d.cts.map +0 -1
- package/dist/lib/utilities/format.d.mts.map +0 -1
- package/dist/lib/utilities/source-file.d.cts.map +0 -1
- package/dist/lib/utilities/source-file.d.mts.map +0 -1
- package/dist/lib/utilities/source-map.d.cts.map +0 -1
- package/dist/lib/utilities/source-map.d.mts.map +0 -1
- package/dist/lib/utilities/write-file.d.cts.map +0 -1
- package/dist/lib/utilities/write-file.d.mts.map +0 -1
- package/dist/lib/vfs.d.cts.map +0 -1
- package/dist/lib/vfs.d.mts.map +0 -1
- package/dist/schemas/fs.d.cts.map +0 -1
- package/dist/schemas/fs.d.mts.map +0 -1
- package/dist/schemas/fs.mjs.map +0 -1
- package/dist/types/api.d.cts +0 -16
- package/dist/types/api.d.cts.map +0 -1
- package/dist/types/api.d.mts +0 -18
- package/dist/types/api.d.mts.map +0 -1
- package/dist/types/config.d.cts +0 -739
- package/dist/types/config.d.cts.map +0 -1
- package/dist/types/config.d.mts +0 -741
- package/dist/types/config.d.mts.map +0 -1
- package/dist/types/context.d.cts +0 -682
- package/dist/types/context.d.cts.map +0 -1
- package/dist/types/context.d.mts +0 -684
- package/dist/types/context.d.mts.map +0 -1
- package/dist/types/fs.d.cts +0 -538
- package/dist/types/fs.d.cts.map +0 -1
- package/dist/types/fs.d.mts +0 -540
- package/dist/types/fs.d.mts.map +0 -1
- package/dist/types/hooks.d.cts +0 -96
- package/dist/types/hooks.d.cts.map +0 -1
- package/dist/types/hooks.d.mts +0 -98
- package/dist/types/hooks.d.mts.map +0 -1
- package/dist/types/index.d.cts +0 -9
- package/dist/types/index.d.mts +0 -11
- package/dist/types/logging.d.cts +0 -145
- package/dist/types/logging.d.cts.map +0 -1
- package/dist/types/logging.d.mts +0 -147
- package/dist/types/logging.d.mts.map +0 -1
- package/dist/types/plugin.d.cts +0 -207
- package/dist/types/plugin.d.cts.map +0 -1
- package/dist/types/plugin.d.mts +0 -209
- package/dist/types/plugin.d.mts.map +0 -1
- package/dist/types/tsconfig.d.cts +0 -73
- package/dist/types/tsconfig.d.cts.map +0 -1
- package/dist/types/tsconfig.d.mts +0 -75
- package/dist/types/tsconfig.d.mts.map +0 -1
- package/dist/types/unplugin.d.cts +0 -22
- package/dist/types/unplugin.d.cts.map +0 -1
- package/dist/types/unplugin.d.mts +0 -24
- package/dist/types/unplugin.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.mjs","names":["#isDisposed"],"sources":["../../src/storage/base.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { appendPath } from \"@stryke/path/append\";\nimport { correctPath } from \"@stryke/path/correct-path\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { MaybePromise } from \"@stryke/types/base\";\nimport { resolve } from \"node:path\";\nimport { Context } from \"../types/context\";\nimport { StorageAdapter, StoragePreset } from \"../types/fs\";\n\nexport interface StorageAdapterOptions {\n base: string;\n isReadOnly?: boolean;\n ignore?: string | string[];\n}\n\n/**\n * Abstract base class for storage adapters, providing a template for storage operations.\n */\nexport abstract class BaseStorageAdapter<\n TOptions extends StorageAdapterOptions = StorageAdapterOptions\n> implements StorageAdapter {\n /**\n * Indicates whether the storage adapter has been disposed.\n */\n #isDisposed = false;\n\n /**\n * A name identifying the storage adapter type.\n */\n public abstract name: string;\n\n /**\n * Configuration options for the storage adapter.\n */\n public options: TOptions;\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public readonly preset?: StoragePreset | null = null;\n\n /**\n * Constructor for the BaseStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(\n protected context: Context,\n options: TOptions = { base: \"/\" } as TOptions\n ) {\n this.options = options;\n this.options.base = resolve(options.base);\n this.options.isReadOnly = !!options.isReadOnly;\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public abstract existsSync(key: string): boolean;\n\n /**\n * Asynchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns A promise that resolves to `true` if the key exists, otherwise `false`.\n */\n public async exists(key: string): Promise<boolean> {\n return this.existsSync(key);\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public abstract getSync(key: string): string | null;\n\n /**\n * Asynchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.\n */\n public async get(key: string): Promise<string | null> {\n return this.getSync(key);\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public abstract setSync(key: string, value: string): void;\n\n /**\n * Asynchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public async set(key: string, value: string): Promise<void> {\n if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) {\n this.setSync(key, value);\n }\n }\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param _ - The path of the directory to create.\n */\n public mkdirSync(_: string) {}\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public async mkdir(dirPath: string): Promise<void> {\n return Promise.resolve(this.mkdirSync(dirPath));\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public abstract removeSync(key: string): void;\n\n /**\n * Asynchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public async remove(key: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n this.removeSync(key);\n }\n }\n\n /**\n * Synchronously removes all entries from the storage that match the provided base path.\n *\n * @param base - The base path to clear keys from.\n */\n public clearSync(base?: string) {\n if (!this.isReadOnly && this.overwrite) {\n const keys = this.listSync(base || this.options.base);\n if (!keys.length) {\n return;\n }\n\n keys.map(key =>\n this.removeSync(\n base && !key.startsWith(base) ? joinPaths(base, key) : key\n )\n );\n }\n }\n\n /**\n * Asynchronously removes all entries from the storage that match the provided base path.\n *\n * @param base - The base path to clear keys from.\n * @returns A promise that resolves when the operation is complete.\n */\n public async clear(base?: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n const keys = await this.list(base || this.options.base);\n if (!keys.length) {\n return;\n }\n\n await Promise.all(\n keys.map(async key =>\n this.remove(\n base && !key.startsWith(base) ? joinPaths(base, key) : key\n )\n )\n );\n }\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public abstract listSync(base?: string): string[];\n\n /**\n * Asynchronously lists all keys under a given base path.\n *\n * @param base - The base path to list keys from.\n * @returns A promise that resolves to an array of keys under the specified base path.\n */\n public async list(base?: string): Promise<string[]> {\n return this.listSync(base);\n }\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param _ - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n public isDirectorySync(_: string): boolean {\n return false;\n }\n\n /**\n * Checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.\n */\n public async isDirectory(key: string) {\n return Promise.resolve(this.isDirectorySync(key));\n }\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n public isFileSync(key: string): boolean {\n return this.existsSync(key) && !this.isDirectorySync(key);\n }\n\n /**\n * Checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.\n */\n public async isFile(key: string) {\n return Promise.resolve(this.isFileSync(key));\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n public dispose(): MaybePromise<void> {\n return Promise.resolve();\n }\n\n /**\n * Async dispose method to clean up resources.\n *\n * @returns A promise that resolves when disposal is complete.\n */\n public async [Symbol.asyncDispose]() {\n return this._dispose();\n }\n\n /**\n * Determines if the storage adapter is read-only based on the provided options.\n *\n * @returns `true` if the storage adapter is read-only, otherwise `false`.\n */\n protected get isReadOnly() {\n return !!this.options.isReadOnly;\n }\n\n /**\n * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.\n *\n * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.\n */\n protected get overwrite() {\n return !this.isReadOnly && this.context.config.output.overwrite !== false;\n }\n\n /**\n * Resolves a given key to its full path within the storage adapter.\n *\n * @param key - The key to resolve.\n * @returns The resolved full path for the key.\n */\n protected resolve(key?: string) {\n if (!key) {\n return this.options.base;\n }\n\n if (/\\.\\.:|\\.\\.$/.test(key)) {\n throw new Error(\n `[${this.name}]: Invalid key: ${JSON.stringify(key)} provided to storage adapter.`\n );\n }\n\n return appendPath(correctPath(key).replace(/:/g, \"/\"), this.options.base);\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n protected async _dispose(): Promise<void> {\n if (!this.#isDisposed) {\n await Promise.resolve(this.dispose());\n this.#isDisposed = true;\n }\n }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,KAAK,QAAQ,CAAC;GACpC,KAAKA,cAAc;EACrB;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"base.mjs","names":["#isDisposed"],"sources":["../../src/storage/base.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { appendPath } from \"@stryke/path/append\";\nimport { correctPath } from \"@stryke/path/correct-path\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { MaybePromise } from \"@stryke/types/base\";\nimport { resolve } from \"node:path\";\nimport { Context } from \"../types/context\";\nimport { StorageAdapter, StoragePreset } from \"../types/fs\";\n\nexport interface StorageAdapterOptions {\n base: string;\n isReadOnly?: boolean;\n ignore?: string | string[];\n}\n\n/**\n * Abstract base class for storage adapters, providing a template for storage operations.\n */\nexport abstract class BaseStorageAdapter<\n TOptions extends StorageAdapterOptions = StorageAdapterOptions\n> implements StorageAdapter {\n /**\n * Indicates whether the storage adapter has been disposed.\n */\n #isDisposed = false;\n\n /**\n * A name identifying the storage adapter type.\n */\n public abstract name: string;\n\n /**\n * Configuration options for the storage adapter.\n */\n public options: TOptions;\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public readonly preset?: StoragePreset | null = null;\n\n /**\n * Constructor for the BaseStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(\n protected context: Context,\n options: TOptions = { base: \"/\" } as TOptions\n ) {\n this.options = options;\n this.options.base = resolve(options.base);\n this.options.isReadOnly = !!options.isReadOnly;\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public abstract existsSync(key: string): boolean;\n\n /**\n * Asynchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns A promise that resolves to `true` if the key exists, otherwise `false`.\n */\n public async exists(key: string): Promise<boolean> {\n return this.existsSync(key);\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public abstract getSync(key: string): string | null;\n\n /**\n * Asynchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.\n */\n public async get(key: string): Promise<string | null> {\n return this.getSync(key);\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public abstract setSync(key: string, value: string): void;\n\n /**\n * Asynchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public async set(key: string, value: string): Promise<void> {\n if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) {\n this.setSync(key, value);\n }\n }\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param _ - The path of the directory to create.\n */\n public mkdirSync(_: string) {}\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public async mkdir(dirPath: string): Promise<void> {\n return Promise.resolve(this.mkdirSync(dirPath));\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public abstract removeSync(key: string): void;\n\n /**\n * Asynchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public async remove(key: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n this.removeSync(key);\n }\n }\n\n /**\n * Synchronously removes all entries from the storage that match the provided base path.\n *\n * @param base - The base path to clear keys from.\n */\n public clearSync(base?: string) {\n if (!this.isReadOnly && this.overwrite) {\n const keys = this.listSync(base || this.options.base);\n if (!keys.length) {\n return;\n }\n\n keys.map(key =>\n this.removeSync(\n base && !key.startsWith(base) ? joinPaths(base, key) : key\n )\n );\n }\n }\n\n /**\n * Asynchronously removes all entries from the storage that match the provided base path.\n *\n * @param base - The base path to clear keys from.\n * @returns A promise that resolves when the operation is complete.\n */\n public async clear(base?: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n const keys = await this.list(base || this.options.base);\n if (!keys.length) {\n return;\n }\n\n await Promise.all(\n keys.map(async key =>\n this.remove(\n base && !key.startsWith(base) ? joinPaths(base, key) : key\n )\n )\n );\n }\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public abstract listSync(base?: string): string[];\n\n /**\n * Asynchronously lists all keys under a given base path.\n *\n * @param base - The base path to list keys from.\n * @returns A promise that resolves to an array of keys under the specified base path.\n */\n public async list(base?: string): Promise<string[]> {\n return this.listSync(base);\n }\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param _ - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n public isDirectorySync(_: string): boolean {\n return false;\n }\n\n /**\n * Checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.\n */\n public async isDirectory(key: string) {\n return Promise.resolve(this.isDirectorySync(key));\n }\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n public isFileSync(key: string): boolean {\n return this.existsSync(key) && !this.isDirectorySync(key);\n }\n\n /**\n * Checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.\n */\n public async isFile(key: string) {\n return Promise.resolve(this.isFileSync(key));\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n public dispose(): MaybePromise<void> {\n return Promise.resolve();\n }\n\n /**\n * Async dispose method to clean up resources.\n *\n * @returns A promise that resolves when disposal is complete.\n */\n public async [Symbol.asyncDispose]() {\n return this._dispose();\n }\n\n /**\n * Determines if the storage adapter is read-only based on the provided options.\n *\n * @returns `true` if the storage adapter is read-only, otherwise `false`.\n */\n protected get isReadOnly() {\n return !!this.options.isReadOnly;\n }\n\n /**\n * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.\n *\n * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.\n */\n protected get overwrite() {\n return !this.isReadOnly && this.context.config.output.overwrite !== false;\n }\n\n /**\n * Resolves a given key to its full path within the storage adapter.\n *\n * @param key - The key to resolve.\n * @returns The resolved full path for the key.\n */\n protected resolve(key?: string) {\n if (!key) {\n return this.options.base;\n }\n\n if (/\\.\\.:|\\.\\.$/.test(key)) {\n throw new Error(\n `[${this.name}]: Invalid key: ${JSON.stringify(key)} provided to storage adapter.`\n );\n }\n\n return appendPath(correctPath(key).replace(/:/g, \"/\"), this.options.base);\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n protected async _dispose(): Promise<void> {\n if (!this.#isDisposed) {\n await Promise.resolve(this.dispose());\n this.#isDisposed = true;\n }\n }\n}\n"],"mappings":";;;;;;;;;AAmCA,IAAsB,qBAAtB,MAE4B;CA+Bd;;;;CA3BZ,cAAc;;;;CAUd,AAAO;;;;;;;CAQP,AAAgB,SAAgC;;;;;;;CAQhD,AAAO,YACL,AAAU,SACV,UAAoB,EAAE,MAAM,IAAI,GAChC;EAFU;EAGV,KAAK,UAAU;EACf,KAAK,QAAQ,OAAO,QAAQ,QAAQ,IAAI;EACxC,KAAK,QAAQ,aAAa,CAAC,CAAC,QAAQ;CACtC;;;;;;;CAgBA,MAAa,OAAO,KAA+B;EACjD,OAAO,KAAK,WAAW,GAAG;CAC5B;;;;;;;CAgBA,MAAa,IAAI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AAO,WAAW,KAAsB;EACtC,OAAO,KAAK,WAAW,GAAG,KAAK,CAAC,KAAK,gBAAgB,GAAG;CAC1D;;;;;;;CAQA,MAAa,OAAO,KAAa;EAC/B,OAAO,QAAQ,QAAQ,KAAK,WAAW,GAAG,CAAC;CAC7C;;;;;;CAOA,AAAO,UAA8B;EACnC,OAAO,QAAQ,QAAQ;CACzB;;;;;;CAOA,OAAc,OAAO,gBAAgB;EACnC,OAAO,KAAK,SAAS;CACvB;;;;;;CAOA,IAAc,aAAa;EACzB,OAAO,CAAC,CAAC,KAAK,QAAQ;CACxB;;;;;;CAOA,IAAc,YAAY;EACxB,OAAO,CAAC,KAAK,cAAc,KAAK,QAAQ,OAAO,OAAO,cAAc;CACtE;;;;;;;CAQA,AAAU,QAAQ,KAAc;EAC9B,IAAI,CAAC,KACH,OAAO,KAAK,QAAQ;EAGtB,IAAI,cAAc,KAAK,GAAG,GACxB,MAAM,IAAI,MACR,IAAI,KAAK,KAAK,kBAAkB,KAAK,UAAU,GAAG,EAAE,8BACtD;EAGF,OAAO,WAAW,YAAY,GAAG,EAAE,QAAQ,MAAM,GAAG,GAAG,KAAK,QAAQ,IAAI;CAC1E;;;;;;CAOA,MAAgB,WAA0B;EACxC,IAAI,CAAC,KAAKA,aAAa;GACrB,MAAM,QAAQ,QAAQ,KAAK,QAAQ,CAAC;GACpC,KAAKA,cAAc;EACrB;CACF;AACF"}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
10
2
|
const require_lib_utilities_file_header = require('../lib/utilities/file-header.cjs');
|
|
11
3
|
const require_storage_base = require('./base.cjs');
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
import { Context } from "../types/context.mjs";
|
|
1
|
+
import { J as Context } from "../config-DboKmDhl.mjs";
|
|
4
2
|
import { BaseStorageAdapter, StorageAdapterOptions } from "./base.mjs";
|
|
5
3
|
import { writeFile, writeFileSync } from "@stryke/fs/write-file";
|
|
6
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-system.d.mts","names":[],"sources":["../../src/storage/file-system.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-system.d.mts","names":[],"sources":["../../src/storage/file-system.ts"],"mappings":";;;;;KAgCY,cAAA,GAAiB,UAAU,QAAQ,aAAA;AAAA,KACnC,UAAA,GAAa,UAAU,QAAQ,SAAA;AAD3C;;;AAAA,cAMa,wBAAA,SAAiC,kBAAA;EANc;AAC5D;;EASS,IAAA;EATgB;AAA2B;AAKpD;;;;EALyB,SAiBE,MAAA;EA4BkB;;;;;;cApBxB,OAAA,EAAS,OAAA,EAAS,OAAA,GAAU,qBAAA;EApBe;;;;;;EA8BvD,UAAA,CAAW,GAAA;EAVC;;;;;;EAoBG,MAAA,CAAO,GAAA,WAAc,OAAA;EAAA;;;;;;EAUpC,OAAA,CAAQ,GAAA;EAoBA;;;;;;EAVO,GAAA,CAAI,GAAA,WAAc,OAAA;EAuFtB;;;;;;EA7EX,OAAA,CAAQ,GAAA,UAAa,KAAA;EAgHA;;;;;;EAzEN,GAAA,CAAI,GAAA,UAAa,KAAA,WAAgB,OAAA;EAiHvC;;;;;EA3ET,UAAA,CAAW,GAAA;;;;;;EAeI,MAAA,CAAO,GAAA,WAAc,OAAA;;;;;;EAW3B,SAAA,CAAU,OAAA;;;;;;EASJ,KAAA,CAAM,OAAA,WAAkB,OAAA;;;;;;;EAUvC,QAAA,CAAS,IAAA;;;;;;;EAgBM,IAAA,CAAK,IAAA,YAAgB,OAAA;;;;;;;EAc3B,eAAA,CAAgB,GAAA;;;;;;;EAUhB,UAAA,CAAW,GAAA;AAAA"}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
import { getFileHeaderWarningText } from "../lib/utilities/file-header.mjs";
|
|
10
2
|
import { BaseStorageAdapter } from "./base.mjs";
|
|
11
3
|
import { ignoreNotfound } from "./helpers.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-system.mjs","names":[],"sources":["../../src/storage/file-system.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { exists, existsSync } from \"@stryke/fs/exists\";\nimport { createDirectory, createDirectorySync } from \"@stryke/fs/helpers\";\nimport { isDirectory, isFile } from \"@stryke/fs/is-file\";\nimport { listFiles, listFilesSync } from \"@stryke/fs/list-files\";\nimport { readFile, readFileSync } from \"@stryke/fs/read-file\";\nimport { writeFile, writeFileSync } from \"@stryke/fs/write-file\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { unlinkSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport { getFileHeaderWarningText } from \"../lib/utilities/file-header\";\nimport type { Context } from \"../types/context\";\nimport { BaseStorageAdapter, StorageAdapterOptions } from \"./base\";\nimport { ignoreNotfound } from \"./helpers\";\n\nexport type SetSyncOptions = Parameters<typeof writeFileSync>[2];\nexport type SetOptions = Parameters<typeof writeFile>[2];\n\n/**\n * File system storage adapter implementation.\n */\nexport class FileSystemStorageAdapter extends BaseStorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n public name = \"file-system\";\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public override readonly preset = \"fs\";\n\n /**\n * Constructor for the FileSystemStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(context: Context, options?: StorageAdapterOptions) {\n super(context, options);\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public existsSync(key: string): boolean {\n return existsSync(this.resolve(key));\n }\n\n /**\n * Asynchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns A promise that resolves to `true` if the key exists, otherwise `false`.\n */\n public override async exists(key: string): Promise<boolean> {\n return exists(this.resolve(key));\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public getSync(key: string): string | null {\n return readFileSync(this.resolve(key));\n }\n\n /**\n * Asynchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.\n */\n public override async get(key: string): Promise<string | null> {\n return readFile(this.resolve(key));\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public setSync(key: string, value: string) {\n if (!this.isReadOnly) {\n if (this.existsSync(this.resolve(key)) && !this.overwrite) {\n const existingValue = this.getSync(this.resolve(key));\n if (\n isSetString(existingValue) &&\n existingValue.includes(\n getFileHeaderWarningText(\n true,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n ) {\n return writeFileSync(\n this.resolve(key),\n existingValue.replace(\n getFileHeaderWarningText(\n true,\n this.context.config.framework?.name || \"powerlines\"\n ),\n getFileHeaderWarningText(\n false,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n );\n }\n } else {\n return writeFileSync(this.resolve(key), value);\n }\n }\n }\n\n /**\n * Asynchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public override async set(key: string, value: string): Promise<void> {\n if (!this.isReadOnly) {\n if (this.existsSync(this.resolve(key)) && !this.overwrite) {\n const existingValue = await this.get(this.resolve(key));\n if (\n isSetString(existingValue) &&\n existingValue.includes(\n getFileHeaderWarningText(\n true,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n ) {\n return writeFile(\n this.resolve(key),\n existingValue.replace(\n getFileHeaderWarningText(\n true,\n this.context.config.framework?.name || \"powerlines\"\n ),\n getFileHeaderWarningText(\n false,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n );\n }\n } else {\n return writeFile(this.resolve(key), value);\n }\n }\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public removeSync(key: string) {\n if (!this.isReadOnly && this.overwrite) {\n try {\n return unlinkSync(this.resolve(key));\n } catch (err) {\n return ignoreNotfound(err);\n }\n }\n }\n\n /**\n * Asynchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public override async remove(key: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n return unlink(this.resolve(key)).catch(ignoreNotfound);\n }\n }\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public override mkdirSync(dirPath: string) {\n createDirectorySync(this.resolve(dirPath));\n }\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public override async mkdir(dirPath: string): Promise<void> {\n await createDirectory(this.resolve(dirPath));\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public listSync(base?: string): string[] {\n try {\n return listFilesSync(this.resolve(base), {\n ignore: this.options.ignore\n });\n } catch (err) {\n return ignoreNotfound(err) ?? [];\n }\n }\n\n /**\n * Asynchronously lists all keys under a given base path.\n *\n * @param base - The base path to list keys from.\n * @returns A promise that resolves to an array of keys under the specified base path.\n */\n public override async list(base?: string): Promise<string[]> {\n return listFiles(this.resolve(base), {\n ignore: this.options.ignore\n })\n .catch(ignoreNotfound)\n .then(r => r || []);\n }\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n public override isDirectorySync(key: string): boolean {\n return isDirectory(this.resolve(key));\n }\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n public override isFileSync(key: string): boolean {\n return isFile(this.resolve(key));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,IAAa,2BAAb,cAA8C,mBAAmB;;;;CAI/D,AAAO,OAAO;;;;;;;CAQd,AAAyB,SAAS;;;;;;;CAQlC,AAAO,YAAY,SAAkB,SAAiC;EACpE,MAAM,SAAS,OAAO;CACxB;;;;;;;CAQA,AAAO,WAAW,KAAsB;EACtC,OAAO,WAAW,KAAK,QAAQ,GAAG,CAAC;CACrC;;;;;;;CAQA,MAAsB,OAAO,KAA+B;EAC1D,OAAO,OAAO,KAAK,QAAQ,GAAG,CAAC;CACjC;;;;;;;CAQA,AAAO,QAAQ,KAA4B;EACzC,OAAO,aAAa,KAAK,QAAQ,GAAG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WAAW,KAAK,QAAQ,GAAG,CAAC;EACrC,SAAS,KAAK;GACZ,OAAO,eAAe,GAAG;EAC3B;CAEJ;;;;;;CAOA,MAAsB,OAAO,KAA4B;EACvD,IAAI,CAAC,KAAK,cAAc,KAAK,WAC3B,OAAO,OAAO,KAAK,QAAQ,GAAG,CAAC,EAAE,MAAM,cAAc;CAEzD;;;;;;CAOA,AAAgB,UAAU,SAAiB;EACzC,oBAAoB,KAAK,QAAQ,OAAO,CAAC;CAC3C;;;;;;CAOA,MAAsB,MAAM,SAAgC;EAC1D,MAAM,gBAAgB,KAAK,QAAQ,OAAO,CAAC;CAC7C;;;;;;;CAQA,AAAO,SAAS,MAAyB;EACvC,IAAI;GACF,OAAO,cAAc,KAAK,QAAQ,IAAI,GAAG,EACvC,QAAQ,KAAK,QAAQ,OACvB,CAAC;EACH,SAAS,KAAK;GACZ,OAAO,eAAe,GAAG,KAAK,CAAC;EACjC;CACF;;;;;;;CAQA,MAAsB,KAAK,MAAkC;EAC3D,OAAO,UAAU,KAAK,QAAQ,IAAI,GAAG,EACnC,QAAQ,KAAK,QAAQ,OACvB,CAAC,EACE,MAAM,cAAc,EACpB,MAAK,MAAK,KAAK,CAAC,CAAC;CACtB;;;;;;;CAQA,AAAgB,gBAAgB,KAAsB;EACpD,OAAO,YAAY,KAAK,QAAQ,GAAG,CAAC;CACtC;;;;;;;CAQA,AAAgB,WAAW,KAAsB;EAC/C,OAAO,OAAO,KAAK,QAAQ,GAAG,CAAC;CACjC;AACF"}
|
|
1
|
+
{"version":3,"file":"file-system.mjs","names":[],"sources":["../../src/storage/file-system.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { exists, existsSync } from \"@stryke/fs/exists\";\nimport { createDirectory, createDirectorySync } from \"@stryke/fs/helpers\";\nimport { isDirectory, isFile } from \"@stryke/fs/is-file\";\nimport { listFiles, listFilesSync } from \"@stryke/fs/list-files\";\nimport { readFile, readFileSync } from \"@stryke/fs/read-file\";\nimport { writeFile, writeFileSync } from \"@stryke/fs/write-file\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { unlinkSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport { getFileHeaderWarningText } from \"../lib/utilities/file-header\";\nimport type { Context } from \"../types/context\";\nimport { BaseStorageAdapter, StorageAdapterOptions } from \"./base\";\nimport { ignoreNotfound } from \"./helpers\";\n\nexport type SetSyncOptions = Parameters<typeof writeFileSync>[2];\nexport type SetOptions = Parameters<typeof writeFile>[2];\n\n/**\n * File system storage adapter implementation.\n */\nexport class FileSystemStorageAdapter extends BaseStorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n public name = \"file-system\";\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public override readonly preset = \"fs\";\n\n /**\n * Constructor for the FileSystemStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(context: Context, options?: StorageAdapterOptions) {\n super(context, options);\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public existsSync(key: string): boolean {\n return existsSync(this.resolve(key));\n }\n\n /**\n * Asynchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns A promise that resolves to `true` if the key exists, otherwise `false`.\n */\n public override async exists(key: string): Promise<boolean> {\n return exists(this.resolve(key));\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public getSync(key: string): string | null {\n return readFileSync(this.resolve(key));\n }\n\n /**\n * Asynchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.\n */\n public override async get(key: string): Promise<string | null> {\n return readFile(this.resolve(key));\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public setSync(key: string, value: string) {\n if (!this.isReadOnly) {\n if (this.existsSync(this.resolve(key)) && !this.overwrite) {\n const existingValue = this.getSync(this.resolve(key));\n if (\n isSetString(existingValue) &&\n existingValue.includes(\n getFileHeaderWarningText(\n true,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n ) {\n return writeFileSync(\n this.resolve(key),\n existingValue.replace(\n getFileHeaderWarningText(\n true,\n this.context.config.framework?.name || \"powerlines\"\n ),\n getFileHeaderWarningText(\n false,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n );\n }\n } else {\n return writeFileSync(this.resolve(key), value);\n }\n }\n }\n\n /**\n * Asynchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public override async set(key: string, value: string): Promise<void> {\n if (!this.isReadOnly) {\n if (this.existsSync(this.resolve(key)) && !this.overwrite) {\n const existingValue = await this.get(this.resolve(key));\n if (\n isSetString(existingValue) &&\n existingValue.includes(\n getFileHeaderWarningText(\n true,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n ) {\n return writeFile(\n this.resolve(key),\n existingValue.replace(\n getFileHeaderWarningText(\n true,\n this.context.config.framework?.name || \"powerlines\"\n ),\n getFileHeaderWarningText(\n false,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n );\n }\n } else {\n return writeFile(this.resolve(key), value);\n }\n }\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public removeSync(key: string) {\n if (!this.isReadOnly && this.overwrite) {\n try {\n return unlinkSync(this.resolve(key));\n } catch (err) {\n return ignoreNotfound(err);\n }\n }\n }\n\n /**\n * Asynchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public override async remove(key: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n return unlink(this.resolve(key)).catch(ignoreNotfound);\n }\n }\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public override mkdirSync(dirPath: string) {\n createDirectorySync(this.resolve(dirPath));\n }\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public override async mkdir(dirPath: string): Promise<void> {\n await createDirectory(this.resolve(dirPath));\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public listSync(base?: string): string[] {\n try {\n return listFilesSync(this.resolve(base), {\n ignore: this.options.ignore\n });\n } catch (err) {\n return ignoreNotfound(err) ?? [];\n }\n }\n\n /**\n * Asynchronously lists all keys under a given base path.\n *\n * @param base - The base path to list keys from.\n * @returns A promise that resolves to an array of keys under the specified base path.\n */\n public override async list(base?: string): Promise<string[]> {\n return listFiles(this.resolve(base), {\n ignore: this.options.ignore\n })\n .catch(ignoreNotfound)\n .then(r => r || []);\n }\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n public override isDirectorySync(key: string): boolean {\n return isDirectory(this.resolve(key));\n }\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n public override isFileSync(key: string): boolean {\n return isFile(this.resolve(key));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAsCA,IAAa,2BAAb,cAA8C,mBAAmB;;;;CAI/D,AAAO,OAAO;;;;;;;CAQd,AAAyB,SAAS;;;;;;;CAQlC,AAAO,YA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ers.cjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
10
2
|
let _stryke_type_checks_is_error = require("@stryke/type-checks/is-error");
|
|
11
3
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/storage/helpers.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/storage/helpers.ts"],"mappings":";;AA0BA;;;;AAAoC;iBAApB,WAAA,CAAY,GAAQ;;;;AAUG;AAavC;;iBAbgB,cAAA,CAAe,GAAQ;;AAaF;;;;;iBAArB,YAAA,CAAa,GAAQ"}
|
package/dist/storage/helpers.mjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
import { isError } from "@stryke/type-checks/is-error";
|
|
10
2
|
|
|
11
3
|
//#region src/storage/helpers.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/storage/helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isError } from \"@stryke/type-checks/is-error\";\n\n/**\n * Checks if an error is a file system error.\n *\n * @param err - The error to check.\n * @returns `true` if the error is a file system error, otherwise `false`.\n */\nexport function isFileError(err: any) {\n return isError(err) && \"code\" in err && err.code;\n}\n\n/**\n * Ignores file not found errors.\n *\n * @param err - The error to check.\n * @returns `null` if the error is a file not found error, otherwise returns the error.\n */\nexport function ignoreNotfound(err: any) {\n return (\n isFileError(err) &&\n (err.code === \"ENOENT\" || err.code === \"EISDIR\" ? null : err)\n );\n}\n\n/**\n * Ignores file exists errors.\n *\n * @param err - The error to check.\n * @returns `null` if the error is a file exists error, otherwise returns the error.\n */\nexport function ignoreExists(err: any) {\n return isFileError(err) && err.code === \"EEXIST\" ? null : err;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/storage/helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isError } from \"@stryke/type-checks/is-error\";\n\n/**\n * Checks if an error is a file system error.\n *\n * @param err - The error to check.\n * @returns `true` if the error is a file system error, otherwise `false`.\n */\nexport function isFileError(err: any) {\n return isError(err) && \"code\" in err && err.code;\n}\n\n/**\n * Ignores file not found errors.\n *\n * @param err - The error to check.\n * @returns `null` if the error is a file not found error, otherwise returns the error.\n */\nexport function ignoreNotfound(err: any) {\n return (\n isFileError(err) &&\n (err.code === \"ENOENT\" || err.code === \"EISDIR\" ? null : err)\n );\n}\n\n/**\n * Ignores file exists errors.\n *\n * @param err - The error to check.\n * @returns `null` if the error is a file exists error, otherwise returns the error.\n */\nexport function ignoreExists(err: any) {\n return isFileError(err) && err.code === \"EEXIST\" ? null : err;\n}\n"],"mappings":";;;;;;;;;AA0BA,SAAgB,YAAY,KAAU;CACpC,OAAO,QAAQ,GAAG,KAAK,UAAU,OAAO,IAAI;AAC9C;;;;;;;AAQA,SAAgB,eAAe,KAAU;CACvC,OACE,YAAY,GAAG,MACd,IAAI,SAAS,YAAY,IAAI,SAAS,WAAW,OAAO;AAE7D;;;;;;;AAQA,SAAgB,aAAa,KAAU;CACrC,OAAO,YAAY,GAAG,KAAK,IAAI,SAAS,WAAW,OAAO;AAC5D"}
|
package/dist/storage/index.cjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
10
2
|
const require_storage_base = require('./base.cjs');
|
|
11
3
|
const require_storage_helpers = require('./helpers.cjs');
|
package/dist/storage/index.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
1
|
import { BaseStorageAdapter, StorageAdapterOptions } from "./base.mjs";
|
|
4
2
|
import { FileSystemStorageAdapter, SetOptions, SetSyncOptions } from "./file-system.mjs";
|
|
5
3
|
import { ignoreExists, ignoreNotfound, isFileError } from "./helpers.mjs";
|
package/dist/storage/index.mjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
import { BaseStorageAdapter } from "./base.mjs";
|
|
10
2
|
import { ignoreExists, ignoreNotfound, isFileError } from "./helpers.mjs";
|
|
11
3
|
import { FileSystemStorageAdapter } from "./file-system.mjs";
|
package/dist/storage/virtual.cjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
10
2
|
const require_storage_base = require('./base.cjs');
|
|
11
3
|
let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual.d.cts","names":[],"sources":["../../src/storage/virtual.ts"],"mappings":";;;;;;AAyBA;cAAa,qBAAA,SAA8B,kBAAA;;;;EAIlC,IAAA;EAuF0B;;;;;;EAAA,SA/ER,MAAA;EAKf;;;EAAA,UAAA,IAAA,EAAI,GAAA;EAQK;;;;;;cAAA,OAAA,EAAS,OAAA,EAAS,OAAA,GAAU,qBAAA;EA8BxC;;;;;;EApBA,UAAA,CAAW,GAAA;EAwDI;;;;AASU;;EAvDzB,OAAA,CAAQ,GAAA;;;;;;;EAUR,OAAA,CAAQ,GAAA,UAAa,KAAA;;;;;;EAWrB,UAAA,CAAW,GAAA;;;;;;;EAYX,QAAA,CAAS,IAAA;;;;;;EAaM,OAAA,
|
|
1
|
+
{"version":3,"file":"virtual.d.cts","names":[],"sources":["../../src/storage/virtual.ts"],"mappings":";;;;;;AAyBA;cAAa,qBAAA,SAA8B,kBAAA;;;;EAIlC,IAAA;EAuF0B;;;;;;EAAA,SA/ER,MAAA;EAKf;;;EAAA,UAAA,IAAA,EAAI,GAAA;EAQK;;;;;;cAAA,OAAA,EAAS,OAAA,EAAS,OAAA,GAAU,qBAAA;EA8BxC;;;;;;EApBA,UAAA,CAAW,GAAA;EAwDI;;;;AASU;;EAvDzB,OAAA,CAAQ,GAAA;;;;;;;EAUR,OAAA,CAAQ,GAAA,UAAa,KAAA;;;;;;EAWrB,UAAA,CAAW,GAAA;;;;;;;EAYX,QAAA,CAAS,IAAA;;;;;;EAaM,OAAA,IAAW,OAAA;;;;;;gBASV,SAAA;AAAA"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
import { Context } from "../types/context.mjs";
|
|
1
|
+
import { J as Context } from "../config-DboKmDhl.mjs";
|
|
4
2
|
import { BaseStorageAdapter, StorageAdapterOptions } from "./base.mjs";
|
|
5
3
|
|
|
6
4
|
//#region src/storage/virtual.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual.d.mts","names":[],"sources":["../../src/storage/virtual.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"virtual.d.mts","names":[],"sources":["../../src/storage/virtual.ts"],"mappings":";;;;;;AAyBA;cAAa,qBAAA,SAA8B,kBAAA;;;;EAIlC,IAAA;EAuF0B;;;;;;EAAA,SA/ER,MAAA;EAKf;;;EAAA,UAAA,IAAA,EAAI,GAAA;EAQK;;;;;;cAAA,OAAA,EAAS,OAAA,EAAS,OAAA,GAAU,qBAAA;EA8BxC;;;;;;EApBA,UAAA,CAAW,GAAA;EAwDI;;;;AASU;;EAvDzB,OAAA,CAAQ,GAAA;;;;;;;EAUR,OAAA,CAAQ,GAAA,UAAa,KAAA;;;;;;EAWrB,UAAA,CAAW,GAAA;;;;;;;EAYX,QAAA,CAAS,IAAA;;;;;;EAaM,OAAA,IAAW,OAAA;;;;;;gBASV,SAAA;AAAA"}
|
package/dist/storage/virtual.mjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
1
|
import { BaseStorageAdapter } from "./base.mjs";
|
|
10
2
|
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
11
3
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual.mjs","names":[],"sources":["../../src/storage/virtual.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport type { Context } from \"../types/context\";\nimport { BaseStorageAdapter, StorageAdapterOptions } from \"./base\";\n\n/**\n * Virtual/in-memory storage adapter implementation.\n */\nexport class VirtualStorageAdapter extends BaseStorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n public name = \"virtual\";\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public override readonly preset = \"virtual\";\n\n /**\n * In-memory data storage.\n */\n protected data = new Map<string, any>();\n\n /**\n * Constructor for the VirtualStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(context: Context, options?: StorageAdapterOptions) {\n super(context, options);\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public existsSync(key: string): boolean {\n return this.data.has(this.resolve(key));\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public getSync(key: string): string | null {\n return this.data.get(this.resolve(key)) ?? null;\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public setSync(key: string, value: string) {\n if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) {\n this.data.set(this.resolve(key), value);\n }\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public removeSync(key: string) {\n if (!this.isReadOnly && this.overwrite) {\n this.data.delete(this.resolve(key));\n }\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public listSync(base?: string): string[] {\n return [\n ...this.data\n .keys()\n .filter(key => (!base ? true : isParentPath(key, this.resolve(base))))\n ];\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n public override async dispose(): Promise<void> {\n return this.clear();\n }\n\n /**\n * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.\n *\n * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.\n */\n protected override get overwrite() {\n return !this.isReadOnly;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"virtual.mjs","names":[],"sources":["../../src/storage/virtual.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport type { Context } from \"../types/context\";\nimport { BaseStorageAdapter, StorageAdapterOptions } from \"./base\";\n\n/**\n * Virtual/in-memory storage adapter implementation.\n */\nexport class VirtualStorageAdapter extends BaseStorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n public name = \"virtual\";\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public override readonly preset = \"virtual\";\n\n /**\n * In-memory data storage.\n */\n protected data = new Map<string, any>();\n\n /**\n * Constructor for the VirtualStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(context: Context, options?: StorageAdapterOptions) {\n super(context, options);\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public existsSync(key: string): boolean {\n return this.data.has(this.resolve(key));\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public getSync(key: string): string | null {\n return this.data.get(this.resolve(key)) ?? null;\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public setSync(key: string, value: string) {\n if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) {\n this.data.set(this.resolve(key), value);\n }\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public removeSync(key: string) {\n if (!this.isReadOnly && this.overwrite) {\n this.data.delete(this.resolve(key));\n }\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public listSync(base?: string): string[] {\n return [\n ...this.data\n .keys()\n .filter(key => (!base ? true : isParentPath(key, this.resolve(base))))\n ];\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n public override async dispose(): Promise<void> {\n return this.clear();\n }\n\n /**\n * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.\n *\n * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.\n */\n protected override get overwrite() {\n return !this.isReadOnly;\n }\n}\n"],"mappings":";;;;;;;AAyBA,IAAa,wBAAb,cAA2C,mBAAmB;;;;CAI5D,AAAO,OAAO;;;;;;;CAQd,AAAyB,SAAS;;;;CAKlC,AAAU,uBAAO,IAAI,IAAiB;;;;;;;CAQtC,AAAO,YAAY,SAAkB,SAAiC;EACpE,MAAM,SAAS,OAAO;CACxB;;;;;;;CAQA,AAAO,WAAW,KAAsB;EACtC,OAAO,KAAK,KAAK,IAAI,KAAK,QAAQ,GAAG,CAAC;CACxC;;;;;;;CAQA,AAAO,QAAQ,KAA4B;EACzC,OAAO,KAAK,KAAK,IAAI,KAAK,QAAQ,GAAG,CAAC,KAAK;CAC7C;;;;;;;CAQA,AAAO,QAAQ,KAAa,OAAe;EACzC,IAAI,CAAC,KAAK,eAAe,CAAC,KAAK,WAAW,GAAG,KAAK,KAAK,YACrD,KAAK,KAAK,IAAI,KAAK,QAAQ,GAAG,GAAG,KAAK;CAE1C;;;;;;CAOA,AAAO,WAAW,KAAa;EAC7B,IAAI,CAAC,KAAK,cAAc,KAAK,WAC3B,KAAK,KAAK,OAAO,KAAK,QAAQ,GAAG,CAAC;CAEtC;;;;;;;CAQA,AAAO,SAAS,MAAyB;EACvC,OAAO,CACL,GAAG,KAAK,KACL,KAAK,EACL,QAAO,QAAQ,CAAC,OAAO,OAAO,aAAa,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAE,CACzE;CACF;;;;;;CAOA,MAAsB,UAAyB;EAC7C,OAAO,KAAK,MAAM;CACpB;;;;;;CAOA,IAAuB,YAAY;EACjC,OAAO,CAAC,KAAK;CACf;AACF"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { EventEmitter } from "devframe/types";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/streaming-channel.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Serialized error shape sent over the wire when a stream ends with a failure.
|
|
6
|
+
* Stays JSON-safe so the strict-JSON encoder can carry it without coercion.
|
|
7
|
+
*/
|
|
8
|
+
interface StreamErrorPayload {
|
|
9
|
+
name: string;
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Single buffered chunk in the server-side ring buffer.
|
|
14
|
+
*
|
|
15
|
+
* Sequence numbers start at 1 and increment per write. Subscribers track
|
|
16
|
+
* `lastSeenSeq` and ask for `afterSeq` on resubscribe so the server can
|
|
17
|
+
* replay any chunks the client missed during a brief disconnect.
|
|
18
|
+
*/
|
|
19
|
+
interface BufferedChunk<T> {
|
|
20
|
+
seq: number;
|
|
21
|
+
chunk: T;
|
|
22
|
+
}
|
|
23
|
+
interface StreamSinkEvents<T> {
|
|
24
|
+
/** Fired for each `write()`. The RPC layer subscribes and broadcasts. */
|
|
25
|
+
chunk: (seq: number, chunk: T) => void;
|
|
26
|
+
/** Terminal — fired exactly once per sink lifetime. */
|
|
27
|
+
end: (error?: StreamErrorPayload) => void;
|
|
28
|
+
}
|
|
29
|
+
interface CreateStreamSinkOptions {
|
|
30
|
+
id?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Size of the per-stream ring buffer kept for replay-on-resubscribe.
|
|
33
|
+
* `0` (default) disables replay.
|
|
34
|
+
*/
|
|
35
|
+
replayWindow?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Server-side producer handle. Two equivalent surfaces share one piece of
|
|
39
|
+
* state: the imperative `write/error/close` triple, and a `WritableStream<T>`
|
|
40
|
+
* for `pipeTo`-style consumption.
|
|
41
|
+
*/
|
|
42
|
+
interface StreamSink<T> {
|
|
43
|
+
/** Stable id used by clients to subscribe. */
|
|
44
|
+
readonly id: string;
|
|
45
|
+
/**
|
|
46
|
+
* Aborts when the consumer cancels (server-side) or when the transport
|
|
47
|
+
* loses every subscriber. Producers should poll `signal.aborted` and exit
|
|
48
|
+
* cleanly.
|
|
49
|
+
*/
|
|
50
|
+
readonly signal: AbortSignal;
|
|
51
|
+
/** `true` after `close()` / `error()`. Further writes throw. */
|
|
52
|
+
readonly closed: boolean;
|
|
53
|
+
/** Last allocated sequence number. `0` until the first write. */
|
|
54
|
+
readonly lastSeq: number;
|
|
55
|
+
write: (chunk: T) => void;
|
|
56
|
+
error: (reason: unknown) => void;
|
|
57
|
+
close: () => void;
|
|
58
|
+
/** External-cancel path. Aborts the signal so handlers can short-circuit. */
|
|
59
|
+
abort: (reason?: unknown) => void;
|
|
60
|
+
/** `WritableStream<T>` adapter — same in-memory state as the imperative API. */
|
|
61
|
+
readonly writable: WritableStream<T>;
|
|
62
|
+
/**
|
|
63
|
+
* Internal — RPC layer subscribes to receive chunk/end notifications.
|
|
64
|
+
* Not part of the public contract; do not call directly.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
readonly events: EventEmitter<StreamSinkEvents<T>>;
|
|
69
|
+
/**
|
|
70
|
+
* Internal — replay buffer. RPC layer reads on (re)subscribe to feed
|
|
71
|
+
* missed chunks before going live.
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
readonly buffer: ReadonlyArray<BufferedChunk<T>>;
|
|
76
|
+
}
|
|
77
|
+
interface CreateStreamReaderOptions {
|
|
78
|
+
id?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Maximum number of buffered chunks held client-side while the consumer
|
|
81
|
+
* isn't draining. On overflow, the oldest chunk is dropped.
|
|
82
|
+
*/
|
|
83
|
+
highWaterMark?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Called when the chunk queue overflows the high-water mark. The RPC
|
|
86
|
+
* layer wires this to a coded warning; the primitive itself is
|
|
87
|
+
* RPC-agnostic.
|
|
88
|
+
*/
|
|
89
|
+
onOverflow?: (dropped: number) => void;
|
|
90
|
+
/** Called when the consumer cancels — the RPC layer sends `:cancel` upstream. */
|
|
91
|
+
onCancel?: () => void;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Client-side consumer handle. Both an `AsyncIterable<T>` (for `for await`)
|
|
95
|
+
* and exposes `readable: ReadableStream<T>` (for `pipeTo`). Pick one — they
|
|
96
|
+
* share a single internal queue, so concurrent draining will race.
|
|
97
|
+
*/
|
|
98
|
+
interface StreamReader<T> extends AsyncIterable<T> {
|
|
99
|
+
readonly id: string;
|
|
100
|
+
readonly cancelled: boolean;
|
|
101
|
+
readonly done: boolean;
|
|
102
|
+
/** Highest `seq` observed. Used for replay on reconnect. */
|
|
103
|
+
readonly lastSeenSeq: number;
|
|
104
|
+
/** `ReadableStream<T>` adapter for `pipeTo`-style consumption. */
|
|
105
|
+
readonly readable: ReadableStream<T>;
|
|
106
|
+
cancel: () => void;
|
|
107
|
+
/** @internal */
|
|
108
|
+
_push: (seq: number, chunk: T) => void;
|
|
109
|
+
/** @internal */
|
|
110
|
+
_end: (error?: StreamErrorPayload) => void;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Build a server-side stream sink. RPC-agnostic — the RPC host wires
|
|
114
|
+
* `events.on('chunk' | 'end')` to broadcast, and reads `buffer` to replay
|
|
115
|
+
* for late or reconnecting subscribers.
|
|
116
|
+
*/
|
|
117
|
+
declare function createStreamSink<T>(options?: CreateStreamSinkOptions): StreamSink<T>;
|
|
118
|
+
/**
|
|
119
|
+
* Build a client-side stream reader. RPC-agnostic — the RPC host calls
|
|
120
|
+
* `_push(seq, chunk)` on each incoming chunk and `_end(error?)` on the
|
|
121
|
+
* terminal frame. Consumers iterate with `for await` or pipe `readable`.
|
|
122
|
+
*/
|
|
123
|
+
declare function createStreamReader<T>(options?: CreateStreamReaderOptions): StreamReader<T>;
|
|
124
|
+
//#endregion
|
|
125
|
+
export { StreamReader as a, createStreamReader as c, StreamErrorPayload as i, createStreamSink as l, CreateStreamReaderOptions as n, StreamSink as o, CreateStreamSinkOptions as r, StreamSinkEvents as s, BufferedChunk as t };
|
|
126
|
+
//# sourceMappingURL=streaming-channel-CiyFd_6l.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming-channel-CiyFd_6l.d.cts","names":[],"sources":["../src/lib/streaming-channel.ts"],"mappings":";;;;;AA0BA;;UAAiB,kBAAA;EACf,IAAA;EACA,OAAO;AAAA;;;;;;;;UAUQ,aAAA;EACf,GAAA;EACA,KAAA,EAAO,CAAC;AAAA;AAAA,UAGO,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ventEmitter } from "devframe/types";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/streaming-channel.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Serialized error shape sent over the wire when a stream ends with a failure.
|
|
6
|
+
* Stays JSON-safe so the strict-JSON encoder can carry it without coercion.
|
|
7
|
+
*/
|
|
8
|
+
interface StreamErrorPayload {
|
|
9
|
+
name: string;
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Single buffered chunk in the server-side ring buffer.
|
|
14
|
+
*
|
|
15
|
+
* Sequence numbers start at 1 and increment per write. Subscribers track
|
|
16
|
+
* `lastSeenSeq` and ask for `afterSeq` on resubscribe so the server can
|
|
17
|
+
* replay any chunks the client missed during a brief disconnect.
|
|
18
|
+
*/
|
|
19
|
+
interface BufferedChunk<T> {
|
|
20
|
+
seq: number;
|
|
21
|
+
chunk: T;
|
|
22
|
+
}
|
|
23
|
+
interface StreamSinkEvents<T> {
|
|
24
|
+
/** Fired for each `write()`. The RPC layer subscribes and broadcasts. */
|
|
25
|
+
chunk: (seq: number, chunk: T) => void;
|
|
26
|
+
/** Terminal — fired exactly once per sink lifetime. */
|
|
27
|
+
end: (error?: StreamErrorPayload) => void;
|
|
28
|
+
}
|
|
29
|
+
interface CreateStreamSinkOptions {
|
|
30
|
+
id?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Size of the per-stream ring buffer kept for replay-on-resubscribe.
|
|
33
|
+
* `0` (default) disables replay.
|
|
34
|
+
*/
|
|
35
|
+
replayWindow?: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Server-side producer handle. Two equivalent surfaces share one piece of
|
|
39
|
+
* state: the imperative `write/error/close` triple, and a `WritableStream<T>`
|
|
40
|
+
* for `pipeTo`-style consumption.
|
|
41
|
+
*/
|
|
42
|
+
interface StreamSink<T> {
|
|
43
|
+
/** Stable id used by clients to subscribe. */
|
|
44
|
+
readonly id: string;
|
|
45
|
+
/**
|
|
46
|
+
* Aborts when the consumer cancels (server-side) or when the transport
|
|
47
|
+
* loses every subscriber. Producers should poll `signal.aborted` and exit
|
|
48
|
+
* cleanly.
|
|
49
|
+
*/
|
|
50
|
+
readonly signal: AbortSignal;
|
|
51
|
+
/** `true` after `close()` / `error()`. Further writes throw. */
|
|
52
|
+
readonly closed: boolean;
|
|
53
|
+
/** Last allocated sequence number. `0` until the first write. */
|
|
54
|
+
readonly lastSeq: number;
|
|
55
|
+
write: (chunk: T) => void;
|
|
56
|
+
error: (reason: unknown) => void;
|
|
57
|
+
close: () => void;
|
|
58
|
+
/** External-cancel path. Aborts the signal so handlers can short-circuit. */
|
|
59
|
+
abort: (reason?: unknown) => void;
|
|
60
|
+
/** `WritableStream<T>` adapter — same in-memory state as the imperative API. */
|
|
61
|
+
readonly writable: WritableStream<T>;
|
|
62
|
+
/**
|
|
63
|
+
* Internal — RPC layer subscribes to receive chunk/end notifications.
|
|
64
|
+
* Not part of the public contract; do not call directly.
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
readonly events: EventEmitter<StreamSinkEvents<T>>;
|
|
69
|
+
/**
|
|
70
|
+
* Internal — replay buffer. RPC layer reads on (re)subscribe to feed
|
|
71
|
+
* missed chunks before going live.
|
|
72
|
+
*
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
readonly buffer: ReadonlyArray<BufferedChunk<T>>;
|
|
76
|
+
}
|
|
77
|
+
interface CreateStreamReaderOptions {
|
|
78
|
+
id?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Maximum number of buffered chunks held client-side while the consumer
|
|
81
|
+
* isn't draining. On overflow, the oldest chunk is dropped.
|
|
82
|
+
*/
|
|
83
|
+
highWaterMark?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Called when the chunk queue overflows the high-water mark. The RPC
|
|
86
|
+
* layer wires this to a coded warning; the primitive itself is
|
|
87
|
+
* RPC-agnostic.
|
|
88
|
+
*/
|
|
89
|
+
onOverflow?: (dropped: number) => void;
|
|
90
|
+
/** Called when the consumer cancels — the RPC layer sends `:cancel` upstream. */
|
|
91
|
+
onCancel?: () => void;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Client-side consumer handle. Both an `AsyncIterable<T>` (for `for await`)
|
|
95
|
+
* and exposes `readable: ReadableStream<T>` (for `pipeTo`). Pick one — they
|
|
96
|
+
* share a single internal queue, so concurrent draining will race.
|
|
97
|
+
*/
|
|
98
|
+
interface StreamReader<T> extends AsyncIterable<T> {
|
|
99
|
+
readonly id: string;
|
|
100
|
+
readonly cancelled: boolean;
|
|
101
|
+
readonly done: boolean;
|
|
102
|
+
/** Highest `seq` observed. Used for replay on reconnect. */
|
|
103
|
+
readonly lastSeenSeq: number;
|
|
104
|
+
/** `ReadableStream<T>` adapter for `pipeTo`-style consumption. */
|
|
105
|
+
readonly readable: ReadableStream<T>;
|
|
106
|
+
cancel: () => void;
|
|
107
|
+
/** @internal */
|
|
108
|
+
_push: (seq: number, chunk: T) => void;
|
|
109
|
+
/** @internal */
|
|
110
|
+
_end: (error?: StreamErrorPayload) => void;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Build a server-side stream sink. RPC-agnostic — the RPC host wires
|
|
114
|
+
* `events.on('chunk' | 'end')` to broadcast, and reads `buffer` to replay
|
|
115
|
+
* for late or reconnecting subscribers.
|
|
116
|
+
*/
|
|
117
|
+
declare function createStreamSink<T>(options?: CreateStreamSinkOptions): StreamSink<T>;
|
|
118
|
+
/**
|
|
119
|
+
* Build a client-side stream reader. RPC-agnostic — the RPC host calls
|
|
120
|
+
* `_push(seq, chunk)` on each incoming chunk and `_end(error?)` on the
|
|
121
|
+
* terminal frame. Consumers iterate with `for await` or pipe `readable`.
|
|
122
|
+
*/
|
|
123
|
+
declare function createStreamReader<T>(options?: CreateStreamReaderOptions): StreamReader<T>;
|
|
124
|
+
//#endregion
|
|
125
|
+
export { StreamReader as a, createStreamReader as c, StreamErrorPayload as i, createStreamSink as l, CreateStreamReaderOptions as n, StreamSink as o, CreateStreamSinkOptions as r, StreamSinkEvents as s, BufferedChunk as t };
|
|
126
|
+
//# sourceMappingURL=streaming-channel-CiyFd_6l.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streaming-channel-CiyFd_6l.d.mts","names":[],"sources":["../src/lib/streaming-channel.ts"],"mappings":";;;;;AA0BA;;UAAiB,kBAAA;EACf,IAAA;EACA,OAAO;AAAA;;;;;;;;UAUQ,aAAA;EACf,GAAA;EACA,KAAA,EAAO,CAAC;AAAA;AAAA,UAGO,gBAAA;EAIiB;EAFhC,KAAA,GAAQ,GAAA,UAAa,KAAA,EAAO,CAAA;EAA5B;EAEA,GAAA,GAAM,KAAA,GAAQ,kBAAkB;AAAA;AAAA,UAGjB,uBAAA;EACf,EAAA;EAJc;;;AAAkB;EAShC,YAAY;AAAA;;;AAAA;AAQd;;UAAiB,UAAA;EAQE;EAAA,SANR,EAAA;EAmByB;;;;;EAAA,SAbzB,MAAA,EAAQ,WAAA;EA6Bc;EAAA,SA3BtB,MAAA;EA2BqB;EAAA,SAzBrB,OAAA;EAET,KAAA,GAAQ,KAAA,EAAO,CAAA;EACf,KAAA,GAAQ,MAAA;EACR,KAAA;EARiB;EAUjB,KAAA,GAAQ,MAAA;EANC;EAAA,SASA,QAAA,EAAU,cAAA,CAAe,CAAA;EAPnB;;;;;;EAAA,SAeN,MAAA,EAAQ,YAAA,CAAa,gBAAA,CAAiB,CAAA;EARtC;;;;;;EAAA,SAgBA,MAAA,EAAQ,aAAA,CAAc,aAAA,CAAc,CAAA;AAAA;AAAA,UAG9B,yBAAA;EACf,EAAA;EAJ6C;;AAAC;AAGhD;EAME,aAAA;;;;;;EAMA,UAAA,IAAc,OAAA;EAEd;EAAA,QAAA;AAAA;AAQF;;;;;AAAA,UAAiB,YAAA,YAAwB,aAAA,CAAc,CAAA;EAAA,SAC5C,EAAA;EAAA,SACA,SAAA;EAAA,SACA,IAAA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