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

main
ts 57 lines 2.01 KB
Raw
1 import type * as frauddetector from "@distilled.cloud/aws/frauddetector";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { List } from "./List.ts";
5
6 /**
7 * The list `name` is injected by the binding from the bound list; the caller
8 * supplies the elements and the `updateMode` (`APPEND`, `REMOVE`, or
9 * `REPLACE`).
10 */
11 export interface UpdateListRequest extends Omit<frauddetector.UpdateListRequest, "name"> {}
12
13 /**
14 * Mutate the elements of a bound Amazon Fraud Detector list at runtime — the
15 * effectful write call made from a deployed Lambda or Task, e.g. to append a
16 * newly-confirmed fraudulent IP to a deny-list the detector's rules reference.
17 *
18 * Note that the `List` resource reconciles `elements` declaratively on every
19 * deploy (a `REPLACE` update), so elements appended at runtime are removed by
20 * the next deploy unless they are also added to the resource's props.
21 *
22 * ### Updating List Elements
23 * Provide the `UpdateListHttp` implementation layer on the Function effect,
24 * bind the list in the init phase, then call the returned client at runtime.
25 * The binding grants `frauddetector:UpdateList` on the list and injects its
26 * `name` automatically.
27 *
28 * **Example:** Append from a Lambda
29 * ```typescript
30 * // init
31 * const updateList = yield* FraudDetector.UpdateList(blockedIps);
32 *
33 * return {
34 * fetch: Effect.gen(function* () {
35 * // runtime
36 * yield* updateList({ elements: ["192.0.2.44"], updateMode: "APPEND" });
37 * return HttpServerResponse.json({ ok: true });
38 * }),
39 * };
40 * // on the Function effect:
41 * // .pipe(Effect.provide(FraudDetector.UpdateListHttp))
42 * ```
43 *
44 * @binding
45 */
46 export interface UpdateList extends Binding.Service<
47 UpdateList,
48 "AWS.FraudDetector.UpdateList",
49 (
50 list: List,
51 ) => Effect.Effect<
52 (
53 request: UpdateListRequest,
54 ) => Effect.Effect<frauddetector.UpdateListResult, frauddetector.UpdateListError>
55 >
56 > {}
57 export const UpdateList = Binding.Service<UpdateList>("AWS.FraudDetector.UpdateList");