homebridge-plugin-utils 1.34.0 → 2.0.0

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 (198) hide show
  1. package/README.md +130 -2
  2. package/build/eslint-plugin/README.md +164 -0
  3. package/build/eslint-plugin/config.mjs +308 -0
  4. package/build/eslint-plugin/index.mjs +7 -0
  5. package/build/eslint-plugin/plugin.mjs +46 -0
  6. package/build/eslint-plugin/rules/blank-line-after-open-brace.mjs +137 -0
  7. package/build/eslint-plugin/rules/blank-line-after-open-brace.test.mjs +112 -0
  8. package/build/eslint-plugin/rules/comment-style.mjs +190 -0
  9. package/build/eslint-plugin/rules/comment-style.test.mjs +190 -0
  10. package/build/eslint-plugin/rules/enforce-node-protocol.mjs +114 -0
  11. package/build/eslint-plugin/rules/enforce-node-protocol.test.mjs +116 -0
  12. package/build/eslint-plugin/rules/paren-comparisons-in-logical.mjs +94 -0
  13. package/build/eslint-plugin/rules/paren-comparisons-in-logical.test.mjs +107 -0
  14. package/build/eslint-plugin/rules/split-type-imports.mjs +354 -0
  15. package/build/eslint-plugin/rules/split-type-imports.test.mjs +268 -0
  16. package/build/eslint-plugin/test-setup.mjs +21 -0
  17. package/build/fs-ops.mjs +184 -0
  18. package/build/tsconfig.json +18 -3
  19. package/dist/backpressure.d.ts +128 -0
  20. package/dist/backpressure.js +273 -0
  21. package/dist/backpressure.js.map +1 -0
  22. package/dist/cli/index.d.ts +95 -0
  23. package/dist/cli/index.js +355 -0
  24. package/dist/cli/index.js.map +1 -0
  25. package/dist/clock-double.d.ts +93 -0
  26. package/dist/clock-double.js +141 -0
  27. package/dist/clock-double.js.map +1 -0
  28. package/dist/clock.d.ts +39 -0
  29. package/dist/clock.js +34 -0
  30. package/dist/clock.js.map +1 -0
  31. package/dist/eslint-plugin/config.d.mts +193 -0
  32. package/dist/eslint-plugin/index.d.mts +2 -0
  33. package/dist/eslint-plugin/plugin.d.mts +87 -0
  34. package/dist/eslint-plugin/rules/blank-line-after-open-brace.d.mts +19 -0
  35. package/dist/eslint-plugin/rules/comment-style.d.mts +15 -0
  36. package/dist/eslint-plugin/rules/enforce-node-protocol.d.mts +18 -0
  37. package/dist/eslint-plugin/rules/paren-comparisons-in-logical.d.mts +15 -0
  38. package/dist/eslint-plugin/rules/split-type-imports.d.mts +16 -0
  39. package/dist/featureOptions-docs.d.ts +96 -0
  40. package/dist/featureOptions-docs.js +193 -0
  41. package/dist/featureOptions-docs.js.map +1 -0
  42. package/dist/featureOptions.d.ts +674 -0
  43. package/dist/featureOptions.js +870 -0
  44. package/dist/featureOptions.js.map +1 -0
  45. package/dist/ffmpeg/codecs.d.ts +256 -72
  46. package/dist/ffmpeg/codecs.js +477 -257
  47. package/dist/ffmpeg/codecs.js.map +1 -1
  48. package/dist/ffmpeg/dgram-util.d.ts +46 -0
  49. package/dist/ffmpeg/dgram-util.js +38 -0
  50. package/dist/ffmpeg/dgram-util.js.map +1 -0
  51. package/dist/ffmpeg/exec.d.ts +83 -64
  52. package/dist/ffmpeg/exec.js +77 -86
  53. package/dist/ffmpeg/exec.js.map +1 -1
  54. package/dist/ffmpeg/fmp4.d.ts +70 -4
  55. package/dist/ffmpeg/fmp4.js +100 -11
  56. package/dist/ffmpeg/fmp4.js.map +1 -1
  57. package/dist/ffmpeg/hap-enums.d.ts +214 -0
  58. package/dist/ffmpeg/hap-enums.js +92 -0
  59. package/dist/ffmpeg/hap-enums.js.map +1 -0
  60. package/dist/ffmpeg/index.d.ts +16 -9
  61. package/dist/ffmpeg/index.js +6 -0
  62. package/dist/ffmpeg/index.js.map +1 -1
  63. package/dist/ffmpeg/mp4-assembler.d.ts +120 -0
  64. package/dist/ffmpeg/mp4-assembler.js +387 -0
  65. package/dist/ffmpeg/mp4-assembler.js.map +1 -0
  66. package/dist/ffmpeg/mp4-parser.d.ts +94 -0
  67. package/dist/ffmpeg/mp4-parser.js +130 -0
  68. package/dist/ffmpeg/mp4-parser.js.map +1 -0
  69. package/dist/ffmpeg/options.d.ts +62 -149
  70. package/dist/ffmpeg/options.js +608 -499
  71. package/dist/ffmpeg/options.js.map +1 -1
  72. package/dist/ffmpeg/process.d.ts +143 -91
  73. package/dist/ffmpeg/process.js +406 -265
  74. package/dist/ffmpeg/process.js.map +1 -1
  75. package/dist/ffmpeg/record.d.ts +302 -188
  76. package/dist/ffmpeg/record.js +408 -560
  77. package/dist/ffmpeg/record.js.map +1 -1
  78. package/dist/ffmpeg/recording-process-double.d.ts +144 -0
  79. package/dist/ffmpeg/recording-process-double.js +168 -0
  80. package/dist/ffmpeg/recording-process-double.js.map +1 -0
  81. package/dist/ffmpeg/rtp-parser.d.ts +70 -0
  82. package/dist/ffmpeg/rtp-parser.js +77 -0
  83. package/dist/ffmpeg/rtp-parser.js.map +1 -0
  84. package/dist/ffmpeg/rtp.d.ts +198 -141
  85. package/dist/ffmpeg/rtp.js +473 -244
  86. package/dist/ffmpeg/rtp.js.map +1 -1
  87. package/dist/ffmpeg/settings.d.ts +5 -1
  88. package/dist/ffmpeg/settings.js +20 -2
  89. package/dist/ffmpeg/settings.js.map +1 -1
  90. package/dist/ffmpeg/stream.d.ts +57 -107
  91. package/dist/ffmpeg/stream.js +121 -148
  92. package/dist/ffmpeg/stream.js.map +1 -1
  93. package/dist/formatters.d.ts +106 -0
  94. package/dist/formatters.js +174 -0
  95. package/dist/formatters.js.map +1 -0
  96. package/dist/homebridge-enums.d.ts +30 -0
  97. package/dist/homebridge-enums.js +17 -0
  98. package/dist/homebridge-enums.js.map +1 -0
  99. package/dist/index.d.ts +12 -5
  100. package/dist/index.js +8 -2
  101. package/dist/index.js.map +1 -1
  102. package/dist/logclient/auth.d.ts +114 -0
  103. package/dist/logclient/auth.js +199 -0
  104. package/dist/logclient/auth.js.map +1 -0
  105. package/dist/logclient/cli-run.d.ts +76 -0
  106. package/dist/logclient/cli-run.js +639 -0
  107. package/dist/logclient/cli-run.js.map +1 -0
  108. package/dist/logclient/cli.d.ts +3 -0
  109. package/dist/logclient/cli.js +97 -0
  110. package/dist/logclient/cli.js.map +1 -0
  111. package/dist/logclient/client.d.ts +145 -0
  112. package/dist/logclient/client.js +600 -0
  113. package/dist/logclient/client.js.map +1 -0
  114. package/dist/logclient/config.d.ts +173 -0
  115. package/dist/logclient/config.js +199 -0
  116. package/dist/logclient/config.js.map +1 -0
  117. package/dist/logclient/endpoints.d.ts +54 -0
  118. package/dist/logclient/endpoints.js +73 -0
  119. package/dist/logclient/endpoints.js.map +1 -0
  120. package/dist/logclient/filter.d.ts +45 -0
  121. package/dist/logclient/filter.js +51 -0
  122. package/dist/logclient/filter.js.map +1 -0
  123. package/dist/logclient/frame.d.ts +93 -0
  124. package/dist/logclient/frame.js +203 -0
  125. package/dist/logclient/frame.js.map +1 -0
  126. package/dist/logclient/index.d.ts +31 -0
  127. package/dist/logclient/index.js +12 -0
  128. package/dist/logclient/index.js.map +1 -0
  129. package/dist/logclient/parser.d.ts +211 -0
  130. package/dist/logclient/parser.js +393 -0
  131. package/dist/logclient/parser.js.map +1 -0
  132. package/dist/logclient/rest.d.ts +41 -0
  133. package/dist/logclient/rest.js +111 -0
  134. package/dist/logclient/rest.js.map +1 -0
  135. package/dist/logclient/settings.d.ts +15 -0
  136. package/dist/logclient/settings.js +64 -0
  137. package/dist/logclient/settings.js.map +1 -0
  138. package/dist/logclient/socket-double.d.ts +201 -0
  139. package/dist/logclient/socket-double.js +384 -0
  140. package/dist/logclient/socket-double.js.map +1 -0
  141. package/dist/logclient/socket.d.ts +257 -0
  142. package/dist/logclient/socket.js +620 -0
  143. package/dist/logclient/socket.js.map +1 -0
  144. package/dist/logclient/stitch.d.ts +83 -0
  145. package/dist/logclient/stitch.js +146 -0
  146. package/dist/logclient/stitch.js.map +1 -0
  147. package/dist/logclient/time-expression.d.ts +42 -0
  148. package/dist/logclient/time-expression.js +181 -0
  149. package/dist/logclient/time-expression.js.map +1 -0
  150. package/dist/logclient/time-window.d.ts +38 -0
  151. package/dist/logclient/time-window.js +53 -0
  152. package/dist/logclient/time-window.js.map +1 -0
  153. package/dist/logclient/types.d.ts +107 -0
  154. package/dist/logclient/types.js +6 -0
  155. package/dist/logclient/types.js.map +1 -0
  156. package/dist/mqttClient.d.ts +287 -0
  157. package/dist/mqttClient.js +433 -0
  158. package/dist/mqttClient.js.map +1 -0
  159. package/dist/service.d.ts +64 -15
  160. package/dist/service.js +93 -66
  161. package/dist/service.js.map +1 -1
  162. package/dist/ui/featureOptions.js +870 -0
  163. package/dist/ui/featureOptions.js.map +1 -0
  164. package/dist/ui/formatters.js +174 -0
  165. package/dist/ui/formatters.js.map +1 -0
  166. package/dist/ui/pluginConfigSession.mjs +141 -0
  167. package/dist/ui/webUi-featureOptions/categoryState.mjs +135 -0
  168. package/dist/ui/webUi-featureOptions/effects/keyboard.mjs +61 -0
  169. package/dist/ui/webUi-featureOptions/effects/persist.mjs +226 -0
  170. package/dist/ui/webUi-featureOptions/effects/theme.mjs +398 -0
  171. package/dist/ui/webUi-featureOptions/effects/tokens.mjs +152 -0
  172. package/dist/ui/webUi-featureOptions/rendering.mjs +431 -0
  173. package/dist/ui/webUi-featureOptions/selectors.mjs +360 -0
  174. package/dist/ui/webUi-featureOptions/state.mjs +319 -0
  175. package/dist/ui/webUi-featureOptions/store.mjs +181 -0
  176. package/dist/ui/webUi-featureOptions/utils.mjs +200 -0
  177. package/dist/ui/webUi-featureOptions/views/connectionError.mjs +152 -0
  178. package/dist/ui/webUi-featureOptions/views/deviceInfo.mjs +80 -0
  179. package/dist/ui/webUi-featureOptions/views/header.mjs +77 -0
  180. package/dist/ui/webUi-featureOptions/views/nav.mjs +327 -0
  181. package/dist/ui/webUi-featureOptions/views/options.mjs +521 -0
  182. package/dist/ui/webUi-featureOptions/views/search.mjs +395 -0
  183. package/dist/ui/webUi-featureOptions.mjs +677 -0
  184. package/dist/ui/webUi.mjs +192 -87
  185. package/dist/util.d.ts +597 -45
  186. package/dist/util.js +787 -68
  187. package/dist/util.js.map +1 -1
  188. package/package.json +33 -15
  189. package/build/eslint-rules.mjs +0 -511
  190. package/dist/featureoptions.d.ts +0 -264
  191. package/dist/featureoptions.js +0 -480
  192. package/dist/featureoptions.js.map +0 -1
  193. package/dist/mqttclient.d.ts +0 -178
  194. package/dist/mqttclient.js +0 -310
  195. package/dist/mqttclient.js.map +0 -1
  196. package/dist/ui/featureoptions.js +0 -480
  197. package/dist/ui/featureoptions.js.map +0 -1
  198. package/dist/ui/webUi-featureoptions.mjs +0 -3765
package/dist/service.js CHANGED
@@ -12,7 +12,13 @@ let hasNameUUIDs = null;
12
12
  // service without holding a reference to the HAP object itself. This reflection pattern extracts it from the first characteristic on any service instance, which always
13
13
  // exists (every service has at least one required characteristic). Centralized here so the fragile cast lives in one place.
14
14
  function getCharacteristicConstructor(service) {
15
- return service.characteristics[0].constructor;
15
+ // Every HAP service is constructed with at least one required characteristic, so the first slot is always populated. The explicit check satisfies
16
+ // `noUncheckedIndexedAccess` and throws loudly in the unreachable event that a service arrives without characteristics.
17
+ const [first] = service.characteristics;
18
+ if (!first) {
19
+ throw new Error("Service has no characteristics; cannot resolve the Characteristic constructor.");
20
+ }
21
+ return first.constructor;
16
22
  }
17
23
  /**
18
24
  * Initializes the cached UUID Sets for service characteristic lookups.
@@ -22,48 +28,43 @@ function getCharacteristicConstructor(service) {
22
28
  * @internal
23
29
  */
24
30
  function initServiceUUIDSets(service) {
25
- // Already initialized.
26
31
  if (requiresConfiguredNameUUIDs) {
27
32
  return;
28
33
  }
29
- // Grab the constructor from the instance of our service so we can access the static UUID properties.
34
+ // Grab the constructor from the instance of our service so we can access the static UUID properties. HAP's static service entries are populated unconditionally at
35
+ // module load, so the UUID lookup is total in practice. We centralize the `undefined` handling here so the individual Set contents read cleanly.
30
36
  const ctor = service.constructor;
31
- // Services that require the ConfiguredName characteristic.
32
- requiresConfiguredNameUUIDs = new Set([
33
- ctor.InputSource.UUID, ctor.Television.UUID, ctor.WiFiRouter.UUID
34
- ]);
35
- // Services that support the ConfiguredName characteristic (includes required).
37
+ const uuidOf = (name) => ctor[name]?.UUID ?? "";
38
+ requiresConfiguredNameUUIDs = new Set(["InputSource", "Television", "WiFiRouter"].map(uuidOf));
39
+ // The "has" sets are supersets of the "requires" sets - any service that requires a characteristic also supports it. Call sites combine the two predicates as
40
+ // `!serviceRequires(...) && serviceHas(...)` to detect the optional-but-supported case.
36
41
  hasConfiguredNameUUIDs = new Set([
37
- ctor.AccessoryInformation.UUID, ctor.ContactSensor.UUID, ctor.InputSource.UUID, ctor.Lightbulb.UUID, ctor.MotionSensor.UUID,
38
- ctor.OccupancySensor.UUID, ctor.SmartSpeaker.UUID, ctor.Switch.UUID, ctor.Television.UUID, ctor.Valve.UUID, ctor.WiFiRouter.UUID
39
- ]);
40
- // Services that require the Name characteristic.
41
- requiresNameUUIDs = new Set([
42
- ctor.AccessoryInformation.UUID, ctor.Assistant.UUID, ctor.InputSource.UUID
43
- ]);
44
- // Services that support the Name characteristic (includes required).
42
+ "AccessoryInformation", "ContactSensor", "InputSource", "Lightbulb", "MotionSensor", "OccupancySensor", "SmartSpeaker", "StatelessProgrammableSwitch", "Switch",
43
+ "Television", "Valve", "WiFiRouter"
44
+ ].map(uuidOf));
45
+ requiresNameUUIDs = new Set(["AccessoryInformation", "Assistant", "InputSource"].map(uuidOf));
45
46
  hasNameUUIDs = new Set([
46
- ctor.AccessoryInformation.UUID, ctor.AirPurifier.UUID, ctor.AirQualitySensor.UUID, ctor.Assistant.UUID, ctor.Battery.UUID,
47
- ctor.CarbonDioxideSensor.UUID, ctor.CarbonMonoxideSensor.UUID, ctor.ContactSensor.UUID, ctor.Door.UUID, ctor.Doorbell.UUID,
48
- ctor.Fan.UUID, ctor.Fanv2.UUID, ctor.Faucet.UUID, ctor.FilterMaintenance.UUID, ctor.GarageDoorOpener.UUID, ctor.HeaterCooler.UUID,
49
- ctor.HumidifierDehumidifier.UUID, ctor.HumiditySensor.UUID, ctor.InputSource.UUID, ctor.IrrigationSystem.UUID, ctor.LeakSensor.UUID,
50
- ctor.Lightbulb.UUID, ctor.LightSensor.UUID, ctor.LockMechanism.UUID, ctor.MotionSensor.UUID, ctor.OccupancySensor.UUID, ctor.Outlet.UUID,
51
- ctor.SecuritySystem.UUID, ctor.Slats.UUID, ctor.SmartSpeaker.UUID, ctor.SmokeSensor.UUID, ctor.StatefulProgrammableSwitch.UUID,
52
- ctor.StatelessProgrammableSwitch.UUID, ctor.Switch.UUID, ctor.TargetControl.UUID, ctor.Television.UUID, ctor.TemperatureSensor.UUID,
53
- ctor.Thermostat.UUID, ctor.Valve.UUID, ctor.Window.UUID, ctor.WindowCovering.UUID
54
- ]);
47
+ "AccessoryInformation", "AirPurifier", "AirQualitySensor", "Assistant", "Battery", "CarbonDioxideSensor", "CarbonMonoxideSensor", "ContactSensor", "Door", "Doorbell",
48
+ "Fan", "Fanv2", "Faucet", "FilterMaintenance", "GarageDoorOpener", "HeaterCooler", "HumidifierDehumidifier", "HumiditySensor", "InputSource", "IrrigationSystem",
49
+ "LeakSensor", "Lightbulb", "LightSensor", "LockMechanism", "MotionSensor", "OccupancySensor", "Outlet", "SecuritySystem", "Slats", "SmartSpeaker", "SmokeSensor",
50
+ "StatefulProgrammableSwitch", "StatelessProgrammableSwitch", "Switch", "TargetControl", "Television", "TemperatureSensor", "Thermostat", "Valve", "Window",
51
+ "WindowCovering"
52
+ ].map(uuidOf));
55
53
  }
56
54
  /**
57
55
  * Utility method that either creates a new service on an accessory if needed, or returns an existing one. Optionally, it executes a callback to initialize a new
58
56
  * service instance. Additionally, the various name characteristics of the service are set to the specified name, and optionally added if necessary.
59
57
  *
58
+ * @typeParam T - The concrete Service subclass being acquired. Inferred from `serviceType` so callers receive the specific subclass type back rather than
59
+ * the wider `Service` type.
60
60
  * @param accessory - The Homebridge accessory to check or modify.
61
- * @param serviceType - The type of service to instantiate or retrieve.
61
+ * @param serviceType - The type of service to instantiate or retrieve. Must be a HAP Service subclass with the standard `(displayName?, subtype?)` constructor;
62
+ * see {@link AcquireServiceTarget}.
62
63
  * @param name - Name to be displayed to the end user for this service.
63
64
  * @param subtype - Optional service subtype to uniquely identify the service.
64
65
  * @param onServiceCreate - Optional callback invoked only when a new service is created, receiving the new service as its argument.
65
66
  *
66
- * @returns Returns the created or retrieved service, or `null` if service creation failed.
67
+ * @returns Returns the created or retrieved service. Construction failures throw rather than returning `null`.
67
68
  *
68
69
  * @remarks
69
70
  * This method ensures that the service's display name and available name characteristics are updated to the specified name. If `onServiceCreate` is provided,
@@ -73,10 +74,11 @@ function initServiceUUIDSets(service) {
73
74
  *
74
75
  * @example
75
76
  * ```typescript
76
- * // Example: Ensure a Lightbulb service exists with a user-friendly name, and initialize it if newly created.
77
- * const lightbulbService = acquireService(accessory, hap.Service.Lightbulb, "Living Room Lamp", undefined, (svc: Service): void => {
77
+ * // Example: Ensure a Lightbulb service exists with a user-friendly name, and initialize it if newly created. The return type is narrowed to `Lightbulb | null`,
78
+ * // so callers can invoke subclass-specific behavior on the result without casts.
79
+ * const lightbulbService = acquireService(accessory, hap.Service.Lightbulb, "Living Room Lamp", undefined, (svc): void => {
78
80
  *
79
- * // Called only if the service is newly created.
81
+ * // Called only if the service is newly created. `svc` is typed as `Lightbulb` here.
80
82
  * svc.setCharacteristic(hap.Characteristic.On, false);
81
83
  * });
82
84
  *
@@ -87,33 +89,33 @@ function initServiceUUIDSets(service) {
87
89
  * }
88
90
  * ```
89
91
  *
90
- * @see setServiceName updates the newly created (or existing) services name-related characteristics.
91
- * @see validService validate or prune services after acquisition.
92
+ * @see setServiceName - updates the newly created (or existing) service's name-related characteristics.
93
+ * @see validService - validate or prune services after acquisition.
92
94
  * @category Accessory
93
95
  */
94
96
  export function acquireService(accessory, serviceType, name, subtype, onServiceCreate) {
95
- // Ensure we have HomeKit approved naming.
96
- name = sanitizeName(name);
97
- // Find the service, if it exists.
98
- let service = subtype ? accessory.getServiceById(serviceType, subtype) : accessory.getService(serviceType);
99
- // Add the service to the accessory, if needed.
97
+ // Sanitize once up front because HomeKit's strict naming rules apply both to the constructor's displayName and to the ConfiguredName / Name characteristics that
98
+ // setServiceName populates - same source string, same validation contract.
99
+ const sanitized = sanitizeName(name);
100
+ // Find the service, if it exists. The cast back to `T` is sound because `getService` / `getServiceById` look up by the constructor's UUID brand, and the only
101
+ // service registered against that UUID is one this function (or a sibling caller using the same constructor) created - i.e., an instance of `T`.
102
+ let service = (subtype ? accessory.getServiceById(serviceType, subtype) : accessory.getService(serviceType));
100
103
  if (!service) {
101
- // WithUUID<typeof Service> types subtype as required, but the constructor handles undefined at runtime.
102
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
103
- service = new serviceType(name, subtype);
104
- // Grab the Characteristic constructor from the instance of our service so we can set the individual characteristics without needing the HAP object directly.
104
+ // The narrow constructor signature in `AcquireServiceTarget<T>` lets us invoke `new serviceType(sanitized, subtype)` directly - no cast, no non-null assertion.
105
+ // The type system expresses what the runtime requires: callers pass a Service subclass with the standard `(displayName?, subtype?)` constructor.
106
+ service = new serviceType(sanitized, subtype);
105
107
  const characteristic = getCharacteristicConstructor(service);
106
- // Add the Configured Name characteristic if we don't already have it and it's available to us.
108
+ // HAP can pre-populate ConfiguredName in a freshly-constructed service's default optional set, so this guard prevents adding it a second time within this single
109
+ // construction. Re-acquisition of an already-existing service is a separate case, already gated by the `!service` check above.
107
110
  if (!serviceRequiresConfiguredName(service) && serviceHasConfiguredName(service) &&
108
111
  !service.optionalCharacteristics.some(x => (x.UUID === characteristic.ConfiguredName.UUID))) {
109
112
  service.addOptionalCharacteristic(characteristic.ConfiguredName);
110
113
  }
111
- // Add the Name characteristic if we don't already have it and it's available to us.
114
+ // Same duplicate-guard rationale as the ConfiguredName check above, applied to the Name characteristic.
112
115
  if (!serviceRequiresName(service) && serviceHasName(service) && !service.optionalCharacteristics.some(x => (x.UUID === characteristic.Name.UUID))) {
113
116
  service.addOptionalCharacteristic(characteristic.Name);
114
117
  }
115
- // Set our name.
116
- setServiceName(service, name);
118
+ setServiceName(service, sanitized);
117
119
  accessory.addService(service);
118
120
  if (onServiceCreate) {
119
121
  onServiceCreate(service);
@@ -151,22 +153,46 @@ export function acquireService(accessory, serviceType, name, subtype, onServiceC
151
153
  * validService(accessory, Service.Switch, (hasService) => hasService || config.enableSwitch);
152
154
  * ```
153
155
  *
154
- * @see acquireService to add or retrieve services.
156
+ * @see acquireService - to add or retrieve services.
155
157
  * @category Accessory
156
158
  */
157
159
  export function validService(accessory, serviceType, validate, subtype) {
158
- // Find the service, if it exists.
159
160
  const service = subtype ? accessory.getServiceById(serviceType, subtype) : accessory.getService(serviceType);
160
- // Validate whether we should have the service. If not, remove it.
161
+ // Resolve `validate` against the current presence and remove the service when the validator votes false. The function-form receives the actual presence boolean so
162
+ // callers can express add-if-missing semantics like `(has) => has || config.enableSwitch`.
161
163
  if (!((typeof validate === "function") ? validate(!!service) : validate)) {
162
164
  if (service) {
163
165
  accessory.removeService(service);
164
166
  }
165
167
  return false;
166
168
  }
167
- // We have a valid service.
168
169
  return true;
169
170
  }
171
+ /**
172
+ * Build a `validService` predicate for a service gated on a hardware capability and a user toggle, applying an additive-eager / subtractive-conservative asymmetry
173
+ * between the two: the user `toggle` is absolute - when false, the service is removed - while the hardware `capability` is conservative - an existing service is kept
174
+ * through a transient capability-false, and a new service is created only when the capability reports.
175
+ *
176
+ * @param options - The `capability` and `toggle` inputs for the gate.
177
+ *
178
+ * @returns A `validService` function-form predicate, `(hasService) => toggle && (hasService || capability)`.
179
+ *
180
+ * @remarks
181
+ * Pass the result as `validService`'s `validate` argument. The asymmetry keeps a capability-gated service from being removed during a transient window in which the
182
+ * device under-reports its capability, while still honoring a user who disables the service. A service with no user toggle should gate on its capability directly.
183
+ *
184
+ * @example
185
+ * ```typescript
186
+ * // Keep the service while its user toggle is on, add it when the capability reports, and keep an existing one through a transient capability-false.
187
+ * validService(accessory, Service.Switch, capabilityGate({ capability: deviceReportsFeature, toggle: config.enableSwitch }));
188
+ * ```
189
+ *
190
+ * @see validService - consumes the returned predicate.
191
+ * @category Accessory
192
+ */
193
+ export function capabilityGate({ capability, toggle }) {
194
+ return hasService => toggle && (hasService || capability);
195
+ }
170
196
  /**
171
197
  * Determines whether the specified service type requires the ConfiguredName characteristic.
172
198
  *
@@ -183,7 +209,7 @@ function serviceRequiresConfiguredName(service) {
183
209
  * Determines whether the specified service type supports the ConfiguredName characteristic.
184
210
  *
185
211
  * @param service - The service instance to check.
186
- * @returns `true` if the service type needs the ConfiguredName characteristic maintained.
212
+ * @returns `true` if the service type supports the ConfiguredName characteristic.
187
213
  *
188
214
  * @internal
189
215
  */
@@ -207,7 +233,7 @@ function serviceRequiresName(service) {
207
233
  * Determines whether the specified service type supports the Name characteristic.
208
234
  *
209
235
  * @param service - The service instance to check.
210
- * @returns `true` if the service type needs the Name characteristic maintained.
236
+ * @returns `true` if the service type supports the Name characteristic.
211
237
  *
212
238
  * @internal
213
239
  */
@@ -216,22 +242,26 @@ function serviceHasName(service) {
216
242
  return hasNameUUIDs?.has(service.UUID) ?? false;
217
243
  }
218
244
  /**
219
- * Retrieves the primary name of a service, preferring the ConfiguredName characteristic over the Name characteristic.
245
+ * Retrieves the primary name of a service, preferring the ConfiguredName characteristic over the Name characteristic. This is a pure read - it never mutates the
246
+ * service.
220
247
  *
221
248
  * @param service - The service from which to retrieve the name.
222
- * @returns The configured or display name of the service, or `undefined` if neither is set.
249
+ * @returns The configured or display name of the service, or `undefined` if neither characteristic is present or set.
223
250
  *
224
- * @see setServiceName to update the current name n a service.
251
+ * @see setServiceName - to update the current name on a service.
225
252
  * @category Accessory
226
253
  */
227
254
  export function getServiceName(service) {
228
- // No service, we're done.
229
255
  if (!service) {
230
256
  return undefined;
231
257
  }
232
- // Grab the Characteristic constructor from the instance of our service so we can set the individual characteristics without needing the HAP object directly.
233
258
  const characteristic = getCharacteristicConstructor(service);
234
- return (service.getCharacteristic(characteristic.ConfiguredName).value ?? service.getCharacteristic(characteristic.Name).value ?? undefined);
259
+ // HAP's `getCharacteristic` is get-or-create: asking for a characteristic the service does not have constructs it, attaches it to the service, and (for types
260
+ // outside the service's optional set) logs an "Adding anyway." warning. A name lookup must stay read-only, so we gate each read behind `testCharacteristic` - a
261
+ // pure existence check - and read a value only when the characteristic is already present. ConfiguredName takes precedence over Name.
262
+ const configuredName = service.testCharacteristic(characteristic.ConfiguredName) ? service.getCharacteristic(characteristic.ConfiguredName).value : undefined;
263
+ const name = service.testCharacteristic(characteristic.Name) ? service.getCharacteristic(characteristic.Name).value : undefined;
264
+ return (configuredName ?? name ?? undefined);
235
265
  }
236
266
  /**
237
267
  * Updates the displayName and applicable name characteristics of a service to the specified value.
@@ -243,22 +273,19 @@ export function getServiceName(service) {
243
273
  * This function ensures the name is validated, updates the service's `displayName`, and sets the `ConfiguredName` and `Name`
244
274
  * characteristics when supported by the service type.
245
275
  *
246
- * @see acquireService to add or retrieve services.
247
- * @see getServiceName to retrieve the current name set on a service.
276
+ * @see acquireService - to add or retrieve services.
277
+ * @see getServiceName - to retrieve the current name set on a service.
248
278
  * @category Accessory
249
279
  */
250
280
  export function setServiceName(service, name) {
251
- // Grab the Characteristic constructor from the instance of our service so we can set the individual characteristics without needing the HAP object directly.
252
281
  const characteristic = getCharacteristicConstructor(service);
253
- // Ensure we have HomeKit approved naming.
254
- name = sanitizeName(name);
255
- // Update our name.
256
- service.displayName = name;
282
+ const sanitized = sanitizeName(name);
283
+ service.displayName = sanitized;
257
284
  if (serviceHasConfiguredName(service)) {
258
- service.updateCharacteristic(characteristic.ConfiguredName, name);
285
+ service.updateCharacteristic(characteristic.ConfiguredName, sanitized);
259
286
  }
260
287
  if (serviceHasName(service)) {
261
- service.updateCharacteristic(characteristic.Name, name);
288
+ service.updateCharacteristic(characteristic.Name, sanitized);
262
289
  }
263
290
  }
264
291
  //# sourceMappingURL=service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAiB,YAAY,EAAE,MAAM,WAAW,CAAC;AAExD,8EAA8E;A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