dt-common-device 3.1.1 → 3.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.
Files changed (52) hide show
  1. package/dist/admin/Admin.repository.d.ts +7 -0
  2. package/dist/admin/Admin.repository.js +182 -0
  3. package/dist/admin/Admin.service.d.ts +5 -0
  4. package/dist/admin/Admin.service.js +17 -0
  5. package/dist/admin/index.d.ts +1 -0
  6. package/dist/{device → admin}/index.js +1 -4
  7. package/dist/audit/AuditProperties.d.ts +16 -0
  8. package/dist/audit/AuditUtils.d.ts +2 -0
  9. package/dist/audit/AuditUtils.js +36 -0
  10. package/dist/config/config.js +4 -0
  11. package/dist/config/config.types.d.ts +2 -0
  12. package/dist/device/cloud/entities/DeviceFactory.js +73 -14
  13. package/dist/device/local/events/EventHandler.js +6 -6
  14. package/dist/device/local/events/Events.d.ts +33 -12
  15. package/dist/device/local/events/Events.js +33 -12
  16. package/dist/device/local/services/Device.service.js +294 -239
  17. package/dist/device/local/services/Hub.service.js +92 -38
  18. package/dist/events/BaseEventHandler.js +6 -1
  19. package/dist/events/DeviceEventHandler.js +6 -1
  20. package/dist/events/EventHandler.js +158 -104
  21. package/dist/events/EventProcessingService.js +8 -3
  22. package/dist/index.d.ts +1 -0
  23. package/dist/index.js +2 -0
  24. package/dist/microservice/MicroServiceFactory.d.ts +1 -1
  25. package/dist/microservice/MicroServiceFactory.js +5 -3
  26. package/dist/property/Property.service.js +86 -27
  27. package/dist/queue/services/QueueService.js +6 -1
  28. package/dist/queue/utils/rateLimit.utils.js +9 -9
  29. package/dist/utils/http.utils.d.ts +2 -0
  30. package/dist/utils/http.utils.js +30 -0
  31. package/package.json +1 -1
  32. package/dist/device/cloud/interface.d.ts +0 -101
  33. package/dist/device/cloud/interface.js +0 -3
  34. package/dist/device/cloud/interfaces/IDeviceConnectionService.d.ts +0 -7
  35. package/dist/device/cloud/interfaces/IDeviceConnectionService.js +0 -3
  36. package/dist/device/cloud/interfaces/IDevicesService.d.ts +0 -9
  37. package/dist/device/cloud/services/Device.service.d.ts +0 -39
  38. package/dist/device/cloud/services/Device.service.js +0 -9
  39. package/dist/device/cloud/services/DeviceCloudService.d.ts +0 -42
  40. package/dist/device/cloud/services/DeviceCloudService.js +0 -59
  41. package/dist/device/cloud/services/DeviceHub.service.d.ts +0 -3
  42. package/dist/device/cloud/services/DeviceHub.service.js +0 -6
  43. package/dist/device/cloud/services/Hub.service.d.ts +0 -25
  44. package/dist/device/cloud/services/Hub.service.js +0 -9
  45. package/dist/device/cloud/services/SmartThingsDeviceService.d.ts +0 -38
  46. package/dist/device/cloud/services/SmartThingsDeviceService.js +0 -52
  47. package/dist/device/index.d.ts +0 -4
  48. package/dist/device/local/interface.d.ts +0 -0
  49. package/dist/device/local/interface.js +0 -1
  50. package/dist/device/local/services/DeviceHub.service.d.ts +0 -11
  51. package/dist/device/local/services/DeviceHub.service.js +0 -40
  52. /package/dist/{device/cloud/interfaces/IDevicesService.js → audit/AuditProperties.js} +0 -0
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SmartThingsDeviceService = void 0;
4
- /**
5
- * SmartThings Device Service Class
6
- * Implements ISmartthingsDeviceCommandManager interface with empty implementations
7
- * Implementation will be provided by the consuming project
8
- */
9
- class SmartThingsDeviceService {
10
- /**
11
- * Invokes a command on a device
12
- * @param command - Device command to execute
13
- * @param deviceId - Device identifier
14
- * @returns Promise with command response
15
- */
16
- async invokeCommand(command, deviceId) {
17
- // Implementation will be provided by the consuming project
18
- throw new Error("invokeCommand method not implemented");
19
- }
20
- /**
21
- * Performs device action for SmartThings
22
- * @param commands - Array of SmartThings device commands
23
- * @param deviceId - Device identifier
24
- * @param accessToken - Access token for authentication
25
- * @returns Promise with action result
26
- */
27
- async performDeviceAction(commands, deviceId, accessToken) {
28
- // Implementation will be provided by the consuming project
29
- throw new Error("performDeviceAction method not implemented");
30
- }
31
- /**
32
- * Gets device status for SmartThings
33
- * @param deviceId - Device identifier
34
- * @param accessToken - Access token for authentication
35
- * @returns Promise with device status
36
- */
37
- async getDeviceStatus(deviceId, accessToken) {
38
- // Implementation will be provided by the consuming project
39
- throw new Error("getDeviceStatus method not implemented");
40
- }
41
- /**
42
- * Gets device lock status for SmartThings
43
- * @param deviceId - Device identifier
44
- * @param accessToken - Access token for authentication
45
- * @returns Promise with lock status
46
- */
47
- async getDeviceLockStatus(deviceId, accessToken) {
48
- // Implementation will be provided by the consuming project
49
- throw new Error("getDeviceLockStatus method not implemented");
50
- }
51
- }
52
- exports.SmartThingsDeviceService = SmartThingsDeviceService;
@@ -1,4 +0,0 @@
1
- export * from "./cloud/interface";
2
- export * from "./cloud/types";
3
- export type { IConnection, IConnectionConnectParams, IDevice, IDeviceAccountResponse, } from "./cloud/types";
4
- export type { IDeviceCloudService } from "./cloud/interface";
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,11 +0,0 @@
1
- import { IHubCreateParams } from "../interfaces";
2
- export declare class DeviceHubService {
3
- private readonly baseUrl;
4
- constructor();
5
- addHub(body: IHubCreateParams): Promise<any>;
6
- getHubs(hubIds: string[]): Promise<any>;
7
- getHub(hubId: string): Promise<any>;
8
- updateHub(hubId: string, body: any): Promise<any>;
9
- deleteHub(hubId: string): Promise<any>;
10
- deleteAllHubs(hubIds: string[]): Promise<any>;
11
- }
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DeviceHubService = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const config_1 = require("../../../config/config");
9
- class DeviceHubService {
10
- constructor() {
11
- const { DEVICE_SERVICE } = (0, config_1.getConfig)();
12
- if (!DEVICE_SERVICE) {
13
- throw new Error("DEVICE_SERVICE is not configured. Call initialize() first with DEVICE_SERVICE.");
14
- }
15
- this.baseUrl = DEVICE_SERVICE;
16
- }
17
- async addHub(body) {
18
- return await axios_1.default.post(`${this.baseUrl}/devices/hubs`, body);
19
- }
20
- //get hubs takes an array of hub ids as query params
21
- async getHubs(hubIds) {
22
- const query = hubIds && hubIds.length ? `?ids=${hubIds.join(",")}` : "";
23
- return await axios_1.default.get(`${this.baseUrl}/devices/hubs${query}`);
24
- }
25
- //get hub takes a hub id in params
26
- async getHub(hubId) {
27
- return await axios_1.default.get(`${this.baseUrl}/devices/hubs/${hubId}`);
28
- }
29
- async updateHub(hubId, body) {
30
- return await axios_1.default.put(`${this.baseUrl}/devices/hubs/${hubId}`, body);
31
- }
32
- async deleteHub(hubId) {
33
- return await axios_1.default.delete(`${this.baseUrl}/devices/hubs/${hubId}`);
34
- }
35
- async deleteAllHubs(hubIds) {
36
- const query = hubIds.length ? `?ids=${hubIds.join(",")}` : "";
37
- return await axios_1.default.delete(`${this.baseUrl}/devices/hubs${query}`);
38
- }
39
- }
40
- exports.DeviceHubService = DeviceHubService;