zwave-js 15.23.1 → 15.23.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/build/cjs/Node.d.ts +0 -1
- package/build/cjs/Node.js +0 -3
- package/build/cjs/Node.js.map +2 -2
- package/build/cjs/lib/_version.d.ts +1 -1
- package/build/cjs/lib/_version.js +1 -1
- package/build/cjs/lib/_version.js.map +1 -1
- package/build/cjs/lib/node/endpoint-mixins/index.d.ts +6 -4
- package/build/cjs/lib/node/endpoint-mixins/index.js +9 -8
- package/build/cjs/lib/node/endpoint-mixins/index.js.map +2 -2
- package/build/cjs/lib/node/feature-apis/AccessControl.d.ts +2 -2
- package/build/cjs/lib/node/feature-apis/AccessControl.js +19 -42
- package/build/cjs/lib/node/feature-apis/AccessControl.js.map +2 -2
- package/build/esm/Node.d.ts +0 -1
- package/build/esm/Node.d.ts.map +1 -1
- package/build/esm/Node.js +0 -1
- package/build/esm/Node.js.map +1 -1
- package/build/esm/lib/_version.d.ts +1 -1
- package/build/esm/lib/_version.js +1 -1
- package/build/esm/lib/node/endpoint-mixins/index.d.ts +6 -4
- package/build/esm/lib/node/endpoint-mixins/index.d.ts.map +1 -1
- package/build/esm/lib/node/endpoint-mixins/index.js +10 -9
- package/build/esm/lib/node/endpoint-mixins/index.js.map +1 -1
- package/build/esm/lib/node/feature-apis/AccessControl.d.ts +2 -2
- package/build/esm/lib/node/feature-apis/AccessControl.d.ts.map +1 -1
- package/build/esm/lib/node/feature-apis/AccessControl.js +19 -43
- package/build/esm/lib/node/feature-apis/AccessControl.js.map +1 -1
- package/package.json +1 -1
- package/build/cjs/lib/node/feature-apis/DeviceFeatures.d.ts +0 -5
- package/build/cjs/lib/node/feature-apis/DeviceFeatures.js +0 -32
- package/build/cjs/lib/node/feature-apis/DeviceFeatures.js.map +0 -7
- package/build/esm/lib/node/feature-apis/DeviceFeatures.d.ts +0 -5
- package/build/esm/lib/node/feature-apis/DeviceFeatures.d.ts.map +0 -1
- package/build/esm/lib/node/feature-apis/DeviceFeatures.js +0 -6
- package/build/esm/lib/node/feature-apis/DeviceFeatures.js.map +0 -1
package/build/cjs/Node.d.ts
CHANGED
|
@@ -11,6 +11,5 @@ export type { VirtualValueID } from "./lib/node/VirtualNode.js";
|
|
|
11
11
|
export * from "./lib/node/_Types.js";
|
|
12
12
|
export { AccessControlAPI } from "./lib/node/feature-apis/AccessControl.js";
|
|
13
13
|
export type { CredentialCapabilities, CredentialData, SetUserOptions, UserCapabilities, UserData, } from "./lib/node/feature-apis/AccessControl.js";
|
|
14
|
-
export { DeviceFeatures } from "./lib/node/feature-apis/DeviceFeatures.js";
|
|
15
14
|
export { FeatureAPI } from "./lib/node/feature-apis/FeatureAPI.js";
|
|
16
15
|
//# sourceMappingURL=Node.d.ts.map
|
package/build/cjs/Node.js
CHANGED
|
@@ -21,7 +21,6 @@ var Node_exports = {};
|
|
|
21
21
|
__export(Node_exports, {
|
|
22
22
|
AccessControlAPI: () => import_AccessControl.AccessControlAPI,
|
|
23
23
|
DeviceClass: () => import_DeviceClass.DeviceClass,
|
|
24
|
-
DeviceFeatures: () => import_DeviceFeatures.DeviceFeatures,
|
|
25
24
|
Endpoint: () => import_Endpoint.Endpoint,
|
|
26
25
|
FeatureAPI: () => import_FeatureAPI.FeatureAPI,
|
|
27
26
|
NODE_ID_BROADCAST: () => import_core.NODE_ID_BROADCAST,
|
|
@@ -43,13 +42,11 @@ var import_VirtualEndpoint = require("./lib/node/VirtualEndpoint.js");
|
|
|
43
42
|
var import_VirtualNode = require("./lib/node/VirtualNode.js");
|
|
44
43
|
__reExport(Node_exports, require("./lib/node/_Types.js"), module.exports);
|
|
45
44
|
var import_AccessControl = require("./lib/node/feature-apis/AccessControl.js");
|
|
46
|
-
var import_DeviceFeatures = require("./lib/node/feature-apis/DeviceFeatures.js");
|
|
47
45
|
var import_FeatureAPI = require("./lib/node/feature-apis/FeatureAPI.js");
|
|
48
46
|
// Annotate the CommonJS export names for ESM import in node:
|
|
49
47
|
0 && (module.exports = {
|
|
50
48
|
AccessControlAPI,
|
|
51
49
|
DeviceClass,
|
|
52
|
-
DeviceFeatures,
|
|
53
50
|
Endpoint,
|
|
54
51
|
FeatureAPI,
|
|
55
52
|
NODE_ID_BROADCAST,
|
package/build/cjs/Node.js.map
CHANGED
|
@@ -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 {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA
|
|
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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -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.
|
|
25
|
+
const PACKAGE_VERSION = "15.23.2";
|
|
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.
|
|
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"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;;AACO,MAAM,kBAAkB;AACxB,MAAM,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { AccessControlAPI } from "../feature-apis/AccessControl.js";
|
|
2
|
-
import { DeviceFeatures } from "../feature-apis/DeviceFeatures.js";
|
|
3
2
|
import { EndpointBase } from "./00_Base.js";
|
|
4
3
|
export declare class FeatureAPIsMixin extends EndpointBase {
|
|
5
4
|
private _accessControl?;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* High-level API for managing users and credentials on access control
|
|
7
|
+
* devices. Returns `undefined` if the endpoint supports neither the
|
|
8
|
+
* **User Credential CC** nor the **User Code CC**.
|
|
9
|
+
*/
|
|
10
|
+
get accessControl(): AccessControlAPI | undefined;
|
|
9
11
|
}
|
|
10
12
|
export declare class EndpointMixins extends FeatureAPIsMixin {
|
|
11
13
|
}
|
|
@@ -25,22 +25,23 @@ __export(endpoint_mixins_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(endpoint_mixins_exports);
|
|
26
26
|
var import_core = require("@zwave-js/core");
|
|
27
27
|
var import_AccessControl = require("../feature-apis/AccessControl.js");
|
|
28
|
-
var import_DeviceFeatures = require("../feature-apis/DeviceFeatures.js");
|
|
29
28
|
var import_Base = require("./00_Base.js");
|
|
30
29
|
class FeatureAPIsMixin extends import_Base.EndpointBase {
|
|
31
30
|
static {
|
|
32
31
|
__name(this, "FeatureAPIsMixin");
|
|
33
32
|
}
|
|
34
33
|
_accessControl;
|
|
34
|
+
/**
|
|
35
|
+
* High-level API for managing users and credentials on access control
|
|
36
|
+
* devices. Returns `undefined` if the endpoint supports neither the
|
|
37
|
+
* **User Credential CC** nor the **User Code CC**.
|
|
38
|
+
*/
|
|
35
39
|
get accessControl() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/** Tests whether this endpoint supports the given high-level device feature */
|
|
39
|
-
supportsFeature(feature) {
|
|
40
|
-
switch (feature) {
|
|
41
|
-
case import_DeviceFeatures.DeviceFeatures.AccessControl:
|
|
42
|
-
return this.supportsCC(import_core.CommandClasses["User Credential"]) || this.supportsCC(import_core.CommandClasses["User Code"]);
|
|
40
|
+
if (!this.supportsCC(import_core.CommandClasses["User Credential"]) && !this.supportsCC(import_core.CommandClasses["User Code"])) {
|
|
41
|
+
return void 0;
|
|
43
42
|
}
|
|
43
|
+
this._accessControl ??= new import_AccessControl.AccessControlAPI(this);
|
|
44
|
+
return this._accessControl;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
class EndpointMixins extends FeatureAPIsMixin {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/lib/node/endpoint-mixins/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { CommandClasses } from \"@zwave-js/core\";\nimport { AccessControlAPI } from \"../feature-apis/AccessControl.js\";\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAAA,kBAA+B;AAC/B,2BAAiC;AACjC,
|
|
4
|
+
"sourcesContent": ["import { CommandClasses } from \"@zwave-js/core\";\nimport { AccessControlAPI } from \"../feature-apis/AccessControl.js\";\nimport { EndpointBase } from \"./00_Base.js\";\n\nexport class FeatureAPIsMixin extends EndpointBase {\n\tprivate _accessControl?: AccessControlAPI;\n\n\t/**\n\t * High-level API for managing users and credentials on access control\n\t * devices. Returns `undefined` if the endpoint supports neither the\n\t * **User Credential CC** nor the **User Code CC**.\n\t */\n\tpublic get accessControl(): AccessControlAPI | undefined {\n\t\tif (\n\t\t\t!this.supportsCC(CommandClasses[\"User Credential\"])\n\t\t\t&& !this.supportsCC(CommandClasses[\"User Code\"])\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\tthis._accessControl ??= new AccessControlAPI(this);\n\t\treturn this._accessControl;\n\t}\n}\n\nexport class EndpointMixins extends FeatureAPIsMixin {}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAAA,kBAA+B;AAC/B,2BAAiC;AACjC,kBAA6B;AAEvB,MAAO,yBAAyB,yBAAY;EAJlD,OAIkD;;;EACzC;;;;;;EAOR,IAAW,gBAAa;AACvB,QACC,CAAC,KAAK,WAAW,2BAAe,iBAAiB,CAAC,KAC/C,CAAC,KAAK,WAAW,2BAAe,WAAW,CAAC,GAC9C;AACD,aAAO;IACR;AACA,SAAK,mBAAmB,IAAI,sCAAiB,IAAI;AACjD,WAAO,KAAK;EACb;;AAGK,MAAO,uBAAuB,iBAAgB;EAxBpD,OAwBoD;;;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -40,12 +40,12 @@ export declare class AccessControlAPI extends FeatureAPI {
|
|
|
40
40
|
* Returns the user-related capabilities of this endpoint.
|
|
41
41
|
* This method uses cached information from the most recent interview.
|
|
42
42
|
*/
|
|
43
|
-
getUserCapabilitiesCached(): UserCapabilities
|
|
43
|
+
getUserCapabilitiesCached(): UserCapabilities;
|
|
44
44
|
/**
|
|
45
45
|
* Returns the credential-related capabilities of this endpoint.
|
|
46
46
|
* This method uses cached information from the most recent interview.
|
|
47
47
|
*/
|
|
48
|
-
getCredentialCapabilitiesCached(): CredentialCapabilities
|
|
48
|
+
getCredentialCapabilitiesCached(): CredentialCapabilities;
|
|
49
49
|
/**
|
|
50
50
|
* Returns the data for the user with the given ID.
|
|
51
51
|
* This communicates with the node to retrieve fresh information.
|
|
@@ -44,9 +44,6 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
44
44
|
get #usesUserCredentialCC() {
|
|
45
45
|
return this.endpoint.supportsCC(import_core.CommandClasses["User Credential"]);
|
|
46
46
|
}
|
|
47
|
-
get #usesUserCodeCC() {
|
|
48
|
-
return !this.#usesUserCredentialCC && this.endpoint.supportsCC(import_core.CommandClasses["User Code"]);
|
|
49
|
-
}
|
|
50
47
|
/**
|
|
51
48
|
* Returns the user-related capabilities of this endpoint.
|
|
52
49
|
* This method uses cached information from the most recent interview.
|
|
@@ -59,7 +56,7 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
59
56
|
maxUserNameLength: this.getValue(import_UserCredentialCC.UserCredentialCCValues.maxUserNameLength.endpoint(this.endpoint.index)) ?? void 0,
|
|
60
57
|
supportedCredentialRules: this.getValue(import_UserCredentialCC.UserCredentialCCValues.supportedCredentialRules.endpoint(this.endpoint.index)) ?? []
|
|
61
58
|
};
|
|
62
|
-
} else
|
|
59
|
+
} else {
|
|
63
60
|
const supportedStatuses = this.getValue(import_UserCodeCC.UserCodeCCValues.supportedUserIDStatuses.endpoint(this.endpoint.index)) ?? [];
|
|
64
61
|
const supportedUserTypes = [
|
|
65
62
|
import_cc.UserCredentialUserType.General
|
|
@@ -75,7 +72,6 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
75
72
|
supportedCredentialRules: [import_cc.UserCredentialRule.Single]
|
|
76
73
|
};
|
|
77
74
|
}
|
|
78
|
-
return void 0;
|
|
79
75
|
}
|
|
80
76
|
/**
|
|
81
77
|
* Returns the credential-related capabilities of this endpoint.
|
|
@@ -95,7 +91,7 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
95
91
|
supportsAdminCode: this.getValue(import_UserCredentialCC.UserCredentialCCValues.supportsAdminCode.endpoint(this.endpoint.index)) ?? false,
|
|
96
92
|
supportsAdminCodeDeactivation: this.getValue(import_UserCredentialCC.UserCredentialCCValues.supportsAdminCodeDeactivation.endpoint(this.endpoint.index)) ?? false
|
|
97
93
|
};
|
|
98
|
-
} else
|
|
94
|
+
} else {
|
|
99
95
|
const credentialTypes = /* @__PURE__ */ new Map();
|
|
100
96
|
credentialTypes.set(this.#ucCredentialType, {
|
|
101
97
|
numberOfCredentialSlots: 1,
|
|
@@ -110,7 +106,6 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
110
106
|
supportsAdminCodeDeactivation: this.getValue(import_UserCodeCC.UserCodeCCValues.supportsAdminCodeDeactivation.endpoint(this.endpoint.index)) ?? false
|
|
111
107
|
};
|
|
112
108
|
}
|
|
113
|
-
return void 0;
|
|
114
109
|
}
|
|
115
110
|
/**
|
|
116
111
|
* Returns the data for the user with the given ID.
|
|
@@ -130,14 +125,13 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
130
125
|
credentialRule: result.credentialRule ?? void 0,
|
|
131
126
|
expiringTimeoutMinutes: result.expiringTimeoutMinutes || void 0
|
|
132
127
|
};
|
|
133
|
-
} else
|
|
128
|
+
} else {
|
|
134
129
|
const api = this.#ucAPI();
|
|
135
130
|
const result = await api.get(userId);
|
|
136
131
|
if (!result)
|
|
137
132
|
return void 0;
|
|
138
133
|
return this.#mapUserCodeStatusToUserData(userId, result.userIdStatus);
|
|
139
134
|
}
|
|
140
|
-
return void 0;
|
|
141
135
|
}
|
|
142
136
|
/**
|
|
143
137
|
* Returns the data for the user with the given ID.
|
|
@@ -146,10 +140,9 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
146
140
|
getUserCached(userId) {
|
|
147
141
|
if (this.#usesUserCredentialCC) {
|
|
148
142
|
return this.#getUserCached_U3C(userId);
|
|
149
|
-
} else
|
|
143
|
+
} else {
|
|
150
144
|
return this.#getUserCached_UC(userId);
|
|
151
145
|
}
|
|
152
|
-
return void 0;
|
|
153
146
|
}
|
|
154
147
|
/**
|
|
155
148
|
* Returns the data for all configured users.
|
|
@@ -175,7 +168,7 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
175
168
|
nextUserId = result.nextUserId;
|
|
176
169
|
} while (nextUserId > 0);
|
|
177
170
|
return users;
|
|
178
|
-
} else
|
|
171
|
+
} else {
|
|
179
172
|
const api = this.#ucAPI();
|
|
180
173
|
const maxUsers = await api.getUsersCount();
|
|
181
174
|
if (!maxUsers)
|
|
@@ -203,7 +196,6 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
203
196
|
}
|
|
204
197
|
return users;
|
|
205
198
|
}
|
|
206
|
-
return [];
|
|
207
199
|
}
|
|
208
200
|
/**
|
|
209
201
|
* Returns the data for all configured users.
|
|
@@ -219,7 +211,7 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
219
211
|
users.push(user);
|
|
220
212
|
}
|
|
221
213
|
return users;
|
|
222
|
-
} else
|
|
214
|
+
} else {
|
|
223
215
|
const maxUsers = this.getValue(import_UserCodeCC.UserCodeCCValues.supportedUsers.endpoint(this.endpoint.index)) ?? 0;
|
|
224
216
|
const users = [];
|
|
225
217
|
for (let userId = 1; userId <= maxUsers; userId++) {
|
|
@@ -229,7 +221,6 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
229
221
|
}
|
|
230
222
|
return users;
|
|
231
223
|
}
|
|
232
|
-
return [];
|
|
233
224
|
}
|
|
234
225
|
/**
|
|
235
226
|
* Creates or updates the user with the given ID.
|
|
@@ -260,7 +251,7 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
260
251
|
credentialRule: options.credentialRule ?? existing?.credentialRule,
|
|
261
252
|
userName: options.userName ?? existing?.userName
|
|
262
253
|
});
|
|
263
|
-
} else
|
|
254
|
+
} else {
|
|
264
255
|
const api = this.#ucAPI();
|
|
265
256
|
const existing = this.#getUserCached_UC(userId);
|
|
266
257
|
const existingStatus = this.getValue(import_UserCodeCC.UserCodeCCValues.userIdStatus(userId).endpoint(this.endpoint.index));
|
|
@@ -296,7 +287,6 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
296
287
|
}
|
|
297
288
|
return result;
|
|
298
289
|
}
|
|
299
|
-
this.#throwNoAccessControl();
|
|
300
290
|
}
|
|
301
291
|
/**
|
|
302
292
|
* Deletes the user with the given ID and all of their credentials.
|
|
@@ -313,7 +303,7 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
313
303
|
this.#purgeCachedCredentials(userId);
|
|
314
304
|
}
|
|
315
305
|
return result;
|
|
316
|
-
} else
|
|
306
|
+
} else {
|
|
317
307
|
const existed = this.#getUserCached_UC(userId) != void 0;
|
|
318
308
|
const api = this.#ucAPI();
|
|
319
309
|
const result = await api.clear(userId);
|
|
@@ -337,7 +327,6 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
337
327
|
}
|
|
338
328
|
return result;
|
|
339
329
|
}
|
|
340
|
-
this.#throwNoAccessControl();
|
|
341
330
|
}
|
|
342
331
|
/**
|
|
343
332
|
* Deletes all users and their credentials.
|
|
@@ -354,7 +343,7 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
354
343
|
this.#purgeAllCachedUsersAndCredentials();
|
|
355
344
|
}
|
|
356
345
|
return result;
|
|
357
|
-
} else
|
|
346
|
+
} else {
|
|
358
347
|
const api = this.#ucAPI();
|
|
359
348
|
const result = await api.clear(0);
|
|
360
349
|
if ((0, import_core.isUnsupervisedOrSucceeded)(result)) {
|
|
@@ -362,7 +351,6 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
362
351
|
}
|
|
363
352
|
return result;
|
|
364
353
|
}
|
|
365
|
-
this.#throwNoAccessControl();
|
|
366
354
|
}
|
|
367
355
|
/**
|
|
368
356
|
* Returns the data for a specific credential.
|
|
@@ -381,7 +369,7 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
381
369
|
slot: result.credentialSlot,
|
|
382
370
|
data: result.credentialData
|
|
383
371
|
};
|
|
384
|
-
} else
|
|
372
|
+
} else {
|
|
385
373
|
const api = this.#ucAPI();
|
|
386
374
|
const result = await api.get(userId);
|
|
387
375
|
if (!result)
|
|
@@ -391,7 +379,6 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
391
379
|
}
|
|
392
380
|
return { userId, type, slot, data: result.userCode };
|
|
393
381
|
}
|
|
394
|
-
return void 0;
|
|
395
382
|
}
|
|
396
383
|
/**
|
|
397
384
|
* Returns the data for a specific credential.
|
|
@@ -401,10 +388,9 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
401
388
|
this.#assertValidSlot(type, slot);
|
|
402
389
|
if (this.#usesUserCredentialCC) {
|
|
403
390
|
return this.#getCredentialCached_U3C(userId, type, slot);
|
|
404
|
-
} else
|
|
391
|
+
} else {
|
|
405
392
|
return this.#getCredentialCached_UC(userId, type, slot);
|
|
406
393
|
}
|
|
407
|
-
return void 0;
|
|
408
394
|
}
|
|
409
395
|
/**
|
|
410
396
|
* Returns all credentials for the given user.
|
|
@@ -430,11 +416,10 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
430
416
|
nextCredSlot = result.nextCredentialSlot;
|
|
431
417
|
} while (nextCredType !== import_cc.UserCredentialType.None || nextCredSlot !== 0);
|
|
432
418
|
return credentials;
|
|
433
|
-
} else
|
|
419
|
+
} else {
|
|
434
420
|
const cred = await this.getCredential(userId, this.#ucCredentialType, 1);
|
|
435
421
|
return cred ? [cred] : [];
|
|
436
422
|
}
|
|
437
|
-
return [];
|
|
438
423
|
}
|
|
439
424
|
/**
|
|
440
425
|
* Returns all credentials for the given user.
|
|
@@ -455,11 +440,10 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
455
440
|
}
|
|
456
441
|
}
|
|
457
442
|
return credentials;
|
|
458
|
-
} else
|
|
443
|
+
} else {
|
|
459
444
|
const cred = this.#getCredentialCached_UC(userId, this.#ucCredentialType, 1);
|
|
460
445
|
return cred ? [cred] : [];
|
|
461
446
|
}
|
|
462
|
-
return [];
|
|
463
447
|
}
|
|
464
448
|
/**
|
|
465
449
|
* Creates or updates a credential for the given user.
|
|
@@ -478,7 +462,7 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
478
462
|
credentialSlot: slot,
|
|
479
463
|
credentialData
|
|
480
464
|
});
|
|
481
|
-
} else
|
|
465
|
+
} else {
|
|
482
466
|
const api = this.#ucAPI();
|
|
483
467
|
const existingStatus = this.getValue(import_UserCodeCC.UserCodeCCValues.userIdStatus(userId).endpoint(this.endpoint.index));
|
|
484
468
|
const status = existingStatus == void 0 || existingStatus === import_cc.UserIDStatus.Available ? import_cc.UserIDStatus.Enabled : existingStatus;
|
|
@@ -505,7 +489,6 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
505
489
|
}
|
|
506
490
|
return result;
|
|
507
491
|
}
|
|
508
|
-
this.#throwNoAccessControl();
|
|
509
492
|
}
|
|
510
493
|
/**
|
|
511
494
|
* Deletes the given credential.
|
|
@@ -521,7 +504,7 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
521
504
|
credentialType: type,
|
|
522
505
|
credentialSlot: slot
|
|
523
506
|
});
|
|
524
|
-
} else
|
|
507
|
+
} else {
|
|
525
508
|
const existed = this.#getCredentialCached_UC(userId, type, slot) != void 0;
|
|
526
509
|
const api = this.#ucAPI();
|
|
527
510
|
const result = await api.clear(userId);
|
|
@@ -545,7 +528,6 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
545
528
|
}
|
|
546
529
|
return result;
|
|
547
530
|
}
|
|
548
|
-
this.#throwNoAccessControl();
|
|
549
531
|
}
|
|
550
532
|
/**
|
|
551
533
|
* Starts a learn process for the given credential slot, allowing a user
|
|
@@ -560,7 +542,7 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
560
542
|
this.#assertValidSlot(type, slot);
|
|
561
543
|
const existing = this.#getCredentialCached_U3C(userId, type, slot);
|
|
562
544
|
const operationType = existing ? import_cc.UserCredentialOperationType.Modify : import_cc.UserCredentialOperationType.Add;
|
|
563
|
-
timeout ??= this.getCredentialCapabilitiesCached()
|
|
545
|
+
timeout ??= this.getCredentialCapabilitiesCached().supportedCredentialTypes.get(type)?.credentialLearnRecommendedTimeout;
|
|
564
546
|
if (timeout == void 0) {
|
|
565
547
|
throw new import_core.ZWaveError(`Credential learning is not supported for credential type ${(0, import_shared.getEnumMemberName)(import_cc.UserCredentialType, type)}`, import_core.ZWaveErrorCodes.CC_NotSupported);
|
|
566
548
|
}
|
|
@@ -593,11 +575,10 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
593
575
|
if (this.#usesUserCredentialCC) {
|
|
594
576
|
const api = this.#u3cAPI();
|
|
595
577
|
return api.getAdminPinCode();
|
|
596
|
-
} else
|
|
578
|
+
} else {
|
|
597
579
|
const api = this.#ucAPI();
|
|
598
580
|
return api.getAdminCode();
|
|
599
581
|
}
|
|
600
|
-
return void 0;
|
|
601
582
|
}
|
|
602
583
|
/**
|
|
603
584
|
* Sets the admin code on the node.
|
|
@@ -607,11 +588,10 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
607
588
|
if (this.#usesUserCredentialCC) {
|
|
608
589
|
const api = this.#u3cAPI();
|
|
609
590
|
return api.setAdminPinCode({ pinCode: code });
|
|
610
|
-
} else
|
|
591
|
+
} else {
|
|
611
592
|
const api = this.#ucAPI();
|
|
612
593
|
return api.setAdminCode(code);
|
|
613
594
|
}
|
|
614
|
-
this.#throwNoAccessControl();
|
|
615
595
|
}
|
|
616
596
|
#ucAPI() {
|
|
617
597
|
return this.endpoint.commandClasses["User Code"];
|
|
@@ -698,14 +678,11 @@ class AccessControlAPI extends import_FeatureAPI.FeatureAPI {
|
|
|
698
678
|
}
|
|
699
679
|
}
|
|
700
680
|
#assertValidSlot(type, slot) {
|
|
701
|
-
const caps = this.getCredentialCapabilitiesCached()
|
|
681
|
+
const caps = this.getCredentialCapabilitiesCached().supportedCredentialTypes.get(type);
|
|
702
682
|
if (!caps || slot < 1 || slot > caps.numberOfCredentialSlots) {
|
|
703
683
|
throw new import_core.ZWaveError(`Credential slot ${slot} is out of range for credential type ${(0, import_shared.getEnumMemberName)(import_cc.UserCredentialType, type)}`, import_core.ZWaveErrorCodes.Argument_Invalid);
|
|
704
684
|
}
|
|
705
685
|
}
|
|
706
|
-
#throwNoAccessControl() {
|
|
707
|
-
throw new import_core.ZWaveError("This node does not support managing users or credentials", import_core.ZWaveErrorCodes.CC_NotSupported);
|
|
708
|
-
}
|
|
709
686
|
#getUserCached_U3C(userId) {
|
|
710
687
|
const userType = this.getValue(import_UserCredentialCC.UserCredentialCCValues.userType(userId).endpoint(this.endpoint.index));
|
|
711
688
|
if (userType == void 0)
|