@samva/webhooks 0.43.3 → 0.45.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/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-Cup4zTAh.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-CwzHnoqu.js";
@@ -240,6 +240,8 @@ export declare const MessageReceivedEventSchema: Schema.StructWithRest<Schema.St
240
240
  readonly errorMessage: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
241
241
  readonly parts: Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Null]>>;
242
242
  readonly carrier: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
243
+ readonly disposition: Schema.Literals<readonly ["delivered", "quarantined", "isolated"]>;
244
+ readonly reason: Schema.Union<readonly [Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "verdict_missing", "phishing", "fraud", "prompt_injection"]>, Schema.Null]>;
243
245
  readonly campaign: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
244
246
  readonly campaignId: Schema.String;
245
247
  readonly runId: Schema.String;
@@ -1102,7 +1104,7 @@ export declare const MailboxMessageQuarantinedEventSchema: Schema.StructWithRest
1102
1104
  readonly mailboxId: Schema.String;
1103
1105
  readonly namespaceId: Schema.Union<readonly [Schema.String, Schema.Null]>;
1104
1106
  readonly disposition: Schema.Literals<readonly ["quarantined", "isolated"]>;
1105
- readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "phishing", "fraud", "prompt_injection"]>;
1107
+ readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "verdict_missing", "phishing", "fraud", "prompt_injection"]>;
1106
1108
  readonly source: Schema.Literals<readonly ["receipt", "classifier"]>;
1107
1109
  readonly message: Schema.StructWithRest<Schema.Struct<{
1108
1110
  readonly id: Schema.String;
@@ -1127,7 +1129,7 @@ export declare const MailboxMessageReleasedEventSchema: Schema.StructWithRest<Sc
1127
1129
  readonly displayName: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1128
1130
  readonly source: Schema.Literals<readonly ["humanUi", "externalApi", "externalAgent", "extension", "samvaManagedAgent", "system"]>;
1129
1131
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
1130
- readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "phishing", "fraud", "prompt_injection"]>;
1132
+ readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "verdict_missing", "phishing", "fraud", "prompt_injection"]>;
1131
1133
  readonly message: Schema.StructWithRest<Schema.Struct<{
1132
1134
  readonly id: Schema.String;
1133
1135
  readonly campaign: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
@@ -1174,7 +1176,7 @@ export declare const MailboxMessageDiscardedEventSchema: Schema.StructWithRest<S
1174
1176
  readonly source: Schema.Literals<readonly ["humanUi", "externalApi", "externalAgent", "extension", "samvaManagedAgent", "system"]>;
1175
1177
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
1176
1178
  readonly disposition: Schema.Literals<readonly ["quarantined", "isolated"]>;
1177
- readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "phishing", "fraud", "prompt_injection"]>;
1179
+ readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "verdict_missing", "phishing", "fraud", "prompt_injection"]>;
1178
1180
  readonly message: Schema.StructWithRest<Schema.Struct<{
1179
1181
  readonly id: Schema.String;
1180
1182
  readonly from: Schema.StructWithRest<Schema.Struct<{
@@ -1487,6 +1489,8 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
1487
1489
  readonly errorMessage: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1488
1490
  readonly parts: Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Null]>>;
1489
1491
  readonly carrier: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1492
+ readonly disposition: Schema.Literals<readonly ["delivered", "quarantined", "isolated"]>;
1493
+ readonly reason: Schema.Union<readonly [Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "verdict_missing", "phishing", "fraud", "prompt_injection"]>, Schema.Null]>;
1490
1494
  readonly campaign: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
1491
1495
  readonly campaignId: Schema.String;
1492
1496
  readonly runId: Schema.String;
@@ -2321,7 +2325,7 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
2321
2325
  readonly mailboxId: Schema.String;
2322
2326
  readonly namespaceId: Schema.Union<readonly [Schema.String, Schema.Null]>;
2323
2327
  readonly disposition: Schema.Literals<readonly ["quarantined", "isolated"]>;
2324
- readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "phishing", "fraud", "prompt_injection"]>;
2328
+ readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "verdict_missing", "phishing", "fraud", "prompt_injection"]>;
2325
2329
  readonly source: Schema.Literals<readonly ["receipt", "classifier"]>;
2326
2330
  readonly message: Schema.StructWithRest<Schema.Struct<{
2327
2331
  readonly id: Schema.String;
@@ -2345,7 +2349,7 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
2345
2349
  readonly displayName: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
2346
2350
  readonly source: Schema.Literals<readonly ["humanUi", "externalApi", "externalAgent", "extension", "samvaManagedAgent", "system"]>;
2347
2351
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
2348
- readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "phishing", "fraud", "prompt_injection"]>;
2352
+ readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "verdict_missing", "phishing", "fraud", "prompt_injection"]>;
2349
2353
  readonly message: Schema.StructWithRest<Schema.Struct<{
2350
2354
  readonly id: Schema.String;
2351
2355
  readonly campaign: Schema.optionalKey<Schema.Union<readonly [Schema.StructWithRest<Schema.Struct<{
@@ -2391,7 +2395,7 @@ export declare const SamvaWebhookEventSchema: Schema.Union<readonly [Schema.Stru
2391
2395
  readonly source: Schema.Literals<readonly ["humanUi", "externalApi", "externalAgent", "extension", "samvaManagedAgent", "system"]>;
2392
2396
  }>, readonly [Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>]>;
2393
2397
  readonly disposition: Schema.Literals<readonly ["quarantined", "isolated"]>;
2394
- readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "phishing", "fraud", "prompt_injection"]>;
2398
+ readonly reason: Schema.Literals<readonly ["spam", "dmarc", "virus", "virus_unscanned", "verdict_missing", "phishing", "fraud", "prompt_injection"]>;
2395
2399
  readonly message: Schema.StructWithRest<Schema.Struct<{
2396
2400
  readonly id: Schema.String;
2397
2401
  readonly from: Schema.StructWithRest<Schema.Struct<{
@@ -297,6 +297,21 @@ const MessageReceivedEventSchema = Schema.StructWithRest(Schema.Struct({
297
297
  errorMessage: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
298
298
  parts: Schema.optionalKey(Schema.Union([Schema.Finite, Schema.Null])),
299
299
  carrier: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
300
+ disposition: Schema.Literals([
301
+ "delivered",
302
+ "quarantined",
303
+ "isolated"
304
+ ]).annotate({ description: "The message disposition when this event was committed, before mailbox content screening." }),
305
+ reason: Schema.Union([Schema.Literals([
306
+ "spam",
307
+ "dmarc",
308
+ "virus",
309
+ "virus_unscanned",
310
+ "verdict_missing",
311
+ "phishing",
312
+ "fraud",
313
+ "prompt_injection"
314
+ ]), Schema.Null]).annotate({ description: "Why the message is held, or null when delivered." }),
300
315
  campaign: Schema.optionalKey(Schema.Union([Schema.StructWithRest(Schema.Struct({
301
316
  campaignId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^camp_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^camp_[0-9a-hjkmnp-tv-z]{16,24}$" })),
302
317
  runId: Schema.String.check(Schema.isPattern(new globalThis.RegExp("^crun_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({ expected: "a string matching the RegExp ^crun_[0-9a-hjkmnp-tv-z]{16,24}$" }))
@@ -1559,6 +1574,7 @@ const MailboxMessageQuarantinedEventSchema = Schema.StructWithRest(Schema.Struct
1559
1574
  "dmarc",
1560
1575
  "virus",
1561
1576
  "virus_unscanned",
1577
+ "verdict_missing",
1562
1578
  "phishing",
1563
1579
  "fraud",
1564
1580
  "prompt_injection"
@@ -1606,6 +1622,7 @@ const MailboxMessageReleasedEventSchema = Schema.StructWithRest(Schema.Struct({
1606
1622
  "dmarc",
1607
1623
  "virus",
1608
1624
  "virus_unscanned",
1625
+ "verdict_missing",
1609
1626
  "phishing",
1610
1627
  "fraud",
1611
1628
  "prompt_injection"
@@ -1679,6 +1696,7 @@ const MailboxMessageDiscardedEventSchema = Schema.StructWithRest(Schema.Struct({
1679
1696
  "dmarc",
1680
1697
  "virus",
1681
1698
  "virus_unscanned",
1699
+ "verdict_missing",
1682
1700
  "phishing",
1683
1701
  "fraud",
1684
1702
  "prompt_injection"
@@ -286,6 +286,8 @@ export type MessageReceivedEvent = {
286
286
  readonly errorMessage?: string | null;
287
287
  readonly parts?: number | null;
288
288
  readonly carrier?: string | null;
289
+ readonly disposition: "delivered" | "quarantined" | "isolated";
290
+ readonly reason: "spam" | "dmarc" | "virus" | "virus_unscanned" | "verdict_missing" | "phishing" | "fraud" | "prompt_injection" | null;
289
291
  readonly campaign?: ({
290
292
  readonly campaignId: string;
291
293
  readonly runId: string;
@@ -1478,7 +1480,7 @@ export type MailboxMessageQuarantinedEvent = {
1478
1480
  readonly mailboxId: string;
1479
1481
  readonly namespaceId: string | null;
1480
1482
  readonly disposition: "quarantined" | "isolated";
1481
- readonly reason: "spam" | "dmarc" | "virus" | "virus_unscanned" | "phishing" | "fraud" | "prompt_injection";
1483
+ readonly reason: "spam" | "dmarc" | "virus" | "virus_unscanned" | "verdict_missing" | "phishing" | "fraud" | "prompt_injection";
1482
1484
  readonly source: "receipt" | "classifier";
1483
1485
  readonly message: {
1484
1486
  readonly id: string;
@@ -1514,7 +1516,7 @@ export type MailboxMessageReleasedEvent = {
1514
1516
  } & {
1515
1517
  readonly [x: string]: JsonValue;
1516
1518
  };
1517
- readonly reason: "spam" | "dmarc" | "virus" | "virus_unscanned" | "phishing" | "fraud" | "prompt_injection";
1519
+ readonly reason: "spam" | "dmarc" | "virus" | "virus_unscanned" | "verdict_missing" | "phishing" | "fraud" | "prompt_injection";
1518
1520
  readonly message: {
1519
1521
  readonly id: string;
1520
1522
  readonly campaign?: ({
@@ -1578,7 +1580,7 @@ export type MailboxMessageDiscardedEvent = {
1578
1580
  readonly [x: string]: JsonValue;
1579
1581
  };
1580
1582
  readonly disposition: "quarantined" | "isolated";
1581
- readonly reason: "spam" | "dmarc" | "virus" | "virus_unscanned" | "phishing" | "fraud" | "prompt_injection";
1583
+ readonly reason: "spam" | "dmarc" | "virus" | "virus_unscanned" | "verdict_missing" | "phishing" | "fraud" | "prompt_injection";
1582
1584
  readonly message: {
1583
1585
  readonly id: string;
1584
1586
  readonly from: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samva/webhooks",
3
- "version": "0.43.3",
3
+ "version": "0.45.0",
4
4
  "description": "Runtime-neutral verification for Samva webhook deliveries",
5
5
  "keywords": [
6
6
  "samva",
@@ -56,13 +56,13 @@
56
56
  "access": "public"
57
57
  },
58
58
  "scripts": {
59
- "build": "tsdown && tsc --project tsconfig.build.json",
59
+ "build": "slot --all 'tsdown && tsc --project tsconfig.build.json \"$@\"'",
60
60
  "prepack": "bun run build",
61
- "test": "bun run test:generation && vitest run --root ../.. --project packages packages/webhooks/tests",
62
- "typecheck": "effect-tsgo tsrs --noEmit",
61
+ "test": "slot --all 'bun run test:generation && vitest run --root ../.. --project packages packages/webhooks/tests \"$@\"'",
62
+ "typecheck": "slot effect-tsgo tsrs --noEmit",
63
63
  "generate": "bun run --filter @samva/openapi build && bun run scripts/generate.ts",
64
- "test:generation": "bun run --filter @samva/openapi build && bun run scripts/generate.ts --check",
65
- "test:bundle": "bun run build && bun run scripts/check-bundle.ts"
64
+ "test:generation": "slot --all 'bun run --filter @samva/openapi build && bun run scripts/generate.ts --check \"$@\"'",
65
+ "test:bundle": "slot --all 'bun run build && bun run scripts/check-bundle.ts \"$@\"'"
66
66
  },
67
67
  "devDependencies": {
68
68
  "@effect/tsgo": "0.67.5",