mage-remote-run 1.1.0 → 1.2.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/lib/utils.js +16 -8
- package/package.json +1 -1
package/lib/utils.js
CHANGED
|
@@ -111,7 +111,7 @@ export function buildSearchCriteria(options) {
|
|
|
111
111
|
let orIndex = 0;
|
|
112
112
|
|
|
113
113
|
for (const f of orFilters) {
|
|
114
|
-
let match = f.match(/^([
|
|
114
|
+
let match = f.match(/^([\w\.]+)(?::([a-z!]+))?(?:(<=|>=|<|>|=|!=|!~|~|\?|!|@@)(.*))?$/);
|
|
115
115
|
if (match) {
|
|
116
116
|
const field = match[1];
|
|
117
117
|
const opString = match[2];
|
|
@@ -121,19 +121,27 @@ export function buildSearchCriteria(options) {
|
|
|
121
121
|
let condition = 'eq';
|
|
122
122
|
|
|
123
123
|
if (opString) {
|
|
124
|
-
condition = opString;
|
|
124
|
+
condition = opString === '!in' ? 'nin' : opString;
|
|
125
125
|
} else if (shorthand) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
switch (shorthand) {
|
|
127
|
+
case '>': condition = 'gt'; break;
|
|
128
|
+
case '<': condition = 'lt'; break;
|
|
129
|
+
case '>=': condition = 'gteq'; break;
|
|
130
|
+
case '<=': condition = 'lteq'; break;
|
|
131
|
+
case '!=': condition = 'neq'; break;
|
|
132
|
+
case '~': condition = 'like'; break;
|
|
133
|
+
case '!~': condition = 'nlike'; break;
|
|
134
|
+
case '@@': condition = 'finset'; break;
|
|
135
|
+
case '?': condition = 'null'; value = '1'; break;
|
|
136
|
+
case '!': condition = 'notnull'; value = '1'; break;
|
|
137
|
+
default: condition = 'eq';
|
|
138
|
+
}
|
|
131
139
|
} else {
|
|
132
140
|
console.error(chalk.yellow(`Warning: Invalid filter format "${f}". Expected formats like "field=value", "field:like=value", etc.`));
|
|
133
141
|
continue;
|
|
134
142
|
}
|
|
135
143
|
|
|
136
|
-
if (condition === 'like' && value.includes('*')) {
|
|
144
|
+
if ((condition === 'like' || condition === 'nlike') && value.includes('*')) {
|
|
137
145
|
value = value.replaceAll('*', '%');
|
|
138
146
|
}
|
|
139
147
|
|