@sprucelabs/data-stores 25.4.0 → 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.
- package/build/cursors/BatchCursor.d.ts +2 -0
- package/build/cursors/BatchCursor.js +3 -0
- package/build/esm/cursors/BatchCursor.d.ts +2 -0
- package/build/esm/cursors/BatchCursor.js +5 -0
- package/build/esm/index.d.ts +1 -1
- package/build/esm/index.js +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +2 -2
- package/package.json +1 -1
|
@@ -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* () {
|
package/build/esm/index.d.ts
CHANGED
|
@@ -25,5 +25,5 @@ export * from './cursors/CursorPager';
|
|
|
25
25
|
*/
|
|
26
26
|
export { default as databaseAssertUtil } from './tests/databaseAssertUtil';
|
|
27
27
|
export { default as databaseAssert } from './tests/databaseAssertUtil';
|
|
28
|
-
export { default as
|
|
28
|
+
export { default as BatchCursorImpl } from './cursors/BatchCursor';
|
|
29
29
|
export * from './cursors/BatchCursor';
|
package/build/esm/index.js
CHANGED
|
@@ -25,5 +25,5 @@ export * from './cursors/CursorPager.js';
|
|
|
25
25
|
*/
|
|
26
26
|
export { default as databaseAssertUtil } from './tests/databaseAssertUtil.js';
|
|
27
27
|
export { default as databaseAssert } from './tests/databaseAssertUtil.js';
|
|
28
|
-
export { default as
|
|
28
|
+
export { default as BatchCursorImpl } from './cursors/BatchCursor.js';
|
|
29
29
|
export * from './cursors/BatchCursor.js';
|
package/build/index.d.ts
CHANGED
|
@@ -25,5 +25,5 @@ export * from './cursors/CursorPager';
|
|
|
25
25
|
*/
|
|
26
26
|
export { default as databaseAssertUtil } from './tests/databaseAssertUtil';
|
|
27
27
|
export { default as databaseAssert } from './tests/databaseAssertUtil';
|
|
28
|
-
export { default as
|
|
28
|
+
export { default as BatchCursorImpl } from './cursors/BatchCursor';
|
|
29
29
|
export * from './cursors/BatchCursor';
|
package/build/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
20
|
+
exports.BatchCursorImpl = exports.databaseAssert = exports.databaseAssertUtil = exports.CursorPagerFaker = exports.CursorPager = exports.generateId = exports.DataStoresError = exports.mongoUtil = exports.NeDbDatabase = exports.MongoDatabase = exports.StoreLoader = exports.DatabaseFactory = exports.StoreFactory = exports.AbstractStore = exports.DatabaseFixture = exports.AbstractDatabaseTest = void 0;
|
|
21
21
|
var AbstractDatabaseTest_1 = require("./tests/AbstractDatabaseTest");
|
|
22
22
|
Object.defineProperty(exports, "AbstractDatabaseTest", { enumerable: true, get: function () { return __importDefault(AbstractDatabaseTest_1).default; } });
|
|
23
23
|
var DatabaseFixture_1 = require("./fixtures/DatabaseFixture");
|
|
@@ -61,5 +61,5 @@ Object.defineProperty(exports, "databaseAssertUtil", { enumerable: true, get: fu
|
|
|
61
61
|
var databaseAssertUtil_2 = require("./tests/databaseAssertUtil");
|
|
62
62
|
Object.defineProperty(exports, "databaseAssert", { enumerable: true, get: function () { return __importDefault(databaseAssertUtil_2).default; } });
|
|
63
63
|
var BatchCursor_1 = require("./cursors/BatchCursor");
|
|
64
|
-
Object.defineProperty(exports, "
|
|
64
|
+
Object.defineProperty(exports, "BatchCursorImpl", { enumerable: true, get: function () { return __importDefault(BatchCursor_1).default; } });
|
|
65
65
|
__exportStar(require("./cursors/BatchCursor"), exports);
|