dt-common-device 1.0.15 → 1.0.16

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.
@@ -39,13 +39,13 @@ export interface IConnectionConnectParams {
39
39
  propertyId?: string;
40
40
  [key: string]: unknown;
41
41
  }
42
- export interface ConnectionProvider {
43
- DEVICETHREAD: "Devicethread";
44
- SMARTTHINGS: "Smartthings";
45
- SALTOKS: "SaltoKS";
46
- TUYA: "Tuya";
47
- TTLOCK: "TTLock";
48
- SCHLAGE: "Schlage";
49
- YALEWIFI: "YaleWifi";
50
- SENSIBO: "Sensibo";
42
+ export declare enum ConnectionProvider {
43
+ Smartthings = "Smartthings",
44
+ SaltoKS = "SaltoKS",
45
+ TTLock = "TTLock",
46
+ Tuya = "Tuya",
47
+ Schlage = "Schlage",
48
+ YaleWifi = "YaleWifi",
49
+ Sensibo = "Sensibo",
50
+ Devicethread = "Devicethread"
51
51
  }
@@ -1,3 +1,15 @@
1
1
  "use strict";
2
2
  // Device Cloud Type Interfaces for DeviceThread Common Library
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ConnectionProvider = void 0;
5
+ var ConnectionProvider;
6
+ (function (ConnectionProvider) {
7
+ ConnectionProvider["Smartthings"] = "Smartthings";
8
+ ConnectionProvider["SaltoKS"] = "SaltoKS";
9
+ ConnectionProvider["TTLock"] = "TTLock";
10
+ ConnectionProvider["Tuya"] = "Tuya";
11
+ ConnectionProvider["Schlage"] = "Schlage";
12
+ ConnectionProvider["YaleWifi"] = "YaleWifi";
13
+ ConnectionProvider["Sensibo"] = "Sensibo";
14
+ ConnectionProvider["Devicethread"] = "Devicethread";
15
+ })(ConnectionProvider || (exports.ConnectionProvider = ConnectionProvider = {}));
@@ -1,5 +1,6 @@
1
+ import { IConnection } from "../interfaces/IConnection";
1
2
  export declare class LocalConnectionService {
2
3
  private readonly pool;
3
4
  constructor();
4
- getConnection(connectionId: string): Promise<any>;
5
+ getConnection(connectionId: string): Promise<IConnection>;
5
6
  }
@@ -153,7 +153,7 @@ class LocalDeviceService {
153
153
  async getDevicesByAccessGroup(accessGroupId) {
154
154
  try {
155
155
  // Fetch from Postgres if not in cache
156
- const result = await this.postgres.query("SELECT * FROM access_groups WHERE id = $1", [accessGroupId]);
156
+ const result = await this.postgres.query("SELECT * FROM dt_group WHERE id = $1", [accessGroupId]);
157
157
  if (result.rows.length > 0) {
158
158
  return result.rows[0];
159
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -45,13 +45,13 @@ export interface IConnectionConnectParams {
45
45
  [key: string]: unknown;
46
46
  }
47
47
 
48
- export interface ConnectionProvider {
49
- DEVICETHREAD: "Devicethread";
50
- SMARTTHINGS: "Smartthings";
51
- SALTOKS: "SaltoKS";
52
- TUYA: "Tuya";
53
- TTLOCK: "TTLock";
54
- SCHLAGE: "Schlage";
55
- YALEWIFI: "YaleWifi";
56
- SENSIBO: "Sensibo";
57
- }
48
+ export enum ConnectionProvider {
49
+ Smartthings = "Smartthings",
50
+ SaltoKS = "SaltoKS",
51
+ TTLock = "TTLock",
52
+ Tuya = "Tuya",
53
+ Schlage = "Schlage",
54
+ YaleWifi = "YaleWifi",
55
+ Sensibo = "Sensibo",
56
+ Devicethread = "Devicethread",
57
+ }
@@ -1,11 +1,12 @@
1
1
  import { getPostgresClient } from "../../../db";
2
+ import { IConnection } from "../interfaces/IConnection";
2
3
  export class LocalConnectionService {
3
4
  private readonly pool;
4
5
  constructor() {
5
6
  this.pool = getPostgresClient();
6
7
  }
7
8
 
8
- async getConnection(connectionId: string) {
9
+ async getConnection(connectionId: string): Promise<IConnection> {
9
10
  const result = await this.pool.query(
10
11
  "SELECT * FROM dt_connections WHERE id = $1",
11
12
  [connectionId]
@@ -203,7 +203,7 @@ export class LocalDeviceService {
203
203
  try {
204
204
  // Fetch from Postgres if not in cache
205
205
  const result = await this.postgres.query(
206
- "SELECT * FROM access_groups WHERE id = $1",
206
+ "SELECT * FROM dt_group WHERE id = $1",
207
207
  [accessGroupId]
208
208
  );
209
209
  if (result.rows.length > 0) {