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, 06:00 UTC
| 1 | import * as Kinesis from "@distilled.cloud/aws/kinesis"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import type { Stream } from "./Stream.ts"; |
| 5 | |
| 6 | export interface PutRecordsRequest extends Omit<Kinesis.PutRecordsInput, "StreamName"> {} |
| 7 | |
| 8 | /** |
| 9 | * Runtime binding for `kinesis:PutRecords`. |
| 10 | * |
| 11 | * Bind this operation to a `Stream` to write up to 500 records per call — |
| 12 | * the stream name is injected automatically and `kinesis:PutRecords` is |
| 13 | * granted on the stream. Provide the implementation with |
| 14 | * `Effect.provide(AWS.Kinesis.PutRecordsHttp)`. For unbounded batching with |
| 15 | * automatic partial-failure retry, use `AWS.Kinesis.StreamSink` instead. |
| 16 | * ### Writing Batches |
| 17 | * **Example:** Put a Batch of Records |
| 18 | * ```typescript |
| 19 | * // init — bind the operation to the stream |
| 20 | * const putRecords = yield* AWS.Kinesis.PutRecords(stream); |
| 21 | * |
| 22 | * // runtime — write a batch from a handler |
| 23 | * const result = yield* putRecords({ |
| 24 | * Records: orders.map((order) => ({ |
| 25 | * PartitionKey: order.id, |
| 26 | * Data: new TextEncoder().encode(JSON.stringify(order)), |
| 27 | * })), |
| 28 | * }); |
| 29 | * // result.FailedRecordCount > 0 means some entries need re-submission |
| 30 | * ``` |
| 31 | * |
| 32 | * @binding |
| 33 | */ |
| 34 | export interface PutRecords extends Binding.Service< |
| 35 | PutRecords, |
| 36 | "AWS.Kinesis.PutRecords", |
| 37 | ( |
| 38 | stream: Stream, |
| 39 | ) => Effect.Effect< |
| 40 | (request: PutRecordsRequest) => Effect.Effect<Kinesis.PutRecordsOutput, Kinesis.PutRecordsError> |
| 41 | > |
| 42 | > {} |
| 43 | |
| 44 | export const PutRecords = Binding.Service<PutRecords>("AWS.Kinesis.PutRecords"); |