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 c85bb1c commit a48ae7f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
19 changes: 19 additions & 0 deletions dist/lib/socket.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
import type { Server as HttpServer } from 'node:http';
import type { Server as HttpsServer } from 'node:https';
import { SocketWS } from './socketWS';
import { type Store, type WhiteListSettings, type SocketSubscribeTypes, type SocketSettings } from '@iobroker/socket-classes';
type Server = HttpServer | HttpsServer;
export declare class Socket {
ioServer: SocketWS | null;
constructor(server: Server, settings: SocketSettings, adapter: ioBroker.Adapter, store: Store, checkUser?: (user: string, pass: string, cb: (error: Error | null, result?: {
logged_in: boolean;
}) => void) => void);
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 {};
3 changes: 2 additions & 1 deletion dist/lib/socket.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/lib/socket.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 3 additions & 17 deletions dist/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 };
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"@iobroker/adapter-core": "^3.2.3",
"@iobroker/socket-classes": "^2.0.7",
"@iobroker/socket-classes": "^2.0.8",
"@iobroker/webserver": "^1.0.8",
"@iobroker/ws-server": "^4.2.4",
"express-session": "^1.18.1"
Expand Down

0 comments on commit a48ae7f

Please sign in to comment.