sqlparser-devexpress 2.5.3 → 2.5.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sqlparser-devexpress",
3
- "version": "2.5.3",
3
+ "version": "2.5.4",
4
4
  "main": "src/index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -308,6 +308,13 @@ function DevExpressConverter() {
308
308
  resolvedValue = resolvedValue.split(',').map(v => v.trim());
309
309
  }
310
310
 
311
+ // Short-circuit: Field being compared to itself (e.g., ID IN (ID))
312
+ if (EnableShortCircuit && typeof ast.field === 'string') {
313
+ if (typeof resolvedValue === 'string' && ast.field === resolvedValue) {
314
+ return operator === "IN" ? true : false;
315
+ }
316
+ }
317
+
311
318
  // handle short circuit evaluation for IN operator
312
319
  if (EnableShortCircuit && (LITERAL_TYPES.includes(ast.field?.type) && LITERAL_TYPES.includes(ast.value?.type))) {
313
320
  const fieldVal = convertValue(ast.field);
@@ -407,6 +407,10 @@ describe("Parser SQL to dx Filter Builder", () => {
407
407
  expected: [
408
408
  "AccountID", "=", 42
409
409
  ]
410
+ },
411
+ {
412
+ input: "ID IN ({SampleDoc.AuthFilterID})",
413
+ expected: []
410
414
  }
411
415
  ];
412
416
 
@@ -477,5 +481,6 @@ const sampleData = {
477
481
  "SaleOrderStatusStmtGlobalRpt.RegionID": null,
478
482
  "WorkOrderLine.CompanyIDs": ["0,1"],
479
483
  "PurchaseOrderDocument.IsMultiBrand": false,
480
- "PurchaseOrderDocument.AllowedApplicableMake": "0"
484
+ "PurchaseOrderDocument.AllowedApplicableMake": "0",
485
+ "SampleDoc.AuthFilterID": "ID"
481
486
  };