Registry / database / graphile-meta-schema

graphile-meta-schema

JSON →
library1.1.1jsnpmunverified

Graphile Meta Schema is a PostGraphile plugin (v1.1.1) that dynamically introspects and serves PostgreSQL meta-information (tables, columns, constraints, etc.) as a GraphQL schema. It enables runtime inspection of database structure via GraphQL queries. Released by Constructive, it targets developers building admin UIs or dynamic data tools on PostGraphile. Unlike static schema introspection, it provides a real-time, queryable meta-layer that updates as the database changes. Ships TypeScript types. Current stable version: 1.1.1 (no frequent releases).

npm install graphile-meta-schema
INSTALL
IMPORT
SIG · GRAPHILE-META-SCHE
G
graphile-meta-schema
databasejavascriptv1.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import MetaSchemaPlugin from 'graphile-meta-schema'
const MetaSchemaPlugin = require('graphile-meta-schema')
Default export is a PostGraphile plugin function. CommonJS require may not work if package is ESM-only; use import.
MetaSchemaPlugin
import MetaSchemaPlugin from 'graphile-meta-schema'
import { MetaSchemaPlugin } from 'graphile-meta-schema'
The package exports a default function, not a named export. Named import will yield undefined.
makeMetaSchemaPlugin
import { makeMetaSchemaPlugin } from 'graphile-meta-schema'
import makeMetaSchemaPlugin from 'graphile-meta-schema'
makeMetaSchemaPlugin is a named export (factory function) for advanced customization. Default export is a pre-configured plugin.

Sets up a PostGraphile server with the MetaSchemaPlugin to expose database meta-information via GraphQL.

import { PostGraphile } from 'postgraphile'; import MetaSchemaPlugin from 'graphile-meta-schema'; const server = PostGraphile( process.env.DATABASE_URL ?? 'postgres://localhost:5432/mydb', 'public', { appendPlugins: [MetaSchemaPlugin], graphileBuildOptions: { // Optional: customize meta schema metaSchemaName: 'graphile_meta' } } ); server.listen(4000, () => { console.log('GraphQL endpoint: http://localhost:4000/graphql'); });
Debug
Known issues
gotchaPlugin must be used with a PostGraphile schema; standalone use is unsupported.
fix
Ensure you are running PostGraphile and the plugin is added to appendPlugins.
affects: >=1.0.0
deprecatedThe option 'metaSchemaName' was renamed to 'metaSchema' in v1.1.0.
fix
Use graphileBuildOptions.metaSchema instead of metaSchemaName.
affects: >=1.1.0
gotchaDatabase user must have permissions to query pg_catalog and information_schema for introspection to work.
fix
Grant SELECT on all tables in pg_catalog and information_schema to the database user, or use a superuser.
affects: >=1.0.0
breakingDefault export changed from a factory function to a pre-configured plugin in v1.0.0.
fix
If upgrading from <1.0.0, use import MetaSchemaPlugin from 'graphile-meta-schema' instead of calling makeMetaSchemaPlugin().
affects: >=1.0.0
gotchaThe meta schema queries can be expensive on large databases with many tables.
fix
Consider caching or limiting the introspection to required schemas.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'graphile-meta-schema'
Package not installed or not in node_modules.
fix
Run `npm install graphile-meta-schema` or `yarn add graphile-meta-schema`.
MetaSchemaPlugin is not a function
Named import used instead of default import.
fix
Change import to `import MetaSchemaPlugin from 'graphile-meta-schema'`.
graphileBuildOptions.metaSchemaName is not recognized
Option renamed in v1.1.0.
fix
Use graphileBuildOptions.metaSchema instead.
relation "meta.services" does not exist
Database user lacks permissions or meta schema not created.
fix
Ensure user has SELECT on pg_catalog and information_schema, or run the plugin with a superuser.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies
pgrequiredPostgreSQL client for database introspection queries
Agent activity
12 hits · last 30 days
node
10
Resources
graphile-meta-schema — npm install graphile-meta-schema · libregistry