@wabot-dev/framework 0.9.19 → 0.9.20
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/whatsapp/kapso/@kapso.js +23 -0
- package/dist/src/addon/chat-controller/whatsapp/kapso/KapsoChannel.js +65 -0
- package/dist/src/addon/chat-controller/whatsapp/kapso/KapsoChannelConfig.js +14 -0
- package/dist/src/addon/chat-controller/whatsapp/kapso/KapsoChannelName.js +3 -0
- package/dist/src/addon/chat-controller/whatsapp/kapso/KapsoReceiver.js +36 -0
- package/dist/src/addon/chat-controller/whatsapp/kapso/KapsoSender.js +44 -0
- package/dist/src/addon/chat-controller/whatsapp/kapso/KapsoWebhookController.js +99 -0
- package/dist/src/index.d.ts +125 -1
- package/dist/src/index.js +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { container } from '../../../../core/injection/index.js';
|
|
2
|
+
import { resolveConfigReferences } from '../../../../core/config/resolver.js';
|
|
3
|
+
import { ControllerMetadataStore } from '../../../../feature/chat-controller/metadata/ControllerMetadataStore.js';
|
|
4
|
+
import '../../../../feature/chat-controller/ChatResolver.js';
|
|
5
|
+
import '../../../../feature/chat-controller/runChatControllers.js';
|
|
6
|
+
import { KapsoChannel } from './KapsoChannel.js';
|
|
7
|
+
import { KapsoChannelConfig } from './KapsoChannelConfig.js';
|
|
8
|
+
|
|
9
|
+
function kapso(config) {
|
|
10
|
+
return function (target, propertyKey) {
|
|
11
|
+
const cfg = config ?? {};
|
|
12
|
+
const resolvedConfig = resolveConfigReferences(cfg);
|
|
13
|
+
const store = container.resolve(ControllerMetadataStore);
|
|
14
|
+
store.saveChannelMetadata({
|
|
15
|
+
channelConstructor: KapsoChannel,
|
|
16
|
+
functionName: propertyKey.toString(),
|
|
17
|
+
controllerConstructor: target.constructor,
|
|
18
|
+
channelConfig: new KapsoChannelConfig(resolvedConfig),
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { kapso };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import { injectable } from '../../../../core/injection/index.js';
|
|
3
|
+
import { Env } from '../../../../core/env/Env.js';
|
|
4
|
+
import { Logger } from '../../../../core/logger/Logger.js';
|
|
5
|
+
import { KapsoChannelConfig } from './KapsoChannelConfig.js';
|
|
6
|
+
import { KapsoReceiver } from './KapsoReceiver.js';
|
|
7
|
+
import { KapsoSender } from './KapsoSender.js';
|
|
8
|
+
import { kapsoChannelName } from './KapsoChannelName.js';
|
|
9
|
+
|
|
10
|
+
var KapsoChannel_1;
|
|
11
|
+
let KapsoChannel = class KapsoChannel {
|
|
12
|
+
static { KapsoChannel_1 = this; }
|
|
13
|
+
logger = new Logger('wabot:whatsapp-by-kapso-channel');
|
|
14
|
+
sender;
|
|
15
|
+
receiver;
|
|
16
|
+
phoneNumberId;
|
|
17
|
+
static channelName = kapsoChannelName;
|
|
18
|
+
constructor(config, env) {
|
|
19
|
+
const apiKey = config.apiKey ?? env.requireString('KAPSO_API_KEY');
|
|
20
|
+
const webhookSecret = config.webhookSecret ?? process.env.KAPSO_WEBHOOK_SECRET;
|
|
21
|
+
this.phoneNumberId = config.phoneNumberId ?? env.requireString('KAPSO_PHONE_NUMBER_ID');
|
|
22
|
+
this.sender = new KapsoSender(apiKey, this.phoneNumberId);
|
|
23
|
+
this.receiver = new KapsoReceiver({
|
|
24
|
+
webhookSecret,
|
|
25
|
+
webhookPath: config.webhookPath,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
listen(callback) {
|
|
29
|
+
this.receiver.listenMessage(async (message, from) => {
|
|
30
|
+
try {
|
|
31
|
+
await callback({
|
|
32
|
+
channel: kapsoChannelName,
|
|
33
|
+
chatConnection: {
|
|
34
|
+
chatType: 'PRIVATE',
|
|
35
|
+
channelName: KapsoChannel_1.channelName,
|
|
36
|
+
id: from,
|
|
37
|
+
},
|
|
38
|
+
message,
|
|
39
|
+
reply: async (replyMessage) => {
|
|
40
|
+
await this.sender.sendMessage({
|
|
41
|
+
from: this.phoneNumberId,
|
|
42
|
+
to: from,
|
|
43
|
+
message: replyMessage,
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
this.logger.error('Failed to handle WhatsApp message', err);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
connect() {
|
|
54
|
+
this.receiver.connect();
|
|
55
|
+
}
|
|
56
|
+
disconnect() {
|
|
57
|
+
this.receiver.disconnect();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
KapsoChannel = KapsoChannel_1 = __decorate([
|
|
61
|
+
injectable(),
|
|
62
|
+
__metadata("design:paramtypes", [KapsoChannelConfig, Env])
|
|
63
|
+
], KapsoChannel);
|
|
64
|
+
|
|
65
|
+
export { KapsoChannel };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class KapsoChannelConfig {
|
|
2
|
+
apiKey;
|
|
3
|
+
webhookSecret;
|
|
4
|
+
phoneNumberId;
|
|
5
|
+
webhookPath;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.apiKey = config.apiKey;
|
|
8
|
+
this.webhookSecret = config.webhookSecret;
|
|
9
|
+
this.phoneNumberId = config.phoneNumberId;
|
|
10
|
+
this.webhookPath = config.webhookPath ?? '/kapso/hook';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { KapsoChannelConfig };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import '../../../../core/injection/index.js';
|
|
3
|
+
import '../../../../feature/rest-controller/metadata/RestControllerMetadataStore.js';
|
|
4
|
+
import { restController } from '../../../../feature/rest-controller/metadata/@restController.js';
|
|
5
|
+
import { runRestControllers } from '../../../../feature/rest-controller/runRestControllers.js';
|
|
6
|
+
import { KapsoWebhookController } from './KapsoWebhookController.js';
|
|
7
|
+
|
|
8
|
+
class KapsoReceiver {
|
|
9
|
+
config;
|
|
10
|
+
listener = null;
|
|
11
|
+
constructor(config) {
|
|
12
|
+
this.config = config;
|
|
13
|
+
}
|
|
14
|
+
listenMessage(listener) {
|
|
15
|
+
this.listener = listener;
|
|
16
|
+
}
|
|
17
|
+
connect() {
|
|
18
|
+
const webhookSecret = this.config.webhookSecret;
|
|
19
|
+
const listener = this.listener;
|
|
20
|
+
let UniqueController = class UniqueController extends KapsoWebhookController {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(webhookSecret, listener);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
UniqueController = __decorate([
|
|
26
|
+
restController(this.config.webhookPath),
|
|
27
|
+
__metadata("design:paramtypes", [])
|
|
28
|
+
], UniqueController);
|
|
29
|
+
runRestControllers([UniqueController]);
|
|
30
|
+
}
|
|
31
|
+
disconnect() {
|
|
32
|
+
// Nothing to disconnect
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { KapsoReceiver };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Logger } from '../../../../core/logger/Logger.js';
|
|
2
|
+
|
|
3
|
+
class KapsoSender {
|
|
4
|
+
apiKey;
|
|
5
|
+
phoneNumberId;
|
|
6
|
+
logger = new Logger('wabot:whatsapp-sender-by-kapso');
|
|
7
|
+
baseUrl = 'https://api.kapso.ai/meta/whatsapp/v24.0';
|
|
8
|
+
constructor(apiKey, phoneNumberId) {
|
|
9
|
+
this.apiKey = apiKey;
|
|
10
|
+
this.phoneNumberId = phoneNumberId;
|
|
11
|
+
}
|
|
12
|
+
async sendMessage(request) {
|
|
13
|
+
const url = `${this.baseUrl}/${this.phoneNumberId}/messages`;
|
|
14
|
+
const payload = {
|
|
15
|
+
messaging_product: 'whatsapp',
|
|
16
|
+
recipient_type: 'individual',
|
|
17
|
+
to: request.to.replace(/\D+/g, ''),
|
|
18
|
+
type: 'text',
|
|
19
|
+
text: {
|
|
20
|
+
preview_url: false,
|
|
21
|
+
body: request.message.text ?? '',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
const response = await fetch(url, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: {
|
|
27
|
+
'X-API-Key': this.apiKey,
|
|
28
|
+
'Content-Type': 'application/json',
|
|
29
|
+
},
|
|
30
|
+
body: JSON.stringify(payload),
|
|
31
|
+
});
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
const errorBody = await response.text();
|
|
34
|
+
this.logger.error(`Failed to send message from '${request.from}' to '${request.to}': ${response.status} ${errorBody}`);
|
|
35
|
+
throw new Error(`Kapso send message failed: ${response.status} ${errorBody}`);
|
|
36
|
+
}
|
|
37
|
+
this.logger.trace(`message sent from '${request.from}' to '${request.to}'`);
|
|
38
|
+
}
|
|
39
|
+
async sendTemplate(_request) {
|
|
40
|
+
throw new Error('Method not implemented.');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { KapsoSender };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
3
|
+
import { IncomingMessage } from 'node:http';
|
|
4
|
+
import { Logger } from '../../../../core/logger/Logger.js';
|
|
5
|
+
import '../../../../core/injection/index.js';
|
|
6
|
+
import '../../../../feature/rest-controller/metadata/RestControllerMetadataStore.js';
|
|
7
|
+
import { onPost } from '../../../../feature/rest-controller/metadata/@onPost.js';
|
|
8
|
+
|
|
9
|
+
class KapsoWebhookController {
|
|
10
|
+
webhookSecret;
|
|
11
|
+
listener;
|
|
12
|
+
logger = new Logger('wabot:kapso-webhook');
|
|
13
|
+
constructor(webhookSecret, listener) {
|
|
14
|
+
this.webhookSecret = webhookSecret;
|
|
15
|
+
this.listener = listener;
|
|
16
|
+
}
|
|
17
|
+
async handleWebhook(req) {
|
|
18
|
+
const rawBody = await this.getRawBody(req);
|
|
19
|
+
if (!this.verifySignature(req, rawBody)) {
|
|
20
|
+
this.logger.warn('rejected webhook with invalid signature');
|
|
21
|
+
throw new Error('Invalid webhook signature');
|
|
22
|
+
}
|
|
23
|
+
let event;
|
|
24
|
+
try {
|
|
25
|
+
event = JSON.parse(rawBody);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
this.logger.error('Failed to parse webhook payload', err);
|
|
29
|
+
throw new Error('Invalid webhook payload');
|
|
30
|
+
}
|
|
31
|
+
this.logger.trace(`received event ${event.event}`);
|
|
32
|
+
switch (event.event) {
|
|
33
|
+
case 'whatsapp.message.received':
|
|
34
|
+
await this.handleMessageReceived(event);
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
this.logger.trace(`unhandled event type ${event.event}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async handleMessageReceived(event) {
|
|
41
|
+
const message = event.message;
|
|
42
|
+
if (message.type !== 'text' || !message.text) {
|
|
43
|
+
this.logger.warn(`message type '${message.type}' is not supported yet`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const rawNumber = message.from ?? event.conversation?.phone_number ?? '';
|
|
47
|
+
if (!rawNumber) {
|
|
48
|
+
this.logger.warn('received message without a sender number');
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const from = rawNumber.startsWith('+') ? rawNumber : `+${rawNumber}`;
|
|
52
|
+
const senderName = event.conversation?.kapso?.contact_name ?? message.username ?? from;
|
|
53
|
+
this.logger.trace(`new message from '${from}'`);
|
|
54
|
+
await this.listener({
|
|
55
|
+
text: message.text.body,
|
|
56
|
+
senderName,
|
|
57
|
+
senderId: from,
|
|
58
|
+
metadata: {
|
|
59
|
+
whatsAppNumber: from,
|
|
60
|
+
},
|
|
61
|
+
}, from);
|
|
62
|
+
}
|
|
63
|
+
verifySignature(req, rawBody) {
|
|
64
|
+
if (!this.webhookSecret) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
const headerValue = req.headers['x-webhook-signature'];
|
|
68
|
+
const provided = Array.isArray(headerValue) ? headerValue[0] : headerValue;
|
|
69
|
+
if (!provided) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const expected = createHmac('sha256', this.webhookSecret).update(rawBody).digest('hex');
|
|
73
|
+
const providedHex = provided.startsWith('sha256=') ? provided.slice('sha256='.length) : provided;
|
|
74
|
+
const expectedBuf = Buffer.from(expected, 'hex');
|
|
75
|
+
const providedBuf = Buffer.from(providedHex, 'hex');
|
|
76
|
+
if (expectedBuf.length !== providedBuf.length) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return timingSafeEqual(expectedBuf, providedBuf);
|
|
80
|
+
}
|
|
81
|
+
getRawBody(req) {
|
|
82
|
+
return new Promise((resolve, reject) => {
|
|
83
|
+
let data = '';
|
|
84
|
+
req.on('data', (chunk) => {
|
|
85
|
+
data += chunk;
|
|
86
|
+
});
|
|
87
|
+
req.on('end', () => resolve(data));
|
|
88
|
+
req.on('error', (err) => reject(err));
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
__decorate([
|
|
93
|
+
onPost({ disableJsonParser: true, disableUrlEncodedParser: true }),
|
|
94
|
+
__metadata("design:type", Function),
|
|
95
|
+
__metadata("design:paramtypes", [IncomingMessage]),
|
|
96
|
+
__metadata("design:returntype", Promise)
|
|
97
|
+
], KapsoWebhookController.prototype, "handleWebhook", null);
|
|
98
|
+
|
|
99
|
+
export { KapsoWebhookController };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2355,6 +2355,130 @@ declare class WhatsAppApiSender implements IWhatsAppSender {
|
|
|
2355
2355
|
sendTemplate(request: ISendWhatsAppTemplateReq): Promise<void>;
|
|
2356
2356
|
}
|
|
2357
2357
|
|
|
2358
|
+
interface IKapsoChannelConfig {
|
|
2359
|
+
apiKey?: string | ConfigReference<string>;
|
|
2360
|
+
webhookSecret?: string | ConfigReference<string>;
|
|
2361
|
+
phoneNumberId?: string | ConfigReference<string>;
|
|
2362
|
+
webhookPath?: string;
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
declare function kapso(config?: IKapsoChannelConfig): (target: object, propertyKey: string | symbol) => void;
|
|
2366
|
+
|
|
2367
|
+
interface IKapsoChatMessage extends IChatMessage {
|
|
2368
|
+
metadata: {
|
|
2369
|
+
whatsAppNumber: string;
|
|
2370
|
+
};
|
|
2371
|
+
}
|
|
2372
|
+
|
|
2373
|
+
declare const kapsoChannelName: "WhatsAppByKapsoChannel";
|
|
2374
|
+
|
|
2375
|
+
interface IKapsoReceivedMessage extends IReceivedMessage {
|
|
2376
|
+
channel: typeof kapsoChannelName;
|
|
2377
|
+
message: IKapsoChatMessage;
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
interface IKapsoChannelMessage extends IKapsoReceivedMessage {
|
|
2381
|
+
chatConnection: IChatConnection;
|
|
2382
|
+
injectInstances?: [any, any][];
|
|
2383
|
+
}
|
|
2384
|
+
|
|
2385
|
+
type IKapsoEvent = IKapsoMessageReceivedEvent | IKapsoUnknownEvent;
|
|
2386
|
+
interface IKapsoUnknownEvent {
|
|
2387
|
+
event: string;
|
|
2388
|
+
[key: string]: unknown;
|
|
2389
|
+
}
|
|
2390
|
+
interface IKapsoMessageReceivedEvent {
|
|
2391
|
+
event: 'whatsapp.message.received';
|
|
2392
|
+
message: IKapsoIncomingMessage;
|
|
2393
|
+
conversation: IKapsoConversation;
|
|
2394
|
+
is_new_conversation?: boolean;
|
|
2395
|
+
phone_number_id?: string;
|
|
2396
|
+
}
|
|
2397
|
+
interface IKapsoIncomingMessage {
|
|
2398
|
+
id: string;
|
|
2399
|
+
timestamp: string;
|
|
2400
|
+
type: string;
|
|
2401
|
+
from: string;
|
|
2402
|
+
from_user_id?: string;
|
|
2403
|
+
from_parent_user_id?: string;
|
|
2404
|
+
username?: string;
|
|
2405
|
+
text?: {
|
|
2406
|
+
body: string;
|
|
2407
|
+
};
|
|
2408
|
+
}
|
|
2409
|
+
interface IKapsoConversation {
|
|
2410
|
+
id: string;
|
|
2411
|
+
phone_number?: string;
|
|
2412
|
+
business_scoped_user_id?: string;
|
|
2413
|
+
parent_business_scoped_user_id?: string;
|
|
2414
|
+
username?: string;
|
|
2415
|
+
status?: string;
|
|
2416
|
+
phone_number_id?: string;
|
|
2417
|
+
kapso?: {
|
|
2418
|
+
contact_name?: string;
|
|
2419
|
+
[key: string]: unknown;
|
|
2420
|
+
};
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
declare class KapsoChannelConfig {
|
|
2424
|
+
readonly apiKey?: string;
|
|
2425
|
+
readonly webhookSecret?: string;
|
|
2426
|
+
readonly phoneNumberId?: string;
|
|
2427
|
+
readonly webhookPath: string;
|
|
2428
|
+
constructor(config: {
|
|
2429
|
+
apiKey?: string;
|
|
2430
|
+
webhookSecret?: string;
|
|
2431
|
+
phoneNumberId?: string;
|
|
2432
|
+
webhookPath?: string;
|
|
2433
|
+
});
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
declare class KapsoChannel implements IChatChannel {
|
|
2437
|
+
private logger;
|
|
2438
|
+
private sender;
|
|
2439
|
+
private receiver;
|
|
2440
|
+
private phoneNumberId;
|
|
2441
|
+
static channelName: "WhatsAppByKapsoChannel";
|
|
2442
|
+
constructor(config: KapsoChannelConfig, env: Env);
|
|
2443
|
+
listen(callback: (message: IKapsoChannelMessage) => Promise<void>): void;
|
|
2444
|
+
connect(): void;
|
|
2445
|
+
disconnect(): void;
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
type IKapsoChannelMessageListener = (message: IKapsoChatMessage, from: string) => Promise<void>;
|
|
2449
|
+
declare class KapsoWebhookController {
|
|
2450
|
+
private webhookSecret;
|
|
2451
|
+
private listener;
|
|
2452
|
+
private logger;
|
|
2453
|
+
constructor(webhookSecret: string | undefined, listener: IKapsoChannelMessageListener);
|
|
2454
|
+
handleWebhook(req: IncomingMessage): Promise<void>;
|
|
2455
|
+
private handleMessageReceived;
|
|
2456
|
+
private verifySignature;
|
|
2457
|
+
private getRawBody;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
declare class KapsoReceiver {
|
|
2461
|
+
private config;
|
|
2462
|
+
private listener;
|
|
2463
|
+
constructor(config: {
|
|
2464
|
+
webhookSecret?: string;
|
|
2465
|
+
webhookPath: string;
|
|
2466
|
+
});
|
|
2467
|
+
listenMessage(listener: IKapsoChannelMessageListener): void;
|
|
2468
|
+
connect(): void;
|
|
2469
|
+
disconnect(): void;
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
declare class KapsoSender implements IWhatsAppSender {
|
|
2473
|
+
private apiKey;
|
|
2474
|
+
private phoneNumberId;
|
|
2475
|
+
private logger;
|
|
2476
|
+
private baseUrl;
|
|
2477
|
+
constructor(apiKey: string, phoneNumberId: string);
|
|
2478
|
+
sendMessage(request: ISendWhatsAppMessageReq): Promise<void>;
|
|
2479
|
+
sendTemplate(_request: ISendWhatsAppTemplateReq): Promise<void>;
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2358
2482
|
interface IWasenderChannelConfig {
|
|
2359
2483
|
apiKey?: string | ConfigReference<string>;
|
|
2360
2484
|
webhookSecret?: string | ConfigReference<string>;
|
|
@@ -2524,4 +2648,4 @@ declare function HtmlModule(options: IHtmlModuleOptions): {
|
|
|
2524
2648
|
new (): {};
|
|
2525
2649
|
};
|
|
2526
2650
|
|
|
2527
|
-
export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, AsyncMetadataStore, Auth, Chat, ChatAdapter, ChatAdapterMetadataStore, ChatAdapterRegistry, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatOperator, ChatRepository, ChatResolver, type ClientMap, CmdChannel, CmdChannelConfig, CmdChannelServer, type CmdClientMessage, type CmdServerMessage, type ConfigReference, type ConfigReferenceType, ConfigResolver, Container, ControllerMetadataStore, CronJob, CronJobRepository, CrudRepository, CustomError, DeepSeekChatAdapter, DescriptionMetadataStore, EXPRESS_REQ, EXPRESS_RES, Entity, Env, type ErrorSeverity, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IBuiltQuery, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterDecoratorConfig, type IChatAdapterMetadata, 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 IChatMessageDocument, type IChatMessageFile, type IChatMessageImage, type IChatMessagesPrivateFile, type IChatMessagesPublicFile, type IChatRepository, type IChatType, type ICmdChannelEntry, type ICmdChannelHandlers, type ICmdChannelMessage, type ICmdReceivedMessage, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICronConfig, type ICronHandler, type ICronJobData, type ICronJobRepository, type ICrudRepository, type ICustomErrorData, type IDescriptionMetadata, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IErrorHandlersConfig, type IErrorMonitor, type IErrorMonitorContext, type IExtractChatMessageTextOptions, type IFunctionCall, type IFunctionCallItem, type IGenerateApiKeyReq, type IGenerateApiKeyRes, type IHandshakeMiddleware, type IHandshakeMiddlewareMetadata, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type ILanguageModelUsage, type ILockKey, type ILocker, type ILockerKey, type IMemoryRepositoryAdapterOptions, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetConfig, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModelKind, type IMindsetModelRef, type IMindsetModels, type IMindsetModuleConfig, type IMindsetModuleMetadata, type IMindsetParameterSchema, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IPersistentData, type IPgRepositoryConfig, type IProjectRunnerConfig, type IPropertyValidatorInfo, type IQueryAst, type IQueryCondition, type IQueryMethodMetadata, type IQueryOrderBy, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRepositoryAdapter, type IRepositoryConfig, type IRepositoryRuntime, type IRestControllerConfig, type IRestControllerMetadata, type IScanProjectFilesOptions, type IScheduleAt, type IScheduleDelay, type ISendWhatsAppMessageReq, type ISendWhatsAppTemplateReq, 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 ITransactionAdapter, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateIsRecordOptions, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWasenderChannelConfig, type IWasenderChannelMessageListener, type IWasenderDeviceListMetadata, type IWasenderEvent, type IWasenderMessageContent, type IWasenderMessageContextInfo, type IWasenderMessageKey, type IWasenderMessageReceivedData, type IWasenderMessageReceivedEvent, type IWasenderQrUpdatedEvent, type IWasenderReceivedMessage, type IWhatsAppCloudContact, type IWhatsAppCloudMessage, type IWhatsAppCloudMessageMetadata, type IWhatsAppCloudTemplate, type IWhatsAppCloudTemplateComponent, type IWhatsAppCloudTemplateResponse, type IWhatsAppCloudWebhookPayload, type IWhatsAppSender, type IWhatsAppTemplateData, type IWhatsAppTemplateParameter, type IchatControllerConfig, InMemoryChatMemory, InMemoryChatRepository, InMemoryCronJobRepository, InMemoryJobRepository, InMemoryLockKey, InMemoryLocker, Job, JobRepository, JobRunner, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtGuardMiddleware, JwtHandshakeGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, Lifecycle, Locker, Logger, MEMORY_ADAPTER_ID, Mapper, MemoryRepositoryAdapter, MemoryRepositoryExtension, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenRouterChatAdapter, OpenaiChatAdapter, PG_ADAPTER_ID, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCronJobRepository, PgCrudRepository, PgJobRepository, PgJsonRepositoryAdapter, PgJwtRefreshTokenRepository, PgLockKey, PgLocker, PgRepositoryBase, PgRepositoryBase as PgRepositoryExtension, PgTransactionAdapter, ProjectRunner, type QueryConnector, type QueryOperator, type QueryPrefix, Random, RemoteApiKeyRepository, RepositoryAdapterRegistry, RepositoryMetadataStore, type ResolvedConfig, RestControllerMetadataStore, RestRequest, SocketChannel, SocketChannelConfig, SocketChannelMessageFile, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerConfig, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, TransactionMetadataStore, UnionChatAdapter, ValidationMetadataStore, WabotChatAdapter, WasenderChannel, WasenderChannelConfig, WasenderReceiver, WasenderSender, WasenderWebhookController, WhatsAppApiSender, WhatsAppReceiverByCloudApi, WhatsAppSender, apiKeyGuard, apiKeyHandshakeGuard, bool, boolArr, buildQuerySql, chatAdapter, chatBot, chatController, chatItemTypeOptions, cmd, cmdChannelName, cmdChannelSocketPath, command, commandHandler, container, cronHandler, description, errorToPlainObject, evaluateQueryAst, extractChatMessageText, extractNumberFromWasenderMessageKey, getClientMap, getPgClient, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isChatMessageEmpty, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isRecord, isRetryableError, isString, jwtGuard, jwtHandshakeGuard, markdownToTelegramHtml, max, memExtension, middleware, min, mindset, mindsetModule, modelInfo, num, numArr, obj, onDelete, onGet, onPost, onPut, onSocketEvent, parseQueryMethodName, pgExtension, pgStorage, query, queryExtension, readJsonFromFile, repository, resolveConfigReferences, restController, run, runChatAdapters, runChatControllers, runCmdClient, runCommandHandlers, runCronHandlers, runRestControllers, runSocketControllers, safeJsonParse, scanProjectFiles, scoped, setupErrorHandlers, singleton, socket, socketChannelName, socketController, stopCommandHandlers, stopCronHandlers, str, strArr, telegram, telegramChannelName, transaction, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsRecord, validateIsString, validateMax, validateMin, validateModel, wasender, wasenderChannelName, withPgClient, withPgTransaction, writeJsonToFile };
|
|
2651
|
+
export { AnthropicChatAdapter, ApiKey, ApiKeyGuardMiddleware, ApiKeyHandshakeGuardMiddleware, ApiKeyRepository, Async, AsyncMetadataStore, Auth, Chat, ChatAdapter, ChatAdapterMetadataStore, ChatAdapterRegistry, ChatBot, ChatBotMetadataStore, ChatItem, ChatMemory, ChatOperator, ChatRepository, ChatResolver, type ClientMap, CmdChannel, CmdChannelConfig, CmdChannelServer, type CmdClientMessage, type CmdServerMessage, type ConfigReference, type ConfigReferenceType, ConfigResolver, Container, ControllerMetadataStore, CronJob, CronJobRepository, CrudRepository, CustomError, DeepSeekChatAdapter, DescriptionMetadataStore, EXPRESS_REQ, EXPRESS_RES, Entity, Env, type ErrorSeverity, ExpressProvider, GoogleChatAdapter, type GoogleChatAdapterV2Options, HtmlModule, HttpServerProvider, type IApiKeyData, type IApiKeyRepository, type IArrayValidationError, type IArrayValidationResult, type IBotMessageItem, type IBuiltQuery, type IChannelMessage, type IChannelMetadata, type IChatAdapter, type IChatAdapterDecoratorConfig, type IChatAdapterMetadata, 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 IChatMessageDocument, type IChatMessageFile, type IChatMessageImage, type IChatMessagesPrivateFile, type IChatMessagesPublicFile, type IChatRepository, type IChatType, type ICmdChannelEntry, type ICmdChannelHandlers, type ICmdChannelMessage, type ICmdReceivedMessage, type ICommandConfig, type ICommandHandler, type ICommandHandlerConfig, type IConstructor, type ICronConfig, type ICronHandler, type ICronJobData, type ICronJobRepository, type ICrudRepository, type ICustomErrorData, type IDescriptionMetadata, type IEndPointConfig, type IEndPointMetadata, type IEntityData, type IEnvType, type IErrorHandlersConfig, type IErrorMonitor, type IErrorMonitorContext, type IExtractChatMessageTextOptions, type IFunctionCall, type IFunctionCallItem, type IGenerateApiKeyReq, type IGenerateApiKeyRes, type IHandshakeMiddleware, type IHandshakeMiddlewareMetadata, type IHtmlModuleOptions, type IHumanMessageItem, type IJobData, type IJobRepository, type IJwtRefreshTokenData, type IJwtRefreshTokenRepository, type IKapsoChannelConfig, type IKapsoChannelMessage, type IKapsoChannelMessageListener, type IKapsoChatMessage, type IKapsoConversation, type IKapsoEvent, type IKapsoIncomingMessage, type IKapsoMessageReceivedEvent, type IKapsoReceivedMessage, type IKapsoUnknownEvent, type ILanguageModelUsage, type ILockKey, type ILocker, type ILockerKey, type IMemoryRepositoryAdapterOptions, type IMessageContext, type IMiddleware, type IMiddlewareMetadata, type IMindset, type IMindsetConfig, type IMindsetIdentity, type IMindsetLlm, type IMindsetMetadata, type IMindsetModelKind, type IMindsetModelRef, type IMindsetModels, type IMindsetModuleConfig, type IMindsetModuleMetadata, type IMindsetParameterSchema, type IMindsetTool, type IMindsetToolParameter, type IModelValidationError, type IModelValidationResult, type IModelValidatorsInfo, type IMoneyData, type IPersistentData, type IPgRepositoryConfig, type IProjectRunnerConfig, type IPropertyValidatorInfo, type IQueryAst, type IQueryCondition, type IQueryMethodMetadata, type IQueryOrderBy, type IReceivedMessage, type IRemoteApiKeyFetcher, type IRepositoryAdapter, type IRepositoryConfig, type IRepositoryRuntime, type IRestControllerConfig, type IRestControllerMetadata, type IScanProjectFilesOptions, type IScheduleAt, type IScheduleDelay, type ISendWhatsAppMessageReq, type ISendWhatsAppTemplateReq, 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 ITransactionAdapter, type IValidateArrayOptions, type IValidateArrayOptionsWithItemsValidators, type IValidateInputShape, type IValidateIsInOptions, type IValidateIsRecordOptions, type IValidateMaxOptions, type IValidateMinOptions, type IValidationError, type IValidationResult, type IValidator, type IValidatorMetadata, type IWasenderChannelConfig, type IWasenderChannelMessageListener, type IWasenderDeviceListMetadata, type IWasenderEvent, type IWasenderMessageContent, type IWasenderMessageContextInfo, type IWasenderMessageKey, type IWasenderMessageReceivedData, type IWasenderMessageReceivedEvent, type IWasenderQrUpdatedEvent, type IWasenderReceivedMessage, type IWhatsAppCloudContact, type IWhatsAppCloudMessage, type IWhatsAppCloudMessageMetadata, type IWhatsAppCloudTemplate, type IWhatsAppCloudTemplateComponent, type IWhatsAppCloudTemplateResponse, type IWhatsAppCloudWebhookPayload, type IWhatsAppSender, type IWhatsAppTemplateData, type IWhatsAppTemplateParameter, type IchatControllerConfig, InMemoryChatMemory, InMemoryChatRepository, InMemoryCronJobRepository, InMemoryJobRepository, InMemoryLockKey, InMemoryLocker, Job, JobRepository, JobRunner, Jwt, JwtAccessAndRefreshTokenDto, JwtConfig, JwtGuardMiddleware, JwtHandshakeGuardMiddleware, JwtRefreshToken, JwtRefreshTokenRepository, JwtSigner, JwtTokenDto, KapsoChannel, KapsoChannelConfig, KapsoReceiver, KapsoSender, KapsoWebhookController, Lifecycle, Locker, Logger, MEMORY_ADAPTER_ID, Mapper, MemoryRepositoryAdapter, MemoryRepositoryExtension, Mindset, MindsetMetadataStore, MindsetOperator, Money, MoneyDto, OpenRouterChatAdapter, OpenaiChatAdapter, PG_ADAPTER_ID, Password, type PasswordHashOptions, Persistent, PgApiKeyRepository, PgChatMemory, PgChatRepository, PgCronJobRepository, PgCrudRepository, PgJobRepository, PgJsonRepositoryAdapter, PgJwtRefreshTokenRepository, PgLockKey, PgLocker, PgRepositoryBase, PgRepositoryBase as PgRepositoryExtension, PgTransactionAdapter, ProjectRunner, type QueryConnector, type QueryOperator, type QueryPrefix, Random, RemoteApiKeyRepository, RepositoryAdapterRegistry, RepositoryMetadataStore, type ResolvedConfig, RestControllerMetadataStore, RestRequest, SocketChannel, SocketChannelConfig, SocketChannelMessageFile, SocketChannelReceivedMessage, SocketControllerMetadataStore, SocketServerConfig, SocketServerProvider, Storable, TelegramChannel, TelegramChannelConfig, TransactionMetadataStore, UnionChatAdapter, ValidationMetadataStore, WabotChatAdapter, WasenderChannel, WasenderChannelConfig, WasenderReceiver, WasenderSender, WasenderWebhookController, WhatsAppApiSender, WhatsAppReceiverByCloudApi, WhatsAppSender, apiKeyGuard, apiKeyHandshakeGuard, bool, boolArr, buildQuerySql, chatAdapter, chatBot, chatController, chatItemTypeOptions, cmd, cmdChannelName, cmdChannelSocketPath, command, commandHandler, container, cronHandler, description, errorToPlainObject, evaluateQueryAst, extractChatMessageText, extractNumberFromWasenderMessageKey, getClientMap, getPgClient, handshakeMiddlewares, inject, injectable, isArray, isBoolean, isChatMessageEmpty, isDate, isIn, isModel, isNotEmpty, isNumber, isOptional, isPresent, isRecord, isRetryableError, isString, jwtGuard, jwtHandshakeGuard, kapso, kapsoChannelName, markdownToTelegramHtml, max, memExtension, middleware, min, mindset, mindsetModule, modelInfo, num, numArr, obj, onDelete, onGet, onPost, onPut, onSocketEvent, parseQueryMethodName, pgExtension, pgStorage, query, queryExtension, readJsonFromFile, repository, resolveConfigReferences, restController, run, runChatAdapters, runChatControllers, runCmdClient, runCommandHandlers, runCronHandlers, runRestControllers, runSocketControllers, safeJsonParse, scanProjectFiles, scoped, setupErrorHandlers, singleton, socket, socketChannelName, socketController, stopCommandHandlers, stopCronHandlers, str, strArr, telegram, telegramChannelName, transaction, validateAndTransform, validateArray, validateIsBoolean, validateIsDate, validateIsIn, validateIsNotEmpty, validateIsNumber, validateIsPresent, validateIsRecord, validateIsString, validateMax, validateMin, validateModel, wasender, wasenderChannelName, withPgClient, withPgTransaction, writeJsonToFile };
|
package/dist/src/index.js
CHANGED
|
@@ -180,6 +180,13 @@ export { telegramChannelName } from './addon/chat-controller/telegram/telegramCh
|
|
|
180
180
|
export { markdownToTelegramHtml } from './addon/chat-controller/telegram/markdownToTelegramHtml.js';
|
|
181
181
|
export { WhatsAppReceiverByCloudApi } from './addon/chat-controller/whatsapp/cloud-api/WhatsAppReceiverByCloudApi.js';
|
|
182
182
|
export { WhatsAppApiSender } from './addon/chat-controller/whatsapp/cloud-api/WhatsAppApiSender.js';
|
|
183
|
+
export { kapso } from './addon/chat-controller/whatsapp/kapso/@kapso.js';
|
|
184
|
+
export { KapsoChannel } from './addon/chat-controller/whatsapp/kapso/KapsoChannel.js';
|
|
185
|
+
export { KapsoChannelConfig } from './addon/chat-controller/whatsapp/kapso/KapsoChannelConfig.js';
|
|
186
|
+
export { kapsoChannelName } from './addon/chat-controller/whatsapp/kapso/KapsoChannelName.js';
|
|
187
|
+
export { KapsoReceiver } from './addon/chat-controller/whatsapp/kapso/KapsoReceiver.js';
|
|
188
|
+
export { KapsoSender } from './addon/chat-controller/whatsapp/kapso/KapsoSender.js';
|
|
189
|
+
export { KapsoWebhookController } from './addon/chat-controller/whatsapp/kapso/KapsoWebhookController.js';
|
|
183
190
|
export { wasender } from './addon/chat-controller/whatsapp/wasender/@wasender.js';
|
|
184
191
|
export { WasenderChannel } from './addon/chat-controller/whatsapp/wasender/WasenderChannel.js';
|
|
185
192
|
export { WasenderChannelConfig } from './addon/chat-controller/whatsapp/wasender/WasenderChannelConfig.js';
|