graphile-settings
Version:
graphile settings
46 lines (45 loc) • 1.63 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MinimalPreset = void 0;
const graphile_build_1 = require("graphile-build");
const graphile_build_pg_1 = require("graphile-build-pg");
/**
* Minimal PostGraphile v5 preset without Node/Relay features.
*
* This preset builds a clean GraphQL API from PostgreSQL without:
* - Global Node ID (Relay spec) - so `id` columns stay as `id`
* - Schema prefixing for naming conflicts
*
* We use the default presets from graphile-build and graphile-build-pg
* and disable all Node-related plugins.
*/
/**
* List of Node/Relay-related plugins to disable.
* These implement the Relay Global Object Identification spec which:
* - Adds a global `id` field to types
* - Renames actual `id` columns to `rowId`
* - Adds Node interface and nodeId lookups
*
* Since we use UUIDs, we don't need any of this.
*/
const NODE_PLUGINS_TO_DISABLE = [
// Core Node plugins from graphile-build
'NodePlugin',
'AddNodeInterfaceToSuitableTypesPlugin',
'NodeIdCodecBase64JSONPlugin',
'NodeIdCodecPipeStringPlugin',
'RegisterQueryNodePlugin',
'NodeAccessorPlugin',
// PG-specific Node plugins from graphile-build-pg
'PgNodeIdAttributesPlugin',
'PgTableNodePlugin',
];
/**
* Minimal preset with all the PostgreSQL functionality but without Node/Relay features.
* This keeps `id` columns as `id` (no renaming to `rowId`).
*/
exports.MinimalPreset = {
extends: [graphile_build_1.defaultPreset, graphile_build_pg_1.defaultPreset],
disablePlugins: NODE_PLUGINS_TO_DISABLE,
};
exports.default = exports.MinimalPreset;