samva 0.34.0 → 0.36.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.
- package/AGENTS.md +17 -0
- package/README.md +2 -1
- package/dist/client/sdk.gen.d.ts +325 -331
- package/dist/client/sdk.gen.js +406 -454
- package/dist/client/types.gen.d.ts +3465 -750
- package/dist/effect/agents.d.ts +222 -17
- package/dist/effect/agents.js +7 -1
- package/dist/effect/analytics.d.ts +21 -15
- package/dist/effect/api-keys.d.ts +30 -24
- package/dist/effect/campaigns.d.ts +695 -39
- package/dist/effect/categories.d.ts +3 -3
- package/dist/effect/contact-groups.d.ts +15 -15
- package/dist/effect/contacts.d.ts +56 -52
- package/dist/effect/conversations.d.ts +51 -45
- package/dist/effect/email.d.ts +82 -82
- package/dist/effect/errors.d.ts +1 -1
- package/dist/effect/errors.js +2 -2
- package/dist/effect/extension-installations.d.ts +64 -12
- package/dist/effect/extensions.d.ts +16 -16
- package/dist/effect/generated/agents.d.ts +2902 -150
- package/dist/effect/generated/agents.js +219 -31
- package/dist/effect/generated/analytics.d.ts +127 -136
- package/dist/effect/generated/analytics.js +72 -37
- package/dist/effect/generated/api-keys.d.ts +243 -47
- package/dist/effect/generated/api-keys.js +27 -12
- package/dist/effect/generated/attachments.d.ts +89 -1
- package/dist/effect/generated/attachments.js +10 -2
- package/dist/effect/generated/brands.d.ts +133 -1
- package/dist/effect/generated/brands.js +22 -10
- package/dist/effect/generated/campaigns.d.ts +1467 -143
- package/dist/effect/generated/campaigns.js +84 -20
- package/dist/effect/generated/contact-events.d.ts +26 -4
- package/dist/effect/generated/contact-events.js +5 -3
- package/dist/effect/generated/contact-groups.d.ts +233 -13
- package/dist/effect/generated/contact-groups.js +33 -17
- package/dist/effect/generated/contacts.d.ts +634 -96
- package/dist/effect/generated/contacts.js +82 -20
- package/dist/effect/generated/conversations.d.ts +501 -108
- package/dist/effect/generated/conversations.js +106 -22
- package/dist/effect/generated/custom-fields.d.ts +89 -1
- package/dist/effect/generated/custom-fields.js +11 -3
- package/dist/effect/generated/email.d.ts +1447 -83
- package/dist/effect/generated/email.js +167 -43
- package/dist/effect/generated/events.d.ts +51 -7
- package/dist/effect/generated/events.js +9 -5
- package/dist/effect/generated/extension-installations.d.ts +1052 -77
- package/dist/effect/generated/extension-installations.js +45 -31
- package/dist/effect/generated/extensions.d.ts +123 -13
- package/dist/effect/generated/extensions.js +20 -10
- package/dist/effect/generated/feedback.d.ts +23 -1
- package/dist/effect/generated/feedback.js +6 -4
- package/dist/effect/generated/index.d.ts +3 -1
- package/dist/effect/generated/journeys.d.ts +684 -16
- package/dist/effect/generated/journeys.js +37 -9
- package/dist/effect/generated/mailboxes.d.ts +6169 -1734
- package/dist/effect/generated/mailboxes.js +549 -344
- package/dist/effect/generated/media.d.ts +125 -15
- package/dist/effect/generated/media.js +15 -2
- package/dist/effect/generated/messages.d.ts +2036 -117
- package/dist/effect/generated/messages.js +286 -54
- package/dist/effect/generated/namespaces.d.ts +215 -55
- package/dist/effect/generated/namespaces.js +30 -12
- package/dist/effect/generated/newsletter-domains.d.ts +98 -12
- package/dist/effect/generated/newsletter-domains.js +20 -13
- package/dist/effect/generated/newsletter-issues.d.ts +354 -19
- package/dist/effect/generated/newsletter-issues.js +162 -98
- package/dist/effect/generated/newsletters.d.ts +123 -13
- package/dist/effect/generated/newsletters.js +19 -9
- package/dist/effect/generated/operations.d.ts +76 -10
- package/dist/effect/generated/operations.js +12 -6
- package/dist/effect/generated/organizations.d.ts +287 -7
- package/dist/effect/generated/organizations.js +33 -5
- package/dist/effect/generated/policies.d.ts +953 -0
- package/dist/effect/generated/policies.js +116 -0
- package/dist/effect/generated/scheduled-messages.d.ts +4418 -49
- package/dist/effect/generated/scheduled-messages.js +77 -13
- package/dist/effect/generated/shared.d.ts +3213 -521
- package/dist/effect/generated/shared.js +713 -128
- package/dist/effect/generated/subscriptions.d.ts +23 -1
- package/dist/effect/generated/subscriptions.js +6 -4
- package/dist/effect/generated/templates.d.ts +2081 -693
- package/dist/effect/generated/templates.js +482 -267
- package/dist/effect/generated/topic-forms.d.ts +111 -1
- package/dist/effect/generated/topic-forms.js +23 -13
- package/dist/effect/generated/topics.d.ts +353 -43
- package/dist/effect/generated/topics.js +67 -19
- package/dist/effect/generated/webhooks.d.ts +318 -57
- package/dist/effect/generated/webhooks.js +68 -17
- package/dist/effect/generated/whoami.d.ts +35 -5
- package/dist/effect/generated/whoami.js +4 -2
- package/dist/effect/generated-metadata.d.ts +56 -32
- package/dist/effect/generated-metadata.js +137 -105
- package/dist/effect/index.d.ts +1 -0
- package/dist/effect/index.js +3 -2
- package/dist/effect/internal/client.js +1 -1
- package/dist/effect/internal/email-sender.d.ts +1 -1
- package/dist/effect/internal/operation.js +5 -32
- package/dist/effect/internal/send.d.ts +1 -1
- package/dist/effect/journeys.d.ts +169 -83
- package/dist/effect/mailboxes.d.ts +978 -301
- package/dist/effect/mailboxes.js +1 -11
- package/dist/effect/media.d.ts +1 -1
- package/dist/effect/messages.d.ts +40 -40
- package/dist/effect/namespaces.d.ts +15 -15
- package/dist/effect/newsletter-domains.d.ts +5 -5
- package/dist/effect/newsletters.d.ts +1 -1
- package/dist/effect/operations.d.ts +11 -11
- package/dist/effect/organizations.d.ts +2 -2
- package/dist/effect/policies.d.ts +65 -0
- package/dist/effect/policies.js +16 -0
- package/dist/effect/scheduled-messages.d.ts +869 -8
- package/dist/effect/templates.d.ts +43 -45
- package/dist/effect/templates.js +5 -3
- package/dist/effect/topics.d.ts +23 -23
- package/dist/effect/webhooks.d.ts +29 -26
- package/dist/index.js +2 -2
- package/dist/mailbox/test.js +11 -4
- package/dist/mailbox/types.d.ts +39 -3
- package/dist/normalize.js +13 -1
- package/dist/package.js +1 -1
- package/dist/promises/client.d.ts +4 -2
- package/dist/promises/client.js +5 -3
- package/dist/promises/errors.gen.d.ts +38 -2
- package/dist/promises/errors.gen.js +394 -34
- package/dist/promises/index.js +2 -2
- package/dist/promises/types.gen.d.ts +1 -1
- package/dist/service-map.d.ts +39 -28
- package/dist/service-map.js +220 -782
- package/package.json +13 -8
package/dist/mailbox/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { SamvaClient } from "../promises/client";
|
|
2
|
-
type SendResult = Awaited<ReturnType<SamvaClient["mailboxes"]["reply"]>>;
|
|
3
2
|
export type ExtensionManifest = {
|
|
4
3
|
readonly name: string;
|
|
5
4
|
readonly displayName: string;
|
|
@@ -35,6 +34,41 @@ export type ActionResolution = {
|
|
|
35
34
|
/** The denial reason; null for an approval or a cancellation. */
|
|
36
35
|
readonly reason: string | null;
|
|
37
36
|
};
|
|
37
|
+
/** Why a mailbox action was allowed, held, or refused. */
|
|
38
|
+
export type ActionDecision = {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly reviewRound: number;
|
|
41
|
+
readonly requirement: "run" | "model" | "person" | "never";
|
|
42
|
+
readonly decider: "rule" | "model" | "person" | "agent";
|
|
43
|
+
readonly outcome: "allow" | "hold" | "refuse";
|
|
44
|
+
readonly reason: string;
|
|
45
|
+
readonly scopes: readonly PolicyScope[];
|
|
46
|
+
readonly rule?: {
|
|
47
|
+
readonly scope: PolicyScope;
|
|
48
|
+
readonly index: number;
|
|
49
|
+
} | undefined;
|
|
50
|
+
readonly guard?: string | undefined;
|
|
51
|
+
readonly guardReason?: string | undefined;
|
|
52
|
+
readonly resolution?: {
|
|
53
|
+
readonly by: string;
|
|
54
|
+
readonly at: string;
|
|
55
|
+
readonly as: "approved" | "edited" | "denied" | "alwaysAllowed";
|
|
56
|
+
readonly diff?: {
|
|
57
|
+
readonly text?: {
|
|
58
|
+
readonly before: string | null;
|
|
59
|
+
readonly after: string | null;
|
|
60
|
+
} | undefined;
|
|
61
|
+
readonly html?: {
|
|
62
|
+
readonly before: string | null;
|
|
63
|
+
readonly after: string | null;
|
|
64
|
+
} | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
} | undefined;
|
|
67
|
+
};
|
|
68
|
+
type PolicyScope = {
|
|
69
|
+
readonly kind: "organization" | "mailbox" | "agent" | "apiKey";
|
|
70
|
+
readonly id: string;
|
|
71
|
+
};
|
|
38
72
|
export type CampaignAttribution = {
|
|
39
73
|
readonly campaignId: string;
|
|
40
74
|
readonly runId: string;
|
|
@@ -89,9 +123,10 @@ export type EventData = {
|
|
|
89
123
|
"mailbox.action.pending_approval": MailboxEventScope & {
|
|
90
124
|
readonly action: {
|
|
91
125
|
readonly state?: "approvalRequired";
|
|
92
|
-
readonly decision
|
|
126
|
+
readonly decision: ActionDecision;
|
|
127
|
+
readonly reviewRound: number;
|
|
93
128
|
readonly id: string;
|
|
94
|
-
readonly type: "sendMessage" | "reply" | "updateDraft" | "createNote" | "assignThread" | "changeThreadState" | "call" | "extensionRequest" | "toolCall";
|
|
129
|
+
readonly type: "sendMessage" | "reply" | "updateDraft" | "createNote" | "assignThread" | "changeThreadState" | "call" | "extensionRequest" | "toolCall" | "handoff";
|
|
95
130
|
readonly threadId: string | null;
|
|
96
131
|
readonly reason: string | null;
|
|
97
132
|
readonly proposedBy: WebhookActor;
|
|
@@ -115,6 +150,7 @@ export type EventData = {
|
|
|
115
150
|
"mailbox.action.resolved": MailboxEventScope & {
|
|
116
151
|
readonly action: {
|
|
117
152
|
readonly id: string;
|
|
153
|
+
readonly reviewRound: number;
|
|
118
154
|
readonly type: EventData["mailbox.action.pending_approval"]["action"]["type"];
|
|
119
155
|
readonly threadId: string | null;
|
|
120
156
|
readonly proposedBy: WebhookActor;
|
package/dist/normalize.js
CHANGED
|
@@ -2,9 +2,21 @@
|
|
|
2
2
|
function toRecipientArray(recipient) {
|
|
3
3
|
return Array.isArray(recipient) ? recipient : [recipient];
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* A caller's recipient, in the ergonomic forms the SDK accepts: an address string, an object with
|
|
7
|
+
* the declared address, a `{ id }` reference to a contact, or a listed contact that carries an
|
|
8
|
+
* address and its own id and profile fields.
|
|
9
|
+
*/
|
|
5
10
|
function normalizeMessageRecipient(recipient) {
|
|
6
11
|
if (typeof recipient === "string") return { email: recipient };
|
|
7
|
-
|
|
12
|
+
const { contactId, email, phone, name, displayName } = recipient;
|
|
13
|
+
if (contactId !== void 0) return recipient;
|
|
14
|
+
if (email !== void 0 || phone !== void 0) return {
|
|
15
|
+
...email === void 0 ? {} : { email },
|
|
16
|
+
...phone === void 0 ? {} : { phone },
|
|
17
|
+
...name === void 0 ? {} : { name },
|
|
18
|
+
...displayName === void 0 ? {} : { displayName }
|
|
19
|
+
};
|
|
8
20
|
return { contactId: recipient.id };
|
|
9
21
|
}
|
|
10
22
|
function normalizeRecipients(recipient) {
|
package/dist/package.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
import { type Client, type Config } from "../client/client";
|
|
30
|
-
import { Agents as agents, Analytics as analytics, ApiKeys as apiKeys, Attachments as attachments, Brands as brands, Campaigns as campaigns, ContactGroups as contactGroups, ContactEvents as contactEvents, Contacts as contacts, Conversations as conversations, CustomFields as customFields, Email as email, ExtensionInstallations as extensionInstallations, Extensions as extensions, Events as events, Feedback as feedback, Journeys as journeys, Mailboxes as mailboxes, Media as media, Messages as messages, Namespaces as namespaces, Operations as operations, Organizations as organizations, ScheduledMessages as scheduledMessages, Subscriptions as subscriptions, Templates as templates, Topics as topics, TopicForms as topicForms, Newsletters as newsletters, Webhooks as webhooks, Whoami as whoami } from "../client/sdk.gen";
|
|
30
|
+
import { Agents as agents, Analytics as analytics, ApiKeys as apiKeys, Attachments as attachments, Brands as brands, Campaigns as campaigns, ContactGroups as contactGroups, ContactEvents as contactEvents, Contacts as contacts, Conversations as conversations, CustomFields as customFields, Email as email, ExtensionInstallations as extensionInstallations, Extensions as extensions, Events as events, Feedback as feedback, Journeys as journeys, Mailboxes as mailboxes, Media as media, Messages as messages, Namespaces as namespaces, Operations as operations, Organizations as organizations, Policies as policies, ScheduledMessages as scheduledMessages, Subscriptions as subscriptions, Templates as templates, Topics as topics, TopicForms as topicForms, Newsletters as newsletters, Webhooks as webhooks, Whoami as whoami } from "../client/sdk.gen";
|
|
31
31
|
import type { MessagesSendData } from "../client/types.gen";
|
|
32
32
|
import { MailboxEventStream, type MailboxEventStreamOptions } from "../mailbox-events";
|
|
33
33
|
import { type RequestPolicy } from "./request";
|
|
@@ -51,7 +51,7 @@ export type SamvaClientConfig = (SamvaClientConfigBase & {
|
|
|
51
51
|
apiKey?: never;
|
|
52
52
|
});
|
|
53
53
|
type MessageSendBody = MessagesSendData["body"];
|
|
54
|
-
type MessageRecipient =
|
|
54
|
+
type MessageRecipient = EmailMessageSendBody["to"][number];
|
|
55
55
|
type MessageSendRequestOptions<ThrowOnError extends boolean = false> = Omit<NonNullable<Parameters<typeof messages.send<ThrowOnError>>[1]>, "client">;
|
|
56
56
|
type MessageSendOptions<ThrowOnError extends boolean = false> = MessageSendRequestOptions<ThrowOnError> & {
|
|
57
57
|
/** Sent as the `idempotency-key` header; defaults to a fresh UUID per call. */
|
|
@@ -143,6 +143,7 @@ export interface SamvaRawClient {
|
|
|
143
143
|
readonly operations: typeof operations;
|
|
144
144
|
readonly apiKeys: typeof apiKeys;
|
|
145
145
|
readonly organizations: typeof organizations;
|
|
146
|
+
readonly policies: typeof policies;
|
|
146
147
|
readonly attachments: typeof attachments;
|
|
147
148
|
readonly contactGroups: typeof contactGroups;
|
|
148
149
|
readonly customFields: typeof customFields;
|
|
@@ -185,6 +186,7 @@ export interface SamvaClient {
|
|
|
185
186
|
readonly operations: DirectService<typeof operations>;
|
|
186
187
|
readonly apiKeys: DirectService<typeof apiKeys>;
|
|
187
188
|
readonly organizations: DirectService<typeof organizations>;
|
|
189
|
+
readonly policies: DirectService<typeof policies>;
|
|
188
190
|
readonly attachments: DirectService<typeof attachments>;
|
|
189
191
|
readonly contactGroups: DirectService<typeof contactGroups>;
|
|
190
192
|
readonly customFields: DirectService<typeof customFields>;
|
package/dist/promises/client.js
CHANGED
|
@@ -2,9 +2,9 @@ import { CLIENT_ATTRIBUTION_HEADER, clientAttribution } from "../client-attribut
|
|
|
2
2
|
import { mergeHeaders } from "../client/client/utils.gen.js";
|
|
3
3
|
import { createClient as createClient$1 } from "../client/client/client.gen.js";
|
|
4
4
|
import { SamvaOperations } from "../effect/generated-metadata.js";
|
|
5
|
-
import { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateSourceError, UnauthorizedError, ValidationError, fromApiError } from "./errors.gen.js";
|
|
5
|
+
import { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppServiceWindowClosedError, fromApiError } from "./errors.gen.js";
|
|
6
6
|
import { configureRequests } from "./request.js";
|
|
7
|
-
import { Agents, Analytics, ApiKeys, Attachments, Brands, Campaigns, ContactEvents, ContactGroups, Contacts, Conversations, CustomFields, Email, Events, ExtensionInstallations, Extensions, Feedback, Journeys, Mailboxes, Media, Messages, Namespaces, Newsletters, Operations, Organizations, ScheduledMessages, Subscriptions, Templates, TopicForms, Topics, Webhooks, Whoami } from "../client/sdk.gen.js";
|
|
7
|
+
import { Agents, Analytics, ApiKeys, Attachments, Brands, Campaigns, ContactEvents, ContactGroups, Contacts, Conversations, CustomFields, Email, Events, ExtensionInstallations, Extensions, Feedback, Journeys, Mailboxes, Media, Messages, Namespaces, Newsletters, Operations, Organizations, Policies, ScheduledMessages, Subscriptions, Templates, TopicForms, Topics, Webhooks, Whoami } from "../client/sdk.gen.js";
|
|
8
8
|
import { MediaUploadError, mediaCreateBody, planInlineUploads, withUploadedAttachments } from "../inline-attachments.js";
|
|
9
9
|
import { MailboxEventStream } from "../mailbox-events.js";
|
|
10
10
|
import { buildEmailSendPayload, buildMessagesSendPayload, replyToEmailsPayload } from "../normalize.js";
|
|
@@ -256,6 +256,7 @@ function makeClient(config) {
|
|
|
256
256
|
operations: createBoundService(Operations, clientInstance),
|
|
257
257
|
apiKeys: createBoundService(ApiKeys, clientInstance),
|
|
258
258
|
organizations: createBoundService(Organizations, clientInstance),
|
|
259
|
+
policies: createBoundService(Policies, clientInstance),
|
|
259
260
|
attachments: createBoundService(Attachments, clientInstance),
|
|
260
261
|
contactGroups: createBoundService(ContactGroups, clientInstance),
|
|
261
262
|
customFields: createBoundService(CustomFields, clientInstance),
|
|
@@ -296,6 +297,7 @@ function makeClient(config) {
|
|
|
296
297
|
operations: createDirectService(raw.operations),
|
|
297
298
|
apiKeys: createDirectService(raw.apiKeys),
|
|
298
299
|
organizations: createDirectService(raw.organizations),
|
|
300
|
+
policies: createDirectService(raw.policies),
|
|
299
301
|
attachments: createDirectService(raw.attachments),
|
|
300
302
|
contactGroups: createDirectService(raw.contactGroups),
|
|
301
303
|
customFields: createDirectService(raw.customFields),
|
|
@@ -319,6 +321,6 @@ function makeClient(config) {
|
|
|
319
321
|
}));
|
|
320
322
|
return result;
|
|
321
323
|
}
|
|
322
|
-
export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateSourceError, UnauthorizedError, ValidationError, clientWithIdempotency, createBoundClient, createClient, fromApiError };
|
|
324
|
+
export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppServiceWindowClosedError, clientWithIdempotency, createBoundClient, createClient, fromApiError };
|
|
323
325
|
|
|
324
326
|
//# sourceMappingURL=client.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as Wire from "../client/types.gen";
|
|
2
|
-
export type SamvaApiErrorTag = "AnalyticsQueryError" | "BillingProviderError" | "BrandAddressRequiredError" | "CampaignFooterRequiredError" | "ConflictError" | "DeliveryUnavailableError" | "EmailChannelError" | "ExternalServiceError" | "FlagDisabledError" | "ForbiddenError" | "FromAddressRequiredError" | "GatewayTimeoutError" | "InternalError" | "MailboxSendConflictError" | "MailboxSendRefusedError" | "OnboardingReviewRequiredError" | "PaymentRequiredError" | "RateLimitedError" | "ResourceNotFoundError" | "SenderNotReadyError" | "ServiceUnavailableError" | "TemplateSourceError" | "UnauthorizedError" | "ValidationError";
|
|
2
|
+
export type SamvaApiErrorTag = "AnalyticsQueryError" | "BillingProviderError" | "BrandAddressRequiredError" | "CampaignFooterRequiredError" | "ConflictError" | "DeliveryUnavailableError" | "EmailChannelError" | "ExternalServiceError" | "FlagDisabledError" | "ForbiddenError" | "FromAddressRequiredError" | "GatewayTimeoutError" | "InternalError" | "MailboxSendConflictError" | "MailboxSendRefusedError" | "MalformedRequestError" | "OnboardingReviewRequiredError" | "PaymentRequiredError" | "RateLimitedError" | "ResourceNotFoundError" | "SenderNotReadyError" | "ServiceUnavailableError" | "TemplateInUseError" | "TemplateSourceError" | "UnauthorizedError" | "ValidationError" | "WhatsAppServiceWindowClosedError";
|
|
3
3
|
export interface SamvaApiErrorContext {
|
|
4
4
|
readonly request?: Request | undefined;
|
|
5
5
|
readonly response?: Response | undefined;
|
|
@@ -167,6 +167,16 @@ export declare class MailboxSendRefusedError extends SamvaApiError<"MailboxSendR
|
|
|
167
167
|
readonly "receipt": Wire.MailboxSendReceipt;
|
|
168
168
|
constructor(payload: Omit<MailboxSendRefusedErrorPayload, "_tag">, context?: SamvaApiErrorContext);
|
|
169
169
|
}
|
|
170
|
+
type MalformedRequestErrorPayload = {
|
|
171
|
+
readonly _tag: "MalformedRequestError";
|
|
172
|
+
readonly fields: Record<string, Array<string>>;
|
|
173
|
+
readonly message: string;
|
|
174
|
+
};
|
|
175
|
+
export declare class MalformedRequestError extends SamvaApiError<"MalformedRequestError"> {
|
|
176
|
+
readonly _tag: "MalformedRequestError";
|
|
177
|
+
readonly "fields": Record<string, Array<string>>;
|
|
178
|
+
constructor(payload: Omit<MalformedRequestErrorPayload, "_tag">, context?: SamvaApiErrorContext);
|
|
179
|
+
}
|
|
170
180
|
type OnboardingReviewRequiredErrorPayload = {
|
|
171
181
|
readonly _tag: "OnboardingReviewRequiredError";
|
|
172
182
|
readonly code: "review_required" | "review_in_progress" | "information_required" | "review_rejected" | "identity_review_required" | "identity_review_rejected" | "identity_changed";
|
|
@@ -243,6 +253,22 @@ export declare class ServiceUnavailableError extends SamvaApiError<"ServiceUnava
|
|
|
243
253
|
readonly "retryAfterSeconds": number;
|
|
244
254
|
constructor(payload: Omit<ServiceUnavailableErrorPayload, "_tag">, context?: SamvaApiErrorContext);
|
|
245
255
|
}
|
|
256
|
+
type TemplateInUseErrorPayload = {
|
|
257
|
+
readonly _tag: "TemplateInUseError";
|
|
258
|
+
readonly message: string;
|
|
259
|
+
readonly references: Array<{
|
|
260
|
+
readonly kind: string;
|
|
261
|
+
readonly id: string;
|
|
262
|
+
}>;
|
|
263
|
+
};
|
|
264
|
+
export declare class TemplateInUseError extends SamvaApiError<"TemplateInUseError"> {
|
|
265
|
+
readonly _tag: "TemplateInUseError";
|
|
266
|
+
readonly "references": Array<{
|
|
267
|
+
readonly kind: string;
|
|
268
|
+
readonly id: string;
|
|
269
|
+
}>;
|
|
270
|
+
constructor(payload: Omit<TemplateInUseErrorPayload, "_tag">, context?: SamvaApiErrorContext);
|
|
271
|
+
}
|
|
246
272
|
type TemplateSourceErrorPayload = {
|
|
247
273
|
readonly _tag: "TemplateSourceError";
|
|
248
274
|
readonly diagnostics: Array<{
|
|
@@ -317,7 +343,17 @@ export declare class ValidationError extends SamvaApiError<"ValidationError"> {
|
|
|
317
343
|
readonly "fields"?: Record<string, Array<string>> | null;
|
|
318
344
|
constructor(payload: Omit<ValidationErrorPayload, "_tag">, context?: SamvaApiErrorContext);
|
|
319
345
|
}
|
|
320
|
-
|
|
346
|
+
type WhatsAppServiceWindowClosedErrorPayload = {
|
|
347
|
+
readonly _tag: "WhatsAppServiceWindowClosedError";
|
|
348
|
+
readonly closedAt: string | null;
|
|
349
|
+
readonly message: string;
|
|
350
|
+
};
|
|
351
|
+
export declare class WhatsAppServiceWindowClosedError extends SamvaApiError<"WhatsAppServiceWindowClosedError"> {
|
|
352
|
+
readonly _tag: "WhatsAppServiceWindowClosedError";
|
|
353
|
+
readonly "closedAt": string | null;
|
|
354
|
+
constructor(payload: Omit<WhatsAppServiceWindowClosedErrorPayload, "_tag">, context?: SamvaApiErrorContext);
|
|
355
|
+
}
|
|
356
|
+
export type AnySamvaApiError = AnalyticsQueryError | BillingProviderError | BrandAddressRequiredError | CampaignFooterRequiredError | ConflictError | DeliveryUnavailableError | EmailChannelError | ExternalServiceError | FlagDisabledError | ForbiddenError | FromAddressRequiredError | GatewayTimeoutError | InternalError | MailboxSendConflictError | MailboxSendRefusedError | MalformedRequestError | OnboardingReviewRequiredError | PaymentRequiredError | RateLimitedError | ResourceNotFoundError | SenderNotReadyError | ServiceUnavailableError | TemplateInUseError | TemplateSourceError | UnauthorizedError | ValidationError | WhatsAppServiceWindowClosedError;
|
|
321
357
|
/** Convert a decoded error payload into its generated JavaScript error class. */
|
|
322
358
|
export declare function fromApiError(error: unknown, context?: SamvaApiErrorContext): AnySamvaApiError | SamvaTransportError;
|
|
323
359
|
export {};
|