Skip to content

Commit

Permalink
update the MessageAction fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
splindsay-92 committed Oct 9, 2024
1 parent d14268c commit 858aaad
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
12 changes: 6 additions & 6 deletions ably.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2457,27 +2457,27 @@ export enum MessageAction {
/**
* Message action has not been set.
*/
MessageUnset = 'message_unset',
MESSAGE_UNSET = 'MESSAGE_UNSET',
/**
* Message action for a newly created message.
*/
MessageCreate = 'message_create',
MESSAGE_CREATE = 'MESSAGE_CREATE',
/**
* Message action for an updated message.
*/
MessageUpdate = 'message_update',
MESSAGE_UPDATE = 'MESSAGE_UPDATE',
/**
* Message action for a deleted message.
*/
MessageDelete = 'message_delete',
MESSAGE_DELETE = 'MESSAGE_DELETE',
/**
* Message action for a newly created annotation.
*/
MessageAnnotationCreate = 'message_annotation_create',
ANNOTATION_CREATE = 'ANNOTATION_CREATE',
/**
* Message action for a deleted annotation.
*/
MessageAnnotationDelete = 'message_annotation_delete',
ANNOTATION_DELETE = 'ANNOTATION_DELETE',
}


Expand Down
25 changes: 12 additions & 13 deletions src/common/lib/types/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,43 @@ import * as API from '../../../../ably';
import { IUntypedCryptoStatic } from 'common/types/ICryptoStatic';
import { MsgPack } from 'common/types/msgpack';


/**
* Enum containing the different types of message actions.
*/
enum MessageAction {
/**
* Message action has not been set.
*/
MessageUnset = 'MESSAGE_UNSET',
MESSAGE_UNSET = 'MESSAGE_UNSET',
/**
* Message action for a newly created message.
*/
MessageCreate = 'MESSAGE_CREATE',
MESSAGE_CREATE = 'MESSAGE_CREATE',
/**
* Message action for an updated message.
*/
MessageUpdate = 'MESSAGE_UPDATE',
MESSAGE_UPDATE = 'MESSAGE_UPDATE',
/**
* Message action for a deleted message.
*/
MessageDelete = 'MESSAGE_DELETE',
MESSAGE_DELETE = 'MESSAGE_DELETE',
/**
* Message action for a newly created annotation.
*/
AnnotationCreate = 'ANNOTATION_CREATE',
ANNOTATION_CREATE = 'ANNOTATION_CREATE',
/**
* Message action for a deleted annotation.
*/
AnnotationDelete = 'ANNOTATION_DELETE',
ANNOTATION_DELETE = 'ANNOTATION_DELETE',
}

const MessageActionNumberMap: Record<number, MessageAction> = {
0: MessageAction.MessageUnset,
1: MessageAction.MessageCreate,
2: MessageAction.MessageUpdate,
3: MessageAction.MessageDelete,
4: MessageAction.AnnotationCreate,
5: MessageAction.AnnotationDelete,
0: MessageAction.MESSAGE_UNSET,
1: MessageAction.MESSAGE_CREATE,
2: MessageAction.MESSAGE_UPDATE,
3: MessageAction.MESSAGE_DELETE,
4: MessageAction.ANNOTATION_CREATE,
5: MessageAction.ANNOTATION_DELETE,
};

function getMessageAction(actionNumber: number): MessageAction {
Expand Down

0 comments on commit 858aaad

Please sign in to comment.