Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
new DynamoDBModelTransformer(),
new ModelConnectionTransformer(),
new VersionedModelTransformer(),
new DefaultValueTransformer()
]
// 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))
return new CustomTransformer();
} else if (typeof CustomTransformer === 'object') {
return CustomTransformer;
}
throw new Error("Custom Transformers' default export must be a function or an object");
})
.filter(customTransformer => customTransformer);
if (customTransformers.length > 0) {
transformerList.push(...customTransformers);
}
// TODO: Build dependency mechanism into transformers. Auth runs last
// so any resolvers that need to be protected will already be created.
transformerList.push(new ModelAuthTransformer({ authConfig }));
return transformerList;
};
}