@naturalcycles/mysql-lib 4.1.0 → 4.2.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.
@@ -1,7 +1,7 @@
1
1
  import type { CommonDB, CommonDBCreateOptions, CommonDBOptions, CommonDBSaveOptions, CommonDBSupport, RunQueryResult } from '@naturalcycles/db-lib';
2
2
  import { BaseCommonDB, CommonDBType, DBQuery } from '@naturalcycles/db-lib';
3
3
  import type { CommonLogger, JsonSchemaObject, JsonSchemaRootObject, ObjectWithId } from '@naturalcycles/js-lib';
4
- import type { ReadableTyped } from '@naturalcycles/nodejs-lib';
4
+ import type { ReadableTyped } from '@naturalcycles/nodejs-lib/stream';
5
5
  import type { Connection, Pool, PoolConfig, PoolConnection, QueryOptions } from 'mysql';
6
6
  export interface MysqlDBOptions extends CommonDBOptions {
7
7
  }
package/dist/mysql.db.js CHANGED
@@ -125,7 +125,7 @@ export class MysqlDB extends BaseCommonDB {
125
125
  rows: [],
126
126
  };
127
127
  }
128
- const rows = (await this.runSQL({ sql })).map(row => _mapKeys(_filterUndefinedValues(row, true), k => mapNameFromMySQL(k)));
128
+ const rows = (await this.runSQL({ sql })).map(row => _mapKeys(_filterUndefinedValues(row, { mutate: true }), k => mapNameFromMySQL(k)));
129
129
  // edge case where 0 fields are selected
130
130
  if (q._selectedFieldNames?.length === 0) {
131
131
  return {
@@ -181,7 +181,7 @@ export class MysqlDB extends BaseCommonDB {
181
181
  .pipe(new Transform({
182
182
  objectMode: true,
183
183
  transform(row, _encoding, cb) {
184
- cb(null, _filterUndefinedValues(row, true));
184
+ cb(null, _filterUndefinedValues(row, { mutate: true }));
185
185
  },
186
186
  }));
187
187
  }
@@ -1,5 +1,5 @@
1
1
  import type { CommonDBCreateOptions, CommonKeyValueDB, IncrementTuple, KeyValueDBTuple } from '@naturalcycles/db-lib';
2
- import type { ReadableTyped } from '@naturalcycles/nodejs-lib';
2
+ import type { ReadableTyped } from '@naturalcycles/nodejs-lib/stream';
3
3
  import type { MysqlDBCfg } from './mysql.db.js';
4
4
  import { MysqlDB } from './mysql.db.js';
5
5
  export declare class MySQLKeyValueDB implements CommonKeyValueDB {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "dependencies": {
5
5
  "@naturalcycles/db-lib": "^10",
6
6
  "@naturalcycles/js-lib": "^15",
7
- "@naturalcycles/nodejs-lib": "^14",
7
+ "@naturalcycles/nodejs-lib": "^15",
8
8
  "@types/mysql": "^2",
9
9
  "mysql": "^2",
10
10
  "tslib": "^2"
@@ -12,7 +12,10 @@
12
12
  "devDependencies": {
13
13
  "@naturalcycles/dev-lib": "*",
14
14
  "@types/node": "^24",
15
- "dotenv": "^16"
15
+ "dotenv": "^17"
16
+ },
17
+ "exports": {
18
+ ".": "./dist/index.js"
16
19
  },
17
20
  "files": [
18
21
  "dist",
@@ -35,7 +38,7 @@
35
38
  "engines": {
36
39
  "node": ">=22.12.0"
37
40
  },
38
- "version": "4.1.0",
41
+ "version": "4.2.0",
39
42
  "description": "MySQL client implementing CommonDB interface",
40
43
  "keywords": [
41
44
  "mysql",
package/src/mysql.db.ts CHANGED
@@ -24,8 +24,8 @@ import {
24
24
  _omit,
25
25
  commonLoggerPrefix,
26
26
  } from '@naturalcycles/js-lib'
27
- import type { ReadableTyped } from '@naturalcycles/nodejs-lib'
28
27
  import { white } from '@naturalcycles/nodejs-lib'
28
+ import type { ReadableTyped } from '@naturalcycles/nodejs-lib/stream'
29
29
  import type {
30
30
  Connection,
31
31
  OkPacket,
@@ -222,7 +222,10 @@ export class MysqlDB extends BaseCommonDB implements CommonDB {
222
222
  }
223
223
 
224
224
  const rows = (await this.runSQL<ROW[]>({ sql })).map(
225
- row => _mapKeys(_filterUndefinedValues(row, true), k => mapNameFromMySQL(k as string)) as any,
225
+ row =>
226
+ _mapKeys(_filterUndefinedValues(row, { mutate: true }), k =>
227
+ mapNameFromMySQL(k as string),
228
+ ) as any,
226
229
  )
227
230
 
228
231
  // edge case where 0 fields are selected
@@ -293,7 +296,7 @@ export class MysqlDB extends BaseCommonDB implements CommonDB {
293
296
  new Transform({
294
297
  objectMode: true,
295
298
  transform(row: ROW, _encoding, cb) {
296
- cb(null, _filterUndefinedValues(row, true))
299
+ cb(null, _filterUndefinedValues(row, { mutate: true }))
297
300
  },
298
301
  }),
299
302
  )
@@ -8,7 +8,7 @@ import type {
8
8
  import { commonKeyValueDBFullSupport } from '@naturalcycles/db-lib'
9
9
  import type { ObjectWithId } from '@naturalcycles/js-lib'
10
10
  import { AppError, pMap } from '@naturalcycles/js-lib'
11
- import type { ReadableTyped } from '@naturalcycles/nodejs-lib'
11
+ import type { ReadableTyped } from '@naturalcycles/nodejs-lib/stream'
12
12
  import type { QueryOptions } from 'mysql'
13
13
  import type { MysqlDBCfg } from './mysql.db.js'
14
14
  import { MysqlDB } from './mysql.db.js'