@wabot-dev/framework 0.1.0-beta.5 → 0.1.0-beta.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/addon/async/pg/PgJobRepository.js +26 -0
- package/dist/src/addon/auth/api-key/@apiKeyGuard.js +17 -0
- package/dist/src/addon/auth/api-key/ApiKey.js +53 -0
- package/dist/src/addon/auth/api-key/ApiKeyGuardMiddleware.js +45 -0
- package/dist/src/addon/auth/api-key/ApiKeyRepository.js +13 -0
- package/dist/src/addon/auth/api-key/PgApiKeyRepository.js +21 -0
- package/dist/src/addon/auth/jwt/@jwtConnectionGuard.js +16 -0
- package/dist/src/addon/auth/jwt/@jwtGuard.js +17 -0
- package/dist/src/addon/auth/jwt/Jwt.js +53 -0
- package/dist/src/addon/auth/jwt/JwtAccessAndRefreshTokenDto.js +20 -0
- package/dist/src/addon/auth/jwt/JwtConfig.js +28 -0
- package/dist/src/addon/auth/jwt/JwtConnectionGuardMiddleware.js +57 -0
- package/dist/src/addon/auth/jwt/JwtGuardMiddleware.js +45 -0
- package/dist/src/addon/auth/jwt/JwtRefreshToken.js +56 -0
- package/dist/src/addon/auth/jwt/JwtRefreshTokenRepository.js +25 -0
- package/dist/src/addon/auth/jwt/JwtSigner.js +36 -0
- package/dist/src/addon/auth/jwt/JwtTokenDto.js +22 -0
- package/dist/src/addon/auth/jwt/PgJwtRefreshTokenRepository.js +21 -0
- package/dist/src/addon/chat-bot/anthropic/AnthropicChatAdapter.js +135 -0
- package/dist/src/addon/chat-bot/deepseek/DeepSeekChatAdapter.js +137 -0
- package/dist/src/addon/chat-bot/google/GoogleChatAdapter.js +145 -0
- package/dist/src/addon/chat-bot/openia/OpenaiChatAdapter.js +117 -0
- package/dist/src/{pre-made/repository/chat → addon/chat-bot}/pg/PgChatMemory.js +6 -4
- package/dist/src/{pre-made/repository/chat → addon/chat-bot}/pg/PgChatRepository.js +6 -5
- package/dist/src/{pre-made/repository/chat → addon/chat-bot}/ram/RamChatRepository.js +2 -2
- package/dist/src/addon/chat-bot/wabot/WabotChatAdapter.js +41 -0
- package/dist/src/addon/chat-controller/cmd/@cmd.js +23 -0
- package/dist/src/{channels → addon/chat-controller}/cmd/CmdChannel.js +4 -26
- package/dist/src/{channels → addon/chat-controller}/socket/@socket.js +9 -4
- package/dist/src/{channels → addon/chat-controller}/socket/SocketChannel.js +5 -23
- package/dist/src/{channels → addon/chat-controller}/socket/SocketChannelConfig.js +1 -1
- package/dist/src/{channels → addon/chat-controller}/telegram/@telegram.js +9 -4
- package/dist/src/{channels → addon/chat-controller}/telegram/TelegramChannel.js +4 -22
- package/dist/src/addon/chat-controller/whatsapp/@whatsApp.js +25 -0
- package/dist/src/{channels → addon/chat-controller}/whatsapp/EnvWhatsAppRepository.js +3 -3
- package/dist/src/{channels → addon/chat-controller}/whatsapp/PgWhatsAppRepository.js +2 -2
- package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsApp.js +2 -4
- package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsAppChannel.js +6 -18
- package/dist/src/addon/chat-controller/whatsapp/WhatsAppReceiver.js +10 -0
- package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsAppSender.js +20 -41
- package/dist/src/addon/chat-controller/whatsapp/cloud-api/WhatsAppReceiverByCloudApi.js +97 -0
- package/dist/src/{channels/whatsapp → addon/chat-controller/whatsapp/cloud-api}/WhatsAppSenderByCloudApi.js +26 -20
- package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppProxyContracts.js +5 -0
- package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppReceiverByWabotProxy.js +65 -0
- package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppSenderByWabotProxy.js +60 -0
- package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppWabotProxyConnection.js +45 -0
- package/dist/src/addon/mindset/html/HtmlModule.js +70 -0
- package/dist/src/core/auth/Auth.js +24 -0
- package/dist/src/core/{Persistent.js → entity/Entity.js} +24 -9
- package/dist/src/core/env/Env.js +39 -0
- package/dist/src/core/error/CustomError.js +15 -0
- package/dist/src/core/injection/index.js +4 -0
- package/dist/src/core/mapper/Mapper.js +42 -0
- package/dist/src/core/password/Password.js +30 -0
- package/dist/src/core/random/Random.js +47 -0
- package/dist/src/core/storable/Storable.js +8 -0
- package/dist/src/core/validation/core/validateArray.js +51 -0
- package/dist/src/core/validation/core/validateIsOptional.js +5 -0
- package/dist/src/core/validation/core/validateModel.js +36 -0
- package/dist/src/core/validation/metadata/@isArray.js +18 -0
- package/dist/src/core/validation/metadata/@isModel.js +18 -0
- package/dist/src/core/validation/metadata/@isOptional.js +17 -0
- package/dist/src/core/validation/metadata/ValidationMetadataStore.js +98 -0
- package/dist/src/core/validation/modelInfo.js +9 -0
- package/dist/src/core/validation/validate.js +11 -0
- package/dist/src/core/validation/validators/is-boolean/@isBoolean.js +17 -0
- package/dist/src/core/validation/validators/is-boolean/validateIsBoolean.js +12 -0
- package/dist/src/core/validation/validators/is-date/@isDate.js +17 -0
- package/dist/src/core/validation/validators/is-date/validateIsDate.js +16 -0
- package/dist/src/core/validation/validators/is-not-empty/@isNotEmpty.js +17 -0
- package/dist/src/core/validation/validators/is-not-empty/validateIsNotEmpty.js +12 -0
- package/dist/src/core/validation/validators/is-number/@isNumber.js +17 -0
- package/dist/src/core/validation/validators/is-number/validateIsNumber.js +12 -0
- package/dist/src/core/validation/validators/is-present/@isPresent.js +17 -0
- package/dist/src/core/validation/validators/is-present/validateIsPresent.js +12 -0
- package/dist/src/core/validation/validators/is-string/@isString.js +17 -0
- package/dist/src/core/validation/validators/is-string/validateIsString.js +12 -0
- package/dist/src/core/validation/validators/max/@max.js +18 -0
- package/dist/src/core/validation/validators/max/validateMax.js +17 -0
- package/dist/src/core/validation/validators/min/@min.js +18 -0
- package/dist/src/core/validation/validators/min/validateMin.js +17 -0
- package/dist/src/feature/async/@command.js +11 -0
- package/dist/src/feature/async/@commandHandler.js +12 -0
- package/dist/src/feature/async/Async.js +38 -0
- package/dist/src/feature/async/Command.js +9 -0
- package/dist/src/feature/async/CommandMetadataStore.js +38 -0
- package/dist/src/feature/async/Job.js +24 -0
- package/dist/src/feature/async/JobRepository.js +31 -0
- package/dist/src/feature/async/JobRunner.js +45 -0
- package/dist/src/feature/async/JobsEventsHub.js +24 -0
- package/dist/src/feature/async/runCommandHandlers.js +29 -0
- package/dist/src/{core/chat → feature/chat-bot}/Chat.js +2 -2
- package/dist/src/feature/chat-bot/ChatAdapter.js +7 -0
- package/dist/src/feature/chat-bot/ChatBot.js +73 -0
- package/dist/src/feature/chat-bot/ChatItem.js +24 -0
- package/dist/src/feature/chat-bot/ChatMemory.js +10 -0
- package/dist/src/{core/chat/repository/IChatRepository.js → feature/chat-bot/ChatRepository.js} +2 -8
- package/dist/src/feature/chat-bot/IChatItem.js +3 -0
- package/dist/src/{chatbot → feature/chat-bot}/metadata/@chatBot.js +1 -1
- package/dist/src/{chatbot → feature/chat-bot}/metadata/ChatBotMetadataStore.js +1 -1
- package/dist/src/{controller/channel → feature/chat-controller}/ChatResolver.js +6 -4
- package/dist/src/{controller → feature/chat-controller}/metadata/ControllerMetadataStore.js +1 -1
- package/dist/src/{controller → feature/chat-controller}/metadata/controller/@chatController.js +1 -1
- package/dist/src/feature/chat-controller/runChatControllers.js +69 -0
- package/dist/src/{channels → feature}/express/ExpressProvider.js +2 -4
- package/dist/src/{channels → feature}/http/HttpServerProvider.js +2 -2
- package/dist/src/{mindset → feature/mindset}/IMindset.js +3 -0
- package/dist/src/{mindset → feature/mindset}/MindsetOperator.js +69 -42
- package/dist/src/{mindset → feature/mindset}/metadata/MindsetMetadataStore.js +1 -1
- package/dist/src/{mindset → feature/mindset}/metadata/functions/@mindsetFunction.js +1 -1
- package/dist/src/{mindset → feature/mindset}/metadata/mindsets/@mindset.js +1 -1
- package/dist/src/{mindset → feature/mindset}/metadata/modules/@mindsetModule.js +1 -2
- package/dist/src/{mindset → feature/mindset}/metadata/params/@param.js +1 -1
- package/dist/src/feature/money/Money.js +61 -0
- package/dist/src/feature/money/MoneyDto.js +22 -0
- package/dist/src/{repository → feature}/pg/PgCrudRepository.js +25 -2
- package/dist/src/{repository → feature}/pg/PgRepositoryBase.js +2 -2
- package/dist/src/feature/rest-controller/injection-tokens.js +4 -0
- package/dist/src/feature/rest-controller/metadata/@get.js +19 -0
- package/dist/src/feature/rest-controller/metadata/@middleware.js +16 -0
- package/dist/src/feature/rest-controller/metadata/@post.js +19 -0
- package/dist/src/feature/rest-controller/metadata/@restController.js +15 -0
- package/dist/src/feature/rest-controller/metadata/RestControllerMetadataStore.js +50 -0
- package/dist/src/feature/rest-controller/runRestControllers.js +102 -0
- package/dist/src/{channels → feature}/socket/SocketServerProvider.js +2 -2
- package/dist/src/feature/socket-controller/metadata/@connectionMiddleware.js +16 -0
- package/dist/src/feature/socket-controller/metadata/@socketConnection.js +18 -0
- package/dist/src/feature/socket-controller/metadata/@socketController.js +15 -0
- package/dist/src/feature/socket-controller/metadata/@socketEvent.js +18 -0
- package/dist/src/feature/socket-controller/metadata/SocketControllerMetadataStore.js +65 -0
- package/dist/src/feature/socket-controller/runSocketControllers.js +98 -0
- package/dist/src/index.d.ts +1151 -575
- package/dist/src/index.js +140 -76
- package/package.json +10 -4
- package/dist/src/ai/deepseek/DeepSeekChatBotAdapter.js +0 -106
- package/dist/src/ai/openia/OpenaiChatBotAdapter.js +0 -84
- package/dist/src/channels/cmd/@cmd.js +0 -18
- package/dist/src/channels/wabot/WabotDevConnection.js +0 -57
- package/dist/src/channels/wabot/WabotDevSocketContracts.js +0 -10
- package/dist/src/channels/whatsapp/@whatsapp.js +0 -20
- package/dist/src/channels/whatsapp/WhatsAppReceiver.js +0 -59
- package/dist/src/channels/whatsapp/WhatsAppReceiverByDevConnection.js +0 -32
- package/dist/src/channels/whatsapp/WhatsAppReceiverByWebHook.js +0 -63
- package/dist/src/channels/whatsapp/WhatsAppSenderByDevConnection.js +0 -61
- package/dist/src/chatbot/ChatBot.js +0 -51
- package/dist/src/chatbot/ChatBotAdapter.js +0 -72
- package/dist/src/controller/channel/UserResolver.js +0 -21
- package/dist/src/core/IMessageContext.js +0 -12
- package/dist/src/core/chat/ChatItem.js +0 -15
- package/dist/src/core/chat/repository/IChatMemory.js +0 -10
- package/dist/src/core/user/IUserRepository.js +0 -19
- package/dist/src/core/user/User.js +0 -26
- package/dist/src/env/WabotEnv.js +0 -27
- package/dist/src/injection/index.js +0 -4
- package/dist/src/mindset/metadata/params/@isOptional.js +0 -21
- package/dist/src/pre-made/module/authentication/AuthenticationModule.js +0 -97
- package/dist/src/pre-made/module/authentication/requests/SendOneTimePasswordRequest.js +0 -25
- package/dist/src/pre-made/module/authentication/requests/ValidateOneTimePasswordRequest.js +0 -25
- package/dist/src/pre-made/module/register-user/RegisterUserModule.js +0 -56
- package/dist/src/pre-made/module/register-user/requests/RegisterUserWithEmailRequest.js +0 -25
- package/dist/src/pre-made/repository/user/pg/PgUserRepository.js +0 -33
- package/dist/src/pre-made/repository/user/ram/RamUserRepository.js +0 -27
- package/dist/src/pre-made/service/EmailService.js +0 -13
- package/dist/src/pre-made/service/OtpService.js +0 -14
- package/dist/src/server/prepareChatContainer.js +0 -43
- package/dist/src/server/runChannel.js +0 -27
- package/dist/src/server/runServer.js +0 -40
- /package/dist/src/{pre-made/repository/chat → addon/chat-bot}/ram/RamChatMemory.js +0 -0
- /package/dist/src/{channels → addon/chat-controller}/telegram/TelegramChannelConfig.js +0 -0
- /package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsAppChannelConfig.js +0 -0
- /package/dist/src/{channels → addon/chat-controller}/whatsapp/WhatsAppRepository.js +0 -0
- /package/dist/src/{injection → core/injection}/Container.js +0 -0
- /package/dist/src/{logger → core/logger}/Logger.js +0 -0
- /package/dist/src/{mindset → feature/mindset}/metadata/functions/decoratorNames.js +0 -0
- /package/dist/src/{mindset → feature/mindset}/metadata/mindsets/decoratorNames.js +0 -0
- /package/dist/src/{mindset → feature/mindset}/metadata/modules/decoratorNames.js +0 -0
- /package/dist/src/{mindset → feature/mindset}/metadata/params/decoratorNames.js +0 -0
package/dist/src/index.js
CHANGED
|
@@ -1,76 +1,140 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export {
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
35
|
-
export {
|
|
36
|
-
export {
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export {
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
44
|
-
export {
|
|
45
|
-
export {
|
|
46
|
-
export {
|
|
47
|
-
export {
|
|
48
|
-
export {
|
|
49
|
-
export {
|
|
50
|
-
export {
|
|
51
|
-
export {
|
|
52
|
-
export {
|
|
53
|
-
export {
|
|
54
|
-
export {
|
|
55
|
-
export {
|
|
56
|
-
export {
|
|
57
|
-
export {
|
|
58
|
-
export {
|
|
59
|
-
export {
|
|
60
|
-
export {
|
|
61
|
-
export {
|
|
62
|
-
export {
|
|
63
|
-
export {
|
|
64
|
-
export {
|
|
65
|
-
export {
|
|
66
|
-
export {
|
|
67
|
-
export {
|
|
68
|
-
export {
|
|
69
|
-
export {
|
|
70
|
-
export {
|
|
71
|
-
export {
|
|
72
|
-
export {
|
|
73
|
-
export {
|
|
74
|
-
export {
|
|
75
|
-
export {
|
|
76
|
-
export {
|
|
1
|
+
export { Auth } from './core/auth/Auth.js';
|
|
2
|
+
export { Entity, Persistent } from './core/entity/Entity.js';
|
|
3
|
+
export { Env } from './core/env/Env.js';
|
|
4
|
+
export { CustomError } from './core/error/CustomError.js';
|
|
5
|
+
export { Lifecycle, container, inject, injectable, scoped, singleton } from './core/injection/index.js';
|
|
6
|
+
export { Logger } from './core/logger/Logger.js';
|
|
7
|
+
export { Mapper } from './core/mapper/Mapper.js';
|
|
8
|
+
export { Password } from './core/password/Password.js';
|
|
9
|
+
export { Random } from './core/random/Random.js';
|
|
10
|
+
export { Storable } from './core/storable/Storable.js';
|
|
11
|
+
export { isModel } from './core/validation/metadata/@isModel.js';
|
|
12
|
+
export { isOptional } from './core/validation/metadata/@isOptional.js';
|
|
13
|
+
export { isArray } from './core/validation/metadata/@isArray.js';
|
|
14
|
+
export { ValidationMetadataStore } from './core/validation/metadata/ValidationMetadataStore.js';
|
|
15
|
+
export { validateModel } from './core/validation/core/validateModel.js';
|
|
16
|
+
export { validateArray } from './core/validation/core/validateArray.js';
|
|
17
|
+
export { validate } from './core/validation/validate.js';
|
|
18
|
+
export { modelInfo } from './core/validation/modelInfo.js';
|
|
19
|
+
export { isBoolean } from './core/validation/validators/is-boolean/@isBoolean.js';
|
|
20
|
+
export { validateIsBoolean } from './core/validation/validators/is-boolean/validateIsBoolean.js';
|
|
21
|
+
export { isDate } from './core/validation/validators/is-date/@isDate.js';
|
|
22
|
+
export { validateIsDate } from './core/validation/validators/is-date/validateIsDate.js';
|
|
23
|
+
export { isNotEmpty } from './core/validation/validators/is-not-empty/@isNotEmpty.js';
|
|
24
|
+
export { validateIsNotEmpty } from './core/validation/validators/is-not-empty/validateIsNotEmpty.js';
|
|
25
|
+
export { isNumber } from './core/validation/validators/is-number/@isNumber.js';
|
|
26
|
+
export { validateIsNumber } from './core/validation/validators/is-number/validateIsNumber.js';
|
|
27
|
+
export { isPresent } from './core/validation/validators/is-present/@isPresent.js';
|
|
28
|
+
export { validateIsPresent } from './core/validation/validators/is-present/validateIsPresent.js';
|
|
29
|
+
export { isString } from './core/validation/validators/is-string/@isString.js';
|
|
30
|
+
export { validateIsString } from './core/validation/validators/is-string/validateIsString.js';
|
|
31
|
+
export { min } from './core/validation/validators/min/@min.js';
|
|
32
|
+
export { validateMin } from './core/validation/validators/min/validateMin.js';
|
|
33
|
+
export { max } from './core/validation/validators/max/@max.js';
|
|
34
|
+
export { validateMax } from './core/validation/validators/max/validateMax.js';
|
|
35
|
+
export { command } from './feature/async/@command.js';
|
|
36
|
+
export { commandHandler } from './feature/async/@commandHandler.js';
|
|
37
|
+
export { Async } from './feature/async/Async.js';
|
|
38
|
+
export { Command } from './feature/async/Command.js';
|
|
39
|
+
export { CommandMetadataStore } from './feature/async/CommandMetadataStore.js';
|
|
40
|
+
export { Job } from './feature/async/Job.js';
|
|
41
|
+
export { JobRepository } from './feature/async/JobRepository.js';
|
|
42
|
+
export { JobRunner } from './feature/async/JobRunner.js';
|
|
43
|
+
export { JobsEventsHub } from './feature/async/JobsEventsHub.js';
|
|
44
|
+
export { runAsyncCommandHandlers } from './feature/async/runCommandHandlers.js';
|
|
45
|
+
export { Chat } from './feature/chat-bot/Chat.js';
|
|
46
|
+
export { ChatAdapter } from './feature/chat-bot/ChatAdapter.js';
|
|
47
|
+
export { ChatBot } from './feature/chat-bot/ChatBot.js';
|
|
48
|
+
export { ChatItem } from './feature/chat-bot/ChatItem.js';
|
|
49
|
+
export { ChatMemory } from './feature/chat-bot/ChatMemory.js';
|
|
50
|
+
export { ChatRepository } from './feature/chat-bot/ChatRepository.js';
|
|
51
|
+
export { chatItemTypeOptions } from './feature/chat-bot/IChatItem.js';
|
|
52
|
+
export { chatBot } from './feature/chat-bot/metadata/@chatBot.js';
|
|
53
|
+
export { ChatBotMetadataStore } from './feature/chat-bot/metadata/ChatBotMetadataStore.js';
|
|
54
|
+
export { chatController } from './feature/chat-controller/metadata/controller/@chatController.js';
|
|
55
|
+
export { ControllerMetadataStore } from './feature/chat-controller/metadata/ControllerMetadataStore.js';
|
|
56
|
+
export { ChatResolver } from './feature/chat-controller/ChatResolver.js';
|
|
57
|
+
export { runChatControllers } from './feature/chat-controller/runChatControllers.js';
|
|
58
|
+
export { ExpressProvider } from './feature/express/ExpressProvider.js';
|
|
59
|
+
export { HttpServerProvider } from './feature/http/HttpServerProvider.js';
|
|
60
|
+
export { mindsetFunction } from './feature/mindset/metadata/functions/@mindsetFunction.js';
|
|
61
|
+
export { MINDSET_FUNCTION_DECORATION_FUNCTION } from './feature/mindset/metadata/functions/decoratorNames.js';
|
|
62
|
+
export { mindset } from './feature/mindset/metadata/mindsets/@mindset.js';
|
|
63
|
+
export { MINDSET_DECORATION_MINDSET } from './feature/mindset/metadata/mindsets/decoratorNames.js';
|
|
64
|
+
export { mindsetModule } from './feature/mindset/metadata/modules/@mindsetModule.js';
|
|
65
|
+
export { MINDSET_MODULE_DECORATION_MODULE } from './feature/mindset/metadata/modules/decoratorNames.js';
|
|
66
|
+
export { param } from './feature/mindset/metadata/params/@param.js';
|
|
67
|
+
export { PARAM_DECORATION_IS_OPTIONAL, PARAM_DECORATION_PARAM } from './feature/mindset/metadata/params/decoratorNames.js';
|
|
68
|
+
export { MindsetMetadataStore } from './feature/mindset/metadata/MindsetMetadataStore.js';
|
|
69
|
+
export { Mindset } from './feature/mindset/IMindset.js';
|
|
70
|
+
export { MindsetOperator } from './feature/mindset/MindsetOperator.js';
|
|
71
|
+
export { Money } from './feature/money/Money.js';
|
|
72
|
+
export { MoneyDto } from './feature/money/MoneyDto.js';
|
|
73
|
+
export { PgCrudRepository } from './feature/pg/PgCrudRepository.js';
|
|
74
|
+
export { PgRepositoryBase } from './feature/pg/PgRepositoryBase.js';
|
|
75
|
+
export { get } from './feature/rest-controller/metadata/@get.js';
|
|
76
|
+
export { middleware } from './feature/rest-controller/metadata/@middleware.js';
|
|
77
|
+
export { post } from './feature/rest-controller/metadata/@post.js';
|
|
78
|
+
export { restController } from './feature/rest-controller/metadata/@restController.js';
|
|
79
|
+
export { RestControllerMetadataStore } from './feature/rest-controller/metadata/RestControllerMetadataStore.js';
|
|
80
|
+
export { runRestControllers } from './feature/rest-controller/runRestControllers.js';
|
|
81
|
+
export { EXPRESS_REQ, EXPRESS_RES } from './feature/rest-controller/injection-tokens.js';
|
|
82
|
+
export { SocketServerProvider } from './feature/socket/SocketServerProvider.js';
|
|
83
|
+
export { connectionMiddleware } from './feature/socket-controller/metadata/@connectionMiddleware.js';
|
|
84
|
+
export { socketConnection } from './feature/socket-controller/metadata/@socketConnection.js';
|
|
85
|
+
export { socketController } from './feature/socket-controller/metadata/@socketController.js';
|
|
86
|
+
export { socketEvent } from './feature/socket-controller/metadata/@socketEvent.js';
|
|
87
|
+
export { SocketControllerMetadataStore } from './feature/socket-controller/metadata/SocketControllerMetadataStore.js';
|
|
88
|
+
export { runSocketControllers } from './feature/socket-controller/runSocketControllers.js';
|
|
89
|
+
export { PgJobRepository } from './addon/async/pg/PgJobRepository.js';
|
|
90
|
+
export { apiKeyGuard } from './addon/auth/api-key/@apiKeyGuard.js';
|
|
91
|
+
export { ApiKey } from './addon/auth/api-key/ApiKey.js';
|
|
92
|
+
export { ApiKeyGuardMiddleware } from './addon/auth/api-key/ApiKeyGuardMiddleware.js';
|
|
93
|
+
export { ApiKeyRepository } from './addon/auth/api-key/ApiKeyRepository.js';
|
|
94
|
+
export { PgApiKeyRepository } from './addon/auth/api-key/PgApiKeyRepository.js';
|
|
95
|
+
export { jwtConnectionGuard } from './addon/auth/jwt/@jwtConnectionGuard.js';
|
|
96
|
+
export { jwtGuard } from './addon/auth/jwt/@jwtGuard.js';
|
|
97
|
+
export { Jwt } from './addon/auth/jwt/Jwt.js';
|
|
98
|
+
export { JwtAccessAndRefreshTokenDto } from './addon/auth/jwt/JwtAccessAndRefreshTokenDto.js';
|
|
99
|
+
export { JwtConfig } from './addon/auth/jwt/JwtConfig.js';
|
|
100
|
+
export { JwtConnectionGuardMiddleware } from './addon/auth/jwt/JwtConnectionGuardMiddleware.js';
|
|
101
|
+
export { JwtGuardMiddleware } from './addon/auth/jwt/JwtGuardMiddleware.js';
|
|
102
|
+
export { JwtRefreshToken } from './addon/auth/jwt/JwtRefreshToken.js';
|
|
103
|
+
export { JwtRefreshTokenRepository } from './addon/auth/jwt/JwtRefreshTokenRepository.js';
|
|
104
|
+
export { JwtSigner } from './addon/auth/jwt/JwtSigner.js';
|
|
105
|
+
export { JwtTokenDto } from './addon/auth/jwt/JwtTokenDto.js';
|
|
106
|
+
export { PgJwtRefreshTokenRepository } from './addon/auth/jwt/PgJwtRefreshTokenRepository.js';
|
|
107
|
+
export { AnthropicChatAdapter } from './addon/chat-bot/anthropic/AnthropicChatAdapter.js';
|
|
108
|
+
export { DeepSeekChatAdapter } from './addon/chat-bot/deepseek/DeepSeekChatAdapter.js';
|
|
109
|
+
export { GoogleChatAdapter } from './addon/chat-bot/google/GoogleChatAdapter.js';
|
|
110
|
+
export { OpenaiChatAdapter } from './addon/chat-bot/openia/OpenaiChatAdapter.js';
|
|
111
|
+
export { PgChatRepository } from './addon/chat-bot/pg/PgChatRepository.js';
|
|
112
|
+
export { PgChatMemory } from './addon/chat-bot/pg/PgChatMemory.js';
|
|
113
|
+
export { RamChatMemory } from './addon/chat-bot/ram/RamChatMemory.js';
|
|
114
|
+
export { RamChatRepository } from './addon/chat-bot/ram/RamChatRepository.js';
|
|
115
|
+
export { WabotChatAdapter } from './addon/chat-bot/wabot/WabotChatAdapter.js';
|
|
116
|
+
export { cmd } from './addon/chat-controller/cmd/@cmd.js';
|
|
117
|
+
export { CmdChannel } from './addon/chat-controller/cmd/CmdChannel.js';
|
|
118
|
+
export { socket } from './addon/chat-controller/socket/@socket.js';
|
|
119
|
+
export { SocketChannel } from './addon/chat-controller/socket/SocketChannel.js';
|
|
120
|
+
export { SocketChannelConfig } from './addon/chat-controller/socket/SocketChannelConfig.js';
|
|
121
|
+
export { telegram } from './addon/chat-controller/telegram/@telegram.js';
|
|
122
|
+
export { TelegramChannelConfig } from './addon/chat-controller/telegram/TelegramChannelConfig.js';
|
|
123
|
+
export { TelegramChannel } from './addon/chat-controller/telegram/TelegramChannel.js';
|
|
124
|
+
export { whatsApp } from './addon/chat-controller/whatsapp/@whatsApp.js';
|
|
125
|
+
export { EnvWhatsAppRepository } from './addon/chat-controller/whatsapp/EnvWhatsAppRepository.js';
|
|
126
|
+
export { PgWhatsAppRepository } from './addon/chat-controller/whatsapp/PgWhatsAppRepository.js';
|
|
127
|
+
export { WhatsApp } from './addon/chat-controller/whatsapp/WhatsApp.js';
|
|
128
|
+
export { WhatsAppChannel } from './addon/chat-controller/whatsapp/WhatsAppChannel.js';
|
|
129
|
+
export { WhatsappChannelConfig } from './addon/chat-controller/whatsapp/WhatsAppChannelConfig.js';
|
|
130
|
+
export { WhatsAppReceiver } from './addon/chat-controller/whatsapp/WhatsAppReceiver.js';
|
|
131
|
+
export { WhatsAppRepository } from './addon/chat-controller/whatsapp/WhatsAppRepository.js';
|
|
132
|
+
export { WhatsAppSender } from './addon/chat-controller/whatsapp/WhatsAppSender.js';
|
|
133
|
+
export { WhatsAppReceiverByCloudApi } from './addon/chat-controller/whatsapp/cloud-api/WhatsAppReceiverByCloudApi.js';
|
|
134
|
+
export { WhatsAppSenderByCloudApi } from './addon/chat-controller/whatsapp/cloud-api/WhatsAppSenderByCloudApi.js';
|
|
135
|
+
export { WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT } from './addon/chat-controller/whatsapp/proxy/WhatsAppProxyContracts.js';
|
|
136
|
+
export { WhatsAppReceiverByWabotProxy } from './addon/chat-controller/whatsapp/proxy/WhatsAppReceiverByWabotProxy.js';
|
|
137
|
+
export { WhatsAppSenderByWabotProxy } from './addon/chat-controller/whatsapp/proxy/WhatsAppSenderByWabotProxy.js';
|
|
138
|
+
export { WhatsAppWabotProxyConnection } from './addon/chat-controller/whatsapp/proxy/WhatsAppWabotProxyConnection.js';
|
|
139
|
+
export { HtmlModule } from './addon/mindset/html/HtmlModule.js';
|
|
140
|
+
export { Container } from './core/injection/Container.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wabot-dev/framework",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.51",
|
|
4
4
|
"description": "Framework for IA Chat Bots",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"fmt": "prettier --write .",
|
|
17
17
|
"fmt:check": "prettier --check .",
|
|
18
18
|
"types:check": "tsc --noEmit",
|
|
19
|
-
"elia:dev": "yts --import ./env.mjs ./test/elia/
|
|
19
|
+
"elia:dev": "yts --import ./env.mjs ./test/elia/run.ts"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@rollup/plugin-alias": "5.1.1",
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
"@rollup/plugin-json": "6.1.0",
|
|
25
25
|
"@rollup/plugin-node-resolve": "16.0.1",
|
|
26
26
|
"@rollup/plugin-typescript": "12.1.2",
|
|
27
|
+
"@types/big.js": "^6.2.2",
|
|
28
|
+
"@types/html-to-text": "^9.0.4",
|
|
27
29
|
"@types/node": "22.14.1",
|
|
28
30
|
"@types/react": "^19.1.2",
|
|
29
31
|
"@yucacodes/ts": "^0.0.4",
|
|
@@ -34,17 +36,21 @@
|
|
|
34
36
|
"typescript": "5.8.3"
|
|
35
37
|
},
|
|
36
38
|
"peerDependencies": {
|
|
39
|
+
"@anthropic-ai/sdk": "^0.60.0",
|
|
40
|
+
"@google/genai": "^1.16.0",
|
|
37
41
|
"@types/debug": "^4.1.12",
|
|
38
42
|
"@types/express": "^5.0.1",
|
|
43
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
39
44
|
"@types/pg": "^8.11.14",
|
|
40
45
|
"@yucacodes/ts": "^0.0.4",
|
|
46
|
+
"big.js": "^7.0.1",
|
|
41
47
|
"body-parser": "^2.2.0",
|
|
42
|
-
"class-transformer": "^0.5.1",
|
|
43
|
-
"class-validator": "^0.14.1",
|
|
44
48
|
"debug": "^4.4.0",
|
|
45
49
|
"dotenv": "^16.5.0",
|
|
46
50
|
"express": "^5.1.0",
|
|
47
51
|
"grammy": "^1.36.0",
|
|
52
|
+
"html-to-text": "^9.0.5",
|
|
53
|
+
"jsonwebtoken": "^9.0.2",
|
|
48
54
|
"openai": "^4.93.0",
|
|
49
55
|
"pg": "^8.15.6",
|
|
50
56
|
"reflect-metadata": "^0.2.2",
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from 'tslib';
|
|
2
|
-
import { injectable } from '../../injection/index.js';
|
|
3
|
-
import { OpenAI } from 'openai';
|
|
4
|
-
import 'uuid';
|
|
5
|
-
import '../../chatbot/metadata/ChatBotMetadataStore.js';
|
|
6
|
-
import '../../chatbot/ChatBot.js';
|
|
7
|
-
import { ChatBotAdapter } from '../../chatbot/ChatBotAdapter.js';
|
|
8
|
-
import 'reflect-metadata';
|
|
9
|
-
import '../../mindset/metadata/MindsetMetadataStore.js';
|
|
10
|
-
import { MindsetOperator } from '../../mindset/MindsetOperator.js';
|
|
11
|
-
|
|
12
|
-
let DeepSeekChatBotAdapter = class DeepSeekChatBotAdapter extends ChatBotAdapter {
|
|
13
|
-
deepSeek;
|
|
14
|
-
model;
|
|
15
|
-
constructor(mindset) {
|
|
16
|
-
super(mindset);
|
|
17
|
-
const model = process.env.DEEPSEEK_CHAT_MODEL;
|
|
18
|
-
const apiKey = process.env.DEEPSEEK_API_KEY;
|
|
19
|
-
const baseURL = process.env.DEEPSEEK_BASE_URL;
|
|
20
|
-
this.validateEnvVariables([model, apiKey, baseURL]);
|
|
21
|
-
this.model = model || 'deepseek-chat';
|
|
22
|
-
this.deepSeek = new OpenAI({
|
|
23
|
-
apiKey: apiKey,
|
|
24
|
-
baseURL: baseURL
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
validateEnvVariables(envVariables) {
|
|
28
|
-
envVariables.forEach((envVariable) => {
|
|
29
|
-
if (!envVariable) {
|
|
30
|
-
throw new Error('Missing environment variable');
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
async generateNextChatItem(chatItems) {
|
|
35
|
-
const systemPrompt = await this.systemPrompt();
|
|
36
|
-
const tools = (await this.mindset.allFunctionsDescriptors()).map((fn) => {
|
|
37
|
-
const parameters = { ...fn.parameters, additionalProperties: false, type: 'object' };
|
|
38
|
-
return {
|
|
39
|
-
type: 'function', function: { name: fn.name, description: fn.description, parameters, strict: true }
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
const response = await this.deepSeek.chat.completions.create({
|
|
43
|
-
model: this.model,
|
|
44
|
-
messages: [{ role: 'system', content: systemPrompt }, ...this.mapChatItems(chatItems)],
|
|
45
|
-
tools: tools,
|
|
46
|
-
tool_choice: 'auto'
|
|
47
|
-
});
|
|
48
|
-
let newChatItem;
|
|
49
|
-
const { tool_calls: responseFunctionCall, content: responseText } = response.choices?.[0]?.message ?? {};
|
|
50
|
-
if (responseText) {
|
|
51
|
-
newChatItem = await this.buildBotMessageItem(responseText);
|
|
52
|
-
}
|
|
53
|
-
else if (responseFunctionCall && responseFunctionCall[0]?.type == 'function') {
|
|
54
|
-
newChatItem = await this.buildFunctionCallItem(responseFunctionCall[0].id, responseFunctionCall[0].function.name, responseFunctionCall[0].function.arguments);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
throw new Error('Not supported DeepSeek Response');
|
|
58
|
-
}
|
|
59
|
-
return newChatItem;
|
|
60
|
-
}
|
|
61
|
-
mapChatItems(chatItems) {
|
|
62
|
-
const deepSeekInput = [];
|
|
63
|
-
for (const item of chatItems) {
|
|
64
|
-
const itemData = item.getData();
|
|
65
|
-
if (itemData.type === 'CONNECTION_MESSAGE') {
|
|
66
|
-
if (!itemData.content.text) {
|
|
67
|
-
throw new Error('System message content is empty');
|
|
68
|
-
}
|
|
69
|
-
deepSeekInput.push({ role: 'user', content: itemData.content.text });
|
|
70
|
-
}
|
|
71
|
-
else if (itemData.type === 'BOT_MESSAGE') {
|
|
72
|
-
if (!itemData.content.text) {
|
|
73
|
-
throw new Error('System message content is empty');
|
|
74
|
-
}
|
|
75
|
-
deepSeekInput.push({ role: 'assistant', content: itemData.content.text });
|
|
76
|
-
}
|
|
77
|
-
if (itemData.type === 'FUNCTION_CALL') {
|
|
78
|
-
deepSeekInput.push({
|
|
79
|
-
role: 'assistant',
|
|
80
|
-
tool_calls: [
|
|
81
|
-
{
|
|
82
|
-
id: itemData.content.id,
|
|
83
|
-
type: 'function',
|
|
84
|
-
function: {
|
|
85
|
-
name: itemData.content.name,
|
|
86
|
-
arguments: JSON.stringify(itemData.content.arguments)
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
});
|
|
91
|
-
deepSeekInput.push({
|
|
92
|
-
role: 'tool',
|
|
93
|
-
tool_call_id: itemData.content.id,
|
|
94
|
-
content: itemData.content.result
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return deepSeekInput;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
DeepSeekChatBotAdapter = __decorate([
|
|
102
|
-
injectable(),
|
|
103
|
-
__metadata("design:paramtypes", [MindsetOperator])
|
|
104
|
-
], DeepSeekChatBotAdapter);
|
|
105
|
-
|
|
106
|
-
export { DeepSeekChatBotAdapter };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from 'tslib';
|
|
2
|
-
import { injectable } from '../../injection/index.js';
|
|
3
|
-
import { OpenAI } from 'openai';
|
|
4
|
-
import 'uuid';
|
|
5
|
-
import '../../chatbot/metadata/ChatBotMetadataStore.js';
|
|
6
|
-
import '../../chatbot/ChatBot.js';
|
|
7
|
-
import { ChatBotAdapter } from '../../chatbot/ChatBotAdapter.js';
|
|
8
|
-
import 'reflect-metadata';
|
|
9
|
-
import '../../mindset/metadata/MindsetMetadataStore.js';
|
|
10
|
-
import { MindsetOperator } from '../../mindset/MindsetOperator.js';
|
|
11
|
-
|
|
12
|
-
let OpenaiChatBotAdapter = class OpenaiChatBotAdapter extends ChatBotAdapter {
|
|
13
|
-
openai = new OpenAI();
|
|
14
|
-
model;
|
|
15
|
-
constructor(mindset) {
|
|
16
|
-
super(mindset);
|
|
17
|
-
const model = process.env.OPENAI_CHAT_MODEL;
|
|
18
|
-
if (!model) {
|
|
19
|
-
throw new Error(`OPENAI_CHAT_MODEL env variable is required`);
|
|
20
|
-
}
|
|
21
|
-
this.model = model;
|
|
22
|
-
}
|
|
23
|
-
async generateNextChatItem(chatItems) {
|
|
24
|
-
const systemPrompt = await this.systemPrompt();
|
|
25
|
-
const tools = (await this.mindset.allFunctionsDescriptors()).map((fn) => {
|
|
26
|
-
const parameters = { ...fn.parameters, additionalProperties: false, type: 'object' };
|
|
27
|
-
return { ...fn, type: 'function', parameters, strict: true };
|
|
28
|
-
});
|
|
29
|
-
const response = await this.openai.responses.create({
|
|
30
|
-
model: this.model,
|
|
31
|
-
input: [{ role: 'system', content: systemPrompt }, ...this.mapChatItems(chatItems)],
|
|
32
|
-
tools,
|
|
33
|
-
});
|
|
34
|
-
let newChatItem;
|
|
35
|
-
if (response.output_text) {
|
|
36
|
-
newChatItem = await this.buildBotMessageItem(response.output_text);
|
|
37
|
-
}
|
|
38
|
-
else if (response.output && response.output[0]?.type == 'function_call') {
|
|
39
|
-
newChatItem = await this.buildFunctionCallItem(response.output[0].call_id, response.output[0].name, response.output[0].arguments);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
throw new Error('Not supported OpenIA Response');
|
|
43
|
-
}
|
|
44
|
-
return newChatItem;
|
|
45
|
-
}
|
|
46
|
-
mapChatItems(chatItems) {
|
|
47
|
-
const openIaInput = [];
|
|
48
|
-
for (const item of chatItems) {
|
|
49
|
-
const itemData = item.getData();
|
|
50
|
-
if (itemData.type === 'CONNECTION_MESSAGE') {
|
|
51
|
-
if (!itemData.content.text) {
|
|
52
|
-
throw new Error('System message content is empty');
|
|
53
|
-
}
|
|
54
|
-
openIaInput.push({ role: 'user', content: itemData.content.text });
|
|
55
|
-
}
|
|
56
|
-
else if (itemData.type === 'BOT_MESSAGE') {
|
|
57
|
-
if (!itemData.content.text) {
|
|
58
|
-
throw new Error('System message content is empty');
|
|
59
|
-
}
|
|
60
|
-
openIaInput.push({ role: 'assistant', content: itemData.content.text });
|
|
61
|
-
}
|
|
62
|
-
if (itemData.type === 'FUNCTION_CALL') {
|
|
63
|
-
openIaInput.push({
|
|
64
|
-
type: 'function_call',
|
|
65
|
-
call_id: itemData.content.id,
|
|
66
|
-
name: itemData.content.name,
|
|
67
|
-
arguments: JSON.stringify(itemData.content.arguments),
|
|
68
|
-
});
|
|
69
|
-
openIaInput.push({
|
|
70
|
-
type: 'function_call_output',
|
|
71
|
-
call_id: itemData.content.id,
|
|
72
|
-
output: itemData.content.result,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return openIaInput;
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
OpenaiChatBotAdapter = __decorate([
|
|
80
|
-
injectable(),
|
|
81
|
-
__metadata("design:paramtypes", [MindsetOperator])
|
|
82
|
-
], OpenaiChatBotAdapter);
|
|
83
|
-
|
|
84
|
-
export { OpenaiChatBotAdapter };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import '../../controller/channel/ChatResolver.js';
|
|
2
|
-
import '../../controller/channel/UserResolver.js';
|
|
3
|
-
import { container } from '../../injection/index.js';
|
|
4
|
-
import { ControllerMetadataStore } from '../../controller/metadata/ControllerMetadataStore.js';
|
|
5
|
-
import { CmdChannel } from './CmdChannel.js';
|
|
6
|
-
|
|
7
|
-
function cmd() {
|
|
8
|
-
return function (target, propertyKey) {
|
|
9
|
-
const store = container.resolve(ControllerMetadataStore);
|
|
10
|
-
store.saveChannelMetadata({
|
|
11
|
-
channelConstructor: CmdChannel,
|
|
12
|
-
functionName: propertyKey.toString(),
|
|
13
|
-
controllerConstructor: target.constructor,
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { cmd };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from 'tslib';
|
|
2
|
-
import { singleton } from '../../injection/index.js';
|
|
3
|
-
import { Logger } from '../../logger/Logger.js';
|
|
4
|
-
import { io } from 'socket.io-client';
|
|
5
|
-
import { devEmitEvent } from './WabotDevSocketContracts.js';
|
|
6
|
-
|
|
7
|
-
var WabotDevConnection_1;
|
|
8
|
-
let WabotDevConnection = WabotDevConnection_1 = class WabotDevConnection {
|
|
9
|
-
devProxy;
|
|
10
|
-
devProxySocket = null;
|
|
11
|
-
devToken;
|
|
12
|
-
logger = new Logger('wabot:dev-connection');
|
|
13
|
-
static isTokenAvailable() {
|
|
14
|
-
return !!process.env.WABOT_DEV_TOKEN;
|
|
15
|
-
}
|
|
16
|
-
constructor() {
|
|
17
|
-
if (!WabotDevConnection_1.isTokenAvailable()) {
|
|
18
|
-
throw new Error('WABOT_DEV_TOKEN is not set in environment variables');
|
|
19
|
-
}
|
|
20
|
-
this.devToken = process.env.WABOT_DEV_TOKEN;
|
|
21
|
-
this.devProxy = process.env.WABOT_DEV_PROXY ?? 'https://proxy.wabot.dev';
|
|
22
|
-
}
|
|
23
|
-
async getSocket() {
|
|
24
|
-
if (this.devProxySocket) {
|
|
25
|
-
return this.devProxySocket;
|
|
26
|
-
}
|
|
27
|
-
return new Promise((resolve, reject) => {
|
|
28
|
-
const devProxySocket = io(this.devProxy, { autoConnect: false });
|
|
29
|
-
devProxySocket.on('connect', async () => {
|
|
30
|
-
try {
|
|
31
|
-
const req = {
|
|
32
|
-
token: this.devToken,
|
|
33
|
-
};
|
|
34
|
-
this.logger.debug('dev connection request');
|
|
35
|
-
const ack = await devProxySocket.emitWithAck(devEmitEvent.DEV_CONNECTION, req);
|
|
36
|
-
if (ack != 'OK') {
|
|
37
|
-
return reject(new Error('Dev connection failed'));
|
|
38
|
-
}
|
|
39
|
-
this.logger.debug('success dev connection');
|
|
40
|
-
this.devProxySocket = devProxySocket;
|
|
41
|
-
resolve(devProxySocket);
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
this.logger.error(err);
|
|
45
|
-
reject(err);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
devProxySocket.connect();
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
WabotDevConnection = WabotDevConnection_1 = __decorate([
|
|
53
|
-
singleton(),
|
|
54
|
-
__metadata("design:paramtypes", [])
|
|
55
|
-
], WabotDevConnection);
|
|
56
|
-
|
|
57
|
-
export { WabotDevConnection };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
const devListentEvent = {
|
|
2
|
-
DEV_WATSAPP_WEBHOOK: 'dev-whatsapp-webhook',
|
|
3
|
-
};
|
|
4
|
-
const devEmitEvent = {
|
|
5
|
-
DEV_CONNECTION: 'dev-connection',
|
|
6
|
-
DEV_SEND_WHATSAPP: 'dev-send-whatsapp',
|
|
7
|
-
DEV_SEND_WHATSAPP_TEMPLATE: 'dev-send-whatsapp-template',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export { devEmitEvent, devListentEvent };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { container } from '../../injection/index.js';
|
|
2
|
-
import { WhatsappChannelConfig } from './WhatsAppChannelConfig.js';
|
|
3
|
-
import '../../controller/channel/ChatResolver.js';
|
|
4
|
-
import '../../controller/channel/UserResolver.js';
|
|
5
|
-
import { ControllerMetadataStore } from '../../controller/metadata/ControllerMetadataStore.js';
|
|
6
|
-
import { WhatsAppChannel } from './WhatsAppChannel.js';
|
|
7
|
-
|
|
8
|
-
function whatsapp(config) {
|
|
9
|
-
return function (target, propertyKey) {
|
|
10
|
-
const store = container.resolve(ControllerMetadataStore);
|
|
11
|
-
store.saveChannelMetadata({
|
|
12
|
-
channelConstructor: WhatsAppChannel,
|
|
13
|
-
functionName: propertyKey.toString(),
|
|
14
|
-
controllerConstructor: target.constructor,
|
|
15
|
-
channelConfig: new WhatsappChannelConfig(config.number),
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { whatsapp };
|