graphile-settings
Version:
graphile settings
87 lines (86 loc) • 3.63 kB
TypeScript
import type { GraphileConfig } from 'graphile-config';
/**
* Feature flags that control which optional Graphile plugins are included
* in the preset. Mirrors the `database_settings` / `api_settings` cascade
* from the services DB.
*
* Every flag defaults to the value that matches the current production
* behavior so that `createConstructivePreset()` (no args) is identical to
* the previous static `ConstructivePreset`.
*/
export interface ConstructivePresetOptions {
enableAggregates?: boolean;
enablePostgis?: boolean;
enableSearch?: boolean;
enableDirectUploads?: boolean;
enablePresignedUploads?: boolean;
enableManyToMany?: boolean;
enableConnectionFilter?: boolean;
enableLtree?: boolean;
enableLlm?: boolean;
enableRealtime?: boolean;
enableBulk?: boolean;
enableI18n?: boolean;
}
/**
* Create a Constructive PostGraphile v5 Preset.
*
* Accepts optional feature flags (`ConstructivePresetOptions`) that map 1-to-1
* with the `database_settings` / `api_settings` tables. When a flag is `true`
* its corresponding plugin preset is included; when `false` it is omitted.
*
* Calling with no arguments produces the same preset as the previous static
* `ConstructivePreset` (everything on except aggregates).
*
* CORE PRESETS (always included):
* - MinimalPreset (PostGraphile without Node/Relay)
* - ConflictDetectorPreset (multi-schema conflict detection)
* - InflektPreset (custom inflection)
* - InflectorLoggerPreset (debugging, INFLECTOR_LOG=1)
* - NoUniqueLookupPreset (primary-key-only lookups)
* - MetaSchemaPreset (_meta introspection)
* - PgTypeMappingsPreset (email, url, etc.)
* - RequiredInputPreset (@requiredInput support)
*
* FLAG-CONTROLLED PRESETS:
* - enableConnectionFilter -> ConnectionFilterPreset, EnableAllFilterColumnsPreset
* - enableManyToMany -> ManyToManyOptInPreset
* - enableSearch -> UnifiedSearchPreset (tsvector, BM25, pg_trgm, pgvector)
* - enablePostgis -> GraphilePostgisPreset
* - enableLtree -> GraphileLtreePreset
* - enableDirectUploads -> UploadPreset
* - enablePresignedUploads -> PresignedUrlPreset, BucketProvisionerPreset
* - enableAggregates -> PgAggregatesPreset (off by default)
* - enableRealtime -> RealtimeSubscriptionsPreset (off by default)
* - enableBulk -> BulkMutationPreset (off by default)
* - enableI18n -> I18nPreset (off by default)
* - enableLlm -> GraphileLlmPreset (auto-embed unifiedSearch, vector text fields)
*
* RELATION FILTERS (when enableConnectionFilter is true):
* - Forward: filter child by parent
* - Backward: filter parent by children
*
* USAGE:
* ```typescript
* import { createConstructivePreset, makePgService } from 'graphile-settings';
*
* // All defaults (same as previous static ConstructivePreset)
* const preset = {
* extends: [createConstructivePreset()],
* pgServices: [makePgService({ connectionString, schemas })],
* };
*
* // With database_settings feature flags
* const preset = {
* extends: [createConstructivePreset({ enableAggregates: true, enablePostgis: false })],
* pgServices: [makePgService({ connectionString, schemas })],
* };
* ```
*/
export declare function createConstructivePreset(options?: ConstructivePresetOptions): GraphileConfig.Preset;
/**
* Default Constructive preset -- everything enabled except aggregates.
* Backwards-compatible: identical to the previous static ConstructivePreset.
*/
export declare const ConstructivePreset: GraphileConfig.Preset;
export default ConstructivePreset;