zwave-js 15.23.2 → 15.23.4

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.
Files changed (37) hide show
  1. package/build/cjs/Node.d.ts +1 -1
  2. package/build/cjs/Node.js +6 -0
  3. package/build/cjs/Node.js.map +2 -2
  4. package/build/cjs/lib/_version.d.ts +1 -1
  5. package/build/cjs/lib/_version.js +1 -1
  6. package/build/cjs/lib/_version.js.map +1 -1
  7. package/build/cjs/lib/node/CCHandlers/UserCredentialCC.d.ts +2 -1
  8. package/build/cjs/lib/node/CCHandlers/UserCredentialCC.js +37 -2
  9. package/build/cjs/lib/node/CCHandlers/UserCredentialCC.js.map +2 -2
  10. package/build/cjs/lib/node/Node.js +2 -0
  11. package/build/cjs/lib/node/Node.js.map +2 -2
  12. package/build/cjs/lib/node/feature-apis/AccessControl.d.ts +78 -13
  13. package/build/cjs/lib/node/feature-apis/AccessControl.js +416 -105
  14. package/build/cjs/lib/node/feature-apis/AccessControl.js.map +3 -3
  15. package/build/cjs/lib/node/mockCCBehaviors/UserCredential.js +99 -80
  16. package/build/cjs/lib/node/mockCCBehaviors/UserCredential.js.map +2 -2
  17. package/build/esm/Node.d.ts +1 -1
  18. package/build/esm/Node.d.ts.map +1 -1
  19. package/build/esm/Node.js +1 -1
  20. package/build/esm/Node.js.map +1 -1
  21. package/build/esm/lib/_version.d.ts +1 -1
  22. package/build/esm/lib/_version.js +1 -1
  23. package/build/esm/lib/node/CCHandlers/UserCredentialCC.d.ts +2 -1
  24. package/build/esm/lib/node/CCHandlers/UserCredentialCC.d.ts.map +1 -1
  25. package/build/esm/lib/node/CCHandlers/UserCredentialCC.js +45 -2
  26. package/build/esm/lib/node/CCHandlers/UserCredentialCC.js.map +1 -1
  27. package/build/esm/lib/node/Node.d.ts.map +1 -1
  28. package/build/esm/lib/node/Node.js +5 -2
  29. package/build/esm/lib/node/Node.js.map +1 -1
  30. package/build/esm/lib/node/feature-apis/AccessControl.d.ts +78 -13
  31. package/build/esm/lib/node/feature-apis/AccessControl.d.ts.map +1 -1
  32. package/build/esm/lib/node/feature-apis/AccessControl.js +467 -113
  33. package/build/esm/lib/node/feature-apis/AccessControl.js.map +1 -1
  34. package/build/esm/lib/node/mockCCBehaviors/UserCredential.d.ts.map +1 -1
  35. package/build/esm/lib/node/mockCCBehaviors/UserCredential.js +109 -86
  36. package/build/esm/lib/node/mockCCBehaviors/UserCredential.js.map +1 -1
  37. package/package.json +6 -6
@@ -9,7 +9,7 @@ export { VirtualEndpoint } from "./lib/node/VirtualEndpoint.js";
9
9
  export { VirtualNode } from "./lib/node/VirtualNode.js";
10
10
  export type { VirtualValueID } from "./lib/node/VirtualNode.js";
11
11
  export * from "./lib/node/_Types.js";
12
- export { AccessControlAPI } from "./lib/node/feature-apis/AccessControl.js";
12
+ export { AccessControlAPI, AssignCredentialResult, SetCredentialResult, SetUserResult, } from "./lib/node/feature-apis/AccessControl.js";
13
13
  export type { CredentialCapabilities, CredentialData, SetUserOptions, UserCapabilities, UserData, } from "./lib/node/feature-apis/AccessControl.js";
14
14
  export { FeatureAPI } from "./lib/node/feature-apis/FeatureAPI.js";
15
15
  //# sourceMappingURL=Node.d.ts.map
package/build/cjs/Node.js CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  var Node_exports = {};
21
21
  __export(Node_exports, {
22
22
  AccessControlAPI: () => import_AccessControl.AccessControlAPI,
23
+ AssignCredentialResult: () => import_AccessControl.AssignCredentialResult,
23
24
  DeviceClass: () => import_DeviceClass.DeviceClass,
24
25
  Endpoint: () => import_Endpoint.Endpoint,
25
26
  FeatureAPI: () => import_FeatureAPI.FeatureAPI,
@@ -29,6 +30,8 @@ __export(Node_exports, {
29
30
  NodeType: () => import_core.NodeType,
30
31
  ProtocolDataRate: () => import_core.ProtocolDataRate,
31
32
  ProtocolVersion: () => import_core.ProtocolVersion,
33
+ SetCredentialResult: () => import_AccessControl.SetCredentialResult,
34
+ SetUserResult: () => import_AccessControl.SetUserResult,
32
35
  VirtualEndpoint: () => import_VirtualEndpoint.VirtualEndpoint,
33
36
  VirtualNode: () => import_VirtualNode.VirtualNode,
34
37
  ZWaveNode: () => import_Node.ZWaveNode
@@ -46,6 +49,7 @@ var import_FeatureAPI = require("./lib/node/feature-apis/FeatureAPI.js");
46
49
  // Annotate the CommonJS export names for ESM import in node:
47
50
  0 && (module.exports = {
48
51
  AccessControlAPI,
52
+ AssignCredentialResult,
49
53
  DeviceClass,
50
54
  Endpoint,
51
55
  FeatureAPI,
@@ -55,6 +59,8 @@ var import_FeatureAPI = require("./lib/node/feature-apis/FeatureAPI.js");
55
59
  NodeType,
56
60
  ProtocolDataRate,
57
61
  ProtocolVersion,
62
+ SetCredentialResult,
63
+ SetUserResult,
58
64
  VirtualEndpoint,
59
65
  VirtualNode,
60
66
  ZWaveNode,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/Node.ts"],
4
- "sourcesContent": ["export {\n\tNODE_ID_BROADCAST,\n\tNODE_ID_BROADCAST_LR,\n\tNODE_ID_MAX,\n\tNodeType,\n\tProtocolDataRate,\n\tProtocolVersion,\n} from \"@zwave-js/core\";\nexport type { DataRate, FLiRS } from \"@zwave-js/core\";\nexport { DeviceClass } from \"./lib/node/DeviceClass.js\";\nexport type { NodeDump } from \"./lib/node/Dump.js\";\nexport { Endpoint } from \"./lib/node/Endpoint.js\";\nexport { ZWaveNode } from \"./lib/node/Node.js\";\nexport type {\n\tNodeStatistics,\n\tRouteStatistics,\n} from \"./lib/node/NodeStatistics.js\";\nexport { VirtualEndpoint } from \"./lib/node/VirtualEndpoint.js\";\nexport { VirtualNode } from \"./lib/node/VirtualNode.js\";\nexport type { VirtualValueID } from \"./lib/node/VirtualNode.js\";\nexport * from \"./lib/node/_Types.js\";\nexport { AccessControlAPI } from \"./lib/node/feature-apis/AccessControl.js\";\nexport type {\n\tCredentialCapabilities,\n\tCredentialData,\n\tSetUserOptions,\n\tUserCapabilities,\n\tUserData,\n} from \"./lib/node/feature-apis/AccessControl.js\";\nexport { FeatureAPI } from \"./lib/node/feature-apis/FeatureAPI.js\";\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;AAAA,kBAOO;AAEP,yBAA4B;AAE5B,sBAAyB;AACzB,kBAA0B;AAK1B,6BAAgC;AAChC,yBAA4B;AAE5B,yBAAc,iCApBd;AAqBA,2BAAiC;AAQjC,wBAA2B;",
4
+ "sourcesContent": ["export {\n\tNODE_ID_BROADCAST,\n\tNODE_ID_BROADCAST_LR,\n\tNODE_ID_MAX,\n\tNodeType,\n\tProtocolDataRate,\n\tProtocolVersion,\n} from \"@zwave-js/core\";\nexport type { DataRate, FLiRS } from \"@zwave-js/core\";\nexport { DeviceClass } from \"./lib/node/DeviceClass.js\";\nexport type { NodeDump } from \"./lib/node/Dump.js\";\nexport { Endpoint } from \"./lib/node/Endpoint.js\";\nexport { ZWaveNode } from \"./lib/node/Node.js\";\nexport type {\n\tNodeStatistics,\n\tRouteStatistics,\n} from \"./lib/node/NodeStatistics.js\";\nexport { VirtualEndpoint } from \"./lib/node/VirtualEndpoint.js\";\nexport { VirtualNode } from \"./lib/node/VirtualNode.js\";\nexport type { VirtualValueID } from \"./lib/node/VirtualNode.js\";\nexport * from \"./lib/node/_Types.js\";\nexport {\n\tAccessControlAPI,\n\tAssignCredentialResult,\n\tSetCredentialResult,\n\tSetUserResult,\n} from \"./lib/node/feature-apis/AccessControl.js\";\nexport type {\n\tCredentialCapabilities,\n\tCredentialData,\n\tSetUserOptions,\n\tUserCapabilities,\n\tUserData,\n} from \"./lib/node/feature-apis/AccessControl.js\";\nexport { FeatureAPI } from \"./lib/node/feature-apis/FeatureAPI.js\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;AAAA,kBAOO;AAEP,yBAA4B;AAE5B,sBAAyB;AACzB,kBAA0B;AAK1B,6BAAgC;AAChC,yBAA4B;AAE5B,yBAAc,iCApBd;AAqBA,2BAKO;AAQP,wBAA2B;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,3 @@
1
- export declare const PACKAGE_VERSION = "15.23.2";
1
+ export declare const PACKAGE_VERSION = "15.23.4";
2
2
  export declare const PACKAGE_NAME = "zwave-js";
3
3
  //# sourceMappingURL=_version.d.ts.map
@@ -22,7 +22,7 @@ __export(version_exports, {
22
22
  PACKAGE_VERSION: () => PACKAGE_VERSION
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- const PACKAGE_VERSION = "15.23.2";
25
+ const PACKAGE_VERSION = "15.23.4";
26
26
  const PACKAGE_NAME = "zwave-js";
27
27
  // Annotate the CommonJS export names for ESM import in node:
28
28
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/_version.ts"],
4
- "sourcesContent": ["// This file is auto-generated by the codegen maintenance script\nexport const PACKAGE_VERSION = \"15.23.2\";\nexport const PACKAGE_NAME = \"zwave-js\";\n"],
4
+ "sourcesContent": ["// This file is auto-generated by the codegen maintenance script\nexport const PACKAGE_VERSION = \"15.23.4\";\nexport const PACKAGE_NAME = \"zwave-js\";\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;;AACO,MAAM,kBAAkB;AACxB,MAAM,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,7 @@
1
- import { type UserCredentialCCCredentialLearnReport, type UserCredentialCCCredentialReport, type UserCredentialCCUserReport } from "@zwave-js/cc/UserCredentialCC";
1
+ import { type UserCredentialCCAssociationReport, type UserCredentialCCCredentialLearnReport, type UserCredentialCCCredentialReport, type UserCredentialCCUserReport } from "@zwave-js/cc/UserCredentialCC";
2
2
  import type { ZWaveNode } from "../Node.js";
3
3
  export declare function handleUserCredentialUserReport(node: ZWaveNode, report: UserCredentialCCUserReport): void;
4
4
  export declare function handleUserCredentialCredentialReport(node: ZWaveNode, report: UserCredentialCCCredentialReport): void;
5
+ export declare function handleUserCredentialAssociationReport(node: ZWaveNode, report: UserCredentialCCAssociationReport): void;
5
6
  export declare function handleUserCredentialCredentialLearnReport(node: ZWaveNode, report: UserCredentialCCCredentialLearnReport): void;
6
7
  //# sourceMappingURL=UserCredentialCC.d.ts.map
@@ -19,12 +19,14 @@ var __copyProps = (to, from, except, desc) => {
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
  var UserCredentialCC_exports = {};
21
21
  __export(UserCredentialCC_exports, {
22
+ handleUserCredentialAssociationReport: () => handleUserCredentialAssociationReport,
22
23
  handleUserCredentialCredentialLearnReport: () => handleUserCredentialCredentialLearnReport,
23
24
  handleUserCredentialCredentialReport: () => handleUserCredentialCredentialReport,
24
25
  handleUserCredentialUserReport: () => handleUserCredentialUserReport
25
26
  });
26
27
  module.exports = __toCommonJS(UserCredentialCC_exports);
27
28
  var import_cc = require("@zwave-js/cc");
29
+ var import_UserCredentialCC = require("@zwave-js/cc/UserCredentialCC");
28
30
  function buildUserArgs(report) {
29
31
  return {
30
32
  userId: report.userId,
@@ -40,12 +42,19 @@ function handleUserCredentialUserReport(node, report) {
40
42
  const endpoint = node.getEndpoint(report.endpointIndex) ?? node;
41
43
  switch (report.reportType) {
42
44
  case import_cc.UserCredentialUserReportType.UserAdded:
45
+ // The device rejected an Add because the slot was already occupied,
46
+ // but reported the actual user data. Notify applications about the
47
+ // previously-unknown user.
48
+ case import_cc.UserCredentialUserReportType.UserAddRejectedLocationOccupied:
43
49
  node.emit("user added", endpoint, buildUserArgs(report));
44
50
  break;
45
51
  case import_cc.UserCredentialUserReportType.UserModified:
46
52
  node.emit("user modified", endpoint, buildUserArgs(report));
47
53
  break;
48
54
  case import_cc.UserCredentialUserReportType.UserDeleted:
55
+ // The device rejected a Modify because the slot was empty, meaning
56
+ // our cache was stale. Notify applications that the user is gone.
57
+ case import_cc.UserCredentialUserReportType.UserModifyRejectedLocationEmpty:
49
58
  node.emit("user deleted", endpoint, {
50
59
  userId: report.userId
51
60
  });
@@ -55,13 +64,14 @@ function handleUserCredentialUserReport(node, report) {
55
64
  __name(handleUserCredentialUserReport, "handleUserCredentialUserReport");
56
65
  function handleUserCredentialCredentialReport(node, report) {
57
66
  const endpoint = node.getEndpoint(report.endpointIndex) ?? node;
67
+ const normalizedData = report.credentialData ? (0, import_UserCredentialCC.normalizeCredentialData)(report.credentialType, report.credentialData) : void 0;
58
68
  switch (report.reportType) {
59
69
  case import_cc.UserCredentialCredentialReportType.CredentialAdded:
60
70
  node.emit("credential added", endpoint, {
61
71
  userId: report.userId,
62
72
  credentialType: report.credentialType,
63
73
  credentialSlot: report.credentialSlot,
64
- data: report.credentialData ?? void 0
74
+ data: normalizedData
65
75
  });
66
76
  break;
67
77
  case import_cc.UserCredentialCredentialReportType.CredentialModified:
@@ -69,19 +79,43 @@ function handleUserCredentialCredentialReport(node, report) {
69
79
  userId: report.userId,
70
80
  credentialType: report.credentialType,
71
81
  credentialSlot: report.credentialSlot,
72
- data: report.credentialData ?? void 0
82
+ data: normalizedData
73
83
  });
74
84
  break;
75
85
  case import_cc.UserCredentialCredentialReportType.CredentialDeleted:
86
+ // The device rejected a Modify because the slot was empty, meaning
87
+ // our cache was stale. Notify applications that the credential is gone.
88
+ case import_cc.UserCredentialCredentialReportType.CredentialModifyRejectedLocationEmpty:
76
89
  node.emit("credential deleted", endpoint, {
77
90
  userId: report.userId,
78
91
  credentialType: report.credentialType,
79
92
  credentialSlot: report.credentialSlot
80
93
  });
81
94
  break;
95
+ case import_cc.UserCredentialCredentialReportType.CredentialAddRejectedLocationOccupied:
96
+ if (report.credentialReadBack) {
97
+ node.emit("credential added", endpoint, {
98
+ userId: report.userId,
99
+ credentialType: report.credentialType,
100
+ credentialSlot: report.credentialSlot,
101
+ data: normalizedData
102
+ });
103
+ }
104
+ break;
82
105
  }
83
106
  }
84
107
  __name(handleUserCredentialCredentialReport, "handleUserCredentialCredentialReport");
108
+ function handleUserCredentialAssociationReport(node, report) {
109
+ if (report.status !== 0)
110
+ return;
111
+ const endpoint = node.getEndpoint(report.endpointIndex) ?? node;
112
+ node.emit("credential modified", endpoint, {
113
+ userId: report.destinationUserId,
114
+ credentialType: report.credentialType,
115
+ credentialSlot: report.credentialSlot
116
+ });
117
+ }
118
+ __name(handleUserCredentialAssociationReport, "handleUserCredentialAssociationReport");
85
119
  function handleUserCredentialCredentialLearnReport(node, report) {
86
120
  const endpoint = node.getEndpoint(report.endpointIndex) ?? node;
87
121
  if (report.stepsRemaining > 0) {
@@ -105,6 +139,7 @@ function handleUserCredentialCredentialLearnReport(node, report) {
105
139
  __name(handleUserCredentialCredentialLearnReport, "handleUserCredentialCredentialLearnReport");
106
140
  // Annotate the CommonJS export names for ESM import in node:
107
141
  0 && (module.exports = {
142
+ handleUserCredentialAssociationReport,
108
143
  handleUserCredentialCredentialLearnReport,
109
144
  handleUserCredentialCredentialReport,
110
145
  handleUserCredentialUserReport
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/node/CCHandlers/UserCredentialCC.ts"],
4
- "sourcesContent": ["import {\n\tUserCredentialCredentialReportType,\n\tUserCredentialLearnStatus,\n\tUserCredentialUserReportType,\n} from \"@zwave-js/cc\";\nimport {\n\ttype UserCredentialCCCredentialLearnReport,\n\ttype UserCredentialCCCredentialReport,\n\ttype UserCredentialCCUserReport,\n} from \"@zwave-js/cc/UserCredentialCC\";\nimport type { ZWaveNode } from \"../Node.js\";\n\nfunction buildUserArgs(report: UserCredentialCCUserReport) {\n\treturn {\n\t\tuserId: report.userId,\n\t\tactive: report.active,\n\t\tuserType: report.userType,\n\t\tuserName: report.userName || undefined,\n\t\tcredentialRule: report.credentialRule,\n\t\texpiringTimeoutMinutes: report.expiringTimeoutMinutes || undefined,\n\t};\n}\n\nexport function handleUserCredentialUserReport(\n\tnode: ZWaveNode,\n\treport: UserCredentialCCUserReport,\n): void {\n\tconst endpoint = node.getEndpoint(report.endpointIndex) ?? node;\n\n\t// Trust the reportType from the device\n\tswitch (report.reportType) {\n\t\tcase UserCredentialUserReportType.UserAdded:\n\t\t\tnode.emit(\"user added\", endpoint, buildUserArgs(report));\n\t\t\tbreak;\n\t\tcase UserCredentialUserReportType.UserModified:\n\t\t\tnode.emit(\"user modified\", endpoint, buildUserArgs(report));\n\t\t\tbreak;\n\t\tcase UserCredentialUserReportType.UserDeleted:\n\t\t\tnode.emit(\"user deleted\", endpoint, {\n\t\t\t\tuserId: report.userId,\n\t\t\t});\n\t\t\tbreak;\n\t}\n}\n\nexport function handleUserCredentialCredentialReport(\n\tnode: ZWaveNode,\n\treport: UserCredentialCCCredentialReport,\n): void {\n\tconst endpoint = node.getEndpoint(report.endpointIndex) ?? node;\n\n\t// Trust the reportType from the device\n\tswitch (report.reportType) {\n\t\tcase UserCredentialCredentialReportType.CredentialAdded:\n\t\t\tnode.emit(\"credential added\", endpoint, {\n\t\t\t\tuserId: report.userId,\n\t\t\t\tcredentialType: report.credentialType,\n\t\t\t\tcredentialSlot: report.credentialSlot,\n\t\t\t\tdata: report.credentialData ?? undefined,\n\t\t\t});\n\t\t\tbreak;\n\t\tcase UserCredentialCredentialReportType.CredentialModified:\n\t\t\tnode.emit(\"credential modified\", endpoint, {\n\t\t\t\tuserId: report.userId,\n\t\t\t\tcredentialType: report.credentialType,\n\t\t\t\tcredentialSlot: report.credentialSlot,\n\t\t\t\tdata: report.credentialData ?? undefined,\n\t\t\t});\n\t\t\tbreak;\n\t\tcase UserCredentialCredentialReportType.CredentialDeleted:\n\t\t\tnode.emit(\"credential deleted\", endpoint, {\n\t\t\t\tuserId: report.userId,\n\t\t\t\tcredentialType: report.credentialType,\n\t\t\t\tcredentialSlot: report.credentialSlot,\n\t\t\t});\n\t\t\tbreak;\n\t}\n}\n\nexport function handleUserCredentialCredentialLearnReport(\n\tnode: ZWaveNode,\n\treport: UserCredentialCCCredentialLearnReport,\n): void {\n\tconst endpoint = node.getEndpoint(report.endpointIndex) ?? node;\n\n\tif (report.stepsRemaining > 0) {\n\t\tnode.emit(\"credential learn progress\", endpoint, {\n\t\t\tuserId: report.userId,\n\t\t\tcredentialType: report.credentialType,\n\t\t\tcredentialSlot: report.credentialSlot,\n\t\t\tstepsRemaining: report.stepsRemaining,\n\t\t\tstatus: report.learnStatus,\n\t\t});\n\t} else {\n\t\tnode.emit(\"credential learn completed\", endpoint, {\n\t\t\tuserId: report.userId,\n\t\t\tcredentialType: report.credentialType,\n\t\t\tcredentialSlot: report.credentialSlot,\n\t\t\tstatus: report.learnStatus,\n\t\t\tsuccess: report.learnStatus === UserCredentialLearnStatus.Success,\n\t\t});\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAAA,gBAIO;AAQP,SAAS,cAAc,QAAkC;AACxD,SAAO;IACN,QAAQ,OAAO;IACf,QAAQ,OAAO;IACf,UAAU,OAAO;IACjB,UAAU,OAAO,YAAY;IAC7B,gBAAgB,OAAO;IACvB,wBAAwB,OAAO,0BAA0B;;AAE3D;AATS;AAWH,SAAU,+BACf,MACA,QAAkC;AAElC,QAAM,WAAW,KAAK,YAAY,OAAO,aAAa,KAAK;AAG3D,UAAQ,OAAO,YAAY;IAC1B,KAAK,uCAA6B;AACjC,WAAK,KAAK,cAAc,UAAU,cAAc,MAAM,CAAC;AACvD;IACD,KAAK,uCAA6B;AACjC,WAAK,KAAK,iBAAiB,UAAU,cAAc,MAAM,CAAC;AAC1D;IACD,KAAK,uCAA6B;AACjC,WAAK,KAAK,gBAAgB,UAAU;QACnC,QAAQ,OAAO;OACf;AACD;EACF;AACD;AApBgB;AAsBV,SAAU,qCACf,MACA,QAAwC;AAExC,QAAM,WAAW,KAAK,YAAY,OAAO,aAAa,KAAK;AAG3D,UAAQ,OAAO,YAAY;IAC1B,KAAK,6CAAmC;AACvC,WAAK,KAAK,oBAAoB,UAAU;QACvC,QAAQ,OAAO;QACf,gBAAgB,OAAO;QACvB,gBAAgB,OAAO;QACvB,MAAM,OAAO,kBAAkB;OAC/B;AACD;IACD,KAAK,6CAAmC;AACvC,WAAK,KAAK,uBAAuB,UAAU;QAC1C,QAAQ,OAAO;QACf,gBAAgB,OAAO;QACvB,gBAAgB,OAAO;QACvB,MAAM,OAAO,kBAAkB;OAC/B;AACD;IACD,KAAK,6CAAmC;AACvC,WAAK,KAAK,sBAAsB,UAAU;QACzC,QAAQ,OAAO;QACf,gBAAgB,OAAO;QACvB,gBAAgB,OAAO;OACvB;AACD;EACF;AACD;AAhCgB;AAkCV,SAAU,0CACf,MACA,QAA6C;AAE7C,QAAM,WAAW,KAAK,YAAY,OAAO,aAAa,KAAK;AAE3D,MAAI,OAAO,iBAAiB,GAAG;AAC9B,SAAK,KAAK,6BAA6B,UAAU;MAChD,QAAQ,OAAO;MACf,gBAAgB,OAAO;MACvB,gBAAgB,OAAO;MACvB,gBAAgB,OAAO;MACvB,QAAQ,OAAO;KACf;EACF,OAAO;AACN,SAAK,KAAK,8BAA8B,UAAU;MACjD,QAAQ,OAAO;MACf,gBAAgB,OAAO;MACvB,gBAAgB,OAAO;MACvB,QAAQ,OAAO;MACf,SAAS,OAAO,gBAAgB,oCAA0B;KAC1D;EACF;AACD;AAvBgB;",
4
+ "sourcesContent": ["import {\n\tUserCredentialCredentialReportType,\n\tUserCredentialLearnStatus,\n\tUserCredentialUserReportType,\n} from \"@zwave-js/cc\";\nimport {\n\ttype UserCredentialCCAssociationReport,\n\ttype UserCredentialCCCredentialLearnReport,\n\ttype UserCredentialCCCredentialReport,\n\ttype UserCredentialCCUserReport,\n\tnormalizeCredentialData,\n} from \"@zwave-js/cc/UserCredentialCC\";\nimport type { ZWaveNode } from \"../Node.js\";\n\nfunction buildUserArgs(report: UserCredentialCCUserReport) {\n\treturn {\n\t\tuserId: report.userId,\n\t\tactive: report.active,\n\t\tuserType: report.userType,\n\t\tuserName: report.userName || undefined,\n\t\tcredentialRule: report.credentialRule,\n\t\texpiringTimeoutMinutes: report.expiringTimeoutMinutes || undefined,\n\t};\n}\n\nexport function handleUserCredentialUserReport(\n\tnode: ZWaveNode,\n\treport: UserCredentialCCUserReport,\n): void {\n\tconst endpoint = node.getEndpoint(report.endpointIndex) ?? node;\n\n\t// Trust the reportType from the device\n\tswitch (report.reportType) {\n\t\tcase UserCredentialUserReportType.UserAdded:\n\t\t// The device rejected an Add because the slot was already occupied,\n\t\t// but reported the actual user data. Notify applications about the\n\t\t// previously-unknown user.\n\t\tcase UserCredentialUserReportType.UserAddRejectedLocationOccupied:\n\t\t\tnode.emit(\"user added\", endpoint, buildUserArgs(report));\n\t\t\tbreak;\n\t\tcase UserCredentialUserReportType.UserModified:\n\t\t\tnode.emit(\"user modified\", endpoint, buildUserArgs(report));\n\t\t\tbreak;\n\t\tcase UserCredentialUserReportType.UserDeleted:\n\t\t// The device rejected a Modify because the slot was empty, meaning\n\t\t// our cache was stale. Notify applications that the user is gone.\n\t\tcase UserCredentialUserReportType.UserModifyRejectedLocationEmpty:\n\t\t\tnode.emit(\"user deleted\", endpoint, {\n\t\t\t\tuserId: report.userId,\n\t\t\t});\n\t\t\tbreak;\n\t}\n}\n\nexport function handleUserCredentialCredentialReport(\n\tnode: ZWaveNode,\n\treport: UserCredentialCCCredentialReport,\n): void {\n\tconst endpoint = node.getEndpoint(report.endpointIndex) ?? node;\n\n\tconst normalizedData = report.credentialData\n\t\t? normalizeCredentialData(report.credentialType, report.credentialData)\n\t\t: undefined;\n\n\t// Trust the reportType from the device\n\tswitch (report.reportType) {\n\t\tcase UserCredentialCredentialReportType.CredentialAdded:\n\t\t\tnode.emit(\"credential added\", endpoint, {\n\t\t\t\tuserId: report.userId,\n\t\t\t\tcredentialType: report.credentialType,\n\t\t\t\tcredentialSlot: report.credentialSlot,\n\t\t\t\tdata: normalizedData,\n\t\t\t});\n\t\t\tbreak;\n\t\tcase UserCredentialCredentialReportType.CredentialModified:\n\t\t\tnode.emit(\"credential modified\", endpoint, {\n\t\t\t\tuserId: report.userId,\n\t\t\t\tcredentialType: report.credentialType,\n\t\t\t\tcredentialSlot: report.credentialSlot,\n\t\t\t\tdata: normalizedData,\n\t\t\t});\n\t\t\tbreak;\n\t\tcase UserCredentialCredentialReportType.CredentialDeleted:\n\t\t// The device rejected a Modify because the slot was empty, meaning\n\t\t// our cache was stale. Notify applications that the credential is gone.\n\t\tcase UserCredentialCredentialReportType\n\t\t\t.CredentialModifyRejectedLocationEmpty:\n\t\t\tnode.emit(\"credential deleted\", endpoint, {\n\t\t\t\tuserId: report.userId,\n\t\t\t\tcredentialType: report.credentialType,\n\t\t\t\tcredentialSlot: report.credentialSlot,\n\t\t\t});\n\t\t\tbreak;\n\t\tcase UserCredentialCredentialReportType\n\t\t\t.CredentialAddRejectedLocationOccupied:\n\t\t\t// The device rejected an Add because the slot was already occupied.\n\t\t\t// When read-back is set, the report contains the actual credential\n\t\t\t// data \u2014 notify applications about the previously-unknown credential.\n\t\t\tif (report.credentialReadBack) {\n\t\t\t\tnode.emit(\"credential added\", endpoint, {\n\t\t\t\t\tuserId: report.userId,\n\t\t\t\t\tcredentialType: report.credentialType,\n\t\t\t\t\tcredentialSlot: report.credentialSlot,\n\t\t\t\t\tdata: normalizedData,\n\t\t\t\t});\n\t\t\t}\n\t\t\tbreak;\n\t}\n}\n\nexport function handleUserCredentialAssociationReport(\n\tnode: ZWaveNode,\n\treport: UserCredentialCCAssociationReport,\n): void {\n\t// A successful association is semantically a modification of the credential's\n\t// owner. Applications can observe it via the existing \"credential modified\"\n\t// event. Failure statuses are delivered to the initiating node via the\n\t// command response and do not fan out to listeners.\n\tif (report.status !== 0) return;\n\tconst endpoint = node.getEndpoint(report.endpointIndex) ?? node;\n\tnode.emit(\"credential modified\", endpoint, {\n\t\tuserId: report.destinationUserId,\n\t\tcredentialType: report.credentialType,\n\t\tcredentialSlot: report.credentialSlot,\n\t});\n}\n\nexport function handleUserCredentialCredentialLearnReport(\n\tnode: ZWaveNode,\n\treport: UserCredentialCCCredentialLearnReport,\n): void {\n\tconst endpoint = node.getEndpoint(report.endpointIndex) ?? node;\n\n\tif (report.stepsRemaining > 0) {\n\t\tnode.emit(\"credential learn progress\", endpoint, {\n\t\t\tuserId: report.userId,\n\t\t\tcredentialType: report.credentialType,\n\t\t\tcredentialSlot: report.credentialSlot,\n\t\t\tstepsRemaining: report.stepsRemaining,\n\t\t\tstatus: report.learnStatus,\n\t\t});\n\t} else {\n\t\tnode.emit(\"credential learn completed\", endpoint, {\n\t\t\tuserId: report.userId,\n\t\t\tcredentialType: report.credentialType,\n\t\t\tcredentialSlot: report.credentialSlot,\n\t\t\tstatus: report.learnStatus,\n\t\t\tsuccess: report.learnStatus === UserCredentialLearnStatus.Success,\n\t\t});\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AAAA,gBAIO;AACP,8BAMO;AAGP,SAAS,cAAc,QAAkC;AACxD,SAAO;IACN,QAAQ,OAAO;IACf,QAAQ,OAAO;IACf,UAAU,OAAO;IACjB,UAAU,OAAO,YAAY;IAC7B,gBAAgB,OAAO;IACvB,wBAAwB,OAAO,0BAA0B;;AAE3D;AATS;AAWH,SAAU,+BACf,MACA,QAAkC;AAElC,QAAM,WAAW,KAAK,YAAY,OAAO,aAAa,KAAK;AAG3D,UAAQ,OAAO,YAAY;IAC1B,KAAK,uCAA6B;;;;IAIlC,KAAK,uCAA6B;AACjC,WAAK,KAAK,cAAc,UAAU,cAAc,MAAM,CAAC;AACvD;IACD,KAAK,uCAA6B;AACjC,WAAK,KAAK,iBAAiB,UAAU,cAAc,MAAM,CAAC;AAC1D;IACD,KAAK,uCAA6B;;;IAGlC,KAAK,uCAA6B;AACjC,WAAK,KAAK,gBAAgB,UAAU;QACnC,QAAQ,OAAO;OACf;AACD;EACF;AACD;AA3BgB;AA6BV,SAAU,qCACf,MACA,QAAwC;AAExC,QAAM,WAAW,KAAK,YAAY,OAAO,aAAa,KAAK;AAE3D,QAAM,iBAAiB,OAAO,qBAC3B,iDAAwB,OAAO,gBAAgB,OAAO,cAAc,IACpE;AAGH,UAAQ,OAAO,YAAY;IAC1B,KAAK,6CAAmC;AACvC,WAAK,KAAK,oBAAoB,UAAU;QACvC,QAAQ,OAAO;QACf,gBAAgB,OAAO;QACvB,gBAAgB,OAAO;QACvB,MAAM;OACN;AACD;IACD,KAAK,6CAAmC;AACvC,WAAK,KAAK,uBAAuB,UAAU;QAC1C,QAAQ,OAAO;QACf,gBAAgB,OAAO;QACvB,gBAAgB,OAAO;QACvB,MAAM;OACN;AACD;IACD,KAAK,6CAAmC;;;IAGxC,KAAK,6CACH;AACD,WAAK,KAAK,sBAAsB,UAAU;QACzC,QAAQ,OAAO;QACf,gBAAgB,OAAO;QACvB,gBAAgB,OAAO;OACvB;AACD;IACD,KAAK,6CACH;AAID,UAAI,OAAO,oBAAoB;AAC9B,aAAK,KAAK,oBAAoB,UAAU;UACvC,QAAQ,OAAO;UACf,gBAAgB,OAAO;UACvB,gBAAgB,OAAO;UACvB,MAAM;SACN;MACF;AACA;EACF;AACD;AAtDgB;AAwDV,SAAU,sCACf,MACA,QAAyC;AAMzC,MAAI,OAAO,WAAW;AAAG;AACzB,QAAM,WAAW,KAAK,YAAY,OAAO,aAAa,KAAK;AAC3D,OAAK,KAAK,uBAAuB,UAAU;IAC1C,QAAQ,OAAO;IACf,gBAAgB,OAAO;IACvB,gBAAgB,OAAO;GACvB;AACF;AAfgB;AAiBV,SAAU,0CACf,MACA,QAA6C;AAE7C,QAAM,WAAW,KAAK,YAAY,OAAO,aAAa,KAAK;AAE3D,MAAI,OAAO,iBAAiB,GAAG;AAC9B,SAAK,KAAK,6BAA6B,UAAU;MAChD,QAAQ,OAAO;MACf,gBAAgB,OAAO;MACvB,gBAAgB,OAAO;MACvB,gBAAgB,OAAO;MACvB,QAAQ,OAAO;KACf;EACF,OAAO;AACN,SAAK,KAAK,8BAA8B,UAAU;MACjD,QAAQ,OAAO;MACf,gBAAgB,OAAO;MACvB,gBAAgB,OAAO;MACvB,QAAQ,OAAO;MACf,SAAS,OAAO,gBAAgB,oCAA0B;KAC1D;EACF;AACD;AAvBgB;",
6
6
  "names": []
7
7
  }
@@ -1385,6 +1385,8 @@ protocol version: ${this.protocolVersion}`;
1385
1385
  return (0, import_UserCredentialCC2.handleUserCredentialCredentialReport)(this, command);
1386
1386
  } else if (command instanceof import_UserCredentialCC.UserCredentialCCCredentialLearnReport) {
1387
1387
  return (0, import_UserCredentialCC2.handleUserCredentialCredentialLearnReport)(this, command);
1388
+ } else if (command instanceof import_UserCredentialCC.UserCredentialCCAssociationReport) {
1389
+ return (0, import_UserCredentialCC2.handleUserCredentialAssociationReport)(this, command);
1388
1390
  } else if (command instanceof import_cc.TimeCCTimeGet) {
1389
1391
  return (0, import_TimeCC.handleTimeGet)(this.driver, this, command);
1390
1392
  } else if (command instanceof import_cc.TimeCCDateGet) {