samva 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +9 -0
- package/README.md +51 -6
- package/dist/{categories-DvsHUJtX.js → categories-BGUBFdH9.js} +13 -1
- package/dist/client/sdk.gen.d.ts +130 -32
- package/dist/client/types.gen.d.ts +979 -168
- package/dist/{client-Cj1bqIEe.js → client-CZjhOKPM.js} +898 -177
- package/dist/effect/analytics.d.ts +6 -6
- package/dist/effect/analytics.js +1 -1
- package/dist/effect/api-keys.d.ts +20 -20
- package/dist/effect/api-keys.js +1 -1
- package/dist/effect/attachments.js +1 -1
- package/dist/effect/brands.js +2 -2
- package/dist/effect/campaigns.d.ts +13 -13
- package/dist/effect/campaigns.js +1 -1
- package/dist/effect/categories.js +1 -1
- package/dist/effect/client.js +1 -1
- package/dist/effect/contact-groups.d.ts +9 -12
- package/dist/effect/contact-groups.js +1 -1
- package/dist/effect/contacts.d.ts +161 -76
- package/dist/effect/contacts.js +1 -1
- package/dist/effect/conversations.d.ts +20 -20
- package/dist/effect/conversations.js +1 -1
- package/dist/effect/custom-fields.d.ts +1 -1
- package/dist/effect/custom-fields.js +1 -1
- package/dist/effect/email.d.ts +27 -27
- package/dist/effect/email.js +2 -2
- package/dist/effect/extension-installations.d.ts +68 -2
- package/dist/effect/extension-installations.js +5 -3
- package/dist/effect/extensions.d.ts +3 -3
- package/dist/effect/extensions.js +1 -1
- package/dist/effect/feedback.d.ts +1 -1
- package/dist/effect/feedback.js +2 -2
- package/dist/effect/generated-metadata.d.ts +12 -0
- package/dist/effect/generated.d.ts +6502 -906
- package/dist/effect/index.d.ts +3 -1
- package/dist/effect/index.js +6 -4
- package/dist/effect/internal/client.d.ts +16 -2
- package/dist/effect/internal/operation.d.ts +14 -11
- package/dist/effect/mailboxes.d.ts +1725 -108
- package/dist/effect/mailboxes.js +3 -3
- package/dist/effect/media.d.ts +1 -1
- package/dist/effect/media.js +1 -1
- package/dist/effect/messages.d.ts +21 -19
- package/dist/effect/messages.js +1 -1
- package/dist/effect/namespaces.js +1 -1
- package/dist/effect/operations.d.ts +6 -6
- package/dist/effect/operations.js +1 -1
- package/dist/effect/organizations.d.ts +30 -0
- package/dist/effect/organizations.js +4 -2
- package/dist/effect/retry.js +1 -1
- package/dist/effect/scheduled-messages.d.ts +7 -7
- package/dist/effect/scheduled-messages.js +1 -1
- package/dist/effect/subscriptions.d.ts +15 -0
- package/dist/effect/subscriptions.js +9 -0
- package/dist/effect/templates.d.ts +52 -14
- package/dist/effect/templates.js +5 -3
- package/dist/effect/unsubscribe-groups.d.ts +1 -1
- package/dist/effect/unsubscribe-groups.js +1 -1
- package/dist/effect/webhooks.d.ts +15 -15
- package/dist/effect/webhooks.js +2 -2
- package/dist/index.js +4 -3
- package/dist/inline-attachments-BrNnSMF2.js +121 -0
- package/dist/inline-attachments.d.ts +65 -0
- package/dist/{mailbox-events-CsbF35vH.js → mailbox-events-VKR4f3qq.js} +6 -4
- package/dist/mailbox-events.d.ts +1 -1
- package/dist/{mailboxes-BtcktcNB.js → mailboxes-DT02zP7q.js} +13 -5
- package/dist/{operation-BEghYyLu.js → operation-g8nAzmIM.js} +63 -3
- package/dist/promises/errors.gen.d.ts +38 -2
- package/dist/promises/index.d.ts +7 -4
- package/dist/promises/index.js +4 -3
- package/dist/promises/types.gen.d.ts +1 -1
- package/dist/{promises-BzrwhHEW.js → promises-BFRKhpSS.js} +1070 -49
- package/dist/service-map.d.ts +40 -0
- package/package.json +7 -2
- package/dist/client-attribution-BTWYSXxo.js +0 -9
package/dist/effect/index.d.ts
CHANGED
|
@@ -38,10 +38,12 @@ export * as Operations from "./operations";
|
|
|
38
38
|
export * as Organizations from "./organizations";
|
|
39
39
|
export * as Retry from "./retry";
|
|
40
40
|
export * as ScheduledMessages from "./scheduled-messages";
|
|
41
|
+
export * as Subscriptions from "./subscriptions";
|
|
41
42
|
export * as Templates from "./templates";
|
|
42
43
|
export * as UnsubscribeGroups from "./unsubscribe-groups";
|
|
43
44
|
export * as Webhooks from "./webhooks";
|
|
44
|
-
export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, GatewayTimeoutError, InternalError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, UnauthorizedError, ValidationError, DeliveryUnavailableError, } from "./generated";
|
|
45
|
+
export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SenderNotReadyError, UnauthorizedError, ValidationError, DeliveryUnavailableError, } from "./generated";
|
|
45
46
|
export { type ErrorCategory, categoriesOf, hasCategory, isAuthError, isValidationError, isNotFoundError, isConflictError, isThrottlingError, isBillingError, isTransient, isRetryable, catchCategory, catchAuthError, catchValidationError, catchNotFoundError, catchConflictError, catchThrottlingError, catchBillingError, catchTransient, } from "./categories";
|
|
47
|
+
export { MediaUploadError } from "../inline-attachments";
|
|
46
48
|
export type { CursorPageEnvelope } from "./pagination";
|
|
47
49
|
export type { Json as JsonValue } from "effect/Schema";
|
package/dist/effect/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { t as MediaUploadError } from "../inline-attachments-BrNnSMF2.js";
|
|
2
|
+
import { C as PaymentRequiredError, F as ValidationError, O as SenderNotReadyError, S as OnboardingReviewRequiredError, T as ResourceNotFoundError, _ as ForbiddenError, a as AnalyticsQueryError, b as MailboxSendConflictError, c as CampaignFooterRequiredError, g as FlagDisabledError, h as ExternalServiceError, j as UnauthorizedError, l as ConflictError, m as EmailChannelError, o as BillingProviderError, p as DeliveryUnavailableError, s as BrandAddressRequiredError, v as GatewayTimeoutError, w as RateLimitedError, x as MailboxSendRefusedError, y as InternalError } from "../client-CZjhOKPM.js";
|
|
3
|
+
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-BGUBFdH9.js";
|
|
3
4
|
import { t as retry_exports } from "./retry.js";
|
|
4
5
|
import { t as analytics_exports } from "./analytics.js";
|
|
5
6
|
import { t as api_keys_exports } from "./api-keys.js";
|
|
@@ -15,14 +16,15 @@ import { t as email_exports } from "./email.js";
|
|
|
15
16
|
import { t as extension_installations_exports } from "./extension-installations.js";
|
|
16
17
|
import { t as extensions_exports } from "./extensions.js";
|
|
17
18
|
import { t as feedback_exports } from "./feedback.js";
|
|
18
|
-
import {
|
|
19
|
+
import { B as mailboxes_exports } from "../mailboxes-DT02zP7q.js";
|
|
19
20
|
import { t as media_exports } from "./media.js";
|
|
20
21
|
import { t as messages_exports } from "./messages.js";
|
|
21
22
|
import { t as namespaces_exports } from "./namespaces.js";
|
|
22
23
|
import { t as operations_exports } from "./operations.js";
|
|
23
24
|
import { t as organizations_exports } from "./organizations.js";
|
|
24
25
|
import { t as scheduled_messages_exports } from "./scheduled-messages.js";
|
|
26
|
+
import { t as subscriptions_exports } from "./subscriptions.js";
|
|
25
27
|
import { t as templates_exports } from "./templates.js";
|
|
26
28
|
import { t as unsubscribe_groups_exports } from "./unsubscribe-groups.js";
|
|
27
29
|
import { t as webhooks_exports } from "./webhooks.js";
|
|
28
|
-
export { analytics_exports as Analytics, AnalyticsQueryError, api_keys_exports as ApiKeys, attachments_exports as Attachments, BillingProviderError, BrandAddressRequiredError, brands_exports as Brands, CampaignFooterRequiredError, campaigns_exports as Campaigns, client_exports as Client, ConflictError, contact_groups_exports as ContactGroups, contacts_exports as Contacts, conversations_exports as Conversations, custom_fields_exports as CustomFields, DeliveryUnavailableError, email_exports as Email, EmailChannelError, extension_installations_exports as ExtensionInstallations, extensions_exports as Extensions, ExternalServiceError, feedback_exports as Feedback, FlagDisabledError, ForbiddenError, GatewayTimeoutError, InternalError, mailboxes_exports as Mailboxes, media_exports as Media, messages_exports as Messages, namespaces_exports as Namespaces, OnboardingReviewRequiredError, 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, unsubscribe_groups_exports as UnsubscribeGroups, ValidationError, webhooks_exports as Webhooks, catchAuthError, catchBillingError, catchCategory, catchConflictError, catchNotFoundError, catchThrottlingError, catchTransient, catchValidationError, categoriesOf, hasCategory, isAuthError, isBillingError, isConflictError, isNotFoundError, isRetryable, isThrottlingError, isTransient, isValidationError };
|
|
30
|
+
export { analytics_exports as Analytics, AnalyticsQueryError, api_keys_exports as ApiKeys, attachments_exports as Attachments, BillingProviderError, BrandAddressRequiredError, brands_exports as Brands, CampaignFooterRequiredError, campaigns_exports as Campaigns, client_exports as Client, ConflictError, contact_groups_exports as ContactGroups, contacts_exports as Contacts, conversations_exports as Conversations, custom_fields_exports as CustomFields, DeliveryUnavailableError, email_exports as Email, EmailChannelError, extension_installations_exports as ExtensionInstallations, extensions_exports as Extensions, ExternalServiceError, feedback_exports as Feedback, FlagDisabledError, ForbiddenError, GatewayTimeoutError, InternalError, MailboxSendConflictError, MailboxSendRefusedError, mailboxes_exports as Mailboxes, media_exports as Media, MediaUploadError, messages_exports as Messages, namespaces_exports as Namespaces, OnboardingReviewRequiredError, operations_exports as Operations, organizations_exports as Organizations, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, retry_exports as Retry, scheduled_messages_exports as ScheduledMessages, SenderNotReadyError, subscriptions_exports as Subscriptions, templates_exports as Templates, UnauthorizedError, unsubscribe_groups_exports as UnsubscribeGroups, ValidationError, webhooks_exports as Webhooks, catchAuthError, catchBillingError, catchCategory, catchConflictError, catchNotFoundError, catchThrottlingError, catchTransient, catchValidationError, categoriesOf, hasCategory, isAuthError, isBillingError, isConflictError, isNotFoundError, isRetryable, isThrottlingError, isTransient, isValidationError };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Context, Effect, Layer } from "effect";
|
|
1
|
+
import { Context, Effect, Layer, Redacted } from "effect";
|
|
2
2
|
import { HttpApiClient } from "effect/http-api";
|
|
3
3
|
import * as HttpClient from "effect/http/HttpClient";
|
|
4
|
+
import { MediaUploadError } from "../../inline-attachments";
|
|
4
5
|
import type { MailboxEventStreamConnection } from "../../mailbox-events";
|
|
5
6
|
import { SamvaApi } from "../generated";
|
|
6
7
|
export interface ConfigBase {
|
|
@@ -8,7 +9,7 @@ export interface ConfigBase {
|
|
|
8
9
|
readonly headers?: Readonly<Record<string, string | undefined>>;
|
|
9
10
|
}
|
|
10
11
|
export type Config = (ConfigBase & {
|
|
11
|
-
readonly apiKey: string
|
|
12
|
+
readonly apiKey: string | Redacted.Redacted<string>;
|
|
12
13
|
readonly authToken?: never;
|
|
13
14
|
}) | (ConfigBase & {
|
|
14
15
|
readonly authToken: string;
|
|
@@ -28,6 +29,19 @@ export interface Interface {
|
|
|
28
29
|
readonly operation: <Name extends Operation>(name: Name) => FlatRaw[Name];
|
|
29
30
|
/** The origin and headers a connection outside HTTP requests, such as the event stream, uses. */
|
|
30
31
|
readonly connection: MailboxEventStreamConnection;
|
|
32
|
+
/**
|
|
33
|
+
* Put bytes at a presigned storage URL through the configured transport, replaying the
|
|
34
|
+
* instruction's headers exactly and sending no API credentials. Fails with the response status
|
|
35
|
+
* (or the transport error) as `MediaUploadError`.
|
|
36
|
+
*/
|
|
37
|
+
readonly putUpload: (input: {
|
|
38
|
+
readonly filename: string;
|
|
39
|
+
readonly mediaId: string;
|
|
40
|
+
readonly url: string;
|
|
41
|
+
readonly method: string;
|
|
42
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
43
|
+
readonly bytes: Uint8Array;
|
|
44
|
+
}) => Effect.Effect<void, MediaUploadError>;
|
|
31
45
|
}
|
|
32
46
|
declare const Service_base: Context.ServiceClass<Service, "samva/Client", Interface>;
|
|
33
47
|
export declare class Service extends Service_base {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Effect, Redacted, Stream } from "effect";
|
|
1
|
+
import { type Brand, Effect, Redacted, Stream } from "effect";
|
|
2
|
+
import { type MediaUploadError } from "../../inline-attachments";
|
|
2
3
|
import { SDK_OPERATION_CALLS } from "../../service-map";
|
|
3
4
|
import { SendMessagePayload } from "../generated";
|
|
4
5
|
import { type FlatRaw, type Operation, Service } from "./client";
|
|
5
6
|
type SdkOperation = keyof typeof SDK_OPERATION_CALLS & Operation;
|
|
6
7
|
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
|
+
type Wire<Value> = Value extends string ? Value extends Brand.Brand<string> ? string : Value : 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
9
|
readonly [Key in keyof Value]: Wire<Value[Key]> | ({} extends Pick<Value, Key> ? undefined : never);
|
|
9
10
|
} : Value;
|
|
10
11
|
type FlattenRequest<Request> = (Request extends {
|
|
@@ -80,36 +81,38 @@ export type EmailSendInput = Omit<EmailPayload, "channel" | "email" | "to" | "cc
|
|
|
80
81
|
readonly cc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
|
|
81
82
|
readonly bcc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
|
|
82
83
|
};
|
|
84
|
+
type SendResult = MethodReturn<FlatRaw["messagesSend"]>;
|
|
85
|
+
type UploadFailure = MediaUploadError | Effect.Error<SendResult>;
|
|
83
86
|
export declare const sendMessage: (input: MessageSendInput, options?: SendOptions | undefined) => Effect.Effect<{
|
|
84
|
-
readonly id: string &
|
|
87
|
+
readonly id: string & Brand.Brand<"MessageId">;
|
|
85
88
|
readonly status: "bounced" | "complained" | "delivered" | "failed" | "pending" | "processing" | "queued" | "read" | "scheduled" | "sent";
|
|
86
|
-
readonly waitReason: "campaign-paused" | "content-review" | "daily-quota" | "domain-health" | "domain-warming" | "onboarding-review" | "rate" | "retry" | "sending-paused" | "upstream-unavailable" | null;
|
|
89
|
+
readonly waitReason: "campaign-paused" | "content-review" | "daily-quota" | "domain-health" | "domain-warming" | "onboarding-review" | "rate" | "retry" | "screening-unavailable" | "sending-paused" | "upstream-unavailable" | null;
|
|
87
90
|
readonly reviewExpectedAt: string | null;
|
|
88
91
|
readonly skippedRecipients: readonly {
|
|
89
92
|
readonly address: string;
|
|
90
93
|
readonly reason: "bounce" | "complaint" | "group-unsubscribe" | "manual" | "unsubscribe";
|
|
91
|
-
readonly unsubscribeGroupId?: (string &
|
|
94
|
+
readonly unsubscribeGroupId?: (string & Brand.Brand<"UnsubscribeId">) | null;
|
|
92
95
|
}[];
|
|
93
96
|
readonly createdAt: string;
|
|
94
|
-
},
|
|
97
|
+
}, UploadFailure, Service>;
|
|
95
98
|
export declare const sendEmail: (input: EmailSendInput, options?: SendOptions | undefined) => Effect.Effect<{
|
|
96
|
-
readonly id: string &
|
|
99
|
+
readonly id: string & Brand.Brand<"MessageId">;
|
|
97
100
|
readonly status: "bounced" | "complained" | "delivered" | "failed" | "pending" | "processing" | "queued" | "read" | "scheduled" | "sent";
|
|
98
|
-
readonly waitReason: "campaign-paused" | "content-review" | "daily-quota" | "domain-health" | "domain-warming" | "onboarding-review" | "rate" | "retry" | "sending-paused" | "upstream-unavailable" | null;
|
|
101
|
+
readonly waitReason: "campaign-paused" | "content-review" | "daily-quota" | "domain-health" | "domain-warming" | "onboarding-review" | "rate" | "retry" | "screening-unavailable" | "sending-paused" | "upstream-unavailable" | null;
|
|
99
102
|
readonly reviewExpectedAt: string | null;
|
|
100
103
|
readonly skippedRecipients: readonly {
|
|
101
104
|
readonly address: string;
|
|
102
105
|
readonly reason: "bounce" | "complaint" | "group-unsubscribe" | "manual" | "unsubscribe";
|
|
103
|
-
readonly unsubscribeGroupId?: (string &
|
|
106
|
+
readonly unsubscribeGroupId?: (string & Brand.Brand<"UnsubscribeId">) | null;
|
|
104
107
|
}[];
|
|
105
108
|
readonly createdAt: string;
|
|
106
|
-
},
|
|
109
|
+
}, UploadFailure, Service>;
|
|
107
110
|
type AddSenderRequest = NonNullable<RequestArg<FlatRaw["emailAddSender"]>>;
|
|
108
111
|
export type EmailAddSenderInput = Omit<AddSenderRequest["payload"], "replyToEmails"> & {
|
|
109
112
|
readonly replyToEmails?: ErgonomicEmailList | null | undefined;
|
|
110
113
|
};
|
|
111
114
|
export declare const addEmailSender: (input: EmailAddSenderInput, options?: SendOptions | undefined) => Effect.Effect<{
|
|
112
|
-
readonly id: string &
|
|
115
|
+
readonly id: string & Brand.Brand<"EmailSenderId">;
|
|
113
116
|
readonly email: string;
|
|
114
117
|
readonly status: "failed" | "pending" | "verified";
|
|
115
118
|
readonly providerLifecycle: "active" | "deleting" | "failed" | "provisioning";
|