The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as sdb from "@distilled.cloud/aws/simpledb"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Layer from "effect/Layer"; |
| 4 | import * as AWSBindings from "../AWSBindings.ts"; |
| 5 | import { RegisterSimpleDbBinding } from "./Binding.ts"; |
| 6 | import type { Domain } from "./Domain.ts"; |
| 7 | import { Select, type SelectRequest } from "./Select.ts"; |
| 8 | |
| 9 | export const SelectHttp = Layer.effect( |
| 10 | Select, |
| 11 | Effect.gen(function* () { |
| 12 | const registerSimpleDbBinding = yield* RegisterSimpleDbBinding; |
| 13 | const select = yield* AWSBindings.withCredentials(sdb.select); |
| 14 | |
| 15 | return Effect.fn(function* (domain: Domain) { |
| 16 | const domainName = yield* domain.domainName; |
| 17 | yield* registerSimpleDbBinding("Select", domain); |
| 18 | return Effect.fn(`AWS.SimpleDB.Select(${domain.LogicalId})`)(function* ( |
| 19 | request: SelectRequest, |
| 20 | ) { |
| 21 | const { SelectExpression, ...rest } = request; |
| 22 | const name = yield* domainName; |
| 23 | return yield* select({ |
| 24 | ...rest, |
| 25 | SelectExpression: |
| 26 | typeof SelectExpression === "function" ? SelectExpression(name) : SelectExpression, |
| 27 | }); |
| 28 | }); |
| 29 | }); |
| 30 | }), |
| 31 | ); |