Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Nov 3, 2024
1 parent e8491aa commit 94119d4
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 40 deletions.
7 changes: 6 additions & 1 deletion src/connector/pusher-connector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { Connector } from './connector';
import { PusherChannel, PusherPrivateChannel, PusherEncryptedPrivateChannel, PusherPresenceChannel } from './../channel';
import {
PusherChannel,
PusherPrivateChannel,
PusherEncryptedPrivateChannel,
PusherPresenceChannel,
} from './../channel';

type AnyPusherChannel = PusherChannel | PusherPrivateChannel | PusherEncryptedPrivateChannel | PusherPresenceChannel;

Expand Down
93 changes: 54 additions & 39 deletions src/echo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
import { Channel, NullChannel, NullEncryptedPrivateChannel, NullPresenceChannel, NullPrivateChannel, PresenceChannel, PusherChannel, PusherEncryptedPrivateChannel, PusherPresenceChannel, PusherPrivateChannel, SocketIoChannel, SocketIoPresenceChannel, SocketIoPrivateChannel } from './channel';
import {
Channel,
NullChannel,
NullEncryptedPrivateChannel,
NullPresenceChannel,
NullPrivateChannel,
PresenceChannel,
PusherChannel,
PusherEncryptedPrivateChannel,
PusherPresenceChannel,
PusherPrivateChannel,
SocketIoChannel,
SocketIoPresenceChannel,
SocketIoPrivateChannel,
} from './channel';
import { Connector, PusherConnector, SocketIoConnector, NullConnector } from './connector';

/**
Expand Down Expand Up @@ -112,7 +126,9 @@ export default class Echo<T extends keyof Broadcaster> {
encryptedPrivate(channel: string): Broadcaster[T]['encrypted'] {
if ((this.connector as any) instanceof SocketIoConnector) {
throw new Error(
`Broadcaster ${typeof this.options.broadcaster} ${this.options.broadcaster} does not support encrypted private channels.`
`Broadcaster ${typeof this.options.broadcaster} ${
this.options.broadcaster
} does not support encrypted private channels.`
);
}

Expand Down Expand Up @@ -208,49 +224,48 @@ export { EventFormatter } from './util';
* Specifies the broadcaster
*/
type Broadcaster = {
'reverb': {
connector: PusherConnector,
public: PusherChannel,
private: PusherPrivateChannel,
encrypted: PusherEncryptedPrivateChannel,
presence: PusherPresenceChannel,
},
'pusher': {
connector: PusherConnector,
public: PusherChannel,
private: PusherPrivateChannel,
encrypted: PusherEncryptedPrivateChannel,
presence: PusherPresenceChannel,
},
reverb: {
connector: PusherConnector;
public: PusherChannel;
private: PusherPrivateChannel;
encrypted: PusherEncryptedPrivateChannel;
presence: PusherPresenceChannel;
};
pusher: {
connector: PusherConnector;
public: PusherChannel;
private: PusherPrivateChannel;
encrypted: PusherEncryptedPrivateChannel;
presence: PusherPresenceChannel;
};
'socket.io': {
connector: SocketIoConnector,
public: SocketIoChannel,
private: SocketIoPrivateChannel,
encrypted: never,
presence: SocketIoPresenceChannel,
},
'null': {
connector: NullConnector,
public: NullChannel,
private: NullPrivateChannel,
encrypted: NullEncryptedPrivateChannel,
presence: NullPresenceChannel,
},
'function': {
connector: any,
public: any,
private: any,
encrypted: any,
presence: any,
}
connector: SocketIoConnector;
public: SocketIoChannel;
private: SocketIoPrivateChannel;
encrypted: never;
presence: SocketIoPresenceChannel;
};
null: {
connector: NullConnector;
public: NullChannel;
private: NullPrivateChannel;
encrypted: NullEncryptedPrivateChannel;
presence: NullPresenceChannel;
};
function: {
connector: any;
public: any;
private: any;
encrypted: any;
presence: any;
};
};

type EchoOptions<T extends keyof Broadcaster> = {

/**
* The broadcast connector.
*/
broadcaster: T extends 'function' ? ((options: EchoOptions<T>) => any) : T,
broadcaster: T extends 'function' ? (options: EchoOptions<T>) => any : T;

[key: string]: any,
[key: string]: any;
};

0 comments on commit 94119d4

Please sign in to comment.