@stonecrop/graphql-middleware 0.12.5 → 0.12.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/index.js +307 -378
- package/dist/index.js.map +1 -1
- package/dist/src/plugin/postgraphile.d.ts.map +1 -1
- package/dist/src/plugin/postgraphile.js +5 -81
- package/dist/src/typeDefs.d.ts.map +1 -1
- package/dist/src/typeDefs.js +8 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -102,6 +102,14 @@ Fields with `fieldtype: "Display"` are excluded from the auto-generated scalar q
|
|
|
102
102
|
|
|
103
103
|
All other non-`Link` fieldtypes are assumed to map to a scalar DB column and are included in the query.
|
|
104
104
|
|
|
105
|
+
## Architecture
|
|
106
|
+
|
|
107
|
+
### Why the middleware builds queries
|
|
108
|
+
|
|
109
|
+
The client (`@stonecrop/graphql-client`) is intentionally transport-only — it sends requests and receives flat data. It never constructs GraphQL queries. All query generation lives in the middleware, which is the only layer aware of PostGraphile naming conventions (inflection).
|
|
110
|
+
|
|
111
|
+
This boundary exists because PostGraphile's schema naming is configurable. A single application might use `ById` for UUID primary keys, `ByRowId` for `row_id` columns, or entirely custom conventions. If the client hardcoded any of these conventions, it would silently generate wrong queries for any non-default setup. By keeping query construction server-side, the middleware's `StonecropInflectionConfig` becomes the single source of truth.
|
|
112
|
+
|
|
105
113
|
## Actions
|
|
106
114
|
|
|
107
115
|
Actions are custom logic triggered by the client. Register handlers with `registerHandler`:
|
|
@@ -122,7 +130,7 @@ The middleware exposes these GraphQL operations:
|
|
|
122
130
|
| Operation | Description |
|
|
123
131
|
|-----------|-------------|
|
|
124
132
|
| `stonecropRecord(doctype, id, options?)` | Fetch a single record, optionally with nested links |
|
|
125
|
-
| `stonecropRecords(doctype, filters?, orderBy?, limit?, offset?)` | Fetch multiple records |
|
|
133
|
+
| `stonecropRecords(doctype, filters?, orderBy?, limit?, offset?, options?)` | Fetch multiple records |
|
|
126
134
|
| `stonecropMeta(doctype)` | Fetch doctype metadata |
|
|
127
135
|
| `stonecropAllMeta` | Fetch all doctype metadata |
|
|
128
136
|
| `stonecropAction(doctype, action, args?)` | Execute a doctype action |
|