@naturalcycles/datastore-lib 3.35.0 → 3.35.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.
@@ -132,7 +132,10 @@ class DatastoreStreamReadable extends node_stream_1.Readable {
132
132
  return;
133
133
  }
134
134
  if (!this.running) {
135
- void this.runNextQuery();
135
+ void this.runNextQuery().catch(err => {
136
+ console.log('error in runNextQuery', err);
137
+ this.emit('error', err);
138
+ });
136
139
  }
137
140
  else {
138
141
  this.logger.log(`_read ${this.count}, wasRunning: true`);
@@ -1,7 +1,7 @@
1
- import { Transaction } from '@google-cloud/datastore';
2
1
  import type { Datastore, Key, Query } from '@google-cloud/datastore';
3
- import { BaseCommonDB, CommonDB, CommonDBOptions, CommonDBSaveOptions, CommonDBSupport, DBQuery, DBTransaction, DBTransactionFn, RunQueryResult, CommonDBTransactionOptions } from '@naturalcycles/db-lib';
4
- import { JsonSchemaObject, JsonSchemaRootObject, CommonLogger, ObjectWithId } from '@naturalcycles/js-lib';
2
+ import { Transaction } from '@google-cloud/datastore';
3
+ import { BaseCommonDB, CommonDB, CommonDBOptions, CommonDBSaveOptions, CommonDBSupport, CommonDBTransactionOptions, DBQuery, DBTransaction, DBTransactionFn, RunQueryResult } from '@naturalcycles/db-lib';
4
+ import { CommonLogger, JsonSchemaObject, JsonSchemaRootObject, ObjectWithId } from '@naturalcycles/js-lib';
5
5
  import { ReadableTyped } from '@naturalcycles/nodejs-lib';
6
6
  import { DatastoreDBCfg, DatastoreDBOptions, DatastoreDBSaveOptions, DatastoreDBStreamOptions, DatastorePayload, DatastorePropertyStats, DatastoreStats } from './datastore.model';
7
7
  /**
@@ -5,8 +5,8 @@ const datastore_1 = require("@google-cloud/datastore");
5
5
  const db_lib_1 = require("@naturalcycles/db-lib");
6
6
  const js_lib_1 = require("@naturalcycles/js-lib");
7
7
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
8
- const DatastoreStreamReadable_1 = require("./DatastoreStreamReadable");
9
8
  const datastore_model_1 = require("./datastore.model");
9
+ const DatastoreStreamReadable_1 = require("./DatastoreStreamReadable");
10
10
  const query_util_1 = require("./query.util");
11
11
  // Datastore (also Firestore and other Google APIs) supports max 500 of items when saving/deleting, etc.
12
12
  const MAX_ITEMS = 500;
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@naturalcycles/datastore-lib",
3
- "version": "3.35.0",
3
+ "version": "3.35.2",
4
4
  "description": "Opinionated library to work with Google Datastore",
5
5
  "scripts": {
6
- "prepare": "husky"
6
+ "prepare": "husky",
7
+ "build": "dev-lib build",
8
+ "test": "dev-lib test",
9
+ "lint": "dev-lib lint",
10
+ "bt": "dev-lib bt",
11
+ "lbt": "dev-lib lbt"
7
12
  },
8
13
  "dependencies": {
9
14
  "@google-cloud/datastore": "^9.0.0",
@@ -12,8 +17,8 @@
12
17
  "@naturalcycles/nodejs-lib": "^13.1.0"
13
18
  },
14
19
  "devDependencies": {
15
- "@naturalcycles/dev-lib": "^13.0.0",
16
- "@types/node": "^20.4.1",
20
+ "@naturalcycles/dev-lib": "^15.2.0",
21
+ "@types/node": "^22.0.0",
17
22
  "jest": "^29.0.3"
18
23
  },
19
24
  "files": [
@@ -27,7 +32,7 @@
27
32
  "main": "dist/index.js",
28
33
  "types": "dist/index.d.ts",
29
34
  "engines": {
30
- "node": ">=18.12.0"
35
+ "node": ">=20.13.0"
31
36
  },
32
37
  "publishConfig": {
33
38
  "access": "public"
@@ -192,7 +192,10 @@ export class DatastoreStreamReadable<T = any> extends Readable implements Readab
192
192
  }
193
193
 
194
194
  if (!this.running) {
195
- void this.runNextQuery()
195
+ void this.runNextQuery().catch(err => {
196
+ console.log('error in runNextQuery', err)
197
+ this.emit('error', err)
198
+ })
196
199
  } else {
197
200
  this.logger.log(`_read ${this.count}, wasRunning: true`)
198
201
  }
@@ -1,5 +1,5 @@
1
- import { PropertyFilter, Transaction } from '@google-cloud/datastore'
2
1
  import type { Datastore, Key, Query } from '@google-cloud/datastore'
2
+ import { PropertyFilter, Transaction } from '@google-cloud/datastore'
3
3
  import {
4
4
  BaseCommonDB,
5
5
  CommonDB,
@@ -8,34 +8,33 @@ import {
8
8
  CommonDBSaveMethod,
9
9
  CommonDBSaveOptions,
10
10
  CommonDBSupport,
11
+ CommonDBTransactionOptions,
11
12
  DBQuery,
12
13
  DBTransaction,
13
14
  DBTransactionFn,
14
15
  RunQueryResult,
15
- CommonDBTransactionOptions,
16
16
  } from '@naturalcycles/db-lib'
17
17
  import {
18
+ _assert,
19
+ _chunk,
20
+ _omit,
21
+ CommonLogger,
22
+ commonLoggerMinLevel,
18
23
  JsonSchemaAny,
19
24
  JsonSchemaBoolean,
20
25
  JsonSchemaNull,
21
26
  JsonSchemaNumber,
22
27
  JsonSchemaObject,
28
+ JsonSchemaRootObject,
23
29
  JsonSchemaString,
30
+ ObjectWithId,
24
31
  pMap,
25
- _assert,
26
- _chunk,
27
- _omit,
28
- JsonSchemaRootObject,
29
- CommonLogger,
30
- commonLoggerMinLevel,
31
- pTimeout,
32
- pRetryFn,
33
32
  pRetry,
33
+ pRetryFn,
34
34
  PRetryOptions,
35
- ObjectWithId,
35
+ pTimeout,
36
36
  } from '@naturalcycles/js-lib'
37
- import { ReadableTyped, boldWhite } from '@naturalcycles/nodejs-lib'
38
- import { DatastoreStreamReadable } from './DatastoreStreamReadable'
37
+ import { boldWhite, ReadableTyped } from '@naturalcycles/nodejs-lib'
39
38
  import {
40
39
  DatastoreDBCfg,
41
40
  DatastoreDBOptions,
@@ -46,6 +45,7 @@ import {
46
45
  DatastoreStats,
47
46
  DatastoreType,
48
47
  } from './datastore.model'
48
+ import { DatastoreStreamReadable } from './DatastoreStreamReadable'
49
49
  import { dbQueryToDatastoreQuery } from './query.util'
50
50
 
51
51
  // Datastore (also Firestore and other Google APIs) supports max 500 of items when saving/deleting, etc.