@zwave-js/cc 15.23.3 → 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.
@@ -1571,7 +1571,16 @@ let UserCredentialCCUserGet = (() => {
1571
1571
  return UserCredentialCCUserGet2 = _classThis;
1572
1572
  })();
1573
1573
  function testResponseForUserCredentialCredentialSet(sent, received) {
1574
- return received.reportType !== import_Types.UserCredentialCredentialReportType.ResponseToGet && received.credentialType === sent.credentialType && received.credentialSlot === sent.credentialSlot;
1574
+ if (received.reportType === import_Types.UserCredentialCredentialReportType.ResponseToGet) {
1575
+ return false;
1576
+ }
1577
+ if (received.credentialType !== sent.credentialType) {
1578
+ return false;
1579
+ }
1580
+ if (received.reportType === import_Types.UserCredentialCredentialReportType.DuplicateCredential || received.reportType === import_Types.UserCredentialCredentialReportType.DuplicateAdminPINCode) {
1581
+ return true;
1582
+ }
1583
+ return received.credentialSlot === sent.credentialSlot;
1575
1584
  }
1576
1585
  __name(testResponseForUserCredentialCredentialSet, "testResponseForUserCredentialCredentialSet");
1577
1586
  let UserCredentialCCCredentialSet = (() => {
@@ -1785,14 +1794,33 @@ let UserCredentialCCCredentialReport = (() => {
1785
1794
  persistValues(ctx) {
1786
1795
  if (!super.persistValues(ctx))
1787
1796
  return false;
1788
- 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
+ }
1789
1821
  return true;
1790
1822
  }
1791
- if (this.reportType === import_Types.UserCredentialCredentialReportType.CredentialDeleted || this.reportType === import_Types.UserCredentialCredentialReportType.CredentialModifyRejectedLocationEmpty) {
1792
- this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credential(this.credentialType, this.credentialSlot));
1793
- this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialOwner(this.credentialType, this.credentialSlot));
1794
- this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierType(this.credentialType, this.credentialSlot));
1795
- this.removeValue(ctx, import_CCValues_generated.UserCredentialCCValues.credentialModifierNodeId(this.credentialType, this.credentialSlot));
1823
+ if (this.credentialType === import_Types.UserCredentialType.None || this.credentialSlot === 0) {
1796
1824
  return true;
1797
1825
  }
1798
1826
  const isRejectionWithReadback = this.reportType === import_Types.UserCredentialCredentialReportType.CredentialAddRejectedLocationOccupied && this.credentialReadBack;