@camstack/addon-provider-bosch 0.0.0-stage → 0.1.2

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.
Binary file
Binary file
@@ -0,0 +1,50 @@
1
+ const require_dist = require("./dist-DvEvuaoA.js");
2
+ //#region src/shared/account-integration-cascade.ts
3
+ async function cascadeRemoveDevicesForIntegration(input) {
4
+ const { reg, devices, addonId, system, integrationId, logger } = input;
5
+ let removed = 0;
6
+ for (const d of reg.getAllForAddon(addonId)) {
7
+ if (d.parentDeviceId !== null) continue;
8
+ const cfg = await devices.loadConfig(d.id).catch(() => ({}));
9
+ if (cfg["system"] !== system || cfg["brokerId"] !== integrationId) continue;
10
+ try {
11
+ await devices.remove(d.id);
12
+ removed += 1;
13
+ } catch (err) {
14
+ logger.warn(`${system}: integration cascade-remove failed`, {
15
+ tags: { deviceId: d.id },
16
+ meta: {
17
+ integrationId,
18
+ error: require_dist.errMsg(err)
19
+ }
20
+ });
21
+ }
22
+ }
23
+ return removed;
24
+ }
25
+ //#endregion
26
+ //#region src/shared/account-integration-offline.ts
27
+ function setIntegrationDevicesOnline(devices, system, integrationId, online) {
28
+ let count = 0;
29
+ for (const dev of devices) {
30
+ if (dev.config.get("system") !== system) continue;
31
+ if (dev.config.get("brokerId") !== integrationId) continue;
32
+ if (dev.online === online) continue;
33
+ dev.markOnline(online);
34
+ count += 1;
35
+ }
36
+ return count;
37
+ }
38
+ //#endregion
39
+ Object.defineProperty(exports, "cascadeRemoveDevicesForIntegration", {
40
+ enumerable: true,
41
+ get: function() {
42
+ return cascadeRemoveDevicesForIntegration;
43
+ }
44
+ });
45
+ Object.defineProperty(exports, "setIntegrationDevicesOnline", {
46
+ enumerable: true,
47
+ get: function() {
48
+ return setIntegrationDevicesOnline;
49
+ }
50
+ });
@@ -0,0 +1,39 @@
1
+ import { v as errMsg } from "./dist-BoMB3-eL.mjs";
2
+ //#region src/shared/account-integration-cascade.ts
3
+ async function cascadeRemoveDevicesForIntegration(input) {
4
+ const { reg, devices, addonId, system, integrationId, logger } = input;
5
+ let removed = 0;
6
+ for (const d of reg.getAllForAddon(addonId)) {
7
+ if (d.parentDeviceId !== null) continue;
8
+ const cfg = await devices.loadConfig(d.id).catch(() => ({}));
9
+ if (cfg["system"] !== system || cfg["brokerId"] !== integrationId) continue;
10
+ try {
11
+ await devices.remove(d.id);
12
+ removed += 1;
13
+ } catch (err) {
14
+ logger.warn(`${system}: integration cascade-remove failed`, {
15
+ tags: { deviceId: d.id },
16
+ meta: {
17
+ integrationId,
18
+ error: errMsg(err)
19
+ }
20
+ });
21
+ }
22
+ }
23
+ return removed;
24
+ }
25
+ //#endregion
26
+ //#region src/shared/account-integration-offline.ts
27
+ function setIntegrationDevicesOnline(devices, system, integrationId, online) {
28
+ let count = 0;
29
+ for (const dev of devices) {
30
+ if (dev.config.get("system") !== system) continue;
31
+ if (dev.config.get("brokerId") !== integrationId) continue;
32
+ if (dev.online === online) continue;
33
+ dev.markOnline(online);
34
+ count += 1;
35
+ }
36
+ return count;
37
+ }
38
+ //#endregion
39
+ export { cascadeRemoveDevicesForIntegration as n, setIntegrationDevicesOnline as t };