@zwave-js/cc 15.23.5 → 15.24.0

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.
@@ -1794,14 +1794,33 @@ let UserCredentialCCCredentialReport = (() => {
1794
1794
  persistValues(ctx) {
1795
1795
  if (!super.persistValues(ctx))
1796
1796
  return false;
1797
- if (this.credentialType === import_Types.UserCredentialType.None || this.credentialSlot === 0) {
1797
+ if (this.reportType === import_Types.UserCredentialCredentialReportType.CredentialDeleted || this.reportType === import_Types.UserCredentialCredentialReportType.CredentialModifyRejectedLocationEmpty) {
1798
+ if (this.credentialType !== import_Types.UserCredentialType.None && this.credentialSlot !== 0) {
1799
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credential(this.credentialType, this.credentialSlot));
1800
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialOwner(this.credentialType, this.credentialSlot));
1801
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierType(this.credentialType, this.credentialSlot));
1802
+ this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(this.credentialType, this.credentialSlot));
1803
+ } else {
1804
+ const valueDB = this.getValueDB(ctx);
1805
+ const credentialOwners = valueDB.findValues((vid) => import_CCValues_generated.UserCredentialCCValues.credentialOwner.is(vid) && vid.endpoint === this.endpointIndex);
1806
+ for (const { endpoint, propertyKey, value } of credentialOwners) {
1807
+ if (this.userId !== 0 && value !== this.userId)
1808
+ continue;
1809
+ const key = propertyKey;
1810
+ const cType = key >>> 16;
1811
+ const cSlot = key & 65535;
1812
+ if (this.credentialType !== import_Types.UserCredentialType.None && cType !== this.credentialType) {
1813
+ continue;
1814
+ }
1815
+ valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credential(cType, cSlot).endpoint(endpoint));
1816
+ valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credentialOwner(cType, cSlot).endpoint(endpoint));
1817
+ valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credentialModifierType(cType, cSlot).endpoint(endpoint));
1818
+ valueDB.removeValue(import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(cType, cSlot).endpoint(endpoint));
1819
+ }
1820
+ }
1798
1821
  return true;
1799
1822
  }
1800
- if (this.reportType === import_Types.UserCredentialCredentialReportType.CredentialDeleted || this.reportType === import_Types.UserCredentialCredentialReportType.CredentialModifyRejectedLocationEmpty) {
1801
- this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credential(this.credentialType, this.credentialSlot));
1802
- this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialOwner(this.credentialType, this.credentialSlot));
1803
- this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierType(this.credentialType, this.credentialSlot));
1804
- this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(this.credentialType, this.credentialSlot));
1823
+ if (this.credentialType === import_Types.UserCredentialType.None || this.credentialSlot === 0) {
1805
1824
  return true;
1806
1825
  }
1807
1826
  const isRejectionWithReadback = this.reportType === import_Types.UserCredentialCredentialReportType.CredentialAddRejectedLocationOccupied && this.credentialReadBack;