How to use the graphile-build-pg.PgEntityKind.PROCEDURE function in graphile-build-pg

To help you get started, we’ve selected a few graphile-build-pg 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 / graphile-engine / packages / graphile-utils / src / introspectionHelpers.ts View on Github external
export function isProcedure(obj: PgEntity): obj is PgProc {
  return obj.kind === PgEntityKind.PROCEDURE;
}
github graphile / graphile-engine / packages / graphile-utils / src / makePgSmartTagsPlugin.ts View on Github external
}

export type PgSmartTagSupportedKinds =
  | PgEntityKind.CLASS
  | PgEntityKind.ATTRIBUTE
  | PgEntityKind.CONSTRAINT
  | PgEntityKind.PROCEDURE;

const meaningByKind: {
  [kind in PgSmartTagSupportedKinds]: string;
} = {
  [PgEntityKind.CLASS]:
    "for tables, composite types, views and materialized views",
  [PgEntityKind.ATTRIBUTE]: "for columns/attributes (of any 'class' type)",
  [PgEntityKind.CONSTRAINT]: "for table constraints",
  [PgEntityKind.PROCEDURE]: "for functions/procedures",
};

const validKinds = Object.entries(meaningByKind)
  .map(([kind, meaning]) => `'${kind}' (${meaning})`)
  .join(", ");

function compileRule(
  rule: PgSmartTagRule
): CompiledPgSmartTagRule {
  const { kind, match: incomingMatch, ...rest } = rule;
  if (!Object.prototype.hasOwnProperty.call(meaningByKind, kind)) {
    throw new Error(
      `makePgSmartTagsPlugin rule has invalid kind '${kind}'; valid kinds are: ${validKinds}`
    );
  }

graphile-build-pg

Build a GraphQL schema by reflection over a PostgreSQL schema. Easy to customize since it's built with plugins on graphile-build

MIT
Latest version published 2 years ago

Package Health Score

66 / 100
Full package analysis