dbgate-filterparser 6.4.1 → 6.4.2
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/lib/filterTool.d.ts +1 -1
- package/lib/filterTool.js +2 -0
- package/lib/parseFilter.js +7 -5
- package/package.json +3 -3
package/lib/filterTool.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Condition } from 'dbgate-sqltree';
|
|
2
2
|
export type FilterMultipleValuesMode = 'is' | 'is_not' | 'contains' | 'begins' | 'ends';
|
|
3
|
-
export declare function getFilterValueExpression(value: any, dataType?: any):
|
|
3
|
+
export declare function getFilterValueExpression(value: any, dataType?: any): any;
|
|
4
4
|
export declare function createMultiLineFilter(mode: FilterMultipleValuesMode, text: string): string;
|
|
5
5
|
export declare function compileCompoudEvalCondition(filters: {
|
|
6
6
|
[column: string]: string;
|
package/lib/filterTool.js
CHANGED
|
@@ -26,6 +26,8 @@ function getFilterValueExpression(value, dataType) {
|
|
|
26
26
|
return 'FALSE';
|
|
27
27
|
if (value.$oid)
|
|
28
28
|
return `ObjectId("${value.$oid}")`;
|
|
29
|
+
if (value.$bigint)
|
|
30
|
+
return value.$bigint;
|
|
29
31
|
if (value.type == 'Buffer' && Array.isArray(value.data)) {
|
|
30
32
|
return '0x' + (0, dbgate_tools_1.arrayToHexString)(value.data);
|
|
31
33
|
}
|
package/lib/parseFilter.js
CHANGED
|
@@ -9,8 +9,10 @@ const moment_1 = __importDefault(require("moment"));
|
|
|
9
9
|
const common_1 = require("./common");
|
|
10
10
|
const dbgate_tools_1 = require("dbgate-tools");
|
|
11
11
|
const binaryCondition = (operator, numberDualTesting = false) => value => {
|
|
12
|
-
const numValue =
|
|
13
|
-
if (numberDualTesting &&
|
|
12
|
+
const numValue = (0, dbgate_tools_1.parseNumberSafe)(value);
|
|
13
|
+
if (numberDualTesting &&
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
!isNaN(numValue)) {
|
|
14
16
|
return {
|
|
15
17
|
conditionType: 'or',
|
|
16
18
|
conditions: [
|
|
@@ -301,13 +303,13 @@ const createParser = (filterBehaviour) => {
|
|
|
301
303
|
.map(common_1.interpretEscapes)
|
|
302
304
|
.desc('string quoted'),
|
|
303
305
|
string1Num: () => (0, common_1.token)(parsimmon_1.default.regexp(/"-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?"/, 1))
|
|
304
|
-
.map(
|
|
306
|
+
.map(dbgate_tools_1.parseNumberSafe)
|
|
305
307
|
.desc('numer quoted'),
|
|
306
308
|
string2Num: () => (0, common_1.token)(parsimmon_1.default.regexp(/'-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?'/, 1))
|
|
307
|
-
.map(
|
|
309
|
+
.map(dbgate_tools_1.parseNumberSafe)
|
|
308
310
|
.desc('numer quoted'),
|
|
309
311
|
number: () => (0, common_1.token)(parsimmon_1.default.regexp(/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/))
|
|
310
|
-
.map(
|
|
312
|
+
.map(dbgate_tools_1.parseNumberSafe)
|
|
311
313
|
.desc('number'),
|
|
312
314
|
objectid: () => (0, common_1.token)(parsimmon_1.default.regexp(/ObjectId\(['"]?[0-9a-f]{24}['"]?\)/)).desc('ObjectId'),
|
|
313
315
|
objectidstr: () => (0, common_1.token)(parsimmon_1.default.regexp(/[0-9a-f]{24}/)).desc('ObjectId string'),
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "6.4.
|
|
2
|
+
"version": "6.4.2",
|
|
3
3
|
"name": "dbgate-filterparser",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"typings": "lib/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lib"
|
|
14
14
|
],
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"dbgate-types": "^6.4.
|
|
16
|
+
"dbgate-types": "^6.4.2",
|
|
17
17
|
"@types/jest": "^25.1.4",
|
|
18
18
|
"@types/node": "^13.7.0",
|
|
19
19
|
"jest": "^28.1.3",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@types/parsimmon": "^1.10.1",
|
|
25
|
-
"dbgate-tools": "^6.4.
|
|
25
|
+
"dbgate-tools": "^6.4.2",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
27
|
"date-fns": "^4.1.0",
|
|
28
28
|
"moment": "^2.24.0",
|