| 1 | import type * as b2bi from "@distilled.cloud/aws/b2bi"; |
| 2 | import type * as Effect from "effect/Effect"; |
| 3 | import * as Binding from "../../Binding.ts"; |
| 4 | |
| 5 | /** |
| 6 | * Runtime binding for `b2bi:TestParsing`. |
| 7 | * |
| 8 | * Synchronously parses an EDI document in S3 (e.g. an X12 file) into the |
| 9 | * JSON or XML representation B2BI's mapping step consumes. B2BI reads the |
| 10 | * `inputFile` with its service principal, so the bucket needs a bucket |
| 11 | * policy granting `b2bi.amazonaws.com` read access. Provide the |
| 12 | * implementation with `Effect.provide(AWS.B2BI.TestParsingHttp)`. |
| 13 | * ### Parsing EDI Documents |
| 14 | * **Example:** Parse an X12 850 into JSON |
| 15 | * ```typescript |
| 16 | * // init — account-level, no resource argument |
| 17 | * const testParsing = yield* AWS.B2BI.TestParsing(); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const result = yield* testParsing({ |
| 21 | * inputFile: { bucketName: "my-edi-bucket", key: "inbound/order.edi" }, |
| 22 | * fileFormat: "JSON", |
| 23 | * ediType: { |
| 24 | * x12Details: { transactionSet: "X12_850", version: "VERSION_4010" }, |
| 25 | * }, |
| 26 | * }); |
| 27 | * // result.parsedFileContent — the JSON representation of the EDI file |
| 28 | * ``` |
| 29 | * |
| 30 | * @binding |
| 31 | */ |
| 32 | export interface TestParsing extends Binding.Service< |
| 33 | TestParsing, |
| 34 | "AWS.B2BI.TestParsing", |
| 35 | () => Effect.Effect< |
| 36 | ( |
| 37 | request: b2bi.TestParsingRequest, |
| 38 | ) => Effect.Effect<b2bi.TestParsingResponse, b2bi.TestParsingError> |
| 39 | > |
| 40 | > {} |
| 41 | export const TestParsing = Binding.Service<TestParsing>("AWS.B2BI.TestParsing"); |