Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
]
// Only insert certain plugins if needed, otherwise they pollute the cloudformation
// for no good reason.
// We determine if needed with a simple string search for the directive string
function conditionalInsertDirectivePlugin(plugin, searchString){
if (schema.indexOf(searchString) >= 0) {
transformers.push(plugin)
}
}
conditionalInsertDirectivePlugin(new ModelAuthTransformer(), '@auth');
conditionalInsertDirectivePlugin(new SearchableModelTransformer(), '@searchable');
// console.log(process.argv)
const transformer = new GraphQLTransform({
transformers: transformers
})
const cfdoc = transformer.transform(schema);
console.log(JSON.stringify(cfdoc, null, 2))