@@ -13,10 +13,11 @@ export type SearchManyPublicParams<S extends Schema.Schema.AnyNoContext> = {
1313 include ?: { [ K in keyof Schema . Schema . Type < S > ] ?: Record < string , Record < string , never > > } | undefined ;
1414 space : string | undefined ;
1515 first ?: number | undefined ;
16+ offset ?: number | undefined ;
1617} ;
1718
1819const searchQueryDocumentLevel0 = gql `
19- query search($query: String!, $spaceId: UUID!, $typeIds: [UUID!]!, $first: Int, $filter: EntityFilter!) {
20+ query search($query: String!, $spaceId: UUID!, $typeIds: [UUID!]!, $first: Int, $filter: EntityFilter!, $offset: Int ) {
2021 search(
2122 query: $query
2223 filter: { and: [{
@@ -25,7 +26,7 @@ query search($query: String!, $spaceId: UUID!, $typeIds: [UUID!]!, $first: Int,
2526 }, $filter]}
2627 spaceId: $spaceId
2728 first: $first
28- offset: 0
29+ offset: $offset
2930 ) {
3031 id
3132 name
@@ -42,7 +43,7 @@ query search($query: String!, $spaceId: UUID!, $typeIds: [UUID!]!, $first: Int,
4243` ;
4344
4445const searchQueryDocumentLevel1 = gql `
45- query search($query: String!, $spaceId: UUID!, $typeIds: [UUID!]!, $relationTypeIdsLevel1: [UUID!]!, $first: Int, $filter: EntityFilter!) {
46+ query search($query: String!, $spaceId: UUID!, $typeIds: [UUID!]!, $relationTypeIdsLevel1: [UUID!]!, $first: Int, $filter: EntityFilter!, $offset: Int ) {
4647 search(
4748 query: $query
4849 filter: { and: [{
@@ -51,7 +52,7 @@ query search($query: String!, $spaceId: UUID!, $typeIds: [UUID!]!, $relationType
5152 }, $filter]}
5253 spaceId: $spaceId
5354 first: $first
54- offset: 0
55+ offset: $offset
5556 ) {
5657 id
5758 name
@@ -96,7 +97,7 @@ query search($query: String!, $spaceId: UUID!, $typeIds: [UUID!]!, $relationType
9697` ;
9798
9899const searchQueryDocumentLevel2 = gql `
99- query search($query: String!, $spaceId: UUID!, $typeIds: [UUID!]!, $relationTypeIdsLevel1: [UUID!]!, $relationTypeIdsLevel2: [UUID!]!, $first: Int, $filter: EntityFilter!) {
100+ query search($query: String!, $spaceId: UUID!, $typeIds: [UUID!]!, $relationTypeIdsLevel1: [UUID!]!, $relationTypeIdsLevel2: [UUID!]!, $first: Int, $filter: EntityFilter!, $offset: Int ) {
100101 search(
101102 query: $query
102103 filter: { and: [{
@@ -105,7 +106,7 @@ query search($query: String!, $spaceId: UUID!, $typeIds: [UUID!]!, $relationType
105106 }, $filter]}
106107 spaceId: $spaceId
107108 first: $first
108- offset: 0
109+ offset: $offset
109110 ) {
110111 id
111112 name
@@ -248,7 +249,7 @@ export const searchManyPublic = async <S extends Schema.Schema.AnyNoContext>(
248249 type : S ,
249250 params ?: SearchManyPublicParams < S > ,
250251) => {
251- const { query, filter, include, space, first = 100 } = params ?? { } ;
252+ const { query, filter, include, space, first = 100 , offset = 0 } = params ?? { } ;
252253
253254 // constructing the relation type ids for the query
254255 const relationTypeIds = Utils . getRelationTypeIds ( type , include ) ;
@@ -275,6 +276,7 @@ export const searchManyPublic = async <S extends Schema.Schema.AnyNoContext>(
275276 relationTypeIdsLevel2 : relationTypeIds . level2 ,
276277 first,
277278 filter : filterParams ,
279+ offset,
278280 } ) ;
279281
280282 const { data, invalidEntities } = parseResult ( { entities : result . search } , type ) ;
0 commit comments