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 type * as DynamoDB from "@distilled.cloud/aws/dynamodb"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import type * as Effect from "effect/Effect"; |
| 4 | import type { Table } from "./Table.ts"; |
| 5 | |
| 6 | export type BatchGetItemTables = [Table, ...Table[]]; |
| 7 | |
| 8 | type BatchGetItemKeysAndAttributes = NonNullable< |
| 9 | DynamoDB.BatchGetItemInput["RequestItems"] |
| 10 | >[string]; |
| 11 | |
| 12 | export interface BatchGetItemRequest extends Omit<DynamoDB.BatchGetItemInput, "RequestItems"> { |
| 13 | RequestItems: Record<string, BatchGetItemKeysAndAttributes>; |
| 14 | } |
| 15 | |
| 16 | /** |
| 17 | * Runtime binding for `dynamodb:BatchGetItem`. |
| 18 | * |
| 19 | * Bind this operation to one or more tables and key the request by each bound |
| 20 | * table's `LogicalId`. The binding resolves those logical IDs to physical table |
| 21 | * names at runtime. |
| 22 | * ### Reading Data |
| 23 | * **Example:** Read Items Across Multiple Tables |
| 24 | * ```typescript |
| 25 | * const batchGetItem = yield* BatchGetItem(sourceTable, archiveTable); |
| 26 | * |
| 27 | * const response = yield* batchGetItem({ |
| 28 | * RequestItems: { |
| 29 | * [sourceTable.LogicalId]: { |
| 30 | * Keys: [{ pk: { S: "user#1" }, sk: { S: "profile" } }], |
| 31 | * }, |
| 32 | * [archiveTable.LogicalId]: { |
| 33 | * Keys: [{ pk: { S: "user#1" }, sk: { S: "profile" } }], |
| 34 | * }, |
| 35 | * }, |
| 36 | * }); |
| 37 | * ``` |
| 38 | * |
| 39 | * @binding |
| 40 | */ |
| 41 | export interface BatchGetItem extends Binding.Service< |
| 42 | BatchGetItem, |
| 43 | "AWS.DynamoDB.BatchGetItem", |
| 44 | ( |
| 45 | ...tables: BatchGetItemTables |
| 46 | ) => Effect.Effect< |
| 47 | ( |
| 48 | request: BatchGetItemRequest, |
| 49 | ) => Effect.Effect<DynamoDB.BatchGetItemOutput, DynamoDB.BatchGetItemError> |
| 50 | > |
| 51 | > {} |
| 52 | export const BatchGetItem = Binding.Service<BatchGetItem>("AWS.DynamoDB.BatchGetItem"); |