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,36 +1,95 @@
1
1
  "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
39
+ };
40
+ var __importDefault = (this && this.__importDefault) || function (mod) {
41
+ return (mod && mod.__esModule) ? mod : { "default": mod };
42
+ };
2
43
  Object.defineProperty(exports, "__esModule", { value: true });
3
44
  exports.LocalPropertyService = void 0;
4
45
  const Property_repository_1 = require("./Property.repository");
5
- class LocalPropertyService {
6
- constructor() {
7
- this.propertyRepository = new Property_repository_1.PropertyRepository();
8
- }
9
- async getPropertyPreferences(propertyId) {
10
- if (!propertyId) {
11
- throw new Error("Property ID is required");
46
+ const typedi_1 = __importDefault(require("typedi"));
47
+ const typedi_2 = require("typedi");
48
+ let LocalPropertyService = (() => {
49
+ let _classDecorators = [(0, typedi_2.Service)()];
50
+ let _classDescriptor;
51
+ let _classExtraInitializers = [];
52
+ let _classThis;
53
+ var LocalPropertyService = _classThis = class {
54
+ constructor() {
55
+ // Use dependency injection instead of creating new instance
56
+ this.propertyRepository = typedi_1.default.get(Property_repository_1.PropertyRepository);
12
57
  }
13
- return await this.propertyRepository.getPropertyPreferences(propertyId);
14
- }
15
- async getProperty(propertyId) {
16
- if (!propertyId) {
17
- throw new Error("Property ID is required");
58
+ async getPropertyPreferences(propertyId) {
59
+ if (!propertyId) {
60
+ throw new Error("Property ID is required");
61
+ }
62
+ return await this.propertyRepository.getPropertyPreferences(propertyId);
18
63
  }
19
- return await this.propertyRepository.getProperty(propertyId);
20
- }
21
- async getPropertyTimeZone(propertyId) {
22
- if (!propertyId) {
23
- throw new Error("Property ID is required");
64
+ async getProperty(propertyId) {
65
+ if (!propertyId) {
66
+ throw new Error("Property ID is required");
67
+ }
68
+ return await this.propertyRepository.getProperty(propertyId);
24
69
  }
25
- const property = await this.propertyRepository.getProperty(propertyId);
26
- if (!property) {
27
- throw new Error("Property not found");
70
+ async getPropertyTimeZone(propertyId) {
71
+ if (!propertyId) {
72
+ throw new Error("Property ID is required");
73
+ }
74
+ const property = await this.propertyRepository.getProperty(propertyId);
75
+ if (!property) {
76
+ throw new Error("Property not found");
77
+ }
78
+ return property.timezone;
28
79
  }
29
- return property.timezone;
30
- }
31
- async getAllProperties() {
32
- const properties = await this.propertyRepository.getAllProperties();
33
- return properties;
34
- }
35
- }
80
+ async getAllProperties() {
81
+ const properties = await this.propertyRepository.getAllProperties();
82
+ return properties;
83
+ }
84
+ };
85
+ __setFunctionName(_classThis, "LocalPropertyService");
86
+ (() => {
87
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
88
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
89
+ LocalPropertyService = _classThis = _classDescriptor.value;
90
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
91
+ __runInitializers(_classThis, _classExtraInitializers);
92
+ })();
93
+ return LocalPropertyService = _classThis;
94
+ })();
36
95
  exports.LocalPropertyService = LocalPropertyService;
@@ -37,10 +37,14 @@ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, p
37
37
  if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
38
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
39
39
  };
40
+ var __importDefault = (this && this.__importDefault) || function (mod) {
41
+ return (mod && mod.__esModule) ? mod : { "default": mod };
42
+ };
40
43
  Object.defineProperty(exports, "__esModule", { value: true });
41
44
  exports.QueueService = void 0;
42
45
  const typedi_1 = require("typedi");
43
46
  const HybridHttpQueue_1 = require("../entities/HybridHttpQueue");
47
+ const typedi_2 = __importDefault(require("typedi"));
44
48
  let QueueService = (() => {
45
49
  let _classDecorators = [(0, typedi_1.Service)()];
46
50
  let _classDescriptor;
@@ -48,7 +52,8 @@ let QueueService = (() => {
48
52
  let _classThis;
49
53
  var QueueService = _classThis = class {
50
54
  constructor() {
51
- this.hybridQueue = new HybridHttpQueue_1.HybridHttpQueue();
55
+ // Use dependency injection instead of creating new instance
56
+ this.hybridQueue = typedi_2.default.get(HybridHttpQueue_1.HybridHttpQueue);
52
57
  }
53
58
  async request(options) {
54
59
  return this.hybridQueue.request(options);
@@ -34,28 +34,28 @@ class RateLimitUtils {
34
34
  const configs = new Map();
35
35
  // Configure rate limits for different providers
36
36
  configs.set(constants_1.CONNECTION_PROVIDERS.SENSIBO, {
37
- maxRequests: 5,
38
- windowMs: 60000,
37
+ maxRequests: 10,
38
+ windowMs: 10000, // 10 seconds
39
39
  provider: constants_1.CONNECTION_PROVIDERS.SENSIBO,
40
40
  });
41
41
  configs.set(constants_1.CONNECTION_PROVIDERS.CLOUDBEDS, {
42
42
  maxRequests: 10,
43
- windowMs: 1000,
43
+ windowMs: 10000, // 10 seconds
44
44
  provider: constants_1.CONNECTION_PROVIDERS.CLOUDBEDS,
45
45
  });
46
46
  configs.set(constants_1.CONNECTION_PROVIDERS.TTLOCK, {
47
- maxRequests: 5,
48
- windowMs: 60000,
47
+ maxRequests: 15,
48
+ windowMs: 60000, // 1 minute
49
49
  provider: constants_1.CONNECTION_PROVIDERS.TTLOCK,
50
50
  });
51
51
  configs.set(constants_1.CONNECTION_PROVIDERS.SCHLAGE, {
52
- maxRequests: 5,
53
- windowMs: 60000,
52
+ maxRequests: 120,
53
+ windowMs: 60000, // 1 minute
54
54
  provider: constants_1.CONNECTION_PROVIDERS.SCHLAGE,
55
55
  });
56
56
  configs.set(constants_1.CONNECTION_PROVIDERS.SMARTTHINGS, {
57
- maxRequests: 5,
58
- windowMs: 60000,
57
+ maxRequests: 250,
58
+ windowMs: 60000, // 1 minute
59
59
  provider: constants_1.CONNECTION_PROVIDERS.SMARTTHINGS,
60
60
  });
61
61
  configs.set(constants_1.CONNECTION_PROVIDERS.YALEWIFI, {
@@ -7,6 +7,8 @@ export declare function validateServiceUrl(url: string): boolean;
7
7
  */
8
8
  export declare function createAxiosInstance(baseURL?: string): import("axios").AxiosInstance;
9
9
  export declare function getDeviceServiceAxiosInstance(): any;
10
+ export declare function getAccessServiceAxiosInstance(): any;
11
+ export declare function getCloudServiceAxiosInstance(): any;
10
12
  /**
11
13
  * Retry function for failed HTTP requests
12
14
  */
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.validateServiceUrl = validateServiceUrl;
7
7
  exports.createAxiosInstance = createAxiosInstance;
8
8
  exports.getDeviceServiceAxiosInstance = getDeviceServiceAxiosInstance;
9
+ exports.getAccessServiceAxiosInstance = getAccessServiceAxiosInstance;
10
+ exports.getCloudServiceAxiosInstance = getCloudServiceAxiosInstance;
9
11
  exports.retryRequest = retryRequest;
10
12
  const config_1 = require("../config/config");
11
13
  const axios_1 = __importDefault(require("axios"));
@@ -89,6 +91,34 @@ function getDeviceServiceAxiosInstance() {
89
91
  }
90
92
  return deviceServiceAxiosInstance;
91
93
  }
94
+ /**
95
+ * Centralized axios instance for access service
96
+ */
97
+ let accessServiceAxiosInstance = null;
98
+ function getAccessServiceAxiosInstance() {
99
+ if (!accessServiceAxiosInstance) {
100
+ const { ACCESS_SERVICE } = (0, config_1.getConfig)();
101
+ if (!ACCESS_SERVICE) {
102
+ throw new Error("ACCESS_SERVICE is not configured. Call initialize() first with ACCESS_SERVICE.");
103
+ }
104
+ accessServiceAxiosInstance = createAxiosInstance(ACCESS_SERVICE);
105
+ }
106
+ return accessServiceAxiosInstance;
107
+ }
108
+ /**
109
+ * Centralized axios instance for cloud service (smart-cloud)
110
+ */
111
+ let cloudServiceAxiosInstance = null;
112
+ function getCloudServiceAxiosInstance() {
113
+ const { ADMIN_SERVICE } = (0, config_1.getConfig)();
114
+ if (!cloudServiceAxiosInstance) {
115
+ if (!ADMIN_SERVICE) {
116
+ throw new Error("ADMIN_SERVICE is not configured. Call initialize() first with ADMIN_SERVICE.");
117
+ }
118
+ cloudServiceAxiosInstance = createAxiosInstance(ADMIN_SERVICE);
119
+ }
120
+ return cloudServiceAxiosInstance;
121
+ }
92
122
  /**
93
123
  * Retry function for failed HTTP requests
94
124
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -1,101 +0,0 @@
1
- import { IConnection, IConnectionConnectParams, IDevice, IDeviceAccountResponse, IDeviceCommand, ISmartthingsDeviceCommand, ICommandResponse } from "./types";
2
- /**
3
- * Class interface for device cloud operations and connection management
4
- */
5
- export interface IDeviceCloudService {
6
- /**
7
- * Creates a new connection for device management
8
- * @param data - Connection data
9
- * @param userId - User identifier
10
- * @returns Promise with connection result
11
- */
12
- createConnection(data: IConnection, userId: string): Promise<any>;
13
- /**
14
- * Gets device account information for a connection
15
- * @param connection - Connection object
16
- * @returns Promise with device account response
17
- */
18
- getDeviceAccount(connection: IConnection): Promise<IDeviceAccountResponse>;
19
- /**
20
- * Gets all devices for a connection
21
- * @param connection - Connection object
22
- * @returns Promise with array of devices
23
- */
24
- getDevices(connection: IConnection): Promise<IDevice[]>;
25
- /**
26
- * Filters devices based on connection and device list
27
- * @param connection - Connection object
28
- * @param devices - Array of devices to filter
29
- * @returns Promise with filtered devices
30
- */
31
- filterDevices(connection: IConnection, devices: any[]): Promise<IDevice[]>;
32
- /**
33
- * Connects to a device service
34
- * @param connection - Connection object
35
- * @param connectionConnect - Connection parameters
36
- * @returns Promise with connection result
37
- */
38
- connect(connection: IConnection, connectionConnect: IConnectionConnectParams): Promise<any>;
39
- }
40
- /**
41
- * Interface for device command operations
42
- */
43
- export interface IDeviceCommandManager {
44
- /**
45
- * Invokes a command on a device
46
- * @param command - Device command to execute
47
- * @param deviceId - Device identifier
48
- * @returns Promise with command response
49
- */
50
- invokeCommand(command: IDeviceCommand, deviceId: string): Promise<ICommandResponse>;
51
- }
52
- /**
53
- * Interface for SmartThings specific device command operations
54
- */
55
- export interface ISmartthingsDeviceCommandManager extends IDeviceCommandManager {
56
- /**
57
- * Performs device action for SmartThings
58
- * @param commands - Array of SmartThings device commands
59
- * @param deviceId - Device identifier
60
- * @param accessToken - Access token for authentication
61
- * @returns Promise with action result
62
- */
63
- performDeviceAction(commands: ISmartthingsDeviceCommand[], deviceId: string, accessToken: string): Promise<any>;
64
- /**
65
- * Gets device status for SmartThings
66
- * @param deviceId - Device identifier
67
- * @param accessToken - Access token for authentication
68
- * @returns Promise with device status
69
- */
70
- getDeviceStatus(deviceId: string, accessToken: string): Promise<any>;
71
- /**
72
- * Gets device lock status for SmartThings
73
- * @param deviceId - Device identifier
74
- * @param accessToken - Access token for authentication
75
- * @returns Promise with lock status
76
- */
77
- getDeviceLockStatus(deviceId: string, accessToken: string): Promise<any>;
78
- }
79
- /**
80
- * Interface for device command factory
81
- */
82
- export interface IDeviceCommandManagerFactory {
83
- /**
84
- * Creates a device command manager for a specific connection provider
85
- * @param connectionProvider - Connection provider type
86
- * @param connection - Connection object
87
- * @returns Device command manager instance
88
- */
89
- createDeviceCommandManager(connectionProvider: string, connection: IConnection): IDeviceCommandManager;
90
- }
91
- /**
92
- * Interface for device command classes
93
- */
94
- export interface IDeviceCommandClass {
95
- /**
96
- * Creates a SmartThings device command from a generic device command
97
- * @param deviceCommand - Generic device command
98
- * @returns SmartThings device command
99
- */
100
- fromDeviceCommand(deviceCommand: IDeviceCommand): ISmartthingsDeviceCommand;
101
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // Device Cloud Class Interface for DeviceThread Common Library
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- import { IConnection, IConnectionConnectParams, IDeviceAccountResponse } from "../types";
2
- export interface IDeviceConnectionService {
3
- createConnection(data: IConnection, userId: string): Promise<any>;
4
- getDeviceAccount(connection: IConnection): Promise<IDeviceAccountResponse>;
5
- getDevices(connection: IConnection): Promise<any>;
6
- connect(connection: IConnection, connectionConnect: IConnectionConnectParams): Promise<any>;
7
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // Device Cloud Class Interface for DeviceThread Common Library
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
1
- import { IConnection } from "../types";
2
- export interface IDeviceService {
3
- getDevices(connection: IConnection): Promise<Record<string, any>[]>;
4
- getDevice(connectionId: string, deviceId: string): Promise<Record<string, any>>;
5
- getStatus(connectionId: string, deviceId: string): Promise<string | null>;
6
- getState(deviceId: string): Promise<Record<string, any>>;
7
- getGateways(connectionId: string): Promise<any[] | null>;
8
- getGatewayDetails(connectionId: string, gatewayId: string): Promise<any>;
9
- }
@@ -1,39 +0,0 @@
1
- import { IDeviceService } from "../interfaces";
2
- import { IConnection, IDevice } from "../types";
3
- export declare abstract class DeviceService implements IDeviceService {
4
- deviceId: string;
5
- propertyId: string;
6
- name: string;
7
- hubId: string[];
8
- deviceType: {
9
- id: string;
10
- type: string;
11
- };
12
- status: {
13
- online: boolean;
14
- error?: {
15
- type?: string;
16
- message?: string;
17
- };
18
- lastUpdated?: string;
19
- };
20
- state?: Record<string, any>;
21
- metaData?: Record<string, any>;
22
- zone?: {
23
- id: string;
24
- name: string;
25
- zoneType: string;
26
- parentZone?: {
27
- id: string;
28
- name: string;
29
- zoneType: string;
30
- };
31
- };
32
- connection: IConnection;
33
- constructor(device: IDevice);
34
- abstract getDevices(connection: IConnection): Promise<Record<string, any>[]>;
35
- abstract getDevice(connectionId: string, deviceId: string): Promise<any>;
36
- abstract getBattery(deviceId: string): Promise<number | string>;
37
- abstract getStatus(connectionId: string, deviceId: string): Promise<string>;
38
- abstract getState(deviceId: string): Promise<string>;
39
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeviceService = void 0;
4
- class DeviceService {
5
- constructor(device) {
6
- Object.assign(this, device);
7
- }
8
- }
9
- exports.DeviceService = DeviceService;
@@ -1,42 +0,0 @@
1
- import { IDeviceCloudService } from "../interface";
2
- import { IConnection, IDevice, IDeviceAccountResponse, IConnectionConnectParams } from "../types";
3
- /**
4
- * Device Cloud Service Class
5
- * Implements IDeviceCloudService interface with empty implementations
6
- * Implementation will be provided by the consuming project
7
- */
8
- export declare class DeviceCloudService implements IDeviceCloudService {
9
- /**
10
- * Creates a new connection for device management
11
- * @param data - Connection data
12
- * @param userId - User identifier
13
- * @returns Promise with connection result
14
- */
15
- createConnection(data: IConnection, userId: string): Promise<any>;
16
- /**
17
- * Gets device account information for a connection
18
- * @param connection - Connection object
19
- * @returns Promise with device account response
20
- */
21
- getDeviceAccount(connection: IConnection): Promise<IDeviceAccountResponse>;
22
- /**
23
- * Gets all devices for a connection
24
- * @param connection - Connection object
25
- * @returns Promise with array of devices
26
- */
27
- getDevices(connection: IConnection): Promise<IDevice[]>;
28
- /**
29
- * Filters devices based on connection and device list
30
- * @param connection - Connection object
31
- * @param devices - Array of devices to filter
32
- * @returns Promise with filtered devices
33
- */
34
- filterDevices(connection: IConnection, devices: any[]): Promise<IDevice[]>;
35
- /**
36
- * Connects to a device service
37
- * @param connection - Connection object
38
- * @param connectionConnect - Connection parameters
39
- * @returns Promise with connection result
40
- */
41
- connect(connection: IConnection, connectionConnect: IConnectionConnectParams): Promise<any>;
42
- }
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeviceCloudService = void 0;
4
- /**
5
- * Device Cloud Service Class
6
- * Implements IDeviceCloudService interface with empty implementations
7
- * Implementation will be provided by the consuming project
8
- */
9
- class DeviceCloudService {
10
- /**
11
- * Creates a new connection for device management
12
- * @param data - Connection data
13
- * @param userId - User identifier
14
- * @returns Promise with connection result
15
- */
16
- async createConnection(data, userId) {
17
- // Implementation will be provided by the consuming project
18
- throw new Error("createConnection method not implemented");
19
- }
20
- /**
21
- * Gets device account information for a connection
22
- * @param connection - Connection object
23
- * @returns Promise with device account response
24
- */
25
- async getDeviceAccount(connection) {
26
- // Implementation will be provided by the consuming project
27
- throw new Error("getDeviceAccount method not implemented");
28
- }
29
- /**
30
- * Gets all devices for a connection
31
- * @param connection - Connection object
32
- * @returns Promise with array of devices
33
- */
34
- async getDevices(connection) {
35
- // Implementation will be provided by the consuming project
36
- throw new Error("getDevices method not implemented");
37
- }
38
- /**
39
- * Filters devices based on connection and device list
40
- * @param connection - Connection object
41
- * @param devices - Array of devices to filter
42
- * @returns Promise with filtered devices
43
- */
44
- async filterDevices(connection, devices) {
45
- // Implementation will be provided by the consuming project
46
- throw new Error("filterDevices method not implemented");
47
- }
48
- /**
49
- * Connects to a device service
50
- * @param connection - Connection object
51
- * @param connectionConnect - Connection parameters
52
- * @returns Promise with connection result
53
- */
54
- async connect(connection, connectionConnect) {
55
- // Implementation will be provided by the consuming project
56
- throw new Error("connect method not implemented");
57
- }
58
- }
59
- exports.DeviceCloudService = DeviceCloudService;
@@ -1,3 +0,0 @@
1
- export declare abstract class DeviceHubService {
2
- abstract getHubs(): Promise<any>;
3
- }
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeviceHubService = void 0;
4
- class DeviceHubService {
5
- }
6
- exports.DeviceHubService = DeviceHubService;
@@ -1,25 +0,0 @@
1
- import { IHubService } from "../interfaces";
2
- import { IConnection, IDevice } from "../types";
3
- export declare abstract class HubService implements IHubService {
4
- deviceId: string;
5
- propertyId: string;
6
- name: string;
7
- deviceType: {
8
- id: string;
9
- type: string;
10
- };
11
- status: {
12
- online: boolean;
13
- error?: {
14
- type?: string;
15
- message?: string;
16
- };
17
- lastUpdated?: string;
18
- };
19
- metaData?: Record<string, any>;
20
- connection: IConnection;
21
- constructor(hub: IDevice);
22
- abstract getHubs(connectionId: string): Promise<any[] | null>;
23
- abstract getHub(connectionId: string, hubId: string): Promise<Record<string, any>>;
24
- abstract getStatus(connectionId: string, hubId: string): Promise<string>;
25
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HubService = void 0;
4
- class HubService {
5
- constructor(hub) {
6
- Object.assign(this, hub);
7
- }
8
- }
9
- exports.HubService = HubService;
@@ -1,38 +0,0 @@
1
- import { ISmartthingsDeviceCommandManager } from "../interface";
2
- import { IDeviceCommand, ISmartthingsDeviceCommand, ICommandResponse } from "../types";
3
- /**
4
- * SmartThings Device Service Class
5
- * Implements ISmartthingsDeviceCommandManager interface with empty implementations
6
- * Implementation will be provided by the consuming project
7
- */
8
- export declare class SmartThingsDeviceService implements ISmartthingsDeviceCommandManager {
9
- /**
10
- * Invokes a command on a device
11
- * @param command - Device command to execute
12
- * @param deviceId - Device identifier
13
- * @returns Promise with command response
14
- */
15
- invokeCommand(command: IDeviceCommand, deviceId: string): Promise<ICommandResponse>;
16
- /**
17
- * Performs device action for SmartThings
18
- * @param commands - Array of SmartThings device commands
19
- * @param deviceId - Device identifier
20
- * @param accessToken - Access token for authentication
21
- * @returns Promise with action result
22
- */
23
- performDeviceAction(commands: ISmartthingsDeviceCommand[], deviceId: string, accessToken: string): Promise<any>;
24
- /**
25
- * Gets device status for SmartThings
26
- * @param deviceId - Device identifier
27
- * @param accessToken - Access token for authentication
28
- * @returns Promise with device status
29
- */
30
- getDeviceStatus(deviceId: string, accessToken: string): Promise<any>;
31
- /**
32
- * Gets device lock status for SmartThings
33
- * @param deviceId - Device identifier
34
- * @param accessToken - Access token for authentication
35
- * @returns Promise with lock status
36
- */
37
- getDeviceLockStatus(deviceId: string, accessToken: string): Promise<any>;
38
- }