@samva/webhooks 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/effect.js CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as WebhookTimestampError, c as signWebhook, f as InvalidWebhookHeadersError, g as WebhookSignatureError, h as WebhookCryptoError, i as WEBHOOK_TIMESTAMP_HEADER, l as verifyWebhookAt, m as MalformedWebhookPayloadError, n as WEBHOOK_ID_HEADER, o as generateWebhookSecret, p as InvalidWebhookSecretError, r as WEBHOOK_SIGNATURE_HEADER, t as DEFAULT_TOLERANCE_SECONDS, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-DxerOUFO.js";
2
- import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-CC-lSu4T.js";
3
- import { ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, MailboxActionPendingApprovalEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageReleasedEventSchema, MailboxMessageSentEventSchema, MessageBouncedEventSchema, MessageClickedEventSchema, MessageComplainedEventSchema, MessageDeliveredEventSchema, MessageFailedEventSchema, MessageOpenedEventSchema, MessageReadEventSchema, MessageReceivedEventSchema, MessageSentEventSchema, SamvaWebhookEventSchema, TemplateRegistrationUpdatedEventSchema, WebhookCreatedEventSchema, WebhookDeletedEventSchema, WebhookTestEventSchema, WebhookUpdatedEventSchema } from "./schemas.gen.js";
1
+ import { _ as WebhookTimestampError, c as signWebhook, f as InvalidWebhookHeadersError, g as WebhookSignatureError, h as WebhookCryptoError, i as WEBHOOK_TIMESTAMP_HEADER, l as verifyWebhookAt, m as MalformedWebhookPayloadError, n as WEBHOOK_ID_HEADER, o as generateWebhookSecret, p as InvalidWebhookSecretError, r as WEBHOOK_SIGNATURE_HEADER, t as DEFAULT_TOLERANCE_SECONDS, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-GkuvvobW.js";
2
+ import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-DC_ZmYw2.js";
3
+ import { ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageReleasedEventSchema, MailboxMessageSentEventSchema, MessageBouncedEventSchema, MessageClickedEventSchema, MessageComplainedEventSchema, MessageDeliveredEventSchema, MessageFailedEventSchema, MessageOpenedEventSchema, MessageReadEventSchema, MessageReceivedEventSchema, MessageSentEventSchema, SamvaWebhookEventSchema, TemplateRegistrationUpdatedEventSchema, WebhookCreatedEventSchema, WebhookDeletedEventSchema, WebhookTestEventSchema, WebhookUpdatedEventSchema } from "./schemas.gen.js";
4
4
  import { Clock, Effect } from "effect";
5
5
  //#region src/effect.ts
6
6
  /**
@@ -75,6 +75,6 @@ const verifyRequest = Effect.fn("Webhooks.verifyRequest")(function* (request, se
75
75
  });
76
76
  });
77
77
  //#endregion
78
- export { ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DEFAULT_TOLERANCE_SECONDS, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, InvalidWebhookHeadersError, InvalidWebhookSecretError, MailboxActionPendingApprovalEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageReleasedEventSchema, MailboxMessageSentEventSchema, MalformedWebhookPayloadError, MessageBouncedEventSchema, MessageClickedEventSchema, MessageComplainedEventSchema, MessageDeliveredEventSchema, MessageFailedEventSchema, MessageOpenedEventSchema, MessageReadEventSchema, MessageReceivedEventSchema, MessageSentEventSchema, SamvaWebhookEventSchema, TemplateRegistrationUpdatedEventSchema, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WebhookCreatedEventSchema, WebhookCryptoError, WebhookDeletedEventSchema, WebhookEventJsonSchemas, WebhookSignatureError, WebhookTestEventSchema, WebhookTimestampError, WebhookUpdatedEventSchema, WebhookVerificationError, generateWebhookSecret, isKnownEvent, signWebhook, verify, verifyRequest };
78
+ export { ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DEFAULT_TOLERANCE_SECONDS, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, InvalidWebhookHeadersError, InvalidWebhookSecretError, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageReleasedEventSchema, MailboxMessageSentEventSchema, MalformedWebhookPayloadError, MessageBouncedEventSchema, MessageClickedEventSchema, MessageComplainedEventSchema, MessageDeliveredEventSchema, MessageFailedEventSchema, MessageOpenedEventSchema, MessageReadEventSchema, MessageReceivedEventSchema, MessageSentEventSchema, SamvaWebhookEventSchema, TemplateRegistrationUpdatedEventSchema, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WebhookCreatedEventSchema, WebhookCryptoError, WebhookDeletedEventSchema, WebhookEventJsonSchemas, WebhookSignatureError, WebhookTestEventSchema, WebhookTimestampError, WebhookUpdatedEventSchema, WebhookVerificationError, generateWebhookSecret, isKnownEvent, signWebhook, verify, verifyRequest };
79
79
 
80
80
  //# sourceMappingURL=effect.js.map
@@ -2667,6 +2667,7 @@ const WebhookEventJsonSchemas = {
2667
2667
  type: "object",
2668
2668
  properties: {
2669
2669
  id: { $ref: "#/$defs/MessageId" },
2670
+ channel: { $ref: "#/$defs/MailboxChannel" },
2670
2671
  threadId: { $ref: "#/$defs/MailboxThreadId" },
2671
2672
  from: {
2672
2673
  type: "object",
@@ -2727,6 +2728,10 @@ const WebhookEventJsonSchemas = {
2727
2728
  type: "object",
2728
2729
  properties: {
2729
2730
  id: { $ref: "#/$defs/MailboxThreadId" },
2731
+ endpointId: {
2732
+ anyOf: [{ $ref: "#/$defs/MailboxEndpointId" }, { type: "null" }],
2733
+ description: "The endpoint the message arrived at; null once it is removed. Deliveries recorded before this field existed omit it."
2734
+ },
2730
2735
  subject: { anyOf: [{ type: "string" }, { type: "null" }] },
2731
2736
  preview: { anyOf: [{ type: "string" }, { type: "null" }] }
2732
2737
  },
@@ -2766,6 +2771,15 @@ const WebhookEventJsonSchemas = {
2766
2771
  type: "string",
2767
2772
  pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
2768
2773
  },
2774
+ MailboxChannel: {
2775
+ type: "string",
2776
+ enum: [
2777
+ "email",
2778
+ "whatsapp",
2779
+ "sms"
2780
+ ],
2781
+ description: "Deliveries recorded before this field existed omit it; they are email."
2782
+ },
2769
2783
  MailboxThreadId: {
2770
2784
  type: "string",
2771
2785
  pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$"
@@ -2773,6 +2787,10 @@ const WebhookEventJsonSchemas = {
2773
2787
  AttachmentId: {
2774
2788
  type: "string",
2775
2789
  pattern: "^att_[0-9a-hjkmnp-tv-z]{16,24}$"
2790
+ },
2791
+ MailboxEndpointId: {
2792
+ type: "string",
2793
+ pattern: "^mbxep_[0-9a-hjkmnp-tv-z]{16,24}$"
2776
2794
  }
2777
2795
  }
2778
2796
  },
@@ -2834,6 +2852,7 @@ const WebhookEventJsonSchemas = {
2834
2852
  type: "object",
2835
2853
  properties: {
2836
2854
  id: { $ref: "#/$defs/MessageId" },
2855
+ channel: { $ref: "#/$defs/MailboxChannel" },
2837
2856
  threadId: { $ref: "#/$defs/MailboxThreadId" },
2838
2857
  from: {
2839
2858
  type: "object",
@@ -2924,6 +2943,15 @@ const WebhookEventJsonSchemas = {
2924
2943
  type: "string",
2925
2944
  pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
2926
2945
  },
2946
+ MailboxChannel: {
2947
+ type: "string",
2948
+ enum: [
2949
+ "email",
2950
+ "whatsapp",
2951
+ "sms"
2952
+ ],
2953
+ description: "Deliveries recorded before this field existed omit it; they are email."
2954
+ },
2927
2955
  MailboxThreadId: {
2928
2956
  type: "string",
2929
2957
  pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$"
@@ -3263,6 +3291,7 @@ const WebhookEventJsonSchemas = {
3263
3291
  type: "object",
3264
3292
  properties: {
3265
3293
  id: { $ref: "#/$defs/MessageId" },
3294
+ channel: { $ref: "#/$defs/MailboxChannel" },
3266
3295
  threadId: { $ref: "#/$defs/MailboxThreadId" },
3267
3296
  from: {
3268
3297
  type: "object",
@@ -3323,6 +3352,10 @@ const WebhookEventJsonSchemas = {
3323
3352
  type: "object",
3324
3353
  properties: {
3325
3354
  id: { $ref: "#/$defs/MailboxThreadId" },
3355
+ endpointId: {
3356
+ anyOf: [{ $ref: "#/$defs/MailboxEndpointId" }, { type: "null" }],
3357
+ description: "The endpoint the message arrived at; null once it is removed. Deliveries recorded before this field existed omit it."
3358
+ },
3326
3359
  subject: { anyOf: [{ type: "string" }, { type: "null" }] },
3327
3360
  preview: { anyOf: [{ type: "string" }, { type: "null" }] }
3328
3361
  },
@@ -3364,6 +3397,15 @@ const WebhookEventJsonSchemas = {
3364
3397
  type: "string",
3365
3398
  pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
3366
3399
  },
3400
+ MailboxChannel: {
3401
+ type: "string",
3402
+ enum: [
3403
+ "email",
3404
+ "whatsapp",
3405
+ "sms"
3406
+ ],
3407
+ description: "Deliveries recorded before this field existed omit it; they are email."
3408
+ },
3367
3409
  MailboxThreadId: {
3368
3410
  type: "string",
3369
3411
  pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$"
@@ -3371,6 +3413,10 @@ const WebhookEventJsonSchemas = {
3371
3413
  AttachmentId: {
3372
3414
  type: "string",
3373
3415
  pattern: "^att_[0-9a-hjkmnp-tv-z]{16,24}$"
3416
+ },
3417
+ MailboxEndpointId: {
3418
+ type: "string",
3419
+ pattern: "^mbxep_[0-9a-hjkmnp-tv-z]{16,24}$"
3374
3420
  }
3375
3421
  }
3376
3422
  },
@@ -3493,9 +3539,79 @@ const WebhookEventJsonSchemas = {
3493
3539
  pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
3494
3540
  }
3495
3541
  }
3542
+ },
3543
+ "journey.webhook": {
3544
+ type: "object",
3545
+ properties: {
3546
+ type: {
3547
+ type: "string",
3548
+ enum: ["journey.webhook"]
3549
+ },
3550
+ timestamp: { type: "string" },
3551
+ data: {
3552
+ type: "object",
3553
+ properties: {
3554
+ organizationId: { $ref: "#/$defs/OrganizationId" },
3555
+ journeyId: { $ref: "#/$defs/JourneyId" },
3556
+ journeyVersion: { type: "integer" },
3557
+ runId: { $ref: "#/$defs/JourneyRunId" },
3558
+ nodeId: { type: "string" },
3559
+ contact: {
3560
+ type: "object",
3561
+ properties: {
3562
+ id: { $ref: "#/$defs/ContactId" },
3563
+ externalId: { anyOf: [{ type: "string" }, { type: "null" }] },
3564
+ email: { anyOf: [{ type: "string" }, { type: "null" }] }
3565
+ },
3566
+ required: [
3567
+ "id",
3568
+ "externalId",
3569
+ "email"
3570
+ ],
3571
+ additionalProperties: true
3572
+ },
3573
+ data: { $ref: "#/$defs/JsonObject" }
3574
+ },
3575
+ required: [
3576
+ "organizationId",
3577
+ "journeyId",
3578
+ "journeyVersion",
3579
+ "runId",
3580
+ "nodeId",
3581
+ "contact",
3582
+ "data"
3583
+ ],
3584
+ additionalProperties: true
3585
+ }
3586
+ },
3587
+ required: [
3588
+ "type",
3589
+ "timestamp",
3590
+ "data"
3591
+ ],
3592
+ additionalProperties: true,
3593
+ $defs: {
3594
+ OrganizationId: {
3595
+ type: "string",
3596
+ pattern: "^org_[0-9a-hjkmnp-tv-z]{16,24}$"
3597
+ },
3598
+ JourneyId: {
3599
+ type: "string",
3600
+ pattern: "^jrny_[0-9a-hjkmnp-tv-z]{16,24}$"
3601
+ },
3602
+ JourneyRunId: {
3603
+ type: "string",
3604
+ pattern: "^jrun_[0-9a-hjkmnp-tv-z]{16,24}$"
3605
+ },
3606
+ ContactId: {
3607
+ type: "string",
3608
+ pattern: "^contact_[0-9a-hjkmnp-tv-z]{16,24}$"
3609
+ },
3610
+ JsonObject: { type: "object" }
3611
+ }
3496
3612
  }
3497
3613
  };
3498
3614
  //#endregion
3499
3615
  export { WebhookEventJsonSchemas as t };
3500
3616
 
3501
- //# sourceMappingURL=json-schemas.gen-CC-lSu4T.js.map
3617
+ //# sourceMappingURL=json-schemas.gen-DC_ZmYw2.js.map
package/dist/promise.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as WebhookTimestampError, c as signWebhook, f as InvalidWebhookHeadersError, g as WebhookSignatureError, h as WebhookCryptoError, i as WEBHOOK_TIMESTAMP_HEADER, l as verifyWebhookAt, m as MalformedWebhookPayloadError, n as WEBHOOK_ID_HEADER, o as generateWebhookSecret, p as InvalidWebhookSecretError, r as WEBHOOK_SIGNATURE_HEADER, s as readWebhookHeaders, t as DEFAULT_TOLERANCE_SECONDS, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-DxerOUFO.js";
2
- import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-CC-lSu4T.js";
1
+ import { _ as WebhookTimestampError, c as signWebhook, f as InvalidWebhookHeadersError, g as WebhookSignatureError, h as WebhookCryptoError, i as WEBHOOK_TIMESTAMP_HEADER, l as verifyWebhookAt, m as MalformedWebhookPayloadError, n as WEBHOOK_ID_HEADER, o as generateWebhookSecret, p as InvalidWebhookSecretError, r as WEBHOOK_SIGNATURE_HEADER, s as readWebhookHeaders, t as DEFAULT_TOLERANCE_SECONDS, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-GkuvvobW.js";
2
+ import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-DC_ZmYw2.js";
3
3
  //#region src/promise.ts
4
4
  /**
5
5
  * Verifies a Samva webhook delivery from its body and header values, then returns its ID and
@@ -219,51 +219,60 @@ const validate1301 = (value) => typeof value === "string" && (value === "marketi
219
219
  const validate1302 = (value) => validate1301(value) || validate6(value);
220
220
  const validate1319 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1320(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1322(value["data"]));
221
221
  const validate1320 = (value) => typeof value === "string" && value === "mailbox.message.received";
222
- const validate1322 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "message") && Object.hasOwn(value, "thread") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1324(value["namespaceId"])) && (!Object.hasOwn(value, "message") || validate1327(value["message"])) && (!Object.hasOwn(value, "thread") || validate1355(value["thread"]));
222
+ const validate1322 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "message") && Object.hasOwn(value, "thread") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1324(value["namespaceId"])) && (!Object.hasOwn(value, "message") || validate1327(value["message"])) && (!Object.hasOwn(value, "thread") || validate1356(value["thread"]));
223
223
  const validate1324 = (value) => validate1325(value) || validate6(value);
224
224
  const validate1325 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^ns_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
225
- const validate1327 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "from") && Object.hasOwn(value, "to") && Object.hasOwn(value, "cc") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "text") && Object.hasOwn(value, "replyText") && Object.hasOwn(value, "attachments") && Object.hasOwn(value, "occurredAt") && (!Object.hasOwn(value, "id") || validate755(value["id"])) && (!Object.hasOwn(value, "threadId") || validate1329(value["threadId"])) && (!Object.hasOwn(value, "from") || validate1330(value["from"])) && (!Object.hasOwn(value, "to") || validate45(value["to"])) && (!Object.hasOwn(value, "cc") || validate45(value["cc"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "text") || validate8(value["text"])) && (!Object.hasOwn(value, "replyText") || validate8(value["replyText"])) && (!Object.hasOwn(value, "attachments") || validate1348(value["attachments"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"]));
226
- const validate1329 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^thread_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
227
- const validate1330 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "address") && (!Object.hasOwn(value, "address") || validate2(value["address"])) && (!Object.hasOwn(value, "name") || validate8(value["name"]));
228
- const validate1348 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate1349);
229
- const validate1349 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "filename") && Object.hasOwn(value, "contentType") && Object.hasOwn(value, "size") && (!Object.hasOwn(value, "id") || validate1350(value["id"])) && (!Object.hasOwn(value, "filename") || validate2(value["filename"])) && (!Object.hasOwn(value, "contentType") || validate2(value["contentType"])) && (!Object.hasOwn(value, "size") || validate15(value["size"]));
230
- const validate1350 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^att_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
231
- const validate1355 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "preview") && (!Object.hasOwn(value, "id") || validate1329(value["id"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "preview") || validate8(value["preview"]));
232
- const validate1363 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1364(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1366(value["data"]));
233
- const validate1364 = (value) => typeof value === "string" && value === "mailbox.message.sent";
234
- const validate1366 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "actionId") && Object.hasOwn(value, "actor") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1324(value["namespaceId"])) && (!Object.hasOwn(value, "actionId") || validate1371(value["actionId"])) && (!Object.hasOwn(value, "state") || validate1372(value["state"])) && (!Object.hasOwn(value, "acceptedAt") || validate2(value["acceptedAt"])) && (!Object.hasOwn(value, "actor") || validate1374(value["actor"])) && (!Object.hasOwn(value, "message") || validate1327(value["message"]));
235
- const validate1371 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
236
- const validate1372 = (value) => typeof value === "string" && value === "completed";
237
- const validate1374 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "kind") && Object.hasOwn(value, "id") && Object.hasOwn(value, "source") && (!Object.hasOwn(value, "kind") || validate1375(value["kind"])) && (!Object.hasOwn(value, "id") || validate2(value["id"])) && (!Object.hasOwn(value, "displayName") || validate8(value["displayName"])) && (!Object.hasOwn(value, "source") || validate1380(value["source"]));
238
- const validate1375 = (value) => typeof value === "string" && (value === "user" || value === "apiKey" || value === "extension" || value === "externalAgent" || value === "samvaAgent" || value === "system");
239
- const validate1380 = (value) => typeof value === "string" && (value === "humanUi" || value === "externalApi" || value === "externalAgent" || value === "extension" || value === "system");
240
- const validate1409 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1410(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1412(value["data"]));
241
- const validate1410 = (value) => typeof value === "string" && value === "mailbox.action.pending_approval";
242
- const validate1412 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "action") && Object.hasOwn(value, "draft") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1324(value["namespaceId"])) && (!Object.hasOwn(value, "action") || validate1417(value["action"])) && (!Object.hasOwn(value, "draft") || validate1447(value["draft"]));
243
- const validate1417 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "type") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "proposedBy") && Object.hasOwn(value, "createdAt") && (!Object.hasOwn(value, "id") || validate1371(value["id"])) && (!Object.hasOwn(value, "type") || validate1419(value["type"])) && (!Object.hasOwn(value, "state") || validate1420(value["state"])) && (!Object.hasOwn(value, "decision") || validate1421(value["decision"])) && (!Object.hasOwn(value, "threadId") || validate1433(value["threadId"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"])) && (!Object.hasOwn(value, "proposedBy") || validate1374(value["proposedBy"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"]));
244
- const validate1419 = (value) => typeof value === "string" && (value === "sendMessage" || value === "reply" || value === "updateDraft" || value === "createNote" || value === "assignThread" || value === "changeThreadState" || value === "call" || value === "extensionRequest");
245
- const validate1420 = (value) => typeof value === "string" && value === "approvalRequired";
246
- const validate1421 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "outcome") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "policyId") && Object.hasOwn(value, "source") && Object.hasOwn(value, "decidedAt") && (!Object.hasOwn(value, "outcome") || validate1422(value["outcome"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"])) && (!Object.hasOwn(value, "policyId") || validate1426(value["policyId"])) && (!Object.hasOwn(value, "source") || validate1429(value["source"])) && (!Object.hasOwn(value, "decidedAt") || validate2(value["decidedAt"]));
247
- const validate1422 = (value) => typeof value === "string" && (value === "allow" || value === "requireApproval" || value === "deny");
248
- const validate1426 = (value) => validate1427(value) || validate6(value);
249
- const validate1427 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^mbxpol_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
250
- const validate1429 = (value) => validate1430(value) || validate6(value);
251
- const validate1430 = (value) => typeof value === "string" && (value === "grant" || value === "installation" || value === "policy");
252
- const validate1433 = (value) => validate1329(value) || validate6(value);
253
- const validate1447 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "to") && Object.hasOwn(value, "cc") && Object.hasOwn(value, "subject") && (!Object.hasOwn(value, "to") || validate45(value["to"])) && (!Object.hasOwn(value, "cc") || validate45(value["cc"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"]));
254
- const validate1455 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1456(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1458(value["data"]));
255
- const validate1456 = (value) => typeof value === "string" && value === "mailbox.message.quarantined";
256
- const validate1458 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "disposition") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "source") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1324(value["namespaceId"])) && (!Object.hasOwn(value, "disposition") || validate1463(value["disposition"])) && (!Object.hasOwn(value, "reason") || validate1464(value["reason"])) && (!Object.hasOwn(value, "source") || validate1465(value["source"])) && (!Object.hasOwn(value, "message") || validate1466(value["message"]));
257
- const validate1463 = (value) => typeof value === "string" && (value === "quarantined" || value === "isolated");
258
- const validate1464 = (value) => typeof value === "string" && (value === "spam" || value === "dmarc" || value === "virus" || value === "virus_unscanned" || value === "phishing" || value === "fraud" || value === "prompt_injection");
259
- const validate1465 = (value) => typeof value === "string" && (value === "receipt" || value === "classifier");
260
- const validate1466 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "from") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "receivedAt") && (!Object.hasOwn(value, "id") || validate755(value["id"])) && (!Object.hasOwn(value, "from") || validate1330(value["from"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "receivedAt") || validate2(value["receivedAt"]));
261
- const validate1477 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1478(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1480(value["data"]));
262
- const validate1478 = (value) => typeof value === "string" && value === "mailbox.message.released";
263
- const validate1480 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "releasedBy") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "message") && Object.hasOwn(value, "thread") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1324(value["namespaceId"])) && (!Object.hasOwn(value, "releasedBy") || validate1374(value["releasedBy"])) && (!Object.hasOwn(value, "reason") || validate1464(value["reason"])) && (!Object.hasOwn(value, "message") || validate1327(value["message"])) && (!Object.hasOwn(value, "thread") || validate1355(value["thread"]));
264
- const validate1529 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1530(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1532(value["data"]));
265
- const validate1530 = (value) => typeof value === "string" && value === "mailbox.message.discarded";
266
- const validate1532 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "discardedBy") && Object.hasOwn(value, "disposition") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1324(value["namespaceId"])) && (!Object.hasOwn(value, "discardedBy") || validate1374(value["discardedBy"])) && (!Object.hasOwn(value, "disposition") || validate1463(value["disposition"])) && (!Object.hasOwn(value, "reason") || validate1464(value["reason"])) && (!Object.hasOwn(value, "message") || validate1466(value["message"]));
225
+ const validate1327 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "from") && Object.hasOwn(value, "to") && Object.hasOwn(value, "cc") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "text") && Object.hasOwn(value, "replyText") && Object.hasOwn(value, "attachments") && Object.hasOwn(value, "occurredAt") && (!Object.hasOwn(value, "id") || validate755(value["id"])) && (!Object.hasOwn(value, "channel") || validate1329(value["channel"])) && (!Object.hasOwn(value, "threadId") || validate1330(value["threadId"])) && (!Object.hasOwn(value, "from") || validate1331(value["from"])) && (!Object.hasOwn(value, "to") || validate45(value["to"])) && (!Object.hasOwn(value, "cc") || validate45(value["cc"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "text") || validate8(value["text"])) && (!Object.hasOwn(value, "replyText") || validate8(value["replyText"])) && (!Object.hasOwn(value, "attachments") || validate1349(value["attachments"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"]));
226
+ const validate1329 = (value) => typeof value === "string" && (value === "email" || value === "whatsapp" || value === "sms");
227
+ const validate1330 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^thread_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
228
+ const validate1331 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "address") && (!Object.hasOwn(value, "address") || validate2(value["address"])) && (!Object.hasOwn(value, "name") || validate8(value["name"]));
229
+ const validate1349 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate1350);
230
+ const validate1350 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "filename") && Object.hasOwn(value, "contentType") && Object.hasOwn(value, "size") && (!Object.hasOwn(value, "id") || validate1351(value["id"])) && (!Object.hasOwn(value, "filename") || validate2(value["filename"])) && (!Object.hasOwn(value, "contentType") || validate2(value["contentType"])) && (!Object.hasOwn(value, "size") || validate15(value["size"]));
231
+ const validate1351 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^att_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
232
+ const validate1356 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "preview") && (!Object.hasOwn(value, "id") || validate1330(value["id"])) && (!Object.hasOwn(value, "endpointId") || validate1358(value["endpointId"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "preview") || validate8(value["preview"]));
233
+ const validate1358 = (value) => validate1359(value) || validate6(value);
234
+ const validate1359 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^mbxep_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
235
+ const validate1367 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1368(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1370(value["data"]));
236
+ const validate1368 = (value) => typeof value === "string" && value === "mailbox.message.sent";
237
+ const validate1370 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "actionId") && Object.hasOwn(value, "actor") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1324(value["namespaceId"])) && (!Object.hasOwn(value, "actionId") || validate1375(value["actionId"])) && (!Object.hasOwn(value, "state") || validate1376(value["state"])) && (!Object.hasOwn(value, "acceptedAt") || validate2(value["acceptedAt"])) && (!Object.hasOwn(value, "actor") || validate1378(value["actor"])) && (!Object.hasOwn(value, "message") || validate1327(value["message"]));
238
+ const validate1375 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
239
+ const validate1376 = (value) => typeof value === "string" && value === "completed";
240
+ const validate1378 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "kind") && Object.hasOwn(value, "id") && Object.hasOwn(value, "source") && (!Object.hasOwn(value, "kind") || validate1379(value["kind"])) && (!Object.hasOwn(value, "id") || validate2(value["id"])) && (!Object.hasOwn(value, "displayName") || validate8(value["displayName"])) && (!Object.hasOwn(value, "source") || validate1384(value["source"]));
241
+ const validate1379 = (value) => typeof value === "string" && (value === "user" || value === "apiKey" || value === "extension" || value === "externalAgent" || value === "samvaAgent" || value === "system");
242
+ const validate1384 = (value) => typeof value === "string" && (value === "humanUi" || value === "externalApi" || value === "externalAgent" || value === "extension" || value === "system");
243
+ const validate1414 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1415(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1417(value["data"]));
244
+ const validate1415 = (value) => typeof value === "string" && value === "mailbox.action.pending_approval";
245
+ const validate1417 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "action") && Object.hasOwn(value, "draft") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1324(value["namespaceId"])) && (!Object.hasOwn(value, "action") || validate1422(value["action"])) && (!Object.hasOwn(value, "draft") || validate1452(value["draft"]));
246
+ const validate1422 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "type") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "proposedBy") && Object.hasOwn(value, "createdAt") && (!Object.hasOwn(value, "id") || validate1375(value["id"])) && (!Object.hasOwn(value, "type") || validate1424(value["type"])) && (!Object.hasOwn(value, "state") || validate1425(value["state"])) && (!Object.hasOwn(value, "decision") || validate1426(value["decision"])) && (!Object.hasOwn(value, "threadId") || validate1438(value["threadId"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"])) && (!Object.hasOwn(value, "proposedBy") || validate1378(value["proposedBy"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"]));
247
+ const validate1424 = (value) => typeof value === "string" && (value === "sendMessage" || value === "reply" || value === "updateDraft" || value === "createNote" || value === "assignThread" || value === "changeThreadState" || value === "call" || value === "extensionRequest");
248
+ const validate1425 = (value) => typeof value === "string" && value === "approvalRequired";
249
+ const validate1426 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "outcome") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "policyId") && Object.hasOwn(value, "source") && Object.hasOwn(value, "decidedAt") && (!Object.hasOwn(value, "outcome") || validate1427(value["outcome"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"])) && (!Object.hasOwn(value, "policyId") || validate1431(value["policyId"])) && (!Object.hasOwn(value, "source") || validate1434(value["source"])) && (!Object.hasOwn(value, "decidedAt") || validate2(value["decidedAt"]));
250
+ const validate1427 = (value) => typeof value === "string" && (value === "allow" || value === "requireApproval" || value === "deny");
251
+ const validate1431 = (value) => validate1432(value) || validate6(value);
252
+ const validate1432 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^mbxpol_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
253
+ const validate1434 = (value) => validate1435(value) || validate6(value);
254
+ const validate1435 = (value) => typeof value === "string" && (value === "grant" || value === "installation" || value === "policy");
255
+ const validate1438 = (value) => validate1330(value) || validate6(value);
256
+ const validate1452 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "to") && Object.hasOwn(value, "cc") && Object.hasOwn(value, "subject") && (!Object.hasOwn(value, "to") || validate45(value["to"])) && (!Object.hasOwn(value, "cc") || validate45(value["cc"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"]));
257
+ const validate1460 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1461(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1463(value["data"]));
258
+ const validate1461 = (value) => typeof value === "string" && value === "mailbox.message.quarantined";
259
+ const validate1463 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "disposition") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "source") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1324(value["namespaceId"])) && (!Object.hasOwn(value, "disposition") || validate1468(value["disposition"])) && (!Object.hasOwn(value, "reason") || validate1469(value["reason"])) && (!Object.hasOwn(value, "source") || validate1470(value["source"])) && (!Object.hasOwn(value, "message") || validate1471(value["message"]));
260
+ const validate1468 = (value) => typeof value === "string" && (value === "quarantined" || value === "isolated");
261
+ const validate1469 = (value) => typeof value === "string" && (value === "spam" || value === "dmarc" || value === "virus" || value === "virus_unscanned" || value === "phishing" || value === "fraud" || value === "prompt_injection");
262
+ const validate1470 = (value) => typeof value === "string" && (value === "receipt" || value === "classifier");
263
+ const validate1471 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "from") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "receivedAt") && (!Object.hasOwn(value, "id") || validate755(value["id"])) && (!Object.hasOwn(value, "from") || validate1331(value["from"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "receivedAt") || validate2(value["receivedAt"]));
264
+ const validate1482 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1483(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1485(value["data"]));
265
+ const validate1483 = (value) => typeof value === "string" && value === "mailbox.message.released";
266
+ const validate1485 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "releasedBy") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "message") && Object.hasOwn(value, "thread") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1324(value["namespaceId"])) && (!Object.hasOwn(value, "releasedBy") || validate1378(value["releasedBy"])) && (!Object.hasOwn(value, "reason") || validate1469(value["reason"])) && (!Object.hasOwn(value, "message") || validate1327(value["message"])) && (!Object.hasOwn(value, "thread") || validate1356(value["thread"]));
267
+ const validate1538 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1539(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1541(value["data"]));
268
+ const validate1539 = (value) => typeof value === "string" && value === "mailbox.message.discarded";
269
+ const validate1541 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "discardedBy") && Object.hasOwn(value, "disposition") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1324(value["namespaceId"])) && (!Object.hasOwn(value, "discardedBy") || validate1378(value["discardedBy"])) && (!Object.hasOwn(value, "disposition") || validate1468(value["disposition"])) && (!Object.hasOwn(value, "reason") || validate1469(value["reason"])) && (!Object.hasOwn(value, "message") || validate1471(value["message"]));
270
+ const validate1566 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1567(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1569(value["data"]));
271
+ const validate1567 = (value) => typeof value === "string" && value === "journey.webhook";
272
+ const validate1569 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "journeyId") && Object.hasOwn(value, "journeyVersion") && Object.hasOwn(value, "runId") && Object.hasOwn(value, "nodeId") && Object.hasOwn(value, "contact") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "organizationId") || validate821(value["organizationId"])) && (!Object.hasOwn(value, "journeyId") || validate1571(value["journeyId"])) && (!Object.hasOwn(value, "journeyVersion") || validate1228(value["journeyVersion"])) && (!Object.hasOwn(value, "runId") || validate1573(value["runId"])) && (!Object.hasOwn(value, "nodeId") || validate2(value["nodeId"])) && (!Object.hasOwn(value, "contact") || validate1575(value["contact"])) && (!Object.hasOwn(value, "data") || validate12(value["data"]));
273
+ const validate1571 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^jrny_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
274
+ const validate1573 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^jrun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
275
+ const validate1575 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "externalId") && Object.hasOwn(value, "email") && (!Object.hasOwn(value, "id") || validate920(value["id"])) && (!Object.hasOwn(value, "externalId") || validate8(value["externalId"])) && (!Object.hasOwn(value, "email") || validate8(value["email"]));
267
276
  /** Narrow an event to a structurally valid payload known to this package. */
268
277
  const isKnownEvent = (value) => {
269
278
  switch (value.type) {
@@ -293,11 +302,12 @@ const isKnownEvent = (value) => {
293
302
  case "domain.warming.updated": return validate1259(value);
294
303
  case "template.registration.updated": return validate1283(value);
295
304
  case "mailbox.message.received": return validate1319(value);
296
- case "mailbox.message.sent": return validate1363(value);
297
- case "mailbox.action.pending_approval": return validate1409(value);
298
- case "mailbox.message.quarantined": return validate1455(value);
299
- case "mailbox.message.released": return validate1477(value);
300
- case "mailbox.message.discarded": return validate1529(value);
305
+ case "mailbox.message.sent": return validate1367(value);
306
+ case "mailbox.action.pending_approval": return validate1414(value);
307
+ case "mailbox.message.quarantined": return validate1460(value);
308
+ case "mailbox.message.released": return validate1482(value);
309
+ case "mailbox.message.discarded": return validate1538(value);
310
+ case "journey.webhook": return validate1566(value);
301
311
  default: return false;
302
312
  }
303
313
  };
@@ -330,11 +340,12 @@ const validateEvent = (value) => {
330
340
  case "domain.warming.updated": return validate1259(value);
331
341
  case "template.registration.updated": return validate1283(value);
332
342
  case "mailbox.message.received": return validate1319(value);
333
- case "mailbox.message.sent": return validate1363(value);
334
- case "mailbox.action.pending_approval": return validate1409(value);
335
- case "mailbox.message.quarantined": return validate1455(value);
336
- case "mailbox.message.released": return validate1477(value);
337
- case "mailbox.message.discarded": return validate1529(value);
343
+ case "mailbox.message.sent": return validate1367(value);
344
+ case "mailbox.action.pending_approval": return validate1414(value);
345
+ case "mailbox.message.quarantined": return validate1460(value);
346
+ case "mailbox.message.released": return validate1482(value);
347
+ case "mailbox.message.discarded": return validate1538(value);
348
+ case "journey.webhook": return validate1566(value);
338
349
  default: return true;
339
350
  }
340
351
  };
@@ -665,4 +676,4 @@ const readWebhookHeaders = (headers) => requireHeaders({
665
676
  //#endregion
666
677
  export { WebhookTimestampError as _, encodeWebhookSignature as a, signWebhook as c, webhookSignedContent as d, InvalidWebhookHeadersError as f, WebhookSignatureError as g, WebhookCryptoError as h, WEBHOOK_TIMESTAMP_HEADER as i, verifyWebhookAt as l, MalformedWebhookPayloadError as m, WEBHOOK_ID_HEADER as n, generateWebhookSecret as o, InvalidWebhookSecretError as p, WEBHOOK_SIGNATURE_HEADER as r, readWebhookHeaders as s, DEFAULT_TOLERANCE_SECONDS as t, verifyWebhookAtWithPublicKeys as u, WebhookVerificationError as v, isKnownEvent as y };
667
678
 
668
- //# sourceMappingURL=protocol-DxerOUFO.js.map
679
+ //# sourceMappingURL=protocol-GkuvvobW.js.map
package/dist/protocol.js CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as WebhookTimestampError, a as encodeWebhookSignature, c as signWebhook, d as webhookSignedContent, f as InvalidWebhookHeadersError, g as WebhookSignatureError, h as WebhookCryptoError, i as WEBHOOK_TIMESTAMP_HEADER, l as verifyWebhookAt, m as MalformedWebhookPayloadError, n as WEBHOOK_ID_HEADER, o as generateWebhookSecret, p as InvalidWebhookSecretError, r as WEBHOOK_SIGNATURE_HEADER, s as readWebhookHeaders, t as DEFAULT_TOLERANCE_SECONDS, u as verifyWebhookAtWithPublicKeys, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-DxerOUFO.js";
1
+ import { _ as WebhookTimestampError, a as encodeWebhookSignature, c as signWebhook, d as webhookSignedContent, f as InvalidWebhookHeadersError, g as WebhookSignatureError, h as WebhookCryptoError, i as WEBHOOK_TIMESTAMP_HEADER, l as verifyWebhookAt, m as MalformedWebhookPayloadError, n as WEBHOOK_ID_HEADER, o as generateWebhookSecret, p as InvalidWebhookSecretError, r as WEBHOOK_SIGNATURE_HEADER, s as readWebhookHeaders, t as DEFAULT_TOLERANCE_SECONDS, u as verifyWebhookAtWithPublicKeys, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-GkuvvobW.js";
2
2
  export { DEFAULT_TOLERANCE_SECONDS, InvalidWebhookHeadersError, InvalidWebhookSecretError, MalformedWebhookPayloadError, WEBHOOK_ID_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WebhookCryptoError, WebhookSignatureError, WebhookTimestampError, WebhookVerificationError, encodeWebhookSignature, generateWebhookSecret, isKnownEvent, readWebhookHeaders, signWebhook, verifyWebhookAt, verifyWebhookAtWithPublicKeys, webhookSignedContent };
@@ -796,6 +796,7 @@ export declare const MailboxMessageReceivedEventSchema: Schema.StructWithRest<Sc
796
796
  readonly namespaceId: Schema.Union<readonly [Schema.String, Schema.Null]>;
797
797
  readonly message: Schema.StructWithRest<Schema.Struct<{
798
798
  readonly id: Schema.String;
799
+ readonly channel: Schema.optionalKey<Schema.Literals<readonly ["email", "whatsapp", "sms"]>>;
799
800
  readonly threadId: Schema.String;
800
801
  readonly from: Schema.StructWithRest<Schema.Struct<{
801
802
  readonly address: Schema.String;
@@ -816,6 +817,7 @@ export declare const MailboxMessageReceivedEventSchema: Schema.StructWithRest<Sc
816
817
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
817
818
  readonly thread: Schema.StructWithRest<Schema.Struct<{
818
819
  readonly id: Schema.String;
820
+ readonly endpointId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
819
821
  readonly subject: Schema.Union<readonly [Schema.String, Schema.Null]>;
820
822
  readonly preview: Schema.Union<readonly [Schema.String, Schema.Null]>;
821
823
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
@@ -838,6 +840,7 @@ export declare const MailboxMessageSentEventSchema: Schema.StructWithRest<Schema
838
840
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
839
841
  readonly message: Schema.StructWithRest<Schema.Struct<{
840
842
  readonly id: Schema.String;
843
+ readonly channel: Schema.optionalKey<Schema.Literals<readonly ["email", "whatsapp", "sms"]>>;
841
844
  readonly threadId: Schema.String;
842
845
  readonly from: Schema.StructWithRest<Schema.Struct<{
843
846
  readonly address: Schema.String;
@@ -927,6 +930,7 @@ export declare const MailboxMessageReleasedEventSchema: Schema.StructWithRest<Sc
927
930
  readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "phishing", "fraud", "prompt_injection"]>;
928
931
  readonly message: Schema.StructWithRest<Schema.Struct<{
929
932
  readonly id: Schema.String;
933
+ readonly channel: Schema.optionalKey<Schema.Literals<readonly ["email", "whatsapp", "sms"]>>;
930
934
  readonly threadId: Schema.String;
931
935
  readonly from: Schema.StructWithRest<Schema.Struct<{
932
936
  readonly address: Schema.String;
@@ -947,6 +951,7 @@ export declare const MailboxMessageReleasedEventSchema: Schema.StructWithRest<Sc
947
951
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
948
952
  readonly thread: Schema.StructWithRest<Schema.Struct<{
949
953
  readonly id: Schema.String;
954
+ readonly endpointId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
950
955
  readonly subject: Schema.Union<readonly [Schema.String, Schema.Null]>;
951
956
  readonly preview: Schema.Union<readonly [Schema.String, Schema.Null]>;
952
957
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
@@ -977,6 +982,23 @@ export declare const MailboxMessageDiscardedEventSchema: Schema.StructWithRest<S
977
982
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
978
983
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
979
984
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
985
+ export declare const JourneyWebhookEventSchema: Schema.StructWithRest<Schema.Struct<{
986
+ readonly type: Schema.Literal<"journey.webhook">;
987
+ readonly timestamp: Schema.String;
988
+ readonly data: Schema.StructWithRest<Schema.Struct<{
989
+ readonly organizationId: Schema.String;
990
+ readonly journeyId: Schema.String;
991
+ readonly journeyVersion: Schema.Finite;
992
+ readonly runId: Schema.String;
993
+ readonly nodeId: Schema.String;
994
+ readonly contact: Schema.StructWithRest<Schema.Struct<{
995
+ readonly id: Schema.String;
996
+ readonly externalId: Schema.Union<readonly [Schema.String, Schema.Null]>;
997
+ readonly email: Schema.Union<readonly [Schema.String, Schema.Null]>;
998
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
999
+ readonly data: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1000
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
1001
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
980
1002
  export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
981
1003
  readonly type: Schema.Literal<"message.sent">;
982
1004
  readonly timestamp: Schema.String;
@@ -1749,6 +1771,7 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
1749
1771
  readonly namespaceId: Schema.Union<readonly [Schema.String, Schema.Null]>;
1750
1772
  readonly message: Schema.StructWithRest<Schema.Struct<{
1751
1773
  readonly id: Schema.String;
1774
+ readonly channel: Schema.optionalKey<Schema.Literals<readonly ["email", "whatsapp", "sms"]>>;
1752
1775
  readonly threadId: Schema.String;
1753
1776
  readonly from: Schema.StructWithRest<Schema.Struct<{
1754
1777
  readonly address: Schema.String;
@@ -1769,6 +1792,7 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
1769
1792
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
1770
1793
  readonly thread: Schema.StructWithRest<Schema.Struct<{
1771
1794
  readonly id: Schema.String;
1795
+ readonly endpointId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1772
1796
  readonly subject: Schema.Union<readonly [Schema.String, Schema.Null]>;
1773
1797
  readonly preview: Schema.Union<readonly [Schema.String, Schema.Null]>;
1774
1798
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
@@ -1790,6 +1814,7 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
1790
1814
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
1791
1815
  readonly message: Schema.StructWithRest<Schema.Struct<{
1792
1816
  readonly id: Schema.String;
1817
+ readonly channel: Schema.optionalKey<Schema.Literals<readonly ["email", "whatsapp", "sms"]>>;
1793
1818
  readonly threadId: Schema.String;
1794
1819
  readonly from: Schema.StructWithRest<Schema.Struct<{
1795
1820
  readonly address: Schema.String;
@@ -1876,6 +1901,7 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
1876
1901
  readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "phishing", "fraud", "prompt_injection"]>;
1877
1902
  readonly message: Schema.StructWithRest<Schema.Struct<{
1878
1903
  readonly id: Schema.String;
1904
+ readonly channel: Schema.optionalKey<Schema.Literals<readonly ["email", "whatsapp", "sms"]>>;
1879
1905
  readonly threadId: Schema.String;
1880
1906
  readonly from: Schema.StructWithRest<Schema.Struct<{
1881
1907
  readonly address: Schema.String;
@@ -1896,6 +1922,7 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
1896
1922
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
1897
1923
  readonly thread: Schema.StructWithRest<Schema.Struct<{
1898
1924
  readonly id: Schema.String;
1925
+ readonly endpointId: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1899
1926
  readonly subject: Schema.Union<readonly [Schema.String, Schema.Null]>;
1900
1927
  readonly preview: Schema.Union<readonly [Schema.String, Schema.Null]>;
1901
1928
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
@@ -1924,4 +1951,20 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
1924
1951
  readonly receivedAt: Schema.String;
1925
1952
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
1926
1953
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
1954
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>, Schema.StructWithRest<Schema.Struct<{
1955
+ readonly type: Schema.Literal<"journey.webhook">;
1956
+ readonly timestamp: Schema.String;
1957
+ readonly data: Schema.StructWithRest<Schema.Struct<{
1958
+ readonly organizationId: Schema.String;
1959
+ readonly journeyId: Schema.String;
1960
+ readonly journeyVersion: Schema.Finite;
1961
+ readonly runId: Schema.String;
1962
+ readonly nodeId: Schema.String;
1963
+ readonly contact: Schema.StructWithRest<Schema.Struct<{
1964
+ readonly id: Schema.String;
1965
+ readonly externalId: Schema.Union<readonly [Schema.String, Schema.Null]>;
1966
+ readonly email: Schema.Union<readonly [Schema.String, Schema.Null]>;
1967
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
1968
+ readonly data: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
1969
+ }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
1927
1970
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>]>;
@@ -1288,6 +1288,14 @@ const MailboxMessageReceivedEventSchema = Schema.StructWithRest(Schema.Struct({
1288
1288
  expected: "a string matching the RegExp ^msg_[0-9a-hjkmnp-tv-z]{16,24}$",
1289
1289
  identifier: "MessageId"
1290
1290
  })),
1291
+ channel: Schema.optionalKey(Schema.Literals([
1292
+ "email",
1293
+ "whatsapp",
1294
+ "sms"
1295
+ ]).annotate({
1296
+ description: "Deliveries recorded before this field existed omit it; they are email.",
1297
+ identifier: "MailboxChannel"
1298
+ })),
1291
1299
  threadId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^thread_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1292
1300
  expected: "a string matching the RegExp ^thread_[0-9a-hjkmnp-tv-z]{16,24}$",
1293
1301
  identifier: "MailboxThreadId"
@@ -1317,6 +1325,10 @@ const MailboxMessageReceivedEventSchema = Schema.StructWithRest(Schema.Struct({
1317
1325
  expected: "a string matching the RegExp ^thread_[0-9a-hjkmnp-tv-z]{16,24}$",
1318
1326
  identifier: "MailboxThreadId"
1319
1327
  })),
1328
+ endpointId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^mbxep_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1329
+ expected: "a string matching the RegExp ^mbxep_[0-9a-hjkmnp-tv-z]{16,24}$",
1330
+ identifier: "MailboxEndpointId"
1331
+ })), Schema.Null]).annotate({ description: "The endpoint the message arrived at; null once it is removed. Deliveries recorded before this field existed omit it." })),
1320
1332
  subject: Schema.Union([Schema.String, Schema.Null]),
1321
1333
  preview: Schema.Union([Schema.String, Schema.Null])
1322
1334
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))])
@@ -1364,6 +1376,14 @@ const MailboxMessageSentEventSchema = Schema.StructWithRest(Schema.Struct({
1364
1376
  expected: "a string matching the RegExp ^msg_[0-9a-hjkmnp-tv-z]{16,24}$",
1365
1377
  identifier: "MessageId"
1366
1378
  })),
1379
+ channel: Schema.optionalKey(Schema.Literals([
1380
+ "email",
1381
+ "whatsapp",
1382
+ "sms"
1383
+ ]).annotate({
1384
+ description: "Deliveries recorded before this field existed omit it; they are email.",
1385
+ identifier: "MailboxChannel"
1386
+ })),
1367
1387
  threadId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^thread_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1368
1388
  expected: "a string matching the RegExp ^thread_[0-9a-hjkmnp-tv-z]{16,24}$",
1369
1389
  identifier: "MailboxThreadId"
@@ -1554,6 +1574,14 @@ const MailboxMessageReleasedEventSchema = Schema.StructWithRest(Schema.Struct({
1554
1574
  expected: "a string matching the RegExp ^msg_[0-9a-hjkmnp-tv-z]{16,24}$",
1555
1575
  identifier: "MessageId"
1556
1576
  })),
1577
+ channel: Schema.optionalKey(Schema.Literals([
1578
+ "email",
1579
+ "whatsapp",
1580
+ "sms"
1581
+ ]).annotate({
1582
+ description: "Deliveries recorded before this field existed omit it; they are email.",
1583
+ identifier: "MailboxChannel"
1584
+ })),
1557
1585
  threadId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^thread_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1558
1586
  expected: "a string matching the RegExp ^thread_[0-9a-hjkmnp-tv-z]{16,24}$",
1559
1587
  identifier: "MailboxThreadId"
@@ -1583,6 +1611,10 @@ const MailboxMessageReleasedEventSchema = Schema.StructWithRest(Schema.Struct({
1583
1611
  expected: "a string matching the RegExp ^thread_[0-9a-hjkmnp-tv-z]{16,24}$",
1584
1612
  identifier: "MailboxThreadId"
1585
1613
  })),
1614
+ endpointId: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^mbxep_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1615
+ expected: "a string matching the RegExp ^mbxep_[0-9a-hjkmnp-tv-z]{16,24}$",
1616
+ identifier: "MailboxEndpointId"
1617
+ })), Schema.Null]).annotate({ description: "The endpoint the message arrived at; null once it is removed. Deliveries recorded before this field existed omit it." })),
1586
1618
  subject: Schema.Union([Schema.String, Schema.Null]),
1587
1619
  preview: Schema.Union([Schema.String, Schema.Null])
1588
1620
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))])
@@ -1643,6 +1675,35 @@ const MailboxMessageDiscardedEventSchema = Schema.StructWithRest(Schema.Struct({
1643
1675
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))])
1644
1676
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))])
1645
1677
  }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]);
1678
+ const JourneyWebhookEventSchema = Schema.StructWithRest(Schema.Struct({
1679
+ type: Schema.Literal("journey.webhook"),
1680
+ timestamp: Schema.String,
1681
+ data: Schema.StructWithRest(Schema.Struct({
1682
+ organizationId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^org_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1683
+ expected: "a string matching the RegExp ^org_[0-9a-hjkmnp-tv-z]{16,24}$",
1684
+ identifier: "OrganizationId"
1685
+ })),
1686
+ journeyId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^jrny_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1687
+ expected: "a string matching the RegExp ^jrny_[0-9a-hjkmnp-tv-z]{16,24}$",
1688
+ identifier: "JourneyId"
1689
+ })),
1690
+ journeyVersion: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })),
1691
+ runId: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^jrun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1692
+ expected: "a string matching the RegExp ^jrun_[0-9a-hjkmnp-tv-z]{16,24}$",
1693
+ identifier: "JourneyRunId"
1694
+ })),
1695
+ nodeId: Schema.String,
1696
+ contact: Schema.StructWithRest(Schema.Struct({
1697
+ id: Schema.String.check(Schema.isPattern(/* @__PURE__ */ new RegExp("^contact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
1698
+ expected: "a string matching the RegExp ^contact_[0-9a-hjkmnp-tv-z]{16,24}$",
1699
+ identifier: "ContactId"
1700
+ })),
1701
+ externalId: Schema.Union([Schema.String, Schema.Null]),
1702
+ email: Schema.Union([Schema.String, Schema.Null])
1703
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]),
1704
+ data: Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" })).annotate({ identifier: "JsonObject" })
1705
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))])
1706
+ }), [Schema.Record(Schema.String, Schema.Json.annotate({ expected: "JSON value" }))]);
1646
1707
  const SamvaWebhookEventSchema = Schema.Union([
1647
1708
  MessageSentEventSchema,
1648
1709
  MessageDeliveredEventSchema,
@@ -1674,9 +1735,10 @@ const SamvaWebhookEventSchema = Schema.Union([
1674
1735
  MailboxActionPendingApprovalEventSchema,
1675
1736
  MailboxMessageQuarantinedEventSchema,
1676
1737
  MailboxMessageReleasedEventSchema,
1677
- MailboxMessageDiscardedEventSchema
1738
+ MailboxMessageDiscardedEventSchema,
1739
+ JourneyWebhookEventSchema
1678
1740
  ]);
1679
1741
  //#endregion
1680
- export { ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, MailboxActionPendingApprovalEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageReleasedEventSchema, MailboxMessageSentEventSchema, MessageBouncedEventSchema, MessageClickedEventSchema, MessageComplainedEventSchema, MessageDeliveredEventSchema, MessageFailedEventSchema, MessageOpenedEventSchema, MessageReadEventSchema, MessageReceivedEventSchema, MessageSentEventSchema, SamvaWebhookEventSchema, TemplateRegistrationUpdatedEventSchema, WebhookCreatedEventSchema, WebhookDeletedEventSchema, WebhookTestEventSchema, WebhookUpdatedEventSchema };
1742
+ export { ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageReleasedEventSchema, MailboxMessageSentEventSchema, MessageBouncedEventSchema, MessageClickedEventSchema, MessageComplainedEventSchema, MessageDeliveredEventSchema, MessageFailedEventSchema, MessageOpenedEventSchema, MessageReadEventSchema, MessageReceivedEventSchema, MessageSentEventSchema, SamvaWebhookEventSchema, TemplateRegistrationUpdatedEventSchema, WebhookCreatedEventSchema, WebhookDeletedEventSchema, WebhookTestEventSchema, WebhookUpdatedEventSchema };
1681
1743
 
1682
1744
  //# sourceMappingURL=schemas.gen.js.map
@@ -1049,6 +1049,7 @@ export type MailboxMessageReceivedEvent = {
1049
1049
  readonly namespaceId: string | null;
1050
1050
  readonly message: {
1051
1051
  readonly id: string;
1052
+ readonly channel?: "email" | "whatsapp" | "sms";
1052
1053
  readonly threadId: string;
1053
1054
  readonly from: {
1054
1055
  readonly address: string;
@@ -1075,6 +1076,7 @@ export type MailboxMessageReceivedEvent = {
1075
1076
  };
1076
1077
  readonly thread: {
1077
1078
  readonly id: string;
1079
+ readonly endpointId?: string | null;
1078
1080
  readonly subject: string | null;
1079
1081
  readonly preview: string | null;
1080
1082
  } & {
@@ -1106,6 +1108,7 @@ export type MailboxMessageSentEvent = {
1106
1108
  };
1107
1109
  readonly message: {
1108
1110
  readonly id: string;
1111
+ readonly channel?: "email" | "whatsapp" | "sms";
1109
1112
  readonly threadId: string;
1110
1113
  readonly from: {
1111
1114
  readonly address: string;
@@ -1230,6 +1233,7 @@ export type MailboxMessageReleasedEvent = {
1230
1233
  readonly reason: "spam" | "dmarc" | "virus" | "virus_unscanned" | "phishing" | "fraud" | "prompt_injection";
1231
1234
  readonly message: {
1232
1235
  readonly id: string;
1236
+ readonly channel?: "email" | "whatsapp" | "sms";
1233
1237
  readonly threadId: string;
1234
1238
  readonly from: {
1235
1239
  readonly address: string;
@@ -1256,6 +1260,7 @@ export type MailboxMessageReleasedEvent = {
1256
1260
  };
1257
1261
  readonly thread: {
1258
1262
  readonly id: string;
1263
+ readonly endpointId?: string | null;
1259
1264
  readonly subject: string | null;
1260
1265
  readonly preview: string | null;
1261
1266
  } & {
@@ -1304,7 +1309,33 @@ export type MailboxMessageDiscardedEvent = {
1304
1309
  readonly [x: string]: JsonValue;
1305
1310
  };
1306
1311
  export type MailboxMessageDiscardedPayload = MailboxMessageDiscardedEvent["data"];
1307
- export type SamvaWebhookEvent = MessageSentEvent | MessageDeliveredEvent | MessageReadEvent | MessageFailedEvent | MessageBouncedEvent | MessageComplainedEvent | MessageReceivedEvent | MessageOpenedEvent | MessageClickedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | ContactSubscribedEvent | ContactUnsubscribedEvent | ContactResubscribedEvent | ConversationCreatedEvent | ConversationUpdatedEvent | ConversationArchivedEvent | WebhookCreatedEvent | WebhookUpdatedEvent | WebhookDeletedEvent | WebhookTestEvent | DomainUpdatedEvent | DomainWarmingUpdatedEvent | TemplateRegistrationUpdatedEvent | MailboxMessageReceivedEvent | MailboxMessageSentEvent | MailboxActionPendingApprovalEvent | MailboxMessageQuarantinedEvent | MailboxMessageReleasedEvent | MailboxMessageDiscardedEvent;
1312
+ export type JourneyWebhookEvent = {
1313
+ readonly type: "journey.webhook";
1314
+ readonly timestamp: string;
1315
+ readonly data: {
1316
+ readonly organizationId: string;
1317
+ readonly journeyId: string;
1318
+ readonly journeyVersion: number;
1319
+ readonly runId: string;
1320
+ readonly nodeId: string;
1321
+ readonly contact: {
1322
+ readonly id: string;
1323
+ readonly externalId: string | null;
1324
+ readonly email: string | null;
1325
+ } & {
1326
+ readonly [x: string]: JsonValue;
1327
+ };
1328
+ readonly data: {
1329
+ readonly [x: string]: JsonValue;
1330
+ };
1331
+ } & {
1332
+ readonly [x: string]: JsonValue;
1333
+ };
1334
+ } & {
1335
+ readonly [x: string]: JsonValue;
1336
+ };
1337
+ export type JourneyWebhookPayload = JourneyWebhookEvent["data"];
1338
+ export type SamvaWebhookEvent = MessageSentEvent | MessageDeliveredEvent | MessageReadEvent | MessageFailedEvent | MessageBouncedEvent | MessageComplainedEvent | MessageReceivedEvent | MessageOpenedEvent | MessageClickedEvent | ContactCreatedEvent | ContactUpdatedEvent | ContactDeletedEvent | ContactSubscribedEvent | ContactUnsubscribedEvent | ContactResubscribedEvent | ConversationCreatedEvent | ConversationUpdatedEvent | ConversationArchivedEvent | WebhookCreatedEvent | WebhookUpdatedEvent | WebhookDeletedEvent | WebhookTestEvent | DomainUpdatedEvent | DomainWarmingUpdatedEvent | TemplateRegistrationUpdatedEvent | MailboxMessageReceivedEvent | MailboxMessageSentEvent | MailboxActionPendingApprovalEvent | MailboxMessageQuarantinedEvent | MailboxMessageReleasedEvent | MailboxMessageDiscardedEvent | JourneyWebhookEvent;
1308
1339
  export interface UnknownWebhookEvent {
1309
1340
  readonly type: string;
1310
1341
  readonly timestamp: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samva/webhooks",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Runtime-neutral verification for Samva webhook deliveries",
5
5
  "keywords": [
6
6
  "samva",