meta-cloud-api 0.1.11 → 0.1.13

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.
Files changed (132) hide show
  1. package/dist/api/base.d.mts +1 -1
  2. package/dist/api/base.d.ts +1 -1
  3. package/dist/api/businessProfile.d.mts +1 -1
  4. package/dist/api/businessProfile.d.ts +1 -1
  5. package/dist/api/businessProfile.js +1 -1
  6. package/dist/api/businessProfile.mjs +1 -1
  7. package/dist/api/encryption.d.mts +1 -1
  8. package/dist/api/encryption.d.ts +1 -1
  9. package/dist/api/encryption.js +1 -1
  10. package/dist/api/flow.d.mts +1 -1
  11. package/dist/api/flow.d.ts +1 -1
  12. package/dist/api/flow.js +1 -1
  13. package/dist/api/index.d.mts +1 -1
  14. package/dist/api/index.d.ts +1 -1
  15. package/dist/api/index.js +1 -1
  16. package/dist/api/index.mjs +1 -1
  17. package/dist/api/media.d.mts +1 -1
  18. package/dist/api/media.d.ts +1 -1
  19. package/dist/api/media.js +1 -1
  20. package/dist/api/messages.d.mts +1 -1
  21. package/dist/api/messages.d.ts +1 -1
  22. package/dist/api/messages.js +1 -1
  23. package/dist/api/messages.mjs +1 -1
  24. package/dist/api/phoneNumber.d.mts +1 -1
  25. package/dist/api/phoneNumber.d.ts +1 -1
  26. package/dist/api/phoneNumber.js +1 -1
  27. package/dist/api/qrCode.d.mts +1 -1
  28. package/dist/api/qrCode.d.ts +1 -1
  29. package/dist/api/qrCode.js +1 -1
  30. package/dist/api/registration.d.mts +1 -1
  31. package/dist/api/registration.d.ts +1 -1
  32. package/dist/api/registration.js +1 -1
  33. package/dist/api/template.d.mts +1 -1
  34. package/dist/api/template.d.ts +1 -1
  35. package/dist/api/template.js +1 -1
  36. package/dist/api/template.mjs +1 -1
  37. package/dist/api/twoStepVerification.d.mts +1 -1
  38. package/dist/api/twoStepVerification.d.ts +1 -1
  39. package/dist/api/twoStepVerification.js +1 -1
  40. package/dist/api/waba.d.mts +1 -1
  41. package/dist/api/waba.d.ts +1 -1
  42. package/dist/api/waba.js +1 -1
  43. package/dist/api/waba.mjs +1 -1
  44. package/dist/{enums-D7paGoTY.d.mts → enums-DEhBfoMC.d.mts} +16 -11
  45. package/dist/{enums-D7paGoTY.d.ts → enums-DEhBfoMC.d.ts} +16 -11
  46. package/dist/httpsClient.d.mts +1 -1
  47. package/dist/httpsClient.d.ts +1 -1
  48. package/dist/index.d.mts +1 -1
  49. package/dist/index.d.ts +1 -1
  50. package/dist/index.js +1 -1
  51. package/dist/index.js.map +1 -1
  52. package/dist/index.mjs +1 -1
  53. package/dist/index.mjs.map +1 -1
  54. package/dist/request.d.mts +1 -1
  55. package/dist/request.d.ts +1 -1
  56. package/dist/types/base.d.mts +1 -1
  57. package/dist/types/base.d.ts +1 -1
  58. package/dist/types/businessProfile.d.mts +1 -1
  59. package/dist/types/businessProfile.d.ts +1 -1
  60. package/dist/types/config.d.mts +1 -1
  61. package/dist/types/config.d.ts +1 -1
  62. package/dist/types/encryption.d.mts +1 -1
  63. package/dist/types/encryption.d.ts +1 -1
  64. package/dist/types/enums.d.mts +1 -1
  65. package/dist/types/enums.d.ts +1 -1
  66. package/dist/types/enums.js +1 -1
  67. package/dist/types/enums.js.map +1 -1
  68. package/dist/types/enums.mjs +1 -1
  69. package/dist/types/enums.mjs.map +1 -1
  70. package/dist/types/flow.d.mts +1 -1
  71. package/dist/types/flow.d.ts +1 -1
  72. package/dist/types/httpsClient.d.mts +1 -1
  73. package/dist/types/httpsClient.d.ts +1 -1
  74. package/dist/types/index.d.mts +1 -1
  75. package/dist/types/index.d.ts +1 -1
  76. package/dist/types/index.js +1 -1
  77. package/dist/types/index.js.map +1 -1
  78. package/dist/types/index.mjs +1 -1
  79. package/dist/types/index.mjs.map +1 -1
  80. package/dist/types/media.d.mts +1 -1
  81. package/dist/types/media.d.ts +1 -1
  82. package/dist/types/messages.d.mts +1 -1
  83. package/dist/types/messages.d.ts +1 -1
  84. package/dist/types/phoneNumber.d.mts +1 -1
  85. package/dist/types/phoneNumber.d.ts +1 -1
  86. package/dist/types/qrCode.d.mts +1 -1
  87. package/dist/types/qrCode.d.ts +1 -1
  88. package/dist/types/registration.d.mts +1 -1
  89. package/dist/types/registration.d.ts +1 -1
  90. package/dist/types/request.d.mts +1 -1
  91. package/dist/types/request.d.ts +1 -1
  92. package/dist/types/template.d.mts +1 -1
  93. package/dist/types/template.d.ts +1 -1
  94. package/dist/types/twoStepVerification.d.mts +1 -1
  95. package/dist/types/twoStepVerification.d.ts +1 -1
  96. package/dist/types/waba.d.mts +1 -1
  97. package/dist/types/waba.d.ts +1 -1
  98. package/dist/types/webhook.d.mts +4 -20
  99. package/dist/types/webhook.d.ts +4 -20
  100. package/dist/types/webhook.js +1 -1
  101. package/dist/types/webhook.js.map +1 -1
  102. package/dist/types/webhook.mjs +1 -1
  103. package/dist/types/webhook.mjs.map +1 -1
  104. package/dist/types/whatsapp.d.mts +1 -1
  105. package/dist/types/whatsapp.d.ts +1 -1
  106. package/dist/utils/filters.d.mts +3 -2
  107. package/dist/utils/filters.d.ts +3 -2
  108. package/dist/utils/filters.js +1 -1
  109. package/dist/utils/filters.js.map +1 -1
  110. package/dist/utils/filters.mjs +1 -1
  111. package/dist/utils/filters.mjs.map +1 -1
  112. package/dist/utils/importConfig.d.mts +1 -1
  113. package/dist/utils/importConfig.d.ts +1 -1
  114. package/dist/utils/importConfig.js +1 -1
  115. package/dist/utils/importConfig.mjs +1 -1
  116. package/dist/utils/index.d.mts +1 -1
  117. package/dist/utils/index.d.ts +1 -1
  118. package/dist/utils/index.js +1 -1
  119. package/dist/utils/index.mjs +1 -1
  120. package/dist/webhook.d.mts +19 -8
  121. package/dist/webhook.d.ts +19 -8
  122. package/dist/webhook.js +1 -1
  123. package/dist/webhook.js.map +1 -1
  124. package/dist/webhook.mjs +1 -1
  125. package/dist/webhook.mjs.map +1 -1
  126. package/dist/whatsapp.d.mts +1 -1
  127. package/dist/whatsapp.d.ts +1 -1
  128. package/dist/whatsapp.js +1 -1
  129. package/dist/whatsapp.js.map +1 -1
  130. package/dist/whatsapp.mjs +1 -1
  131. package/dist/whatsapp.mjs.map +1 -1
  132. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { Paging, ResponseSuccess } from './request.js';
2
- import '../enums-D7paGoTY.js';
2
+ import '../enums-DEhBfoMC.js';
3
3
 
4
4
  type QualityRating = 'GREEN' | 'YELLOW' | 'RED' | 'NA';
5
5
  type AccountMode = 'LIVE' | 'SANDBOX';
@@ -1,5 +1,5 @@
1
1
  import { ResponseData, ResponseSuccess } from './request.mjs';
2
- import '../enums-D7paGoTY.mjs';
2
+ import '../enums-DEhBfoMC.mjs';
3
3
 
4
4
  type QrCodeResponse = {
5
5
  code: string;
@@ -1,5 +1,5 @@
1
1
  import { ResponseData, ResponseSuccess } from './request.js';
2
- import '../enums-D7paGoTY.js';
2
+ import '../enums-DEhBfoMC.js';
3
3
 
4
4
  type QrCodeResponse = {
5
5
  code: string;
@@ -1,4 +1,4 @@
1
- import { j as DataLocalizationRegionEnum } from '../enums-D7paGoTY.mjs';
1
+ import { j as DataLocalizationRegionEnum } from '../enums-DEhBfoMC.mjs';
2
2
  import { ResponseSuccess } from './request.mjs';
3
3
 
4
4
  type RegistrationRequest = {
@@ -1,4 +1,4 @@
1
- import { j as DataLocalizationRegionEnum } from '../enums-D7paGoTY.js';
1
+ import { j as DataLocalizationRegionEnum } from '../enums-DEhBfoMC.js';
2
2
  import { ResponseSuccess } from './request.js';
3
3
 
4
4
  type RegistrationRequest = {
@@ -1,4 +1,4 @@
1
- import { H as HttpMethodsEnum } from '../enums-D7paGoTY.mjs';
1
+ import { H as HttpMethodsEnum } from '../enums-DEhBfoMC.mjs';
2
2
 
3
3
  type GeneralRequestBody = Record<string, unknown>;
4
4
  interface GeneralHeaderInterface {
@@ -1,4 +1,4 @@
1
- import { H as HttpMethodsEnum } from '../enums-D7paGoTY.js';
1
+ import { H as HttpMethodsEnum } from '../enums-DEhBfoMC.js';
2
2
 
3
3
  type GeneralRequestBody = Record<string, unknown>;
4
4
  interface GeneralHeaderInterface {
@@ -1,4 +1,4 @@
1
- import { L as LanguagesEnum, C as CategoryEnum, T as TemplateStatusEnum } from '../enums-D7paGoTY.mjs';
1
+ import { L as LanguagesEnum, C as CategoryEnum, T as TemplateStatusEnum } from '../enums-DEhBfoMC.mjs';
2
2
  import { GeneralRequestBody, ResponseSuccess, ResponsePagination } from './request.mjs';
3
3
 
4
4
  type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION';
@@ -1,4 +1,4 @@
1
- import { L as LanguagesEnum, C as CategoryEnum, T as TemplateStatusEnum } from '../enums-D7paGoTY.js';
1
+ import { L as LanguagesEnum, C as CategoryEnum, T as TemplateStatusEnum } from '../enums-DEhBfoMC.js';
2
2
  import { GeneralRequestBody, ResponseSuccess, ResponsePagination } from './request.js';
3
3
 
4
4
  type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION';
@@ -1,5 +1,5 @@
1
1
  import { ResponseSuccess } from './request.mjs';
2
- import '../enums-D7paGoTY.mjs';
2
+ import '../enums-DEhBfoMC.mjs';
3
3
 
4
4
  type TwoStepVerificationRequest = {
5
5
  pin: string;
@@ -1,5 +1,5 @@
1
1
  import { ResponseSuccess } from './request.js';
2
- import '../enums-D7paGoTY.js';
2
+ import '../enums-DEhBfoMC.js';
3
3
 
4
4
  type TwoStepVerificationRequest = {
5
5
  pin: string;
@@ -1,5 +1,5 @@
1
1
  import { ResponseSuccess } from './request.mjs';
2
- import '../enums-D7paGoTY.mjs';
2
+ import '../enums-DEhBfoMC.mjs';
3
3
 
4
4
  type WabaSubscription = {
5
5
  whatsapp_business_api_data: {
@@ -1,5 +1,5 @@
1
1
  import { ResponseSuccess } from './request.js';
2
- import '../enums-D7paGoTY.js';
2
+ import '../enums-DEhBfoMC.js';
3
3
 
4
4
  type WabaSubscription = {
5
5
  whatsapp_business_api_data: {
@@ -1,3 +1,5 @@
1
+ import { M as MessageTypesEnum } from '../enums-DEhBfoMC.mjs';
2
+
1
3
  /**
2
4
  * Represents a message received through the webhook
3
5
  * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
@@ -18,7 +20,7 @@ interface WebhookMessage {
18
20
  /**
19
21
  * The type of message (text, image, etc.)
20
22
  */
21
- type: MessageType;
23
+ type: MessageTypesEnum;
22
24
  /**
23
25
  * The phone number ID that received the message
24
26
  */
@@ -395,24 +397,6 @@ type MessageHandler = (message: WebhookMessage) => void | Promise<void>;
395
397
  * Handler function for processing events
396
398
  */
397
399
  type EventHandler = (event: WebhookEvent) => void | Promise<void>;
398
- /**
399
- * Message types that can be received through the webhook
400
- */
401
- declare enum MessageType {
402
- TEXT = "text",
403
- IMAGE = "image",
404
- AUDIO = "audio",
405
- VIDEO = "video",
406
- DOCUMENT = "document",
407
- STICKER = "sticker",
408
- LOCATION = "location",
409
- CONTACTS = "contacts",
410
- BUTTON = "button",
411
- INTERACTIVE = "interactive",
412
- ORDER = "order",
413
- SYSTEM = "system",
414
- UNKNOWN = "unknown"
415
- }
416
400
  /**
417
401
  * Statuses that can be received in status updates
418
402
  */
@@ -433,4 +417,4 @@ declare enum EventField {
433
417
  UNKNOWN = "unknown"
434
418
  }
435
419
 
436
- export { EventField, type EventHandler, type MessageHandler, MessageStatus, MessageType, type WebhookEvent, type WebhookMessage };
420
+ export { EventField, type EventHandler, type MessageHandler, MessageStatus, type WebhookEvent, type WebhookMessage };
@@ -1,3 +1,5 @@
1
+ import { M as MessageTypesEnum } from '../enums-DEhBfoMC.js';
2
+
1
3
  /**
2
4
  * Represents a message received through the webhook
3
5
  * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object
@@ -18,7 +20,7 @@ interface WebhookMessage {
18
20
  /**
19
21
  * The type of message (text, image, etc.)
20
22
  */
21
- type: MessageType;
23
+ type: MessageTypesEnum;
22
24
  /**
23
25
  * The phone number ID that received the message
24
26
  */
@@ -395,24 +397,6 @@ type MessageHandler = (message: WebhookMessage) => void | Promise<void>;
395
397
  * Handler function for processing events
396
398
  */
397
399
  type EventHandler = (event: WebhookEvent) => void | Promise<void>;
398
- /**
399
- * Message types that can be received through the webhook
400
- */
401
- declare enum MessageType {
402
- TEXT = "text",
403
- IMAGE = "image",
404
- AUDIO = "audio",
405
- VIDEO = "video",
406
- DOCUMENT = "document",
407
- STICKER = "sticker",
408
- LOCATION = "location",
409
- CONTACTS = "contacts",
410
- BUTTON = "button",
411
- INTERACTIVE = "interactive",
412
- ORDER = "order",
413
- SYSTEM = "system",
414
- UNKNOWN = "unknown"
415
- }
416
400
  /**
417
401
  * Statuses that can be received in status updates
418
402
  */
@@ -433,4 +417,4 @@ declare enum EventField {
433
417
  UNKNOWN = "unknown"
434
418
  }
435
419
 
436
- export { EventField, type EventHandler, type MessageHandler, MessageStatus, MessageType, type WebhookEvent, type WebhookMessage };
420
+ export { EventField, type EventHandler, type MessageHandler, MessageStatus, type WebhookEvent, type WebhookMessage };
@@ -1,2 +1,2 @@
1
- "use strict";var a=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(i,r)=>{for(var o in r)a(i,o,{get:r[o],enumerable:!0})},l=(i,r,o,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of u(r))!c.call(i,s)&&s!==o&&a(i,s,{get:()=>r[s],enumerable:!(n=_(r,s))||n.enumerable});return i};var y=i=>l(a({},"__esModule",{value:!0}),i);var E={};p(E,{EventField:()=>m,MessageStatus:()=>d,MessageType:()=>g});module.exports=y(E);var g=(t=>(t.TEXT="text",t.IMAGE="image",t.AUDIO="audio",t.VIDEO="video",t.DOCUMENT="document",t.STICKER="sticker",t.LOCATION="location",t.CONTACTS="contacts",t.BUTTON="button",t.INTERACTIVE="interactive",t.ORDER="order",t.SYSTEM="system",t.UNKNOWN="unknown",t))(g||{}),d=(n=>(n.DELIVERED="delivered",n.READ="read",n.SENT="sent",n))(d||{}),m=(e=>(e.MESSAGES="messages",e.STATUSES="statuses",e.MESSAGE_TEMPLATE_STATUS_UPDATE="message_template_status_update",e.PHONE_NUMBER_QUALITY_UPDATE="phone_number_quality_update",e.PHONE_NUMBER_NAME_UPDATE="phone_number_name_update",e.UNKNOWN="unknown",e))(m||{});0&&(module.exports={EventField,MessageStatus,MessageType});
1
+ "use strict";var g=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var _=(r,t)=>{for(var s in t)g(r,s,{get:t[s],enumerable:!0})},y=(r,t,s,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!p.call(r,n)&&n!==s&&g(r,n,{get:()=>t[n],enumerable:!(e=d(t,n))||e.enumerable});return r};var u=r=>y(g({},"__esModule",{value:!0}),r);var c={};_(c,{EventField:()=>o,MessageStatus:()=>a});module.exports=u(c);var a=(e=>(e.DELIVERED="delivered",e.READ="read",e.SENT="sent",e))(a||{}),o=(i=>(i.MESSAGES="messages",i.STATUSES="statuses",i.MESSAGE_TEMPLATE_STATUS_UPDATE="message_template_status_update",i.PHONE_NUMBER_QUALITY_UPDATE="phone_number_quality_update",i.PHONE_NUMBER_NAME_UPDATE="phone_number_name_update",i.UNKNOWN="unknown",i))(o||{});0&&(module.exports={EventField,MessageStatus});
2
2
  //# sourceMappingURL=webhook.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/webhook.ts"],"sourcesContent":["/**\n * Represents a message received through the webhook\n * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object\n */\nexport interface WebhookMessage {\n /**\n * The message ID\n */\n id: string;\n\n /**\n * The sender's phone number\n */\n from: string;\n\n /**\n * The timestamp of the message\n */\n timestamp: string;\n\n /**\n * The type of message (text, image, etc.)\n */\n type: MessageType;\n\n /**\n * The phone number ID that received the message\n */\n phoneNumberId: string;\n\n /**\n * Text object for text messages\n */\n text?: {\n /**\n * The text content of the message\n */\n body: string;\n };\n\n /**\n * Image object for image messages\n */\n image?: {\n /**\n * The image caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the image\n */\n sha256?: string;\n /**\n * The ID for the image\n */\n id: string;\n /**\n * The MIME type of the image\n */\n mime_type: string;\n };\n\n /**\n * Video object for video messages\n */\n video?: {\n /**\n * The video caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the video\n */\n sha256?: string;\n /**\n * The ID for the video\n */\n id: string;\n /**\n * The MIME type of the video\n */\n mime_type: string;\n };\n\n /**\n * Audio object for audio messages\n */\n audio?: {\n /**\n * The ID for the audio file\n */\n id: string;\n /**\n * The MIME type of the audio file\n */\n mime_type: string;\n /**\n * Whether the audio is a voice message\n */\n voice?: boolean;\n };\n\n /**\n * Document object for document messages\n */\n document?: {\n /**\n * The document caption (if provided)\n */\n caption?: string;\n /**\n * The document filename\n */\n filename: string;\n /**\n * The SHA256 hash of the document\n */\n sha256?: string;\n /**\n * The ID for the document\n */\n id: string;\n /**\n * The MIME type of the document\n */\n mime_type: string;\n };\n\n /**\n * Sticker object for sticker messages\n */\n sticker?: {\n /**\n * The ID for the sticker\n */\n id: string;\n /**\n * Whether this is an animated sticker\n */\n animated: boolean;\n /**\n * The MIME type of the sticker\n */\n mime_type: string;\n };\n\n /**\n * Contacts object for contact messages\n */\n contacts?: Array<{\n /**\n * The contact's name\n */\n name: {\n formatted_name: string;\n first_name?: string;\n last_name?: string;\n middle_name?: string;\n suffix?: string;\n prefix?: string;\n };\n /**\n * The contact's phone numbers\n */\n phones?: Array<{\n phone: string;\n type?: string;\n wa_id?: string;\n }>;\n /**\n * The contact's emails\n */\n emails?: Array<{\n email: string;\n type?: string;\n }>;\n /**\n * The contact's addresses\n */\n addresses?: Array<{\n street?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n country_code?: string;\n type?: string;\n }>;\n /**\n * The contact's organizations\n */\n org?: {\n company?: string;\n department?: string;\n title?: string;\n };\n /**\n * The contact's URLs\n */\n urls?: Array<{\n url: string;\n type?: string;\n }>;\n /**\n * The contact's birthday (YYYY-MM-DD format)\n */\n birthday?: string;\n }>;\n\n /**\n * Location object for location messages\n */\n location?: {\n /**\n * Latitude of the location\n */\n latitude: number;\n /**\n * Longitude of the location\n */\n longitude: number;\n /**\n * Name of the location\n */\n name?: string;\n /**\n * Address of the location\n */\n address?: string;\n };\n\n /**\n * Interactive object for interactive messages\n */\n interactive?: {\n /**\n * Type of the interactive message\n */\n type: string;\n /**\n * ID for the button that was clicked\n */\n button_reply?: {\n id: string;\n title: string;\n };\n /**\n * ID for the list item that was selected\n */\n list_reply?: {\n id: string;\n title: string;\n description?: string;\n };\n };\n\n /**\n * System object for system messages (like user phone number changes)\n */\n system?: {\n /**\n * The type of system update\n */\n type: string;\n /**\n * User's identity if the update is a customer identity change\n */\n identity?: string;\n /**\n * Old and new phone numbers if the update is a phone number change\n */\n customer?: {\n /**\n * The previous phone number\n */\n previous_wa_id: string;\n /**\n * The new phone number\n */\n wa_id: string;\n };\n };\n\n /**\n * Order object for order messages\n */\n order?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product items in the order\n */\n product_items: Array<{\n /**\n * Product ID\n */\n product_retailer_id: string;\n /**\n * Quantity of the product\n */\n quantity: number;\n /**\n * Item price\n */\n item_price: number;\n /**\n * Currency code\n */\n currency: string;\n }>;\n /**\n * Text message included with the order\n */\n text?: string;\n };\n\n /**\n * Context object, included when a user replies or interacts\n */\n context?: {\n /**\n * ID of the message being replied to or interacted with\n */\n message_id: string;\n /**\n * ID of the forwarded message, if applicable\n */\n forwarded?: boolean;\n /**\n * Frequently forwarded status\n */\n frequently_forwarded?: boolean;\n /**\n * Original message information if the message was referred\n */\n referred_product?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product ID\n */\n product_retailer_id: string;\n };\n };\n\n /**\n * Errors array, if the message had errors\n */\n errors?: Array<{\n /**\n * Error code\n */\n code: number;\n /**\n * Error title\n */\n title: string;\n /**\n * Error message\n */\n message: string;\n /**\n * Error details object\n */\n error_data?: {\n /**\n * Describes the error details\n */\n details: string;\n };\n }>;\n\n /**\n * Button object for button messages\n */\n button?: {\n /**\n * The payload for the button\n */\n payload: string;\n /**\n * Button text\n */\n text: string;\n };\n\n /**\n * The original message data as received from the webhook\n */\n originalData: any;\n}\n\n/**\n * Represents a non-message event received through the webhook\n */\nexport interface WebhookEvent {\n /**\n * The field type of the event\n */\n field: string;\n\n /**\n * The event data\n */\n value: any;\n}\n\n/**\n * Handler function for processing messages\n */\nexport type MessageHandler = (message: WebhookMessage) => void | Promise<void>;\n\n/**\n * Handler function for processing events\n */\nexport type EventHandler = (event: WebhookEvent) => void | Promise<void>;\n\n/**\n * Message types that can be received through the webhook\n */\nexport enum MessageType {\n TEXT = 'text',\n IMAGE = 'image',\n AUDIO = 'audio',\n VIDEO = 'video',\n DOCUMENT = 'document',\n STICKER = 'sticker',\n LOCATION = 'location',\n CONTACTS = 'contacts',\n BUTTON = 'button',\n INTERACTIVE = 'interactive',\n ORDER = 'order',\n SYSTEM = 'system',\n UNKNOWN = 'unknown',\n}\n\n/**\n * Statuses that can be received in status updates\n */\nexport enum MessageStatus {\n DELIVERED = 'delivered',\n READ = 'read',\n SENT = 'sent',\n}\n\n/**\n * Event fields that can be received through the webhook\n */\nexport enum EventField {\n MESSAGES = 'messages',\n STATUSES = 'statuses',\n MESSAGE_TEMPLATE_STATUS_UPDATE = 'message_template_status_update',\n PHONE_NUMBER_QUALITY_UPDATE = 'phone_number_quality_update',\n PHONE_NUMBER_NAME_UPDATE = 'phone_number_name_update',\n UNKNOWN = 'unknown',\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,kBAAAC,EAAA,gBAAAC,IAAA,eAAAC,EAAAL,GAwaO,IAAKI,OACRA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,MAAQ,QACRA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,YAAc,cACdA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAAA,QAAU,UAbFA,OAAA,IAmBAD,OACRA,EAAA,UAAY,YACZA,EAAA,KAAO,OACPA,EAAA,KAAO,OAHCA,OAAA,IASAD,OACRA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,+BAAiC,iCACjCA,EAAA,4BAA8B,8BAC9BA,EAAA,yBAA2B,2BAC3BA,EAAA,QAAU,UANFA,OAAA","names":["webhook_exports","__export","EventField","MessageStatus","MessageType","__toCommonJS"]}
1
+ {"version":3,"sources":["../../src/types/webhook.ts"],"sourcesContent":["import { MessageTypesEnum } from './enums';\n\n/**\n * Represents a message received through the webhook\n * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object\n */\nexport interface WebhookMessage {\n /**\n * The message ID\n */\n id: string;\n\n /**\n * The sender's phone number\n */\n from: string;\n\n /**\n * The timestamp of the message\n */\n timestamp: string;\n\n /**\n * The type of message (text, image, etc.)\n */\n type: MessageTypesEnum;\n\n /**\n * The phone number ID that received the message\n */\n phoneNumberId: string;\n\n /**\n * Text object for text messages\n */\n text?: {\n /**\n * The text content of the message\n */\n body: string;\n };\n\n /**\n * Image object for image messages\n */\n image?: {\n /**\n * The image caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the image\n */\n sha256?: string;\n /**\n * The ID for the image\n */\n id: string;\n /**\n * The MIME type of the image\n */\n mime_type: string;\n };\n\n /**\n * Video object for video messages\n */\n video?: {\n /**\n * The video caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the video\n */\n sha256?: string;\n /**\n * The ID for the video\n */\n id: string;\n /**\n * The MIME type of the video\n */\n mime_type: string;\n };\n\n /**\n * Audio object for audio messages\n */\n audio?: {\n /**\n * The ID for the audio file\n */\n id: string;\n /**\n * The MIME type of the audio file\n */\n mime_type: string;\n /**\n * Whether the audio is a voice message\n */\n voice?: boolean;\n };\n\n /**\n * Document object for document messages\n */\n document?: {\n /**\n * The document caption (if provided)\n */\n caption?: string;\n /**\n * The document filename\n */\n filename: string;\n /**\n * The SHA256 hash of the document\n */\n sha256?: string;\n /**\n * The ID for the document\n */\n id: string;\n /**\n * The MIME type of the document\n */\n mime_type: string;\n };\n\n /**\n * Sticker object for sticker messages\n */\n sticker?: {\n /**\n * The ID for the sticker\n */\n id: string;\n /**\n * Whether this is an animated sticker\n */\n animated: boolean;\n /**\n * The MIME type of the sticker\n */\n mime_type: string;\n };\n\n /**\n * Contacts object for contact messages\n */\n contacts?: Array<{\n /**\n * The contact's name\n */\n name: {\n formatted_name: string;\n first_name?: string;\n last_name?: string;\n middle_name?: string;\n suffix?: string;\n prefix?: string;\n };\n /**\n * The contact's phone numbers\n */\n phones?: Array<{\n phone: string;\n type?: string;\n wa_id?: string;\n }>;\n /**\n * The contact's emails\n */\n emails?: Array<{\n email: string;\n type?: string;\n }>;\n /**\n * The contact's addresses\n */\n addresses?: Array<{\n street?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n country_code?: string;\n type?: string;\n }>;\n /**\n * The contact's organizations\n */\n org?: {\n company?: string;\n department?: string;\n title?: string;\n };\n /**\n * The contact's URLs\n */\n urls?: Array<{\n url: string;\n type?: string;\n }>;\n /**\n * The contact's birthday (YYYY-MM-DD format)\n */\n birthday?: string;\n }>;\n\n /**\n * Location object for location messages\n */\n location?: {\n /**\n * Latitude of the location\n */\n latitude: number;\n /**\n * Longitude of the location\n */\n longitude: number;\n /**\n * Name of the location\n */\n name?: string;\n /**\n * Address of the location\n */\n address?: string;\n };\n\n /**\n * Interactive object for interactive messages\n */\n interactive?: {\n /**\n * Type of the interactive message\n */\n type: string;\n /**\n * ID for the button that was clicked\n */\n button_reply?: {\n id: string;\n title: string;\n };\n /**\n * ID for the list item that was selected\n */\n list_reply?: {\n id: string;\n title: string;\n description?: string;\n };\n };\n\n /**\n * System object for system messages (like user phone number changes)\n */\n system?: {\n /**\n * The type of system update\n */\n type: string;\n /**\n * User's identity if the update is a customer identity change\n */\n identity?: string;\n /**\n * Old and new phone numbers if the update is a phone number change\n */\n customer?: {\n /**\n * The previous phone number\n */\n previous_wa_id: string;\n /**\n * The new phone number\n */\n wa_id: string;\n };\n };\n\n /**\n * Order object for order messages\n */\n order?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product items in the order\n */\n product_items: Array<{\n /**\n * Product ID\n */\n product_retailer_id: string;\n /**\n * Quantity of the product\n */\n quantity: number;\n /**\n * Item price\n */\n item_price: number;\n /**\n * Currency code\n */\n currency: string;\n }>;\n /**\n * Text message included with the order\n */\n text?: string;\n };\n\n /**\n * Context object, included when a user replies or interacts\n */\n context?: {\n /**\n * ID of the message being replied to or interacted with\n */\n message_id: string;\n /**\n * ID of the forwarded message, if applicable\n */\n forwarded?: boolean;\n /**\n * Frequently forwarded status\n */\n frequently_forwarded?: boolean;\n /**\n * Original message information if the message was referred\n */\n referred_product?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product ID\n */\n product_retailer_id: string;\n };\n };\n\n /**\n * Errors array, if the message had errors\n */\n errors?: Array<{\n /**\n * Error code\n */\n code: number;\n /**\n * Error title\n */\n title: string;\n /**\n * Error message\n */\n message: string;\n /**\n * Error details object\n */\n error_data?: {\n /**\n * Describes the error details\n */\n details: string;\n };\n }>;\n\n /**\n * Button object for button messages\n */\n button?: {\n /**\n * The payload for the button\n */\n payload: string;\n /**\n * Button text\n */\n text: string;\n };\n\n /**\n * The original message data as received from the webhook\n */\n originalData: any;\n}\n\n/**\n * Represents a non-message event received through the webhook\n */\nexport interface WebhookEvent {\n /**\n * The field type of the event\n */\n field: string;\n\n /**\n * The event data\n */\n value: any;\n}\n\n/**\n * Handler function for processing messages\n */\nexport type MessageHandler = (message: WebhookMessage) => void | Promise<void>;\n\n/**\n * Handler function for processing events\n */\nexport type EventHandler = (event: WebhookEvent) => void | Promise<void>;\n\n/**\n * Statuses that can be received in status updates\n */\nexport enum MessageStatus {\n DELIVERED = 'delivered',\n READ = 'read',\n SENT = 'sent',\n}\n\n/**\n * Event fields that can be received through the webhook\n */\nexport enum EventField {\n MESSAGES = 'messages',\n STATUSES = 'statuses',\n MESSAGE_TEMPLATE_STATUS_UPDATE = 'message_template_status_update',\n PHONE_NUMBER_QUALITY_UPDATE = 'phone_number_quality_update',\n PHONE_NUMBER_NAME_UPDATE = 'phone_number_name_update',\n UNKNOWN = 'unknown',\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,kBAAAC,IAAA,eAAAC,EAAAJ,GA0aO,IAAKG,OACRA,EAAA,UAAY,YACZA,EAAA,KAAO,OACPA,EAAA,KAAO,OAHCA,OAAA,IASAD,OACRA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,+BAAiC,iCACjCA,EAAA,4BAA8B,8BAC9BA,EAAA,yBAA2B,2BAC3BA,EAAA,QAAU,UANFA,OAAA","names":["webhook_exports","__export","EventField","MessageStatus","__toCommonJS"]}
@@ -1,2 +1,2 @@
1
- var n=(t=>(t.TEXT="text",t.IMAGE="image",t.AUDIO="audio",t.VIDEO="video",t.DOCUMENT="document",t.STICKER="sticker",t.LOCATION="location",t.CONTACTS="contacts",t.BUTTON="button",t.INTERACTIVE="interactive",t.ORDER="order",t.SYSTEM="system",t.UNKNOWN="unknown",t))(n||{}),e=(i=>(i.DELIVERED="delivered",i.READ="read",i.SENT="sent",i))(e||{}),s=(r=>(r.MESSAGES="messages",r.STATUSES="statuses",r.MESSAGE_TEMPLATE_STATUS_UPDATE="message_template_status_update",r.PHONE_NUMBER_QUALITY_UPDATE="phone_number_quality_update",r.PHONE_NUMBER_NAME_UPDATE="phone_number_name_update",r.UNKNOWN="unknown",r))(s||{});export{s as EventField,e as MessageStatus,n as MessageType};
1
+ var e=(r=>(r.DELIVERED="delivered",r.READ="read",r.SENT="sent",r))(e||{}),i=(t=>(t.MESSAGES="messages",t.STATUSES="statuses",t.MESSAGE_TEMPLATE_STATUS_UPDATE="message_template_status_update",t.PHONE_NUMBER_QUALITY_UPDATE="phone_number_quality_update",t.PHONE_NUMBER_NAME_UPDATE="phone_number_name_update",t.UNKNOWN="unknown",t))(i||{});export{i as EventField,e as MessageStatus};
2
2
  //# sourceMappingURL=webhook.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/webhook.ts"],"sourcesContent":["/**\n * Represents a message received through the webhook\n * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object\n */\nexport interface WebhookMessage {\n /**\n * The message ID\n */\n id: string;\n\n /**\n * The sender's phone number\n */\n from: string;\n\n /**\n * The timestamp of the message\n */\n timestamp: string;\n\n /**\n * The type of message (text, image, etc.)\n */\n type: MessageType;\n\n /**\n * The phone number ID that received the message\n */\n phoneNumberId: string;\n\n /**\n * Text object for text messages\n */\n text?: {\n /**\n * The text content of the message\n */\n body: string;\n };\n\n /**\n * Image object for image messages\n */\n image?: {\n /**\n * The image caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the image\n */\n sha256?: string;\n /**\n * The ID for the image\n */\n id: string;\n /**\n * The MIME type of the image\n */\n mime_type: string;\n };\n\n /**\n * Video object for video messages\n */\n video?: {\n /**\n * The video caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the video\n */\n sha256?: string;\n /**\n * The ID for the video\n */\n id: string;\n /**\n * The MIME type of the video\n */\n mime_type: string;\n };\n\n /**\n * Audio object for audio messages\n */\n audio?: {\n /**\n * The ID for the audio file\n */\n id: string;\n /**\n * The MIME type of the audio file\n */\n mime_type: string;\n /**\n * Whether the audio is a voice message\n */\n voice?: boolean;\n };\n\n /**\n * Document object for document messages\n */\n document?: {\n /**\n * The document caption (if provided)\n */\n caption?: string;\n /**\n * The document filename\n */\n filename: string;\n /**\n * The SHA256 hash of the document\n */\n sha256?: string;\n /**\n * The ID for the document\n */\n id: string;\n /**\n * The MIME type of the document\n */\n mime_type: string;\n };\n\n /**\n * Sticker object for sticker messages\n */\n sticker?: {\n /**\n * The ID for the sticker\n */\n id: string;\n /**\n * Whether this is an animated sticker\n */\n animated: boolean;\n /**\n * The MIME type of the sticker\n */\n mime_type: string;\n };\n\n /**\n * Contacts object for contact messages\n */\n contacts?: Array<{\n /**\n * The contact's name\n */\n name: {\n formatted_name: string;\n first_name?: string;\n last_name?: string;\n middle_name?: string;\n suffix?: string;\n prefix?: string;\n };\n /**\n * The contact's phone numbers\n */\n phones?: Array<{\n phone: string;\n type?: string;\n wa_id?: string;\n }>;\n /**\n * The contact's emails\n */\n emails?: Array<{\n email: string;\n type?: string;\n }>;\n /**\n * The contact's addresses\n */\n addresses?: Array<{\n street?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n country_code?: string;\n type?: string;\n }>;\n /**\n * The contact's organizations\n */\n org?: {\n company?: string;\n department?: string;\n title?: string;\n };\n /**\n * The contact's URLs\n */\n urls?: Array<{\n url: string;\n type?: string;\n }>;\n /**\n * The contact's birthday (YYYY-MM-DD format)\n */\n birthday?: string;\n }>;\n\n /**\n * Location object for location messages\n */\n location?: {\n /**\n * Latitude of the location\n */\n latitude: number;\n /**\n * Longitude of the location\n */\n longitude: number;\n /**\n * Name of the location\n */\n name?: string;\n /**\n * Address of the location\n */\n address?: string;\n };\n\n /**\n * Interactive object for interactive messages\n */\n interactive?: {\n /**\n * Type of the interactive message\n */\n type: string;\n /**\n * ID for the button that was clicked\n */\n button_reply?: {\n id: string;\n title: string;\n };\n /**\n * ID for the list item that was selected\n */\n list_reply?: {\n id: string;\n title: string;\n description?: string;\n };\n };\n\n /**\n * System object for system messages (like user phone number changes)\n */\n system?: {\n /**\n * The type of system update\n */\n type: string;\n /**\n * User's identity if the update is a customer identity change\n */\n identity?: string;\n /**\n * Old and new phone numbers if the update is a phone number change\n */\n customer?: {\n /**\n * The previous phone number\n */\n previous_wa_id: string;\n /**\n * The new phone number\n */\n wa_id: string;\n };\n };\n\n /**\n * Order object for order messages\n */\n order?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product items in the order\n */\n product_items: Array<{\n /**\n * Product ID\n */\n product_retailer_id: string;\n /**\n * Quantity of the product\n */\n quantity: number;\n /**\n * Item price\n */\n item_price: number;\n /**\n * Currency code\n */\n currency: string;\n }>;\n /**\n * Text message included with the order\n */\n text?: string;\n };\n\n /**\n * Context object, included when a user replies or interacts\n */\n context?: {\n /**\n * ID of the message being replied to or interacted with\n */\n message_id: string;\n /**\n * ID of the forwarded message, if applicable\n */\n forwarded?: boolean;\n /**\n * Frequently forwarded status\n */\n frequently_forwarded?: boolean;\n /**\n * Original message information if the message was referred\n */\n referred_product?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product ID\n */\n product_retailer_id: string;\n };\n };\n\n /**\n * Errors array, if the message had errors\n */\n errors?: Array<{\n /**\n * Error code\n */\n code: number;\n /**\n * Error title\n */\n title: string;\n /**\n * Error message\n */\n message: string;\n /**\n * Error details object\n */\n error_data?: {\n /**\n * Describes the error details\n */\n details: string;\n };\n }>;\n\n /**\n * Button object for button messages\n */\n button?: {\n /**\n * The payload for the button\n */\n payload: string;\n /**\n * Button text\n */\n text: string;\n };\n\n /**\n * The original message data as received from the webhook\n */\n originalData: any;\n}\n\n/**\n * Represents a non-message event received through the webhook\n */\nexport interface WebhookEvent {\n /**\n * The field type of the event\n */\n field: string;\n\n /**\n * The event data\n */\n value: any;\n}\n\n/**\n * Handler function for processing messages\n */\nexport type MessageHandler = (message: WebhookMessage) => void | Promise<void>;\n\n/**\n * Handler function for processing events\n */\nexport type EventHandler = (event: WebhookEvent) => void | Promise<void>;\n\n/**\n * Message types that can be received through the webhook\n */\nexport enum MessageType {\n TEXT = 'text',\n IMAGE = 'image',\n AUDIO = 'audio',\n VIDEO = 'video',\n DOCUMENT = 'document',\n STICKER = 'sticker',\n LOCATION = 'location',\n CONTACTS = 'contacts',\n BUTTON = 'button',\n INTERACTIVE = 'interactive',\n ORDER = 'order',\n SYSTEM = 'system',\n UNKNOWN = 'unknown',\n}\n\n/**\n * Statuses that can be received in status updates\n */\nexport enum MessageStatus {\n DELIVERED = 'delivered',\n READ = 'read',\n SENT = 'sent',\n}\n\n/**\n * Event fields that can be received through the webhook\n */\nexport enum EventField {\n MESSAGES = 'messages',\n STATUSES = 'statuses',\n MESSAGE_TEMPLATE_STATUS_UPDATE = 'message_template_status_update',\n PHONE_NUMBER_QUALITY_UPDATE = 'phone_number_quality_update',\n PHONE_NUMBER_NAME_UPDATE = 'phone_number_name_update',\n UNKNOWN = 'unknown',\n}\n"],"mappings":"AAwaO,IAAKA,OACRA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,MAAQ,QACRA,EAAA,MAAQ,QACRA,EAAA,SAAW,WACXA,EAAA,QAAU,UACVA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,OAAS,SACTA,EAAA,YAAc,cACdA,EAAA,MAAQ,QACRA,EAAA,OAAS,SACTA,EAAA,QAAU,UAbFA,OAAA,IAmBAC,OACRA,EAAA,UAAY,YACZA,EAAA,KAAO,OACPA,EAAA,KAAO,OAHCA,OAAA,IASAC,OACRA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,+BAAiC,iCACjCA,EAAA,4BAA8B,8BAC9BA,EAAA,yBAA2B,2BAC3BA,EAAA,QAAU,UANFA,OAAA","names":["MessageType","MessageStatus","EventField"]}
1
+ {"version":3,"sources":["../../src/types/webhook.ts"],"sourcesContent":["import { MessageTypesEnum } from './enums';\n\n/**\n * Represents a message received through the webhook\n * Based on Meta's documentation: https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components#messages-object\n */\nexport interface WebhookMessage {\n /**\n * The message ID\n */\n id: string;\n\n /**\n * The sender's phone number\n */\n from: string;\n\n /**\n * The timestamp of the message\n */\n timestamp: string;\n\n /**\n * The type of message (text, image, etc.)\n */\n type: MessageTypesEnum;\n\n /**\n * The phone number ID that received the message\n */\n phoneNumberId: string;\n\n /**\n * Text object for text messages\n */\n text?: {\n /**\n * The text content of the message\n */\n body: string;\n };\n\n /**\n * Image object for image messages\n */\n image?: {\n /**\n * The image caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the image\n */\n sha256?: string;\n /**\n * The ID for the image\n */\n id: string;\n /**\n * The MIME type of the image\n */\n mime_type: string;\n };\n\n /**\n * Video object for video messages\n */\n video?: {\n /**\n * The video caption (if provided)\n */\n caption?: string;\n /**\n * The SHA256 hash of the video\n */\n sha256?: string;\n /**\n * The ID for the video\n */\n id: string;\n /**\n * The MIME type of the video\n */\n mime_type: string;\n };\n\n /**\n * Audio object for audio messages\n */\n audio?: {\n /**\n * The ID for the audio file\n */\n id: string;\n /**\n * The MIME type of the audio file\n */\n mime_type: string;\n /**\n * Whether the audio is a voice message\n */\n voice?: boolean;\n };\n\n /**\n * Document object for document messages\n */\n document?: {\n /**\n * The document caption (if provided)\n */\n caption?: string;\n /**\n * The document filename\n */\n filename: string;\n /**\n * The SHA256 hash of the document\n */\n sha256?: string;\n /**\n * The ID for the document\n */\n id: string;\n /**\n * The MIME type of the document\n */\n mime_type: string;\n };\n\n /**\n * Sticker object for sticker messages\n */\n sticker?: {\n /**\n * The ID for the sticker\n */\n id: string;\n /**\n * Whether this is an animated sticker\n */\n animated: boolean;\n /**\n * The MIME type of the sticker\n */\n mime_type: string;\n };\n\n /**\n * Contacts object for contact messages\n */\n contacts?: Array<{\n /**\n * The contact's name\n */\n name: {\n formatted_name: string;\n first_name?: string;\n last_name?: string;\n middle_name?: string;\n suffix?: string;\n prefix?: string;\n };\n /**\n * The contact's phone numbers\n */\n phones?: Array<{\n phone: string;\n type?: string;\n wa_id?: string;\n }>;\n /**\n * The contact's emails\n */\n emails?: Array<{\n email: string;\n type?: string;\n }>;\n /**\n * The contact's addresses\n */\n addresses?: Array<{\n street?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n country_code?: string;\n type?: string;\n }>;\n /**\n * The contact's organizations\n */\n org?: {\n company?: string;\n department?: string;\n title?: string;\n };\n /**\n * The contact's URLs\n */\n urls?: Array<{\n url: string;\n type?: string;\n }>;\n /**\n * The contact's birthday (YYYY-MM-DD format)\n */\n birthday?: string;\n }>;\n\n /**\n * Location object for location messages\n */\n location?: {\n /**\n * Latitude of the location\n */\n latitude: number;\n /**\n * Longitude of the location\n */\n longitude: number;\n /**\n * Name of the location\n */\n name?: string;\n /**\n * Address of the location\n */\n address?: string;\n };\n\n /**\n * Interactive object for interactive messages\n */\n interactive?: {\n /**\n * Type of the interactive message\n */\n type: string;\n /**\n * ID for the button that was clicked\n */\n button_reply?: {\n id: string;\n title: string;\n };\n /**\n * ID for the list item that was selected\n */\n list_reply?: {\n id: string;\n title: string;\n description?: string;\n };\n };\n\n /**\n * System object for system messages (like user phone number changes)\n */\n system?: {\n /**\n * The type of system update\n */\n type: string;\n /**\n * User's identity if the update is a customer identity change\n */\n identity?: string;\n /**\n * Old and new phone numbers if the update is a phone number change\n */\n customer?: {\n /**\n * The previous phone number\n */\n previous_wa_id: string;\n /**\n * The new phone number\n */\n wa_id: string;\n };\n };\n\n /**\n * Order object for order messages\n */\n order?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product items in the order\n */\n product_items: Array<{\n /**\n * Product ID\n */\n product_retailer_id: string;\n /**\n * Quantity of the product\n */\n quantity: number;\n /**\n * Item price\n */\n item_price: number;\n /**\n * Currency code\n */\n currency: string;\n }>;\n /**\n * Text message included with the order\n */\n text?: string;\n };\n\n /**\n * Context object, included when a user replies or interacts\n */\n context?: {\n /**\n * ID of the message being replied to or interacted with\n */\n message_id: string;\n /**\n * ID of the forwarded message, if applicable\n */\n forwarded?: boolean;\n /**\n * Frequently forwarded status\n */\n frequently_forwarded?: boolean;\n /**\n * Original message information if the message was referred\n */\n referred_product?: {\n /**\n * Catalog ID\n */\n catalog_id: string;\n /**\n * Product ID\n */\n product_retailer_id: string;\n };\n };\n\n /**\n * Errors array, if the message had errors\n */\n errors?: Array<{\n /**\n * Error code\n */\n code: number;\n /**\n * Error title\n */\n title: string;\n /**\n * Error message\n */\n message: string;\n /**\n * Error details object\n */\n error_data?: {\n /**\n * Describes the error details\n */\n details: string;\n };\n }>;\n\n /**\n * Button object for button messages\n */\n button?: {\n /**\n * The payload for the button\n */\n payload: string;\n /**\n * Button text\n */\n text: string;\n };\n\n /**\n * The original message data as received from the webhook\n */\n originalData: any;\n}\n\n/**\n * Represents a non-message event received through the webhook\n */\nexport interface WebhookEvent {\n /**\n * The field type of the event\n */\n field: string;\n\n /**\n * The event data\n */\n value: any;\n}\n\n/**\n * Handler function for processing messages\n */\nexport type MessageHandler = (message: WebhookMessage) => void | Promise<void>;\n\n/**\n * Handler function for processing events\n */\nexport type EventHandler = (event: WebhookEvent) => void | Promise<void>;\n\n/**\n * Statuses that can be received in status updates\n */\nexport enum MessageStatus {\n DELIVERED = 'delivered',\n READ = 'read',\n SENT = 'sent',\n}\n\n/**\n * Event fields that can be received through the webhook\n */\nexport enum EventField {\n MESSAGES = 'messages',\n STATUSES = 'statuses',\n MESSAGE_TEMPLATE_STATUS_UPDATE = 'message_template_status_update',\n PHONE_NUMBER_QUALITY_UPDATE = 'phone_number_quality_update',\n PHONE_NUMBER_NAME_UPDATE = 'phone_number_name_update',\n UNKNOWN = 'unknown',\n}\n"],"mappings":"AA0aO,IAAKA,OACRA,EAAA,UAAY,YACZA,EAAA,KAAO,OACPA,EAAA,KAAO,OAHCA,OAAA,IASAC,OACRA,EAAA,SAAW,WACXA,EAAA,SAAW,WACXA,EAAA,+BAAiC,iCACjCA,EAAA,4BAA8B,8BAC9BA,EAAA,yBAA2B,2BAC3BA,EAAA,QAAU,UANFA,OAAA","names":["MessageStatus","EventField"]}
@@ -9,7 +9,7 @@ import { RegistrationClass } from './registration.mjs';
9
9
  import { TemplateClass } from './template.mjs';
10
10
  import { TwoStepVerificationClass } from './twoStepVerification.mjs';
11
11
  import { WABAClass } from './waba.mjs';
12
- import '../enums-D7paGoTY.mjs';
12
+ import '../enums-DEhBfoMC.mjs';
13
13
  import './request.mjs';
14
14
  import './base.mjs';
15
15
  import './config.mjs';
@@ -9,7 +9,7 @@ import { RegistrationClass } from './registration.js';
9
9
  import { TemplateClass } from './template.js';
10
10
  import { TwoStepVerificationClass } from './twoStepVerification.js';
11
11
  import { WABAClass } from './waba.js';
12
- import '../enums-D7paGoTY.js';
12
+ import '../enums-DEhBfoMC.js';
13
13
  import './request.js';
14
14
  import './base.js';
15
15
  import './config.js';
@@ -1,4 +1,5 @@
1
- import { MessageType, WebhookMessage } from '../types/webhook.mjs';
1
+ import { M as MessageTypesEnum } from '../enums-DEhBfoMC.mjs';
2
+ import { WebhookMessage } from '../types/webhook.mjs';
2
3
 
3
4
  /**
4
5
  * Filters for message handling, inspired by PyWa
@@ -9,7 +10,7 @@ declare const filters: {
9
10
  * @param type Message type to filter for
10
11
  * @returns A filter function
11
12
  */
12
- type: (type: MessageType | string) => ((message: WebhookMessage) => boolean);
13
+ type: (type: MessageTypesEnum | string) => ((message: WebhookMessage) => boolean);
13
14
  /**
14
15
  * Filters text messages
15
16
  * @param message Message to check
@@ -1,4 +1,5 @@
1
- import { MessageType, WebhookMessage } from '../types/webhook.js';
1
+ import { M as MessageTypesEnum } from '../enums-DEhBfoMC.js';
2
+ import { WebhookMessage } from '../types/webhook.js';
2
3
 
3
4
  /**
4
5
  * Filters for message handling, inspired by PyWa
@@ -9,7 +10,7 @@ declare const filters: {
9
10
  * @param type Message type to filter for
10
11
  * @returns A filter function
11
12
  */
12
- type: (type: MessageType | string) => ((message: WebhookMessage) => boolean);
13
+ type: (type: MessageTypesEnum | string) => ((message: WebhookMessage) => boolean);
13
14
  /**
14
15
  * Filters text messages
15
16
  * @param message Message to check
@@ -1,2 +1,2 @@
1
- "use strict";var s=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var b=(e,t)=>{for(var r in t)s(e,r,{get:t[r],enumerable:!0})},u=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of a(t))!g.call(e,o)&&o!==r&&s(e,o,{get:()=>t[o],enumerable:!(n=i(t,o))||n.enumerable});return e};var l=e=>u(s({},"__esModule",{value:!0}),e);var m={};b(m,{filters:()=>d});module.exports=l(m);var d={type:e=>t=>t.type===e,text:e=>e.type==="text",image:e=>e.type==="image",audio:e=>e.type==="audio",video:e=>e.type==="video",document:e=>e.type==="document",sticker:e=>e.type==="sticker",location:e=>e.type==="location",contacts:e=>e.type==="contacts",button:e=>e.type==="button",interactive:e=>e.type==="interactive",system:e=>e.type==="system",order:e=>e.type==="order",matches:e=>{let t=Array.isArray(e)?e:[e];return r=>{if(r.type!=="text"||!r.text)return!1;let n=r.text.body;for(let o of t)if(typeof o=="string"){if(n.includes(o))return!0}else if(o instanceof RegExp&&o.test(n))return!0;return!1}},isReply:e=>!!e.context&&!!e.context.message_id,isReplyTo:e=>t=>!!t.context&&t.context.message_id===e,isForwarded:e=>!!e.context&&!!e.context.forwarded,isFrequentlyForwarded:e=>!!e.context&&!!e.context.frequently_forwarded,and:(...e)=>t=>{for(let r of e)if(!r(t))return!1;return!0},or:(...e)=>t=>{for(let r of e)if(r(t))return!0;return!1},not:e=>t=>!e(t),from:e=>t=>t.from===e,all:()=>()=>!0};0&&(module.exports={filters});
1
+ "use strict";var o=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var a=(t,i)=>{for(var R in i)o(t,R,{get:i[R],enumerable:!0})},D=(t,i,R,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let A of S(i))!p.call(t,A)&&A!==R&&o(t,A,{get:()=>i[A],enumerable:!(l=P(i,A))||l.enumerable});return t};var _=t=>D(o({},"__esModule",{value:!0}),t);var U={};a(U,{filters:()=>N});module.exports=_(U);var N={type:t=>i=>i.type===t,text:t=>t.type==="text",image:t=>t.type==="image",audio:t=>t.type==="audio",video:t=>t.type==="video",document:t=>t.type==="document",sticker:t=>t.type==="sticker",location:t=>t.type==="location",contacts:t=>t.type==="contacts",button:t=>t.type==="button",interactive:t=>t.type==="interactive",system:t=>t.type==="system",order:t=>t.type==="order",matches:t=>{let i=Array.isArray(t)?t:[t];return R=>{if(R.type!=="text"||!R.text)return!1;let l=R.text.body;for(let A of i)if(typeof A=="string"){if(l.includes(A))return!0}else if(A instanceof RegExp&&A.test(l))return!0;return!1}},isReply:t=>!!t.context&&!!t.context.message_id,isReplyTo:t=>i=>!!i.context&&i.context.message_id===t,isForwarded:t=>!!t.context&&!!t.context.forwarded,isFrequentlyForwarded:t=>!!t.context&&!!t.context.frequently_forwarded,and:(...t)=>i=>{for(let R of t)if(!R(i))return!1;return!0},or:(...t)=>i=>{for(let R of t)if(R(i))return!0;return!1},not:t=>i=>!t(i),from:t=>i=>i.from===t,all:()=>()=>!0};0&&(module.exports={filters});
2
2
  //# sourceMappingURL=filters.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/filters.ts"],"sourcesContent":["import { MessageType, WebhookMessage } from '../types/webhook';\n\n/**\n * Filters for message handling, inspired by PyWa\n */\nexport const filters = {\n /**\n * Filters messages by type\n * @param type Message type to filter for\n * @returns A filter function\n */\n type: (type: MessageType | string): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage) => message.type === type;\n },\n\n /**\n * Filters text messages\n * @param message Message to check\n * @returns True if the message is a text message\n */\n text: (message: WebhookMessage): boolean => {\n return message.type === MessageType.TEXT;\n },\n\n /**\n * Filters image messages\n * @param message Message to check\n * @returns True if the message is an image message\n */\n image: (message: WebhookMessage): boolean => {\n return message.type === MessageType.IMAGE;\n },\n\n /**\n * Filters audio messages\n * @param message Message to check\n * @returns True if the message is an audio message\n */\n audio: (message: WebhookMessage): boolean => {\n return message.type === MessageType.AUDIO;\n },\n\n /**\n * Filters video messages\n * @param message Message to check\n * @returns True if the message is a video message\n */\n video: (message: WebhookMessage): boolean => {\n return message.type === MessageType.VIDEO;\n },\n\n /**\n * Filters document messages\n * @param message Message to check\n * @returns True if the message is a document message\n */\n document: (message: WebhookMessage): boolean => {\n return message.type === MessageType.DOCUMENT;\n },\n\n /**\n * Filters sticker messages\n * @param message Message to check\n * @returns True if the message is a sticker message\n */\n sticker: (message: WebhookMessage): boolean => {\n return message.type === MessageType.STICKER;\n },\n\n /**\n * Filters location messages\n * @param message Message to check\n * @returns True if the message is a location message\n */\n location: (message: WebhookMessage): boolean => {\n return message.type === MessageType.LOCATION;\n },\n\n /**\n * Filters contact messages\n * @param message Message to check\n * @returns True if the message is a contacts message\n */\n contacts: (message: WebhookMessage): boolean => {\n return message.type === MessageType.CONTACTS;\n },\n\n /**\n * Filters button messages\n * @param message Message to check\n * @returns True if the message is a button message\n */\n button: (message: WebhookMessage): boolean => {\n return message.type === MessageType.BUTTON;\n },\n\n /**\n * Filters interactive messages\n * @param message Message to check\n * @returns True if the message is an interactive message\n */\n interactive: (message: WebhookMessage): boolean => {\n return message.type === MessageType.INTERACTIVE;\n },\n\n /**\n * Filters system messages\n * @param message Message to check\n * @returns True if the message is a system message\n */\n system: (message: WebhookMessage): boolean => {\n return message.type === MessageType.SYSTEM;\n },\n\n /**\n * Filters order messages\n * @param message Message to check\n * @returns True if the message is an order message\n */\n order: (message: WebhookMessage): boolean => {\n return message.type === MessageType.ORDER;\n },\n\n /**\n * Matches text content against a pattern\n * @param patterns String or regular expression or array of patterns to match against\n * @returns A filter function\n */\n matches: (patterns: string | RegExp | (string | RegExp)[]): ((message: WebhookMessage) => boolean) => {\n const patternsArray = Array.isArray(patterns) ? patterns : [patterns];\n\n return (message: WebhookMessage): boolean => {\n if (message.type !== MessageType.TEXT || !message.text) {\n return false;\n }\n\n const text = message.text.body;\n\n for (const pattern of patternsArray) {\n if (typeof pattern === 'string') {\n if (text.includes(pattern)) {\n return true;\n }\n } else if (pattern instanceof RegExp) {\n if (pattern.test(text)) {\n return true;\n }\n }\n }\n\n return false;\n };\n },\n\n /**\n * Checks if a message is a reply to another message\n * @returns A filter function that returns true if the message is a reply\n */\n isReply: (message: WebhookMessage): boolean => {\n return !!message.context && !!message.context.message_id;\n },\n\n /**\n * Checks if a message is a reply to a specific message\n * @param messageId The ID of the original message to check for\n * @returns A filter function that returns true if the message is a reply to the specified message\n */\n isReplyTo: (messageId: string): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n return !!message.context && message.context.message_id === messageId;\n };\n },\n\n /**\n * Checks if a message is forwarded\n * @returns A filter function that returns true if the message is forwarded\n */\n isForwarded: (message: WebhookMessage): boolean => {\n return !!message.context && !!message.context.forwarded;\n },\n\n /**\n * Checks if a message is frequently forwarded\n * @returns A filter function that returns true if the message is frequently forwarded\n */\n isFrequentlyForwarded: (message: WebhookMessage): boolean => {\n return !!message.context && !!message.context.frequently_forwarded;\n },\n\n /**\n * Combines multiple filters with AND logic\n * @param filterFunctions Array of filter functions to combine\n * @returns A filter function that returns true only if all filters return true\n */\n and: (...filterFunctions: ((message: WebhookMessage) => boolean)[]): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n for (const filter of filterFunctions) {\n if (!filter(message)) {\n return false;\n }\n }\n return true;\n };\n },\n\n /**\n * Combines multiple filters with OR logic\n * @param filterFunctions Array of filter functions to combine\n * @returns A filter function that returns true if any filter returns true\n */\n or: (...filterFunctions: ((message: WebhookMessage) => boolean)[]): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n for (const filter of filterFunctions) {\n if (filter(message)) {\n return true;\n }\n }\n return false;\n };\n },\n\n /**\n * Negates a filter\n * @param filterFunction Filter function to negate\n * @returns A filter function that returns the opposite of the input filter\n */\n not: (filterFunction: (message: WebhookMessage) => boolean): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n return !filterFunction(message);\n };\n },\n\n /**\n * Filters messages from a specific sender\n * @param from Sender phone number to filter for\n * @returns A filter function\n */\n from: (from: string): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n return message.from === from;\n };\n },\n\n /**\n * Filter function that accepts all messages\n * @returns Always returns true\n */\n all: (): ((message: WebhookMessage) => boolean) => {\n return (): boolean => true;\n },\n};\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAKO,IAAMI,EAAU,CAMnB,KAAOC,GACKC,GAA4BA,EAAQ,OAASD,EAQzD,KAAOC,GACIA,EAAQ,OAAS,OAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,SAAWA,GACAA,EAAQ,OAAS,WAQ5B,QAAUA,GACCA,EAAQ,OAAS,UAQ5B,SAAWA,GACAA,EAAQ,OAAS,WAQ5B,SAAWA,GACAA,EAAQ,OAAS,WAQ5B,OAASA,GACEA,EAAQ,OAAS,SAQ5B,YAAcA,GACHA,EAAQ,OAAS,cAQ5B,OAASA,GACEA,EAAQ,OAAS,SAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,QAAUC,GAA4F,CAClG,IAAMC,EAAgB,MAAM,QAAQD,CAAQ,EAAIA,EAAW,CAACA,CAAQ,EAEpE,OAAQD,GAAqC,CACzC,GAAIA,EAAQ,OAAS,QAAoB,CAACA,EAAQ,KAC9C,MAAO,GAGX,IAAMG,EAAOH,EAAQ,KAAK,KAE1B,QAAWI,KAAWF,EAClB,GAAI,OAAOE,GAAY,UACnB,GAAID,EAAK,SAASC,CAAO,EACrB,MAAO,WAEJA,aAAmB,QACtBA,EAAQ,KAAKD,CAAI,EACjB,MAAO,GAKnB,MAAO,EACX,CACJ,EAMA,QAAUH,GACC,CAAC,CAACA,EAAQ,SAAW,CAAC,CAACA,EAAQ,QAAQ,WAQlD,UAAYK,GACAL,GACG,CAAC,CAACA,EAAQ,SAAWA,EAAQ,QAAQ,aAAeK,EAQnE,YAAcL,GACH,CAAC,CAACA,EAAQ,SAAW,CAAC,CAACA,EAAQ,QAAQ,UAOlD,sBAAwBA,GACb,CAAC,CAACA,EAAQ,SAAW,CAAC,CAACA,EAAQ,QAAQ,qBAQlD,IAAK,IAAIM,IACGN,GAAqC,CACzC,QAAWO,KAAUD,EACjB,GAAI,CAACC,EAAOP,CAAO,EACf,MAAO,GAGf,MAAO,EACX,EAQJ,GAAI,IAAIM,IACIN,GAAqC,CACzC,QAAWO,KAAUD,EACjB,GAAIC,EAAOP,CAAO,EACd,MAAO,GAGf,MAAO,EACX,EAQJ,IAAMQ,GACMR,GACG,CAACQ,EAAeR,CAAO,EAStC,KAAOS,GACKT,GACGA,EAAQ,OAASS,EAQhC,IAAK,IACM,IAAe,EAE9B","names":["filters_exports","__export","filters","__toCommonJS","filters","type","message","patterns","patternsArray","text","pattern","messageId","filterFunctions","filter","filterFunction","from"]}
1
+ {"version":3,"sources":["../../src/utils/filters.ts"],"sourcesContent":["import { MessageTypesEnum } from 'src/types';\nimport { WebhookMessage } from '../types/webhook';\n\n/**\n * Filters for message handling, inspired by PyWa\n */\nexport const filters = {\n /**\n * Filters messages by type\n * @param type Message type to filter for\n * @returns A filter function\n */\n type: (type: MessageTypesEnum | string): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage) => message.type === type;\n },\n\n /**\n * Filters text messages\n * @param message Message to check\n * @returns True if the message is a text message\n */\n text: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Text;\n },\n\n /**\n * Filters image messages\n * @param message Message to check\n * @returns True if the message is an image message\n */\n image: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Image;\n },\n\n /**\n * Filters audio messages\n * @param message Message to check\n * @returns True if the message is an audio message\n */\n audio: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Audio;\n },\n\n /**\n * Filters video messages\n * @param message Message to check\n * @returns True if the message is a video message\n */\n video: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Video;\n },\n\n /**\n * Filters document messages\n * @param message Message to check\n * @returns True if the message is a document message\n */\n document: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Document;\n },\n\n /**\n * Filters sticker messages\n * @param message Message to check\n * @returns True if the message is a sticker message\n */\n sticker: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Sticker;\n },\n\n /**\n * Filters location messages\n * @param message Message to check\n * @returns True if the message is a location message\n */\n location: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Location;\n },\n\n /**\n * Filters contact messages\n * @param message Message to check\n * @returns True if the message is a contacts message\n */\n contacts: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Contacts;\n },\n\n /**\n * Filters button messages\n * @param message Message to check\n * @returns True if the message is a button message\n */\n button: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Button;\n },\n\n /**\n * Filters interactive messages\n * @param message Message to check\n * @returns True if the message is an interactive message\n */\n interactive: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Interactive;\n },\n\n /**\n * Filters system messages\n * @param message Message to check\n * @returns True if the message is a system message\n */\n system: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.System;\n },\n\n /**\n * Filters order messages\n * @param message Message to check\n * @returns True if the message is an order message\n */\n order: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Order;\n },\n\n /**\n * Matches text content against a pattern\n * @param patterns String or regular expression or array of patterns to match against\n * @returns A filter function\n */\n matches: (patterns: string | RegExp | (string | RegExp)[]): ((message: WebhookMessage) => boolean) => {\n const patternsArray = Array.isArray(patterns) ? patterns : [patterns];\n\n return (message: WebhookMessage): boolean => {\n if (message.type !== MessageTypesEnum.Text || !message.text) {\n return false;\n }\n\n const text = message.text.body;\n\n for (const pattern of patternsArray) {\n if (typeof pattern === 'string') {\n if (text.includes(pattern)) {\n return true;\n }\n } else if (pattern instanceof RegExp) {\n if (pattern.test(text)) {\n return true;\n }\n }\n }\n\n return false;\n };\n },\n\n /**\n * Checks if a message is a reply to another message\n * @returns A filter function that returns true if the message is a reply\n */\n isReply: (message: WebhookMessage): boolean => {\n return !!message.context && !!message.context.message_id;\n },\n\n /**\n * Checks if a message is a reply to a specific message\n * @param messageId The ID of the original message to check for\n * @returns A filter function that returns true if the message is a reply to the specified message\n */\n isReplyTo: (messageId: string): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n return !!message.context && message.context.message_id === messageId;\n };\n },\n\n /**\n * Checks if a message is forwarded\n * @returns A filter function that returns true if the message is forwarded\n */\n isForwarded: (message: WebhookMessage): boolean => {\n return !!message.context && !!message.context.forwarded;\n },\n\n /**\n * Checks if a message is frequently forwarded\n * @returns A filter function that returns true if the message is frequently forwarded\n */\n isFrequentlyForwarded: (message: WebhookMessage): boolean => {\n return !!message.context && !!message.context.frequently_forwarded;\n },\n\n /**\n * Combines multiple filters with AND logic\n * @param filterFunctions Array of filter functions to combine\n * @returns A filter function that returns true only if all filters return true\n */\n and: (...filterFunctions: ((message: WebhookMessage) => boolean)[]): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n for (const filter of filterFunctions) {\n if (!filter(message)) {\n return false;\n }\n }\n return true;\n };\n },\n\n /**\n * Combines multiple filters with OR logic\n * @param filterFunctions Array of filter functions to combine\n * @returns A filter function that returns true if any filter returns true\n */\n or: (...filterFunctions: ((message: WebhookMessage) => boolean)[]): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n for (const filter of filterFunctions) {\n if (filter(message)) {\n return true;\n }\n }\n return false;\n };\n },\n\n /**\n * Negates a filter\n * @param filterFunction Filter function to negate\n * @returns A filter function that returns the opposite of the input filter\n */\n not: (filterFunction: (message: WebhookMessage) => boolean): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n return !filterFunction(message);\n };\n },\n\n /**\n * Filters messages from a specific sender\n * @param from Sender phone number to filter for\n * @returns A filter function\n */\n from: (from: string): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n return message.from === from;\n };\n },\n\n /**\n * Filter function that accepts all messages\n * @returns Always returns true\n */\n all: (): ((message: WebhookMessage) => boolean) => {\n return (): boolean => true;\n },\n};\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAMO,IAAMI,EAAU,CAMnB,KAAOC,GACKC,GAA4BA,EAAQ,OAASD,EAQzD,KAAOC,GACIA,EAAQ,OAAS,OAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,SAAWA,GACAA,EAAQ,OAAS,WAQ5B,QAAUA,GACCA,EAAQ,OAAS,UAQ5B,SAAWA,GACAA,EAAQ,OAAS,WAQ5B,SAAWA,GACAA,EAAQ,OAAS,WAQ5B,OAASA,GACEA,EAAQ,OAAS,SAQ5B,YAAcA,GACHA,EAAQ,OAAS,cAQ5B,OAASA,GACEA,EAAQ,OAAS,SAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,QAAUC,GAA4F,CAClG,IAAMC,EAAgB,MAAM,QAAQD,CAAQ,EAAIA,EAAW,CAACA,CAAQ,EAEpE,OAAQD,GAAqC,CACzC,GAAIA,EAAQ,OAAS,QAAyB,CAACA,EAAQ,KACnD,MAAO,GAGX,IAAMG,EAAOH,EAAQ,KAAK,KAE1B,QAAWI,KAAWF,EAClB,GAAI,OAAOE,GAAY,UACnB,GAAID,EAAK,SAASC,CAAO,EACrB,MAAO,WAEJA,aAAmB,QACtBA,EAAQ,KAAKD,CAAI,EACjB,MAAO,GAKnB,MAAO,EACX,CACJ,EAMA,QAAUH,GACC,CAAC,CAACA,EAAQ,SAAW,CAAC,CAACA,EAAQ,QAAQ,WAQlD,UAAYK,GACAL,GACG,CAAC,CAACA,EAAQ,SAAWA,EAAQ,QAAQ,aAAeK,EAQnE,YAAcL,GACH,CAAC,CAACA,EAAQ,SAAW,CAAC,CAACA,EAAQ,QAAQ,UAOlD,sBAAwBA,GACb,CAAC,CAACA,EAAQ,SAAW,CAAC,CAACA,EAAQ,QAAQ,qBAQlD,IAAK,IAAIM,IACGN,GAAqC,CACzC,QAAWO,KAAUD,EACjB,GAAI,CAACC,EAAOP,CAAO,EACf,MAAO,GAGf,MAAO,EACX,EAQJ,GAAI,IAAIM,IACIN,GAAqC,CACzC,QAAWO,KAAUD,EACjB,GAAIC,EAAOP,CAAO,EACd,MAAO,GAGf,MAAO,EACX,EAQJ,IAAMQ,GACMR,GACG,CAACQ,EAAeR,CAAO,EAStC,KAAOS,GACKT,GACGA,EAAQ,OAASS,EAQhC,IAAK,IACM,IAAe,EAE9B","names":["filters_exports","__export","filters","__toCommonJS","filters","type","message","patterns","patternsArray","text","pattern","messageId","filterFunctions","filter","filterFunction","from"]}
@@ -1,2 +1,2 @@
1
- var b={type:e=>t=>t.type===e,text:e=>e.type==="text",image:e=>e.type==="image",audio:e=>e.type==="audio",video:e=>e.type==="video",document:e=>e.type==="document",sticker:e=>e.type==="sticker",location:e=>e.type==="location",contacts:e=>e.type==="contacts",button:e=>e.type==="button",interactive:e=>e.type==="interactive",system:e=>e.type==="system",order:e=>e.type==="order",matches:e=>{let t=Array.isArray(e)?e:[e];return r=>{if(r.type!=="text"||!r.text)return!1;let n=r.text.body;for(let o of t)if(typeof o=="string"){if(n.includes(o))return!0}else if(o instanceof RegExp&&o.test(n))return!0;return!1}},isReply:e=>!!e.context&&!!e.context.message_id,isReplyTo:e=>t=>!!t.context&&t.context.message_id===e,isForwarded:e=>!!e.context&&!!e.context.forwarded,isFrequentlyForwarded:e=>!!e.context&&!!e.context.frequently_forwarded,and:(...e)=>t=>{for(let r of e)if(!r(t))return!1;return!0},or:(...e)=>t=>{for(let r of e)if(r(t))return!0;return!1},not:e=>t=>!e(t),from:e=>t=>t.from===e,all:()=>()=>!0};export{b as filters};
1
+ var k={type:t=>i=>i.type===t,text:t=>t.type==="text",image:t=>t.type==="image",audio:t=>t.type==="audio",video:t=>t.type==="video",document:t=>t.type==="document",sticker:t=>t.type==="sticker",location:t=>t.type==="location",contacts:t=>t.type==="contacts",button:t=>t.type==="button",interactive:t=>t.type==="interactive",system:t=>t.type==="system",order:t=>t.type==="order",matches:t=>{let i=Array.isArray(t)?t:[t];return R=>{if(R.type!=="text"||!R.text)return!1;let l=R.text.body;for(let A of i)if(typeof A=="string"){if(l.includes(A))return!0}else if(A instanceof RegExp&&A.test(l))return!0;return!1}},isReply:t=>!!t.context&&!!t.context.message_id,isReplyTo:t=>i=>!!i.context&&i.context.message_id===t,isForwarded:t=>!!t.context&&!!t.context.forwarded,isFrequentlyForwarded:t=>!!t.context&&!!t.context.frequently_forwarded,and:(...t)=>i=>{for(let R of t)if(!R(i))return!1;return!0},or:(...t)=>i=>{for(let R of t)if(R(i))return!0;return!1},not:t=>i=>!t(i),from:t=>i=>i.from===t,all:()=>()=>!0};export{k as filters};
2
2
  //# sourceMappingURL=filters.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/filters.ts"],"sourcesContent":["import { MessageType, WebhookMessage } from '../types/webhook';\n\n/**\n * Filters for message handling, inspired by PyWa\n */\nexport const filters = {\n /**\n * Filters messages by type\n * @param type Message type to filter for\n * @returns A filter function\n */\n type: (type: MessageType | string): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage) => message.type === type;\n },\n\n /**\n * Filters text messages\n * @param message Message to check\n * @returns True if the message is a text message\n */\n text: (message: WebhookMessage): boolean => {\n return message.type === MessageType.TEXT;\n },\n\n /**\n * Filters image messages\n * @param message Message to check\n * @returns True if the message is an image message\n */\n image: (message: WebhookMessage): boolean => {\n return message.type === MessageType.IMAGE;\n },\n\n /**\n * Filters audio messages\n * @param message Message to check\n * @returns True if the message is an audio message\n */\n audio: (message: WebhookMessage): boolean => {\n return message.type === MessageType.AUDIO;\n },\n\n /**\n * Filters video messages\n * @param message Message to check\n * @returns True if the message is a video message\n */\n video: (message: WebhookMessage): boolean => {\n return message.type === MessageType.VIDEO;\n },\n\n /**\n * Filters document messages\n * @param message Message to check\n * @returns True if the message is a document message\n */\n document: (message: WebhookMessage): boolean => {\n return message.type === MessageType.DOCUMENT;\n },\n\n /**\n * Filters sticker messages\n * @param message Message to check\n * @returns True if the message is a sticker message\n */\n sticker: (message: WebhookMessage): boolean => {\n return message.type === MessageType.STICKER;\n },\n\n /**\n * Filters location messages\n * @param message Message to check\n * @returns True if the message is a location message\n */\n location: (message: WebhookMessage): boolean => {\n return message.type === MessageType.LOCATION;\n },\n\n /**\n * Filters contact messages\n * @param message Message to check\n * @returns True if the message is a contacts message\n */\n contacts: (message: WebhookMessage): boolean => {\n return message.type === MessageType.CONTACTS;\n },\n\n /**\n * Filters button messages\n * @param message Message to check\n * @returns True if the message is a button message\n */\n button: (message: WebhookMessage): boolean => {\n return message.type === MessageType.BUTTON;\n },\n\n /**\n * Filters interactive messages\n * @param message Message to check\n * @returns True if the message is an interactive message\n */\n interactive: (message: WebhookMessage): boolean => {\n return message.type === MessageType.INTERACTIVE;\n },\n\n /**\n * Filters system messages\n * @param message Message to check\n * @returns True if the message is a system message\n */\n system: (message: WebhookMessage): boolean => {\n return message.type === MessageType.SYSTEM;\n },\n\n /**\n * Filters order messages\n * @param message Message to check\n * @returns True if the message is an order message\n */\n order: (message: WebhookMessage): boolean => {\n return message.type === MessageType.ORDER;\n },\n\n /**\n * Matches text content against a pattern\n * @param patterns String or regular expression or array of patterns to match against\n * @returns A filter function\n */\n matches: (patterns: string | RegExp | (string | RegExp)[]): ((message: WebhookMessage) => boolean) => {\n const patternsArray = Array.isArray(patterns) ? patterns : [patterns];\n\n return (message: WebhookMessage): boolean => {\n if (message.type !== MessageType.TEXT || !message.text) {\n return false;\n }\n\n const text = message.text.body;\n\n for (const pattern of patternsArray) {\n if (typeof pattern === 'string') {\n if (text.includes(pattern)) {\n return true;\n }\n } else if (pattern instanceof RegExp) {\n if (pattern.test(text)) {\n return true;\n }\n }\n }\n\n return false;\n };\n },\n\n /**\n * Checks if a message is a reply to another message\n * @returns A filter function that returns true if the message is a reply\n */\n isReply: (message: WebhookMessage): boolean => {\n return !!message.context && !!message.context.message_id;\n },\n\n /**\n * Checks if a message is a reply to a specific message\n * @param messageId The ID of the original message to check for\n * @returns A filter function that returns true if the message is a reply to the specified message\n */\n isReplyTo: (messageId: string): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n return !!message.context && message.context.message_id === messageId;\n };\n },\n\n /**\n * Checks if a message is forwarded\n * @returns A filter function that returns true if the message is forwarded\n */\n isForwarded: (message: WebhookMessage): boolean => {\n return !!message.context && !!message.context.forwarded;\n },\n\n /**\n * Checks if a message is frequently forwarded\n * @returns A filter function that returns true if the message is frequently forwarded\n */\n isFrequentlyForwarded: (message: WebhookMessage): boolean => {\n return !!message.context && !!message.context.frequently_forwarded;\n },\n\n /**\n * Combines multiple filters with AND logic\n * @param filterFunctions Array of filter functions to combine\n * @returns A filter function that returns true only if all filters return true\n */\n and: (...filterFunctions: ((message: WebhookMessage) => boolean)[]): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n for (const filter of filterFunctions) {\n if (!filter(message)) {\n return false;\n }\n }\n return true;\n };\n },\n\n /**\n * Combines multiple filters with OR logic\n * @param filterFunctions Array of filter functions to combine\n * @returns A filter function that returns true if any filter returns true\n */\n or: (...filterFunctions: ((message: WebhookMessage) => boolean)[]): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n for (const filter of filterFunctions) {\n if (filter(message)) {\n return true;\n }\n }\n return false;\n };\n },\n\n /**\n * Negates a filter\n * @param filterFunction Filter function to negate\n * @returns A filter function that returns the opposite of the input filter\n */\n not: (filterFunction: (message: WebhookMessage) => boolean): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n return !filterFunction(message);\n };\n },\n\n /**\n * Filters messages from a specific sender\n * @param from Sender phone number to filter for\n * @returns A filter function\n */\n from: (from: string): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n return message.from === from;\n };\n },\n\n /**\n * Filter function that accepts all messages\n * @returns Always returns true\n */\n all: (): ((message: WebhookMessage) => boolean) => {\n return (): boolean => true;\n },\n};\n"],"mappings":"AAKO,IAAMA,EAAU,CAMnB,KAAOC,GACKC,GAA4BA,EAAQ,OAASD,EAQzD,KAAOC,GACIA,EAAQ,OAAS,OAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,SAAWA,GACAA,EAAQ,OAAS,WAQ5B,QAAUA,GACCA,EAAQ,OAAS,UAQ5B,SAAWA,GACAA,EAAQ,OAAS,WAQ5B,SAAWA,GACAA,EAAQ,OAAS,WAQ5B,OAASA,GACEA,EAAQ,OAAS,SAQ5B,YAAcA,GACHA,EAAQ,OAAS,cAQ5B,OAASA,GACEA,EAAQ,OAAS,SAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,QAAUC,GAA4F,CAClG,IAAMC,EAAgB,MAAM,QAAQD,CAAQ,EAAIA,EAAW,CAACA,CAAQ,EAEpE,OAAQD,GAAqC,CACzC,GAAIA,EAAQ,OAAS,QAAoB,CAACA,EAAQ,KAC9C,MAAO,GAGX,IAAMG,EAAOH,EAAQ,KAAK,KAE1B,QAAWI,KAAWF,EAClB,GAAI,OAAOE,GAAY,UACnB,GAAID,EAAK,SAASC,CAAO,EACrB,MAAO,WAEJA,aAAmB,QACtBA,EAAQ,KAAKD,CAAI,EACjB,MAAO,GAKnB,MAAO,EACX,CACJ,EAMA,QAAUH,GACC,CAAC,CAACA,EAAQ,SAAW,CAAC,CAACA,EAAQ,QAAQ,WAQlD,UAAYK,GACAL,GACG,CAAC,CAACA,EAAQ,SAAWA,EAAQ,QAAQ,aAAeK,EAQnE,YAAcL,GACH,CAAC,CAACA,EAAQ,SAAW,CAAC,CAACA,EAAQ,QAAQ,UAOlD,sBAAwBA,GACb,CAAC,CAACA,EAAQ,SAAW,CAAC,CAACA,EAAQ,QAAQ,qBAQlD,IAAK,IAAIM,IACGN,GAAqC,CACzC,QAAWO,KAAUD,EACjB,GAAI,CAACC,EAAOP,CAAO,EACf,MAAO,GAGf,MAAO,EACX,EAQJ,GAAI,IAAIM,IACIN,GAAqC,CACzC,QAAWO,KAAUD,EACjB,GAAIC,EAAOP,CAAO,EACd,MAAO,GAGf,MAAO,EACX,EAQJ,IAAMQ,GACMR,GACG,CAACQ,EAAeR,CAAO,EAStC,KAAOS,GACKT,GACGA,EAAQ,OAASS,EAQhC,IAAK,IACM,IAAe,EAE9B","names":["filters","type","message","patterns","patternsArray","text","pattern","messageId","filterFunctions","filter","filterFunction","from"]}
1
+ {"version":3,"sources":["../../src/utils/filters.ts"],"sourcesContent":["import { MessageTypesEnum } from 'src/types';\nimport { WebhookMessage } from '../types/webhook';\n\n/**\n * Filters for message handling, inspired by PyWa\n */\nexport const filters = {\n /**\n * Filters messages by type\n * @param type Message type to filter for\n * @returns A filter function\n */\n type: (type: MessageTypesEnum | string): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage) => message.type === type;\n },\n\n /**\n * Filters text messages\n * @param message Message to check\n * @returns True if the message is a text message\n */\n text: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Text;\n },\n\n /**\n * Filters image messages\n * @param message Message to check\n * @returns True if the message is an image message\n */\n image: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Image;\n },\n\n /**\n * Filters audio messages\n * @param message Message to check\n * @returns True if the message is an audio message\n */\n audio: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Audio;\n },\n\n /**\n * Filters video messages\n * @param message Message to check\n * @returns True if the message is a video message\n */\n video: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Video;\n },\n\n /**\n * Filters document messages\n * @param message Message to check\n * @returns True if the message is a document message\n */\n document: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Document;\n },\n\n /**\n * Filters sticker messages\n * @param message Message to check\n * @returns True if the message is a sticker message\n */\n sticker: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Sticker;\n },\n\n /**\n * Filters location messages\n * @param message Message to check\n * @returns True if the message is a location message\n */\n location: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Location;\n },\n\n /**\n * Filters contact messages\n * @param message Message to check\n * @returns True if the message is a contacts message\n */\n contacts: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Contacts;\n },\n\n /**\n * Filters button messages\n * @param message Message to check\n * @returns True if the message is a button message\n */\n button: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Button;\n },\n\n /**\n * Filters interactive messages\n * @param message Message to check\n * @returns True if the message is an interactive message\n */\n interactive: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Interactive;\n },\n\n /**\n * Filters system messages\n * @param message Message to check\n * @returns True if the message is a system message\n */\n system: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.System;\n },\n\n /**\n * Filters order messages\n * @param message Message to check\n * @returns True if the message is an order message\n */\n order: (message: WebhookMessage): boolean => {\n return message.type === MessageTypesEnum.Order;\n },\n\n /**\n * Matches text content against a pattern\n * @param patterns String or regular expression or array of patterns to match against\n * @returns A filter function\n */\n matches: (patterns: string | RegExp | (string | RegExp)[]): ((message: WebhookMessage) => boolean) => {\n const patternsArray = Array.isArray(patterns) ? patterns : [patterns];\n\n return (message: WebhookMessage): boolean => {\n if (message.type !== MessageTypesEnum.Text || !message.text) {\n return false;\n }\n\n const text = message.text.body;\n\n for (const pattern of patternsArray) {\n if (typeof pattern === 'string') {\n if (text.includes(pattern)) {\n return true;\n }\n } else if (pattern instanceof RegExp) {\n if (pattern.test(text)) {\n return true;\n }\n }\n }\n\n return false;\n };\n },\n\n /**\n * Checks if a message is a reply to another message\n * @returns A filter function that returns true if the message is a reply\n */\n isReply: (message: WebhookMessage): boolean => {\n return !!message.context && !!message.context.message_id;\n },\n\n /**\n * Checks if a message is a reply to a specific message\n * @param messageId The ID of the original message to check for\n * @returns A filter function that returns true if the message is a reply to the specified message\n */\n isReplyTo: (messageId: string): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n return !!message.context && message.context.message_id === messageId;\n };\n },\n\n /**\n * Checks if a message is forwarded\n * @returns A filter function that returns true if the message is forwarded\n */\n isForwarded: (message: WebhookMessage): boolean => {\n return !!message.context && !!message.context.forwarded;\n },\n\n /**\n * Checks if a message is frequently forwarded\n * @returns A filter function that returns true if the message is frequently forwarded\n */\n isFrequentlyForwarded: (message: WebhookMessage): boolean => {\n return !!message.context && !!message.context.frequently_forwarded;\n },\n\n /**\n * Combines multiple filters with AND logic\n * @param filterFunctions Array of filter functions to combine\n * @returns A filter function that returns true only if all filters return true\n */\n and: (...filterFunctions: ((message: WebhookMessage) => boolean)[]): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n for (const filter of filterFunctions) {\n if (!filter(message)) {\n return false;\n }\n }\n return true;\n };\n },\n\n /**\n * Combines multiple filters with OR logic\n * @param filterFunctions Array of filter functions to combine\n * @returns A filter function that returns true if any filter returns true\n */\n or: (...filterFunctions: ((message: WebhookMessage) => boolean)[]): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n for (const filter of filterFunctions) {\n if (filter(message)) {\n return true;\n }\n }\n return false;\n };\n },\n\n /**\n * Negates a filter\n * @param filterFunction Filter function to negate\n * @returns A filter function that returns the opposite of the input filter\n */\n not: (filterFunction: (message: WebhookMessage) => boolean): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n return !filterFunction(message);\n };\n },\n\n /**\n * Filters messages from a specific sender\n * @param from Sender phone number to filter for\n * @returns A filter function\n */\n from: (from: string): ((message: WebhookMessage) => boolean) => {\n return (message: WebhookMessage): boolean => {\n return message.from === from;\n };\n },\n\n /**\n * Filter function that accepts all messages\n * @returns Always returns true\n */\n all: (): ((message: WebhookMessage) => boolean) => {\n return (): boolean => true;\n },\n};\n"],"mappings":"AAMO,IAAMA,EAAU,CAMnB,KAAOC,GACKC,GAA4BA,EAAQ,OAASD,EAQzD,KAAOC,GACIA,EAAQ,OAAS,OAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,SAAWA,GACAA,EAAQ,OAAS,WAQ5B,QAAUA,GACCA,EAAQ,OAAS,UAQ5B,SAAWA,GACAA,EAAQ,OAAS,WAQ5B,SAAWA,GACAA,EAAQ,OAAS,WAQ5B,OAASA,GACEA,EAAQ,OAAS,SAQ5B,YAAcA,GACHA,EAAQ,OAAS,cAQ5B,OAASA,GACEA,EAAQ,OAAS,SAQ5B,MAAQA,GACGA,EAAQ,OAAS,QAQ5B,QAAUC,GAA4F,CAClG,IAAMC,EAAgB,MAAM,QAAQD,CAAQ,EAAIA,EAAW,CAACA,CAAQ,EAEpE,OAAQD,GAAqC,CACzC,GAAIA,EAAQ,OAAS,QAAyB,CAACA,EAAQ,KACnD,MAAO,GAGX,IAAMG,EAAOH,EAAQ,KAAK,KAE1B,QAAWI,KAAWF,EAClB,GAAI,OAAOE,GAAY,UACnB,GAAID,EAAK,SAASC,CAAO,EACrB,MAAO,WAEJA,aAAmB,QACtBA,EAAQ,KAAKD,CAAI,EACjB,MAAO,GAKnB,MAAO,EACX,CACJ,EAMA,QAAUH,GACC,CAAC,CAACA,EAAQ,SAAW,CAAC,CAACA,EAAQ,QAAQ,WAQlD,UAAYK,GACAL,GACG,CAAC,CAACA,EAAQ,SAAWA,EAAQ,QAAQ,aAAeK,EAQnE,YAAcL,GACH,CAAC,CAACA,EAAQ,SAAW,CAAC,CAACA,EAAQ,QAAQ,UAOlD,sBAAwBA,GACb,CAAC,CAACA,EAAQ,SAAW,CAAC,CAACA,EAAQ,QAAQ,qBAQlD,IAAK,IAAIM,IACGN,GAAqC,CACzC,QAAWO,KAAUD,EACjB,GAAI,CAACC,EAAOP,CAAO,EACf,MAAO,GAGf,MAAO,EACX,EAQJ,GAAI,IAAIM,IACIN,GAAqC,CACzC,QAAWO,KAAUD,EACjB,GAAIC,EAAOP,CAAO,EACd,MAAO,GAGf,MAAO,EACX,EAQJ,IAAMQ,GACMR,GACG,CAACQ,EAAeR,CAAO,EAStC,KAAOS,GACKT,GACGA,EAAQ,OAASS,EAQhC,IAAK,IACM,IAAe,EAE9B","names":["filters","type","message","patterns","patternsArray","text","pattern","messageId","filterFunctions","filter","filterFunction","from"]}
@@ -1,7 +1,7 @@
1
1
  import { WhatsAppConfig } from '../types/whatsapp.mjs';
2
2
  import { WabaConfigType } from '../types/config.mjs';
3
3
  import '../types/businessProfile.mjs';
4
- import '../enums-D7paGoTY.mjs';
4
+ import '../enums-DEhBfoMC.mjs';
5
5
  import '../types/request.mjs';
6
6
  import '../types/encryption.mjs';
7
7
  import '../types/flow.mjs';
@@ -1,7 +1,7 @@
1
1
  import { WhatsAppConfig } from '../types/whatsapp.js';
2
2
  import { WabaConfigType } from '../types/config.js';
3
3
  import '../types/businessProfile.js';
4
- import '../enums-D7paGoTY.js';
4
+ import '../enums-DEhBfoMC.js';
5
5
  import '../types/request.js';
6
6
  import '../types/encryption.js';
7
7
  import '../types/flow.js';
@@ -1,2 +1,2 @@
1
- "use strict";var P=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var t=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var G=(S,A)=>{for(var R in A)P(S,R,{get:A[R],enumerable:!0})},T=(S,A,R,U)=>{if(A&&typeof A=="object"||typeof A=="function")for(let D of t(A))!B.call(S,D)&&D!==R&&P(S,D,{get:()=>A[D],enumerable:!(U=O(A,D))||U.enumerable});return S};var _=S=>T(P({},"__esModule",{value:!0}),S);var Y={};G(Y,{importConfig:()=>X});module.exports=_(Y);var N=class{name;debug;constructor(A,R=!1){this.name=A,this.debug=R}log(...A){if(this.debug){let R=`[ ${Date.now()} ]`;this.name&&(R+=` - ${this.name}`),console.log.apply(console,[R,": ",...A])}}error(...A){let R=`[ ${Date.now()} ] - ERROR`;this.name&&(R+=` - ${this.name}`),console.error.apply(console,[R,": ",...A])}warn(...A){let R=`[ ${Date.now()} ] - WARN`;this.name&&(R+=` - ${this.name}`),console.warn.apply(console,[R,": ",...A])}info(...A){let R=`[ ${Date.now()} ] - INFO`;this.name&&(R+=` - ${this.name}`),console.info.apply(console,[R,": ",...A])}};var K="UTILS",M=!1,I=new N(K,process.env.DEBUG==="true"||M),i="graph.facebook.com",p=3e3,F=30,H=2e4,L=S=>{if(!process.env.CLOUD_API_ACCESS_TOKEN&&!S?.accessToken)throw I.log("Environmental variable: CLOUD_API_ACCESS_TOKEN and/or access token argument is undefined."),new Error("Missing WhatsApp access token.")},X=S=>{L(S);let A={WA_BASE_URL:process.env.WA_BASE_URL||i,M4D_APP_ID:process.env.M4D_APP_ID||"",M4D_APP_SECRET:process.env.M4D_APP_SECRET||"",WA_PHONE_NUMBER_ID:S?.phoneNumberId||Number(process.env.WA_PHONE_NUMBER_ID),WA_BUSINESS_ACCOUNT_ID:S?.businessAcctId||process.env.WA_BUSINESS_ACCOUNT_ID||"",CLOUD_API_VERSION:process.env.CLOUD_API_VERSION||"",CLOUD_API_ACCESS_TOKEN:S?.accessToken||process.env.CLOUD_API_ACCESS_TOKEN||"",WEBHOOK_ENDPOINT:process.env.WEBHOOK_ENDPOINT||"",WEBHOOK_VERIFICATION_TOKEN:process.env.WEBHOOK_VERIFICATION_TOKEN||"",LISTENER_PORT:parseInt(process.env.LISTENER_PORT||"")||p,MAX_RETRIES_AFTER_WAIT:parseInt(process.env.MAX_RETRIES_AFTER_WAIT||"")||F,REQUEST_TIMEOUT:parseInt(process.env.REQUEST_TIMEOUT||"")||H,DEBUG:process.env.DEBUG==="true"};return I.log(`Configuration loaded for App Id ${A.M4D_APP_ID}`),A};0&&(module.exports={importConfig});
1
+ "use strict";var P=Object.defineProperty;var t=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var G=(S,A)=>{for(var R in A)P(S,R,{get:A[R],enumerable:!0})},_=(S,A,R,U)=>{if(A&&typeof A=="object"||typeof A=="function")for(let D of I(A))!B.call(S,D)&&D!==R&&P(S,D,{get:()=>A[D],enumerable:!(U=t(A,D))||U.enumerable});return S};var T=S=>_(P({},"__esModule",{value:!0}),S);var Y={};G(Y,{importConfig:()=>X});module.exports=T(Y);var N=class{name;debug;constructor(A,R=!1){this.name=A,this.debug=R}log(...A){if(this.debug){let R=`[ ${Date.now()} ]`;this.name&&(R+=` - ${this.name}`),console.log.apply(console,[R,": ",...A])}}error(...A){let R=`[ ${Date.now()} ] - ERROR`;this.name&&(R+=` - ${this.name}`),console.error.apply(console,[R,": ",...A])}warn(...A){let R=`[ ${Date.now()} ] - WARN`;this.name&&(R+=` - ${this.name}`),console.warn.apply(console,[R,": ",...A])}info(...A){let R=`[ ${Date.now()} ] - INFO`;this.name&&(R+=` - ${this.name}`),console.info.apply(console,[R,": ",...A])}};var K="UTILS",M=!1,O=new N(K,process.env.DEBUG==="true"||M),i="graph.facebook.com",F=3e3,p=30,H=2e4,L=S=>{if(!process.env.CLOUD_API_ACCESS_TOKEN&&!S?.accessToken)throw O.log("Environmental variable: CLOUD_API_ACCESS_TOKEN and/or access token argument is undefined."),new Error("Missing WhatsApp access token.")},X=S=>{L(S);let A={WA_BASE_URL:process.env.WA_BASE_URL||i,M4D_APP_ID:process.env.M4D_APP_ID||"",M4D_APP_SECRET:process.env.M4D_APP_SECRET||"",WA_PHONE_NUMBER_ID:S?.phoneNumberId||Number(process.env.WA_PHONE_NUMBER_ID),WA_BUSINESS_ACCOUNT_ID:S?.businessAcctId||process.env.WA_BUSINESS_ACCOUNT_ID||"",CLOUD_API_VERSION:process.env.CLOUD_API_VERSION||"",CLOUD_API_ACCESS_TOKEN:S?.accessToken||process.env.CLOUD_API_ACCESS_TOKEN||"",WEBHOOK_ENDPOINT:process.env.WEBHOOK_ENDPOINT||"",WEBHOOK_VERIFICATION_TOKEN:process.env.WEBHOOK_VERIFICATION_TOKEN||"",LISTENER_PORT:parseInt(process.env.LISTENER_PORT||"")||F,MAX_RETRIES_AFTER_WAIT:parseInt(process.env.MAX_RETRIES_AFTER_WAIT||"")||p,REQUEST_TIMEOUT:parseInt(process.env.REQUEST_TIMEOUT||"")||H,DEBUG:process.env.DEBUG==="true"};return O.log(`Configuration loaded for App Id ${A.M4D_APP_ID}`),A};0&&(module.exports={importConfig});
2
2
  //# sourceMappingURL=importConfig.js.map
@@ -1,2 +1,2 @@
1
- var D=class{name;debug;constructor(R,A=!1){this.name=R,this.debug=A}log(...R){if(this.debug){let A=`[ ${Date.now()} ]`;this.name&&(A+=` - ${this.name}`),console.log.apply(console,[A,": ",...R])}}error(...R){let A=`[ ${Date.now()} ] - ERROR`;this.name&&(A+=` - ${this.name}`),console.error.apply(console,[A,": ",...R])}warn(...R){let A=`[ ${Date.now()} ] - WARN`;this.name&&(A+=` - ${this.name}`),console.warn.apply(console,[A,": ",...R])}info(...R){let A=`[ ${Date.now()} ] - INFO`;this.name&&(A+=` - ${this.name}`),console.info.apply(console,[A,": ",...R])}};var P="UTILS",U=!1,N=new D(P,process.env.DEBUG==="true"||U),I="graph.facebook.com",O=3e3,t=30,B=2e4,G=S=>{if(!process.env.CLOUD_API_ACCESS_TOKEN&&!S?.accessToken)throw N.log("Environmental variable: CLOUD_API_ACCESS_TOKEN and/or access token argument is undefined."),new Error("Missing WhatsApp access token.")},p=S=>{G(S);let R={WA_BASE_URL:process.env.WA_BASE_URL||I,M4D_APP_ID:process.env.M4D_APP_ID||"",M4D_APP_SECRET:process.env.M4D_APP_SECRET||"",WA_PHONE_NUMBER_ID:S?.phoneNumberId||Number(process.env.WA_PHONE_NUMBER_ID),WA_BUSINESS_ACCOUNT_ID:S?.businessAcctId||process.env.WA_BUSINESS_ACCOUNT_ID||"",CLOUD_API_VERSION:process.env.CLOUD_API_VERSION||"",CLOUD_API_ACCESS_TOKEN:S?.accessToken||process.env.CLOUD_API_ACCESS_TOKEN||"",WEBHOOK_ENDPOINT:process.env.WEBHOOK_ENDPOINT||"",WEBHOOK_VERIFICATION_TOKEN:process.env.WEBHOOK_VERIFICATION_TOKEN||"",LISTENER_PORT:parseInt(process.env.LISTENER_PORT||"")||O,MAX_RETRIES_AFTER_WAIT:parseInt(process.env.MAX_RETRIES_AFTER_WAIT||"")||t,REQUEST_TIMEOUT:parseInt(process.env.REQUEST_TIMEOUT||"")||B,DEBUG:process.env.DEBUG==="true"};return N.log(`Configuration loaded for App Id ${R.M4D_APP_ID}`),R};export{p as importConfig};
1
+ var D=class{name;debug;constructor(R,A=!1){this.name=R,this.debug=A}log(...R){if(this.debug){let A=`[ ${Date.now()} ]`;this.name&&(A+=` - ${this.name}`),console.log.apply(console,[A,": ",...R])}}error(...R){let A=`[ ${Date.now()} ] - ERROR`;this.name&&(A+=` - ${this.name}`),console.error.apply(console,[A,": ",...R])}warn(...R){let A=`[ ${Date.now()} ] - WARN`;this.name&&(A+=` - ${this.name}`),console.warn.apply(console,[A,": ",...R])}info(...R){let A=`[ ${Date.now()} ] - INFO`;this.name&&(A+=` - ${this.name}`),console.info.apply(console,[A,": ",...R])}};var P="UTILS",U=!1,N=new D(P,process.env.DEBUG==="true"||U),O="graph.facebook.com",t=3e3,I=30,B=2e4,G=S=>{if(!process.env.CLOUD_API_ACCESS_TOKEN&&!S?.accessToken)throw N.log("Environmental variable: CLOUD_API_ACCESS_TOKEN and/or access token argument is undefined."),new Error("Missing WhatsApp access token.")},F=S=>{G(S);let R={WA_BASE_URL:process.env.WA_BASE_URL||O,M4D_APP_ID:process.env.M4D_APP_ID||"",M4D_APP_SECRET:process.env.M4D_APP_SECRET||"",WA_PHONE_NUMBER_ID:S?.phoneNumberId||Number(process.env.WA_PHONE_NUMBER_ID),WA_BUSINESS_ACCOUNT_ID:S?.businessAcctId||process.env.WA_BUSINESS_ACCOUNT_ID||"",CLOUD_API_VERSION:process.env.CLOUD_API_VERSION||"",CLOUD_API_ACCESS_TOKEN:S?.accessToken||process.env.CLOUD_API_ACCESS_TOKEN||"",WEBHOOK_ENDPOINT:process.env.WEBHOOK_ENDPOINT||"",WEBHOOK_VERIFICATION_TOKEN:process.env.WEBHOOK_VERIFICATION_TOKEN||"",LISTENER_PORT:parseInt(process.env.LISTENER_PORT||"")||t,MAX_RETRIES_AFTER_WAIT:parseInt(process.env.MAX_RETRIES_AFTER_WAIT||"")||I,REQUEST_TIMEOUT:parseInt(process.env.REQUEST_TIMEOUT||"")||B,DEBUG:process.env.DEBUG==="true"};return N.log(`Configuration loaded for App Id ${R.M4D_APP_ID}`),R};export{F as importConfig};
2
2
  //# sourceMappingURL=importConfig.mjs.map
@@ -4,7 +4,7 @@ export { MetaError, isMetaError } from './isMetaError.mjs';
4
4
  export { objectToQueryString } from './objectToQueryString.mjs';
5
5
  import '../types/whatsapp.mjs';
6
6
  import '../types/businessProfile.mjs';
7
- import '../enums-D7paGoTY.mjs';
7
+ import '../enums-DEhBfoMC.mjs';
8
8
  import '../types/request.mjs';
9
9
  import '../types/encryption.mjs';
10
10
  import '../types/flow.mjs';
@@ -4,7 +4,7 @@ export { MetaError, isMetaError } from './isMetaError.js';
4
4
  export { objectToQueryString } from './objectToQueryString.js';
5
5
  import '../types/whatsapp.js';
6
6
  import '../types/businessProfile.js';
7
- import '../enums-D7paGoTY.js';
7
+ import '../enums-DEhBfoMC.js';
8
8
  import '../types/request.js';
9
9
  import '../types/encryption.js';
10
10
  import '../types/flow.js';