equoter 0.1.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.
@@ -0,0 +1,64 @@
1
+ export { Position } from "./enums.js";
2
+ /**
3
+ * Divide email body into quoted parts.
4
+ *
5
+ * @param text - Plain text message.
6
+ * @param options.limit - If set, the text will automatically be quoted starting at the
7
+ * line where the limit is reached.
8
+ * @param options.quoteIntroLine - Whether the line introducing the quoted text ("On ...
9
+ * wrote:" / "Begin forwarded message:") should be part of the quoted text.
10
+ * @returns List of tuples [shouldExpand, textSegment].
11
+ */
12
+ export declare function quote(text: string, options?: {
13
+ limit?: number;
14
+ quoteIntroLine?: boolean;
15
+ }): [boolean, string][];
16
+ /**
17
+ * Like quote(), but takes an HTML message as an argument.
18
+ *
19
+ * Uses a two-phase approach inspired by Mailgun's Talon:
20
+ * 1. Try client-specific CSS selectors (Gmail, Zimbra, OWA, Outlook styles)
21
+ * 2. Fall back to line-based pattern matching
22
+ */
23
+ export declare function quoteHtml(html: string, options?: {
24
+ limit?: number;
25
+ quoteIntroLine?: boolean;
26
+ }): [boolean, string][];
27
+ export interface UnwrapResult {
28
+ type: "reply" | "forward" | "quote";
29
+ text_top?: string;
30
+ text_bottom?: string;
31
+ text?: string;
32
+ from?: string;
33
+ to?: string;
34
+ cc?: string;
35
+ bcc?: string;
36
+ subject?: string;
37
+ date?: string;
38
+ "reply-to"?: string;
39
+ [key: string]: string | undefined;
40
+ }
41
+ /**
42
+ * If the passed text is the text body of a forwarded message, a reply, or
43
+ * contains quoted text, returns a structured result. Otherwise returns null.
44
+ */
45
+ export declare function unwrap(text: string): UnwrapResult | null;
46
+ export interface UnwrapHtmlResult {
47
+ type: "reply" | "forward" | "quote";
48
+ html_top?: string;
49
+ html_bottom?: string;
50
+ html?: string;
51
+ from?: string;
52
+ to?: string;
53
+ cc?: string;
54
+ bcc?: string;
55
+ subject?: string;
56
+ date?: string;
57
+ "reply-to"?: string;
58
+ [key: string]: string | undefined;
59
+ }
60
+ /**
61
+ * Like unwrap(), but for HTML email bodies.
62
+ */
63
+ export declare function unwrapHtml(html: string): UnwrapHtmlResult | null;
64
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GACzD,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAsBrB;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GACzD,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CA+FrB;AAqED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,M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