@builderbot/provider-sherpa 1.3.11
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/LICENSE.md +21 -0
- package/README.md +21 -0
- package/dist/index.cjs +31824 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +31821 -0
- package/dist/releaseTmp.d.ts +6 -0
- package/dist/releaseTmp.d.ts.map +1 -0
- package/dist/sherpa.d.ts +209 -0
- package/dist/sherpa.d.ts.map +1 -0
- package/dist/sherpaWrapper.d.ts +3 -0
- package/dist/sherpaWrapper.d.ts.map +1 -0
- package/dist/type.d.ts +19 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/utils.d.ts +25 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"releaseTmp.d.ts","sourceRoot":"","sources":["../src/releaseTmp.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAU,aAAa,MAAM,EAAE,IAAI,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CA6BxF,CAAA"}
|
package/dist/sherpa.d.ts
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { ProviderClass } from '@builderbot/bot';
|
|
2
|
+
import type { BotContext, Button, SendOptions } from '@builderbot/bot/dist/types';
|
|
3
|
+
import type { PathOrFileDescriptor } from 'fs';
|
|
4
|
+
import NodeCache from 'node-cache';
|
|
5
|
+
import type polka from 'polka';
|
|
6
|
+
import type { IStickerOptions } from 'wa-sticker-formatter';
|
|
7
|
+
|
|
8
|
+
import { BaileysEventMap, WAMessage, WASocket, proto } from './sherpaWrapper';
|
|
9
|
+
import type { SherpaGlobalVendorArgs } from './type';
|
|
10
|
+
declare class SherpaProvider extends ProviderClass<WASocket> {
|
|
11
|
+
globalVendorArgs: SherpaGlobalVendorArgs;
|
|
12
|
+
private reconnectAttempts;
|
|
13
|
+
private maxReconnectAttempts;
|
|
14
|
+
private reconnectDelay;
|
|
15
|
+
msgRetryCounterCache?: NodeCache;
|
|
16
|
+
userDevicesCache?: NodeCache;
|
|
17
|
+
private logger;
|
|
18
|
+
private logStream;
|
|
19
|
+
private idsDuplicates;
|
|
20
|
+
private mapSet;
|
|
21
|
+
constructor(args: Partial<SherpaGlobalVendorArgs>);
|
|
22
|
+
/**
|
|
23
|
+
* Setup cleanup handlers
|
|
24
|
+
* @description
|
|
25
|
+
* - Remove existing listeners to prevent duplicates
|
|
26
|
+
* - Add new listeners
|
|
27
|
+
* - Add cleanup function to all listeners
|
|
28
|
+
* - Add cleanup function to uncaughtException and unhandledRejection
|
|
29
|
+
* - Add cleanup function to SIGINT, SIGTERM, SIGUSR1, SIGUSR2
|
|
30
|
+
* - Add cleanup function to process.exit
|
|
31
|
+
*/
|
|
32
|
+
private setupCleanupHandlers;
|
|
33
|
+
private setupPeriodicCleanup;
|
|
34
|
+
private cleanup;
|
|
35
|
+
releaseSessionFiles(): Promise<void>;
|
|
36
|
+
protected beforeHttpServerInit(): void;
|
|
37
|
+
protected afterHttpServerInit(): void;
|
|
38
|
+
indexHome: polka.Middleware;
|
|
39
|
+
protected getMessage: (key: {
|
|
40
|
+
remoteJid: string;
|
|
41
|
+
id: string;
|
|
42
|
+
}) => Promise<proto.Message>;
|
|
43
|
+
protected saveCredsGlobal: (() => Promise<void>) | null;
|
|
44
|
+
/**
|
|
45
|
+
* Iniciar todo Sherpa
|
|
46
|
+
*/
|
|
47
|
+
protected initVendor: () => Promise<import("whaileys").BaileysEventEmitter & {
|
|
48
|
+
process(handler: (events: Partial<import("whaileys/lib/Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
|
49
|
+
buffer(): boolean;
|
|
50
|
+
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
|
|
51
|
+
flush(): Promise<void>;
|
|
52
|
+
processInBuffer(task: Promise<any>): any;
|
|
53
|
+
}>;
|
|
54
|
+
/**
|
|
55
|
+
* Map native events that the Provider class expects
|
|
56
|
+
* to have a standard set of events
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
59
|
+
protected busEvents: () => {
|
|
60
|
+
event: keyof BaileysEventMap;
|
|
61
|
+
func: (arg?: any, arg2?: any) => any;
|
|
62
|
+
}[];
|
|
63
|
+
/**
|
|
64
|
+
* @param {string} orderId
|
|
65
|
+
* @param {string} orderToken
|
|
66
|
+
* @example await getOrderDetails('order-id', 'order-token')
|
|
67
|
+
*/
|
|
68
|
+
getOrderDetails: (orderId: string, orderToken: string) => Promise<import("whaileys").OrderDetails>;
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated sendPoll is not available in whaileys provider
|
|
71
|
+
* @param {string} number
|
|
72
|
+
* @param {string} text
|
|
73
|
+
* @param {object} poll
|
|
74
|
+
* @returns {Promise<false>}
|
|
75
|
+
*/
|
|
76
|
+
sendPoll: (numberIn: string, text: string, poll: {
|
|
77
|
+
options: string[];
|
|
78
|
+
multiselect: any;
|
|
79
|
+
}) => Promise<false>;
|
|
80
|
+
/**
|
|
81
|
+
* Obtener LID (Local Identifier) para un número de teléfono (PN)
|
|
82
|
+
* @param {string} phoneNumber - Número de teléfono en formato JID (e.g., '1234567890@s.whatsapp.net')
|
|
83
|
+
* @returns {Promise<string|null>} - El LID correspondiente o null si no se encuentra
|
|
84
|
+
* @example await getLIDForPN('1234567890@s.whatsapp.net')
|
|
85
|
+
*/
|
|
86
|
+
getLIDForPN: (phoneNumber: string) => Promise<any>;
|
|
87
|
+
/**
|
|
88
|
+
* Obtener número de teléfono (PN) para un LID (Local Identifier)
|
|
89
|
+
* @param {string} lid - Local Identifier
|
|
90
|
+
* @returns {Promise<string|null>} - El número de teléfono correspondiente o null si no se encuentra
|
|
91
|
+
* @example await getPNForLID('lid:xxxxxx')
|
|
92
|
+
*/
|
|
93
|
+
getPNForLID: (lid: string) => Promise<any>;
|
|
94
|
+
/**
|
|
95
|
+
* @param {string} number
|
|
96
|
+
* @param {string} message
|
|
97
|
+
* @example await sendMessage('+XXXXXXXXXXX', 'https://dominio.com/imagen.jpg' | 'img/imagen.jpg')
|
|
98
|
+
*/
|
|
99
|
+
sendMedia: (number: string, imageUrl: string, text: string) => Promise<proto.WebMessageInfo>;
|
|
100
|
+
/**
|
|
101
|
+
* Enviar imagen
|
|
102
|
+
* @param {*} number
|
|
103
|
+
* @param {*} imageUrl
|
|
104
|
+
* @param {*} text
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
sendImage: (number: string, filePath: string, text: any) => Promise<proto.WebMessageInfo>;
|
|
108
|
+
/**
|
|
109
|
+
* Enviar video
|
|
110
|
+
* @param {*} number
|
|
111
|
+
* @param {*} imageUrl
|
|
112
|
+
* @param {*} text
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
sendVideo: (number: string, filePath: PathOrFileDescriptor, text: any) => Promise<proto.WebMessageInfo>;
|
|
116
|
+
/**
|
|
117
|
+
* Enviar audio
|
|
118
|
+
* @alpha
|
|
119
|
+
* @param {string} number
|
|
120
|
+
* @param {string} message
|
|
121
|
+
* @param {boolean} voiceNote optional
|
|
122
|
+
* @example await sendMessage('+XXXXXXXXXXX', 'audio.mp3')
|
|
123
|
+
*/
|
|
124
|
+
sendAudio: (number: string, audioUrl: string) => Promise<proto.WebMessageInfo>;
|
|
125
|
+
/**
|
|
126
|
+
*
|
|
127
|
+
* @param {string} number
|
|
128
|
+
* @param {string} message
|
|
129
|
+
* @returns
|
|
130
|
+
*/
|
|
131
|
+
sendText: (number: string, message: string) => Promise<proto.WebMessageInfo>;
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
* @param {string} number
|
|
135
|
+
* @param {string} filePath
|
|
136
|
+
* @example await sendMessage('+XXXXXXXXXXX', './document/file.pdf')
|
|
137
|
+
*/
|
|
138
|
+
sendFile: (number: string, filePath: string, text: string) => Promise<proto.WebMessageInfo>;
|
|
139
|
+
/**
|
|
140
|
+
* @deprecated Buttons are not available in this provider, please use sendButtons instead
|
|
141
|
+
* @private
|
|
142
|
+
* @param {string} number
|
|
143
|
+
* @param {string} text
|
|
144
|
+
* @param {string} footer
|
|
145
|
+
* @param {Array} buttons
|
|
146
|
+
* @example await sendMessage("+XXXXXXXXXXX", "Your Text", "Your Footer", [{"buttonId": "id", "buttonText": {"displayText": "Button"}, "type": 1}])
|
|
147
|
+
*/
|
|
148
|
+
sendButtons: (number: string, text: string, buttons: Button[]) => Promise<proto.WebMessageInfo>;
|
|
149
|
+
/**
|
|
150
|
+
* TODO: Necesita terminar de implementar el sendMedia y sendButton guiarse:
|
|
151
|
+
* https://github.com/leifermendez/bot-whatsapp/blob/4e0fcbd8347f8a430adb43351b5415098a5d10df/packages/provider/src/web-whatsapp/index.js#L165
|
|
152
|
+
* @param {string} number
|
|
153
|
+
* @param {string} message
|
|
154
|
+
* @example await sendMessage('+XXXXXXXXXXX', 'Hello World')
|
|
155
|
+
*/
|
|
156
|
+
sendMessage: (numberIn: string, message: string, options?: SendOptions) => Promise<any>;
|
|
157
|
+
/**
|
|
158
|
+
* @param {string} remoteJid
|
|
159
|
+
* @param {string} latitude
|
|
160
|
+
* @param {string} longitude
|
|
161
|
+
* @param {any} messages
|
|
162
|
+
* @example await sendLocation("xxxxxxxxxxx@c.us" || "xxxxxxxxxxxxxxxxxx@g.us", "xx.xxxx", "xx.xxxx", messages)
|
|
163
|
+
*/
|
|
164
|
+
sendLocation: (remoteJid: string, latitude: any, longitude: any, messages?: any) => Promise<{
|
|
165
|
+
status: string;
|
|
166
|
+
}>;
|
|
167
|
+
/**
|
|
168
|
+
* @param {string} remoteJid
|
|
169
|
+
* @param {string} contactNumber
|
|
170
|
+
* @param {string} displayName
|
|
171
|
+
* @param {string} orgName
|
|
172
|
+
* @param {any} messages - optional
|
|
173
|
+
* @example await sendContact("xxxxxxxxxxx@c.us" || "xxxxxxxxxxxxxxxxxx@g.us", "+xxxxxxxxxxx", "Robin Smith", messages)
|
|
174
|
+
*/
|
|
175
|
+
sendContact: (remoteJid: any, contactNumber: {
|
|
176
|
+
replaceAll: (arg0: string, arg1: string) => any;
|
|
177
|
+
}, displayName: string, orgName: string, messages?: any) => Promise<{
|
|
178
|
+
status: string;
|
|
179
|
+
}>;
|
|
180
|
+
/**
|
|
181
|
+
* @param {string} remoteJid
|
|
182
|
+
* @param {string} WAPresence
|
|
183
|
+
* @example await sendPresenceUpdate("xxxxxxxxxxx@c.us" || "xxxxxxxxxxxxxxxxxx@g.us", "recording")
|
|
184
|
+
*/
|
|
185
|
+
sendPresenceUpdate: (remoteJid: any, WAPresence: any) => Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* @param {string} remoteJid
|
|
188
|
+
* @param {string} url
|
|
189
|
+
* @param {object} stickerOptions
|
|
190
|
+
* @param {any} messages - optional
|
|
191
|
+
* @example await sendSticker("xxxxxxxxxxx@c.us" || "xxxxxxxxxxxxxxxxxx@g.us", "https://dn/image.png" || "https://dn/image.gif" || "https://dn/image.mp4", {pack: 'User', author: 'Me'} messages)
|
|
192
|
+
*/
|
|
193
|
+
sendSticker: (remoteJid: any, url: string | Buffer, stickerOptions: Partial<IStickerOptions>, messages?: any) => Promise<void>;
|
|
194
|
+
private getMimeType;
|
|
195
|
+
private generateFileName;
|
|
196
|
+
/**
|
|
197
|
+
* Return Path absolute
|
|
198
|
+
* @param ctx
|
|
199
|
+
* @param options
|
|
200
|
+
* @returns
|
|
201
|
+
*/
|
|
202
|
+
saveFile: (ctx: Partial<WAMessage & BotContext>, options?: {
|
|
203
|
+
path: string;
|
|
204
|
+
}) => Promise<string>;
|
|
205
|
+
private shouldReconnect;
|
|
206
|
+
private delayedReconnect;
|
|
207
|
+
}
|
|
208
|
+
export { SherpaProvider };
|
|
209
|
+
//# sourceMappingURL=sherpa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sherpa.d.ts","sourceRoot":"","sources":["../src/sherpa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ket, BaileysEventMap, AnyMediaMessageContent, AnyMessageContent, downloadMediaMessage, WAMessage, MessageUpsertType, isJidGroup, isJidBroadcast } from 'whaileys';
|
|
2
|
+
export { makeWASocketOther, useMultiFileAuthState, DisconnectReason, proto, makeCacheableSignalKeyStore, getAggregateVotesInPollMessage, WASocket, BaileysEventMap, AnyMediaMessageContent, AnyMessageContent, downloadMediaMessage, WAMessage, MessageUpsertType, isJidGroup, isJidBroadcast, };
|
|
3
|
+
//# sourceMappingURL=sherpaWrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sherpaWrapper.d.ts","sourceRoot":"","sources":["../src/sherpaWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,EAAE,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,cAAc,EACjB,MAAM,UAAU,CAAA;AAEjB,OAAO,EACH,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,UAAU,EACV,cAAc,GACjB,CAAA"}
|
package/dist/type.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { GlobalVendorArgs } from '@builderbot/bot/dist/types';
|
|
2
|
+
import { proto, WABrowserDescription, WAVersion } from 'whaileys';
|
|
3
|
+
export interface SherpaGlobalVendorArgs extends GlobalVendorArgs {
|
|
4
|
+
gifPlayback: boolean;
|
|
5
|
+
usePairingCode: boolean;
|
|
6
|
+
phoneNumber: string | null;
|
|
7
|
+
browser: WABrowserDescription;
|
|
8
|
+
experimentalSyncMessage?: string;
|
|
9
|
+
fallBackAction?: (ctx: proto.IWebMessageInfo) => Promise<void>;
|
|
10
|
+
useBaileysStore: boolean;
|
|
11
|
+
timeRelease?: number;
|
|
12
|
+
experimentalStore?: boolean;
|
|
13
|
+
groupsIgnore: boolean;
|
|
14
|
+
readStatus: boolean;
|
|
15
|
+
version?: WAVersion;
|
|
16
|
+
autoRefresh?: number;
|
|
17
|
+
host?: any;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACjE,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC5D,WAAW,EAAE,OAAO,CAAA;IACpB,cAAc,EAAE,OAAO,CAAA;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,OAAO,EAAE,oBAAoB,CAAA;IAC7B,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9D,eAAe,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,YAAY,EAAE,OAAO,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,GAAG,CAAA;CACb"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const emptyDirSessions: (pathBase: string) => Promise<unknown>;
|
|
2
|
+
/**
|
|
3
|
+
* Cleans the WhatsApp number format.
|
|
4
|
+
* @param number The WhatsApp number to be cleaned.
|
|
5
|
+
* @param full Whether to return the full number format or not.
|
|
6
|
+
* @returns The cleaned number.
|
|
7
|
+
*/
|
|
8
|
+
declare const baileyCleanNumber: (number: string, full?: boolean) => string;
|
|
9
|
+
/**
|
|
10
|
+
* Generates an image from a base64 string.
|
|
11
|
+
* @param base64 The base64 string to generate the image from.
|
|
12
|
+
* @param name The name of the file to write the image to.
|
|
13
|
+
*/
|
|
14
|
+
declare const baileyGenerateImage: (base64: string, name?: string) => Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Validates if the given number is a valid WhatsApp number and not a group ID.
|
|
17
|
+
* @param rawNumber The number to validate.
|
|
18
|
+
* @returns True if it's a valid number, false otherwise.
|
|
19
|
+
*/
|
|
20
|
+
declare const baileyIsValidNumber: (rawNumber: string) => boolean;
|
|
21
|
+
declare const sherpaCleanNumber: (number: string, full?: boolean) => string;
|
|
22
|
+
declare const sherpaGenerateImage: (base64: string, name?: string) => Promise<void>;
|
|
23
|
+
declare const sherpaIsValidNumber: (rawNumber: string) => boolean;
|
|
24
|
+
export { baileyCleanNumber, baileyGenerateImage, baileyIsValidNumber, emptyDirSessions, sherpaCleanNumber, sherpaGenerateImage, sherpaIsValidNumber, };
|
|
25
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,gBAAgB,GAAU,UAAU,MAAM,qBAM1C,CAAA;AACN;;;;;GAKG;AACH,QAAA,MAAM,iBAAiB,GAAI,QAAQ,MAAM,EAAE,OAAM,OAAe,KAAG,MAOlE,CAAA;AAED;;;;GAIG;AACH,QAAA,MAAM,mBAAmB,GAAU,QAAQ,MAAM,EAAE,OAAM,MAAiB,KAAG,OAAO,CAAC,IAAI,CAaxF,CAAA;AAED;;;;GAIG;AACH,QAAA,MAAM,mBAAmB,GAAI,WAAW,MAAM,KAAG,OAKhD,CAAA;AAGD,QAAA,MAAM,iBAAiB,WA1CY,MAAM,SAAQ,OAAO,KAAW,MA0CxB,CAAA;AAC3C,QAAA,MAAM,mBAAmB,WA7BkB,MAAM,SAAQ,MAAM,KAAc,OAAO,CAAC,IAAI,CA6B1C,CAAA;AAC/C,QAAA,MAAM,mBAAmB,cAVe,MAAM,KAAG,OAUF,CAAA;AAE/C,OAAO,EACH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACtB,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@builderbot/provider-sherpa",
|
|
3
|
+
"version": "1.3.11",
|
|
4
|
+
"description": "Provider Sherpa for BuilderBot - WhatsApp integration using Whaileys",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"author": "Leifer Mendez <leifer33@gmail.com>",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"main": "dist/index.cjs",
|
|
9
|
+
"module": "dist/index.mjs",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.mjs",
|
|
15
|
+
"require": "./dist/index.cjs",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "rimraf dist && rollup --config",
|
|
21
|
+
"test": "jest --forceExit",
|
|
22
|
+
"test:coverage": "jest --coverage",
|
|
23
|
+
"test:watch": "jest --watchAll --coverage"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"./dist/"
|
|
27
|
+
],
|
|
28
|
+
"directories": {
|
|
29
|
+
"src": "src",
|
|
30
|
+
"test": "__tests__"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/codigoencasa/bot-whatsapp.git"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/codigoencasa/bot-whatsapp/issues"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/codigoencasa/bot-whatsapp#readme",
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@builderbot/bot": "workspace:*",
|
|
42
|
+
"@hapi/boom": "^10.0.1",
|
|
43
|
+
"@jest/globals": "^29.7.0",
|
|
44
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
45
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
46
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
47
|
+
"@types/cors": "^2.8.17",
|
|
48
|
+
"@types/jest": "^29.5.12",
|
|
49
|
+
"@types/mime-types": "^2.1.4",
|
|
50
|
+
"@types/node": "^20.12.3",
|
|
51
|
+
"@types/qr-image": "^3.2.9",
|
|
52
|
+
"@types/sinon": "^17.0.3",
|
|
53
|
+
"body-parser": "^1.20.2",
|
|
54
|
+
"cors": "^2.8.5",
|
|
55
|
+
"jest": "^29.7.0",
|
|
56
|
+
"mime-types": "^2.1.35",
|
|
57
|
+
"pino": "^7.11.0",
|
|
58
|
+
"polka": "^0.5.2",
|
|
59
|
+
"qr-image": "^3.2.0",
|
|
60
|
+
"rimraf": "^5.0.5",
|
|
61
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
62
|
+
"sinon": "^17.0.1",
|
|
63
|
+
"ts-jest": "^29.1.2",
|
|
64
|
+
"ts-node": "^10.9.2",
|
|
65
|
+
"wa-sticker-formatter": "^4.4.4",
|
|
66
|
+
"wtfnode": "^0.9.2"
|
|
67
|
+
},
|
|
68
|
+
"dependencies": {
|
|
69
|
+
"@adiwajshing/keyed-db": "^0.2.4",
|
|
70
|
+
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
71
|
+
"@types/polka": "^0.5.7",
|
|
72
|
+
"fluent-ffmpeg": "^2.1.2",
|
|
73
|
+
"fs-extra": "^11.2.0",
|
|
74
|
+
"jimp": "^1.6.0",
|
|
75
|
+
"node-cache": "^5.1.2",
|
|
76
|
+
"qrcode-terminal": "^0.12.0",
|
|
77
|
+
"rollup": "^4.48.1",
|
|
78
|
+
"sharp": "0.33.3",
|
|
79
|
+
"tslib": "^2.8.1",
|
|
80
|
+
"typescript": "^5.9.2",
|
|
81
|
+
"whaileys": "6.4.3"
|
|
82
|
+
},
|
|
83
|
+
"gitHead": "1aeef80914d0fa6d23f8a5787998559a5912f110"
|
|
84
|
+
}
|