@samva/webhooks 0.39.0 → 0.41.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,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-BXALcVid.js";
|
|
2
|
+
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-DTP5ehDZ.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, 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
|
// src/effect.ts
|
|
@@ -1803,7 +1803,7 @@ const WebhookEventJsonSchemas = {
|
|
|
1803
1803
|
email: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1804
1804
|
topicId: {
|
|
1805
1805
|
type: "string",
|
|
1806
|
-
pattern: "^
|
|
1806
|
+
pattern: "^tpc_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1807
1807
|
},
|
|
1808
1808
|
topicName: { type: "string" },
|
|
1809
1809
|
channel: {
|
|
@@ -1875,7 +1875,7 @@ const WebhookEventJsonSchemas = {
|
|
|
1875
1875
|
email: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1876
1876
|
topicId: {
|
|
1877
1877
|
type: "string",
|
|
1878
|
-
pattern: "^
|
|
1878
|
+
pattern: "^tpc_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1879
1879
|
},
|
|
1880
1880
|
topicName: { type: "string" },
|
|
1881
1881
|
channel: {
|
|
@@ -1947,7 +1947,7 @@ const WebhookEventJsonSchemas = {
|
|
|
1947
1947
|
email: { anyOf: [{ type: "string" }, { type: "null" }] },
|
|
1948
1948
|
topicId: {
|
|
1949
1949
|
type: "string",
|
|
1950
|
-
pattern: "^
|
|
1950
|
+
pattern: "^tpc_[0-9a-hjkmnp-tv-z]{16,24}$"
|
|
1951
1951
|
},
|
|
1952
1952
|
topicName: { type: "string" },
|
|
1953
1953
|
channel: {
|
|
@@ -4722,4 +4722,4 @@ const WebhookEventJsonSchemas = {
|
|
|
4722
4722
|
};
|
|
4723
4723
|
export { WebhookEventJsonSchemas as t };
|
|
4724
4724
|
|
|
4725
|
-
//# sourceMappingURL=json-schemas.gen-
|
|
4725
|
+
//# sourceMappingURL=json-schemas.gen-DTP5ehDZ.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-BXALcVid.js";
|
|
2
|
+
import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-DTP5ehDZ.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
|
|
@@ -162,7 +162,7 @@ const validate995 = (value) => typeof value === "string" && value === "contact.d
|
|
|
162
162
|
const validate1018 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1019(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1021(value["data"]));
|
|
163
163
|
const validate1019 = (value) => typeof value === "string" && value === "contact.subscribed";
|
|
164
164
|
const validate1021 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "organizationId") && Object.hasOwn(value, "contactId") && Object.hasOwn(value, "topicId") && Object.hasOwn(value, "topicName") && Object.hasOwn(value, "channel") && Object.hasOwn(value, "source") && Object.hasOwn(value, "occurredAt") && (!Object.hasOwn(value, "organizationId") || validate851(value["organizationId"])) && (!Object.hasOwn(value, "contactId") || validate950(value["contactId"])) && (!Object.hasOwn(value, "email") || validate8(value["email"])) && (!Object.hasOwn(value, "topicId") || validate1027(value["topicId"])) && (!Object.hasOwn(value, "topicName") || validate2(value["topicName"])) && (!Object.hasOwn(value, "channel") || validate7(value["channel"])) && (!Object.hasOwn(value, "consentIp") || validate8(value["consentIp"])) && (!Object.hasOwn(value, "consentSource") || validate8(value["consentSource"])) && (!Object.hasOwn(value, "source") || validate2(value["source"])) && (!Object.hasOwn(value, "formKey") || validate8(value["formKey"])) && (!Object.hasOwn(value, "page") || validate8(value["page"])) && (!Object.hasOwn(value, "referrer") || validate8(value["referrer"])) && (!Object.hasOwn(value, "messageId") || validate778(value["messageId"])) && (!Object.hasOwn(value, "campaignId") || validate888(value["campaignId"])) && (!Object.hasOwn(value, "campaignRunId") || validate891(value["campaignRunId"])) && (!Object.hasOwn(value, "occurredAt") || validate2(value["occurredAt"]));
|
|
165
|
-
const validate1027 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^
|
|
165
|
+
const validate1027 = (value) => typeof value === "string" && typeof value === "string" && (/* @__PURE__ */ new RegExp("^tpc_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).test(value);
|
|
166
166
|
const validate1056 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1057(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1021(value["data"]));
|
|
167
167
|
const validate1057 = (value) => typeof value === "string" && value === "contact.unsubscribed";
|
|
168
168
|
const validate1094 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "type") && Object.hasOwn(value, "timestamp") && Object.hasOwn(value, "data") && (!Object.hasOwn(value, "type") || validate1095(value["type"])) && (!Object.hasOwn(value, "timestamp") || validate2(value["timestamp"])) && (!Object.hasOwn(value, "data") || validate1021(value["data"]));
|
|
@@ -720,4 +720,4 @@ const readWebhookHeaders = (headers) => requireHeaders({
|
|
|
720
720
|
});
|
|
721
721
|
export { generateWebhookSecret as a, verifyWebhookAt as c, MalformedWebhookPayloadError as d, WebhookCryptoError as f, isKnownEvent as g, WebhookVerificationError as h, WEBHOOK_TIMESTAMP_HEADER as i, InvalidWebhookHeadersError as l, WebhookTimestampError as m, WEBHOOK_ID_HEADER as n, readWebhookHeaders as o, WebhookSignatureError as p, WEBHOOK_SIGNATURE_HEADER as r, signWebhook as s, DEFAULT_TOLERANCE_SECONDS as t, InvalidWebhookSecretError as u };
|
|
722
722
|
|
|
723
|
-
//# sourceMappingURL=protocol-
|
|
723
|
+
//# sourceMappingURL=protocol-BXALcVid.js.map
|
package/dist/protocol.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as DEFAULT_TOLERANCE_SECONDS, l as InvalidWebhookHeadersError, u as InvalidWebhookSecretError, d as MalformedWebhookPayloadError, n as WEBHOOK_ID_HEADER, r as WEBHOOK_SIGNATURE_HEADER, i as WEBHOOK_TIMESTAMP_HEADER, f as WebhookCryptoError, p as WebhookSignatureError, m as WebhookTimestampError, h as WebhookVerificationError, a as generateWebhookSecret, g as isKnownEvent, o as readWebhookHeaders, s as signWebhook, c as verifyWebhookAt } from "./protocol-
|
|
1
|
+
export { t as DEFAULT_TOLERANCE_SECONDS, l as InvalidWebhookHeadersError, u as InvalidWebhookSecretError, d as MalformedWebhookPayloadError, n as WEBHOOK_ID_HEADER, r as WEBHOOK_SIGNATURE_HEADER, i as WEBHOOK_TIMESTAMP_HEADER, f as WebhookCryptoError, p as WebhookSignatureError, m as WebhookTimestampError, h as WebhookVerificationError, a as generateWebhookSecret, g as isKnownEvent, o as readWebhookHeaders, s as signWebhook, c as verifyWebhookAt } from "./protocol-BXALcVid.js";
|
package/dist/schemas.gen.js
CHANGED
|
@@ -742,7 +742,7 @@ const ContactSubscribedEventSchema = Schema.StructWithRest(Schema.Struct({
|
|
|
742
742
|
organizationId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^org_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^org_[0-9a-hjkmnp-tv-z]{16,24}$" })),
|
|
743
743
|
contactId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^contact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^contact_[0-9a-hjkmnp-tv-z]{16,24}$" })),
|
|
744
744
|
email: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
745
|
-
topicId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^
|
|
745
|
+
topicId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^tpc_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^tpc_[0-9a-hjkmnp-tv-z]{16,24}$" })),
|
|
746
746
|
topicName: Schema.String,
|
|
747
747
|
channel: Schema.Literals([
|
|
748
748
|
"sms",
|
|
@@ -768,7 +768,7 @@ const ContactUnsubscribedEventSchema = Schema.StructWithRest(Schema.Struct({
|
|
|
768
768
|
organizationId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^org_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^org_[0-9a-hjkmnp-tv-z]{16,24}$" })),
|
|
769
769
|
contactId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^contact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^contact_[0-9a-hjkmnp-tv-z]{16,24}$" })),
|
|
770
770
|
email: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
771
|
-
topicId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^
|
|
771
|
+
topicId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^tpc_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^tpc_[0-9a-hjkmnp-tv-z]{16,24}$" })),
|
|
772
772
|
topicName: Schema.String,
|
|
773
773
|
channel: Schema.Literals([
|
|
774
774
|
"sms",
|
|
@@ -794,7 +794,7 @@ const ContactResubscribedEventSchema = Schema.StructWithRest(Schema.Struct({
|
|
|
794
794
|
organizationId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^org_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^org_[0-9a-hjkmnp-tv-z]{16,24}$" })),
|
|
795
795
|
contactId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^contact_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^contact_[0-9a-hjkmnp-tv-z]{16,24}$" })),
|
|
796
796
|
email: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
|
|
797
|
-
topicId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^
|
|
797
|
+
topicId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^tpc_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^tpc_[0-9a-hjkmnp-tv-z]{16,24}$" })),
|
|
798
798
|
topicName: Schema.String,
|
|
799
799
|
channel: Schema.Literals([
|
|
800
800
|
"sms",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@samva/webhooks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Runtime-neutral verification for Samva webhook deliveries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"samva",
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
"test:bundle": "bun run build && bun run scripts/check-bundle.ts"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@effect/tsgo": "0.
|
|
68
|
+
"@effect/tsgo": "0.67.5",
|
|
69
69
|
"@effect/vitest": "^4.1.2",
|
|
70
70
|
"@samva/openapi": "0.0.0",
|
|
71
71
|
"ajv": "^8.20.0",
|
|
72
72
|
"ajv-formats": "^3.0.1",
|
|
73
73
|
"effect": "^4.1.2",
|
|
74
|
-
"tsdown": "0.23.
|
|
74
|
+
"tsdown": "0.23.7",
|
|
75
75
|
"typescript": "^7.0.2",
|
|
76
76
|
"vitest": "5.0.3"
|
|
77
77
|
},
|