@petradb/knex 1.2.1 → 1.3.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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ declare class PetraDBClient extends ClientBase {
|
|
|
75
75
|
destroyRawConnection(connection: any): Promise<void>;
|
|
76
76
|
validateConnection(connection: any): boolean;
|
|
77
77
|
positionBindings(sql: string): string;
|
|
78
|
+
_sanitizeBindings(bindings: any[]): any[];
|
|
78
79
|
_query(connection: any, obj: any): Promise<any>;
|
|
79
80
|
processResponse(obj: any, runner: any): any;
|
|
80
81
|
poolDefaults(): any;
|
package/dist/index.js
CHANGED
|
@@ -347,11 +347,18 @@ class PetraDBClient extends ClientBase {
|
|
|
347
347
|
}
|
|
348
348
|
});
|
|
349
349
|
}
|
|
350
|
+
_sanitizeBindings(bindings) {
|
|
351
|
+
return bindings.map((val) => {
|
|
352
|
+
if (val instanceof Date)
|
|
353
|
+
return val.toISOString();
|
|
354
|
+
return val;
|
|
355
|
+
});
|
|
356
|
+
}
|
|
350
357
|
async _query(connection, obj) {
|
|
351
358
|
if (!obj.sql)
|
|
352
359
|
throw new Error("The query is empty");
|
|
353
360
|
const sql = obj.sql;
|
|
354
|
-
const bindings = obj.bindings || [];
|
|
361
|
+
const bindings = this._sanitizeBindings(obj.bindings || []);
|
|
355
362
|
let results;
|
|
356
363
|
if (bindings.length > 0) {
|
|
357
364
|
const stmt = connection.prepare(sql);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@petradb/knex",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Knex.js dialect for PetraDB",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"clean": "rm -rf dist"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@petradb/engine": ">=1.
|
|
23
|
+
"@petradb/engine": ">=1.3.4",
|
|
24
24
|
"knex": ">=2.0.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|