@adaas/a-server 0.0.22 → 0.0.23
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/.conf/tsconfig.base.json +79 -0
- package/.conf/tsconfig.browser.json +32 -0
- package/.conf/tsconfig.node.json +33 -0
- package/LICENSE +10 -19
- package/dist/browser/index.d.mts +1669 -0
- package/dist/browser/index.mjs +2869 -0
- package/dist/browser/index.mjs.map +1 -0
- package/dist/node/A-Request.entity-8_9MCXT2.d.ts +533 -0
- package/dist/node/A-Request.entity-r905O60G.d.mts +533 -0
- package/dist/node/A-Response.entity-BVYAc6-8.d.mts +318 -0
- package/dist/node/A-Response.entity-CRc-t-vr.d.ts +318 -0
- package/dist/node/channels/A-Http/A-Http.channel.constants.d.mts +9 -0
- package/dist/node/channels/A-Http/A-Http.channel.constants.d.ts +9 -0
- package/dist/node/channels/A-Http/A-Http.channel.constants.js +13 -0
- package/dist/node/channels/A-Http/A-Http.channel.constants.js.map +1 -0
- package/dist/node/channels/A-Http/A-Http.channel.constants.mjs +12 -0
- package/dist/node/channels/A-Http/A-Http.channel.constants.mjs.map +1 -0
- package/dist/node/channels/A-Http/A-Http.channel.d.mts +23 -0
- package/dist/node/channels/A-Http/A-Http.channel.d.ts +23 -0
- package/dist/node/channels/A-Http/A-Http.channel.error.d.mts +7 -0
- package/dist/node/channels/A-Http/A-Http.channel.error.d.ts +7 -0
- package/dist/node/channels/A-Http/A-Http.channel.error.js +11 -0
- package/dist/node/channels/A-Http/A-Http.channel.error.js.map +1 -0
- package/dist/node/channels/A-Http/A-Http.channel.error.mjs +10 -0
- package/dist/node/channels/A-Http/A-Http.channel.error.mjs.map +1 -0
- package/dist/node/channels/A-Http/A-Http.channel.js +122 -0
- package/dist/node/channels/A-Http/A-Http.channel.js.map +1 -0
- package/dist/node/channels/A-Http/A-Http.channel.mjs +110 -0
- package/dist/node/channels/A-Http/A-Http.channel.mjs.map +1 -0
- package/dist/node/channels/A-Http/A-Http.channel.types.d.mts +67 -0
- package/dist/node/channels/A-Http/A-Http.channel.types.d.ts +67 -0
- package/dist/node/channels/A-Http/A-Http.channel.types.js +4 -0
- package/dist/node/channels/A-Http/A-Http.channel.types.js.map +1 -0
- package/dist/node/channels/A-Http/A-Http.channel.types.mjs +3 -0
- package/dist/node/channels/A-Http/A-Http.channel.types.mjs.map +1 -0
- package/dist/node/channels/A-Websockets/A-Websockets.channel.d.mts +7 -0
- package/dist/node/channels/A-Websockets/A-Websockets.channel.d.ts +7 -0
- package/dist/node/channels/A-Websockets/A-Websockets.channel.js +13 -0
- package/dist/node/channels/A-Websockets/A-Websockets.channel.js.map +1 -0
- package/dist/node/channels/A-Websockets/A-Websockets.channel.mjs +12 -0
- package/dist/node/channels/A-Websockets/A-Websockets.channel.mjs.map +1 -0
- package/dist/node/chunk-EQQGB2QZ.mjs +15 -0
- package/dist/node/chunk-EQQGB2QZ.mjs.map +1 -0
- package/dist/node/constants/env.constants.d.mts +12 -0
- package/dist/node/constants/env.constants.d.ts +12 -0
- package/dist/node/constants/env.constants.js +23 -0
- package/dist/node/constants/env.constants.js.map +1 -0
- package/dist/node/constants/env.constants.mjs +22 -0
- package/dist/node/constants/env.constants.mjs.map +1 -0
- package/dist/node/controllers/A-CommandController/A-CommandController.component.d.mts +29 -0
- package/dist/node/controllers/A-CommandController/A-CommandController.component.d.ts +29 -0
- package/dist/node/controllers/A-CommandController/A-CommandController.component.js +55 -0
- package/dist/node/controllers/A-CommandController/A-CommandController.component.js.map +1 -0
- package/dist/node/controllers/A-CommandController/A-CommandController.component.mjs +43 -0
- package/dist/node/controllers/A-CommandController/A-CommandController.component.mjs.map +1 -0
- package/dist/node/controllers/A-EntityController/A-EntityController.component.d.mts +44 -0
- package/dist/node/controllers/A-EntityController/A-EntityController.component.d.ts +44 -0
- package/dist/node/controllers/A-EntityController/A-EntityController.component.js +189 -0
- package/dist/node/controllers/A-EntityController/A-EntityController.component.js.map +1 -0
- package/dist/node/controllers/A-EntityController/A-EntityController.component.mjs +177 -0
- package/dist/node/controllers/A-EntityController/A-EntityController.component.mjs.map +1 -0
- package/dist/node/controllers/A-EntityController/A-EntityController.component.types.d.mts +2 -0
- package/dist/node/controllers/A-EntityController/A-EntityController.component.types.d.ts +2 -0
- package/dist/node/controllers/A-EntityController/A-EntityController.component.types.js +4 -0
- package/dist/node/controllers/A-EntityController/A-EntityController.component.types.js.map +1 -0
- package/dist/node/controllers/A-EntityController/A-EntityController.component.types.mjs +3 -0
- package/dist/node/controllers/A-EntityController/A-EntityController.component.types.mjs.map +1 -0
- package/dist/node/controllers/A-ListingController/A-ListingController.component.d.mts +28 -0
- package/dist/node/controllers/A-ListingController/A-ListingController.component.d.ts +28 -0
- package/dist/node/controllers/A-ListingController/A-ListingController.component.js +59 -0
- package/dist/node/controllers/A-ListingController/A-ListingController.component.js.map +1 -0
- package/dist/node/controllers/A-ListingController/A-ListingController.component.mjs +47 -0
- package/dist/node/controllers/A-ListingController/A-ListingController.component.mjs.map +1 -0
- package/dist/node/controllers/A-ListingController/A-ListingController.types.d.mts +2 -0
- package/dist/node/controllers/A-ListingController/A-ListingController.types.d.ts +2 -0
- package/dist/node/controllers/A-ListingController/A-ListingController.types.js +4 -0
- package/dist/node/controllers/A-ListingController/A-ListingController.types.js.map +1 -0
- package/dist/node/controllers/A-ListingController/A-ListingController.types.mjs +3 -0
- package/dist/node/controllers/A-ListingController/A-ListingController.types.mjs.map +1 -0
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.d.mts +30 -0
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.d.ts +30 -0
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js +46 -0
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js.map +1 -0
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.mjs +34 -0
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.mjs.map +1 -0
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.d.mts +2 -0
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.d.ts +2 -0
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.js +4 -0
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.js.map +1 -0
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.mjs +3 -0
- package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.mjs.map +1 -0
- package/dist/node/index.d.mts +51 -0
- package/dist/node/index.d.ts +51 -0
- package/dist/node/index.js +320 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/index.mjs +48 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/node/lib/A-Request/A-HttpRequestData.context.d.mts +12 -0
- package/dist/node/lib/A-Request/A-HttpRequestData.context.d.ts +12 -0
- package/dist/node/lib/A-Request/A-HttpRequestData.context.js +25 -0
- package/dist/node/lib/A-Request/A-HttpRequestData.context.js.map +1 -0
- package/dist/node/lib/A-Request/A-HttpRequestData.context.mjs +24 -0
- package/dist/node/lib/A-Request/A-HttpRequestData.context.mjs.map +1 -0
- package/dist/node/lib/A-Request/A-HttpServerRequest.context.d.mts +39 -0
- package/dist/node/lib/A-Request/A-HttpServerRequest.context.d.ts +39 -0
- package/dist/node/lib/A-Request/A-HttpServerRequest.context.js +56 -0
- package/dist/node/lib/A-Request/A-HttpServerRequest.context.js.map +1 -0
- package/dist/node/lib/A-Request/A-HttpServerRequest.context.mjs +55 -0
- package/dist/node/lib/A-Request/A-HttpServerRequest.context.mjs.map +1 -0
- package/dist/node/lib/A-Request/A-Request.constants.d.mts +18 -0
- package/dist/node/lib/A-Request/A-Request.constants.d.ts +18 -0
- package/dist/node/lib/A-Request/A-Request.constants.js +22 -0
- package/dist/node/lib/A-Request/A-Request.constants.js.map +1 -0
- package/dist/node/lib/A-Request/A-Request.constants.mjs +22 -0
- package/dist/node/lib/A-Request/A-Request.constants.mjs.map +1 -0
- package/dist/node/lib/A-Request/A-Request.entity.d.mts +17 -0
- package/dist/node/lib/A-Request/A-Request.entity.d.ts +17 -0
- package/dist/node/lib/A-Request/A-Request.entity.js +651 -0
- package/dist/node/lib/A-Request/A-Request.entity.js.map +1 -0
- package/dist/node/lib/A-Request/A-Request.entity.mjs +639 -0
- package/dist/node/lib/A-Request/A-Request.entity.mjs.map +1 -0
- package/dist/node/lib/A-Request/A-Request.env.d.mts +37 -0
- package/dist/node/lib/A-Request/A-Request.env.d.ts +37 -0
- package/dist/node/lib/A-Request/A-Request.env.js +39 -0
- package/dist/node/lib/A-Request/A-Request.env.js.map +1 -0
- package/dist/node/lib/A-Request/A-Request.env.mjs +38 -0
- package/dist/node/lib/A-Request/A-Request.env.mjs.map +1 -0
- package/dist/node/lib/A-Request/A-Request.error.d.mts +11 -0
- package/dist/node/lib/A-Request/A-Request.error.d.ts +11 -0
- package/dist/node/lib/A-Request/A-Request.error.js +15 -0
- package/dist/node/lib/A-Request/A-Request.error.js.map +1 -0
- package/dist/node/lib/A-Request/A-Request.error.mjs +14 -0
- package/dist/node/lib/A-Request/A-Request.error.mjs.map +1 -0
- package/dist/node/lib/A-Request/A-Request.helper.d.mts +105 -0
- package/dist/node/lib/A-Request/A-Request.helper.d.ts +105 -0
- package/dist/node/lib/A-Request/A-Request.helper.js +181 -0
- package/dist/node/lib/A-Request/A-Request.helper.js.map +1 -0
- package/dist/node/lib/A-Request/A-Request.helper.mjs +180 -0
- package/dist/node/lib/A-Request/A-Request.helper.mjs.map +1 -0
- package/dist/node/lib/A-Request/A-Request.types.d.mts +17 -0
- package/dist/node/lib/A-Request/A-Request.types.d.ts +17 -0
- package/dist/node/lib/A-Request/A-Request.types.js +14 -0
- package/dist/node/lib/A-Request/A-Request.types.js.map +1 -0
- package/dist/node/lib/A-Request/A-Request.types.mjs +14 -0
- package/dist/node/lib/A-Request/A-Request.types.mjs.map +1 -0
- package/dist/node/lib/A-Response/A-Response.constants.d.mts +24 -0
- package/dist/node/lib/A-Response/A-Response.constants.d.ts +24 -0
- package/dist/node/lib/A-Response/A-Response.constants.js +28 -0
- package/dist/node/lib/A-Response/A-Response.constants.js.map +1 -0
- package/dist/node/lib/A-Response/A-Response.constants.mjs +28 -0
- package/dist/node/lib/A-Response/A-Response.constants.mjs.map +1 -0
- package/dist/node/lib/A-Response/A-Response.entity.d.mts +20 -0
- package/dist/node/lib/A-Response/A-Response.entity.d.ts +20 -0
- package/dist/node/lib/A-Response/A-Response.entity.js +544 -0
- package/dist/node/lib/A-Response/A-Response.entity.js.map +1 -0
- package/dist/node/lib/A-Response/A-Response.entity.mjs +532 -0
- package/dist/node/lib/A-Response/A-Response.entity.mjs.map +1 -0
- package/dist/node/lib/A-Response/A-Response.env.d.mts +2 -0
- package/dist/node/lib/A-Response/A-Response.env.d.ts +2 -0
- package/dist/node/lib/A-Response/A-Response.env.js +4 -0
- package/dist/node/lib/A-Response/A-Response.env.js.map +1 -0
- package/dist/node/lib/A-Response/A-Response.env.mjs +3 -0
- package/dist/node/lib/A-Response/A-Response.env.mjs.map +1 -0
- package/dist/node/lib/A-Response/A-Response.error.d.mts +6 -0
- package/dist/node/lib/A-Response/A-Response.error.d.ts +6 -0
- package/dist/node/lib/A-Response/A-Response.error.js +10 -0
- package/dist/node/lib/A-Response/A-Response.error.js.map +1 -0
- package/dist/node/lib/A-Response/A-Response.error.mjs +9 -0
- package/dist/node/lib/A-Response/A-Response.error.mjs.map +1 -0
- package/dist/node/lib/A-Response/A-Response.types.d.mts +20 -0
- package/dist/node/lib/A-Response/A-Response.types.d.ts +20 -0
- package/dist/node/lib/A-Response/A-Response.types.js +4 -0
- package/dist/node/lib/A-Response/A-Response.types.js.map +1 -0
- package/dist/node/lib/A-Response/A-Response.types.mjs +3 -0
- package/dist/node/lib/A-Response/A-Response.types.mjs.map +1 -0
- package/dist/node/lib/A-Server/A-HttpServer.constants.d.mts +7 -0
- package/dist/node/lib/A-Server/A-HttpServer.constants.d.ts +7 -0
- package/dist/node/lib/A-Server/A-HttpServer.constants.js +11 -0
- package/dist/node/lib/A-Server/A-HttpServer.constants.js.map +1 -0
- package/dist/node/lib/A-Server/A-HttpServer.constants.mjs +11 -0
- package/dist/node/lib/A-Server/A-HttpServer.constants.mjs.map +1 -0
- package/dist/node/lib/A-Server/A-HttpServer.container.d.mts +50 -0
- package/dist/node/lib/A-Server/A-HttpServer.container.d.ts +50 -0
- package/dist/node/lib/A-Server/A-HttpServer.container.js +194 -0
- package/dist/node/lib/A-Server/A-HttpServer.container.js.map +1 -0
- package/dist/node/lib/A-Server/A-HttpServer.container.mjs +182 -0
- package/dist/node/lib/A-Server/A-HttpServer.container.mjs.map +1 -0
- package/dist/node/lib/A-Server/A-HttpServer.error.d.mts +54 -0
- package/dist/node/lib/A-Server/A-HttpServer.error.d.ts +54 -0
- package/dist/node/lib/A-Server/A-HttpServer.error.js +118 -0
- package/dist/node/lib/A-Server/A-HttpServer.error.js.map +1 -0
- package/dist/node/lib/A-Server/A-HttpServer.error.mjs +117 -0
- package/dist/node/lib/A-Server/A-HttpServer.error.mjs.map +1 -0
- package/dist/node/lib/A-Server/A-HttpServer.types.d.mts +19 -0
- package/dist/node/lib/A-Server/A-HttpServer.types.d.ts +19 -0
- package/dist/node/lib/A-Server/A-HttpServer.types.js +4 -0
- package/dist/node/lib/A-Server/A-HttpServer.types.js.map +1 -0
- package/dist/node/lib/A-Server/A-HttpServer.types.mjs +3 -0
- package/dist/node/lib/A-Server/A-HttpServer.types.mjs.map +1 -0
- package/dist/node/lib/A-Server/A-Server.context.d.mts +22 -0
- package/dist/node/lib/A-Server/A-Server.context.d.ts +22 -0
- package/dist/node/lib/A-Server/A-Server.context.js +24 -0
- package/dist/node/lib/A-Server/A-Server.context.js.map +1 -0
- package/dist/node/lib/A-Server/A-Server.context.mjs +23 -0
- package/dist/node/lib/A-Server/A-Server.context.mjs.map +1 -0
- package/dist/node/lib/A-Server/A-Server.error.d.mts +14 -0
- package/dist/node/lib/A-Server/A-Server.error.d.ts +14 -0
- package/dist/node/lib/A-Server/A-Server.error.js +26 -0
- package/dist/node/lib/A-Server/A-Server.error.js.map +1 -0
- package/dist/node/lib/A-Server/A-Server.error.mjs +25 -0
- package/dist/node/lib/A-Server/A-Server.error.mjs.map +1 -0
- package/dist/node/lib/A-Server/A-Server.types.d.mts +26 -0
- package/dist/node/lib/A-Server/A-Server.types.d.ts +26 -0
- package/dist/node/lib/A-Server/A-Server.types.js +4 -0
- package/dist/node/lib/A-Server/A-Server.types.js.map +1 -0
- package/dist/node/lib/A-Server/A-Server.types.mjs +3 -0
- package/dist/node/lib/A-Server/A-Server.types.mjs.map +1 -0
- package/dist/node/lib/A-ServerController/A-ServerController.component.d.mts +29 -0
- package/dist/node/lib/A-ServerController/A-ServerController.component.d.ts +29 -0
- package/dist/node/lib/A-ServerController/A-ServerController.component.js +49 -0
- package/dist/node/lib/A-ServerController/A-ServerController.component.js.map +1 -0
- package/dist/node/lib/A-ServerController/A-ServerController.component.mjs +37 -0
- package/dist/node/lib/A-ServerController/A-ServerController.component.mjs.map +1 -0
- package/dist/node/lib/A-ServerController/A-ServerController.types.d.mts +2 -0
- package/dist/node/lib/A-ServerController/A-ServerController.types.d.ts +2 -0
- package/dist/node/lib/A-ServerController/A-ServerController.types.js +4 -0
- package/dist/node/lib/A-ServerController/A-ServerController.types.js.map +1 -0
- package/dist/node/lib/A-ServerController/A-ServerController.types.mjs +3 -0
- package/dist/node/lib/A-ServerController/A-ServerController.types.mjs.map +1 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.d.mts +49 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.d.ts +49 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.js +91 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.js.map +1 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.mjs +90 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.mjs.map +1 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityList.types.d.mts +22 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityList.types.d.ts +22 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityList.types.js +10 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityList.types.js.map +1 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityList.types.mjs +10 -0
- package/dist/node/lib/A-ServerEntityList/A-EntityList.types.mjs.map +1 -0
- package/dist/node/lib/A-ServerListQuery/A-ServerListQueryFilter.context.d.mts +13 -0
- package/dist/node/lib/A-ServerListQuery/A-ServerListQueryFilter.context.d.ts +13 -0
- package/dist/node/lib/A-ServerListQuery/A-ServerListQueryFilter.context.js +32 -0
- package/dist/node/lib/A-ServerListQuery/A-ServerListQueryFilter.context.js.map +1 -0
- package/dist/node/lib/A-ServerListQuery/A-ServerListQueryFilter.context.mjs +31 -0
- package/dist/node/lib/A-ServerListQuery/A-ServerListQueryFilter.context.mjs.map +1 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.d.mts +48 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.d.ts +48 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.js +88 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.js.map +1 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.mjs +76 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.mjs.map +1 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.constants.d.mts +24 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.constants.d.ts +24 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.constants.js +33 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.constants.js.map +1 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.constants.mjs +33 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.constants.mjs.map +1 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.types.d.mts +12 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.types.d.ts +12 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.types.js +4 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.types.js.map +1 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.types.mjs +3 -0
- package/dist/node/lib/A-ServerLogger/A-ServerLogger.types.mjs.map +1 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.component.d.mts +6 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.component.d.ts +6 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.component.js +18 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.component.js.map +1 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.component.mjs +17 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.component.mjs.map +1 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.constants.d.mts +2 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.constants.d.ts +2 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.constants.js +4 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.constants.js.map +1 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.constants.mjs +3 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.constants.mjs.map +1 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.types.d.mts +2 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.types.d.ts +2 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.types.js +4 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.types.js.map +1 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.types.mjs +3 -0
- package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.types.mjs.map +1 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.component.d.mts +31 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.component.d.ts +31 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.component.js +90 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.component.js.map +1 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.component.mjs +78 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.component.mjs.map +1 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.constants.d.mts +9 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.constants.d.ts +9 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.constants.js +14 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.constants.js.map +1 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.constants.mjs +14 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.constants.mjs.map +1 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.context.d.mts +36 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.context.d.ts +36 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.context.js +60 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.context.js.map +1 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.context.mjs +59 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.context.mjs.map +1 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.types.d.mts +23 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.types.d.ts +23 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.types.js +4 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.types.js.map +1 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.types.mjs +3 -0
- package/dist/node/lib/A-ServerProxy/A-ServerProxy.types.mjs.map +1 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.constants.d.mts +20 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.constants.d.ts +20 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.constants.js +25 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.constants.js.map +1 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.constants.mjs +24 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.constants.mjs.map +1 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.entity.d.mts +15 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.entity.d.ts +15 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.entity.js +24 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.entity.js.map +1 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.entity.mjs +23 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.entity.mjs.map +1 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.types.d.mts +6 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.types.d.ts +6 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.types.js +4 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.types.js.map +1 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.types.mjs +3 -0
- package/dist/node/lib/A-ServerRoute/A-ServerRoute.types.mjs.map +1 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.d.mts +84 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.d.ts +84 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.js +194 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.js.map +1 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.mjs +184 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.mjs.map +1 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.constants.d.mts +6 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.constants.d.ts +6 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.constants.js +10 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.constants.js.map +1 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.constants.mjs +10 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.constants.mjs.map +1 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.meta.d.mts +16 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.meta.d.ts +16 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.meta.js +40 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.meta.js.map +1 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.meta.mjs +39 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.meta.mjs.map +1 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.types.d.mts +24 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.types.d.ts +24 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.types.js +4 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.types.js.map +1 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.types.mjs +3 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouter.types.mjs.map +1 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouterDefine.decorator.d.mts +16 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouterDefine.decorator.d.ts +16 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouterDefine.decorator.js +25 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouterDefine.decorator.js.map +1 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouterDefine.decorator.mjs +24 -0
- package/dist/node/lib/A-ServerRouter/A-ServerRouterDefine.decorator.mjs.map +1 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.component.d.mts +65 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.component.d.ts +65 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.component.js +260 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.component.js.map +1 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.component.mjs +248 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.component.mjs.map +1 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.context.d.mts +110 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.context.d.ts +110 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.context.js +180 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.context.js.map +1 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.context.mjs +179 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.context.mjs.map +1 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.types.d.mts +8 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.types.d.ts +8 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.types.js +4 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.types.js.map +1 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.types.mjs +3 -0
- package/dist/node/lib/A-ServerStatic/A-ServerStatic.types.mjs.map +1 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.d.mts +29 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.d.ts +29 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.js +62 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.js.map +1 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.mjs +50 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.mjs.map +1 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.constants.d.mts +5 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.constants.d.ts +5 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.constants.js +14 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.constants.js.map +1 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.constants.mjs +14 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.constants.mjs.map +1 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.types.d.mts +9 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.types.d.ts +9 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.types.js +4 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.types.js.map +1 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.types.mjs +3 -0
- package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.types.mjs.map +1 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.d.mts +24 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.d.ts +24 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.js +94 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.js.map +1 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.mjs +82 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.mjs.map +1 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.error.d.mts +2 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.error.d.ts +2 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.error.js +4 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.error.js.map +1 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.error.mjs +3 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.error.mjs.map +1 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.types.d.mts +2 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.types.d.ts +2 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.types.js +4 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.types.js.map +1 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.types.mjs +3 -0
- package/dist/node/repositories/A-EntityRepository/A-EntityRepository.types.mjs.map +1 -0
- package/examples/simple-server/commands/SignIn.command.ts +17 -1
- package/examples/simple-server/components/Test.controller.ts +8 -7
- package/examples/simple-server/components/Users.repository.ts +28 -26
- package/examples/simple-server/concept.ts +56 -66
- package/examples/simple-server/entities/User/User.entity.ts +17 -7
- package/jest.config.ts +24 -10
- package/package.json +267 -25
- package/src/channels/A-Http/A-Http.channel.constants.ts +6 -7
- package/src/channels/A-Http/A-Http.channel.error.ts +2 -2
- package/src/channels/A-Http/A-Http.channel.ts +76 -125
- package/src/channels/A-Http/A-Http.channel.types.ts +6 -3
- package/src/channels/A-Websockets/A-Websockets.channel.ts +1 -1
- package/src/{components → controllers}/A-CommandController/A-CommandController.component.ts +16 -10
- package/src/{components → controllers}/A-EntityController/A-EntityController.component.ts +24 -28
- package/src/{components → controllers}/A-ListingController/A-ListingController.component.ts +10 -12
- package/src/{components → controllers}/A-ServerHealthMonitor/A-ServerHealthMonitor.component.ts +11 -11
- package/src/index.ts +58 -63
- package/src/lib/A-Request/A-HttpRequestData.context.ts +30 -0
- package/src/lib/A-Request/A-HttpServerRequest.context.ts +103 -0
- package/src/lib/A-Request/A-Request.constants.ts +30 -0
- package/src/lib/A-Request/A-Request.entity.ts +844 -0
- package/src/lib/A-Request/A-Request.env.ts +50 -0
- package/src/lib/A-Request/A-Request.error.ts +11 -0
- package/src/lib/A-Request/A-Request.helper.ts +276 -0
- package/src/lib/A-Request/A-Request.types.ts +284 -0
- package/src/lib/A-Request/README.md +567 -0
- package/src/lib/A-Response/A-Response.constants.ts +24 -0
- package/src/lib/A-Response/A-Response.entity.ts +689 -0
- package/src/lib/A-Response/A-Response.error.ts +6 -0
- package/src/lib/A-Response/A-Response.types.ts +127 -0
- package/src/lib/A-Response/README.md +793 -0
- package/src/lib/A-Server/A-HttpServer.constants.ts +9 -0
- package/src/lib/A-Server/A-HttpServer.container.ts +251 -0
- package/src/lib/A-Server/A-HttpServer.error.ts +165 -0
- package/src/lib/A-Server/A-HttpServer.types.ts +37 -0
- package/src/{context/A-Server/A_Server.context.ts → lib/A-Server/A-Server.context.ts} +6 -7
- package/src/lib/A-Server/A-Server.error.ts +26 -0
- package/src/{components/A-ServerError/A-ServerError.types.ts → lib/A-Server/A-Server.types.ts} +8 -0
- package/src/{components/A-Controller/A-Controller.component.ts → lib/A-ServerController/A-ServerController.component.ts} +5 -5
- package/src/{entities/A_EntityList/A_EntityList.entity.ts → lib/A-ServerEntityList/A-EntityList.entity.ts} +2 -2
- package/src/{entities/A_EntityList/A_EntityList.entity.types.ts → lib/A-ServerEntityList/A-EntityList.types.ts} +2 -2
- package/src/{context/A-ListQueryFilter/A_ListQueryFilter.context.ts → lib/A-ServerListQuery/A-ServerListQueryFilter.context.ts} +1 -1
- package/src/lib/A-ServerLogger/A-ServerLogger.component.ts +121 -0
- package/src/lib/A-ServerLogger/A-ServerLogger.types.ts +13 -0
- package/src/lib/A-ServerMiddleware/A-ServerMiddleware.component.ts +17 -0
- package/src/{components → lib}/A-ServerProxy/A-ServerProxy.component.ts +17 -12
- package/src/{context/A-ProxyConfig/A_ProxyConfig.constants.ts → lib/A-ServerProxy/A-ServerProxy.constants.ts} +1 -1
- package/src/{context/A-ProxyConfig/A_ProxyConfig.context.ts → lib/A-ServerProxy/A-ServerProxy.context.ts} +4 -4
- package/src/{context/A-ProxyConfig/A_ProxyConfig.types.ts → lib/A-ServerProxy/A-ServerProxy.types.ts} +4 -4
- package/src/lib/A-ServerRoute/A-ServerRoute.constants.ts +20 -0
- package/src/lib/A-ServerRoute/A-ServerRoute.entity.ts +48 -0
- package/src/lib/A-ServerRoute/A-ServerRoute.types.ts +6 -0
- package/src/{components/A-Router/A-Router.component.ts → lib/A-ServerRouter/A-ServerRouter.component.ts} +77 -97
- package/src/lib/A-ServerRouter/A-ServerRouter.constants.ts +8 -0
- package/src/lib/A-ServerRouter/A-ServerRouter.meta.ts +48 -0
- package/src/lib/A-ServerRouter/A-ServerRouter.types.ts +27 -0
- package/src/lib/A-ServerRouter/A-ServerRouterDefine.decorator.ts +37 -0
- package/src/{components/A-StaticLoader/A-StaticLoader.component.ts → lib/A-ServerStatic/A-ServerStatic.component.ts} +73 -54
- package/src/{context/A-StaticConfig/A-StaticConfig.context.ts → lib/A-ServerStatic/A-ServerStatic.context.ts} +16 -6
- package/src/{components → middlewares}/A-ServerCORS/A_ServerCORS.component.ts +16 -13
- package/src/{components/A-ServerCORS/A_ServerCORS.component.defaults.ts → middlewares/A-ServerCORS/A_ServerCORS.constants.ts} +2 -2
- package/src/{components → repositories}/A-EntityRepository/A-EntityRepository.component.ts +39 -30
- package/tests/A-HttpChannel.test.ts +41 -48
- package/tests/A-HttpServerError.test.ts +204 -0
- package/tests/A-Request.test.ts +351 -0
- package/tsconfig.json +40 -50
- package/tsup.config.ts +111 -13
- package/dist/index.d.mts +0 -855
- package/dist/index.d.ts +0 -855
- package/dist/index.js +0 -2179
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -2144
- package/dist/index.mjs.map +0 -1
- package/examples/microservices-server/components/controllers/Statistics.controller.ts +0 -18
- package/examples/microservices-server/components/repositories/Memory.repository.ts +0 -66
- package/examples/microservices-server/concept.ts +0 -43
- package/examples/microservices-server/context/MemoryStore.context.ts +0 -31
- package/examples/microservices-server/entities/Order.entity.ts +0 -7
- package/examples/microservices-server/entities/User.entity.ts +0 -8
- package/src/components/A-Router/A-Router.component.types.ts +0 -38
- package/src/components/A-ServerError/A-ServerError.class.ts +0 -98
- package/src/components/A-ServerLogger/A_ServerLogger.component.ts +0 -194
- package/src/components/A-ServerLogger/A_ServerLogger.component.types.ts +0 -14
- package/src/containers/A-Service/A-Service.container.ts +0 -218
- package/src/containers/A-Service/A-Service.container.types.ts +0 -46
- package/src/context/A-EntityFactory/A-EntityFactory.context.ts +0 -163
- package/src/context/A-EntityFactory/A-EntityFactory.context.types.ts +0 -11
- package/src/context/A-HttpChannel/A-HttpChannel.context.ts +0 -36
- package/src/context/A-Server/A_Server.context.types.ts +0 -9
- package/src/entities/A-Request/A-Request.entity.ts +0 -163
- package/src/entities/A-Request/A-Request.entity.types.ts +0 -41
- package/src/entities/A-Response/A-Response.entity.ts +0 -194
- package/src/entities/A-Response/A-Response.entity.types.ts +0 -26
- package/src/entities/A-Route/A-Route.entity.ts +0 -117
- package/tests/A-Service.test.ts +0 -18
- /package/src/{components → controllers}/A-EntityController/A-EntityController.component.types.ts +0 -0
- /package/src/{components/A-Controller/A-Controller.component.types.ts → controllers/A-ListingController/A-ListingController.types.ts} +0 -0
- /package/src/{components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.types.ts → controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.ts} +0 -0
- /package/src/{components/A-EntityRepository/A-EntityRepository.error.ts → lib/A-Response/A-Response.env.ts} +0 -0
- /package/src/{components/A-EntityRepository/A-EntityRepository.types.ts → lib/A-ServerController/A-ServerController.types.ts} +0 -0
- /package/src/{components → lib}/A-ServerLogger/A-ServerLogger.constants.ts +0 -0
- /package/src/{components/A-ListingController/A-ListingController.component.types.ts → lib/A-ServerMiddleware/A-ServerMiddleware.constants.ts} +0 -0
- /package/src/{components/A-ServerError/A-ServerError.constants.ts → lib/A-ServerMiddleware/A-ServerMiddleware.types.ts} +0 -0
- /package/src/{components/A-StaticLoader/A-StaticLoader.component.types.ts → lib/A-ServerStatic/A-ServerStatic.types.ts} +0 -0
- /package/src/{components/A-ServerCORS/A_ServerCORS.component.types.ts → middlewares/A-ServerCORS/A_ServerCORS.types.ts} +0 -0
- /package/src/{context/A-StaticConfig/A-StaticConfig.context.types.ts → repositories/A-EntityRepository/A-EntityRepository.error.ts} +0 -0
- /package/src/{entities/A-Route/A-Route.entity.types.ts → repositories/A-EntityRepository/A-EntityRepository.types.ts} +0 -0
|
@@ -0,0 +1,1669 @@
|
|
|
1
|
+
import { A_ExecutionContext } from '@adaas/a-utils/a-execution';
|
|
2
|
+
import { IncomingMessage, ServerResponse, IncomingHttpHeaders, Server } from 'http';
|
|
3
|
+
import { A_OperationContext, A_Operation_Storage } from '@adaas/a-utils/a-operation';
|
|
4
|
+
import * as _adaas_a_concept from '@adaas/a-concept';
|
|
5
|
+
import { A_TYPES__Error_Init, A_TYPES__Error_Serialized, A_TYPES__Entity_Serialized, A_Error, A_Entity, A_Fragment, A_TYPES__Required, A_Component, A_Scope, A_TYPES__Entity_Constructor, A_TYPES__ConceptENVVariables, A_Feature, A_TYPES__ComponentMeta, A_ComponentMeta, A_TYPES__MetaLinkedComponentConstructors } from '@adaas/a-concept';
|
|
6
|
+
import { A_Config } from '@adaas/a-utils/a-config';
|
|
7
|
+
import { A_Route } from '@adaas/a-utils/a-route';
|
|
8
|
+
import { Readable } from 'stream';
|
|
9
|
+
import { A_Logger } from '@adaas/a-utils/a-logger';
|
|
10
|
+
import { A_Service, A_ServiceFeatures } from '@adaas/a-utils/a-service';
|
|
11
|
+
import { A_Polyfill } from '@adaas/a-utils/a-polyfill';
|
|
12
|
+
|
|
13
|
+
declare class A_HttpRequestData extends A_ExecutionContext<{
|
|
14
|
+
data: Buffer;
|
|
15
|
+
}> {
|
|
16
|
+
constructor(data: Buffer);
|
|
17
|
+
get length(): number;
|
|
18
|
+
get data(): Buffer;
|
|
19
|
+
toString(encoding?: BufferEncoding): string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare class A_HttpServerRequestContext<_DataType extends any = any> extends A_OperationContext<'http-server-request', {
|
|
23
|
+
request: IncomingMessage;
|
|
24
|
+
response: ServerResponse;
|
|
25
|
+
}, {
|
|
26
|
+
buffers: Buffer[];
|
|
27
|
+
data: _DataType;
|
|
28
|
+
files: Record<string, any[]>;
|
|
29
|
+
}, {
|
|
30
|
+
buffers: Buffer[];
|
|
31
|
+
data: _DataType;
|
|
32
|
+
files: Record<string, any[]>;
|
|
33
|
+
params: {
|
|
34
|
+
request: IncomingMessage;
|
|
35
|
+
response: ServerResponse;
|
|
36
|
+
};
|
|
37
|
+
} & A_Operation_Storage> {
|
|
38
|
+
protected _id: string;
|
|
39
|
+
protected _startTime: [number, number];
|
|
40
|
+
protected _endTime?: [number, number];
|
|
41
|
+
protected _ready?: Promise<void>;
|
|
42
|
+
protected get _request(): IncomingMessage;
|
|
43
|
+
protected get _response(): ServerResponse;
|
|
44
|
+
protected _customResponse: any;
|
|
45
|
+
constructor(request: IncomingMessage, response: ServerResponse);
|
|
46
|
+
get id(): string;
|
|
47
|
+
get buffers(): Buffer[];
|
|
48
|
+
get contentType(): string | undefined;
|
|
49
|
+
get data(): _DataType;
|
|
50
|
+
set data(value: _DataType);
|
|
51
|
+
get length(): number;
|
|
52
|
+
get processingTime(): number;
|
|
53
|
+
startProcessing(): void;
|
|
54
|
+
stopProcessing(): void;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare const A_RequestFeatures: {
|
|
58
|
+
readonly onError: "A_Request_onError";
|
|
59
|
+
readonly onInit: "A_Request_onInit";
|
|
60
|
+
readonly onAfterInit: "A_Request_onAfterInit";
|
|
61
|
+
readonly onParse: "A_Request_onParse";
|
|
62
|
+
readonly onValidate: "A_Request_onValidate";
|
|
63
|
+
readonly onClose: "A_Request_onClose";
|
|
64
|
+
readonly onAborted: "A_Request_onAborted";
|
|
65
|
+
readonly onTimeout: "A_Request_onTimeout";
|
|
66
|
+
readonly onData: "A_Request_onData";
|
|
67
|
+
readonly onEnd: "A_Request_onEnd";
|
|
68
|
+
readonly onBodyParse: "A_Request_onBodyParse";
|
|
69
|
+
readonly onQueryParse: "A_Request_onQueryParse";
|
|
70
|
+
readonly onParamsParse: "A_Request_onParamsParse";
|
|
71
|
+
readonly onCookiesParse: "A_Request_onCookiesParse";
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
declare const A_HttpServerFeatures: {
|
|
75
|
+
readonly onBeforeRequest: "_A_HTTPServer_onBeforeRequest";
|
|
76
|
+
readonly onRequest: "_A_HTTPServer_onRequest";
|
|
77
|
+
readonly onAfterRequest: "_A_HTTPServer_onAfterRequest";
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
type A_HttpServerRequestMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD' | 'CONNECT' | 'TRACE' | 'DEFAULT';
|
|
81
|
+
type A_HttpServerFeatureNames = typeof A_HttpServerFeatures[keyof typeof A_HttpServerFeatures];
|
|
82
|
+
type A_HttpServerError_Init = {
|
|
83
|
+
/**
|
|
84
|
+
* HTTP Status Code of the error
|
|
85
|
+
*/
|
|
86
|
+
status?: number;
|
|
87
|
+
} & A_TYPES__Error_Init;
|
|
88
|
+
type A_HttpServerError_Serialized = {
|
|
89
|
+
/**
|
|
90
|
+
* HTTP Status Code of the error
|
|
91
|
+
*/
|
|
92
|
+
status: number;
|
|
93
|
+
} & A_TYPES__Error_Serialized;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Constructor parameters for A_Request entity
|
|
97
|
+
*/
|
|
98
|
+
type A_Request_Init = {
|
|
99
|
+
/**
|
|
100
|
+
* Unique identifier for the request (should correspond to Response id)
|
|
101
|
+
*/
|
|
102
|
+
id: string;
|
|
103
|
+
/**
|
|
104
|
+
* ASEID Shard for the request.
|
|
105
|
+
* it's some sort of request fingerprint
|
|
106
|
+
*/
|
|
107
|
+
shard: string;
|
|
108
|
+
/**
|
|
109
|
+
* Node.js IncomingMessage object
|
|
110
|
+
*/
|
|
111
|
+
request: IncomingMessage;
|
|
112
|
+
/**
|
|
113
|
+
* Request scope for context resolution
|
|
114
|
+
*/
|
|
115
|
+
scope: string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Serialized representation of A_Request entity
|
|
119
|
+
*/
|
|
120
|
+
type A_Request_Serialized<_ReqBodyType = any, _ParamsType extends Record<string, string> = any, _QueryType = any> = A_TYPES__Entity_Serialized & {
|
|
121
|
+
method: A_HttpServerRequestMethod;
|
|
122
|
+
url: string;
|
|
123
|
+
headers: Record<string, string | string[] | undefined>;
|
|
124
|
+
params?: _ParamsType;
|
|
125
|
+
query?: _QueryType;
|
|
126
|
+
cookies: Record<string, string>;
|
|
127
|
+
body?: _ReqBodyType;
|
|
128
|
+
userAgent?: string;
|
|
129
|
+
isValid: boolean;
|
|
130
|
+
bodyType?: A_Request_BodyType;
|
|
131
|
+
filesCount?: number;
|
|
132
|
+
fileFieldNames?: string[];
|
|
133
|
+
totalFileSize?: number;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Supported HTTP request methods
|
|
137
|
+
*/
|
|
138
|
+
type A_Request_Methods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD' | 'CONNECT' | 'TRACE' | 'DEFAULT';
|
|
139
|
+
/**
|
|
140
|
+
* Request lifecycle events
|
|
141
|
+
*/
|
|
142
|
+
declare enum A_Request_Event {
|
|
143
|
+
Error = "error",
|
|
144
|
+
Finish = "finish",
|
|
145
|
+
Data = "data",
|
|
146
|
+
End = "end",
|
|
147
|
+
Close = "close"
|
|
148
|
+
}
|
|
149
|
+
type A_RequestFeatureNames = typeof A_RequestFeatures[keyof typeof A_RequestFeatures];
|
|
150
|
+
/**
|
|
151
|
+
* Request event callback function type
|
|
152
|
+
*/
|
|
153
|
+
type A_Request_EventCallback = (request: A_Request) => void;
|
|
154
|
+
/**
|
|
155
|
+
* Supported body content types for parsing
|
|
156
|
+
*/
|
|
157
|
+
type A_Request_BodyType = 'json' | 'form' | 'multipart' | 'raw' | 'text';
|
|
158
|
+
/**
|
|
159
|
+
* Result of body parsing operation
|
|
160
|
+
*/
|
|
161
|
+
type A_Request_ParsedBody = {
|
|
162
|
+
/**
|
|
163
|
+
* Type of parsed content
|
|
164
|
+
*/
|
|
165
|
+
type: A_Request_BodyType;
|
|
166
|
+
/**
|
|
167
|
+
* Parsed data
|
|
168
|
+
*/
|
|
169
|
+
data: any;
|
|
170
|
+
/**
|
|
171
|
+
* Size of the body in bytes
|
|
172
|
+
*/
|
|
173
|
+
size: number;
|
|
174
|
+
/**
|
|
175
|
+
* Character encoding used
|
|
176
|
+
*/
|
|
177
|
+
encoding?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Multipart boundary (for multipart content)
|
|
180
|
+
*/
|
|
181
|
+
boundary?: string;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Session data structure for user session management
|
|
185
|
+
*/
|
|
186
|
+
type A_Request_SessionData = {
|
|
187
|
+
/**
|
|
188
|
+
* Unique session identifier
|
|
189
|
+
*/
|
|
190
|
+
id?: string;
|
|
191
|
+
/**
|
|
192
|
+
* Associated user ID
|
|
193
|
+
*/
|
|
194
|
+
userId?: string;
|
|
195
|
+
/**
|
|
196
|
+
* Session creation timestamp
|
|
197
|
+
*/
|
|
198
|
+
createdAt?: Date;
|
|
199
|
+
/**
|
|
200
|
+
* Last access timestamp
|
|
201
|
+
*/
|
|
202
|
+
lastAccess?: Date;
|
|
203
|
+
/**
|
|
204
|
+
* Session data storage
|
|
205
|
+
*/
|
|
206
|
+
data?: Record<string, any>;
|
|
207
|
+
/**
|
|
208
|
+
* Whether session is expired
|
|
209
|
+
*/
|
|
210
|
+
isExpired?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Maximum session age in milliseconds
|
|
213
|
+
*/
|
|
214
|
+
maxAge?: number;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* File upload information for multipart requests
|
|
218
|
+
*/
|
|
219
|
+
type A_Request_FileUpload = {
|
|
220
|
+
/**
|
|
221
|
+
* Form field name
|
|
222
|
+
*/
|
|
223
|
+
fieldName: string;
|
|
224
|
+
/**
|
|
225
|
+
* Original filename
|
|
226
|
+
*/
|
|
227
|
+
filename: string;
|
|
228
|
+
/**
|
|
229
|
+
* File encoding
|
|
230
|
+
*/
|
|
231
|
+
encoding: string;
|
|
232
|
+
/**
|
|
233
|
+
* MIME type
|
|
234
|
+
*/
|
|
235
|
+
mimetype: string;
|
|
236
|
+
/**
|
|
237
|
+
* File size in bytes
|
|
238
|
+
*/
|
|
239
|
+
size: number;
|
|
240
|
+
/**
|
|
241
|
+
* File buffer data
|
|
242
|
+
*/
|
|
243
|
+
buffer: Buffer;
|
|
244
|
+
/**
|
|
245
|
+
* Path if saved to disk
|
|
246
|
+
*/
|
|
247
|
+
path?: string;
|
|
248
|
+
/**
|
|
249
|
+
* File hash for integrity verification
|
|
250
|
+
*/
|
|
251
|
+
hash?: string;
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Request validation result with detailed feedback
|
|
255
|
+
*/
|
|
256
|
+
type A_Request_ValidationResult = {
|
|
257
|
+
/**
|
|
258
|
+
* Whether validation passed
|
|
259
|
+
*/
|
|
260
|
+
isValid: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Validation error messages
|
|
263
|
+
*/
|
|
264
|
+
errors: string[];
|
|
265
|
+
/**
|
|
266
|
+
* Warning messages
|
|
267
|
+
*/
|
|
268
|
+
warnings: string[];
|
|
269
|
+
/**
|
|
270
|
+
* Sanitized data after validation
|
|
271
|
+
*/
|
|
272
|
+
sanitized?: any;
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Request processing configuration options
|
|
276
|
+
*/
|
|
277
|
+
type A_Request_Options = {
|
|
278
|
+
/**
|
|
279
|
+
* Maximum request body size in bytes (default: 10MB)
|
|
280
|
+
*/
|
|
281
|
+
maxBodySize?: number;
|
|
282
|
+
/**
|
|
283
|
+
* Request timeout in milliseconds (default: 30s)
|
|
284
|
+
*/
|
|
285
|
+
timeout?: number;
|
|
286
|
+
/**
|
|
287
|
+
* Default character encoding (default: 'utf8')
|
|
288
|
+
*/
|
|
289
|
+
encoding?: string;
|
|
290
|
+
/**
|
|
291
|
+
* Automatically parse cookies (default: true)
|
|
292
|
+
*/
|
|
293
|
+
parseCookies?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Automatically parse query parameters (default: true)
|
|
296
|
+
*/
|
|
297
|
+
parseQuery?: boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Automatically parse request body (default: true)
|
|
300
|
+
*/
|
|
301
|
+
parseBody?: boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Enable file upload handling (default: false)
|
|
304
|
+
*/
|
|
305
|
+
enableFileUploads?: boolean;
|
|
306
|
+
/**
|
|
307
|
+
* Enable strict validation mode (default: false)
|
|
308
|
+
*/
|
|
309
|
+
strictValidation?: boolean;
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Request Event Listener Function
|
|
313
|
+
*/
|
|
314
|
+
type A_Request_Listener = (req?: A_Request) => void;
|
|
315
|
+
|
|
316
|
+
declare class A_HttpServerError extends A_Error<A_HttpServerError_Init, A_HttpServerError_Serialized> {
|
|
317
|
+
static readonly NotFoundErrorStatus: number;
|
|
318
|
+
static readonly NotFoundError = "Resource Not Found";
|
|
319
|
+
static readonly InternalServerErrorStatus: number;
|
|
320
|
+
static readonly InternalServerError = "Internal Server Error";
|
|
321
|
+
/**
|
|
322
|
+
* HTTP status code to title mapping
|
|
323
|
+
*/
|
|
324
|
+
private static readonly HTTP_STATUS_TITLES;
|
|
325
|
+
status: number;
|
|
326
|
+
/**
|
|
327
|
+
* Gets the appropriate title for a given HTTP status code
|
|
328
|
+
*/
|
|
329
|
+
private static getHttpStatusTitle;
|
|
330
|
+
constructor(
|
|
331
|
+
/**
|
|
332
|
+
* A_Error Constructor params with required title
|
|
333
|
+
*/
|
|
334
|
+
params: A_HttpServerError_Init);
|
|
335
|
+
constructor(
|
|
336
|
+
/**
|
|
337
|
+
* Simplified params with optional title - will auto-generate from status
|
|
338
|
+
*/
|
|
339
|
+
params: {
|
|
340
|
+
status?: number;
|
|
341
|
+
description?: string;
|
|
342
|
+
code?: string;
|
|
343
|
+
scope?: string;
|
|
344
|
+
link?: string;
|
|
345
|
+
originalError?: Error | unknown;
|
|
346
|
+
});
|
|
347
|
+
constructor(
|
|
348
|
+
/**
|
|
349
|
+
* HTTP Status Code of the error
|
|
350
|
+
*/
|
|
351
|
+
status: number,
|
|
352
|
+
/**
|
|
353
|
+
* Error description
|
|
354
|
+
*/
|
|
355
|
+
description: string);
|
|
356
|
+
constructor(
|
|
357
|
+
/**
|
|
358
|
+
* Original JS Error
|
|
359
|
+
*/
|
|
360
|
+
error: Error);
|
|
361
|
+
protected fromConstructor(params: A_HttpServerError_Init): void;
|
|
362
|
+
toJSON(): A_HttpServerError_Serialized;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
declare const A_RequestEnvVariables: {
|
|
366
|
+
/**
|
|
367
|
+
* Default request timeout in milliseconds
|
|
368
|
+
*/
|
|
369
|
+
readonly A_SERVER_REQUEST_TIMEOUT: 5000;
|
|
370
|
+
/**
|
|
371
|
+
* Maximum request body size in bytes
|
|
372
|
+
*/
|
|
373
|
+
readonly A_SERVER_REQUEST_MAX_BODY_SIZE: number;
|
|
374
|
+
/**
|
|
375
|
+
* Default request encoding
|
|
376
|
+
*/
|
|
377
|
+
readonly A_SERVER_REQUEST_DEFAULT_ENCODING: "utf8";
|
|
378
|
+
/**
|
|
379
|
+
* Enable automatic cookie parsing
|
|
380
|
+
*/
|
|
381
|
+
readonly A_SERVER_REQUEST_PARSE_COOKIES: true;
|
|
382
|
+
/**
|
|
383
|
+
* Enable automatic query parameter parsing
|
|
384
|
+
*/
|
|
385
|
+
readonly A_SERVER_REQUEST_PARSE_QUERY: true;
|
|
386
|
+
/**
|
|
387
|
+
* Enable automatic body parsing
|
|
388
|
+
*/
|
|
389
|
+
readonly A_SERVER_REQUEST_PARSE_BODY: true;
|
|
390
|
+
/**
|
|
391
|
+
* Enable file upload handling
|
|
392
|
+
*/
|
|
393
|
+
readonly A_SERVER_REQUEST_ENABLE_FILE_UPLOADS: false;
|
|
394
|
+
};
|
|
395
|
+
declare const A_RequestEnvVariablesArray: Array<keyof typeof A_RequestEnvVariables>;
|
|
396
|
+
/**
|
|
397
|
+
* Array of all possible fields in A_RequestEnvVariables
|
|
398
|
+
*/
|
|
399
|
+
type A_RequestEnvVariablesType = Array<keyof typeof A_RequestEnvVariables>;
|
|
400
|
+
|
|
401
|
+
declare const A_ServerRouteHttpMethods: {
|
|
402
|
+
readonly DEFAULT: "DEFAULT";
|
|
403
|
+
readonly GET: "GET";
|
|
404
|
+
readonly POST: "POST";
|
|
405
|
+
readonly PUT: "PUT";
|
|
406
|
+
readonly DELETE: "DELETE";
|
|
407
|
+
readonly PATCH: "PATCH";
|
|
408
|
+
readonly OPTIONS: "OPTIONS";
|
|
409
|
+
readonly HEAD: "HEAD";
|
|
410
|
+
readonly CONNECT: "CONNECT";
|
|
411
|
+
readonly TRACE: "TRACE";
|
|
412
|
+
};
|
|
413
|
+
declare const A_ServerRouteProtocols: {
|
|
414
|
+
readonly HTTP: "http";
|
|
415
|
+
readonly HTTPS: "https";
|
|
416
|
+
readonly WS: "ws";
|
|
417
|
+
readonly WSS: "wss";
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
type A_serverRouteProtocolNames = typeof A_ServerRouteProtocols[keyof typeof A_ServerRouteProtocols];
|
|
421
|
+
type A_ServerRouteHttpMethodNames = typeof A_ServerRouteHttpMethods[keyof typeof A_ServerRouteHttpMethods];
|
|
422
|
+
|
|
423
|
+
declare class A_ServerRoute extends A_Route {
|
|
424
|
+
url: string;
|
|
425
|
+
method: A_ServerRouteHttpMethodNames;
|
|
426
|
+
constructor(url: string | RegExp, method: A_ServerRouteHttpMethodNames);
|
|
427
|
+
constructor(url: string | RegExp);
|
|
428
|
+
toString(): string;
|
|
429
|
+
toRegExp(): RegExp;
|
|
430
|
+
toAFeatureExtension(extensionScope?: Array<string>): RegExp;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
declare class A_Request<_ReqBodyType = any, _ParamsType extends Record<string, string> = any, _QueryType = any> extends A_Entity<A_Request_Init, A_Request_Serialized<_ReqBodyType, _ParamsType, _QueryType>> {
|
|
434
|
+
static get concept(): string;
|
|
435
|
+
/**
|
|
436
|
+
* Request processing status
|
|
437
|
+
*/
|
|
438
|
+
protected _listeners: Map<A_RequestFeatureNames, Set<A_Request_Listener>>;
|
|
439
|
+
/**
|
|
440
|
+
* Parsed cookies from request headers
|
|
441
|
+
*/
|
|
442
|
+
private _cookies;
|
|
443
|
+
/**
|
|
444
|
+
* Request body type
|
|
445
|
+
*/
|
|
446
|
+
private _bodyType?;
|
|
447
|
+
/**
|
|
448
|
+
* Request body data
|
|
449
|
+
*/
|
|
450
|
+
private _body;
|
|
451
|
+
private _req;
|
|
452
|
+
private _timeout;
|
|
453
|
+
/**
|
|
454
|
+
* Uploaded files from multipart requests
|
|
455
|
+
*/
|
|
456
|
+
private _files;
|
|
457
|
+
/**
|
|
458
|
+
* User agent string from request headers
|
|
459
|
+
*/
|
|
460
|
+
private _userAgent?;
|
|
461
|
+
/**
|
|
462
|
+
* Content length in bytes
|
|
463
|
+
*/
|
|
464
|
+
private _contentLength?;
|
|
465
|
+
/**
|
|
466
|
+
* Request processing configuration options
|
|
467
|
+
*/
|
|
468
|
+
private _options;
|
|
469
|
+
private _routeDefinition?;
|
|
470
|
+
/**
|
|
471
|
+
* A_Request - Comprehensive HTTP Request Processing Entity
|
|
472
|
+
*
|
|
473
|
+
* This class provides a complete wrapper around Node.js IncomingMessage with advanced features:
|
|
474
|
+
* - Automatic body parsing (JSON, form-data, multipart, raw)
|
|
475
|
+
* - Cookie and session management
|
|
476
|
+
* - File upload handling with easy access methods
|
|
477
|
+
* - Request validation
|
|
478
|
+
* - Middleware support
|
|
479
|
+
* - Type-safe parameter extraction
|
|
480
|
+
* - Request timing and metrics
|
|
481
|
+
*
|
|
482
|
+
* @example
|
|
483
|
+
* ```typescript
|
|
484
|
+
* const request = new A_Request({
|
|
485
|
+
* id: 'req-123',
|
|
486
|
+
* request: incomingMessage,
|
|
487
|
+
* scope: 'api'
|
|
488
|
+
* }, {
|
|
489
|
+
* enableFileUploads: true,
|
|
490
|
+
* maxBodySize: 50 * 1024 * 1024 // 50MB for file uploads
|
|
491
|
+
* });
|
|
492
|
+
*
|
|
493
|
+
* await request.init();
|
|
494
|
+
*
|
|
495
|
+
* // Access parsed body
|
|
496
|
+
* const userData = request.body;
|
|
497
|
+
*
|
|
498
|
+
* // Get typed parameters
|
|
499
|
+
* const userId = request.params.id;
|
|
500
|
+
*
|
|
501
|
+
* // Handle file uploads
|
|
502
|
+
* if (request.hasFiles()) {
|
|
503
|
+
* const avatar = request.getFile('avatar');
|
|
504
|
+
* if (avatar) {
|
|
505
|
+
* console.log(`Uploaded file: ${avatar.filename}`);
|
|
506
|
+
* console.log(`File size: ${avatar.size} bytes`);
|
|
507
|
+
* console.log(`File type: ${avatar.mimetype}`);
|
|
508
|
+
*
|
|
509
|
+
* // Access file buffer for processing
|
|
510
|
+
* const fileBuffer = avatar.buffer;
|
|
511
|
+
* // Save to disk, process, etc.
|
|
512
|
+
* }
|
|
513
|
+
*
|
|
514
|
+
* // Get all files for a specific field
|
|
515
|
+
* const documents = request.getFiles('documents');
|
|
516
|
+
* for (const doc of documents) {
|
|
517
|
+
* // Process each document...
|
|
518
|
+
* }
|
|
519
|
+
* }
|
|
520
|
+
*
|
|
521
|
+
* // Check specific files
|
|
522
|
+
* if (request.hasFile('profilePicture')) {
|
|
523
|
+
* const pic = request.getFile('profilePicture');
|
|
524
|
+
* // Process profile picture...
|
|
525
|
+
* }
|
|
526
|
+
* ```
|
|
527
|
+
*/
|
|
528
|
+
constructor(params: A_Request_Init, options?: A_Request_Options);
|
|
529
|
+
/**
|
|
530
|
+
* Creates A_Request entity from initialization data
|
|
531
|
+
*
|
|
532
|
+
* @param newEntity
|
|
533
|
+
*/
|
|
534
|
+
fromNew(newEntity: A_Request_Init): void;
|
|
535
|
+
/**
|
|
536
|
+
* Core HTTP request object from Node.js
|
|
537
|
+
*/
|
|
538
|
+
get original(): IncomingMessage;
|
|
539
|
+
/**
|
|
540
|
+
* Parsed request body data
|
|
541
|
+
*/
|
|
542
|
+
get body(): _ReqBodyType;
|
|
543
|
+
/**
|
|
544
|
+
* URL route parameters (e.g., /users/:id)
|
|
545
|
+
*/
|
|
546
|
+
get params(): _ParamsType;
|
|
547
|
+
/**
|
|
548
|
+
* Query string parameters
|
|
549
|
+
*/
|
|
550
|
+
get query(): _QueryType;
|
|
551
|
+
/**
|
|
552
|
+
* Gets the parsed cookies
|
|
553
|
+
*/
|
|
554
|
+
get cookies(): Record<string, string>;
|
|
555
|
+
/**
|
|
556
|
+
* Gets the request URL
|
|
557
|
+
*/
|
|
558
|
+
get url(): string;
|
|
559
|
+
/**
|
|
560
|
+
* Gets the HTTP method
|
|
561
|
+
*/
|
|
562
|
+
get method(): A_HttpServerRequestMethod;
|
|
563
|
+
/**
|
|
564
|
+
* Gets the request headers
|
|
565
|
+
*/
|
|
566
|
+
get headers(): IncomingHttpHeaders;
|
|
567
|
+
/**
|
|
568
|
+
* Gets the timestamp when the request was started
|
|
569
|
+
*/
|
|
570
|
+
get startedAt(): Date | undefined;
|
|
571
|
+
/**
|
|
572
|
+
* Gets uploaded files
|
|
573
|
+
*/
|
|
574
|
+
get files(): A_Request_FileUpload[];
|
|
575
|
+
/**
|
|
576
|
+
* Gets user agent string
|
|
577
|
+
*/
|
|
578
|
+
get userAgent(): string | undefined;
|
|
579
|
+
/**
|
|
580
|
+
* Gets content length
|
|
581
|
+
*/
|
|
582
|
+
get contentLength(): number;
|
|
583
|
+
/**
|
|
584
|
+
* Check if request is secure (HTTPS)
|
|
585
|
+
*/
|
|
586
|
+
get isSecure(): boolean;
|
|
587
|
+
/**
|
|
588
|
+
* Check if request is from mobile device
|
|
589
|
+
*/
|
|
590
|
+
get isMobile(): boolean;
|
|
591
|
+
/**
|
|
592
|
+
* Get request size in bytes
|
|
593
|
+
*/
|
|
594
|
+
get size(): number;
|
|
595
|
+
/**
|
|
596
|
+
* Gets content type from headers
|
|
597
|
+
*/
|
|
598
|
+
get contentType(): string | undefined;
|
|
599
|
+
/**
|
|
600
|
+
* Pipes request stream to destination
|
|
601
|
+
*/
|
|
602
|
+
pipe(destination: NodeJS.WritableStream, options?: {
|
|
603
|
+
end?: boolean | undefined;
|
|
604
|
+
}): NodeJS.WritableStream;
|
|
605
|
+
/**
|
|
606
|
+
* Get a file by field name
|
|
607
|
+
*/
|
|
608
|
+
getFile(fieldName: string): A_Request_FileUpload | undefined;
|
|
609
|
+
/**
|
|
610
|
+
* Get all files for a specific field name
|
|
611
|
+
*/
|
|
612
|
+
getFiles(fieldName: string): A_Request_FileUpload[];
|
|
613
|
+
/**
|
|
614
|
+
* Check if request has any files
|
|
615
|
+
*/
|
|
616
|
+
hasFiles(): boolean;
|
|
617
|
+
/**
|
|
618
|
+
* Check if request has a file with specific field name
|
|
619
|
+
*/
|
|
620
|
+
hasFile(fieldName: string): boolean;
|
|
621
|
+
/**
|
|
622
|
+
* Get total size of all uploaded files
|
|
623
|
+
*/
|
|
624
|
+
getTotalFileSize(): number;
|
|
625
|
+
/**
|
|
626
|
+
* Get a cookie value
|
|
627
|
+
*/
|
|
628
|
+
getCookie(name: string): string | undefined;
|
|
629
|
+
/**
|
|
630
|
+
* Check if request has a specific cookie
|
|
631
|
+
*/
|
|
632
|
+
hasCookie(name: string): boolean;
|
|
633
|
+
/**
|
|
634
|
+
* Check if request accepts specific content type
|
|
635
|
+
*/
|
|
636
|
+
accepts(contentType: string): boolean;
|
|
637
|
+
/**
|
|
638
|
+
* Get request fingerprint for caching/identification
|
|
639
|
+
*/
|
|
640
|
+
getFingerprint(): string;
|
|
641
|
+
/**
|
|
642
|
+
* Registers an event listener for a specific event
|
|
643
|
+
*
|
|
644
|
+
* @param event
|
|
645
|
+
* @param listener
|
|
646
|
+
*/
|
|
647
|
+
on(event: A_RequestFeatureNames, listener: A_Request_Listener): void;
|
|
648
|
+
/**
|
|
649
|
+
* Removes an event listener for a specific event
|
|
650
|
+
*
|
|
651
|
+
* @param event
|
|
652
|
+
* @param listener
|
|
653
|
+
*/
|
|
654
|
+
off(event: A_RequestFeatureNames, listener: A_Request_Listener): void;
|
|
655
|
+
/**
|
|
656
|
+
* Emits an event to all registered listeners
|
|
657
|
+
*
|
|
658
|
+
* @param event
|
|
659
|
+
*/
|
|
660
|
+
emit(event: A_RequestFeatureNames): void;
|
|
661
|
+
/**
|
|
662
|
+
* Allows to use a route definition for this request
|
|
663
|
+
*
|
|
664
|
+
* @param route
|
|
665
|
+
*/
|
|
666
|
+
useRoute(route: A_ServerRoute): void;
|
|
667
|
+
clearTimeout(): void;
|
|
668
|
+
/**
|
|
669
|
+
* Initialize the request - parse cookies, query, body etc.
|
|
670
|
+
*/
|
|
671
|
+
load(): Promise<void>;
|
|
672
|
+
validate(): Promise<void>;
|
|
673
|
+
/**
|
|
674
|
+
* Destroy the request A-Entity with cleanup
|
|
675
|
+
*
|
|
676
|
+
* @returns
|
|
677
|
+
*/
|
|
678
|
+
destroy(): Promise<any>;
|
|
679
|
+
/**
|
|
680
|
+
* Handles request failure - registers error, emits event, and destroys request
|
|
681
|
+
*
|
|
682
|
+
* [!] Destroys the request after handling the failure.
|
|
683
|
+
*
|
|
684
|
+
* @param err
|
|
685
|
+
*/
|
|
686
|
+
fail(err?: A_HttpServerError): Promise<void>;
|
|
687
|
+
/**
|
|
688
|
+
* Internal helper method to handle incoming data chunks
|
|
689
|
+
* It creates a new scope for each data chunk, inherits the parent scope,
|
|
690
|
+
* and calls the onData feature with the new scope.
|
|
691
|
+
*
|
|
692
|
+
* [!] This method ensures that each data chunk is processed in isolation,
|
|
693
|
+
* preventing side effects between chunks.
|
|
694
|
+
*
|
|
695
|
+
* @param data
|
|
696
|
+
*/
|
|
697
|
+
protected handleData(data: Buffer): Promise<void>;
|
|
698
|
+
/**
|
|
699
|
+
* Handles request close event
|
|
700
|
+
*
|
|
701
|
+
* This method is called when the request is closed prematurely.
|
|
702
|
+
* It triggers the onClose feature and handles any errors that occur during processing.
|
|
703
|
+
*
|
|
704
|
+
*/
|
|
705
|
+
protected handleClose(): Promise<void>;
|
|
706
|
+
/**
|
|
707
|
+
* Handles request end event
|
|
708
|
+
*
|
|
709
|
+
* This method is called when the request has finished sending data.
|
|
710
|
+
* It triggers the onEnd feature and handles any errors that occur during processing.
|
|
711
|
+
*/
|
|
712
|
+
protected handleEnd(): Promise<void>;
|
|
713
|
+
/**
|
|
714
|
+
* Handles request timeout event
|
|
715
|
+
*
|
|
716
|
+
* This method is called when the request processing exceeds the configured timeout.
|
|
717
|
+
* It triggers the onTimeout feature and fails the request with a timeout error.
|
|
718
|
+
*/
|
|
719
|
+
protected handleTimeout(): Promise<void>;
|
|
720
|
+
[A_RequestFeatures.onInit](config: A_Config<['A_SERVER_REQUEST_TIMEOUT']>, context: A_HttpServerRequestContext, ...args: any[]): Promise<void>;
|
|
721
|
+
[A_RequestFeatures.onData](context: A_HttpServerRequestContext, chunk: A_HttpRequestData, ...args: any[]): Promise<void>;
|
|
722
|
+
[A_RequestFeatures.onTimeout](context: A_HttpServerRequestContext, ...args: any[]): Promise<void>;
|
|
723
|
+
[A_RequestFeatures.onClose](context: A_HttpServerRequestContext, ...args: any[]): Promise<void>;
|
|
724
|
+
[A_RequestFeatures.onError](error: A_Error, context: A_HttpServerRequestContext, ...args: any[]): Promise<void>;
|
|
725
|
+
[A_RequestFeatures.onEnd](config: A_Config<A_RequestEnvVariablesType>, context: A_HttpServerRequestContext, ...args: any[]): Promise<void>;
|
|
726
|
+
[A_RequestFeatures.onValidate](context: A_HttpServerRequestContext, ...args: any[]): Promise<void>;
|
|
727
|
+
/**
|
|
728
|
+
* Serialize request for logging/debugging
|
|
729
|
+
*/
|
|
730
|
+
toJSON(): A_Request_Serialized;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
declare class A_RequestError extends A_Error {
|
|
734
|
+
static readonly RequestBodyParsingError = "Unable to parse request body";
|
|
735
|
+
static readonly FileUploadError = "File upload error";
|
|
736
|
+
static readonly RequestTimeoutError = "Request timed out";
|
|
737
|
+
static readonly InvalidRequestError = "Invalid request";
|
|
738
|
+
static readonly MissingParametersError = "Missing required parameters";
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* A_RequestHelper - Stateless utility class for HTTP request processing
|
|
743
|
+
*
|
|
744
|
+
* This helper class provides static methods for parsing and processing HTTP request data:
|
|
745
|
+
* - URL parameter extraction from route patterns
|
|
746
|
+
* - Query string parsing
|
|
747
|
+
* - Request body parsing (JSON, form-data, multipart, raw)
|
|
748
|
+
* - URL-encoded form data parsing
|
|
749
|
+
* - Multipart form data parsing (including file uploads)
|
|
750
|
+
*
|
|
751
|
+
* All methods are stateless and only depend on input parameters.
|
|
752
|
+
*
|
|
753
|
+
* @example
|
|
754
|
+
* ```typescript
|
|
755
|
+
* // Extract URL parameters
|
|
756
|
+
* const params = A_RequestHelper.extractParams('/users/123', '/users/:id');
|
|
757
|
+
* // { id: '123' }
|
|
758
|
+
*
|
|
759
|
+
* // Parse query string
|
|
760
|
+
* const query = A_RequestHelper.extractQuery('/api/users?page=1&limit=10');
|
|
761
|
+
* // { page: '1', limit: '10' }
|
|
762
|
+
*
|
|
763
|
+
* // Parse request body
|
|
764
|
+
* const result = await A_RequestHelper.parseRequestBody(req, { maxBodySize: 1024 * 1024 });
|
|
765
|
+
* // { data: {...}, type: 'json' }
|
|
766
|
+
* ```
|
|
767
|
+
*/
|
|
768
|
+
declare class A_RequestHelper {
|
|
769
|
+
/**
|
|
770
|
+
* Extract URL parameters from a URL using a route pattern
|
|
771
|
+
* @param url - The actual URL to extract parameters from
|
|
772
|
+
* @param routePattern - The route pattern with parameters (e.g., "/users/:id/posts/:postId")
|
|
773
|
+
* @returns Object containing extracted parameters
|
|
774
|
+
*/
|
|
775
|
+
static extractParams(url: string, routePattern: string): Record<string, string>;
|
|
776
|
+
/**
|
|
777
|
+
* Extract query parameters from URL
|
|
778
|
+
* @param url - The URL to extract query parameters from
|
|
779
|
+
* @returns Object containing query parameters
|
|
780
|
+
*/
|
|
781
|
+
static extractQuery<T = Record<string, string>>(url: string): T;
|
|
782
|
+
/**
|
|
783
|
+
* Parse cookies from Cookie header
|
|
784
|
+
*/
|
|
785
|
+
static parseCookies(cookieHeader?: string): Record<string, string>;
|
|
786
|
+
/**
|
|
787
|
+
* Parse request body based on Content-Type
|
|
788
|
+
*
|
|
789
|
+
*
|
|
790
|
+
* @param context - The HTTP server request context
|
|
791
|
+
* @returns Parsed body data and detected body type
|
|
792
|
+
*/
|
|
793
|
+
static parseRequestBody<T extends any = any>(context: A_HttpServerRequestContext): {
|
|
794
|
+
data: T;
|
|
795
|
+
type: A_Request_BodyType;
|
|
796
|
+
};
|
|
797
|
+
/**
|
|
798
|
+
* Parse URL-encoded form data (application/x-www-form-urlencoded)
|
|
799
|
+
* @param body - The URL-encoded body string
|
|
800
|
+
* @returns Object containing form data
|
|
801
|
+
*/
|
|
802
|
+
static parseFormUrlEncoded(
|
|
803
|
+
/**
|
|
804
|
+
* The URL-encoded body string
|
|
805
|
+
*/
|
|
806
|
+
body: string): Record<string, string | string[]>;
|
|
807
|
+
/**
|
|
808
|
+
* Parse multipart form data (for file uploads and form data)
|
|
809
|
+
* @param buffer - The raw buffer containing multipart data
|
|
810
|
+
* @param contentType - The content type header
|
|
811
|
+
* @returns Object containing fields and files
|
|
812
|
+
*/
|
|
813
|
+
static parseMultipartData(
|
|
814
|
+
/**
|
|
815
|
+
* The raw buffer containing multipart data
|
|
816
|
+
*/
|
|
817
|
+
buffer: Buffer,
|
|
818
|
+
/**
|
|
819
|
+
* The content type header
|
|
820
|
+
*/
|
|
821
|
+
contentType: string): {
|
|
822
|
+
fields: Record<string, string>;
|
|
823
|
+
files: A_Request_FileUpload[];
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
declare const A_ResponseFeatures: {
|
|
828
|
+
/**
|
|
829
|
+
* Event fired when an error occurs while sending the response
|
|
830
|
+
*/
|
|
831
|
+
readonly onError: "_A_Response_onError";
|
|
832
|
+
/**
|
|
833
|
+
* Event fired when the response is closed
|
|
834
|
+
*/
|
|
835
|
+
readonly onClose: "_A_Response_onClose";
|
|
836
|
+
/**
|
|
837
|
+
* Event fired when the response is finished
|
|
838
|
+
*/
|
|
839
|
+
readonly onFinish: "_A_Response_onFinish";
|
|
840
|
+
/**
|
|
841
|
+
* Event fired when the response is sent
|
|
842
|
+
*/
|
|
843
|
+
readonly onSend: "_A_Response_onSend";
|
|
844
|
+
/**
|
|
845
|
+
* Event fired when the response is redirected
|
|
846
|
+
*/
|
|
847
|
+
readonly onRedirect: "_A_Response_onRedirect";
|
|
848
|
+
};
|
|
849
|
+
|
|
850
|
+
type A_Response_Constructor = {
|
|
851
|
+
/**
|
|
852
|
+
* Should correspond to Request id
|
|
853
|
+
*/
|
|
854
|
+
id: string;
|
|
855
|
+
scope: string;
|
|
856
|
+
shard: string;
|
|
857
|
+
response: ServerResponse;
|
|
858
|
+
};
|
|
859
|
+
type A_Response_Serialized<T extends any> = {
|
|
860
|
+
status: number;
|
|
861
|
+
headersSent: boolean;
|
|
862
|
+
size: number;
|
|
863
|
+
data: T;
|
|
864
|
+
redirectURL?: string;
|
|
865
|
+
} & A_TYPES__Entity_Serialized;
|
|
866
|
+
type A_Response_SendResponseObject<_ResponseType = any> = Record<string, _ResponseType>;
|
|
867
|
+
/**
|
|
868
|
+
* Cookie configuration for setting response cookies
|
|
869
|
+
*/
|
|
870
|
+
type A_Response_CookieOptions = {
|
|
871
|
+
domain?: string;
|
|
872
|
+
path?: string;
|
|
873
|
+
secure?: boolean;
|
|
874
|
+
httpOnly?: boolean;
|
|
875
|
+
maxAge?: number;
|
|
876
|
+
expires?: Date;
|
|
877
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
878
|
+
signed?: boolean;
|
|
879
|
+
};
|
|
880
|
+
type A_ResponseFeatureNames = typeof A_ResponseFeatures[keyof typeof A_ResponseFeatures];
|
|
881
|
+
/**
|
|
882
|
+
* Response streaming options
|
|
883
|
+
*/
|
|
884
|
+
type A_Response_StreamOptions = {
|
|
885
|
+
chunkSize?: number;
|
|
886
|
+
delay?: number;
|
|
887
|
+
encoding?: BufferEncoding;
|
|
888
|
+
transform?: (chunk: any) => any;
|
|
889
|
+
onProgress?: (bytesWritten: number, totalBytes: number) => void;
|
|
890
|
+
onComplete?: () => void;
|
|
891
|
+
onError?: (error: Error) => void;
|
|
892
|
+
};
|
|
893
|
+
/**
|
|
894
|
+
* Response compression options
|
|
895
|
+
*/
|
|
896
|
+
type A_Response_CompressionOptions = {
|
|
897
|
+
threshold?: number;
|
|
898
|
+
level?: number;
|
|
899
|
+
strategy?: number;
|
|
900
|
+
chunkSize?: number;
|
|
901
|
+
windowBits?: number;
|
|
902
|
+
memLevel?: number;
|
|
903
|
+
};
|
|
904
|
+
/**
|
|
905
|
+
* File download options
|
|
906
|
+
*/
|
|
907
|
+
type A_Response_DownloadOptions = {
|
|
908
|
+
filename?: string;
|
|
909
|
+
contentType?: string;
|
|
910
|
+
disposition?: 'attachment' | 'inline';
|
|
911
|
+
maxAge?: number;
|
|
912
|
+
etag?: boolean;
|
|
913
|
+
lastModified?: boolean;
|
|
914
|
+
cacheControl?: string;
|
|
915
|
+
};
|
|
916
|
+
/**
|
|
917
|
+
* Response caching options
|
|
918
|
+
*/
|
|
919
|
+
type A_Response_CacheOptions = {
|
|
920
|
+
maxAge?: number;
|
|
921
|
+
sMaxAge?: number;
|
|
922
|
+
noCache?: boolean;
|
|
923
|
+
noStore?: boolean;
|
|
924
|
+
mustRevalidate?: boolean;
|
|
925
|
+
proxyRevalidate?: boolean;
|
|
926
|
+
immutable?: boolean;
|
|
927
|
+
private?: boolean;
|
|
928
|
+
public?: boolean;
|
|
929
|
+
etag?: string;
|
|
930
|
+
lastModified?: Date;
|
|
931
|
+
};
|
|
932
|
+
/**
|
|
933
|
+
* Response configuration options
|
|
934
|
+
*/
|
|
935
|
+
type A_Response_Options = {
|
|
936
|
+
autoCompress?: boolean;
|
|
937
|
+
compressionThreshold?: number;
|
|
938
|
+
enableCaching?: boolean;
|
|
939
|
+
defaultCacheMaxAge?: number;
|
|
940
|
+
enableMetrics?: boolean;
|
|
941
|
+
enableEtag?: boolean;
|
|
942
|
+
enableLastModified?: boolean;
|
|
943
|
+
charset?: string;
|
|
944
|
+
defaultContentType?: string;
|
|
945
|
+
maxRedirects?: number;
|
|
946
|
+
enableCookies?: boolean;
|
|
947
|
+
enableSessions?: boolean;
|
|
948
|
+
};
|
|
949
|
+
/**
|
|
950
|
+
* Response Event Listener Function
|
|
951
|
+
*/
|
|
952
|
+
type A_Response_Listener = (res?: A_Response) => void;
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* A_Response - Comprehensive HTTP Response Processing Entity
|
|
956
|
+
*
|
|
957
|
+
* This class provides a complete wrapper around Node.js ServerResponse with advanced features:
|
|
958
|
+
* - Response data accumulation and value management
|
|
959
|
+
* - Error collection and standardized error responses
|
|
960
|
+
* - Response streaming with progress tracking
|
|
961
|
+
* - Template rendering and view engine support
|
|
962
|
+
* - Cookie management and secure cookie handling
|
|
963
|
+
* - Response compression (gzip, deflate, brotli)
|
|
964
|
+
* - File downloads and static file serving
|
|
965
|
+
* - Response caching and ETags
|
|
966
|
+
* - Performance metrics and timing
|
|
967
|
+
* - Response validation and content negotiation
|
|
968
|
+
*
|
|
969
|
+
* @example
|
|
970
|
+
*/
|
|
971
|
+
declare class A_Response<_ResponseType = any> extends A_Entity<A_Response_Constructor, A_Response_Serialized<_ResponseType>> {
|
|
972
|
+
static get namespace(): string;
|
|
973
|
+
/**
|
|
974
|
+
* Original ServerResponse object
|
|
975
|
+
*/
|
|
976
|
+
private _res;
|
|
977
|
+
/**
|
|
978
|
+
* Internal object to store all response data
|
|
979
|
+
*/
|
|
980
|
+
private _data;
|
|
981
|
+
/**
|
|
982
|
+
* uses in case the response isn't an object
|
|
983
|
+
*/
|
|
984
|
+
private _dataOverride?;
|
|
985
|
+
/**
|
|
986
|
+
* Redirect URL for handling redirects
|
|
987
|
+
*/
|
|
988
|
+
private _redirectURL?;
|
|
989
|
+
/**
|
|
990
|
+
* Cookies map for managing response cookies
|
|
991
|
+
*/
|
|
992
|
+
private _cookies;
|
|
993
|
+
/**
|
|
994
|
+
* Indicates if the response has finished
|
|
995
|
+
*/
|
|
996
|
+
private _cacheOptions?;
|
|
997
|
+
/**
|
|
998
|
+
* Indicates if the response has finished
|
|
999
|
+
*/
|
|
1000
|
+
private _options;
|
|
1001
|
+
/**
|
|
1002
|
+
* Event listeners map for A_Response events
|
|
1003
|
+
*/
|
|
1004
|
+
private _listeners;
|
|
1005
|
+
constructor(params: A_Response_Constructor, options?: A_Response_Options);
|
|
1006
|
+
/**
|
|
1007
|
+
* Initialize from new entity parameters
|
|
1008
|
+
*/
|
|
1009
|
+
fromNew(newEntity: A_Response_Constructor): void;
|
|
1010
|
+
/**
|
|
1011
|
+
* Gets the response data map
|
|
1012
|
+
*/
|
|
1013
|
+
get data(): Map<string, _ResponseType>;
|
|
1014
|
+
/**
|
|
1015
|
+
* Gets the original ServerResponse object
|
|
1016
|
+
*/
|
|
1017
|
+
get original(): ServerResponse;
|
|
1018
|
+
/**
|
|
1019
|
+
* Gets whether headers have been sent
|
|
1020
|
+
*/
|
|
1021
|
+
get headersSent(): boolean;
|
|
1022
|
+
/**
|
|
1023
|
+
* Gets the current status code
|
|
1024
|
+
*/
|
|
1025
|
+
get statusCode(): number;
|
|
1026
|
+
/**
|
|
1027
|
+
* Gets response size in bytes
|
|
1028
|
+
*/
|
|
1029
|
+
get size(): number;
|
|
1030
|
+
/**
|
|
1031
|
+
* Initialize the response
|
|
1032
|
+
*/
|
|
1033
|
+
load(): Promise<void>;
|
|
1034
|
+
/**
|
|
1035
|
+
* Destroy the response
|
|
1036
|
+
*/
|
|
1037
|
+
destroy(): Promise<any>;
|
|
1038
|
+
/**
|
|
1039
|
+
* Handle response failure with error details
|
|
1040
|
+
*/
|
|
1041
|
+
fail(err?: A_HttpServerError): Promise<void>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Send a plain text or JSON response
|
|
1044
|
+
*/
|
|
1045
|
+
send(data?: any): Promise<void>;
|
|
1046
|
+
/**
|
|
1047
|
+
* Stream response data
|
|
1048
|
+
*/
|
|
1049
|
+
stream(dataStream: Readable | any[]): Promise<void>;
|
|
1050
|
+
/**
|
|
1051
|
+
* Redirect response
|
|
1052
|
+
*
|
|
1053
|
+
* [!] Note: This method ends the response immediately.
|
|
1054
|
+
*/
|
|
1055
|
+
redirect(url: string): Promise<void>;
|
|
1056
|
+
/**
|
|
1057
|
+
* Write head with status and headers
|
|
1058
|
+
*/
|
|
1059
|
+
writeHead(statusCode: number, headers?: Record<string, string> | IncomingHttpHeaders | any): this;
|
|
1060
|
+
/**
|
|
1061
|
+
* Set HTTP status code
|
|
1062
|
+
*/
|
|
1063
|
+
status(code: number): this;
|
|
1064
|
+
/**
|
|
1065
|
+
* Set response header
|
|
1066
|
+
*/
|
|
1067
|
+
setHeader(key: string, value: string | number | string[]): this;
|
|
1068
|
+
/**
|
|
1069
|
+
* Get response header
|
|
1070
|
+
*/
|
|
1071
|
+
getHeader(key: string): string | number | string[] | undefined;
|
|
1072
|
+
/**
|
|
1073
|
+
* Remove response header
|
|
1074
|
+
*/
|
|
1075
|
+
removeHeader(key: string): this;
|
|
1076
|
+
/**
|
|
1077
|
+
* Set cookie
|
|
1078
|
+
*/
|
|
1079
|
+
setCookie(name: string, value: string, options?: A_Response_CookieOptions): this;
|
|
1080
|
+
/**
|
|
1081
|
+
* Clear cookie
|
|
1082
|
+
*/
|
|
1083
|
+
clearCookie(name: string, options?: A_Response_CookieOptions): this;
|
|
1084
|
+
/**
|
|
1085
|
+
* Add data to response
|
|
1086
|
+
*/
|
|
1087
|
+
add(key: string, data: _ResponseType): this;
|
|
1088
|
+
/**
|
|
1089
|
+
* Remove data from response
|
|
1090
|
+
*/
|
|
1091
|
+
remove(key: string): this;
|
|
1092
|
+
/**
|
|
1093
|
+
* Get data from response
|
|
1094
|
+
*/
|
|
1095
|
+
get(key: string): _ResponseType | undefined;
|
|
1096
|
+
/**
|
|
1097
|
+
* Check if response has data
|
|
1098
|
+
*/
|
|
1099
|
+
has(key: string): boolean;
|
|
1100
|
+
/**
|
|
1101
|
+
* Clear all response data
|
|
1102
|
+
*/
|
|
1103
|
+
clear(): this;
|
|
1104
|
+
/**
|
|
1105
|
+
* Handle response finish event
|
|
1106
|
+
*
|
|
1107
|
+
* @returns
|
|
1108
|
+
*/
|
|
1109
|
+
protected handleFinish(): Promise<void>;
|
|
1110
|
+
/**
|
|
1111
|
+
* Handle response close event
|
|
1112
|
+
*/
|
|
1113
|
+
protected handleClose(): Promise<void>;
|
|
1114
|
+
/**
|
|
1115
|
+
* Registers an event listener for a specific event
|
|
1116
|
+
*
|
|
1117
|
+
* @param event
|
|
1118
|
+
* @param listener
|
|
1119
|
+
*/
|
|
1120
|
+
on(event: A_ResponseFeatureNames, listener: A_Response_Listener): void;
|
|
1121
|
+
/**
|
|
1122
|
+
* Removes an event listener for a specific event
|
|
1123
|
+
*
|
|
1124
|
+
* @param event
|
|
1125
|
+
* @param listener
|
|
1126
|
+
*/
|
|
1127
|
+
off(event: A_ResponseFeatureNames, listener: A_Response_Listener): void;
|
|
1128
|
+
/**
|
|
1129
|
+
* Emits an event to all registered listeners
|
|
1130
|
+
*
|
|
1131
|
+
* @param event
|
|
1132
|
+
*/
|
|
1133
|
+
emit(event: A_ResponseFeatureNames): void;
|
|
1134
|
+
[A_ResponseFeatures.onSend](context: A_HttpServerRequestContext, ...args: any[]): Promise<void>;
|
|
1135
|
+
[A_ResponseFeatures.onRedirect](context: A_HttpServerRequestContext, ...args: any[]): Promise<void>;
|
|
1136
|
+
[A_ResponseFeatures.onError](error: A_HttpServerError, context: A_HttpServerRequestContext, request: A_Request, ...args: any[]): Promise<void>;
|
|
1137
|
+
/**
|
|
1138
|
+
* Set standard response headers
|
|
1139
|
+
*/
|
|
1140
|
+
protected setDefaultResponseHeaders(): void;
|
|
1141
|
+
/**
|
|
1142
|
+
* Set cookie headers
|
|
1143
|
+
*/
|
|
1144
|
+
protected setCookieHeaders(): void;
|
|
1145
|
+
/**
|
|
1146
|
+
* Set cache headers
|
|
1147
|
+
*/
|
|
1148
|
+
protected setCacheHeaders(): void;
|
|
1149
|
+
/**
|
|
1150
|
+
* Convert accumulated data to response object
|
|
1151
|
+
*/
|
|
1152
|
+
toResponse(): _ResponseType;
|
|
1153
|
+
/**
|
|
1154
|
+
* Enhanced JSON serialization for logging/debugging
|
|
1155
|
+
*/
|
|
1156
|
+
toJSON(): A_Response_Serialized<_ResponseType>;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
declare class A_ResponseError extends A_Error {
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
declare const A_SERVER_CONSTANTS__DEFAULT_ENV_VARIABLES: {
|
|
1163
|
+
/**
|
|
1164
|
+
* Port for the server to listen on
|
|
1165
|
+
* [!] Default is 3000
|
|
1166
|
+
* @default 3000
|
|
1167
|
+
*/
|
|
1168
|
+
readonly A_SERVER_PORT: "A_SERVER_PORT";
|
|
1169
|
+
};
|
|
1170
|
+
type A_TYPES__ServerENVVariables = (typeof A_SERVER_CONSTANTS__DEFAULT_ENV_VARIABLES)[keyof typeof A_SERVER_CONSTANTS__DEFAULT_ENV_VARIABLES][];
|
|
1171
|
+
declare const A_SERVER_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY: readonly ["A_SERVER_PORT"];
|
|
1172
|
+
|
|
1173
|
+
type A_SERVER_TYPES__ServerConstructor = {
|
|
1174
|
+
name: string;
|
|
1175
|
+
version: string;
|
|
1176
|
+
routes: A_ServerRoute[];
|
|
1177
|
+
port: number;
|
|
1178
|
+
};
|
|
1179
|
+
type A_SERVER_TYPES__ServerError_Init = {
|
|
1180
|
+
/**
|
|
1181
|
+
* HTTP Status Code of the error
|
|
1182
|
+
*/
|
|
1183
|
+
status?: number;
|
|
1184
|
+
} & A_TYPES__Error_Init;
|
|
1185
|
+
type A_SERVER_TYPES__ServerError_Serialized = {
|
|
1186
|
+
/**
|
|
1187
|
+
* HTTP Status Code of the error
|
|
1188
|
+
*/
|
|
1189
|
+
status: number;
|
|
1190
|
+
} & A_TYPES__Error_Serialized;
|
|
1191
|
+
|
|
1192
|
+
declare class A_Server extends A_Fragment {
|
|
1193
|
+
port: number;
|
|
1194
|
+
version: string;
|
|
1195
|
+
protected _routes: A_ServerRoute[];
|
|
1196
|
+
constructor(params: A_TYPES__Required<Partial<A_SERVER_TYPES__ServerConstructor>, [
|
|
1197
|
+
'port',
|
|
1198
|
+
'name'
|
|
1199
|
+
]>);
|
|
1200
|
+
/**
|
|
1201
|
+
* A list of routes that the server will listen to
|
|
1202
|
+
*/
|
|
1203
|
+
get routes(): A_ServerRoute[];
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
declare class A_ServerLogger extends A_Logger {
|
|
1207
|
+
protected config: A_Config<any>;
|
|
1208
|
+
logRequestFinish(request: A_Request, response: A_Response, context: A_HttpServerRequestContext): void;
|
|
1209
|
+
logResponseError(request: A_Request, response: A_Response, context: A_HttpServerRequestContext, error: A_Error): void;
|
|
1210
|
+
logStop(server: A_Server): void;
|
|
1211
|
+
serverReady(params: {
|
|
1212
|
+
port: number;
|
|
1213
|
+
app: {
|
|
1214
|
+
name: string;
|
|
1215
|
+
version?: string;
|
|
1216
|
+
};
|
|
1217
|
+
}): void;
|
|
1218
|
+
/**
|
|
1219
|
+
* Displays a proxy routes
|
|
1220
|
+
*
|
|
1221
|
+
* @param params
|
|
1222
|
+
*/
|
|
1223
|
+
proxy(params: {
|
|
1224
|
+
original: string;
|
|
1225
|
+
destination: string;
|
|
1226
|
+
}): void;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
/**
|
|
1230
|
+
* A-Service is a container that can run different types of services, such as HTTP servers, workers, etc.
|
|
1231
|
+
* Depending on the provided config and configuration, it will load the necessary components and start the service.
|
|
1232
|
+
*
|
|
1233
|
+
*/
|
|
1234
|
+
declare class A_HttpServer extends A_Service {
|
|
1235
|
+
protected server: Server;
|
|
1236
|
+
static get onBeforeRequest(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
1237
|
+
static get onRequest(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
1238
|
+
static get onAfterRequest(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
1239
|
+
protected [A_ServiceFeatures.onStart](polyfill: A_Polyfill, config: A_Config<A_TYPES__ServerENVVariables>): Promise<void>;
|
|
1240
|
+
protected [A_ServiceFeatures.onAfterStart](config: A_Config<A_TYPES__ServerENVVariables>, logger: A_ServerLogger): Promise<void>;
|
|
1241
|
+
protected [A_ServiceFeatures.onStop](...args: any[]): Promise<void>;
|
|
1242
|
+
close(): Promise<void>;
|
|
1243
|
+
listen(port: number): Promise<void>;
|
|
1244
|
+
protected [A_HttpServerFeatures.onBeforeRequest](...args: any[]): Promise<void>;
|
|
1245
|
+
protected [A_HttpServerFeatures.onRequest](...args: any[]): Promise<void>;
|
|
1246
|
+
protected [A_HttpServerFeatures.onAfterRequest](...args: any[]): Promise<void>;
|
|
1247
|
+
handleRequest(request: IncomingMessage, response: ServerResponse): Promise<void>;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
declare class A_ServerError extends A_Error<A_SERVER_TYPES__ServerError_Init, A_SERVER_TYPES__ServerError_Serialized> {
|
|
1251
|
+
status: number;
|
|
1252
|
+
protected fromConstructor(params: A_SERVER_TYPES__ServerError_Init): void;
|
|
1253
|
+
toJSON(): A_SERVER_TYPES__ServerError_Serialized;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
declare class A_ServerController extends A_Component {
|
|
1257
|
+
callEntityMethod(request: A_Request<any, any, {
|
|
1258
|
+
component: string;
|
|
1259
|
+
operation: string;
|
|
1260
|
+
}>, response: A_Response, scope: A_Scope): Promise<void>;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
type A_SERVER_TYPES__A_EntityListConstructor = {
|
|
1264
|
+
name: string;
|
|
1265
|
+
scope: string;
|
|
1266
|
+
constructor: A_TYPES__Entity_Constructor;
|
|
1267
|
+
};
|
|
1268
|
+
declare enum A_SERVER_TYPES__A_EntityListEvent {
|
|
1269
|
+
Load = "load"
|
|
1270
|
+
}
|
|
1271
|
+
type A_SERVER_TYPES__A_EntityListSerialized<EntityTypes extends A_Entity = A_Entity> = {
|
|
1272
|
+
items: Array<ReturnType<EntityTypes['toJSON']>>;
|
|
1273
|
+
type: string;
|
|
1274
|
+
pagination: A_SERVER_TYPES__A_EntityListPagination;
|
|
1275
|
+
} & A_TYPES__Entity_Serialized;
|
|
1276
|
+
type A_SERVER_TYPES__A_EntityListPagination = {
|
|
1277
|
+
total: number;
|
|
1278
|
+
page: number;
|
|
1279
|
+
pageSize: number;
|
|
1280
|
+
};
|
|
1281
|
+
|
|
1282
|
+
/**
|
|
1283
|
+
* A-EntityList
|
|
1284
|
+
*
|
|
1285
|
+
* Entity that represents a list of entities with pagination of particular type
|
|
1286
|
+
*/
|
|
1287
|
+
declare class A_ServerEntityList<EntityType extends A_Entity = A_Entity> extends A_Entity<A_SERVER_TYPES__A_EntityListConstructor, A_SERVER_TYPES__A_EntityListSerialized> {
|
|
1288
|
+
static get scope(): string;
|
|
1289
|
+
protected _entityConstructor: new (...args: ConstructorParameters<typeof A_Entity>) => EntityType;
|
|
1290
|
+
protected _items: Array<EntityType>;
|
|
1291
|
+
protected _pagination: A_SERVER_TYPES__A_EntityListPagination;
|
|
1292
|
+
/**
|
|
1293
|
+
* Returns the entity constructor used for the list
|
|
1294
|
+
*/
|
|
1295
|
+
get entityConstructor(): new (...args: ConstructorParameters<typeof A_Entity>) => EntityType;
|
|
1296
|
+
/**
|
|
1297
|
+
* Returns the list of items contained in the entity list
|
|
1298
|
+
*/
|
|
1299
|
+
get items(): Array<EntityType>;
|
|
1300
|
+
/**
|
|
1301
|
+
* Returns pagination information about the entity list
|
|
1302
|
+
*/
|
|
1303
|
+
get pagination(): A_SERVER_TYPES__A_EntityListPagination;
|
|
1304
|
+
/**
|
|
1305
|
+
* Creates a new instance of A_EntityList
|
|
1306
|
+
*
|
|
1307
|
+
* @param newEntity
|
|
1308
|
+
*/
|
|
1309
|
+
fromNew(newEntity: A_SERVER_TYPES__A_EntityListConstructor): void;
|
|
1310
|
+
/**
|
|
1311
|
+
* Allows to convert Repository Response data to EntityList instance
|
|
1312
|
+
*
|
|
1313
|
+
* [!] This method does not load the data from the repository, it only converts the data to the EntityList instance
|
|
1314
|
+
*
|
|
1315
|
+
* @param items
|
|
1316
|
+
* @param pagination
|
|
1317
|
+
*/
|
|
1318
|
+
fromList(items: Array<EntityType> | Array<ReturnType<EntityType['toJSON']>>, pagination?: A_SERVER_TYPES__A_EntityListPagination): void;
|
|
1319
|
+
/**
|
|
1320
|
+
* Serializes the EntityList to a JSON object
|
|
1321
|
+
*
|
|
1322
|
+
* @returns
|
|
1323
|
+
*/
|
|
1324
|
+
toJSON(): A_SERVER_TYPES__A_EntityListSerialized<EntityType>;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
declare class A_ServerListQueryFilter<FilterFields extends string[]> extends A_Fragment {
|
|
1328
|
+
protected _query: string | Partial<Record<FilterFields[number], string>>;
|
|
1329
|
+
protected defaults: Partial<Record<FilterFields[number], string>>;
|
|
1330
|
+
protected parsedQuery: Record<FilterFields[number], string>;
|
|
1331
|
+
constructor(_query?: string | Partial<Record<FilterFields[number], string>>, defaults?: Partial<Record<FilterFields[number], string>>);
|
|
1332
|
+
get query(): string | Partial<Record<FilterFields[number], string>>;
|
|
1333
|
+
get(property: FilterFields[number], defaultValue?: string): string;
|
|
1334
|
+
protected parseQueryString(value?: string | Partial<Record<FilterFields[number], string>>): Record<FilterFields[number], string>;
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
declare const A_SERVER__A_SERVER_LOGGER_ENV_VARIABLES: {
|
|
1338
|
+
/**
|
|
1339
|
+
* Enable logging of 200 responses
|
|
1340
|
+
*/
|
|
1341
|
+
readonly SERVER_IGNORE_LOG_200: "SERVER_IGNORE_LOG_200";
|
|
1342
|
+
/**
|
|
1343
|
+
* Enable logging of 404 responses
|
|
1344
|
+
*/
|
|
1345
|
+
readonly SERVER_IGNORE_LOG_404: "SERVER_IGNORE_LOG_404";
|
|
1346
|
+
/**
|
|
1347
|
+
* Enable logging of 500 responses
|
|
1348
|
+
*/
|
|
1349
|
+
readonly SERVER_IGNORE_LOG_500: "SERVER_IGNORE_LOG_500";
|
|
1350
|
+
/**
|
|
1351
|
+
* Enable logging of 400 responses
|
|
1352
|
+
*/
|
|
1353
|
+
readonly SERVER_IGNORE_LOG_400: "SERVER_IGNORE_LOG_400";
|
|
1354
|
+
/**
|
|
1355
|
+
* Enable logging of default responses
|
|
1356
|
+
*/
|
|
1357
|
+
readonly SERVER_IGNORE_LOG_DEFAULT: "SERVER_IGNORE_LOG_DEFAULT";
|
|
1358
|
+
};
|
|
1359
|
+
|
|
1360
|
+
type A_SERVER_TYPES__ServerLoggerRouteParams = {
|
|
1361
|
+
method: string;
|
|
1362
|
+
url: string;
|
|
1363
|
+
status: number;
|
|
1364
|
+
responseTime: number;
|
|
1365
|
+
};
|
|
1366
|
+
type A_SERVER_TYPES__ServerLoggerEnvVariables = Array<keyof typeof A_SERVER__A_SERVER_LOGGER_ENV_VARIABLES> | A_TYPES__ConceptENVVariables;
|
|
1367
|
+
|
|
1368
|
+
declare class A_ServerMiddleware extends A_Component {
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
type A_SERVER_TYPES__ProxyConfigConstructor = Record<string, string | Partial<A_SERVER_TYPES__ProxyConfigConstructorConfig>>;
|
|
1372
|
+
type A_SERVER_TYPES__ProxyConfigConstructorConfig = {
|
|
1373
|
+
hostname: string;
|
|
1374
|
+
protocol: 'http' | 'https' | string;
|
|
1375
|
+
port: number;
|
|
1376
|
+
path: string;
|
|
1377
|
+
method: A_ServerRouteHttpMethodNames;
|
|
1378
|
+
headers: Record<string, string>;
|
|
1379
|
+
};
|
|
1380
|
+
type A_SERVER_TYPES__RoutesConfig = {
|
|
1381
|
+
route: A_ServerRoute;
|
|
1382
|
+
protocol: 'http' | 'https' | string;
|
|
1383
|
+
hostname: string;
|
|
1384
|
+
port: number;
|
|
1385
|
+
headers: Record<string, string>;
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1388
|
+
declare class A_ProxyConfig extends A_Fragment {
|
|
1389
|
+
protected readonly _configs: Array<A_SERVER_TYPES__RoutesConfig>;
|
|
1390
|
+
constructor(
|
|
1391
|
+
/**
|
|
1392
|
+
* Setup proxy configs, where key is the path to match, and value is either a full URL or a partial config object
|
|
1393
|
+
*/
|
|
1394
|
+
configs?: A_SERVER_TYPES__ProxyConfigConstructor);
|
|
1395
|
+
/**
|
|
1396
|
+
* Returns all configured proxy configs
|
|
1397
|
+
*
|
|
1398
|
+
*/
|
|
1399
|
+
get configs(): Array<A_SERVER_TYPES__RoutesConfig>;
|
|
1400
|
+
/**
|
|
1401
|
+
* Checks if a given path is configured in the proxy
|
|
1402
|
+
*
|
|
1403
|
+
* @param path
|
|
1404
|
+
* @returns
|
|
1405
|
+
*/
|
|
1406
|
+
has(path: string): boolean;
|
|
1407
|
+
/**
|
|
1408
|
+
* Returns the proxy configuration for a given path, if exists
|
|
1409
|
+
*
|
|
1410
|
+
* @param path
|
|
1411
|
+
* @returns
|
|
1412
|
+
*/
|
|
1413
|
+
config(path: string): A_SERVER_TYPES__RoutesConfig | undefined;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
declare class A_ServerProxy extends A_Component {
|
|
1417
|
+
load(logger: A_Logger, config: A_ProxyConfig): Promise<void>;
|
|
1418
|
+
onRequest(req: A_Request, res: A_Response, proxyConfig: A_ProxyConfig, logger: A_Logger, polyfill: A_Polyfill, feature: A_Feature): Promise<void>;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
declare const PROXY_CONFIG_DEFAULTS: A_SERVER_TYPES__ProxyConfigConstructorConfig;
|
|
1422
|
+
|
|
1423
|
+
declare const A_ServerRouterMetaKeys: {
|
|
1424
|
+
readonly ROUTES: "_A_ServerRouterMeta_ROUTES";
|
|
1425
|
+
readonly ROUTES_CONFIGS: "_A_ServerRouterMeta_ROUTES_CONFIGS";
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1428
|
+
type A_ServerRouterRouteDefinition = {
|
|
1429
|
+
component: A_Component;
|
|
1430
|
+
handler: string;
|
|
1431
|
+
route: A_ServerRoute;
|
|
1432
|
+
};
|
|
1433
|
+
type A_ServerRouterMetaStructure = {
|
|
1434
|
+
[A_ServerRouterMetaKeys.ROUTES]: Map<string, A_ServerRouterRouteDefinition>;
|
|
1435
|
+
[A_ServerRouterMetaKeys.ROUTES_CONFIGS]: Array<A_ServerRoute>;
|
|
1436
|
+
} & A_TYPES__ComponentMeta;
|
|
1437
|
+
type A_ServerRouterMetaKeyNames = typeof A_ServerRouterMetaKeys[keyof typeof A_ServerRouterMetaKeys];
|
|
1438
|
+
type A_ServerRouterRouteConfig = {
|
|
1439
|
+
path: string | RegExp;
|
|
1440
|
+
version: string;
|
|
1441
|
+
prefix: string;
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1444
|
+
declare class A_ServerRouterMeta extends A_ComponentMeta<A_ServerRouterMetaStructure> {
|
|
1445
|
+
get routes(): Array<A_ServerRoute>;
|
|
1446
|
+
get definitions(): Map<string, A_ServerRouterRouteDefinition>;
|
|
1447
|
+
addRoute(regexp: RegExp, route: A_ServerRouterRouteDefinition): void;
|
|
1448
|
+
removeRoute(route: A_ServerRoute): void;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
declare class A_ServerRouter extends A_Component {
|
|
1452
|
+
/**
|
|
1453
|
+
* Allows to define a custom route for POST requests
|
|
1454
|
+
*
|
|
1455
|
+
* @param path
|
|
1456
|
+
* @returns
|
|
1457
|
+
*/
|
|
1458
|
+
static Post(path: string | A_ServerRoute | RegExp | A_TYPES__Required<Partial<A_ServerRouterRouteConfig>, ['path']>): <TTarget extends _adaas_a_concept.A_TYPES__MetaLinkedComponentConstructors>(target: A_Component, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
1459
|
+
/**
|
|
1460
|
+
* Allows to define a custom route for GET requests
|
|
1461
|
+
*
|
|
1462
|
+
* @param path
|
|
1463
|
+
* @returns
|
|
1464
|
+
*/
|
|
1465
|
+
static Get(path: string | A_ServerRoute | RegExp | A_TYPES__Required<Partial<A_ServerRouterRouteConfig>, ['path']>): <TTarget extends _adaas_a_concept.A_TYPES__MetaLinkedComponentConstructors>(target: A_Component, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
1466
|
+
/**
|
|
1467
|
+
* Allows to define a custom route for PUT requests
|
|
1468
|
+
*
|
|
1469
|
+
* @param path
|
|
1470
|
+
* @returns
|
|
1471
|
+
*/
|
|
1472
|
+
static Put(path: string | A_ServerRoute | RegExp | A_TYPES__Required<Partial<A_ServerRouterRouteConfig>, ['path']>): <TTarget extends _adaas_a_concept.A_TYPES__MetaLinkedComponentConstructors>(target: A_Component, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
1473
|
+
/**
|
|
1474
|
+
* Allows to define a custom route for DELETE requests
|
|
1475
|
+
*
|
|
1476
|
+
* @param path
|
|
1477
|
+
* @returns
|
|
1478
|
+
*/
|
|
1479
|
+
static Delete(path: string | A_ServerRoute | RegExp | A_TYPES__Required<Partial<A_ServerRouterRouteConfig>, ['path']>): <TTarget extends _adaas_a_concept.A_TYPES__MetaLinkedComponentConstructors>(target: A_Component, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
1480
|
+
/**
|
|
1481
|
+
* Allows to define a custom route for PATCH requests
|
|
1482
|
+
*
|
|
1483
|
+
* @param path
|
|
1484
|
+
* @returns
|
|
1485
|
+
*/
|
|
1486
|
+
static Patch(path: string | A_ServerRoute | RegExp | A_TYPES__Required<Partial<A_ServerRouterRouteConfig>, ['path']>): <TTarget extends _adaas_a_concept.A_TYPES__MetaLinkedComponentConstructors>(target: A_Component, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
1487
|
+
/**
|
|
1488
|
+
* Allows to define a custom route for DEFAULT requests
|
|
1489
|
+
*
|
|
1490
|
+
* @param path
|
|
1491
|
+
* @returns
|
|
1492
|
+
*/
|
|
1493
|
+
static Default(path: string | A_ServerRoute | RegExp | A_TYPES__Required<Partial<A_ServerRouterRouteConfig>, ['path']>): <TTarget extends _adaas_a_concept.A_TYPES__MetaLinkedComponentConstructors>(target: A_Component, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
1494
|
+
/**
|
|
1495
|
+
* Private method to have the same signature for all route methods
|
|
1496
|
+
*
|
|
1497
|
+
* @param method
|
|
1498
|
+
* @param path
|
|
1499
|
+
* @returns
|
|
1500
|
+
*/
|
|
1501
|
+
private static defineRoute;
|
|
1502
|
+
protected load(logger: A_ServerLogger): Promise<void>;
|
|
1503
|
+
identifyRoute(request: A_Request, response: A_Response, scope: A_Scope, config: A_Config, logger: A_Logger, route: A_ServerRoute): Promise<void>;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
/**
|
|
1507
|
+
*
|
|
1508
|
+
* This decorator should allow to set a default meta type for the class, this helps to avoid
|
|
1509
|
+
* the need to create custom meta classes for each class.
|
|
1510
|
+
*
|
|
1511
|
+
* @returns
|
|
1512
|
+
*/
|
|
1513
|
+
declare function A_ServerRouterDefineDecorator(route: A_ServerRoute): <TTarget extends A_TYPES__MetaLinkedComponentConstructors>(target: A_Component, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
1514
|
+
|
|
1515
|
+
interface A_StaticAlias {
|
|
1516
|
+
alias: string;
|
|
1517
|
+
path: string;
|
|
1518
|
+
directory: string;
|
|
1519
|
+
enabled?: boolean;
|
|
1520
|
+
}
|
|
1521
|
+
interface A_StaticDirectoryConfig {
|
|
1522
|
+
path: string;
|
|
1523
|
+
directory: string;
|
|
1524
|
+
alias?: string;
|
|
1525
|
+
}
|
|
1526
|
+
declare class A_StaticConfig extends A_Fragment {
|
|
1527
|
+
readonly directories: Array<string>;
|
|
1528
|
+
private _aliases;
|
|
1529
|
+
private _directoryConfigs;
|
|
1530
|
+
constructor(
|
|
1531
|
+
/**
|
|
1532
|
+
* Setup directories to serve static files from, comma separated
|
|
1533
|
+
*/
|
|
1534
|
+
directories?: string[],
|
|
1535
|
+
/**
|
|
1536
|
+
* Custom directory configurations with aliases
|
|
1537
|
+
*/
|
|
1538
|
+
directoryConfigs?: A_StaticDirectoryConfig[]);
|
|
1539
|
+
private initializeDefaultAliases;
|
|
1540
|
+
private initializeCustomAliases;
|
|
1541
|
+
/**
|
|
1542
|
+
* Add a custom static file alias
|
|
1543
|
+
* @param alias - The URL path alias (e.g., '/assets')
|
|
1544
|
+
* @param directory - The local directory path
|
|
1545
|
+
* @param path - Optional custom path (defaults to alias)
|
|
1546
|
+
*/
|
|
1547
|
+
addAlias(alias: string, directory: string, path?: string): void;
|
|
1548
|
+
/**
|
|
1549
|
+
* Remove a static file alias
|
|
1550
|
+
* @param aliasPath - The path of the alias to remove
|
|
1551
|
+
*/
|
|
1552
|
+
removeAlias(aliasPath: string): boolean;
|
|
1553
|
+
/**
|
|
1554
|
+
* Enable or disable an alias
|
|
1555
|
+
* @param aliasPath - The path of the alias
|
|
1556
|
+
* @param enabled - Whether to enable or disable
|
|
1557
|
+
*/
|
|
1558
|
+
setAliasEnabled(aliasPath: string, enabled: boolean): boolean;
|
|
1559
|
+
/**
|
|
1560
|
+
* Get all configured aliases
|
|
1561
|
+
*/
|
|
1562
|
+
getAliases(): A_StaticAlias[];
|
|
1563
|
+
/**
|
|
1564
|
+
* Get enabled aliases only
|
|
1565
|
+
*/
|
|
1566
|
+
getEnabledAliases(): A_StaticAlias[];
|
|
1567
|
+
/**
|
|
1568
|
+
* Find the best matching alias for a given request path
|
|
1569
|
+
* @param requestPath - The request path to match
|
|
1570
|
+
*/
|
|
1571
|
+
findMatchingAlias(requestPath: string): A_StaticAlias | null;
|
|
1572
|
+
/**
|
|
1573
|
+
* Check if an alias exists
|
|
1574
|
+
* @param aliasPath - The path to check
|
|
1575
|
+
*/
|
|
1576
|
+
hasAlias(aliasPath: string): boolean;
|
|
1577
|
+
/**
|
|
1578
|
+
* Get a specific alias by path
|
|
1579
|
+
* @param aliasPath - The path of the alias
|
|
1580
|
+
*/
|
|
1581
|
+
getAlias(aliasPath: string): A_StaticAlias | undefined;
|
|
1582
|
+
/**
|
|
1583
|
+
* Add multiple aliases at once
|
|
1584
|
+
* @param aliases - Array of alias configurations
|
|
1585
|
+
*/
|
|
1586
|
+
addAliases(aliases: A_StaticDirectoryConfig[]): void;
|
|
1587
|
+
/**
|
|
1588
|
+
* Clear all aliases
|
|
1589
|
+
*/
|
|
1590
|
+
clearAliases(): void;
|
|
1591
|
+
/**
|
|
1592
|
+
* Update an existing alias
|
|
1593
|
+
* @param aliasPath - The path of the alias to update
|
|
1594
|
+
* @param updates - Partial updates to apply
|
|
1595
|
+
*/
|
|
1596
|
+
updateAlias(aliasPath: string, updates: Partial<A_StaticAlias>): boolean;
|
|
1597
|
+
/**
|
|
1598
|
+
* Get statistics about configured aliases
|
|
1599
|
+
*/
|
|
1600
|
+
getStats(): {
|
|
1601
|
+
total: number;
|
|
1602
|
+
enabled: number;
|
|
1603
|
+
disabled: number;
|
|
1604
|
+
directories: string[];
|
|
1605
|
+
};
|
|
1606
|
+
/**
|
|
1607
|
+
* Checks if a given path is configured in the proxy (legacy method)
|
|
1608
|
+
* @deprecated Use findMatchingAlias instead
|
|
1609
|
+
* @param path
|
|
1610
|
+
* @returns
|
|
1611
|
+
*/
|
|
1612
|
+
has(path: string): boolean;
|
|
1613
|
+
/**
|
|
1614
|
+
* Gets the directory for a given path if configured (legacy method)
|
|
1615
|
+
*
|
|
1616
|
+
* @param path
|
|
1617
|
+
* @returns
|
|
1618
|
+
*/
|
|
1619
|
+
get(path: string): string | undefined;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
declare class A_StaticLoader extends A_Component {
|
|
1623
|
+
private _fsPolyfill;
|
|
1624
|
+
private _pathPolyfill;
|
|
1625
|
+
load(logger: A_Logger, config: A_StaticConfig, polyfill: A_Polyfill): Promise<void>;
|
|
1626
|
+
[A_HttpServerFeatures.onRequest](req: A_Request, res: A_Response, logger: A_Logger, config: A_StaticConfig, polyfill: A_Polyfill): Promise<void>;
|
|
1627
|
+
/**
|
|
1628
|
+
* Add a custom static file alias through the config
|
|
1629
|
+
* @param alias - The URL path alias (e.g., '/assets')
|
|
1630
|
+
* @param directory - The local directory path
|
|
1631
|
+
* @param path - Optional custom path (defaults to alias)
|
|
1632
|
+
* @param config - Static config instance
|
|
1633
|
+
* @param logger - Logger instance for logging
|
|
1634
|
+
*/
|
|
1635
|
+
addAlias(alias: string, directory: string, config: A_StaticConfig, logger?: A_Logger, path?: string): void;
|
|
1636
|
+
/**
|
|
1637
|
+
* Remove a static file alias through the config
|
|
1638
|
+
* @param aliasPath - The path of the alias to remove
|
|
1639
|
+
* @param config - Static config instance
|
|
1640
|
+
* @param logger - Logger instance for logging
|
|
1641
|
+
*/
|
|
1642
|
+
removeAlias(aliasPath: string, config: A_StaticConfig, logger?: A_Logger): boolean;
|
|
1643
|
+
/**
|
|
1644
|
+
* Get all configured aliases from config
|
|
1645
|
+
* @param config - Static config instance
|
|
1646
|
+
*/
|
|
1647
|
+
getAliases(config: A_StaticConfig): A_StaticAlias[];
|
|
1648
|
+
/**
|
|
1649
|
+
* Enable or disable an alias
|
|
1650
|
+
* @param aliasPath - The path of the alias
|
|
1651
|
+
* @param enabled - Whether to enable or disable
|
|
1652
|
+
* @param config - Static config instance
|
|
1653
|
+
* @param logger - Logger instance for logging
|
|
1654
|
+
*/
|
|
1655
|
+
setAliasEnabled(aliasPath: string, enabled: boolean, config: A_StaticConfig, logger?: A_Logger): boolean;
|
|
1656
|
+
protected getMimeType(ext: string): string;
|
|
1657
|
+
protected safeFilePath(staticDir: string, reqUrl: string, host: string | undefined, pathPolyfill: any, fsPolyfill: any): string;
|
|
1658
|
+
protected serveFile(filePath: string, res: A_Response, logger: A_Logger, fsPolyfill: any, pathPolyfill: any): Promise<void>;
|
|
1659
|
+
protected getCacheControl(ext: string): string;
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
type A_SERVER_TYPES__StaticLoader_Init = {
|
|
1663
|
+
/**
|
|
1664
|
+
* Path to the static files directory
|
|
1665
|
+
*/
|
|
1666
|
+
staticFilesPath: string;
|
|
1667
|
+
};
|
|
1668
|
+
|
|
1669
|
+
export { A_HttpRequestData, A_HttpServer, A_HttpServerError, type A_HttpServerError_Init, type A_HttpServerError_Serialized, type A_HttpServerFeatureNames, A_HttpServerFeatures, A_HttpServerRequestContext, type A_HttpServerRequestMethod, A_ProxyConfig, A_Request, A_RequestEnvVariables, A_RequestEnvVariablesArray, type A_RequestEnvVariablesType, A_RequestError, type A_RequestFeatureNames, A_RequestFeatures, A_RequestHelper, type A_Request_BodyType, A_Request_Event, type A_Request_EventCallback, type A_Request_FileUpload, type A_Request_Init, type A_Request_Listener, type A_Request_Methods, type A_Request_Options, type A_Request_ParsedBody, type A_Request_Serialized, type A_Request_SessionData, type A_Request_ValidationResult, A_Response, A_ResponseError, type A_ResponseFeatureNames, A_ResponseFeatures, type A_Response_CacheOptions, type A_Response_CompressionOptions, type A_Response_Constructor, type A_Response_CookieOptions, type A_Response_DownloadOptions, type A_Response_Listener, type A_Response_Options, type A_Response_SendResponseObject, type A_Response_Serialized, type A_Response_StreamOptions, A_SERVER_CONSTANTS__DEFAULT_ENV_VARIABLES, A_SERVER_CONSTANTS__DEFAULT_ENV_VARIABLES_ARRAY, type A_SERVER_TYPES__A_EntityListConstructor, A_SERVER_TYPES__A_EntityListEvent, type A_SERVER_TYPES__A_EntityListPagination, type A_SERVER_TYPES__A_EntityListSerialized, type A_SERVER_TYPES__ProxyConfigConstructor, type A_SERVER_TYPES__ProxyConfigConstructorConfig, type A_SERVER_TYPES__RoutesConfig, type A_SERVER_TYPES__ServerConstructor, type A_SERVER_TYPES__ServerError_Init, type A_SERVER_TYPES__ServerError_Serialized, type A_SERVER_TYPES__ServerLoggerEnvVariables, type A_SERVER_TYPES__ServerLoggerRouteParams, type A_SERVER_TYPES__StaticLoader_Init, A_SERVER__A_SERVER_LOGGER_ENV_VARIABLES, A_Server, A_ServerController, A_ServerEntityList, A_ServerError, A_ServerListQueryFilter, A_ServerLogger, A_ServerMiddleware, A_ServerProxy, A_ServerRoute, type A_ServerRouteHttpMethodNames, A_ServerRouteHttpMethods, A_ServerRouteProtocols, A_ServerRouter, A_ServerRouterDefineDecorator, A_ServerRouterMeta, type A_ServerRouterMetaKeyNames, A_ServerRouterMetaKeys, type A_ServerRouterMetaStructure, type A_ServerRouterRouteConfig, type A_ServerRouterRouteDefinition, type A_StaticAlias, A_StaticConfig, type A_StaticDirectoryConfig, A_StaticLoader, type A_TYPES__ServerENVVariables, type A_serverRouteProtocolNames, PROXY_CONFIG_DEFAULTS };
|