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/esm/index.mjs
CHANGED
|
@@ -13899,6 +13899,69 @@ var getPendingTaskChannelData = (cid) => {
|
|
|
13899
13899
|
};
|
|
13900
13900
|
};
|
|
13901
13901
|
|
|
13902
|
+
// src/utils/FixedSizeQueueCache.ts
|
|
13903
|
+
var FixedSizeQueueCache = class {
|
|
13904
|
+
constructor(size, options) {
|
|
13905
|
+
if (!size) throw new Error("Size must be greater than 0");
|
|
13906
|
+
this.keys = [];
|
|
13907
|
+
this.size = size;
|
|
13908
|
+
this.map = /* @__PURE__ */ new Map();
|
|
13909
|
+
this.dispose = options?.dispose ?? null;
|
|
13910
|
+
}
|
|
13911
|
+
/**
|
|
13912
|
+
* Adds a new or moves the existing reference to the front of the queue
|
|
13913
|
+
* @param key
|
|
13914
|
+
* @param value
|
|
13915
|
+
*/
|
|
13916
|
+
add(key, value) {
|
|
13917
|
+
const index = this.keys.indexOf(key);
|
|
13918
|
+
if (index > -1) {
|
|
13919
|
+
this.keys.splice(this.keys.indexOf(key), 1);
|
|
13920
|
+
} else if (this.keys.length >= this.size) {
|
|
13921
|
+
const itemKey = this.keys.shift();
|
|
13922
|
+
if (itemKey) {
|
|
13923
|
+
const item = this.peek(itemKey);
|
|
13924
|
+
if (item) {
|
|
13925
|
+
this.dispose?.(itemKey, item);
|
|
13926
|
+
}
|
|
13927
|
+
this.map.delete(itemKey);
|
|
13928
|
+
}
|
|
13929
|
+
}
|
|
13930
|
+
this.keys.push(key);
|
|
13931
|
+
this.map.set(key, value);
|
|
13932
|
+
}
|
|
13933
|
+
/**
|
|
13934
|
+
* Retrieves the value by key.
|
|
13935
|
+
* @param key
|
|
13936
|
+
*/
|
|
13937
|
+
peek(key) {
|
|
13938
|
+
const value = this.map.get(key);
|
|
13939
|
+
return value;
|
|
13940
|
+
}
|
|
13941
|
+
/**
|
|
13942
|
+
* Retrieves the value and moves it to the front of the queue.
|
|
13943
|
+
* @param key
|
|
13944
|
+
*/
|
|
13945
|
+
get(key) {
|
|
13946
|
+
const foundItem = this.peek(key);
|
|
13947
|
+
if (foundItem && this.keys.indexOf(key) !== this.size - 1) {
|
|
13948
|
+
this.keys.splice(this.keys.indexOf(key), 1);
|
|
13949
|
+
this.keys.push(key);
|
|
13950
|
+
}
|
|
13951
|
+
return foundItem;
|
|
13952
|
+
}
|
|
13953
|
+
/**
|
|
13954
|
+
* Clears queue entirely and disposes of each item individually.
|
|
13955
|
+
*/
|
|
13956
|
+
clear() {
|
|
13957
|
+
if (this.dispose) {
|
|
13958
|
+
this.map.forEach((entry, key) => this.dispose?.(key, entry));
|
|
13959
|
+
}
|
|
13960
|
+
this.map.clear();
|
|
13961
|
+
this.keys = [];
|
|
13962
|
+
}
|
|
13963
|
+
};
|
|
13964
|
+
|
|
13902
13965
|
// src/client.ts
|
|
13903
13966
|
function isString2(x) {
|
|
13904
13967
|
return typeof x === "string" || x instanceof String;
|
|
@@ -14105,6 +14168,7 @@ var StreamChat = class _StreamChat {
|
|
|
14105
14168
|
this.state = new ClientState({ client: this });
|
|
14106
14169
|
this.threads.resetState();
|
|
14107
14170
|
this.uploadManager.reset();
|
|
14171
|
+
this.messageComposerCache.clear();
|
|
14108
14172
|
closePromise.finally(() => {
|
|
14109
14173
|
this.tokenManager.reset();
|
|
14110
14174
|
}).catch((err) => console.error(err));
|
|
@@ -14556,6 +14620,7 @@ var StreamChat = class _StreamChat {
|
|
|
14556
14620
|
this.polls = new PollManager({ client: this });
|
|
14557
14621
|
this.reminders = new ReminderManager({ client: this });
|
|
14558
14622
|
this.messageDeliveryReporter = new MessageDeliveryReporter({ client: this });
|
|
14623
|
+
this.messageComposerCache = new FixedSizeQueueCache(64);
|
|
14559
14624
|
}
|
|
14560
14625
|
static getInstance(key, secretOrOptions, options) {
|
|
14561
14626
|
if (!_StreamChat._instance) {
|
|
@@ -16428,7 +16493,7 @@ var StreamChat = class _StreamChat {
|
|
|
16428
16493
|
if (this.userAgent) {
|
|
16429
16494
|
return this.userAgent;
|
|
16430
16495
|
}
|
|
16431
|
-
const version = "9.45.
|
|
16496
|
+
const version = "9.45.6";
|
|
16432
16497
|
const clientBundle = "browser-esm";
|
|
16433
16498
|
let userAgentString = "";
|
|
16434
16499
|
if (this.sdkIdentifier) {
|
|
@@ -19026,59 +19091,6 @@ var _LiveLocationManager = class _LiveLocationManager extends WithSubscriptions
|
|
|
19026
19091
|
};
|
|
19027
19092
|
_LiveLocationManager.symbol = Symbol(_LiveLocationManager.name);
|
|
19028
19093
|
var LiveLocationManager = _LiveLocationManager;
|
|
19029
|
-
|
|
19030
|
-
// src/utils/FixedSizeQueueCache.ts
|
|
19031
|
-
var FixedSizeQueueCache = class {
|
|
19032
|
-
constructor(size, options) {
|
|
19033
|
-
if (!size) throw new Error("Size must be greater than 0");
|
|
19034
|
-
this.keys = [];
|
|
19035
|
-
this.size = size;
|
|
19036
|
-
this.map = /* @__PURE__ */ new Map();
|
|
19037
|
-
this.dispose = options?.dispose ?? null;
|
|
19038
|
-
}
|
|
19039
|
-
/**
|
|
19040
|
-
* Adds a new or moves the existing reference to the front of the queue
|
|
19041
|
-
* @param key
|
|
19042
|
-
* @param value
|
|
19043
|
-
*/
|
|
19044
|
-
add(key, value) {
|
|
19045
|
-
const index = this.keys.indexOf(key);
|
|
19046
|
-
if (index > -1) {
|
|
19047
|
-
this.keys.splice(this.keys.indexOf(key), 1);
|
|
19048
|
-
} else if (this.keys.length >= this.size) {
|
|
19049
|
-
const itemKey = this.keys.shift();
|
|
19050
|
-
if (itemKey) {
|
|
19051
|
-
const item = this.peek(itemKey);
|
|
19052
|
-
if (item) {
|
|
19053
|
-
this.dispose?.(itemKey, item);
|
|
19054
|
-
}
|
|
19055
|
-
this.map.delete(itemKey);
|
|
19056
|
-
}
|
|
19057
|
-
}
|
|
19058
|
-
this.keys.push(key);
|
|
19059
|
-
this.map.set(key, value);
|
|
19060
|
-
}
|
|
19061
|
-
/**
|
|
19062
|
-
* Retrieves the value by key.
|
|
19063
|
-
* @param key
|
|
19064
|
-
*/
|
|
19065
|
-
peek(key) {
|
|
19066
|
-
const value = this.map.get(key);
|
|
19067
|
-
return value;
|
|
19068
|
-
}
|
|
19069
|
-
/**
|
|
19070
|
-
* Retrieves the value and moves it to the front of the queue.
|
|
19071
|
-
* @param key
|
|
19072
|
-
*/
|
|
19073
|
-
get(key) {
|
|
19074
|
-
const foundItem = this.peek(key);
|
|
19075
|
-
if (foundItem && this.keys.indexOf(key) !== this.size - 1) {
|
|
19076
|
-
this.keys.splice(this.keys.indexOf(key), 1);
|
|
19077
|
-
this.keys.push(key);
|
|
19078
|
-
}
|
|
19079
|
-
return foundItem;
|
|
19080
|
-
}
|
|
19081
|
-
};
|
|
19082
19094
|
export {
|
|
19083
19095
|
AbstractOfflineDB,
|
|
19084
19096
|
Allow,
|