stream-chat 9.50.3 → 10.0.0-rc.2
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 +19798 -14472
- package/dist/cjs/index.browser.js.map +4 -4
- package/dist/cjs/index.node.js +19817 -14482
- package/dist/cjs/index.node.js.map +4 -4
- package/dist/esm/index.mjs +19795 -14469
- package/dist/esm/index.mjs.map +4 -4
- package/dist/types/ChannelManager.d.ts +221 -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 +454 -479
- package/dist/types/channel_batch_updater.d.ts +0 -93
- package/dist/types/channel_state.d.ts +53 -201
- package/dist/types/client.d.ts +451 -1920
- 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/entityStore/EntityStore.d.ts +111 -0
- package/dist/types/entityStore/StoreBackedItemIndex.d.ts +60 -0
- package/dist/types/entityStore/applyReactionLocally.d.ts +26 -0
- package/dist/types/entityStore/index.d.ts +2 -0
- package/dist/types/errors.d.ts +10 -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 +8 -7
- package/dist/types/insights.d.ts +9 -8
- 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 +111 -87
- package/dist/types/offline-support/offline_sync_manager.d.ts +0 -7
- 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 +25 -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 +848 -0
- package/dist/types/pagination/paginators/ChannelPaginator.d.ts +212 -0
- package/dist/types/pagination/paginators/MessageIntervalPaginator.d.ts +282 -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/paginators/stateThrottling.d.ts +2 -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 +70 -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 +197 -3404
- 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/throttling/throttle.d.ts +36 -0
- package/dist/types/utils.d.ts +100 -194
- package/package.json +7 -3
- package/src/ChannelManager.ts +724 -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 +1344 -1282
- package/src/channel_batch_updater.ts +1 -211
- package/src/channel_state.ts +144 -1013
- package/src/client.ts +936 -3995
- 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/entityStore/EntityStore.ts +208 -0
- package/src/entityStore/StoreBackedItemIndex.ts +115 -0
- package/src/entityStore/applyReactionLocally.ts +113 -0
- package/src/entityStore/index.ts +2 -0
- package/src/errors.ts +14 -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 +11 -12
- 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 +200 -133
- package/src/offline-support/offline_sync_manager.ts +23 -44
- 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 +25 -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 +2859 -0
- package/src/pagination/paginators/ChannelPaginator.ts +729 -0
- package/src/pagination/paginators/MessageIntervalPaginator.ts +1116 -0
- package/src/pagination/paginators/MessagePaginator.ts +508 -0
- package/src/pagination/paginators/PinnedMessagePaginator.ts +108 -0
- package/src/pagination/paginators/ReminderPaginator.ts +107 -0
- package/src/pagination/paginators/UserGroupPaginator.ts +127 -0
- package/src/pagination/paginators/index.ts +7 -0
- package/src/pagination/paginators/stateThrottling.ts +31 -0
- package/src/pagination/sortCompiler.ts +193 -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 +562 -238
- package/src/thread_manager.ts +37 -16
- package/src/token_manager.ts +21 -10
- package/src/types.ts +364 -4533
- 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/throttling/throttle.ts +130 -0
- package/src/utils.ts +208 -754
- package/dist/types/channel_manager.d.ts +0 -122
- 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/channel_manager.ts +0 -830
- 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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { MessageOperationsContext, OperationParams, OperationRequestFn } from './types';
|
|
2
|
+
export declare class MessageOperations {
|
|
3
|
+
private ctx;
|
|
4
|
+
private policy;
|
|
5
|
+
private failedSendCache;
|
|
6
|
+
constructor(ctx: MessageOperationsContext);
|
|
7
|
+
private normalizeMessage;
|
|
8
|
+
private pruneExpiredFailedSendCache;
|
|
9
|
+
private cacheFailedSend;
|
|
10
|
+
private getCachedFailedSend;
|
|
11
|
+
private clearCachedFailedSend;
|
|
12
|
+
private run;
|
|
13
|
+
send(params: OperationParams<'send'>, requestFn?: OperationRequestFn<'send'>): Promise<void>;
|
|
14
|
+
retry(params: OperationParams<'retry'>, requestFn?: OperationRequestFn<'retry'>): Promise<void>;
|
|
15
|
+
update(params: OperationParams<'update'>, requestFn?: OperationRequestFn<'update'>): Promise<void>;
|
|
16
|
+
delete(params: OperationParams<'delete'>, requestFn?: OperationRequestFn<'delete'>): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { MessageOperations } from './MessageOperations';
|
|
2
|
+
export { MessageOperationStatePolicy } from './MessageOperationStatePolicy';
|
|
3
|
+
export type { MessageOperationsContext, MessageOperationsHandlers, OperationKind, OperationParams, OperationRequestFn, OperationResponse, } from './types';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DeleteMessageOptions, LocalMessage, MessageRequest, MessageResponse, SendMessageAPIResponse, SendMessageOptions, UpdateMessageAPIResponse, UpdateMessageOptions } from '../types';
|
|
2
|
+
export type OperationKind = 'send' | 'retry' | 'update' | 'delete';
|
|
3
|
+
export type MessageOperationSpec = {
|
|
4
|
+
send: {
|
|
5
|
+
options: SendMessageOptions;
|
|
6
|
+
requestResult: SendMessageAPIResponse;
|
|
7
|
+
};
|
|
8
|
+
retry: {
|
|
9
|
+
options: SendMessageOptions;
|
|
10
|
+
requestResult: SendMessageAPIResponse;
|
|
11
|
+
};
|
|
12
|
+
update: {
|
|
13
|
+
options: UpdateMessageOptions;
|
|
14
|
+
requestResult: UpdateMessageAPIResponse;
|
|
15
|
+
};
|
|
16
|
+
delete: {
|
|
17
|
+
options: DeleteMessageOptions;
|
|
18
|
+
requestResult: {
|
|
19
|
+
message: MessageResponse;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type OperationParams<K extends OperationKind> = {
|
|
24
|
+
localMessage: LocalMessage;
|
|
25
|
+
options?: MessageOperationSpec[K]['options'];
|
|
26
|
+
} & (K extends 'send' | 'retry' ? {
|
|
27
|
+
message?: MessageRequest;
|
|
28
|
+
} : {});
|
|
29
|
+
export type OperationResponse = {
|
|
30
|
+
message: MessageResponse;
|
|
31
|
+
};
|
|
32
|
+
export type OperationRequestFn<K extends OperationKind> = (params: OperationParams<K>) => Promise<OperationResponse>;
|
|
33
|
+
export type MessageOperationsHandlers = {
|
|
34
|
+
delete?: OperationRequestFn<'delete'>;
|
|
35
|
+
send?: OperationRequestFn<'send'>;
|
|
36
|
+
retry?: OperationRequestFn<'retry'>;
|
|
37
|
+
update?: OperationRequestFn<'update'>;
|
|
38
|
+
};
|
|
39
|
+
export type MessageOperationsContext = {
|
|
40
|
+
ingest: (m: LocalMessage) => void;
|
|
41
|
+
get: (id: string) => LocalMessage | undefined;
|
|
42
|
+
normalizeOutgoingMessage?: (m: MessageRequest) => MessageRequest;
|
|
43
|
+
defaults: {
|
|
44
|
+
delete: (id: string, o?: DeleteMessageOptions) => Promise<OperationResponse>;
|
|
45
|
+
send: (m: MessageRequest, o?: SendMessageOptions) => Promise<OperationResponse>;
|
|
46
|
+
update: (m: LocalMessage, o?: UpdateMessageOptions) => Promise<OperationResponse>;
|
|
47
|
+
};
|
|
48
|
+
handlers: () => MessageOperationsHandlers;
|
|
49
|
+
};
|
|
@@ -1,220 +1,38 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ModerationFlagOptions, UnmuteUserResponse } from './types';
|
|
2
2
|
import type { StreamChat } from './client';
|
|
3
|
+
import { ModerationApi } from './gen/moderation/ModerationApi';
|
|
3
4
|
export declare const MODERATION_ENTITY_TYPES: {
|
|
4
5
|
user: string;
|
|
5
6
|
message: string;
|
|
6
|
-
userprofile: string;
|
|
7
7
|
};
|
|
8
|
-
export declare class Moderation {
|
|
8
|
+
export declare class Moderation extends ModerationApi {
|
|
9
9
|
client: StreamChat;
|
|
10
10
|
constructor(client: StreamChat);
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Flags a user.
|
|
13
13
|
*
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @
|
|
19
|
-
* @returns
|
|
14
|
+
* @param flaggedUserId - User ID to be flagged.
|
|
15
|
+
* @param reason - Reason for flagging the user.
|
|
16
|
+
* @param options - Additional options for flagging the user (optional, defaults to `{}`).
|
|
17
|
+
* @param options.custom - Additional data to be stored with the flag (optional).
|
|
18
|
+
* @returns The flag response.
|
|
20
19
|
*/
|
|
21
|
-
flagUser(
|
|
22
|
-
item_id: string;
|
|
23
|
-
} & APIResponse>;
|
|
20
|
+
flagUser(flaggedUserId: string, reason: string, options?: ModerationFlagOptions): Promise<import("./types").StreamResponse<import(".").FlagItemResponse>>;
|
|
24
21
|
/**
|
|
25
|
-
*
|
|
22
|
+
* Flags a message.
|
|
26
23
|
*
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @
|
|
32
|
-
* @returns
|
|
24
|
+
* @param messageId - MessageRequest ID to be flagged.
|
|
25
|
+
* @param reason - Reason for flagging the message.
|
|
26
|
+
* @param options - Additional options for flagging the message (optional, defaults to `{}`).
|
|
27
|
+
* @param options.custom - Additional data to be stored with the flag (optional).
|
|
28
|
+
* @returns The flag response.
|
|
33
29
|
*/
|
|
34
|
-
flagMessage(
|
|
35
|
-
item_id: string;
|
|
36
|
-
} & APIResponse>;
|
|
30
|
+
flagMessage(messageId: string, reason: string, options?: ModerationFlagOptions): Promise<import("./types").StreamResponse<import(".").FlagItemResponse>>;
|
|
37
31
|
/**
|
|
38
|
-
*
|
|
32
|
+
* Unmutes a user.
|
|
39
33
|
*
|
|
40
|
-
* @param
|
|
41
|
-
* @
|
|
42
|
-
* @param {string} entityCreatorID User ID of the entity creator
|
|
43
|
-
* @param {string} reason Reason for flagging the entity
|
|
44
|
-
* @param {Object} options Additional options for flagging the entity
|
|
45
|
-
* @param {string} options.user_id (For server side usage) User ID of the user who is flagging the target entity
|
|
46
|
-
* @param {Object} options.moderation_payload Content to be flagged e.g., { texts: ['text1', 'text2'], images: ['image1', 'image2']}
|
|
47
|
-
* @param {Object} options.custom Additional data to be stored with the flag
|
|
48
|
-
* @returns
|
|
34
|
+
* @param targetId - User ID to be unmuted.
|
|
35
|
+
* @returns The unmute response.
|
|
49
36
|
*/
|
|
50
|
-
|
|
51
|
-
item_id: string;
|
|
52
|
-
} & APIResponse>;
|
|
53
|
-
/**
|
|
54
|
-
* Mute a user
|
|
55
|
-
* @param {string} targetID User ID to be muted
|
|
56
|
-
* @param {Object} options Additional options for muting the user
|
|
57
|
-
* @param {string} options.user_id (For server side usage) User ID of the user who is muting the target user
|
|
58
|
-
* @param {number} options.timeout Timeout for the mute in minutes
|
|
59
|
-
* @returns
|
|
60
|
-
*/
|
|
61
|
-
muteUser(targetID: string, options?: ModerationMuteOptions): Promise<APIResponse & {
|
|
62
|
-
mute?: import("./types").MuteResponse;
|
|
63
|
-
mutes?: Array<import("./types").Mute>;
|
|
64
|
-
own_user?: import("./types").OwnUserResponse;
|
|
65
|
-
non_existing_users?: string[];
|
|
66
|
-
}>;
|
|
67
|
-
/**
|
|
68
|
-
* Unmute a user
|
|
69
|
-
* @param {string} targetID User ID to be unmuted
|
|
70
|
-
* @param {Object} options Additional options for unmuting the user
|
|
71
|
-
* @param {string} options.user_id (For server side usage) User ID of the user who is unmuting the target user
|
|
72
|
-
* @returns
|
|
73
|
-
*/
|
|
74
|
-
unmuteUser(targetID: string, options: {
|
|
75
|
-
user_id?: string;
|
|
76
|
-
}): Promise<UnmuteUserResponse>;
|
|
77
|
-
/**
|
|
78
|
-
* Get moderation report for a user
|
|
79
|
-
* @param {string} userID User ID for which moderation report is to be fetched
|
|
80
|
-
* @param {Object} options Additional options for fetching the moderation report
|
|
81
|
-
* @param {boolean} options.create_user_if_not_exists Create user if not exists
|
|
82
|
-
* @param {boolean} options.include_user_blocks Include user blocks
|
|
83
|
-
* @param {boolean} options.include_user_mutes Include user mutes
|
|
84
|
-
*/
|
|
85
|
-
getUserModerationReport(userID: string, options?: GetUserModerationReportOptions): Promise<GetUserModerationReportResponse>;
|
|
86
|
-
/**
|
|
87
|
-
* Query review queue
|
|
88
|
-
* @param {Object} filterConditions Filter conditions for querying review queue
|
|
89
|
-
* @param {Object} sort Sort conditions for querying review queue
|
|
90
|
-
* @param {Object} options Pagination options for querying review queue
|
|
91
|
-
*/
|
|
92
|
-
queryReviewQueue(filterConditions?: ReviewQueueFilters, sort?: ReviewQueueSort, options?: ReviewQueuePaginationOptions): Promise<ReviewQueueResponse>;
|
|
93
|
-
/**
|
|
94
|
-
* Upsert moderation config
|
|
95
|
-
* @param {Object} config Moderation config to be upserted
|
|
96
|
-
*/
|
|
97
|
-
upsertConfig(config: ModerationConfig): Promise<UpsertConfigResponse>;
|
|
98
|
-
/**
|
|
99
|
-
* Get moderation config
|
|
100
|
-
* @param {string} key Key for which moderation config is to be fetched
|
|
101
|
-
*/
|
|
102
|
-
getConfig(key: string, data?: {
|
|
103
|
-
team?: string;
|
|
104
|
-
}): Promise<GetConfigResponse>;
|
|
105
|
-
deleteConfig(key: string, data?: {
|
|
106
|
-
team?: string;
|
|
107
|
-
}): Promise<APIResponse>;
|
|
108
|
-
/**
|
|
109
|
-
* Query moderation configs
|
|
110
|
-
* @param {Object} filterConditions Filter conditions for querying moderation configs
|
|
111
|
-
* @param {Object} sort Sort conditions for querying moderation configs
|
|
112
|
-
* @param {Object} options Additional options for querying moderation configs
|
|
113
|
-
*/
|
|
114
|
-
queryConfigs(filterConditions: QueryModerationConfigsFilters, sort: QueryModerationConfigsSort, options?: Pager): Promise<QueryConfigsResponse>;
|
|
115
|
-
submitAction(actionType: string, itemID: string, options?: SubmitActionOptions): Promise<SubmitActionResponse>;
|
|
116
|
-
/**
|
|
117
|
-
*
|
|
118
|
-
* @param {string} entityType string Type of entity to be checked E.g., stream:user, stream:chat:v1:message, or any custom string
|
|
119
|
-
* @param {string} entityID string ID of the entity to be checked. This is mainly for tracking purposes
|
|
120
|
-
* @param {string} entityCreatorID string ID of the entity creator
|
|
121
|
-
* @param {object} moderationPayload object Content to be checked for moderation. E.g., { texts: ['text1', 'text2'], images: ['image1', 'image2']}
|
|
122
|
-
* @param {Array} moderationPayload.texts array Array of texts to be checked for moderation
|
|
123
|
-
* @param {Array} moderationPayload.images array Array of images to be checked for moderation
|
|
124
|
-
* @param {Array} moderationPayload.videos array Array of videos to be checked for moderation
|
|
125
|
-
* @param configKey
|
|
126
|
-
* @param options
|
|
127
|
-
* @returns
|
|
128
|
-
*/
|
|
129
|
-
check(entityType: string, entityID: string, entityCreatorID: string, moderationPayload: {
|
|
130
|
-
custom?: Record<string, any>;
|
|
131
|
-
images?: string[];
|
|
132
|
-
texts?: string[];
|
|
133
|
-
videos?: string[];
|
|
134
|
-
}, configKey: string, options?: {
|
|
135
|
-
force_sync?: boolean;
|
|
136
|
-
}, testMode?: boolean): Promise<CheckResponse>;
|
|
137
|
-
/**
|
|
138
|
-
* Experimental: Check user profile
|
|
139
|
-
*
|
|
140
|
-
* Warning: This is an experimental feature and the API is subject to change.
|
|
141
|
-
*
|
|
142
|
-
* This function is used to check a user profile for moderation.
|
|
143
|
-
* This will not create any review queue items for the user profile.
|
|
144
|
-
* You can just use this to check whether to allow a certain user profile to be created or not.
|
|
145
|
-
*
|
|
146
|
-
* Example:
|
|
147
|
-
*
|
|
148
|
-
* ```ts
|
|
149
|
-
* const res = await client.moderation.checkUserProfile(userId, { username: "fuck_boy_001", image: "https://example.com/profile.jpg" });
|
|
150
|
-
* if (res.recommended_action === "remove") {
|
|
151
|
-
* // Block the user profile from being created
|
|
152
|
-
* } else {
|
|
153
|
-
* // Allow the user profile to be created
|
|
154
|
-
* }
|
|
155
|
-
* ```
|
|
156
|
-
*
|
|
157
|
-
* @param userId
|
|
158
|
-
* @param profile.username
|
|
159
|
-
* @param profile.image
|
|
160
|
-
* @returns
|
|
161
|
-
*/
|
|
162
|
-
checkUserProfile(userId: string, profile: RequireAtLeastOne<{
|
|
163
|
-
image?: string;
|
|
164
|
-
username?: string;
|
|
165
|
-
}>): Promise<CheckResponse>;
|
|
166
|
-
/**
|
|
167
|
-
*
|
|
168
|
-
* @param {string} entityType string Type of entity to be checked E.g., stream:user, stream:chat:v1:message, or any custom string
|
|
169
|
-
* @param {string} entityID string ID of the entity to be checked. This is mainly for tracking purposes
|
|
170
|
-
* @param {string} entityCreatorID string ID of the entity creator
|
|
171
|
-
* @param {object} moderationPayload object Content to be checked for moderation. E.g., { texts: ['text1', 'text2'], images: ['image1', 'image2']}
|
|
172
|
-
* @param {Array} moderationPayload.texts array Array of texts to be checked for moderation
|
|
173
|
-
* @param {Array} moderationPayload.images array Array of images to be checked for moderation
|
|
174
|
-
* @param {Array} moderationPayload.videos array Array of videos to be checked for moderation
|
|
175
|
-
* @param {object} moderationPayload.custom object Additional custom data to attach to the moderation review queue item
|
|
176
|
-
* @param {Array<CustomCheckFlag>} flags Array of CustomCheckFlag to be passed to flag the entity
|
|
177
|
-
* @returns
|
|
178
|
-
*/
|
|
179
|
-
addCustomFlags(entityType: string, entityID: string, entityCreatorID: string, moderationPayload: {
|
|
180
|
-
custom?: Record<string, any>;
|
|
181
|
-
images?: string[];
|
|
182
|
-
texts?: string[];
|
|
183
|
-
videos?: string[];
|
|
184
|
-
}, flags: CustomCheckFlag[]): Promise<CustomCheckResponse>;
|
|
185
|
-
/**
|
|
186
|
-
* Add custom flags to a message
|
|
187
|
-
* @param {string} messageID Message ID to be flagged
|
|
188
|
-
* @param {Array<CustomCheckFlag>} flags Array of CustomCheckFlag to be passed to flag the message
|
|
189
|
-
* @returns
|
|
190
|
-
*/
|
|
191
|
-
addCustomMessageFlags(messageID: string, flags: CustomCheckFlag[]): Promise<CustomCheckResponse>;
|
|
192
|
-
/**
|
|
193
|
-
* Create or update a moderation rule
|
|
194
|
-
* @param {ModerationRuleRequest} rule Rule configuration to be upserted
|
|
195
|
-
* @returns
|
|
196
|
-
*/
|
|
197
|
-
upsertModerationRule(rule: ModerationRuleRequest): Promise<UpsertModerationRuleResponse>;
|
|
198
|
-
/**
|
|
199
|
-
* Query moderation rules
|
|
200
|
-
* @param {QueryModerationRulesFilters} filterConditions Filter conditions for querying moderation rules
|
|
201
|
-
* @param {QueryModerationRulesSort} sort Sort conditions for querying moderation rules
|
|
202
|
-
* @param {Pager} options Pagination options for querying moderation rules
|
|
203
|
-
* @returns
|
|
204
|
-
*/
|
|
205
|
-
queryModerationRules(filterConditions?: QueryModerationRulesFilters, sort?: QueryModerationRulesSort, options?: Pager): Promise<QueryModerationRulesResponse>;
|
|
206
|
-
/**
|
|
207
|
-
* Get a specific moderation rule by ID
|
|
208
|
-
* @param {string} id ID of the moderation rule to fetch
|
|
209
|
-
* @returns
|
|
210
|
-
*/
|
|
211
|
-
getModerationRule(id: string): Promise<{
|
|
212
|
-
rule: ModerationRule;
|
|
213
|
-
}>;
|
|
214
|
-
/**
|
|
215
|
-
* Delete a moderation rule by ID
|
|
216
|
-
* @param {string} id ID of the moderation rule to delete
|
|
217
|
-
* @returns
|
|
218
|
-
*/
|
|
219
|
-
deleteModerationRule(id: string): Promise<APIResponse>;
|
|
37
|
+
unmuteUser(targetId: string): Promise<UnmuteUserResponse>;
|
|
220
38
|
}
|
|
@@ -28,7 +28,7 @@ export type Notification = {
|
|
|
28
28
|
origin: NotificationOrigin;
|
|
29
29
|
/** Array of action buttons for the notification */
|
|
30
30
|
actions?: NotificationAction[];
|
|
31
|
-
/** The severity level of the notification
|
|
31
|
+
/** The severity level of the notification (defaults to `undefined` unless explicitly provided). */
|
|
32
32
|
severity?: NotificationSeverity;
|
|
33
33
|
/**
|
|
34
34
|
* Optional code that can be used to group the notifications of the same type, e.g. attachment-upload-blocked.
|
|
@@ -50,9 +50,9 @@ export type Notification = {
|
|
|
50
50
|
* 'validation:attachment:size:exceeded' // File size too large
|
|
51
51
|
* 'validation:attachment:count:exceeded' // Too many attachments
|
|
52
52
|
*
|
|
53
|
-
*
|
|
54
|
-
* 'api:message:send:failed' //
|
|
55
|
-
* 'validation:message:content:empty' //
|
|
53
|
+
* MessageRequest related errors
|
|
54
|
+
* 'api:message:send:failed' // MessageRequest send failed
|
|
55
|
+
* 'validation:message:content:empty' // MessageRequest content validation failed
|
|
56
56
|
*
|
|
57
57
|
* Channel related errors
|
|
58
58
|
* 'api:channel:join:failed' // Channel join failed
|
|
@@ -92,11 +92,12 @@ export type NotificationOptions = Partial<Pick<Notification, 'type' | 'severity'
|
|
|
92
92
|
duration?: number;
|
|
93
93
|
};
|
|
94
94
|
/**
|
|
95
|
-
* State shape for the notification store
|
|
96
|
-
*
|
|
95
|
+
* State shape for the notification store.
|
|
96
|
+
*
|
|
97
|
+
* @deprecated Use {@link NotificationManagerState} instead.
|
|
97
98
|
*/
|
|
98
99
|
export type NotificationState = {
|
|
99
|
-
/** Array of current notification objects */
|
|
100
|
+
/** Array of current notification objects. */
|
|
100
101
|
notifications: Notification[];
|
|
101
102
|
};
|
|
102
103
|
/** State shape for the notification store */
|