@wabot-dev/framework 0.1.0-beta.53 → 0.1.0-beta.54

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.
@@ -0,0 +1,7 @@
1
+ import { methodDecorator } from './methodDecorator.js';
2
+
3
+ function onDelete(config) {
4
+ return methodDecorator('delete', config);
5
+ }
6
+
7
+ export { onDelete };
@@ -0,0 +1,7 @@
1
+ import { methodDecorator } from './methodDecorator.js';
2
+
3
+ function onGet(config) {
4
+ return methodDecorator('get', config);
5
+ }
6
+
7
+ export { onGet };
@@ -0,0 +1,7 @@
1
+ import { methodDecorator } from './methodDecorator.js';
2
+
3
+ function onPost(config) {
4
+ return methodDecorator('post', config);
5
+ }
6
+
7
+ export { onPost };
@@ -0,0 +1,7 @@
1
+ import { methodDecorator } from './methodDecorator.js';
2
+
3
+ function onPut(config) {
4
+ return methodDecorator('put', config);
5
+ }
6
+
7
+ export { onPut };
@@ -1,14 +1,14 @@
1
1
  import { container } from '../../../core/injection/index.js';
2
2
  import { RestControllerMetadataStore } from './RestControllerMetadataStore.js';
3
3
 
4
- function get(config) {
4
+ function methodDecorator(method, config) {
5
5
  return function (target, propertyKey) {
6
6
  const functionName = propertyKey.toString();
7
7
  const paramsTypes = Reflect.getMetadata('design:paramtypes', target, functionName);
8
8
  const store = container.resolve(RestControllerMetadataStore);
9
9
  store.saveEndPointMetadata({
10
10
  controllerConstructor: target.constructor,
11
- method: 'get',
11
+ method,
12
12
  config: typeof config === 'string' ? { path: config } : config,
13
13
  functionName,
14
14
  paramsTypes,
@@ -16,4 +16,4 @@ function get(config) {
16
16
  };
17
17
  }
18
18
 
19
- export { get };
19
+ export { methodDecorator };
@@ -829,7 +829,7 @@ interface IEndPointConfig {
829
829
  disableUrlEncodedParser?: boolean;
830
830
  }
831
831
 
832
- declare function get(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
832
+ declare function onGet(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
833
833
 
834
834
  interface IMiddleware {
835
835
  handle(req: Request, res: Response, container: DependencyContainer$1): Promise<void>;
@@ -837,7 +837,11 @@ interface IMiddleware {
837
837
 
838
838
  declare function middleware(middlewareConstructor: IConstructor<IMiddleware>): (target: object, propertyKey: string | symbol) => void;
839
839
 
840
- declare function post(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
840
+ declare function onPost(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
841
+
842
+ declare function onPut(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
843
+
844
+ declare function onDelete(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
841
845
 
842
846
  interface IRestControllerConfig {
843
847
  path: string;
@@ -846,7 +850,7 @@ interface IRestControllerConfig {
846
850
  declare function restController(config: string | IRestControllerConfig): (target: IConstructor<any>) => void;
847
851
 
848
852
  interface IEndPointMetadata {
849
- method: 'get' | 'post';
853
+ method: 'get' | 'post' | 'put' | 'delete';
850
854
  config?: IEndPointConfig;
851
855
  controllerConstructor: IConstructor<any>;
852
856
  functionName: string;
@@ -874,7 +878,7 @@ declare class RestControllerMetadataStore {
874
878
  getControllerEndPointsInfo(controllerConstructor: IConstructor<any>): {
875
879
  middlewares: IMiddlewareMetadata[];
876
880
  controller: IRestControllerMetadata;
877
- method: "get" | "post";
881
+ method: "get" | "post" | "put" | "delete";
878
882
  config?: IEndPointConfig;
879
883
  controllerConstructor: IConstructor<any>;
880
884
  functionName: string;
@@ -1552,4 +1556,4 @@ declare function HtmlModule(options: IHtmlModuleOptions): {
1552
1556
  new (): {};
1553
1557
  };
1554
1558
 
1555
- export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyRepository, Async, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, CmdChannel, Command, CommandMetadataStore, Container, ControllerMetadataStore, CustomError, DeepSeekChatAdapter, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, ExpressProvider, GoogleChatAdapter, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemReq, type IChatAdapterNextItemRes, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConnectionMiddleware, type IConnectionMiddlewareMetadata, type IConstructor, type ICrudRepository, type ICustomErrorData, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IFunctionCall, type IFunctionCallItem, type IGetWhatsAppTemplateRequest, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobEvent, type IJobEventListener, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type IListenWhatsAppMessageRequest, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetDecoration, type IMindsetFunctionConfig, type IMindsetFunctionDecoration, type IMindsetFunctionMetadata, type IMindsetFunctionParamMetadata, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleDecoration, type IMindsetModuleMetadata, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IParamConfig, type IParamDecoration, type IPersistentData, type IPgRepositoryConfig, type IPrimitive, type IPropertyValidatorInfo, type IReceivedMessage, type IRestControllerConfig, type IRestControllerMetadata, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type ISocketConnectionConfig, type ISocketConnectionMetadata, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type IStorableData, type ITelegramChannelConfig, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppCloudContact, type IWhatsAppCloudMessage, type IWhatsAppCloudMessageMetadata, type IWhatsAppCloudTemplate, type IWhatsAppCloudTemplateComponent, type IWhatsAppCloudTemplateMessage, type IWhatsAppCloudTemplateParameter, type IWhatsAppCloudTemplateResponse, type IWhatsAppCloudWebhookPayload, type IWhatsAppData, type IWhatsAppMessageListener, type IWhatsAppProxyListenMessageEventData, type IWhatsAppProxyListenMessageEventReq, type IWhatsAppProxyMessage, type IWhatsAppProxyMessageContent, type IWhatsAppProxyMessageEventReq, type IWhatsAppProxySendMessageEventReq, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsappChannelConfig, type IchatControllerConfig, Job, JobRepository, JobRunner, JobsEventsHub, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtConnectionGuardMiddleware, JwtGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Logger, MINDSET_DECORATION_MINDSET, MINDSET_FUNCTION_DECORATION_FUNCTION, MINDSET_MODULE_DECORATION_MODULE, Mapper, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenaiChatAdapter, PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RestControllerMetadataStore, SocketChannel, SocketChannelConfig, SocketControllerMetadataStore, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, chatBot, chatController, chatItemTypeOptions, cmd, command, commandHandler, connectionMiddleware, container, get, inject, injectable, isArray, isBoolean, isDate, isModel, isNotEmpty, isNumber, isOptional, isPresent, isString, jwtConnectionGuard, jwtGuard, max, middleware, min, mindset, mindsetFunction, mindsetModule, modelInfo, param, post, restController, runAsyncCommandHandlers, runChatControllers, runRestControllers, runSocketControllers, scoped, singleton, socket, socketConnection, socketController, socketEvent, telegram, validate, validateArray, validateIsBoolean, validateIsDate, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsString, validateMax, validateMin, validateModel, whatsApp };
1559
+ export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyRepository, Async, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, CmdChannel, Command, CommandMetadataStore, Container, ControllerMetadataStore, CustomError, DeepSeekChatAdapter, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, ExpressProvider, GoogleChatAdapter, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemReq, type IChatAdapterNextItemRes, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConnectionMiddleware, type IConnectionMiddlewareMetadata, type IConstructor, type ICrudRepository, type ICustomErrorData, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IFunctionCall, type IFunctionCallItem, type IGetWhatsAppTemplateRequest, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobEvent, type IJobEventListener, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type IListenWhatsAppMessageRequest, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetDecoration, type IMindsetFunctionConfig, type IMindsetFunctionDecoration, type IMindsetFunctionMetadata, type IMindsetFunctionParamMetadata, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleDecoration, type IMindsetModuleMetadata, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IParamConfig, type IParamDecoration, type IPersistentData, type IPgRepositoryConfig, type IPrimitive, type IPropertyValidatorInfo, type IReceivedMessage, type IRestControllerConfig, type IRestControllerMetadata, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type ISocketConnectionConfig, type ISocketConnectionMetadata, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type IStorableData, type ITelegramChannelConfig, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppCloudContact, type IWhatsAppCloudMessage, type IWhatsAppCloudMessageMetadata, type IWhatsAppCloudTemplate, type IWhatsAppCloudTemplateComponent, type IWhatsAppCloudTemplateMessage, type IWhatsAppCloudTemplateParameter, type IWhatsAppCloudTemplateResponse, type IWhatsAppCloudWebhookPayload, type IWhatsAppData, type IWhatsAppMessageListener, type IWhatsAppProxyListenMessageEventData, type IWhatsAppProxyListenMessageEventReq, type IWhatsAppProxyMessage, type IWhatsAppProxyMessageContent, type IWhatsAppProxyMessageEventReq, type IWhatsAppProxySendMessageEventReq, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsappChannelConfig, type IchatControllerConfig, Job, JobRepository, JobRunner, JobsEventsHub, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtConnectionGuardMiddleware, JwtGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Logger, MINDSET_DECORATION_MINDSET, MINDSET_FUNCTION_DECORATION_FUNCTION, MINDSET_MODULE_DECORATION_MODULE, Mapper, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenaiChatAdapter, PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RestControllerMetadataStore, SocketChannel, SocketChannelConfig, SocketControllerMetadataStore, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, chatBot, chatController, chatItemTypeOptions, cmd, command, commandHandler, connectionMiddleware, container, inject, injectable, isArray, isBoolean, isDate, isModel, isNotEmpty, isNumber, isOptional, isPresent, isString, jwtConnectionGuard, jwtGuard, max, middleware, min, mindset, mindsetFunction, mindsetModule, modelInfo, onDelete, onGet, onPost, onPut, param, restController, runAsyncCommandHandlers, runChatControllers, runRestControllers, runSocketControllers, scoped, singleton, socket, socketConnection, socketController, socketEvent, telegram, validate, validateArray, validateIsBoolean, validateIsDate, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsString, validateMax, validateMin, validateModel, whatsApp };
package/dist/src/index.js CHANGED
@@ -72,9 +72,11 @@ export { Money } from './feature/money/Money.js';
72
72
  export { MoneyDto } from './feature/money/MoneyDto.js';
73
73
  export { PgCrudRepository } from './feature/pg/PgCrudRepository.js';
74
74
  export { PgRepositoryBase } from './feature/pg/PgRepositoryBase.js';
75
- export { get } from './feature/rest-controller/metadata/@get.js';
75
+ export { onGet } from './feature/rest-controller/metadata/@onGet.js';
76
76
  export { middleware } from './feature/rest-controller/metadata/@middleware.js';
77
- export { post } from './feature/rest-controller/metadata/@post.js';
77
+ export { onPost } from './feature/rest-controller/metadata/@onPost.js';
78
+ export { onPut } from './feature/rest-controller/metadata/@onPut.js';
79
+ export { onDelete } from './feature/rest-controller/metadata/@onDelete.js';
78
80
  export { restController } from './feature/rest-controller/metadata/@restController.js';
79
81
  export { RestControllerMetadataStore } from './feature/rest-controller/metadata/RestControllerMetadataStore.js';
80
82
  export { runRestControllers } from './feature/rest-controller/runRestControllers.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wabot-dev/framework",
3
- "version": "0.1.0-beta.53",
3
+ "version": "0.1.0-beta.54",
4
4
  "description": "Framework for IA Chat Bots",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -1,19 +0,0 @@
1
- import { container } from '../../../core/injection/index.js';
2
- import { RestControllerMetadataStore } from './RestControllerMetadataStore.js';
3
-
4
- function post(config) {
5
- return function (target, propertyKey) {
6
- const functionName = propertyKey.toString();
7
- const paramsTypes = Reflect.getMetadata('design:paramtypes', target, functionName);
8
- const store = container.resolve(RestControllerMetadataStore);
9
- store.saveEndPointMetadata({
10
- controllerConstructor: target.constructor,
11
- method: 'post',
12
- config: typeof config === 'string' ? { path: config } : config,
13
- functionName,
14
- paramsTypes,
15
- });
16
- };
17
- }
18
-
19
- export { post };