stream-chat 10.1.1 → 10.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.browser.js +4736 -2819
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +4757 -2819
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +4736 -2819
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/channel.d.ts +62 -3
- package/dist/types/client.d.ts +9 -1
- package/dist/types/configuration/types.d.ts +2 -0
- package/dist/types/connection/ConnectionRecoveryManager.d.ts +1 -0
- package/dist/types/gen/chat/ChatApi.d.ts +12 -1
- package/dist/types/gen/models/index.d.ts +659 -11
- package/dist/types/gen/moderation/ModerationApi.d.ts +3 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/messageComposer/attachmentManager.d.ts +2 -0
- package/dist/types/messageComposer/index.d.ts +1 -0
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +1 -0
- package/dist/types/messageComposer/messageComposer.d.ts +33 -7
- package/dist/types/messageComposer/middleware/messageComposer/compositionValidation.d.ts +1 -2
- package/dist/types/messageComposer/middleware/messageComposer/index.d.ts +1 -0
- package/dist/types/messageComposer/middleware/messageComposer/scheduledMessage.d.ts +4 -0
- package/dist/types/messageComposer/middleware/textComposer/commandUtils.d.ts +1 -0
- package/dist/types/messageComposer/scheduledMessageComposition.d.ts +32 -0
- package/dist/types/messageMarks/MessageMarkManager.d.ts +44 -0
- package/dist/types/messageMarks/index.d.ts +1 -0
- package/dist/types/messageOperations/MessageOperations.d.ts +12 -1
- package/dist/types/messageOperations/index.d.ts +1 -0
- package/dist/types/messageOperations/reflectMessageMarkEvent.d.ts +9 -0
- package/dist/types/messageOperations/sendOrdering.d.ts +4 -3
- package/dist/types/messageOperations/types.d.ts +6 -2
- package/dist/types/notifications/types.d.ts +4 -0
- package/dist/types/offline-support/offline_support_api.d.ts +19 -1
- package/dist/types/offline-support/types.d.ts +19 -1
- package/dist/types/pagination/PaginatorView.d.ts +55 -0
- package/dist/types/pagination/index.d.ts +1 -0
- package/dist/types/pagination/paginators/BasePaginator.d.ts +49 -0
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +0 -9
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +6 -0
- package/dist/types/pagination/paginators/MessageMarkPaginator.d.ts +61 -0
- package/dist/types/pagination/paginators/ScheduledMessagePaginator.d.ts +83 -0
- package/dist/types/pagination/paginators/index.d.ts +2 -0
- package/dist/types/scheduledMessages/ScheduledMessagePaginatorsManager.d.ts +47 -0
- package/dist/types/scheduledMessages/ScheduledMessageStatePolicy.d.ts +12 -0
- package/dist/types/scheduledMessages/ScheduledMessagesView.d.ts +38 -0
- package/dist/types/scheduledMessages/composition.d.ts +5 -0
- package/dist/types/scheduledMessages/constants.d.ts +56 -0
- package/dist/types/scheduledMessages/editResolvers.d.ts +4 -0
- package/dist/types/scheduledMessages/errors.d.ts +3 -0
- package/dist/types/scheduledMessages/eventHandlers.d.ts +8 -0
- package/dist/types/scheduledMessages/index.d.ts +7 -0
- package/dist/types/scheduledMessages/limits.d.ts +6 -0
- package/dist/types/scheduledMessages/types.d.ts +65 -0
- package/dist/types/thread.d.ts +12 -1
- package/dist/types/utils.d.ts +7 -0
- package/package.json +1 -1
- package/src/channel.ts +231 -7
- package/src/client.ts +46 -2
- package/src/configuration/keys.ts +2 -0
- package/src/configuration/shape.ts +15 -0
- package/src/configuration/types.ts +3 -1
- package/src/connection/ConnectionRecoveryManager.ts +7 -0
- package/src/errors.ts +11 -0
- package/src/gen/chat/ChatApi.ts +60 -3
- package/src/gen/models/index.ts +794 -23
- package/src/gen/moderation/ModerationApi.ts +24 -3
- package/src/index.ts +2 -0
- package/src/messageComposer/attachmentManager.ts +43 -24
- package/src/messageComposer/index.ts +1 -0
- package/src/messageComposer/messageComposer.ts +140 -32
- package/src/messageComposer/middleware/messageComposer/MessageComposerMiddlewareExecutor.ts +2 -0
- package/src/messageComposer/middleware/messageComposer/compositionValidation.ts +40 -47
- package/src/messageComposer/middleware/messageComposer/index.ts +1 -0
- package/src/messageComposer/middleware/messageComposer/scheduledMessage.ts +38 -0
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +8 -0
- package/src/messageComposer/scheduledMessageComposition.ts +324 -0
- package/src/messageMarks/MessageMarkManager.ts +145 -0
- package/src/messageMarks/index.ts +1 -0
- package/src/messageOperations/MessageOperationStatePolicy.ts +7 -0
- package/src/messageOperations/MessageOperations.ts +154 -1
- package/src/messageOperations/index.ts +1 -0
- package/src/messageOperations/reflectMessageMarkEvent.ts +47 -0
- package/src/messageOperations/reflectReactionEvent.ts +3 -0
- package/src/messageOperations/sendOrdering.ts +11 -4
- package/src/messageOperations/types.ts +6 -2
- package/src/notifications/types.ts +4 -0
- package/src/offline-support/offline_support_api.ts +61 -1
- package/src/offline-support/queueableOperations.ts +6 -0
- package/src/offline-support/types.ts +28 -0
- package/src/pagination/PaginatorView.ts +103 -0
- package/src/pagination/index.ts +1 -0
- package/src/pagination/paginators/BasePaginator.ts +204 -29
- package/src/pagination/paginators/ChannelPaginator.ts +8 -28
- package/src/pagination/paginators/MessageIntervalPaginator.ts +14 -1
- package/src/pagination/paginators/MessageMarkPaginator.ts +222 -0
- package/src/pagination/paginators/ScheduledMessagePaginator.ts +352 -0
- package/src/pagination/paginators/index.ts +2 -0
- package/src/scheduledMessages/ScheduledMessagePaginatorsManager.ts +268 -0
- package/src/scheduledMessages/ScheduledMessageStatePolicy.ts +42 -0
- package/src/scheduledMessages/ScheduledMessagesView.ts +57 -0
- package/src/scheduledMessages/composition.ts +129 -0
- package/src/scheduledMessages/constants.ts +79 -0
- package/src/scheduledMessages/editResolvers.ts +51 -0
- package/src/scheduledMessages/errors.ts +45 -0
- package/src/scheduledMessages/eventHandlers.ts +58 -0
- package/src/scheduledMessages/index.ts +7 -0
- package/src/scheduledMessages/limits.ts +32 -0
- package/src/scheduledMessages/types.ts +124 -0
- package/src/thread.ts +41 -17
- package/src/utils.ts +18 -0
|
@@ -215,6 +215,12 @@ export type PaginatorState<T> = {
|
|
|
215
215
|
hasMoreHead: boolean;
|
|
216
216
|
hasMoreTail: boolean;
|
|
217
217
|
isLoading: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* The direction of the running query while it loads a page at an edge of the loaded items
|
|
220
|
+
* (`toHead()`, `toTail()`). `undefined` while no query runs, and for a query that loads no such
|
|
221
|
+
* page: a first page, a refresh, or a page at a query shape the caller gives (a jump).
|
|
222
|
+
*/
|
|
223
|
+
loadingDirection?: PaginationDirection;
|
|
218
224
|
items: T[] | undefined;
|
|
219
225
|
lastQueryError?: Error;
|
|
220
226
|
cursor?: PaginatorCursor;
|
|
@@ -317,6 +323,15 @@ export type PaginatorOptions<T, Q> = {
|
|
|
317
323
|
* Does not hold across interval changes or page jumps.
|
|
318
324
|
*/
|
|
319
325
|
lockItemOrder?: boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Where a newly ingested item lands in a loaded list that is already empty and complete. When the
|
|
328
|
+
* sort order follows arrival (recency lists: messages by `created_at`, channels by
|
|
329
|
+
* `last_message_at`), a new item is the newest and waits in the logical head, leaving the list
|
|
330
|
+
* re-queryable — so this stays `false`. When the sort order is independent of arrival (scheduled
|
|
331
|
+
* messages, by `scheduled_at`), completeness makes its slot known, so it anchors a real interval
|
|
332
|
+
* there instead; such paginators set this `true`. Defaults to `false`.
|
|
333
|
+
*/
|
|
334
|
+
newItemsAnchorBySortPosition?: boolean;
|
|
320
335
|
/**
|
|
321
336
|
* Caps the loaded items: when the head interval exceeds it, the oldest are released as new ones
|
|
322
337
|
* arrive and the tailward edge re-opens, so scrolling back re-fetches. Unset: unbounded. Values
|
|
@@ -410,6 +425,11 @@ export declare abstract class BasePaginator<T, Q, R = PaginationQueryReturnValue
|
|
|
410
425
|
protected _lastQueryShape?: Q;
|
|
411
426
|
/** Set by `setItems`, which loads a page (even an empty one) without a query. */
|
|
412
427
|
private _pageSetWithoutQuery;
|
|
428
|
+
/**
|
|
429
|
+
* The IDs of the offline database's page (see {@link preloadFirstPageFromOfflineDb}) that no live
|
|
430
|
+
* event has touched since, until a page from the server takes their place.
|
|
431
|
+
*/
|
|
432
|
+
private _offlineOnlyItemIds;
|
|
413
433
|
/**
|
|
414
434
|
* Stable, purely data-driven comparison (age, timestamps, ...). Default for
|
|
415
435
|
* `itemOrderComparator`, which orders items and intervals and breaks `boostComparator` ties.
|
|
@@ -443,6 +463,8 @@ export declare abstract class BasePaginator<T, Q, R = PaginationQueryReturnValue
|
|
|
443
463
|
get hasMoreHead(): boolean;
|
|
444
464
|
get hasResults(): boolean;
|
|
445
465
|
get isLoading(): boolean;
|
|
466
|
+
/** See {@link PaginatorState.loadingDirection}. */
|
|
467
|
+
get loadingDirection(): PaginationDirection | undefined;
|
|
446
468
|
/**
|
|
447
469
|
* True once a query has run or a non-empty interval was loaded without one (`setItems`, or a
|
|
448
470
|
* subclass calling `recordLoadedIntervalQueryShape`). Cleared by `resetState`.
|
|
@@ -457,6 +479,8 @@ export declare abstract class BasePaginator<T, Q, R = PaginationQueryReturnValue
|
|
|
457
479
|
* queries) still skips such a list. Cleared by `resetState`.
|
|
458
480
|
*/
|
|
459
481
|
get hasLoadedPage(): boolean;
|
|
482
|
+
private get isLoadedEmptyAndComplete();
|
|
483
|
+
private placeEmptyCompleteFirstPage;
|
|
460
484
|
get isOfflineSupportEnabled(): boolean;
|
|
461
485
|
get isCursorPagination(): boolean;
|
|
462
486
|
get initialState(): PaginatorState<T>;
|
|
@@ -943,7 +967,32 @@ export declare abstract class BasePaginator<T, Q, R = PaginationQueryReturnValue
|
|
|
943
967
|
/** The page size a query's results are measured against when deriving the head/tail flags. */
|
|
944
968
|
protected getRequestedPageSize(_queryShape: Q | undefined): number;
|
|
945
969
|
protected getStateAfterQuery(stateUpdate: Partial<PaginatorState<T>>, _isFirstPage: boolean): PaginatorState<T>;
|
|
970
|
+
/**
|
|
971
|
+
* The offline database's copy of the first page, shown while the first query of a paginator not
|
|
972
|
+
* initialized yet runs. It is stored like a page, so live items join it. The first page from the
|
|
973
|
+
* server takes the place of its items no live event touched, as the copy can be arbitrarily old,
|
|
974
|
+
* and merges with the rest, as a loaded page would. A failed query leaves it shown. `undefined`
|
|
975
|
+
* (the default) shows nothing until the server answers.
|
|
976
|
+
*/
|
|
946
977
|
preloadFirstPageFromOfflineDb: (_params: PaginationQueryParams<Q>) => Promise<T[] | undefined> | T[] | undefined;
|
|
978
|
+
/** Whether the shown items are the offline database's page, not yet replaced by the server's. */
|
|
979
|
+
protected get showsOfflinePage(): boolean;
|
|
980
|
+
/**
|
|
981
|
+
* Stores the offline database's page as the head interval and returns its items, ordered. Without
|
|
982
|
+
* an interval behind them, the next live item would rebuild `state.items` without them.
|
|
983
|
+
*/
|
|
984
|
+
private storeOfflinePage;
|
|
985
|
+
/**
|
|
986
|
+
* Shows the offline database's page without a query, for a subclass that defers its first query
|
|
987
|
+
* (see `ChannelPaginator.executeQuery`). Like the page of {@link preloadFirstPageFromOfflineDb},
|
|
988
|
+
* the first page from the server takes its place.
|
|
989
|
+
*/
|
|
990
|
+
protected setItemsFromOfflineDb(items: T[]): void;
|
|
991
|
+
/**
|
|
992
|
+
* Takes the offline database's items no live event touched out of storage, without publishing:
|
|
993
|
+
* the server's page placed next publishes the list once.
|
|
994
|
+
*/
|
|
995
|
+
private removeOfflineOnlyItems;
|
|
947
996
|
populateOfflineDbAfterQuery: (_params: {
|
|
948
997
|
items: T[] | undefined;
|
|
949
998
|
queryShape: Q | undefined;
|
|
@@ -75,15 +75,6 @@ export declare class ChannelPaginator extends BasePaginator<Channel, ChannelQuer
|
|
|
75
75
|
protected _predefinedFilter: ParsedPredefinedFilterResponse | undefined;
|
|
76
76
|
/** Metadata of the in-flight response, committed by `placeQueryPage` on a first page only. */
|
|
77
77
|
private _pendingPredefinedFilter;
|
|
78
|
-
/**
|
|
79
|
-
* True while the loaded items came only from the offline cache (seeded by `setItems`, never
|
|
80
|
-
* confirmed by a query). The seed's offset and query shape would make the next query a
|
|
81
|
-
* continuation, but a cache has no pagination position, so `executeQuery` forces a first page that
|
|
82
|
-
* keeps the items.
|
|
83
|
-
*/
|
|
84
|
-
private _itemsLoadedFromOfflineDB;
|
|
85
|
-
/** The query in flight refreshes a cache-only interval, so its response replaces the interval. */
|
|
86
|
-
private _replaceOfflineSeedOnResponse;
|
|
87
78
|
/** The query handed to the sync manager, from the cache read until it runs. See `executeQuery`. */
|
|
88
79
|
private _queryAwaitingSync;
|
|
89
80
|
/** The cids of the page the latest query returned, `undefined` when it failed. */
|
|
@@ -666,6 +666,12 @@ export declare class MessageIntervalPaginator extends BasePaginator<LocalMessage
|
|
|
666
666
|
clearMessageFocusSignal: ({ token }?: {
|
|
667
667
|
token?: number;
|
|
668
668
|
}) => void;
|
|
669
|
+
/**
|
|
670
|
+
* Also drops the focus signal of an earlier jump. Whatever claims the active interval decides what
|
|
671
|
+
* is shown, so the earlier target must not be scrolled to or highlighted there. A jump claims
|
|
672
|
+
* before it emits its own signal, so it keeps that one.
|
|
673
|
+
*/
|
|
674
|
+
protected claimActiveInterval(): number;
|
|
669
675
|
clearStateAndCache(): void;
|
|
670
676
|
/**
|
|
671
677
|
* Partial truncation for `channel.truncated` with a `truncated_at`: drops every loaded message
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { BasePaginator } from './BasePaginator';
|
|
2
|
+
import type { ExecuteQueryReturnValue, PaginationQueryParams, PaginationQueryReturnValue, PaginatorOptions, PaginatorState, PlaceQueryPageParams } from './BasePaginator';
|
|
3
|
+
import type { MessageMarkWithUserResponse, QueryMessageMarksFilter, QueryMessageMarksRequest } from '../../types';
|
|
4
|
+
import type { StreamChat } from '../../client';
|
|
5
|
+
export type MessageMarkPaginatorOptions = {
|
|
6
|
+
/** Identifies the list in `client.messageMarks`. Generated when left out. */
|
|
7
|
+
id?: string;
|
|
8
|
+
/** The message whose marks are listed. */
|
|
9
|
+
messageId: string;
|
|
10
|
+
/** Lists only the marks it matches, for example `{ type: 'played' }`. */
|
|
11
|
+
filter?: QueryMessageMarksFilter;
|
|
12
|
+
/** How the list is fetched, for example its `pageSize`. */
|
|
13
|
+
paginatorOptions?: PaginatorOptions<MessageMarkWithUserResponse, QueryMessageMarksRequest>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Lists the marks on one message, with the users who made them, newest first. The API pages
|
|
17
|
+
* forward only, so the headward cursor starts exhausted (`null`). New marks are added at the head
|
|
18
|
+
* through `ingestItem`, which `client.messageMarks` calls for `message.mark_added`.
|
|
19
|
+
*
|
|
20
|
+
* With offline support, the first page opens with the marks the offline database holds while the
|
|
21
|
+
* request runs, and keeps them when the request fails.
|
|
22
|
+
*/
|
|
23
|
+
export declare class MessageMarkPaginator extends BasePaginator<MessageMarkWithUserResponse, QueryMessageMarksRequest> {
|
|
24
|
+
private client;
|
|
25
|
+
private readonly _id;
|
|
26
|
+
readonly messageId: string;
|
|
27
|
+
readonly filter: QueryMessageMarksFilter | undefined;
|
|
28
|
+
private activeRefCount;
|
|
29
|
+
private _isStateStale;
|
|
30
|
+
constructor(client: StreamChat, { id, messageId, filter, paginatorOptions }: MessageMarkPaginatorOptions);
|
|
31
|
+
get initialState(): PaginatorState<MessageMarkWithUserResponse>;
|
|
32
|
+
get id(): string;
|
|
33
|
+
getItemId(item: MessageMarkWithUserResponse): string;
|
|
34
|
+
/** See {@link MessageMarkPaginator.activate}. */
|
|
35
|
+
get active(): boolean;
|
|
36
|
+
/** Whether marks may have been missed, for example while the connection was down. */
|
|
37
|
+
get isStateStale(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Call this when a screen starts showing the list, and call the returned function when it stops.
|
|
40
|
+
* A stale list reloads as soon as it is shown. The list counts as shown until every caller has
|
|
41
|
+
* released it, and releasing twice does nothing.
|
|
42
|
+
*/
|
|
43
|
+
activate: () => (() => void);
|
|
44
|
+
/**
|
|
45
|
+
* Flags the loaded marks as possibly incomplete. An active list reloads now, an inactive one when
|
|
46
|
+
* it is next activated.
|
|
47
|
+
*/
|
|
48
|
+
markStale: () => void;
|
|
49
|
+
private reloadIfStale;
|
|
50
|
+
get isOfflineSupportEnabled(): boolean;
|
|
51
|
+
preloadFirstPageFromOfflineDb: () => Promise<MessageMarkWithUserResponse[] | undefined>;
|
|
52
|
+
placeQueryPage(params: PlaceQueryPageParams<MessageMarkWithUserResponse, QueryMessageMarksRequest>): ExecuteQueryReturnValue<MessageMarkWithUserResponse>;
|
|
53
|
+
protected buildMatchFilters(): {
|
|
54
|
+
type?: string;
|
|
55
|
+
message_id: string;
|
|
56
|
+
};
|
|
57
|
+
protected getNextQueryShape(): QueryMessageMarksRequest;
|
|
58
|
+
protected fetchQueryResponse: ({ direction, queryShape, }: PaginationQueryParams<QueryMessageMarksRequest>) => Promise<PaginationQueryReturnValue<MessageMarkWithUserResponse>>;
|
|
59
|
+
/** The extracting step of the query pipeline: the response is the page. */
|
|
60
|
+
protected extractQueryPage(response: PaginationQueryReturnValue<MessageMarkWithUserResponse>, _params: PaginationQueryParams<QueryMessageMarksRequest>): PaginationQueryReturnValue<MessageMarkWithUserResponse>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { PaginationQueryParams, PaginationQueryReturnValue, PaginatorOptions } from './BasePaginator';
|
|
2
|
+
import { BasePaginator } from './BasePaginator';
|
|
3
|
+
import type { EntityStore, EntityStoreChangeBatch } from '../../entityStore/EntityStore';
|
|
4
|
+
import type { StreamChat } from '../../client';
|
|
5
|
+
import type { QueryScheduledMessagesRequest, ScheduledMessageResponse, ScheduledMessagesFilter } from '../../gen/models';
|
|
6
|
+
export type ScheduledMessagePaginatorOptions = {
|
|
7
|
+
client: StreamChat;
|
|
8
|
+
/**
|
|
9
|
+
* The query filter, also deciding which ingested messages the list takes. `status` defaults to all
|
|
10
|
+
* the query accepts. Changed later through the `filter` setter.
|
|
11
|
+
*/
|
|
12
|
+
filter?: ScheduledMessagesFilter;
|
|
13
|
+
/** Generated when omitted. */
|
|
14
|
+
id?: string;
|
|
15
|
+
paginatorOptions?: PaginatorOptions<ScheduledMessageResponse, QueryScheduledMessagesRequest>;
|
|
16
|
+
/** Defaults to `client.scheduledMessageStore`. */
|
|
17
|
+
store?: EntityStore<ScheduledMessageResponse>;
|
|
18
|
+
};
|
|
19
|
+
/** The current user's scheduled messages, earliest `scheduled_at` first. */
|
|
20
|
+
export declare class ScheduledMessagePaginator extends BasePaginator<ScheduledMessageResponse, QueryScheduledMessagesRequest> {
|
|
21
|
+
private readonly client;
|
|
22
|
+
private readonly _id;
|
|
23
|
+
private _filter;
|
|
24
|
+
constructor({ client, filter, id, paginatorOptions, store, }: ScheduledMessagePaginatorOptions);
|
|
25
|
+
get id(): string;
|
|
26
|
+
/** The query filter, sent as given: without a `status` the server lists all it lists. */
|
|
27
|
+
get filter(): ScheduledMessagesFilter;
|
|
28
|
+
/** Replaces the filter and resets the list; load it again with `reload()`. */
|
|
29
|
+
set filter(filter: ScheduledMessagesFilter);
|
|
30
|
+
get cid(): string | undefined;
|
|
31
|
+
getItemId(item: ScheduledMessageResponse): string;
|
|
32
|
+
protected getNextQueryShape(): QueryScheduledMessagesRequest;
|
|
33
|
+
/**
|
|
34
|
+
* The query filter, with the server's default statuses when it names none: matching on `status`
|
|
35
|
+
* is what takes sent and canceled messages out of the list. The matcher reads the array as any of
|
|
36
|
+
* them.
|
|
37
|
+
*/
|
|
38
|
+
protected buildMatchFilters(): ScheduledMessagesFilter;
|
|
39
|
+
protected fetchQueryResponse: ({ direction, queryShape, }: PaginationQueryParams<QueryScheduledMessagesRequest>) => Promise<PaginationQueryReturnValue<ScheduledMessageResponse>>;
|
|
40
|
+
protected extractQueryPage(response: PaginationQueryReturnValue<ScheduledMessageResponse>): PaginationQueryReturnValue<ScheduledMessageResponse>;
|
|
41
|
+
filterQueryResults(items: ScheduledMessageResponse[]): ScheduledMessageResponse[];
|
|
42
|
+
ingestItem(item: ScheduledMessageResponse): boolean;
|
|
43
|
+
/** Places `item` by the list's filter and order: moves it, or takes it out when it no longer matches. */
|
|
44
|
+
private placeItem;
|
|
45
|
+
/** The IDs the list holds. */
|
|
46
|
+
getItemIds(): ReadonlySet<string>;
|
|
47
|
+
/** A page loaded and nothing more to load either way: the list holds every message it matches. */
|
|
48
|
+
private get holdsCompleteList();
|
|
49
|
+
/**
|
|
50
|
+
* Applies a complete set (e.g. a channel query's `scheduled_messages`) through the paginator's own
|
|
51
|
+
* operations: removes what was held at `itemIdsAtRequest` and is missing, and ingests the rest. A
|
|
52
|
+
* list that does not hold a complete set yet is replaced by it instead. Messages taken since the
|
|
53
|
+
* snapshot stay. Publishes once.
|
|
54
|
+
*/
|
|
55
|
+
hydrate(scheduledMessages: ScheduledMessageResponse[], itemIdsAtRequest?: ReadonlySet<string>): void;
|
|
56
|
+
/**
|
|
57
|
+
* Re-queries the first page and applies it in place: the current messages stay until the response
|
|
58
|
+
* lands, unlike the base `reload()`, which empties the list first. A complete response is applied
|
|
59
|
+
* as {@link hydrate} does; a longer list is replaced by its first page. Messages taken by events
|
|
60
|
+
* while the request was out stay. A failed query keeps the list and records `lastQueryError`; a
|
|
61
|
+
* success clears it. Only the first load publishes `isLoading`. A call while one is in flight
|
|
62
|
+
* joins it.
|
|
63
|
+
*/
|
|
64
|
+
reload: () => Promise<void>;
|
|
65
|
+
private reloadInFlight?;
|
|
66
|
+
private reloadGeneration;
|
|
67
|
+
private reloadWasSuperseded;
|
|
68
|
+
private reloadFirstPage;
|
|
69
|
+
/**
|
|
70
|
+
* Replaces the list with `page` as its first page. Messages taken by events since the request went
|
|
71
|
+
* out (held now, not at `itemIdsAtRequest`) stay; the others the page leaves out go. Publishes once.
|
|
72
|
+
*/
|
|
73
|
+
private replaceWithFirstPage;
|
|
74
|
+
/**
|
|
75
|
+
* Another list stored a newer copy of items this one holds. A change can move a scheduled message
|
|
76
|
+
* (`scheduled_at`) or take it out of this list (`status`), so each changed item is placed by this
|
|
77
|
+
* list's filter and order.
|
|
78
|
+
*/
|
|
79
|
+
onEntitiesChanged({ changedIds }: EntityStoreChangeBatch): void;
|
|
80
|
+
onEntityRemoved(id: string, item: unknown): void;
|
|
81
|
+
flushState(): void;
|
|
82
|
+
resetState(): void;
|
|
83
|
+
}
|
|
@@ -2,7 +2,9 @@ export * from './BasePaginator';
|
|
|
2
2
|
export * from './ChannelPaginator';
|
|
3
3
|
export { MessageIntervalPaginator } from './MessageIntervalPaginator';
|
|
4
4
|
export * from './MessagePaginator';
|
|
5
|
+
export * from './MessageMarkPaginator';
|
|
5
6
|
export * from './PinnedMessagePaginator';
|
|
6
7
|
export * from './ReminderPaginator';
|
|
8
|
+
export * from './ScheduledMessagePaginator';
|
|
7
9
|
export * from './UserGroupPaginator';
|
|
8
10
|
export * from './ThreadPaginator';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { StateStore } from '@stream-io/state-store';
|
|
2
|
+
import { EventHandlerPipeline } from '../EventHandlerPipeline';
|
|
3
|
+
import { WithSubscriptions } from '../utils/WithSubscriptions';
|
|
4
|
+
import type { Unsubscribe } from '@stream-io/state-store';
|
|
5
|
+
import type { StreamChat } from '../client';
|
|
6
|
+
import type { ScheduledMessageResponse } from '../gen/models';
|
|
7
|
+
import type { ScheduledMessagePaginator } from '../pagination/paginators/ScheduledMessagePaginator';
|
|
8
|
+
import type { AddScheduledMessageEventHandlerParams, RemoveScheduledMessageEventHandlersParams, ScheduledMessagePaginatorsManagerEventHandlerContext, ScheduledMessagePaginatorsManagerEventHandlers, ScheduledMessagePaginatorsManagerEventType, ScheduledMessagePaginatorsManagerOptions, ScheduledMessagePaginatorsManagerState, SetScheduledMessageEventHandlersParams } from './types';
|
|
9
|
+
export declare class ScheduledMessagePaginatorsManager extends WithSubscriptions {
|
|
10
|
+
private eventHandlerPipelines;
|
|
11
|
+
private queryErrorUnsubscribeByPaginator;
|
|
12
|
+
readonly client: StreamChat;
|
|
13
|
+
state: StateStore<ScheduledMessagePaginatorsManagerState>;
|
|
14
|
+
constructor({ client, eventHandlers, }: ScheduledMessagePaginatorsManagerOptions);
|
|
15
|
+
static getDefaultHandlers(): ScheduledMessagePaginatorsManagerEventHandlers;
|
|
16
|
+
get paginators(): ScheduledMessagePaginator[];
|
|
17
|
+
get isDisabled(): boolean;
|
|
18
|
+
get pipelines(): Map<ScheduledMessagePaginatorsManagerEventType, EventHandlerPipeline<ScheduledMessagePaginatorsManagerEventHandlerContext>>;
|
|
19
|
+
private get eventHandlerContext();
|
|
20
|
+
private installEventHandlers;
|
|
21
|
+
private watchQueryErrors;
|
|
22
|
+
private unwatchQueryErrors;
|
|
23
|
+
private updateIsDisabled;
|
|
24
|
+
ensurePipeline(eventType: ScheduledMessagePaginatorsManagerEventType): EventHandlerPipeline<ScheduledMessagePaginatorsManagerEventHandlerContext>;
|
|
25
|
+
addEventHandler({ eventType, ...payload }: AddScheduledMessageEventHandlerParams): Unsubscribe;
|
|
26
|
+
setEventHandlers({ eventType, handlers, }: SetScheduledMessageEventHandlersParams): void;
|
|
27
|
+
removeEventHandlers({ eventType, handlers, }: RemoveScheduledMessageEventHandlersParams): void;
|
|
28
|
+
getPaginatorById(id: string): ScheduledMessagePaginator | undefined;
|
|
29
|
+
setPaginators(paginators: ScheduledMessagePaginator[]): void;
|
|
30
|
+
clearPaginators(): ScheduledMessagePaginator[];
|
|
31
|
+
insertPaginator({ index, paginator, }: {
|
|
32
|
+
paginator: ScheduledMessagePaginator;
|
|
33
|
+
index?: number;
|
|
34
|
+
}): void;
|
|
35
|
+
removePaginator(paginatorOrId: ScheduledMessagePaginator | string): ScheduledMessagePaginator | undefined;
|
|
36
|
+
resetPaginatorStates(): void;
|
|
37
|
+
ingest: (scheduledMessage: ScheduledMessageResponse) => void;
|
|
38
|
+
recover: () => Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Starts syncing the registered lists with the client's WS events. Nothing keeps them in sync
|
|
41
|
+
* until this is called, so an integration has to call it once a user is connected and call the
|
|
42
|
+
* returned unsubscribe (or {@link unregisterSubscriptions}) on teardown. The Stream UI SDKs do
|
|
43
|
+
* this for you; a pure-LLC integration must do it itself. Ref-counted, so several holders can
|
|
44
|
+
* share one manager and only the last unsubscribe tears the subscriptions down.
|
|
45
|
+
*/
|
|
46
|
+
registerSubscriptions(): Unsubscribe;
|
|
47
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ScheduledMessageResponse } from '../gen/models';
|
|
2
|
+
export type ScheduledMessageOperationKind = 'schedule' | 'update' | 'cancel' | 'sendNow';
|
|
3
|
+
export type ScheduledMessageStatePolicyContext = {
|
|
4
|
+
ingest: (scheduledMessage: ScheduledMessageResponse) => void;
|
|
5
|
+
get: (id: string) => ScheduledMessageResponse | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare class ScheduledMessageStatePolicy {
|
|
8
|
+
private ctx;
|
|
9
|
+
constructor(ctx: ScheduledMessageStatePolicyContext);
|
|
10
|
+
success(kind: ScheduledMessageOperationKind, scheduledMessage: ScheduledMessageResponse | undefined): void;
|
|
11
|
+
failure(kind: ScheduledMessageOperationKind, id: string | undefined, error: unknown): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PaginatorViewState } from '../pagination/PaginatorView';
|
|
2
|
+
import { PaginatorView } from '../pagination/PaginatorView';
|
|
3
|
+
import type { ScheduledMessageResponse } from '../gen/models';
|
|
4
|
+
import type { ScheduledMessagePaginator } from '../pagination/paginators/ScheduledMessagePaginator';
|
|
5
|
+
/**
|
|
6
|
+
* Which of its paginator's scheduled messages a view shows.
|
|
7
|
+
* - `all`: every one, e.g. of a list registered with `client.scheduledMessagePaginators`.
|
|
8
|
+
* - `channel`: a channel's own, without thread replies.
|
|
9
|
+
* - `thread`: the replies of the thread whose parent message is `parentId`.
|
|
10
|
+
*/
|
|
11
|
+
export type ScheduledMessagesViewScope = {
|
|
12
|
+
type: 'all';
|
|
13
|
+
} | {
|
|
14
|
+
type: 'channel';
|
|
15
|
+
} | {
|
|
16
|
+
parentId: string;
|
|
17
|
+
type: 'thread';
|
|
18
|
+
};
|
|
19
|
+
export type ScheduledMessagesViewState = PaginatorViewState<ScheduledMessageResponse>;
|
|
20
|
+
export type ScheduledMessagesViewOptions = {
|
|
21
|
+
/** The list the messages come from. The view only reads it. */
|
|
22
|
+
paginator: ScheduledMessagePaginator;
|
|
23
|
+
/** Defaults to `{ type: 'all' }`. */
|
|
24
|
+
scope?: ScheduledMessagesViewScope;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A scope of a `ScheduledMessagePaginator`, e.g. a channel's own scheduled messages or a thread's
|
|
28
|
+
* scheduled replies. The server cannot filter scheduled messages by thread, so a channel's
|
|
29
|
+
* paginator holds both, and each scope is a `PaginatorView` of it rather than a list of
|
|
30
|
+
* its own. `Channel` and `Thread` hold theirs registered while they are.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ScheduledMessagesView extends PaginatorView<ScheduledMessageResponse> {
|
|
33
|
+
readonly paginator: ScheduledMessagePaginator;
|
|
34
|
+
readonly scope: ScheduledMessagesViewScope;
|
|
35
|
+
constructor({ paginator, scope }: ScheduledMessagesViewOptions);
|
|
36
|
+
/** The thread's parent message ID, for a `thread` scope. */
|
|
37
|
+
get parentId(): string | undefined;
|
|
38
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { MessageRequest, ScheduledMessageResponse } from '../gen/models';
|
|
2
|
+
import type { DraftMessage, LocalMessage } from '../types';
|
|
3
|
+
export declare const toComposerContent: (scheduledMessage: ScheduledMessageResponse) => DraftMessage;
|
|
4
|
+
export declare const toScheduledMessagePayload: (composedMessage: MessageRequest, scheduledMessage: ScheduledMessageResponse) => MessageRequest;
|
|
5
|
+
export declare const toScheduledMessagePreview: (scheduledMessage: ScheduledMessageResponse) => LocalMessage;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ScheduledMessageQueryStatus } from '../gen/models';
|
|
2
|
+
export declare const SCHEDULED_MESSAGE_STATUS: {
|
|
3
|
+
readonly Canceled: "canceled";
|
|
4
|
+
readonly Failed: "failed";
|
|
5
|
+
readonly Scheduled: "scheduled";
|
|
6
|
+
readonly Sending: "sending";
|
|
7
|
+
readonly Sent: "sent";
|
|
8
|
+
};
|
|
9
|
+
export declare const SCHEDULED_MESSAGE_ACTIVE_STATUSES: ScheduledMessageQueryStatus[];
|
|
10
|
+
export declare const SCHEDULED_MESSAGE_FAILURE_REASON: {
|
|
11
|
+
readonly Banned: "banned";
|
|
12
|
+
readonly ChannelDeleted: "channel_deleted";
|
|
13
|
+
readonly ChannelFrozen: "channel_frozen";
|
|
14
|
+
readonly Expired: "expired";
|
|
15
|
+
readonly HookRejected: "hook_rejected";
|
|
16
|
+
readonly InternalError: "internal_error";
|
|
17
|
+
readonly InvalidMessage: "invalid_message";
|
|
18
|
+
readonly ModerationBlocked: "moderation_blocked";
|
|
19
|
+
readonly NoPermission: "no_permission";
|
|
20
|
+
readonly PendingNotSupported: "pending_not_supported";
|
|
21
|
+
readonly UserDeleted: "user_deleted";
|
|
22
|
+
};
|
|
23
|
+
export declare const ScheduledMessageErrorReason: {
|
|
24
|
+
readonly AlreadySent: "scheduled_message_already_sent";
|
|
25
|
+
readonly Canceled: "scheduled_message_canceled";
|
|
26
|
+
readonly ChannelLimit: "scheduled_limit_channel";
|
|
27
|
+
readonly Conflict: "scheduled_message_conflict";
|
|
28
|
+
readonly Disabled: "scheduled_messages_disabled";
|
|
29
|
+
readonly IdTaken: "scheduled_message_id_taken";
|
|
30
|
+
readonly NotEditable: "scheduled_message_not_editable";
|
|
31
|
+
readonly Sending: "scheduled_message_sending";
|
|
32
|
+
readonly TooFar: "scheduled_at_too_far";
|
|
33
|
+
readonly TooSoon: "scheduled_at_too_soon";
|
|
34
|
+
readonly UserLimit: "scheduled_limit_user";
|
|
35
|
+
};
|
|
36
|
+
export type ScheduledMessageErrorReason = (typeof ScheduledMessageErrorReason)[keyof typeof ScheduledMessageErrorReason];
|
|
37
|
+
export declare const ScheduledMessageBlockReason: {
|
|
38
|
+
readonly Command: "command";
|
|
39
|
+
readonly SharedLocation: "shared_location";
|
|
40
|
+
readonly Unavailable: "unavailable";
|
|
41
|
+
};
|
|
42
|
+
export type ScheduledMessageBlockReason = (typeof ScheduledMessageBlockReason)[keyof typeof ScheduledMessageBlockReason];
|
|
43
|
+
export declare const ScheduledMessageCompositionEndReason: {
|
|
44
|
+
readonly Deleted: "deleted";
|
|
45
|
+
readonly Failed: "failed";
|
|
46
|
+
readonly Sent: "sent";
|
|
47
|
+
};
|
|
48
|
+
export type ScheduledMessageCompositionEndReason = (typeof ScheduledMessageCompositionEndReason)[keyof typeof ScheduledMessageCompositionEndReason];
|
|
49
|
+
export declare const ScheduledMessageEventType: {
|
|
50
|
+
readonly Created: "scheduled_message.created";
|
|
51
|
+
readonly Deleted: "scheduled_message.deleted";
|
|
52
|
+
readonly Failed: "scheduled_message.failed";
|
|
53
|
+
readonly Sent: "scheduled_message.sent";
|
|
54
|
+
readonly Updated: "scheduled_message.updated";
|
|
55
|
+
};
|
|
56
|
+
export type ScheduledMessageEventType = (typeof ScheduledMessageEventType)[keyof typeof ScheduledMessageEventType];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StreamChat } from '../client';
|
|
2
|
+
import type { LocalMessage, UserResponse } from '../types';
|
|
3
|
+
export declare const resolveUsersByIds: (client: StreamChat, userIds?: string[]) => Promise<UserResponse[]>;
|
|
4
|
+
export declare const resolveMessageById: (client: StreamChat, id: string) => Promise<LocalMessage | null>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ScheduledMessageResponse } from '../gen/models';
|
|
2
|
+
import type { ScheduledMessagePaginatorsManagerEventHandlers } from './types';
|
|
3
|
+
/** The event's scheduled message in the status the event leaves it in (`deleted` → canceled, `sent` → sent). */
|
|
4
|
+
export declare const getScheduledMessageFromEvent: ({ scheduled_message: scheduledMessage, type, }: {
|
|
5
|
+
scheduled_message?: ScheduledMessageResponse;
|
|
6
|
+
type: string;
|
|
7
|
+
}) => ScheduledMessageResponse | undefined;
|
|
8
|
+
export declare const DEFAULT_SCHEDULED_MESSAGE_EVENT_HANDLERS: ScheduledMessagePaginatorsManagerEventHandlers;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './ScheduledMessagePaginatorsManager';
|
|
2
|
+
export { toScheduledMessagePreview } from './composition';
|
|
3
|
+
export * from './constants';
|
|
4
|
+
export * from './errors';
|
|
5
|
+
export * from './limits';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export * from './ScheduledMessagesView';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Channel } from '../channel';
|
|
2
|
+
import type { ScheduledMessageLimits } from './types';
|
|
3
|
+
type ChannelServerConfig = Channel['serverConfig'];
|
|
4
|
+
export declare const getScheduledMessageLimitsFromServerConfig: (serverConfig: ChannelServerConfig) => ScheduledMessageLimits | undefined;
|
|
5
|
+
export declare const getScheduledMessageLimits: (channel: Channel) => ScheduledMessageLimits | undefined;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { StreamChat } from '../client';
|
|
2
|
+
import type { FindEventHandlerParams, InsertEventHandlerPayload, LabeledEventHandler } from '../EventHandlerPipeline';
|
|
3
|
+
import type { DeleteScheduledMessageResponse, MessageRequest, SendMessageRequest, SendMessageResponse, SendScheduledMessageNowResponse, UpdateScheduledMessageRequest, UpdateScheduledMessageResponse } from '../gen/models';
|
|
4
|
+
import type { EventType, LocalMessage, SendMessageOptions, StreamResponse } from '../types';
|
|
5
|
+
import type { ScheduledMessagePaginator } from '../pagination/paginators/ScheduledMessagePaginator';
|
|
6
|
+
import type { ScheduledMessagePaginatorsManager } from './ScheduledMessagePaginatorsManager';
|
|
7
|
+
export type ScheduledMessagePaginatorsManagerState = {
|
|
8
|
+
/** A registered list's last query failed with error 114 (feature off). */
|
|
9
|
+
isDisabled: boolean;
|
|
10
|
+
paginators: ScheduledMessagePaginator[];
|
|
11
|
+
};
|
|
12
|
+
export type ScheduledMessagePaginatorsManagerEventHandlerContext = {
|
|
13
|
+
scheduledMessagePaginators: ScheduledMessagePaginatorsManager;
|
|
14
|
+
};
|
|
15
|
+
export type ScheduledMessagePaginatorsManagerEventType = EventType | (string & {});
|
|
16
|
+
export type ScheduledMessagePaginatorsManagerEventHandlers = Partial<Record<ScheduledMessagePaginatorsManagerEventType, LabeledEventHandler<ScheduledMessagePaginatorsManagerEventHandlerContext>[]>>;
|
|
17
|
+
export type AddScheduledMessageEventHandlerParams = {
|
|
18
|
+
eventType: ScheduledMessagePaginatorsManagerEventType;
|
|
19
|
+
} & InsertEventHandlerPayload<ScheduledMessagePaginatorsManagerEventHandlerContext>;
|
|
20
|
+
export type SetScheduledMessageEventHandlersParams = {
|
|
21
|
+
eventType: ScheduledMessagePaginatorsManagerEventType;
|
|
22
|
+
handlers: LabeledEventHandler<ScheduledMessagePaginatorsManagerEventHandlerContext>[];
|
|
23
|
+
};
|
|
24
|
+
export type RemoveScheduledMessageEventHandlersParams = {
|
|
25
|
+
eventType: ScheduledMessagePaginatorsManagerEventType;
|
|
26
|
+
handlers: FindEventHandlerParams<ScheduledMessagePaginatorsManagerEventHandlerContext>[];
|
|
27
|
+
};
|
|
28
|
+
export type DefaultScheduledMessageRequest<TParams, TResponse> = (params: TParams) => Promise<StreamResponse<TResponse>>;
|
|
29
|
+
export type ScheduledMessageRequestFn<TParams, TResponse> = (params: TParams, defaultRequest: DefaultScheduledMessageRequest<TParams, TResponse>) => Promise<StreamResponse<TResponse>>;
|
|
30
|
+
export type ScheduleMessageParams = {
|
|
31
|
+
message: MessageRequest;
|
|
32
|
+
options?: SendMessageOptions;
|
|
33
|
+
localMessage?: LocalMessage;
|
|
34
|
+
};
|
|
35
|
+
export type UpdateScheduledMessageParams = {
|
|
36
|
+
request: UpdateScheduledMessageRequest;
|
|
37
|
+
localMessage?: LocalMessage;
|
|
38
|
+
};
|
|
39
|
+
export type ScheduledMessageIdRequestParams = {
|
|
40
|
+
id: string;
|
|
41
|
+
};
|
|
42
|
+
export type UpdateScheduledMessageRequestParams = {
|
|
43
|
+
id: string;
|
|
44
|
+
request: UpdateScheduledMessageRequest;
|
|
45
|
+
};
|
|
46
|
+
export type ScheduleMessageRequestFn = ScheduledMessageRequestFn<SendMessageRequest, SendMessageResponse>;
|
|
47
|
+
export type UpdateScheduledMessageRequestFn = ScheduledMessageRequestFn<UpdateScheduledMessageRequestParams, UpdateScheduledMessageResponse>;
|
|
48
|
+
export type DeleteScheduledMessageRequestFn = ScheduledMessageRequestFn<ScheduledMessageIdRequestParams, DeleteScheduledMessageResponse>;
|
|
49
|
+
export type SendScheduledMessageNowRequestFn = ScheduledMessageRequestFn<ScheduledMessageIdRequestParams, SendScheduledMessageNowResponse>;
|
|
50
|
+
export type ScheduledMessageRequestHandlers = {
|
|
51
|
+
deleteScheduledMessageRequest?: DeleteScheduledMessageRequestFn;
|
|
52
|
+
scheduleMessageRequest?: ScheduleMessageRequestFn;
|
|
53
|
+
sendScheduledMessageNowRequest?: SendScheduledMessageNowRequestFn;
|
|
54
|
+
updateScheduledMessageRequest?: UpdateScheduledMessageRequestFn;
|
|
55
|
+
};
|
|
56
|
+
export type ScheduledMessagePaginatorsManagerOptions = {
|
|
57
|
+
client: StreamChat;
|
|
58
|
+
eventHandlers?: ScheduledMessagePaginatorsManagerEventHandlers;
|
|
59
|
+
};
|
|
60
|
+
export type ScheduledMessageLimits = {
|
|
61
|
+
maxLeadTimeSeconds: number;
|
|
62
|
+
maxPerChannel: number;
|
|
63
|
+
maxPerUser: number;
|
|
64
|
+
minLeadTimeSeconds: number;
|
|
65
|
+
};
|
package/dist/types/thread.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { CustomThreadData } from './custom_types';
|
|
|
6
6
|
import { MessageComposer } from './messageComposer';
|
|
7
7
|
import type { MessageOperations } from './messageOperations';
|
|
8
8
|
import { WithSubscriptions } from './utils/WithSubscriptions';
|
|
9
|
+
import { ScheduledMessagesView } from './scheduledMessages/ScheduledMessagesView';
|
|
9
10
|
import { MessagePaginator } from './pagination';
|
|
10
11
|
import type { ReconcileNewestMessagesOptions } from './pagination';
|
|
11
12
|
import type { ThreadDeclarativeConfig } from './configuration/types';
|
|
@@ -57,6 +58,13 @@ export declare class Thread extends WithSubscriptions {
|
|
|
57
58
|
readonly messageComposer: MessageComposer;
|
|
58
59
|
readonly messageOperations: MessageOperations;
|
|
59
60
|
readonly messagePaginator: MessagePaginator;
|
|
61
|
+
/**
|
|
62
|
+
* The current user's scheduled replies in this thread: a view of the channel's
|
|
63
|
+
* `scheduledMessagesPaginator`, which holds the channel's scheduled messages and replies alike
|
|
64
|
+
* (the server cannot filter them by thread). Follows it while the thread's subscriptions are
|
|
65
|
+
* registered.
|
|
66
|
+
*/
|
|
67
|
+
readonly scheduledMessages: ScheduledMessagesView;
|
|
60
68
|
private client;
|
|
61
69
|
private failedRepliesMap;
|
|
62
70
|
private _activeRefCount;
|
|
@@ -123,6 +131,7 @@ export declare class Thread extends WithSubscriptions {
|
|
|
123
131
|
handleThreadUpdated: (event: EventPayload<"thread.updated">) => void;
|
|
124
132
|
private subscribeMarkActiveThreadRead;
|
|
125
133
|
private subscribeReloadActiveStaleThread;
|
|
134
|
+
private subscribeLoadScheduledMessagesWhenActive;
|
|
126
135
|
/**
|
|
127
136
|
* A watch stopped while the connection stays up (`NotWatching`) ends the channel's events with no
|
|
128
137
|
* reconnect to catch it. A dropped connection (`WasWatching`) is left to recovery.
|
|
@@ -162,5 +171,7 @@ export declare class Thread extends WithSubscriptions {
|
|
|
162
171
|
}
|
|
163
172
|
/** `participant_limit` of the single-thread requests (`getThreadAndHydrate`, `reload()`). */
|
|
164
173
|
export declare const DEFAULT_THREAD_PARTICIPANT_LIMIT = 100;
|
|
165
|
-
/**
|
|
174
|
+
/**
|
|
175
|
+
* The thread's channel, with the members, custom data and server config of `threadData` applied.
|
|
176
|
+
*/
|
|
166
177
|
export declare const ensureThreadChannel: (client: StreamChat, threadData: ThreadStateResponse) => Channel;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ export declare function logChatPromiseExecution<T>(promise: Promise<T>, name: st
|
|
|
16
16
|
export declare const invokeEventListener: <T>(listener: (event: T) => unknown, event: T, scopedLogger: ScopedLogger) => void;
|
|
17
17
|
export declare const sleep: (m: number) => Promise<void>;
|
|
18
18
|
export declare function isFunction(value: unknown): value is (...args: unknown[]) => unknown;
|
|
19
|
+
export declare const pickFields: <T extends object, K extends keyof T>(source: T, fields: readonly K[]) => Pick<T, K>;
|
|
20
|
+
export declare const omitFields: <T extends object>(source: T, fields: ReadonlySet<string>) => {
|
|
21
|
+
[k: string]: any;
|
|
22
|
+
};
|
|
19
23
|
export declare const chatCodes: {
|
|
20
24
|
TOKEN_EXPIRED: number;
|
|
21
25
|
WS_CLOSED_SUCCESS: number;
|
|
@@ -24,6 +28,7 @@ export declare function isOwnUser(user?: OwnUserResponse | UserResponse): user i
|
|
|
24
28
|
export declare function isOwnUserBaseProperty(property: string): boolean;
|
|
25
29
|
/** Whether `read-events` is among the own capabilities (true while they are not loaded). */
|
|
26
30
|
export declare const channelHasReadEvents: (channel?: Channel) => boolean;
|
|
31
|
+
export declare const channelCanScheduleMessages: (channel?: Channel) => boolean;
|
|
27
32
|
/** Whether read events are off and the channel keeps a client-local unread count. */
|
|
28
33
|
export declare const channelTracksReadLocally: (channel?: Channel) => boolean;
|
|
29
34
|
/** A random retry delay in milliseconds that grows with `numberOfFailures`. */
|
|
@@ -136,10 +141,12 @@ export declare const toDeletedMessage: ({ message, deletedAt, hardDelete, }: {
|
|
|
136
141
|
mentioned_group_ids?: Array<string>;
|
|
137
142
|
mentioned_groups?: Array<import(".").UserGroupResponse>;
|
|
138
143
|
mentioned_roles?: Array<string>;
|
|
144
|
+
own_marks?: Array<import(".").OwnMarkResponse>;
|
|
139
145
|
thread_participants?: Array<UserResponse>;
|
|
140
146
|
draft?: import(".").DraftResponse;
|
|
141
147
|
i18n?: Record<string, string>;
|
|
142
148
|
image_labels?: Record<string, Array<string>>;
|
|
149
|
+
mark_groups?: Record<string, import(".").MarkGroupResponse>;
|
|
143
150
|
member?: import(".").ChannelMemberPartialResponse;
|
|
144
151
|
mentioned_channel_members?: Record<string, import(".").ChannelMemberPartialResponse>;
|
|
145
152
|
moderation?: import(".").ModerationV2Response;
|