@naturalcycles/firestore-lib 1.4.0 → 1.4.1
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.js +5 -1
- package/package.json +1 -1
- package/src/firestore.db.ts +16 -11
package/dist/firestore.db.js
CHANGED
|
@@ -59,12 +59,16 @@ class FirestoreDB extends db_lib_1.BaseCommonDB {
|
|
|
59
59
|
}
|
|
60
60
|
streamQuery(q, _opt) {
|
|
61
61
|
const firestoreQuery = (0, query_util_1.dbQueryToFirestoreQuery)(q, this.cfg.firestore.collection(q.table));
|
|
62
|
-
|
|
62
|
+
const stream = firestoreQuery
|
|
63
|
+
.stream()
|
|
64
|
+
.on('error', err => stream.emit('error', err))
|
|
65
|
+
.pipe((0, nodejs_lib_1.transformMapSimple)(doc => ({
|
|
63
66
|
id: (0, firestore_util_1.unescapeDocId)(doc.id),
|
|
64
67
|
...doc.data(),
|
|
65
68
|
}), {
|
|
66
69
|
errorMode: js_lib_1.ErrorMode.SUPPRESS, // because .pipe cannot propagate errors
|
|
67
70
|
}));
|
|
71
|
+
return stream;
|
|
68
72
|
}
|
|
69
73
|
// SAVE
|
|
70
74
|
async saveBatch(table, rows, opt = {}) {
|
package/package.json
CHANGED
package/src/firestore.db.ts
CHANGED
|
@@ -111,17 +111,22 @@ export class FirestoreDB extends BaseCommonDB implements CommonDB {
|
|
|
111
111
|
): ReadableTyped<ROW> {
|
|
112
112
|
const firestoreQuery = dbQueryToFirestoreQuery(q, this.cfg.firestore.collection(q.table))
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
114
|
+
const stream: ReadableTyped<ROW> = firestoreQuery
|
|
115
|
+
.stream()
|
|
116
|
+
.on('error', err => stream.emit('error', err))
|
|
117
|
+
.pipe(
|
|
118
|
+
transformMapSimple<QueryDocumentSnapshot<any>, ROW>(
|
|
119
|
+
doc => ({
|
|
120
|
+
id: unescapeDocId(doc.id),
|
|
121
|
+
...doc.data(),
|
|
122
|
+
}),
|
|
123
|
+
{
|
|
124
|
+
errorMode: ErrorMode.SUPPRESS, // because .pipe cannot propagate errors
|
|
125
|
+
},
|
|
126
|
+
),
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
return stream
|
|
125
130
|
}
|
|
126
131
|
|
|
127
132
|
// SAVE
|