dt-common-device 13.4.15 → 13.4.17

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.
@@ -27,7 +27,8 @@ export declare enum AlertType {
27
27
  ZONE_NOT_MAPPED_TO_ACCESS_GROUP = "ZONE_NOT_MAPPED_TO_ACCESS_GROUP",
28
28
  INCORRECT_CODE_USED = "INCORRECT_CODE_USED",
29
29
  RESERVATION_INACTIVE_ACCESSGROUP = "RESERVATION_INACTIVE_ACCESSGROUP",
30
- ACCESS_GROUP_CREATED = "ACCESS_GROUP_CREATED"
30
+ ACCESS_GROUP_CREATED = "ACCESS_GROUP_CREATED",
31
+ ACCESS_GROUP_UPDATED = "ACCESS_GROUP_UPDATED"
31
32
  }
32
33
  export declare const AlertDescriptions: {
33
34
  ACCOUNT_NEW_DEVICE: string;
@@ -46,6 +47,7 @@ export declare const AlertDescriptions: {
46
47
  INCORRECT_CODE_USED: string;
47
48
  RESERVATION_INACTIVE_ACCESSGROUP: string;
48
49
  ACCESS_GROUP_CREATED: string;
50
+ ACCESS_GROUP_UPDATED: string;
49
51
  };
50
52
  export interface AlertDocument {
51
53
  _id: string;
@@ -33,6 +33,7 @@ var AlertType;
33
33
  AlertType["INCORRECT_CODE_USED"] = "INCORRECT_CODE_USED";
34
34
  AlertType["RESERVATION_INACTIVE_ACCESSGROUP"] = "RESERVATION_INACTIVE_ACCESSGROUP";
35
35
  AlertType["ACCESS_GROUP_CREATED"] = "ACCESS_GROUP_CREATED";
36
+ AlertType["ACCESS_GROUP_UPDATED"] = "ACCESS_GROUP_UPDATED";
36
37
  })(AlertType || (exports.AlertType = AlertType = {}));
37
38
  exports.AlertDescriptions = {
38
39
  [AlertType.ACCOUNT_NEW_DEVICE]: "The alert is raised when system detects a new device in the device cloud account.",
@@ -51,6 +52,7 @@ exports.AlertDescriptions = {
51
52
  [AlertType.INCORRECT_CODE_USED]: "The alert is raised when user uses the incorrect code on the device.",
52
53
  [AlertType.RESERVATION_INACTIVE_ACCESSGROUP]: "The alert is raised when a reservation is received for an inactive access group.",
53
54
  [AlertType.ACCESS_GROUP_CREATED]: "The alert is raised when an access group is created for the pms system.",
55
+ [AlertType.ACCESS_GROUP_UPDATED]: "The alert is raised when an access group is updated for the pms system."
54
56
  };
55
57
  // Re-export EntityType from issue.types.ts to avoid duplication
56
58
  var issue_types_1 = require("../issues/issue.types");
@@ -1,4 +1,9 @@
1
1
  import { IAuditProperties } from "./IAuditProperties";
2
+ /**
3
+ * Publishes an audit event. Failures are logged and swallowed so callers can
4
+ * fire-and-forget without causing unhandled promise rejections when the audit
5
+ * pipeline returns 5xx or times out (see e.g. Sentry DT-PMS-C).
6
+ */
2
7
  export declare function pushAudit(data: {
3
8
  auditType: string;
4
9
  auditData: IAuditProperties;
@@ -5,16 +5,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.pushAudit = pushAudit;
7
7
  const dt_audit_library_1 = require("dt-audit-library");
8
+ const config_1 = require("../config/config");
8
9
  const AuditUtils_1 = require("./AuditUtils");
9
10
  const typedi_1 = __importDefault(require("typedi"));
11
+ /**
12
+ * Publishes an audit event. Failures are logged and swallowed so callers can
13
+ * fire-and-forget without causing unhandled promise rejections when the audit
14
+ * pipeline returns 5xx or times out (see e.g. Sentry DT-PMS-C).
15
+ */
10
16
  async function pushAudit(data) {
11
- const audit = await typedi_1.default.get(AuditUtils_1.AuditUtils).buildAuditProperties(data.auditData);
12
- await (0, dt_audit_library_1.publishAudit)({
13
- eventType: data.auditType,
14
- properties: {
15
- ...audit,
16
- timestamp: new Date().toISOString(),
17
- env_type: process.env.NODE_ENV,
18
- },
19
- });
17
+ try {
18
+ const audit = await typedi_1.default.get(AuditUtils_1.AuditUtils).buildAuditProperties(data.auditData);
19
+ await (0, dt_audit_library_1.publishAudit)({
20
+ eventType: data.auditType,
21
+ properties: {
22
+ ...audit,
23
+ timestamp: new Date().toISOString(),
24
+ env_type: process.env.NODE_ENV,
25
+ },
26
+ });
27
+ }
28
+ catch (err) {
29
+ const status = err?.response?.status;
30
+ const code = err?.code;
31
+ (0, config_1.getLogger)().error(`pushAudit failed for ${data.auditType}: ${err?.message ?? err}`, status != null || code != null
32
+ ? { auditType: data.auditType, status, code }
33
+ : { auditType: data.auditType });
34
+ }
20
35
  }
package/package.json CHANGED
@@ -1,60 +1,60 @@
1
- {
2
- "name": "dt-common-device",
3
- "version": "13.4.15",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
6
- "files": [
7
- "dist",
8
- "README.md",
9
- "LICENSE"
10
- ],
11
- "scripts": {
12
- "build": "tsc",
13
- "patch": "npm login && npm version patch && npm run build && npm publish && git push",
14
- "minor": "npm login && npm version minor && npm run build && npm publish && git push",
15
- "major": "npm login && npm version major && npm run build && npm publish && git push",
16
- "security:audit": "npm audit --audit-level=moderate",
17
- "security:fix": "npm audit fix",
18
- "security:check": "npm audit && npm outdated",
19
- "type-check": "tsc --noEmit"
20
- },
21
- "keywords": [
22
- "device",
23
- "iot",
24
- "smart-devices",
25
- "device-management"
26
- ],
27
- "author": "DeviceThread Team",
28
- "license": "MIT",
29
- "description": "A secure and robust device management library for IoT applications",
30
- "repository": {
31
- "type": "git",
32
- "url": "https://github.com/devicethread/dt-common-device.git"
33
- },
34
- "engines": {
35
- "node": ">=16.0.0",
36
- "npm": ">=8.0.0"
37
- },
38
- "devDependencies": {
39
- "@types/lodash": "^4.17.19",
40
- "@types/node": "^20.0.0",
41
- "@types/pg": "8.15.4",
42
- "ts-node": "^10.9.2",
43
- "typescript": "^5.8.3"
44
- },
45
- "dependencies": {
46
- "@aws-sdk/client-s3": "3.1015.0",
47
- "@aws-sdk/client-ses": "3.1003.0",
48
- "axios": "1.10.0",
49
- "bullmq": "5.56.4",
50
- "dt-audit-library": "1.7.1",
51
- "dt-pub-sub": "^1.0.0",
52
- "ioredis": "5.6.1",
53
- "lodash": "^4.17.21",
54
- "mongoose": "8.17.1",
55
- "pg": "8.16.3",
56
- "svix": "1.84.1",
57
- "twilio": "5.12.2",
58
- "typedi": "0.10.0"
59
- }
60
- }
1
+ {
2
+ "name": "dt-common-device",
3
+ "version": "13.4.17",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "files": [
7
+ "dist",
8
+ "README.md",
9
+ "LICENSE"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "patch": "npm login && npm version patch && npm run build && npm publish && git push",
14
+ "minor": "npm login && npm version minor && npm run build && npm publish && git push",
15
+ "major": "npm login && npm version major && npm run build && npm publish && git push",
16
+ "security:audit": "npm audit --audit-level=moderate",
17
+ "security:fix": "npm audit fix",
18
+ "security:check": "npm audit && npm outdated",
19
+ "type-check": "tsc --noEmit"
20
+ },
21
+ "keywords": [
22
+ "device",
23
+ "iot",
24
+ "smart-devices",
25
+ "device-management"
26
+ ],
27
+ "author": "DeviceThread Team",
28
+ "license": "MIT",
29
+ "description": "A secure and robust device management library for IoT applications",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/devicethread/dt-common-device.git"
33
+ },
34
+ "engines": {
35
+ "node": ">=16.0.0",
36
+ "npm": ">=8.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/lodash": "^4.17.19",
40
+ "@types/node": "^20.0.0",
41
+ "@types/pg": "8.15.4",
42
+ "ts-node": "^10.9.2",
43
+ "typescript": "^5.8.3"
44
+ },
45
+ "dependencies": {
46
+ "@aws-sdk/client-s3": "3.1015.0",
47
+ "@aws-sdk/client-ses": "3.1003.0",
48
+ "axios": "1.10.0",
49
+ "bullmq": "5.56.4",
50
+ "dt-audit-library": "1.7.1",
51
+ "dt-pub-sub": "^1.0.0",
52
+ "ioredis": "5.6.1",
53
+ "lodash": "^4.17.21",
54
+ "mongoose": "8.17.1",
55
+ "pg": "8.16.3",
56
+ "svix": "1.84.1",
57
+ "twilio": "5.12.2",
58
+ "typedi": "0.10.0"
59
+ }
60
+ }