@riddix/hamh 2.1.0-alpha.695 → 2.1.0-alpha.697
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/backend/cli.js
CHANGED
|
@@ -153744,7 +153744,7 @@ function normalizeSupportedIndex(index) {
|
|
|
153744
153744
|
return null;
|
|
153745
153745
|
}
|
|
153746
153746
|
function asFabricIndex(value) {
|
|
153747
|
-
return value === void 0 ? null : FabricIndex3(value);
|
|
153747
|
+
return value === void 0 || value === 0 ? null : FabricIndex3(value);
|
|
153748
153748
|
}
|
|
153749
153749
|
function hasStoredCredentialHelper(env, entityId) {
|
|
153750
153750
|
try {
|
|
@@ -153836,7 +153836,7 @@ function buildGetCredentialStatusResponse(env, entityId, request) {
|
|
|
153836
153836
|
async function applySetCredential(env, entityId, request, fabricIndex) {
|
|
153837
153837
|
if (request.credential.credentialType !== DoorLock3.CredentialType.Pin || normalizeSupportedIndex(request.credential.credentialIndex) === null) {
|
|
153838
153838
|
return {
|
|
153839
|
-
status:
|
|
153839
|
+
status: Status2.Failure,
|
|
153840
153840
|
userIndex: null,
|
|
153841
153841
|
nextCredentialIndex: null
|
|
153842
153842
|
};
|
|
@@ -153844,7 +153844,7 @@ async function applySetCredential(env, entityId, request, fabricIndex) {
|
|
|
153844
153844
|
const userSlot = normalizeSupportedIndex(request.userIndex ?? SUPPORTED_SLOT);
|
|
153845
153845
|
if (userSlot === null) {
|
|
153846
153846
|
return {
|
|
153847
|
-
status:
|
|
153847
|
+
status: Status2.Failure,
|
|
153848
153848
|
userIndex: null,
|
|
153849
153849
|
nextCredentialIndex: null
|
|
153850
153850
|
};
|
|
@@ -153861,7 +153861,7 @@ async function applySetCredential(env, entityId, request, fabricIndex) {
|
|
|
153861
153861
|
});
|
|
153862
153862
|
}
|
|
153863
153863
|
return {
|
|
153864
|
-
status:
|
|
153864
|
+
status: Status2.Success,
|
|
153865
153865
|
userIndex: SUPPORTED_SLOT,
|
|
153866
153866
|
nextCredentialIndex: null
|
|
153867
153867
|
};
|
|
@@ -153878,6 +153878,17 @@ async function applySetUser(env, entityId, request, fabricIndex) {
|
|
|
153878
153878
|
fabricIndex
|
|
153879
153879
|
});
|
|
153880
153880
|
}
|
|
153881
|
+
async function applyClearCredential(env, entityId, request) {
|
|
153882
|
+
if (request.credential === null) {
|
|
153883
|
+
const storage2 = env.get(LockCredentialStorage);
|
|
153884
|
+
await storage2.deleteCredential(entityId);
|
|
153885
|
+
return;
|
|
153886
|
+
}
|
|
153887
|
+
if (request.credential.credentialType === DoorLock3.CredentialType.Pin && normalizeSupportedIndex(request.credential.credentialIndex) !== null) {
|
|
153888
|
+
const storage2 = env.get(LockCredentialStorage);
|
|
153889
|
+
await storage2.deleteCredential(entityId);
|
|
153890
|
+
}
|
|
153891
|
+
}
|
|
153881
153892
|
var LockServerBase = class extends DoorLockServer {
|
|
153882
153893
|
async initialize() {
|
|
153883
153894
|
await super.initialize();
|
|
@@ -154070,11 +154081,8 @@ var LockServerWithPinBase = class extends PinCredentialBase {
|
|
|
154070
154081
|
);
|
|
154071
154082
|
}
|
|
154072
154083
|
async clearCredential(request) {
|
|
154073
|
-
|
|
154074
|
-
|
|
154075
|
-
const storage2 = this.env.get(LockCredentialStorage);
|
|
154076
|
-
await storage2.deleteCredential(homeAssistant.entityId);
|
|
154077
|
-
}
|
|
154084
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154085
|
+
await applyClearCredential(this.env, homeAssistant.entityId, request);
|
|
154078
154086
|
}
|
|
154079
154087
|
};
|
|
154080
154088
|
((LockServerWithPinBase2) => {
|
|
@@ -154272,11 +154280,8 @@ var LockServerWithPinAndUnboltBase = class extends PinCredentialUnboltBase {
|
|
|
154272
154280
|
);
|
|
154273
154281
|
}
|
|
154274
154282
|
async clearCredential(request) {
|
|
154275
|
-
|
|
154276
|
-
|
|
154277
|
-
const storage2 = this.env.get(LockCredentialStorage);
|
|
154278
|
-
await storage2.deleteCredential(homeAssistant.entityId);
|
|
154279
|
-
}
|
|
154283
|
+
const homeAssistant = this.agent.get(HomeAssistantEntityBehavior);
|
|
154284
|
+
await applyClearCredential(this.env, homeAssistant.entityId, request);
|
|
154280
154285
|
}
|
|
154281
154286
|
};
|
|
154282
154287
|
((LockServerWithPinAndUnboltBase2) => {
|