@@ -10,7 +10,7 @@ import { GEO_API_TESTNET_ENDPOINT } from './constants.js';
1010import type { QueryPublicParams } from './types.js' ;
1111
1212const entitiesQueryDocument = gql `
13- query entities($spaceId: String!, $typeIds: [String!]!) {
13+ query entities($spaceId: String!, $typeIds: [String!]!, $relationTypeIdsLevel1: [String!]! ) {
1414 entities(spaceId: $spaceId, filter: {
1515 types: { in: $typeIds }
1616 }) {
@@ -20,7 +20,9 @@ query entities($spaceId: String!, $typeIds: [String!]!) {
2020 propertyId
2121 value
2222 }
23- relations {
23+ relations(filter: {
24+ type: { in: $relationTypeIdsLevel1 }
25+ }) {
2426 to {
2527 id
2628 name
@@ -320,10 +322,10 @@ export const useQueryPublic = <S extends Entity.AnyNoContext>(type: S, params?:
320322 throw new Error ( `Mapping entry for ${ typeName } not found` ) ;
321323 }
322324
323- const relationTypeIds : string [ ] = [ ] ;
325+ const relationTypeIdsLevel1 : string [ ] = [ ] ;
324326 for ( const key in mappingEntry ?. relations ?? { } ) {
325327 if ( include ?. [ key ] && mappingEntry ?. relations ?. [ key ] ) {
326- relationTypeIds . push ( mappingEntry ?. relations ?. [ key ] ) ;
328+ relationTypeIdsLevel1 . push ( mappingEntry ?. relations ?. [ key ] ) ;
327329 }
328330 }
329331
@@ -333,7 +335,7 @@ export const useQueryPublic = <S extends Entity.AnyNoContext>(type: S, params?:
333335 const result = await request < EntityQueryResult > ( GEO_API_TESTNET_ENDPOINT , entitiesQueryDocument , {
334336 spaceId : space ,
335337 typeIds : mappingEntry ?. typeIds || [ ] ,
336- relationTypeIds ,
338+ relationTypeIdsLevel1 ,
337339 } ) ;
338340 return result ;
339341 } ,
0 commit comments