| 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:TestMapping`. |
| 7 | * |
| 8 | * Synchronously maps sample content with a mapping template (JSONATA or |
| 9 | * XSLT) — the inline counterpart of a transformer's mapping step, useful for |
| 10 | * validating templates or transforming small documents on the fly without a |
| 11 | * deployed transformer. Provide the implementation with |
| 12 | * `Effect.provide(AWS.B2BI.TestMappingHttp)`. |
| 13 | * ### Testing Mappings |
| 14 | * **Example:** Map a JSON Document with a JSONATA Template |
| 15 | * ```typescript |
| 16 | * // init — account-level, no resource argument |
| 17 | * const testMapping = yield* AWS.B2BI.TestMapping(); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const result = yield* testMapping({ |
| 21 | * inputFileContent: JSON.stringify({ customer: "acme" }), |
| 22 | * mappingTemplate: '{ "name": customer }', |
| 23 | * fileFormat: "JSON", |
| 24 | * }); |
| 25 | * // result.mappedFileContent === '{"name":"acme"}' |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface TestMapping extends Binding.Service< |
| 31 | TestMapping, |
| 32 | "AWS.B2BI.TestMapping", |
| 33 | () => Effect.Effect< |
| 34 | ( |
| 35 | request: b2bi.TestMappingRequest, |
| 36 | ) => Effect.Effect<b2bi.TestMappingResponse, b2bi.TestMappingError> |
| 37 | > |
| 38 | > {} |
| 39 | export const TestMapping = Binding.Service<TestMapping>("AWS.B2BI.TestMapping"); |