| 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:GenerateMapping`. |
| 7 | * |
| 8 | * Generates a mapping template (JSONATA or XSLT) from a sample input and |
| 9 | * desired output document using AI-assisted mapping — useful for building |
| 10 | * self-service EDI onboarding flows where trading partners supply sample |
| 11 | * documents. `mappingAccuracy` reports the model's confidence. Provide the |
| 12 | * implementation with `Effect.provide(AWS.B2BI.GenerateMappingHttp)`. |
| 13 | * ### Generating Mappings |
| 14 | * **Example:** Generate a JSONATA Template from Samples |
| 15 | * ```typescript |
| 16 | * // init — account-level, no resource argument |
| 17 | * const generateMapping = yield* AWS.B2BI.GenerateMapping(); |
| 18 | * |
| 19 | * // runtime |
| 20 | * const result = yield* generateMapping({ |
| 21 | * inputFileContent: JSON.stringify({ customer: "acme" }), |
| 22 | * outputFileContent: JSON.stringify({ name: "acme" }), |
| 23 | * mappingType: "JSONATA", |
| 24 | * }); |
| 25 | * // result.mappingTemplate, result.mappingAccuracy |
| 26 | * ``` |
| 27 | * |
| 28 | * @binding |
| 29 | */ |
| 30 | export interface GenerateMapping extends Binding.Service< |
| 31 | GenerateMapping, |
| 32 | "AWS.B2BI.GenerateMapping", |
| 33 | () => Effect.Effect< |
| 34 | ( |
| 35 | request: b2bi.GenerateMappingRequest, |
| 36 | ) => Effect.Effect<b2bi.GenerateMappingResponse, b2bi.GenerateMappingError> |
| 37 | > |
| 38 | > {} |
| 39 | export const GenerateMapping = Binding.Service<GenerateMapping>( |
| 40 | "AWS.B2BI.GenerateMapping", |
| 41 | ); |