@naturalcycles/mysql-lib 3.11.0 → 3.11.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.
@@ -40,7 +40,7 @@ export declare class MysqlDB extends BaseCommonDB implements CommonDB {
40
40
  * Be careful to manage this connection yourself (open, release, etc).
41
41
  */
42
42
  createSingleConnection(): Promise<Connection>;
43
- getByIds<ROW extends ObjectWithId>(table: string, ids: string[], opt?: MysqlDBOptions): Promise<ROW[]>;
43
+ getByIds<ROW extends ObjectWithId>(table: string, ids: ROW['id'][], opt?: MysqlDBOptions): Promise<ROW[]>;
44
44
  runQuery<ROW extends ObjectWithId, OUT = ROW>(q: DBQuery<ROW>, _opt?: MysqlDBOptions): Promise<RunQueryResult<OUT>>;
45
45
  runSQL<RESULT>(q: QueryOptions): Promise<RESULT>;
46
46
  /**
@@ -54,7 +54,7 @@ export declare class MysqlDB extends BaseCommonDB implements CommonDB {
54
54
  /**
55
55
  * Limitation: always returns [], regardless of which rows are actually deleted
56
56
  */
57
- deleteByIds(table: string, ids: string[], _opt?: MysqlDBOptions): Promise<number>;
57
+ deleteByIds<ROW extends ObjectWithId>(table: string, ids: ROW['id'][], _opt?: MysqlDBOptions): Promise<number>;
58
58
  deleteByQuery<ROW extends ObjectWithId>(q: DBQuery<ROW>, _opt?: CommonDBOptions): Promise<number>;
59
59
  /**
60
60
  * Use with caution!
package/dist/mysql.db.js CHANGED
@@ -227,7 +227,7 @@ class MysqlDB extends db_lib_1.BaseCommonDB {
227
227
  return (0, mysql_schema_util_1.mysqlTableStatsToJsonSchemaField)(table, stats, this.cfg.logger);
228
228
  }
229
229
  }
230
- (0, tslib_1.__decorate)([
230
+ tslib_1.__decorate([
231
231
  (0, js_lib_1._Memo)()
232
232
  ], MysqlDB.prototype, "pool", null);
233
233
  exports.MysqlDB = MysqlDB;
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "devDependencies": {
14
14
  "@naturalcycles/dev-lib": "^12.7.5",
15
15
  "@types/node": "^17.0.5",
16
- "dotenv": "^14.1.0",
16
+ "dotenv": "^16.0.0",
17
17
  "jest": "^27.2.4"
18
18
  },
19
19
  "files": [
@@ -36,7 +36,7 @@
36
36
  "engines": {
37
37
  "node": ">=14.15.0"
38
38
  },
39
- "version": "3.11.0",
39
+ "version": "3.11.1",
40
40
  "description": "MySQL client implementing CommonDB interface",
41
41
  "keywords": [
42
42
  "mysql",
package/src/mysql.db.ts CHANGED
@@ -176,7 +176,7 @@ export class MysqlDB extends BaseCommonDB implements CommonDB {
176
176
  // GET
177
177
  override async getByIds<ROW extends ObjectWithId>(
178
178
  table: string,
179
- ids: string[],
179
+ ids: ROW['id'][],
180
180
  opt: MysqlDBOptions = {},
181
181
  ): Promise<ROW[]> {
182
182
  if (!ids.length) return []
@@ -290,7 +290,11 @@ export class MysqlDB extends BaseCommonDB implements CommonDB {
290
290
  /**
291
291
  * Limitation: always returns [], regardless of which rows are actually deleted
292
292
  */
293
- override async deleteByIds(table: string, ids: string[], _opt?: MysqlDBOptions): Promise<number> {
293
+ override async deleteByIds<ROW extends ObjectWithId>(
294
+ table: string,
295
+ ids: ROW['id'][],
296
+ _opt?: MysqlDBOptions,
297
+ ): Promise<number> {
294
298
  if (!ids.length) return 0
295
299
  const sql = dbQueryToSQLDelete(new DBQuery(table).filterEq('id', ids))
296
300
  const res = await this.runSQL<any>({ sql })