@samva/webhooks 0.23.1 → 0.25.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-BshlNyvg.js";
2
- import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-CaL1pRff.js";
3
- import { ContactConsentChangedEventSchema, ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, FlowRegistrationUpdatedEventSchema, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxActionResolvedEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageReleasedEventSchema, MailboxMessageSentEventSchema, MessageBouncedEventSchema, MessageClickedEventSchema, MessageComplainedEventSchema, MessageDeliveredEventSchema, MessageFailedEventSchema, MessageOpenedEventSchema, MessageReadEventSchema, MessageReceivedEventSchema, MessageSentEventSchema, SamvaWebhookEventSchema, TemplateRegistrationUpdatedEventSchema, WebhookCreatedEventSchema, WebhookDeletedEventSchema, WebhookTestEventSchema, WebhookUpdatedEventSchema, WhatsappNumberConnectedEventSchema } 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-DcQIkEck.js";
2
+ import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-Cfvr6mQA.js";
3
+ import { ContactConsentChangedEventSchema, ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, FlowRegistrationUpdatedEventSchema, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxActionResolvedEventSchema, MailboxMessageDeliveredEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageFailedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReadEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageReleasedEventSchema, MailboxMessageSentEventSchema, MessageBouncedEventSchema, MessageClickedEventSchema, MessageComplainedEventSchema, MessageDeliveredEventSchema, MessageFailedEventSchema, MessageOpenedEventSchema, MessageReadEventSchema, MessageReceivedEventSchema, MessageSentEventSchema, SamvaWebhookEventSchema, TemplateRegistrationUpdatedEventSchema, WebhookCreatedEventSchema, WebhookDeletedEventSchema, WebhookTestEventSchema, WebhookUpdatedEventSchema, WhatsappNumberConnectedEventSchema } 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 { ContactConsentChangedEventSchema, ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DEFAULT_TOLERANCE_SECONDS, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, FlowRegistrationUpdatedEventSchema, InvalidWebhookHeadersError, InvalidWebhookSecretError, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxActionResolvedEventSchema, 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, WhatsappNumberConnectedEventSchema, generateWebhookSecret, isKnownEvent, signWebhook, verify, verifyRequest };
78
+ export { ContactConsentChangedEventSchema, ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DEFAULT_TOLERANCE_SECONDS, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, FlowRegistrationUpdatedEventSchema, InvalidWebhookHeadersError, InvalidWebhookSecretError, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxActionResolvedEventSchema, MailboxMessageDeliveredEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageFailedEventSchema, MailboxMessageQuarantinedEventSchema, MailboxMessageReadEventSchema, 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, WhatsappNumberConnectedEventSchema, generateWebhookSecret, isKnownEvent, signWebhook, verify, verifyRequest };
79
79
 
80
80
  //# sourceMappingURL=effect.js.map
@@ -3232,6 +3232,7 @@ const WebhookEventJsonSchemas = {
3232
3232
  "externalApi",
3233
3233
  "externalAgent",
3234
3234
  "extension",
3235
+ "samvaManagedAgent",
3235
3236
  "system"
3236
3237
  ]
3237
3238
  }
@@ -3375,7 +3376,8 @@ const WebhookEventJsonSchemas = {
3375
3376
  "assignThread",
3376
3377
  "changeThreadState",
3377
3378
  "call",
3378
- "extensionRequest"
3379
+ "extensionRequest",
3380
+ "toolCall"
3379
3381
  ]
3380
3382
  },
3381
3383
  state: {
@@ -3447,6 +3449,7 @@ const WebhookEventJsonSchemas = {
3447
3449
  "externalApi",
3448
3450
  "externalAgent",
3449
3451
  "extension",
3452
+ "samvaManagedAgent",
3450
3453
  "system"
3451
3454
  ]
3452
3455
  }
@@ -3471,24 +3474,51 @@ const WebhookEventJsonSchemas = {
3471
3474
  additionalProperties: true
3472
3475
  },
3473
3476
  draft: {
3474
- type: "object",
3475
- properties: {
3476
- to: {
3477
- type: "array",
3478
- items: { type: "string" }
3477
+ anyOf: [{
3478
+ type: "object",
3479
+ properties: {
3480
+ to: {
3481
+ type: "array",
3482
+ items: { type: "string" }
3483
+ },
3484
+ cc: {
3485
+ type: "array",
3486
+ items: { type: "string" }
3487
+ },
3488
+ subject: { anyOf: [{ type: "string" }, { type: "null" }] }
3479
3489
  },
3480
- cc: {
3481
- type: "array",
3482
- items: { type: "string" }
3490
+ required: [
3491
+ "to",
3492
+ "cc",
3493
+ "subject"
3494
+ ],
3495
+ additionalProperties: true
3496
+ }, { type: "null" }],
3497
+ description: "Who a held send goes to; null for a held tool call."
3498
+ },
3499
+ tool: {
3500
+ anyOf: [{
3501
+ type: "object",
3502
+ properties: {
3503
+ name: {
3504
+ type: "string",
3505
+ minLength: 1,
3506
+ maxLength: 128
3507
+ },
3508
+ argumentsHash: {
3509
+ type: "string",
3510
+ pattern: "^[0-9a-f]{64}$"
3511
+ },
3512
+ arguments: { type: "object" }
3483
3513
  },
3484
- subject: { anyOf: [{ type: "string" }, { type: "null" }] }
3485
- },
3486
- required: [
3487
- "to",
3488
- "cc",
3489
- "subject"
3490
- ],
3491
- additionalProperties: true
3514
+ required: [
3515
+ "name",
3516
+ "argumentsHash",
3517
+ "arguments"
3518
+ ],
3519
+ additionalProperties: true
3520
+ }, { type: "null" }],
3521
+ description: "The tool a held tool call runs and its arguments; null for a held send. Deliveries recorded before this field existed omit it."
3492
3522
  }
3493
3523
  },
3494
3524
  required: [
@@ -3543,7 +3573,8 @@ const WebhookEventJsonSchemas = {
3543
3573
  "assignThread",
3544
3574
  "changeThreadState",
3545
3575
  "call",
3546
- "extensionRequest"
3576
+ "extensionRequest",
3577
+ "toolCall"
3547
3578
  ]
3548
3579
  },
3549
3580
  threadId: { anyOf: [{
@@ -3573,6 +3604,7 @@ const WebhookEventJsonSchemas = {
3573
3604
  "externalApi",
3574
3605
  "externalAgent",
3575
3606
  "extension",
3607
+ "samvaManagedAgent",
3576
3608
  "system"
3577
3609
  ]
3578
3610
  }
@@ -3629,6 +3661,7 @@ const WebhookEventJsonSchemas = {
3629
3661
  "externalApi",
3630
3662
  "externalAgent",
3631
3663
  "extension",
3664
+ "samvaManagedAgent",
3632
3665
  "system"
3633
3666
  ]
3634
3667
  }
@@ -3800,6 +3833,7 @@ const WebhookEventJsonSchemas = {
3800
3833
  "externalApi",
3801
3834
  "externalAgent",
3802
3835
  "extension",
3836
+ "samvaManagedAgent",
3803
3837
  "system"
3804
3838
  ]
3805
3839
  }
@@ -3986,6 +4020,7 @@ const WebhookEventJsonSchemas = {
3986
4020
  "externalApi",
3987
4021
  "externalAgent",
3988
4022
  "extension",
4023
+ "samvaManagedAgent",
3989
4024
  "system"
3990
4025
  ]
3991
4026
  }
@@ -4059,6 +4094,232 @@ const WebhookEventJsonSchemas = {
4059
4094
  ],
4060
4095
  additionalProperties: true
4061
4096
  },
4097
+ "mailbox.message.delivered": {
4098
+ type: "object",
4099
+ properties: {
4100
+ type: {
4101
+ type: "string",
4102
+ enum: ["mailbox.message.delivered"]
4103
+ },
4104
+ timestamp: { type: "string" },
4105
+ data: {
4106
+ type: "object",
4107
+ properties: {
4108
+ mailboxId: {
4109
+ type: "string",
4110
+ pattern: "^mbx_[0-9a-hjkmnp-tv-z]{16,24}$"
4111
+ },
4112
+ namespaceId: { anyOf: [{
4113
+ type: "string",
4114
+ pattern: "^ns_[0-9a-hjkmnp-tv-z]{16,24}$"
4115
+ }, { type: "null" }] },
4116
+ threadId: {
4117
+ type: "string",
4118
+ pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$"
4119
+ },
4120
+ actionId: {
4121
+ type: "string",
4122
+ pattern: "^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$",
4123
+ description: "The mailbox send action that sent the message."
4124
+ },
4125
+ messageId: {
4126
+ type: "string",
4127
+ pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
4128
+ },
4129
+ channel: {
4130
+ type: "string",
4131
+ enum: [
4132
+ "email",
4133
+ "whatsapp",
4134
+ "sms"
4135
+ ],
4136
+ description: "The channel an endpoint, thread, or message belongs to."
4137
+ },
4138
+ recipient: {
4139
+ type: "string",
4140
+ description: "The address or number the status is about."
4141
+ },
4142
+ occurredAt: { type: "string" },
4143
+ status: {
4144
+ type: "string",
4145
+ enum: ["delivered"]
4146
+ }
4147
+ },
4148
+ required: [
4149
+ "mailboxId",
4150
+ "namespaceId",
4151
+ "threadId",
4152
+ "actionId",
4153
+ "messageId",
4154
+ "channel",
4155
+ "recipient",
4156
+ "occurredAt",
4157
+ "status"
4158
+ ],
4159
+ additionalProperties: true
4160
+ }
4161
+ },
4162
+ required: [
4163
+ "type",
4164
+ "timestamp",
4165
+ "data"
4166
+ ],
4167
+ additionalProperties: true
4168
+ },
4169
+ "mailbox.message.read": {
4170
+ type: "object",
4171
+ properties: {
4172
+ type: {
4173
+ type: "string",
4174
+ enum: ["mailbox.message.read"]
4175
+ },
4176
+ timestamp: { type: "string" },
4177
+ data: {
4178
+ type: "object",
4179
+ properties: {
4180
+ mailboxId: {
4181
+ type: "string",
4182
+ pattern: "^mbx_[0-9a-hjkmnp-tv-z]{16,24}$"
4183
+ },
4184
+ namespaceId: { anyOf: [{
4185
+ type: "string",
4186
+ pattern: "^ns_[0-9a-hjkmnp-tv-z]{16,24}$"
4187
+ }, { type: "null" }] },
4188
+ threadId: {
4189
+ type: "string",
4190
+ pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$"
4191
+ },
4192
+ actionId: {
4193
+ type: "string",
4194
+ pattern: "^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$",
4195
+ description: "The mailbox send action that sent the message."
4196
+ },
4197
+ messageId: {
4198
+ type: "string",
4199
+ pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
4200
+ },
4201
+ channel: {
4202
+ type: "string",
4203
+ enum: [
4204
+ "email",
4205
+ "whatsapp",
4206
+ "sms"
4207
+ ],
4208
+ description: "The channel an endpoint, thread, or message belongs to."
4209
+ },
4210
+ recipient: {
4211
+ type: "string",
4212
+ description: "The address or number the status is about."
4213
+ },
4214
+ occurredAt: { type: "string" },
4215
+ status: {
4216
+ type: "string",
4217
+ enum: ["read"]
4218
+ }
4219
+ },
4220
+ required: [
4221
+ "mailboxId",
4222
+ "namespaceId",
4223
+ "threadId",
4224
+ "actionId",
4225
+ "messageId",
4226
+ "channel",
4227
+ "recipient",
4228
+ "occurredAt",
4229
+ "status"
4230
+ ],
4231
+ additionalProperties: true
4232
+ }
4233
+ },
4234
+ required: [
4235
+ "type",
4236
+ "timestamp",
4237
+ "data"
4238
+ ],
4239
+ additionalProperties: true
4240
+ },
4241
+ "mailbox.message.failed": {
4242
+ type: "object",
4243
+ properties: {
4244
+ type: {
4245
+ type: "string",
4246
+ enum: ["mailbox.message.failed"]
4247
+ },
4248
+ timestamp: { type: "string" },
4249
+ data: {
4250
+ type: "object",
4251
+ properties: {
4252
+ mailboxId: {
4253
+ type: "string",
4254
+ pattern: "^mbx_[0-9a-hjkmnp-tv-z]{16,24}$"
4255
+ },
4256
+ namespaceId: { anyOf: [{
4257
+ type: "string",
4258
+ pattern: "^ns_[0-9a-hjkmnp-tv-z]{16,24}$"
4259
+ }, { type: "null" }] },
4260
+ threadId: {
4261
+ type: "string",
4262
+ pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$"
4263
+ },
4264
+ actionId: {
4265
+ type: "string",
4266
+ pattern: "^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$",
4267
+ description: "The mailbox send action that sent the message."
4268
+ },
4269
+ messageId: {
4270
+ type: "string",
4271
+ pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
4272
+ },
4273
+ channel: {
4274
+ type: "string",
4275
+ enum: [
4276
+ "email",
4277
+ "whatsapp",
4278
+ "sms"
4279
+ ],
4280
+ description: "The channel an endpoint, thread, or message belongs to."
4281
+ },
4282
+ recipient: {
4283
+ type: "string",
4284
+ description: "The address or number the status is about."
4285
+ },
4286
+ occurredAt: { type: "string" },
4287
+ status: {
4288
+ type: "string",
4289
+ enum: ["failed"]
4290
+ },
4291
+ error: {
4292
+ type: "object",
4293
+ properties: {
4294
+ code: { anyOf: [{ type: "string" }, { type: "null" }] },
4295
+ message: { anyOf: [{ type: "string" }, { type: "null" }] }
4296
+ },
4297
+ required: ["code", "message"],
4298
+ additionalProperties: true
4299
+ }
4300
+ },
4301
+ required: [
4302
+ "mailboxId",
4303
+ "namespaceId",
4304
+ "threadId",
4305
+ "actionId",
4306
+ "messageId",
4307
+ "channel",
4308
+ "recipient",
4309
+ "occurredAt",
4310
+ "status",
4311
+ "error"
4312
+ ],
4313
+ additionalProperties: true
4314
+ }
4315
+ },
4316
+ required: [
4317
+ "type",
4318
+ "timestamp",
4319
+ "data"
4320
+ ],
4321
+ additionalProperties: true
4322
+ },
4062
4323
  "journey.webhook": {
4063
4324
  type: "object",
4064
4325
  properties: {
@@ -4130,4 +4391,4 @@ const WebhookEventJsonSchemas = {
4130
4391
  //#endregion
4131
4392
  export { WebhookEventJsonSchemas as t };
4132
4393
 
4133
- //# sourceMappingURL=json-schemas.gen-CaL1pRff.js.map
4394
+ //# sourceMappingURL=json-schemas.gen-Cfvr6mQA.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-BshlNyvg.js";
2
- import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-CaL1pRff.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-DcQIkEck.js";
2
+ import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-Cfvr6mQA.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
@@ -276,12 +276,12 @@ const validate1479 = (value) => typeof value === "string" && typeof value === "s
276
276
  const validate1480 = (value) => typeof value === "string" && value === "completed";
277
277
  const validate1482 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "kind") && Object.hasOwn(value, "id") && Object.hasOwn(value, "source") && (!Object.hasOwn(value, "kind") || validate1483(value["kind"])) && (!Object.hasOwn(value, "id") || validate2(value["id"])) && (!Object.hasOwn(value, "displayName") || validate8(value["displayName"])) && (!Object.hasOwn(value, "source") || validate1488(value["source"]));
278
278
  const validate1483 = (value) => typeof value === "string" && (value === "user" || value === "apiKey" || value === "extension" || value === "externalAgent" || value === "samvaAgent" || value === "system");
279
- const validate1488 = (value) => typeof value === "string" && (value === "humanUi" || value === "externalApi" || value === "externalAgent" || value === "extension" || value === "system");
279
+ const validate1488 = (value) => typeof value === "string" && (value === "humanUi" || value === "externalApi" || value === "externalAgent" || value === "extension" || value === "samvaManagedAgent" || value === "system");
280
280
  const validate1518 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1519(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1521(value["data"]));
281
281
  const validate1519 = (value) => typeof value === "string" && value === "mailbox.action.pending_approval";
282
- const validate1521 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "action") && Object.hasOwn(value, "draft") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "action") || validate1526(value["action"])) && (!Object.hasOwn(value, "draft") || validate1556(value["draft"]));
282
+ const validate1521 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "action") && Object.hasOwn(value, "draft") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "action") || validate1526(value["action"])) && (!Object.hasOwn(value, "draft") || validate1556(value["draft"])) && (!Object.hasOwn(value, "tool") || validate1566(value["tool"]));
283
283
  const validate1526 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "type") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "proposedBy") && Object.hasOwn(value, "createdAt") && (!Object.hasOwn(value, "id") || validate1479(value["id"])) && (!Object.hasOwn(value, "type") || validate1528(value["type"])) && (!Object.hasOwn(value, "state") || validate1529(value["state"])) && (!Object.hasOwn(value, "decision") || validate1530(value["decision"])) && (!Object.hasOwn(value, "threadId") || validate1542(value["threadId"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"])) && (!Object.hasOwn(value, "proposedBy") || validate1482(value["proposedBy"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"]));
284
- const validate1528 = (value) => typeof value === "string" && (value === "sendMessage" || value === "reply" || value === "updateDraft" || value === "createNote" || value === "assignThread" || value === "changeThreadState" || value === "call" || value === "extensionRequest");
284
+ const validate1528 = (value) => typeof value === "string" && (value === "sendMessage" || value === "reply" || value === "updateDraft" || value === "createNote" || value === "assignThread" || value === "changeThreadState" || value === "call" || value === "extensionRequest" || value === "toolCall");
285
285
  const validate1529 = (value) => typeof value === "string" && value === "approvalRequired";
286
286
  const validate1530 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "outcome") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "policyId") && Object.hasOwn(value, "source") && Object.hasOwn(value, "decidedAt") && (!Object.hasOwn(value, "outcome") || validate1531(value["outcome"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"])) && (!Object.hasOwn(value, "policyId") || validate1535(value["policyId"])) && (!Object.hasOwn(value, "source") || validate1538(value["source"])) && (!Object.hasOwn(value, "decidedAt") || validate2(value["decidedAt"]));
287
287
  const validate1531 = (value) => typeof value === "string" && (value === "allow" || value === "requireApproval" || value === "deny");
@@ -290,32 +290,50 @@ const validate1536 = (value) => typeof value === "string" && typeof value === "s
290
290
  const validate1538 = (value) => validate1539(value) || validate6(value);
291
291
  const validate1539 = (value) => typeof value === "string" && (value === "grant" || value === "installation" || value === "policy");
292
292
  const validate1542 = (value) => validate1434(value) || validate6(value);
293
- const validate1556 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "to") && Object.hasOwn(value, "cc") && Object.hasOwn(value, "subject") && (!Object.hasOwn(value, "to") || validate45(value["to"])) && (!Object.hasOwn(value, "cc") || validate45(value["cc"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"]));
294
- const validate1564 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1565(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1567(value["data"]));
295
- const validate1565 = (value) => typeof value === "string" && value === "mailbox.action.resolved";
296
- const validate1567 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "action") && Object.hasOwn(value, "resolution") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "action") || validate1572(value["action"])) && (!Object.hasOwn(value, "resolution") || validate1586(value["resolution"]));
297
- const validate1572 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "type") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "proposedBy") && Object.hasOwn(value, "createdAt") && (!Object.hasOwn(value, "id") || validate1479(value["id"])) && (!Object.hasOwn(value, "type") || validate1528(value["type"])) && (!Object.hasOwn(value, "threadId") || validate1542(value["threadId"])) && (!Object.hasOwn(value, "proposedBy") || validate1482(value["proposedBy"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"]));
298
- const validate1586 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "outcome") && Object.hasOwn(value, "actor") && Object.hasOwn(value, "resolvedAt") && Object.hasOwn(value, "reason") && (!Object.hasOwn(value, "outcome") || validate1587(value["outcome"])) && (!Object.hasOwn(value, "actor") || validate1482(value["actor"])) && (!Object.hasOwn(value, "resolvedAt") || validate2(value["resolvedAt"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"]));
299
- const validate1587 = (value) => typeof value === "string" && (value === "approved" || value === "denied" || value === "cancelled");
300
- const validate1599 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1600(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1602(value["data"]));
301
- const validate1600 = (value) => typeof value === "string" && value === "mailbox.message.quarantined";
302
- const validate1602 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "disposition") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "source") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "disposition") || validate1607(value["disposition"])) && (!Object.hasOwn(value, "reason") || validate1608(value["reason"])) && (!Object.hasOwn(value, "source") || validate1609(value["source"])) && (!Object.hasOwn(value, "message") || validate1610(value["message"]));
303
- const validate1607 = (value) => typeof value === "string" && (value === "quarantined" || value === "isolated");
304
- const validate1608 = (value) => typeof value === "string" && (value === "spam" || value === "dmarc" || value === "virus" || value === "virus_unscanned" || value === "phishing" || value === "fraud" || value === "prompt_injection");
305
- const validate1609 = (value) => typeof value === "string" && (value === "receipt" || value === "classifier");
306
- const validate1610 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "from") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "receivedAt") && (!Object.hasOwn(value, "id") || validate774(value["id"])) && (!Object.hasOwn(value, "from") || validate1435(value["from"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "receivedAt") || validate2(value["receivedAt"]));
307
- const validate1621 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1622(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1624(value["data"]));
308
- const validate1622 = (value) => typeof value === "string" && value === "mailbox.message.released";
309
- const validate1624 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "releasedBy") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "message") && Object.hasOwn(value, "thread") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "releasedBy") || validate1482(value["releasedBy"])) && (!Object.hasOwn(value, "reason") || validate1608(value["reason"])) && (!Object.hasOwn(value, "message") || validate1431(value["message"])) && (!Object.hasOwn(value, "thread") || validate1460(value["thread"]));
310
- const validate1677 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1678(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1680(value["data"]));
311
- const validate1678 = (value) => typeof value === "string" && value === "mailbox.message.discarded";
312
- const validate1680 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "discardedBy") && Object.hasOwn(value, "disposition") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "discardedBy") || validate1482(value["discardedBy"])) && (!Object.hasOwn(value, "disposition") || validate1607(value["disposition"])) && (!Object.hasOwn(value, "reason") || validate1608(value["reason"])) && (!Object.hasOwn(value, "message") || validate1610(value["message"]));
313
- const validate1705 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1706(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1708(value["data"]));
314
- const validate1706 = (value) => typeof value === "string" && value === "journey.webhook";
315
- const validate1708 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "journeyId") && Object.hasOwn(value, "journeyVersion") && Object.hasOwn(value, "runId") && Object.hasOwn(value, "nodeId") && Object.hasOwn(value, "contact") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "journeyId") || validate1710(value["journeyId"])) && (!Object.hasOwn(value, "journeyVersion") || validate1270(value["journeyVersion"])) && (!Object.hasOwn(value, "runId") || validate1712(value["runId"])) && (!Object.hasOwn(value, "nodeId") || validate2(value["nodeId"])) && (!Object.hasOwn(value, "contact") || validate1714(value["contact"])) && (!Object.hasOwn(value, "data") || validate12(value["data"]));
316
- const validate1710 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^jrny_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
317
- const validate1712 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^jrun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
318
- const validate1714 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "externalId") && Object.hasOwn(value, "email") && (!Object.hasOwn(value, "id") || validate945(value["id"])) && (!Object.hasOwn(value, "externalId") || validate8(value["externalId"])) && (!Object.hasOwn(value, "email") || validate8(value["email"]));
293
+ const validate1556 = (value) => validate1557(value) || validate6(value);
294
+ const validate1557 = (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"]));
295
+ const validate1566 = (value) => validate1567(value) || validate6(value);
296
+ const validate1567 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "name") && Object.hasOwn(value, "argumentsHash") && Object.hasOwn(value, "arguments") && (!Object.hasOwn(value, "name") || validate1568(value["name"])) && (!Object.hasOwn(value, "argumentsHash") || validate1569(value["argumentsHash"])) && (!Object.hasOwn(value, "arguments") || validate12(value["arguments"]));
297
+ const validate1568 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1 && typeof value === "string" && Array.from(value).length <= 128;
298
+ const validate1569 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^[0-9a-f]{64}$", "u")).test(value);
299
+ const validate1572 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1573(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1575(value["data"]));
300
+ const validate1573 = (value) => typeof value === "string" && value === "mailbox.action.resolved";
301
+ const validate1575 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "action") && Object.hasOwn(value, "resolution") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "action") || validate1580(value["action"])) && (!Object.hasOwn(value, "resolution") || validate1594(value["resolution"]));
302
+ const validate1580 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "type") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "proposedBy") && Object.hasOwn(value, "createdAt") && (!Object.hasOwn(value, "id") || validate1479(value["id"])) && (!Object.hasOwn(value, "type") || validate1528(value["type"])) && (!Object.hasOwn(value, "threadId") || validate1542(value["threadId"])) && (!Object.hasOwn(value, "proposedBy") || validate1482(value["proposedBy"])) && (!Object.hasOwn(value, "createdAt") || validate2(value["createdAt"]));
303
+ const validate1594 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "outcome") && Object.hasOwn(value, "actor") && Object.hasOwn(value, "resolvedAt") && Object.hasOwn(value, "reason") && (!Object.hasOwn(value, "outcome") || validate1595(value["outcome"])) && (!Object.hasOwn(value, "actor") || validate1482(value["actor"])) && (!Object.hasOwn(value, "resolvedAt") || validate2(value["resolvedAt"])) && (!Object.hasOwn(value, "reason") || validate8(value["reason"]));
304
+ const validate1595 = (value) => typeof value === "string" && (value === "approved" || value === "denied" || value === "cancelled");
305
+ const validate1607 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1608(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1610(value["data"]));
306
+ const validate1608 = (value) => typeof value === "string" && value === "mailbox.message.quarantined";
307
+ const validate1610 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "disposition") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "source") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "disposition") || validate1615(value["disposition"])) && (!Object.hasOwn(value, "reason") || validate1616(value["reason"])) && (!Object.hasOwn(value, "source") || validate1617(value["source"])) && (!Object.hasOwn(value, "message") || validate1618(value["message"]));
308
+ const validate1615 = (value) => typeof value === "string" && (value === "quarantined" || value === "isolated");
309
+ const validate1616 = (value) => typeof value === "string" && (value === "spam" || value === "dmarc" || value === "virus" || value === "virus_unscanned" || value === "phishing" || value === "fraud" || value === "prompt_injection");
310
+ const validate1617 = (value) => typeof value === "string" && (value === "receipt" || value === "classifier");
311
+ const validate1618 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "from") && Object.hasOwn(value, "subject") && Object.hasOwn(value, "receivedAt") && (!Object.hasOwn(value, "id") || validate774(value["id"])) && (!Object.hasOwn(value, "from") || validate1435(value["from"])) && (!Object.hasOwn(value, "subject") || validate8(value["subject"])) && (!Object.hasOwn(value, "receivedAt") || validate2(value["receivedAt"]));
312
+ const validate1629 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1630(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1632(value["data"]));
313
+ const validate1630 = (value) => typeof value === "string" && value === "mailbox.message.released";
314
+ const validate1632 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "releasedBy") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "message") && Object.hasOwn(value, "thread") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "releasedBy") || validate1482(value["releasedBy"])) && (!Object.hasOwn(value, "reason") || validate1616(value["reason"])) && (!Object.hasOwn(value, "message") || validate1431(value["message"])) && (!Object.hasOwn(value, "thread") || validate1460(value["thread"]));
315
+ const validate1685 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1686(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1688(value["data"]));
316
+ const validate1686 = (value) => typeof value === "string" && value === "mailbox.message.discarded";
317
+ const validate1688 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "discardedBy") && Object.hasOwn(value, "disposition") && Object.hasOwn(value, "reason") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "discardedBy") || validate1482(value["discardedBy"])) && (!Object.hasOwn(value, "disposition") || validate1615(value["disposition"])) && (!Object.hasOwn(value, "reason") || validate1616(value["reason"])) && (!Object.hasOwn(value, "message") || validate1618(value["message"]));
318
+ const validate1713 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1714(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1716(value["data"]));
319
+ const validate1714 = (value) => typeof value === "string" && value === "mailbox.message.delivered";
320
+ const validate1716 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "actionId") && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "channel") && Object.hasOwn(value, "recipient") && Object.hasOwn(value, "occurredAt") && Object.hasOwn(value, "status") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "threadId") || validate1434(value["threadId"])) && (!Object.hasOwn(value, "actionId") || validate1479(value["actionId"])) && (!Object.hasOwn(value, "messageId") || validate774(value["messageId"])) && (!Object.hasOwn(value, "channel") || validate1433(value["channel"])) && (!Object.hasOwn(value, "recipient") || validate2(value["recipient"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"])) && (!Object.hasOwn(value, "status") || validate1727(value["status"]));
321
+ const validate1727 = (value) => typeof value === "string" && value === "delivered";
322
+ const validate1728 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1729(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1731(value["data"]));
323
+ const validate1729 = (value) => typeof value === "string" && value === "mailbox.message.read";
324
+ const validate1731 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "actionId") && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "channel") && Object.hasOwn(value, "recipient") && Object.hasOwn(value, "occurredAt") && Object.hasOwn(value, "status") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "threadId") || validate1434(value["threadId"])) && (!Object.hasOwn(value, "actionId") || validate1479(value["actionId"])) && (!Object.hasOwn(value, "messageId") || validate774(value["messageId"])) && (!Object.hasOwn(value, "channel") || validate1433(value["channel"])) && (!Object.hasOwn(value, "recipient") || validate2(value["recipient"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"])) && (!Object.hasOwn(value, "status") || validate1742(value["status"]));
325
+ const validate1742 = (value) => typeof value === "string" && value === "read";
326
+ const validate1743 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1744(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1746(value["data"]));
327
+ const validate1744 = (value) => typeof value === "string" && value === "mailbox.message.failed";
328
+ const validate1746 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "mailboxId") && Object.hasOwn(value, "namespaceId") && Object.hasOwn(value, "threadId") && Object.hasOwn(value, "actionId") && Object.hasOwn(value, "messageId") && Object.hasOwn(value, "channel") && Object.hasOwn(value, "recipient") && Object.hasOwn(value, "occurredAt") && Object.hasOwn(value, "status") && Object.hasOwn(value, "error") && (!Object.hasOwn(value, "mailboxId") || validate5(value["mailboxId"])) && (!Object.hasOwn(value, "namespaceId") || validate1408(value["namespaceId"])) && (!Object.hasOwn(value, "threadId") || validate1434(value["threadId"])) && (!Object.hasOwn(value, "actionId") || validate1479(value["actionId"])) && (!Object.hasOwn(value, "messageId") || validate774(value["messageId"])) && (!Object.hasOwn(value, "channel") || validate1433(value["channel"])) && (!Object.hasOwn(value, "recipient") || validate2(value["recipient"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"])) && (!Object.hasOwn(value, "status") || validate1757(value["status"])) && (!Object.hasOwn(value, "error") || validate1758(value["error"]));
329
+ const validate1757 = (value) => typeof value === "string" && value === "failed";
330
+ const validate1758 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "code") && Object.hasOwn(value, "message") && (!Object.hasOwn(value, "code") || validate8(value["code"])) && (!Object.hasOwn(value, "message") || validate8(value["message"]));
331
+ const validate1765 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1766(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1768(value["data"]));
332
+ const validate1766 = (value) => typeof value === "string" && value === "journey.webhook";
333
+ const validate1768 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "journeyId") && Object.hasOwn(value, "journeyVersion") && Object.hasOwn(value, "runId") && Object.hasOwn(value, "nodeId") && Object.hasOwn(value, "contact") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "organizationId") || validate846(value["organizationId"])) && (!Object.hasOwn(value, "journeyId") || validate1770(value["journeyId"])) && (!Object.hasOwn(value, "journeyVersion") || validate1270(value["journeyVersion"])) && (!Object.hasOwn(value, "runId") || validate1772(value["runId"])) && (!Object.hasOwn(value, "nodeId") || validate2(value["nodeId"])) && (!Object.hasOwn(value, "contact") || validate1774(value["contact"])) && (!Object.hasOwn(value, "data") || validate12(value["data"]));
334
+ const validate1770 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^jrny_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
335
+ const validate1772 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^jrun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
336
+ const validate1774 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "id") && Object.hasOwn(value, "externalId") && Object.hasOwn(value, "email") && (!Object.hasOwn(value, "id") || validate945(value["id"])) && (!Object.hasOwn(value, "externalId") || validate8(value["externalId"])) && (!Object.hasOwn(value, "email") || validate8(value["email"]));
319
337
  /** Narrow an event to a structurally valid payload known to this package. */
320
338
  const isKnownEvent = (value) => {
321
339
  switch (value.type) {
@@ -350,11 +368,14 @@ const isKnownEvent = (value) => {
350
368
  case "mailbox.message.received": return validate1423(value);
351
369
  case "mailbox.message.sent": return validate1471(value);
352
370
  case "mailbox.action.pending_approval": return validate1518(value);
353
- case "mailbox.action.resolved": return validate1564(value);
354
- case "mailbox.message.quarantined": return validate1599(value);
355
- case "mailbox.message.released": return validate1621(value);
356
- case "mailbox.message.discarded": return validate1677(value);
357
- case "journey.webhook": return validate1705(value);
371
+ case "mailbox.action.resolved": return validate1572(value);
372
+ case "mailbox.message.quarantined": return validate1607(value);
373
+ case "mailbox.message.released": return validate1629(value);
374
+ case "mailbox.message.discarded": return validate1685(value);
375
+ case "mailbox.message.delivered": return validate1713(value);
376
+ case "mailbox.message.read": return validate1728(value);
377
+ case "mailbox.message.failed": return validate1743(value);
378
+ case "journey.webhook": return validate1765(value);
358
379
  default: return false;
359
380
  }
360
381
  };
@@ -392,11 +413,14 @@ const validateEvent = (value) => {
392
413
  case "mailbox.message.received": return validate1423(value);
393
414
  case "mailbox.message.sent": return validate1471(value);
394
415
  case "mailbox.action.pending_approval": return validate1518(value);
395
- case "mailbox.action.resolved": return validate1564(value);
396
- case "mailbox.message.quarantined": return validate1599(value);
397
- case "mailbox.message.released": return validate1621(value);
398
- case "mailbox.message.discarded": return validate1677(value);
399
- case "journey.webhook": return validate1705(value);
416
+ case "mailbox.action.resolved": return validate1572(value);
417
+ case "mailbox.message.quarantined": return validate1607(value);
418
+ case "mailbox.message.released": return validate1629(value);
419
+ case "mailbox.message.discarded": return validate1685(value);
420
+ case "mailbox.message.delivered": return validate1713(value);
421
+ case "mailbox.message.read": return validate1728(value);
422
+ case "mailbox.message.failed": return validate1743(value);
423
+ case "journey.webhook": return validate1765(value);
400
424
  default: return true;
401
425
  }
402
426
  };
@@ -727,4 +751,4 @@ const readWebhookHeaders = (headers) => requireHeaders({
727
751
  //#endregion
728
752
  export { WebhookTimestampError as _, encodeWebhookSignature as a, signWebhook as c, webhookSignedContent as d, InvalidWebhookHeadersError as f, WebhookSignatureError as g, WebhookCryptoError as h, WEBHOOK_TIMESTAMP_HEADER as i, verifyWebhookAt as l, MalformedWebhookPayloadError as m, WEBHOOK_ID_HEADER as n, generateWebhookSecret as o, InvalidWebhookSecretError as p, WEBHOOK_SIGNATURE_HEADER as r, readWebhookHeaders as s, DEFAULT_TOLERANCE_SECONDS as t, verifyWebhookAtWithPublicKeys as u, WebhookVerificationError as v, isKnownEvent as y };
729
753
 
730
- //# sourceMappingURL=protocol-BshlNyvg.js.map
754
+ //# sourceMappingURL=protocol-DcQIkEck.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-BshlNyvg.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-DcQIkEck.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 };