dt-common-device 4.0.6 → 4.0.8

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.
@@ -23,9 +23,6 @@ export declare enum ConnectionProvider {
23
23
  YaleWifi = "YaleWifi",
24
24
  Sensibo = "Sensibo",
25
25
  Devicethread = "Devicethread",
26
- Yanolja = "Yanolja",
27
- Cloudbeds = "Cloudbeds",
28
- StayNTouch = "StayNTouch",
29
26
  Dormakaba = "Dormakaba",
30
27
  Dusaw = "Dusaw"
31
28
  }
@@ -11,9 +11,6 @@ var ConnectionProvider;
11
11
  ConnectionProvider["YaleWifi"] = "YaleWifi";
12
12
  ConnectionProvider["Sensibo"] = "Sensibo";
13
13
  ConnectionProvider["Devicethread"] = "Devicethread";
14
- ConnectionProvider["Yanolja"] = "Yanolja";
15
- ConnectionProvider["Cloudbeds"] = "Cloudbeds";
16
- ConnectionProvider["StayNTouch"] = "StayNTouch";
17
14
  ConnectionProvider["Dormakaba"] = "Dormakaba";
18
15
  ConnectionProvider["Dusaw"] = "Dusaw";
19
16
  })(ConnectionProvider || (exports.ConnectionProvider = ConnectionProvider = {}));
@@ -7,6 +7,7 @@ export declare class DeviceRepository {
7
7
  createDevice(body: IDevice): Promise<IDevice>;
8
8
  getDevice(deviceId: string, withHubDetails?: boolean): Promise<IDevice>;
9
9
  updateDevice(deviceId: string, body: any): Promise<IDevice>;
10
+ updateDevices(query: any, updateData: any): Promise<any>;
10
11
  deleteDevice(deviceId: string): Promise<void>;
11
12
  getDevices(deviceIds: string[], withHubDetails?: boolean): Promise<IDevice[]>;
12
13
  getPropertyDevices(propertyId: string, selectDeviceId?: boolean, type?: string, withHubDetails?: boolean): Promise<IDevice[]>;
@@ -83,6 +83,19 @@ let DeviceRepository = (() => {
83
83
  throw new Error(`Failed to update device: ${error.message || "Unknown error"}`);
84
84
  }
85
85
  }
86
+ async updateDevices(query, updateData) {
87
+ try {
88
+ const response = await this.axiosInstance.put(`/devices/updateMany`, {
89
+ query,
90
+ updateData,
91
+ });
92
+ return response.data;
93
+ }
94
+ catch (error) {
95
+ (0, config_1.getConfig)().LOGGER.error("Failed to update devices:", error);
96
+ throw new Error(`Failed to update devices: ${error.message}`);
97
+ }
98
+ }
86
99
  async deleteDevice(deviceId) {
87
100
  try {
88
101
  await this.axiosInstance.delete(`/devices/${deviceId}`);
@@ -170,14 +183,18 @@ let DeviceRepository = (() => {
170
183
  }
171
184
  }
172
185
  async setStatusMany(query, newStatus) {
186
+ console.log("SetStatusMany query:------------", query);
187
+ console.log("SetStatusMany newStatus:------------", newStatus);
173
188
  try {
174
189
  const response = await this.axiosInstance.put(`/devices/statusMany`, {
175
190
  query,
176
191
  status: newStatus,
177
192
  });
193
+ console.log("SetStatusMany response:------------", response);
178
194
  return response.data;
179
195
  }
180
196
  catch (error) {
197
+ console.log("SetStatusMany error:------------", error);
181
198
  (0, config_1.getConfig)().LOGGER.error(`Failed to set status for multiple devices: ${error.message}`);
182
199
  throw new Error(`Failed to set status for multiple devices: ${error.message}`);
183
200
  }
@@ -14,6 +14,7 @@ export declare class LocalDeviceService {
14
14
  getPropertyDevices(propertyId: string, selectDeviceId?: boolean, type?: string, withHubDetails?: boolean): Promise<IDevice[]>;
15
15
  getPropertyDeviceIds(propertyId: string, selectDeviceId: boolean | undefined, type: string): Promise<any>;
16
16
  updateDevice(deviceId: string, body: any, auditBody: AuditProperties): Promise<any>;
17
+ updateDevices(query: any, updateData: any): Promise<any>;
17
18
  deleteDevice(deviceId: string, auditBody: AuditProperties): Promise<any>;
18
19
  getState(deviceId: string): Promise<any>;
19
20
  setState(deviceId: string, newState: any, auditProperties: AuditProperties): Promise<void>;
@@ -100,6 +100,12 @@ let LocalDeviceService = (() => {
100
100
  await this.deviceRepository.updateDevice(deviceId, body);
101
101
  return await this.eventHandler.onDeviceUpdate(deviceId, body, auditBody);
102
102
  }
103
+ async updateDevices(query, updateData) {
104
+ if (!query || !updateData) {
105
+ throw new Error("Query and update data are required");
106
+ }
107
+ return await this.deviceRepository.updateDevices(query, updateData);
108
+ }
103
109
  async deleteDevice(deviceId, auditBody) {
104
110
  if (!deviceId) {
105
111
  throw new Error("Device ID is required");
package/dist/index.d.ts CHANGED
@@ -13,4 +13,5 @@ export * from "./alerts";
13
13
  export * from "./issues";
14
14
  export * from "./utils";
15
15
  export * from "./queue";
16
+ export * from "./pms";
16
17
  export { initialize, getConfig, shutdown } from "./config/config";
package/dist/index.js CHANGED
@@ -48,6 +48,8 @@ __exportStar(require("./issues"), exports);
48
48
  __exportStar(require("./utils"), exports);
49
49
  // QUEUE EXPORTS
50
50
  __exportStar(require("./queue"), exports);
51
+ // PMS EXPORTS
52
+ __exportStar(require("./pms"), exports);
51
53
  // CONFIG EXPORTS
52
54
  var config_1 = require("./config/config");
53
55
  Object.defineProperty(exports, "initialize", { enumerable: true, get: function () { return config_1.initialize; } });
@@ -0,0 +1,6 @@
1
+ export declare enum PmsProvider {
2
+ Cloudbeds = "Cloudbeds",
3
+ StayNTouch = "StayNTouch",
4
+ HotelKey = "HotelKey",
5
+ Yanolja = "Yanolja"
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PmsProvider = void 0;
4
+ var PmsProvider;
5
+ (function (PmsProvider) {
6
+ PmsProvider["Cloudbeds"] = "Cloudbeds";
7
+ PmsProvider["StayNTouch"] = "StayNTouch";
8
+ PmsProvider["HotelKey"] = "HotelKey";
9
+ PmsProvider["Yanolja"] = "Yanolja";
10
+ })(PmsProvider || (exports.PmsProvider = PmsProvider = {}));
@@ -0,0 +1 @@
1
+ export * from "./IPms";
@@ -0,0 +1,17 @@
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("./IPms"), exports);
@@ -36,6 +36,7 @@ function createAxiosInstance(baseURL) {
36
36
  headers: {
37
37
  "Content-Type": "application/json",
38
38
  "User-Agent": "dt-common-device/1.3.0",
39
+ "x-api-key": (0, config_1.getConfig)().CLOUD_SERVICE_API_KEY,
39
40
  },
40
41
  });
41
42
  // Add request interceptor for logging
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "4.0.6",
3
+ "version": "4.0.8",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [