stream-chat
Advanced tools
Comparing version 1.9.0 to 1.10.0
@@ -0,1 +1,7 @@ | ||
## May 13, 2020 - 1.9.0 | ||
- Multi-tenant feature | ||
- Ws Disconnect improvements - forcefully assume closed after 1 sec | ||
- Silent message feature | ||
## April 29, 2020 - 1.8.0 | ||
@@ -2,0 +8,0 @@ - **Breaking:** updated typescript namespace to avoid conflict with getstream package |
{ | ||
"name": "stream-chat", | ||
"version": "1.9.0", | ||
"version": "1.10.0", | ||
"description": "JS SDK for the Stream Chat API", | ||
@@ -49,3 +49,3 @@ "author": "GetStream", | ||
"seamless-immutable": "^7.1.4", | ||
"uuid": "^3.3.2", | ||
"uuid": "^8.0.0", | ||
"ws": "^6.1.3" | ||
@@ -52,0 +52,0 @@ }, |
@@ -58,5 +58,5 @@ // TypeScript Version: 2.8 | ||
reaction?: ReactionResponse; | ||
channel?: Channel; | ||
member?: User; | ||
user?: User; | ||
channel?: ChannelResponse; | ||
member?: ChannelMemberResponse; | ||
user?: UserResponse; | ||
user_id?: string; | ||
@@ -133,2 +133,7 @@ me?: OwnUserResponse; | ||
} | ||
export type Logger = ( | ||
log_level: 'info' | 'error', | ||
message: string, | ||
extraData?: object, | ||
) => void; | ||
export interface StreamChatOptions { | ||
@@ -166,3 +171,3 @@ /** | ||
*/ | ||
logger?(log_level: 'info' | 'error', message: string, extraData?: object): void; | ||
logger?: Logger; | ||
[propName: string]: any; | ||
@@ -172,2 +177,3 @@ } | ||
// client.js | ||
export class StreamChat { | ||
@@ -184,6 +190,19 @@ constructor(key: string, options?: StreamChatOptions); | ||
state: ClientState; | ||
userID: string; | ||
user: OwnUserResponse; | ||
browser: boolean; | ||
wsConnection: StableWSConnection; | ||
logger: Logger; | ||
mutedChannels: ChannelMute[]; | ||
options: StreamChatOptions; | ||
wsPromise: Promise<void>; | ||
setUserPromise: Promise<void>; | ||
activeChannels: { | ||
[cid: string]: Channel; | ||
}; | ||
configs: { | ||
[channel_type: string]: object; | ||
}; | ||
anonymous: boolean; | ||
tokenManager: TokenManager; | ||
testPushSettings(userID: string, data: object): Promise<APIResponse>; | ||
@@ -286,6 +305,6 @@ | ||
flagUser(userID: string): Promise<FlagAPIResponse>; | ||
unflagUser(userID: string): Promise<UnflagAPIResponse>; | ||
flagMessage(messageID: string): Promise<FlagAPIResponse>; | ||
unflagMessage(messageID: string): Promise<UnflagAPIResponse>; | ||
flagUser(userID: string, options?: object): Promise<FlagAPIResponse>; | ||
unflagUser(userID: string, options?: object): Promise<UnflagAPIResponse>; | ||
flagMessage(messageID: string, options?: object): Promise<FlagAPIResponse>; | ||
unflagMessage(messageID: string, options?: object): Promise<UnflagAPIResponse>; | ||
@@ -307,2 +326,12 @@ createChannelType(data: ChannelData): Promise<CreateChannelTypeAPIResponse>; | ||
verifyWebhook(requestBody: string | Int8Array | Buffer, xSignature: string): boolean; | ||
// TODO: Add detailed types for following api responses | ||
getPermission(name: string): Promise<APIResponse>; | ||
createPermission(permissionData: object): Promise<APIResponse>; | ||
updatePermission(name: string, permissionData: object): Promise<APIResponse>; | ||
deletePermission(name: string): Promise<APIResponse>; | ||
listPermissions(): Promise<APIResponse>; | ||
createRole(name: string): Promise<APIResponse>; | ||
listRoles(): Promise<APIResponse>; | ||
deleteRole(name: string): Promise<APIResponse>; | ||
} | ||
@@ -317,2 +346,3 @@ | ||
} | ||
// client_state.js | ||
export class ClientState { | ||
@@ -325,2 +355,3 @@ constructor(); | ||
// channel.js | ||
export class Channel { | ||
@@ -453,2 +484,3 @@ constructor(client: StreamChat, type: string, id: string, data: ChannelData); | ||
} | ||
// channel_state.js | ||
export class ChannelState { | ||
@@ -496,11 +528,6 @@ constructor(channel: Channel); | ||
} | ||
// connection.js | ||
export class StableWSConnection { | ||
constructor( | ||
wsURL: string, | ||
clientID: string, | ||
userID: string, | ||
messageCallback: (event: WebSocket.OpenEvent) => void, | ||
recoverCallback: (open: Promise<object>) => void, | ||
eventCallback: (event: ConnectionChangeEvent) => void, | ||
); | ||
constructor(options: StableWSConnectionOptions); | ||
connect(): Promise<void>; | ||
@@ -515,2 +542,17 @@ disconnect(): Promise<void>; | ||
export interface StableWSConnectionOptions { | ||
wsBaseURL: string; | ||
clientID: string; | ||
userID: string; | ||
user: User; | ||
messageCallback: (event: WebSocket.OpenEvent) => void; | ||
recoverCallback: (open: Promise<object>) => void; | ||
eventCallback: (event: ConnectionChangeEvent) => void; | ||
userAgent: string; | ||
apiKey: string; | ||
tokenManager: TokenManager; | ||
authType: string; | ||
logger?: Logger; | ||
} | ||
// permissions.js | ||
export class Permission { | ||
@@ -544,2 +586,37 @@ constructor( | ||
export const BuiltinRoles: { | ||
Anonymous: 'anonymous'; | ||
Guest: 'guest'; | ||
User: 'user'; | ||
Admin: 'admin'; | ||
ChannelModerator: 'channel_moderator'; | ||
ChannelMember: 'channel_member'; | ||
}; | ||
export const BuiltinPermissions: { | ||
CreateMessage: 'Create Message'; | ||
UpdateAnyMessage: 'Update Any Message'; | ||
UpdateOwnMessage: 'Update Own Message'; | ||
DeleteAnyMessage: 'Delete Any Message'; | ||
DeleteOwnMessage: 'Delete Own Message'; | ||
CreateChannel: 'Create Channel'; | ||
ReadAnyChannel: 'Read Any Channel'; | ||
ReadOwnChannel: 'Read Own Channel'; | ||
UpdateMembersAnyChannel: 'Update Members Any Channel'; | ||
UpdateMembersOwnChannel: 'Update Members Own Channel'; | ||
UpdateAnyChannel: 'Update Any Channel'; | ||
UpdateOwnChannel: 'Update Own Channel'; | ||
DeleteAnyChannel: 'Delete Any Channel'; | ||
DeleteOwnChannel: 'Delete Own Channel'; | ||
RunMessageAction: 'Run Message Action'; | ||
BanUser: 'Ban User'; | ||
UploadAttachment: 'Upload Attachment'; | ||
DeleteAnyAttachment: 'Delete Any Attachment'; | ||
DeleteOwnAttachment: 'Delete Own Attachment'; | ||
AddLinks: 'Add Links'; | ||
CreateReaction: 'Create Reaction'; | ||
DeleteAnyReaction: 'Delete Any Reaction'; | ||
DeleteOwnReaction: 'Delete Own Reaction'; | ||
}; | ||
export function JWTUserToken( | ||
@@ -566,4 +643,22 @@ apiSecret: string, | ||
// utils.js | ||
export function logChatPromiseExecution(promise: Promise<any>, name: string): void; | ||
export function isFunction(value: any): boolean; | ||
// token_manager.js | ||
export class TokenManager { | ||
constructor(secret?: string); | ||
setTokenOrProvider(tokenOrProvider: TokenOrProvider, user: User): Promise<void>; | ||
reset?(): void; | ||
validateToken(tokenOrProvider: TokenOrProvider, user: User): void; | ||
tokenReady(): Promise<string>; | ||
loadToken(): Promise<string>; | ||
getToken(): Promise<string>; | ||
isStatic(): boolean; | ||
} | ||
export type TokenOrProvider = string | TokenProvider | null | undefined; | ||
export type TokenProvider = () => Promise<string>; | ||
export interface APIResponse { | ||
@@ -900,2 +995,3 @@ duration: string; | ||
permissions: Permission[]; | ||
roles: object; | ||
} | ||
@@ -902,0 +998,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 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 not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2084699
24092
+ Addeduuid@8.3.2(transitive)
- Removeduuid@3.4.0(transitive)
Updateduuid@^8.0.0