@@ -158,6 +158,7 @@ export class BatchedArrayCursor<T = any> {
158158 protected _count ?: number ;
159159 protected _extra : CursorExtras ;
160160 protected _hasMore : boolean ;
161+ protected _nextBatchId ?: string ;
161162 protected _id : string | undefined ;
162163 protected _hostUrl ?: string ;
163164 protected _allowDirtyRead ?: boolean ;
@@ -172,6 +173,7 @@ export class BatchedArrayCursor<T = any> {
172173 extra : any ;
173174 result : T [ ] ;
174175 hasMore : boolean ;
176+ nextBatchId ?: string ;
175177 id : string ;
176178 count : number ;
177179 } ,
@@ -185,6 +187,7 @@ export class BatchedArrayCursor<T = any> {
185187 this . _batches = batches ;
186188 this . _id = body . id ;
187189 this . _hasMore = Boolean ( body . id && body . hasMore ) ;
190+ this . _nextBatchId = body . nextBatchId ;
188191 this . _hostUrl = hostUrl ;
189192 this . _count = body . count ;
190193 this . _extra = body . extra ;
@@ -209,15 +212,25 @@ export class BatchedArrayCursor<T = any> {
209212 }
210213
211214 protected async _more ( ) : Promise < void > {
212- if ( ! this . hasMore ) return ;
215+ if ( ! this . _id || ! this . hasMore ) return ;
213216 const body = await this . _db . request ( {
214- method : "PUT" ,
215- path : `/_api/cursor/${ encodeURIComponent ( this . _id ! ) } ` ,
217+ ...( this . _nextBatchId
218+ ? {
219+ method : "POST" ,
220+ path : `/_api/cursor/${ encodeURIComponent ( this . _id ) } /${
221+ this . _nextBatchId
222+ } `,
223+ }
224+ : {
225+ method : "PUT" ,
226+ path : `/_api/cursor/${ encodeURIComponent ( this . _id ) } ` ,
227+ } ) ,
216228 hostUrl : this . _hostUrl ,
217229 allowDirtyRead : this . _allowDirtyRead ,
218230 } ) ;
219231 this . _batches . push ( new LinkedList ( body . result ) ) ;
220232 this . _hasMore = body . hasMore ;
233+ this . _nextBatchId = body . nextBatchId ;
221234 }
222235
223236 /**
0 commit comments