@naturalcycles/datastore-lib 3.23.0 → 3.23.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.
- package/dist/datastore.db.js +3 -3
- package/package.json +2 -2
- package/src/datastore.db.ts +3 -4
package/dist/datastore.db.js
CHANGED
|
@@ -10,7 +10,7 @@ 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;
|
|
13
|
-
const RETRY_ON = ['GOAWAY', 'UNAVAILABLE', 'UNKNOWN', 'much contention'];
|
|
13
|
+
const RETRY_ON = ['GOAWAY', 'UNAVAILABLE', 'UNKNOWN', 'DEADLINE_EXCEEDED', 'much contention'];
|
|
14
14
|
// Examples of errors:
|
|
15
15
|
// UNKNOWN: Stream removed
|
|
16
16
|
const methodMap = {
|
|
@@ -206,8 +206,8 @@ class DatastoreDB extends db_lib_1.BaseCommonDB {
|
|
|
206
206
|
const tx = this.ds().transaction();
|
|
207
207
|
try {
|
|
208
208
|
await tx.run();
|
|
209
|
-
const ops =
|
|
210
|
-
for await (const op of ops) {
|
|
209
|
+
// const ops = mergeDBOperations(_tx.ops)
|
|
210
|
+
for await (const op of _tx.ops) {
|
|
211
211
|
if (op.type === 'saveBatch') {
|
|
212
212
|
await this.saveBatch(op.table, op.rows, { ...opt, tx });
|
|
213
213
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/datastore-lib",
|
|
3
|
-
"version": "3.23.
|
|
3
|
+
"version": "3.23.2",
|
|
4
4
|
"description": "Opinionated library to work with Google Datastore",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "husky install"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@naturalcycles/dev-lib": "^13.0.0",
|
|
17
17
|
"@types/node": "^18.7.2",
|
|
18
|
-
"jest": "^
|
|
18
|
+
"jest": "^29.0.3"
|
|
19
19
|
},
|
|
20
20
|
"resolutions": {
|
|
21
21
|
"long": "^4.0.0"
|
package/src/datastore.db.ts
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
CommonDBSaveMethod,
|
|
7
7
|
DBQuery,
|
|
8
8
|
DBTransaction,
|
|
9
|
-
mergeDBOperations,
|
|
10
9
|
RunQueryResult,
|
|
11
10
|
} from '@naturalcycles/db-lib'
|
|
12
11
|
import {
|
|
@@ -45,7 +44,7 @@ import { dbQueryToDatastoreQuery } from './query.util'
|
|
|
45
44
|
// Datastore (also Firestore and other Google APIs) supports max 500 of items when saving/deleting, etc.
|
|
46
45
|
const MAX_ITEMS = 500
|
|
47
46
|
|
|
48
|
-
const RETRY_ON = ['GOAWAY', 'UNAVAILABLE', 'UNKNOWN', 'much contention']
|
|
47
|
+
const RETRY_ON = ['GOAWAY', 'UNAVAILABLE', 'UNKNOWN', 'DEADLINE_EXCEEDED', 'much contention']
|
|
49
48
|
// Examples of errors:
|
|
50
49
|
// UNKNOWN: Stream removed
|
|
51
50
|
|
|
@@ -334,9 +333,9 @@ export class DatastoreDB extends BaseCommonDB implements CommonDB {
|
|
|
334
333
|
try {
|
|
335
334
|
await tx.run()
|
|
336
335
|
|
|
337
|
-
const ops = mergeDBOperations(_tx.ops)
|
|
336
|
+
// const ops = mergeDBOperations(_tx.ops)
|
|
338
337
|
|
|
339
|
-
for await (const op of ops) {
|
|
338
|
+
for await (const op of _tx.ops) {
|
|
340
339
|
if (op.type === 'saveBatch') {
|
|
341
340
|
await this.saveBatch(op.table, op.rows, { ...opt, tx })
|
|
342
341
|
} else if (op.type === 'deleteByIds') {
|