@zwave-js/config 14.0.0-beta.1 → 14.0.0-beta.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.
Files changed (214) hide show
  1. package/build/{ConfigManager.d.ts → cjs/ConfigManager.d.ts} +2 -2
  2. package/build/cjs/ConfigManager.js +208 -0
  3. package/build/cjs/ConfigManager.js.map +7 -0
  4. package/build/cjs/JsonTemplate.js +198 -0
  5. package/build/cjs/JsonTemplate.js.map +7 -0
  6. package/build/{Logger.d.ts → cjs/Logger.d.ts} +1 -1
  7. package/build/cjs/Logger.js +50 -0
  8. package/build/cjs/Logger.js.map +7 -0
  9. package/build/cjs/Logger_safe.js +32 -0
  10. package/build/cjs/Logger_safe.js.map +7 -0
  11. package/build/cjs/Logic.js +71 -0
  12. package/build/cjs/Logic.js.map +7 -0
  13. package/build/cjs/LogicParser.js +1343 -0
  14. package/build/cjs/LogicParser.js.map +7 -0
  15. package/build/cjs/Manufacturers.js +88 -0
  16. package/build/cjs/Manufacturers.js.map +7 -0
  17. package/build/cjs/_version.d.ts +2 -0
  18. package/build/cjs/_version.js +29 -0
  19. package/build/cjs/_version.js.map +7 -0
  20. package/build/{devices → cjs/devices}/AssociationConfig.d.ts +2 -2
  21. package/build/cjs/devices/AssociationConfig.js +93 -0
  22. package/build/cjs/devices/AssociationConfig.js.map +7 -0
  23. package/build/{devices → cjs/devices}/CompatConfig.d.ts +2 -2
  24. package/build/cjs/devices/CompatConfig.js +584 -0
  25. package/build/cjs/devices/CompatConfig.js.map +7 -0
  26. package/build/{devices → cjs/devices}/ConditionalItem.d.ts +1 -1
  27. package/build/cjs/devices/ConditionalItem.js +107 -0
  28. package/build/cjs/devices/ConditionalItem.js.map +7 -0
  29. package/build/{devices → cjs/devices}/ConditionalPrimitive.d.ts +2 -2
  30. package/build/cjs/devices/ConditionalPrimitive.js +59 -0
  31. package/build/cjs/devices/ConditionalPrimitive.js.map +7 -0
  32. package/build/{devices → cjs/devices}/DeviceConfig.d.ts +7 -7
  33. package/build/cjs/devices/DeviceConfig.js +502 -0
  34. package/build/cjs/devices/DeviceConfig.js.map +7 -0
  35. package/build/cjs/devices/DeviceConfig.unit._test.js +17 -0
  36. package/build/cjs/devices/DeviceConfig.unit._test.js.map +7 -0
  37. package/build/{devices → cjs/devices}/DeviceMetadata.d.ts +3 -3
  38. package/build/cjs/devices/DeviceMetadata.js +112 -0
  39. package/build/cjs/devices/DeviceMetadata.js.map +7 -0
  40. package/build/{devices → cjs/devices}/EndpointConfig.d.ts +5 -5
  41. package/build/cjs/devices/EndpointConfig.js +87 -0
  42. package/build/cjs/devices/EndpointConfig.js.map +7 -0
  43. package/build/{devices → cjs/devices}/ParamInformation.d.ts +3 -3
  44. package/build/cjs/devices/ParamInformation.js +209 -0
  45. package/build/cjs/devices/ParamInformation.js.map +7 -0
  46. package/build/cjs/devices/shared.js +17 -0
  47. package/build/cjs/devices/shared.js.map +7 -0
  48. package/build/cjs/index.d.ts +13 -0
  49. package/build/cjs/index.js +53 -0
  50. package/build/cjs/index.js.map +7 -0
  51. package/build/cjs/index_safe.d.ts +3 -0
  52. package/build/cjs/index_safe.js +32 -0
  53. package/build/cjs/index_safe.js.map +7 -0
  54. package/build/cjs/package.json +3 -0
  55. package/build/{utils.d.ts → cjs/utils.d.ts} +2 -2
  56. package/build/cjs/utils.js +117 -0
  57. package/build/cjs/utils.js.map +7 -0
  58. package/build/cjs/utils_safe.js +57 -0
  59. package/build/cjs/utils_safe.js.map +7 -0
  60. package/build/esm/ConfigManager.d.ts +57 -0
  61. package/build/esm/ConfigManager.d.ts.map +1 -0
  62. package/build/{ConfigManager.js → esm/ConfigManager.js} +36 -43
  63. package/build/esm/ConfigManager.js.map +1 -0
  64. package/build/esm/JsonTemplate.d.ts +4 -0
  65. package/build/esm/JsonTemplate.d.ts.map +1 -0
  66. package/build/{JsonTemplate.js → esm/JsonTemplate.js} +30 -60
  67. package/build/esm/JsonTemplate.js.map +1 -0
  68. package/build/esm/Logger.d.ts +11 -0
  69. package/build/esm/Logger.d.ts.map +1 -0
  70. package/build/esm/Logger.js +23 -0
  71. package/build/esm/Logger.js.map +1 -0
  72. package/build/esm/Logger_safe.d.ts +5 -0
  73. package/build/esm/Logger_safe.d.ts.map +1 -0
  74. package/build/esm/Logger_safe.js +3 -0
  75. package/build/esm/Logger_safe.js.map +1 -0
  76. package/build/esm/Logic.d.ts +4 -0
  77. package/build/esm/Logic.d.ts.map +1 -0
  78. package/build/esm/Logic.js +35 -0
  79. package/build/esm/Logic.js.map +1 -0
  80. package/build/esm/LogicParser.d.ts +93 -0
  81. package/build/esm/LogicParser.d.ts.map +1 -0
  82. package/build/{LogicParser.js → esm/LogicParser.js} +2 -5
  83. package/build/{LogicParser.js.map → esm/LogicParser.js.map} +1 -1
  84. package/build/esm/Manufacturers.d.ts +6 -0
  85. package/build/esm/Manufacturers.d.ts.map +1 -0
  86. package/build/esm/Manufacturers.js +55 -0
  87. package/build/esm/Manufacturers.js.map +1 -0
  88. package/build/esm/_version.d.ts +2 -0
  89. package/build/esm/_version.d.ts.map +1 -0
  90. package/build/esm/_version.js +3 -0
  91. package/build/esm/_version.js.map +1 -0
  92. package/build/esm/devices/AssociationConfig.d.ts +27 -0
  93. package/build/esm/devices/AssociationConfig.d.ts.map +1 -0
  94. package/build/{devices → esm/devices}/AssociationConfig.js +12 -16
  95. package/build/esm/devices/AssociationConfig.js.map +1 -0
  96. package/build/esm/devices/CompatConfig.d.ts +112 -0
  97. package/build/esm/devices/CompatConfig.d.ts.map +1 -0
  98. package/build/{devices → esm/devices}/CompatConfig.js +112 -119
  99. package/build/esm/devices/CompatConfig.js.map +1 -0
  100. package/build/esm/devices/ConditionalItem.d.ts +14 -0
  101. package/build/esm/devices/ConditionalItem.d.ts.map +1 -0
  102. package/build/{devices → esm/devices}/ConditionalItem.js +15 -21
  103. package/build/esm/devices/ConditionalItem.js.map +1 -0
  104. package/build/esm/devices/ConditionalPrimitive.d.ts +13 -0
  105. package/build/esm/devices/ConditionalPrimitive.d.ts.map +1 -0
  106. package/build/esm/devices/ConditionalPrimitive.js +35 -0
  107. package/build/esm/devices/ConditionalPrimitive.js.map +1 -0
  108. package/build/esm/devices/DeviceConfig.d.ts +117 -0
  109. package/build/esm/devices/DeviceConfig.d.ts.map +1 -0
  110. package/build/{devices → esm/devices}/DeviceConfig.js +96 -108
  111. package/build/esm/devices/DeviceConfig.js.map +1 -0
  112. package/build/esm/devices/DeviceConfig.unit._test.d.ts +2 -0
  113. package/build/esm/devices/DeviceConfig.unit._test.d.ts.map +1 -0
  114. package/build/{devices → esm/devices}/DeviceConfig.unit._test.js +1 -2
  115. package/build/esm/devices/DeviceConfig.unit._test.js.map +1 -0
  116. package/build/esm/devices/DeviceMetadata.d.ts +41 -0
  117. package/build/esm/devices/DeviceMetadata.d.ts.map +1 -0
  118. package/build/{devices → esm/devices}/DeviceMetadata.js +16 -21
  119. package/build/esm/devices/DeviceMetadata.js.map +1 -0
  120. package/build/esm/devices/EndpointConfig.d.ts +20 -0
  121. package/build/esm/devices/EndpointConfig.d.ts.map +1 -0
  122. package/build/esm/devices/EndpointConfig.js +60 -0
  123. package/build/esm/devices/EndpointConfig.js.map +1 -0
  124. package/build/esm/devices/ParamInformation.d.ts +50 -0
  125. package/build/esm/devices/ParamInformation.d.ts.map +1 -0
  126. package/build/{devices → esm/devices}/ParamInformation.js +38 -44
  127. package/build/esm/devices/ParamInformation.js.map +1 -0
  128. package/build/esm/devices/shared.d.ts +11 -0
  129. package/build/esm/devices/shared.d.ts.map +1 -0
  130. package/build/esm/devices/shared.js +2 -0
  131. package/build/{devices → esm/devices}/shared.js.map +1 -1
  132. package/build/esm/index.d.ts +13 -0
  133. package/build/esm/index.d.ts.map +1 -0
  134. package/build/esm/index.js +14 -0
  135. package/build/esm/index.js.map +1 -0
  136. package/build/esm/index_safe.d.ts +3 -0
  137. package/build/esm/index_safe.d.ts.map +1 -0
  138. package/build/esm/index_safe.js +4 -0
  139. package/build/esm/index_safe.js.map +1 -0
  140. package/build/esm/package.json +3 -0
  141. package/build/esm/utils.d.ts +19 -0
  142. package/build/esm/utils.d.ts.map +1 -0
  143. package/build/esm/utils.js +93 -0
  144. package/build/esm/utils.js.map +1 -0
  145. package/build/esm/utils_safe.d.ts +7 -0
  146. package/build/esm/utils_safe.d.ts.map +1 -0
  147. package/build/esm/utils_safe.js +28 -0
  148. package/build/esm/utils_safe.js.map +1 -0
  149. package/package.json +22 -19
  150. package/build/ConfigManager.d.ts.map +0 -1
  151. package/build/ConfigManager.js.map +0 -1
  152. package/build/JsonTemplate.d.ts.map +0 -1
  153. package/build/JsonTemplate.js.map +0 -1
  154. package/build/Logger.d.ts.map +0 -1
  155. package/build/Logger.js +0 -27
  156. package/build/Logger.js.map +0 -1
  157. package/build/Logger_safe.d.ts.map +0 -1
  158. package/build/Logger_safe.js +0 -6
  159. package/build/Logger_safe.js.map +0 -1
  160. package/build/Logic.d.ts.map +0 -1
  161. package/build/Logic.js +0 -60
  162. package/build/Logic.js.map +0 -1
  163. package/build/LogicParser.d.ts.map +0 -1
  164. package/build/Manufacturers.d.ts.map +0 -1
  165. package/build/Manufacturers.js +0 -62
  166. package/build/Manufacturers.js.map +0 -1
  167. package/build/_version.d.ts +0 -2
  168. package/build/_version.d.ts.map +0 -1
  169. package/build/_version.js +0 -6
  170. package/build/_version.js.map +0 -1
  171. package/build/devices/AssociationConfig.d.ts.map +0 -1
  172. package/build/devices/AssociationConfig.js.map +0 -1
  173. package/build/devices/CompatConfig.d.ts.map +0 -1
  174. package/build/devices/CompatConfig.js.map +0 -1
  175. package/build/devices/ConditionalItem.d.ts.map +0 -1
  176. package/build/devices/ConditionalItem.js.map +0 -1
  177. package/build/devices/ConditionalPrimitive.d.ts.map +0 -1
  178. package/build/devices/ConditionalPrimitive.js +0 -40
  179. package/build/devices/ConditionalPrimitive.js.map +0 -1
  180. package/build/devices/DeviceConfig.d.ts.map +0 -1
  181. package/build/devices/DeviceConfig.js.map +0 -1
  182. package/build/devices/DeviceConfig.unit._test.d.ts.map +0 -1
  183. package/build/devices/DeviceConfig.unit._test.js.map +0 -1
  184. package/build/devices/DeviceMetadata.d.ts.map +0 -1
  185. package/build/devices/DeviceMetadata.js.map +0 -1
  186. package/build/devices/EndpointConfig.d.ts.map +0 -1
  187. package/build/devices/EndpointConfig.js +0 -64
  188. package/build/devices/EndpointConfig.js.map +0 -1
  189. package/build/devices/ParamInformation.d.ts.map +0 -1
  190. package/build/devices/ParamInformation.js.map +0 -1
  191. package/build/devices/shared.d.ts.map +0 -1
  192. package/build/devices/shared.js +0 -3
  193. package/build/index.d.ts +0 -13
  194. package/build/index.d.ts.map +0 -1
  195. package/build/index.js +0 -33
  196. package/build/index.js.map +0 -1
  197. package/build/index_safe.d.ts +0 -3
  198. package/build/index_safe.d.ts.map +0 -1
  199. package/build/index_safe.js +0 -22
  200. package/build/index_safe.js.map +0 -1
  201. package/build/utils.d.ts.map +0 -1
  202. package/build/utils.js +0 -124
  203. package/build/utils.js.map +0 -1
  204. package/build/utils_safe.d.ts.map +0 -1
  205. package/build/utils_safe.js +0 -33
  206. package/build/utils_safe.js.map +0 -1
  207. /package/build/{JsonTemplate.d.ts → cjs/JsonTemplate.d.ts} +0 -0
  208. /package/build/{Logger_safe.d.ts → cjs/Logger_safe.d.ts} +0 -0
  209. /package/build/{Logic.d.ts → cjs/Logic.d.ts} +0 -0
  210. /package/build/{LogicParser.d.ts → cjs/LogicParser.d.ts} +0 -0
  211. /package/build/{Manufacturers.d.ts → cjs/Manufacturers.d.ts} +0 -0
  212. /package/build/{devices → cjs/devices}/DeviceConfig.unit._test.d.ts +0 -0
  213. /package/build/{devices → cjs/devices}/shared.d.ts +0 -0
  214. /package/build/{utils_safe.d.ts → cjs/utils_safe.d.ts} +0 -0
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var DeviceMetadata_exports = {};
20
+ __export(DeviceMetadata_exports, {
21
+ ConditionalDeviceComment: () => ConditionalDeviceComment,
22
+ ConditionalDeviceMetadata: () => ConditionalDeviceMetadata
23
+ });
24
+ module.exports = __toCommonJS(DeviceMetadata_exports);
25
+ var import_safe = require("@zwave-js/shared/safe");
26
+ var import_typeguards = require("alcalzone-shared/typeguards/index.js");
27
+ var import_utils_safe = require("../utils_safe.js");
28
+ var import_ConditionalItem = require("./ConditionalItem.js");
29
+ var import_ConditionalPrimitive = require("./ConditionalPrimitive.js");
30
+ class ConditionalDeviceMetadata {
31
+ constructor(filename, definition) {
32
+ for (const prop of [
33
+ "wakeup",
34
+ "inclusion",
35
+ "exclusion",
36
+ "reset",
37
+ "manual"
38
+ ]) {
39
+ if (prop in definition) {
40
+ this[prop] = (0, import_ConditionalPrimitive.parseConditionalPrimitive)(filename, "string", prop, definition[prop], "The metadata entry ");
41
+ }
42
+ }
43
+ if ("comments" in definition) {
44
+ const value = definition.comments;
45
+ const isComment = (opt) => (0, import_typeguards.isObject)(opt) && typeof opt.level === "string" && typeof opt.text === "string";
46
+ if (isComment(value)) {
47
+ this.comments = new ConditionalDeviceComment(value.level, value.text, value.$if);
48
+ } else if ((0, import_typeguards.isArray)(value) && value.every(isComment)) {
49
+ this.comments = value.map((c) => new ConditionalDeviceComment(c.level, c.text, c.$if));
50
+ } else {
51
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${filename}:
52
+ The metadata entry comments is invalid!`);
53
+ }
54
+ }
55
+ }
56
+ condition;
57
+ evaluateCondition(deviceId) {
58
+ if (!(0, import_ConditionalItem.conditionApplies)(this, deviceId))
59
+ return;
60
+ const ret = {};
61
+ for (const prop of [
62
+ "wakeup",
63
+ "inclusion",
64
+ "exclusion",
65
+ "reset",
66
+ "manual"
67
+ ]) {
68
+ if (this[prop]) {
69
+ const evaluated = (0, import_ConditionalItem.evaluateDeep)(this[prop], deviceId);
70
+ if (evaluated)
71
+ ret[prop] = evaluated;
72
+ }
73
+ }
74
+ const comments = (0, import_ConditionalItem.evaluateDeep)(this.comments, deviceId, true);
75
+ if (comments)
76
+ ret.comments = comments;
77
+ return ret;
78
+ }
79
+ /** How to wake up the device manually */
80
+ wakeup;
81
+ /** Inclusion instructions */
82
+ inclusion;
83
+ /** Exclusion instructions */
84
+ exclusion;
85
+ /** Instructions for resetting the device to factory defaults */
86
+ reset;
87
+ /** A link to the device manual */
88
+ manual;
89
+ /** Comments for this device */
90
+ comments;
91
+ }
92
+ class ConditionalDeviceComment {
93
+ level;
94
+ text;
95
+ condition;
96
+ constructor(level, text, condition) {
97
+ this.level = level;
98
+ this.text = text;
99
+ this.condition = condition;
100
+ }
101
+ evaluateCondition(deviceId) {
102
+ if (!(0, import_ConditionalItem.conditionApplies)(this, deviceId))
103
+ return;
104
+ return (0, import_safe.pick)(this, ["level", "text"]);
105
+ }
106
+ }
107
+ // Annotate the CommonJS export names for ESM import in node:
108
+ 0 && (module.exports = {
109
+ ConditionalDeviceComment,
110
+ ConditionalDeviceMetadata
111
+ });
112
+ //# sourceMappingURL=DeviceMetadata.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/devices/DeviceMetadata.ts"],
4
+ "sourcesContent": ["import { type JSONObject, pick } from \"@zwave-js/shared/safe\";\nimport { isArray, isObject } from \"alcalzone-shared/typeguards/index.js\";\nimport { throwInvalidConfig } from \"../utils_safe.js\";\nimport {\n\ttype ConditionalItem,\n\tconditionApplies,\n\tevaluateDeep,\n} from \"./ConditionalItem.js\";\nimport {\n\ttype ConditionalPrimitive,\n\tparseConditionalPrimitive,\n} from \"./ConditionalPrimitive.js\";\nimport type { DeviceID } from \"./shared.js\";\n\nexport class ConditionalDeviceMetadata\n\timplements ConditionalItem<DeviceMetadata>\n{\n\tpublic constructor(filename: string, definition: JSONObject) {\n\t\tfor (\n\t\t\tconst prop of [\n\t\t\t\t\"wakeup\",\n\t\t\t\t\"inclusion\",\n\t\t\t\t\"exclusion\",\n\t\t\t\t\"reset\",\n\t\t\t\t\"manual\",\n\t\t\t] as const\n\t\t) {\n\t\t\tif (prop in definition) {\n\t\t\t\tthis[prop] = parseConditionalPrimitive(\n\t\t\t\t\tfilename,\n\t\t\t\t\t\"string\",\n\t\t\t\t\tprop,\n\t\t\t\t\tdefinition[prop],\n\t\t\t\t\t\"The metadata entry \",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (\"comments\" in definition) {\n\t\t\tconst value = definition.comments;\n\t\t\tconst isComment = (opt: unknown) =>\n\t\t\t\tisObject(opt)\n\t\t\t\t&& typeof opt.level === \"string\"\n\t\t\t\t&& typeof opt.text === \"string\";\n\n\t\t\tif (isComment(value)) {\n\t\t\t\tthis.comments = new ConditionalDeviceComment(\n\t\t\t\t\tvalue.level,\n\t\t\t\t\tvalue.text,\n\t\t\t\t\tvalue.$if,\n\t\t\t\t);\n\t\t\t} else if (isArray(value) && value.every(isComment)) {\n\t\t\t\tthis.comments = value.map(\n\t\t\t\t\t(c: any) =>\n\t\t\t\t\t\tnew ConditionalDeviceComment(c.level, c.text, c.$if),\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthrowInvalidConfig(\n\t\t\t\t\t\"devices\",\n\t\t\t\t\t`packages/config/config/devices/${filename}:\nThe metadata entry comments is invalid!`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic readonly condition?: string;\n\n\tpublic evaluateCondition(deviceId?: DeviceID): DeviceMetadata | undefined {\n\t\tif (!conditionApplies(this, deviceId)) return;\n\t\tconst ret: DeviceMetadata = {};\n\t\tfor (\n\t\t\tconst prop of [\n\t\t\t\t\"wakeup\",\n\t\t\t\t\"inclusion\",\n\t\t\t\t\"exclusion\",\n\t\t\t\t\"reset\",\n\t\t\t\t\"manual\",\n\t\t\t] as const\n\t\t) {\n\t\t\tif (this[prop]) {\n\t\t\t\tconst evaluated = evaluateDeep(this[prop], deviceId);\n\t\t\t\tif (evaluated) ret[prop] = evaluated;\n\t\t\t}\n\t\t}\n\t\tconst comments = evaluateDeep(this.comments, deviceId, true);\n\t\tif (comments) ret.comments = comments;\n\n\t\treturn ret;\n\t}\n\n\t/** How to wake up the device manually */\n\tpublic readonly wakeup?: ConditionalPrimitive<string>;\n\t/** Inclusion instructions */\n\tpublic readonly inclusion?: ConditionalPrimitive<string>;\n\t/** Exclusion instructions */\n\tpublic readonly exclusion?: ConditionalPrimitive<string>;\n\t/** Instructions for resetting the device to factory defaults */\n\tpublic readonly reset?: ConditionalPrimitive<string>;\n\t/** A link to the device manual */\n\tpublic readonly manual?: ConditionalPrimitive<string>;\n\t/** Comments for this device */\n\tpublic readonly comments?:\n\t\t| ConditionalDeviceComment\n\t\t| ConditionalDeviceComment[];\n}\n\nexport interface DeviceMetadata {\n\twakeup?: string;\n\tinclusion?: string;\n\texclusion?: string;\n\treset?: string;\n\tmanual?: string;\n\tcomments?: DeviceComment | DeviceComment[];\n}\n\nexport class ConditionalDeviceComment\n\timplements ConditionalItem<DeviceComment>\n{\n\tpublic constructor(\n\t\tpublic readonly level: DeviceComment[\"level\"],\n\t\tpublic readonly text: string,\n\t\tpublic readonly condition?: string,\n\t) {}\n\n\tpublic evaluateCondition(deviceId?: DeviceID): DeviceComment | undefined {\n\t\tif (!conditionApplies(this, deviceId)) return;\n\t\treturn pick(this, [\"level\",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;EACR;;EAGgB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;AAcX,MAAO,yBAAwB;EAInB;EACA;EACA;EAHjB,YACiB,OACA,MACA,WAAkB;AAFlB,SAAA,QAAA;AACA,SAAA,OAAA;AACA,SAAA,YAAA;EACd;EAEI,kBAAkB,UAAmB;AAC3C,QAAI,KAAC,yCAAiB,MAAM,QAAQ;AAAG;AACvC,eAAO,kBAAK,MAAM,CAAC,SAAS,MAAM,CAAC;EACpC;;",
6
+ "names": []
7
+ }
@@ -1,9 +1,9 @@
1
1
  import type { JSONObject } from "@zwave-js/shared/safe";
2
- import { type AssociationConfig, ConditionalAssociationConfig } from "./AssociationConfig";
3
- import { type ConditionalItem } from "./ConditionalItem";
4
- import type { ConditionalDeviceConfig } from "./DeviceConfig";
5
- import { type ConditionalParamInfoMap, type ParamInfoMap } from "./ParamInformation";
6
- import type { DeviceID } from "./shared";
2
+ import { type AssociationConfig, ConditionalAssociationConfig } from "./AssociationConfig.js";
3
+ import { type ConditionalItem } from "./ConditionalItem.js";
4
+ import type { ConditionalDeviceConfig } from "./DeviceConfig.js";
5
+ import { type ConditionalParamInfoMap, type ParamInfoMap } from "./ParamInformation.js";
6
+ import type { DeviceID } from "./shared.js";
7
7
  export declare class ConditionalEndpointConfig implements ConditionalItem<EndpointConfig> {
8
8
  constructor(parent: ConditionalDeviceConfig, index: number, definition: JSONObject);
9
9
  readonly index: number;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var EndpointConfig_exports = {};
20
+ __export(EndpointConfig_exports, {
21
+ ConditionalEndpointConfig: () => ConditionalEndpointConfig
22
+ });
23
+ module.exports = __toCommonJS(EndpointConfig_exports);
24
+ var import_typeguards = require("alcalzone-shared/typeguards/index.js");
25
+ var import_utils_safe = require("../utils_safe.js");
26
+ var import_AssociationConfig = require("./AssociationConfig.js");
27
+ var import_ConditionalItem = require("./ConditionalItem.js");
28
+ var import_ParamInformation = require("./ParamInformation.js");
29
+ class ConditionalEndpointConfig {
30
+ constructor(parent, index, definition) {
31
+ this.index = index;
32
+ const filename = parent.filename;
33
+ (0, import_ConditionalItem.validateCondition)(filename, definition, `Endpoint ${index} contains an`);
34
+ this.condition = definition.$if;
35
+ if (definition.label != void 0) {
36
+ if (typeof definition.label !== "string") {
37
+ (0, import_utils_safe.throwInvalidConfig)(`device`, `packages/config/config/devices/${filename}:
38
+ Endpoint ${index}: label is not a string`);
39
+ }
40
+ this.label = definition.label;
41
+ }
42
+ if (definition.associations != void 0) {
43
+ const associations = /* @__PURE__ */ new Map();
44
+ if (!(0, import_typeguards.isObject)(definition.associations)) {
45
+ (0, import_utils_safe.throwInvalidConfig)(`device`, `packages/config/config/devices/${filename}:
46
+ Endpoint ${index}: associations is not an object`);
47
+ }
48
+ for (const [key, assocDefinition] of Object.entries(definition.associations)) {
49
+ if (!/^[1-9][0-9]*$/.test(key)) {
50
+ (0, import_utils_safe.throwInvalidConfig)(`device`, `packages/config/config/devices/${filename}:
51
+ Endpoint ${index}: found non-numeric group id "${key}" in associations`);
52
+ }
53
+ const keyNum = parseInt(key, 10);
54
+ associations.set(keyNum, new import_AssociationConfig.ConditionalAssociationConfig(filename, keyNum, assocDefinition));
55
+ }
56
+ this.associations = associations;
57
+ }
58
+ if (definition.paramInformation != void 0) {
59
+ this.paramInformation = (0, import_ParamInformation.parseConditionalParamInformationMap)(definition, parent, `Endpoint ${index}: `);
60
+ }
61
+ }
62
+ index;
63
+ associations;
64
+ paramInformation;
65
+ condition;
66
+ label;
67
+ evaluateCondition(deviceId) {
68
+ if (!(0, import_ConditionalItem.conditionApplies)(this, deviceId))
69
+ return;
70
+ const ret = {
71
+ index: this.index,
72
+ label: this.label
73
+ };
74
+ const associations = (0, import_ConditionalItem.evaluateDeep)(this.associations, deviceId);
75
+ if (associations)
76
+ ret.associations = associations;
77
+ const paramInformation = (0, import_ConditionalItem.evaluateDeep)(this.paramInformation, deviceId);
78
+ if (paramInformation)
79
+ ret.paramInformation = paramInformation;
80
+ return ret;
81
+ }
82
+ }
83
+ // Annotate the CommonJS export names for ESM import in node:
84
+ 0 && (module.exports = {
85
+ ConditionalEndpointConfig
86
+ });
87
+ //# sourceMappingURL=EndpointConfig.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/devices/EndpointConfig.ts"],
4
+ "sourcesContent": ["import type { JSONObject } from \"@zwave-js/shared/safe\";\nimport { isObject } from \"alcalzone-shared/typeguards/index.js\";\nimport { throwInvalidConfig } from \"../utils_safe.js\";\nimport {\n\ttype AssociationConfig,\n\tConditionalAssociationConfig,\n} from \"./AssociationConfig.js\";\nimport {\n\ttype ConditionalItem,\n\tconditionApplies,\n\tevaluateDeep,\n\tvalidateCondition,\n} from \"./ConditionalItem.js\";\nimport type { ConditionalDeviceConfig } from \"./DeviceConfig.js\";\nimport {\n\ttype ConditionalParamInfoMap,\n\ttype ParamInfoMap,\n\tparseConditionalParamInformationMap,\n} from \"./ParamInformation.js\";\nimport type { DeviceID } from \"./shared.js\";\n\nexport class ConditionalEndpointConfig\n\timplements ConditionalItem<EndpointConfig>\n{\n\tpublic constructor(\n\t\tparent: ConditionalDeviceConfig,\n\t\tindex: number,\n\t\tdefinition: JSONObject,\n\t) {\n\t\tthis.index = index;\n\t\tconst filename = parent.filename;\n\n\t\tvalidateCondition(\n\t\t\tfilename,\n\t\t\tdefinition,\n\t\t\t`Endpoint ${index} contains an`,\n\t\t);\n\t\tthis.condition = definition.$if;\n\n\t\tif (definition.label != undefined) {\n\t\t\tif (typeof definition.label !== \"string\") {\n\t\t\t\tthrowInvalidConfig(\n\t\t\t\t\t`device`,\n\t\t\t\t\t`packages/config/config/devices/${filename}:\nEndpoint ${index}: label is not a string`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.label = definition.label;\n\t\t}\n\n\t\tif (definition.associations != undefined) {\n\t\t\tconst associations = new Map<\n\t\t\t\tnumber,\n\t\t\t\tConditionalAssociationConfig\n\t\t\t>();\n\t\t\tif (!isObject(definition.associations)) {\n\t\t\t\tthrowInvalidConfig(\n\t\t\t\t\t`device`,\n\t\t\t\t\t`packages/config/config/devices/${filename}:\nEndpoint ${index}: associations is not an object`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tfor (\n\t\t\t\tconst [key, assocDefinition] of Object.entries(\n\t\t\t\t\tdefinition.associations,\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tif (!/^[1-9][0-9]*$/.test(key)) {\n\t\t\t\t\tthrowInvalidConfig(\n\t\t\t\t\t\t`device`,\n\t\t\t\t\t\t`packages/config/config/devices/${filename}:\nEndpoint ${index}: found non-numeric group id \"${key}\" in associations`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst keyNum = parseInt(key, 10);\n\t\t\t\tassociations.set(\n\t\t\t\t\tkeyNum,\n\t\t\t\t\tnew ConditionalAssociationConfig(\n\t\t\t\t\t\tfilename,\n\t\t\t\t\t\tkeyNum,\n\t\t\t\t\t\tassocDefinition as any,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\tthis.associations = associations;\n\t\t}\n\n\t\tif (definition.paramInformation != undefined) {\n\t\t\tthis.paramInformation = parseConditionalParamInformationMap(\n\t\t\t\tdefinition,\n\t\t\t\tparent,\n\t\t\t\t`Endpoint ${index}: `,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic readonly index: number;\n\tpublic readonly associations?: ReadonlyMap<\n\t\tnumber,\n\t\tConditionalAssociationConfig\n\t>;\n\n\tpublic readonly paramInformation?: ConditionalParamInfoMap;\n\n\tpublic readonly condition?: string;\n\tpublic readonly label?: string;\n\n\tpublic evaluateCondition(deviceId?: DeviceID): EndpointConfig | undefined {\n\t\tif (!conditionApplies(this, deviceId)) return;\n\t\tconst ret: EndpointConfig = {\n\t\t\tindex: this.index,\n\t\t\tlabel: this.label,\n\t\t};\n\t\tconst associations = evaluateDeep(this.associations, deviceId);\n\t\tif (associations) ret.associations = associations;\n\n\t\tconst paramInformation = evaluateDeep(this.paramInformation, deviceId);\n\t\tif (paramInformation) ret.paramInformation = paramInformation;\n\n\t\treturn ret;\n\t}\n}\n\nexport type EndpointConfig =\n\t& Omit<\n\t\tConditionalEndpointConfig,\n\t\t\"condition\" | \"evaluateCondition\" | \"associations\" | \"paramInformation\"\n\t>\n\t& {\n\t\tassociations?: Map<number, AssociationConfig> | undefined;\n\t\tparamInformation?: ParamInfoMap;\n\t};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AACA;;;;;AAAA,wBAAyB;AACzB,wBAAmC;AACnC,+BAGO;AACP,6BAKO;AAEP,8BAIO;AAGD,MAAO,0BAAyB;EAGrC,YACC,QACA,OACA,YAAsB;AAEtB,SAAK,QAAQ;AACb,UAAM,WAAW,OAAO;AAExB,kDACC,UACA,YACA,YAAY,KAAK,cAAc;AAEhC,SAAK,YAAY,WAAW;AAE5B,QAAI,WAAW,SAAS,QAAW;AAClC,UAAI,OAAO,WAAW,UAAU,UAAU;AACzC,kDACC,UACA,kCAAkC,QAAQ;WACpC,KAAK,yBAAyB;MAEtC;AACA,WAAK,QAAQ,WAAW;IACzB;AAEA,QAAI,WAAW,gBAAgB,QAAW;AACzC,YAAM,eAAe,oBAAI,IAAG;AAI5B,UAAI,KAAC,4BAAS,WAAW,YAAY,GAAG;AACvC,kDACC,UACA,kCAAkC,QAAQ;WACpC,KAAK,iCAAiC;MAE9C;AACA,iBACO,CAAC,KAAK,eAAe,KAAK,OAAO,QACtC,WAAW,YAAY,GAEvB;AACD,YAAI,CAAC,gBAAgB,KAAK,GAAG,GAAG;AAC/B,oDACC,UACA,kCAAkC,QAAQ;WACrC,KAAK,iCAAiC,GAAG,mBAAmB;QAEnE;AAEA,cAAM,SAAS,SAAS,KAAK,EAAE;AAC/B,qBAAa,IACZ,QACA,IAAI,sDACH,UACA,QACA,eAAsB,CACtB;MAEH;AACA,WAAK,eAAe;IACrB;AAEA,QAAI,WAAW,oBAAoB,QAAW;AAC7C,WAAK,uBAAmB,6DACvB,YACA,QACA,YAAY,KAAK,IAAI;IAEvB;EACD;EAEgB;EACA;EAKA;EAEA;EACA;EAET,kBAAkB,UAAmB;AAC3C,QAAI,KAAC,yCAAiB,MAAM,QAAQ;AAAG;AACvC,UAAM,MAAsB;MAC3B,OAAO,KAAK;MACZ,OAAO,KAAK;;AAEb,UAAM,mBAAe,qCAAa,KAAK,cAAc,QAAQ;AAC7D,QAAI;AAAc,UAAI,eAAe;AAErC,UAAM,uBAAmB,qCAAa,KAAK,kBAAkB,QAAQ;AACrE,QAAI;AAAkB,UAAI,mBAAmB;AAE7C,WAAO;EACR;;",
6
+ "names": []
7
+ }
@@ -1,7 +1,7 @@
1
1
  import { type JSONObject, type ReadonlyObjectKeyMap } from "@zwave-js/shared/safe";
2
- import { type ConditionalItem } from "./ConditionalItem";
3
- import type { ConditionalDeviceConfig } from "./DeviceConfig";
4
- import type { DeviceID } from "./shared";
2
+ import { type ConditionalItem } from "./ConditionalItem.js";
3
+ import type { ConditionalDeviceConfig } from "./DeviceConfig.js";
4
+ import type { DeviceID } from "./shared.js";
5
5
  export declare class ConditionalParamInformation implements ConditionalItem<ParamInformation> {
6
6
  constructor(parent: ConditionalDeviceConfig, parameterNumber: number, valueBitMask: number | undefined, definition: JSONObject);
7
7
  private parent;
@@ -0,0 +1,209 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var ParamInformation_exports = {};
20
+ __export(ParamInformation_exports, {
21
+ ConditionalConfigOption: () => ConditionalConfigOption,
22
+ ConditionalParamInformation: () => ConditionalParamInformation,
23
+ parseConditionalParamInformationMap: () => parseConditionalParamInformationMap
24
+ });
25
+ module.exports = __toCommonJS(ParamInformation_exports);
26
+ var import_core = require("@zwave-js/core");
27
+ var import_safe = require("@zwave-js/shared/safe");
28
+ var import_typeguards = require("alcalzone-shared/typeguards/index.js");
29
+ var import_utils_safe = require("../utils_safe.js");
30
+ var import_ConditionalItem = require("./ConditionalItem.js");
31
+ class ConditionalParamInformation {
32
+ constructor(parent, parameterNumber, valueBitMask, definition) {
33
+ this.parent = parent;
34
+ this.parameterNumber = parameterNumber;
35
+ this.valueBitMask = valueBitMask;
36
+ this.condition = definition.$if;
37
+ if (typeof definition.label !== "string") {
38
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
39
+ Parameter #${parameterNumber} has a non-string label`);
40
+ }
41
+ this.label = definition.label;
42
+ if (definition.description != void 0 && typeof definition.description !== "string") {
43
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
44
+ Parameter #${parameterNumber} has a non-string description`);
45
+ }
46
+ this.description = definition.description;
47
+ if (typeof definition.valueSize !== "number" || definition.valueSize <= 0) {
48
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
49
+ Parameter #${parameterNumber} has an invalid value size`);
50
+ }
51
+ this.valueSize = definition.valueSize;
52
+ if (definition.minValue != void 0 && typeof definition.minValue !== "number") {
53
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
54
+ Parameter #${parameterNumber} has a non-numeric property minValue`);
55
+ }
56
+ this.minValue = definition.minValue;
57
+ if (definition.maxValue != void 0 && typeof definition.maxValue !== "number") {
58
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
59
+ Parameter #${parameterNumber} has a non-numeric property maxValue`);
60
+ }
61
+ this.maxValue = definition.maxValue;
62
+ if (definition.unsigned != void 0 && typeof definition.unsigned !== "boolean") {
63
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
64
+ Parameter #${parameterNumber} has a non-boolean property unsigned`);
65
+ }
66
+ this.unsigned = definition.unsigned === true;
67
+ if (definition.unit != void 0 && typeof definition.unit !== "string") {
68
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
69
+ Parameter #${parameterNumber} has a non-string unit`);
70
+ }
71
+ this.unit = definition.unit;
72
+ if (definition.readOnly != void 0 && definition.readOnly !== true) {
73
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
74
+ Parameter #${parameterNumber}: readOnly must true or omitted!`);
75
+ }
76
+ this.readOnly = definition.readOnly;
77
+ if (definition.writeOnly != void 0 && definition.writeOnly !== true) {
78
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
79
+ Parameter #${parameterNumber}: writeOnly must be true or omitted!`);
80
+ }
81
+ this.writeOnly = definition.writeOnly;
82
+ if (definition.defaultValue == void 0) {
83
+ if (!this.readOnly) {
84
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
85
+ Parameter #${parameterNumber} is missing defaultValue, which is required unless the parameter is readOnly`);
86
+ }
87
+ } else if (typeof definition.defaultValue !== "number") {
88
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
89
+ Parameter #${parameterNumber} has a non-numeric property defaultValue`);
90
+ }
91
+ this.defaultValue = definition.defaultValue;
92
+ if (definition.allowManualEntry != void 0 && definition.allowManualEntry !== false) {
93
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
94
+ Parameter #${parameterNumber}: allowManualEntry must be false or omitted!`);
95
+ }
96
+ this.allowManualEntry = definition.allowManualEntry ?? (this.readOnly ? false : true);
97
+ if ((0, import_typeguards.isArray)(definition.options) && !definition.options.every((opt) => (0, import_typeguards.isObject)(opt) && typeof opt.label === "string" && typeof opt.value === "number")) {
98
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${parent.filename}:
99
+ Parameter #${parameterNumber}: options is malformed!`);
100
+ }
101
+ this.options = definition.options?.map((opt) => new ConditionalConfigOption(opt.value, opt.label, opt.$if)) ?? [];
102
+ }
103
+ parent;
104
+ parameterNumber;
105
+ valueBitMask;
106
+ label;
107
+ description;
108
+ valueSize;
109
+ minValue;
110
+ maxValue;
111
+ unsigned;
112
+ defaultValue;
113
+ unit;
114
+ readOnly;
115
+ writeOnly;
116
+ allowManualEntry;
117
+ options;
118
+ condition;
119
+ evaluateCondition(deviceId) {
120
+ if (!(0, import_ConditionalItem.conditionApplies)(this, deviceId))
121
+ return;
122
+ const ret = {
123
+ ...(0, import_safe.pick)(this, [
124
+ "parameterNumber",
125
+ "valueBitMask",
126
+ "label",
127
+ "description",
128
+ "valueSize",
129
+ "minValue",
130
+ "maxValue",
131
+ "unsigned",
132
+ "defaultValue",
133
+ "unit",
134
+ "readOnly",
135
+ "writeOnly",
136
+ "allowManualEntry"
137
+ ]),
138
+ options: (0, import_ConditionalItem.evaluateDeep)(this.options, deviceId, true)
139
+ };
140
+ if (ret.minValue == void 0) {
141
+ if (ret.allowManualEntry === false && ret.options.length > 0) {
142
+ ret.minValue = Math.min(...ret.options.map((o) => o.value));
143
+ } else {
144
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${this.parent.filename}:
145
+ Parameter #${this.parameterNumber} is missing required property "minValue"!`);
146
+ }
147
+ }
148
+ if (ret.maxValue == void 0) {
149
+ if (ret.allowManualEntry === false && ret.options.length > 0) {
150
+ ret.maxValue = Math.max(...ret.options.map((o) => o.value));
151
+ } else {
152
+ (0, import_utils_safe.throwInvalidConfig)("devices", `packages/config/config/devices/${this.parent.filename}:
153
+ Parameter #${this.parameterNumber} is missing required property "maxValue"!`);
154
+ }
155
+ }
156
+ return ret;
157
+ }
158
+ }
159
+ class ConditionalConfigOption {
160
+ value;
161
+ label;
162
+ condition;
163
+ constructor(value, label, condition) {
164
+ this.value = value;
165
+ this.label = label;
166
+ this.condition = condition;
167
+ }
168
+ evaluateCondition(deviceId) {
169
+ if (!(0, import_ConditionalItem.conditionApplies)(this, deviceId))
170
+ return;
171
+ return (0, import_safe.pick)(this, ["value", "label"]);
172
+ }
173
+ }
174
+ function parseConditionalParamInformationMap(definition, parent, errorPrefix = "") {
175
+ const paramInformation = new import_safe.ObjectKeyMap();
176
+ const filename = parent.filename;
177
+ if ((0, import_typeguards.isArray)(definition.paramInformation)) {
178
+ if (!definition.paramInformation.every((entry) => "#" in entry)) {
179
+ (0, import_utils_safe.throwInvalidConfig)(`device`, `packages/config/config/devices/${filename}:
180
+ ${errorPrefix}required property "#" missing in at least one entry of paramInformation`);
181
+ }
182
+ for (const entry of definition.paramInformation) {
183
+ (0, import_ConditionalItem.validateCondition)(filename, entry, `${errorPrefix}At least one entry of paramInformation contains an`);
184
+ }
185
+ for (const paramDefinition of definition.paramInformation) {
186
+ const { ["#"]: paramNo, ...defn } = paramDefinition;
187
+ const key = (0, import_core.tryParseParamNumber)(paramNo);
188
+ if (!key) {
189
+ (0, import_utils_safe.throwInvalidConfig)(`device`, `packages/config/config/devices/${filename}:
190
+ ${errorPrefix}found invalid param number "${paramNo}" in paramInformation`);
191
+ }
192
+ if (!paramInformation.has(key))
193
+ paramInformation.set(key, []);
194
+ paramInformation.get(key).push(new ConditionalParamInformation(parent, key.parameter, key.valueBitMask, defn));
195
+ }
196
+ } else if ((0, import_typeguards.isObject)(definition.paramInformation)) {
197
+ } else {
198
+ (0, import_utils_safe.throwInvalidConfig)(`device`, `packages/config/config/devices/${filename}:
199
+ ${errorPrefix}paramInformation must be an array!`);
200
+ }
201
+ return paramInformation;
202
+ }
203
+ // Annotate the CommonJS export names for ESM import in node:
204
+ 0 && (module.exports = {
205
+ ConditionalConfigOption,
206
+ ConditionalParamInformation,
207
+ parseConditionalParamInformationMap
208
+ });
209
+ //# sourceMappingURL=ParamInformation.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/devices/ParamInformation.ts"],
4
+ "sourcesContent": ["import { tryParseParamNumber } from \"@zwave-js/core\";\nimport {\n\ttype JSONObject,\n\tObjectKeyMap,\n\ttype ReadonlyObjectKeyMap,\n\tpick,\n} from \"@zwave-js/shared/safe\";\nimport { isArray, isObject } from \"alcalzone-shared/typeguards/index.js\";\nimport { throwInvalidConfig } from \"../utils_safe.js\";\nimport {\n\ttype ConditionalItem,\n\tconditionApplies,\n\tevaluateDeep,\n\tvalidateCondition,\n} from \"./ConditionalItem.js\";\nimport type { ConditionalDeviceConfig } from \"./DeviceConfig.js\";\nimport type { DeviceID } from \"./shared.js\";\n\nexport class ConditionalParamInformation\n\timplements ConditionalItem<ParamInformation>\n{\n\tpublic constructor(\n\t\tparent: ConditionalDeviceConfig,\n\t\tparameterNumber: number,\n\t\tvalueBitMask: number | undefined,\n\t\tdefinition: JSONObject,\n\t) {\n\t\tthis.parent = parent;\n\t\tthis.parameterNumber = parameterNumber;\n\t\tthis.valueBitMask = valueBitMask;\n\t\t// No need to validate here, this should be done one level higher\n\t\tthis.condition = definition.$if;\n\n\t\tif (typeof definition.label !== \"string\") {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t\"devices\",\n\t\t\t\t`packages/config/config/devices/${parent.filename}:\nParameter #${parameterNumber} has a non-string label`,\n\t\t\t);\n\t\t}\n\t\tthis.label = definition.label;\n\n\t\tif (\n\t\t\tdefinition.description != undefined\n\t\t\t&& typeof definition.description !== \"string\"\n\t\t) {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t\"devices\",\n\t\t\t\t`packages/config/config/devices/${parent.filename}:\nParameter #${parameterNumber} has a non-string description`,\n\t\t\t);\n\t\t}\n\t\tthis.description = definition.description;\n\n\t\tif (\n\t\t\ttypeof definition.valueSize !== \"number\"\n\t\t\t|| definition.valueSize <= 0\n\t\t) {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t\"devices\",\n\t\t\t\t`packages/config/config/devices/${parent.filename}:\nParameter #${parameterNumber} has an invalid value size`,\n\t\t\t);\n\t\t}\n\t\tthis.valueSize = definition.valueSize;\n\n\t\tif (\n\t\t\tdefinition.minValue != undefined\n\t\t\t&& typeof definition.minValue !== \"number\"\n\t\t) {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t\"devices\",\n\t\t\t\t`packages/config/config/devices/${parent.filename}:\nParameter #${parameterNumber} has a non-numeric property minValue`,\n\t\t\t);\n\t\t}\n\t\tthis.minValue = definition.minValue;\n\n\t\tif (\n\t\t\tdefinition.maxValue != undefined\n\t\t\t&& typeof definition.maxValue !== \"number\"\n\t\t) {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t\"devices\",\n\t\t\t\t`packages/config/config/devices/${parent.filename}:\nParameter #${parameterNumber} has a non-numeric property maxValue`,\n\t\t\t);\n\t\t}\n\t\tthis.maxValue = definition.maxValue;\n\n\t\tif (\n\t\t\tdefinition.unsigned != undefined\n\t\t\t&& typeof definition.unsigned !== \"boolean\"\n\t\t) {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t\"devices\",\n\t\t\t\t`packages/config/config/devices/${parent.filename}:\nParameter #${parameterNumber} has a non-boolean property unsigned`,\n\t\t\t);\n\t\t}\n\t\tthis.unsigned = definition.unsigned === true;\n\n\t\tif (\n\t\t\tdefinition.unit != undefined\n\t\t\t&& typeof definition.unit !== \"string\"\n\t\t) {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t\"devices\",\n\t\t\t\t`packages/config/config/devices/${parent.filename}:\nParameter #${parameterNumber} has a non-string unit`,\n\t\t\t);\n\t\t}\n\t\tthis.unit = definition.unit;\n\n\t\tif (definition.readOnly != undefined && definition.readOnly !== true) {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t\"devices\",\n\t\t\t\t`packages/config/config/devices/${parent.filename}:\n\t\tParameter #${parameterNumber}: readOnly must true or omitted!`,\n\t\t\t);\n\t\t}\n\t\tthis.readOnly = definition.readOnly;\n\n\t\tif (\n\t\t\tdefinition.writeOnly != undefined\n\t\t\t&& definition.writeOnly !== true\n\t\t) {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t\"devices\",\n\t\t\t\t`packages/config/config/devices/${parent.filename}:\n\t\tParameter #${parameterNumber}: writeOnly must be true or omitted!`,\n\t\t\t);\n\t\t}\n\t\tthis.writeOnly = definition.writeOnly;\n\n\t\tif (definition.defaultValue == undefined) {\n\t\t\tif (!this.readOnly) {\n\t\t\t\tthrowInvalidConfig(\n\t\t\t\t\t\"devices\",\n\t\t\t\t\t`packages/config/config/devices/${parent.filename}:\nParameter #${parameterNumber} is missing defaultValue, which is required unless the parameter is readOnly`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (typeof definition.defaultValue !== \"number\") {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t\"devices\",\n\t\t\t\t`packages/config/config/devices/${parent.filename}:\nParameter #${parameterNumber} has a non-numeric property defaultValue`,\n\t\t\t);\n\t\t}\n\t\tthis.defaultValue = definition.defaultValue;\n\n\t\tif (\n\t\t\tdefinition.allowManualEntry != undefined\n\t\t\t&& definition.allowManualEntry !== false\n\t\t) {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t\"devices\",\n\t\t\t\t`packages/config/config/devices/${parent.filename}:\nParameter #${parameterNumber}: allowManualEntry must be false or omitted!`,\n\t\t\t);\n\t\t}\n\t\t// Default to allowing manual entry, except if the param is readonly\n\t\tthis.allowManualEntry = definition.allowManualEntry\n\t\t\t?? (this.readOnly ? false : true);\n\n\t\tif (\n\t\t\tisArray(definition.options)\n\t\t\t&& !definition.options.every(\n\t\t\t\t(opt: unknown) =>\n\t\t\t\t\tisObject(opt)\n\t\t\t\t\t&& typeof opt.label === \"string\"\n\t\t\t\t\t&& typeof opt.value === \"number\",\n\t\t\t)\n\t\t) {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t\"devices\",\n\t\t\t\t`packages/config/config/devices/${parent.filename}:\nParameter #${parameterNumber}: options is malformed!`,\n\t\t\t);\n\t\t}\n\n\t\tthis.options = definition.options?.map(\n\t\t\t(opt: any) =>\n\t\t\t\tnew ConditionalConfigOption(opt.value, opt.label, opt.$if),\n\t\t) ?? [];\n\t}\n\n\tprivate parent: ConditionalDeviceConfig;\n\tpublic readonly parameterNumber: number;\n\tpublic readonly valueBitMask?: number;\n\tpublic readonly label: string;\n\tpublic readonly description?: string;\n\tpublic readonly valueSize: number;\n\tpublic readonly minValue?: number;\n\tpublic readonly maxValue?: number;\n\tpublic readonly unsigned?: boolean;\n\tpublic readonly defaultValue: number;\n\tpublic readonly unit?: string;\n\tpublic readonly readOnly?: true;\n\tpublic readonly writeOnly?: true;\n\tpublic readonly allowManualEntry: boolean;\n\tpublic readonly options: readonly ConditionalConfigOption[];\n\n\tpublic readonly condition?: string;\n\n\tpublic evaluateCondition(\n\t\tdeviceId?: DeviceID,\n\t): ParamInformation | undefined {\n\t\tif (!conditionApplies(this, deviceId)) return;\n\n\t\tconst ret = {\n\t\t\t...pick(this, [\n\t\t\t\t\"parameterNumber\",\n\t\t\t\t\"valueBitMask\",\n\t\t\t\t\"label\",\n\t\t\t\t\"description\",\n\t\t\t\t\"valueSize\",\n\t\t\t\t\"minValue\",\n\t\t\t\t\"maxValue\",\n\t\t\t\t\"unsigned\",\n\t\t\t\t\"defaultValue\",\n\t\t\t\t\"unit\",\n\t\t\t\t\"readOnly\",\n\t\t\t\t\"writeOnly\",\n\t\t\t\t\"allowManualEntry\",\n\t\t\t]),\n\t\t\toptions: evaluateDeep(this.options, deviceId, true),\n\t\t};\n\t\t// Infer minValue from options if possible\n\t\tif (ret.minValue == undefined) {\n\t\t\tif (ret.allowManualEntry === false && ret.options.length > 0) {\n\t\t\t\tret.minValue = Math.min(...ret.options.map((o) => o.value));\n\t\t\t} else {\n\t\t\t\tthrowInvalidConfig(\n\t\t\t\t\t\"devices\",\n\t\t\t\t\t`packages/config/config/devices/${this.parent.filename}:\nParameter #${this.parameterNumber} is missing required property \"minValue\"!`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (ret.maxValue == undefined) {\n\t\t\tif (ret.allowManualEntry === false && ret.options.length > 0) {\n\t\t\t\tret.maxValue = Math.max(...ret.options.map((o) => o.value));\n\t\t\t} else {\n\t\t\t\tthrowInvalidConfig(\n\t\t\t\t\t\"devices\",\n\t\t\t\t\t`packages/config/config/devices/${this.parent.filename}:\nParameter #${this.parameterNumber} is missing required property \"maxValue\"!`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// @ts-expect-error TS doesn't seem to understand that we do set min/maxValue\n\t\treturn ret;\n\t}\n}\n\nexport type ParamInformation =\n\t& Omit<\n\t\tConditionalParamInformation,\n\t\t\"condition\" | \"evaluateCondition\" | \"options\" | \"minValue\" | \"maxValue\"\n\t>\n\t& {\n\t\toptions: readonly ConfigOption[];\n\t\tminValue: NonNullable<ConditionalParamInformation[\"minValue\"]>;\n\t\tmaxValue: NonNullable<ConditionalParamInformation[\"maxValue\"]>;\n\t};\n\nexport class ConditionalConfigOption implements ConditionalItem<ConfigOption> {\n\tpublic constructor(\n\t\tpublic readonly value: number,\n\t\tpublic readonly label: string,\n\t\tpublic readonly condition?: string,\n\t) {}\n\n\tpublic evaluateCondition(deviceId?: DeviceID): ConfigOption | undefined {\n\t\tif (!conditionApplies(this, deviceId)) return;\n\n\t\treturn pick(this, [\"value\", \"label\"]);\n\t}\n}\n\nexport interface ConfigOption {\n\tvalue: number;\n\tlabel: string;\n}\n\nexport type ConditionalParamInfoMap = ReadonlyObjectKeyMap<\n\t{ parameter: number; valueBitMask?: number },\n\tConditionalParamInformation[]\n>;\n\nexport type ParamInfoMap = ReadonlyObjectKeyMap<\n\t{ parameter: number; valueBitMask?: number },\n\tParamInformation\n>;\n\nexport function parseConditionalParamInformationMap(\n\tdefinition: JSONObject,\n\tparent: ConditionalDeviceConfig,\n\terrorPrefix: string = \"\",\n): ConditionalParamInfoMap {\n\tconst paramInformation = new ObjectKeyMap<\n\t\t{ parameter: number; valueBitMask?: number },\n\t\tConditionalParamInformation[]\n\t>();\n\n\tconst filename = parent.filename;\n\n\tif (isArray(definition.paramInformation)) {\n\t\t// Check that every param has a param number\n\t\tif (!definition.paramInformation.every((entry: any) => \"#\" in entry)) {\n\t\t\tthrowInvalidConfig(\n\t\t\t\t`device`,\n\t\t\t\t`packages/config/config/devices/${filename}: \n${errorPrefix}required property \"#\" missing in at least one entry of paramInformation`,\n\t\t\t);\n\t\t}\n\n\t\t// And a valid $if condition\n\t\tfor (const entry of definition.paramInformation) {\n\t\t\tvalidateCondition(\n\t\t\t\tfilename,\n\t\t\t\tentry,\n\t\t\t\t`${errorPrefix}At least one entry of paramInformation contains an`,\n\t\t\t);\n\t\t}\n\n\t\tfor (const paramDefinition of definition.paramInformation) {\n\t\t\tconst { [\"#\"]: paramNo, ...defn } = paramDefinition;\n\t\t\tconst key = tryParseParamNumber(paramNo);\n\t\t\tif (!key) {\n\t\t\t\tthrowInvalidConfig(\n\t\t\t\t\t`device`,\n\t\t\t\t\t`packages/config/config/devices/${filename}: \n${errorPrefix}found invalid param number \"${paramNo}\" in paramInformation`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (!paramInformation.has(key)) paramInformation.set(key, []);\n\t\t\tparamInformation\n\t\t\t\t.get(key)!\n\t\t\t\t.push(\n\t\t\t\t\tnew ConditionalParamInformation(\n\t\t\t\t\t\tparent,\n\t\t\t\t\t\tkey.parameter,\n\t\t\t\t\t\tkey.valueBitMask,\n\t\t\t\t\t\tdefn,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t}\n\t} else if (isObject(definition.paramInformation)) {\n\t\t// Silently ignore this old format\n\t} else {\n\t\tthrowInvalidConfig(\n\t\t\t`device`,\n\t\t\t`packages/config/config/devices/${filename}:\n${errorPrefix}paramInformation must be an array!`,\n\t\t);\n\t}\n\n\treturn paramInformation;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAAA,kBAAoC;AACpC,kBAKO;AACP,wBAAkC;AAClC,wBAAmC;AACnC,6BAKO;AAID,MAAO,4BAA2B;EAGvC,YACC,QACA,iBACA,cACA,YAAsB;AAEtB,SAAK,SAAS;AACd,SAAK,kBAAkB;AACvB,SAAK,eAAe;AAEpB,SAAK,YAAY,WAAW;AAE5B,QAAI,OAAO,WAAW,UAAU,UAAU;AACzC,gDACC,WACA,kCAAkC,OAAO,QAAQ;aACxC,eAAe,yBAAyB;IAEnD;AACA,SAAK,QAAQ,WAAW;AAExB,QACC,WAAW,eAAe,UACvB,OAAO,WAAW,gBAAgB,UACpC;AACD,gDACC,WACA,kCAAkC,OAAO,QAAQ;aACxC,eAAe,+BAA+B;IAEzD;AACA,SAAK,cAAc,WAAW;AAE9B,QACC,OAAO,WAAW,cAAc,YAC7B,WAAW,aAAa,GAC1B;AACD,gDACC,WACA,kCAAkC,OAAO,QAA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@@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var shared_exports = {};
16
+ module.exports = __toCommonJS(shared_exports);
17
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../esm/devices/shared.js"],
4
+ "sourcesContent": ["export {};\n//# sourceMappingURL=shared.js.map"],
5
+ "mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,13 @@
1
+ export * from "./ConfigManager.js";
2
+ export * from "./Logger_safe.js";
3
+ export * from "./Manufacturers.js";
4
+ export { PACKAGE_VERSION } from "./_version.js";
5
+ export * from "./devices/AssociationConfig.js";
6
+ export * from "./devices/CompatConfig.js";
7
+ export * from "./devices/DeviceConfig.js";
8
+ export * from "./devices/DeviceMetadata.js";
9
+ export * from "./devices/EndpointConfig.js";
10
+ export * from "./devices/ParamInformation.js";
11
+ export * from "./devices/shared.js";
12
+ export { externalConfigDir } from "./utils.js";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var esm_exports = {};
21
+ __export(esm_exports, {
22
+ PACKAGE_VERSION: () => import_version.PACKAGE_VERSION,
23
+ externalConfigDir: () => import_utils.externalConfigDir
24
+ });
25
+ module.exports = __toCommonJS(esm_exports);
26
+ __reExport(esm_exports, require("./ConfigManager.js"), module.exports);
27
+ __reExport(esm_exports, require("./Logger_safe.js"), module.exports);
28
+ __reExport(esm_exports, require("./Manufacturers.js"), module.exports);
29
+ var import_version = require("./_version.js");
30
+ __reExport(esm_exports, require("./devices/AssociationConfig.js"), module.exports);
31
+ __reExport(esm_exports, require("./devices/CompatConfig.js"), module.exports);
32
+ __reExport(esm_exports, require("./devices/DeviceConfig.js"), module.exports);
33
+ __reExport(esm_exports, require("./devices/DeviceMetadata.js"), module.exports);
34
+ __reExport(esm_exports, require("./devices/EndpointConfig.js"), module.exports);
35
+ __reExport(esm_exports, require("./devices/ParamInformation.js"), module.exports);
36
+ __reExport(esm_exports, require("./devices/shared.js"), module.exports);
37
+ var import_utils = require("./utils.js");
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ PACKAGE_VERSION,
41
+ externalConfigDir,
42
+ ...require("./ConfigManager.js"),
43
+ ...require("./Logger_safe.js"),
44
+ ...require("./Manufacturers.js"),
45
+ ...require("./devices/AssociationConfig.js"),
46
+ ...require("./devices/CompatConfig.js"),
47
+ ...require("./devices/DeviceConfig.js"),
48
+ ...require("./devices/DeviceMetadata.js"),
49
+ ...require("./devices/EndpointConfig.js"),
50
+ ...require("./devices/ParamInformation.js"),
51
+ ...require("./devices/shared.js")
52
+ });
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.ts"],
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/consistent-type-exports */\nexport * from \"./ConfigManager.js\";\nexport * from \"./Logger_safe.js\";\nexport * from \"./Manufacturers.js\";\nexport { PACKAGE_VERSION } from \"./_version.js\";\nexport * from \"./devices/AssociationConfig.js\";\nexport * from \"./devices/CompatConfig.js\";\nexport * from \"./devices/DeviceConfig.js\";\nexport * from \"./devices/DeviceMetadata.js\";\nexport * from \"./devices/EndpointConfig.js\";\nexport * from \"./devices/ParamInformation.js\";\nexport * from \"./devices/shared.js\";\nexport { externalConfigDir } from \"./utils.js\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;AACA,wBAAc,+BADd;AAEA,wBAAc,6BAFd;AAGA,wBAAc,+BAHd;AAIA,qBAAgC;AAChC,wBAAc,2CALd;AAMA,wBAAc,sCANd;AAOA,wBAAc,sCAPd;AAQA,wBAAc,wCARd;AASA,wBAAc,wCATd;AAUA,wBAAc,0CAVd;AAWA,wBAAc,gCAXd;AAYA,mBAAkC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./Logger_safe.js";
2
+ export { PACKAGE_VERSION } from "./_version.js";
3
+ //# sourceMappingURL=index_safe.d.ts.map