@wabot-dev/framework 0.1.0-beta.2 → 0.1.0-beta.21
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/ai/claude/ClaudeChatBotAdapter.js +113 -0
- package/dist/src/ai/deepseek/DeepSeekChatBotAdapter.js +12 -13
- package/dist/src/ai/openia/OpenaiChatBotAdapter.js +9 -7
- package/dist/src/channels/cmd/@cmd.js +0 -4
- package/dist/src/channels/cmd/CmdChannel.js +0 -4
- package/dist/src/channels/express/ExpressProvider.js +46 -0
- package/dist/src/channels/http/HttpServerProvider.js +31 -0
- package/dist/src/channels/{socket-io → socket}/@socket.js +0 -4
- package/dist/src/channels/{socket-io → socket}/SocketChannel.js +12 -11
- package/dist/src/channels/socket/SocketServerProvider.js +50 -0
- package/dist/src/channels/telegram/@telegram.js +0 -4
- package/dist/src/channels/telegram/TelegramChannel.js +0 -4
- package/dist/src/channels/wabot/WabotDevConnection.js +57 -0
- package/dist/src/channels/{whatsapp/WhatsAppDevSocketContracts.js → wabot/WabotDevSocketContracts.js} +3 -3
- package/dist/src/channels/whatsapp/@whatsapp.js +0 -4
- package/dist/src/channels/whatsapp/EnvWhatsAppRepository.js +49 -0
- package/dist/src/channels/whatsapp/PgWhatsAppRepository.js +41 -0
- package/dist/src/channels/whatsapp/WhatsApp.js +32 -0
- package/dist/src/channels/whatsapp/WhatsAppChannel.js +33 -32
- package/dist/src/channels/whatsapp/{WhatsAppConnection.js → WhatsAppReceiver.js} +4 -6
- package/dist/src/channels/whatsapp/WhatsAppReceiverByDevConnection.js +32 -0
- package/dist/src/channels/whatsapp/WhatsAppReceiverByWebHook.js +63 -0
- package/dist/src/channels/whatsapp/WhatsAppRepository.js +10 -0
- package/dist/src/channels/whatsapp/WhatsAppSender.js +107 -20
- package/dist/src/channels/whatsapp/WhatsAppSenderByCloudApi.js +118 -0
- package/dist/src/channels/whatsapp/WhatsAppSenderByDevConnection.js +56 -0
- package/dist/src/chatbot/ChatBotAdapter.js +1 -5
- package/dist/src/chatbot/metadata/@chatBot.js +0 -5
- package/dist/src/chatbot/metadata/ChatBotMetadataStore.js +0 -5
- package/dist/src/controller/metadata/ControllerMetadataStore.js +0 -2
- package/dist/src/controller/metadata/controller/@chatController.js +0 -2
- package/dist/src/core/{Persistent.js → Entity.js} +24 -9
- package/dist/src/core/IMessageContext.js +0 -2
- package/dist/src/core/Storable.js +8 -0
- package/dist/src/core/chat/Chat.js +2 -2
- package/dist/src/core/chat/ChatItem.js +2 -2
- package/dist/src/core/user/User.js +2 -2
- package/dist/src/env/Env.js +39 -0
- package/dist/src/error/CustomError.js +15 -0
- package/dist/src/index.d.ts +539 -240
- package/dist/src/index.js +65 -34
- package/dist/src/mindset/MindsetOperator.js +1 -3
- package/dist/src/mindset/metadata/MindsetMetadataStore.js +0 -2
- package/dist/src/mindset/metadata/mindsets/@mindset.js +0 -2
- package/dist/src/mindset/metadata/modules/@mindsetModule.js +0 -2
- package/dist/src/pre-made/module/authentication/requests/SendOneTimePasswordRequest.js +0 -2
- package/dist/src/pre-made/module/authentication/requests/ValidateOneTimePasswordRequest.js +0 -2
- package/dist/src/pre-made/module/html/HtmlModule.js +70 -0
- package/dist/src/pre-made/module/register-user/requests/RegisterUserWithEmailRequest.js +0 -2
- package/dist/src/pre-made/repository/chat/pg/PgChatMemory.js +1 -7
- package/dist/src/pre-made/repository/chat/pg/PgChatRepository.js +0 -5
- package/dist/src/pre-made/repository/chat/ram/RamChatRepository.js +1 -1
- package/dist/src/pre-made/repository/user/pg/PgUserRepository.js +0 -5
- package/dist/src/repository/pg/PgCrudRepository.js +13 -3
- package/dist/src/repository/pg/PgRepositoryBase.js +2 -2
- package/dist/src/rest-controller/metadata/@get.js +19 -0
- package/dist/src/rest-controller/metadata/@middleware.js +16 -0
- package/dist/src/rest-controller/metadata/@post.js +19 -0
- package/dist/src/rest-controller/metadata/@restController.js +15 -0
- package/dist/src/rest-controller/metadata/RestControllerMetadataStore.js +50 -0
- package/dist/src/rest-controller/runRestControllers.js +93 -0
- package/dist/src/server/prepareChatContainer.js +6 -6
- package/dist/src/server/runChannel.js +2 -10
- package/dist/src/server/runServer.js +0 -43
- package/dist/src/validation/metadata/@isBoolean.js +17 -0
- package/dist/src/validation/metadata/@isDate.js +17 -0
- package/dist/src/validation/metadata/@isModel.js +18 -0
- package/dist/src/validation/metadata/@isNotEmpty.js +17 -0
- package/dist/src/validation/metadata/@isNumber.js +17 -0
- package/dist/src/validation/metadata/@isOptional.js +17 -0
- package/dist/src/validation/metadata/@isPresent.js +17 -0
- package/dist/src/validation/metadata/@isString.js +17 -0
- package/dist/src/validation/metadata/@max.js +18 -0
- package/dist/src/validation/metadata/@min.js +18 -0
- package/dist/src/validation/metadata/ValidationMetadataStore.js +70 -0
- package/dist/src/validation/validate.js +11 -0
- package/dist/src/validation/validators/validateIsBoolean.js +12 -0
- package/dist/src/validation/validators/validateIsDate.js +16 -0
- package/dist/src/validation/validators/validateIsNotEmpty.js +12 -0
- package/dist/src/validation/validators/validateIsNumber.js +12 -0
- package/dist/src/validation/validators/validateIsOptional.js +5 -0
- package/dist/src/validation/validators/validateIsPresent.js +12 -0
- package/dist/src/validation/validators/validateIsString.js +12 -0
- package/dist/src/validation/validators/validateMax.js +17 -0
- package/dist/src/validation/validators/validateMin.js +17 -0
- package/dist/src/validation/validators/validateModel.js +34 -0
- package/package.json +5 -6
- package/dist/src/channels/whatsapp/WhatsAppDevConnection.js +0 -69
- package/dist/src/channels/whatsapp/WhatsAppProdConnection.js +0 -39
- package/dist/src/controller/express/Express.js +0 -5
- package/dist/src/controller/socket.io/SocketIO.js +0 -5
- package/dist/src/env/WabotEnv.js +0 -21
- package/dist/src/mindset/metadata/params/@isOptional.js +0 -21
- package/dist/src/pre-made/repository/chat/sqlite/SqliteChatMemory.js +0 -23
- package/dist/src/pre-made/repository/chat/sqlite/SqliteChatRepository.js +0 -30
- package/dist/src/pre-made/repository/user/sqlite/SqliteUserRepository.js +0 -23
- package/dist/src/repository/sqlite/SqliteCrudRepository.js +0 -85
- package/dist/src/repository/sqlite/SqlitePersistentMapper.js +0 -17
- /package/dist/src/channels/{socket-io → socket}/SocketChannelConfig.js +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import { singleton } from 'tsyringe';
|
|
3
|
+
|
|
4
|
+
let Env = class Env {
|
|
5
|
+
envType;
|
|
6
|
+
constructor() {
|
|
7
|
+
this.envType = process.env.WABOT_ENV ?? 'development';
|
|
8
|
+
}
|
|
9
|
+
isDevelopment() {
|
|
10
|
+
return this.envType === 'development';
|
|
11
|
+
}
|
|
12
|
+
isProduction() {
|
|
13
|
+
return this.envType === 'production';
|
|
14
|
+
}
|
|
15
|
+
isTesting() {
|
|
16
|
+
return this.envType === 'testing';
|
|
17
|
+
}
|
|
18
|
+
requireString(varName, options) {
|
|
19
|
+
const value = process.env[varName] ?? options?.default;
|
|
20
|
+
if (!value)
|
|
21
|
+
throw new Error(`Env Variable ${varName} is required`);
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
requireNumber(varName, options) {
|
|
25
|
+
const strValue = this.requireString(varName, {
|
|
26
|
+
default: options?.default != null ? String(options.default) : undefined,
|
|
27
|
+
});
|
|
28
|
+
const value = Number(strValue);
|
|
29
|
+
if (isNaN(value))
|
|
30
|
+
throw new Error(`Env Variable ${varName} should have number format`);
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
Env = __decorate([
|
|
35
|
+
singleton(),
|
|
36
|
+
__metadata("design:paramtypes", [])
|
|
37
|
+
], Env);
|
|
38
|
+
|
|
39
|
+
export { Env };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class CustomError extends Error {
|
|
2
|
+
humanMessage;
|
|
3
|
+
code;
|
|
4
|
+
httpCode;
|
|
5
|
+
info;
|
|
6
|
+
constructor(data) {
|
|
7
|
+
super(data.message, { cause: data.cause });
|
|
8
|
+
this.humanMessage = data.humanMessage;
|
|
9
|
+
this.code = data.code;
|
|
10
|
+
this.httpCode = data.httpCode;
|
|
11
|
+
this.info = data.info;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { CustomError };
|