dt-common-device 1.0.1 → 1.0.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.
@@ -1,39 +1,8 @@
1
1
  import { IConnection, IConnectionConnectParams, IDevice, IDeviceAccountResponse } from "../types";
2
- /**
3
- * Class interface for device cloud operations and connection management
4
- */
5
2
  export interface IDeviceConnectionService {
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
3
  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
4
  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<any>;
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
- */
5
+ getDevices(connection: IConnection): Promise<IDevice[]>;
6
+ filterDevices(connection: IConnection, devices: Record<string, any>[]): Promise<IDevice[]>;
38
7
  connect(connection: IConnection, connectionConnect: IConnectionConnectParams): Promise<any>;
39
8
  }
@@ -1,42 +1,9 @@
1
1
  import { IDeviceConnectionService } from "../interfaces";
2
2
  import { IConnection, IDevice, IDeviceAccountResponse } 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
3
  export declare class ConnectionService implements IDeviceConnectionService {
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
4
  createConnection(data: IConnection, userId: string): Promise<void>;
16
- /**
17
- * Gets device account information for a connection
18
- * @param connection - Connection object
19
- * @returns Promise with device account response
20
- */
21
5
  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<Record<string, any>[]>;
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
- */
6
+ getDevices(connection: IConnection): Promise<IDevice[]>;
34
7
  filterDevices(connection: IConnection, devices: Record<string, 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
8
  connect(connection: IConnection): Promise<void>;
42
9
  }
@@ -1,56 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectionService = 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
4
  class ConnectionService {
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
5
  async createConnection(data, userId) {
17
6
  // Implementation will be provided by the consuming project
18
7
  throw new Error("createConnection method not implemented");
19
8
  }
20
- /**
21
- * Gets device account information for a connection
22
- * @param connection - Connection object
23
- * @returns Promise with device account response
24
- */
25
9
  async getDeviceAccount(connection) {
26
10
  // Implementation will be provided by the consuming project
27
11
  throw new Error("getDeviceAccount method not implemented");
28
12
  }
29
- /**
30
- * Gets all devices for a connection
31
- * @param connection - Connection object
32
- * @returns Promise with array of devices
33
- */
34
13
  async getDevices(connection) {
35
14
  // Implementation will be provided by the consuming project
36
15
  throw new Error("getDevices method not implemented");
37
16
  }
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
17
  async filterDevices(connection, devices) {
45
18
  // Implementation will be provided by the consuming project
46
19
  throw new Error("filterDevices method not implemented");
47
20
  }
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
21
  async connect(connection) {
55
22
  // Implementation will be provided by the consuming project
56
23
  throw new Error("connect method not implemented");
@@ -1,28 +1,20 @@
1
- /**
2
- * Base entity for all models.
3
- * All date fields must be ISO 8601 strings.
4
- */
5
- export declare class BaseEntity {
6
- id?: string;
7
- createdAt?: string;
8
- updatedAt?: string;
9
- }
10
1
  /**
11
2
  * Represents a connection to a device provider.
12
3
  * WARNING: Do not log or expose sensitive fields (accessToken, clientSecret).
13
4
  */
14
- export interface IConnection extends BaseEntity {
5
+ export interface IConnection {
15
6
  connectionName: string;
16
7
  connectionRefId: string;
17
8
  propertyId: string;
18
9
  connectionProvider: ConnectionProvider;
19
- /** Sensitive. */
20
10
  accessToken?: string;
21
- /** Sensitive. */
22
11
  clientId?: string;
23
- /** Sensitive. */
24
12
  clientSecret?: string;
25
13
  }
14
+ export interface IConnectionPagination {
15
+ page: number;
16
+ limit: number;
17
+ }
26
18
  /**
27
19
  * Represents a device in the system.
28
20
  * All date fields must be ISO 8601 strings.
@@ -67,9 +59,20 @@ export interface IDevice {
67
59
  };
68
60
  lastUpdated?: string;
69
61
  };
70
- state?: Record<string, unknown>;
71
- metaData?: Record<string, unknown>;
62
+ state?: Record<string, any>;
63
+ metaData?: Record<string, any>;
64
+ createdAt?: Date;
65
+ updatedAt?: Date;
66
+ isDeleted?: boolean;
72
67
  hubDeviceDetails?: IDevice[];
68
+ parentZones?: {
69
+ id: string;
70
+ name: string;
71
+ }[];
72
+ zone?: {
73
+ id: string;
74
+ name: string;
75
+ };
73
76
  }
74
77
  /**
75
78
  * Device account response from provider.
@@ -78,7 +81,6 @@ export interface IDevice {
78
81
  export interface IDeviceAccountResponse {
79
82
  id: string;
80
83
  connection_name: string;
81
- /** Sensitive. */
82
84
  connection_access_token: string;
83
85
  connection_provider: string;
84
86
  totalDevices: number;
@@ -1,11 +1,3 @@
1
1
  "use strict";
2
2
  // Device Cloud Type Interfaces for DeviceThread Common Library
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.BaseEntity = void 0;
5
- /**
6
- * Base entity for all models.
7
- * All date fields must be ISO 8601 strings.
8
- */
9
- class BaseEntity {
10
- }
11
- exports.BaseEntity = BaseEntity;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -7,46 +7,18 @@ import {
7
7
  IDeviceAccountResponse,
8
8
  } from "../types";
9
9
 
10
- /**
11
- * Class interface for device cloud operations and connection management
12
- */
13
10
  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
11
  createConnection(data: IConnection, userId: string): Promise<any>;
21
12
 
22
- /**
23
- * Gets device account information for a connection
24
- * @param connection - Connection object
25
- * @returns Promise with device account response
26
- */
27
13
  getDeviceAccount(connection: IConnection): Promise<IDeviceAccountResponse>;
28
14
 
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>;
15
+ getDevices(connection: IConnection): Promise<IDevice[]>;
35
16
 
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[]>;
17
+ filterDevices(
18
+ connection: IConnection,
19
+ devices: Record<string, any>[]
20
+ ): Promise<IDevice[]>;
43
21
 
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
22
  connect(
51
23
  connection: IConnection,
52
24
  connectionConnect: IConnectionConnectParams
@@ -2,28 +2,12 @@
2
2
  import { IDeviceConnectionService } from "../interfaces";
3
3
  import { IConnection, IDevice, IDeviceAccountResponse } from "../types";
4
4
 
5
- /**
6
- * Device Cloud Service Class
7
- * Implements IDeviceCloudService interface with empty implementations
8
- * Implementation will be provided by the consuming project
9
- */
10
5
  export class ConnectionService implements IDeviceConnectionService {
11
- /**
12
- * Creates a new connection for device management
13
- * @param data - Connection data
14
- * @param userId - User identifier
15
- * @returns Promise with connection result
16
- */
17
6
  async createConnection(data: IConnection, userId: string) {
18
7
  // Implementation will be provided by the consuming project
19
8
  throw new Error("createConnection method not implemented");
20
9
  }
21
10
 
22
- /**
23
- * Gets device account information for a connection
24
- * @param connection - Connection object
25
- * @returns Promise with device account response
26
- */
27
11
  async getDeviceAccount(
28
12
  connection: IConnection
29
13
  ): Promise<IDeviceAccountResponse> {
@@ -31,22 +15,11 @@ export class ConnectionService implements IDeviceConnectionService {
31
15
  throw new Error("getDeviceAccount method not implemented");
32
16
  }
33
17
 
34
- /**
35
- * Gets all devices for a connection
36
- * @param connection - Connection object
37
- * @returns Promise with array of devices
38
- */
39
- async getDevices(connection: IConnection): Promise<Record<string, any>[]> {
18
+ async getDevices(connection: IConnection): Promise<IDevice[]> {
40
19
  // Implementation will be provided by the consuming project
41
20
  throw new Error("getDevices method not implemented");
42
21
  }
43
22
 
44
- /**
45
- * Filters devices based on connection and device list
46
- * @param connection - Connection object
47
- * @param devices - Array of devices to filter
48
- * @returns Promise with filtered devices
49
- */
50
23
  async filterDevices(
51
24
  connection: IConnection,
52
25
  devices: Record<string, any>[]
@@ -55,12 +28,6 @@ export class ConnectionService implements IDeviceConnectionService {
55
28
  throw new Error("filterDevices method not implemented");
56
29
  }
57
30
 
58
- /**
59
- * Connects to a device service
60
- * @param connection - Connection object
61
- * @param connectionConnect - Connection parameters
62
- * @returns Promise with connection result
63
- */
64
31
  async connect(connection: IConnection) {
65
32
  // Implementation will be provided by the consuming project
66
33
  throw new Error("connect method not implemented");
@@ -1,32 +1,24 @@
1
1
  // Device Cloud Type Interfaces for DeviceThread Common Library
2
2
 
3
- /**
4
- * Base entity for all models.
5
- * All date fields must be ISO 8601 strings.
6
- */
7
- export class BaseEntity {
8
- id?: string;
9
- createdAt?: string; // ISO 8601
10
- updatedAt?: string; // ISO 8601
11
- }
12
-
13
3
  /**
14
4
  * Represents a connection to a device provider.
15
5
  * WARNING: Do not log or expose sensitive fields (accessToken, clientSecret).
16
6
  */
17
- export interface IConnection extends BaseEntity {
7
+ export interface IConnection {
18
8
  connectionName: string;
19
9
  connectionRefId: string;
20
10
  propertyId: string;
21
11
  connectionProvider: ConnectionProvider;
22
- /** Sensitive. */
23
12
  accessToken?: string;
24
- /** Sensitive. */
25
13
  clientId?: string;
26
- /** Sensitive. */
27
14
  clientSecret?: string;
28
15
  }
29
16
 
17
+ export interface IConnectionPagination {
18
+ page: number;
19
+ limit: number;
20
+ }
21
+
30
22
  /**
31
23
  * Represents a device in the system.
32
24
  * All date fields must be ISO 8601 strings.
@@ -69,11 +61,16 @@ export interface IDevice {
69
61
  type?: string;
70
62
  message?: string;
71
63
  };
72
- lastUpdated?: string; // ISO 8601
64
+ lastUpdated?: string;
73
65
  };
74
- state?: Record<string, unknown>;
75
- metaData?: Record<string, unknown>;
66
+ state?: Record<string, any>;
67
+ metaData?: Record<string, any>;
68
+ createdAt?: Date;
69
+ updatedAt?: Date;
70
+ isDeleted?: boolean;
76
71
  hubDeviceDetails?: IDevice[];
72
+ parentZones?: { id: string; name: string }[];
73
+ zone?: { id: string; name: string };
77
74
  }
78
75
 
79
76
  /**
@@ -83,7 +80,6 @@ export interface IDevice {
83
80
  export interface IDeviceAccountResponse {
84
81
  id: string;
85
82
  connection_name: string;
86
- /** Sensitive. */
87
83
  connection_access_token: string;
88
84
  connection_provider: string;
89
85
  totalDevices: number;