samva 0.17.0 → 0.18.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 (124) hide show
  1. package/AGENTS.md +5 -0
  2. package/README.md +16 -3
  3. package/dist/{rolldown-runtime-D7D4PA-g.js → _virtual/_rolldown/runtime.js} +1 -1
  4. package/dist/client/client/client.gen.js +174 -0
  5. package/dist/client/client/utils.gen.js +177 -0
  6. package/dist/client/client.gen.js +8 -0
  7. package/dist/client/core/auth.gen.js +12 -0
  8. package/dist/client/core/bodySerializer.gen.js +6 -0
  9. package/dist/client/core/params.gen.js +77 -0
  10. package/dist/client/core/pathSerializer.gen.js +82 -0
  11. package/dist/client/core/serverSentEvents.gen.js +96 -0
  12. package/dist/client/core/utils.gen.js +78 -0
  13. package/dist/{promises---Kbh-7z.js → client/sdk.gen.js} +4 -2293
  14. package/dist/client-attribution.js +9 -0
  15. package/dist/effect/analytics.d.ts +6 -6
  16. package/dist/effect/analytics.js +23 -2
  17. package/dist/effect/api-keys.d.ts +12 -12
  18. package/dist/effect/api-keys.js +29 -2
  19. package/dist/effect/attachments.d.ts +4 -4
  20. package/dist/effect/attachments.js +19 -2
  21. package/dist/effect/brands.d.ts +6 -6
  22. package/dist/effect/brands.js +26 -3
  23. package/dist/effect/campaigns.d.ts +18 -18
  24. package/dist/effect/campaigns.js +35 -2
  25. package/dist/effect/categories.d.ts +2 -2
  26. package/dist/effect/categories.js +95 -1
  27. package/dist/effect/client.js +3 -3
  28. package/dist/effect/contact-groups.d.ts +14 -14
  29. package/dist/effect/contact-groups.js +31 -2
  30. package/dist/effect/contacts.d.ts +28 -28
  31. package/dist/effect/contacts.js +52 -2
  32. package/dist/effect/conversations.d.ts +17 -17
  33. package/dist/effect/conversations.js +37 -2
  34. package/dist/effect/custom-fields.d.ts +4 -4
  35. package/dist/effect/custom-fields.js +19 -2
  36. package/dist/effect/email.d.ts +75 -75
  37. package/dist/effect/email.js +140 -2
  38. package/dist/effect/errors.d.ts +2 -0
  39. package/dist/effect/errors.js +3 -0
  40. package/dist/effect/events.d.ts +2 -2
  41. package/dist/effect/events.js +17 -3
  42. package/dist/effect/extension-installations.d.ts +11 -11
  43. package/dist/effect/extension-installations.js +29 -2
  44. package/dist/effect/extensions.d.ts +9 -9
  45. package/dist/effect/extensions.js +21 -2
  46. package/dist/effect/feedback.d.ts +1 -1
  47. package/dist/effect/feedback.js +14 -3
  48. package/dist/{analytics-CaqPRsry.js → effect/generated/analytics.js} +4 -23
  49. package/dist/{api-keys-Ce1Y4_Ip.js → effect/generated/api-keys.js} +4 -29
  50. package/dist/{attachments-DYqVIraC.js → effect/generated/attachments.js} +3 -18
  51. package/dist/{brands-ZwuOGIWO.js → effect/generated/brands.js} +5 -25
  52. package/dist/{campaigns-DZlz1E9E.js → effect/generated/campaigns.js} +4 -35
  53. package/dist/effect/generated/contact-events.js +37 -0
  54. package/dist/{contact-groups-BLbFXnjq.js → effect/generated/contact-groups.js} +3 -30
  55. package/dist/{contacts-BbsoXXB4.js → effect/generated/contacts.js} +3 -81
  56. package/dist/{conversations-_sRHueML.js → effect/generated/conversations.js} +3 -36
  57. package/dist/{custom-fields-BHWbwlKn.js → effect/generated/custom-fields.js} +5 -19
  58. package/dist/{email-R0NAA9PW.js → effect/generated/email.js} +995 -1146
  59. package/dist/{events-CxbTUHYT.js → effect/generated/events.js} +3 -15
  60. package/dist/{extension-installations-CD94LPmk.js → effect/generated/extension-installations.js} +4 -29
  61. package/dist/{extensions-BKyNQLvu.js → effect/generated/extensions.js} +3 -20
  62. package/dist/{feedback-Bpa09JOS.js → effect/generated/feedback.js} +3 -12
  63. package/dist/{journeys-CARo_BJT.js → effect/generated/journeys.js} +3 -38
  64. package/dist/{mailboxes-BRDn7BIK.js → effect/generated/mailboxes.js} +793 -951
  65. package/dist/{media-VrrtNnft.js → effect/generated/media.js} +3 -3
  66. package/dist/effect/generated/messages.js +671 -0
  67. package/dist/{namespaces-CcvEbG-y.js → effect/generated/namespaces.js} +3 -20
  68. package/dist/{operations-CmB3FHwf.js → effect/generated/operations.js} +3 -16
  69. package/dist/{organizations-A-plufWc.js → effect/generated/organizations.js} +3 -24
  70. package/dist/{scheduled-messages-DkKZRRaN.js → effect/generated/scheduled-messages.js} +4 -21
  71. package/dist/effect/generated/shared.js +1053 -0
  72. package/dist/{subscriptions-DEXYtMXg.js → effect/generated/subscriptions.js} +3 -9
  73. package/dist/{templates-DZomxsG7.js → effect/generated/templates.js} +3 -78
  74. package/dist/{unsubscribe-groups-Iqk4Isf9.js → effect/generated/unsubscribe-groups.js} +5 -29
  75. package/dist/{webhooks-CPXuu8Xf.js → effect/generated/webhooks.js} +4 -34
  76. package/dist/{whoami-Ccz0jwlt.js → effect/generated/whoami.js} +5 -10
  77. package/dist/{categories-CA4XIQAb.js → effect/generated-metadata.js} +2 -94
  78. package/dist/effect/index.d.ts +1 -2
  79. package/dist/effect/index.js +32 -32
  80. package/dist/effect/internal/client.js +69 -0
  81. package/dist/effect/internal/email-sender.js +21 -0
  82. package/dist/effect/internal/mailbox-events.js +33 -0
  83. package/dist/effect/internal/operation.js +116 -0
  84. package/dist/effect/internal/send.js +56 -0
  85. package/dist/effect/journeys.d.ts +18 -18
  86. package/dist/effect/journeys.js +39 -2
  87. package/dist/effect/mailboxes.d.ts +191 -191
  88. package/dist/effect/mailboxes.js +135 -3
  89. package/dist/effect/media.d.ts +5 -5
  90. package/dist/effect/media.js +10 -10
  91. package/dist/effect/messages.d.ts +14 -14
  92. package/dist/effect/messages.js +15 -14
  93. package/dist/effect/namespaces.d.ts +7 -7
  94. package/dist/effect/namespaces.js +21 -2
  95. package/dist/effect/operations.d.ts +5 -5
  96. package/dist/effect/operations.js +17 -2
  97. package/dist/effect/organizations.d.ts +7 -7
  98. package/dist/effect/organizations.js +25 -2
  99. package/dist/effect/pagination.js +39 -0
  100. package/dist/effect/retry.js +3 -3
  101. package/dist/{runtime-P0l1_2-C.js → effect/runtime.js} +2 -2
  102. package/dist/effect/scheduled-messages.d.ts +7 -7
  103. package/dist/effect/scheduled-messages.js +21 -2
  104. package/dist/effect/subscriptions.d.ts +1 -1
  105. package/dist/effect/subscriptions.js +10 -2
  106. package/dist/effect/templates.d.ts +39 -39
  107. package/dist/effect/templates.js +80 -3
  108. package/dist/effect/unsubscribe-groups.d.ts +11 -11
  109. package/dist/effect/unsubscribe-groups.js +29 -2
  110. package/dist/effect/webhooks.d.ts +14 -14
  111. package/dist/effect/webhooks.js +35 -3
  112. package/dist/effect/whoami.d.ts +9 -9
  113. package/dist/effect/whoami.js +10 -2
  114. package/dist/index.js +4 -3
  115. package/dist/{inline-attachments-Bi1hDltp.js → inline-attachments.js} +13 -7
  116. package/dist/{mailbox-events-VKR4f3qq.js → mailbox-events.js} +2 -2
  117. package/dist/{normalize-B79uJIeb.js → normalize.js} +2 -2
  118. package/dist/package.js +6 -0
  119. package/dist/promises/errors.gen.js +1340 -0
  120. package/dist/promises/index.js +288 -3
  121. package/dist/{operation-n_IYgNVK.js → service-map.js} +2 -148
  122. package/package.json +6 -2
  123. package/dist/client-DOzUrdTE.js +0 -1115
  124. package/dist/send-Bxc0XfGE.js +0 -722
@@ -1,722 +0,0 @@
1
- import { a as withUploadedAttachments, n as mediaCreateBody, r as planInlineUploads } from "./inline-attachments-Bi1hDltp.js";
2
- import { n as buildMessagesSendPayload, t as buildEmailSendPayload } from "./normalize-B79uJIeb.js";
3
- import { $t as UserId, A as EmailBccRecipients, Ct as MessageId, D as Cursor, G as FlagDisabledError, I as EmailRecipients, Jt as UnauthorizedError, K as ForbiddenError, L as EmailSender, Lt as ResourceNotFoundError, N as EmailContent, Nt as PaymentRequiredError, O as DeliveryUnavailableError, Ot as OnboardingReviewRequiredError, Pt as RateLimitedError, St as MediaId, Tt as MessagePage, U as ExternalServiceError, Vt as SkippedRecipient, Y as InternalError, c as AttachmentId, en as ValidationError, et as JsonValue, j as EmailCcRecipients, l as BillingProviderError, m as ConflictError, o as ApiKeyId, q as GatewayTimeoutError, s as ApiKeySecurityMiddleware, t as Service, v as ContactId, wt as MessageMetadata, x as ConversationId, z as EmailTrackingOverrideV1, zt as SenderNotReadyError } from "./client-DOzUrdTE.js";
4
- import { r as stripUndefined, t as callEndpoint } from "./operation-n_IYgNVK.js";
5
- import { generateIdempotencyKey, withRetry } from "./effect/retry.js";
6
- import { t as MediaGroup } from "./media-VrrtNnft.js";
7
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
8
- import * as Schema$1 from "effect/Schema";
9
- import { Effect } from "effect";
10
- //#region src/effect/generated/messages.ts
11
- const MessageSender = /* @__PURE__ */ Schema$1.Struct({
12
- address: Schema$1.String,
13
- name: Schema$1.Union([Schema$1.String, Schema$1.Null])
14
- }).annotate({ identifier: "MessageSender" });
15
- const SubmissionClient = /* @__PURE__ */ Schema$1.Struct({
16
- surface: Schema$1.Union([
17
- Schema$1.Literal("typescript-promise"),
18
- Schema$1.Literal("typescript-effect"),
19
- Schema$1.Literal("cli"),
20
- Schema$1.Literal("mcp")
21
- ]),
22
- version: Schema$1.String
23
- }).annotate({ identifier: "SubmissionClient" });
24
- const MessageDeliveryId = /* @__PURE__ */ Schema$1.String.check(Schema$1.isPattern(/* @__PURE__ */ new RegExp("^mdel_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
25
- expected: "a string matching the RegExp ^mdel_[0-9a-hjkmnp-tv-z]{16,24}$",
26
- identifier: "MessageDeliveryId"
27
- })).pipe(Schema$1.brand("MessageDeliveryId"));
28
- const MessageDeliveryError = /* @__PURE__ */ Schema$1.Struct({
29
- code: Schema$1.Union([Schema$1.String, Schema$1.Null]),
30
- message: Schema$1.Union([Schema$1.String, Schema$1.Null]),
31
- retryable: Schema$1.Union([Schema$1.Boolean, Schema$1.Null])
32
- }).annotate({ identifier: "MessageDeliveryError" });
33
- const DeliveryErrorDetails = /* @__PURE__ */ Schema$1.Struct({
34
- code: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
35
- name: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
36
- message: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
37
- details: Schema$1.optionalKey(Schema$1.Union([Schema$1.Record(Schema$1.String, Schema$1.Union([
38
- Schema$1.String,
39
- Schema$1.Finite.check(Schema$1.isFinite().annotate({ expected: "a finite number" })),
40
- Schema$1.Null
41
- ])), Schema$1.Null])),
42
- retryable: Schema$1.optionalKey(Schema$1.Union([Schema$1.Boolean, Schema$1.Null]))
43
- }).annotate({ identifier: "DeliveryErrorDetails" });
44
- const EmailAddress = /* @__PURE__ */ Schema$1.Struct({
45
- email: Schema$1.String,
46
- name: Schema$1.Union([Schema$1.String, Schema$1.Null])
47
- }).annotate({ identifier: "EmailAddress" });
48
- const MessageEventId = /* @__PURE__ */ Schema$1.String.check(Schema$1.isPattern(/* @__PURE__ */ new RegExp("^mevt_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
49
- expected: "a string matching the RegExp ^mevt_[0-9a-hjkmnp-tv-z]{16,24}$",
50
- identifier: "MessageEventId"
51
- })).pipe(Schema$1.brand("MessageEventId"));
52
- const ValidateEmailResponse = /* @__PURE__ */ Schema$1.Struct({
53
- valid: Schema$1.Literal(true),
54
- from: Schema$1.Struct({
55
- email: Schema$1.String,
56
- name: Schema$1.Union([Schema$1.String, Schema$1.Null])
57
- }),
58
- recipientCount: Schema$1.Finite.check(Schema$1.isInt().annotate({ expected: "an integer" })),
59
- content: Schema$1.Struct({
60
- source: Schema$1.Union([Schema$1.Literal("inline"), Schema$1.Literal("template")]),
61
- subject: Schema$1.String,
62
- hasHtml: Schema$1.Boolean,
63
- hasText: Schema$1.Boolean
64
- })
65
- }).annotate({ identifier: "ValidateEmailResponse" });
66
- const SubmissionCredential = /* @__PURE__ */ Schema$1.Union([
67
- Schema$1.Struct({
68
- kind: Schema$1.Literal("api_key"),
69
- apiKeyId: Schema$1.Union([ApiKeyId, Schema$1.Null])
70
- }),
71
- Schema$1.Struct({
72
- kind: Schema$1.Literal("oauth"),
73
- clientId: Schema$1.Union([Schema$1.String, Schema$1.Null])
74
- }),
75
- Schema$1.Struct({ kind: Schema$1.Literal("session") })
76
- ]).annotate({ identifier: "SubmissionCredential" });
77
- const MessageContent = /* @__PURE__ */ Schema$1.Struct({
78
- text: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
79
- html: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
80
- markdown: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
81
- email: Schema$1.optionalKey(Schema$1.Union([Schema$1.Struct({
82
- subject: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
83
- html: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
84
- text: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
85
- headers: Schema$1.optionalKey(Schema$1.Union([Schema$1.Record(Schema$1.String, Schema$1.String), Schema$1.Null])),
86
- tracking: Schema$1.optionalKey(EmailTrackingOverrideV1),
87
- attachments: Schema$1.optionalKey(Schema$1.Union([Schema$1.Array(Schema$1.Struct({
88
- filename: Schema$1.String,
89
- contentId: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
90
- isInline: Schema$1.optionalKey(Schema$1.Union([Schema$1.Boolean, Schema$1.Null])),
91
- content: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
92
- mediaId: Schema$1.optionalKey(Schema$1.Union([MediaId, Schema$1.Null])),
93
- contentType: Schema$1.String,
94
- size: Schema$1.Finite.check(Schema$1.isFinite().annotate({ expected: "a finite number" }))
95
- })), Schema$1.Null]))
96
- }), Schema$1.Null])),
97
- metadata: Schema$1.optionalKey(Schema$1.Union([Schema$1.Record(Schema$1.String, JsonValue), Schema$1.Null]))
98
- }).annotate({ identifier: "MessageContent" });
99
- const MessageAddress = /* @__PURE__ */ Schema$1.Struct({
100
- address: Schema$1.String,
101
- contactId: Schema$1.Union([ContactId, Schema$1.Null])
102
- }).annotate({ identifier: "MessageAddress" });
103
- const MessageDelivery = /* @__PURE__ */ Schema$1.Struct({
104
- id: MessageDeliveryId,
105
- recipient: Schema$1.Union([Schema$1.String, Schema$1.Null]),
106
- status: Schema$1.Union([
107
- Schema$1.Literal("pending"),
108
- Schema$1.Literal("scheduled"),
109
- Schema$1.Literal("queued"),
110
- Schema$1.Literal("processing"),
111
- Schema$1.Literal("sent"),
112
- Schema$1.Literal("delivered"),
113
- Schema$1.Literal("read"),
114
- Schema$1.Literal("failed"),
115
- Schema$1.Literal("bounced"),
116
- Schema$1.Literal("complained")
117
- ]),
118
- attemptCount: Schema$1.Finite.check(Schema$1.isFinite().annotate({ expected: "a finite number" })),
119
- waitReason: Schema$1.Union([Schema$1.Union([
120
- Schema$1.Literal("rate"),
121
- Schema$1.Literal("daily-quota"),
122
- Schema$1.Literal("domain-health"),
123
- Schema$1.Literal("sending-paused"),
124
- Schema$1.Literal("upstream-unavailable"),
125
- Schema$1.Literal("retry"),
126
- Schema$1.Literal("campaign-paused"),
127
- Schema$1.Literal("domain-warming"),
128
- Schema$1.Literal("onboarding-review"),
129
- Schema$1.Literal("content-review"),
130
- Schema$1.Literal("screening-unavailable")
131
- ]), Schema$1.Null]),
132
- nextRetryAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
133
- sentAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
134
- deliveredAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
135
- readAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
136
- failedAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
137
- error: Schema$1.Union([MessageDeliveryError, Schema$1.Null]),
138
- createdAt: Schema$1.String,
139
- updatedAt: Schema$1.String
140
- }).annotate({ identifier: "MessageDelivery" });
141
- const MessageEventPage = /* @__PURE__ */ Schema$1.Struct({
142
- items: Schema$1.Array(Schema$1.Struct({
143
- id: MessageEventId,
144
- messageId: MessageId,
145
- eventType: Schema$1.String,
146
- status: Schema$1.String,
147
- timestamp: Schema$1.String,
148
- metadata: Schema$1.optionalKey(Schema$1.Union([Schema$1.Record(Schema$1.String, JsonValue), Schema$1.Null]))
149
- })),
150
- nextCursor: Schema$1.Union([Schema$1.String, Schema$1.Null])
151
- }).annotate({ identifier: "MessageEventPage" });
152
- const MessageSubmission = /* @__PURE__ */ Schema$1.Struct({
153
- origin: Schema$1.Union([
154
- Schema$1.Literal("direct"),
155
- Schema$1.Literal("campaign"),
156
- Schema$1.Literal("scheduled"),
157
- Schema$1.Literal("mailbox"),
158
- Schema$1.Literal("forwarding"),
159
- Schema$1.Literal("journey")
160
- ]),
161
- transport: Schema$1.Union([Schema$1.Literal("http"), Schema$1.Null]),
162
- credential: Schema$1.Union([SubmissionCredential, Schema$1.Null]),
163
- userId: Schema$1.Union([UserId, Schema$1.Null]),
164
- client: Schema$1.Union([SubmissionClient, Schema$1.Null])
165
- }).annotate({ identifier: "MessageSubmission" });
166
- const MessageReceipt = /* @__PURE__ */ Schema$1.Struct({
167
- id: MessageId,
168
- status: Schema$1.Union([
169
- Schema$1.Literal("pending"),
170
- Schema$1.Literal("scheduled"),
171
- Schema$1.Literal("queued"),
172
- Schema$1.Literal("processing"),
173
- Schema$1.Literal("sent"),
174
- Schema$1.Literal("delivered"),
175
- Schema$1.Literal("read"),
176
- Schema$1.Literal("failed"),
177
- Schema$1.Literal("bounced"),
178
- Schema$1.Literal("complained")
179
- ]),
180
- waitReason: Schema$1.Union([Schema$1.Union([
181
- Schema$1.Literal("rate"),
182
- Schema$1.Literal("daily-quota"),
183
- Schema$1.Literal("domain-health"),
184
- Schema$1.Literal("sending-paused"),
185
- Schema$1.Literal("upstream-unavailable"),
186
- Schema$1.Literal("retry"),
187
- Schema$1.Literal("campaign-paused"),
188
- Schema$1.Literal("domain-warming"),
189
- Schema$1.Literal("onboarding-review"),
190
- Schema$1.Literal("content-review"),
191
- Schema$1.Literal("screening-unavailable")
192
- ]), Schema$1.Null]),
193
- reviewExpectedAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
194
- skippedRecipients: Schema$1.Array(SkippedRecipient),
195
- createdAt: Schema$1.String
196
- }).annotate({ identifier: "MessageReceipt" });
197
- const MessageDeliveryList = /* @__PURE__ */ Schema$1.Struct({ items: Schema$1.Array(MessageDelivery) }).annotate({ identifier: "MessageDeliveryList" });
198
- const Message = /* @__PURE__ */ Schema$1.Struct({
199
- id: MessageId,
200
- channel: Schema$1.Literal("email"),
201
- direction: Schema$1.Union([Schema$1.Literal("outbound"), Schema$1.Literal("inbound")]),
202
- status: Schema$1.Union([
203
- Schema$1.Literal("pending"),
204
- Schema$1.Literal("scheduled"),
205
- Schema$1.Literal("queued"),
206
- Schema$1.Literal("processing"),
207
- Schema$1.Literal("sent"),
208
- Schema$1.Literal("delivered"),
209
- Schema$1.Literal("read"),
210
- Schema$1.Literal("failed"),
211
- Schema$1.Literal("bounced"),
212
- Schema$1.Literal("complained")
213
- ]),
214
- from: Schema$1.Union([MessageSender, Schema$1.Null]),
215
- to: Schema$1.Array(MessageAddress),
216
- cc: Schema$1.Array(MessageAddress),
217
- bcc: Schema$1.Array(MessageAddress),
218
- replyTo: Schema$1.Array(Schema$1.String),
219
- subject: Schema$1.Union([Schema$1.String, Schema$1.Null]),
220
- conversationId: Schema$1.Union([ConversationId, Schema$1.Null]),
221
- inReplyToMessageId: Schema$1.Union([MessageId, Schema$1.Null]),
222
- tags: Schema$1.Array(Schema$1.String),
223
- metadata: Schema$1.Union([Schema$1.Record(Schema$1.String, JsonValue), Schema$1.Null]),
224
- isTest: Schema$1.Boolean,
225
- scheduledAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
226
- submission: Schema$1.Union([MessageSubmission, Schema$1.Null]),
227
- waitReason: Schema$1.Union([Schema$1.Union([
228
- Schema$1.Literal("rate"),
229
- Schema$1.Literal("daily-quota"),
230
- Schema$1.Literal("domain-health"),
231
- Schema$1.Literal("sending-paused"),
232
- Schema$1.Literal("upstream-unavailable"),
233
- Schema$1.Literal("retry"),
234
- Schema$1.Literal("campaign-paused"),
235
- Schema$1.Literal("domain-warming"),
236
- Schema$1.Literal("onboarding-review"),
237
- Schema$1.Literal("content-review"),
238
- Schema$1.Literal("screening-unavailable")
239
- ]), Schema$1.Null]),
240
- reviewExpectedAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
241
- skippedRecipients: Schema$1.Array(SkippedRecipient),
242
- createdAt: Schema$1.String,
243
- updatedAt: Schema$1.String
244
- }).annotate({ identifier: "Message" });
245
- const MessagesListQuery = /* @__PURE__ */ Schema$1.Struct({
246
- limit: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
247
- cursor: Schema$1.optionalKey(Schema$1.Union([Cursor, Schema$1.Null])),
248
- channel: Schema$1.optionalKey(Schema$1.Union([Schema$1.Literal("email"), Schema$1.Null])),
249
- direction: Schema$1.optionalKey(Schema$1.Union([Schema$1.Union([Schema$1.Literal("outbound"), Schema$1.Literal("inbound")]), Schema$1.Null])),
250
- status: Schema$1.optionalKey(Schema$1.Union([Schema$1.Union([
251
- Schema$1.Literal("pending"),
252
- Schema$1.Literal("scheduled"),
253
- Schema$1.Literal("queued"),
254
- Schema$1.Literal("processing"),
255
- Schema$1.Literal("sent"),
256
- Schema$1.Literal("delivered"),
257
- Schema$1.Literal("read"),
258
- Schema$1.Literal("failed"),
259
- Schema$1.Literal("bounced"),
260
- Schema$1.Literal("complained")
261
- ]), Schema$1.Null])),
262
- conversationId: Schema$1.optionalKey(Schema$1.Union([ConversationId, Schema$1.Null])),
263
- contactId: Schema$1.optionalKey(Schema$1.Union([ContactId, Schema$1.Null])),
264
- from: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
265
- after: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
266
- before: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null]))
267
- });
268
- const MessagesList200 = MessagePage;
269
- const MessagesList401 = UnauthorizedError;
270
- const MessagesList403 = ForbiddenError;
271
- const MessagesList422 = ValidationError;
272
- const MessagesList500 = InternalError;
273
- const MessagesList504 = GatewayTimeoutError;
274
- const MessagesSendHeaders = /* @__PURE__ */ Schema$1.Struct({ "idempotency-key": Schema$1.optionalKey(Schema$1.Union([Schema$1.String.annotate({ description: "Optional org-scoped key that makes a send idempotent. Repeating a request with the same key and identical payload replays the original 201 response; reusing the key with different content returns 409." }).check(Schema$1.isPattern(/* @__PURE__ */ new RegExp("^[\\s\\S]{1,255}$")).annotate({ expected: "a string matching the RegExp ^[\\s\\S]{1,255}$" })), Schema$1.Null])) });
275
- const MessagesSendRequestJson = /* @__PURE__ */ Schema$1.Struct({
276
- conversationId: Schema$1.optionalKey(Schema$1.Union([Schema$1.Union([ConversationId, Schema$1.Null]), Schema$1.Null])),
277
- metadata: Schema$1.optionalKey(MessageMetadata),
278
- channel: Schema$1.Literal("email"),
279
- to: EmailRecipients,
280
- cc: Schema$1.optionalKey(EmailCcRecipients),
281
- bcc: Schema$1.optionalKey(EmailBccRecipients),
282
- from: Schema$1.optionalKey(EmailSender),
283
- email: EmailContent
284
- });
285
- const MessagesSend201 = MessageReceipt;
286
- const MessagesSend401 = UnauthorizedError;
287
- const MessagesSend402 = PaymentRequiredError;
288
- const MessagesSend403 = /* @__PURE__ */ Schema$1.Union([
289
- ForbiddenError,
290
- OnboardingReviewRequiredError,
291
- FlagDisabledError
292
- ]);
293
- const MessagesSend404 = ResourceNotFoundError;
294
- const MessagesSend409 = ConflictError;
295
- const MessagesSend422 = ValidationError;
296
- const MessagesSend429 = RateLimitedError;
297
- const MessagesSend500 = InternalError;
298
- const MessagesSend502 = /* @__PURE__ */ Schema$1.Union([BillingProviderError, ExternalServiceError]);
299
- const MessagesSend503 = /* @__PURE__ */ Schema$1.Union([SenderNotReadyError, DeliveryUnavailableError]);
300
- const MessagesSend504 = GatewayTimeoutError;
301
- const MessagesGetPathParams = /* @__PURE__ */ Schema$1.Struct({ id: MessageId });
302
- const MessagesGet200 = Message;
303
- const MessagesGet401 = UnauthorizedError;
304
- const MessagesGet403 = ForbiddenError;
305
- const MessagesGet404 = ResourceNotFoundError;
306
- const MessagesGet422 = ValidationError;
307
- const MessagesGet500 = InternalError;
308
- const MessagesGet504 = GatewayTimeoutError;
309
- const MessagesRemovePathParams = /* @__PURE__ */ Schema$1.Struct({ id: MessageId });
310
- const MessagesRemove200 = /* @__PURE__ */ Schema$1.Struct({
311
- success: Schema$1.Boolean,
312
- message: Schema$1.String
313
- });
314
- const MessagesRemove401 = UnauthorizedError;
315
- const MessagesRemove403 = ForbiddenError;
316
- const MessagesRemove404 = ResourceNotFoundError;
317
- const MessagesRemove422 = ValidationError;
318
- const MessagesRemove500 = InternalError;
319
- const MessagesRemove502 = BillingProviderError;
320
- const MessagesRemove504 = GatewayTimeoutError;
321
- const MessagesGetContentPathParams = /* @__PURE__ */ Schema$1.Struct({ id: MessageId });
322
- const MessagesGetContent200 = MessageContent;
323
- const MessagesGetContent401 = UnauthorizedError;
324
- const MessagesGetContent403 = ForbiddenError;
325
- const MessagesGetContent404 = ResourceNotFoundError;
326
- const MessagesGetContent422 = ValidationError;
327
- const MessagesGetContent500 = InternalError;
328
- const MessagesGetContent504 = GatewayTimeoutError;
329
- const MessagesListDeliveriesPathParams = /* @__PURE__ */ Schema$1.Struct({ id: MessageId });
330
- const MessagesListDeliveries200 = MessageDeliveryList;
331
- const MessagesListDeliveries401 = UnauthorizedError;
332
- const MessagesListDeliveries403 = ForbiddenError;
333
- const MessagesListDeliveries404 = ResourceNotFoundError;
334
- const MessagesListDeliveries422 = ValidationError;
335
- const MessagesListDeliveries500 = InternalError;
336
- const MessagesListDeliveries504 = GatewayTimeoutError;
337
- const MessagesGetEmailPathParams = /* @__PURE__ */ Schema$1.Struct({ id: MessageId });
338
- const MessagesGetEmailQuery = /* @__PURE__ */ Schema$1.Struct({
339
- includeDownloadUrls: Schema$1.optionalKey(Schema$1.Union([Schema$1.String.annotate({ contentMediaType: "application/json" }), Schema$1.Null])),
340
- urlExpiresIn: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null]))
341
- });
342
- const MessagesGetEmail200 = /* @__PURE__ */ Schema$1.Struct({
343
- deliveries: Schema$1.Array(Schema$1.Struct({
344
- scheduling: Schema$1.Union([Schema$1.Struct({
345
- dueAt: Schema$1.String,
346
- expiresAt: Schema$1.String,
347
- waitReason: Schema$1.Union([Schema$1.Union([
348
- Schema$1.Literal("rate"),
349
- Schema$1.Literal("daily-quota"),
350
- Schema$1.Literal("domain-health"),
351
- Schema$1.Literal("sending-paused"),
352
- Schema$1.Literal("upstream-unavailable"),
353
- Schema$1.Literal("retry"),
354
- Schema$1.Literal("campaign-paused"),
355
- Schema$1.Literal("domain-warming"),
356
- Schema$1.Literal("onboarding-review"),
357
- Schema$1.Literal("content-review"),
358
- Schema$1.Literal("screening-unavailable")
359
- ]), Schema$1.Null]),
360
- reviewExpectedAt: Schema$1.Union([Schema$1.String, Schema$1.Null])
361
- }), Schema$1.Null]),
362
- id: Schema$1.String,
363
- messageId: Schema$1.String,
364
- recipientId: Schema$1.Union([Schema$1.String, Schema$1.Null]),
365
- channel: Schema$1.Literal("email"),
366
- status: Schema$1.Union([
367
- Schema$1.Literal("pending"),
368
- Schema$1.Literal("scheduled"),
369
- Schema$1.Literal("queued"),
370
- Schema$1.Literal("processing"),
371
- Schema$1.Literal("sent"),
372
- Schema$1.Literal("delivered"),
373
- Schema$1.Literal("read"),
374
- Schema$1.Literal("failed"),
375
- Schema$1.Literal("bounced"),
376
- Schema$1.Literal("complained")
377
- ]),
378
- attemptCount: Schema$1.Finite.check(Schema$1.isFinite().annotate({ expected: "a finite number" })),
379
- maxAttempts: Schema$1.Finite.check(Schema$1.isFinite().annotate({ expected: "a finite number" })),
380
- queuedAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
381
- claimedAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
382
- lastAttemptAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
383
- nextRetryAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
384
- sentAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
385
- deliveredAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
386
- readAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
387
- failedAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
388
- terminalAt: Schema$1.Union([Schema$1.String, Schema$1.Null]),
389
- errorCode: Schema$1.Union([Schema$1.String, Schema$1.Null]),
390
- errorMessage: Schema$1.Union([Schema$1.String, Schema$1.Null]),
391
- errorDetails: Schema$1.Union([DeliveryErrorDetails, Schema$1.Null]),
392
- cost: Schema$1.String,
393
- currency: Schema$1.String,
394
- idempotencyKey: Schema$1.Union([Schema$1.String, Schema$1.Null]),
395
- createdAt: Schema$1.String,
396
- updatedAt: Schema$1.String
397
- })),
398
- id: MessageId,
399
- organizationId: Schema$1.String,
400
- conversationId: Schema$1.Union([ConversationId, Schema$1.Null]),
401
- status: Schema$1.Union([
402
- Schema$1.Literal("pending"),
403
- Schema$1.Literal("scheduled"),
404
- Schema$1.Literal("queued"),
405
- Schema$1.Literal("processing"),
406
- Schema$1.Literal("sent"),
407
- Schema$1.Literal("delivered"),
408
- Schema$1.Literal("read"),
409
- Schema$1.Literal("failed"),
410
- Schema$1.Literal("bounced"),
411
- Schema$1.Literal("complained")
412
- ]),
413
- channel: Schema$1.Literal("email"),
414
- direction: Schema$1.Union([Schema$1.Literal("outbound"), Schema$1.Literal("inbound")]),
415
- subject: Schema$1.Union([Schema$1.String, Schema$1.Null]),
416
- fromEmail: Schema$1.String,
417
- fromName: Schema$1.Union([Schema$1.String, Schema$1.Null]),
418
- toEmails: Schema$1.Array(EmailAddress),
419
- ccEmails: Schema$1.Union([Schema$1.Array(EmailAddress), Schema$1.Null]),
420
- bccEmails: Schema$1.Union([Schema$1.Array(EmailAddress), Schema$1.Null]),
421
- replyToEmails: Schema$1.Union([Schema$1.Array(Schema$1.String), Schema$1.Null]),
422
- messageIdHeader: Schema$1.String,
423
- inReplyTo: Schema$1.Union([Schema$1.String, Schema$1.Null]),
424
- references: Schema$1.Union([Schema$1.Array(Schema$1.String), Schema$1.Null]),
425
- threadPosition: Schema$1.Union([Schema$1.Finite.check(Schema$1.isInt().annotate({ expected: "an integer" })).check(Schema$1.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })), Schema$1.Null]),
426
- newContent: Schema$1.Union([Schema$1.String, Schema$1.Null]),
427
- quotedContent: Schema$1.Union([Schema$1.String, Schema$1.Null]),
428
- hasQuotedContent: Schema$1.Boolean,
429
- dkimVerdict: Schema$1.Union([Schema$1.Union([
430
- Schema$1.Literal("pass"),
431
- Schema$1.Literal("fail"),
432
- Schema$1.Literal("softfail"),
433
- Schema$1.Literal("neutral"),
434
- Schema$1.Literal("none"),
435
- Schema$1.Literal("policy"),
436
- Schema$1.Literal("temperror"),
437
- Schema$1.Literal("permerror")
438
- ]), Schema$1.Null]),
439
- spfVerdict: Schema$1.Union([Schema$1.Union([
440
- Schema$1.Literal("pass"),
441
- Schema$1.Literal("fail"),
442
- Schema$1.Literal("softfail"),
443
- Schema$1.Literal("neutral"),
444
- Schema$1.Literal("none"),
445
- Schema$1.Literal("policy"),
446
- Schema$1.Literal("temperror"),
447
- Schema$1.Literal("permerror")
448
- ]), Schema$1.Null]),
449
- dmarcVerdict: Schema$1.Union([Schema$1.Union([
450
- Schema$1.Literal("pass"),
451
- Schema$1.Literal("fail"),
452
- Schema$1.Literal("softfail"),
453
- Schema$1.Literal("neutral"),
454
- Schema$1.Literal("none"),
455
- Schema$1.Literal("policy"),
456
- Schema$1.Literal("temperror"),
457
- Schema$1.Literal("permerror")
458
- ]), Schema$1.Null]),
459
- isAutoReply: Schema$1.Boolean,
460
- autoReplyReason: Schema$1.Union([Schema$1.Union([
461
- Schema$1.Literal("out-of-office"),
462
- Schema$1.Literal("auto-response"),
463
- Schema$1.Literal("delivery-status"),
464
- Schema$1.Literal("read-receipt")
465
- ]), Schema$1.Null]),
466
- listUnsubscribeUrl: Schema$1.Union([Schema$1.String, Schema$1.Null]),
467
- listUnsubscribeEmail: Schema$1.Union([Schema$1.String, Schema$1.Null]),
468
- priority: Schema$1.Union([Schema$1.Union([
469
- Schema$1.Literal("high"),
470
- Schema$1.Literal("normal"),
471
- Schema$1.Literal("low")
472
- ]), Schema$1.Null]),
473
- parsingErrors: Schema$1.Union([Schema$1.Array(Schema$1.String), Schema$1.Null]),
474
- parsingDuration: Schema$1.Union([Schema$1.Finite.check(Schema$1.isFinite().annotate({ expected: "a finite number" })).check(Schema$1.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })), Schema$1.Null]),
475
- hasAttachments: Schema$1.Boolean,
476
- attachmentCount: Schema$1.Finite.check(Schema$1.isInt().annotate({ expected: "an integer" })).check(Schema$1.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })),
477
- attachments: Schema$1.Array(Schema$1.Struct({
478
- id: AttachmentId,
479
- filename: Schema$1.String,
480
- contentType: Schema$1.String,
481
- size: Schema$1.Finite.check(Schema$1.isInt().annotate({ expected: "an integer" })).check(Schema$1.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })),
482
- isInline: Schema$1.Boolean,
483
- contentId: Schema$1.Union([Schema$1.String, Schema$1.Null])
484
- })),
485
- downloadUrls: Schema$1.Union([Schema$1.Struct({
486
- rawMime: Schema$1.Union([Schema$1.String, Schema$1.Null]),
487
- html: Schema$1.Union([Schema$1.String, Schema$1.Null]),
488
- text: Schema$1.Union([Schema$1.String, Schema$1.Null]),
489
- expiresAt: Schema$1.String
490
- }), Schema$1.Null]),
491
- createdAt: Schema$1.String,
492
- receivedAt: Schema$1.Union([Schema$1.String, Schema$1.Null]).annotate({ description: "When Samva's receiving server accepted the email; null for outbound email. The sender's `Date` header plays no part and stays in the raw MIME." }),
493
- processedAt: Schema$1.Union([Schema$1.String, Schema$1.Null])
494
- });
495
- const MessagesGetEmail401 = UnauthorizedError;
496
- const MessagesGetEmail403 = ForbiddenError;
497
- const MessagesGetEmail404 = ResourceNotFoundError;
498
- const MessagesGetEmail422 = ValidationError;
499
- const MessagesGetEmail500 = InternalError;
500
- const MessagesGetEmail504 = GatewayTimeoutError;
501
- const MessagesGetEventsPathParams = /* @__PURE__ */ Schema$1.Struct({ id: MessageId });
502
- const MessagesGetEventsQuery = /* @__PURE__ */ Schema$1.Struct({
503
- limit: Schema$1.optionalKey(Schema$1.Union([Schema$1.String, Schema$1.Null])),
504
- cursor: Schema$1.optionalKey(Schema$1.Union([Cursor, Schema$1.Null]))
505
- });
506
- const MessagesGetEvents200 = MessageEventPage;
507
- const MessagesGetEvents401 = UnauthorizedError;
508
- const MessagesGetEvents403 = ForbiddenError;
509
- const MessagesGetEvents404 = ResourceNotFoundError;
510
- const MessagesGetEvents422 = ValidationError;
511
- const MessagesGetEvents500 = InternalError;
512
- const MessagesGetEvents504 = GatewayTimeoutError;
513
- const MessagesGetStatusPathParams = /* @__PURE__ */ Schema$1.Struct({ id: MessageId });
514
- const MessagesGetStatus200 = /* @__PURE__ */ Schema$1.Struct({
515
- id: MessageId,
516
- status: Schema$1.Union([
517
- Schema$1.Literal("pending"),
518
- Schema$1.Literal("scheduled"),
519
- Schema$1.Literal("queued"),
520
- Schema$1.Literal("processing"),
521
- Schema$1.Literal("sent"),
522
- Schema$1.Literal("delivered"),
523
- Schema$1.Literal("read"),
524
- Schema$1.Literal("failed"),
525
- Schema$1.Literal("bounced"),
526
- Schema$1.Literal("complained")
527
- ]),
528
- updatedAt: Schema$1.String
529
- });
530
- const MessagesGetStatus401 = UnauthorizedError;
531
- const MessagesGetStatus403 = ForbiddenError;
532
- const MessagesGetStatus404 = ResourceNotFoundError;
533
- const MessagesGetStatus422 = ValidationError;
534
- const MessagesGetStatus500 = InternalError;
535
- const MessagesGetStatus504 = GatewayTimeoutError;
536
- const MessagesValidateEmailRequestJson = /* @__PURE__ */ Schema$1.Struct({
537
- conversationId: Schema$1.optionalKey(Schema$1.Union([Schema$1.Union([ConversationId, Schema$1.Null]), Schema$1.Null])),
538
- metadata: Schema$1.optionalKey(MessageMetadata),
539
- channel: Schema$1.Literal("email"),
540
- to: EmailRecipients,
541
- cc: Schema$1.optionalKey(EmailCcRecipients),
542
- bcc: Schema$1.optionalKey(EmailBccRecipients),
543
- from: Schema$1.optionalKey(EmailSender),
544
- email: EmailContent
545
- });
546
- const MessagesValidateEmail200 = ValidateEmailResponse;
547
- const MessagesValidateEmail401 = UnauthorizedError;
548
- const MessagesValidateEmail403 = ForbiddenError;
549
- const MessagesValidateEmail404 = ResourceNotFoundError;
550
- const MessagesValidateEmail422 = ValidationError;
551
- const MessagesValidateEmail500 = InternalError;
552
- const MessagesValidateEmail503 = SenderNotReadyError;
553
- const MessagesValidateEmail504 = GatewayTimeoutError;
554
- var MessagesGroup = class extends HttpApiGroup.make("Messages").add(HttpApiEndpoint.get("messagesList", "/v1/messages", {
555
- query: MessagesListQuery,
556
- success: MessagesList200,
557
- error: [
558
- MessagesList401.pipe(HttpApiSchema.status(401)),
559
- MessagesList403.pipe(HttpApiSchema.status(403)),
560
- MessagesList422.pipe(HttpApiSchema.status(422)),
561
- MessagesList500,
562
- MessagesList504.pipe(HttpApiSchema.status(504))
563
- ]
564
- }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "messages.list").annotate(OpenApi.Summary, "List messages").annotate(OpenApi.Description, "Returns message summaries, newest first (oldest first when filtered by conversation), with optional filters for channel, direction, status, conversation, contact, sender address, and creation time. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page."), HttpApiEndpoint.post("messagesSend", "/v1/messages", {
565
- headers: MessagesSendHeaders,
566
- payload: MessagesSendRequestJson,
567
- success: MessagesSend201.pipe(HttpApiSchema.status(201)),
568
- error: [
569
- MessagesSend401.pipe(HttpApiSchema.status(401)),
570
- MessagesSend402.pipe(HttpApiSchema.status(402)),
571
- MessagesSend403.pipe(HttpApiSchema.status(403)),
572
- MessagesSend404.pipe(HttpApiSchema.status(404)),
573
- MessagesSend409.pipe(HttpApiSchema.status(409)),
574
- MessagesSend422.pipe(HttpApiSchema.status(422)),
575
- MessagesSend429.pipe(HttpApiSchema.status(429)),
576
- MessagesSend500,
577
- MessagesSend502.pipe(HttpApiSchema.status(502)),
578
- MessagesSend503.pipe(HttpApiSchema.status(503)),
579
- MessagesSend504.pipe(HttpApiSchema.status(504))
580
- ]
581
- }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "messages.send").annotate(OpenApi.Summary, "Send a message").annotate(OpenApi.Description, "Sends a message on the requested channel and returns its receipt (id, status, and why it waits when it does) with a 201 Created status. Requires `messages:create` or the send permission of the channel it sends on, such as `email:send`. `channel` selects the payload variant. Repeating an identical request with the same optional `Idempotency-Key` header returns the original receipt; reusing the key for different content returns a conflict."), HttpApiEndpoint.get("messagesGet", "/v1/messages/:id", {
582
- params: MessagesGetPathParams,
583
- success: MessagesGet200,
584
- error: [
585
- MessagesGet401.pipe(HttpApiSchema.status(401)),
586
- MessagesGet403.pipe(HttpApiSchema.status(403)),
587
- MessagesGet404.pipe(HttpApiSchema.status(404)),
588
- MessagesGet422.pipe(HttpApiSchema.status(422)),
589
- MessagesGet500,
590
- MessagesGet504.pipe(HttpApiSchema.status(504))
591
- ]
592
- }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "messages.get").annotate(OpenApi.Summary, "Get a message").annotate(OpenApi.Description, "Returns a message by its ID: addresses, subject, status, and why it is waiting when it is. Per-recipient delivery state and the body are their own reads."), HttpApiEndpoint.delete("messagesRemove", "/v1/messages/:id", {
593
- params: MessagesRemovePathParams,
594
- success: MessagesRemove200,
595
- error: [
596
- MessagesRemove401.pipe(HttpApiSchema.status(401)),
597
- MessagesRemove403.pipe(HttpApiSchema.status(403)),
598
- MessagesRemove404.pipe(HttpApiSchema.status(404)),
599
- MessagesRemove422.pipe(HttpApiSchema.status(422)),
600
- MessagesRemove500,
601
- MessagesRemove502.pipe(HttpApiSchema.status(502)),
602
- MessagesRemove504.pipe(HttpApiSchema.status(504))
603
- ]
604
- }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "messages.remove").annotate(OpenApi.Summary, "Delete a message").annotate(OpenApi.Description, "Permanently deletes a message by its ID."), HttpApiEndpoint.get("messagesGetContent", "/v1/messages/:id/content", {
605
- params: MessagesGetContentPathParams,
606
- success: MessagesGetContent200,
607
- error: [
608
- MessagesGetContent401.pipe(HttpApiSchema.status(401)),
609
- MessagesGetContent403.pipe(HttpApiSchema.status(403)),
610
- MessagesGetContent404.pipe(HttpApiSchema.status(404)),
611
- MessagesGetContent422.pipe(HttpApiSchema.status(422)),
612
- MessagesGetContent500,
613
- MessagesGetContent504.pipe(HttpApiSchema.status(504))
614
- ]
615
- }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "messages.getContent").annotate(OpenApi.Summary, "Get message content").annotate(OpenApi.Description, "Returns the content the message was sent or received with."), HttpApiEndpoint.get("messagesListDeliveries", "/v1/messages/:id/deliveries", {
616
- params: MessagesListDeliveriesPathParams,
617
- success: MessagesListDeliveries200,
618
- error: [
619
- MessagesListDeliveries401.pipe(HttpApiSchema.status(401)),
620
- MessagesListDeliveries403.pipe(HttpApiSchema.status(403)),
621
- MessagesListDeliveries404.pipe(HttpApiSchema.status(404)),
622
- MessagesListDeliveries422.pipe(HttpApiSchema.status(422)),
623
- MessagesListDeliveries500,
624
- MessagesListDeliveries504.pipe(HttpApiSchema.status(504))
625
- ]
626
- }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "messages.listDeliveries").annotate(OpenApi.Summary, "List message deliveries").annotate(OpenApi.Description, "Returns one delivery per recipient: its status, attempts, delivery times, and why it failed or is waiting."), HttpApiEndpoint.get("messagesGetEmail", "/v1/messages/:id/email", {
627
- params: MessagesGetEmailPathParams,
628
- query: MessagesGetEmailQuery,
629
- success: MessagesGetEmail200,
630
- error: [
631
- MessagesGetEmail401.pipe(HttpApiSchema.status(401)),
632
- MessagesGetEmail403.pipe(HttpApiSchema.status(403)),
633
- MessagesGetEmail404.pipe(HttpApiSchema.status(404)),
634
- MessagesGetEmail422.pipe(HttpApiSchema.status(422)),
635
- MessagesGetEmail500,
636
- MessagesGetEmail504.pipe(HttpApiSchema.status(504))
637
- ]
638
- }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "messages.getEmail").annotate(OpenApi.Summary, "Get email message details").annotate(OpenApi.Description, "Returns email delivery details for a message, optionally including signed URLs for its raw MIME, HTML, and text content."), HttpApiEndpoint.get("messagesGetEvents", "/v1/messages/:id/events", {
639
- params: MessagesGetEventsPathParams,
640
- query: MessagesGetEventsQuery,
641
- success: MessagesGetEvents200,
642
- error: [
643
- MessagesGetEvents401.pipe(HttpApiSchema.status(401)),
644
- MessagesGetEvents403.pipe(HttpApiSchema.status(403)),
645
- MessagesGetEvents404.pipe(HttpApiSchema.status(404)),
646
- MessagesGetEvents422.pipe(HttpApiSchema.status(422)),
647
- MessagesGetEvents500,
648
- MessagesGetEvents504.pipe(HttpApiSchema.status(504))
649
- ]
650
- }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "messages.getEvents").annotate(OpenApi.Summary, "List message events").annotate(OpenApi.Description, "Returns the delivery events recorded for a message, oldest first. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page."), HttpApiEndpoint.get("messagesGetStatus", "/v1/messages/:id/status", {
651
- params: MessagesGetStatusPathParams,
652
- success: MessagesGetStatus200,
653
- error: [
654
- MessagesGetStatus401.pipe(HttpApiSchema.status(401)),
655
- MessagesGetStatus403.pipe(HttpApiSchema.status(403)),
656
- MessagesGetStatus404.pipe(HttpApiSchema.status(404)),
657
- MessagesGetStatus422.pipe(HttpApiSchema.status(422)),
658
- MessagesGetStatus500,
659
- MessagesGetStatus504.pipe(HttpApiSchema.status(504))
660
- ]
661
- }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "messages.getStatus").annotate(OpenApi.Summary, "Get message delivery status").annotate(OpenApi.Description, "Returns the current delivery status of a message by its ID."), HttpApiEndpoint.post("messagesValidateEmail", "/v1/messages/validate/email", {
662
- payload: MessagesValidateEmailRequestJson,
663
- success: MessagesValidateEmail200,
664
- error: [
665
- MessagesValidateEmail401.pipe(HttpApiSchema.status(401)),
666
- MessagesValidateEmail403.pipe(HttpApiSchema.status(403)),
667
- MessagesValidateEmail404.pipe(HttpApiSchema.status(404)),
668
- MessagesValidateEmail422.pipe(HttpApiSchema.status(422)),
669
- MessagesValidateEmail500,
670
- MessagesValidateEmail503.pipe(HttpApiSchema.status(503)),
671
- MessagesValidateEmail504.pipe(HttpApiSchema.status(504))
672
- ]
673
- }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "messages.validateEmail").annotate(OpenApi.Summary, "Validate an email message").annotate(OpenApi.Description, "Resolves recipients, sender, and inline or published-template content without sending anything, creating contacts or messages, or counting toward your quota.")).annotate(OpenApi.Description, "Send messages and read their delivery state and timeline.") {};
674
- //#endregion
675
- //#region src/effect/internal/send.ts
676
- /**
677
- * Inline attachment content over the API's request cap travels as media instead: the largest
678
- * attachments are uploaded (create, put to the presigned URL, complete) and replaced by their
679
- * `mediaId`. The returned payload is the one request every send attempt reuses, so nothing is
680
- * uploaded twice.
681
- */
682
- const uploadOversizedAttachments = (client, payload) => Effect.gen(function* () {
683
- const plan = planInlineUploads(payload);
684
- if (plan.length === 0) return payload;
685
- const uploaded = /* @__PURE__ */ new Map();
686
- for (const upload of plan) {
687
- const created = yield* callEndpoint(MediaGroup, "mediaCreate", { payload: mediaCreateBody(upload) });
688
- yield* client.putUpload({
689
- filename: upload.filename,
690
- mediaId: created.id,
691
- url: created.upload.url,
692
- method: created.upload.method,
693
- headers: created.upload.headers,
694
- bytes: upload.bytes
695
- });
696
- yield* callEndpoint(MediaGroup, "mediaComplete", { params: { id: created.id } });
697
- uploaded.set(upload.index, {
698
- mediaId: created.id,
699
- upload
700
- });
701
- }
702
- return withUploadedAttachments(payload, uploaded);
703
- });
704
- const sendPayload = (payload, options) => Effect.gen(function* () {
705
- const client = yield* Service;
706
- const idempotencyKey = options?.idempotencyKey ?? (yield* generateIdempotencyKey);
707
- const prepared = yield* uploadOversizedAttachments(client, payload);
708
- return yield* withRetry(callEndpoint(MessagesGroup, "messagesSend", {
709
- payload: stripUndefined(prepared),
710
- headers: { "idempotency-key": idempotencyKey }
711
- }));
712
- });
713
- const sendMessage = Effect.fn("Messages.send")(function* (input, options) {
714
- return yield* sendPayload(buildMessagesSendPayload(input), options);
715
- });
716
- const sendEmail = Effect.fn("Email.send")(function* (input, options) {
717
- return yield* sendPayload(buildEmailSendPayload(input), options);
718
- });
719
- //#endregion
720
- export { sendMessage as n, MessagesGroup as r, sendEmail as t };
721
-
722
- //# sourceMappingURL=send-Bxc0XfGE.js.map