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.
Files changed (2) hide show
  1. package/lib/utils.js +16 -8
  2. 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(/^([^=<>:]+)(?::([a-z]+))?(?:(<=|>=|<|>|=)(.*))?$/);
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
- if (shorthand === '>') condition = 'gt';
127
- else if (shorthand === '<') condition = 'lt';
128
- else if (shorthand === '>=') condition = 'gteq';
129
- else if (shorthand === '<=') condition = 'lteq';
130
- else condition = 'eq';
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mage-remote-run",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "The remote swiss army knife for Magento Open Source, Mage-OS, Adobe Commerce",
5
5
  "main": "index.js",
6
6
  "scripts": {