Skip to content

(WIP) Feat/v5 relations cont#856

Open
yyyyaaa wants to merge 11 commits intomainfrom
feat/v5-relations-cont
Open

(WIP) Feat/v5 relations cont#856
yyyyaaa wants to merge 11 commits intomainfrom
feat/v5-relations-cont

Conversation

@yyyyaaa
Copy link
Contributor

@yyyyaaa yyyyaaa commented Mar 20, 2026

No description provided.

yyyyaaa added 11 commits March 16, 2026 14:13
Surface TableMeta from buildSchemaWithMeta() through database, pgpm-module,
and endpoint sources. Endpoint fires _meta query in parallel with introspection
and falls back gracefully. Extract shared executeGraphqlRequest() core.
… heuristic

Add enrichRelationsFromMeta (authoritative path) and enrichRelationsFromCrossReference
(SDL fallback) to infer-tables. Extend CleanManyToManyRelation with junction FK fields.
Add TableMetaInput interface for structural decoupling from graphile-misc-plugins.
- Extract shared junction-utils module (collectJunctionMutations, resolveJunctionInfo, getJunctionHookName)
- Generate React Query mutation hooks for add/remove junction operations (usePostAddTagMutation etc.)
- Bidirectional onSuccess invalidation: detail+lists on both left and right entities
- Add M:N entries to mutation-keys factory and invalidation helpers
- Update barrel generators with junction hook exports and dedup
- Shared M:N test fixtures, 5 new hook tests, 3 new key/invalidation tests
- Generate ToMany filter interfaces (every/some/none) for hasMany relations
- Add relational filter fields on XxxFilter types (belongsTo, hasOne, hasMany)
- M:N excluded from filter types (PostGraphile connection-filter doesn't support direct M:N)
- Generate static `filters` property on model classes with ergonomic helpers:
  - belongsTo/hasOne: Post.filters.hasAuthor(filter)
  - hasMany: User.filters.hasPost/hasEveryPost/hasNoPost(filter)
  - M:N via junction path: Post.filters.hasTag(filter) => { postTags: { some: { tag: filter } } }
- Extract resolveJunctionFilterPath helper, FILTER_QUANTIFIERS const, Map-based lookups
- 16 new tests covering all relation types, null fieldNames, junction path resolution
- Prioritize getRelations() method over .relations property
- Add pgRelations registry fallback for resources lacking getRelations()
- Change isReferencee guard from !== false to === true (PGv5 leaves undefined)
- Add after: PgManyToManyRelationPlugin to ensure M:N Map is populated
- Junction table with isReferencee undefined (real PGv5 behavior)
- Mixed isReferencee values (true/false/undefined) on same resource
- Registry-based fallback when resource lacks getRelations()
- Full M:N + junction belongsTo integration scenario
Use resolveTableType() instead of raw codec.name for belongsTo references,
referencedBy, rightTable, junctionTable, and FK referencedTable fields.
Now that _meta emits consistent inflected PascalCase names for all
relation targets, the multi-step fuzzy matching is unnecessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant