stream-chat 9.2.0 → 9.3.0
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.cjs +64 -15
- package/dist/cjs/index.browser.cjs.map +3 -3
- package/dist/cjs/index.node.cjs +65 -15
- package/dist/cjs/index.node.cjs.map +3 -3
- package/dist/esm/index.js +64 -15
- package/dist/esm/index.js.map +3 -3
- package/dist/types/channel.d.ts +3 -5
- package/dist/types/client.d.ts +20 -3
- package/dist/types/offline-support/offline_support_api.d.ts +2 -4
- package/dist/types/offline-support/types.d.ts +14 -4
- package/dist/types/types.d.ts +24 -0
- package/package.json +1 -1
- package/src/channel.ts +5 -5
- package/src/client.ts +26 -7
- package/src/offline-support/offline_support_api.ts +12 -9
- package/src/offline-support/types.ts +28 -4
- package/src/types.ts +26 -0
- package/src/utils/mergeWith/mergeWithCore.ts +7 -1
package/dist/cjs/index.node.cjs
CHANGED
|
@@ -10711,6 +10711,7 @@ __export(index_exports, {
|
|
|
10711
10711
|
MinPriority: () => MinPriority,
|
|
10712
10712
|
Moderation: () => Moderation,
|
|
10713
10713
|
OfflineDBSyncManager: () => OfflineDBSyncManager,
|
|
10714
|
+
OfflineError: () => OfflineError,
|
|
10714
10715
|
Permission: () => Permission,
|
|
10715
10716
|
Poll: () => Poll,
|
|
10716
10717
|
PollComposer: () => PollComposer,
|
|
@@ -15672,6 +15673,12 @@ function createMergeCore(options = {}) {
|
|
|
15672
15673
|
return false;
|
|
15673
15674
|
}
|
|
15674
15675
|
function createNewTarget(targetValue, srcValue) {
|
|
15676
|
+
if (targetValue === null || typeof targetValue === "undefined") {
|
|
15677
|
+
return srcValue;
|
|
15678
|
+
}
|
|
15679
|
+
if (!Array.isArray(targetValue) && typeof targetValue !== "object") {
|
|
15680
|
+
return srcValue;
|
|
15681
|
+
}
|
|
15675
15682
|
if (targetValue && typeof targetValue === "object") {
|
|
15676
15683
|
const isTargetClassInstance = isClassInstance(targetValue);
|
|
15677
15684
|
const isSourceClassInstance = isClassInstance(srcValue);
|
|
@@ -24243,7 +24250,24 @@ var StreamChat = class _StreamChat {
|
|
|
24243
24250
|
'data_template': 'data handlebars template',
|
|
24244
24251
|
'apn_template': 'apn notification handlebars template under v2'
|
|
24245
24252
|
},
|
|
24246
|
-
'webhook_url': 'https://acme.com/my/awesome/webhook/'
|
|
24253
|
+
'webhook_url': 'https://acme.com/my/awesome/webhook/',
|
|
24254
|
+
'event_hooks': [
|
|
24255
|
+
{
|
|
24256
|
+
'hook_type': 'webhook',
|
|
24257
|
+
'enabled': true,
|
|
24258
|
+
'event_types': ['message.new'],
|
|
24259
|
+
'webhook_url': 'https://acme.com/my/awesome/webhook/'
|
|
24260
|
+
},
|
|
24261
|
+
{
|
|
24262
|
+
'hook_type': 'sqs',
|
|
24263
|
+
'enabled': true,
|
|
24264
|
+
'event_types': ['message.new'],
|
|
24265
|
+
'sqs_url': 'https://sqs.us-east-1.amazonaws.com/1234567890/my-queue',
|
|
24266
|
+
'sqs_auth_type': 'key',
|
|
24267
|
+
'sqs_key': 'my-access-key',
|
|
24268
|
+
'sqs_secret': 'my-secret-key'
|
|
24269
|
+
}
|
|
24270
|
+
]
|
|
24247
24271
|
}
|
|
24248
24272
|
*/
|
|
24249
24273
|
async updateAppSettings(options) {
|
|
@@ -25587,13 +25611,15 @@ var StreamChat = class _StreamChat {
|
|
|
25587
25611
|
} else {
|
|
25588
25612
|
await this.offlineDb.softDeleteMessage({ id: messageID });
|
|
25589
25613
|
}
|
|
25590
|
-
return await this.offlineDb.queueTask(
|
|
25591
|
-
|
|
25592
|
-
|
|
25593
|
-
|
|
25594
|
-
|
|
25614
|
+
return await this.offlineDb.queueTask(
|
|
25615
|
+
{
|
|
25616
|
+
task: {
|
|
25617
|
+
messageId: messageID,
|
|
25618
|
+
payload: [messageID, hardDelete],
|
|
25619
|
+
type: "delete-message"
|
|
25620
|
+
}
|
|
25595
25621
|
}
|
|
25596
|
-
|
|
25622
|
+
);
|
|
25597
25623
|
}
|
|
25598
25624
|
} catch (error) {
|
|
25599
25625
|
this.logger("error", `offlineDb:deleteMessage`, {
|
|
@@ -25747,7 +25773,7 @@ var StreamChat = class _StreamChat {
|
|
|
25747
25773
|
if (this.userAgent) {
|
|
25748
25774
|
return this.userAgent;
|
|
25749
25775
|
}
|
|
25750
|
-
const version = "9.
|
|
25776
|
+
const version = "9.3.0";
|
|
25751
25777
|
const clientBundle = "node-cjs";
|
|
25752
25778
|
let userAgentString = "";
|
|
25753
25779
|
if (this.sdkIdentifier) {
|
|
@@ -26923,6 +26949,26 @@ var BuiltinPermissions = {
|
|
|
26923
26949
|
UseFrozenChannel: "Send messages and reactions to frozen channels"
|
|
26924
26950
|
};
|
|
26925
26951
|
|
|
26952
|
+
// src/offline-support/types.ts
|
|
26953
|
+
var OfflineError = class extends Error {
|
|
26954
|
+
constructor(message, {
|
|
26955
|
+
type
|
|
26956
|
+
}) {
|
|
26957
|
+
super(message);
|
|
26958
|
+
this.name = "OfflineError";
|
|
26959
|
+
this.type = type;
|
|
26960
|
+
}
|
|
26961
|
+
// Vitest helper (serialized errors are too large to read)
|
|
26962
|
+
// https://github.com/vitest-dev/vitest/blob/v3.1.3/packages/utils/src/error.ts#L60-L62
|
|
26963
|
+
toJSON() {
|
|
26964
|
+
return {
|
|
26965
|
+
message: `${this.type} - ${this.message}`,
|
|
26966
|
+
stack: this.stack,
|
|
26967
|
+
name: this.name
|
|
26968
|
+
};
|
|
26969
|
+
}
|
|
26970
|
+
};
|
|
26971
|
+
|
|
26926
26972
|
// src/offline-support/offline_sync_manager.ts
|
|
26927
26973
|
var OfflineDBSyncManager = class {
|
|
26928
26974
|
constructor({
|
|
@@ -27528,20 +27574,23 @@ var AbstractOfflineDB = class {
|
|
|
27528
27574
|
* @param task - the pending task we want to execute
|
|
27529
27575
|
*/
|
|
27530
27576
|
this.queueTask = async ({ task }) => {
|
|
27531
|
-
|
|
27532
|
-
try {
|
|
27577
|
+
const attemptTaskExecution = async () => {
|
|
27533
27578
|
if (!this.client.wsConnection?.isHealthy) {
|
|
27534
|
-
|
|
27535
|
-
|
|
27579
|
+
throw new OfflineError(
|
|
27580
|
+
"Cannot execute task because the connection has been lost.",
|
|
27581
|
+
{ type: "connection:lost" }
|
|
27582
|
+
);
|
|
27536
27583
|
}
|
|
27537
|
-
|
|
27584
|
+
return await this.executeTask({ task });
|
|
27585
|
+
};
|
|
27586
|
+
try {
|
|
27587
|
+
return await attemptTaskExecution();
|
|
27538
27588
|
} catch (e) {
|
|
27539
27589
|
if (!this.shouldSkipQueueingTask(e)) {
|
|
27540
27590
|
await this.addPendingTask(task);
|
|
27541
|
-
throw e;
|
|
27542
27591
|
}
|
|
27592
|
+
throw e;
|
|
27543
27593
|
}
|
|
27544
|
-
return response;
|
|
27545
27594
|
};
|
|
27546
27595
|
/**
|
|
27547
27596
|
* A utility method that determines if a failed task should be added to the
|
|
@@ -27743,6 +27792,7 @@ var FixedSizeQueueCache = class {
|
|
|
27743
27792
|
MinPriority,
|
|
27744
27793
|
Moderation,
|
|
27745
27794
|
OfflineDBSyncManager,
|
|
27795
|
+
OfflineError,
|
|
27746
27796
|
Permission,
|
|
27747
27797
|
Poll,
|
|
27748
27798
|
PollComposer,
|