@theokit/gateway-whatsapp 0.6.0 → 0.7.0
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/CHANGELOG.md +6 -0
- package/README.md +4 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -13
- package/dist/index.d.ts +3 -13
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChildProcess } from 'node:child_process';
|
|
2
|
-
import { GatewayConfigurationError, GatewayConfigurationErrorOptions, BasePlatformAdapter, OutboundMessage, SendResult, MessageEvent, WhatsAppMessageEvent } from '@theokit/gateway';
|
|
2
|
+
import { GatewayConfigurationError, GatewayConfigurationErrorOptions, BasePlatformAdapter, AdapterCapabilities, OutboundMessage, SendResult, MessageEvent, WhatsAppMessageEvent } from '@theokit/gateway';
|
|
3
3
|
export { WhatsAppMessageEvent } from '@theokit/gateway';
|
|
4
4
|
|
|
5
5
|
/** Inbound webhook payload — the full envelope Meta POSTs. */
|
|
@@ -401,6 +401,7 @@ interface WhatsAppAdapterCommonOptions {
|
|
|
401
401
|
* constructor stays available for tests and for a backend of your own.
|
|
402
402
|
*/
|
|
403
403
|
declare class WhatsAppAdapter extends BasePlatformAdapter {
|
|
404
|
+
get capabilities(): AdapterCapabilities;
|
|
404
405
|
readonly platform: "whatsapp";
|
|
405
406
|
private readonly backendImpl;
|
|
406
407
|
/**
|
|
@@ -1361,18 +1362,7 @@ declare function mapWhatsAppCloudError(status: number, body: unknown): ErrorPayl
|
|
|
1361
1362
|
*/
|
|
1362
1363
|
declare function mapWhatsAppWebError(ipcError: string | undefined): ErrorPayload;
|
|
1363
1364
|
|
|
1364
|
-
/**
|
|
1365
|
-
* Split a long string into ≤4096-char chunks for WhatsApp messages (ADR D310).
|
|
1366
|
-
*
|
|
1367
|
-
* Thin wrapper over core `chunkText` (roadmap M1). WhatsApp family: fixed 4096
|
|
1368
|
-
* window, `\n\n` → `\n` → ` ` boundary preference, UTF-16 surrogate-pair guard,
|
|
1369
|
-
* leading-whitespace strip. `trimParts` reproduces EC-8 (empty parts filtered
|
|
1370
|
-
* so consecutive newlines don't yield empty `sendMessage` calls Meta rejects).
|
|
1371
|
-
* Output is byte-identical to the previous implementation (pinned by
|
|
1372
|
-
* `tests/split.test.ts`).
|
|
1373
|
-
*
|
|
1374
|
-
* @internal
|
|
1375
|
-
*/
|
|
1365
|
+
/** Split `text` into chunks of at most `WHATSAPP_MAX_TEXT` characters. */
|
|
1376
1366
|
declare function splitForWhatsApp(text: string): string[];
|
|
1377
1367
|
|
|
1378
1368
|
export { type BaileysSocketFactory, type BaileysSocketLike, type BaileysSocketOptions, ConfigurationError, type ConfigurationErrorOptions, type IpcCommand, type IpcEvent, LineBuffer, type MetaTemplateComponent, type MetaWebhookEnvelope, WhatsAppAdapter, type WhatsAppAdapterCommonOptions, type WhatsAppAdapterOptions, type WhatsAppBackend, WhatsAppBaileysBackend, type WhatsAppBaileysBackendOptions, type WhatsAppBaileysConfig, WhatsAppBridgeError, WhatsAppCloudBackend, type WhatsAppCloudBackendOptions, type WhatsAppCloudConfig, WhatsAppConnectTimeoutError, type WhatsAppInboundEvent, type WhatsAppOutboundMessage, type WhatsAppPairingState, type WhatsAppSendResult, type WhatsAppStatusReceipt, WhatsAppWebBackend, type WhatsAppWebBackendOptions, type WhatsAppWebConfig, createBaileysSocket, defaultBridgeScriptPath, digitsOnly, formatCommand, mapWhatsAppCloudError, mapWhatsAppWebError, normalizeInboundMessages, normalizeStatusReceipts, parseEvent, parseWebhookPayload, splitForWhatsApp, verifyWebhookSignature, verifyWebhookSubscription };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChildProcess } from 'node:child_process';
|
|
2
|
-
import { GatewayConfigurationError, GatewayConfigurationErrorOptions, BasePlatformAdapter, OutboundMessage, SendResult, MessageEvent, WhatsAppMessageEvent } from '@theokit/gateway';
|
|
2
|
+
import { GatewayConfigurationError, GatewayConfigurationErrorOptions, BasePlatformAdapter, AdapterCapabilities, OutboundMessage, SendResult, MessageEvent, WhatsAppMessageEvent } from '@theokit/gateway';
|
|
3
3
|
export { WhatsAppMessageEvent } from '@theokit/gateway';
|
|
4
4
|
|
|
5
5
|
/** Inbound webhook payload — the full envelope Meta POSTs. */
|
|
@@ -401,6 +401,7 @@ interface WhatsAppAdapterCommonOptions {
|
|
|
401
401
|
* constructor stays available for tests and for a backend of your own.
|
|
402
402
|
*/
|
|
403
403
|
declare class WhatsAppAdapter extends BasePlatformAdapter {
|
|
404
|
+
get capabilities(): AdapterCapabilities;
|
|
404
405
|
readonly platform: "whatsapp";
|
|
405
406
|
private readonly backendImpl;
|
|
406
407
|
/**
|
|
@@ -1361,18 +1362,7 @@ declare function mapWhatsAppCloudError(status: number, body: unknown): ErrorPayl
|
|
|
1361
1362
|
*/
|
|
1362
1363
|
declare function mapWhatsAppWebError(ipcError: string | undefined): ErrorPayload;
|
|
1363
1364
|
|
|
1364
|
-
/**
|
|
1365
|
-
* Split a long string into ≤4096-char chunks for WhatsApp messages (ADR D310).
|
|
1366
|
-
*
|
|
1367
|
-
* Thin wrapper over core `chunkText` (roadmap M1). WhatsApp family: fixed 4096
|
|
1368
|
-
* window, `\n\n` → `\n` → ` ` boundary preference, UTF-16 surrogate-pair guard,
|
|
1369
|
-
* leading-whitespace strip. `trimParts` reproduces EC-8 (empty parts filtered
|
|
1370
|
-
* so consecutive newlines don't yield empty `sendMessage` calls Meta rejects).
|
|
1371
|
-
* Output is byte-identical to the previous implementation (pinned by
|
|
1372
|
-
* `tests/split.test.ts`).
|
|
1373
|
-
*
|
|
1374
|
-
* @internal
|
|
1375
|
-
*/
|
|
1365
|
+
/** Split `text` into chunks of at most `WHATSAPP_MAX_TEXT` characters. */
|
|
1376
1366
|
declare function splitForWhatsApp(text: string): string[];
|
|
1377
1367
|
|
|
1378
1368
|
export { type BaileysSocketFactory, type BaileysSocketLike, type BaileysSocketOptions, ConfigurationError, type ConfigurationErrorOptions, type IpcCommand, type IpcEvent, LineBuffer, type MetaTemplateComponent, type MetaWebhookEnvelope, WhatsAppAdapter, type WhatsAppAdapterCommonOptions, type WhatsAppAdapterOptions, type WhatsAppBackend, WhatsAppBaileysBackend, type WhatsAppBaileysBackendOptions, type WhatsAppBaileysConfig, WhatsAppBridgeError, WhatsAppCloudBackend, type WhatsAppCloudBackendOptions, type WhatsAppCloudConfig, WhatsAppConnectTimeoutError, type WhatsAppInboundEvent, type WhatsAppOutboundMessage, type WhatsAppPairingState, type WhatsAppSendResult, type WhatsAppStatusReceipt, WhatsAppWebBackend, type WhatsAppWebBackendOptions, type WhatsAppWebConfig, createBaileysSocket, defaultBridgeScriptPath, digitsOnly, formatCommand, mapWhatsAppCloudError, mapWhatsAppWebError, normalizeInboundMessages, normalizeStatusReceipts, parseEvent, parseWebhookPayload, splitForWhatsApp, verifyWebhookSignature, verifyWebhookSubscription };
|
package/dist/index.js
CHANGED
|
@@ -1844,6 +1844,9 @@ function requireNonEmpty(entries) {
|
|
|
1844
1844
|
}
|
|
1845
1845
|
}
|
|
1846
1846
|
var WhatsAppAdapter = class _WhatsAppAdapter extends BasePlatformAdapter {
|
|
1847
|
+
get capabilities() {
|
|
1848
|
+
return { ...super.capabilities, maxMessageChars: WHATSAPP_MAX_TEXT, threads: false };
|
|
1849
|
+
}
|
|
1847
1850
|
platform = "whatsapp";
|
|
1848
1851
|
backendImpl;
|
|
1849
1852
|
/**
|