@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.
@@ -1,12 +1,8 @@
1
- import { EmailAuth, EmailReceivedEvent, ValidateEmailAuthResult, WebhookEvent } from "./types-CIOzt1FY.js";
2
- import { ReceivedEmail } from "./received-email-C67Z7Dha.js";
1
+ import { N as WebhookEvent, j as ValidateEmailAuthResult, l as EmailAuth, u as EmailReceivedEvent } from "./types-9vXGZjPd.js";
2
+ import { t as ReceivedEmail } from "./received-email-DNjpq_Wt.js";
3
3
  import { ErrorObject } from "ajv";
4
4
 
5
5
  //#region src/webhook/errors.d.ts
6
- /**
7
- * Verification error definitions.
8
- * Use these for documentation, dashboards, and i18n.
9
- */
10
6
  /**
11
7
  * Verification error definitions.
12
8
  * Use these for documentation, dashboards, and i18n.
@@ -211,7 +207,8 @@ declare class RawEmailDecodeError extends PrimitiveWebhookError {
211
207
  readonly code: RawEmailDecodeErrorCode;
212
208
  readonly suggestion: string;
213
209
  constructor(code: RawEmailDecodeErrorCode, message?: string);
214
- } //#endregion
210
+ }
211
+ //#endregion
215
212
  //#region src/validation.d.ts
216
213
  interface ValidationSuccess<T> {
217
214
  success: true;
@@ -224,7 +221,6 @@ interface ValidationFailure {
224
221
  type ValidationResult<T> = ValidationSuccess<T> | ValidationFailure;
225
222
  declare function validateEmailReceivedEvent(input: unknown): EmailReceivedEvent;
226
223
  declare function safeValidateEmailReceivedEvent(input: unknown): ValidationResult<EmailReceivedEvent>;
227
-
228
224
  //#endregion
229
225
  //#region src/webhook/download-tokens.d.ts
230
226
  /**
@@ -313,7 +309,6 @@ type VerifyDownloadTokenResult = {
313
309
  * @returns Whether the token is valid, plus a reason on failure.
314
310
  */
315
311
  declare function verifyDownloadToken(params: VerifyDownloadTokenOptions): VerifyDownloadTokenResult;
316
-
317
312
  //#endregion
318
313
  //#region src/webhook/signing.d.ts
319
314
  /**
@@ -406,7 +401,6 @@ declare function signWebhookPayload(rawBody: string | Buffer, secret: string | B
406
401
  * ```
407
402
  */
408
403
  declare function verifyWebhookSignature(opts: VerifyOptions): true;
409
-
410
404
  //#endregion
411
405
  //#region src/webhook/standard-webhooks.d.ts
412
406
  /**
@@ -458,15 +452,6 @@ interface StandardWebhooksVerifyOptions {
458
452
  /** Override current time for testing (unix seconds) */
459
453
  nowSeconds?: number;
460
454
  }
461
- /**
462
- * Prepare a Standard Webhooks secret for HMAC computation.
463
- *
464
- * Strips the "whsec_" prefix if present, then base64-decodes the remainder
465
- * to produce the raw HMAC key bytes.
466
- *
467
- * @internal
468
- */
469
-
470
455
  /**
471
456
  * Sign a webhook payload using the Standard Webhooks format.
472
457
  *
@@ -482,7 +467,6 @@ declare function signStandardWebhooksPayload(rawBody: string | Buffer, secret: s
482
467
  * Throws `WebhookVerificationError` on failure with a specific error code.
483
468
  */
484
469
  declare function verifyStandardWebhooksSignature(opts: StandardWebhooksVerifyOptions): true;
485
-
486
470
  //#endregion
487
471
  //#region src/schema.generated.d.ts
488
472
  /**
@@ -1274,7 +1258,8 @@ declare const emailReceivedEventJsonSchema: {
1274
1258
  readonly description: "DKIM signature verification result for a single signature.";
1275
1259
  };
1276
1260
  };
1277
- }; //#endregion
1261
+ };
1262
+ //#endregion
1278
1263
  //#region src/webhook/auth.d.ts
1279
1264
  /**
1280
1265
  * Validate email authentication and compute a verdict.
@@ -1336,7 +1321,6 @@ declare const emailReceivedEventJsonSchema: {
1336
1321
  * ```
1337
1322
  */
1338
1323
  declare function validateEmailAuth(auth: EmailAuth): ValidateEmailAuthResult;
1339
-
1340
1324
  //#endregion
1341
1325
  //#region src/webhook/version.d.ts
1342
1326
  /**
@@ -1352,15 +1336,8 @@ declare function validateEmailAuth(auth: EmailAuth): ValidateEmailAuthResult;
1352
1336
  * need to handle version-specific behavior.
1353
1337
  */
1354
1338
  declare const WEBHOOK_VERSION = "2025-12-14";
1355
-
1356
1339
  //#endregion
1357
1340
  //#region src/webhook/index.d.ts
1358
- /**
1359
- * Valid webhook version format (YYYY-MM-DD date string).
1360
- * The SDK accepts any valid date-formatted version, not just the current one,
1361
- * for forward and backward compatibility.
1362
- */
1363
-
1364
1341
  /**
1365
1342
  * Parse a webhook payload, returning typed events for known types
1366
1343
  * and UnknownEvent for future event types.
@@ -1646,6 +1623,5 @@ declare function decodeRawEmail(event: EmailReceivedEvent, options?: DecodeRawEm
1646
1623
  * ```
1647
1624
  */
1648
1625
  declare function verifyRawEmailDownload(downloaded: Buffer | ArrayBuffer | Uint8Array, event: EmailReceivedEvent): Buffer;
1649
-
1650
1626
  //#endregion
1651
- export { DecodeRawEmailOptions, GenerateDownloadTokenOptions, HandleWebhookOptions, LEGACY_CONFIRMED_HEADER as LEGACY_CONFIRMED_HEADER$1, LEGACY_SIGNATURE_HEADER as LEGACY_SIGNATURE_HEADER$1, PAYLOAD_ERRORS as PAYLOAD_ERRORS$1, PRIMITIVE_CONFIRMED_HEADER as PRIMITIVE_CONFIRMED_HEADER$1, PRIMITIVE_SIGNATURE_HEADER as PRIMITIVE_SIGNATURE_HEADER$1, PrimitiveWebhookError as PrimitiveWebhookError$1, RAW_EMAIL_ERRORS as RAW_EMAIL_ERRORS$1, RawEmailDecodeError as RawEmailDecodeError$1, RawEmailDecodeErrorCode, ReceiveRequestOptions, STANDARD_WEBHOOK_ID_HEADER as STANDARD_WEBHOOK_ID_HEADER$1, STANDARD_WEBHOOK_SIGNATURE_HEADER as STANDARD_WEBHOOK_SIGNATURE_HEADER$1, STANDARD_WEBHOOK_TIMESTAMP_HEADER as STANDARD_WEBHOOK_TIMESTAMP_HEADER$1, SignResult, StandardWebhooksSignResult, StandardWebhooksVerifyOptions, VERIFICATION_ERRORS as VERIFICATION_ERRORS$1, VerifyDownloadTokenOptions, VerifyDownloadTokenResult, VerifyOptions, WEBHOOK_VERSION as WEBHOOK_VERSION$1, WebhookErrorCode, WebhookHeaders, WebhookPayloadError as WebhookPayloadError$1, WebhookPayloadErrorCode, WebhookValidationError as WebhookValidationError$1, WebhookValidationErrorCode, WebhookVerificationError as WebhookVerificationError$1, WebhookVerificationErrorCode, confirmedHeaders as confirmedHeaders$1, decodeRawEmail as decodeRawEmail$1, emailReceivedEventJsonSchema as emailReceivedEventJsonSchema$1, generateDownloadToken as generateDownloadToken$1, getDownloadTimeRemaining as getDownloadTimeRemaining$1, handleWebhook as handleWebhook$1, isDownloadExpired as isDownloadExpired$1, isEmailReceivedEvent as isEmailReceivedEvent$1, isRawIncluded as isRawIncluded$1, parseWebhookEvent as parseWebhookEvent$1, receive as receive$1, safeValidateEmailReceivedEvent as safeValidateEmailReceivedEvent$1, signStandardWebhooksPayload as signStandardWebhooksPayload$1, signWebhookPayload as signWebhookPayload$1, validateEmailAuth as validateEmailAuth$1, validateEmailReceivedEvent as validateEmailReceivedEvent$1, verifyDownloadToken as verifyDownloadToken$1, verifyRawEmailDownload as verifyRawEmailDownload$1, verifyStandardWebhooksSignature as verifyStandardWebhooksSignature$1, verifyWebhookSignature as verifyWebhookSignature$1 };
1627
+ export { VerifyOptions as A, PAYLOAD_ERRORS as B, signStandardWebhooksPayload as C, PRIMITIVE_CONFIRMED_HEADER as D, LEGACY_SIGNATURE_HEADER as E, VerifyDownloadTokenResult as F, VERIFICATION_ERRORS as G, RAW_EMAIL_ERRORS as H, generateDownloadToken as I, WebhookPayloadErrorCode as J, WebhookErrorCode as K, verifyDownloadToken as L, verifyWebhookSignature as M, GenerateDownloadTokenOptions as N, PRIMITIVE_SIGNATURE_HEADER as O, VerifyDownloadTokenOptions as P, WebhookVerificationErrorCode as Q, safeValidateEmailReceivedEvent as R, StandardWebhooksVerifyOptions as S, LEGACY_CONFIRMED_HEADER as T, RawEmailDecodeError as U, PrimitiveWebhookError as V, RawEmailDecodeErrorCode as W, WebhookValidationErrorCode as X, WebhookValidationError as Y, WebhookVerificationError as Z, emailReceivedEventJsonSchema as _, confirmedHeaders as a, STANDARD_WEBHOOK_TIMESTAMP_HEADER as b, handleWebhook as c, isRawIncluded as d, parseWebhookEvent as f, validateEmailAuth as g, WEBHOOK_VERSION as h, WebhookHeaders as i, signWebhookPayload as j, SignResult as k, isDownloadExpired as l, verifyRawEmailDownload as m, HandleWebhookOptions as n, decodeRawEmail as o, receive as p, WebhookPayloadError as q, ReceiveRequestOptions as r, getDownloadTimeRemaining as s, DecodeRawEmailOptions as t, isEmailReceivedEvent as u, STANDARD_WEBHOOK_ID_HEADER as v, verifyStandardWebhooksSignature as w, StandardWebhooksSignResult as x, STANDARD_WEBHOOK_SIGNATURE_HEADER as y, validateEmailReceivedEvent as z };