twilio-chat
Advanced tools
Comparing version 6.0.0-rc.26 to 6.0.0-rc.27
@@ -6,2 +6,19 @@ # Change Log | ||
## [6.0.0-rc.27](https://github.com/twilio/rtd-sdk-monorepo-js/compare/twilio-chat@6.0.0-rc.26...twilio-chat@6.0.0-rc.27) (2021-11-09) | ||
### Features | ||
* Migrate to ReplayEventEmitter ([91d692c](https://github.com/twilio/rtd-sdk-monorepo-js/commit/91d692c5d8bf11dabf6433ce5ca11ad139ccf36c)) | ||
### Bug Fixes | ||
* Fix client user initialization ([f2cc628](https://github.com/twilio/rtd-sdk-monorepo-js/commit/f2cc628f8e58c9c991a64888c8e016fc0e17a0dd)) | ||
* Fix getChannelBySid returning wrong channels issue ([3eeaf1f](https://github.com/twilio/rtd-sdk-monorepo-js/commit/3eeaf1fc64d77c48305ff7c43b8a92c81e6ead7b)) | ||
* Fix the post-install script to be runnable cross-platform ([a16eede](https://github.com/twilio/rtd-sdk-monorepo-js/commit/a16eede598dd3dbdda1997fbd2033fa2254f113f)) | ||
* Throw an error if reachabilityEnabled was accessed before client init ([52f9aab](https://github.com/twilio/rtd-sdk-monorepo-js/commit/52f9aab8bce737fbd4b9d730f13c1d6720e5b884)) | ||
## [6.0.0-rc.26](https://github.com/twilio/rtd-sdk-monorepo-js/compare/twilio-chat@6.0.0-rc.25...twilio-chat@6.0.0-rc.26) (2021-10-26) | ||
@@ -8,0 +25,0 @@ |
@@ -1,5 +0,5 @@ | ||
import { EventEmitter } from "events"; | ||
import { SyncClient } from "twilio-sync"; | ||
import { Transport, TwilsockClient, InitRegistration } from "twilsock"; | ||
import { ConnectionState as TwilsockConnectionState } from "twilsock"; | ||
import { ReplayEventEmitter } from "@twilio/replay-event-emitter"; | ||
import { ChannelType, Notifications } from "@twilio/notifications"; | ||
@@ -92,2 +92,10 @@ import { Notifications as NotificationClient } from "@twilio/notifications"; | ||
} | ||
type UserEvents = { | ||
updated: (data: { | ||
user: User; | ||
updateReasons: UserUpdateReason[]; | ||
}) => void; | ||
userSubscribed: (user: User) => void; | ||
userUnsubscribed: (user: User) => void; | ||
}; | ||
interface UserServices { | ||
@@ -97,5 +105,2 @@ syncClient: SyncClient; | ||
} | ||
interface UserLinks { | ||
self: string; | ||
} | ||
/** | ||
@@ -111,3 +116,3 @@ * The reason for the `updated` event being emitted by a user. | ||
*/ | ||
declare class User extends EventEmitter { | ||
declare class User extends ReplayEventEmitter<UserEvents> { | ||
private entity; | ||
@@ -117,9 +122,11 @@ private state; | ||
private subscribed; | ||
private readonly links; | ||
private readonly configuration; | ||
private links; | ||
private configuration; | ||
private readonly services; | ||
private _initializationPromise; | ||
private _resolveInitializationPromise; | ||
/** | ||
* @internal | ||
*/ | ||
constructor(identity: string, entityName: string, links: UserLinks, configuration: Configuration, services: UserServices); | ||
constructor(identity: string, entityName: string, configuration: Configuration | null, services: UserServices); | ||
/** | ||
@@ -130,4 +137,4 @@ * Fired when the properties or the reachability status of the message have been updated. | ||
* 1. object `data` - info object provided with the event. It has the following properties: | ||
* * {@link User} user - the user in question | ||
* * {@link UserUpdateReason}[] updateReasons - array of reasons for the update | ||
* * {@link User} `user` - the user in question | ||
* * {@link UserUpdateReason}[] `updateReasons` - array of reasons for the update | ||
* @event | ||
@@ -201,2 +208,3 @@ */ | ||
unsubscribe(): Promise<void>; | ||
_resolveInitialization(configuration: Configuration, identity: string, entityName: string, emitUpdated: boolean): void; | ||
} | ||
@@ -246,2 +254,10 @@ /** | ||
} | ||
type UsersEvents = { | ||
userUpdated: (data: { | ||
user: User; | ||
updateReasons: UserUpdateReason[]; | ||
}) => void; | ||
userSubscribed: (user: User) => void; | ||
userUnsubscribed: (user: User) => void; | ||
}; | ||
interface UsersServices { | ||
@@ -256,3 +272,3 @@ network: Network; | ||
*/ | ||
declare class Users extends EventEmitter { | ||
declare class Users extends ReplayEventEmitter<UsersEvents> { | ||
private readonly configuration; | ||
@@ -264,3 +280,3 @@ private readonly services; | ||
readonly myself: User; | ||
constructor(configuration: Configuration, services: UsersServices); | ||
constructor(myself: User, configuration: Configuration, services: UsersServices); | ||
private handleUnsubscribeUser; | ||
@@ -332,2 +348,10 @@ private handleSubscribeUser; | ||
} | ||
type MemberEvents = { | ||
typingEnded: (member: Member) => void; | ||
typingStarted: (member: Member) => void; | ||
updated: (data: { | ||
member: Member; | ||
updateReasons: MemberUpdateReason[]; | ||
}) => void; | ||
}; | ||
interface MemberDescriptor { | ||
@@ -362,3 +386,3 @@ attributes?: Object; | ||
*/ | ||
declare class Member extends EventEmitter { | ||
declare class Member extends ReplayEventEmitter<MemberEvents> { | ||
private state; | ||
@@ -519,2 +543,8 @@ /** | ||
} | ||
type MessageEvents = { | ||
updated: (data: { | ||
message: Message; | ||
updateReasons: MessageUpdateReason[]; | ||
}) => void; | ||
}; | ||
interface MessageServices { | ||
@@ -540,3 +570,3 @@ mcsClient: McsClient; | ||
*/ | ||
declare class Message extends EventEmitter { | ||
declare class Message extends ReplayEventEmitter<MessageEvents> { | ||
private state; | ||
@@ -681,2 +711,24 @@ /** | ||
} | ||
type ChannelEvents = { | ||
memberJoined: (member: Member) => void; | ||
memberInvited: (member: Member) => void; | ||
memberLeft: (member: Member) => void; | ||
memberUpdated: (data: { | ||
member: Member; | ||
updateReasons: MemberUpdateReason[]; | ||
}) => void; | ||
messageAdded: (message: Message) => void; | ||
messageRemoved: (message: Message) => void; | ||
messageUpdated: (data: { | ||
message: Message; | ||
updateReasons: MessageUpdateReason[]; | ||
}) => void; | ||
typingEnded: (member: Member) => void; | ||
typingStarted: (member: Member) => void; | ||
updated: (data: { | ||
channel: Channel; | ||
updateReasons: ChannelUpdateReason[]; | ||
}) => void; | ||
removed: (channel: Channel) => void; | ||
}; | ||
interface ChannelServices { | ||
@@ -777,3 +829,3 @@ users: Users; | ||
*/ | ||
declare class Channel extends EventEmitter { | ||
declare class Channel extends ReplayEventEmitter<ChannelEvents> { | ||
private readonly channelState; | ||
@@ -1244,2 +1296,27 @@ private statusSource; | ||
} | ||
type ChannelsEvents = { | ||
channelAdded: (channel: Channel) => void; | ||
channelJoined: (channel: Channel) => void; | ||
channelInvited: (channel: Channel) => void; | ||
channelLeft: (channel: Channel) => void; | ||
channelRemoved: (channel: Channel) => void; | ||
channelUpdated: (data: { | ||
channel: Channel; | ||
updateReasons: ChannelUpdateReason[]; | ||
}) => void; | ||
memberJoined: (member: Member) => void; | ||
memberLeft: (member: Member) => void; | ||
memberUpdated: (data: { | ||
member: Member; | ||
updateReasons: MemberUpdateReason[]; | ||
}) => void; | ||
messageAdded: (message: Message) => void; | ||
messageRemoved: (message: Message) => void; | ||
messageUpdated: (data: { | ||
message: Message; | ||
updateReasons: MessageUpdateReason[]; | ||
}) => void; | ||
typingEnded: (member: Member) => void; | ||
typingStarted: (member: Member) => void; | ||
}; | ||
interface ChannelsServices { | ||
@@ -1257,3 +1334,3 @@ syncClient: SyncClient; | ||
*/ | ||
declare class Channels extends EventEmitter { | ||
declare class Channels extends ReplayEventEmitter<ChannelsEvents> { | ||
private readonly configuration; | ||
@@ -1357,2 +1434,44 @@ private readonly services; | ||
} | ||
type ClientEvents = { | ||
channelAdded: (channel: Channel) => void; | ||
channelInvited: (channel: Channel) => void; | ||
channelJoined: (channel: Channel) => void; | ||
channelLeft: (channel: Channel) => void; | ||
channelRemoved: (channel: Channel) => void; | ||
channelUpdated: (data: { | ||
channel: Channel; | ||
updateReasons: ChannelUpdateReason[]; | ||
}) => void; | ||
memberJoined: (member: Member) => void; | ||
memberLeft: (member: Member) => void; | ||
memberUpdated: (data: { | ||
member: Member; | ||
updateReasons: MemberUpdateReason[]; | ||
}) => void; | ||
messageAdded: (message: Message) => void; | ||
messageRemoved: (message: Message) => void; | ||
messageUpdated: (data: { | ||
message: Message; | ||
updateReasons: MessageUpdateReason[]; | ||
}) => void; | ||
tokenAboutToExpire: (ttl: number) => void; | ||
tokenExpired: () => void; | ||
typingEnded: (member: Member) => void; | ||
typingStarted: (member: Member) => void; | ||
pushNotification: (pushNotification: PushNotification) => void; | ||
userSubscribed: (user: User) => void; | ||
userUnsubscribed: (user: User) => void; | ||
userUpdated: (data: { | ||
user: User; | ||
updateReasons: UserUpdateReason[]; | ||
}) => void; | ||
stateChanged: (state: State) => void; | ||
connectionStateChanged: (state: TwilsockConnectionState) => void; | ||
connectionError: (data: { | ||
terminal: boolean; | ||
message: string; | ||
httpStatusCode?: number; | ||
errorCode?: number; | ||
}) => void; | ||
}; | ||
/** | ||
@@ -1455,3 +1574,3 @@ * Connection state of the client. Possible values are as follows: | ||
*/ | ||
declare class Client extends EventEmitter { | ||
declare class Client extends ReplayEventEmitter<ClientEvents> { | ||
private fpaToken; | ||
@@ -1471,2 +1590,3 @@ private readonly options; | ||
private readonly services; | ||
private readonly _myself; | ||
/** | ||
@@ -1599,2 +1719,5 @@ * Current version of the Chat client. | ||
* Fired when the token is about to expire and needs to be updated. | ||
* | ||
* * Parameters: | ||
* 1. number `ttl` - token's time to live | ||
* @event | ||
@@ -1700,7 +1823,10 @@ */ | ||
/** | ||
* Information of the logged-in user. | ||
* Information of the logged-in user. Before client initialization, returns an | ||
* uninitialized user. Will trigger a {@link Client.userUpdated} event after | ||
* initialization. | ||
*/ | ||
get user(): User; | ||
/** | ||
* Client reachability state. | ||
* Client reachability state. Throws if accessed before the client | ||
* initialization was completed. | ||
*/ | ||
@@ -1707,0 +1833,0 @@ get reachabilityEnabled(): boolean; |
{ | ||
"name": "twilio-chat", | ||
"version": "6.0.0-rc.26", | ||
"version": "6.0.0-rc.27", | ||
"description": "Twilio Chat service client library", | ||
@@ -32,10 +32,11 @@ "main": "./dist/lib.js", | ||
"precommit": "yarn lint:fix && yarn test:unit && yarn test:integration", | ||
"postinstall": "if [ -f ./dist/post-install.js ]; then node ./dist/post-install.js; fi" | ||
"postinstall": "node -e \"if (require('fs').existsSync('./dist/post-install.js')) require('./dist/post-install.js');\"" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.14.5", | ||
"@twilio/declarative-type-validator": "^0.1.10-rc.0", | ||
"@twilio/mcs-client": "^0.5.2-rc.0", | ||
"@twilio/notifications": "^1.0.4-rc.0", | ||
"@twilio/operation-retrier": "^4.0.6-rc.0", | ||
"@twilio/declarative-type-validator": "^0.1.10-rc.1", | ||
"@twilio/mcs-client": "^0.5.2-rc.1", | ||
"@twilio/notifications": "^1.0.4-rc.1", | ||
"@twilio/operation-retrier": "^4.0.6-rc.1", | ||
"@twilio/replay-event-emitter": "^0.2.3-rc.1", | ||
"core-js": "^3.17.3", | ||
@@ -46,4 +47,4 @@ "iso8601-duration": "=1.2.0", | ||
"platform": "^1.3.6", | ||
"twilio-sync": "^3.0.6-rc.0", | ||
"twilsock": "^0.12.1-rc.0", | ||
"twilio-sync": "^3.0.6-rc.1", | ||
"twilsock": "^0.12.1-rc.1", | ||
"uuid": "^3.4.0" | ||
@@ -50,0 +51,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
9484835
14
59847
+ Added@twilio/replay-event-emitter@0.2.4(transitive)
Updatedtwilio-sync@^3.0.6-rc.1
Updatedtwilsock@^0.12.1-rc.1