@primitivedotdev/sdk 0.2.1 → 0.2.2
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/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WEBHOOK_VERSION, signWebhookPayload, validateEmailReceivedEvent } from "../webhook-
|
|
1
|
+
import { WEBHOOK_VERSION, signWebhookPayload, validateEmailReceivedEvent } from "../webhook-Cz3QsQnS.js";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
|
|
4
4
|
//#region src/contract/contract.ts
|
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-
|
|
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-Cz3QsQnS.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 };
|
package/dist/webhook/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-
|
|
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-Cz3QsQnS.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 =
|
|
194
|
-
const formats4 =
|
|
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",
|
|
@@ -4855,7 +4849,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
4855
4849
|
if (data3.attempted_at !== void 0) {
|
|
4856
4850
|
let data6 = data3.attempted_at;
|
|
4857
4851
|
if (typeof data6 === "string") {
|
|
4858
|
-
if (!formats0.
|
|
4852
|
+
if (!formats0.test(data6)) {
|
|
4859
4853
|
const err17 = {
|
|
4860
4854
|
instancePath: instancePath + "/delivery/attempted_at",
|
|
4861
4855
|
schemaPath: "#/properties/delivery/properties/attempted_at/format",
|
|
@@ -5009,7 +5003,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
5009
5003
|
if (data7.received_at !== void 0) {
|
|
5010
5004
|
let data9 = data7.received_at;
|
|
5011
5005
|
if (typeof data9 === "string") {
|
|
5012
|
-
if (!formats0.
|
|
5006
|
+
if (!formats0.test(data9)) {
|
|
5013
5007
|
const err29 = {
|
|
5014
5008
|
instancePath: instancePath + "/email/received_at",
|
|
5015
5009
|
schemaPath: "#/properties/email/properties/received_at/format",
|
|
@@ -5252,7 +5246,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
5252
5246
|
if (data15.from !== void 0) {
|
|
5253
5247
|
let data18 = data15.from;
|
|
5254
5248
|
if (typeof data18 === "string") {
|
|
5255
|
-
if (
|
|
5249
|
+
if (data18.length < 1) {
|
|
5256
5250
|
const err47 = {
|
|
5257
5251
|
instancePath: instancePath + "/email/headers/from",
|
|
5258
5252
|
schemaPath: "#/properties/email/properties/headers/properties/from/minLength",
|
|
@@ -5280,7 +5274,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
5280
5274
|
if (data15.to !== void 0) {
|
|
5281
5275
|
let data19 = data15.to;
|
|
5282
5276
|
if (typeof data19 === "string") {
|
|
5283
|
-
if (
|
|
5277
|
+
if (data19.length < 1) {
|
|
5284
5278
|
const err49 = {
|
|
5285
5279
|
instancePath: instancePath + "/email/headers/to",
|
|
5286
5280
|
schemaPath: "#/properties/email/properties/headers/properties/to/minLength",
|
|
@@ -5413,7 +5407,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
5413
5407
|
else vErrors.push(err57);
|
|
5414
5408
|
errors++;
|
|
5415
5409
|
}
|
|
5416
|
-
if (!formats4(data24)) {
|
|
5410
|
+
if (!formats4.test(data24)) {
|
|
5417
5411
|
const err58 = {
|
|
5418
5412
|
instancePath: instancePath + "/email/content/download/url",
|
|
5419
5413
|
schemaPath: "#/properties/email/properties/content/properties/download/properties/url/format",
|
|
@@ -5441,7 +5435,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
5441
5435
|
if (data23.expires_at !== void 0) {
|
|
5442
5436
|
let data25 = data23.expires_at;
|
|
5443
5437
|
if (typeof data25 === "string") {
|
|
5444
|
-
if (!formats0.
|
|
5438
|
+
if (!formats0.test(data25)) {
|
|
5445
5439
|
const err60 = {
|
|
5446
5440
|
instancePath: instancePath + "/email/content/download/expires_at",
|
|
5447
5441
|
schemaPath: "#/properties/email/properties/content/properties/download/properties/expires_at/format",
|