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.
- package/dist/cjs/index.browser.js +67 -54
- package/dist/cjs/index.browser.js.map +3 -3
- package/dist/cjs/index.node.js +67 -54
- package/dist/cjs/index.node.js.map +3 -3
- package/dist/esm/index.mjs +67 -54
- package/dist/esm/index.mjs.map +3 -3
- package/dist/types/client.d.ts +2 -0
- package/dist/types/moderation.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/moderation.ts +3 -0
- package/src/utils/FixedSizeQueueCache.ts +11 -0
package/dist/esm/index.mjs
CHANGED
|
@@ -12231,6 +12231,7 @@ var Moderation = class {
|
|
|
12231
12231
|
* @param {Array} moderationPayload.texts array Array of texts to be checked for moderation
|
|
12232
12232
|
* @param {Array} moderationPayload.images array Array of images to be checked for moderation
|
|
12233
12233
|
* @param {Array} moderationPayload.videos array Array of videos to be checked for moderation
|
|
12234
|
+
* @param {object} moderationPayload.custom object Additional custom data to attach to the moderation review queue item
|
|
12234
12235
|
* @param {Array<CustomCheckFlag>} flags Array of CustomCheckFlag to be passed to flag the entity
|
|
12235
12236
|
* @returns
|
|
12236
12237
|
*/
|
|
@@ -13898,6 +13899,69 @@ var getPendingTaskChannelData = (cid) => {
|
|
|
13898
13899
|
};
|
|
13899
13900
|
};
|
|
13900
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
|
+
|
|
13901
13965
|
// src/client.ts
|
|
13902
13966
|
function isString2(x) {
|
|
13903
13967
|
return typeof x === "string" || x instanceof String;
|
|
@@ -14104,6 +14168,7 @@ var StreamChat = class _StreamChat {
|
|
|
14104
14168
|
this.state = new ClientState({ client: this });
|
|
14105
14169
|
this.threads.resetState();
|
|
14106
14170
|
this.uploadManager.reset();
|
|
14171
|
+
this.messageComposerCache.clear();
|
|
14107
14172
|
closePromise.finally(() => {
|
|
14108
14173
|
this.tokenManager.reset();
|
|
14109
14174
|
}).catch((err) => console.error(err));
|
|
@@ -14555,6 +14620,7 @@ var StreamChat = class _StreamChat {
|
|
|
14555
14620
|
this.polls = new PollManager({ client: this });
|
|
14556
14621
|
this.reminders = new ReminderManager({ client: this });
|
|
14557
14622
|
this.messageDeliveryReporter = new MessageDeliveryReporter({ client: this });
|
|
14623
|
+
this.messageComposerCache = new FixedSizeQueueCache(64);
|
|
14558
14624
|
}
|
|
14559
14625
|
static getInstance(key, secretOrOptions, options) {
|
|
14560
14626
|
if (!_StreamChat._instance) {
|
|
@@ -16427,7 +16493,7 @@ var StreamChat = class _StreamChat {
|
|
|
16427
16493
|
if (this.userAgent) {
|
|
16428
16494
|
return this.userAgent;
|
|
16429
16495
|
}
|
|
16430
|
-
const version = "9.45.
|
|
16496
|
+
const version = "9.45.6";
|
|
16431
16497
|
const clientBundle = "browser-esm";
|
|
16432
16498
|
let userAgentString = "";
|
|
16433
16499
|
if (this.sdkIdentifier) {
|
|
@@ -19025,59 +19091,6 @@ var _LiveLocationManager = class _LiveLocationManager extends WithSubscriptions
|
|
|
19025
19091
|
};
|
|
19026
19092
|
_LiveLocationManager.symbol = Symbol(_LiveLocationManager.name);
|
|
19027
19093
|
var LiveLocationManager = _LiveLocationManager;
|
|
19028
|
-
|
|
19029
|
-
// src/utils/FixedSizeQueueCache.ts
|
|
19030
|
-
var FixedSizeQueueCache = class {
|
|
19031
|
-
constructor(size, options) {
|
|
19032
|
-
if (!size) throw new Error("Size must be greater than 0");
|
|
19033
|
-
this.keys = [];
|
|
19034
|
-
this.size = size;
|
|
19035
|
-
this.map = /* @__PURE__ */ new Map();
|
|
19036
|
-
this.dispose = options?.dispose ?? null;
|
|
19037
|
-
}
|
|
19038
|
-
/**
|
|
19039
|
-
* Adds a new or moves the existing reference to the front of the queue
|
|
19040
|
-
* @param key
|
|
19041
|
-
* @param value
|
|
19042
|
-
*/
|
|
19043
|
-
add(key, value) {
|
|
19044
|
-
const index = this.keys.indexOf(key);
|
|
19045
|
-
if (index > -1) {
|
|
19046
|
-
this.keys.splice(this.keys.indexOf(key), 1);
|
|
19047
|
-
} else if (this.keys.length >= this.size) {
|
|
19048
|
-
const itemKey = this.keys.shift();
|
|
19049
|
-
if (itemKey) {
|
|
19050
|
-
const item = this.peek(itemKey);
|
|
19051
|
-
if (item) {
|
|
19052
|
-
this.dispose?.(itemKey, item);
|
|
19053
|
-
}
|
|
19054
|
-
this.map.delete(itemKey);
|
|
19055
|
-
}
|
|
19056
|
-
}
|
|
19057
|
-
this.keys.push(key);
|
|
19058
|
-
this.map.set(key, value);
|
|
19059
|
-
}
|
|
19060
|
-
/**
|
|
19061
|
-
* Retrieves the value by key.
|
|
19062
|
-
* @param key
|
|
19063
|
-
*/
|
|
19064
|
-
peek(key) {
|
|
19065
|
-
const value = this.map.get(key);
|
|
19066
|
-
return value;
|
|
19067
|
-
}
|
|
19068
|
-
/**
|
|
19069
|
-
* Retrieves the value and moves it to the front of the queue.
|
|
19070
|
-
* @param key
|
|
19071
|
-
*/
|
|
19072
|
-
get(key) {
|
|
19073
|
-
const foundItem = this.peek(key);
|
|
19074
|
-
if (foundItem && this.keys.indexOf(key) !== this.size - 1) {
|
|
19075
|
-
this.keys.splice(this.keys.indexOf(key), 1);
|
|
19076
|
-
this.keys.push(key);
|
|
19077
|
-
}
|
|
19078
|
-
return foundItem;
|
|
19079
|
-
}
|
|
19080
|
-
};
|
|
19081
19094
|
export {
|
|
19082
19095
|
AbstractOfflineDB,
|
|
19083
19096
|
Allow,
|