@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, 06:00 UTC

main
ts 49 lines 1.78 KB
Raw
1 import type * as b2bi from "@distilled.cloud/aws/b2bi";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { Transformer } from "./Transformer.ts";
5
6 export interface StartTransformerJobRequest extends Omit<
7 b2bi.StartTransformerJobRequest,
8 "transformerId"
9 > {}
10
11 /**
12 * Runtime binding for `b2bi:StartTransformerJob`.
13 *
14 * Runs an asynchronous transformer job against an EDI document in S3 — the
15 * bound {@link Transformer} (which must be `active`) parses and maps the
16 * `inputFile` and writes the result to `outputLocation`. Poll the returned
17 * `transformerJobId` with {@link GetTransformerJob}. B2BI accesses the S3
18 * locations with its service principal, so the buckets need a bucket policy
19 * granting `b2bi.amazonaws.com` read/write access. Provide the
20 * implementation with `Effect.provide(AWS.B2BI.StartTransformerJobHttp)`.
21 * ### Running Transformer Jobs
22 * **Example:** Transform an EDI Document in S3
23 * ```typescript
24 * // init — grants b2bi:StartTransformerJob on the transformer
25 * const startTransformerJob = yield* AWS.B2BI.StartTransformerJob(transformer);
26 *
27 * // runtime
28 * const { transformerJobId } = yield* startTransformerJob({
29 * inputFile: { bucketName: "my-edi-bucket", key: "inbound/order.edi" },
30 * outputLocation: { bucketName: "my-edi-bucket", key: "output/" },
31 * });
32 * ```
33 *
34 * @binding
35 */
36 export interface StartTransformerJob extends Binding.Service<
37 StartTransformerJob,
38 "AWS.B2BI.StartTransformerJob",
39 (
40 transformer: Transformer,
41 ) => Effect.Effect<
42 (
43 request: StartTransformerJobRequest,
44 ) => Effect.Effect<b2bi.StartTransformerJobResponse, b2bi.StartTransformerJobError>
45 >
46 > {}
47 export const StartTransformerJob = Binding.Service<StartTransformerJob>(
48 "AWS.B2BI.StartTransformerJob",
49 );