@sprucelabs/data-stores 25.4.1 → 25.5.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.
|
@@ -10,6 +10,7 @@ export default class BatchCursorImpl<ResponseRecord> implements BatchCursor<Resp
|
|
|
10
10
|
private constructor();
|
|
11
11
|
static Cursor<Response>(store: AbstractStore<Schema>, query?: Record<string, any>, options?: FindBatchOptions): BatchCursor<Response>;
|
|
12
12
|
setOnNextResults(cb: (results: ResponseRecord[]) => never[]): void;
|
|
13
|
+
getTotalRecords(): Promise<number>;
|
|
13
14
|
next(): Promise<ResponseRecord[] | null>;
|
|
14
15
|
private bumpCursorPosition;
|
|
15
16
|
}
|
|
@@ -17,6 +18,7 @@ export interface FindBatchOptions<IncludePrivateFields extends boolean = true, F
|
|
|
17
18
|
batchSize?: number;
|
|
18
19
|
}
|
|
19
20
|
export interface BatchCursor<ResponseRecord> {
|
|
21
|
+
getTotalRecords(): Promise<number>;
|
|
20
22
|
setOnNextResults(cb: (results: ResponseRecord[]) => Record<string, any>[]): void;
|
|
21
23
|
next(): Promise<ResponseRecord[] | null>;
|
|
22
24
|
}
|
|
@@ -23,6 +23,9 @@ class BatchCursorImpl {
|
|
|
23
23
|
setOnNextResults(cb) {
|
|
24
24
|
this.nextHandler = cb;
|
|
25
25
|
}
|
|
26
|
+
async getTotalRecords() {
|
|
27
|
+
return this.store.count(Object.assign({}, this.query));
|
|
28
|
+
}
|
|
26
29
|
async next() {
|
|
27
30
|
var _a;
|
|
28
31
|
const _b = (_a = this.options) !== null && _a !== void 0 ? _a : {}, { batchSize = 10 } = _b, rest = __rest(_b, ["batchSize"]);
|
|
@@ -10,6 +10,7 @@ export default class BatchCursorImpl<ResponseRecord> implements BatchCursor<Resp
|
|
|
10
10
|
private constructor();
|
|
11
11
|
static Cursor<Response>(store: AbstractStore<Schema>, query?: Record<string, any>, options?: FindBatchOptions): BatchCursor<Response>;
|
|
12
12
|
setOnNextResults(cb: (results: ResponseRecord[]) => never[]): void;
|
|
13
|
+
getTotalRecords(): Promise<number>;
|
|
13
14
|
next(): Promise<ResponseRecord[] | null>;
|
|
14
15
|
private bumpCursorPosition;
|
|
15
16
|
}
|
|
@@ -17,6 +18,7 @@ export interface FindBatchOptions<IncludePrivateFields extends boolean = true, F
|
|
|
17
18
|
batchSize?: number;
|
|
18
19
|
}
|
|
19
20
|
export interface BatchCursor<ResponseRecord> {
|
|
21
|
+
getTotalRecords(): Promise<number>;
|
|
20
22
|
setOnNextResults(cb: (results: ResponseRecord[]) => Record<string, any>[]): void;
|
|
21
23
|
next(): Promise<ResponseRecord[] | null>;
|
|
22
24
|
}
|
|
@@ -30,6 +30,11 @@ export default class BatchCursorImpl {
|
|
|
30
30
|
setOnNextResults(cb) {
|
|
31
31
|
this.nextHandler = cb;
|
|
32
32
|
}
|
|
33
|
+
getTotalRecords() {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return this.store.count(Object.assign({}, this.query));
|
|
36
|
+
});
|
|
37
|
+
}
|
|
33
38
|
next() {
|
|
34
39
|
var _a;
|
|
35
40
|
return __awaiter(this, void 0, void 0, function* () {
|