samva 0.5.0 → 0.7.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 (65) hide show
  1. package/AGENTS.md +3 -2
  2. package/README.md +14 -4
  3. package/dist/{categories-B9Nw2v_F.js → categories-DvsHUJtX.js} +32 -8
  4. package/dist/client/sdk.gen.d.ts +493 -88
  5. package/dist/client/types.gen.d.ts +3136 -416
  6. package/dist/{client-B7gEkvEq.js → client-5O8KsY5Z.js} +2638 -902
  7. package/dist/{client-attribution-B2yJBXdZ.js → client-attribution-27MNycCV.js} +2 -2
  8. package/dist/effect/analytics.d.ts +66 -0
  9. package/dist/effect/analytics.js +21 -0
  10. package/dist/effect/api-keys.d.ts +198 -34
  11. package/dist/effect/api-keys.js +1 -1
  12. package/dist/effect/attachments.d.ts +53 -0
  13. package/dist/effect/attachments.js +17 -0
  14. package/dist/effect/brands.d.ts +212 -0
  15. package/dist/effect/brands.js +24 -0
  16. package/dist/effect/campaigns.d.ts +36 -18
  17. package/dist/effect/campaigns.js +1 -1
  18. package/dist/effect/categories.d.ts +3 -3
  19. package/dist/effect/categories.js +1 -1
  20. package/dist/effect/client.js +1 -1
  21. package/dist/effect/contact-groups.d.ts +375 -0
  22. package/dist/effect/contact-groups.js +29 -0
  23. package/dist/effect/contacts.d.ts +35 -19
  24. package/dist/effect/contacts.js +1 -1
  25. package/dist/effect/conversations.d.ts +188 -47
  26. package/dist/effect/conversations.js +1 -1
  27. package/dist/effect/custom-fields.d.ts +111 -0
  28. package/dist/effect/custom-fields.js +17 -0
  29. package/dist/effect/email.d.ts +268 -121
  30. package/dist/effect/email.js +2 -2
  31. package/dist/effect/generated-metadata.d.ts +20 -4
  32. package/dist/effect/generated.d.ts +13934 -7968
  33. package/dist/effect/index.d.ts +7 -2
  34. package/dist/effect/index.js +9 -4
  35. package/dist/effect/internal/operation.d.ts +121 -27
  36. package/dist/effect/media.d.ts +5 -5
  37. package/dist/effect/media.js +1 -1
  38. package/dist/effect/messages.d.ts +319 -73
  39. package/dist/effect/messages.js +1 -1
  40. package/dist/effect/operations.d.ts +6 -6
  41. package/dist/effect/operations.js +1 -1
  42. package/dist/effect/organizations.d.ts +7 -374
  43. package/dist/effect/organizations.js +2 -4
  44. package/dist/effect/retry.js +1 -1
  45. package/dist/effect/scheduled-messages.d.ts +7 -7
  46. package/dist/effect/scheduled-messages.js +1 -1
  47. package/dist/effect/templates.d.ts +263 -305
  48. package/dist/effect/templates.js +7 -5
  49. package/dist/effect/unsubscribe-groups.d.ts +161 -0
  50. package/dist/effect/unsubscribe-groups.js +25 -0
  51. package/dist/effect/webhooks.d.ts +18 -18
  52. package/dist/effect/webhooks.js +2 -2
  53. package/dist/index.js +2 -2
  54. package/dist/{normalize-BiIJnycv.js → normalize-B79uJIeb.js} +13 -14
  55. package/dist/normalize.d.ts +3 -7
  56. package/dist/{operation-B4FjN6wq.js → operation-Cb5V9FJ7.js} +123 -11
  57. package/dist/promises/errors.gen.d.ts +50 -43
  58. package/dist/promises/index.d.ts +20 -6
  59. package/dist/promises/index.js +2 -2
  60. package/dist/promises/types.gen.d.ts +1 -1
  61. package/dist/{promises-CP_nxUus.js → promises-C2yyw-pf.js} +1582 -368
  62. package/dist/service-map.d.ts +189 -12
  63. package/package.json +32 -12
  64. package/dist/effect/design.d.ts +0 -209
  65. package/dist/effect/design.js +0 -13
@@ -1,12 +1,28 @@
1
- import { n as buildMessagesSendPayload, r as replyToEmailsPayload, t as buildEmailSendPayload } from "./normalize-BiIJnycv.js";
2
- import { _ as SamvaApi, t as Service } from "./client-B7gEkvEq.js";
1
+ import { n as buildMessagesSendPayload, r as replyToEmailsPayload, t as buildEmailSendPayload } from "./normalize-B79uJIeb.js";
2
+ import { t as Service, w as SamvaApi } from "./client-5O8KsY5Z.js";
3
3
  import { generateIdempotencyKey, withRetry } from "./effect/retry.js";
4
4
  import { Effect, Option, Predicate, Stream } from "effect";
5
5
  //#region src/service-map.ts
6
6
  /** How each generated Effect operation is adapted to the Promise facade's direct input shape. */
7
7
  const SDK_OPERATION_CALLS = {
8
- designGet: { kind: "none" },
9
- designUpdate: { kind: "payload" },
8
+ brandsList: { kind: "none" },
9
+ brandsCreate: { kind: "payload" },
10
+ brandsGet: {
11
+ kind: "path",
12
+ paths: ["slug"]
13
+ },
14
+ brandsUpdate: {
15
+ kind: "pathPayload",
16
+ paths: ["slug"]
17
+ },
18
+ brandsRemove: {
19
+ kind: "path",
20
+ paths: ["slug"]
21
+ },
22
+ brandsSetDefault: {
23
+ kind: "path",
24
+ paths: ["slug"]
25
+ },
10
26
  operationsList: { kind: "params" },
11
27
  operationsGet: {
12
28
  kind: "path",
@@ -338,7 +354,10 @@ const SDK_OPERATION_CALLS = {
338
354
  },
339
355
  templatesList: { kind: "params" },
340
356
  templatesCreate: { kind: "payload" },
341
- templatesListDashboard: { kind: "params" },
357
+ templatesAddEntry: {
358
+ kind: "pathPayload",
359
+ paths: ["projectId"]
360
+ },
342
361
  templatesListFamilies: { kind: "params" },
343
362
  templatesCreateFamily: { kind: "payload" },
344
363
  templatesGetFamily: {
@@ -393,6 +412,10 @@ const SDK_OPERATION_CALLS = {
393
412
  kind: "pathPayload",
394
413
  paths: ["id"]
395
414
  },
415
+ templatesPutWorkspaceAsset: {
416
+ kind: "pathPayload",
417
+ paths: ["id"]
418
+ },
396
419
  templatesResolveWorkspaceConflict: {
397
420
  kind: "pathPayload",
398
421
  paths: ["id"]
@@ -483,7 +506,6 @@ const SDK_OPERATION_CALLS = {
483
506
  kind: "path",
484
507
  paths: ["webhookId"]
485
508
  },
486
- organizationsBootstrap: { kind: "payload" },
487
509
  organizationsCreate: { kind: "payload" },
488
510
  organizationsGet: { kind: "none" },
489
511
  organizationsUpdate: { kind: "payload" },
@@ -518,7 +540,90 @@ const SDK_OPERATION_CALLS = {
518
540
  apiKeysGetActivity: {
519
541
  kind: "pathParams",
520
542
  paths: ["id"]
521
- }
543
+ },
544
+ attachmentsList: { kind: "params" },
545
+ attachmentsGetById: {
546
+ kind: "path",
547
+ paths: ["id"]
548
+ },
549
+ attachmentsRemove: {
550
+ kind: "path",
551
+ paths: ["id"]
552
+ },
553
+ attachmentsDownloadUrl: {
554
+ kind: "pathParams",
555
+ paths: ["id"]
556
+ },
557
+ contactGroupsList: { kind: "params" },
558
+ contactGroupsCreate: { kind: "payload" },
559
+ contactGroupsGetById: {
560
+ kind: "path",
561
+ paths: ["id"]
562
+ },
563
+ contactGroupsUpdate: {
564
+ kind: "pathPayload",
565
+ paths: ["id"]
566
+ },
567
+ contactGroupsRemove: {
568
+ kind: "path",
569
+ paths: ["id"]
570
+ },
571
+ contactGroupsPreview: { kind: "payload" },
572
+ contactGroupsEvaluateDynamic: {
573
+ kind: "path",
574
+ paths: ["groupId"]
575
+ },
576
+ contactGroupsGetMembers: {
577
+ kind: "pathParams",
578
+ paths: ["groupId"]
579
+ },
580
+ contactGroupsAddMembers: {
581
+ kind: "pathPayload",
582
+ paths: ["groupId"]
583
+ },
584
+ contactGroupsRemoveMembers: {
585
+ kind: "pathPayload",
586
+ paths: ["groupId"]
587
+ },
588
+ customFieldsList: { kind: "params" },
589
+ customFieldsCreate: { kind: "payload" },
590
+ customFieldsUpdate: {
591
+ kind: "pathPayload",
592
+ paths: ["id"]
593
+ },
594
+ customFieldsRemove: {
595
+ kind: "path",
596
+ paths: ["id"]
597
+ },
598
+ unsubscribeList: { kind: "params" },
599
+ unsubscribeCreate: { kind: "payload" },
600
+ unsubscribeUpdate: {
601
+ kind: "pathPayload",
602
+ paths: ["id"]
603
+ },
604
+ unsubscribeRemove: {
605
+ kind: "path",
606
+ paths: ["id"]
607
+ },
608
+ unsubscribeListMembers: {
609
+ kind: "pathParams",
610
+ paths: ["groupId"]
611
+ },
612
+ unsubscribeAddEmails: {
613
+ kind: "pathPayload",
614
+ paths: ["groupId"]
615
+ },
616
+ unsubscribeRemoveEmails: {
617
+ kind: "pathPayload",
618
+ paths: ["groupId"]
619
+ },
620
+ unsubscribeCheckSubscription: { kind: "params" },
621
+ analyticsGetStats: { kind: "params" },
622
+ analyticsGetChannelStats: { kind: "params" },
623
+ analyticsGetTopContacts: { kind: "params" },
624
+ analyticsGetHourlyDistribution: { kind: "params" },
625
+ analyticsGetDeliveryMetrics: { kind: "params" },
626
+ analyticsExportData: { kind: "payload" }
522
627
  };
523
628
  //#endregion
524
629
  //#region src/effect/pagination.ts
@@ -586,11 +691,15 @@ const readOperations = () => {
586
691
  };
587
692
  const READ_OPERATIONS = readOperations();
588
693
  const MODULE_NAMES = {
694
+ analytics: "Analytics",
589
695
  apiKeys: "ApiKeys",
696
+ attachments: "Attachments",
697
+ brands: "Brands",
590
698
  campaigns: "Campaigns",
699
+ contactGroups: "ContactGroups",
591
700
  contacts: "Contacts",
592
701
  conversations: "Conversations",
593
- design: "Design",
702
+ customFields: "CustomFields",
594
703
  email: "Email",
595
704
  media: "Media",
596
705
  messages: "Messages",
@@ -598,6 +707,7 @@ const MODULE_NAMES = {
598
707
  organizations: "Organizations",
599
708
  scheduledMessages: "ScheduledMessages",
600
709
  templates: "Templates",
710
+ unsubscribe: "UnsubscribeGroups",
601
711
  webhooks: "Webhooks"
602
712
  };
603
713
  const traceName = (operationName) => {
@@ -646,10 +756,12 @@ const adapt = (operationName, rawCall, input) => {
646
756
  [pathDescriptor.kind === "pathParams" ? "query" : "payload"]: remainingInput
647
757
  });
648
758
  };
759
+ const isPageEnvelope = (value) => Predicate.isObject(value) && Array.isArray(value.items) && Predicate.isObject(value.pagination) && typeof value.pagination.page === "number" && typeof value.pagination.limit === "number" && typeof value.pagination.total === "number" && typeof value.pagination.totalPages === "number";
649
760
  const make = (operationName) => {
650
- const operation = Effect.fn(traceName(operationName))((input) => Effect.flatMap(Service, (client) => adapt(operationName, rawOperation(client, operationName), input)));
761
+ const call = Effect.fn(traceName(operationName))((input) => Effect.flatMap(Service, (client) => adapt(operationName, rawOperation(client, operationName), input)));
762
+ const operation = call;
651
763
  if (PAGINATED_OPERATIONS.has(operationName)) {
652
- const list = operation;
764
+ const list = (input) => Effect.filterOrElse(call(input), isPageEnvelope, () => Effect.die(/* @__PURE__ */ new Error(`${operationName} did not return a page envelope`)));
653
765
  Object.assign(operation, {
654
766
  pages: (input) => streamPages(list, input ?? {}),
655
767
  items: (input) => streamItems(list, input ?? {})
@@ -686,4 +798,4 @@ const addEmailSender = Effect.fn("Email.addSender")(function* (input, options) {
686
798
  //#endregion
687
799
  export { sendMessage as i, make as n, sendEmail as r, addEmailSender as t };
688
800
 
689
- //# sourceMappingURL=operation-B4FjN6wq.js.map
801
+ //# sourceMappingURL=operation-Cb5V9FJ7.js.map
@@ -1,4 +1,4 @@
1
- export type SamvaApiErrorTag = "BillingProviderError" | "ConflictError" | "EmailChannelError" | "ExternalServiceError" | "FlagDisabledError" | "ForbiddenError" | "InternalError" | "OnboardingReviewRequiredError" | "PaymentRequiredError" | "RateLimitedError" | "ResourceNotFoundError" | "UnauthorizedError" | "ValidationError" | "WebhookEnqueueError";
1
+ export type SamvaApiErrorTag = "AnalyticsQueryError" | "BillingProviderError" | "BrandAddressRequiredError" | "CampaignFooterRequiredError" | "ConflictError" | "DeliveryUnavailableError" | "EmailChannelError" | "ExternalServiceError" | "FlagDisabledError" | "ForbiddenError" | "GatewayTimeoutError" | "InternalError" | "OnboardingReviewRequiredError" | "PaymentRequiredError" | "RateLimitedError" | "ResourceNotFoundError" | "UnauthorizedError" | "ValidationError";
2
2
  export interface SamvaApiErrorContext {
3
3
  readonly request?: Request | undefined;
4
4
  readonly response?: Response | undefined;
@@ -20,40 +20,70 @@ export declare class SamvaTransportError extends Error {
20
20
  readonly cause: unknown;
21
21
  constructor(cause: unknown, context?: SamvaApiErrorContext);
22
22
  }
23
+ type AnalyticsQueryErrorPayload = {
24
+ readonly _tag: "AnalyticsQueryError";
25
+ readonly message: string;
26
+ };
27
+ export declare class AnalyticsQueryError extends SamvaApiError<"AnalyticsQueryError"> {
28
+ readonly _tag: "AnalyticsQueryError";
29
+ constructor(payload: Omit<AnalyticsQueryErrorPayload, "_tag">, context?: SamvaApiErrorContext);
30
+ }
23
31
  type BillingProviderErrorPayload = {
24
32
  readonly _tag: "BillingProviderError";
25
33
  readonly message: string;
26
- readonly operation: string;
27
34
  };
28
35
  export declare class BillingProviderError extends SamvaApiError<"BillingProviderError"> {
29
36
  readonly _tag: "BillingProviderError";
30
- readonly "operation": string;
31
37
  constructor(payload: Omit<BillingProviderErrorPayload, "_tag">, context?: SamvaApiErrorContext);
32
38
  }
39
+ type BrandAddressRequiredErrorPayload = {
40
+ readonly _tag: "BrandAddressRequiredError";
41
+ readonly brand: string | null;
42
+ readonly message: string;
43
+ };
44
+ export declare class BrandAddressRequiredError extends SamvaApiError<"BrandAddressRequiredError"> {
45
+ readonly _tag: "BrandAddressRequiredError";
46
+ readonly "brand": string | null;
47
+ constructor(payload: Omit<BrandAddressRequiredErrorPayload, "_tag">, context?: SamvaApiErrorContext);
48
+ }
49
+ type CampaignFooterRequiredErrorPayload = {
50
+ readonly _tag: "CampaignFooterRequiredError";
51
+ readonly message: string;
52
+ };
53
+ export declare class CampaignFooterRequiredError extends SamvaApiError<"CampaignFooterRequiredError"> {
54
+ readonly _tag: "CampaignFooterRequiredError";
55
+ constructor(payload: Omit<CampaignFooterRequiredErrorPayload, "_tag">, context?: SamvaApiErrorContext);
56
+ }
33
57
  type ConflictErrorPayload = {
34
58
  readonly _tag: "ConflictError";
35
59
  readonly id?: string | null;
36
60
  readonly message: string;
37
- readonly operation: string;
38
61
  readonly resource: string;
39
62
  };
40
63
  export declare class ConflictError extends SamvaApiError<"ConflictError"> {
41
64
  readonly _tag: "ConflictError";
42
65
  readonly "id"?: string | null;
43
- readonly "operation": string;
44
66
  readonly "resource": string;
45
67
  constructor(payload: Omit<ConflictErrorPayload, "_tag">, context?: SamvaApiErrorContext);
46
68
  }
69
+ type DeliveryUnavailableErrorPayload = {
70
+ readonly _tag: "DeliveryUnavailableError";
71
+ readonly message: string;
72
+ readonly retryAfterSeconds: number;
73
+ };
74
+ export declare class DeliveryUnavailableError extends SamvaApiError<"DeliveryUnavailableError"> {
75
+ readonly _tag: "DeliveryUnavailableError";
76
+ readonly "retryAfterSeconds": number;
77
+ constructor(payload: Omit<DeliveryUnavailableErrorPayload, "_tag">, context?: SamvaApiErrorContext);
78
+ }
47
79
  type EmailChannelErrorPayload = {
48
80
  readonly _tag: "EmailChannelError";
49
81
  readonly message: string;
50
- readonly operation: string;
51
82
  readonly reason: "transport" | "rejected" | "rate_limited" | "auth";
52
83
  readonly statusCode?: number | null;
53
84
  };
54
85
  export declare class EmailChannelError extends SamvaApiError<"EmailChannelError"> {
55
86
  readonly _tag: "EmailChannelError";
56
- readonly "operation": string;
57
87
  readonly "reason": "transport" | "rejected" | "rate_limited" | "auth";
58
88
  readonly "statusCode"?: number | null;
59
89
  constructor(payload: Omit<EmailChannelErrorPayload, "_tag">, context?: SamvaApiErrorContext);
@@ -61,60 +91,60 @@ export declare class EmailChannelError extends SamvaApiError<"EmailChannelError"
61
91
  type ExternalServiceErrorPayload = {
62
92
  readonly _tag: "ExternalServiceError";
63
93
  readonly message: string;
64
- readonly operation: string;
65
94
  };
66
95
  export declare class ExternalServiceError extends SamvaApiError<"ExternalServiceError"> {
67
96
  readonly _tag: "ExternalServiceError";
68
- readonly "operation": string;
69
97
  constructor(payload: Omit<ExternalServiceErrorPayload, "_tag">, context?: SamvaApiErrorContext);
70
98
  }
71
99
  type FlagDisabledErrorPayload = {
72
100
  readonly _tag: "FlagDisabledError";
73
101
  readonly flag: string;
74
- readonly operation: string;
75
102
  };
76
103
  export declare class FlagDisabledError extends SamvaApiError<"FlagDisabledError"> {
77
104
  readonly _tag: "FlagDisabledError";
78
105
  readonly "flag": string;
79
- readonly "operation": string;
80
106
  constructor(payload: Omit<FlagDisabledErrorPayload, "_tag">, context?: SamvaApiErrorContext);
81
107
  }
82
108
  type ForbiddenErrorPayload = {
83
109
  readonly _tag: "ForbiddenError";
84
110
  readonly message: string;
85
- readonly operation: string;
86
111
  };
87
112
  export declare class ForbiddenError extends SamvaApiError<"ForbiddenError"> {
88
113
  readonly _tag: "ForbiddenError";
89
- readonly "operation": string;
90
114
  constructor(payload: Omit<ForbiddenErrorPayload, "_tag">, context?: SamvaApiErrorContext);
91
115
  }
116
+ type GatewayTimeoutErrorPayload = {
117
+ readonly _tag: "GatewayTimeoutError";
118
+ readonly message: string;
119
+ readonly retryAfterSeconds: number;
120
+ };
121
+ export declare class GatewayTimeoutError extends SamvaApiError<"GatewayTimeoutError"> {
122
+ readonly _tag: "GatewayTimeoutError";
123
+ readonly "retryAfterSeconds": number;
124
+ constructor(payload: Omit<GatewayTimeoutErrorPayload, "_tag">, context?: SamvaApiErrorContext);
125
+ }
92
126
  type InternalErrorPayload = {
93
127
  readonly _tag: "InternalError";
94
128
  readonly message: string;
95
- readonly operation: string;
96
129
  };
97
130
  export declare class InternalError extends SamvaApiError<"InternalError"> {
98
131
  readonly _tag: "InternalError";
99
- readonly "operation": string;
100
132
  constructor(payload: Omit<InternalErrorPayload, "_tag">, context?: SamvaApiErrorContext);
101
133
  }
102
134
  type OnboardingReviewRequiredErrorPayload = {
103
135
  readonly _tag: "OnboardingReviewRequiredError";
104
136
  readonly code: "review_required" | "review_in_progress" | "information_required" | "review_rejected" | "identity_review_required" | "identity_review_rejected" | "identity_changed";
105
- readonly decision: "undecided" | "approved" | "rejected" | "exempt";
137
+ readonly decision: "undecided" | "approved" | "rejected";
106
138
  readonly identityId?: string | null;
107
139
  readonly nextAction: "wait_for_review" | "provide_information" | "verify_sending_identity" | "reapply" | "contact_support";
108
- readonly operation: string;
109
140
  readonly stage: "collecting" | "automated_review" | "manual_review" | "information_requested" | "complete";
110
141
  };
111
142
  export declare class OnboardingReviewRequiredError extends SamvaApiError<"OnboardingReviewRequiredError"> {
112
143
  readonly _tag: "OnboardingReviewRequiredError";
113
144
  readonly "code": "review_required" | "review_in_progress" | "information_required" | "review_rejected" | "identity_review_required" | "identity_review_rejected" | "identity_changed";
114
- readonly "decision": "undecided" | "approved" | "rejected" | "exempt";
145
+ readonly "decision": "undecided" | "approved" | "rejected";
115
146
  readonly "identityId"?: string | null;
116
147
  readonly "nextAction": "wait_for_review" | "provide_information" | "verify_sending_identity" | "reapply" | "contact_support";
117
- readonly "operation": string;
118
148
  readonly "stage": "collecting" | "automated_review" | "manual_review" | "information_requested" | "complete";
119
149
  constructor(payload: Omit<OnboardingReviewRequiredErrorPayload, "_tag">, context?: SamvaApiErrorContext);
120
150
  }
@@ -122,77 +152,54 @@ type PaymentRequiredErrorPayload = {
122
152
  readonly _tag: "PaymentRequiredError";
123
153
  readonly currentUsage: number;
124
154
  readonly limit: number;
125
- readonly operation: string;
126
155
  readonly resource: string;
127
156
  };
128
157
  export declare class PaymentRequiredError extends SamvaApiError<"PaymentRequiredError"> {
129
158
  readonly _tag: "PaymentRequiredError";
130
159
  readonly "currentUsage": number;
131
160
  readonly "limit": number;
132
- readonly "operation": string;
133
161
  readonly "resource": string;
134
162
  constructor(payload: Omit<PaymentRequiredErrorPayload, "_tag">, context?: SamvaApiErrorContext);
135
163
  }
136
164
  type RateLimitedErrorPayload = {
137
165
  readonly _tag: "RateLimitedError";
138
- readonly operation: string;
139
166
  readonly retryAfterSeconds: number;
140
167
  };
141
168
  export declare class RateLimitedError extends SamvaApiError<"RateLimitedError"> {
142
169
  readonly _tag: "RateLimitedError";
143
- readonly "operation": string;
144
170
  readonly "retryAfterSeconds": number;
145
171
  constructor(payload: Omit<RateLimitedErrorPayload, "_tag">, context?: SamvaApiErrorContext);
146
172
  }
147
173
  type ResourceNotFoundErrorPayload = {
148
174
  readonly _tag: "ResourceNotFoundError";
149
175
  readonly id: string;
150
- readonly operation: string;
151
176
  readonly resource: string;
152
177
  };
153
178
  export declare class ResourceNotFoundError extends SamvaApiError<"ResourceNotFoundError"> {
154
179
  readonly _tag: "ResourceNotFoundError";
155
180
  readonly "id": string;
156
- readonly "operation": string;
157
181
  readonly "resource": string;
158
182
  constructor(payload: Omit<ResourceNotFoundErrorPayload, "_tag">, context?: SamvaApiErrorContext);
159
183
  }
160
184
  type UnauthorizedErrorPayload = {
161
185
  readonly _tag: "UnauthorizedError";
162
186
  readonly message: string;
163
- readonly operation: string;
164
187
  };
165
188
  export declare class UnauthorizedError extends SamvaApiError<"UnauthorizedError"> {
166
189
  readonly _tag: "UnauthorizedError";
167
- readonly "operation": string;
168
190
  constructor(payload: Omit<UnauthorizedErrorPayload, "_tag">, context?: SamvaApiErrorContext);
169
191
  }
170
192
  type ValidationErrorPayload = {
171
193
  readonly _tag: "ValidationError";
172
194
  readonly fields?: Record<string, Array<string>> | null;
173
195
  readonly message: string;
174
- readonly operation: string;
175
196
  };
176
197
  export declare class ValidationError extends SamvaApiError<"ValidationError"> {
177
198
  readonly _tag: "ValidationError";
178
199
  readonly "fields"?: Record<string, Array<string>> | null;
179
- readonly "operation": string;
180
200
  constructor(payload: Omit<ValidationErrorPayload, "_tag">, context?: SamvaApiErrorContext);
181
201
  }
182
- type WebhookEnqueueErrorPayload = {
183
- readonly _tag: "WebhookEnqueueError";
184
- readonly details?: string | null;
185
- readonly operation: string;
186
- readonly reason: string;
187
- };
188
- export declare class WebhookEnqueueError extends SamvaApiError<"WebhookEnqueueError"> {
189
- readonly _tag: "WebhookEnqueueError";
190
- readonly "details"?: string | null;
191
- readonly "operation": string;
192
- readonly "reason": string;
193
- constructor(payload: Omit<WebhookEnqueueErrorPayload, "_tag">, context?: SamvaApiErrorContext);
194
- }
195
- export type AnySamvaApiError = BillingProviderError | ConflictError | EmailChannelError | ExternalServiceError | FlagDisabledError | ForbiddenError | InternalError | OnboardingReviewRequiredError | PaymentRequiredError | RateLimitedError | ResourceNotFoundError | UnauthorizedError | ValidationError | WebhookEnqueueError;
202
+ export type AnySamvaApiError = AnalyticsQueryError | BillingProviderError | BrandAddressRequiredError | CampaignFooterRequiredError | ConflictError | DeliveryUnavailableError | EmailChannelError | ExternalServiceError | FlagDisabledError | ForbiddenError | GatewayTimeoutError | InternalError | OnboardingReviewRequiredError | PaymentRequiredError | RateLimitedError | ResourceNotFoundError | UnauthorizedError | ValidationError;
196
203
  /** Convert a decoded error payload into its generated JavaScript error class. */
197
204
  export declare function fromApiError(error: unknown, context?: SamvaApiErrorContext): AnySamvaApiError | SamvaTransportError;
198
205
  export {};
@@ -27,7 +27,7 @@
27
27
  * ```
28
28
  */
29
29
  import { type Client, type Config } from "../client/client";
30
- import { ApiKeys as apiKeys, Campaigns as campaigns, Contacts as contacts, Conversations as conversations, Design as design, Email as email, Media as media, Messages as messages, Operations as operations, Organizations as organizations, ScheduledMessages as scheduledMessages, Templates as templates, Webhooks as webhooks } from "../client/sdk.gen";
30
+ import { Analytics as analytics, ApiKeys as apiKeys, Attachments as attachments, Brands as brands, Campaigns as campaigns, ContactGroups as contactGroups, Contacts as contacts, Conversations as conversations, CustomFields as customFields, Email as email, Media as media, Messages as messages, Operations as operations, Organizations as organizations, ScheduledMessages as scheduledMessages, Templates as templates, Unsubscribe as unsubscribeGroups, Webhooks as webhooks } from "../client/sdk.gen";
31
31
  import type { MessagesSendData } from "../client/types.gen";
32
32
  export * from "./errors.gen";
33
33
  export type * from "./types.gen";
@@ -47,6 +47,10 @@ export type SamvaClientConfig = (SamvaClientConfigBase & {
47
47
  type MessageSendBody = MessagesSendData["body"];
48
48
  type MessageRecipient = MessageSendBody["to"][number];
49
49
  type MessageSendRequestOptions<ThrowOnError extends boolean = false> = Omit<NonNullable<Parameters<typeof messages.send<ThrowOnError>>[1]>, "client">;
50
+ type MessageSendOptions<ThrowOnError extends boolean = false> = MessageSendRequestOptions<ThrowOnError> & {
51
+ /** Sent as the `idempotency-key` header; defaults to a fresh UUID per call. */
52
+ readonly idempotencyKey?: string | undefined;
53
+ };
50
54
  type MessageSendResponse<ThrowOnError extends boolean = false> = ReturnType<typeof messages.send<ThrowOnError>>;
51
55
  type ContactObjectRecipient = {
52
56
  readonly id: string;
@@ -83,7 +87,7 @@ type PromiseMessagesTransport = {
83
87
  readonly getStatus: typeof messages.getStatus;
84
88
  readonly getEvents: typeof messages.getEvents;
85
89
  readonly validateEmail: typeof messages.validateEmail;
86
- readonly send: <ThrowOnError extends boolean = false>(input: ErgonomicMessageSendInput, options?: MessageSendRequestOptions<ThrowOnError>) => MessageSendResponse<ThrowOnError>;
90
+ readonly send: <ThrowOnError extends boolean = false>(input: ErgonomicMessageSendInput, options?: MessageSendOptions<ThrowOnError>) => MessageSendResponse<ThrowOnError>;
87
91
  };
88
92
  type ErgonomicEmailSendBody = Omit<EmailMessageSendBody, "channel" | "email" | "to" | "cc" | "bcc"> & ErgonomicEmailContent & {
89
93
  readonly to: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
@@ -91,11 +95,11 @@ type ErgonomicEmailSendBody = Omit<EmailMessageSendBody, "channel" | "email" | "
91
95
  readonly bcc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
92
96
  };
93
97
  type PromiseEmailTransport = Omit<typeof email, "send"> & {
94
- readonly send: <ThrowOnError extends boolean = false>(input: ErgonomicEmailSendBody, options?: MessageSendRequestOptions<ThrowOnError>) => MessageSendResponse<ThrowOnError>;
98
+ readonly send: <ThrowOnError extends boolean = false>(input: ErgonomicEmailSendBody, options?: MessageSendOptions<ThrowOnError>) => MessageSendResponse<ThrowOnError>;
95
99
  readonly addSender: <ThrowOnError extends boolean = false>(input: ErgonomicEmailAddSenderInput, options?: EmailAddSenderOptions<ThrowOnError>) => ReturnType<typeof email.addSender<ThrowOnError>>;
96
100
  };
97
101
  type PromiseTemplatesTransport = typeof templates;
98
- type RawMethod = (...arguments_: Array<any>) => PromiseLike<unknown>;
102
+ type RawMethod = (...arguments_: Array<never>) => PromiseLike<unknown>;
99
103
  type SuccessValue<Method extends RawMethod> = Exclude<Awaited<ReturnType<Method>> extends infer Result ? Result extends {
100
104
  readonly data: infer Data;
101
105
  } ? Data : never : never, undefined>;
@@ -112,34 +116,44 @@ export interface SamvaRawClient {
112
116
  readonly client: Client;
113
117
  readonly messages: typeof messages;
114
118
  readonly scheduledMessages: typeof scheduledMessages;
119
+ readonly brands: typeof brands;
115
120
  readonly campaigns: typeof campaigns;
116
121
  readonly email: typeof email;
117
122
  readonly media: typeof media;
118
123
  readonly templates: PromiseTemplatesTransport;
119
124
  readonly contacts: typeof contacts;
120
125
  readonly conversations: typeof conversations;
121
- readonly design: typeof design;
122
126
  readonly webhooks: typeof webhooks;
123
127
  readonly operations: typeof operations;
124
128
  readonly apiKeys: typeof apiKeys;
125
129
  readonly organizations: typeof organizations;
130
+ readonly attachments: typeof attachments;
131
+ readonly contactGroups: typeof contactGroups;
132
+ readonly customFields: typeof customFields;
133
+ readonly unsubscribeGroups: typeof unsubscribeGroups;
134
+ readonly analytics: typeof analytics;
126
135
  }
127
136
  export interface SamvaClient {
128
137
  /** Bound, unmodified Hey API methods and their original result envelopes. */
129
138
  readonly raw: SamvaRawClient;
130
139
  readonly messages: DirectService<PromiseMessagesTransport>;
131
140
  readonly scheduledMessages: DirectService<typeof scheduledMessages>;
141
+ readonly brands: DirectService<typeof brands>;
132
142
  readonly campaigns: DirectService<typeof campaigns>;
133
143
  readonly email: DirectService<PromiseEmailTransport>;
134
144
  readonly media: DirectService<typeof media>;
135
145
  readonly templates: DirectService<PromiseTemplatesTransport>;
136
146
  readonly contacts: DirectService<typeof contacts>;
137
147
  readonly conversations: DirectService<typeof conversations>;
138
- readonly design: DirectService<typeof design>;
139
148
  readonly webhooks: DirectService<typeof webhooks>;
140
149
  readonly operations: DirectService<typeof operations>;
141
150
  readonly apiKeys: DirectService<typeof apiKeys>;
142
151
  readonly organizations: DirectService<typeof organizations>;
152
+ readonly attachments: DirectService<typeof attachments>;
153
+ readonly contactGroups: DirectService<typeof contactGroups>;
154
+ readonly customFields: DirectService<typeof customFields>;
155
+ readonly unsubscribeGroups: DirectService<typeof unsubscribeGroups>;
156
+ readonly analytics: DirectService<typeof analytics>;
143
157
  }
144
158
  /** Create a configured Promise client. */
145
159
  export declare function createClient(config: SamvaClientConfig): SamvaClient;
@@ -1,2 +1,2 @@
1
- import { _ as WebhookEnqueueError, a as ExternalServiceError, c as InternalError, d as RateLimitedError, f as ResourceNotFoundError, g as ValidationError, h as UnauthorizedError, i as EmailChannelError, l as OnboardingReviewRequiredError, m as SamvaTransportError, n as BillingProviderError, o as FlagDisabledError, p as SamvaApiError, r as ConflictError, s as ForbiddenError, t as createClient, u as PaymentRequiredError, v as fromApiError } from "../promises-CP_nxUus.js";
2
- export { BillingProviderError, ConflictError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, InternalError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, UnauthorizedError, ValidationError, WebhookEnqueueError, createClient, fromApiError };
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-C2yyw-pf.js";
2
+ export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, DeliveryUnavailableError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, GatewayTimeoutError, InternalError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SamvaApiError, SamvaTransportError, UnauthorizedError, ValidationError, createClient, fromApiError };