How to use the amplify-velocity-template.Compile function in amplify-velocity-template

To help you get started, we’ve selected a few amplify-velocity-template examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-amplify / amplify-cli / packages / amplify-appsync-simulator / src / velocity / index.ts View on Github external
constructor(template: AppSyncVTLTemplate, private simulatorContext: AmplifyAppSyncSimulator) {
    try {
      const ast = parse(template.content.toString());
      this.compiler = new Compile(ast, {
        valueMapper: map,
        escape: false,
      });
      this.template = template;
    } catch (e) {
      const lineDetails = `${e.hash.line}:${e.hash.loc.first_column}`;
      const fileName = template.path ? `${template.path}:${lineDetails}` : lineDetails;
      const templateError = new VelocityTemplateParseError(`Error:Parse error on ${fileName} \n${e.message}`);
      templateError.stack = e.stack;
      throw templateError;
    }
  }
  render(

amplify-velocity-template

Velocity Template Language(VTL) for JavaScript

Apache-2.0
Latest version published 5 months ago

Package Health Score

92 / 100
Full package analysis

Popular amplify-velocity-template functions