UNPKG

@graphprotocol/graph-cli

Version:

CLI for building for and deploying to The Graph

28 lines (27 loc) 997 B
/* eslint-disable */ import * as tsCodegen from '../codegen/typescript.js'; export default class FileTemplateCodeGen { template; constructor(template) { this.template = template; this.template = template; } generateModuleImports() { return []; } generateCreateMethod() { const name = this.template.get('name'); return tsCodegen.staticMethod('create', [tsCodegen.param('cid', tsCodegen.namedType('string'))], tsCodegen.namedType('void'), ` DataSourceTemplate.create('${name}', [cid]) `); } generateCreateWithContextMethod() { const name = this.template.get('name'); return tsCodegen.staticMethod('createWithContext', [ tsCodegen.param('cid', tsCodegen.namedType('string')), tsCodegen.param('context', tsCodegen.namedType('DataSourceContext')), ], tsCodegen.namedType('void'), ` DataSourceTemplate.createWithContext('${name}', [cid], context) `); } }