@primitivedotdev/sdk 0.8.0 → 0.10.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.
@@ -16,6 +16,7 @@ export const operationManifest = [
16
16
  "path": "/account",
17
17
  "pathParams": [],
18
18
  "queryParams": [],
19
+ "requestSchema": null,
19
20
  "sdkName": "getAccount",
20
21
  "summary": "Get account info",
21
22
  "tag": "Account",
@@ -32,6 +33,7 @@ export const operationManifest = [
32
33
  "path": "/account/storage",
33
34
  "pathParams": [],
34
35
  "queryParams": [],
36
+ "requestSchema": null,
35
37
  "sdkName": "getStorageStats",
36
38
  "summary": "Get storage usage",
37
39
  "tag": "Account",
@@ -48,6 +50,7 @@ export const operationManifest = [
48
50
  "path": "/account/webhook-secret",
49
51
  "pathParams": [],
50
52
  "queryParams": [],
53
+ "requestSchema": null,
51
54
  "sdkName": "getWebhookSecret",
52
55
  "summary": "Get webhook signing secret",
53
56
  "tag": "Account",
@@ -64,6 +67,7 @@ export const operationManifest = [
64
67
  "path": "/account/webhook-secret/rotate",
65
68
  "pathParams": [],
66
69
  "queryParams": [],
70
+ "requestSchema": null,
67
71
  "sdkName": "rotateWebhookSecret",
68
72
  "summary": "Rotate webhook signing secret",
69
73
  "tag": "Account",
@@ -80,6 +84,26 @@ export const operationManifest = [
80
84
  "path": "/account",
81
85
  "pathParams": [],
82
86
  "queryParams": [],
87
+ "requestSchema": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "properties": {
91
+ "spam_threshold": {
92
+ "type": [
93
+ "number",
94
+ "null"
95
+ ],
96
+ "minimum": 0,
97
+ "maximum": 15,
98
+ "description": "Global spam score threshold (0-15). Emails scoring above this are rejected. Set to null to disable."
99
+ },
100
+ "discard_content_on_webhook_confirmed": {
101
+ "type": "boolean",
102
+ "description": "Whether to discard email content after the webhook endpoint confirms receipt."
103
+ }
104
+ },
105
+ "minProperties": 1
106
+ },
83
107
  "sdkName": "updateAccount",
84
108
  "summary": "Update account settings",
85
109
  "tag": "Account",
@@ -96,6 +120,21 @@ export const operationManifest = [
96
120
  "path": "/domains",
97
121
  "pathParams": [],
98
122
  "queryParams": [],
123
+ "requestSchema": {
124
+ "type": "object",
125
+ "additionalProperties": false,
126
+ "properties": {
127
+ "domain": {
128
+ "type": "string",
129
+ "minLength": 1,
130
+ "maxLength": 253,
131
+ "description": "The domain name to claim (e.g. \"example.com\")"
132
+ }
133
+ },
134
+ "required": [
135
+ "domain"
136
+ ]
137
+ },
99
138
  "sdkName": "addDomain",
100
139
  "summary": "Claim a new domain",
101
140
  "tag": "Domains",
@@ -120,6 +159,7 @@ export const operationManifest = [
120
159
  }
121
160
  ],
122
161
  "queryParams": [],
162
+ "requestSchema": null,
123
163
  "sdkName": "deleteDomain",
124
164
  "summary": "Delete a domain",
125
165
  "tag": "Domains",
@@ -136,6 +176,7 @@ export const operationManifest = [
136
176
  "path": "/domains",
137
177
  "pathParams": [],
138
178
  "queryParams": [],
179
+ "requestSchema": null,
139
180
  "sdkName": "listDomains",
140
181
  "summary": "List all domains",
141
182
  "tag": "Domains",
@@ -160,6 +201,26 @@ export const operationManifest = [
160
201
  }
161
202
  ],
162
203
  "queryParams": [],
204
+ "requestSchema": {
205
+ "type": "object",
206
+ "additionalProperties": false,
207
+ "properties": {
208
+ "is_active": {
209
+ "type": "boolean",
210
+ "description": "Whether the domain accepts incoming emails"
211
+ },
212
+ "spam_threshold": {
213
+ "type": [
214
+ "number",
215
+ "null"
216
+ ],
217
+ "minimum": 0,
218
+ "maximum": 15,
219
+ "description": "Per-domain spam threshold override (Pro plan required)"
220
+ }
221
+ },
222
+ "minProperties": 1
223
+ },
163
224
  "sdkName": "updateDomain",
164
225
  "summary": "Update domain settings",
165
226
  "tag": "Domains",
@@ -184,6 +245,7 @@ export const operationManifest = [
184
245
  }
185
246
  ],
186
247
  "queryParams": [],
248
+ "requestSchema": null,
187
249
  "sdkName": "verifyDomain",
188
250
  "summary": "Verify domain ownership",
189
251
  "tag": "Domains",
@@ -208,6 +270,7 @@ export const operationManifest = [
208
270
  }
209
271
  ],
210
272
  "queryParams": [],
273
+ "requestSchema": null,
211
274
  "sdkName": "deleteEmail",
212
275
  "summary": "Delete an email",
213
276
  "tag": "Emails",
@@ -240,6 +303,7 @@ export const operationManifest = [
240
303
  "type": "string"
241
304
  }
242
305
  ],
306
+ "requestSchema": null,
243
307
  "sdkName": "downloadAttachments",
244
308
  "summary": "Download email attachments",
245
309
  "tag": "Emails",
@@ -272,6 +336,7 @@ export const operationManifest = [
272
336
  "type": "string"
273
337
  }
274
338
  ],
339
+ "requestSchema": null,
275
340
  "sdkName": "downloadRawEmail",
276
341
  "summary": "Download raw email",
277
342
  "tag": "Emails",
@@ -296,6 +361,7 @@ export const operationManifest = [
296
361
  }
297
362
  ],
298
363
  "queryParams": [],
364
+ "requestSchema": null,
299
365
  "sdkName": "getEmail",
300
366
  "summary": "Get email details",
301
367
  "tag": "Emails",
@@ -367,6 +433,7 @@ export const operationManifest = [
367
433
  "type": "string"
368
434
  }
369
435
  ],
436
+ "requestSchema": null,
370
437
  "sdkName": "listEmails",
371
438
  "summary": "List emails",
372
439
  "tag": "Emails",
@@ -391,6 +458,7 @@ export const operationManifest = [
391
458
  }
392
459
  ],
393
460
  "queryParams": [],
461
+ "requestSchema": null,
394
462
  "sdkName": "replayEmailWebhooks",
395
463
  "summary": "Replay email webhooks",
396
464
  "tag": "Emails",
@@ -407,6 +475,37 @@ export const operationManifest = [
407
475
  "path": "/endpoints",
408
476
  "pathParams": [],
409
477
  "queryParams": [],
478
+ "requestSchema": {
479
+ "type": "object",
480
+ "additionalProperties": false,
481
+ "properties": {
482
+ "url": {
483
+ "type": "string",
484
+ "minLength": 1,
485
+ "description": "The webhook URL to deliver events to"
486
+ },
487
+ "enabled": {
488
+ "type": "boolean",
489
+ "default": true,
490
+ "description": "Whether the endpoint is active"
491
+ },
492
+ "domain_id": {
493
+ "type": [
494
+ "string",
495
+ "null"
496
+ ],
497
+ "format": "uuid",
498
+ "description": "Restrict to emails from a specific domain"
499
+ },
500
+ "rules": {
501
+ "type": "object",
502
+ "description": "Endpoint-specific filtering rules"
503
+ }
504
+ },
505
+ "required": [
506
+ "url"
507
+ ]
508
+ },
410
509
  "sdkName": "createEndpoint",
411
510
  "summary": "Create a webhook endpoint",
412
511
  "tag": "Endpoints",
@@ -431,6 +530,7 @@ export const operationManifest = [
431
530
  }
432
531
  ],
433
532
  "queryParams": [],
533
+ "requestSchema": null,
434
534
  "sdkName": "deleteEndpoint",
435
535
  "summary": "Delete a webhook endpoint",
436
536
  "tag": "Endpoints",
@@ -447,6 +547,7 @@ export const operationManifest = [
447
547
  "path": "/endpoints",
448
548
  "pathParams": [],
449
549
  "queryParams": [],
550
+ "requestSchema": null,
450
551
  "sdkName": "listEndpoints",
451
552
  "summary": "List webhook endpoints",
452
553
  "tag": "Endpoints",
@@ -471,6 +572,7 @@ export const operationManifest = [
471
572
  }
472
573
  ],
473
574
  "queryParams": [],
575
+ "requestSchema": null,
474
576
  "sdkName": "testEndpoint",
475
577
  "summary": "Send a test webhook",
476
578
  "tag": "Endpoints",
@@ -495,6 +597,31 @@ export const operationManifest = [
495
597
  }
496
598
  ],
497
599
  "queryParams": [],
600
+ "requestSchema": {
601
+ "type": "object",
602
+ "additionalProperties": false,
603
+ "properties": {
604
+ "url": {
605
+ "type": "string",
606
+ "minLength": 1,
607
+ "description": "New webhook URL (triggers endpoint rotation)"
608
+ },
609
+ "enabled": {
610
+ "type": "boolean"
611
+ },
612
+ "domain_id": {
613
+ "type": [
614
+ "string",
615
+ "null"
616
+ ],
617
+ "format": "uuid"
618
+ },
619
+ "rules": {
620
+ "type": "object"
621
+ }
622
+ },
623
+ "minProperties": 1
624
+ },
498
625
  "sdkName": "updateEndpoint",
499
626
  "summary": "Update a webhook endpoint",
500
627
  "tag": "Endpoints",
@@ -511,6 +638,37 @@ export const operationManifest = [
511
638
  "path": "/filters",
512
639
  "pathParams": [],
513
640
  "queryParams": [],
641
+ "requestSchema": {
642
+ "type": "object",
643
+ "additionalProperties": false,
644
+ "properties": {
645
+ "type": {
646
+ "type": "string",
647
+ "enum": [
648
+ "whitelist",
649
+ "blocklist"
650
+ ]
651
+ },
652
+ "pattern": {
653
+ "type": "string",
654
+ "minLength": 1,
655
+ "maxLength": 500,
656
+ "description": "Email address or pattern to filter"
657
+ },
658
+ "domain_id": {
659
+ "type": [
660
+ "string",
661
+ "null"
662
+ ],
663
+ "format": "uuid",
664
+ "description": "Restrict filter to a specific domain (Pro plan required)"
665
+ }
666
+ },
667
+ "required": [
668
+ "type",
669
+ "pattern"
670
+ ]
671
+ },
514
672
  "sdkName": "createFilter",
515
673
  "summary": "Create a filter rule",
516
674
  "tag": "Filters",
@@ -535,6 +693,7 @@ export const operationManifest = [
535
693
  }
536
694
  ],
537
695
  "queryParams": [],
696
+ "requestSchema": null,
538
697
  "sdkName": "deleteFilter",
539
698
  "summary": "Delete a filter rule",
540
699
  "tag": "Filters",
@@ -551,6 +710,7 @@ export const operationManifest = [
551
710
  "path": "/filters",
552
711
  "pathParams": [],
553
712
  "queryParams": [],
713
+ "requestSchema": null,
554
714
  "sdkName": "listFilters",
555
715
  "summary": "List filter rules",
556
716
  "tag": "Filters",
@@ -575,11 +735,72 @@ export const operationManifest = [
575
735
  }
576
736
  ],
577
737
  "queryParams": [],
738
+ "requestSchema": {
739
+ "type": "object",
740
+ "additionalProperties": false,
741
+ "properties": {
742
+ "enabled": {
743
+ "type": "boolean"
744
+ }
745
+ },
746
+ "required": [
747
+ "enabled"
748
+ ]
749
+ },
578
750
  "sdkName": "updateFilter",
579
751
  "summary": "Update a filter rule",
580
752
  "tag": "Filters",
581
753
  "tagCommand": "filters"
582
754
  },
755
+ {
756
+ "binaryResponse": false,
757
+ "bodyRequired": true,
758
+ "command": "reply-to-email",
759
+ "description": "Sends an outbound reply to the inbound email identified by `id`.\nThreading headers (`In-Reply-To`, `References`), recipient\nderivation (Reply-To, then From, then bare sender), and the\n`Re:` subject prefix are all derived server-side from the\nstored inbound row. The request body carries only the message\nbody and optional `wait` flag; passing any header or recipient\noverride is rejected by the schema (`additionalProperties:\nfalse`).\n\nForwards through the same gates as `/send-mail`: the response\nstatus, error envelope, and `idempotent_replay` flag mirror\nthe send-mail contract verbatim.\n",
760
+ "hasJsonBody": true,
761
+ "method": "POST",
762
+ "operationId": "replyToEmail",
763
+ "path": "/emails/{id}/reply",
764
+ "pathParams": [
765
+ {
766
+ "description": "Resource UUID",
767
+ "enum": null,
768
+ "name": "id",
769
+ "required": true,
770
+ "type": "string"
771
+ }
772
+ ],
773
+ "queryParams": [],
774
+ "requestSchema": {
775
+ "type": "object",
776
+ "additionalProperties": false,
777
+ "description": "Body shape for `/emails/{id}/reply`. Intentionally narrow:\nrecipients (`to`), subject, and threading headers\n(`in_reply_to`, `references`) are derived server-side from\nthe inbound row referenced by the path id and are rejected by\n`additionalProperties` if passed (returns 400).\n\n`from` IS allowed because of legitimate use cases (display-name\naddition, replying from a different verified outbound address,\nmulti-team triage). Send-mail's per-send `canSendFrom` gate\nvalidates the from-domain regardless, so the override carries\nno extra privilege.\n",
778
+ "properties": {
779
+ "body_text": {
780
+ "type": "string",
781
+ "description": "Plain-text reply body. At least one of body_text or body_html is required. The combined UTF-8 byte length of body_text and body_html must be at most 262144 bytes (same cap as send-mail)."
782
+ },
783
+ "body_html": {
784
+ "type": "string",
785
+ "description": "HTML reply body. At least one of body_text or body_html is required."
786
+ },
787
+ "from": {
788
+ "type": "string",
789
+ "minLength": 3,
790
+ "maxLength": 998,
791
+ "description": "Optional override for the reply's From header. Defaults to\nthe inbound's recipient. Use to add a display name (`\"Acme\nSupport\" <agent@company.com>`) or to reply from a different\nverified outbound address (e.g. multi-team routing where\nsupport@ triages to billing@). The from-domain must be a\nverified outbound domain for your org, same as send-mail.\n"
792
+ },
793
+ "wait": {
794
+ "type": "boolean",
795
+ "description": "When true, wait for the first downstream SMTP delivery outcome before returning, mirroring the send-mail `wait` semantics."
796
+ }
797
+ }
798
+ },
799
+ "sdkName": "replyToEmail",
800
+ "summary": "Reply to an inbound email",
801
+ "tag": "Sending",
802
+ "tagCommand": "sending"
803
+ },
583
804
  {
584
805
  "binaryResponse": false,
585
806
  "bodyRequired": true,
@@ -591,6 +812,71 @@ export const operationManifest = [
591
812
  "path": "/send-mail",
592
813
  "pathParams": [],
593
814
  "queryParams": [],
815
+ "requestSchema": {
816
+ "type": "object",
817
+ "additionalProperties": false,
818
+ "properties": {
819
+ "from": {
820
+ "type": "string",
821
+ "minLength": 3,
822
+ "maxLength": 998,
823
+ "description": "RFC 5322 From header. The sender domain must be a verified outbound domain for your organization."
824
+ },
825
+ "to": {
826
+ "type": "string",
827
+ "minLength": 3,
828
+ "maxLength": 320,
829
+ "description": "Recipient address. Recipient eligibility depends on your account's outbound entitlements."
830
+ },
831
+ "subject": {
832
+ "type": "string",
833
+ "minLength": 1,
834
+ "maxLength": 998,
835
+ "description": "Subject line for the outbound message"
836
+ },
837
+ "body_text": {
838
+ "type": "string",
839
+ "description": "Plain-text message body. At least one of body_text or body_html is required. The combined UTF-8 byte length of body_text and body_html must be at most 262144 bytes."
840
+ },
841
+ "body_html": {
842
+ "type": "string",
843
+ "description": "HTML message body. At least one of body_text or body_html is required. The combined UTF-8 byte length of body_text and body_html must be at most 262144 bytes."
844
+ },
845
+ "in_reply_to": {
846
+ "type": "string",
847
+ "minLength": 1,
848
+ "maxLength": 998,
849
+ "pattern": "^[^\\x00-\\x1F\\x7F]+$",
850
+ "description": "Message-ID of the direct parent email when sending a threaded reply."
851
+ },
852
+ "references": {
853
+ "type": "array",
854
+ "maxItems": 100,
855
+ "description": "Full ordered message-id chain for the thread.",
856
+ "items": {
857
+ "type": "string",
858
+ "minLength": 1,
859
+ "maxLength": 998,
860
+ "pattern": "^[^\\x00-\\x1F\\x7F]+$"
861
+ }
862
+ },
863
+ "wait": {
864
+ "type": "boolean",
865
+ "description": "When true, wait for the first downstream SMTP delivery outcome before returning."
866
+ },
867
+ "wait_timeout_ms": {
868
+ "type": "integer",
869
+ "minimum": 1000,
870
+ "maximum": 30000,
871
+ "description": "Maximum time to wait for a delivery outcome when wait is true. Defaults to 30000."
872
+ }
873
+ },
874
+ "required": [
875
+ "from",
876
+ "to",
877
+ "subject"
878
+ ]
879
+ },
594
880
  "sdkName": "sendEmail",
595
881
  "summary": "Send outbound email",
596
882
  "tag": "Sending",
@@ -655,6 +941,7 @@ export const operationManifest = [
655
941
  "type": "string"
656
942
  }
657
943
  ],
944
+ "requestSchema": null,
658
945
  "sdkName": "listDeliveries",
659
946
  "summary": "List webhook deliveries",
660
947
  "tag": "Webhook Deliveries",
@@ -679,6 +966,7 @@ export const operationManifest = [
679
966
  }
680
967
  ],
681
968
  "queryParams": [],
969
+ "requestSchema": null,
682
970
  "sdkName": "replayDelivery",
683
971
  "summary": "Replay a webhook delivery",
684
972
  "tag": "Webhook Deliveries",
@@ -1,17 +1,6 @@
1
- import { EmailAddress, ParsedDataComplete, WebhookAttachment } from "../types-CIOzt1FY.js";
1
+ import { M as WebhookAttachment, S as ParsedDataComplete, s as EmailAddress } from "../types-9vXGZjPd.js";
2
2
 
3
3
  //#region src/parser/address-parser.d.ts
4
- /**
5
- * A validated RFC 5322 address. Returned by the strict parser, which
6
- * deliberately does not expose a display name.
7
- *
8
- * `address` is normalized to lowercase. Both the local-part and the
9
- * domain are lowercased: RFC 5321 §2.4 permits case-sensitive local-
10
- * parts, but every consumer mailbox in practice treats them as
11
- * case-insensitive, and a case-sensitive grant key would split
12
- * `Bob@x.com` from `bob@x.com` into separate rows and defeat the
13
- * primary-key index on lookup.
14
- */
15
4
  /**
16
5
  * A validated RFC 5322 address. Returned by the strict parser, which
17
6
  * deliberately does not expose a display name.
@@ -99,7 +88,8 @@ declare function parseFromHeader(header: string | null | undefined): ParseFromHe
99
88
  * include addressparser's recovery output (trailing tokens, garbage
100
89
  * before the address); treat as opaque text for display.
101
90
  */
102
- declare function parseFromHeaderLoose(header: string | null | undefined): ParsedAddress | null; //#endregion
91
+ declare function parseFromHeaderLoose(header: string | null | undefined): ParsedAddress | null;
92
+ //#endregion
103
93
  //#region src/parser/attachment-parser.d.ts
104
94
  interface ParsedAttachment {
105
95
  id: string;
@@ -162,7 +152,6 @@ declare function sha256Hex(buffer: Buffer): string;
162
152
  * Prevents path traversal, removes control characters, enforces length limits.
163
153
  */
164
154
  declare function sanitizeFilename(filename: string | null, partIndex: number): string;
165
-
166
155
  //#endregion
167
156
  //#region src/parser/attachment-bundler.d.ts
168
157
  /**
@@ -216,7 +205,6 @@ declare function extractAttachmentMetadata(attachments: ParsedAttachment[]): Att
216
205
  * @returns Storage key in format: attachments/{email_id}_{hash8}.tar.gz
217
206
  */
218
207
  declare function getAttachmentsStorageKey(emailId: string, sha256: string): string;
219
-
220
208
  //#endregion
221
209
  //#region src/parser/email-parser.d.ts
222
210
  interface ParsedEmail {
@@ -234,7 +222,6 @@ interface ParsedEmail {
234
222
  * Uses mailparser library for robust email parsing
235
223
  */
236
224
  declare function parseEmail(emlRaw: string): Promise<ParsedEmail>;
237
-
238
225
  //#endregion
239
226
  //#region src/parser/mapping.d.ts
240
227
  /**
@@ -283,10 +270,8 @@ declare function toCanonicalHeaders(parsed: ParsedEmailWithAttachments): {
283
270
  to: string;
284
271
  date: string | null;
285
272
  };
286
-
287
273
  //#endregion
288
274
  //#region src/parser/sanitize-html.d.ts
289
275
  declare function sanitizeHtml(html: string): string;
290
-
291
276
  //#endregion
292
- export { AttachmentMetadata, BundleResult, ParseFromHeaderFailureReason, ParseFromHeaderResult, ParsedAddress, ParsedAttachment, ParsedEmail, ParsedEmailWithAttachments, ValidatedAddress, attachmentMetadataToWebhookAttachments, bundleAttachments, extractAttachmentMetadata, getAttachmentsStorageKey, normalizeContentType, parseEmail, parseEmailWithAttachments, parseFromHeader, parseFromHeaderLoose, sanitizeFilename, sanitizeHtml, sha256Hex, toCanonicalHeaders, toParsedDataComplete, toWebhookAttachments };
277
+ export { type AttachmentMetadata, type BundleResult, type ParseFromHeaderFailureReason, type ParseFromHeaderResult, type ParsedAddress, type ParsedAttachment, type ParsedEmail, type ParsedEmailWithAttachments, type ValidatedAddress, attachmentMetadataToWebhookAttachments, bundleAttachments, extractAttachmentMetadata, getAttachmentsStorageKey, normalizeContentType, parseEmail, parseEmailWithAttachments, parseFromHeader, parseFromHeaderLoose, sanitizeFilename, sanitizeHtml, sha256Hex, toCanonicalHeaders, toParsedDataComplete, toWebhookAttachments };
@@ -1,10 +1,9 @@
1
- import { parseFromHeader, parseFromHeaderLoose } from "../address-parser-CfPHs3mE.js";
1
+ import { n as parseFromHeaderLoose, t as parseFromHeader } from "../address-parser-BYn8oW5r.js";
2
2
  import { createHash } from "node:crypto";
3
3
  import { createGzip } from "node:zlib";
4
4
  import { pack } from "tar-stream";
5
5
  import { simpleParser } from "mailparser";
6
6
  import DOMPurify from "isomorphic-dompurify";
7
-
8
7
  //#region src/parser/attachment-bundler.ts
9
8
  function appendTarEntry(archive, name, content) {
10
9
  return new Promise((resolve, reject) => {
@@ -81,10 +80,9 @@ async function bundleAttachments(attachments) {
81
80
  }
82
81
  })();
83
82
  });
84
- const sha256 = createHash("sha256").update(tarGzBuffer).digest("hex");
85
83
  return {
86
84
  tarGzBuffer,
87
- sha256,
85
+ sha256: createHash("sha256").update(tarGzBuffer).digest("hex"),
88
86
  attachmentCount: downloadable.length,
89
87
  totalAttachmentBytes
90
88
  };
@@ -114,10 +112,8 @@ function extractAttachmentMetadata(attachments) {
114
112
  * @returns Storage key in format: attachments/{email_id}_{hash8}.tar.gz
115
113
  */
116
114
  function getAttachmentsStorageKey(emailId, sha256) {
117
- const hash8 = sha256.substring(0, 8);
118
- return `attachments/${emailId}_${hash8}.tar.gz`;
115
+ return `attachments/${emailId}_${sha256.substring(0, 8)}.tar.gz`;
119
116
  }
120
-
121
117
  //#endregion
122
118
  //#region src/parser/sanitize-html.ts
123
119
  const ALLOWED_TAGS = [
@@ -203,8 +199,7 @@ DOMPurify.addHook("uponSanitizeAttribute", (_node, data) => {
203
199
  });
204
200
  DOMPurify.addHook("afterSanitizeAttributes", (node) => {
205
201
  if (node.tagName === "A") {
206
- const target = node.getAttribute("target");
207
- if (target === "_blank") node.setAttribute("rel", "noopener noreferrer");
202
+ if (node.getAttribute("target") === "_blank") node.setAttribute("rel", "noopener noreferrer");
208
203
  }
209
204
  });
210
205
  const SANITIZE_OPTIONS = {
@@ -234,7 +229,6 @@ const SANITIZE_OPTIONS = {
234
229
  function sanitizeHtml(html) {
235
230
  return DOMPurify.sanitize(html, SANITIZE_OPTIONS);
236
231
  }
237
-
238
232
  //#endregion
239
233
  //#region src/parser/attachment-parser.ts
240
234
  const SIGNATURE_ARTIFACTS = new Set([
@@ -345,8 +339,7 @@ function normalizeReferences(refs) {
345
339
  */
346
340
  function normalizeContentType(contentType) {
347
341
  if (!contentType?.trim()) return "application/octet-stream";
348
- const mediaType = contentType.split(";")[0].trim().toLowerCase();
349
- return mediaType || "application/octet-stream";
342
+ return contentType.split(";")[0].trim().toLowerCase() || "application/octet-stream";
350
343
  }
351
344
  /**
352
345
  * Parse disposition string to typed value.
@@ -375,8 +368,7 @@ function getHeaderString(value) {
375
368
  return String(value);
376
369
  }
377
370
  function getOriginalHeaderValue(parsed, key) {
378
- const headerLines = parsed.headerLines;
379
- const original = headerLines?.find((header) => header.key?.toLowerCase() === key.toLowerCase())?.line;
371
+ const original = parsed.headerLines?.find((header) => header.key?.toLowerCase() === key.toLowerCase())?.line;
380
372
  if (!original) return null;
381
373
  const separator = original.indexOf(":");
382
374
  return separator === -1 ? original : original.slice(separator + 1).trimStart();
@@ -406,7 +398,6 @@ function sanitizeFilename(filename, partIndex) {
406
398
  if (!safe) return `attachment_${partIndex}`;
407
399
  return safe;
408
400
  }
409
-
410
401
  //#endregion
411
402
  //#region src/parser/email-parser.ts
412
403
  /**
@@ -466,7 +457,6 @@ function structuredHeaderToString(value) {
466
457
  }
467
458
  return JSON.stringify(value);
468
459
  }
469
-
470
460
  //#endregion
471
461
  //#region src/parser/mapping.ts
472
462
  /**
@@ -556,6 +546,5 @@ function requireNonEmptyHeader(value, headerName) {
556
546
  if (typeof value !== "string" || value.trim() === "") throw new Error(`Parsed email is missing a usable ${headerName} header value`);
557
547
  return value;
558
548
  }
559
-
560
549
  //#endregion
561
- export { attachmentMetadataToWebhookAttachments, bundleAttachments, extractAttachmentMetadata, getAttachmentsStorageKey, normalizeContentType, parseEmail, parseEmailWithAttachments, parseFromHeader, parseFromHeaderLoose, sanitizeFilename, sanitizeHtml, sha256Hex, toCanonicalHeaders, toParsedDataComplete, toWebhookAttachments };
550
+ export { attachmentMetadataToWebhookAttachments, bundleAttachments, extractAttachmentMetadata, getAttachmentsStorageKey, normalizeContentType, parseEmail, parseEmailWithAttachments, parseFromHeader, parseFromHeaderLoose, sanitizeFilename, sanitizeHtml, sha256Hex, toCanonicalHeaders, toParsedDataComplete, toWebhookAttachments };
@@ -1,5 +1,4 @@
1
- import { parseFromHeaderLoose } from "./address-parser-CfPHs3mE.js";
2
-
1
+ import { n as parseFromHeaderLoose } from "./address-parser-BYn8oW5r.js";
3
2
  //#region src/webhook/received-email.ts
4
3
  const REPLY_PREFIX_RE = /^re\s*:/i;
5
4
  const FORWARD_PREFIX_RE = /^(fwd?|fw)\s*:/i;
@@ -66,6 +65,5 @@ function parseHeaderAddress(value) {
66
65
  name: parsed.name?.trim() || null
67
66
  };
68
67
  }
69
-
70
68
  //#endregion
71
- export { buildForwardSubject, buildReplySubject, formatAddress, normalizeReceivedEmail, parseHeaderAddress };
69
+ export { parseHeaderAddress as a, normalizeReceivedEmail as i, buildReplySubject as n, formatAddress as r, buildForwardSubject as t };
@@ -1,4 +1,4 @@
1
- import { EmailAnalysis, EmailAuth, EmailReceivedEvent, WebhookAttachment } from "./types-CIOzt1FY.js";
1
+ import { M as WebhookAttachment, c as EmailAnalysis, l as EmailAuth, u as EmailReceivedEvent } from "./types-9vXGZjPd.js";
2
2
 
3
3
  //#region src/webhook/received-email.d.ts
4
4
  interface ReceivedEmailAddress {
@@ -32,5 +32,6 @@ declare function normalizeReceivedEmail(event: EmailReceivedEvent): ReceivedEmai
32
32
  declare function buildReplySubject(subject: string | null | undefined): string;
33
33
  declare function buildForwardSubject(subject: string | null | undefined): string;
34
34
  declare function formatAddress(address: ReceivedEmailAddress): string;
35
- declare function parseHeaderAddress(value: string | null | undefined): ReceivedEmailAddress | null; //#endregion
36
- export { ReceivedEmail, ReceivedEmailAddress, ReceivedEmailThread, buildForwardSubject as buildForwardSubject$1, buildReplySubject as buildReplySubject$1, formatAddress as formatAddress$1, normalizeReceivedEmail as normalizeReceivedEmail$1, parseHeaderAddress as parseHeaderAddress$1 };
35
+ declare function parseHeaderAddress(value: string | null | undefined): ReceivedEmailAddress | null;
36
+ //#endregion
37
+ export { buildReplySubject as a, parseHeaderAddress as c, buildForwardSubject as i, ReceivedEmailAddress as n, formatAddress as o, ReceivedEmailThread as r, normalizeReceivedEmail as s, ReceivedEmail as t };