1import * as Effect from "effect/Effect";
2import * as Layer from "effect/Layer";
3import {
4 makeReadVectorsClient,
5 makeVectorsHttpBinding,
6 makeWriteVectorsClient,
7 readVectorsActions,
8 writeVectorsActions,
9} from "./BindingHttp.ts";
10import { type VectorsClient, Vectors } from "./Vectors.ts";
11
12/**
13 * HTTP implementation of {@link Vectors} — calls the S3 Vectors data plane
14 * with the host Function's own credentials, granting the full read+write
15 * action set on the bound index. Composes the read- and write-level client
16 * builders.
17 */
18export const VectorsHttp = Layer.effect(
19 Vectors,
20 makeVectorsHttpBinding({
21 name: "Vectors",
22 actions: [...readVectorsActions, ...writeVectorsActions],
23 makeClient: Effect.gen(function* () {
24 const makeRead = yield* makeReadVectorsClient;
25 const makeWrite = yield* makeWriteVectorsClient;
26 return (
27 indexArn: Effect.Effect<string>,
28 label: string,
29 ): VectorsClient => ({
30 ...makeRead(indexArn, label),
31 ...makeWrite(indexArn, label),
32 });
33 }),
34 }),
35);