@samva/webhooks 0.53.0 → 0.54.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 +2 -2
- package/dist/{json-schemas.gen-Du5pts9S.js → json-schemas.gen-Ck8UIxoX.js} +204 -8
- package/dist/promise.js +2 -2
- package/dist/{protocol-Q3-Vd3-K.js → protocol-DwRceAlj.js} +428 -425
- package/dist/protocol.js +1 -1
- package/dist/schemas.gen.d.ts +70 -0
- package/dist/schemas.gen.js +77 -7
- package/dist/types.gen.d.ts +49 -0
- package/package.json +1 -1
package/dist/effect.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, p as WebhookSignatureError, r as WEBHOOK_SIGNATURE_HEADER, s as signWebhook, t as DEFAULT_TOLERANCE_SECONDS, u as InvalidWebhookSecretError } from "./protocol-
|
|
2
|
-
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-
|
|
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-DwRceAlj.js";
|
|
2
|
+
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-Ck8UIxoX.js";
|
|
3
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
|
|
@@ -25,7 +25,35 @@ const WebhookEventJsonSchemas = {
|
|
|
25
25
|
},
|
|
26
26
|
status: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
27
27
|
metadata: { anyOf: [{ type: "object" }, { type: "null" }] },
|
|
28
|
-
cost: { anyOf: [{
|
|
28
|
+
cost: { anyOf: [{
|
|
29
|
+
type: "number",
|
|
30
|
+
description: "The cost reported by the SMS provider, when available."
|
|
31
|
+
}, { type: "null" }] },
|
|
32
|
+
estimatedProviderCost: {
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: {
|
|
35
|
+
amount: {
|
|
36
|
+
type: "string",
|
|
37
|
+
pattern: "^\\d+\\.\\d+$"
|
|
38
|
+
},
|
|
39
|
+
currency: { type: "string" },
|
|
40
|
+
category: {
|
|
41
|
+
type: "string",
|
|
42
|
+
enum: [
|
|
43
|
+
"marketing",
|
|
44
|
+
"utility",
|
|
45
|
+
"authentication",
|
|
46
|
+
"service"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
required: [
|
|
51
|
+
"amount",
|
|
52
|
+
"currency",
|
|
53
|
+
"category"
|
|
54
|
+
],
|
|
55
|
+
additionalProperties: true
|
|
56
|
+
},
|
|
29
57
|
recipient: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
30
58
|
occurredAt: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
31
59
|
failureReason: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
@@ -104,7 +132,35 @@ const WebhookEventJsonSchemas = {
|
|
|
104
132
|
},
|
|
105
133
|
status: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
106
134
|
metadata: { anyOf: [{ type: "object" }, { type: "null" }] },
|
|
107
|
-
cost: { anyOf: [{
|
|
135
|
+
cost: { anyOf: [{
|
|
136
|
+
type: "number",
|
|
137
|
+
description: "The cost reported by the SMS provider, when available."
|
|
138
|
+
}, { type: "null" }] },
|
|
139
|
+
estimatedProviderCost: {
|
|
140
|
+
type: "object",
|
|
141
|
+
properties: {
|
|
142
|
+
amount: {
|
|
143
|
+
type: "string",
|
|
144
|
+
pattern: "^\\d+\\.\\d+$"
|
|
145
|
+
},
|
|
146
|
+
currency: { type: "string" },
|
|
147
|
+
category: {
|
|
148
|
+
type: "string",
|
|
149
|
+
enum: [
|
|
150
|
+
"marketing",
|
|
151
|
+
"utility",
|
|
152
|
+
"authentication",
|
|
153
|
+
"service"
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
required: [
|
|
158
|
+
"amount",
|
|
159
|
+
"currency",
|
|
160
|
+
"category"
|
|
161
|
+
],
|
|
162
|
+
additionalProperties: true
|
|
163
|
+
},
|
|
108
164
|
recipient: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
109
165
|
occurredAt: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
110
166
|
failureReason: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
@@ -183,7 +239,35 @@ const WebhookEventJsonSchemas = {
|
|
|
183
239
|
},
|
|
184
240
|
status: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
185
241
|
metadata: { anyOf: [{ type: "object" }, { type: "null" }] },
|
|
186
|
-
cost: { anyOf: [{
|
|
242
|
+
cost: { anyOf: [{
|
|
243
|
+
type: "number",
|
|
244
|
+
description: "The cost reported by the SMS provider, when available."
|
|
245
|
+
}, { type: "null" }] },
|
|
246
|
+
estimatedProviderCost: {
|
|
247
|
+
type: "object",
|
|
248
|
+
properties: {
|
|
249
|
+
amount: {
|
|
250
|
+
type: "string",
|
|
251
|
+
pattern: "^\\d+\\.\\d+$"
|
|
252
|
+
},
|
|
253
|
+
currency: { type: "string" },
|
|
254
|
+
category: {
|
|
255
|
+
type: "string",
|
|
256
|
+
enum: [
|
|
257
|
+
"marketing",
|
|
258
|
+
"utility",
|
|
259
|
+
"authentication",
|
|
260
|
+
"service"
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
required: [
|
|
265
|
+
"amount",
|
|
266
|
+
"currency",
|
|
267
|
+
"category"
|
|
268
|
+
],
|
|
269
|
+
additionalProperties: true
|
|
270
|
+
},
|
|
187
271
|
recipient: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
188
272
|
occurredAt: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
189
273
|
failureReason: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
@@ -262,7 +346,35 @@ const WebhookEventJsonSchemas = {
|
|
|
262
346
|
},
|
|
263
347
|
status: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
264
348
|
metadata: { anyOf: [{ type: "object" }, { type: "null" }] },
|
|
265
|
-
cost: { anyOf: [{
|
|
349
|
+
cost: { anyOf: [{
|
|
350
|
+
type: "number",
|
|
351
|
+
description: "The cost reported by the SMS provider, when available."
|
|
352
|
+
}, { type: "null" }] },
|
|
353
|
+
estimatedProviderCost: {
|
|
354
|
+
type: "object",
|
|
355
|
+
properties: {
|
|
356
|
+
amount: {
|
|
357
|
+
type: "string",
|
|
358
|
+
pattern: "^\\d+\\.\\d+$"
|
|
359
|
+
},
|
|
360
|
+
currency: { type: "string" },
|
|
361
|
+
category: {
|
|
362
|
+
type: "string",
|
|
363
|
+
enum: [
|
|
364
|
+
"marketing",
|
|
365
|
+
"utility",
|
|
366
|
+
"authentication",
|
|
367
|
+
"service"
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
required: [
|
|
372
|
+
"amount",
|
|
373
|
+
"currency",
|
|
374
|
+
"category"
|
|
375
|
+
],
|
|
376
|
+
additionalProperties: true
|
|
377
|
+
},
|
|
266
378
|
recipient: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
267
379
|
occurredAt: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
268
380
|
failureReason: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
@@ -341,7 +453,35 @@ const WebhookEventJsonSchemas = {
|
|
|
341
453
|
},
|
|
342
454
|
status: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
343
455
|
metadata: { anyOf: [{ type: "object" }, { type: "null" }] },
|
|
344
|
-
cost: { anyOf: [{
|
|
456
|
+
cost: { anyOf: [{
|
|
457
|
+
type: "number",
|
|
458
|
+
description: "The cost reported by the SMS provider, when available."
|
|
459
|
+
}, { type: "null" }] },
|
|
460
|
+
estimatedProviderCost: {
|
|
461
|
+
type: "object",
|
|
462
|
+
properties: {
|
|
463
|
+
amount: {
|
|
464
|
+
type: "string",
|
|
465
|
+
pattern: "^\\d+\\.\\d+$"
|
|
466
|
+
},
|
|
467
|
+
currency: { type: "string" },
|
|
468
|
+
category: {
|
|
469
|
+
type: "string",
|
|
470
|
+
enum: [
|
|
471
|
+
"marketing",
|
|
472
|
+
"utility",
|
|
473
|
+
"authentication",
|
|
474
|
+
"service"
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
},
|
|
478
|
+
required: [
|
|
479
|
+
"amount",
|
|
480
|
+
"currency",
|
|
481
|
+
"category"
|
|
482
|
+
],
|
|
483
|
+
additionalProperties: true
|
|
484
|
+
},
|
|
345
485
|
recipient: { type: "string" },
|
|
346
486
|
occurredAt: { type: "string" },
|
|
347
487
|
failureReason: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
@@ -422,7 +562,35 @@ const WebhookEventJsonSchemas = {
|
|
|
422
562
|
},
|
|
423
563
|
status: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
424
564
|
metadata: { anyOf: [{ type: "object" }, { type: "null" }] },
|
|
425
|
-
cost: { anyOf: [{
|
|
565
|
+
cost: { anyOf: [{
|
|
566
|
+
type: "number",
|
|
567
|
+
description: "The cost reported by the SMS provider, when available."
|
|
568
|
+
}, { type: "null" }] },
|
|
569
|
+
estimatedProviderCost: {
|
|
570
|
+
type: "object",
|
|
571
|
+
properties: {
|
|
572
|
+
amount: {
|
|
573
|
+
type: "string",
|
|
574
|
+
pattern: "^\\d+\\.\\d+$"
|
|
575
|
+
},
|
|
576
|
+
currency: { type: "string" },
|
|
577
|
+
category: {
|
|
578
|
+
type: "string",
|
|
579
|
+
enum: [
|
|
580
|
+
"marketing",
|
|
581
|
+
"utility",
|
|
582
|
+
"authentication",
|
|
583
|
+
"service"
|
|
584
|
+
]
|
|
585
|
+
}
|
|
586
|
+
},
|
|
587
|
+
required: [
|
|
588
|
+
"amount",
|
|
589
|
+
"currency",
|
|
590
|
+
"category"
|
|
591
|
+
],
|
|
592
|
+
additionalProperties: true
|
|
593
|
+
},
|
|
426
594
|
recipient: { type: "string" },
|
|
427
595
|
occurredAt: { type: "string" },
|
|
428
596
|
failureReason: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
@@ -503,7 +671,35 @@ const WebhookEventJsonSchemas = {
|
|
|
503
671
|
},
|
|
504
672
|
status: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
505
673
|
metadata: { anyOf: [{ type: "object" }, { type: "null" }] },
|
|
506
|
-
cost: { anyOf: [{
|
|
674
|
+
cost: { anyOf: [{
|
|
675
|
+
type: "number",
|
|
676
|
+
description: "The cost reported by the SMS provider, when available."
|
|
677
|
+
}, { type: "null" }] },
|
|
678
|
+
estimatedProviderCost: {
|
|
679
|
+
type: "object",
|
|
680
|
+
properties: {
|
|
681
|
+
amount: {
|
|
682
|
+
type: "string",
|
|
683
|
+
pattern: "^\\d+\\.\\d+$"
|
|
684
|
+
},
|
|
685
|
+
currency: { type: "string" },
|
|
686
|
+
category: {
|
|
687
|
+
type: "string",
|
|
688
|
+
enum: [
|
|
689
|
+
"marketing",
|
|
690
|
+
"utility",
|
|
691
|
+
"authentication",
|
|
692
|
+
"service"
|
|
693
|
+
]
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
required: [
|
|
697
|
+
"amount",
|
|
698
|
+
"currency",
|
|
699
|
+
"category"
|
|
700
|
+
],
|
|
701
|
+
additionalProperties: true
|
|
702
|
+
},
|
|
507
703
|
recipient: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
508
704
|
occurredAt: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
509
705
|
failureReason: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
@@ -4632,4 +4828,4 @@ const WebhookEventJsonSchemas = {
|
|
|
4632
4828
|
};
|
|
4633
4829
|
export { WebhookEventJsonSchemas as t };
|
|
4634
4830
|
|
|
4635
|
-
//# sourceMappingURL=json-schemas.gen-
|
|
4831
|
+
//# sourceMappingURL=json-schemas.gen-Ck8UIxoX.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-
|
|
2
|
-
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-
|
|
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-DwRceAlj.js";
|
|
2
|
+
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-Ck8UIxoX.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
|