@wabot-dev/framework 0.1.0-beta.9 → 0.2.0-beta.1

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 (212) hide show
  1. package/dist/src/addon/async/pg/PgJobRepository.js +26 -0
  2. package/dist/src/addon/auth/api-key/@apiKeyConnectionGuard.js +16 -0
  3. package/dist/src/addon/auth/api-key/@apiKeyGuard.js +17 -0
  4. package/dist/src/addon/auth/api-key/ApiKey.js +45 -0
  5. package/dist/src/addon/auth/api-key/ApiKeyConnectionGuardMiddleware.js +57 -0
  6. package/dist/src/addon/auth/api-key/ApiKeyGuardMiddleware.js +45 -0
  7. package/dist/src/addon/auth/api-key/ApiKeyRepository.js +22 -0
  8. package/dist/src/addon/auth/api-key/PgApiKeyRepository.js +53 -0
  9. package/dist/src/addon/auth/api-key/RemoteApiKeyRepository.js +62 -0
  10. package/dist/src/addon/auth/jwt/@jwtConnectionGuard.js +16 -0
  11. package/dist/src/addon/auth/jwt/@jwtGuard.js +17 -0
  12. package/dist/src/addon/auth/jwt/Jwt.js +53 -0
  13. package/dist/src/addon/auth/jwt/JwtAccessAndRefreshTokenDto.js +20 -0
  14. package/dist/src/addon/auth/jwt/JwtConfig.js +28 -0
  15. package/dist/src/addon/auth/jwt/JwtConnectionGuardMiddleware.js +57 -0
  16. package/dist/src/addon/auth/jwt/JwtGuardMiddleware.js +45 -0
  17. package/dist/src/addon/auth/jwt/JwtRefreshToken.js +56 -0
  18. package/dist/src/addon/auth/jwt/JwtRefreshTokenRepository.js +25 -0
  19. package/dist/src/addon/auth/jwt/JwtSigner.js +36 -0
  20. package/dist/src/addon/auth/jwt/JwtTokenDto.js +22 -0
  21. package/dist/src/addon/auth/jwt/PgJwtRefreshTokenRepository.js +21 -0
  22. package/dist/src/addon/chat-bot/anthropic/AnthropicChatAdapter.js +135 -0
  23. package/dist/src/addon/chat-bot/deepseek/DeepSeekChatAdapter.js +137 -0
  24. package/dist/src/addon/chat-bot/google/GoogleChatAdapter.js +128 -0
  25. package/dist/src/addon/chat-bot/openia/OpenaiChatAdapter.js +117 -0
  26. package/dist/src/{pre-made/repository/chat → addon/chat-bot}/pg/PgChatMemory.js +6 -4
  27. package/dist/src/{pre-made/repository/chat → addon/chat-bot}/pg/PgChatRepository.js +6 -5
  28. package/dist/src/{pre-made/repository/chat → addon/chat-bot}/ram/RamChatRepository.js +2 -2
  29. package/dist/src/addon/chat-bot/wabot/WabotChatAdapter.js +41 -0
  30. package/dist/src/addon/chat-controller/cmd/@cmd.js +24 -0
  31. package/dist/src/addon/chat-controller/cmd/CmdChannel.js +91 -0
  32. package/dist/src/{channels → addon/chat-controller}/socket/@socket.js +10 -4
  33. package/dist/src/{channels → addon/chat-controller}/socket/SocketChannel.js +9 -23
  34. package/dist/src/{channels → addon/chat-controller}/socket/SocketChannelConfig.js +1 -1
  35. package/dist/src/{channels → addon/chat-controller}/telegram/@telegram.js +10 -4
  36. package/dist/src/{channels → addon/chat-controller}/telegram/TelegramChannel.js +4 -22
  37. package/dist/src/addon/chat-controller/whatsapp/@whatsApp.js +26 -0
  38. package/dist/src/{channels → addon/chat-controller}/whatsapp/EnvWhatsAppRepository.js +3 -3
  39. package/dist/src/{channels → addon/chat-controller}/whatsapp/PgWhatsAppRepository.js +2 -2
  40. package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsApp.js +2 -4
  41. package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsAppChannel.js +6 -18
  42. package/dist/src/addon/chat-controller/whatsapp/WhatsAppReceiver.js +10 -0
  43. package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsAppSender.js +15 -39
  44. package/dist/src/addon/chat-controller/whatsapp/cloud-api/WhatsAppReceiverByCloudApi.js +97 -0
  45. package/dist/src/{channels/whatsapp → addon/chat-controller/whatsapp/cloud-api}/WhatsAppSenderByCloudApi.js +27 -20
  46. package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppProxyContracts.js +5 -0
  47. package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppReceiverByWabotProxy.js +65 -0
  48. package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppSenderByWabotProxy.js +61 -0
  49. package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppWabotProxyConnection.js +45 -0
  50. package/dist/src/{pre-made/module → addon/mindset}/html/HtmlModule.js +7 -7
  51. package/dist/src/core/auth/Auth.js +33 -0
  52. package/dist/src/core/{Persistent.js → entity/Entity.js} +24 -12
  53. package/dist/src/core/env/Env.js +39 -0
  54. package/dist/src/core/error/CustomError.js +15 -0
  55. package/dist/src/core/injection/index.js +4 -0
  56. package/dist/src/core/mapper/Mapper.js +42 -0
  57. package/dist/src/core/password/Password.js +30 -0
  58. package/dist/src/core/random/Random.js +65 -0
  59. package/dist/src/core/storable/Storable.js +8 -0
  60. package/dist/src/core/validation/core/validateArray.js +51 -0
  61. package/dist/src/core/validation/core/validateModel.js +36 -0
  62. package/dist/src/{validation/metadata/@isNumber.js → core/validation/metadata/@isArray.js} +5 -4
  63. package/dist/src/{validation/metadata/@isDate.js → core/validation/metadata/@isModel.js} +5 -4
  64. package/dist/src/{validation → core/validation}/metadata/@isOptional.js +1 -1
  65. package/dist/src/core/validation/metadata/ValidationMetadataStore.js +98 -0
  66. package/dist/src/core/validation/modelInfo.js +9 -0
  67. package/dist/src/{validation/validateModel2.js → core/validation/validate.js} +3 -3
  68. package/dist/src/{validation/metadata → core/validation/validators/is-boolean}/@isBoolean.js +3 -3
  69. package/dist/src/core/validation/validators/is-date/@isDate.js +17 -0
  70. package/dist/src/core/validation/validators/is-in/@isIn.js +18 -0
  71. package/dist/src/core/validation/validators/is-in/validateIsIn.js +12 -0
  72. package/dist/src/{validation/metadata → core/validation/validators/is-not-empty}/@isNotEmpty.js +3 -3
  73. package/dist/src/core/validation/validators/is-number/@isNumber.js +17 -0
  74. package/dist/src/{validation/metadata → core/validation/validators/is-present}/@isPresent.js +3 -3
  75. package/dist/src/{validation/metadata → core/validation/validators/is-string}/@isString.js +3 -3
  76. package/dist/src/{validation/metadata → core/validation/validators/max}/@max.js +3 -3
  77. package/dist/src/{validation/metadata → core/validation/validators/min}/@min.js +3 -3
  78. package/dist/src/feature/async/@command.js +11 -0
  79. package/dist/src/feature/async/@commandHandler.js +12 -0
  80. package/dist/src/feature/async/Async.js +38 -0
  81. package/dist/src/feature/async/Command.js +9 -0
  82. package/dist/src/feature/async/CommandMetadataStore.js +38 -0
  83. package/dist/src/feature/async/Job.js +27 -0
  84. package/dist/src/feature/async/JobRepository.js +31 -0
  85. package/dist/src/feature/async/JobRunner.js +48 -0
  86. package/dist/src/feature/async/JobsEventsHub.js +36 -0
  87. package/dist/src/feature/async/runCommandHandlers.js +29 -0
  88. package/dist/src/{core/chat → feature/chat-bot}/Chat.js +2 -2
  89. package/dist/src/feature/chat-bot/ChatAdapter.js +7 -0
  90. package/dist/src/feature/chat-bot/ChatBot.js +73 -0
  91. package/dist/src/feature/chat-bot/ChatItem.js +24 -0
  92. package/dist/src/feature/chat-bot/ChatMemory.js +10 -0
  93. package/dist/src/{core/chat/repository/IChatRepository.js → feature/chat-bot/ChatRepository.js} +2 -8
  94. package/dist/src/feature/chat-bot/IChatItem.js +3 -0
  95. package/dist/src/{chatbot → feature/chat-bot}/metadata/@chatBot.js +1 -1
  96. package/dist/src/{chatbot → feature/chat-bot}/metadata/ChatBotMetadataStore.js +1 -1
  97. package/dist/src/{controller/channel → feature/chat-controller}/ChatResolver.js +6 -4
  98. package/dist/src/{controller → feature/chat-controller}/metadata/ControllerMetadataStore.js +1 -1
  99. package/dist/src/{controller → feature/chat-controller}/metadata/controller/@chatController.js +1 -1
  100. package/dist/src/feature/chat-controller/runChatControllers.js +83 -0
  101. package/dist/src/{channels → feature}/express/ExpressProvider.js +2 -4
  102. package/dist/src/{channels → feature}/http/HttpServerProvider.js +2 -2
  103. package/dist/src/{mindset → feature/mindset}/IMindset.js +6 -0
  104. package/dist/src/feature/mindset/MindsetOperator.js +180 -0
  105. package/dist/src/{mindset → feature/mindset}/metadata/MindsetMetadataStore.js +1 -1
  106. package/dist/src/{mindset → feature/mindset}/metadata/functions/@mindsetFunction.js +1 -1
  107. package/dist/src/{mindset → feature/mindset}/metadata/mindsets/@mindset.js +1 -1
  108. package/dist/src/{mindset → feature/mindset}/metadata/modules/@mindsetModule.js +1 -2
  109. package/dist/src/{mindset → feature/mindset}/metadata/params/@param.js +1 -1
  110. package/dist/src/feature/money/Money.js +61 -0
  111. package/dist/src/feature/money/MoneyDto.js +22 -0
  112. package/dist/src/{repository → feature}/pg/PgCrudRepository.js +24 -10
  113. package/dist/src/{repository → feature}/pg/PgRepositoryBase.js +2 -2
  114. package/dist/src/feature/rest-controller/injection-tokens.js +4 -0
  115. package/dist/src/{rest-controller/metadata/@post.js → feature/rest-controller/metadata/@middleware.js} +5 -8
  116. package/dist/src/feature/rest-controller/metadata/@onDelete.js +7 -0
  117. package/dist/src/feature/rest-controller/metadata/@onGet.js +7 -0
  118. package/dist/src/feature/rest-controller/metadata/@onPost.js +7 -0
  119. package/dist/src/feature/rest-controller/metadata/@onPut.js +7 -0
  120. package/dist/src/{rest-controller → feature/rest-controller}/metadata/@restController.js +2 -2
  121. package/dist/src/{rest-controller → feature/rest-controller}/metadata/RestControllerMetadataStore.js +14 -1
  122. package/dist/src/{rest-controller/metadata/@get.js → feature/rest-controller/metadata/methodDecorator.js} +5 -5
  123. package/dist/src/feature/rest-controller/runRestControllers.js +103 -0
  124. package/dist/src/{channels → feature}/socket/SocketServerProvider.js +2 -2
  125. package/dist/src/feature/socket-controller/metadata/@connectionMiddleware.js +16 -0
  126. package/dist/src/feature/socket-controller/metadata/@socketConnection.js +18 -0
  127. package/dist/src/feature/socket-controller/metadata/@socketController.js +15 -0
  128. package/dist/src/feature/socket-controller/metadata/@socketEvent.js +18 -0
  129. package/dist/src/feature/socket-controller/metadata/SocketControllerMetadataStore.js +65 -0
  130. package/dist/src/feature/socket-controller/runSocketControllers.js +99 -0
  131. package/dist/src/index.d.ts +1219 -718
  132. package/dist/src/index.js +147 -102
  133. package/package.json +8 -2
  134. package/dist/src/_virtual/_commonjsHelpers.js +0 -5
  135. package/dist/src/_virtual/cjs.js +0 -7
  136. package/dist/src/ai/deepseek/DeepSeekChatBotAdapter.js +0 -107
  137. package/dist/src/ai/openia/OpenaiChatBotAdapter.js +0 -88
  138. package/dist/src/channels/cmd/@cmd.js +0 -18
  139. package/dist/src/channels/cmd/CmdChannel.js +0 -73
  140. package/dist/src/channels/wabot/WabotDevConnection.js +0 -57
  141. package/dist/src/channels/wabot/WabotDevSocketContracts.js +0 -10
  142. package/dist/src/channels/whatsapp/@whatsapp.js +0 -20
  143. package/dist/src/channels/whatsapp/WhatsAppReceiver.js +0 -59
  144. package/dist/src/channels/whatsapp/WhatsAppReceiverByDevConnection.js +0 -32
  145. package/dist/src/channels/whatsapp/WhatsAppReceiverByWebHook.js +0 -63
  146. package/dist/src/channels/whatsapp/WhatsAppSenderByDevConnection.js +0 -61
  147. package/dist/src/chatbot/ChatBot.js +0 -51
  148. package/dist/src/chatbot/ChatBotAdapter.js +0 -72
  149. package/dist/src/controller/channel/UserResolver.js +0 -21
  150. package/dist/src/core/IMessageContext.js +0 -12
  151. package/dist/src/core/chat/ChatItem.js +0 -15
  152. package/dist/src/core/chat/repository/IChatMemory.js +0 -10
  153. package/dist/src/core/user/IUserRepository.js +0 -19
  154. package/dist/src/core/user/User.js +0 -26
  155. package/dist/src/env/WabotEnv.js +0 -27
  156. package/dist/src/injection/index.js +0 -4
  157. package/dist/src/mindset/MindsetOperator.js +0 -101
  158. package/dist/src/node_modules/@selderee/plugin-htmlparser2/lib/hp2-builder.js +0 -90
  159. package/dist/src/node_modules/deepmerge/dist/cjs.js +0 -142
  160. package/dist/src/node_modules/dom-serializer/lib/esm/foreignNames.js +0 -102
  161. package/dist/src/node_modules/dom-serializer/lib/esm/index.js +0 -186
  162. package/dist/src/node_modules/domelementtype/lib/esm/index.js +0 -53
  163. package/dist/src/node_modules/domhandler/lib/esm/index.js +0 -148
  164. package/dist/src/node_modules/domhandler/lib/esm/node.js +0 -334
  165. package/dist/src/node_modules/entities/lib/esm/decode.js +0 -458
  166. package/dist/src/node_modules/entities/lib/esm/decode_codepoint.js +0 -62
  167. package/dist/src/node_modules/entities/lib/esm/escape.js +0 -99
  168. package/dist/src/node_modules/entities/lib/esm/generated/decode-data-html.js +0 -8
  169. package/dist/src/node_modules/entities/lib/esm/generated/decode-data-xml.js +0 -8
  170. package/dist/src/node_modules/html-to-text/lib/html-to-text.js +0 -2147
  171. package/dist/src/node_modules/htmlparser2/lib/esm/Parser.js +0 -491
  172. package/dist/src/node_modules/htmlparser2/lib/esm/Tokenizer.js +0 -928
  173. package/dist/src/node_modules/htmlparser2/lib/esm/index.js +0 -18
  174. package/dist/src/node_modules/leac/lib/leac.js +0 -3
  175. package/dist/src/node_modules/parseley/lib/parseley.js +0 -270
  176. package/dist/src/node_modules/peberminta/lib/core.js +0 -171
  177. package/dist/src/node_modules/selderee/lib/selderee.js +0 -380
  178. package/dist/src/pre-made/module/authentication/AuthenticationModule.js +0 -97
  179. package/dist/src/pre-made/module/authentication/requests/SendOneTimePasswordRequest.js +0 -25
  180. package/dist/src/pre-made/module/authentication/requests/ValidateOneTimePasswordRequest.js +0 -25
  181. package/dist/src/pre-made/module/register-user/RegisterUserModule.js +0 -56
  182. package/dist/src/pre-made/module/register-user/requests/RegisterUserWithEmailRequest.js +0 -25
  183. package/dist/src/pre-made/repository/user/pg/PgUserRepository.js +0 -33
  184. package/dist/src/pre-made/repository/user/ram/RamUserRepository.js +0 -27
  185. package/dist/src/pre-made/service/EmailService.js +0 -13
  186. package/dist/src/pre-made/service/OtpService.js +0 -14
  187. package/dist/src/rest-controller/runRestControllers.js +0 -74
  188. package/dist/src/server/prepareChatContainer.js +0 -43
  189. package/dist/src/server/runChannel.js +0 -27
  190. package/dist/src/server/runServer.js +0 -40
  191. package/dist/src/validation/metadata/@validable.js +0 -14
  192. package/dist/src/validation/metadata/ValidationMetadataStore.js +0 -55
  193. package/dist/src/validation/validators/validateModel.js +0 -47
  194. /package/dist/src/{pre-made/repository/chat → addon/chat-bot}/ram/RamChatMemory.js +0 -0
  195. /package/dist/src/{channels → addon/chat-controller}/telegram/TelegramChannelConfig.js +0 -0
  196. /package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsAppChannelConfig.js +0 -0
  197. /package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsAppRepository.js +0 -0
  198. /package/dist/src/{injection → core/injection}/Container.js +0 -0
  199. /package/dist/src/{logger → core/logger}/Logger.js +0 -0
  200. /package/dist/src/{validation/validators → core/validation/core}/validateIsOptional.js +0 -0
  201. /package/dist/src/{validation/validators → core/validation/validators/is-boolean}/validateIsBoolean.js +0 -0
  202. /package/dist/src/{validation/validators → core/validation/validators/is-date}/validateIsDate.js +0 -0
  203. /package/dist/src/{validation/validators → core/validation/validators/is-not-empty}/validateIsNotEmpty.js +0 -0
  204. /package/dist/src/{validation/validators → core/validation/validators/is-number}/validateIsNumber.js +0 -0
  205. /package/dist/src/{validation/validators → core/validation/validators/is-present}/validateIsPresent.js +0 -0
  206. /package/dist/src/{validation/validators → core/validation/validators/is-string}/validateIsString.js +0 -0
  207. /package/dist/src/{validation/validators → core/validation/validators/max}/validateMax.js +0 -0
  208. /package/dist/src/{validation/validators → core/validation/validators/min}/validateMin.js +0 -0
  209. /package/dist/src/{mindset → feature/mindset}/metadata/functions/decoratorNames.js +0 -0
  210. /package/dist/src/{mindset → feature/mindset}/metadata/mindsets/decoratorNames.js +0 -0
  211. /package/dist/src/{mindset → feature/mindset}/metadata/modules/decoratorNames.js +0 -0
  212. /package/dist/src/{mindset → feature/mindset}/metadata/params/decoratorNames.js +0 -0
@@ -1,183 +1,437 @@
1
+ import * as tsyringe from 'tsyringe';
2
+ import { DependencyContainer as DependencyContainer$1 } from 'tsyringe';
3
+ export { DependencyContainer } from 'tsyringe';
1
4
  import InjectionToken from 'tsyringe/dist/typings/providers/injection-token';
2
5
  import DependencyContainer, { PreResolutionInterceptorCallback, PostResolutionInterceptorCallback } from 'tsyringe/dist/typings/types/dependency-container';
3
6
  import InterceptionOptions from 'tsyringe/dist/typings/types/interceptor-options';
4
7
  import { Server } from 'http';
5
- import { Express } from 'express';
6
- import { Server as Server$1 } from 'socket.io';
7
- import { Socket } from 'socket.io-client';
8
+ import { Express, Request, Response } from 'express';
9
+ import * as big_js from 'big.js';
8
10
  import { Pool } from 'pg';
9
- import * as tsyringe from 'tsyringe';
10
- import { DependencyContainer as DependencyContainer$1 } from 'tsyringe';
11
- export { DependencyContainer } from 'tsyringe';
11
+ import { Server as Server$1, Socket } from 'socket.io';
12
+ import { Algorithm } from 'jsonwebtoken';
13
+ import { Socket as Socket$1 } from 'socket.io-client';
12
14
 
13
- interface IMindsetFunctionConfig {
14
- description: string;
15
+ type IPrimitive = null | number | string | boolean | undefined;
16
+ type IStorableData = {
17
+ [key: string]: IPrimitive | IPrimitive[] | IStorableData | IStorableData[];
18
+ };
19
+ declare class Storable<D extends IStorableData> {
20
+ protected data: D;
21
+ constructor(data: D);
15
22
  }
16
23
 
17
- declare function mindsetFunction(config: IMindsetFunctionConfig): (target: object, propertyKey: string | symbol) => void;
18
-
19
- declare const MINDSET_FUNCTION_DECORATION_FUNCTION = "mindsetFunction";
20
-
21
- interface IMindsetFunctionDecoration {
22
- decorationName: string;
23
- functionName: string;
24
- constructor: Function;
25
- paramsTypes: Function[];
26
- decorationConfig: any;
24
+ declare class Auth<D extends IStorableData> {
25
+ private authInfo;
26
+ require(): D;
27
+ assign(authInfo: D): void;
28
+ override(authInfo: D): void;
29
+ clear(): void;
30
+ isAssigned(): boolean;
27
31
  }
28
32
 
29
- interface IPersistentData {
33
+ interface IEntityData extends IStorableData {
30
34
  id?: string;
31
35
  createdAt?: number | null;
32
36
  discardedAt?: number | null;
33
37
  }
34
- declare class Persistent<D extends IPersistentData = IPersistentData> {
35
- protected data: D;
36
- constructor(data: D);
38
+ declare class Entity<D extends IEntityData> extends Storable<D> {
39
+ get id(): string;
40
+ /**
41
+ * @deprecated use id
42
+ */
37
43
  getId(): string;
44
+ get createdAt(): Date;
45
+ /**
46
+ * @deprecated use createdAt
47
+ */
38
48
  getCreatedAt(): Date;
39
- update(newData: D): void;
49
+ update(newData: Omit<D, 'id' | 'createdAt' | 'discardedAt'>): void;
40
50
  wasCreated(): boolean;
41
51
  validate(): void;
42
- discard(): void;
43
52
  }
44
-
45
- type IChatType = 'PRIVATE' | 'GROUP';
46
- interface IChatConnection {
47
- chatType: IChatType;
48
- channelName: string;
49
- id: string;
53
+ /**
54
+ * @deprecated Should use IEntityData
55
+ */
56
+ interface IPersistentData extends IEntityData {
50
57
  }
51
- interface IChatData extends IPersistentData {
52
- type: IChatType;
53
- connections: IChatConnection[];
58
+ /**
59
+ * @deprecated Should use Entity
60
+ */
61
+ declare class Persistent<D extends IPersistentData> extends Entity<D> {
54
62
  }
55
- declare class Chat extends Persistent<IChatData> {
56
- constructor(data: IChatData);
57
- isPrivate(): boolean;
58
- isGroup(): boolean;
59
- hasConnection(connection: IChatConnection): boolean;
60
- private validatePrivateChat;
61
- private validateGroupChat;
62
- validate(): void;
63
+
64
+ type IEnvType = 'development' | 'staging' | 'testing' | 'production';
65
+ declare class Env {
66
+ private envType;
67
+ constructor();
68
+ isDevelopment(): boolean;
69
+ isProduction(): boolean;
70
+ isTesting(): boolean;
71
+ requireString(varName: string, options?: {
72
+ default?: string;
73
+ }): string;
74
+ requireNumber(varName: string, options?: {
75
+ default?: number;
76
+ }): number;
77
+ }
78
+
79
+ interface ICustomErrorData {
80
+ message: string;
81
+ humanMessage?: string;
82
+ code?: string;
83
+ httpCode?: number;
84
+ cause?: Error;
85
+ info?: any;
86
+ }
87
+ declare class CustomError extends Error {
88
+ humanMessage?: string;
89
+ code?: string;
90
+ httpCode?: number;
91
+ info?: any;
92
+ constructor(data: ICustomErrorData);
63
93
  }
64
94
 
65
- interface IChatDocument {
95
+ type IConstructor<T> = new (...args: any[]) => T;
96
+
97
+ declare class Container implements DependencyContainer {
98
+ register(token: unknown, provider: unknown, options?: unknown): DependencyContainer;
99
+ registerSingleton(from: unknown, to?: unknown): DependencyContainer;
100
+ registerType<T>(from: InjectionToken<T>, to: InjectionToken<T>): DependencyContainer;
101
+ registerInstance<T>(token: InjectionToken<T>, instance: T): DependencyContainer;
102
+ resolve<T>(token: InjectionToken<T>): T;
103
+ resolveAll<T>(token: InjectionToken<T>): T[];
104
+ isRegistered<T>(token: InjectionToken<T>, recursive?: boolean): boolean;
105
+ reset(): void;
106
+ clearInstances(): void;
107
+ createChildContainer(): DependencyContainer;
108
+ beforeResolution<T>(token: InjectionToken<T>, callback: PreResolutionInterceptorCallback<T>, options?: InterceptionOptions): void;
109
+ afterResolution<T>(token: InjectionToken<T>, callback: PostResolutionInterceptorCallback<T>, options?: InterceptionOptions): void;
110
+ dispose(): Promise<void> | void;
66
111
  }
67
112
 
68
- interface IChatImage {
113
+ declare const injectable: typeof tsyringe.injectable;
114
+ declare const container: tsyringe.DependencyContainer;
115
+ declare const singleton: typeof tsyringe.singleton;
116
+ declare const inject: typeof tsyringe.inject;
117
+ declare const scoped: typeof tsyringe.scoped;
118
+ declare const Lifecycle: typeof tsyringe.Lifecycle;
119
+
120
+ declare class Logger {
121
+ private debuggers;
122
+ constructor(name: string);
123
+ trace(...args: any[]): void;
124
+ debug(...args: any[]): void;
125
+ info(...args: any[]): void;
126
+ warn(...args: any[]): void;
127
+ error(...args: any[]): void;
128
+ fatal(...args: any[]): void;
129
+ private log;
69
130
  }
70
131
 
71
- interface IUserConnection {
72
- channelName: string;
73
- id: string;
132
+ declare class Mapper {
133
+ map<T>(data: any, ctor: IConstructor<T>): T;
74
134
  }
75
- interface IUserData extends IPersistentData {
76
- shortName: string;
77
- connections: IUserConnection[];
78
- keyValueData: {
79
- [key: string]: string;
80
- };
135
+
136
+ interface PasswordHashOptions {
137
+ password: string;
138
+ saltLength?: number;
139
+ keyLength?: number;
81
140
  }
82
- declare class User extends Persistent<IUserData> {
83
- constructor(data: IUserData);
84
- hasConnection(connection: IUserConnection): boolean;
85
- getValue(key: string): string;
86
- setValue(key: string, value: string): void;
87
- addConnection(connection: IUserConnection): void;
141
+ declare class Password {
142
+ static hash(options: PasswordHashOptions): string;
143
+ static isValid(req: {
144
+ password: string;
145
+ hash: string;
146
+ }): boolean;
147
+ static generate(length: number): string;
88
148
  }
89
149
 
90
- interface IChatMessage {
91
- text?: string;
92
- documents?: IChatDocument[];
93
- images?: IChatImage[];
94
- senderName: string;
95
- }
96
- interface IConnectionChatMessage extends IChatMessage {
97
- chatConnection: IChatConnection;
98
- userConnection: IUserConnection;
99
- userId?: string;
150
+ declare class Random {
151
+ static integer(options: {
152
+ min: number;
153
+ max: number;
154
+ }): number;
155
+ static slug(name: string, options: {
156
+ randomLength: number;
157
+ }): string;
158
+ static alphaNumeric(length: number): string;
159
+ static alphaNumericLowerCase(length: number): string;
160
+ static numberCode(length: number): string;
100
161
  }
101
162
 
102
- interface IChatFunctionCall {
103
- id: string;
104
- name: string;
105
- arguments?: string;
106
- result: string;
163
+ interface ICrudRepository<T> {
164
+ find(id: string): Promise<T | null>;
165
+ findOrThrow(id: string): Promise<T>;
166
+ findByIds(ids: string[]): Promise<T[]>;
167
+ findAll(id: string): Promise<T[]>;
168
+ create(item: T): Promise<void>;
169
+ update(item: T): Promise<void>;
170
+ delete(item: T): Promise<void>;
107
171
  }
108
172
 
109
- type ISystemMessageItem = {
110
- type: 'BOT_MESSAGE';
111
- content: IChatMessage;
173
+ declare function isModel(model: IConstructor<any>): (target: object, propertyKey: string | symbol) => void;
174
+
175
+ declare function isOptional(): (target: object, propertyKey: string | symbol) => void;
176
+
177
+ interface IValidationError {
178
+ description: string;
179
+ }
180
+ interface IModelValidationError extends IValidationError {
181
+ properties: {
182
+ [key: string]: string[];
183
+ };
184
+ }
185
+ interface IArrayValidationError extends IValidationError {
186
+ items: (IValidationError[] | null)[];
187
+ }
188
+ type IValidationResult<V> = {
189
+ value: V;
190
+ error?: undefined;
191
+ } | {
192
+ value?: undefined;
193
+ error: IValidationError;
112
194
  };
113
- type IReceivedMessageItem = {
114
- type: 'CONNECTION_MESSAGE';
115
- content: IConnectionChatMessage;
195
+ type IModelValidationResult<V> = {
196
+ value: V;
197
+ error?: undefined;
198
+ } | {
199
+ value?: undefined;
200
+ error: IModelValidationError;
116
201
  };
117
- type ISystemFunctionCallItem = {
118
- type: 'FUNCTION_CALL';
119
- content: IChatFunctionCall;
202
+ type IArrayValidationResult<V> = {
203
+ value: V[];
204
+ error?: undefined;
205
+ } | {
206
+ value?: undefined;
207
+ error: IArrayValidationError;
120
208
  };
121
- type IChatItemData = {
122
- id?: string;
123
- createdAt?: number;
124
- } & (ISystemMessageItem | IReceivedMessageItem | ISystemFunctionCallItem);
125
- type IChatItemType = IChatItemData['type'];
126
- declare class ChatItem extends Persistent<IChatItemData> {
127
- getType(): "BOT_MESSAGE" | "CONNECTION_MESSAGE" | "FUNCTION_CALL";
128
- getContent(): IChatMessage | IConnectionChatMessage | IChatFunctionCall;
129
- getData(): IChatItemData;
209
+ type IValidator<V = any, O = any> = (value: V, options: O) => IValidationResult<V>;
210
+ interface IPropertyValidatorInfo {
211
+ propertyName: string;
212
+ validator: IValidator;
213
+ validatorOptions?: any;
130
214
  }
215
+ type IModelValidatorsInfo<V> = {
216
+ modelConstructor: IConstructor<V>;
217
+ properties: {
218
+ [prop: string]: {
219
+ isOptional?: boolean;
220
+ validators?: IPropertyValidatorInfo[];
221
+ } | undefined;
222
+ };
223
+ };
131
224
 
132
- interface IChatMemory {
133
- findLastItems(count: number): Promise<ChatItem[]>;
134
- create(item: ChatItem): Promise<void>;
225
+ interface IValidateArrayOptions {
226
+ minLength?: number;
227
+ maxLength?: number;
135
228
  }
136
- declare class ChatMemory implements IChatMemory {
137
- findLastItems(count: number): Promise<ChatItem[]>;
138
- create(item: ChatItem): Promise<void>;
229
+ interface IValidateArrayOptionsWithItemsValidators extends IValidateArrayOptions {
230
+ itemsValidator?: {
231
+ validator: IValidator;
232
+ options: any;
233
+ }[];
139
234
  }
235
+ declare function validateArray(value: any, options?: IValidateArrayOptionsWithItemsValidators): IArrayValidationResult<any>;
140
236
 
141
- interface IChatRepository {
142
- create(chat: Chat): Promise<void>;
143
- findByConnection(query: IChatConnection): Promise<Chat | null>;
144
- findMemory(chatId: string): Promise<IChatMemory | null>;
237
+ declare function isArray(options?: IValidateArrayOptions): (target: object, propertyKey: string | symbol) => void;
238
+
239
+ interface IValidatorMetadata {
240
+ modelConstructor: IConstructor<any>;
241
+ propertyName: string;
242
+ validator: IValidator;
243
+ validatorOptions?: any;
145
244
  }
146
- declare class ChatRepository implements IChatRepository {
147
- create(chat: Chat): Promise<void>;
148
- findByConnection(query: IChatConnection): Promise<Chat | null>;
149
- findMemory(chatId: string): Promise<IChatMemory | null>;
245
+
246
+ declare class ValidationMetadataStore {
247
+ private validators;
248
+ saveValidatorMetadata(validatorMetadata: IValidatorMetadata): void;
249
+ getModelValidatorsInfo<V>(modelConstructor: IConstructor<V>): IModelValidatorsInfo<V>;
250
+ private getConstructorPropertiesValidatorsInfo;
251
+ }
252
+
253
+ declare function validateModel<V>(value: any, info: IModelValidatorsInfo<V>): IModelValidationResult<V>;
254
+
255
+ declare function validate<V>(value: any, modelConstructor: IConstructor<V>): IModelValidationResult<V>;
256
+
257
+ declare function modelInfo<V>(modelConstructor: IConstructor<V>): IModelValidatorsInfo<V>;
258
+
259
+ declare function isBoolean(): (target: object, propertyKey: string | symbol) => void;
260
+
261
+ declare function validateIsBoolean(value: any): IValidationResult<boolean>;
262
+
263
+ declare function isDate(): (target: object, propertyKey: string | symbol) => void;
264
+
265
+ declare function validateIsDate(value: any): IValidationResult<Date>;
266
+
267
+ interface IValidateIsInOptions {
268
+ values: readonly (number | string | boolean | null)[];
269
+ }
270
+ declare function validateIsIn(value: any, options: IValidateIsInOptions): IValidationResult<any>;
271
+
272
+ declare function isIn(values: IValidateIsInOptions['values']): (target: object, propertyKey: string | symbol) => void;
273
+
274
+ declare function isNotEmpty(): (target: object, propertyKey: string | symbol) => void;
275
+
276
+ declare function validateIsNotEmpty(value: any): IValidationResult<any>;
277
+
278
+ declare function isNumber(): (target: object, propertyKey: string | symbol) => void;
279
+
280
+ declare function validateIsNumber(value: any): IValidationResult<number>;
281
+
282
+ declare function isPresent(): (target: object, propertyKey: string | symbol) => void;
283
+
284
+ declare function validateIsPresent(value: any): IValidationResult<any>;
285
+
286
+ declare function isString(): (target: object, propertyKey: string | symbol) => void;
287
+
288
+ declare function validateIsString(value: any): IValidationResult<string>;
289
+
290
+ declare function max(limit: any): (target: object, propertyKey: string | symbol) => void;
291
+
292
+ interface IValidateMaxOptions {
293
+ limit: any;
150
294
  }
295
+ declare function validateMax(value: any, options: IValidateMaxOptions): IValidationResult<any>;
296
+
297
+ declare function min(limit: any): (target: object, propertyKey: string | symbol) => void;
151
298
 
152
- interface IUserRepository {
153
- create(chat: User): Promise<void>;
154
- update(chat: User): Promise<void>;
155
- findByConnection(query: IUserConnection): Promise<User | null>;
299
+ interface IValidateMinOptions {
300
+ limit: any;
156
301
  }
157
- declare class UserRepository implements IUserRepository {
158
- create(chat: User): Promise<void>;
159
- update(chat: User): Promise<void>;
160
- findByConnection(query: IUserConnection): Promise<User | null>;
302
+ declare function validateMin(value: any, options: IValidateMinOptions): IValidationResult<any>;
303
+
304
+ interface ICommandConfig {
305
+ name?: string;
161
306
  }
307
+ declare function command(config?: ICommandConfig): (target: IConstructor<any>) => void;
162
308
 
163
- interface IMessageContext {
164
- message: IConnectionChatMessage;
165
- chat: Chat;
166
- user: User | null;
309
+ declare class Command<T extends IStorableData> extends Storable<T> {
310
+ getData(): T;
167
311
  }
168
- declare class MessageContext implements IMessageContext {
169
- message: IConnectionChatMessage;
170
- chat: Chat;
171
- user: User | null;
172
- constructor(message: IConnectionChatMessage, chat: Chat, user: User | null);
312
+
313
+ interface ICommandHandler<C extends Command<any>> {
314
+ handle(command: C): void | Promise<void>;
173
315
  }
174
316
 
175
- interface IReversibleMapper<T1, T2> {
176
- map(input: T1): T2;
177
- rev(input: T2): T1;
317
+ interface ICommandHandlerConfig<C extends Command<any>> {
318
+ command: IConstructor<C>;
178
319
  }
320
+ declare function commandHandler<C extends Command<any>>(config: ICommandHandlerConfig<C>): (target: IConstructor<ICommandHandler<C>>) => void;
179
321
 
180
- type IConstructor<T> = new (...args: any[]) => T;
322
+ declare class CommandMetadataStore {
323
+ private handlersMap;
324
+ private handlersInverseMap;
325
+ private commandsMap;
326
+ private commandsInverseMap;
327
+ registerCommand(command: IConstructor<Command<any>>, commandName: string): void;
328
+ registerHandler(command: IConstructor<Command<any>>, handlerConstructor: IConstructor<ICommandHandler<any>>): void;
329
+ getHandlerForCommandName(commandName: string): IConstructor<ICommandHandler<any>> | null;
330
+ getCommandNameForHandler(handlerConstructor: IConstructor<ICommandHandler<any>>): string | null;
331
+ getCommandName(command: IConstructor<Command<any>>): string | null;
332
+ getCommandForCommandName(commandName: string): IConstructor<Command<any>> | null;
333
+ }
334
+
335
+ interface IJobData extends IEntityData {
336
+ commandName: string;
337
+ commandData: any;
338
+ startedAt?: number;
339
+ successAt?: number;
340
+ failedAt?: number;
341
+ retryAt?: number;
342
+ error?: {
343
+ message: string;
344
+ stack?: string;
345
+ info?: any;
346
+ };
347
+ }
348
+ declare class Job extends Entity<IJobData> {
349
+ get commandName(): string;
350
+ hasFinished(): boolean;
351
+ setAsStarted(): void;
352
+ setAsSuccess(): void;
353
+ setAsFailed(error: Error): void;
354
+ }
355
+
356
+ interface IJobRepository extends ICrudRepository<Job> {
357
+ }
358
+
359
+ declare class JobRepository implements IJobRepository {
360
+ find(id: string): Promise<Job | null>;
361
+ findOrThrow(id: string): Promise<Job>;
362
+ findByIds(ids: string[]): Promise<Job[]>;
363
+ findAll(id: string): Promise<Job[]>;
364
+ create(item: Job): Promise<void>;
365
+ update(item: Job): Promise<void>;
366
+ delete(item: Job): Promise<void>;
367
+ }
368
+
369
+ interface IJobEvent extends IStorableData {
370
+ jobId: string;
371
+ type: 'created';
372
+ }
373
+ type IJobEventListener = (event: IJobEvent) => void | Promise<void>;
374
+ declare class JobsEventsHub {
375
+ private logger;
376
+ private jobsEventsListener;
377
+ notifyJobCreated(job: Job): void;
378
+ listenJobsEvents(listener: IJobEventListener): void;
379
+ }
380
+
381
+ declare class Async {
382
+ private jobRepository;
383
+ private handlerContainer;
384
+ private jobsEventsHub;
385
+ constructor(jobRepository: JobRepository, handlerContainer: CommandMetadataStore, jobsEventsHub: JobsEventsHub);
386
+ run<T extends IStorableData>(command: Command<T>): Promise<Job>;
387
+ }
388
+
389
+ declare class JobRunner {
390
+ private jobRepository;
391
+ private handlerContainer;
392
+ private logger;
393
+ constructor(jobRepository: JobRepository, handlerContainer: CommandMetadataStore);
394
+ run(job: Job): Promise<void>;
395
+ }
396
+
397
+ declare function runAsyncCommandHandlers(handlers: IConstructor<ICommandHandler<any>>[]): void;
398
+
399
+ interface IChatConnection extends IStorableData {
400
+ channelName: string;
401
+ id: string;
402
+ }
403
+
404
+ type IChatType = 'PRIVATE' | 'GROUP';
405
+
406
+ interface IChatData extends IEntityData {
407
+ type: IChatType;
408
+ connections: IChatConnection[];
409
+ }
410
+ declare class Chat extends Entity<IChatData> {
411
+ constructor(data: IChatData);
412
+ isPrivate(): boolean;
413
+ isGroup(): boolean;
414
+ hasConnection(connection: IChatConnection): boolean;
415
+ private validatePrivateChat;
416
+ private validateGroupChat;
417
+ validate(): void;
418
+ }
419
+
420
+ interface IMindsetFunctionConfig {
421
+ description: string;
422
+ }
423
+
424
+ declare function mindsetFunction(config: IMindsetFunctionConfig): (target: object, propertyKey: string | symbol) => void;
425
+
426
+ declare const MINDSET_FUNCTION_DECORATION_FUNCTION = "mindsetFunction";
427
+
428
+ interface IMindsetFunctionDecoration {
429
+ decorationName: string;
430
+ functionName: string;
431
+ constructor: Function;
432
+ paramsTypes: Function[];
433
+ decorationConfig: any;
434
+ }
181
435
 
182
436
  interface IMindsetIdentity {
183
437
  name: string;
@@ -186,15 +440,23 @@ interface IMindsetIdentity {
186
440
  personality?: string;
187
441
  emotions?: string;
188
442
  }
443
+ interface IMindsetLlm {
444
+ provider?: string;
445
+ model: string;
446
+ }
189
447
  interface IMindset {
190
448
  identity(): Promise<IMindsetIdentity>;
191
449
  skills(): Promise<string>;
192
450
  limits(): Promise<string>;
451
+ workflow(): Promise<string>;
452
+ llms(): Promise<IMindsetLlm[]>;
193
453
  }
194
454
  declare class Mindset implements IMindset {
195
455
  identity(): Promise<IMindsetIdentity>;
196
456
  skills(): Promise<string>;
197
457
  limits(): Promise<string>;
458
+ workflow(): Promise<string>;
459
+ llms(): Promise<IMindsetLlm[]>;
198
460
  }
199
461
 
200
462
  interface IMindsetConfig {
@@ -283,26 +545,17 @@ declare class MindsetMetadataStore {
283
545
  getMindsetMetadata(ctor: Function): IMindsetMetadata;
284
546
  }
285
547
 
286
- declare class Container implements DependencyContainer {
287
- register(token: unknown, provider: unknown, options?: unknown): DependencyContainer;
288
- registerSingleton(from: unknown, to?: unknown): DependencyContainer;
289
- registerType<T>(from: InjectionToken<T>, to: InjectionToken<T>): DependencyContainer;
290
- registerInstance<T>(token: InjectionToken<T>, instance: T): DependencyContainer;
291
- resolve<T>(token: InjectionToken<T>): T;
292
- resolveAll<T>(token: InjectionToken<T>): T[];
293
- isRegistered<T>(token: InjectionToken<T>, recursive?: boolean): boolean;
294
- reset(): void;
295
- clearInstances(): void;
296
- createChildContainer(): DependencyContainer;
297
- beforeResolution<T>(token: InjectionToken<T>, callback: PreResolutionInterceptorCallback<T>, options?: InterceptionOptions): void;
298
- afterResolution<T>(token: InjectionToken<T>, callback: PostResolutionInterceptorCallback<T>, options?: InterceptionOptions): void;
299
- dispose(): Promise<void> | void;
548
+ interface IMindsetToolParameter {
549
+ type: string;
550
+ name: string;
551
+ description: string;
552
+ }
553
+ interface IMindsetTool {
554
+ language: string;
555
+ name: string;
556
+ description: string;
557
+ parameters: IMindsetToolParameter[];
300
558
  }
301
-
302
- declare const injectable: typeof tsyringe.injectable;
303
- declare const container: tsyringe.DependencyContainer;
304
- declare const singleton: typeof tsyringe.singleton;
305
- declare const inject: typeof tsyringe.inject;
306
559
 
307
560
  declare class MindsetOperator implements IMindset {
308
561
  private mindset;
@@ -312,45 +565,88 @@ declare class MindsetOperator implements IMindset {
312
565
  identity(): Promise<IMindsetIdentity>;
313
566
  skills(): Promise<string>;
314
567
  limits(): Promise<string>;
568
+ workflow(): Promise<string>;
569
+ llms(): Promise<IMindsetLlm[]>;
570
+ systemPrompt(): Promise<string>;
571
+ tools(): IMindsetTool[];
572
+ protected tool(fn: IMindsetFunctionMetadata, module: IMindsetModuleMetadata): IMindsetTool;
573
+ protected toolParameter(param: IMindsetFunctionParamMetadata): IMindsetToolParameter;
315
574
  callFunction(name: string, params: string): Promise<string>;
316
- allFunctionsDescriptors(): Promise<{
317
- readonly type: "function";
318
- readonly name: string;
319
- readonly description: string;
320
- readonly parameters: {
321
- readonly type: "object";
322
- readonly properties: {};
323
- readonly required: string[];
324
- };
325
- }[]>;
326
- private functionDescriptor;
327
- private toolParam;
575
+ functionResponseToString(response: any): Promise<string>;
576
+ functionErrorToString(error: any): Promise<string>;
328
577
  }
329
578
 
330
- declare function chatBot(mindset: IConstructor<IMindset>): (target: object, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
579
+ interface IChatMessage extends IStorableData {
580
+ senderId?: string;
581
+ senderName?: string;
582
+ text?: string;
583
+ }
331
584
 
332
- interface IChatBotMetadata {
333
- constructor: IConstructor<any>;
334
- mindsetConstructor: IConstructor<IMindset>;
335
- injectionToken: string;
585
+ interface IFunctionCall extends IStorableData {
586
+ id: string;
587
+ name: string;
588
+ arguments?: string;
589
+ result?: string;
336
590
  }
337
591
 
338
- declare class ChatBotMetadataStore {
339
- private chatBots;
340
- saveChatBotMetadata(chatBot: IChatBotMetadata): void;
341
- getChatBotsMetadata(): IChatBotMetadata[];
592
+ declare const chatItemTypeOptions: readonly ["botMessage", "humanMessage", "functionCall"];
593
+ type IBotMessageItem = {
594
+ type: 'botMessage';
595
+ botMessage: IChatMessage;
596
+ };
597
+ type IHumanMessageItem = {
598
+ type: 'humanMessage';
599
+ humanMessage: IChatMessage;
600
+ };
601
+ type IFunctionCallItem = {
602
+ type: 'functionCall';
603
+ functionCall: IFunctionCall;
604
+ };
605
+ type IChatItem = IBotMessageItem | IHumanMessageItem | IFunctionCallItem;
606
+ type IChatItemType = (typeof chatItemTypeOptions)[number];
607
+
608
+ interface ILanguageModelUsage {
609
+ inputTokens: number;
610
+ outputTokens: number;
611
+ }
612
+
613
+ interface IChatAdapterNextItemReq {
614
+ model: string;
615
+ systemPrompt: string;
616
+ tools: IMindsetTool[];
617
+ prevItems: IChatItem[];
618
+ }
619
+ interface IChatAdapterNextItemRes {
620
+ chatItem: IChatItem;
621
+ usage: ILanguageModelUsage;
622
+ }
623
+ interface IChatAdapter {
624
+ nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
625
+ }
626
+
627
+ declare class ChatAdapter implements IChatAdapter {
628
+ nextItem(req: IChatAdapterNextItemReq & {
629
+ provider?: string;
630
+ }): Promise<IChatAdapterNextItemRes>;
631
+ }
632
+
633
+ type IChatItemData = IEntityData & IChatItem;
634
+ declare class ChatItem extends Entity<IChatItemData> {
635
+ get type(): "botMessage" | "humanMessage" | "functionCall";
636
+ get botMessage(): IChatMessage;
637
+ get functionCall(): IFunctionCall;
638
+ setFunctionResult(result: string): void;
639
+ getData(): IChatItemData;
342
640
  }
343
641
 
344
- interface IChatBotAdapter {
345
- generateNextChatItem(chatItems: ChatItem[]): Promise<ChatItem>;
642
+ interface IChatMemory {
643
+ findLastItems(count: number): Promise<ChatItem[]>;
644
+ create(item: ChatItem): Promise<void>;
346
645
  }
347
- declare class ChatBotAdapter implements IChatBotAdapter {
348
- protected mindset: MindsetOperator;
349
- constructor(mindset: MindsetOperator);
350
- generateNextChatItem(chatItems: ChatItem[]): Promise<ChatItem>;
351
- protected systemPrompt(): Promise<string>;
352
- protected buildBotMessageItem(text: string): Promise<ChatItem>;
353
- protected buildFunctionCallItem(id: string, functionName: string, functionArguments: string): Promise<ChatItem>;
646
+
647
+ declare class ChatMemory implements IChatMemory {
648
+ findLastItems(count: number): Promise<ChatItem[]>;
649
+ create(item: ChatItem): Promise<void>;
354
650
  }
355
651
 
356
652
  interface IChatBot {
@@ -360,51 +656,36 @@ interface IChatBot {
360
656
  declare class ChatBot implements IChatBot {
361
657
  private memory;
362
658
  private adapter;
363
- constructor(memory: ChatMemory, adapter: ChatBotAdapter);
364
- sendMessage(message: IConnectionChatMessage, callback: (message: IChatMessage) => void): Promise<void>;
659
+ private mindset;
660
+ constructor(memory: ChatMemory, adapter: ChatAdapter, mindset: MindsetOperator);
661
+ sendMessage(message: IChatMessage, callback: (message: IChatMessage) => void): Promise<void>;
365
662
  protected processLoop(callback: (message: IChatMessage) => void): Promise<void>;
366
663
  }
367
664
 
368
- declare class DeepSeekChatBotAdapter extends ChatBotAdapter {
369
- private deepSeek;
370
- private model;
371
- constructor(mindset: MindsetOperator);
372
- validateEnvVariables(envVariables: (string | undefined)[]): void;
373
- generateNextChatItem(chatItems: ChatItem[]): Promise<ChatItem>;
374
- private mapChatItems;
665
+ interface IChatRepository {
666
+ create(chat: Chat): Promise<void>;
667
+ findByConnection(query: IChatConnection): Promise<Chat | null>;
668
+ findMemory(chatId: string): Promise<IChatMemory | null>;
375
669
  }
376
670
 
377
- declare class OpenaiChatBotAdapter extends ChatBotAdapter {
378
- private openai;
379
- private model;
380
- private logger;
381
- constructor(mindset: MindsetOperator);
382
- generateNextChatItem(chatItems: ChatItem[]): Promise<ChatItem>;
383
- private mapChatItems;
671
+ declare class ChatRepository implements IChatRepository {
672
+ create(chat: Chat): Promise<void>;
673
+ findByConnection(query: IChatConnection): Promise<Chat | null>;
674
+ findMemory(chatId: string): Promise<IChatMemory | null>;
384
675
  }
385
676
 
386
- declare function cmd(): (target: object, propertyKey: string | symbol) => void;
387
-
388
- declare class ChatResolver {
389
- private chatRepository;
390
- constructor(chatRepository: ChatRepository);
391
- resolve(connection: IChatConnection): Promise<Chat>;
392
- private resolveGroupChat;
393
- private resolvePrivateChat;
394
- }
677
+ declare function chatBot(mindset: IConstructor<IMindset>): (target: object, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
395
678
 
396
- interface IReceivedMessage extends IMessageContext {
397
- reply: (message: IChatMessage) => void;
398
- }
399
- interface IChatChannel {
400
- listen(callback: (message: IReceivedMessage) => void): void;
401
- connect(): void;
679
+ interface IChatBotMetadata {
680
+ constructor: IConstructor<any>;
681
+ mindsetConstructor: IConstructor<IMindset>;
682
+ injectionToken: string;
402
683
  }
403
684
 
404
- declare class UserResolver {
405
- private userRepository;
406
- constructor(userRepository: UserRepository);
407
- resolve(connection: IUserConnection): Promise<User | null>;
685
+ declare class ChatBotMetadataStore {
686
+ private chatBots;
687
+ saveChatBotMetadata(chatBot: IChatBotMetadata): void;
688
+ getChatBotsMetadata(): IChatBotMetadata[];
408
689
  }
409
690
 
410
691
  interface IchatControllerConfig {
@@ -416,6 +697,22 @@ interface IChatControllerMetadata {
416
697
  controllerConstructor: Function;
417
698
  }
418
699
 
700
+ interface IReceivedMessage {
701
+ message: IChatMessage;
702
+ reply: (message: IChatMessage) => void;
703
+ }
704
+
705
+ interface IChannelMessage extends IReceivedMessage {
706
+ chatConnection: IChatConnection;
707
+ authInfo?: IStorableData;
708
+ setAuthInfo?: (authInfo: IStorableData | undefined) => void;
709
+ }
710
+
711
+ interface IChatChannel {
712
+ listen(callback: (received: IChannelMessage) => void): void;
713
+ connect(): void;
714
+ }
715
+
419
716
  interface IChannelMetadata {
420
717
  controllerConstructor: IConstructor<any>;
421
718
  functionName: string;
@@ -434,16 +731,21 @@ declare class ControllerMetadataStore {
434
731
  } | null;
435
732
  }
436
733
 
437
- declare class CmdChannel implements IChatChannel {
438
- private chatResolver;
439
- private userResolver;
440
- private rl;
441
- private callBack;
442
- constructor(chatResolver: ChatResolver, userResolver: UserResolver);
443
- listen(callback: (message: IReceivedMessage) => void): void;
444
- connect(): void;
734
+ declare class ChatResolver {
735
+ private chatRepository;
736
+ constructor(chatRepository: ChatRepository);
737
+ resolve(connection: IChatConnection): Promise<Chat>;
738
+ private resolveGroupChat;
739
+ private resolvePrivateChat;
445
740
  }
446
741
 
742
+ interface IMessageContext extends IReceivedMessage {
743
+ chat: Chat;
744
+ authInfo?: IStorableData;
745
+ }
746
+
747
+ declare function runChatControllers(controllers: IConstructor<any>[]): void;
748
+
447
749
  declare class HttpServerProvider {
448
750
  server: Server | null;
449
751
  private listening;
@@ -462,16 +764,152 @@ declare class ExpressProvider {
462
764
  private createExpress;
463
765
  }
464
766
 
465
- interface ISocketChannelConfig {
466
- channel: string;
767
+ interface IMoneyData extends IStorableData {
768
+ amount: string;
769
+ currency: string;
770
+ }
771
+ declare class Money extends Storable<IMoneyData> {
772
+ getData(): {
773
+ [key: string]: IPrimitive | IStorableData | IPrimitive[] | IStorableData[];
774
+ amount: string;
775
+ currency: string;
776
+ };
777
+ get amount(): big_js.Big;
778
+ get currency(): string;
779
+ plus(money: Money): Money;
780
+ minus(money: Money): Money;
781
+ times(value: bigint | string): Money;
782
+ div(value: bigint | string): Money;
783
+ negative(): Money;
784
+ isGretterThan(money: Money): boolean;
785
+ protected validateEqualCurrencies(left: string, right: string): void;
786
+ static zero(currency: string): Money;
467
787
  }
468
788
 
469
- declare class SocketChannelConfig implements ISocketChannelConfig {
470
- channel: string;
471
- constructor(channel: string);
789
+ declare class MoneyDto {
790
+ amount: string;
791
+ currency: string;
472
792
  }
473
793
 
474
- declare function socket(config: SocketChannelConfig): (target: object, propertyKey: string | symbol) => void;
794
+ type IPgRepositoryConfig<P extends Entity<IEntityData>> = {
795
+ schema?: string;
796
+ table: string;
797
+ constructor: IConstructor<P>;
798
+ add?: {
799
+ columns: {
800
+ [column: string]: {
801
+ type: string;
802
+ value: (item: P) => boolean | number | string | null | Date;
803
+ };
804
+ };
805
+ };
806
+ };
807
+
808
+ declare class PgRepositoryBase<P extends Entity<IEntityData>> {
809
+ protected pool: Pool;
810
+ protected config: IPgRepositoryConfig<any>;
811
+ private tableIsCreated;
812
+ protected schema: string;
813
+ protected table: string;
814
+ protected columnsList: string[];
815
+ protected columnsAndTypes: string;
816
+ protected columns: string;
817
+ protected vars: string;
818
+ protected updates: string;
819
+ addColumns: {
820
+ [columns: string]: {
821
+ type: string;
822
+ value: (item: P) => number | boolean | string | null | Date;
823
+ };
824
+ };
825
+ constructor(pool: Pool, config: IPgRepositoryConfig<any>);
826
+ protected values(item: P): (string | number | boolean | Date | null)[];
827
+ protected exec(sql: string, values: any[]): Promise<void>;
828
+ protected query(sql: string, values: any[]): Promise<P[]>;
829
+ protected connect(): Promise<Pool>;
830
+ protected ensureTable(): Promise<void>;
831
+ protected ensureColumns(): Promise<void>;
832
+ }
833
+
834
+ declare class PgCrudRepository<P extends Entity<IEntityData>> extends PgRepositoryBase<P> implements ICrudRepository<P> {
835
+ protected readonly config: IPgRepositoryConfig<P>;
836
+ constructor(pool: Pool, config: IPgRepositoryConfig<P>);
837
+ find(id: string): Promise<P | null>;
838
+ findByIds(ids: string[]): Promise<P[]>;
839
+ findOrThrow(id: string): Promise<P>;
840
+ findAll(): Promise<P[]>;
841
+ create(item: P): Promise<void>;
842
+ update(item: P): Promise<void>;
843
+ delete(item: P): Promise<void>;
844
+ }
845
+
846
+ interface IEndPointConfig {
847
+ path?: string;
848
+ disableJsonParser?: boolean;
849
+ disableUrlEncodedParser?: boolean;
850
+ }
851
+
852
+ declare function onGet(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
853
+
854
+ interface IMiddleware {
855
+ handle(req: Request, res: Response, container: DependencyContainer$1): Promise<void>;
856
+ }
857
+
858
+ declare function middleware(middlewareConstructor: IConstructor<IMiddleware>): (target: object, propertyKey: string | symbol) => void;
859
+
860
+ declare function onPost(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
861
+
862
+ declare function onPut(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
863
+
864
+ declare function onDelete(config?: string | IEndPointConfig): (target: object, propertyKey: string | symbol) => void;
865
+
866
+ interface IRestControllerConfig {
867
+ path: string;
868
+ }
869
+
870
+ declare function restController(config: string | IRestControllerConfig): (target: IConstructor<any>) => void;
871
+
872
+ interface IEndPointMetadata {
873
+ method: 'get' | 'post' | 'put' | 'delete';
874
+ config?: IEndPointConfig;
875
+ controllerConstructor: IConstructor<any>;
876
+ functionName: string;
877
+ paramsTypes: any[];
878
+ }
879
+
880
+ interface IMiddlewareMetadata {
881
+ controllerConstructor: IConstructor<any>;
882
+ functionName: string;
883
+ middlewareConstructor: IConstructor<IMiddleware>;
884
+ }
885
+
886
+ interface IRestControllerMetadata {
887
+ controllerConstructor: IConstructor<any>;
888
+ path: string;
889
+ }
890
+
891
+ declare class RestControllerMetadataStore {
892
+ private endPoints;
893
+ private middlewares;
894
+ private restControllers;
895
+ saveControllerMetadata(controllerMetadata: IRestControllerMetadata): void;
896
+ saveEndPointMetadata(endPointMetadata: IEndPointMetadata): void;
897
+ saveMiddlewareMetadata(middlewareMetadata: IMiddlewareMetadata): void;
898
+ getControllerEndPointsInfo(controllerConstructor: IConstructor<any>): {
899
+ middlewares: IMiddlewareMetadata[];
900
+ controller: IRestControllerMetadata;
901
+ method: "get" | "post" | "put" | "delete";
902
+ config?: IEndPointConfig;
903
+ controllerConstructor: IConstructor<any>;
904
+ functionName: string;
905
+ paramsTypes: any[];
906
+ }[];
907
+ }
908
+
909
+ declare function runRestControllers(controllers: IConstructor<any>[]): void;
910
+
911
+ declare const EXPRESS_REQ = "EXPRESS_REQ";
912
+ declare const EXPRESS_RES = "EXPRESS_RES";
475
913
 
476
914
  declare class SocketServerProvider {
477
915
  private httpServerProvider;
@@ -483,138 +921,427 @@ declare class SocketServerProvider {
483
921
  private createSocketServer;
484
922
  }
485
923
 
486
- interface ISocketChannelReceivedMessage {
487
- chatId: string;
488
- userId: string;
489
- senderName: string;
490
- text: string;
924
+ interface IConnectionMiddleware {
925
+ handle(socket: Socket, container: DependencyContainer$1): Promise<void>;
491
926
  }
492
- declare class SocketChannel implements IChatChannel {
493
- private config;
494
- private socketServerProvider;
495
- private chatResolver;
496
- private userResolver;
497
- private callBack;
498
- private server;
499
- constructor(config: SocketChannelConfig, socketServerProvider: SocketServerProvider, chatResolver: ChatResolver, userResolver: UserResolver);
500
- listen(callback: (message: IReceivedMessage) => void): void;
501
- connect(): void;
927
+
928
+ declare function connectionMiddleware(middlewareConstructor: IConstructor<IConnectionMiddleware>): (target: object, propertyKey: string | symbol) => void;
929
+
930
+ interface ISocketConnectionConfig {
931
+ namespace: string;
502
932
  }
503
933
 
504
- interface ITelegramChannelConfig {
505
- botToken: string;
934
+ declare function socketConnection(config?: string | ISocketConnectionConfig): (target: object, propertyKey: string | symbol) => void;
935
+
936
+ interface ISocketControllerConfig {
937
+ namespace: string;
506
938
  }
507
- declare class TelegramChannelConfig implements ITelegramChannelConfig {
508
- botToken: string;
509
- constructor(botToken: string);
939
+
940
+ declare function socketController(config?: string | ISocketControllerConfig): (target: IConstructor<any>) => void;
941
+
942
+ interface ISocketEventConfig {
943
+ namespace?: string;
944
+ event: string;
510
945
  }
511
946
 
512
- declare function telegram(config: ITelegramChannelConfig): (target: object, propertyKey: string | symbol) => void;
947
+ declare function socketEvent(config: string | ISocketEventConfig): (target: object, propertyKey: string | symbol) => void;
513
948
 
514
- declare class TelegramChannel implements IChatChannel {
515
- private config;
516
- private chatResolver;
517
- private userResolver;
518
- private bot;
519
- constructor(config: TelegramChannelConfig, chatResolver: ChatResolver, userResolver: UserResolver);
520
- listen(callback: (message: IReceivedMessage) => void): void;
521
- connect(): void;
949
+ interface IConnectionMiddlewareMetadata {
950
+ controllerConstructor: IConstructor<any>;
951
+ functionName: string;
952
+ middlewareConstructor: IConstructor<IConnectionMiddleware>;
522
953
  }
523
954
 
524
- interface IWhatsappChannelConfig {
525
- number: string;
526
- proxy?: string;
955
+ interface ISocketConnectionMetadata {
956
+ config?: ISocketConnectionConfig;
957
+ controllerConstructor: IConstructor<any>;
958
+ functionName: string;
959
+ paramsTypes: any[];
527
960
  }
528
- declare class WhatsappChannelConfig implements IWhatsappChannelConfig {
529
- number: string;
530
- constructor(number: string);
961
+
962
+ interface ISocketControllerMetadata {
963
+ controllerConstructor: IConstructor<any>;
964
+ config?: ISocketControllerConfig;
531
965
  }
532
966
 
533
- declare function whatsapp(config: IWhatsappChannelConfig): (target: object, propertyKey: string | symbol) => void;
967
+ interface ISocketEventMetadata {
968
+ config: ISocketEventConfig;
969
+ controllerConstructor: IConstructor<any>;
970
+ functionName: string;
971
+ paramsTypes: any[];
972
+ }
534
973
 
535
- type IWhatsAppTemplateParameter = {
536
- type: 'text';
537
- text: string;
538
- parameter_name?: string;
539
- } | {
540
- type: 'currency';
541
- currency: {
542
- fallback_value: string;
543
- code: string;
544
- amount_1000: number;
545
- };
546
- } | {
547
- type: 'date_time';
548
- date_time: {
549
- fallback_value: string;
550
- };
551
- };
552
- interface IWhatsAppTemplateMessage {
553
- templateName: string;
554
- languageCode: string;
555
- parameters: IWhatsAppTemplateParameter[];
974
+ declare class SocketControllerMetadataStore {
975
+ private socketControllers;
976
+ private socketConnections;
977
+ private socketEvents;
978
+ private connectionMiddlewares;
979
+ saveControllerMetadata(controllerMetadata: ISocketControllerMetadata): void;
980
+ saveSocketConnectionMetadata(socketConnectionMetadata: ISocketConnectionMetadata): void;
981
+ saveSocketEventMetadata(socketEventMetadata: ISocketEventMetadata): void;
982
+ saveConnectionMiddlewareMetadata(middlewareMetadata: IConnectionMiddlewareMetadata): void;
983
+ getControllerSockerConnectionsInfo(controllerConstructor: IConstructor<any>): {
984
+ events: ISocketEventMetadata[];
985
+ connectionMiddlewares: IConnectionMiddlewareMetadata[];
986
+ controller: ISocketControllerMetadata;
987
+ config?: ISocketConnectionConfig;
988
+ controllerConstructor: IConstructor<any>;
989
+ functionName: string;
990
+ paramsTypes: any[];
991
+ }[];
556
992
  }
557
993
 
558
- interface IWhatsAppWebhookPayload {
559
- object: 'whatsapp_business_account';
560
- entry: IEntry[];
561
- }
562
- interface IEntry {
563
- id: string;
564
- changes: IChange[];
994
+ declare function runSocketControllers(controllers: IConstructor<any>[]): void;
995
+
996
+ declare class PgJobRepository extends PgCrudRepository<Job> implements IJobRepository {
997
+ constructor(pool: Pool);
565
998
  }
566
- type IChange = IMessagesChange;
567
- interface IMessagesChange {
568
- value: IMessagesChangeValue;
569
- field: 'messages';
999
+
1000
+ declare function apiKeyConnectionGuard(): (target: object, propertyKey: string | symbol) => void;
1001
+
1002
+ declare function apiKeyGuard(): (target: object, propertyKey: string | symbol) => void;
1003
+
1004
+ interface IApiKeyData<A extends IStorableData> extends IEntityData {
1005
+ secretHash?: string;
1006
+ metadata?: Record<string, string>;
1007
+ authInfo: A;
1008
+ name: string;
570
1009
  }
571
- interface IMessagesChangeValue {
572
- messaging_product: 'whatsapp';
573
- metadata: IMessageMetadata;
574
- contacts?: IWhatsAppContact[];
575
- messages?: IWhatsAppMessage[];
1010
+ declare class ApiKey<A extends IStorableData> extends Entity<IApiKeyData<A>> {
1011
+ static PREFIX: string;
1012
+ static hashSecret(secret: string): string;
1013
+ get authInfo(): A;
1014
+ get metadata(): Record<string, string>;
1015
+ setAuthInfo(authInfo: A): void;
1016
+ generateSecret(): string;
1017
+ isValidSecret(secret: string): boolean;
1018
+ validateSecret(secret: string): void;
1019
+ }
1020
+
1021
+ interface IApiKeyRepository<A extends IStorableData> {
1022
+ find(id: string): Promise<ApiKey<A> | null>;
1023
+ findOrThrow(id: string): Promise<ApiKey<A>>;
1024
+ findByMetadata(metadata: Record<string, string>): Promise<ApiKey<A>[]>;
1025
+ create(item: ApiKey<A>): Promise<void>;
1026
+ generate(req: IGenerateApiKeyReq<A>): Promise<IGenerateApiKeyRes<A>>;
1027
+ findAuthInfoBySecret(secret: string): Promise<A | null>;
1028
+ }
1029
+ interface IGenerateApiKeyReq<A extends IStorableData> extends IStorableData {
1030
+ name: string;
1031
+ metadata?: Record<string, string>;
1032
+ authInfo: A;
576
1033
  }
577
- interface IMessageMetadata {
578
- display_phone_number: string;
579
- phone_number_id: string;
1034
+ interface IGenerateApiKeyRes<A extends IStorableData> {
1035
+ apiKey: ApiKey<A>;
1036
+ secret: string;
580
1037
  }
581
- interface IWhatsAppContact {
582
- profile: {
583
- name: string;
584
- };
585
- wa_id: string;
1038
+
1039
+ declare class ApiKeyRepository<A extends IStorableData> implements IApiKeyRepository<A> {
1040
+ findAuthInfoBySecret(secret: string): Promise<A>;
1041
+ findByMetadata(metadata: Record<string, string>): Promise<ApiKey<A>[]>;
1042
+ find(id: string): Promise<ApiKey<A> | null>;
1043
+ findOrThrow(id: string): Promise<ApiKey<A>>;
1044
+ create(item: ApiKey<A>): Promise<void>;
1045
+ generate(req: IGenerateApiKeyReq<A>): Promise<IGenerateApiKeyRes<A>>;
586
1046
  }
587
- type IWhatsAppMessage = ITextMessage | IAudioMessage;
588
- interface IBaseMessage {
589
- from: string;
590
- id: string;
591
- timestamp: string;
592
- type: string;
1047
+
1048
+ declare class ApiKeyConnectionGuardMiddleware implements IConnectionMiddleware {
1049
+ private apiKeyRepository;
1050
+ private auth;
1051
+ constructor(apiKeyRepository: ApiKeyRepository<any>, auth: Auth<any>);
1052
+ handle(socket: Socket, container: DependencyContainer$1): Promise<void>;
593
1053
  }
594
- interface ITextMessage extends IBaseMessage {
595
- type: 'text';
596
- text: {
597
- body: string;
598
- };
1054
+
1055
+ declare class ApiKeyGuardMiddleware implements IMiddleware {
1056
+ private apiKeyRepository;
1057
+ private auth;
1058
+ constructor(apiKeyRepository: ApiKeyRepository<any>, auth: Auth<any>);
1059
+ handle(req: Request, res: Response, container: DependencyContainer$1): Promise<void>;
599
1060
  }
600
- interface IAudioMessage extends IBaseMessage {
601
- type: 'audio';
602
- audio: {
603
- mime_type: string;
604
- sha256: string;
1061
+
1062
+ declare class PgApiKeyRepository<A extends IStorableData> extends PgCrudRepository<ApiKey<A>> implements IApiKeyRepository<A> {
1063
+ constructor(pool: Pool);
1064
+ findAuthInfoBySecret(secret: string): Promise<A | null>;
1065
+ findByMetadata(metadata: Record<string, string>): Promise<ApiKey<A>[]>;
1066
+ generate(req: IGenerateApiKeyReq<A>): Promise<IGenerateApiKeyRes<A>>;
1067
+ }
1068
+
1069
+ interface IRemoteApiKeyFetcher<A extends IStorableData> {
1070
+ fetchById: (id: string) => Promise<ApiKey<A> | null>;
1071
+ fetchBySecret: (secret: string) => Promise<ApiKey<A> | null>;
1072
+ }
1073
+ declare class RemoteApiKeyRepository<A extends IStorableData> implements IApiKeyRepository<A> {
1074
+ private fetcher;
1075
+ private cacheSeconds;
1076
+ private cacheById;
1077
+ private cacheBySecret;
1078
+ constructor(fetcher: IRemoteApiKeyFetcher<A>, cacheSeconds: number);
1079
+ find(id: string): Promise<ApiKey<A> | null>;
1080
+ findOrThrow(id: string): Promise<ApiKey<A>>;
1081
+ findAuthInfoBySecret(secret: string): Promise<A>;
1082
+ findByMetadata(metadata: Record<string, string>): Promise<ApiKey<A>[]>;
1083
+ create(item: ApiKey<A>): Promise<void>;
1084
+ generate(req: IGenerateApiKeyReq<A>): Promise<IGenerateApiKeyRes<A>>;
1085
+ }
1086
+
1087
+ declare function jwtConnectionGuard(): (target: object, propertyKey: string | symbol) => void;
1088
+
1089
+ declare function jwtGuard(): (target: object, propertyKey: string | symbol) => void;
1090
+
1091
+ interface IJwtRefreshTokenData<A extends IStorableData> extends IEntityData {
1092
+ authInfo: A;
1093
+ passwordHash?: string;
1094
+ expirationTime: number;
1095
+ }
1096
+ declare class JwtRefreshToken<A extends IStorableData> extends Entity<IJwtRefreshTokenData<A>> {
1097
+ get authInfo(): A;
1098
+ get expirationTime(): Date;
1099
+ generatePassword(): string;
1100
+ isValidPassword(password: string): boolean;
1101
+ validatePassword(password: string): void;
1102
+ static inflate(secret: string): {
605
1103
  id: string;
606
- voice: boolean;
1104
+ pass: string;
607
1105
  };
1106
+ static deflate(data: {
1107
+ id: string;
1108
+ pass: string;
1109
+ }): string;
1110
+ }
1111
+
1112
+ interface IJwtRefreshTokenRepository<D extends IStorableData> extends ICrudRepository<JwtRefreshToken<D>> {
1113
+ }
1114
+
1115
+ declare class JwtTokenDto {
1116
+ token?: string;
1117
+ expiration?: Date;
1118
+ }
1119
+
1120
+ declare class JwtAccessAndRefreshTokenDto {
1121
+ access?: JwtTokenDto;
1122
+ refresh?: JwtTokenDto;
1123
+ }
1124
+
1125
+ declare class JwtConfig {
1126
+ secretOrPublicKey: string;
1127
+ secretOrPrivateKey: string;
1128
+ algorithm: Algorithm;
1129
+ accessExpirationSeconds: number;
1130
+ refreshExpirationSeconds: number;
1131
+ constructor(env: Env);
1132
+ }
1133
+
1134
+ declare class JwtSigner {
1135
+ private config;
1136
+ private mapper;
1137
+ constructor(config: JwtConfig, mapper: Mapper);
1138
+ signAccessToken<D extends IStorableData>(info: D | JwtRefreshToken<any>): Promise<JwtTokenDto>;
1139
+ }
1140
+
1141
+ declare class JwtRefreshTokenRepository<D extends IStorableData> implements IJwtRefreshTokenRepository<D> {
1142
+ find(id: string): Promise<JwtRefreshToken<D> | null>;
1143
+ findOrThrow(id: string): Promise<JwtRefreshToken<D>>;
1144
+ findByIds(ids: string[]): Promise<JwtRefreshToken<D>[]>;
1145
+ findAll(id: string): Promise<JwtRefreshToken<D>[]>;
1146
+ create(item: JwtRefreshToken<D>): Promise<void>;
1147
+ update(item: JwtRefreshToken<D>): Promise<void>;
1148
+ delete(item: JwtRefreshToken<D>): Promise<void>;
1149
+ }
1150
+
1151
+ declare class Jwt {
1152
+ private auth;
1153
+ private jwtSigner;
1154
+ private jwtRefreshTokenRepository;
1155
+ private config;
1156
+ constructor(auth: Auth<any>, jwtSigner: JwtSigner, jwtRefreshTokenRepository: JwtRefreshTokenRepository<any>, config: JwtConfig);
1157
+ createToken(): Promise<JwtAccessAndRefreshTokenDto>;
1158
+ refreshToken(refreshSecret: string): Promise<JwtTokenDto>;
1159
+ }
1160
+
1161
+ declare class JwtConnectionGuardMiddleware implements IConnectionMiddleware {
1162
+ private config;
1163
+ private auth;
1164
+ constructor(config: JwtConfig, auth: Auth<any>);
1165
+ handle(socket: Socket, container: DependencyContainer$1): Promise<void>;
1166
+ }
1167
+
1168
+ declare class JwtGuardMiddleware implements IMiddleware {
1169
+ private config;
1170
+ private auth;
1171
+ constructor(config: JwtConfig, auth: Auth<any>);
1172
+ handle(req: Request, res: Response, container: DependencyContainer$1): Promise<void>;
1173
+ }
1174
+
1175
+ declare class PgJwtRefreshTokenRepository<D extends IStorableData> extends PgCrudRepository<JwtRefreshToken<D>> implements IJwtRefreshTokenRepository<D> {
1176
+ constructor(pool: Pool);
1177
+ }
1178
+
1179
+ declare class AnthropicChatAdapter implements IChatAdapter {
1180
+ private env;
1181
+ private anthropic;
1182
+ private logger;
1183
+ constructor(env: Env);
1184
+ nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
1185
+ private mapChatItems;
1186
+ private mapHumanMessage;
1187
+ private mapBotMessage;
1188
+ private mapFunctionCall;
1189
+ private mapTool;
1190
+ private mapResponse;
1191
+ }
1192
+
1193
+ declare class DeepSeekChatAdapter implements IChatAdapter {
1194
+ private deepSeek;
1195
+ private logger;
1196
+ constructor();
1197
+ nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
1198
+ private mapChatItems;
1199
+ private mapHumanMessage;
1200
+ private mapBotMessage;
1201
+ private mapFunctionCall;
1202
+ private mapTool;
1203
+ private mapResponse;
1204
+ }
1205
+
1206
+ declare class GoogleChatAdapter implements IChatAdapter {
1207
+ private env;
1208
+ private openai;
1209
+ private logger;
1210
+ constructor(env: Env);
1211
+ nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
1212
+ private mapChatItems;
1213
+ private mapHumanMessage;
1214
+ private mapBotMessage;
1215
+ private mapFunctionCall;
1216
+ private mapTool;
1217
+ private mapResponse;
1218
+ }
1219
+
1220
+ declare class OpenaiChatAdapter implements IChatAdapter {
1221
+ private openai;
1222
+ private logger;
1223
+ nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
1224
+ private mapChatItems;
1225
+ private mapConectionMessage;
1226
+ private mapBotMessage;
1227
+ private mapFunctionCall;
1228
+ private mapTool;
1229
+ private mapResponse;
1230
+ }
1231
+
1232
+ declare class PgChatRepository extends PgCrudRepository<Chat> implements IChatRepository {
1233
+ constructor(pool: Pool);
1234
+ findByConnection(query: IChatConnection): Promise<Chat | null>;
1235
+ findMemory(chatId: string): Promise<IChatMemory | null>;
1236
+ }
1237
+
1238
+ declare class PgChatMemory extends PgCrudRepository<ChatItem> implements IChatMemory {
1239
+ private chatId;
1240
+ constructor(pool: Pool, chatId: string);
1241
+ findLastItems(count: number): Promise<ChatItem[]>;
1242
+ }
1243
+
1244
+ declare class RamChatMemory implements IChatMemory {
1245
+ private memory;
1246
+ findLastItems(count: number): Promise<ChatItem[]>;
1247
+ create(item: ChatItem): Promise<void>;
1248
+ clearMemory(): Promise<void>;
1249
+ }
1250
+
1251
+ declare class RamChatRepository implements IChatRepository {
1252
+ private items;
1253
+ private memories;
1254
+ create(chat: Chat): Promise<void>;
1255
+ findByConnection(query: IChatConnection): Promise<Chat | null>;
1256
+ findMemory(chatId: string): Promise<IChatMemory | null>;
1257
+ private getMemory;
1258
+ }
1259
+
1260
+ declare class WabotChatAdapter implements IChatAdapter {
1261
+ private apiKey;
1262
+ private baseUrl;
1263
+ private logger;
1264
+ constructor(env: Env);
1265
+ nextItem(req: IChatAdapterNextItemReq): Promise<IChatAdapterNextItemRes>;
1266
+ }
1267
+
1268
+ declare function cmd(): (target: object, propertyKey: string | symbol) => void;
1269
+
1270
+ declare class CmdChannel implements IChatChannel {
1271
+ private authInfo;
1272
+ private chatId;
1273
+ private rl;
1274
+ private callBack;
1275
+ listen(callback: (message: IChannelMessage) => void): void;
1276
+ connect(): void;
1277
+ }
1278
+ declare function writeJsonToFile<T>(filename: string, data: T): void;
1279
+ declare function readJsonFromFile<T>(filename: string): T | null;
1280
+
1281
+ interface ISocketChannelConfig {
1282
+ channel: string;
1283
+ }
1284
+
1285
+ declare class SocketChannelConfig implements ISocketChannelConfig {
1286
+ channel: string;
1287
+ constructor(channel: string);
1288
+ }
1289
+
1290
+ declare function socket(config: SocketChannelConfig): (target: object, propertyKey: string | symbol) => void;
1291
+
1292
+ interface ISocketChannelReceivedMessage {
1293
+ chatId: string;
1294
+ userId: string;
1295
+ senderName: string;
1296
+ text: string;
1297
+ }
1298
+ declare class SocketChannel implements IChatChannel {
1299
+ private config;
1300
+ private socketServerProvider;
1301
+ private callBack;
1302
+ private server;
1303
+ constructor(config: SocketChannelConfig, socketServerProvider: SocketServerProvider);
1304
+ listen(callback: (message: IChannelMessage) => void): void;
1305
+ connect(): void;
608
1306
  }
609
1307
 
610
- interface IWhatsAppBusinessNumber {
1308
+ interface ITelegramChannelConfig {
1309
+ botToken: string;
1310
+ }
1311
+ declare class TelegramChannelConfig implements ITelegramChannelConfig {
1312
+ botToken: string;
1313
+ constructor(botToken: string);
1314
+ }
1315
+
1316
+ declare function telegram(config: ITelegramChannelConfig): (target: object, propertyKey: string | symbol) => void;
1317
+
1318
+ declare class TelegramChannel implements IChatChannel {
1319
+ private config;
1320
+ private bot;
1321
+ constructor(config: TelegramChannelConfig);
1322
+ listen(callback: (message: IChannelMessage) => void): void;
1323
+ connect(): void;
1324
+ }
1325
+
1326
+ interface IWhatsappChannelConfig {
1327
+ number: string;
1328
+ proxy?: string;
1329
+ }
1330
+ declare class WhatsappChannelConfig implements IWhatsappChannelConfig {
1331
+ number: string;
1332
+ constructor(number: string);
1333
+ }
1334
+
1335
+ declare function whatsApp(config: string | IWhatsappChannelConfig): (target: object, propertyKey: string | symbol) => void;
1336
+
1337
+ interface IWhatsAppBusinessNumber extends IStorableData {
611
1338
  id: string;
612
1339
  number: string;
613
1340
  }
614
- interface IWhatsAppBusinessAccount {
1341
+ interface IWhatsAppBusinessAccount extends IStorableData {
615
1342
  id: string;
616
1343
  }
617
- interface IWhatsAppData extends IPersistentData {
1344
+ interface IWhatsAppData extends IEntityData {
618
1345
  slug: string;
619
1346
  verifyToken: string;
620
1347
  appSecret: string;
@@ -622,7 +1349,7 @@ interface IWhatsAppData extends IPersistentData {
622
1349
  businessAccount: IWhatsAppBusinessAccount;
623
1350
  businessNumbers: IWhatsAppBusinessNumber[];
624
1351
  }
625
- declare class WhatsApp extends Persistent<IWhatsAppData> {
1352
+ declare class WhatsApp extends Entity<IWhatsAppData> {
626
1353
  getVerifyToken(): string;
627
1354
  getSlug(): string;
628
1355
  getBusinessAccount(): IWhatsAppBusinessAccount;
@@ -633,57 +1360,88 @@ declare class WhatsApp extends Persistent<IWhatsAppData> {
633
1360
  getBussinessNumber(number: string): IWhatsAppBusinessNumber | null;
634
1361
  }
635
1362
 
636
- declare class Logger {
637
- private debuggers;
638
- constructor(name: string);
639
- trace(...args: any[]): void;
640
- debug(...args: any[]): void;
641
- info(...args: any[]): void;
642
- warn(...args: any[]): void;
643
- error(...args: any[]): void;
644
- fatal(...args: any[]): void;
645
- private log;
1363
+ interface IWhatsAppRepository {
1364
+ findBySlug(slug: string): Promise<WhatsApp | null>;
1365
+ findByBusinessNumber(number: string): Promise<WhatsApp | null>;
1366
+ }
1367
+
1368
+ declare class EnvWhatsAppRepository implements IWhatsAppRepository {
1369
+ private env;
1370
+ constructor(env: Env);
1371
+ findBySlug(slug: string): Promise<WhatsApp | null>;
1372
+ findByBusinessNumber(number: string): Promise<WhatsApp | null>;
1373
+ private getFromEnvVars;
1374
+ }
1375
+
1376
+ declare class PgWhatsAppRepository extends PgCrudRepository<WhatsApp> implements IWhatsAppRepository {
1377
+ constructor(pool: Pool);
1378
+ findBySlug(slug: string): Promise<WhatsApp | null>;
1379
+ findByBusinessNumber(number: string): Promise<WhatsApp | null>;
646
1380
  }
647
1381
 
648
- type IWhatsAppMessageListener = (message: IConnectionChatMessage) => Promise<void>;
1382
+ type IWhatsAppMessageListener = (message: Omit<IChannelMessage, 'reply'>) => Promise<void>;
649
1383
  interface IListenWhatsAppMessageRequest {
650
1384
  to: string;
651
1385
  listener: IWhatsAppMessageListener;
652
1386
  }
653
- declare abstract class WhatsAppReceiver {
654
- protected logger: Logger;
655
- private listeners;
656
- constructor(logger: Logger);
657
- abstract connect(): Promise<void>;
1387
+ declare class WhatsAppReceiver {
1388
+ connect(): Promise<void>;
658
1389
  listenMessage(request: IListenWhatsAppMessageRequest): void;
659
- protected handlePayload(payload: IWhatsAppWebhookPayload): Promise<void>;
660
- private emmitMessage;
661
1390
  }
662
1391
 
663
- interface IWhatsAppRepository {
664
- findBySlug(slug: string): Promise<WhatsApp | null>;
665
- findByBusinessNumber(number: string): Promise<WhatsApp | null>;
1392
+ type IWhatsAppCloudTemplateParameter = {
1393
+ type: 'text';
1394
+ text: string;
1395
+ parameter_name?: string;
1396
+ } | {
1397
+ type: 'currency';
1398
+ currency: {
1399
+ fallback_value: string;
1400
+ code: string;
1401
+ amount_1000: number;
1402
+ };
1403
+ } | {
1404
+ type: 'date_time';
1405
+ date_time: {
1406
+ fallback_value: string;
1407
+ };
1408
+ };
1409
+ interface IWhatsAppCloudTemplateMessage {
1410
+ templateName: string;
1411
+ languageCode: string;
1412
+ parameters: IWhatsAppCloudTemplateParameter[];
666
1413
  }
667
1414
 
668
- declare class WhatsAppRepository implements IWhatsAppRepository {
669
- findBySlug(slug: string): Promise<WhatsApp | null>;
670
- findByBusinessNumber(number: string): Promise<WhatsApp | null>;
1415
+ interface IWhatsAppCloudTemplateResponse {
1416
+ data: IWhatsAppCloudTemplate[];
1417
+ paging: IWhatsAppCloudApiPaging;
671
1418
  }
672
-
673
- interface IWhatsAppTemplate {
1419
+ interface IWhatsAppCloudTemplate {
674
1420
  name: string;
675
1421
  parameter_format: 'POSITIONAL' | 'OTHER';
676
- components: IWhatsAppTemplateComponent[];
1422
+ components: IWhatsAppCloudTemplateComponent[];
677
1423
  language: string;
678
1424
  status: string;
679
1425
  category: string;
680
1426
  id: string;
681
1427
  }
682
- interface IWhatsAppTemplateComponent {
1428
+ interface IWhatsAppCloudTemplateComponent {
683
1429
  type: 'HEADER' | 'BODY' | 'FOOTER';
684
1430
  format?: 'TEXT';
685
1431
  text?: string;
686
1432
  }
1433
+ interface IWhatsAppCloudApiPaging {
1434
+ cursors: IWhatsAppCloudApiCursors;
1435
+ }
1436
+ interface IWhatsAppCloudApiCursors {
1437
+ before: string;
1438
+ after: string;
1439
+ }
1440
+
1441
+ declare class WhatsAppRepository implements IWhatsAppRepository {
1442
+ findBySlug(slug: string): Promise<WhatsApp | null>;
1443
+ findByBusinessNumber(number: string): Promise<WhatsApp | null>;
1444
+ }
687
1445
 
688
1446
  interface ISendWhatsAppRequest {
689
1447
  from: string;
@@ -693,7 +1451,7 @@ interface ISendWhatsAppRequest {
693
1451
  interface ISendWhatsAppTemplateRequest {
694
1452
  from: string;
695
1453
  to: string;
696
- templateMessage: IWhatsAppTemplateMessage;
1454
+ templateMessage: IWhatsAppCloudTemplateMessage;
697
1455
  senderName: string;
698
1456
  }
699
1457
  interface IGetWhatsAppTemplateRequest {
@@ -704,232 +1462,156 @@ interface IGetWhatsAppTemplateRequest {
704
1462
  interface IWhatsAppSenderOptions {
705
1463
  writeChatMemory?: boolean;
706
1464
  }
707
- declare abstract class WhatsAppSender {
708
- protected logger: Logger;
1465
+ declare class WhatsAppSender {
709
1466
  protected chatRepository: ChatRepository;
710
1467
  protected chatResolver: ChatResolver;
711
1468
  protected whatsAppRepository: WhatsAppRepository;
712
- constructor(logger: Logger, chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
713
- protected abstract handleSendRequest(request: ISendWhatsAppRequest): Promise<void>;
714
- protected abstract handleSendTemplateRequest(request: ISendWhatsAppTemplateRequest): Promise<void>;
715
- protected abstract handleGetWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppTemplate | null>;
1469
+ constructor(chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
716
1470
  sendWhatsApp(request: ISendWhatsAppRequest, options?: IWhatsAppSenderOptions): Promise<void>;
717
1471
  sendWhatsAppTemplate(request: ISendWhatsAppTemplateRequest, options?: IWhatsAppSenderOptions): Promise<void>;
718
- getWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppTemplate | null>;
719
- protected resolveTemplateToChatMessage(request: ISendWhatsAppTemplateRequest): Promise<IChatMessage>;
1472
+ protected getWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppCloudTemplate | null>;
1473
+ protected mapTemplateToChatMessage(request: ISendWhatsAppTemplateRequest): Promise<IChatMessage>;
720
1474
  protected writePrivateChatMemory(message: IChatMessage, to: string): Promise<void>;
721
- private replaceTemplateParameters;
1475
+ protected replaceTemplateParameters(template: string, data: IWhatsAppCloudTemplateParameter[]): string;
722
1476
  }
723
1477
 
724
1478
  declare class WhatsAppChannel implements IChatChannel {
725
1479
  private config;
726
- private chatResolver;
727
- private userResolver;
728
1480
  private sender;
729
1481
  private receiver;
730
1482
  private logger;
731
- constructor(config: WhatsappChannelConfig, chatResolver: ChatResolver, userResolver: UserResolver, sender: WhatsAppSender, receiver: WhatsAppReceiver);
732
- listen(callback: (message: IReceivedMessage) => void): void;
1483
+ constructor(config: WhatsappChannelConfig, sender: WhatsAppSender, receiver: WhatsAppReceiver);
1484
+ listen(callback: (message: IChannelMessage) => void): void;
733
1485
  connect(): void;
734
1486
  }
735
1487
 
736
- declare class WabotDevConnection {
737
- private devProxy;
738
- private devProxySocket;
739
- private devToken;
740
- private logger;
741
- static isTokenAvailable(): boolean;
742
- constructor();
743
- getSocket(): Promise<Socket>;
1488
+ interface IWhatsAppCloudWebhookPayload {
1489
+ object: 'whatsapp_business_account';
1490
+ entry: IWhatsAppCloudEntry[];
744
1491
  }
745
-
746
- declare class WhatsAppReceiverByDevConnection extends WhatsAppReceiver {
747
- private wabotDevConnection;
748
- constructor(wabotDevConnection: WabotDevConnection);
749
- connect(): Promise<void>;
1492
+ interface IWhatsAppCloudEntry {
1493
+ id: string;
1494
+ changes: IWhatsAppCloudChange[];
750
1495
  }
751
-
752
- declare class WhatsAppReceiverByWebHook extends WhatsAppReceiver {
753
- private expressProvider;
754
- private whatsAppRepository;
755
- private expressApp;
756
- private webhookPath;
757
- constructor(expressProvider: ExpressProvider, whatsAppRepository: WhatsAppRepository);
758
- connect(): Promise<void>;
759
- }
760
-
761
- declare class WhatsAppSenderByDevConnection extends WhatsAppSender {
762
- private wabotDevConnection;
763
- constructor(wabotDevConnection: WabotDevConnection, chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
764
- handleSendRequest(request: ISendWhatsAppRequest): Promise<void>;
765
- handleSendTemplateRequest(request: ISendWhatsAppTemplateRequest): Promise<void>;
766
- handleGetWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppTemplate | null>;
1496
+ type IWhatsAppCloudChange = IWhatsAppCloudMessagesChange;
1497
+ interface IWhatsAppCloudMessagesChange {
1498
+ value: IWhatsAppCloudMessagesChangeValue;
1499
+ field: 'messages';
767
1500
  }
768
-
769
- declare class WhatsAppSenderByCloudApi extends WhatsAppSender {
770
- constructor(chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
771
- handleSendRequest(request: ISendWhatsAppRequest): Promise<void>;
772
- handleSendTemplateRequest(request: ISendWhatsAppTemplateRequest): Promise<void>;
773
- handleGetWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppTemplate | null>;
1501
+ interface IWhatsAppCloudMessagesChangeValue {
1502
+ messaging_product: 'whatsapp';
1503
+ metadata: IWhatsAppCloudMessageMetadata;
1504
+ contacts?: IWhatsAppCloudContact[];
1505
+ messages?: IWhatsAppCloudMessage[];
774
1506
  }
775
-
776
- interface ICrudRepository<T> {
777
- find(id: string): Promise<T | null>;
778
- findOrThrow(id: string): Promise<T>;
779
- findAll(id: string): Promise<T[]>;
780
- create(item: T): Promise<void>;
781
- update(item: T): Promise<void>;
782
- discard(item: T): Promise<void>;
1507
+ interface IWhatsAppCloudMessageMetadata {
1508
+ display_phone_number: string;
1509
+ phone_number_id: string;
783
1510
  }
784
-
785
- type IPgRepositoryConfig<P extends Persistent> = {
786
- schema?: string;
787
- table: string;
788
- constructor: IConstructor<P>;
789
- add?: {
790
- columns: {
791
- [column: string]: {
792
- type: string;
793
- value: (item: P) => boolean | number | string | null | Date;
794
- };
795
- };
796
- };
797
- };
798
-
799
- declare class PgRepositoryBase<P extends Persistent> {
800
- protected pool: Pool;
801
- protected config: IPgRepositoryConfig<any>;
802
- private tableIsCreated;
803
- schema: string;
804
- table: string;
805
- columnsList: string[];
806
- columnsAndTypes: string;
807
- columns: string;
808
- vars: string;
809
- updates: string;
810
- addColumns: {
811
- [columns: string]: {
812
- type: string;
813
- value: (item: P) => number | boolean | string | null | Date;
814
- };
1511
+ interface IWhatsAppCloudContact {
1512
+ profile: {
1513
+ name: string;
815
1514
  };
816
- constructor(pool: Pool, config: IPgRepositoryConfig<any>);
817
- values(item: P): (string | number | boolean | Date | null)[];
818
- protected exec(sql: string, values: any[]): Promise<void>;
819
- protected query(sql: string, values: any[]): Promise<any[]>;
820
- protected connect(): Promise<Pool>;
821
- protected ensureTable(): Promise<void>;
822
- protected ensureColumns(): Promise<void>;
823
- }
824
-
825
- declare class PgCrudRepository<P extends Persistent> extends PgRepositoryBase<P> implements ICrudRepository<P> {
826
- protected readonly config: IPgRepositoryConfig<P>;
827
- constructor(pool: Pool, config: IPgRepositoryConfig<P>);
828
- find(id: string): Promise<P | null>;
829
- findOrThrow(id: string): Promise<P>;
830
- findAll(): Promise<P[]>;
831
- create(item: P): Promise<void>;
832
- update(item: P): Promise<void>;
833
- discard(item: P): Promise<void>;
834
- }
835
-
836
- declare class PgWhatsAppRepository extends PgCrudRepository<WhatsApp> implements IWhatsAppRepository {
837
- constructor(pool: Pool);
838
- findBySlug(slug: string): Promise<WhatsApp | null>;
839
- findByBusinessNumber(number: string): Promise<WhatsApp | null>;
1515
+ wa_id: string;
840
1516
  }
841
-
842
- type IWabotEnvType = 'development' | 'staging' | 'testing' | 'production';
843
- declare class WabotEnv {
844
- private envType;
845
- constructor();
846
- isDevelopment(): boolean;
847
- isProduction(): boolean;
848
- requireString(varName: string): string;
1517
+ type IWhatsAppCloudMessage = IWhatsAppCloudTextMessage | IWhatsAppCloudAudioMessage;
1518
+ interface IWhatsAppCloudBaseMessage {
1519
+ from: string;
1520
+ id: string;
1521
+ timestamp: string;
1522
+ type: string;
849
1523
  }
850
-
851
- declare class EnvWhatsAppRepository implements IWhatsAppRepository {
852
- private env;
853
- constructor(env: WabotEnv);
854
- findBySlug(slug: string): Promise<WhatsApp | null>;
855
- findByBusinessNumber(number: string): Promise<WhatsApp | null>;
856
- private getFromEnvVars;
1524
+ interface IWhatsAppCloudTextMessage extends IWhatsAppCloudBaseMessage {
1525
+ type: 'text';
1526
+ text: {
1527
+ body: string;
1528
+ };
857
1529
  }
858
-
859
- declare function prepareChatContainer(container: DependencyContainer$1, context: IMessageContext, mindsetCtor?: IConstructor<IMindset>): Promise<DependencyContainer$1>;
860
-
861
- interface IrunChannelProps {
862
- channel: IConstructor<IChatChannel>;
863
- channelConfig?: object;
864
- mindset: IConstructor<IMindset>;
865
- chatRepository: IConstructor<IChatRepository>;
866
- chatBotAdapter: IConstructor<IChatBotAdapter>;
1530
+ interface IWhatsAppCloudAudioMessage extends IWhatsAppCloudBaseMessage {
1531
+ type: 'audio';
1532
+ audio: {
1533
+ mime_type: string;
1534
+ sha256: string;
1535
+ id: string;
1536
+ voice: boolean;
1537
+ };
867
1538
  }
868
- declare function runChannel(props: IrunChannelProps): void;
869
1539
 
870
- interface IServerProvider<T, ST extends T> {
871
- replace: IConstructor<T>;
872
- with: IConstructor<ST>;
873
- singleton?: true;
874
- }
875
- interface IServerConfig {
876
- controllers: IConstructor<any>[];
877
- providers?: IServerProvider<unknown, unknown>[];
1540
+ declare class WhatsAppReceiverByCloudApi extends WhatsAppReceiver {
1541
+ private expressProvider;
1542
+ private whatsAppRepository;
1543
+ private listeners;
1544
+ private expressApp;
1545
+ private logger;
1546
+ private webhookPath;
1547
+ constructor(expressProvider: ExpressProvider, whatsAppRepository: WhatsAppRepository);
1548
+ connect(): Promise<void>;
1549
+ listenMessage(request: IListenWhatsAppMessageRequest): void;
1550
+ protected handlePayload(payload: IWhatsAppCloudWebhookPayload): Promise<void>;
1551
+ private emmitMessage;
878
1552
  }
879
- declare function runServer(config: IServerConfig): void;
880
1553
 
881
- declare class SendOneTimePasswordRequest {
882
- fromEmail: string;
883
- toEmail: string;
1554
+ declare class WhatsAppSenderByCloudApi extends WhatsAppSender {
1555
+ private logger;
1556
+ constructor(chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
1557
+ sendWhatsApp(request: ISendWhatsAppRequest, options?: IWhatsAppSenderOptions): Promise<void>;
1558
+ sendWhatsAppTemplate(request: ISendWhatsAppTemplateRequest, options?: IWhatsAppSenderOptions): Promise<void>;
1559
+ protected getWhatsAppTemplate(request: IGetWhatsAppTemplateRequest): Promise<IWhatsAppCloudTemplate | null>;
884
1560
  }
885
1561
 
886
- declare class ValidateOneTimePasswordRequest {
887
- userEmail: string;
888
- otp: string;
1562
+ interface IWhatsAppProxyMessageContent {
1563
+ text: string;
889
1564
  }
890
1565
 
891
- interface ISendEmailRequest {
1566
+ interface IWhatsAppProxyMessage {
892
1567
  from: string;
893
1568
  to: string;
894
- subject: string;
895
- html: string;
1569
+ senderName?: string;
1570
+ content: IWhatsAppProxyMessageContent;
896
1571
  }
897
- interface IEmailService {
898
- sendEmail(request: ISendEmailRequest): Promise<void>;
1572
+
1573
+ declare const WHATSAPP_PROXY_SEND_MESSAGE_EVENT: "sendMessage";
1574
+ interface IWhatsAppProxySendMessageEventReq {
1575
+ event: typeof WHATSAPP_PROXY_SEND_MESSAGE_EVENT;
1576
+ data: IWhatsAppProxyMessage;
899
1577
  }
900
- declare class EmailService implements IEmailService {
901
- sendEmail(request: ISendEmailRequest): Promise<void>;
1578
+ declare const WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT: "listenMessage";
1579
+ interface IWhatsAppProxyListenMessageEventReq {
1580
+ event: typeof WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT;
1581
+ data: IWhatsAppProxyListenMessageEventData;
902
1582
  }
903
-
904
- interface IOtpService {
905
- generate(): Promise<string>;
1583
+ interface IWhatsAppProxyListenMessageEventData {
1584
+ from?: string[];
1585
+ to: string[];
906
1586
  }
907
- declare class OtpService implements IOtpService {
908
- generate(): Promise<string>;
1587
+ declare const WHATSAPP_MESSAGE_EVENT: "message";
1588
+ interface IWhatsAppProxyMessageEventReq {
1589
+ event: typeof WHATSAPP_MESSAGE_EVENT;
1590
+ data: IWhatsAppProxyMessage;
909
1591
  }
910
1592
 
911
- declare class AuthenticationModule {
912
- private userRepository;
913
- private emailService;
914
- private otpService;
915
- private context;
916
- constructor(userRepository: UserRepository, emailService: EmailService, otpService: OtpService, context: MessageContext);
917
- sendOneTimePassword(request: SendOneTimePasswordRequest): Promise<string>;
918
- validateOneTimePassword(request: ValidateOneTimePasswordRequest): Promise<string>;
919
- protected generateOtpEmailHtml(otp: string, user: User): Promise<string>;
920
- protected generateOtpEmailSubject(): Promise<string>;
1593
+ declare class WhatsAppWabotProxyConnection {
1594
+ private baseUrl;
1595
+ private socket;
1596
+ private apiKey;
1597
+ private logger;
1598
+ constructor(env: Env);
1599
+ getSocket(): Promise<Socket$1>;
921
1600
  }
922
1601
 
923
- declare class RegisterUserWithEmailRequest {
924
- email: string;
925
- shortName: string;
1602
+ declare class WhatsAppReceiverByWabotProxy extends WhatsAppReceiver {
1603
+ private connection;
1604
+ private loger;
1605
+ constructor(connection: WhatsAppWabotProxyConnection);
1606
+ connect(): Promise<void>;
1607
+ listenMessage(request: IListenWhatsAppMessageRequest): void;
926
1608
  }
927
1609
 
928
- declare class RegisterUserModule {
929
- private userRepository;
930
- private context;
931
- constructor(userRepository: UserRepository, context: MessageContext);
932
- registerUserWithEmail(request: RegisterUserWithEmailRequest): Promise<string>;
1610
+ declare class WhatsAppSenderByWabotProxy extends WhatsAppSender {
1611
+ private wabotDevConnection;
1612
+ private logger;
1613
+ constructor(wabotDevConnection: WhatsAppWabotProxyConnection, chatRepository: ChatRepository, chatResolver: ChatResolver, whatsAppRepository: WhatsAppRepository);
1614
+ sendWhatsApp(request: ISendWhatsAppRequest, options?: IWhatsAppSenderOptions): Promise<void>;
933
1615
  }
934
1616
 
935
1617
  interface IHtmlModuleOptions {
@@ -940,185 +1622,4 @@ declare function HtmlModule(options: IHtmlModuleOptions): {
940
1622
  new (): {};
941
1623
  };
942
1624
 
943
- declare class PgUserRepository extends PgCrudRepository<User> implements IUserRepository {
944
- constructor(pool: Pool);
945
- findByConnection(query: IUserConnection): Promise<User | null>;
946
- }
947
-
948
- declare class RamUserRepository implements IUserRepository {
949
- private items;
950
- create(chat: User): Promise<void>;
951
- findByConnection(query: IUserConnection): Promise<User | null>;
952
- update(chat: User): Promise<void>;
953
- }
954
-
955
- declare class PgChatRepository extends PgCrudRepository<Chat> implements IChatRepository {
956
- constructor(pool: Pool);
957
- findByConnection(query: IChatConnection): Promise<Chat | null>;
958
- findMemory(chatId: string): Promise<IChatMemory | null>;
959
- }
960
-
961
- declare class PgChatMemory extends PgCrudRepository<ChatItem> implements IChatMemory {
962
- private chatId;
963
- constructor(pool: Pool, chatId: string);
964
- findLastItems(count: number): Promise<ChatItem[]>;
965
- }
966
-
967
- declare class RamChatMemory implements IChatMemory {
968
- private memory;
969
- findLastItems(count: number): Promise<ChatItem[]>;
970
- create(item: ChatItem): Promise<void>;
971
- clearMemory(): Promise<void>;
972
- }
973
-
974
- declare class RamChatRepository implements IChatRepository {
975
- private items;
976
- private memories;
977
- create(chat: Chat): Promise<void>;
978
- findByConnection(query: IChatConnection): Promise<Chat | null>;
979
- findMemory(chatId: string): Promise<IChatMemory | null>;
980
- private getMemory;
981
- }
982
-
983
- interface IGetConfig {
984
- path?: string;
985
- }
986
-
987
- declare function get(config?: IGetConfig): (target: object, propertyKey: string | symbol) => void;
988
-
989
- interface IPostConfig {
990
- path?: string;
991
- }
992
-
993
- declare function post(config?: IPostConfig): (target: object, propertyKey: string | symbol) => void;
994
-
995
- interface IRestControllerConfig {
996
- path: string;
997
- }
998
-
999
- declare function restController(config: IRestControllerConfig): (target: IConstructor<any>) => void;
1000
-
1001
- interface IEndPointMetadata {
1002
- method: 'get' | 'post';
1003
- path?: string;
1004
- controllerConstructor: IConstructor<any>;
1005
- functionName: string;
1006
- paramsTypes: any[];
1007
- }
1008
-
1009
- interface IRestControllerMetadata {
1010
- controllerConstructor: IConstructor<any>;
1011
- path: string;
1012
- }
1013
-
1014
- declare class RestControllerMetadataStore {
1015
- private endPoints;
1016
- private restControllers;
1017
- saveControllerMetadata(controllerMetadata: IRestControllerMetadata): void;
1018
- saveEndPointMetadata(endPointMetadata: IEndPointMetadata): void;
1019
- getControllerEndPointsInfo(controllerConstructor: IConstructor<any>): {
1020
- controller: IRestControllerMetadata;
1021
- method: "get" | "post";
1022
- path?: string;
1023
- controllerConstructor: IConstructor<any>;
1024
- functionName: string;
1025
- paramsTypes: any[];
1026
- }[];
1027
- }
1028
-
1029
- declare function runRestControllers(controllers: IConstructor<any>[], container: DependencyContainer$1): void;
1030
-
1031
- declare function isBoolean(): (target: object, propertyKey: string | symbol) => void;
1032
-
1033
- declare function isDate(): (target: object, propertyKey: string | symbol) => void;
1034
-
1035
- declare function isNotEmpty(): (target: object, propertyKey: string | symbol) => void;
1036
-
1037
- declare function isNumber(): (target: object, propertyKey: string | symbol) => void;
1038
-
1039
- declare function isOptional(): (target: object, propertyKey: string | symbol) => void;
1040
-
1041
- declare function isPresent(): (target: object, propertyKey: string | symbol) => void;
1042
-
1043
- declare function isString(): (target: object, propertyKey: string | symbol) => void;
1044
-
1045
- declare function max(limit: any): (target: object, propertyKey: string | symbol) => void;
1046
-
1047
- declare function min(limit: any): (target: object, propertyKey: string | symbol) => void;
1048
-
1049
- declare function validable<A>(): (target: IConstructor<A>) => void;
1050
-
1051
- interface IValidationError {
1052
- description: string;
1053
- }
1054
- interface IModelValidationError {
1055
- model: IValidationError[];
1056
- properties: {
1057
- name: string;
1058
- errors: IValidationError[];
1059
- }[];
1060
- }
1061
- interface IValidationResult<V> {
1062
- value?: V;
1063
- error?: IValidationError;
1064
- }
1065
- interface IModelValidationResult<V> {
1066
- value?: V;
1067
- error?: IModelValidationError;
1068
- }
1069
- type IValidator = (value: any, options: any) => IValidationResult<any>;
1070
- interface IPropertyValidatorInfo {
1071
- propertyName: string;
1072
- validator: IValidator;
1073
- validatorOptions?: any;
1074
- }
1075
- type IModelValidatorsInfo<V> = {
1076
- modelConstructor: IConstructor<V>;
1077
- properties: {
1078
- [prop: string]: {
1079
- isOptional?: boolean;
1080
- validators?: IPropertyValidatorInfo[];
1081
- } | undefined;
1082
- };
1083
- };
1084
-
1085
- interface IValidatorMetadata {
1086
- modelConstructor: IConstructor<any>;
1087
- propertyName: string;
1088
- validator: IValidator;
1089
- validatorOptions?: any;
1090
- }
1091
-
1092
- declare class ValidationMetadataStore {
1093
- private validators;
1094
- saveValidatorMetadata(validatorMetadata: IValidatorMetadata): void;
1095
- getModelValidatorsInfo<V>(modelConstructor: IConstructor<V>): IModelValidatorsInfo<V>;
1096
- }
1097
-
1098
- declare function validateIsBoolean(value: any): IValidationResult<boolean>;
1099
-
1100
- declare function validateIsDate(value: any): IValidationResult<Date>;
1101
-
1102
- declare function validateIsNotEmpty(value: any): IValidationResult<any>;
1103
-
1104
- declare function validateIsNumber(value: any): IValidationResult<number>;
1105
-
1106
- declare function validateIsString(value: any): IValidationResult<string>;
1107
-
1108
- interface IValidateMaxOptions {
1109
- limit: any;
1110
- }
1111
- declare function validateMax(value: any, options: IValidateMaxOptions): IValidationResult<any>;
1112
-
1113
- interface IValidateMinOptions {
1114
- limit: any;
1115
- }
1116
- declare function validateMin(value: any, options: IValidateMinOptions): IValidationResult<any>;
1117
-
1118
- declare function validateIsPresent(value: any): IValidationResult<any>;
1119
-
1120
- declare function validateModel<V>(value: any, info: IModelValidatorsInfo<V>): IModelValidationResult<V>;
1121
-
1122
- declare function validateModel2<V>(value: any, modelConstructor: IConstructor<V>): IModelValidationResult<V>;
1123
-
1124
- export { AuthenticationModule, Chat, ChatBot, ChatBotAdapter, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, CmdChannel, Container, ControllerMetadataStore, DeepSeekChatBotAdapter, EmailService, EnvWhatsAppRepository, ExpressProvider, HtmlModule, HttpServerProvider, type IChannelMetadata, type IChatBot, type IChatBotAdapter, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatFunctionCall, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type IConnectionChatMessage, type IConstructor, type ICrudRepository, type IEmailService, type IEndPointMetadata, type IGetConfig, type IGetWhatsAppTemplateRequest, type IHtmlModuleOptions, type IListenWhatsAppMessageRequest, type IMessageContext, type IMessageMetadata, type IMindset, type IMindsetDecoration, type IMindsetFunctionConfig, type IMindsetFunctionDecoration, type IMindsetFunctionMetadata, type IMindsetFunctionParamMetadata, type IMindsetIdentity, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleDecoration, type IMindsetModuleMetadata, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IOtpService, type IParamConfig, type IParamDecoration, type IPersistentData, type IPgRepositoryConfig, type IPostConfig, type IPropertyValidatorInfo, type IReceivedMessage, type IReceivedMessageItem, type IRestControllerConfig, type IRestControllerMetadata, type IReversibleMapper, type ISendEmailRequest, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type IServerConfig, type IServerProvider, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type ISystemFunctionCallItem, type ISystemMessageItem, type ITelegramChannelConfig, type IUserConnection, type IUserData, type IUserRepository, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWabotEnvType, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppContact, type IWhatsAppData, type IWhatsAppMessage, type IWhatsAppMessageListener, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsAppTemplateMessage, type IWhatsAppTemplateParameter, type IWhatsAppWebhookPayload, type IWhatsappChannelConfig, type IchatControllerConfig, type IrunChannelProps, Logger, MINDSET_DECORATION_MINDSET, MINDSET_FUNCTION_DECORATION_FUNCTION, MINDSET_MODULE_DECORATION_MODULE, MessageContext, Mindset, MindsetMetadataStore, MindsetOperator, OpenaiChatBotAdapter, OtpService, PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM, Persistent, PgChatMemory, PgChatRepository, PgCrudRepository, PgRepositoryBase, PgUserRepository, PgWhatsAppRepository, RamChatMemory, RamChatRepository, RamUserRepository, RegisterUserModule, RegisterUserWithEmailRequest, RestControllerMetadataStore, SendOneTimePasswordRequest, SocketChannel, SocketChannelConfig, SocketServerProvider, TelegramChannel, TelegramChannelConfig, User, UserRepository, UserResolver, ValidateOneTimePasswordRequest, ValidationMetadataStore, WabotEnv, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByDevConnection, WhatsAppReceiverByWebHook, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByDevConnection, WhatsappChannelConfig, chatBot, chatController, cmd, container, get, inject, injectable, isBoolean, isDate, isNotEmpty, isNumber, isOptional, isPresent, isString, max, min, mindset, mindsetFunction, mindsetModule, param, post, prepareChatContainer, restController, runChannel, runRestControllers, runServer, singleton, socket, telegram, validable, validateIsBoolean, validateIsDate, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsString, validateMax, validateMin, validateModel, validateModel2, whatsapp };
1625
+ export { AnthropicChatAdapter, ApiKey, ApiKeyConnectionGuardMiddleware, 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 IGenerateApiKeyReq, type IGenerateApiKeyRes, 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 IRemoteApiKeyFetcher, 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 IValidateIsInOptions, 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, RemoteApiKeyRepository, 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, apiKeyConnectionGuard, apiKeyGuard, chatBot, chatController, chatItemTypeOptions, cmd, command, commandHandler, connectionMiddleware, container, inject, injectable, isArray, isBoolean, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isString, jwtConnectionGuard, jwtGuard, max, middleware, min, mindset, mindsetFunction, mindsetModule, modelInfo, onDelete, onGet, onPost, onPut, param, readJsonFromFile, restController, runAsyncCommandHandlers, runChatControllers, runRestControllers, runSocketControllers, scoped, singleton, socket, socketConnection, socketController, socketEvent, telegram, validate, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsString, validateMax, validateMin, validateModel, whatsApp, writeJsonToFile };