@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 43 lines 1.44 KB
Raw
1 import type * as kvs from "@distilled.cloud/aws/cloudfront-keyvaluestore";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { KeyValueStore } from "./KeyValueStore.ts";
5
6 export interface PutKeyRequest extends Omit<kvs.PutKeyRequest, "KvsARN"> {}
7
8 /**
9 * Runtime binding for `cloudfront-keyvaluestore:PutKey`.
10 *
11 * Creates or replaces a single key in the bound KeyValueStore's data plane.
12 * Writes use optimistic concurrency: pass the store's current `ETag` as
13 * `IfMatch` (from {@link DescribeKeyValueStore} or a previous write's
14 * response). Provide the implementation with
15 * `Effect.provide(AWS.CloudFront.PutKeyHttp)`.
16 * ### Writing KeyValueStore Data
17 * **Example:** Put a Key
18 * ```typescript
19 * // init — bind the operations to the store
20 * const describeStore = yield* CloudFront.DescribeKeyValueStore(store);
21 * const putKey = yield* CloudFront.PutKey(store);
22 *
23 * // runtime
24 * const meta = yield* describeStore({});
25 * const res = yield* putKey({
26 * Key: "routes:/about",
27 * Value: "/about.html",
28 * IfMatch: meta.ETag,
29 * });
30 * // res.ETag is the store's new entity tag
31 * ```
32 *
33 * @binding
34 */
35 export interface PutKey extends Binding.Service<
36 PutKey,
37 "AWS.CloudFront.PutKey",
38 (
39 store: KeyValueStore,
40 ) => Effect.Effect<(request: PutKeyRequest) => Effect.Effect<kvs.PutKeyResponse, kvs.PutKeyError>>
41 > {}
42
43 export const PutKey = Binding.Service<PutKey>("AWS.CloudFront.PutKey");