@asenajs/asena 0.1.18 → 0.2.0
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/README.md +90 -147
- package/dist/index.d.ts +0 -9
- package/dist/index.js +0 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/adapter/AsenaAdapter.d.ts +46 -54
- package/dist/lib/adapter/AsenaAdapter.js +22 -11
- package/dist/lib/adapter/AsenaAdapter.js.map +1 -1
- package/dist/lib/adapter/AsenaContext.d.ts +67 -57
- package/dist/lib/adapter/AsenaWebsocketAdapter.d.ts +57 -34
- package/dist/lib/adapter/AsenaWebsocketAdapter.js +43 -12
- package/dist/lib/adapter/AsenaWebsocketAdapter.js.map +1 -1
- package/dist/lib/adapter/index.d.ts +1 -0
- package/dist/lib/adapter/index.js +1 -0
- package/dist/lib/adapter/index.js.map +1 -1
- package/dist/lib/adapter/types/ApiParams.d.ts +73 -0
- package/dist/lib/adapter/types/ApiParams.js +2 -0
- package/dist/lib/adapter/types/ApiParams.js.map +1 -0
- package/dist/lib/adapter/types/AsenaHandler.d.ts +2 -0
- package/dist/lib/adapter/types/AsenaHandler.js +2 -0
- package/dist/lib/adapter/types/AsenaHandler.js.map +1 -0
- package/dist/lib/adapter/types/AsenaMiddlewareHandler.d.ts +2 -0
- package/dist/lib/adapter/types/AsenaMiddlewareHandler.js +2 -0
- package/dist/lib/adapter/types/AsenaMiddlewareHandler.js.map +1 -0
- package/dist/lib/adapter/types/BaseMiddleware.d.ts +57 -0
- package/dist/lib/adapter/types/BaseMiddleware.js +2 -0
- package/dist/lib/adapter/types/BaseMiddleware.js.map +1 -0
- package/dist/lib/adapter/types/ErrorHandler.d.ts +2 -0
- package/dist/lib/adapter/types/ErrorHandler.js +2 -0
- package/dist/lib/adapter/types/ErrorHandler.js.map +1 -0
- package/dist/lib/adapter/types/RouteParams.d.ts +8 -5
- package/dist/lib/adapter/types/ServeOptions.d.ts +7 -0
- package/dist/lib/adapter/types/ServeOptions.js +2 -0
- package/dist/lib/adapter/types/ServeOptions.js.map +1 -0
- package/dist/lib/adapter/types/WebSocketRegistry.d.ts +5 -4
- package/dist/lib/adapter/types/WebsocketAdapterParams.d.ts +1 -1
- package/dist/lib/adapter/types/index.d.ts +6 -0
- package/dist/lib/adapter/types/index.js +6 -0
- package/dist/lib/adapter/types/index.js.map +1 -1
- package/dist/lib/ioc/Container.d.ts +8 -3
- package/dist/lib/ioc/Container.js +100 -76
- package/dist/lib/ioc/Container.js.map +1 -1
- package/dist/lib/ioc/IocEngine.d.ts +2 -2
- package/dist/lib/ioc/IocEngine.js +28 -16
- package/dist/lib/ioc/IocEngine.js.map +1 -1
- package/dist/lib/ioc/component/componentUtils.d.ts +1 -1
- package/dist/lib/ioc/component/componentUtils.js +16 -12
- package/dist/lib/ioc/component/componentUtils.js.map +1 -1
- package/dist/lib/{server/decorators/components → ioc/component/decorators}/Component.d.ts +1 -1
- package/dist/lib/{server/decorators/components → ioc/component/decorators}/Component.js +2 -2
- package/dist/lib/ioc/component/decorators/Component.js.map +1 -0
- package/dist/lib/ioc/component/decorators/Implements.js +2 -2
- package/dist/lib/ioc/component/decorators/Implements.js.map +1 -1
- package/dist/lib/ioc/component/decorators/Inject.d.ts +1 -1
- package/dist/lib/ioc/component/decorators/Inject.js +6 -7
- package/dist/lib/ioc/component/decorators/Inject.js.map +1 -1
- package/dist/lib/ioc/component/decorators/PostConstruct.d.ts +6 -0
- package/dist/lib/ioc/component/decorators/PostConstruct.js +17 -0
- package/dist/lib/ioc/component/decorators/PostConstruct.js.map +1 -0
- package/dist/lib/ioc/component/decorators/Strategy.js +6 -6
- package/dist/lib/ioc/component/decorators/Strategy.js.map +1 -1
- package/dist/lib/ioc/component/decorators/index.d.ts +1 -0
- package/dist/lib/ioc/component/decorators/index.js +1 -0
- package/dist/lib/ioc/component/decorators/index.js.map +1 -1
- package/dist/lib/ioc/component/index.d.ts +1 -0
- package/dist/lib/ioc/component/index.js +2 -0
- package/dist/lib/ioc/component/index.js.map +1 -0
- package/dist/lib/ioc/constants/ComponentConstants.d.ts +4 -2
- package/dist/lib/ioc/constants/ComponentConstants.js +3 -1
- package/dist/lib/ioc/constants/ComponentConstants.js.map +1 -1
- package/dist/lib/ioc/helper/fileHelper.d.ts +1 -1
- package/dist/lib/ioc/helper/fileHelper.js +9 -3
- package/dist/lib/ioc/helper/fileHelper.js.map +1 -1
- package/dist/lib/ioc/helper/iocHelper.d.ts +2 -3
- package/dist/lib/ioc/helper/iocHelper.js +4 -2
- package/dist/lib/ioc/helper/iocHelper.js.map +1 -1
- package/dist/lib/ioc/types/{Component.d.ts → InjectableComponent.d.ts} +4 -4
- package/dist/lib/ioc/types/InjectableComponent.js +2 -0
- package/dist/lib/ioc/types/InjectableComponent.js.map +1 -0
- package/dist/lib/ioc/types/IocConfig.d.ts +1 -0
- package/dist/lib/ioc/types/decorators/ComponentParams.d.ts +1 -1
- package/dist/lib/ioc/types/decorators/ComponentType.d.ts +2 -2
- package/dist/lib/ioc/types/decorators/ComponentType.js +1 -1
- package/dist/lib/ioc/types/decorators/ComponentType.js.map +1 -1
- package/dist/lib/ioc/types/decorators/ControllerParams.d.ts +4 -3
- package/dist/lib/ioc/types/decorators/MiddlewareParams.d.ts +1 -1
- package/dist/lib/ioc/types/index.d.ts +1 -1
- package/dist/lib/ioc/types/index.js +1 -1
- package/dist/lib/ioc/types/index.js.map +1 -1
- package/dist/lib/{services/logger → logger}/DefaultLogger.d.ts +1 -1
- package/dist/lib/logger/DefaultLogger.js.map +1 -0
- package/dist/lib/{services/types → logger}/Logger.js.map +1 -1
- package/dist/lib/logger/index.d.ts +2 -0
- package/dist/lib/logger/index.js +3 -0
- package/dist/lib/logger/index.js.map +1 -0
- package/dist/lib/server/AsenaServer.d.ts +15 -14
- package/dist/lib/server/AsenaServer.js +125 -113
- package/dist/lib/server/AsenaServer.js.map +1 -1
- package/dist/lib/server/config/AsenaConfig.d.ts +43 -0
- package/dist/lib/server/config/AsenaConfig.js +2 -0
- package/dist/lib/server/config/AsenaConfig.js.map +1 -0
- package/dist/lib/server/config/index.d.ts +1 -0
- package/dist/lib/server/config/index.js +2 -0
- package/dist/lib/server/config/index.js.map +1 -0
- package/dist/lib/server/decorators/Override.d.ts +4 -4
- package/dist/lib/server/decorators/Override.js +11 -7
- package/dist/lib/server/decorators/Override.js.map +1 -1
- package/dist/lib/server/decorators/components/Config.d.ts +10 -0
- package/dist/lib/server/decorators/components/Config.js +14 -0
- package/dist/lib/server/decorators/components/Config.js.map +1 -0
- package/dist/lib/server/decorators/components/Controller.js +4 -4
- package/dist/lib/server/decorators/components/Controller.js.map +1 -1
- package/dist/lib/server/decorators/components/Middleware.d.ts +1 -1
- package/dist/lib/server/decorators/components/Middleware.js +19 -9
- package/dist/lib/server/decorators/components/Middleware.js.map +1 -1
- package/dist/lib/server/decorators/components/Schedule.d.ts +2 -2
- package/dist/lib/server/decorators/components/Schedule.js +7 -7
- package/dist/lib/server/decorators/components/Schedule.js.map +1 -1
- package/dist/lib/server/decorators/components/Service.d.ts +1 -1
- package/dist/lib/server/decorators/components/Service.js +2 -2
- package/dist/lib/server/decorators/components/Service.js.map +1 -1
- package/dist/lib/server/decorators/components/WebSocket.js +4 -4
- package/dist/lib/server/decorators/components/WebSocket.js.map +1 -1
- package/dist/lib/server/decorators/components/index.d.ts +1 -2
- package/dist/lib/server/decorators/components/index.js +1 -2
- package/dist/lib/server/decorators/components/index.js.map +1 -1
- package/dist/lib/server/decorators/index.d.ts +2 -1
- package/dist/lib/server/decorators/index.js +2 -1
- package/dist/lib/server/decorators/index.js.map +1 -1
- package/dist/lib/server/types/Class.d.ts +0 -3
- package/dist/lib/server/types/index.d.ts +2 -2
- package/dist/lib/server/types/index.js +2 -2
- package/dist/lib/server/types/index.js.map +1 -1
- package/dist/lib/server/web/decorators/http.base.d.ts +4 -0
- package/dist/lib/server/web/decorators/http.base.js +35 -0
- package/dist/lib/server/web/decorators/http.base.js.map +1 -0
- package/dist/lib/server/web/decorators/index.d.ts +4 -0
- package/dist/lib/server/web/decorators/index.js +5 -0
- package/dist/lib/server/web/decorators/index.js.map +1 -0
- package/dist/lib/server/web/decorators/methods/Connect.d.ts +7 -0
- package/dist/lib/server/web/decorators/methods/Connect.js +12 -0
- package/dist/lib/server/web/decorators/methods/Connect.js.map +1 -0
- package/dist/lib/server/web/decorators/methods/Delete.d.ts +7 -0
- package/dist/lib/server/web/decorators/methods/Delete.js +12 -0
- package/dist/lib/server/web/decorators/methods/Delete.js.map +1 -0
- package/dist/lib/server/web/decorators/methods/Get.d.ts +7 -0
- package/dist/lib/server/web/decorators/methods/Get.js +12 -0
- package/dist/lib/server/web/decorators/methods/Get.js.map +1 -0
- package/dist/lib/server/web/decorators/methods/Head.d.ts +7 -0
- package/dist/lib/server/web/decorators/methods/Head.js +12 -0
- package/dist/lib/server/web/decorators/methods/Head.js.map +1 -0
- package/dist/lib/server/web/decorators/methods/Options.d.ts +7 -0
- package/dist/lib/server/web/decorators/methods/Options.js +12 -0
- package/dist/lib/server/web/decorators/methods/Options.js.map +1 -0
- package/dist/lib/server/web/decorators/methods/Patch.d.ts +7 -0
- package/dist/lib/server/web/decorators/methods/Patch.js +12 -0
- package/dist/lib/server/web/decorators/methods/Patch.js.map +1 -0
- package/dist/lib/server/web/decorators/methods/Post.d.ts +7 -0
- package/dist/lib/server/web/decorators/methods/Post.js +12 -0
- package/dist/lib/server/web/decorators/methods/Post.js.map +1 -0
- package/dist/lib/server/web/decorators/methods/Put.d.ts +7 -0
- package/dist/lib/server/web/decorators/methods/Put.js +12 -0
- package/dist/lib/server/web/decorators/methods/Put.js.map +1 -0
- package/dist/lib/server/web/decorators/methods/Trace.d.ts +7 -0
- package/dist/lib/server/web/decorators/methods/Trace.js +12 -0
- package/dist/lib/server/web/decorators/methods/Trace.js.map +1 -0
- package/dist/lib/server/web/decorators/methods/index.d.ts +9 -0
- package/dist/lib/server/web/decorators/methods/index.js +10 -0
- package/dist/lib/server/web/decorators/methods/index.js.map +1 -0
- package/dist/lib/server/web/helper/middlewareHelper.d.ts +8 -2
- package/dist/lib/server/web/helper/middlewareHelper.js +11 -5
- package/dist/lib/server/web/helper/middlewareHelper.js.map +1 -1
- package/dist/lib/server/web/middleware/AsenaMiddlewareService.d.ts +8 -10
- package/dist/lib/server/web/middleware/AsenaMiddlewareService.js +1 -4
- package/dist/lib/server/web/middleware/AsenaMiddlewareService.js.map +1 -1
- package/dist/lib/server/web/middleware/AsenaValidationService.d.ts +15 -16
- package/dist/lib/server/web/middleware/AsenaValidationService.js +1 -8
- package/dist/lib/server/web/middleware/AsenaValidationService.js.map +1 -1
- package/dist/lib/server/web/types/HttpMethod.js.map +1 -0
- package/dist/lib/server/web/types/HttpStatus.d.ts +79 -0
- package/dist/lib/server/web/types/HttpStatus.js +85 -0
- package/dist/lib/server/web/types/HttpStatus.js.map +1 -0
- package/dist/lib/server/web/types/index.d.ts +2 -2
- package/dist/lib/server/web/types/index.js +2 -2
- package/dist/lib/server/web/types/index.js.map +1 -1
- package/dist/lib/server/web/websocket/AsenaSocket.d.ts +1 -0
- package/dist/lib/server/web/websocket/AsenaSocket.js +4 -0
- package/dist/lib/server/web/websocket/AsenaSocket.js.map +1 -1
- package/dist/lib/server/web/websocket/AsenaWebSocketServer.d.ts +39 -0
- package/dist/lib/server/web/websocket/AsenaWebSocketServer.js +41 -1
- package/dist/lib/server/web/websocket/AsenaWebSocketServer.js.map +1 -1
- package/dist/lib/server/web/websocket/AsenaWebSocketService.js +4 -4
- package/dist/lib/server/web/websocket/AsenaWebSocketService.js.map +1 -1
- package/dist/lib/server/web/websocket/index.d.ts +1 -0
- package/dist/lib/server/web/websocket/index.js +1 -0
- package/dist/lib/server/web/websocket/index.js.map +1 -1
- package/dist/lib/utils/typedMetadata.d.ts +3 -0
- package/dist/lib/utils/typedMetadata.js +16 -0
- package/dist/lib/utils/typedMetadata.js.map +1 -0
- package/package.json +55 -6
- package/dist/lib/adapter/defaultAdapter/DefaultAdapter.d.ts +0 -26
- package/dist/lib/adapter/defaultAdapter/DefaultAdapter.js +0 -92
- package/dist/lib/adapter/defaultAdapter/DefaultAdapter.js.map +0 -1
- package/dist/lib/adapter/defaultAdapter/DefaultContextWrapper.d.ts +0 -32
- package/dist/lib/adapter/defaultAdapter/DefaultContextWrapper.js +0 -97
- package/dist/lib/adapter/defaultAdapter/DefaultContextWrapper.js.map +0 -1
- package/dist/lib/adapter/defaultAdapter/DefaultWebsocketAdapter.d.ts +0 -15
- package/dist/lib/adapter/defaultAdapter/DefaultWebsocketAdapter.js +0 -77
- package/dist/lib/adapter/defaultAdapter/DefaultWebsocketAdapter.js.map +0 -1
- package/dist/lib/adapter/defaultAdapter/index.d.ts +0 -3
- package/dist/lib/adapter/defaultAdapter/index.js +0 -4
- package/dist/lib/adapter/defaultAdapter/index.js.map +0 -1
- package/dist/lib/adapter/defaultAdapter/types/Defaultcontext.d.ts +0 -3
- package/dist/lib/adapter/defaultAdapter/types/Defaultcontext.js +0 -2
- package/dist/lib/adapter/defaultAdapter/types/Defaultcontext.js.map +0 -1
- package/dist/lib/adapter/defaultAdapter/types/Handler.d.ts +0 -4
- package/dist/lib/adapter/defaultAdapter/types/Handler.js +0 -2
- package/dist/lib/adapter/defaultAdapter/types/Handler.js.map +0 -1
- package/dist/lib/adapter/defaultAdapter/types/index.d.ts +0 -2
- package/dist/lib/adapter/defaultAdapter/types/index.js +0 -3
- package/dist/lib/adapter/defaultAdapter/types/index.js.map +0 -1
- package/dist/lib/ioc/types/Component.js +0 -2
- package/dist/lib/ioc/types/Component.js.map +0 -1
- package/dist/lib/server/decorators/components/Component.js.map +0 -1
- package/dist/lib/server/decorators/components/ServerService.d.ts +0 -9
- package/dist/lib/server/decorators/components/ServerService.js +0 -13
- package/dist/lib/server/decorators/components/ServerService.js.map +0 -1
- package/dist/lib/server/web/api/apiHandler.d.ts +0 -55
- package/dist/lib/server/web/api/apiHandler.js +0 -107
- package/dist/lib/server/web/api/apiHandler.js.map +0 -1
- package/dist/lib/server/web/api/index.d.ts +0 -1
- package/dist/lib/server/web/api/index.js +0 -2
- package/dist/lib/server/web/api/index.js.map +0 -1
- package/dist/lib/server/web/http/HttpMethod.js.map +0 -1
- package/dist/lib/server/web/http/HttpStatus.d.ts +0 -77
- package/dist/lib/server/web/http/HttpStatus.js +0 -84
- package/dist/lib/server/web/http/HttpStatus.js.map +0 -1
- package/dist/lib/server/web/http/index.d.ts +0 -2
- package/dist/lib/server/web/http/index.js +0 -3
- package/dist/lib/server/web/http/index.js.map +0 -1
- package/dist/lib/server/web/types/ApiHandler.d.ts +0 -22
- package/dist/lib/server/web/types/ApiHandler.js +0 -2
- package/dist/lib/server/web/types/ApiHandler.js.map +0 -1
- package/dist/lib/server/web/types/BaseMiddleware.d.ts +0 -12
- package/dist/lib/server/web/types/BaseMiddleware.js +0 -2
- package/dist/lib/server/web/types/BaseMiddleware.js.map +0 -1
- package/dist/lib/services/index.d.ts +0 -3
- package/dist/lib/services/index.js +0 -4
- package/dist/lib/services/index.js.map +0 -1
- package/dist/lib/services/logger/DefaultLogger.js.map +0 -1
- package/dist/lib/services/serverService/AsenaService.d.ts +0 -7
- package/dist/lib/services/serverService/AsenaService.js +0 -7
- package/dist/lib/services/serverService/AsenaService.js.map +0 -1
- package/dist/lib/services/types/index.d.ts +0 -2
- package/dist/lib/services/types/index.js +0 -3
- package/dist/lib/services/types/index.js.map +0 -1
- /package/dist/lib/{services/logger → logger}/DefaultLogger.js +0 -0
- /package/dist/lib/{services/types → logger}/Logger.d.ts +0 -0
- /package/dist/lib/{services/types → logger}/Logger.js +0 -0
- /package/dist/lib/server/web/{http → types}/HttpMethod.d.ts +0 -0
- /package/dist/lib/server/web/{http → types}/HttpMethod.js +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { ComponentType } from
|
|
2
|
-
import { defineComponent } from
|
|
3
|
-
import { parseCron } from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { ComponentType } from '../../../ioc/types';
|
|
2
|
+
import { defineComponent } from '../../../ioc/component';
|
|
3
|
+
import { parseCron } from '../../../ioc/helper/cronParser';
|
|
4
|
+
import { ComponentConstants } from '../../../ioc/constants';
|
|
5
|
+
import { defineTypedMetadata } from '../../../utils/typedMetadata';
|
|
6
6
|
/**
|
|
7
|
-
* Not working right now.
|
|
7
|
+
* @deprecated Not working right now.
|
|
8
8
|
*
|
|
9
9
|
* @param params
|
|
10
10
|
* @constructor
|
|
@@ -12,7 +12,7 @@ import { ComponentConstants } from "../../../ioc/constants";
|
|
|
12
12
|
export const Schedule = (params) => {
|
|
13
13
|
return defineComponent(ComponentType.SCHEDULE, params, (target) => {
|
|
14
14
|
const cronParsed = parseCron(params.cron);
|
|
15
|
-
|
|
15
|
+
defineTypedMetadata(ComponentConstants.CronKey, cronParsed, target);
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
//# sourceMappingURL=Schedule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schedule.js","sourceRoot":"","sources":["../../../../../lib/server/decorators/components/Schedule.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Schedule.js","sourceRoot":"","sources":["../../../../../lib/server/decorators/components/Schedule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuB,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAmB,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,MAAsB,EAAkB,EAAE;IACjE,OAAO,eAAe,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;QAChE,MAAM,UAAU,GAAG,SAAS,CAAE,MAAyB,CAAC,IAAI,CAAC,CAAC;QAE9D,mBAAmB,CAAa,kBAAkB,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ComponentType } from
|
|
2
|
-
import { defineComponent } from
|
|
1
|
+
import { ComponentType } from '../../../ioc/types';
|
|
2
|
+
import { defineComponent } from '../../../ioc/component';
|
|
3
3
|
/**
|
|
4
4
|
* Decorator for defining a Service component.
|
|
5
5
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../../../lib/server/decorators/components/Service.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Service.js","sourceRoot":"","sources":["../../../../../lib/server/decorators/components/Service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAsB,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAA+B,EAAkB,EAAE;IACzE,OAAO,eAAe,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ComponentType } from '../../../ioc/types';
|
|
2
|
-
import { defineComponent } from '../../../ioc/component
|
|
3
|
-
import { defineMetadata } from 'reflect-metadata/no-conflict';
|
|
2
|
+
import { defineComponent } from '../../../ioc/component';
|
|
4
3
|
import { ComponentConstants } from '../../../ioc/constants';
|
|
5
4
|
import { defineMiddleware } from '../../web/helper';
|
|
5
|
+
import { defineTypedMetadata } from '../../../utils/typedMetadata';
|
|
6
6
|
/**
|
|
7
7
|
* Decorator for defining a WebSocket component.
|
|
8
8
|
*
|
|
@@ -13,9 +13,9 @@ export const WebSocket = (params) => {
|
|
|
13
13
|
return defineComponent(ComponentType.WEBSOCKET, params, (target) => {
|
|
14
14
|
let path = typeof params === 'string' ? params : params.path;
|
|
15
15
|
path = path.replace(/^\/+/, '');
|
|
16
|
-
|
|
16
|
+
defineTypedMetadata(ComponentConstants.PathKey, path, target);
|
|
17
17
|
defineMiddleware(target, params.middlewares || []);
|
|
18
|
-
|
|
18
|
+
defineTypedMetadata(ComponentConstants.MiddlewaresKey, params.middlewares || [], target);
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
//# sourceMappingURL=WebSocket.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebSocket.js","sourceRoot":"","sources":["../../../../../lib/server/decorators/components/WebSocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAyB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"WebSocket.js","sourceRoot":"","sources":["../../../../../lib/server/decorators/components/WebSocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAyB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAInE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAiC,EAAkB,EAAE;IAC7E,OAAO,eAAe,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;QACjE,IAAI,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;QAE7D,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAEhC,mBAAmB,CAAS,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAEtE,gBAAgB,CAAC,MAAM,EAAG,MAA2B,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;QAEzE,mBAAmB,CACjB,kBAAkB,CAAC,cAAc,EAChC,MAA2B,CAAC,WAAW,IAAI,EAAE,EAC9C,MAAM,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from '../../../ioc/component/decorators/Component';
|
|
2
2
|
export * from './Controller';
|
|
3
3
|
export * from './Middleware';
|
|
4
4
|
export * from './Schedule';
|
|
5
|
-
export * from './ServerService';
|
|
6
5
|
export * from './Service';
|
|
7
6
|
export * from './WebSocket';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from '../../../ioc/component/decorators/Component';
|
|
2
2
|
export * from './Controller';
|
|
3
3
|
export * from './Middleware';
|
|
4
4
|
export * from './Schedule';
|
|
5
|
-
export * from './ServerService';
|
|
6
5
|
export * from './Service';
|
|
7
6
|
export * from './WebSocket';
|
|
8
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lib/server/decorators/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lib/server/decorators/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/server/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/server/decorators/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import type { AsenaMiddlewareService, AsenaValidationService } from '../web/middleware';
|
|
2
1
|
export type Class<T = any> = new (...args: any[]) => T;
|
|
3
|
-
export type MiddlewareClass = Class<AsenaMiddlewareService<any, any>>;
|
|
4
|
-
export type ValidatorClass<T> = Class<AsenaValidationService<T>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from '../web/
|
|
1
|
+
export * from '../web/types/HttpMethod';
|
|
2
2
|
export * from './Class';
|
|
3
|
-
export * from '../web/
|
|
3
|
+
export * from '../web/types/HttpStatus';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/server/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/server/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ApiParams, ControllerDecoratorParams, ControllerHandler } from "../../../adapter";
|
|
2
|
+
export declare function genericHandler({ method, path, description, middlewares, staticServe, validator }: ApiParams): (route: Object, propertyKey: string, _descriptor: TypedPropertyDescriptor<ControllerHandler>) => void;
|
|
3
|
+
export declare const DEFAULT_PARAMS: ControllerDecoratorParams;
|
|
4
|
+
export declare const generateHandlerParams: (params: ControllerDecoratorParams | string) => ControllerDecoratorParams;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ComponentConstants } from '../../../ioc/constants';
|
|
2
|
+
import { defineMiddleware } from '../helper';
|
|
3
|
+
import { defineTypedMetadata, getOwnTypedMetadata } from '../../../utils/typedMetadata';
|
|
4
|
+
export function genericHandler({ method, path, description, middlewares, staticServe, validator }) {
|
|
5
|
+
return function (route, propertyKey, _descriptor) {
|
|
6
|
+
const routes = getOwnTypedMetadata(ComponentConstants.RouteKey, route.constructor) || {};
|
|
7
|
+
if (!routes[propertyKey]) {
|
|
8
|
+
routes[propertyKey] = { path, method, description, middlewares, staticServe, validator };
|
|
9
|
+
}
|
|
10
|
+
defineTypedMetadata(ComponentConstants.RouteKey, routes, route.constructor);
|
|
11
|
+
defineMiddleware(route.constructor, middlewares);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export const DEFAULT_PARAMS = {
|
|
15
|
+
path: '',
|
|
16
|
+
middlewares: [],
|
|
17
|
+
description: '',
|
|
18
|
+
staticServe: false,
|
|
19
|
+
validator: undefined,
|
|
20
|
+
};
|
|
21
|
+
export const generateHandlerParams = (params) => {
|
|
22
|
+
if (typeof params === 'string') {
|
|
23
|
+
return {
|
|
24
|
+
...DEFAULT_PARAMS,
|
|
25
|
+
path: normalizePathString(params),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
...DEFAULT_PARAMS,
|
|
30
|
+
...params,
|
|
31
|
+
path: normalizePathString(params.path),
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const normalizePathString = (path) => path.replace(/^\/+/, '');
|
|
35
|
+
//# sourceMappingURL=http.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.base.js","sourceRoot":"","sources":["../../../../../lib/server/web/decorators/http.base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAQxF,MAAM,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAa;IAC1G,OAAO,UAAU,KAAa,EAAE,WAAmB,EAAE,WAAuD;QAC1G,MAAM,MAAM,GAAG,mBAAmB,CAAQ,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAEhG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;YACzB,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;QAC3F,CAAC;QAED,mBAAmB,CAAQ,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;QAEnF,gBAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACnD,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAA8B;IACvD,IAAI,EAAE,EAAE;IACR,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,SAAS;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAA0C,EAA6B,EAAE;IAC7G,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO;YACL,GAAG,cAAc;YACjB,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC;SAClC,CAAC;IACJ,CAAC;IAED,OAAO;QACL,GAAG,cAAc;QACjB,GAAG,MAAM;QACT,IAAI,EAAE,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC;KACvC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lib/server/web/decorators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ControllerDecoratorParams } from "../../../../adapter";
|
|
2
|
+
/**
|
|
3
|
+
* Decorator for handling HTTP CONNECT requests.
|
|
4
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the CONNECT request.
|
|
5
|
+
* @returns {Function} The generic handler for the CONNECT request.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Connect(params: ControllerDecoratorParams | string): Function;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generateHandlerParams, genericHandler } from '../http.base';
|
|
2
|
+
import { HttpMethod } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for handling HTTP CONNECT requests.
|
|
5
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the CONNECT request.
|
|
6
|
+
* @returns {Function} The generic handler for the CONNECT request.
|
|
7
|
+
*/
|
|
8
|
+
export function Connect(params) {
|
|
9
|
+
const { path, middlewares, description, staticServe, validator } = generateHandlerParams(params);
|
|
10
|
+
return genericHandler({ method: HttpMethod.CONNECT, path, middlewares, description, staticServe, validator });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Connect.js","sourceRoot":"","sources":["../../../../../../lib/server/web/decorators/methods/Connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,MAA0C;IAChE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEjG,OAAO,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;AAChH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ControllerDecoratorParams } from "../../../../adapter";
|
|
2
|
+
/**
|
|
3
|
+
* Decorator for handling HTTP DELETE requests.
|
|
4
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the DELETE request.
|
|
5
|
+
* @returns {Function} The generic handler for the DELETE request.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Delete(params: ControllerDecoratorParams | string): Function;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generateHandlerParams, genericHandler } from '../http.base';
|
|
2
|
+
import { HttpMethod } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for handling HTTP DELETE requests.
|
|
5
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the DELETE request.
|
|
6
|
+
* @returns {Function} The generic handler for the DELETE request.
|
|
7
|
+
*/
|
|
8
|
+
export function Delete(params) {
|
|
9
|
+
const { path, middlewares, description, staticServe, validator } = generateHandlerParams(params);
|
|
10
|
+
return genericHandler({ method: HttpMethod.DELETE, path, middlewares, description, staticServe, validator });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Delete.js","sourceRoot":"","sources":["../../../../../../lib/server/web/decorators/methods/Delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAC,MAA0C;IAC/D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEjG,OAAO,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;AAC/G,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ControllerDecoratorParams } from "../../../../adapter";
|
|
2
|
+
/**
|
|
3
|
+
* Decorator for handling HTTP GET requests.
|
|
4
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the GET request.
|
|
5
|
+
* @returns {Function} The generic handler for the GET request.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Get(params: ControllerDecoratorParams | string): Function;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generateHandlerParams, genericHandler } from '../http.base';
|
|
2
|
+
import { HttpMethod } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for handling HTTP GET requests.
|
|
5
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the GET request.
|
|
6
|
+
* @returns {Function} The generic handler for the GET request.
|
|
7
|
+
*/
|
|
8
|
+
export function Get(params) {
|
|
9
|
+
const { path, middlewares, description, staticServe, validator } = generateHandlerParams(params);
|
|
10
|
+
return genericHandler({ method: HttpMethod.GET, path, middlewares, description, staticServe, validator });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Get.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Get.js","sourceRoot":"","sources":["../../../../../../lib/server/web/decorators/methods/Get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,MAA0C;IAC5D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEjG,OAAO,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ControllerDecoratorParams } from "../../../../adapter";
|
|
2
|
+
/**
|
|
3
|
+
* Decorator for handling HTTP HEAD requests.
|
|
4
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the HEAD request.
|
|
5
|
+
* @returns {Function} The generic handler for the HEAD request.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Head(params: ControllerDecoratorParams | string): Function;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generateHandlerParams, genericHandler } from '../http.base';
|
|
2
|
+
import { HttpMethod } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for handling HTTP HEAD requests.
|
|
5
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the HEAD request.
|
|
6
|
+
* @returns {Function} The generic handler for the HEAD request.
|
|
7
|
+
*/
|
|
8
|
+
export function Head(params) {
|
|
9
|
+
const { path, middlewares, description, staticServe, validator } = generateHandlerParams(params);
|
|
10
|
+
return genericHandler({ method: HttpMethod.HEAD, path, middlewares, description, staticServe, validator });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Head.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Head.js","sourceRoot":"","sources":["../../../../../../lib/server/web/decorators/methods/Head.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,MAA0C;IAC7D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEjG,OAAO,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;AAC7G,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ControllerDecoratorParams } from "../../../../adapter";
|
|
2
|
+
/**
|
|
3
|
+
* Decorator for handling HTTP OPTIONS requests.
|
|
4
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the OPTIONS request.
|
|
5
|
+
* @returns {Function} The generic handler for the OPTIONS request.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Options(params: ControllerDecoratorParams | string): Function;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generateHandlerParams, genericHandler } from '../http.base';
|
|
2
|
+
import { HttpMethod } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for handling HTTP OPTIONS requests.
|
|
5
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the OPTIONS request.
|
|
6
|
+
* @returns {Function} The generic handler for the OPTIONS request.
|
|
7
|
+
*/
|
|
8
|
+
export function Options(params) {
|
|
9
|
+
const { path, middlewares, description, staticServe, validator } = generateHandlerParams(params);
|
|
10
|
+
return genericHandler({ method: HttpMethod.OPTIONS, path, middlewares, description, staticServe, validator });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Options.js","sourceRoot":"","sources":["../../../../../../lib/server/web/decorators/methods/Options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,MAA0C;IAChE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEjG,OAAO,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;AAChH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ControllerDecoratorParams } from "../../../../adapter";
|
|
2
|
+
/**
|
|
3
|
+
* Decorator for handling HTTP PATCH requests.
|
|
4
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the PATCH request.
|
|
5
|
+
* @returns {Function} The generic handler for the PATCH request.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Patch(params: ControllerDecoratorParams | string): Function;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generateHandlerParams, genericHandler } from '../http.base';
|
|
2
|
+
import { HttpMethod } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for handling HTTP PATCH requests.
|
|
5
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the PATCH request.
|
|
6
|
+
* @returns {Function} The generic handler for the PATCH request.
|
|
7
|
+
*/
|
|
8
|
+
export function Patch(params) {
|
|
9
|
+
const { path, middlewares, description, staticServe, validator } = generateHandlerParams(params);
|
|
10
|
+
return genericHandler({ method: HttpMethod.PATCH, path, middlewares, description, staticServe, validator });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Patch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Patch.js","sourceRoot":"","sources":["../../../../../../lib/server/web/decorators/methods/Patch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,MAA0C;IAC9D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEjG,OAAO,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;AAC9G,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ControllerDecoratorParams } from "../../../../adapter";
|
|
2
|
+
/**
|
|
3
|
+
* Decorator for handling HTTP POST requests.
|
|
4
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the POST request.
|
|
5
|
+
* @returns {Function} The generic handler for the POST request.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Post(params: ControllerDecoratorParams | string): Function;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generateHandlerParams, genericHandler } from '../http.base';
|
|
2
|
+
import { HttpMethod } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for handling HTTP POST requests.
|
|
5
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the POST request.
|
|
6
|
+
* @returns {Function} The generic handler for the POST request.
|
|
7
|
+
*/
|
|
8
|
+
export function Post(params) {
|
|
9
|
+
const { path, middlewares, description, staticServe, validator } = generateHandlerParams(params);
|
|
10
|
+
return genericHandler({ method: HttpMethod.POST, path, middlewares, description, staticServe, validator });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Post.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Post.js","sourceRoot":"","sources":["../../../../../../lib/server/web/decorators/methods/Post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAAC,MAA0C;IAC7D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEjG,OAAO,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;AAC7G,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ControllerDecoratorParams } from "../../../../adapter";
|
|
2
|
+
/**
|
|
3
|
+
* Decorator for handling HTTP PUT requests.
|
|
4
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the PUT request.
|
|
5
|
+
* @returns {Function} The generic handler for the PUT request.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Put(params: ControllerDecoratorParams | string): Function;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generateHandlerParams, genericHandler } from '../http.base';
|
|
2
|
+
import { HttpMethod } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for handling HTTP PUT requests.
|
|
5
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the PUT request.
|
|
6
|
+
* @returns {Function} The generic handler for the PUT request.
|
|
7
|
+
*/
|
|
8
|
+
export function Put(params) {
|
|
9
|
+
const { path, middlewares, description, staticServe, validator } = generateHandlerParams(params);
|
|
10
|
+
return genericHandler({ method: HttpMethod.PUT, path, middlewares, description, staticServe, validator });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Put.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Put.js","sourceRoot":"","sources":["../../../../../../lib/server/web/decorators/methods/Put.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;GAIG;AACH,MAAM,UAAU,GAAG,CAAC,MAA0C;IAC5D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEjG,OAAO,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ControllerDecoratorParams } from "../../../../adapter";
|
|
2
|
+
/**
|
|
3
|
+
* Decorator for handling HTTP TRACE requests.
|
|
4
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the TRACE request.
|
|
5
|
+
* @returns {Function} The generic handler for the TRACE request.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Trace(params: ControllerDecoratorParams | string): Function;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generateHandlerParams, genericHandler } from '../http.base';
|
|
2
|
+
import { HttpMethod } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Decorator for handling HTTP TRACE requests.
|
|
5
|
+
* @param {ControllerDecoratorParams | string} params - The parameters for the TRACE request.
|
|
6
|
+
* @returns {Function} The generic handler for the TRACE request.
|
|
7
|
+
*/
|
|
8
|
+
export function Trace(params) {
|
|
9
|
+
const { path, middlewares, description, staticServe, validator } = generateHandlerParams(params);
|
|
10
|
+
return genericHandler({ method: HttpMethod.TRACE, path, middlewares, description, staticServe, validator });
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=Trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Trace.js","sourceRoot":"","sources":["../../../../../../lib/server/web/decorators/methods/Trace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,MAA0C;IAC9D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEjG,OAAO,cAAc,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;AAC9G,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Get } from './Get';
|
|
2
|
+
export { Post } from './Post';
|
|
3
|
+
export { Put } from './Put';
|
|
4
|
+
export { Delete } from './Delete';
|
|
5
|
+
export { Patch } from './Patch';
|
|
6
|
+
export { Options } from './Options';
|
|
7
|
+
export { Head } from './Head';
|
|
8
|
+
export { Connect } from './Connect';
|
|
9
|
+
export { Trace } from './Trace';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Get } from './Get';
|
|
2
|
+
export { Post } from './Post';
|
|
3
|
+
export { Put } from './Put';
|
|
4
|
+
export { Delete } from './Delete';
|
|
5
|
+
export { Patch } from './Patch';
|
|
6
|
+
export { Options } from './Options';
|
|
7
|
+
export { Head } from './Head';
|
|
8
|
+
export { Connect } from './Connect';
|
|
9
|
+
export { Trace } from './Trace';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lib/server/web/decorators/methods/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
import type { MiddlewareClass } from
|
|
2
|
-
|
|
1
|
+
import type { MiddlewareClass } from "../middleware";
|
|
2
|
+
/**
|
|
3
|
+
* Defines middlewares for target class.
|
|
4
|
+
*
|
|
5
|
+
* @param {Function} target - The target class to which the middleware will be applied.
|
|
6
|
+
* @param {MiddlewareClass[]} middlewares - An array of middleware classes to be defined.
|
|
7
|
+
*/
|
|
8
|
+
export declare const defineMiddleware: (target: Object, middlewares: MiddlewareClass[]) => void;
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { defineMetadata, getMetadata } from 'reflect-metadata/no-conflict';
|
|
2
1
|
import { ComponentConstants } from '../../../ioc/constants';
|
|
2
|
+
import { defineTypedMetadata, getOwnTypedMetadata, getTypedMetadata } from '../../../utils/typedMetadata';
|
|
3
|
+
/**
|
|
4
|
+
* Defines middlewares for target class.
|
|
5
|
+
*
|
|
6
|
+
* @param {Function} target - The target class to which the middleware will be applied.
|
|
7
|
+
* @param {MiddlewareClass[]} middlewares - An array of middleware classes to be defined.
|
|
8
|
+
*/
|
|
3
9
|
export const defineMiddleware = (target, middlewares) => {
|
|
4
|
-
const deps =
|
|
10
|
+
const deps = getOwnTypedMetadata(ComponentConstants.SoftDependencyKey, target.constructor) || {};
|
|
5
11
|
for (const middleware of middlewares) {
|
|
6
12
|
const keys = Object.keys(deps);
|
|
7
|
-
const name =
|
|
13
|
+
const name = getTypedMetadata(ComponentConstants.NameKey, middleware);
|
|
8
14
|
if (!keys.includes(name)) {
|
|
9
|
-
deps[name] =
|
|
15
|
+
deps[name] = name;
|
|
10
16
|
}
|
|
11
17
|
}
|
|
12
|
-
|
|
18
|
+
defineTypedMetadata(ComponentConstants.SoftDependencyKey, deps, target);
|
|
13
19
|
};
|
|
14
20
|
//# sourceMappingURL=middlewareHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middlewareHelper.js","sourceRoot":"","sources":["../../../../../lib/server/web/helper/middlewareHelper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"middlewareHelper.js","sourceRoot":"","sources":["../../../../../lib/server/web/helper/middlewareHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAC,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAGxG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAE,WAA8B,EAAQ,EAAE;IACvF,MAAM,IAAI,GAAiB,mBAAmB,CAAe,kBAAkB,CAAC,iBAAiB,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAE7H,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE/B,MAAM,IAAI,GAAG,gBAAgB,CAAS,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAE9E,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACpB,CAAC;IACH,CAAC;IAED,mBAAmB,CAAe,kBAAkB,CAAC,iBAAiB,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACxF,CAAC,CAAA"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import type { AsenaContext } from '../../../adapter';
|
|
2
|
-
import type {
|
|
1
|
+
import type { AsenaContext, AsenaNextHandler } from '../../../adapter';
|
|
2
|
+
import type { Class } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Abstract class representing a middleware service in the Asena framework.
|
|
5
5
|
*
|
|
6
|
-
* @template
|
|
7
|
-
* @template S - The response type.
|
|
6
|
+
* @template C - The context type, extending AsenaContext.
|
|
8
7
|
*/
|
|
9
|
-
export declare abstract class AsenaMiddlewareService<
|
|
8
|
+
export declare abstract class AsenaMiddlewareService<C extends AsenaContext<any, any> = any> {
|
|
10
9
|
/**
|
|
11
10
|
* Handles the middleware logic.
|
|
12
11
|
*
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
12
|
+
* @param {C} context - The context for the middleware.
|
|
13
|
+
* @param {AsenaNextHandler} next - The next middleware function in the stack.
|
|
15
14
|
* @returns {Promise<void> | any} A promise that resolves when the middleware is complete, or any other value.
|
|
16
15
|
*/
|
|
17
|
-
abstract handle(context:
|
|
18
|
-
}
|
|
19
|
-
export declare abstract class MiddlewareService<P extends string = any, I = any> extends AsenaMiddlewareService<HonoRequest<P, I>, Response> {
|
|
16
|
+
abstract handle(context: C, next: AsenaNextHandler): Promise<void> | any;
|
|
20
17
|
}
|
|
18
|
+
export type MiddlewareClass<C extends AsenaContext<any, any> = AsenaContext<any, any>> = Class<AsenaMiddlewareService<C>>;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Abstract class representing a middleware service in the Asena framework.
|
|
3
3
|
*
|
|
4
|
-
* @template
|
|
5
|
-
* @template S - The response type.
|
|
4
|
+
* @template C - The context type, extending AsenaContext.
|
|
6
5
|
*/
|
|
7
6
|
export class AsenaMiddlewareService {
|
|
8
7
|
}
|
|
9
|
-
export class MiddlewareService extends AsenaMiddlewareService {
|
|
10
|
-
}
|
|
11
8
|
//# sourceMappingURL=AsenaMiddlewareService.js.map
|