dt-common-device 3.0.6 → 3.0.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.
@@ -293,8 +293,8 @@ class LocalDeviceService {
293
293
  if (!query || Object.keys(query).length === 0) {
294
294
  throw new Error("Query is required");
295
295
  }
296
- const count = await this.deviceRepository.queryDevices(query);
297
- return count;
296
+ const res = await this.deviceRepository.queryDevices(query);
297
+ return res;
298
298
  }
299
299
  }
300
300
  exports.LocalDeviceService = LocalDeviceService;
@@ -30,17 +30,13 @@ class QueueUtils {
30
30
  // Simplified event handlers
31
31
  worker.on("completed", (job) => {
32
32
  (0, config_1.getConfig)().LOGGER.info(`HTTP request completed: ${job.id} [${queueKey}]`);
33
- job.returnvalue
34
- .then((result) => jobResults.set(job.id, {
33
+ // job.returnvalue is the actual result, not a Promise
34
+ const result = job.returnvalue;
35
+ jobResults.set(job.id, {
35
36
  result,
36
37
  resolved: true,
37
38
  timestamp: Date.now(),
38
- }))
39
- .catch((error) => jobResults.set(job.id, {
40
- error: error.message,
41
- resolved: true,
42
- timestamp: Date.now(),
43
- }));
39
+ });
44
40
  });
45
41
  worker.on("failed", (job, err) => {
46
42
  (0, config_1.getConfig)().LOGGER.error(`HTTP request failed: ${job?.id} [${queueKey}], Error: ${err.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dt-common-device",
3
- "version": "3.0.6",
3
+ "version": "3.0.7",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -430,7 +430,7 @@ export class LocalDeviceService {
430
430
  if (!query || Object.keys(query).length === 0) {
431
431
  throw new Error("Query is required");
432
432
  }
433
- const count = await this.deviceRepository.queryDevices(query);
434
- return count;
433
+ const res = await this.deviceRepository.queryDevices(query);
434
+ return res;
435
435
  }
436
436
  }
@@ -47,21 +47,14 @@ export class QueueUtils {
47
47
  getConfig().LOGGER.info(
48
48
  `HTTP request completed: ${job.id} [${queueKey}]`
49
49
  );
50
- job.returnvalue
51
- .then((result: any) =>
52
- jobResults.set(job.id!, {
53
- result,
54
- resolved: true,
55
- timestamp: Date.now(),
56
- })
57
- )
58
- .catch((error: any) =>
59
- jobResults.set(job.id!, {
60
- error: error.message,
61
- resolved: true,
62
- timestamp: Date.now(),
63
- })
64
- );
50
+
51
+ // job.returnvalue is the actual result, not a Promise
52
+ const result = job.returnvalue;
53
+ jobResults.set(job.id!, {
54
+ result,
55
+ resolved: true,
56
+ timestamp: Date.now(),
57
+ });
65
58
  });
66
59
 
67
60
  worker.on("failed", (job: any, err: any) => {