@wabot-dev/framework 0.4.0-beta.6 → 0.4.0-beta.8

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.
@@ -6,6 +6,12 @@ import { singleton } from '../../../core/injection/index.js';
6
6
  let RamChatRepository = class RamChatRepository {
7
7
  items = [];
8
8
  memories = [];
9
+ async update(chat) {
10
+ if (!chat.wasCreated()) {
11
+ throw new Error('Chat wat not created');
12
+ }
13
+ chat.validate();
14
+ }
9
15
  async create(chat) {
10
16
  if (chat.wasCreated()) {
11
17
  throw new Error('Chat already created');
@@ -20,7 +20,7 @@ let WhatsAppReceiverByWabotProxy = class WhatsAppReceiverByWabotProxy extends Wh
20
20
  const req = {
21
21
  event: 'listenMessage',
22
22
  data: {
23
- to: [request.to],
23
+ to: request.to,
24
24
  },
25
25
  };
26
26
  const response = await socket.emitWithAck(req.event, req.data);
@@ -31,7 +31,7 @@ let WhatsAppReceiverByWabotProxy = class WhatsAppReceiverByWabotProxy extends Wh
31
31
  else if (!response ||
32
32
  typeof response !== 'object' ||
33
33
  !Array.isArray(response.from) ||
34
- !Array.isArray(response.to)) {
34
+ typeof response.to !== 'string') {
35
35
  this.loger.error('unknown response');
36
36
  return;
37
37
  }
@@ -2,6 +2,9 @@ class ChatRepository {
2
2
  create(chat) {
3
3
  throw new Error('Method not implemented.');
4
4
  }
5
+ update(chat) {
6
+ throw new Error('Method not implemented.');
7
+ }
5
8
  findByConnection(query) {
6
9
  throw new Error('Method not implemented.');
7
10
  }
@@ -848,12 +848,14 @@ declare class ChatBot implements IChatBot {
848
848
 
849
849
  interface IChatRepository {
850
850
  create(chat: Chat): Promise<void>;
851
+ update(chat: Chat): Promise<void>;
851
852
  findByConnection(query: IChatConnection): Promise<Chat | null>;
852
853
  findMemory(chatId: string): Promise<IChatMemory | null>;
853
854
  }
854
855
 
855
856
  declare class ChatRepository implements IChatRepository {
856
857
  create(chat: Chat): Promise<void>;
858
+ update(chat: Chat): Promise<void>;
857
859
  findByConnection(query: IChatConnection): Promise<Chat | null>;
858
860
  findMemory(chatId: string): Promise<IChatMemory | null>;
859
861
  }
@@ -1480,6 +1482,7 @@ declare class RamChatMemory implements IChatMemory {
1480
1482
  declare class RamChatRepository implements IChatRepository {
1481
1483
  private items;
1482
1484
  private memories;
1485
+ update(chat: Chat): Promise<void>;
1483
1486
  create(chat: Chat): Promise<void>;
1484
1487
  findByConnection(query: IChatConnection): Promise<Chat | null>;
1485
1488
  findMemory(chatId: string): Promise<IChatMemory | null>;
@@ -1821,7 +1824,7 @@ interface IWhatsAppProxyListenMessageEventReq {
1821
1824
  }
1822
1825
  interface IWhatsAppProxyListenMessageEventData {
1823
1826
  from?: string[];
1824
- to: string[];
1827
+ to: string;
1825
1828
  }
1826
1829
  declare const WHATSAPP_MESSAGE_EVENT: "message";
1827
1830
  interface IWhatsAppProxyMessageEventReq {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wabot-dev/framework",
3
- "version": "0.4.0-beta.6",
3
+ "version": "0.4.0-beta.8",
4
4
  "description": "Framework for IA Chat Bots",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",