| 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:TestConversion`. |
| 7 | * |
| 8 | * Synchronously converts an inline JSON or XML document into an outbound |
| 9 | * X12 EDI document — the inline counterpart of an outbound transformer's |
| 10 | * conversion step. Provide the implementation with |
| 11 | * `Effect.provide(AWS.B2BI.TestConversionHttp)`. |
| 12 | * ### Converting Documents to EDI |
| 13 | * **Example:** Convert JSON to an X12 850 |
| 14 | * ```typescript |
| 15 | * // init — account-level, no resource argument |
| 16 | * const testConversion = yield* AWS.B2BI.TestConversion(); |
| 17 | * |
| 18 | * // runtime |
| 19 | * const result = yield* testConversion({ |
| 20 | * source: { fileFormat: "JSON", inputFile: { fileContent } }, |
| 21 | * target: { |
| 22 | * fileFormat: "X12", |
| 23 | * formatDetails: { |
| 24 | * x12: { transactionSet: "X12_850", version: "VERSION_4010" }, |
| 25 | * }, |
| 26 | * }, |
| 27 | * }); |
| 28 | * // result.convertedFileContent — the generated X12 document |
| 29 | * ``` |
| 30 | * |
| 31 | * @binding |
| 32 | */ |
| 33 | export interface TestConversion extends Binding.Service< |
| 34 | TestConversion, |
| 35 | "AWS.B2BI.TestConversion", |
| 36 | () => Effect.Effect< |
| 37 | ( |
| 38 | request: b2bi.TestConversionRequest, |
| 39 | ) => Effect.Effect<b2bi.TestConversionResponse, b2bi.TestConversionError> |
| 40 | > |
| 41 | > {} |
| 42 | export const TestConversion = Binding.Service<TestConversion>( |
| 43 | "AWS.B2BI.TestConversion", |
| 44 | ); |