@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 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-Response/A-Response.error.ts"],"names":[],"mappings":";;;AAGO,MAAM,wBAAwB,OAAA,CAAQ;AAE7C","file":"A-Response.error.mjs","sourcesContent":["import { A_Error } from \"@adaas/a-concept\"\n\n\nexport class A_ResponseError extends A_Error {\n\n}"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import 'http';
|
|
2
|
+
export { a as A_ResponseFeatureNames, b as A_Response_CacheOptions, c as A_Response_CompressionOptions, d as A_Response_Constructor, e as A_Response_CookieOptions, f as A_Response_DownloadOptions, g as A_Response_Listener, h as A_Response_Options, i as A_Response_SendResponseObject, j as A_Response_Serialized, k as A_Response_StreamOptions } from '../../A-Response.entity-BVYAc6-8.mjs';
|
|
3
|
+
import '@adaas/a-concept';
|
|
4
|
+
import './A-Response.constants.mjs';
|
|
5
|
+
import 'stream';
|
|
6
|
+
import '../A-Server/A-HttpServer.error.mjs';
|
|
7
|
+
import '../A-Server/A-HttpServer.types.mjs';
|
|
8
|
+
import '../A-Server/A-HttpServer.constants.mjs';
|
|
9
|
+
import '../../A-Request.entity-r905O60G.mjs';
|
|
10
|
+
import '../A-Request/A-Request.constants.mjs';
|
|
11
|
+
import '../A-Request/A-Request.env.mjs';
|
|
12
|
+
import '../A-Request/A-HttpServerRequest.context.mjs';
|
|
13
|
+
import '@adaas/a-utils/a-operation';
|
|
14
|
+
import '../A-Request/A-HttpRequestData.context.mjs';
|
|
15
|
+
import '@adaas/a-utils/a-execution';
|
|
16
|
+
import '@adaas/a-utils/a-config';
|
|
17
|
+
import '../A-ServerRoute/A-ServerRoute.entity.mjs';
|
|
18
|
+
import '@adaas/a-utils/a-route';
|
|
19
|
+
import '../A-ServerRoute/A-ServerRoute.types.mjs';
|
|
20
|
+
import '../A-ServerRoute/A-ServerRoute.constants.mjs';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import 'http';
|
|
2
|
+
export { a as A_ResponseFeatureNames, b as A_Response_CacheOptions, c as A_Response_CompressionOptions, d as A_Response_Constructor, e as A_Response_CookieOptions, f as A_Response_DownloadOptions, g as A_Response_Listener, h as A_Response_Options, i as A_Response_SendResponseObject, j as A_Response_Serialized, k as A_Response_StreamOptions } from '../../A-Response.entity-CRc-t-vr.js';
|
|
3
|
+
import '@adaas/a-concept';
|
|
4
|
+
import './A-Response.constants.js';
|
|
5
|
+
import 'stream';
|
|
6
|
+
import '../A-Server/A-HttpServer.error.js';
|
|
7
|
+
import '../A-Server/A-HttpServer.types.js';
|
|
8
|
+
import '../A-Server/A-HttpServer.constants.js';
|
|
9
|
+
import '../../A-Request.entity-8_9MCXT2.js';
|
|
10
|
+
import '../A-Request/A-Request.constants.js';
|
|
11
|
+
import '../A-Request/A-Request.env.js';
|
|
12
|
+
import '../A-Request/A-HttpServerRequest.context.js';
|
|
13
|
+
import '@adaas/a-utils/a-operation';
|
|
14
|
+
import '../A-Request/A-HttpRequestData.context.js';
|
|
15
|
+
import '@adaas/a-utils/a-execution';
|
|
16
|
+
import '@adaas/a-utils/a-config';
|
|
17
|
+
import '../A-ServerRoute/A-ServerRoute.entity.js';
|
|
18
|
+
import '@adaas/a-utils/a-route';
|
|
19
|
+
import '../A-ServerRoute/A-ServerRoute.types.js';
|
|
20
|
+
import '../A-ServerRoute/A-ServerRoute.constants.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"A-Response.types.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"A-Response.types.mjs"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const A_HttpServerFeatures = {
|
|
4
|
+
onBeforeRequest: "_A_HTTPServer_onBeforeRequest",
|
|
5
|
+
onRequest: "_A_HTTPServer_onRequest",
|
|
6
|
+
onAfterRequest: "_A_HTTPServer_onAfterRequest"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
exports.A_HttpServerFeatures = A_HttpServerFeatures;
|
|
10
|
+
//# sourceMappingURL=A-HttpServer.constants.js.map
|
|
11
|
+
//# sourceMappingURL=A-HttpServer.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-Server/A-HttpServer.constants.ts"],"names":[],"mappings":";;AAGO,MAAM,oBAAA,GAAuB;AAAA,EAChC,eAAA,EAAiB,+BAAA;AAAA,EACjB,SAAA,EAAW,yBAAA;AAAA,EACX,cAAA,EAAgB;AACpB","file":"A-HttpServer.constants.js","sourcesContent":["\n\n\nexport const A_HttpServerFeatures = {\n onBeforeRequest: '_A_HTTPServer_onBeforeRequest',\n onRequest: '_A_HTTPServer_onRequest',\n onAfterRequest: '_A_HTTPServer_onAfterRequest',\n} as const\n\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import '../../chunk-EQQGB2QZ.mjs';
|
|
2
|
+
|
|
3
|
+
const A_HttpServerFeatures = {
|
|
4
|
+
onBeforeRequest: "_A_HTTPServer_onBeforeRequest",
|
|
5
|
+
onRequest: "_A_HTTPServer_onRequest",
|
|
6
|
+
onAfterRequest: "_A_HTTPServer_onAfterRequest"
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { A_HttpServerFeatures };
|
|
10
|
+
//# sourceMappingURL=A-HttpServer.constants.mjs.map
|
|
11
|
+
//# sourceMappingURL=A-HttpServer.constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-Server/A-HttpServer.constants.ts"],"names":[],"mappings":";;AAGO,MAAM,oBAAA,GAAuB;AAAA,EAChC,eAAA,EAAiB,+BAAA;AAAA,EACjB,SAAA,EAAW,yBAAA;AAAA,EACX,cAAA,EAAgB;AACpB","file":"A-HttpServer.constants.mjs","sourcesContent":["\n\n\nexport const A_HttpServerFeatures = {\n onBeforeRequest: '_A_HTTPServer_onBeforeRequest',\n onRequest: '_A_HTTPServer_onRequest',\n onAfterRequest: '_A_HTTPServer_onAfterRequest',\n} as const\n\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Server, IncomingMessage, ServerResponse } from 'http';
|
|
2
|
+
import { A_HttpServerFeatures } from './A-HttpServer.constants.mjs';
|
|
3
|
+
import { A_TYPES__ServerENVVariables } from '../../constants/env.constants.mjs';
|
|
4
|
+
import { A_ServerLogger } from '../A-ServerLogger/A-ServerLogger.component.mjs';
|
|
5
|
+
import { A_Service, A_ServiceFeatures } from '@adaas/a-utils/a-service';
|
|
6
|
+
import { A_Polyfill } from '@adaas/a-utils/a-polyfill';
|
|
7
|
+
import { A_Config } from '@adaas/a-utils/a-config';
|
|
8
|
+
import '@adaas/a-concept';
|
|
9
|
+
import './A-Server.context.mjs';
|
|
10
|
+
import './A-Server.types.mjs';
|
|
11
|
+
import '../A-ServerRoute/A-ServerRoute.entity.mjs';
|
|
12
|
+
import '@adaas/a-utils/a-route';
|
|
13
|
+
import '../A-ServerRoute/A-ServerRoute.types.mjs';
|
|
14
|
+
import '../A-ServerRoute/A-ServerRoute.constants.mjs';
|
|
15
|
+
import '../../A-Request.entity-r905O60G.mjs';
|
|
16
|
+
import './A-HttpServer.error.mjs';
|
|
17
|
+
import './A-HttpServer.types.mjs';
|
|
18
|
+
import '../A-Request/A-Request.constants.mjs';
|
|
19
|
+
import '../A-Request/A-Request.env.mjs';
|
|
20
|
+
import '../A-Request/A-HttpServerRequest.context.mjs';
|
|
21
|
+
import '@adaas/a-utils/a-operation';
|
|
22
|
+
import '../A-Request/A-HttpRequestData.context.mjs';
|
|
23
|
+
import '@adaas/a-utils/a-execution';
|
|
24
|
+
import '../../A-Response.entity-BVYAc6-8.mjs';
|
|
25
|
+
import 'stream';
|
|
26
|
+
import '../A-Response/A-Response.constants.mjs';
|
|
27
|
+
import '@adaas/a-utils/a-logger';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A-Service is a container that can run different types of services, such as HTTP servers, workers, etc.
|
|
31
|
+
* Depending on the provided config and configuration, it will load the necessary components and start the service.
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
declare class A_HttpServer extends A_Service {
|
|
35
|
+
protected server: Server;
|
|
36
|
+
static get onBeforeRequest(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
37
|
+
static get onRequest(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
38
|
+
static get onAfterRequest(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
39
|
+
protected [A_ServiceFeatures.onStart](polyfill: A_Polyfill, config: A_Config<A_TYPES__ServerENVVariables>): Promise<void>;
|
|
40
|
+
protected [A_ServiceFeatures.onAfterStart](config: A_Config<A_TYPES__ServerENVVariables>, logger: A_ServerLogger): Promise<void>;
|
|
41
|
+
protected [A_ServiceFeatures.onStop](...args: any[]): Promise<void>;
|
|
42
|
+
close(): Promise<void>;
|
|
43
|
+
listen(port: number): Promise<void>;
|
|
44
|
+
protected [A_HttpServerFeatures.onBeforeRequest](...args: any[]): Promise<void>;
|
|
45
|
+
protected [A_HttpServerFeatures.onRequest](...args: any[]): Promise<void>;
|
|
46
|
+
protected [A_HttpServerFeatures.onAfterRequest](...args: any[]): Promise<void>;
|
|
47
|
+
handleRequest(request: IncomingMessage, response: ServerResponse): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { A_HttpServer };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Server, IncomingMessage, ServerResponse } from 'http';
|
|
2
|
+
import { A_HttpServerFeatures } from './A-HttpServer.constants.js';
|
|
3
|
+
import { A_TYPES__ServerENVVariables } from '../../constants/env.constants.js';
|
|
4
|
+
import { A_ServerLogger } from '../A-ServerLogger/A-ServerLogger.component.js';
|
|
5
|
+
import { A_Service, A_ServiceFeatures } from '@adaas/a-utils/a-service';
|
|
6
|
+
import { A_Polyfill } from '@adaas/a-utils/a-polyfill';
|
|
7
|
+
import { A_Config } from '@adaas/a-utils/a-config';
|
|
8
|
+
import '@adaas/a-concept';
|
|
9
|
+
import './A-Server.context.js';
|
|
10
|
+
import './A-Server.types.js';
|
|
11
|
+
import '../A-ServerRoute/A-ServerRoute.entity.js';
|
|
12
|
+
import '@adaas/a-utils/a-route';
|
|
13
|
+
import '../A-ServerRoute/A-ServerRoute.types.js';
|
|
14
|
+
import '../A-ServerRoute/A-ServerRoute.constants.js';
|
|
15
|
+
import '../../A-Request.entity-8_9MCXT2.js';
|
|
16
|
+
import './A-HttpServer.error.js';
|
|
17
|
+
import './A-HttpServer.types.js';
|
|
18
|
+
import '../A-Request/A-Request.constants.js';
|
|
19
|
+
import '../A-Request/A-Request.env.js';
|
|
20
|
+
import '../A-Request/A-HttpServerRequest.context.js';
|
|
21
|
+
import '@adaas/a-utils/a-operation';
|
|
22
|
+
import '../A-Request/A-HttpRequestData.context.js';
|
|
23
|
+
import '@adaas/a-utils/a-execution';
|
|
24
|
+
import '../../A-Response.entity-CRc-t-vr.js';
|
|
25
|
+
import 'stream';
|
|
26
|
+
import '../A-Response/A-Response.constants.js';
|
|
27
|
+
import '@adaas/a-utils/a-logger';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A-Service is a container that can run different types of services, such as HTTP servers, workers, etc.
|
|
31
|
+
* Depending on the provided config and configuration, it will load the necessary components and start the service.
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
declare class A_HttpServer extends A_Service {
|
|
35
|
+
protected server: Server;
|
|
36
|
+
static get onBeforeRequest(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
37
|
+
static get onRequest(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
38
|
+
static get onAfterRequest(): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => any;
|
|
39
|
+
protected [A_ServiceFeatures.onStart](polyfill: A_Polyfill, config: A_Config<A_TYPES__ServerENVVariables>): Promise<void>;
|
|
40
|
+
protected [A_ServiceFeatures.onAfterStart](config: A_Config<A_TYPES__ServerENVVariables>, logger: A_ServerLogger): Promise<void>;
|
|
41
|
+
protected [A_ServiceFeatures.onStop](...args: any[]): Promise<void>;
|
|
42
|
+
close(): Promise<void>;
|
|
43
|
+
listen(port: number): Promise<void>;
|
|
44
|
+
protected [A_HttpServerFeatures.onBeforeRequest](...args: any[]): Promise<void>;
|
|
45
|
+
protected [A_HttpServerFeatures.onRequest](...args: any[]): Promise<void>;
|
|
46
|
+
protected [A_HttpServerFeatures.onAfterRequest](...args: any[]): Promise<void>;
|
|
47
|
+
handleRequest(request: IncomingMessage, response: ServerResponse): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { A_HttpServer };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var AHttpServer_constants = require('./A-HttpServer.constants');
|
|
4
|
+
var ARequest_entity = require('@adaas/a-server/request/A-Request.entity');
|
|
5
|
+
var AResponse_entity = require('@adaas/a-server/response/A-Response.entity');
|
|
6
|
+
var aConcept = require('@adaas/a-concept');
|
|
7
|
+
var AServerRoute_entity = require('@adaas/a-server/route/A-ServerRoute.entity');
|
|
8
|
+
var AHttpServer_error = require('./A-HttpServer.error');
|
|
9
|
+
var ARequest_constants = require('@adaas/a-server/request/A-Request.constants');
|
|
10
|
+
var AHttpServerRequest_context = require('@adaas/a-server/request/A-HttpServerRequest.context');
|
|
11
|
+
var AServerLogger_component = require('@adaas/a-server/logger/A-ServerLogger.component');
|
|
12
|
+
var aService = require('@adaas/a-utils/a-service');
|
|
13
|
+
var aPolyfill = require('@adaas/a-utils/a-polyfill');
|
|
14
|
+
var aConfig = require('@adaas/a-utils/a-config');
|
|
15
|
+
|
|
16
|
+
var __defProp = Object.defineProperty;
|
|
17
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
18
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
19
|
+
var result = __getOwnPropDesc(target, key) ;
|
|
20
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
21
|
+
if (decorator = decorators[i])
|
|
22
|
+
result = (decorator(target, key, result) ) || result;
|
|
23
|
+
if (result) __defProp(target, key, result);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
27
|
+
var _a, _b, _c, _d, _e;
|
|
28
|
+
class A_HttpServer extends aService.A_Service {
|
|
29
|
+
static get onBeforeRequest() {
|
|
30
|
+
return (target, propertyKey, descriptor) => {
|
|
31
|
+
return aConcept.A_Feature.Extend({
|
|
32
|
+
name: AHttpServer_constants.A_HttpServerFeatures.onBeforeRequest,
|
|
33
|
+
scope: [target.constructor]
|
|
34
|
+
})(target, propertyKey, descriptor);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
static get onRequest() {
|
|
38
|
+
return (target, propertyKey, descriptor) => {
|
|
39
|
+
return aConcept.A_Feature.Extend({
|
|
40
|
+
name: AHttpServer_constants.A_HttpServerFeatures.onRequest,
|
|
41
|
+
scope: [target.constructor]
|
|
42
|
+
})(target, propertyKey, descriptor);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
static get onAfterRequest() {
|
|
46
|
+
return (target, propertyKey, descriptor) => {
|
|
47
|
+
return aConcept.A_Feature.Extend({
|
|
48
|
+
name: AHttpServer_constants.A_HttpServerFeatures.onAfterRequest,
|
|
49
|
+
scope: [target.constructor]
|
|
50
|
+
})(target, propertyKey, descriptor);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
async [_e = aService.A_ServiceFeatures.onStart](polyfill, config) {
|
|
54
|
+
const http = await polyfill.http();
|
|
55
|
+
this.server = http.createServer(this.handleRequest.bind(this));
|
|
56
|
+
await this.listen(config.get("A_SERVER_PORT"));
|
|
57
|
+
}
|
|
58
|
+
async [_d = aService.A_ServiceFeatures.onAfterStart](config, logger) {
|
|
59
|
+
logger.serverReady({
|
|
60
|
+
port: config.get("A_SERVER_PORT"),
|
|
61
|
+
app: {
|
|
62
|
+
name: this.scope.name
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async [aService.A_ServiceFeatures.onStop](...args) {
|
|
67
|
+
await this.close();
|
|
68
|
+
}
|
|
69
|
+
close() {
|
|
70
|
+
return new Promise((resolve, reject) => {
|
|
71
|
+
this.server.close(() => {
|
|
72
|
+
resolve();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
listen(port) {
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
this.server.listen(port, () => {
|
|
79
|
+
resolve();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
async [_c = AHttpServer_constants.A_HttpServerFeatures.onBeforeRequest](...args) {
|
|
84
|
+
}
|
|
85
|
+
async [_b = AHttpServer_constants.A_HttpServerFeatures.onRequest](...args) {
|
|
86
|
+
}
|
|
87
|
+
async [_a = AHttpServer_constants.A_HttpServerFeatures.onAfterRequest](...args) {
|
|
88
|
+
}
|
|
89
|
+
// ======================================================================================
|
|
90
|
+
// ============================= A_HttpServer Methods =================================
|
|
91
|
+
// ======================================================================================
|
|
92
|
+
async handleRequest(request, response) {
|
|
93
|
+
const route = new AServerRoute_entity.A_ServerRoute(
|
|
94
|
+
request.url || "",
|
|
95
|
+
request.method
|
|
96
|
+
);
|
|
97
|
+
const id = aConcept.A_IdentityHelper.generateTimeId();
|
|
98
|
+
const shard = `${request.method}-${route.path.replace("/", "-")}`;
|
|
99
|
+
const req = new ARequest_entity.A_Request({ id, shard, request, scope: this.scope.name });
|
|
100
|
+
const res = new AResponse_entity.A_Response({ id, shard, response, scope: this.scope.name });
|
|
101
|
+
const context = new AHttpServerRequest_context.A_HttpServerRequestContext(request, response);
|
|
102
|
+
const scope = new aConcept.A_Scope({
|
|
103
|
+
name: id,
|
|
104
|
+
entities: [req, res],
|
|
105
|
+
fragments: [route, context]
|
|
106
|
+
}).inherit(this.scope);
|
|
107
|
+
try {
|
|
108
|
+
const onBeforeRequestFeature = new aConcept.A_Feature({
|
|
109
|
+
name: AHttpServer_constants.A_HttpServerFeatures.onBeforeRequest,
|
|
110
|
+
component: this
|
|
111
|
+
});
|
|
112
|
+
const onRequestFeature = new aConcept.A_Feature({
|
|
113
|
+
name: AHttpServer_constants.A_HttpServerFeatures.onRequest,
|
|
114
|
+
component: this
|
|
115
|
+
});
|
|
116
|
+
const onAfterRequestFeature = new aConcept.A_Feature({
|
|
117
|
+
name: AHttpServer_constants.A_HttpServerFeatures.onAfterRequest,
|
|
118
|
+
component: this
|
|
119
|
+
});
|
|
120
|
+
await new Promise(async (resolve, reject) => {
|
|
121
|
+
const cleanup = () => {
|
|
122
|
+
onBeforeRequestFeature.interrupt();
|
|
123
|
+
onRequestFeature.interrupt();
|
|
124
|
+
onAfterRequestFeature.interrupt();
|
|
125
|
+
req.off(ARequest_constants.A_RequestFeatures.onError, cleanup);
|
|
126
|
+
req.off(ARequest_constants.A_RequestFeatures.onClose, cleanup);
|
|
127
|
+
req.off(ARequest_constants.A_RequestFeatures.onTimeout, cleanup);
|
|
128
|
+
reject(scope.resolve(aConcept.A_Error));
|
|
129
|
+
};
|
|
130
|
+
req.on(ARequest_constants.A_RequestFeatures.onError, cleanup.bind(this));
|
|
131
|
+
req.on(ARequest_constants.A_RequestFeatures.onClose, cleanup.bind(this));
|
|
132
|
+
try {
|
|
133
|
+
await req.load();
|
|
134
|
+
await res.load();
|
|
135
|
+
await onBeforeRequestFeature.process(scope);
|
|
136
|
+
await onRequestFeature.process(scope);
|
|
137
|
+
await onAfterRequestFeature.process(scope);
|
|
138
|
+
req.clearTimeout();
|
|
139
|
+
await res.status(200).send();
|
|
140
|
+
resolve();
|
|
141
|
+
} catch (error) {
|
|
142
|
+
req.clearTimeout();
|
|
143
|
+
reject(error);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
} catch (error) {
|
|
147
|
+
let wrappedError;
|
|
148
|
+
switch (true) {
|
|
149
|
+
case error instanceof AHttpServer_error.A_HttpServerError:
|
|
150
|
+
wrappedError = error;
|
|
151
|
+
break;
|
|
152
|
+
case (error instanceof aConcept.A_Error && error.originalError instanceof AHttpServer_error.A_HttpServerError):
|
|
153
|
+
wrappedError = error.originalError;
|
|
154
|
+
break;
|
|
155
|
+
default:
|
|
156
|
+
wrappedError = new AHttpServer_error.A_HttpServerError({
|
|
157
|
+
status: 500,
|
|
158
|
+
description: "An error occurred while processing the request.",
|
|
159
|
+
originalError: error
|
|
160
|
+
});
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
scope.register(wrappedError);
|
|
164
|
+
await res.fail(wrappedError);
|
|
165
|
+
await this.call(aService.A_ServiceFeatures.onError, scope);
|
|
166
|
+
}
|
|
167
|
+
scope.destroy();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
__decorateClass([
|
|
171
|
+
aConcept.A_Feature.Extend(),
|
|
172
|
+
__decorateParam(0, aConcept.A_Dependency.Required()),
|
|
173
|
+
__decorateParam(0, aConcept.A_Inject(aPolyfill.A_Polyfill)),
|
|
174
|
+
__decorateParam(1, aConcept.A_Dependency.Required()),
|
|
175
|
+
__decorateParam(1, aConcept.A_Inject(aConfig.A_Config))
|
|
176
|
+
], A_HttpServer.prototype, _e);
|
|
177
|
+
__decorateClass([
|
|
178
|
+
aConcept.A_Feature.Extend(),
|
|
179
|
+
__decorateParam(0, aConcept.A_Inject(aConfig.A_Config)),
|
|
180
|
+
__decorateParam(1, aConcept.A_Inject(AServerLogger_component.A_ServerLogger))
|
|
181
|
+
], A_HttpServer.prototype, _d);
|
|
182
|
+
__decorateClass([
|
|
183
|
+
aConcept.A_Feature.Extend()
|
|
184
|
+
], A_HttpServer.prototype, _c);
|
|
185
|
+
__decorateClass([
|
|
186
|
+
aConcept.A_Feature.Extend()
|
|
187
|
+
], A_HttpServer.prototype, _b);
|
|
188
|
+
__decorateClass([
|
|
189
|
+
aConcept.A_Feature.Extend()
|
|
190
|
+
], A_HttpServer.prototype, _a);
|
|
191
|
+
|
|
192
|
+
exports.A_HttpServer = A_HttpServer;
|
|
193
|
+
//# sourceMappingURL=A-HttpServer.container.js.map
|
|
194
|
+
//# sourceMappingURL=A-HttpServer.container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-Server/A-HttpServer.container.ts"],"names":["A_Service","A_Feature","A_HttpServerFeatures","A_ServiceFeatures","A_ServerRoute","A_IdentityHelper","A_Request","A_Response","A_HttpServerRequestContext","A_Scope","A_RequestFeatures","A_Error","A_HttpServerError","A_Polyfill","A_Config","A_ServerLogger"],"mappings":"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","file":"A-HttpServer.container.js","sourcesContent":["import type { IncomingMessage, Server, ServerResponse } from \"http\";\nimport { A_HttpServerFeatures } from \"./A-HttpServer.constants\";\nimport { A_Request } from \"@adaas/a-server/request/A-Request.entity\";\nimport { A_Response } from \"@adaas/a-server/response/A-Response.entity\";\nimport { A_TYPES__ServerENVVariables } from \"@adaas/a-server/constants/env.constants\";\nimport { A_Dependency, A_Error, A_Feature, A_IdentityHelper, A_Inject, A_Scope } from \"@adaas/a-concept\";\nimport { A_ServerRoute } from \"@adaas/a-server/route/A-ServerRoute.entity\";\nimport { A_HttpServerRequestMethod } from \"./A-HttpServer.types\";\nimport { A_HttpServerError } from \"./A-HttpServer.error\";\nimport { A_RequestFeatures } from \"@adaas/a-server/request/A-Request.constants\";\nimport { A_HttpServerRequestContext } from \"@adaas/a-server/request/A-HttpServerRequest.context\";\nimport { A_ServerLogger } from \"@adaas/a-server/logger/A-ServerLogger.component\";\nimport { A_Service, A_ServiceFeatures } from \"@adaas/a-utils/a-service\";\nimport { A_Polyfill } from \"@adaas/a-utils/a-polyfill\";\nimport { A_Config } from \"@adaas/a-utils/a-config\";\n\n\n\n\n/**\n * A-Service is a container that can run different types of services, such as HTTP servers, workers, etc.\n * Depending on the provided config and configuration, it will load the necessary components and start the service.\n * \n */\nexport class A_HttpServer extends A_Service {\n\n protected server!: Server;\n\n\n static get onBeforeRequest() {\n return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n return A_Feature.Extend({\n name: A_HttpServerFeatures.onBeforeRequest,\n scope: [target.constructor],\n })(target, propertyKey, descriptor);\n }\n }\n\n static get onRequest() {\n return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n return A_Feature.Extend({\n name: A_HttpServerFeatures.onRequest,\n scope: [target.constructor],\n })(target, propertyKey, descriptor);\n }\n }\n\n static get onAfterRequest() {\n return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {\n return A_Feature.Extend({\n name: A_HttpServerFeatures.onAfterRequest,\n scope: [target.constructor],\n })(target, propertyKey, descriptor);\n }\n }\n\n\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onStart](\n\n @A_Dependency.Required()\n @A_Inject(A_Polyfill) polyfill: A_Polyfill,\n\n @A_Dependency.Required()\n @A_Inject(A_Config) config: A_Config<A_TYPES__ServerENVVariables>,\n\n ): Promise<void> {\n const http = await polyfill.http();\n\n // Create the HTTP server\n this.server = http.createServer(this.handleRequest.bind(this));\n\n // Start listening on the specified port\n await this.listen(config.get('A_SERVER_PORT'));\n }\n\n @A_Feature.Extend()\n protected async [A_ServiceFeatures.onAfterStart](\n @A_Inject(A_Config) config: A_Config<A_TYPES__ServerENVVariables>,\n @A_Inject(A_ServerLogger) logger: A_ServerLogger,\n ): Promise<void> {\n logger.serverReady({\n port: config.get('A_SERVER_PORT'),\n app: {\n name: this.scope.name,\n }\n });\n }\n\n protected async [A_ServiceFeatures.onStop](...args: any[]): Promise<void> {\n await this.close();\n }\n\n close() {\n return new Promise<void>((resolve, reject) => {\n this.server.close(() => {\n resolve();\n });\n });\n }\n\n listen(port: number) {\n return new Promise<void>((resolve, reject) => {\n this.server.listen(port, () => {\n resolve();\n });\n });\n }\n\n\n // ======================================================================================\n // ============================= A_HttpServer Lifecycle =================================\n // ======================================================================================\n\n @A_Feature.Extend()\n protected async [A_HttpServerFeatures.onBeforeRequest](...args: any[]) { }\n\n @A_Feature.Extend()\n protected async [A_HttpServerFeatures.onRequest](...args: any[]) { }\n\n @A_Feature.Extend()\n protected async [A_HttpServerFeatures.onAfterRequest](...args: any[]) { }\n\n\n // ======================================================================================\n // ============================= A_HttpServer Methods =================================\n // ======================================================================================\n\n async handleRequest(\n request: IncomingMessage,\n response: ServerResponse\n ) {\n const route = new A_ServerRoute(\n request.url || '',\n request.method as A_HttpServerRequestMethod\n );\n\n const id = A_IdentityHelper.generateTimeId();\n const shard = `${request.method}-${route.path.replace('/', '-')}`;\n\n const req = new A_Request({ id, shard, request, scope: this.scope.name });\n const res = new A_Response({ id, shard, response, scope: this.scope.name });\n const context = new A_HttpServerRequestContext(request, response);\n\n const scope = new A_Scope({\n name: id,\n entities: [req, res],\n fragments: [route, context]\n }).inherit(this.scope);\n\n try {\n const onBeforeRequestFeature = new A_Feature({\n name: A_HttpServerFeatures.onBeforeRequest,\n component: this\n });\n\n const onRequestFeature = new A_Feature({\n name: A_HttpServerFeatures.onRequest,\n component: this\n });\n\n const onAfterRequestFeature = new A_Feature({\n name: A_HttpServerFeatures.onAfterRequest,\n component: this\n });\n\n await new Promise<void>(async (resolve, reject) => {\n\n const cleanup = () => {\n onBeforeRequestFeature.interrupt();\n onRequestFeature.interrupt();\n onAfterRequestFeature.interrupt();\n\n req.off(A_RequestFeatures.onError, cleanup);\n req.off(A_RequestFeatures.onClose, cleanup);\n req.off(A_RequestFeatures.onTimeout, cleanup);\n\n\n reject(scope.resolve(A_Error)!);\n }\n\n\n req.on(A_RequestFeatures.onError, cleanup.bind(this));\n req.on(A_RequestFeatures.onClose, cleanup.bind(this));\n\n try {\n await req.load();\n await res.load();\n\n\n await onBeforeRequestFeature.process(scope);\n\n await onRequestFeature.process(scope);\n\n await onAfterRequestFeature.process(scope);\n\n\n req.clearTimeout();\n await res.status(200).send();\n\n resolve();\n } catch (error) {\n\n req.clearTimeout();\n reject(error);\n }\n });\n\n } catch (error) {\n\n let wrappedError;\n\n switch (true) {\n case error instanceof A_HttpServerError:\n wrappedError = error;\n break;\n\n case error instanceof A_Error && error.originalError instanceof A_HttpServerError:\n wrappedError = error.originalError;\n break;\n\n default:\n wrappedError = new A_HttpServerError({\n status: 500,\n description: 'An error occurred while processing the request.',\n originalError: error\n })\n break;\n }\n\n\n scope.register(wrappedError);\n\n await res.fail(wrappedError);\n\n await this.call(A_ServiceFeatures.onError, scope);\n }\n\n scope.destroy();\n }\n\n}\n\n\n\n\n\n\n\n\n"]}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { __decorateClass, __decorateParam } from '../../chunk-EQQGB2QZ.mjs';
|
|
2
|
+
import { A_HttpServerFeatures } from './A-HttpServer.constants';
|
|
3
|
+
import { A_Request } from '@adaas/a-server/request/A-Request.entity';
|
|
4
|
+
import { A_Response } from '@adaas/a-server/response/A-Response.entity';
|
|
5
|
+
import { A_Feature, A_IdentityHelper, A_Scope, A_Error, A_Dependency, A_Inject } from '@adaas/a-concept';
|
|
6
|
+
import { A_ServerRoute } from '@adaas/a-server/route/A-ServerRoute.entity';
|
|
7
|
+
import { A_HttpServerError } from './A-HttpServer.error';
|
|
8
|
+
import { A_RequestFeatures } from '@adaas/a-server/request/A-Request.constants';
|
|
9
|
+
import { A_HttpServerRequestContext } from '@adaas/a-server/request/A-HttpServerRequest.context';
|
|
10
|
+
import { A_ServerLogger } from '@adaas/a-server/logger/A-ServerLogger.component';
|
|
11
|
+
import { A_Service, A_ServiceFeatures } from '@adaas/a-utils/a-service';
|
|
12
|
+
import { A_Polyfill } from '@adaas/a-utils/a-polyfill';
|
|
13
|
+
import { A_Config } from '@adaas/a-utils/a-config';
|
|
14
|
+
|
|
15
|
+
var _a, _b, _c, _d, _e;
|
|
16
|
+
class A_HttpServer extends A_Service {
|
|
17
|
+
static get onBeforeRequest() {
|
|
18
|
+
return (target, propertyKey, descriptor) => {
|
|
19
|
+
return A_Feature.Extend({
|
|
20
|
+
name: A_HttpServerFeatures.onBeforeRequest,
|
|
21
|
+
scope: [target.constructor]
|
|
22
|
+
})(target, propertyKey, descriptor);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
static get onRequest() {
|
|
26
|
+
return (target, propertyKey, descriptor) => {
|
|
27
|
+
return A_Feature.Extend({
|
|
28
|
+
name: A_HttpServerFeatures.onRequest,
|
|
29
|
+
scope: [target.constructor]
|
|
30
|
+
})(target, propertyKey, descriptor);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
static get onAfterRequest() {
|
|
34
|
+
return (target, propertyKey, descriptor) => {
|
|
35
|
+
return A_Feature.Extend({
|
|
36
|
+
name: A_HttpServerFeatures.onAfterRequest,
|
|
37
|
+
scope: [target.constructor]
|
|
38
|
+
})(target, propertyKey, descriptor);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async [_e = A_ServiceFeatures.onStart](polyfill, config) {
|
|
42
|
+
const http = await polyfill.http();
|
|
43
|
+
this.server = http.createServer(this.handleRequest.bind(this));
|
|
44
|
+
await this.listen(config.get("A_SERVER_PORT"));
|
|
45
|
+
}
|
|
46
|
+
async [_d = A_ServiceFeatures.onAfterStart](config, logger) {
|
|
47
|
+
logger.serverReady({
|
|
48
|
+
port: config.get("A_SERVER_PORT"),
|
|
49
|
+
app: {
|
|
50
|
+
name: this.scope.name
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async [A_ServiceFeatures.onStop](...args) {
|
|
55
|
+
await this.close();
|
|
56
|
+
}
|
|
57
|
+
close() {
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
this.server.close(() => {
|
|
60
|
+
resolve();
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
listen(port) {
|
|
65
|
+
return new Promise((resolve, reject) => {
|
|
66
|
+
this.server.listen(port, () => {
|
|
67
|
+
resolve();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async [_c = A_HttpServerFeatures.onBeforeRequest](...args) {
|
|
72
|
+
}
|
|
73
|
+
async [_b = A_HttpServerFeatures.onRequest](...args) {
|
|
74
|
+
}
|
|
75
|
+
async [_a = A_HttpServerFeatures.onAfterRequest](...args) {
|
|
76
|
+
}
|
|
77
|
+
// ======================================================================================
|
|
78
|
+
// ============================= A_HttpServer Methods =================================
|
|
79
|
+
// ======================================================================================
|
|
80
|
+
async handleRequest(request, response) {
|
|
81
|
+
const route = new A_ServerRoute(
|
|
82
|
+
request.url || "",
|
|
83
|
+
request.method
|
|
84
|
+
);
|
|
85
|
+
const id = A_IdentityHelper.generateTimeId();
|
|
86
|
+
const shard = `${request.method}-${route.path.replace("/", "-")}`;
|
|
87
|
+
const req = new A_Request({ id, shard, request, scope: this.scope.name });
|
|
88
|
+
const res = new A_Response({ id, shard, response, scope: this.scope.name });
|
|
89
|
+
const context = new A_HttpServerRequestContext(request, response);
|
|
90
|
+
const scope = new A_Scope({
|
|
91
|
+
name: id,
|
|
92
|
+
entities: [req, res],
|
|
93
|
+
fragments: [route, context]
|
|
94
|
+
}).inherit(this.scope);
|
|
95
|
+
try {
|
|
96
|
+
const onBeforeRequestFeature = new A_Feature({
|
|
97
|
+
name: A_HttpServerFeatures.onBeforeRequest,
|
|
98
|
+
component: this
|
|
99
|
+
});
|
|
100
|
+
const onRequestFeature = new A_Feature({
|
|
101
|
+
name: A_HttpServerFeatures.onRequest,
|
|
102
|
+
component: this
|
|
103
|
+
});
|
|
104
|
+
const onAfterRequestFeature = new A_Feature({
|
|
105
|
+
name: A_HttpServerFeatures.onAfterRequest,
|
|
106
|
+
component: this
|
|
107
|
+
});
|
|
108
|
+
await new Promise(async (resolve, reject) => {
|
|
109
|
+
const cleanup = () => {
|
|
110
|
+
onBeforeRequestFeature.interrupt();
|
|
111
|
+
onRequestFeature.interrupt();
|
|
112
|
+
onAfterRequestFeature.interrupt();
|
|
113
|
+
req.off(A_RequestFeatures.onError, cleanup);
|
|
114
|
+
req.off(A_RequestFeatures.onClose, cleanup);
|
|
115
|
+
req.off(A_RequestFeatures.onTimeout, cleanup);
|
|
116
|
+
reject(scope.resolve(A_Error));
|
|
117
|
+
};
|
|
118
|
+
req.on(A_RequestFeatures.onError, cleanup.bind(this));
|
|
119
|
+
req.on(A_RequestFeatures.onClose, cleanup.bind(this));
|
|
120
|
+
try {
|
|
121
|
+
await req.load();
|
|
122
|
+
await res.load();
|
|
123
|
+
await onBeforeRequestFeature.process(scope);
|
|
124
|
+
await onRequestFeature.process(scope);
|
|
125
|
+
await onAfterRequestFeature.process(scope);
|
|
126
|
+
req.clearTimeout();
|
|
127
|
+
await res.status(200).send();
|
|
128
|
+
resolve();
|
|
129
|
+
} catch (error) {
|
|
130
|
+
req.clearTimeout();
|
|
131
|
+
reject(error);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
} catch (error) {
|
|
135
|
+
let wrappedError;
|
|
136
|
+
switch (true) {
|
|
137
|
+
case error instanceof A_HttpServerError:
|
|
138
|
+
wrappedError = error;
|
|
139
|
+
break;
|
|
140
|
+
case (error instanceof A_Error && error.originalError instanceof A_HttpServerError):
|
|
141
|
+
wrappedError = error.originalError;
|
|
142
|
+
break;
|
|
143
|
+
default:
|
|
144
|
+
wrappedError = new A_HttpServerError({
|
|
145
|
+
status: 500,
|
|
146
|
+
description: "An error occurred while processing the request.",
|
|
147
|
+
originalError: error
|
|
148
|
+
});
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
scope.register(wrappedError);
|
|
152
|
+
await res.fail(wrappedError);
|
|
153
|
+
await this.call(A_ServiceFeatures.onError, scope);
|
|
154
|
+
}
|
|
155
|
+
scope.destroy();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
__decorateClass([
|
|
159
|
+
A_Feature.Extend(),
|
|
160
|
+
__decorateParam(0, A_Dependency.Required()),
|
|
161
|
+
__decorateParam(0, A_Inject(A_Polyfill)),
|
|
162
|
+
__decorateParam(1, A_Dependency.Required()),
|
|
163
|
+
__decorateParam(1, A_Inject(A_Config))
|
|
164
|
+
], A_HttpServer.prototype, _e, 1);
|
|
165
|
+
__decorateClass([
|
|
166
|
+
A_Feature.Extend(),
|
|
167
|
+
__decorateParam(0, A_Inject(A_Config)),
|
|
168
|
+
__decorateParam(1, A_Inject(A_ServerLogger))
|
|
169
|
+
], A_HttpServer.prototype, _d, 1);
|
|
170
|
+
__decorateClass([
|
|
171
|
+
A_Feature.Extend()
|
|
172
|
+
], A_HttpServer.prototype, _c, 1);
|
|
173
|
+
__decorateClass([
|
|
174
|
+
A_Feature.Extend()
|
|
175
|
+
], A_HttpServer.prototype, _b, 1);
|
|
176
|
+
__decorateClass([
|
|
177
|
+
A_Feature.Extend()
|
|
178
|
+
], A_HttpServer.prototype, _a, 1);
|
|
179
|
+
|
|
180
|
+
export { A_HttpServer };
|
|
181
|
+
//# sourceMappingURL=A-HttpServer.container.mjs.map
|
|
182
|
+
//# sourceMappingURL=A-HttpServer.container.mjs.map
|