@primitivedotdev/sdk 0.2.1 → 0.2.3

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
@@ -12,7 +12,7 @@ This package ships three Node.js modules:
12
12
 
13
13
  ## Requirements
14
14
 
15
- - Node.js `>=20`
15
+ - Node.js `>=22`
16
16
 
17
17
  ## Installation
18
18
 
@@ -1,5 +1,5 @@
1
- import { EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, ParsedDataComplete, ParsedDataFailed, ParsedError, RawContentDownloadOnly, RawContentInline, WebhookAttachment } from "../types-C6M6oCRS.js";
2
- import { SignResult, WEBHOOK_VERSION$1 as WEBHOOK_VERSION, signWebhookPayload$1 as signWebhookPayload } from "../index-pNcbeqPI.js";
1
+ import { EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, ParsedDataComplete, ParsedDataFailed, ParsedError, RawContentDownloadOnly, RawContentInline, WebhookAttachment } from "../types-B5IgP-Zx.js";
2
+ import { SignResult, WEBHOOK_VERSION$1 as WEBHOOK_VERSION, signWebhookPayload$1 as signWebhookPayload } from "../index-BdRIHaXz.js";
3
3
 
4
4
  //#region src/contract/contract.d.ts
5
5
  /** Maximum raw email size for inline inclusion (256 KB). */
@@ -86,8 +86,8 @@ interface EmailReceivedEventInput {
86
86
  * Generate a stable event ID for webhook deduplication.
87
87
  *
88
88
  * Format: `evt_{sha256_hex}` where the hash is deterministic based on the
89
- * event type, endpoint ID, and email ID. The same email sent
90
- * to the same endpoint will always get the same event ID.
89
+ * event type, webhook version, endpoint ID, and email ID. The same email
90
+ * sent to the same endpoint will always get the same event ID.
91
91
  *
92
92
  * @param endpoint_id - Webhook endpoint ID.
93
93
  * @param email_id - Primitive email ID.
@@ -1,4 +1,4 @@
1
- import { WEBHOOK_VERSION, signWebhookPayload, validateEmailReceivedEvent } from "../webhook-CqFsX50W.js";
1
+ import { WEBHOOK_VERSION, signWebhookPayload, validateEmailReceivedEvent } from "../webhook-Be2vM0F-.js";
2
2
  import { createHash } from "node:crypto";
3
3
 
4
4
  //#region src/contract/contract.ts
@@ -31,15 +31,15 @@ function validateTimestamp(timestamp, fieldName) {
31
31
  * Generate a stable event ID for webhook deduplication.
32
32
  *
33
33
  * Format: `evt_{sha256_hex}` where the hash is deterministic based on the
34
- * event type, endpoint ID, and email ID. The same email sent
35
- * to the same endpoint will always get the same event ID.
34
+ * event type, webhook version, endpoint ID, and email ID. The same email
35
+ * sent to the same endpoint will always get the same event ID.
36
36
  *
37
37
  * @param endpoint_id - Webhook endpoint ID.
38
38
  * @param email_id - Primitive email ID.
39
39
  * @returns Stable event ID with `evt_` prefix.
40
40
  */
41
41
  function generateEventId(endpoint_id, email_id) {
42
- const hashInput = `email.received:${endpoint_id}:${email_id}`;
42
+ const hashInput = `email.received:${WEBHOOK_VERSION}:${endpoint_id}:${email_id}`;
43
43
  const hash = createHash("sha256").update(hashInput).digest("hex");
44
44
  return `evt_${hash}`;
45
45
  }
@@ -1,4 +1,4 @@
1
- import { EmailAuth, EmailReceivedEvent, ValidateEmailAuthResult, WebhookEvent } from "./types-C6M6oCRS.js";
1
+ import { EmailAuth, EmailReceivedEvent, ValidateEmailAuthResult, WebhookEvent } from "./types-B5IgP-Zx.js";
2
2
  import { ErrorObject } from "ajv";
3
3
 
4
4
  //#region src/webhook/errors.d.ts
@@ -1034,11 +1034,11 @@ declare const emailReceivedEventJsonSchema: {
1034
1034
  };
1035
1035
  readonly dmarcSpfAligned: {
1036
1036
  readonly type: "boolean";
1037
- readonly description: "Whether SPF aligned with the From: domain for DMARC purposes.\n\nTrue if the envelope sender domain matches the From: domain (per alignment mode). Optional in self-hosted environments.";
1037
+ readonly description: "Whether SPF aligned with the From: domain for DMARC purposes.\n\nTrue if the envelope sender domain matches the From: domain (per alignment mode).";
1038
1038
  };
1039
1039
  readonly dmarcDkimAligned: {
1040
1040
  readonly type: "boolean";
1041
- readonly description: "Whether DKIM aligned with the From: domain for DMARC purposes.\n\nTrue if at least one DKIM signature's domain matches the From: domain. Optional in self-hosted environments.";
1041
+ readonly description: "Whether DKIM aligned with the From: domain for DMARC purposes.\n\nTrue if at least one DKIM signature's domain matches the From: domain.";
1042
1042
  };
1043
1043
  readonly dmarcSpfStrict: {
1044
1044
  readonly type: ["boolean", "null"];
@@ -1056,7 +1056,7 @@ declare const emailReceivedEventJsonSchema: {
1056
1056
  readonly description: "All DKIM signatures found in the email with their verification results.\n\nMay be empty if no DKIM signatures were present.";
1057
1057
  };
1058
1058
  };
1059
- readonly required: ["spf", "dmarc", "dmarcPolicy", "dmarcFromDomain", "dmarcSpfStrict", "dmarcDkimStrict", "dkimSignatures"];
1059
+ readonly required: ["spf", "dmarc", "dmarcPolicy", "dmarcFromDomain", "dmarcSpfAligned", "dmarcDkimAligned", "dmarcSpfStrict", "dmarcDkimStrict", "dkimSignatures"];
1060
1060
  readonly description: "Email authentication results for SPF, DKIM, and DMARC.\n\nUse `validateEmailAuth()` to compute a verdict based on these results.";
1061
1061
  };
1062
1062
  readonly SpfResult: {
@@ -1099,8 +1099,8 @@ declare const emailReceivedEventJsonSchema: {
1099
1099
  readonly description: "Signing algorithm (e.g., \"rsa-sha256\", \"ed25519-sha256\").\n\nOptional in self-hosted environments.";
1100
1100
  };
1101
1101
  };
1102
- readonly required: ["domain", "result", "aligned"];
1103
- readonly description: "Details about a single DKIM signature found in the email.\n\nAn email may have multiple DKIM signatures (e.g., one from the sending domain and one from the ESP). Each signature is verified independently.\n\nFields marked optional (`selector`, `keyBits`, `algo`) may be unavailable in self-hosted environments where the milter provides limited DKIM detail.";
1102
+ readonly required: ["domain", "selector", "result", "aligned", "keyBits", "algo"];
1103
+ readonly description: "Details about a single DKIM signature found in the email.\n\nAn email may have multiple DKIM signatures (e.g., one from the sending domain and one from the ESP). Each signature is verified independently.";
1104
1104
  };
1105
1105
  readonly DkimResult: {
1106
1106
  readonly type: "string";
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { AuthConfidence$1 as AuthConfidence, AuthVerdict$1 as AuthVerdict, DkimResult$1 as DkimResult, DkimSignature, DmarcPolicy$1 as DmarcPolicy, DmarcResult$1 as DmarcResult, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType$1 as EventType, ForwardAnalysis, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict$1 as ForwardVerdict, ForwardVerification, KnownWebhookEvent, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus$1 as ParsedStatus, RawContent, RawContentDownloadOnly, RawContentInline, SpfResult$1 as SpfResult, UnknownEvent, ValidateEmailAuthResult, WebhookAttachment, WebhookEvent } from "./types-C6M6oCRS.js";
2
- import { DecodeRawEmailOptions, HandleWebhookOptions, LEGACY_CONFIRMED_HEADER$1 as LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER$1 as LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS$1 as PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER$1 as PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER$1 as PRIMITIVE_SIGNATURE_HEADER, PrimitiveWebhookError$1 as PrimitiveWebhookError, RAW_EMAIL_ERRORS$1 as RAW_EMAIL_ERRORS, RawEmailDecodeError$1 as RawEmailDecodeError, RawEmailDecodeErrorCode, SignResult, VERIFICATION_ERRORS$1 as VERIFICATION_ERRORS, VerifyOptions, WEBHOOK_VERSION$1 as WEBHOOK_VERSION, WebhookErrorCode, WebhookHeaders, WebhookPayloadError$1 as WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError$1 as WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError$1 as WebhookVerificationError, WebhookVerificationErrorCode, confirmedHeaders$1 as confirmedHeaders, decodeRawEmail$1 as decodeRawEmail, emailReceivedEventJsonSchema$1 as emailReceivedEventJsonSchema, getDownloadTimeRemaining$1 as getDownloadTimeRemaining, handleWebhook$1 as handleWebhook, isDownloadExpired$1 as isDownloadExpired, isEmailReceivedEvent$1 as isEmailReceivedEvent, isRawIncluded$1 as isRawIncluded, parseWebhookEvent$1 as parseWebhookEvent, safeValidateEmailReceivedEvent$1 as safeValidateEmailReceivedEvent, signWebhookPayload$1 as signWebhookPayload, validateEmailAuth$1 as validateEmailAuth, validateEmailReceivedEvent$1 as validateEmailReceivedEvent, verifyRawEmailDownload$1 as verifyRawEmailDownload, verifyWebhookSignature$1 as verifyWebhookSignature } from "./index-pNcbeqPI.js";
1
+ import { AuthConfidence$1 as AuthConfidence, AuthVerdict$1 as AuthVerdict, DkimResult$1 as DkimResult, DkimSignature, DmarcPolicy$1 as DmarcPolicy, DmarcResult$1 as DmarcResult, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType$1 as EventType, ForwardAnalysis, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict$1 as ForwardVerdict, ForwardVerification, KnownWebhookEvent, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus$1 as ParsedStatus, RawContent, RawContentDownloadOnly, RawContentInline, SpfResult$1 as SpfResult, UnknownEvent, ValidateEmailAuthResult, WebhookAttachment, WebhookEvent } from "./types-B5IgP-Zx.js";
2
+ import { DecodeRawEmailOptions, HandleWebhookOptions, LEGACY_CONFIRMED_HEADER$1 as LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER$1 as LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS$1 as PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER$1 as PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER$1 as PRIMITIVE_SIGNATURE_HEADER, PrimitiveWebhookError$1 as PrimitiveWebhookError, RAW_EMAIL_ERRORS$1 as RAW_EMAIL_ERRORS, RawEmailDecodeError$1 as RawEmailDecodeError, RawEmailDecodeErrorCode, SignResult, VERIFICATION_ERRORS$1 as VERIFICATION_ERRORS, VerifyOptions, WEBHOOK_VERSION$1 as WEBHOOK_VERSION, WebhookErrorCode, WebhookHeaders, WebhookPayloadError$1 as WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError$1 as WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError$1 as WebhookVerificationError, WebhookVerificationErrorCode, confirmedHeaders$1 as confirmedHeaders, decodeRawEmail$1 as decodeRawEmail, emailReceivedEventJsonSchema$1 as emailReceivedEventJsonSchema, getDownloadTimeRemaining$1 as getDownloadTimeRemaining, handleWebhook$1 as handleWebhook, isDownloadExpired$1 as isDownloadExpired, isEmailReceivedEvent$1 as isEmailReceivedEvent, isRawIncluded$1 as isRawIncluded, parseWebhookEvent$1 as parseWebhookEvent, safeValidateEmailReceivedEvent$1 as safeValidateEmailReceivedEvent, signWebhookPayload$1 as signWebhookPayload, validateEmailAuth$1 as validateEmailAuth, validateEmailReceivedEvent$1 as validateEmailReceivedEvent, verifyRawEmailDownload$1 as verifyRawEmailDownload, verifyWebhookSignature$1 as verifyWebhookSignature } from "./index-BdRIHaXz.js";
3
3
  export { AuthConfidence, AuthVerdict, DecodeRawEmailOptions, DkimResult, DkimSignature, DmarcPolicy, DmarcResult, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType, ForwardAnalysis, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict, ForwardVerification, HandleWebhookOptions, KnownWebhookEvent, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawContent, RawContentDownloadOnly, RawContentInline, RawEmailDecodeError, RawEmailDecodeErrorCode, SignResult, SpfResult, UnknownEvent, VERIFICATION_ERRORS, ValidateEmailAuthResult, VerifyOptions, WEBHOOK_VERSION, WebhookAttachment, WebhookErrorCode, WebhookEvent, WebhookHeaders, WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError, WebhookVerificationErrorCode, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, safeValidateEmailReceivedEvent, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyRawEmailDownload, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, safeValidateEmailReceivedEvent, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyRawEmailDownload, verifyWebhookSignature } from "./webhook-CqFsX50W.js";
1
+ import { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, safeValidateEmailReceivedEvent, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyRawEmailDownload, verifyWebhookSignature } from "./webhook-Be2vM0F-.js";
2
2
 
3
3
  export { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, safeValidateEmailReceivedEvent, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyRawEmailDownload, verifyWebhookSignature };
@@ -1,4 +1,4 @@
1
- import { EmailAddress, ParsedDataComplete, WebhookAttachment } from "../types-C6M6oCRS.js";
1
+ import { EmailAddress, ParsedDataComplete, WebhookAttachment } from "../types-B5IgP-Zx.js";
2
2
 
3
3
  //#region src/parser/attachment-parser.d.ts
4
4
  interface ParsedAttachment {
@@ -1,12 +1,10 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { PassThrough } from "node:stream";
3
+ import archiver from "archiver";
4
+ import { simpleParser } from "mailparser";
3
5
  import DOMPurify from "isomorphic-dompurify";
4
6
 
5
7
  //#region src/parser/attachment-bundler.ts
6
- async function loadArchiver() {
7
- const module = await import("archiver");
8
- return module.default;
9
- }
10
8
  /**
11
9
  * Bundle downloadable attachments into a tar.gz archive.
12
10
  *
@@ -20,7 +18,6 @@ async function loadArchiver() {
20
18
  async function bundleAttachments(attachments) {
21
19
  const downloadable = attachments.filter((att) => att.isDownloadable);
22
20
  if (downloadable.length === 0) return null;
23
- const archiver = await loadArchiver();
24
21
  const archive = archiver("tar", {
25
22
  gzip: true,
26
23
  gzipOptions: { level: 6 }
@@ -181,51 +178,49 @@ const ALLOWED_ATTRS = [
181
178
  "size",
182
179
  "face"
183
180
  ];
184
- const ALLOWED_URI_REGEXP = /^(data:|mailto:|#)/i;
181
+ const ALLOWED_URI_REGEXP = /^(https?:|data:image\/(?!svg\+xml)[a-z0-9][a-z0-9+.-]*[;,]|mailto:|cid:|#)/i;
182
+ const SVG_DATA_URI_RE = /^data:image\/svg\+xml/i;
183
+ DOMPurify.addHook("uponSanitizeAttribute", (_node, data) => {
184
+ if (data.attrName.startsWith("on")) data.keepAttr = false;
185
+ if (data.attrName === "style") data.keepAttr = false;
186
+ if ((data.attrName === "src" || data.attrName === "href") && SVG_DATA_URI_RE.test(data.attrValue)) data.keepAttr = false;
187
+ });
188
+ DOMPurify.addHook("afterSanitizeAttributes", (node) => {
189
+ if (node.tagName === "A") {
190
+ const target = node.getAttribute("target");
191
+ if (target === "_blank") node.setAttribute("rel", "noopener noreferrer");
192
+ }
193
+ });
194
+ const SANITIZE_OPTIONS = {
195
+ ALLOWED_TAGS,
196
+ ALLOWED_ATTR: ALLOWED_ATTRS,
197
+ ALLOW_DATA_ATTR: false,
198
+ ALLOW_UNKNOWN_PROTOCOLS: false,
199
+ ALLOWED_URI_REGEXP,
200
+ FORBID_TAGS: [
201
+ "style",
202
+ "script",
203
+ "iframe",
204
+ "object",
205
+ "embed",
206
+ "form",
207
+ "input",
208
+ "button",
209
+ "select",
210
+ "textarea",
211
+ "link",
212
+ "meta",
213
+ "base",
214
+ "svg",
215
+ "math"
216
+ ]
217
+ };
185
218
  function sanitizeHtml(html) {
186
- DOMPurify.addHook("uponSanitizeAttribute", (_node, data) => {
187
- if (data.attrName.startsWith("on")) data.keepAttr = false;
188
- if (data.attrName === "style") data.keepAttr = false;
189
- });
190
- DOMPurify.addHook("afterSanitizeAttributes", (node) => {
191
- if (node.tagName === "A") {
192
- const target = node.getAttribute("target");
193
- if (target === "_blank") node.setAttribute("rel", "noopener noreferrer");
194
- }
195
- });
196
- const result = DOMPurify.sanitize(html, {
197
- ALLOWED_TAGS,
198
- ALLOWED_ATTR: ALLOWED_ATTRS,
199
- ALLOW_DATA_ATTR: false,
200
- ALLOW_UNKNOWN_PROTOCOLS: false,
201
- ALLOWED_URI_REGEXP,
202
- FORBID_TAGS: [
203
- "style",
204
- "script",
205
- "iframe",
206
- "object",
207
- "embed",
208
- "form",
209
- "input",
210
- "button",
211
- "select",
212
- "textarea",
213
- "link",
214
- "meta",
215
- "base",
216
- "svg",
217
- "math"
218
- ]
219
- });
220
- DOMPurify.removeAllHooks();
221
- return result;
219
+ return DOMPurify.sanitize(html, SANITIZE_OPTIONS);
222
220
  }
223
221
 
224
222
  //#endregion
225
223
  //#region src/parser/attachment-parser.ts
226
- async function loadMailparser$1() {
227
- return import("mailparser");
228
- }
229
224
  const SIGNATURE_ARTIFACTS = new Set([
230
225
  "application/pkcs7-signature",
231
226
  "application/x-pkcs7-signature",
@@ -251,7 +246,6 @@ const SAFE_INLINE_TYPES = new Set([
251
246
  */
252
247
  async function parseEmailWithAttachments(emlBuffer, options) {
253
248
  const generateId = options?.generateAttachmentId ?? (() => crypto.randomUUID());
254
- const { simpleParser } = await loadMailparser$1();
255
249
  const parsed = await simpleParser(emlBuffer);
256
250
  const attachments = [];
257
251
  for (let i = 0; i < (parsed.attachments?.length ?? 0); i++) {
@@ -399,15 +393,11 @@ function sanitizeFilename(filename, partIndex) {
399
393
 
400
394
  //#endregion
401
395
  //#region src/parser/email-parser.ts
402
- async function loadMailparser() {
403
- return import("mailparser");
404
- }
405
396
  /**
406
397
  * Parse a raw .eml file into structured data
407
398
  * Uses mailparser library for robust email parsing
408
399
  */
409
400
  async function parseEmail(emlRaw) {
410
- const { simpleParser } = await loadMailparser();
411
401
  const parsed = await simpleParser(emlRaw);
412
402
  const headers = {};
413
403
  parsed.headers.forEach((value, key) => {
@@ -614,15 +614,15 @@ interface EmailAuth$1 {
614
614
  /**
615
615
  * Whether SPF aligned with the From: domain for DMARC purposes.
616
616
  *
617
- * True if the envelope sender domain matches the From: domain (per alignment mode). Optional in self-hosted environments.
617
+ * True if the envelope sender domain matches the From: domain (per alignment mode).
618
618
  */
619
- dmarcSpfAligned?: boolean;
619
+ dmarcSpfAligned: boolean;
620
620
  /**
621
621
  * Whether DKIM aligned with the From: domain for DMARC purposes.
622
622
  *
623
- * True if at least one DKIM signature's domain matches the From: domain. Optional in self-hosted environments.
623
+ * True if at least one DKIM signature's domain matches the From: domain.
624
624
  */
625
- dmarcDkimAligned?: boolean;
625
+ dmarcDkimAligned: boolean;
626
626
  /**
627
627
  * Whether DMARC SPF alignment mode is strict.
628
628
  *
@@ -651,8 +651,6 @@ interface EmailAuth$1 {
651
651
  *
652
652
  * An email may have multiple DKIM signatures (e.g., one from the sending domain and one from the ESP). Each signature is verified independently.
653
653
  *
654
- * Fields marked optional (`selector`, `keyBits`, `algo`) may be unavailable in self-hosted environments where the milter provides limited DKIM detail.
655
- *
656
654
  * This interface was referenced by `EmailReceivedEvent`'s JSON-Schema
657
655
  * via the `definition` "DkimSignature".
658
656
  */
@@ -666,7 +664,7 @@ interface DkimSignature$1 {
666
664
  *
667
665
  * Optional in self-hosted environments where the milter may not provide selector info.
668
666
  */
669
- selector?: (string | null);
667
+ selector: (string | null);
670
668
  /**
671
669
  * Verification result for this specific signature.
672
670
  */
@@ -684,13 +682,13 @@ interface DkimSignature$1 {
684
682
  *
685
683
  * Optional in self-hosted environments.
686
684
  */
687
- keyBits?: (number | null);
685
+ keyBits: (number | null);
688
686
  /**
689
687
  * Signing algorithm (e.g., "rsa-sha256", "ed25519-sha256").
690
688
  *
691
689
  * Optional in self-hosted environments.
692
690
  */
693
- algo?: (string | null);
691
+ algo: (string | null);
694
692
  } //#endregion
695
693
  //#region src/types.d.ts
696
694
 
@@ -1,3 +1,3 @@
1
- import { AuthConfidence$1 as AuthConfidence, AuthVerdict$1 as AuthVerdict, DkimResult$1 as DkimResult, DkimSignature, DmarcPolicy$1 as DmarcPolicy, DmarcResult$1 as DmarcResult, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType$1 as EventType, ForwardAnalysis, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict$1 as ForwardVerdict, ForwardVerification, KnownWebhookEvent, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus$1 as ParsedStatus, RawContent, RawContentDownloadOnly, RawContentInline, SpfResult$1 as SpfResult, UnknownEvent, ValidateEmailAuthResult, WebhookAttachment, WebhookEvent } from "../types-C6M6oCRS.js";
2
- import { DecodeRawEmailOptions, HandleWebhookOptions, LEGACY_CONFIRMED_HEADER$1 as LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER$1 as LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS$1 as PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER$1 as PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER$1 as PRIMITIVE_SIGNATURE_HEADER, PrimitiveWebhookError$1 as PrimitiveWebhookError, RAW_EMAIL_ERRORS$1 as RAW_EMAIL_ERRORS, RawEmailDecodeError$1 as RawEmailDecodeError, RawEmailDecodeErrorCode, SignResult, VERIFICATION_ERRORS$1 as VERIFICATION_ERRORS, VerifyOptions, WEBHOOK_VERSION$1 as WEBHOOK_VERSION, WebhookErrorCode, WebhookHeaders, WebhookPayloadError$1 as WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError$1 as WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError$1 as WebhookVerificationError, WebhookVerificationErrorCode, confirmedHeaders$1 as confirmedHeaders, decodeRawEmail$1 as decodeRawEmail, emailReceivedEventJsonSchema$1 as emailReceivedEventJsonSchema, getDownloadTimeRemaining$1 as getDownloadTimeRemaining, handleWebhook$1 as handleWebhook, isDownloadExpired$1 as isDownloadExpired, isEmailReceivedEvent$1 as isEmailReceivedEvent, isRawIncluded$1 as isRawIncluded, parseWebhookEvent$1 as parseWebhookEvent, safeValidateEmailReceivedEvent$1 as safeValidateEmailReceivedEvent, signWebhookPayload$1 as signWebhookPayload, validateEmailAuth$1 as validateEmailAuth, validateEmailReceivedEvent$1 as validateEmailReceivedEvent, verifyRawEmailDownload$1 as verifyRawEmailDownload, verifyWebhookSignature$1 as verifyWebhookSignature } from "../index-pNcbeqPI.js";
1
+ import { AuthConfidence$1 as AuthConfidence, AuthVerdict$1 as AuthVerdict, DkimResult$1 as DkimResult, DkimSignature, DmarcPolicy$1 as DmarcPolicy, DmarcResult$1 as DmarcResult, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType$1 as EventType, ForwardAnalysis, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict$1 as ForwardVerdict, ForwardVerification, KnownWebhookEvent, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus$1 as ParsedStatus, RawContent, RawContentDownloadOnly, RawContentInline, SpfResult$1 as SpfResult, UnknownEvent, ValidateEmailAuthResult, WebhookAttachment, WebhookEvent } from "../types-B5IgP-Zx.js";
2
+ import { DecodeRawEmailOptions, HandleWebhookOptions, LEGACY_CONFIRMED_HEADER$1 as LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER$1 as LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS$1 as PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER$1 as PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER$1 as PRIMITIVE_SIGNATURE_HEADER, PrimitiveWebhookError$1 as PrimitiveWebhookError, RAW_EMAIL_ERRORS$1 as RAW_EMAIL_ERRORS, RawEmailDecodeError$1 as RawEmailDecodeError, RawEmailDecodeErrorCode, SignResult, VERIFICATION_ERRORS$1 as VERIFICATION_ERRORS, VerifyOptions, WEBHOOK_VERSION$1 as WEBHOOK_VERSION, WebhookErrorCode, WebhookHeaders, WebhookPayloadError$1 as WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError$1 as WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError$1 as WebhookVerificationError, WebhookVerificationErrorCode, confirmedHeaders$1 as confirmedHeaders, decodeRawEmail$1 as decodeRawEmail, emailReceivedEventJsonSchema$1 as emailReceivedEventJsonSchema, getDownloadTimeRemaining$1 as getDownloadTimeRemaining, handleWebhook$1 as handleWebhook, isDownloadExpired$1 as isDownloadExpired, isEmailReceivedEvent$1 as isEmailReceivedEvent, isRawIncluded$1 as isRawIncluded, parseWebhookEvent$1 as parseWebhookEvent, safeValidateEmailReceivedEvent$1 as safeValidateEmailReceivedEvent, signWebhookPayload$1 as signWebhookPayload, validateEmailAuth$1 as validateEmailAuth, validateEmailReceivedEvent$1 as validateEmailReceivedEvent, verifyRawEmailDownload$1 as verifyRawEmailDownload, verifyWebhookSignature$1 as verifyWebhookSignature } from "../index-BdRIHaXz.js";
3
3
  export { AuthConfidence, AuthVerdict, DecodeRawEmailOptions, DkimResult, DkimSignature, DmarcPolicy, DmarcResult, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType, ForwardAnalysis, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict, ForwardVerification, HandleWebhookOptions, KnownWebhookEvent, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawContent, RawContentDownloadOnly, RawContentInline, RawEmailDecodeError, RawEmailDecodeErrorCode, SignResult, SpfResult, UnknownEvent, VERIFICATION_ERRORS, ValidateEmailAuthResult, VerifyOptions, WEBHOOK_VERSION, WebhookAttachment, WebhookErrorCode, WebhookEvent, WebhookHeaders, WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError, WebhookVerificationErrorCode, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, safeValidateEmailReceivedEvent, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyRawEmailDownload, verifyWebhookSignature };
@@ -1,3 +1,3 @@
1
- import { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, safeValidateEmailReceivedEvent, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyRawEmailDownload, verifyWebhookSignature } from "../webhook-CqFsX50W.js";
1
+ import { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, safeValidateEmailReceivedEvent, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyRawEmailDownload, verifyWebhookSignature } from "../webhook-Be2vM0F-.js";
2
2
 
3
3
  export { AuthConfidence, AuthVerdict, DkimResult, DmarcPolicy, DmarcResult, EventType, ForwardVerdict, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedStatus, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawEmailDecodeError, SpfResult, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, getDownloadTimeRemaining, handleWebhook, isDownloadExpired, isEmailReceivedEvent, isRawIncluded, parseWebhookEvent, safeValidateEmailReceivedEvent, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyRawEmailDownload, verifyWebhookSignature };
@@ -1,10 +1,5 @@
1
- import { createRequire } from "module";
2
1
  import { createHash, createHmac, timingSafeEqual } from "node:crypto";
3
2
 
4
- //#region rolldown:runtime
5
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
6
-
7
- //#endregion
8
3
  //#region src/generated/email-received-event.validator.generated.ts
9
4
  var email_received_event_validator_generated_default = validate10;
10
5
  const schema12 = {
@@ -190,9 +185,8 @@ const schema12 = {
190
185
  const pattern0 = new RegExp("^evt_[a-f0-9]{64}$", "u");
191
186
  const pattern1 = new RegExp("^(?:(?:\\d{4}-(?:(?:01|03|05|07|08|10|12)-(?:0[1-9]|[12]\\d|3[01])|(?:04|06|09|11)-(?:0[1-9]|[12]\\d|30)|02-(?:0[1-9]|1\\d|2[0-8])))|(?:(?:[02468][048]00|[13579][26]00|\\d{2}(?:0[48]|[2468][048]|[13579][26]))-02-29))$", "u");
192
187
  const pattern4 = new RegExp("^https://", "u");
193
- const formats0 = __require("ajv-formats/dist/formats").fullFormats["date-time"];
194
- const formats4 = __require("ajv-formats/dist/formats").fullFormats.uri;
195
- const func2 = __require("ajv/dist/runtime/ucs2length").default;
188
+ const formats0 = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])[T\t ](?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:[Zz]|[+-](?:[01]\d|2[0-3]):?[0-5]\d)$/;
189
+ const formats4 = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
196
190
  const pattern2 = new RegExp("^[a-fA-F0-9]{64}$", "u");
197
191
  function validate12(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
198
192
  let vErrors = null;
@@ -1810,7 +1804,7 @@ function validate15(data, { instancePath = "", parentData, parentDataProperty, r
1810
1804
  else vErrors.push(err66);
1811
1805
  errors++;
1812
1806
  }
1813
- if (!formats4(data28)) {
1807
+ if (!formats4.test(data28)) {
1814
1808
  const err67 = {
1815
1809
  instancePath: instancePath + "/attachments_download_url",
1816
1810
  schemaPath: "#/properties/attachments_download_url/format",
@@ -4048,11 +4042,11 @@ const schema38 = {
4048
4042
  },
4049
4043
  "dmarcSpfAligned": {
4050
4044
  "type": "boolean",
4051
- "description": "Whether SPF aligned with the From: domain for DMARC purposes.\n\nTrue if the envelope sender domain matches the From: domain (per alignment mode). Optional in self-hosted environments."
4045
+ "description": "Whether SPF aligned with the From: domain for DMARC purposes.\n\nTrue if the envelope sender domain matches the From: domain (per alignment mode)."
4052
4046
  },
4053
4047
  "dmarcDkimAligned": {
4054
4048
  "type": "boolean",
4055
- "description": "Whether DKIM aligned with the From: domain for DMARC purposes.\n\nTrue if at least one DKIM signature's domain matches the From: domain. Optional in self-hosted environments."
4049
+ "description": "Whether DKIM aligned with the From: domain for DMARC purposes.\n\nTrue if at least one DKIM signature's domain matches the From: domain."
4056
4050
  },
4057
4051
  "dmarcSpfStrict": {
4058
4052
  "type": ["boolean", "null"],
@@ -4073,6 +4067,8 @@ const schema38 = {
4073
4067
  "dmarc",
4074
4068
  "dmarcPolicy",
4075
4069
  "dmarcFromDomain",
4070
+ "dmarcSpfAligned",
4071
+ "dmarcDkimAligned",
4076
4072
  "dmarcSpfStrict",
4077
4073
  "dmarcDkimStrict",
4078
4074
  "dkimSignatures"
@@ -4135,10 +4131,13 @@ const schema42 = {
4135
4131
  },
4136
4132
  "required": [
4137
4133
  "domain",
4134
+ "selector",
4138
4135
  "result",
4139
- "aligned"
4136
+ "aligned",
4137
+ "keyBits",
4138
+ "algo"
4140
4139
  ],
4141
- "description": "Details about a single DKIM signature found in the email.\n\nAn email may have multiple DKIM signatures (e.g., one from the sending domain and one from the ESP). Each signature is verified independently.\n\nFields marked optional (`selector`, `keyBits`, `algo`) may be unavailable in self-hosted environments where the milter provides limited DKIM detail."
4140
+ "description": "Details about a single DKIM signature found in the email.\n\nAn email may have multiple DKIM signatures (e.g., one from the sending domain and one from the ESP). Each signature is verified independently."
4142
4141
  };
4143
4142
  const schema43 = {
4144
4143
  "type": "string",
@@ -4166,117 +4165,153 @@ function validate34(data, { instancePath = "", parentData, parentDataProperty, r
4166
4165
  else vErrors.push(err0);
4167
4166
  errors++;
4168
4167
  }
4169
- if (data.result === void 0) {
4168
+ if (data.selector === void 0) {
4170
4169
  const err1 = {
4171
4170
  instancePath,
4172
4171
  schemaPath: "#/required",
4173
4172
  keyword: "required",
4174
- params: { missingProperty: "result" },
4175
- message: "must have required property 'result'"
4173
+ params: { missingProperty: "selector" },
4174
+ message: "must have required property 'selector'"
4176
4175
  };
4177
4176
  if (vErrors === null) vErrors = [err1];
4178
4177
  else vErrors.push(err1);
4179
4178
  errors++;
4180
4179
  }
4181
- if (data.aligned === void 0) {
4180
+ if (data.result === void 0) {
4182
4181
  const err2 = {
4183
4182
  instancePath,
4184
4183
  schemaPath: "#/required",
4185
4184
  keyword: "required",
4186
- params: { missingProperty: "aligned" },
4187
- message: "must have required property 'aligned'"
4185
+ params: { missingProperty: "result" },
4186
+ message: "must have required property 'result'"
4188
4187
  };
4189
4188
  if (vErrors === null) vErrors = [err2];
4190
4189
  else vErrors.push(err2);
4191
4190
  errors++;
4192
4191
  }
4192
+ if (data.aligned === void 0) {
4193
+ const err3 = {
4194
+ instancePath,
4195
+ schemaPath: "#/required",
4196
+ keyword: "required",
4197
+ params: { missingProperty: "aligned" },
4198
+ message: "must have required property 'aligned'"
4199
+ };
4200
+ if (vErrors === null) vErrors = [err3];
4201
+ else vErrors.push(err3);
4202
+ errors++;
4203
+ }
4204
+ if (data.keyBits === void 0) {
4205
+ const err4 = {
4206
+ instancePath,
4207
+ schemaPath: "#/required",
4208
+ keyword: "required",
4209
+ params: { missingProperty: "keyBits" },
4210
+ message: "must have required property 'keyBits'"
4211
+ };
4212
+ if (vErrors === null) vErrors = [err4];
4213
+ else vErrors.push(err4);
4214
+ errors++;
4215
+ }
4216
+ if (data.algo === void 0) {
4217
+ const err5 = {
4218
+ instancePath,
4219
+ schemaPath: "#/required",
4220
+ keyword: "required",
4221
+ params: { missingProperty: "algo" },
4222
+ message: "must have required property 'algo'"
4223
+ };
4224
+ if (vErrors === null) vErrors = [err5];
4225
+ else vErrors.push(err5);
4226
+ errors++;
4227
+ }
4193
4228
  if (data.domain !== void 0) {
4194
4229
  if (typeof data.domain !== "string") {
4195
- const err3 = {
4230
+ const err6 = {
4196
4231
  instancePath: instancePath + "/domain",
4197
4232
  schemaPath: "#/properties/domain/type",
4198
4233
  keyword: "type",
4199
4234
  params: { type: "string" },
4200
4235
  message: "must be string"
4201
4236
  };
4202
- if (vErrors === null) vErrors = [err3];
4203
- else vErrors.push(err3);
4237
+ if (vErrors === null) vErrors = [err6];
4238
+ else vErrors.push(err6);
4204
4239
  errors++;
4205
4240
  }
4206
4241
  }
4207
4242
  if (data.selector !== void 0) {
4208
4243
  let data1 = data.selector;
4209
4244
  if (typeof data1 !== "string" && data1 !== null) {
4210
- const err4 = {
4245
+ const err7 = {
4211
4246
  instancePath: instancePath + "/selector",
4212
4247
  schemaPath: "#/properties/selector/type",
4213
4248
  keyword: "type",
4214
4249
  params: { type: schema42.properties.selector.type },
4215
4250
  message: "must be string,null"
4216
4251
  };
4217
- if (vErrors === null) vErrors = [err4];
4218
- else vErrors.push(err4);
4252
+ if (vErrors === null) vErrors = [err7];
4253
+ else vErrors.push(err7);
4219
4254
  errors++;
4220
4255
  }
4221
4256
  }
4222
4257
  if (data.result !== void 0) {
4223
4258
  let data2 = data.result;
4224
4259
  if (typeof data2 !== "string") {
4225
- const err5 = {
4260
+ const err8 = {
4226
4261
  instancePath: instancePath + "/result",
4227
4262
  schemaPath: "#/definitions/DkimResult/type",
4228
4263
  keyword: "type",
4229
4264
  params: { type: "string" },
4230
4265
  message: "must be string"
4231
4266
  };
4232
- if (vErrors === null) vErrors = [err5];
4233
- else vErrors.push(err5);
4267
+ if (vErrors === null) vErrors = [err8];
4268
+ else vErrors.push(err8);
4234
4269
  errors++;
4235
4270
  }
4236
4271
  if (!(data2 === "pass" || data2 === "fail" || data2 === "temperror" || data2 === "permerror")) {
4237
- const err6 = {
4272
+ const err9 = {
4238
4273
  instancePath: instancePath + "/result",
4239
4274
  schemaPath: "#/definitions/DkimResult/enum",
4240
4275
  keyword: "enum",
4241
4276
  params: { allowedValues: schema43.enum },
4242
4277
  message: "must be equal to one of the allowed values"
4243
4278
  };
4244
- if (vErrors === null) vErrors = [err6];
4245
- else vErrors.push(err6);
4279
+ if (vErrors === null) vErrors = [err9];
4280
+ else vErrors.push(err9);
4246
4281
  errors++;
4247
4282
  }
4248
4283
  }
4249
4284
  if (data.aligned !== void 0) {
4250
4285
  if (typeof data.aligned !== "boolean") {
4251
- const err7 = {
4286
+ const err10 = {
4252
4287
  instancePath: instancePath + "/aligned",
4253
4288
  schemaPath: "#/properties/aligned/type",
4254
4289
  keyword: "type",
4255
4290
  params: { type: "boolean" },
4256
4291
  message: "must be boolean"
4257
4292
  };
4258
- if (vErrors === null) vErrors = [err7];
4259
- else vErrors.push(err7);
4293
+ if (vErrors === null) vErrors = [err10];
4294
+ else vErrors.push(err10);
4260
4295
  errors++;
4261
4296
  }
4262
4297
  }
4263
4298
  if (data.keyBits !== void 0) {
4264
4299
  let data4 = data.keyBits;
4265
4300
  if (!(typeof data4 == "number" && !(data4 % 1) && !isNaN(data4)) && data4 !== null) {
4266
- const err8 = {
4301
+ const err11 = {
4267
4302
  instancePath: instancePath + "/keyBits",
4268
4303
  schemaPath: "#/properties/keyBits/type",
4269
4304
  keyword: "type",
4270
4305
  params: { type: schema42.properties.keyBits.type },
4271
4306
  message: "must be integer,null"
4272
4307
  };
4273
- if (vErrors === null) vErrors = [err8];
4274
- else vErrors.push(err8);
4308
+ if (vErrors === null) vErrors = [err11];
4309
+ else vErrors.push(err11);
4275
4310
  errors++;
4276
4311
  }
4277
4312
  if (typeof data4 == "number") {
4278
4313
  if (data4 > 16384 || isNaN(data4)) {
4279
- const err9 = {
4314
+ const err12 = {
4280
4315
  instancePath: instancePath + "/keyBits",
4281
4316
  schemaPath: "#/properties/keyBits/maximum",
4282
4317
  keyword: "maximum",
@@ -4286,12 +4321,12 @@ function validate34(data, { instancePath = "", parentData, parentDataProperty, r
4286
4321
  },
4287
4322
  message: "must be <= 16384"
4288
4323
  };
4289
- if (vErrors === null) vErrors = [err9];
4290
- else vErrors.push(err9);
4324
+ if (vErrors === null) vErrors = [err12];
4325
+ else vErrors.push(err12);
4291
4326
  errors++;
4292
4327
  }
4293
4328
  if (data4 < 1 || isNaN(data4)) {
4294
- const err10 = {
4329
+ const err13 = {
4295
4330
  instancePath: instancePath + "/keyBits",
4296
4331
  schemaPath: "#/properties/keyBits/minimum",
4297
4332
  keyword: "minimum",
@@ -4301,8 +4336,8 @@ function validate34(data, { instancePath = "", parentData, parentDataProperty, r
4301
4336
  },
4302
4337
  message: "must be >= 1"
4303
4338
  };
4304
- if (vErrors === null) vErrors = [err10];
4305
- else vErrors.push(err10);
4339
+ if (vErrors === null) vErrors = [err13];
4340
+ else vErrors.push(err13);
4306
4341
  errors++;
4307
4342
  }
4308
4343
  }
@@ -4310,28 +4345,28 @@ function validate34(data, { instancePath = "", parentData, parentDataProperty, r
4310
4345
  if (data.algo !== void 0) {
4311
4346
  let data5 = data.algo;
4312
4347
  if (typeof data5 !== "string" && data5 !== null) {
4313
- const err11 = {
4348
+ const err14 = {
4314
4349
  instancePath: instancePath + "/algo",
4315
4350
  schemaPath: "#/properties/algo/type",
4316
4351
  keyword: "type",
4317
4352
  params: { type: schema42.properties.algo.type },
4318
4353
  message: "must be string,null"
4319
4354
  };
4320
- if (vErrors === null) vErrors = [err11];
4321
- else vErrors.push(err11);
4355
+ if (vErrors === null) vErrors = [err14];
4356
+ else vErrors.push(err14);
4322
4357
  errors++;
4323
4358
  }
4324
4359
  }
4325
4360
  } else {
4326
- const err12 = {
4361
+ const err15 = {
4327
4362
  instancePath,
4328
4363
  schemaPath: "#/type",
4329
4364
  keyword: "type",
4330
4365
  params: { type: "object" },
4331
4366
  message: "must be object"
4332
4367
  };
4333
- if (vErrors === null) vErrors = [err12];
4334
- else vErrors.push(err12);
4368
+ if (vErrors === null) vErrors = [err15];
4369
+ else vErrors.push(err15);
4335
4370
  errors++;
4336
4371
  }
4337
4372
  validate34.errors = vErrors;
@@ -4389,193 +4424,217 @@ function validate33(data, { instancePath = "", parentData, parentDataProperty, r
4389
4424
  else vErrors.push(err3);
4390
4425
  errors++;
4391
4426
  }
4392
- if (data.dmarcSpfStrict === void 0) {
4427
+ if (data.dmarcSpfAligned === void 0) {
4393
4428
  const err4 = {
4394
4429
  instancePath,
4395
4430
  schemaPath: "#/required",
4396
4431
  keyword: "required",
4397
- params: { missingProperty: "dmarcSpfStrict" },
4398
- message: "must have required property 'dmarcSpfStrict'"
4432
+ params: { missingProperty: "dmarcSpfAligned" },
4433
+ message: "must have required property 'dmarcSpfAligned'"
4399
4434
  };
4400
4435
  if (vErrors === null) vErrors = [err4];
4401
4436
  else vErrors.push(err4);
4402
4437
  errors++;
4403
4438
  }
4404
- if (data.dmarcDkimStrict === void 0) {
4439
+ if (data.dmarcDkimAligned === void 0) {
4405
4440
  const err5 = {
4406
4441
  instancePath,
4407
4442
  schemaPath: "#/required",
4408
4443
  keyword: "required",
4409
- params: { missingProperty: "dmarcDkimStrict" },
4410
- message: "must have required property 'dmarcDkimStrict'"
4444
+ params: { missingProperty: "dmarcDkimAligned" },
4445
+ message: "must have required property 'dmarcDkimAligned'"
4411
4446
  };
4412
4447
  if (vErrors === null) vErrors = [err5];
4413
4448
  else vErrors.push(err5);
4414
4449
  errors++;
4415
4450
  }
4416
- if (data.dkimSignatures === void 0) {
4451
+ if (data.dmarcSpfStrict === void 0) {
4417
4452
  const err6 = {
4418
4453
  instancePath,
4419
4454
  schemaPath: "#/required",
4420
4455
  keyword: "required",
4421
- params: { missingProperty: "dkimSignatures" },
4422
- message: "must have required property 'dkimSignatures'"
4456
+ params: { missingProperty: "dmarcSpfStrict" },
4457
+ message: "must have required property 'dmarcSpfStrict'"
4423
4458
  };
4424
4459
  if (vErrors === null) vErrors = [err6];
4425
4460
  else vErrors.push(err6);
4426
4461
  errors++;
4427
4462
  }
4463
+ if (data.dmarcDkimStrict === void 0) {
4464
+ const err7 = {
4465
+ instancePath,
4466
+ schemaPath: "#/required",
4467
+ keyword: "required",
4468
+ params: { missingProperty: "dmarcDkimStrict" },
4469
+ message: "must have required property 'dmarcDkimStrict'"
4470
+ };
4471
+ if (vErrors === null) vErrors = [err7];
4472
+ else vErrors.push(err7);
4473
+ errors++;
4474
+ }
4475
+ if (data.dkimSignatures === void 0) {
4476
+ const err8 = {
4477
+ instancePath,
4478
+ schemaPath: "#/required",
4479
+ keyword: "required",
4480
+ params: { missingProperty: "dkimSignatures" },
4481
+ message: "must have required property 'dkimSignatures'"
4482
+ };
4483
+ if (vErrors === null) vErrors = [err8];
4484
+ else vErrors.push(err8);
4485
+ errors++;
4486
+ }
4428
4487
  if (data.spf !== void 0) {
4429
4488
  let data0 = data.spf;
4430
4489
  if (typeof data0 !== "string") {
4431
- const err7 = {
4490
+ const err9 = {
4432
4491
  instancePath: instancePath + "/spf",
4433
4492
  schemaPath: "#/definitions/SpfResult/type",
4434
4493
  keyword: "type",
4435
4494
  params: { type: "string" },
4436
4495
  message: "must be string"
4437
4496
  };
4438
- if (vErrors === null) vErrors = [err7];
4439
- else vErrors.push(err7);
4497
+ if (vErrors === null) vErrors = [err9];
4498
+ else vErrors.push(err9);
4440
4499
  errors++;
4441
4500
  }
4442
4501
  if (!(data0 === "pass" || data0 === "fail" || data0 === "softfail" || data0 === "neutral" || data0 === "none" || data0 === "temperror" || data0 === "permerror")) {
4443
- const err8 = {
4502
+ const err10 = {
4444
4503
  instancePath: instancePath + "/spf",
4445
4504
  schemaPath: "#/definitions/SpfResult/enum",
4446
4505
  keyword: "enum",
4447
4506
  params: { allowedValues: schema39.enum },
4448
4507
  message: "must be equal to one of the allowed values"
4449
4508
  };
4450
- if (vErrors === null) vErrors = [err8];
4451
- else vErrors.push(err8);
4509
+ if (vErrors === null) vErrors = [err10];
4510
+ else vErrors.push(err10);
4452
4511
  errors++;
4453
4512
  }
4454
4513
  }
4455
4514
  if (data.dmarc !== void 0) {
4456
4515
  let data1 = data.dmarc;
4457
4516
  if (typeof data1 !== "string") {
4458
- const err9 = {
4517
+ const err11 = {
4459
4518
  instancePath: instancePath + "/dmarc",
4460
4519
  schemaPath: "#/definitions/DmarcResult/type",
4461
4520
  keyword: "type",
4462
4521
  params: { type: "string" },
4463
4522
  message: "must be string"
4464
4523
  };
4465
- if (vErrors === null) vErrors = [err9];
4466
- else vErrors.push(err9);
4524
+ if (vErrors === null) vErrors = [err11];
4525
+ else vErrors.push(err11);
4467
4526
  errors++;
4468
4527
  }
4469
4528
  if (!(data1 === "pass" || data1 === "fail" || data1 === "none" || data1 === "temperror" || data1 === "permerror")) {
4470
- const err10 = {
4529
+ const err12 = {
4471
4530
  instancePath: instancePath + "/dmarc",
4472
4531
  schemaPath: "#/definitions/DmarcResult/enum",
4473
4532
  keyword: "enum",
4474
4533
  params: { allowedValues: schema40.enum },
4475
4534
  message: "must be equal to one of the allowed values"
4476
4535
  };
4477
- if (vErrors === null) vErrors = [err10];
4478
- else vErrors.push(err10);
4536
+ if (vErrors === null) vErrors = [err12];
4537
+ else vErrors.push(err12);
4479
4538
  errors++;
4480
4539
  }
4481
4540
  }
4482
4541
  if (data.dmarcPolicy !== void 0) {
4483
4542
  let data2 = data.dmarcPolicy;
4484
4543
  if (typeof data2 !== "string" && data2 !== null) {
4485
- const err11 = {
4544
+ const err13 = {
4486
4545
  instancePath: instancePath + "/dmarcPolicy",
4487
4546
  schemaPath: "#/definitions/DmarcPolicy/type",
4488
4547
  keyword: "type",
4489
4548
  params: { type: schema34.type },
4490
4549
  message: "must be string,null"
4491
4550
  };
4492
- if (vErrors === null) vErrors = [err11];
4493
- else vErrors.push(err11);
4551
+ if (vErrors === null) vErrors = [err13];
4552
+ else vErrors.push(err13);
4494
4553
  errors++;
4495
4554
  }
4496
4555
  if (!(data2 === "reject" || data2 === "quarantine" || data2 === "none" || data2 === null)) {
4497
- const err12 = {
4556
+ const err14 = {
4498
4557
  instancePath: instancePath + "/dmarcPolicy",
4499
4558
  schemaPath: "#/definitions/DmarcPolicy/enum",
4500
4559
  keyword: "enum",
4501
4560
  params: { allowedValues: schema34.enum },
4502
4561
  message: "must be equal to one of the allowed values"
4503
4562
  };
4504
- if (vErrors === null) vErrors = [err12];
4505
- else vErrors.push(err12);
4563
+ if (vErrors === null) vErrors = [err14];
4564
+ else vErrors.push(err14);
4506
4565
  errors++;
4507
4566
  }
4508
4567
  }
4509
4568
  if (data.dmarcFromDomain !== void 0) {
4510
4569
  let data3 = data.dmarcFromDomain;
4511
4570
  if (typeof data3 !== "string" && data3 !== null) {
4512
- const err13 = {
4571
+ const err15 = {
4513
4572
  instancePath: instancePath + "/dmarcFromDomain",
4514
4573
  schemaPath: "#/properties/dmarcFromDomain/type",
4515
4574
  keyword: "type",
4516
4575
  params: { type: schema38.properties.dmarcFromDomain.type },
4517
4576
  message: "must be string,null"
4518
4577
  };
4519
- if (vErrors === null) vErrors = [err13];
4520
- else vErrors.push(err13);
4578
+ if (vErrors === null) vErrors = [err15];
4579
+ else vErrors.push(err15);
4521
4580
  errors++;
4522
4581
  }
4523
4582
  }
4524
4583
  if (data.dmarcSpfAligned !== void 0) {
4525
4584
  if (typeof data.dmarcSpfAligned !== "boolean") {
4526
- const err14 = {
4585
+ const err16 = {
4527
4586
  instancePath: instancePath + "/dmarcSpfAligned",
4528
4587
  schemaPath: "#/properties/dmarcSpfAligned/type",
4529
4588
  keyword: "type",
4530
4589
  params: { type: "boolean" },
4531
4590
  message: "must be boolean"
4532
4591
  };
4533
- if (vErrors === null) vErrors = [err14];
4534
- else vErrors.push(err14);
4592
+ if (vErrors === null) vErrors = [err16];
4593
+ else vErrors.push(err16);
4535
4594
  errors++;
4536
4595
  }
4537
4596
  }
4538
4597
  if (data.dmarcDkimAligned !== void 0) {
4539
4598
  if (typeof data.dmarcDkimAligned !== "boolean") {
4540
- const err15 = {
4599
+ const err17 = {
4541
4600
  instancePath: instancePath + "/dmarcDkimAligned",
4542
4601
  schemaPath: "#/properties/dmarcDkimAligned/type",
4543
4602
  keyword: "type",
4544
4603
  params: { type: "boolean" },
4545
4604
  message: "must be boolean"
4546
4605
  };
4547
- if (vErrors === null) vErrors = [err15];
4548
- else vErrors.push(err15);
4606
+ if (vErrors === null) vErrors = [err17];
4607
+ else vErrors.push(err17);
4549
4608
  errors++;
4550
4609
  }
4551
4610
  }
4552
4611
  if (data.dmarcSpfStrict !== void 0) {
4553
4612
  let data6 = data.dmarcSpfStrict;
4554
4613
  if (typeof data6 !== "boolean" && data6 !== null) {
4555
- const err16 = {
4614
+ const err18 = {
4556
4615
  instancePath: instancePath + "/dmarcSpfStrict",
4557
4616
  schemaPath: "#/properties/dmarcSpfStrict/type",
4558
4617
  keyword: "type",
4559
4618
  params: { type: schema38.properties.dmarcSpfStrict.type },
4560
4619
  message: "must be boolean,null"
4561
4620
  };
4562
- if (vErrors === null) vErrors = [err16];
4563
- else vErrors.push(err16);
4621
+ if (vErrors === null) vErrors = [err18];
4622
+ else vErrors.push(err18);
4564
4623
  errors++;
4565
4624
  }
4566
4625
  }
4567
4626
  if (data.dmarcDkimStrict !== void 0) {
4568
4627
  let data7 = data.dmarcDkimStrict;
4569
4628
  if (typeof data7 !== "boolean" && data7 !== null) {
4570
- const err17 = {
4629
+ const err19 = {
4571
4630
  instancePath: instancePath + "/dmarcDkimStrict",
4572
4631
  schemaPath: "#/properties/dmarcDkimStrict/type",
4573
4632
  keyword: "type",
4574
4633
  params: { type: schema38.properties.dmarcDkimStrict.type },
4575
4634
  message: "must be boolean,null"
4576
4635
  };
4577
- if (vErrors === null) vErrors = [err17];
4578
- else vErrors.push(err17);
4636
+ if (vErrors === null) vErrors = [err19];
4637
+ else vErrors.push(err19);
4579
4638
  errors++;
4580
4639
  }
4581
4640
  }
@@ -4593,28 +4652,28 @@ function validate33(data, { instancePath = "", parentData, parentDataProperty, r
4593
4652
  errors = vErrors.length;
4594
4653
  }
4595
4654
  } else {
4596
- const err18 = {
4655
+ const err20 = {
4597
4656
  instancePath: instancePath + "/dkimSignatures",
4598
4657
  schemaPath: "#/properties/dkimSignatures/type",
4599
4658
  keyword: "type",
4600
4659
  params: { type: "array" },
4601
4660
  message: "must be array"
4602
4661
  };
4603
- if (vErrors === null) vErrors = [err18];
4604
- else vErrors.push(err18);
4662
+ if (vErrors === null) vErrors = [err20];
4663
+ else vErrors.push(err20);
4605
4664
  errors++;
4606
4665
  }
4607
4666
  }
4608
4667
  } else {
4609
- const err19 = {
4668
+ const err21 = {
4610
4669
  instancePath,
4611
4670
  schemaPath: "#/type",
4612
4671
  keyword: "type",
4613
4672
  params: { type: "object" },
4614
4673
  message: "must be object"
4615
4674
  };
4616
- if (vErrors === null) vErrors = [err19];
4617
- else vErrors.push(err19);
4675
+ if (vErrors === null) vErrors = [err21];
4676
+ else vErrors.push(err21);
4618
4677
  errors++;
4619
4678
  }
4620
4679
  validate33.errors = vErrors;
@@ -4855,7 +4914,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
4855
4914
  if (data3.attempted_at !== void 0) {
4856
4915
  let data6 = data3.attempted_at;
4857
4916
  if (typeof data6 === "string") {
4858
- if (!formats0.validate(data6)) {
4917
+ if (!formats0.test(data6)) {
4859
4918
  const err17 = {
4860
4919
  instancePath: instancePath + "/delivery/attempted_at",
4861
4920
  schemaPath: "#/properties/delivery/properties/attempted_at/format",
@@ -5009,7 +5068,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
5009
5068
  if (data7.received_at !== void 0) {
5010
5069
  let data9 = data7.received_at;
5011
5070
  if (typeof data9 === "string") {
5012
- if (!formats0.validate(data9)) {
5071
+ if (!formats0.test(data9)) {
5013
5072
  const err29 = {
5014
5073
  instancePath: instancePath + "/email/received_at",
5015
5074
  schemaPath: "#/properties/email/properties/received_at/format",
@@ -5252,7 +5311,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
5252
5311
  if (data15.from !== void 0) {
5253
5312
  let data18 = data15.from;
5254
5313
  if (typeof data18 === "string") {
5255
- if (func2(data18) < 1) {
5314
+ if (data18.length < 1) {
5256
5315
  const err47 = {
5257
5316
  instancePath: instancePath + "/email/headers/from",
5258
5317
  schemaPath: "#/properties/email/properties/headers/properties/from/minLength",
@@ -5280,7 +5339,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
5280
5339
  if (data15.to !== void 0) {
5281
5340
  let data19 = data15.to;
5282
5341
  if (typeof data19 === "string") {
5283
- if (func2(data19) < 1) {
5342
+ if (data19.length < 1) {
5284
5343
  const err49 = {
5285
5344
  instancePath: instancePath + "/email/headers/to",
5286
5345
  schemaPath: "#/properties/email/properties/headers/properties/to/minLength",
@@ -5413,7 +5472,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
5413
5472
  else vErrors.push(err57);
5414
5473
  errors++;
5415
5474
  }
5416
- if (!formats4(data24)) {
5475
+ if (!formats4.test(data24)) {
5417
5476
  const err58 = {
5418
5477
  instancePath: instancePath + "/email/content/download/url",
5419
5478
  schemaPath: "#/properties/email/properties/content/properties/download/properties/url/format",
@@ -5441,7 +5500,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
5441
5500
  if (data23.expires_at !== void 0) {
5442
5501
  let data25 = data23.expires_at;
5443
5502
  if (typeof data25 === "string") {
5444
- if (!formats0.validate(data25)) {
5503
+ if (!formats0.test(data25)) {
5445
5504
  const err60 = {
5446
5505
  instancePath: instancePath + "/email/content/download/expires_at",
5447
5506
  schemaPath: "#/properties/email/properties/content/properties/download/properties/expires_at/format",
@@ -6962,11 +7021,11 @@ const emailReceivedEventJsonSchema = {
6962
7021
  },
6963
7022
  "dmarcSpfAligned": {
6964
7023
  "type": "boolean",
6965
- "description": "Whether SPF aligned with the From: domain for DMARC purposes.\n\nTrue if the envelope sender domain matches the From: domain (per alignment mode). Optional in self-hosted environments."
7024
+ "description": "Whether SPF aligned with the From: domain for DMARC purposes.\n\nTrue if the envelope sender domain matches the From: domain (per alignment mode)."
6966
7025
  },
6967
7026
  "dmarcDkimAligned": {
6968
7027
  "type": "boolean",
6969
- "description": "Whether DKIM aligned with the From: domain for DMARC purposes.\n\nTrue if at least one DKIM signature's domain matches the From: domain. Optional in self-hosted environments."
7028
+ "description": "Whether DKIM aligned with the From: domain for DMARC purposes.\n\nTrue if at least one DKIM signature's domain matches the From: domain."
6970
7029
  },
6971
7030
  "dmarcSpfStrict": {
6972
7031
  "type": ["boolean", "null"],
@@ -6987,6 +7046,8 @@ const emailReceivedEventJsonSchema = {
6987
7046
  "dmarc",
6988
7047
  "dmarcPolicy",
6989
7048
  "dmarcFromDomain",
7049
+ "dmarcSpfAligned",
7050
+ "dmarcDkimAligned",
6990
7051
  "dmarcSpfStrict",
6991
7052
  "dmarcDkimStrict",
6992
7053
  "dkimSignatures"
@@ -7049,10 +7110,13 @@ const emailReceivedEventJsonSchema = {
7049
7110
  },
7050
7111
  "required": [
7051
7112
  "domain",
7113
+ "selector",
7052
7114
  "result",
7053
- "aligned"
7115
+ "aligned",
7116
+ "keyBits",
7117
+ "algo"
7054
7118
  ],
7055
- "description": "Details about a single DKIM signature found in the email.\n\nAn email may have multiple DKIM signatures (e.g., one from the sending domain and one from the ESP). Each signature is verified independently.\n\nFields marked optional (`selector`, `keyBits`, `algo`) may be unavailable in self-hosted environments where the milter provides limited DKIM detail."
7119
+ "description": "Details about a single DKIM signature found in the email.\n\nAn email may have multiple DKIM signatures (e.g., one from the sending domain and one from the ESP). Each signature is verified independently."
7056
7120
  },
7057
7121
  "DkimResult": {
7058
7122
  "type": "string",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primitivedotdev/sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Official Primitive Node.js SDK — webhook, contract, and parser modules",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -66,7 +66,6 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "ajv": "^8.17.1",
69
- "ajv-formats": "^3.0.1",
70
69
  "archiver": "^7.0.1",
71
70
  "isomorphic-dompurify": "^3.8.0",
72
71
  "mailparser": "^3.9.0"