stream-chat 9.50.2 → 10.0.0-rc.1
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 +18869 -13986
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +18888 -13992
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +18866 -13983
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelPaginatorsOrchestrator.d.ts +130 -0
- package/dist/types/EventHandlerPipeline.d.ts +104 -0
- package/dist/types/api-client.d.ts +26 -0
- package/dist/types/campaign.d.ts +0 -44
- package/dist/types/channel.d.ts +436 -480
- package/dist/types/channel_batch_updater.d.ts +0 -93
- package/dist/types/channel_manager.d.ts +8 -10
- package/dist/types/channel_state.d.ts +53 -201
- package/dist/types/client.d.ts +440 -1910
- package/dist/types/client_state.d.ts +4 -4
- package/dist/types/configuration/InstanceConfigurationService.d.ts +26 -0
- package/dist/types/configuration/index.d.ts +1 -0
- package/dist/types/configuration/types.d.ts +53 -0
- package/dist/types/connection.d.ts +49 -41
- package/dist/types/connection_fallback.d.ts +6 -4
- package/dist/types/constants.d.ts +0 -4
- package/dist/types/custom_types.d.ts +2 -0
- package/dist/types/errors.d.ts +2 -2
- package/dist/types/gen/chat/ChannelApi.d.ts +45 -0
- package/dist/types/gen/chat/ChatApi.d.ts +334 -0
- package/dist/types/gen/model-decoders/decoders.d.ts +3 -0
- package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts +6 -0
- package/dist/types/gen/models/index.d.ts +8836 -0
- package/dist/types/gen/moderation/ModerationApi.d.ts +50 -0
- package/dist/types/gen-imports.d.ts +3 -0
- package/dist/types/index.d.ts +5 -5
- package/dist/types/insights.d.ts +7 -6
- package/dist/types/logger.d.ts +9 -0
- package/dist/types/messageComposer/LocationComposer.d.ts +7 -4
- package/dist/types/messageComposer/attachmentIdentity.d.ts +2 -2
- package/dist/types/messageComposer/attachmentManager.d.ts +8 -4
- package/dist/types/messageComposer/configuration/types.d.ts +11 -11
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +25 -13
- package/dist/types/messageComposer/messageComposer.d.ts +10 -10
- package/dist/types/messageComposer/middleware/messageComposer/types.d.ts +3 -3
- package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +4 -7
- package/dist/types/messageComposer/middleware/textComposer/commandUtils.d.ts +3 -3
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +7 -7
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +218 -4
- package/dist/types/messageComposer/middleware/textComposer/types.d.ts +9 -4
- package/dist/types/messageComposer/pollComposer.d.ts +5 -4
- package/dist/types/messageComposer/textComposer.d.ts +8 -3
- package/dist/types/messageComposer/types.d.ts +6 -28
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +40 -25
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +53 -12
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +19 -0
- package/dist/types/messageOperations/MessageOperations.d.ts +17 -0
- package/dist/types/messageOperations/index.d.ts +3 -0
- package/dist/types/messageOperations/types.d.ts +49 -0
- package/dist/types/moderation.d.ts +21 -203
- package/dist/types/notifications/types.d.ts +8 -7
- package/dist/types/offline-support/offline_support_api.d.ts +110 -87
- package/dist/types/offline-support/types.d.ts +19 -23
- package/dist/types/offline-support/util.d.ts +4 -2
- package/dist/types/pagination/FilterBuilder.d.ts +1 -1
- package/dist/types/pagination/ItemIndex.d.ts +82 -0
- package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +9 -0
- package/dist/types/pagination/cursorDerivation/idAroundPaginationFlags.d.ts +6 -0
- package/dist/types/pagination/cursorDerivation/index.d.ts +1 -0
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +6 -0
- package/dist/types/pagination/filterCompiler.d.ts +7 -0
- package/dist/types/pagination/index.d.ts +1 -3
- package/dist/types/pagination/paginators/BasePaginator.d.ts +709 -0
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +58 -0
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +260 -0
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +208 -0
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +39 -0
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +19 -0
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +24 -0
- package/dist/types/pagination/paginators/index.d.ts +7 -0
- package/dist/types/pagination/sortCompiler.d.ts +49 -0
- package/dist/types/pagination/types.normalization.d.ts +11 -0
- package/dist/types/pagination/utility.normalization.d.ts +18 -0
- package/dist/types/pagination/utility.queryChannel.d.ts +26 -0
- package/dist/types/pagination/utility.search.d.ts +13 -0
- package/dist/types/permissions.d.ts +1 -1
- package/dist/types/poll.d.ts +29 -32
- package/dist/types/poll_manager.d.ts +2 -2
- package/dist/types/reminders/Reminder.d.ts +2 -5
- package/dist/types/reminders/ReminderManager.d.ts +2 -9
- package/dist/types/search/MessageSearchSource.d.ts +4 -4
- package/dist/types/search/UserSearchSource.d.ts +1 -1
- package/dist/types/search/types.d.ts +3 -3
- package/dist/types/segment.d.ts +0 -34
- package/dist/types/signing.d.ts +105 -65
- package/dist/types/store.d.ts +1 -0
- package/dist/types/thread.d.ts +51 -34
- package/dist/types/thread_manager.d.ts +3 -3
- package/dist/types/token_manager.d.ts +15 -10
- package/dist/types/types.d.ts +196 -3384
- package/dist/types/utils/FixedSizeQueueCache.d.ts +12 -6
- package/dist/types/utils/WithSubscriptions.d.ts +2 -1
- package/dist/types/utils/concurrency.d.ts +4 -4
- package/dist/types/utils/mergeWith/mergeWith.d.ts +3 -3
- package/dist/types/utils/mergeWith/mergeWithCore.d.ts +8 -3
- package/dist/types/utils/retryable.d.ts +34 -0
- package/dist/types/utils.d.ts +104 -137
- package/package.json +7 -3
- package/src/ChannelPaginatorsOrchestrator.ts +545 -0
- package/src/CooldownTimer.ts +2 -2
- package/src/EventHandlerPipeline.ts +228 -0
- package/src/LiveLocationManager.ts +12 -11
- package/src/api-client.ts +275 -0
- package/src/campaign.ts +1 -77
- package/src/channel.ts +1262 -1277
- package/src/channel_batch_updater.ts +1 -211
- package/src/channel_manager.ts +92 -88
- package/src/channel_state.ts +144 -1013
- package/src/client.ts +888 -3944
- package/src/client_state.ts +4 -4
- package/src/configuration/InstanceConfigurationService.ts +73 -0
- package/src/configuration/index.ts +1 -0
- package/src/configuration/types.ts +81 -0
- package/src/connection.ts +145 -94
- package/src/connection_fallback.ts +29 -27
- package/src/constants.ts +1 -5
- package/src/custom_types.ts +4 -1
- package/src/errors.ts +2 -2
- package/src/gen/chat/ChannelApi.ts +275 -0
- package/src/gen/chat/ChatApi.ts +2554 -0
- package/src/gen/model-decoders/decoders.ts +2680 -0
- package/src/gen/model-decoders/event-decoder-mapping.ts +198 -0
- package/src/gen/models/index.ts +12673 -0
- package/src/gen/moderation/ModerationApi.ts +607 -0
- package/src/gen-imports.ts +3 -0
- package/src/index.ts +5 -10
- package/src/insights.ts +6 -5
- package/src/logger.ts +28 -0
- package/src/messageComposer/LocationComposer.ts +9 -5
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -0
- package/src/messageComposer/attachmentIdentity.ts +16 -9
- package/src/messageComposer/attachmentManager.ts +13 -8
- package/src/messageComposer/configuration/types.ts +11 -11
- package/src/messageComposer/linkPreviewsManager.ts +9 -10
- package/src/messageComposer/messageComposer.ts +57 -53
- package/src/messageComposer/middleware/messageComposer/attachments.ts +1 -2
- package/src/messageComposer/middleware/messageComposer/cleanData.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/compositionValidation.ts +2 -2
- package/src/messageComposer/middleware/messageComposer/messageComposerState.ts +2 -2
- package/src/messageComposer/middleware/messageComposer/sharedLocation.ts +4 -3
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +2 -2
- package/src/messageComposer/middleware/messageComposer/types.ts +3 -4
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +9 -5
- package/src/messageComposer/middleware/pollComposer/state.ts +0 -2
- package/src/messageComposer/middleware/pollComposer/types.ts +4 -7
- package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +10 -1
- package/src/messageComposer/middleware/textComposer/commandEffects.ts +4 -4
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +3 -6
- package/src/messageComposer/middleware/textComposer/commands.ts +3 -3
- package/src/messageComposer/middleware/textComposer/mentionUtils.ts +1 -1
- package/src/messageComposer/middleware/textComposer/mentions.ts +31 -15
- package/src/messageComposer/middleware/textComposer/types.ts +9 -4
- package/src/messageComposer/pollComposer.ts +6 -8
- package/src/messageComposer/textComposer.ts +27 -2
- package/src/messageComposer/types.ts +6 -28
- package/src/messageDelivery/MessageDeliveryReporter.ts +101 -45
- package/src/messageDelivery/MessageReceiptsTracker.ts +294 -21
- package/src/messageOperations/MessageOperationStatePolicy.ts +77 -0
- package/src/messageOperations/MessageOperations.ts +212 -0
- package/src/messageOperations/index.ts +10 -0
- package/src/messageOperations/types.ts +64 -0
- package/src/moderation.ts +38 -431
- package/src/notifications/types.ts +8 -7
- package/src/offline-support/offline_support_api.ts +198 -132
- package/src/offline-support/offline_sync_manager.ts +17 -7
- package/src/offline-support/types.ts +23 -26
- package/src/offline-support/util.ts +5 -4
- package/src/pagination/FilterBuilder.ts +4 -1
- package/src/pagination/ItemIndex.ts +112 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +73 -0
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +53 -0
- package/src/pagination/cursorDerivation/index.ts +1 -0
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +86 -0
- package/src/pagination/filterCompiler.ts +196 -0
- package/src/pagination/index.ts +1 -3
- package/src/pagination/paginators/BasePaginator.ts +2393 -0
- package/src/pagination/paginators/ChannelPaginator.ts +427 -0
- package/src/pagination/paginators/MessageIntervalPaginator.ts +1073 -0
- package/src/pagination/paginators/MessagePaginator.ts +496 -0
- package/src/pagination/paginators/PinnedMessagePaginator.ts +105 -0
- package/src/pagination/paginators/ReminderPaginator.ts +105 -0
- package/src/pagination/paginators/UserGroupPaginator.ts +125 -0
- package/src/pagination/paginators/index.ts +7 -0
- package/src/pagination/sortCompiler.ts +178 -0
- package/src/pagination/types.normalization.ts +14 -0
- package/src/pagination/utility.normalization.ts +106 -0
- package/src/pagination/utility.queryChannel.ts +84 -0
- package/src/pagination/utility.search.ts +80 -0
- package/src/permissions.ts +7 -8
- package/src/poll.ts +101 -110
- package/src/poll_manager.ts +14 -8
- package/src/reminders/Reminder.ts +2 -5
- package/src/reminders/ReminderManager.ts +19 -21
- package/src/search/BaseSearchSource.ts +0 -3
- package/src/search/ChannelMemberSearchSource.ts +7 -1
- package/src/search/ChannelSearchSource.ts +10 -3
- package/src/search/MessageSearchSource.ts +29 -30
- package/src/search/UserSearchSource.ts +12 -8
- package/src/search/types.ts +3 -4
- package/src/segment.ts +1 -95
- package/src/signing.ts +107 -67
- package/src/store.ts +2 -1
- package/src/thread.ts +439 -236
- package/src/thread_manager.ts +36 -15
- package/src/token_manager.ts +21 -10
- package/src/types.ts +375 -4524
- package/src/uploadManager.ts +8 -0
- package/src/utils/FixedSizeQueueCache.ts +12 -6
- package/src/utils/WithSubscriptions.ts +2 -1
- package/src/utils/concurrency.ts +4 -4
- package/src/utils/mergeWith/mergeWith.ts +3 -3
- package/src/utils/mergeWith/mergeWithCore.ts +140 -164
- package/src/utils/mergeWith/mergeWithDiff.ts +3 -3
- package/src/utils/retryable.ts +117 -0
- package/src/utils.ts +133 -524
- package/dist/types/events.d.ts +0 -72
- package/dist/types/pagination/BasePaginator.d.ts +0 -69
- package/dist/types/pagination/ReminderPaginator.d.ts +0 -16
- package/dist/types/pagination/UserGroupPaginator.d.ts +0 -21
- package/src/events.ts +0 -75
- package/src/pagination/BasePaginator.ts +0 -184
- package/src/pagination/ReminderPaginator.ts +0 -56
- package/src/pagination/UserGroupPaginator.ts +0 -93
package/dist/types/thread.d.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { StateStore } from './store';
|
|
2
|
-
import type {
|
|
3
|
-
import type { Channel } from './channel';
|
|
2
|
+
import type { DraftResponse, EventAPIResponse, LocalMessage, MarkReadRequest, MessageResponse, ThreadStateResponse, UserResponse } from './types';
|
|
3
|
+
import type { Channel, DeleteMessageWithStateUpdateParams, SendMessageWithStateUpdateParams, UpdateMessageWithStateUpdateParams } from './channel';
|
|
4
4
|
import type { StreamChat } from './client';
|
|
5
5
|
import type { CustomThreadData } from './custom_types';
|
|
6
6
|
import { MessageComposer } from './messageComposer';
|
|
7
|
+
import { MessageOperations } from './messageOperations';
|
|
7
8
|
import { WithSubscriptions } from './utils/WithSubscriptions';
|
|
8
|
-
|
|
9
|
-
sort?: {
|
|
10
|
-
created_at: AscDesc;
|
|
11
|
-
}[];
|
|
12
|
-
} & MessagePaginationOptions & {
|
|
13
|
-
user?: UserResponse;
|
|
14
|
-
user_id?: string;
|
|
15
|
-
};
|
|
9
|
+
import { MessagePaginator } from './pagination';
|
|
16
10
|
export type ThreadState = {
|
|
17
11
|
/**
|
|
18
12
|
* Determines if the thread is currently opened and on-screen. When the thread is active,
|
|
@@ -25,25 +19,17 @@ export type ThreadState = {
|
|
|
25
19
|
deletedAt: Date | null;
|
|
26
20
|
isLoading: boolean;
|
|
27
21
|
isStateStale: boolean;
|
|
28
|
-
pagination: ThreadRepliesPagination;
|
|
29
22
|
/**
|
|
30
23
|
* Thread is identified by and has a one-to-one relation with its parent message.
|
|
31
24
|
* We use parent message id as a thread id.
|
|
32
25
|
*/
|
|
33
26
|
parentMessage: LocalMessage;
|
|
34
|
-
participants:
|
|
27
|
+
participants: ThreadStateResponse['thread_participants'];
|
|
35
28
|
read: ThreadReadState;
|
|
36
|
-
replies: Array<LocalMessage>;
|
|
37
29
|
replyCount: number;
|
|
38
30
|
title: string;
|
|
39
31
|
updatedAt: Date | null;
|
|
40
32
|
};
|
|
41
|
-
export type ThreadRepliesPagination = {
|
|
42
|
-
isLoadingNext: boolean;
|
|
43
|
-
isLoadingPrev: boolean;
|
|
44
|
-
nextCursor: string | null;
|
|
45
|
-
prevCursor: string | null;
|
|
46
|
-
};
|
|
47
33
|
export type ThreadUserReadState = {
|
|
48
34
|
lastReadAt: Date;
|
|
49
35
|
unreadMessageCount: number;
|
|
@@ -52,16 +38,30 @@ export type ThreadUserReadState = {
|
|
|
52
38
|
firstUnreadMessageId?: string;
|
|
53
39
|
};
|
|
54
40
|
export type ThreadReadState = Record<string, ThreadUserReadState | undefined>;
|
|
55
|
-
export
|
|
41
|
+
export type CustomThreadMarkReadRequestFn = (params: {
|
|
42
|
+
thread: Thread;
|
|
43
|
+
options?: MarkReadRequest;
|
|
44
|
+
}) => Promise<EventAPIResponse | null> | void;
|
|
45
|
+
export type ThreadInstanceConfig = {
|
|
46
|
+
requestHandlers?: {
|
|
47
|
+
markReadRequest?: CustomThreadMarkReadRequestFn;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
56
50
|
export declare class Thread extends WithSubscriptions {
|
|
51
|
+
readonly configState: StateStore<ThreadInstanceConfig>;
|
|
57
52
|
readonly state: StateStore<ThreadState>;
|
|
58
53
|
readonly id: string;
|
|
59
54
|
readonly messageComposer: MessageComposer;
|
|
55
|
+
readonly messagePaginator: MessagePaginator;
|
|
56
|
+
readonly messageOperations: MessageOperations;
|
|
60
57
|
private client;
|
|
61
58
|
private failedRepliesMap;
|
|
62
|
-
constructor({ client, threadData, }: {
|
|
59
|
+
constructor({ client, threadData, channel, parentMessage, draft, }: {
|
|
63
60
|
client: StreamChat;
|
|
64
|
-
threadData
|
|
61
|
+
threadData?: ThreadStateResponse;
|
|
62
|
+
channel?: Channel;
|
|
63
|
+
parentMessage?: MessageResponse | LocalMessage;
|
|
64
|
+
draft?: DraftResponse;
|
|
65
65
|
});
|
|
66
66
|
get channel(): Channel;
|
|
67
67
|
get hasStaleState(): boolean;
|
|
@@ -77,14 +77,16 @@ export declare class Thread extends WithSubscriptions {
|
|
|
77
77
|
private subscribeMarkThreadStale;
|
|
78
78
|
private subscribeRepliesUnread;
|
|
79
79
|
private subscribeNewReplies;
|
|
80
|
+
private incrementReplyCountLocally;
|
|
80
81
|
private subscribeRepliesRead;
|
|
81
82
|
private subscribeMessageDeleted;
|
|
82
83
|
private subscribeMessageUpdated;
|
|
84
|
+
private subscribeUserMessagesDeleted;
|
|
83
85
|
unregisterSubscriptions: () => symbol;
|
|
84
86
|
deleteReplyLocally: ({ message }: {
|
|
85
87
|
message: MessageResponse;
|
|
86
88
|
}) => void;
|
|
87
|
-
upsertReplyLocally: ({ message,
|
|
89
|
+
upsertReplyLocally: ({ message, }: {
|
|
88
90
|
message: MessageResponse | LocalMessage;
|
|
89
91
|
timestampChanged?: boolean;
|
|
90
92
|
}) => void;
|
|
@@ -92,17 +94,32 @@ export declare class Thread extends WithSubscriptions {
|
|
|
92
94
|
message: MessageResponse;
|
|
93
95
|
}) => void;
|
|
94
96
|
updateParentMessageOrReplyLocally: (message: MessageResponse) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Sends a message with optimistic local state update.
|
|
99
|
+
*/
|
|
100
|
+
sendMessageWithLocalUpdate({ localMessage, message, options, sendMessageRequestFn, }: SendMessageWithStateUpdateParams): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Retry sending a failed message.
|
|
103
|
+
*/
|
|
104
|
+
retrySendMessageWithLocalUpdate(params: Omit<SendMessageWithStateUpdateParams, 'message'>): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Updates a message with optimistic local state update.
|
|
107
|
+
*
|
|
108
|
+
* The update flows through `messagePaginator`, which is the sole reply source.
|
|
109
|
+
*/
|
|
110
|
+
updateMessageWithLocalUpdate(params: UpdateMessageWithStateUpdateParams): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Deletes a message with local state update.
|
|
113
|
+
*/
|
|
114
|
+
deleteMessageWithLocalUpdate(params: DeleteMessageWithStateUpdateParams): Promise<void>;
|
|
115
|
+
markRead: ({ force }?: {
|
|
116
|
+
force?: boolean;
|
|
117
|
+
}) => Promise<EventAPIResponse | import("./types").StreamResponse<import(".").MarkReadResponse> | null>;
|
|
118
|
+
private throttledMarkRead;
|
|
119
|
+
/**
|
|
120
|
+
* @deprecated Use `thread.markRead` instead.
|
|
121
|
+
*/
|
|
95
122
|
markAsRead: ({ force }?: {
|
|
96
123
|
force?: boolean;
|
|
97
|
-
}) => Promise<import("./types").
|
|
98
|
-
private throttledMarkAsRead;
|
|
99
|
-
queryReplies: ({ limit, sort, ...otherOptions }?: QueryRepliesOptions) => Promise<import("./types").GetRepliesAPIResponse>;
|
|
100
|
-
loadNextPage: ({ limit }?: {
|
|
101
|
-
limit?: number;
|
|
102
|
-
}) => Promise<void>;
|
|
103
|
-
loadPrevPage: ({ limit }?: {
|
|
104
|
-
limit?: number;
|
|
105
|
-
}) => Promise<void>;
|
|
106
|
-
private loadPage;
|
|
124
|
+
}) => Promise<EventAPIResponse | import("./types").StreamResponse<import(".").MarkReadResponse> | null>;
|
|
107
125
|
}
|
|
108
|
-
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StateStore } from './store';
|
|
2
2
|
import type { StreamChat } from './client';
|
|
3
3
|
import type { Thread } from './thread';
|
|
4
|
-
import type {
|
|
4
|
+
import type { QueryThreadsRequest } from './types';
|
|
5
5
|
import { WithSubscriptions } from './utils/WithSubscriptions';
|
|
6
6
|
export declare const THREAD_MANAGER_INITIAL_STATE: {
|
|
7
7
|
active: boolean;
|
|
@@ -65,9 +65,9 @@ export declare class ThreadManager extends WithSubscriptions {
|
|
|
65
65
|
reload: ({ force }?: {
|
|
66
66
|
force?: boolean | undefined;
|
|
67
67
|
}) => Promise<void>;
|
|
68
|
-
queryThreads: (options?:
|
|
68
|
+
queryThreads: (options?: QueryThreadsRequest) => Promise<{
|
|
69
69
|
threads: Thread[];
|
|
70
70
|
next: string | undefined;
|
|
71
71
|
}>;
|
|
72
|
-
loadNextPage: (options?: Omit<
|
|
72
|
+
loadNextPage: (options?: Omit<QueryThreadsRequest, "next">) => Promise<void>;
|
|
73
73
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type jwt from 'jsonwebtoken';
|
|
2
|
-
import type { TokenOrProvider
|
|
2
|
+
import type { TokenOrProvider } from './types';
|
|
3
|
+
export type TokenManagerMinimalUser = {
|
|
4
|
+
id: string;
|
|
5
|
+
anon?: boolean;
|
|
6
|
+
};
|
|
3
7
|
/**
|
|
4
8
|
* TokenManager
|
|
5
9
|
*
|
|
@@ -11,27 +15,28 @@ export declare class TokenManager {
|
|
|
11
15
|
secret?: jwt.Secret;
|
|
12
16
|
token?: string;
|
|
13
17
|
tokenProvider?: TokenOrProvider;
|
|
14
|
-
user?:
|
|
18
|
+
user?: TokenManagerMinimalUser;
|
|
15
19
|
/**
|
|
16
|
-
*
|
|
20
|
+
* Initializes the token manager, optionally with a server-side API secret used to mint tokens
|
|
21
|
+
* locally.
|
|
17
22
|
*
|
|
18
|
-
* @param
|
|
23
|
+
* @param secret - Optional API secret. When provided, the manager will sign server tokens locally.
|
|
19
24
|
*/
|
|
20
25
|
constructor(secret?: jwt.Secret);
|
|
21
26
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
27
|
+
* Sets the static string token or token provider. A token provider should return a token string
|
|
28
|
+
* or a promise that resolves to a token string.
|
|
24
29
|
*
|
|
25
|
-
* @param
|
|
26
|
-
* @param
|
|
30
|
+
* @param tokenOrProvider - A token string or an async provider that returns one.
|
|
31
|
+
* @param user - The user the token belongs to.
|
|
27
32
|
*/
|
|
28
|
-
setTokenOrProvider: (tokenOrProvider: TokenOrProvider, user:
|
|
33
|
+
setTokenOrProvider: (tokenOrProvider: TokenOrProvider, user: TokenManagerMinimalUser) => Promise<void>;
|
|
29
34
|
/**
|
|
30
35
|
* Resets the token manager.
|
|
31
36
|
* Useful for client disconnection or switching user.
|
|
32
37
|
*/
|
|
33
38
|
reset: () => void;
|
|
34
|
-
validateToken: (tokenOrProvider: TokenOrProvider, user:
|
|
39
|
+
validateToken: (tokenOrProvider: TokenOrProvider, user: TokenManagerMinimalUser) => void;
|
|
35
40
|
tokenReady: () => Promise<string> | null;
|
|
36
41
|
loadToken: () => Promise<string>;
|
|
37
42
|
getToken: () => string | undefined;
|