dt-common-device 7.8.5 → 7.8.7

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.
@@ -224,7 +224,7 @@ let AdminRepository = (() => {
224
224
  const zone = await this.postgres.query(`SELECT * FROM dt_zones WHERE "id" = $1`, [zoneId]);
225
225
  if (zone.rows.length > 0) {
226
226
  const zoneData = zone.rows[0];
227
- const zoneType = await this.postgres.query(`SELECT * FROM dt_zoneTypes WHERE "id" = $1`, [zoneData.zoneTypeId]);
227
+ const zoneType = await this.postgres.query(`SELECT * FROM "dt_zoneTypes" WHERE "id" = $1`, [zoneData.zoneTypeId]);
228
228
  zoneData.zoneType = {
229
229
  id: zoneType.rows[0].id,
230
230
  name: zoneType.rows[0].name,
@@ -0,0 +1,5 @@
1
+ export declare class DeviceProfileRepository {
2
+ private readonly axiosInstance;
3
+ constructor();
4
+ getDeviceBaseLine(deviceId: string): Promise<void>;
5
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.DeviceProfileRepository = void 0;
42
+ const typedi_1 = require("typedi");
43
+ const utils_1 = require("../../../../utils");
44
+ let DeviceProfileRepository = (() => {
45
+ let _classDecorators = [(0, typedi_1.Service)()];
46
+ let _classDescriptor;
47
+ let _classExtraInitializers = [];
48
+ let _classThis;
49
+ var DeviceProfileRepository = _classThis = class {
50
+ constructor() {
51
+ this.axiosInstance = (0, utils_1.getDeviceServiceAxiosInstance)();
52
+ }
53
+ async getDeviceBaseLine(deviceId) { }
54
+ };
55
+ __setFunctionName(_classThis, "DeviceProfileRepository");
56
+ (() => {
57
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
58
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
59
+ DeviceProfileRepository = _classThis = _classDescriptor.value;
60
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
61
+ __runInitializers(_classThis, _classExtraInitializers);
62
+ })();
63
+ return DeviceProfileRepository = _classThis;
64
+ })();
65
+ exports.DeviceProfileRepository = DeviceProfileRepository;
@@ -74,4 +74,10 @@ export declare class RedisUtils {
74
74
  smembers(key: string): Promise<string[]>;
75
75
  srem(key: string, ...members: string[]): Promise<number>;
76
76
  keys(pattern: string): Promise<string[]>;
77
+ /**
78
+ * Delete all keys matching a pattern
79
+ * @param pattern - The Redis key pattern (e.g., "zones:batch:*")
80
+ * @returns The number of keys deleted
81
+ */
82
+ delPattern(pattern: string): Promise<number>;
77
83
  }
@@ -200,6 +200,23 @@ let RedisUtils = (() => {
200
200
  async keys(pattern) {
201
201
  return this.client.keys(pattern);
202
202
  }
203
+ /**
204
+ * Delete all keys matching a pattern
205
+ * @param pattern - The Redis key pattern (e.g., "zones:batch:*")
206
+ * @returns The number of keys deleted
207
+ */
208
+ async delPattern(pattern) {
209
+ try {
210
+ const keys = await this.keys(pattern);
211
+ if (keys.length === 0)
212
+ return 0;
213
+ return await this.client.del(...keys);
214
+ }
215
+ catch (error) {
216
+ console.error(`Error deleting keys for pattern ${pattern}:`, error);
217
+ throw error;
218
+ }
219
+ }
203
220
  };
204
221
  __setFunctionName(_classThis, "RedisUtils");
205
222
  (() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "7.8.5",
3
+ "version": "7.8.7",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [