@primitivedotdev/sdk 1.8.0 → 1.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,4 +1,4 @@
1
- import { F as WebhookAttachment, l as EmailAddress, w as ParsedDataComplete } from "../types-BjnIxPED.js";
1
+ import { F as WebhookAttachment, l as EmailAddress, w as ParsedDataComplete } from "../types-CAG3bi20.js";
2
2
  import { a as parseFromHeader, i as ValidatedAddress, n as ParseFromHeaderResult, o as parseFromHeaderLoose, r as ParsedAddress, t as ParseFromHeaderFailureReason } from "../address-parser-CA6G7R-h.js";
3
3
 
4
4
  //#region src/parser/attachment-parser.d.ts
@@ -929,28 +929,42 @@ type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];
929
929
  /** True if `eventType` is a known current catalog value. */
930
930
  declare function isKnownWebhookEventType(eventType: string | null | undefined): eventType is WebhookEventType;
931
931
  /**
932
- * Common shape of a `payment.*` webhook body. The stored payload carries the
933
- * event name in `type` (not `event`); the parser overlays a canonical `event`
934
- * from the header so consumers can branch on a single field.
932
+ * Common shape of a `payment.*` webhook body. The stored payload is FLAT (no
933
+ * envelope, no nested `payment` object): it carries the event name in `type`,
934
+ * and the parser overlays a canonical `event` mirrored from the
935
+ * `X-Webhook-Event` header so consumers can branch on a single field. All
936
+ * amounts are token base units (USDC has 6 decimals, so `"10000"` is 0.01).
935
937
  */
936
938
  interface PaymentEvent {
937
939
  /** Canonical event name, mirrored from the `X-Webhook-Event` header. */
938
940
  event: "payment.settled" | "payment.failed";
939
941
  /** The event name as carried in the raw stored body. */
940
- type?: string;
941
- id?: string;
942
- created_at?: string;
943
- /** The settlement payload as stored; shape is payment-flow specific. */
944
- payment?: Record<string, unknown>;
942
+ type: "payment.settled" | "payment.failed";
943
+ /** The challenge this payment settles or fails. */
944
+ challenge_id: string;
945
+ /** The settlement network (e.g. `"base"`, `"base-sepolia"`). */
946
+ network: string;
947
+ /** Amount in token base units (USDC has 6 decimals, so `"10000"` is 0.01). */
948
+ amount: string;
949
+ /** The checksummed token contract address. */
950
+ asset: string;
951
+ /** The paying organization id, or null when not on-net. */
952
+ payer_org: string | null;
945
953
  [key: string]: unknown;
946
954
  }
947
955
  /** A `payment.settled` webhook event. */
948
956
  interface PaymentSettledEvent extends PaymentEvent {
949
957
  event: "payment.settled";
958
+ type: "payment.settled";
959
+ /** The on-chain settlement transaction hash. */
960
+ settle_tx: string;
950
961
  }
951
962
  /** A `payment.failed` webhook event. */
952
963
  interface PaymentFailedEvent extends PaymentEvent {
953
964
  event: "payment.failed";
965
+ type: "payment.failed";
966
+ /** Human-readable reason the payment failed. */
967
+ failure_reason: string;
954
968
  }
955
969
  /** A single interaction.x402.* event suffix. */
956
970
  type InteractionX402Suffix = "challenge" | "payment" | "settled" | "rejected" | "declined" | "expired" | "verify_timeout";
@@ -1,4 +1,4 @@
1
- import { $ as isPaymentSettledEvent, A as RawContentInline, B as InteractionX402Event, C as ParsedData, D as ParsedStatus, E as ParsedError, F as WebhookAttachment, G as PaymentSettledEvent, H as PAYMENT_EVENT_TYPES, I as WebhookEvent, J as isEmailReceivedEvent, K as WEBHOOK_EVENT_TYPES, L as EMAIL_EVENT_TYPES, M as TlsReportAnalysis, N as UnknownEvent, O as RawContent, P as ValidateEmailAuthResult, Q as isPaymentFailedEvent, R as INTERACTION_EVENT_TYPES, S as KnownWebhookEvent, T as ParsedDataFailed, U as PaymentEvent, V as InteractionX402Suffix, W as PaymentFailedEvent, X as isKnownWebhookEventType, Y as isInteractionX402Event, Z as isPaymentEvent, _ as ForwardResultAttachmentAnalyzed, a as DkimSignature, b as ForwardVerdict, c as DmarcResult, d as EmailAuth, f as EmailReceivedEvent, g as ForwardResult, h as ForwardOriginalSender, i as DkimResult, j as SpfResult, k as RawContentDownloadOnly, l as EmailAddress, m as ForwardAnalysis, n as AuthVerdict, o as DmarcPolicy, p as EventType, q as WebhookEventType, r as BounceAnalysis, s as DmarcReportAnalysis, t as AuthConfidence, u as EmailAnalysis, v as ForwardResultAttachmentSkipped, w as ParsedDataComplete, x as ForwardVerification, y as ForwardResultInline, z as InteractionEvent } from "../types-BjnIxPED.js";
2
- import { _ as buildForwardSubject, a as RawEmailDecodeErrorCode, b as normalizeReceivedEmail, c as WebhookPayloadError, d as WebhookValidationErrorCode, f as WebhookVerificationError, g as ReceivedEmailThread, h as ReceivedEmailAddress, i as RawEmailDecodeError, l as WebhookPayloadErrorCode, m as ReceivedEmail, n as PrimitiveWebhookError, o as VERIFICATION_ERRORS, p as WebhookVerificationErrorCode, r as RAW_EMAIL_ERRORS, s as WebhookErrorCode, t as PAYLOAD_ERRORS, u as WebhookValidationError, v as buildReplySubject, x as parseHeaderAddress, y as formatAddress } from "../errors-bXUNXAlf.js";
3
- import { A as PRIMITIVE_SIGNATURE_HEADER, B as safeValidateEmailReceivedEvent, C as StandardWebhooksSignResult, D as LEGACY_CONFIRMED_HEADER, E as verifyStandardWebhooksSignature, F as GenerateDownloadTokenOptions, I as VerifyDownloadTokenOptions, L as VerifyDownloadTokenResult, M as VerifyOptions, N as signWebhookPayload, O as LEGACY_SIGNATURE_HEADER, P as verifyWebhookSignature, R as generateDownloadToken, S as STANDARD_WEBHOOK_TIMESTAMP_HEADER, T as signStandardWebhooksPayload, V as validateEmailReceivedEvent, _ as WEBHOOK_VERSION, a as WebhookHeaders, b as STANDARD_WEBHOOK_ID_HEADER, c as getDownloadTimeRemaining, d as handleWebhookEvent, f as isDownloadExpired, g as verifyRawEmailDownload, h as receive, i as WEBHOOK_EVENT_HEADER, j as SignResult, k as PRIMITIVE_CONFIRMED_HEADER, l as getEventHeader, m as parseWebhookEvent, n as HandleWebhookOptions, o as confirmedHeaders, p as isRawIncluded, r as ReceiveRequestOptions, s as decodeRawEmail, t as DecodeRawEmailOptions, u as handleWebhook, v as validateEmailAuth, w as StandardWebhooksVerifyOptions, x as STANDARD_WEBHOOK_SIGNATURE_HEADER, y as emailReceivedEventJsonSchema, z as verifyDownloadToken } from "../index-BDnY9HH-.js";
1
+ import { $ as isPaymentSettledEvent, A as RawContentInline, B as InteractionX402Event, C as ParsedData, D as ParsedStatus, E as ParsedError, F as WebhookAttachment, G as PaymentSettledEvent, H as PAYMENT_EVENT_TYPES, I as WebhookEvent, J as isEmailReceivedEvent, K as WEBHOOK_EVENT_TYPES, L as EMAIL_EVENT_TYPES, M as TlsReportAnalysis, N as UnknownEvent, O as RawContent, P as ValidateEmailAuthResult, Q as isPaymentFailedEvent, R as INTERACTION_EVENT_TYPES, S as KnownWebhookEvent, T as ParsedDataFailed, U as PaymentEvent, V as InteractionX402Suffix, W as PaymentFailedEvent, X as isKnownWebhookEventType, Y as isInteractionX402Event, Z as isPaymentEvent, _ as ForwardResultAttachmentAnalyzed, a as DkimSignature, b as ForwardVerdict, c as DmarcResult, d as EmailAuth, f as EmailReceivedEvent, g as ForwardResult, h as ForwardOriginalSender, i as DkimResult, j as SpfResult, k as RawContentDownloadOnly, l as EmailAddress, m as ForwardAnalysis, n as AuthVerdict, o as DmarcPolicy, p as EventType, q as WebhookEventType, r as BounceAnalysis, s as DmarcReportAnalysis, t as AuthConfidence, u as EmailAnalysis, v as ForwardResultAttachmentSkipped, w as ParsedDataComplete, x as ForwardVerification, y as ForwardResultInline, z as InteractionEvent } from "../types-CAG3bi20.js";
2
+ import { _ as buildForwardSubject, a as RawEmailDecodeErrorCode, b as normalizeReceivedEmail, c as WebhookPayloadError, d as WebhookValidationErrorCode, f as WebhookVerificationError, g as ReceivedEmailThread, h as ReceivedEmailAddress, i as RawEmailDecodeError, l as WebhookPayloadErrorCode, m as ReceivedEmail, n as PrimitiveWebhookError, o as VERIFICATION_ERRORS, p as WebhookVerificationErrorCode, r as RAW_EMAIL_ERRORS, s as WebhookErrorCode, t as PAYLOAD_ERRORS, u as WebhookValidationError, v as buildReplySubject, x as parseHeaderAddress, y as formatAddress } from "../errors-jagfi4Ue.js";
3
+ import { A as PRIMITIVE_SIGNATURE_HEADER, B as safeValidateEmailReceivedEvent, C as StandardWebhooksSignResult, D as LEGACY_CONFIRMED_HEADER, E as verifyStandardWebhooksSignature, F as GenerateDownloadTokenOptions, I as VerifyDownloadTokenOptions, L as VerifyDownloadTokenResult, M as VerifyOptions, N as signWebhookPayload, O as LEGACY_SIGNATURE_HEADER, P as verifyWebhookSignature, R as generateDownloadToken, S as STANDARD_WEBHOOK_TIMESTAMP_HEADER, T as signStandardWebhooksPayload, V as validateEmailReceivedEvent, _ as WEBHOOK_VERSION, a as WebhookHeaders, b as STANDARD_WEBHOOK_ID_HEADER, c as getDownloadTimeRemaining, d as handleWebhookEvent, f as isDownloadExpired, g as verifyRawEmailDownload, h as receive, i as WEBHOOK_EVENT_HEADER, j as SignResult, k as PRIMITIVE_CONFIRMED_HEADER, l as getEventHeader, m as parseWebhookEvent, n as HandleWebhookOptions, o as confirmedHeaders, p as isRawIncluded, r as ReceiveRequestOptions, s as decodeRawEmail, t as DecodeRawEmailOptions, u as handleWebhook, v as validateEmailAuth, w as StandardWebhooksVerifyOptions, x as STANDARD_WEBHOOK_SIGNATURE_HEADER, y as emailReceivedEventJsonSchema, z as verifyDownloadToken } from "../index-MfFuW5sS.js";
4
4
  export { AuthConfidence, AuthVerdict, BounceAnalysis, DecodeRawEmailOptions, DkimResult, DkimSignature, DmarcPolicy, DmarcReportAnalysis, DmarcResult, EMAIL_EVENT_TYPES, EmailAddress, EmailAnalysis, EmailAuth, EmailReceivedEvent, EventType, ForwardAnalysis, ForwardOriginalSender, ForwardResult, ForwardResultAttachmentAnalyzed, ForwardResultAttachmentSkipped, ForwardResultInline, ForwardVerdict, ForwardVerification, GenerateDownloadTokenOptions, HandleWebhookOptions, INTERACTION_EVENT_TYPES, InteractionEvent, InteractionX402Event, InteractionX402Suffix, KnownWebhookEvent, LEGACY_CONFIRMED_HEADER, LEGACY_SIGNATURE_HEADER, PAYLOAD_ERRORS, PAYMENT_EVENT_TYPES, PRIMITIVE_CONFIRMED_HEADER, PRIMITIVE_SIGNATURE_HEADER, ParsedData, ParsedDataComplete, ParsedDataFailed, ParsedError, ParsedStatus, PaymentEvent, PaymentFailedEvent, PaymentSettledEvent, PrimitiveWebhookError, RAW_EMAIL_ERRORS, RawContent, RawContentDownloadOnly, RawContentInline, RawEmailDecodeError, RawEmailDecodeErrorCode, ReceiveRequestOptions, ReceivedEmail, ReceivedEmailAddress, ReceivedEmailThread, STANDARD_WEBHOOK_ID_HEADER, STANDARD_WEBHOOK_SIGNATURE_HEADER, STANDARD_WEBHOOK_TIMESTAMP_HEADER, SignResult, SpfResult, StandardWebhooksSignResult, StandardWebhooksVerifyOptions, TlsReportAnalysis, UnknownEvent, VERIFICATION_ERRORS, ValidateEmailAuthResult, VerifyDownloadTokenOptions, VerifyDownloadTokenResult, VerifyOptions, WEBHOOK_EVENT_HEADER, WEBHOOK_EVENT_TYPES, WEBHOOK_VERSION, WebhookAttachment, WebhookErrorCode, WebhookEvent, WebhookEventType, WebhookHeaders, WebhookPayloadError, WebhookPayloadErrorCode, WebhookValidationError, WebhookValidationErrorCode, WebhookVerificationError, WebhookVerificationErrorCode, buildForwardSubject, buildReplySubject, confirmedHeaders, decodeRawEmail, emailReceivedEventJsonSchema, formatAddress, generateDownloadToken, getDownloadTimeRemaining, getEventHeader, handleWebhook, handleWebhookEvent, isDownloadExpired, isEmailReceivedEvent, isInteractionX402Event, isKnownWebhookEventType, isPaymentEvent, isPaymentFailedEvent, isPaymentSettledEvent, isRawIncluded, normalizeReceivedEmail, parseHeaderAddress, parseWebhookEvent, receive, safeValidateEmailReceivedEvent, signStandardWebhooksPayload, signWebhookPayload, validateEmailAuth, validateEmailReceivedEvent, verifyDownloadToken, verifyRawEmailDownload, verifyStandardWebhooksSignature, verifyWebhookSignature };
@@ -382,7 +382,7 @@ interface X402EmailChargeInput {
382
382
  description?: string;
383
383
  /** A URL identifying the thing being paid for. */
384
384
  resource?: string;
385
- /** Seconds until the challenge expires (default 1h). */
385
+ /** Seconds until the challenge expires (defaults to 300s / 5 minutes). */
386
386
  expiresIn?: number;
387
387
  /**
388
388
  * Optional idempotency key. Retrying `createEmailChallenge()` with the same
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primitivedotdev/sdk",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "description": "Official Primitive Node.js SDK: webhook, api, openapi, contract, and parser runtime modules.",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -93,7 +93,7 @@
93
93
  "dependencies": {
94
94
  "ajv": "^8.17.1",
95
95
  "mailparser": "^3.9.0",
96
- "nodemailer": "^8.0.7",
96
+ "nodemailer": "^9.0.1",
97
97
  "sanitize-html": "^2.14.0",
98
98
  "tar-stream": "^3.1.8",
99
99
  "validator": "^13.15.35",