You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update GRAPHILE.md with plugin architecture, remove duplicate
Updates the existing root-level GRAPHILE.md to include:
- Plugin architecture overview with ConstructivePreset composition tree
- Active package descriptions with usage examples
- Legacy directory inventory
- Declarative operator factory API docs
- Key design decisions
- Testing matrix
- Updated package list (unified graphile-search, removed old separate plugins)
- Removed postgraphile-plugin-connection-filter from pinned versions (replaced by v5-native)
This monorepo contains several packages that depend on the [Graphile](https://graphile.org/) v5 release candidate (RC) ecosystem. The Graphile v5 RC packages are **tightly coupled** -- all packages in the ecosystem must be at matching RC versions to work correctly.
5
+
The `graphile/` directory contains all PostGraphile v5 plugins, organized as individual packages in the pnpm workspace. The central entry point is `graphile-settings`, which exports `ConstructivePreset` — a single preset that wires everything together.
6
6
7
-
## The Problem (Why We Pin)
7
+
```
8
+
ConstructivePreset
9
+
├── MinimalPreset (no Node/Relay — keeps id as id)
10
+
├── InflektPreset (custom inflection via inflekt library)
11
+
├── ConflictDetectorPreset (warns about naming conflicts between schemas)
12
+
├── InflectorLoggerPreset (debug logging for inflector calls)
13
+
├── NoUniqueLookupPreset (primary key only lookups)
14
+
├── ConnectionFilterPreset (v5-native connection filter with relation filters)
15
+
├── EnableAllFilterColumnsPreset (allow filtering on all columns)
16
+
├── ManyToManyOptInPreset (many-to-many via @behavior +manyToMany)
17
+
├── MetaSchemaPreset (_meta query for schema introspection)
└── PgTypeMappingsPreset (custom type → GraphQL scalar mappings)
23
+
```
8
24
9
-
Graphile v5 RC packages declare peer dependencies on each other. When a new RC is released, the minimum required versions of those peer deps often bump together. For example, `graphile-build-pg@5.0.0-rc.5` requires `@dataplan/pg@^1.0.0-rc.5` and `tamedevil@^0.1.0-rc.4`, whereas the earlier `rc.3` only required `rc.3` versions of those peers.
25
+
## Active Packages
26
+
27
+
### graphile-settings
28
+
29
+
**The main configuration package.** Exports `ConstructivePreset` and all sub-presets. This is the only package most consumers need to import.
30
+
31
+
- Combines all plugins into a single composable preset
32
+
- Disables `condition` argument (all filtering via `where`)
**Unified search plugin with adapter pattern.** Replaces the previous separate plugins (`graphile-tsvector`, `graphile-bm25`, `graphile-trgm`, `graphile-pgvector`) with a single plugin that supports all four search algorithms.
59
+
60
+
Each algorithm is a ~50-line adapter implementing the `SearchAdapter` interface:
61
+
-**tsvector** — PostgreSQL full-text search via `ts_rank`
62
+
-**BM25** — `pg_textsearch` extension scoring
63
+
-**pg_trgm** — Trigram fuzzy matching via `similarity()`
|`MetaSchemaPreset`|`_meta` query for database schema introspection |
107
+
|`PgTypeMappingsPreset`| Custom PostgreSQL type → GraphQL scalar mappings |
108
+
109
+
### graphile-cache
10
110
11
-
If our packages use loose caret ranges (e.g., `^5.0.0-rc.3`), the package manager may resolve to the **latest** RC (e.g., `rc.5` or `rc.7`), which introduces new peer dependency requirements that nothing in our tree satisfies. This causes cascading "missing peer dependency" warnings like:
111
+
**PostGraphile instance LRU cache** with automatic cleanup when PostgreSQL pools are disposed. Integrates with `pg-cache` for pool management.
12
112
113
+
```typescript
114
+
import { graphileCache } from'graphile-cache';
13
115
```
14
-
graphile-build-pg 5.0.0-rc.5
15
-
- missing peer @dataplan/pg@^1.0.0-rc.5
16
-
- missing peer tamedevil@^0.1.0-rc.4
17
-
postgraphile 5.0.0-rc.7
18
-
- missing peer @dataplan/pg@^1.0.0-rc.5
19
-
- missing peer @dataplan/json@^1.0.0-rc.5
20
-
- missing peer grafserv@^1.0.0-rc.6
21
-
- missing peer tamedevil@^0.1.0-rc.4
116
+
117
+
### graphile-schema
118
+
119
+
**Lightweight GraphQL SDL builder.** Build schemas directly from a database or fetch from a running endpoint — no server dependencies.
The following directories contain npm-installed upstream packages from the v4 era. They have no `package.json` or `src/` — only `dist/` and `node_modules/`. They are consumed as dependencies but not maintained as source:
|`graphile-meta-schema`| Folded into `graphile-misc-plugins` as `MetaSchemaPreset`|
177
+
|`graphile-pg-type-mappings`| Folded into `graphile-misc-plugins` as `PgTypeMappingsPreset`|
178
+
|`graphile-plugin-connection-filter`| Replaced by v5-native `graphile-connection-filter`|
179
+
|`graphile-plugin-fulltext-filter`| Replaced by `graphile-search` unified plugin |
180
+
|`graphile-simple-inflector`| Replaced by `InflektPreset` in `graphile-misc-plugins`|
181
+
182
+
## How Satellite Plugins Register Filter Operators
183
+
184
+
Satellite plugins (search, PostGIS, trgm) register custom filter operators via the **declarative operator factory API** on `graphile-connection-filter`. Each factory is a function that receives the Graphile `build` object and returns operator registrations:
This ensures `graphile-config`'s array replacement behavior is handled correctly — all factories are collected at the top-level preset.
198
+
199
+
## Key Design Decisions
200
+
201
+
1.**`condition` is disabled.** All filtering lives under `where` (the v5-native filter argument). `PgConditionArgumentPlugin` and `PgConditionCustomFieldsPlugin` are explicitly disabled in the preset.
202
+
203
+
2.**All columns are filterable.**`EnableAllFilterColumnsPreset` overrides PostGraphile's default of only filtering indexed columns. Index optimization is left to DBAs.
204
+
205
+
3.**Many-to-many is opt-in.** No many-to-many fields are generated unless the junction table has `@behavior +manyToMany` smart tag. This prevents API bloat.
206
+
207
+
4.**Relation filters are enabled.**`connectionFilterRelations: true` allows filtering across foreign key relationships (forward and backward).
208
+
209
+
5.**Search is unified.** One plugin (`graphile-search`) handles all four search algorithms via adapters instead of four separate plugins.
210
+
211
+
6.**Computed fields are excluded from codegen defaults.** The codegen's `getSelectableScalarFields()` helper uses the TypeRegistry to filter out plugin-added computed fields (search scores, hash UUIDs) from default CLI select objects.
212
+
213
+
---
214
+
215
+
## RC Dependency Management
216
+
217
+
### Overview
218
+
219
+
This monorepo contains several packages that depend on the [Graphile](https://graphile.org/) v5 release candidate (RC) ecosystem. The Graphile v5 RC packages are **tightly coupled** -- all packages in the ecosystem must be at matching RC versions to work correctly.
220
+
221
+
### The Problem (Why We Pin)
222
+
223
+
Graphile v5 RC packages declare peer dependencies on each other. When a new RC is released, the minimum required versions of those peer deps often bump together. For example, `graphile-build-pg@5.0.0-rc.5` requires `@dataplan/pg@^1.0.0-rc.5` and `tamedevil@^0.1.0-rc.4`, whereas the earlier `rc.3` only required `rc.3` versions of those peers.
224
+
225
+
If our packages use loose caret ranges (e.g., `^5.0.0-rc.3`), the package manager may resolve to the **latest** RC (e.g., `rc.5` or `rc.7`), which introduces new peer dependency requirements that nothing in our tree satisfies.
226
+
227
+
### Our Approach: Pinned Exact Versions
25
228
26
229
All Graphile RC dependencies are pinned to **exact versions** (no `^` or `~` prefix). This ensures:
27
230
@@ -30,7 +233,7 @@ All Graphile RC dependencies are pinned to **exact versions** (no `^` or `~` pre
30
233
3. All peer dependency requirements are explicitly satisfied
31
234
4. Deterministic installs across environments
32
235
33
-
## Current Pinned Versions
236
+
###Current Pinned Versions
34
237
35
238
| Package | Pinned Version |
36
239
|---------|---------------|
@@ -46,24 +249,24 @@ All Graphile RC dependencies are pinned to **exact versions** (no `^` or `~` pre
-**graphile-sql-expression-validator** -- SQL expression validation for safe default expressions
266
+
-**graphile-upload-plugin** -- File upload support (S3/MinIO)
267
+
-**graphile-misc-plugins** -- Inflection, conflict detection, meta-schema, type mappings
65
268
66
-
### `graphql/` packages
269
+
####`graphql/` packages
67
270
68
271
-**@constructive-io/graphql-server** -- GraphQL server with PostGraphile v5
69
272
-**@constructive-io/graphql-test** -- GraphQL testing with all plugins loaded
@@ -72,7 +275,7 @@ All Graphile RC dependencies are pinned to **exact versions** (no `^` or `~` pre
72
275
73
276
**Important:** Having different versions of `grafast` (or other singleton graphile packages) installed in the same workspace causes runtime errors like `Preset attempted to register version 'X' of 'grafast', but version 'Y' is already registered`. This is why **all** packages must use the same pinned versions.
74
277
75
-
## Upgrading Graphile RC Versions
278
+
###Upgrading Graphile RC Versions
76
279
77
280
When upgrading to a new Graphile RC set:
78
281
@@ -84,3 +287,16 @@ When upgrading to a new Graphile RC set:
0 commit comments