@arcaelas/whatsapp 1.0.3 → 1.0.4
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/build/index.d.ts +49 -9
- package/build/index.js +1 -1
- package/build/index.js.map +3 -3
- package/build/model/base.d.ts +15 -0
- package/build/model/base.js +15 -0
- package/build/model/base.js.map +1 -1
- package/build/model/chat.d.ts +51 -0
- package/build/model/chat.js +41 -13
- package/build/model/chat.js.map +1 -1
- package/build/model/message.d.ts +64 -1
- package/build/model/message.js +41 -1
- package/build/model/message.js.map +1 -1
- package/build/static/Store.d.ts +15 -53
- package/build/static/Store.js +30 -95
- package/build/static/Store.js.map +1 -1
- package/build/static/useCache.js +2 -1
- package/build/static/useCache.js.map +1 -1
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import Store, { Engine } from './static/Store';
|
|
|
11
11
|
*/
|
|
12
12
|
interface IWhatsAppBase {
|
|
13
13
|
phone: string;
|
|
14
|
-
store
|
|
14
|
+
store: Engine;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* @description Configuración condicional según tipo de login.
|
|
@@ -23,6 +23,10 @@ type IWhatsApp<T extends 'qr' | 'code'> = IWhatsAppBase & {
|
|
|
23
23
|
} : {
|
|
24
24
|
code: Noop<[code: string]>;
|
|
25
25
|
});
|
|
26
|
+
/**
|
|
27
|
+
* @description
|
|
28
|
+
* Event map for WhatsApp.
|
|
29
|
+
*/
|
|
26
30
|
interface EventMap {
|
|
27
31
|
error: [error: Error];
|
|
28
32
|
open: [];
|
|
@@ -46,18 +50,22 @@ interface EventMap {
|
|
|
46
50
|
* qr: (code) => console.log(code),
|
|
47
51
|
* });
|
|
48
52
|
*/
|
|
49
|
-
|
|
50
|
-
protected readonly options: IWhatsApp<T>;
|
|
53
|
+
declare class WhatsApp<T extends 'qr' | 'code'> extends EventEmitter<EventMap> {
|
|
51
54
|
/**
|
|
52
55
|
* @description
|
|
53
|
-
*
|
|
56
|
+
* Store for WhatsApp Web.
|
|
54
57
|
*/
|
|
55
|
-
protected
|
|
58
|
+
protected store: Store;
|
|
56
59
|
/**
|
|
57
60
|
* @description
|
|
58
|
-
*
|
|
61
|
+
* Options for WhatsApp Web.
|
|
59
62
|
*/
|
|
60
|
-
protected
|
|
63
|
+
protected options: IWhatsApp<T>;
|
|
64
|
+
/**
|
|
65
|
+
* @description
|
|
66
|
+
* Socket for WhatsApp Web.
|
|
67
|
+
*/
|
|
68
|
+
protected socket: Baileys.WASocket;
|
|
61
69
|
/**
|
|
62
70
|
* @description
|
|
63
71
|
* Mutex, used to prevent concurrent access to the socket.
|
|
@@ -71,8 +79,30 @@ export default class WhatsApp<T extends 'qr' | 'code'> extends EventEmitter<Even
|
|
|
71
79
|
* @returns Result of the function.
|
|
72
80
|
*/
|
|
73
81
|
tick<T extends Noop<[socket: Baileys.WASocket, store: Store], any>>(func: T): Promise<Awaited<ReturnType<T>>>;
|
|
82
|
+
/**
|
|
83
|
+
* @description
|
|
84
|
+
* Process events from the socket.
|
|
85
|
+
* @param func Function to execute.
|
|
86
|
+
* @returns Handler to remove the event listener.
|
|
87
|
+
*/
|
|
88
|
+
process(func: Noop<[event: Partial<Baileys.BaileysEventMap>, socket: Baileys.WASocket, store: Store]>): () => void;
|
|
89
|
+
/**
|
|
90
|
+
* @description
|
|
91
|
+
* Returns all documents in the store.
|
|
92
|
+
* @returns Promise that resolves to an object containing all documents.
|
|
93
|
+
*/
|
|
74
94
|
documents(): Promise<Record<string, any>>;
|
|
95
|
+
/**
|
|
96
|
+
* @description
|
|
97
|
+
* Returns all chats in the store.
|
|
98
|
+
* @returns Promise that resolves to an array of chats.
|
|
99
|
+
*/
|
|
75
100
|
chats(): Promise<Chat[]>;
|
|
101
|
+
/**
|
|
102
|
+
* @description
|
|
103
|
+
* Returns all messages in the store.
|
|
104
|
+
* @returns Promise that resolves to an array of messages.
|
|
105
|
+
*/
|
|
76
106
|
messages(): Promise<Message[]>;
|
|
77
107
|
/**
|
|
78
108
|
* @description
|
|
@@ -134,7 +164,11 @@ export default class WhatsApp<T extends 'qr' | 'code'> extends EventEmitter<Even
|
|
|
134
164
|
jid: string;
|
|
135
165
|
content: import("baileys").BinaryNode;
|
|
136
166
|
}[]>;
|
|
137
|
-
groupUpdateDescription: (jid: string, description
|
|
167
|
+
groupUpdateDescription: (jid: string, description? /**
|
|
168
|
+
* @description
|
|
169
|
+
* Returns all messages in the store.
|
|
170
|
+
* @returns Promise that resolves to an array of messages.
|
|
171
|
+
*/: string) => Promise<void>;
|
|
138
172
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
139
173
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
140
174
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
@@ -224,4 +258,10 @@ export default class WhatsApp<T extends 'qr' | 'code'> extends EventEmitter<Even
|
|
|
224
258
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
|
|
225
259
|
}>;
|
|
226
260
|
}
|
|
227
|
-
export
|
|
261
|
+
export default WhatsApp;
|
|
262
|
+
export * from './static/Store';
|
|
263
|
+
export { default as Store } from './static/Store';
|
|
264
|
+
export * from './model/chat';
|
|
265
|
+
export { default as Chat } from './model/chat';
|
|
266
|
+
export * from './model/message';
|
|
267
|
+
export { default as Message } from './model/message';
|
package/build/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var C=Object.create;var y=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var E=(s,r)=>{for(var e in r)y(s,e,{get:r[e],enumerable:!0})},g=(s,r,e,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of P(r))!v.call(s,a)&&a!==e&&y(s,a,{get:()=>r[a],enumerable:!(i=M(r,a))||i.enumerable});return s},h=(s,r,e)=>(g(s,r,"default"),e&&g(e,r,"default")),p=(s,r,e)=>(e=s!=null?C(q(s)):{},g(r||!s||!s.__esModule?y(e,"default",{value:s,enumerable:!0}):e,s)),I=s=>g(y({},"__esModule",{value:!0}),s);var n={};E(n,{Chat:()=>A.default,Message:()=>W.default,Store:()=>x.default,default:()=>N});module.exports=I(n);var d=require("@arcaelas/utils"),k=require("async-mutex"),u=p(require("baileys")),B=p(require("node:events")),f=p(require("./model/chat")),w=p(require("./model/message")),S=p(require("./static/Store")),T=p(require("./static/useCache"));h(n,require("./static/Store"),module.exports);var x=p(require("./static/Store"));h(n,require("./model/chat"),module.exports);var A=p(require("./model/chat"));h(n,require("./model/message"),module.exports);var W=p(require("./model/message"));class R extends B.default{constructor(e){super({captureRejections:!0});this.mutex=new k.Mutex;this.on("error",i=>{this.listenerCount("error")===1&&console.error(i)}),this.options={...e,phone:e.phone.replace(/\D/g,"")},this.store=new S.default(this.options.store),this.connect()}async tick(e){return this.mutex.acquire().then(()=>e(this.socket,this.store))}process(e){return this.socket.ev.process(i=>{e(i,this.socket,this.store)})}async documents(){return await this.tick(async(e,i)=>{const a={};for await(const m of i.document.values())a[m.key]=m.value;return a})}async chats(){return await this.tick(async(e,i)=>{const a=[];for await(const m of i.chat.values())a.push(new f.default(this,m));return a})}async messages(){return await this.tick(async(e,i)=>{const a=[];for await(const m of i.message.values())a.push(new w.default(this,m));return a})}async connect(){const e=(0,d.promify)(),{state:i,save:a}=await(0,T.default)(this.store),{version:m}=await u.fetchLatestBaileysVersion();if(this.socket=u.makeWASocket({version:m,syncFullHistory:!0,browser:u.Browsers.macOS("Descktop"),auth:{creds:i.creds,keys:u.makeCacheableSignalKeyStore(i.keys)},getMessage:async o=>{const t=await this.store.message.get(o.id);return t?t.message:void 0}}),this.socket.ev.process(async o=>{if(o["creds.update"]&&await a(),o["connection.update"]){const{connection:t,lastDisconnect:c}=o["connection.update"];t==="open"?e.resolve(this.socket):t==="close"&&c?.error?.output?.statusCode!==u.DisconnectReason.loggedOut&&e.resolve(await this.connect())}await Promise.allSettled([].concat(o["messaging-history.set"]?.chats||[],o["chats.upsert"]||[]).map(async t=>{await this.store.chat.set(t),this.emit("chat:created",new f.default(this,t))})),await Promise.allSettled([].concat(o["chats.update"]||[]).map(async t=>{const c=await this.store.chat.get(t.id);if(c!==null){const l=(0,d.merge)(c,t);await this.store.chat.set(l),this.emit("chat:updated",new f.default(this,l))}}));for(const t of o["chats.delete"]??[])await this.store.chat.unset(t),this.emit("chat:deleted",t);await Promise.allSettled([].concat(o["messages.upsert"]?.messages||[]).map(async t=>{await this.store.message.set(t),this.emit("message:created",new w.default(this,t))})),await Promise.allSettled([].concat(o["messages.update"]||[]).map(async t=>{const c=await this.store.message.get(t.key.id);if(c!==null){const l=(0,d.merge)(c,t);await this.store.message.set(l),this.emit("message:updated",new w.default(this,l))}}))}),await this.socket.waitForSocketOpen(),await(0,d.sleep)(3e3),this.socket.authState.creds.registered)e.resolve(this.socket);else if(this.options.loginType==="code")await this.options.code(await this.socket.requestPairingCode(this.options.phone));else if(this.options.loginType==="qr"){const o=(0,d.promify)(),t=setTimeout(()=>o.reject("QR Timeout"),6e4);this.socket.ev.on("connection.update",async({qr:c})=>{if(c){clearTimeout(t);try{await this.options.qr(c),o.resolve(c)}catch(l){o.reject(l)}}}),await o}return e}}var N=R;0&&(module.exports={Chat,Message,Store,...require("./static/Store"),...require("./model/chat"),...require("./model/message")});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { merge, Noop, promify, sleep } from '@arcaelas/utils';\nimport { type Boom } from '@hapi/boom';\nimport { Mutex } from 'async-mutex';\nimport * as Baileys from 'baileys';\nimport EventEmitter from 'node:events';\nimport Chat from './model/chat';\nimport Message from './model/message';\nimport Store, { Engine } from './static/Store';\nimport useCache from './static/useCache';\n\n/**\n * @description Estructura de configuraci\u00F3n para iniciar sesi\u00F3n con WhatsApp.\n */\ninterface IWhatsAppBase {\n phone: string;\n store
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["src_exports", "__export", "
|
|
4
|
+
"sourcesContent": ["import { merge, Noop, promify, sleep } from '@arcaelas/utils';\nimport { type Boom } from '@hapi/boom';\nimport { Mutex } from 'async-mutex';\nimport * as Baileys from 'baileys';\nimport EventEmitter from 'node:events';\nimport Chat from './model/chat';\nimport Message from './model/message';\nimport Store, { Engine } from './static/Store';\nimport useCache from './static/useCache';\n\n/**\n * @description Estructura de configuraci\u00F3n para iniciar sesi\u00F3n con WhatsApp.\n */\ninterface IWhatsAppBase {\n phone: string;\n store: Engine;\n}\n\n/**\n * @description Configuraci\u00F3n condicional seg\u00FAn tipo de login.\n */\n// prettier-ignore\ntype IWhatsApp<T extends 'qr' | 'code'> = IWhatsAppBase & {\n loginType: T } & (\n T extends 'qr'\n ? { qr: Noop<[qr: string]> }\n : { code: Noop<[code: string]> }\n );\n\n/**\n * @description\n * Event map for WhatsApp.\n */\ninterface EventMap {\n error: [error: Error];\n open: [];\n close: [];\n qr: [qr: string];\n code: [code: string];\n 'chat:created': [chat: Chat];\n 'chat:updated': [chat: Chat];\n 'chat:deleted': [id: string];\n 'message:created': [message: Message];\n 'message:updated': [message: Message];\n 'message:deleted': [id: string];\n}\n\n/**\n * @description\n * Client for WhatsApp Web.\n * @example\n * const client = new WhatsApp({\n * phone: '1234567890',\n * loginType: 'qr',\n * qr: (code) => console.log(code),\n * });\n */\nclass WhatsApp<T extends 'qr' | 'code'> extends EventEmitter<EventMap> {\n /**\n * @description\n * Store for WhatsApp Web.\n */\n protected store: Store;\n /**\n * @description\n * Options for WhatsApp Web.\n */\n protected options: IWhatsApp<T>;\n /**\n * @description\n * Socket for WhatsApp Web.\n */\n protected socket: Baileys.WASocket;\n /**\n * @description\n * Mutex, used to prevent concurrent access to the socket.\n */\n protected readonly mutex = new Mutex();\n\n constructor(options: IWhatsApp<T>) {\n super({ captureRejections: true });\n this.on('error', (error) => {\n if (this.listenerCount('error') === 1) {\n console.error(error);\n }\n });\n this.options = {\n ...options,\n phone: options.phone.replace(/\\D/g, ''),\n };\n this.store = new Store(this.options.store);\n this.connect();\n }\n\n /**\n * @description\n * Execute a function with the socket and store, means that the function will be executed only when the socket is ready.\n * @param func Function to execute.\n * @returns Result of the function.\n */\n async tick<T extends Noop<[socket: Baileys.WASocket, store: Store], any>>(func: T): Promise<Awaited<ReturnType<T>>> {\n return this.mutex.acquire().then(() => func(this.socket, this.store));\n }\n\n /**\n * @description\n * Process events from the socket.\n * @param func Function to execute.\n * @returns Handler to remove the event listener.\n */\n process(func: Noop<[event: Partial<Baileys.BaileysEventMap>, socket: Baileys.WASocket, store: Store]>) {\n return this.socket.ev.process((event) => {\n func(event, this.socket, this.store);\n });\n }\n\n /**\n * @description\n * Returns all documents in the store.\n * @returns Promise that resolves to an object containing all documents.\n */\n async documents(): Promise<Record<string, any>> {\n return await this.tick(async (_, store) => {\n const documents: Record<string, any> = {};\n for await (const document of store.document.values()) {\n documents[document.key] = document.value;\n }\n return documents;\n });\n }\n\n /**\n * @description\n * Returns all chats in the store.\n * @returns Promise that resolves to an array of chats.\n */\n async chats(): Promise<Chat[]> {\n return await this.tick(async (_, store) => {\n const chats: Chat[] = [];\n for await (const chat of store.chat.values()) {\n chats.push(new Chat(this, chat));\n }\n return chats;\n });\n }\n\n /**\n * @description\n * Returns all messages in the store.\n * @returns Promise that resolves to an array of messages.\n */\n async messages(): Promise<Message[]> {\n return await this.tick(async (_, store) => {\n const messages: Message[] = [];\n for await (const message of store.message.values()) {\n messages.push(new Message(this, message));\n }\n return messages;\n });\n }\n\n /**\n * @description\n * Connect to WhatsApp Web.\n * @returns Promise that resolves to the socket.\n */\n protected async connect() {\n const promise = promify<Baileys.WASocket>();\n const { state, save } = await useCache(this.store);\n const { version } = await Baileys.fetchLatestBaileysVersion();\n this.socket = Baileys.makeWASocket({\n version,\n syncFullHistory: true,\n browser: Baileys.Browsers.macOS('Descktop'),\n auth: {\n creds: state.creds,\n keys: Baileys.makeCacheableSignalKeyStore(state.keys),\n },\n getMessage: async (key) => {\n const message = await this.store.message.get(key.id!);\n return message ? message.message! : undefined;\n },\n });\n this.socket.ev.process(async (event) => {\n if (event['creds.update']) {\n await save();\n }\n if (event['connection.update']) {\n const { connection, lastDisconnect } = event['connection.update'];\n if (connection === 'open') promise.resolve(this.socket);\n else if (connection === 'close' && (lastDisconnect?.error as Boom)?.output?.statusCode !== Baileys.DisconnectReason.loggedOut) {\n promise.resolve(await this.connect());\n }\n }\n // prettier-ignore\n await Promise.allSettled(\n ([] as Baileys.Chat[])\n .concat(event['messaging-history.set']?.chats || [], event['chats.upsert'] || [])\n .map(async chat => {\n await this.store.chat.set(chat);\n this.emit('chat:created', new Chat(this, chat));\n })\n );\n // prettier-ignore\n await Promise.allSettled(\n ([] as Baileys.ChatUpdate[])\n .concat(event['chats.update'] || [])\n .map(async update => {\n const payload = await this.store.chat.get(update.id!);\n if (payload !== null) {\n const chat = merge(payload, update) as Baileys.Chat;\n await this.store.chat.set(chat);\n this.emit('chat:updated', new Chat(this, chat));\n }\n })\n );\n for (const key of (event['chats.delete'] ?? []) as string[]) {\n await this.store.chat.unset(key);\n this.emit('chat:deleted', key);\n }\n // prettier-ignore\n await Promise.allSettled(\n ([] as Baileys.WAMessage[])\n .concat(event['messages.upsert']?.messages || [])\n .map(async message => {\n await this.store.message.set(message);\n this.emit('message:created', new Message(this, message));\n })\n );\n // prettier-ignore\n await Promise.allSettled(\n ([] as Baileys.WAMessageUpdate[])\n .concat(event['messages.update'] || [])\n .map(async message => {\n const payload = await this.store.message.get(message.key.id!);\n if (payload !== null) {\n const chat = merge(payload, message) as Baileys.WAProto.WebMessageInfo;\n await this.store.message.set(chat);\n this.emit('message:updated', new Message(this, chat));\n }\n })\n );\n // TODO: Handle messages.delete\n });\n\n await this.socket.waitForSocketOpen();\n await sleep(3000);\n\n if (this.socket.authState.creds.registered) {\n promise.resolve(this.socket);\n } else if (this.options.loginType === 'code') {\n await this.options['code'](await this.socket.requestPairingCode(this.options.phone));\n } else if (this.options.loginType === 'qr') {\n const _qr = promify<string>();\n const timeout = setTimeout(() => _qr.reject('QR Timeout'), 60000);\n this.socket.ev.on('connection.update', async ({ qr }) => {\n if (qr) {\n clearTimeout(timeout);\n try {\n await this.options['qr'](qr);\n _qr.resolve(qr);\n } catch (error) {\n _qr.reject(error);\n }\n }\n });\n await _qr;\n }\n return promise;\n }\n}\n\nexport default WhatsApp;\nexport * from './static/Store';\nexport { default as Store } from './static/Store';\n\nexport * from './model/chat';\nexport { default as Chat } from './model/chat';\n\nexport * from './model/message';\nexport { default as Message } from './model/message';\n"],
|
|
5
|
+
"mappings": "wmBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0EAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAA4C,2BAE5CC,EAAsB,uBACtBC,EAAyB,sBACzBC,EAAyB,0BACzBC,EAAiB,2BACjBC,EAAoB,8BACpBC,EAA8B,6BAC9BC,EAAqB,gCAyQrBC,EAAAZ,EAAc,0BAjRd,gBAkRA,IAAAU,EAAiC,6BAEjCE,EAAAZ,EAAc,wBApRd,gBAqRA,IAAAQ,EAAgC,2BAEhCI,EAAAZ,EAAc,2BAvRd,gBAwRA,IAAAS,EAAmC,8BA/NnC,MAAMI,UAA0C,EAAAC,OAAuB,CAsBnE,YAAYC,EAAuB,CAC/B,MAAM,CAAE,kBAAmB,EAAK,CAAC,EAHrC,KAAmB,MAAQ,IAAI,QAI3B,KAAK,GAAG,QAAUC,GAAU,CACpB,KAAK,cAAc,OAAO,IAAM,GAChC,QAAQ,MAAMA,CAAK,CAE3B,CAAC,EACD,KAAK,QAAU,CACX,GAAGD,EACH,MAAOA,EAAQ,MAAM,QAAQ,MAAO,EAAE,CAC1C,EACA,KAAK,MAAQ,IAAI,EAAAE,QAAM,KAAK,QAAQ,KAAK,EACzC,KAAK,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CACEwB,EAAI,OAAOxB,CAAK,CACpB,EAER,CAAC,EACD,MAAMwB,EAEV,OAAOV,CACX,CACJ,CAEA,IAAO5B,EAAQW",
|
|
6
|
+
"names": ["src_exports", "__export", "src_default", "__toCommonJS", "import_utils", "import_async_mutex", "Baileys", "import_node_events", "import_chat", "import_message", "import_Store", "import_useCache", "__reExport", "WhatsApp", "EventEmitter", "options", "error", "Store", "func", "event", "_", "store", "documents", "document", "chats", "chat", "Chat", "messages", "message", "Message", "promise", "state", "save", "useCache", "version", "key", "connection", "lastDisconnect", "update", "payload", "_qr", "timeout", "qr"]
|
|
7
7
|
}
|
package/build/model/base.d.ts
CHANGED
|
@@ -3,11 +3,26 @@ import WhatsApp from 'src';
|
|
|
3
3
|
type Serialize<T> = {
|
|
4
4
|
[K in keyof T as T[K] extends Noop ? never : K]: T[K];
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* @module Base
|
|
8
|
+
* @description
|
|
9
|
+
* Base class for WhatsApp entities.
|
|
10
|
+
*/
|
|
6
11
|
export default class Base<T> {
|
|
7
12
|
protected readonly $: WhatsApp<'code' | 'qr'>;
|
|
8
13
|
protected readonly _: Serialize<T>;
|
|
9
14
|
constructor($: WhatsApp<'code' | 'qr'>, _: Serialize<T>);
|
|
15
|
+
/**
|
|
16
|
+
* @description
|
|
17
|
+
* Returns a JSON representation of this entity.
|
|
18
|
+
* @returns A JSON representation of this entity.
|
|
19
|
+
*/
|
|
10
20
|
toJSON(): any;
|
|
21
|
+
/**
|
|
22
|
+
* @description
|
|
23
|
+
* Returns a string representation of this entity.
|
|
24
|
+
* @returns A string representation of this entity.
|
|
25
|
+
*/
|
|
11
26
|
toString(): string;
|
|
12
27
|
}
|
|
13
28
|
export {};
|
package/build/model/base.js
CHANGED
|
@@ -34,11 +34,21 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
const Baileys = __importStar(require("baileys"));
|
|
37
|
+
/**
|
|
38
|
+
* @module Base
|
|
39
|
+
* @description
|
|
40
|
+
* Base class for WhatsApp entities.
|
|
41
|
+
*/
|
|
37
42
|
class Base {
|
|
38
43
|
constructor($, _) {
|
|
39
44
|
this.$ = $;
|
|
40
45
|
this._ = _;
|
|
41
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* @description
|
|
49
|
+
* Returns a JSON representation of this entity.
|
|
50
|
+
* @returns A JSON representation of this entity.
|
|
51
|
+
*/
|
|
42
52
|
toJSON() {
|
|
43
53
|
const o = {};
|
|
44
54
|
for (const k in this) {
|
|
@@ -48,6 +58,11 @@ class Base {
|
|
|
48
58
|
}
|
|
49
59
|
return o;
|
|
50
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* @description
|
|
63
|
+
* Returns a string representation of this entity.
|
|
64
|
+
* @returns A string representation of this entity.
|
|
65
|
+
*/
|
|
51
66
|
toString() {
|
|
52
67
|
return JSON.stringify(this.toJSON(), Baileys.BufferJSON.replacer);
|
|
53
68
|
}
|
package/build/model/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/model/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAmC;AAKnC,MAAqB,IAAI;IACrB,YAA+B,CAA0B,EAAqB,CAAe;QAA9D,MAAC,GAAD,CAAC,CAAyB;QAAqB,MAAC,GAAD,CAAC,CAAc;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/model/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAmC;AAKnC;;;;GAIG;AACH,MAAqB,IAAI;IACrB,YAA+B,CAA0B,EAAqB,CAAe;QAA9D,MAAC,GAAD,CAAC,CAAyB;QAAqB,MAAC,GAAD,CAAC,CAAc;IAAG,CAAC;IACjG;;;;OAIG;IACH,MAAM;QACF,MAAM,CAAC,GAAQ,EAAE,CAAC;QAClB,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACnB,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU;gBAAE,SAAS;YAC5C,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;QACD,OAAO,CAAC,CAAC;IACb,CAAC;IACD;;;;OAIG;IACH,QAAQ;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACtE,CAAC;CACJ;AAvBD,uBAuBC"}
|
package/build/model/chat.d.ts
CHANGED
|
@@ -1,15 +1,66 @@
|
|
|
1
1
|
import * as Baileys from 'baileys';
|
|
2
2
|
import Base from './base';
|
|
3
3
|
import Message, { MessageOptions } from './message';
|
|
4
|
+
/**
|
|
5
|
+
* @module Chat
|
|
6
|
+
* @description
|
|
7
|
+
* Represents a chat in WhatsApp.
|
|
8
|
+
*/
|
|
4
9
|
export default class Chat extends Base<Baileys.Chat> {
|
|
10
|
+
/**
|
|
11
|
+
* @description
|
|
12
|
+
* Sends a text message to this chat.
|
|
13
|
+
* @param text The text to send.
|
|
14
|
+
* @param options Additional options for the message.
|
|
15
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
16
|
+
*/
|
|
5
17
|
send(text: string, options?: {
|
|
6
18
|
once: boolean;
|
|
7
19
|
}): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* @description
|
|
22
|
+
* Sends a media message to this chat.
|
|
23
|
+
* @param media The media to send.
|
|
24
|
+
* @param options Additional options for the message.
|
|
25
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
26
|
+
*/
|
|
8
27
|
send(media: Baileys.WAMediaUpload, options: MessageOptions): Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* @description
|
|
30
|
+
* Returns the messages in this chat.
|
|
31
|
+
* @returns Promise that resolves to an array of messages.
|
|
32
|
+
*/
|
|
9
33
|
messages(): Promise<Message[]>;
|
|
34
|
+
/**
|
|
35
|
+
* @description
|
|
36
|
+
* Pins this chat.
|
|
37
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
38
|
+
*/
|
|
10
39
|
pin(): Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* @description
|
|
42
|
+
* Marks this chat as seen.
|
|
43
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
44
|
+
*/
|
|
11
45
|
seen(): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* @description
|
|
48
|
+
* Mutes this chat.
|
|
49
|
+
* @param time The time to mute for.
|
|
50
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
51
|
+
*/
|
|
12
52
|
mute(time?: number): Promise<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* @description
|
|
55
|
+
* Updates the presence of this chat.
|
|
56
|
+
* @param status The status to update to.
|
|
57
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
58
|
+
*/
|
|
13
59
|
presence(status: Baileys.WAPresence): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* @description
|
|
62
|
+
* Deletes this chat.
|
|
63
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
64
|
+
*/
|
|
14
65
|
delete(): Promise<boolean>;
|
|
15
66
|
}
|
package/build/model/chat.js
CHANGED
|
@@ -5,6 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const base_1 = __importDefault(require("./base"));
|
|
7
7
|
const message_1 = __importDefault(require("./message"));
|
|
8
|
+
/**
|
|
9
|
+
* @module Chat
|
|
10
|
+
* @description
|
|
11
|
+
* Represents a chat in WhatsApp.
|
|
12
|
+
*/
|
|
8
13
|
class Chat extends base_1.default {
|
|
9
14
|
async send(content, options) {
|
|
10
15
|
return this.$.tick(async (socket) => {
|
|
@@ -33,26 +38,27 @@ class Chat extends base_1.default {
|
|
|
33
38
|
return false;
|
|
34
39
|
});
|
|
35
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* @description
|
|
43
|
+
* Returns the messages in this chat.
|
|
44
|
+
* @returns Promise that resolves to an array of messages.
|
|
45
|
+
*/
|
|
36
46
|
async messages() {
|
|
37
47
|
return await this.$.tick(async (_, store) => {
|
|
38
48
|
const messages = [];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
for await (const key of store.engine.keys()) {
|
|
47
|
-
if (key.startsWith(`chat/${this._.id}/message/`)) {
|
|
48
|
-
const id = key.slice(`chat/${this._.id}/message/`.length);
|
|
49
|
-
messages.push(new message_1.default(this.$, (await store.message.get(id))));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
49
|
+
const keys = await store.engine.match(`chat/${this._.id}/message/*/index`);
|
|
50
|
+
for (const key of keys) {
|
|
51
|
+
const [, , id] = key.match(/chat\/[^/]+\/message\/([^/]+)/);
|
|
52
|
+
messages.push(new message_1.default(this.$, (await store.message.get(id))));
|
|
52
53
|
}
|
|
53
54
|
return messages;
|
|
54
55
|
});
|
|
55
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* @description
|
|
59
|
+
* Pins this chat.
|
|
60
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
61
|
+
*/
|
|
56
62
|
async pin() {
|
|
57
63
|
return await this.$.tick(async (socket) => {
|
|
58
64
|
// prettier-ignore
|
|
@@ -63,6 +69,11 @@ class Chat extends base_1.default {
|
|
|
63
69
|
return true;
|
|
64
70
|
});
|
|
65
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* @description
|
|
74
|
+
* Marks this chat as seen.
|
|
75
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
76
|
+
*/
|
|
66
77
|
async seen() {
|
|
67
78
|
return await this.$.tick(async (socket) => {
|
|
68
79
|
// prettier-ignore
|
|
@@ -73,6 +84,12 @@ class Chat extends base_1.default {
|
|
|
73
84
|
return true;
|
|
74
85
|
});
|
|
75
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* @description
|
|
89
|
+
* Mutes this chat.
|
|
90
|
+
* @param time The time to mute for.
|
|
91
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
92
|
+
*/
|
|
76
93
|
async mute(time = 0) {
|
|
77
94
|
return await this.$.tick(async (socket) => {
|
|
78
95
|
// prettier-ignore
|
|
@@ -83,12 +100,23 @@ class Chat extends base_1.default {
|
|
|
83
100
|
return true;
|
|
84
101
|
});
|
|
85
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* @description
|
|
105
|
+
* Updates the presence of this chat.
|
|
106
|
+
* @param status The status to update to.
|
|
107
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
108
|
+
*/
|
|
86
109
|
async presence(status) {
|
|
87
110
|
return await this.$.tick(async (socket) => {
|
|
88
111
|
await socket.sendPresenceUpdate(status, this._.id);
|
|
89
112
|
return true;
|
|
90
113
|
});
|
|
91
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* @description
|
|
117
|
+
* Deletes this chat.
|
|
118
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
119
|
+
*/
|
|
92
120
|
async delete() {
|
|
93
121
|
return this.$.tick(async (socket) => {
|
|
94
122
|
await socket.chatModify({
|
package/build/model/chat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/model/chat.ts"],"names":[],"mappings":";;;;;AACA,kDAA0B;AAC1B,wDAAoD;AAEpD,MAAqB,IAAK,SAAQ,cAAkB;
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/model/chat.ts"],"names":[],"mappings":";;;;;AACA,kDAA0B;AAC1B,wDAAoD;AAEpD;;;;GAIG;AACH,MAAqB,IAAK,SAAQ,cAAkB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,CAAC,MAAM;QACR,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YAChC,MAAM,MAAM,CAAC,UAAU,CACnB;gBACI,MAAM,EAAE,IAAI;gBACZ,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,QAAS,CAAC,IAAI,CAAC,CAAC,CAAC,QAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAQ,CAAC;aACzE,EACD,IAAI,CAAC,CAAC,CAAC,EAAE,CACZ,CAAC;YACF,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA3ID,uBA2IC"}
|
package/build/model/message.d.ts
CHANGED
|
@@ -1,19 +1,82 @@
|
|
|
1
1
|
import * as Baileys from 'baileys';
|
|
2
2
|
import Base from './base';
|
|
3
|
+
import Chat from './chat';
|
|
3
4
|
export interface MessageOptions {
|
|
4
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @description
|
|
7
|
+
* The type of the message.
|
|
8
|
+
* @default 'text'
|
|
9
|
+
*/
|
|
10
|
+
type?: 'audio' | 'video' | 'image' | 'location';
|
|
11
|
+
/**
|
|
12
|
+
* @description
|
|
13
|
+
* The caption for the image.
|
|
14
|
+
*/
|
|
5
15
|
caption?: string;
|
|
16
|
+
/**
|
|
17
|
+
* @description
|
|
18
|
+
* Whether the audio is a voice note.
|
|
19
|
+
*/
|
|
6
20
|
ptt?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @description
|
|
23
|
+
* Whether the video is a video note.
|
|
24
|
+
*/
|
|
7
25
|
ptv?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @description
|
|
28
|
+
* Whether the message is a view once message.
|
|
29
|
+
*/
|
|
8
30
|
once?: boolean;
|
|
9
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* @module Message
|
|
34
|
+
* @description
|
|
35
|
+
* Represents a message in WhatsApp.
|
|
36
|
+
*/
|
|
10
37
|
export default class Message extends Base<Baileys.WAProto.IWebMessageInfo> {
|
|
38
|
+
/**
|
|
39
|
+
* @description
|
|
40
|
+
* Returns the chat associated with this message.
|
|
41
|
+
* @returns Promise that resolves to the chat.
|
|
42
|
+
*/
|
|
43
|
+
chat(): Promise<Chat>;
|
|
44
|
+
/**
|
|
45
|
+
* @description
|
|
46
|
+
* Replies to this message.
|
|
47
|
+
* @param content The content to reply with.
|
|
48
|
+
* @param options Additional options for the reply.
|
|
49
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
50
|
+
*/
|
|
11
51
|
reply(text: string, options?: {
|
|
12
52
|
once: boolean;
|
|
13
53
|
}): Promise<boolean>;
|
|
14
54
|
reply(media: Baileys.WAMediaUpload, options: MessageOptions): Promise<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* @description
|
|
57
|
+
* Marks this message as seen.
|
|
58
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
59
|
+
*/
|
|
15
60
|
seen(): Promise<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* @description
|
|
63
|
+
* Deletes this message.
|
|
64
|
+
* @param forall Whether to delete for all participants.
|
|
65
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
66
|
+
*/
|
|
16
67
|
delete(forall?: boolean): Promise<boolean>;
|
|
68
|
+
/**
|
|
69
|
+
* @description
|
|
70
|
+
* Likes this message.
|
|
71
|
+
* @param emoji The emoji to use for the like.
|
|
72
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
73
|
+
*/
|
|
17
74
|
like(emoji: string): Promise<boolean>;
|
|
75
|
+
/**
|
|
76
|
+
* @description
|
|
77
|
+
* Forwards this message to another chat.
|
|
78
|
+
* @param chat_id The ID of the chat to forward the message to.
|
|
79
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
80
|
+
*/
|
|
18
81
|
forward(chat_id: string): Promise<boolean>;
|
|
19
82
|
}
|
package/build/model/message.js
CHANGED
|
@@ -4,7 +4,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const base_1 = __importDefault(require("./base"));
|
|
7
|
+
const chat_1 = __importDefault(require("./chat"));
|
|
8
|
+
/**
|
|
9
|
+
* @module Message
|
|
10
|
+
* @description
|
|
11
|
+
* Represents a message in WhatsApp.
|
|
12
|
+
*/
|
|
7
13
|
class Message extends base_1.default {
|
|
14
|
+
/**
|
|
15
|
+
* @description
|
|
16
|
+
* Returns the chat associated with this message.
|
|
17
|
+
* @returns Promise that resolves to the chat.
|
|
18
|
+
*/
|
|
19
|
+
async chat() {
|
|
20
|
+
// prettier-ignore
|
|
21
|
+
return this.$.tick(async (_, store) => {
|
|
22
|
+
return new chat_1.default(this.$, (await store.chat.get(this._.key.remoteJid)));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
8
25
|
async reply(content, options) {
|
|
9
26
|
return this.$.tick(async (socket) => {
|
|
10
27
|
// prettier-ignore
|
|
@@ -30,6 +47,11 @@ class Message extends base_1.default {
|
|
|
30
47
|
return false;
|
|
31
48
|
});
|
|
32
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* @description
|
|
52
|
+
* Marks this message as seen.
|
|
53
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
54
|
+
*/
|
|
33
55
|
async seen() {
|
|
34
56
|
return this.$.tick(async (socket) => {
|
|
35
57
|
// prettier-ignore
|
|
@@ -40,6 +62,12 @@ class Message extends base_1.default {
|
|
|
40
62
|
return true;
|
|
41
63
|
});
|
|
42
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* @description
|
|
67
|
+
* Deletes this message.
|
|
68
|
+
* @param forall Whether to delete for all participants.
|
|
69
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
70
|
+
*/
|
|
43
71
|
async delete(forall = false) {
|
|
44
72
|
return this.$.tick(async (socket) => {
|
|
45
73
|
if (forall) {
|
|
@@ -60,14 +88,26 @@ class Message extends base_1.default {
|
|
|
60
88
|
return true;
|
|
61
89
|
});
|
|
62
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* @description
|
|
93
|
+
* Likes this message.
|
|
94
|
+
* @param emoji The emoji to use for the like.
|
|
95
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
96
|
+
*/
|
|
63
97
|
async like(emoji) {
|
|
64
98
|
return this.$.tick(async (socket) => {
|
|
65
99
|
await socket.sendMessage(this._.key.remoteJid, {
|
|
66
|
-
react: { text: emoji, key: this._.key
|
|
100
|
+
react: { text: emoji, key: this._.key },
|
|
67
101
|
});
|
|
68
102
|
return true;
|
|
69
103
|
});
|
|
70
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* @description
|
|
107
|
+
* Forwards this message to another chat.
|
|
108
|
+
* @param chat_id The ID of the chat to forward the message to.
|
|
109
|
+
* @returns Promise that resolves to a boolean indicating success.
|
|
110
|
+
*/
|
|
71
111
|
async forward(chat_id) {
|
|
72
112
|
return this.$.tick(async (socket) => {
|
|
73
113
|
await socket.sendMessage(chat_id, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/model/message.ts"],"names":[],"mappings":";;;;;AACA,kDAA0B;
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/model/message.ts"],"names":[],"mappings":";;;;;AACA,kDAA0B;AAC1B,kDAA0B;AA+B1B;;;;GAIG;AACH,MAAqB,OAAQ,SAAQ,cAAqC;IACtE;;;;OAIG;IACH,KAAK,CAAC,IAAI;QACN,kBAAkB;QAClB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;YAClC,OAAO,IAAI,cAAI,CACX,IAAI,CAAC,CAAC,EACN,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,SAAU,CAAC,CAAE,CACjD,CAAA;QACL,CA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AC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI,CAAC,KAAa;QACpB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YAChC,MAAM,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,SAAU,EAAE;gBAC5C,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE;aAC1C,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,OAAe;QACzB,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YAChC,MAAM,MAAM,CAAC,WAAW,CAAC,OAAQ,EAAE;gBAC/B,OAAO,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE;aAC/B,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAjID,0BAiIC"}
|
package/build/static/Store.d.ts
CHANGED
|
@@ -52,71 +52,33 @@ export interface Engine {
|
|
|
52
52
|
/**
|
|
53
53
|
* Remove a key.
|
|
54
54
|
*
|
|
55
|
-
* @param key Key to
|
|
55
|
+
* @param key Key to unset.
|
|
56
56
|
* @returns `true` if removed; `false` if it did not exist.
|
|
57
57
|
*
|
|
58
58
|
* @example
|
|
59
|
-
* await store.
|
|
59
|
+
* await store.unset('cache:config');
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
unset(key: string): Promise<boolean>;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* @returns `AsyncGenerator` yielding each key.
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* for await (const key of store.keys()) console.log(key);
|
|
69
|
-
*/
|
|
70
|
-
keys(): AsyncGenerator<string>;
|
|
71
|
-
/**
|
|
72
|
-
* Iterate over all values (`string | null`).
|
|
73
|
-
*
|
|
74
|
-
* @returns `AsyncGenerator` yielding each value.
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* for await (const value of store.values()) console.log(value);
|
|
78
|
-
*/
|
|
79
|
-
values(): AsyncGenerator<string | null>;
|
|
80
|
-
/**
|
|
81
|
-
* Iterate over `[key, value]` pairs.
|
|
82
|
-
*
|
|
83
|
-
* @returns `AsyncGenerator<[string, string | null]>`.
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* for await (const [k, v] of store.entries()) console.log(k, v);
|
|
87
|
-
*/
|
|
88
|
-
entries(): AsyncGenerator<[string, string | null]>;
|
|
89
|
-
/**
|
|
90
|
-
* Remove **all** keys.
|
|
91
|
-
*
|
|
92
|
-
* @returns `true` when the store is empty; `false` if an error occurred.
|
|
93
|
-
*
|
|
94
|
-
* @example
|
|
95
|
-
* await store.clear();
|
|
96
|
-
*/
|
|
97
|
-
clear(): Promise<boolean>;
|
|
98
|
-
/**
|
|
99
|
-
* (Optional) Filter keys using a **glob pattern** (`*` as wildcard).
|
|
100
|
-
*
|
|
63
|
+
* @description
|
|
64
|
+
* Filter keys using a **glob pattern** (`*` as wildcard).
|
|
101
65
|
* - `user:*` → everything starting with `user:`
|
|
102
66
|
* - `log:*:error` → simultaneous prefix and suffix
|
|
103
|
-
*
|
|
104
67
|
* @param pattern Glob pattern.
|
|
105
68
|
* @returns Array of matching keys.
|
|
106
|
-
*
|
|
107
69
|
* @example
|
|
108
|
-
* const keys = await store.
|
|
70
|
+
* const keys = await store.match('user:*:active');
|
|
109
71
|
*/
|
|
110
|
-
|
|
72
|
+
match(pattern: string): Promise<string[]>;
|
|
111
73
|
}
|
|
112
74
|
export default class Store {
|
|
113
75
|
readonly engine: Engine;
|
|
114
76
|
constructor(engine: Engine);
|
|
115
77
|
document: {
|
|
116
|
-
set: (
|
|
117
|
-
get: <T>(
|
|
118
|
-
has: (
|
|
119
|
-
|
|
78
|
+
set: (pathname: string, content: any) => Promise<boolean>;
|
|
79
|
+
get: <T>(pathname: string) => Promise<T | null>;
|
|
80
|
+
has: (pathname: string) => Promise<boolean>;
|
|
81
|
+
unset: (pathname: string) => Promise<boolean>;
|
|
120
82
|
keys: () => {
|
|
121
83
|
[Symbol.asyncIterator](): AsyncGenerator<string, void, unknown>;
|
|
122
84
|
};
|
|
@@ -129,9 +91,9 @@ export default class Store {
|
|
|
129
91
|
};
|
|
130
92
|
chat: {
|
|
131
93
|
set: (chat: Baileys.Chat) => Promise<boolean>;
|
|
132
|
-
get: (id:
|
|
133
|
-
has: (id:
|
|
134
|
-
|
|
94
|
+
get: (id: Baileys.Chat["id"]) => Promise<Baileys.Chat | null>;
|
|
95
|
+
has: (id: Baileys.Chat["id"]) => Promise<boolean>;
|
|
96
|
+
unset: (id: Baileys.Chat["id"]) => Promise<boolean>;
|
|
135
97
|
keys: () => {
|
|
136
98
|
[Symbol.asyncIterator](): AsyncGenerator<string, void, unknown>;
|
|
137
99
|
};
|
|
@@ -146,7 +108,7 @@ export default class Store {
|
|
|
146
108
|
set: (message: Baileys.WAProto.IWebMessageInfo) => Promise<boolean>;
|
|
147
109
|
get: (id: string) => Promise<Baileys.WAProto.IWebMessageInfo | null>;
|
|
148
110
|
has: (id: string) => Promise<boolean>;
|
|
149
|
-
|
|
111
|
+
unset: (id: string) => Promise<boolean>;
|
|
150
112
|
keys: () => {
|
|
151
113
|
[Symbol.asyncIterator](): AsyncGenerator<string, void, unknown>;
|
|
152
114
|
};
|
package/build/static/Store.js
CHANGED
|
@@ -38,35 +38,28 @@ class Store {
|
|
|
38
38
|
constructor(engine) {
|
|
39
39
|
this.engine = engine;
|
|
40
40
|
this.document = {
|
|
41
|
-
set: async (
|
|
41
|
+
set: async (pathname, content) => {
|
|
42
42
|
// prettier-ignore
|
|
43
|
-
return await this.engine.set(`document/${
|
|
43
|
+
return await this.engine.set(`document/${pathname}`, JSON.stringify(content, Baileys.BufferJSON.replacer));
|
|
44
44
|
},
|
|
45
|
-
get: async (
|
|
45
|
+
get: async (pathname) => {
|
|
46
46
|
// prettier-ignore
|
|
47
|
-
return JSON.parse(await this.engine.get(`document/${
|
|
47
|
+
return JSON.parse(await this.engine.get(`document/${pathname}`) ?? 'null', Baileys.BufferJSON.reviver);
|
|
48
48
|
},
|
|
49
|
-
has: async (
|
|
50
|
-
return this.engine.has(`document/${
|
|
49
|
+
has: async (pathname) => {
|
|
50
|
+
return await this.engine.has(`document/${pathname}`);
|
|
51
51
|
},
|
|
52
|
-
|
|
53
|
-
return this.engine.
|
|
52
|
+
unset: async (pathname) => {
|
|
53
|
+
return await this.engine.unset(`document/${pathname}`);
|
|
54
54
|
},
|
|
55
55
|
keys: () => {
|
|
56
56
|
const _this = this;
|
|
57
57
|
return {
|
|
58
58
|
async *[Symbol.asyncIterator]() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
59
|
+
for (const key of await _this.engine.match('document/*')) {
|
|
60
|
+
const [, _key] = key.match(/document\/(.*)/) ?? [];
|
|
61
|
+
yield _key;
|
|
63
62
|
}
|
|
64
|
-
else
|
|
65
|
-
for await (const key of _this.engine.keys()) {
|
|
66
|
-
if (key.startsWith('document/')) {
|
|
67
|
-
yield key.slice('document/'.length);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
63
|
},
|
|
71
64
|
};
|
|
72
65
|
},
|
|
@@ -101,44 +94,28 @@ class Store {
|
|
|
101
94
|
return JSON.parse(await this.engine.get(`chat/${id}/index`) ?? 'null', Baileys.BufferJSON.reviver);
|
|
102
95
|
},
|
|
103
96
|
has: async (id) => {
|
|
104
|
-
return this.engine.has(`chat/${id}/index`);
|
|
97
|
+
return await this.engine.has(`chat/${id}/index`);
|
|
105
98
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
else
|
|
112
|
-
for await (const key of this.engine.keys()) {
|
|
113
|
-
if (key.startsWith(`chat/${id}/`))
|
|
114
|
-
await this.engine.delete(key);
|
|
115
|
-
}
|
|
99
|
+
unset: async (id) => {
|
|
100
|
+
for (const key of await this.engine.match(`chat/${id}/*`)) {
|
|
101
|
+
await this.engine.unset(key);
|
|
102
|
+
}
|
|
116
103
|
return true;
|
|
117
104
|
},
|
|
118
105
|
keys: () => {
|
|
119
106
|
const _this = this;
|
|
120
107
|
return {
|
|
121
108
|
async *[Symbol.asyncIterator]() {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
yield id;
|
|
126
|
-
}
|
|
109
|
+
for await (const key of await _this.engine.match('chat/*/index')) {
|
|
110
|
+
const [, id] = key.match(/chat\/([^/]+)\/index/) ?? [];
|
|
111
|
+
yield id;
|
|
127
112
|
}
|
|
128
|
-
else
|
|
129
|
-
for await (const key of _this.engine.keys()) {
|
|
130
|
-
if (key.startsWith('chat/')) {
|
|
131
|
-
const [, id] = key.split('/');
|
|
132
|
-
yield id;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
113
|
},
|
|
136
114
|
};
|
|
137
115
|
},
|
|
138
116
|
values: () => {
|
|
139
117
|
const _this = this;
|
|
140
118
|
return {
|
|
141
|
-
// prettier-ignore
|
|
142
119
|
async *[Symbol.asyncIterator]() {
|
|
143
120
|
for await (const id of _this.chat.keys()) {
|
|
144
121
|
yield (await _this.chat.get(id));
|
|
@@ -149,7 +126,6 @@ class Store {
|
|
|
149
126
|
entries: () => {
|
|
150
127
|
const _this = this;
|
|
151
128
|
return {
|
|
152
|
-
// prettier-ignore
|
|
153
129
|
async *[Symbol.asyncIterator]() {
|
|
154
130
|
for await (const id of _this.chat.keys()) {
|
|
155
131
|
yield [id, (await _this.chat.get(id))];
|
|
@@ -164,73 +140,33 @@ class Store {
|
|
|
164
140
|
return await this.engine.set(`chat/${message.key.remoteJid}/message/${message.key.id}/index`, JSON.stringify(message, Baileys.BufferJSON.replacer));
|
|
165
141
|
},
|
|
166
142
|
get: async (id) => {
|
|
143
|
+
const [key] = await this.engine.match(`chat/*/${id}/index`);
|
|
167
144
|
// prettier-ignore
|
|
168
|
-
|
|
169
|
-
const [key] = await this.engine.scan(`chat/*/${id}/index`);
|
|
170
|
-
return JSON.parse((await this.engine.get(key)), Baileys.BufferJSON.reviver);
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
for await (const key of this.engine.keys()) {
|
|
174
|
-
const [chat, mid] = key.match(/chat\/([^/]+)\/message\/([^/]+)\/index/) ?? [];
|
|
175
|
-
if (chat && mid === id) {
|
|
176
|
-
return JSON.parse((await this.engine.get(`chat/${chat}/message/${id}/index`)), Baileys.BufferJSON.reviver);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return null;
|
|
145
|
+
return JSON.parse((await this.engine.get(key)), Baileys.BufferJSON.reviver);
|
|
181
146
|
},
|
|
182
147
|
has: async (id) => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return !!key;
|
|
186
|
-
}
|
|
187
|
-
for await (const key of this.engine.keys()) {
|
|
188
|
-
const [chat, mid] = key.match(/chat\/([^/]+)\/message\/([^/]+)\/index/) ?? [];
|
|
189
|
-
if (chat && mid === id)
|
|
190
|
-
return true;
|
|
191
|
-
}
|
|
192
|
-
return false;
|
|
148
|
+
const [key] = await this.engine.match(`chat/*/${id}/index`);
|
|
149
|
+
return !!key;
|
|
193
150
|
},
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
await this.engine.delete(key);
|
|
198
|
-
}
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
for await (const key of this.engine.keys()) {
|
|
203
|
-
const [chat, mid] = key.match(/chat\/([^/]+)\/message\/([^/]+)\/index/) ?? [];
|
|
204
|
-
if (chat && mid === id)
|
|
205
|
-
await this.engine.delete(key);
|
|
206
|
-
}
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
151
|
+
unset: async (id) => {
|
|
152
|
+
const [key] = await this.engine.match(`chat/*/${id}/index`);
|
|
153
|
+
return await this.engine.unset(key);
|
|
209
154
|
},
|
|
210
155
|
keys: () => {
|
|
211
156
|
const _this = this;
|
|
212
157
|
return {
|
|
213
158
|
async *[Symbol.asyncIterator]() {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
159
|
+
const keys = await _this.engine.match('chat/*/message/*/index');
|
|
160
|
+
for (const key of keys) {
|
|
161
|
+
const [, , id] = key.match(/chat\/([^/]+)\/message\/([^/]+)\/index/) ?? [];
|
|
162
|
+
yield id;
|
|
219
163
|
}
|
|
220
|
-
else
|
|
221
|
-
for await (const key of _this.engine.keys()) {
|
|
222
|
-
if (key.startsWith('chat/')) {
|
|
223
|
-
const [, , , m] = key.split('/');
|
|
224
|
-
yield m;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
164
|
},
|
|
228
165
|
};
|
|
229
166
|
},
|
|
230
167
|
values: () => {
|
|
231
168
|
const _this = this;
|
|
232
169
|
return {
|
|
233
|
-
// prettier-ignore
|
|
234
170
|
async *[Symbol.asyncIterator]() {
|
|
235
171
|
for await (const key of _this.message.keys()) {
|
|
236
172
|
yield (await _this.message.get(key));
|
|
@@ -241,7 +177,6 @@ class Store {
|
|
|
241
177
|
entries: () => {
|
|
242
178
|
const _this = this;
|
|
243
179
|
return {
|
|
244
|
-
// prettier-ignore
|
|
245
180
|
async *[Symbol.asyncIterator]() {
|
|
246
181
|
for await (const key of _this.message.keys()) {
|
|
247
182
|
yield [key, (await _this.message.get(key))];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Store.js","sourceRoot":"","sources":["../../src/static/Store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;
|
|
1
|
+
{"version":3,"file":"Store.js","sourceRoot":"","sources":["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,OAAO,EAAE,GAAG,EAAE;gBACV,MAAM,KAAK,GAAG,IAAI,CAAC;gBACnB,OAAO;oBACH,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;wBACzB,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;4BAC3C,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAE,CAAU,CAAC;wBAC1D,CAAC;oBACL,CAAC;iBACJ,CAAC;YACN,CAAC;SACJ,CAAC;IAzKoC,CAAC;CA0K1C;AA3KD,wBA2KC"}
|
package/build/static/useCache.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = useCache;
|
|
4
4
|
const baileys_1 = require("baileys");
|
|
5
5
|
async function useCache(store) {
|
|
6
|
+
// prettier-ignore
|
|
6
7
|
const creds = await store
|
|
7
8
|
.document.get('creds.json')
|
|
8
9
|
.then((e) => e ?? (0, baileys_1.initAuthCreds)());
|
|
@@ -30,7 +31,7 @@ async function useCache(store) {
|
|
|
30
31
|
const value = data[category][id];
|
|
31
32
|
tasks.push(value
|
|
32
33
|
? store.document.set(`${category}/${id}.json`, value)
|
|
33
|
-
: store.document.
|
|
34
|
+
: store.document.unset(`${category}/${id}.json`));
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
await Promise.all(tasks);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCache.js","sourceRoot":"","sources":["../../src/static/useCache.ts"],"names":[],"mappings":";;AAIA,
|
|
1
|
+
{"version":3,"file":"useCache.js","sourceRoot":"","sources":["../../src/static/useCache.ts"],"names":[],"mappings":";;AAIA,2BAsCC;AAzCD,qCAA+C;AAGhC,KAAK,UAAU,QAAQ,CAAC,KAAY;IAC/C,kBAAkB;IAClB,MAAM,KAAK,GAAG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