mymx 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract.d.ts +4 -2
- package/dist/contract.js +2 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -3
- package/dist/{types-C8JlcpcT.d.ts → types-B5aR2RnG.d.ts} +4 -7
- package/dist/{zod-CalKEwR4.js → zod-Df95bIDs.js} +1 -1
- package/dist/zod.d.ts +27 -27
- package/dist/zod.js +1 -1
- package/package.json +1 -1
package/dist/contract.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmailAddress, EmailReceivedEvent, ParsedDataComplete, ParsedDataFailed, ParsedError, RawContentDownloadOnly, RawContentInline, WEBHOOK_VERSION$1 as WEBHOOK_VERSION, WebhookAttachment } from "./types-
|
|
1
|
+
import { EmailAddress, EmailAuth, EmailReceivedEvent, ParsedDataComplete, ParsedDataFailed, ParsedError, RawContentDownloadOnly, RawContentInline, WEBHOOK_VERSION$1 as WEBHOOK_VERSION, WebhookAttachment } from "./types-B5aR2RnG.js";
|
|
2
2
|
import { SignResult, signWebhookPayload$1 as signWebhookPayload } from "./signing-Ecohrukk.js";
|
|
3
3
|
|
|
4
4
|
//#region src/contract.d.ts
|
|
@@ -84,6 +84,8 @@ interface EmailReceivedEventInput {
|
|
|
84
84
|
attachments_download_url: string | null;
|
|
85
85
|
/** Parsed email content (optional, defaults to failed state) */
|
|
86
86
|
parsed?: ParsedInput;
|
|
87
|
+
/** Email authentication results (SPF, DKIM, DMARC) */
|
|
88
|
+
auth: EmailAuth;
|
|
87
89
|
}
|
|
88
90
|
/**
|
|
89
91
|
* Generate a stable event ID for webhook deduplication.
|
|
@@ -143,4 +145,4 @@ declare function buildEmailReceivedEvent(input: EmailReceivedEventInput, options
|
|
|
143
145
|
/** Override attempted_at timestamp (for testing) */
|
|
144
146
|
attempted_at?: string;
|
|
145
147
|
}): EmailReceivedEvent; //#endregion
|
|
146
|
-
export { EmailAddress, EmailReceivedEvent, EmailReceivedEventInput, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedInput, ParsedInputComplete, ParsedInputFailed, RAW_EMAIL_INLINE_THRESHOLD, RawContentDownloadOnly, RawContentInline, SignResult, WEBHOOK_VERSION, WebhookAttachment, buildEmailReceivedEvent, generateEventId, signWebhookPayload };
|
|
148
|
+
export { EmailAddress, EmailAuth, EmailReceivedEvent, EmailReceivedEventInput, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedInput, ParsedInputComplete, ParsedInputFailed, RAW_EMAIL_INLINE_THRESHOLD, RawContentDownloadOnly, RawContentInline, SignResult, WEBHOOK_VERSION, WebhookAttachment, buildEmailReceivedEvent, generateEventId, signWebhookPayload };
|
package/dist/contract.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthConfidence, AuthVerdict, DkimSignature, DkimSignatureResult, DmarcPolicy, DmarcResult, EmailAddress, EmailAuth, EmailReceivedEvent, KnownWebhookEvent, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus, RawContent, RawContentDownloadOnly, RawContentInline, SpfResult, UnknownEvent, ValidateEmailAuthResult, WEBHOOK_VERSION$1 as WEBHOOK_VERSION, WebhookAttachment, WebhookEvent } from "./types-
|
|
1
|
+
import { AuthConfidence, AuthVerdict, DkimSignature, DkimSignatureResult, DmarcPolicy, DmarcResult, EmailAddress, EmailAuth, EmailReceivedEvent, KnownWebhookEvent, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus, RawContent, RawContentDownloadOnly, RawContentInline, SpfResult, UnknownEvent, ValidateEmailAuthResult, WEBHOOK_VERSION$1 as WEBHOOK_VERSION, WebhookAttachment, WebhookEvent } from "./types-B5aR2RnG.js";
|
|
2
2
|
import { MYMX_CONFIRMED_HEADER$1 as MYMX_CONFIRMED_HEADER, MYMX_SIGNATURE_HEADER$1 as MYMX_SIGNATURE_HEADER, VerifyOptions, verifyWebhookSignature$1 as verifyWebhookSignature } from "./signing-Ecohrukk.js";
|
|
3
3
|
import { MyMXWebhookError$1 as MyMXWebhookError, PAYLOAD_ERRORS$1 as PAYLOAD_ERRORS, RAW_EMAIL_ERRORS$1 as RAW_EMAIL_ERRORS, RawEmailDecodeError$1 as RawEmailDecodeError, RawEmailDecodeErrorCode, VERIFICATION_ERRORS$1 as VERIFICATION_ERRORS, WebhookErrorCode, WebhookPayloadError$1 as WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError$1 as WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError$1 as WebhookVerificationError, WebhookVerificationErrorCode } from "./errors-CSPHzZB_.js";
|
|
4
4
|
|
|
@@ -173,10 +173,10 @@ declare const emailReceivedEventJsonSchema: {
|
|
|
173
173
|
};
|
|
174
174
|
readonly auth: {
|
|
175
175
|
readonly $ref: "#/definitions/EmailAuth";
|
|
176
|
-
readonly description: "Email authentication results (SPF, DKIM, DMARC).
|
|
176
|
+
readonly description: "Email authentication results (SPF, DKIM, DMARC).";
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
|
-
readonly required: ["id", "received_at", "smtp", "headers", "content", "parsed"];
|
|
179
|
+
readonly required: ["id", "received_at", "smtp", "headers", "content", "parsed", "auth"];
|
|
180
180
|
readonly additionalProperties: false;
|
|
181
181
|
readonly description: "The email that triggered this event.";
|
|
182
182
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MyMXWebhookError, PAYLOAD_ERRORS, RAW_EMAIL_ERRORS, RawEmailDecodeError, VERIFICATION_ERRORS, WEBHOOK_VERSION, WebhookPayloadError, WebhookValidationError, WebhookVerificationError } from "./errors-2CwICC_t.js";
|
|
2
2
|
import { MYMX_CONFIRMED_HEADER, MYMX_SIGNATURE_HEADER, bufferToString, verifyWebhookSignature } from "./signing-kfnmqAcK.js";
|
|
3
|
-
import { validateEmailReceivedEvent } from "./zod-
|
|
3
|
+
import { validateEmailReceivedEvent } from "./zod-Df95bIDs.js";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
|
|
6
6
|
//#region src/schema.generated.ts
|
|
@@ -170,7 +170,7 @@ const emailReceivedEventJsonSchema = {
|
|
|
170
170
|
},
|
|
171
171
|
"auth": {
|
|
172
172
|
"$ref": "#/definitions/EmailAuth",
|
|
173
|
-
"description": "Email authentication results (SPF, DKIM, DMARC).
|
|
173
|
+
"description": "Email authentication results (SPF, DKIM, DMARC)."
|
|
174
174
|
}
|
|
175
175
|
},
|
|
176
176
|
"required": [
|
|
@@ -179,7 +179,8 @@ const emailReceivedEventJsonSchema = {
|
|
|
179
179
|
"smtp",
|
|
180
180
|
"headers",
|
|
181
181
|
"content",
|
|
182
|
-
"parsed"
|
|
182
|
+
"parsed",
|
|
183
|
+
"auth"
|
|
183
184
|
],
|
|
184
185
|
"additionalProperties": false,
|
|
185
186
|
"description": "The email that triggered this event."
|
|
@@ -468,9 +468,8 @@ interface EmailReceivedEvent {
|
|
|
468
468
|
};
|
|
469
469
|
/**
|
|
470
470
|
* Email authentication results (SPF, DKIM, DMARC).
|
|
471
|
-
* May be absent if authentication was not performed.
|
|
472
471
|
*/
|
|
473
|
-
auth
|
|
472
|
+
auth: EmailAuth;
|
|
474
473
|
};
|
|
475
474
|
}
|
|
476
475
|
/**
|
|
@@ -548,12 +547,10 @@ interface DkimSignature {
|
|
|
548
547
|
* import { handleWebhook, validateEmailAuth } from 'mymx';
|
|
549
548
|
*
|
|
550
549
|
* const event = handleWebhook({ body, headers, secret });
|
|
550
|
+
* const result = validateEmailAuth(event.email.auth);
|
|
551
551
|
*
|
|
552
|
-
* if (
|
|
553
|
-
*
|
|
554
|
-
* if (result.verdict === 'legit') {
|
|
555
|
-
* // Email passed authentication
|
|
556
|
-
* }
|
|
552
|
+
* if (result.verdict === 'legit') {
|
|
553
|
+
* // Email passed authentication
|
|
557
554
|
* }
|
|
558
555
|
* ```
|
|
559
556
|
*/
|
|
@@ -152,7 +152,7 @@ const emailReceivedEventSchema = z.object({
|
|
|
152
152
|
}),
|
|
153
153
|
parsed: parsedDataSchema,
|
|
154
154
|
analysis: z.object({ spamassassin: z.object({ score: z.number() }) }).optional(),
|
|
155
|
-
auth: emailAuthSchema
|
|
155
|
+
auth: emailAuthSchema
|
|
156
156
|
})
|
|
157
157
|
});
|
|
158
158
|
/**
|
package/dist/zod.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmailReceivedEvent } from "./types-
|
|
1
|
+
import { EmailReceivedEvent } from "./types-B5aR2RnG.js";
|
|
2
2
|
import { WebhookValidationError$1 as WebhookValidationError, WebhookValidationErrorCode } from "./errors-CSPHzZB_.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
@@ -1006,7 +1006,7 @@ declare const emailReceivedEventSchema: z.ZodObject<{
|
|
|
1006
1006
|
score: number;
|
|
1007
1007
|
};
|
|
1008
1008
|
}>>;
|
|
1009
|
-
auth: z.
|
|
1009
|
+
auth: z.ZodObject<{
|
|
1010
1010
|
spf: z.ZodEnum<["pass", "fail", "softfail", "neutral", "none", "temperror", "permerror"]>;
|
|
1011
1011
|
dmarc: z.ZodEnum<["pass", "fail", "none", "temperror", "permerror"]>;
|
|
1012
1012
|
dmarcPolicy: z.ZodNullable<z.ZodEnum<["reject", "quarantine", "none"]>>;
|
|
@@ -1071,7 +1071,7 @@ declare const emailReceivedEventSchema: z.ZodObject<{
|
|
|
1071
1071
|
keyBits: number | null;
|
|
1072
1072
|
algo: string;
|
|
1073
1073
|
}[];
|
|
1074
|
-
}
|
|
1074
|
+
}>;
|
|
1075
1075
|
}, "strip", z.ZodTypeAny, {
|
|
1076
1076
|
id: string;
|
|
1077
1077
|
received_at: string;
|
|
@@ -1159,12 +1159,7 @@ declare const emailReceivedEventSchema: z.ZodObject<{
|
|
|
1159
1159
|
}[];
|
|
1160
1160
|
attachments_download_url: null;
|
|
1161
1161
|
};
|
|
1162
|
-
|
|
1163
|
-
spamassassin: {
|
|
1164
|
-
score: number;
|
|
1165
|
-
};
|
|
1166
|
-
} | undefined;
|
|
1167
|
-
auth?: {
|
|
1162
|
+
auth: {
|
|
1168
1163
|
spf: "pass" | "fail" | "softfail" | "neutral" | "none" | "temperror" | "permerror";
|
|
1169
1164
|
dmarc: "pass" | "fail" | "none" | "temperror" | "permerror";
|
|
1170
1165
|
dmarcPolicy: "none" | "reject" | "quarantine" | null;
|
|
@@ -1181,6 +1176,11 @@ declare const emailReceivedEventSchema: z.ZodObject<{
|
|
|
1181
1176
|
keyBits: number | null;
|
|
1182
1177
|
algo: string;
|
|
1183
1178
|
}[];
|
|
1179
|
+
};
|
|
1180
|
+
analysis?: {
|
|
1181
|
+
spamassassin: {
|
|
1182
|
+
score: number;
|
|
1183
|
+
};
|
|
1184
1184
|
} | undefined;
|
|
1185
1185
|
}, {
|
|
1186
1186
|
id: string;
|
|
@@ -1269,12 +1269,7 @@ declare const emailReceivedEventSchema: z.ZodObject<{
|
|
|
1269
1269
|
}[];
|
|
1270
1270
|
attachments_download_url: null;
|
|
1271
1271
|
};
|
|
1272
|
-
|
|
1273
|
-
spamassassin: {
|
|
1274
|
-
score: number;
|
|
1275
|
-
};
|
|
1276
|
-
} | undefined;
|
|
1277
|
-
auth?: {
|
|
1272
|
+
auth: {
|
|
1278
1273
|
spf: "pass" | "fail" | "softfail" | "neutral" | "none" | "temperror" | "permerror";
|
|
1279
1274
|
dmarc: "pass" | "fail" | "none" | "temperror" | "permerror";
|
|
1280
1275
|
dmarcPolicy: "none" | "reject" | "quarantine" | null;
|
|
@@ -1291,6 +1286,11 @@ declare const emailReceivedEventSchema: z.ZodObject<{
|
|
|
1291
1286
|
keyBits: number | null;
|
|
1292
1287
|
algo: string;
|
|
1293
1288
|
}[];
|
|
1289
|
+
};
|
|
1290
|
+
analysis?: {
|
|
1291
|
+
spamassassin: {
|
|
1292
|
+
score: number;
|
|
1293
|
+
};
|
|
1294
1294
|
} | undefined;
|
|
1295
1295
|
}>;
|
|
1296
1296
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1389,12 +1389,7 @@ declare const emailReceivedEventSchema: z.ZodObject<{
|
|
|
1389
1389
|
}[];
|
|
1390
1390
|
attachments_download_url: null;
|
|
1391
1391
|
};
|
|
1392
|
-
|
|
1393
|
-
spamassassin: {
|
|
1394
|
-
score: number;
|
|
1395
|
-
};
|
|
1396
|
-
} | undefined;
|
|
1397
|
-
auth?: {
|
|
1392
|
+
auth: {
|
|
1398
1393
|
spf: "pass" | "fail" | "softfail" | "neutral" | "none" | "temperror" | "permerror";
|
|
1399
1394
|
dmarc: "pass" | "fail" | "none" | "temperror" | "permerror";
|
|
1400
1395
|
dmarcPolicy: "none" | "reject" | "quarantine" | null;
|
|
@@ -1411,6 +1406,11 @@ declare const emailReceivedEventSchema: z.ZodObject<{
|
|
|
1411
1406
|
keyBits: number | null;
|
|
1412
1407
|
algo: string;
|
|
1413
1408
|
}[];
|
|
1409
|
+
};
|
|
1410
|
+
analysis?: {
|
|
1411
|
+
spamassassin: {
|
|
1412
|
+
score: number;
|
|
1413
|
+
};
|
|
1414
1414
|
} | undefined;
|
|
1415
1415
|
};
|
|
1416
1416
|
}, {
|
|
@@ -1509,12 +1509,7 @@ declare const emailReceivedEventSchema: z.ZodObject<{
|
|
|
1509
1509
|
}[];
|
|
1510
1510
|
attachments_download_url: null;
|
|
1511
1511
|
};
|
|
1512
|
-
|
|
1513
|
-
spamassassin: {
|
|
1514
|
-
score: number;
|
|
1515
|
-
};
|
|
1516
|
-
} | undefined;
|
|
1517
|
-
auth?: {
|
|
1512
|
+
auth: {
|
|
1518
1513
|
spf: "pass" | "fail" | "softfail" | "neutral" | "none" | "temperror" | "permerror";
|
|
1519
1514
|
dmarc: "pass" | "fail" | "none" | "temperror" | "permerror";
|
|
1520
1515
|
dmarcPolicy: "none" | "reject" | "quarantine" | null;
|
|
@@ -1531,6 +1526,11 @@ declare const emailReceivedEventSchema: z.ZodObject<{
|
|
|
1531
1526
|
keyBits: number | null;
|
|
1532
1527
|
algo: string;
|
|
1533
1528
|
}[];
|
|
1529
|
+
};
|
|
1530
|
+
analysis?: {
|
|
1531
|
+
spamassassin: {
|
|
1532
|
+
score: number;
|
|
1533
|
+
};
|
|
1534
1534
|
} | undefined;
|
|
1535
1535
|
};
|
|
1536
1536
|
}>;
|
package/dist/zod.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { WebhookValidationError } from "./errors-2CwICC_t.js";
|
|
2
|
-
import { dkimSignatureResultSchema, dkimSignatureSchema, dmarcPolicySchema, dmarcResultSchema, emailAddressSchema, emailAuthSchema, emailReceivedEventSchema, parsedDataCompleteSchema, parsedDataFailedSchema, parsedDataSchema, parsedErrorSchema, rawContentDownloadOnlySchema, rawContentInlineSchema, rawContentSchema, safeValidateEmailReceivedEvent, spfResultSchema, validateEmailReceivedEvent, webhookAttachmentSchema } from "./zod-
|
|
2
|
+
import { dkimSignatureResultSchema, dkimSignatureSchema, dmarcPolicySchema, dmarcResultSchema, emailAddressSchema, emailAuthSchema, emailReceivedEventSchema, parsedDataCompleteSchema, parsedDataFailedSchema, parsedDataSchema, parsedErrorSchema, rawContentDownloadOnlySchema, rawContentInlineSchema, rawContentSchema, safeValidateEmailReceivedEvent, spfResultSchema, validateEmailReceivedEvent, webhookAttachmentSchema } from "./zod-Df95bIDs.js";
|
|
3
3
|
|
|
4
4
|
export { WebhookValidationError, dkimSignatureResultSchema, dkimSignatureSchema, dmarcPolicySchema, dmarcResultSchema, emailAddressSchema, emailAuthSchema, emailReceivedEventSchema, parsedDataCompleteSchema, parsedDataFailedSchema, parsedDataSchema, parsedErrorSchema, rawContentDownloadOnlySchema, rawContentInlineSchema, rawContentSchema, safeValidateEmailReceivedEvent, spfResultSchema, validateEmailReceivedEvent, webhookAttachmentSchema };
|