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.
@@ -13866,28 +13866,29 @@ var DEFAULT_MESSAGE_SET_PAGINATION = { hasNext: false, hasPrev: false };
13866
13866
  var DEFAULT_UPLOAD_SIZE_LIMIT_BYTES = 100 * 1024 * 1024;
13867
13867
  var API_MAX_FILES_ALLOWED_PER_MESSAGE = 10;
13868
13868
  var MAX_CHANNEL_MEMBER_COUNT_IN_CHANNEL_QUERY = 100;
13869
- var RESERVED_UPDATED_MESSAGE_FIELDS = [
13869
+ var RESERVED_UPDATED_MESSAGE_FIELDS = {
13870
13870
  // Dates should not be converted back to ISO strings as JS looses precision on them (milliseconds)
13871
- "created_at",
13872
- "deleted_at",
13873
- "pinned_at",
13874
- "updated_at",
13875
- "command",
13871
+ created_at: true,
13872
+ deleted_at: true,
13873
+ pinned_at: true,
13874
+ updated_at: true,
13875
+ command: true,
13876
13876
  // Back-end enriches these fields
13877
- "mentioned_users",
13878
- "quoted_message",
13877
+ mentioned_users: true,
13878
+ quoted_message: true,
13879
13879
  // Client-specific fields
13880
- "latest_reactions",
13881
- "own_reactions",
13882
- "reaction_counts",
13883
- "reply_count",
13880
+ latest_reactions: true,
13881
+ own_reactions: true,
13882
+ reaction_counts: true,
13883
+ reply_count: true,
13884
13884
  // Message text related fields that shouldn't be in update
13885
- "i18n",
13886
- "type",
13887
- "html",
13888
- "__html"
13889
- ];
13890
- var LOCAL_MESSAGE_FIELDS = ["error"];
13885
+ i18n: true,
13886
+ type: true,
13887
+ html: true,
13888
+ __html: true,
13889
+ user: true
13890
+ };
13891
+ var LOCAL_MESSAGE_FIELDS = { error: true };
13891
13892
 
13892
13893
  // src/utils.ts
13893
13894
  function logChatPromiseExecution(promise, name) {
@@ -14114,11 +14115,13 @@ var localMessageToNewMessagePayload = (localMessage) => {
14114
14115
  };
14115
14116
  };
14116
14117
  var toUpdatedMessagePayload = (message) => {
14118
+ const reservedKeys = {
14119
+ ...RESERVED_UPDATED_MESSAGE_FIELDS,
14120
+ ...LOCAL_MESSAGE_FIELDS
14121
+ };
14117
14122
  const messageFields = Object.fromEntries(
14118
14123
  Object.entries(message).filter(
14119
- ([key]) => ![...RESERVED_UPDATED_MESSAGE_FIELDS, ...LOCAL_MESSAGE_FIELDS].includes(
14120
- key
14121
- )
14124
+ ([key]) => !reservedKeys[key]
14122
14125
  )
14123
14126
  );
14124
14127
  return {
@@ -14126,8 +14129,7 @@ var toUpdatedMessagePayload = (message) => {
14126
14129
  pinned: !!message.pinned_at,
14127
14130
  mentioned_users: message.mentioned_users?.map(
14128
14131
  (user) => typeof user === "string" ? user : user.id
14129
- ),
14130
- user_id: message.user?.id ?? message.user_id
14132
+ )
14131
14133
  };
14132
14134
  };
14133
14135
  var findIndexInSortedArray = ({
@@ -24959,24 +24961,20 @@ var StreamChat = class _StreamChat {
24959
24961
  * updateMessage - Update the given message
24960
24962
  *
24961
24963
  * @param {Omit<MessageResponse, 'mentioned_users'> & { mentioned_users?: string[] }} message object, id needs to be specified
24962
- * @param {string | { id: string }} [userId]
24964
+ * @param {string | { id: string }} [partialUserOrUserId]
24963
24965
  * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
24964
24966
  *
24965
24967
  * @return {{ message: LocalMessage | MessageResponse }} Response that includes the message
24966
24968
  */
24967
- async updateMessage(message, userId, options) {
24969
+ async updateMessage(message, partialUserOrUserId, options) {
24968
24970
  if (!message.id) {
24969
- throw Error("Please specify the message id when calling updateMessage");
24971
+ throw Error("Please specify the message.id when calling updateMessage");
24970
24972
  }
24971
24973
  const payload = toUpdatedMessagePayload(message);
24972
- if (userId != null) {
24973
- if (isString3(userId)) {
24974
- payload.user_id = userId;
24975
- } else {
24976
- payload.user = {
24977
- id: userId.id
24978
- };
24979
- }
24974
+ if (typeof partialUserOrUserId === "string") {
24975
+ payload.user_id = partialUserOrUserId;
24976
+ } else if (typeof partialUserOrUserId?.id === "string") {
24977
+ payload.user_id = partialUserOrUserId.id;
24980
24978
  }
24981
24979
  return await this.post(
24982
24980
  this.baseURL + `/messages/${encodeURIComponent(message.id)}`,
@@ -24999,13 +24997,15 @@ var StreamChat = class _StreamChat {
24999
24997
  *
25000
24998
  * @return {{ message: MessageResponse }} Response that includes the updated message
25001
24999
  */
25002
- async partialUpdateMessage(id, partialMessageObject, userId, options) {
25000
+ async partialUpdateMessage(id, partialMessageObject, partialUserOrUserId, options) {
25003
25001
  if (!id) {
25004
- throw Error("Please specify the message id when calling partialUpdateMessage");
25002
+ throw Error("Please specify the message.id when calling partialUpdateMessage");
25005
25003
  }
25006
- let user = userId;
25007
- if (userId != null && isString3(userId)) {
25008
- user = { id: userId };
25004
+ let user = void 0;
25005
+ if (typeof partialUserOrUserId === "string") {
25006
+ user = { id: partialUserOrUserId };
25007
+ } else if (typeof partialUserOrUserId?.id === "string") {
25008
+ user = { id: partialUserOrUserId.id };
25009
25009
  }
25010
25010
  return await this.put(
25011
25011
  this.baseURL + `/messages/${encodeURIComponent(id)}`,
@@ -25160,7 +25160,7 @@ var StreamChat = class _StreamChat {
25160
25160
  if (this.userAgent) {
25161
25161
  return this.userAgent;
25162
25162
  }
25163
- const version = "9.0.0";
25163
+ const version = "9.0.1";
25164
25164
  const clientBundle = "node-cjs";
25165
25165
  let userAgentString = "";
25166
25166
  if (this.sdkIdentifier) {