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/esm/index.js
CHANGED
|
@@ -4182,6 +4182,12 @@ function createMergeCore(options = {}) {
|
|
|
4182
4182
|
return false;
|
|
4183
4183
|
}
|
|
4184
4184
|
function createNewTarget(targetValue, srcValue) {
|
|
4185
|
+
if (targetValue === null || typeof targetValue === "undefined") {
|
|
4186
|
+
return srcValue;
|
|
4187
|
+
}
|
|
4188
|
+
if (!Array.isArray(targetValue) && typeof targetValue !== "object") {
|
|
4189
|
+
return srcValue;
|
|
4190
|
+
}
|
|
4185
4191
|
if (targetValue && typeof targetValue === "object") {
|
|
4186
4192
|
const isTargetClassInstance = isClassInstance(targetValue);
|
|
4187
4193
|
const isSourceClassInstance = isClassInstance(srcValue);
|
|
@@ -13894,7 +13900,24 @@ var StreamChat = class _StreamChat {
|
|
|
13894
13900
|
'data_template': 'data handlebars template',
|
|
13895
13901
|
'apn_template': 'apn notification handlebars template under v2'
|
|
13896
13902
|
},
|
|
13897
|
-
'webhook_url': 'https://acme.com/my/awesome/webhook/'
|
|
13903
|
+
'webhook_url': 'https://acme.com/my/awesome/webhook/',
|
|
13904
|
+
'event_hooks': [
|
|
13905
|
+
{
|
|
13906
|
+
'hook_type': 'webhook',
|
|
13907
|
+
'enabled': true,
|
|
13908
|
+
'event_types': ['message.new'],
|
|
13909
|
+
'webhook_url': 'https://acme.com/my/awesome/webhook/'
|
|
13910
|
+
},
|
|
13911
|
+
{
|
|
13912
|
+
'hook_type': 'sqs',
|
|
13913
|
+
'enabled': true,
|
|
13914
|
+
'event_types': ['message.new'],
|
|
13915
|
+
'sqs_url': 'https://sqs.us-east-1.amazonaws.com/1234567890/my-queue',
|
|
13916
|
+
'sqs_auth_type': 'key',
|
|
13917
|
+
'sqs_key': 'my-access-key',
|
|
13918
|
+
'sqs_secret': 'my-secret-key'
|
|
13919
|
+
}
|
|
13920
|
+
]
|
|
13898
13921
|
}
|
|
13899
13922
|
*/
|
|
13900
13923
|
async updateAppSettings(options) {
|
|
@@ -15238,13 +15261,15 @@ var StreamChat = class _StreamChat {
|
|
|
15238
15261
|
} else {
|
|
15239
15262
|
await this.offlineDb.softDeleteMessage({ id: messageID });
|
|
15240
15263
|
}
|
|
15241
|
-
return await this.offlineDb.queueTask(
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15264
|
+
return await this.offlineDb.queueTask(
|
|
15265
|
+
{
|
|
15266
|
+
task: {
|
|
15267
|
+
messageId: messageID,
|
|
15268
|
+
payload: [messageID, hardDelete],
|
|
15269
|
+
type: "delete-message"
|
|
15270
|
+
}
|
|
15246
15271
|
}
|
|
15247
|
-
|
|
15272
|
+
);
|
|
15248
15273
|
}
|
|
15249
15274
|
} catch (error) {
|
|
15250
15275
|
this.logger("error", `offlineDb:deleteMessage`, {
|
|
@@ -15398,7 +15423,7 @@ var StreamChat = class _StreamChat {
|
|
|
15398
15423
|
if (this.userAgent) {
|
|
15399
15424
|
return this.userAgent;
|
|
15400
15425
|
}
|
|
15401
|
-
const version = "9.
|
|
15426
|
+
const version = "9.3.0";
|
|
15402
15427
|
const clientBundle = "browser-esm";
|
|
15403
15428
|
let userAgentString = "";
|
|
15404
15429
|
if (this.sdkIdentifier) {
|
|
@@ -16574,6 +16599,26 @@ var BuiltinPermissions = {
|
|
|
16574
16599
|
UseFrozenChannel: "Send messages and reactions to frozen channels"
|
|
16575
16600
|
};
|
|
16576
16601
|
|
|
16602
|
+
// src/offline-support/types.ts
|
|
16603
|
+
var OfflineError = class extends Error {
|
|
16604
|
+
constructor(message, {
|
|
16605
|
+
type
|
|
16606
|
+
}) {
|
|
16607
|
+
super(message);
|
|
16608
|
+
this.name = "OfflineError";
|
|
16609
|
+
this.type = type;
|
|
16610
|
+
}
|
|
16611
|
+
// Vitest helper (serialized errors are too large to read)
|
|
16612
|
+
// https://github.com/vitest-dev/vitest/blob/v3.1.3/packages/utils/src/error.ts#L60-L62
|
|
16613
|
+
toJSON() {
|
|
16614
|
+
return {
|
|
16615
|
+
message: `${this.type} - ${this.message}`,
|
|
16616
|
+
stack: this.stack,
|
|
16617
|
+
name: this.name
|
|
16618
|
+
};
|
|
16619
|
+
}
|
|
16620
|
+
};
|
|
16621
|
+
|
|
16577
16622
|
// src/offline-support/offline_sync_manager.ts
|
|
16578
16623
|
var OfflineDBSyncManager = class {
|
|
16579
16624
|
constructor({
|
|
@@ -17179,20 +17224,23 @@ var AbstractOfflineDB = class {
|
|
|
17179
17224
|
* @param task - the pending task we want to execute
|
|
17180
17225
|
*/
|
|
17181
17226
|
this.queueTask = async ({ task }) => {
|
|
17182
|
-
|
|
17183
|
-
try {
|
|
17227
|
+
const attemptTaskExecution = async () => {
|
|
17184
17228
|
if (!this.client.wsConnection?.isHealthy) {
|
|
17185
|
-
|
|
17186
|
-
|
|
17229
|
+
throw new OfflineError(
|
|
17230
|
+
"Cannot execute task because the connection has been lost.",
|
|
17231
|
+
{ type: "connection:lost" }
|
|
17232
|
+
);
|
|
17187
17233
|
}
|
|
17188
|
-
|
|
17234
|
+
return await this.executeTask({ task });
|
|
17235
|
+
};
|
|
17236
|
+
try {
|
|
17237
|
+
return await attemptTaskExecution();
|
|
17189
17238
|
} catch (e) {
|
|
17190
17239
|
if (!this.shouldSkipQueueingTask(e)) {
|
|
17191
17240
|
await this.addPendingTask(task);
|
|
17192
|
-
throw e;
|
|
17193
17241
|
}
|
|
17242
|
+
throw e;
|
|
17194
17243
|
}
|
|
17195
|
-
return response;
|
|
17196
17244
|
};
|
|
17197
17245
|
/**
|
|
17198
17246
|
* A utility method that determines if a failed task should be added to the
|
|
@@ -17393,6 +17441,7 @@ export {
|
|
|
17393
17441
|
MinPriority,
|
|
17394
17442
|
Moderation,
|
|
17395
17443
|
OfflineDBSyncManager,
|
|
17444
|
+
OfflineError,
|
|
17396
17445
|
Permission,
|
|
17397
17446
|
Poll,
|
|
17398
17447
|
PollComposer,
|