@naturalcycles/db-lib 9.17.0 → 9.18.0

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.
@@ -15,10 +15,8 @@ export declare class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity
15
15
  cfg: CommonDaoCfg<BM, DBM, ID>;
16
16
  constructor(cfg: CommonDaoCfg<BM, DBM, ID>);
17
17
  create(part?: Partial<BM>, opt?: CommonDaoOptions): BM;
18
- getById(id: undefined | null, opt?: CommonDaoOptions): Promise<null>;
19
18
  getById(id?: ID | null, opt?: CommonDaoOptions): Promise<BM | null>;
20
19
  getByIdOrEmpty(id: ID, part?: Partial<BM>, opt?: CommonDaoOptions): Promise<BM>;
21
- getByIdAsDBM(id: undefined | null, opt?: CommonDaoOptions): Promise<null>;
22
20
  getByIdAsDBM(id?: ID | null, opt?: CommonDaoOptions): Promise<DBM | null>;
23
21
  getByIds(ids: ID[], opt?: CommonDaoOptions): Promise<BM[]>;
24
22
  getByIdsAsDBM(ids: ID[], opt?: CommonDaoOptions): Promise<DBM[]>;
@@ -53,6 +53,10 @@ class CommonDao {
53
53
  this.assignIdCreatedUpdated(bm, opt);
54
54
  return this.validateAndConvert(bm, this.cfg.bmSchema, undefined, opt);
55
55
  }
56
+ // GET
57
+ // overrides are disabled now, as they obfuscate errors when ID branded type is used
58
+ // async getById(id: undefined | null, opt?: CommonDaoOptions): Promise<null>
59
+ // async getById(id?: ID | null, opt?: CommonDaoOptions): Promise<BM | null>
56
60
  async getById(id, opt = {}) {
57
61
  if (!id)
58
62
  return null;
@@ -73,6 +77,8 @@ class CommonDao {
73
77
  return bm;
74
78
  return this.create({ ...part, id }, opt);
75
79
  }
80
+ // async getByIdAsDBM(id: undefined | null, opt?: CommonDaoOptions): Promise<null>
81
+ // async getByIdAsDBM(id?: ID | null, opt?: CommonDaoOptions): Promise<DBM | null>
76
82
  async getByIdAsDBM(id, opt = {}) {
77
83
  if (!id)
78
84
  return null;
package/package.json CHANGED
@@ -45,7 +45,7 @@
45
45
  "engines": {
46
46
  "node": ">=20.13"
47
47
  },
48
- "version": "9.17.0",
48
+ "version": "9.18.0",
49
49
  "description": "Lowest Common Denominator API to supported Databases",
50
50
  "keywords": [
51
51
  "db",
@@ -112,8 +112,9 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
112
112
  }
113
113
 
114
114
  // GET
115
- async getById(id: undefined | null, opt?: CommonDaoOptions): Promise<null>
116
- async getById(id?: ID | null, opt?: CommonDaoOptions): Promise<BM | null>
115
+ // overrides are disabled now, as they obfuscate errors when ID branded type is used
116
+ // async getById(id: undefined | null, opt?: CommonDaoOptions): Promise<null>
117
+ // async getById(id?: ID | null, opt?: CommonDaoOptions): Promise<BM | null>
117
118
  async getById(id?: ID | null, opt: CommonDaoOptions = {}): Promise<BM | null> {
118
119
  if (!id) return null
119
120
  const op = `getById(${id})`
@@ -137,8 +138,8 @@ export class CommonDao<BM extends BaseDBEntity, DBM extends BaseDBEntity = BM, I
137
138
  return this.create({ ...part, id }, opt)
138
139
  }
139
140
 
140
- async getByIdAsDBM(id: undefined | null, opt?: CommonDaoOptions): Promise<null>
141
- async getByIdAsDBM(id?: ID | null, opt?: CommonDaoOptions): Promise<DBM | null>
141
+ // async getByIdAsDBM(id: undefined | null, opt?: CommonDaoOptions): Promise<null>
142
+ // async getByIdAsDBM(id?: ID | null, opt?: CommonDaoOptions): Promise<DBM | null>
142
143
  async getByIdAsDBM(id?: ID | null, opt: CommonDaoOptions = {}): Promise<DBM | null> {
143
144
  if (!id) return null
144
145
  const op = `getByIdAsDBM(${id})`