@naturalcycles/firestore-lib 1.3.0 → 1.4.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/firestore.db.d.ts +1 -1
- package/dist/firestore.db.js +4 -3
- package/package.json +1 -1
- package/src/firestore.db.ts +4 -3
package/dist/firestore.db.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare class FirestoreDB extends BaseCommonDB implements CommonDB {
|
|
|
15
15
|
getByIds<ROW extends ObjectWithId>(table: string, ids: ROW['id'][], _opt?: FirestoreDBOptions): Promise<ROW[]>;
|
|
16
16
|
runQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, opt?: FirestoreDBOptions): Promise<RunQueryResult<ROW>>;
|
|
17
17
|
runFirestoreQuery<ROW extends ObjectWithId>(q: Query, _opt?: FirestoreDBOptions): Promise<ROW[]>;
|
|
18
|
-
runQueryCount<ROW extends ObjectWithId>(q: DBQuery<ROW>,
|
|
18
|
+
runQueryCount<ROW extends ObjectWithId>(q: DBQuery<ROW>, _opt?: FirestoreDBOptions): Promise<number>;
|
|
19
19
|
streamQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, _opt?: CommonDBStreamOptions): ReadableTyped<ROW>;
|
|
20
20
|
saveBatch<ROW extends Partial<ObjectWithId>>(table: string, rows: ROW[], opt?: FirestoreDBSaveOptions<ROW>): Promise<void>;
|
|
21
21
|
deleteByQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, opt?: FirestoreDBOptions): Promise<number>;
|
package/dist/firestore.db.js
CHANGED
|
@@ -52,9 +52,10 @@ class FirestoreDB extends db_lib_1.BaseCommonDB {
|
|
|
52
52
|
async runFirestoreQuery(q, _opt) {
|
|
53
53
|
return this.querySnapshotToArray(await q.get());
|
|
54
54
|
}
|
|
55
|
-
async runQueryCount(q,
|
|
56
|
-
const
|
|
57
|
-
|
|
55
|
+
async runQueryCount(q, _opt) {
|
|
56
|
+
const firestoreQuery = (0, query_util_1.dbQueryToFirestoreQuery)(q, this.cfg.firestore.collection(q.table));
|
|
57
|
+
const r = await firestoreQuery.count().get();
|
|
58
|
+
return r.data().count;
|
|
58
59
|
}
|
|
59
60
|
streamQuery(q, _opt) {
|
|
60
61
|
const firestoreQuery = (0, query_util_1.dbQueryToFirestoreQuery)(q, this.cfg.firestore.collection(q.table));
|
package/package.json
CHANGED
package/src/firestore.db.ts
CHANGED
|
@@ -98,10 +98,11 @@ export class FirestoreDB extends BaseCommonDB implements CommonDB {
|
|
|
98
98
|
|
|
99
99
|
override async runQueryCount<ROW extends ObjectWithId>(
|
|
100
100
|
q: DBQuery<ROW>,
|
|
101
|
-
|
|
101
|
+
_opt?: FirestoreDBOptions,
|
|
102
102
|
): Promise<number> {
|
|
103
|
-
const
|
|
104
|
-
|
|
103
|
+
const firestoreQuery = dbQueryToFirestoreQuery(q, this.cfg.firestore.collection(q.table))
|
|
104
|
+
const r = await firestoreQuery.count().get()
|
|
105
|
+
return r.data().count
|
|
105
106
|
}
|
|
106
107
|
|
|
107
108
|
override streamQuery<ROW extends ObjectWithId>(
|