@based/db-query
Advanced tools
Comparing version 2.0.1 to 3.1.0
@@ -14,2 +14,4 @@ import { convertNowFilter } from './convertNow.js'; | ||
'!=': 'c L', | ||
like: '"toupper" s', | ||
notLike: '"toupper" s L', | ||
exists: 'h', | ||
@@ -77,3 +79,3 @@ notExists: 'h', | ||
isFork: true, | ||
[f.$operator == '!=' ? '$and' : '$or']: [ | ||
[['!=', 'notLike'].includes(f.$operator) ? '$and' : '$or']: [ | ||
{ | ||
@@ -114,3 +116,3 @@ $operator: f.$operator, | ||
} | ||
if (vType == 'string' && f.$operator == 'has') { | ||
if (f.$operator === 'has') { | ||
out += ` $${valueId} $${fieldId} ${op}`; | ||
@@ -117,0 +119,0 @@ } |
@@ -29,2 +29,4 @@ import isFork from './isFork.js'; | ||
'!=', | ||
'like', | ||
'notLike', | ||
'has', | ||
@@ -45,2 +47,13 @@ 'includes', | ||
}; | ||
if (filterOpt.$caseInsensitive) { | ||
if (o === '=') { | ||
filter.$operator = 'like'; | ||
} | ||
else if (o === '!=') { | ||
filter.$operator = 'notLike'; | ||
} | ||
else { | ||
return [{ isFork: true }, `$caseInsensitive is only valid with '=' and '!='`]; | ||
} | ||
} | ||
if (o !== 'notExists' && o !== 'exists') { | ||
@@ -47,0 +60,0 @@ filter.$value = isGeoFilterValue(filterOpt) |
@@ -10,2 +10,3 @@ export type Value = (string | number) | (string | number)[]; | ||
}; | ||
$caseInsensitive?: undefined; | ||
$and?: Filter; | ||
@@ -18,2 +19,3 @@ $or?: Filter; | ||
$value?: undefined; | ||
$caseInsensitive?: undefined; | ||
$and?: Filter; | ||
@@ -26,2 +28,3 @@ $or?: Filter; | ||
$value: string | number | (string | number)[]; | ||
$caseInsensitive?: boolean; | ||
$and?: Filter; | ||
@@ -32,3 +35,3 @@ $or?: Filter; | ||
$field: string; | ||
$operator: '=' | '>' | '<' | '..' | '!=' | 'has' | 'includes' | 'distance' | 'exists' | 'notExists' | 'textSearch'; | ||
$operator: '=' | '!=' | '>' | '<' | '..' | 'like' | 'notLike' | 'has' | 'includes' | 'distance' | 'exists' | 'notExists' | 'textSearch'; | ||
$value?: Value; | ||
@@ -35,0 +38,0 @@ hasNow?: true; |
{ | ||
"name": "@based/db-query", | ||
"version": "2.0.1", | ||
"version": "3.1.0", | ||
"license": "MIT", | ||
@@ -32,3 +32,3 @@ "main": "dist/src/index.js", | ||
"@types/node": "^17.0.23", | ||
"ava": "5.3.1", | ||
"ava": "6.1.1", | ||
"ts-node": "10.9.1", | ||
@@ -35,0 +35,0 @@ "typescript": "^5.1.6", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34017
1064