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

main
ts 37 lines 1.17 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 interface QueryRequest extends Omit<DynamoDB.QueryInput, "TableName"> {}
7
8 /**
9 * Runtime binding for `dynamodb:Query`.
10 *
11 * Bind this operation to a `Table` inside a function runtime to get a callable
12 * that queries items by key condition, automatically injecting the table name.
13 * Provide the `QueryHttp` layer on the Function to satisfy the binding.
14 * ### Reading Data
15 * **Example:** Query Items by Partition Key
16 * ```typescript
17 * const query = yield* AWS.DynamoDB.Query(table);
18 *
19 * const response = yield* query({
20 * KeyConditionExpression: "pk = :pk",
21 * ExpressionAttributeValues: { ":pk": { S: "user#123" } },
22 * });
23 * const items = response.Items;
24 * ```
25 *
26 * @binding
27 */
28 export interface Query extends Binding.Service<
29 Query,
30 "AWS.DynamoDB.Query",
31 <T extends Table>(
32 table: T,
33 ) => Effect.Effect<
34 (request: QueryRequest) => Effect.Effect<DynamoDB.QueryOutput, DynamoDB.QueryError>
35 >
36 > {}
37 export const Query = Binding.Service<Query>("AWS.DynamoDB.Query");