@samva/webhooks 0.43.0 → 0.43.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@samva/webhooks`
2
2
 
3
- Samva is the email and WhatsApp API for your app: transactional and campaign sending, inbound replies threaded into conversations, programmable mailboxes, and signed webhooks. AI agents get their own addresses and WhatsApp numbers on the same platform.
3
+ Samva is email and WhatsApp for AI agents, and the API developers build on. An agent gets its own address and WhatsApp number, and the same platform covers transactional and campaign sending, inbound replies threaded into conversations, programmable mailboxes, and signed webhooks.
4
4
 
5
5
  Verify signed Samva webhook deliveries in Node.js, Bun, Cloudflare Workers, and other Web
6
6
  Crypto-compatible runtimes.
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-BXALcVid.js";
2
- import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-DTP5ehDZ.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-Cup4zTAh.js";
2
+ import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-DmLfXny0.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
@@ -3614,6 +3614,7 @@ const WebhookEventJsonSchemas = {
3614
3614
  type: "string",
3615
3615
  enum: [
3616
3616
  "organization",
3617
+ "integration",
3617
3618
  "mailbox",
3618
3619
  "agent",
3619
3620
  "apiKey"
@@ -3638,6 +3639,7 @@ const WebhookEventJsonSchemas = {
3638
3639
  type: "string",
3639
3640
  enum: [
3640
3641
  "organization",
3642
+ "integration",
3641
3643
  "mailbox",
3642
3644
  "agent",
3643
3645
  "apiKey"
@@ -4722,4 +4724,4 @@ const WebhookEventJsonSchemas = {
4722
4724
  };
4723
4725
  export { WebhookEventJsonSchemas as t };
4724
4726
 
4725
- //# sourceMappingURL=json-schemas.gen-DTP5ehDZ.js.map
4727
+ //# sourceMappingURL=json-schemas.gen-DmLfXny0.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-BXALcVid.js";
2
- import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-DTP5ehDZ.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-Cup4zTAh.js";
2
+ import { t as WebhookEventJsonSchemas } from "./json-schemas.gen-DmLfXny0.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
@@ -293,7 +293,7 @@ const validate1571 = (value) => typeof value === "string" && (value === "allow"
293
293
  const validate1572 = (value) => typeof value === "string" && typeof value === "string" && Array.from(value).length >= 1;
294
294
  const validate1573 = (value) => Array.isArray(value) && Array.isArray(value) && value.every(validate1574);
295
295
  const validate1574 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "kind") && Object.hasOwn(value, "id") && (!Object.hasOwn(value, "kind") || validate1575(value["kind"])) && (!Object.hasOwn(value, "id") || validate1572(value["id"]));
296
- const validate1575 = (value) => typeof value === "string" && (value === "organization" || value === "mailbox" || value === "agent" || value === "apiKey");
296
+ const validate1575 = (value) => typeof value === "string" && (value === "organization" || value === "integration" || value === "mailbox" || value === "agent" || value === "apiKey");
297
297
  const validate1577 = (value) => validate1578(value) || validate6(value);
298
298
  const validate1578 = (value) => isObject(value) && isObject(value) && Object.hasOwn(value, "scope") && Object.hasOwn(value, "index") && (!Object.hasOwn(value, "scope") || validate1574(value["scope"])) && (!Object.hasOwn(value, "index") || validate1582(value["index"]));
299
299
  const validate1582 = (value) => typeof value === "number" && Number.isInteger(value) && typeof value === "number" && value >= 0 && typeof value === "number" && value <= 9007199254740991;
@@ -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-BXALcVid.js.map
723
+ //# sourceMappingURL=protocol-Cup4zTAh.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-BXALcVid.js";
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-Cup4zTAh.js";
@@ -1013,12 +1013,12 @@ export declare const MailboxActionPendingApprovalEventSchema: Schema.StructWithR
1013
1013
  readonly outcome: Schema.Literals<readonly ["allow", "hold", "refuse"]>;
1014
1014
  readonly reason: Schema.String;
1015
1015
  readonly scopes: Schema.$Array<Schema.StructWithRest<Schema.Struct<{
1016
- readonly kind: Schema.Literals<readonly ["organization", "mailbox", "agent", "apiKey"]>;
1016
+ readonly kind: Schema.Literals<readonly ["organization", "integration", "mailbox", "agent", "apiKey"]>;
1017
1017
  readonly id: Schema.String;
1018
1018
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
1019
1019
  readonly rule: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
1020
1020
  readonly scope: Schema.StructWithRest<Schema.Struct<{
1021
- readonly kind: Schema.Literals<readonly ["organization", "mailbox", "agent", "apiKey"]>;
1021
+ readonly kind: Schema.Literals<readonly ["organization", "integration", "mailbox", "agent", "apiKey"]>;
1022
1022
  readonly id: Schema.String;
1023
1023
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
1024
1024
  readonly index: Schema.Int;
@@ -2234,12 +2234,12 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
2234
2234
  readonly outcome: Schema.Literals<readonly ["allow", "hold", "refuse"]>;
2235
2235
  readonly reason: Schema.String;
2236
2236
  readonly scopes: Schema.$Array<Schema.StructWithRest<Schema.Struct<{
2237
- readonly kind: Schema.Literals<readonly ["organization", "mailbox", "agent", "apiKey"]>;
2237
+ readonly kind: Schema.Literals<readonly ["organization", "integration", "mailbox", "agent", "apiKey"]>;
2238
2238
  readonly id: Schema.String;
2239
2239
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>>;
2240
2240
  readonly rule: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
2241
2241
  readonly scope: Schema.StructWithRest<Schema.Struct<{
2242
- readonly kind: Schema.Literals<readonly ["organization", "mailbox", "agent", "apiKey"]>;
2242
+ readonly kind: Schema.Literals<readonly ["organization", "integration", "mailbox", "agent", "apiKey"]>;
2243
2243
  readonly id: Schema.String;
2244
2244
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
2245
2245
  readonly index: Schema.Int;
@@ -1393,6 +1393,7 @@ const MailboxActionPendingApprovalEventSchema = Schema.StructWithRest(Schema.Str
1393
1393
  scopes: Schema.Array(Schema.StructWithRest(Schema.Struct({
1394
1394
  kind: Schema.Literals([
1395
1395
  "organization",
1396
+ "integration",
1396
1397
  "mailbox",
1397
1398
  "agent",
1398
1399
  "apiKey"
@@ -1403,6 +1404,7 @@ const MailboxActionPendingApprovalEventSchema = Schema.StructWithRest(Schema.Str
1403
1404
  scope: Schema.StructWithRest(Schema.Struct({
1404
1405
  kind: Schema.Literals([
1405
1406
  "organization",
1407
+ "integration",
1406
1408
  "mailbox",
1407
1409
  "agent",
1408
1410
  "apiKey"
@@ -1345,14 +1345,14 @@ export type MailboxActionPendingApprovalEvent = {
1345
1345
  readonly outcome: "allow" | "hold" | "refuse";
1346
1346
  readonly reason: string;
1347
1347
  readonly scopes: ReadonlyArray<{
1348
- readonly kind: "organization" | "mailbox" | "agent" | "apiKey";
1348
+ readonly kind: "organization" | "integration" | "mailbox" | "agent" | "apiKey";
1349
1349
  readonly id: string;
1350
1350
  } & {
1351
1351
  readonly [x: string]: JsonValue;
1352
1352
  }>;
1353
1353
  readonly rule?: ({
1354
1354
  readonly scope: {
1355
- readonly kind: "organization" | "mailbox" | "agent" | "apiKey";
1355
+ readonly kind: "organization" | "integration" | "mailbox" | "agent" | "apiKey";
1356
1356
  readonly id: string;
1357
1357
  } & {
1358
1358
  readonly [x: string]: JsonValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samva/webhooks",
3
- "version": "0.43.0",
3
+ "version": "0.43.2",
4
4
  "description": "Runtime-neutral verification for Samva webhook deliveries",
5
5
  "keywords": [
6
6
  "samva",