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.
@@ -12444,6 +12444,7 @@ var Moderation = class {
12444
12444
  * @param {Array} moderationPayload.texts array Array of texts to be checked for moderation
12445
12445
  * @param {Array} moderationPayload.images array Array of images to be checked for moderation
12446
12446
  * @param {Array} moderationPayload.videos array Array of videos to be checked for moderation
12447
+ * @param {object} moderationPayload.custom object Additional custom data to attach to the moderation review queue item
12447
12448
  * @param {Array<CustomCheckFlag>} flags Array of CustomCheckFlag to be passed to flag the entity
12448
12449
  * @returns
12449
12450
  */
@@ -14111,6 +14112,69 @@ var getPendingTaskChannelData = (cid) => {
14111
14112
  };
14112
14113
  };
14113
14114
 
14115
+ // src/utils/FixedSizeQueueCache.ts
14116
+ var FixedSizeQueueCache = class {
14117
+ constructor(size, options) {
14118
+ if (!size) throw new Error("Size must be greater than 0");
14119
+ this.keys = [];
14120
+ this.size = size;
14121
+ this.map = /* @__PURE__ */ new Map();
14122
+ this.dispose = options?.dispose ?? null;
14123
+ }
14124
+ /**
14125
+ * Adds a new or moves the existing reference to the front of the queue
14126
+ * @param key
14127
+ * @param value
14128
+ */
14129
+ add(key, value) {
14130
+ const index = this.keys.indexOf(key);
14131
+ if (index > -1) {
14132
+ this.keys.splice(this.keys.indexOf(key), 1);
14133
+ } else if (this.keys.length >= this.size) {
14134
+ const itemKey = this.keys.shift();
14135
+ if (itemKey) {
14136
+ const item = this.peek(itemKey);
14137
+ if (item) {
14138
+ this.dispose?.(itemKey, item);
14139
+ }
14140
+ this.map.delete(itemKey);
14141
+ }
14142
+ }
14143
+ this.keys.push(key);
14144
+ this.map.set(key, value);
14145
+ }
14146
+ /**
14147
+ * Retrieves the value by key.
14148
+ * @param key
14149
+ */
14150
+ peek(key) {
14151
+ const value = this.map.get(key);
14152
+ return value;
14153
+ }
14154
+ /**
14155
+ * Retrieves the value and moves it to the front of the queue.
14156
+ * @param key
14157
+ */
14158
+ get(key) {
14159
+ const foundItem = this.peek(key);
14160
+ if (foundItem && this.keys.indexOf(key) !== this.size - 1) {
14161
+ this.keys.splice(this.keys.indexOf(key), 1);
14162
+ this.keys.push(key);
14163
+ }
14164
+ return foundItem;
14165
+ }
14166
+ /**
14167
+ * Clears queue entirely and disposes of each item individually.
14168
+ */
14169
+ clear() {
14170
+ if (this.dispose) {
14171
+ this.map.forEach((entry, key) => this.dispose?.(key, entry));
14172
+ }
14173
+ this.map.clear();
14174
+ this.keys = [];
14175
+ }
14176
+ };
14177
+
14114
14178
  // src/client.ts
14115
14179
  function isString2(x) {
14116
14180
  return typeof x === "string" || x instanceof String;
@@ -14317,6 +14381,7 @@ var StreamChat = class _StreamChat {
14317
14381
  this.state = new ClientState({ client: this });
14318
14382
  this.threads.resetState();
14319
14383
  this.uploadManager.reset();
14384
+ this.messageComposerCache.clear();
14320
14385
  closePromise.finally(() => {
14321
14386
  this.tokenManager.reset();
14322
14387
  }).catch((err) => console.error(err));
@@ -14768,6 +14833,7 @@ var StreamChat = class _StreamChat {
14768
14833
  this.polls = new PollManager({ client: this });
14769
14834
  this.reminders = new ReminderManager({ client: this });
14770
14835
  this.messageDeliveryReporter = new MessageDeliveryReporter({ client: this });
14836
+ this.messageComposerCache = new FixedSizeQueueCache(64);
14771
14837
  }
14772
14838
  static getInstance(key, secretOrOptions, options) {
14773
14839
  if (!_StreamChat._instance) {
@@ -16640,7 +16706,7 @@ var StreamChat = class _StreamChat {
16640
16706
  if (this.userAgent) {
16641
16707
  return this.userAgent;
16642
16708
  }
16643
- const version = "9.45.4";
16709
+ const version = "9.45.6";
16644
16710
  const clientBundle = "browser-cjs";
16645
16711
  let userAgentString = "";
16646
16712
  if (this.sdkIdentifier) {
@@ -19238,57 +19304,4 @@ var _LiveLocationManager = class _LiveLocationManager extends WithSubscriptions
19238
19304
  };
19239
19305
  _LiveLocationManager.symbol = Symbol(_LiveLocationManager.name);
19240
19306
  var LiveLocationManager = _LiveLocationManager;
19241
-
19242
- // src/utils/FixedSizeQueueCache.ts
19243
- var FixedSizeQueueCache = class {
19244
- constructor(size, options) {
19245
- if (!size) throw new Error("Size must be greater than 0");
19246
- this.keys = [];
19247
- this.size = size;
19248
- this.map = /* @__PURE__ */ new Map();
19249
- this.dispose = options?.dispose ?? null;
19250
- }
19251
- /**
19252
- * Adds a new or moves the existing reference to the front of the queue
19253
- * @param key
19254
- * @param value
19255
- */
19256
- add(key, value) {
19257
- const index = this.keys.indexOf(key);
19258
- if (index > -1) {
19259
- this.keys.splice(this.keys.indexOf(key), 1);
19260
- } else if (this.keys.length >= this.size) {
19261
- const itemKey = this.keys.shift();
19262
- if (itemKey) {
19263
- const item = this.peek(itemKey);
19264
- if (item) {
19265
- this.dispose?.(itemKey, item);
19266
- }
19267
- this.map.delete(itemKey);
19268
- }
19269
- }
19270
- this.keys.push(key);
19271
- this.map.set(key, value);
19272
- }
19273
- /**
19274
- * Retrieves the value by key.
19275
- * @param key
19276
- */
19277
- peek(key) {
19278
- const value = this.map.get(key);
19279
- return value;
19280
- }
19281
- /**
19282
- * Retrieves the value and moves it to the front of the queue.
19283
- * @param key
19284
- */
19285
- get(key) {
19286
- const foundItem = this.peek(key);
19287
- if (foundItem && this.keys.indexOf(key) !== this.size - 1) {
19288
- this.keys.splice(this.keys.indexOf(key), 1);
19289
- this.keys.push(key);
19290
- }
19291
- return foundItem;
19292
- }
19293
- };
19294
19307
  //# sourceMappingURL=index.browser.js.map