@fastybird/smart-panel-backend 1.1.0-alpha.40 → 1.1.0-alpha.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.module.js +1 -1
- package/dist/app.module.js.map +1 -1
- package/dist/common/utils/cancellable-exec.utils.d.ts +5 -0
- package/dist/common/utils/cancellable-exec.utils.js +34 -0
- package/dist/common/utils/cancellable-exec.utils.js.map +1 -0
- package/dist/common/utils/remote-access-observation.utils.d.ts +11 -0
- package/dist/common/utils/remote-access-observation.utils.js +89 -0
- package/dist/common/utils/remote-access-observation.utils.js.map +1 -0
- package/dist/modules/auth/auth.module.js +4 -0
- package/dist/modules/auth/auth.module.js.map +1 -1
- package/dist/modules/auth/guards/auth.guard.js +8 -13
- package/dist/modules/auth/guards/auth.guard.js.map +1 -1
- package/dist/modules/auth/services/token-metadata.service.d.ts +42 -0
- package/dist/modules/auth/services/token-metadata.service.js +202 -0
- package/dist/modules/auth/services/token-metadata.service.js.map +1 -0
- package/dist/modules/auth/services/token-usage.service.d.ts +22 -0
- package/dist/modules/auth/services/token-usage.service.js +93 -0
- package/dist/modules/auth/services/token-usage.service.js.map +1 -0
- package/dist/modules/auth/services/tokens.service.d.ts +8 -2
- package/dist/modules/auth/services/tokens.service.js +16 -10
- package/dist/modules/auth/services/tokens.service.js.map +1 -1
- package/dist/modules/devices/devices.module.js +7 -0
- package/dist/modules/devices/devices.module.js.map +1 -1
- package/dist/modules/devices/dto/property-command.dto.js +2 -8
- package/dist/modules/devices/dto/property-command.dto.js.map +1 -1
- package/dist/modules/devices/services/device-command-graph.service.d.ts +18 -0
- package/dist/modules/devices/services/device-command-graph.service.js +92 -0
- package/dist/modules/devices/services/device-command-graph.service.js.map +1 -0
- package/dist/modules/devices/services/devices.service.js +2 -17
- package/dist/modules/devices/services/devices.service.js.map +1 -1
- package/dist/modules/devices/services/property-command-dispatch.service.d.ts +5 -3
- package/dist/modules/devices/services/property-command-dispatch.service.js +15 -12
- package/dist/modules/devices/services/property-command-dispatch.service.js.map +1 -1
- package/dist/modules/devices/services/property-command.service.d.ts +7 -5
- package/dist/modules/devices/services/property-command.service.js +41 -20
- package/dist/modules/devices/services/property-command.service.js.map +1 -1
- package/dist/modules/devices/services/property-metadata.service.d.ts +9 -2
- package/dist/modules/devices/services/property-metadata.service.js +67 -17
- package/dist/modules/devices/services/property-metadata.service.js.map +1 -1
- package/dist/modules/devices/utils/device-graph-query.utils.d.ts +3 -0
- package/dist/modules/devices/utils/device-graph-query.utils.js +23 -0
- package/dist/modules/devices/utils/device-graph-query.utils.js.map +1 -0
- package/dist/modules/devices/validators/property-command-target-constraint.validator.d.ts +9 -0
- package/dist/modules/devices/validators/property-command-target-constraint.validator.js +58 -0
- package/dist/modules/devices/validators/property-command-target-constraint.validator.js.map +1 -0
- package/dist/modules/remote-access/controllers/remote-access.controller.js +9 -5
- package/dist/modules/remote-access/controllers/remote-access.controller.js.map +1 -1
- package/dist/modules/remote-access/models/provider.model.d.ts +3 -0
- package/dist/modules/remote-access/models/provider.model.js +23 -0
- package/dist/modules/remote-access/models/provider.model.js.map +1 -1
- package/dist/modules/remote-access/models/status.model.d.ts +2 -0
- package/dist/modules/remote-access/models/status.model.js +18 -1
- package/dist/modules/remote-access/models/status.model.js.map +1 -1
- package/dist/modules/remote-access/models/urls.model.d.ts +2 -0
- package/dist/modules/remote-access/models/urls.model.js +17 -0
- package/dist/modules/remote-access/models/urls.model.js.map +1 -1
- package/dist/modules/remote-access/platforms/remote-access-provider.platform.d.ts +18 -1
- package/dist/modules/remote-access/remote-access.constants.d.ts +2 -1
- package/dist/modules/remote-access/remote-access.constants.js +2 -1
- package/dist/modules/remote-access/remote-access.constants.js.map +1 -1
- package/dist/modules/remote-access/services/remote-access-proxy-contribution.service.d.ts +1 -0
- package/dist/modules/remote-access/services/remote-access-proxy-contribution.service.js +4 -1
- package/dist/modules/remote-access/services/remote-access-proxy-contribution.service.js.map +1 -1
- package/dist/modules/remote-access/services/remote-access-status.service.d.ts +40 -8
- package/dist/modules/remote-access/services/remote-access-status.service.js +314 -65
- package/dist/modules/remote-access/services/remote-access-status.service.js.map +1 -1
- package/dist/modules/remote-access/services/remote-access-url.service.d.ts +2 -2
- package/dist/modules/remote-access/services/remote-access-url.service.js +4 -2
- package/dist/modules/remote-access/services/remote-access-url.service.js.map +1 -1
- package/dist/modules/spaces/services/module-reset.service.d.ts +5 -1
- package/dist/modules/spaces/services/module-reset.service.js +10 -2
- package/dist/modules/spaces/services/module-reset.service.js.map +1 -1
- package/dist/modules/spaces/services/space-activity.service.d.ts +14 -0
- package/dist/modules/spaces/services/space-activity.service.js +56 -0
- package/dist/modules/spaces/services/space-activity.service.js.map +1 -0
- package/dist/modules/spaces/spaces.module.js +5 -0
- package/dist/modules/spaces/spaces.module.js.map +1 -1
- package/dist/modules/spaces/subscribers/space-activity.subscriber.d.ts +17 -0
- package/dist/modules/spaces/subscribers/space-activity.subscriber.js +89 -0
- package/dist/modules/spaces/subscribers/space-activity.subscriber.js.map +1 -0
- package/dist/modules/websocket/gateway/websocket.gateway.js +1 -0
- package/dist/modules/websocket/gateway/websocket.gateway.js.map +1 -1
- package/dist/modules/websocket/services/ws-auth.service.js +12 -28
- package/dist/modules/websocket/services/ws-auth.service.js.map +1 -1
- package/dist/plugins/devices-virtual/platforms/virtual-device.platform.d.ts +3 -8
- package/dist/plugins/devices-virtual/platforms/virtual-device.platform.js +6 -36
- package/dist/plugins/devices-virtual/platforms/virtual-device.platform.js.map +1 -1
- package/dist/plugins/remote-access-cloudflare-tunnel/controllers/setup.controller.d.ts +5 -3
- package/dist/plugins/remote-access-cloudflare-tunnel/controllers/setup.controller.js +20 -8
- package/dist/plugins/remote-access-cloudflare-tunnel/controllers/setup.controller.js.map +1 -1
- package/dist/plugins/remote-access-cloudflare-tunnel/controllers/status.controller.d.ts +3 -5
- package/dist/plugins/remote-access-cloudflare-tunnel/controllers/status.controller.js +11 -10
- package/dist/plugins/remote-access-cloudflare-tunnel/controllers/status.controller.js.map +1 -1
- package/dist/plugins/remote-access-cloudflare-tunnel/models/status.model.d.ts +2 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/models/status.model.js +17 -0
- package/dist/plugins/remote-access-cloudflare-tunnel/models/status.model.js.map +1 -1
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-managed.service.d.ts +20 -2
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-managed.service.js +105 -48
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-managed.service.js.map +1 -1
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-provider.service.d.ts +13 -1
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-provider.service.js +8 -2
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflare-tunnel-provider.service.js.map +1 -1
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-cli.service.d.ts +1 -1
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-cli.service.js +12 -24
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-cli.service.js.map +1 -1
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-metrics.service.d.ts +1 -1
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-metrics.service.js +5 -2
- package/dist/plugins/remote-access-cloudflare-tunnel/services/cloudflared-metrics.service.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/controllers/setup.controller.d.ts +10 -5
- package/dist/plugins/remote-access-tailscale/controllers/setup.controller.js +105 -15
- package/dist/plugins/remote-access-tailscale/controllers/setup.controller.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/controllers/status.controller.d.ts +5 -4
- package/dist/plugins/remote-access-tailscale/controllers/status.controller.js +19 -9
- package/dist/plugins/remote-access-tailscale/controllers/status.controller.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/models/status.model.d.ts +16 -0
- package/dist/plugins/remote-access-tailscale/models/status.model.js +100 -1
- package/dist/plugins/remote-access-tailscale/models/status.model.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.constants.d.ts +2 -0
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.constants.js +3 -1
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.constants.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.exceptions.d.ts +17 -1
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.exceptions.js +33 -1
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.exceptions.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.openapi.d.ts +2 -2
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.openapi.js +1 -0
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.openapi.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.plugin.js +2 -0
- package/dist/plugins/remote-access-tailscale/remote-access-tailscale.plugin.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-cli.service.d.ts +8 -4
- package/dist/plugins/remote-access-tailscale/services/tailscale-cli.service.js +58 -14
- package/dist/plugins/remote-access-tailscale/services/tailscale-cli.service.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-login.service.d.ts +8 -3
- package/dist/plugins/remote-access-tailscale/services/tailscale-login.service.js +175 -151
- package/dist/plugins/remote-access-tailscale/services/tailscale-login.service.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-node-managed.service.d.ts +51 -7
- package/dist/plugins/remote-access-tailscale/services/tailscale-node-managed.service.js +481 -101
- package/dist/plugins/remote-access-tailscale/services/tailscale-node-managed.service.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-operation-coordinator.service.d.ts +33 -0
- package/dist/plugins/remote-access-tailscale/services/tailscale-operation-coordinator.service.js +167 -0
- package/dist/plugins/remote-access-tailscale/services/tailscale-operation-coordinator.service.js.map +1 -0
- package/dist/plugins/remote-access-tailscale/services/tailscale-provider.service.d.ts +13 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-provider.service.js +8 -2
- package/dist/plugins/remote-access-tailscale/services/tailscale-provider.service.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-serve.service.d.ts +1 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-serve.service.js +7 -6
- package/dist/plugins/remote-access-tailscale/services/tailscale-serve.service.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/services/tailscale-setup.service.d.ts +1 -3
- package/dist/plugins/remote-access-tailscale/services/tailscale-setup.service.js +9 -11
- package/dist/plugins/remote-access-tailscale/services/tailscale-setup.service.js.map +1 -1
- package/dist/plugins/remote-access-tailscale/utils/tailscale-control.utils.d.ts +5 -0
- package/dist/plugins/remote-access-tailscale/utils/tailscale-control.utils.js +36 -0
- package/dist/plugins/remote-access-tailscale/utils/tailscale-control.utils.js.map +1 -0
- package/dist/plugins/spaces-home-control/listeners/space-activity.listener.d.ts +6 -7
- package/dist/plugins/spaces-home-control/listeners/space-activity.listener.js +19 -44
- package/dist/plugins/spaces-home-control/listeners/space-activity.listener.js.map +1 -1
- package/dist/plugins/spaces-home-control/listeners/space-climate-state.listener.d.ts +4 -4
- package/dist/plugins/spaces-home-control/listeners/space-climate-state.listener.js +9 -22
- package/dist/plugins/spaces-home-control/listeners/space-climate-state.listener.js.map +1 -1
- package/dist/plugins/spaces-home-control/listeners/space-lighting-state.listener.d.ts +4 -4
- package/dist/plugins/spaces-home-control/listeners/space-lighting-state.listener.js +9 -22
- package/dist/plugins/spaces-home-control/listeners/space-lighting-state.listener.js.map +1 -1
- package/dist/plugins/spaces-home-control/listeners/space-sensor-state.listener.d.ts +4 -4
- package/dist/plugins/spaces-home-control/listeners/space-sensor-state.listener.js +9 -22
- package/dist/plugins/spaces-home-control/listeners/space-sensor-state.listener.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/space-climate-state.service.d.ts +3 -5
- package/dist/plugins/spaces-home-control/services/space-climate-state.service.js +9 -12
- package/dist/plugins/spaces-home-control/services/space-climate-state.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/space-lighting-state.service.d.ts +3 -5
- package/dist/plugins/spaces-home-control/services/space-lighting-state.service.js +7 -10
- package/dist/plugins/spaces-home-control/services/space-lighting-state.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/space-sensor-state.service.d.ts +3 -5
- package/dist/plugins/spaces-home-control/services/space-sensor-state.service.js +7 -10
- package/dist/plugins/spaces-home-control/services/space-sensor-state.service.js.map +1 -1
- package/dist/plugins/spaces-home-control/services/space-state-read.service.d.ts +47 -0
- package/dist/plugins/spaces-home-control/services/space-state-read.service.js +262 -0
- package/dist/plugins/spaces-home-control/services/space-state-read.service.js.map +1 -0
- package/dist/plugins/spaces-home-control/spaces-home-control.plugin.js +4 -0
- package/dist/plugins/spaces-home-control/spaces-home-control.plugin.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tailscale-setup.service.js","sourceRoot":"","sources":["../../../../src/plugins/remote-access-tailscale/services/tailscale-setup.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2BAA2C;AAC3C,4CAAoB;AACpB,+BAA4B;AAE5B,2CAA4C;AAC5C,2CAAoE;AACpE,yDAAsD;AAEtD,mDAA+D;AAC/D,qEAAiE;AACjE,oFAAgF;AAChF,
|
|
1
|
+
{"version":3,"file":"tailscale-setup.service.js","sourceRoot":"","sources":["../../../../src/plugins/remote-access-tailscale/services/tailscale-setup.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2BAA2C;AAC3C,4CAAoB;AACpB,+BAA4B;AAE5B,2CAA4C;AAC5C,2CAAoE;AACpE,yDAAsD;AAEtD,mDAA+D;AAC/D,qEAAiE;AACjE,oFAAgF;AAChF,0FAAsF;AACtF,oGAA4G;AAC5G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CAAC,CAAC;YAE/D,OAAO;QACR,CAAC;QAED,MAAM,IAAI,CAAC,kBAAkB,CAAC,oBAAoB,EAAE,CAAC;IACtD,CAAC;IAEO,SAAS,CAAC,GAAW;QAC5B,IAAI,CAAC,IAAA,eAAU,EAAC,GAAG,CAAC,EAAE,CAAC;YACtB,IAAA,cAAS,EAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;CACD,CAAA;AA9MY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAUwB,mDAAuB;QACtB,sBAAiB;QAChB,4DAA2B;QACjC,6BAAa;QACV,kCAAe;QACjB,8BAAa;GAdlC,qBAAqB,CA8MjC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RemoteAccessProviderState } from '../../../modules/remote-access/platforms/remote-access-provider.platform';
|
|
2
|
+
import { UserRole } from '../../../modules/users/users.constants';
|
|
3
|
+
import { RemoteAccessTailscalePluginControlModel } from '../models/status.model';
|
|
4
|
+
import { TailscaleRequirement } from '../services/tailscale-node-managed.service';
|
|
5
|
+
export declare function buildTailscaleControlModel(control: Omit<RemoteAccessTailscalePluginControlModel, 'availableActions'>, state: RemoteAccessProviderState, requirements: TailscaleRequirement[], role: UserRole | undefined): RemoteAccessTailscalePluginControlModel;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildTailscaleControlModel = buildTailscaleControlModel;
|
|
4
|
+
const users_constants_1 = require("../../../modules/users/users.constants");
|
|
5
|
+
const status_model_1 = require("../models/status.model");
|
|
6
|
+
function buildTailscaleControlModel(control, state, requirements, role) {
|
|
7
|
+
const result = Object.assign(new status_model_1.RemoteAccessTailscalePluginControlModel(), control);
|
|
8
|
+
result.availableActions = [];
|
|
9
|
+
if (role !== users_constants_1.UserRole.ADMIN && role !== users_constants_1.UserRole.OWNER) {
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
const stopping = control.operation === 'disconnect' || control.operation === 'shutdown' || control.operation === 'reset';
|
|
13
|
+
if (!stopping && (control.serviceState !== 'stopped' || control.operation !== null)) {
|
|
14
|
+
result.availableActions.push('disconnect');
|
|
15
|
+
}
|
|
16
|
+
if (!control.enabled || control.operation !== null || control.serviceState === 'stopping') {
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
const ready = requirements.length > 0 && requirements.every((requirement) => requirement.satisfied);
|
|
20
|
+
if (!ready) {
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
if (control.authentication === 'authenticated') {
|
|
24
|
+
if (state !== 'connected' && state !== 'connecting' && state !== 'pending-approval') {
|
|
25
|
+
result.availableActions.push('connect');
|
|
26
|
+
}
|
|
27
|
+
if (role === users_constants_1.UserRole.OWNER) {
|
|
28
|
+
result.availableActions.push('logout', 'reset-preferences');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
result.availableActions.push('login');
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=tailscale-control.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailscale-control.utils.js","sourceRoot":"","sources":["../../../../src/plugins/remote-access-tailscale/utils/tailscale-control.utils.ts"],"names":[],"mappings":";;AAMA,gEA6CC;AAlDD,4EAAkE;AAClE,yDAAiF;AAIjF,SAAgB,0BAA0B,CACzC,OAA0E,EAC1E,KAAgC,EAChC,YAAoC,EACpC,IAA0B;IAE1B,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,sDAAuC,EAAE,EAAE,OAAO,CAAC,CAAC;IACrF,MAAM,CAAC,gBAAgB,GAAG,EAAE,CAAC;IAE7B,IAAI,IAAI,KAAK,0BAAQ,CAAC,KAAK,IAAI,IAAI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,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
2
1
|
import { OnModuleInit } from '@nestjs/common';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { ChannelPropertyEntity } from '../../../modules/devices/entities/devices.entity';
|
|
3
|
+
import { PropertyMetadataService } from '../../../modules/devices/services/property-metadata.service';
|
|
4
|
+
import { SpaceActivityService } from '../../../modules/spaces/services/space-activity.service';
|
|
5
5
|
export declare class SpaceActivityListener implements OnModuleInit {
|
|
6
|
-
private readonly
|
|
7
|
-
private readonly
|
|
6
|
+
private readonly propertyMetadata;
|
|
7
|
+
private readonly activity;
|
|
8
8
|
private readonly logger;
|
|
9
|
-
constructor(
|
|
9
|
+
constructor(propertyMetadata: PropertyMetadataService, activity: SpaceActivityService);
|
|
10
10
|
onModuleInit(): void;
|
|
11
11
|
handlePropertyUpdated(property: ChannelPropertyEntity): Promise<void>;
|
|
12
|
-
private updateSpaceActivity;
|
|
13
12
|
}
|
|
@@ -8,68 +8,45 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.SpaceActivityListener = void 0;
|
|
16
|
-
const typeorm_1 = require("typeorm");
|
|
17
13
|
const common_1 = require("@nestjs/common");
|
|
18
14
|
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
19
|
-
const typeorm_2 = require("@nestjs/typeorm");
|
|
20
15
|
const logger_1 = require("../../../common/logger");
|
|
21
16
|
const devices_constants_1 = require("../../../modules/devices/devices.constants");
|
|
22
17
|
const devices_entity_1 = require("../../../modules/devices/entities/devices.entity");
|
|
23
|
-
const
|
|
18
|
+
const property_metadata_service_1 = require("../../../modules/devices/services/property-metadata.service");
|
|
19
|
+
const space_activity_service_1 = require("../../../modules/spaces/services/space-activity.service");
|
|
24
20
|
const spaces_constants_1 = require("../../../modules/spaces/spaces.constants");
|
|
25
21
|
let SpaceActivityListener = class SpaceActivityListener {
|
|
26
|
-
constructor(
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
22
|
+
constructor(propertyMetadata, activity) {
|
|
23
|
+
this.propertyMetadata = propertyMetadata;
|
|
24
|
+
this.activity = activity;
|
|
29
25
|
this.logger = (0, logger_1.createExtensionLogger)(spaces_constants_1.SPACES_MODULE_NAME, 'SpaceActivityListener');
|
|
30
26
|
}
|
|
31
27
|
onModuleInit() {
|
|
32
28
|
this.logger.debug('Space activity listener initialized');
|
|
33
29
|
}
|
|
34
30
|
async handlePropertyUpdated(property) {
|
|
31
|
+
const observedAt = new Date();
|
|
32
|
+
const generation = this.activity.getGeneration();
|
|
35
33
|
try {
|
|
36
|
-
|
|
34
|
+
if (!property.id)
|
|
35
|
+
return;
|
|
36
|
+
const metadata = await this.propertyMetadata.findOne(property.id);
|
|
37
|
+
const channel = metadata?.channel;
|
|
38
|
+
if (!channel || typeof channel === 'string')
|
|
39
|
+
return;
|
|
40
|
+
const device = channel.device;
|
|
41
|
+
if (!device || typeof device === 'string' || !device.roomId)
|
|
42
|
+
return;
|
|
43
|
+
this.activity.record(device.roomId, observedAt, generation);
|
|
37
44
|
}
|
|
38
45
|
catch (error) {
|
|
39
46
|
const err = error;
|
|
40
47
|
this.logger.warn(`Failed to update space activity on property update: ${err.message}`, err.stack);
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
|
-
async updateSpaceActivity(property) {
|
|
44
|
-
const channelId = typeof property.channel === 'string' ? property.channel : property.channel?.id;
|
|
45
|
-
if (!channelId) {
|
|
46
|
-
this.logger.debug('Property has no channel, skipping activity update');
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const channel = await this.channelRepository
|
|
50
|
-
.createQueryBuilder('channel')
|
|
51
|
-
.innerJoinAndSelect('channel.device', 'device')
|
|
52
|
-
.where('channel.id = :channelId', { channelId })
|
|
53
|
-
.andWhere('device.roomId IS NOT NULL')
|
|
54
|
-
.getOne();
|
|
55
|
-
if (!channel) {
|
|
56
|
-
this.logger.debug('Channel not found or device has no room, skipping activity update');
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const device = channel.device;
|
|
60
|
-
if (!device.roomId) {
|
|
61
|
-
this.logger.debug('Device has no room, skipping activity update');
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const now = new Date();
|
|
65
|
-
await this.spaceRepository
|
|
66
|
-
.createQueryBuilder()
|
|
67
|
-
.update()
|
|
68
|
-
.set({ lastActivityAt: now })
|
|
69
|
-
.where('id = :roomId', { roomId: device.roomId })
|
|
70
|
-
.execute();
|
|
71
|
-
this.logger.debug(`Updated lastActivityAt for room=${device.roomId} to ${now.toISOString()}`);
|
|
72
|
-
}
|
|
73
50
|
};
|
|
74
51
|
exports.SpaceActivityListener = SpaceActivityListener;
|
|
75
52
|
__decorate([
|
|
@@ -81,9 +58,7 @@ __decorate([
|
|
|
81
58
|
], SpaceActivityListener.prototype, "handlePropertyUpdated", null);
|
|
82
59
|
exports.SpaceActivityListener = SpaceActivityListener = __decorate([
|
|
83
60
|
(0, common_1.Injectable)(),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
__metadata("design:paramtypes", [typeorm_1.Repository,
|
|
87
|
-
typeorm_1.Repository])
|
|
61
|
+
__metadata("design:paramtypes", [property_metadata_service_1.PropertyMetadataService,
|
|
62
|
+
space_activity_service_1.SpaceActivityService])
|
|
88
63
|
], SpaceActivityListener);
|
|
89
64
|
//# sourceMappingURL=space-activity.listener.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space-activity.listener.js","sourceRoot":"","sources":["../../../../src/plugins/spaces-home-control/listeners/space-activity.listener.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"space-activity.listener.js","sourceRoot":"","sources":["../../../../src/plugins/spaces-home-control/listeners/space-activity.listener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA0D;AAC1D,yDAAgD;AAEhD,mDAA+D;AAC/D,kFAA2F;AAC3F,qFAAyF;AACzF,2GAAsG;AACtG,oGAA+F;AAC/F,+EAA8E;AAGvE,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAGjC,YACkB,gBAAyC,EACzC,QAA8B;QAD9B,qBAAgB,GAAhB,gBAAgB,CAAyB;QACzC,aAAQ,GAAR,QAAQ,CAAsB;QAJ/B,WAAM,GAAG,IAAA,8BAAqB,EAAC,qCAAkB,EAAE,uBAAuB,CAAC,CAAC;IAK1F,CAAC;IAEJ,YAAY;QACX,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAC1D,CAAC;IAIK,AAAN,KAAK,CAAC,qBAAqB,CAAC,QAA+B;QAC1D,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC;QACjD,IAAI,CAAC;YACJ,IAAI,CAAC,QAAQ,CAAC,EAAE;gBAAE,OAAO;YAGzB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAClE,MAAM,OAAO,GAAG,QAAQ,EAAE,OAAO,CAAC;YAClC,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ;gBAAE,OAAO;YACpD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC9B,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,MAAM;gBAAE,OAAO;YACpE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,GAAG,GAAG,KAAc,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uDAAuD,GAAG,CAAC,OAAO,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;QACnG,CAAC;IACF,CAAC;CACD,CAAA;AAhCY,sDAAqB;AAc3B;IAFL,IAAA,uBAAO,EAAC,6BAAgB,CAAC,wBAAwB,CAAC;IAClD,IAAA,uBAAO,EAAC,6BAAgB,CAAC,0BAA0B,CAAC;;qCACf,sCAAqB;;kEAiB1D;gCA/BW,qBAAqB;IADjC,IAAA,mBAAU,GAAE;qCAKwB,mDAAuB;QAC/B,6CAAoB;GALpC,qBAAqB,CAgCjC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
2
1
|
import { OnModuleDestroy, OnModuleInit } from '@nestjs/common';
|
|
3
2
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
4
|
-
import {
|
|
3
|
+
import { ChannelPropertyEntity } from '../../../modules/devices/entities/devices.entity';
|
|
4
|
+
import { PropertyMetadataService } from '../../../modules/devices/services/property-metadata.service';
|
|
5
5
|
import { SpaceClimateStateService } from '../services/space-climate-state.service';
|
|
6
6
|
export declare class SpaceClimateStateListener implements OnModuleInit, OnModuleDestroy {
|
|
7
|
-
private readonly
|
|
7
|
+
private readonly propertyMetadata;
|
|
8
8
|
private readonly climateStateService;
|
|
9
9
|
private readonly eventEmitter;
|
|
10
10
|
private readonly logger;
|
|
11
11
|
private readonly debounceTimers;
|
|
12
|
-
constructor(
|
|
12
|
+
constructor(propertyMetadata: PropertyMetadataService, climateStateService: SpaceClimateStateService, eventEmitter: EventEmitter2);
|
|
13
13
|
onModuleInit(): void;
|
|
14
14
|
onModuleDestroy(): void;
|
|
15
15
|
handlePropertyChanged(property: ChannelPropertyEntity): Promise<void>;
|
|
@@ -8,20 +8,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.SpaceClimateStateListener = void 0;
|
|
16
|
-
const typeorm_1 = require("typeorm");
|
|
17
13
|
const common_1 = require("@nestjs/common");
|
|
18
14
|
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
19
|
-
const typeorm_2 = require("@nestjs/typeorm");
|
|
20
15
|
const logger_1 = require("../../../common/logger");
|
|
21
16
|
const transform_utils_1 = require("../../../common/utils/transform.utils");
|
|
22
17
|
const devices_constants_1 = require("../../../modules/devices/devices.constants");
|
|
23
18
|
const devices_constants_2 = require("../../../modules/devices/devices.constants");
|
|
24
19
|
const devices_entity_1 = require("../../../modules/devices/entities/devices.entity");
|
|
20
|
+
const property_metadata_service_1 = require("../../../modules/devices/services/property-metadata.service");
|
|
25
21
|
const spaces_constants_1 = require("../../../modules/spaces/spaces.constants");
|
|
26
22
|
const spaces_response_model_1 = require("../models/spaces-response.model");
|
|
27
23
|
const space_climate_state_service_1 = require("../services/space-climate-state.service");
|
|
@@ -42,8 +38,8 @@ const CLIMATE_PROPERTY_CATEGORIES = [
|
|
|
42
38
|
devices_constants_1.PropertyCategory.LOCKED,
|
|
43
39
|
];
|
|
44
40
|
let SpaceClimateStateListener = class SpaceClimateStateListener {
|
|
45
|
-
constructor(
|
|
46
|
-
this.
|
|
41
|
+
constructor(propertyMetadata, climateStateService, eventEmitter) {
|
|
42
|
+
this.propertyMetadata = propertyMetadata;
|
|
47
43
|
this.climateStateService = climateStateService;
|
|
48
44
|
this.eventEmitter = eventEmitter;
|
|
49
45
|
this.logger = (0, logger_1.createExtensionLogger)(spaces_constants_1.SPACES_MODULE_NAME, 'SpaceClimateStateListener');
|
|
@@ -68,27 +64,19 @@ let SpaceClimateStateListener = class SpaceClimateStateListener {
|
|
|
68
64
|
}
|
|
69
65
|
}
|
|
70
66
|
async processClimatePropertyChange(property) {
|
|
71
|
-
if (!CLIMATE_PROPERTY_CATEGORIES.includes(property.category)) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const channelId = typeof property.channel === 'string' ? property.channel : property.channel?.id;
|
|
75
|
-
if (!channelId) {
|
|
67
|
+
if (!property.id || !CLIMATE_PROPERTY_CATEGORIES.includes(property.category)) {
|
|
76
68
|
return;
|
|
77
69
|
}
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
.where('channel.id = :channelId', { channelId })
|
|
82
|
-
.andWhere('device.roomId IS NOT NULL')
|
|
83
|
-
.getOne();
|
|
84
|
-
if (!channel) {
|
|
70
|
+
const metadata = await this.propertyMetadata.findOne(property.id);
|
|
71
|
+
const channel = metadata?.channel;
|
|
72
|
+
if (!channel || typeof channel === 'string') {
|
|
85
73
|
return;
|
|
86
74
|
}
|
|
87
75
|
if (!CLIMATE_CHANNEL_CATEGORIES.includes(channel.category)) {
|
|
88
76
|
return;
|
|
89
77
|
}
|
|
90
78
|
const device = channel.device;
|
|
91
|
-
const roomId = device.roomId;
|
|
79
|
+
const roomId = device && typeof device !== 'string' ? device.roomId : null;
|
|
92
80
|
if (!roomId) {
|
|
93
81
|
return;
|
|
94
82
|
}
|
|
@@ -135,8 +123,7 @@ __decorate([
|
|
|
135
123
|
], SpaceClimateStateListener.prototype, "handlePropertyChanged", null);
|
|
136
124
|
exports.SpaceClimateStateListener = SpaceClimateStateListener = __decorate([
|
|
137
125
|
(0, common_1.Injectable)(),
|
|
138
|
-
|
|
139
|
-
__metadata("design:paramtypes", [typeorm_1.Repository,
|
|
126
|
+
__metadata("design:paramtypes", [property_metadata_service_1.PropertyMetadataService,
|
|
140
127
|
space_climate_state_service_1.SpaceClimateStateService,
|
|
141
128
|
event_emitter_1.EventEmitter2])
|
|
142
129
|
], SpaceClimateStateListener);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space-climate-state.listener.js","sourceRoot":"","sources":["../../../../src/plugins/spaces-home-control/listeners/space-climate-state.listener.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"space-climate-state.listener.js","sourceRoot":"","sources":["../../../../src/plugins/spaces-home-control/listeners/space-climate-state.listener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA2E;AAC3E,yDAA+D;AAE/D,mDAA+D;AAC/D,2EAAmE;AACnE,kFAA+F;AAC/F,kFAA2F;AAC3F,qFAAyF;AACzF,2GAAsG;AACtG,+EAA8E;AAC9E,2EAAwE;AACxE,yFAAmF;AACnF,oFAA6D;AAM7D,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAGtC,MAAM,0BAA0B,GAAsB;IACrD,mCAAe,CAAC,WAAW;IAC3B,mCAAe,CAAC,QAAQ;IACxB,mCAAe,CAAC,MAAM;IACtB,mCAAe,CAAC,MAAM;IACtB,mCAAe,CAAC,UAAU;CAC1B,CAAC;AAGF,MAAM,2BAA2B,GAAuB;IACvD,oCAAgB,CAAC,WAAW;IAC5B,oCAAgB,CAAC,EAAE;IACnB,oCAAgB,CAAC,MAAM;IACvB,oCAAgB,CAAC,QAAQ;IACzB,oCAAgB,CAAC,MAAM;CACvB,CAAC;AAGK,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IASrC,YACkB,gBAAyC,EACzC,mBAA6C,EAC7C,YAA2B;QAF3B,qBAAgB,GAAhB,gBAAgB,CAAyB;QACzC,wBAAmB,GAAnB,mBAAmB,CAA0B;QAC7C,iBAAY,GAAZ,YAAY,C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CAAC,YAAY,CAAC,IAAI,CAAC,yCAAS,CAAC,qBAAqB,EAAE;gBACvD,QAAQ,EAAE,MAAM;gBAChB,KAAK,EAAE,UAAU;aACjB,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,MAAM,yBAAyB,CAAC,CAAC;QAC9F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,GAAG,GAAG,KAAc,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gDAAgD,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5F,CAAC;IACF,CAAC;CACD,CAAA;AAxHY,8DAAyB;AA6B/B;IAFL,IAAA,uBAAO,EAAC,6BAAgB,CAAC,0BAA0B,CAAC;IACpD,IAAA,uBAAO,EAAC,6BAAgB,CAAC,wBAAwB,CAAC;;qCACb,sCAAqB;;sEAO1D;oCApCW,yBAAyB;IADrC,IAAA,mBAAU,GAAE;qCAWwB,mDAAuB;QACpB,sDAAwB;QAC/B,6BAAa;GAZjC,yBAAyB,CAwHrC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
2
1
|
import { OnModuleDestroy, OnModuleInit } from '@nestjs/common';
|
|
3
2
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
4
|
-
import {
|
|
3
|
+
import { ChannelPropertyEntity } from '../../../modules/devices/entities/devices.entity';
|
|
4
|
+
import { PropertyMetadataService } from '../../../modules/devices/services/property-metadata.service';
|
|
5
5
|
import { SpaceLightingStateService } from '../services/space-lighting-state.service';
|
|
6
6
|
export declare class SpaceLightingStateListener implements OnModuleInit, OnModuleDestroy {
|
|
7
|
-
private readonly
|
|
7
|
+
private readonly propertyMetadata;
|
|
8
8
|
private readonly lightingStateService;
|
|
9
9
|
private readonly eventEmitter;
|
|
10
10
|
private readonly logger;
|
|
11
11
|
private readonly debounceTimers;
|
|
12
|
-
constructor(
|
|
12
|
+
constructor(propertyMetadata: PropertyMetadataService, lightingStateService: SpaceLightingStateService, eventEmitter: EventEmitter2);
|
|
13
13
|
onModuleInit(): void;
|
|
14
14
|
onModuleDestroy(): void;
|
|
15
15
|
handlePropertyChanged(property: ChannelPropertyEntity): Promise<void>;
|
|
@@ -8,19 +8,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.SpaceLightingStateListener = void 0;
|
|
16
|
-
const typeorm_1 = require("typeorm");
|
|
17
13
|
const common_1 = require("@nestjs/common");
|
|
18
14
|
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
19
|
-
const typeorm_2 = require("@nestjs/typeorm");
|
|
20
15
|
const logger_1 = require("../../../common/logger");
|
|
21
16
|
const devices_constants_1 = require("../../../modules/devices/devices.constants");
|
|
22
17
|
const devices_constants_2 = require("../../../modules/devices/devices.constants");
|
|
23
18
|
const devices_entity_1 = require("../../../modules/devices/entities/devices.entity");
|
|
19
|
+
const property_metadata_service_1 = require("../../../modules/devices/services/property-metadata.service");
|
|
24
20
|
const spaces_constants_1 = require("../../../modules/spaces/spaces.constants");
|
|
25
21
|
const spaces_response_model_1 = require("../models/spaces-response.model");
|
|
26
22
|
const space_lighting_state_service_1 = require("../services/space-lighting-state.service");
|
|
@@ -39,8 +35,8 @@ const LIGHTING_PROPERTY_CATEGORIES = [
|
|
|
39
35
|
devices_constants_1.PropertyCategory.SATURATION,
|
|
40
36
|
];
|
|
41
37
|
let SpaceLightingStateListener = class SpaceLightingStateListener {
|
|
42
|
-
constructor(
|
|
43
|
-
this.
|
|
38
|
+
constructor(propertyMetadata, lightingStateService, eventEmitter) {
|
|
39
|
+
this.propertyMetadata = propertyMetadata;
|
|
44
40
|
this.lightingStateService = lightingStateService;
|
|
45
41
|
this.eventEmitter = eventEmitter;
|
|
46
42
|
this.logger = (0, logger_1.createExtensionLogger)(spaces_constants_1.SPACES_MODULE_NAME, 'SpaceLightingStateListener');
|
|
@@ -65,27 +61,19 @@ let SpaceLightingStateListener = class SpaceLightingStateListener {
|
|
|
65
61
|
}
|
|
66
62
|
}
|
|
67
63
|
async processLightingPropertyChange(property) {
|
|
68
|
-
if (!LIGHTING_PROPERTY_CATEGORIES.includes(property.category)) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const channelId = typeof property.channel === 'string' ? property.channel : property.channel?.id;
|
|
72
|
-
if (!channelId) {
|
|
64
|
+
if (!property.id || !LIGHTING_PROPERTY_CATEGORIES.includes(property.category)) {
|
|
73
65
|
return;
|
|
74
66
|
}
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
.where('channel.id = :channelId', { channelId })
|
|
79
|
-
.andWhere('device.roomId IS NOT NULL')
|
|
80
|
-
.getOne();
|
|
81
|
-
if (!channel) {
|
|
67
|
+
const metadata = await this.propertyMetadata.findOne(property.id);
|
|
68
|
+
const channel = metadata?.channel;
|
|
69
|
+
if (!channel || typeof channel === 'string') {
|
|
82
70
|
return;
|
|
83
71
|
}
|
|
84
72
|
if (!LIGHTING_CHANNEL_CATEGORIES.includes(channel.category)) {
|
|
85
73
|
return;
|
|
86
74
|
}
|
|
87
75
|
const device = channel.device;
|
|
88
|
-
const roomId = device.roomId;
|
|
76
|
+
const roomId = device && typeof device !== 'string' ? device.roomId : null;
|
|
89
77
|
if (!roomId) {
|
|
90
78
|
return;
|
|
91
79
|
}
|
|
@@ -134,8 +122,7 @@ __decorate([
|
|
|
134
122
|
], SpaceLightingStateListener.prototype, "handlePropertyChanged", null);
|
|
135
123
|
exports.SpaceLightingStateListener = SpaceLightingStateListener = __decorate([
|
|
136
124
|
(0, common_1.Injectable)(),
|
|
137
|
-
|
|
138
|
-
__metadata("design:paramtypes", [typeorm_1.Repository,
|
|
125
|
+
__metadata("design:paramtypes", [property_metadata_service_1.PropertyMetadataService,
|
|
139
126
|
space_lighting_state_service_1.SpaceLightingStateService,
|
|
140
127
|
event_emitter_1.EventEmitter2])
|
|
141
128
|
], SpaceLightingStateListener);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space-lighting-state.listener.js","sourceRoot":"","sources":["../../../../src/plugins/spaces-home-control/listeners/space-lighting-state.listener.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"space-lighting-state.listener.js","sourceRoot":"","sources":["../../../../src/plugins/spaces-home-control/listeners/space-lighting-state.listener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA2E;AAC3E,yDAA+D;AAE/D,mDAA+D;AAC/D,kFAA+F;AAC/F,kFAA2F;AAC3F,qFAAyF;AACzF,2GAAsG;AACtG,+EAA8E;AAC9E,2EAAyE;AACzE,2FAAqF;AACrF,oFAA6D;AAM7D,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAGvC,MAAM,2BAA2B,GAAsB,CAAC,mCAAe,CAAC,KAAK,CAAC,CAAC;AAG/E,MAAM,4BAA4B,GAAuB;IACxD,oCAAgB,CAAC,EAAE;IACnB,oCAAgB,CAAC,UAAU;IAC3B,oCAAgB,CAAC,SAAS;IAC1B,oCAAgB,CAAC,WAAW;IAC5B,oCAAgB,CAAC,UAAU;IAC3B,oCAAgB,CAAC,WAAW;IAC5B,oCAAgB,CAAC,iBAAiB;IAClC,oCAAgB,CAAC,GAAG;IACpB,oCAAgB,CAAC,UAAU;CAC3B,CAAC;AAGK,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAStC,YACkB,gBAAyC,EACzC,oBAA+C,EAC/C,YAA2B;QAF3B,qBAAgB,GAAhB,gBAAgB,CAAyB;QACzC,y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ACR,CAAC;YAGD,MAAM,UAAU,GAAG,8CAAsB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAE3D,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,yCAAS,CAAC,sBAAsB,EAAE;gBACxD,QAAQ,EAAE,MAAM;gBAChB,KAAK,EAAE,UAAU;aACjB,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2CAA2C,MAAM,yBAAyB,CAAC,CAAC;QAC/F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,GAAG,GAAG,KAAc,CAAC;YAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iDAAiD,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7F,CAAC;IACF,CAAC;CACD,CAAA;AAvHY,gEAA0B;AA6BhC;IAFL,IAAA,uBAAO,EAAC,6BAAgB,CAAC,0BAA0B,CAAC;IACpD,IAAA,uBAAO,EAAC,6BAAgB,CAAC,wBAAwB,CAAC;;qCACb,sCAAqB;;uEAO1D;qCApCW,0BAA0B;IADtC,IAAA,mBAAU,GAAE;qCAWwB,mDAAuB;QACnB,wDAAyB;QACjC,6BAAa;GAZjC,0BAA0B,CAuHtC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
2
1
|
import { OnModuleDestroy, OnModuleInit } from '@nestjs/common';
|
|
3
2
|
import { EventEmitter2 } from '@nestjs/event-emitter';
|
|
4
|
-
import {
|
|
3
|
+
import { ChannelPropertyEntity } from '../../../modules/devices/entities/devices.entity';
|
|
4
|
+
import { PropertyMetadataService } from '../../../modules/devices/services/property-metadata.service';
|
|
5
5
|
import { SpaceSensorStateService } from '../services/space-sensor-state.service';
|
|
6
6
|
export declare class SpaceSensorStateListener implements OnModuleInit, OnModuleDestroy {
|
|
7
|
-
private readonly
|
|
7
|
+
private readonly propertyMetadata;
|
|
8
8
|
private readonly sensorStateService;
|
|
9
9
|
private readonly eventEmitter;
|
|
10
10
|
private readonly logger;
|
|
11
11
|
private readonly debounceTimers;
|
|
12
|
-
constructor(
|
|
12
|
+
constructor(propertyMetadata: PropertyMetadataService, sensorStateService: SpaceSensorStateService, eventEmitter: EventEmitter2);
|
|
13
13
|
onModuleInit(): void;
|
|
14
14
|
onModuleDestroy(): void;
|
|
15
15
|
handleSensorRoleChanged(payload: {
|
|
@@ -8,19 +8,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.SpaceSensorStateListener = void 0;
|
|
16
|
-
const typeorm_1 = require("typeorm");
|
|
17
13
|
const common_1 = require("@nestjs/common");
|
|
18
14
|
const event_emitter_1 = require("@nestjs/event-emitter");
|
|
19
|
-
const typeorm_2 = require("@nestjs/typeorm");
|
|
20
15
|
const logger_1 = require("../../../common/logger");
|
|
21
16
|
const transform_utils_1 = require("../../../common/utils/transform.utils");
|
|
22
17
|
const devices_constants_1 = require("../../../modules/devices/devices.constants");
|
|
23
18
|
const devices_entity_1 = require("../../../modules/devices/entities/devices.entity");
|
|
19
|
+
const property_metadata_service_1 = require("../../../modules/devices/services/property-metadata.service");
|
|
24
20
|
const spaces_constants_1 = require("../../../modules/spaces/spaces.constants");
|
|
25
21
|
const spaces_response_model_1 = require("../models/spaces-response.model");
|
|
26
22
|
const space_sensor_state_service_1 = require("../services/space-sensor-state.service");
|
|
@@ -39,8 +35,8 @@ const SENSOR_PROPERTY_CATEGORIES = [
|
|
|
39
35
|
devices_constants_1.PropertyCategory.PERCENTAGE,
|
|
40
36
|
];
|
|
41
37
|
let SpaceSensorStateListener = class SpaceSensorStateListener {
|
|
42
|
-
constructor(
|
|
43
|
-
this.
|
|
38
|
+
constructor(propertyMetadata, sensorStateService, eventEmitter) {
|
|
39
|
+
this.propertyMetadata = propertyMetadata;
|
|
44
40
|
this.sensorStateService = sensorStateService;
|
|
45
41
|
this.eventEmitter = eventEmitter;
|
|
46
42
|
this.logger = (0, logger_1.createExtensionLogger)(spaces_constants_1.SPACES_MODULE_NAME, 'SpaceSensorStateListener');
|
|
@@ -72,27 +68,19 @@ let SpaceSensorStateListener = class SpaceSensorStateListener {
|
|
|
72
68
|
}
|
|
73
69
|
}
|
|
74
70
|
async processSensorPropertyChange(property) {
|
|
75
|
-
if (!SENSOR_PROPERTY_CATEGORIES.includes(property.category)) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const channelId = typeof property.channel === 'string' ? property.channel : property.channel?.id;
|
|
79
|
-
if (!channelId) {
|
|
71
|
+
if (!property.id || !SENSOR_PROPERTY_CATEGORIES.includes(property.category)) {
|
|
80
72
|
return;
|
|
81
73
|
}
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
.where('channel.id = :channelId', { channelId })
|
|
86
|
-
.andWhere('device.roomId IS NOT NULL')
|
|
87
|
-
.getOne();
|
|
88
|
-
if (!channel) {
|
|
74
|
+
const metadata = await this.propertyMetadata.findOne(property.id);
|
|
75
|
+
const channel = metadata?.channel;
|
|
76
|
+
if (!channel || typeof channel === 'string') {
|
|
89
77
|
return;
|
|
90
78
|
}
|
|
91
79
|
if (!spaces_home_control_constants_1.SENSOR_CHANNEL_CATEGORIES.includes(channel.category)) {
|
|
92
80
|
return;
|
|
93
81
|
}
|
|
94
82
|
const device = channel.device;
|
|
95
|
-
const roomId = device.roomId;
|
|
83
|
+
const roomId = device && typeof device !== 'string' ? device.roomId : null;
|
|
96
84
|
if (!roomId) {
|
|
97
85
|
return;
|
|
98
86
|
}
|
|
@@ -147,8 +135,7 @@ __decorate([
|
|
|
147
135
|
], SpaceSensorStateListener.prototype, "handlePropertyChanged", null);
|
|
148
136
|
exports.SpaceSensorStateListener = SpaceSensorStateListener = __decorate([
|
|
149
137
|
(0, common_1.Injectable)(),
|
|
150
|
-
|
|
151
|
-
__metadata("design:paramtypes", [typeorm_1.Repository,
|
|
138
|
+
__metadata("design:paramtypes", [property_metadata_service_1.PropertyMetadataService,
|
|
152
139
|
space_sensor_state_service_1.SpaceSensorStateService,
|
|
153
140
|
event_emitter_1.EventEmitter2])
|
|
154
141
|
], SpaceSensorStateListener);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space-sensor-state.listener.js","sourceRoot":"","sources":["../../../../src/plugins/spaces-home-control/listeners/space-sensor-state.listener.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"space-sensor-state.listener.js","sourceRoot":"","sources":["../../../../src/plugins/spaces-home-control/listeners/space-sensor-state.listener.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA2E;AAC3E,yDAA+D;AAE/D,mDAA+D;AAC/D,2EAAmE;AACnE,kFAA6G;AAC7G,qFAAyF;AACzF,2GAAsG;AACtG,+EAA8E;AAC9E,2EAAuE;AACvE,uFAAiF;AACjF,oFAAwF;AAMxF,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAMrC,MAAM,0BAA0B,GAAuB;IACtD,oCAAgB,CAAC,WAAW;IAC5B,oCAAgB,CAAC,QAAQ;IACzB,oCAAgB,CAAC,QAAQ;IACzB,oCAAgB,CAAC,WAAW;IAC5B,oCAAgB,CAAC,aAAa;IAC9B,oCAAgB,CAAC,GAAG;IACpB,oCAAgB,CAAC,QAAQ;IACzB,oCAAgB,CAAC,KAAK;IACtB,oCAAgB,CAAC,WAAW;IAC5B,oCAAgB,CAAC,UAAU;CAC3B,CAAC;AAGK,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IASpC,YACkB,gBAAyC,EACzC,kBAA2C,EAC3C,YAA2B;Q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
2
|
import { ChannelEntity, ChannelPropertyEntity, DeviceEntity } from '../../../modules/devices/entities/devices.entity';
|
|
3
3
|
import { IntentTimeseriesService } from '../../../modules/intents/services/intent-timeseries.service';
|
|
4
|
-
import { SpacesService } from '../../../modules/spaces/services/spaces.service';
|
|
5
4
|
import { ClimateMode, ClimateRole } from '../spaces-home-control.constants';
|
|
6
|
-
import { SpaceClimateRoleService } from './space-climate-role.service';
|
|
7
5
|
import { SpaceIntentBaseService } from './space-intent-base.service';
|
|
6
|
+
import { SpaceStateReadService } from './space-state-read.service';
|
|
8
7
|
export interface PrimaryClimateDevice {
|
|
9
8
|
device: DeviceEntity;
|
|
10
9
|
deviceCategory: DeviceCategory;
|
|
@@ -51,11 +50,10 @@ export interface ClimateState {
|
|
|
51
50
|
lastAppliedAt: Date | null;
|
|
52
51
|
}
|
|
53
52
|
export declare class SpaceClimateStateService extends SpaceIntentBaseService {
|
|
54
|
-
private readonly
|
|
55
|
-
private readonly climateRoleService;
|
|
53
|
+
private readonly stateReads;
|
|
56
54
|
private readonly intentTimeseriesService;
|
|
57
55
|
private readonly logger;
|
|
58
|
-
constructor(
|
|
56
|
+
constructor(stateReads: SpaceStateReadService, intentTimeseriesService: IntentTimeseriesService);
|
|
59
57
|
getClimateState(spaceId: string): Promise<ClimateState | null>;
|
|
60
58
|
getPrimaryClimateDevicesInSpace(spaceId: string): Promise<PrimaryClimateDevice[]>;
|
|
61
59
|
private extractPrimaryClimateDevices;
|