samva 0.0.1 → 0.2.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 (79) hide show
  1. package/AGENTS.md +13 -0
  2. package/LICENSE +21 -0
  3. package/README.md +392 -5
  4. package/dist/categories-CsUa8ojo.js +143 -0
  5. package/dist/client/client/client.gen.d.ts +2 -0
  6. package/dist/client/client/index.d.ts +10 -0
  7. package/dist/client/client/types.gen.d.ts +120 -0
  8. package/dist/client/client/utils.gen.d.ts +37 -0
  9. package/dist/client/client.gen.d.ts +12 -0
  10. package/dist/client/core/auth.gen.d.ts +25 -0
  11. package/dist/client/core/bodySerializer.gen.d.ts +25 -0
  12. package/dist/client/core/params.gen.d.ts +43 -0
  13. package/dist/client/core/pathSerializer.gen.d.ts +33 -0
  14. package/dist/client/core/queryKeySerializer.gen.d.ts +18 -0
  15. package/dist/client/core/serverSentEvents.gen.d.ts +71 -0
  16. package/dist/client/core/types.gen.d.ts +83 -0
  17. package/dist/client/core/utils.gen.d.ts +19 -0
  18. package/dist/client/sdk.gen.d.ts +1558 -0
  19. package/dist/client/types.gen.d.ts +7917 -0
  20. package/dist/client-BqkU-sFv.js +6049 -0
  21. package/dist/effect/api-keys.d.ts +190 -0
  22. package/dist/effect/api-keys.js +27 -0
  23. package/dist/effect/campaigns.d.ts +2055 -0
  24. package/dist/effect/campaigns.js +33 -0
  25. package/dist/effect/categories.d.ts +65 -0
  26. package/dist/effect/categories.js +2 -0
  27. package/dist/effect/client.d.ts +9 -0
  28. package/dist/effect/client.js +13 -0
  29. package/dist/effect/contacts.d.ts +1278 -0
  30. package/dist/effect/contacts.js +39 -0
  31. package/dist/effect/conversations.d.ts +1604 -0
  32. package/dist/effect/conversations.js +23 -0
  33. package/dist/effect/design.d.ts +209 -0
  34. package/dist/effect/design.js +13 -0
  35. package/dist/effect/email.d.ts +1022 -0
  36. package/dist/effect/email.js +111 -0
  37. package/dist/effect/generated-metadata.d.ts +54 -0
  38. package/dist/effect/generated.d.ts +32156 -0
  39. package/dist/effect/index.d.ts +36 -0
  40. package/dist/effect/index.js +17 -0
  41. package/dist/effect/internal/client.d.ts +35 -0
  42. package/dist/effect/internal/operation.d.ts +466 -0
  43. package/dist/effect/messages.d.ts +1047 -0
  44. package/dist/effect/messages.js +23 -0
  45. package/dist/effect/operations.d.ts +97 -0
  46. package/dist/effect/operations.js +15 -0
  47. package/dist/effect/organizations.d.ts +559 -0
  48. package/dist/effect/organizations.js +21 -0
  49. package/dist/effect/pagination.d.ts +37 -0
  50. package/dist/effect/retry.d.ts +60 -0
  51. package/dist/effect/retry.js +112 -0
  52. package/dist/effect/runtime.d.ts +7 -0
  53. package/dist/effect/scheduled-messages.d.ts +1009 -0
  54. package/dist/effect/scheduled-messages.js +17 -0
  55. package/dist/effect/templates.d.ts +2591 -0
  56. package/dist/effect/templates.js +66 -0
  57. package/dist/effect/webhooks.d.ts +228 -0
  58. package/dist/effect/webhooks.js +33 -0
  59. package/dist/index.d.ts +1 -0
  60. package/dist/index.js +2 -0
  61. package/dist/normalize-LkWl4HUF.js +82 -0
  62. package/dist/normalize.d.ts +87 -0
  63. package/dist/operation-Ccqh_yxb.js +596 -0
  64. package/dist/promises/errors.gen.d.ts +179 -0
  65. package/dist/promises/index.d.ts +153 -0
  66. package/dist/promises/index.js +2 -0
  67. package/dist/promises/types.gen.d.ts +1 -0
  68. package/dist/promises-Dgv8UmCC.js +5911 -0
  69. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  70. package/dist/service-map.d.ts +732 -0
  71. package/dist/webhooks/effect.d.ts +1 -0
  72. package/dist/webhooks/effect.js +1 -0
  73. package/dist/webhooks/promise.d.ts +1 -0
  74. package/dist/webhooks/promise.js +1 -0
  75. package/package.json +151 -4
  76. package/CLAUDE.md +0 -111
  77. package/bun.lock +0 -29
  78. package/index.ts +0 -1
  79. package/tsconfig.json +0 -29
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Effect-native Samva SDK.
3
+ *
4
+ * Domain operations are exported as Pascal-cased modules. Provide a
5
+ * `Client.layer` once, then compose operations directly with Effect.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { Effect } from "effect";
10
+ * import { Client, Email } from "samva/effect";
11
+ *
12
+ * const program = Email.send({
13
+ * to: "ada@example.com",
14
+ * subject: "Hello",
15
+ * text: "Hi",
16
+ * }).pipe(Effect.provide(Client.layerFetch({ apiKey: "<samva-api-key>" })));
17
+ * ```
18
+ */
19
+ export * as ApiKeys from "./api-keys";
20
+ export * as Campaigns from "./campaigns";
21
+ export * as Client from "./client";
22
+ export * as Contacts from "./contacts";
23
+ export * as Conversations from "./conversations";
24
+ export * as Design from "./design";
25
+ export * as Email from "./email";
26
+ export * as Messages from "./messages";
27
+ export * as Operations from "./operations";
28
+ export * as Organizations from "./organizations";
29
+ export * as Retry from "./retry";
30
+ export * as ScheduledMessages from "./scheduled-messages";
31
+ export * as Templates from "./templates";
32
+ export * as Webhooks from "./webhooks";
33
+ export { BillingProviderError, ConflictError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, InternalError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, UnauthorizedError, ValidationError, WebhookEnqueueError, } from "./generated";
34
+ export { type ErrorCategory, categoriesOf, hasCategory, isAuthError, isValidationError, isNotFoundError, isConflictError, isThrottlingError, isBillingError, isTransient, isRetryable, catchCategory, catchAuthError, catchValidationError, catchNotFoundError, catchConflictError, catchThrottlingError, catchBillingError, catchTransient, } from "./categories";
35
+ export type { PageEnvelope } from "./pagination";
36
+ export type { Json as JsonValue } from "effect/Schema";
@@ -0,0 +1,17 @@
1
+ import { C as ValidationError, a as BillingProviderError, b as UnauthorizedError, d as FlagDisabledError, f as ForbiddenError, g as ResourceNotFoundError, h as RateLimitedError, l as EmailChannelError, m as PaymentRequiredError, o as ConflictError, p as InternalError, u as ExternalServiceError, w as WebhookEnqueueError } from "../client-BqkU-sFv.js";
2
+ import { _ as isTransient, a as catchNotFoundError, c as catchValidationError, d as isAuthError, f as isBillingError, g as isThrottlingError, h as isRetryable, i as catchConflictError, l as categoriesOf, m as isNotFoundError, n as catchBillingError, o as catchThrottlingError, p as isConflictError, r as catchCategory, s as catchTransient, t as catchAuthError, u as hasCategory, v as isValidationError } from "../categories-CsUa8ojo.js";
3
+ import { t as retry_exports } from "./retry.js";
4
+ import { t as api_keys_exports } from "./api-keys.js";
5
+ import { t as campaigns_exports } from "./campaigns.js";
6
+ import { t as client_exports } from "./client.js";
7
+ import { t as contacts_exports } from "./contacts.js";
8
+ import { t as conversations_exports } from "./conversations.js";
9
+ import { t as design_exports } from "./design.js";
10
+ import { t as email_exports } from "./email.js";
11
+ import { t as messages_exports } from "./messages.js";
12
+ import { t as operations_exports } from "./operations.js";
13
+ import { t as organizations_exports } from "./organizations.js";
14
+ import { t as scheduled_messages_exports } from "./scheduled-messages.js";
15
+ import { t as templates_exports } from "./templates.js";
16
+ import { t as webhooks_exports } from "./webhooks.js";
17
+ export { api_keys_exports as ApiKeys, BillingProviderError, campaigns_exports as Campaigns, client_exports as Client, ConflictError, contacts_exports as Contacts, conversations_exports as Conversations, design_exports as Design, email_exports as Email, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, InternalError, messages_exports as Messages, operations_exports as Operations, organizations_exports as Organizations, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, retry_exports as Retry, scheduled_messages_exports as ScheduledMessages, templates_exports as Templates, UnauthorizedError, ValidationError, WebhookEnqueueError, webhooks_exports as Webhooks, catchAuthError, catchBillingError, catchCategory, catchConflictError, catchNotFoundError, catchThrottlingError, catchTransient, catchValidationError, categoriesOf, hasCategory, isAuthError, isBillingError, isConflictError, isNotFoundError, isRetryable, isThrottlingError, isTransient, isValidationError };
@@ -0,0 +1,35 @@
1
+ import { Context, Effect, Layer } from "effect";
2
+ import * as HttpClient from "effect/unstable/http/HttpClient";
3
+ import { HttpApiClient } from "effect/unstable/httpapi";
4
+ import { SamvaApi } from "../generated";
5
+ export interface ConfigBase {
6
+ readonly baseUrl?: string;
7
+ readonly headers?: Readonly<Record<string, string>>;
8
+ }
9
+ export type Config = (ConfigBase & {
10
+ readonly apiKey: string;
11
+ readonly authToken?: never;
12
+ }) | (ConfigBase & {
13
+ readonly authToken: string;
14
+ readonly apiKey?: never;
15
+ });
16
+ export type Raw = HttpApiClient.ForApi<typeof SamvaApi>;
17
+ type UnionToIntersection<Union> = (Union extends unknown ? (arg: Union) => void : never) extends (arg: infer Intersection) => void ? Intersection : never;
18
+ type FlattenGroups<Client> = {
19
+ [Group in keyof Client]: {
20
+ [Endpoint in keyof Client[Group]]: Client[Group][Endpoint];
21
+ };
22
+ }[keyof Client];
23
+ export type FlatRaw = UnionToIntersection<FlattenGroups<Raw>>;
24
+ export type Operation = keyof FlatRaw & string;
25
+ export interface Interface {
26
+ readonly raw: Raw;
27
+ readonly operation: <Name extends Operation>(name: Name) => FlatRaw[Name];
28
+ }
29
+ declare const Service_base: Context.ServiceClass<Service, "samva/Client", Interface>;
30
+ export declare class Service extends Service_base {
31
+ }
32
+ export declare const layer: (config: Config) => Layer.Layer<Service, never, HttpClient.HttpClient>;
33
+ export declare const layerFetch: (config: Config) => Layer.Layer<Service>;
34
+ export declare const raw: Effect.Effect<Raw, never, Service>;
35
+ export {};
@@ -0,0 +1,466 @@
1
+ import { Effect, Redacted, Stream } from "effect";
2
+ import { SDK_OPERATION_CALLS } from "../../service-map";
3
+ import { SendMessagePayload } from "../generated";
4
+ import { type FlatRaw, type Operation, Service } from "./client";
5
+ type SdkOperation = keyof typeof SDK_OPERATION_CALLS & Operation;
6
+ type MethodReturn<Method> = Method extends (...args: infer _Args) => infer Return ? Return : never;
7
+ type Wire<Value> = Value extends string ? string : Value extends Redacted.Redacted<infer Raw> ? Raw | Value : Value extends number | boolean | bigint | symbol | null | undefined ? Value : Value extends Date ? Value : Value extends ReadonlyArray<infer Item> ? ReadonlyArray<Wire<Item>> : Value extends object ? {
8
+ readonly [Key in keyof Value]: Wire<Value[Key]> | ({} extends Pick<Value, Key> ? undefined : never);
9
+ } : Value;
10
+ type FlattenRequest<Request> = (Request extends {
11
+ readonly params: infer Params;
12
+ } ? Params : unknown) & (Request extends {
13
+ readonly query: infer Query;
14
+ } ? Query : unknown) & (Request extends {
15
+ readonly payload: infer Payload;
16
+ } ? Payload : unknown);
17
+ type RequestArg<Method> = Method extends (request: infer Request, ...rest: ReadonlyArray<unknown>) => unknown ? Request : never;
18
+ export type Input<Name extends SdkOperation> = Wire<FlattenRequest<NonNullable<RequestArg<FlatRaw[Name]>>>>;
19
+ type IdempotencyKeyField<Request> = Request extends {
20
+ readonly headers: {
21
+ readonly "idempotency-key": infer Key;
22
+ };
23
+ } ? {
24
+ readonly idempotencyKey: Wire<Key>;
25
+ } : unknown;
26
+ type OperationResult<Name extends SdkOperation> = Effect.Effect<Effect.Success<MethodReturn<FlatRaw[Name]>>, Effect.Error<MethodReturn<FlatRaw[Name]>>, Service>;
27
+ type DirectOperation<Name extends SdkOperation> = {} extends Input<Name> ? (input?: Input<Name>) => OperationResult<Name> : (input: Input<Name>) => OperationResult<Name>;
28
+ type OperationFunction<Name extends SdkOperation> = (typeof SDK_OPERATION_CALLS)[Name] extends {
29
+ readonly kind: "none";
30
+ } ? (_?: never) => OperationResult<Name> : (typeof SDK_OPERATION_CALLS)[Name] extends {
31
+ readonly kind: "idempotentPayload";
32
+ } ? (input: Input<Name> & IdempotencyKeyField<NonNullable<RequestArg<FlatRaw[Name]>>>) => OperationResult<Name> : DirectOperation<Name>;
33
+ type EnvelopeItem<A> = A extends {
34
+ readonly items: ReadonlyArray<infer Item>;
35
+ } ? Item : never;
36
+ type IsPaginated<A> = [A] extends [
37
+ {
38
+ readonly items: ReadonlyArray<unknown>;
39
+ readonly pagination: {
40
+ readonly totalPages: number;
41
+ };
42
+ }
43
+ ] ? true : false;
44
+ type PaginationCompanions<Parameters, A, E, R> = {} extends Parameters ? {
45
+ readonly pages: (input?: Parameters) => Stream.Stream<A, E, R>;
46
+ readonly items: (input?: Parameters) => Stream.Stream<EnvelopeItem<A>, E, R>;
47
+ } : {
48
+ readonly pages: (input: Parameters) => Stream.Stream<A, E, R>;
49
+ readonly items: (input: Parameters) => Stream.Stream<EnvelopeItem<A>, E, R>;
50
+ };
51
+ type WithPagination<Method> = Method extends (input: infer Parameters) => Effect.Effect<infer A, infer E, infer R> ? IsPaginated<A> extends true ? Method & PaginationCompanions<Parameters, A, E, R> : Method : Method;
52
+ export declare const stripUndefined: <Value>(input: Value) => Value;
53
+ export declare const make: <Name extends SdkOperation>(operationName: Name) => WithPagination<OperationFunction<Name>>;
54
+ type MessagePayload = typeof SendMessagePayload.Encoded;
55
+ type MessageRecipient = MessagePayload["to"][number];
56
+ type ContactObjectRecipient = {
57
+ readonly id: string;
58
+ };
59
+ type ErgonomicMessageRecipient = MessageRecipient | ContactObjectRecipient | string;
60
+ type EmailPayload = Extract<MessagePayload, {
61
+ readonly channel: "email";
62
+ }>;
63
+ type SmsPayload = Extract<MessagePayload, {
64
+ readonly channel: "sms";
65
+ }>;
66
+ type WhatsAppPayload = Extract<MessagePayload, {
67
+ readonly channel: "whatsapp";
68
+ }>;
69
+ type ErgonomicReplyTo = string | ReadonlyArray<string>;
70
+ type ErgonomicEmailList = string | ReadonlyArray<string>;
71
+ type ErgonomicEmailContent = Omit<EmailPayload["email"], "replyTo"> & {
72
+ readonly replyTo?: ErgonomicReplyTo | null | undefined;
73
+ };
74
+ export interface SendOptions {
75
+ readonly idempotencyKey?: string;
76
+ }
77
+ export type MessageSendInput = (Omit<EmailPayload, "to" | "cc" | "bcc" | "email"> & {
78
+ readonly to: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
79
+ readonly cc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient> | null;
80
+ readonly bcc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient> | null;
81
+ readonly email: ErgonomicEmailContent;
82
+ }) | (Omit<SmsPayload, "to"> & {
83
+ readonly to: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
84
+ }) | (Omit<WhatsAppPayload, "to"> & {
85
+ readonly to: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
86
+ });
87
+ export type EmailSendInput = Omit<EmailPayload, "channel" | "email" | "to" | "cc" | "bcc"> & ErgonomicEmailContent & {
88
+ readonly to: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
89
+ readonly cc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
90
+ readonly bcc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
91
+ };
92
+ export declare const sendMessage: (input: MessageSendInput, options?: SendOptions | undefined) => Effect.Effect<{
93
+ readonly id: string;
94
+ readonly organizationId: string;
95
+ readonly conversationId: string | null;
96
+ readonly parentMessageId: string | null;
97
+ readonly fromActorId: string;
98
+ readonly actorMetadata: {
99
+ readonly [x: string]: import("../generated").JsonValue;
100
+ } | null;
101
+ readonly channel: "sms" | "whatsapp" | "email";
102
+ readonly direction: "outbound" | "inbound";
103
+ readonly content: import("../generated").JsonValue;
104
+ readonly metadata: {
105
+ readonly [x: string]: import("../generated").JsonValue;
106
+ } | null;
107
+ readonly status: "pending" | "scheduled" | "queued" | "processing" | "sent" | "delivered" | "read" | "failed" | "bounced" | "complained";
108
+ readonly scheduledAt: string | null;
109
+ readonly tags: readonly string[];
110
+ readonly categories: readonly string[];
111
+ readonly isTest: boolean;
112
+ readonly isInternal: boolean;
113
+ readonly isAutomated: boolean;
114
+ readonly externalId: string | null;
115
+ readonly referenceId: string | null;
116
+ readonly apiKeyId: string | null;
117
+ readonly httpMethod: string | null;
118
+ readonly apiRequestMetadata: import("../generated").JsonValue;
119
+ readonly apiResponseMetadata: import("../generated").JsonValue;
120
+ readonly createdAt: string;
121
+ readonly updatedAt: string;
122
+ readonly createdBy: string | null;
123
+ readonly fromContact: {
124
+ readonly id: string;
125
+ readonly name: string;
126
+ readonly displayName: string | null;
127
+ readonly type: string;
128
+ readonly identities: readonly {
129
+ readonly channel: "sms" | "whatsapp" | "email";
130
+ readonly identifier: string;
131
+ readonly verified: boolean;
132
+ }[];
133
+ } | null;
134
+ readonly toContacts: readonly {
135
+ readonly id: string;
136
+ readonly name: string;
137
+ readonly displayName: string | null;
138
+ readonly type: string;
139
+ readonly identities: readonly {
140
+ readonly channel: "sms" | "whatsapp" | "email";
141
+ readonly identifier: string;
142
+ readonly verified: boolean;
143
+ }[];
144
+ }[];
145
+ readonly recipients: readonly {
146
+ readonly id: string;
147
+ readonly messageId: string;
148
+ readonly actorId: string | null;
149
+ readonly contactId: string | null;
150
+ readonly identityId: string | null;
151
+ readonly kind: "to" | "cc" | "bcc";
152
+ readonly address: string;
153
+ readonly status: "pending" | "scheduled" | "queued" | "processing" | "sent" | "delivered" | "read" | "failed" | "bounced" | "complained";
154
+ readonly createdAt: string;
155
+ readonly updatedAt: string;
156
+ readonly contact: {
157
+ readonly id: string;
158
+ readonly name: string;
159
+ readonly displayName: string | null;
160
+ readonly type: string;
161
+ readonly identities: readonly {
162
+ readonly channel: "sms" | "whatsapp" | "email";
163
+ readonly identifier: string;
164
+ readonly verified: boolean;
165
+ }[];
166
+ } | null;
167
+ }[];
168
+ readonly deliveries: readonly {
169
+ readonly id: string;
170
+ readonly messageId: string;
171
+ readonly recipientId: string | null;
172
+ readonly channel: "sms" | "whatsapp" | "email";
173
+ readonly status: "pending" | "scheduled" | "queued" | "processing" | "sent" | "delivered" | "read" | "failed" | "bounced" | "complained";
174
+ readonly attemptCount: number;
175
+ readonly maxAttempts: number;
176
+ readonly queuedAt: string | null;
177
+ readonly claimedAt: string | null;
178
+ readonly lastAttemptAt: string | null;
179
+ readonly nextRetryAt: string | null;
180
+ readonly sentAt: string | null;
181
+ readonly deliveredAt: string | null;
182
+ readonly readAt: string | null;
183
+ readonly failedAt: string | null;
184
+ readonly terminalAt: string | null;
185
+ readonly errorCode: string | null;
186
+ readonly errorMessage: string | null;
187
+ readonly errorDetails: import("../generated").JsonValue;
188
+ readonly cost: string;
189
+ readonly currency: string;
190
+ readonly idempotencyKey: string | null;
191
+ readonly metadata: import("../generated").JsonValue;
192
+ readonly createdAt: string;
193
+ readonly updatedAt: string;
194
+ }[];
195
+ readonly emailDeliveryDetails: readonly {
196
+ readonly deliveryId: string;
197
+ readonly messageIdHeader: string | null;
198
+ readonly inReplyTo: string | null;
199
+ readonly references: readonly string[] | null;
200
+ readonly subject: string;
201
+ readonly fromEmail: string;
202
+ readonly fromName: string | null;
203
+ readonly toEmails: readonly string[];
204
+ readonly toName: string | null;
205
+ readonly ccEmails: readonly string[] | null;
206
+ readonly bccEmails: readonly string[] | null;
207
+ readonly replyToEmails: readonly string[] | null;
208
+ readonly hasAttachments: boolean;
209
+ readonly attachmentCount: number;
210
+ readonly listUnsubscribeUrl: string | null;
211
+ readonly listUnsubscribeEmail: string | null;
212
+ readonly threadPosition: number | null;
213
+ readonly newContent: string | null;
214
+ readonly quotedContent: string | null;
215
+ readonly hasQuotedContent: boolean;
216
+ readonly dkimVerdict: string | null;
217
+ readonly spfVerdict: string | null;
218
+ readonly dmarcVerdict: string | null;
219
+ readonly isAutoReply: boolean;
220
+ readonly autoReplyReason: "out-of-office" | "auto-response" | "delivery-status" | "read-receipt" | null;
221
+ readonly priority: string | null;
222
+ readonly parsingErrors: readonly string[] | null;
223
+ readonly parsingDuration: number | null;
224
+ readonly receivedAt: string | null;
225
+ readonly processedAt: string | null;
226
+ readonly createdAt: string;
227
+ readonly updatedAt: string;
228
+ }[];
229
+ readonly smsDeliveryDetails: readonly {
230
+ readonly deliveryId: string;
231
+ readonly fromNumber: string;
232
+ readonly toNumber: string;
233
+ readonly segmentCount: number;
234
+ readonly encoding: string;
235
+ readonly dltTemplateId: string | null;
236
+ readonly dltEntityId: string | null;
237
+ readonly dltContentId: string | null;
238
+ readonly carrier: string | null;
239
+ readonly numSegmentsReported: number | null;
240
+ readonly createdAt: string;
241
+ readonly updatedAt: string;
242
+ }[];
243
+ readonly whatsappDeliveryDetails: readonly {
244
+ readonly deliveryId: string;
245
+ readonly fromNumber: string;
246
+ readonly toNumber: string;
247
+ readonly messageType: "text" | "image" | "video" | "audio" | "document" | "location" | "contacts" | "template" | "interactive" | "sticker" | "reaction" | "order" | "button" | "system" | "unsupported";
248
+ readonly templateName: string | null;
249
+ readonly templateLanguage: string | null;
250
+ readonly templateCategory: string | null;
251
+ readonly templateParams: {
252
+ readonly [x: string]: import("../generated").JsonValue;
253
+ } | null;
254
+ readonly mediaUrl: string | null;
255
+ readonly mediaType: string | null;
256
+ readonly mediaS3Key: string | null;
257
+ readonly interactiveType: string | null;
258
+ readonly contextMessageId: string | null;
259
+ readonly conversationType: "marketing" | "utility" | "authentication" | "service" | null;
260
+ readonly serviceWindowId: string | null;
261
+ readonly freeEntryPointId: string | null;
262
+ readonly isBillable: boolean;
263
+ readonly pricing: {
264
+ readonly messageCost: string;
265
+ readonly reason: string;
266
+ readonly sentInServiceWindow: boolean;
267
+ readonly sentInFreeEntryPoint: boolean;
268
+ } | null;
269
+ readonly recipientId: string | null;
270
+ readonly createdAt: string;
271
+ readonly updatedAt: string;
272
+ }[];
273
+ }, import("effect/SchemaError").SchemaError | import("..").BillingProviderError | import("..").ConflictError | import("..").ExternalServiceError | import("..").FlagDisabledError | import("..").ForbiddenError | import("..").InternalError | import("..").PaymentRequiredError | import("..").RateLimitedError | import("..").ResourceNotFoundError | import("..").UnauthorizedError | import("..").ValidationError | import("..").WebhookEnqueueError | import("effect/unstable/http/HttpClientError").HttpClientError, Service>;
274
+ export declare const sendEmail: (input: EmailSendInput, options?: SendOptions | undefined) => Effect.Effect<{
275
+ readonly id: string;
276
+ readonly organizationId: string;
277
+ readonly conversationId: string | null;
278
+ readonly parentMessageId: string | null;
279
+ readonly fromActorId: string;
280
+ readonly actorMetadata: {
281
+ readonly [x: string]: import("../generated").JsonValue;
282
+ } | null;
283
+ readonly channel: "sms" | "whatsapp" | "email";
284
+ readonly direction: "outbound" | "inbound";
285
+ readonly content: import("../generated").JsonValue;
286
+ readonly metadata: {
287
+ readonly [x: string]: import("../generated").JsonValue;
288
+ } | null;
289
+ readonly status: "pending" | "scheduled" | "queued" | "processing" | "sent" | "delivered" | "read" | "failed" | "bounced" | "complained";
290
+ readonly scheduledAt: string | null;
291
+ readonly tags: readonly string[];
292
+ readonly categories: readonly string[];
293
+ readonly isTest: boolean;
294
+ readonly isInternal: boolean;
295
+ readonly isAutomated: boolean;
296
+ readonly externalId: string | null;
297
+ readonly referenceId: string | null;
298
+ readonly apiKeyId: string | null;
299
+ readonly httpMethod: string | null;
300
+ readonly apiRequestMetadata: import("../generated").JsonValue;
301
+ readonly apiResponseMetadata: import("../generated").JsonValue;
302
+ readonly createdAt: string;
303
+ readonly updatedAt: string;
304
+ readonly createdBy: string | null;
305
+ readonly fromContact: {
306
+ readonly id: string;
307
+ readonly name: string;
308
+ readonly displayName: string | null;
309
+ readonly type: string;
310
+ readonly identities: readonly {
311
+ readonly channel: "sms" | "whatsapp" | "email";
312
+ readonly identifier: string;
313
+ readonly verified: boolean;
314
+ }[];
315
+ } | null;
316
+ readonly toContacts: readonly {
317
+ readonly id: string;
318
+ readonly name: string;
319
+ readonly displayName: string | null;
320
+ readonly type: string;
321
+ readonly identities: readonly {
322
+ readonly channel: "sms" | "whatsapp" | "email";
323
+ readonly identifier: string;
324
+ readonly verified: boolean;
325
+ }[];
326
+ }[];
327
+ readonly recipients: readonly {
328
+ readonly id: string;
329
+ readonly messageId: string;
330
+ readonly actorId: string | null;
331
+ readonly contactId: string | null;
332
+ readonly identityId: string | null;
333
+ readonly kind: "to" | "cc" | "bcc";
334
+ readonly address: string;
335
+ readonly status: "pending" | "scheduled" | "queued" | "processing" | "sent" | "delivered" | "read" | "failed" | "bounced" | "complained";
336
+ readonly createdAt: string;
337
+ readonly updatedAt: string;
338
+ readonly contact: {
339
+ readonly id: string;
340
+ readonly name: string;
341
+ readonly displayName: string | null;
342
+ readonly type: string;
343
+ readonly identities: readonly {
344
+ readonly channel: "sms" | "whatsapp" | "email";
345
+ readonly identifier: string;
346
+ readonly verified: boolean;
347
+ }[];
348
+ } | null;
349
+ }[];
350
+ readonly deliveries: readonly {
351
+ readonly id: string;
352
+ readonly messageId: string;
353
+ readonly recipientId: string | null;
354
+ readonly channel: "sms" | "whatsapp" | "email";
355
+ readonly status: "pending" | "scheduled" | "queued" | "processing" | "sent" | "delivered" | "read" | "failed" | "bounced" | "complained";
356
+ readonly attemptCount: number;
357
+ readonly maxAttempts: number;
358
+ readonly queuedAt: string | null;
359
+ readonly claimedAt: string | null;
360
+ readonly lastAttemptAt: string | null;
361
+ readonly nextRetryAt: string | null;
362
+ readonly sentAt: string | null;
363
+ readonly deliveredAt: string | null;
364
+ readonly readAt: string | null;
365
+ readonly failedAt: string | null;
366
+ readonly terminalAt: string | null;
367
+ readonly errorCode: string | null;
368
+ readonly errorMessage: string | null;
369
+ readonly errorDetails: import("../generated").JsonValue;
370
+ readonly cost: string;
371
+ readonly currency: string;
372
+ readonly idempotencyKey: string | null;
373
+ readonly metadata: import("../generated").JsonValue;
374
+ readonly createdAt: string;
375
+ readonly updatedAt: string;
376
+ }[];
377
+ readonly emailDeliveryDetails: readonly {
378
+ readonly deliveryId: string;
379
+ readonly messageIdHeader: string | null;
380
+ readonly inReplyTo: string | null;
381
+ readonly references: readonly string[] | null;
382
+ readonly subject: string;
383
+ readonly fromEmail: string;
384
+ readonly fromName: string | null;
385
+ readonly toEmails: readonly string[];
386
+ readonly toName: string | null;
387
+ readonly ccEmails: readonly string[] | null;
388
+ readonly bccEmails: readonly string[] | null;
389
+ readonly replyToEmails: readonly string[] | null;
390
+ readonly hasAttachments: boolean;
391
+ readonly attachmentCount: number;
392
+ readonly listUnsubscribeUrl: string | null;
393
+ readonly listUnsubscribeEmail: string | null;
394
+ readonly threadPosition: number | null;
395
+ readonly newContent: string | null;
396
+ readonly quotedContent: string | null;
397
+ readonly hasQuotedContent: boolean;
398
+ readonly dkimVerdict: string | null;
399
+ readonly spfVerdict: string | null;
400
+ readonly dmarcVerdict: string | null;
401
+ readonly isAutoReply: boolean;
402
+ readonly autoReplyReason: "out-of-office" | "auto-response" | "delivery-status" | "read-receipt" | null;
403
+ readonly priority: string | null;
404
+ readonly parsingErrors: readonly string[] | null;
405
+ readonly parsingDuration: number | null;
406
+ readonly receivedAt: string | null;
407
+ readonly processedAt: string | null;
408
+ readonly createdAt: string;
409
+ readonly updatedAt: string;
410
+ }[];
411
+ readonly smsDeliveryDetails: readonly {
412
+ readonly deliveryId: string;
413
+ readonly fromNumber: string;
414
+ readonly toNumber: string;
415
+ readonly segmentCount: number;
416
+ readonly encoding: string;
417
+ readonly dltTemplateId: string | null;
418
+ readonly dltEntityId: string | null;
419
+ readonly dltContentId: string | null;
420
+ readonly carrier: string | null;
421
+ readonly numSegmentsReported: number | null;
422
+ readonly createdAt: string;
423
+ readonly updatedAt: string;
424
+ }[];
425
+ readonly whatsappDeliveryDetails: readonly {
426
+ readonly deliveryId: string;
427
+ readonly fromNumber: string;
428
+ readonly toNumber: string;
429
+ readonly messageType: "text" | "image" | "video" | "audio" | "document" | "location" | "contacts" | "template" | "interactive" | "sticker" | "reaction" | "order" | "button" | "system" | "unsupported";
430
+ readonly templateName: string | null;
431
+ readonly templateLanguage: string | null;
432
+ readonly templateCategory: string | null;
433
+ readonly templateParams: {
434
+ readonly [x: string]: import("../generated").JsonValue;
435
+ } | null;
436
+ readonly mediaUrl: string | null;
437
+ readonly mediaType: string | null;
438
+ readonly mediaS3Key: string | null;
439
+ readonly interactiveType: string | null;
440
+ readonly contextMessageId: string | null;
441
+ readonly conversationType: "marketing" | "utility" | "authentication" | "service" | null;
442
+ readonly serviceWindowId: string | null;
443
+ readonly freeEntryPointId: string | null;
444
+ readonly isBillable: boolean;
445
+ readonly pricing: {
446
+ readonly messageCost: string;
447
+ readonly reason: string;
448
+ readonly sentInServiceWindow: boolean;
449
+ readonly sentInFreeEntryPoint: boolean;
450
+ } | null;
451
+ readonly recipientId: string | null;
452
+ readonly createdAt: string;
453
+ readonly updatedAt: string;
454
+ }[];
455
+ }, import("effect/SchemaError").SchemaError | import("..").BillingProviderError | import("..").ConflictError | import("..").ExternalServiceError | import("..").FlagDisabledError | import("..").ForbiddenError | import("..").InternalError | import("..").PaymentRequiredError | import("..").RateLimitedError | import("..").ResourceNotFoundError | import("..").UnauthorizedError | import("..").ValidationError | import("..").WebhookEnqueueError | import("effect/unstable/http/HttpClientError").HttpClientError, Service>;
456
+ type AddSenderRequest = NonNullable<RequestArg<FlatRaw["emailAddSender"]>>;
457
+ export type EmailAddSenderInput = Omit<AddSenderRequest["payload"], "replyToEmails"> & {
458
+ readonly replyToEmails?: ErgonomicEmailList | null | undefined;
459
+ };
460
+ export declare const addEmailSender: (input: EmailAddSenderInput) => Effect.Effect<{
461
+ readonly id: string & import("effect/Brand").Brand<"EmailSenderId">;
462
+ readonly email: string;
463
+ readonly status: "pending" | "failed" | "verified";
464
+ readonly createdAt: string;
465
+ }, import("effect/SchemaError").SchemaError | import("..").ConflictError | import("..").ExternalServiceError | import("..").ForbiddenError | import("..").InternalError | import("..").ResourceNotFoundError | import("..").UnauthorizedError | import("..").ValidationError | import("effect/unstable/http/HttpClientError").HttpClientError, Service>;
466
+ export {};