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/cjs/index.node.js
CHANGED
|
@@ -12417,6 +12417,7 @@ var Moderation = class {
|
|
|
12417
12417
|
* @param {Array} moderationPayload.texts array Array of texts to be checked for moderation
|
|
12418
12418
|
* @param {Array} moderationPayload.images array Array of images to be checked for moderation
|
|
12419
12419
|
* @param {Array} moderationPayload.videos array Array of videos to be checked for moderation
|
|
12420
|
+
* @param {object} moderationPayload.custom object Additional custom data to attach to the moderation review queue item
|
|
12420
12421
|
* @param {Array<CustomCheckFlag>} flags Array of CustomCheckFlag to be passed to flag the entity
|
|
12421
12422
|
* @returns
|
|
12422
12423
|
*/
|
|
@@ -14084,6 +14085,69 @@ var getPendingTaskChannelData = (cid) => {
|
|
|
14084
14085
|
};
|
|
14085
14086
|
};
|
|
14086
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
|
+
|
|
14087
14151
|
// src/client.ts
|
|
14088
14152
|
function isString2(x) {
|
|
14089
14153
|
return typeof x === "string" || x instanceof String;
|
|
@@ -14290,6 +14354,7 @@ var StreamChat = class _StreamChat {
|
|
|
14290
14354
|
this.state = new ClientState({ client: this });
|
|
14291
14355
|
this.threads.resetState();
|
|
14292
14356
|
this.uploadManager.reset();
|
|
14357
|
+
this.messageComposerCache.clear();
|
|
14293
14358
|
closePromise.finally(() => {
|
|
14294
14359
|
this.tokenManager.reset();
|
|
14295
14360
|
}).catch((err) => console.error(err));
|
|
@@ -14741,6 +14806,7 @@ var StreamChat = class _StreamChat {
|
|
|
14741
14806
|
this.polls = new PollManager({ client: this });
|
|
14742
14807
|
this.reminders = new ReminderManager({ client: this });
|
|
14743
14808
|
this.messageDeliveryReporter = new MessageDeliveryReporter({ client: this });
|
|
14809
|
+
this.messageComposerCache = new FixedSizeQueueCache(64);
|
|
14744
14810
|
}
|
|
14745
14811
|
static getInstance(key, secretOrOptions, options) {
|
|
14746
14812
|
if (!_StreamChat._instance) {
|
|
@@ -16613,7 +16679,7 @@ var StreamChat = class _StreamChat {
|
|
|
16613
16679
|
if (this.userAgent) {
|
|
16614
16680
|
return this.userAgent;
|
|
16615
16681
|
}
|
|
16616
|
-
const version = "9.45.
|
|
16682
|
+
const version = "9.45.6";
|
|
16617
16683
|
const clientBundle = "node-cjs";
|
|
16618
16684
|
let userAgentString = "";
|
|
16619
16685
|
if (this.sdkIdentifier) {
|
|
@@ -19211,59 +19277,6 @@ var _LiveLocationManager = class _LiveLocationManager extends WithSubscriptions
|
|
|
19211
19277
|
};
|
|
19212
19278
|
_LiveLocationManager.symbol = Symbol(_LiveLocationManager.name);
|
|
19213
19279
|
var LiveLocationManager = _LiveLocationManager;
|
|
19214
|
-
|
|
19215
|
-
// src/utils/FixedSizeQueueCache.ts
|
|
19216
|
-
var FixedSizeQueueCache = class {
|
|
19217
|
-
constructor(size, options) {
|
|
19218
|
-
if (!size) throw new Error("Size must be greater than 0");
|
|
19219
|
-
this.keys = [];
|
|
19220
|
-
this.size = size;
|
|
19221
|
-
this.map = /* @__PURE__ */ new Map();
|
|
19222
|
-
this.dispose = options?.dispose ?? null;
|
|
19223
|
-
}
|
|
19224
|
-
/**
|
|
19225
|
-
* Adds a new or moves the existing reference to the front of the queue
|
|
19226
|
-
* @param key
|
|
19227
|
-
* @param value
|
|
19228
|
-
*/
|
|
19229
|
-
add(key, value) {
|
|
19230
|
-
const index = this.keys.indexOf(key);
|
|
19231
|
-
if (index > -1) {
|
|
19232
|
-
this.keys.splice(this.keys.indexOf(key), 1);
|
|
19233
|
-
} else if (this.keys.length >= this.size) {
|
|
19234
|
-
const itemKey = this.keys.shift();
|
|
19235
|
-
if (itemKey) {
|
|
19236
|
-
const item = this.peek(itemKey);
|
|
19237
|
-
if (item) {
|
|
19238
|
-
this.dispose?.(itemKey, item);
|
|
19239
|
-
}
|
|
19240
|
-
this.map.delete(itemKey);
|
|
19241
|
-
}
|
|
19242
|
-
}
|
|
19243
|
-
this.keys.push(key);
|
|
19244
|
-
this.map.set(key, value);
|
|
19245
|
-
}
|
|
19246
|
-
/**
|
|
19247
|
-
* Retrieves the value by key.
|
|
19248
|
-
* @param key
|
|
19249
|
-
*/
|
|
19250
|
-
peek(key) {
|
|
19251
|
-
const value = this.map.get(key);
|
|
19252
|
-
return value;
|
|
19253
|
-
}
|
|
19254
|
-
/**
|
|
19255
|
-
* Retrieves the value and moves it to the front of the queue.
|
|
19256
|
-
* @param key
|
|
19257
|
-
*/
|
|
19258
|
-
get(key) {
|
|
19259
|
-
const foundItem = this.peek(key);
|
|
19260
|
-
if (foundItem && this.keys.indexOf(key) !== this.size - 1) {
|
|
19261
|
-
this.keys.splice(this.keys.indexOf(key), 1);
|
|
19262
|
-
this.keys.push(key);
|
|
19263
|
-
}
|
|
19264
|
-
return foundItem;
|
|
19265
|
-
}
|
|
19266
|
-
};
|
|
19267
19280
|
// Annotate the CommonJS export names for ESM import in node:
|
|
19268
19281
|
0 && (module.exports = {
|
|
19269
19282
|
AbstractOfflineDB,
|