Skip to content

Commit

Permalink
fix: added transport.changed event to event map (#892)
Browse files Browse the repository at this point in the history
* fix: added transport.changed event to event map

* refactor: unifying event map and event types

* refactor: moving transport.changed event to set of local events
  • Loading branch information
vishalnarkhede authored Feb 2, 2022
1 parent 27fccbe commit 48013cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 44 deletions.
1 change: 1 addition & 0 deletions src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const EVENT_MAP = {
// local events
'connection.changed': true,
'connection.recovered': true,
'transport.changed': true,
};

const IS_VALID_EVENT_MAP_TYPE = { ...EVENT_MAP, all: true };
Expand Down
46 changes: 2 additions & 44 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AxiosRequestConfig } from 'axios';
import { EVENT_MAP } from './events';
import { Role } from './permissions';

/**
Expand Down Expand Up @@ -1052,50 +1053,7 @@ export type EventHandler<
UserType extends UR = UR
> = (event: Event<AttachmentType, ChannelType, CommandType, EventType, MessageType, ReactionType, UserType>) => void;

export type EventTypes =
| 'all'
| 'channel.created'
| 'channel.deleted'
| 'channel.hidden'
| 'channel.muted'
| 'channel.truncated'
| 'channel.unmuted'
| 'channel.updated'
| 'channel.visible'
| 'transport.changed' // ws vs longpoll
| 'connection.changed'
| 'connection.recovered'
| 'health.check'
| 'member.added'
| 'member.removed'
| 'member.updated'
| 'message.deleted'
| 'message.new'
| 'message.read'
| 'message.updated'
| 'notification.added_to_channel'
| 'notification.channel_deleted'
| 'notification.channel_mutes_updated'
| 'notification.channel_truncated'
| 'notification.invite_accepted'
| 'notification.invite_rejected'
| 'notification.invited'
| 'notification.mark_read'
| 'notification.message_new'
| 'notification.mutes_updated'
| 'notification.removed_from_channel'
| 'reaction.deleted'
| 'reaction.new'
| 'reaction.updated'
| 'typing.start'
| 'typing.stop'
| 'user.banned'
| 'user.deleted'
| 'user.presence.changed'
| 'user.unbanned'
| 'user.updated'
| 'user.watching.start'
| 'user.watching.stop';
export type EventTypes = 'all' | keyof typeof EVENT_MAP;

/**
* Filter Types
Expand Down

0 comments on commit 48013cd

Please sign in to comment.