samva 0.12.0 → 0.14.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.
Files changed (75) hide show
  1. package/AGENTS.md +9 -0
  2. package/README.md +51 -6
  3. package/dist/{categories-DvsHUJtX.js → categories-BGUBFdH9.js} +13 -1
  4. package/dist/client/sdk.gen.d.ts +130 -32
  5. package/dist/client/types.gen.d.ts +979 -168
  6. package/dist/{client-Cj1bqIEe.js → client-CZjhOKPM.js} +898 -177
  7. package/dist/effect/analytics.d.ts +6 -6
  8. package/dist/effect/analytics.js +1 -1
  9. package/dist/effect/api-keys.d.ts +20 -20
  10. package/dist/effect/api-keys.js +1 -1
  11. package/dist/effect/attachments.js +1 -1
  12. package/dist/effect/brands.js +2 -2
  13. package/dist/effect/campaigns.d.ts +13 -13
  14. package/dist/effect/campaigns.js +1 -1
  15. package/dist/effect/categories.js +1 -1
  16. package/dist/effect/client.js +1 -1
  17. package/dist/effect/contact-groups.d.ts +9 -12
  18. package/dist/effect/contact-groups.js +1 -1
  19. package/dist/effect/contacts.d.ts +161 -76
  20. package/dist/effect/contacts.js +1 -1
  21. package/dist/effect/conversations.d.ts +20 -20
  22. package/dist/effect/conversations.js +1 -1
  23. package/dist/effect/custom-fields.d.ts +1 -1
  24. package/dist/effect/custom-fields.js +1 -1
  25. package/dist/effect/email.d.ts +27 -27
  26. package/dist/effect/email.js +2 -2
  27. package/dist/effect/extension-installations.d.ts +68 -2
  28. package/dist/effect/extension-installations.js +5 -3
  29. package/dist/effect/extensions.d.ts +3 -3
  30. package/dist/effect/extensions.js +1 -1
  31. package/dist/effect/feedback.d.ts +1 -1
  32. package/dist/effect/feedback.js +2 -2
  33. package/dist/effect/generated-metadata.d.ts +12 -0
  34. package/dist/effect/generated.d.ts +6502 -906
  35. package/dist/effect/index.d.ts +3 -1
  36. package/dist/effect/index.js +6 -4
  37. package/dist/effect/internal/client.d.ts +16 -2
  38. package/dist/effect/internal/operation.d.ts +14 -11
  39. package/dist/effect/mailboxes.d.ts +1725 -108
  40. package/dist/effect/mailboxes.js +3 -3
  41. package/dist/effect/media.d.ts +1 -1
  42. package/dist/effect/media.js +1 -1
  43. package/dist/effect/messages.d.ts +21 -19
  44. package/dist/effect/messages.js +1 -1
  45. package/dist/effect/namespaces.js +1 -1
  46. package/dist/effect/operations.d.ts +6 -6
  47. package/dist/effect/operations.js +1 -1
  48. package/dist/effect/organizations.d.ts +30 -0
  49. package/dist/effect/organizations.js +4 -2
  50. package/dist/effect/retry.js +1 -1
  51. package/dist/effect/scheduled-messages.d.ts +7 -7
  52. package/dist/effect/scheduled-messages.js +1 -1
  53. package/dist/effect/subscriptions.d.ts +15 -0
  54. package/dist/effect/subscriptions.js +9 -0
  55. package/dist/effect/templates.d.ts +52 -14
  56. package/dist/effect/templates.js +5 -3
  57. package/dist/effect/unsubscribe-groups.d.ts +1 -1
  58. package/dist/effect/unsubscribe-groups.js +1 -1
  59. package/dist/effect/webhooks.d.ts +15 -15
  60. package/dist/effect/webhooks.js +2 -2
  61. package/dist/index.js +4 -3
  62. package/dist/inline-attachments-BrNnSMF2.js +121 -0
  63. package/dist/inline-attachments.d.ts +65 -0
  64. package/dist/{mailbox-events-CsbF35vH.js → mailbox-events-VKR4f3qq.js} +6 -4
  65. package/dist/mailbox-events.d.ts +1 -1
  66. package/dist/{mailboxes-BtcktcNB.js → mailboxes-DT02zP7q.js} +13 -5
  67. package/dist/{operation-BEghYyLu.js → operation-g8nAzmIM.js} +63 -3
  68. package/dist/promises/errors.gen.d.ts +38 -2
  69. package/dist/promises/index.d.ts +7 -4
  70. package/dist/promises/index.js +4 -3
  71. package/dist/promises/types.gen.d.ts +1 -1
  72. package/dist/{promises-BzrwhHEW.js → promises-BFRKhpSS.js} +1070 -49
  73. package/dist/service-map.d.ts +40 -0
  74. package/package.json +7 -2
  75. package/dist/client-attribution-BTWYSXxo.js +0 -9
@@ -3,13 +3,13 @@ export declare const list: ((input?: {
3
3
  readonly limit?: string | null | undefined;
4
4
  readonly cursor?: string | null | undefined;
5
5
  readonly search?: string | null | undefined;
6
- readonly status?: string | null | undefined;
6
+ readonly status?: "active" | "disabled" | null | undefined;
7
7
  } | undefined) => import("effect/Effect").Effect<{
8
8
  readonly items: readonly {
9
9
  readonly id: string & import("effect/Brand").Brand<"WebhookEndpointId">;
10
10
  readonly name: string;
11
11
  readonly url: string;
12
- readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
12
+ readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.subscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
13
13
  readonly channels: readonly "email"[] | null;
14
14
  readonly mailboxIds: readonly (string & import("effect/Brand").Brand<"MailboxId">)[] | null;
15
15
  readonly namespaceId: (string & import("effect/Brand").Brand<"NamespaceId">) | null;
@@ -33,13 +33,13 @@ export declare const list: ((input?: {
33
33
  readonly limit?: string | null | undefined;
34
34
  readonly cursor?: string | null | undefined;
35
35
  readonly search?: string | null | undefined;
36
- readonly status?: string | null | undefined;
36
+ readonly status?: "active" | "disabled" | null | undefined;
37
37
  } | undefined) => import("effect/Stream").Stream<{
38
38
  readonly items: readonly {
39
39
  readonly id: string & import("effect/Brand").Brand<"WebhookEndpointId">;
40
40
  readonly name: string;
41
41
  readonly url: string;
42
- readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
42
+ readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.subscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
43
43
  readonly channels: readonly "email"[] | null;
44
44
  readonly mailboxIds: readonly (string & import("effect/Brand").Brand<"MailboxId">)[] | null;
45
45
  readonly namespaceId: (string & import("effect/Brand").Brand<"NamespaceId">) | null;
@@ -63,12 +63,12 @@ export declare const list: ((input?: {
63
63
  readonly limit?: string | null | undefined;
64
64
  readonly cursor?: string | null | undefined;
65
65
  readonly search?: string | null | undefined;
66
- readonly status?: string | null | undefined;
66
+ readonly status?: "active" | "disabled" | null | undefined;
67
67
  } | undefined) => import("effect/Stream").Stream<{
68
68
  readonly id: string & import("effect/Brand").Brand<"WebhookEndpointId">;
69
69
  readonly name: string;
70
70
  readonly url: string;
71
- readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
71
+ readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.subscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
72
72
  readonly channels: readonly "email"[] | null;
73
73
  readonly mailboxIds: readonly (string & import("effect/Brand").Brand<"MailboxId">)[] | null;
74
74
  readonly namespaceId: (string & import("effect/Brand").Brand<"NamespaceId">) | null;
@@ -90,20 +90,20 @@ export declare const list: ((input?: {
90
90
  export declare const create: (input: {
91
91
  readonly name: string;
92
92
  readonly url: string;
93
- readonly eventTypes: readonly string[];
94
- readonly channels?: readonly string[] | null | undefined;
93
+ readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.subscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
94
+ readonly channels?: readonly "email"[] | null | undefined;
95
95
  readonly mailboxIds?: readonly string[] | null | undefined;
96
96
  readonly namespaceId?: string | null | undefined;
97
97
  readonly headers?: {
98
98
  readonly [x: string]: string | undefined;
99
99
  } | null | undefined;
100
- readonly status?: string | null | undefined;
100
+ readonly status?: "active" | "disabled" | null | undefined;
101
101
  }) => import("effect/Effect").Effect<{
102
102
  readonly endpoint: {
103
103
  readonly id: string & import("effect/Brand").Brand<"WebhookEndpointId">;
104
104
  readonly name: string;
105
105
  readonly url: string;
106
- readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
106
+ readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.subscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
107
107
  readonly channels: readonly "email"[] | null;
108
108
  readonly mailboxIds: readonly (string & import("effect/Brand").Brand<"MailboxId">)[] | null;
109
109
  readonly namespaceId: (string & import("effect/Brand").Brand<"NamespaceId">) | null;
@@ -122,7 +122,7 @@ export declare const get: (input: {
122
122
  readonly id: string & import("effect/Brand").Brand<"WebhookEndpointId">;
123
123
  readonly name: string;
124
124
  readonly url: string;
125
- readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
125
+ readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.subscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
126
126
  readonly channels: readonly "email"[] | null;
127
127
  readonly mailboxIds: readonly (string & import("effect/Brand").Brand<"MailboxId">)[] | null;
128
128
  readonly namespaceId: (string & import("effect/Brand").Brand<"NamespaceId">) | null;
@@ -142,19 +142,19 @@ export declare const update: (input: {
142
142
  readonly id: string;
143
143
  readonly name?: string | null | undefined;
144
144
  readonly url?: string | null | undefined;
145
- readonly eventTypes?: readonly string[] | null | undefined;
146
- readonly channels?: readonly string[] | null | undefined;
145
+ readonly eventTypes?: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.subscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[] | null | undefined;
146
+ readonly channels?: readonly "email"[] | null | undefined;
147
147
  readonly mailboxIds?: readonly string[] | null | undefined;
148
148
  readonly namespaceId?: string | null | undefined;
149
149
  readonly headers?: {
150
150
  readonly [x: string]: string | undefined;
151
151
  } | null | undefined;
152
- readonly status?: string | null | undefined;
152
+ readonly status?: "active" | "disabled" | null | undefined;
153
153
  }) => import("effect/Effect").Effect<{
154
154
  readonly id: string & import("effect/Brand").Brand<"WebhookEndpointId">;
155
155
  readonly name: string;
156
156
  readonly url: string;
157
- readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
157
+ readonly eventTypes: readonly ("contact.created" | "contact.deleted" | "contact.resubscribed" | "contact.subscribed" | "contact.unsubscribed" | "contact.updated" | "conversation.archived" | "conversation.created" | "conversation.updated" | "domain.updated" | "domain.warming.updated" | "mailbox.action.pending_approval" | "mailbox.message.discarded" | "mailbox.message.quarantined" | "mailbox.message.received" | "mailbox.message.released" | "mailbox.message.sent" | "message.bounced" | "message.clicked" | "message.complained" | "message.delivered" | "message.failed" | "message.opened" | "message.read" | "message.received" | "message.sent" | "webhook.created" | "webhook.deleted" | "webhook.test" | "webhook.updated")[];
158
158
  readonly channels: readonly "email"[] | null;
159
159
  readonly mailboxIds: readonly (string & import("effect/Brand").Brand<"MailboxId">)[] | null;
160
160
  readonly namespaceId: (string & import("effect/Brand").Brand<"NamespaceId">) | null;
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.js";
2
- import { n as make } from "../operation-BEghYyLu.js";
3
- import { E as TestWebhookPayload, f as CreateWebhookPayload, j as UpdateWebhookPayload } from "../client-Cj1bqIEe.js";
2
+ import { n as make } from "../operation-g8nAzmIM.js";
3
+ import { P as UpdateWebhookPayload, f as CreateWebhookPayload, k as TestWebhookPayload } from "../client-CZjhOKPM.js";
4
4
  //#region src/effect/webhooks.ts
5
5
  var webhooks_exports = /* @__PURE__ */ __exportAll({
6
6
  CreatePayload: () => CreateWebhookPayload,
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
- import { S as fromApiError, _ as ResourceNotFoundError, a as CampaignFooterRequiredError, b as UnauthorizedError, c as EmailChannelError, d as ForbiddenError, f as GatewayTimeoutError, g as RateLimitedError, h as PaymentRequiredError, i as BrandAddressRequiredError, l as ExternalServiceError, m as OnboardingReviewRequiredError, n as AnalyticsQueryError, o as ConflictError, p as InternalError, r as BillingProviderError, s as DeliveryUnavailableError, t as createClient, u as FlagDisabledError, v as SamvaApiError, x as ValidationError, y as SamvaTransportError } from "./promises-BzrwhHEW.js";
2
- import { n as MailboxEventStreamError, t as MailboxEventStream } from "./mailbox-events-CsbF35vH.js";
3
- export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, GatewayTimeoutError, InternalError, MailboxEventStream, MailboxEventStreamError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, UnauthorizedError, ValidationError, createClient, fromApiError };
1
+ import { t as MediaUploadError } from "./inline-attachments-BrNnSMF2.js";
2
+ import { C as UnauthorizedError, S as SenderNotReadyError, T as fromApiError, _ as PaymentRequiredError, a as CampaignFooterRequiredError, b as SamvaApiError, c as EmailChannelError, d as ForbiddenError, f as GatewayTimeoutError, g as OnboardingReviewRequiredError, h as MailboxSendRefusedError, i as BrandAddressRequiredError, l as ExternalServiceError, m as MailboxSendConflictError, n as AnalyticsQueryError, o as ConflictError, p as InternalError, r as BillingProviderError, s as DeliveryUnavailableError, t as createClient, u as FlagDisabledError, v as RateLimitedError, w as ValidationError, x as SamvaTransportError, y as ResourceNotFoundError } from "./promises-BFRKhpSS.js";
3
+ import { n as MailboxEventStreamError, t as MailboxEventStream } from "./mailbox-events-VKR4f3qq.js";
4
+ export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, GatewayTimeoutError, InternalError, MailboxEventStream, MailboxEventStreamError, MailboxSendConflictError, MailboxSendRefusedError, MediaUploadError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, UnauthorizedError, ValidationError, createClient, fromApiError };
@@ -0,0 +1,121 @@
1
+ //#endregion
2
+ //#region src/client-attribution.ts
3
+ const SDK_VERSION = "0.14.0";
4
+ const CLIENT_ATTRIBUTION_HEADER = "x-samva-client";
5
+ const clientAttribution = (surface) => `${surface}/${SDK_VERSION}`;
6
+ /** A failed upload of an attachment's bytes to its presigned media URL. */
7
+ var MediaUploadError = class extends Error {
8
+ _tag = "MediaUploadError";
9
+ /** The attachment filename the upload was for. */
10
+ filename;
11
+ mediaId;
12
+ /** The storage response status, absent when the request never completed. */
13
+ status;
14
+ cause;
15
+ constructor(input) {
16
+ super(input.status === void 0 ? `Uploading attachment "${input.filename}" (${input.mediaId}) failed before storage answered` : `Uploading attachment "${input.filename}" (${input.mediaId}) failed with storage status ${input.status}`, { cause: input.cause });
17
+ this.name = "MediaUploadError";
18
+ this.filename = input.filename;
19
+ this.mediaId = input.mediaId;
20
+ this.status = input.status;
21
+ this.cause = input.cause;
22
+ }
23
+ };
24
+ const isRecord = (value) => typeof value === "object" && value !== null;
25
+ const attachmentsOf = (payload) => {
26
+ const email = payload.email;
27
+ if (!isRecord(email)) return [];
28
+ const attachments = email.attachments;
29
+ return Array.isArray(attachments) ? attachments : [];
30
+ };
31
+ /** Decoded byte length of a Base64 string, without decoding it. */
32
+ const decodedBase64Bytes = (content) => {
33
+ const length = content.length;
34
+ if (length === 0) return 0;
35
+ let padding = 0;
36
+ if (content.endsWith("==")) padding = 2;
37
+ else if (content.endsWith("=")) padding = 1;
38
+ return Math.floor(length * 3 / 4) - padding;
39
+ };
40
+ /** The bytes `content` encodes, or `undefined` when it is not Base64. */
41
+ const base64ToBytes = (content) => {
42
+ let binary;
43
+ try {
44
+ binary = atob(content);
45
+ } catch {
46
+ return;
47
+ }
48
+ const bytes = new Uint8Array(binary.length);
49
+ for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);
50
+ return bytes;
51
+ };
52
+ /**
53
+ * The inline attachments to upload so the rest fit under {@link INLINE_ATTACHMENT_MAX_BYTES}:
54
+ * largest first, stopping as soon as the remaining inline total is within the cap. Empty when the
55
+ * request is already within the cap, carries no inline content, or carries content that is not
56
+ * Base64: nothing is uploaded for a request the API will refuse, and its 422 names the attachment.
57
+ */
58
+ const planInlineUploads = (payload) => {
59
+ const inline = [];
60
+ for (const [index, entry] of attachmentsOf(payload).entries()) {
61
+ if (!isRecord(entry)) continue;
62
+ const attachment = entry;
63
+ if (typeof attachment.content !== "string") continue;
64
+ if (attachment.mediaId !== void 0) return [];
65
+ inline.push({
66
+ index,
67
+ filename: typeof attachment.filename === "string" ? attachment.filename : "attachment",
68
+ contentType: typeof attachment.contentType === "string" ? attachment.contentType : "application/octet-stream",
69
+ content: attachment.content,
70
+ sizeBytes: typeof attachment.size === "number" ? attachment.size : decodedBase64Bytes(attachment.content)
71
+ });
72
+ }
73
+ let remaining = inline.reduce((total, upload) => total + upload.sizeBytes, 0);
74
+ if (remaining <= 4194304) return [];
75
+ const chosen = [];
76
+ const largestFirst = [...inline].sort((left, right) => right.sizeBytes - left.sizeBytes || left.index - right.index);
77
+ for (const { content, ...upload } of largestFirst) {
78
+ if (remaining <= 4194304) break;
79
+ const bytes = base64ToBytes(content);
80
+ if (bytes === void 0) return [];
81
+ chosen.push({
82
+ ...upload,
83
+ bytes
84
+ });
85
+ remaining -= upload.sizeBytes;
86
+ }
87
+ return chosen;
88
+ };
89
+ /** The `POST /v1/media` body for an inline attachment. */
90
+ const mediaCreateBody = (upload) => ({
91
+ filename: upload.filename,
92
+ contentType: upload.contentType,
93
+ sizeBytes: upload.sizeBytes,
94
+ purpose: "attachment"
95
+ });
96
+ /** The `Content-Type` of the presigned request, for clients that set it from the body. */
97
+ const uploadContentType = (headers) => Object.entries(headers).find(([name]) => name.toLowerCase() === "content-type")?.[1];
98
+ /** Replace each uploaded attachment with its `mediaId` form; everything else is untouched. */
99
+ const withUploadedAttachments = (payload, uploaded) => {
100
+ const email = payload.email;
101
+ const attachments = email.attachments.map((entry, index) => {
102
+ const replacement = uploaded.get(index);
103
+ if (replacement === void 0) return entry;
104
+ const { content: _content, ...rest } = entry;
105
+ return {
106
+ ...rest,
107
+ mediaId: replacement.mediaId
108
+ };
109
+ });
110
+ return {
111
+ ...payload,
112
+ email: {
113
+ ...email,
114
+ attachments
115
+ }
116
+ };
117
+ };
118
+ //#endregion
119
+ export { withUploadedAttachments as a, uploadContentType as i, mediaCreateBody as n, CLIENT_ATTRIBUTION_HEADER as o, planInlineUploads as r, clientAttribution as s, MediaUploadError as t };
120
+
121
+ //# sourceMappingURL=inline-attachments-BrNnSMF2.js.map
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Shared, pure planning for email sends whose inline attachments exceed the API's inline cap.
3
+ *
4
+ * The API accepts a bounded number of decoded bytes as Base64 `content` per request (larger files
5
+ * travel as owned media and are referenced by `mediaId`). Both clients call these helpers to decide
6
+ * which inline attachments to upload through media before the single send request, so the choice
7
+ * cannot drift between them. No Effect, no I/O.
8
+ */
9
+ /** Decoded bytes of inline attachment `content` one send request may carry. */
10
+ export declare const INLINE_ATTACHMENT_MAX_BYTES: number;
11
+ /** A failed upload of an attachment's bytes to its presigned media URL. */
12
+ export declare class MediaUploadError extends Error {
13
+ readonly _tag: "MediaUploadError";
14
+ /** The attachment filename the upload was for. */
15
+ readonly filename: string;
16
+ readonly mediaId: string;
17
+ /** The storage response status, absent when the request never completed. */
18
+ readonly status: number | undefined;
19
+ readonly cause: unknown;
20
+ constructor(input: {
21
+ readonly filename: string;
22
+ readonly mediaId: string;
23
+ readonly status?: number | undefined;
24
+ readonly cause?: unknown;
25
+ });
26
+ }
27
+ /** One inline attachment chosen for upload. */
28
+ export interface InlineUpload {
29
+ /** Position in `email.attachments`. */
30
+ readonly index: number;
31
+ readonly filename: string;
32
+ readonly contentType: string;
33
+ /** The decoded `content`, the bytes put to storage. */
34
+ readonly bytes: Uint8Array;
35
+ /** The attachment's declared `size`, the bytes the API charges against the inline cap. */
36
+ readonly sizeBytes: number;
37
+ }
38
+ /** The presigned request `POST /v1/media` returns for putting the bytes into storage. */
39
+ export interface UploadInstruction {
40
+ readonly url: string;
41
+ readonly headers: Readonly<Record<string, string>>;
42
+ }
43
+ /** Decoded byte length of a Base64 string, without decoding it. */
44
+ export declare const decodedBase64Bytes: (content: string) => number;
45
+ /**
46
+ * The inline attachments to upload so the rest fit under {@link INLINE_ATTACHMENT_MAX_BYTES}:
47
+ * largest first, stopping as soon as the remaining inline total is within the cap. Empty when the
48
+ * request is already within the cap, carries no inline content, or carries content that is not
49
+ * Base64: nothing is uploaded for a request the API will refuse, and its 422 names the attachment.
50
+ */
51
+ export declare const planInlineUploads: (payload: Record<string, unknown>) => ReadonlyArray<InlineUpload>;
52
+ /** The `POST /v1/media` body for an inline attachment. */
53
+ export declare const mediaCreateBody: (upload: InlineUpload) => {
54
+ filename: string;
55
+ contentType: string;
56
+ sizeBytes: number;
57
+ purpose: "attachment";
58
+ };
59
+ /** The `Content-Type` of the presigned request, for clients that set it from the body. */
60
+ export declare const uploadContentType: (headers: Readonly<Record<string, string>>) => string | undefined;
61
+ /** Replace each uploaded attachment with its `mediaId` form; everything else is untouched. */
62
+ export declare const withUploadedAttachments: (payload: Record<string, unknown>, uploaded: ReadonlyMap<number, {
63
+ readonly mediaId: string;
64
+ readonly upload: InlineUpload;
65
+ }>) => Record<string, unknown>;
@@ -441,7 +441,9 @@ var MailboxEventStream = class {
441
441
  });
442
442
  }
443
443
  /** One connection, from upgrade to close. `onLive` runs once replay has caught up. */
444
- #connect(onLive) {
444
+ async #connect(onLive) {
445
+ const headers = typeof this.#connection.headers === "function" ? await this.#connection.headers() : this.#connection.headers;
446
+ if (this.#ended) return { kind: "stopped" };
445
447
  return new Promise((resolve) => {
446
448
  const WebSocketImplementation = this.#options.WebSocket ?? globalWebSocket();
447
449
  if (WebSocketImplementation === void 0) {
@@ -481,7 +483,7 @@ var MailboxEventStream = class {
481
483
  const onStop = () => settle({ kind: "stopped" });
482
484
  let socket;
483
485
  try {
484
- socket = new WebSocketImplementation(url.toString(), { headers: this.#connection.headers });
486
+ socket = new WebSocketImplementation(url.toString(), { headers });
485
487
  } catch (cause) {
486
488
  this.#fail(new MailboxEventStreamError({
487
489
  _tag: "StreamClientError",
@@ -568,7 +570,7 @@ var MailboxEventStream = class {
568
570
  const diagnosis = (async () => {
569
571
  try {
570
572
  const response = await (this.#connection.fetch ?? fetch)(url, {
571
- headers: this.#connection.headers,
573
+ headers: typeof this.#connection.headers === "function" ? await this.#connection.headers() : this.#connection.headers,
572
574
  signal: deadline.signal
573
575
  });
574
576
  if (response.status === 426) {
@@ -626,4 +628,4 @@ const readRefusalBody = async (response) => {
626
628
  //#endregion
627
629
  export { MailboxEventStreamError as n, MailboxEventStream as t };
628
630
 
629
- //# sourceMappingURL=mailbox-events-CsbF35vH.js.map
631
+ //# sourceMappingURL=mailbox-events-VKR4f3qq.js.map
@@ -136,7 +136,7 @@ export interface MailboxEventStreamOptions {
136
136
  export interface MailboxEventStreamConnection {
137
137
  readonly baseUrl: string;
138
138
  /** The credential and attribution headers every request of the client carries. */
139
- readonly headers: Readonly<Record<string, string>>;
139
+ readonly headers: Readonly<Record<string, string>> | (() => Promise<Readonly<Record<string, string>>>);
140
140
  readonly fetch?: typeof fetch | undefined;
141
141
  }
142
142
  /** The frame that asks the events host whether the connection is alive; pinned to the host's by a test. */
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { n as MailboxEventStreamError, t as MailboxEventStream } from "./mailbox-events-CsbF35vH.js";
3
- import { n as make } from "./operation-BEghYyLu.js";
4
- import { t as Service } from "./client-Cj1bqIEe.js";
2
+ import { n as MailboxEventStreamError, t as MailboxEventStream } from "./mailbox-events-VKR4f3qq.js";
3
+ import { n as make } from "./operation-g8nAzmIM.js";
4
+ import { t as Service } from "./client-CZjhOKPM.js";
5
5
  import { Cause, Effect, Exit, Stream } from "effect";
6
6
  //#region src/effect/internal/mailbox-events.ts
7
7
  const toStreamError = (cause) => cause instanceof MailboxEventStreamError ? cause : new MailboxEventStreamError({
@@ -35,6 +35,8 @@ var mailboxes_exports = /* @__PURE__ */ __exportAll({
35
35
  MailboxEventStreamError: () => MailboxEventStreamError,
36
36
  addThreadLabels: () => addThreadLabels,
37
37
  approveAction: () => approveAction,
38
+ cancelAction: () => cancelAction,
39
+ copyMessageAttachment: () => copyMessageAttachment,
38
40
  create: () => create,
39
41
  createDraft: () => createDraft,
40
42
  createGrant: () => createGrant,
@@ -50,6 +52,7 @@ var mailboxes_exports = /* @__PURE__ */ __exportAll({
50
52
  events: () => events,
51
53
  forward: () => forward,
52
54
  get: () => get,
55
+ getAction: () => getAction,
53
56
  getAgentActivity: () => getAgentActivity,
54
57
  getDraft: () => getDraft,
55
58
  getMessage: () => getMessage,
@@ -77,6 +80,7 @@ var mailboxes_exports = /* @__PURE__ */ __exportAll({
77
80
  reply: () => reply,
78
81
  replyAll: () => replyAll,
79
82
  resume: () => resume,
83
+ retryAction: () => retryAction,
80
84
  revokeGrant: () => revokeGrant,
81
85
  sendDraft: () => sendDraft,
82
86
  sendMessage: () => sendMessage,
@@ -125,6 +129,7 @@ const sendMessage = make("mailboxesSendMessage");
125
129
  const getMessage = make("mailboxesGetMessage");
126
130
  const getMessageRaw = make("mailboxesGetMessageRaw");
127
131
  const getMessageAttachment = make("mailboxesGetMessageAttachment");
132
+ const copyMessageAttachment = make("mailboxesCopyMessageAttachment");
128
133
  const reply = make("mailboxesReply");
129
134
  const replyAll = make("mailboxesReplyAll");
130
135
  const forward = make("mailboxesForward");
@@ -138,10 +143,13 @@ const updateDraft = make("mailboxesUpdateDraft");
138
143
  const deleteDraft = make("mailboxesDeleteDraft");
139
144
  const sendDraft = make("mailboxesSendDraft");
140
145
  const listActions = make("mailboxesListActions");
146
+ const getAction = make("mailboxesGetAction");
147
+ const cancelAction = make("mailboxesCancelAction");
148
+ const retryAction = make("mailboxesRetryAction");
141
149
  const approveAction = make("mailboxesApproveAction");
142
150
  const denyAction = make("mailboxesDenyAction");
143
151
  const listEvents = make("mailboxesListEvents");
144
152
  //#endregion
145
- export { updatePolicy as $, listGrants as A, remove as B, getThread as C, listDrafts as D, listActions as E, listThreadNotes as F, revokeGrant as G, reply as H, listThreads as I, update as J, sendDraft as K, mailboxes_exports as L, listPolicies as M, listQuarantine as N, listEvents as O, listThreadMessages as P, updateNote as Q, pause as R, getPolicy as S, list as T, replyAll as U, removeThreadLabels as V, resume as W, updateGrant as X, updateDraft as Y, updateLabel as Z, getAgentActivity as _, createGrant as a, getMessageAttachment as b, createPolicy as c, deleteNote as d, updateThread as et, deletePolicy as f, get as g, forward as h, createDraft as i, listLabels as j, listFolders as k, deleteDraft as l, discardMessage as m, approveAction as n, createLabel as o, denyAction as p, sendMessage as q, create as r, createNote as s, addThreadLabels as t, events as tt, deleteLabel as u, getDraft as v, getThreadContent as w, getMessageRaw as x, getMessage as y, releaseMessage as z };
153
+ export { updateDraft as $, listDrafts as A, mailboxes_exports as B, getMessageAttachment as C, getThreadContent as D, getThread as E, listPolicies as F, reply as G, releaseMessage as H, listQuarantine as I, retryAction as J, replyAll as K, listThreadMessages as L, listFolders as M, listGrants as N, list as O, listLabels as P, update as Q, listThreadNotes as R, getMessage as S, getPolicy as T, remove as U, pause as V, removeThreadLabels as W, sendDraft as X, revokeGrant as Y, sendMessage as Z, forward as _, create as a, events as at, getAgentActivity as b, createLabel as c, deleteDraft as d, updateGrant as et, deleteLabel as f, discardMessage as g, denyAction as h, copyMessageAttachment as i, updateThread as it, listEvents as j, listActions as k, createNote as l, deletePolicy as m, approveAction as n, updateNote as nt, createDraft as o, deleteNote as p, resume as q, cancelAction as r, updatePolicy as rt, createGrant as s, addThreadLabels as t, updateLabel as tt, createPolicy as u, get as v, getMessageRaw as w, getDraft as x, getAction as y, listThreads as z };
146
154
 
147
- //# sourceMappingURL=mailboxes-BtcktcNB.js.map
155
+ //# sourceMappingURL=mailboxes-DT02zP7q.js.map
@@ -1,5 +1,6 @@
1
+ import { a as withUploadedAttachments, n as mediaCreateBody, r as planInlineUploads } from "./inline-attachments-BrNnSMF2.js";
1
2
  import { n as buildMessagesSendPayload, r as replyToEmailsPayload, t as buildEmailSendPayload } from "./normalize-B79uJIeb.js";
2
- import { t as Service, w as SamvaApi } from "./client-Cj1bqIEe.js";
3
+ import { E as SamvaApi, t as Service } from "./client-CZjhOKPM.js";
3
4
  import { generateIdempotencyKey, withRetry } from "./effect/retry.js";
4
5
  import { Effect, Option, Predicate, Stream } from "effect";
5
6
  //#region src/service-map.ts
@@ -523,6 +524,10 @@ const SDK_OPERATION_CALLS = {
523
524
  kind: "path",
524
525
  paths: ["id", "publicationId"]
525
526
  },
527
+ templatesRenderPublication: {
528
+ kind: "pathPayload",
529
+ paths: ["id", "publicationId"]
530
+ },
526
531
  templatesListInputContracts: {
527
532
  kind: "pathParams",
528
533
  paths: ["id"]
@@ -568,6 +573,7 @@ const SDK_OPERATION_CALLS = {
568
573
  organizationsCreate: { kind: "payload" },
569
574
  organizationsGet: { kind: "none" },
570
575
  organizationsGetProfile: { kind: "none" },
576
+ organizationsGetTrustTier: { kind: "none" },
571
577
  organizationsUpdate: { kind: "payload" },
572
578
  organizationsGetUsage: { kind: "params" },
573
579
  organizationsDelete: { kind: "idempotentPayload" },
@@ -652,6 +658,7 @@ const SDK_OPERATION_CALLS = {
652
658
  kind: "path",
653
659
  paths: ["id"]
654
660
  },
661
+ subscriptionsSubscribe: { kind: "payload" },
655
662
  unsubscribeList: { kind: "none" },
656
663
  unsubscribeCreate: { kind: "payload" },
657
664
  unsubscribeUpdate: {
@@ -839,6 +846,14 @@ const SDK_OPERATION_CALLS = {
839
846
  "attachmentId"
840
847
  ]
841
848
  },
849
+ mailboxesCopyMessageAttachment: {
850
+ kind: "path",
851
+ paths: [
852
+ "id",
853
+ "messageId",
854
+ "attachmentId"
855
+ ]
856
+ },
842
857
  mailboxesReply: {
843
858
  kind: "optionalIdempotentPathPayload",
844
859
  paths: ["id", "messageId"]
@@ -891,6 +906,18 @@ const SDK_OPERATION_CALLS = {
891
906
  kind: "pathParams",
892
907
  paths: ["id"]
893
908
  },
909
+ mailboxesGetAction: {
910
+ kind: "path",
911
+ paths: ["id", "actionId"]
912
+ },
913
+ mailboxesCancelAction: {
914
+ kind: "path",
915
+ paths: ["id", "actionId"]
916
+ },
917
+ mailboxesRetryAction: {
918
+ kind: "path",
919
+ paths: ["id", "actionId"]
920
+ },
894
921
  mailboxesApproveAction: {
895
922
  kind: "path",
896
923
  paths: ["id", "actionId"]
@@ -933,6 +960,10 @@ const SDK_OPERATION_CALLS = {
933
960
  },
934
961
  extensionInstallationsList: { kind: "params" },
935
962
  extensionInstallationsInstall: { kind: "payload" },
963
+ extensionInstallationsUpgrade: {
964
+ kind: "pathPayload",
965
+ paths: ["id"]
966
+ },
936
967
  extensionInstallationsGet: {
937
968
  kind: "path",
938
969
  paths: ["id"]
@@ -1114,11 +1145,40 @@ const make = (operationName) => {
1114
1145
  }
1115
1146
  return operation;
1116
1147
  };
1148
+ /**
1149
+ * Inline attachment content over the API's request cap travels as media instead: the largest
1150
+ * attachments are uploaded (create, put to the presigned URL, complete) and replaced by their
1151
+ * `mediaId`. The returned payload is the one request every send attempt reuses, so nothing is
1152
+ * uploaded twice.
1153
+ */
1154
+ const uploadOversizedAttachments = (client, payload) => Effect.gen(function* () {
1155
+ const plan = planInlineUploads(payload);
1156
+ if (plan.length === 0) return payload;
1157
+ const uploaded = /* @__PURE__ */ new Map();
1158
+ for (const upload of plan) {
1159
+ const created = yield* rawOperation(client, "mediaCreate")({ payload: mediaCreateBody(upload) });
1160
+ yield* client.putUpload({
1161
+ filename: upload.filename,
1162
+ mediaId: created.id,
1163
+ url: created.upload.url,
1164
+ method: created.upload.method,
1165
+ headers: created.upload.headers,
1166
+ bytes: upload.bytes
1167
+ });
1168
+ yield* rawOperation(client, "mediaComplete")({ params: { id: created.id } });
1169
+ uploaded.set(upload.index, {
1170
+ mediaId: created.id,
1171
+ upload
1172
+ });
1173
+ }
1174
+ return withUploadedAttachments(payload, uploaded);
1175
+ });
1117
1176
  const sendPayload = (payload, options) => Effect.gen(function* () {
1118
1177
  const client = yield* Service;
1119
1178
  const idempotencyKey = options?.idempotencyKey ?? (yield* generateIdempotencyKey);
1179
+ const prepared = yield* uploadOversizedAttachments(client, payload);
1120
1180
  return yield* withRetry(rawOperation(client, "messagesSend")({
1121
- payload: stripUndefined(payload),
1181
+ payload: stripUndefined(prepared),
1122
1182
  headers: { "idempotency-key": idempotencyKey }
1123
1183
  }));
1124
1184
  });
@@ -1143,4 +1203,4 @@ const addEmailSender = Effect.fn("Email.addSender")(function* (input, options) {
1143
1203
  //#endregion
1144
1204
  export { sendMessage as i, make as n, sendEmail as r, addEmailSender as t };
1145
1205
 
1146
- //# sourceMappingURL=operation-BEghYyLu.js.map
1206
+ //# sourceMappingURL=operation-g8nAzmIM.js.map
@@ -1,4 +1,4 @@
1
- export type SamvaApiErrorTag = "AnalyticsQueryError" | "BillingProviderError" | "BrandAddressRequiredError" | "CampaignFooterRequiredError" | "ConflictError" | "DeliveryUnavailableError" | "EmailChannelError" | "ExternalServiceError" | "FlagDisabledError" | "ForbiddenError" | "GatewayTimeoutError" | "InternalError" | "OnboardingReviewRequiredError" | "PaymentRequiredError" | "RateLimitedError" | "ResourceNotFoundError" | "UnauthorizedError" | "ValidationError";
1
+ export type SamvaApiErrorTag = "AnalyticsQueryError" | "BillingProviderError" | "BrandAddressRequiredError" | "CampaignFooterRequiredError" | "ConflictError" | "DeliveryUnavailableError" | "EmailChannelError" | "ExternalServiceError" | "FlagDisabledError" | "ForbiddenError" | "GatewayTimeoutError" | "InternalError" | "MailboxSendConflictError" | "MailboxSendRefusedError" | "OnboardingReviewRequiredError" | "PaymentRequiredError" | "RateLimitedError" | "ResourceNotFoundError" | "SenderNotReadyError" | "UnauthorizedError" | "ValidationError";
2
2
  export interface SamvaApiErrorContext {
3
3
  readonly request?: Request | undefined;
4
4
  readonly response?: Response | undefined;
@@ -132,6 +132,30 @@ export declare class InternalError extends SamvaApiError<"InternalError"> {
132
132
  readonly _tag: "InternalError";
133
133
  constructor(payload: Omit<InternalErrorPayload, "_tag">, context?: SamvaApiErrorContext);
134
134
  }
135
+ type MailboxSendConflictErrorPayload = {
136
+ readonly _tag: "MailboxSendConflictError";
137
+ readonly id: string;
138
+ readonly message: string;
139
+ readonly receipt: Record<string, unknown>;
140
+ readonly resource: string;
141
+ };
142
+ export declare class MailboxSendConflictError extends SamvaApiError<"MailboxSendConflictError"> {
143
+ readonly _tag: "MailboxSendConflictError";
144
+ readonly "id": string;
145
+ readonly "receipt": Record<string, unknown>;
146
+ readonly "resource": string;
147
+ constructor(payload: Omit<MailboxSendConflictErrorPayload, "_tag">, context?: SamvaApiErrorContext);
148
+ }
149
+ type MailboxSendRefusedErrorPayload = {
150
+ readonly _tag: "MailboxSendRefusedError";
151
+ readonly message: string;
152
+ readonly receipt: Record<string, unknown>;
153
+ };
154
+ export declare class MailboxSendRefusedError extends SamvaApiError<"MailboxSendRefusedError"> {
155
+ readonly _tag: "MailboxSendRefusedError";
156
+ readonly "receipt": Record<string, unknown>;
157
+ constructor(payload: Omit<MailboxSendRefusedErrorPayload, "_tag">, context?: SamvaApiErrorContext);
158
+ }
135
159
  type OnboardingReviewRequiredErrorPayload = {
136
160
  readonly _tag: "OnboardingReviewRequiredError";
137
161
  readonly code: "review_required" | "review_in_progress" | "information_required" | "review_rejected" | "identity_review_required" | "identity_review_rejected" | "identity_changed";
@@ -186,6 +210,18 @@ export declare class ResourceNotFoundError extends SamvaApiError<"ResourceNotFou
186
210
  readonly "resource": string;
187
211
  constructor(payload: Omit<ResourceNotFoundErrorPayload, "_tag">, context?: SamvaApiErrorContext);
188
212
  }
213
+ type SenderNotReadyErrorPayload = {
214
+ readonly _tag: "SenderNotReadyError";
215
+ readonly message: string;
216
+ readonly retryAfterSeconds?: number | null;
217
+ readonly sender: string;
218
+ };
219
+ export declare class SenderNotReadyError extends SamvaApiError<"SenderNotReadyError"> {
220
+ readonly _tag: "SenderNotReadyError";
221
+ readonly "retryAfterSeconds"?: number | null;
222
+ readonly "sender": string;
223
+ constructor(payload: Omit<SenderNotReadyErrorPayload, "_tag">, context?: SamvaApiErrorContext);
224
+ }
189
225
  type UnauthorizedErrorPayload = {
190
226
  readonly _tag: "UnauthorizedError";
191
227
  readonly message: string;
@@ -204,7 +240,7 @@ export declare class ValidationError extends SamvaApiError<"ValidationError"> {
204
240
  readonly "fields"?: Record<string, Array<string>> | null;
205
241
  constructor(payload: Omit<ValidationErrorPayload, "_tag">, context?: SamvaApiErrorContext);
206
242
  }
207
- export type AnySamvaApiError = AnalyticsQueryError | BillingProviderError | BrandAddressRequiredError | CampaignFooterRequiredError | ConflictError | DeliveryUnavailableError | EmailChannelError | ExternalServiceError | FlagDisabledError | ForbiddenError | GatewayTimeoutError | InternalError | OnboardingReviewRequiredError | PaymentRequiredError | RateLimitedError | ResourceNotFoundError | UnauthorizedError | ValidationError;
243
+ export type AnySamvaApiError = AnalyticsQueryError | BillingProviderError | BrandAddressRequiredError | CampaignFooterRequiredError | ConflictError | DeliveryUnavailableError | EmailChannelError | ExternalServiceError | FlagDisabledError | ForbiddenError | GatewayTimeoutError | InternalError | MailboxSendConflictError | MailboxSendRefusedError | OnboardingReviewRequiredError | PaymentRequiredError | RateLimitedError | ResourceNotFoundError | SenderNotReadyError | UnauthorizedError | ValidationError;
208
244
  /** Convert a decoded error payload into its generated JavaScript error class. */
209
245
  export declare function fromApiError(error: unknown, context?: SamvaApiErrorContext): AnySamvaApiError | SamvaTransportError;
210
246
  export {};