@naturalcycles/db-lib 10.1.0 → 10.1.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/base.common.db.d.ts
CHANGED
|
@@ -2,9 +2,8 @@ import type { JsonSchemaObject, JsonSchemaRootObject, ObjectWithId, StringMap }
|
|
|
2
2
|
import type { ReadableTyped } from '@naturalcycles/nodejs-lib';
|
|
3
3
|
import type { CommonDB, CommonDBSupport } from './common.db.js';
|
|
4
4
|
import { CommonDBType } from './common.db.js';
|
|
5
|
-
import type { CommonDBOptions, CommonDBSaveOptions, CommonDBTransactionOptions, DBTransactionFn, RunQueryResult } from './db.model.js';
|
|
5
|
+
import type { CommonDBOptions, CommonDBSaveOptions, CommonDBTransactionOptions, DBTransaction, DBTransactionFn, RunQueryResult } from './db.model.js';
|
|
6
6
|
import type { DBQuery } from './query/dbQuery.js';
|
|
7
|
-
import { FakeDBTransaction } from './transaction/dbTransaction.util.js';
|
|
8
7
|
/**
|
|
9
8
|
* No-op implementation of CommonDB interface.
|
|
10
9
|
* To be extended by actual implementations.
|
|
@@ -25,6 +24,6 @@ export declare class BaseCommonDB implements CommonDB {
|
|
|
25
24
|
streamQuery<ROW extends ObjectWithId>(_q: DBQuery<ROW>): ReadableTyped<ROW>;
|
|
26
25
|
deleteByIds(_table: string, _ids: string[], _opt?: CommonDBOptions): Promise<number>;
|
|
27
26
|
runInTransaction(fn: DBTransactionFn, _opt?: CommonDBTransactionOptions): Promise<void>;
|
|
28
|
-
createTransaction(_opt?: CommonDBTransactionOptions): Promise<
|
|
27
|
+
createTransaction(_opt?: CommonDBTransactionOptions): Promise<DBTransaction>;
|
|
29
28
|
incrementBatch(_table: string, _prop: string, _incrementMap: StringMap<number>, _opt?: CommonDBOptions): Promise<StringMap<number>>;
|
|
30
29
|
}
|
package/package.json
CHANGED
package/src/base.common.db.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
CommonDBOptions,
|
|
12
12
|
CommonDBSaveOptions,
|
|
13
13
|
CommonDBTransactionOptions,
|
|
14
|
+
DBTransaction,
|
|
14
15
|
DBTransactionFn,
|
|
15
16
|
RunQueryResult,
|
|
16
17
|
} from './db.model.js'
|
|
@@ -93,7 +94,7 @@ export class BaseCommonDB implements CommonDB {
|
|
|
93
94
|
// there's no try/catch and rollback, as there's nothing to rollback
|
|
94
95
|
}
|
|
95
96
|
|
|
96
|
-
async createTransaction(_opt?: CommonDBTransactionOptions): Promise<
|
|
97
|
+
async createTransaction(_opt?: CommonDBTransactionOptions): Promise<DBTransaction> {
|
|
97
98
|
return new FakeDBTransaction(this)
|
|
98
99
|
}
|
|
99
100
|
|