stream-chat 9.45.5 → 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.
- package/dist/cjs/index.browser.js +66 -54
- package/dist/cjs/index.browser.js.map +3 -3
- package/dist/cjs/index.node.js +66 -54
- package/dist/cjs/index.node.js.map +3 -3
- package/dist/esm/index.mjs +66 -54
- package/dist/esm/index.mjs.map +3 -3
- package/dist/types/client.d.ts +2 -0
- package/dist/types/utils/FixedSizeQueueCache.d.ts +4 -0
- package/package.json +1 -1
- package/src/client.ts +4 -0
- package/src/utils/FixedSizeQueueCache.ts +11 -0
package/dist/cjs/index.node.js
CHANGED
|
@@ -14085,6 +14085,69 @@ var getPendingTaskChannelData = (cid) => {
|
|
|
14085
14085
|
};
|
|
14086
14086
|
};
|
|
14087
14087
|
|
|
14088
|
+
// src/utils/FixedSizeQueueCache.ts
|
|
14089
|
+
var FixedSizeQueueCache = class {
|
|
14090
|
+
constructor(size, options) {
|
|
14091
|
+
if (!size) throw new Error("Size must be greater than 0");
|
|
14092
|
+
this.keys = [];
|
|
14093
|
+
this.size = size;
|
|
14094
|
+
this.map = /* @__PURE__ */ new Map();
|
|
14095
|
+
this.dispose = options?.dispose ?? null;
|
|
14096
|
+
}
|
|
14097
|
+
/**
|
|
14098
|
+
* Adds a new or moves the existing reference to the front of the queue
|
|
14099
|
+
* @param key
|
|
14100
|
+
* @param value
|
|
14101
|
+
*/
|
|
14102
|
+
add(key, value) {
|
|
14103
|
+
const index = this.keys.indexOf(key);
|
|
14104
|
+
if (index > -1) {
|
|
14105
|
+
this.keys.splice(this.keys.indexOf(key), 1);
|
|
14106
|
+
} else if (this.keys.length >= this.size) {
|
|
14107
|
+
const itemKey = this.keys.shift();
|
|
14108
|
+
if (itemKey) {
|
|
14109
|
+
const item = this.peek(itemKey);
|
|
14110
|
+
if (item) {
|
|
14111
|
+
this.dispose?.(itemKey, item);
|
|
14112
|
+
}
|
|
14113
|
+
this.map.delete(itemKey);
|
|
14114
|
+
}
|
|
14115
|
+
}
|
|
14116
|
+
this.keys.push(key);
|
|
14117
|
+
this.map.set(key, value);
|
|
14118
|
+
}
|
|
14119
|
+
/**
|
|
14120
|
+
* Retrieves the value by key.
|
|
14121
|
+
* @param key
|
|
14122
|
+
*/
|
|
14123
|
+
peek(key) {
|
|
14124
|
+
const value = this.map.get(key);
|
|
14125
|
+
return value;
|
|
14126
|
+
}
|
|
14127
|
+
/**
|
|
14128
|
+
* Retrieves the value and moves it to the front of the queue.
|
|
14129
|
+
* @param key
|
|
14130
|
+
*/
|
|
14131
|
+
get(key) {
|
|
14132
|
+
const foundItem = this.peek(key);
|
|
14133
|
+
if (foundItem && this.keys.indexOf(key) !== this.size - 1) {
|
|
14134
|
+
this.keys.splice(this.keys.indexOf(key), 1);
|
|
14135
|
+
this.keys.push(key);
|
|
14136
|
+
}
|
|
14137
|
+
return foundItem;
|
|
14138
|
+
}
|
|
14139
|
+
/**
|
|
14140
|
+
* Clears queue entirely and disposes of each item individually.
|
|
14141
|
+
*/
|
|
14142
|
+
clear() {
|
|
14143
|
+
if (this.dispose) {
|
|
14144
|
+
this.map.forEach((entry, key) => this.dispose?.(key, entry));
|
|
14145
|
+
}
|
|
14146
|
+
this.map.clear();
|
|
14147
|
+
this.keys = [];
|
|
14148
|
+
}
|
|
14149
|
+
};
|
|
14150
|
+
|
|
14088
14151
|
// src/client.ts
|
|
14089
14152
|
function isString2(x) {
|
|
14090
14153
|
return typeof x === "string" || x instanceof String;
|
|
@@ -14291,6 +14354,7 @@ var StreamChat = class _StreamChat {
|
|
|
14291
14354
|
this.state = new ClientState({ client: this });
|
|
14292
14355
|
this.threads.resetState();
|
|
14293
14356
|
this.uploadManager.reset();
|
|
14357
|
+
this.messageComposerCache.clear();
|
|
14294
14358
|
closePromise.finally(() => {
|
|
14295
14359
|
this.tokenManager.reset();
|
|
14296
14360
|
}).catch((err) => console.error(err));
|
|
@@ -14742,6 +14806,7 @@ var StreamChat = class _StreamChat {
|
|
|
14742
14806
|
this.polls = new PollManager({ client: this });
|
|
14743
14807
|
this.reminders = new ReminderManager({ client: this });
|
|
14744
14808
|
this.messageDeliveryReporter = new MessageDeliveryReporter({ client: this });
|
|
14809
|
+
this.messageComposerCache = new FixedSizeQueueCache(64);
|
|
14745
14810
|
}
|
|
14746
14811
|
static getInstance(key, secretOrOptions, options) {
|
|
14747
14812
|
if (!_StreamChat._instance) {
|
|
@@ -16614,7 +16679,7 @@ var StreamChat = class _StreamChat {
|
|
|
16614
16679
|
if (this.userAgent) {
|
|
16615
16680
|
return this.userAgent;
|
|
16616
16681
|
}
|
|
16617
|
-
const version = "9.45.
|
|
16682
|
+
const version = "9.45.6";
|
|
16618
16683
|
const clientBundle = "node-cjs";
|
|
16619
16684
|
let userAgentString = "";
|
|
16620
16685
|
if (this.sdkIdentifier) {
|
|
@@ -19212,59 +19277,6 @@ var _LiveLocationManager = class _LiveLocationManager extends WithSubscriptions
|
|
|
19212
19277
|
};
|
|
19213
19278
|
_LiveLocationManager.symbol = Symbol(_LiveLocationManager.name);
|
|
19214
19279
|
var LiveLocationManager = _LiveLocationManager;
|
|
19215
|
-
|
|
19216
|
-
// src/utils/FixedSizeQueueCache.ts
|
|
19217
|
-
var FixedSizeQueueCache = class {
|
|
19218
|
-
constructor(size, options) {
|
|
19219
|
-
if (!size) throw new Error("Size must be greater than 0");
|
|
19220
|
-
this.keys = [];
|
|
19221
|
-
this.size = size;
|
|
19222
|
-
this.map = /* @__PURE__ */ new Map();
|
|
19223
|
-
this.dispose = options?.dispose ?? null;
|
|
19224
|
-
}
|
|
19225
|
-
/**
|
|
19226
|
-
* Adds a new or moves the existing reference to the front of the queue
|
|
19227
|
-
* @param key
|
|
19228
|
-
* @param value
|
|
19229
|
-
*/
|
|
19230
|
-
add(key, value) {
|
|
19231
|
-
const index = this.keys.indexOf(key);
|
|
19232
|
-
if (index > -1) {
|
|
19233
|
-
this.keys.splice(this.keys.indexOf(key), 1);
|
|
19234
|
-
} else if (this.keys.length >= this.size) {
|
|
19235
|
-
const itemKey = this.keys.shift();
|
|
19236
|
-
if (itemKey) {
|
|
19237
|
-
const item = this.peek(itemKey);
|
|
19238
|
-
if (item) {
|
|
19239
|
-
this.dispose?.(itemKey, item);
|
|
19240
|
-
}
|
|
19241
|
-
this.map.delete(itemKey);
|
|
19242
|
-
}
|
|
19243
|
-
}
|
|
19244
|
-
this.keys.push(key);
|
|
19245
|
-
this.map.set(key, value);
|
|
19246
|
-
}
|
|
19247
|
-
/**
|
|
19248
|
-
* Retrieves the value by key.
|
|
19249
|
-
* @param key
|
|
19250
|
-
*/
|
|
19251
|
-
peek(key) {
|
|
19252
|
-
const value = this.map.get(key);
|
|
19253
|
-
return value;
|
|
19254
|
-
}
|
|
19255
|
-
/**
|
|
19256
|
-
* Retrieves the value and moves it to the front of the queue.
|
|
19257
|
-
* @param key
|
|
19258
|
-
*/
|
|
19259
|
-
get(key) {
|
|
19260
|
-
const foundItem = this.peek(key);
|
|
19261
|
-
if (foundItem && this.keys.indexOf(key) !== this.size - 1) {
|
|
19262
|
-
this.keys.splice(this.keys.indexOf(key), 1);
|
|
19263
|
-
this.keys.push(key);
|
|
19264
|
-
}
|
|
19265
|
-
return foundItem;
|
|
19266
|
-
}
|
|
19267
|
-
};
|
|
19268
19280
|
// Annotate the CommonJS export names for ESM import in node:
|
|
19269
19281
|
0 && (module.exports = {
|
|
19270
19282
|
AbstractOfflineDB,
|