@wabot-dev/framework 0.6.0 → 0.7.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.
@@ -3,6 +3,7 @@ import { Env } from '../../../core/env/Env.js';
3
3
  import { singleton } from '../../../core/injection/index.js';
4
4
  import { Logger } from '../../../core/logger/Logger.js';
5
5
  import '../../../feature/chat-bot/ChatBot.js';
6
+ import '../../../feature/chat-bot/ChatOperator.js';
6
7
  import 'uuid';
7
8
  import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
8
9
  import { safeJsonParse } from '../../../feature/chat-bot/safeJsonParse.js';
@@ -1,5 +1,6 @@
1
1
  import { Logger } from '../../../core/logger/Logger.js';
2
2
  import '../../../feature/chat-bot/ChatBot.js';
3
+ import '../../../feature/chat-bot/ChatOperator.js';
3
4
  import '../../../core/injection/index.js';
4
5
  import 'uuid';
5
6
  import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
@@ -4,6 +4,7 @@ import { singleton } from '../../../core/injection/index.js';
4
4
  import { Logger } from '../../../core/logger/Logger.js';
5
5
  import { Random } from '../../../core/random/Random.js';
6
6
  import '../../../feature/chat-bot/ChatBot.js';
7
+ import '../../../feature/chat-bot/ChatOperator.js';
7
8
  import 'uuid';
8
9
  import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
9
10
  import { safeJsonParse } from '../../../feature/chat-bot/safeJsonParse.js';
@@ -1,5 +1,6 @@
1
1
  import { __decorate } from 'tslib';
2
2
  import '../../../feature/chat-bot/ChatBot.js';
3
+ import '../../../feature/chat-bot/ChatOperator.js';
3
4
  import { singleton } from '../../../core/injection/index.js';
4
5
  import 'uuid';
5
6
  import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
@@ -3,6 +3,7 @@ import { Env } from '../../../core/env/Env.js';
3
3
  import { singleton } from '../../../core/injection/index.js';
4
4
  import { Logger } from '../../../core/logger/Logger.js';
5
5
  import '../../../feature/chat-bot/ChatBot.js';
6
+ import '../../../feature/chat-bot/ChatOperator.js';
6
7
  import 'uuid';
7
8
  import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
8
9
  import '../../../core/error/setupErrorHandlers.js';
@@ -6,6 +6,7 @@ import '../../../feature/pg/withPgClient.js';
6
6
  import '../../../feature/pg/pgStorage.js';
7
7
  import '../../../feature/chat-bot/ChatBot.js';
8
8
  import { ChatItem } from '../../../feature/chat-bot/ChatItem.js';
9
+ import '../../../feature/chat-bot/ChatOperator.js';
9
10
  import '../../../core/injection/index.js';
10
11
  import 'uuid';
11
12
  import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
@@ -10,6 +10,7 @@ import '../../../feature/pg/withPgClient.js';
10
10
  import '../../../feature/pg/pgStorage.js';
11
11
  import { Chat } from '../../../feature/chat-bot/Chat.js';
12
12
  import '../../../feature/chat-bot/ChatBot.js';
13
+ import { ChatOperator } from '../../../feature/chat-bot/ChatOperator.js';
13
14
  import 'uuid';
14
15
  import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
15
16
  import '../../../core/error/setupErrorHandlers.js';
@@ -25,7 +26,7 @@ let PgChatRepository = class PgChatRepository extends PgCrudRepository {
25
26
  async findByConnection(query) {
26
27
  const sql = `
27
28
  SELECT ${this.columns}
28
- FROM ${this.table}
29
+ FROM ${this.table}
29
30
  WHERE data->'connections' @> $1::jsonb
30
31
  LIMIT 1
31
32
  `;
@@ -35,6 +36,13 @@ let PgChatRepository = class PgChatRepository extends PgCrudRepository {
35
36
  async findMemory(chatId) {
36
37
  return new PgChatMemory(this.pool, chatId);
37
38
  }
39
+ async findOperator(chatId) {
40
+ const chat = await this.find(chatId);
41
+ if (!chat)
42
+ return null;
43
+ const memory = new PgChatMemory(this.pool, chatId);
44
+ return new ChatOperator(chat, memory, this);
45
+ }
38
46
  };
39
47
  PgChatRepository = __decorate([
40
48
  singleton(),
@@ -2,6 +2,10 @@ import { __decorate } from 'tslib';
2
2
  import { v4 } from 'uuid';
3
3
  import { RamChatMemory } from './RamChatMemory.js';
4
4
  import { singleton } from '../../../core/injection/index.js';
5
+ import '../../../feature/chat-bot/ChatBot.js';
6
+ import { ChatOperator } from '../../../feature/chat-bot/ChatOperator.js';
7
+ import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
8
+ import '../../../core/error/setupErrorHandlers.js';
5
9
 
6
10
  let RamChatRepository = class RamChatRepository {
7
11
  items = [];
@@ -36,6 +40,15 @@ let RamChatRepository = class RamChatRepository {
36
40
  }
37
41
  return Promise.resolve(memory.memory);
38
42
  }
43
+ async findOperator(chatId) {
44
+ const chat = this.items.find((item) => item.id === chatId) ?? null;
45
+ if (!chat)
46
+ return null;
47
+ const memory = this.getMemory(chatId);
48
+ if (!memory)
49
+ return null;
50
+ return new ChatOperator(chat, memory.memory, this);
51
+ }
39
52
  getMemory(chatId) {
40
53
  return this.memories.find((r) => r.chatId === chatId) ?? null;
41
54
  }
@@ -1,5 +1,6 @@
1
1
  import '../../../feature/chat-bot/ChatBot.js';
2
2
  import { ChatItem } from '../../../feature/chat-bot/ChatItem.js';
3
+ import '../../../feature/chat-bot/ChatOperator.js';
3
4
  import '../../../core/injection/index.js';
4
5
  import 'uuid';
5
6
  import '../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
@@ -6,6 +6,7 @@ import '../../../../feature/chat-controller/metadata/ControllerMetadataStore.js'
6
6
  import { ChatResolver } from '../../../../feature/chat-controller/ChatResolver.js';
7
7
  import '../../../../feature/chat-controller/runChatControllers.js';
8
8
  import '../../../../feature/chat-bot/ChatBot.js';
9
+ import '../../../../feature/chat-bot/ChatOperator.js';
9
10
  import { ChatRepository } from '../../../../feature/chat-bot/ChatRepository.js';
10
11
  import 'uuid';
11
12
  import '../../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
@@ -3,6 +3,7 @@ import { WhatsAppSender } from '../WhatsAppSender.js';
3
3
  import { singleton } from '../../../../core/injection/index.js';
4
4
  import { Logger } from '../../../../core/logger/Logger.js';
5
5
  import '../../../../feature/chat-bot/ChatBot.js';
6
+ import '../../../../feature/chat-bot/ChatOperator.js';
6
7
  import { ChatRepository } from '../../../../feature/chat-bot/ChatRepository.js';
7
8
  import 'uuid';
8
9
  import '../../../../feature/chat-bot/metadata/ChatBotMetadataStore.js';
@@ -33,20 +33,40 @@ class Chat extends Entity {
33
33
  }
34
34
  this.data.connections.push(connection);
35
35
  }
36
- hasAssociation(type, id) {
37
- return this.data.associations?.some((a) => a.type === type && a.id === id) ?? false;
36
+ removeConnection(connection) {
37
+ const index = this.data.connections.findIndex((c) => c.channelName === connection.channelName && c.id === connection.id);
38
+ if (index === -1) {
39
+ throw new Error('Connection does not exist');
40
+ }
41
+ this.data.connections.splice(index, 1);
42
+ }
43
+ hasAssociation(association) {
44
+ return this.data.associations?.some((a) => a.type === association.type && a.id === association.id) ?? false;
45
+ }
46
+ hasAssociations(type) {
47
+ return this.data.associations?.some((a) => a.type === type) ?? false;
38
48
  }
39
49
  getAssociationsByType(type) {
40
50
  return this.data.associations?.filter((a) => a.type === type) ?? [];
41
51
  }
42
52
  addAssociation(association) {
43
- if (this.hasAssociation(association.type, association.id)) {
53
+ if (this.hasAssociation(association)) {
44
54
  throw new Error('Association already exists');
45
55
  }
46
56
  if (!this.data.associations)
47
57
  this.data.associations = [];
48
58
  this.data.associations.push(association);
49
59
  }
60
+ removeAssociation(association) {
61
+ if (!this.data.associations) {
62
+ throw new Error('Association does not exist');
63
+ }
64
+ const index = this.data.associations.findIndex((a) => a.type === association.type && a.id === association.id);
65
+ if (index === -1) {
66
+ throw new Error('Association does not exist');
67
+ }
68
+ this.data.associations.splice(index, 1);
69
+ }
50
70
  validatePrivateChat() {
51
71
  if (this.data.connections.length < 1) {
52
72
  throw new Error('PRIVATE chat should have one or more connections');
@@ -0,0 +1,65 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { injectable } from '../../core/injection/index.js';
3
+ import { Chat } from './Chat.js';
4
+ import { ChatItem } from './ChatItem.js';
5
+ import { ChatMemory } from './ChatMemory.js';
6
+ import { ChatRepository } from './ChatRepository.js';
7
+
8
+ let ChatOperator = class ChatOperator {
9
+ chat;
10
+ memory;
11
+ repository;
12
+ constructor(chat, memory, repository) {
13
+ this.chat = chat;
14
+ this.memory = memory;
15
+ this.repository = repository;
16
+ }
17
+ async saveHumanMessage(message) {
18
+ const item = new ChatItem({ type: 'humanMessage', humanMessage: message });
19
+ await this.memory.create(item);
20
+ return item;
21
+ }
22
+ async saveBotMessage(message) {
23
+ const item = new ChatItem({ type: 'botMessage', botMessage: message });
24
+ await this.memory.create(item);
25
+ return item;
26
+ }
27
+ getConnections() {
28
+ return this.chat.connections;
29
+ }
30
+ async addConnection(connection) {
31
+ this.chat.addConnection(connection);
32
+ await this.repository.update(this.chat);
33
+ }
34
+ async removeConnection(connection) {
35
+ this.chat.removeConnection(connection);
36
+ await this.repository.update(this.chat);
37
+ }
38
+ hasAssociations(type) {
39
+ return this.chat.hasAssociations(type);
40
+ }
41
+ hasAssociation(association) {
42
+ return this.chat.hasAssociation(association);
43
+ }
44
+ findAssociations(type) {
45
+ if (type === undefined)
46
+ return this.chat.associations;
47
+ return this.chat.getAssociationsByType(type);
48
+ }
49
+ async addAssociation(association) {
50
+ this.chat.addAssociation(association);
51
+ await this.repository.update(this.chat);
52
+ }
53
+ async removeAssociation(association) {
54
+ this.chat.removeAssociation(association);
55
+ await this.repository.update(this.chat);
56
+ }
57
+ };
58
+ ChatOperator = __decorate([
59
+ injectable(),
60
+ __metadata("design:paramtypes", [Chat,
61
+ ChatMemory,
62
+ ChatRepository])
63
+ ], ChatOperator);
64
+
65
+ export { ChatOperator };
@@ -11,6 +11,9 @@ class ChatRepository {
11
11
  findMemory(chatId) {
12
12
  throw new Error('Method not implemented.');
13
13
  }
14
+ findOperator(chatId) {
15
+ throw new Error('Method not implemented.');
16
+ }
14
17
  }
15
18
 
16
19
  export { ChatRepository };
@@ -1,6 +1,7 @@
1
1
  import { __decorate, __metadata } from 'tslib';
2
2
  import { Chat } from '../chat-bot/Chat.js';
3
3
  import '../chat-bot/ChatBot.js';
4
+ import '../chat-bot/ChatOperator.js';
4
5
  import { ChatRepository } from '../chat-bot/ChatRepository.js';
5
6
  import { injectable } from '../../core/injection/index.js';
6
7
  import 'uuid';
@@ -4,6 +4,7 @@ import { Logger } from '../../core/logger/Logger.js';
4
4
  import { Chat } from '../chat-bot/Chat.js';
5
5
  import { ChatBot } from '../chat-bot/ChatBot.js';
6
6
  import { ChatMemory } from '../chat-bot/ChatMemory.js';
7
+ import '../chat-bot/ChatOperator.js';
7
8
  import { ChatRepository } from '../chat-bot/ChatRepository.js';
8
9
  import 'uuid';
9
10
  import { ChatBotMetadataStore } from '../chat-bot/metadata/ChatBotMetadataStore.js';
@@ -678,12 +678,15 @@ declare class Chat extends Entity<IChatData> {
678
678
  id: string;
679
679
  } | null;
680
680
  addConnection(connection: IChatConnection): void;
681
- hasAssociation(type: string, id: string): boolean;
681
+ removeConnection(connection: IChatConnection): void;
682
+ hasAssociation(association: IChatAssociation): boolean;
683
+ hasAssociations(type: string): boolean;
682
684
  getAssociationsByType(type: string): {
683
685
  type: string;
684
686
  id: string;
685
687
  }[];
686
688
  addAssociation(association: IChatAssociation): void;
689
+ removeAssociation(association: IChatAssociation): void;
687
690
  private validatePrivateChat;
688
691
  private validateGroupChat;
689
692
  validate(): void;
@@ -944,6 +947,7 @@ interface IChatRepository {
944
947
  update(chat: Chat): Promise<void>;
945
948
  findByConnection(query: IChatConnection): Promise<Chat | null>;
946
949
  findMemory(chatId: string): Promise<IChatMemory | null>;
950
+ findOperator(chatId: string): Promise<ChatOperator | null>;
947
951
  }
948
952
 
949
953
  declare class ChatRepository implements IChatRepository {
@@ -951,6 +955,24 @@ declare class ChatRepository implements IChatRepository {
951
955
  update(chat: Chat): Promise<void>;
952
956
  findByConnection(query: IChatConnection): Promise<Chat | null>;
953
957
  findMemory(chatId: string): Promise<IChatMemory | null>;
958
+ findOperator(chatId: string): Promise<ChatOperator | null>;
959
+ }
960
+
961
+ declare class ChatOperator {
962
+ private chat;
963
+ private memory;
964
+ private repository;
965
+ constructor(chat: Chat, memory: ChatMemory, repository: ChatRepository);
966
+ saveHumanMessage(message: IChatMessage): Promise<ChatItem>;
967
+ saveBotMessage(message: IChatMessage): Promise<ChatItem>;
968
+ getConnections(): IChatConnection[];
969
+ addConnection(connection: IChatConnection): Promise<void>;
970
+ removeConnection(connection: IChatConnection): Promise<void>;
971
+ hasAssociations(type: string): boolean;
972
+ hasAssociation(association: IChatAssociation): boolean;
973
+ findAssociations(type?: string): IChatAssociation[];
974
+ addAssociation(association: IChatAssociation): Promise<void>;
975
+ removeAssociation(association: IChatAssociation): Promise<void>;
954
976
  }
955
977
 
956
978
  declare function chatBot(mindset: IConstructor<IMindset>): (target: object, propertyKey: string | symbol | undefined, parameterIndex: number) => void;
@@ -1593,6 +1615,7 @@ declare class PgChatRepository extends PgCrudRepository<Chat> implements IChatRe
1593
1615
  constructor(pool: Pool);
1594
1616
  findByConnection(query: IChatConnection): Promise<Chat | null>;
1595
1617
  findMemory(chatId: string): Promise<IChatMemory | null>;
1618
+ findOperator(chatId: string): Promise<ChatOperator | null>;
1596
1619
  }
1597
1620
 
1598
1621
  declare class PgChatMemory extends PgCrudRepository<ChatItem> implements IChatMemory {
@@ -1615,6 +1638,7 @@ declare class RamChatRepository implements IChatRepository {
1615
1638
  create(chat: Chat): Promise<void>;
1616
1639
  findByConnection(query: IChatConnection): Promise<Chat | null>;
1617
1640
  findMemory(chatId: string): Promise<IChatMemory | null>;
1641
+ findOperator(chatId: string): Promise<ChatOperator | null>;
1618
1642
  private getMemory;
1619
1643
  }
1620
1644
 
@@ -2193,4 +2217,4 @@ declare function HtmlModule(options: IHtmlModuleOptions): {
2193
2217
  new (): {};
2194
2218
  };
2195
2219
 
2196
- export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, AsyncMetadataStore, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, type ClientMap, CmdChannel, Container, ControllerMetadataStore, CronJob, CronJobRepository, CustomError, DeepSeekChatAdapter, DescriptionMetadataStore, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, type ErrorSeverity, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemsReq, type IChatAdapterNextItemsRes, type IChatAssociation, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatMessageDocument, type IChatMessageFile, type IChatMessageImage, type IChatMessagesPrivateFile, type IChatMessagesPublicFile, type IChatRepository, type IChatType, type ICmdChannelMessage, type ICmdReceivedMessage, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICronConfig, type ICronJobData, type ICrudRepository, type ICustomErrorData, type IDescriptionMetadata, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IErrorHandlersConfig, type IErrorMonitor, type IErrorMonitorContext, type IExtractChatMessageTextOptions, type IFunctionCall, type IFunctionCallItem, type IGenerateApiKeyReq, type IGenerateApiKeyRes, type IGetWhatsAppTemplateRequest, type IHandshakeMiddleware, type IHandshakeMiddlewareMetadata, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type IListenWhatsAppMessageRequest, type ILockKey, type ILocker, type ILockerKey, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetConfig, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleMetadata, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IPersistentData, type IPgRepositoryConfig, type IPropertyValidatorInfo, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRestControllerConfig, type IRestControllerMetadata, type IScheduleAt, type IScheduleDelay, type ISendByWasenderRequest, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelMessage, type ISocketChannelReceivedMessage, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type ISocketReceivedMessage, type IStorableData, type ITelegramChannelConfig, type ITelegramChannelMessage, type ITelegramReceivedMessage, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateIsRecordOptions, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWasenderChannelMessageListener, type IWasenderDeviceListMetadata, type IWasenderEvent, type IWasenderMessageContent, type IWasenderMessageContextInfo, type IWasenderMessageKey, type IWasenderMessageReceivedData, type IWasenderMessageReceivedEvent, type IWasenderQrUpdatedEvent, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppByWasenderChannelConfig, type IWhatsAppByWasenderReceivedMessage, type IWhatsAppChannelMessage, 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 IWhatsAppReceivedMessage, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsappChannelConfig, type IchatControllerConfig, Job, JobRepository, JobRunner, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtGuardMiddleware, JwtHandshakeGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Locker, Logger, Mapper, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenRouterChatAdapter, OpenaiChatAdapter, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCronJobRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgLockKey, PgLocker, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RemoteApiKeyRepository, RestControllerMetadataStore, RestRequest, SocketChannel, SocketChannelConfig, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerConfig, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WasenderWebhookController, WhatsApp, WhatsAppByWasenderChannel, WhatsAppByWasenderChannelConfig, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppReceiverByWasender, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppSenderByWasender, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, apiKeyHandshakeGuard, chatBot, chatController, chatItemTypeOptions, cmd, cmdChannelName, command, commandHandler, container, cron, description, errorToPlainObject, extractChatMessageText, extractNumberFromWasenderMessageKey, getClientMap, getPgClient, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isChatMessageEmpty, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isRecord, isString, jwtGuard, jwtHandshakeGuard, max, middleware, min, mindset, mindsetModule, modelInfo, onDelete, onGet, onPost, onPut, onSocketEvent, pgStorage, readJsonFromFile, restController, runChatControllers, runCommandHandlers, runCronHandlers, runRestControllers, runSocketControllers, safeJsonParse, scoped, setupErrorHandlers, singleton, socket, socketChannelName, socketController, stopCommandHandlers, stopCronHandlers, telegram, telegramChannelName, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsRecord, validateIsString, validateMax, validateMin, validateModel, whatsApp, whatsAppByWasender, whatsAppByWasenderChannelName, whatsAppChannelName, withPgClient, withPgTransaction, writeJsonToFile };
2220
+ export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, AsyncMetadataStore, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatOperator, ChatRepository, ChatResolver, type ClientMap, CmdChannel, Container, ControllerMetadataStore, CronJob, CronJobRepository, CustomError, DeepSeekChatAdapter, DescriptionMetadataStore, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, type ErrorSeverity, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemsReq, type IChatAdapterNextItemsRes, type IChatAssociation, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatMessageDocument, type IChatMessageFile, type IChatMessageImage, type IChatMessagesPrivateFile, type IChatMessagesPublicFile, type IChatRepository, type IChatType, type ICmdChannelMessage, type ICmdReceivedMessage, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICronConfig, type ICronJobData, type ICrudRepository, type ICustomErrorData, type IDescriptionMetadata, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IErrorHandlersConfig, type IErrorMonitor, type IErrorMonitorContext, type IExtractChatMessageTextOptions, type IFunctionCall, type IFunctionCallItem, type IGenerateApiKeyReq, type IGenerateApiKeyRes, type IGetWhatsAppTemplateRequest, type IHandshakeMiddleware, type IHandshakeMiddlewareMetadata, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type IListenWhatsAppMessageRequest, type ILockKey, type ILocker, type ILockerKey, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetConfig, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleMetadata, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IPersistentData, type IPgRepositoryConfig, type IPropertyValidatorInfo, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRestControllerConfig, type IRestControllerMetadata, type IScheduleAt, type IScheduleDelay, type ISendByWasenderRequest, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelMessage, type ISocketChannelReceivedMessage, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type ISocketReceivedMessage, type IStorableData, type ITelegramChannelConfig, type ITelegramChannelMessage, type ITelegramReceivedMessage, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateIsRecordOptions, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWasenderChannelMessageListener, type IWasenderDeviceListMetadata, type IWasenderEvent, type IWasenderMessageContent, type IWasenderMessageContextInfo, type IWasenderMessageKey, type IWasenderMessageReceivedData, type IWasenderMessageReceivedEvent, type IWasenderQrUpdatedEvent, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppByWasenderChannelConfig, type IWhatsAppByWasenderReceivedMessage, type IWhatsAppChannelMessage, 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 IWhatsAppReceivedMessage, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsappChannelConfig, type IchatControllerConfig, Job, JobRepository, JobRunner, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtGuardMiddleware, JwtHandshakeGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Locker, Logger, Mapper, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenRouterChatAdapter, OpenaiChatAdapter, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCronJobRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgLockKey, PgLocker, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RemoteApiKeyRepository, RestControllerMetadataStore, RestRequest, SocketChannel, SocketChannelConfig, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerConfig, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WasenderWebhookController, WhatsApp, WhatsAppByWasenderChannel, WhatsAppByWasenderChannelConfig, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppReceiverByWasender, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppSenderByWasender, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, apiKeyHandshakeGuard, chatBot, chatController, chatItemTypeOptions, cmd, cmdChannelName, command, commandHandler, container, cron, description, errorToPlainObject, extractChatMessageText, extractNumberFromWasenderMessageKey, getClientMap, getPgClient, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isChatMessageEmpty, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isRecord, isString, jwtGuard, jwtHandshakeGuard, max, middleware, min, mindset, mindsetModule, modelInfo, onDelete, onGet, onPost, onPut, onSocketEvent, pgStorage, readJsonFromFile, restController, runChatControllers, runCommandHandlers, runCronHandlers, runRestControllers, runSocketControllers, safeJsonParse, scoped, setupErrorHandlers, singleton, socket, socketChannelName, socketController, stopCommandHandlers, stopCronHandlers, telegram, telegramChannelName, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsRecord, validateIsString, validateMax, validateMin, validateModel, whatsApp, whatsAppByWasender, whatsAppByWasenderChannelName, whatsAppChannelName, withPgClient, withPgTransaction, writeJsonToFile };
package/dist/src/index.js CHANGED
@@ -57,6 +57,7 @@ export { ChatAdapter } from './feature/chat-bot/ChatAdapter.js';
57
57
  export { ChatBot } from './feature/chat-bot/ChatBot.js';
58
58
  export { ChatItem } from './feature/chat-bot/ChatItem.js';
59
59
  export { ChatMemory } from './feature/chat-bot/ChatMemory.js';
60
+ export { ChatOperator } from './feature/chat-bot/ChatOperator.js';
60
61
  export { ChatRepository } from './feature/chat-bot/ChatRepository.js';
61
62
  export { chatItemTypeOptions } from './feature/chat-bot/IChatItem.js';
62
63
  export { chatBot } from './feature/chat-bot/metadata/@chatBot.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wabot-dev/framework",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "Framework for IA Chat Bots",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -35,7 +35,7 @@
35
35
  "prettier": "^3.5.3",
36
36
  "rollup": "^4.60.0",
37
37
  "tsup": "^8.4.0",
38
- "typescript": "5.8.3"
38
+ "typescript": "^6.0.3"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@anthropic-ai/sdk": "^0.60.0",