@samva/webhooks 0.21.0 → 0.22.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.
@@ -0,0 +1,730 @@
1
+ //#region src/decoder.gen.ts
2
+ const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3
+ const validate0 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate3(value["data"]));
4
+ const validate1 = (value) => typeof value === "string" && value === "message.sent";
5
+ const validate2 = (value) => typeof value === "string";
6
+ const validate3 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "channel") && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "organizationId") && (!Object.hasOwn(value, "mailboxId") || validate4(value["mailboxId"])) && (!Object.hasOwn(value, "channel") || validate7(value["channel"])) && (!Object.hasOwn(value, "status") || validate8(value["status"])) && (!Object.hasOwn(value, "metadata") || validate11(value["metadata"])) && (!Object.hasOwn(value, "cost") || validate14(value["cost"])) && (!Object.hasOwn(value, "recipient") || validate8(value["recipient"])) && (!Object.hasOwn(value, "occurredAt") || validate8(value["occurredAt"])) && (!Object.hasOwn(value, "failureReason") || validate8(value["failureReason"])) && (!Object.hasOwn(value, "errorCode") || validate8(value["errorCode"])) && (!Object.hasOwn(value, "conversationId") || validate8(value["conversationId"])) && (!Object.hasOwn(value, "isBillable") || validate32(value["isBillable"])) && (!Object.hasOwn(value, "messageType") || validate8(value["messageType"])) && (!Object.hasOwn(value, "templateCategory") || validate38(value["templateCategory"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "toEmails") || validate44(value["toEmails"])) && (!Object.hasOwn(value, "providerMessageId") || validate8(value["providerMessageId"])) && (!Object.hasOwn(value, "waId") || validate8(value["waId"])) && (!Object.hasOwn(value, "hasAttachments") || validate32(value["hasAttachments"])) && (!Object.hasOwn(value, "isAutoReply") || validate32(value["isAutoReply"])) && (!Object.hasOwn(value, "segments") || validate14(value["segments"])) && (!Object.hasOwn(value, "to") || validate8(value["to"])) && (!Object.hasOwn(value, "from") || validate8(value["from"])) && (!Object.hasOwn(value, "body") || validate8(value["body"])) && (!Object.hasOwn(value, "direction") || validate72(value["direction"])) && (!Object.hasOwn(value, "errorMessage") || validate8(value["errorMessage"])) && (!Object.hasOwn(value, "parts") || validate14(value["parts"])) && (!Object.hasOwn(value, "carrier") || validate8(value["carrier"])) && (!Object.hasOwn(value, "messageId") || validate2(value["messageId"])) && (!Object.hasOwn(value, "organizationId") || validate2(value["organizationId"]));
7
+ const validate4 = (value) => validate5(value) || validate6(value);
8
+ const validate5 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^mbx_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
9
+ const validate6 = (value) => value === null;
10
+ const validate7 = (value) => typeof value === "string" && (value === "sms" || value === "whatsapp" || value === "email");
11
+ const validate8 = (value) => validate2(value) || validate6(value);
12
+ const validate11 = (value) => validate12(value) || validate6(value);
13
+ const validate12 = (value) => isObject(value);
14
+ const validate14 = (value) => validate15(value) || validate6(value);
15
+ const validate15 = (value) => typeof value === "number" && Number.isFinite(value);
16
+ const validate32 = (value) => validate33(value) || validate6(value);
17
+ const validate33 = (value) => typeof value === "boolean";
18
+ const validate38 = (value) => validate39(value) || validate6(value);
19
+ const validate39 = (value) => typeof value === "string" && (value === "marketing" || value === "utility" || value === "authentication");
20
+ const validate44 = (value) => validate45(value) || validate6(value);
21
+ const validate45 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate2);
22
+ const validate72 = (value) => validate73(value) || validate6(value);
23
+ const validate73 = (value) => typeof value === "string" && (value === "inbound" || value === "outbound");
24
+ const validate86 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate87(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate3(value["data"]));
25
+ const validate87 = (value) => typeof value === "string" && value === "message.delivered";
26
+ const validate172 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate173(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate3(value["data"]));
27
+ const validate173 = (value) => typeof value === "string" && value === "message.read";
28
+ const validate258 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate259(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate3(value["data"]));
29
+ const validate259 = (value) => typeof value === "string" && value === "message.failed";
30
+ const validate344 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate345(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate347(value["data"]));
31
+ const validate345 = (value) => typeof value === "string" && value === "message.bounced";
32
+ const validate347 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "channel") && Object.hasOwn(value, "recipient") && Object.hasOwn(value, "occurredAt") && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "organizationId") && (!Object.hasOwn(value, "mailboxId") || validate4(value["mailboxId"])) && (!Object.hasOwn(value, "channel") || validate7(value["channel"])) && (!Object.hasOwn(value, "status") || validate8(value["status"])) && (!Object.hasOwn(value, "metadata") || validate11(value["metadata"])) && (!Object.hasOwn(value, "cost") || validate14(value["cost"])) && (!Object.hasOwn(value, "recipient") || validate2(value["recipient"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"])) && (!Object.hasOwn(value, "failureReason") || validate8(value["failureReason"])) && (!Object.hasOwn(value, "errorCode") || validate8(value["errorCode"])) && (!Object.hasOwn(value, "conversationId") || validate8(value["conversationId"])) && (!Object.hasOwn(value, "isBillable") || validate32(value["isBillable"])) && (!Object.hasOwn(value, "messageType") || validate8(value["messageType"])) && (!Object.hasOwn(value, "templateCategory") || validate38(value["templateCategory"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "toEmails") || validate44(value["toEmails"])) && (!Object.hasOwn(value, "providerMessageId") || validate8(value["providerMessageId"])) && (!Object.hasOwn(value, "waId") || validate8(value["waId"])) && (!Object.hasOwn(value, "hasAttachments") || validate32(value["hasAttachments"])) && (!Object.hasOwn(value, "isAutoReply") || validate32(value["isAutoReply"])) && (!Object.hasOwn(value, "segments") || validate14(value["segments"])) && (!Object.hasOwn(value, "to") || validate8(value["to"])) && (!Object.hasOwn(value, "from") || validate8(value["from"])) && (!Object.hasOwn(value, "body") || validate8(value["body"])) && (!Object.hasOwn(value, "direction") || validate72(value["direction"])) && (!Object.hasOwn(value, "errorMessage") || validate8(value["errorMessage"])) && (!Object.hasOwn(value, "parts") || validate14(value["parts"])) && (!Object.hasOwn(value, "carrier") || validate8(value["carrier"])) && (!Object.hasOwn(value, "messageId") || validate2(value["messageId"])) && (!Object.hasOwn(value, "organizationId") || validate2(value["organizationId"]));
33
+ const validate426 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate427(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate347(value["data"]));
34
+ const validate427 = (value) => typeof value === "string" && value === "message.complained";
35
+ const validate508 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate509(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate511(value["data"]));
36
+ const validate509 = (value) => typeof value === "string" && value === "message.received";
37
+ const validate511 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "channel") && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "organizationId") && (!Object.hasOwn(value, "mailboxId") || validate4(value["mailboxId"])) && (!Object.hasOwn(value, "channel") || validate7(value["channel"])) && (!Object.hasOwn(value, "status") || validate8(value["status"])) && (!Object.hasOwn(value, "metadata") || validate11(value["metadata"])) && (!Object.hasOwn(value, "cost") || validate14(value["cost"])) && (!Object.hasOwn(value, "recipient") || validate8(value["recipient"])) && (!Object.hasOwn(value, "occurredAt") || validate8(value["occurredAt"])) && (!Object.hasOwn(value, "failureReason") || validate8(value["failureReason"])) && (!Object.hasOwn(value, "errorCode") || validate8(value["errorCode"])) && (!Object.hasOwn(value, "conversationId") || validate8(value["conversationId"])) && (!Object.hasOwn(value, "isBillable") || validate32(value["isBillable"])) && (!Object.hasOwn(value, "messageType") || validate8(value["messageType"])) && (!Object.hasOwn(value, "templateCategory") || validate38(value["templateCategory"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "toEmails") || validate44(value["toEmails"])) && (!Object.hasOwn(value, "providerMessageId") || validate8(value["providerMessageId"])) && (!Object.hasOwn(value, "waId") || validate8(value["waId"])) && (!Object.hasOwn(value, "hasAttachments") || validate32(value["hasAttachments"])) && (!Object.hasOwn(value, "isAutoReply") || validate32(value["isAutoReply"])) && (!Object.hasOwn(value, "segments") || validate14(value["segments"])) && (!Object.hasOwn(value, "to") || validate8(value["to"])) && (!Object.hasOwn(value, "from") || validate8(value["from"])) && (!Object.hasOwn(value, "body") || validate8(value["body"])) && (!Object.hasOwn(value, "direction") || validate72(value["direction"])) && (!Object.hasOwn(value, "errorMessage") || validate8(value["errorMessage"])) && (!Object.hasOwn(value, "parts") || validate14(value["parts"])) && (!Object.hasOwn(value, "carrier") || validate8(value["carrier"])) && (!Object.hasOwn(value, "whatsapp") || validate592(value["whatsapp"])) && (!Object.hasOwn(value, "messageId") || validate2(value["messageId"])) && (!Object.hasOwn(value, "organizationId") || validate2(value["organizationId"]));
38
+ const validate592 = (value) => validate593(value) || validate6(value);
39
+ const validate593 = (value) => isObject(value) && isObject(value) && (!Object.hasOwn(value, "text") || validate8(value["text"])) && (!Object.hasOwn(value, "template") || validate597(value["template"])) && (!Object.hasOwn(value, "interactive") || validate649(value["interactive"])) && (!Object.hasOwn(value, "media") || validate749(value["media"])) && (!Object.hasOwn(value, "reaction") || validate772(value["reaction"])) && (!Object.hasOwn(value, "location") || validate780(value["location"])) && (!Object.hasOwn(value, "contacts") || validate786(value["contacts"])) && (!Object.hasOwn(value, "reply") || validate822(value["reply"])) && (!Object.hasOwn(value, "flowResponse") || validate827(value["flowResponse"])) && (!Object.hasOwn(value, "context") || validate833(value["context"]));
40
+ const validate597 = (value) => validate598(value) || validate6(value);
41
+ const validate598 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "name") && Object.hasOwn(value, "language") && Object.hasOwn(value, "components") && (!Object.hasOwn(value, "name") || validate2(value["name"])) && (!Object.hasOwn(value, "language") || validate2(value["language"])) && (!Object.hasOwn(value, "components") || validate601(value["components"]));
42
+ const validate601 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate602);
43
+ const validate602 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "parameters") && (!Object.hasOwn(value, "type") || validate603(value["type"])) && (!Object.hasOwn(value, "sub_type") || validate604(value["sub_type"])) && (!Object.hasOwn(value, "index") || validate8(value["index"])) && (!Object.hasOwn(value, "parameters") || validate610(value["parameters"]));
44
+ const validate603 = (value) => typeof value === "string" && (value === "header" || value === "body" || value === "footer" || value === "button");
45
+ const validate604 = (value) => validate605(value) || validate6(value);
46
+ const validate605 = (value) => typeof value === "string" && (value === "url" || value === "quick_reply" || value === "copy_code" || value === "flow");
47
+ const validate610 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate611);
48
+ const validate611 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && (!Object.hasOwn(value, "type") || validate612(value["type"])) && (!Object.hasOwn(value, "text") || validate8(value["text"])) && (!Object.hasOwn(value, "currency") || validate616(value["currency"])) && (!Object.hasOwn(value, "date_time") || validate622(value["date_time"])) && (!Object.hasOwn(value, "image") || validate626(value["image"])) && (!Object.hasOwn(value, "document") || validate630(value["document"])) && (!Object.hasOwn(value, "video") || validate626(value["video"])) && (!Object.hasOwn(value, "coupon_code") || validate8(value["coupon_code"])) && (!Object.hasOwn(value, "action") || validate644(value["action"]));
49
+ const validate612 = (value) => typeof value === "string" && (value === "text" || value === "currency" || value === "date_time" || value === "image" || value === "document" || value === "video" || value === "coupon_code" || value === "action");
50
+ const validate616 = (value) => validate617(value) || validate6(value);
51
+ const validate617 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "fallback_value") && Object.hasOwn(value, "code") && Object.hasOwn(value, "amount_1000") && (!Object.hasOwn(value, "fallback_value") || validate2(value["fallback_value"])) && (!Object.hasOwn(value, "code") || validate2(value["code"])) && (!Object.hasOwn(value, "amount_1000") || validate15(value["amount_1000"]));
52
+ const validate622 = (value) => validate623(value) || validate6(value);
53
+ const validate623 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "fallback_value") && (!Object.hasOwn(value, "fallback_value") || validate2(value["fallback_value"]));
54
+ const validate626 = (value) => validate627(value) || validate6(value);
55
+ const validate627 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "link") && (!Object.hasOwn(value, "link") || validate2(value["link"]));
56
+ const validate630 = (value) => validate631(value) || validate6(value);
57
+ const validate631 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "link") && (!Object.hasOwn(value, "link") || validate2(value["link"])) && (!Object.hasOwn(value, "filename") || validate8(value["filename"]));
58
+ const validate644 = (value) => validate645(value) || validate6(value);
59
+ const validate645 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "flow_token") && (!Object.hasOwn(value, "flow_token") || validate2(value["flow_token"]));
60
+ const validate649 = (value) => validate650(value) || validate685(value) || validate701(value) || validate734(value);
61
+ const validate650 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "body") && Object.hasOwn(value, "buttons") && (!Object.hasOwn(value, "type") || validate651(value["type"])) && (!Object.hasOwn(value, "header") || validate652(value["header"])) && (!Object.hasOwn(value, "body") || validate679(value["body"])) && (!Object.hasOwn(value, "footer") || validate655(value["footer"])) && (!Object.hasOwn(value, "buttons") || validate681(value["buttons"]));
62
+ const validate651 = (value) => typeof value === "string" && value === "buttons";
63
+ const validate652 = (value) => validate653(value) || validate656(value) || validate663(value) || validate670(value);
64
+ const validate653 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "text") && (!Object.hasOwn(value, "type") || validate654(value["type"])) && (!Object.hasOwn(value, "text") || validate655(value["text"]));
65
+ const validate654 = (value) => typeof value === "string" && value === "text";
66
+ const validate655 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1 && typeof value === "string" && Array.from(value).length <= 60;
67
+ const validate656 = (value) => validate657(value) || validate660(value);
68
+ const validate657 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "url") && (!Object.hasOwn(value, "type") || validate658(value["type"])) && (!Object.hasOwn(value, "url") || validate2(value["url"]));
69
+ const validate658 = (value) => typeof value === "string" && value === "image";
70
+ const validate660 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "mediaId") && (!Object.hasOwn(value, "type") || validate658(value["type"])) && (!Object.hasOwn(value, "mediaId") || validate662(value["mediaId"]));
71
+ const validate662 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^media_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
72
+ const validate663 = (value) => validate664(value) || validate667(value);
73
+ const validate664 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "url") && (!Object.hasOwn(value, "type") || validate665(value["type"])) && (!Object.hasOwn(value, "url") || validate2(value["url"]));
74
+ const validate665 = (value) => typeof value === "string" && value === "video";
75
+ const validate667 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "mediaId") && (!Object.hasOwn(value, "type") || validate665(value["type"])) && (!Object.hasOwn(value, "mediaId") || validate662(value["mediaId"]));
76
+ const validate670 = (value) => validate671(value) || validate675(value);
77
+ const validate671 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "url") && (!Object.hasOwn(value, "type") || validate672(value["type"])) && (!Object.hasOwn(value, "filename") || validate673(value["filename"])) && (!Object.hasOwn(value, "url") || validate2(value["url"]));
78
+ const validate672 = (value) => typeof value === "string" && value === "document";
79
+ const validate673 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1 && typeof value === "string" && Array.from(value).length <= 255;
80
+ const validate675 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "mediaId") && (!Object.hasOwn(value, "type") || validate672(value["type"])) && (!Object.hasOwn(value, "filename") || validate673(value["filename"])) && (!Object.hasOwn(value, "mediaId") || validate662(value["mediaId"]));
81
+ const validate679 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1 && typeof value === "string" && Array.from(value).length <= 1024;
82
+ const validate681 = (value) => Array.isArray(value) && Array.isArray(value) && value.length >= 1 && Array.isArray(value) && value.length <= 3 && Array.isArray(value) && value.every(validate682);
83
+ const validate682 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "title") && (!Object.hasOwn(value, "id") || validate683(value["id"])) && (!Object.hasOwn(value, "title") || validate684(value["title"]));
84
+ const validate683 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1 && typeof value === "string" && Array.from(value).length <= 256;
85
+ const validate684 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1 && typeof value === "string" && Array.from(value).length <= 20;
86
+ const validate685 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "body") && Object.hasOwn(value, "button") && Object.hasOwn(value, "sections") && (!Object.hasOwn(value, "type") || validate686(value["type"])) && (!Object.hasOwn(value, "header") || validate653(value["header"])) && (!Object.hasOwn(value, "body") || validate690(value["body"])) && (!Object.hasOwn(value, "footer") || validate655(value["footer"])) && (!Object.hasOwn(value, "button") || validate684(value["button"])) && (!Object.hasOwn(value, "sections") || validate693(value["sections"]));
87
+ const validate686 = (value) => typeof value === "string" && value === "list";
88
+ const validate690 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1 && typeof value === "string" && Array.from(value).length <= 4096;
89
+ const validate693 = (value) => Array.isArray(value) && Array.isArray(value) && value.length >= 1 && Array.isArray(value) && value.length <= 10 && Array.isArray(value) && value.every(validate694);
90
+ const validate694 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "rows") && (!Object.hasOwn(value, "title") || validate695(value["title"])) && (!Object.hasOwn(value, "rows") || validate696(value["rows"]));
91
+ const validate695 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1 && typeof value === "string" && Array.from(value).length <= 24;
92
+ const validate696 = (value) => Array.isArray(value) && Array.isArray(value) && value.length >= 1 && Array.isArray(value) && value.every(validate697);
93
+ const validate697 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "title") && (!Object.hasOwn(value, "id") || validate698(value["id"])) && (!Object.hasOwn(value, "title") || validate695(value["title"])) && (!Object.hasOwn(value, "description") || validate700(value["description"]));
94
+ const validate698 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1 && typeof value === "string" && Array.from(value).length <= 200;
95
+ const validate700 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1 && typeof value === "string" && Array.from(value).length <= 72;
96
+ const validate701 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "body") && Object.hasOwn(value, "displayText") && Object.hasOwn(value, "url") && (!Object.hasOwn(value, "type") || validate702(value["type"])) && (!Object.hasOwn(value, "header") || validate652(value["header"])) && (!Object.hasOwn(value, "body") || validate679(value["body"])) && (!Object.hasOwn(value, "footer") || validate655(value["footer"])) && (!Object.hasOwn(value, "displayText") || validate684(value["displayText"])) && (!Object.hasOwn(value, "url") || validate2(value["url"]));
97
+ const validate702 = (value) => typeof value === "string" && value === "cta_url";
98
+ const validate734 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "body") && Object.hasOwn(value, "flowId") && Object.hasOwn(value, "cta") && Object.hasOwn(value, "flowVersionId") && Object.hasOwn(value, "providerFlowId") && (!Object.hasOwn(value, "type") || validate735(value["type"])) && (!Object.hasOwn(value, "header") || validate653(value["header"])) && (!Object.hasOwn(value, "body") || validate679(value["body"])) && (!Object.hasOwn(value, "footer") || validate655(value["footer"])) && (!Object.hasOwn(value, "flowId") || validate741(value["flowId"])) && (!Object.hasOwn(value, "cta") || validate742(value["cta"])) && (!Object.hasOwn(value, "token") || validate679(value["token"])) && (!Object.hasOwn(value, "action") || validate744(value["action"])) && (!Object.hasOwn(value, "screen") || validate745(value["screen"])) && (!Object.hasOwn(value, "data") || validate12(value["data"])) && (!Object.hasOwn(value, "flowVersionId") || validate747(value["flowVersionId"])) && (!Object.hasOwn(value, "providerFlowId") || validate2(value["providerFlowId"]));
99
+ const validate735 = (value) => typeof value === "string" && value === "flow";
100
+ const validate741 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^waflow_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
101
+ const validate742 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1 && typeof value === "string" && Array.from(value).length <= 30;
102
+ const validate744 = (value) => typeof value === "string" && (value === "navigate" || value === "data_exchange");
103
+ const validate745 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^[A-Za-z_]{1,100}$", "u")).test(value);
104
+ const validate747 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^wafver_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
105
+ const validate749 = (value) => validate750(value) || validate6(value);
106
+ const validate750 = (value) => validate751(value) || validate756(value) || validate761(value);
107
+ const validate751 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "url") && (!Object.hasOwn(value, "type") || validate752(value["type"])) && (!Object.hasOwn(value, "url") || validate2(value["url"])) && (!Object.hasOwn(value, "caption") || validate2(value["caption"])) && (!Object.hasOwn(value, "filename") || validate2(value["filename"]));
108
+ const validate752 = (value) => typeof value === "string" && (value === "image" || value === "video" || value === "audio" || value === "document" || value === "sticker");
109
+ const validate756 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "mediaId") && (!Object.hasOwn(value, "type") || validate752(value["type"])) && (!Object.hasOwn(value, "mediaId") || validate662(value["mediaId"])) && (!Object.hasOwn(value, "caption") || validate2(value["caption"])) && (!Object.hasOwn(value, "filename") || validate2(value["filename"]));
110
+ const validate761 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "providerMediaId") && (!Object.hasOwn(value, "type") || validate752(value["type"])) && (!Object.hasOwn(value, "providerMediaId") || validate2(value["providerMediaId"])) && (!Object.hasOwn(value, "mimeType") || validate8(value["mimeType"])) && (!Object.hasOwn(value, "caption") || validate8(value["caption"])) && (!Object.hasOwn(value, "filename") || validate2(value["filename"]));
111
+ const validate772 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "providerMessageId") && Object.hasOwn(value, "emoji") && (!Object.hasOwn(value, "messageId") || validate773(value["messageId"])) && (!Object.hasOwn(value, "providerMessageId") || validate2(value["providerMessageId"])) && (!Object.hasOwn(value, "emoji") || validate8(value["emoji"]));
112
+ const validate773 = (value) => validate774(value) || validate6(value);
113
+ const validate774 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^msg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
114
+ const validate780 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "latitude") && Object.hasOwn(value, "longitude") && (!Object.hasOwn(value, "latitude") || validate15(value["latitude"])) && (!Object.hasOwn(value, "longitude") || validate15(value["longitude"])) && (!Object.hasOwn(value, "name") || validate2(value["name"])) && (!Object.hasOwn(value, "address") || validate2(value["address"])) && (!Object.hasOwn(value, "url") || validate2(value["url"]));
115
+ const validate786 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate787);
116
+ const validate787 = (value) => isObject(value) && isObject(value) && (!Object.hasOwn(value, "name") || validate788(value["name"])) && (!Object.hasOwn(value, "phones") || validate795(value["phones"])) && (!Object.hasOwn(value, "emails") || validate800(value["emails"])) && (!Object.hasOwn(value, "urls") || validate804(value["urls"])) && (!Object.hasOwn(value, "org") || validate808(value["org"])) && (!Object.hasOwn(value, "addresses") || validate812(value["addresses"])) && (!Object.hasOwn(value, "birthday") || validate2(value["birthday"]));
117
+ const validate788 = (value) => isObject(value) && isObject(value) && (!Object.hasOwn(value, "formattedName") || validate2(value["formattedName"])) && (!Object.hasOwn(value, "firstName") || validate2(value["firstName"])) && (!Object.hasOwn(value, "lastName") || validate2(value["lastName"])) && (!Object.hasOwn(value, "middleName") || validate2(value["middleName"])) && (!Object.hasOwn(value, "prefix") || validate2(value["prefix"])) && (!Object.hasOwn(value, "suffix") || validate2(value["suffix"]));
118
+ const validate795 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate796);
119
+ const validate796 = (value) => isObject(value) && isObject(value) && (!Object.hasOwn(value, "phone") || validate2(value["phone"])) && (!Object.hasOwn(value, "type") || validate2(value["type"])) && (!Object.hasOwn(value, "waId") || validate2(value["waId"]));
120
+ const validate800 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate801);
121
+ const validate801 = (value) => isObject(value) && isObject(value) && (!Object.hasOwn(value, "email") || validate2(value["email"])) && (!Object.hasOwn(value, "type") || validate2(value["type"]));
122
+ const validate804 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate805);
123
+ const validate805 = (value) => isObject(value) && isObject(value) && (!Object.hasOwn(value, "url") || validate2(value["url"])) && (!Object.hasOwn(value, "type") || validate2(value["type"]));
124
+ const validate808 = (value) => isObject(value) && isObject(value) && (!Object.hasOwn(value, "company") || validate2(value["company"])) && (!Object.hasOwn(value, "department") || validate2(value["department"])) && (!Object.hasOwn(value, "title") || validate2(value["title"]));
125
+ const validate812 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate813);
126
+ const validate813 = (value) => isObject(value) && isObject(value) && (!Object.hasOwn(value, "street") || validate2(value["street"])) && (!Object.hasOwn(value, "city") || validate2(value["city"])) && (!Object.hasOwn(value, "state") || validate2(value["state"])) && (!Object.hasOwn(value, "zip") || validate2(value["zip"])) && (!Object.hasOwn(value, "country") || validate2(value["country"])) && (!Object.hasOwn(value, "countryCode") || validate2(value["countryCode"])) && (!Object.hasOwn(value, "type") || validate2(value["type"]));
127
+ const validate822 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "id") && Object.hasOwn(value, "title") && (!Object.hasOwn(value, "type") || validate823(value["type"])) && (!Object.hasOwn(value, "id") || validate2(value["id"])) && (!Object.hasOwn(value, "title") || validate2(value["title"])) && (!Object.hasOwn(value, "description") || validate2(value["description"]));
128
+ const validate823 = (value) => typeof value === "string" && (value === "button" || value === "list" || value === "template_button");
129
+ const validate827 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "flowToken") && Object.hasOwn(value, "response") && (!Object.hasOwn(value, "flowToken") || validate8(value["flowToken"])) && (!Object.hasOwn(value, "response") || validate12(value["response"])) && (!Object.hasOwn(value, "body") || validate2(value["body"]));
130
+ const validate833 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "providerMessageId") && (!Object.hasOwn(value, "messageId") || validate773(value["messageId"])) && (!Object.hasOwn(value, "providerMessageId") || validate2(value["providerMessageId"]));
131
+ const validate841 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate842(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate844(value["data"]));
132
+ const validate842 = (value) => typeof value === "string" && value === "message.opened";
133
+ const validate844 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "channel") && Object.hasOwn(value, "deliveryId") && Object.hasOwn(value, "recipient") && Object.hasOwn(value, "occurredAt") && Object.hasOwn(value, "firstOpen") && Object.hasOwn(value, "machine") && Object.hasOwn(value, "machineReason") && (!Object.hasOwn(value, "messageId") || validate774(value["messageId"])) && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "channel") || validate847(value["channel"])) && (!Object.hasOwn(value, "deliveryId") || validate848(value["deliveryId"])) && (!Object.hasOwn(value, "recipient") || validate2(value["recipient"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"])) && (!Object.hasOwn(value, "userAgent") || validate8(value["userAgent"])) && (!Object.hasOwn(value, "ipAddress") || validate8(value["ipAddress"])) && (!Object.hasOwn(value, "firstOpen") || validate33(value["firstOpen"])) && (!Object.hasOwn(value, "machine") || validate33(value["machine"])) && (!Object.hasOwn(value, "machineReason") || validate859(value["machineReason"])) && (!Object.hasOwn(value, "country") || validate8(value["country"])) && (!Object.hasOwn(value, "city") || validate8(value["city"])) && (!Object.hasOwn(value, "asn") || validate14(value["asn"])) && (!Object.hasOwn(value, "code") || validate8(value["code"])) && (!Object.hasOwn(value, "linkIndex") || validate14(value["linkIndex"])) && (!Object.hasOwn(value, "destinationUrl") || validate8(value["destinationUrl"])) && (!Object.hasOwn(value, "metadata") || validate11(value["metadata"])) && (!Object.hasOwn(value, "campaignId") || validate883(value["campaignId"])) && (!Object.hasOwn(value, "campaignRunId") || validate886(value["campaignRunId"]));
134
+ const validate846 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^org_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
135
+ const validate847 = (value) => typeof value === "string" && value === "email";
136
+ const validate848 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^mdel_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
137
+ const validate859 = (value) => validate860(value) || validate6(value);
138
+ const validate860 = (value) => typeof value === "string" && (value === "google-image-proxy" || value === "apple-mail-privacy" || value === "scanner-user-agent" || value === "scanner-asn" || value === "too-fast");
139
+ const validate883 = (value) => validate884(value) || validate6(value);
140
+ const validate884 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^camp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
141
+ const validate886 = (value) => validate887(value) || validate6(value);
142
+ const validate887 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^crun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
143
+ const validate889 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate890(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate892(value["data"]));
144
+ const validate890 = (value) => typeof value === "string" && value === "message.clicked";
145
+ const validate892 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "channel") && Object.hasOwn(value, "deliveryId") && Object.hasOwn(value, "recipient") && Object.hasOwn(value, "occurredAt") && Object.hasOwn(value, "url") && Object.hasOwn(value, "linkTags") && Object.hasOwn(value, "firstClick") && Object.hasOwn(value, "machine") && Object.hasOwn(value, "machineReason") && (!Object.hasOwn(value, "messageId") || validate774(value["messageId"])) && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "channel") || validate847(value["channel"])) && (!Object.hasOwn(value, "deliveryId") || validate848(value["deliveryId"])) && (!Object.hasOwn(value, "recipient") || validate2(value["recipient"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"])) && (!Object.hasOwn(value, "userAgent") || validate8(value["userAgent"])) && (!Object.hasOwn(value, "ipAddress") || validate8(value["ipAddress"])) && (!Object.hasOwn(value, "url") || validate2(value["url"])) && (!Object.hasOwn(value, "linkTags") || validate906(value["linkTags"])) && (!Object.hasOwn(value, "firstClick") || validate33(value["firstClick"])) && (!Object.hasOwn(value, "machine") || validate33(value["machine"])) && (!Object.hasOwn(value, "machineReason") || validate859(value["machineReason"])) && (!Object.hasOwn(value, "country") || validate8(value["country"])) && (!Object.hasOwn(value, "city") || validate8(value["city"])) && (!Object.hasOwn(value, "asn") || validate14(value["asn"])) && (!Object.hasOwn(value, "code") || validate8(value["code"])) && (!Object.hasOwn(value, "linkIndex") || validate14(value["linkIndex"])) && (!Object.hasOwn(value, "destinationUrl") || validate8(value["destinationUrl"])) && (!Object.hasOwn(value, "metadata") || validate11(value["metadata"])) && (!Object.hasOwn(value, "campaignId") || validate883(value["campaignId"])) && (!Object.hasOwn(value, "campaignRunId") || validate886(value["campaignRunId"]));
146
+ const validate906 = (value) => isObject(value) && isObject(value) && Object.entries(value).every(([key, item]) => validate45(item));
147
+ const validate941 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate942(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate944(value["data"]));
148
+ const validate942 = (value) => typeof value === "string" && value === "contact.created";
149
+ const validate944 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "contactId") && Object.hasOwn(value, "status") && Object.hasOwn(value, "name") && Object.hasOwn(value, "identities") && Object.hasOwn(value, "tags") && Object.hasOwn(value, "createdAt") && Object.hasOwn(value, "updatedAt") && (!Object.hasOwn(value, "contactId") || validate945(value["contactId"])) && (!Object.hasOwn(value, "status") || validate946(value["status"])) && (!Object.hasOwn(value, "name") || validate2(value["name"])) && (!Object.hasOwn(value, "displayName") || validate948(value["displayName"])) && (!Object.hasOwn(value, "identities") || validate953(value["identities"])) && (!Object.hasOwn(value, "tags") || validate45(value["tags"])) && (!Object.hasOwn(value, "externalId") || validate948(value["externalId"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"])) && (!Object.hasOwn(value, "updatedAt") || validate2(value["updatedAt"]));
150
+ const validate945 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^contact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
151
+ const validate946 = (value) => typeof value === "string" && (value === "active" || value === "paused" || value === "blocked" || value === "archived");
152
+ const validate948 = (value) => validate8(value) || validate6(value);
153
+ const validate953 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate954);
154
+ const validate954 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "identifier") && Object.hasOwn(value, "verified") && (!Object.hasOwn(value, "type") || validate955(value["type"])) && (!Object.hasOwn(value, "identifier") || validate2(value["identifier"])) && (!Object.hasOwn(value, "verified") || validate33(value["verified"]));
155
+ const validate955 = (value) => typeof value === "string" && (value === "email" || value === "phone");
156
+ const validate967 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate968(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate944(value["data"]));
157
+ const validate968 = (value) => typeof value === "string" && value === "contact.updated";
158
+ const validate993 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate994(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate944(value["data"]));
159
+ const validate994 = (value) => typeof value === "string" && value === "contact.deleted";
160
+ const validate1019 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1020(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1022(value["data"]));
161
+ const validate1020 = (value) => typeof value === "string" && value === "contact.subscribed";
162
+ const validate1022 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "contactId") && Object.hasOwn(value, "groupId") && Object.hasOwn(value, "groupName") && Object.hasOwn(value, "source") && Object.hasOwn(value, "occurredAt") && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "contactId") || validate945(value["contactId"])) && (!Object.hasOwn(value, "email") || validate8(value["email"])) && (!Object.hasOwn(value, "groupId") || validate2(value["groupId"])) && (!Object.hasOwn(value, "groupName") || validate2(value["groupName"])) && (!Object.hasOwn(value, "contactGroupId") || validate1030(value["contactGroupId"])) && (!Object.hasOwn(value, "unsubscribeGroupId") || validate1033(value["unsubscribeGroupId"])) && (!Object.hasOwn(value, "consentIp") || validate8(value["consentIp"])) && (!Object.hasOwn(value, "consentSource") || validate8(value["consentSource"])) && (!Object.hasOwn(value, "source") || validate1042(value["source"])) && (!Object.hasOwn(value, "messageId") || validate773(value["messageId"])) && (!Object.hasOwn(value, "campaignId") || validate883(value["campaignId"])) && (!Object.hasOwn(value, "campaignRunId") || validate886(value["campaignRunId"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"]));
163
+ const validate1030 = (value) => validate1031(value) || validate6(value);
164
+ const validate1031 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
165
+ const validate1033 = (value) => validate1034(value) || validate6(value);
166
+ const validate1034 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^unsub_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
167
+ const validate1042 = (value) => typeof value === "string" && (value === "link" || value === "api" || value === "manual" || value === "complaint");
168
+ const validate1053 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1054(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1022(value["data"]));
169
+ const validate1054 = (value) => typeof value === "string" && value === "contact.unsubscribed";
170
+ const validate1087 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1088(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1022(value["data"]));
171
+ const validate1088 = (value) => typeof value === "string" && value === "contact.resubscribed";
172
+ const validate1121 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1122(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1124(value["data"]));
173
+ const validate1122 = (value) => typeof value === "string" && value === "contact.consent_changed";
174
+ const validate1124 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "contactId") && Object.hasOwn(value, "identity") && Object.hasOwn(value, "channel") && Object.hasOwn(value, "status") && Object.hasOwn(value, "previousStatus") && Object.hasOwn(value, "source") && Object.hasOwn(value, "capturedAt") && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "contactId") || validate945(value["contactId"])) && (!Object.hasOwn(value, "identity") || validate1127(value["identity"])) && (!Object.hasOwn(value, "channel") || validate7(value["channel"])) && (!Object.hasOwn(value, "status") || validate1132(value["status"])) && (!Object.hasOwn(value, "previousStatus") || validate1133(value["previousStatus"])) && (!Object.hasOwn(value, "source") || validate2(value["source"])) && (!Object.hasOwn(value, "capturedAt") || validate2(value["capturedAt"]));
175
+ const validate1127 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "type") && Object.hasOwn(value, "identifier") && (!Object.hasOwn(value, "id") || validate1128(value["id"])) && (!Object.hasOwn(value, "type") || validate955(value["type"])) && (!Object.hasOwn(value, "identifier") || validate2(value["identifier"]));
176
+ const validate1128 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^cident_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
177
+ const validate1132 = (value) => typeof value === "string" && (value === "opted_in" || value === "opted_out");
178
+ const validate1133 = (value) => validate1132(value) || validate6(value);
179
+ const validate1138 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1139(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1141(value["data"]));
180
+ const validate1139 = (value) => typeof value === "string" && value === "conversation.created";
181
+ const validate1141 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "conversationId") && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "channels") && Object.hasOwn(value, "primaryChannel") && Object.hasOwn(value, "status") && Object.hasOwn(value, "createdAt") && Object.hasOwn(value, "updatedAt") && (!Object.hasOwn(value, "conversationId") || validate1142(value["conversationId"])) && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "title") || validate948(value["title"])) && (!Object.hasOwn(value, "channels") || validate1149(value["channels"])) && (!Object.hasOwn(value, "primaryChannel") || validate7(value["primaryChannel"])) && (!Object.hasOwn(value, "status") || validate1152(value["status"])) && (!Object.hasOwn(value, "primaryContactId") || validate1153(value["primaryContactId"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"])) && (!Object.hasOwn(value, "updatedAt") || validate2(value["updatedAt"]));
182
+ const validate1142 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^conv_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
183
+ const validate1149 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate7);
184
+ const validate1152 = (value) => typeof value === "string" && (value === "active" || value === "waiting" || value === "resolved" || value === "escalated" || value === "archived");
185
+ const validate1153 = (value) => validate1154(value) || validate6(value);
186
+ const validate1154 = (value) => validate945(value) || validate6(value);
187
+ const validate1160 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1161(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1141(value["data"]));
188
+ const validate1161 = (value) => typeof value === "string" && value === "conversation.updated";
189
+ const validate1182 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1183(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1141(value["data"]));
190
+ const validate1183 = (value) => typeof value === "string" && value === "conversation.archived";
191
+ const validate1204 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1205(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1207(value["data"]));
192
+ const validate1205 = (value) => typeof value === "string" && value === "webhook.created";
193
+ const validate1207 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "webhookId") && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "name") && Object.hasOwn(value, "url") && Object.hasOwn(value, "eventTypes") && Object.hasOwn(value, "channels") && Object.hasOwn(value, "status") && Object.hasOwn(value, "createdAt") && Object.hasOwn(value, "updatedAt") && (!Object.hasOwn(value, "webhookId") || validate1208(value["webhookId"])) && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "name") || validate2(value["name"])) && (!Object.hasOwn(value, "url") || validate2(value["url"])) && (!Object.hasOwn(value, "eventTypes") || validate45(value["eventTypes"])) && (!Object.hasOwn(value, "channels") || validate44(value["channels"])) && (!Object.hasOwn(value, "status") || validate1218(value["status"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"])) && (!Object.hasOwn(value, "updatedAt") || validate2(value["updatedAt"]));
194
+ const validate1208 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^wep_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
195
+ const validate1218 = (value) => typeof value === "string" && (value === "active" || value === "disabled");
196
+ const validate1221 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1222(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1207(value["data"]));
197
+ const validate1222 = (value) => typeof value === "string" && value === "webhook.updated";
198
+ const validate1238 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1239(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1207(value["data"]));
199
+ const validate1239 = (value) => typeof value === "string" && value === "webhook.deleted";
200
+ const validate1255 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1256(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate12(value["data"]));
201
+ const validate1256 = (value) => typeof value === "string" && value === "webhook.test";
202
+ const validate1259 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1260(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1262(value["data"]));
203
+ const validate1260 = (value) => typeof value === "string" && value === "domain.updated";
204
+ const validate1262 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "domainId") && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "domain") && Object.hasOwn(value, "previousPhase") && Object.hasOwn(value, "phase") && Object.hasOwn(value, "dns") && Object.hasOwn(value, "provider") && Object.hasOwn(value, "operationId") && Object.hasOwn(value, "checkedAt") && Object.hasOwn(value, "nextCheckAt") && Object.hasOwn(value, "failure") && Object.hasOwn(value, "updatedAt") && (!Object.hasOwn(value, "domainId") || validate1263(value["domainId"])) && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "domain") || validate2(value["domain"])) && (!Object.hasOwn(value, "previousPhase") || validate1266(value["previousPhase"])) && (!Object.hasOwn(value, "phase") || validate1266(value["phase"])) && (!Object.hasOwn(value, "dns") || validate1268(value["dns"])) && (!Object.hasOwn(value, "provider") || validate1275(value["provider"])) && (!Object.hasOwn(value, "operationId") || validate1285(value["operationId"])) && (!Object.hasOwn(value, "checkedAt") || validate8(value["checkedAt"])) && (!Object.hasOwn(value, "nextCheckAt") || validate8(value["nextCheckAt"])) && (!Object.hasOwn(value, "failure") || validate1294(value["failure"])) && (!Object.hasOwn(value, "updatedAt") || validate2(value["updatedAt"]));
205
+ const validate1263 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^dom_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
206
+ const validate1266 = (value) => typeof value === "string" && (value === "dns-setup" || value === "provisioning" || value === "verifying" || value === "ready" || value === "degraded" || value === "failed");
207
+ const validate1268 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "observed") && Object.hasOwn(value, "total") && Object.hasOwn(value, "satisfied") && Object.hasOwn(value, "missing") && Object.hasOwn(value, "mismatch") && Object.hasOwn(value, "unknown") && (!Object.hasOwn(value, "observed") || validate33(value["observed"])) && (!Object.hasOwn(value, "total") || validate1270(value["total"])) && (!Object.hasOwn(value, "satisfied") || validate1270(value["satisfied"])) && (!Object.hasOwn(value, "missing") || validate1270(value["missing"])) && (!Object.hasOwn(value, "mismatch") || validate1270(value["mismatch"])) && (!Object.hasOwn(value, "unknown") || validate1270(value["unknown"]));
208
+ const validate1270 = (value) => typeof value === "number" && Number.isInteger(value);
209
+ const validate1275 = (value) => validate1276(value) || validate6(value);
210
+ const validate1276 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "identity") && (!Object.hasOwn(value, "identity") || validate1277(value["identity"])) && (!Object.hasOwn(value, "dkim") || validate1278(value["dkim"])) && (!Object.hasOwn(value, "mailFrom") || validate1278(value["mailFrom"]));
211
+ const validate1277 = (value) => typeof value === "string" && (value === "pending" || value === "verified" || value === "failed" || value === "unknown");
212
+ const validate1278 = (value) => validate1277(value) || validate6(value);
213
+ const validate1285 = (value) => validate1286(value) || validate6(value);
214
+ const validate1286 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^op_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
215
+ const validate1294 = (value) => validate1295(value) || validate6(value);
216
+ const validate1295 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "code") && Object.hasOwn(value, "message") && Object.hasOwn(value, "failedAt") && (!Object.hasOwn(value, "code") || validate2(value["code"])) && (!Object.hasOwn(value, "message") || validate2(value["message"])) && (!Object.hasOwn(value, "failedAt") || validate2(value["failedAt"]));
217
+ const validate1301 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1302(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1304(value["data"]));
218
+ const validate1302 = (value) => typeof value === "string" && value === "domain.warming.updated";
219
+ const validate1304 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "domainId") && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "domain") && Object.hasOwn(value, "planId") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "status") && Object.hasOwn(value, "holdReason") && Object.hasOwn(value, "batch") && Object.hasOwn(value, "updatedAt") && (!Object.hasOwn(value, "domainId") || validate2(value["domainId"])) && (!Object.hasOwn(value, "organizationId") || validate2(value["organizationId"])) && (!Object.hasOwn(value, "domain") || validate2(value["domain"])) && (!Object.hasOwn(value, "planId") || validate2(value["planId"])) && (!Object.hasOwn(value, "reason") || validate1309(value["reason"])) && (!Object.hasOwn(value, "status") || validate1310(value["status"])) && (!Object.hasOwn(value, "holdReason") || validate8(value["holdReason"])) && (!Object.hasOwn(value, "batch") || validate1314(value["batch"])) && (!Object.hasOwn(value, "updatedAt") || validate2(value["updatedAt"]));
220
+ const validate1309 = (value) => typeof value === "string" && (value === "plan-created" || value === "policy-updated" || value === "window-opened" || value === "window-cancelled" || value === "paused" || value === "resumed" || value === "held" || value === "completed");
221
+ const validate1310 = (value) => typeof value === "string" && (value === "active" || value === "paused" || value === "completed");
222
+ const validate1314 = (value) => validate1315(value) || validate6(value);
223
+ const validate1315 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "sequence") && Object.hasOwn(value, "startsAt") && Object.hasOwn(value, "endsAt") && Object.hasOwn(value, "allowanceRecipients") && Object.hasOwn(value, "dailyGrowthPercent") && Object.hasOwn(value, "targetDailyRecipients") && (!Object.hasOwn(value, "id") || validate2(value["id"])) && (!Object.hasOwn(value, "sequence") || validate15(value["sequence"])) && (!Object.hasOwn(value, "startsAt") || validate2(value["startsAt"])) && (!Object.hasOwn(value, "endsAt") || validate2(value["endsAt"])) && (!Object.hasOwn(value, "allowanceRecipients") || validate15(value["allowanceRecipients"])) && (!Object.hasOwn(value, "dailyGrowthPercent") || validate15(value["dailyGrowthPercent"])) && (!Object.hasOwn(value, "targetDailyRecipients") || validate15(value["targetDailyRecipients"]));
224
+ const validate1325 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1326(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1328(value["data"]));
225
+ const validate1326 = (value) => typeof value === "string" && value === "template.registration.updated";
226
+ const validate1328 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "templateId") && Object.hasOwn(value, "publicationId") && Object.hasOwn(value, "target") && Object.hasOwn(value, "name") && Object.hasOwn(value, "language") && Object.hasOwn(value, "status") && Object.hasOwn(value, "category") && Object.hasOwn(value, "providerCategory") && Object.hasOwn(value, "providerTemplateId") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "submittedAt") && Object.hasOwn(value, "statusChangedAt") && Object.hasOwn(value, "createdAt") && Object.hasOwn(value, "updatedAt") && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "previousStatus") && (!Object.hasOwn(value, "id") || validate1329(value["id"])) && (!Object.hasOwn(value, "templateId") || validate1330(value["templateId"])) && (!Object.hasOwn(value, "publicationId") || validate1331(value["publicationId"])) && (!Object.hasOwn(value, "target") || validate1332(value["target"])) && (!Object.hasOwn(value, "name") || validate2(value["name"])) && (!Object.hasOwn(value, "language") || validate2(value["language"])) && (!Object.hasOwn(value, "status") || validate1342(value["status"])) && (!Object.hasOwn(value, "category") || validate1343(value["category"])) && (!Object.hasOwn(value, "providerCategory") || validate1344(value["providerCategory"])) && (!Object.hasOwn(value, "providerTemplateId") || validate8(value["providerTemplateId"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"])) && (!Object.hasOwn(value, "submittedAt") || validate8(value["submittedAt"])) && (!Object.hasOwn(value, "statusChangedAt") || validate2(value["statusChangedAt"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"])) && (!Object.hasOwn(value, "updatedAt") || validate2(value["updatedAt"])) && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "previousStatus") || validate1342(value["previousStatus"]));
227
+ const validate1329 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^treg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
228
+ const validate1330 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^tmpl_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
229
+ const validate1331 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^tpub_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
230
+ const validate1332 = (value) => validate1333(value) || validate1336(value);
231
+ const validate1333 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "provider") && Object.hasOwn(value, "wabaId") && (!Object.hasOwn(value, "provider") || validate1334(value["provider"])) && (!Object.hasOwn(value, "wabaId") || validate2(value["wabaId"]));
232
+ const validate1334 = (value) => typeof value === "string" && value === "whatsapp";
233
+ const validate1336 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "provider") && Object.hasOwn(value, "entityId") && Object.hasOwn(value, "headerId") && (!Object.hasOwn(value, "provider") || validate1337(value["provider"])) && (!Object.hasOwn(value, "entityId") || validate2(value["entityId"])) && (!Object.hasOwn(value, "headerId") || validate2(value["headerId"]));
234
+ const validate1337 = (value) => typeof value === "string" && value === "dlt";
235
+ const validate1342 = (value) => typeof value === "string" && (value === "draft" || value === "submitted" || value === "approved" || value === "rejected" || value === "paused" || value === "disabled");
236
+ const validate1343 = (value) => typeof value === "string" && (value === "marketing" || value === "utility" || value === "authentication" || value === "transactional" || value === "service_implicit" || value === "service_explicit" || value === "promotional");
237
+ const validate1344 = (value) => validate1343(value) || validate6(value);
238
+ const validate1361 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1362(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1364(value["data"]));
239
+ const validate1362 = (value) => typeof value === "string" && value === "flow.registration.updated";
240
+ const validate1364 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "flowId") && Object.hasOwn(value, "versionId") && Object.hasOwn(value, "versionNumber") && Object.hasOwn(value, "wabaId") && Object.hasOwn(value, "providerFlowId") && Object.hasOwn(value, "name") && Object.hasOwn(value, "status") && Object.hasOwn(value, "validationErrors") && Object.hasOwn(value, "endpointAlerts") && Object.hasOwn(value, "publishedAt") && Object.hasOwn(value, "statusChangedAt") && Object.hasOwn(value, "createdAt") && Object.hasOwn(value, "updatedAt") && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "previousStatus") && (!Object.hasOwn(value, "id") || validate1365(value["id"])) && (!Object.hasOwn(value, "flowId") || validate741(value["flowId"])) && (!Object.hasOwn(value, "versionId") || validate747(value["versionId"])) && (!Object.hasOwn(value, "versionNumber") || validate1270(value["versionNumber"])) && (!Object.hasOwn(value, "wabaId") || validate2(value["wabaId"])) && (!Object.hasOwn(value, "providerFlowId") || validate8(value["providerFlowId"])) && (!Object.hasOwn(value, "name") || validate2(value["name"])) && (!Object.hasOwn(value, "status") || validate1374(value["status"])) && (!Object.hasOwn(value, "validationErrors") || validate1375(value["validationErrors"])) && (!Object.hasOwn(value, "endpointAlerts") || validate1382(value["endpointAlerts"])) && (!Object.hasOwn(value, "publishedAt") || validate8(value["publishedAt"])) && (!Object.hasOwn(value, "statusChangedAt") || validate2(value["statusChangedAt"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"])) && (!Object.hasOwn(value, "updatedAt") || validate2(value["updatedAt"])) && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "previousStatus") || validate1400(value["previousStatus"]));
241
+ const validate1365 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^wafreg_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
242
+ const validate1374 = (value) => typeof value === "string" && (value === "draft" || value === "published" || value === "throttled" || value === "blocked" || value === "deprecated");
243
+ const validate1375 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate1376);
244
+ const validate1376 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "error") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "error") || validate2(value["error"])) && (!Object.hasOwn(value, "message") || validate2(value["message"])) && (!Object.hasOwn(value, "path") || validate2(value["path"])) && (!Object.hasOwn(value, "line") || validate1270(value["line"])) && (!Object.hasOwn(value, "column") || validate1270(value["column"]));
245
+ const validate1382 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate1383);
246
+ const validate1383 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "kind") && Object.hasOwn(value, "message") && Object.hasOwn(value, "value") && Object.hasOwn(value, "threshold") && Object.hasOwn(value, "activatedAt") && (!Object.hasOwn(value, "kind") || validate2(value["kind"])) && (!Object.hasOwn(value, "message") || validate2(value["message"])) && (!Object.hasOwn(value, "value") || validate14(value["value"])) && (!Object.hasOwn(value, "threshold") || validate14(value["threshold"])) && (!Object.hasOwn(value, "activatedAt") || validate2(value["activatedAt"]));
247
+ const validate1400 = (value) => validate1374(value) || validate6(value);
248
+ const validate1403 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1404(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1406(value["data"]));
249
+ const validate1404 = (value) => typeof value === "string" && value === "whatsapp.number.connected";
250
+ const validate1406 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "businessAccountId") && Object.hasOwn(value, "phoneNumber") && Object.hasOwn(value, "phoneNumberId") && Object.hasOwn(value, "whatsappBusinessAccountId") && Object.hasOwn(value, "displayName") && Object.hasOwn(value, "verificationStatus") && Object.hasOwn(value, "reconnected") && Object.hasOwn(value, "setupLink") && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "businessAccountId") || validate1411(value["businessAccountId"])) && (!Object.hasOwn(value, "phoneNumber") || validate2(value["phoneNumber"])) && (!Object.hasOwn(value, "phoneNumberId") || validate2(value["phoneNumberId"])) && (!Object.hasOwn(value, "whatsappBusinessAccountId") || validate2(value["whatsappBusinessAccountId"])) && (!Object.hasOwn(value, "displayName") || validate2(value["displayName"])) && (!Object.hasOwn(value, "verificationStatus") || validate1416(value["verificationStatus"])) && (!Object.hasOwn(value, "reconnected") || validate33(value["reconnected"])) && (!Object.hasOwn(value, "setupLink") || validate1418(value["setupLink"]));
251
+ const validate1408 = (value) => validate1409(value) || validate6(value);
252
+ const validate1409 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^ns_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
253
+ const validate1411 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^waba_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
254
+ const validate1416 = (value) => typeof value === "string" && (value === "pending" || value === "verified" || value === "failed" || value === "suspended");
255
+ const validate1418 = (value) => validate1419(value) || validate6(value);
256
+ const validate1419 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "metadata") && (!Object.hasOwn(value, "id") || validate1420(value["id"])) && (!Object.hasOwn(value, "metadata") || validate1421(value["metadata"]));
257
+ const validate1420 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^wasl_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
258
+ const validate1421 = (value) => isObject(value) && isObject(value);
259
+ const validate1423 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1424(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1426(value["data"]));
260
+ const validate1424 = (value) => typeof value === "string" && value === "mailbox.message.received";
261
+ const validate1426 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "message") && Object.hasOwn(value, "thread") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "message") || validate1431(value["message"])) && (!Object.hasOwn(value, "thread") || validate1460(value["thread"]));
262
+ const validate1431 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "from") && Object.hasOwn(value, "to") && Object.hasOwn(value, "cc") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "text") && Object.hasOwn(value, "replyText") && Object.hasOwn(value, "attachments") && Object.hasOwn(value, "occurredAt") && (!Object.hasOwn(value, "id") || validate774(value["id"])) && (!Object.hasOwn(value, "channel") || validate1433(value["channel"])) && (!Object.hasOwn(value, "threadId") || validate1434(value["threadId"])) && (!Object.hasOwn(value, "from") || validate1435(value["from"])) && (!Object.hasOwn(value, "to") || validate45(value["to"])) && (!Object.hasOwn(value, "cc") || validate45(value["cc"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "text") || validate8(value["text"])) && (!Object.hasOwn(value, "replyText") || validate8(value["replyText"])) && (!Object.hasOwn(value, "attachments") || validate1453(value["attachments"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"]));
263
+ const validate1433 = (value) => typeof value === "string" && (value === "email" || value === "whatsapp" || value === "sms");
264
+ const validate1434 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^thread_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
265
+ const validate1435 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "address") && (!Object.hasOwn(value, "address") || validate2(value["address"])) && (!Object.hasOwn(value, "name") || validate8(value["name"]));
266
+ const validate1453 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate1454);
267
+ const validate1454 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "filename") && Object.hasOwn(value, "contentType") && Object.hasOwn(value, "size") && (!Object.hasOwn(value, "id") || validate1455(value["id"])) && (!Object.hasOwn(value, "filename") || validate2(value["filename"])) && (!Object.hasOwn(value, "contentType") || validate2(value["contentType"])) && (!Object.hasOwn(value, "size") || validate15(value["size"]));
268
+ const validate1455 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^att_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
269
+ const validate1460 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "preview") && (!Object.hasOwn(value, "id") || validate1434(value["id"])) && (!Object.hasOwn(value, "endpointId") || validate1462(value["endpointId"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "preview") || validate8(value["preview"]));
270
+ const validate1462 = (value) => validate1463(value) || validate6(value);
271
+ const validate1463 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^mbxep_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
272
+ const validate1471 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1472(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1474(value["data"]));
273
+ const validate1472 = (value) => typeof value === "string" && value === "mailbox.message.sent";
274
+ const validate1474 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "actionId") && Object.hasOwn(value, "actor") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "actionId") || validate1479(value["actionId"])) && (!Object.hasOwn(value, "state") || validate1480(value["state"])) && (!Object.hasOwn(value, "acceptedAt") || validate2(value["acceptedAt"])) && (!Object.hasOwn(value, "actor") || validate1482(value["actor"])) && (!Object.hasOwn(value, "message") || validate1431(value["message"]));
275
+ const validate1479 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
276
+ const validate1480 = (value) => typeof value === "string" && value === "completed";
277
+ const validate1482 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "kind") && Object.hasOwn(value, "id") && Object.hasOwn(value, "source") && (!Object.hasOwn(value, "kind") || validate1483(value["kind"])) && (!Object.hasOwn(value, "id") || validate2(value["id"])) && (!Object.hasOwn(value, "displayName") || validate8(value["displayName"])) && (!Object.hasOwn(value, "source") || validate1488(value["source"]));
278
+ const validate1483 = (value) => typeof value === "string" && (value === "user" || value === "apiKey" || value === "extension" || value === "externalAgent" || value === "samvaAgent" || value === "system");
279
+ const validate1488 = (value) => typeof value === "string" && (value === "humanUi" || value === "externalApi" || value === "externalAgent" || value === "extension" || value === "system");
280
+ const validate1518 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1519(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1521(value["data"]));
281
+ const validate1519 = (value) => typeof value === "string" && value === "mailbox.action.pending_approval";
282
+ const validate1521 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "action") && Object.hasOwn(value, "draft") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "action") || validate1526(value["action"])) && (!Object.hasOwn(value, "draft") || validate1556(value["draft"]));
283
+ const validate1526 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "type") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "proposedBy") && Object.hasOwn(value, "createdAt") && (!Object.hasOwn(value, "id") || validate1479(value["id"])) && (!Object.hasOwn(value, "type") || validate1528(value["type"])) && (!Object.hasOwn(value, "state") || validate1529(value["state"])) && (!Object.hasOwn(value, "decision") || validate1530(value["decision"])) && (!Object.hasOwn(value, "threadId") || validate1542(value["threadId"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"])) && (!Object.hasOwn(value, "proposedBy") || validate1482(value["proposedBy"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"]));
284
+ const validate1528 = (value) => typeof value === "string" && (value === "sendMessage" || value === "reply" || value === "updateDraft" || value === "createNote" || value === "assignThread" || value === "changeThreadState" || value === "call" || value === "extensionRequest");
285
+ const validate1529 = (value) => typeof value === "string" && value === "approvalRequired";
286
+ const validate1530 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "outcome") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "policyId") && Object.hasOwn(value, "source") && Object.hasOwn(value, "decidedAt") && (!Object.hasOwn(value, "outcome") || validate1531(value["outcome"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"])) && (!Object.hasOwn(value, "policyId") || validate1535(value["policyId"])) && (!Object.hasOwn(value, "source") || validate1538(value["source"])) && (!Object.hasOwn(value, "decidedAt") || validate2(value["decidedAt"]));
287
+ const validate1531 = (value) => typeof value === "string" && (value === "allow" || value === "requireApproval" || value === "deny");
288
+ const validate1535 = (value) => validate1536(value) || validate6(value);
289
+ const validate1536 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^mbxpol_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
290
+ const validate1538 = (value) => validate1539(value) || validate6(value);
291
+ const validate1539 = (value) => typeof value === "string" && (value === "grant" || value === "installation" || value === "policy");
292
+ const validate1542 = (value) => validate1434(value) || validate6(value);
293
+ const validate1556 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "to") && Object.hasOwn(value, "cc") && Object.hasOwn(value, "subject") && (!Object.hasOwn(value, "to") || validate45(value["to"])) && (!Object.hasOwn(value, "cc") || validate45(value["cc"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"]));
294
+ const validate1564 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1565(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1567(value["data"]));
295
+ const validate1565 = (value) => typeof value === "string" && value === "mailbox.action.resolved";
296
+ const validate1567 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "action") && Object.hasOwn(value, "resolution") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "action") || validate1572(value["action"])) && (!Object.hasOwn(value, "resolution") || validate1586(value["resolution"]));
297
+ const validate1572 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "type") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "proposedBy") && Object.hasOwn(value, "createdAt") && (!Object.hasOwn(value, "id") || validate1479(value["id"])) && (!Object.hasOwn(value, "type") || validate1528(value["type"])) && (!Object.hasOwn(value, "threadId") || validate1542(value["threadId"])) && (!Object.hasOwn(value, "proposedBy") || validate1482(value["proposedBy"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"]));
298
+ const validate1586 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "outcome") && Object.hasOwn(value, "actor") && Object.hasOwn(value, "resolvedAt") && Object.hasOwn(value, "reason") && (!Object.hasOwn(value, "outcome") || validate1587(value["outcome"])) && (!Object.hasOwn(value, "actor") || validate1482(value["actor"])) && (!Object.hasOwn(value, "resolvedAt") || validate2(value["resolvedAt"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"]));
299
+ const validate1587 = (value) => typeof value === "string" && (value === "approved" || value === "denied" || value === "cancelled");
300
+ const validate1599 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1600(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1602(value["data"]));
301
+ const validate1600 = (value) => typeof value === "string" && value === "mailbox.message.quarantined";
302
+ const validate1602 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "disposition") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "source") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "disposition") || validate1607(value["disposition"])) && (!Object.hasOwn(value, "reason") || validate1608(value["reason"])) && (!Object.hasOwn(value, "source") || validate1609(value["source"])) && (!Object.hasOwn(value, "message") || validate1610(value["message"]));
303
+ const validate1607 = (value) => typeof value === "string" && (value === "quarantined" || value === "isolated");
304
+ const validate1608 = (value) => typeof value === "string" && (value === "spam" || value === "dmarc" || value === "virus" || value === "virus_unscanned" || value === "phishing" || value === "fraud" || value === "prompt_injection");
305
+ const validate1609 = (value) => typeof value === "string" && (value === "receipt" || value === "classifier");
306
+ const validate1610 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "from") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "receivedAt") && (!Object.hasOwn(value, "id") || validate774(value["id"])) && (!Object.hasOwn(value, "from") || validate1435(value["from"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "receivedAt") || validate2(value["receivedAt"]));
307
+ const validate1621 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1622(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1624(value["data"]));
308
+ const validate1622 = (value) => typeof value === "string" && value === "mailbox.message.released";
309
+ const validate1624 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "releasedBy") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "message") && Object.hasOwn(value, "thread") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "releasedBy") || validate1482(value["releasedBy"])) && (!Object.hasOwn(value, "reason") || validate1608(value["reason"])) && (!Object.hasOwn(value, "message") || validate1431(value["message"])) && (!Object.hasOwn(value, "thread") || validate1460(value["thread"]));
310
+ const validate1677 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1678(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1680(value["data"]));
311
+ const validate1678 = (value) => typeof value === "string" && value === "mailbox.message.discarded";
312
+ const validate1680 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "discardedBy") && Object.hasOwn(value, "disposition") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "discardedBy") || validate1482(value["discardedBy"])) && (!Object.hasOwn(value, "disposition") || validate1607(value["disposition"])) && (!Object.hasOwn(value, "reason") || validate1608(value["reason"])) && (!Object.hasOwn(value, "message") || validate1610(value["message"]));
313
+ const validate1705 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1706(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1708(value["data"]));
314
+ const validate1706 = (value) => typeof value === "string" && value === "journey.webhook";
315
+ const validate1708 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "journeyId") && Object.hasOwn(value, "journeyVersion") && Object.hasOwn(value, "runId") && Object.hasOwn(value, "nodeId") && Object.hasOwn(value, "contact") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "journeyId") || validate1710(value["journeyId"])) && (!Object.hasOwn(value, "journeyVersion") || validate1270(value["journeyVersion"])) && (!Object.hasOwn(value, "runId") || validate1712(value["runId"])) && (!Object.hasOwn(value, "nodeId") || validate2(value["nodeId"])) && (!Object.hasOwn(value, "contact") || validate1714(value["contact"])) && (!Object.hasOwn(value, "data") || validate12(value["data"]));
316
+ const validate1710 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^jrny_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
317
+ const validate1712 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^jrun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
318
+ const validate1714 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "externalId") && Object.hasOwn(value, "email") && (!Object.hasOwn(value, "id") || validate945(value["id"])) && (!Object.hasOwn(value, "externalId") || validate8(value["externalId"])) && (!Object.hasOwn(value, "email") || validate8(value["email"]));
319
+ /** Narrow an event to a structurally valid payload known to this package. */
320
+ const isKnownEvent = (value) => {
321
+ switch (value.type) {
322
+ case "message.sent": return validate0(value);
323
+ case "message.delivered": return validate86(value);
324
+ case "message.read": return validate172(value);
325
+ case "message.failed": return validate258(value);
326
+ case "message.bounced": return validate344(value);
327
+ case "message.complained": return validate426(value);
328
+ case "message.received": return validate508(value);
329
+ case "message.opened": return validate841(value);
330
+ case "message.clicked": return validate889(value);
331
+ case "contact.created": return validate941(value);
332
+ case "contact.updated": return validate967(value);
333
+ case "contact.deleted": return validate993(value);
334
+ case "contact.subscribed": return validate1019(value);
335
+ case "contact.unsubscribed": return validate1053(value);
336
+ case "contact.resubscribed": return validate1087(value);
337
+ case "contact.consent_changed": return validate1121(value);
338
+ case "conversation.created": return validate1138(value);
339
+ case "conversation.updated": return validate1160(value);
340
+ case "conversation.archived": return validate1182(value);
341
+ case "webhook.created": return validate1204(value);
342
+ case "webhook.updated": return validate1221(value);
343
+ case "webhook.deleted": return validate1238(value);
344
+ case "webhook.test": return validate1255(value);
345
+ case "domain.updated": return validate1259(value);
346
+ case "domain.warming.updated": return validate1301(value);
347
+ case "template.registration.updated": return validate1325(value);
348
+ case "flow.registration.updated": return validate1361(value);
349
+ case "whatsapp.number.connected": return validate1403(value);
350
+ case "mailbox.message.received": return validate1423(value);
351
+ case "mailbox.message.sent": return validate1471(value);
352
+ case "mailbox.action.pending_approval": return validate1518(value);
353
+ case "mailbox.action.resolved": return validate1564(value);
354
+ case "mailbox.message.quarantined": return validate1599(value);
355
+ case "mailbox.message.released": return validate1621(value);
356
+ case "mailbox.message.discarded": return validate1677(value);
357
+ case "journey.webhook": return validate1705(value);
358
+ default: return false;
359
+ }
360
+ };
361
+ const validateEvent = (value) => {
362
+ if (!isObject(value) || typeof value.type !== "string" || typeof value.timestamp !== "string" || !Object.hasOwn(value, "data")) return false;
363
+ switch (value.type) {
364
+ case "message.sent": return validate0(value);
365
+ case "message.delivered": return validate86(value);
366
+ case "message.read": return validate172(value);
367
+ case "message.failed": return validate258(value);
368
+ case "message.bounced": return validate344(value);
369
+ case "message.complained": return validate426(value);
370
+ case "message.received": return validate508(value);
371
+ case "message.opened": return validate841(value);
372
+ case "message.clicked": return validate889(value);
373
+ case "contact.created": return validate941(value);
374
+ case "contact.updated": return validate967(value);
375
+ case "contact.deleted": return validate993(value);
376
+ case "contact.subscribed": return validate1019(value);
377
+ case "contact.unsubscribed": return validate1053(value);
378
+ case "contact.resubscribed": return validate1087(value);
379
+ case "contact.consent_changed": return validate1121(value);
380
+ case "conversation.created": return validate1138(value);
381
+ case "conversation.updated": return validate1160(value);
382
+ case "conversation.archived": return validate1182(value);
383
+ case "webhook.created": return validate1204(value);
384
+ case "webhook.updated": return validate1221(value);
385
+ case "webhook.deleted": return validate1238(value);
386
+ case "webhook.test": return validate1255(value);
387
+ case "domain.updated": return validate1259(value);
388
+ case "domain.warming.updated": return validate1301(value);
389
+ case "template.registration.updated": return validate1325(value);
390
+ case "flow.registration.updated": return validate1361(value);
391
+ case "whatsapp.number.connected": return validate1403(value);
392
+ case "mailbox.message.received": return validate1423(value);
393
+ case "mailbox.message.sent": return validate1471(value);
394
+ case "mailbox.action.pending_approval": return validate1518(value);
395
+ case "mailbox.action.resolved": return validate1564(value);
396
+ case "mailbox.message.quarantined": return validate1599(value);
397
+ case "mailbox.message.released": return validate1621(value);
398
+ case "mailbox.message.discarded": return validate1677(value);
399
+ case "journey.webhook": return validate1705(value);
400
+ default: return true;
401
+ }
402
+ };
403
+ //#endregion
404
+ //#region src/errors.ts
405
+ /**
406
+ * Base class for every failure this package reports while verifying a webhook delivery.
407
+ *
408
+ * Each subclass carries a literal `_tag` (also used as `name`), so you can branch on the failure
409
+ * with a `switch` or Effect's `catchTag`. `detail` is a human-readable reason for your logs; do not
410
+ * echo it to the sender, and do not match on its wording.
411
+ */
412
+ var WebhookVerificationError = class extends Error {
413
+ /** Discriminant naming the concrete failure; equal to the subclass name. */
414
+ _tag;
415
+ /** Human-readable reason for logs. The wording is not a stable contract. */
416
+ detail;
417
+ constructor(tag, options) {
418
+ super(options.detail);
419
+ this.name = tag;
420
+ this._tag = tag;
421
+ this.detail = options.detail;
422
+ }
423
+ };
424
+ /**
425
+ * The signing secret is unusable: it lacks the `whsec_` prefix, the remainder is not Base64, or
426
+ * the decoded key length is outside the accepted range (`detail` names the range). This is a
427
+ * configuration error on the receiving side, not a bad delivery; copy the endpoint's signing
428
+ * secret from Samva again.
429
+ */
430
+ var InvalidWebhookSecretError = class extends WebhookVerificationError {
431
+ constructor(options) {
432
+ super("InvalidWebhookSecretError", options);
433
+ }
434
+ };
435
+ /**
436
+ * One of the `webhook-id`, `webhook-timestamp`, or `webhook-signature` headers is missing or
437
+ * empty; `header` names it. The request is not a Samva delivery, or something between Samva and
438
+ * your handler stripped the headers.
439
+ */
440
+ var InvalidWebhookHeadersError = class extends WebhookVerificationError {
441
+ /** The first signing header, in id, timestamp, signature order, that is missing or empty. */
442
+ header;
443
+ constructor(options) {
444
+ super("InvalidWebhookHeadersError", options);
445
+ this.header = options.header;
446
+ }
447
+ };
448
+ /**
449
+ * The `webhook-timestamp` header is not an integer count of Unix seconds, it lies further from the
450
+ * current time than the replay tolerance, or the tolerance you passed is negative or not finite.
451
+ * A delivery outside the tolerance is rejected even when its signature is valid; that bounds how
452
+ * long a captured request can be replayed. Repeated failures on genuine deliveries usually mean
453
+ * the receiving server's clock is wrong.
454
+ */
455
+ var WebhookTimestampError = class extends WebhookVerificationError {
456
+ constructor(options) {
457
+ super("WebhookTimestampError", options);
458
+ }
459
+ };
460
+ /**
461
+ * No signature in the `webhook-signature` header matches the delivery, or no verification key was
462
+ * supplied. Treat the request as forged and reject it. When genuine deliveries fail, the usual
463
+ * causes are the wrong endpoint secret or a body that was parsed and re-serialized before
464
+ * verification instead of passed through as the exact bytes received.
465
+ */
466
+ var WebhookSignatureError = class extends WebhookVerificationError {
467
+ constructor(options) {
468
+ super("WebhookSignatureError", options);
469
+ }
470
+ };
471
+ /**
472
+ * The signature is valid, but the body is not UTF-8 JSON holding exactly the `type`,
473
+ * `timestamp`, and `data` fields of a Samva event envelope.
474
+ */
475
+ var MalformedWebhookPayloadError = class extends WebhookVerificationError {
476
+ constructor(options) {
477
+ super("MalformedWebhookPayloadError", options);
478
+ }
479
+ };
480
+ /**
481
+ * The runtime's Web Crypto implementation could not import a key or compute a signature, none of
482
+ * the supplied public keys could be imported, or the Effect entrypoint could not read the request
483
+ * body. Points at the runtime or its configuration rather than at the delivery.
484
+ */
485
+ var WebhookCryptoError = class extends WebhookVerificationError {
486
+ constructor(options) {
487
+ super("WebhookCryptoError", options);
488
+ }
489
+ };
490
+ //#endregion
491
+ //#region src/protocol.ts
492
+ /**
493
+ * Header carrying the delivery's unique message ID. Retries of the same delivery reuse it, so it
494
+ * is the key for deduplicating deliveries you have already handled.
495
+ */
496
+ const WEBHOOK_ID_HEADER = "webhook-id";
497
+ /** Header carrying the time Samva signed the delivery, as integer Unix seconds. */
498
+ const WEBHOOK_TIMESTAMP_HEADER = "webhook-timestamp";
499
+ /**
500
+ * Header carrying one or more space-separated `<version>,<base64 signature>` entries. More than one
501
+ * entry appears while a signing secret is being rotated; a delivery verifies when any entry of the
502
+ * expected version matches.
503
+ */
504
+ const WEBHOOK_SIGNATURE_HEADER = "webhook-signature";
505
+ /**
506
+ * Replay tolerance, in seconds, used when a caller passes no `toleranceSeconds`. A delivery whose
507
+ * `webhook-timestamp` differs from the current time by more than this, in either direction, is
508
+ * rejected with {@link WebhookTimestampError}.
509
+ */
510
+ const DEFAULT_TOLERANCE_SECONDS = 300;
511
+ const SECRET_PREFIX = "whsec_";
512
+ const ASYMMETRIC_ALGORITHM = {
513
+ name: "RSASSA-PKCS1-v1_5",
514
+ hash: "SHA-256"
515
+ };
516
+ const MINIMUM_SECRET_BYTES = 24;
517
+ const MAXIMUM_SECRET_BYTES = 64;
518
+ const GENERATED_SECRET_BYTES = 32;
519
+ const encoder = new TextEncoder();
520
+ const toBytes = (body) => typeof body === "string" ? encoder.encode(body) : body;
521
+ const toCryptoBytes = (bytes) => new Uint8Array(bytes);
522
+ const bytesToBase64 = (bytes) => {
523
+ let binary = "";
524
+ for (const byte of bytes) binary += String.fromCharCode(byte);
525
+ return btoa(binary);
526
+ };
527
+ const base64ToBytes = (encoded) => {
528
+ const binary = atob(encoded);
529
+ return Uint8Array.from(binary, (character) => character.charCodeAt(0));
530
+ };
531
+ const decodeSecret = (secret) => {
532
+ if (!secret.startsWith(SECRET_PREFIX)) throw new InvalidWebhookSecretError({ detail: "Webhook secret must start with whsec_" });
533
+ const decoded = (() => {
534
+ try {
535
+ return base64ToBytes(secret.slice(6));
536
+ } catch {
537
+ throw new InvalidWebhookSecretError({ detail: "Webhook secret is not valid Base64" });
538
+ }
539
+ })();
540
+ if (decoded.byteLength < MINIMUM_SECRET_BYTES || decoded.byteLength > MAXIMUM_SECRET_BYTES) throw new InvalidWebhookSecretError({ detail: `Webhook secret must decode to ${MINIMUM_SECRET_BYTES}-${MAXIMUM_SECRET_BYTES} bytes` });
541
+ return decoded;
542
+ };
543
+ const importHmacKey = async (secret) => {
544
+ const secretBytes = decodeSecret(secret);
545
+ try {
546
+ return await crypto.subtle.importKey("raw", toCryptoBytes(secretBytes), {
547
+ name: "HMAC",
548
+ hash: "SHA-256"
549
+ }, false, ["sign"]);
550
+ } catch (cause) {
551
+ throw new WebhookCryptoError({ detail: `Unable to import webhook signing key: ${cause instanceof Error ? cause.message : String(cause)}` });
552
+ }
553
+ };
554
+ const importVerificationKey = async (publicKey) => {
555
+ try {
556
+ return await crypto.subtle.importKey("spki", toCryptoBytes(base64ToBytes(publicKey.trim())), ASYMMETRIC_ALGORITHM, false, ["verify"]);
557
+ } catch {
558
+ return;
559
+ }
560
+ };
561
+ const signedBytes = (id, timestamp, body) => {
562
+ const prefix = encoder.encode(`${id}.${timestamp}.`);
563
+ const material = new Uint8Array(prefix.byteLength + body.byteLength);
564
+ material.set(prefix);
565
+ material.set(body, prefix.byteLength);
566
+ return material;
567
+ };
568
+ const hmac = async (secret, id, timestamp, body) => {
569
+ const key = await importHmacKey(secret);
570
+ try {
571
+ return new Uint8Array(await crypto.subtle.sign("HMAC", key, toCryptoBytes(signedBytes(id, timestamp, body))));
572
+ } catch (cause) {
573
+ throw new WebhookCryptoError({ detail: `Unable to sign webhook: ${cause instanceof Error ? cause.message : String(cause)}` });
574
+ }
575
+ };
576
+ const asymmetricMatch = async (key, candidate, content) => {
577
+ try {
578
+ return await crypto.subtle.verify(ASYMMETRIC_ALGORITHM, key, toCryptoBytes(candidate), content);
579
+ } catch {
580
+ return false;
581
+ }
582
+ };
583
+ const timingSafeEqual = (left, right) => {
584
+ if (left.byteLength !== right.byteLength) return false;
585
+ let difference = 0;
586
+ for (let index = 0; index < left.byteLength; index += 1) difference |= (left[index] ?? 0) ^ (right[index] ?? 0);
587
+ return difference === 0;
588
+ };
589
+ const signatureCandidates = (header, expected) => header.split(" ").map((candidate) => candidate.split(",", 2)).flatMap(([version, encoded]) => {
590
+ if (version !== expected || encoded === void 0) return [];
591
+ try {
592
+ return [base64ToBytes(encoded)];
593
+ } catch {
594
+ return [];
595
+ }
596
+ });
597
+ const parseEvent = (body) => {
598
+ try {
599
+ const parsed = JSON.parse(new TextDecoder("utf-8", {
600
+ fatal: true,
601
+ ignoreBOM: false
602
+ }).decode(body));
603
+ if (!validateEvent(parsed)) throw new MalformedWebhookPayloadError({ detail: "Webhook event does not match its payload schema" });
604
+ return parsed;
605
+ } catch {
606
+ throw new MalformedWebhookPayloadError({ detail: "Webhook body must be valid UTF-8 JSON matching a Samva event payload schema" });
607
+ }
608
+ };
609
+ /**
610
+ * Creates a random `whsec_`-prefixed signing secret from the runtime's secure random source.
611
+ * Samva issues each endpoint's secret for you; use this to sign test deliveries with
612
+ * {@link signWebhook}.
613
+ */
614
+ const generateWebhookSecret = () => {
615
+ const bytes = crypto.getRandomValues(new Uint8Array(GENERATED_SECRET_BYTES));
616
+ return `${SECRET_PREFIX}${bytesToBase64(bytes)}`;
617
+ };
618
+ /**
619
+ * Builds the bytes every signature version covers: `<id>.<timestamp>.<body>`. Use it to verify a
620
+ * signature with your own crypto code; {@link verifyWebhookAt} and
621
+ * {@link verifyWebhookAtWithPublicKeys} build it for you.
622
+ */
623
+ const webhookSignedContent = (input) => signedBytes(input.id, input.timestamp, toBytes(input.body));
624
+ /** Formats raw signature bytes as one `<version>,<base64>` entry of the `webhook-signature` header. */
625
+ const encodeWebhookSignature = (version, signature) => `${version},${bytesToBase64(signature)}`;
626
+ /**
627
+ * Computes the `v1` HMAC-SHA256 signature Samva sends, formatted as one `webhook-signature`
628
+ * entry. Use it to produce signed test deliveries for your handler.
629
+ *
630
+ * `timestamp` is Unix seconds; a number is stringified, and the verifier requires an integer.
631
+ * Rejects with {@link InvalidWebhookSecretError} for an unusable secret and
632
+ * {@link WebhookCryptoError} when Web Crypto fails.
633
+ */
634
+ const signWebhook = async (input) => {
635
+ const timestamp = String(input.timestamp);
636
+ const signature = await hmac(input.secret, input.id, timestamp, toBytes(input.body));
637
+ return encodeWebhookSignature("v1", signature);
638
+ };
639
+ const requireHeader = (header, value) => {
640
+ if (value === null || value === void 0) throw new InvalidWebhookHeadersError({
641
+ header,
642
+ detail: `${header} header is missing`
643
+ });
644
+ if (value.length === 0) throw new InvalidWebhookHeadersError({
645
+ header,
646
+ detail: `${header} header is empty`
647
+ });
648
+ return value;
649
+ };
650
+ const requireHeaders = (values) => ({
651
+ id: requireHeader(WEBHOOK_ID_HEADER, values.id),
652
+ timestamp: requireHeader(WEBHOOK_TIMESTAMP_HEADER, values.timestamp),
653
+ signature: requireHeader(WEBHOOK_SIGNATURE_HEADER, values.signature)
654
+ });
655
+ const freshHeaders = (input) => {
656
+ const { id, timestamp, signature } = requireHeaders(input.headers);
657
+ const timestampSeconds = Number(timestamp);
658
+ if (!Number.isInteger(timestampSeconds)) throw new WebhookTimestampError({ detail: "webhook-timestamp must be Unix seconds" });
659
+ const toleranceSeconds = input.toleranceSeconds ?? 300;
660
+ if (!Number.isFinite(toleranceSeconds) || toleranceSeconds < 0) throw new WebhookTimestampError({ detail: "Webhook tolerance must be non-negative" });
661
+ if (Math.abs(input.nowMilliseconds / 1e3 - timestampSeconds) > toleranceSeconds) throw new WebhookTimestampError({ detail: "Webhook timestamp is outside the replay tolerance" });
662
+ return {
663
+ id,
664
+ timestamp,
665
+ signature
666
+ };
667
+ };
668
+ /**
669
+ * Verifies a `v1` (HMAC-SHA256) delivery against an explicit current time. The `verify` and
670
+ * `verifyRequest` entry points call this with the current clock; call it directly when your
671
+ * framework owns the clock or a test needs a fixed time.
672
+ *
673
+ * Checks, in order: all three headers are present and non-empty; the timestamp is integer Unix seconds within
674
+ * `toleranceSeconds` of `nowMilliseconds`; some `v1` entry in the signature header matches, using
675
+ * a constant-time comparison; the body has a valid envelope and known event payloads match their schema. Unknown event types pass
676
+ * through with untyped data. The replay window rejects stale
677
+ * deliveries but does not detect a repeat inside it; deduplicate on the returned `id`.
678
+ *
679
+ * Rejects with {@link InvalidWebhookHeadersError}, {@link WebhookTimestampError},
680
+ * {@link InvalidWebhookSecretError}, {@link WebhookSignatureError},
681
+ * {@link MalformedWebhookPayloadError}, or {@link WebhookCryptoError}.
682
+ */
683
+ const verifyWebhookAt = async (input) => {
684
+ const { id, timestamp, signature } = freshHeaders(input);
685
+ const body = toBytes(input.body);
686
+ const expected = await hmac(input.secret, id, timestamp, body);
687
+ if (!signatureCandidates(signature, "v1").some((candidate) => timingSafeEqual(expected, candidate))) throw new WebhookSignatureError({ detail: "Webhook signature verification failed" });
688
+ return {
689
+ id,
690
+ event: parseEvent(body)
691
+ };
692
+ };
693
+ /**
694
+ * Verifies a `v2` (RSASSA-PKCS1-v1_5, SHA-256) delivery against one or more public keys, each a
695
+ * Base64-encoded SPKI DER key. Pass several keys during a key rotation; the delivery verifies when
696
+ * any `v2` signature entry matches any key.
697
+ *
698
+ * Header, timestamp, and envelope checks match {@link verifyWebhookAt}. Keys that fail to import
699
+ * are skipped. Rejects with {@link WebhookSignatureError} when `publicKeys` is empty or nothing
700
+ * matches, and {@link WebhookCryptoError} when none of the keys imports.
701
+ */
702
+ const verifyWebhookAtWithPublicKeys = async (input) => {
703
+ const { id, timestamp, signature } = freshHeaders(input);
704
+ if (input.publicKeys.length === 0) throw new WebhookSignatureError({ detail: "No webhook verification key is available" });
705
+ const keys = (await Promise.all(input.publicKeys.map(importVerificationKey))).filter((key) => key !== void 0);
706
+ if (keys.length === 0) throw new WebhookCryptoError({ detail: "Unable to import any webhook verification key: keys must be Base64 SPKI DER" });
707
+ const body = toBytes(input.body);
708
+ const content = toCryptoBytes(signedBytes(id, timestamp, body));
709
+ const candidates = signatureCandidates(signature, "v2");
710
+ if (!(await Promise.all(keys.flatMap((key) => candidates.map((candidate) => asymmetricMatch(key, candidate, content))))).includes(true)) throw new WebhookSignatureError({ detail: "Webhook signature verification failed" });
711
+ return {
712
+ id,
713
+ event: parseEvent(body)
714
+ };
715
+ };
716
+ /**
717
+ * Reads the three signing headers from a Fetch API `Headers` object, for code that needs a header
718
+ * value, such as the timestamp, before or beside verification. Throws
719
+ * {@link InvalidWebhookHeadersError}, naming the header, when one is missing or empty; call it
720
+ * inside the same error handling as the verification that follows.
721
+ */
722
+ const readWebhookHeaders = (headers) => requireHeaders({
723
+ id: headers.get(WEBHOOK_ID_HEADER),
724
+ timestamp: headers.get(WEBHOOK_TIMESTAMP_HEADER),
725
+ signature: headers.get(WEBHOOK_SIGNATURE_HEADER)
726
+ });
727
+ //#endregion
728
+ export { WebhookTimestampError as _, encodeWebhookSignature as a, signWebhook as c, webhookSignedContent as d, InvalidWebhookHeadersError as f, WebhookSignatureError as g, WebhookCryptoError as h, WEBHOOK_TIMESTAMP_HEADER as i, verifyWebhookAt as l, MalformedWebhookPayloadError as m, WEBHOOK_ID_HEADER as n, generateWebhookSecret as o, InvalidWebhookSecretError as p, WEBHOOK_SIGNATURE_HEADER as r, readWebhookHeaders as s, DEFAULT_TOLERANCE_SECONDS as t, verifyWebhookAtWithPublicKeys as u, WebhookVerificationError as v, isKnownEvent as y };
729
+
730
+ //# sourceMappingURL=protocol-8ERuoP0F.js.map