Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const runGeneration = async ({db, client, backend, silent }: CliFlags, cwd: string, generateConfig: GenerateConfig, schemaString: string) => {
const tasks: ListrTask[] = [];
if (backend || client) {
// Creates model context that is shared with all generators to provide results
const inputContext = graphQLInputContext.createModelContext(schemaString, generateConfig.graphqlCRUD)
if (backend) {
tasks.push({
title: 'Generating Backend Schema and Resolvers',
task: () => createBackendFiles(cwd, inputContext, generateConfig),
})
}
if (client) {
tasks.push({
title: 'Generating Client-side Operations',
task: () => createClientFiles(cwd, inputContext, generateConfig),
})
}
}
if (db) {
public async init(schemaText: string): Promise {
const types = graphQLInputContext.createModelContext(schemaText, {});
const inputContext = types.filter((t: InputModelTypeContext) => t.name !== 'Query' && t.name !== 'Mutation' && t.name !== 'Subscription')
await this.schemaManager.dropDatabaseSchema();
await this.schemaManager.createDatabaseResources(this.context, inputContext);
await this.schemaManager.createDatabaseRelations(this.context, inputContext);
}
}
constructor(schemaText: string, config: GraphbackCRUDGeneratorConfig) {
this.inputContext = graphQLInputContext.createModelContext(schemaText, config);
}
constructor(schemaText: string, db: knex, migrationsDir: string) {
this.schema = removeDirectivesFromSchema(schemaText);
this.inputContext = graphQLInputContext.createModelContext(schemaText, {});
this.migrationProvider = new KnexMigrationProvider(db, migrationsDir);
this.knexMigrationManager = new KnexMigrationManager(db);
this.localMigrationManager = new LocalMigrationManager(migrationsDir);
}