@naturalcycles/db-lib 9.26.1 → 9.26.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.
|
@@ -63,7 +63,7 @@ class CommonDao {
|
|
|
63
63
|
const op = `getById(${id})`;
|
|
64
64
|
const table = opt.table || this.cfg.table;
|
|
65
65
|
const started = this.logStarted(op, table);
|
|
66
|
-
let dbm = (await (opt.tx || this.cfg.db).getByIds(table, [id]))[0];
|
|
66
|
+
let dbm = (await (opt.tx || this.cfg.db).getByIds(table, [id], opt))[0];
|
|
67
67
|
if (dbm && this.cfg.hooks.afterLoad) {
|
|
68
68
|
dbm = (await this.cfg.hooks.afterLoad(dbm)) || undefined;
|
|
69
69
|
}
|
|
@@ -85,7 +85,7 @@ class CommonDao {
|
|
|
85
85
|
const op = `getByIdAsDBM(${id})`;
|
|
86
86
|
const table = opt.table || this.cfg.table;
|
|
87
87
|
const started = this.logStarted(op, table);
|
|
88
|
-
let [dbm] = await (opt.tx || this.cfg.db).getByIds(table, [id]);
|
|
88
|
+
let [dbm] = await (opt.tx || this.cfg.db).getByIds(table, [id], opt);
|
|
89
89
|
if (dbm && this.cfg.hooks.afterLoad) {
|
|
90
90
|
dbm = (await this.cfg.hooks.afterLoad(dbm)) || undefined;
|
|
91
91
|
}
|
|
@@ -99,7 +99,7 @@ class CommonDao {
|
|
|
99
99
|
const op = `getByIds ${ids.length} id(s) (${(0, js_lib_1._truncate)(ids.slice(0, 10).join(', '), 50)})`;
|
|
100
100
|
const table = opt.table || this.cfg.table;
|
|
101
101
|
const started = this.logStarted(op, table);
|
|
102
|
-
let dbms = await (opt.tx || this.cfg.db).getByIds(table, ids);
|
|
102
|
+
let dbms = await (opt.tx || this.cfg.db).getByIds(table, ids, opt);
|
|
103
103
|
if (this.cfg.hooks.afterLoad && dbms.length) {
|
|
104
104
|
dbms = (await (0, js_lib_1.pMap)(dbms, async (dbm) => await this.cfg.hooks.afterLoad(dbm))).filter(js_lib_1._isTruthy);
|
|
105
105
|
}
|
|
@@ -113,7 +113,7 @@ class CommonDao {
|
|
|
113
113
|
const op = `getByIdsAsDBM ${ids.length} id(s) (${(0, js_lib_1._truncate)(ids.slice(0, 10).join(', '), 50)})`;
|
|
114
114
|
const table = opt.table || this.cfg.table;
|
|
115
115
|
const started = this.logStarted(op, table);
|
|
116
|
-
let dbms = await (opt.tx || this.cfg.db).getByIds(table, ids);
|
|
116
|
+
let dbms = await (opt.tx || this.cfg.db).getByIds(table, ids, opt);
|
|
117
117
|
if (this.cfg.hooks.afterLoad && dbms.length) {
|
|
118
118
|
dbms = (await (0, js_lib_1.pMap)(dbms, async (dbm) => await this.cfg.hooks.afterLoad(dbm))).filter(js_lib_1._isTruthy);
|
|
119
119
|
}
|
package/package.json
CHANGED
|
@@ -123,7 +123,7 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
|
|
|
123
123
|
const table = opt.table || this.cfg.table
|
|
124
124
|
const started = this.logStarted(op, table)
|
|
125
125
|
|
|
126
|
-
let dbm = (await (opt.tx || this.cfg.db).getByIds<DBM>(table, [id as string]))[0]
|
|
126
|
+
let dbm = (await (opt.tx || this.cfg.db).getByIds<DBM>(table, [id as string], opt))[0]
|
|
127
127
|
if (dbm && this.cfg.hooks!.afterLoad) {
|
|
128
128
|
dbm = (await this.cfg.hooks!.afterLoad(dbm)) || undefined
|
|
129
129
|
}
|
|
@@ -147,7 +147,7 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
|
|
|
147
147
|
const op = `getByIdAsDBM(${id})`
|
|
148
148
|
const table = opt.table || this.cfg.table
|
|
149
149
|
const started = this.logStarted(op, table)
|
|
150
|
-
let [dbm] = await (opt.tx || this.cfg.db).getByIds<DBM>(table, [id as string])
|
|
150
|
+
let [dbm] = await (opt.tx || this.cfg.db).getByIds<DBM>(table, [id as string], opt)
|
|
151
151
|
if (dbm && this.cfg.hooks!.afterLoad) {
|
|
152
152
|
dbm = (await this.cfg.hooks!.afterLoad(dbm)) || undefined
|
|
153
153
|
}
|
|
@@ -162,7 +162,7 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
|
|
|
162
162
|
const op = `getByIds ${ids.length} id(s) (${_truncate(ids.slice(0, 10).join(', '), 50)})`
|
|
163
163
|
const table = opt.table || this.cfg.table
|
|
164
164
|
const started = this.logStarted(op, table)
|
|
165
|
-
let dbms = await (opt.tx || this.cfg.db).getByIds<DBM>(table, ids as string[])
|
|
165
|
+
let dbms = await (opt.tx || this.cfg.db).getByIds<DBM>(table, ids as string[], opt)
|
|
166
166
|
if (this.cfg.hooks!.afterLoad && dbms.length) {
|
|
167
167
|
dbms = (await pMap(dbms, async dbm => await this.cfg.hooks!.afterLoad!(dbm))).filter(
|
|
168
168
|
_isTruthy,
|
|
@@ -179,7 +179,7 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
|
|
|
179
179
|
const op = `getByIdsAsDBM ${ids.length} id(s) (${_truncate(ids.slice(0, 10).join(', '), 50)})`
|
|
180
180
|
const table = opt.table || this.cfg.table
|
|
181
181
|
const started = this.logStarted(op, table)
|
|
182
|
-
let dbms = await (opt.tx || this.cfg.db).getByIds<DBM>(table, ids as string[])
|
|
182
|
+
let dbms = await (opt.tx || this.cfg.db).getByIds<DBM>(table, ids as string[], opt)
|
|
183
183
|
if (this.cfg.hooks!.afterLoad && dbms.length) {
|
|
184
184
|
dbms = (await pMap(dbms, async dbm => await this.cfg.hooks!.afterLoad!(dbm))).filter(
|
|
185
185
|
_isTruthy,
|