@topgunbuild/client 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +64 -5
- package/dist/index.d.ts +64 -5
- package/dist/index.js +102 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +102 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -99,7 +99,19 @@ interface QueryFilter {
|
|
|
99
99
|
predicate?: PredicateNode;
|
|
100
100
|
sort?: Record<string, 'asc' | 'desc'>;
|
|
101
101
|
limit?: number;
|
|
102
|
-
offset
|
|
102
|
+
/** Cursor for pagination (Phase 14.1: replaces offset) */
|
|
103
|
+
cursor?: string;
|
|
104
|
+
}
|
|
105
|
+
/** Cursor status for debugging (Phase 14.1) */
|
|
106
|
+
type CursorStatus = 'valid' | 'expired' | 'invalid' | 'none';
|
|
107
|
+
/** Pagination info from server (Phase 14.1) */
|
|
108
|
+
interface PaginationInfo {
|
|
109
|
+
/** Cursor for fetching next page */
|
|
110
|
+
nextCursor?: string;
|
|
111
|
+
/** Whether more results are available */
|
|
112
|
+
hasMore: boolean;
|
|
113
|
+
/** Debug info: status of input cursor processing */
|
|
114
|
+
cursorStatus: CursorStatus;
|
|
103
115
|
}
|
|
104
116
|
/** Source of query results for proper handling of race conditions */
|
|
105
117
|
type QueryResultSource = 'local' | 'server';
|
|
@@ -117,6 +129,8 @@ declare class QueryHandle<T> {
|
|
|
117
129
|
private changeTracker;
|
|
118
130
|
private pendingChanges;
|
|
119
131
|
private changeListeners;
|
|
132
|
+
private _paginationInfo;
|
|
133
|
+
private paginationListeners;
|
|
120
134
|
constructor(syncEngine: SyncEngine, mapName: string, filter?: QueryFilter);
|
|
121
135
|
subscribe(callback: (results: QueryResultItem<T>[]) => void): () => void;
|
|
122
136
|
private loadInitialLocalData;
|
|
@@ -186,6 +200,26 @@ declare class QueryHandle<T> {
|
|
|
186
200
|
private getSortedResults;
|
|
187
201
|
getFilter(): QueryFilter;
|
|
188
202
|
getMapName(): string;
|
|
203
|
+
/**
|
|
204
|
+
* Get current pagination info.
|
|
205
|
+
* Returns nextCursor, hasMore, and cursorStatus.
|
|
206
|
+
*/
|
|
207
|
+
getPaginationInfo(): PaginationInfo;
|
|
208
|
+
/**
|
|
209
|
+
* Subscribe to pagination info changes.
|
|
210
|
+
* Called when server sends QUERY_RESP with new cursor info.
|
|
211
|
+
*
|
|
212
|
+
* @returns Unsubscribe function
|
|
213
|
+
*/
|
|
214
|
+
onPaginationChange(listener: (info: PaginationInfo) => void): () => void;
|
|
215
|
+
/**
|
|
216
|
+
* Update pagination info from server response.
|
|
217
|
+
* Called by SyncEngine when processing QUERY_RESP.
|
|
218
|
+
*
|
|
219
|
+
* @internal
|
|
220
|
+
*/
|
|
221
|
+
updatePaginationInfo(info: Partial<PaginationInfo>): void;
|
|
222
|
+
private notifyPaginationListeners;
|
|
189
223
|
}
|
|
190
224
|
|
|
191
225
|
/**
|
|
@@ -213,8 +247,8 @@ interface HybridQueryFilter {
|
|
|
213
247
|
sort?: Record<string, 'asc' | 'desc'>;
|
|
214
248
|
/** Maximum results */
|
|
215
249
|
limit?: number;
|
|
216
|
-
/**
|
|
217
|
-
|
|
250
|
+
/** Cursor for pagination (Phase 14.1: replaces offset) */
|
|
251
|
+
cursor?: string;
|
|
218
252
|
}
|
|
219
253
|
/**
|
|
220
254
|
* Result item with score for hybrid queries.
|
|
@@ -265,6 +299,8 @@ declare class HybridQueryHandle<T> {
|
|
|
265
299
|
private pendingChanges;
|
|
266
300
|
private changeListeners;
|
|
267
301
|
private hasReceivedServerData;
|
|
302
|
+
private _paginationInfo;
|
|
303
|
+
private paginationListeners;
|
|
268
304
|
constructor(syncEngine: SyncEngine, mapName: string, filter?: HybridQueryFilter);
|
|
269
305
|
/**
|
|
270
306
|
* Subscribe to query results.
|
|
@@ -328,6 +364,26 @@ declare class HybridQueryHandle<T> {
|
|
|
328
364
|
*/
|
|
329
365
|
hasFTSPredicate(): boolean;
|
|
330
366
|
private containsFTS;
|
|
367
|
+
/**
|
|
368
|
+
* Get current pagination info.
|
|
369
|
+
* Returns nextCursor, hasMore, and cursorStatus.
|
|
370
|
+
*/
|
|
371
|
+
getPaginationInfo(): PaginationInfo;
|
|
372
|
+
/**
|
|
373
|
+
* Subscribe to pagination info changes.
|
|
374
|
+
* Called when server sends HYBRID_QUERY_RESP with new cursor info.
|
|
375
|
+
*
|
|
376
|
+
* @returns Unsubscribe function
|
|
377
|
+
*/
|
|
378
|
+
onPaginationChange(listener: (info: PaginationInfo) => void): () => void;
|
|
379
|
+
/**
|
|
380
|
+
* Update pagination info from server response.
|
|
381
|
+
* Called by SyncEngine when processing HYBRID_QUERY_RESP.
|
|
382
|
+
*
|
|
383
|
+
* @internal
|
|
384
|
+
*/
|
|
385
|
+
updatePaginationInfo(info: Partial<PaginationInfo>): void;
|
|
386
|
+
private notifyPaginationListeners;
|
|
331
387
|
}
|
|
332
388
|
|
|
333
389
|
type TopicCallback = (data: any, context: {
|
|
@@ -1235,6 +1291,9 @@ declare class SyncEngine {
|
|
|
1235
1291
|
score: number;
|
|
1236
1292
|
matchedTerms: string[];
|
|
1237
1293
|
}>;
|
|
1294
|
+
nextCursor?: string;
|
|
1295
|
+
hasMore?: boolean;
|
|
1296
|
+
cursorStatus?: 'valid' | 'expired' | 'invalid' | 'none';
|
|
1238
1297
|
}): void;
|
|
1239
1298
|
/**
|
|
1240
1299
|
* Handle hybrid query delta update from server.
|
|
@@ -1845,7 +1904,7 @@ declare class TopGunClient {
|
|
|
1845
1904
|
* Results include relevance scores for FTS ranking.
|
|
1846
1905
|
*
|
|
1847
1906
|
* @param mapName Name of the map to query
|
|
1848
|
-
* @param filter Hybrid query filter with predicate, where, sort, limit,
|
|
1907
|
+
* @param filter Hybrid query filter with predicate, where, sort, limit, cursor
|
|
1849
1908
|
* @returns HybridQueryHandle for managing the subscription
|
|
1850
1909
|
*
|
|
1851
1910
|
* @example
|
|
@@ -2705,4 +2764,4 @@ declare class SingleServerProvider implements IConnectionProvider {
|
|
|
2705
2764
|
|
|
2706
2765
|
declare const logger: pino.Logger<never, boolean>;
|
|
2707
2766
|
|
|
2708
|
-
export { type BackoffConfig, type BackpressureConfig, BackpressureError, type BackpressureStatus, type BackpressureStrategy, type BackpressureThresholdEvent, type ChangeEvent, ChangeTracker, type CircuitState, ClusterClient, type ClusterClientEvents, type ClusterRoutingMode, ConflictResolverClient, type ConnectionEventHandler, ConnectionPool, type ConnectionPoolEvents, type ConnectionProviderEvent, DEFAULT_BACKPRESSURE_CONFIG, DEFAULT_CLUSTER_CONFIG, EncryptedStorageAdapter, EventJournalReader, type HeartbeatConfig, type HybridQueryFilter, HybridQueryHandle, type HybridResultItem, type HybridResultSource, type IConnectionProvider, IDBAdapter, type IStorageAdapter, type JournalEventData, type JournalSubscribeOptions, type OpLogEntry, type OperationDroppedEvent, PNCounterHandle, PartitionRouter, type PartitionRouterEvents, type QueryFilter, QueryHandle, type QueryResultItem, type QueryResultSource, type RegisterResult, type ResolverInfo, type RoutingMetrics, type RoutingResult, SearchHandle, type SearchResult, type SearchResultsCallback, SingleServerProvider, type SingleServerProviderConfig, type StateChangeEvent, type StateChangeListener, SyncEngine, type SyncEngineConfig, SyncState, SyncStateMachine, type SyncStateMachineConfig, TopGun, TopGunClient, type TopGunClientConfig, type TopGunClusterConfig, type TopicCallback, TopicHandle, VALID_TRANSITIONS, isValidTransition, logger };
|
|
2767
|
+
export { type BackoffConfig, type BackpressureConfig, BackpressureError, type BackpressureStatus, type BackpressureStrategy, type BackpressureThresholdEvent, type ChangeEvent, ChangeTracker, type CircuitState, ClusterClient, type ClusterClientEvents, type ClusterRoutingMode, ConflictResolverClient, type ConnectionEventHandler, ConnectionPool, type ConnectionPoolEvents, type ConnectionProviderEvent, type CursorStatus, DEFAULT_BACKPRESSURE_CONFIG, DEFAULT_CLUSTER_CONFIG, EncryptedStorageAdapter, EventJournalReader, type HeartbeatConfig, type HybridQueryFilter, HybridQueryHandle, type HybridResultItem, type HybridResultSource, type IConnectionProvider, IDBAdapter, type IStorageAdapter, type JournalEventData, type JournalSubscribeOptions, type OpLogEntry, type OperationDroppedEvent, PNCounterHandle, type PaginationInfo, PartitionRouter, type PartitionRouterEvents, type QueryFilter, QueryHandle, type QueryResultItem, type QueryResultSource, type RegisterResult, type ResolverInfo, type RoutingMetrics, type RoutingResult, SearchHandle, type SearchResult, type SearchResultsCallback, SingleServerProvider, type SingleServerProviderConfig, type StateChangeEvent, type StateChangeListener, SyncEngine, type SyncEngineConfig, SyncState, SyncStateMachine, type SyncStateMachineConfig, TopGun, TopGunClient, type TopGunClientConfig, type TopGunClusterConfig, type TopicCallback, TopicHandle, VALID_TRANSITIONS, isValidTransition, logger };
|
package/dist/index.d.ts
CHANGED
|
@@ -99,7 +99,19 @@ interface QueryFilter {
|
|
|
99
99
|
predicate?: PredicateNode;
|
|
100
100
|
sort?: Record<string, 'asc' | 'desc'>;
|
|
101
101
|
limit?: number;
|
|
102
|
-
offset
|
|
102
|
+
/** Cursor for pagination (Phase 14.1: replaces offset) */
|
|
103
|
+
cursor?: string;
|
|
104
|
+
}
|
|
105
|
+
/** Cursor status for debugging (Phase 14.1) */
|
|
106
|
+
type CursorStatus = 'valid' | 'expired' | 'invalid' | 'none';
|
|
107
|
+
/** Pagination info from server (Phase 14.1) */
|
|
108
|
+
interface PaginationInfo {
|
|
109
|
+
/** Cursor for fetching next page */
|
|
110
|
+
nextCursor?: string;
|
|
111
|
+
/** Whether more results are available */
|
|
112
|
+
hasMore: boolean;
|
|
113
|
+
/** Debug info: status of input cursor processing */
|
|
114
|
+
cursorStatus: CursorStatus;
|
|
103
115
|
}
|
|
104
116
|
/** Source of query results for proper handling of race conditions */
|
|
105
117
|
type QueryResultSource = 'local' | 'server';
|
|
@@ -117,6 +129,8 @@ declare class QueryHandle<T> {
|
|
|
117
129
|
private changeTracker;
|
|
118
130
|
private pendingChanges;
|
|
119
131
|
private changeListeners;
|
|
132
|
+
private _paginationInfo;
|
|
133
|
+
private paginationListeners;
|
|
120
134
|
constructor(syncEngine: SyncEngine, mapName: string, filter?: QueryFilter);
|
|
121
135
|
subscribe(callback: (results: QueryResultItem<T>[]) => void): () => void;
|
|
122
136
|
private loadInitialLocalData;
|
|
@@ -186,6 +200,26 @@ declare class QueryHandle<T> {
|
|
|
186
200
|
private getSortedResults;
|
|
187
201
|
getFilter(): QueryFilter;
|
|
188
202
|
getMapName(): string;
|
|
203
|
+
/**
|
|
204
|
+
* Get current pagination info.
|
|
205
|
+
* Returns nextCursor, hasMore, and cursorStatus.
|
|
206
|
+
*/
|
|
207
|
+
getPaginationInfo(): PaginationInfo;
|
|
208
|
+
/**
|
|
209
|
+
* Subscribe to pagination info changes.
|
|
210
|
+
* Called when server sends QUERY_RESP with new cursor info.
|
|
211
|
+
*
|
|
212
|
+
* @returns Unsubscribe function
|
|
213
|
+
*/
|
|
214
|
+
onPaginationChange(listener: (info: PaginationInfo) => void): () => void;
|
|
215
|
+
/**
|
|
216
|
+
* Update pagination info from server response.
|
|
217
|
+
* Called by SyncEngine when processing QUERY_RESP.
|
|
218
|
+
*
|
|
219
|
+
* @internal
|
|
220
|
+
*/
|
|
221
|
+
updatePaginationInfo(info: Partial<PaginationInfo>): void;
|
|
222
|
+
private notifyPaginationListeners;
|
|
189
223
|
}
|
|
190
224
|
|
|
191
225
|
/**
|
|
@@ -213,8 +247,8 @@ interface HybridQueryFilter {
|
|
|
213
247
|
sort?: Record<string, 'asc' | 'desc'>;
|
|
214
248
|
/** Maximum results */
|
|
215
249
|
limit?: number;
|
|
216
|
-
/**
|
|
217
|
-
|
|
250
|
+
/** Cursor for pagination (Phase 14.1: replaces offset) */
|
|
251
|
+
cursor?: string;
|
|
218
252
|
}
|
|
219
253
|
/**
|
|
220
254
|
* Result item with score for hybrid queries.
|
|
@@ -265,6 +299,8 @@ declare class HybridQueryHandle<T> {
|
|
|
265
299
|
private pendingChanges;
|
|
266
300
|
private changeListeners;
|
|
267
301
|
private hasReceivedServerData;
|
|
302
|
+
private _paginationInfo;
|
|
303
|
+
private paginationListeners;
|
|
268
304
|
constructor(syncEngine: SyncEngine, mapName: string, filter?: HybridQueryFilter);
|
|
269
305
|
/**
|
|
270
306
|
* Subscribe to query results.
|
|
@@ -328,6 +364,26 @@ declare class HybridQueryHandle<T> {
|
|
|
328
364
|
*/
|
|
329
365
|
hasFTSPredicate(): boolean;
|
|
330
366
|
private containsFTS;
|
|
367
|
+
/**
|
|
368
|
+
* Get current pagination info.
|
|
369
|
+
* Returns nextCursor, hasMore, and cursorStatus.
|
|
370
|
+
*/
|
|
371
|
+
getPaginationInfo(): PaginationInfo;
|
|
372
|
+
/**
|
|
373
|
+
* Subscribe to pagination info changes.
|
|
374
|
+
* Called when server sends HYBRID_QUERY_RESP with new cursor info.
|
|
375
|
+
*
|
|
376
|
+
* @returns Unsubscribe function
|
|
377
|
+
*/
|
|
378
|
+
onPaginationChange(listener: (info: PaginationInfo) => void): () => void;
|
|
379
|
+
/**
|
|
380
|
+
* Update pagination info from server response.
|
|
381
|
+
* Called by SyncEngine when processing HYBRID_QUERY_RESP.
|
|
382
|
+
*
|
|
383
|
+
* @internal
|
|
384
|
+
*/
|
|
385
|
+
updatePaginationInfo(info: Partial<PaginationInfo>): void;
|
|
386
|
+
private notifyPaginationListeners;
|
|
331
387
|
}
|
|
332
388
|
|
|
333
389
|
type TopicCallback = (data: any, context: {
|
|
@@ -1235,6 +1291,9 @@ declare class SyncEngine {
|
|
|
1235
1291
|
score: number;
|
|
1236
1292
|
matchedTerms: string[];
|
|
1237
1293
|
}>;
|
|
1294
|
+
nextCursor?: string;
|
|
1295
|
+
hasMore?: boolean;
|
|
1296
|
+
cursorStatus?: 'valid' | 'expired' | 'invalid' | 'none';
|
|
1238
1297
|
}): void;
|
|
1239
1298
|
/**
|
|
1240
1299
|
* Handle hybrid query delta update from server.
|
|
@@ -1845,7 +1904,7 @@ declare class TopGunClient {
|
|
|
1845
1904
|
* Results include relevance scores for FTS ranking.
|
|
1846
1905
|
*
|
|
1847
1906
|
* @param mapName Name of the map to query
|
|
1848
|
-
* @param filter Hybrid query filter with predicate, where, sort, limit,
|
|
1907
|
+
* @param filter Hybrid query filter with predicate, where, sort, limit, cursor
|
|
1849
1908
|
* @returns HybridQueryHandle for managing the subscription
|
|
1850
1909
|
*
|
|
1851
1910
|
* @example
|
|
@@ -2705,4 +2764,4 @@ declare class SingleServerProvider implements IConnectionProvider {
|
|
|
2705
2764
|
|
|
2706
2765
|
declare const logger: pino.Logger<never, boolean>;
|
|
2707
2766
|
|
|
2708
|
-
export { type BackoffConfig, type BackpressureConfig, BackpressureError, type BackpressureStatus, type BackpressureStrategy, type BackpressureThresholdEvent, type ChangeEvent, ChangeTracker, type CircuitState, ClusterClient, type ClusterClientEvents, type ClusterRoutingMode, ConflictResolverClient, type ConnectionEventHandler, ConnectionPool, type ConnectionPoolEvents, type ConnectionProviderEvent, DEFAULT_BACKPRESSURE_CONFIG, DEFAULT_CLUSTER_CONFIG, EncryptedStorageAdapter, EventJournalReader, type HeartbeatConfig, type HybridQueryFilter, HybridQueryHandle, type HybridResultItem, type HybridResultSource, type IConnectionProvider, IDBAdapter, type IStorageAdapter, type JournalEventData, type JournalSubscribeOptions, type OpLogEntry, type OperationDroppedEvent, PNCounterHandle, PartitionRouter, type PartitionRouterEvents, type QueryFilter, QueryHandle, type QueryResultItem, type QueryResultSource, type RegisterResult, type ResolverInfo, type RoutingMetrics, type RoutingResult, SearchHandle, type SearchResult, type SearchResultsCallback, SingleServerProvider, type SingleServerProviderConfig, type StateChangeEvent, type StateChangeListener, SyncEngine, type SyncEngineConfig, SyncState, SyncStateMachine, type SyncStateMachineConfig, TopGun, TopGunClient, type TopGunClientConfig, type TopGunClusterConfig, type TopicCallback, TopicHandle, VALID_TRANSITIONS, isValidTransition, logger };
|
|
2767
|
+
export { type BackoffConfig, type BackpressureConfig, BackpressureError, type BackpressureStatus, type BackpressureStrategy, type BackpressureThresholdEvent, type ChangeEvent, ChangeTracker, type CircuitState, ClusterClient, type ClusterClientEvents, type ClusterRoutingMode, ConflictResolverClient, type ConnectionEventHandler, ConnectionPool, type ConnectionPoolEvents, type ConnectionProviderEvent, type CursorStatus, DEFAULT_BACKPRESSURE_CONFIG, DEFAULT_CLUSTER_CONFIG, EncryptedStorageAdapter, EventJournalReader, type HeartbeatConfig, type HybridQueryFilter, HybridQueryHandle, type HybridResultItem, type HybridResultSource, type IConnectionProvider, IDBAdapter, type IStorageAdapter, type JournalEventData, type JournalSubscribeOptions, type OpLogEntry, type OperationDroppedEvent, PNCounterHandle, type PaginationInfo, PartitionRouter, type PartitionRouterEvents, type QueryFilter, QueryHandle, type QueryResultItem, type QueryResultSource, type RegisterResult, type ResolverInfo, type RoutingMetrics, type RoutingResult, SearchHandle, type SearchResult, type SearchResultsCallback, SingleServerProvider, type SingleServerProviderConfig, type StateChangeEvent, type StateChangeListener, SyncEngine, type SyncEngineConfig, SyncState, SyncStateMachine, type SyncStateMachineConfig, TopGun, TopGunClient, type TopGunClientConfig, type TopGunClusterConfig, type TopicCallback, TopicHandle, VALID_TRANSITIONS, isValidTransition, logger };
|
package/dist/index.js
CHANGED
|
@@ -1398,10 +1398,11 @@ var _SyncEngine = class _SyncEngine {
|
|
|
1398
1398
|
break;
|
|
1399
1399
|
}
|
|
1400
1400
|
case "QUERY_RESP": {
|
|
1401
|
-
const { queryId, results } = message.payload;
|
|
1401
|
+
const { queryId, results, nextCursor, hasMore, cursorStatus } = message.payload;
|
|
1402
1402
|
const query = this.queries.get(queryId);
|
|
1403
1403
|
if (query) {
|
|
1404
1404
|
query.onResult(results, "server");
|
|
1405
|
+
query.updatePaginationInfo({ nextCursor, hasMore, cursorStatus });
|
|
1405
1406
|
}
|
|
1406
1407
|
break;
|
|
1407
1408
|
}
|
|
@@ -2555,7 +2556,8 @@ var _SyncEngine = class _SyncEngine {
|
|
|
2555
2556
|
where: filter.where,
|
|
2556
2557
|
sort: filter.sort,
|
|
2557
2558
|
limit: filter.limit,
|
|
2558
|
-
|
|
2559
|
+
cursor: filter.cursor
|
|
2560
|
+
// Phase 14.1: replaces offset
|
|
2559
2561
|
}
|
|
2560
2562
|
});
|
|
2561
2563
|
}
|
|
@@ -2628,9 +2630,6 @@ var _SyncEngine = class _SyncEngine {
|
|
|
2628
2630
|
});
|
|
2629
2631
|
}
|
|
2630
2632
|
let sliced = results;
|
|
2631
|
-
if (filter.offset) {
|
|
2632
|
-
sliced = sliced.slice(filter.offset);
|
|
2633
|
-
}
|
|
2634
2633
|
if (filter.limit) {
|
|
2635
2634
|
sliced = sliced.slice(0, filter.limit);
|
|
2636
2635
|
}
|
|
@@ -2643,6 +2642,11 @@ var _SyncEngine = class _SyncEngine {
|
|
|
2643
2642
|
const query = this.hybridQueries.get(payload.subscriptionId);
|
|
2644
2643
|
if (query) {
|
|
2645
2644
|
query.onResult(payload.results, "server");
|
|
2645
|
+
query.updatePaginationInfo({
|
|
2646
|
+
nextCursor: payload.nextCursor,
|
|
2647
|
+
hasMore: payload.hasMore,
|
|
2648
|
+
cursorStatus: payload.cursorStatus
|
|
2649
|
+
});
|
|
2646
2650
|
}
|
|
2647
2651
|
}
|
|
2648
2652
|
/**
|
|
@@ -2765,6 +2769,9 @@ var QueryHandle = class {
|
|
|
2765
2769
|
this.changeTracker = new ChangeTracker();
|
|
2766
2770
|
this.pendingChanges = [];
|
|
2767
2771
|
this.changeListeners = /* @__PURE__ */ new Set();
|
|
2772
|
+
// Pagination info (Phase 14.1)
|
|
2773
|
+
this._paginationInfo = { hasMore: false, cursorStatus: "none" };
|
|
2774
|
+
this.paginationListeners = /* @__PURE__ */ new Set();
|
|
2768
2775
|
// Track if we've received authoritative server response
|
|
2769
2776
|
this.hasReceivedServerData = false;
|
|
2770
2777
|
this.id = crypto.randomUUID();
|
|
@@ -2958,6 +2965,49 @@ var QueryHandle = class {
|
|
|
2958
2965
|
getMapName() {
|
|
2959
2966
|
return this.mapName;
|
|
2960
2967
|
}
|
|
2968
|
+
// ============== Pagination Methods (Phase 14.1) ==============
|
|
2969
|
+
/**
|
|
2970
|
+
* Get current pagination info.
|
|
2971
|
+
* Returns nextCursor, hasMore, and cursorStatus.
|
|
2972
|
+
*/
|
|
2973
|
+
getPaginationInfo() {
|
|
2974
|
+
return { ...this._paginationInfo };
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Subscribe to pagination info changes.
|
|
2978
|
+
* Called when server sends QUERY_RESP with new cursor info.
|
|
2979
|
+
*
|
|
2980
|
+
* @returns Unsubscribe function
|
|
2981
|
+
*/
|
|
2982
|
+
onPaginationChange(listener) {
|
|
2983
|
+
this.paginationListeners.add(listener);
|
|
2984
|
+
listener(this.getPaginationInfo());
|
|
2985
|
+
return () => this.paginationListeners.delete(listener);
|
|
2986
|
+
}
|
|
2987
|
+
/**
|
|
2988
|
+
* Update pagination info from server response.
|
|
2989
|
+
* Called by SyncEngine when processing QUERY_RESP.
|
|
2990
|
+
*
|
|
2991
|
+
* @internal
|
|
2992
|
+
*/
|
|
2993
|
+
updatePaginationInfo(info) {
|
|
2994
|
+
this._paginationInfo = {
|
|
2995
|
+
nextCursor: info.nextCursor,
|
|
2996
|
+
hasMore: info.hasMore ?? false,
|
|
2997
|
+
cursorStatus: info.cursorStatus ?? "none"
|
|
2998
|
+
};
|
|
2999
|
+
this.notifyPaginationListeners();
|
|
3000
|
+
}
|
|
3001
|
+
notifyPaginationListeners() {
|
|
3002
|
+
const info = this.getPaginationInfo();
|
|
3003
|
+
for (const listener of this.paginationListeners) {
|
|
3004
|
+
try {
|
|
3005
|
+
listener(info);
|
|
3006
|
+
} catch (e) {
|
|
3007
|
+
logger.error({ err: e }, "QueryHandle pagination listener error");
|
|
3008
|
+
}
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
2961
3011
|
};
|
|
2962
3012
|
|
|
2963
3013
|
// src/DistributedLock.ts
|
|
@@ -3549,6 +3599,9 @@ var HybridQueryHandle = class {
|
|
|
3549
3599
|
this.changeListeners = /* @__PURE__ */ new Set();
|
|
3550
3600
|
// Track server data reception
|
|
3551
3601
|
this.hasReceivedServerData = false;
|
|
3602
|
+
// Pagination info (Phase 14.1)
|
|
3603
|
+
this._paginationInfo = { hasMore: false, cursorStatus: "none" };
|
|
3604
|
+
this.paginationListeners = /* @__PURE__ */ new Set();
|
|
3552
3605
|
this.id = crypto.randomUUID();
|
|
3553
3606
|
this.syncEngine = syncEngine;
|
|
3554
3607
|
this.mapName = mapName;
|
|
@@ -3731,9 +3784,6 @@ var HybridQueryHandle = class {
|
|
|
3731
3784
|
});
|
|
3732
3785
|
}
|
|
3733
3786
|
let sliced = results;
|
|
3734
|
-
if (this.filter.offset) {
|
|
3735
|
-
sliced = sliced.slice(this.filter.offset);
|
|
3736
|
-
}
|
|
3737
3787
|
if (this.filter.limit) {
|
|
3738
3788
|
sliced = sliced.slice(0, this.filter.limit);
|
|
3739
3789
|
}
|
|
@@ -3766,6 +3816,49 @@ var HybridQueryHandle = class {
|
|
|
3766
3816
|
}
|
|
3767
3817
|
return false;
|
|
3768
3818
|
}
|
|
3819
|
+
// ============== Pagination Methods (Phase 14.1) ==============
|
|
3820
|
+
/**
|
|
3821
|
+
* Get current pagination info.
|
|
3822
|
+
* Returns nextCursor, hasMore, and cursorStatus.
|
|
3823
|
+
*/
|
|
3824
|
+
getPaginationInfo() {
|
|
3825
|
+
return { ...this._paginationInfo };
|
|
3826
|
+
}
|
|
3827
|
+
/**
|
|
3828
|
+
* Subscribe to pagination info changes.
|
|
3829
|
+
* Called when server sends HYBRID_QUERY_RESP with new cursor info.
|
|
3830
|
+
*
|
|
3831
|
+
* @returns Unsubscribe function
|
|
3832
|
+
*/
|
|
3833
|
+
onPaginationChange(listener) {
|
|
3834
|
+
this.paginationListeners.add(listener);
|
|
3835
|
+
listener(this.getPaginationInfo());
|
|
3836
|
+
return () => this.paginationListeners.delete(listener);
|
|
3837
|
+
}
|
|
3838
|
+
/**
|
|
3839
|
+
* Update pagination info from server response.
|
|
3840
|
+
* Called by SyncEngine when processing HYBRID_QUERY_RESP.
|
|
3841
|
+
*
|
|
3842
|
+
* @internal
|
|
3843
|
+
*/
|
|
3844
|
+
updatePaginationInfo(info) {
|
|
3845
|
+
this._paginationInfo = {
|
|
3846
|
+
nextCursor: info.nextCursor,
|
|
3847
|
+
hasMore: info.hasMore ?? false,
|
|
3848
|
+
cursorStatus: info.cursorStatus ?? "none"
|
|
3849
|
+
};
|
|
3850
|
+
this.notifyPaginationListeners();
|
|
3851
|
+
}
|
|
3852
|
+
notifyPaginationListeners() {
|
|
3853
|
+
const info = this.getPaginationInfo();
|
|
3854
|
+
for (const listener of this.paginationListeners) {
|
|
3855
|
+
try {
|
|
3856
|
+
listener(info);
|
|
3857
|
+
} catch (e) {
|
|
3858
|
+
logger.error({ err: e }, "HybridQueryHandle pagination listener error");
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3861
|
+
}
|
|
3769
3862
|
};
|
|
3770
3863
|
|
|
3771
3864
|
// src/cluster/ClusterClient.ts
|
|
@@ -5661,7 +5754,7 @@ var TopGunClient = class {
|
|
|
5661
5754
|
* Results include relevance scores for FTS ranking.
|
|
5662
5755
|
*
|
|
5663
5756
|
* @param mapName Name of the map to query
|
|
5664
|
-
* @param filter Hybrid query filter with predicate, where, sort, limit,
|
|
5757
|
+
* @param filter Hybrid query filter with predicate, where, sort, limit, cursor
|
|
5665
5758
|
* @returns HybridQueryHandle for managing the subscription
|
|
5666
5759
|
*
|
|
5667
5760
|
* @example
|