stream-chat 9.45.4 → 9.45.6

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.
@@ -23,6 +23,7 @@ import { ReminderManager } from './reminders';
23
23
  import { StateStore } from './store';
24
24
  import type { MessageComposer } from './messageComposer';
25
25
  import type { AbstractOfflineDB } from './offline-support';
26
+ import { FixedSizeQueueCache } from './utils/FixedSizeQueueCache';
26
27
  type MessageComposerTearDownFunction = () => void;
27
28
  export type QueryChannelsResponseWithChannels = Omit<QueryChannelsAPIResponse, 'channels'> & {
28
29
  channels: Channel[];
@@ -110,6 +111,7 @@ export declare class StreamChat {
110
111
  defaultWSTimeout: number;
111
112
  sdkIdentifier?: SdkIdentifier;
112
113
  deviceIdentifier?: DeviceIdentifier;
114
+ readonly messageComposerCache: FixedSizeQueueCache<string, MessageComposer>;
113
115
  private nextRequestAbortController;
114
116
  /**
115
117
  * @private
@@ -172,10 +172,12 @@ export declare class Moderation {
172
172
  * @param {Array} moderationPayload.texts array Array of texts to be checked for moderation
173
173
  * @param {Array} moderationPayload.images array Array of images to be checked for moderation
174
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
175
176
  * @param {Array<CustomCheckFlag>} flags Array of CustomCheckFlag to be passed to flag the entity
176
177
  * @returns
177
178
  */
178
179
  addCustomFlags(entityType: string, entityID: string, entityCreatorID: string, moderationPayload: {
180
+ custom?: Record<string, any>;
179
181
  images?: string[];
180
182
  texts?: string[];
181
183
  videos?: string[];
@@ -28,4 +28,8 @@ export declare class FixedSizeQueueCache<K, T> {
28
28
  * @param key
29
29
  */
30
30
  get(key: K): T | undefined;
31
+ /**
32
+ * Clears queue entirely and disposes of each item individually.
33
+ */
34
+ clear(): void;
31
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stream-chat",
3
- "version": "9.45.4",
3
+ "version": "9.45.6",
4
4
  "description": "JS SDK for the Stream Chat API",
5
5
  "homepage": "https://getstream.io/chat/",
6
6
  "author": {
package/src/client.ts CHANGED
@@ -293,6 +293,7 @@ import { StateStore } from './store';
293
293
  import type { MessageComposer } from './messageComposer';
294
294
  import type { AbstractOfflineDB } from './offline-support';
295
295
  import { getPendingTaskChannelData } from './offline-support/util';
296
+ import { FixedSizeQueueCache } from './utils/FixedSizeQueueCache';
296
297
 
297
298
  function isString(x: unknown): x is string {
298
299
  return typeof x === 'string' || x instanceof String;
@@ -393,6 +394,7 @@ export class StreamChat {
393
394
  defaultWSTimeout: number;
394
395
  sdkIdentifier?: SdkIdentifier;
395
396
  deviceIdentifier?: DeviceIdentifier;
397
+ readonly messageComposerCache: FixedSizeQueueCache<string, MessageComposer>;
396
398
  private nextRequestAbortController: AbortController | null = null;
397
399
  /**
398
400
  * @private
@@ -573,6 +575,7 @@ export class StreamChat {
573
575
  this.polls = new PollManager({ client: this });
574
576
  this.reminders = new ReminderManager({ client: this });
575
577
  this.messageDeliveryReporter = new MessageDeliveryReporter({ client: this });
578
+ this.messageComposerCache = new FixedSizeQueueCache<string, MessageComposer>(64);
576
579
  }
577
580
 
578
581
  /**
@@ -1060,6 +1063,7 @@ export class StreamChat {
1060
1063
  // reset thread manager
1061
1064
  this.threads.resetState();
1062
1065
  this.uploadManager.reset();
1066
+ this.messageComposerCache.clear();
1063
1067
 
1064
1068
  // Since we wipe all user data already, we should reset token manager as well
1065
1069
  closePromise
package/src/moderation.ts CHANGED
@@ -361,6 +361,7 @@ export class Moderation {
361
361
  * @param {Array} moderationPayload.texts array Array of texts to be checked for moderation
362
362
  * @param {Array} moderationPayload.images array Array of images to be checked for moderation
363
363
  * @param {Array} moderationPayload.videos array Array of videos to be checked for moderation
364
+ * @param {object} moderationPayload.custom object Additional custom data to attach to the moderation review queue item
364
365
  * @param {Array<CustomCheckFlag>} flags Array of CustomCheckFlag to be passed to flag the entity
365
366
  * @returns
366
367
  */
@@ -369,6 +370,8 @@ export class Moderation {
369
370
  entityID: string,
370
371
  entityCreatorID: string,
371
372
  moderationPayload: {
373
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
374
+ custom?: Record<string, any>;
372
375
  images?: string[];
373
376
  texts?: string[];
374
377
  videos?: string[];
@@ -71,4 +71,15 @@ export class FixedSizeQueueCache<K, T> {
71
71
 
72
72
  return foundItem;
73
73
  }
74
+
75
+ /**
76
+ * Clears queue entirely and disposes of each item individually.
77
+ */
78
+ clear() {
79
+ if (this.dispose) {
80
+ this.map.forEach((entry, key) => this.dispose?.(key, entry));
81
+ }
82
+ this.map.clear();
83
+ this.keys = [];
84
+ }
74
85
  }