samva 0.43.3 → 0.45.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 (103) hide show
  1. package/AGENTS.md +3 -0
  2. package/README.md +4 -0
  3. package/dist/client/sdk.gen.d.ts +308 -2
  4. package/dist/client/sdk.gen.js +937 -2
  5. package/dist/client/types.gen.d.ts +2294 -54
  6. package/dist/effect/agents.d.ts +86 -86
  7. package/dist/effect/agents.js +2 -2
  8. package/dist/effect/api-keys.d.ts +36 -36
  9. package/dist/effect/api-keys.js +2 -2
  10. package/dist/effect/attachments.d.ts +3 -3
  11. package/dist/effect/attachments.js +1 -1
  12. package/dist/effect/campaigns.d.ts +250 -250
  13. package/dist/effect/campaigns.js +3 -3
  14. package/dist/effect/categories.d.ts +23 -5
  15. package/dist/effect/categories.js +11 -20
  16. package/dist/effect/contact-groups.d.ts +44 -44
  17. package/dist/effect/contact-groups.js +3 -3
  18. package/dist/effect/contacts.d.ts +3 -3
  19. package/dist/effect/contacts.js +1 -1
  20. package/dist/effect/conversations.d.ts +53 -53
  21. package/dist/effect/conversations.js +1 -1
  22. package/dist/effect/email.d.ts +99 -97
  23. package/dist/effect/email.js +21 -21
  24. package/dist/effect/errors.d.ts +1 -1
  25. package/dist/effect/errors.js +2 -2
  26. package/dist/effect/extension-installations.d.ts +6 -6
  27. package/dist/effect/extension-installations.js +1 -1
  28. package/dist/effect/generated/campaigns.js +2 -2
  29. package/dist/effect/generated/email.d.ts +7 -0
  30. package/dist/effect/generated/email.js +8 -9
  31. package/dist/effect/generated/index.d.ts +9 -1
  32. package/dist/effect/generated/journeys.d.ts +1 -3
  33. package/dist/effect/generated/journeys.js +2 -6
  34. package/dist/effect/generated/mailboxes.d.ts +14 -14
  35. package/dist/effect/generated/mailboxes.js +2 -0
  36. package/dist/effect/generated/messages.d.ts +1 -5
  37. package/dist/effect/generated/messages.js +2 -10
  38. package/dist/effect/generated/newsletter-issues.js +29 -29
  39. package/dist/effect/generated/organizations.js +2 -2
  40. package/dist/effect/generated/scheduled-messages.js +3 -3
  41. package/dist/effect/generated/shared.d.ts +112 -2
  42. package/dist/effect/generated/shared.js +66 -25
  43. package/dist/effect/generated/subscriptions.js +4 -4
  44. package/dist/effect/generated/template-registrations.d.ts +651 -0
  45. package/dist/effect/generated/template-registrations.js +138 -0
  46. package/dist/effect/generated/templates.d.ts +789 -6
  47. package/dist/effect/generated/templates.js +156 -54
  48. package/dist/effect/generated/whats-app-flows.d.ts +1838 -0
  49. package/dist/effect/generated/whats-app-flows.js +338 -0
  50. package/dist/effect/generated/whats-app-setup-links.d.ts +705 -0
  51. package/dist/effect/generated/whats-app-setup-links.js +150 -0
  52. package/dist/effect/generated/whats-app.d.ts +2089 -0
  53. package/dist/effect/generated/whats-app.js +633 -0
  54. package/dist/effect/generated-metadata.d.ts +257 -0
  55. package/dist/effect/generated-metadata.js +223 -48
  56. package/dist/effect/index.d.ts +4 -0
  57. package/dist/effect/index.js +6 -2
  58. package/dist/effect/mailboxes.d.ts +301 -301
  59. package/dist/effect/mailboxes.js +3 -3
  60. package/dist/effect/media.d.ts +4 -4
  61. package/dist/effect/media.js +2 -2
  62. package/dist/effect/messages.d.ts +17 -17
  63. package/dist/effect/messages.js +4 -4
  64. package/dist/effect/namespaces.d.ts +5 -5
  65. package/dist/effect/namespaces.js +1 -1
  66. package/dist/effect/newsletter-issues.d.ts +8 -8
  67. package/dist/effect/newsletter-issues.js +2 -2
  68. package/dist/effect/newsletters.d.ts +3 -3
  69. package/dist/effect/newsletters.js +1 -1
  70. package/dist/effect/organizations.d.ts +10 -10
  71. package/dist/effect/organizations.js +1 -1
  72. package/dist/effect/runtime.d.ts +2 -0
  73. package/dist/effect/runtime.js +2 -1
  74. package/dist/effect/scheduled-messages.d.ts +839 -839
  75. package/dist/effect/scheduled-messages.js +1 -1
  76. package/dist/effect/template-registrations.d.ts +12 -0
  77. package/dist/effect/template-registrations.js +16 -0
  78. package/dist/effect/templates.d.ts +66 -56
  79. package/dist/effect/templates.js +16 -12
  80. package/dist/effect/topic-forms.d.ts +4 -4
  81. package/dist/effect/topic-forms.js +1 -1
  82. package/dist/effect/topics.d.ts +11 -11
  83. package/dist/effect/topics.js +2 -2
  84. package/dist/effect/webhooks.d.ts +18 -18
  85. package/dist/effect/webhooks.js +3 -3
  86. package/dist/effect/whatsapp-flows.d.ts +34 -0
  87. package/dist/effect/whatsapp-flows.js +30 -0
  88. package/dist/effect/whatsapp-setup-links.d.ts +66 -0
  89. package/dist/effect/whatsapp-setup-links.js +18 -0
  90. package/dist/effect/whatsapp.d.ts +51 -0
  91. package/dist/effect/whatsapp.js +34 -0
  92. package/dist/index.js +2 -2
  93. package/dist/mailbox/types.d.ts +2 -1
  94. package/dist/package.js +1 -1
  95. package/dist/promises/client.d.ts +9 -1
  96. package/dist/promises/client.js +11 -3
  97. package/dist/promises/errors.gen.d.ts +38 -2
  98. package/dist/promises/errors.gen.js +160 -3
  99. package/dist/promises/index.js +2 -2
  100. package/dist/promises/types.gen.d.ts +1 -1
  101. package/dist/service-map.d.ts +923 -734
  102. package/dist/service-map.js +288 -233
  103. package/package.json +27 -11
@@ -0,0 +1,18 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { forGroup } from "./internal/operation.js";
3
+ import { WhatsAppSetupLinksGroup } from "./generated/whats-app-setup-links.js";
4
+ // src/effect/whatsapp-setup-links.ts
5
+ var whatsapp_setup_links_exports = /* @__PURE__ */ __exportAll({
6
+ create: () => create,
7
+ get: () => get,
8
+ list: () => list,
9
+ revoke: () => revoke
10
+ });
11
+ const make = /* @__PURE__ */ forGroup(WhatsAppSetupLinksGroup);
12
+ const create = /* @__PURE__ */ make("whatsappSetupLinksCreate");
13
+ const list = /* @__PURE__ */ make("whatsappSetupLinksList");
14
+ const get = /* @__PURE__ */ make("whatsappSetupLinksGet");
15
+ const revoke = /* @__PURE__ */ make("whatsappSetupLinksRevoke");
16
+ export { create, get, list, revoke, whatsapp_setup_links_exports };
17
+
18
+ //# sourceMappingURL=whatsapp-setup-links.js.map
@@ -0,0 +1,51 @@
1
+ export declare const getStats: (input?: {
2
+ readonly startDate?: string | undefined;
3
+ readonly endDate?: string | undefined;
4
+ } | undefined, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"whatsappGetStats">;
5
+ export declare const getTemplateStats: (input?: {
6
+ readonly startDate?: string | undefined;
7
+ readonly endDate?: string | undefined;
8
+ readonly templateId?: string | undefined;
9
+ readonly campaignId?: string | undefined;
10
+ readonly journeyId?: string | undefined;
11
+ } | undefined, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"whatsappGetTemplateStats">;
12
+ export declare const getServiceWindowStatus: (input: {
13
+ readonly customerPhone: string;
14
+ readonly businessPhone: string;
15
+ }, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"whatsappGetServiceWindowStatus">;
16
+ export declare const getServiceWindowBilling: (input: {
17
+ readonly serviceWindowId: string;
18
+ }, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"whatsappGetServiceWindowBilling">;
19
+ export declare const getMediaDownloadUrl: (input: {
20
+ readonly deliveryId: string;
21
+ }, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"whatsappGetMediaDownloadUrl">;
22
+ export declare const listBusinessAccounts: (input?: {
23
+ readonly page?: number | null | undefined;
24
+ readonly limit?: number | null | undefined;
25
+ readonly isActive?: boolean | null | undefined;
26
+ readonly verificationStatus?: "failed" | "pending" | "suspended" | "verified" | undefined;
27
+ readonly namespaceId?: string | undefined;
28
+ } | undefined, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"whatsappListBusinessAccounts">;
29
+ export declare const connectBusinessAccount: (input: {
30
+ readonly code: string | import("effect/Redacted").Redacted<string>;
31
+ readonly wabaId: string;
32
+ readonly phoneNumberId: string;
33
+ readonly namespaceId?: string | null | undefined;
34
+ }, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"whatsappConnectBusinessAccount">;
35
+ export declare const getBusinessAccount: (input: {
36
+ readonly accountId: string;
37
+ }, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"whatsappGetBusinessAccount">;
38
+ export declare const updateBusinessAccount: (input: {
39
+ readonly accountId: string;
40
+ readonly displayName?: string | null | undefined;
41
+ readonly webhookUrl?: string | null | undefined;
42
+ }, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"whatsappUpdateBusinessAccount">;
43
+ export declare const disconnectBusinessAccount: (input: {
44
+ readonly accountId: string;
45
+ }, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"whatsappDisconnectBusinessAccount">;
46
+ export declare const setDefaultBusinessAccount: (input: {
47
+ readonly accountId: string;
48
+ }, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"whatsappSetDefaultBusinessAccount">;
49
+ export declare const syncAccountStatus: (input: {
50
+ readonly accountId: string;
51
+ }, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"whatsappSyncAccountStatus">;
@@ -0,0 +1,34 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { forGroup } from "./internal/operation.js";
3
+ import { WhatsAppGroup } from "./generated/whats-app.js";
4
+ // src/effect/whatsapp.ts
5
+ var whatsapp_exports = /* @__PURE__ */ __exportAll({
6
+ connectBusinessAccount: () => connectBusinessAccount,
7
+ disconnectBusinessAccount: () => disconnectBusinessAccount,
8
+ getBusinessAccount: () => getBusinessAccount,
9
+ getMediaDownloadUrl: () => getMediaDownloadUrl,
10
+ getServiceWindowBilling: () => getServiceWindowBilling,
11
+ getServiceWindowStatus: () => getServiceWindowStatus,
12
+ getStats: () => getStats,
13
+ getTemplateStats: () => getTemplateStats,
14
+ listBusinessAccounts: () => listBusinessAccounts,
15
+ setDefaultBusinessAccount: () => setDefaultBusinessAccount,
16
+ syncAccountStatus: () => syncAccountStatus,
17
+ updateBusinessAccount: () => updateBusinessAccount
18
+ });
19
+ const make = /* @__PURE__ */ forGroup(WhatsAppGroup);
20
+ const getStats = /* @__PURE__ */ make("whatsappGetStats");
21
+ const getTemplateStats = /* @__PURE__ */ make("whatsappGetTemplateStats");
22
+ const getServiceWindowStatus = /* @__PURE__ */ make("whatsappGetServiceWindowStatus");
23
+ const getServiceWindowBilling = /* @__PURE__ */ make("whatsappGetServiceWindowBilling");
24
+ const getMediaDownloadUrl = /* @__PURE__ */ make("whatsappGetMediaDownloadUrl");
25
+ const listBusinessAccounts = /* @__PURE__ */ make("whatsappListBusinessAccounts");
26
+ const connectBusinessAccount = /* @__PURE__ */ make("whatsappConnectBusinessAccount");
27
+ const getBusinessAccount = /* @__PURE__ */ make("whatsappGetBusinessAccount");
28
+ const updateBusinessAccount = /* @__PURE__ */ make("whatsappUpdateBusinessAccount");
29
+ const disconnectBusinessAccount = /* @__PURE__ */ make("whatsappDisconnectBusinessAccount");
30
+ const setDefaultBusinessAccount = /* @__PURE__ */ make("whatsappSetDefaultBusinessAccount");
31
+ const syncAccountStatus = /* @__PURE__ */ make("whatsappSyncAccountStatus");
32
+ export { connectBusinessAccount, disconnectBusinessAccount, getBusinessAccount, getMediaDownloadUrl, getServiceWindowBilling, getServiceWindowStatus, getStats, getTemplateStats, listBusinessAccounts, setDefaultBusinessAccount, syncAccountStatus, updateBusinessAccount, whatsapp_exports };
33
+
34
+ //# sourceMappingURL=whatsapp.js.map
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- 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 "./promises/errors.gen.js";
1
+ import { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, CredentialsError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppChannelError, WhatsAppServiceWindowClosedError, WhatsAppSetupLinkUnavailableError, fromApiError } from "./promises/errors.gen.js";
2
2
  import { MediaUploadError } from "./inline-attachments.js";
3
3
  import { MailboxEventStream, MailboxEventStreamError } from "./mailbox-events.js";
4
4
  import { createClient } from "./promises/client.js";
5
- export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxEventStream, MailboxEventStreamError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, MediaUploadError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppServiceWindowClosedError, createClient, fromApiError };
5
+ export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, CredentialsError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxEventStream, MailboxEventStreamError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, MediaUploadError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppChannelError, WhatsAppServiceWindowClosedError, WhatsAppSetupLinkUnavailableError, createClient, fromApiError };
@@ -1,3 +1,4 @@
1
+ import type { MailboxQuarantinedMessage } from "../client/types.gen";
1
2
  import type { SamvaClient } from "../promises/client";
2
3
  export type ExtensionManifest = {
3
4
  readonly name: string;
@@ -107,7 +108,7 @@ type MailboxEventScope = {
107
108
  readonly mailboxId: string;
108
109
  readonly namespaceId: string | null;
109
110
  };
110
- type QuarantineReason = "spam" | "dmarc" | "virus" | "virus_unscanned" | "phishing" | "fraud" | "prompt_injection";
111
+ type QuarantineReason = MailboxQuarantinedMessage["reason"];
111
112
  export type EventData = {
112
113
  "mailbox.message.received": MailboxEventScope & {
113
114
  readonly message: WebhookMessage;
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.43.3";
2
+ var version = "0.45.0";
3
3
  export { version };
4
4
 
5
5
  //# sourceMappingURL=package.js.map
@@ -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, 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";
30
+ import { Agents as agents, Whatsapp as whatsapp, WhatsappFlows as whatsappFlows, WhatsappSetupLinks as whatsappSetupLinks, TemplateRegistrations as templateRegistrations, 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";
@@ -132,6 +132,10 @@ export interface SamvaRawClient {
132
132
  readonly messages: typeof messages;
133
133
  readonly scheduledMessages: typeof scheduledMessages;
134
134
  readonly brands: typeof brands;
135
+ readonly whatsapp: typeof whatsapp;
136
+ readonly whatsappFlows: typeof whatsappFlows;
137
+ readonly whatsappSetupLinks: typeof whatsappSetupLinks;
138
+ readonly templateRegistrations: typeof templateRegistrations;
135
139
  readonly campaigns: typeof campaigns;
136
140
  readonly email: typeof email;
137
141
  readonly media: typeof media;
@@ -175,6 +179,10 @@ export interface SamvaClient {
175
179
  readonly messages: DirectService<PromiseMessagesTransport>;
176
180
  readonly scheduledMessages: DirectService<typeof scheduledMessages>;
177
181
  readonly brands: DirectService<typeof brands>;
182
+ readonly whatsapp: DirectService<typeof whatsapp>;
183
+ readonly whatsappFlows: DirectService<typeof whatsappFlows>;
184
+ readonly whatsappSetupLinks: DirectService<typeof whatsappSetupLinks>;
185
+ readonly templateRegistrations: DirectService<typeof templateRegistrations>;
178
186
  readonly campaigns: DirectService<typeof campaigns>;
179
187
  readonly email: DirectService<PromiseEmailTransport>;
180
188
  readonly media: DirectService<typeof media>;
@@ -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, MalformedRequestError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppServiceWindowClosedError, fromApiError } from "./errors.gen.js";
5
+ import { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, CredentialsError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppChannelError, WhatsAppServiceWindowClosedError, WhatsAppSetupLinkUnavailableError, 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, Policies, 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, TemplateRegistrations, Templates, TopicForms, Topics, Webhooks, Whatsapp, WhatsappFlows, WhatsappSetupLinks, 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";
@@ -245,6 +245,10 @@ function makeClient(config) {
245
245
  messages: createBoundService(Messages, clientInstance),
246
246
  scheduledMessages: createBoundService(ScheduledMessages, clientInstance),
247
247
  brands: createBoundService(Brands, clientInstance),
248
+ whatsapp: createBoundService(Whatsapp, clientInstance),
249
+ whatsappFlows: createBoundService(WhatsappFlows, clientInstance),
250
+ whatsappSetupLinks: createBoundService(WhatsappSetupLinks, clientInstance),
251
+ templateRegistrations: createBoundService(TemplateRegistrations, clientInstance),
248
252
  campaigns: createBoundService(Campaigns, clientInstance),
249
253
  email: createBoundService(Email, clientInstance),
250
254
  media: createBoundService(Media, clientInstance),
@@ -286,6 +290,10 @@ function makeClient(config) {
286
290
  messages: createDirectService(promiseMessages),
287
291
  scheduledMessages: createDirectService(raw.scheduledMessages),
288
292
  brands: createDirectService(raw.brands),
293
+ whatsapp: createDirectService(raw.whatsapp),
294
+ whatsappFlows: createDirectService(raw.whatsappFlows),
295
+ whatsappSetupLinks: createDirectService(raw.whatsappSetupLinks),
296
+ templateRegistrations: createDirectService(raw.templateRegistrations),
289
297
  campaigns: createDirectService(raw.campaigns),
290
298
  email: createDirectService(promiseEmail),
291
299
  media: createDirectService(raw.media),
@@ -321,6 +329,6 @@ function makeClient(config) {
321
329
  }));
322
330
  return result;
323
331
  }
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 };
332
+ export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, CredentialsError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppChannelError, WhatsAppServiceWindowClosedError, WhatsAppSetupLinkUnavailableError, clientWithIdempotency, createBoundClient, createClient, fromApiError };
325
333
 
326
334
  //# 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" | "MalformedRequestError" | "OnboardingReviewRequiredError" | "PaymentRequiredError" | "RateLimitedError" | "ResourceNotFoundError" | "SenderNotReadyError" | "ServiceUnavailableError" | "TemplateInUseError" | "TemplateSourceError" | "UnauthorizedError" | "ValidationError" | "WhatsAppServiceWindowClosedError";
2
+ export type SamvaApiErrorTag = "AnalyticsQueryError" | "BillingProviderError" | "BrandAddressRequiredError" | "CampaignFooterRequiredError" | "ConflictError" | "CredentialsError" | "DeliveryUnavailableError" | "EmailChannelError" | "ExternalServiceError" | "FlagDisabledError" | "ForbiddenError" | "FromAddressRequiredError" | "GatewayTimeoutError" | "InternalError" | "MailboxSendConflictError" | "MailboxSendRefusedError" | "MalformedRequestError" | "OnboardingReviewRequiredError" | "PaymentRequiredError" | "RateLimitedError" | "ResourceNotFoundError" | "SenderNotReadyError" | "ServiceUnavailableError" | "TemplateInUseError" | "TemplateSourceError" | "UnauthorizedError" | "ValidationError" | "WhatsAppChannelError" | "WhatsAppServiceWindowClosedError" | "WhatsAppSetupLinkUnavailableError";
3
3
  export interface SamvaApiErrorContext {
4
4
  readonly request?: Request | undefined;
5
5
  readonly response?: Response | undefined;
@@ -67,6 +67,16 @@ export declare class ConflictError extends SamvaApiError<"ConflictError"> {
67
67
  readonly "resource": string;
68
68
  constructor(payload: Omit<ConflictErrorPayload, "_tag">, context?: SamvaApiErrorContext);
69
69
  }
70
+ type CredentialsErrorPayload = {
71
+ readonly _tag: "CredentialsError";
72
+ readonly message: string;
73
+ readonly retryable: boolean;
74
+ };
75
+ export declare class CredentialsError extends SamvaApiError<"CredentialsError"> {
76
+ readonly _tag: "CredentialsError";
77
+ readonly "retryable": boolean;
78
+ constructor(payload: Omit<CredentialsErrorPayload, "_tag">, context?: SamvaApiErrorContext);
79
+ }
70
80
  type DeliveryUnavailableErrorPayload = {
71
81
  readonly _tag: "DeliveryUnavailableError";
72
82
  readonly message: string;
@@ -343,6 +353,22 @@ export declare class ValidationError extends SamvaApiError<"ValidationError"> {
343
353
  readonly "fields"?: Record<string, Array<string>> | null;
344
354
  constructor(payload: Omit<ValidationErrorPayload, "_tag">, context?: SamvaApiErrorContext);
345
355
  }
356
+ type WhatsAppChannelErrorPayload = {
357
+ readonly _tag: "WhatsAppChannelError";
358
+ readonly message: string;
359
+ readonly provider: string;
360
+ readonly providerCode?: string | null;
361
+ readonly reason: "transport" | "rejected" | "rate_limited" | "auth" | "unsupported";
362
+ readonly statusCode?: number | null;
363
+ };
364
+ export declare class WhatsAppChannelError extends SamvaApiError<"WhatsAppChannelError"> {
365
+ readonly _tag: "WhatsAppChannelError";
366
+ readonly "provider": string;
367
+ readonly "providerCode"?: string | null;
368
+ readonly "reason": "transport" | "rejected" | "rate_limited" | "auth" | "unsupported";
369
+ readonly "statusCode"?: number | null;
370
+ constructor(payload: Omit<WhatsAppChannelErrorPayload, "_tag">, context?: SamvaApiErrorContext);
371
+ }
346
372
  type WhatsAppServiceWindowClosedErrorPayload = {
347
373
  readonly _tag: "WhatsAppServiceWindowClosedError";
348
374
  readonly closedAt: string | null;
@@ -353,7 +379,17 @@ export declare class WhatsAppServiceWindowClosedError extends SamvaApiError<"Wha
353
379
  readonly "closedAt": string | null;
354
380
  constructor(payload: Omit<WhatsAppServiceWindowClosedErrorPayload, "_tag">, context?: SamvaApiErrorContext);
355
381
  }
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;
382
+ type WhatsAppSetupLinkUnavailableErrorPayload = {
383
+ readonly _tag: "WhatsAppSetupLinkUnavailableError";
384
+ readonly message: string;
385
+ readonly reason: "completed" | "revoked" | "expired";
386
+ };
387
+ export declare class WhatsAppSetupLinkUnavailableError extends SamvaApiError<"WhatsAppSetupLinkUnavailableError"> {
388
+ readonly _tag: "WhatsAppSetupLinkUnavailableError";
389
+ readonly "reason": "completed" | "revoked" | "expired";
390
+ constructor(payload: Omit<WhatsAppSetupLinkUnavailableErrorPayload, "_tag">, context?: SamvaApiErrorContext);
391
+ }
392
+ export type AnySamvaApiError = AnalyticsQueryError | BillingProviderError | BrandAddressRequiredError | CampaignFooterRequiredError | ConflictError | CredentialsError | DeliveryUnavailableError | EmailChannelError | ExternalServiceError | FlagDisabledError | ForbiddenError | FromAddressRequiredError | GatewayTimeoutError | InternalError | MailboxSendConflictError | MailboxSendRefusedError | MalformedRequestError | OnboardingReviewRequiredError | PaymentRequiredError | RateLimitedError | ResourceNotFoundError | SenderNotReadyError | ServiceUnavailableError | TemplateInUseError | TemplateSourceError | UnauthorizedError | ValidationError | WhatsAppChannelError | WhatsAppServiceWindowClosedError | WhatsAppSetupLinkUnavailableError;
357
393
  /** Convert a decoded error payload into its generated JavaScript error class. */
358
394
  export declare function fromApiError(error: unknown, context?: SamvaApiErrorContext): AnySamvaApiError | SamvaTransportError;
359
395
  export {};
@@ -68,6 +68,13 @@ var ConflictError = class extends SamvaApiError {
68
68
  Object.assign(this, payload);
69
69
  }
70
70
  };
71
+ var CredentialsError = class extends SamvaApiError {
72
+ _tag = "CredentialsError";
73
+ constructor(payload, context = {}) {
74
+ super(messageOf("CredentialsError", payload), context);
75
+ Object.assign(this, payload);
76
+ }
77
+ };
71
78
  var DeliveryUnavailableError = class extends SamvaApiError {
72
79
  _tag = "DeliveryUnavailableError";
73
80
  constructor(payload, context = {}) {
@@ -215,6 +222,13 @@ var ValidationError = class extends SamvaApiError {
215
222
  Object.assign(this, payload);
216
223
  }
217
224
  };
225
+ var WhatsAppChannelError = class extends SamvaApiError {
226
+ _tag = "WhatsAppChannelError";
227
+ constructor(payload, context = {}) {
228
+ super(messageOf("WhatsAppChannelError", payload), context);
229
+ Object.assign(this, payload);
230
+ }
231
+ };
218
232
  var WhatsAppServiceWindowClosedError = class extends SamvaApiError {
219
233
  _tag = "WhatsAppServiceWindowClosedError";
220
234
  constructor(payload, context = {}) {
@@ -222,12 +236,20 @@ var WhatsAppServiceWindowClosedError = class extends SamvaApiError {
222
236
  Object.assign(this, payload);
223
237
  }
224
238
  };
239
+ var WhatsAppSetupLinkUnavailableError = class extends SamvaApiError {
240
+ _tag = "WhatsAppSetupLinkUnavailableError";
241
+ constructor(payload, context = {}) {
242
+ super(messageOf("WhatsAppSetupLinkUnavailableError", payload), context);
243
+ Object.assign(this, payload);
244
+ }
245
+ };
225
246
  const constructors = {
226
247
  AnalyticsQueryError,
227
248
  BillingProviderError,
228
249
  BrandAddressRequiredError,
229
250
  CampaignFooterRequiredError,
230
251
  ConflictError,
252
+ CredentialsError,
231
253
  DeliveryUnavailableError,
232
254
  EmailChannelError,
233
255
  ExternalServiceError,
@@ -249,7 +271,9 @@ const constructors = {
249
271
  TemplateSourceError,
250
272
  UnauthorizedError,
251
273
  ValidationError,
252
- WhatsAppServiceWindowClosedError
274
+ WhatsAppChannelError,
275
+ WhatsAppServiceWindowClosedError,
276
+ WhatsAppSetupLinkUnavailableError
253
277
  };
254
278
  const payloadSchemas = {
255
279
  AnalyticsQueryError: {
@@ -327,6 +351,37 @@ const payloadSchemas = {
327
351
  "x-category": ["conflict"],
328
352
  "x-retryable": false
329
353
  },
354
+ CredentialsError: {
355
+ type: "object",
356
+ properties: {
357
+ _tag: {
358
+ type: "string",
359
+ enum: ["CredentialsError"]
360
+ },
361
+ message: { type: "string" },
362
+ retryable: { type: "boolean" }
363
+ },
364
+ required: [
365
+ "_tag",
366
+ "message",
367
+ "retryable"
368
+ ],
369
+ additionalProperties: false,
370
+ "x-retryable": false,
371
+ "x-category-rules": {
372
+ field: "retryable",
373
+ cases: {
374
+ true: {
375
+ categories: ["transient"],
376
+ retryable: true
377
+ },
378
+ false: {
379
+ categories: [],
380
+ retryable: false
381
+ }
382
+ }
383
+ }
384
+ },
330
385
  DeliveryUnavailableError: {
331
386
  type: "object",
332
387
  properties: {
@@ -370,7 +425,29 @@ const payloadSchemas = {
370
425
  "reason",
371
426
  "message"
372
427
  ],
373
- additionalProperties: false
428
+ additionalProperties: false,
429
+ "x-retryable": false,
430
+ "x-category-rules": {
431
+ field: "reason",
432
+ cases: {
433
+ transport: {
434
+ categories: ["transient"],
435
+ retryable: true
436
+ },
437
+ rejected: {
438
+ categories: ["validation"],
439
+ retryable: false
440
+ },
441
+ rate_limited: {
442
+ categories: ["throttling", "transient"],
443
+ retryable: true
444
+ },
445
+ auth: {
446
+ categories: ["auth"],
447
+ retryable: false
448
+ }
449
+ }
450
+ }
374
451
  },
375
452
  ExternalServiceError: {
376
453
  type: "object",
@@ -1793,6 +1870,62 @@ const payloadSchemas = {
1793
1870
  "x-category": ["validation"],
1794
1871
  "x-retryable": false
1795
1872
  },
1873
+ WhatsAppChannelError: {
1874
+ type: "object",
1875
+ properties: {
1876
+ _tag: {
1877
+ type: "string",
1878
+ enum: ["WhatsAppChannelError"]
1879
+ },
1880
+ reason: {
1881
+ type: "string",
1882
+ enum: [
1883
+ "transport",
1884
+ "rejected",
1885
+ "rate_limited",
1886
+ "auth",
1887
+ "unsupported"
1888
+ ]
1889
+ },
1890
+ message: { type: "string" },
1891
+ provider: { type: "string" },
1892
+ providerCode: { anyOf: [{ type: "string" }, { type: "null" }] },
1893
+ statusCode: { anyOf: [{ type: "number" }, { type: "null" }] }
1894
+ },
1895
+ required: [
1896
+ "_tag",
1897
+ "reason",
1898
+ "message",
1899
+ "provider"
1900
+ ],
1901
+ additionalProperties: false,
1902
+ "x-retryable": false,
1903
+ "x-category-rules": {
1904
+ field: "reason",
1905
+ cases: {
1906
+ transport: {
1907
+ categories: ["transient"],
1908
+ retryable: true
1909
+ },
1910
+ rejected: {
1911
+ categories: ["validation"],
1912
+ retryable: false
1913
+ },
1914
+ rate_limited: {
1915
+ categories: ["throttling", "transient"],
1916
+ retryable: true
1917
+ },
1918
+ auth: {
1919
+ categories: ["auth"],
1920
+ retryable: false
1921
+ },
1922
+ unsupported: {
1923
+ categories: [],
1924
+ retryable: false
1925
+ }
1926
+ }
1927
+ }
1928
+ },
1796
1929
  WhatsAppServiceWindowClosedError: {
1797
1930
  type: "object",
1798
1931
  properties: {
@@ -1809,6 +1942,30 @@ const payloadSchemas = {
1809
1942
  "closedAt"
1810
1943
  ],
1811
1944
  additionalProperties: false
1945
+ },
1946
+ WhatsAppSetupLinkUnavailableError: {
1947
+ type: "object",
1948
+ properties: {
1949
+ _tag: {
1950
+ type: "string",
1951
+ enum: ["WhatsAppSetupLinkUnavailableError"]
1952
+ },
1953
+ reason: {
1954
+ type: "string",
1955
+ enum: [
1956
+ "completed",
1957
+ "revoked",
1958
+ "expired"
1959
+ ]
1960
+ },
1961
+ message: { type: "string" }
1962
+ },
1963
+ required: [
1964
+ "_tag",
1965
+ "reason",
1966
+ "message"
1967
+ ],
1968
+ additionalProperties: false
1812
1969
  }
1813
1970
  };
1814
1971
  const isRecord = (value) => typeof value === "object" && value !== null;
@@ -1862,6 +2019,6 @@ function fromApiError(error, context = {}) {
1862
2019
  }
1863
2020
  return new SamvaTransportError(error, context);
1864
2021
  }
1865
- 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, fromApiError };
2022
+ export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, CredentialsError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppChannelError, WhatsAppServiceWindowClosedError, WhatsAppSetupLinkUnavailableError, fromApiError };
1866
2023
 
1867
2024
  //# sourceMappingURL=errors.gen.js.map
@@ -1,5 +1,5 @@
1
- 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";
1
+ import { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, CredentialsError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppChannelError, WhatsAppServiceWindowClosedError, WhatsAppSetupLinkUnavailableError, fromApiError } from "./errors.gen.js";
2
2
  import { MediaUploadError } from "../inline-attachments.js";
3
3
  import { MailboxEventStream, MailboxEventStreamError } from "../mailbox-events.js";
4
4
  import { createClient } from "./client.js";
5
- export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxEventStream, MailboxEventStreamError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, MediaUploadError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppServiceWindowClosedError, createClient, fromApiError };
5
+ export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, CredentialsError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MailboxEventStream, MailboxEventStreamError, MailboxSendConflictError, MailboxSendRefusedError, MalformedRequestError, MediaUploadError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, SenderNotReadyError, ServiceUnavailableError, TemplateInUseError, TemplateSourceError, UnauthorizedError, ValidationError, WhatsAppChannelError, WhatsAppServiceWindowClosedError, WhatsAppSetupLinkUnavailableError, createClient, fromApiError };