@wabot-dev/framework 0.5.7 → 0.5.9
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/dist/src/addon/chat-controller/cmd/CmdChannel.js +6 -2
- package/dist/src/addon/chat-controller/cmd/cmdChannelName.js +3 -0
- package/dist/src/addon/chat-controller/socket/SocketChannel.js +6 -2
- package/dist/src/addon/chat-controller/socket/socketChannelName.js +3 -0
- package/dist/src/addon/chat-controller/telegram/TelegramChannel.js +6 -2
- package/dist/src/addon/chat-controller/telegram/telegramChannelName.js +3 -0
- package/dist/src/addon/chat-controller/wasender/@whatsAppByWasender.js +20 -0
- package/dist/src/addon/chat-controller/wasender/WasenderWebhookController.js +82 -0
- package/dist/src/addon/chat-controller/wasender/WhatsAppByWasenderChannel.js +67 -0
- package/dist/src/addon/chat-controller/wasender/WhatsAppByWasenderChannelConfig.js +16 -0
- package/dist/src/addon/chat-controller/wasender/WhatsAppReceiverByWasender.js +39 -0
- package/dist/src/addon/chat-controller/wasender/WhatsAppSenderByWasender.js +33 -0
- package/dist/src/addon/chat-controller/wasender/extractNumberFromWasenderKey.js +5 -0
- package/dist/src/addon/chat-controller/wasender/whatsAppByWasenderChannelName.js +3 -0
- package/dist/src/addon/chat-controller/whatsapp/WhatsAppChannel.js +3 -0
- package/dist/src/addon/chat-controller/whatsapp/cloud-api/WhatsAppReceiverByCloudApi.js +2 -2
- package/dist/src/addon/chat-controller/whatsapp/proxy/WhatsAppReceiverByWabotProxy.js +2 -1
- package/dist/src/addon/chat-controller/whatsapp/whatsAppChannelName.js +3 -0
- package/dist/src/addon/chat-controller/whatsapp-by-wasender/@whatsAppByWasender.js +20 -0
- package/dist/src/addon/chat-controller/whatsapp-by-wasender/WhatsAppByWasenderChannel.js +52 -0
- package/dist/src/addon/chat-controller/whatsapp-by-wasender/WhatsAppByWasenderChannelConfig.js +16 -0
- package/dist/src/addon/chat-controller/whatsapp-by-wasender/WhatsAppReceiverByWasender.js +106 -0
- package/dist/src/addon/chat-controller/whatsapp-by-wasender/WhatsAppSenderByWasender.js +40 -0
- package/dist/src/addon/chat-controller/whatsapp-by-wasender/extractNumberFromWasenderKey.js +5 -0
- package/dist/src/feature/rest-controller/metadata/RestControllerMetadataStore.js +35 -8
- package/dist/src/index.d.ts +203 -7
- package/dist/src/index.js +12 -0
- package/dist/src/node_modules/wasenderapi/dist/index.js +553 -0
- package/package.json +3 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import { Logger } from '../../../core/logger/Logger.js';
|
|
3
|
+
import { injectable } from '../../../core/injection/index.js';
|
|
4
|
+
import { createWasender } from '../../../node_modules/wasenderapi/dist/index.js';
|
|
5
|
+
import { WhatsAppByWasenderChannelConfig } from './WhatsAppByWasenderChannelConfig.js';
|
|
6
|
+
|
|
7
|
+
let WhatsAppSenderByWasender = class WhatsAppSenderByWasender {
|
|
8
|
+
wasender;
|
|
9
|
+
logger = new Logger('wabot:whatsapp-sender-by-wasender');
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.wasender = createWasender(config.apiKey, undefined, undefined, undefined, config.retryOptions, undefined);
|
|
12
|
+
}
|
|
13
|
+
async send(request) {
|
|
14
|
+
try {
|
|
15
|
+
const textPayload = {
|
|
16
|
+
messageType: 'text',
|
|
17
|
+
to: `+${request.to.replace(/\D+/g, '')}`,
|
|
18
|
+
text: request.message.text ?? 'No Text',
|
|
19
|
+
};
|
|
20
|
+
const result = await this.wasender.send(textPayload);
|
|
21
|
+
this.logger.trace(`message sent from '${request.from}' to '${request.to}'`);
|
|
22
|
+
this.logger.trace(`rate limit remaining: ${result.rateLimit?.remaining}`);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
this.logger.error(`Failed to send message from '${request.from}' to '${request.to}'`, error);
|
|
26
|
+
if (error instanceof Error) {
|
|
27
|
+
throw new Error(error.message, { cause: error });
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
throw new Error('error sending message');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
WhatsAppSenderByWasender = __decorate([
|
|
36
|
+
injectable(),
|
|
37
|
+
__metadata("design:paramtypes", [WhatsAppByWasenderChannelConfig])
|
|
38
|
+
], WhatsAppSenderByWasender);
|
|
39
|
+
|
|
40
|
+
export { WhatsAppSenderByWasender };
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import { singleton } from '../../../core/injection/index.js';
|
|
3
3
|
|
|
4
|
+
function getClassHierarchy(cls) {
|
|
5
|
+
const classes = [];
|
|
6
|
+
let proto = Object.getPrototypeOf(cls.prototype);
|
|
7
|
+
while (proto && proto.constructor !== Object) {
|
|
8
|
+
classes.push(proto.constructor);
|
|
9
|
+
proto = Object.getPrototypeOf(proto);
|
|
10
|
+
}
|
|
11
|
+
return classes;
|
|
12
|
+
}
|
|
4
13
|
let RestControllerMetadataStore = class RestControllerMetadataStore {
|
|
5
14
|
endPoints = new Map();
|
|
6
15
|
middlewares = new Map();
|
|
@@ -31,16 +40,34 @@ let RestControllerMetadataStore = class RestControllerMetadataStore {
|
|
|
31
40
|
if (!controller) {
|
|
32
41
|
throw new Error(`${controllerConstructor.name} should be decorated with @restController`);
|
|
33
42
|
}
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
const hierarchy = [controllerConstructor, ...getClassHierarchy(controllerConstructor)];
|
|
44
|
+
const endPointsMap = new Map();
|
|
45
|
+
for (const cls of [...hierarchy].reverse()) {
|
|
46
|
+
const classEndPoints = this.endPoints.get(cls);
|
|
47
|
+
if (classEndPoints) {
|
|
48
|
+
for (const [name, endPoint] of classEndPoints) {
|
|
49
|
+
endPointsMap.set(name, endPoint);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (!endPointsMap.size) {
|
|
37
54
|
return [];
|
|
38
55
|
}
|
|
39
|
-
return [...
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
56
|
+
return [...endPointsMap.values()].map((endPoint) => {
|
|
57
|
+
const middlewares = [];
|
|
58
|
+
for (const cls of [...hierarchy].reverse()) {
|
|
59
|
+
const classMiddlewares = this.middlewares.get(cls)?.get(endPoint.functionName);
|
|
60
|
+
if (classMiddlewares) {
|
|
61
|
+
middlewares.push(...classMiddlewares);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
...endPoint,
|
|
66
|
+
controllerConstructor,
|
|
67
|
+
middlewares,
|
|
68
|
+
controller,
|
|
69
|
+
};
|
|
70
|
+
});
|
|
44
71
|
}
|
|
45
72
|
};
|
|
46
73
|
RestControllerMetadataStore = __decorate([
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { DependencyContainer } from 'tsyringe';
|
|
|
4
4
|
import InjectionToken from 'tsyringe/dist/typings/providers/injection-token';
|
|
5
5
|
import DependencyContainer, { PreResolutionInterceptorCallback, PostResolutionInterceptorCallback } from 'tsyringe/dist/typings/types/dependency-container';
|
|
6
6
|
import InterceptionOptions from 'tsyringe/dist/typings/types/interceptor-options';
|
|
7
|
-
import { Server } from 'http';
|
|
7
|
+
import { Server, IncomingMessage } from 'http';
|
|
8
8
|
import { Express, Request, Response } from 'express';
|
|
9
9
|
import * as big_js from 'big.js';
|
|
10
10
|
import { Pool, PoolClient } from 'pg';
|
|
@@ -12,6 +12,7 @@ import { AsyncLocalStorage } from 'async_hooks';
|
|
|
12
12
|
import { Server as Server$1, Socket } from 'socket.io';
|
|
13
13
|
import { Algorithm } from 'jsonwebtoken';
|
|
14
14
|
import { Socket as Socket$1 } from 'socket.io-client';
|
|
15
|
+
import { Wasender } from 'wasenderapi';
|
|
15
16
|
|
|
16
17
|
type IStorablePrimitive = null | number | string | boolean | undefined;
|
|
17
18
|
|
|
@@ -1209,11 +1210,11 @@ declare class RestControllerMetadataStore {
|
|
|
1209
1210
|
saveEndPointMetadata(endPointMetadata: IEndPointMetadata): void;
|
|
1210
1211
|
saveMiddlewareMetadata(middlewareMetadata: IMiddlewareMetadata): void;
|
|
1211
1212
|
getControllerEndPointsInfo(controllerConstructor: IConstructor<any>): {
|
|
1213
|
+
controllerConstructor: IConstructor<any>;
|
|
1212
1214
|
middlewares: IMiddlewareMetadata[];
|
|
1213
1215
|
controller: IRestControllerMetadata;
|
|
1214
1216
|
method: "get" | "post" | "put" | "delete";
|
|
1215
1217
|
config?: IEndPointConfig;
|
|
1216
|
-
controllerConstructor: IConstructor<any>;
|
|
1217
1218
|
functionName: string;
|
|
1218
1219
|
paramsTypes: any[];
|
|
1219
1220
|
}[];
|
|
@@ -1596,13 +1597,25 @@ declare class WabotChatAdapter implements IChatAdapter {
|
|
|
1596
1597
|
|
|
1597
1598
|
declare function cmd(): (target: object, propertyKey: string | symbol) => void;
|
|
1598
1599
|
|
|
1600
|
+
declare const cmdChannelName: "CmdChannel";
|
|
1601
|
+
|
|
1602
|
+
interface ICmdReceivedMessage extends IReceivedMessage {
|
|
1603
|
+
channel: typeof cmdChannelName;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
interface ICmdChannelMessage extends ICmdReceivedMessage {
|
|
1607
|
+
chatConnection: IChatConnection;
|
|
1608
|
+
injectInstances?: [any, any][];
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1599
1611
|
declare class CmdChannel implements IChatChannel {
|
|
1600
1612
|
private auth;
|
|
1601
1613
|
private chatId;
|
|
1602
1614
|
private rl;
|
|
1615
|
+
static channelName: "CmdChannel";
|
|
1603
1616
|
private callBack;
|
|
1604
1617
|
constructor(auth: Auth<any>);
|
|
1605
|
-
listen(callback: (message:
|
|
1618
|
+
listen(callback: (message: ICmdChannelMessage) => Promise<void>): void;
|
|
1606
1619
|
disconnect(): void;
|
|
1607
1620
|
connect(): void;
|
|
1608
1621
|
}
|
|
@@ -1622,6 +1635,17 @@ declare class SocketChannelConfig implements ISocketChannelConfig {
|
|
|
1622
1635
|
|
|
1623
1636
|
declare function socket(config: SocketChannelConfig): (target: object, propertyKey: string | symbol) => void;
|
|
1624
1637
|
|
|
1638
|
+
declare const socketChannelName: "SocketChannel";
|
|
1639
|
+
|
|
1640
|
+
interface ISocketReceivedMessage extends IReceivedMessage {
|
|
1641
|
+
channel: typeof socketChannelName;
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
interface ISocketChannelMessage extends ISocketReceivedMessage {
|
|
1645
|
+
chatConnection: IChatConnection;
|
|
1646
|
+
injectInstances?: [any, any][];
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1625
1649
|
interface ISocketChannelReceivedMessage {
|
|
1626
1650
|
chatId: string;
|
|
1627
1651
|
senderName: string;
|
|
@@ -1634,11 +1658,12 @@ declare class SocketChannelReceivedMessage implements ISocketChannelReceivedMess
|
|
|
1634
1658
|
}
|
|
1635
1659
|
declare class SocketChannel implements IChatChannel {
|
|
1636
1660
|
private config;
|
|
1661
|
+
static channelName: "SocketChannel";
|
|
1637
1662
|
private callBack;
|
|
1638
1663
|
private controller;
|
|
1639
1664
|
constructor(config: SocketChannelConfig);
|
|
1640
1665
|
private configController;
|
|
1641
|
-
listen(callback: (message:
|
|
1666
|
+
listen(callback: (message: ISocketChannelMessage) => Promise<void>): void;
|
|
1642
1667
|
connect(): void;
|
|
1643
1668
|
disconnect(): void;
|
|
1644
1669
|
}
|
|
@@ -1653,11 +1678,23 @@ declare class TelegramChannelConfig implements ITelegramChannelConfig {
|
|
|
1653
1678
|
|
|
1654
1679
|
declare function telegram(config: ITelegramChannelConfig): (target: object, propertyKey: string | symbol) => void;
|
|
1655
1680
|
|
|
1681
|
+
declare const telegramChannelName: "TelegramChannel";
|
|
1682
|
+
|
|
1683
|
+
interface ITelegramReceivedMessage extends IReceivedMessage {
|
|
1684
|
+
channel: typeof telegramChannelName;
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
interface ITelegramChannelMessage extends ITelegramReceivedMessage {
|
|
1688
|
+
chatConnection: IChatConnection;
|
|
1689
|
+
injectInstances?: [any, any][];
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1656
1692
|
declare class TelegramChannel implements IChatChannel {
|
|
1657
1693
|
private config;
|
|
1694
|
+
static channelName: "TelegramChannel";
|
|
1658
1695
|
private bot;
|
|
1659
1696
|
constructor(config: TelegramChannelConfig);
|
|
1660
|
-
listen(callback: (message:
|
|
1697
|
+
listen(callback: (message: ITelegramChannelMessage) => Promise<void>): void;
|
|
1661
1698
|
connect(): void;
|
|
1662
1699
|
disconnect(): void;
|
|
1663
1700
|
}
|
|
@@ -1818,13 +1855,25 @@ declare class WhatsAppSender {
|
|
|
1818
1855
|
protected replaceTemplateParameters(template: string, data: IWhatsAppCloudTemplateParameter[]): string;
|
|
1819
1856
|
}
|
|
1820
1857
|
|
|
1858
|
+
declare const whatsAppChannelName: "WhatsAppChannel";
|
|
1859
|
+
|
|
1860
|
+
interface IWhatsAppReceivedMessage extends IReceivedMessage {
|
|
1861
|
+
channel: typeof whatsAppChannelName;
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1864
|
+
interface IWhatsAppChannelMessage extends IWhatsAppReceivedMessage {
|
|
1865
|
+
chatConnection: IChatConnection;
|
|
1866
|
+
injectInstances?: [any, any][];
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1821
1869
|
declare class WhatsAppChannel implements IChatChannel {
|
|
1822
1870
|
private config;
|
|
1823
1871
|
private sender;
|
|
1824
1872
|
private receiver;
|
|
1873
|
+
static channelName: "WhatsAppChannel";
|
|
1825
1874
|
private logger;
|
|
1826
1875
|
constructor(config: WhatsappChannelConfig, sender: WhatsAppSender, receiver: WhatsAppReceiver);
|
|
1827
|
-
listen(callback: (message:
|
|
1876
|
+
listen(callback: (message: IWhatsAppChannelMessage) => Promise<void>): void;
|
|
1828
1877
|
connect(): void;
|
|
1829
1878
|
disconnect(): void;
|
|
1830
1879
|
}
|
|
@@ -1958,6 +2007,153 @@ declare class WhatsAppSenderByWabotProxy extends WhatsAppSender {
|
|
|
1958
2007
|
sendWhatsApp(request: ISendWhatsAppRequest, options?: IWhatsAppSenderOptions): Promise<void>;
|
|
1959
2008
|
}
|
|
1960
2009
|
|
|
2010
|
+
interface IWhatsAppByWasenderChannelConfig {
|
|
2011
|
+
apiKey?: string;
|
|
2012
|
+
webhookSecret?: string;
|
|
2013
|
+
phoneNumber?: string;
|
|
2014
|
+
webhookPath?: string;
|
|
2015
|
+
retryOptions?: {
|
|
2016
|
+
enabled: boolean;
|
|
2017
|
+
maxRetries: number;
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
declare function whatsAppByWasender(config?: IWhatsAppByWasenderChannelConfig): (target: object, propertyKey: string | symbol) => void;
|
|
2022
|
+
|
|
2023
|
+
type IWasenderEvent = IWasenderMessageReceivedEvent | IWasenderQrUpdatedEvent;
|
|
2024
|
+
interface IWasenderQrUpdatedEvent {
|
|
2025
|
+
event: 'qrcode.updated';
|
|
2026
|
+
}
|
|
2027
|
+
interface IWasenderMessageReceivedEvent {
|
|
2028
|
+
event: 'messages.received';
|
|
2029
|
+
sessionId: string;
|
|
2030
|
+
data: {
|
|
2031
|
+
messages: IWasenderMessageReceivedData | IWasenderMessageReceivedData[];
|
|
2032
|
+
};
|
|
2033
|
+
timestamp: number;
|
|
2034
|
+
}
|
|
2035
|
+
interface IWasenderMessageReceivedData {
|
|
2036
|
+
key: IWasenderMessageKey;
|
|
2037
|
+
messageTimestamp: number;
|
|
2038
|
+
pushName: string;
|
|
2039
|
+
broadcast: boolean;
|
|
2040
|
+
message: IWasenderMessageContent;
|
|
2041
|
+
remoteJid: string;
|
|
2042
|
+
id: string;
|
|
2043
|
+
}
|
|
2044
|
+
interface IWasenderMessageKey {
|
|
2045
|
+
remoteJid: string;
|
|
2046
|
+
fromMe: boolean;
|
|
2047
|
+
id: string;
|
|
2048
|
+
senderLid: string;
|
|
2049
|
+
senderPn?: string;
|
|
2050
|
+
cleanedSenderPn?: string;
|
|
2051
|
+
}
|
|
2052
|
+
interface IWasenderMessageContent {
|
|
2053
|
+
conversation: string;
|
|
2054
|
+
messageContextInfo: IWasenderMessageContextInfo;
|
|
2055
|
+
}
|
|
2056
|
+
interface IWasenderMessageContextInfo {
|
|
2057
|
+
deviceListMetadata: IWasenderDeviceListMetadata;
|
|
2058
|
+
deviceListMetadataVersion: number;
|
|
2059
|
+
messageSecret: string;
|
|
2060
|
+
}
|
|
2061
|
+
interface IWasenderDeviceListMetadata {
|
|
2062
|
+
senderKeyHash: string;
|
|
2063
|
+
senderTimestamp: string;
|
|
2064
|
+
recipientKeyHash: string;
|
|
2065
|
+
recipientTimestamp: string;
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
declare class WhatsAppByWasenderChannelConfig implements IWhatsAppByWasenderChannelConfig {
|
|
2069
|
+
readonly apiKey?: string;
|
|
2070
|
+
readonly webhookSecret?: string;
|
|
2071
|
+
readonly phoneNumber?: string;
|
|
2072
|
+
readonly webhookPath: string;
|
|
2073
|
+
readonly retryOptions: {
|
|
2074
|
+
enabled: boolean;
|
|
2075
|
+
maxRetries: number;
|
|
2076
|
+
};
|
|
2077
|
+
constructor(config: IWhatsAppByWasenderChannelConfig);
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
interface IWhatsAppByWasenderChatMessage extends IChatMessage {
|
|
2081
|
+
metadata: {
|
|
2082
|
+
whatsAppNumber: string;
|
|
2083
|
+
};
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
declare const whatsAppByWasenderChannelName: "WhatsAppByWasenderChannel";
|
|
2087
|
+
|
|
2088
|
+
interface IWhatsAppByWasenderReceivedMessage extends IReceivedMessage {
|
|
2089
|
+
channel: typeof whatsAppByWasenderChannelName;
|
|
2090
|
+
message: IWhatsAppByWasenderChatMessage;
|
|
2091
|
+
}
|
|
2092
|
+
|
|
2093
|
+
interface IWhatsAppByWasenderChannelMessage extends IWhatsAppByWasenderReceivedMessage {
|
|
2094
|
+
chatConnection: IChatConnection;
|
|
2095
|
+
injectInstances?: [any, any][];
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
declare class WhatsAppByWasenderChannel implements IChatChannel {
|
|
2099
|
+
private logger;
|
|
2100
|
+
private sender;
|
|
2101
|
+
private receiver;
|
|
2102
|
+
private phoneNumber;
|
|
2103
|
+
static channelName: "WhatsAppByWasenderChannel";
|
|
2104
|
+
constructor(config: WhatsAppByWasenderChannelConfig, env: Env);
|
|
2105
|
+
listen(callback: (message: IWhatsAppByWasenderChannelMessage) => Promise<void>): void;
|
|
2106
|
+
connect(): void;
|
|
2107
|
+
disconnect(): void;
|
|
2108
|
+
}
|
|
2109
|
+
|
|
2110
|
+
type IWasenderChannelMessageListener = (message: IWhatsAppByWasenderChatMessage, from: string) => Promise<void>;
|
|
2111
|
+
declare class WasenderWebhookController {
|
|
2112
|
+
private wasender;
|
|
2113
|
+
private listener;
|
|
2114
|
+
private logger;
|
|
2115
|
+
constructor(wasender: Wasender, listener: IWasenderChannelMessageListener);
|
|
2116
|
+
handleWebhook(req: IncomingMessage): Promise<void>;
|
|
2117
|
+
private handleMessages;
|
|
2118
|
+
private parseEvent;
|
|
2119
|
+
private getRawBody;
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
declare class WhatsAppReceiverByWasender {
|
|
2123
|
+
private config;
|
|
2124
|
+
private wasender;
|
|
2125
|
+
private listener;
|
|
2126
|
+
constructor(config: {
|
|
2127
|
+
apiKey: string;
|
|
2128
|
+
webhookSecret: string;
|
|
2129
|
+
webhookPath: string;
|
|
2130
|
+
retryOptions?: {
|
|
2131
|
+
enabled: boolean;
|
|
2132
|
+
maxRetries: number;
|
|
2133
|
+
};
|
|
2134
|
+
});
|
|
2135
|
+
listenMessage(listener: IWasenderChannelMessageListener): void;
|
|
2136
|
+
connect(): void;
|
|
2137
|
+
disconnect(): void;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
interface ISendByWasenderRequest {
|
|
2141
|
+
from: string;
|
|
2142
|
+
to: string;
|
|
2143
|
+
message: IChatMessage;
|
|
2144
|
+
}
|
|
2145
|
+
declare class WhatsAppSenderByWasender {
|
|
2146
|
+
private wasender;
|
|
2147
|
+
private logger;
|
|
2148
|
+
constructor(apiKey: string, retryOptions?: {
|
|
2149
|
+
enabled: boolean;
|
|
2150
|
+
maxRetries: number;
|
|
2151
|
+
});
|
|
2152
|
+
send(request: ISendByWasenderRequest): Promise<void>;
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
declare function extractNumberFromWasenderMessageKey(key: IWasenderMessageKey): string;
|
|
2156
|
+
|
|
1961
2157
|
interface IHtmlModuleOptions {
|
|
1962
2158
|
url: string;
|
|
1963
2159
|
title: string;
|
|
@@ -1966,4 +2162,4 @@ declare function HtmlModule(options: IHtmlModuleOptions): {
|
|
|
1966
2162
|
new (): {};
|
|
1967
2163
|
};
|
|
1968
2164
|
|
|
1969
|
-
export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, AsyncMetadataStore, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, type ClientMap, CmdChannel, Container, ControllerMetadataStore, CronJob, CronJobRepository, CustomError, DeepSeekChatAdapter, DescriptionMetadataStore, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, type ErrorSeverity, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemsReq, type IChatAdapterNextItemsRes, type IChatAssociation, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICronConfig, type ICronJobData, type ICrudRepository, type ICustomErrorData, type IDescriptionMetadata, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IErrorHandlersConfig, type IErrorMonitor, type IErrorMonitorContext, type IFunctionCall, type IFunctionCallItem, type IGenerateApiKeyReq, type IGenerateApiKeyRes, type IGetWhatsAppTemplateRequest, type IHandshakeMiddleware, type IHandshakeMiddlewareMetadata, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type IListenWhatsAppMessageRequest, type ILockKey, type ILocker, type ILockerKey, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetConfig, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleMetadata, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IPersistentData, type IPgRepositoryConfig, type IPropertyValidatorInfo, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRestControllerConfig, type IRestControllerMetadata, type IScheduleAt, type IScheduleDelay, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelReceivedMessage, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type IStorableData, type ITelegramChannelConfig, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateIsRecordOptions, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppCloudContact, type IWhatsAppCloudMessage, type IWhatsAppCloudMessageMetadata, type IWhatsAppCloudTemplate, type IWhatsAppCloudTemplateComponent, type IWhatsAppCloudTemplateMessage, type IWhatsAppCloudTemplateParameter, type IWhatsAppCloudTemplateResponse, type IWhatsAppCloudWebhookPayload, type IWhatsAppData, type IWhatsAppMessageListener, type IWhatsAppProxyListenMessageEventData, type IWhatsAppProxyListenMessageEventReq, type IWhatsAppProxyMessage, type IWhatsAppProxyMessageContent, type IWhatsAppProxyMessageEventReq, type IWhatsAppProxySendMessageEventReq, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsappChannelConfig, type IchatControllerConfig, Job, JobRepository, JobRunner, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtGuardMiddleware, JwtHandshakeGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Locker, Logger, Mapper, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenaiChatAdapter, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCronJobRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgLockKey, PgLocker, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RemoteApiKeyRepository, RestControllerMetadataStore, RestRequest, SocketChannel, SocketChannelConfig, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerConfig, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WhatsApp, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, apiKeyHandshakeGuard, chatBot, chatController, chatItemTypeOptions, cmd, command, commandHandler, container, cron, description, extractChatMessageText, getClientMap, getPgClient, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isRecord, isString, jwtGuard, jwtHandshakeGuard, max, middleware, min, mindset, mindsetModule, modelInfo, onDelete, onGet, onPost, onPut, onSocketEvent, pgStorage, readJsonFromFile, restController, runChatControllers, runCommandHandlers, runCronHandlers, runRestControllers, runSocketControllers, safeJsonParse, scoped, setupErrorHandlers, singleton, socket, socketController, stopCommandHandlers, stopCronHandlers, telegram, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsRecord, validateIsString, validateMax, validateMin, validateModel, whatsApp, withPgClient, withPgTransaction, writeJsonToFile };
|
|
2165
|
+
export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, AsyncMetadataStore, Auth, Chat, ChatAdapter, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatRepository, ChatResolver, type ClientMap, CmdChannel, Container, ControllerMetadataStore, CronJob, CronJobRepository, CustomError, DeepSeekChatAdapter, DescriptionMetadataStore, EXPRESS_REQ, EXPRESS_RES, Entity, Env, EnvWhatsAppRepository, type ErrorSeverity, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterNextItemsReq, type IChatAdapterNextItemsRes, type IChatAssociation, type IChatBot, type IChatBotMetadata, type IChatChannel, type IChatConnection, type IChatControllerMetadata, type IChatData, type IChatItem, type IChatItemData, type IChatItemType, type IChatMemory, type IChatMessage, type IChatRepository, type IChatType, type ICmdChannelMessage, type ICmdReceivedMessage, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICronConfig, type ICronJobData, type ICrudRepository, type ICustomErrorData, type IDescriptionMetadata, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IErrorHandlersConfig, type IErrorMonitor, type IErrorMonitorContext, type IFunctionCall, type IFunctionCallItem, type IGenerateApiKeyReq, type IGenerateApiKeyRes, type IGetWhatsAppTemplateRequest, type IHandshakeMiddleware, type IHandshakeMiddlewareMetadata, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type IListenWhatsAppMessageRequest, type ILockKey, type ILocker, type ILockerKey, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetConfig, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModuleConfig, type IMindsetModuleMetadata, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IPersistentData, type IPgRepositoryConfig, type IPropertyValidatorInfo, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRestControllerConfig, type IRestControllerMetadata, type IScheduleAt, type IScheduleDelay, type ISendByWasenderRequest, type ISendWhatsAppRequest, type ISendWhatsAppTemplateRequest, type ISocketChannelConfig, type ISocketChannelMessage, type ISocketChannelReceivedMessage, type ISocketControllerConfig, type ISocketControllerMetadata, type ISocketEventConfig, type ISocketEventMetadata, type ISocketReceivedMessage, type IStorableData, type ITelegramChannelConfig, type ITelegramChannelMessage, type ITelegramReceivedMessage, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateIsRecordOptions, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWasenderChannelMessageListener, type IWasenderDeviceListMetadata, type IWasenderEvent, type IWasenderMessageContent, type IWasenderMessageContextInfo, type IWasenderMessageKey, type IWasenderMessageReceivedData, type IWasenderMessageReceivedEvent, type IWasenderQrUpdatedEvent, type IWhatsAppBusinessAccount, type IWhatsAppBusinessNumber, type IWhatsAppByWasenderChannelConfig, type IWhatsAppByWasenderReceivedMessage, type IWhatsAppChannelMessage, type IWhatsAppCloudContact, type IWhatsAppCloudMessage, type IWhatsAppCloudMessageMetadata, type IWhatsAppCloudTemplate, type IWhatsAppCloudTemplateComponent, type IWhatsAppCloudTemplateMessage, type IWhatsAppCloudTemplateParameter, type IWhatsAppCloudTemplateResponse, type IWhatsAppCloudWebhookPayload, type IWhatsAppData, type IWhatsAppMessageListener, type IWhatsAppProxyListenMessageEventData, type IWhatsAppProxyListenMessageEventReq, type IWhatsAppProxyMessage, type IWhatsAppProxyMessageContent, type IWhatsAppProxyMessageEventReq, type IWhatsAppProxySendMessageEventReq, type IWhatsAppReceivedMessage, type IWhatsAppRepository, type IWhatsAppSenderOptions, type IWhatsappChannelConfig, type IchatControllerConfig, Job, JobRepository, JobRunner, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtGuardMiddleware, JwtHandshakeGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Locker, Logger, Mapper, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenaiChatAdapter, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCronJobRepository, PgCrudRepository, PgJobRepository, PgJwtRefreshTokenRepository, PgLockKey, PgLocker, PgRepositoryBase, PgWhatsAppRepository, RamChatMemory, RamChatRepository, Random, RemoteApiKeyRepository, RestControllerMetadataStore, RestRequest, SocketChannel, SocketChannelConfig, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerConfig, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, ValidationMetadataStore, WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT, WabotChatAdapter, WasenderWebhookController, WhatsApp, WhatsAppByWasenderChannel, WhatsAppByWasenderChannelConfig, WhatsAppChannel, WhatsAppReceiver, WhatsAppReceiverByCloudApi, WhatsAppReceiverByWabotProxy, WhatsAppReceiverByWasender, WhatsAppRepository, WhatsAppSender, WhatsAppSenderByCloudApi, WhatsAppSenderByWabotProxy, WhatsAppSenderByWasender, WhatsAppWabotProxyConnection, WhatsappChannelConfig, apiKeyGuard, apiKeyHandshakeGuard, chatBot, chatController, chatItemTypeOptions, cmd, cmdChannelName, command, commandHandler, container, cron, description, extractChatMessageText, extractNumberFromWasenderMessageKey, getClientMap, getPgClient, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isRecord, isString, jwtGuard, jwtHandshakeGuard, max, middleware, min, mindset, mindsetModule, modelInfo, onDelete, onGet, onPost, onPut, onSocketEvent, pgStorage, readJsonFromFile, restController, runChatControllers, runCommandHandlers, runCronHandlers, runRestControllers, runSocketControllers, safeJsonParse, scoped, setupErrorHandlers, singleton, socket, socketChannelName, socketController, stopCommandHandlers, stopCronHandlers, telegram, telegramChannelName, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsRecord, validateIsString, validateMax, validateMin, validateModel, whatsApp, whatsAppByWasender, whatsAppByWasenderChannelName, whatsAppChannelName, withPgClient, withPgTransaction, writeJsonToFile };
|
package/dist/src/index.js
CHANGED
|
@@ -133,12 +133,15 @@ export { RamChatRepository } from './addon/chat-bot/ram/RamChatRepository.js';
|
|
|
133
133
|
export { WabotChatAdapter } from './addon/chat-bot/wabot/WabotChatAdapter.js';
|
|
134
134
|
export { cmd } from './addon/chat-controller/cmd/@cmd.js';
|
|
135
135
|
export { CmdChannel, readJsonFromFile, writeJsonToFile } from './addon/chat-controller/cmd/CmdChannel.js';
|
|
136
|
+
export { cmdChannelName } from './addon/chat-controller/cmd/cmdChannelName.js';
|
|
136
137
|
export { socket } from './addon/chat-controller/socket/@socket.js';
|
|
137
138
|
export { SocketChannel, SocketChannelReceivedMessage } from './addon/chat-controller/socket/SocketChannel.js';
|
|
138
139
|
export { SocketChannelConfig } from './addon/chat-controller/socket/SocketChannelConfig.js';
|
|
140
|
+
export { socketChannelName } from './addon/chat-controller/socket/socketChannelName.js';
|
|
139
141
|
export { telegram } from './addon/chat-controller/telegram/@telegram.js';
|
|
140
142
|
export { TelegramChannelConfig } from './addon/chat-controller/telegram/TelegramChannelConfig.js';
|
|
141
143
|
export { TelegramChannel } from './addon/chat-controller/telegram/TelegramChannel.js';
|
|
144
|
+
export { telegramChannelName } from './addon/chat-controller/telegram/telegramChannelName.js';
|
|
142
145
|
export { whatsApp } from './addon/chat-controller/whatsapp/@whatsApp.js';
|
|
143
146
|
export { EnvWhatsAppRepository } from './addon/chat-controller/whatsapp/EnvWhatsAppRepository.js';
|
|
144
147
|
export { PgWhatsAppRepository } from './addon/chat-controller/whatsapp/PgWhatsAppRepository.js';
|
|
@@ -148,11 +151,20 @@ export { WhatsappChannelConfig } from './addon/chat-controller/whatsapp/WhatsApp
|
|
|
148
151
|
export { WhatsAppReceiver } from './addon/chat-controller/whatsapp/WhatsAppReceiver.js';
|
|
149
152
|
export { WhatsAppRepository } from './addon/chat-controller/whatsapp/WhatsAppRepository.js';
|
|
150
153
|
export { WhatsAppSender } from './addon/chat-controller/whatsapp/WhatsAppSender.js';
|
|
154
|
+
export { whatsAppChannelName } from './addon/chat-controller/whatsapp/whatsAppChannelName.js';
|
|
151
155
|
export { WhatsAppReceiverByCloudApi } from './addon/chat-controller/whatsapp/cloud-api/WhatsAppReceiverByCloudApi.js';
|
|
152
156
|
export { WhatsAppSenderByCloudApi } from './addon/chat-controller/whatsapp/cloud-api/WhatsAppSenderByCloudApi.js';
|
|
153
157
|
export { WHATSAPP_MESSAGE_EVENT, WHATSAPP_PROXY_LISTEN_MESSAGE_EVENT, WHATSAPP_PROXY_SEND_MESSAGE_EVENT } from './addon/chat-controller/whatsapp/proxy/WhatsAppProxyContracts.js';
|
|
154
158
|
export { WhatsAppReceiverByWabotProxy } from './addon/chat-controller/whatsapp/proxy/WhatsAppReceiverByWabotProxy.js';
|
|
155
159
|
export { WhatsAppSenderByWabotProxy } from './addon/chat-controller/whatsapp/proxy/WhatsAppSenderByWabotProxy.js';
|
|
156
160
|
export { WhatsAppWabotProxyConnection } from './addon/chat-controller/whatsapp/proxy/WhatsAppWabotProxyConnection.js';
|
|
161
|
+
export { whatsAppByWasender } from './addon/chat-controller/wasender/@whatsAppByWasender.js';
|
|
162
|
+
export { WhatsAppByWasenderChannel } from './addon/chat-controller/wasender/WhatsAppByWasenderChannel.js';
|
|
163
|
+
export { WhatsAppByWasenderChannelConfig } from './addon/chat-controller/wasender/WhatsAppByWasenderChannelConfig.js';
|
|
164
|
+
export { WhatsAppReceiverByWasender } from './addon/chat-controller/wasender/WhatsAppReceiverByWasender.js';
|
|
165
|
+
export { WhatsAppSenderByWasender } from './addon/chat-controller/wasender/WhatsAppSenderByWasender.js';
|
|
166
|
+
export { WasenderWebhookController } from './addon/chat-controller/wasender/WasenderWebhookController.js';
|
|
167
|
+
export { extractNumberFromWasenderMessageKey } from './addon/chat-controller/wasender/extractNumberFromWasenderKey.js';
|
|
168
|
+
export { whatsAppByWasenderChannelName } from './addon/chat-controller/wasender/whatsAppByWasenderChannelName.js';
|
|
157
169
|
export { HtmlModule } from './addon/mindset/html/HtmlModule.js';
|
|
158
170
|
export { Container } from './core/injection/Container.js';
|