stream-chat 10.0.0-rc.21 → 10.0.0-rc.23
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 +2196 -3902
- package/dist/cjs/index.browser.js.map +3 -3
- package/dist/cjs/index.node.js +2197 -3902
- package/dist/cjs/index.node.js.map +3 -3
- package/dist/esm/index.mjs +2199 -3905
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +120 -233
- package/dist/types/CooldownTimer.d.ts +8 -23
- package/dist/types/EventHandlerPipeline.d.ts +17 -37
- package/dist/types/LiveLocationManager.d.ts +22 -50
- package/dist/types/api-client.d.ts +9 -14
- package/dist/types/channel.d.ts +253 -448
- package/dist/types/channel_state.d.ts +48 -95
- package/dist/types/client.d.ts +245 -370
- package/dist/types/client_state.d.ts +1 -3
- package/dist/types/configuration/ConfigController.d.ts +30 -124
- package/dist/types/configuration/InstanceConfigurationRegistry.d.ts +31 -123
- package/dist/types/configuration/keys.d.ts +5 -19
- package/dist/types/configuration/shape.d.ts +12 -29
- package/dist/types/configuration/types.d.ts +59 -87
- package/dist/types/configuration/utils/applyInstanceConfiguration.d.ts +13 -35
- package/dist/types/configuration/utils/copyConfigPatch.d.ts +8 -0
- package/dist/types/configuration/utils/declarativeSlices.d.ts +5 -16
- package/dist/types/configuration/utils/deepFreezeConfig.d.ts +3 -17
- package/dist/types/configuration/utils/serverAuthority.d.ts +9 -29
- package/dist/types/connection/ConnectionIdManager.d.ts +18 -40
- package/dist/types/connection/ConnectionRecoveryManager.d.ts +29 -120
- package/dist/types/connection/networkConnection/NetworkConnectionObserver.d.ts +32 -103
- package/dist/types/connection/networkConnection/reporters.d.ts +9 -32
- package/dist/types/connection/networkConnection/types.d.ts +12 -27
- package/dist/types/connection/wsConnection/StableWSConnection.d.ts +37 -116
- package/dist/types/connection/wsConnection/WSConnection.d.ts +41 -104
- package/dist/types/connection/wsConnection/WSConnectionFallback.d.ts +8 -16
- package/dist/types/connection/wsConnection/config.d.ts +8 -28
- package/dist/types/connection/wsConnection/types.d.ts +17 -70
- package/dist/types/entityStore/EntityStore.d.ts +153 -113
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +13 -46
- package/dist/types/errors.d.ts +7 -19
- package/dist/types/gen/chat/ChannelApi.d.ts +2 -1
- package/dist/types/gen/chat/ChatApi.d.ts +28 -14
- package/dist/types/gen/models/index.d.ts +769 -86
- package/dist/types/gen/moderation/ModerationApi.d.ts +4 -4
- package/dist/types/index.d.ts +2 -4
- package/dist/types/languageNames.d.ts +9 -24
- package/dist/types/logger.d.ts +1 -3
- package/dist/types/messageComposer/LocationComposer.d.ts +1 -1
- package/dist/types/messageComposer/attachmentIdentity.d.ts +1 -6
- package/dist/types/messageComposer/attachmentManager.d.ts +10 -32
- package/dist/types/messageComposer/attachmentUtils.d.ts +3 -14
- package/dist/types/messageComposer/configuration/configuration.d.ts +2 -5
- package/dist/types/messageComposer/configuration/types.d.ts +29 -56
- package/dist/types/messageComposer/linkPreviewsManager.d.ts +6 -9
- package/dist/types/messageComposer/messageComposer.d.ts +30 -164
- package/dist/types/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.d.ts +4 -14
- package/dist/types/messageComposer/middleware/messageComposer/attachments.d.ts +2 -9
- package/dist/types/messageComposer/middleware/pollComposer/types.d.ts +2 -4
- package/dist/types/messageComposer/middleware/pollComposer/validation.d.ts +7 -19
- package/dist/types/messageComposer/middleware/textComposer/commands.d.ts +9 -0
- package/dist/types/messageComposer/middleware/textComposer/mentions.d.ts +11 -18
- package/dist/types/messageComposer/middleware/textComposer/textMiddlewareUtils.d.ts +9 -3
- package/dist/types/messageComposer/middleware/textComposer/types.d.ts +1 -6
- package/dist/types/messageComposer/pollComposer.d.ts +8 -4
- package/dist/types/messageComposer/textComposer.d.ts +3 -9
- package/dist/types/messageComposer/types.d.ts +5 -8
- package/dist/types/messageDelivery/MessageDeliveryReporter.d.ts +25 -79
- package/dist/types/messageDelivery/MessageReceiptsTracker.d.ts +15 -82
- package/dist/types/messageOperations/FailedSendCache.d.ts +4 -9
- package/dist/types/messageOperations/MessageOperationStatePolicy.d.ts +10 -20
- package/dist/types/messageOperations/MessageOperations.d.ts +20 -40
- package/dist/types/messageOperations/applyReactionLocally.d.ts +5 -22
- package/dist/types/messageOperations/createMessageOperations.d.ts +3 -5
- package/dist/types/messageOperations/reflectReactionEvent.d.ts +5 -13
- package/dist/types/messageOperations/sendOrdering.d.ts +4 -7
- package/dist/types/messageOperations/settlePendingAttachmentUploads.d.ts +7 -15
- package/dist/types/messageOperations/types.d.ts +15 -30
- package/dist/types/middleware.d.ts +7 -5
- package/dist/types/moderation.d.ts +21 -14
- package/dist/types/notifications/NotificationManager.d.ts +8 -31
- package/dist/types/notifications/types.d.ts +19 -59
- package/dist/types/offline-support/offline_support_api.d.ts +145 -539
- package/dist/types/offline-support/offline_sync_manager.d.ts +18 -42
- package/dist/types/offline-support/queueableOperations.d.ts +24 -52
- package/dist/types/offline-support/types.d.ts +24 -187
- package/dist/types/pagination/ItemIndex.d.ts +4 -12
- package/dist/types/pagination/cursorDerivation/aroundPaginationFlags.d.ts +13 -0
- package/dist/types/pagination/cursorDerivation/createdAtAroundPaginationFlags.d.ts +2 -4
- package/dist/types/pagination/cursorDerivation/linearPaginationFlags.d.ts +2 -3
- package/dist/types/pagination/paginators/BasePaginator.d.ts +235 -622
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +67 -125
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +133 -292
- package/dist/types/pagination/paginators/MessagePaginator.d.ts +69 -118
- package/dist/types/pagination/paginators/PinnedMessagePaginator.d.ts +7 -26
- package/dist/types/pagination/paginators/ReminderPaginator.d.ts +2 -2
- package/dist/types/pagination/paginators/ThreadPaginator.d.ts +15 -23
- package/dist/types/pagination/paginators/UserGroupPaginator.d.ts +2 -6
- package/dist/types/pagination/sortCompiler.d.ts +11 -22
- package/dist/types/pagination/utility.normalization.d.ts +5 -23
- package/dist/types/pagination/utility.search.d.ts +3 -8
- package/dist/types/poll.d.ts +14 -14
- package/dist/types/poll_manager.d.ts +11 -2
- package/dist/types/poll_optimistic_votes.d.ts +10 -14
- package/dist/types/reminders/Reminder.d.ts +4 -4
- package/dist/types/reminders/ReminderManager.d.ts +7 -20
- package/dist/types/search/BaseSearchSource.d.ts +7 -12
- package/dist/types/search/ChannelSearchSource.d.ts +7 -7
- package/dist/types/search/MessageSearchSource.d.ts +7 -9
- package/dist/types/search/SearchController.d.ts +17 -22
- package/dist/types/search/types.d.ts +6 -10
- package/dist/types/signing.d.ts +12 -3
- package/dist/types/thread.d.ts +23 -71
- package/dist/types/thread_manager.d.ts +45 -70
- package/dist/types/token_manager.d.ts +8 -13
- package/dist/types/types.d.ts +64 -125
- package/dist/types/types.utility.d.ts +3 -3
- package/dist/types/upload-utils.d.ts +5 -10
- package/dist/types/uploadManager.d.ts +17 -45
- package/dist/types/utils/FixedSizeQueueCache.d.ts +6 -11
- package/dist/types/utils/WithSubscriptions.d.ts +5 -15
- package/dist/types/utils/concurrency.d.ts +11 -19
- package/dist/types/utils/mergeWith/mergeWith.d.ts +8 -11
- package/dist/types/utils/mergeWith/mergeWithCore.d.ts +5 -13
- package/dist/types/utils/mergeWith/mergeWithDiff.d.ts +22 -0
- package/dist/types/utils/objectPath.d.ts +6 -41
- package/dist/types/utils/retryable.d.ts +8 -12
- package/dist/types/utils/throttling/throttle.d.ts +8 -23
- package/dist/types/utils/time.d.ts +24 -64
- package/dist/types/utils.d.ts +40 -86
- package/package.json +7 -2
- package/src/ChannelManager.ts +159 -300
- package/src/CooldownTimer.ts +11 -29
- package/src/EventHandlerPipeline.ts +21 -44
- package/src/LiveLocationManager.ts +35 -74
- package/src/api-client.ts +43 -61
- package/src/campaign.ts +1 -1
- package/src/channel.ts +396 -749
- package/src/channel_batch_updater.ts +1 -1
- package/src/channel_state.ts +50 -105
- package/src/client.ts +360 -588
- package/src/client_state.ts +1 -6
- package/src/configuration/ConfigController.ts +41 -157
- package/src/configuration/InstanceConfigurationRegistry.ts +42 -171
- package/src/configuration/index.ts +1 -1
- package/src/configuration/keys.ts +13 -32
- package/src/configuration/shape.ts +67 -70
- package/src/configuration/types.ts +60 -100
- package/src/configuration/utils/applyInstanceConfiguration.ts +21 -53
- package/src/configuration/utils/copyConfigPatch.ts +11 -32
- package/src/configuration/utils/declarativeSlices.ts +9 -39
- package/src/configuration/utils/deepFreezeConfig.ts +3 -17
- package/src/configuration/utils/index.ts +2 -4
- package/src/configuration/utils/serverAuthority.ts +20 -68
- package/src/connection/ConnectionIdManager.ts +20 -49
- package/src/connection/ConnectionRecoveryManager.ts +51 -178
- package/src/connection/networkConnection/NetworkConnectionObserver.ts +37 -114
- package/src/connection/networkConnection/reporters.ts +9 -36
- package/src/connection/networkConnection/types.ts +12 -27
- package/src/connection/wsConnection/StableWSConnection.ts +73 -193
- package/src/connection/wsConnection/WSConnection.ts +56 -131
- package/src/connection/wsConnection/WSConnectionFallback.ts +22 -31
- package/src/connection/wsConnection/config.ts +13 -48
- package/src/connection/wsConnection/types.ts +17 -70
- package/src/constants.ts +4 -4
- package/src/entityStore/EntityStore.ts +162 -167
- package/src/entityStore/StoreBackedItemIndex.ts +14 -47
- package/src/errors.ts +7 -19
- package/src/formatMessageMemo.ts +3 -9
- package/src/gen/chat/ChannelApi.ts +19 -0
- package/src/gen/chat/ChatApi.ts +87 -13
- package/src/gen/models/index.ts +793 -71
- package/src/gen/moderation/ModerationApi.ts +0 -4
- package/src/index.ts +10 -14
- package/src/languageNames.ts +9 -24
- package/src/logger.ts +1 -3
- package/src/messageComposer/LocationComposer.ts +7 -23
- package/src/messageComposer/MessageComposerEffectHandlers.ts +1 -2
- package/src/messageComposer/attachmentIdentity.ts +2 -13
- package/src/messageComposer/attachmentManager.ts +17 -63
- package/src/messageComposer/attachmentUtils.ts +3 -17
- package/src/messageComposer/configuration/configuration.ts +5 -8
- package/src/messageComposer/configuration/types.ts +29 -56
- package/src/messageComposer/fileUtils.ts +1 -1
- package/src/messageComposer/linkPreviewsManager.ts +8 -20
- package/src/messageComposer/messageComposer.ts +54 -222
- package/src/messageComposer/middleware/attachmentManager/postUpload/attachmentEnrichment.ts +4 -16
- package/src/messageComposer/middleware/attachmentManager/postUpload/uploadErrorHandler.ts +1 -2
- package/src/messageComposer/middleware/messageComposer/attachments.ts +14 -40
- package/src/messageComposer/middleware/messageComposer/linkPreviews.ts +3 -4
- package/src/messageComposer/middleware/messageComposer/textComposer.ts +1 -1
- package/src/messageComposer/middleware/messageComposer/userDataInjection.ts +4 -11
- package/src/messageComposer/middleware/pollComposer/state.ts +2 -2
- package/src/messageComposer/middleware/pollComposer/types.ts +2 -4
- package/src/messageComposer/middleware/pollComposer/validation.ts +8 -26
- package/src/messageComposer/middleware/textComposer/TextComposerMiddlewareExecutor.ts +1 -6
- package/src/messageComposer/middleware/textComposer/commandUtils.ts +1 -2
- package/src/messageComposer/middleware/textComposer/commands.ts +11 -16
- package/src/messageComposer/middleware/textComposer/mentions.ts +32 -70
- package/src/messageComposer/middleware/textComposer/textMiddlewareUtils.ts +10 -4
- package/src/messageComposer/middleware/textComposer/types.ts +1 -6
- package/src/messageComposer/pollComposer.ts +11 -8
- package/src/messageComposer/textComposer.ts +9 -59
- package/src/messageComposer/types.ts +9 -12
- package/src/messageDelivery/MessageDeliveryReporter.ts +60 -113
- package/src/messageDelivery/MessageReceiptsTracker.ts +21 -105
- package/src/messageOperations/FailedSendCache.ts +4 -9
- package/src/messageOperations/MessageOperationStatePolicy.ts +40 -67
- package/src/messageOperations/MessageOperations.ts +33 -62
- package/src/messageOperations/applyReactionLocally.ts +9 -28
- package/src/messageOperations/createMessageOperations.ts +17 -33
- package/src/messageOperations/reflectReactionEvent.ts +5 -13
- package/src/messageOperations/sendOrdering.ts +4 -7
- package/src/messageOperations/settlePendingAttachmentUploads.ts +10 -21
- package/src/messageOperations/types.ts +15 -30
- package/src/middleware.ts +7 -10
- package/src/moderation.ts +25 -21
- package/src/notifications/NotificationManager.ts +11 -35
- package/src/notifications/types.ts +19 -59
- package/src/offline-support/offline_support_api.ts +178 -608
- package/src/offline-support/offline_sync_manager.ts +25 -69
- package/src/offline-support/queueableOperations.ts +31 -84
- package/src/offline-support/types.ts +25 -188
- package/src/pagination/ItemIndex.ts +4 -12
- package/src/pagination/cursorDerivation/aroundPaginationFlags.ts +29 -0
- package/src/pagination/cursorDerivation/createdAtAroundPaginationFlags.ts +13 -62
- package/src/pagination/cursorDerivation/idAroundPaginationFlags.ts +11 -39
- package/src/pagination/cursorDerivation/linearPaginationFlags.ts +4 -6
- package/src/pagination/filterCompiler.ts +11 -25
- package/src/pagination/paginators/BasePaginator.ts +422 -976
- package/src/pagination/paginators/ChannelPaginator.ts +130 -190
- package/src/pagination/paginators/MessageIntervalPaginator.ts +226 -457
- package/src/pagination/paginators/MessagePaginator.ts +135 -175
- package/src/pagination/paginators/PinnedMessagePaginator.ts +13 -38
- package/src/pagination/paginators/ReminderPaginator.ts +12 -15
- package/src/pagination/paginators/ThreadPaginator.ts +16 -26
- package/src/pagination/paginators/UserGroupPaginator.ts +6 -17
- package/src/pagination/paginators/stateThrottling.ts +5 -10
- package/src/pagination/sortCompiler.ts +23 -50
- package/src/pagination/utility.normalization.ts +8 -30
- package/src/pagination/utility.search.ts +4 -11
- package/src/poll.ts +19 -19
- package/src/poll_manager.ts +16 -20
- package/src/poll_optimistic_votes.ts +17 -22
- package/src/reminders/Reminder.ts +5 -6
- package/src/reminders/ReminderManager.ts +9 -34
- package/src/reminders/ReminderTimer.ts +1 -2
- package/src/search/BaseSearchSource.ts +14 -29
- package/src/search/ChannelSearchSource.ts +8 -8
- package/src/search/MessageSearchSource.ts +19 -25
- package/src/search/SearchController.ts +18 -24
- package/src/search/types.ts +6 -10
- package/src/segment.ts +1 -1
- package/src/signing.ts +23 -3
- package/src/thread.ts +72 -173
- package/src/thread_manager.ts +59 -76
- package/src/token_manager.ts +11 -21
- package/src/types.ts +78 -126
- package/src/types.utility.ts +3 -3
- package/src/upload-utils.ts +5 -10
- package/src/uploadManager.ts +22 -54
- package/src/utils/FixedSizeQueueCache.ts +13 -21
- package/src/utils/WithSubscriptions.ts +5 -15
- package/src/utils/concurrency.ts +16 -55
- package/src/utils/mergeWith/mergeWith.ts +10 -13
- package/src/utils/mergeWith/mergeWithCore.ts +24 -81
- package/src/utils/mergeWith/mergeWithDiff.ts +15 -33
- package/src/utils/objectPath.ts +6 -41
- package/src/utils/retryable.ts +10 -14
- package/src/utils/throttling/throttle.ts +9 -25
- package/src/utils/time.ts +26 -66
- package/src/utils.ts +72 -128
|
@@ -7,10 +7,8 @@ import type { LocalMessage, MessageResponse } from './types';
|
|
|
7
7
|
import { WithSubscriptions } from './utils/WithSubscriptions';
|
|
8
8
|
export type ThreadManagerConfig = {
|
|
9
9
|
/**
|
|
10
|
-
* Minimum gap between thread-list reloads triggered by connection recovery
|
|
11
|
-
*
|
|
12
|
-
* Read when subscriptions are registered, since the throttle captures the interval in a closure — a
|
|
13
|
-
* change applies from the next `registerSubscriptions()`, not retroactively.
|
|
10
|
+
* Minimum gap between thread-list reloads triggered by connection recovery, in milliseconds.
|
|
11
|
+
* Defaults to 1000. Read in `registerSubscriptions()`, so a change applies from the next call.
|
|
14
12
|
*/
|
|
15
13
|
connectionRecoveryThrottleMs: number;
|
|
16
14
|
};
|
|
@@ -18,19 +16,12 @@ export declare const DEFAULT_THREAD_MANAGER_CONFIG: ThreadManagerConfig;
|
|
|
18
16
|
/** Manager-level state. The list itself lives on {@link ThreadManager.paginator}. */
|
|
19
17
|
export type ThreadManagerState = {
|
|
20
18
|
active: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Whether the thread manager has been activated at least once in the current
|
|
23
|
-
* session (i.e. `activate()` was called). Used to avoid requerying threads
|
|
24
|
-
* on connection recovery for consumers that never actually activate the manager.
|
|
25
|
-
*/
|
|
19
|
+
/** Whether `activate()` was called this session. Recovery skips the reload when it never was. */
|
|
26
20
|
wasActivatedAtLeastOnce: boolean;
|
|
27
21
|
/** A listed thread got a reply since the latest reload, so the list order may be out of date. */
|
|
28
22
|
isThreadOrderStale: boolean;
|
|
29
23
|
unreadThreadCount: number;
|
|
30
|
-
/**
|
|
31
|
-
* List of threads that haven't been loaded in the list, but have received new messages
|
|
32
|
-
* since the latest reload. Useful to display a banner prompting to reload the thread list.
|
|
33
|
-
*/
|
|
24
|
+
/** Threads not in the list that got new messages since the latest reload (for a banner). */
|
|
34
25
|
unseenThreadIds: string[];
|
|
35
26
|
};
|
|
36
27
|
export declare const THREAD_MANAGER_INITIAL_STATE: ThreadManagerState;
|
|
@@ -40,85 +31,78 @@ export declare class ThreadManager extends WithSubscriptions {
|
|
|
40
31
|
readonly paginator: ThreadPaginator;
|
|
41
32
|
private client;
|
|
42
33
|
/**
|
|
43
|
-
* Every live thread, held by the list
|
|
44
|
-
*
|
|
34
|
+
* Every live thread, held by the list and/or `REGISTERED_HOLDER` (opened this session). A thread
|
|
35
|
+
* leaves once neither holds it.
|
|
45
36
|
*/
|
|
46
37
|
private readonly threadStore;
|
|
47
|
-
/** A reload is in flight; a second one is dropped
|
|
38
|
+
/** A reload is in flight; a second one is dropped. */
|
|
48
39
|
private isReloadInFlight;
|
|
49
40
|
/**
|
|
50
|
-
* A local `pendingDisposal` listener
|
|
51
|
-
*
|
|
41
|
+
* A local `pendingDisposal` listener per channel with a listed or opened thread, removed when the
|
|
42
|
+
* channel is disposed or on reset.
|
|
52
43
|
*/
|
|
53
44
|
private readonly disposalListeners;
|
|
54
|
-
/** The shared configuration machinery — see {@link ConfigController}. */
|
|
55
45
|
private readonly configController;
|
|
56
|
-
/**
|
|
57
|
-
* Resolved configuration, as a store — the shape every configurable class exposes
|
|
58
|
-
* (`configState` / `config` / `updateConfig`).
|
|
59
|
-
*/
|
|
60
46
|
get configState(): StateStore<ThreadManagerConfig>;
|
|
61
47
|
constructor({ client }: {
|
|
62
48
|
client: StreamChat;
|
|
63
49
|
});
|
|
64
|
-
/** The current resolved configuration. `Readonly` — change it through {@link updateConfig}. */
|
|
65
50
|
get config(): Readonly<ThreadManagerConfig>;
|
|
66
|
-
/** Merges a partial configuration into the resolved config and notifies subscribers. */
|
|
67
|
-
updateConfig(config: Partial<ThreadManagerConfig>): void;
|
|
68
51
|
/**
|
|
69
|
-
*
|
|
52
|
+
* Merges a partial configuration into the resolved config.
|
|
70
53
|
*
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
54
|
+
* @param config - The fields to change.
|
|
55
|
+
*/
|
|
56
|
+
updateConfig(config: Partial<ThreadManagerConfig>): void;
|
|
57
|
+
/**
|
|
58
|
+
* Re-derives the configuration from the declarative slice.
|
|
76
59
|
*
|
|
77
|
-
*
|
|
78
|
-
* every field of `ThreadManagerConfig` is required and present in the defaults, so a patch naming all of
|
|
79
|
-
* them amounts to a replacement. `NotificationManager` cannot do this — its `sortComparator` is
|
|
80
|
-
* optional with no default, so a patch can never remove one — which is why it replaces outright.
|
|
60
|
+
* @param config - The declarative slice (optional).
|
|
81
61
|
*/
|
|
82
62
|
initializeConfig(config?: Partial<ThreadManagerConfig>): void;
|
|
83
63
|
/**
|
|
84
|
-
* The live thread for `id`: one in the list, or one opened this session
|
|
85
|
-
* list
|
|
86
|
-
* membership is `paginator.getItem(id)`.
|
|
64
|
+
* The live thread for `id`: one in the list, or one opened this session. `paginator.items` holds
|
|
65
|
+
* the list only; list membership is `paginator.getItem(id)`.
|
|
87
66
|
*/
|
|
88
67
|
get: (id: string) => Thread | undefined;
|
|
89
68
|
/**
|
|
90
|
-
* Returns the thread for `parentMessage`, creating
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
69
|
+
* Returns the thread for `parentMessage`, creating and registering it if needed. Use it instead
|
|
70
|
+
* of `new Thread()`: the thread list reuses this instance if it later loads the same thread. A
|
|
71
|
+
* created thread starts stale and loads its data when first opened, unless the parent has no
|
|
72
|
+
* replies in a watched channel (nothing to load: `getThread` would 404, the first reply arrives
|
|
73
|
+
* as an event). In an unwatched channel the parent's `reply_count` may miss newer replies, so it
|
|
74
|
+
* always loads.
|
|
95
75
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* misses the replies sent since. A parent without replies in a watched channel has nothing to load
|
|
100
|
-
* yet (`getThread` would answer 404): the thread starts up to date, and its first reply arrives as
|
|
101
|
-
* an event.
|
|
76
|
+
* @param params.channel - The channel of the parent message.
|
|
77
|
+
* @param params.parentMessage - The thread's parent message.
|
|
78
|
+
* @returns The registered thread.
|
|
102
79
|
*/
|
|
103
80
|
ensure: ({ channel, parentMessage, }: {
|
|
104
81
|
channel: Channel;
|
|
105
82
|
parentMessage: LocalMessage | MessageResponse;
|
|
106
83
|
}) => Thread;
|
|
107
84
|
/**
|
|
108
|
-
*
|
|
85
|
+
* The registered instance for a thread a query just built, else the query's own, so events keep
|
|
86
|
+
* reaching the one managed instance. A stale registered thread is refreshed from the query unless
|
|
87
|
+
* it is active (it reloads itself).
|
|
88
|
+
*
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
resolveQueried: (incoming: Thread) => Thread;
|
|
92
|
+
/**
|
|
93
|
+
* Every registered thread: the list's plus the opened ones.
|
|
109
94
|
*
|
|
110
95
|
* @internal
|
|
111
96
|
*/
|
|
112
97
|
get registeredThreads(): Thread[];
|
|
113
98
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* channel is disposed or the user disconnects.
|
|
99
|
+
* Keeps `thread` for the session: resolvable through {@link ThreadManager.get} and subscribed
|
|
100
|
+
* whether or not the list holds it, until its channel is disposed or the user disconnects.
|
|
117
101
|
*
|
|
118
102
|
* @internal
|
|
119
103
|
*/
|
|
120
104
|
register: (thread: Thread) => void;
|
|
121
|
-
/** Releases the `REGISTERED_HOLDER` hold
|
|
105
|
+
/** Releases the `REGISTERED_HOLDER` hold, and unsubscribes the thread unless listed. */
|
|
122
106
|
private release;
|
|
123
107
|
/** Listens for its channel's disposal the first time a thread on that channel is seen. */
|
|
124
108
|
private listenForDisposal;
|
|
@@ -129,32 +113,23 @@ export declare class ThreadManager extends WithSubscriptions {
|
|
|
129
113
|
deactivate: () => void;
|
|
130
114
|
registerSubscriptions: () => void;
|
|
131
115
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* `master`. A thread follows its channel's `watchStatus` itself, so watch events need no routing.
|
|
116
|
+
* Routes client events to the threads in the store by ID. A message event reaches the thread the
|
|
117
|
+
* message replies in and the thread it starts; quoted-message updates stay within the reply's own
|
|
118
|
+
* thread. A thread follows its channel's `watchStatus` itself.
|
|
136
119
|
*/
|
|
137
120
|
private subscribeThreadEvents;
|
|
138
121
|
private subscribeUnreadThreadsCountChange;
|
|
139
122
|
private subscribeManageThreadSubscriptions;
|
|
140
123
|
private subscribeReloadOnActivation;
|
|
141
124
|
private subscribeNewReplies;
|
|
142
|
-
/**
|
|
143
|
-
* Reloads the thread list once recovery after a reconnect has finished.
|
|
144
|
-
*
|
|
145
|
-
* `connection.recovered` on its own is the whole condition, with no drop timestamp to gate on:
|
|
146
|
-
* `ConnectionRecoveryManager` dispatches it on every reconnect path, so it already implies a drop.
|
|
147
|
-
*
|
|
148
|
-
* Anything that does need the drop timestamp should read `client.wsConnection.state.lastUnhealthyAt`,
|
|
149
|
-
* which is written on every status transition.
|
|
150
|
-
*/
|
|
125
|
+
/** Reloads the thread list once recovery after a reconnect finished (`connection.recovered`). */
|
|
151
126
|
private subscribeReloadOnConnectionRecovered;
|
|
152
127
|
unregisterSubscriptions: () => symbol;
|
|
153
128
|
/**
|
|
154
129
|
* Loads the first page, or re-queries a loaded list in place, sized to what is loaded plus the
|
|
155
130
|
* unseen threads. Skipped once loaded unless forced or something changed; the list survives a
|
|
156
|
-
* failure.
|
|
157
|
-
*
|
|
131
|
+
* failure. Dropped while another reload is in flight. Only the first load shows
|
|
132
|
+
* `paginator.isLoading`.
|
|
158
133
|
*/
|
|
159
134
|
reload: ({ force }?: {
|
|
160
135
|
force?: boolean | undefined;
|
|
@@ -3,11 +3,7 @@ export type TokenManagerMinimalUser = {
|
|
|
3
3
|
id: string;
|
|
4
4
|
anon?: boolean;
|
|
5
5
|
};
|
|
6
|
-
/**
|
|
7
|
-
* TokenManager
|
|
8
|
-
*
|
|
9
|
-
* Handles all the operations around user token.
|
|
10
|
-
*/
|
|
6
|
+
/** Holds the user token, either static or loaded from a provider. */
|
|
11
7
|
export declare class TokenManager {
|
|
12
8
|
loadTokenPromise: Promise<string> | null;
|
|
13
9
|
type: 'static' | 'provider';
|
|
@@ -15,22 +11,21 @@ export declare class TokenManager {
|
|
|
15
11
|
tokenProvider?: TokenOrProvider;
|
|
16
12
|
user?: TokenManagerMinimalUser;
|
|
17
13
|
private _isAnonymous;
|
|
18
|
-
/**
|
|
19
|
-
* Initializes the token manager.
|
|
20
|
-
*/
|
|
21
14
|
constructor();
|
|
22
15
|
get isAnonymous(): boolean;
|
|
23
16
|
/**
|
|
24
|
-
* Sets
|
|
25
|
-
* or a promise that resolves to a token string.
|
|
17
|
+
* Sets a static token or a token provider, then loads the token.
|
|
26
18
|
*
|
|
27
|
-
* @param tokenOrProvider - A token string or an async provider that
|
|
19
|
+
* @param tokenOrProvider - A token string, or an async provider that resolves to one.
|
|
28
20
|
* @param user - The user the token belongs to.
|
|
21
|
+
* @throws When the token is not a string or function, or a string token does not match `user.id`.
|
|
29
22
|
*/
|
|
30
23
|
setTokenOrProvider: (tokenOrProvider: TokenOrProvider, user: TokenManagerMinimalUser) => Promise<void>;
|
|
31
24
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
25
|
+
* Clears the token, the provider and the user. Called by the client on `disconnectUser()` and
|
|
26
|
+
* after an anonymous `createGuest()`.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
34
29
|
*/
|
|
35
30
|
reset: () => void;
|
|
36
31
|
validateToken: (tokenOrProvider: TokenOrProvider, user: TokenManagerMinimalUser) => void;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AxiosResponse } from 'axios';
|
|
2
2
|
import type { CustomEventTypes } from './custom_types';
|
|
3
|
-
import type {
|
|
4
|
-
import type { InstanceConfigTree } from './configuration/types';
|
|
5
|
-
import type { DeepPartial } from './types.utility';
|
|
6
|
-
import type { APIError, Attachment, BanRequest, ChannelConfigWithInfo, ChannelOwnCapability, ChannelStateResponseFields, CreateDeviceRequest, CreatePollRequest, DraftPayloadResponse, FlagRequest, Images, MessageResponse, OwnUserResponse, QueryChannelsRequest, QueryMembersPayload, QueryPollsRequest, QueryPollVotesRequest, QueryReactionsRequest, QueryRemindersRequest, QueryThreadsRequest, QueryUsersPayload, ReactionResponse, SearchPayload, SendMessageRequest, SendMessageResponse, SharedLocationResponseData, TimestampNS, TranslateMessageRequest, UpdateChannelRequest, UpdateMessageRequest, UpdateMessageResponse, UpdatePollRequest, UserResponse, WSEvent } from './gen/models';
|
|
3
|
+
import type { APIError, Attachment, BanRequest, ChannelConfigWithInfo, ChannelMemberRequest, ChannelOwnCapability, ChannelStateResponseFields, CreateDeviceRequest, CreatePollRequest, CustomEvent, DraftPayloadResponse, FlagRequest, Images, MessageRequest, MessageResponse, OwnUserResponse, QueryChannelsRequest, QueryMembersPayload, QueryPollsRequest, QueryPollVotesRequest, QueryReactionsRequest, QueryRemindersRequest, QueryThreadsRequest, QueryUsersPayload, ReactionResponse, SearchPayload, SendMessageRequest, SendMessageResponse, SharedLocationResponseData, TimestampNS, TranslateMessageRequest, UpdateChannelRequest, UpdateMessageRequest, UpdateMessageResponse, UpdatePollRequest, UserResponse, WSEvent } from './gen/models';
|
|
7
4
|
import type { ChatApi } from './gen-imports';
|
|
8
|
-
/**
|
|
9
|
-
* Utility Types
|
|
10
|
-
*/
|
|
11
5
|
export type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Omit<T, Keys> & {
|
|
12
6
|
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
|
13
7
|
}[Keys];
|
|
@@ -15,19 +9,29 @@ export type RequireAtLeastOne<T> = {
|
|
|
15
9
|
[K in keyof T]-?: Required<Pick<T, K>> & Partial<Omit<T, K>>;
|
|
16
10
|
}[keyof T];
|
|
17
11
|
/**
|
|
18
|
-
*
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Legacy response envelope. Every generated response already carries `duration`, and the
|
|
22
|
-
* transport wraps results in `StreamResponse<T>`, which also carries `metadata`.
|
|
23
|
-
*
|
|
24
|
-
* Only still referenced by the hand-written `/moderation/*` methods on `StreamChat` that
|
|
25
|
-
* bypass the generated client. Delete this together with those.
|
|
12
|
+
* Used only by `StreamChat.unbanUser`, a hand-written `/moderation/*` call that bypasses the
|
|
13
|
+
* generated client.
|
|
26
14
|
*/
|
|
27
15
|
export type APIResponse = {
|
|
28
16
|
duration: string;
|
|
29
17
|
};
|
|
30
18
|
export type ChannelUpdateOptions = Omit<UpdateChannelRequest, 'message'>;
|
|
19
|
+
/**
|
|
20
|
+
* A channel update that adds or removes items (members, invitees, filter tags): the items, a message
|
|
21
|
+
* notifying the channel members, and any other `update()` option.
|
|
22
|
+
*/
|
|
23
|
+
type ChannelItemsUpdate<Key extends string, Item> = Record<Key, Item[]> & {
|
|
24
|
+
/** Message object for channel members notification (optional). */
|
|
25
|
+
message?: MessageRequest;
|
|
26
|
+
} & ChannelUpdateOptions;
|
|
27
|
+
/** Request of `channel.addMembers`: user IDs, or member requests with a role or custom data. */
|
|
28
|
+
export type AddMembersRequest = ChannelItemsUpdate<'members', string | ChannelMemberRequest>;
|
|
29
|
+
/** Request of `channel.inviteMembers`. */
|
|
30
|
+
export type InviteMembersRequest = ChannelItemsUpdate<'members', string | Required<Omit<ChannelMemberRequest, 'channel_role'>>>;
|
|
31
|
+
/** Request of `channel.removeMembers`: the user IDs to remove. */
|
|
32
|
+
export type RemoveMembersRequest = ChannelItemsUpdate<'members', string>;
|
|
33
|
+
/** Request of `channel.addFilterTags` and `channel.removeFilterTags`. */
|
|
34
|
+
export type FilterTagsRequest = ChannelItemsUpdate<'tags', string>;
|
|
31
35
|
export type ConnectAPIResponse = Promise<void | ConnectionOpen>;
|
|
32
36
|
export type LocalMessage = MessageResponse & {
|
|
33
37
|
status: string;
|
|
@@ -35,27 +39,26 @@ export type LocalMessage = MessageResponse & {
|
|
|
35
39
|
user_id?: string;
|
|
36
40
|
};
|
|
37
41
|
export type GetThreadOptions = NonNullable<Parameters<ChatApi['getThread']>[1]>;
|
|
42
|
+
/** Options of `client.pinMessage`. */
|
|
43
|
+
export type PinMessageOptions = {
|
|
44
|
+
/** When the pin expires; `null` or leaving it out pins without expiry. */
|
|
45
|
+
pin_expires?: Date | string | null;
|
|
46
|
+
/** The pin time, which orders the pinned messages. Defaults to now. */
|
|
47
|
+
pinned_at?: Date | string;
|
|
48
|
+
};
|
|
38
49
|
/**
|
|
39
|
-
* The fields
|
|
40
|
-
* `
|
|
41
|
-
*
|
|
42
|
-
* Derived, never hand-listed: `client._handleUserEvent` uses this set (through
|
|
43
|
-
* `isOwnUserBaseProperty`) to decide which keys survive a `user.updated` event, so a field
|
|
44
|
-
* missing from it is silently deleted off `client.user`. Deriving it means a spec change
|
|
45
|
-
* cannot desynchronise the two.
|
|
50
|
+
* The fields of `OwnUserResponse` that a plain `UserResponse` lacks. `client._handleUserEvent` uses
|
|
51
|
+
* it (through `isOwnUserBaseProperty`) to decide which keys survive a `user.updated` event.
|
|
46
52
|
*/
|
|
47
53
|
export type OwnUserBase = Pick<OwnUserResponse, Exclude<keyof OwnUserResponse, keyof UserResponse>>;
|
|
48
54
|
export type BanUserOptions = Omit<BanRequest, 'target_user_id'>;
|
|
49
55
|
/**
|
|
50
56
|
* Everything `queryChannels()` accepts apart from the filter and the sort.
|
|
51
57
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* if the predefined filter has its own stored sort template that template wins and the request
|
|
57
|
-
* `sort` is ignored; if it does not, the request `sort` is used. `sort_values` interpolates the
|
|
58
|
-
* stored sort template's placeholders. All three are only read when `predefined_filter` is set.
|
|
58
|
+
* `predefined_filter` names a backend filter template, interpolated with `filter_values`. If that
|
|
59
|
+
* template has its own stored sort, it wins over the request `sort` and `sort_values` fills its
|
|
60
|
+
* placeholders; otherwise the request `sort` is used. `filter_values` and `sort_values` are sent
|
|
61
|
+
* only when `predefined_filter` is set.
|
|
59
62
|
*/
|
|
60
63
|
export type ChannelOptions = Omit<QueryChannelsRequest, 'filter_conditions' | 'sort'>;
|
|
61
64
|
export type ChannelStateOptions = {
|
|
@@ -63,12 +66,8 @@ export type ChannelStateOptions = {
|
|
|
63
66
|
skipInitialization?: string[];
|
|
64
67
|
skipHydration?: boolean;
|
|
65
68
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* This is a compatibility bridge for internal callers that need response level
|
|
69
|
-
* metadata such as `predefined_filter`. The default `queryChannels()` return value
|
|
70
|
-
* remains `Channel[]` to avoid a breaking change. This should be folded into a
|
|
71
|
-
* single full response API in the next major release.
|
|
69
|
+
* Makes `queryChannelsAndHydrate()` return the full query response (with hydrated `channels`,
|
|
70
|
+
* plus metadata such as `predefined_filter`) instead of `Channel[]`.
|
|
72
71
|
*/
|
|
73
72
|
withResponse?: boolean;
|
|
74
73
|
};
|
|
@@ -78,41 +77,6 @@ export type Automod = ChannelConfigWithInfo['automod'];
|
|
|
78
77
|
export type AutomodBehavior = ChannelConfigWithInfo['automod_behavior'];
|
|
79
78
|
export type PinnedMessagePaginationOptions = Omit<NonNullable<Parameters<ChatApi['getPinnedMessages']>[1]>, 'sort'>;
|
|
80
79
|
export type QueryMembersOptions = Partial<Omit<QueryMembersPayload, 'filter_conditions'>>;
|
|
81
|
-
export type StreamChatOptions = {
|
|
82
|
-
/**
|
|
83
|
-
* Used to disable warnings that are triggered by using connectUser or connectAnonymousUser server-side.
|
|
84
|
-
*/
|
|
85
|
-
allowServerSideConnect?: boolean;
|
|
86
|
-
axiosRequestConfig?: AxiosRequestConfig;
|
|
87
|
-
/**
|
|
88
|
-
* Base url to use for API
|
|
89
|
-
* such as https://chat-proxy-dublin.stream-io-api.com
|
|
90
|
-
*/
|
|
91
|
-
baseURL?: string;
|
|
92
|
-
browser?: boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Custom notification manager service to use for the client.
|
|
95
|
-
* If not provided, a default notification manager will be created.
|
|
96
|
-
* Notifications are used to communicate events like errors, warnings, info, etc. Other services can publish notifications or subscribe to the NotificationManager state changes.
|
|
97
|
-
*/
|
|
98
|
-
notifications?: NotificationManager;
|
|
99
|
-
/**
|
|
100
|
-
* Declarative configuration for instances the SDK creates on your behalf, seeded before the client's
|
|
101
|
-
* own managers are constructed.
|
|
102
|
-
*
|
|
103
|
-
* Equivalent to calling `client.config.set(tree)` immediately after construction, except for the
|
|
104
|
-
* `client` subtree — the configuration registry is created inside the constructor, so this is the only
|
|
105
|
-
* way to configure `reminders` / `notifications` before they are built.
|
|
106
|
-
*/
|
|
107
|
-
config?: DeepPartial<InstanceConfigTree>;
|
|
108
|
-
/**
|
|
109
|
-
* When true, user will be persisted on client. Otherwise if `connectUser` call fails, then you need to
|
|
110
|
-
* call `connectUser` again to retry.
|
|
111
|
-
* This is mainly useful for chat application working in offline mode, where you will need client.user to
|
|
112
|
-
* persist even if connectUser call fails.
|
|
113
|
-
*/
|
|
114
|
-
persistUserOnConnectionFailure?: boolean;
|
|
115
|
-
};
|
|
116
80
|
export type UnBanUserOptions = {
|
|
117
81
|
client_id?: string;
|
|
118
82
|
connection_id?: string;
|
|
@@ -125,13 +89,9 @@ export type UnBanUserOptions = {
|
|
|
125
89
|
/** Everything `queryUsers()` accepts apart from the filter and the sort. */
|
|
126
90
|
export type UserOptions = Omit<QueryUsersPayload, 'filter_conditions' | 'sort'>;
|
|
127
91
|
/**
|
|
128
|
-
* Which
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* `client.networkConnection`. `'ws'` is this client's WebSocket. They are different facts and routinely
|
|
132
|
-
* disagree: a socket dies on a working network (server close, expired token, health-check timeout),
|
|
133
|
-
* and a device goes offline while the socket has not noticed yet — which is why each has its own
|
|
134
|
-
* store and neither is derived from the other.
|
|
92
|
+
* Which connection a status refers to: `'network'` is the device's network (reported by the
|
|
93
|
+
* platform reporter installed on `client.networkConnection`), `'ws'` is this client's WebSocket.
|
|
94
|
+
* They can disagree, so each has its own store.
|
|
135
95
|
*/
|
|
136
96
|
export type ConnectionType = 'network' | 'ws';
|
|
137
97
|
type LocalEvent = (({
|
|
@@ -179,14 +139,23 @@ type LocalEvent = (({
|
|
|
179
139
|
};
|
|
180
140
|
export type Event = (WSEvent & {
|
|
181
141
|
received_at?: TimestampNS;
|
|
182
|
-
}) | LocalEvent |
|
|
142
|
+
}) | LocalEvent | CustomEventTypeUnion;
|
|
143
|
+
type CustomEventTypeUnion = {
|
|
144
|
+
[K in keyof CustomEventTypes]: {
|
|
145
|
+
type: K;
|
|
146
|
+
} & Omit<CustomEvent, 'type'> & {
|
|
147
|
+
received_at?: TimestampNS;
|
|
148
|
+
};
|
|
149
|
+
}[keyof CustomEventTypes];
|
|
183
150
|
export type EventType = Event['type'] | 'all';
|
|
184
|
-
export type EventHandler<T = string> = (event: Extract<Event, {
|
|
185
|
-
type: T;
|
|
186
|
-
}>) => void;
|
|
187
151
|
/**
|
|
188
|
-
*
|
|
152
|
+
* A listener for events of type `T`. `'all'` (the default) receives every event, any other type the
|
|
153
|
+
* event members declaring it. Custom event types have to be declared by augmenting
|
|
154
|
+
* `CustomEventTypes`; an undeclared name is not an `EventType`.
|
|
189
155
|
*/
|
|
156
|
+
export type EventHandler<T extends EventType = 'all'> = (event: T extends 'all' ? Event : Extract<Event, {
|
|
157
|
+
type: T;
|
|
158
|
+
}>) => void;
|
|
190
159
|
export type ReactionFilters = NonNullable<QueryReactionsRequest['filter']>;
|
|
191
160
|
export type ChannelFilters = NonNullable<QueryChannelsRequest['filter_conditions']>;
|
|
192
161
|
export type QueryPollsOptions = Omit<QueryPollsRequest, 'filter' | 'sort'>;
|
|
@@ -199,18 +168,14 @@ export type MemberFilters = QueryMembersPayload['filter_conditions'];
|
|
|
199
168
|
export type OGAttachment = RequireLiteral<Attachment, 'og_scrape_url'>;
|
|
200
169
|
export type PushProvider = CreateDeviceRequest['push_provider'];
|
|
201
170
|
/**
|
|
202
|
-
* Server-provided channel configuration, keyed by
|
|
203
|
-
*
|
|
204
|
-
*
|
|
171
|
+
* Server-provided channel configuration, keyed by cid (`messaging:general`). Keyed per channel
|
|
172
|
+
* because a channel's `config_overrides` can narrow its type's config. Read it via
|
|
173
|
+
* `channel.serverConfig`.
|
|
205
174
|
*/
|
|
206
175
|
export type Configs = Record<string, ChannelConfigWithInfo | undefined>;
|
|
207
176
|
export type ConnectionOpen = EventPayload<'health.check'> | EventPayload<'connection.ok'>;
|
|
208
177
|
/**
|
|
209
|
-
* The message `type` values the server can return.
|
|
210
|
-
*
|
|
211
|
-
* Hand-written because there is no generated equivalent: `MessageResponse['type']` is a bare
|
|
212
|
-
* `string`, so deriving it would widen rather than narrow. Both the React and React Native
|
|
213
|
-
* SDKs use this as a discriminant (RN types its SQLite message rows with it).
|
|
178
|
+
* The message `type` values the server can return (`MessageResponse['type']` is a bare `string`).
|
|
214
179
|
*/
|
|
215
180
|
export type MessageLabel = 'deleted' | 'ephemeral' | 'error' | 'regular' | 'reply' | 'system';
|
|
216
181
|
export type SendMessageOptions = Omit<SendMessageRequest, 'message'>;
|
|
@@ -222,13 +187,9 @@ export declare class StreamAPIError<T = APIError> extends Error {
|
|
|
222
187
|
status: number | undefined;
|
|
223
188
|
response: AxiosResponse<T> | undefined;
|
|
224
189
|
constructor(message: string, { code, status, response, }: {
|
|
225
|
-
/**
|
|
226
|
-
* Stream error code (`APIError.code`)
|
|
227
|
-
*/
|
|
190
|
+
/** Stream error code (`APIError.code`) */
|
|
228
191
|
code: StreamAPIError<T>['code'];
|
|
229
|
-
/**
|
|
230
|
-
* HTTP status code
|
|
231
|
-
*/
|
|
192
|
+
/** HTTP status code */
|
|
232
193
|
status: StreamAPIError<T>['status'];
|
|
233
194
|
response: StreamAPIError<T>['response'];
|
|
234
195
|
});
|
|
@@ -242,18 +203,12 @@ export declare class StreamAPIError<T = APIError> extends Error {
|
|
|
242
203
|
readonly status: number | undefined;
|
|
243
204
|
};
|
|
244
205
|
}
|
|
245
|
-
/**
|
|
246
|
-
* Poll vote visibility. Derived from the generated request shape so it tracks the spec.
|
|
247
|
-
*/
|
|
248
206
|
export type VotingVisibility = NonNullable<CreatePollRequest['voting_visibility']>;
|
|
249
207
|
export type PartialPollUpdate = {
|
|
250
208
|
set?: Partial<UpdatePollRequest>;
|
|
251
209
|
unset?: Array<keyof UpdatePollRequest>;
|
|
252
210
|
};
|
|
253
|
-
/**
|
|
254
|
-
* Options accepted by `moderation.flagUser` / `moderation.flagMessage` on top of the
|
|
255
|
-
* entity they resolve and the `reason` they take positionally.
|
|
256
|
-
*/
|
|
211
|
+
/** Options of `moderation.flagUser` / `moderation.flagMessage` besides the entity and `reason`. */
|
|
257
212
|
export type ModerationFlagOptions = Omit<FlagRequest, 'entity_id' | 'entity_type' | 'reason'>;
|
|
258
213
|
export type AIState = 'AI_STATE_IDLE' | 'AI_STATE_ERROR' | 'AI_STATE_EXTERNAL_SOURCES' | 'AI_STATE_THINKING' | 'AI_STATE_GENERATING' | 'AI_STATE_STOP' | (string & {});
|
|
259
214
|
export declare const AIStates: {
|
|
@@ -264,27 +219,18 @@ export declare const AIStates: {
|
|
|
264
219
|
readonly Stop: "AI_STATE_STOP";
|
|
265
220
|
readonly Thinking: "AI_STATE_THINKING";
|
|
266
221
|
};
|
|
267
|
-
/**
|
|
268
|
-
* An identifier containing information about the downstream SDK using stream-chat. It
|
|
269
|
-
* is used to resolve the user agent.
|
|
270
|
-
*/
|
|
222
|
+
/** The downstream SDK using stream-chat, used to resolve the user agent. */
|
|
271
223
|
export type SdkIdentifier = {
|
|
272
224
|
name: 'react' | 'react-native' | 'expo' | 'angular';
|
|
273
225
|
version: string;
|
|
274
226
|
};
|
|
275
|
-
/**
|
|
276
|
-
* An identifier containing information about the downstream device using stream-chat, if
|
|
277
|
-
* available. Is used by the react-native SDKs to enrich the user agent further.
|
|
278
|
-
*/
|
|
227
|
+
/** The downstream device, used by the React Native SDKs to enrich the user agent. */
|
|
279
228
|
export type DeviceIdentifier = {
|
|
280
229
|
os: string;
|
|
281
230
|
model?: string;
|
|
282
231
|
};
|
|
283
232
|
/**
|
|
284
|
-
*
|
|
285
|
-
* stream-chat, if available. `name` is reported as `app` and `version` as `app_version`
|
|
286
|
-
* in the user agent. Distinct from the SDK ({@link SdkIdentifier}) and device
|
|
287
|
-
* ({@link DeviceIdentifier}) identifiers.
|
|
233
|
+
* The downstream app: `name` is reported as `app` and `version` as `app_version` in the user agent.
|
|
288
234
|
*/
|
|
289
235
|
export type AppIdentifier = {
|
|
290
236
|
name: string;
|
|
@@ -323,10 +269,6 @@ export type DeleteMessageOptions = NonNullable<Parameters<ChatApi['deleteMessage
|
|
|
323
269
|
export type SendMessageAPIResponse = StreamResponse<SendMessageResponse>;
|
|
324
270
|
export type UpdateMessageOptions = Omit<UpdateMessageRequest, 'message'>;
|
|
325
271
|
export type UpdateMessageAPIResponse = StreamResponse<UpdateMessageResponse>;
|
|
326
|
-
/**
|
|
327
|
-
* The Giphy rendition names, derived from the generated `Images` shape so the two cannot
|
|
328
|
-
* drift. Consumed by the React and React Native SDKs to pick a rendition size.
|
|
329
|
-
*/
|
|
330
272
|
export type GiphyVersions = keyof Images;
|
|
331
273
|
export type TranslationLanguage = TranslateMessageRequest['language'];
|
|
332
274
|
export type FileReferenceBase = {
|
|
@@ -336,8 +278,7 @@ export type FileReferenceBase = {
|
|
|
336
278
|
};
|
|
337
279
|
export type FileUploadInput = File | Blob | FileReferenceBase | string;
|
|
338
280
|
/**
|
|
339
|
-
* Structural subset of axios' `AxiosProgressEvent`,
|
|
340
|
-
* public surface does not depend on axios.
|
|
281
|
+
* Structural subset of axios' `AxiosProgressEvent`, so the public surface does not depend on axios.
|
|
341
282
|
*/
|
|
342
283
|
export type StreamProgressEvent = {
|
|
343
284
|
loaded: number;
|
|
@@ -349,9 +290,7 @@ export type StreamRequestOptions = {
|
|
|
349
290
|
signal?: AbortSignal;
|
|
350
291
|
/** Only meaningful for upload (multipart) requests; ignored everywhere else. */
|
|
351
292
|
onUploadProgress?: (event: StreamProgressEvent) => void;
|
|
352
|
-
/**
|
|
353
|
-
* Milliseconds before this request is aborted.
|
|
354
|
-
*/
|
|
293
|
+
/** Milliseconds before this request is aborted. */
|
|
355
294
|
timeout?: number;
|
|
356
295
|
};
|
|
357
296
|
export * from './gen/models';
|
|
@@ -2,9 +2,9 @@ export type DeepPartial<T> = {
|
|
|
2
2
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
3
3
|
};
|
|
4
4
|
/**
|
|
5
|
-
* The keys of every union member, not only those common to all
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* The keys of every union member, not only those common to all (`keyof (A | B)`). Distribution
|
|
6
|
+
* needs the naked type parameter: the same conditional inline over a concrete union yields the
|
|
7
|
+
* common keys.
|
|
8
8
|
*/
|
|
9
9
|
export type KeysOfUnion<T> = T extends unknown ? keyof T : never;
|
|
10
10
|
/** The type `Key` has in each union member declaring it; members without it drop out as `never`. */
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import type { FileReferenceBase, FileUploadInput } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Wraps a bare URI string in a {@link FileReferenceBase}; `File`, `Blob` and picker objects pass
|
|
4
|
+
* through.
|
|
5
5
|
*/
|
|
6
6
|
export declare const normalizeUploadFile: (file?: FileUploadInput) => Blob | FileReferenceBase | {
|
|
7
7
|
uri: string;
|
|
8
8
|
} | undefined;
|
|
9
9
|
/**
|
|
10
|
-
* Appends one request-body entry to a multipart form
|
|
11
|
-
*
|
|
12
|
-
* Callers must pass **raw** values - objects and arrays are JSON-encoded here (that is what
|
|
13
|
-
* the API expects for `user` and `upload_sizes`), so pre-stringifying them double-encodes.
|
|
10
|
+
* Appends one request-body entry to a multipart form. Pass **raw** values: objects and arrays are
|
|
11
|
+
* JSON-encoded here, so pre-stringifying them double-encodes.
|
|
14
12
|
*/
|
|
15
13
|
export declare function appendToFormData(data: FormData, key: string, value: unknown): void;
|
|
16
|
-
/**
|
|
17
|
-
* Encodes a request body as `multipart/form-data`. Used by `ApiClient.sendRequest` for every
|
|
18
|
-
* generated operation declaring that content type.
|
|
19
|
-
*/
|
|
14
|
+
/** Encodes a request body as `multipart/form-data`. */
|
|
20
15
|
export declare function toFormData(body: Record<string, unknown>): FormData;
|