@samva/webhooks 0.48.0 → 0.50.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 { a as generateWebhookSecret, c as verifyWebhookAt, d as MalformedWebhookPayloadError, f as WebhookCryptoError, g as isKnownEvent, h as WebhookVerificationError, i as WEBHOOK_TIMESTAMP_HEADER, l as InvalidWebhookHeadersError, m as WebhookTimestampError, n as WEBHOOK_ID_HEADER, p as WebhookSignatureError, r as WEBHOOK_SIGNATURE_HEADER, s as signWebhook, t as DEFAULT_TOLERANCE_SECONDS, u as InvalidWebhookSecretError } from "./protocol-CwzHnoqu.js";
2
- import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-DR7PincU.js";
3
- import { ContactConsentChangedEventSchema, ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, EmailSendingPausedEventSchema, EmailSendingResumedEventSchema, 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";
1
+ import { a as generateWebhookSecret, c as verifyWebhookAt, d as MalformedWebhookPayloadError, f as WebhookCryptoError, g as isKnownEvent, h as WebhookVerificationError, i as WEBHOOK_TIMESTAMP_HEADER, l as InvalidWebhookHeadersError, m as WebhookTimestampError, n as WEBHOOK_ID_HEADER, p as WebhookSignatureError, r as WEBHOOK_SIGNATURE_HEADER, s as signWebhook, t as DEFAULT_TOLERANCE_SECONDS, u as InvalidWebhookSecretError } from "./protocol-COaro8fP.js";
2
+ import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-CE5C7st9.js";
3
+ import { ContactConsentChangedEventSchema, ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, EmailSendingPausedEventSchema, EmailSendingResumedEventSchema, FlowRegistrationUpdatedEventSchema, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxActionResolvedEventSchema, MailboxMessageDeliveredEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageFailedEventSchema, MailboxMessageReadEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageSentEventSchema, MailboxMessageSpamEventSchema, MailboxThreadDeletedEventSchema, 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
  // src/effect.ts
6
6
  /**
@@ -74,6 +74,6 @@ const verifyRequest = Effect.fn("Webhooks.verifyRequest")(function* (request, se
74
74
  nowMilliseconds
75
75
  });
76
76
  });
77
- export { ContactConsentChangedEventSchema, ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DEFAULT_TOLERANCE_SECONDS, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, EmailSendingPausedEventSchema, EmailSendingResumedEventSchema, 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 };
77
+ export { ContactConsentChangedEventSchema, ContactCreatedEventSchema, ContactDeletedEventSchema, ContactResubscribedEventSchema, ContactSubscribedEventSchema, ContactUnsubscribedEventSchema, ContactUpdatedEventSchema, ConversationArchivedEventSchema, ConversationCreatedEventSchema, ConversationUpdatedEventSchema, DEFAULT_TOLERANCE_SECONDS, DomainUpdatedEventSchema, DomainWarmingUpdatedEventSchema, EmailSendingPausedEventSchema, EmailSendingResumedEventSchema, FlowRegistrationUpdatedEventSchema, InvalidWebhookHeadersError, InvalidWebhookSecretError, JourneyWebhookEventSchema, MailboxActionPendingApprovalEventSchema, MailboxActionResolvedEventSchema, MailboxMessageDeliveredEventSchema, MailboxMessageDiscardedEventSchema, MailboxMessageFailedEventSchema, MailboxMessageReadEventSchema, MailboxMessageReceivedEventSchema, MailboxMessageSentEventSchema, MailboxMessageSpamEventSchema, MailboxThreadDeletedEventSchema, 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
78
 
79
79
  //# sourceMappingURL=effect.js.map
@@ -2888,6 +2888,10 @@ const WebhookEventJsonSchemas = {
2888
2888
  type: "string",
2889
2889
  pattern: "^tpub_[0-9a-hjkmnp-tv-z]{16,24}$"
2890
2890
  },
2891
+ templateChannelVariantId: {
2892
+ type: "string",
2893
+ pattern: "^tvar_[0-9a-hjkmnp-tv-z]{16,24}$"
2894
+ },
2891
2895
  target: { anyOf: [{
2892
2896
  type: "object",
2893
2897
  properties: {
@@ -2929,6 +2933,13 @@ const WebhookEventJsonSchemas = {
2929
2933
  "disabled"
2930
2934
  ]
2931
2935
  },
2936
+ pendingTemplateChannelVariantId: {
2937
+ anyOf: [{
2938
+ type: "string",
2939
+ pattern: "^tvar_[0-9a-hjkmnp-tv-z]{16,24}$"
2940
+ }, { type: "null" }],
2941
+ description: "Content a submission sent to the provider whose outcome is not yet recorded, because its request failed or is still in flight; the provider may already hold it. While it is set nothing sends from this registration, even when `status` is `approved`. Submitting again settles it."
2942
+ },
2932
2943
  category: {
2933
2944
  type: "string",
2934
2945
  enum: [
@@ -2979,10 +2990,12 @@ const WebhookEventJsonSchemas = {
2979
2990
  "id",
2980
2991
  "templateId",
2981
2992
  "publicationId",
2993
+ "templateChannelVariantId",
2982
2994
  "target",
2983
2995
  "name",
2984
2996
  "language",
2985
2997
  "status",
2998
+ "pendingTemplateChannelVariantId",
2986
2999
  "category",
2987
3000
  "providerCategory",
2988
3001
  "providerTemplateId",
@@ -4052,12 +4065,12 @@ const WebhookEventJsonSchemas = {
4052
4065
  ],
4053
4066
  additionalProperties: true
4054
4067
  },
4055
- "mailbox.message.quarantined": {
4068
+ "mailbox.message.spam": {
4056
4069
  type: "object",
4057
4070
  properties: {
4058
4071
  type: {
4059
4072
  type: "string",
4060
- enum: ["mailbox.message.quarantined"]
4073
+ enum: ["mailbox.message.spam"]
4061
4074
  },
4062
4075
  timestamp: { type: "string" },
4063
4076
  data: {
@@ -4073,9 +4086,13 @@ const WebhookEventJsonSchemas = {
4073
4086
  }, { type: "null" }] },
4074
4087
  disposition: {
4075
4088
  type: "string",
4076
- enum: ["quarantined", "isolated"]
4089
+ enum: ["spam", "isolated"]
4077
4090
  },
4078
- reason: {
4091
+ threadId: { anyOf: [{
4092
+ type: "string",
4093
+ pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$"
4094
+ }, { type: "null" }] },
4095
+ reason: { anyOf: [{
4079
4096
  type: "string",
4080
4097
  enum: [
4081
4098
  "spam",
@@ -4087,10 +4104,14 @@ const WebhookEventJsonSchemas = {
4087
4104
  "fraud",
4088
4105
  "prompt_injection"
4089
4106
  ]
4090
- },
4107
+ }, { type: "null" }] },
4091
4108
  source: {
4092
4109
  type: "string",
4093
- enum: ["receipt", "classifier"]
4110
+ enum: [
4111
+ "receipt",
4112
+ "classifier",
4113
+ "reader"
4114
+ ]
4094
4115
  },
4095
4116
  message: {
4096
4117
  type: "object",
@@ -4124,6 +4145,7 @@ const WebhookEventJsonSchemas = {
4124
4145
  "mailboxId",
4125
4146
  "namespaceId",
4126
4147
  "disposition",
4148
+ "threadId",
4127
4149
  "reason",
4128
4150
  "source",
4129
4151
  "message"
@@ -4138,12 +4160,12 @@ const WebhookEventJsonSchemas = {
4138
4160
  ],
4139
4161
  additionalProperties: true
4140
4162
  },
4141
- "mailbox.message.released": {
4163
+ "mailbox.message.discarded": {
4142
4164
  type: "object",
4143
4165
  properties: {
4144
4166
  type: {
4145
4167
  type: "string",
4146
- enum: ["mailbox.message.released"]
4168
+ enum: ["mailbox.message.discarded"]
4147
4169
  },
4148
4170
  timestamp: { type: "string" },
4149
4171
  data: {
@@ -4157,7 +4179,7 @@ const WebhookEventJsonSchemas = {
4157
4179
  type: "string",
4158
4180
  pattern: "^ns_[0-9a-hjkmnp-tv-z]{16,24}$"
4159
4181
  }, { type: "null" }] },
4160
- releasedBy: {
4182
+ discardedBy: {
4161
4183
  type: "object",
4162
4184
  properties: {
4163
4185
  kind: {
@@ -4192,6 +4214,10 @@ const WebhookEventJsonSchemas = {
4192
4214
  ],
4193
4215
  additionalProperties: true
4194
4216
  },
4217
+ disposition: {
4218
+ type: "string",
4219
+ enum: ["quarantined", "isolated"]
4220
+ },
4195
4221
  reason: {
4196
4222
  type: "string",
4197
4223
  enum: [
@@ -4212,34 +4238,6 @@ const WebhookEventJsonSchemas = {
4212
4238
  type: "string",
4213
4239
  pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
4214
4240
  },
4215
- campaign: { anyOf: [{
4216
- type: "object",
4217
- properties: {
4218
- campaignId: {
4219
- type: "string",
4220
- pattern: "^camp_[0-9a-hjkmnp-tv-z]{16,24}$"
4221
- },
4222
- runId: {
4223
- type: "string",
4224
- pattern: "^crun_[0-9a-hjkmnp-tv-z]{16,24}$"
4225
- }
4226
- },
4227
- required: ["campaignId", "runId"],
4228
- additionalProperties: true
4229
- }, { type: "null" }] },
4230
- channel: {
4231
- type: "string",
4232
- enum: [
4233
- "sms",
4234
- "whatsapp",
4235
- "email"
4236
- ],
4237
- description: "Deliveries recorded before this field existed omit it; they are email."
4238
- },
4239
- threadId: {
4240
- type: "string",
4241
- pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$"
4242
- },
4243
4241
  from: {
4244
4242
  type: "object",
4245
4243
  properties: {
@@ -4249,76 +4247,14 @@ const WebhookEventJsonSchemas = {
4249
4247
  required: ["address"],
4250
4248
  additionalProperties: true
4251
4249
  },
4252
- to: {
4253
- type: "array",
4254
- items: { type: "string" }
4255
- },
4256
- cc: {
4257
- type: "array",
4258
- items: { type: "string" }
4259
- },
4260
4250
  subject: { anyOf: [{ type: "string" }, { type: "null" }] },
4261
- text: { anyOf: [{ type: "string" }, { type: "null" }] },
4262
- replyText: { anyOf: [{ type: "string" }, { type: "null" }] },
4263
- attachments: {
4264
- type: "array",
4265
- items: {
4266
- type: "object",
4267
- properties: {
4268
- id: {
4269
- type: "string",
4270
- pattern: "^att_[0-9a-hjkmnp-tv-z]{16,24}$"
4271
- },
4272
- filename: { type: "string" },
4273
- contentType: { type: "string" },
4274
- size: { type: "number" }
4275
- },
4276
- required: [
4277
- "id",
4278
- "filename",
4279
- "contentType",
4280
- "size"
4281
- ],
4282
- additionalProperties: true
4283
- }
4284
- },
4285
- occurredAt: { type: "string" }
4251
+ receivedAt: { type: "string" }
4286
4252
  },
4287
4253
  required: [
4288
4254
  "id",
4289
- "threadId",
4290
4255
  "from",
4291
- "to",
4292
- "cc",
4293
4256
  "subject",
4294
- "text",
4295
- "replyText",
4296
- "attachments",
4297
- "occurredAt"
4298
- ],
4299
- additionalProperties: true
4300
- },
4301
- thread: {
4302
- type: "object",
4303
- properties: {
4304
- id: {
4305
- type: "string",
4306
- pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$"
4307
- },
4308
- endpointId: {
4309
- anyOf: [{
4310
- type: "string",
4311
- pattern: "^mbxep_[0-9a-hjkmnp-tv-z]{16,24}$"
4312
- }, { type: "null" }],
4313
- description: "The endpoint the message arrived at; null once it is removed. Deliveries recorded before this field existed omit it."
4314
- },
4315
- subject: { anyOf: [{ type: "string" }, { type: "null" }] },
4316
- preview: { anyOf: [{ type: "string" }, { type: "null" }] }
4317
- },
4318
- required: [
4319
- "id",
4320
- "subject",
4321
- "preview"
4257
+ "receivedAt"
4322
4258
  ],
4323
4259
  additionalProperties: true
4324
4260
  }
@@ -4326,10 +4262,10 @@ const WebhookEventJsonSchemas = {
4326
4262
  required: [
4327
4263
  "mailboxId",
4328
4264
  "namespaceId",
4329
- "releasedBy",
4265
+ "discardedBy",
4266
+ "disposition",
4330
4267
  "reason",
4331
- "message",
4332
- "thread"
4268
+ "message"
4333
4269
  ],
4334
4270
  additionalProperties: true
4335
4271
  }
@@ -4341,12 +4277,12 @@ const WebhookEventJsonSchemas = {
4341
4277
  ],
4342
4278
  additionalProperties: true
4343
4279
  },
4344
- "mailbox.message.discarded": {
4280
+ "mailbox.thread.deleted": {
4345
4281
  type: "object",
4346
4282
  properties: {
4347
4283
  type: {
4348
4284
  type: "string",
4349
- enum: ["mailbox.message.discarded"]
4285
+ enum: ["mailbox.thread.deleted"]
4350
4286
  },
4351
4287
  timestamp: { type: "string" },
4352
4288
  data: {
@@ -4360,93 +4296,15 @@ const WebhookEventJsonSchemas = {
4360
4296
  type: "string",
4361
4297
  pattern: "^ns_[0-9a-hjkmnp-tv-z]{16,24}$"
4362
4298
  }, { type: "null" }] },
4363
- discardedBy: {
4364
- type: "object",
4365
- properties: {
4366
- kind: {
4367
- type: "string",
4368
- enum: [
4369
- "user",
4370
- "apiKey",
4371
- "extension",
4372
- "externalAgent",
4373
- "samvaAgent",
4374
- "system"
4375
- ]
4376
- },
4377
- id: { type: "string" },
4378
- displayName: { anyOf: [{ type: "string" }, { type: "null" }] },
4379
- source: {
4380
- type: "string",
4381
- enum: [
4382
- "humanUi",
4383
- "externalApi",
4384
- "externalAgent",
4385
- "extension",
4386
- "samvaManagedAgent",
4387
- "system"
4388
- ]
4389
- }
4390
- },
4391
- required: [
4392
- "kind",
4393
- "id",
4394
- "source"
4395
- ],
4396
- additionalProperties: true
4397
- },
4398
- disposition: {
4399
- type: "string",
4400
- enum: ["quarantined", "isolated"]
4401
- },
4402
- reason: {
4299
+ threadId: {
4403
4300
  type: "string",
4404
- enum: [
4405
- "spam",
4406
- "dmarc",
4407
- "virus",
4408
- "virus_unscanned",
4409
- "verdict_missing",
4410
- "phishing",
4411
- "fraud",
4412
- "prompt_injection"
4413
- ]
4414
- },
4415
- message: {
4416
- type: "object",
4417
- properties: {
4418
- id: {
4419
- type: "string",
4420
- pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
4421
- },
4422
- from: {
4423
- type: "object",
4424
- properties: {
4425
- address: { type: "string" },
4426
- name: { anyOf: [{ type: "string" }, { type: "null" }] }
4427
- },
4428
- required: ["address"],
4429
- additionalProperties: true
4430
- },
4431
- subject: { anyOf: [{ type: "string" }, { type: "null" }] },
4432
- receivedAt: { type: "string" }
4433
- },
4434
- required: [
4435
- "id",
4436
- "from",
4437
- "subject",
4438
- "receivedAt"
4439
- ],
4440
- additionalProperties: true
4301
+ pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$"
4441
4302
  }
4442
4303
  },
4443
4304
  required: [
4444
4305
  "mailboxId",
4445
4306
  "namespaceId",
4446
- "discardedBy",
4447
- "disposition",
4448
- "reason",
4449
- "message"
4307
+ "threadId"
4450
4308
  ],
4451
4309
  additionalProperties: true
4452
4310
  }
@@ -4754,4 +4612,4 @@ const WebhookEventJsonSchemas = {
4754
4612
  };
4755
4613
  export { WebhookEventJsonSchemas as t };
4756
4614
 
4757
- //# sourceMappingURL=json-schemas.gen-DR7PincU.js.map
4615
+ //# sourceMappingURL=json-schemas.gen-CE5C7st9.js.map
package/dist/promise.js CHANGED
@@ -1,5 +1,5 @@
1
- import { a as generateWebhookSecret, c as verifyWebhookAt, d as MalformedWebhookPayloadError, f as WebhookCryptoError, g as isKnownEvent, h as WebhookVerificationError, i as WEBHOOK_TIMESTAMP_HEADER, l as InvalidWebhookHeadersError, m as WebhookTimestampError, n as WEBHOOK_ID_HEADER, o as readWebhookHeaders, p as WebhookSignatureError, r as WEBHOOK_SIGNATURE_HEADER, s as signWebhook, t as DEFAULT_TOLERANCE_SECONDS, u as InvalidWebhookSecretError } from "./protocol-CwzHnoqu.js";
2
- import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-DR7PincU.js";
1
+ import { a as generateWebhookSecret, c as verifyWebhookAt, d as MalformedWebhookPayloadError, f as WebhookCryptoError, g as isKnownEvent, h as WebhookVerificationError, i as WEBHOOK_TIMESTAMP_HEADER, l as InvalidWebhookHeadersError, m as WebhookTimestampError, n as WEBHOOK_ID_HEADER, o as readWebhookHeaders, p as WebhookSignatureError, r as WEBHOOK_SIGNATURE_HEADER, s as signWebhook, t as DEFAULT_TOLERANCE_SECONDS, u as InvalidWebhookSecretError } from "./protocol-COaro8fP.js";
2
+ import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-CE5C7st9.js";
3
3
  // src/promise.ts
4
4
  /**
5
5
  * Verifies a Samva webhook delivery from its body and header values, then returns its ID and