@naturalcycles/datastore-lib 4.18.0 → 4.18.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/datastore.db.js +11 -12
- package/package.json +3 -3
- package/src/datastore.db.ts +11 -12
package/dist/datastore.db.js
CHANGED
|
@@ -200,18 +200,17 @@ export class DatastoreDB extends BaseCommonDB {
|
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
202
|
streamQuery(dbQuery, _opt) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}).mapSync(r => this.mapId(r));
|
|
203
|
+
const ds = this.ds();
|
|
204
|
+
const q = dbQueryToDatastoreQuery(dbQuery, ds.createQuery(dbQuery.table));
|
|
205
|
+
const opt = {
|
|
206
|
+
logger: this.cfg.logger,
|
|
207
|
+
...this.cfg.streamOptions,
|
|
208
|
+
..._opt,
|
|
209
|
+
};
|
|
210
|
+
const readable = opt.experimentalCursorStream
|
|
211
|
+
? new DatastoreStreamReadable(q, opt)
|
|
212
|
+
: ds.runQueryStream(q, this.getRunQueryOptions(opt));
|
|
213
|
+
return Pipeline.from(readable).mapSync(r => this.mapId(r));
|
|
215
214
|
}
|
|
216
215
|
// https://github.com/GoogleCloudPlatform/nodejs-getting-started/blob/master/2-structured-data/books/model-datastore.js
|
|
217
216
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/datastore-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.18.
|
|
4
|
+
"version": "4.18.1",
|
|
5
5
|
"description": "Opinionated library to work with Google Datastore, implements CommonDB",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@google-cloud/datastore": "^10",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@types/node": "^24",
|
|
14
|
-
"@naturalcycles/dev-lib": "
|
|
14
|
+
"@naturalcycles/dev-lib": "20.11.0"
|
|
15
15
|
},
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./dist/index.js"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"main": "dist/index.js",
|
|
28
28
|
"types": "dist/index.d.ts",
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=24.10.0"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
package/src/datastore.db.ts
CHANGED
|
@@ -302,21 +302,20 @@ export class DatastoreDB extends BaseCommonDB implements CommonDB {
|
|
|
302
302
|
dbQuery: DBQuery<ROW>,
|
|
303
303
|
_opt?: DatastoreDBStreamOptions,
|
|
304
304
|
): Pipeline<ROW> {
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
const ds = this.ds()
|
|
306
|
+
const q = dbQueryToDatastoreQuery(dbQuery, ds.createQuery(dbQuery.table))
|
|
307
307
|
|
|
308
|
-
|
|
308
|
+
const opt = {
|
|
309
|
+
logger: this.cfg.logger,
|
|
310
|
+
...this.cfg.streamOptions,
|
|
311
|
+
..._opt,
|
|
312
|
+
}
|
|
309
313
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
..._opt,
|
|
314
|
-
}
|
|
314
|
+
const readable = opt.experimentalCursorStream
|
|
315
|
+
? new DatastoreStreamReadable<ROW>(q, opt)
|
|
316
|
+
: ds.runQueryStream(q, this.getRunQueryOptions(opt))
|
|
315
317
|
|
|
316
|
-
|
|
317
|
-
? new DatastoreStreamReadable<ROW>(q, opt)
|
|
318
|
-
: ds.runQueryStream(q, this.getRunQueryOptions(opt))
|
|
319
|
-
}).mapSync(r => this.mapId<ROW>(r))
|
|
318
|
+
return Pipeline.from<ROW>(readable).mapSync(r => this.mapId<ROW>(r))
|
|
320
319
|
}
|
|
321
320
|
|
|
322
321
|
// https://github.com/GoogleCloudPlatform/nodejs-getting-started/blob/master/2-structured-data/books/model-datastore.js
|