@adaas/a-server 0.0.21 → 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 -59
- 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/lib/A-ServerStatic/A-ServerStatic.component.ts +323 -0
- package/src/lib/A-ServerStatic/A-ServerStatic.context.ts +229 -0
- 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 -739
- package/dist/index.d.ts +0 -739
- package/dist/index.js +0 -1904
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -1863
- 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/components/A-StaticLoader/A-StaticLoader.component.ts +0 -133
- package/src/containers/A-Service/A-Service.container.ts +0 -202
- 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/context/A-StaticConfig/A-StaticConfig.context.ts +0 -36
- 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,48 @@
|
|
|
1
|
+
import { A_ComponentMeta } from "@adaas/a-concept";
|
|
2
|
+
import { A_ServerRouterMetaStructure, A_ServerRouterRouteDefinition } from "./A-ServerRouter.types";
|
|
3
|
+
import { A_ServerRoute } from "@adaas/a-server/route/A-ServerRoute.entity";
|
|
4
|
+
import { A_ServerRouterMetaKeys } from "./A-ServerRouter.constants";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export class A_ServerRouterMeta extends A_ComponentMeta<A_ServerRouterMetaStructure> {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
get routes(): Array<A_ServerRoute> {
|
|
12
|
+
return this.meta.get(A_ServerRouterMetaKeys.ROUTES_CONFIGS) as Array<A_ServerRoute> || [];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
get definitions(): Map<string, A_ServerRouterRouteDefinition> {
|
|
17
|
+
return this.meta.get(A_ServerRouterMetaKeys.ROUTES) as Map<string, A_ServerRouterRouteDefinition> || new Map<string, A_ServerRouterRouteDefinition>();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
addRoute(regexp: RegExp, route: A_ServerRouterRouteDefinition) {
|
|
22
|
+
const existingRoutes = this.meta.get(A_ServerRouterMetaKeys.ROUTES) as Map<string, A_ServerRouterRouteDefinition> || new Map<string, A_ServerRouterRouteDefinition>();
|
|
23
|
+
existingRoutes.set(regexp.source, route);
|
|
24
|
+
this.meta.set(A_ServerRouterMetaKeys.ROUTES, existingRoutes);
|
|
25
|
+
|
|
26
|
+
const existingRoutesConfigs = this.meta.get(A_ServerRouterMetaKeys.ROUTES_CONFIGS) as Array<A_ServerRoute> || [];
|
|
27
|
+
existingRoutesConfigs.push(route.route);
|
|
28
|
+
this.meta.set(A_ServerRouterMetaKeys.ROUTES_CONFIGS, existingRoutesConfigs);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
removeRoute(route: A_ServerRoute) {
|
|
33
|
+
const existingRoutes = this.meta.get(A_ServerRouterMetaKeys.ROUTES) as Map<string, A_ServerRouterRouteDefinition> || new Map<string, A_ServerRouterRouteDefinition>();
|
|
34
|
+
existingRoutes.forEach((value, key) => {
|
|
35
|
+
if (value.route === route) {
|
|
36
|
+
existingRoutes.delete(key);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
this.meta.set(A_ServerRouterMetaKeys.ROUTES, existingRoutes);
|
|
40
|
+
|
|
41
|
+
const existingRoutesConfigs = this.meta.get(A_ServerRouterMetaKeys.ROUTES_CONFIGS) as Array<A_ServerRoute> || [];
|
|
42
|
+
const index = existingRoutesConfigs.indexOf(route);
|
|
43
|
+
if (index !== -1) {
|
|
44
|
+
existingRoutesConfigs.splice(index, 1);
|
|
45
|
+
}
|
|
46
|
+
this.meta.set(A_ServerRouterMetaKeys.ROUTES_CONFIGS, existingRoutesConfigs);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { A_Component, A_TYPES__ComponentMeta } from "@adaas/a-concept";
|
|
2
|
+
import { A_ServerRoute } from "@adaas/a-server/route/A-ServerRoute.entity";
|
|
3
|
+
import { A_ServerRouterMetaKeys } from "./A-ServerRouter.constants";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export type A_ServerRouterRouteDefinition = {
|
|
10
|
+
component: A_Component,
|
|
11
|
+
handler: string,
|
|
12
|
+
route: A_ServerRoute
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type A_ServerRouterMetaStructure = {
|
|
16
|
+
[A_ServerRouterMetaKeys.ROUTES]: Map<string, A_ServerRouterRouteDefinition>
|
|
17
|
+
[A_ServerRouterMetaKeys.ROUTES_CONFIGS]: Array<A_ServerRoute>
|
|
18
|
+
} & A_TYPES__ComponentMeta
|
|
19
|
+
|
|
20
|
+
export type A_ServerRouterMetaKeyNames = typeof A_ServerRouterMetaKeys[keyof typeof A_ServerRouterMetaKeys]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export type A_ServerRouterRouteConfig = {
|
|
24
|
+
path: string | RegExp;
|
|
25
|
+
version: string;
|
|
26
|
+
prefix: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { A_Component, A_Context, A_Feature_Define, A_Feature_Extend, A_TYPES__MetaLinkedComponentConstructors } from "@adaas/a-concept";
|
|
2
|
+
import { A_ServerRouterMeta } from "./A-ServerRouter.meta";
|
|
3
|
+
import { A_ServerRoute } from "../A-ServerRoute/A-ServerRoute.entity";
|
|
4
|
+
import { A_ServerRouter } from "./A-ServerRouter.component";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* This decorator should allow to set a default meta type for the class, this helps to avoid
|
|
9
|
+
* the need to create custom meta classes for each class.
|
|
10
|
+
*
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
export function A_ServerRouterDefineDecorator(route: A_ServerRoute) {
|
|
14
|
+
return function <TTarget extends A_TYPES__MetaLinkedComponentConstructors>(
|
|
15
|
+
target: A_Component,
|
|
16
|
+
propertyKey: string,
|
|
17
|
+
descriptor: PropertyDescriptor
|
|
18
|
+
) {
|
|
19
|
+
|
|
20
|
+
const meta: A_ServerRouterMeta = A_Context.meta<A_ServerRouterMeta>(A_ServerRouter);
|
|
21
|
+
|
|
22
|
+
const searchKey = route.toAFeatureExtension(['A_ServerRouter', 'A_Service']);
|
|
23
|
+
|
|
24
|
+
meta.addRoute(searchKey, {
|
|
25
|
+
component: target,
|
|
26
|
+
handler: propertyKey,
|
|
27
|
+
route
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
A_Feature_Define({
|
|
31
|
+
name: searchKey.source,
|
|
32
|
+
invoke: false
|
|
33
|
+
})(target, propertyKey, descriptor)
|
|
34
|
+
|
|
35
|
+
return A_Feature_Extend(searchKey)(target, propertyKey, descriptor);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { A_Component, A_Concept, A_Feature, A_Inject } from "@adaas/a-concept"
|
|
2
|
+
import { A_Request } from "@adaas/a-server/request/A-Request.entity";
|
|
3
|
+
import { A_Response } from "@adaas/a-server/response/A-Response.entity";
|
|
4
|
+
import { A_StaticConfig, A_StaticAlias } from "./A-ServerStatic.context";
|
|
5
|
+
import { A_HttpServerFeatures } from "@adaas/a-server/server/A-HttpServer.constants";
|
|
6
|
+
import { A_HttpServerError } from "@adaas/a-server/server/A-HttpServer.error";
|
|
7
|
+
import { A_Logger } from "@adaas/a-utils/a-logger";
|
|
8
|
+
import { A_Polyfill } from "@adaas/a-utils/a-polyfill";
|
|
9
|
+
import { A_ServerRoute } from "@adaas/a-server/route/A-ServerRoute.entity";
|
|
10
|
+
|
|
11
|
+
export class A_StaticLoader extends A_Component {
|
|
12
|
+
|
|
13
|
+
private _fsPolyfill: any;
|
|
14
|
+
private _pathPolyfill: any;
|
|
15
|
+
|
|
16
|
+
@A_Concept.Load()
|
|
17
|
+
async load(
|
|
18
|
+
@A_Inject(A_Logger) logger: A_Logger,
|
|
19
|
+
@A_Inject(A_StaticConfig) config: A_StaticConfig,
|
|
20
|
+
@A_Inject(A_Polyfill) polyfill: A_Polyfill
|
|
21
|
+
) {
|
|
22
|
+
// Initialize polyfills
|
|
23
|
+
this._fsPolyfill = await polyfill.fs();
|
|
24
|
+
this._pathPolyfill = await polyfill.path();
|
|
25
|
+
|
|
26
|
+
// Log configured aliases
|
|
27
|
+
const aliases = config.getEnabledAliases();
|
|
28
|
+
logger.info('cyan',
|
|
29
|
+
|
|
30
|
+
`Static aliases configured:`,
|
|
31
|
+
...aliases.map(alias => `${alias.alias} -> ${alias.directory}`)
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
// =======================================================
|
|
37
|
+
// ================ Method Definition=====================
|
|
38
|
+
// =======================================================
|
|
39
|
+
|
|
40
|
+
@A_Feature.Extend({
|
|
41
|
+
before: /.*/
|
|
42
|
+
})
|
|
43
|
+
async [A_HttpServerFeatures.onRequest](
|
|
44
|
+
@A_Inject(A_Request) req: A_Request,
|
|
45
|
+
@A_Inject(A_Response) res: A_Response,
|
|
46
|
+
@A_Inject(A_Logger) logger: A_Logger,
|
|
47
|
+
@A_Inject(A_StaticConfig) config: A_StaticConfig,
|
|
48
|
+
@A_Inject(A_Polyfill) polyfill: A_Polyfill
|
|
49
|
+
) {
|
|
50
|
+
|
|
51
|
+
if (req.method !== 'GET' && req.method !== 'HEAD') {
|
|
52
|
+
return; // Only handle GET and HEAD requests
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const { method, url } = req;
|
|
56
|
+
const route = new A_ServerRoute(url, method);
|
|
57
|
+
|
|
58
|
+
// Check if this request matches any of our configured aliases
|
|
59
|
+
const alias = config.findMatchingAlias(route.path);
|
|
60
|
+
if (!alias) {
|
|
61
|
+
return; // No static config for this path
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
// Ensure polyfills are available
|
|
66
|
+
const fs = this._fsPolyfill || await polyfill.fs();
|
|
67
|
+
const path = this._pathPolyfill || await polyfill.path();
|
|
68
|
+
|
|
69
|
+
const staticDir = path.resolve(process.cwd(), alias.directory);
|
|
70
|
+
|
|
71
|
+
// Validate static directory exists
|
|
72
|
+
if (!fs.existsSync(staticDir)) {
|
|
73
|
+
logger.log("red", `Static directory ${staticDir} does not exist.`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Get the file path relative to the alias
|
|
78
|
+
const relativePath = route.path.replace(alias.path, '');
|
|
79
|
+
const safePath = this.safeFilePath(staticDir, relativePath, req.headers?.host, path, fs);
|
|
80
|
+
|
|
81
|
+
await this.serveFile(safePath, res, logger, fs, path);
|
|
82
|
+
|
|
83
|
+
logger.log('green', `Successfully served: ${safePath}`);
|
|
84
|
+
|
|
85
|
+
} catch (error: any) {
|
|
86
|
+
throw new A_HttpServerError({
|
|
87
|
+
status: 500,
|
|
88
|
+
title: 'Static File Serving Error',
|
|
89
|
+
description: `Error serving static file for ${route.path}: ${error.message}`,
|
|
90
|
+
originalError: error
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Add a custom static file alias through the config
|
|
97
|
+
* @param alias - The URL path alias (e.g., '/assets')
|
|
98
|
+
* @param directory - The local directory path
|
|
99
|
+
* @param path - Optional custom path (defaults to alias)
|
|
100
|
+
* @param config - Static config instance
|
|
101
|
+
* @param logger - Logger instance for logging
|
|
102
|
+
*/
|
|
103
|
+
public addAlias(
|
|
104
|
+
alias: string,
|
|
105
|
+
directory: string,
|
|
106
|
+
config: A_StaticConfig,
|
|
107
|
+
logger?: A_Logger,
|
|
108
|
+
path?: string
|
|
109
|
+
): void {
|
|
110
|
+
config.addAlias(alias, directory, path);
|
|
111
|
+
|
|
112
|
+
if (logger) {
|
|
113
|
+
logger.log('cyan', `Static alias added: ${alias} -> ${directory}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Remove a static file alias through the config
|
|
119
|
+
* @param aliasPath - The path of the alias to remove
|
|
120
|
+
* @param config - Static config instance
|
|
121
|
+
* @param logger - Logger instance for logging
|
|
122
|
+
*/
|
|
123
|
+
public removeAlias(aliasPath: string, config: A_StaticConfig, logger?: A_Logger): boolean {
|
|
124
|
+
const removed = config.removeAlias(aliasPath);
|
|
125
|
+
|
|
126
|
+
if (removed && logger) {
|
|
127
|
+
logger.log('yellow', `Static alias removed: ${aliasPath}`);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return removed;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get all configured aliases from config
|
|
135
|
+
* @param config - Static config instance
|
|
136
|
+
*/
|
|
137
|
+
public getAliases(config: A_StaticConfig): A_StaticAlias[] {
|
|
138
|
+
return config.getAliases();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Enable or disable an alias
|
|
143
|
+
* @param aliasPath - The path of the alias
|
|
144
|
+
* @param enabled - Whether to enable or disable
|
|
145
|
+
* @param config - Static config instance
|
|
146
|
+
* @param logger - Logger instance for logging
|
|
147
|
+
*/
|
|
148
|
+
public setAliasEnabled(
|
|
149
|
+
aliasPath: string,
|
|
150
|
+
enabled: boolean,
|
|
151
|
+
config: A_StaticConfig,
|
|
152
|
+
logger?: A_Logger
|
|
153
|
+
): boolean {
|
|
154
|
+
const result = config.setAliasEnabled(aliasPath, enabled);
|
|
155
|
+
|
|
156
|
+
if (result && logger) {
|
|
157
|
+
logger.log('blue', `Static alias ${enabled ? 'enabled' : 'disabled'}: ${aliasPath}`);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
protected getMimeType(ext: string): string {
|
|
164
|
+
const mimeTypes: Record<string, string> = {
|
|
165
|
+
// Text
|
|
166
|
+
".html": "text/html",
|
|
167
|
+
".htm": "text/html",
|
|
168
|
+
".css": "text/css",
|
|
169
|
+
".txt": "text/plain",
|
|
170
|
+
".md": "text/markdown",
|
|
171
|
+
".xml": "application/xml",
|
|
172
|
+
|
|
173
|
+
// JavaScript
|
|
174
|
+
".js": "application/javascript",
|
|
175
|
+
".mjs": "application/javascript",
|
|
176
|
+
".jsx": "application/javascript",
|
|
177
|
+
".ts": "application/typescript",
|
|
178
|
+
".tsx": "application/typescript",
|
|
179
|
+
|
|
180
|
+
// JSON
|
|
181
|
+
".json": "application/json",
|
|
182
|
+
".jsonld": "application/ld+json",
|
|
183
|
+
|
|
184
|
+
// Images
|
|
185
|
+
".png": "image/png",
|
|
186
|
+
".jpg": "image/jpeg",
|
|
187
|
+
".jpeg": "image/jpeg",
|
|
188
|
+
".gif": "image/gif",
|
|
189
|
+
".svg": "image/svg+xml",
|
|
190
|
+
".ico": "image/x-icon",
|
|
191
|
+
".webp": "image/webp",
|
|
192
|
+
".bmp": "image/bmp",
|
|
193
|
+
".tiff": "image/tiff",
|
|
194
|
+
|
|
195
|
+
// Fonts
|
|
196
|
+
".woff": "font/woff",
|
|
197
|
+
".woff2": "font/woff2",
|
|
198
|
+
".ttf": "font/ttf",
|
|
199
|
+
".otf": "font/otf",
|
|
200
|
+
".eot": "application/vnd.ms-fontobject",
|
|
201
|
+
|
|
202
|
+
// Audio/Video
|
|
203
|
+
".mp3": "audio/mpeg",
|
|
204
|
+
".wav": "audio/wav",
|
|
205
|
+
".mp4": "video/mp4",
|
|
206
|
+
".webm": "video/webm",
|
|
207
|
+
".ogg": "application/ogg",
|
|
208
|
+
|
|
209
|
+
// Archives
|
|
210
|
+
".zip": "application/zip",
|
|
211
|
+
".tar": "application/x-tar",
|
|
212
|
+
".gz": "application/gzip",
|
|
213
|
+
|
|
214
|
+
// Documents
|
|
215
|
+
".pdf": "application/pdf",
|
|
216
|
+
".doc": "application/msword",
|
|
217
|
+
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
218
|
+
".xls": "application/vnd.ms-excel",
|
|
219
|
+
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
return mimeTypes[ext.toLowerCase()] || "application/octet-stream";
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
protected safeFilePath(staticDir: string, reqUrl: string, host: string = 'localhost', pathPolyfill: any, fsPolyfill: any): string {
|
|
227
|
+
const parsedUrl = new URL(reqUrl || "/", `http://${host}`);
|
|
228
|
+
let pathname = decodeURIComponent(parsedUrl.pathname);
|
|
229
|
+
|
|
230
|
+
// Prevent path traversal attacks
|
|
231
|
+
pathname = pathname.replace(/\.\.[\/\\]/g, "");
|
|
232
|
+
|
|
233
|
+
let filePath = pathPolyfill.join(staticDir, pathname);
|
|
234
|
+
|
|
235
|
+
if (!fsPolyfill.existsSync(filePath)) {
|
|
236
|
+
throw new Error(`File not found: ${filePath}`);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return filePath;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
protected serveFile(
|
|
243
|
+
filePath: string,
|
|
244
|
+
res: A_Response,
|
|
245
|
+
logger: A_Logger,
|
|
246
|
+
fsPolyfill: any,
|
|
247
|
+
pathPolyfill: any
|
|
248
|
+
): Promise<void> {
|
|
249
|
+
return new Promise<void>((resolve, reject) => {
|
|
250
|
+
try {
|
|
251
|
+
if (fsPolyfill.existsSync(filePath)) {
|
|
252
|
+
const ext = pathPolyfill.extname(filePath);
|
|
253
|
+
const contentType = this.getMimeType(ext);
|
|
254
|
+
|
|
255
|
+
// Set appropriate headers
|
|
256
|
+
const headers: Record<string, string> = {
|
|
257
|
+
"Content-Type": contentType,
|
|
258
|
+
"Cache-Control": this.getCacheControl(ext),
|
|
259
|
+
"X-Content-Type-Options": "nosniff"
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
res.writeHead(200, headers);
|
|
263
|
+
|
|
264
|
+
const stream = fsPolyfill.createReadStream(filePath);
|
|
265
|
+
|
|
266
|
+
if (stream && res.original) {
|
|
267
|
+
stream.pipe(res.original);
|
|
268
|
+
|
|
269
|
+
stream.on('end', () => {
|
|
270
|
+
resolve();
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
stream.on("error", (err: any) => {
|
|
274
|
+
reject(new A_HttpServerError({
|
|
275
|
+
status: 500,
|
|
276
|
+
title: 'File Stream Error',
|
|
277
|
+
description: `Error reading file stream for ${filePath}: ${err.message}`,
|
|
278
|
+
originalError: err
|
|
279
|
+
}));
|
|
280
|
+
});
|
|
281
|
+
} else {
|
|
282
|
+
reject(new A_HttpServerError({
|
|
283
|
+
status: 500,
|
|
284
|
+
title: 'Response Stream Error',
|
|
285
|
+
description: `Unable to pipe file stream for ${filePath}`,
|
|
286
|
+
}));
|
|
287
|
+
}
|
|
288
|
+
} else {
|
|
289
|
+
reject(new A_HttpServerError({
|
|
290
|
+
status: 404,
|
|
291
|
+
title: 'File Not Found',
|
|
292
|
+
description: `File not found: ${filePath}`,
|
|
293
|
+
}));
|
|
294
|
+
}
|
|
295
|
+
} catch (error: any) {
|
|
296
|
+
logger.error(`Error serving file: ${error.message}`);
|
|
297
|
+
reject(new A_HttpServerError({
|
|
298
|
+
status: 500,
|
|
299
|
+
title: 'Internal Server Error',
|
|
300
|
+
description: `Error serving file: ${error.message}`,
|
|
301
|
+
originalError: error
|
|
302
|
+
}));
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
protected getCacheControl(ext: string): string {
|
|
308
|
+
// Different cache strategies for different file types
|
|
309
|
+
const staticAssets = ['.css', '.js', '.png', '.jpg', '.jpeg', '.gif', '.svg', '.ico', '.woff', '.woff2', '.ttf', '.otf'];
|
|
310
|
+
const dynamicContent = ['.html', '.htm'];
|
|
311
|
+
|
|
312
|
+
if (staticAssets.includes(ext.toLowerCase())) {
|
|
313
|
+
return "public, max-age=31536000"; // 1 year for static assets
|
|
314
|
+
} else if (dynamicContent.includes(ext.toLowerCase())) {
|
|
315
|
+
return "public, max-age=3600"; // 1 hour for HTML
|
|
316
|
+
} else {
|
|
317
|
+
return "public, max-age=86400"; // 1 day for other files
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { A_Fragment } from "@adaas/a-concept";
|
|
2
|
+
|
|
3
|
+
export interface A_StaticAlias {
|
|
4
|
+
alias: string;
|
|
5
|
+
path: string;
|
|
6
|
+
directory: string;
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface A_StaticDirectoryConfig {
|
|
11
|
+
path: string;
|
|
12
|
+
directory: string;
|
|
13
|
+
alias?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class A_StaticConfig extends A_Fragment {
|
|
17
|
+
|
|
18
|
+
readonly directories: Array<string>;
|
|
19
|
+
private _aliases: Map<string, A_StaticAlias> = new Map();
|
|
20
|
+
private _directoryConfigs: A_StaticDirectoryConfig[] = [];
|
|
21
|
+
|
|
22
|
+
constructor(
|
|
23
|
+
/**
|
|
24
|
+
* Setup directories to serve static files from, comma separated
|
|
25
|
+
*/
|
|
26
|
+
directories: string[] = [],
|
|
27
|
+
/**
|
|
28
|
+
* Custom directory configurations with aliases
|
|
29
|
+
*/
|
|
30
|
+
directoryConfigs: A_StaticDirectoryConfig[] = []
|
|
31
|
+
) {
|
|
32
|
+
super();
|
|
33
|
+
|
|
34
|
+
this.directories = directories;
|
|
35
|
+
this._directoryConfigs = directoryConfigs;
|
|
36
|
+
|
|
37
|
+
// Initialize default aliases from directories
|
|
38
|
+
this.initializeDefaultAliases();
|
|
39
|
+
|
|
40
|
+
// Initialize custom aliases from directoryConfigs
|
|
41
|
+
this.initializeCustomAliases();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private initializeDefaultAliases(): void {
|
|
45
|
+
this.directories.forEach((dir, index) => {
|
|
46
|
+
const alias: A_StaticAlias = {
|
|
47
|
+
alias: `/static${index > 0 ? index : ''}`,
|
|
48
|
+
path: `/static${index > 0 ? index : ''}`,
|
|
49
|
+
directory: dir,
|
|
50
|
+
enabled: true
|
|
51
|
+
};
|
|
52
|
+
this._aliases.set(alias.path, alias);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private initializeCustomAliases(): void {
|
|
57
|
+
this._directoryConfigs.forEach((config) => {
|
|
58
|
+
const alias: A_StaticAlias = {
|
|
59
|
+
alias: config.alias || config.path,
|
|
60
|
+
path: config.path,
|
|
61
|
+
directory: config.directory,
|
|
62
|
+
enabled: true
|
|
63
|
+
};
|
|
64
|
+
this._aliases.set(alias.path, alias);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Add a custom static file alias
|
|
70
|
+
* @param alias - The URL path alias (e.g., '/assets')
|
|
71
|
+
* @param directory - The local directory path
|
|
72
|
+
* @param path - Optional custom path (defaults to alias)
|
|
73
|
+
*/
|
|
74
|
+
public addAlias(alias: string, directory: string, path?: string): void {
|
|
75
|
+
const staticAlias: A_StaticAlias = {
|
|
76
|
+
alias,
|
|
77
|
+
path: path || alias,
|
|
78
|
+
directory,
|
|
79
|
+
enabled: true
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
this._aliases.set(staticAlias.path, staticAlias);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Remove a static file alias
|
|
87
|
+
* @param aliasPath - The path of the alias to remove
|
|
88
|
+
*/
|
|
89
|
+
public removeAlias(aliasPath: string): boolean {
|
|
90
|
+
return this._aliases.delete(aliasPath);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Enable or disable an alias
|
|
95
|
+
* @param aliasPath - The path of the alias
|
|
96
|
+
* @param enabled - Whether to enable or disable
|
|
97
|
+
*/
|
|
98
|
+
public setAliasEnabled(aliasPath: string, enabled: boolean): boolean {
|
|
99
|
+
const alias = this._aliases.get(aliasPath);
|
|
100
|
+
if (alias) {
|
|
101
|
+
alias.enabled = enabled;
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get all configured aliases
|
|
109
|
+
*/
|
|
110
|
+
public getAliases(): A_StaticAlias[] {
|
|
111
|
+
return Array.from(this._aliases.values());
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Get enabled aliases only
|
|
116
|
+
*/
|
|
117
|
+
public getEnabledAliases(): A_StaticAlias[] {
|
|
118
|
+
return Array.from(this._aliases.values()).filter(alias => alias.enabled !== false);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Find the best matching alias for a given request path
|
|
123
|
+
* @param requestPath - The request path to match
|
|
124
|
+
*/
|
|
125
|
+
public findMatchingAlias(requestPath: string): A_StaticAlias | null {
|
|
126
|
+
let bestMatch: A_StaticAlias | null = null;
|
|
127
|
+
let longestMatch = 0;
|
|
128
|
+
|
|
129
|
+
for (const alias of this.getEnabledAliases()) {
|
|
130
|
+
if (requestPath.startsWith(alias.path) && alias.path.length > longestMatch) {
|
|
131
|
+
bestMatch = alias;
|
|
132
|
+
longestMatch = alias.path.length;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return bestMatch;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Check if an alias exists
|
|
141
|
+
* @param aliasPath - The path to check
|
|
142
|
+
*/
|
|
143
|
+
public hasAlias(aliasPath: string): boolean {
|
|
144
|
+
return this._aliases.has(aliasPath);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Get a specific alias by path
|
|
149
|
+
* @param aliasPath - The path of the alias
|
|
150
|
+
*/
|
|
151
|
+
public getAlias(aliasPath: string): A_StaticAlias | undefined {
|
|
152
|
+
return this._aliases.get(aliasPath);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Add multiple aliases at once
|
|
157
|
+
* @param aliases - Array of alias configurations
|
|
158
|
+
*/
|
|
159
|
+
public addAliases(aliases: A_StaticDirectoryConfig[]): void {
|
|
160
|
+
aliases.forEach(config => {
|
|
161
|
+
this.addAlias(config.alias || config.path, config.directory, config.path);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Clear all aliases
|
|
167
|
+
*/
|
|
168
|
+
public clearAliases(): void {
|
|
169
|
+
this._aliases.clear();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Update an existing alias
|
|
174
|
+
* @param aliasPath - The path of the alias to update
|
|
175
|
+
* @param updates - Partial updates to apply
|
|
176
|
+
*/
|
|
177
|
+
public updateAlias(aliasPath: string, updates: Partial<A_StaticAlias>): boolean {
|
|
178
|
+
const alias = this._aliases.get(aliasPath);
|
|
179
|
+
if (alias) {
|
|
180
|
+
Object.assign(alias, updates);
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Get statistics about configured aliases
|
|
188
|
+
*/
|
|
189
|
+
public getStats(): {
|
|
190
|
+
total: number;
|
|
191
|
+
enabled: number;
|
|
192
|
+
disabled: number;
|
|
193
|
+
directories: string[];
|
|
194
|
+
} {
|
|
195
|
+
const aliases = this.getAliases();
|
|
196
|
+
const enabled = aliases.filter(a => a.enabled !== false);
|
|
197
|
+
const disabled = aliases.filter(a => a.enabled === false);
|
|
198
|
+
const directories = [...new Set(aliases.map(a => a.directory))];
|
|
199
|
+
|
|
200
|
+
return {
|
|
201
|
+
total: aliases.length,
|
|
202
|
+
enabled: enabled.length,
|
|
203
|
+
disabled: disabled.length,
|
|
204
|
+
directories
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Checks if a given path is configured in the proxy (legacy method)
|
|
210
|
+
* @deprecated Use findMatchingAlias instead
|
|
211
|
+
* @param path
|
|
212
|
+
* @returns
|
|
213
|
+
*/
|
|
214
|
+
has(path: string): boolean {
|
|
215
|
+
const alias = this.findMatchingAlias(path);
|
|
216
|
+
return alias ? !!alias.directory : false;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Gets the directory for a given path if configured (legacy method)
|
|
221
|
+
*
|
|
222
|
+
* @param path
|
|
223
|
+
* @returns
|
|
224
|
+
*/
|
|
225
|
+
get(path: string): string | undefined {
|
|
226
|
+
const alias = this.findMatchingAlias(path);
|
|
227
|
+
return alias ? alias.directory : undefined;
|
|
228
|
+
}
|
|
229
|
+
}
|