Skip to content

Commit

Permalink
Better typing
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Feb 10, 2025
1 parent 944320e commit c85bb1c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 34 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ It is suggested to use [socket class](https://github.com/ioBroker/socket-client)
-->

## Changelog
### 3.0.1 (2025-02-09)
### **WORK IN PROGRESS**
* (@GermanBluefox) Adapter was rewritten in TypeScript

### 2.7.0 (2024-11-17)
Expand Down
13 changes: 0 additions & 13 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@
"zh-cn": "该适配器允许与ioBroker通信不同的Web应用程序"
},
"news": {
"3.0.1": {
"en": "Adapter was rewritten in TypeScript",
"de": "Adapter wurde in TypeScript neu geschrieben",
"ru": "Адаптер был переписан в TypeScript",
"pt": "Adapter foi reescrito no TypeScript",
"nl": "Adapter is herschreven in TypeScript",
"fr": "Adaptateur a été réécrit dans TypeScript",
"it": "L'adattatore è stato riscritto in TypeScript",
"es": "Adaptador fue reescrito en TipoScript",
"pl": "Adapter został przepisany w TypeScript",
"uk": "Адаптер був записаний у TypeScript",
"zh-cn": "适配器在类型脚本中重写"
},
"2.7.0": {
"en": "Update ws-server library",
"de": "Ws-Server-Bibliothek aktualisieren",
Expand Down
4 changes: 1 addition & 3 deletions src/lib/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {

type Server = HttpServer | HttpsServer;

class Socket {
export class Socket {
public ioServer: SocketWS | null;
constructor(
server: Server,
Expand Down Expand Up @@ -71,5 +71,3 @@ class Socket {
}
}
}

module.exports = Socket;
20 changes: 3 additions & 17 deletions src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { SocketWS } from './lib/socketWS';
import type { Socket as IOSocketClass } from './lib/socket';

export interface WsAdapterConfig {
port: number | string;
Expand All @@ -16,20 +17,5 @@ export interface WsAdapterConfig {
leCheckPort: number | string;
}

export declare class IOSocketClass {
public ioServer: SocketWS | null;

constructor(server: Server, settings: SocketSettings, adapter: ioBroker.Adapter, store: Store);

getWhiteListIpForAddress(
remoteIp: string,
whiteListSettings: {
[address: string]: WhiteListSettings;
},
): string | null;
publishAll(type: SocketSubscribeTypes, id: string, obj: ioBroker.Object | ioBroker.State | null | undefined): void;
publishFileAll(id: string, fileName: string, size: number | null): void;
publishInstanceMessageAll(sourceInstance: string, messageType: string, sid: string, data: any): void;
sendLog(obj: ioBroker.LogMessage): void;
close(): void;
}
export type { SocketWS };
export type { IOSocketClass };

0 comments on commit c85bb1c

Please sign in to comment.