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
|
@@ -200,6 +200,7 @@ __export(index_exports, {
|
|
|
200
200
|
MinPriority: () => MinPriority,
|
|
201
201
|
Moderation: () => Moderation,
|
|
202
202
|
OfflineDBSyncManager: () => OfflineDBSyncManager,
|
|
203
|
+
OfflineError: () => OfflineError,
|
|
203
204
|
Permission: () => Permission,
|
|
204
205
|
Poll: () => Poll,
|
|
205
206
|
PollComposer: () => PollComposer,
|
|
@@ -4329,6 +4330,12 @@ function createMergeCore(options = {}) {
|
|
|
4329
4330
|
return false;
|
|
4330
4331
|
}
|
|
4331
4332
|
function createNewTarget(targetValue, srcValue) {
|
|
4333
|
+
if (targetValue === null || typeof targetValue === "undefined") {
|
|
4334
|
+
return srcValue;
|
|
4335
|
+
}
|
|
4336
|
+
if (!Array.isArray(targetValue) && typeof targetValue !== "object") {
|
|
4337
|
+
return srcValue;
|
|
4338
|
+
}
|
|
4332
4339
|
if (targetValue && typeof targetValue === "object") {
|
|
4333
4340
|
const isTargetClassInstance = isClassInstance(targetValue);
|
|
4334
4341
|
const isSourceClassInstance = isClassInstance(srcValue);
|
|
@@ -12912,7 +12919,24 @@ var StreamChat = class _StreamChat {
|
|
|
12912
12919
|
'data_template': 'data handlebars template',
|
|
12913
12920
|
'apn_template': 'apn notification handlebars template under v2'
|
|
12914
12921
|
},
|
|
12915
|
-
'webhook_url': 'https://acme.com/my/awesome/webhook/'
|
|
12922
|
+
'webhook_url': 'https://acme.com/my/awesome/webhook/',
|
|
12923
|
+
'event_hooks': [
|
|
12924
|
+
{
|
|
12925
|
+
'hook_type': 'webhook',
|
|
12926
|
+
'enabled': true,
|
|
12927
|
+
'event_types': ['message.new'],
|
|
12928
|
+
'webhook_url': 'https://acme.com/my/awesome/webhook/'
|
|
12929
|
+
},
|
|
12930
|
+
{
|
|
12931
|
+
'hook_type': 'sqs',
|
|
12932
|
+
'enabled': true,
|
|
12933
|
+
'event_types': ['message.new'],
|
|
12934
|
+
'sqs_url': 'https://sqs.us-east-1.amazonaws.com/1234567890/my-queue',
|
|
12935
|
+
'sqs_auth_type': 'key',
|
|
12936
|
+
'sqs_key': 'my-access-key',
|
|
12937
|
+
'sqs_secret': 'my-secret-key'
|
|
12938
|
+
}
|
|
12939
|
+
]
|
|
12916
12940
|
}
|
|
12917
12941
|
*/
|
|
12918
12942
|
async updateAppSettings(options) {
|
|
@@ -14256,13 +14280,15 @@ var StreamChat = class _StreamChat {
|
|
|
14256
14280
|
} else {
|
|
14257
14281
|
await this.offlineDb.softDeleteMessage({ id: messageID });
|
|
14258
14282
|
}
|
|
14259
|
-
return await this.offlineDb.queueTask(
|
|
14260
|
-
|
|
14261
|
-
|
|
14262
|
-
|
|
14263
|
-
|
|
14283
|
+
return await this.offlineDb.queueTask(
|
|
14284
|
+
{
|
|
14285
|
+
task: {
|
|
14286
|
+
messageId: messageID,
|
|
14287
|
+
payload: [messageID, hardDelete],
|
|
14288
|
+
type: "delete-message"
|
|
14289
|
+
}
|
|
14264
14290
|
}
|
|
14265
|
-
|
|
14291
|
+
);
|
|
14266
14292
|
}
|
|
14267
14293
|
} catch (error) {
|
|
14268
14294
|
this.logger("error", `offlineDb:deleteMessage`, {
|
|
@@ -14416,7 +14442,7 @@ var StreamChat = class _StreamChat {
|
|
|
14416
14442
|
if (this.userAgent) {
|
|
14417
14443
|
return this.userAgent;
|
|
14418
14444
|
}
|
|
14419
|
-
const version = "9.
|
|
14445
|
+
const version = "9.3.0";
|
|
14420
14446
|
const clientBundle = "browser-cjs";
|
|
14421
14447
|
let userAgentString = "";
|
|
14422
14448
|
if (this.sdkIdentifier) {
|
|
@@ -15592,6 +15618,26 @@ var BuiltinPermissions = {
|
|
|
15592
15618
|
UseFrozenChannel: "Send messages and reactions to frozen channels"
|
|
15593
15619
|
};
|
|
15594
15620
|
|
|
15621
|
+
// src/offline-support/types.ts
|
|
15622
|
+
var OfflineError = class extends Error {
|
|
15623
|
+
constructor(message, {
|
|
15624
|
+
type
|
|
15625
|
+
}) {
|
|
15626
|
+
super(message);
|
|
15627
|
+
this.name = "OfflineError";
|
|
15628
|
+
this.type = type;
|
|
15629
|
+
}
|
|
15630
|
+
// Vitest helper (serialized errors are too large to read)
|
|
15631
|
+
// https://github.com/vitest-dev/vitest/blob/v3.1.3/packages/utils/src/error.ts#L60-L62
|
|
15632
|
+
toJSON() {
|
|
15633
|
+
return {
|
|
15634
|
+
message: `${this.type} - ${this.message}`,
|
|
15635
|
+
stack: this.stack,
|
|
15636
|
+
name: this.name
|
|
15637
|
+
};
|
|
15638
|
+
}
|
|
15639
|
+
};
|
|
15640
|
+
|
|
15595
15641
|
// src/offline-support/offline_sync_manager.ts
|
|
15596
15642
|
var OfflineDBSyncManager = class {
|
|
15597
15643
|
constructor({
|
|
@@ -16197,20 +16243,23 @@ var AbstractOfflineDB = class {
|
|
|
16197
16243
|
* @param task - the pending task we want to execute
|
|
16198
16244
|
*/
|
|
16199
16245
|
this.queueTask = async ({ task }) => {
|
|
16200
|
-
|
|
16201
|
-
try {
|
|
16246
|
+
const attemptTaskExecution = async () => {
|
|
16202
16247
|
if (!this.client.wsConnection?.isHealthy) {
|
|
16203
|
-
|
|
16204
|
-
|
|
16248
|
+
throw new OfflineError(
|
|
16249
|
+
"Cannot execute task because the connection has been lost.",
|
|
16250
|
+
{ type: "connection:lost" }
|
|
16251
|
+
);
|
|
16205
16252
|
}
|
|
16206
|
-
|
|
16253
|
+
return await this.executeTask({ task });
|
|
16254
|
+
};
|
|
16255
|
+
try {
|
|
16256
|
+
return await attemptTaskExecution();
|
|
16207
16257
|
} catch (e) {
|
|
16208
16258
|
if (!this.shouldSkipQueueingTask(e)) {
|
|
16209
16259
|
await this.addPendingTask(task);
|
|
16210
|
-
throw e;
|
|
16211
16260
|
}
|
|
16261
|
+
throw e;
|
|
16212
16262
|
}
|
|
16213
|
-
return response;
|
|
16214
16263
|
};
|
|
16215
16264
|
/**
|
|
16216
16265
|
* A utility method that determines if a failed task should be added to the
|