@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 58 lines 1.72 KB
Raw
1 import * as rdsdata from "@distilled.cloud/aws/rds-data";
2 import * as Binding from "alchemy/Binding";
3 import type { RuntimeContext } from "alchemy/RuntimeContext";
4 import * as Effect from "effect/Effect";
5 import type { DBCluster } from "../RDS/DBCluster.ts";
6 import type { Secret } from "../SecretsManager/Secret.ts";
7
8 export interface CommitTransactionOptions {
9 secret: Secret;
10 }
11
12 export interface CommitTransactionRequest extends Omit<
13 rdsdata.CommitTransactionRequest,
14 "resourceArn" | "secretArn"
15 > {}
16
17 /**
18 * Runtime binding for `rds-data:CommitTransaction` — commit a Data API
19 * transaction opened with `AWS.RDSData.BeginTransaction`.
20 *
21 * Bind it to the same `DBCluster` and credentials secret as the rest of the
22 * transaction; provide the implementation with
23 * `Effect.provide(AWS.RDSData.CommitTransactionHttp)`.
24 * ### Transactions
25 * **Example:** Commit a Transaction
26 * ```typescript
27 * // init
28 * const commitTransaction = yield* AWS.RDSData.CommitTransaction(db.cluster, {
29 * secret: db.secret,
30 * });
31 *
32 * // runtime — after statements executed with tx.transactionId
33 * const commit = yield* commitTransaction({ transactionId: tx.transactionId! });
34 * // commit.transactionStatus === "Transaction Committed"
35 * ```
36 *
37 * @binding
38 */
39 export interface CommitTransaction extends Binding.Service<
40 CommitTransaction,
41 "AWS.RDSData.CommitTransaction",
42 (
43 cluster: DBCluster,
44 options: CommitTransactionOptions,
45 ) => Effect.Effect<
46 (
47 request: CommitTransactionRequest,
48 ) => Effect.Effect<
49 rdsdata.CommitTransactionResponse,
50 rdsdata.CommitTransactionError,
51 RuntimeContext
52 >
53 >
54 > {}
55
56 export const CommitTransaction = Binding.Service<CommitTransaction>(
57 "AWS.RDSData.CommitTransaction",
58 );