@adaas/a-server 0.0.22 → 0.0.24
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 +1699 -0
- package/dist/browser/index.mjs +2935 -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-6qhiV7BE.d.mts +348 -0
- package/dist/node/A-Response.entity-bjh6bofZ.d.ts +348 -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 +608 -0
- package/dist/node/lib/A-Response/A-Response.entity.js.map +1 -0
- package/dist/node/lib/A-Response/A-Response.entity.mjs +596 -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 +196 -0
- package/dist/node/lib/A-Server/A-HttpServer.container.js.map +1 -0
- package/dist/node/lib/A-Server/A-HttpServer.container.mjs +184 -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 +751 -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 +256 -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,110 @@
|
|
|
1
|
+
import { A_Fragment } from '@adaas/a-concept';
|
|
2
|
+
|
|
3
|
+
interface A_StaticAlias {
|
|
4
|
+
alias: string;
|
|
5
|
+
path: string;
|
|
6
|
+
directory: string;
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface A_StaticDirectoryConfig {
|
|
10
|
+
path: string;
|
|
11
|
+
directory: string;
|
|
12
|
+
alias?: string;
|
|
13
|
+
}
|
|
14
|
+
declare class A_StaticConfig extends A_Fragment {
|
|
15
|
+
readonly directories: Array<string>;
|
|
16
|
+
private _aliases;
|
|
17
|
+
private _directoryConfigs;
|
|
18
|
+
constructor(
|
|
19
|
+
/**
|
|
20
|
+
* Setup directories to serve static files from, comma separated
|
|
21
|
+
*/
|
|
22
|
+
directories?: string[],
|
|
23
|
+
/**
|
|
24
|
+
* Custom directory configurations with aliases
|
|
25
|
+
*/
|
|
26
|
+
directoryConfigs?: A_StaticDirectoryConfig[]);
|
|
27
|
+
private initializeDefaultAliases;
|
|
28
|
+
private initializeCustomAliases;
|
|
29
|
+
/**
|
|
30
|
+
* Add a custom static file alias
|
|
31
|
+
* @param alias - The URL path alias (e.g., '/assets')
|
|
32
|
+
* @param directory - The local directory path
|
|
33
|
+
* @param path - Optional custom path (defaults to alias)
|
|
34
|
+
*/
|
|
35
|
+
addAlias(alias: string, directory: string, path?: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Remove a static file alias
|
|
38
|
+
* @param aliasPath - The path of the alias to remove
|
|
39
|
+
*/
|
|
40
|
+
removeAlias(aliasPath: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Enable or disable an alias
|
|
43
|
+
* @param aliasPath - The path of the alias
|
|
44
|
+
* @param enabled - Whether to enable or disable
|
|
45
|
+
*/
|
|
46
|
+
setAliasEnabled(aliasPath: string, enabled: boolean): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Get all configured aliases
|
|
49
|
+
*/
|
|
50
|
+
getAliases(): A_StaticAlias[];
|
|
51
|
+
/**
|
|
52
|
+
* Get enabled aliases only
|
|
53
|
+
*/
|
|
54
|
+
getEnabledAliases(): A_StaticAlias[];
|
|
55
|
+
/**
|
|
56
|
+
* Find the best matching alias for a given request path
|
|
57
|
+
* @param requestPath - The request path to match
|
|
58
|
+
*/
|
|
59
|
+
findMatchingAlias(requestPath: string): A_StaticAlias | null;
|
|
60
|
+
/**
|
|
61
|
+
* Check if an alias exists
|
|
62
|
+
* @param aliasPath - The path to check
|
|
63
|
+
*/
|
|
64
|
+
hasAlias(aliasPath: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Get a specific alias by path
|
|
67
|
+
* @param aliasPath - The path of the alias
|
|
68
|
+
*/
|
|
69
|
+
getAlias(aliasPath: string): A_StaticAlias | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Add multiple aliases at once
|
|
72
|
+
* @param aliases - Array of alias configurations
|
|
73
|
+
*/
|
|
74
|
+
addAliases(aliases: A_StaticDirectoryConfig[]): void;
|
|
75
|
+
/**
|
|
76
|
+
* Clear all aliases
|
|
77
|
+
*/
|
|
78
|
+
clearAliases(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Update an existing alias
|
|
81
|
+
* @param aliasPath - The path of the alias to update
|
|
82
|
+
* @param updates - Partial updates to apply
|
|
83
|
+
*/
|
|
84
|
+
updateAlias(aliasPath: string, updates: Partial<A_StaticAlias>): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Get statistics about configured aliases
|
|
87
|
+
*/
|
|
88
|
+
getStats(): {
|
|
89
|
+
total: number;
|
|
90
|
+
enabled: number;
|
|
91
|
+
disabled: number;
|
|
92
|
+
directories: string[];
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Checks if a given path is configured in the proxy (legacy method)
|
|
96
|
+
* @deprecated Use findMatchingAlias instead
|
|
97
|
+
* @param path
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
100
|
+
has(path: string): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Gets the directory for a given path if configured (legacy method)
|
|
103
|
+
*
|
|
104
|
+
* @param path
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
get(path: string): string | undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { type A_StaticAlias, A_StaticConfig, type A_StaticDirectoryConfig };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { A_Fragment } from '@adaas/a-concept';
|
|
2
|
+
|
|
3
|
+
interface A_StaticAlias {
|
|
4
|
+
alias: string;
|
|
5
|
+
path: string;
|
|
6
|
+
directory: string;
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface A_StaticDirectoryConfig {
|
|
10
|
+
path: string;
|
|
11
|
+
directory: string;
|
|
12
|
+
alias?: string;
|
|
13
|
+
}
|
|
14
|
+
declare class A_StaticConfig extends A_Fragment {
|
|
15
|
+
readonly directories: Array<string>;
|
|
16
|
+
private _aliases;
|
|
17
|
+
private _directoryConfigs;
|
|
18
|
+
constructor(
|
|
19
|
+
/**
|
|
20
|
+
* Setup directories to serve static files from, comma separated
|
|
21
|
+
*/
|
|
22
|
+
directories?: string[],
|
|
23
|
+
/**
|
|
24
|
+
* Custom directory configurations with aliases
|
|
25
|
+
*/
|
|
26
|
+
directoryConfigs?: A_StaticDirectoryConfig[]);
|
|
27
|
+
private initializeDefaultAliases;
|
|
28
|
+
private initializeCustomAliases;
|
|
29
|
+
/**
|
|
30
|
+
* Add a custom static file alias
|
|
31
|
+
* @param alias - The URL path alias (e.g., '/assets')
|
|
32
|
+
* @param directory - The local directory path
|
|
33
|
+
* @param path - Optional custom path (defaults to alias)
|
|
34
|
+
*/
|
|
35
|
+
addAlias(alias: string, directory: string, path?: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Remove a static file alias
|
|
38
|
+
* @param aliasPath - The path of the alias to remove
|
|
39
|
+
*/
|
|
40
|
+
removeAlias(aliasPath: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Enable or disable an alias
|
|
43
|
+
* @param aliasPath - The path of the alias
|
|
44
|
+
* @param enabled - Whether to enable or disable
|
|
45
|
+
*/
|
|
46
|
+
setAliasEnabled(aliasPath: string, enabled: boolean): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Get all configured aliases
|
|
49
|
+
*/
|
|
50
|
+
getAliases(): A_StaticAlias[];
|
|
51
|
+
/**
|
|
52
|
+
* Get enabled aliases only
|
|
53
|
+
*/
|
|
54
|
+
getEnabledAliases(): A_StaticAlias[];
|
|
55
|
+
/**
|
|
56
|
+
* Find the best matching alias for a given request path
|
|
57
|
+
* @param requestPath - The request path to match
|
|
58
|
+
*/
|
|
59
|
+
findMatchingAlias(requestPath: string): A_StaticAlias | null;
|
|
60
|
+
/**
|
|
61
|
+
* Check if an alias exists
|
|
62
|
+
* @param aliasPath - The path to check
|
|
63
|
+
*/
|
|
64
|
+
hasAlias(aliasPath: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Get a specific alias by path
|
|
67
|
+
* @param aliasPath - The path of the alias
|
|
68
|
+
*/
|
|
69
|
+
getAlias(aliasPath: string): A_StaticAlias | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Add multiple aliases at once
|
|
72
|
+
* @param aliases - Array of alias configurations
|
|
73
|
+
*/
|
|
74
|
+
addAliases(aliases: A_StaticDirectoryConfig[]): void;
|
|
75
|
+
/**
|
|
76
|
+
* Clear all aliases
|
|
77
|
+
*/
|
|
78
|
+
clearAliases(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Update an existing alias
|
|
81
|
+
* @param aliasPath - The path of the alias to update
|
|
82
|
+
* @param updates - Partial updates to apply
|
|
83
|
+
*/
|
|
84
|
+
updateAlias(aliasPath: string, updates: Partial<A_StaticAlias>): boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Get statistics about configured aliases
|
|
87
|
+
*/
|
|
88
|
+
getStats(): {
|
|
89
|
+
total: number;
|
|
90
|
+
enabled: number;
|
|
91
|
+
disabled: number;
|
|
92
|
+
directories: string[];
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Checks if a given path is configured in the proxy (legacy method)
|
|
96
|
+
* @deprecated Use findMatchingAlias instead
|
|
97
|
+
* @param path
|
|
98
|
+
* @returns
|
|
99
|
+
*/
|
|
100
|
+
has(path: string): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Gets the directory for a given path if configured (legacy method)
|
|
103
|
+
*
|
|
104
|
+
* @param path
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
get(path: string): string | undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { type A_StaticAlias, A_StaticConfig, type A_StaticDirectoryConfig };
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var aConcept = require('@adaas/a-concept');
|
|
4
|
+
|
|
5
|
+
class A_StaticConfig extends aConcept.A_Fragment {
|
|
6
|
+
constructor(directories = [], directoryConfigs = []) {
|
|
7
|
+
super();
|
|
8
|
+
this._aliases = /* @__PURE__ */ new Map();
|
|
9
|
+
this._directoryConfigs = [];
|
|
10
|
+
this.directories = directories;
|
|
11
|
+
this._directoryConfigs = directoryConfigs;
|
|
12
|
+
this.initializeDefaultAliases();
|
|
13
|
+
this.initializeCustomAliases();
|
|
14
|
+
}
|
|
15
|
+
initializeDefaultAliases() {
|
|
16
|
+
this.directories.forEach((dir, index) => {
|
|
17
|
+
const alias = {
|
|
18
|
+
alias: `/static${index > 0 ? index : ""}`,
|
|
19
|
+
path: `/static${index > 0 ? index : ""}`,
|
|
20
|
+
directory: dir,
|
|
21
|
+
enabled: true
|
|
22
|
+
};
|
|
23
|
+
this._aliases.set(alias.path, alias);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
initializeCustomAliases() {
|
|
27
|
+
this._directoryConfigs.forEach((config) => {
|
|
28
|
+
const alias = {
|
|
29
|
+
alias: config.alias || config.path,
|
|
30
|
+
path: config.path,
|
|
31
|
+
directory: config.directory,
|
|
32
|
+
enabled: true
|
|
33
|
+
};
|
|
34
|
+
this._aliases.set(alias.path, alias);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Add a custom static file alias
|
|
39
|
+
* @param alias - The URL path alias (e.g., '/assets')
|
|
40
|
+
* @param directory - The local directory path
|
|
41
|
+
* @param path - Optional custom path (defaults to alias)
|
|
42
|
+
*/
|
|
43
|
+
addAlias(alias, directory, path) {
|
|
44
|
+
const staticAlias = {
|
|
45
|
+
alias,
|
|
46
|
+
path: path || alias,
|
|
47
|
+
directory,
|
|
48
|
+
enabled: true
|
|
49
|
+
};
|
|
50
|
+
this._aliases.set(staticAlias.path, staticAlias);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Remove a static file alias
|
|
54
|
+
* @param aliasPath - The path of the alias to remove
|
|
55
|
+
*/
|
|
56
|
+
removeAlias(aliasPath) {
|
|
57
|
+
return this._aliases.delete(aliasPath);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Enable or disable an alias
|
|
61
|
+
* @param aliasPath - The path of the alias
|
|
62
|
+
* @param enabled - Whether to enable or disable
|
|
63
|
+
*/
|
|
64
|
+
setAliasEnabled(aliasPath, enabled) {
|
|
65
|
+
const alias = this._aliases.get(aliasPath);
|
|
66
|
+
if (alias) {
|
|
67
|
+
alias.enabled = enabled;
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get all configured aliases
|
|
74
|
+
*/
|
|
75
|
+
getAliases() {
|
|
76
|
+
return Array.from(this._aliases.values());
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Get enabled aliases only
|
|
80
|
+
*/
|
|
81
|
+
getEnabledAliases() {
|
|
82
|
+
return Array.from(this._aliases.values()).filter((alias) => alias.enabled !== false);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Find the best matching alias for a given request path
|
|
86
|
+
* @param requestPath - The request path to match
|
|
87
|
+
*/
|
|
88
|
+
findMatchingAlias(requestPath) {
|
|
89
|
+
let bestMatch = null;
|
|
90
|
+
let longestMatch = 0;
|
|
91
|
+
for (const alias of this.getEnabledAliases()) {
|
|
92
|
+
if (requestPath.startsWith(alias.path) && alias.path.length > longestMatch) {
|
|
93
|
+
bestMatch = alias;
|
|
94
|
+
longestMatch = alias.path.length;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return bestMatch;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Check if an alias exists
|
|
101
|
+
* @param aliasPath - The path to check
|
|
102
|
+
*/
|
|
103
|
+
hasAlias(aliasPath) {
|
|
104
|
+
return this._aliases.has(aliasPath);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Get a specific alias by path
|
|
108
|
+
* @param aliasPath - The path of the alias
|
|
109
|
+
*/
|
|
110
|
+
getAlias(aliasPath) {
|
|
111
|
+
return this._aliases.get(aliasPath);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Add multiple aliases at once
|
|
115
|
+
* @param aliases - Array of alias configurations
|
|
116
|
+
*/
|
|
117
|
+
addAliases(aliases) {
|
|
118
|
+
aliases.forEach((config) => {
|
|
119
|
+
this.addAlias(config.alias || config.path, config.directory, config.path);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Clear all aliases
|
|
124
|
+
*/
|
|
125
|
+
clearAliases() {
|
|
126
|
+
this._aliases.clear();
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Update an existing alias
|
|
130
|
+
* @param aliasPath - The path of the alias to update
|
|
131
|
+
* @param updates - Partial updates to apply
|
|
132
|
+
*/
|
|
133
|
+
updateAlias(aliasPath, updates) {
|
|
134
|
+
const alias = this._aliases.get(aliasPath);
|
|
135
|
+
if (alias) {
|
|
136
|
+
Object.assign(alias, updates);
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get statistics about configured aliases
|
|
143
|
+
*/
|
|
144
|
+
getStats() {
|
|
145
|
+
const aliases = this.getAliases();
|
|
146
|
+
const enabled = aliases.filter((a) => a.enabled !== false);
|
|
147
|
+
const disabled = aliases.filter((a) => a.enabled === false);
|
|
148
|
+
const directories = [...new Set(aliases.map((a) => a.directory))];
|
|
149
|
+
return {
|
|
150
|
+
total: aliases.length,
|
|
151
|
+
enabled: enabled.length,
|
|
152
|
+
disabled: disabled.length,
|
|
153
|
+
directories
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Checks if a given path is configured in the proxy (legacy method)
|
|
158
|
+
* @deprecated Use findMatchingAlias instead
|
|
159
|
+
* @param path
|
|
160
|
+
* @returns
|
|
161
|
+
*/
|
|
162
|
+
has(path) {
|
|
163
|
+
const alias = this.findMatchingAlias(path);
|
|
164
|
+
return alias ? !!alias.directory : false;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Gets the directory for a given path if configured (legacy method)
|
|
168
|
+
*
|
|
169
|
+
* @param path
|
|
170
|
+
* @returns
|
|
171
|
+
*/
|
|
172
|
+
get(path) {
|
|
173
|
+
const alias = this.findMatchingAlias(path);
|
|
174
|
+
return alias ? alias.directory : void 0;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
exports.A_StaticConfig = A_StaticConfig;
|
|
179
|
+
//# sourceMappingURL=A-ServerStatic.context.js.map
|
|
180
|
+
//# sourceMappingURL=A-ServerStatic.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-ServerStatic/A-ServerStatic.context.ts"],"names":["A_Fragment"],"mappings":";;;;AAeO,MAAM,uBAAuBA,mBAAA,CAAW;AAAA,EAM3C,YAII,WAAA,GAAwB,EAAC,EAIzB,gBAAA,GAA8C,EAA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KAAA;AAAA,EACX;AAAA;AAAA;AAAA;AAAA,EAKO,QAAA,GAKL;AACE,IAAA,MAAM,OAAA,GAAU,KAAK,UAAA,EAAW;AAChC,IAAA,MAAM,UAAU,OAAA,CAAQ,MAAA,CAAO,CAAA,CAAA,KAAK,CAAA,CAAE,YAAY,KAAK,CAAA;AACvD,IAAA,MAAM,WAAW,OAAA,CAAQ,MAAA,CAAO,CAAA,CAAA,KAAK,CAAA,CAAE,YAAY,KAAK,CAAA;AACxD,IAAA,MAAM,WAAA,GAAc,CAAC,GAAG,IAAI,GAAA,CAAI,OAAA,CAAQ,GAAA,CAAI,CAAA,CAAA,KAAK,CAAA,CAAE,SAAS,CAAC,CAAC,CAAA;AAE9D,IAAA,OAAO;AAAA,MACH,OAAO,OAAA,CAAQ,MAAA;AAAA,MACf,SAAS,OAAA,CAAQ,MAAA;AAAA,MACjB,UAAU,QAAA,CAAS,MAAA;AAAA,MACnB;AAAA,KACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,IAAA,EAAuB;AACvB,IAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,iBAAA,CAAkB,IAAI,CAAA;AACzC,IAAA,OAAO,KAAA,GAAQ,CAAC,CAAC,KAAA,CAAM,SAAA,GAAY,KAAA;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,IAAA,EAAkC;AAClC,IAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,iBAAA,CAAkB,IAAI,CAAA;AACzC,IAAA,OAAO,KAAA,GAAQ,MAAM,SAAA,GAAY,MAAA;AAAA,EACrC;AACJ","file":"A-ServerStatic.context.js","sourcesContent":["import { A_Fragment } from \"@adaas/a-concept\";\n\nexport interface A_StaticAlias {\n alias: string;\n path: string;\n directory: string;\n enabled?: boolean;\n}\n\nexport interface A_StaticDirectoryConfig {\n path: string;\n directory: string;\n alias?: string;\n}\n\nexport class A_StaticConfig extends A_Fragment {\n\n readonly directories: Array<string>;\n private _aliases: Map<string, A_StaticAlias> = new Map();\n private _directoryConfigs: A_StaticDirectoryConfig[] = [];\n\n constructor(\n /**\n * Setup directories to serve static files from, comma separated\n */\n directories: string[] = [],\n /**\n * Custom directory configurations with aliases\n */\n directoryConfigs: A_StaticDirectoryConfig[] = []\n ) {\n super();\n\n this.directories = directories;\n this._directoryConfigs = directoryConfigs;\n\n // Initialize default aliases from directories\n this.initializeDefaultAliases();\n\n // Initialize custom aliases from directoryConfigs\n this.initializeCustomAliases();\n }\n\n private initializeDefaultAliases(): void {\n this.directories.forEach((dir, index) => {\n const alias: A_StaticAlias = {\n alias: `/static${index > 0 ? index : ''}`,\n path: `/static${index > 0 ? index : ''}`,\n directory: dir,\n enabled: true\n };\n this._aliases.set(alias.path, alias);\n });\n }\n\n private initializeCustomAliases(): void {\n this._directoryConfigs.forEach((config) => {\n const alias: A_StaticAlias = {\n alias: config.alias || config.path,\n path: config.path,\n directory: config.directory,\n enabled: true\n };\n this._aliases.set(alias.path, alias);\n });\n }\n\n /**\n * Add a custom static file alias\n * @param alias - The URL path alias (e.g., '/assets')\n * @param directory - The local directory path\n * @param path - Optional custom path (defaults to alias)\n */\n public addAlias(alias: string, directory: string, path?: string): void {\n const staticAlias: A_StaticAlias = {\n alias,\n path: path || alias,\n directory,\n enabled: true\n };\n\n this._aliases.set(staticAlias.path, staticAlias);\n }\n\n /**\n * Remove a static file alias\n * @param aliasPath - The path of the alias to remove\n */\n public removeAlias(aliasPath: string): boolean {\n return this._aliases.delete(aliasPath);\n }\n\n /**\n * Enable or disable an alias\n * @param aliasPath - The path of the alias\n * @param enabled - Whether to enable or disable\n */\n public setAliasEnabled(aliasPath: string, enabled: boolean): boolean {\n const alias = this._aliases.get(aliasPath);\n if (alias) {\n alias.enabled = enabled;\n return true;\n }\n return false;\n }\n\n /**\n * Get all configured aliases\n */\n public getAliases(): A_StaticAlias[] {\n return Array.from(this._aliases.values());\n }\n\n /**\n * Get enabled aliases only\n */\n public getEnabledAliases(): A_StaticAlias[] {\n return Array.from(this._aliases.values()).filter(alias => alias.enabled !== false);\n }\n\n /**\n * Find the best matching alias for a given request path\n * @param requestPath - The request path to match\n */\n public findMatchingAlias(requestPath: string): A_StaticAlias | null {\n let bestMatch: A_StaticAlias | null = null;\n let longestMatch = 0;\n\n for (const alias of this.getEnabledAliases()) {\n if (requestPath.startsWith(alias.path) && alias.path.length > longestMatch) {\n bestMatch = alias;\n longestMatch = alias.path.length;\n }\n }\n\n return bestMatch;\n }\n\n /**\n * Check if an alias exists\n * @param aliasPath - The path to check\n */\n public hasAlias(aliasPath: string): boolean {\n return this._aliases.has(aliasPath);\n }\n\n /**\n * Get a specific alias by path\n * @param aliasPath - The path of the alias\n */\n public getAlias(aliasPath: string): A_StaticAlias | undefined {\n return this._aliases.get(aliasPath);\n }\n\n /**\n * Add multiple aliases at once\n * @param aliases - Array of alias configurations\n */\n public addAliases(aliases: A_StaticDirectoryConfig[]): void {\n aliases.forEach(config => {\n this.addAlias(config.alias || config.path, config.directory, config.path);\n });\n }\n\n /**\n * Clear all aliases\n */\n public clearAliases(): void {\n this._aliases.clear();\n }\n\n /**\n * Update an existing alias\n * @param aliasPath - The path of the alias to update\n * @param updates - Partial updates to apply\n */\n public updateAlias(aliasPath: string, updates: Partial<A_StaticAlias>): boolean {\n const alias = this._aliases.get(aliasPath);\n if (alias) {\n Object.assign(alias, updates);\n return true;\n }\n return false;\n }\n\n /**\n * Get statistics about configured aliases\n */\n public getStats(): {\n total: number;\n enabled: number;\n disabled: number;\n directories: string[];\n } {\n const aliases = this.getAliases();\n const enabled = aliases.filter(a => a.enabled !== false);\n const disabled = aliases.filter(a => a.enabled === false);\n const directories = [...new Set(aliases.map(a => a.directory))];\n\n return {\n total: aliases.length,\n enabled: enabled.length,\n disabled: disabled.length,\n directories\n };\n }\n\n /**\n * Checks if a given path is configured in the proxy (legacy method)\n * @deprecated Use findMatchingAlias instead\n * @param path \n * @returns \n */\n has(path: string): boolean {\n const alias = this.findMatchingAlias(path);\n return alias ? !!alias.directory : false;\n }\n\n /**\n * Gets the directory for a given path if configured (legacy method)\n * \n * @param path \n * @returns \n */\n get(path: string): string | undefined {\n const alias = this.findMatchingAlias(path);\n return alias ? alias.directory : undefined;\n }\n}"]}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import '../../chunk-EQQGB2QZ.mjs';
|
|
2
|
+
import { A_Fragment } from '@adaas/a-concept';
|
|
3
|
+
|
|
4
|
+
class A_StaticConfig extends A_Fragment {
|
|
5
|
+
constructor(directories = [], directoryConfigs = []) {
|
|
6
|
+
super();
|
|
7
|
+
this._aliases = /* @__PURE__ */ new Map();
|
|
8
|
+
this._directoryConfigs = [];
|
|
9
|
+
this.directories = directories;
|
|
10
|
+
this._directoryConfigs = directoryConfigs;
|
|
11
|
+
this.initializeDefaultAliases();
|
|
12
|
+
this.initializeCustomAliases();
|
|
13
|
+
}
|
|
14
|
+
initializeDefaultAliases() {
|
|
15
|
+
this.directories.forEach((dir, index) => {
|
|
16
|
+
const alias = {
|
|
17
|
+
alias: `/static${index > 0 ? index : ""}`,
|
|
18
|
+
path: `/static${index > 0 ? index : ""}`,
|
|
19
|
+
directory: dir,
|
|
20
|
+
enabled: true
|
|
21
|
+
};
|
|
22
|
+
this._aliases.set(alias.path, alias);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
initializeCustomAliases() {
|
|
26
|
+
this._directoryConfigs.forEach((config) => {
|
|
27
|
+
const alias = {
|
|
28
|
+
alias: config.alias || config.path,
|
|
29
|
+
path: config.path,
|
|
30
|
+
directory: config.directory,
|
|
31
|
+
enabled: true
|
|
32
|
+
};
|
|
33
|
+
this._aliases.set(alias.path, alias);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Add a custom static file alias
|
|
38
|
+
* @param alias - The URL path alias (e.g., '/assets')
|
|
39
|
+
* @param directory - The local directory path
|
|
40
|
+
* @param path - Optional custom path (defaults to alias)
|
|
41
|
+
*/
|
|
42
|
+
addAlias(alias, directory, path) {
|
|
43
|
+
const staticAlias = {
|
|
44
|
+
alias,
|
|
45
|
+
path: path || alias,
|
|
46
|
+
directory,
|
|
47
|
+
enabled: true
|
|
48
|
+
};
|
|
49
|
+
this._aliases.set(staticAlias.path, staticAlias);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Remove a static file alias
|
|
53
|
+
* @param aliasPath - The path of the alias to remove
|
|
54
|
+
*/
|
|
55
|
+
removeAlias(aliasPath) {
|
|
56
|
+
return this._aliases.delete(aliasPath);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Enable or disable an alias
|
|
60
|
+
* @param aliasPath - The path of the alias
|
|
61
|
+
* @param enabled - Whether to enable or disable
|
|
62
|
+
*/
|
|
63
|
+
setAliasEnabled(aliasPath, enabled) {
|
|
64
|
+
const alias = this._aliases.get(aliasPath);
|
|
65
|
+
if (alias) {
|
|
66
|
+
alias.enabled = enabled;
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get all configured aliases
|
|
73
|
+
*/
|
|
74
|
+
getAliases() {
|
|
75
|
+
return Array.from(this._aliases.values());
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get enabled aliases only
|
|
79
|
+
*/
|
|
80
|
+
getEnabledAliases() {
|
|
81
|
+
return Array.from(this._aliases.values()).filter((alias) => alias.enabled !== false);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Find the best matching alias for a given request path
|
|
85
|
+
* @param requestPath - The request path to match
|
|
86
|
+
*/
|
|
87
|
+
findMatchingAlias(requestPath) {
|
|
88
|
+
let bestMatch = null;
|
|
89
|
+
let longestMatch = 0;
|
|
90
|
+
for (const alias of this.getEnabledAliases()) {
|
|
91
|
+
if (requestPath.startsWith(alias.path) && alias.path.length > longestMatch) {
|
|
92
|
+
bestMatch = alias;
|
|
93
|
+
longestMatch = alias.path.length;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return bestMatch;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Check if an alias exists
|
|
100
|
+
* @param aliasPath - The path to check
|
|
101
|
+
*/
|
|
102
|
+
hasAlias(aliasPath) {
|
|
103
|
+
return this._aliases.has(aliasPath);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get a specific alias by path
|
|
107
|
+
* @param aliasPath - The path of the alias
|
|
108
|
+
*/
|
|
109
|
+
getAlias(aliasPath) {
|
|
110
|
+
return this._aliases.get(aliasPath);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Add multiple aliases at once
|
|
114
|
+
* @param aliases - Array of alias configurations
|
|
115
|
+
*/
|
|
116
|
+
addAliases(aliases) {
|
|
117
|
+
aliases.forEach((config) => {
|
|
118
|
+
this.addAlias(config.alias || config.path, config.directory, config.path);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Clear all aliases
|
|
123
|
+
*/
|
|
124
|
+
clearAliases() {
|
|
125
|
+
this._aliases.clear();
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Update an existing alias
|
|
129
|
+
* @param aliasPath - The path of the alias to update
|
|
130
|
+
* @param updates - Partial updates to apply
|
|
131
|
+
*/
|
|
132
|
+
updateAlias(aliasPath, updates) {
|
|
133
|
+
const alias = this._aliases.get(aliasPath);
|
|
134
|
+
if (alias) {
|
|
135
|
+
Object.assign(alias, updates);
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get statistics about configured aliases
|
|
142
|
+
*/
|
|
143
|
+
getStats() {
|
|
144
|
+
const aliases = this.getAliases();
|
|
145
|
+
const enabled = aliases.filter((a) => a.enabled !== false);
|
|
146
|
+
const disabled = aliases.filter((a) => a.enabled === false);
|
|
147
|
+
const directories = [...new Set(aliases.map((a) => a.directory))];
|
|
148
|
+
return {
|
|
149
|
+
total: aliases.length,
|
|
150
|
+
enabled: enabled.length,
|
|
151
|
+
disabled: disabled.length,
|
|
152
|
+
directories
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Checks if a given path is configured in the proxy (legacy method)
|
|
157
|
+
* @deprecated Use findMatchingAlias instead
|
|
158
|
+
* @param path
|
|
159
|
+
* @returns
|
|
160
|
+
*/
|
|
161
|
+
has(path) {
|
|
162
|
+
const alias = this.findMatchingAlias(path);
|
|
163
|
+
return alias ? !!alias.directory : false;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Gets the directory for a given path if configured (legacy method)
|
|
167
|
+
*
|
|
168
|
+
* @param path
|
|
169
|
+
* @returns
|
|
170
|
+
*/
|
|
171
|
+
get(path) {
|
|
172
|
+
const alias = this.findMatchingAlias(path);
|
|
173
|
+
return alias ? alias.directory : void 0;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export { A_StaticConfig };
|
|
178
|
+
//# sourceMappingURL=A-ServerStatic.context.mjs.map
|
|
179
|
+
//# sourceMappingURL=A-ServerStatic.context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/A-ServerStatic/A-ServerStatic.context.ts"],"names":[],"mappings":";;;AAeO,MAAM,uBAAuB,UAAA,CAAW;AAAA,EAM3C,YAII,WAAA,GAAwB,EAAC,EAIzB,gBAAA,GAA8C,EAAC,EACjD;AACE,IAAA,KAAA,EAAM;AAbV,IAAA,IAAA,CAAQ,QAAA,uBAA2C,GAAA,EAAI;AACvD,IAAA,IAAA,CAAQ,oBAA+C,EAAC;AAcpD,IAAA,IAAA,CAAK,WAAA,GAAc,WAAA;AACnB,IAAA,IAAA,CAAK,iBAAA,GAAoB,gBAAA;AAGzB,IAAA,IAAA,CAAK,wBAAA,EAAy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AO,CAAA,CAAA,KAAK,CAAA,CAAE,YAAY,KAAK,CAAA;AACxD,IAAA,MAAM,WAAA,GAAc,CAAC,GAAG,IAAI,GAAA,CAAI,OAAA,CAAQ,GAAA,CAAI,CAAA,CAAA,KAAK,CAAA,CAAE,SAAS,CAAC,CAAC,CAAA;AAE9D,IAAA,OAAO;AAAA,MACH,OAAO,OAAA,CAAQ,MAAA;AAAA,MACf,SAAS,OAAA,CAAQ,MAAA;AAAA,MACjB,UAAU,QAAA,CAAS,MAAA;AAAA,MACnB;AAAA,KACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,IAAA,EAAuB;AACvB,IAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,iBAAA,CAAkB,IAAI,CAAA;AACzC,IAAA,OAAO,KAAA,GAAQ,CAAC,CAAC,KAAA,CAAM,SAAA,GAAY,KAAA;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,IAAA,EAAkC;AAClC,IAAA,MAAM,KAAA,GAAQ,IAAA,CAAK,iBAAA,CAAkB,IAAI,CAAA;AACzC,IAAA,OAAO,KAAA,GAAQ,MAAM,SAAA,GAAY,MAAA;AAAA,EACrC;AACJ","file":"A-ServerStatic.context.mjs","sourcesContent":["import { A_Fragment } from \"@adaas/a-concept\";\n\nexport interface A_StaticAlias {\n alias: string;\n path: string;\n directory: string;\n enabled?: boolean;\n}\n\nexport interface A_StaticDirectoryConfig {\n path: string;\n directory: string;\n alias?: string;\n}\n\nexport class A_StaticConfig extends A_Fragment {\n\n readonly directories: Array<string>;\n private _aliases: Map<string, A_StaticAlias> = new Map();\n private _directoryConfigs: A_StaticDirectoryConfig[] = [];\n\n constructor(\n /**\n * Setup directories to serve static files from, comma separated\n */\n directories: string[] = [],\n /**\n * Custom directory configurations with aliases\n */\n directoryConfigs: A_StaticDirectoryConfig[] = []\n ) {\n super();\n\n this.directories = directories;\n this._directoryConfigs = directoryConfigs;\n\n // Initialize default aliases from directories\n this.initializeDefaultAliases();\n\n // Initialize custom aliases from directoryConfigs\n this.initializeCustomAliases();\n }\n\n private initializeDefaultAliases(): void {\n this.directories.forEach((dir, index) => {\n const alias: A_StaticAlias = {\n alias: `/static${index > 0 ? index : ''}`,\n path: `/static${index > 0 ? index : ''}`,\n directory: dir,\n enabled: true\n };\n this._aliases.set(alias.path, alias);\n });\n }\n\n private initializeCustomAliases(): void {\n this._directoryConfigs.forEach((config) => {\n const alias: A_StaticAlias = {\n alias: config.alias || config.path,\n path: config.path,\n directory: config.directory,\n enabled: true\n };\n this._aliases.set(alias.path, alias);\n });\n }\n\n /**\n * Add a custom static file alias\n * @param alias - The URL path alias (e.g., '/assets')\n * @param directory - The local directory path\n * @param path - Optional custom path (defaults to alias)\n */\n public addAlias(alias: string, directory: string, path?: string): void {\n const staticAlias: A_StaticAlias = {\n alias,\n path: path || alias,\n directory,\n enabled: true\n };\n\n this._aliases.set(staticAlias.path, staticAlias);\n }\n\n /**\n * Remove a static file alias\n * @param aliasPath - The path of the alias to remove\n */\n public removeAlias(aliasPath: string): boolean {\n return this._aliases.delete(aliasPath);\n }\n\n /**\n * Enable or disable an alias\n * @param aliasPath - The path of the alias\n * @param enabled - Whether to enable or disable\n */\n public setAliasEnabled(aliasPath: string, enabled: boolean): boolean {\n const alias = this._aliases.get(aliasPath);\n if (alias) {\n alias.enabled = enabled;\n return true;\n }\n return false;\n }\n\n /**\n * Get all configured aliases\n */\n public getAliases(): A_StaticAlias[] {\n return Array.from(this._aliases.values());\n }\n\n /**\n * Get enabled aliases only\n */\n public getEnabledAliases(): A_StaticAlias[] {\n return Array.from(this._aliases.values()).filter(alias => alias.enabled !== false);\n }\n\n /**\n * Find the best matching alias for a given request path\n * @param requestPath - The request path to match\n */\n public findMatchingAlias(requestPath: string): A_StaticAlias | null {\n let bestMatch: A_StaticAlias | null = null;\n let longestMatch = 0;\n\n for (const alias of this.getEnabledAliases()) {\n if (requestPath.startsWith(alias.path) && alias.path.length > longestMatch) {\n bestMatch = alias;\n longestMatch = alias.path.length;\n }\n }\n\n return bestMatch;\n }\n\n /**\n * Check if an alias exists\n * @param aliasPath - The path to check\n */\n public hasAlias(aliasPath: string): boolean {\n return this._aliases.has(aliasPath);\n }\n\n /**\n * Get a specific alias by path\n * @param aliasPath - The path of the alias\n */\n public getAlias(aliasPath: string): A_StaticAlias | undefined {\n return this._aliases.get(aliasPath);\n }\n\n /**\n * Add multiple aliases at once\n * @param aliases - Array of alias configurations\n */\n public addAliases(aliases: A_StaticDirectoryConfig[]): void {\n aliases.forEach(config => {\n this.addAlias(config.alias || config.path, config.directory, config.path);\n });\n }\n\n /**\n * Clear all aliases\n */\n public clearAliases(): void {\n this._aliases.clear();\n }\n\n /**\n * Update an existing alias\n * @param aliasPath - The path of the alias to update\n * @param updates - Partial updates to apply\n */\n public updateAlias(aliasPath: string, updates: Partial<A_StaticAlias>): boolean {\n const alias = this._aliases.get(aliasPath);\n if (alias) {\n Object.assign(alias, updates);\n return true;\n }\n return false;\n }\n\n /**\n * Get statistics about configured aliases\n */\n public getStats(): {\n total: number;\n enabled: number;\n disabled: number;\n directories: string[];\n } {\n const aliases = this.getAliases();\n const enabled = aliases.filter(a => a.enabled !== false);\n const disabled = aliases.filter(a => a.enabled === false);\n const directories = [...new Set(aliases.map(a => a.directory))];\n\n return {\n total: aliases.length,\n enabled: enabled.length,\n disabled: disabled.length,\n directories\n };\n }\n\n /**\n * Checks if a given path is configured in the proxy (legacy method)\n * @deprecated Use findMatchingAlias instead\n * @param path \n * @returns \n */\n has(path: string): boolean {\n const alias = this.findMatchingAlias(path);\n return alias ? !!alias.directory : false;\n }\n\n /**\n * Gets the directory for a given path if configured (legacy method)\n * \n * @param path \n * @returns \n */\n get(path: string): string | undefined {\n const alias = this.findMatchingAlias(path);\n return alias ? alias.directory : undefined;\n }\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"A-ServerStatic.types.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"A-ServerStatic.types.mjs"}
|