@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,121 @@
|
|
|
1
|
+
import { A_Error, A_Feature, A_Inject, } from "@adaas/a-concept";
|
|
2
|
+
import { A_Server } from "@adaas/a-server/server/A-Server.context";
|
|
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_ResponseFeatures } from "@adaas/a-server/response/A-Response.constants";
|
|
6
|
+
import { A_HttpServerRequestContext } from "@adaas/a-server/request/A-HttpServerRequest.context";
|
|
7
|
+
import { A_Config } from "@adaas/a-utils/a-config";
|
|
8
|
+
import { A_Logger } from "@adaas/a-utils/a-logger";
|
|
9
|
+
import { A_Service, A_ServiceFeatures } from "@adaas/a-utils/a-service";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export class A_ServerLogger extends A_Logger {
|
|
13
|
+
|
|
14
|
+
protected declare config: A_Config<any>
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@A_Feature.Extend({
|
|
19
|
+
name: A_ResponseFeatures.onSend,
|
|
20
|
+
scope: [A_Response]
|
|
21
|
+
})
|
|
22
|
+
logRequestFinish(
|
|
23
|
+
@A_Inject(A_Request) request: A_Request,
|
|
24
|
+
@A_Inject(A_Response) response: A_Response,
|
|
25
|
+
@A_Inject(A_HttpServerRequestContext) context: A_HttpServerRequestContext,
|
|
26
|
+
) {
|
|
27
|
+
|
|
28
|
+
this.info('green', `Request ${request.method} ${request.url} finished with status ${response.statusCode} in ${context.processingTime ?? 'N/A'}ms`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@A_Feature.Extend({
|
|
33
|
+
name: A_ResponseFeatures.onError,
|
|
34
|
+
scope: [A_Response]
|
|
35
|
+
})
|
|
36
|
+
logResponseError(
|
|
37
|
+
@A_Inject(A_Request) request: A_Request,
|
|
38
|
+
@A_Inject(A_Response) response: A_Response,
|
|
39
|
+
@A_Inject(A_HttpServerRequestContext) context: A_HttpServerRequestContext,
|
|
40
|
+
@A_Inject(A_Error) error: A_Error,
|
|
41
|
+
) {
|
|
42
|
+
this.info('red', `Request ${request.method} ${request.url} errored with status ${response.statusCode} in ${context.processingTime ?? 'N/A'}ms`);
|
|
43
|
+
this.error(error);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// @A_Feature.Extend({
|
|
50
|
+
// name: A_ServiceFeatures.onAfterStart,
|
|
51
|
+
// scope: [A_Service]
|
|
52
|
+
// })
|
|
53
|
+
// logStart(
|
|
54
|
+
// @A_Inject(A_Service) container: A_Service,
|
|
55
|
+
// ): void {
|
|
56
|
+
// // this.serverReady({
|
|
57
|
+
// // port: container.port,
|
|
58
|
+
// // app: {
|
|
59
|
+
// // name: container.name,
|
|
60
|
+
// // }
|
|
61
|
+
// // })
|
|
62
|
+
// }
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@A_Feature.Extend({
|
|
68
|
+
name: A_ServiceFeatures.onAfterStop,
|
|
69
|
+
scope: [A_Service]
|
|
70
|
+
})
|
|
71
|
+
logStop(
|
|
72
|
+
@A_Inject(A_Server) server: A_Server,
|
|
73
|
+
) {
|
|
74
|
+
this.log('red', `Server ${server.name} stopped`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
serverReady(
|
|
81
|
+
params: {
|
|
82
|
+
port: number,
|
|
83
|
+
|
|
84
|
+
app: {
|
|
85
|
+
name: string,
|
|
86
|
+
version?: string
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
) {
|
|
90
|
+
const processId = process.pid;
|
|
91
|
+
|
|
92
|
+
this.info('cyan',
|
|
93
|
+
` ${params.app.name} v${params.app.version || '0.0.1'} is running on port ${params.port}`,
|
|
94
|
+
` Process ID: ${processId}`,
|
|
95
|
+
` Open In Browser: http://localhost:${params.port}`,
|
|
96
|
+
``,
|
|
97
|
+
`-------------------------------`,
|
|
98
|
+
` ==============================`,
|
|
99
|
+
` LISTENING... `,
|
|
100
|
+
` ==============================`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Displays a proxy routes
|
|
107
|
+
*
|
|
108
|
+
* @param params
|
|
109
|
+
*/
|
|
110
|
+
proxy(
|
|
111
|
+
params: {
|
|
112
|
+
original: string,
|
|
113
|
+
destination: string,
|
|
114
|
+
}
|
|
115
|
+
) {
|
|
116
|
+
console.log(`\x1b[35m[${this.scope.name}] |${this.getTime()}| Proxy:
|
|
117
|
+
${' '.repeat(this.scopeLength + 3)}| ${params.original} -> ${params.destination}
|
|
118
|
+
${' '.repeat(this.scopeLength + 3)}|-------------------------------\x1b[0m`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { A_TYPES__ConceptENVVariables } from "@adaas/a-concept";
|
|
2
|
+
import { A_SERVER__A_SERVER_LOGGER_ENV_VARIABLES } from "./A-ServerLogger.constants";
|
|
3
|
+
|
|
4
|
+
export type A_SERVER_TYPES__ServerLoggerRouteParams = {
|
|
5
|
+
method: string,
|
|
6
|
+
url: string,
|
|
7
|
+
status: number,
|
|
8
|
+
responseTime: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export type A_SERVER_TYPES__ServerLoggerEnvVariables = Array<keyof typeof A_SERVER__A_SERVER_LOGGER_ENV_VARIABLES>
|
|
13
|
+
| A_TYPES__ConceptENVVariables
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { A_Component } from "@adaas/a-concept";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export class A_ServerMiddleware extends A_Component {
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// static get features() {
|
|
9
|
+
// // return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {
|
|
10
|
+
// // return A_Feature.Extend({
|
|
11
|
+
// // name: A_ServerMiddlewareFeatures.onBeforeInit,
|
|
12
|
+
// // scope: [target.constructor],
|
|
13
|
+
// // })(target, propertyKey, descriptor);
|
|
14
|
+
// // }
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { A_Component, A_Concept, A_Feature, A_Inject } from "@adaas/a-concept";
|
|
2
|
-
import {
|
|
3
|
-
import { A_ProxyConfig } from "
|
|
4
|
-
import { A_Request } from "@adaas/a-server/
|
|
5
|
-
import { A_Response } from "@adaas/a-server/
|
|
6
|
-
import {
|
|
7
|
-
import { A_Logger,
|
|
2
|
+
import { A_HttpServerFeatures } from "@adaas/a-server/server/A-HttpServer.constants";
|
|
3
|
+
import { A_ProxyConfig } from "./A-ServerProxy.context";
|
|
4
|
+
import { A_Request } from "@adaas/a-server/request/A-Request.entity";
|
|
5
|
+
import { A_Response } from "@adaas/a-server/response/A-Response.entity";
|
|
6
|
+
import { A_ServerRoute } from "@adaas/a-server/route/A-ServerRoute.entity";
|
|
7
|
+
import { A_Logger, A_LOGGER_COLORS } from "@adaas/a-utils/a-logger";
|
|
8
|
+
import { A_Polyfill } from "@adaas/a-utils/a-polyfill";
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
export class A_ServerProxy extends A_Component {
|
|
@@ -15,29 +16,31 @@ export class A_ServerProxy extends A_Component {
|
|
|
15
16
|
@A_Inject(A_Logger) logger: A_Logger,
|
|
16
17
|
@A_Inject(A_ProxyConfig) config: A_ProxyConfig
|
|
17
18
|
) {
|
|
18
|
-
logger.
|
|
19
|
-
'
|
|
19
|
+
logger.info(
|
|
20
|
+
'green',
|
|
20
21
|
`Proxy routes configured:`,
|
|
21
|
-
config.configs.map(c => c.route
|
|
22
|
+
...config.configs.map(c => `${c.route.toString()} -> ${c.protocol}//${c.hostname}:${c.port}`)
|
|
22
23
|
);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
@A_Feature.Extend({
|
|
28
|
-
name:
|
|
29
|
+
name: A_HttpServerFeatures.onRequest,
|
|
30
|
+
before:/.*/
|
|
29
31
|
})
|
|
30
32
|
async onRequest(
|
|
31
33
|
@A_Inject(A_Request) req: A_Request,
|
|
32
34
|
@A_Inject(A_Response) res: A_Response,
|
|
33
35
|
@A_Inject(A_ProxyConfig) proxyConfig: A_ProxyConfig,
|
|
34
36
|
@A_Inject(A_Logger) logger: A_Logger,
|
|
35
|
-
@A_Inject(A_Polyfill) polyfill: A_Polyfill
|
|
37
|
+
@A_Inject(A_Polyfill) polyfill: A_Polyfill,
|
|
38
|
+
@A_Inject(A_Feature) feature: A_Feature
|
|
36
39
|
) {
|
|
37
40
|
return new Promise<void>(async (resolve, reject) => {
|
|
38
41
|
const { method, url } = req;
|
|
39
42
|
|
|
40
|
-
const route = new
|
|
43
|
+
const route = new A_ServerRoute(url, method);
|
|
41
44
|
const config = proxyConfig.config(route.toString());
|
|
42
45
|
|
|
43
46
|
if (!config) {
|
|
@@ -80,6 +83,8 @@ export class A_ServerProxy extends A_Component {
|
|
|
80
83
|
proxyReq.on("error", (err) => reject(err));
|
|
81
84
|
|
|
82
85
|
req.pipe(proxyReq);
|
|
86
|
+
|
|
87
|
+
feature.interrupt();
|
|
83
88
|
});
|
|
84
89
|
}
|
|
85
90
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A_SERVER_TYPES__ProxyConfigConstructorConfig } from "./
|
|
1
|
+
import { A_SERVER_TYPES__ProxyConfigConstructorConfig } from "./A-ServerProxy.types";
|
|
2
2
|
|
|
3
3
|
export const PROXY_CONFIG_DEFAULTS: A_SERVER_TYPES__ProxyConfigConstructorConfig = {
|
|
4
4
|
path: '/',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { A_Fragment } from "@adaas/a-concept";
|
|
2
|
-
import { A_SERVER_TYPES__ProxyConfigConstructor, A_SERVER_TYPES__ProxyConfigConstructorConfig, A_SERVER_TYPES__RoutesConfig } from "./
|
|
3
|
-
import { PROXY_CONFIG_DEFAULTS } from "./
|
|
4
|
-
import {
|
|
2
|
+
import { A_SERVER_TYPES__ProxyConfigConstructor, A_SERVER_TYPES__ProxyConfigConstructorConfig, A_SERVER_TYPES__RoutesConfig } from "./A-ServerProxy.types";
|
|
3
|
+
import { PROXY_CONFIG_DEFAULTS } from "./A-ServerProxy.constants";
|
|
4
|
+
import { A_ServerRoute } from "@adaas/a-server/route/A-ServerRoute.entity";
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -37,7 +37,7 @@ export class A_ProxyConfig extends A_Fragment {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
return {
|
|
40
|
-
route: new
|
|
40
|
+
route: new A_ServerRoute(prepared.path, prepared.method),
|
|
41
41
|
hostname: prepared.hostname,
|
|
42
42
|
port: prepared.port,
|
|
43
43
|
headers: prepared.headers,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { A_ServerRoute } from "@adaas/a-server/route/A-ServerRoute.entity";
|
|
2
|
+
import { A_ServerRouteHttpMethodNames } from "@adaas/a-server/route/A-ServerRoute.types"
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
@@ -13,13 +13,13 @@ export type A_SERVER_TYPES__ProxyConfigConstructorConfig = {
|
|
|
13
13
|
protocol: 'http' | 'https' | string,
|
|
14
14
|
port: number,
|
|
15
15
|
path: string,
|
|
16
|
-
method:
|
|
16
|
+
method: A_ServerRouteHttpMethodNames,
|
|
17
17
|
headers: Record<string, string>
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
export type A_SERVER_TYPES__RoutesConfig = {
|
|
22
|
-
route:
|
|
22
|
+
route: A_ServerRoute,
|
|
23
23
|
protocol: 'http' | 'https' | string,
|
|
24
24
|
hostname: string,
|
|
25
25
|
port: number,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const A_ServerRouteHttpMethods = {
|
|
2
|
+
DEFAULT: 'DEFAULT',
|
|
3
|
+
GET: 'GET',
|
|
4
|
+
POST: 'POST',
|
|
5
|
+
PUT: 'PUT',
|
|
6
|
+
DELETE: 'DELETE',
|
|
7
|
+
PATCH: 'PATCH',
|
|
8
|
+
OPTIONS: 'OPTIONS',
|
|
9
|
+
HEAD: 'HEAD',
|
|
10
|
+
CONNECT: 'CONNECT',
|
|
11
|
+
TRACE: 'TRACE',
|
|
12
|
+
} as const
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export const A_ServerRouteProtocols = {
|
|
16
|
+
HTTP: 'http',
|
|
17
|
+
HTTPS: 'https',
|
|
18
|
+
WS: 'ws',
|
|
19
|
+
WSS: 'wss',
|
|
20
|
+
} as const
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { A_Route } from '@adaas/a-utils/a-route';
|
|
2
|
+
import { A_ServerRouteHttpMethodNames } from './A-ServerRoute.types';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class A_ServerRoute extends A_Route {
|
|
7
|
+
|
|
8
|
+
public url!: string;
|
|
9
|
+
public method!: A_ServerRouteHttpMethodNames;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
constructor(
|
|
13
|
+
url: string | RegExp,
|
|
14
|
+
method: A_ServerRouteHttpMethodNames
|
|
15
|
+
)
|
|
16
|
+
constructor(
|
|
17
|
+
url: string | RegExp,
|
|
18
|
+
)
|
|
19
|
+
constructor(
|
|
20
|
+
param1: string | RegExp,
|
|
21
|
+
param2?: A_ServerRouteHttpMethodNames
|
|
22
|
+
) {
|
|
23
|
+
super(param1);
|
|
24
|
+
this.url = param1 instanceof RegExp ? param1.source : param1;
|
|
25
|
+
this.method = param2 || 'GET';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
toString(): string {
|
|
30
|
+
// path can be like /api/v1/users/:id
|
|
31
|
+
// and because of that :id we need to replace it with regex that matches chars and numbers only
|
|
32
|
+
return `${this.method}::${this.path}`;
|
|
33
|
+
|
|
34
|
+
// .replace(/\/:([^\/]+)/g, '\\/([^\/]+)')
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
toRegExp(): RegExp {
|
|
38
|
+
return new RegExp(`^${this.method}::${this.path.replace(/\/:([^\/]+)/g, '/([^/]+)')}$`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
toAFeatureExtension(extensionScope: Array<string> = []): RegExp {
|
|
42
|
+
return new RegExp(`^${extensionScope.length
|
|
43
|
+
? `(${extensionScope.join('|')})`
|
|
44
|
+
: '.*'
|
|
45
|
+
}\\.${this.method}::${this.path.replace(/\/:([^\/]+)/g, '/([^/]+)')}$`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { A_ServerRouteHttpMethods, A_ServerRouteProtocols } from "./A-ServerRoute.constants";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export type A_serverRouteProtocolNames = typeof A_ServerRouteProtocols[keyof typeof A_ServerRouteProtocols];
|
|
5
|
+
|
|
6
|
+
export type A_ServerRouteHttpMethodNames = typeof A_ServerRouteHttpMethods[keyof typeof A_ServerRouteHttpMethods]
|
|
@@ -3,33 +3,30 @@ import {
|
|
|
3
3
|
A_Concept,
|
|
4
4
|
A_Context,
|
|
5
5
|
A_Feature,
|
|
6
|
-
A_Feature_Define,
|
|
7
|
-
A_Feature_Extend,
|
|
8
|
-
A_IdentityHelper,
|
|
9
6
|
A_Inject,
|
|
10
7
|
A_Meta,
|
|
11
8
|
A_Scope,
|
|
12
|
-
A_TypeGuards
|
|
9
|
+
A_TypeGuards,
|
|
10
|
+
A_TYPES__Required
|
|
13
11
|
} from "@adaas/a-concept";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from "
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { A_TYPES__Required } from "@adaas/a-concept/dist/src/types/A_Common.types";
|
|
28
|
-
import { A_Config, A_Logger } from "@adaas/a-utils";
|
|
12
|
+
import { A_Request } from "@adaas/a-server/request/A-Request.entity";
|
|
13
|
+
import { A_ServerLogger } from "../A-ServerLogger/A-ServerLogger.component";
|
|
14
|
+
import { A_HttpServerFeatures } from "@adaas/a-server/server/A-HttpServer.constants";
|
|
15
|
+
import { A_HttpServerError } from "@adaas/a-server/server/A-HttpServer.error";
|
|
16
|
+
import { A_Config } from "@adaas/a-utils/a-config";
|
|
17
|
+
import { A_Logger } from "@adaas/a-utils/a-logger";
|
|
18
|
+
import { A_Response } from "@adaas/a-server/response/A-Response.entity";
|
|
19
|
+
import { A_ServerRoute } from "@adaas/a-server/route/A-ServerRoute.entity";
|
|
20
|
+
import { A_ServerRouteHttpMethodNames } from "@adaas/a-server/route/A-ServerRoute.types";
|
|
21
|
+
import { A_ServerRouteHttpMethods } from "@adaas/a-server/route/A-ServerRoute.constants";
|
|
22
|
+
import { A_ServerRouterMeta } from "./A-ServerRouter.meta";
|
|
23
|
+
import { A_ServerRouterDefineDecorator } from "./A-ServerRouterDefine.decorator";
|
|
24
|
+
import { A_ServerRouterRouteConfig } from "./A-ServerRouter.types";
|
|
29
25
|
|
|
30
26
|
|
|
31
27
|
|
|
32
|
-
|
|
28
|
+
@A_Meta.Define(A_ServerRouterMeta)
|
|
29
|
+
export class A_ServerRouter extends A_Component {
|
|
33
30
|
|
|
34
31
|
// =======================================================
|
|
35
32
|
// ================ Method Definition=====================
|
|
@@ -41,11 +38,9 @@ export class A_Router extends A_Component {
|
|
|
41
38
|
* @param path
|
|
42
39
|
* @returns
|
|
43
40
|
*/
|
|
44
|
-
static Post(path: string |
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
static Post(path: string | A_ServerRoute | RegExp | A_TYPES__Required<Partial<A_ServerRouterRouteConfig>, ['path']>) {
|
|
47
42
|
return this.defineRoute({
|
|
48
|
-
method:
|
|
43
|
+
method: A_ServerRouteHttpMethods.POST,
|
|
49
44
|
path: typeof path === 'object' && 'path' in path ? path.path : path,
|
|
50
45
|
version: typeof path === 'object' && 'version' in path && path.version ? path.version : 'v1',
|
|
51
46
|
prefix: typeof path === 'object' && 'prefix' in path && path.prefix ? path.prefix : 'api',
|
|
@@ -58,9 +53,9 @@ export class A_Router extends A_Component {
|
|
|
58
53
|
* @param path
|
|
59
54
|
* @returns
|
|
60
55
|
*/
|
|
61
|
-
static Get(path: string |
|
|
56
|
+
static Get(path: string | A_ServerRoute | RegExp | A_TYPES__Required<Partial<A_ServerRouterRouteConfig>, ['path']>) {
|
|
62
57
|
return this.defineRoute({
|
|
63
|
-
method:
|
|
58
|
+
method: A_ServerRouteHttpMethods.GET,
|
|
64
59
|
path: typeof path === 'object' && 'path' in path ? path.path : path,
|
|
65
60
|
version: typeof path === 'object' && 'version' in path && path.version ? path.version : 'v1',
|
|
66
61
|
prefix: typeof path === 'object' && 'prefix' in path && path.prefix ? path.prefix : 'api',
|
|
@@ -73,9 +68,9 @@ export class A_Router extends A_Component {
|
|
|
73
68
|
* @param path
|
|
74
69
|
* @returns
|
|
75
70
|
*/
|
|
76
|
-
static Put(path: string |
|
|
71
|
+
static Put(path: string | A_ServerRoute | RegExp | A_TYPES__Required<Partial<A_ServerRouterRouteConfig>, ['path']>) {
|
|
77
72
|
return this.defineRoute({
|
|
78
|
-
method:
|
|
73
|
+
method: A_ServerRouteHttpMethods.PUT,
|
|
79
74
|
path: typeof path === 'object' && 'path' in path ? path.path : path,
|
|
80
75
|
version: typeof path === 'object' && 'version' in path && path.version ? path.version : 'v1',
|
|
81
76
|
prefix: typeof path === 'object' && 'prefix' in path && path.prefix ? path.prefix : 'api',
|
|
@@ -88,9 +83,9 @@ export class A_Router extends A_Component {
|
|
|
88
83
|
* @param path
|
|
89
84
|
* @returns
|
|
90
85
|
*/
|
|
91
|
-
static Delete(path: string |
|
|
86
|
+
static Delete(path: string | A_ServerRoute | RegExp | A_TYPES__Required<Partial<A_ServerRouterRouteConfig>, ['path']>) {
|
|
92
87
|
return this.defineRoute({
|
|
93
|
-
method:
|
|
88
|
+
method: A_ServerRouteHttpMethods.DELETE,
|
|
94
89
|
path: typeof path === 'object' && 'path' in path ? path.path : path,
|
|
95
90
|
version: typeof path === 'object' && 'version' in path && path.version ? path.version : 'v1',
|
|
96
91
|
prefix: typeof path === 'object' && 'prefix' in path && path.prefix ? path.prefix : 'api',
|
|
@@ -103,9 +98,9 @@ export class A_Router extends A_Component {
|
|
|
103
98
|
* @param path
|
|
104
99
|
* @returns
|
|
105
100
|
*/
|
|
106
|
-
static Patch(path: string |
|
|
101
|
+
static Patch(path: string | A_ServerRoute | RegExp | A_TYPES__Required<Partial<A_ServerRouterRouteConfig>, ['path']>) {
|
|
107
102
|
return this.defineRoute({
|
|
108
|
-
method:
|
|
103
|
+
method: A_ServerRouteHttpMethods.PATCH,
|
|
109
104
|
path: typeof path === 'object' && 'path' in path ? path.path : path,
|
|
110
105
|
version: typeof path === 'object' && 'version' in path && path.version ? path.version : 'v1',
|
|
111
106
|
prefix: typeof path === 'object' && 'prefix' in path && path.prefix ? path.prefix : 'api',
|
|
@@ -118,9 +113,9 @@ export class A_Router extends A_Component {
|
|
|
118
113
|
* @param path
|
|
119
114
|
* @returns
|
|
120
115
|
*/
|
|
121
|
-
static Default(path: string |
|
|
116
|
+
static Default(path: string | A_ServerRoute | RegExp | A_TYPES__Required<Partial<A_ServerRouterRouteConfig>, ['path']>) {
|
|
122
117
|
return this.defineRoute({
|
|
123
|
-
method:
|
|
118
|
+
method: A_ServerRouteHttpMethods.DEFAULT,
|
|
124
119
|
path: typeof path === 'object' && 'path' in path ? path.path : path,
|
|
125
120
|
version: typeof path === 'object' && 'version' in path && path.version ? path.version : 'v1',
|
|
126
121
|
prefix: typeof path === 'object' && 'prefix' in path && path.prefix ? path.prefix : 'api',
|
|
@@ -128,7 +123,7 @@ export class A_Router extends A_Component {
|
|
|
128
123
|
}
|
|
129
124
|
|
|
130
125
|
|
|
131
|
-
static routes: Array<
|
|
126
|
+
// static routes: Array<A_ServerRoute> = [];
|
|
132
127
|
|
|
133
128
|
/**
|
|
134
129
|
* Private method to have the same signature for all route methods
|
|
@@ -138,43 +133,15 @@ export class A_Router extends A_Component {
|
|
|
138
133
|
* @returns
|
|
139
134
|
*/
|
|
140
135
|
private static defineRoute(
|
|
141
|
-
config:
|
|
136
|
+
config: A_ServerRouterRouteConfig & { method: A_ServerRouteHttpMethodNames }
|
|
142
137
|
) {
|
|
143
138
|
const route = typeof config.path === 'string' || config.path instanceof RegExp
|
|
144
|
-
? new
|
|
139
|
+
? new A_ServerRoute(
|
|
145
140
|
`/${config.prefix}/${config.version}${config.path instanceof RegExp ? config.path.source : config.path.startsWith('/') ? config.path : `/${config.path}`}`,
|
|
146
141
|
config.method)
|
|
147
142
|
: config.path;
|
|
148
143
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return function decorator(
|
|
152
|
-
target: A_Component,
|
|
153
|
-
propertyKey: string,
|
|
154
|
-
descriptor: PropertyDescriptor
|
|
155
|
-
) {
|
|
156
|
-
|
|
157
|
-
const meta: A_Meta<A_TYPES__ARouterComponentMeta> = A_Context.meta<A_TYPES__ARouterComponentMeta>(target as any);
|
|
158
|
-
|
|
159
|
-
const routes = meta.get(A_SERVER_TYPES__ARouterComponentMetaKey.ROUTES) || new Map<string, A_TYPES__ARouterDefineRoute>();
|
|
160
|
-
|
|
161
|
-
const searchKey = route.toAFeatureExtension(['A_Router', 'A_Service']);
|
|
162
|
-
|
|
163
|
-
routes.set(searchKey.source, {
|
|
164
|
-
component: target,
|
|
165
|
-
handler: propertyKey,
|
|
166
|
-
route
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
meta.set(A_SERVER_TYPES__ARouterComponentMetaKey.ROUTES, routes);
|
|
170
|
-
|
|
171
|
-
A_Feature_Define({
|
|
172
|
-
name: searchKey.source,
|
|
173
|
-
invoke: false
|
|
174
|
-
})(target, propertyKey, descriptor)
|
|
175
|
-
|
|
176
|
-
return A_Feature_Extend(searchKey)(target, propertyKey, descriptor);
|
|
177
|
-
}
|
|
144
|
+
return A_ServerRouterDefineDecorator(route);
|
|
178
145
|
}
|
|
179
146
|
|
|
180
147
|
|
|
@@ -186,7 +153,23 @@ export class A_Router extends A_Component {
|
|
|
186
153
|
protected async load(
|
|
187
154
|
@A_Inject(A_ServerLogger) logger: A_ServerLogger
|
|
188
155
|
): Promise<void> {
|
|
189
|
-
|
|
156
|
+
const meta = A_Context.meta<A_ServerRouterMeta>(this.constructor as any);
|
|
157
|
+
|
|
158
|
+
const routes = meta.routes;
|
|
159
|
+
|
|
160
|
+
if (!routes || !routes.length) {
|
|
161
|
+
logger.warning('yellow', `No routes defined for ${this.constructor.name}`);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
logger.info('cyan',
|
|
167
|
+
`Registered Routes:`,
|
|
168
|
+
`------------------------------------\n`,
|
|
169
|
+
...routes
|
|
170
|
+
.map(route => `[${route.method.toUpperCase()}]${' '.repeat(7 - route.method.length)} ${route.path}`)
|
|
171
|
+
|
|
172
|
+
);
|
|
190
173
|
}
|
|
191
174
|
|
|
192
175
|
|
|
@@ -198,25 +181,20 @@ export class A_Router extends A_Component {
|
|
|
198
181
|
// invoke: false
|
|
199
182
|
// })
|
|
200
183
|
@A_Feature.Extend({
|
|
201
|
-
name:
|
|
202
|
-
scope: [A_Service],
|
|
184
|
+
name: A_HttpServerFeatures.onRequest,
|
|
203
185
|
})
|
|
204
186
|
async identifyRoute(
|
|
205
187
|
@A_Inject(A_Request) request: A_Request,
|
|
206
188
|
@A_Inject(A_Response) response: A_Response,
|
|
207
189
|
@A_Inject(A_Scope) scope: A_Scope,
|
|
208
190
|
@A_Inject(A_Config) config: A_Config,
|
|
209
|
-
@A_Inject(A_Logger) logger: A_Logger
|
|
191
|
+
@A_Inject(A_Logger) logger: A_Logger,
|
|
192
|
+
@A_Inject(A_ServerRoute) route: A_ServerRoute,
|
|
210
193
|
) {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (config.get('A_CONCEPT_ENVIRONMENT') === 'development') {
|
|
215
|
-
logger.log(`Incoming request: ${request.method} ${request.url}`);
|
|
216
|
-
logger.log(`Identified route: ${route.toString()}`);
|
|
194
|
+
if (route.method === 'OPTIONS') {
|
|
195
|
+
// Ignore OPTIONS requests
|
|
196
|
+
return;
|
|
217
197
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
198
|
/**
|
|
221
199
|
* just execute all listeners on the Route
|
|
222
200
|
* url example: /api/v1/users/123
|
|
@@ -226,34 +204,38 @@ export class A_Router extends A_Component {
|
|
|
226
204
|
* And it will return all stages that are similar to the feature name
|
|
227
205
|
*/
|
|
228
206
|
|
|
229
|
-
const feature = new A_Feature({
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
207
|
+
const feature = new A_Feature({ name: route.toString(), component: this, })
|
|
208
|
+
|
|
209
|
+
if (!feature.size)
|
|
210
|
+
throw new A_HttpServerError({
|
|
211
|
+
status: 404,
|
|
212
|
+
title: 'Route Not Found',
|
|
213
|
+
description: `No route found for ${request.method} ${request.url}`,
|
|
214
|
+
})
|
|
233
215
|
|
|
234
216
|
|
|
235
217
|
for (const stage of feature) {
|
|
236
|
-
if (A_TypeGuards.isComponentConstructor(stage.definition.component)) {
|
|
237
218
|
|
|
238
|
-
|
|
219
|
+
const targetConstructor = stage.definition.dependency.target;
|
|
220
|
+
|
|
221
|
+
if (A_TypeGuards.isComponentConstructor(targetConstructor)) {
|
|
222
|
+
|
|
223
|
+
const meta: A_ServerRouterMeta = A_Context.meta<A_ServerRouterMeta>(this.constructor as any);
|
|
224
|
+
|
|
225
|
+
const routeDefinitions = meta.definitions;
|
|
239
226
|
|
|
240
|
-
const
|
|
227
|
+
const routeDefinition = routeDefinitions?.get(stage.definition.name || '');
|
|
241
228
|
|
|
242
|
-
if (routes) {
|
|
243
|
-
const currentRoute = routes.get(stage.definition.name || '');
|
|
244
229
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
};
|
|
250
|
-
}
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
if (routeDefinition) {
|
|
233
|
+
request.useRoute(routeDefinition.route);
|
|
251
234
|
}
|
|
252
235
|
}
|
|
253
236
|
|
|
254
237
|
const stageScope = new A_Scope({
|
|
255
|
-
name: `a-route--${
|
|
256
|
-
entities: [request],
|
|
238
|
+
name: `a-route--${request.id}--${stage.definition.name}`,
|
|
257
239
|
}, {
|
|
258
240
|
parent: scope
|
|
259
241
|
});
|
|
@@ -262,7 +244,5 @@ export class A_Router extends A_Component {
|
|
|
262
244
|
await stage.process(stageScope);
|
|
263
245
|
}
|
|
264
246
|
|
|
265
|
-
|
|
266
|
-
console.log('Finished processing route for request:', request.method, request.url);
|
|
267
247
|
}
|
|
268
248
|
}
|