mssql-cr-layer 2.0.9 → 2.0.13

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.
Files changed (3) hide show
  1. package/LICENSE +1 -1
  2. package/package.json +6 -6
  3. package/src/index.js +12 -3
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 Andre Gloria <andredagloria@gmail.com> (andrglo.com)
3
+ Copyright (c) 2022 Andre Gloria <andredagloria@gmail.com> (andrglo.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mssql-cr-layer",
3
- "version": "2.0.9",
3
+ "version": "2.0.13",
4
4
  "description": "A MS SQL Server interface layer for common requests",
5
5
  "repository": "andrglo/mssql-cr-layer",
6
6
  "author": {
@@ -20,11 +20,11 @@
20
20
  "interface"
21
21
  ],
22
22
  "devDependencies": {
23
- "chai": "^4.3.0",
24
- "coveralls": "^3.1.0",
25
- "eslint": "^7.20.0",
23
+ "chai": "^4.3.6",
24
+ "coveralls": "^3.1.1",
25
+ "eslint": "^8.8.0",
26
26
  "eslint-config-google": "^0.14.0",
27
- "mocha": "^8.3.0",
27
+ "mocha": "^9.2.0",
28
28
  "nyc": "^15.1.0"
29
29
  },
30
30
  "scripts": {
@@ -35,6 +35,6 @@
35
35
  "license": "MIT",
36
36
  "dependencies": {
37
37
  "lodash.every": "^4.6.0",
38
- "mssql": "^6.3.1"
38
+ "mssql": "^8.0.1"
39
39
  }
40
40
  }
package/src/index.js CHANGED
@@ -324,6 +324,8 @@ function getType(value, param) {
324
324
  type = mssql.DateTime2
325
325
  } else if (typeof value === 'number') {
326
326
  type = mssql.Decimal(('' + value).length, decimalPlaces(value))
327
+ } else if (typeof value === 'boolean') {
328
+ type = mssql.Bit
327
329
  }
328
330
  }
329
331
  return type
@@ -343,14 +345,13 @@ function decimalPlaces(num) {
343
345
  }
344
346
 
345
347
  function toMssqlConfig(config) {
346
- return {
348
+ const mssqlConfig = {
347
349
  port: 1433,
348
350
  server: config.host || 'localhost',
349
351
  requestTimeout: 6000,
350
352
  ...config || {},
351
353
  pool: {
352
- min: 0,
353
- ...config.pool || {}
354
+ min: 0
354
355
  },
355
356
  options: {
356
357
  encrypt: false,
@@ -358,4 +359,12 @@ function toMssqlConfig(config) {
358
359
  ...config.options || {},
359
360
  }
360
361
  }
362
+ if (config.pool) {
363
+ mssqlConfig.pool = {...mssqlConfig.pool, ...config.pool}
364
+ if (mssqlConfig.pool.idleTimeout) {
365
+ mssqlConfig.pool.idleTimeoutMillis = mssqlConfig.pool.idleTimeout
366
+ delete mssqlConfig.pool.idleTimeout
367
+ }
368
+ }
369
+ return mssqlConfig
361
370
  }