@naturalcycles/datastore-lib 3.23.1 → 3.23.3
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
CHANGED
|
@@ -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
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DatastoreOptions, Key, Transaction } from '@google-cloud/datastore';
|
|
2
2
|
import { CommonDBOptions, CommonDBSaveOptions } from '@naturalcycles/db-lib';
|
|
3
|
-
import {
|
|
3
|
+
import { CommonLogger, ObjectWithId } from '@naturalcycles/js-lib';
|
|
4
4
|
export interface DatastorePayload<T = any> {
|
|
5
5
|
key: Key;
|
|
6
6
|
data: T;
|
|
@@ -99,7 +99,7 @@ export interface DatastoreDBStreamOptions extends DatastoreDBOptions {
|
|
|
99
99
|
export interface DatastoreDBOptions extends CommonDBOptions {
|
|
100
100
|
tx?: Transaction;
|
|
101
101
|
}
|
|
102
|
-
export interface DatastoreDBSaveOptions<ROW extends Partial<ObjectWithId> =
|
|
102
|
+
export interface DatastoreDBSaveOptions<ROW extends Partial<ObjectWithId> = any> extends CommonDBSaveOptions<ROW> {
|
|
103
103
|
tx?: Transaction;
|
|
104
104
|
}
|
|
105
105
|
export interface DatastoreStats {
|
package/package.json
CHANGED
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 {
|
|
@@ -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') {
|
package/src/datastore.model.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DatastoreOptions, Key, Transaction } from '@google-cloud/datastore'
|
|
2
2
|
import { CommonDBOptions, CommonDBSaveOptions } from '@naturalcycles/db-lib'
|
|
3
|
-
import {
|
|
3
|
+
import { CommonLogger, ObjectWithId } from '@naturalcycles/js-lib'
|
|
4
4
|
|
|
5
5
|
export interface DatastorePayload<T = any> {
|
|
6
6
|
key: Key
|
|
@@ -114,7 +114,7 @@ export interface DatastoreDBStreamOptions extends DatastoreDBOptions {
|
|
|
114
114
|
export interface DatastoreDBOptions extends CommonDBOptions {
|
|
115
115
|
tx?: Transaction
|
|
116
116
|
}
|
|
117
|
-
export interface DatastoreDBSaveOptions<ROW extends Partial<ObjectWithId> =
|
|
117
|
+
export interface DatastoreDBSaveOptions<ROW extends Partial<ObjectWithId> = any>
|
|
118
118
|
extends CommonDBSaveOptions<ROW> {
|
|
119
119
|
tx?: Transaction
|
|
120
120
|
}
|