dt-common-device 1.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 (58) hide show
  1. package/README.md +73 -0
  2. package/dist/device/cloud/interface.d.ts +101 -0
  3. package/dist/device/cloud/interface.js +3 -0
  4. package/dist/device/cloud/interfaces/IDeviceConnectionService.d.ts +39 -0
  5. package/dist/device/cloud/interfaces/IDeviceConnectionService.js +3 -0
  6. package/dist/device/cloud/interfaces/IDevicesService.d.ts +9 -0
  7. package/dist/device/cloud/interfaces/IDevicesService.js +2 -0
  8. package/dist/device/cloud/interfaces/index.d.ts +2 -0
  9. package/dist/device/cloud/interfaces/index.js +18 -0
  10. package/dist/device/cloud/services/Connection.service.d.ts +42 -0
  11. package/dist/device/cloud/services/Connection.service.js +59 -0
  12. package/dist/device/cloud/services/Device.service.d.ts +10 -0
  13. package/dist/device/cloud/services/Device.service.js +30 -0
  14. package/dist/device/cloud/services/DeviceCloudService.d.ts +42 -0
  15. package/dist/device/cloud/services/DeviceCloudService.js +59 -0
  16. package/dist/device/cloud/services/DeviceHub.service.d.ts +3 -0
  17. package/dist/device/cloud/services/DeviceHub.service.js +10 -0
  18. package/dist/device/cloud/services/SmartThingsDeviceService.d.ts +38 -0
  19. package/dist/device/cloud/services/SmartThingsDeviceService.js +52 -0
  20. package/dist/device/cloud/services/index.d.ts +2 -0
  21. package/dist/device/cloud/services/index.js +19 -0
  22. package/dist/device/cloud/types.d.ts +77 -0
  23. package/dist/device/cloud/types.js +3 -0
  24. package/dist/device/index.d.ts +4 -0
  25. package/dist/device/index.js +20 -0
  26. package/dist/device/local/interface.d.ts +0 -0
  27. package/dist/device/local/interface.js +1 -0
  28. package/dist/device/local/interfaces/IDevice.d.ts +46 -0
  29. package/dist/device/local/interfaces/IDevice.js +3 -0
  30. package/dist/device/local/interfaces/IHub.d.ts +46 -0
  31. package/dist/device/local/interfaces/IHub.js +2 -0
  32. package/dist/device/local/interfaces/index.d.ts +2 -0
  33. package/dist/device/local/interfaces/index.js +18 -0
  34. package/dist/device/local/services/Device.service.d.ts +18 -0
  35. package/dist/device/local/services/Device.service.js +27 -0
  36. package/dist/device/local/services/DeviceHub.service.d.ts +21 -0
  37. package/dist/device/local/services/DeviceHub.service.js +28 -0
  38. package/dist/device/local/services/index.d.ts +2 -0
  39. package/dist/device/local/services/index.js +18 -0
  40. package/dist/index.d.ts +5 -0
  41. package/dist/index.js +47 -0
  42. package/package.json +21 -0
  43. package/src/device/cloud/interfaces/IDeviceConnectionService.ts +54 -0
  44. package/src/device/cloud/interfaces/IDevicesService.ts +10 -0
  45. package/src/device/cloud/interfaces/index.ts +2 -0
  46. package/src/device/cloud/services/Connection.service.ts +76 -0
  47. package/src/device/cloud/services/Device.service.ts +40 -0
  48. package/src/device/cloud/services/DeviceHub.service.ts +6 -0
  49. package/src/device/cloud/services/index.ts +4 -0
  50. package/src/device/cloud/types.ts +83 -0
  51. package/src/device/local/interfaces/IDevice.ts +48 -0
  52. package/src/device/local/interfaces/IHub.ts +46 -0
  53. package/src/device/local/interfaces/index.ts +2 -0
  54. package/src/device/local/services/Device.service.ts +46 -0
  55. package/src/device/local/services/DeviceHub.service.ts +50 -0
  56. package/src/device/local/services/index.ts +2 -0
  57. package/src/index.ts +10 -0
  58. package/tsconfig.json +20 -0
@@ -0,0 +1,77 @@
1
+ export interface IConnection {
2
+ connectionName: string;
3
+ connectionRefId: string;
4
+ propertyId: string;
5
+ connectionProvider: ConnectionProvider;
6
+ accessToken?: string;
7
+ clientId?: string;
8
+ clientSecret?: string;
9
+ }
10
+ export interface IDevice {
11
+ deviceId: string;
12
+ propertyId: string;
13
+ name: string;
14
+ hubId: string[];
15
+ specifications?: {
16
+ manufacturer?: string;
17
+ model?: string;
18
+ firmware?: {
19
+ version?: string;
20
+ newVersionAvailable?: boolean;
21
+ newVersion?: string;
22
+ mandatoryUpdate?: boolean;
23
+ };
24
+ };
25
+ protocol?: {
26
+ location?: {
27
+ id?: string;
28
+ name?: string;
29
+ city?: string;
30
+ };
31
+ name?: string;
32
+ room?: {
33
+ id?: string;
34
+ name?: string;
35
+ };
36
+ accountId?: string;
37
+ };
38
+ deviceType: {
39
+ id: string;
40
+ type: string;
41
+ };
42
+ status: {
43
+ online: boolean;
44
+ error?: {
45
+ type?: string;
46
+ message?: string;
47
+ };
48
+ lastUpdated?: string;
49
+ };
50
+ state?: Record<string, any>;
51
+ metaData?: Record<string, any>;
52
+ hubDeviceDetails?: IDevice[];
53
+ }
54
+ export interface IDeviceAccountResponse {
55
+ id: string;
56
+ connection_name: string;
57
+ connection_access_token: string;
58
+ connection_provider: string;
59
+ totalDevices: number;
60
+ connection_ref_id: string;
61
+ isActive: boolean;
62
+ }
63
+ export interface IConnectionConnectParams {
64
+ code?: string;
65
+ propertyId?: string;
66
+ [key: string]: any;
67
+ }
68
+ export interface ConnectionProvider {
69
+ Smartthings: "Smartthings";
70
+ SaltoKS: "SaltoKS";
71
+ Tuya: "Tuya";
72
+ TTLock: "TTLock";
73
+ Schlage: "Schlage";
74
+ YaleWifi: "YaleWifi";
75
+ Devicethread: "Devicethread";
76
+ Sensibo: "Sensibo";
77
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // Device Cloud Type Interfaces for DeviceThread Common Library
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
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";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ // DeviceThread Common Library - Device Module
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ // Export cloud device interfaces
19
+ __exportStar(require("./cloud/interface"), exports);
20
+ __exportStar(require("./cloud/types"), exports);
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,46 @@
1
+ export interface IDeviceCreateParams {
2
+ deviceId: string;
3
+ propertyId: string;
4
+ name: string;
5
+ hubId?: string[];
6
+ specifications: {
7
+ manufacturer?: string;
8
+ model?: string;
9
+ firmware?: {
10
+ version?: string;
11
+ newVersionAvailable?: boolean;
12
+ newVersion?: string;
13
+ mandatoryUpdate?: boolean;
14
+ };
15
+ };
16
+ protocol: {
17
+ location?: {
18
+ id?: string;
19
+ name?: string;
20
+ city?: string;
21
+ };
22
+ name?: string;
23
+ room?: {
24
+ id?: string;
25
+ name?: string;
26
+ };
27
+ accountId?: string;
28
+ };
29
+ deviceType: {
30
+ id: string;
31
+ type: string;
32
+ };
33
+ status: {
34
+ online: boolean;
35
+ error?: {
36
+ type?: string;
37
+ message?: string;
38
+ default?: object;
39
+ };
40
+ lastUpdated?: Date;
41
+ };
42
+ state?: object;
43
+ metaData?: object;
44
+ createdAt?: Date;
45
+ updatedAt?: Date;
46
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // Interfaces for DeviceService methods
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,46 @@
1
+ export interface IHubCreateParams {
2
+ deviceId: string;
3
+ propertyId: string;
4
+ name: string;
5
+ hubId?: string[];
6
+ specifications: {
7
+ manufacturer?: string;
8
+ model?: string;
9
+ firmware?: {
10
+ version?: string;
11
+ newVersionAvailable?: boolean;
12
+ newVersion?: string;
13
+ mandatoryUpdate?: boolean;
14
+ };
15
+ };
16
+ protocol: {
17
+ location?: {
18
+ id?: string;
19
+ name?: string;
20
+ city?: string;
21
+ };
22
+ name?: string;
23
+ room?: {
24
+ id?: string;
25
+ name?: string;
26
+ };
27
+ accountId?: string;
28
+ };
29
+ deviceType: {
30
+ id: string;
31
+ type: string;
32
+ };
33
+ status: {
34
+ online: boolean;
35
+ error?: {
36
+ type?: string;
37
+ message?: string;
38
+ default?: object;
39
+ };
40
+ lastUpdated?: Date;
41
+ };
42
+ state?: object;
43
+ metaData?: object;
44
+ createdAt?: Date;
45
+ updatedAt?: Date;
46
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from "./IDevice";
2
+ export * from "./IHub";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./IDevice"), exports);
18
+ __exportStar(require("./IHub"), exports);
@@ -0,0 +1,18 @@
1
+ import { IDeviceCreateParams } from "../interfaces";
2
+ export declare class DeviceService {
3
+ createDevice(body: IDeviceCreateParams, httpClient: {
4
+ post: (url: string, options: any) => Promise<any>;
5
+ }): Promise<void>;
6
+ getDevice(deviceId: string, httpClient: {
7
+ get: (url: string) => Promise<any>;
8
+ }): Promise<any>;
9
+ getPropertyDevices(propertyId: string, httpClient: {
10
+ get: (url: string, options: any) => Promise<any>;
11
+ }): Promise<any>;
12
+ updateDevice(deviceId: string, body: any, httpClient: {
13
+ put: (url: string, options: any) => Promise<any>;
14
+ }): Promise<any>;
15
+ deleteDevice(deviceId: string, httpClient: {
16
+ delete: (url: string) => Promise<any>;
17
+ }): Promise<any>;
18
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ // src/device/local/services/Device.service.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.DeviceService = void 0;
5
+ class DeviceService {
6
+ async createDevice(body, httpClient) {
7
+ // Create main device
8
+ await httpClient.post("/devices", { body });
9
+ }
10
+ async getDevice(deviceId, httpClient) {
11
+ return await httpClient.get(`/devices/${deviceId}`);
12
+ }
13
+ async getPropertyDevices(propertyId, httpClient) {
14
+ return await httpClient.get(`/devices`, {
15
+ params: {
16
+ propertyId,
17
+ },
18
+ });
19
+ }
20
+ async updateDevice(deviceId, body, httpClient) {
21
+ return await httpClient.put(`/devices/${deviceId}`, { body });
22
+ }
23
+ async deleteDevice(deviceId, httpClient) {
24
+ return await httpClient.delete(`/devices/${deviceId}`);
25
+ }
26
+ }
27
+ exports.DeviceService = DeviceService;
@@ -0,0 +1,21 @@
1
+ import { IHubCreateParams } from "../interfaces";
2
+ export declare class DeviceHubService {
3
+ addHub(body: IHubCreateParams, httpClient: {
4
+ post: (url: string, options: any) => Promise<any>;
5
+ }): Promise<any>;
6
+ getHubs(hubIds: string[], httpClient: {
7
+ get: (url: string, options?: any) => Promise<any>;
8
+ }): Promise<any>;
9
+ getHub(hubId: string, httpClient: {
10
+ get: (url: string) => Promise<any>;
11
+ }): Promise<any>;
12
+ updateHub(hubId: string, body: any, httpClient: {
13
+ put: (url: string, options: any) => Promise<any>;
14
+ }): Promise<any>;
15
+ deleteHub(hubId: string, httpClient: {
16
+ delete: (url: string) => Promise<any>;
17
+ }): Promise<any>;
18
+ deleteAllHubs(hubIds: string[], httpClient: {
19
+ delete: (url: string) => Promise<any>;
20
+ }): Promise<any>;
21
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeviceHubService = void 0;
4
+ class DeviceHubService {
5
+ async addHub(body, httpClient) {
6
+ return await httpClient.post(`/devices/hubs`, { body });
7
+ }
8
+ //get hubs takes an array of hub ids as query params
9
+ async getHubs(hubIds, httpClient) {
10
+ const query = hubIds && hubIds.length ? `?ids=${hubIds.join(",")}` : "";
11
+ return await httpClient.get(`/devices/hubs${query}`);
12
+ }
13
+ //get hub takes a hub id in params
14
+ async getHub(hubId, httpClient) {
15
+ return await httpClient.get(`/devices/hubs/${hubId}`);
16
+ }
17
+ async updateHub(hubId, body, httpClient) {
18
+ return await httpClient.put(`/devices/hubs/${hubId}`, { body });
19
+ }
20
+ async deleteHub(hubId, httpClient) {
21
+ return await httpClient.delete(`/devices/hubs/${hubId}`);
22
+ }
23
+ async deleteAllHubs(hubIds, httpClient) {
24
+ const query = hubIds.length ? `?ids=${hubIds.join(",")}` : "";
25
+ return await httpClient.delete(`/devices/hubs${query}`);
26
+ }
27
+ }
28
+ exports.DeviceHubService = DeviceHubService;
@@ -0,0 +1,2 @@
1
+ export * from "./Device.service";
2
+ export * from "./DeviceHub.service";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Device.service"), exports);
18
+ __exportStar(require("./DeviceHub.service"), exports);
@@ -0,0 +1,5 @@
1
+ export * as cloud from "./device/cloud/services";
2
+ export * as cloudInterfaces from "./device/cloud/interfaces";
3
+ export * from "./device/cloud/types";
4
+ export * as local from "./device/local/services";
5
+ export * as localInterfaces from "./device/local/interfaces";
package/dist/index.js ADDED
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ // Main entry point for dt-common-device
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
37
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.localInterfaces = exports.local = exports.cloudInterfaces = exports.cloud = void 0;
41
+ // Cloud exports
42
+ exports.cloud = __importStar(require("./device/cloud/services"));
43
+ exports.cloudInterfaces = __importStar(require("./device/cloud/interfaces"));
44
+ __exportStar(require("./device/cloud/types"), exports);
45
+ // Local exports
46
+ exports.local = __importStar(require("./device/local/services"));
47
+ exports.localInterfaces = __importStar(require("./device/local/interfaces"));
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "dt-common-device",
3
+ "version": "1.0.0",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "build": "tsc"
9
+ },
10
+ "keywords": [],
11
+ "author": "",
12
+ "license": "ISC",
13
+ "description": "",
14
+ "devDependencies": {
15
+ "ts-node": "^10.9.2",
16
+ "typescript": "^5.8.3"
17
+ },
18
+ "dependencies": {
19
+ "axios": "^1.10.0"
20
+ }
21
+ }
@@ -0,0 +1,54 @@
1
+ // Device Cloud Class Interface for DeviceThread Common Library
2
+
3
+ import {
4
+ IConnection,
5
+ IConnectionConnectParams,
6
+ IDevice,
7
+ IDeviceAccountResponse,
8
+ } from "../types";
9
+
10
+ /**
11
+ * Class interface for device cloud operations and connection management
12
+ */
13
+ export interface IDeviceConnectionService {
14
+ /**
15
+ * Creates a new connection for device management
16
+ * @param data - Connection data
17
+ * @param userId - User identifier
18
+ * @returns Promise with connection result
19
+ */
20
+ createConnection(data: IConnection, userId: string): Promise<any>;
21
+
22
+ /**
23
+ * Gets device account information for a connection
24
+ * @param connection - Connection object
25
+ * @returns Promise with device account response
26
+ */
27
+ getDeviceAccount(connection: IConnection): Promise<IDeviceAccountResponse>;
28
+
29
+ /**
30
+ * Gets all devices for a connection
31
+ * @param connection - Connection object
32
+ * @returns Promise with array of devices
33
+ */
34
+ getDevices(connection: IConnection): Promise<any>;
35
+
36
+ /**
37
+ * Filters devices based on connection and device list
38
+ * @param connection - Connection object
39
+ * @param devices - Array of devices to filter
40
+ * @returns Promise with filtered devices
41
+ */
42
+ filterDevices(connection: IConnection, devices: any[]): Promise<IDevice[]>;
43
+
44
+ /**
45
+ * Connects to a device service
46
+ * @param connection - Connection object
47
+ * @param connectionConnect - Connection parameters
48
+ * @returns Promise with connection result
49
+ */
50
+ connect(
51
+ connection: IConnection,
52
+ connectionConnect: IConnectionConnectParams
53
+ ): Promise<any>;
54
+ }
@@ -0,0 +1,10 @@
1
+ import { IConnection } from "../types";
2
+
3
+ export interface IDeviceService {
4
+ getDevices(connection: IConnection): Promise<any[]>;
5
+ getDevice(connectionId: string, deviceId: string): Promise<any>;
6
+ getStatus(connectionId: string, deviceId: string): Promise<string | null>;
7
+ getState(deviceId: string): Promise<any>;
8
+ getGateways(connectionId: string): Promise<any[] | null>;
9
+ getGatewayDetails(connectionId: string, gatewayId: string): Promise<any>;
10
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./IDeviceConnectionService";
2
+ export * from "./IDevicesService";
@@ -0,0 +1,76 @@
1
+ // Device Cloud Service - Class Implementation
2
+ import { IDeviceConnectionService } from "../interfaces";
3
+ import {
4
+ IConnection,
5
+ IConnectionConnectParams,
6
+ IDevice,
7
+ IDeviceAccountResponse,
8
+ } from "../types";
9
+
10
+ /**
11
+ * Device Cloud Service Class
12
+ * Implements IDeviceCloudService interface with empty implementations
13
+ * Implementation will be provided by the consuming project
14
+ */
15
+ export class ConnectionService implements IDeviceConnectionService {
16
+ /**
17
+ * Creates a new connection for device management
18
+ * @param data - Connection data
19
+ * @param userId - User identifier
20
+ * @returns Promise with connection result
21
+ */
22
+ async createConnection(data: IConnection, userId: string): Promise<any> {
23
+ // Implementation will be provided by the consuming project
24
+ throw new Error("createConnection method not implemented");
25
+ }
26
+
27
+ /**
28
+ * Gets device account information for a connection
29
+ * @param connection - Connection object
30
+ * @returns Promise with device account response
31
+ */
32
+ async getDeviceAccount(
33
+ connection: IConnection
34
+ ): Promise<IDeviceAccountResponse> {
35
+ // Implementation will be provided by the consuming project
36
+ throw new Error("getDeviceAccount method not implemented");
37
+ }
38
+
39
+ /**
40
+ * Gets all devices for a connection
41
+ * @param connection - Connection object
42
+ * @returns Promise with array of devices
43
+ */
44
+ async getDevices(connection: IConnection): Promise<any> {
45
+ // Implementation will be provided by the consuming project
46
+ throw new Error("getDevices method not implemented");
47
+ }
48
+
49
+ /**
50
+ * Filters devices based on connection and device list
51
+ * @param connection - Connection object
52
+ * @param devices - Array of devices to filter
53
+ * @returns Promise with filtered devices
54
+ */
55
+ async filterDevices(
56
+ connection: IConnection,
57
+ devices: any[]
58
+ ): Promise<IDevice[]> {
59
+ // Implementation will be provided by the consuming project
60
+ throw new Error("filterDevices method not implemented");
61
+ }
62
+
63
+ /**
64
+ * Connects to a device service
65
+ * @param connection - Connection object
66
+ * @param connectionConnect - Connection parameters
67
+ * @returns Promise with connection result
68
+ */
69
+ async connect(
70
+ connection: IConnection,
71
+ connectionConnect: IConnectionConnectParams
72
+ ): Promise<any> {
73
+ // Implementation will be provided by the consuming project
74
+ throw new Error("connect method not implemented");
75
+ }
76
+ }
@@ -0,0 +1,40 @@
1
+ import { IDeviceService } from "../interfaces";
2
+ import { IConnection } from "../types";
3
+
4
+ export class DeviceService implements IDeviceService {
5
+ async getDevices(connection: IConnection): Promise<any[]> {
6
+ // Implementation will be provided by the consuming project
7
+ throw new Error("getDevices method not implemented");
8
+ }
9
+
10
+ async getDevice(connectionId: string, deviceId: string): Promise<any> {
11
+ // Implementation will be provided by the consuming project
12
+ throw new Error("getDevice method not implemented");
13
+ }
14
+
15
+ async getStatus(
16
+ connectionId: string,
17
+ deviceId: string
18
+ ): Promise<string | null> {
19
+ // Implementation will be provided by the consuming project
20
+ throw new Error("getDeviceStatus method not implemented");
21
+ }
22
+
23
+ async getState(deviceId: string): Promise<any> {
24
+ // Implementation will be provided by the consuming project
25
+ throw new Error("getState method not implemented");
26
+ }
27
+
28
+ async getGateways(connectionId: string): Promise<any[] | null> {
29
+ // Implementation will be provided by the consuming project
30
+ throw new Error("getGateways method not implemented");
31
+ }
32
+
33
+ async getGatewayDetails(
34
+ connectionId: string,
35
+ gatewayId: string
36
+ ): Promise<any> {
37
+ // Implementation will be provided by the consuming project
38
+ throw new Error("getGatewayDetails method not implemented");
39
+ }
40
+ }
@@ -0,0 +1,6 @@
1
+ export class DeviceHubService {
2
+ async getHubs(): Promise<any> {
3
+ // implements will be provided by the consuming project
4
+ throw new Error("getHubs method not implemented");
5
+ }
6
+ }
@@ -0,0 +1,4 @@
1
+ // Device Cloud Services - Export all service classes
2
+
3
+ export * from "./Connection.service";
4
+ export * from "./Device.service";