-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1923 from ably/mutable-message-field-changes
Mutable message field changes and Message/PresenceMessage.fromValues refactoring
- Loading branch information
Showing
20 changed files
with
308 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,35 @@ | ||
import * as API from '../../../../ably'; | ||
import Logger from '../util/logger'; | ||
import PresenceMessage, { fromEncoded, fromEncodedArray, fromValues } from './presencemessage'; | ||
import PresenceMessage, { | ||
fromEncoded, | ||
fromEncodedArray, | ||
fromValues, | ||
WireProtocolPresenceMessage, | ||
} from './presencemessage'; | ||
import Platform from 'common/platform'; | ||
import type { Properties } from '../util/utils'; | ||
|
||
/** | ||
`DefaultPresenceMessage` is the class returned by `DefaultRest` and `DefaultRealtime`’s `PresenceMessage` static property. It introduces the static methods described in the `PresenceMessageStatic` interface of the public API of the non tree-shakable version of the library. | ||
*/ | ||
export class DefaultPresenceMessage extends PresenceMessage { | ||
static async fromEncoded(encoded: unknown, inputOptions?: API.ChannelOptions): Promise<PresenceMessage> { | ||
return fromEncoded(Logger.defaultLogger, encoded, inputOptions); | ||
return fromEncoded(Logger.defaultLogger, Platform.Crypto, encoded as WireProtocolPresenceMessage, inputOptions); | ||
} | ||
|
||
static async fromEncodedArray( | ||
encodedArray: Array<unknown>, | ||
options?: API.ChannelOptions, | ||
): Promise<PresenceMessage[]> { | ||
return fromEncodedArray(Logger.defaultLogger, encodedArray, options); | ||
return fromEncodedArray( | ||
Logger.defaultLogger, | ||
Platform.Crypto, | ||
encodedArray as WireProtocolPresenceMessage[], | ||
options, | ||
); | ||
} | ||
|
||
static fromValues(values: PresenceMessage | Record<string, unknown>, stringifyAction?: boolean): PresenceMessage { | ||
return fromValues(values, stringifyAction); | ||
static fromValues(values: Properties<PresenceMessage>): PresenceMessage { | ||
return fromValues(values); | ||
} | ||
} |
Oops, something went wrong.