samva 0.15.0 → 0.17.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 (128) hide show
  1. package/AGENTS.md +4 -1
  2. package/README.md +46 -1
  3. package/dist/analytics-CaqPRsry.js +207 -0
  4. package/dist/api-keys-Ce1Y4_Ip.js +274 -0
  5. package/dist/attachments-DYqVIraC.js +140 -0
  6. package/dist/brands-ZwuOGIWO.js +175 -0
  7. package/dist/campaigns-DZlz1E9E.js +522 -0
  8. package/dist/categories-CA4XIQAb.js +1011 -0
  9. package/dist/client/sdk.gen.d.ts +234 -49
  10. package/dist/client/types.gen.d.ts +1521 -348
  11. package/dist/client-DOzUrdTE.js +1115 -0
  12. package/dist/contact-groups-BLbFXnjq.js +446 -0
  13. package/dist/contacts-BbsoXXB4.js +787 -0
  14. package/dist/conversations-_sRHueML.js +494 -0
  15. package/dist/custom-fields-BHWbwlKn.js +176 -0
  16. package/dist/effect/analytics.js +2 -21
  17. package/dist/effect/api-keys.d.ts +1 -0
  18. package/dist/effect/api-keys.js +2 -25
  19. package/dist/effect/attachments.js +2 -17
  20. package/dist/effect/brands.d.ts +1 -1
  21. package/dist/effect/brands.js +3 -24
  22. package/dist/effect/campaigns.js +2 -33
  23. package/dist/effect/categories.js +1 -1
  24. package/dist/effect/client.d.ts +1 -1
  25. package/dist/effect/client.js +3 -4
  26. package/dist/effect/contact-groups.js +2 -29
  27. package/dist/effect/contacts.d.ts +52 -0
  28. package/dist/effect/contacts.js +2 -47
  29. package/dist/effect/conversations.js +2 -35
  30. package/dist/effect/custom-fields.js +2 -17
  31. package/dist/effect/email.d.ts +3 -20
  32. package/dist/effect/email.js +2 -141
  33. package/dist/effect/events.d.ts +121 -0
  34. package/dist/effect/events.js +3 -0
  35. package/dist/effect/extension-installations.js +2 -27
  36. package/dist/effect/extensions.js +2 -19
  37. package/dist/effect/feedback.d.ts +1 -1
  38. package/dist/effect/feedback.js +3 -13
  39. package/dist/effect/generated/analytics.d.ts +715 -0
  40. package/dist/effect/generated/api-keys.d.ts +1627 -0
  41. package/dist/effect/generated/attachments.d.ts +554 -0
  42. package/dist/effect/generated/brands.d.ts +1118 -0
  43. package/dist/effect/generated/campaigns.d.ts +3783 -0
  44. package/dist/effect/generated/contact-events.d.ts +158 -0
  45. package/dist/effect/generated/contact-groups.d.ts +1445 -0
  46. package/dist/effect/generated/contacts.d.ts +3789 -0
  47. package/dist/effect/generated/conversations.d.ts +2870 -0
  48. package/dist/effect/generated/custom-fields.d.ts +562 -0
  49. package/dist/effect/generated/email.d.ts +10622 -0
  50. package/dist/effect/generated/events.d.ts +463 -0
  51. package/dist/effect/generated/extension-installations.d.ts +1786 -0
  52. package/dist/effect/generated/extensions.d.ts +927 -0
  53. package/dist/effect/generated/feedback.d.ts +116 -0
  54. package/dist/effect/generated/index.d.ts +61 -0
  55. package/dist/effect/generated/journeys.d.ts +6135 -0
  56. package/dist/effect/generated/mailboxes.d.ts +13641 -0
  57. package/dist/effect/generated/media.d.ts +741 -0
  58. package/dist/effect/generated/messages.d.ts +2355 -0
  59. package/dist/effect/generated/namespaces.d.ts +654 -0
  60. package/dist/effect/generated/operations.d.ts +514 -0
  61. package/dist/effect/generated/organizations.d.ts +1111 -0
  62. package/dist/effect/generated/scheduled-messages.d.ts +1798 -0
  63. package/dist/effect/generated/shared.d.ts +3250 -0
  64. package/dist/effect/generated/subscriptions.d.ts +188 -0
  65. package/dist/effect/generated/templates.d.ts +8177 -0
  66. package/dist/effect/generated/unsubscribe-groups.d.ts +1153 -0
  67. package/dist/effect/generated/webhooks.d.ts +1697 -0
  68. package/dist/effect/generated/whoami.d.ts +291 -0
  69. package/dist/effect/generated-metadata.d.ts +1631 -0
  70. package/dist/effect/index.d.ts +4 -1
  71. package/dist/effect/index.js +29 -26
  72. package/dist/effect/internal/client.d.ts +10 -7
  73. package/dist/effect/internal/email-sender.d.ts +17 -0
  74. package/dist/effect/internal/operation.d.ts +12 -72
  75. package/dist/effect/internal/send.d.ts +60 -0
  76. package/dist/effect/journeys.d.ts +2153 -0
  77. package/dist/effect/journeys.js +2 -0
  78. package/dist/effect/mailboxes.d.ts +255 -205
  79. package/dist/effect/mailboxes.js +2 -2
  80. package/dist/effect/media.js +3 -1
  81. package/dist/effect/messages.d.ts +2 -2
  82. package/dist/effect/messages.js +3 -1
  83. package/dist/effect/namespaces.js +2 -19
  84. package/dist/effect/operations.js +2 -15
  85. package/dist/effect/organizations.js +2 -23
  86. package/dist/effect/retry.js +1 -1
  87. package/dist/effect/scheduled-messages.js +2 -19
  88. package/dist/effect/subscriptions.js +2 -9
  89. package/dist/effect/templates.d.ts +1 -1
  90. package/dist/effect/templates.js +3 -78
  91. package/dist/effect/unsubscribe-groups.js +2 -27
  92. package/dist/effect/webhooks.d.ts +9 -9
  93. package/dist/effect/webhooks.js +3 -33
  94. package/dist/effect/whoami.d.ts +46 -0
  95. package/dist/effect/whoami.js +2 -0
  96. package/dist/email-R0NAA9PW.js +2498 -0
  97. package/dist/events-CxbTUHYT.js +82 -0
  98. package/dist/extension-installations-CD94LPmk.js +407 -0
  99. package/dist/extensions-BKyNQLvu.js +220 -0
  100. package/dist/feedback-Bpa09JOS.js +52 -0
  101. package/dist/index.js +3 -3
  102. package/dist/{inline-attachments-UxLeyytJ.js → inline-attachments-Bi1hDltp.js} +2 -2
  103. package/dist/journeys-CARo_BJT.js +499 -0
  104. package/dist/mailboxes-BRDn7BIK.js +2470 -0
  105. package/dist/media-VrrtNnft.js +181 -0
  106. package/dist/namespaces-CcvEbG-y.js +152 -0
  107. package/dist/{operation-BZ5Xov-x.js → operation-n_IYgNVK.js} +85 -102
  108. package/dist/operations-CmB3FHwf.js +93 -0
  109. package/dist/organizations-A-plufWc.js +252 -0
  110. package/dist/promises/errors.gen.d.ts +12 -2
  111. package/dist/promises/index.d.ts +9 -3
  112. package/dist/promises/index.js +3 -3
  113. package/dist/promises/types.gen.d.ts +1 -1
  114. package/dist/{promises-Cd6Jamqk.js → promises---Kbh-7z.js} +745 -195
  115. package/dist/runtime-P0l1_2-C.js +25 -0
  116. package/dist/scheduled-messages-DkKZRRaN.js +207 -0
  117. package/dist/send-Bxc0XfGE.js +722 -0
  118. package/dist/service-map.d.ts +101 -15
  119. package/dist/subscriptions-DEXYtMXg.js +67 -0
  120. package/dist/templates-DZomxsG7.js +2289 -0
  121. package/dist/unsubscribe-groups-Iqk4Isf9.js +291 -0
  122. package/dist/webhooks-CPXuu8Xf.js +530 -0
  123. package/dist/whoami-Ccz0jwlt.js +59 -0
  124. package/package.json +17 -3
  125. package/dist/categories-BGUBFdH9.js +0 -183
  126. package/dist/client-CDg7zJs0.js +0 -13726
  127. package/dist/effect/generated.d.ts +0 -64059
  128. package/dist/mailboxes-BH_JPmOE.js +0 -159
@@ -29,7 +29,9 @@ export * as CustomFields from "./custom-fields";
29
29
  export * as Email from "./email";
30
30
  export * as ExtensionInstallations from "./extension-installations";
31
31
  export * as Extensions from "./extensions";
32
+ export * as Events from "./events";
32
33
  export * as Feedback from "./feedback";
34
+ export * as Journeys from "./journeys";
33
35
  export * as Mailboxes from "./mailboxes";
34
36
  export * as Media from "./media";
35
37
  export * as Messages from "./messages";
@@ -42,7 +44,8 @@ export * as Subscriptions from "./subscriptions";
42
44
  export * as Templates from "./templates";
43
45
  export * as UnsubscribeGroups from "./unsubscribe-groups";
44
46
  export * as Webhooks from "./webhooks";
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";
47
+ export * as Whoami from "./whoami";
48
+ export { AnalyticsQueryError, BillingProviderError, BrandAddressRequiredError, CampaignFooterRequiredError, ConflictError, EmailChannelError, ExternalServiceError, FlagDisabledError, ForbiddenError, GatewayTimeoutError, InternalError, MailboxChannelUnsupportedError, MailboxSendConflictError, MailboxSendRefusedError, OnboardingReviewRequiredError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, SenderNotReadyError, UnauthorizedError, ValidationError, DeliveryUnavailableError, } from "./generated/shared";
46
49
  export { type ErrorCategory, categoriesOf, hasCategory, isAuthError, isValidationError, isNotFoundError, isConflictError, isThrottlingError, isBillingError, isTransient, isRetryable, catchCategory, catchAuthError, catchValidationError, catchNotFoundError, catchConflictError, catchThrottlingError, catchBillingError, catchTransient, } from "./categories";
47
50
  export { MediaUploadError } from "../inline-attachments";
48
51
  export type { CursorPageEnvelope } from "./pagination";
@@ -1,30 +1,33 @@
1
- import { t as MediaUploadError } from "../inline-attachments-UxLeyytJ.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-CDg7zJs0.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";
1
+ import { t as MediaUploadError } from "../inline-attachments-Bi1hDltp.js";
2
+ import { G as FlagDisabledError, Jt as UnauthorizedError, K as ForbiddenError, Lt as ResourceNotFoundError, M as EmailChannelError, Nt as PaymentRequiredError, O as DeliveryUnavailableError, Ot as OnboardingReviewRequiredError, Pt as RateLimitedError, U as ExternalServiceError, Y as InternalError, en as ValidationError, i as AnalyticsQueryError, it as MailboxChannelUnsupportedError, l as BillingProviderError, m as ConflictError, mt as MailboxSendConflictError, p as CampaignFooterRequiredError, q as GatewayTimeoutError, u as BrandAddressRequiredError, vt as MailboxSendRefusedError, zt as SenderNotReadyError } from "../client-DOzUrdTE.js";
3
+ import { t as analytics_exports } from "../analytics-CaqPRsry.js";
4
+ 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-CA4XIQAb.js";
4
5
  import { t as retry_exports } from "./retry.js";
5
- import { t as analytics_exports } from "./analytics.js";
6
- import { t as api_keys_exports } from "./api-keys.js";
7
- import { t as attachments_exports } from "./attachments.js";
8
- import { t as brands_exports } from "./brands.js";
9
- import { t as campaigns_exports } from "./campaigns.js";
6
+ import { t as api_keys_exports } from "../api-keys-Ce1Y4_Ip.js";
7
+ import { t as attachments_exports } from "../attachments-DYqVIraC.js";
8
+ import { t as brands_exports } from "../brands-ZwuOGIWO.js";
9
+ import { n as campaigns_exports } from "../campaigns-DZlz1E9E.js";
10
10
  import { t as client_exports } from "./client.js";
11
- import { t as contact_groups_exports } from "./contact-groups.js";
12
- import { t as contacts_exports } from "./contacts.js";
13
- import { t as conversations_exports } from "./conversations.js";
14
- import { t as custom_fields_exports } from "./custom-fields.js";
15
- import { t as email_exports } from "./email.js";
16
- import { t as extension_installations_exports } from "./extension-installations.js";
17
- import { t as extensions_exports } from "./extensions.js";
18
- import { t as feedback_exports } from "./feedback.js";
19
- import { V as mailboxes_exports } from "../mailboxes-BH_JPmOE.js";
11
+ import { n as contact_groups_exports } from "../contact-groups-BLbFXnjq.js";
12
+ import { s as contacts_exports } from "../contacts-BbsoXXB4.js";
13
+ import { a as conversations_exports } from "../conversations-_sRHueML.js";
14
+ import { n as custom_fields_exports } from "../custom-fields-BHWbwlKn.js";
15
+ import { b as email_exports } from "../email-R0NAA9PW.js";
16
+ import { r as extension_installations_exports } from "../extension-installations-CD94LPmk.js";
17
+ import { t as extensions_exports } from "../extensions-BKyNQLvu.js";
18
+ import { r as events_exports } from "../events-CxbTUHYT.js";
19
+ import { t as feedback_exports } from "../feedback-Bpa09JOS.js";
20
+ import { o as journeys_exports } from "../journeys-CARo_BJT.js";
21
+ import { V as mailboxes_exports } from "../mailboxes-BRDn7BIK.js";
20
22
  import { t as media_exports } from "./media.js";
21
23
  import { t as messages_exports } from "./messages.js";
22
- import { t as namespaces_exports } from "./namespaces.js";
23
- import { t as operations_exports } from "./operations.js";
24
- import { t as organizations_exports } from "./organizations.js";
25
- import { t as scheduled_messages_exports } from "./scheduled-messages.js";
26
- import { t as subscriptions_exports } from "./subscriptions.js";
27
- import { t as templates_exports } from "./templates.js";
28
- import { t as unsubscribe_groups_exports } from "./unsubscribe-groups.js";
29
- import { t as webhooks_exports } from "./webhooks.js";
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 };
24
+ import { i as namespaces_exports } from "../namespaces-CcvEbG-y.js";
25
+ import { r as operations_exports } from "../operations-CmB3FHwf.js";
26
+ import { s as organizations_exports } from "../organizations-A-plufWc.js";
27
+ import { o as scheduled_messages_exports } from "../scheduled-messages-DkKZRRaN.js";
28
+ import { n as subscriptions_exports } from "../subscriptions-DEXYtMXg.js";
29
+ import { M as templates_exports } from "../templates-DZomxsG7.js";
30
+ import { l as unsubscribe_groups_exports } from "../unsubscribe-groups-Iqk4Isf9.js";
31
+ import { d as webhooks_exports } from "../webhooks-CPXuu8Xf.js";
32
+ import { n as whoami_exports } from "../whoami-Ccz0jwlt.js";
33
+ 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, events_exports as Events, extension_installations_exports as ExtensionInstallations, extensions_exports as Extensions, ExternalServiceError, feedback_exports as Feedback, FlagDisabledError, ForbiddenError, GatewayTimeoutError, InternalError, journeys_exports as Journeys, MailboxChannelUnsupportedError, 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, whoami_exports as Whoami, catchAuthError, catchBillingError, catchCategory, catchConflictError, catchNotFoundError, catchThrottlingError, catchTransient, catchValidationError, categoriesOf, hasCategory, isAuthError, isBillingError, isConflictError, isNotFoundError, isRetryable, isThrottlingError, isTransient, isValidationError };
@@ -1,9 +1,9 @@
1
1
  import { Context, Effect, Layer, Redacted } from "effect";
2
- import { HttpApiClient } from "effect/http-api";
2
+ import { HttpApiClient, type HttpApiGroup } from "effect/http-api";
3
3
  import * as HttpClient from "effect/http/HttpClient";
4
4
  import { MediaUploadError } from "../../inline-attachments";
5
5
  import type { MailboxEventStreamConnection } from "../../mailbox-events";
6
- import { SamvaApi } from "../generated";
6
+ import type { SamvaApi } from "../generated/index";
7
7
  export interface ConfigBase {
8
8
  readonly baseUrl?: string;
9
9
  readonly headers?: Readonly<Record<string, string | undefined>>;
@@ -15,18 +15,22 @@ export type Config = (ConfigBase & {
15
15
  readonly authToken: string;
16
16
  readonly apiKey?: never;
17
17
  });
18
- export type Raw = HttpApiClient.ForApi<typeof SamvaApi>;
18
+ type Api = HttpApiClient.ForApi<typeof SamvaApi>;
19
19
  type UnionToIntersection<Union> = (Union extends unknown ? (arg: Union) => void : never) extends (arg: infer Intersection) => void ? Intersection : never;
20
20
  type FlattenGroups<Client> = {
21
21
  [Group in keyof Client]: {
22
22
  [Endpoint in keyof Client[Group]]: Client[Group][Endpoint];
23
23
  };
24
24
  }[keyof Client];
25
- export type FlatRaw = UnionToIntersection<FlattenGroups<Raw>>;
25
+ export type FlatRaw = UnionToIntersection<FlattenGroups<Api>>;
26
26
  export type Operation = keyof FlatRaw & string;
27
+ export type RawCall = (request?: unknown) => Effect.Effect<unknown, unknown>;
27
28
  export interface Interface {
28
- readonly raw: Raw;
29
- readonly operation: <Name extends Operation>(name: Name) => FlatRaw[Name];
29
+ /**
30
+ * The generated call for one endpoint. A group's client is built on the first call to any of its
31
+ * endpoints and reused, so a group the program never calls costs nothing.
32
+ */
33
+ readonly endpoint: (group: HttpApiGroup.Constraint, name: Operation) => Effect.Effect<RawCall>;
30
34
  /** The origin and headers a connection outside HTTP requests, such as the event stream, uses. */
31
35
  readonly connection: MailboxEventStreamConnection;
32
36
  /**
@@ -48,5 +52,4 @@ export declare class Service extends Service_base {
48
52
  }
49
53
  export declare const layer: (config: Config) => Layer.Layer<Service, never, HttpClient.HttpClient>;
50
54
  export declare const layerFetch: (config: Config) => Layer.Layer<Service>;
51
- export declare const raw: Effect.Effect<Raw, never, Service>;
52
55
  export {};
@@ -0,0 +1,17 @@
1
+ import { Effect } from "effect";
2
+ import type { FlatRaw, Service } from "./client";
3
+ import { type RequestArg } from "./operation";
4
+ import type { ErgonomicEmailList, SendOptions } from "./send";
5
+ type AddSenderRequest = NonNullable<RequestArg<FlatRaw["emailAddSender"]>>;
6
+ export type EmailAddSenderInput = Omit<AddSenderRequest["payload"], "replyToEmails"> & {
7
+ readonly replyToEmails?: ErgonomicEmailList | null | undefined;
8
+ };
9
+ export declare const addEmailSender: (input: EmailAddSenderInput, options?: SendOptions | undefined) => Effect.Effect<{
10
+ readonly id: string & import("effect/Brand").Brand<"EmailSenderId">;
11
+ readonly email: string;
12
+ readonly status: "failed" | "pending" | "verified";
13
+ readonly providerLifecycle: "active" | "deleting" | "failed" | "provisioning";
14
+ readonly providerFailureCode: string | null;
15
+ readonly createdAt: string;
16
+ }, import("..").ConflictError | import("..").ExternalServiceError | import("..").ForbiddenError | import("..").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("..").InternalError | import("..").ResourceNotFoundError | import("effect/Schema").SchemaError | import("..").UnauthorizedError | import("..").ValidationError, Service>;
17
+ export {};
@@ -1,10 +1,9 @@
1
1
  import { type Brand, Effect, Redacted, Stream } from "effect";
2
- import { type MediaUploadError } from "../../inline-attachments";
2
+ import type { HttpApiGroup } from "effect/http-api";
3
3
  import { SDK_OPERATION_CALLS } from "../../service-map";
4
- import { SendMessagePayload } from "../generated";
5
4
  import { type FlatRaw, type Operation, Service } from "./client";
6
- type SdkOperation = keyof typeof SDK_OPERATION_CALLS & Operation;
7
- type MethodReturn<Method> = Method extends (...args: infer _Args) => infer Return ? Return : never;
5
+ export type SdkOperation = keyof typeof SDK_OPERATION_CALLS & Operation;
6
+ export type MethodReturn<Method> = Method extends (...args: infer _Args) => infer Return ? Return : never;
8
7
  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 ? {
9
8
  readonly [Key in keyof Value]: Wire<Value[Key]> | ({} extends Pick<Value, Key> ? undefined : never);
10
9
  } : Value;
@@ -15,7 +14,7 @@ type FlattenRequest<Request> = (Request extends {
15
14
  } ? Query : unknown) & (Request extends {
16
15
  readonly payload: infer Payload;
17
16
  } ? Payload : unknown);
18
- type RequestArg<Method> = Method extends (request: infer Request, ...rest: ReadonlyArray<unknown>) => unknown ? Request : never;
17
+ export type RequestArg<Method> = Method extends (request: infer Request, ...rest: ReadonlyArray<unknown>) => unknown ? Request : never;
19
18
  type Input<Name extends SdkOperation> = Wire<FlattenRequest<NonNullable<RequestArg<FlatRaw[Name]>>>>;
20
19
  type IdempotencyKeyField<Request> = Request extends {
21
20
  readonly headers: {
@@ -52,71 +51,12 @@ type PaginationCompanions<Parameters, A, E, R> = {} extends Parameters ? {
52
51
  readonly items: (input: Parameters) => Stream.Stream<EnvelopeItem<A>, E, R>;
53
52
  };
54
53
  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;
55
- export declare const make: <Name extends SdkOperation>(operationName: Name) => WithPagination<OperationFunction<Name>>;
56
- type MessagePayload = typeof SendMessagePayload.Encoded;
57
- type MessageRecipient = MessagePayload["to"][number];
58
- type ContactObjectRecipient = {
59
- readonly id: string;
60
- };
61
- type ErgonomicMessageRecipient = MessageRecipient | ContactObjectRecipient | string;
62
- type EmailPayload = Extract<MessagePayload, {
63
- readonly channel: "email";
64
- }>;
65
- type ErgonomicReplyTo = string | ReadonlyArray<string>;
66
- type ErgonomicEmailList = string | ReadonlyArray<string>;
67
- type ErgonomicEmailContent = Omit<EmailPayload["email"], "replyTo"> & {
68
- readonly replyTo?: ErgonomicReplyTo | null | undefined;
69
- };
70
- export interface SendOptions {
71
- readonly idempotencyKey?: string;
72
- }
73
- export type MessageSendInput = Omit<EmailPayload, "to" | "cc" | "bcc" | "email"> & {
74
- readonly to: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
75
- readonly cc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient> | null;
76
- readonly bcc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient> | null;
77
- readonly email: ErgonomicEmailContent;
78
- };
79
- export type EmailSendInput = Omit<EmailPayload, "channel" | "email" | "to" | "cc" | "bcc"> & ErgonomicEmailContent & {
80
- readonly to: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
81
- readonly cc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
82
- readonly bcc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
83
- };
84
- type SendResult = MethodReturn<FlatRaw["messagesSend"]>;
85
- type UploadFailure = MediaUploadError | Effect.Error<SendResult>;
86
- export declare const sendMessage: (input: MessageSendInput, options?: SendOptions | undefined) => Effect.Effect<{
87
- readonly id: string & Brand.Brand<"MessageId">;
88
- readonly status: "bounced" | "complained" | "delivered" | "failed" | "pending" | "processing" | "queued" | "read" | "scheduled" | "sent";
89
- readonly waitReason: "campaign-paused" | "content-review" | "daily-quota" | "domain-health" | "domain-warming" | "onboarding-review" | "rate" | "retry" | "screening-unavailable" | "sending-paused" | "upstream-unavailable" | null;
90
- readonly reviewExpectedAt: string | null;
91
- readonly skippedRecipients: readonly {
92
- readonly address: string;
93
- readonly reason: "bounce" | "complaint" | "group-unsubscribe" | "manual" | "unsubscribe";
94
- readonly unsubscribeGroupId?: (string & Brand.Brand<"UnsubscribeId">) | null;
95
- }[];
96
- readonly createdAt: string;
97
- }, UploadFailure, Service>;
98
- export declare const sendEmail: (input: EmailSendInput, options?: SendOptions | undefined) => Effect.Effect<{
99
- readonly id: string & Brand.Brand<"MessageId">;
100
- readonly status: "bounced" | "complained" | "delivered" | "failed" | "pending" | "processing" | "queued" | "read" | "scheduled" | "sent";
101
- readonly waitReason: "campaign-paused" | "content-review" | "daily-quota" | "domain-health" | "domain-warming" | "onboarding-review" | "rate" | "retry" | "screening-unavailable" | "sending-paused" | "upstream-unavailable" | null;
102
- readonly reviewExpectedAt: string | null;
103
- readonly skippedRecipients: readonly {
104
- readonly address: string;
105
- readonly reason: "bounce" | "complaint" | "group-unsubscribe" | "manual" | "unsubscribe";
106
- readonly unsubscribeGroupId?: (string & Brand.Brand<"UnsubscribeId">) | null;
107
- }[];
108
- readonly createdAt: string;
109
- }, UploadFailure, Service>;
110
- type AddSenderRequest = NonNullable<RequestArg<FlatRaw["emailAddSender"]>>;
111
- export type EmailAddSenderInput = Omit<AddSenderRequest["payload"], "replyToEmails"> & {
112
- readonly replyToEmails?: ErgonomicEmailList | null | undefined;
113
- };
114
- export declare const addEmailSender: (input: EmailAddSenderInput, options?: SendOptions | undefined) => Effect.Effect<{
115
- readonly id: string & Brand.Brand<"EmailSenderId">;
116
- readonly email: string;
117
- readonly status: "failed" | "pending" | "verified";
118
- readonly providerLifecycle: "active" | "deleting" | "failed" | "provisioning";
119
- readonly providerFailureCode: string | null;
120
- readonly createdAt: string;
121
- }, import("..").ConflictError | import("..").ExternalServiceError | import("..").ForbiddenError | import("..").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("..").InternalError | import("..").ResourceNotFoundError | import("effect/Schema").SchemaError | import("..").UnauthorizedError | import("..").ValidationError, Service>;
54
+ export declare const stripUndefined: <Value>(input: Value) => Value;
55
+ /**
56
+ * Operation factory for one API group. Each domain module binds its own group, so importing it
57
+ * loads that group's schemas and nothing else.
58
+ */
59
+ export declare const forGroup: (group: HttpApiGroup.Constraint) => <Name extends SdkOperation>(operationName: Name) => WithPagination<OperationFunction<Name>>;
60
+ /** Call one endpoint with an already-shaped request, outside the direct-operation adapter. */
61
+ export declare const callEndpoint: (group: HttpApiGroup.Constraint, name: SdkOperation, request: unknown) => Effect.Effect<unknown, unknown, Service>;
122
62
  export {};
@@ -0,0 +1,60 @@
1
+ import { Effect } from "effect";
2
+ import { type MediaUploadError } from "../../inline-attachments";
3
+ import type { SendMessagePayload } from "../generated/scheduled-messages";
4
+ import { type FlatRaw, Service } from "./client";
5
+ import { type MethodReturn } from "./operation";
6
+ type MessagePayload = typeof SendMessagePayload.Encoded;
7
+ export type MessageRecipient = MessagePayload["to"][number];
8
+ type ContactObjectRecipient = {
9
+ readonly id: string;
10
+ };
11
+ type ErgonomicMessageRecipient = MessageRecipient | ContactObjectRecipient | string;
12
+ type EmailPayload = Extract<MessagePayload, {
13
+ readonly channel: "email";
14
+ }>;
15
+ type ErgonomicReplyTo = string | ReadonlyArray<string>;
16
+ export type ErgonomicEmailList = string | ReadonlyArray<string>;
17
+ type ErgonomicEmailContent = Omit<EmailPayload["email"], "replyTo"> & {
18
+ readonly replyTo?: ErgonomicReplyTo | null | undefined;
19
+ };
20
+ export interface SendOptions {
21
+ readonly idempotencyKey?: string;
22
+ }
23
+ export type MessageSendInput = Omit<EmailPayload, "to" | "cc" | "bcc" | "email"> & {
24
+ readonly to: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
25
+ readonly cc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient> | null;
26
+ readonly bcc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient> | null;
27
+ readonly email: ErgonomicEmailContent;
28
+ };
29
+ export type EmailSendInput = Omit<EmailPayload, "channel" | "email" | "to" | "cc" | "bcc"> & ErgonomicEmailContent & {
30
+ readonly to: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
31
+ readonly cc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
32
+ readonly bcc?: ErgonomicMessageRecipient | ReadonlyArray<ErgonomicMessageRecipient>;
33
+ };
34
+ type SendResult = MethodReturn<FlatRaw["messagesSend"]>;
35
+ type UploadFailure = MediaUploadError | Effect.Error<SendResult>;
36
+ export declare const sendMessage: (input: MessageSendInput, options?: SendOptions | undefined) => Effect.Effect<{
37
+ readonly id: string & import("effect/Brand").Brand<"MessageId">;
38
+ readonly status: "bounced" | "complained" | "delivered" | "failed" | "pending" | "processing" | "queued" | "read" | "scheduled" | "sent";
39
+ readonly waitReason: "campaign-paused" | "content-review" | "daily-quota" | "domain-health" | "domain-warming" | "onboarding-review" | "rate" | "retry" | "screening-unavailable" | "sending-paused" | "upstream-unavailable" | null;
40
+ readonly reviewExpectedAt: string | null;
41
+ readonly skippedRecipients: readonly {
42
+ readonly address: string;
43
+ readonly reason: "bounce" | "complaint" | "group-unsubscribe" | "manual" | "unsubscribe";
44
+ readonly unsubscribeGroupId?: (string & import("effect/Brand").Brand<"UnsubscribeId">) | null;
45
+ }[];
46
+ readonly createdAt: string;
47
+ }, UploadFailure, Service>;
48
+ export declare const sendEmail: (input: EmailSendInput, options?: SendOptions | undefined) => Effect.Effect<{
49
+ readonly id: string & import("effect/Brand").Brand<"MessageId">;
50
+ readonly status: "bounced" | "complained" | "delivered" | "failed" | "pending" | "processing" | "queued" | "read" | "scheduled" | "sent";
51
+ readonly waitReason: "campaign-paused" | "content-review" | "daily-quota" | "domain-health" | "domain-warming" | "onboarding-review" | "rate" | "retry" | "screening-unavailable" | "sending-paused" | "upstream-unavailable" | null;
52
+ readonly reviewExpectedAt: string | null;
53
+ readonly skippedRecipients: readonly {
54
+ readonly address: string;
55
+ readonly reason: "bounce" | "complaint" | "group-unsubscribe" | "manual" | "unsubscribe";
56
+ readonly unsubscribeGroupId?: (string & import("effect/Brand").Brand<"UnsubscribeId">) | null;
57
+ }[];
58
+ readonly createdAt: string;
59
+ }, UploadFailure, Service>;
60
+ export {};