Skip to content

Commit

Permalink
Updated dependencies (typescript)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed May 19, 2024
1 parent 110a692 commit cf05da9
Show file tree
Hide file tree
Showing 18 changed files with 274 additions and 244 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to `hap-nodejs` will be documented in this file. This projec

- Updated dependencies (`rimraf` and `@types/node`)
- Updated dependencies (`simple-plist`)
- Updated dependencies (`typescript`)

## v0.12.1 (2024-05-11)

Expand Down
444 changes: 218 additions & 226 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
"@types/jest": "^29.5.12",
"@types/node": "^20.12.12",
"@types/plist": "^3.0.5",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"axios": "^1.6.8",
"commander": "^12.1.0",
"escape-html": "^1.0.3",
Expand All @@ -83,6 +83,6 @@
"ts-jest": "^29.1.2",
"ts-node": "^10.9.2",
"typedoc": "^0.25.13",
"typescript": "^4.9.5"
"typescript": "^5.4.5"
}
}
2 changes: 2 additions & 0 deletions src/internal-types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-duplicate-enum-values */

import { CharacteristicValue, Nullable } from "./types";

/**
Expand Down
16 changes: 12 additions & 4 deletions src/lib/Accessory.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-duplicate-enum-values, @typescript-eslint/no-unsafe-declaration-merging */

import assert from "assert";
import { MulticastOptions } from "bonjour-hap";
import crypto from "crypto";
Expand Down Expand Up @@ -623,8 +625,11 @@ export class Accessory extends EventEmitter {
for (const service of this.services) {
if (typeof name === "string" && (service.displayName === name || service.name === name || service.subtype === name)) {
return service;
} else if (typeof name === "function" && ((service instanceof name) || (name.UUID === service.UUID))) {
return service;
} else {
// @ts-expect-error ('UUID' does not exist on type 'never')
if (typeof name === "function" && ((service instanceof name) || (name.UUID === service.UUID))) {
return service;
}
}
}

Expand All @@ -635,8 +640,11 @@ export class Accessory extends EventEmitter {
for (const service of this.services) {
if (typeof uuid === "string" && (service.displayName === uuid || service.name === uuid) && service.subtype === subType) {
return service;
} else if (typeof uuid === "function" && ((service instanceof uuid) || (uuid.UUID === service.UUID)) && service.subtype === subType) {
return service;
} else {
// @ts-expect-error ('UUID' does not exist on type 'never')
if (typeof uuid === "function" && ((service instanceof uuid) || (uuid.UUID === service.UUID)) && service.subtype === subType) {
return service;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/Characteristic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,7 @@ describe("Characteristic", () => {
mock.mockReset();
characteristic.removeAllListeners("get");
characteristic.on("get", (callback) => {
callback(234234234234);
callback(234234234234 as HAPStatus);
});
await expect(characteristic.handleGetRequest()).rejects.toEqual(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
expect(characteristic.statusCode).toEqual(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
Expand Down Expand Up @@ -1878,7 +1878,7 @@ describe("Characteristic", () => {
mock.mockReset();
characteristic.removeAllListeners("set");
characteristic.on("set", (value, callback) => {
callback(234234234234);
callback(234234234234 as HAPStatus);
});
await expect(characteristic.handleSetRequest("hello")).rejects.toEqual(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
expect(characteristic.statusCode).toEqual(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
Expand Down
2 changes: 2 additions & 0 deletions src/lib/Characteristic.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-duplicate-enum-values, @typescript-eslint/no-unsafe-declaration-merging */

import assert from "assert";
import createDebug from "debug";
import { EventEmitter } from "events";
Expand Down
8 changes: 4 additions & 4 deletions src/lib/HAPServer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,10 @@ describe(IsKnownHAPStatusError, () => {
});

it("should reject non defined error codes", () => {
expect(IsKnownHAPStatusError(23)).toBe(false);
expect(IsKnownHAPStatusError(-3)).toBe(false);
expect(IsKnownHAPStatusError(-72037)).toBe(false);
expect(IsKnownHAPStatusError(HAPStatus.SUCCESS)).toBe(false);
expect(IsKnownHAPStatusError(23 as HAPStatus)).toBe(false);
expect(IsKnownHAPStatusError(-3 as HAPStatus)).toBe(false);
expect(IsKnownHAPStatusError(-72037 as HAPStatus)).toBe(false);
expect(IsKnownHAPStatusError(HAPStatus.SUCCESS as HAPStatus)).toBe(false);
});

it("should reject invalid user input", () => {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/HAPServer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-duplicate-enum-values, @typescript-eslint/no-unsafe-declaration-merging */

import crypto from "crypto";
import createDebug from "debug";
import { EventEmitter } from "events";
Expand Down
17 changes: 13 additions & 4 deletions src/lib/Service.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */

import assert from "assert";
import createDebug from "debug";
import { EventEmitter } from "events";
Expand Down Expand Up @@ -677,12 +679,16 @@ export class Service extends EventEmitter {
for (const characteristic of this.characteristics) {
if (typeof name === "string" && characteristic.displayName === name) {
return characteristic;
} else if (typeof name === "function" && ((characteristic instanceof name) || (name.UUID === characteristic.UUID))) {
return characteristic;
} else {
// @ts-expect-error ('UUID' does not exist on type 'never')
if (typeof name === "function" && ((characteristic instanceof name) || (name.UUID === characteristic.UUID))) {
return characteristic;
}
}
}
if (typeof name === "function") {
for (const characteristic of this.optionalCharacteristics) {
// @ts-expect-error ('UUID' does not exist on type 'never')
if ((characteristic instanceof name) || (name.UUID === characteristic.UUID)) {
return this.addCharacteristic(name);
}
Expand All @@ -704,8 +710,11 @@ export class Service extends EventEmitter {
for (const characteristic of this.characteristics) {
if (typeof name === "string" && characteristic.displayName === name) {
return true;
} else if (typeof name === "function" && ((characteristic instanceof name) || (name.UUID === characteristic.UUID))) {
return true;
} else {
// @ts-expect-error ('UUID' does not exist on type 'never')
if (typeof name === "function" && ((characteristic instanceof name) || (name.UUID === characteristic.UUID))) {
return true;
}
}
}
return false;
Expand Down
2 changes: 2 additions & 0 deletions src/lib/camera/RecordingManagement.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */

import crypto from "crypto";
import createDebug from "debug";
import { EventEmitter } from "events";
Expand Down
2 changes: 2 additions & 0 deletions src/lib/controller/AdaptiveLightingController.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */

import assert from "assert";
import { HAPStatus } from "../HAPServer";
import { ColorUtils } from "../util/color-utils";
Expand Down
2 changes: 2 additions & 0 deletions src/lib/controller/CameraController.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */

import crypto from "crypto";
import createDebug from "debug";
import { EventEmitter } from "events";
Expand Down
2 changes: 2 additions & 0 deletions src/lib/controller/RemoteController.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */

import assert from "assert";
import createDebug from "debug";
import { EventEmitter } from "events";
Expand Down
2 changes: 2 additions & 0 deletions src/lib/datastream/DataStreamServer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */

import assert from "assert";
import crypto from "crypto";
import createDebug from "debug";
Expand Down
2 changes: 2 additions & 0 deletions src/lib/tv/AccessControlManagement.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */

import { EventEmitter } from "events";
import { Characteristic } from "../Characteristic";
import type { AccessControl } from "../definitions";
Expand Down
2 changes: 2 additions & 0 deletions src/lib/util/eventedhttp.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */

import { getNetAddress } from "@homebridge/ciao/lib/util/domain-formatter";
import assert from "assert";
import createDebug from "debug";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/util/hapStatusError.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("HapStatusError", () => {
});

it("reverts to SERVICE_COMMUNICATION_FAILURE if an invalid code is passed in", async () => {
const error = new HapStatusError(234523323423423);
const error = new HapStatusError(234523323423423 as HAPStatus);
expect(error.hapStatus).toEqual(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
});
});

0 comments on commit cf05da9

Please sign in to comment.