@naturalcycles/datastore-lib 4.18.0 → 4.18.2

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.
@@ -200,18 +200,17 @@ export class DatastoreDB extends BaseCommonDB {
200
200
  };
201
201
  }
202
202
  streamQuery(dbQuery, _opt) {
203
- return Pipeline.fromAsyncReadable(async () => {
204
- const ds = this.ds();
205
- const q = dbQueryToDatastoreQuery(dbQuery, ds.createQuery(dbQuery.table));
206
- const opt = {
207
- logger: this.cfg.logger,
208
- ...this.cfg.streamOptions,
209
- ..._opt,
210
- };
211
- return opt.experimentalCursorStream
212
- ? new DatastoreStreamReadable(q, opt)
213
- : ds.runQueryStream(q, this.getRunQueryOptions(opt));
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.0",
4
+ "version": "4.18.2",
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": "18.4.2"
14
+ "@naturalcycles/dev-lib": "20.12.10"
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": ">=22.12.0"
30
+ "node": ">=24.10.0"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
@@ -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
- return Pipeline.fromAsyncReadable<ROW>(async () => {
306
- const ds = this.ds()
305
+ const ds = this.ds()
306
+ const q = dbQueryToDatastoreQuery(dbQuery, ds.createQuery(dbQuery.table))
307
307
 
308
- const q = dbQueryToDatastoreQuery(dbQuery, ds.createQuery(dbQuery.table))
308
+ const opt = {
309
+ logger: this.cfg.logger,
310
+ ...this.cfg.streamOptions,
311
+ ..._opt,
312
+ }
309
313
 
310
- const opt = {
311
- logger: this.cfg.logger,
312
- ...this.cfg.streamOptions,
313
- ..._opt,
314
- }
314
+ const readable = opt.experimentalCursorStream
315
+ ? new DatastoreStreamReadable<ROW>(q, opt)
316
+ : ds.runQueryStream(q, this.getRunQueryOptions(opt))
315
317
 
316
- return opt.experimentalCursorStream
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
@@ -113,8 +113,9 @@ export interface DatastoreDBOptions extends CommonDBOptions {}
113
113
 
114
114
  export interface DatastoreDBReadOptions extends CommonDBReadOptions {}
115
115
 
116
- export interface DatastoreDBSaveOptions<ROW extends ObjectWithId>
117
- extends CommonDBSaveOptions<ROW> {}
116
+ export interface DatastoreDBSaveOptions<
117
+ ROW extends ObjectWithId,
118
+ > extends CommonDBSaveOptions<ROW> {}
118
119
 
119
120
  export interface DatastoreStats {
120
121
  composite_index_count: number