stream-chat
Advanced tools
Comparing version 7.0.0-offline-support.3 to 7.0.0-offline-support.4
import { Channel } from './channel'; | ||
import { ChannelMemberResponse, ChannelMembership, FormatMessageResponse, Event, ExtendableGenerics, DefaultGenerics, MessageSetType, MessageResponse, ReactionResponse, UserResponse } from './types'; | ||
import { ChannelMemberResponse, ChannelMembership, FormatMessageResponse, Event, ExtendableGenerics, DefaultGenerics, MessageSetType, MessageResponse, ReactionResponse, UserResponse, PendingMessageResponse } from './types'; | ||
declare type ChannelReadStatus<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = Record<string, { | ||
@@ -17,2 +17,3 @@ last_read: Date; | ||
pinnedMessages: Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>; | ||
pending_messages: Array<PendingMessageResponse<StreamChatGenerics>>; | ||
threads: Record<string, Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>>; | ||
@@ -19,0 +20,0 @@ mutedUsers: Array<UserResponse<StreamChatGenerics>>; |
@@ -35,3 +35,3 @@ /// <reference types="node" /> | ||
*/ | ||
staticState: boolean; | ||
offlineMode: boolean; | ||
lastKeyStroke?: Date; | ||
@@ -70,2 +70,4 @@ lastTypingEvent: Date | null; | ||
* @param {boolean} [options.skip_push] Skip sending push notifications | ||
* @param {boolean} [options.is_pending_message] Make this message pending | ||
* @param {Record<string,string>} [options.pending_message_metadata] Metadata for the pending message | ||
* | ||
@@ -75,2 +77,4 @@ * @return {Promise<SendMessageAPIResponse<StreamChatGenerics>>} The Server Response | ||
sendMessage(message: Message<StreamChatGenerics>, options?: { | ||
is_pending_message?: boolean; | ||
pending_message_metadata?: Record<string, string>; | ||
skip_enrich_url?: boolean; | ||
@@ -517,11 +521,3 @@ skip_push?: boolean; | ||
messageSet: { | ||
isCurrent: boolean; /** | ||
* This boolean is a vague indication of weather the channel exists on chat backend. | ||
* | ||
* If the value is true, then that means the channel has been initialized by either calling | ||
* channel.create() or channel.query() or channel.watch(). | ||
* | ||
* If the value is false, then channel may or may not exist on the backend. The only way to ensure | ||
* is by calling channel.create() or channel.query() or channel.watch(). | ||
*/ | ||
isCurrent: boolean; | ||
isLatest: boolean; | ||
@@ -528,0 +524,0 @@ messages: FormatMessageResponse<StreamChatGenerics>[]; |
@@ -9,3 +9,3 @@ /// <reference types="node" /> | ||
import { WSConnectionFallback } from './connection_fallback'; | ||
import { APIResponse, AppSettings, AppSettingsAPIResponse, BaseDeviceFields, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BlockList, BlockListResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CustomPermissionOptions, DeleteCommandResponse, Device, EndpointName, Event, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, FlagMessageResponse, FlagUserResponse, GetChannelTypeResponse, GetCommandResponse, GetRateLimitsResponse, ListChannelResponse, ListCommandsResponse, Logger, MarkChannelsReadOptions, MessageFilters, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OwnUserResponse, PartialMessageUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, PushProvider, PushProviderID, PushProviderConfig, PushProviderUpsertResponse, PushProviderListResponse, ReactionResponse, SearchOptions, SearchAPIResponse, SendFileAPIResponse, StreamChatOptions, TestPushDataInput, TestSQSDataInput, TokenOrProvider, UnBanUserOptions, UpdateChannelOptions, UpdateChannelResponse, UpdateCommandOptions, UpdateCommandResponse, UpdatedMessage, UpdateMessageAPIResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, SegmentData, Segment, Campaign, CampaignData, OGAttachment, TaskStatus, DeleteUserOptions, TaskResponse, ExtendableGenerics, DefaultGenerics, ReviewFlagReportResponse, FlagReportsFilters, FlagReportsResponse, ReviewFlagReportOptions, FlagReportsPaginationOptions, ExportUsersRequest, ExportUsersResponse, CreateImportResponse, CreateImportOptions, CreateImportURLResponse, GetImportResponse, ListImportsResponse, ListImportsPaginationOptions, FlagsFilters, FlagsPaginationOptions, FlagsResponse, TestCampaignResponse, GetCallTokenResponse, APIErrorResponse, ErrorFromResponse } from './types'; | ||
import { APIResponse, AppSettings, AppSettingsAPIResponse, BaseDeviceFields, BannedUsersFilters, BannedUsersPaginationOptions, BannedUsersResponse, BannedUsersSort, BanUserOptions, BlockList, BlockListResponse, ChannelAPIResponse, ChannelData, ChannelFilters, ChannelMute, ChannelOptions, ChannelSort, ChannelStateOptions, CheckPushResponse, CheckSQSResponse, Configs, ConnectAPIResponse, CreateChannelOptions, CreateChannelResponse, CreateCommandOptions, CreateCommandResponse, CustomPermissionOptions, DeleteCommandResponse, Device, EndpointName, Event, EventHandler, ExportChannelOptions, ExportChannelRequest, ExportChannelResponse, ExportChannelStatusResponse, MessageFlagsFilters, MessageFlagsPaginationOptions, MessageFlagsResponse, FlagMessageResponse, FlagUserResponse, GetChannelTypeResponse, GetCommandResponse, GetMessageAPIResponse, GetRateLimitsResponse, ListChannelResponse, ListCommandsResponse, Logger, MarkChannelsReadOptions, MessageFilters, MessageResponse, Mute, MuteUserOptions, MuteUserResponse, OwnUserResponse, PartialMessageUpdate, PartialUserUpdate, PermissionAPIResponse, PermissionsAPIResponse, PushProvider, PushProviderID, PushProviderConfig, PushProviderUpsertResponse, PushProviderListResponse, ReactionResponse, SearchOptions, SearchAPIResponse, SendFileAPIResponse, StreamChatOptions, TestPushDataInput, TestSQSDataInput, TokenOrProvider, UnBanUserOptions, UpdateChannelOptions, UpdateChannelResponse, UpdateCommandOptions, UpdateCommandResponse, UpdatedMessage, UpdateMessageAPIResponse, UserCustomEvent, UserFilters, UserOptions, UserResponse, UserSort, SegmentData, Segment, Campaign, CampaignData, OGAttachment, TaskStatus, DeleteUserOptions, TaskResponse, ExtendableGenerics, DefaultGenerics, ReviewFlagReportResponse, FlagReportsFilters, FlagReportsResponse, ReviewFlagReportOptions, FlagReportsPaginationOptions, ExportUsersRequest, ExportUsersResponse, CreateImportResponse, CreateImportOptions, CreateImportURLResponse, GetImportResponse, ListImportsResponse, ListImportsPaginationOptions, FlagsFilters, FlagsPaginationOptions, FlagsResponse, TestCampaignResponse, GetCallTokenResponse, APIErrorResponse, ErrorFromResponse, SyncOptions, SyncResponse } from './types'; | ||
import { InsightMetrics } from './insights'; | ||
@@ -861,3 +861,3 @@ export declare class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> { | ||
deleted_at?: string | undefined; | ||
i18n?: (import("./types").RequireAtLeastOne<Record<"_text" | "so_text" | "hr_text" | "th_text" | "tr_text" | "no_text" | "af_text" | "am_text" | "ar_text" | "az_text" | "bg_text" | "bn_text" | "bs_text" | "cs_text" | "da_text" | "de_text" | "el_text" | "en_text" | "es_text" | "es-MX_text" | "et_text" | "fa_text" | "fa-AF_text" | "fi_text" | "fr_text" | "fr-CA_text" | "ha_text" | "he_text" | "hi_text" | "hu_text" | "id_text" | "it_text" | "ja_text" | "ka_text" | "ko_text" | "lv_text" | "ms_text" | "nl_text" | "pl_text" | "ps_text" | "pt_text" | "ro_text" | "ru_text" | "sk_text" | "sl_text" | "sq_text" | "sr_text" | "sv_text" | "sw_text" | "ta_text" | "tl_text" | "uk_text" | "ur_text" | "vi_text" | "zh_text" | "zh-TW_text", string>> & { | ||
i18n?: (import("./types").RequireAtLeastOne<Record<"_text" | "so_text" | "hr_text" | "th_text" | "tr_text" | "af_text" | "am_text" | "ar_text" | "az_text" | "bg_text" | "bn_text" | "bs_text" | "cs_text" | "da_text" | "de_text" | "el_text" | "en_text" | "es_text" | "es-MX_text" | "et_text" | "fa_text" | "fa-AF_text" | "fi_text" | "fr_text" | "fr-CA_text" | "ha_text" | "he_text" | "hi_text" | "hu_text" | "id_text" | "it_text" | "ja_text" | "ka_text" | "ko_text" | "lv_text" | "ms_text" | "nl_text" | "no_text" | "pl_text" | "ps_text" | "pt_text" | "ro_text" | "ru_text" | "sk_text" | "sl_text" | "sq_text" | "sr_text" | "sv_text" | "sw_text" | "ta_text" | "tl_text" | "uk_text" | "ur_text" | "vi_text" | "zh_text" | "zh-TW_text", string>> & { | ||
language: import("./types").TranslationLanguages; | ||
@@ -956,5 +956,3 @@ }) | undefined; | ||
}>; | ||
getMessage(messageID: string): Promise<APIResponse & { | ||
message: MessageResponse<StreamChatGenerics>; | ||
}>; | ||
getMessage(messageID: string): Promise<GetMessageAPIResponse<StreamChatGenerics>>; | ||
getUserAgent(): string; | ||
@@ -1028,6 +1026,7 @@ setUserAgent(userAgent: string): void; | ||
* @param {string} last_sync_at last time the user was online and in sync. RFC3339 ie. "2020-05-06T15:05:01.207Z" | ||
* @param {SyncOptions} options See JSDoc in the type fields for more info | ||
* | ||
* @returns {Promise<SyncResponse>} | ||
*/ | ||
sync(channel_cids: string[], last_sync_at: string): Promise<APIResponse & { | ||
events: Event<StreamChatGenerics>[]; | ||
}>; | ||
sync(channel_cids: string[], last_sync_at: string, options?: SyncOptions): Promise<SyncResponse<DefaultGenerics>>; | ||
/** | ||
@@ -1034,0 +1033,0 @@ * sendUserCustomEvent - Send a custom event to a user |
@@ -51,2 +51,3 @@ /// <reference types="node" /> | ||
_log(msg: string, extra?: UR, level?: LogLevel): void; | ||
setClient(client: StreamChat<StreamChatGenerics>): void; | ||
/** | ||
@@ -53,0 +54,0 @@ * connect - Connect to the WS URL |
{ | ||
"name": "stream-chat", | ||
"version": "7.0.0-offline-support.3", | ||
"version": "7.0.0-offline-support.4", | ||
"description": "JS SDK for the Stream Chat API", | ||
@@ -5,0 +5,0 @@ "author": "GetStream", |
@@ -13,2 +13,3 @@ import { Channel } from './channel'; | ||
UserResponse, | ||
PendingMessageResponse, | ||
} from './types'; | ||
@@ -30,2 +31,3 @@ | ||
pinnedMessages: Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>; | ||
pending_messages: Array<PendingMessageResponse<StreamChatGenerics>>; | ||
threads: Record<string, Array<ReturnType<ChannelState<StreamChatGenerics>['formatMessage']>>>; | ||
@@ -63,2 +65,3 @@ mutedUsers: Array<UserResponse<StreamChatGenerics>>; | ||
this.pinnedMessages = []; | ||
this.pending_messages = []; | ||
this.threads = {}; | ||
@@ -65,0 +68,0 @@ // a list of users to hide messages from |
@@ -86,3 +86,3 @@ import { ChannelState } from './channel_state'; | ||
*/ | ||
staticState: boolean; | ||
offlineMode: boolean; | ||
lastKeyStroke?: Date; | ||
@@ -131,3 +131,3 @@ lastTypingEvent: Date | null; | ||
this.initialized = false; | ||
this.staticState = false; | ||
this.offlineMode = false; | ||
this.lastTypingEvent = null; | ||
@@ -166,2 +166,4 @@ this.isTyping = false; | ||
* @param {boolean} [options.skip_push] Skip sending push notifications | ||
* @param {boolean} [options.is_pending_message] Make this message pending | ||
* @param {Record<string,string>} [options.pending_message_metadata] Metadata for the pending message | ||
* | ||
@@ -172,3 +174,8 @@ * @return {Promise<SendMessageAPIResponse<StreamChatGenerics>>} The Server Response | ||
message: Message<StreamChatGenerics>, | ||
options?: { skip_enrich_url?: boolean; skip_push?: boolean }, | ||
options?: { | ||
is_pending_message?: boolean; | ||
pending_message_metadata?: Record<string, string>; | ||
skip_enrich_url?: boolean; | ||
skip_push?: boolean; | ||
}, | ||
) { | ||
@@ -1398,3 +1405,3 @@ const sendMessageResponse = await this.getClient().post<SendMessageAPIResponse<StreamChatGenerics>>( | ||
_checkInitialized() { | ||
if (!this.initialized && !this.staticState && !this.getClient()._isUsingServerAuth()) { | ||
if (!this.initialized && !this.offlineMode && !this.getClient()._isUsingServerAuth()) { | ||
throw Error( | ||
@@ -1434,2 +1441,5 @@ `Channel ${this.cid} hasn't been initialized yet. Make sure to call .watch() and wait for it to resolve`, | ||
this.state.addPinnedMessages(state.pinned_messages || []); | ||
if (state.pending_messages) { | ||
this.state.pending_messages = state.pending_messages; | ||
} | ||
this.state.watcher_count = state.watcher_count || 0; | ||
@@ -1436,0 +1446,0 @@ // convert the arrays into objects for easier syncing... |
@@ -95,2 +95,6 @@ import WebSocket from 'isomorphic-ws'; | ||
setClient(client: StreamChat<StreamChatGenerics>) { | ||
this.client = client; | ||
} | ||
/** | ||
@@ -97,0 +101,0 @@ * connect - Connect to the WS URL |
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
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 too big to display
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
4870301
51346