diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml index 809e1104f..df2d34624 100644 --- a/.github/workflows/pr-labeler.yml +++ b/.github/workflows/pr-labeler.yml @@ -1,7 +1,7 @@ name: PR Labeler on: - pull_request: # required for autolabeler + pull_request_target: # required for auto labeler types: [opened, reopened, synchronize] workflow_dispatch: @@ -9,4 +9,4 @@ jobs: stale: uses: homebridge/.github/.github/workflows/pr-labeler.yml@latest secrets: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 94caae5f0..d6aed91c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,14 +2,46 @@ All notable changes to `hap-nodejs` will be documented in this file. This project tries to adhere to [Semantic Versioning](http://semver.org/). -## v0.12.3 (2024-06-22) +## v1.0.0 (2024-07-10) + +### Breaking Changes + +- **The minimum Node.js version required is now `v18`.** +- **Important notice:** Because of the cleanup of the Deprecated code, you will need to migrate you code base. + - Remove the long-deprecated init(). + - Deprecate Core, BridgedCore, legacy Camera characteristics. (#1058) (@hjdhjd) + - For deprecated `Core` and `BridgedCore` see: https://github.com/homebridge/HAP-NodeJS/wiki/Deprecation-of-Core-and-BridgeCore + - Legacy code deprecation cleanup. (#1059) (@hjdhjd) + - For deprecated `storagePath` switch to `HAPStorage.setCustomStoragePath`, `AudioCodec` switch to `AudioStreamingCodec`, `VideoCodec` switch to `H264CodecParameters`,`StreamAudioParams` switch to `AudioStreamingOptions`, `StreamVideoParams` switch to `VideoStreamingOptions`,`cameraSource` switch to `CameraController`. + - Others deprecated code to highlight removed: `useLegacyAdvertiser`, `AccessoryLoader`. +- Fix: Naming for Characteristic.ProgramMode has been corrected from `PROGRAM_SCHEDULED_MANUAL_MODE_` to `PROGRAM_SCHEDULED_MANUAL_MODE` + +### Fixed + +- Fix: Build Issues (#1041) (@NorthernMan54) +- Fix: Ensure data is only transmitted on open and ready connections. (#1051) (@hjdhjd) +- Fix: Ensure we check names using the full UTF-8 character set. (#1052) (@hjdhjd) +- Fix: ConfiguredName (#1049) (@donavanbecker) +- Fix: Manufacturer looking at checkName but should look at checkValue. (#1053) (@donavanbecker) ### Other Changes - Implement warning messages for invalid characters in names (#1009) (@NorthernMan54) - Mitigate event emitter "memory leak" warnings when a significant number of camera streaming events occur simultaneously (#1037) (@hjdhjd) +- AdaptiveLightingController fix & improvement (#1038) (@Shaquu) +- Minor fixes to recording logging and one change in logging. (#1040) (@hjdhjd) +- Bridged core and core cleanup (#1048) (@Shaquu) +- Increase snapshot handler warning timeout to 8000ms. (#1055) (@hjdhjd) +- Cleanup and refactor getLocalNetworkInterface and address a potential edge case. (#1056) (@hjdhjd) +- Correct log spacing +- Updated and fixed `typedoc` config file - Updated dependencies +### Homebridge Dependencies + +- `@homebridge/ciao` @ `v1.3.0` +- `bonjour-hap` @ `v3.8.0` + ## v0.12.2 (2024-05-31) ### Changed @@ -47,12 +79,12 @@ All notable changes to `hap-nodejs` will be documented in this file. This projec ### Changed - Create `CHANGELOG.md` file -- Fix typos + add logo to `README.md` +- Fix: typos + add logo to `README.md` - Refresh `package-lock.json` (no major changes to dep versions) - general repo updates - add alpha releases - dependency updates -- fix typedoc generation +- Fix: typedoc generation - update homebridge dependencies - regenerate docs diff --git a/README.md b/README.md index b4e77e69e..f95061315 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ +
Coverage Status diff --git a/package-lock.json b/package-lock.json index 0a47aff01..831dbd4cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,17 @@ { "name": "hap-nodejs", - "version": "0.12.3", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "hap-nodejs", - "version": "0.12.3", + "version": "1.0.0", "license": "Apache-2.0", "dependencies": { - "@homebridge/ciao": "^1.2.0", + "@homebridge/ciao": "^1.3.0", "@homebridge/dbus-native": "^0.6.0", - "bonjour-hap": "^3.7.2", + "bonjour-hap": "^3.8.0", "debug": "^4.3.5", "fast-srp-hap": "^2.0.4", "futoin-hkdf": "^1.5.3", @@ -24,23 +24,23 @@ "@types/debug": "^4.1.12", "@types/escape-html": "^1.0.4", "@types/jest": "^29.5.12", - "@types/node": "^20.14.8", + "@types/node": "^20.14.10", "@types/plist": "^3.0.5", - "@typescript-eslint/eslint-plugin": "^7.13.1", - "@typescript-eslint/parser": "^7.13.1", + "@typescript-eslint/eslint-plugin": "^7.16.0", + "@typescript-eslint/parser": "^7.16.0", "axios": "^1.7.2", "commander": "^12.1.0", "escape-html": "^1.0.3", "eslint": "^8.57.0", "http-parser-js": "^0.5.8", "jest": "^29.7.0", - "rimraf": "^5.0.7", + "rimraf": "^5.0.9", "semver": "^7.6.2", "simple-plist": "^1.4.0-0", - "ts-jest": "^29.1.5", + "ts-jest": "^29.2.0", "ts-node": "^10.9.2", - "typedoc": "^0.26.1", - "typescript": "^5.5.2" + "typedoc": "^0.26.3", + "typescript": "^5.5.3" }, "engines": { "node": "^18 || ^20" @@ -61,13 +61,13 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.6.tgz", - "integrity": "sha512-ZJhac6FkEd1yhG2AHOmfcXG4ceoLltoCVJjN5XsWN9BifBQr+cHJbWi0h68HZuSORq+3WtJ2z0hwF2NG1b5kcA==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/highlight": "^7.24.6", + "@babel/highlight": "^7.24.7", "picocolors": "^1.0.0" }, "engines": { @@ -75,9 +75,9 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.24.6.tgz", - "integrity": "sha512-aC2DGhBq5eEdyXWqrDInSqQjO0k8xtPRf5YylULqx8MCd6jBtzqfta/3ETMRpuKIc5hyswfO80ObyA1MvkCcUQ==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.24.7.tgz", + "integrity": "sha512-qJzAIcv03PyaWqxRgO4mSU3lihncDT296vnyuE2O8uA4w3UHWI4S3hgeZd1L8W1Bft40w9JxJ2b412iDUFFRhw==", "dev": true, "license": "MIT", "engines": { @@ -85,22 +85,22 @@ } }, "node_modules/@babel/core": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.6.tgz", - "integrity": "sha512-qAHSfAdVyFmIvl0VHELib8xar7ONuSHrE2hLnsaWkYNTI68dmi1x8GYDhJjMI/e7XWal9QBlZkwbOnkcw7Z8gQ==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.7.tgz", + "integrity": "sha512-nykK+LEK86ahTkX/3TgauT0ikKoNCfKHEaZYTUVupJdTLzGNvrblu4u6fa7DhZONAltdf8e662t/abY8idrd/g==", "dev": true, "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.24.6", - "@babel/generator": "^7.24.6", - "@babel/helper-compilation-targets": "^7.24.6", - "@babel/helper-module-transforms": "^7.24.6", - "@babel/helpers": "^7.24.6", - "@babel/parser": "^7.24.6", - "@babel/template": "^7.24.6", - "@babel/traverse": "^7.24.6", - "@babel/types": "^7.24.6", + "@babel/code-frame": "^7.24.7", + "@babel/generator": "^7.24.7", + "@babel/helper-compilation-targets": "^7.24.7", + "@babel/helper-module-transforms": "^7.24.7", + "@babel/helpers": "^7.24.7", + "@babel/parser": "^7.24.7", + "@babel/template": "^7.24.7", + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -126,13 +126,13 @@ } }, "node_modules/@babel/generator": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.6.tgz", - "integrity": "sha512-S7m4eNa6YAPJRHmKsLHIDJhNAGNKoWNiWefz1MBbpnt8g9lvMDl1hir4P9bo/57bQEmuwEhnRU/AMWsD0G/Fbg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.7.tgz", + "integrity": "sha512-oipXieGC3i45Y1A41t4tAqpnEZWgB/lC6Ehh6+rOviR5XWpTtMmLN+fGjz9vOiNRt0p6RtO6DtD0pdU3vpqdSA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.24.6", + "@babel/types": "^7.24.7", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^2.5.1" @@ -142,14 +142,14 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.24.6.tgz", - "integrity": "sha512-VZQ57UsDGlX/5fFA7GkVPplZhHsVc+vuErWgdOiysI9Ksnw0Pbbd6pnPiR/mmJyKHgyIW0c7KT32gmhiF+cirg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.24.7.tgz", + "integrity": "sha512-ctSdRHBi20qWOfy27RUb4Fhp07KSJ3sXcuSvTrXrc4aG8NSYDo1ici3Vhg9bg69y5bj0Mr1lh0aeEgTvc12rMg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/compat-data": "^7.24.6", - "@babel/helper-validator-option": "^7.24.6", + "@babel/compat-data": "^7.24.7", + "@babel/helper-validator-option": "^7.24.7", "browserslist": "^4.22.2", "lru-cache": "^5.1.1", "semver": "^6.3.1" @@ -169,67 +169,71 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.6.tgz", - "integrity": "sha512-Y50Cg3k0LKLMjxdPjIl40SdJgMB85iXn27Vk/qbHZCFx/o5XO3PSnpi675h1KEmmDb6OFArfd5SCQEQ5Q4H88g==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz", + "integrity": "sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==", "dev": true, "license": "MIT", + "dependencies": { + "@babel/types": "^7.24.7" + }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-function-name": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.24.6.tgz", - "integrity": "sha512-xpeLqeeRkbxhnYimfr2PC+iA0Q7ljX/d1eZ9/inYbmfG2jpl8Lu3DyXvpOAnrS5kxkfOWJjioIMQsaMBXFI05w==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz", + "integrity": "sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/template": "^7.24.6", - "@babel/types": "^7.24.6" + "@babel/template": "^7.24.7", + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.6.tgz", - "integrity": "sha512-SF/EMrC3OD7dSta1bLJIlrsVxwtd0UpjRJqLno6125epQMJ/kyFmpTT4pbvPbdQHzCHg+biQ7Syo8lnDtbR+uA==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz", + "integrity": "sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.24.6" + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.6.tgz", - "integrity": "sha512-a26dmxFJBF62rRO9mmpgrfTLsAuyHk4e1hKTUkD/fcMfynt8gvEKwQPQDVxWhca8dHoDck+55DFt42zV0QMw5g==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", + "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.24.6" + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.24.6.tgz", - "integrity": "sha512-Y/YMPm83mV2HJTbX1Qh2sjgjqcacvOlhbzdCCsSlblOKjSYmQqEbO6rUniWQyRo9ncyfjT8hnUjlG06RXDEmcA==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.24.7.tgz", + "integrity": "sha512-1fuJEwIrp+97rM4RWdO+qrRsZlAeL1lQJoPqtCYWv0NL115XM93hIH4CSRln2w52SqvmY5hqdtauB6QFCDiZNQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-environment-visitor": "^7.24.6", - "@babel/helper-module-imports": "^7.24.6", - "@babel/helper-simple-access": "^7.24.6", - "@babel/helper-split-export-declaration": "^7.24.6", - "@babel/helper-validator-identifier": "^7.24.6" + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/helper-module-imports": "^7.24.7", + "@babel/helper-simple-access": "^7.24.7", + "@babel/helper-split-export-declaration": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7" }, "engines": { "node": ">=6.9.0" @@ -239,9 +243,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.6.tgz", - "integrity": "sha512-MZG/JcWfxybKwsA9N9PmtF2lOSFSEMVCpIRrbxccZFLJPrJciJdG/UhSh5W96GEteJI2ARqm5UAHxISwRDLSNg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.7.tgz", + "integrity": "sha512-Rq76wjt7yz9AAc1KnlRKNAi/dMSVWgDRx43FHoJEbcYU6xOWaE2dVPwcdTukJrjxS65GITyfbvEYHvkirZ6uEg==", "dev": true, "license": "MIT", "engines": { @@ -249,35 +253,36 @@ } }, "node_modules/@babel/helper-simple-access": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.6.tgz", - "integrity": "sha512-nZzcMMD4ZhmB35MOOzQuiGO5RzL6tJbsT37Zx8M5L/i9KSrukGXWTjLe1knIbb/RmxoJE9GON9soq0c0VEMM5g==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", + "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.24.6" + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.6.tgz", - "integrity": "sha512-CvLSkwXGWnYlF9+J3iZUvwgAxKiYzK3BWuo+mLzD/MDGOZDj7Gq8+hqaOkMxmJwmlv0iu86uH5fdADd9Hxkymw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz", + "integrity": "sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.24.6" + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-string-parser": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.6.tgz", - "integrity": "sha512-WdJjwMEkmBicq5T9fm/cHND3+UlFa2Yj8ALLgmoSQAJZysYbBjw+azChSGPN4DSPLXOcooGRvDwZWMcF/mLO2Q==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.7.tgz", + "integrity": "sha512-7MbVt6xrwFQbunH2DNQsAP5sTGxfqQtErvBIvIMi6EQnbgUOuVYanvREcmFrOPhoXBrTtjhhP+lW+o5UfK+tDg==", "dev": true, "license": "MIT", "engines": { @@ -285,9 +290,9 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.6.tgz", - "integrity": "sha512-4yA7s865JHaqUdRbnaxarZREuPTHrjpDT+pXoAZ1yhyo6uFnIEpS8VMu16siFOHDpZNKYv5BObhsB//ycbICyw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", "dev": true, "license": "MIT", "engines": { @@ -295,9 +300,9 @@ } }, "node_modules/@babel/helper-validator-option": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.6.tgz", - "integrity": "sha512-Jktc8KkF3zIkePb48QO+IapbXlSapOW9S+ogZZkcO6bABgYAxtZcjZ/O005111YLf+j4M84uEgwYoidDkXbCkQ==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.7.tgz", + "integrity": "sha512-yy1/KvjhV/ZCL+SM7hBrvnZJ3ZuT9OuZgIJAGpPEToANvc3iM6iDvBnRjtElWibHU6n8/LPR/EjX9EtIEYO3pw==", "dev": true, "license": "MIT", "engines": { @@ -305,27 +310,27 @@ } }, "node_modules/@babel/helpers": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.6.tgz", - "integrity": "sha512-V2PI+NqnyFu1i0GyTd/O/cTpxzQCYioSkUIRmgo7gFEHKKCg5w46+r/A6WeUR1+P3TeQ49dspGPNd/E3n9AnnA==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.7.tgz", + "integrity": "sha512-NlmJJtvcw72yRJRcnCmGvSi+3jDEg8qFu3z0AFoymmzLx5ERVWyzd9kVXr7Th9/8yIJi2Zc6av4Tqz3wFs8QWg==", "dev": true, "license": "MIT", "dependencies": { - "@babel/template": "^7.24.6", - "@babel/types": "^7.24.6" + "@babel/template": "^7.24.7", + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.6.tgz", - "integrity": "sha512-2YnuOp4HAk2BsBrJJvYCbItHx0zWscI1C3zgWkz+wDyD9I7GIVrfnLyrR4Y1VR+7p+chAEcrgRQYZAGIKMV7vQ==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-validator-identifier": "^7.24.6", + "@babel/helper-validator-identifier": "^7.24.7", "chalk": "^2.4.2", "js-tokens": "^4.0.0", "picocolors": "^1.0.0" @@ -413,9 +418,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.6.tgz", - "integrity": "sha512-eNZXdfU35nJC2h24RznROuOpO94h6x8sg9ju0tT9biNtLZ2vuP8SduLqqV+/8+cebSLV9SJEAN5Z3zQbJG/M+Q==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.7.tgz", + "integrity": "sha512-9uUYRm6OqQrCqQdG1iCBwBPZgN8ciDBro2nIOFaiRz1/BCxaI7CNvQbDHvsArAC7Tw9Hda/B3U+6ui9u4HWXPw==", "dev": true, "license": "MIT", "bin": { @@ -491,13 +496,13 @@ } }, "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.6.tgz", - "integrity": "sha512-lWfvAIFNWMlCsU0DRUun2GpFwZdGTukLaHJqRh1JRb80NdAP5Sb1HDHB5X9P9OtgZHQl089UzQkpYlBq2VTPRw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz", + "integrity": "sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.6" + "@babel/helper-plugin-utils": "^7.24.7" }, "engines": { "node": ">=6.9.0" @@ -601,13 +606,13 @@ } }, "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.6.tgz", - "integrity": "sha512-TzCtxGgVTEJWWwcYwQhCIQ6WaKlo80/B+Onsk4RRCcYqpYGFcG9etPW94VToGte5AAcxRrhjPUFvUS3Y2qKi4A==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.7.tgz", + "integrity": "sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.24.6" + "@babel/helper-plugin-utils": "^7.24.7" }, "engines": { "node": ">=6.9.0" @@ -617,35 +622,35 @@ } }, "node_modules/@babel/template": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.6.tgz", - "integrity": "sha512-3vgazJlLwNXi9jhrR1ef8qiB65L1RK90+lEQwv4OxveHnqC3BfmnHdgySwRLzf6akhlOYenT+b7AfWq+a//AHw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz", + "integrity": "sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.24.6", - "@babel/parser": "^7.24.6", - "@babel/types": "^7.24.6" + "@babel/code-frame": "^7.24.7", + "@babel/parser": "^7.24.7", + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.6.tgz", - "integrity": "sha512-OsNjaJwT9Zn8ozxcfoBc+RaHdj3gFmCmYoQLUII1o6ZrUwku0BMg80FoOTPx+Gi6XhcQxAYE4xyjPTo4SxEQqw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.7.tgz", + "integrity": "sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.24.6", - "@babel/generator": "^7.24.6", - "@babel/helper-environment-visitor": "^7.24.6", - "@babel/helper-function-name": "^7.24.6", - "@babel/helper-hoist-variables": "^7.24.6", - "@babel/helper-split-export-declaration": "^7.24.6", - "@babel/parser": "^7.24.6", - "@babel/types": "^7.24.6", + "@babel/code-frame": "^7.24.7", + "@babel/generator": "^7.24.7", + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/helper-function-name": "^7.24.7", + "@babel/helper-hoist-variables": "^7.24.7", + "@babel/helper-split-export-declaration": "^7.24.7", + "@babel/parser": "^7.24.7", + "@babel/types": "^7.24.7", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -664,14 +669,14 @@ } }, "node_modules/@babel/types": { - "version": "7.24.6", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.6.tgz", - "integrity": "sha512-WaMsgi6Q8zMgMth93GvWPXkhAIEobfsIkLTacoVZoK1J0CevIPGYY2Vo5YvJGqyHqXM6P4ppOYGsIRU8MM9pFQ==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.7.tgz", + "integrity": "sha512-XEFXSlxiG5td2EJRe8vOmRbaXVgfcBlszKujvVmWIK/UpywWljQCfzAv3RQCGujWQ1RD4YYWEAqDXfuJiy8f5Q==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-string-parser": "^7.24.6", - "@babel/helper-validator-identifier": "^7.24.6", + "@babel/helper-string-parser": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7", "to-fast-properties": "^2.0.0" }, "engines": { @@ -726,9 +731,9 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", - "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", + "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", "dev": true, "license": "MIT", "engines": { @@ -794,15 +799,15 @@ } }, "node_modules/@homebridge/ciao": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@homebridge/ciao/-/ciao-1.2.0.tgz", - "integrity": "sha512-2Qa8MVC7Q5DKH6iXh6cRvqz9VJYVpVZ+whHKrnr8YdPkXxc67kiQ9IOxMb0ydokDTETBVyXgr1m+HrheBtqDoQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@homebridge/ciao/-/ciao-1.3.0.tgz", + "integrity": "sha512-PRbY5FiukY13gIDwiAAZng598gMyI61GL9VU19G2CB4D3vNwh8vESgI9TkjeecCDethTqJmNiruYvdunfQkt7w==", "license": "MIT", "dependencies": { - "debug": "^4.3.4", + "debug": "^4.3.5", "fast-deep-equal": "^3.1.3", "source-map-support": "^0.5.21", - "tslib": "^2.6.2" + "tslib": "^2.6.3" }, "bin": { "ciao-bcs": "lib/bonjour-conformance-testing.js" @@ -848,6 +853,7 @@ "version": "0.11.14", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", + "deprecated": "Use @eslint/config-array instead", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -901,6 +907,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", "dev": true, "license": "BSD-3-Clause" }, @@ -1525,11 +1532,14 @@ } }, "node_modules/@shikijs/core": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.9.0.tgz", - "integrity": "sha512-cbSoY8P/jgGByG8UOl3jnP/CWg/Qk+1q+eAKWtcrU3pNoILF8wTsLB0jT44qUBV8Ce1SvA9uqcM9Xf+u3fJFBw==", + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/@shikijs/core/-/core-1.10.3.tgz", + "integrity": "sha512-D45PMaBaeDHxww+EkcDQtDAtzv00Gcsp72ukBtaLSmqRvh0WgGMq3Al0rl1QQBZfuneO75NXMIzEZGFitThWbg==", "dev": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.4" + } }, "node_modules/@sinclair/typebox": { "version": "0.27.8", @@ -1658,6 +1668,16 @@ "@types/node": "*" } }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -1704,9 +1724,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.14.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.8.tgz", - "integrity": "sha512-DO+2/jZinXfROG7j7WKFn/3C6nFwxy2lLpgLjEXJz+0XKphZlTLJ14mo8Vfg8X5BWN6XjyESXq+LcYdT7tR3bA==", + "version": "20.14.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.10.tgz", + "integrity": "sha512-MdiXf+nDuMvY0gJKxyfZ7/6UFsETO7mGKF54MVD/ekJS6HdFtpZFBgrh6Pseu64XTb2MLyFPlbW6hj8HYRQNOQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1731,6 +1751,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/unist": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", + "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/yargs": { "version": "17.0.32", "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", @@ -1749,17 +1776,17 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.13.1.tgz", - "integrity": "sha512-kZqi+WZQaZfPKnsflLJQCz6Ze9FFSMfXrrIOcyargekQxG37ES7DJNpJUE9Q/X5n3yTIP/WPutVNzgknQ7biLg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.16.0.tgz", + "integrity": "sha512-py1miT6iQpJcs1BiJjm54AMzeuMPBSPuKPlnT8HlfudbcS5rYeX5jajpLf3mrdRh9dA/Ec2FVUY0ifeVNDIhZw==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "7.13.1", - "@typescript-eslint/type-utils": "7.13.1", - "@typescript-eslint/utils": "7.13.1", - "@typescript-eslint/visitor-keys": "7.13.1", + "@typescript-eslint/scope-manager": "7.16.0", + "@typescript-eslint/type-utils": "7.16.0", + "@typescript-eslint/utils": "7.16.0", + "@typescript-eslint/visitor-keys": "7.16.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -1783,16 +1810,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.13.1.tgz", - "integrity": "sha512-1ELDPlnLvDQ5ybTSrMhRTFDfOQEOXNM+eP+3HT/Yq7ruWpciQw+Avi73pdEbA4SooCawEWo3dtYbF68gN7Ed1A==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.16.0.tgz", + "integrity": "sha512-ar9E+k7CU8rWi2e5ErzQiC93KKEFAXA2Kky0scAlPcxYblLt8+XZuHUZwlyfXILyQa95P6lQg+eZgh/dDs3+Vw==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/scope-manager": "7.13.1", - "@typescript-eslint/types": "7.13.1", - "@typescript-eslint/typescript-estree": "7.13.1", - "@typescript-eslint/visitor-keys": "7.13.1", + "@typescript-eslint/scope-manager": "7.16.0", + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/typescript-estree": "7.16.0", + "@typescript-eslint/visitor-keys": "7.16.0", "debug": "^4.3.4" }, "engines": { @@ -1812,14 +1839,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.13.1.tgz", - "integrity": "sha512-adbXNVEs6GmbzaCpymHQ0MB6E4TqoiVbC0iqG3uijR8ZYfpAXMGttouQzF4Oat3P2GxDVIrg7bMI/P65LiQZdg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.16.0.tgz", + "integrity": "sha512-8gVv3kW6n01Q6TrI1cmTZ9YMFi3ucDT7i7aI5lEikk2ebk1AEjrwX8MDTdaX5D7fPXMBLvnsaa0IFTAu+jcfOw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "7.13.1", - "@typescript-eslint/visitor-keys": "7.13.1" + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/visitor-keys": "7.16.0" }, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -1830,14 +1857,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.13.1.tgz", - "integrity": "sha512-aWDbLu1s9bmgPGXSzNCxELu+0+HQOapV/y+60gPXafR8e2g1Bifxzevaa+4L2ytCWm+CHqpELq4CSoN9ELiwCg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.16.0.tgz", + "integrity": "sha512-j0fuUswUjDHfqV/UdW6mLtOQQseORqfdmoBNDFOqs9rvNVR2e+cmu6zJu/Ku4SDuqiJko6YnhwcL8x45r8Oqxg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "7.13.1", - "@typescript-eslint/utils": "7.13.1", + "@typescript-eslint/typescript-estree": "7.16.0", + "@typescript-eslint/utils": "7.16.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -1858,9 +1885,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.13.1.tgz", - "integrity": "sha512-7K7HMcSQIAND6RBL4kDl24sG/xKM13cA85dc7JnmQXw2cBDngg7c19B++JzvJHRG3zG36n9j1i451GBzRuHchw==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.16.0.tgz", + "integrity": "sha512-fecuH15Y+TzlUutvUl9Cc2XJxqdLr7+93SQIbcZfd4XRGGKoxyljK27b+kxKamjRkU7FYC6RrbSCg0ALcZn/xw==", "dev": true, "license": "MIT", "engines": { @@ -1872,14 +1899,14 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.13.1.tgz", - "integrity": "sha512-uxNr51CMV7npU1BxZzYjoVz9iyjckBduFBP0S5sLlh1tXYzHzgZ3BR9SVsNed+LmwKrmnqN3Kdl5t7eZ5TS1Yw==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.16.0.tgz", + "integrity": "sha512-a5NTvk51ZndFuOLCh5OaJBELYc2O3Zqxfl3Js78VFE1zE46J2AaVuW+rEbVkQznjkmlzWsUI15BG5tQMixzZLw==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/types": "7.13.1", - "@typescript-eslint/visitor-keys": "7.13.1", + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/visitor-keys": "7.16.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -1901,16 +1928,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.13.1.tgz", - "integrity": "sha512-h5MzFBD5a/Gh/fvNdp9pTfqJAbuQC4sCN2WzuXme71lqFJsZtLbjxfSk4r3p02WIArOF9N94pdsLiGutpDbrXQ==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.16.0.tgz", + "integrity": "sha512-PqP4kP3hb4r7Jav+NiRCntlVzhxBNWq6ZQ+zQwII1y/G/1gdIPeYDCKr2+dH6049yJQsWZiHU6RlwvIFBXXGNA==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "7.13.1", - "@typescript-eslint/types": "7.13.1", - "@typescript-eslint/typescript-estree": "7.13.1" + "@typescript-eslint/scope-manager": "7.16.0", + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/typescript-estree": "7.16.0" }, "engines": { "node": "^18.18.0 || >=20.0.0" @@ -1924,13 +1951,13 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.13.1.tgz", - "integrity": "sha512-k/Bfne7lrP7hcb7m9zSsgcBmo+8eicqqfNAJ7uUY+jkTFpKeH2FSkWpFRtimBxgkyvqfu9jTPRbYOvud6isdXA==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.16.0.tgz", + "integrity": "sha512-rMo01uPy9C7XxG7AFsxa8zLnWXTF8N3PYclekWSrurvhwiw1eW88mrKiAYe6s53AUY57nTRz8dJsuuXdkAhzCg==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "7.13.1", + "@typescript-eslint/types": "7.16.0", "eslint-visitor-keys": "^3.4.3" }, "engines": { @@ -1959,9 +1986,9 @@ } }, "node_modules/acorn": { - "version": "8.11.3", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", - "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", "dev": true, "license": "MIT", "bin": { @@ -1982,11 +2009,14 @@ } }, "node_modules/acorn-walk": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", - "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", + "version": "8.3.3", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz", + "integrity": "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==", "dev": true, "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, "engines": { "node": ">=0.4.0" } @@ -2108,9 +2138,9 @@ } }, "node_modules/array-flatten": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-2.1.2.tgz", - "integrity": "sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-3.0.0.tgz", + "integrity": "sha512-zPMVc3ZYlGLNk4mpK1NzP2wg0ml9t7fUgDsayR5Y5rSzxQilzR9FGu/EH2jQOcKSAeAfWeylyW8juy3OkWRvNA==", "license": "MIT" }, "node_modules/array-union": { @@ -2319,12 +2349,12 @@ } }, "node_modules/bonjour-hap": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bonjour-hap/-/bonjour-hap-3.7.2.tgz", - "integrity": "sha512-BzOdOSIpXqjE1hejVNhj1T7E5YazPNG7cMOph5jQfzf1nF2yO18FSxuIg2zDMa4tFxhNC5d+U+0hT2bQkC5nTw==", + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/bonjour-hap/-/bonjour-hap-3.8.0.tgz", + "integrity": "sha512-l/Ptvrt/pjN2pCgiVyyA0EkE0uVoXXYZ4DW4xhL4kDVBaw0w54/3Jhdhzn5EyT1Z8YhNXiNhSX0uW6xz2zSxqQ==", "license": "MIT", "dependencies": { - "array-flatten": "^2.1.2", + "array-flatten": "^3.0.0", "deep-equal": "^2.2.3", "multicast-dns": "^7.2.5", "multicast-dns-service-types": "^1.1.0" @@ -2377,9 +2407,9 @@ } }, "node_modules/browserslist": { - "version": "4.23.0", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz", - "integrity": "sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==", + "version": "4.23.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.1.tgz", + "integrity": "sha512-TUfofFo/KsK/bWZ9TWQ5O26tsWW4Uhmt8IYklbnUa70udB6P2wA7w7o4PY4muaEPBQaAX+CEnmmIA41NVHtPVw==", "dev": true, "funding": [ { @@ -2397,10 +2427,10 @@ ], "license": "MIT", "dependencies": { - "caniuse-lite": "^1.0.30001587", - "electron-to-chromium": "^1.4.668", + "caniuse-lite": "^1.0.30001629", + "electron-to-chromium": "^1.4.796", "node-releases": "^2.0.14", - "update-browserslist-db": "^1.0.13" + "update-browserslist-db": "^1.0.16" }, "bin": { "browserslist": "cli.js" @@ -2478,9 +2508,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001625", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001625.tgz", - "integrity": "sha512-4KE9N2gcRH+HQhpeiRZXd+1niLB/XNLAhSy4z7fI8EzcbcPoAqjNInxVHTiTwWfTIV4w096XG8OtCOCQQKPv3w==", + "version": "1.0.30001640", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001640.tgz", + "integrity": "sha512-lA4VMpW0PSUrFnkmVuEKBUovSWKhj7puyCg8StBChgu298N1AtuF1sKWEvfDuimSEDbhlb/KqPKC3fs1HbuQUA==", "dev": true, "funding": [ { @@ -2889,9 +2919,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.4.787", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.787.tgz", - "integrity": "sha512-d0EFmtLPjctczO3LogReyM2pbBiiZbnsKnGF+cdZhsYzHm/A0GV7W94kqzLD8SN4O3f3iHlgLUChqghgyznvCQ==", + "version": "1.4.820", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.820.tgz", + "integrity": "sha512-kK/4O/YunacfboFEk/BDf7VO1HoPmDudLTJAU9NmXIOSjsV7qVIX3OrI4REZo0VmdqhcpUcncQc6N8Q3aEXlHg==", "dev": true, "license": "ISC" }, @@ -3152,9 +3182,9 @@ } }, "node_modules/esquery": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", - "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -3454,9 +3484,9 @@ } }, "node_modules/foreground-child": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", - "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", + "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", "dev": true, "license": "ISC", "dependencies": { @@ -4025,13 +4055,16 @@ } }, "node_modules/is-core-module": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", - "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz", + "integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==", "dev": true, "license": "MIT", "dependencies": { - "hasown": "^2.0.0" + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -4280,9 +4313,9 @@ } }, "node_modules/istanbul-lib-instrument": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.2.tgz", - "integrity": "sha512-1WUsZ9R1lA0HtBSohTkm39WTPlNKSJ5iFk7UwqXkBLoHQT+hfqPsfsTDVuZdKGaBwn7din9bS7SsnoAr943hvw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", + "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -4341,16 +4374,16 @@ } }, "node_modules/jackspeak": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.1.2.tgz", - "integrity": "sha512-kWmLKn2tRtfYMF/BakihVVRzBKOxz4gJMiL2Rj91WnAB5TPZumSH99R/Yf1qE1u4uRimvCSJfm6hnxohXeEXjQ==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.2.tgz", + "integrity": "sha512-qH3nOSj8q/8+Eg8LUPOq3C+6HWkpUioIjDsq1+D4zY91oZvpPttw8GwtF1nReRYKXl+1AORyFqtm2f5Q1SB6/Q==", "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/cliui": "^8.0.2" }, "engines": { - "node": ">=14" + "node": "14 >=14.21 || 16 >=16.20 || >=18" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -5264,9 +5297,9 @@ } }, "node_modules/minimatch": { - "version": "9.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.4.tgz", - "integrity": "sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, "license": "ISC", "dependencies": { @@ -5390,10 +5423,13 @@ } }, "node_modules/object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", + "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", "license": "MIT", + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -5527,6 +5563,13 @@ "node": ">=6" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", + "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -5614,13 +5657,13 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.2.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz", - "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==", + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.2.tgz", + "integrity": "sha512-voV4dDrdVZVNz84n39LFKDaRzfwhdzJ7akpyXfTMxCgRUp07U3lcJUXRlhTKP17rgt09sUzLi5iCitpEAr+6ug==", "dev": true, "license": "ISC", "engines": { - "node": "14 || >=16.14" + "node": "14 || 16 || 18 || 20 || >=22" } }, "node_modules/path-type": { @@ -5868,6 +5911,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/q/-/q-1.1.2.tgz", "integrity": "sha512-ROtylwux7Vkc4C07oKE/ReigUmb33kVoLtcR4SJ1QVqwaZkBEDL3vX4/kwFzIERQ5PfCl0XafbU8u2YUhyGgVA==", + "deprecated": "You or someone you depend on is using Q, the JavaScript Promise library that gave JavaScript developers strong feelings about promises. They can almost certainly migrate to the native JavaScript promise now. Thank you literally everyone for joining me in this bet against the odds. Be excellent to each other.\n\n(For a CapTP with native promises, see @endo/eventual-send and @endo/captp)", "license": "MIT", "engines": { "node": ">=0.6.0", @@ -6003,9 +6047,9 @@ } }, "node_modules/rimraf": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.7.tgz", - "integrity": "sha512-nV6YcJo5wbLW77m+8KjH8aB/7/rxQy9SZ0HY5shnwULfS+9nmTtVXAJET5NdZmCzA4fPI/Hm1wo/Po/4mopOdg==", + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.9.tgz", + "integrity": "sha512-3i7b8OcswU6CpU8Ej89quJD4O98id7TtVM5U4Mybh84zQXdrFmDLouWBEEaD/QfO3gDDfH+AGFCGsR7kngzQnA==", "dev": true, "license": "ISC", "dependencies": { @@ -6015,16 +6059,16 @@ "rimraf": "dist/esm/bin.mjs" }, "engines": { - "node": ">=14.18" + "node": "14 >=14.20 || 16 >=16.20 || >=18" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/rimraf/node_modules/glob": { - "version": "10.4.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.1.tgz", - "integrity": "sha512-2jelhlq3E4ho74ZyVLN03oKdAZVUa6UDZzFLVH1H7dnoax+y9qyaq8zBkfDIggjniU19z0wU18y16jMB2eyVIw==", + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", "dev": true, "license": "ISC", "dependencies": { @@ -6032,14 +6076,12 @@ "jackspeak": "^3.1.2", "minimatch": "^9.0.4", "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", "path-scurry": "^1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, "funding": { "url": "https://github.com/sponsors/isaacs" } @@ -6163,13 +6205,14 @@ } }, "node_modules/shiki": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.9.0.tgz", - "integrity": "sha512-i6//Lqgn7+7nZA0qVjoYH0085YdNk4MC+tJV4bo+HgjgRMJ0JmkLZzFAuvVioJqLkcGDK5GAMpghZEZkCnwxpQ==", + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-1.10.3.tgz", + "integrity": "sha512-eneCLncGuvPdTutJuLyUGS8QNPAVFO5Trvld2wgEq1e002mwctAhJKeMGWtWVXOIEzmlcLRqcgPSorR6AVzOmQ==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/core": "1.9.0" + "@shikijs/core": "1.10.3", + "@types/hast": "^3.0.4" } }, "node_modules/side-channel": { @@ -6552,9 +6595,9 @@ } }, "node_modules/ts-jest": { - "version": "29.1.5", - "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.5.tgz", - "integrity": "sha512-UuClSYxM7byvvYfyWdFI+/2UxMmwNyJb0NPkZPQE2hew3RurV7l7zURgOHAd/1I1ZdPpe3GUsXNXAcN8TFKSIg==", + "version": "29.2.0", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.2.0.tgz", + "integrity": "sha512-eFmkE9MG0+oT6nqSOcUwL+2UUmK2IvhhUV8hFDsCHnc++v2WCCbQQZh5vvjsa8sgOY/g9T0325hmkEmi6rninA==", "dev": true, "license": "MIT", "dependencies": { @@ -6692,16 +6735,16 @@ } }, "node_modules/typedoc": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.1.tgz", - "integrity": "sha512-APsVXqh93jTlpkLuw6+/IORx7n5LN8hzJV8nvMIrYYaIva0VCq0CoDN7Z3hsRThEYVExI/qoFHnAAxrhG+Wd7Q==", + "version": "0.26.3", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.26.3.tgz", + "integrity": "sha512-6d2Sw9disvvpdk4K7VNjKr5/3hzijtfQVHRthhDqJgnhMHy1wQz4yPMJVKXElvnZhFr0nkzo+GzjXDTRV5yLpg==", "dev": true, "license": "Apache-2.0", "dependencies": { "lunr": "^2.3.9", "markdown-it": "^14.1.0", - "minimatch": "^9.0.4", - "shiki": "^1.9.0", + "minimatch": "^9.0.5", + "shiki": "^1.9.1", "yaml": "^2.4.5" }, "bin": { @@ -6715,9 +6758,9 @@ } }, "node_modules/typescript": { - "version": "5.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz", - "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", + "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -6743,9 +6786,9 @@ "license": "MIT" }, "node_modules/update-browserslist-db": { - "version": "1.0.16", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz", - "integrity": "sha512-KVbTxlBYlckhF5wgfyZXTWnMn7MMZjMu9XG8bPlliUOP9ThaF4QnhP8qrjrH7DRzHfSk0oQv1wToW+iA5GajEQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", + "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", "dev": true, "funding": [ { @@ -6791,9 +6834,9 @@ "license": "MIT" }, "node_modules/v8-to-istanbul": { - "version": "9.2.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", - "integrity": "sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", "dev": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 20ad515d3..90cb8e37a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hap-nodejs", - "version": "0.12.3", + "version": "1.0.0", "description": "HAP-NodeJS is a Node.js implementation of HomeKit Accessory Server.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -52,9 +52,9 @@ "@types" ], "dependencies": { - "@homebridge/ciao": "^1.2.0", + "@homebridge/ciao": "^1.3.0", "@homebridge/dbus-native": "^0.6.0", - "bonjour-hap": "^3.7.2", + "bonjour-hap": "^3.8.0", "debug": "^4.3.5", "fast-srp-hap": "^2.0.4", "futoin-hkdf": "^1.5.3", @@ -67,22 +67,22 @@ "@types/debug": "^4.1.12", "@types/escape-html": "^1.0.4", "@types/jest": "^29.5.12", - "@types/node": "^20.14.8", + "@types/node": "^20.14.10", "@types/plist": "^3.0.5", - "@typescript-eslint/eslint-plugin": "^7.13.1", - "@typescript-eslint/parser": "^7.13.1", + "@typescript-eslint/eslint-plugin": "^7.16.0", + "@typescript-eslint/parser": "^7.16.0", "axios": "^1.7.2", "commander": "^12.1.0", "escape-html": "^1.0.3", "eslint": "^8.57.0", "http-parser-js": "^0.5.8", "jest": "^29.7.0", - "rimraf": "^5.0.7", + "rimraf": "^5.0.9", "semver": "^7.6.2", "simple-plist": "^1.4.0-0", - "ts-jest": "^29.1.5", + "ts-jest": "^29.2.0", "ts-node": "^10.9.2", - "typedoc": "^0.26.1", - "typescript": "^5.5.2" + "typedoc": "^0.26.3", + "typescript": "^5.5.3" } } diff --git a/src/BridgedCore.ts b/src/BridgedCore.ts deleted file mode 100644 index 94f3be3c9..000000000 --- a/src/BridgedCore.ts +++ /dev/null @@ -1,50 +0,0 @@ -import path from "path"; - -import storage from "node-persist"; - -import { Accessory, AccessoryEventTypes, AccessoryLoader, Bridge, Categories, HAPLibraryVersion, uuid, VoidCallback } from "./"; - -console.log(`HAP-NodeJS v${HAPLibraryVersion()} starting...`); - -console.warn("DEPRECATION NOTICE: The use of Core and BridgeCore are deprecated and are scheduled to be remove in October 2020. " + - "For more information and some guidance on how to migrate, have a look at https://github.com/homebridge/HAP-NodeJS/wiki/Deprecation-of-Core-and-BridgeCore"); - -// Initialize our storage system -storage.initSync(); - -// Start by creating our Bridge which will host all loaded Accessories -const bridge = new Bridge("Node Bridge", uuid.generate("Node Bridge")); - -// Listen for bridge identification event -bridge.on(AccessoryEventTypes.IDENTIFY, (paired: boolean, callback: VoidCallback) => { - console.log("Node Bridge identify"); - callback(); // success -}); - -// Load up all accessories in the /accessories folder -const dir = path.join(__dirname, "accessories"); -const accessories = AccessoryLoader.loadDirectory(dir); - -// Add them all to the bridge -accessories.forEach((accessory: Accessory) => { - bridge.addBridgedAccessory(accessory); -}); - -// Publish the Bridge on the local network. -bridge.publish({ - username: "CC:22:3D:E3:CE:F6", - port: 51826, - pincode: "031-45-154", - category: Categories.BRIDGE, -}); - -const signals = { "SIGINT": 2, "SIGTERM": 15 } as Record; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -Object.keys(signals).forEach((signal: any) => { - process.on(signal, () => { - bridge.unpublish(); - setTimeout(()=> { - process.exit(128 + signals[signal]); - }, 1000); - }); -}); diff --git a/src/Core.ts b/src/Core.ts deleted file mode 100644 index b2583c81a..000000000 --- a/src/Core.ts +++ /dev/null @@ -1,61 +0,0 @@ -import path from "path"; - -import storage from "node-persist"; - -import { AccessoryLoader, HAPLibraryVersion } from "./"; - -console.log(`HAP-NodeJS v${HAPLibraryVersion()} starting...`); - -console.warn("DEPRECATION NOTICE: The use of Core and BridgeCore are deprecated and are scheduled to be remove in October 2020. " + - "For more information and some guidance on how to migrate, have a look at https://github.com/homebridge/HAP-NodeJS/wiki/Deprecation-of-Core-and-BridgeCore"); - -// Initialize our storage system -storage.initSync(); - -// Our Accessories will each have their own HAP server; we will assign ports sequentially -let targetPort = 51826; - -// Load up all accessories in the /accessories folder -const dir = path.join(__dirname, "accessories"); -const accessories = AccessoryLoader.loadDirectory(dir); - -// Publish them all separately (as opposed to BridgedCore which publishes them behind a single Bridge accessory) -accessories.forEach((accessory) => { - - // To push Accessories separately, we'll need a few extra properties - // @ts-expect-error: Core/BridgeCore API - if (!accessory.username) { - throw new Error("Username not found on accessory '" + accessory.displayName + - "'. Core.js requires all accessories to define a unique 'username' property."); - } - - // @ts-expect-error: Core/BridgeCore API - if (!accessory.pincode) { - throw new Error("Pincode not found on accessory '" + accessory.displayName + - "'. Core.js requires all accessories to define a 'pincode' property."); - } - - // publish this Accessory on the local network - accessory.publish({ - port: targetPort++, - // @ts-expect-error: Core/BridgeCore API - username: accessory.username, - // @ts-expect-error: Core/BridgeCore API - pincode: accessory.pincode, - category: accessory.category, - }); -}); - -const signals = { "SIGINT": 2, "SIGTERM": 15 } as Record; -// eslint-disable-next-line @typescript-eslint/no-explicit-any -Object.keys(signals).forEach((signal: any) => { - process.on(signal, () => { - for (let i = 0; i < accessories.length; i++) { - accessories[i].unpublish(); - } - - setTimeout(() => { - process.exit(128 + signals[signal]); - }, 1000); - }); -}); diff --git a/src/accessories/Light-AdaptiveLighting_accessory.ts b/src/accessories/Light-AdaptiveLighting_accessory.ts index 42c53221f..6888c970b 100644 --- a/src/accessories/Light-AdaptiveLighting_accessory.ts +++ b/src/accessories/Light-AdaptiveLighting_accessory.ts @@ -8,6 +8,7 @@ import { Service, uuid, } from ".."; +import util from "util"; /** * This example light gives an example how a light with AdaptiveLighting (in AUTOMATIC mode) support @@ -113,4 +114,14 @@ const adaptiveLightingController = new AdaptiveLightingController(lightbulbServi // look into the docs for more information controllerMode: AdaptiveLightingControllerMode.AUTOMATIC, }); + +// Requires AdaptiveLightingControllerMode.MANUAL to be set as a controllerMode +adaptiveLightingController.on("update", () => { + console.log("Adaptive Lighting updated"); +}).on("update", (update) => { + console.log("Adaptive Lighting schedule updated to " + util.inspect(update)); +}).on("disable", () => { + console.log("Adaptive Lighting disabled"); +}); + accessory.configureController(adaptiveLightingController); diff --git a/src/accessories/Sprinkler_accessory.ts b/src/accessories/Sprinkler_accessory.ts index f9ee52ca9..69139e435 100644 --- a/src/accessories/Sprinkler_accessory.ts +++ b/src/accessories/Sprinkler_accessory.ts @@ -34,7 +34,7 @@ const SPRINKLER = { const sprinklerUUID = uuid.generate("hap-nodejs:accessories:sprinkler"); // This is the Accessory that we'll return to HAP-NodeJS that represents our fake motionSensor. -const sprinkler = exports.accessory = new Accessory("💦 Sprinkler", sprinklerUUID); +const sprinkler = exports.accessory = new Accessory("Sprinkler", sprinklerUUID); // Add properties for publishing (in case we're using Core.js and not BridgedCore.js) // @ts-expect-error: Core/BridgeCore API @@ -44,7 +44,7 @@ sprinkler.pincode = "123-44-567"; sprinkler.category = Categories.SPRINKLER; // Add the actual Valve Service and listen for change events from iOS. -const sprinklerService = sprinkler.addService(Service.Valve, "💦 Sprinkler"); +const sprinklerService = sprinkler.addService(Service.Valve, "Sprinkler"); // Sprinkler Controll function openVentile() { diff --git a/src/index.ts b/src/index.ts index af9a15816..50158e173 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,7 @@ import "source-map-support/register"; // registering node-source-map-support for typescript stack traces import "./lib/definitions"; // must be loaded before Characteristic and Service class import createDebug from "debug"; -import { HAPStorage } from "./lib/model/HAPStorage"; -/** - * @group Utils - */ -export * as AccessoryLoader from "./lib/AccessoryLoader"; /** * @group Utils */ @@ -16,7 +11,6 @@ export * from "./lib/Accessory"; export * from "./lib/Bridge"; export * from "./lib/Service"; export * from "./lib/Characteristic"; -export * from "./lib/AccessoryLoader"; export * from "./lib/camera"; export * from "./lib/tv/AccessControlManagement"; export * from "./lib/HAPServer"; @@ -57,23 +51,6 @@ function printInit() { } printInit(); -/** - * - * @param {string} storagePath - * @deprecated the need to manually initialize the internal storage was removed. If you want to set a custom - * storage path location, please use {@link HAPStorage.setCustomStoragePath} directly. - * - * @group Utils - */ -export function init(storagePath?: string): void { - console.log("DEPRECATED: The need to manually initialize HAP (by calling the init method) was removed. " + - "If you want to set a custom storage path location, please ust HAPStorage.setCustomStoragePath directly. " + - "This method will be removed in the next major update!"); - if (storagePath) { - HAPStorage.setCustomStoragePath(storagePath); - } -} - import * as Services from "./lib/definitions/ServiceDefinitions"; import * as Characteristics from "./lib/definitions/CharacteristicDefinitions"; diff --git a/src/lib/Accessory.spec.ts b/src/lib/Accessory.spec.ts index 56d297df2..3eddf61cd 100644 --- a/src/lib/Accessory.spec.ts +++ b/src/lib/Accessory.spec.ts @@ -28,7 +28,7 @@ import { Units, } from "./Characteristic"; import { CameraController, Controller, ControllerIdentifier, ControllerServiceMap } from "./controller"; -import { createCameraControllerOptions, MOCK_IMAGE, MockLegacyCameraSource } from "./controller/CameraController.spec"; +import { createCameraControllerOptions, MOCK_IMAGE } from "./controller/CameraController.spec"; import { HAPHTTPCode, HAPStatus, IdentifyCallback, TLVErrorCode } from "./HAPServer"; import { AccessoryInfo, PairingInformation, PermissionTypes } from "./model/AccessoryInfo"; import { IdentifierCache } from "./model/IdentifierCache"; @@ -201,8 +201,7 @@ describe("Accessory", () => { expect(accessory.primaryService).toBe(instance); const outlet = new Service.Outlet("Outlet"); - // noinspection JSDeprecatedSymbols - accessory.setPrimaryService(outlet); + outlet.setPrimaryService(); accessory.addService(outlet); // @ts-expect-error: private access @@ -307,41 +306,6 @@ describe("Accessory", () => { expect(restoredAccessory.getService(Service.Outlet)).toBeDefined(); expect(restoredAccessory.getService(Service.Switch)).toBeUndefined(); }); - - test("legacy configure camera source", async () => { - const microphone = new Service.Microphone(); - const source = new MockLegacyCameraSource(2); - source.services.push(microphone); - - const expectedOptions = source.streamControllers[0].options; - - // noinspection JSDeprecatedSymbols - accessory.configureCameraSource(source); - - expect(accessory.getServiceById(Service.CameraRTPStreamManagement, "0")).toBeDefined(); - expect(accessory.getServiceById(Service.CameraRTPStreamManagement, "1")).toBeDefined(); - expect(accessory.getService(Service.Microphone)).toBe(microphone); - - // @ts-expect-error: private access - const cameraController = accessory.activeCameraController!; - expect(cameraController).toBeDefined(); - - // @ts-expect-error: private access - expect(cameraController.streamCount).toEqual(2); - // @ts-expect-error: private access - expect(cameraController.streamingOptions).toEqual(expectedOptions); - - // @ts-expect-error: private access - accessory.handleResource({ - "resource-type": ResourceRequestType.IMAGE, - "image-width": 200, - "image-height": 200, - }, callback); - - await callbackPromise; - - expect(callback).toHaveBeenCalledWith(undefined, MOCK_IMAGE); - }); }); describe("publish", () => { @@ -409,14 +373,14 @@ describe("Accessory", () => { }); describe("Accessory and Service naming checks", () => { - let consoleLogSpy: jest.SpyInstance; + let consoleWarnSpy: jest.SpyInstance; beforeEach(() => { - consoleLogSpy = jest.spyOn(console, "warn"); + consoleWarnSpy = jest.spyOn(console, "warn").mockImplementation(() => {}); }); afterEach(() => { - consoleLogSpy.mockRestore(); + consoleWarnSpy.mockRestore(); }); test("Accessory Name ending with !", async () => { @@ -431,7 +395,7 @@ describe("Accessory", () => { await accessoryBadName.publish(publishInfo); // eslint-disable-next-line max-len - expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'Bad Name! 7430' is getting published with the characteristic 'Name' not following HomeKit naming rules ('Bad Name! 7430'). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'Bad Name!' has an invalid 'Name' characteristic ('Bad Name!'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness."); await awaitEventOnce(accessoryBadName, AccessoryEventTypes.ADVERTISED); await accessoryBadName?.unpublish(); @@ -450,7 +414,7 @@ describe("Accessory", () => { await accessoryBadName.publish(publishInfo); // eslint-disable-next-line max-len - expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'Bad ! Name 7430' is getting published with the characteristic 'Name' not following HomeKit naming rules ('Bad ! Name 7430'). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'Bad ! Name' has an invalid 'Name' characteristic ('Bad ! Name'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness."); await awaitEventOnce(accessoryBadName, AccessoryEventTypes.ADVERTISED); await accessoryBadName?.unpublish(); @@ -468,7 +432,7 @@ describe("Accessory", () => { }; await accessoryBadName.publish(publishInfo); - expect(consoleLogSpy).toBeCalledTimes(0); + expect(consoleWarnSpy).toBeCalledTimes(0); await awaitEventOnce(accessoryBadName, AccessoryEventTypes.ADVERTISED); await accessoryBadName?.unpublish(); @@ -487,9 +451,9 @@ describe("Accessory", () => { await accessoryBadName.publish(publishInfo); expect(accessoryBadName.displayName.startsWith(TEST_DISPLAY_NAME)); - expect(consoleLogSpy).toBeCalledTimes(2); + expect(consoleWarnSpy).toBeCalledTimes(2); // eslint-disable-next-line max-len - expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory ''Bad Name 7430' is getting published with the characteristic 'Name' not following HomeKit naming rules (''Bad Name 7430'). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory ''Bad Name' has an invalid 'Name' characteristic (''Bad Name'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness."); await awaitEventOnce(accessoryBadName, AccessoryEventTypes.ADVERTISED); await accessoryBadName?.unpublish(); @@ -510,7 +474,7 @@ describe("Accessory", () => { await accessoryBadName.publish(publishInfo); // eslint-disable-next-line max-len - expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'My Bad ! Switch' is getting published with the characteristic 'Name' not following HomeKit naming rules ('My Bad ! Switch'). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'My Bad ! Switch' has an invalid 'Name' characteristic ('My Bad ! Switch'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness."); await awaitEventOnce(accessoryBadName, AccessoryEventTypes.ADVERTISED); await accessoryBadName?.unpublish(); @@ -530,9 +494,9 @@ describe("Accessory", () => { }; await accessoryBadName.publish(publishInfo); - expect(consoleLogSpy).toBeCalledTimes(1); + expect(consoleWarnSpy).toBeCalledTimes(1); // eslint-disable-next-line max-len - expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'My Bad Switch!' is getting published with the characteristic 'Name' not following HomeKit naming rules ('My Bad Switch!'). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'My Bad Switch!' has an invalid 'Name' characteristic ('My Bad Switch!'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness."); await awaitEventOnce(accessoryBadName, AccessoryEventTypes.ADVERTISED); await accessoryBadName?.unpublish(); @@ -552,7 +516,7 @@ describe("Accessory", () => { }; await accessoryBadName.publish(publishInfo); - expect(consoleLogSpy).toBeCalledTimes(0); + expect(consoleWarnSpy).toBeCalledTimes(0); await awaitEventOnce(accessoryBadName, AccessoryEventTypes.ADVERTISED); await accessoryBadName?.unpublish(); @@ -572,9 +536,9 @@ describe("Accessory", () => { }; await accessoryBadName.publish(publishInfo); - expect(consoleLogSpy).toBeCalledTimes(1); + expect(consoleWarnSpy).toBeCalledTimes(1); // eslint-disable-next-line max-len - expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'My Bad Switch'' is getting published with the characteristic 'Name' not following HomeKit naming rules ('My Bad Switch''). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'My Bad Switch'' has an invalid 'Name' characteristic ('My Bad Switch''). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness."); await awaitEventOnce(accessoryBadName, AccessoryEventTypes.ADVERTISED); await accessoryBadName?.unpublish(); @@ -594,9 +558,9 @@ describe("Accessory", () => { }; await accessoryBadName.publish(publishInfo); - expect(consoleLogSpy).toBeCalledTimes(1); + expect(consoleWarnSpy).toBeCalledTimes(1); // eslint-disable-next-line max-len - expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory ''My Bad Switch' is getting published with the characteristic 'Name' not following HomeKit naming rules (''My Bad Switch'). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory ''My Bad Switch' has an invalid 'Name' characteristic (''My Bad Switch'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness."); await awaitEventOnce(accessoryBadName, AccessoryEventTypes.ADVERTISED); await accessoryBadName?.unpublish(); @@ -620,9 +584,9 @@ describe("Accessory", () => { switchService.getCharacteristic(Characteristic.ConfiguredName).updateValue("'Bad Name"); - expect(consoleLogSpy).toBeCalledTimes(1); + expect(consoleWarnSpy).toBeCalledTimes(1); // eslint-disable-next-line max-len - expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'unknown' is getting published with the characteristic 'Configured Name' not following HomeKit naming rules (''Bad Name'). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'Configured Name' has an invalid 'ConfiguredName' characteristic (''Bad Name'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness."); await awaitEventOnce(accessoryBadName, AccessoryEventTypes.ADVERTISED); await accessoryBadName?.unpublish(); @@ -1228,6 +1192,18 @@ describe("Accessory", () => { }); describe("handleSetCharacteristic", () => { + let consoleWarnSpy: jest.SpyInstance; + + beforeEach(() => { + // Mock console.warn before each test that needs it + consoleWarnSpy = jest.spyOn(console, "warn").mockImplementation(() => {}); + }); + + afterEach(() => { + // Restore console.warn after each test + consoleWarnSpy.mockRestore(); + }); + const testRequestResponse = async ( request: Partial, ...expectedReadData: CharacteristicWriteData[] @@ -1948,6 +1924,18 @@ describe("Accessory", () => { }); describe("characteristicWarning", () => { + let consoleWarnSpy: jest.SpyInstance; + + beforeEach(() => { + // Mock console.warn before each test that needs it + consoleWarnSpy = jest.spyOn(console, "warn").mockImplementation(() => {}); + }); + + afterEach(() => { + // Restore console.warn after each test + consoleWarnSpy.mockRestore(); + }); + test("emit characteristic warning", () => { accessory.on(AccessoryEventTypes.CHARACTERISTIC_WARNING, callback); @@ -2006,6 +1994,18 @@ describe("Accessory", () => { }); describe("deserialize", () => { + let consoleWarnSpy: jest.SpyInstance; + + beforeEach(() => { + // Mock console.warn before each test that needs it + consoleWarnSpy = jest.spyOn(console, "warn").mockImplementation(() => {}); + }); + + afterEach(() => { + // Restore console.warn after each test + consoleWarnSpy.mockRestore(); + }); + test("deserialize legacy json from homebridge", () => { const json = JSON.parse("{\"plugin\":\"homebridge-samplePlatform\",\"platform\":\"SamplePlatform\"," + "\"displayName\":\"2020-01-17T18:45:41.049Z\",\"UUID\":\"dc3951d8-662e-46f7-b6fe-d1b5b5e1a995\",\"category\":1," + diff --git a/src/lib/Accessory.ts b/src/lib/Accessory.ts index 6f4e6ec1d..1784fec42 100644 --- a/src/lib/Accessory.ts +++ b/src/lib/Accessory.ts @@ -1,5 +1,4 @@ import assert from "assert"; -import { MulticastOptions } from "bonjour-hap"; import crypto from "crypto"; import createDebug from "debug"; import { EventEmitter } from "events"; @@ -30,7 +29,6 @@ import { } from "../types"; import { Advertiser, AdvertiserEvent, AvahiAdvertiser, BonjourHAPAdvertiser, CiaoAdvertiser, ResolvedAdvertiser } from "./Advertiser"; // noinspection JSDeprecatedSymbols -import { LegacyCameraSource, LegacyCameraSourceAdapter, StreamController } from "./camera"; import { Access, ChangeReason, @@ -42,7 +40,6 @@ import { } from "./Characteristic"; import { CameraController, - CameraControllerOptions, Controller, ControllerConstructor, ControllerIdentifier, @@ -188,13 +185,6 @@ export interface CharacteristicWarning { stack?: string, } -/** - * @group Characteristic - * @deprecated - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export type CharacteristicEvents = Record; - /** * @group Accessory */ @@ -268,11 +258,6 @@ export interface PublishInfo { * When undefined port 0 will be used resulting in a random port. */ port?: number; - /** - * Used to define custom MDNS options. Is not used anymore. - * @deprecated - */ - mdns?: MulticastOptions; /** * If this option is set to true, HAP-NodeJS will add identifying material (based on {@link username}) * to the end of the accessory display name (and bonjour instance name). @@ -283,11 +268,6 @@ export interface PublishInfo { * Defines the advertiser used with the published Accessory. */ advertiser?: MDNSAdvertiser; - /** - * Use the legacy bonjour-hap as advertiser. - * @deprecated - */ - useLegacyAdvertiser?: boolean; } /** @@ -336,13 +316,6 @@ const enum WriteRequestState { TIMED_WRITE_REJECTED } -// noinspection JSUnusedGlobalSymbols -/** - * @deprecated Use AccessoryEventTypes instead - * @group Accessory - */ -export type EventAccessory = "identify" | "listening" | "service-configurationChange" | "service-characteristic-change"; - /** * @group Accessory */ @@ -421,15 +394,9 @@ export declare interface Accessory { */ // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging export class Accessory extends EventEmitter { - /** - * @deprecated Please use the Categories const enum above. - */ - // @ts-expect-error: forceConsistentCasingInFileNames compiler option - static Categories = Categories; - - /// Timeout in milliseconds until a characteristic warning is issue + // Timeout in milliseconds until a characteristic warning is issue private static readonly TIMEOUT_WARNING = 3000; - /// Timeout in milliseconds after `TIMEOUT_WARNING` until the operation on the characteristic is considered timed out. + // Timeout in milliseconds after `TIMEOUT_WARNING` until the operation on the characteristic is considered timed out. private static readonly TIMEOUT_AFTER_WARNING = 6000; // NOTICE: when adding/changing properties, remember to possibly adjust the serialize/deserialize functions @@ -499,7 +466,7 @@ export class Accessory extends EventEmitter { "valid UUID from any arbitrary string, like a serial number."); // create our initial "Accessory Information" Service that all Accessories are expected to have - checkName(this.displayName, "name", displayName); + checkName(this.displayName, "Name", displayName); this.addService(Service.AccessoryInformation) .setCharacteristic(Characteristic.Name, displayName); @@ -591,13 +558,6 @@ export class Accessory extends EventEmitter { return service; } - /** - * @deprecated use {@link Service.setPrimaryService} directly - */ - public setPrimaryService(service: Service): void { - service.setPrimaryService(); - } - public removeService(service: Service): void { const index = this.services.indexOf(service); @@ -665,18 +625,6 @@ export class Accessory extends EventEmitter { return this.bridged? this.bridge!: this; }; - /** - * @deprecated Not supported anymore - */ - public updateReachability(reachable: boolean): void { - if (!this.bridged) { - throw new Error("Cannot update reachability on non-bridged accessory!"); - } - this.reachable = reachable; - - debug("Reachability update is no longer being supported."); - } - public addBridgedAccessory(accessory: Accessory, deferUpdate = false): Accessory { if (accessory._isBridge || accessory === this) { throw new Error("Illegal state: either trying to bridge a bridge or trying to bridge itself!"); @@ -778,63 +726,6 @@ export class Accessory extends EventEmitter { return accessory && accessory.getCharacteristicByIID(iid); } - // noinspection JSDeprecatedSymbols - /** - * Method is used to configure an old style CameraSource. - * The CameraSource API was fully replaced by the new Controller API used by {@link CameraController}. - * The {@link CameraStreamingDelegate} used by the CameraController is the equivalent to the old CameraSource. - * - * The new Controller API is much more refined and robust way of "grouping" services together. - * It especially is intended to fully support serialization/deserialization to/from persistent storage. - * This feature is also gained when using the old style CameraSource API. - * The {@link CameraStreamingDelegate} improves on the overall camera API though and provides some reworked - * type definitions and a refined callback interface to better signal errors to the requesting HomeKit device. - * It is advised to update to it. - * - * Full backwards compatibility is currently maintained. A legacy CameraSource will be wrapped into an Adapter. - * All legacy StreamControllers in the "streamControllers" property will be replaced by CameraRTPManagement instances. - * Any services in the "services" property which are one of the following are ignored: - * - CameraRTPStreamManagement - * - CameraOperatingMode - * - CameraEventRecordingManagement - * - * @param cameraSource - The instance of the legacy camera source - * @deprecated please refer to the new {@link CameraController} API and {@link configureController} - */ - public configureCameraSource(cameraSource: LegacyCameraSource): CameraController { - if (cameraSource.streamControllers.length === 0) { - throw new Error("Malformed legacy CameraSource. Did not expose any StreamControllers!"); - } - - const options = cameraSource.streamControllers[0].options; // grab options from one of the StreamControllers - const cameraControllerOptions: CameraControllerOptions = { // build new options set - cameraStreamCount: cameraSource.streamControllers.length, - streamingOptions: options, - delegate: new LegacyCameraSourceAdapter(cameraSource), - }; - - const cameraController = new CameraController(cameraControllerOptions, true); // create CameraController in legacy mode - this.configureController(cameraController); - - // we try here to be as good as possibly of keeping current behaviour - cameraSource.services.forEach(service => { - if (service.UUID === Service.CameraRTPStreamManagement.UUID || service.UUID === Service.CameraOperatingMode.UUID - || service.UUID === Service.CameraRecordingManagement.UUID) { - return; // ignore those services, as they get replaced by the RTPStreamManagement - } - - // all other services get added. We can't really control possibly linking to any of those ignored services - // so this is really only half-baked stuff. - this.addService(service); - }); - - // replace stream controllers; basically only to still support the "forceStop" call - // noinspection JSDeprecatedSymbols - cameraSource.streamControllers = cameraController.streamManagements as StreamController[]; - - return cameraController; // return the reference for the controller (maybe this could be useful?) - } - /** * This method is used to set up a new Controller for this accessory. See {@link Controller} for a more detailed * explanation what a Controller is and what it is capable of. @@ -1051,18 +942,12 @@ export class Accessory extends EventEmitter { } }; - const model = service.getCharacteristic(Characteristic.Model).value; - const serialNumber = service.getCharacteristic(Characteristic.SerialNumber).value; - const firmwareRevision = service.getCharacteristic(Characteristic.FirmwareRevision).value; - const name = service.getCharacteristic(Characteristic.Name).value; - const manufacturer = service.getCharacteristic(Characteristic.Manufacturer).value; - - checkValue("Model", model); - checkValue("SerialNumber", serialNumber); - checkValue("FirmwareRevision", firmwareRevision); - checkValue("Name", name); - checkName(this.displayName, "Name", name); - checkName(this.displayName, "Manufacturer", manufacturer); + checkName(this.displayName, "Name", service.getCharacteristic(Characteristic.Name).value); + checkValue("FirmwareRevision", service.getCharacteristic(Characteristic.FirmwareRevision).value); + checkValue("Manufacturer", service.getCharacteristic(Characteristic.Manufacturer).value); + checkValue("Model", service.getCharacteristic(Characteristic.Model).value); + checkValue("Name", service.getCharacteristic(Characteristic.Name).value); + checkValue("SerialNumber", service.getCharacteristic(Characteristic.SerialNumber).value); } if (mainAccessory) { @@ -1219,21 +1104,6 @@ export class Accessory extends EventEmitter { throw new Error("Can't publish in accessory which is bridged by another accessory. Bridged by " + this.bridge?.displayName); } - // noinspection JSDeprecatedSymbols - if (!info.advertiser && info.useLegacyAdvertiser != null) { - // noinspection JSDeprecatedSymbols - info.advertiser = info.useLegacyAdvertiser? MDNSAdvertiser.BONJOUR: MDNSAdvertiser.CIAO; - console.warn("DEPRECATED The PublishInfo.useLegacyAdvertiser option has been removed. " + - "Please use the PublishInfo.advertiser property to enable \"ciao\" (useLegacyAdvertiser=false) " + - "or \"bonjour-hap\" (useLegacyAdvertiser=true) mdns advertiser libraries!"); - } - - // noinspection JSDeprecatedSymbols - if (info.mdns && info.advertiser !== MDNSAdvertiser.BONJOUR) { - console.log("DEPRECATED user supplied a custom 'mdns' option. This option is deprecated and ignored. " + - "Please move to the new 'bind' option."); - } - let service = this.getService(Service.ProtocolInformation); if (!service) { service = this.addService(Service.ProtocolInformation); // add the protocol information service to the primary accessory @@ -1338,8 +1208,7 @@ export class Accessory extends EventEmitter { }); break; case MDNSAdvertiser.BONJOUR: - // noinspection JSDeprecatedSymbols - this._advertiser = new BonjourHAPAdvertiser(this._accessoryInfo, info.mdns, { + this._advertiser = new BonjourHAPAdvertiser(this._accessoryInfo, { restrictedAddresses: parsed.serviceRestrictedAddress, disabledIpv6: parsed.serviceDisableIpv6, }); @@ -1966,10 +1835,6 @@ export class Accessory extends EventEmitter { } private handleHAPConnectionClosed(connection: HAPConnection): void { - if (this.activeCameraController) { - this.activeCameraController.handleCloseConnection(connection.sessionID); - } - for (const event of connection.getRegisteredEvents()) { const ids = event.split("."); const aid = parseInt(ids[0], 10); diff --git a/src/lib/AccessoryLoader.ts b/src/lib/AccessoryLoader.ts deleted file mode 100644 index 172a24263..000000000 --- a/src/lib/AccessoryLoader.ts +++ /dev/null @@ -1,197 +0,0 @@ -import createDebug from "debug"; -import fs from "fs"; -import path from "path"; -import { CharacteristicValue, Nullable } from "../types"; -import { Accessory } from "./Accessory"; -import { - Characteristic, - CharacteristicEventTypes, - CharacteristicGetCallback, - CharacteristicSetCallback, -} from "./Characteristic"; -import { Service } from "./Service"; -import * as uuid from "./util/uuid"; - -const debug = createDebug("HAP-NodeJS:AccessoryLoader"); - -/** - * @group Utils - * @deprecated Legacy Accessory Loader - */ -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types,@typescript-eslint/no-explicit-any -export function parseCharacteristicJSON(json: any): Characteristic { - const characteristicUUID = json.cType; - - const characteristic = new Characteristic(json.manfDescription || characteristicUUID, characteristicUUID, { - format: json.format, // example: "int" - minValue: json.designedMinValue, - maxValue: json.designedMaxValue, - minStep: json.designedMinStep, - unit: json.unit, - perms: json.perms, // example: ["pw","pr","ev"] - }); - - // copy simple properties - characteristic.value = json.initialValue; - - // @ts-expect-error: monkey-patch legacy "locals" property which used to exist. - characteristic.locals = json.locals; - - const updateFunc = json.onUpdate; // optional function(value) - const readFunc = json.onRead; // optional function(callback(value)) - const registerFunc = json.onRegister; // optional function - - if (updateFunc) { - characteristic.on(CharacteristicEventTypes.SET, (value: CharacteristicValue, callback: CharacteristicSetCallback) => { - updateFunc(value); - callback && callback(); - }); - } - - if (readFunc) { - characteristic.on(CharacteristicEventTypes.GET, (callback: CharacteristicGetCallback) => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - readFunc((value: any) => { - callback(null, value); // old onRead callbacks don't use Error as first param - }); - }); - } - - if (registerFunc) { - registerFunc(characteristic); - } - - return characteristic; -} - -/** - * @group Utils - * @deprecated Legacy Accessory Loader - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types -export function parseServiceJSON(json: any): Service { - const serviceUUID = json.sType; - - // build characteristics first, so we can extract the Name (if present) - const characteristics: Characteristic[] = []; - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - json.characteristics.forEach((characteristicJSON: any) => { - const characteristic = parseCharacteristicJSON(characteristicJSON); - characteristics.push(characteristic); - }); - - let displayName: Nullable = null; - - // extract the "Name" characteristic to use for 'type' discrimination if necessary - characteristics.forEach((characteristic) => { - if (characteristic.UUID === "00000023-0000-1000-8000-0026BB765291") { // Characteristic.Name.UUID - displayName = characteristic.value; - } - }); - - // Use UUID for "displayName" if necessary, as the JSON structures don't have a value for this - const service = new Service(displayName || serviceUUID, serviceUUID, `${displayName}`); - - characteristics.forEach((characteristic) => { - if (characteristic.UUID !== "00000023-0000-1000-8000-0026BB765291") { // Characteristic.Name.UUID, already present in all Services - service.addCharacteristic(characteristic); - } - }); - - return service; -} - - -/** - * Accepts object-literal JSON structures from previous versions of HAP-NodeJS and parses them into - * newer-style structures of Accessory/Service/Characteristic objects. - * @group Utils - * @deprecated Legacy Accessory Loader - */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types -export function parseAccessoryJSON(json: any): Accessory { - - // parse services first so we can extract the accessory name - const services: Service[] = []; - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - json.services.forEach((serviceJSON: any) => { - const service = parseServiceJSON(serviceJSON); - services.push(service); - }); - - let displayName = json.displayName; - - services.forEach((service) => { - if (service.UUID === "0000003E-0000-1000-8000-0026BB765291") { // Service.AccessoryInformation.UUID - service.characteristics.forEach((characteristic) => { - if (characteristic.UUID === "00000023-0000-1000-8000-0026BB765291") {// Characteristic.Name.UUID - displayName = characteristic.value; - } - }); - } - }); - - const accessory = new Accessory(displayName, uuid.generate(displayName)); - - // create custom properties for "username" and "pincode" for Core.js to find later (if using Core.js) - // @ts-expect-error: Core/BridgeCore API - accessory.username = json.username; - // @ts-expect-error: Core/BridgeCore API - accessory.pincode = json.pincode; - - // clear out the default services - accessory.services.length = 0; - - // add services - services.forEach((service) => { - accessory.addService(service); - }); - - return accessory; -} - -/** - * Loads all accessories from the given folder. Handles object-literal-style accessories, "accessory factories", - * and new-API style modules. - * @group Utils - * @deprecated Legacy Accessory Loader - */ -export function loadDirectory(dir: string): Accessory[] { - - // exported accessory objects loaded from this dir - let accessories: unknown[] = []; - - fs.readdirSync(dir).forEach((file) => { - const suffix = file.split("_").pop(); - - // "Accessories" are modules that export a single accessory. - if (suffix === "accessory.js" || suffix === "accessory.ts") { - debug("Parsing accessory: %s", file); - // eslint-disable-next-line @typescript-eslint/no-var-requires - const loadedAccessory = require(path.join(dir, file)).accessory; - accessories.push(loadedAccessory); - } else if (suffix === "accfactory.js" ||suffix === "accfactory.ts") { // "Accessory Factories" are modules that export an array of accessories. - debug("Parsing accessory factory: %s", file); - - // should return an array of objects { accessory: accessory-json } - // eslint-disable-next-line @typescript-eslint/no-var-requires - const loadedAccessories = require(path.join(dir, file)); - accessories = accessories.concat(loadedAccessories); - } - }); - - // now we need to coerce all accessory objects into instances of Accessory (some or all of them may - // be object-literal JSON-style accessories) - return accessories.map((accessory) => { - if(accessory === null || accessory === undefined) { //check if accessory is not empty - console.log("Invalid accessory!"); - return false; - } else { - return (accessory instanceof Accessory) ? accessory : parseAccessoryJSON(accessory); - } - }).filter((accessory: Accessory | false) => { - return !!accessory; - }) as Accessory[]; -} diff --git a/src/lib/Advertiser.ts b/src/lib/Advertiser.ts index 2ec2a23a4..301e075c8 100644 --- a/src/lib/Advertiser.ts +++ b/src/lib/Advertiser.ts @@ -4,7 +4,7 @@ import ciao, { CiaoService, MDNSServerOptions, Responder, ServiceEvent, ServiceT import { InterfaceName, IPAddress } from "@homebridge/ciao/lib/NetworkManager"; import dbus, { DBusInterface, MessageBus } from "@homebridge/dbus-native"; import assert from "assert"; -import bonjour, { BonjourHAP, BonjourHAPService, MulticastOptions } from "bonjour-hap"; +import bonjour, { BonjourHAP, BonjourHAPService } from "bonjour-hap"; import crypto from "crypto"; import createDebug from "debug"; import { EventEmitter } from "events"; @@ -216,13 +216,13 @@ export class BonjourHAPAdvertiser extends EventEmitter implements Advertiser { private port?: number; private destroyed = false; - constructor(accessoryInfo: AccessoryInfo, responderOptions?: MulticastOptions, serviceOptions?: ServiceNetworkOptions) { + constructor(accessoryInfo: AccessoryInfo, serviceOptions?: ServiceNetworkOptions) { super(); this.accessoryInfo = accessoryInfo; this.setupHash = CiaoAdvertiser.computeSetupHash(accessoryInfo); this.serviceOptions = serviceOptions; - this.bonjour = bonjour(responderOptions); + this.bonjour = bonjour(); debug(`Preparing Advertiser for '${this.accessoryInfo.displayName}' using bonjour-hap backend!`); } diff --git a/src/lib/Characteristic.spec.ts b/src/lib/Characteristic.spec.ts index 5c8825cc1..5bf0e5994 100644 --- a/src/lib/Characteristic.spec.ts +++ b/src/lib/Characteristic.spec.ts @@ -1102,20 +1102,6 @@ describe("Characteristic", () => { expect(characteristic.validateUserInput(VALUE)).toEqual(VALUE); }); - it("should validate a dictionary property", () => { - const VALUE = {}; - const characteristic = createCharacteristic(Formats.DICTIONARY); - // @ts-expect-error: private access - expect(characteristic.validateUserInput(VALUE)).toEqual(VALUE); - }); - - it("should validate an array property", () => { - const VALUE = ["asd"]; - const characteristic = createCharacteristic(Formats.ARRAY); - // @ts-expect-error: private access - expect(characteristic.validateUserInput(VALUE)).toEqual(VALUE); - }); - it("should validate boolean inputs", () => { const characteristic = createCharacteristicWithProps({ format: Formats.BOOL, @@ -1619,18 +1605,6 @@ describe("Characteristic", () => { expect(characteristic.getDefaultValue()).toEqual(""); }); - it("should get the correct default value for a dictionary property", () => { - const characteristic = createCharacteristic(Formats.DICTIONARY); - // @ts-expect-error: private access - expect(characteristic.getDefaultValue()).toEqual({}); - }); - - it("should get the correct default value for an array property", () => { - const characteristic = createCharacteristic(Formats.ARRAY); - // @ts-expect-error: private access - expect(characteristic.getDefaultValue()).toEqual([]); - }); - it("should get the correct default value a UINT8 property without minValue", () => { const characteristic = createCharacteristicWithProps({ format: Formats.UINT8, diff --git a/src/lib/Characteristic.ts b/src/lib/Characteristic.ts index 351b07a62..b33f61426 100644 --- a/src/lib/Characteristic.ts +++ b/src/lib/Characteristic.ts @@ -30,7 +30,6 @@ import type { CarbonMonoxideDetected, CarbonMonoxideLevel, CarbonMonoxidePeakLevel, - Category, CCAEnergyDetectThreshold, CCASignalDetectThreshold, CharacteristicValueActiveTransitionCount, @@ -39,8 +38,6 @@ import type { ClosedCaptions, ColorTemperature, ConfigurationState, - ConfigureBridgedAccessory, - ConfigureBridgedAccessoryStatus, ConfiguredName, ContactSensorState, CoolingThresholdTemperature, @@ -59,17 +56,13 @@ import type { CurrentSlatState, CurrentTemperature, CurrentTiltAngle, - CurrentTime, CurrentTransport, CurrentVerticalTiltAngle, CurrentVisibilityState, DataStreamHAPTransport, DataStreamHAPTransportInterrupt, - DayoftheWeek, DiagonalFieldOfView, DigitalZoom, - DiscoverBridgedAccessories, - DiscoveredBridgedAccessories, DisplayOrder, EventRetransmissionMaximum, EventSnapshotsActive, @@ -95,7 +88,6 @@ import type { InUse, IsConfigured, LeakDetected, - LinkQuality, ListPairings, LockControlPoint, LockCurrentState, @@ -145,7 +137,6 @@ import type { ProgrammableSwitchEvent, ProgrammableSwitchOutputState, ProgramMode, - Reachable, ReceivedSignalStrengthIndication, ReceiverSensitivity, RecordingAudioActive, @@ -216,7 +207,6 @@ import type { SwingMode, TapType, TargetAirPurifierState, - TargetAirQuality, TargetControlList, TargetControlSupportedConfiguration, TargetDoorState, @@ -228,7 +218,6 @@ import type { TargetMediaState, TargetPosition, TargetRelativeHumidity, - TargetSlatState, TargetTemperature, TargetTiltAngle, TargetVerticalTiltAngle, @@ -239,7 +228,6 @@ import type { ThreadNodeCapabilities, ThreadOpenThreadVersion, ThreadStatus, - TimeUpdate, Token, TransmitPower, TunnelConnectionTimeout, @@ -320,15 +308,7 @@ export const enum Formats { /** * Base64 encoded tlv8 string. */ - TLV8 = "tlv8", - /** - * @deprecated Not contained in the HAP spec - */ - ARRAY = "array", - /** - * @deprecated Not contained in the HAP spec - */ - DICTIONARY = "dict", + TLV8 = "tlv8" } /** @@ -351,15 +331,6 @@ export const enum Units { * @group Characteristic */ export const enum Perms { - // noinspection JSUnusedGlobalSymbols - /** - * @deprecated replaced by {@link PAIRED_READ}. Kept for backwards compatibility. - */ - READ = "pr", - /** - * @deprecated replaced by {@link PAIRED_WRITE}. Kept for backwards compatibility. - */ - WRITE = "pw", // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values PAIRED_READ = "pr", // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values @@ -701,22 +672,6 @@ function minWithUndefined(a?: number, b?: number): number | undefined { // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging export class Characteristic extends EventEmitter { - /** - * @deprecated Please use the Formats const enum above. - */ - // @ts-expect-error: forceConsistentCasingInFileNames compiler option - static Formats = Formats; - /** - * @deprecated Please use the Units const enum above. - */ - // @ts-expect-error: forceConsistentCasingInFileNames compiler option - static Units = Units; - /** - * @deprecated Please use the Perms const enum above. - */ - // @ts-expect-error: forceConsistentCasingInFileNames compiler option - static Perms = Perms; - // Pattern below is for automatic detection of the section of defined characteristics. Used by the generator // -=-=-=-=-=-=-=-=-=-=-=-=-=-=- /** @@ -823,11 +778,6 @@ export class Characteristic extends EventEmitter { * @group Characteristic Definitions */ public static CarbonMonoxidePeakLevel: typeof CarbonMonoxidePeakLevel; - /** - * @group Characteristic Definitions - * @deprecated Removed and not used anymore - */ - public static Category: typeof Category; /** * @group Characteristic Definitions */ @@ -860,16 +810,6 @@ export class Characteristic extends EventEmitter { * @group Characteristic Definitions */ public static ConfigurationState: typeof ConfigurationState; - /** - * @group Characteristic Definitions - * @deprecated Removed and not used anymore - */ - public static ConfigureBridgedAccessory: typeof ConfigureBridgedAccessory; - /** - * @group Characteristic Definitions - * @deprecated Removed and not used anymore - */ - public static ConfigureBridgedAccessoryStatus: typeof ConfigureBridgedAccessoryStatus; /** * @group Characteristic Definitions */ @@ -942,11 +882,6 @@ export class Characteristic extends EventEmitter { * @group Characteristic Definitions */ public static CurrentTiltAngle: typeof CurrentTiltAngle; - /** - * @group Characteristic Definitions - * @deprecated Removed and not used anymore - */ - public static CurrentTime: typeof CurrentTime; /** * @group Characteristic Definitions */ @@ -967,11 +902,6 @@ export class Characteristic extends EventEmitter { * @group Characteristic Definitions */ public static DataStreamHAPTransportInterrupt: typeof DataStreamHAPTransportInterrupt; - /** - * @group Characteristic Definitions - * @deprecated Removed and not used anymore - */ - public static DayoftheWeek: typeof DayoftheWeek; /** * @group Characteristic Definitions */ @@ -980,16 +910,6 @@ export class Characteristic extends EventEmitter { * @group Characteristic Definitions */ public static DigitalZoom: typeof DigitalZoom; - /** - * @group Characteristic Definitions - * @deprecated Removed and not used anymore - */ - public static DiscoverBridgedAccessories: typeof DiscoverBridgedAccessories; - /** - * @group Characteristic Definitions - * @deprecated Removed and not used anymore - */ - public static DiscoveredBridgedAccessories: typeof DiscoveredBridgedAccessories; /** * @group Characteristic Definitions */ @@ -1090,11 +1010,6 @@ export class Characteristic extends EventEmitter { * @group Characteristic Definitions */ public static LeakDetected: typeof LeakDetected; - /** - * @group Characteristic Definitions - * @deprecated Removed and not used anymore - */ - public static LinkQuality: typeof LinkQuality; /** * @group Characteristic Definitions */ @@ -1291,11 +1206,6 @@ export class Characteristic extends EventEmitter { * @group Characteristic Definitions */ public static ProgramMode: typeof ProgramMode; - /** - * @group Characteristic Definitions - * @deprecated Removed and not used anymore - */ - public static Reachable: typeof Reachable; /** * @group Characteristic Definitions */ @@ -1576,11 +1486,6 @@ export class Characteristic extends EventEmitter { * @group Characteristic Definitions */ public static TargetAirPurifierState: typeof TargetAirPurifierState; - /** - * @group Characteristic Definitions - * @deprecated Removed and not used anymore - */ - public static TargetAirQuality: typeof TargetAirQuality; /** * @group Characteristic Definitions */ @@ -1625,11 +1530,6 @@ export class Characteristic extends EventEmitter { * @group Characteristic Definitions */ public static TargetRelativeHumidity: typeof TargetRelativeHumidity; - /** - * @group Characteristic Definitions - * @deprecated Removed and not used anymore - */ - public static TargetSlatState: typeof TargetSlatState; /** * @group Characteristic Definitions */ @@ -1670,11 +1570,6 @@ export class Characteristic extends EventEmitter { * @group Characteristic Definitions */ public static ThreadStatus: typeof ThreadStatus; - /** - * @group Characteristic Definitions - * @deprecated Removed and not used anymore - */ - public static TimeUpdate: typeof TimeUpdate; /** * @group Characteristic Definitions */ @@ -1762,11 +1657,6 @@ export class Characteristic extends EventEmitter { public UUID: string; iid: Nullable = null; value: Nullable = null; - /** - * @deprecated replaced by {@link statusCode} - * @private - */ - status: Nullable = null; /** * @private */ @@ -2124,27 +2014,6 @@ export class Characteristic extends EventEmitter { this.additionalAuthorizationHandler = handler; } - /** - * Updates the current value of the characteristic. - * - * @param callback - * @param context - * @private use to return the current value on HAP requests - * - * @deprecated - */ - getValue(callback?: CharacteristicGetCallback, context?: CharacteristicContext): void { - this.handleGetRequest(undefined, context).then(value => { - if (callback) { - callback(null, value); - } - }, reason => { - if (callback) { - callback(reason); - } - }); - } - /** * This updates the value by calling the {@link CharacteristicEventTypes.SET} event handler associated with the characteristic. * This acts the same way as when a HomeKit controller sends a `/characteristics` request to update the characteristic. @@ -2182,23 +2051,6 @@ export class Characteristic extends EventEmitter { * any {@link onGet} or {@link CharacteristicEventTypes.GET} handlers have precedence. */ setValue(error: HapStatusError | Error): Characteristic; - /** - * This updates the value by calling the {@link CharacteristicEventTypes.SET} event handler associated with the characteristic. - * This acts the same way as when a HomeKit controller sends a `/characteristics` request to update the characteristic. - * An event notification will be sent to all connected HomeKit controllers which are registered - * to receive event notifications for this characteristic. - * - * This method behaves like a {@link updateValue} call with the addition that the own {@link CharacteristicEventTypes.SET} - * event handler is called. - * - * @param value - The new value. - * @param callback - Deprecated parameter there to provide backwards compatibility. Called once the - * {@link CharacteristicEventTypes.SET} event handler returns. - * @param context - Passed to the {@link CharacteristicEventTypes.SET} and {@link CharacteristicEventTypes.CHANGE} event handler. - * - * @deprecated Parameter `callback` is deprecated. - */ - setValue(value: CharacteristicValue, callback?: CharacteristicSetCallback, context?: CharacteristicContext): Characteristic /** * This updates the value by calling the {@link CharacteristicEventTypes.SET} event handler associated with the characteristic. * This acts the same way as when a HomeKit controller sends a `/characteristics` request to update the characteristic. @@ -2217,8 +2069,6 @@ export class Characteristic extends EventEmitter { setValue(value: CharacteristicValue | Error, callback?: CharacteristicSetCallback, context?: CharacteristicContext): Characteristic { if (value instanceof Error) { this.statusCode = value instanceof HapStatusError? value.hapStatus: extractHAPStatusFromError(value); - // noinspection JSDeprecatedSymbols - this.status = value; if (callback) { callback(); @@ -2294,17 +2144,6 @@ export class Characteristic extends EventEmitter { * any {@link onGet} or {@link CharacteristicEventTypes.GET} handlers have precedence. */ updateValue(error: Error | HapStatusError): Characteristic; - /** - * This updates the value of the characteristic. If the value changed, an event notification will be sent to all connected - * HomeKit controllers which are registered to receive event notifications for this characteristic. - * - * @param value - The new value. - * @param callback - Deprecated parameter there to provide backwards compatibility. Callback is called instantly. - * @param context - Passed to the {@link CharacteristicEventTypes.CHANGE} event handler. - * - * @deprecated Parameter `callback` is deprecated. - */ - updateValue(value: Nullable, callback?: () => void, context?: CharacteristicContext): Characteristic; /** * This updates the value of the characteristic. If the value changed, an event notification will be sent to all connected * HomeKit controllers which are registered to receive event notifications for this characteristic. @@ -2316,8 +2155,6 @@ export class Characteristic extends EventEmitter { updateValue(value: Nullable | Error | HapStatusError, callback?: () => void, context?: CharacteristicContext): Characteristic { if (value instanceof Error) { this.statusCode = value instanceof HapStatusError? value.hapStatus: extractHAPStatusFromError(value); - // noinspection JSDeprecatedSymbols - this.status = value; if (callback) { callback(); @@ -2341,8 +2178,6 @@ export class Characteristic extends EventEmitter { } this.statusCode = HAPStatus.SUCCESS; - // noinspection JSDeprecatedSymbols - this.status = null; const oldValue = this.value; this.value = value; @@ -2367,8 +2202,6 @@ export class Characteristic extends EventEmitter { */ public sendEventNotification(value: CharacteristicValue, context?: CharacteristicContext): Characteristic { this.statusCode = HAPStatus.SUCCESS; - // noinspection JSDeprecatedSymbols - this.status = null; value = this.validateUserInput(value)!; const oldValue = this.value; @@ -2404,8 +2237,6 @@ export class Characteristic extends EventEmitter { try { let value = await this.getHandler(context, connection); this.statusCode = HAPStatus.SUCCESS; - // noinspection JSDeprecatedSymbols - this.status = null; try { value = this.validateUserInput(value); @@ -2413,8 +2244,6 @@ export class Characteristic extends EventEmitter { this.characteristicWarning(`An illegal value was supplied by the read handler for characteristic: ${error?.message}`, CharacteristicWarningType.WARN_MESSAGE, error?.stack); this.statusCode = HAPStatus.SERVICE_COMMUNICATION_FAILURE; - // noinspection JSDeprecatedSymbols - this.status = error; return Promise.reject(HAPStatus.SERVICE_COMMUNICATION_FAILURE); } @@ -2433,18 +2262,12 @@ export class Characteristic extends EventEmitter { if (typeof error === "number") { const hapStatusError = new HapStatusError(error); this.statusCode = hapStatusError.hapStatus; - // noinspection JSDeprecatedSymbols - this.status = hapStatusError; } else if (error instanceof HapStatusError) { this.statusCode = error.hapStatus; - // noinspection JSDeprecatedSymbols - this.status = error; } else { this.characteristicWarning(`Unhandled error thrown inside read handler for characteristic: ${error?.message}`, CharacteristicWarningType.ERROR_MESSAGE, error?.stack); this.statusCode = HAPStatus.SERVICE_COMMUNICATION_FAILURE; - // noinspection JSDeprecatedSymbols - this.status = error; } throw this.statusCode; } @@ -2471,25 +2294,17 @@ export class Characteristic extends EventEmitter { if (typeof status === "number") { const hapStatusError = new HapStatusError(status); this.statusCode = hapStatusError.hapStatus; - // noinspection JSDeprecatedSymbols - this.status = hapStatusError; } else if (status instanceof HapStatusError) { this.statusCode = status.hapStatus; - // noinspection JSDeprecatedSymbols - this.status = status; } else { debug("[%s] Received error from get handler %s", this.displayName, status.stack); this.statusCode = extractHAPStatusFromError(status); - // noinspection JSDeprecatedSymbols - this.status = status; } reject(this.statusCode); return; } this.statusCode = HAPStatus.SUCCESS; - // noinspection JSDeprecatedSymbols - this.status = null; value = this.validateUserInput(value); const oldValue = this.value; @@ -2508,8 +2323,6 @@ export class Characteristic extends EventEmitter { this.characteristicWarning(`Unhandled error thrown inside read handler for characteristic: ${error?.message}`, CharacteristicWarningType.ERROR_MESSAGE, error?.stack); this.statusCode = HAPStatus.SERVICE_COMMUNICATION_FAILURE; - // noinspection JSDeprecatedSymbols - this.status = error; reject(HAPStatus.SERVICE_COMMUNICATION_FAILURE); } }); @@ -2528,8 +2341,6 @@ export class Characteristic extends EventEmitter { */ async handleSetRequest(value: CharacteristicValue, connection?: HAPConnection, context?: CharacteristicContext): Promise { this.statusCode = HAPStatus.SUCCESS; - // noinspection JSDeprecatedSymbols - this.status = null; if (connection !== undefined) { // if connection is undefined, the set "request" comes from the setValue method. @@ -2552,8 +2363,6 @@ export class Characteristic extends EventEmitter { try { const writeResponse = await this.setHandler(value, context, connection); this.statusCode = HAPStatus.SUCCESS; - // noinspection JSDeprecatedSymbols - this.status = null; if (writeResponse != null && this.props.perms.includes(Perms.WRITE_RESPONSE)) { this.value = this.validateUserInput(writeResponse); @@ -2575,18 +2384,12 @@ export class Characteristic extends EventEmitter { if (typeof error === "number") { const hapStatusError = new HapStatusError(error); this.statusCode = hapStatusError.hapStatus; - // noinspection JSDeprecatedSymbols - this.status = hapStatusError; } else if (error instanceof HapStatusError) { this.statusCode = error.hapStatus; - // noinspection JSDeprecatedSymbols - this.status = error; } else { this.characteristicWarning(`Unhandled error thrown inside write handler for characteristic: ${error?.message}`, CharacteristicWarningType.ERROR_MESSAGE, error?.stack); this.statusCode = HAPStatus.SERVICE_COMMUNICATION_FAILURE; - // noinspection JSDeprecatedSymbols - this.status = error; } throw this.statusCode; } @@ -2604,25 +2407,17 @@ export class Characteristic extends EventEmitter { if (typeof status === "number") { const hapStatusError = new HapStatusError(status); this.statusCode = hapStatusError.hapStatus; - // noinspection JSDeprecatedSymbols - this.status = hapStatusError; } else if (status instanceof HapStatusError) { this.statusCode = status.hapStatus; - // noinspection JSDeprecatedSymbols - this.status = status; } else { debug("[%s] Received error from set handler %s", this.displayName, status.stack); this.statusCode = extractHAPStatusFromError(status); - // noinspection JSDeprecatedSymbols - this.status = status; } reject(this.statusCode); return; } this.statusCode = HAPStatus.SUCCESS; - // noinspection JSDeprecatedSymbols - this.status = null; if (writeResponse != null && this.props.perms.includes(Perms.WRITE_RESPONSE)) { // support write response simply by letting the implementor pass the response as second argument to the callback @@ -2646,8 +2441,6 @@ export class Characteristic extends EventEmitter { this.characteristicWarning(`Unhandled error thrown inside write handler for characteristic: ${error?.message}`, CharacteristicWarningType.ERROR_MESSAGE, error?.stack); this.statusCode = HAPStatus.SERVICE_COMMUNICATION_FAILURE; - // noinspection JSDeprecatedSymbols - this.status = error; reject(HAPStatus.SERVICE_COMMUNICATION_FAILURE); } }); @@ -2701,10 +2494,6 @@ export class Characteristic extends EventEmitter { return ""; // who knows! case Formats.TLV8: return ""; // who knows! - case Formats.DICTIONARY: - return {}; - case Formats.ARRAY: - return []; case Formats.INT: case Formats.FLOAT: case Formats.UINT8: @@ -2941,12 +2730,12 @@ export class Characteristic extends EventEmitter { if (this.props.validValueRanges && this.props.validValueRanges.length === 2) { if (value < this.props.validValueRanges[0]) { - this.characteristicWarning(`characteristic was supplied illegal value: number ${value} not contained in valid value range of \ - ${this.props.validValueRanges}, supplying illegal values will throw errors in the future`, warningType); + this.characteristicWarning(`characteristic was supplied illegal value: number ${value} not contained in valid value range of ` + + `${this.props.validValueRanges}, supplying illegal values will throw errors in the future`, warningType); value = this.props.validValueRanges[0]; } else if (value > this.props.validValueRanges[1]) { - this.characteristicWarning(`characteristic was supplied illegal value: number ${value} not contained in valid value range of \ - ${this.props.validValueRanges}, supplying illegal values will throw errors in the future`, warningType); + this.characteristicWarning(`characteristic was supplied illegal value: number ${value} not contained in valid value range of ` + + `${this.props.validValueRanges}, supplying illegal values will throw errors in the future`, warningType); value = this.props.validValueRanges[1]; } } @@ -2966,8 +2755,8 @@ export class Characteristic extends EventEmitter { // mirrors the case value = null at the beginning if (value.length <= 1 && (this.UUID === Characteristic.Model.UUID || this.UUID === Characteristic.SerialNumber.UUID)) { - this.characteristicWarning(`[${this.displayName}] characteristic must have a length of more than 1 character otherwise \ - HomeKit will reject this accessory, ignoring new value`, warningType); + this.characteristicWarning(`[${this.displayName}] characteristic must have a length of more than 1 character otherwise` + + ` HomeKit will reject this accessory, ignoring new value ${warningType}`); return this.value; // just return the current value } @@ -2977,8 +2766,8 @@ export class Characteristic extends EventEmitter { value = value.substring(0, maxLength); } - if (this.UUID === "000000E3-0000-1000-8000-0026BB765291") { - checkName("unknown", this.displayName, value); + if (value.length > 0 && this.UUID === Characteristic.ConfiguredName.UUID) { + checkName(this.displayName, "ConfiguredName", value); } return value; diff --git a/src/lib/HAPServer.spec.ts b/src/lib/HAPServer.spec.ts index 641edd3c3..eb0b5d65c 100644 --- a/src/lib/HAPServer.spec.ts +++ b/src/lib/HAPServer.spec.ts @@ -618,7 +618,10 @@ describe(IsKnownHAPStatusError, () => { .filter(error => error !== 0); // filter out HAPStatus.SUCCESS for (const error of errorValues) { - // @ts-expect-error: type mismatch + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore:next-line - This was @ts-expect-error: type mismatch, but it triggered build errors + // Summary of all failing tests src/lib/HAPServer.spec.ts:621:7 - error TS2578: Unused '@ts-expect-error' directive. + const result = IsKnownHAPStatusError(error); if (!result) { fail("IsKnownHAPStatusError does not return true for error code " + error); diff --git a/src/lib/HAPServer.ts b/src/lib/HAPServer.ts index f6abd7596..de3e29fa6 100644 --- a/src/lib/HAPServer.ts +++ b/src/lib/HAPServer.ts @@ -121,21 +121,6 @@ export function IsKnownHAPStatusError(status: HAPStatus): boolean { ); } -// noinspection JSUnusedGlobalSymbols -/** - * @group HAP Accessory Server - * @deprecated please use {@link TLVErrorCode} as naming is more precise - */ -// @ts-expect-error (as we use const enums with --preserveConstEnums) -export const Codes = TLVErrorCode; -// noinspection JSUnusedGlobalSymbols -/** - * @group HAP Accessory Server - * @deprecated please use {@link HAPStatus} as naming is more precise - */ -// @ts-expect-error (as we use const enums with --preserveConstEnums) -export const Status = HAPStatus; - /** * Those status codes are the one listed as appropriate for the HAP spec! * diff --git a/src/lib/Service.ts b/src/lib/Service.ts index 1dd05592f..99987a2ec 100644 --- a/src/lib/Service.ts +++ b/src/lib/Service.ts @@ -16,9 +16,6 @@ import type { Assistant, AudioStreamManagement, Battery, - BridgeConfiguration, - BridgingState, - CameraControl, CameraOperatingMode, CameraRecordingManagement, CameraRTPStreamManagement, @@ -73,7 +70,6 @@ import type { TemperatureSensor, Thermostat, ThreadTransport, - TimeInformation, TransferTransportManagement, Tunnel, Valve, @@ -124,13 +120,6 @@ export type ServiceId = string; */ export type ServiceCharacteristicChange = CharacteristicChange & { characteristic: Characteristic }; -// noinspection JSUnusedGlobalSymbols -/** - * @deprecated Use ServiceEventTypes instead - * @group Service - */ -export type EventService = ServiceEventTypes.CHARACTERISTIC_CHANGE | ServiceEventTypes.SERVICE_CONFIGURATION_CHANGE; - /** * @group Service */ @@ -226,31 +215,6 @@ export class Service extends EventEmitter { * @group Service Definitions */ public static Battery: typeof Battery; - /** - * @group Service Definitions - * @deprecated Please use {@link Service.Battery}. - */ - public static BatteryService: typeof Battery; - /** - * @group Service Definitions - * @deprecated Removed and not used anymore - */ - public static BridgeConfiguration: typeof BridgeConfiguration; - /** - * @group Service Definitions - * @deprecated Removed and not used anymore - */ - public static BridgingState: typeof BridgingState; - /** - * @group Service Definitions - * @deprecated This service has no usage anymore and will be ignored by iOS - */ - public static CameraControl: typeof CameraControl; - /** - * @group Service Definitions - * @deprecated Please use {@link Service.CameraRecordingManagement}. - */ - public static CameraEventRecordingManagement: typeof CameraRecordingManagement; /** * @group Service Definitions */ @@ -391,11 +355,6 @@ export class Service extends EventEmitter { * @group Service Definitions */ public static ProtocolInformation: typeof ProtocolInformation; - /** - * @group Service Definitions - * @deprecated Please use {@link Service.CloudRelay}. - */ - public static Relay: typeof CloudRelay; /** * @group Service Definitions */ @@ -412,11 +371,6 @@ export class Service extends EventEmitter { * @group Service Definitions */ public static SiriEndpoint: typeof SiriEndpoint; - /** - * @group Service Definitions - * @deprecated Please use {@link Service.Slats}. - */ - public static Slat: typeof Slats; /** * @group Service Definitions */ @@ -477,11 +431,6 @@ export class Service extends EventEmitter { * @group Service Definitions */ public static ThreadTransport: typeof ThreadTransport; - /** - * @group Service Definitions - * @deprecated Removed and not used anymore - */ - public static TimeInformation: typeof TimeInformation; /** * @group Service Definitions */ @@ -490,11 +439,6 @@ export class Service extends EventEmitter { * @group Service Definitions */ public static Tunnel: typeof Tunnel; - /** - * @group Service Definitions - * @deprecated Please use {@link Service.Tunnel}. - */ - public static TunneledBTLEAccessoryService: typeof Tunnel; /** * @group Service Definitions */ diff --git a/src/lib/camera/Camera.ts b/src/lib/camera/Camera.ts deleted file mode 100644 index ed7d5c6db..000000000 --- a/src/lib/camera/Camera.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { Service } from "../Service"; -// noinspection JSDeprecatedSymbols -import { - CameraStreamingDelegate, - PrepareStreamCallback, - PrepareStreamRequest, - PrepareStreamResponse, - SnapshotRequest, - SnapshotRequestCallback, - StreamController, - StreamingRequest, - StreamRequest, - StreamRequestCallback, -} from "../.."; -import { NodeCallback, SessionIdentifier } from "../../types"; - -// noinspection JSDeprecatedSymbols -/** - * @group Camera - * @deprecated - */ -export type PreparedStreamRequestCallback = (response: PreparedStreamResponse) => void; -/** - * @group Camera - * @deprecated - */ -export type PreparedStreamResponse = PrepareStreamResponse; - -/** - * @group Camera - */ -// noinspection JSDeprecatedSymbols,JSUnusedGlobalSymbols -export type Camera = LegacyCameraSource; // provide backwards compatibility -// noinspection JSDeprecatedSymbols -/** - * Interface of and old style CameraSource. See {@link Accessory.configureCameraSource} for more Information. - * - * @group Camera - * @deprecated was replaced by {@link CameraStreamingDelegate} utilized by the {@link CameraController} - */ -export interface LegacyCameraSource { - - services: Service[]; - streamControllers: StreamController[]; - - handleSnapshotRequest(request: SnapshotRequest, callback: NodeCallback): void; - - prepareStream(request: PrepareStreamRequest, callback: PreparedStreamRequestCallback): void; - handleStreamRequest(request: StreamRequest): void; - - handleCloseConnection(connectionID: SessionIdentifier): void; - -} - -/** - * @group Camera - */ -// noinspection JSDeprecatedSymbols -export class LegacyCameraSourceAdapter implements CameraStreamingDelegate { - - private readonly cameraSource: LegacyCameraSource; - - constructor(cameraSource: LegacyCameraSource) { - this.cameraSource = cameraSource; - } - - handleSnapshotRequest(request: SnapshotRequest, callback: SnapshotRequestCallback): void { - this.cameraSource.handleSnapshotRequest(request, (error, buffer) => { - callback(error? error: undefined, buffer); - }); - } - - prepareStream(request: PrepareStreamRequest, callback: PrepareStreamCallback): void { - this.cameraSource.prepareStream(request, response => { - callback(undefined, response); - }); - } - - handleStreamRequest(request: StreamingRequest, callback: StreamRequestCallback): void { - // @ts-expect-error: compatible types - this.cameraSource.handleStreamRequest(request); - callback(); - } - - forwardCloseConnection(sessionID: SessionIdentifier): void { - // In the legacy type CameraSource API it was required that the plugin dev would forward this call to the - // handleCloseConnection of the "StreamController". This is not needed anymore and is automatically handled - // by HAP-NodeJS. However, devs could possibly define other stuff in there so we still forward this call. - this.cameraSource.handleCloseConnection(sessionID); - } - -} diff --git a/src/lib/camera/RTPStreamManagement.ts b/src/lib/camera/RTPStreamManagement.ts index bfcb11d91..18a753f0c 100644 --- a/src/lib/camera/RTPStreamManagement.ts +++ b/src/lib/camera/RTPStreamManagement.ts @@ -2,10 +2,10 @@ import assert from "assert"; import crypto from "crypto"; import createDebug from "debug"; import net from "net"; -import { CharacteristicValue, SessionIdentifier } from "../../types"; import { Access, Characteristic, CharacteristicEventTypes, CharacteristicSetCallback } from "../Characteristic"; import { CameraController, CameraStreamingDelegate, ResourceRequestReason, StateChangeDelegate } from "../controller"; import type { CameraRTPStreamManagement } from "../definitions"; +import { CharacteristicValue } from "../../types"; import { HAPStatus } from "../HAPServer"; import { Service } from "../Service"; import { HAPConnection, HAPConnectionEvent } from "../util/eventedhttp"; @@ -13,8 +13,6 @@ import { HapStatusError } from "../util/hapStatusError"; import { once } from "../util/once"; import * as tlv from "../util/tlv"; import * as uuid from "../util/uuid"; -// noinspection JSDeprecatedSymbols -import { LegacyCameraSource, LegacyCameraSourceAdapter } from "./Camera"; import RTPProxy from "./RTPProxy"; const debug = createDebug("HAP-NodeJS:Camera:RTPStreamManagement"); @@ -259,11 +257,6 @@ const enum AudioRTPParametersTypes { // ---------------------------------- TLV DEFINITIONS END ------------------------------------ -/** - * @group Camera - * @deprecated renamed to {@link CameraStreamingOptions} - */ -export type StreamControllerOptions = CameraStreamingOptions; /** * @group Camera */ @@ -417,11 +410,6 @@ export type Source = { * @group Camera */ export type PrepareStreamResponse = { - /** - * @deprecated The local ip address will be automatically determined by HAP-NodeJS. - * Any value set will be ignored. You may only still set a value to support version prior to 0.7.9 - */ - address?: string | Address; /** * Any value set to this optional property will overwrite the automatically determined local address, * which is sent as RTP endpoint to the iOS device. @@ -433,15 +421,6 @@ export type PrepareStreamResponse = { audio?: SourceResponse | ProxiedSourceResponse; } -/** - * @group Camera - * @deprecated just supply the address directly in {@link PrepareStreamRequest} - */ -export type Address = { - address: string; - type?: "v4" | "v6"; -} - /** * @group Camera */ @@ -476,16 +455,6 @@ export const enum StreamRequestTypes { * @group Camera */ export type StreamingRequest = StartStreamRequest | ReconfigureStreamRequest | StopStreamRequest; -/** - * @group Camera - * @deprecated replaced by {@link StreamingRequest} - */ -export type StreamRequest = { - sessionID: SessionIdentifier; - type: StreamRequestTypes; - video?: VideoInfo; - audio?: AudioInfo; -} /** * @group Camera @@ -579,21 +548,6 @@ export interface RTPStreamManagementState { * @group Camera */ export class RTPStreamManagement { - /** - * @deprecated Please use the SRTPCryptoSuites const enum above. - */ - // @ts-expect-error: forceConsistentCasingInFileNames compiler option - static SRTPCryptoSuites = SRTPCryptoSuites; - /** - * @deprecated Please use the H264Profile const enum above. - */ - // @ts-expect-error: forceConsistentCasingInFileNames compiler option - static VideoCodecParamProfileIDTypes = H264Profile; - /** - * @deprecated won't be updated anymore. Please use the H264Level const enum above. - */ - static VideoCodecParamLevelTypes = Object.freeze({ TYPE3_1: 0, TYPE3_2: 1, TYPE4_0: 2 }); - private readonly id: number; private readonly delegate: CameraStreamingDelegate; readonly service: CameraRTPStreamManagement; @@ -609,10 +563,6 @@ export class RTPStreamManagement { readonly supportedVideoStreamConfiguration: string; readonly supportedAudioStreamConfiguration: string; - /** - * @deprecated - */ - connectionID?: SessionIdentifier; private activeConnection?: HAPConnection; private readonly activeConnectionClosedListener: (callback?: CharacteristicSetCallback) => void; sessionIdentifier?: StreamSessionIdentifier = undefined; @@ -690,17 +640,6 @@ export class RTPStreamManagement { return this.service; } - // noinspection JSUnusedGlobalSymbols,JSUnusedLocalSymbols - /** - * @deprecated - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - handleCloseConnection(connectionID: SessionIdentifier): void { - // This method is only here for legacy compatibility. It used to be called by legacy style CameraSource - // implementations to signal that the associated HAP connection was closed. - // This is now handled automatically. Thus, we don't need to do anything anymore. - } - handleFactoryReset(): void { this.resetSelectedStreamConfiguration(); this.resetSetupEndpointsResponse(); @@ -790,8 +729,6 @@ export class RTPStreamManagement { this._updateStreamStatus(StreamingStatus.AVAILABLE); this.sessionIdentifier = undefined; - // noinspection JSDeprecatedSymbols - this.connectionID = undefined; this.ipVersion = undefined; if (this.videoProxy) { @@ -1102,8 +1039,6 @@ export class RTPStreamManagement { this.activeConnection.setMaxListeners(this.activeConnection.getMaxListeners() + 1); this.activeConnection.on(HAPConnectionEvent.CLOSED, this.activeConnectionClosedListener); - // noinspection JSDeprecatedSymbols - this.connectionID = connection.sessionID; this.sessionIdentifier = sessionIdentifier; this._updateStreamStatus(StreamingStatus.IN_USE); @@ -1589,21 +1524,3 @@ export class RTPStreamManagement { } } -/** - * @group Camera - * @deprecated - only there for backwards compatibility, please use {@link RTPStreamManagement} directly - */ -export class StreamController extends RTPStreamManagement { - - /** - * options get saved so we can still support {@link Accessory.configureCameraSource} - */ - options: CameraStreamingOptions; - - // noinspection JSDeprecatedSymbols - constructor(id: number, options: CameraStreamingOptions, delegate: LegacyCameraSource, service?: CameraRTPStreamManagement) { - super(id, options, new LegacyCameraSourceAdapter(delegate), service); - this.options = options; - } - -} diff --git a/src/lib/camera/RecordingManagement.ts b/src/lib/camera/RecordingManagement.ts index 06ffe7e66..09889745e 100644 --- a/src/lib/camera/RecordingManagement.ts +++ b/src/lib/camera/RecordingManagement.ts @@ -1018,6 +1018,10 @@ class CameraRecordingStream extends EventEmitter implements DataStreamProtocolHa let offset = 0; let dataChunkSequenceNumber = 1; while (offset < fragment.length) { + if (this.closed) { + break; + } + const data = fragment.slice(offset, offset + maxChunk); offset += data.length; diff --git a/src/lib/camera/index.ts b/src/lib/camera/index.ts index db1350996..341a0ce87 100644 --- a/src/lib/camera/index.ts +++ b/src/lib/camera/index.ts @@ -1,4 +1,3 @@ -export * from "./Camera"; export * from "./RTPProxy"; export * from "./RTPStreamManagement"; export * from "./RecordingManagement"; diff --git a/src/lib/controller/AdaptiveLightingController.ts b/src/lib/controller/AdaptiveLightingController.ts index d56d62b08..a9354ee9f 100644 --- a/src/lib/controller/AdaptiveLightingController.ts +++ b/src/lib/controller/AdaptiveLightingController.ts @@ -302,7 +302,7 @@ export const enum AdaptiveLightingControllerMode { export const enum AdaptiveLightingControllerEvents { /** * This event is called once a HomeKit controller enables Adaptive Lighting - * or a HomeHub sends a updated transition schedule for the next 24 hours. + * or a HomeHub sends an updated transition schedule for the next 24 hours. * This is also called on startup when AdaptiveLighting was previously enabled. */ UPDATE = "update", @@ -314,6 +314,19 @@ export const enum AdaptiveLightingControllerEvents { DISABLED = "disable", } +/** + * @group Adaptive Lighting + * see {@link ActiveAdaptiveLightingTransition}. + */ +export interface AdaptiveLightingControllerUpdate { + transitionStartMillis: number; + timeMillisOffset: number; + transitionCurve: AdaptiveLightingTransitionCurveEntry[]; + brightnessAdjustmentRange: BrightnessAdjustmentMultiplierRange; + updateInterval: number, + notifyIntervalThreshold: number; +} + /** * @group Adaptive Lighting */ @@ -321,11 +334,12 @@ export const enum AdaptiveLightingControllerEvents { export declare interface AdaptiveLightingController { /** * See {@link AdaptiveLightingControllerEvents.UPDATE} + * Also see {@link AdaptiveLightingControllerUpdate} * * @param event * @param listener */ - on(event: "update", listener: () => void): this; + on(event: "update", listener: (update: AdaptiveLightingControllerUpdate) => void): this; /** * See {@link AdaptiveLightingControllerEvents.DISABLED} * @@ -334,7 +348,10 @@ export declare interface AdaptiveLightingController { */ on(event: "disable", listener: () => void): this; - emit(event: "update"): boolean; + /** + * See {@link AdaptiveLightingControllerUpdate} + */ + emit(event: "update", update: AdaptiveLightingControllerUpdate): boolean; emit(event: "disable"): boolean; } @@ -526,15 +543,10 @@ export class AdaptiveLightingController } if (this.activeTransition) { - this.colorTemperatureCharacteristic!.removeListener(CharacteristicEventTypes.CHANGE, this.characteristicManualWrittenChangeListener); - this.brightnessCharacteristic!.removeListener(CharacteristicEventTypes.CHANGE, this.adjustmentFactorChangedListener); - - if (this.hueCharacteristic) { - this.hueCharacteristic.removeListener(CharacteristicEventTypes.CHANGE, this.characteristicManualWrittenChangeListener); - } - if (this.saturationCharacteristic) { - this.saturationCharacteristic.removeListener(CharacteristicEventTypes.CHANGE, this.characteristicManualWrittenChangeListener); - } + this.colorTemperatureCharacteristic?.removeListener(CharacteristicEventTypes.CHANGE, this.characteristicManualWrittenChangeListener); + this.brightnessCharacteristic?.removeListener(CharacteristicEventTypes.CHANGE, this.adjustmentFactorChangedListener); + this.hueCharacteristic?.removeListener(CharacteristicEventTypes.CHANGE, this.characteristicManualWrittenChangeListener); + this.saturationCharacteristic?.removeListener(CharacteristicEventTypes.CHANGE, this.characteristicManualWrittenChangeListener); this.activeTransition = undefined; @@ -554,7 +566,7 @@ export class AdaptiveLightingController this.didRunFirstInitializationStep = false; - this.activeTransitionCount!.sendEventNotification(0); + this.activeTransitionCount?.sendEventNotification(0); debug("[%s] Disabling adaptive lighting", this.lightbulb.displayName); } @@ -631,16 +643,31 @@ export class AdaptiveLightingController // ----------- PUBLIC API END ----------- private handleActiveTransitionUpdated(calledFromDeserializer = false): void { - if (!calledFromDeserializer) { - this.activeTransitionCount!.sendEventNotification(1); - } else { - this.activeTransitionCount!.value = 1; + if (this.activeTransitionCount) { + if (!calledFromDeserializer) { + this.activeTransitionCount.sendEventNotification(1); + } else { + this.activeTransitionCount.value = 1; + } } if (this.mode === AdaptiveLightingControllerMode.AUTOMATIC) { this.scheduleNextUpdate(); } else if (this.mode === AdaptiveLightingControllerMode.MANUAL) { - this.emit(AdaptiveLightingControllerEvents.UPDATE); + if (!this.activeTransition) { + throw new Error("There is no active transition!"); + } + + const update: AdaptiveLightingControllerUpdate = { + transitionStartMillis: this.activeTransition.transitionStartMillis, + timeMillisOffset: this.activeTransition.timeMillisOffset, + transitionCurve: this.activeTransition.transitionCurve, + brightnessAdjustmentRange: this.activeTransition.brightnessAdjustmentRange, + updateInterval: this.activeTransition.updateInterval, + notifyIntervalThreshold: this.activeTransition.notifyIntervalThreshold, + }; + + this.emit(AdaptiveLightingControllerEvents.UPDATE, update); } else { throw new Error("Unsupported adaptive lighting controller mode: " + this.mode); } @@ -833,7 +860,7 @@ export class AdaptiveLightingController this.activeTransition.brightnessAdjustmentRange.minBrightnessValue, Math.min( this.activeTransition.brightnessAdjustmentRange.maxBrightnessValue, - this.brightnessCharacteristic!.value as number, // get handler is not called for optimal performance + this.brightnessCharacteristic?.value as number, // get handler is not called for optimal performance ), ); @@ -877,7 +904,7 @@ export class AdaptiveLightingController this.hueCharacteristic.value = color.hue; } - this.colorTemperatureCharacteristic!.handleSetRequest(temperature, undefined, context).catch(reason => { // reason is HAPStatus code + this.colorTemperatureCharacteristic?.handleSetRequest(temperature, undefined, context).catch(reason => { // reason is HAPStatus code debug("[%s] Failed to next adaptive lighting transition point: %d", this.lightbulb.displayName, reason); }); @@ -898,7 +925,7 @@ export class AdaptiveLightingController }; if (this.lastNotifiedTemperatureValue !== temperature) { - this.colorTemperatureCharacteristic!.sendEventNotification(temperature, eventContext); + this.colorTemperatureCharacteristic?.sendEventNotification(temperature, eventContext); this.lastNotifiedTemperatureValue = temperature; } if (this.saturationCharacteristic && this.lastNotifiedSaturationValue !== color.saturation) { @@ -1023,8 +1050,8 @@ export class AdaptiveLightingController } private handleSupportedTransitionConfigurationRead(): string { - const brightnessIID = this.lightbulb!.getCharacteristic(Characteristic.Brightness).iid; - const temperatureIID = this.lightbulb!.getCharacteristic(Characteristic.ColorTemperature).iid; + const brightnessIID = this.lightbulb?.getCharacteristic(Characteristic.Brightness).iid; + const temperatureIID = this.lightbulb?.getCharacteristic(Characteristic.ColorTemperature).iid; assert(brightnessIID, "iid for brightness characteristic is undefined"); assert(temperatureIID, "iid for temperature characteristic is undefined"); diff --git a/src/lib/controller/CameraController.spec.ts b/src/lib/controller/CameraController.spec.ts index 98d3c0ceb..1a6433836 100644 --- a/src/lib/controller/CameraController.spec.ts +++ b/src/lib/controller/CameraController.spec.ts @@ -10,14 +10,12 @@ import { SnapshotRequestCallback, StreamRequestCallback, } from "."; -import { NodeCallback, SessionIdentifier } from "../../types"; import { AudioBitrate, AudioRecordingCodecType, AudioRecordingSamplerate, AudioStreamingCodecType, AudioStreamingSamplerate, - Camera, CameraRecordingConfiguration, CameraRecordingOptions, CameraStreamingOptions, @@ -25,21 +23,17 @@ import { H264Level, H264Profile, MediaContainerType, - PreparedStreamRequestCallback, PrepareStreamRequest, RecordingPacket, SnapshotRequest, SRTPCryptoSuites, - StreamController, StreamingRequest, - StreamRequest, VideoCodecType, } from "../camera"; import { Characteristic } from "../Characteristic"; import { HDSProtocolSpecificErrorReason } from "../datastream"; import "../definitions"; import { HAPStatus } from "../HAPServer"; -import { Service } from "../Service"; export const MOCK_IMAGE = crypto.randomBytes(64); @@ -131,47 +125,6 @@ export class MockDelegate implements CameraStreamingDelegate, CameraRecordingDel } } -export class MockLegacyCameraSource implements Camera { - services: Service[] = []; - // noinspection JSDeprecatedSymbols - streamControllers: StreamController[] = []; - - constructor(size: number, options?: CameraStreamingOptions) { - const opt = options ?? { - video: mockStreamingOptions.video, - audio: mockStreamingOptions.audio, - srtp: true, - }; - - for (let i = 0; i < size; i++) { - const controller = new StreamController(i, opt, this); - this.streamControllers.push(controller); - this.services.push(controller.getService()); - } - } - - handleCloseConnection(connectionID: SessionIdentifier): void { - for (const controller of this.streamControllers) { - // noinspection JSDeprecatedSymbols - controller.handleCloseConnection(connectionID); - } - } - - handleSnapshotRequest(request: SnapshotRequest, callback: NodeCallback): void { - callback(undefined, MOCK_IMAGE); - } - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - handleStreamRequest(request: StreamRequest): void { - throw Error("Unsupported!"); - } - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - prepareStream(request: PrepareStreamRequest, callback: PreparedStreamRequestCallback): void { - throw Error("Unsupported!"); - } -} - export function createCameraControllerOptions( recordingOptions: CameraRecordingOptions = mockRecordingOptions, streamingOptions: CameraStreamingOptions = mockStreamingOptions, diff --git a/src/lib/controller/CameraController.ts b/src/lib/controller/CameraController.ts index 175f5c061..f8124508e 100644 --- a/src/lib/controller/CameraController.ts +++ b/src/lib/controller/CameraController.ts @@ -7,7 +7,6 @@ import { CameraRecordingOptions, CameraStreamingOptions, EventTriggerOption, - LegacyCameraSourceAdapter, PrepareStreamRequest, PrepareStreamResponse, RecordingManagement, @@ -1071,14 +1070,4 @@ export class CameraController extends EventEmitter implements SerializableContro } }); } - - /** - * @private - */ - handleCloseConnection(sessionID: SessionIdentifier): void { - if (this.delegate instanceof LegacyCameraSourceAdapter) { - this.delegate.forwardCloseConnection(sessionID); - } - } - } diff --git a/src/lib/controller/RemoteController.ts b/src/lib/controller/RemoteController.ts index 3c996630a..5bbeb2864 100644 --- a/src/lib/controller/RemoteController.ts +++ b/src/lib/controller/RemoteController.ts @@ -2,7 +2,6 @@ import assert from "assert"; import createDebug from "debug"; import { EventEmitter } from "events"; import { CharacteristicValue } from "../../types"; -import { Accessory } from "../Accessory"; import { AudioBitrate, AudioSamplerate } from "../camera"; import { Characteristic, @@ -583,16 +582,6 @@ export class RemoteController extends EventEmitter setTimeout(() => this.releaseButton(button), time); } - /** - * This method adds and configures the remote services for a give accessory. - * - * @param accessory - the give accessory this remote should be added to - * @deprecated - use {@link Accessory.configureController} instead - */ - addServicesToAccessory(accessory: Accessory): void { - accessory.configureController(this); - } - // ---------------------------------- CONFIGURATION ---------------------------------- // override methods if you would like to change anything (but should not be necessary most likely) @@ -1394,12 +1383,6 @@ export class RemoteController extends EventEmitter } } -// noinspection JSUnusedGlobalSymbols -/** - * @deprecated - only there for backwards compatibility, please use {@link RemoteController} directly - * @group Apple TV Remote - */ -export class HomeKitRemoteController extends RemoteController {} // backwards compatibility /** * @group Apple TV Remote diff --git a/src/lib/datastream/DataStreamServer.ts b/src/lib/datastream/DataStreamServer.ts index 9d997f862..f5fb37dc1 100644 --- a/src/lib/datastream/DataStreamServer.ts +++ b/src/lib/datastream/DataStreamServer.ts @@ -108,11 +108,6 @@ export enum HDSStatus { PROTOCOL_SPECIFIC_ERROR = 6, } -/** - * @group HomeKit Data Streams (HDS) - * @deprecated Renamed to {@link HDSProtocolSpecificErrorReason}. - */ -export type DataSendCloseReason = HDSProtocolSpecificErrorReason; /** * @group HomeKit Data Streams (HDS) */ @@ -715,7 +710,9 @@ export class DataStreamConnection extends EventEmitter { header.protocol = protocol; header.event = event; - this.sendHDSFrame(header, message); + if (this.state === ConnectionState.READY) { + this.sendHDSFrame(header, message); + } } /** diff --git a/src/lib/definitions/CharacteristicDefinitions.spec.ts b/src/lib/definitions/CharacteristicDefinitions.spec.ts index b0e82202f..7394ba7e8 100644 --- a/src/lib/definitions/CharacteristicDefinitions.spec.ts +++ b/src/lib/definitions/CharacteristicDefinitions.spec.ts @@ -160,12 +160,6 @@ describe("CharacteristicDefinitions", () => { }); }); - describe("Category", () => { - it("should be able to construct", () => { - new Characteristic.Category(); - }); - }); - describe("CCAEnergyDetectThreshold", () => { it("should be able to construct", () => { new Characteristic.CCAEnergyDetectThreshold(); @@ -214,18 +208,6 @@ describe("CharacteristicDefinitions", () => { }); }); - describe("ConfigureBridgedAccessory", () => { - it("should be able to construct", () => { - new Characteristic.ConfigureBridgedAccessory(); - }); - }); - - describe("ConfigureBridgedAccessoryStatus", () => { - it("should be able to construct", () => { - new Characteristic.ConfigureBridgedAccessoryStatus(); - }); - }); - describe("ConfiguredName", () => { it("should be able to construct", () => { new Characteristic.ConfiguredName(); @@ -334,12 +316,6 @@ describe("CharacteristicDefinitions", () => { }); }); - describe("CurrentTime", () => { - it("should be able to construct", () => { - new Characteristic.CurrentTime(); - }); - }); - describe("CurrentTransport", () => { it("should be able to construct", () => { new Characteristic.CurrentTransport(); @@ -370,12 +346,6 @@ describe("CharacteristicDefinitions", () => { }); }); - describe("DayoftheWeek", () => { - it("should be able to construct", () => { - new Characteristic.DayoftheWeek(); - }); - }); - describe("DiagonalFieldOfView", () => { it("should be able to construct", () => { new Characteristic.DiagonalFieldOfView(); @@ -388,18 +358,6 @@ describe("CharacteristicDefinitions", () => { }); }); - describe("DiscoverBridgedAccessories", () => { - it("should be able to construct", () => { - new Characteristic.DiscoverBridgedAccessories(); - }); - }); - - describe("DiscoveredBridgedAccessories", () => { - it("should be able to construct", () => { - new Characteristic.DiscoveredBridgedAccessories(); - }); - }); - describe("DisplayOrder", () => { it("should be able to construct", () => { new Characteristic.DisplayOrder(); @@ -550,12 +508,6 @@ describe("CharacteristicDefinitions", () => { }); }); - describe("LinkQuality", () => { - it("should be able to construct", () => { - new Characteristic.LinkQuality(); - }); - }); - describe("ListPairings", () => { it("should be able to construct", () => { new Characteristic.ListPairings(); @@ -850,12 +802,6 @@ describe("CharacteristicDefinitions", () => { }); }); - describe("Reachable", () => { - it("should be able to construct", () => { - new Characteristic.Reachable(); - }); - }); - describe("ReceivedSignalStrengthIndication", () => { it("should be able to construct", () => { new Characteristic.ReceivedSignalStrengthIndication(); @@ -1276,12 +1222,6 @@ describe("CharacteristicDefinitions", () => { }); }); - describe("TargetAirQuality", () => { - it("should be able to construct", () => { - new Characteristic.TargetAirQuality(); - }); - }); - describe("TargetControlList", () => { it("should be able to construct", () => { new Characteristic.TargetControlList(); @@ -1348,12 +1288,6 @@ describe("CharacteristicDefinitions", () => { }); }); - describe("TargetSlatState", () => { - it("should be able to construct", () => { - new Characteristic.TargetSlatState(); - }); - }); - describe("TargetTemperature", () => { it("should be able to construct", () => { new Characteristic.TargetTemperature(); @@ -1414,12 +1348,6 @@ describe("CharacteristicDefinitions", () => { }); }); - describe("TimeUpdate", () => { - it("should be able to construct", () => { - new Characteristic.TimeUpdate(); - }); - }); - describe("Token", () => { it("should be able to construct", () => { new Characteristic.Token(); diff --git a/src/lib/definitions/CharacteristicDefinitions.ts b/src/lib/definitions/CharacteristicDefinitions.ts index 2b9ba1dc0..86b7531f9 100644 --- a/src/lib/definitions/CharacteristicDefinitions.ts +++ b/src/lib/definitions/CharacteristicDefinitions.ts @@ -523,27 +523,6 @@ export class CarbonMonoxidePeakLevel extends Characteristic { } Characteristic.CarbonMonoxidePeakLevel = CarbonMonoxidePeakLevel; -/** - * Characteristic "Category" - * @deprecated Removed and not used anymore - */ -export class Category extends Characteristic { - - public static readonly UUID: string = "000000A3-0000-1000-8000-0026BB765291"; - - constructor() { - super("Category", Category.UUID, { - format: Formats.UINT16, - perms: [Perms.NOTIFY, Perms.PAIRED_READ], - minValue: 1, - maxValue: 16, - }); - this.value = this.getDefaultValue(); - } -} -// noinspection JSDeprecatedSymbols -Characteristic.Category = Category; - /** * Characteristic "CCA Energy Detect Threshold" * @since iOS 14 @@ -703,44 +682,6 @@ export class ConfigurationState extends Characteristic { } Characteristic.ConfigurationState = ConfigurationState; -/** - * Characteristic "Configure Bridged Accessory" - * @deprecated Removed and not used anymore - */ -export class ConfigureBridgedAccessory extends Characteristic { - - public static readonly UUID: string = "000000A0-0000-1000-8000-0026BB765291"; - - constructor() { - super("Configure Bridged Accessory", ConfigureBridgedAccessory.UUID, { - format: Formats.TLV8, - perms: [Perms.PAIRED_WRITE], - }); - this.value = this.getDefaultValue(); - } -} -// noinspection JSDeprecatedSymbols -Characteristic.ConfigureBridgedAccessory = ConfigureBridgedAccessory; - -/** - * Characteristic "Configure Bridged Accessory Status" - * @deprecated Removed and not used anymore - */ -export class ConfigureBridgedAccessoryStatus extends Characteristic { - - public static readonly UUID: string = "0000009D-0000-1000-8000-0026BB765291"; - - constructor() { - super("Configure Bridged Accessory Status", ConfigureBridgedAccessoryStatus.UUID, { - format: Formats.TLV8, - perms: [Perms.NOTIFY, Perms.PAIRED_READ], - }); - this.value = this.getDefaultValue(); - } -} -// noinspection JSDeprecatedSymbols -Characteristic.ConfigureBridgedAccessoryStatus = ConfigureBridgedAccessoryStatus; - /** * Characteristic "Configured Name" */ @@ -1151,25 +1092,6 @@ export class CurrentTiltAngle extends Characteristic { } Characteristic.CurrentTiltAngle = CurrentTiltAngle; -/** - * Characteristic "Current Time" - * @deprecated Removed and not used anymore - */ -export class CurrentTime extends Characteristic { - - public static readonly UUID: string = "0000009B-0000-1000-8000-0026BB765291"; - - constructor() { - super("Current Time", CurrentTime.UUID, { - format: Formats.STRING, - perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE], - }); - this.value = this.getDefaultValue(); - } -} -// noinspection JSDeprecatedSymbols -Characteristic.CurrentTime = CurrentTime; - /** * Characteristic "Current Transport" * @since iOS 14 @@ -1269,27 +1191,6 @@ export class DataStreamHAPTransportInterrupt extends Characteristic { } Characteristic.DataStreamHAPTransportInterrupt = DataStreamHAPTransportInterrupt; -/** - * Characteristic "Day of the Week" - * @deprecated Removed and not used anymore - */ -export class DayoftheWeek extends Characteristic { - - public static readonly UUID: string = "00000098-0000-1000-8000-0026BB765291"; - - constructor() { - super("Day of the Week", DayoftheWeek.UUID, { - format: Formats.UINT8, - perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE], - minValue: 1, - maxValue: 7, - }); - this.value = this.getDefaultValue(); - } -} -// noinspection JSDeprecatedSymbols -Characteristic.DayoftheWeek = DayoftheWeek; - /** * Characteristic "Diagonal Field Of View" * @since iOS 13.2 @@ -1329,44 +1230,6 @@ export class DigitalZoom extends Characteristic { } Characteristic.DigitalZoom = DigitalZoom; -/** - * Characteristic "Discover Bridged Accessories" - * @deprecated Removed and not used anymore - */ -export class DiscoverBridgedAccessories extends Characteristic { - - public static readonly UUID: string = "0000009E-0000-1000-8000-0026BB765291"; - - constructor() { - super("Discover Bridged Accessories", DiscoverBridgedAccessories.UUID, { - format: Formats.UINT8, - perms: [Perms.NOTIFY, Perms.PAIRED_READ, Perms.PAIRED_WRITE], - }); - this.value = this.getDefaultValue(); - } -} -// noinspection JSDeprecatedSymbols -Characteristic.DiscoverBridgedAccessories = DiscoverBridgedAccessories; - -/** - * Characteristic "Discovered Bridged Accessories" - * @deprecated Removed and not used anymore - */ -export class DiscoveredBridgedAccessories extends Characteristic { - - public static readonly UUID: string = "0000009F-0000-1000-8000-0026BB765291"; - - constructor() { - super("Discovered Bridged Accessories", DiscoveredBridgedAccessories.UUID, { - format: Formats.UINT16, - perms: [Perms.NOTIFY, Perms.PAIRED_READ], - }); - this.value = this.getDefaultValue(); - } -} -// noinspection JSDeprecatedSymbols -Characteristic.DiscoveredBridgedAccessories = DiscoveredBridgedAccessories; - /** * Characteristic "Display Order" */ @@ -1878,27 +1741,6 @@ export class LeakDetected extends Characteristic { } Characteristic.LeakDetected = LeakDetected; -/** - * Characteristic "Link Quality" - * @deprecated Removed and not used anymore - */ -export class LinkQuality extends Characteristic { - - public static readonly UUID: string = "0000009C-0000-1000-8000-0026BB765291"; - - constructor() { - super("Link Quality", LinkQuality.UUID, { - format: Formats.UINT8, - perms: [Perms.NOTIFY, Perms.PAIRED_READ], - minValue: 1, - maxValue: 4, - }); - this.value = this.getDefaultValue(); - } -} -// noinspection JSDeprecatedSymbols -Characteristic.LinkQuality = LinkQuality; - /** * Characteristic "List Pairings" */ @@ -2848,7 +2690,7 @@ export class ProgramMode extends Characteristic { public static readonly NO_PROGRAM_SCHEDULED = 0; public static readonly PROGRAM_SCHEDULED = 1; - public static readonly PROGRAM_SCHEDULED_MANUAL_MODE_ = 2; + public static readonly PROGRAM_SCHEDULED_MANUAL_MODE = 2; constructor() { super("Program Mode", ProgramMode.UUID, { @@ -2864,25 +2706,6 @@ export class ProgramMode extends Characteristic { } Characteristic.ProgramMode = ProgramMode; -/** - * Characteristic "Reachable" - * @deprecated Removed and not used anymore - */ -export class Reachable extends Characteristic { - - public static readonly UUID: string = "00000063-0000-1000-8000-0026BB765291"; - - constructor() { - super("Reachable", Reachable.UUID, { - format: Formats.BOOL, - perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE], - }); - this.value = this.getDefaultValue(); - } -} -// noinspection JSDeprecatedSymbols -Characteristic.Reachable = Reachable; - /** * Characteristic "Received Signal Strength Indication" * @since iOS 14 @@ -4260,32 +4083,6 @@ export class TargetAirPurifierState extends Characteristic { } Characteristic.TargetAirPurifierState = TargetAirPurifierState; -/** - * Characteristic "Target Air Quality" - * @deprecated Removed and not used anymore - */ -export class TargetAirQuality extends Characteristic { - - public static readonly UUID: string = "000000AE-0000-1000-8000-0026BB765291"; - - public static readonly EXCELLENT = 0; - public static readonly GOOD = 1; - public static readonly FAIR = 2; - - constructor() { - super("Target Air Quality", TargetAirQuality.UUID, { - format: Formats.UINT8, - perms: [Perms.NOTIFY, Perms.PAIRED_READ, Perms.PAIRED_WRITE], - minValue: 0, - maxValue: 2, - validValues: [0, 1, 2], - }); - this.value = this.getDefaultValue(); - } -} -// noinspection JSDeprecatedSymbols -Characteristic.TargetAirQuality = TargetAirQuality; - /** * Characteristic "Target Control List" */ @@ -4448,11 +4245,6 @@ export class TargetHumidifierDehumidifierState extends Characteristic { public static readonly UUID: string = "000000B4-0000-1000-8000-0026BB765291"; - /** - * @deprecated Removed in iOS 11. Use {@link HUMIDIFIER_OR_DEHUMIDIFIER} instead. - */ - public static readonly AUTO = 0; - public static readonly HUMIDIFIER_OR_DEHUMIDIFIER = 0; public static readonly HUMIDIFIER = 1; public static readonly DEHUMIDIFIER = 2; @@ -4538,31 +4330,6 @@ export class TargetRelativeHumidity extends Characteristic { } Characteristic.TargetRelativeHumidity = TargetRelativeHumidity; -/** - * Characteristic "Target Slat State" - * @deprecated Removed and not used anymore - */ -export class TargetSlatState extends Characteristic { - - public static readonly UUID: string = "000000BE-0000-1000-8000-0026BB765291"; - - public static readonly MANUAL = 0; - public static readonly AUTO = 1; - - constructor() { - super("Target Slat State", TargetSlatState.UUID, { - format: Formats.UINT8, - perms: [Perms.NOTIFY, Perms.PAIRED_READ, Perms.PAIRED_WRITE], - minValue: 0, - maxValue: 1, - validValues: [0, 1], - }); - this.value = this.getDefaultValue(); - } -} -// noinspection JSDeprecatedSymbols -Characteristic.TargetSlatState = TargetSlatState; - /** * Characteristic "Target Temperature" */ @@ -4769,25 +4536,6 @@ export class ThreadStatus extends Characteristic { } Characteristic.ThreadStatus = ThreadStatus; -/** - * Characteristic "Time Update" - * @deprecated Removed and not used anymore - */ -export class TimeUpdate extends Characteristic { - - public static readonly UUID: string = "0000009A-0000-1000-8000-0026BB765291"; - - constructor() { - super("Time Update", TimeUpdate.UUID, { - format: Formats.BOOL, - perms: [Perms.PAIRED_READ, Perms.PAIRED_WRITE], - }); - this.value = this.getDefaultValue(); - } -} -// noinspection JSDeprecatedSymbols -Characteristic.TimeUpdate = TimeUpdate; - /** * Characteristic "Token" */ diff --git a/src/lib/definitions/ServiceDefinitions.spec.ts b/src/lib/definitions/ServiceDefinitions.spec.ts index 91515668b..2a17fe5d3 100644 --- a/src/lib/definitions/ServiceDefinitions.spec.ts +++ b/src/lib/definitions/ServiceDefinitions.spec.ts @@ -240,75 +240,6 @@ describe("ServiceDefinitions", () => { expect(service1.getCharacteristic(Characteristic.Name).value).toBe("test name"); expect(service1.subtype).toBeUndefined(); - expect(service2.displayName).toBe("test name"); - expect(service2.testCharacteristic(Characteristic.Name)).toBe(true); - expect(service2.getCharacteristic(Characteristic.Name).value).toBe("test name"); - expect(service2.subtype).toBe("test sub type"); - // noinspection JSDeprecatedSymbols - - new Service.BatteryService(); - }); - }); - - describe("BridgeConfiguration", () => { - it("should be able to construct", () => { - const service0 = new Service.BridgeConfiguration(); - const service1 = new Service.BridgeConfiguration("test name"); - const service2 = new Service.BridgeConfiguration("test name", "test sub type"); - - expect(service0.displayName).toBe(""); - expect(service0.testCharacteristic(Characteristic.Name)).toBe(false); - expect(service0.subtype).toBeUndefined(); - - expect(service1.displayName).toBe("test name"); - expect(service1.testCharacteristic(Characteristic.Name)).toBe(true); - expect(service1.getCharacteristic(Characteristic.Name).value).toBe("test name"); - expect(service1.subtype).toBeUndefined(); - - expect(service2.displayName).toBe("test name"); - expect(service2.testCharacteristic(Characteristic.Name)).toBe(true); - expect(service2.getCharacteristic(Characteristic.Name).value).toBe("test name"); - expect(service2.subtype).toBe("test sub type"); - }); - }); - - describe("BridgingState", () => { - it("should be able to construct", () => { - const service0 = new Service.BridgingState(); - const service1 = new Service.BridgingState("test name"); - const service2 = new Service.BridgingState("test name", "test sub type"); - - expect(service0.displayName).toBe(""); - expect(service0.testCharacteristic(Characteristic.Name)).toBe(false); - expect(service0.subtype).toBeUndefined(); - - expect(service1.displayName).toBe("test name"); - expect(service1.testCharacteristic(Characteristic.Name)).toBe(true); - expect(service1.getCharacteristic(Characteristic.Name).value).toBe("test name"); - expect(service1.subtype).toBeUndefined(); - - expect(service2.displayName).toBe("test name"); - expect(service2.testCharacteristic(Characteristic.Name)).toBe(true); - expect(service2.getCharacteristic(Characteristic.Name).value).toBe("test name"); - expect(service2.subtype).toBe("test sub type"); - }); - }); - - describe("CameraControl", () => { - it("should be able to construct", () => { - const service0 = new Service.CameraControl(); - const service1 = new Service.CameraControl("test name"); - const service2 = new Service.CameraControl("test name", "test sub type"); - - expect(service0.displayName).toBe(""); - expect(service0.testCharacteristic(Characteristic.Name)).toBe(false); - expect(service0.subtype).toBeUndefined(); - - expect(service1.displayName).toBe("test name"); - expect(service1.testCharacteristic(Characteristic.Name)).toBe(true); - expect(service1.getCharacteristic(Characteristic.Name).value).toBe("test name"); - expect(service1.subtype).toBeUndefined(); - expect(service2.displayName).toBe("test name"); expect(service2.testCharacteristic(Characteristic.Name)).toBe(true); expect(service2.getCharacteristic(Characteristic.Name).value).toBe("test name"); @@ -357,9 +288,6 @@ describe("ServiceDefinitions", () => { expect(service2.testCharacteristic(Characteristic.Name)).toBe(true); expect(service2.getCharacteristic(Characteristic.Name).value).toBe("test name"); expect(service2.subtype).toBe("test sub type"); - // noinspection JSDeprecatedSymbols - - new Service.CameraEventRecordingManagement(); }); }); @@ -448,9 +376,6 @@ describe("ServiceDefinitions", () => { expect(service2.testCharacteristic(Characteristic.Name)).toBe(true); expect(service2.getCharacteristic(Characteristic.Name).value).toBe("test name"); expect(service2.subtype).toBe("test sub type"); - // noinspection JSDeprecatedSymbols - - new Service.Relay(); }); }); @@ -1199,9 +1124,6 @@ describe("ServiceDefinitions", () => { expect(service2.testCharacteristic(Characteristic.Name)).toBe(true); expect(service2.getCharacteristic(Characteristic.Name).value).toBe("test name"); expect(service2.subtype).toBe("test sub type"); - // noinspection JSDeprecatedSymbols - - new Service.Slat(); }); }); @@ -1513,28 +1435,6 @@ describe("ServiceDefinitions", () => { }); }); - describe("TimeInformation", () => { - it("should be able to construct", () => { - const service0 = new Service.TimeInformation(); - const service1 = new Service.TimeInformation("test name"); - const service2 = new Service.TimeInformation("test name", "test sub type"); - - expect(service0.displayName).toBe(""); - expect(service0.testCharacteristic(Characteristic.Name)).toBe(false); - expect(service0.subtype).toBeUndefined(); - - expect(service1.displayName).toBe("test name"); - expect(service1.testCharacteristic(Characteristic.Name)).toBe(true); - expect(service1.getCharacteristic(Characteristic.Name).value).toBe("test name"); - expect(service1.subtype).toBeUndefined(); - - expect(service2.displayName).toBe("test name"); - expect(service2.testCharacteristic(Characteristic.Name)).toBe(true); - expect(service2.getCharacteristic(Characteristic.Name).value).toBe("test name"); - expect(service2.subtype).toBe("test sub type"); - }); - }); - describe("TransferTransportManagement", () => { it("should be able to construct", () => { const service0 = new Service.TransferTransportManagement(); @@ -1576,9 +1476,6 @@ describe("ServiceDefinitions", () => { expect(service2.testCharacteristic(Characteristic.Name)).toBe(true); expect(service2.getCharacteristic(Characteristic.Name).value).toBe("test name"); expect(service2.subtype).toBe("test sub type"); - // noinspection JSDeprecatedSymbols - - new Service.TunneledBTLEAccessoryService(); }); }); diff --git a/src/lib/definitions/ServiceDefinitions.ts b/src/lib/definitions/ServiceDefinitions.ts index fe3341e35..09897ea04 100644 --- a/src/lib/definitions/ServiceDefinitions.ts +++ b/src/lib/definitions/ServiceDefinitions.ts @@ -239,88 +239,8 @@ export class Battery extends Service { this.addOptionalCharacteristic(Characteristic.Name); } } -// noinspection JSDeprecatedSymbols -Service.BatteryService = Battery; Service.Battery = Battery; -/** - * Service "Bridge Configuration" - * @deprecated Removed and not used anymore - */ -export class BridgeConfiguration extends Service { - - public static readonly UUID: string = "000000A1-0000-1000-8000-0026BB765291"; - - constructor(displayName?: string, subtype?: string) { - super(displayName, BridgeConfiguration.UUID, subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.ConfigureBridgedAccessoryStatus); - this.addCharacteristic(Characteristic.DiscoverBridgedAccessories); - this.addCharacteristic(Characteristic.DiscoveredBridgedAccessories); - this.addCharacteristic(Characteristic.ConfigureBridgedAccessory); - - // Optional Characteristics - this.addOptionalCharacteristic(Characteristic.Name); - } -} -// noinspection JSDeprecatedSymbols -Service.BridgeConfiguration = BridgeConfiguration; - -/** - * Service "Bridging State" - * @deprecated Removed and not used anymore - */ -export class BridgingState extends Service { - - public static readonly UUID: string = "00000062-0000-1000-8000-0026BB765291"; - - constructor(displayName?: string, subtype?: string) { - super(displayName, BridgingState.UUID, subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.Reachable); - this.addCharacteristic(Characteristic.LinkQuality); - this.addCharacteristic(Characteristic.AccessoryIdentifier); - this.addCharacteristic(Characteristic.Category); - - // Optional Characteristics - this.addOptionalCharacteristic(Characteristic.Name); - } -} -// noinspection JSDeprecatedSymbols -Service.BridgingState = BridgingState; - -/** - * Service "Camera Control" - * @deprecated This service has no usage anymore and will be ignored by iOS - */ -export class CameraControl extends Service { - - public static readonly UUID: string = "00000111-0000-1000-8000-0026BB765291"; - - constructor(displayName?: string, subtype?: string) { - super(displayName, CameraControl.UUID, subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.On); - - // Optional Characteristics - this.addOptionalCharacteristic(Characteristic.CurrentHorizontalTiltAngle); - this.addOptionalCharacteristic(Characteristic.CurrentVerticalTiltAngle); - this.addOptionalCharacteristic(Characteristic.TargetHorizontalTiltAngle); - this.addOptionalCharacteristic(Characteristic.TargetVerticalTiltAngle); - this.addOptionalCharacteristic(Characteristic.NightVision); - this.addOptionalCharacteristic(Characteristic.OpticalZoom); - this.addOptionalCharacteristic(Characteristic.DigitalZoom); - this.addOptionalCharacteristic(Characteristic.ImageRotation); - this.addOptionalCharacteristic(Characteristic.ImageMirroring); - this.addOptionalCharacteristic(Characteristic.Name); - } -} -// noinspection JSDeprecatedSymbols -Service.CameraControl = CameraControl; - /** * Service "Camera Operating Mode" */ @@ -367,8 +287,6 @@ export class CameraRecordingManagement extends Service { this.addOptionalCharacteristic(Characteristic.RecordingAudioActive); } } -// noinspection JSDeprecatedSymbols -Service.CameraEventRecordingManagement = CameraRecordingManagement; Service.CameraRecordingManagement = CameraRecordingManagement; /** @@ -461,8 +379,6 @@ export class CloudRelay extends Service { this.addCharacteristic(Characteristic.RelayEnabled); } } -// noinspection JSDeprecatedSymbols -Service.Relay = CloudRelay; Service.CloudRelay = CloudRelay; /** @@ -1215,8 +1131,6 @@ export class Slats extends Service { this.addOptionalCharacteristic(Characteristic.TargetTiltAngle); } } -// noinspection JSDeprecatedSymbols -Service.Slat = Slats; Service.Slats = Slats; /** @@ -1538,29 +1452,6 @@ export class ThreadTransport extends Service { } Service.ThreadTransport = ThreadTransport; -/** - * Service "Time Information" - * @deprecated Removed and not used anymore - */ -export class TimeInformation extends Service { - - public static readonly UUID: string = "00000099-0000-1000-8000-0026BB765291"; - - constructor(displayName?: string, subtype?: string) { - super(displayName, TimeInformation.UUID, subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.CurrentTime); - this.addCharacteristic(Characteristic.DayoftheWeek); - this.addCharacteristic(Characteristic.TimeUpdate); - - // Optional Characteristics - this.addOptionalCharacteristic(Characteristic.Name); - } -} -// noinspection JSDeprecatedSymbols -Service.TimeInformation = TimeInformation; - /** * Service "Transfer Transport Management" */ @@ -1596,8 +1487,6 @@ export class Tunnel extends Service { this.addCharacteristic(Characteristic.TunneledAccessoryStateNumber); } } -// noinspection JSDeprecatedSymbols -Service.TunneledBTLEAccessoryService = Tunnel; Service.Tunnel = Tunnel; /** diff --git a/src/lib/util/checkName.spec.ts b/src/lib/util/checkName.spec.ts index 539762170..f4f9858a6 100644 --- a/src/lib/util/checkName.spec.ts +++ b/src/lib/util/checkName.spec.ts @@ -1,54 +1,51 @@ import { checkName } from "./checkName"; describe("#checkName()", () => { - let consoleLogSpy: jest.SpyInstance; + let consoleWarnSpy: jest.SpyInstance; beforeEach(() => { - consoleLogSpy = jest.spyOn(console, "warn"); + consoleWarnSpy = jest.spyOn(console, "warn").mockImplementation(() => {}); }); afterEach(() => { - consoleLogSpy.mockRestore(); + consoleWarnSpy.mockRestore(); }); test("Accessory Name ending with !", async () => { - checkName("displayName", "name", "bad name!"); + checkName("displayName", "Name", "bad name!"); - expect(consoleLogSpy).toBeCalledTimes(1); + expect(consoleWarnSpy).toBeCalledTimes(1); // eslint-disable-next-line max-len - expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'displayName' is getting published with the characteristic 'name' not following HomeKit naming rules ('bad name!'). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'displayName' has an invalid 'Name' characteristic ('bad name!'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness."); }); - test("Accessory Name begining with !", async () => { - checkName("displayName", "name", "!bad name"); + test("Accessory Name beginning with !", async () => { + checkName("displayName", "Name", "!bad name"); - expect(consoleLogSpy).toBeCalledTimes(1); + expect(consoleWarnSpy).toBeCalledTimes(1); // eslint-disable-next-line max-len - expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'displayName' is getting published with the characteristic 'name' not following HomeKit naming rules ('!bad name'). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'displayName' has an invalid 'Name' characteristic ('!bad name'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness."); }); test("Accessory Name containing !", async () => { - checkName("displayName", "name", "bad ! name"); + checkName("displayName", "Name", "bad ! name"); - expect(consoleLogSpy).toBeCalledTimes(1); + expect(consoleWarnSpy).toBeCalledTimes(1); // eslint-disable-next-line max-len - expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'displayName' is getting published with the characteristic 'name' not following HomeKit naming rules ('bad ! name'). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'displayName' has an invalid 'Name' characteristic ('bad ! name'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness."); }); - test("Accessory Name begining with '", async () => { - checkName("displayName", "name", "'bad name"); + test("Accessory Name beginning with '", async () => { + checkName("displayName", "Name", " 'bad name"); - expect(consoleLogSpy).toBeCalledTimes(1); + expect(consoleWarnSpy).toBeCalledTimes(1); // eslint-disable-next-line max-len - expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'displayName' is getting published with the characteristic 'name' not following HomeKit naming rules (''bad name'). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'displayName' has an invalid 'Name' characteristic (' 'bad name'). Please use only alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent the accessory from being added in the Home App or cause unresponsiveness."); }); test("Accessory Name containing '", async () => { - checkName("displayName", "name", "bad ' name"); + checkName("displayName", "Name", "good ' name"); - expect(consoleLogSpy).toBeCalledTimes(0); - // eslint-disable-next-line max-len - // expect(consoleLogSpy).toHaveBeenCalledWith("HAP-NodeJS WARNING: The accessory 'displayName' is getting published with the characteristic 'name' not following HomeKit naming rules ('bad name!'). Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + expect(consoleWarnSpy).toBeCalledTimes(0); }); - -}); \ No newline at end of file +}); diff --git a/src/lib/util/checkName.ts b/src/lib/util/checkName.ts index 78a6f75ae..626603269 100644 --- a/src/lib/util/checkName.ts +++ b/src/lib/util/checkName.ts @@ -1,19 +1,17 @@ +import { CharacteristicValue, Nullable } from "../../types"; + /** * Checks that supplied field meets Apple HomeKit naming rules * https://developer.apple.com/design/human-interface-guidelines/homekit#Help-people-choose-useful-names * @private Private API */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types -export function checkName(displayName: string, name: string, value: any): void { - const validHK = /^[a-zA-Z0-9\s'-.]+$/; // Ensure only letter, numbers, apostrophe, or dash - const startWith = /^[a-zA-Z0-9]/; // Ensure only letters or numbers are at the beginning of string - const endWith = /[a-zA-Z0-9]$/; // Ensure only letters or numbers are at the end of string +export function checkName(displayName: string, name: string, value: Nullable): void { - if (!validHK.test(value) || !startWith.test(value) || !endWith.test(value)) { - console.warn("HAP-NodeJS WARNING: The accessory '" + displayName + "' is getting published with the characteristic '" + - name + "'" + " not following HomeKit naming rules ('" + value + "'). " + - "Use only alphanumeric, space, and apostrophe characters, start and end with an alphabetic or numeric character, and don't include emojis. " + - "This might prevent the accessory from being added to the Home App or leading to the accessory being unresponsive!"); + // Ensure the string starts and ends with a Unicode letter or number and allow any combination of letters, numbers, spaces, and apostrophes in the middle. + if (typeof value === "string" && !(new RegExp(/^[\p{L}\p{N}][\p{L}\p{N} ']*[\p{L}\p{N}]$/u)).test(value)) { + console.warn("HAP-NodeJS WARNING: The accessory '" + displayName + "' has an invalid '" + name + "' characteristic ('" + value + "'). Please use only " + + "alphanumeric, space, and apostrophe characters. Ensure it starts and ends with an alphabetic or numeric character, and avoid emojis. This may prevent " + + "the accessory from being added in the Home App or cause unresponsiveness."); } -} \ No newline at end of file +} diff --git a/src/lib/util/eventedhttp.ts b/src/lib/util/eventedhttp.ts index b5eca5ed5..3117ce530 100644 --- a/src/lib/util/eventedhttp.ts +++ b/src/lib/util/eventedhttp.ts @@ -848,7 +848,7 @@ export class HAPConnection extends EventEmitter { const interfaces = os.networkInterfaces(); // Default to the first non-loopback interface we see. - const defaultInterface = () => Object.entries(interfaces).find(([name, addresses]) => addresses?.some(address => !address.internal))?.[0] ?? "unknown"; + const defaultInterface = () => Object.entries(interfaces).find(([, addresses]) => addresses?.some(address => !address.internal))?.[0] ?? "unknown"; // No local address return our default. if(!localAddress) { diff --git a/src/lib/util/tlv.spec.ts b/src/lib/util/tlv.spec.ts index ec85d627c..807bb126e 100644 --- a/src/lib/util/tlv.spec.ts +++ b/src/lib/util/tlv.spec.ts @@ -235,11 +235,6 @@ describe("tlv", () => { expect(() => writeVariableUIntLE(-1)) .toThrowError(); - // offset must be zero - // noinspection JSDeprecatedSymbols - expect(() => writeVariableUIntLE(1, 1)) - .toThrowError(); - const input8 = 128; const buffer8 = writeVariableUIntLE(input8); expect(buffer8.length).toBe(1); diff --git a/src/lib/util/tlv.ts b/src/lib/util/tlv.ts index 0a3ac0985..f13469069 100644 --- a/src/lib/util/tlv.ts +++ b/src/lib/util/tlv.ts @@ -162,8 +162,8 @@ export function decodeWithLists(buffer: Buffer): Record= 0, "Can't encode a negative integer as unsigned integer"); - assert(offset === 0, "Can't define a offset different than 0!"); if (number <= 255) { const buffer = Buffer.alloc(1); - buffer.writeUInt8(number, offset); + buffer.writeUInt8(number, 0); return buffer; } else if (number <= 65535) { return writeUInt16(number); @@ -387,7 +335,7 @@ export function writeVariableUIntLE(number: number, offset = 0): Buffer { return writeUInt32(number); } else { const buffer = Buffer.alloc(8); - hapCrypto.writeUInt64LE(number, buffer, offset); + hapCrypto.writeUInt64LE(number, buffer, 0); return buffer; } } diff --git a/src/lib/util/uuid.ts b/src/lib/util/uuid.ts index 4457915c5..c1603f006 100644 --- a/src/lib/util/uuid.ts +++ b/src/lib/util/uuid.ts @@ -30,15 +30,6 @@ export function isValid(UUID: string): boolean { } -/** - * Returns the identity of the passed argument. - * - * @param buf - The string argument which is returned - * @deprecated Most certainly the API you are using this function with changed from returning a Buffer to returning - * the actual uuid string. You can safely remove the call to unparse. Most certainly this call to unparse - * is located in you CameraSource which you converted from the old style CameraSource API to the new CameraControllers. - */ -export function unparse(buf: string): string /** * Parses the uuid as a string from the given Buffer. * The parser will use the first 8 bytes. @@ -53,21 +44,6 @@ export function unparse(buf: Buffer): string */ export function unparse(buf: Buffer, offset: number): string export function unparse(buf: Buffer | string, offset = 0): string { - if (typeof buf === "string" && isValid(buf)) { - /* - This check was added to fix backwards compatibility with the old style CameraSource API. - The old StreamController implementation would not unparse the HAP provided sessionId for the current streaming session. - This was changed when the new Controller API was introduced, which now turns the sessionId Buffer into a string - and passes it to the implementor of the Camera. - Old style CameraSource implementations would use this unparse function to turn the Buffer into a string. - As the sessionId is already a string we just return it here. - - The buf attribute being a also type of "string" as actually an error. Also I don't know who decided to - not unparse the sessionId. I'm only here to fix things. - */ - return buf; - } - let i = offset; return buf.toString("hex", i, (i += 4)) + "-" + diff --git a/src/types.ts b/src/types.ts index b5452ab1f..179a1cfd0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -82,40 +82,6 @@ export type PrimitiveTypes = string | number | boolean; */ export type CharacteristicValue = PrimitiveTypes | PrimitiveTypes[] | { [key: string]: PrimitiveTypes }; -/** - * @group Camera - * @deprecated replaced by {@link AudioStreamingCodec} - */ -export type AudioCodec = { - samplerate: number; - type: string; -} -/** - * @group Camera - * @deprecated replaced by {@link H264CodecParameters} - */ -export type VideoCodec = { - levels: number[]; - profiles: number[]; -} -/** - * @group Camera - * @deprecated replaced by {@link AudioStreamingOptions} - */ -export type StreamAudioParams = { - comfort_noise: boolean; - // noinspection JSDeprecatedSymbols - codecs: AudioCodec[]; -}; -/** - * @group Camera - * @deprecated replaced by {@link VideoStreamingOptions} - */ -export type StreamVideoParams = { - // noinspection JSDeprecatedSymbols - codec?: VideoCodec; - resolutions: [number, number, number][]; // width, height, framerate -}; /** * @group HAP Accessory Server @@ -262,9 +228,6 @@ export interface CharacteristicWrite { ev?: boolean, // enable/disable event notifications for the accessory authData?: string, // base64 encoded string used for custom authorisation - /** - * @deprecated This indicated if access was done via the old iCloud relay - */ remote?: boolean, // remote access used r?: boolean, // write response } diff --git a/tsconfig.json b/tsconfig.json index 6804145c6..e6efcbb73 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,24 +1,20 @@ { "compilerOptions": { - "target": "ES5", - "module": "commonjs", - "downlevelIteration": true, - "importHelpers": true, - "lib": [ - "es2015", - "es2016", - "es2017", - "es2018" - ], + "allowSyntheticDefaultImports": true, "declaration": true, "declarationMap": true, - "sourceMap": true, - "outDir": "./dist", - "rootDir": "./src", - "strict": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, + "importHelpers": true, + "lib": ["ES2022"], + "module": "CommonJS", + "moduleResolution": "node", "preserveConstEnums": true, // do not remove this option! + "outDir": "./dist", + "rootDir": "./src", + "sourceMap": true, + "strict": true, + "target": "ES2022", "useUnknownInCatchVariables": false }, "include": [ diff --git a/typedoc.json b/typedoc.json index 55fc721f5..91a8f8d38 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,6 +1,5 @@ { "out": "docs", - "includes": "src", "exclude": [ "src/**/*.spec.ts", "src/test-utils/*" @@ -23,5 +22,6 @@ "validation": { "invalidLink": true, "notExported": false - } + }, + "blockTags": ["@deprecated", "@example", "@group", "@param", "@returns", "@since"] }