mssql-cr-layer 2.0.19 → 3.0.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.
- package/README.md +1 -1
- package/package.json +7 -10
- package/src/index.js +3 -15
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# mssql-cr-layer [![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url] [](https://circleci.com/gh/andrglo/mssql-cr-layer)
|
|
1
|
+
# mssql-cr-layer [![NPM version][npm-image]][npm-url] [![Dependency Status][daviddm-image]][daviddm-url] [](https://circleci.com/gh/andrglo/mssql-cr-layer) (https://coveralls.io/repos/github/andrglo/mssql-cr-layer/badge.svg?branch=master)](https://coveralls.io/github/andrglo/mssql-cr-layer?branch=master)
|
|
2
2
|
|
|
3
3
|
> A MS SQL Server interface layer for common requests. It uses [mssql](https://github.com/patriksimek/node-mssql) to connect
|
|
4
4
|
and wraps it in a tiny layer using ES2015 promises with the goal to be simpler and compatible with [pg](https://github.com/brianc/node-postgres)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mssql-cr-layer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "A MS SQL Server interface layer for common requests",
|
|
5
5
|
"repository": "andrglo/mssql-cr-layer",
|
|
6
6
|
"author": {
|
|
@@ -20,22 +20,19 @@
|
|
|
20
20
|
"interface"
|
|
21
21
|
],
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"chai": "^
|
|
24
|
-
"
|
|
25
|
-
"eslint": "^8.35.0",
|
|
23
|
+
"chai": "^5.1.1",
|
|
24
|
+
"eslint": "^9.11.1",
|
|
26
25
|
"eslint-config-google": "^0.14.0",
|
|
27
|
-
"mocha": "^10.
|
|
28
|
-
"nyc": "^15.1.0"
|
|
26
|
+
"mocha": "^10.7.3"
|
|
29
27
|
},
|
|
30
28
|
"scripts": {
|
|
31
|
-
"test": "
|
|
32
|
-
"test:report:coverage": "nyc report --reporter=text-lcov | coveralls",
|
|
29
|
+
"test": "mocha --bail --exit --timeout 15000 test/index.js",
|
|
33
30
|
"ssh": "docker exec -it mssql-cr-layer-dms-1 fish"
|
|
34
31
|
},
|
|
35
32
|
"license": "MIT",
|
|
36
33
|
"dependencies": {
|
|
37
|
-
"debug": "^4.3.
|
|
34
|
+
"debug": "^4.3.7",
|
|
38
35
|
"lodash.every": "^4.6.0",
|
|
39
|
-
"mssql": "^
|
|
36
|
+
"mssql": "^11.0.1"
|
|
40
37
|
}
|
|
41
38
|
}
|
package/src/index.js
CHANGED
|
@@ -241,21 +241,9 @@ MssqlCrLayer.prototype.query = function(statement, params, options) {
|
|
|
241
241
|
const param = params[key]
|
|
242
242
|
if (typeof param === 'object' && !(param instanceof Date)) {
|
|
243
243
|
input[key] = param && param.value !== void 0 ? param.value : null
|
|
244
|
-
// Fix crash when inform a Date value and pass a string
|
|
245
|
-
if (
|
|
246
|
-
input[key] !== null &&
|
|
247
|
-
(param.type === 'date' || param.type === 'datetime') &&
|
|
248
|
-
!(input[key] instanceof Date)
|
|
249
|
-
) {
|
|
250
|
-
input[key] = new Date(input[key])
|
|
251
|
-
}
|
|
252
244
|
ps.input(key, getType(input[key], param))
|
|
253
245
|
} else {
|
|
254
246
|
input[key] = param !== void 0 ? param : null
|
|
255
|
-
if (input[key] instanceof Date) {
|
|
256
|
-
// Fix mssql precision
|
|
257
|
-
input[key] = input[key].toISOString().substring(0, 23) + '000'
|
|
258
|
-
}
|
|
259
247
|
ps.input(key, getType(input[key]))
|
|
260
248
|
}
|
|
261
249
|
})
|
|
@@ -321,10 +309,10 @@ function getType(value, param) {
|
|
|
321
309
|
type = mssql.Date
|
|
322
310
|
break
|
|
323
311
|
case 'datetime':
|
|
324
|
-
if (param.timezone ===
|
|
325
|
-
type = mssql.DateTime2
|
|
326
|
-
} else {
|
|
312
|
+
if (param.timezone === true) {
|
|
327
313
|
type = mssql.DateTimeOffset
|
|
314
|
+
} else {
|
|
315
|
+
type = mssql.DateTime2
|
|
328
316
|
}
|
|
329
317
|
break
|
|
330
318
|
case 'string':
|