@wabot-dev/framework 0.1.0-beta.44 → 0.1.0-beta.46

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.
Files changed (74) hide show
  1. package/dist/src/addon/async/pg/PgJobRepository.js +1 -1
  2. package/dist/src/addon/auth/api-key/@apiKeyGuard.js +17 -0
  3. package/dist/src/addon/auth/api-key/ApiKey.js +46 -0
  4. package/dist/src/addon/auth/api-key/ApiKeyGuardMiddleware.js +45 -0
  5. package/dist/src/addon/auth/api-key/ApiKeyRepository.js +13 -0
  6. package/dist/src/addon/auth/api-key/PgApiKeyRepository.js +14 -0
  7. package/dist/src/addon/auth/jwt/@jwtConnectionGuard.js +16 -0
  8. package/dist/src/addon/auth/jwt/JwtConnectionGuardMiddleware.js +57 -0
  9. package/dist/src/addon/auth/jwt/JwtRefreshTokenRepository.js +25 -0
  10. package/dist/src/addon/{rest-controller → auth}/jwt/JwtTokenDto.js +3 -3
  11. package/dist/src/addon/{rest-controller/jwt/JwtRefreshTokenRepository.js → auth/jwt/PgJwtRefreshTokenRepository.js} +6 -6
  12. package/dist/src/addon/chat-bot/openia/OpenaiChatAdapter.js +1 -1
  13. package/dist/src/addon/chat-bot/pg/PgChatMemory.js +1 -1
  14. package/dist/src/addon/chat-bot/pg/PgChatRepository.js +1 -1
  15. package/dist/src/addon/chat-controller/whatsapp/{@whatsapp.js → @whatsApp.js} +3 -3
  16. package/dist/src/addon/chat-controller/whatsapp/PgWhatsAppRepository.js +1 -1
  17. package/dist/src/addon/chat-controller/whatsapp/WhatsAppReceiver.js +3 -49
  18. package/dist/src/addon/chat-controller/whatsapp/WhatsAppSender.js +7 -44
  19. package/dist/src/addon/chat-controller/whatsapp/cloud-api/WhatsAppReceiverByCloudApi.js +97 -0
  20. package/dist/src/addon/chat-controller/whatsapp/{WhatsAppSenderByCloudApi.js → cloud-api/WhatsAppSenderByCloudApi.js} +24 -16
  21. package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppProxyContracts.js +5 -0
  22. package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppReceiverByWabotProxy.js +65 -0
  23. package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppSenderByWabotProxy.js +60 -0
  24. package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppWabotProxyConnection.js +45 -0
  25. package/dist/src/core/password/Password.js +30 -0
  26. package/dist/src/core/validation/metadata/@isArray.js +1 -1
  27. package/dist/src/core/validation/metadata/@isModel.js +1 -1
  28. package/dist/src/core/validation/metadata/@isOptional.js +1 -1
  29. package/dist/src/core/validation/metadata/ValidationMetadataStore.js +2 -2
  30. package/dist/src/core/validation/validate.js +1 -1
  31. package/dist/src/{addon/validation → core/validation/validators}/is-boolean/@isBoolean.js +2 -2
  32. package/dist/src/{addon/validation → core/validation/validators}/is-date/@isDate.js +2 -2
  33. package/dist/src/{addon/validation → core/validation/validators}/is-not-empty/@isNotEmpty.js +2 -2
  34. package/dist/src/{addon/validation → core/validation/validators}/is-number/@isNumber.js +2 -2
  35. package/dist/src/{addon/validation → core/validation/validators}/is-present/@isPresent.js +2 -2
  36. package/dist/src/{addon/validation → core/validation/validators}/is-string/@isString.js +2 -2
  37. package/dist/src/{addon/validation → core/validation/validators}/max/@max.js +2 -2
  38. package/dist/src/{addon/validation → core/validation/validators}/min/@min.js +2 -2
  39. package/dist/src/feature/chat-bot/ChatBot.js +4 -0
  40. package/dist/src/{addon → feature}/money/MoneyDto.js +2 -2
  41. package/dist/src/{addon/repository → feature}/pg/PgCrudRepository.js +1 -1
  42. package/dist/src/feature/socket-controller/metadata/@connectionMiddleware.js +16 -0
  43. package/dist/src/feature/socket-controller/metadata/@socketConnection.js +18 -0
  44. package/dist/src/feature/socket-controller/metadata/@socketController.js +15 -0
  45. package/dist/src/feature/socket-controller/metadata/@socketEvent.js +18 -0
  46. package/dist/src/feature/socket-controller/metadata/SocketControllerMetadataStore.js +65 -0
  47. package/dist/src/feature/socket-controller/runSocketControllers.js +98 -0
  48. package/dist/src/index.d.ts +546 -368
  49. package/dist/src/index.js +53 -36
  50. package/package.json +1 -1
  51. package/dist/src/addon/chat-controller/whatsapp/WabotDevConnection.js +0 -57
  52. package/dist/src/addon/chat-controller/whatsapp/WabotDevSocketContracts.js +0 -10
  53. package/dist/src/addon/chat-controller/whatsapp/WhatsAppReceiverByDevConnection.js +0 -26
  54. package/dist/src/addon/chat-controller/whatsapp/WhatsAppReceiverByWebHook.js +0 -57
  55. package/dist/src/addon/chat-controller/whatsapp/WhatsAppSenderByDevConnection.js +0 -60
  56. package/dist/src/addon/{rest-controller → auth}/jwt/@jwtGuard.js +0 -0
  57. package/dist/src/addon/{rest-controller → auth}/jwt/Jwt.js +0 -0
  58. package/dist/src/addon/{rest-controller → auth}/jwt/JwtAccessAndRefreshTokenDto.js +0 -0
  59. package/dist/src/addon/{rest-controller → auth}/jwt/JwtConfig.js +0 -0
  60. package/dist/src/addon/{rest-controller → auth}/jwt/JwtGuardMiddleware.js +1 -1
  61. /package/dist/src/addon/{rest-controller → auth}/jwt/JwtRefreshToken.js +0 -0
  62. /package/dist/src/addon/{rest-controller → auth}/jwt/JwtSigner.js +0 -0
  63. /package/dist/src/core/validation/{validators → core}/validateArray.js +0 -0
  64. /package/dist/src/core/validation/{validators → core}/validateIsOptional.js +0 -0
  65. /package/dist/src/core/validation/{validators → core}/validateModel.js +0 -0
  66. /package/dist/src/{addon/validation → core/validation/validators}/is-boolean/validateIsBoolean.js +0 -0
  67. /package/dist/src/{addon/validation → core/validation/validators}/is-date/validateIsDate.js +0 -0
  68. /package/dist/src/{addon/validation → core/validation/validators}/is-not-empty/validateIsNotEmpty.js +0 -0
  69. /package/dist/src/{addon/validation → core/validation/validators}/is-number/validateIsNumber.js +0 -0
  70. /package/dist/src/{addon/validation → core/validation/validators}/is-present/validateIsPresent.js +0 -0
  71. /package/dist/src/{addon/validation → core/validation/validators}/is-string/validateIsString.js +0 -0
  72. /package/dist/src/{addon/validation → core/validation/validators}/max/validateMax.js +0 -0
  73. /package/dist/src/{addon/validation → core/validation/validators}/min/validateMin.js +0 -0
  74. /package/dist/src/{addon/repository → feature}/pg/PgRepositoryBase.js +0 -0
@@ -6,11 +6,11 @@ import DependencyContainer, { PreResolutionInterceptorCallback, PostResolutionIn
6
6
  import InterceptionOptions from 'tsyringe/dist/typings/types/interceptor-options';
7
7
  import { Server } from 'http';
8
8
  import { Express, Request, Response } from 'express';
9
- import { Server as Server$1 } from 'socket.io';
10
9
  import * as big_js from 'big.js';
11
10
  import { Pool } from 'pg';
12
- import { Socket } from 'socket.io-client';
11
+ import { Server as Server$1, Socket } from 'socket.io';
13
12
  import { Algorithm } from 'jsonwebtoken';
13
+ import { Socket as Socket$1 } from 'socket.io-client';
14
14
 
15
15
  type IPrimitive = null | number | string | boolean | undefined;
16
16
  type IStorableData = {
@@ -131,6 +131,20 @@ declare class Mapper {
131
131
  map<T>(data: any, ctor: IConstructor<T>): T;
132
132
  }
133
133
 
134
+ interface PasswordHashOptions {
135
+ password: string;
136
+ saltLength?: number;
137
+ keyLength?: number;
138
+ }
139
+ declare class Password {
140
+ static hash(options: PasswordHashOptions): string;
141
+ static isValid(req: {
142
+ password: string;
143
+ hash: string;
144
+ }): boolean;
145
+ static generate(length: number): string;
146
+ }
147
+
134
148
  declare class Random {
135
149
  static slug(name: string, options: {
136
150
  randomLength: number;
@@ -235,6 +249,44 @@ declare function validate<V>(value: any, modelConstructor: IConstructor<V>): IMo
235
249
 
236
250
  declare function modelInfo<V>(modelConstructor: IConstructor<V>): IModelValidatorsInfo<V>;
237
251
 
252
+ declare function isBoolean(): (target: object, propertyKey: string | symbol) => void;
253
+
254
+ declare function validateIsBoolean(value: any): IValidationResult<boolean>;
255
+
256
+ declare function isDate(): (target: object, propertyKey: string | symbol) => void;
257
+
258
+ declare function validateIsDate(value: any): IValidationResult<Date>;
259
+
260
+ declare function isNotEmpty(): (target: object, propertyKey: string | symbol) => void;
261
+
262
+ declare function validateIsNotEmpty(value: any): IValidationResult<any>;
263
+
264
+ declare function isNumber(): (target: object, propertyKey: string | symbol) => void;
265
+
266
+ declare function validateIsNumber(value: any): IValidationResult<number>;
267
+
268
+ declare function isPresent(): (target: object, propertyKey: string | symbol) => void;
269
+
270
+ declare function validateIsPresent(value: any): IValidationResult<any>;
271
+
272
+ declare function isString(): (target: object, propertyKey: string | symbol) => void;
273
+
274
+ declare function validateIsString(value: any): IValidationResult<string>;
275
+
276
+ declare function min(limit: any): (target: object, propertyKey: string | symbol) => void;
277
+
278
+ interface IValidateMinOptions {
279
+ limit: any;
280
+ }
281
+ declare function validateMin(value: any, options: IValidateMinOptions): IValidationResult<any>;
282
+
283
+ declare function max(limit: any): (target: object, propertyKey: string | symbol) => void;
284
+
285
+ interface IValidateMaxOptions {
286
+ limit: any;
287
+ }
288
+ declare function validateMax(value: any, options: IValidateMaxOptions): IValidationResult<any>;
289
+
238
290
  interface ICommandConfig {
239
291
  name?: string;
240
292
  }
@@ -686,80 +738,6 @@ declare class ExpressProvider {
686
738
  private createExpress;
687
739
  }
688
740
 
689
- interface IEndPointConfig {
690
- path?: string;
691
- disableJsonParser?: boolean;
692
- disableUrlEncodedParser?: boolean;
693
- }
694
-
695
- declare function get(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
696
-
697
- interface IMiddleware {
698
- handle(req: Request, res: Response, container: DependencyContainer$1): Promise<void>;
699
- }
700
-
701
- declare function middleware(middlewareConstructor: IConstructor<IMiddleware>): (target: object, propertyKey: string | symbol) => void;
702
-
703
- declare function post(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
704
-
705
- interface IRestControllerConfig {
706
- path: string;
707
- }
708
-
709
- declare function restController(config: string | IRestControllerConfig): (target: IConstructor<any>) => void;
710
-
711
- interface IEndPointMetadata {
712
- method: 'get' | 'post';
713
- config?: IEndPointConfig;
714
- controllerConstructor: IConstructor<any>;
715
- functionName: string;
716
- paramsTypes: any[];
717
- }
718
-
719
- interface IMiddlewareMetadata {
720
- controllerConstructor: IConstructor<any>;
721
- functionName: string;
722
- middlewareConstructor: IConstructor<IMiddleware>;
723
- }
724
-
725
- interface IRestControllerMetadata {
726
- controllerConstructor: IConstructor<any>;
727
- path: string;
728
- }
729
-
730
- declare class RestControllerMetadataStore {
731
- private endPoints;
732
- private middlewares;
733
- private restControllers;
734
- saveControllerMetadata(controllerMetadata: IRestControllerMetadata): void;
735
- saveEndPointMetadata(endPointMetadata: IEndPointMetadata): void;
736
- saveMiddlewareMetadata(middlewareMetadata: IMiddlewareMetadata): void;
737
- getControllerEndPointsInfo(controllerConstructor: IConstructor<any>): {
738
- middlewares: IMiddlewareMetadata[];
739
- controller: IRestControllerMetadata;
740
- method: "get" | "post";
741
- config?: IEndPointConfig;
742
- controllerConstructor: IConstructor<any>;
743
- functionName: string;
744
- paramsTypes: any[];
745
- }[];
746
- }
747
-
748
- declare function runRestControllers(controllers: IConstructor<any>[]): void;
749
-
750
- declare const EXPRESS_REQ = "EXPRESS_REQ";
751
- declare const EXPRESS_RES = "EXPRESS_RES";
752
-
753
- declare class SocketServerProvider {
754
- private httpServerProvider;
755
- private socketServer;
756
- private logger;
757
- constructor(httpServerProvider: HttpServerProvider);
758
- getSocketServer(): Server$1;
759
- listen(): void;
760
- private createSocketServer;
761
- }
762
-
763
741
  interface IMoneyData extends IStorableData {
764
742
  amount: string;
765
743
  currency: string;
@@ -782,6 +760,11 @@ declare class Money extends Storable<IMoneyData> {
782
760
  static zero(currency: string): Money;
783
761
  }
784
762
 
763
+ declare class MoneyDto {
764
+ amount: string;
765
+ currency: string;
766
+ }
767
+
785
768
  type IPgRepositoryConfig<P extends Entity<IEntityData>> = {
786
769
  schema?: string;
787
770
  table: string;
@@ -834,106 +817,372 @@ declare class PgCrudRepository<P extends Entity<IEntityData>> extends PgReposito
834
817
  discard(item: P): Promise<void>;
835
818
  }
836
819
 
837
- declare class PgJobRepository extends PgCrudRepository<Job> implements IJobRepository {
838
- constructor(pool: Pool);
820
+ interface IEndPointConfig {
821
+ path?: string;
822
+ disableJsonParser?: boolean;
823
+ disableUrlEncodedParser?: boolean;
839
824
  }
840
825
 
841
- declare class AnthropicChatAdapter implements IChatAdapter {
842
- private env;
843
- private anthropic;
844
- private logger;
845
- constructor(env: Env);
846
- nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
847
- private mapChatItems;
848
- private mapHumanMessage;
849
- private mapBotMessage;
850
- private mapFunctionCall;
851
- private mapTool;
852
- private mapResponse;
853
- }
826
+ declare function get(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
854
827
 
855
- declare class DeepSeekChatAdapter implements IChatAdapter {
856
- private deepSeek;
857
- private logger;
858
- constructor();
859
- nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
860
- private mapChatItems;
861
- private mapHumanMessage;
862
- private mapBotMessage;
863
- private mapFunctionCall;
864
- private mapTool;
865
- private mapResponse;
828
+ interface IMiddleware {
829
+ handle(req: Request, res: Response, container: DependencyContainer$1): Promise<void>;
866
830
  }
867
831
 
868
- declare class GoogleChatAdapter implements IChatAdapter {
869
- private env;
870
- private genai;
871
- private logger;
872
- constructor(env: Env);
873
- nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
874
- private mapChatItems;
875
- private mapHumanMessage;
876
- private mapBotMessage;
877
- private mapFunctionCall;
878
- private mapTool;
879
- private mapResponse;
880
- }
832
+ declare function middleware(middlewareConstructor: IConstructor<IMiddleware>): (target: object, propertyKey: string | symbol) => void;
881
833
 
882
- declare class OpenaiChatAdapter implements IChatAdapter {
883
- private openai;
884
- private logger;
885
- nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
886
- private mapChatItems;
887
- private mapConectionMessage;
888
- private mapBotMessage;
889
- private mapFunctionCall;
890
- private mapTool;
891
- private mapResponse;
834
+ declare function post(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
835
+
836
+ interface IRestControllerConfig {
837
+ path: string;
892
838
  }
893
839
 
894
- declare class PgChatRepository extends PgCrudRepository<Chat> implements IChatRepository {
895
- constructor(pool: Pool);
896
- findByConnection(query: IChatConnection): Promise<Chat | null>;
897
- findMemory(chatId: string): Promise<IChatMemory | null>;
840
+ declare function restController(config: string | IRestControllerConfig): (target: IConstructor<any>) => void;
841
+
842
+ interface IEndPointMetadata {
843
+ method: 'get' | 'post';
844
+ config?: IEndPointConfig;
845
+ controllerConstructor: IConstructor<any>;
846
+ functionName: string;
847
+ paramsTypes: any[];
898
848
  }
899
849
 
900
- declare class PgChatMemory extends PgCrudRepository<ChatItem> implements IChatMemory {
901
- private chatId;
902
- constructor(pool: Pool, chatId: string);
903
- findLastItems(count: number): Promise<ChatItem[]>;
850
+ interface IMiddlewareMetadata {
851
+ controllerConstructor: IConstructor<any>;
852
+ functionName: string;
853
+ middlewareConstructor: IConstructor<IMiddleware>;
904
854
  }
905
855
 
906
- declare class RamChatMemory implements IChatMemory {
907
- private memory;
908
- findLastItems(count: number): Promise<ChatItem[]>;
909
- create(item: ChatItem): Promise<void>;
910
- clearMemory(): Promise<void>;
856
+ interface IRestControllerMetadata {
857
+ controllerConstructor: IConstructor<any>;
858
+ path: string;
911
859
  }
912
860
 
913
- declare class RamChatRepository implements IChatRepository {
914
- private items;
915
- private memories;
916
- create(chat: Chat): Promise<void>;
917
- findByConnection(query: IChatConnection): Promise<Chat | null>;
918
- findMemory(chatId: string): Promise<IChatMemory | null>;
919
- private getMemory;
861
+ declare class RestControllerMetadataStore {
862
+ private endPoints;
863
+ private middlewares;
864
+ private restControllers;
865
+ saveControllerMetadata(controllerMetadata: IRestControllerMetadata): void;
866
+ saveEndPointMetadata(endPointMetadata: IEndPointMetadata): void;
867
+ saveMiddlewareMetadata(middlewareMetadata: IMiddlewareMetadata): void;
868
+ getControllerEndPointsInfo(controllerConstructor: IConstructor<any>): {
869
+ middlewares: IMiddlewareMetadata[];
870
+ controller: IRestControllerMetadata;
871
+ method: "get" | "post";
872
+ config?: IEndPointConfig;
873
+ controllerConstructor: IConstructor<any>;
874
+ functionName: string;
875
+ paramsTypes: any[];
876
+ }[];
920
877
  }
921
878
 
922
- declare class WabotChatAdapter implements IChatAdapter {
923
- private apiKey;
924
- private baseUrl;
879
+ declare function runRestControllers(controllers: IConstructor<any>[]): void;
880
+
881
+ declare const EXPRESS_REQ = "EXPRESS_REQ";
882
+ declare const EXPRESS_RES = "EXPRESS_RES";
883
+
884
+ declare class SocketServerProvider {
885
+ private httpServerProvider;
886
+ private socketServer;
925
887
  private logger;
926
- constructor(env: Env);
927
- nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
888
+ constructor(httpServerProvider: HttpServerProvider);
889
+ getSocketServer(): Server$1;
890
+ listen(): void;
891
+ private createSocketServer;
928
892
  }
929
893
 
930
- declare function cmd(): (target: object, propertyKey: string | symbol) => void;
931
-
932
- declare class CmdChannel implements IChatChannel {
933
- private rl;
934
- private callBack;
935
- listen(callback: (message: IChannelMessage) => void): void;
936
- connect(): void;
894
+ interface IConnectionMiddleware {
895
+ handle(socket: Socket, container: DependencyContainer$1): Promise<void>;
896
+ }
897
+
898
+ declare function connectionMiddleware(middlewareConstructor: IConstructor<IConnectionMiddleware>): (target: object, propertyKey: string | symbol) => void;
899
+
900
+ interface ISocketConnectionConfig {
901
+ namespace: string;
902
+ }
903
+
904
+ declare function socketConnection(config?: string | ISocketConnectionConfig): (target: object, propertyKey: string | symbol) => void;
905
+
906
+ interface ISocketControllerConfig {
907
+ namespace: string;
908
+ }
909
+
910
+ declare function socketController(config?: string | ISocketControllerConfig): (target: IConstructor<any>) => void;
911
+
912
+ interface ISocketEventConfig {
913
+ namespace?: string;
914
+ event: string;
915
+ }
916
+
917
+ declare function socketEvent(config: string | ISocketEventConfig): (target: object, propertyKey: string | symbol) => void;
918
+
919
+ interface IConnectionMiddlewareMetadata {
920
+ controllerConstructor: IConstructor<any>;
921
+ functionName: string;
922
+ middlewareConstructor: IConstructor<IConnectionMiddleware>;
923
+ }
924
+
925
+ interface ISocketConnectionMetadata {
926
+ config?: ISocketConnectionConfig;
927
+ controllerConstructor: IConstructor<any>;
928
+ functionName: string;
929
+ paramsTypes: any[];
930
+ }
931
+
932
+ interface ISocketControllerMetadata {
933
+ controllerConstructor: IConstructor<any>;
934
+ config?: ISocketControllerConfig;
935
+ }
936
+
937
+ interface ISocketEventMetadata {
938
+ config: ISocketEventConfig;
939
+ controllerConstructor: IConstructor<any>;
940
+ functionName: string;
941
+ paramsTypes: any[];
942
+ }
943
+
944
+ declare class SocketControllerMetadataStore {
945
+ private socketControllers;
946
+ private socketConnections;
947
+ private socketEvents;
948
+ private connectionMiddlewares;
949
+ saveControllerMetadata(controllerMetadata: ISocketControllerMetadata): void;
950
+ saveSocketConnectionMetadata(socketConnectionMetadata: ISocketConnectionMetadata): void;
951
+ saveSocketEventMetadata(socketEventMetadata: ISocketEventMetadata): void;
952
+ saveConnectionMiddlewareMetadata(middlewareMetadata: IConnectionMiddlewareMetadata): void;
953
+ getControllerSockerConnectionsInfo(controllerConstructor: IConstructor<any>): {
954
+ events: ISocketEventMetadata[];
955
+ connectionMiddlewares: IConnectionMiddlewareMetadata[];
956
+ controller: ISocketControllerMetadata;
957
+ config?: ISocketConnectionConfig;
958
+ controllerConstructor: IConstructor<any>;
959
+ functionName: string;
960
+ paramsTypes: any[];
961
+ }[];
962
+ }
963
+
964
+ declare function runSocketControllers(controllers: IConstructor<any>[]): void;
965
+
966
+ declare class PgJobRepository extends PgCrudRepository<Job> implements IJobRepository {
967
+ constructor(pool: Pool);
968
+ }
969
+
970
+ declare function apiKeyGuard(): (target: object, propertyKey: string | symbol) => void;
971
+
972
+ interface IApiKeyData extends IEntityData {
973
+ passwordHash?: string;
974
+ authInfo: IStorableData;
975
+ }
976
+ interface IApiKeySecretData {
977
+ id: string;
978
+ pass: string;
979
+ }
980
+ declare class ApiKey extends Entity<IApiKeyData> {
981
+ get authInfo(): IStorableData;
982
+ generatePassword(): string;
983
+ isValidPassword(password: string): boolean;
984
+ validatePassword(password: string): void;
985
+ static inflate(secret: string): IApiKeySecretData;
986
+ static deflate(data: IApiKeySecretData): string;
987
+ }
988
+
989
+ interface IApiKeyRepository {
990
+ find(id: string): Promise<ApiKey | null>;
991
+ findOrThrow(id: string): Promise<ApiKey>;
992
+ create(item: ApiKey): Promise<void>;
993
+ }
994
+
995
+ declare class ApiKeyRepository implements IApiKeyRepository {
996
+ find(id: string): Promise<ApiKey | null>;
997
+ findOrThrow(id: string): Promise<ApiKey>;
998
+ create(item: ApiKey): Promise<void>;
999
+ }
1000
+
1001
+ declare class ApiKeyGuardMiddleware implements IMiddleware {
1002
+ private apiKeyRepository;
1003
+ private auth;
1004
+ constructor(apiKeyRepository: ApiKeyRepository, auth: Auth<any>);
1005
+ handle(req: Request, res: Response, container: DependencyContainer$1): Promise<void>;
1006
+ }
1007
+
1008
+ declare class PgApiKeyRepository extends PgCrudRepository<ApiKey> implements IApiKeyRepository {
1009
+ constructor(pool: Pool);
1010
+ }
1011
+
1012
+ declare function jwtConnectionGuard(): (target: object, propertyKey: string | symbol) => void;
1013
+
1014
+ declare function jwtGuard(): (target: object, propertyKey: string | symbol) => void;
1015
+
1016
+ interface IJwtRefreshTokenData<A extends IStorableData> extends IEntityData {
1017
+ authInfo: A;
1018
+ }
1019
+ declare class JwtRefreshToken<A extends IStorableData> extends Entity<IJwtRefreshTokenData<A>> {
1020
+ get authInfo(): A;
1021
+ }
1022
+
1023
+ interface IJwtRefreshTokenRepository<D extends IStorableData> extends ICrudRepository<JwtRefreshToken<D>> {
1024
+ }
1025
+
1026
+ declare class JwtTokenDto {
1027
+ token?: string;
1028
+ expiration?: Date;
1029
+ }
1030
+
1031
+ declare class JwtAccessAndRefreshTokenDto {
1032
+ access?: JwtTokenDto;
1033
+ refresh?: JwtTokenDto;
1034
+ }
1035
+
1036
+ declare class JwtConfig {
1037
+ secretOrPublicKey: string;
1038
+ secretOrPrivateKey: string;
1039
+ algorithm: Algorithm;
1040
+ accessExpirationSeconds: number;
1041
+ refreshExpirationSeconds: number;
1042
+ constructor(env: Env);
1043
+ }
1044
+
1045
+ declare class JwtSigner {
1046
+ private config;
1047
+ private mapper;
1048
+ constructor(config: JwtConfig, mapper: Mapper);
1049
+ signAccessToken<D extends IStorableData>(info: D | JwtRefreshToken<any>): Promise<JwtTokenDto>;
1050
+ signRefreshToken(refreshToken: JwtRefreshToken<any>): Promise<JwtTokenDto>;
1051
+ signAccessAndRefreshToken(refreshToken: JwtRefreshToken<any>): Promise<JwtAccessAndRefreshTokenDto>;
1052
+ }
1053
+
1054
+ declare class JwtRefreshTokenRepository<D extends IStorableData> implements IJwtRefreshTokenRepository<D> {
1055
+ find(id: string): Promise<JwtRefreshToken<D> | null>;
1056
+ findOrThrow(id: string): Promise<JwtRefreshToken<D>>;
1057
+ findByIds(ids: string[]): Promise<JwtRefreshToken<D>[]>;
1058
+ findAll(id: string): Promise<JwtRefreshToken<D>[]>;
1059
+ create(item: JwtRefreshToken<D>): Promise<void>;
1060
+ update(item: JwtRefreshToken<D>): Promise<void>;
1061
+ discard(item: JwtRefreshToken<D>): Promise<void>;
1062
+ }
1063
+
1064
+ declare class Jwt {
1065
+ private auth;
1066
+ private jwtSigner;
1067
+ private jwtRefreshTokenRepository;
1068
+ constructor(auth: Auth<any>, jwtSigner: JwtSigner, jwtRefreshTokenRepository: JwtRefreshTokenRepository<any>);
1069
+ createToken(): Promise<JwtAccessAndRefreshTokenDto>;
1070
+ }
1071
+
1072
+ declare class JwtConnectionGuardMiddleware implements IConnectionMiddleware {
1073
+ private config;
1074
+ private auth;
1075
+ constructor(config: JwtConfig, auth: Auth<any>);
1076
+ handle(socket: Socket, container: DependencyContainer$1): Promise<void>;
1077
+ }
1078
+
1079
+ declare class JwtGuardMiddleware implements IMiddleware {
1080
+ private config;
1081
+ private auth;
1082
+ constructor(config: JwtConfig, auth: Auth<any>);
1083
+ handle(req: Request, res: Response, container: DependencyContainer$1): Promise<void>;
1084
+ }
1085
+
1086
+ declare class PgJwtRefreshTokenRepository<D extends IStorableData> extends PgCrudRepository<JwtRefreshToken<D>> implements IJwtRefreshTokenRepository<D> {
1087
+ constructor(pool: Pool);
1088
+ }
1089
+
1090
+ declare class AnthropicChatAdapter implements IChatAdapter {
1091
+ private env;
1092
+ private anthropic;
1093
+ private logger;
1094
+ constructor(env: Env);
1095
+ nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
1096
+ private mapChatItems;
1097
+ private mapHumanMessage;
1098
+ private mapBotMessage;
1099
+ private mapFunctionCall;
1100
+ private mapTool;
1101
+ private mapResponse;
1102
+ }
1103
+
1104
+ declare class DeepSeekChatAdapter implements IChatAdapter {
1105
+ private deepSeek;
1106
+ private logger;
1107
+ constructor();
1108
+ nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
1109
+ private mapChatItems;
1110
+ private mapHumanMessage;
1111
+ private mapBotMessage;
1112
+ private mapFunctionCall;
1113
+ private mapTool;
1114
+ private mapResponse;
1115
+ }
1116
+
1117
+ declare class GoogleChatAdapter implements IChatAdapter {
1118
+ private env;
1119
+ private genai;
1120
+ private logger;
1121
+ constructor(env: Env);
1122
+ nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
1123
+ private mapChatItems;
1124
+ private mapHumanMessage;
1125
+ private mapBotMessage;
1126
+ private mapFunctionCall;
1127
+ private mapTool;
1128
+ private mapResponse;
1129
+ }
1130
+
1131
+ declare class OpenaiChatAdapter implements IChatAdapter {
1132
+ private openai;
1133
+ private logger;
1134
+ nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
1135
+ private mapChatItems;
1136
+ private mapConectionMessage;
1137
+ private mapBotMessage;
1138
+ private mapFunctionCall;
1139
+ private mapTool;
1140
+ private mapResponse;
1141
+ }
1142
+
1143
+ declare class PgChatRepository extends PgCrudRepository<Chat> implements IChatRepository {
1144
+ constructor(pool: Pool);
1145
+ findByConnection(query: IChatConnection): Promise<Chat | null>;
1146
+ findMemory(chatId: string): Promise<IChatMemory | null>;
1147
+ }
1148
+
1149
+ declare class PgChatMemory extends PgCrudRepository<ChatItem> implements IChatMemory {
1150
+ private chatId;
1151
+ constructor(pool: Pool, chatId: string);
1152
+ findLastItems(count: number): Promise<ChatItem[]>;
1153
+ }
1154
+
1155
+ declare class RamChatMemory implements IChatMemory {
1156
+ private memory;
1157
+ findLastItems(count: number): Promise<ChatItem[]>;
1158
+ create(item: ChatItem): Promise<void>;
1159
+ clearMemory(): Promise<void>;
1160
+ }
1161
+
1162
+ declare class RamChatRepository implements IChatRepository {
1163
+ private items;
1164
+ private memories;
1165
+ create(chat: Chat): Promise<void>;
1166
+ findByConnection(query: IChatConnection): Promise<Chat | null>;
1167
+ findMemory(chatId: string): Promise<IChatMemory | null>;
1168
+ private getMemory;
1169
+ }
1170
+
1171
+ declare class WabotChatAdapter implements IChatAdapter {
1172
+ private apiKey;
1173
+ private baseUrl;
1174
+ private logger;
1175
+ constructor(env: Env);
1176
+ nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
1177
+ }
1178
+
1179
+ declare function cmd(): (target: object, propertyKey: string | symbol) => void;
1180
+
1181
+ declare class CmdChannel implements IChatChannel {
1182
+ private rl;
1183
+ private callBack;
1184
+ listen(callback: (message: IChannelMessage) => void): void;
1185
+ connect(): void;
937
1186
  }
938
1187
 
939
1188
  interface ISocketChannelConfig {
@@ -990,7 +1239,7 @@ declare class WhatsappChannelConfig implements IWhatsappChannelConfig {
990
1239
  constructor(number: string);
991
1240
  }
992
1241
 
993
- declare function whatsapp(config: IWhatsappChannelConfig): (target: object, propertyKey: string | symbol) => void;
1242
+ declare function whatsApp(config: string | IWhatsappChannelConfig): (target: object, propertyKey: string | symbol) => void;
994
1243
 
995
1244
  interface IWhatsAppBusinessNumber extends IStorableData {
996
1245
  id: string;
@@ -1031,7 +1280,23 @@ declare class EnvWhatsAppRepository implements IWhatsAppRepository {
1031
1280
  private getFromEnvVars;
1032
1281
  }
1033
1282
 
1034
- type IWhatsAppTemplateParameter = {
1283
+ declare class PgWhatsAppRepository extends PgCrudRepository<WhatsApp> implements IWhatsAppRepository {
1284
+ constructor(pool: Pool);
1285
+ findBySlug(slug: string): Promise<WhatsApp | null>;
1286
+ findByBusinessNumber(number: string): Promise<WhatsApp | null>;
1287
+ }
1288
+
1289
+ type IWhatsAppMessageListener = (message: Omit<IChannelMessage, 'reply'>) => Promise<void>;
1290
+ interface IListenWhatsAppMessageRequest {
1291
+ to: string;
1292
+ listener: IWhatsAppMessageListener;
1293
+ }
1294
+ declare class WhatsAppReceiver {
1295
+ connect(): Promise<void>;
1296
+ listenMessage(request: IListenWhatsAppMessageRequest): void;
1297
+ }
1298
+
1299
+ type IWhatsAppCloudTemplateParameter = {
1035
1300
  type: 'text';
1036
1301
  text: string;
1037
1302
  parameter_name?: string;
@@ -1048,111 +1313,38 @@ type IWhatsAppTemplateParameter = {
1048
1313
  fallback_value: string;
1049
1314
  };
1050
1315
  };
1051
- interface IWhatsAppTemplateMessage {
1316
+ interface IWhatsAppCloudTemplateMessage {
1052
1317
  templateName: string;
1053
1318
  languageCode: string;
1054
- parameters: IWhatsAppTemplateParameter[];
1319
+ parameters: IWhatsAppCloudTemplateParameter[];
1055
1320
  }
1056
1321
 
1057
- interface IWhatsAppTemplateResponse {
1058
- data: IWhatsAppTemplate[];
1059
- paging: IWhatsAppApiPaging;
1322
+ interface IWhatsAppCloudTemplateResponse {
1323
+ data: IWhatsAppCloudTemplate[];
1324
+ paging: IWhatsAppCloudApiPaging;
1060
1325
  }
1061
- interface IWhatsAppTemplate {
1326
+ interface IWhatsAppCloudTemplate {
1062
1327
  name: string;
1063
1328
  parameter_format: 'POSITIONAL' | 'OTHER';
1064
- components: IWhatsAppTemplateComponent[];
1329
+ components: IWhatsAppCloudTemplateComponent[];
1065
1330
  language: string;
1066
1331
  status: string;
1067
1332
  category: string;
1068
1333
  id: string;
1069
1334
  }
1070
- interface IWhatsAppTemplateComponent {
1335
+ interface IWhatsAppCloudTemplateComponent {
1071
1336
  type: 'HEADER' | 'BODY' | 'FOOTER';
1072
1337
  format?: 'TEXT';
1073
1338
  text?: string;
1074
1339
  }
1075
- interface IWhatsAppApiPaging {
1076
- cursors: IWhatsAppApiCursors;
1340
+ interface IWhatsAppCloudApiPaging {
1341
+ cursors: IWhatsAppCloudApiCursors;
1077
1342
  }
1078
- interface IWhatsAppApiCursors {
1343
+ interface IWhatsAppCloudApiCursors {
1079
1344
  before: string;
1080
1345
  after: string;
1081
1346
  }
1082
1347
 
1083
- interface IWhatsAppWebhookPayload {
1084
- object: 'whatsapp_business_account';
1085
- entry: IEntry[];
1086
- }
1087
- interface IEntry {
1088
- id: string;
1089
- changes: IChange[];
1090
- }
1091
- type IChange = IMessagesChange;
1092
- interface IMessagesChange {
1093
- value: IMessagesChangeValue;
1094
- field: 'messages';
1095
- }
1096
- interface IMessagesChangeValue {
1097
- messaging_product: 'whatsapp';
1098
- metadata: IMessageMetadata;
1099
- contacts?: IWhatsAppContact[];
1100
- messages?: IWhatsAppMessage[];
1101
- }
1102
- interface IMessageMetadata {
1103
- display_phone_number: string;
1104
- phone_number_id: string;
1105
- }
1106
- interface IWhatsAppContact {
1107
- profile: {
1108
- name: string;
1109
- };
1110
- wa_id: string;
1111
- }
1112
- type IWhatsAppMessage = ITextMessage | IAudioMessage;
1113
- interface IBaseMessage {
1114
- from: string;
1115
- id: string;
1116
- timestamp: string;
1117
- type: string;
1118
- }
1119
- interface ITextMessage extends IBaseMessage {
1120
- type: 'text';
1121
- text: {
1122
- body: string;
1123
- };
1124
- }
1125
- interface IAudioMessage extends IBaseMessage {
1126
- type: 'audio';
1127
- audio: {
1128
- mime_type: string;
1129
- sha256: string;
1130
- id: string;
1131
- voice: boolean;
1132
- };
1133
- }
1134
-
1135
- declare class PgWhatsAppRepository extends PgCrudRepository<WhatsApp> implements IWhatsAppRepository {
1136
- constructor(pool: Pool);
1137
- findBySlug(slug: string): Promise<WhatsApp | null>;
1138
- findByBusinessNumber(number: string): Promise<WhatsApp | null>;
1139
- }
1140
-
1141
- type IWhatsAppMessageListener = (message: Omit<IChannelMessage, 'reply'>) => Promise<void>;
1142
- interface IListenWhatsAppMessageRequest {
1143
- to: string;
1144
- listener: IWhatsAppMessageListener;
1145
- }
1146
- declare abstract class WhatsAppReceiver {
1147
- protected logger: Logger;
1148
- private listeners;
1149
- constructor(logger: Logger);
1150
- abstract connect(): Promise<void>;
1151
- listenMessage(request: IListenWhatsAppMessageRequest): void;
1152
- protected handlePayload(payload: IWhatsAppWebhookPayload): Promise<void>;
1153
- private emmitMessage;
1154
- }
1155
-
1156
1348
  declare class WhatsAppRepository implements IWhatsAppRepository {
1157
1349
  findBySlug(slug: string): Promise<WhatsApp | null>;
1158
1350
  findByBusinessNumber(number: string): Promise<WhatsApp | null>;
@@ -1166,7 +1358,7 @@ interface ISendWhatsAppRequest {
1166
1358
  interface ISendWhatsAppTemplateRequest {
1167
1359
  from: string;
1168
1360
  to: string;
1169
- templateMessage: IWhatsAppTemplateMessage;
1361
+ templateMessage: IWhatsAppCloudTemplateMessage;
1170
1362
  senderName: string;
1171
1363
  }
1172
1364
  interface IGetWhatsAppTemplateRequest {
@@ -1178,20 +1370,16 @@ interface IWhatsAppSenderOptions {
1178
1370
  writeChatMemory?: boolean;
1179
1371
  }
1180
1372
  declare class WhatsAppSender {
1181
- protected logger: Logger;
1182
1373
  protected chatRepository: ChatRepository;
1183
1374
  protected chatResolver: ChatResolver;
1184
1375
  protected whatsAppRepository: WhatsAppRepository;
1185
- constructor(logger: Logger, chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
1186
- protected handleSendRequest(request: ISendWhatsAppRequest): Promise<void>;
1187
- protected handleSendTemplateRequest(request: ISendWhatsAppTemplateRequest): Promise<void>;
1188
- protected handleGetWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppTemplate | null>;
1376
+ constructor(chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
1189
1377
  sendWhatsApp(request: ISendWhatsAppRequest, options?: IWhatsAppSenderOptions): Promise<void>;
1190
1378
  sendWhatsAppTemplate(request: ISendWhatsAppTemplateRequest, options?: IWhatsAppSenderOptions): Promise<void>;
1191
- getWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppTemplate | null>;
1192
- protected resolveTemplateToChatMessage(request: ISendWhatsAppTemplateRequest): Promise<IChatMessage>;
1379
+ protected getWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppCloudTemplate | null>;
1380
+ protected mapTemplateToChatMessage(request: ISendWhatsAppTemplateRequest): Promise<IChatMessage>;
1193
1381
  protected writePrivateChatMemory(message: IChatMessage, to: string): Promise<void>;
1194
- private replaceTemplateParameters;
1382
+ protected replaceTemplateParameters(template: string, data: IWhatsAppCloudTemplateParameter[]): string;
1195
1383
  }
1196
1384
 
1197
1385
  declare class WhatsAppChannel implements IChatChannel {
@@ -1204,151 +1392,141 @@ declare class WhatsAppChannel implements IChatChannel {
1204
1392
  connect(): void;
1205
1393
  }
1206
1394
 
1207
- declare class WabotDevConnection {
1208
- private devProxy;
1209
- private devProxySocket;
1210
- private devToken;
1211
- private logger;
1212
- static isTokenAvailable(): boolean;
1213
- constructor();
1214
- getSocket(): Promise<Socket>;
1395
+ interface IWhatsAppCloudWebhookPayload {
1396
+ object: 'whatsapp_business_account';
1397
+ entry: IWhatsAppCloudEntry[];
1215
1398
  }
1216
-
1217
- declare class WhatsAppReceiverByDevConnection extends WhatsAppReceiver {
1218
- private wabotDevConnection;
1219
- constructor(wabotDevConnection: WabotDevConnection);
1220
- connect(): Promise<void>;
1399
+ interface IWhatsAppCloudEntry {
1400
+ id: string;
1401
+ changes: IWhatsAppCloudChange[];
1402
+ }
1403
+ type IWhatsAppCloudChange = IWhatsAppCloudMessagesChange;
1404
+ interface IWhatsAppCloudMessagesChange {
1405
+ value: IWhatsAppCloudMessagesChangeValue;
1406
+ field: 'messages';
1407
+ }
1408
+ interface IWhatsAppCloudMessagesChangeValue {
1409
+ messaging_product: 'whatsapp';
1410
+ metadata: IWhatsAppCloudMessageMetadata;
1411
+ contacts?: IWhatsAppCloudContact[];
1412
+ messages?: IWhatsAppCloudMessage[];
1413
+ }
1414
+ interface IWhatsAppCloudMessageMetadata {
1415
+ display_phone_number: string;
1416
+ phone_number_id: string;
1417
+ }
1418
+ interface IWhatsAppCloudContact {
1419
+ profile: {
1420
+ name: string;
1421
+ };
1422
+ wa_id: string;
1423
+ }
1424
+ type IWhatsAppCloudMessage = IWhatsAppCloudTextMessage | IWhatsAppCloudAudioMessage;
1425
+ interface IWhatsAppCloudBaseMessage {
1426
+ from: string;
1427
+ id: string;
1428
+ timestamp: string;
1429
+ type: string;
1430
+ }
1431
+ interface IWhatsAppCloudTextMessage extends IWhatsAppCloudBaseMessage {
1432
+ type: 'text';
1433
+ text: {
1434
+ body: string;
1435
+ };
1436
+ }
1437
+ interface IWhatsAppCloudAudioMessage extends IWhatsAppCloudBaseMessage {
1438
+ type: 'audio';
1439
+ audio: {
1440
+ mime_type: string;
1441
+ sha256: string;
1442
+ id: string;
1443
+ voice: boolean;
1444
+ };
1221
1445
  }
1222
1446
 
1223
- declare class WhatsAppReceiverByWebHook extends WhatsAppReceiver {
1447
+ declare class WhatsAppReceiverByCloudApi extends WhatsAppReceiver {
1224
1448
  private expressProvider;
1225
1449
  private whatsAppRepository;
1450
+ private listeners;
1226
1451
  private expressApp;
1452
+ private logger;
1227
1453
  private webhookPath;
1228
1454
  constructor(expressProvider: ExpressProvider, whatsAppRepository: WhatsAppRepository);
1229
1455
  connect(): Promise<void>;
1456
+ listenMessage(request: IListenWhatsAppMessageRequest): void;
1457
+ protected handlePayload(payload: IWhatsAppCloudWebhookPayload): Promise<void>;
1458
+ private emmitMessage;
1230
1459
  }
1231
1460
 
1232
1461
  declare class WhatsAppSenderByCloudApi extends WhatsAppSender {
1462
+ private logger;
1233
1463
  constructor(chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
1234
- handleSendRequest(request: ISendWhatsAppRequest): Promise<void>;
1235
- handleSendTemplateRequest(request: ISendWhatsAppTemplateRequest): Promise<void>;
1236
- handleGetWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppTemplate | null>;
1237
- }
1238
-
1239
- declare class WhatsAppSenderByDevConnection extends WhatsAppSender {
1240
- private wabotDevConnection;
1241
- constructor(wabotDevConnection: WabotDevConnection, chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
1242
- handleSendRequest(request: ISendWhatsAppRequest): Promise<void>;
1243
- handleSendTemplateRequest(request: ISendWhatsAppTemplateRequest): Promise<void>;
1244
- handleGetWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppTemplate | null>;
1245
- }
1246
-
1247
- interface IHtmlModuleOptions {
1248
- url: string;
1249
- title: string;
1250
- }
1251
- declare function HtmlModule(options: IHtmlModuleOptions): {
1252
- new (): {};
1253
- };
1254
-
1255
- declare function jwtGuard(): (target: object, propertyKey: string | symbol) => void;
1256
-
1257
- declare class JwtTokenDto {
1258
- token?: string;
1259
- expiration?: Date;
1464
+ sendWhatsApp(request: ISendWhatsAppRequest, options?: IWhatsAppSenderOptions): Promise<void>;
1465
+ sendWhatsAppTemplate(request: ISendWhatsAppTemplateRequest, options?: IWhatsAppSenderOptions): Promise<void>;
1466
+ protected getWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppCloudTemplate | null>;
1260
1467
  }
1261
1468
 
1262
- declare class JwtAccessAndRefreshTokenDto {
1263
- access?: JwtTokenDto;
1264
- refresh?: JwtTokenDto;
1469
+ interface IWhatsAppProxyMessageContent {
1470
+ text: string;
1265
1471
  }
1266
1472
 
1267
- declare class JwtConfig {
1268
- secretOrPublicKey: string;
1269
- secretOrPrivateKey: string;
1270
- algorithm: Algorithm;
1271
- accessExpirationSeconds: number;
1272
- refreshExpirationSeconds: number;
1273
- constructor(env: Env);
1473
+ interface IWhatsAppProxyMessage {
1474
+ from: string;
1475
+ to: string;
1476
+ senderName?: string;
1477
+ content: IWhatsAppProxyMessageContent;
1274
1478
  }
1275
1479
 
1276
- interface IJwtRefreshTokenData<A extends IStorableData> extends IEntityData {
1277
- authInfo: A;
1480
+ declare const WHATSAPP_PROXY_SEND_MESSAGE_EVENT: "sendMessage";
1481
+ interface IWhatsAppProxySendMessageEventReq {
1482
+ event: typeof WHATSAPP_PROXY_SEND_MESSAGE_EVENT;
1483
+ data: IWhatsAppProxyMessage;
1278
1484
  }
1279
- declare class JwtRefreshToken<A extends IStorableData> extends Entity<IJwtRefreshTokenData<A>> {
1280
- get authInfo(): A;
1485
+ declare const WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT: "listenMessage";
1486
+ interface IWhatsAppProxyListenMessageEventReq {
1487
+ event: typeof WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT;
1488
+ data: IWhatsAppProxyListenMessageEventData;
1281
1489
  }
1282
-
1283
- declare class JwtSigner {
1284
- private config;
1285
- private mapper;
1286
- constructor(config: JwtConfig, mapper: Mapper);
1287
- signAccessToken<D extends IStorableData>(info: D | JwtRefreshToken<any>): Promise<JwtTokenDto>;
1288
- signRefreshToken(refreshToken: JwtRefreshToken<any>): Promise<JwtTokenDto>;
1289
- signAccessAndRefreshToken(refreshToken: JwtRefreshToken<any>): Promise<JwtAccessAndRefreshTokenDto>;
1490
+ interface IWhatsAppProxyListenMessageEventData {
1491
+ from?: string[];
1492
+ to: string[];
1290
1493
  }
1291
-
1292
- declare class JwtRefreshTokenRepository<D extends IStorableData> extends PgCrudRepository<JwtRefreshToken<D>> {
1293
- constructor(pool: Pool);
1494
+ declare const WHATSAPP_MESSAGE_EVENT: "message";
1495
+ interface IWhatsAppProxyMessageEventReq {
1496
+ event: typeof WHATSAPP_MESSAGE_EVENT;
1497
+ data: IWhatsAppProxyMessage;
1294
1498
  }
1295
1499
 
1296
- declare class Jwt {
1297
- private auth;
1298
- private jwtSigner;
1299
- private jwtRefreshTokenRepository;
1300
- constructor(auth: Auth<any>, jwtSigner: JwtSigner, jwtRefreshTokenRepository: JwtRefreshTokenRepository<any>);
1301
- createToken(): Promise<JwtAccessAndRefreshTokenDto>;
1302
- }
1303
-
1304
- declare class JwtGuardMiddleware implements IMiddleware {
1305
- private config;
1306
- private auth;
1307
- constructor(config: JwtConfig, auth: Auth<any>);
1308
- handle(req: Request, res: Response, container: DependencyContainer$1): Promise<void>;
1500
+ declare class WhatsAppWabotProxyConnection {
1501
+ private baseUrl;
1502
+ private socket;
1503
+ private apiKey;
1504
+ private logger;
1505
+ constructor(env: Env);
1506
+ getSocket(): Promise<Socket$1>;
1309
1507
  }
1310
1508
 
1311
- declare function isBoolean(): (target: object, propertyKey: string | symbol) => void;
1312
-
1313
- declare function validateIsBoolean(value: any): IValidationResult<boolean>;
1314
-
1315
- declare function isDate(): (target: object, propertyKey: string | symbol) => void;
1316
-
1317
- declare function validateIsDate(value: any): IValidationResult<Date>;
1318
-
1319
- declare function isNotEmpty(): (target: object, propertyKey: string | symbol) => void;
1320
-
1321
- declare function validateIsNotEmpty(value: any): IValidationResult<any>;
1322
-
1323
- declare function isNumber(): (target: object, propertyKey: string | symbol) => void;
1324
-
1325
- declare function validateIsNumber(value: any): IValidationResult<number>;
1326
-
1327
- declare function isPresent(): (target: object, propertyKey: string | symbol) => void;
1328
-
1329
- declare function validateIsPresent(value: any): IValidationResult<any>;
1330
-
1331
- declare function isString(): (target: object, propertyKey: string | symbol) => void;
1332
-
1333
- declare function validateIsString(value: any): IValidationResult<string>;
1334
-
1335
- declare function min(limit: any): (target: object, propertyKey: string | symbol) => void;
1336
-
1337
- interface IValidateMinOptions {
1338
- limit: any;
1509
+ declare class WhatsAppReceiverByWabotProxy extends WhatsAppReceiver {
1510
+ private connection;
1511
+ private loger;
1512
+ constructor(connection: WhatsAppWabotProxyConnection);
1513
+ connect(): Promise<void>;
1514
+ listenMessage(request: IListenWhatsAppMessageRequest): void;
1339
1515
  }
1340
- declare function validateMin(value: any, options: IValidateMinOptions): IValidationResult<any>;
1341
1516
 
1342
- declare function max(limit: any): (target: object, propertyKey: string | symbol) => void;
1343
-
1344
- interface IValidateMaxOptions {
1345
- limit: any;
1517
+ declare class WhatsAppSenderByWabotProxy extends WhatsAppSender {
1518
+ private wabotDevConnection;
1519
+ private logger;
1520
+ constructor(wabotDevConnection: WhatsAppWabotProxyConnection, chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
1521
+ sendWhatsApp(request: ISendWhatsAppRequest, options?: IWhatsAppSenderOptions): Promise<void>;
1346
1522
  }
1347
- declare function validateMax(value: any, options: IValidateMaxOptions): IValidationResult<any>;
1348
1523
 
1349
- declare class MoneyDto {
1350
- amount: string;
1351
- currency: string;
1524
+ interface IHtmlModuleOptions {
1525
+ url: string;
1526
+ title: string;
1352
1527
  }
1528
+ declare function HtmlModule(options: IHtmlModuleOptions): {
1529
+ new (): {};
1530
+ };
1353
1531
 
1354
- export { AnthropicChatAdapter, 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 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 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 ILanguageModelUsage, type IListenWhatsAppMessageRequest, type IMessageContext, type IMessageMetadata, 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 IStorableData, type ITelegramChannelConfig, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppContact, type IWhatsAppData, type IWhatsAppMessage, type IWhatsAppMessageListener, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsAppTemplate, type IWhatsAppTemplateComponent, type IWhatsAppTemplateMessage, type IWhatsAppTemplateParameter, type IWhatsAppTemplateResponse, type IWhatsAppWebhookPayload, type IWhatsappChannelConfig, type IchatControllerConfig, Job, JobRepository, JobRunner, JobsEventsHub, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, 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, Persistent, PgChatMemory, PgChatRepository, PgCrudRepository, PgJobRepository, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RestControllerMetadataStore, SocketChannel, SocketChannelConfig, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WabotChatAdapter, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByDevConnection, WhatsAppReceiverByWebHook, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByDevConnection, WhatsappChannelConfig, chatBot, chatController, chatItemTypeOptions, cmd, command, commandHandler, container, get, inject, injectable, isArray, isBoolean, isDate, isModel, isNotEmpty, isNumber, isOptional, isPresent, isString, jwtGuard, max, middleware, min, mindset, mindsetFunction, mindsetModule, modelInfo, param, post, restController, runAsyncCommandHandlers, runChatControllers, runRestControllers, scoped, singleton, socket, telegram, validate, validateArray, validateIsBoolean, validateIsDate, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsString, validateMax, validateMin, validateModel, whatsapp };
1532
+ 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 IApiKeySecretData, 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 };