@zudojs/http 0.0.1
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/README.md +41 -0
- package/dist/httpAdapter/fetch/httpFetch.body.d.ts +20 -0
- package/dist/httpAdapter/fetch/httpFetch.body.d.ts.map +1 -0
- package/dist/httpAdapter/fetch/httpFetch.body.js +57 -0
- package/dist/httpAdapter/fetch/httpFetch.body.js.map +1 -0
- package/dist/httpAdapter/fetch/httpFetch.helper.d.ts.map +1 -0
- package/dist/httpAdapter/fetch/httpFetch.requestContext.d.ts.map +1 -0
- package/dist/httpAdapter/fetch/httpFetch.responseWriter.d.ts.map +1 -0
- package/dist/httpAdapter/fetch/httpFetch.type.d.ts.map +1 -0
- package/dist/httpAdapter/fetch/index.d.ts.map +1 -0
- package/dist/httpAdapter/http.adapter.d.ts +116 -0
- package/dist/httpAdapter/http.adapter.d.ts.map +1 -0
- package/dist/httpAdapter/http.adapter.js +284 -0
- package/dist/httpAdapter/http.adapter.js.map +1 -0
- package/dist/httpAdapter/http.adapters.d.ts.map +1 -0
- package/dist/httpAdapter/http.adapters.js +137 -0
- package/dist/httpAdapter/http.adapters.js.map +1 -0
- package/dist/httpAdapter/httpFetch.adapter.d.ts.map +1 -0
- package/dist/httpAdapter/index.d.ts +10 -0
- package/dist/httpAdapter/index.d.ts.map +1 -0
- package/dist/httpAdapter/index.js +10 -0
- package/dist/httpAdapter/index.js.map +1 -0
- package/dist/httpAdapter/node/httpNode.adapter.d.ts +42 -0
- package/dist/httpAdapter/node/httpNode.adapter.d.ts.map +1 -0
- package/dist/httpAdapter/node/httpNode.adapter.js +221 -0
- package/dist/httpAdapter/node/httpNode.adapter.js.map +1 -0
- package/dist/httpAdapter/node/httpNode.request.d.ts.map +1 -0
- package/dist/httpAdapter/node/httpNode.response.d.ts.map +1 -0
- package/dist/httpAdapter/node/httpNode.server.d.ts +39 -0
- package/dist/httpAdapter/node/httpNode.server.d.ts.map +1 -0
- package/dist/httpAdapter/node/httpNode.server.js +228 -0
- package/dist/httpAdapter/node/httpNode.server.js.map +1 -0
- package/dist/httpAdapter/node/httpNode.type.d.ts.map +1 -0
- package/dist/httpAdapter/node/index.d.ts +11 -0
- package/dist/httpAdapter/node/index.d.ts.map +1 -0
- package/dist/httpAdapter/node/index.js +11 -0
- package/dist/httpAdapter/node/index.js.map +1 -0
- package/dist/httpAgent/http.agent.d.ts.map +1 -0
- package/dist/httpAgent/index.d.ts +7 -0
- package/dist/httpAgent/index.d.ts.map +1 -0
- package/dist/httpAgent/index.js +7 -0
- package/dist/httpAgent/index.js.map +1 -0
- package/dist/httpBody/http.body.d.ts +36 -0
- package/dist/httpBody/http.body.d.ts.map +1 -0
- package/dist/httpBody/http.body.js +245 -0
- package/dist/httpBody/http.body.js.map +1 -0
- package/dist/httpBody/httpBody.formData.d.ts +48 -0
- package/dist/httpBody/httpBody.formData.d.ts.map +1 -0
- package/dist/httpBody/httpBody.formData.js +366 -0
- package/dist/httpBody/httpBody.formData.js.map +1 -0
- package/dist/httpBody/httpBody.parser.d.ts +44 -0
- package/dist/httpBody/httpBody.parser.d.ts.map +1 -0
- package/dist/httpBody/httpBody.parser.js +233 -0
- package/dist/httpBody/httpBody.parser.js.map +1 -0
- package/dist/httpBody/index.d.ts +9 -0
- package/dist/httpBody/index.d.ts.map +1 -0
- package/dist/httpBody/index.js +9 -0
- package/dist/httpBody/index.js.map +1 -0
- package/dist/httpCacheControl/core/httpCacheControl.parse.d.ts.map +1 -0
- package/dist/httpCacheControl/core/httpCacheControl.type.d.ts.map +1 -0
- package/dist/httpCacheControl/core/httpCacheControl.validation.d.ts.map +1 -0
- package/dist/httpCacheControl/core/index.d.ts.map +1 -0
- package/dist/httpCacheControl/httpCacheControl.core.d.ts.map +1 -0
- package/dist/httpCacheControl/httpCacheControl.factory.d.ts.map +1 -0
- package/dist/httpCacheControl/httpCacheControl.freshness.d.ts.map +1 -0
- package/dist/httpCacheControl/httpCacheControl.requestHelper.d.ts.map +1 -0
- package/dist/httpCacheControl/httpCacheControl.responseHelper.d.ts.map +1 -0
- package/dist/httpCacheControl/index.d.ts +7 -0
- package/dist/httpCacheControl/index.d.ts.map +1 -0
- package/dist/httpCacheControl/index.js +7 -0
- package/dist/httpCacheControl/index.js.map +1 -0
- package/dist/httpClient/httpClient.abort.d.ts.map +1 -0
- package/dist/httpClient/httpClient.body.d.ts.map +1 -0
- package/dist/httpClient/httpClient.client.d.ts.map +1 -0
- package/dist/httpClient/httpClient.context.d.ts.map +1 -0
- package/dist/httpClient/httpClient.error.d.ts +9 -0
- package/dist/httpClient/httpClient.error.d.ts.map +1 -0
- package/dist/httpClient/httpClient.error.js +9 -0
- package/dist/httpClient/httpClient.error.js.map +1 -0
- package/dist/httpClient/httpClient.errorNormalizer.d.ts.map +1 -0
- package/dist/httpClient/httpClient.executor.d.ts.map +1 -0
- package/dist/httpClient/httpClient.factory.d.ts.map +1 -0
- package/dist/httpClient/httpClient.headers.d.ts.map +1 -0
- package/dist/httpClient/httpClient.helpers.d.ts.map +1 -0
- package/dist/httpClient/httpClient.interceptors.d.ts.map +1 -0
- package/dist/httpClient/httpClient.methods.d.ts.map +1 -0
- package/dist/httpClient/httpClient.response.d.ts.map +1 -0
- package/dist/httpClient/httpClient.retry.d.ts +38 -0
- package/dist/httpClient/httpClient.retry.d.ts.map +1 -0
- package/dist/httpClient/httpClient.retry.js +61 -0
- package/dist/httpClient/httpClient.retry.js.map +1 -0
- package/dist/httpClient/httpClient.type.d.ts.map +1 -0
- package/dist/httpClient/httpClient.typeGuards.d.ts.map +1 -0
- package/dist/httpClient/httpClient.url.d.ts.map +1 -0
- package/dist/httpClient/index.d.ts +17 -0
- package/dist/httpClient/index.d.ts.map +1 -0
- package/dist/httpClient/index.js +17 -0
- package/dist/httpClient/index.js.map +1 -0
- package/dist/httpCompression/http.compression.d.ts.map +1 -0
- package/dist/httpCompression/index.d.ts +7 -0
- package/dist/httpCompression/index.d.ts.map +1 -0
- package/dist/httpCompression/index.js +7 -0
- package/dist/httpCompression/index.js.map +1 -0
- package/dist/httpConditional/httpConditional.core.d.ts.map +1 -0
- package/dist/httpConditional/index.d.ts +7 -0
- package/dist/httpConditional/index.d.ts.map +1 -0
- package/dist/httpConditional/index.js +7 -0
- package/dist/httpConditional/index.js.map +1 -0
- package/dist/httpConstants/http.constants.d.ts +171 -0
- package/dist/httpConstants/http.constants.d.ts.map +1 -0
- package/dist/httpConstants/http.constants.js +294 -0
- package/dist/httpConstants/http.constants.js.map +1 -0
- package/dist/httpConstants/index.d.ts +7 -0
- package/dist/httpConstants/index.d.ts.map +1 -0
- package/dist/httpConstants/index.js +7 -0
- package/dist/httpConstants/index.js.map +1 -0
- package/dist/httpContentDisposition/httpContentDisposition.core.d.ts.map +1 -0
- package/dist/httpContentDisposition/index.d.ts +7 -0
- package/dist/httpContentDisposition/index.d.ts.map +1 -0
- package/dist/httpContentDisposition/index.js +7 -0
- package/dist/httpContentDisposition/index.js.map +1 -0
- package/dist/httpContentType/httpContentType.boundary.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.category.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.categoryBinary.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.charset.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.constructors.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.formatter.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.matcher.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.mediaTypes.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.normalizer.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.parameter.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.parser.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.parserHelpers.d.ts.map +1 -0
- package/dist/httpContentType/httpContentType.type.d.ts.map +1 -0
- package/dist/httpContentType/index.d.ts +19 -0
- package/dist/httpContentType/index.d.ts.map +1 -0
- package/dist/httpContentType/index.js +19 -0
- package/dist/httpContentType/index.js.map +1 -0
- package/dist/httpContext/http.context.d.ts +45 -0
- package/dist/httpContext/http.context.d.ts.map +1 -0
- package/dist/httpContext/http.context.js +157 -0
- package/dist/httpContext/http.context.js.map +1 -0
- package/dist/httpContext/index.d.ts +7 -0
- package/dist/httpContext/index.d.ts.map +1 -0
- package/dist/httpContext/index.js +7 -0
- package/dist/httpContext/index.js.map +1 -0
- package/dist/httpCookies/http.cookies.d.ts.map +1 -0
- package/dist/httpCookies/index.d.ts +7 -0
- package/dist/httpCookies/index.d.ts.map +1 -0
- package/dist/httpCookies/index.js +7 -0
- package/dist/httpCookies/index.js.map +1 -0
- package/dist/httpCors/http.cors.d.ts.map +1 -0
- package/dist/httpCors/index.d.ts +7 -0
- package/dist/httpCors/index.d.ts.map +1 -0
- package/dist/httpCors/index.js +7 -0
- package/dist/httpCors/index.js.map +1 -0
- package/dist/httpCsp/checks/httpCsp.checks.d.ts.map +1 -0
- package/dist/httpCsp/checks/index.d.ts.map +1 -0
- package/dist/httpCsp/formatting/httpCsp.formatting.d.ts.map +1 -0
- package/dist/httpCsp/formatting/index.d.ts.map +1 -0
- package/dist/httpCsp/index.d.ts +19 -0
- package/dist/httpCsp/index.d.ts.map +1 -0
- package/dist/httpCsp/index.js +17 -0
- package/dist/httpCsp/index.js.map +1 -0
- package/dist/httpCsp/internal/httpCsp.internal.d.ts.map +1 -0
- package/dist/httpCsp/internal/index.d.ts.map +1 -0
- package/dist/httpCsp/nonce/httpCsp.nonce.d.ts.map +1 -0
- package/dist/httpCsp/nonce/index.d.ts.map +1 -0
- package/dist/httpCsp/parsing/httpCsp.parsing.d.ts.map +1 -0
- package/dist/httpCsp/parsing/index.d.ts.map +1 -0
- package/dist/httpCsp/policies/httpCsp.policies.d.ts.map +1 -0
- package/dist/httpCsp/policies/index.d.ts.map +1 -0
- package/dist/httpCsp/reportOnly/httpCsp.reportOnly.d.ts.map +1 -0
- package/dist/httpCsp/reportOnly/index.d.ts.map +1 -0
- package/dist/httpCsp/sources/httpCsp.sources.d.ts.map +1 -0
- package/dist/httpCsp/sources/index.d.ts.map +1 -0
- package/dist/httpCsp/types/httpCsp.constant.d.ts.map +1 -0
- package/dist/httpCsp/types/httpCsp.type.d.ts.map +1 -0
- package/dist/httpCsp/types/index.d.ts.map +1 -0
- package/dist/httpCsp/validation/httpCsp.validate.d.ts.map +1 -0
- package/dist/httpCsp/validation/httpCsp.validation.d.ts.map +1 -0
- package/dist/httpCsp/validation/index.d.ts.map +1 -0
- package/dist/httpErrors/factories/httpError.clientError.d.ts.map +1 -0
- package/dist/httpErrors/factories/httpError.serverError.d.ts.map +1 -0
- package/dist/httpErrors/httpError.base.d.ts +42 -0
- package/dist/httpErrors/httpError.base.d.ts.map +1 -0
- package/dist/httpErrors/httpError.base.js +73 -0
- package/dist/httpErrors/httpError.base.js.map +1 -0
- package/dist/httpErrors/httpError.helper.d.ts.map +1 -0
- package/dist/httpErrors/httpError.invalidJson.d.ts.map +1 -0
- package/dist/httpErrors/httpError.type.d.ts +69 -0
- package/dist/httpErrors/httpError.type.d.ts.map +1 -0
- package/dist/httpErrors/httpError.type.js +7 -0
- package/dist/httpErrors/httpError.type.js.map +1 -0
- package/dist/httpErrors/httpError.typeGuard.d.ts.map +1 -0
- package/dist/httpErrors/index.d.ts +13 -0
- package/dist/httpErrors/index.d.ts.map +1 -0
- package/dist/httpErrors/index.js +13 -0
- package/dist/httpErrors/index.js.map +1 -0
- package/dist/httpFormData/index.d.ts +7 -0
- package/dist/httpFormData/index.d.ts.map +1 -0
- package/dist/httpFormData/index.js +7 -0
- package/dist/httpFormData/index.js.map +1 -0
- package/dist/httpHeaders/authorization/httpHeaders.authorization.d.ts.map +1 -0
- package/dist/httpHeaders/authorization/index.d.ts +8 -0
- package/dist/httpHeaders/authorization/index.d.ts.map +1 -0
- package/dist/httpHeaders/authorization/index.js +8 -0
- package/dist/httpHeaders/authorization/index.js.map +1 -0
- package/dist/httpHeaders/basic/httpHeaders.basic.d.ts.map +1 -0
- package/dist/httpHeaders/basic/httpHeaders.basicMatch.d.ts.map +1 -0
- package/dist/httpHeaders/basic/index.d.ts +8 -0
- package/dist/httpHeaders/basic/index.d.ts.map +1 -0
- package/dist/httpHeaders/basic/index.js +8 -0
- package/dist/httpHeaders/basic/index.js.map +1 -0
- package/dist/httpHeaders/cacheControl/httpHeaders.cacheControl.d.ts.map +1 -0
- package/dist/httpHeaders/cacheControl/httpHeaders.cacheControlBuilder.d.ts.map +1 -0
- package/dist/httpHeaders/cacheControl/httpHeaders.cacheControlParse.d.ts.map +1 -0
- package/dist/httpHeaders/cacheControl/httpHeaders.cacheControlTokens.d.ts.map +1 -0
- package/dist/httpHeaders/cacheControl/index.d.ts +10 -0
- package/dist/httpHeaders/cacheControl/index.d.ts.map +1 -0
- package/dist/httpHeaders/cacheControl/index.js +10 -0
- package/dist/httpHeaders/cacheControl/index.js.map +1 -0
- package/dist/httpHeaders/conversion/httpHeaders.conversion.d.ts.map +1 -0
- package/dist/httpHeaders/conversion/httpHeaders.conversionObject.d.ts.map +1 -0
- package/dist/httpHeaders/conversion/index.d.ts +8 -0
- package/dist/httpHeaders/conversion/index.d.ts.map +1 -0
- package/dist/httpHeaders/conversion/index.js +8 -0
- package/dist/httpHeaders/conversion/index.js.map +1 -0
- package/dist/httpHeaders/date/httpHeaders.date.d.ts.map +1 -0
- package/dist/httpHeaders/date/index.d.ts +8 -0
- package/dist/httpHeaders/date/index.d.ts.map +1 -0
- package/dist/httpHeaders/date/index.js +8 -0
- package/dist/httpHeaders/date/index.js.map +1 -0
- package/dist/httpHeaders/etag/httpHeaders.etag.d.ts.map +1 -0
- package/dist/httpHeaders/etag/httpHeaders.etagMatch.d.ts.map +1 -0
- package/dist/httpHeaders/etag/index.d.ts +8 -0
- package/dist/httpHeaders/etag/index.d.ts.map +1 -0
- package/dist/httpHeaders/etag/index.js +8 -0
- package/dist/httpHeaders/etag/index.js.map +1 -0
- package/dist/httpHeaders/forwarded/httpHeaders.forwarded.d.ts.map +1 -0
- package/dist/httpHeaders/forwarded/index.d.ts +8 -0
- package/dist/httpHeaders/forwarded/index.d.ts.map +1 -0
- package/dist/httpHeaders/forwarded/index.js +8 -0
- package/dist/httpHeaders/forwarded/index.js.map +1 -0
- package/dist/httpHeaders/http.headers.d.ts.map +1 -0
- package/dist/httpHeaders/index.d.ts +14 -0
- package/dist/httpHeaders/index.d.ts.map +1 -0
- package/dist/httpHeaders/index.js +14 -0
- package/dist/httpHeaders/index.js.map +1 -0
- package/dist/httpHeaders/internal/httpHeaders.internal.cacheControl.d.ts.map +1 -0
- package/dist/httpHeaders/internal/httpHeaders.internal.mediaType.d.ts.map +1 -0
- package/dist/httpHeaders/internal/httpHeaders.internal.specificity.d.ts.map +1 -0
- package/dist/httpHeaders/internal/httpHeaders.internal.typeGuards.d.ts.map +1 -0
- package/dist/httpHeaders/internal/httpHeaders.internal.weightedValues.d.ts.map +1 -0
- package/dist/httpHeaders/internal/index.d.ts +12 -0
- package/dist/httpHeaders/internal/index.d.ts.map +1 -0
- package/dist/httpHeaders/internal/index.js +12 -0
- package/dist/httpHeaders/internal/index.js.map +1 -0
- package/dist/httpHeaders/list/httpHeaders.list.d.ts.map +1 -0
- package/dist/httpHeaders/list/httpHeaders.listMutation.d.ts.map +1 -0
- package/dist/httpHeaders/list/index.d.ts +8 -0
- package/dist/httpHeaders/list/index.d.ts.map +1 -0
- package/dist/httpHeaders/list/index.js +8 -0
- package/dist/httpHeaders/list/index.js.map +1 -0
- package/dist/httpHeaders/negotiation/httpHeaders.contentNegotiation.d.ts.map +1 -0
- package/dist/httpHeaders/negotiation/httpHeaders.contentNegotiationSelect.d.ts.map +1 -0
- package/dist/httpHeaders/negotiation/httpHeaders.encodingNegotiation.d.ts.map +1 -0
- package/dist/httpHeaders/negotiation/httpHeaders.encodingNegotiationSelect.d.ts.map +1 -0
- package/dist/httpHeaders/negotiation/httpHeaders.languageNegotiation.d.ts.map +1 -0
- package/dist/httpHeaders/negotiation/index.d.ts +11 -0
- package/dist/httpHeaders/negotiation/index.d.ts.map +1 -0
- package/dist/httpHeaders/negotiation/index.js +11 -0
- package/dist/httpHeaders/negotiation/index.js.map +1 -0
- package/dist/httpHeaders/range/httpHeaders.contentRange.d.ts.map +1 -0
- package/dist/httpHeaders/range/httpHeaders.contentRangeParse.d.ts.map +1 -0
- package/dist/httpHeaders/range/httpHeaders.range.d.ts.map +1 -0
- package/dist/httpHeaders/range/httpHeaders.rangeResolution.d.ts.map +1 -0
- package/dist/httpHeaders/range/httpHeaders.rangeSingle.d.ts.map +1 -0
- package/dist/httpHeaders/range/index.d.ts +11 -0
- package/dist/httpHeaders/range/index.d.ts.map +1 -0
- package/dist/httpHeaders/range/index.js +11 -0
- package/dist/httpHeaders/range/index.js.map +1 -0
- package/dist/httpHeaders/security/httpHeaders.security.d.ts.map +1 -0
- package/dist/httpHeaders/security/index.d.ts +8 -0
- package/dist/httpHeaders/security/index.d.ts.map +1 -0
- package/dist/httpHeaders/security/index.js +8 -0
- package/dist/httpHeaders/security/index.js.map +1 -0
- package/dist/httpHeaders/types/httpHeaders.type.d.ts.map +1 -0
- package/dist/httpHeaders/types/index.d.ts +7 -0
- package/dist/httpHeaders/types/index.d.ts.map +1 -0
- package/dist/httpHeaders/types/index.js +7 -0
- package/dist/httpHeaders/types/index.js.map +1 -0
- package/dist/httpHsts/http.hsts.d.ts.map +1 -0
- package/dist/httpHsts/index.d.ts +7 -0
- package/dist/httpHsts/index.d.ts.map +1 -0
- package/dist/httpHsts/index.js +7 -0
- package/dist/httpHsts/index.js.map +1 -0
- package/dist/httpInterceptors/builtin/httpInterceptor.request.d.ts.map +1 -0
- package/dist/httpInterceptors/builtin/httpInterceptor.request.js +79 -0
- package/dist/httpInterceptors/builtin/httpInterceptor.request.js.map +1 -0
- package/dist/httpInterceptors/builtin/httpInterceptor.response.d.ts.map +1 -0
- package/dist/httpInterceptors/builtin/index.d.ts.map +1 -0
- package/dist/httpInterceptors/http.interceptors.d.ts.map +1 -0
- package/dist/httpInterceptors/httpInterceptor.helper.d.ts.map +1 -0
- package/dist/httpInterceptors/httpInterceptor.middleware.d.ts.map +1 -0
- package/dist/httpInterceptors/httpInterceptor.type.d.ts.map +1 -0
- package/dist/httpInterceptors/index.d.ts +7 -0
- package/dist/httpInterceptors/index.d.ts.map +1 -0
- package/dist/httpInterceptors/index.js +7 -0
- package/dist/httpInterceptors/index.js.map +1 -0
- package/dist/httpInterceptors/manager/httpInterceptor.lookup.d.ts.map +1 -0
- package/dist/httpInterceptors/manager/httpInterceptor.manager.d.ts.map +1 -0
- package/dist/httpInterceptors/manager/httpInterceptor.registration.d.ts.map +1 -0
- package/dist/httpInterceptors/manager/httpInterceptor.snapshot.d.ts.map +1 -0
- package/dist/httpInterceptors/manager/index.d.ts.map +1 -0
- package/dist/httpKeepAlive/httpKeepAlive.core.d.ts.map +1 -0
- package/dist/httpKeepAlive/index.d.ts +7 -0
- package/dist/httpKeepAlive/index.d.ts.map +1 -0
- package/dist/httpKeepAlive/index.js +7 -0
- package/dist/httpKeepAlive/index.js.map +1 -0
- package/dist/httpMethods/http.methods.d.ts.map +1 -0
- package/dist/httpMethods/index.d.ts +7 -0
- package/dist/httpMethods/index.d.ts.map +1 -0
- package/dist/httpMethods/index.js +7 -0
- package/dist/httpMethods/index.js.map +1 -0
- package/dist/httpMiddleware/builtin/compose/httpMiddleware.compose.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/compose/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/conditional/httpMiddleware.conditional.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/conditional/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/cors/httpMiddleware.cors.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/cors/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/helpers/httpMiddleware.accessor.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/helpers/httpMiddleware.accessor.js +52 -0
- package/dist/httpMiddleware/builtin/helpers/httpMiddleware.accessor.js.map +1 -0
- package/dist/httpMiddleware/builtin/helpers/httpMiddleware.contextHelper.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/helpers/httpMiddleware.normalizer.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/helpers/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/image/httpMiddleware.image.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/image/index.d.ts +7 -0
- package/dist/httpMiddleware/builtin/image/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/image/index.js +7 -0
- package/dist/httpMiddleware/builtin/image/index.js.map +1 -0
- package/dist/httpMiddleware/builtin/index.d.ts +18 -0
- package/dist/httpMiddleware/builtin/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/index.js +22 -0
- package/dist/httpMiddleware/builtin/index.js.map +1 -0
- package/dist/httpMiddleware/builtin/logging/httpMiddleware.logging.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/logging/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/security/httpMiddleware.security.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/security/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/static/httpMiddleware.static.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/static/index.d.ts +7 -0
- package/dist/httpMiddleware/builtin/static/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/static/index.js +7 -0
- package/dist/httpMiddleware/builtin/static/index.js.map +1 -0
- package/dist/httpMiddleware/builtin/timing/httpMiddleware.timing.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/timing/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/video/httpMiddleware.video.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/video/index.d.ts +7 -0
- package/dist/httpMiddleware/builtin/video/index.d.ts.map +1 -0
- package/dist/httpMiddleware/builtin/video/index.js +7 -0
- package/dist/httpMiddleware/builtin/video/index.js.map +1 -0
- package/dist/httpMiddleware/httpMiddleware.error.d.ts +38 -0
- package/dist/httpMiddleware/httpMiddleware.error.d.ts.map +1 -0
- package/dist/httpMiddleware/httpMiddleware.error.js +60 -0
- package/dist/httpMiddleware/httpMiddleware.error.js.map +1 -0
- package/dist/httpMiddleware/httpMiddleware.state.d.ts.map +1 -0
- package/dist/httpMiddleware/httpMiddleware.type.d.ts.map +1 -0
- package/dist/httpMiddleware/index.d.ts +11 -0
- package/dist/httpMiddleware/index.d.ts.map +1 -0
- package/dist/httpMiddleware/index.js +11 -0
- package/dist/httpMiddleware/index.js.map +1 -0
- package/dist/httpMiddleware/pipeline/httpMiddleware.pipeline.d.ts.map +1 -0
- package/dist/httpMiddleware/pipeline/httpPipeline.execution.d.ts.map +1 -0
- package/dist/httpMiddleware/pipeline/httpPipeline.helper.d.ts.map +1 -0
- package/dist/httpMiddleware/pipeline/httpPipeline.registration.d.ts.map +1 -0
- package/dist/httpMiddleware/pipeline/index.d.ts +10 -0
- package/dist/httpMiddleware/pipeline/index.d.ts.map +1 -0
- package/dist/httpMiddleware/pipeline/index.js +10 -0
- package/dist/httpMiddleware/pipeline/index.js.map +1 -0
- package/dist/httpMime/http.mime.d.ts.map +1 -0
- package/dist/httpMime/index.d.ts +7 -0
- package/dist/httpMime/index.d.ts.map +1 -0
- package/dist/httpMime/index.js +7 -0
- package/dist/httpMime/index.js.map +1 -0
- package/dist/httpMultipart/http.multipart.d.ts +42 -0
- package/dist/httpMultipart/http.multipart.d.ts.map +1 -0
- package/dist/httpMultipart/http.multipart.js +334 -0
- package/dist/httpMultipart/http.multipart.js.map +1 -0
- package/dist/httpMultipart/index.d.ts +7 -0
- package/dist/httpMultipart/index.d.ts.map +1 -0
- package/dist/httpMultipart/index.js +7 -0
- package/dist/httpMultipart/index.js.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.accept.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.charset.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.construction.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.core.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.encoding.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.formatting.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.helpers.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.internal.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.language.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.mediaType.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.negotiate.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.parsing.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.quality.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.sorting.d.ts.map +1 -0
- package/dist/httpNegotiation/httpNegotiation.types.d.ts.map +1 -0
- package/dist/httpNegotiation/index.d.ts +7 -0
- package/dist/httpNegotiation/index.d.ts.map +1 -0
- package/dist/httpNegotiation/index.js +7 -0
- package/dist/httpNegotiation/index.js.map +1 -0
- package/dist/httpProtocol/http.protocol.d.ts.map +1 -0
- package/dist/httpProtocol/index.d.ts +7 -0
- package/dist/httpProtocol/index.d.ts.map +1 -0
- package/dist/httpProtocol/index.js +7 -0
- package/dist/httpProtocol/index.js.map +1 -0
- package/dist/httpProxy/http.proxy.d.ts.map +1 -0
- package/dist/httpProxy/index.d.ts +8 -0
- package/dist/httpProxy/index.d.ts.map +1 -0
- package/dist/httpProxy/index.js +8 -0
- package/dist/httpProxy/index.js.map +1 -0
- package/dist/httpQuery/http.query.d.ts.map +1 -0
- package/dist/httpQuery/httpQuery.string.d.ts.map +1 -0
- package/dist/httpQuery/index.d.ts +8 -0
- package/dist/httpQuery/index.d.ts.map +1 -0
- package/dist/httpQuery/index.js +8 -0
- package/dist/httpQuery/index.js.map +1 -0
- package/dist/httpRange/http.range.d.ts.map +1 -0
- package/dist/httpRange/index.d.ts +7 -0
- package/dist/httpRange/index.d.ts.map +1 -0
- package/dist/httpRange/index.js +7 -0
- package/dist/httpRange/index.js.map +1 -0
- package/dist/httpRedirect/http.redirect.d.ts.map +1 -0
- package/dist/httpRedirect/index.d.ts +7 -0
- package/dist/httpRedirect/index.d.ts.map +1 -0
- package/dist/httpRedirect/index.js +7 -0
- package/dist/httpRedirect/index.js.map +1 -0
- package/dist/httpRequest/http.request.d.ts.map +1 -0
- package/dist/httpRequest/httpRequest.context.constant.d.ts.map +1 -0
- package/dist/httpRequest/httpRequest.context.constant.js +8 -0
- package/dist/httpRequest/httpRequest.context.constant.js.map +1 -0
- package/dist/httpRequest/httpRequest.context.d.ts.map +1 -0
- package/dist/httpRequest/httpRequest.context.id.d.ts.map +1 -0
- package/dist/httpRequest/httpRequest.context.js +402 -0
- package/dist/httpRequest/httpRequest.context.js.map +1 -0
- package/dist/httpRequest/httpRequest.context.type.d.ts.map +1 -0
- package/dist/httpRequest/index.d.ts +8 -0
- package/dist/httpRequest/index.d.ts.map +1 -0
- package/dist/httpRequest/index.js +8 -0
- package/dist/httpRequest/index.js.map +1 -0
- package/dist/httpResponse/core/httpResponse.statusText.d.ts.map +1 -0
- package/dist/httpResponse/core/httpResponse.type.d.ts.map +1 -0
- package/dist/httpResponse/core/index.d.ts.map +1 -0
- package/dist/httpResponse/http.response.d.ts.map +1 -0
- package/dist/httpResponse/httpResponse.context.d.ts.map +1 -0
- package/dist/httpResponse/httpResponse.helper.d.ts.map +1 -0
- package/dist/httpResponse/httpResponse.writer.d.ts +52 -0
- package/dist/httpResponse/httpResponse.writer.d.ts.map +1 -0
- package/dist/httpResponse/httpResponse.writer.js +278 -0
- package/dist/httpResponse/httpResponse.writer.js.map +1 -0
- package/dist/httpResponse/index.d.ts +9 -0
- package/dist/httpResponse/index.d.ts.map +1 -0
- package/dist/httpResponse/index.js +9 -0
- package/dist/httpResponse/index.js.map +1 -0
- package/dist/httpSecurity/httpSecurity.config.d.ts +43 -0
- package/dist/httpSecurity/httpSecurity.config.d.ts.map +1 -0
- package/dist/httpSecurity/httpSecurity.config.js +26 -0
- package/dist/httpSecurity/httpSecurity.config.js.map +1 -0
- package/dist/httpSecurity/httpSecurity.guard.d.ts +29 -0
- package/dist/httpSecurity/httpSecurity.guard.d.ts.map +1 -0
- package/dist/httpSecurity/httpSecurity.guard.js +40 -0
- package/dist/httpSecurity/httpSecurity.guard.js.map +1 -0
- package/dist/httpSecurity/httpSecurity.validator.d.ts +42 -0
- package/dist/httpSecurity/httpSecurity.validator.d.ts.map +1 -0
- package/dist/httpSecurity/httpSecurity.validator.js +151 -0
- package/dist/httpSecurity/httpSecurity.validator.js.map +1 -0
- package/dist/httpSecurity/index.d.ts +14 -0
- package/dist/httpSecurity/index.d.ts.map +1 -0
- package/dist/httpSecurity/index.js +11 -0
- package/dist/httpSecurity/index.js.map +1 -0
- package/dist/httpSecurityHeaders/core/httpSecurityHeader.type.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/core/httpSecurityHeader.validation.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/core/index.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/httpSecurity.headers.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/httpSecurityHeader.factory.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/httpSecurityHeader.individual.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/httpSecurityHeader.permissionsPolicy.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/httpSecurityHeader.recommended.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/index.d.ts +7 -0
- package/dist/httpSecurityHeaders/index.d.ts.map +1 -0
- package/dist/httpSecurityHeaders/index.js +7 -0
- package/dist/httpSecurityHeaders/index.js.map +1 -0
- package/dist/httpServer/core/httpServer.core.d.ts +55 -0
- package/dist/httpServer/core/httpServer.core.d.ts.map +1 -0
- package/dist/httpServer/core/httpServer.core.js +240 -0
- package/dist/httpServer/core/httpServer.core.js.map +1 -0
- package/dist/httpServer/core/index.d.ts +7 -0
- package/dist/httpServer/core/index.d.ts.map +1 -0
- package/dist/httpServer/core/index.js +7 -0
- package/dist/httpServer/core/index.js.map +1 -0
- package/dist/httpServer/factory/httpServer.factory.d.ts +24 -0
- package/dist/httpServer/factory/httpServer.factory.d.ts.map +1 -0
- package/dist/httpServer/factory/httpServer.factory.js +67 -0
- package/dist/httpServer/factory/httpServer.factory.js.map +1 -0
- package/dist/httpServer/factory/index.d.ts +7 -0
- package/dist/httpServer/factory/index.d.ts.map +1 -0
- package/dist/httpServer/factory/index.js +7 -0
- package/dist/httpServer/factory/index.js.map +1 -0
- package/dist/httpServer/index.d.ts +10 -0
- package/dist/httpServer/index.d.ts.map +1 -0
- package/dist/httpServer/index.js +10 -0
- package/dist/httpServer/index.js.map +1 -0
- package/dist/httpServer/manager/httpServer.manager.d.ts +19 -0
- package/dist/httpServer/manager/httpServer.manager.d.ts.map +1 -0
- package/dist/httpServer/manager/httpServer.manager.js +57 -0
- package/dist/httpServer/manager/httpServer.manager.js.map +1 -0
- package/dist/httpServer/manager/index.d.ts +7 -0
- package/dist/httpServer/manager/index.d.ts.map +1 -0
- package/dist/httpServer/manager/index.js +7 -0
- package/dist/httpServer/manager/index.js.map +1 -0
- package/dist/httpServer/types/httpServer.type.d.ts +43 -0
- package/dist/httpServer/types/httpServer.type.d.ts.map +1 -0
- package/dist/httpServer/types/httpServer.type.js +8 -0
- package/dist/httpServer/types/httpServer.type.js.map +1 -0
- package/dist/httpStatus/httpStatus.categoryPredicate.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.clientErrorConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.clientErrorTextConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.collection.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.commonPredicate.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.constant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.errorPredicate.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.info.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.informationalSuccessConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.informationalSuccessTextConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.lookup.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.name.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.predicate.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.redirectErrorConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.redirectErrorTextConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.redirectPredicate.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.redirectionConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.redirectionTextConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.semantics.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.serverErrorConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.serverErrorTextConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.statusConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.statusTextConstant.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.type.d.ts.map +1 -0
- package/dist/httpStatus/httpStatus.validator.d.ts.map +1 -0
- package/dist/httpStatus/httpStatusCodes.constant.d.ts.map +1 -0
- package/dist/httpStatus/index.d.ts +20 -0
- package/dist/httpStatus/index.d.ts.map +1 -0
- package/dist/httpStatus/index.js +20 -0
- package/dist/httpStatus/index.js.map +1 -0
- package/dist/httpStream/httpStream.backpressure.d.ts +6 -0
- package/dist/httpStream/httpStream.backpressure.d.ts.map +1 -0
- package/dist/httpStream/httpStream.backpressure.js +38 -0
- package/dist/httpStream/httpStream.backpressure.js.map +1 -0
- package/dist/httpStream/httpStream.constants.d.ts +5 -0
- package/dist/httpStream/httpStream.constants.d.ts.map +1 -0
- package/dist/httpStream/httpStream.constants.js +5 -0
- package/dist/httpStream/httpStream.constants.js.map +1 -0
- package/dist/httpStream/httpStream.consume.d.ts +6 -0
- package/dist/httpStream/httpStream.consume.d.ts.map +1 -0
- package/dist/httpStream/httpStream.consume.js +70 -0
- package/dist/httpStream/httpStream.consume.js.map +1 -0
- package/dist/httpStream/httpStream.destroy.d.ts +5 -0
- package/dist/httpStream/httpStream.destroy.d.ts.map +1 -0
- package/dist/httpStream/httpStream.destroy.js +11 -0
- package/dist/httpStream/httpStream.destroy.js.map +1 -0
- package/dist/httpStream/httpStream.error.d.ts +8 -0
- package/dist/httpStream/httpStream.error.d.ts.map +1 -0
- package/dist/httpStream/httpStream.error.js +17 -0
- package/dist/httpStream/httpStream.error.js.map +1 -0
- package/dist/httpStream/httpStream.eventHelper.d.ts +13 -0
- package/dist/httpStream/httpStream.eventHelper.d.ts.map +1 -0
- package/dist/httpStream/httpStream.eventHelper.js +50 -0
- package/dist/httpStream/httpStream.eventHelper.js.map +1 -0
- package/dist/httpStream/httpStream.helper.d.ts +8 -0
- package/dist/httpStream/httpStream.helper.d.ts.map +1 -0
- package/dist/httpStream/httpStream.helper.js +35 -0
- package/dist/httpStream/httpStream.helper.js.map +1 -0
- package/dist/httpStream/httpStream.pipe.d.ts +7 -0
- package/dist/httpStream/httpStream.pipe.d.ts.map +1 -0
- package/dist/httpStream/httpStream.pipe.js +107 -0
- package/dist/httpStream/httpStream.pipe.js.map +1 -0
- package/dist/httpStream/httpStream.progress.d.ts +6 -0
- package/dist/httpStream/httpStream.progress.d.ts.map +1 -0
- package/dist/httpStream/httpStream.progress.js +100 -0
- package/dist/httpStream/httpStream.progress.js.map +1 -0
- package/dist/httpStream/httpStream.read.d.ts +7 -0
- package/dist/httpStream/httpStream.read.d.ts.map +1 -0
- package/dist/httpStream/httpStream.read.js +20 -0
- package/dist/httpStream/httpStream.read.js.map +1 -0
- package/dist/httpStream/httpStream.request.d.ts +8 -0
- package/dist/httpStream/httpStream.request.d.ts.map +1 -0
- package/dist/httpStream/httpStream.request.js +11 -0
- package/dist/httpStream/httpStream.request.js.map +1 -0
- package/dist/httpStream/httpStream.state.d.ts +8 -0
- package/dist/httpStream/httpStream.state.d.ts.map +1 -0
- package/dist/httpStream/httpStream.state.js +17 -0
- package/dist/httpStream/httpStream.state.js.map +1 -0
- package/dist/httpStream/httpStream.transform.d.ts +8 -0
- package/dist/httpStream/httpStream.transform.d.ts.map +1 -0
- package/dist/httpStream/httpStream.transform.js +17 -0
- package/dist/httpStream/httpStream.transform.js.map +1 -0
- package/dist/httpStream/httpStream.types.d.ts +19 -0
- package/dist/httpStream/httpStream.types.d.ts.map +1 -0
- package/dist/httpStream/httpStream.types.js +5 -0
- package/dist/httpStream/httpStream.types.js.map +1 -0
- package/dist/httpStream/index.d.ts +20 -0
- package/dist/httpStream/index.d.ts.map +1 -0
- package/dist/httpStream/index.js +20 -0
- package/dist/httpStream/index.js.map +1 -0
- package/dist/httpTrustProxy/httpTrustProxy.compilation.d.ts.map +1 -0
- package/dist/httpTrustProxy/httpTrustProxy.core.d.ts.map +1 -0
- package/dist/httpTrustProxy/httpTrustProxy.helper.d.ts.map +1 -0
- package/dist/httpTrustProxy/httpTrustProxy.parsing.d.ts.map +1 -0
- package/dist/httpTrustProxy/httpTrustProxy.type.d.ts.map +1 -0
- package/dist/httpTrustProxy/index.d.ts +7 -0
- package/dist/httpTrustProxy/index.d.ts.map +1 -0
- package/dist/httpTrustProxy/index.js +7 -0
- package/dist/httpTrustProxy/index.js.map +1 -0
- package/dist/httpTypes/http.types.d.ts +212 -0
- package/dist/httpTypes/http.types.d.ts.map +1 -0
- package/dist/httpTypes/http.types.js +15 -0
- package/dist/httpTypes/http.types.js.map +1 -0
- package/dist/httpTypes/index.d.ts +7 -0
- package/dist/httpTypes/index.d.ts.map +1 -0
- package/dist/httpTypes/index.js +7 -0
- package/dist/httpTypes/index.js.map +1 -0
- package/dist/httpUrl/http.url.d.ts.map +1 -0
- package/dist/httpUrl/index.d.ts +7 -0
- package/dist/httpUrl/index.d.ts.map +1 -0
- package/dist/httpUrl/index.js +7 -0
- package/dist/httpUrl/index.js.map +1 -0
- package/dist/httpValidation/httpValidationAssertion.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationAuthority.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationAuthorization.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationCacheControl.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationContentLength.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationContentType.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationCookie.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationDate.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationETag.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationHeader.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationHostname.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationMessage.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationMethod.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationPort.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationRange.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationRequestTarget.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationStatusCode.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationToken.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationTypes.type.d.ts.map +1 -0
- package/dist/httpValidation/httpValidationUrl.d.ts.map +1 -0
- package/dist/httpValidation/index.d.ts +29 -0
- package/dist/httpValidation/index.d.ts.map +1 -0
- package/dist/httpValidation/index.js +29 -0
- package/dist/httpValidation/index.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Consume a readable stream via chunk callback.
|
|
3
|
+
*/
|
|
4
|
+
import { HttpStreamError as StreamError } from "@zudojs/errors";
|
|
5
|
+
import { createAbortError, normalizeStreamError } from "./httpStream.error.js";
|
|
6
|
+
import { isReadableEnded } from "./httpStream.state.js";
|
|
7
|
+
import { destroyStream } from "./httpStream.destroy.js";
|
|
8
|
+
import { createSettleGuard, cleanupListeners, wireAbortSignal, } from "./httpStream.eventHelper.js";
|
|
9
|
+
export async function consumeStream(stream, onChunk, options = {}) {
|
|
10
|
+
const signal = options.signal;
|
|
11
|
+
if (signal?.aborted) {
|
|
12
|
+
throw createAbortError();
|
|
13
|
+
}
|
|
14
|
+
await new Promise((resolve, reject) => {
|
|
15
|
+
const guard = createSettleGuard();
|
|
16
|
+
let cleanupFn;
|
|
17
|
+
const finish = (error) => {
|
|
18
|
+
if (guard.settled())
|
|
19
|
+
return;
|
|
20
|
+
guard.mark();
|
|
21
|
+
cleanupFn();
|
|
22
|
+
if (error) {
|
|
23
|
+
reject(normalizeStreamError(error));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
resolve();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const onData = (chunk) => {
|
|
30
|
+
try {
|
|
31
|
+
onChunk(chunk);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
finish(error);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const onEnd = () => {
|
|
38
|
+
finish();
|
|
39
|
+
};
|
|
40
|
+
const onError = (error) => {
|
|
41
|
+
finish(error);
|
|
42
|
+
};
|
|
43
|
+
const onClose = () => {
|
|
44
|
+
if (!guard.settled() && !isReadableEnded(stream)) {
|
|
45
|
+
finish(new StreamError("Stream closed before completion.", {
|
|
46
|
+
code: "STREAM_CLOSED",
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const onAbort = () => {
|
|
51
|
+
destroyStream(stream);
|
|
52
|
+
finish(createAbortError());
|
|
53
|
+
};
|
|
54
|
+
stream.on("data", onData);
|
|
55
|
+
stream.once("end", onEnd);
|
|
56
|
+
stream.once("error", onError);
|
|
57
|
+
stream.once("close", onClose);
|
|
58
|
+
const removeAbort = wireAbortSignal(signal, onAbort);
|
|
59
|
+
cleanupFn = () => {
|
|
60
|
+
cleanupListeners(stream, [
|
|
61
|
+
["data", onData],
|
|
62
|
+
["end", onEnd],
|
|
63
|
+
["error", onError],
|
|
64
|
+
["close", onClose],
|
|
65
|
+
]);
|
|
66
|
+
removeAbort();
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=httpStream.consume.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.consume.js","sourceRoot":"","sources":["../../src/httpStream/httpStream.consume.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIhE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AAErC,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAA6B,EAC7B,OAAiC,EACjC,OAAO,GAAsB,EAAE;IAE/B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAE9B,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;QACpB,MAAM,gBAAgB,EAAE,CAAC;IAC3B,CAAC;IAED,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC;QAClC,IAAI,SAAqB,CAAC;QAE1B,MAAM,MAAM,GAAG,CAAC,KAAe,EAAE,EAAE;YACjC,IAAI,KAAK,CAAC,OAAO,EAAE;gBAAE,OAAO;YAE5B,KAAK,CAAC,IAAI,EAAE,CAAC;YAEb,SAAS,EAAE,CAAC;YAEZ,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC;YACtC,CAAC;iBAA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M,EAAE,MAAM,CAAC;gBAChB,CAAC,KAAK,EAAE,KAAK,CAAC;gBACd,CAAC,OAAO,EAAE,OAAO,CAAC;gBAClB,CAAC,OAAO,EAAE,OAAO,CAAC;aACnB,CAAC,CAAC;YAEH,WAAW,EAAE,CAAC;QAChB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.destroy.d.ts","sourceRoot":"","sources":["../../src/httpStream/httpStream.destroy.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,EACrD,KAAK,CAAC,EAAE,KAAK,GACZ,IAAI,CAMN"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Stream destruction helper.
|
|
3
|
+
*/
|
|
4
|
+
import { Readable, Writable } from "node:stream";
|
|
5
|
+
export function destroyStream(stream, error) {
|
|
6
|
+
const candidate = stream;
|
|
7
|
+
if (typeof candidate.destroy === "function" && !candidate.destroyed) {
|
|
8
|
+
candidate.destroy(error);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=httpStream.destroy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.destroy.js","sourceRoot":"","sources":["../../src/httpStream/httpStream.destroy.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,aAAa,CAC3B,MAAqD,EACrD,KAAa;IAEb,MAAM,SAAS,GAAG,MAA6B,CAAC;IAEhD,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,UAAU,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC;QACpE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Stream error helpers.
|
|
3
|
+
*/
|
|
4
|
+
import { HttpStreamError as StreamError } from "@zudojs/errors";
|
|
5
|
+
export { StreamError };
|
|
6
|
+
export declare function createAbortError(): StreamError;
|
|
7
|
+
export declare function normalizeStreamError(error: unknown): Error;
|
|
8
|
+
//# sourceMappingURL=httpStream.error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.error.d.ts","sourceRoot":"","sources":["../../src/httpStream/httpStream.error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,wBAAgB,gBAAgB,IAAI,WAAW,CAI9C;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAM1D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Stream error helpers.
|
|
3
|
+
*/
|
|
4
|
+
import { HttpStreamError as StreamError } from "@zudojs/errors";
|
|
5
|
+
export { StreamError };
|
|
6
|
+
export function createAbortError() {
|
|
7
|
+
return new StreamError("Stream operation was aborted.", {
|
|
8
|
+
code: "STREAM_ABORTED",
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export function normalizeStreamError(error) {
|
|
12
|
+
if (error instanceof Error) {
|
|
13
|
+
return error;
|
|
14
|
+
}
|
|
15
|
+
return new StreamError(String(error));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=httpStream.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.error.js","sourceRoot":"","sources":["../../src/httpStream/httpStream.error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,WAAW,CAAC,+BAA+B,EAAE;QACtD,IAAI,EAAE,gBAAgB;KACvB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAc;IACjD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Shared settle-once guard, cleanup, and abort patterns.
|
|
3
|
+
*/
|
|
4
|
+
export interface StreamSettleGuard {
|
|
5
|
+
readonly settled: () => boolean;
|
|
6
|
+
readonly mark: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createSettleGuard(): StreamSettleGuard;
|
|
9
|
+
export declare function cleanupListeners(target: NodeJS.ReadableStream | NodeJS.WritableStream, listeners: ReadonlyArray<readonly [string, (...args: readonly unknown[]) => void]>): void;
|
|
10
|
+
export declare function createFinishHandler(guard: StreamSettleGuard, cleanup: () => void, resolve: (value: void | PromiseLike<void>) => void, reject: (reason: unknown) => void): (error?: unknown) => void;
|
|
11
|
+
export declare function createAbortHandler(guard: StreamSettleGuard, cleanup: () => void, finish: (error?: unknown) => void, streams: ReadonlyArray<NodeJS.ReadableStream | NodeJS.WritableStream>): () => void;
|
|
12
|
+
export declare function wireAbortSignal(signal: AbortSignal | undefined, onAbort: () => void): () => void;
|
|
13
|
+
//# sourceMappingURL=httpStream.eventHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.eventHelper.d.ts","sourceRoot":"","sources":["../../src/httpStream/httpStream.eventHelper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,iBAAiB,IAAI,iBAAiB,CASrD;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,EACrD,SAAS,EAAE,aAAa,CACtB,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,SAAS,OAAO,EAAE,KAAK,IAAI,CAAC,CACzD,GACA,IAAI,CAIN;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,MAAM,IAAI,EACnB,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,EAClD,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,GAChC,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAc3B;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,MAAM,IAAI,EACnB,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,EACjC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,GACpE,MAAM,IAAI,CAQZ;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,OAAO,EAAE,MAAM,IAAI,GAClB,MAAM,IAAI,CAQZ"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Shared settle-once guard, cleanup, and abort patterns.
|
|
3
|
+
*/
|
|
4
|
+
import { destroyStream } from "./httpStream.destroy.js";
|
|
5
|
+
import { normalizeStreamError } from "./httpStream.error.js";
|
|
6
|
+
export function createSettleGuard() {
|
|
7
|
+
let settled = false;
|
|
8
|
+
return {
|
|
9
|
+
settled: () => settled,
|
|
10
|
+
mark: () => {
|
|
11
|
+
settled = true;
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function cleanupListeners(target, listeners) {
|
|
16
|
+
for (const [event, handler] of listeners) {
|
|
17
|
+
target.removeListener(event, handler);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function createFinishHandler(guard, cleanup, resolve, reject) {
|
|
21
|
+
return (error) => {
|
|
22
|
+
if (guard.settled())
|
|
23
|
+
return;
|
|
24
|
+
guard.mark();
|
|
25
|
+
cleanup();
|
|
26
|
+
if (error) {
|
|
27
|
+
reject(normalizeStreamError(error));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
resolve();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function createAbortHandler(guard, cleanup, finish, streams) {
|
|
35
|
+
return () => {
|
|
36
|
+
for (const s of streams) {
|
|
37
|
+
destroyStream(s);
|
|
38
|
+
}
|
|
39
|
+
finish();
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function wireAbortSignal(signal, onAbort) {
|
|
43
|
+
if (signal) {
|
|
44
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
45
|
+
}
|
|
46
|
+
return () => {
|
|
47
|
+
signal?.removeEventListener("abort", onAbort);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=httpStream.eventHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.eventHelper.js","sourceRoot":"","sources":["../../src/httpStream/httpStream.eventHelper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;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E,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,GAAG,EAAE;QACV,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAChD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Buffer conversion, chunk size, and readable creation helpers.
|
|
3
|
+
*/
|
|
4
|
+
import { Readable } from "node:stream";
|
|
5
|
+
export declare function toBuffer(chunk: unknown): Buffer;
|
|
6
|
+
export declare function getChunkSize(chunk: unknown): number;
|
|
7
|
+
export declare function toReadableStream(data: Buffer | Uint8Array | string): Readable;
|
|
8
|
+
//# sourceMappingURL=httpStream.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.helper.d.ts","sourceRoot":"","sources":["../../src/httpStream/httpStream.helper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAkB/C;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAcnD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,CAE7E"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Buffer conversion, chunk size, and readable creation helpers.
|
|
3
|
+
*/
|
|
4
|
+
import { Readable } from "node:stream";
|
|
5
|
+
export function toBuffer(chunk) {
|
|
6
|
+
if (Buffer.isBuffer(chunk)) {
|
|
7
|
+
return chunk;
|
|
8
|
+
}
|
|
9
|
+
if (chunk instanceof Uint8Array) {
|
|
10
|
+
return Buffer.from(chunk);
|
|
11
|
+
}
|
|
12
|
+
if (typeof chunk === "string") {
|
|
13
|
+
return Buffer.from(chunk, "utf8");
|
|
14
|
+
}
|
|
15
|
+
if (chunk === null || chunk === undefined) {
|
|
16
|
+
return Buffer.alloc(0);
|
|
17
|
+
}
|
|
18
|
+
return Buffer.from(String(chunk), "utf8");
|
|
19
|
+
}
|
|
20
|
+
export function getChunkSize(chunk) {
|
|
21
|
+
if (Buffer.isBuffer(chunk)) {
|
|
22
|
+
return chunk.length;
|
|
23
|
+
}
|
|
24
|
+
if (chunk instanceof Uint8Array) {
|
|
25
|
+
return chunk.byteLength;
|
|
26
|
+
}
|
|
27
|
+
if (typeof chunk === "string") {
|
|
28
|
+
return Buffer.byteLength(chunk, "utf8");
|
|
29
|
+
}
|
|
30
|
+
return Buffer.byteLength(String(chunk), "utf8");
|
|
31
|
+
}
|
|
32
|
+
export function toReadableStream(data) {
|
|
33
|
+
return Readable.from([data]);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=httpStream.helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.helper.js","sourceRoot":"","sources":["../../src/httpStream/httpStream.helper.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QAC1C,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,MAAM,CAAC;IACtB,CAAC;IAED,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC,UAAU,CAAC;IAC1B,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAkC;IACjE,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Pipe and copy streams between source and destination.
|
|
3
|
+
*/
|
|
4
|
+
import type { StreamPipeOptions, StreamResult, HTTPStreamOptions } from "./httpStream.types.js";
|
|
5
|
+
export declare function pipeStream(source: NodeJS.ReadableStream, destination: NodeJS.WritableStream, options?: StreamPipeOptions): Promise<StreamResult>;
|
|
6
|
+
export declare function copyStream(source: NodeJS.ReadableStream, destination: NodeJS.WritableStream, options?: HTTPStreamOptions): Promise<StreamResult>;
|
|
7
|
+
//# sourceMappingURL=httpStream.pipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.pipe.d.ts","sourceRoot":"","sources":["../../src/httpStream/httpStream.pipe.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAW/B,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,CAAC,cAAc,EAC7B,WAAW,EAAE,MAAM,CAAC,cAAc,EAClC,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,YAAY,CAAC,CA6GvB;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,CAAC,cAAc,EAC7B,WAAW,EAAE,MAAM,CAAC,cAAc,EAClC,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,YAAY,CAAC,CAEvB"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Pipe and copy streams between source and destination.
|
|
3
|
+
*/
|
|
4
|
+
import { HttpStreamError as StreamError } from "@zudojs/errors";
|
|
5
|
+
import { createAbortError } from "./httpStream.error.js";
|
|
6
|
+
import { isReadableEnded, isWritableFinished } from "./httpStream.state.js";
|
|
7
|
+
import { destroyStream } from "./httpStream.destroy.js";
|
|
8
|
+
import { getChunkSize } from "./httpStream.helper.js";
|
|
9
|
+
import { createSettleGuard, cleanupListeners, wireAbortSignal, } from "./httpStream.eventHelper.js";
|
|
10
|
+
export async function pipeStream(source, destination, options = {}) {
|
|
11
|
+
const signal = options.signal;
|
|
12
|
+
if (signal?.aborted) {
|
|
13
|
+
destroyStream(source);
|
|
14
|
+
throw createAbortError();
|
|
15
|
+
}
|
|
16
|
+
let bytes = 0;
|
|
17
|
+
let chunks = 0;
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
const guard = createSettleGuard();
|
|
20
|
+
let cleanupFn;
|
|
21
|
+
const finish = (error) => {
|
|
22
|
+
if (guard.settled())
|
|
23
|
+
return;
|
|
24
|
+
guard.mark();
|
|
25
|
+
cleanupFn();
|
|
26
|
+
if (error) {
|
|
27
|
+
reject(error instanceof Error ? error : new Error(String(error)));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
resolve({ bytes });
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const onData = (chunk) => {
|
|
34
|
+
chunks += 1;
|
|
35
|
+
bytes += getChunkSize(chunk);
|
|
36
|
+
};
|
|
37
|
+
const onEnd = () => {
|
|
38
|
+
if (options.end === false) {
|
|
39
|
+
finish();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (!isWritableFinished(destination)) {
|
|
43
|
+
try {
|
|
44
|
+
destination.end();
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
finish(error);
|
|
48
|
+
}
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
finish();
|
|
52
|
+
};
|
|
53
|
+
const onFinish = () => {
|
|
54
|
+
finish();
|
|
55
|
+
};
|
|
56
|
+
const onSourceError = (error) => {
|
|
57
|
+
destroyStream(destination);
|
|
58
|
+
finish(error);
|
|
59
|
+
};
|
|
60
|
+
const onDestinationError = (error) => {
|
|
61
|
+
destroyStream(source);
|
|
62
|
+
finish(error);
|
|
63
|
+
};
|
|
64
|
+
const onSourceClose = () => {
|
|
65
|
+
if (!isReadableEnded(source) && !guard.settled()) {
|
|
66
|
+
finish(new StreamError("Source stream closed before completion.", {
|
|
67
|
+
code: "STREAM_SOURCE_CLOSED",
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const onAbort = () => {
|
|
72
|
+
destroyStream(source);
|
|
73
|
+
destroyStream(destination);
|
|
74
|
+
finish(createAbortError());
|
|
75
|
+
};
|
|
76
|
+
source.on("data", onData);
|
|
77
|
+
source.once("end", onEnd);
|
|
78
|
+
source.once("error", onSourceError);
|
|
79
|
+
source.once("close", onSourceClose);
|
|
80
|
+
destination.once("error", onDestinationError);
|
|
81
|
+
destination.once("finish", onFinish);
|
|
82
|
+
const removeAbort = wireAbortSignal(signal, onAbort);
|
|
83
|
+
cleanupFn = () => {
|
|
84
|
+
cleanupListeners(source, [
|
|
85
|
+
["data", onData],
|
|
86
|
+
["end", onEnd],
|
|
87
|
+
["error", onSourceError],
|
|
88
|
+
["close", onSourceClose],
|
|
89
|
+
]);
|
|
90
|
+
cleanupListeners(destination, [
|
|
91
|
+
["error", onDestinationError],
|
|
92
|
+
["finish", onFinish],
|
|
93
|
+
]);
|
|
94
|
+
removeAbort();
|
|
95
|
+
};
|
|
96
|
+
try {
|
|
97
|
+
source.pipe(destination, { end: options.end !== false });
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
finish(error);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
export async function copyStream(source, destination, options = {}) {
|
|
105
|
+
return pipeStream(source, destination, options);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=httpStream.pipe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.pipe.js","sourceRoot":"","sources":["../../src/httpStream/httpStream.pipe.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AAErC,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAA6B,EAC7B,WAAkC,EAClC,OAAO,GAAsB,EAAE;IAE/B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAE9B,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;QACpB,aAAa,CAAC,MAAM,CAAC,CAAC;QAC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D,SAAS,GAAG,GAAG,EAAE;YACf,gBAAgB,CAAC,MAAM,EAAE;gBACvB,CAAC,MAAM,EAAE,MAAM,CAAC;gBAChB,CAAC,KAAK,EAAE,KAAK,CAAC;gBACd,CAAC,OAAO,EAAE,aAAa,CAAC;gBACxB,CAAC,OAAO,EAAE,aAAa,CAAC;aACzB,CAAC,CAAC;YACH,gBAAgB,CAAC,WAAW,EAAE;gBAC5B,CAAC,OAAO,EAAE,kBAAkB,CAAC;gBAC7B,CAAC,QAAQ,EAAE,QAAQ,CAAC;aACrB,CAAC,CAAC;YACH,WAAW,EAAE,CAAC;QAChB,CAAC,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,KAAK,KAAK,EAAE,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAA6B,EAC7B,WAAkC,EAClC,OAAO,GAAsB,EAAE;IAE/B,OAAO,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Pipe streams with progress reporting.
|
|
3
|
+
*/
|
|
4
|
+
import type { StreamPipeOptions, StreamResult, StreamProgressHandler } from "./httpStream.types.js";
|
|
5
|
+
export declare function pipeStreamWithProgress(source: NodeJS.ReadableStream, destination: NodeJS.WritableStream, onProgress: StreamProgressHandler, options?: StreamPipeOptions): Promise<StreamResult>;
|
|
6
|
+
//# sourceMappingURL=httpStream.progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.progress.d.ts","sourceRoot":"","sources":["../../src/httpStream/httpStream.progress.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAgB/B,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,CAAC,cAAc,EAC7B,WAAW,EAAE,MAAM,CAAC,cAAc,EAClC,UAAU,EAAE,qBAAqB,EACjC,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,YAAY,CAAC,CAgHvB"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Pipe streams with progress reporting.
|
|
3
|
+
*/
|
|
4
|
+
import { createAbortError } from "./httpStream.error.js";
|
|
5
|
+
import { destroyStream } from "./httpStream.destroy.js";
|
|
6
|
+
import { getChunkSize } from "./httpStream.helper.js";
|
|
7
|
+
import { isWritableFinished } from "./httpStream.state.js";
|
|
8
|
+
import { createSettleGuard, cleanupListeners, wireAbortSignal, } from "./httpStream.eventHelper.js";
|
|
9
|
+
export async function pipeStreamWithProgress(source, destination, onProgress, options = {}) {
|
|
10
|
+
const signal = options.signal;
|
|
11
|
+
if (signal?.aborted) {
|
|
12
|
+
throw createAbortError();
|
|
13
|
+
}
|
|
14
|
+
let bytes = 0;
|
|
15
|
+
let chunks = 0;
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const guard = createSettleGuard();
|
|
18
|
+
let cleanupFn;
|
|
19
|
+
const fail = (error) => {
|
|
20
|
+
if (guard.settled())
|
|
21
|
+
return;
|
|
22
|
+
guard.mark();
|
|
23
|
+
cleanupFn();
|
|
24
|
+
reject(error instanceof Error ? error : new Error(String(error)));
|
|
25
|
+
};
|
|
26
|
+
const complete = () => {
|
|
27
|
+
if (guard.settled())
|
|
28
|
+
return;
|
|
29
|
+
guard.mark();
|
|
30
|
+
cleanupFn();
|
|
31
|
+
resolve({ bytes });
|
|
32
|
+
};
|
|
33
|
+
const onData = (chunk) => {
|
|
34
|
+
try {
|
|
35
|
+
chunks += 1;
|
|
36
|
+
bytes += getChunkSize(chunk);
|
|
37
|
+
onProgress({ bytes, chunks });
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
destroyStream(source);
|
|
41
|
+
destroyStream(destination);
|
|
42
|
+
fail(error);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const onEnd = () => {
|
|
46
|
+
if (options.end === false) {
|
|
47
|
+
complete();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (!isWritableFinished(destination)) {
|
|
51
|
+
destination.end();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
complete();
|
|
55
|
+
};
|
|
56
|
+
const onFinish = () => {
|
|
57
|
+
complete();
|
|
58
|
+
};
|
|
59
|
+
const onError = (error) => {
|
|
60
|
+
destroyStream(destination);
|
|
61
|
+
fail(error);
|
|
62
|
+
};
|
|
63
|
+
const onDestinationError = (error) => {
|
|
64
|
+
destroyStream(source);
|
|
65
|
+
fail(error);
|
|
66
|
+
};
|
|
67
|
+
const onAbort = () => {
|
|
68
|
+
destroyStream(source);
|
|
69
|
+
destroyStream(destination);
|
|
70
|
+
fail(createAbortError());
|
|
71
|
+
};
|
|
72
|
+
source.on("data", onData);
|
|
73
|
+
source.once("end", onEnd);
|
|
74
|
+
source.once("error", onError);
|
|
75
|
+
destination.once("error", onDestinationError);
|
|
76
|
+
destination.once("finish", onFinish);
|
|
77
|
+
const removeAbort = wireAbortSignal(signal, onAbort);
|
|
78
|
+
cleanupFn = () => {
|
|
79
|
+
cleanupListeners(source, [
|
|
80
|
+
["data", onData],
|
|
81
|
+
["end", onEnd],
|
|
82
|
+
["error", onError],
|
|
83
|
+
]);
|
|
84
|
+
cleanupListeners(destination, [
|
|
85
|
+
["error", onDestinationError],
|
|
86
|
+
["finish", onFinish],
|
|
87
|
+
]);
|
|
88
|
+
removeAbort();
|
|
89
|
+
};
|
|
90
|
+
try {
|
|
91
|
+
source.pipe(destination, {
|
|
92
|
+
end: options.end !== false,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
fail(error);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=httpStream.progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.progress.js","sourceRoot":"","sources":["../../src/httpStream/httpStream.progress.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,GAChB,MAAM,6BAA6B,CAAC;AAErC,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,MAA6B,EAC7B,WAAkC,EAClC,UAAiC,EACjC,OAAO,GAAsB,EAAE;IAE/B,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAE9B,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;QACpB,MAAM,gBAAgB,EAAE,CAAC;IAC3B,CAAC;IAED,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,OAAO,IAAI,OAAO,CAAe,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnD,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC;QAClC,IAAI,SAAqB,CAAC;QAE1B,MAAM,IAAI,GAAG,CAAC,KAAc,EAAE,EAAE;YAC9B,IAAI,KAAK,CAAC,OAAO,EAAE;gBAAE,OAAO;YAE5B,KAAK,CAAC,IAAI,EAAE,CAAC;YAEb,SAAS,EAAE,CAAC;YAEZ,MAA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AC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Read stream into Buffer or string.
|
|
3
|
+
*/
|
|
4
|
+
import type { HTTPStreamOptions } from "./httpStream.types.js";
|
|
5
|
+
export declare function readStream(stream: NodeJS.ReadableStream, options?: HTTPStreamOptions): Promise<Buffer>;
|
|
6
|
+
export declare function readStreamAsString(stream: NodeJS.ReadableStream, encoding?: BufferEncoding, options?: HTTPStreamOptions): Promise<string>;
|
|
7
|
+
//# sourceMappingURL=httpStream.read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.read.d.ts","sourceRoot":"","sources":["../../src/httpStream/httpStream.read.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAM/D,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,CAAC,cAAc,EAC7B,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAkBjB;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,CAAC,cAAc,EAC7B,QAAQ,GAAE,cAAuB,EACjC,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAIjB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Read stream into Buffer or string.
|
|
3
|
+
*/
|
|
4
|
+
import { consumeStream } from "./httpStream.consume.js";
|
|
5
|
+
import { toBuffer } from "./httpStream.helper.js";
|
|
6
|
+
export async function readStream(stream, options = {}) {
|
|
7
|
+
const chunks = [];
|
|
8
|
+
let total = 0;
|
|
9
|
+
await consumeStream(stream, (chunk) => {
|
|
10
|
+
const buffer = toBuffer(chunk);
|
|
11
|
+
chunks.push(buffer);
|
|
12
|
+
total += buffer.length;
|
|
13
|
+
}, options);
|
|
14
|
+
return Buffer.concat(chunks, total);
|
|
15
|
+
}
|
|
16
|
+
export async function readStreamAsString(stream, encoding = "utf8", options = {}) {
|
|
17
|
+
const buffer = await readStream(stream, options);
|
|
18
|
+
return buffer.toString(encoding);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=httpStream.read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.read.js","sourceRoot":"","sources":["../../src/httpStream/httpStream.read.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,MAA6B,EAC7B,OAAO,GAAsB,EAAE;IAE/B,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,MAAM,aAAa,CACjB,MAAM,EACN,CAAC,KAAK,EAAE,EAAE;QACR,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;QAE/B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEpB,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC,EACD,OAAO,CACR,CAAC;IAEF,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,MAA6B,EAC7B,QAAQ,GAAmB,MAAM,EACjC,OAAO,GAAsB,EAAE;IAE/B,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEjD,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Request/response stream accessors.
|
|
3
|
+
*/
|
|
4
|
+
import { Readable, Writable } from "node:stream";
|
|
5
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
6
|
+
export declare function getRequestStream(request: IncomingMessage): Readable;
|
|
7
|
+
export declare function getResponseStream(response: ServerResponse): Writable;
|
|
8
|
+
//# sourceMappingURL=httpStream.request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.request.d.ts","sourceRoot":"","sources":["../../src/httpStream/httpStream.request.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAEnE;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,CAEpE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Request/response stream accessors.
|
|
3
|
+
*/
|
|
4
|
+
import { Readable, Writable } from "node:stream";
|
|
5
|
+
export function getRequestStream(request) {
|
|
6
|
+
return request;
|
|
7
|
+
}
|
|
8
|
+
export function getResponseStream(response) {
|
|
9
|
+
return response;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=httpStream.request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.request.js","sourceRoot":"","sources":["../../src/httpStream/httpStream.request.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIjD,MAAM,UAAU,gBAAgB,CAAC,OAAwB;IACvD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAwB;IACxD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Stream state inspection helpers.
|
|
3
|
+
*/
|
|
4
|
+
export declare function isReadableEnded(stream: NodeJS.ReadableStream): boolean;
|
|
5
|
+
export declare function isReadableDestroyed(stream: NodeJS.ReadableStream): boolean;
|
|
6
|
+
export declare function isWritableFinished(stream: NodeJS.WritableStream): boolean;
|
|
7
|
+
export declare function isWritableDestroyed(stream: NodeJS.WritableStream): boolean;
|
|
8
|
+
//# sourceMappingURL=httpStream.state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.state.d.ts","sourceRoot":"","sources":["../../src/httpStream/httpStream.state.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,OAAO,CAEtE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,OAAO,CAE1E;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,OAAO,CAEzE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,OAAO,CAE1E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Stream state inspection helpers.
|
|
3
|
+
*/
|
|
4
|
+
import { Readable, Writable } from "node:stream";
|
|
5
|
+
export function isReadableEnded(stream) {
|
|
6
|
+
return stream.readableEnded === true;
|
|
7
|
+
}
|
|
8
|
+
export function isReadableDestroyed(stream) {
|
|
9
|
+
return stream.destroyed === true;
|
|
10
|
+
}
|
|
11
|
+
export function isWritableFinished(stream) {
|
|
12
|
+
return stream.writableFinished === true;
|
|
13
|
+
}
|
|
14
|
+
export function isWritableDestroyed(stream) {
|
|
15
|
+
return stream.destroyed === true;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=httpStream.state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStream.state.js","sourceRoot":"","sources":["../../src/httpStream/httpStream.state.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,eAAe,CAAC,MAA6B;IAC3D,OAAQ,MAAmB,CAAC,aAAa,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAA6B;IAC/D,OAAQ,MAAmB,CAAC,SAAS,KAAK,IAAI,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAA6B;IAC9D,OAAQ,MAAmB,CAAC,gBAAgB,KAAK,IAAI,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAA6B;IAC/D,OAAQ,MAAmB,CAAC,SAAS,KAAK,IAAI,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http/httpStream — Create PassThrough and Readable stream instances.
|
|
3
|
+
*/
|
|
4
|
+
import { Readable, PassThrough } from "node:stream";
|
|
5
|
+
import type { HTTPStreamOptions } from "./httpStream.types.js";
|
|
6
|
+
export declare function createPassThrough(options?: HTTPStreamOptions): PassThrough;
|
|
7
|
+
export declare function createReadableStream(data: Iterable<unknown> | AsyncIterable<unknown>, options?: HTTPStreamOptions): Readable;
|
|
8
|
+
//# sourceMappingURL=httpStream.transform.d.ts.map
|