dt-common-device 13.6.0 → 13.7.1

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,4 +1,37 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
@@ -30,7 +63,6 @@ const db_1 = require("../db/db");
30
63
  const dotenv_1 = __importDefault(require("dotenv"));
31
64
  const events_1 = require("../events");
32
65
  const constants_1 = require("./constants");
33
- const notificationQueue_1 = require("../notificationQueue");
34
66
  dotenv_1.default.config();
35
67
  let config = null;
36
68
  let auditInitialized = false;
@@ -329,7 +361,8 @@ async function shutdown() {
329
361
  }
330
362
  // Close notification queue connections
331
363
  try {
332
- await (0, notificationQueue_1.closeNotificationQueue)();
364
+ const { closeNotificationQueue } = await Promise.resolve().then(() => __importStar(require("../notificationQueue/queue.service")));
365
+ await closeNotificationQueue();
333
366
  }
334
367
  catch (error) {
335
368
  getConfig().LOGGER.error("Failed to close notification queue", { error });
@@ -22,4 +22,5 @@ export declare const CONNECTION_PROVIDERS: {
22
22
  readonly SIFELY: "Sifely";
23
23
  readonly CHECKFRONT: "Checkfront";
24
24
  readonly TWILIO: "Twilio";
25
+ readonly DAIKIN: "Daikin";
25
26
  };
@@ -28,4 +28,5 @@ exports.CONNECTION_PROVIDERS = {
28
28
  SIFELY: "Sifely",
29
29
  CHECKFRONT: "Checkfront",
30
30
  TWILIO: "Twilio",
31
+ DAIKIN: "Daikin",
31
32
  };
@@ -73,10 +73,6 @@ export declare const DT_EVENT_TYPES: {
73
73
  UNPROCESSED: string;
74
74
  UNHANDLED: string;
75
75
  };
76
- MAINTENANCE_MODE: {
77
- ENABLED: string;
78
- DISABLED: string;
79
- };
80
76
  };
81
77
  CONNECTION: {
82
78
  CREATE: {
@@ -144,10 +140,6 @@ export declare const DT_EVENT_TYPES: {
144
140
  SUCCESS: string;
145
141
  FAILED: string;
146
142
  };
147
- MAINTENANCE_MODE: {
148
- ENABLED: string;
149
- DISABLED: string;
150
- };
151
143
  };
152
144
  ZONE: {
153
145
  CREATE: {
@@ -165,10 +157,6 @@ export declare const DT_EVENT_TYPES: {
165
157
  SUCCESS: string;
166
158
  FAILED: string;
167
159
  };
168
- MAINTENANCE_MODE: {
169
- ENABLED: string;
170
- DISABLED: string;
171
- };
172
160
  };
173
161
  ISSUE: {
174
162
  CREATE: {
@@ -76,10 +76,6 @@ exports.DT_EVENT_TYPES = {
76
76
  UNPROCESSED: "device.webhook.unprocessed",
77
77
  UNHANDLED: "device.webhook.unhandled",
78
78
  },
79
- MAINTENANCE_MODE: {
80
- ENABLED: "device.maintenance_mode.enabled",
81
- DISABLED: "device.maintenance_mode.disabled",
82
- },
83
79
  },
84
80
  CONNECTION: {
85
81
  CREATE: {
@@ -147,10 +143,6 @@ exports.DT_EVENT_TYPES = {
147
143
  SUCCESS: "accessgroup.delete.success",
148
144
  FAILED: "accessgroup.delete.failed",
149
145
  },
150
- MAINTENANCE_MODE: {
151
- ENABLED: "access_group.maintenance_mode.enabled",
152
- DISABLED: "access_group.maintenance_mode.disabled",
153
- },
154
146
  },
155
147
  ZONE: {
156
148
  CREATE: {
@@ -168,10 +160,6 @@ exports.DT_EVENT_TYPES = {
168
160
  SUCCESS: "zone.delete.success",
169
161
  FAILED: "zone.delete.failed",
170
162
  },
171
- MAINTENANCE_MODE: {
172
- ENABLED: "zone.maintenance_mode.enabled",
173
- DISABLED: "zone.maintenance_mode.disabled",
174
- },
175
163
  },
176
164
  ISSUE: {
177
165
  CREATE: {
@@ -1,4 +1,37 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.QueueManager = void 0;
4
37
  const redis_1 = require("../../db/redis");
@@ -11,7 +44,7 @@ class QueueManager {
11
44
  if (queues.has(queueKey)) {
12
45
  return queues.get(queueKey);
13
46
  }
14
- const { Queue } = await import("bullmq");
47
+ const { Queue } = await Promise.resolve().then(() => __importStar(require("bullmq")));
15
48
  const queue = new Queue(queueKey, {
16
49
  connection: (0, redis_1.getRedisClient)(),
17
50
  });
@@ -25,7 +58,7 @@ class QueueManager {
25
58
  if (workers.has(queueKey)) {
26
59
  return workers.get(queueKey);
27
60
  }
28
- const { Worker } = await import("bullmq");
61
+ const { Worker } = await Promise.resolve().then(() => __importStar(require("bullmq")));
29
62
  const worker = new Worker(queueKey, processor, {
30
63
  connection: (0, redis_1.getRedisClient)(),
31
64
  concurrency: 1, // Process one job at a time for FIFO ordering
@@ -1,20 +1,11 @@
1
- import { IAccessGroup, IDeliverableLocksByAccessGroupResult, IUser, IZone, IZoneAccessGroup, ILocksAndZonesByAccessGroup } from "./IAdmin";
1
+ import { IAccessGroup, IUser, IZone, IZoneAccessGroup } from "./IAdmin";
2
2
  export declare class AdminRepository {
3
3
  private readonly deviceRepository;
4
4
  private readonly postgres;
5
5
  private readonly localDeviceService;
6
6
  private readonly redisUtils;
7
7
  constructor();
8
- /**
9
- * Raw zones + devices for access groups (all non-HUB devices). Used when callers need the full list (e.g. UI).
10
- */
11
- private loadCollectionZonesDevicesByAccessGroupIds;
12
- getZonesByAccessGroupIds(accessGroupIds: string[], propertyId: string): Promise<ILocksAndZonesByAccessGroup[]>;
13
- /**
14
- * ZN-2: same data as {@link getZonesByAccessGroupIds}, but `devices` are only LOCKs that are not
15
- * under maintenance (zone or device). `maintenanceSkips` is structured data for audit emission.
16
- */
17
- getDeliverableLockDevicesByAccessGroupIds(accessGroupIds: string[], propertyId: string): Promise<IDeliverableLocksByAccessGroupResult>;
8
+ getZonesByAccessGroupIds(accessGroupIds: string[], propertyId: string): Promise<any[]>;
18
9
  getZonesByAccessGroups(accessGroupIds: string[], type?: string[]): Promise<any[]>;
19
10
  getAccessGroup(accessGroupId: string, propertyId?: string): Promise<IAccessGroup | null>;
20
11
  getZoneAccessGroupByZoneId(zoneId: string): Promise<IZoneAccessGroup[] | null>;
@@ -91,13 +91,7 @@ let AdminRepository = (() => {
91
91
  this.localDeviceService = typedi_1.default.get(services_1.LocalDeviceService);
92
92
  this.redisUtils = typedi_1.default.get(utils_1.RedisUtils);
93
93
  }
94
- /**
95
- * Raw zones + devices for access groups (all non-HUB devices). Used when callers need the full list (e.g. UI).
96
- */
97
- async loadCollectionZonesDevicesByAccessGroupIds(accessGroupIds, propertyId) {
98
- if (!accessGroupIds?.length) {
99
- return [];
100
- }
94
+ async getZonesByAccessGroupIds(accessGroupIds, propertyId) {
101
95
  // If not cached, get the result from the database
102
96
  const result = await this.postgres.query(`SELECT
103
97
  "zc"."id" AS "zoneCollectionMapId",
@@ -106,8 +100,7 @@ let AdminRepository = (() => {
106
100
  "z"."id" AS "zoneId",
107
101
  "z"."name" AS "zoneName",
108
102
  "z"."zoneTypeId",
109
- "zt"."name" AS "zoneTypeName",
110
- "z"."isUnderMaintenance"
103
+ "zt"."name" AS "zoneTypeName"
111
104
  FROM "dt_zones_collection_map" AS "zc"
112
105
  INNER JOIN "dt_zones" AS "z" ON "zc"."zoneId" = "z"."id"
113
106
  LEFT JOIN "dt_zoneTypes" AS "zt" ON "z"."zoneTypeId" = "zt"."id"
@@ -178,14 +171,6 @@ let AdminRepository = (() => {
178
171
  zoneIds: _zoneIds,
179
172
  excludeDeviceType: interfaces_1.DeviceType.HUB,
180
173
  });
181
- // Fetch isUnderMaintenance for ALL zone IDs (including child zones not in the collection map)
182
- const allCollectionIds = collectionZone.map((e) => e.collectionId);
183
- const [allZoneMaintenanceResult, collectionMaintenanceResult] = await Promise.all([
184
- this.postgres.query(`SELECT "id", "isUnderMaintenance" FROM "dt_zones" WHERE "id" = ANY($1)`, [_zoneIds]),
185
- this.postgres.query(`SELECT "id", "isUnderMaintenance" FROM "dt_collections" WHERE "id" = ANY($1)`, [allCollectionIds]),
186
- ]);
187
- const zoneMaintenanceMap = new Map(allZoneMaintenanceResult.rows.map((r) => [r.id, r.isUnderMaintenance ?? false]));
188
- const collectionMaintenanceMap = new Map(collectionMaintenanceResult.rows.map((r) => [r.id, r.isUnderMaintenance ?? false]));
189
174
  const _collectionZone = collectionZone.map((e) => {
190
175
  const zones = e.zoneIds;
191
176
  let devices = [];
@@ -199,21 +184,18 @@ let AdminRepository = (() => {
199
184
  const _devices = devices.concat(device);
200
185
  devices = _devices;
201
186
  // Create zone data for each zone
202
- // Use zoneMaintenanceMap for isUnderMaintenance so child zones are also covered
203
187
  const zoneInfo = response.find((r) => r.zoneId === element);
204
188
  const zoneData = {
205
189
  zoneId: element,
206
190
  deviceIds: device?.map((d) => d.deviceId), // Get first device ID if available
207
191
  zoneName: zoneInfo?.zoneName || "",
208
192
  zoneType: zoneInfo?.zoneTypeName || null,
209
- isUnderMaintenance: zoneMaintenanceMap.get(element) ?? false,
210
193
  };
211
194
  zonesData.push(zoneData);
212
195
  });
213
196
  e.devices = devices;
214
197
  e.zones = zonesData;
215
198
  e.parentZone = response;
216
- e.isUnderMaintenance = collectionMaintenanceMap.get(e.collectionId) ?? false;
217
199
  return e;
218
200
  });
219
201
  const collectionZoneDevices = Array.from(new Set(_collectionZone));
@@ -225,59 +207,6 @@ let AdminRepository = (() => {
225
207
  // );
226
208
  return collectionZoneDevices;
227
209
  }
228
- async getZonesByAccessGroupIds(accessGroupIds, propertyId) {
229
- return await this.loadCollectionZonesDevicesByAccessGroupIds(accessGroupIds, propertyId);
230
- }
231
- /**
232
- * ZN-2: same data as {@link getZonesByAccessGroupIds}, but `devices` are only LOCKs that are not
233
- * under maintenance (zone or device). `maintenanceSkips` is structured data for audit emission.
234
- */
235
- async getDeliverableLockDevicesByAccessGroupIds(accessGroupIds, propertyId) {
236
- if (!accessGroupIds?.length) {
237
- return { collections: [], maintenanceSkips: [] };
238
- }
239
- const raw = await this.loadCollectionZonesDevicesByAccessGroupIds(accessGroupIds, propertyId);
240
- const maintenanceSkips = [];
241
- const collections = raw.map((cz) => {
242
- const inactiveIds = new Set();
243
- for (const zone of cz.zones || []) {
244
- if (zone.isUnderMaintenance) {
245
- (zone.deviceIds || []).forEach((id) => {
246
- if (id != null && id !== "")
247
- inactiveIds.add(String(id));
248
- });
249
- maintenanceSkips.push({
250
- accessGroupId: cz.collectionId,
251
- zoneId: zone.zoneId,
252
- deviceIds: (zone.deviceIds || [])
253
- .map((x) => String(x))
254
- .filter((x) => x !== ""),
255
- reason: "zone inactive",
256
- });
257
- }
258
- }
259
- for (const dev of cz.devices || []) {
260
- if (dev.deviceType?.type !== "LOCK" || !dev.isUnderMaintenance) {
261
- continue;
262
- }
263
- const did = String(dev.deviceId);
264
- if (inactiveIds.has(did)) {
265
- continue;
266
- }
267
- inactiveIds.add(did);
268
- maintenanceSkips.push({
269
- accessGroupId: cz.collectionId,
270
- zoneId: dev.zoneId,
271
- deviceIds: [did],
272
- reason: "device under maintenance",
273
- });
274
- }
275
- const deliverableDevices = (cz.devices || []).filter((d) => d.deviceType?.type === "LOCK" &&
276
- !inactiveIds.has(String(d.deviceId)));
277
- return { ...cz, devices: deliverableDevices, skippedDevices: cz.devices.filter((device) => device.deviceType?.type === "LOCK" && inactiveIds.has(String(device.deviceId))) };
278
- });
279
- return { collections, maintenanceSkips };
280
- }
281
210
  async getZonesByAccessGroups(accessGroupIds, type) {
282
211
  // Fetch zone IDs associated with these access groups
283
212
  const zonesIdsQuery = `
@@ -3,8 +3,7 @@ export declare class AdminService {
3
3
  private readonly adminRepository;
4
4
  private readonly redisUtils;
5
5
  constructor();
6
- getZonesByAccessGroupIds(accessGroupIds: string[], propertyId: string): Promise<import("./IAdmin").ILocksAndZonesByAccessGroup[]>;
7
- getDeliverableLockDevicesByAccessGroupIds(accessGroupIds: string[], propertyId: string): Promise<import("./IAdmin").IDeliverableLocksByAccessGroupResult>;
6
+ getZonesByAccessGroupIds(accessGroupIds: string[], propertyId: string): Promise<any[]>;
8
7
  getZonesByAccessGroups(accessGroupIds: string[], type?: string[]): Promise<any[]>;
9
8
  getAccessGroup(accessGroupId: string, propertyId?: string): Promise<IAccessGroup | null>;
10
9
  getAccessGroupByZoneId(zoneId: string): Promise<IAccessGroup[] | []>;
@@ -95,15 +95,6 @@ let AdminService = (() => {
95
95
  return [];
96
96
  }
97
97
  }
98
- async getDeliverableLockDevicesByAccessGroupIds(accessGroupIds, propertyId) {
99
- try {
100
- return await this.adminRepository.getDeliverableLockDevicesByAccessGroupIds(accessGroupIds, propertyId);
101
- }
102
- catch (error) {
103
- console.log(error);
104
- return { collections: [], maintenanceSkips: [] };
105
- }
106
- }
107
98
  async getZonesByAccessGroups(accessGroupIds, type) {
108
99
  try {
109
100
  return await this.adminRepository.getZonesByAccessGroups(accessGroupIds, type);
@@ -1,4 +1,3 @@
1
- import { IDevice } from "../device/local/interfaces";
2
1
  export interface IAccessGroup {
3
2
  id: string;
4
3
  propertyId: string;
@@ -49,42 +48,3 @@ export interface IUser {
49
48
  deletedAt?: Date | null;
50
49
  imageURL?: string | null;
51
50
  }
52
- /** ZN-2 skip metadata for callers that emit maintenance audits (e.g. smart-access-node). */
53
- export type IZn2MaintenanceSkipReason = "zone inactive" | "device under maintenance";
54
- export interface IZn2MaintenanceSkip {
55
- accessGroupId: string;
56
- zoneId: string;
57
- deviceIds: string[];
58
- reason: IZn2MaintenanceSkipReason;
59
- }
60
- /** LOCK devices eligible for guest programming after zone + device maintenance rules. */
61
- export interface IDeliverableLocksByAccessGroupResult {
62
- collections: {
63
- collectionId: string;
64
- devices: IDevice[];
65
- skippedDevices: IDevice[];
66
- zones: {
67
- zoneId: string;
68
- deviceIds: string[];
69
- zoneName: string;
70
- zoneTypeName: string;
71
- isUnderMaintenance: boolean;
72
- }[];
73
- parentZone: any;
74
- isUnderMaintenance: boolean;
75
- }[];
76
- maintenanceSkips: IZn2MaintenanceSkip[];
77
- }
78
- export interface ILocksAndZonesByAccessGroup {
79
- collectionId: string;
80
- devices: IDevice[];
81
- zones: {
82
- zoneId: string;
83
- deviceIds: string[];
84
- zoneName: string;
85
- zoneTypeName: string;
86
- isUnderMaintenance: boolean;
87
- }[];
88
- parentZone: any;
89
- isUnderMaintenance: boolean;
90
- }
@@ -29,5 +29,6 @@ export declare enum ConnectionProvider {
29
29
  Dusaw = "Dusaw",
30
30
  Lockly = "Lockly",
31
31
  Sifely = "Sifely",
32
- Twilio = "Twilio"
32
+ Twilio = "Twilio",
33
+ Daikin = "Daikin"
33
34
  }
@@ -20,4 +20,5 @@ var ConnectionProvider;
20
20
  ConnectionProvider["Lockly"] = "Lockly";
21
21
  ConnectionProvider["Sifely"] = "Sifely";
22
22
  ConnectionProvider["Twilio"] = "Twilio";
23
+ ConnectionProvider["Daikin"] = "Daikin";
23
24
  })(ConnectionProvider || (exports.ConnectionProvider = ConnectionProvider = {}));
@@ -1,7 +1,6 @@
1
1
  export interface IDevice {
2
2
  deviceId: string;
3
3
  propertyId: string;
4
- collectionId?: string;
5
4
  zoneId: string;
6
5
  name: string;
7
6
  hubId: string[];
@@ -49,11 +48,6 @@ export interface IDevice {
49
48
  capabilities?: Record<string, any>;
50
49
  isDeleted?: boolean;
51
50
  deletedAt?: Date;
52
- /** Persisted maintenance; ZONE-sourced rows mirror parent zone toggles (smart-cloud). */
53
- isUnderMaintenance?: boolean;
54
- underMaintenanceSince?: string | Date | null;
55
- maintenanceReason?: string | null;
56
- maintenanceSource?: "ZONE" | "DEVICE" | null;
57
51
  }
58
52
  export declare class IStatus {
59
53
  online: boolean;
@@ -8,13 +8,6 @@ export declare class DeviceRepository {
8
8
  getDevice(deviceId: string, withHubDetails?: boolean): Promise<IDevice>;
9
9
  updateDevice(deviceId: string, body: any): Promise<IDevice>;
10
10
  updateDevices(query: any, updateData: any): Promise<any>;
11
- /** Sync Mongo `devices_v2` when smart-cloud toggles zone maintenance (operational device-service). */
12
- syncDevicesZoneMaintenance(body: {
13
- zoneId: string;
14
- enabled: boolean;
15
- maintenanceReason?: string | null;
16
- underMaintenanceSince?: string | null;
17
- }): Promise<any>;
18
11
  deleteDevice(deviceId: string): Promise<void>;
19
12
  getDevices(deviceIds: string[], withHubDetails?: boolean): Promise<IDevice[]>;
20
13
  getPropertyDevices(propertyId: string, selectDeviceId?: boolean, type?: string, withHubDetails?: boolean): Promise<IDevice[]>;
@@ -96,17 +96,6 @@ let DeviceRepository = (() => {
96
96
  throw new Error(`Failed to update devices: ${error.message}`);
97
97
  }
98
98
  }
99
- /** Sync Mongo `devices_v2` when smart-cloud toggles zone maintenance (operational device-service). */
100
- async syncDevicesZoneMaintenance(body) {
101
- try {
102
- const response = await this.axiosInstance.put(`/devices/maintenance/zone`, body);
103
- return response.data;
104
- }
105
- catch (error) {
106
- (0, config_1.getConfig)().LOGGER.error("Failed to sync zone maintenance to devices:", error);
107
- throw new Error(`Failed to sync zone maintenance: ${error.message || "Unknown error"}`);
108
- }
109
- }
110
99
  async deleteDevice(deviceId) {
111
100
  try {
112
101
  await this.axiosInstance.delete(`/devices/${deviceId}`);
@@ -13,14 +13,6 @@ export declare class LocalDeviceService {
13
13
  getDevices(deviceIds: string[], withHubDetails?: boolean): Promise<IDevice[]>;
14
14
  getPropertyDevices(propertyId: string, selectDeviceId?: boolean, type?: string, withHubDetails?: boolean): Promise<IDevice[]>;
15
15
  updateDevice(deviceId: string, body: Partial<IDevice>, auditBody: IAuditProperties): Promise<any>;
16
- /**
17
- * When a zone’s maintenance flag changes in smart-cloud, mirror the same rules as `dt_devices`
18
- * onto operational Mongo (`devices_v2`) via device-service.
19
- */
20
- syncDevicesZoneMaintenance(zoneId: string, enabled: boolean, options?: {
21
- maintenanceReason?: string | null;
22
- underMaintenanceSince?: string | Date | null;
23
- }): Promise<any>;
24
16
  updateDevices(query: any, updateData: any): Promise<any>;
25
17
  deleteDevice(deviceId: string, auditBody: IAuditProperties): Promise<any>;
26
18
  getState(deviceId: string): Promise<any>;
@@ -154,27 +154,6 @@ let LocalDeviceService = (() => {
154
154
  await this.deviceRepository.updateDevice(deviceId, body);
155
155
  return await this.eventHandler.onDeviceUpdate(deviceId, body, auditBody);
156
156
  }
157
- /**
158
- * When a zone’s maintenance flag changes in smart-cloud, mirror the same rules as `dt_devices`
159
- * onto operational Mongo (`devices_v2`) via device-service.
160
- */
161
- async syncDevicesZoneMaintenance(zoneId, enabled, options) {
162
- if (!zoneId) {
163
- throw new Error("Zone ID is required");
164
- }
165
- const body = { zoneId, enabled };
166
- if (enabled && options) {
167
- if (options.maintenanceReason !== undefined) {
168
- body.maintenanceReason = options.maintenanceReason;
169
- }
170
- const since = options.underMaintenanceSince;
171
- if (since !== undefined && since !== null) {
172
- body.underMaintenanceSince =
173
- since instanceof Date ? since.toISOString() : since;
174
- }
175
- }
176
- return await this.deviceRepository.syncDevicesZoneMaintenance(body);
177
- }
178
157
  async updateDevices(query, updateData) {
179
158
  if (!query || !updateData) {
180
159
  throw new Error("Query and update data are required");
@@ -1,4 +1,3 @@
1
- import axios from "axios";
2
1
  /**
3
2
  * Validates if a URL is properly formatted and accessible
4
3
  */
@@ -6,7 +5,7 @@ export declare function validateServiceUrl(url: string): boolean;
6
5
  /**
7
6
  * Creates a properly configured axios instance with error handling
8
7
  */
9
- export declare function createAxiosInstance(baseURL?: string): axios.AxiosInstance;
8
+ export declare function createAxiosInstance(baseURL?: string): import("axios").AxiosInstance;
10
9
  export declare function getDeviceServiceAxiosInstance(): any;
11
10
  export declare function getAdminServiceAxiosInstance(): any;
12
11
  export declare function getMonitoringServiceAxiosInstance(): any;
@@ -1,4 +1,20 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
2
18
  var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
19
  function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
20
  var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
@@ -33,6 +49,23 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
33
49
  }
34
50
  return useValue ? value : void 0;
35
51
  };
52
+ var __importStar = (this && this.__importStar) || (function () {
53
+ var ownKeys = function(o) {
54
+ ownKeys = Object.getOwnPropertyNames || function (o) {
55
+ var ar = [];
56
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
57
+ return ar;
58
+ };
59
+ return ownKeys(o);
60
+ };
61
+ return function (mod) {
62
+ if (mod && mod.__esModule) return mod;
63
+ var result = {};
64
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
65
+ __setModuleDefault(result, mod);
66
+ return result;
67
+ };
68
+ })();
36
69
  var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
70
  if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
71
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
@@ -111,7 +144,7 @@ let WebhookQueueService = (() => {
111
144
  try {
112
145
  // Create queue instance if not exists locally
113
146
  if (!this.webhookQueues.has(queueName)) {
114
- const { Queue } = await import("bullmq");
147
+ const { Queue } = await Promise.resolve().then(() => __importStar(require("bullmq")));
115
148
  const queue = new Queue(queueName, {
116
149
  connection: (0, redis_1.getRedisClient)(),
117
150
  });
@@ -186,7 +219,7 @@ let WebhookQueueService = (() => {
186
219
  try {
187
220
  // Create queue instance if not exists locally
188
221
  if (!this.webhookQueues.has(queueName)) {
189
- const { Queue } = await import("bullmq");
222
+ const { Queue } = await Promise.resolve().then(() => __importStar(require("bullmq")));
190
223
  const queue = new Queue(queueName, {
191
224
  connection: (0, redis_1.getRedisClient)(),
192
225
  });
@@ -212,7 +245,7 @@ let WebhookQueueService = (() => {
212
245
  if (queues.has(queueKey)) {
213
246
  return queues.get(queueKey);
214
247
  }
215
- const { Queue } = await import("bullmq");
248
+ const { Queue } = await Promise.resolve().then(() => __importStar(require("bullmq")));
216
249
  const queue = new Queue(queueKey, {
217
250
  connection: (0, redis_1.getRedisClient)(),
218
251
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "13.6.0",
3
+ "version": "13.7.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [