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 DynamoDB from "@distilled.cloud/aws/dynamodb"; |
| 2 | import * as Binding from "alchemy/Binding"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | import type { Table } from "./Table.ts"; |
| 5 | |
| 6 | export type BatchExecuteStatementTables = [Table, ...Table[]]; |
| 7 | |
| 8 | export const sortBatchExecuteStatementTables = (tables: BatchExecuteStatementTables) => |
| 9 | [...new Map(tables.map((table) => [table.LogicalId, table] as const)).values()].sort((a, b) => |
| 10 | a.LogicalId.localeCompare(b.LogicalId), |
| 11 | ) as BatchExecuteStatementTables; |
| 12 | |
| 13 | export interface BatchExecuteStatementRequest extends DynamoDB.BatchExecuteStatementInput {} |
| 14 | |
| 15 | /** |
| 16 | * Runtime binding for DynamoDB PartiQL `BatchExecuteStatement`. |
| 17 | * |
| 18 | * The request is passed through unchanged, but IAM is scoped to the explicitly |
| 19 | * bound tables and their indexes. |
| 20 | * ### PartiQL |
| 21 | * **Example:** Execute a Batch of Statements |
| 22 | * ```typescript |
| 23 | * const batchExecuteStatement = yield* AWS.DynamoDB.BatchExecuteStatement( |
| 24 | * sourceTable, |
| 25 | * archiveTable, |
| 26 | * ); |
| 27 | * |
| 28 | * const response = yield* batchExecuteStatement({ |
| 29 | * Statements: [ |
| 30 | * { |
| 31 | * Statement: `SELECT * FROM "${yield* sourceTable.tableName}" WHERE pk=?`, |
| 32 | * Parameters: [{ S: "user#1" }], |
| 33 | * }, |
| 34 | * ], |
| 35 | * }); |
| 36 | * ``` |
| 37 | * |
| 38 | * @binding |
| 39 | */ |
| 40 | export interface BatchExecuteStatement extends Binding.Service< |
| 41 | BatchExecuteStatement, |
| 42 | "AWS.DynamoDB.BatchExecuteStatement", |
| 43 | ( |
| 44 | ...tables: BatchExecuteStatementTables |
| 45 | ) => Effect.Effect< |
| 46 | ( |
| 47 | request: BatchExecuteStatementRequest, |
| 48 | ) => Effect.Effect<DynamoDB.BatchExecuteStatementOutput, DynamoDB.BatchExecuteStatementError> |
| 49 | > |
| 50 | > {} |
| 51 | |
| 52 | export const BatchExecuteStatement = Binding.Service<BatchExecuteStatement>( |
| 53 | "AWS.DynamoDB.BatchExecuteStatement", |
| 54 | ); |