How to use the postgraphile-core.createPostGraphileSchema function in postgraphile-core

To help you get started, we’ve selected a few postgraphile-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 graphile / postgraphile / src / postgraphile / postgraphile.ts View on Github external
// eslint-disable-next-line no-constant-condition
    while (true) {
      try {
        if (options.watchPg) {
          await watchPostGraphileSchema(pgPool, pgSchemas, options, newSchema => {
            gqlSchema = newSchema;
            _emitter.emit('schemas:changed');
            exportGqlSchema(gqlSchema);
          });
          if (!gqlSchema) {
            throw new Error(
              "Consistency error: watchPostGraphileSchema promises to call the callback before the promise resolves; but this hasn't happened",
            );
          }
        } else {
          gqlSchema = await createPostGraphileSchema(pgPool, pgSchemas, options);
          exportGqlSchema(gqlSchema);
        }
        if (attempts > 0) {
          // tslint:disable-next-line no-console
          console.error(
            `Schema ${
              attempts > 15 ? 'eventually' : attempts > 5 ? 'finally' : 'now'
            } generated successfully`,
          );
        }
        return gqlSchema;
      } catch (error) {
        attempts++;
        const delay = Math.min(100 * Math.pow(attempts, 2), 30000);
        const exitOnFail = !options.retryOnInitFail;
        // If we fail to build our schema, log the error and either exit or retry shortly
github mlipscombe / postgraphile-plugin-nested-mutations / __tests__ / helpers.js View on Github external
if (typeof setup === 'function') {
      await setup(client);
    } else {
      await client.query(setup);
    }
  }

  const schemaOptions = Object.assign(
    {
      appendPlugins: [require('../index.js')],
      showErrorStack: true,
    },
    options,
  );

  const schema = await createPostGraphileSchema(client, ['p'], schemaOptions);
  return test({
    schema,
    pgClient: client,
  });
});
github graphile-contrib / postgraphile-plugin-connection-filter / __tests__ / integration / schema / core.js View on Github external
withPgClient(async client => {
    if (setup) {
      if (typeof setup === "function") {
        await setup(client);
      } else {
        await client.query(setup);
      }
    }
    const schema = await createPostGraphileSchema(client, schemas, options);
    expect(printSchemaOrdered(schema)).toMatchSnapshot();
  });
github mlipscombe / postgraphile-plugin-nested-mutations / __tests__ / integration / schema / core.js View on Github external
withPgClient(async (client) => {
    if (setup) {
      if (typeof setup === 'function') {
        await setup(client);
      } else {
        await client.query(setup);
      }
    }
    const schema = await createPostGraphileSchema(client, schemas, options);
    expect(printSchemaOrdered(schema)).toMatchSnapshot();
  });

postgraphile-core

<span class="badge-patreon"><a href="https://patreon.com/benjie" title="Support Graphile development on Patreon"><img src="https://img.shields.io/badge/sponsor-via%20Patreon-orange.svg" alt="Patreon sponsor button" /></a></span> [![Discord chat room](http

MIT
Latest version published 2 years ago

Package Health Score

66 / 100
Full package analysis

Similar packages