@builderbot/provider-meta 0.1.3-alpha.22
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/README.md +11 -0
- package/dist/index.cjs +32145 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/metaProvider.d.ts +160 -0
- package/dist/metaProvider.d.ts.map +1 -0
- package/dist/server.d.ts +58 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/types.d.ts +103 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/downloadFile.d.ts +17 -0
- package/dist/utils/downloadFile.d.ts.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/mediaUrl.d.ts +3 -0
- package/dist/utils/mediaUrl.d.ts.map +1 -0
- package/dist/utils/processaIncomingMsg.d.ts +3 -0
- package/dist/utils/processaIncomingMsg.d.ts.map +1 -0
- package/dist/utils/profile.d.ts +4 -0
- package/dist/utils/profile.d.ts.map +1 -0
- package/package.json +59 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { ProviderClass } from '@builderbot/bot';
|
|
2
|
+
import { BotContext, BotCtxMiddlewareOptions, SendOptions } from '@builderbot/bot/dist/types';
|
|
3
|
+
import Queue from 'queue-promise';
|
|
4
|
+
|
|
5
|
+
import { MetaWebHookServer } from './server';
|
|
6
|
+
import { Localization, Message, MetaProviderOptions, Reaction, SaveFileOptions, TextMessageBody } from './types';
|
|
7
|
+
declare class MetaProvider extends ProviderClass {
|
|
8
|
+
http: MetaWebHookServer | undefined;
|
|
9
|
+
jwtToken: string | undefined;
|
|
10
|
+
verifyToken: string | undefined;
|
|
11
|
+
numberId: string | undefined;
|
|
12
|
+
version: string;
|
|
13
|
+
queue: Queue;
|
|
14
|
+
constructor({ jwtToken, numberId, verifyToken, version }: MetaProviderOptions);
|
|
15
|
+
private listenOnEvents;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param port
|
|
19
|
+
* @param opts
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
initHttpServer: (port: number, opts: Pick<BotCtxMiddlewareOptions, 'blacklist'>) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Mapeamos los eventos nativos a los que la clase Provider espera
|
|
25
|
+
* para tener un standar de eventos
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
busEvents: () => {
|
|
29
|
+
event: string;
|
|
30
|
+
func: (payload: any) => void;
|
|
31
|
+
}[];
|
|
32
|
+
/**
|
|
33
|
+
* Sends a message with metadata to the API.
|
|
34
|
+
*
|
|
35
|
+
* @param {Object} body - The body of the message.
|
|
36
|
+
* @return {void} A Promise that resolves when the message is sent.
|
|
37
|
+
*/
|
|
38
|
+
sendMessageMeta(body: TextMessageBody): void;
|
|
39
|
+
/**
|
|
40
|
+
* Sends a message to the API.
|
|
41
|
+
*
|
|
42
|
+
* @param {Object} body - The body of the message.
|
|
43
|
+
* @return {Object} The response data from the API.
|
|
44
|
+
*/
|
|
45
|
+
sendMessageToApi(body: TextMessageBody): Promise<any>;
|
|
46
|
+
sendText: (to: string, message: string) => Promise<void>;
|
|
47
|
+
sendImage: (to: string, mediaInput?: any) => Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param {*} number
|
|
51
|
+
* @param {*} _
|
|
52
|
+
* @param {*} pathVideo
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
sendVideo: (to: string, pathVideo?: any) => Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* @alpha
|
|
58
|
+
* @param {string} number
|
|
59
|
+
* @param {string} message
|
|
60
|
+
* @example await sendMessage('+XXXXXXXXXXX', 'https://dominio.com/imagen.jpg' | 'img/imagen.jpg')
|
|
61
|
+
*/
|
|
62
|
+
sendMedia: (to: string, text: string, mediaInput: string) => Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Enviar listas
|
|
65
|
+
* @param {*} number
|
|
66
|
+
* @param {*} text
|
|
67
|
+
* @param {*} buttons
|
|
68
|
+
* @returns
|
|
69
|
+
*/
|
|
70
|
+
sendLists: (to: string, list: any) => Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Enviar listas alternativo
|
|
73
|
+
* @param {*} number
|
|
74
|
+
* @param {*} header
|
|
75
|
+
* @param {*} text
|
|
76
|
+
* @param {*} footer
|
|
77
|
+
* @param {*} button
|
|
78
|
+
* @param {*} list
|
|
79
|
+
* @returns
|
|
80
|
+
*/
|
|
81
|
+
sendList: (to: string, header: string, text: string, footer: string, button: string, list?: any[]) => Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Enviar buttons
|
|
84
|
+
* @param {*} number
|
|
85
|
+
* @param {*} text
|
|
86
|
+
* @param {*} buttons
|
|
87
|
+
* @returns
|
|
88
|
+
*/
|
|
89
|
+
sendButtons: (to: string, text: string, buttons?: any[]) => Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Enviar buttons only text
|
|
92
|
+
* @param {*} number
|
|
93
|
+
* @param {*} text
|
|
94
|
+
* @param {*} buttons
|
|
95
|
+
* @returns
|
|
96
|
+
*/
|
|
97
|
+
sendButtonsText: (to: string, text: string, buttons?: any[]) => Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Enviar buttons with image
|
|
100
|
+
* @param {*} number
|
|
101
|
+
* @param {*} text
|
|
102
|
+
* @param {*} buttons
|
|
103
|
+
* @param {*} url
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
sendButtonsMedia: (to: string, text: string, buttons: any[], url: string) => Promise<void>;
|
|
107
|
+
/**
|
|
108
|
+
* Enviar plantillas
|
|
109
|
+
* @param {*} number
|
|
110
|
+
* @param {*} template
|
|
111
|
+
* @param {*} languageCode
|
|
112
|
+
* Usarse de acuerdo a cada plantilla en particular, esto solo es un mapeo de como funciona.
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
sendTemplate: (number: any, template: any, languageCode: any) => Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Enviar Contactos
|
|
118
|
+
* @param {*} number
|
|
119
|
+
* @param {*} contact
|
|
120
|
+
* @returns
|
|
121
|
+
*/
|
|
122
|
+
sendContacts: (to: string, contact?: any[]) => Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Enviar catálogo
|
|
125
|
+
* @param {*} number
|
|
126
|
+
* @param {*} bodyText
|
|
127
|
+
* @param {*} itemCatalogId
|
|
128
|
+
* @param {*} footerText
|
|
129
|
+
* @returns
|
|
130
|
+
*/
|
|
131
|
+
sendCatalog: (number: any, bodyText: any, itemCatalogId: any) => Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
* @param {*} userId
|
|
135
|
+
* @param {*} message
|
|
136
|
+
* @param {*} param2
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
sendMessage: (number: string, message: string, options?: SendOptions) => Promise<any>;
|
|
140
|
+
/**
|
|
141
|
+
* Enviar reacción a un mensaje
|
|
142
|
+
* @param {*} number
|
|
143
|
+
* @param {*} react
|
|
144
|
+
*/
|
|
145
|
+
sendReaction: (number: string, react: Reaction) => Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Enviar Ubicación
|
|
148
|
+
* @param {*} longitude
|
|
149
|
+
* @param {*} latitude
|
|
150
|
+
* @param {*} name
|
|
151
|
+
* @param {*} address
|
|
152
|
+
* @returns
|
|
153
|
+
*/
|
|
154
|
+
sendLocation: (to: string, localization: Localization) => Promise<void>;
|
|
155
|
+
saveFile: (ctx: Partial<Message & BotContext>, options?: SaveFileOptions) => Promise<string>;
|
|
156
|
+
sendFile: (to: string, mediaInput?: any) => Promise<void>;
|
|
157
|
+
sendAudio(to: string, fileOpus: string, text: string): void;
|
|
158
|
+
}
|
|
159
|
+
export { MetaProvider };
|
|
160
|
+
//# sourceMappingURL=metaProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metaProvider.d.ts","sourceRoot":"","sources":["../src/metaProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAS,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAoB,uBAAuB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAQ/G,OAAO,KAAK,MAAM,eAAe,CAAA;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAKhH,cAAM,YAAa,SAAQ,aAAa;IACpC,IAAI,EAAE,iBAAiB,GAAG,SAAS,CAAA;IACnC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,OAAO,EAAE,MAAM,CAAU;IACzB,KAAK,EAAE,KAAK,CAAA;gBAEA,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,mBAAmB;IAc7E,OAAO,CAAC,cAAc,CAKrB;IAED;;;;;OAKG;IACH,cAAc,SAAU,MAAM,QAAQ,KAAK,uBAAuB,EAAE,WAAW,CAAC,UAiB/E;IAED;;;;OAIG;IACH,SAAS;;wBAWe,GAAG;QAU1B;IAED;;;;;OAKG;IACH,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI;IAI5C;;;;;OAKG;IACG,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,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// <reference types="node" />
|
|
2
|
+
import { BotCtxMiddleware } from '@builderbot/bot/dist/types';
|
|
3
|
+
import { EventEmitter } from 'node:events';
|
|
4
|
+
import polka, { Polka } from 'polka';
|
|
5
|
+
|
|
6
|
+
import type { MetaProvider } from './metaProvider';
|
|
7
|
+
import { Message } from './types';
|
|
8
|
+
declare class MetaWebHookServer extends EventEmitter {
|
|
9
|
+
server: Polka;
|
|
10
|
+
port: number;
|
|
11
|
+
private token;
|
|
12
|
+
private jwtToken;
|
|
13
|
+
private numberId;
|
|
14
|
+
private version;
|
|
15
|
+
private messageQueue;
|
|
16
|
+
constructor(jwtToken: string, numberId: string, version: string, token: string, metaPort?: number);
|
|
17
|
+
/**
|
|
18
|
+
* Mensaje entrante
|
|
19
|
+
* emit: 'message'
|
|
20
|
+
* @param {*} req
|
|
21
|
+
* @param {*} res
|
|
22
|
+
*/
|
|
23
|
+
protected incomingMsg: (req: any, res: any) => Promise<void>;
|
|
24
|
+
protected processMessage: (message: Message) => Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Valida el token
|
|
27
|
+
* @param {string} mode
|
|
28
|
+
* @param {string} token
|
|
29
|
+
* @returns {boolean}
|
|
30
|
+
*/
|
|
31
|
+
protected tokenIsValid(mode: string, token: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Verificación del token
|
|
34
|
+
* @param {*} req
|
|
35
|
+
* @param {*} res
|
|
36
|
+
*/
|
|
37
|
+
protected verifyToken: (req: any, res: any) => Promise<void>;
|
|
38
|
+
protected emptyCtrl: (_: any, res: any) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Contruir HTTP Server
|
|
41
|
+
*/
|
|
42
|
+
protected buildHTTPServer(): polka.Polka;
|
|
43
|
+
/**
|
|
44
|
+
* Iniciar el servidor HTTP
|
|
45
|
+
*/
|
|
46
|
+
start(vendor: BotCtxMiddleware, port?: number): Promise<void>;
|
|
47
|
+
stop(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param inHandleCtx
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
declare const inHandleCtx: <T extends Pick<MetaProvider, "sendMessage" | "vendor"> & {
|
|
55
|
+
provider: MetaProvider;
|
|
56
|
+
}>(ctxPolka: (bot: T, req: any, res: any) => Promise<void>) => (req: any, res: any) => any;
|
|
57
|
+
export { MetaWebHookServer, inHandleCtx };
|
|
58
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAGpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAIjC,cAAM,iBAAkB,SAAQ,YAAY;IACjC,MAAM,EAAE,KAAK,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,QAAQ,CAAQ;IACxB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,YAAY,CAAO;gBAEf,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAa;IAevG;;;;;OAKG;IACH,SAAS,CAAC,WAAW,QAAe,GAAG,OAAO,GAAG,mBA8BhD;IAED,SAAS,CAAC,cAAc,YAAa,OAAO,KAAG,QAAQ,IAAI,CAAC,CAS3D;IAED;;;;;OAKG;IACH,SAAS,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAIlD;;;;OAIG;IACH,SAAS,CAAC,WAAW,wCAmBpB;IAED,SAAS,CAAC,SAAS,6BAElB;IAED;;OAEG;IACH,SAAS,CAAC,eAAe;IASzB;;OAEG;IACG,KAAK,CAAC,MAAM,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,MAAM;IAuBnD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAWxB;AAED;;;;GAIG;AACH,QAAA,MAAM,WAAW;cACyD,YAAY;2BAC1C,GAAG,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,WAE7D,GAAG,OAAO,GAAG,QAoBlB,CAAA;AAET,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
export interface MediaResponse {
|
|
2
|
+
url?: string;
|
|
3
|
+
}
|
|
4
|
+
export interface Contact {
|
|
5
|
+
name: string;
|
|
6
|
+
phones: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface Order {
|
|
9
|
+
catalog_id: string;
|
|
10
|
+
product_items: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface Message {
|
|
13
|
+
type: string;
|
|
14
|
+
from: string;
|
|
15
|
+
to: string;
|
|
16
|
+
body: string;
|
|
17
|
+
pushName: string;
|
|
18
|
+
name: string;
|
|
19
|
+
url?: string;
|
|
20
|
+
payload?: string;
|
|
21
|
+
title_button_reply?: string;
|
|
22
|
+
title_list_reply?: string;
|
|
23
|
+
latitude?: number;
|
|
24
|
+
longitude?: number;
|
|
25
|
+
contacts?: Contact[];
|
|
26
|
+
order?: Order;
|
|
27
|
+
id?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ParamasIncomingMessage {
|
|
30
|
+
pushName: string;
|
|
31
|
+
to: string;
|
|
32
|
+
jwtToken: string;
|
|
33
|
+
numberId: string;
|
|
34
|
+
version: string;
|
|
35
|
+
message: any;
|
|
36
|
+
}
|
|
37
|
+
export interface TextMessageBody {
|
|
38
|
+
messaging_product: string;
|
|
39
|
+
to: string;
|
|
40
|
+
type: string;
|
|
41
|
+
recipient_type?: string;
|
|
42
|
+
text?: {
|
|
43
|
+
preview_url: boolean;
|
|
44
|
+
body: string;
|
|
45
|
+
};
|
|
46
|
+
image?: {
|
|
47
|
+
id: string;
|
|
48
|
+
};
|
|
49
|
+
video?: {
|
|
50
|
+
id: string;
|
|
51
|
+
};
|
|
52
|
+
interactive?: any;
|
|
53
|
+
contacts?: any[];
|
|
54
|
+
template?: TemplateMessage;
|
|
55
|
+
}
|
|
56
|
+
interface TemplateMessage {
|
|
57
|
+
template: {
|
|
58
|
+
name: string;
|
|
59
|
+
language: {
|
|
60
|
+
code: string;
|
|
61
|
+
};
|
|
62
|
+
components: TemplateComponent[];
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
interface TemplateComponent {
|
|
66
|
+
type: 'header' | 'body' | 'button';
|
|
67
|
+
parameters: TemplateParameter[];
|
|
68
|
+
}
|
|
69
|
+
interface TemplateParameter {
|
|
70
|
+
type: string;
|
|
71
|
+
}
|
|
72
|
+
export interface Reaction {
|
|
73
|
+
message_id: string;
|
|
74
|
+
emoji: string;
|
|
75
|
+
}
|
|
76
|
+
export interface Localization {
|
|
77
|
+
long_number: string;
|
|
78
|
+
lat_number: string;
|
|
79
|
+
name: string;
|
|
80
|
+
address: string;
|
|
81
|
+
}
|
|
82
|
+
export interface MetaProviderOptions {
|
|
83
|
+
jwtToken: string;
|
|
84
|
+
numberId: string;
|
|
85
|
+
verifyToken: string;
|
|
86
|
+
version: string;
|
|
87
|
+
}
|
|
88
|
+
export interface SaveFileOptions {
|
|
89
|
+
path?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface WhatsAppProfile {
|
|
92
|
+
verified_name: string;
|
|
93
|
+
code_verification_status: string;
|
|
94
|
+
display_phone_number: string;
|
|
95
|
+
quality_rating: string;
|
|
96
|
+
platform_type: string;
|
|
97
|
+
throughput: {
|
|
98
|
+
level: string;
|
|
99
|
+
};
|
|
100
|
+
id: string;
|
|
101
|
+
}
|
|
102
|
+
export {};
|
|
103
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;CACf;AACD,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,KAAK;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,EAAE,CAAA;CAC1B;AAED,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAA;IACpB,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,sBAAsB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,GA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,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,eAAe;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC5B,aAAa,EAAE,MAAM,CAAA;IACrB,wBAAwB,EAAE,MAAM,CAAA;IAChC,oBAAoB,EAAE,MAAM,CAAA;IAC5B,cAAc,EAAE,MAAM,CAAA;IACtB,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE;QACR,KAAK,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,EAAE,EAAE,MAAM,CAAA;CACb"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { AxiosResponse } from 'axios';
|
|
3
|
+
/**
|
|
4
|
+
* Extraer el mimetype from buffer
|
|
5
|
+
* @param response - La respuesta HTTP
|
|
6
|
+
* @returns Un objeto con el tipo y la extensión del archivo
|
|
7
|
+
*/
|
|
8
|
+
declare const fileTypeFromFile: (response: AxiosResponse) => Promise<{
|
|
9
|
+
type: string | null;
|
|
10
|
+
ext: string | false;
|
|
11
|
+
}>;
|
|
12
|
+
declare function downloadFile(url: string, Token: string): Promise<{
|
|
13
|
+
buffer: Buffer;
|
|
14
|
+
extension: string;
|
|
15
|
+
}>;
|
|
16
|
+
export { downloadFile, fileTypeFromFile };
|
|
17
|
+
//# sourceMappingURL=downloadFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downloadFile.d.ts","sourceRoot":"","sources":["../../src/utils/downloadFile.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAG1C;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,aAAoB,aAAa;UAAmB,MAAM,GAAG,IAAI;SAAO,MAAM,GAAG,KAAK;EAO3G,CAAA;AAED,iBAAe,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBtG;AAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mediaUrl.d.ts","sourceRoot":"","sources":["../../src/utils/mediaUrl.ts"],"names":[],"mappings":"AAKA,iBAAe,WAAW,CACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe7B;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processaIncomingMsg.d.ts","sourceRoot":"","sources":["../../src/utils/processaIncomingMsg.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAE1D,eAAO,MAAM,sBAAsB,4DAOhC,sBAAsB,KAAG,QAAQ,OAAO,CA2J1C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,iBAAe,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAcpG;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@builderbot/provider-meta",
|
|
3
|
+
"version": "0.1.3-alpha.22",
|
|
4
|
+
"description": "> TODO: description",
|
|
5
|
+
"author": "vicente1992 <vic_ortiz20@hotmail.es>",
|
|
6
|
+
"homepage": "https://github.com/vicente1992/bot-whatsapp#readme",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"main": "dist/index.cjs",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"directories": {
|
|
12
|
+
"src": "src",
|
|
13
|
+
"test": "__tests__"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"./dist/"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/vicente1992/bot-whatsapp.git"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "rimraf dist && rollup --config",
|
|
24
|
+
"test": " npx uvu -r tsm ./__tests__ .test.ts",
|
|
25
|
+
"test:coverage": "npx c8 npm run test",
|
|
26
|
+
"test:debug": " npx tsm --inspect-brk ../../node_modules/uvu/bin.js ./__tests__ .test.ts"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/vicente1992/bot-whatsapp/issues"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"axios": "^1.6.5",
|
|
33
|
+
"body-parser": "^1.20.2",
|
|
34
|
+
"file-type": "^19.0.0",
|
|
35
|
+
"form-data": "^4.0.0",
|
|
36
|
+
"mime-types": "^2.1.35",
|
|
37
|
+
"polka": "^0.5.2",
|
|
38
|
+
"queue-promise": "^2.2.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@builderbot/bot": "^0.1.3-alpha.22",
|
|
42
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
43
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
44
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
45
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
46
|
+
"@types/node": "^20.11.0",
|
|
47
|
+
"@types/polka": "^0.5.7",
|
|
48
|
+
"@types/sinon": "^17.0.3",
|
|
49
|
+
"kleur": "^4.1.5",
|
|
50
|
+
"proxyquire": "^2.1.3",
|
|
51
|
+
"rimraf": "^3.0.2",
|
|
52
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
53
|
+
"sinon": "^17.0.1",
|
|
54
|
+
"supertest": "^6.3.4",
|
|
55
|
+
"tslib": "^2.6.2",
|
|
56
|
+
"tsm": "^2.3.0"
|
|
57
|
+
},
|
|
58
|
+
"gitHead": "e52a9fe13d30d65b650a54b6e116953c949b1158"
|
|
59
|
+
}
|