mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
VtlTemplateEngine.UtilVariable (API Gateway) and AppSyncUtil (AppSync) each independently implemented the same ~49-line block of AWS $util VTL functions (escapeJavaScript, urlEncode, urlDecode, base64Encode, base64Decode, parseJson), flagged as duplicated by CPD. AWS specifies $util identically across both services' VTL mapping-template docs, so the two floci implementations risked silently disagreeing on edge cases over time. Extracted the shared functions into VtlUtilFunctions under core.common.vtl; both $util implementations now delegate to it. base64Encode keeps two overloads matching each service's real AWS signature: API Gateway's $util.base64Encode takes a string, AppSync's takes a Blob (byte[] in the Java model), so both overloads are preserved rather than collapsed into one. No behavior change. All existing VtlTemplateEngine and AppSyncUtil tests, plus the full ApiGateway and AppSync suites, pass unchanged.