@naturalcycles/db-lib 9.26.1 → 9.26.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.
@@ -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
  }
@@ -2,7 +2,7 @@ import { CommonDBOptions, CommonDBSaveOptions } from '../db.model';
2
2
  import { DBQuery, DBQueryFilter, DBQueryFilterOperator, DBQueryOrder } from '../query/dbQuery';
3
3
  export declare const commonDBOptionsSchema: import("joi").ObjectSchema<CommonDBOptions>;
4
4
  export declare const commonDBSaveOptionsSchema: import("joi").ObjectSchema<CommonDBSaveOptions<any>>;
5
- export declare const dbQueryFilterOperatorSchema: import("@naturalcycles/nodejs-lib/dist/validation/joi/string.extensions").StringSchema<DBQueryFilterOperator>;
5
+ export declare const dbQueryFilterOperatorSchema: import("@naturalcycles/nodejs-lib").StringSchema<DBQueryFilterOperator>;
6
6
  export declare const dbQueryFilterSchema: import("joi").ObjectSchema<DBQueryFilter<any>>;
7
7
  export declare const dbQueryOrderSchema: import("joi").ObjectSchema<DBQueryOrder<any>>;
8
8
  export declare const dbQuerySchema: import("joi").ObjectSchema<DBQuery<any>>;
package/package.json CHANGED
@@ -9,14 +9,14 @@
9
9
  "lbt": "dev-lib lbt"
10
10
  },
11
11
  "dependencies": {
12
- "@naturalcycles/js-lib": "^14.116.0",
13
- "@naturalcycles/nodejs-lib": "^13.1.1"
12
+ "@naturalcycles/js-lib": "^14",
13
+ "@naturalcycles/nodejs-lib": "^13"
14
14
  },
15
15
  "devDependencies": {
16
- "@naturalcycles/bench-lib": "^3.0.0",
17
- "@naturalcycles/dev-lib": "^15.4.1",
18
- "@types/node": "^22.1.0",
19
- "jest": "^29.0.0"
16
+ "@naturalcycles/bench-lib": "^3",
17
+ "@naturalcycles/dev-lib": "^15",
18
+ "@types/node": "^22",
19
+ "jest": "^29"
20
20
  },
21
21
  "files": [
22
22
  "dist",
@@ -45,7 +45,7 @@
45
45
  "engines": {
46
46
  "node": ">=22.10.0"
47
47
  },
48
- "version": "9.26.1",
48
+ "version": "9.26.3",
49
49
  "description": "Lowest Common Denominator API to supported Databases",
50
50
  "keywords": [
51
51
  "db",
@@ -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,