@wraps.dev/cli 2.17.3 → 2.17.4
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.
|
@@ -78,16 +78,34 @@ export async function handler(event: S3Event, context: Context) {
|
|
|
78
78
|
// Generate email ID
|
|
79
79
|
const emailId = `inb_${randomUUID().replace(/-/g, "").slice(0, 12)}`;
|
|
80
80
|
|
|
81
|
-
// 3. Extract headers as
|
|
82
|
-
|
|
81
|
+
// 3. Extract headers as key-value pairs
|
|
82
|
+
// mailparser returns most headers as strings, but some (list, received,
|
|
83
|
+
// references) are complex objects. We preserve objects as-is so downstream
|
|
84
|
+
// consumers can access nested fields like list.unsubscribe.
|
|
85
|
+
const headers: Record<string, unknown> = {};
|
|
83
86
|
if (parsed.headers) {
|
|
84
87
|
for (const [key, value] of parsed.headers) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
let headerValue: unknown;
|
|
89
|
+
if (typeof value === "string") {
|
|
90
|
+
headerValue = value;
|
|
91
|
+
} else if (
|
|
92
|
+
typeof value === "object" &&
|
|
93
|
+
value !== null &&
|
|
94
|
+
"text" in value
|
|
95
|
+
) {
|
|
96
|
+
headerValue = (value as { text: string }).text;
|
|
97
|
+
} else if (typeof value === "object" && value !== null) {
|
|
98
|
+
// Preserve nested objects (e.g. list.unsubscribe, list.post)
|
|
99
|
+
headerValue = value;
|
|
100
|
+
} else {
|
|
101
|
+
headerValue = String(value);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (headers[key] != null) {
|
|
105
|
+
// Multiple values for same header — combine strings, keep first object
|
|
106
|
+
if (typeof headers[key] === "string" && typeof headerValue === "string") {
|
|
107
|
+
headers[key] = `${headers[key]}, ${headerValue}`;
|
|
108
|
+
}
|
|
91
109
|
} else {
|
|
92
110
|
headers[key] = headerValue;
|
|
93
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Built at: 2026-02-
|
|
1
|
+
Built at: 2026-02-27T23:36:52.912Z
|