@awarevue/api-types 1.0.74 → 1.0.75

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.
@@ -88,20 +88,26 @@ exports.parseAlarmAutomationCode = parseAlarmAutomationCode;
88
88
  // ]
89
89
  // }
90
90
  // }
91
- const encodeComparison = (value) => {
91
+ const encodeValue = (value) => {
92
92
  if (typeof value === 'string') {
93
- return `== ${JSON.stringify(value)}`;
93
+ return `${JSON.stringify(value)}`;
94
94
  }
95
95
  if (typeof value === 'number' || typeof value === 'boolean') {
96
- return `== ${String(value)}`;
96
+ return `${String(value)}`;
97
97
  }
98
98
  if (Array.isArray(value)) {
99
- return `in (${value.map(encodeComparison).join(', ')})`;
99
+ return `(${value.map(encodeValue).join(', ')})`;
100
100
  }
101
101
  if (value === null) {
102
- return '== null';
102
+ return 'null';
103
+ }
104
+ throw new Error(`Unsupported value type for: ${typeof value}`);
105
+ };
106
+ const encodeComparison = (value) => {
107
+ if (Array.isArray(value)) {
108
+ return `in ${encodeValue(value)}`;
103
109
  }
104
- throw new Error(`Unsupported value type for comparison: ${typeof value}`);
110
+ return `== ${encodeValue(value)}`;
105
111
  };
106
112
  const createAlarmRuleBody = (eventKind, behavior, deviceType, eventCriteria, deviceId) => {
107
113
  let runIf = 'source.type == "' + deviceType + '"';
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awarevue/api-types",
3
- "version": "1.0.74",
3
+ "version": "1.0.75",
4
4
  "description": "Common types between backend, agent(s) and frontend(s)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awarevue/api-types",
3
- "version": "1.0.74",
3
+ "version": "1.0.75",
4
4
  "description": "Common types between backend, agent(s) and frontend(s)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",