dt-common-device 9.2.0 → 9.2.2
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.
- package/dist/audit/ExcludeAudits.d.ts +1 -0
- package/dist/audit/ExcludeAudits.js +7 -2
- package/dist/audit/PushAudit.js +2 -1
- package/dist/cronicle/Cronicle.service.d.ts +1 -0
- package/dist/cronicle/Cronicle.service.js +35 -3
- package/dist/cronicle/ICronicle.interface.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.excludeEvents = void 0;
|
|
3
|
+
exports.propertyIdsToPush = exports.excludeEvents = void 0;
|
|
4
4
|
exports.excludeEvents = [
|
|
5
5
|
"device.event.received",
|
|
6
6
|
"device.event.processed",
|
|
@@ -17,7 +17,6 @@ exports.excludeEvents = [
|
|
|
17
17
|
"lock.code.usage_count",
|
|
18
18
|
"device.webhook.received",
|
|
19
19
|
"$screen",
|
|
20
|
-
"lock.code.delete.pending",
|
|
21
20
|
"heartbeat.lock.missing_codes",
|
|
22
21
|
"schedule.create.success",
|
|
23
22
|
"playlist.play.start",
|
|
@@ -44,3 +43,9 @@ exports.excludeEvents = [
|
|
|
44
43
|
"issue.resolve.success",
|
|
45
44
|
"lock.provision.auto.generate.complete",
|
|
46
45
|
];
|
|
46
|
+
// McCoy Properties
|
|
47
|
+
exports.propertyIdsToPush = [
|
|
48
|
+
"816b315f-4e38-461b-a8cc-c57116ac9c07",
|
|
49
|
+
"3264bff1-2146-42db-b7e2-1a163e7fc56b",
|
|
50
|
+
"e879ab0f-7951-4b57-8d16-81279bad7ca8",
|
|
51
|
+
];
|
package/dist/audit/PushAudit.js
CHANGED
|
@@ -10,7 +10,8 @@ const typedi_1 = __importDefault(require("typedi"));
|
|
|
10
10
|
const ExcludeAudits_1 = require("./ExcludeAudits");
|
|
11
11
|
async function pushAudit(data) {
|
|
12
12
|
const audit = await typedi_1.default.get(AuditUtils_1.AuditUtils).buildAuditProperties(data.auditData);
|
|
13
|
-
if (ExcludeAudits_1.excludeEvents.includes(data.auditType)
|
|
13
|
+
if (ExcludeAudits_1.excludeEvents.includes(data.auditType) &&
|
|
14
|
+
!ExcludeAudits_1.propertyIdsToPush.includes(data.auditData.propertyId)) {
|
|
14
15
|
console.log("Audit event excluded:", data.auditType);
|
|
15
16
|
}
|
|
16
17
|
else {
|
|
@@ -4,6 +4,7 @@ export declare class CronicleService {
|
|
|
4
4
|
private readonly cronicleApiKey;
|
|
5
5
|
constructor();
|
|
6
6
|
registerJob(payload: ICronicle): Promise<void>;
|
|
7
|
+
updateJob(payload: ICronicle): Promise<void>;
|
|
7
8
|
getJob(jobId: string): Promise<any>;
|
|
8
9
|
getSchedules(filter: {
|
|
9
10
|
offset: number;
|
|
@@ -12,15 +12,15 @@ class CronicleService {
|
|
|
12
12
|
this.cronicleApiKey = process.env.CRONICLE_API_KEY || "";
|
|
13
13
|
}
|
|
14
14
|
async registerJob(payload) {
|
|
15
|
-
const { name, apiUrl, method, schedule, cronJobId, target, category, timezone, } = payload;
|
|
15
|
+
const { name, apiUrl, method, schedule, cronJobId, target, category, timezone, enabled = true, } = payload;
|
|
16
16
|
try {
|
|
17
17
|
await axios_1.default.post(`${this.cronicleEndpoint}/create_event/v1`, {
|
|
18
18
|
id: cronJobId,
|
|
19
19
|
title: name,
|
|
20
|
-
category: "general",
|
|
20
|
+
category: category || "general",
|
|
21
21
|
plugin: "urlplug",
|
|
22
22
|
timeZone: timezone || "UTC",
|
|
23
|
-
enabled: 1,
|
|
23
|
+
enabled: enabled ? 1 : 0,
|
|
24
24
|
target: target,
|
|
25
25
|
api_key: this.cronicleApiKey,
|
|
26
26
|
params: {
|
|
@@ -47,6 +47,38 @@ class CronicleService {
|
|
|
47
47
|
(0, config_1.getConfig)().LOGGER.error(`Failed to create Cronicle job: ${error.message}`);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
async updateJob(payload) {
|
|
51
|
+
const { name, apiUrl, method, schedule, cronJobId, target, category, timezone, enabled, } = payload;
|
|
52
|
+
try {
|
|
53
|
+
const croniclePayload = {};
|
|
54
|
+
if (apiUrl || method)
|
|
55
|
+
croniclePayload.params = {};
|
|
56
|
+
if (name)
|
|
57
|
+
croniclePayload.title = name;
|
|
58
|
+
if (timezone)
|
|
59
|
+
croniclePayload.timeZone = timezone;
|
|
60
|
+
if (enabled)
|
|
61
|
+
croniclePayload.enabled = enabled ? 1 : 0;
|
|
62
|
+
if (target)
|
|
63
|
+
croniclePayload.target = target;
|
|
64
|
+
if (category)
|
|
65
|
+
croniclePayload.category = category;
|
|
66
|
+
if (apiUrl)
|
|
67
|
+
croniclePayload.params.url = apiUrl;
|
|
68
|
+
if (method)
|
|
69
|
+
croniclePayload.params.method = method;
|
|
70
|
+
if (schedule)
|
|
71
|
+
croniclePayload.timing = schedule;
|
|
72
|
+
await axios_1.default.post(`${this.cronicleEndpoint}/update_event/v1`, {
|
|
73
|
+
id: cronJobId,
|
|
74
|
+
...croniclePayload,
|
|
75
|
+
api_key: this.cronicleApiKey,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
(0, config_1.getConfig)().LOGGER.error(`Failed to update Cronicle job: ${error.message}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
50
82
|
async getJob(jobId) {
|
|
51
83
|
try {
|
|
52
84
|
const res = await axios_1.default.post(`${this.cronicleEndpoint}/get_event/v1`, {
|