@autofleet/sadot 0.6.9-beta.0 → 0.6.9-beta.1

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.
@@ -42,6 +42,7 @@ const customFieldsFilterScope = (name) => (conditions) => {
42
42
  const replacemetKey = (0, helpers_1.generateRandomString)();
43
43
  replacements[replacemetKey] = `${key}`;
44
44
  if (Array.isArray(condition)) {
45
+ console.log('[sadot] Array.isArray(condition)', { condition });
45
46
  if (condition.length === 0) {
46
47
  // if empty array, the condition is ignored
47
48
  return false;
@@ -59,7 +60,6 @@ const customFieldsFilterScope = (name) => (conditions) => {
59
60
  .map((c) => {
60
61
  const valRep = (0, helpers_1.generateRandomString)();
61
62
  if (c.operator.toUpperCase() === 'IN' && Array.isArray(c.value)) {
62
- // Properly format the array values without adding extra quotes
63
63
  const formattedValues = c.value.map((val) => `'${val}'`).join(', ');
64
64
  replacements[valRep] = formattedValues;
65
65
  return `(custom_fields->> :${replacemetKey} )${castIfNeeded(c.value)} ${c.operator} (${formattedValues})`;
@@ -69,7 +69,7 @@ const customFieldsFilterScope = (name) => (conditions) => {
69
69
  })
70
70
  .join(AND_DELIMETER);
71
71
  }
72
- if (typeof condition === 'string') {
72
+ if (typeof condition === 'string' || typeof condition === 'number') {
73
73
  const conditionRep = (0, helpers_1.generateRandomString)();
74
74
  replacements[conditionRep] = `${condition}`;
75
75
  return `(custom_fields->> :${replacemetKey} ) ${castIfNeeded(condition)} = :${conditionRep}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/sadot",
3
- "version": "0.6.9-beta.0",
3
+ "version": "0.6.9-beta.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -63,6 +63,8 @@ export const customFieldsFilterScope = (
63
63
  const replacemetKey = generateRandomString();
64
64
  replacements[replacemetKey] = `${key}`;
65
65
  if (Array.isArray(condition)) {
66
+ console.log('[sadot] Array.isArray(condition)', { condition });
67
+
66
68
  if (condition.length === 0) {
67
69
  // if empty array, the condition is ignored
68
70
  return false;
@@ -82,7 +84,6 @@ export const customFieldsFilterScope = (
82
84
  const valRep = generateRandomString();
83
85
 
84
86
  if (c.operator.toUpperCase() === 'IN' && Array.isArray(c.value)) {
85
- // Properly format the array values without adding extra quotes
86
87
  const formattedValues = c.value.map((val) => `'${val}'`).join(', ');
87
88
  replacements[valRep] = formattedValues;
88
89
  return `(custom_fields->> :${replacemetKey} )${castIfNeeded(c.value)} ${c.operator} (${formattedValues})`;
@@ -92,7 +93,7 @@ export const customFieldsFilterScope = (
92
93
  })
93
94
  .join(AND_DELIMETER);
94
95
  }
95
- if (typeof condition === 'string') {
96
+ if (typeof condition === 'string' || typeof condition === 'number') {
96
97
  const conditionRep = generateRandomString();
97
98
  replacements[conditionRep] = `${condition}`;
98
99
  return `(custom_fields->> :${replacemetKey} ) ${castIfNeeded(condition)} = :${conditionRep}`;