JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 535
  • Score
    100M100P100Q115152F
  • License MIT

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

Package Exports

  • @subql/x-graphile-build-pg
  • @subql/x-graphile-build-pg/node8plus/index.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PageInfoStartEndCursor
  • @subql/x-graphile-build-pg/node8plus/plugins/PageInfoStartEndCursor.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgAllRows
  • @subql/x-graphile-build-pg/node8plus/plugins/PgAllRows.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgBasicsPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgBasicsPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgColumnDeprecationPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgColumnDeprecationPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgColumnsPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgColumnsPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgComputedColumnsPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgComputedColumnsPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgConditionComputedColumnPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgConditionComputedColumnPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgConnectionArgOrderBy
  • @subql/x-graphile-build-pg/node8plus/plugins/PgConnectionArgOrderBy.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgConnectionArgOrderByDefaultValue
  • @subql/x-graphile-build-pg/node8plus/plugins/PgConnectionArgOrderByDefaultValue.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgConnectionTotalCount
  • @subql/x-graphile-build-pg/node8plus/plugins/PgConnectionTotalCount.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgForwardRelationPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgForwardRelationPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgIntrospectionPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgIntrospectionPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgNodeAliasPostGraphile
  • @subql/x-graphile-build-pg/node8plus/plugins/PgNodeAliasPostGraphile.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgOrderAllColumnsPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgOrderAllColumnsPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgOrderByPrimaryKeyPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgOrderByPrimaryKeyPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgOrderComputedColumnsPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgOrderComputedColumnsPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgQueryProceduresPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgQueryProceduresPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgRecordFunctionConnectionPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgRecordFunctionConnectionPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgRecordReturnTypesPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgRecordReturnTypesPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgRowByUniqueConstraint
  • @subql/x-graphile-build-pg/node8plus/plugins/PgRowByUniqueConstraint.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgRowNode
  • @subql/x-graphile-build-pg/node8plus/plugins/PgRowNode.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgScalarFunctionConnectionPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgScalarFunctionConnectionPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgTablesPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgTablesPlugin.js
  • @subql/x-graphile-build-pg/node8plus/plugins/PgTypesPlugin
  • @subql/x-graphile-build-pg/node8plus/plugins/PgTypesPlugin.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@subql/x-graphile-build-pg) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

graphile-build-pg

Patreon sponsor button Discord chat room Package on npm MIT license Follow

graphile-build-pg is a collection of Graphile Engine plugins that allow you to extend your GraphQL schema with high-performance types and fields based on resources found in your PostgreSQL database schema.

Crowd-funded open-source software

To help us develop this software sustainably under the MIT license, we ask all individuals and businesses that use it to help support its ongoing maintenance and development via sponsorship.

Click here to find out more about sponsors and sponsorship.

And please give some love to our featured sponsors 🤩:

Surge
Surge
*
Netflix
Netflix
*
The Guild
The Guild
*
Qwick
Qwick
*
Chad Furman
Chad Furman
*
Dovetail
Dovetail
*
Enzuzo
Enzuzo
*
Stellate
Stellate
*

* Sponsors the entire Graphile suite

About

Thanks to Graphile Engine's advanced query look-ahead features, the plugins in this package do not exhibit the N+1 query problem common in many database-based GraphQL APIs. For all but the flattest GraphQL queries these plugins typically outperform DataLoader-based solutions.

An example of an application built on graphile-build-pg is PostGraphile which with one command connects to your PostgreSQL database and provides a full highly performant standards-compliant GraphQL API.

It is recommended that you use PostGraphile directly unless you really want to get low level access to this library.

If you prefer to use the plugins yourself it's advised that you use the defaultPlugins export from graphile-build-pg and then create a new array based on that into which you may insert or remove specific plugins. This is because it is ordered in a way to ensure the plugins work correctly (and we may still split up or restructure the plugins).

Export: defaultPlugins

An array of graphql-build plugins in the correct order to generate a well-thought-out GraphQL object tree based on your PostgreSQL schema. This is the array that postgraphile-core uses.

Manual usage

import { defaultPlugins, getBuilder } from "graphile-build";
import { defaultPlugins as pgDefaultPlugins } from "graphile-build-pg";

async function getSchema(
  pgConfig = process.env.DATABASE_URL,
  pgSchemas = ["public"],
  additionalPlugins = []
) {
  return getBuilder(
    [...defaultPlugins, ...pgDefaultPlugins, ...additionalPlugins],
    {
      pgConfig,
      pgSchemas,
      pgExtendedTypes: true,
    }
  );
}