Expand description
Honest, documented evaluation for EvaluateCode / EvaluateMappingTemplate.
AppSync’s real evaluation endpoints run a full VTL interpreter (mapping
templates) or an APPSYNC_JS runtime (code) against a request context and
return the rendered result. fakecloud does not ship a VTL/JS interpreter.
Instead this module performs a faithful, bounded evaluation:
- It validates that
contextis well-formed JSON (AppSync’sContextis a JSON string) and that the template/code is present and non-empty – returning the model’serroroutput member (not a top-level exception) when the context is malformed, exactly as AppSync surfaces evaluation errors. - It returns a deterministic
evaluationResult: the JSON-encoded value of the context’sargumentsfield when present, else the whole parsed context. This mirrors the overwhelmingly common request-mapping-template shape ($util.toJson($ctx.arguments)), so simple templates evaluate to a sensible, reproducible value without a full interpreter. stashechoes the context’sstash(AppSync threads the stash through), andlogsis empty (no interpreter log output is produced).
This is a documented evaluation subset, surfaced honestly rather than faking arbitrary interpreter output.
Structs§
- Evaluation
- The outcome of an evaluation: either a rendered result or an error detail.
Functions§
- evaluate
- Evaluate a request against its context.
bodyis the template (mapping) or code string; it must be non-empty.contextis the rawContextJSON string from the request.