Skip to content

Commit

Permalink
Merge pull request #118 from MiSchroe/feature/Fix-dependencies
Browse files Browse the repository at this point in the history
Upgrade dependencies
  • Loading branch information
MiSchroe authored Oct 18, 2023
2 parents 57a10ef + 0f7ab48 commit 240d589
Show file tree
Hide file tree
Showing 9 changed files with 3,153 additions and 9,641 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ The following devices are defined:
- (Michael Schroeder) [#12](https://github.com/MiSchroe/ioBroker.klf200/issues/12) Support silent mode in scenes
- (Michael Schroeder) [#44](https://github.com/MiSchroe/ioBroker.klf200/issues/44) Add advanced SSL configuration settings
- (Michael Schroeder) [#98](https://github.com/MiSchroe/ioBroker.klf200/issues/98) Fix default values
- (Michael Schroeder) Upgrade dependencies

### 1.0.1 (2020-07-20)

Expand Down
12,608 changes: 3,048 additions & 9,560 deletions package-lock.json

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,45 +17,45 @@
"url": "https://github.com/MiSchroe/ioBroker.klf200"
},
"dependencies": {
"@iobroker/adapter-core": "^2.6.2",
"klf-200-api": "^3.1.2",
"@iobroker/adapter-core": "^3.0.4",
"klf-200-api": "^3.1.3",
"promise-timeout": "^1.3.0"
},
"devDependencies": {
"@alcalzone/release-script": "^3.5.6",
"@alcalzone/release-script-plugin-iobroker": "^3.5.6",
"@alcalzone/release-script": "^3.6.0",
"@alcalzone/release-script-plugin-iobroker": "^3.6.0",
"@iobroker/adapter-dev": "^1.2.0",
"@iobroker/testing": "^2.5.6",
"@types/chai": "^4.3.0",
"@types/chai-as-promised": "^7.1.5",
"@types/gulp": "^4.0.9",
"@types/mocha": "^9.1.0",
"@types/node": "^17.0.21",
"@types/node-schedule": "^1.3.2",
"@types/proxyquire": "^1.3.28",
"@types/sinon": "^10.0.11",
"@types/sinon-chai": "^3.2.8",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"axios": "^0.26.0",
"chai": "^4.3.6",
"@iobroker/testing": "^4.1.0",
"@types/chai": "^4.3.9",
"@types/chai-as-promised": "^7.1.7",
"@types/gulp": "^4.0.16",
"@types/mocha": "^10.0.3",
"@types/node": "^20.8.7",
"@types/node-schedule": "^2.1.2",
"@types/proxyquire": "^1.3.29",
"@types/sinon": "^10.0.19",
"@types/sinon-chai": "^3.2.10",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"axios": "^1.5.1",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"cross-conf-env": "^1.2.1",
"eslint": "^8.10.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"cross-conf-env": "^1.3.0",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"gulp": "^4.0.2",
"mocha": "^9.2.1",
"node-schedule": "^2.1.0",
"mocha": "^10.2.0",
"node-schedule": "^2.1.1",
"nyc": "^15.1.0",
"prettier": "^2.5.1",
"prettier": "^3.0.3",
"proxyquire": "^2.1.3",
"rimraf": "^3.0.2",
"sinon": "^13.0.1",
"rimraf": "^5.0.5",
"sinon": "^16.1.0",
"sinon-chai": "^3.7.0",
"source-map-support": "^0.5.21",
"ts-node": "^10.7.0",
"typescript": "^4.6.2"
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"main": "build/main.js",
"scripts": {
Expand Down
22 changes: 12 additions & 10 deletions src/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,12 @@ describe("Setup", function () {
let disposables: Disposable[] = [];
const setup = await Setup.setupGlobalAsync(adapter as unknown as ioBroker.Adapter, mockGateway);
try {
const objectList: ioBroker.NonNullCallbackReturnTypeOf<ioBroker.GetObjectListCallback> =
await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.gateway.`,
endkey: `${adapter.namespace}.gateway.\u9999`,
});
const objectList: ioBroker.NonNullCallbackReturnTypeOf<
ioBroker.GetObjectListCallback<ioBroker.Object>
> = await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.gateway.`,
endkey: `${adapter.namespace}.gateway.\u9999`,
});
const unmappedWritableStates = objectList.rows
.map((value) => {
// Find state in disposables (only for writable states)
Expand Down Expand Up @@ -287,11 +288,12 @@ describe("Setup", function () {
"test.0.gateway.GatewaySubState",
];
const complexStatesMapping: { [prop: string]: string } = {};
const objectList: ioBroker.NonNullCallbackReturnTypeOf<ioBroker.GetObjectListCallback> =
await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.gateway.`,
endkey: `${adapter.namespace}.gateway.\u9999`,
});
const objectList: ioBroker.NonNullCallbackReturnTypeOf<
ioBroker.GetObjectListCallback<ioBroker.Object>
> = await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.gateway.`,
endkey: `${adapter.namespace}.gateway.\u9999`,
});
const unmappedWritableStates = objectList.rows
.map((value) => {
// Find state in disposables (only for writable states)
Expand Down
26 changes: 14 additions & 12 deletions src/setupGroups.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { MockAdapter, utils } from "@iobroker/testing";
import { expect, use } from "chai";
import {
Group,
GroupType,
GW_GET_ALL_NODES_INFORMATION_NTF,
GW_GET_GROUP_INFORMATION_NTF,
Group,
GroupType,
IConnection,
NodeVariation,
Product,
Expand Down Expand Up @@ -363,11 +363,12 @@ describe("setupGroups", function () {
mockProducts,
);
try {
const objectList: ioBroker.NonNullCallbackReturnTypeOf<ioBroker.GetObjectListCallback> =
await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.groups.${mockGroup.GroupID}.`,
endkey: `${adapter.namespace}.groups.${mockGroup.GroupID}.\u9999`,
});
const objectList: ioBroker.NonNullCallbackReturnTypeOf<
ioBroker.GetObjectListCallback<ioBroker.Object>
> = await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.groups.${mockGroup.GroupID}.`,
endkey: `${adapter.namespace}.groups.${mockGroup.GroupID}.\u9999`,
});
const unmappedWritableStates = objectList.rows
.map((value) => {
// Find state in disposables (only for writable states)
Expand Down Expand Up @@ -418,11 +419,12 @@ describe("setupGroups", function () {
const complexStatesMapping: { [prop: string]: string[] } = {
Nodes: ["test.0.groups.50.productsCount"],
};
const objectList: ioBroker.NonNullCallbackReturnTypeOf<ioBroker.GetObjectListCallback> =
await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.groups.${mockGroup.GroupID}.`,
endkey: `${adapter.namespace}.groups.${mockGroup.GroupID}.\u9999`,
});
const objectList: ioBroker.NonNullCallbackReturnTypeOf<
ioBroker.GetObjectListCallback<ioBroker.Object>
> = await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.groups.${mockGroup.GroupID}.`,
endkey: `${adapter.namespace}.groups.${mockGroup.GroupID}.\u9999`,
});
const unmappedWritableStates = objectList.rows
.map((value) => {
// Find state in disposables (only for writable states)
Expand Down
22 changes: 12 additions & 10 deletions src/setupProducts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,12 @@ describe("setupProducts", function () {
let disposables: Disposable[] = [];
disposables = await SetupProducts.createProductAsync(adapter as unknown as ioBroker.Adapter, mockProduct);
try {
const objectList: ioBroker.NonNullCallbackReturnTypeOf<ioBroker.GetObjectListCallback> =
await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.products.${mockProduct.NodeID}.`,
endkey: `${adapter.namespace}.products.${mockProduct.NodeID}.\u9999`,
});
const objectList: ioBroker.NonNullCallbackReturnTypeOf<
ioBroker.GetObjectListCallback<ioBroker.Object>
> = await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.products.${mockProduct.NodeID}.`,
endkey: `${adapter.namespace}.products.${mockProduct.NodeID}.\u9999`,
});
const unmappedWritableStates = objectList.rows
.map((value) => {
// Find state in disposables (only for writable states)
Expand Down Expand Up @@ -490,11 +491,12 @@ describe("setupProducts", function () {
"test.0.products.0.typeID",
"test.0.products.0.velocity",
];
const objectList: ioBroker.NonNullCallbackReturnTypeOf<ioBroker.GetObjectListCallback> =
await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.products.${mockProduct.NodeID}.`,
endkey: `${adapter.namespace}.products.${mockProduct.NodeID}.\u9999`,
});
const objectList: ioBroker.NonNullCallbackReturnTypeOf<
ioBroker.GetObjectListCallback<ioBroker.Object>
> = await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.products.${mockProduct.NodeID}.`,
endkey: `${adapter.namespace}.products.${mockProduct.NodeID}.\u9999`,
});
const unmappedWritableStates = objectList.rows
.map((value) => {
// Find state in disposables (only for writable states)
Expand Down
22 changes: 12 additions & 10 deletions src/setupScenes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,12 @@ describe("setupScenes", function () {
let disposables: Disposable[] = [];
disposables = await SetupScenes.createSceneAsync(adapter as unknown as ioBroker.Adapter, mockScene);
try {
const objectList: ioBroker.NonNullCallbackReturnTypeOf<ioBroker.GetObjectListCallback> =
await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.scenes.${mockScene.SceneID}.`,
endkey: `${adapter.namespace}.scenes.${mockScene.SceneID}.\u9999`,
});
const objectList: ioBroker.NonNullCallbackReturnTypeOf<
ioBroker.GetObjectListCallback<ioBroker.Object>
> = await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.scenes.${mockScene.SceneID}.`,
endkey: `${adapter.namespace}.scenes.${mockScene.SceneID}.\u9999`,
});
const unmappedWritableStates = objectList.rows
.map((value) => {
// Find state in disposables (only for writable states)
Expand Down Expand Up @@ -382,11 +383,12 @@ describe("setupScenes", function () {
Products: ["test.0.scenes.0.productsCount", "test.0.scenes.0.products"],
IsRunning: ["test.0.scenes.0.run"],
};
const objectList: ioBroker.NonNullCallbackReturnTypeOf<ioBroker.GetObjectListCallback> =
await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.scenes.${mockScene.SceneID}.`,
endkey: `${adapter.namespace}.scenes.${mockScene.SceneID}.\u9999`,
});
const objectList: ioBroker.NonNullCallbackReturnTypeOf<
ioBroker.GetObjectListCallback<ioBroker.Object>
> = await adapter.getObjectListAsync({
startKey: `${adapter.namespace}.scenes.${mockScene.SceneID}.`,
endkey: `${adapter.namespace}.scenes.${mockScene.SceneID}.\u9999`,
});
const unmappedWritableStates = objectList.rows
.map((value) => {
// Find state in disposables (only for writable states)
Expand Down
32 changes: 24 additions & 8 deletions src/util/propertyLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export abstract class BasePropertyChangedHandler<T extends Component>
{
protected disposable?: Disposable;

constructor(readonly Adapter: ioBroker.Adapter, readonly Property: keyof T, readonly LinkedObject: T) {
constructor(
readonly Adapter: ioBroker.Adapter,
readonly Property: keyof T,
readonly LinkedObject: T,
) {
this.disposable = LinkedObject.propertyChangedEvent.on(async (event: PropertyChangedEvent) => {
if (event.propertyName === this.Property) {
return await this.onPropertyChangedTypedEvent(event.propertyValue as T[keyof T]);
Expand Down Expand Up @@ -85,7 +89,12 @@ export class ComplexPropertyChangedHandler<T extends Component> extends BaseProp
}

export class SimplePropertyChangedHandler<T extends Component> extends BasePropertyChangedHandler<T> {
constructor(Adapter: ioBroker.Adapter, readonly StateId: string, Property: keyof T, LinkedObject: T) {
constructor(
Adapter: ioBroker.Adapter,
readonly StateId: string,
Property: keyof T,
LinkedObject: T,
) {
super(Adapter, Property, LinkedObject);
}

Expand All @@ -111,7 +120,10 @@ export class PercentagePropertyChangedHandler<T extends Component> extends Simpl
export const klfPromiseQueue = new PromiseQueue();

export abstract class BaseStateChangeHandler implements StateChangedEventHandler, Disposable {
constructor(readonly Adapter: ioBroker.Adapter, readonly StateId: string) {
constructor(
readonly Adapter: ioBroker.Adapter,
readonly StateId: string,
) {
/// The default number of listeners may not be high enough -> raise it to suppress warnings
const adapterEmitter = this.Adapter as unknown as EventEmitter;
const newMaxSize = adapterEmitter.getMaxListeners() + 1;
Expand Down Expand Up @@ -173,7 +185,7 @@ export class SetterStateChangeHandler<T extends Component> extends BaseStateChan

this.Adapter.log.debug(
`Create a setter state change handler to listen to state ${this.StateId} linked to property ${
this.SetterMethodName
String(this.SetterMethodName)
// eslint-disable-next-line @typescript-eslint/ban-types
} on type ${(this.LinkedObject as Object).constructor.name}.`,
);
Expand All @@ -182,7 +194,7 @@ export class SetterStateChangeHandler<T extends Component> extends BaseStateChan
if (typeof LinkedObject[this.SetterMethodName!] === "function") {
this.setterFunction = LinkedObject[this.SetterMethodName!] as unknown as Function;
} else {
throw new Error(`${this.SetterMethodName!} is not a function.`);
throw new Error(`${String(this.SetterMethodName)!} is not a function.`);
}
}

Expand Down Expand Up @@ -211,11 +223,11 @@ export class SimpleStateChangeHandler<T extends Component> extends SetterStateCh
LinkedObject: T,
SetterMethodName?: keyof T,
) {
super(Adapter, StateId, LinkedObject, SetterMethodName ?? (`set${Property}Async` as keyof T));
super(Adapter, StateId, LinkedObject, SetterMethodName ?? (`set${String(Property)}Async` as keyof T));

this.Adapter.log.debug(
`Create a simple state change handler to listen to state ${this.StateId} linked to property ${
this.Property
String(this.Property)
// eslint-disable-next-line @typescript-eslint/ban-types
} on type ${(this.LinkedObject as Object).constructor.name}.`,
);
Expand All @@ -237,7 +249,11 @@ export class PercentageStateChangeHandler<T extends Component> extends SetterSta
export type OnStateChangedHandlerFunctionType = (state: ioBroker.State | null | undefined) => Promise<void>;

export class ComplexStateChangeHandler<T extends Component> extends BaseStateChangeHandler {
constructor(Adapter: ioBroker.Adapter, StateId: string, readonly Handler: OnStateChangedHandlerFunctionType) {
constructor(
Adapter: ioBroker.Adapter,
StateId: string,
readonly Handler: OnStateChangedHandlerFunctionType,
) {
super(Adapter, StateId);
}

Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
// Consider targetting es2017 or higher if you require the new NodeJS 8+ features
"target": "es2017",
"sourceMap": true,
"inlineSourceMap": false,
"watch": false
"inlineSourceMap": false
},
"include": ["**/*.ts", "test/mocha.setup.js", "test/unit.js"],
"exclude": ["build/**", "node_modules/**", "admin/**"]
Expand Down

0 comments on commit 240d589

Please sign in to comment.