@samva/webhooks 0.26.0 → 0.28.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-Cfvr6mQA.js → json-schemas.gen-kztbWC65.js} +109 -52
- package/dist/promise.js +2 -2
- package/dist/{protocol-DcQIkEck.js → protocol-D6Od0Usw.js} +359 -361
- package/dist/protocol.js +1 -1
- package/dist/schemas.gen.d.ts +74 -30
- package/dist/schemas.gen.js +49 -30
- package/dist/types.gen.d.ts +45 -15
- package/package.json +5 -5
package/dist/effect.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, t as DEFAULT_TOLERANCE_SECONDS, v as WebhookVerificationError, y as isKnownEvent } from "./protocol-
|
|
2
|
-
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-
|
|
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-D6Od0Usw.js";
|
|
2
|
+
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-kztbWC65.js";
|
|
3
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
|
|
@@ -539,6 +539,21 @@ const WebhookEventJsonSchemas = {
|
|
|
539
539
|
errorMessage: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
540
540
|
parts: { anyOf: [{ type: "number" }, { type: "null" }] },
|
|
541
541
|
carrier: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
542
|
+
campaign: { anyOf: [{
|
|
543
|
+
type: "object",
|
|
544
|
+
properties: {
|
|
545
|
+
campaignId: {
|
|
546
|
+
type: "string",
|
|
547
|
+
pattern: "^camp_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
548
|
+
},
|
|
549
|
+
runId: {
|
|
550
|
+
type: "string",
|
|
551
|
+
pattern: "^crun_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
required: ["campaignId", "runId"],
|
|
555
|
+
additionalProperties: true
|
|
556
|
+
}, { type: "null" }] },
|
|
542
557
|
whatsapp: { anyOf: [{
|
|
543
558
|
type: "object",
|
|
544
559
|
properties: {
|
|
@@ -1762,27 +1777,25 @@ const WebhookEventJsonSchemas = {
|
|
|
1762
1777
|
pattern: "^contact_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1763
1778
|
},
|
|
1764
1779
|
email: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1765
|
-
|
|
1766
|
-
groupName: { type: "string" },
|
|
1767
|
-
contactGroupId: { anyOf: [{
|
|
1768
|
-
type: "string",
|
|
1769
|
-
pattern: "^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1770
|
-
}, { type: "null" }] },
|
|
1771
|
-
unsubscribeGroupId: { anyOf: [{
|
|
1780
|
+
topicId: {
|
|
1772
1781
|
type: "string",
|
|
1773
1782
|
pattern: "^unsub_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1774
|
-
},
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
source: {
|
|
1783
|
+
},
|
|
1784
|
+
topicName: { type: "string" },
|
|
1785
|
+
channel: {
|
|
1778
1786
|
type: "string",
|
|
1779
1787
|
enum: [
|
|
1780
|
-
"
|
|
1781
|
-
"
|
|
1782
|
-
"
|
|
1783
|
-
"complaint"
|
|
1788
|
+
"sms",
|
|
1789
|
+
"whatsapp",
|
|
1790
|
+
"email"
|
|
1784
1791
|
]
|
|
1785
1792
|
},
|
|
1793
|
+
consentIp: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1794
|
+
consentSource: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1795
|
+
source: { type: "string" },
|
|
1796
|
+
formKey: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1797
|
+
page: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1798
|
+
referrer: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1786
1799
|
messageId: { anyOf: [{
|
|
1787
1800
|
type: "string",
|
|
1788
1801
|
pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
@@ -1800,8 +1813,9 @@ const WebhookEventJsonSchemas = {
|
|
|
1800
1813
|
required: [
|
|
1801
1814
|
"organizationId",
|
|
1802
1815
|
"contactId",
|
|
1803
|
-
"
|
|
1804
|
-
"
|
|
1816
|
+
"topicId",
|
|
1817
|
+
"topicName",
|
|
1818
|
+
"channel",
|
|
1805
1819
|
"source",
|
|
1806
1820
|
"occurredAt"
|
|
1807
1821
|
],
|
|
@@ -1835,27 +1849,25 @@ const WebhookEventJsonSchemas = {
|
|
|
1835
1849
|
pattern: "^contact_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1836
1850
|
},
|
|
1837
1851
|
email: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1838
|
-
|
|
1839
|
-
groupName: { type: "string" },
|
|
1840
|
-
contactGroupId: { anyOf: [{
|
|
1841
|
-
type: "string",
|
|
1842
|
-
pattern: "^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1843
|
-
}, { type: "null" }] },
|
|
1844
|
-
unsubscribeGroupId: { anyOf: [{
|
|
1852
|
+
topicId: {
|
|
1845
1853
|
type: "string",
|
|
1846
1854
|
pattern: "^unsub_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1847
|
-
},
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
source: {
|
|
1855
|
+
},
|
|
1856
|
+
topicName: { type: "string" },
|
|
1857
|
+
channel: {
|
|
1851
1858
|
type: "string",
|
|
1852
1859
|
enum: [
|
|
1853
|
-
"
|
|
1854
|
-
"
|
|
1855
|
-
"
|
|
1856
|
-
"complaint"
|
|
1860
|
+
"sms",
|
|
1861
|
+
"whatsapp",
|
|
1862
|
+
"email"
|
|
1857
1863
|
]
|
|
1858
1864
|
},
|
|
1865
|
+
consentIp: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1866
|
+
consentSource: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1867
|
+
source: { type: "string" },
|
|
1868
|
+
formKey: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1869
|
+
page: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1870
|
+
referrer: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1859
1871
|
messageId: { anyOf: [{
|
|
1860
1872
|
type: "string",
|
|
1861
1873
|
pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
@@ -1873,8 +1885,9 @@ const WebhookEventJsonSchemas = {
|
|
|
1873
1885
|
required: [
|
|
1874
1886
|
"organizationId",
|
|
1875
1887
|
"contactId",
|
|
1876
|
-
"
|
|
1877
|
-
"
|
|
1888
|
+
"topicId",
|
|
1889
|
+
"topicName",
|
|
1890
|
+
"channel",
|
|
1878
1891
|
"source",
|
|
1879
1892
|
"occurredAt"
|
|
1880
1893
|
],
|
|
@@ -1908,27 +1921,25 @@ const WebhookEventJsonSchemas = {
|
|
|
1908
1921
|
pattern: "^contact_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1909
1922
|
},
|
|
1910
1923
|
email: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1911
|
-
|
|
1912
|
-
groupName: { type: "string" },
|
|
1913
|
-
contactGroupId: { anyOf: [{
|
|
1914
|
-
type: "string",
|
|
1915
|
-
pattern: "^cgrp_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1916
|
-
}, { type: "null" }] },
|
|
1917
|
-
unsubscribeGroupId: { anyOf: [{
|
|
1924
|
+
topicId: {
|
|
1918
1925
|
type: "string",
|
|
1919
1926
|
pattern: "^unsub_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1920
|
-
},
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
source: {
|
|
1927
|
+
},
|
|
1928
|
+
topicName: { type: "string" },
|
|
1929
|
+
channel: {
|
|
1924
1930
|
type: "string",
|
|
1925
1931
|
enum: [
|
|
1926
|
-
"
|
|
1927
|
-
"
|
|
1928
|
-
"
|
|
1929
|
-
"complaint"
|
|
1932
|
+
"sms",
|
|
1933
|
+
"whatsapp",
|
|
1934
|
+
"email"
|
|
1930
1935
|
]
|
|
1931
1936
|
},
|
|
1937
|
+
consentIp: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1938
|
+
consentSource: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1939
|
+
source: { type: "string" },
|
|
1940
|
+
formKey: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1941
|
+
page: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1942
|
+
referrer: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1932
1943
|
messageId: { anyOf: [{
|
|
1933
1944
|
type: "string",
|
|
1934
1945
|
pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
@@ -1946,8 +1957,9 @@ const WebhookEventJsonSchemas = {
|
|
|
1946
1957
|
required: [
|
|
1947
1958
|
"organizationId",
|
|
1948
1959
|
"contactId",
|
|
1949
|
-
"
|
|
1950
|
-
"
|
|
1960
|
+
"topicId",
|
|
1961
|
+
"topicName",
|
|
1962
|
+
"channel",
|
|
1951
1963
|
"source",
|
|
1952
1964
|
"occurredAt"
|
|
1953
1965
|
],
|
|
@@ -3068,6 +3080,21 @@ const WebhookEventJsonSchemas = {
|
|
|
3068
3080
|
type: "string",
|
|
3069
3081
|
pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3070
3082
|
},
|
|
3083
|
+
campaign: { anyOf: [{
|
|
3084
|
+
type: "object",
|
|
3085
|
+
properties: {
|
|
3086
|
+
campaignId: {
|
|
3087
|
+
type: "string",
|
|
3088
|
+
pattern: "^camp_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3089
|
+
},
|
|
3090
|
+
runId: {
|
|
3091
|
+
type: "string",
|
|
3092
|
+
pattern: "^crun_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3093
|
+
}
|
|
3094
|
+
},
|
|
3095
|
+
required: ["campaignId", "runId"],
|
|
3096
|
+
additionalProperties: true
|
|
3097
|
+
}, { type: "null" }] },
|
|
3071
3098
|
channel: {
|
|
3072
3099
|
type: "string",
|
|
3073
3100
|
enum: [
|
|
@@ -3251,6 +3278,21 @@ const WebhookEventJsonSchemas = {
|
|
|
3251
3278
|
type: "string",
|
|
3252
3279
|
pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3253
3280
|
},
|
|
3281
|
+
campaign: { anyOf: [{
|
|
3282
|
+
type: "object",
|
|
3283
|
+
properties: {
|
|
3284
|
+
campaignId: {
|
|
3285
|
+
type: "string",
|
|
3286
|
+
pattern: "^camp_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3287
|
+
},
|
|
3288
|
+
runId: {
|
|
3289
|
+
type: "string",
|
|
3290
|
+
pattern: "^crun_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3291
|
+
}
|
|
3292
|
+
},
|
|
3293
|
+
required: ["campaignId", "runId"],
|
|
3294
|
+
additionalProperties: true
|
|
3295
|
+
}, { type: "null" }] },
|
|
3254
3296
|
channel: {
|
|
3255
3297
|
type: "string",
|
|
3256
3298
|
enum: [
|
|
@@ -3864,6 +3906,21 @@ const WebhookEventJsonSchemas = {
|
|
|
3864
3906
|
type: "string",
|
|
3865
3907
|
pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3866
3908
|
},
|
|
3909
|
+
campaign: { anyOf: [{
|
|
3910
|
+
type: "object",
|
|
3911
|
+
properties: {
|
|
3912
|
+
campaignId: {
|
|
3913
|
+
type: "string",
|
|
3914
|
+
pattern: "^camp_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3915
|
+
},
|
|
3916
|
+
runId: {
|
|
3917
|
+
type: "string",
|
|
3918
|
+
pattern: "^crun_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
3919
|
+
}
|
|
3920
|
+
},
|
|
3921
|
+
required: ["campaignId", "runId"],
|
|
3922
|
+
additionalProperties: true
|
|
3923
|
+
}, { type: "null" }] },
|
|
3867
3924
|
channel: {
|
|
3868
3925
|
type: "string",
|
|
3869
3926
|
enum: [
|
|
@@ -4391,4 +4448,4 @@ const WebhookEventJsonSchemas = {
|
|
|
4391
4448
|
//#endregion
|
|
4392
4449
|
export { WebhookEventJsonSchemas as t };
|
|
4393
4450
|
|
|
4394
|
-
//# sourceMappingURL=json-schemas.gen-
|
|
4451
|
+
//# sourceMappingURL=json-schemas.gen-kztbWC65.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-
|
|
2
|
-
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-
|
|
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-D6Od0Usw.js";
|
|
2
|
+
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-kztbWC65.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
|