-
Notifications
You must be signed in to change notification settings - Fork 13
Nik/query config #569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nik/query config #569
Changes from all commits
64f4e00
082f964
98a9db5
8dafe44
73d8ee2
3b38b8b
482f7e2
d6ab918
4b1f4bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,18 @@ | ||||||
| --- | ||||||
| "@graphprotocol/hypergraph": patch | ||||||
| "@graphprotocol/hypergraph-react": patch | ||||||
| --- | ||||||
|
|
||||||
| Allow relation includes to override nested relation and value space filters by adding _config: { relationSpaces, valueSpaces } to any include branch; GraphQL fragments now honor those overrides when building queries. | ||||||
|
|
||||||
| ``` | ||||||
| include: { | ||||||
| friends: { | ||||||
| _config: { | ||||||
| relationSpaces: ['space-a', 'space-b'], | ||||||
| valueSpaces: 'all', | ||||||
| }, | ||||||
| }, | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
|
Comment on lines
+17
to
+18
|
||||||
| ``` | |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||
| import { useEntities, useEntity, usePublicSpaces } from '@graphprotocol/hypergraph-react'; | ||||
| import { createLazyFileRoute } from '@tanstack/react-router'; | ||||
| import { Podcast, Topic } from '@/schema'; | ||||
| import { Person, Podcast, Topic } from '@/schema'; | ||||
|
|
||||
| export const Route = createLazyFileRoute('/podcasts')({ | ||||
| component: RouteComponent, | ||||
|
|
@@ -22,6 +22,25 @@ function RouteComponent() { | |||
| // }, 1000); | ||||
| // }, []); | ||||
|
|
||||
| const { | ||||
| data: person, | ||||
| invalidEntity: personInvalidEntity, | ||||
| invalidRelationEntities: personInvalidRelationEntities, | ||||
| } = useEntity(Person, { | ||||
| id: '9800a4e8-8437-4310-9af6-ac91644f7c26', | ||||
| mode: 'public', | ||||
| space: '95a4a1cc-bfcc-4038-b7a1-02c513d27700', | ||||
| include: { | ||||
| skills: { | ||||
| _config: { | ||||
| relationSpaces: ['95a4a1cc-bfcc-4038-b7a1-02c513d27700'], | ||||
| valueSpaces: ['021265e2-d839-47c3-8d03-0ee3dfb29ffc', '95a4a1cc-bfcc-4038-b7a1-02c513d27700'], | ||||
| }, | ||||
| }, | ||||
| }, | ||||
| }); | ||||
| console.log({ person, personInvalidEntity, personInvalidRelationEntities }); | ||||
|
||||
| console.log({ person, personInvalidEntity, personInvalidRelationEntities }); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,8 +2,17 @@ import type * as Schema from 'effect/Schema'; | |||||
|
|
||||||
| type SchemaKey<S extends Schema.Schema.AnyNoContext> = Extract<keyof Schema.Schema.Type<S>, string>; | ||||||
|
|
||||||
| export type RelationSpacesOverride = 'all' | readonly string[]; | ||||||
|
|
||||||
| export type RelationIncludeConfig = { | ||||||
| relationSpaces?: RelationSpacesOverride; | ||||||
| valueSpaces?: RelationSpacesOverride; | ||||||
| }; | ||||||
|
|
||||||
| export type RelationIncludeBranch = { | ||||||
| [key: string]: RelationIncludeBranch | boolean | undefined; | ||||||
| _config?: RelationIncludeConfig; | ||||||
| } & { | ||||||
| [key: string]: RelationIncludeBranch | RelationIncludeConfig | boolean | undefined; | ||||||
|
||||||
| [key: string]: RelationIncludeBranch | RelationIncludeConfig | boolean | undefined; | |
| [K in Exclude<string, '_config'>]?: RelationIncludeBranch | RelationIncludeConfig | boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trailing whitespace at the end of the file.