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

main
ts 45 lines 1.42 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 UpdateItemRequest extends Omit<DynamoDB.UpdateItemInput, "TableName"> {}
7
8 /**
9 * Runtime binding for `dynamodb:UpdateItem`.
10 *
11 * Bind this operation to a `Table` inside a function runtime to get a callable
12 * that applies an update expression to a single item, automatically injecting
13 * the table name. Provide the `UpdateItemHttp` layer on the Function to
14 * satisfy the binding.
15 * ### Writing Data
16 * **Example:** Update an Item with an Update Expression
17 * ```typescript
18 * const updateItem = yield* AWS.DynamoDB.UpdateItem(table);
19 *
20 * const response = yield* updateItem({
21 * Key: {
22 * pk: { S: "user#123" },
23 * sk: { S: "profile" },
24 * },
25 * UpdateExpression: "SET #name = :name",
26 * ExpressionAttributeNames: { "#name": "name" },
27 * ExpressionAttributeValues: { ":name": { S: "Alice" } },
28 * ReturnValues: "ALL_NEW",
29 * });
30 * ```
31 *
32 * @binding
33 */
34 export interface UpdateItem extends Binding.Service<
35 UpdateItem,
36 "AWS.DynamoDB.UpdateItem",
37 <T extends Table>(
38 table: T,
39 ) => Effect.Effect<
40 (
41 request: UpdateItemRequest,
42 ) => Effect.Effect<DynamoDB.UpdateItemOutput, DynamoDB.UpdateItemError>
43 >
44 > {}
45 export const UpdateItem = Binding.Service<UpdateItem>("AWS.DynamoDB.UpdateItem");