stream-chat 9.27.2 → 9.28.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.js +206 -1
- package/dist/cjs/index.browser.js.map +3 -3
- package/dist/cjs/index.node.js +207 -1
- package/dist/cjs/index.node.js.map +3 -3
- package/dist/esm/index.mjs +206 -1
- package/dist/esm/index.mjs.map +3 -3
- package/dist/types/channel_batch_updater.d.ts +109 -0
- package/dist/types/client.d.ts +17 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types.d.ts +25 -0
- package/package.json +1 -1
- package/src/channel_batch_updater.ts +247 -0
- package/src/client.ts +25 -0
- package/src/index.ts +1 -0
- package/src/types.ts +49 -0
|
@@ -66,6 +66,7 @@ __export(index_exports, {
|
|
|
66
66
|
BuiltinRoles: () => BuiltinRoles,
|
|
67
67
|
Campaign: () => Campaign,
|
|
68
68
|
Channel: () => Channel,
|
|
69
|
+
ChannelBatchUpdater: () => ChannelBatchUpdater,
|
|
69
70
|
ChannelManager: () => ChannelManager,
|
|
70
71
|
ChannelSearchSource: () => ChannelSearchSource,
|
|
71
72
|
ChannelState: () => ChannelState,
|
|
@@ -335,6 +336,190 @@ var Campaign = class {
|
|
|
335
336
|
}
|
|
336
337
|
};
|
|
337
338
|
|
|
339
|
+
// src/channel_batch_updater.ts
|
|
340
|
+
var ChannelBatchUpdater = class {
|
|
341
|
+
constructor(client) {
|
|
342
|
+
this.client = client;
|
|
343
|
+
}
|
|
344
|
+
// Member operations
|
|
345
|
+
/**
|
|
346
|
+
* addMembers - Add members to channels matching the filter
|
|
347
|
+
*
|
|
348
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
349
|
+
* @param {string[] | NewMemberPayload[]} members Members to add
|
|
350
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
351
|
+
*/
|
|
352
|
+
async addMembers(filter, members) {
|
|
353
|
+
return await this.client.updateChannelsBatch({
|
|
354
|
+
operation: "addMembers",
|
|
355
|
+
filter,
|
|
356
|
+
members
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* removeMembers - Remove members from channels matching the filter
|
|
361
|
+
*
|
|
362
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
363
|
+
* @param {string[]} members Member IDs to remove
|
|
364
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
365
|
+
*/
|
|
366
|
+
async removeMembers(filter, members) {
|
|
367
|
+
return await this.client.updateChannelsBatch({
|
|
368
|
+
operation: "removeMembers",
|
|
369
|
+
filter,
|
|
370
|
+
members
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* inviteMembers - Invite members to channels matching the filter
|
|
375
|
+
*
|
|
376
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
377
|
+
* @param {string[] | NewMemberPayload[]} members Members to invite
|
|
378
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
379
|
+
*/
|
|
380
|
+
async inviteMembers(filter, members) {
|
|
381
|
+
return await this.client.updateChannelsBatch({
|
|
382
|
+
operation: "inviteMembers",
|
|
383
|
+
filter,
|
|
384
|
+
members
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* addModerators - Add moderators to channels matching the filter
|
|
389
|
+
*
|
|
390
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
391
|
+
* @param {string[]} members Member IDs to promote to moderator
|
|
392
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
393
|
+
*/
|
|
394
|
+
async addModerators(filter, members) {
|
|
395
|
+
return await this.client.updateChannelsBatch({
|
|
396
|
+
operation: "addModerators",
|
|
397
|
+
filter,
|
|
398
|
+
members
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* demoteModerators - Remove moderator role from members in channels matching the filter
|
|
403
|
+
*
|
|
404
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
405
|
+
* @param {string[]} members Member IDs to demote
|
|
406
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
407
|
+
*/
|
|
408
|
+
async demoteModerators(filter, members) {
|
|
409
|
+
return await this.client.updateChannelsBatch({
|
|
410
|
+
operation: "demoteModerators",
|
|
411
|
+
filter,
|
|
412
|
+
members
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* assignRoles - Assign roles to members in channels matching the filter
|
|
417
|
+
*
|
|
418
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
419
|
+
* @param {NewMemberPayload[]} members Members with role assignments
|
|
420
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
421
|
+
*/
|
|
422
|
+
async assignRoles(filter, members) {
|
|
423
|
+
return await this.client.updateChannelsBatch({
|
|
424
|
+
operation: "assignRoles",
|
|
425
|
+
filter,
|
|
426
|
+
members
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
// Visibility operations
|
|
430
|
+
/**
|
|
431
|
+
* hide - Hide channels matching the filter
|
|
432
|
+
*
|
|
433
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
434
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
435
|
+
*/
|
|
436
|
+
async hide(filter) {
|
|
437
|
+
return await this.client.updateChannelsBatch({
|
|
438
|
+
operation: "hide",
|
|
439
|
+
filter
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* show - Show channels matching the filter
|
|
444
|
+
*
|
|
445
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
446
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
447
|
+
*/
|
|
448
|
+
async show(filter) {
|
|
449
|
+
return await this.client.updateChannelsBatch({
|
|
450
|
+
operation: "show",
|
|
451
|
+
filter
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* archive - Archive channels matching the filter
|
|
456
|
+
*
|
|
457
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
458
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
459
|
+
*/
|
|
460
|
+
async archive(filter) {
|
|
461
|
+
return await this.client.updateChannelsBatch({
|
|
462
|
+
operation: "archive",
|
|
463
|
+
filter
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* unarchive - Unarchive channels matching the filter
|
|
468
|
+
*
|
|
469
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
470
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
471
|
+
*/
|
|
472
|
+
async unarchive(filter) {
|
|
473
|
+
return await this.client.updateChannelsBatch({
|
|
474
|
+
operation: "unarchive",
|
|
475
|
+
filter
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
// Data operations
|
|
479
|
+
/**
|
|
480
|
+
* updateData - Update data on channels matching the filter
|
|
481
|
+
*
|
|
482
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
483
|
+
* @param {BatchChannelDataUpdate} data Data to update
|
|
484
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
485
|
+
*/
|
|
486
|
+
async updateData(filter, data) {
|
|
487
|
+
return await this.client.updateChannelsBatch({
|
|
488
|
+
operation: "updateData",
|
|
489
|
+
filter,
|
|
490
|
+
data
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* addFilterTags - Add filter tags to channels matching the filter
|
|
495
|
+
*
|
|
496
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
497
|
+
* @param {string[]} tags Tags to add
|
|
498
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
499
|
+
*/
|
|
500
|
+
async addFilterTags(filter, tags) {
|
|
501
|
+
return await this.client.updateChannelsBatch({
|
|
502
|
+
operation: "addFilterTags",
|
|
503
|
+
filter,
|
|
504
|
+
filter_tags_update: tags
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* removeFilterTags - Remove filter tags from channels matching the filter
|
|
509
|
+
*
|
|
510
|
+
* @param {UpdateChannelsBatchFilters} filter Filter to select channels
|
|
511
|
+
* @param {string[]} tags Tags to remove
|
|
512
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
513
|
+
*/
|
|
514
|
+
async removeFilterTags(filter, tags) {
|
|
515
|
+
return await this.client.updateChannelsBatch({
|
|
516
|
+
operation: "removeFilterTags",
|
|
517
|
+
filter,
|
|
518
|
+
filter_tags_update: tags
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
|
|
338
523
|
// src/client.ts
|
|
339
524
|
var import_axios3 = __toESM(require("axios"));
|
|
340
525
|
var import_https = __toESM(require_https());
|
|
@@ -14740,7 +14925,7 @@ var StreamChat = class _StreamChat {
|
|
|
14740
14925
|
if (this.userAgent) {
|
|
14741
14926
|
return this.userAgent;
|
|
14742
14927
|
}
|
|
14743
|
-
const version = "9.
|
|
14928
|
+
const version = "9.28.0";
|
|
14744
14929
|
const clientBundle = "browser-cjs";
|
|
14745
14930
|
let userAgentString = "";
|
|
14746
14931
|
if (this.sdkIdentifier) {
|
|
@@ -15039,6 +15224,14 @@ var StreamChat = class _StreamChat {
|
|
|
15039
15224
|
}
|
|
15040
15225
|
return new Campaign(this, idOrData, data);
|
|
15041
15226
|
}
|
|
15227
|
+
/**
|
|
15228
|
+
* channelBatchUpdater - Returns a ChannelBatchUpdater instance for batch channel operations
|
|
15229
|
+
*
|
|
15230
|
+
* @return {ChannelBatchUpdater} A ChannelBatchUpdater instance
|
|
15231
|
+
*/
|
|
15232
|
+
channelBatchUpdater() {
|
|
15233
|
+
return new ChannelBatchUpdater(this);
|
|
15234
|
+
}
|
|
15042
15235
|
segment(type, idOrData, data) {
|
|
15043
15236
|
if (typeof idOrData === "string") {
|
|
15044
15237
|
return new Segment(this, type, idOrData, data);
|
|
@@ -15901,6 +16094,18 @@ var StreamChat = class _StreamChat {
|
|
|
15901
16094
|
syncDeliveredCandidates(collections) {
|
|
15902
16095
|
this.messageDeliveryReporter.syncDeliveredCandidates(collections);
|
|
15903
16096
|
}
|
|
16097
|
+
/**
|
|
16098
|
+
* Update Channels Batch
|
|
16099
|
+
*
|
|
16100
|
+
* @param {UpdateChannelsBatchOptions} payload for updating channels in batch
|
|
16101
|
+
* @return {Promise<APIResponse & UpdateChannelsBatchResponse>} The server response
|
|
16102
|
+
*/
|
|
16103
|
+
async updateChannelsBatch(payload) {
|
|
16104
|
+
return await this.put(
|
|
16105
|
+
this.baseURL + `/channels/batch`,
|
|
16106
|
+
payload
|
|
16107
|
+
);
|
|
16108
|
+
}
|
|
15904
16109
|
};
|
|
15905
16110
|
|
|
15906
16111
|
// src/events.ts
|