How to use the @graphback/core.graphQLInputContext.createModelContext function in @graphback/core

To help you get started, we’ve selected a few @graphback/core 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 Urigo / graphql-cli / packages / commands / generate / src / index.ts View on Github external
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) {
github aerogear / graphback / packages / graphql-migrations / src / database / initialization / strategies / DropCreateDatabaseAlways.ts View on Github external
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);
  }
}
github aerogear / graphback / packages / graphback / src / GraphQLBackendCreator.ts View on Github external
constructor(schemaText: string, config: GraphbackCRUDGeneratorConfig) {
    this.inputContext = graphQLInputContext.createModelContext(schemaText, config);
  }
github aerogear / graphback / packages / graphql-migrations / src / production / migrations / GraphQLMigrationCreator.ts View on Github external
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);
  }