@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 63 lines 1.65 KB
Raw
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 TransactGetItemsTables = [Table, ...Table[]];
7
8 type NativeTransactGet = NonNullable<
9 NonNullable<DynamoDB.TransactGetItemsInput["TransactItems"]>[number]["Get"]
10 >;
11
12 export interface TransactGet extends Omit<NativeTransactGet, "TableName"> {
13 Table: string;
14 }
15
16 export interface TransactGetItemsRequest extends Omit<
17 DynamoDB.TransactGetItemsInput,
18 "TransactItems"
19 > {
20 TransactItems: Array<{
21 Get: TransactGet;
22 }>;
23 }
24
25 /**
26 * Runtime binding for `dynamodb:TransactGetItems`.
27 *
28 * Bind this operation to one or more tables and identify each table in the
29 * request with the bound table's `LogicalId`.
30 * ### Reading Data
31 * **Example:** Read Items Transactionally
32 * ```typescript
33 * const transactGetItems = yield* AWS.DynamoDB.TransactGetItems(
34 * sourceTable,
35 * archiveTable,
36 * );
37 *
38 * const response = yield* transactGetItems({
39 * TransactItems: [
40 * {
41 * Get: {
42 * Table: sourceTable.LogicalId,
43 * Key: { pk: { S: "user#1" }, sk: { S: "profile" } },
44 * },
45 * },
46 * ],
47 * });
48 * ```
49 *
50 * @binding
51 */
52 export interface TransactGetItems extends Binding.Service<
53 TransactGetItems,
54 "AWS.DynamoDB.TransactGetItems",
55 (
56 ...tables: TransactGetItemsTables
57 ) => Effect.Effect<
58 (
59 request: TransactGetItemsRequest,
60 ) => Effect.Effect<DynamoDB.TransactGetItemsOutput, DynamoDB.TransactGetItemsError>
61 >
62 > {}
63 export const TransactGetItems = Binding.Service<TransactGetItems>("AWS.DynamoDB.TransactGetItems");