@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,278 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP response writer.
|
|
3
|
+
*
|
|
4
|
+
* Provides the runtime-independent contract and utilities used to translate
|
|
5
|
+
* an HttpResponseContext into a concrete HTTP response.
|
|
6
|
+
*
|
|
7
|
+
* Runtime adapters such as Node.js, Bun, or Deno should implement the
|
|
8
|
+
* HttpResponseWriter interface rather than coupling the HTTP core to a
|
|
9
|
+
* specific runtime.
|
|
10
|
+
*/
|
|
11
|
+
import { HttpResponseContext, serializeResponseCookie, } from "./httpResponse.context.js";
|
|
12
|
+
/* -------------------------------------------------------------------------- */
|
|
13
|
+
/* Errors */
|
|
14
|
+
/* -------------------------------------------------------------------------- */
|
|
15
|
+
import { HttpResponseWriterError as ResponseWriterError, ResponseAlreadySentError as ResponseAlreadySentError, UnsupportedResponseBodyError as UnsupportedResponseBodyError, } from "@zudojs/errors";
|
|
16
|
+
export { ResponseWriterError, ResponseAlreadySentError, UnsupportedResponseBodyError, };
|
|
17
|
+
/* -------------------------------------------------------------------------- */
|
|
18
|
+
/* Default Writer */
|
|
19
|
+
/* -------------------------------------------------------------------------- */
|
|
20
|
+
export class DefaultResponseWriter {
|
|
21
|
+
async write(context, writer, options = {}) {
|
|
22
|
+
assertWritable(writer);
|
|
23
|
+
context.assertMutable();
|
|
24
|
+
const body = context.body;
|
|
25
|
+
const status = context.status;
|
|
26
|
+
const statusText = context.statusText;
|
|
27
|
+
const headers = context.headers;
|
|
28
|
+
const cookies = context.cookies;
|
|
29
|
+
prepareAutomaticHeaders(context);
|
|
30
|
+
writeHeaders(context, writer, headers);
|
|
31
|
+
writeCookies(writer, cookies);
|
|
32
|
+
if (options.flushHeaders !== false && writer.flushHeaders) {
|
|
33
|
+
writer.flushHeaders();
|
|
34
|
+
}
|
|
35
|
+
writer.writeHead(status, statusText);
|
|
36
|
+
if (isBodyForbidden(status)) {
|
|
37
|
+
writer.end();
|
|
38
|
+
context.commit();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (body === undefined || body === null) {
|
|
42
|
+
if (options.end !== false) {
|
|
43
|
+
writer.end();
|
|
44
|
+
context.commit();
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (isReadableStream(body)) {
|
|
49
|
+
await writeReadableStream(body, writer);
|
|
50
|
+
writer.end();
|
|
51
|
+
context.commit();
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const normalized = normalizeBody(body);
|
|
55
|
+
if (normalized === undefined) {
|
|
56
|
+
writer.end();
|
|
57
|
+
context.commit();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (options.end === false) {
|
|
61
|
+
writer.write(normalized);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
writer.end(normalized);
|
|
65
|
+
context.commit();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/* -------------------------------------------------------------------------- */
|
|
69
|
+
/* Convenience Function */
|
|
70
|
+
/* -------------------------------------------------------------------------- */
|
|
71
|
+
export async function writeResponse(context, writer, options = {}) {
|
|
72
|
+
const responseWriter = new DefaultResponseWriter();
|
|
73
|
+
await responseWriter.write(context, writer, options);
|
|
74
|
+
}
|
|
75
|
+
/* -------------------------------------------------------------------------- */
|
|
76
|
+
/* Header Writing */
|
|
77
|
+
/* -------------------------------------------------------------------------- */
|
|
78
|
+
export function writeHeaders(context, writer, headers = context.headers) {
|
|
79
|
+
for (const [name, value] of Object.entries(headers)) {
|
|
80
|
+
if (value === undefined)
|
|
81
|
+
continue;
|
|
82
|
+
const strValue = Array.isArray(value) ? value.join(", ") : value;
|
|
83
|
+
writer.setHeader(name, strValue);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export function writeCookies(writer, cookies) {
|
|
87
|
+
for (const cookie of cookies) {
|
|
88
|
+
const serialized = serializeResponseCookie(cookie);
|
|
89
|
+
writer.appendHeader("set-cookie", serialized);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/* -------------------------------------------------------------------------- */
|
|
93
|
+
/* Automatic Headers */
|
|
94
|
+
/* -------------------------------------------------------------------------- */
|
|
95
|
+
export function prepareAutomaticHeaders(context) {
|
|
96
|
+
const body = context.body;
|
|
97
|
+
if (context.contentType === undefined &&
|
|
98
|
+
body !== undefined &&
|
|
99
|
+
body !== null) {
|
|
100
|
+
const inferred = inferContentType(body);
|
|
101
|
+
if (inferred) {
|
|
102
|
+
context.setContentType(inferred);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (context.contentLength === undefined &&
|
|
106
|
+
body !== undefined &&
|
|
107
|
+
body !== null &&
|
|
108
|
+
!isReadableStream(body)) {
|
|
109
|
+
const length = getBodyByteLength(body);
|
|
110
|
+
if (length !== undefined) {
|
|
111
|
+
context.setContentLength(length);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (isBodyForbidden(context.status)) {
|
|
115
|
+
context.removeHeader("content-length");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/* -------------------------------------------------------------------------- */
|
|
119
|
+
/* Body Normalization */
|
|
120
|
+
/* -------------------------------------------------------------------------- */
|
|
121
|
+
export function normalizeBody(body) {
|
|
122
|
+
if (typeof body === "string") {
|
|
123
|
+
return body;
|
|
124
|
+
}
|
|
125
|
+
if (body instanceof Uint8Array) {
|
|
126
|
+
return body;
|
|
127
|
+
}
|
|
128
|
+
if (body instanceof ArrayBuffer) {
|
|
129
|
+
return new Uint8Array(body);
|
|
130
|
+
}
|
|
131
|
+
if (isReadableStream(body)) {
|
|
132
|
+
throw new UnsupportedResponseBodyError("ReadableStream bodies must be handled by the streaming writer.");
|
|
133
|
+
}
|
|
134
|
+
if (body === undefined || body === null) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
if (typeof body === "number" ||
|
|
138
|
+
typeof body === "boolean" ||
|
|
139
|
+
typeof body === "bigint") {
|
|
140
|
+
return String(body);
|
|
141
|
+
}
|
|
142
|
+
if (typeof body === "object") {
|
|
143
|
+
return JSON.stringify(body);
|
|
144
|
+
}
|
|
145
|
+
throw new UnsupportedResponseBodyError();
|
|
146
|
+
}
|
|
147
|
+
/* -------------------------------------------------------------------------- */
|
|
148
|
+
/* Streaming */
|
|
149
|
+
/* -------------------------------------------------------------------------- */
|
|
150
|
+
export async function writeReadableStream(stream, writer) {
|
|
151
|
+
const reader = stream.getReader();
|
|
152
|
+
try {
|
|
153
|
+
while (true) {
|
|
154
|
+
const result = await reader.read();
|
|
155
|
+
if (result.done) {
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
if (result.value) {
|
|
159
|
+
writer.write(result.value);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
finally {
|
|
164
|
+
reader.releaseLock();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/* -------------------------------------------------------------------------- */
|
|
168
|
+
/* Body Helpers */
|
|
169
|
+
/* -------------------------------------------------------------------------- */
|
|
170
|
+
export function getBodyByteLength(body) {
|
|
171
|
+
if (typeof body === "string") {
|
|
172
|
+
return getUtf8ByteLength(body);
|
|
173
|
+
}
|
|
174
|
+
if (body instanceof Uint8Array) {
|
|
175
|
+
return body.byteLength;
|
|
176
|
+
}
|
|
177
|
+
if (body instanceof ArrayBuffer) {
|
|
178
|
+
return body.byteLength;
|
|
179
|
+
}
|
|
180
|
+
if (body === undefined || body === null) {
|
|
181
|
+
return 0;
|
|
182
|
+
}
|
|
183
|
+
if (isReadableStream(body)) {
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
const serialized = JSON.stringify(body);
|
|
188
|
+
if (serialized === undefined) {
|
|
189
|
+
return undefined;
|
|
190
|
+
}
|
|
191
|
+
return getUtf8ByteLength(serialized);
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
export function getUtf8ByteLength(value) {
|
|
198
|
+
if (typeof TextEncoder !== "undefined") {
|
|
199
|
+
return new TextEncoder().encode(value).byteLength;
|
|
200
|
+
}
|
|
201
|
+
return unescape(encodeURIComponent(value)).length;
|
|
202
|
+
}
|
|
203
|
+
/* -------------------------------------------------------------------------- */
|
|
204
|
+
/* Content Type Inference */
|
|
205
|
+
/* -------------------------------------------------------------------------- */
|
|
206
|
+
export function inferContentType(body) {
|
|
207
|
+
if (typeof body === "string") {
|
|
208
|
+
return "text/plain; charset=utf-8";
|
|
209
|
+
}
|
|
210
|
+
if (body instanceof Uint8Array || body instanceof ArrayBuffer) {
|
|
211
|
+
return "application/octet-stream";
|
|
212
|
+
}
|
|
213
|
+
if (isReadableStream(body)) {
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
if (body !== undefined && body !== null && typeof body === "object") {
|
|
217
|
+
return "application/json; charset=utf-8";
|
|
218
|
+
}
|
|
219
|
+
return "text/plain; charset=utf-8";
|
|
220
|
+
}
|
|
221
|
+
/* -------------------------------------------------------------------------- */
|
|
222
|
+
/* Status Rules */
|
|
223
|
+
/* -------------------------------------------------------------------------- */
|
|
224
|
+
export function isBodyForbidden(status) {
|
|
225
|
+
return (status === 101 ||
|
|
226
|
+
status === 204 ||
|
|
227
|
+
status === 205 ||
|
|
228
|
+
status === 304 ||
|
|
229
|
+
(status >= 100 && status < 200));
|
|
230
|
+
}
|
|
231
|
+
/* -------------------------------------------------------------------------- */
|
|
232
|
+
/* Runtime Detection */
|
|
233
|
+
/* -------------------------------------------------------------------------- */
|
|
234
|
+
export function isReadableStream(value) {
|
|
235
|
+
if (typeof ReadableStream === "undefined") {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
return value instanceof ReadableStream;
|
|
239
|
+
}
|
|
240
|
+
/* -------------------------------------------------------------------------- */
|
|
241
|
+
/* Writer State */
|
|
242
|
+
/* -------------------------------------------------------------------------- */
|
|
243
|
+
export function assertWritable(writer) {
|
|
244
|
+
if (writer.headersSent) {
|
|
245
|
+
throw new ResponseAlreadySentError("HTTP response headers have already been sent.");
|
|
246
|
+
}
|
|
247
|
+
if (writer.writableEnded) {
|
|
248
|
+
throw new ResponseAlreadySentError("HTTP response has already ended.");
|
|
249
|
+
}
|
|
250
|
+
if (writer.writable === false) {
|
|
251
|
+
throw new ResponseWriterError("HTTP response is not writable.", {
|
|
252
|
+
code: "HTTP_RESPONSE_NOT_WRITABLE",
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/* -------------------------------------------------------------------------- */
|
|
257
|
+
/* Adapter Helpers */
|
|
258
|
+
/* -------------------------------------------------------------------------- */
|
|
259
|
+
export function createResponseWriter(writer) {
|
|
260
|
+
return {
|
|
261
|
+
write(context, _writer, options) {
|
|
262
|
+
return writeResponse(context, writer, options);
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
export function isResponseWriter(value) {
|
|
267
|
+
if (value === null || typeof value !== "object") {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
const candidate = value;
|
|
271
|
+
return (typeof candidate.writeHead === "function" &&
|
|
272
|
+
typeof candidate.setHeader === "function" &&
|
|
273
|
+
typeof candidate.appendHeader === "function" &&
|
|
274
|
+
typeof candidate.removeHeader === "function" &&
|
|
275
|
+
typeof candidate.write === "function" &&
|
|
276
|
+
typeof candidate.end === "function");
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=httpResponse.writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpResponse.writer.js","sourceRoot":"","sources":["../../src/httpResponse/httpResponse.writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AAkDnC,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,OAAO,EACL,uBAAuB,IAAI,mBAAmB,EAC9C,wBAAwB,IAAI,wBAAwB,EACpD,4BAA4B,IAAI,4BAA4B,GAC7D,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,4BAA4B,GAC7B,CAAC;AAEF,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,MAAM,OAAO,qBAAqB;IAChC,KAAK,CAAC,KAAK,CACT,OAA4B,EAC5B,MAA0B,EAC1B,OAAO,GAAyB,EAAE;QAElC,cAAc,CAAC,MAAM,CAAC,CAAC;QAE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BAAmB,CAAC,gCAAgC,EAAE;YAC9D,IAAI,EAAE,4BAA4B;SACnC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF,MAAM,UAAU,oBAAoB,CAClC,MAA0B;IAE1B,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO;YAC7B,OAAO,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GAAG,KAAoC,CAAC;IAEvD,OAAO,CACL,OAAO,SAAS,CAAC,SAAS,KAAK,UAAU;QACzC,OAAO,SAAS,CAAC,SAAS,KAAK,UAAU;QACzC,OAAO,SAAS,CAAC,YAAY,KAAK,UAAU;QAC5C,OAAO,SAAS,CAAC,YAAY,KAAK,UAAU;QAC5C,OAAO,SAAS,CAAC,KAAK,KAAK,UAAU;QACrC,OAAO,SAAS,CAAC,GAAG,KAAK,UAAU,CACpC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/httpResponse/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/httpResponse/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http — Security configuration types.
|
|
3
|
+
*
|
|
4
|
+
* Defines the configuration for HTTP security features:
|
|
5
|
+
* body limits, header validation, host validation, proxy trust,
|
|
6
|
+
* timeouts, and abort propagation.
|
|
7
|
+
*/
|
|
8
|
+
/** Configuration for HTTP request security guards. */
|
|
9
|
+
export interface HTTPSecurityConfig {
|
|
10
|
+
/** Maximum request body size in bytes (default: 1MB). */
|
|
11
|
+
readonly maxBodySize?: number;
|
|
12
|
+
/** Maximum number of headers allowed (default: 100). */
|
|
13
|
+
readonly maxHeaders?: number;
|
|
14
|
+
/** Maximum individual header value size in bytes (default: 8KB). */
|
|
15
|
+
readonly maxHeaderValueSize?: number;
|
|
16
|
+
/** Maximum request URL length (default: 2048). */
|
|
17
|
+
readonly maxUrlLength?: number;
|
|
18
|
+
/** Maximum query string length (default: 4096). */
|
|
19
|
+
readonly maxQueryLength?: number;
|
|
20
|
+
/** Allowed Host header values. Empty = allow all. */
|
|
21
|
+
readonly allowedHosts?: readonly string[];
|
|
22
|
+
/** Whether to trust X-Forwarded-* headers (default: false). */
|
|
23
|
+
readonly trustProxy?: boolean;
|
|
24
|
+
/** Number of trusted proxy hops (default: 0). */
|
|
25
|
+
readonly trustedProxyCount?: number;
|
|
26
|
+
/** Request timeout in milliseconds (default: 30000). */
|
|
27
|
+
readonly requestTimeout?: number;
|
|
28
|
+
/** Headers timeout in milliseconds (default: 10000). */
|
|
29
|
+
readonly headersTimeout?: number;
|
|
30
|
+
/** Keep-alive timeout in milliseconds (default: 5000). */
|
|
31
|
+
readonly keepAliveTimeout?: number;
|
|
32
|
+
/** Maximum request ID length (default: 128). */
|
|
33
|
+
readonly maxRequestIdLength?: number;
|
|
34
|
+
/** Characters allowed in request IDs (default: alphanumeric + hyphens + underscores). */
|
|
35
|
+
readonly requestIdPattern?: RegExp;
|
|
36
|
+
/** Whether to enable CRLF injection protection (default: true). */
|
|
37
|
+
readonly enableCrlfProtection?: boolean;
|
|
38
|
+
/** Whether to enable request smuggling protection (default: true). */
|
|
39
|
+
readonly enableSmugglingProtection?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** Default security configuration. */
|
|
42
|
+
export declare const DEFAULT_SECURITY_CONFIG: Required<HTTPSecurityConfig>;
|
|
43
|
+
//# sourceMappingURL=httpSecurity.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpSecurity.config.d.ts","sourceRoot":"","sources":["../../src/httpSecurity/httpSecurity.config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,sDAAsD;AACtD,MAAM,WAAW,kBAAkB;IACjC,yDAAyD;IACzD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,wDAAwD;IACxD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,kDAAkD;IAClD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,qDAAqD;IACrD,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,iDAAiD;IACjD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,wDAAwD;IACxD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,wDAAwD;IACxD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,0DAA0D;IAC1D,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,gDAAgD;IAChD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC,yFAAyF;IACzF,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,mEAAmE;IACnE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IACxC,sEAAsE;IACtE,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED,sCAAsC;AACtC,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,kBAAkB,CAiB7D,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http — Security configuration types.
|
|
3
|
+
*
|
|
4
|
+
* Defines the configuration for HTTP security features:
|
|
5
|
+
* body limits, header validation, host validation, proxy trust,
|
|
6
|
+
* timeouts, and abort propagation.
|
|
7
|
+
*/
|
|
8
|
+
/** Default security configuration. */
|
|
9
|
+
export const DEFAULT_SECURITY_CONFIG = Object.freeze({
|
|
10
|
+
maxBodySize: 1_048_576, // 1MB
|
|
11
|
+
maxHeaders: 100,
|
|
12
|
+
maxHeaderValueSize: 8_192, // 8KB
|
|
13
|
+
maxUrlLength: 2048,
|
|
14
|
+
maxQueryLength: 4096,
|
|
15
|
+
allowedHosts: [],
|
|
16
|
+
trustProxy: false,
|
|
17
|
+
trustedProxyCount: 0,
|
|
18
|
+
requestTimeout: 30_000, // 30s
|
|
19
|
+
headersTimeout: 10_000, // 10s
|
|
20
|
+
keepAliveTimeout: 5_000, // 5s
|
|
21
|
+
maxRequestIdLength: 128,
|
|
22
|
+
requestIdPattern: /^[a-zA-Z0-9_-]+$/,
|
|
23
|
+
enableCrlfProtection: true,
|
|
24
|
+
enableSmugglingProtection: true,
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=httpSecurity.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpSecurity.config.js","sourceRoot":"","sources":["../../src/httpSecurity/httpSecurity.config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoCH,sCAAsC;AACtC,MAAM,CAAC,MAAM,uBAAuB,GAClC,MAAM,CAAC,MAAM,CAAC;IACZ,WAAW,EAAE,SAAS,EAAE,MAAM;IAC9B,UAAU,EAAE,GAAG;IACf,kBAAkB,EAAE,KAAK,EAAE,MAAM;IACjC,YAAY,EAAE,IAAI;IAClB,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE,EAAE;IAChB,UAAU,EAAE,KAAK;IACjB,iBAAiB,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,MAAM;IAC9B,cAAc,EAAE,MAAM,EAAE,MAAM;IAC9B,gBAAgB,EAAE,KAAK,EAAE,KAAK;IAC9B,kBAAkB,EAAE,GAAG;IACvB,gBAAgB,EAAE,kBAAkB;IACpC,oBAAoB,EAAE,IAAI;IAC1B,yBAAyB,EAAE,IAAI;CAChC,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http — Request guard middleware.
|
|
3
|
+
*
|
|
4
|
+
* Validates incoming requests against security constraints at the
|
|
5
|
+
* first security boundary. Rejects malformed, oversized, or
|
|
6
|
+
* suspicious requests before they reach the router.
|
|
7
|
+
*/
|
|
8
|
+
import type { HTTPSecurityConfig } from "./httpSecurity.config.js";
|
|
9
|
+
/** A request-like object for validation (keeps the guard decoupled from HTTP types). */
|
|
10
|
+
export interface GuardableRequest {
|
|
11
|
+
readonly method: string;
|
|
12
|
+
readonly url: string;
|
|
13
|
+
readonly headers: Record<string, string | string[] | undefined>;
|
|
14
|
+
}
|
|
15
|
+
/** Result of the request guard check. */
|
|
16
|
+
export interface GuardResult {
|
|
17
|
+
readonly allowed: boolean;
|
|
18
|
+
readonly errors: readonly string[];
|
|
19
|
+
readonly statusCode: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Run all security validations against an incoming request.
|
|
23
|
+
*
|
|
24
|
+
* @param request - The incoming request to validate.
|
|
25
|
+
* @param config - Security configuration.
|
|
26
|
+
* @returns A GuardResult indicating whether the request is allowed.
|
|
27
|
+
*/
|
|
28
|
+
export declare function guardRequest(request: GuardableRequest, config?: Partial<HTTPSecurityConfig>): GuardResult;
|
|
29
|
+
//# sourceMappingURL=httpSecurity.guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpSecurity.guard.d.ts","sourceRoot":"","sources":["../../src/httpSecurity/httpSecurity.guard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAYnE,wFAAwF;AACxF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;CACjE;AAED,yCAAyC;AACzC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,gBAAgB,EACzB,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACnC,WAAW,CA8Cb"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http — Request guard middleware.
|
|
3
|
+
*
|
|
4
|
+
* Validates incoming requests against security constraints at the
|
|
5
|
+
* first security boundary. Rejects malformed, oversized, or
|
|
6
|
+
* suspicious requests before they reach the router.
|
|
7
|
+
*/
|
|
8
|
+
import { validateHeaders, validateHost, validateUrl, validateQuery, validateContentLength, validateRequestId, validateTransferEncoding, } from "./httpSecurity.validator.js";
|
|
9
|
+
/**
|
|
10
|
+
* Run all security validations against an incoming request.
|
|
11
|
+
*
|
|
12
|
+
* @param request - The incoming request to validate.
|
|
13
|
+
* @param config - Security configuration.
|
|
14
|
+
* @returns A GuardResult indicating whether the request is allowed.
|
|
15
|
+
*/
|
|
16
|
+
export function guardRequest(request, config) {
|
|
17
|
+
const allErrors = [];
|
|
18
|
+
const urlParts = request.url.split("?");
|
|
19
|
+
const path = urlParts[0] ?? request.url;
|
|
20
|
+
const query = urlParts[1] ?? "";
|
|
21
|
+
const headerResult = validateHeaders(request.headers, config);
|
|
22
|
+
allErrors.push(...headerResult.errors);
|
|
23
|
+
const hostResult = validateHost(request.headers.host, config);
|
|
24
|
+
allErrors.push(...hostResult.errors);
|
|
25
|
+
const urlResult = validateUrl(path, config);
|
|
26
|
+
allErrors.push(...urlResult.errors);
|
|
27
|
+
const queryResult = validateQuery(query, config);
|
|
28
|
+
allErrors.push(...queryResult.errors);
|
|
29
|
+
const contentLengthResult = validateContentLength(request.headers["content-length"], config);
|
|
30
|
+
allErrors.push(...contentLengthResult.errors);
|
|
31
|
+
const requestIdResult = validateRequestId(request.headers["x-request-id"], config);
|
|
32
|
+
allErrors.push(...requestIdResult.errors);
|
|
33
|
+
const transferEncodingResult = validateTransferEncoding(request.headers["transfer-encoding"], request.headers["content-length"], config);
|
|
34
|
+
allErrors.push(...transferEncodingResult.errors);
|
|
35
|
+
if (allErrors.length > 0) {
|
|
36
|
+
return { allowed: false, errors: allErrors, statusCode: 400 };
|
|
37
|
+
}
|
|
38
|
+
return { allowed: true, errors: [], statusCode: 200 };
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=httpSecurity.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpSecurity.guard.js","sourceRoot":"","sources":["../../src/httpSecurity/httpSecurity.guard.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,eAAe,EACf,YAAY,EACZ,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,iBA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,SAAS,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAE1C,MAAM,sBAAsB,GAAG,wBAAwB,CACrD,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAuB,EAC1D,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAuB,EACvD,MAAM,CACP,CAAC;IACF,SAAS,CAAC,IAAI,CAAC,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAEjD,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;IAChE,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @zudojs/http — Request validation functions.
|
|
3
|
+
*
|
|
4
|
+
* Validates incoming HTTP requests against security constraints:
|
|
5
|
+
* body size, header count, header values, URL length, host, and
|
|
6
|
+
* request ID format.
|
|
7
|
+
*/
|
|
8
|
+
import type { HTTPSecurityConfig } from "./httpSecurity.config.js";
|
|
9
|
+
/** Result of a security validation check. */
|
|
10
|
+
export interface SecurityValidationResult {
|
|
11
|
+
readonly valid: boolean;
|
|
12
|
+
readonly errors: readonly string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Validate request headers against security limits.
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateHeaders(headers: Record<string, string | string[] | undefined>, config?: Partial<HTTPSecurityConfig>): SecurityValidationResult;
|
|
18
|
+
/**
|
|
19
|
+
* Validate the Host header against allowed hosts.
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateHost(host: string | undefined, config?: Partial<HTTPSecurityConfig>): SecurityValidationResult;
|
|
22
|
+
/**
|
|
23
|
+
* Validate request URL length.
|
|
24
|
+
*/
|
|
25
|
+
export declare function validateUrl(url: string, config?: Partial<HTTPSecurityConfig>): SecurityValidationResult;
|
|
26
|
+
/**
|
|
27
|
+
* Validate query string length.
|
|
28
|
+
*/
|
|
29
|
+
export declare function validateQuery(query: string, config?: Partial<HTTPSecurityConfig>): SecurityValidationResult;
|
|
30
|
+
/**
|
|
31
|
+
* Validate Content-Length header against body size limit.
|
|
32
|
+
*/
|
|
33
|
+
export declare function validateContentLength(contentLength: string | undefined, config?: Partial<HTTPSecurityConfig>): SecurityValidationResult;
|
|
34
|
+
/**
|
|
35
|
+
* Validate X-Request-ID format and length.
|
|
36
|
+
*/
|
|
37
|
+
export declare function validateRequestId(requestId: string | undefined, config?: Partial<HTTPSecurityConfig>): SecurityValidationResult;
|
|
38
|
+
/**
|
|
39
|
+
* Validate transfer encoding to prevent request smuggling.
|
|
40
|
+
*/
|
|
41
|
+
export declare function validateTransferEncoding(transferEncoding: string | undefined, contentLength: string | undefined, config?: Partial<HTTPSecurityConfig>): SecurityValidationResult;
|
|
42
|
+
//# sourceMappingURL=httpSecurity.validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpSecurity.validator.d.ts","sourceRoot":"","sources":["../../src/httpSecurity/httpSecurity.validator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnE,6CAA6C;AAC7C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AASD;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,EACtD,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACnC,wBAAwB,CAyB1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