r-agency-mesh 1.166.0 → 1.167.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "r-agency-mesh",
3
- "version": "1.166.0",
3
+ "version": "1.167.0",
4
4
  "scripts": {
5
5
  "build-dev": "npm run compile && npm run gen",
6
6
  "build-prod": "npm run compile && npm run gen-prod",
@@ -2755,7 +2755,6 @@ interface IBroadcastClientAddMeta {
2755
2755
  * Interface representing a broadcast system to manage and interact with clients.
2756
2756
  */
2757
2757
  interface IBroadcast {
2758
- kickClient(id: string, initiator?: IWsClient): boolean;
2759
2758
  getStorage<Data = any>(): IBroadcastStorage<Data>;
2760
2759
  getOwnerId(): string | undefined;
2761
2760
  setOwnerId(id: string): void;
package/release/index.js CHANGED
@@ -25278,37 +25278,6 @@ var init_broadcast = __esm({
25278
25278
  getStorage() {
25279
25279
  return this.storage;
25280
25280
  }
25281
- /**
25282
- * Kicks a client from the system based on the provided ID and notifies both the initiator and the target client.
25283
- *
25284
- * @param {string} id - The unique identifier of the client to be kicked.
25285
- * @param {IWsClient} initiator - The WebSocket client initiating the kick action.
25286
- * @return {void} No return value.
25287
- */
25288
- kickClient(id, initiator) {
25289
- const client = this.clients.get(id);
25290
- if (!client) {
25291
- if (initiator) {
25292
- initiator.payload().notify({
25293
- type: "error",
25294
- title: "Broadcast",
25295
- message: "Client not found!",
25296
- translateKey: "broadcast_client_not_found",
25297
- duration: 5e3
25298
- }).send();
25299
- }
25300
- return false;
25301
- }
25302
- client.client.payload().notify({
25303
- type: "error",
25304
- title: "Broadcast",
25305
- message: "You were kicked from the broadcast!",
25306
- translateKey: "broadcast_client_kicked",
25307
- duration: 5e3
25308
- }).send();
25309
- this.remClient(client.client.deviceId());
25310
- return true;
25311
- }
25312
25281
  /**
25313
25282
  * Retrieves the owner ID associated with the current instance.
25314
25283
  *
@@ -25900,7 +25869,13 @@ var init_broadcast_ctrl = __esm({
25900
25869
  };
25901
25870
  }}
25902
25871
  /**
25903
- * Represents an asynchronous function that handles a kick action.
25872
+ * Handles the "client-kick" action for removing a client from a WebSocket broadcast group.
25873
+ * This function processes incoming requests to remove a client by their unique identifier
25874
+ * from a specified broadcast group.
25875
+ * Failure scenarios include:
25876
+ * - Missing name or clientId in the incoming request.
25877
+ * - The specified broadcast group does not exist.
25878
+ * - The client does not exist in the specified broadcast group.
25904
25879
  */
25905
25880
  __init73() {this["client-kick"] = async (args) => {
25906
25881
  const data = args.data();
@@ -25915,8 +25890,23 @@ var init_broadcast_ctrl = __esm({
25915
25890
  success: false
25916
25891
  };
25917
25892
  }
25893
+ const client = broadcast.getClient(data.clientId);
25894
+ if (!client) {
25895
+ return {
25896
+ success: false
25897
+ };
25898
+ }
25899
+ if (client.client.isConnected()) {
25900
+ client.client.payload().notify({
25901
+ type: "warning",
25902
+ title: "Broadcast",
25903
+ message: "You was kicked from the broadcast!",
25904
+ translateKey: "broadcast_client_kicked"
25905
+ }).send();
25906
+ }
25907
+ broadcast.remClient(client.client.clientId());
25918
25908
  return {
25919
- success: broadcast.kickClient(data.clientId, args.client)
25909
+ success: true
25920
25910
  };
25921
25911
  }}
25922
25912
  }, _class23);