stream-chat 9.0.0 → 9.0.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.cjs +40 -40
- package/dist/cjs/index.browser.cjs.map +2 -2
- package/dist/cjs/index.node.cjs +40 -40
- package/dist/cjs/index.node.cjs.map +2 -2
- package/dist/esm/index.js +40 -40
- package/dist/esm/index.js.map +2 -2
- package/dist/types/client.d.ts +3 -3
- package/dist/types/constants.d.ts +21 -3
- package/dist/types/types.d.ts +2 -1
- package/package.json +1 -1
- package/src/client.ts +21 -16
- package/src/constants.ts +19 -20
- package/src/types.ts +2 -17
- package/src/utils.ts +6 -7
|
@@ -2523,28 +2523,29 @@ var DEFAULT_MESSAGE_SET_PAGINATION = { hasNext: false, hasPrev: false };
|
|
|
2523
2523
|
var DEFAULT_UPLOAD_SIZE_LIMIT_BYTES = 100 * 1024 * 1024;
|
|
2524
2524
|
var API_MAX_FILES_ALLOWED_PER_MESSAGE = 10;
|
|
2525
2525
|
var MAX_CHANNEL_MEMBER_COUNT_IN_CHANNEL_QUERY = 100;
|
|
2526
|
-
var RESERVED_UPDATED_MESSAGE_FIELDS =
|
|
2526
|
+
var RESERVED_UPDATED_MESSAGE_FIELDS = {
|
|
2527
2527
|
// Dates should not be converted back to ISO strings as JS looses precision on them (milliseconds)
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2528
|
+
created_at: true,
|
|
2529
|
+
deleted_at: true,
|
|
2530
|
+
pinned_at: true,
|
|
2531
|
+
updated_at: true,
|
|
2532
|
+
command: true,
|
|
2533
2533
|
// Back-end enriches these fields
|
|
2534
|
-
|
|
2535
|
-
|
|
2534
|
+
mentioned_users: true,
|
|
2535
|
+
quoted_message: true,
|
|
2536
2536
|
// Client-specific fields
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2537
|
+
latest_reactions: true,
|
|
2538
|
+
own_reactions: true,
|
|
2539
|
+
reaction_counts: true,
|
|
2540
|
+
reply_count: true,
|
|
2541
2541
|
// Message text related fields that shouldn't be in update
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2542
|
+
i18n: true,
|
|
2543
|
+
type: true,
|
|
2544
|
+
html: true,
|
|
2545
|
+
__html: true,
|
|
2546
|
+
user: true
|
|
2547
|
+
};
|
|
2548
|
+
var LOCAL_MESSAGE_FIELDS = { error: true };
|
|
2548
2549
|
|
|
2549
2550
|
// src/utils.ts
|
|
2550
2551
|
function logChatPromiseExecution(promise, name) {
|
|
@@ -2771,11 +2772,13 @@ var localMessageToNewMessagePayload = (localMessage) => {
|
|
|
2771
2772
|
};
|
|
2772
2773
|
};
|
|
2773
2774
|
var toUpdatedMessagePayload = (message) => {
|
|
2775
|
+
const reservedKeys = {
|
|
2776
|
+
...RESERVED_UPDATED_MESSAGE_FIELDS,
|
|
2777
|
+
...LOCAL_MESSAGE_FIELDS
|
|
2778
|
+
};
|
|
2774
2779
|
const messageFields = Object.fromEntries(
|
|
2775
2780
|
Object.entries(message).filter(
|
|
2776
|
-
([key]) => ![
|
|
2777
|
-
key
|
|
2778
|
-
)
|
|
2781
|
+
([key]) => !reservedKeys[key]
|
|
2779
2782
|
)
|
|
2780
2783
|
);
|
|
2781
2784
|
return {
|
|
@@ -2783,8 +2786,7 @@ var toUpdatedMessagePayload = (message) => {
|
|
|
2783
2786
|
pinned: !!message.pinned_at,
|
|
2784
2787
|
mentioned_users: message.mentioned_users?.map(
|
|
2785
2788
|
(user) => typeof user === "string" ? user : user.id
|
|
2786
|
-
)
|
|
2787
|
-
user_id: message.user?.id ?? message.user_id
|
|
2789
|
+
)
|
|
2788
2790
|
};
|
|
2789
2791
|
};
|
|
2790
2792
|
var findIndexInSortedArray = ({
|
|
@@ -13628,24 +13630,20 @@ var StreamChat = class _StreamChat {
|
|
|
13628
13630
|
* updateMessage - Update the given message
|
|
13629
13631
|
*
|
|
13630
13632
|
* @param {Omit<MessageResponse, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
|
|
13631
|
-
* @param {string | { id: string }} [
|
|
13633
|
+
* @param {string | { id: string }} [partialUserOrUserId]
|
|
13632
13634
|
* @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
|
|
13633
13635
|
*
|
|
13634
13636
|
* @return {{ message: LocalMessage | MessageResponse }} Response that includes the message
|
|
13635
13637
|
*/
|
|
13636
|
-
async updateMessage(message,
|
|
13638
|
+
async updateMessage(message, partialUserOrUserId, options) {
|
|
13637
13639
|
if (!message.id) {
|
|
13638
|
-
throw Error("Please specify the message
|
|
13640
|
+
throw Error("Please specify the message.id when calling updateMessage");
|
|
13639
13641
|
}
|
|
13640
13642
|
const payload = toUpdatedMessagePayload(message);
|
|
13641
|
-
if (
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
payload.user = {
|
|
13646
|
-
id: userId.id
|
|
13647
|
-
};
|
|
13648
|
-
}
|
|
13643
|
+
if (typeof partialUserOrUserId === "string") {
|
|
13644
|
+
payload.user_id = partialUserOrUserId;
|
|
13645
|
+
} else if (typeof partialUserOrUserId?.id === "string") {
|
|
13646
|
+
payload.user_id = partialUserOrUserId.id;
|
|
13649
13647
|
}
|
|
13650
13648
|
return await this.post(
|
|
13651
13649
|
this.baseURL + `/messages/${encodeURIComponent(message.id)}`,
|
|
@@ -13668,13 +13666,15 @@ var StreamChat = class _StreamChat {
|
|
|
13668
13666
|
*
|
|
13669
13667
|
* @return {{ message: MessageResponse }} Response that includes the updated message
|
|
13670
13668
|
*/
|
|
13671
|
-
async partialUpdateMessage(id, partialMessageObject,
|
|
13669
|
+
async partialUpdateMessage(id, partialMessageObject, partialUserOrUserId, options) {
|
|
13672
13670
|
if (!id) {
|
|
13673
|
-
throw Error("Please specify the message
|
|
13671
|
+
throw Error("Please specify the message.id when calling partialUpdateMessage");
|
|
13674
13672
|
}
|
|
13675
|
-
let user =
|
|
13676
|
-
if (
|
|
13677
|
-
user = { id:
|
|
13673
|
+
let user = void 0;
|
|
13674
|
+
if (typeof partialUserOrUserId === "string") {
|
|
13675
|
+
user = { id: partialUserOrUserId };
|
|
13676
|
+
} else if (typeof partialUserOrUserId?.id === "string") {
|
|
13677
|
+
user = { id: partialUserOrUserId.id };
|
|
13678
13678
|
}
|
|
13679
13679
|
return await this.put(
|
|
13680
13680
|
this.baseURL + `/messages/${encodeURIComponent(id)}`,
|
|
@@ -13829,7 +13829,7 @@ var StreamChat = class _StreamChat {
|
|
|
13829
13829
|
if (this.userAgent) {
|
|
13830
13830
|
return this.userAgent;
|
|
13831
13831
|
}
|
|
13832
|
-
const version = "9.0.
|
|
13832
|
+
const version = "9.0.1";
|
|
13833
13833
|
const clientBundle = "browser-cjs";
|
|
13834
13834
|
let userAgentString = "";
|
|
13835
13835
|
if (this.sdkIdentifier) {
|