@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.
- package/dist/alarm-automation.js +12 -6
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/alarm-automation.js
CHANGED
|
@@ -88,20 +88,26 @@ exports.parseAlarmAutomationCode = parseAlarmAutomationCode;
|
|
|
88
88
|
// ]
|
|
89
89
|
// }
|
|
90
90
|
// }
|
|
91
|
-
const
|
|
91
|
+
const encodeValue = (value) => {
|
|
92
92
|
if (typeof value === 'string') {
|
|
93
|
-
return
|
|
93
|
+
return `${JSON.stringify(value)}`;
|
|
94
94
|
}
|
|
95
95
|
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
96
|
-
return
|
|
96
|
+
return `${String(value)}`;
|
|
97
97
|
}
|
|
98
98
|
if (Array.isArray(value)) {
|
|
99
|
-
return `
|
|
99
|
+
return `(${value.map(encodeValue).join(', ')})`;
|
|
100
100
|
}
|
|
101
101
|
if (value === null) {
|
|
102
|
-
return '
|
|
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
|
-
|
|
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