@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 48 lines 1.58 KB
Raw
1 import * as sqs from "@distilled.cloud/aws/sqs";
2 import * as Binding from "alchemy/Binding";
3 import * as Effect from "effect/Effect";
4 import type { Queue } from "./Queue.ts";
5
6 export interface SendMessageBatchRequest extends Omit<sqs.SendMessageBatchRequest, "QueueUrl"> {}
7
8 /**
9 * Runtime binding for `sqs:SendMessageBatch`.
10 *
11 * Bind this operation to a {@link Queue} inside a function runtime to send up
12 * to 10 messages per call with per-entry success/failure results. The binding
13 * grants the host function `sqs:SendMessage` on the queue. Provide the
14 * `SendMessageBatchHttp` layer on the Function to implement the binding.
15 *
16 * For an unbounded stream of messages with automatic batching and bounded
17 * retry of transient per-entry failures, prefer {@link QueueSink}.
18 * ### Sending Message Batches
19 * **Example:** Send a Batch of Messages
20 * ```typescript
21 * // init (provide SQS.SendMessageBatchHttp on the Function)
22 * const sendMessageBatch = yield* SQS.SendMessageBatch(queue);
23 *
24 * // runtime
25 * const result = yield* sendMessageBatch({
26 * Entries: messages.map((body, index) => ({
27 * Id: `${index}`,
28 * MessageBody: body,
29 * })),
30 * });
31 * // result.Successful / result.Failed
32 * ```
33 *
34 * @binding
35 */
36 export interface SendMessageBatch extends Binding.Service<
37 SendMessageBatch,
38 "AWS.SQS.SendMessageBatch",
39 (
40 queue: Queue,
41 ) => Effect.Effect<
42 (
43 request: SendMessageBatchRequest,
44 ) => Effect.Effect<sqs.SendMessageBatchResult, sqs.SendMessageBatchError>
45 >
46 > {}
47
48 export const SendMessageBatch = Binding.Service<SendMessageBatch>("AWS.SQS.SendMessageBatch");