@primitivedotdev/sdk 0.25.0 → 0.25.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.
@@ -1,4 +1,4 @@
1
- import { t as ReceivedEmail } from "./received-email-DNjpq_Wt.js";
1
+ import { m as ReceivedEmail } from "./errors-C53fe686.js";
2
2
 
3
3
  //#region src/api/generated/core/auth.gen.d.ts
4
4
  type AuthToken = string | undefined;
@@ -1707,6 +1707,52 @@ type TestInvocationResult = {
1707
1707
  */
1708
1708
  watch_url: string;
1709
1709
  };
1710
+ /**
1711
+ * One row from GET /functions/{id}/logs. Represents a single
1712
+ * captured log line emitted by the running handler (e.g. via
1713
+ * `console.log` / `console.error`).
1714
+ *
1715
+ */
1716
+ type FunctionLogRow = {
1717
+ /**
1718
+ * Unique log row id (stable across pages).
1719
+ */
1720
+ id: string;
1721
+ /**
1722
+ * The function this log row belongs to.
1723
+ */
1724
+ function_id: string;
1725
+ /**
1726
+ * Severity. `log` is the runtime's default for unannotated
1727
+ * `console.log` calls; the other levels match standard
1728
+ * `console.*` methods.
1729
+ *
1730
+ */
1731
+ level: 'debug' | 'log' | 'info' | 'warn' | 'error';
1732
+ /**
1733
+ * The textual message body. The runtime stringifies non-string
1734
+ * arguments before persisting, so this is always a plain
1735
+ * string.
1736
+ *
1737
+ */
1738
+ message: string;
1739
+ /**
1740
+ * When the handler emitted this line. Newest-first ordering
1741
+ * on this column drives pagination; clock is the runtime's,
1742
+ * not the gateway's.
1743
+ *
1744
+ */
1745
+ ts: string;
1746
+ /**
1747
+ * Optional structured payload the runtime attaches alongside
1748
+ * the message (e.g. extra args passed to `console.log`).
1749
+ * Shape is opaque; treat keys as untyped.
1750
+ *
1751
+ */
1752
+ metadata?: {
1753
+ [key: string]: unknown;
1754
+ } | null;
1755
+ };
1710
1756
  /**
1711
1757
  * One row from GET /functions/{id}/secrets. Discriminate on the
1712
1758
  * `managed` field:
@@ -3583,8 +3629,68 @@ type SetFunctionSecretResponses = {
3583
3629
  };
3584
3630
  };
3585
3631
  type SetFunctionSecretResponse = SetFunctionSecretResponses[keyof SetFunctionSecretResponses];
3632
+ type ListFunctionLogsData = {
3633
+ body?: never;
3634
+ path: {
3635
+ /**
3636
+ * Resource UUID
3637
+ */
3638
+ id: string;
3639
+ };
3640
+ query?: {
3641
+ /**
3642
+ * Maximum number of rows to return. Clamped to 1..200; default
3643
+ * 50.
3644
+ *
3645
+ */
3646
+ limit?: number;
3647
+ /**
3648
+ * Opaque pagination cursor from a previous response's
3649
+ * `next_cursor`. Omit on the first call.
3650
+ *
3651
+ */
3652
+ cursor?: string;
3653
+ };
3654
+ url: '/functions/{id}/logs';
3655
+ };
3656
+ type ListFunctionLogsErrors = {
3657
+ /**
3658
+ * Invalid request parameters
3659
+ */
3660
+ 400: ErrorResponse;
3661
+ /**
3662
+ * Invalid or missing API key
3663
+ */
3664
+ 401: ErrorResponse;
3665
+ /**
3666
+ * Authenticated caller lacks permission for the operation
3667
+ */
3668
+ 403: ErrorResponse;
3669
+ /**
3670
+ * Resource not found
3671
+ */
3672
+ 404: ErrorResponse;
3673
+ };
3674
+ type ListFunctionLogsError = ListFunctionLogsErrors[keyof ListFunctionLogsErrors];
3675
+ type ListFunctionLogsResponses = {
3676
+ /**
3677
+ * List of log rows (newest first) plus pagination cursor.
3678
+ */
3679
+ 200: SuccessEnvelope & {
3680
+ data?: {
3681
+ items: Array<FunctionLogRow>;
3682
+ /**
3683
+ * Pass back as `cursor` to fetch the next
3684
+ * page. `null` when no further rows exist.
3685
+ *
3686
+ */
3687
+ next_cursor: string | null;
3688
+ };
3689
+ };
3690
+ };
3691
+ type ListFunctionLogsResponse = ListFunctionLogsResponses[keyof ListFunctionLogsResponses];
3586
3692
  declare namespace sdk_gen_d_exports {
3587
- export { Options, addDomain, cliLogout, createEndpoint, createFilter, createFunction, createFunctionSecret, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, deleteFunction, deleteFunctionSecret, discardEmailContent, downloadAttachments, downloadRawEmail, getAccount, getEmail, getFunction, getSendPermissions, getSentEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, listFunctionSecrets, listFunctions, listSentEmails, pollCliLogin, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, searchEmails, sendEmail, setFunctionSecret, startCliLogin, testEndpoint, testFunction, updateAccount, updateDomain, updateEndpoint, updateFilter, updateFunction, verifyDomain };
3693
+ export { Options, addDomain, cliLogout, createEndpoint, createFilter, createFunction, createFunctionSecret, deleteDomain, deleteEmail, deleteEndpoint, deleteFilter, deleteFunction, deleteFunctionSecret, discardEmailContent, downloadAttachments, downloadRawEmail, getAccount, getEmail, getFunction, getSendPermissions, getSentEmail, getStorageStats, getWebhookSecret, listDeliveries, listDomains, listEmails, listEndpoints, listFilters, listFunctionLogs, listFunctionSecrets, listFunctions, listSentEmails, pollCliLogin, replayDelivery, replayEmailWebhooks, replyToEmail, rotateWebhookSecret, searchEmails, sendEmail, setFunctionSecret, startCliLogin, testEndpoint, testFunction, updateAccount, updateDomain, updateEndpoint, updateFilter, updateFunction, verifyDomain };
3588
3694
  }
3589
3695
  type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
3590
3696
  /**
@@ -4191,6 +4297,101 @@ declare const deleteFunctionSecret: <ThrowOnError extends boolean = false>(optio
4191
4297
  *
4192
4298
  */
4193
4299
  declare const setFunctionSecret: <ThrowOnError extends boolean = false>(options: Options<SetFunctionSecretData, ThrowOnError>) => RequestResult<SetFunctionSecretResponses, SetFunctionSecretErrors, ThrowOnError, "fields">;
4300
+ /**
4301
+ * List a function's execution logs
4302
+ *
4303
+ * Returns the most recent `function_logs` rows for the function,
4304
+ * newest first. Each row is a single `console.log` / `console.error`
4305
+ * invocation captured from the running handler.
4306
+ *
4307
+ * Page through history with the opaque `cursor` returned as
4308
+ * `next_cursor`; pass it back as the `cursor` query param on the
4309
+ * next call. `next_cursor` is `null` when there are no further
4310
+ * rows. The cursor format is an implementation detail and should
4311
+ * not be parsed by callers.
4312
+ *
4313
+ */
4314
+ declare const listFunctionLogs: <ThrowOnError extends boolean = false>(options: Options<ListFunctionLogsData, ThrowOnError>) => RequestResult<ListFunctionLogsResponses, ListFunctionLogsErrors, ThrowOnError, "fields">;
4315
+ //#endregion
4316
+ //#region src/api/verify-signature.d.ts
4317
+ /**
4318
+ * Workers-safe webhook signature verification.
4319
+ *
4320
+ * Mirrors `verifyWebhookSignature` from `@primitivedotdev/sdk` but
4321
+ * implements the HMAC-SHA256 step with the Web Crypto API
4322
+ * (`crypto.subtle`) instead of `node:crypto`. The Node version is
4323
+ * still the right choice for server-side handlers running on Node
4324
+ * (it's measurably faster and supports Buffer bodies); this one
4325
+ * exists so a Primitive Function handler can bundle the verifier
4326
+ * without dragging in a `node:crypto` polyfill that inflates the
4327
+ * deploy artifact past the size cap.
4328
+ *
4329
+ * Available natively in Workers, Node 22+, browsers, Deno, and Bun.
4330
+ * Zero polyfill weight, zero new runtime dependencies.
4331
+ *
4332
+ * Surface contract matches the Node verifier exactly: same input
4333
+ * shape, same `WebhookVerificationError` class, same set of error
4334
+ * codes. Existing callers can swap the import path with no other
4335
+ * code changes:
4336
+ *
4337
+ * // Node (existing):
4338
+ * import { verifyWebhookSignature } from '@primitivedotdev/sdk';
4339
+ *
4340
+ * // Workers / in-handler (this file):
4341
+ * import { verifyWebhookSignature } from '@primitivedotdev/sdk/api';
4342
+ */
4343
+ declare const PRIMITIVE_SIGNATURE_HEADER = "Primitive-Signature";
4344
+ interface VerifyOptions {
4345
+ /**
4346
+ * The raw request body string. MUST be the exact bytes Primitive
4347
+ * signed; re-serializing parsed JSON produces a different string
4348
+ * and the verification will fail.
4349
+ */
4350
+ rawBody: string;
4351
+ /** Value of the `Primitive-Signature` header. */
4352
+ signatureHeader: string;
4353
+ /** Webhook signing secret. Auto-injected into Function handlers as `env.PRIMITIVE_WEBHOOK_SECRET`. */
4354
+ secret: string;
4355
+ /** Max age in seconds (default: 300). */
4356
+ toleranceSeconds?: number;
4357
+ /** Override current time for testing (unix seconds). */
4358
+ nowSeconds?: number;
4359
+ }
4360
+ /**
4361
+ * Verify a webhook signature using the Web Crypto API.
4362
+ *
4363
+ * Throws `WebhookVerificationError` on failure with a specific error
4364
+ * code matching the Node verifier's set. Returns `true` on success.
4365
+ *
4366
+ * @example
4367
+ * ```typescript
4368
+ * import {
4369
+ * verifyWebhookSignature,
4370
+ * WebhookVerificationError,
4371
+ * PRIMITIVE_SIGNATURE_HEADER,
4372
+ * } from '@primitivedotdev/sdk/api';
4373
+ *
4374
+ * export default {
4375
+ * async fetch(request: Request, env: { PRIMITIVE_WEBHOOK_SECRET: string }) {
4376
+ * const rawBody = await request.text();
4377
+ * try {
4378
+ * await verifyWebhookSignature({
4379
+ * rawBody,
4380
+ * signatureHeader: request.headers.get(PRIMITIVE_SIGNATURE_HEADER) ?? '',
4381
+ * secret: env.PRIMITIVE_WEBHOOK_SECRET,
4382
+ * });
4383
+ * } catch (err) {
4384
+ * if (err instanceof WebhookVerificationError) {
4385
+ * return new Response('invalid signature', { status: 401 });
4386
+ * }
4387
+ * throw err;
4388
+ * }
4389
+ * // ... process the webhook
4390
+ * },
4391
+ * };
4392
+ * ```
4393
+ */
4394
+ declare function verifyWebhookSignature(opts: VerifyOptions): Promise<true>;
4194
4395
  //#endregion
4195
4396
  //#region src/api/index.d.ts
4196
4397
  declare const DEFAULT_API_BASE_URL_1 = "https://www.primitive.dev/api/v1";
@@ -4347,4 +4548,4 @@ declare function createPrimitiveClient(options?: PrimitiveClientOptions): Primit
4347
4548
  declare function client(options?: PrimitiveClientOptions): PrimitiveClient;
4348
4549
  declare const operations: typeof sdk_gen_d_exports;
4349
4550
  //#endregion
4350
- export { replyToEmail as $, TestEndpointError as $a, ReplayDeliveryResponses as $i, EmailDetail as $n, RequestOptions$1 as $o, GetWebhookSecretResponses as $r, CreateFunctionSecretInput as $t, deleteFunction as A, SendPermissionAnyRecipient as Aa, ListFunctionSecretsResponse as Ai, DeleteFunctionSecretErrors as An, UpdateFilterError as Ao, GetFunctionError as Ar, ClientOptions as At, getStorageStats as B, SetFunctionSecretErrors as Ba, ListSentEmailsResponse as Bi, DiscardEmailContentResponses as Bn, UpdateFunctionResponses as Bo, GetSentEmailError as Br, CreateFilterInput as Bt, createFilter as C, SendEmailError as Ca, ListFiltersError as Ci, DeleteFunctionData as Cn, UpdateEndpointData as Co, GetAccountResponses as Cr, CliLogoutData as Ct, deleteEmail as D, SendMailInput as Da, ListFunctionSecretsData as Di, DeleteFunctionResponses as Dn, UpdateEndpointResponse as Do, GetEmailResponse as Dr, CliLogoutResponse as Dt, deleteDomain as E, SendEmailResponses as Ea, ListFiltersResponses as Ei, DeleteFunctionResponse as En, UpdateEndpointInput as Eo, GetEmailErrors as Er, CliLogoutInput as Et, getAccount as F, SentEmailDetail as Fa, ListFunctionsResponse as Fi, DiscardContentResult as Fn, UpdateFunctionData as Fo, GetSendPermissionsError as Fr, CreateEndpointResponse as Ft, listEndpoints as G, StartCliLoginError as Ga, PollCliLoginErrors as Gi, DownloadAttachmentsErrors as Gn, VerifyDomainResponse as Go, GetStorageStatsError as Gr, CreateFunctionErrors as Gt, listDeliveries as H, SetFunctionSecretResponse as Ha, PaginationMeta as Hi, DomainVerifyResult as Hn, VerifyDomainData as Ho, GetSentEmailResponse as Hr, CreateFilterResponses as Ht, getEmail as I, SentEmailStatus as Ia, ListFunctionsResponses as Ii, DiscardEmailContentData as In, UpdateFunctionError as Io, GetSendPermissionsErrors as Ir, CreateEndpointResponses as It, listFunctions as J, StartCliLoginResponse as Ja, PollCliLoginResponses as Ji, DownloadRawEmailData as Jn, Client as Jo, GetStorageStatsResponses as Jr, CreateFunctionResponses as Jt, listFilters as K, StartCliLoginErrors as Ka, PollCliLoginInput as Ki, DownloadAttachmentsResponse as Kn, VerifyDomainResponses as Ko, GetStorageStatsErrors as Kr, CreateFunctionInput as Kt, getFunction as L, SentEmailSummary as La, ListSentEmailsData as Li, DiscardEmailContentError as Ln, UpdateFunctionErrors as Lo, GetSendPermissionsResponse as Lr, CreateFilterData as Lt, discardEmailContent as M, SendPermissionRule as Ma, ListFunctionsData as Mi, DeleteFunctionSecretResponses as Mn, UpdateFilterInput as Mo, GetFunctionResponse as Mr, CreateEndpointError as Mt, downloadAttachments as N, SendPermissionYourDomain as Na, ListFunctionsError as Ni, DeliveryStatus as Nn, UpdateFilterResponse as No, GetFunctionResponses as Nr, CreateEndpointErrors as Nt, deleteEndpoint as O, SendMailResult as Oa, ListFunctionSecretsError as Oi, DeleteFunctionSecretData as On, UpdateEndpointResponses as Oo, GetEmailResponses as Or, CliLogoutResponses as Ot, downloadRawEmail as P, SendPermissionsMeta as Pa, ListFunctionsErrors as Pi, DeliverySummary as Pn, UpdateFilterResponses as Po, GetSendPermissionsData as Pr, CreateEndpointInput as Pt, replayEmailWebhooks as Q, TestEndpointData as Qa, ReplayDeliveryResponse as Qi, DownloadRawEmailResponses as Qn, Options$1 as Qo, GetWebhookSecretResponse as Qr, CreateFunctionSecretErrors as Qt, getSendPermissions as R, SetFunctionSecretData as Ra, ListSentEmailsError as Ri, DiscardEmailContentErrors as Rn, UpdateFunctionInput as Ro, GetSendPermissionsResponses as Rr, CreateFilterError as Rt, createEndpoint as S, SendEmailData as Sa, ListFiltersData as Si, DeleteFilterResponses as Sn, UpdateDomainResponses as So, GetAccountResponse as Sr, CliLoginStartResult as St, createFunctionSecret as T, SendEmailResponse as Ta, ListFiltersResponse as Ti, DeleteFunctionErrors as Tn, UpdateEndpointErrors as To, GetEmailError as Tr, CliLogoutErrors as Tt, listDomains as U, SetFunctionSecretResponses as Ua, PollCliLoginData as Ui, DownloadAttachmentsData as Un, VerifyDomainError as Uo, GetSentEmailResponses as Ur, CreateFunctionData as Ut, getWebhookSecret as V, SetFunctionSecretInput as Va, ListSentEmailsResponses as Vi, Domain as Vn, VerifiedDomain as Vo, GetSentEmailErrors as Vr, CreateFilterResponse as Vt, listEmails as W, StartCliLoginData as Wa, PollCliLoginError as Wi, DownloadAttachmentsError as Wn, VerifyDomainErrors as Wo, GetStorageStatsData as Wr, CreateFunctionError as Wt, pollCliLogin as X, StorageStats as Xa, ReplayDeliveryError as Xi, DownloadRawEmailErrors as Xn, Config as Xo, GetWebhookSecretError as Xr, CreateFunctionSecretData as Xt, listSentEmails as Y, StartCliLoginResponses as Ya, ReplayDeliveryData as Yi, DownloadRawEmailError as Yn, ClientOptions$1 as Yo, GetWebhookSecretData as Yr, CreateFunctionResult as Yt, replayDelivery as Z, SuccessEnvelope as Za, ReplayDeliveryErrors as Zi, DownloadRawEmailResponse as Zn, CreateClientConfig as Zo, GetWebhookSecretErrors as Zr, CreateFunctionSecretError as Zt, createPrimitiveClient as _, SearchEmailsData as _a, ListEndpointsError as _i, DeleteEndpointResponses as _n, UpdateDomainData as _o, GateDenial as _r, AddDomainErrors as _t, PrimitiveApiClientOptions as a, ReplayResult as aa, ListDeliveriesResponses as ai, DeleteDomainErrors as an, TestFunctionErrors as ao, EmailSearchResult as ar, testEndpoint as at, addDomain as b, SearchEmailsResponse as ba, ListEndpointsResponses as bi, DeleteFilterErrors as bn, UpdateDomainInput as bo, GetAccountError as br, AddDomainResponses as bt, PrimitiveClient as c, ReplyToEmailErrors as ca, ListDomainsErrors as ci, DeleteEmailData as cn, TestInvocationResult as co, EmailWebhookStatus as cr, updateDomain as ct, RequestOptions as d, ResourceId as da, ListEmailsData as di, DeleteEmailResponse as dn, UpdateAccountData as do, Filter as dr, updateFunction as dt, ReplayEmailWebhooksData as ea, Limit as ei, CreateFunctionSecretResponse as en, TestEndpointErrors as eo, EmailDetailReply as er, RequestResult as es, rotateWebhookSecret as et, SendInput as f, RotateWebhookSecretData as fa, ListEmailsError as fi, DeleteEmailResponses as fn, UpdateAccountError as fo, FunctionDeployStatus as fr, verifyDomain as ft, createPrimitiveApiClient as g, RotateWebhookSecretResponses as ga, ListEndpointsData as gi, DeleteEndpointResponse as gn, UpdateAccountResponses as go, FunctionSecretWriteResult as gr, AddDomainError as gt, client as h, RotateWebhookSecretResponse as ha, ListEmailsResponses as hi, DeleteEndpointErrors as hn, UpdateAccountResponse as ho, FunctionSecretListItem as hr, AddDomainData as ht, PrimitiveApiClient as i, ReplayEmailWebhooksResponses as ia, ListDeliveriesResponse as ii, DeleteDomainError as in, TestFunctionError as io, EmailSearchMeta as ir, startCliLogin as it, deleteFunctionSecret as j, SendPermissionManagedZone as ja, ListFunctionSecretsResponses as ji, DeleteFunctionSecretResponse as jn, UpdateFilterErrors as jo, GetFunctionErrors as jr, CreateEndpointData as jt, deleteFilter as k, SendPermissionAddress as ka, ListFunctionSecretsErrors as ki, DeleteFunctionSecretError as kn, UpdateFilterData as ko, GetFunctionData as kr, CliLogoutResult as kt, PrimitiveClientOptions as l, ReplyToEmailResponse as la, ListDomainsResponse as li, DeleteEmailError as ln, TestResult as lo, Endpoint as lr, updateEndpoint as lt, SendThreadInput as m, RotateWebhookSecretErrors as ma, ListEmailsResponse as mi, DeleteEndpointError as mn, UpdateAccountInput as mo, FunctionListItem as mr, AccountUpdated as mt, DEFAULT_API_BASE_URL_2 as n, ReplayEmailWebhooksErrors as na, ListDeliveriesError as ni, Cursor as nn, TestEndpointResponses as no, EmailSearchFacets as nr, Auth as ns, sendEmail as nt, PrimitiveApiError as o, ReplyToEmailData as oa, ListDomainsData as oi, DeleteDomainResponse as on, TestFunctionResponse as oo, EmailStatus as or, testFunction as ot, SendResult as p, RotateWebhookSecretError as pa, ListEmailsErrors as pi, DeleteEndpointData as pn, UpdateAccountErrors as po, FunctionDetail as pr, Account as pt, listFunctionSecrets as q, StartCliLoginInput as qa, PollCliLoginResponse as qi, DownloadAttachmentsResponses as qn, WebhookSecret as qo, GetStorageStatsResponse as qr, CreateFunctionResponse as qt, ForwardInput as r, ReplayEmailWebhooksResponse as ra, ListDeliveriesErrors as ri, DeleteDomainData as rn, TestFunctionData as ro, EmailSearchHighlights as rr, setFunctionSecret as rt, PrimitiveApiErrorDetails as s, ReplyToEmailError as sa, ListDomainsError as si, DeleteDomainResponses as sn, TestFunctionResponses as so, EmailSummary as sr, updateAccount as st, DEFAULT_API_BASE_URL_1 as t, ReplayEmailWebhooksError as ta, ListDeliveriesData as ti, CreateFunctionSecretResponses as tn, TestEndpointResponse as to, EmailSearchFacetBucket as tr, ResponseStyle as ts, searchEmails as tt, ReplyInput as u, ReplyToEmailResponses as ua, ListDomainsResponses as ui, DeleteEmailErrors as un, UnverifiedDomain as uo, ErrorResponse as ur, updateFilter as ut, operations as v, SearchEmailsError as va, ListEndpointsErrors as vi, DeleteFilterData as vn, UpdateDomainError as vo, GateFix as vr, AddDomainInput as vt, createFunction as w, SendEmailErrors as wa, ListFiltersErrors as wi, DeleteFunctionError as wn, UpdateEndpointError as wo, GetEmailData as wr, CliLogoutError as wt, cliLogout as x, SearchEmailsResponses as xa, ListEnvelope as xi, DeleteFilterResponse as xn, UpdateDomainResponse as xo, GetAccountErrors as xr, CliLoginPollResult as xt, Options as y, SearchEmailsErrors as ya, ListEndpointsResponse as yi, DeleteFilterError as yn, UpdateDomainErrors as yo, GetAccountData as yr, AddDomainResponse as yt, getSentEmail as z, SetFunctionSecretError as za, ListSentEmailsErrors as zi, DiscardEmailContentResponse as zn, UpdateFunctionResponse as zo, GetSentEmailData as zr, CreateFilterErrors as zt };
4551
+ export { listSentEmails as $, SetFunctionSecretResponses as $a, PollCliLoginData as $i, DownloadRawEmailError as $n, VerifyDomainError as $o, GetStorageStatsResponses as $r, CreateFunctionResult as $t, deleteEmail as A, SearchEmailsResponse as Aa, ListFiltersResponse as Ai, DeleteFunctionResponse as An, UpdateDomainInput as Ao, GetEmailError as Ar, CliLogoutInput as At, getFunction as B, SendPermissionAnyRecipient as Ba, ListFunctionSecretsResponse as Bi, DiscardEmailContentData as Bn, UpdateFilterError as Bo, GetSendPermissionsError as Br, CreateEndpointResponses as Bt, addDomain as C, RotateWebhookSecretError as Ca, ListEndpointsErrors as Ci, DeleteFilterError as Cn, UpdateAccountErrors as Co, GateFix as Cr, AddDomainResponse as Ct, createFunction as D, SearchEmailsData as Da, ListFiltersData as Di, DeleteFunctionData as Dn, UpdateDomainData as Do, GetAccountResponse as Dr, CliLogoutData as Dt, createFilter as E, RotateWebhookSecretResponses as Ea, ListEnvelope as Ei, DeleteFilterResponses as En, UpdateAccountResponses as Eo, GetAccountErrors as Er, CliLoginStartResult as Et, discardEmailContent as F, SendEmailResponse as Fa, ListFunctionLogsResponse as Fi, DeleteFunctionSecretResponse as Fn, UpdateEndpointErrors as Fo, GetFunctionError as Fr, CreateEndpointData as Ft, listDeliveries as G, SentEmailDetail as Ga, ListFunctionsResponse as Gi, Domain as Gn, UpdateFunctionData as Go, GetSentEmailError as Gr, CreateFilterResponse as Gt, getSentEmail as H, SendPermissionRule as Ha, ListFunctionsData as Hi, DiscardEmailContentErrors as Hn, UpdateFilterInput as Ho, GetSendPermissionsResponse as Hr, CreateFilterError as Ht, downloadAttachments as I, SendEmailResponses as Ia, ListFunctionLogsResponses as Ii, DeleteFunctionSecretResponses as In, UpdateEndpointInput as Io, GetFunctionErrors as Ir, CreateEndpointError as It, listEndpoints as J, SetFunctionSecretData as Ja, ListSentEmailsError as Ji, DownloadAttachmentsError as Jn, UpdateFunctionInput as Jo, GetSentEmailResponses as Jr, CreateFunctionError as Jt, listDomains as K, SentEmailStatus as Ka, ListFunctionsResponses as Ki, DomainVerifyResult as Kn, UpdateFunctionError as Ko, GetSentEmailErrors as Kr, CreateFilterResponses as Kt, downloadRawEmail as L, SendMailInput as La, ListFunctionSecretsData as Li, DeliveryStatus as Ln, UpdateEndpointResponse as Lo, GetFunctionResponse as Lr, CreateEndpointErrors as Lt, deleteFilter as M, SendEmailData as Ma, ListFunctionLogsData as Mi, DeleteFunctionSecretData as Mn, UpdateDomainResponses as Mo, GetEmailResponse as Mr, CliLogoutResponses as Mt, deleteFunction as N, SendEmailError as Na, ListFunctionLogsError as Ni, DeleteFunctionSecretError as Nn, UpdateEndpointData as No, GetEmailResponses as Nr, CliLogoutResult as Nt, createFunctionSecret as O, SearchEmailsError as Oa, ListFiltersError as Oi, DeleteFunctionError as On, UpdateDomainError as Oo, GetAccountResponses as Or, CliLogoutError as Ot, deleteFunctionSecret as P, SendEmailErrors as Pa, ListFunctionLogsErrors as Pi, DeleteFunctionSecretErrors as Pn, UpdateEndpointError as Po, GetFunctionData as Pr, ClientOptions as Pt, listFunctions as Q, SetFunctionSecretResponse as Qa, PaginationMeta as Qi, DownloadRawEmailData as Qn, VerifyDomainData as Qo, GetStorageStatsResponse as Qr, CreateFunctionResponses as Qt, getAccount as R, SendMailResult as Ra, ListFunctionSecretsError as Ri, DeliverySummary as Rn, UpdateEndpointResponses as Ro, GetFunctionResponses as Rr, CreateEndpointInput as Rt, Options as S, RotateWebhookSecretData as Sa, ListEndpointsError as Si, DeleteFilterData as Sn, UpdateAccountError as So, GateDenial as Sr, AddDomainInput as St, createEndpoint as T, RotateWebhookSecretResponse as Ta, ListEndpointsResponses as Ti, DeleteFilterResponse as Tn, UpdateAccountResponse as To, GetAccountError as Tr, CliLoginPollResult as Tt, getStorageStats as U, SendPermissionYourDomain as Ua, ListFunctionsError as Ui, DiscardEmailContentResponse as Un, UpdateFilterResponse as Uo, GetSendPermissionsResponses as Ur, CreateFilterErrors as Ut, getSendPermissions as V, SendPermissionManagedZone as Va, ListFunctionSecretsResponses as Vi, DiscardEmailContentError as Vn, UpdateFilterErrors as Vo, GetSendPermissionsErrors as Vr, CreateFilterData as Vt, getWebhookSecret as W, SendPermissionsMeta as Wa, ListFunctionsErrors as Wi, DiscardEmailContentResponses as Wn, UpdateFilterResponses as Wo, GetSentEmailData as Wr, CreateFilterInput as Wt, listFunctionLogs as X, SetFunctionSecretErrors as Xa, ListSentEmailsResponse as Xi, DownloadAttachmentsResponse as Xn, UpdateFunctionResponses as Xo, GetStorageStatsError as Xr, CreateFunctionInput as Xt, listFilters as Y, SetFunctionSecretError as Ya, ListSentEmailsErrors as Yi, DownloadAttachmentsErrors as Yn, UpdateFunctionResponse as Yo, GetStorageStatsData as Yr, CreateFunctionErrors as Yt, listFunctionSecrets as Z, SetFunctionSecretInput as Za, ListSentEmailsResponses as Zi, DownloadAttachmentsResponses as Zn, VerifiedDomain as Zo, GetStorageStatsErrors as Zr, CreateFunctionResponse as Zt, createPrimitiveClient as _, ReplyToEmailError as _a, ListEmailsError as _i, DeleteEndpointData as _n, TestFunctionResponses as _o, FunctionDetail as _r, Account as _t, PrimitiveApiClientOptions as a, ReplayDeliveryData as aa, Limit as ai, CreateFunctionSecretResponses as an, StartCliLoginResponses as ao, EmailSearchFacetBucket as ar, ClientOptions$1 as as, searchEmails as at, VerifyOptions as b, ReplyToEmailResponses as ba, ListEmailsResponses as bi, DeleteEndpointResponse as bn, UnverifiedDomain as bo, FunctionSecretListItem as br, AddDomainError as bt, PrimitiveClient as c, ReplayDeliveryResponse as ca, ListDeliveriesErrors as ci, DeleteDomainError as cn, TestEndpointData as co, EmailSearchMeta as cr, Options$1 as cs, startCliLogin as ct, RequestOptions as d, ReplayEmailWebhooksError as da, ListDomainsData as di, DeleteDomainResponses as dn, TestEndpointResponse as do, EmailSummary as dr, ResponseStyle as ds, updateAccount as dt, PollCliLoginError as ea, GetWebhookSecretData as ei, CreateFunctionSecretData as en, StartCliLoginData as eo, DownloadRawEmailErrors as er, VerifyDomainErrors as es, pollCliLogin as et, SendInput as f, ReplayEmailWebhooksErrors as fa, ListDomainsError as fi, DeleteEmailData as fn, TestEndpointResponses as fo, EmailWebhookStatus as fr, Auth as fs, updateDomain as ft, createPrimitiveApiClient as g, ReplyToEmailData as ga, ListEmailsData as gi, DeleteEmailResponses as gn, TestFunctionResponse as go, FunctionDeployStatus as gr, verifyDomain as gt, client as h, ReplayResult as ha, ListDomainsResponses as hi, DeleteEmailResponse as hn, TestFunctionErrors as ho, Filter as hr, updateFunction as ht, PrimitiveApiClient as i, PollCliLoginResponses as ia, GetWebhookSecretResponses as ii, CreateFunctionSecretResponse as in, StartCliLoginResponse as io, EmailDetailReply as ir, Client as is, rotateWebhookSecret as it, deleteEndpoint as j, SearchEmailsResponses as ja, ListFiltersResponses as ji, DeleteFunctionResponses as jn, UpdateDomainResponse as jo, GetEmailErrors as jr, CliLogoutResponse as jt, deleteDomain as k, SearchEmailsErrors as ka, ListFiltersErrors as ki, DeleteFunctionErrors as kn, UpdateDomainErrors as ko, GetEmailData as kr, CliLogoutErrors as kt, PrimitiveClientOptions as l, ReplayDeliveryResponses as la, ListDeliveriesResponse as li, DeleteDomainErrors as ln, TestEndpointError as lo, EmailSearchResult as lr, RequestOptions$1 as ls, testEndpoint as lt, SendThreadInput as m, ReplayEmailWebhooksResponses as ma, ListDomainsResponse as mi, DeleteEmailErrors as mn, TestFunctionError as mo, ErrorResponse as mr, updateFilter as mt, DEFAULT_API_BASE_URL_2 as n, PollCliLoginInput as na, GetWebhookSecretErrors as ni, CreateFunctionSecretErrors as nn, StartCliLoginErrors as no, DownloadRawEmailResponses as nr, VerifyDomainResponses as ns, replayEmailWebhooks as nt, PrimitiveApiError as o, ReplayDeliveryError as oa, ListDeliveriesData as oi, Cursor as on, StorageStats as oo, EmailSearchFacets as or, Config as os, sendEmail as ot, SendResult as p, ReplayEmailWebhooksResponse as pa, ListDomainsErrors as pi, DeleteEmailError as pn, TestFunctionData as po, Endpoint as pr, updateEndpoint as pt, listEmails as q, SentEmailSummary as qa, ListSentEmailsData as qi, DownloadAttachmentsData as qn, UpdateFunctionErrors as qo, GetSentEmailResponse as qr, CreateFunctionData as qt, ForwardInput as r, PollCliLoginResponse as ra, GetWebhookSecretResponse as ri, CreateFunctionSecretInput as rn, StartCliLoginInput as ro, EmailDetail as rr, WebhookSecret as rs, replyToEmail as rt, PrimitiveApiErrorDetails as s, ReplayDeliveryErrors as sa, ListDeliveriesError as si, DeleteDomainData as sn, SuccessEnvelope as so, EmailSearchHighlights as sr, CreateClientConfig as ss, setFunctionSecret as st, DEFAULT_API_BASE_URL_1 as t, PollCliLoginErrors as ta, GetWebhookSecretError as ti, CreateFunctionSecretError as tn, StartCliLoginError as to, DownloadRawEmailResponse as tr, VerifyDomainResponse as ts, replayDelivery as tt, ReplyInput as u, ReplayEmailWebhooksData as ua, ListDeliveriesResponses as ui, DeleteDomainResponse as un, TestEndpointErrors as uo, EmailStatus as ur, RequestResult as us, testFunction as ut, operations as v, ReplyToEmailErrors as va, ListEmailsErrors as vi, DeleteEndpointError as vn, TestInvocationResult as vo, FunctionListItem as vr, AccountUpdated as vt, cliLogout as w, RotateWebhookSecretErrors as wa, ListEndpointsResponse as wi, DeleteFilterErrors as wn, UpdateAccountInput as wo, GetAccountData as wr, AddDomainResponses as wt, verifyWebhookSignature as x, ResourceId as xa, ListEndpointsData as xi, DeleteEndpointResponses as xn, UpdateAccountData as xo, FunctionSecretWriteResult as xr, AddDomainErrors as xt, PRIMITIVE_SIGNATURE_HEADER as y, ReplyToEmailResponse as ya, ListEmailsResponse as yi, DeleteEndpointErrors as yn, TestResult as yo, FunctionLogRow as yr, AddDomainData as yt, getEmail as z, SendPermissionAddress as za, ListFunctionSecretsErrors as zi, DiscardContentResult as zn, UpdateFilterData as zo, GetSendPermissionsData as zr, CreateEndpointResponse as zt };
@@ -1,214 +1,6 @@
1
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
- import { ErrorObject } from "ajv";
2
+ import { m as ReceivedEmail, u as WebhookValidationError } from "./errors-C53fe686.js";
4
3
 
5
- //#region src/webhook/errors.d.ts
6
- /**
7
- * Verification error definitions.
8
- * Use these for documentation, dashboards, and i18n.
9
- */
10
- declare const VERIFICATION_ERRORS: {
11
- readonly INVALID_SIGNATURE_HEADER: {
12
- readonly message: "Missing or malformed Primitive-Signature header";
13
- readonly suggestion: "Check that you're reading the correct header (Primitive-Signature) and it's being passed correctly from your web framework.";
14
- };
15
- readonly TIMESTAMP_OUT_OF_RANGE: {
16
- readonly message: "Timestamp is too old (possible replay attack)";
17
- readonly suggestion: "This could indicate a replay attack, network delay, or server clock drift. Check your server's time is synced.";
18
- };
19
- readonly SIGNATURE_MISMATCH: {
20
- readonly message: "Signature doesn't match expected value";
21
- readonly suggestion: "Verify the webhook secret matches and you're using the raw request body (not re-serialized JSON).";
22
- };
23
- readonly MISSING_SECRET: {
24
- readonly message: "No webhook secret was provided";
25
- readonly suggestion: "Pass your webhook secret from the Primitive dashboard. Check that the environment variable is set.";
26
- };
27
- };
28
- /**
29
- * Payload parsing error definitions.
30
- * Use these for documentation, dashboards, and i18n.
31
- */
32
- declare const PAYLOAD_ERRORS: {
33
- readonly PAYLOAD_NULL: {
34
- readonly message: "Webhook payload is null";
35
- readonly suggestion: "Ensure you're passing the parsed JSON body, not null. Check your framework's body parsing middleware.";
36
- };
37
- readonly PAYLOAD_UNDEFINED: {
38
- readonly message: "Webhook payload is undefined";
39
- readonly suggestion: "The payload was not provided. Make sure you're passing the request body to the handler.";
40
- };
41
- readonly PAYLOAD_WRONG_TYPE: {
42
- readonly message: "Webhook payload must be an object";
43
- readonly suggestion: "The payload should be a parsed JSON object. Check that you're not passing a string or other primitive.";
44
- };
45
- readonly PAYLOAD_IS_ARRAY: {
46
- readonly message: "Webhook payload is an array, expected object";
47
- readonly suggestion: "Primitive webhooks are single event objects, not arrays. Check the payload structure.";
48
- };
49
- readonly PAYLOAD_MISSING_EVENT: {
50
- readonly message: "Webhook payload missing 'event' field";
51
- readonly suggestion: "All webhook payloads must have an 'event' field. This may not be a valid Primitive webhook.";
52
- };
53
- readonly PAYLOAD_UNKNOWN_EVENT: {
54
- readonly message: "Unknown webhook event type";
55
- readonly suggestion: "This event type is not recognized. You may need to update your SDK or handle unknown events gracefully.";
56
- };
57
- readonly PAYLOAD_EMPTY_BODY: {
58
- readonly message: "Request body is empty";
59
- readonly suggestion: "The request body was empty. Ensure the webhook is sending data and your framework is parsing it correctly.";
60
- };
61
- readonly JSON_PARSE_FAILED: {
62
- readonly message: "Failed to parse JSON body";
63
- readonly suggestion: "The request body is not valid JSON. Check the raw body content and Content-Type header.";
64
- };
65
- readonly INVALID_ENCODING: {
66
- readonly message: "Invalid body encoding";
67
- readonly suggestion: "The request body encoding is not supported. Primitive webhooks use UTF-8 encoded JSON.";
68
- };
69
- };
70
- /**
71
- * Raw email decode error definitions.
72
- * Use these for documentation, dashboards, and i18n.
73
- */
74
- declare const RAW_EMAIL_ERRORS: {
75
- readonly NOT_INCLUDED: {
76
- readonly message: "Raw email content not included inline";
77
- readonly suggestion: "Use the download URL at event.email.content.download.url to fetch the raw email.";
78
- };
79
- readonly INVALID_BASE64: {
80
- readonly message: "Raw email content is not valid base64";
81
- readonly suggestion: "The raw email data is malformed. Fetch the raw email from the download URL or regenerate the webhook payload.";
82
- };
83
- readonly HASH_MISMATCH: {
84
- readonly message: "SHA-256 hash verification failed";
85
- readonly suggestion: "The raw email data may be corrupted. Try downloading from the URL instead.";
86
- };
87
- };
88
- /**
89
- * All error codes that can be thrown by the SDK.
90
- */
91
- type WebhookErrorCode = WebhookVerificationErrorCode | WebhookPayloadErrorCode | WebhookValidationErrorCode | RawEmailDecodeErrorCode;
92
- type RawEmailDecodeErrorCode = keyof typeof RAW_EMAIL_ERRORS;
93
- /**
94
- * Base class for all Primitive webhook errors.
95
- *
96
- * Catch this to handle any error from the SDK in a single catch block.
97
- *
98
- * @example
99
- * ```typescript
100
- * import { handleWebhook, PrimitiveWebhookError } from '@primitivedotdev/sdk';
101
- *
102
- * try {
103
- * const event = handleWebhook({ body, headers, secret });
104
- * } catch (err) {
105
- * if (err instanceof PrimitiveWebhookError) {
106
- * console.error(`[${err.code}] ${err.message}`);
107
- * return res.status(400).json({ error: err.code });
108
- * }
109
- * throw err;
110
- * }
111
- * ```
112
- */
113
- declare abstract class PrimitiveWebhookError extends Error {
114
- /** Programmatic error code for monitoring and handling */
115
- abstract readonly code: WebhookErrorCode;
116
- /** Actionable guidance for fixing the issue */
117
- abstract readonly suggestion: string;
118
- /**
119
- * Formats the error for logging/display.
120
- */
121
- toString(): string;
122
- /**
123
- * Serializes cleanly for structured logging (Datadog, CloudWatch, etc.)
124
- */
125
- toJSON(): {
126
- name: string;
127
- code: WebhookErrorCode;
128
- message: string;
129
- suggestion: string;
130
- };
131
- }
132
- /**
133
- * Error codes for webhook verification failures.
134
- * Derived from VERIFICATION_ERRORS keys.
135
- */
136
- type WebhookVerificationErrorCode = keyof typeof VERIFICATION_ERRORS;
137
- /**
138
- * Error thrown when webhook signature verification fails.
139
- *
140
- * Use the `code` property to programmatically handle specific error cases.
141
- */
142
- declare class WebhookVerificationError extends PrimitiveWebhookError {
143
- readonly code: WebhookVerificationErrorCode;
144
- readonly suggestion: string;
145
- constructor(code: WebhookVerificationErrorCode, message?: string, suggestion?: string);
146
- }
147
- /**
148
- * Error codes for webhook payload parsing failures.
149
- * Derived from PAYLOAD_ERRORS keys.
150
- */
151
- type WebhookPayloadErrorCode = keyof typeof PAYLOAD_ERRORS;
152
- /**
153
- * Error thrown when webhook payload parsing fails (lightweight parser).
154
- *
155
- * Use the `code` property for programmatic handling and monitoring.
156
- * The `suggestion` property contains actionable guidance for fixing the issue.
157
- */
158
- declare class WebhookPayloadError extends PrimitiveWebhookError {
159
- readonly code: WebhookPayloadErrorCode;
160
- readonly suggestion: string;
161
- /** Original error if this wraps another error (e.g., JSON.parse failure) */
162
- readonly cause?: Error;
163
- constructor(code: WebhookPayloadErrorCode, message?: string, suggestion?: string, cause?: Error);
164
- }
165
- /**
166
- * Error code for schema validation failures.
167
- */
168
- type WebhookValidationErrorCode = "SCHEMA_VALIDATION_FAILED";
169
- /**
170
- * Error thrown when schema validation fails.
171
- */
172
- declare class WebhookValidationError extends PrimitiveWebhookError {
173
- readonly code: WebhookValidationErrorCode;
174
- readonly suggestion: string;
175
- /** The specific field path that failed (e.g., "email.headers.from") */
176
- readonly field: string;
177
- /** Original schema validation errors for advanced debugging */
178
- readonly validationErrors: readonly ErrorObject[];
179
- /** Number of additional validation errors beyond the first */
180
- readonly additionalErrorCount: number;
181
- constructor(field: string, message: string, suggestion: string, validationErrors: readonly ErrorObject[]);
182
- /**
183
- * Formats the error for logging/display.
184
- * Includes error count and suggestion.
185
- */
186
- toString(): string;
187
- /**
188
- * Serializes cleanly for structured logging (Datadog, CloudWatch, etc.)
189
- */
190
- toJSON(): {
191
- name: string;
192
- code: "SCHEMA_VALIDATION_FAILED";
193
- field: string;
194
- message: string;
195
- suggestion: string;
196
- additionalErrorCount: number;
197
- };
198
- }
199
- /**
200
- * Error thrown when raw email decoding or verification fails.
201
- *
202
- * Use the `code` property to determine the failure reason:
203
- * - `NOT_INCLUDED`: Raw email not inline, must download from URL
204
- * - `HASH_MISMATCH`: SHA-256 verification failed, content may be corrupted
205
- */
206
- declare class RawEmailDecodeError extends PrimitiveWebhookError {
207
- readonly code: RawEmailDecodeErrorCode;
208
- readonly suggestion: string;
209
- constructor(code: RawEmailDecodeErrorCode, message?: string);
210
- }
211
- //#endregion
212
4
  //#region src/validation.d.ts
213
5
  interface ValidationSuccess<T> {
214
6
  success: true;
@@ -1624,4 +1416,4 @@ declare function decodeRawEmail(event: EmailReceivedEvent, options?: DecodeRawEm
1624
1416
  */
1625
1417
  declare function verifyRawEmailDownload(downloaded: Buffer | ArrayBuffer | Uint8Array, event: EmailReceivedEvent): Buffer;
1626
1418
  //#endregion
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 };
1419
+ export { VerifyOptions as A, signStandardWebhooksPayload as C, PRIMITIVE_CONFIRMED_HEADER as D, LEGACY_SIGNATURE_HEADER as E, VerifyDownloadTokenResult as F, generateDownloadToken as I, verifyDownloadToken as L, verifyWebhookSignature as M, GenerateDownloadTokenOptions as N, PRIMITIVE_SIGNATURE_HEADER as O, VerifyDownloadTokenOptions as P, safeValidateEmailReceivedEvent as R, StandardWebhooksVerifyOptions as S, LEGACY_CONFIRMED_HEADER as T, 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, 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 };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { A as UnknownEvent, C as ParsedDataFailed, D as RawContentDownloadOnly, E as RawContent, M as WebhookAttachment, N as WebhookEvent, O as RawContentInline, S as ParsedDataComplete, T as ParsedStatus, _ as ForwardResultInline, a as DmarcPolicy, b as KnownWebhookEvent, c as EmailAnalysis, d as EventType, f as ForwardAnalysis, g as ForwardResultAttachmentSkipped, h as ForwardResultAttachmentAnalyzed, i as DkimSignature, j as ValidateEmailAuthResult, k as SpfResult, l as EmailAuth, m as ForwardResult, n as AuthVerdict, o as DmarcResult, p as ForwardOriginalSender, r as DkimResult, s as EmailAddress, t as AuthConfidence, u as EmailReceivedEvent, v as ForwardVerdict, w as ParsedError, x as ParsedData, y as ForwardVerification } from "./types-9vXGZjPd.js";
2
- import { a as buildReplySubject, c as parseHeaderAddress, i as buildForwardSubject, n as ReceivedEmailAddress, o as formatAddress, r as ReceivedEmailThread, s as normalizeReceivedEmail, t as ReceivedEmail } from "./received-email-DNjpq_Wt.js";
3
- import { _ as createPrimitiveClient, c as PrimitiveClient, f as SendInput, h as client, l as PrimitiveClientOptions, m as SendThreadInput, o as PrimitiveApiError, p as SendResult, r as ForwardInput, u as ReplyInput } from "./index-jLAAV6Sq.js";
4
- import { A as VerifyOptions, B as PAYLOAD_ERRORS, C as signStandardWebhooksPayload, D as PRIMITIVE_CONFIRMED_HEADER, E as LEGACY_SIGNATURE_HEADER, F as VerifyDownloadTokenResult, G as VERIFICATION_ERRORS, H as RAW_EMAIL_ERRORS, I as generateDownloadToken, J as WebhookPayloadErrorCode, K as WebhookErrorCode, L as verifyDownloadToken, M as verifyWebhookSignature, N as GenerateDownloadTokenOptions, O as PRIMITIVE_SIGNATURE_HEADER, P as VerifyDownloadTokenOptions, Q as WebhookVerificationErrorCode, R as safeValidateEmailReceivedEvent, S as StandardWebhooksVerifyOptions, T as LEGACY_CONFIRMED_HEADER, U as RawEmailDecodeError, V as PrimitiveWebhookError, W as RawEmailDecodeErrorCode, X as WebhookValidationErrorCode, Y as WebhookValidationError, Z as WebhookVerificationError, _ as emailReceivedEventJsonSchema, a as confirmedHeaders, b as STANDARD_WEBHOOK_TIMESTAMP_HEADER, c as handleWebhook, d as isRawIncluded, f as parseWebhookEvent, g as validateEmailAuth, h as WEBHOOK_VERSION, i as WebhookHeaders, j as signWebhookPayload, k as SignResult, l as isDownloadExpired, m as verifyRawEmailDownload, n as HandleWebhookOptions, o as decodeRawEmail, p as receive, q as WebhookPayloadError, r as ReceiveRequestOptions, s as getDownloadTimeRemaining, t as DecodeRawEmailOptions, u as isEmailReceivedEvent, v as STANDARD_WEBHOOK_ID_HEADER, w as verifyStandardWebhooksSignature, x as StandardWebhooksSignResult, y as STANDARD_WEBHOOK_SIGNATURE_HEADER, z as validateEmailReceivedEvent } from "./index-CDlwyxdp.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-C53fe686.js";
3
+ import { _ as createPrimitiveClient, c as PrimitiveClient, f as SendInput, h as client, l as PrimitiveClientOptions, m as SendThreadInput, o as PrimitiveApiError, p as SendResult, r as ForwardInput, u as ReplyInput } from "./index-DISHEO_u.js";
4
+ import { A as VerifyOptions, C as signStandardWebhooksPayload, D as PRIMITIVE_CONFIRMED_HEADER, E as LEGACY_SIGNATURE_HEADER, F as VerifyDownloadTokenResult, I as generateDownloadToken, L as verifyDownloadToken, M as verifyWebhookSignature, N as GenerateDownloadTokenOptions, O as PRIMITIVE_SIGNATURE_HEADER, P as VerifyDownloadTokenOptions, R as safeValidateEmailReceivedEvent, S as StandardWebhooksVerifyOptions, T as LEGACY_CONFIRMED_HEADER, _ as emailReceivedEventJsonSchema, a as confirmedHeaders, b as STANDARD_WEBHOOK_TIMESTAMP_HEADER, c as handleWebhook, d as isRawIncluded, f as parseWebhookEvent, g as validateEmailAuth, h as WEBHOOK_VERSION, i as WebhookHeaders, j as signWebhookPayload, k as SignResult, l as isDownloadExpired, m as verifyRawEmailDownload, n as HandleWebhookOptions, o as decodeRawEmail, p as receive, r as ReceiveRequestOptions, s as getDownloadTimeRemaining, t as DecodeRawEmailOptions, u as isEmailReceivedEvent, v as STANDARD_WEBHOOK_ID_HEADER, w as verifyStandardWebhooksSignature, x as StandardWebhooksSignResult, y as STANDARD_WEBHOOK_SIGNATURE_HEADER, z as validateEmailReceivedEvent } from "./index-Dbx9udpX.js";
5
5
 
6
6
  //#region src/index.d.ts
7
7
  declare const primitive: {
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as parseHeaderAddress, i as normalizeReceivedEmail, n as buildReplySubject, r as formatAddress, t as buildForwardSubject } from "./received-email-D6tKtWwW.js";
2
- import { a as PrimitiveClient, c as createPrimitiveClient, i as PrimitiveApiError, o as client } from "./api-C3X14uId.js";
3
- import { A as PRIMITIVE_CONFIRMED_HEADER, B as RAW_EMAIL_ERRORS, C as STANDARD_WEBHOOK_ID_HEADER, D as verifyStandardWebhooksSignature, E as signStandardWebhooksPayload, F as verifyDownloadToken, G as WebhookVerificationError, H as VERIFICATION_ERRORS, I as safeValidateEmailReceivedEvent, L as validateEmailReceivedEvent, M as signWebhookPayload, N as verifyWebhookSignature, O as LEGACY_CONFIRMED_HEADER, P as generateDownloadToken, R as PAYLOAD_ERRORS, S as emailReceivedEventJsonSchema, T as STANDARD_WEBHOOK_TIMESTAMP_HEADER, U as WebhookPayloadError, V as RawEmailDecodeError, W as WebhookValidationError, _ as DmarcResult, a as isDownloadExpired, b as ParsedStatus, c as parseWebhookEvent, d as WEBHOOK_VERSION, f as validateEmailAuth, g as DmarcPolicy, h as DkimResult, i as handleWebhook, j as PRIMITIVE_SIGNATURE_HEADER, k as LEGACY_SIGNATURE_HEADER, l as receive, m as AuthVerdict, n as decodeRawEmail, o as isEmailReceivedEvent, p as AuthConfidence, r as getDownloadTimeRemaining, s as isRawIncluded, t as confirmedHeaders, u as verifyRawEmailDownload, v as EventType, w as STANDARD_WEBHOOK_SIGNATURE_HEADER, x as SpfResult, y as ForwardVerdict, z as PrimitiveWebhookError } from "./webhook-rUjGV6Zu.js";
1
+ import { a as VERIFICATION_ERRORS, c as WebhookVerificationError, d as formatAddress, f as normalizeReceivedEmail, i as RawEmailDecodeError, l as buildForwardSubject, n as PrimitiveWebhookError, o as WebhookPayloadError, p as parseHeaderAddress, r as RAW_EMAIL_ERRORS, s as WebhookValidationError, t as PAYLOAD_ERRORS, u as buildReplySubject } from "./errors-x91I_yEt.js";
2
+ import { a as PrimitiveClient, c as createPrimitiveClient, i as PrimitiveApiError, o as client } from "./api-Cfj_U9RX.js";
3
+ import { A as PRIMITIVE_CONFIRMED_HEADER, C as STANDARD_WEBHOOK_ID_HEADER, D as verifyStandardWebhooksSignature, E as signStandardWebhooksPayload, F as verifyDownloadToken, I as safeValidateEmailReceivedEvent, L as validateEmailReceivedEvent, M as signWebhookPayload, N as verifyWebhookSignature, O as LEGACY_CONFIRMED_HEADER, P as generateDownloadToken, S as emailReceivedEventJsonSchema, T as STANDARD_WEBHOOK_TIMESTAMP_HEADER, _ as DmarcResult, a as isDownloadExpired, b as ParsedStatus, c as parseWebhookEvent, d as WEBHOOK_VERSION, f as validateEmailAuth, g as DmarcPolicy, h as DkimResult, i as handleWebhook, j as PRIMITIVE_SIGNATURE_HEADER, k as LEGACY_SIGNATURE_HEADER, l as receive, m as AuthVerdict, n as decodeRawEmail, o as isEmailReceivedEvent, p as AuthConfidence, r as getDownloadTimeRemaining, s as isRawIncluded, t as confirmedHeaders, u as verifyRawEmailDownload, v as EventType, w as STANDARD_WEBHOOK_SIGNATURE_HEADER, x as SpfResult, y as ForwardVerdict } from "./webhook-DJkfUnFZ.js";
4
4
  //#region src/index.ts
5
5
  const primitive = {
6
6
  client,