@aslaluroba/help-center-react 3.2.4 → 3.2.5

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/services.js CHANGED
@@ -4355,7 +4355,7 @@ var ably = {exports: {}};
4355
4355
  });
4356
4356
  return _withTimeoutAsync2.apply(this, arguments);
4357
4357
  }
4358
- var version = "2.15.0";
4358
+ var version = "2.13.0";
4359
4359
 
4360
4360
  // src/common/lib/util/defaults.ts
4361
4361
  var agent = "ably-js/" + version;
@@ -4603,10 +4603,10 @@ var ably = {exports: {}};
4603
4603
  };
4604
4604
  function defaultGetHeaders(options) {
4605
4605
  var {
4606
- format,
4606
+ format = defaultHeadersOptions.format,
4607
4607
  protocolVersion = defaultHeadersOptions.protocolVersion
4608
4608
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4609
- var accept = contentTypes[format != null ? format : options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */];
4609
+ var accept = contentTypes[format];
4610
4610
  return {
4611
4611
  accept,
4612
4612
  "X-Ably-Version": protocolVersion.toString(),
@@ -4615,11 +4615,11 @@ var ably = {exports: {}};
4615
4615
  }
4616
4616
  function defaultPostHeaders(options) {
4617
4617
  var {
4618
- format,
4618
+ format = defaultHeadersOptions.format,
4619
4619
  protocolVersion = defaultHeadersOptions.protocolVersion
4620
4620
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4621
- var accept = contentTypes[format != null ? format : options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */];
4622
- var contentType = accept;
4621
+ var contentType;
4622
+ var accept = contentType = contentTypes[format];
4623
4623
  return {
4624
4624
  accept,
4625
4625
  "content-type": contentType,
@@ -4943,9 +4943,7 @@ var ably = {exports: {}};
4943
4943
  tokenUri = function tokenUri(host) {
4944
4944
  return client.baseUri(host) + path;
4945
4945
  };
4946
- var requestHeaders = defaults_default.defaultPostHeaders(_this3.client.options, {
4947
- format: "json" /* json */
4948
- });
4946
+ var requestHeaders = defaults_default.defaultPostHeaders(_this3.client.options);
4949
4947
  if (resolvedAuthOptions.requestHeaders) _mixin(requestHeaders, resolvedAuthOptions.requestHeaders);
4950
4948
  logger_default.logAction(_this3.logger, logger_default.LOG_MICRO, "Auth.requestToken().requestToken", "Sending POST to " + path + "; Token params: " + JSON.stringify(signedTokenParams));
4951
4949
  _whenPromiseSettles(_this3.client.http.do(HttpMethods_default.Post, tokenUri, requestHeaders, JSON.stringify(signedTokenParams), null), (err, result) => err ? tokenCb(err) : tokenCb(result.error, result.body, result.unpacked));
@@ -6637,7 +6635,9 @@ var ably = {exports: {}};
6637
6635
  return _asyncToGenerator(function* () {
6638
6636
  var client = _this26.client;
6639
6637
  var format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6640
- headers = defaults_default.defaultPostHeaders(client.options),
6638
+ headers = defaults_default.defaultPostHeaders(client.options, {
6639
+ format
6640
+ }),
6641
6641
  params = {};
6642
6642
  var body = _mixin({
6643
6643
  recipient
@@ -6661,7 +6661,9 @@ var ably = {exports: {}};
6661
6661
  var client = _this27.client;
6662
6662
  var body = devicedetails_default.fromValues(device);
6663
6663
  var format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6664
- headers = defaults_default.defaultPostHeaders(client.options),
6664
+ headers = defaults_default.defaultPostHeaders(client.options, {
6665
+ format
6666
+ }),
6665
6667
  params = {};
6666
6668
  _mixin(headers, client.options.headers);
6667
6669
  if (client.options.pushFullWait) _mixin(params, {
@@ -6677,7 +6679,9 @@ var ably = {exports: {}};
6677
6679
  return _asyncToGenerator(function* () {
6678
6680
  var client = _this28.client,
6679
6681
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6680
- headers = defaults_default.defaultGetHeaders(client.options),
6682
+ headers = defaults_default.defaultGetHeaders(client.options, {
6683
+ format
6684
+ }),
6681
6685
  deviceId = deviceIdOrDetails.id || deviceIdOrDetails;
6682
6686
  if (typeof deviceId !== "string" || !deviceId.length) {
6683
6687
  throw new _ErrorInfo2("First argument to DeviceRegistrations#get must be a deviceId string or DeviceDetails", 4e4, 400);
@@ -6693,7 +6697,9 @@ var ably = {exports: {}};
6693
6697
  var client = _this29.client,
6694
6698
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6695
6699
  envelope = _this29.client.http.supportsLinkHeaders ? void 0 : format,
6696
- headers = defaults_default.defaultGetHeaders(client.options);
6700
+ headers = defaults_default.defaultGetHeaders(client.options, {
6701
+ format
6702
+ });
6697
6703
  _mixin(headers, client.options.headers);
6698
6704
  return new paginatedresource_default(client, "/push/deviceRegistrations", headers, envelope, /*#__PURE__*/function () {
6699
6705
  var _ref3 = _asyncToGenerator(function* (body, headers2, unpacked) {
@@ -6709,7 +6715,10 @@ var ably = {exports: {}};
6709
6715
  var _this30 = this;
6710
6716
  return _asyncToGenerator(function* () {
6711
6717
  var client = _this30.client,
6712
- headers = defaults_default.defaultGetHeaders(client.options),
6718
+ format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6719
+ headers = defaults_default.defaultGetHeaders(client.options, {
6720
+ format
6721
+ }),
6713
6722
  params = {},
6714
6723
  deviceId = deviceIdOrDetails.id || deviceIdOrDetails;
6715
6724
  if (typeof deviceId !== "string" || !deviceId.length) {
@@ -6750,7 +6759,9 @@ var ably = {exports: {}};
6750
6759
  var client = _this32.client;
6751
6760
  var body = pushchannelsubscription_default.fromValues(subscription);
6752
6761
  var format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6753
- headers = defaults_default.defaultPostHeaders(client.options),
6762
+ headers = defaults_default.defaultPostHeaders(client.options, {
6763
+ format
6764
+ }),
6754
6765
  params = {};
6755
6766
  _mixin(headers, client.options.headers);
6756
6767
  if (client.options.pushFullWait) _mixin(params, {
@@ -6767,7 +6778,9 @@ var ably = {exports: {}};
6767
6778
  var client = _this33.client,
6768
6779
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6769
6780
  envelope = _this33.client.http.supportsLinkHeaders ? void 0 : format,
6770
- headers = defaults_default.defaultGetHeaders(client.options);
6781
+ headers = defaults_default.defaultGetHeaders(client.options, {
6782
+ format
6783
+ });
6771
6784
  _mixin(headers, client.options.headers);
6772
6785
  return new paginatedresource_default(client, "/push/channelSubscriptions", headers, envelope, /*#__PURE__*/function () {
6773
6786
  var _ref4 = _asyncToGenerator(function* (body, headers2, unpacked) {
@@ -6800,7 +6813,9 @@ var ably = {exports: {}};
6800
6813
  var client = _this35.client,
6801
6814
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6802
6815
  envelope = _this35.client.http.supportsLinkHeaders ? void 0 : format,
6803
- headers = defaults_default.defaultGetHeaders(client.options);
6816
+ headers = defaults_default.defaultGetHeaders(client.options, {
6817
+ format
6818
+ });
6804
6819
  _mixin(headers, client.options.headers);
6805
6820
  if (client.options.pushFullWait) _mixin(params, {
6806
6821
  fullWait: "true"
@@ -6963,7 +6978,9 @@ var ably = {exports: {}};
6963
6978
  var client = _this38.channel.client,
6964
6979
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6965
6980
  envelope = _this38.channel.client.http.supportsLinkHeaders ? void 0 : format,
6966
- headers = defaults_default.defaultGetHeaders(client.options);
6981
+ headers = defaults_default.defaultGetHeaders(client.options, {
6982
+ format
6983
+ });
6967
6984
  _mixin(headers, client.options.headers);
6968
6985
  return new paginatedresource_default(client, _this38.channel.client.rest.presenceMixin.basePath(_this38), headers, envelope, /*#__PURE__*/function () {
6969
6986
  var _ref6 = _asyncToGenerator(function* (body, headers2, unpacked) {
@@ -7087,21 +7104,6 @@ var ably = {exports: {}};
7087
7104
  } else if (!this.annotations.summary) {
7088
7105
  this.annotations.summary = {};
7089
7106
  }
7090
- if (this.annotations && this.annotations.summary) {
7091
- for (var [type, summaryEntry] of Object.entries(this.annotations.summary)) {
7092
- if (type.endsWith(":distinct.v1") || type.endsWith(":unique.v1") || type.endsWith(":multiple.v1")) {
7093
- for (var [, entry] of Object.entries(summaryEntry)) {
7094
- if (!entry.clipped) {
7095
- entry.clipped = false;
7096
- }
7097
- }
7098
- } else if (type.endsWith(":flag.v1")) {
7099
- if (!summaryEntry.clipped) {
7100
- summaryEntry.clipped = false;
7101
- }
7102
- }
7103
- }
7104
- }
7105
7107
  }
7106
7108
  encode(options) {
7107
7109
  var _this40 = this;
@@ -7251,7 +7253,9 @@ var ably = {exports: {}};
7251
7253
  options = client.options,
7252
7254
  format = options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7253
7255
  idempotentRestPublishing = client.options.idempotentRestPublishing,
7254
- headers = defaults_default.defaultPostHeaders(client.options);
7256
+ headers = defaults_default.defaultPostHeaders(client.options, {
7257
+ format
7258
+ });
7255
7259
  _mixin(headers, options.headers);
7256
7260
  if (idempotentRestPublishing && allEmptyIds(messages)) {
7257
7261
  var msgIdBase = yield _randomString(MSG_ID_ENTROPY_BYTES);
@@ -7280,38 +7284,6 @@ var ably = {exports: {}};
7280
7284
  return _this46.client.rest.channelMixin.status(_this46);
7281
7285
  })();
7282
7286
  }
7283
- getMessage(serialOrMessage) {
7284
- var _this47 = this;
7285
- return _asyncToGenerator(function* () {
7286
- logger_default.logAction(_this47.logger, logger_default.LOG_MICRO, "RestChannel.getMessage()", "channel = " + _this47.name);
7287
- return _this47.client.rest.channelMixin.getMessage(_this47, serialOrMessage);
7288
- })();
7289
- }
7290
- updateMessage(message, operation, params) {
7291
- var _this48 = this;
7292
- return _asyncToGenerator(function* () {
7293
- logger_default.logAction(_this48.logger, logger_default.LOG_MICRO, "RestChannel.updateMessage()", "channel = " + _this48.name);
7294
- return _this48.client.rest.channelMixin.updateDeleteMessage(_this48, {
7295
- isDelete: false
7296
- }, message, operation, params);
7297
- })();
7298
- }
7299
- deleteMessage(message, operation, params) {
7300
- var _this49 = this;
7301
- return _asyncToGenerator(function* () {
7302
- logger_default.logAction(_this49.logger, logger_default.LOG_MICRO, "RestChannel.deleteMessage()", "channel = " + _this49.name);
7303
- return _this49.client.rest.channelMixin.updateDeleteMessage(_this49, {
7304
- isDelete: true
7305
- }, message, operation, params);
7306
- })();
7307
- }
7308
- getMessageVersions(serialOrMessage, params) {
7309
- var _this50 = this;
7310
- return _asyncToGenerator(function* () {
7311
- logger_default.logAction(_this50.logger, logger_default.LOG_MICRO, "RestChannel.getMessageVersions()", "channel = " + _this50.name);
7312
- return _this50.client.rest.channelMixin.getMessageVersions(_this50, serialOrMessage, params);
7313
- })();
7314
- }
7315
7287
  };
7316
7288
  var restchannel_default = RestChannel;
7317
7289
 
@@ -7340,7 +7312,9 @@ var ably = {exports: {}};
7340
7312
  var client = channel.client,
7341
7313
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7342
7314
  envelope = channel.client.http.supportsLinkHeaders ? void 0 : format,
7343
- headers = defaults_default.defaultGetHeaders(client.options);
7315
+ headers = defaults_default.defaultGetHeaders(client.options, {
7316
+ format
7317
+ });
7344
7318
  _mixin(headers, client.options.headers);
7345
7319
  return new paginatedresource_default(client, this.basePath(channel) + "/messages", headers, envelope, /*#__PURE__*/function () {
7346
7320
  var _ref7 = _asyncToGenerator(function* (body, headers2, unpacked) {
@@ -7353,81 +7327,16 @@ var ably = {exports: {}};
7353
7327
  }()).get(params);
7354
7328
  }
7355
7329
  static status(channel) {
7356
- var _this51 = this;
7330
+ var _this47 = this;
7357
7331
  return _asyncToGenerator(function* () {
7358
7332
  var format = channel.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */;
7359
- var headers = defaults_default.defaultPostHeaders(channel.client.options);
7360
- var response = yield resource_default.get(channel.client, _this51.basePath(channel), headers, {}, format, true);
7333
+ var headers = defaults_default.defaultPostHeaders(channel.client.options, {
7334
+ format
7335
+ });
7336
+ var response = yield resource_default.get(channel.client, _this47.basePath(channel), headers, {}, format, true);
7361
7337
  return response.body;
7362
7338
  })();
7363
7339
  }
7364
- static getMessage(channel, serialOrMessage) {
7365
- var _this52 = this;
7366
- return _asyncToGenerator(function* () {
7367
- var serial = typeof serialOrMessage === "string" ? serialOrMessage : serialOrMessage.serial;
7368
- if (!serial) {
7369
- throw new _ErrorInfo2('This message lacks a serial. Make sure you have enabled "Message annotations, updates, and deletes" in channel settings on your dashboard.', 40003, 400);
7370
- }
7371
- var client = channel.client;
7372
- var format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */;
7373
- var headers = defaults_default.defaultGetHeaders(client.options);
7374
- _mixin(headers, client.options.headers);
7375
- var {
7376
- body,
7377
- unpacked
7378
- } = yield resource_default.get(client, _this52.basePath(channel) + "/messages/" + encodeURIComponent(serial), headers, {}, null, true);
7379
- var decoded = unpacked ? body : _decodeBody(body, client._MsgPack, format);
7380
- return _fromEncoded2(decoded, channel);
7381
- })();
7382
- }
7383
- static updateDeleteMessage(channel, opts, message, operation, params) {
7384
- var _this53 = this;
7385
- return _asyncToGenerator(function* () {
7386
- if (!message.serial) {
7387
- throw new _ErrorInfo2('This message lacks a serial and cannot be updated. Make sure you have enabled "Message annotations, updates, and deletes" in channel settings on your dashboard.', 40003, 400);
7388
- }
7389
- var client = channel.client;
7390
- var format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */;
7391
- var headers = defaults_default.defaultPostHeaders(client.options);
7392
- _mixin(headers, client.options.headers);
7393
- var encoded = null;
7394
- if (message.data !== void 0) {
7395
- encoded = yield message_default.fromValues(message).encode(channel.channelOptions);
7396
- }
7397
- var req = {
7398
- serial: message.serial,
7399
- operation,
7400
- name: message.name,
7401
- data: encoded && encoded.data,
7402
- encoding: encoded && encoded.encoding,
7403
- extras: message.extras
7404
- };
7405
- var requestBody = serialize(req, client._MsgPack, format);
7406
- var method = opts.isDelete ? resource_default.post : resource_default.patch;
7407
- var pathSuffix = opts.isDelete ? "/delete" : "";
7408
- yield method(client, _this53.basePath(channel) + "/messages/" + encodeURIComponent(message.serial) + pathSuffix, requestBody, headers, params || {}, null, true);
7409
- })();
7410
- }
7411
- static getMessageVersions(channel, serialOrMessage, params) {
7412
- var serial = typeof serialOrMessage === "string" ? serialOrMessage : serialOrMessage.serial;
7413
- if (!serial) {
7414
- throw new _ErrorInfo2('This message lacks a serial. Make sure you have enabled "Message annotations, updates, and deletes" in channel settings on your dashboard.', 40003, 400);
7415
- }
7416
- var client = channel.client;
7417
- var format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */;
7418
- var envelope = channel.client.http.supportsLinkHeaders ? void 0 : format;
7419
- var headers = defaults_default.defaultGetHeaders(client.options);
7420
- _mixin(headers, client.options.headers);
7421
- return new paginatedresource_default(client, this.basePath(channel) + "/messages/" + encodeURIComponent(serial) + "/versions", headers, envelope, /*#__PURE__*/function () {
7422
- var _ref8 = _asyncToGenerator(function* (body, headers2, unpacked) {
7423
- var decoded = unpacked ? body : _decodeBody(body, client._MsgPack, format);
7424
- return _fromEncodedArray2(decoded, channel);
7425
- });
7426
- return function (_x62, _x63, _x64) {
7427
- return _ref8.apply(this, arguments);
7428
- };
7429
- }()).get(params || {});
7430
- }
7431
7340
  };
7432
7341
 
7433
7342
  // src/common/lib/client/restpresencemixin.ts
@@ -7436,20 +7345,22 @@ var ably = {exports: {}};
7436
7345
  return RestChannelMixin.basePath(presence.channel) + "/presence";
7437
7346
  }
7438
7347
  static history(presence, params) {
7439
- var _this54 = this;
7348
+ var _this48 = this;
7440
7349
  return _asyncToGenerator(function* () {
7441
7350
  var client = presence.channel.client,
7442
7351
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7443
7352
  envelope = presence.channel.client.http.supportsLinkHeaders ? void 0 : format,
7444
- headers = defaults_default.defaultGetHeaders(client.options);
7353
+ headers = defaults_default.defaultGetHeaders(client.options, {
7354
+ format
7355
+ });
7445
7356
  _mixin(headers, client.options.headers);
7446
- return new paginatedresource_default(client, _this54.basePath(presence) + "/history", headers, envelope, /*#__PURE__*/function () {
7447
- var _ref9 = _asyncToGenerator(function* (body, headers2, unpacked) {
7357
+ return new paginatedresource_default(client, _this48.basePath(presence) + "/history", headers, envelope, /*#__PURE__*/function () {
7358
+ var _ref8 = _asyncToGenerator(function* (body, headers2, unpacked) {
7448
7359
  var decoded = unpacked ? body : _decodeBody(body, client._MsgPack, format);
7449
7360
  return _fromEncodedArray(decoded, presence.channel);
7450
7361
  });
7451
- return function (_x65, _x66, _x67) {
7452
- return _ref9.apply(this, arguments);
7362
+ return function (_x62, _x63, _x64) {
7363
+ return _ref8.apply(this, arguments);
7453
7364
  };
7454
7365
  }()).get(params);
7455
7366
  })();
@@ -7471,39 +7382,32 @@ var ably = {exports: {}};
7471
7382
  this.push = new push_default(this.client);
7472
7383
  }
7473
7384
  stats(params) {
7474
- var _this55 = this;
7385
+ var _this49 = this;
7475
7386
  return _asyncToGenerator(function* () {
7476
- var headers = defaults_default.defaultGetHeaders(_this55.client.options),
7477
- format = _this55.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7478
- envelope = _this55.client.http.supportsLinkHeaders ? void 0 : format;
7479
- _mixin(headers, _this55.client.options.headers);
7480
- return new paginatedresource_default(_this55.client, "/stats", headers, envelope, /*#__PURE__*/function () {
7481
- var _ref0 = _asyncToGenerator(function* (body, _, unpacked) {
7482
- var statsValues = unpacked ? body : _decodeBody(body, _this55.client._MsgPack, format);
7483
- for (var i = 0; i < statsValues.length; i++) statsValues[i] = stats_default.fromValues(statsValues[i]);
7484
- return statsValues;
7485
- });
7486
- return function (_x68, _x69, _x70) {
7487
- return _ref0.apply(this, arguments);
7488
- };
7489
- }()).get(params);
7387
+ var headers = defaults_default.defaultGetHeaders(_this49.client.options),
7388
+ format = _this49.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7389
+ envelope = _this49.client.http.supportsLinkHeaders ? void 0 : format;
7390
+ _mixin(headers, _this49.client.options.headers);
7391
+ return new paginatedresource_default(_this49.client, "/stats", headers, envelope, function (body, headers2, unpacked) {
7392
+ var statsValues = unpacked ? body : JSON.parse(body);
7393
+ for (var i = 0; i < statsValues.length; i++) statsValues[i] = stats_default.fromValues(statsValues[i]);
7394
+ return statsValues;
7395
+ }).get(params);
7490
7396
  })();
7491
7397
  }
7492
7398
  time(params) {
7493
- var _this56 = this;
7399
+ var _this50 = this;
7494
7400
  return _asyncToGenerator(function* () {
7495
- var headers = defaults_default.defaultGetHeaders(_this56.client.options, {
7496
- format: "json" /* json */
7497
- });
7498
- if (_this56.client.options.headers) _mixin(headers, _this56.client.options.headers);
7401
+ var headers = defaults_default.defaultGetHeaders(_this50.client.options);
7402
+ if (_this50.client.options.headers) _mixin(headers, _this50.client.options.headers);
7499
7403
  var timeUri = host => {
7500
- return _this56.client.baseUri(host) + "/time";
7404
+ return _this50.client.baseUri(host) + "/time";
7501
7405
  };
7502
7406
  var {
7503
7407
  error,
7504
7408
  body,
7505
7409
  unpacked
7506
- } = yield _this56.client.http.do(HttpMethods_default.Get, timeUri, headers, null, params);
7410
+ } = yield _this50.client.http.do(HttpMethods_default.Get, timeUri, headers, null, params);
7507
7411
  if (error) {
7508
7412
  throw error;
7509
7413
  }
@@ -7512,47 +7416,47 @@ var ably = {exports: {}};
7512
7416
  if (!time) {
7513
7417
  throw new _ErrorInfo2("Internal error (unexpected result type from GET /time)", 5e4, 500);
7514
7418
  }
7515
- _this56.client.serverTimeOffset = time - Date.now();
7419
+ _this50.client.serverTimeOffset = time - Date.now();
7516
7420
  return time;
7517
7421
  })();
7518
7422
  }
7519
7423
  request(method, path, version2, params, body, customHeaders) {
7520
- var _this57 = this;
7424
+ var _this51 = this;
7521
7425
  return _asyncToGenerator(function* () {
7522
7426
  var _a2;
7523
7427
  var [encoder, decoder, format] = (() => {
7524
- if (_this57.client.options.useBinaryProtocol) {
7525
- if (!_this57.client._MsgPack) {
7428
+ if (_this51.client.options.useBinaryProtocol) {
7429
+ if (!_this51.client._MsgPack) {
7526
7430
  _throwMissingPluginError("MsgPack");
7527
7431
  }
7528
- return [_this57.client._MsgPack.encode, _this57.client._MsgPack.decode, "msgpack" /* msgpack */];
7432
+ return [_this51.client._MsgPack.encode, _this51.client._MsgPack.decode, "msgpack" /* msgpack */];
7529
7433
  } else {
7530
7434
  return [JSON.stringify, JSON.parse, "json" /* json */];
7531
7435
  }
7532
7436
  })();
7533
- var envelope = _this57.client.http.supportsLinkHeaders ? void 0 : format;
7437
+ var envelope = _this51.client.http.supportsLinkHeaders ? void 0 : format;
7534
7438
  params = params || {};
7535
7439
  var _method = method.toLowerCase();
7536
- var headers = _method == "get" ? defaults_default.defaultGetHeaders(_this57.client.options, {
7440
+ var headers = _method == "get" ? defaults_default.defaultGetHeaders(_this51.client.options, {
7537
7441
  format,
7538
7442
  protocolVersion: version2
7539
- }) : defaults_default.defaultPostHeaders(_this57.client.options, {
7443
+ }) : defaults_default.defaultPostHeaders(_this51.client.options, {
7540
7444
  format,
7541
7445
  protocolVersion: version2
7542
7446
  });
7543
7447
  if (typeof body !== "string") {
7544
7448
  body = (_a2 = encoder(body)) != null ? _a2 : null;
7545
7449
  }
7546
- _mixin(headers, _this57.client.options.headers);
7450
+ _mixin(headers, _this51.client.options.headers);
7547
7451
  if (customHeaders) {
7548
7452
  _mixin(headers, customHeaders);
7549
7453
  }
7550
- var paginatedResource = new paginatedresource_default(_this57.client, path, headers, envelope, /*#__PURE__*/function () {
7551
- var _ref1 = _asyncToGenerator(function* (resbody, headers2, unpacked) {
7454
+ var paginatedResource = new paginatedresource_default(_this51.client, path, headers, envelope, /*#__PURE__*/function () {
7455
+ var _ref9 = _asyncToGenerator(function* (resbody, headers2, unpacked) {
7552
7456
  return _ensureArray(unpacked ? resbody : decoder(resbody));
7553
7457
  });
7554
- return function (_x71, _x72, _x73) {
7555
- return _ref1.apply(this, arguments);
7458
+ return function (_x65, _x66, _x67) {
7459
+ return _ref9.apply(this, arguments);
7556
7460
  };
7557
7461
  }(), /* useHttpPaginatedResponse: */
7558
7462
  true);
@@ -7567,7 +7471,7 @@ var ably = {exports: {}};
7567
7471
  })();
7568
7472
  }
7569
7473
  batchPublish(specOrSpecs) {
7570
- var _this58 = this;
7474
+ var _this52 = this;
7571
7475
  return _asyncToGenerator(function* () {
7572
7476
  var requestBodyDTO;
7573
7477
  var singleSpecMode;
@@ -7578,12 +7482,14 @@ var ably = {exports: {}};
7578
7482
  requestBodyDTO = [specOrSpecs];
7579
7483
  singleSpecMode = true;
7580
7484
  }
7581
- var format = _this58.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7582
- headers = defaults_default.defaultPostHeaders(_this58.client.options);
7583
- if (_this58.client.options.headers) _mixin(headers, _this58.client.options.headers);
7584
- var requestBody = _encodeBody(requestBodyDTO, _this58.client._MsgPack, format);
7585
- var response = yield resource_default.post(_this58.client, "/messages", requestBody, headers, {}, null, true);
7586
- var batchResults = response.unpacked ? response.body : _decodeBody(response.body, _this58.client._MsgPack, format);
7485
+ var format = _this52.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7486
+ headers = defaults_default.defaultPostHeaders(_this52.client.options, {
7487
+ format
7488
+ });
7489
+ if (_this52.client.options.headers) _mixin(headers, _this52.client.options.headers);
7490
+ var requestBody = _encodeBody(requestBodyDTO, _this52.client._MsgPack, format);
7491
+ var response = yield resource_default.post(_this52.client, "/messages", requestBody, headers, {}, null, true);
7492
+ var batchResults = response.unpacked ? response.body : _decodeBody(response.body, _this52.client._MsgPack, format);
7587
7493
  if (singleSpecMode) {
7588
7494
  return batchResults[0];
7589
7495
  } else {
@@ -7592,35 +7498,39 @@ var ably = {exports: {}};
7592
7498
  })();
7593
7499
  }
7594
7500
  batchPresence(channels) {
7595
- var _this59 = this;
7501
+ var _this53 = this;
7596
7502
  return _asyncToGenerator(function* () {
7597
- var format = _this59.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7598
- headers = defaults_default.defaultGetHeaders(_this59.client.options);
7599
- if (_this59.client.options.headers) _mixin(headers, _this59.client.options.headers);
7503
+ var format = _this53.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7504
+ headers = defaults_default.defaultPostHeaders(_this53.client.options, {
7505
+ format
7506
+ });
7507
+ if (_this53.client.options.headers) _mixin(headers, _this53.client.options.headers);
7600
7508
  var channelsParam = channels.join(",");
7601
- var response = yield resource_default.get(_this59.client, "/presence", headers, {
7509
+ var response = yield resource_default.get(_this53.client, "/presence", headers, {
7602
7510
  channels: channelsParam
7603
7511
  }, null, true);
7604
- return response.unpacked ? response.body : _decodeBody(response.body, _this59.client._MsgPack, format);
7512
+ return response.unpacked ? response.body : _decodeBody(response.body, _this53.client._MsgPack, format);
7605
7513
  })();
7606
7514
  }
7607
7515
  revokeTokens(specifiers, options) {
7608
- var _this60 = this;
7516
+ var _this54 = this;
7609
7517
  return _asyncToGenerator(function* () {
7610
- if (useTokenAuth(_this60.client.options)) {
7518
+ if (useTokenAuth(_this54.client.options)) {
7611
7519
  throw new _ErrorInfo2("Cannot revoke tokens when using token auth", 40162, 401);
7612
7520
  }
7613
- var keyName = _this60.client.options.keyName;
7521
+ var keyName = _this54.client.options.keyName;
7614
7522
  var resolvedOptions = options != null ? options : {};
7615
7523
  var requestBodyDTO = __spreadValues({
7616
7524
  targets: specifiers.map(specifier => "".concat(specifier.type, ":").concat(specifier.value))
7617
7525
  }, resolvedOptions);
7618
- var format = _this60.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7619
- headers = defaults_default.defaultPostHeaders(_this60.client.options);
7620
- if (_this60.client.options.headers) _mixin(headers, _this60.client.options.headers);
7621
- var requestBody = _encodeBody(requestBodyDTO, _this60.client._MsgPack, format);
7622
- var response = yield resource_default.post(_this60.client, "/keys/".concat(keyName, "/revokeTokens"), requestBody, headers, {}, null, true);
7623
- return response.unpacked ? response.body : _decodeBody(response.body, _this60.client._MsgPack, format);
7526
+ var format = _this54.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7527
+ headers = defaults_default.defaultPostHeaders(_this54.client.options, {
7528
+ format
7529
+ });
7530
+ if (_this54.client.options.headers) _mixin(headers, _this54.client.options.headers);
7531
+ var requestBody = _encodeBody(requestBodyDTO, _this54.client._MsgPack, format);
7532
+ var response = yield resource_default.post(_this54.client, "/keys/".concat(keyName, "/revokeTokens"), requestBody, headers, {}, null, true);
7533
+ return response.unpacked ? response.body : _decodeBody(response.body, _this54.client._MsgPack, format);
7624
7534
  })();
7625
7535
  }
7626
7536
  };
@@ -7704,7 +7614,7 @@ var ably = {exports: {}};
7704
7614
 
7705
7615
  // src/common/lib/types/annotation.ts
7706
7616
  var actions4 = ["annotation.create", "annotation.delete"];
7707
- function fromEncoded3(_x74, _x75, _x76) {
7617
+ function fromEncoded3(_x68, _x69, _x70) {
7708
7618
  return _fromEncoded8.apply(this, arguments);
7709
7619
  }
7710
7620
  function _fromEncoded8() {
@@ -7714,7 +7624,7 @@ var ably = {exports: {}};
7714
7624
  });
7715
7625
  return _fromEncoded8.apply(this, arguments);
7716
7626
  }
7717
- function fromEncodedArray3(_x77, _x78, _x79) {
7627
+ function fromEncodedArray3(_x71, _x72, _x73) {
7718
7628
  return _fromEncodedArray8.apply(this, arguments);
7719
7629
  }
7720
7630
  function _fromEncodedArray8() {
@@ -7725,7 +7635,7 @@ var ably = {exports: {}};
7725
7635
  });
7726
7636
  return _fromEncodedArray8.apply(this, arguments);
7727
7637
  }
7728
- function _fromEncoded3(_x80, _x81) {
7638
+ function _fromEncoded3(_x74, _x75) {
7729
7639
  return _fromEncoded9.apply(this, arguments);
7730
7640
  }
7731
7641
  function _fromEncoded9() {
@@ -7734,7 +7644,7 @@ var ably = {exports: {}};
7734
7644
  });
7735
7645
  return _fromEncoded9.apply(this, arguments);
7736
7646
  }
7737
- function _fromEncodedArray3(_x82, _x83) {
7647
+ function _fromEncodedArray3(_x76, _x77) {
7738
7648
  return _fromEncodedArray9.apply(this, arguments);
7739
7649
  }
7740
7650
  function _fromEncodedArray9() {
@@ -7747,10 +7657,10 @@ var ably = {exports: {}};
7747
7657
  }
7748
7658
  var Annotation = class _Annotation extends BaseMessage {
7749
7659
  encode() {
7750
- var _this61 = this;
7660
+ var _this55 = this;
7751
7661
  return _asyncToGenerator(function* () {
7752
- var res = Object.assign(new WireAnnotation(), _this61, {
7753
- action: actions4.indexOf(_this61.action || "annotation.create")
7662
+ var res = Object.assign(new WireAnnotation(), _this55, {
7663
+ action: actions4.indexOf(_this55.action || "annotation.create")
7754
7664
  });
7755
7665
  return encode(res, {});
7756
7666
  })();
@@ -7779,10 +7689,10 @@ var ably = {exports: {}};
7779
7689
  return values.map(v => _WireAnnotation.fromValues(v));
7780
7690
  }
7781
7691
  decode(channelOptions, logger) {
7782
- var _this62 = this;
7692
+ var _this56 = this;
7783
7693
  return _asyncToGenerator(function* () {
7784
- var res = Object.assign(new Annotation(), __spreadProps(__spreadValues({}, _this62), {
7785
- action: actions4[_this62.action]
7694
+ var res = Object.assign(new Annotation(), __spreadProps(__spreadValues({}, _this56), {
7695
+ action: actions4[_this56.action]
7786
7696
  }));
7787
7697
  try {
7788
7698
  yield decode(res, channelOptions);
@@ -7851,43 +7761,47 @@ var ably = {exports: {}};
7851
7761
  this.channel = channel;
7852
7762
  }
7853
7763
  publish(msgOrSerial, annotationValues) {
7854
- var _this63 = this;
7764
+ var _this57 = this;
7855
7765
  return _asyncToGenerator(function* () {
7856
7766
  var annotation = constructValidateAnnotation(msgOrSerial, annotationValues);
7857
7767
  var wireAnnotation = yield annotation.encode();
7858
- var client = _this63.channel.client,
7768
+ var client = _this57.channel.client,
7859
7769
  options = client.options,
7860
7770
  format = options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7861
- headers = defaults_default.defaultPostHeaders(client.options),
7771
+ headers = defaults_default.defaultPostHeaders(client.options, {
7772
+ format
7773
+ }),
7862
7774
  params = {};
7863
7775
  _mixin(headers, client.options.headers);
7864
7776
  var requestBody = _encodeBody([wireAnnotation], client._MsgPack, format);
7865
- yield resource_default.post(client, basePathForSerial(_this63.channel, annotation.messageSerial), requestBody, headers, params, null, true);
7777
+ yield resource_default.post(client, basePathForSerial(_this57.channel, annotation.messageSerial), requestBody, headers, params, null, true);
7866
7778
  })();
7867
7779
  }
7868
7780
  delete(msgOrSerial, annotationValues) {
7869
- var _this64 = this;
7781
+ var _this58 = this;
7870
7782
  return _asyncToGenerator(function* () {
7871
7783
  annotationValues.action = "annotation.delete";
7872
- return _this64.publish(msgOrSerial, annotationValues);
7784
+ return _this58.publish(msgOrSerial, annotationValues);
7873
7785
  })();
7874
7786
  }
7875
7787
  get(msgOrSerial, params) {
7876
- var _this65 = this;
7788
+ var _this59 = this;
7877
7789
  return _asyncToGenerator(function* () {
7878
- var client = _this65.channel.client,
7790
+ var client = _this59.channel.client,
7879
7791
  messageSerial = serialFromMsgOrSerial(msgOrSerial),
7880
7792
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7881
7793
  envelope = client.http.supportsLinkHeaders ? void 0 : format,
7882
- headers = defaults_default.defaultGetHeaders(client.options);
7794
+ headers = defaults_default.defaultGetHeaders(client.options, {
7795
+ format
7796
+ });
7883
7797
  _mixin(headers, client.options.headers);
7884
- return new paginatedresource_default(client, basePathForSerial(_this65.channel, messageSerial), headers, envelope, /*#__PURE__*/function () {
7885
- var _ref10 = _asyncToGenerator(function* (body, _, unpacked) {
7798
+ return new paginatedresource_default(client, basePathForSerial(_this59.channel, messageSerial), headers, envelope, /*#__PURE__*/function () {
7799
+ var _ref0 = _asyncToGenerator(function* (body, _, unpacked) {
7886
7800
  var decoded = unpacked ? body : _decodeBody(body, client._MsgPack, format);
7887
- return _fromEncodedArray3(decoded, _this65.channel);
7801
+ return _fromEncodedArray3(decoded, _this59.channel);
7888
7802
  });
7889
- return function (_x84, _x85, _x86) {
7890
- return _ref10.apply(this, arguments);
7803
+ return function (_x78, _x79, _x80) {
7804
+ return _ref0.apply(this, arguments);
7891
7805
  };
7892
7806
  }()).get(params);
7893
7807
  })();
@@ -8058,7 +7972,7 @@ var ably = {exports: {}};
8058
7972
  this._mode = 0;
8059
7973
  this.retryCount = 0;
8060
7974
  this.history = /*#__PURE__*/function () {
8061
- var _ref11 = _asyncToGenerator(function* (params) {
7975
+ var _ref1 = _asyncToGenerator(function* (params) {
8062
7976
  logger_default.logAction(this.logger, logger_default.LOG_MICRO, "RealtimeChannel.history()", "channel = " + this.name);
8063
7977
  var restMixin = this.client.rest.channelMixin;
8064
7978
  if (params && params.untilAttach) {
@@ -8073,8 +7987,8 @@ var ably = {exports: {}};
8073
7987
  }
8074
7988
  return restMixin.history(this, params);
8075
7989
  });
8076
- return function (_x87) {
8077
- return _ref11.apply(this, arguments);
7990
+ return function (_x81) {
7991
+ return _ref1.apply(this, arguments);
8078
7992
  };
8079
7993
  }();
8080
7994
  this.whenState = state => {
@@ -8153,20 +8067,20 @@ var ably = {exports: {}};
8153
8067
  return args;
8154
8068
  }
8155
8069
  setOptions(options) {
8156
- var _this66 = this;
8070
+ var _this60 = this;
8157
8071
  return _asyncToGenerator(function* () {
8158
8072
  var _a2;
8159
- var previousChannelOptions = _this66.channelOptions;
8073
+ var previousChannelOptions = _this60.channelOptions;
8160
8074
  var err = validateChannelOptions(options);
8161
8075
  if (err) {
8162
8076
  throw err;
8163
8077
  }
8164
- _this66.channelOptions = normaliseChannelOptions((_a2 = _this66.client._Crypto) != null ? _a2 : null, _this66.logger, options);
8165
- if (_this66._decodingContext) _this66._decodingContext.channelOptions = _this66.channelOptions;
8166
- if (_this66._shouldReattachToSetOptions(options, previousChannelOptions)) {
8167
- _this66.attachImpl();
8078
+ _this60.channelOptions = normaliseChannelOptions((_a2 = _this60.client._Crypto) != null ? _a2 : null, _this60.logger, options);
8079
+ if (_this60._decodingContext) _this60._decodingContext.channelOptions = _this60.channelOptions;
8080
+ if (_this60._shouldReattachToSetOptions(options, previousChannelOptions)) {
8081
+ _this60.attachImpl();
8168
8082
  return new Promise((resolve, reject) => {
8169
- _this66._allChannelChanges.once(["attached", "update", "detached", "failed"], function (stateChange) {
8083
+ _this60._allChannelChanges.once(["attached", "update", "detached", "failed"], function (stateChange) {
8170
8084
  switch (this.event) {
8171
8085
  case "update":
8172
8086
  case "attached":
@@ -8203,7 +8117,7 @@ var ably = {exports: {}};
8203
8117
  }
8204
8118
  publish() {
8205
8119
  var _arguments2 = arguments,
8206
- _this67 = this;
8120
+ _this61 = this;
8207
8121
  return _asyncToGenerator(function* () {
8208
8122
  var messages;
8209
8123
  var argCount = _arguments2.length;
@@ -8221,20 +8135,20 @@ var ably = {exports: {}};
8221
8135
  data: _arguments2.length <= 1 ? undefined : _arguments2[1]
8222
8136
  })];
8223
8137
  }
8224
- var maxMessageSize = _this67.client.options.maxMessageSize;
8225
- var wireMessages = yield encodeArray(messages, _this67.channelOptions);
8138
+ var maxMessageSize = _this61.client.options.maxMessageSize;
8139
+ var wireMessages = yield encodeArray(messages, _this61.channelOptions);
8226
8140
  var size = getMessagesSize(wireMessages);
8227
8141
  if (size > maxMessageSize) {
8228
8142
  throw new _ErrorInfo2("Maximum size of messages that can be published at once exceeded (was ".concat(size, " bytes; limit is ").concat(maxMessageSize, " bytes)"), 40009, 400);
8229
8143
  }
8230
- _this67.throwIfUnpublishableState();
8231
- logger_default.logAction(_this67.logger, logger_default.LOG_MICRO, "RealtimeChannel.publish()", "sending message; channel state is " + _this67.state + ", message count = " + wireMessages.length);
8144
+ _this61.throwIfUnpublishableState();
8145
+ logger_default.logAction(_this61.logger, logger_default.LOG_MICRO, "RealtimeChannel.publish()", "sending message; channel state is " + _this61.state + ", message count = " + wireMessages.length);
8232
8146
  var pm = fromValues({
8233
8147
  action: actions.MESSAGE,
8234
- channel: _this67.name,
8148
+ channel: _this61.name,
8235
8149
  messages: wireMessages
8236
8150
  });
8237
- return _this67.sendMessage(pm);
8151
+ return _this61.sendMessage(pm);
8238
8152
  })();
8239
8153
  }
8240
8154
  throwIfUnpublishableState() {
@@ -8254,13 +8168,13 @@ var ably = {exports: {}};
8254
8168
  }
8255
8169
  }
8256
8170
  attach() {
8257
- var _this68 = this;
8171
+ var _this62 = this;
8258
8172
  return _asyncToGenerator(function* () {
8259
- if (_this68.state === "attached") {
8173
+ if (_this62.state === "attached") {
8260
8174
  return null;
8261
8175
  }
8262
8176
  return new Promise((resolve, reject) => {
8263
- _this68._attach(false, null, (err, result) => err ? reject(err) : resolve(result));
8177
+ _this62._attach(false, null, (err, result) => err ? reject(err) : resolve(result));
8264
8178
  });
8265
8179
  })();
8266
8180
  }
@@ -8318,25 +8232,25 @@ var ably = {exports: {}};
8318
8232
  this.sendMessage(attachMsg).catch(noop);
8319
8233
  }
8320
8234
  detach() {
8321
- var _this69 = this;
8235
+ var _this63 = this;
8322
8236
  return _asyncToGenerator(function* () {
8323
- var connectionManager = _this69.connectionManager;
8237
+ var connectionManager = _this63.connectionManager;
8324
8238
  if (!connectionManager.activeState()) {
8325
8239
  throw connectionManager.getError();
8326
8240
  }
8327
- switch (_this69.state) {
8241
+ switch (_this63.state) {
8328
8242
  case "suspended":
8329
- _this69.notifyState("detached");
8243
+ _this63.notifyState("detached");
8330
8244
  return;
8331
8245
  case "detached":
8332
8246
  return;
8333
8247
  case "failed":
8334
8248
  throw new _ErrorInfo2("Unable to detach; channel state = failed", 90001, 400);
8335
8249
  default:
8336
- _this69.requestState("detaching");
8250
+ _this63.requestState("detaching");
8337
8251
  case "detaching":
8338
8252
  return new Promise((resolve, reject) => {
8339
- _this69.once(function (stateChange) {
8253
+ _this63.once(function (stateChange) {
8340
8254
  switch (this.event) {
8341
8255
  case "detached":
8342
8256
  resolve();
@@ -8365,22 +8279,22 @@ var ably = {exports: {}};
8365
8279
  }
8366
8280
  subscribe() {
8367
8281
  var _arguments3 = arguments,
8368
- _this70 = this;
8282
+ _this64 = this;
8369
8283
  return _asyncToGenerator(function* () {
8370
8284
  for (var _len0 = _arguments3.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
8371
8285
  args[_key0] = _arguments3[_key0];
8372
8286
  }
8373
8287
  var [event, listener] = _RealtimeChannel.processListenerArgs(args);
8374
- if (_this70.state === "failed") {
8375
- throw _ErrorInfo2.fromValues(_this70.invalidStateError());
8288
+ if (_this64.state === "failed") {
8289
+ throw _ErrorInfo2.fromValues(_this64.invalidStateError());
8376
8290
  }
8377
8291
  if (event && typeof event === "object" && !Array.isArray(event)) {
8378
- _this70.client._FilteredSubscriptions.subscribeFilter(_this70, event, listener);
8292
+ _this64.client._FilteredSubscriptions.subscribeFilter(_this64, event, listener);
8379
8293
  } else {
8380
- _this70.subscriptions.on(event, listener);
8294
+ _this64.subscriptions.on(event, listener);
8381
8295
  }
8382
- if (_this70.channelOptions.attachOnSubscribe !== false) {
8383
- return _this70.attach();
8296
+ if (_this64.channelOptions.attachOnSubscribe !== false) {
8297
+ return _this64.attach();
8384
8298
  } else {
8385
8299
  return null;
8386
8300
  }
@@ -8419,10 +8333,10 @@ var ably = {exports: {}};
8419
8333
  connectionManager.send(syncMessage);
8420
8334
  }
8421
8335
  sendMessage(msg) {
8422
- var _this71 = this;
8336
+ var _this65 = this;
8423
8337
  return _asyncToGenerator(function* () {
8424
8338
  return new Promise((resolve, reject) => {
8425
- _this71.connectionManager.send(msg, _this71.client.options.queueMessages, err => {
8339
+ _this65.connectionManager.send(msg, _this65.client.options.queueMessages, err => {
8426
8340
  if (err) {
8427
8341
  reject(err);
8428
8342
  } else {
@@ -8433,14 +8347,14 @@ var ably = {exports: {}};
8433
8347
  })();
8434
8348
  }
8435
8349
  sendPresence(presence) {
8436
- var _this72 = this;
8350
+ var _this66 = this;
8437
8351
  return _asyncToGenerator(function* () {
8438
8352
  var msg = fromValues({
8439
8353
  action: actions.PRESENCE,
8440
- channel: _this72.name,
8354
+ channel: _this66.name,
8441
8355
  presence
8442
8356
  });
8443
- return _this72.sendMessage(msg);
8357
+ return _this66.sendMessage(msg);
8444
8358
  })();
8445
8359
  }
8446
8360
  sendState(objectMessages) {
@@ -8453,61 +8367,61 @@ var ably = {exports: {}};
8453
8367
  }
8454
8368
  // Access to this method is synchronised by ConnectionManager#processChannelMessage, in order to synchronise access to the state stored in _decodingContext.
8455
8369
  processMessage(message) {
8456
- var _this73 = this;
8370
+ var _this67 = this;
8457
8371
  return _asyncToGenerator(function* () {
8458
8372
  if (message.action === actions.ATTACHED || message.action === actions.MESSAGE || message.action === actions.PRESENCE || message.action === actions.OBJECT || message.action === actions.ANNOTATION) {
8459
- _this73.setChannelSerial(message.channelSerial);
8373
+ _this67.setChannelSerial(message.channelSerial);
8460
8374
  }
8461
8375
  var syncChannelSerial,
8462
8376
  isSync = false;
8463
8377
  switch (message.action) {
8464
8378
  case actions.ATTACHED:
8465
8379
  {
8466
- _this73.properties.attachSerial = message.channelSerial;
8467
- _this73._mode = message.getMode();
8468
- _this73.params = message.params || {};
8380
+ _this67.properties.attachSerial = message.channelSerial;
8381
+ _this67._mode = message.getMode();
8382
+ _this67.params = message.params || {};
8469
8383
  var modesFromFlags = message.decodeModesFromFlags();
8470
- _this73.modes = modesFromFlags && _allToLowerCase(modesFromFlags) || void 0;
8384
+ _this67.modes = modesFromFlags && _allToLowerCase(modesFromFlags) || void 0;
8471
8385
  var resumed = message.hasFlag("RESUMED");
8472
8386
  var hasPresence = message.hasFlag("HAS_PRESENCE");
8473
8387
  var hasBacklog = message.hasFlag("HAS_BACKLOG");
8474
8388
  var hasObjects = message.hasFlag("HAS_OBJECTS");
8475
- if (_this73.state === "attached") {
8389
+ if (_this67.state === "attached") {
8476
8390
  if (!resumed) {
8477
- if (_this73._presence) {
8478
- _this73._presence.onAttached(hasPresence);
8391
+ if (_this67._presence) {
8392
+ _this67._presence.onAttached(hasPresence);
8479
8393
  }
8480
- if (_this73._objects) {
8481
- _this73._objects.onAttached(hasObjects);
8394
+ if (_this67._objects) {
8395
+ _this67._objects.onAttached(hasObjects);
8482
8396
  }
8483
8397
  }
8484
- var change = new channelstatechange_default(_this73.state, _this73.state, resumed, hasBacklog, message.error);
8485
- _this73._allChannelChanges.emit("update", change);
8486
- if (!resumed || _this73.channelOptions.updateOnAttached) {
8487
- _this73.emit("update", change);
8398
+ var change = new channelstatechange_default(_this67.state, _this67.state, resumed, hasBacklog, message.error);
8399
+ _this67._allChannelChanges.emit("update", change);
8400
+ if (!resumed || _this67.channelOptions.updateOnAttached) {
8401
+ _this67.emit("update", change);
8488
8402
  }
8489
- } else if (_this73.state === "detaching") {
8490
- _this73.checkPendingState();
8403
+ } else if (_this67.state === "detaching") {
8404
+ _this67.checkPendingState();
8491
8405
  } else {
8492
- _this73.notifyState("attached", message.error, resumed, hasPresence, hasBacklog, hasObjects);
8406
+ _this67.notifyState("attached", message.error, resumed, hasPresence, hasBacklog, hasObjects);
8493
8407
  }
8494
8408
  break;
8495
8409
  }
8496
8410
  case actions.DETACHED:
8497
8411
  {
8498
8412
  var detachErr = message.error ? _ErrorInfo2.fromValues(message.error) : new _ErrorInfo2("Channel detached", 90001, 404);
8499
- if (_this73.state === "detaching") {
8500
- _this73.notifyState("detached", detachErr);
8501
- } else if (_this73.state === "attaching") {
8502
- _this73.notifyState("suspended", detachErr);
8503
- } else if (_this73.state === "attached" || _this73.state === "suspended") {
8504
- _this73.requestState("attaching", detachErr);
8413
+ if (_this67.state === "detaching") {
8414
+ _this67.notifyState("detached", detachErr);
8415
+ } else if (_this67.state === "attaching") {
8416
+ _this67.notifyState("suspended", detachErr);
8417
+ } else if (_this67.state === "attached" || _this67.state === "suspended") {
8418
+ _this67.requestState("attaching", detachErr);
8505
8419
  }
8506
8420
  break;
8507
8421
  }
8508
8422
  case actions.SYNC:
8509
8423
  isSync = true;
8510
- syncChannelSerial = _this73.syncChannelSerial = message.channelSerial;
8424
+ syncChannelSerial = _this67.syncChannelSerial = message.channelSerial;
8511
8425
  if (!message.presence) break;
8512
8426
  case actions.PRESENCE:
8513
8427
  {
@@ -8515,45 +8429,45 @@ var ably = {exports: {}};
8515
8429
  break;
8516
8430
  }
8517
8431
  populateFieldsFromParent(message);
8518
- var options = _this73.channelOptions;
8519
- if (_this73._presence) {
8432
+ var options = _this67.channelOptions;
8433
+ if (_this67._presence) {
8520
8434
  var presenceMessages = yield Promise.all(message.presence.map(wpm => {
8521
- return wpm.decode(options, _this73.logger);
8435
+ return wpm.decode(options, _this67.logger);
8522
8436
  }));
8523
- _this73._presence.setPresence(presenceMessages, isSync, syncChannelSerial);
8437
+ _this67._presence.setPresence(presenceMessages, isSync, syncChannelSerial);
8524
8438
  }
8525
8439
  break;
8526
8440
  }
8527
8441
  case actions.OBJECT:
8528
8442
  case actions.OBJECT_SYNC:
8529
8443
  {
8530
- if (!_this73._objects || !message.state) {
8444
+ if (!_this67._objects || !message.state) {
8531
8445
  return;
8532
8446
  }
8533
8447
  populateFieldsFromParent(message);
8534
- var format = _this73.client.connection.connectionManager.getActiveTransportFormat();
8535
- var objectMessages = message.state.map(om => om.decode(_this73.client, format));
8448
+ var format = _this67.client.connection.connectionManager.getActiveTransportFormat();
8449
+ var objectMessages = message.state.map(om => om.decode(_this67.client, format));
8536
8450
  if (message.action === actions.OBJECT) {
8537
- _this73._objects.handleObjectMessages(objectMessages);
8451
+ _this67._objects.handleObjectMessages(objectMessages);
8538
8452
  } else {
8539
- _this73._objects.handleObjectSyncMessages(objectMessages, message.channelSerial);
8453
+ _this67._objects.handleObjectSyncMessages(objectMessages, message.channelSerial);
8540
8454
  }
8541
8455
  break;
8542
8456
  }
8543
8457
  case actions.MESSAGE:
8544
8458
  {
8545
- if (_this73.state !== "attached") {
8546
- logger_default.logAction(_this73.logger, logger_default.LOG_MAJOR, "RealtimeChannel.processMessage()", 'Message "' + message.id + '" skipped as this channel "' + _this73.name + '" state is not "attached" (state is "' + _this73.state + '").');
8459
+ if (_this67.state !== "attached") {
8460
+ logger_default.logAction(_this67.logger, logger_default.LOG_MAJOR, "RealtimeChannel.processMessage()", 'Message "' + message.id + '" skipped as this channel "' + _this67.name + '" state is not "attached" (state is "' + _this67.state + '").');
8547
8461
  return;
8548
8462
  }
8549
8463
  populateFieldsFromParent(message);
8550
8464
  var encoded = message.messages,
8551
8465
  firstMessage = encoded[0],
8552
8466
  lastMessage = encoded[encoded.length - 1];
8553
- if (firstMessage.extras && firstMessage.extras.delta && firstMessage.extras.delta.from !== _this73._lastPayload.messageId) {
8554
- var msg = 'Delta message decode failure - previous message not available for message "' + message.id + '" on this channel "' + _this73.name + '".';
8555
- logger_default.logAction(_this73.logger, logger_default.LOG_ERROR, "RealtimeChannel.processMessage()", msg);
8556
- _this73._startDecodeFailureRecovery(new _ErrorInfo2(msg, 40018, 400));
8467
+ if (firstMessage.extras && firstMessage.extras.delta && firstMessage.extras.delta.from !== _this67._lastPayload.messageId) {
8468
+ var msg = 'Delta message decode failure - previous message not available for message "' + message.id + '" on this channel "' + _this67.name + '".';
8469
+ logger_default.logAction(_this67.logger, logger_default.LOG_ERROR, "RealtimeChannel.processMessage()", msg);
8470
+ _this67._startDecodeFailureRecovery(new _ErrorInfo2(msg, 40018, 400));
8557
8471
  break;
8558
8472
  }
8559
8473
  var messages = [];
@@ -8561,34 +8475,34 @@ var ably = {exports: {}};
8561
8475
  var {
8562
8476
  decoded,
8563
8477
  err
8564
- } = yield encoded[i].decodeWithErr(_this73._decodingContext, _this73.logger);
8478
+ } = yield encoded[i].decodeWithErr(_this67._decodingContext, _this67.logger);
8565
8479
  messages[i] = decoded;
8566
8480
  if (err) {
8567
8481
  switch (err.code) {
8568
8482
  case 40018:
8569
- _this73._startDecodeFailureRecovery(err);
8483
+ _this67._startDecodeFailureRecovery(err);
8570
8484
  return;
8571
8485
  case 40019:
8572
8486
  case 40021:
8573
- _this73.notifyState("failed", err);
8487
+ _this67.notifyState("failed", err);
8574
8488
  return;
8575
8489
  }
8576
8490
  }
8577
8491
  }
8578
- _this73._lastPayload.messageId = lastMessage.id;
8579
- _this73._lastPayload.protocolMessageChannelSerial = message.channelSerial;
8580
- _this73.onEvent(messages);
8492
+ _this67._lastPayload.messageId = lastMessage.id;
8493
+ _this67._lastPayload.protocolMessageChannelSerial = message.channelSerial;
8494
+ _this67.onEvent(messages);
8581
8495
  break;
8582
8496
  }
8583
8497
  case actions.ANNOTATION:
8584
8498
  {
8585
8499
  populateFieldsFromParent(message);
8586
- var _options = _this73.channelOptions;
8587
- if (_this73._annotations) {
8500
+ var _options = _this67.channelOptions;
8501
+ if (_this67._annotations) {
8588
8502
  var annotations = yield Promise.all((message.annotations || []).map(wpm => {
8589
- return wpm.decode(_options, _this73.logger);
8503
+ return wpm.decode(_options, _this67.logger);
8590
8504
  }));
8591
- _this73._annotations._processIncoming(annotations);
8505
+ _this67._annotations._processIncoming(annotations);
8592
8506
  }
8593
8507
  break;
8594
8508
  }
@@ -8596,14 +8510,14 @@ var ably = {exports: {}};
8596
8510
  {
8597
8511
  var _err = message.error;
8598
8512
  if (_err && _err.code == 80016) {
8599
- _this73.checkPendingState();
8513
+ _this67.checkPendingState();
8600
8514
  } else {
8601
- _this73.notifyState("failed", _ErrorInfo2.fromValues(_err));
8515
+ _this67.notifyState("failed", _ErrorInfo2.fromValues(_err));
8602
8516
  }
8603
8517
  break;
8604
8518
  }
8605
8519
  default:
8606
- logger_default.logAction(_this73.logger, logger_default.LOG_MAJOR, "RealtimeChannel.processMessage()", "Protocol error: unrecognised message action (" + message.action + ")");
8520
+ logger_default.logAction(_this67.logger, logger_default.LOG_MAJOR, "RealtimeChannel.processMessage()", "Protocol error: unrecognised message action (" + message.action + ")");
8607
8521
  }
8608
8522
  })();
8609
8523
  }
@@ -8759,45 +8673,9 @@ var ably = {exports: {}};
8759
8673
  }
8760
8674
  }
8761
8675
  status() {
8762
- var _this74 = this;
8763
- return _asyncToGenerator(function* () {
8764
- return _this74.client.rest.channelMixin.status(_this74);
8765
- })();
8766
- }
8767
- getMessage(serialOrMessage) {
8768
- var _this75 = this;
8769
- return _asyncToGenerator(function* () {
8770
- logger_default.logAction(_this75.logger, logger_default.LOG_MICRO, "RealtimeChannel.getMessage()", "channel = " + _this75.name);
8771
- var restMixin = _this75.client.rest.channelMixin;
8772
- return restMixin.getMessage(_this75, serialOrMessage);
8773
- })();
8774
- }
8775
- updateMessage(message, operation, params) {
8776
- var _this76 = this;
8777
- return _asyncToGenerator(function* () {
8778
- logger_default.logAction(_this76.logger, logger_default.LOG_MICRO, "RealtimeChannel.updateMessage()", "channel = " + _this76.name);
8779
- var restMixin = _this76.client.rest.channelMixin;
8780
- return restMixin.updateDeleteMessage(_this76, {
8781
- isDelete: false
8782
- }, message, operation, params);
8783
- })();
8784
- }
8785
- deleteMessage(message, operation, params) {
8786
- var _this77 = this;
8787
- return _asyncToGenerator(function* () {
8788
- logger_default.logAction(_this77.logger, logger_default.LOG_MICRO, "RealtimeChannel.deleteMessage()", "channel = " + _this77.name);
8789
- var restMixin = _this77.client.rest.channelMixin;
8790
- return restMixin.updateDeleteMessage(_this77, {
8791
- isDelete: true
8792
- }, message, operation, params);
8793
- })();
8794
- }
8795
- getMessageVersions(serialOrMessage, params) {
8796
- var _this78 = this;
8676
+ var _this68 = this;
8797
8677
  return _asyncToGenerator(function* () {
8798
- logger_default.logAction(_this78.logger, logger_default.LOG_MICRO, "RealtimeChannel.getMessageVersions()", "channel = " + _this78.name);
8799
- var restMixin = _this78.client.rest.channelMixin;
8800
- return restMixin.getMessageVersions(_this78, serialOrMessage, params);
8678
+ return _this68.client.rest.channelMixin.status(_this68);
8801
8679
  })();
8802
8680
  }
8803
8681
  };
@@ -8816,31 +8694,31 @@ var ably = {exports: {}};
8816
8694
  this.subscriptions = new eventemitter_default(this.logger);
8817
8695
  }
8818
8696
  publish(msgOrSerial, annotationValues) {
8819
- var _this79 = this;
8697
+ var _this69 = this;
8820
8698
  return _asyncToGenerator(function* () {
8821
- var channelName = _this79.channel.name;
8699
+ var channelName = _this69.channel.name;
8822
8700
  var annotation = constructValidateAnnotation(msgOrSerial, annotationValues);
8823
8701
  var wireAnnotation = yield annotation.encode();
8824
- _this79.channel.throwIfUnpublishableState();
8825
- logger_default.logAction(_this79.logger, logger_default.LOG_MICRO, "RealtimeAnnotations.publish()", "channelName = " + channelName + ", sending annotation with messageSerial = " + annotation.messageSerial + ", type = " + annotation.type);
8702
+ _this69.channel.throwIfUnpublishableState();
8703
+ logger_default.logAction(_this69.logger, logger_default.LOG_MICRO, "RealtimeAnnotations.publish()", "channelName = " + channelName + ", sending annotation with messageSerial = " + annotation.messageSerial + ", type = " + annotation.type);
8826
8704
  var pm = fromValues({
8827
8705
  action: actions.ANNOTATION,
8828
8706
  channel: channelName,
8829
8707
  annotations: [wireAnnotation]
8830
8708
  });
8831
- return _this79.channel.sendMessage(pm);
8709
+ return _this69.channel.sendMessage(pm);
8832
8710
  })();
8833
8711
  }
8834
8712
  delete(msgOrSerial, annotationValues) {
8835
- var _this80 = this;
8713
+ var _this70 = this;
8836
8714
  return _asyncToGenerator(function* () {
8837
8715
  annotationValues.action = "annotation.delete";
8838
- return _this80.publish(msgOrSerial, annotationValues);
8716
+ return _this70.publish(msgOrSerial, annotationValues);
8839
8717
  })();
8840
8718
  }
8841
8719
  subscribe() {
8842
8720
  var _arguments4 = arguments,
8843
- _this81 = this;
8721
+ _this71 = this;
8844
8722
  return _asyncToGenerator(function* () {
8845
8723
  for (var _len10 = _arguments4.length, _args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
8846
8724
  _args[_key10] = _arguments4[_key10];
@@ -8848,15 +8726,15 @@ var ably = {exports: {}};
8848
8726
  var args = realtimechannel_default.processListenerArgs(_args);
8849
8727
  var event = args[0];
8850
8728
  var listener = args[1];
8851
- var channel = _this81.channel;
8729
+ var channel = _this71.channel;
8852
8730
  if (channel.state === "failed") {
8853
8731
  throw _ErrorInfo2.fromValues(channel.invalidStateError());
8854
8732
  }
8855
- _this81.subscriptions.on(event, listener);
8856
- if (_this81.channel.channelOptions.attachOnSubscribe !== false) {
8733
+ _this71.subscriptions.on(event, listener);
8734
+ if (_this71.channel.channelOptions.attachOnSubscribe !== false) {
8857
8735
  yield channel.attach();
8858
8736
  }
8859
- if ((_this81.channel.state === "attached" && _this81.channel._mode & flags.ANNOTATION_SUBSCRIBE) === 0) {
8737
+ if ((_this71.channel.state === "attached" && _this71.channel._mode & flags.ANNOTATION_SUBSCRIBE) === 0) {
8860
8738
  throw new _ErrorInfo2("You are trying to add an annotation listener, but you haven't requested the annotation_subscribe channel mode in ChannelOptions, so this won't do anything (we only deliver annotations to clients who have explicitly requested them)", 93001, 400);
8861
8739
  }
8862
8740
  })();
@@ -8876,9 +8754,9 @@ var ably = {exports: {}};
8876
8754
  }
8877
8755
  }
8878
8756
  get(msgOrSerial, params) {
8879
- var _this82 = this;
8757
+ var _this72 = this;
8880
8758
  return _asyncToGenerator(function* () {
8881
- return restannotations_default.prototype.get.call(_this82, msgOrSerial, params);
8759
+ return restannotations_default.prototype.get.call(_this72, msgOrSerial, params);
8882
8760
  })();
8883
8761
  }
8884
8762
  };
@@ -10540,23 +10418,23 @@ var ably = {exports: {}};
10540
10418
  }
10541
10419
  }
10542
10420
  processChannelMessage(message) {
10543
- var _this83 = this;
10421
+ var _this73 = this;
10544
10422
  return _asyncToGenerator(function* () {
10545
- yield _this83.realtime.channels.processChannelMessage(message);
10423
+ yield _this73.realtime.channels.processChannelMessage(message);
10546
10424
  })();
10547
10425
  }
10548
10426
  ping() {
10549
- var _this84 = this;
10427
+ var _this74 = this;
10550
10428
  return _asyncToGenerator(function* () {
10551
10429
  var _a2;
10552
- if (_this84.state.state !== "connected") {
10430
+ if (_this74.state.state !== "connected") {
10553
10431
  throw new _ErrorInfo2("Unable to ping service; not connected", 4e4, 400);
10554
10432
  }
10555
- var transport = (_a2 = _this84.activeProtocol) == null ? void 0 : _a2.getTransport();
10433
+ var transport = (_a2 = _this74.activeProtocol) == null ? void 0 : _a2.getTransport();
10556
10434
  if (!transport) {
10557
- throw _this84.getStateError();
10435
+ throw _this74.getStateError();
10558
10436
  }
10559
- logger_default.logAction(_this84.logger, logger_default.LOG_MINOR, "ConnectionManager.ping()", "transport = " + transport);
10437
+ logger_default.logAction(_this74.logger, logger_default.LOG_MINOR, "ConnectionManager.ping()", "transport = " + transport);
10560
10438
  var pingStart = Date.now();
10561
10439
  var id = _cheapRandStr();
10562
10440
  return _withTimeoutAsync(new Promise(resolve => {
@@ -10568,7 +10446,7 @@ var ably = {exports: {}};
10568
10446
  };
10569
10447
  transport.on("heartbeat", onHeartbeat);
10570
10448
  transport.ping(id);
10571
- }), _this84.options.timeouts.realtimeRequestTimeout, "Timeout waiting for heartbeat response");
10449
+ }), _this74.options.timeouts.realtimeRequestTimeout, "Timeout waiting for heartbeat response");
10572
10450
  })();
10573
10451
  }
10574
10452
  abort(error) {
@@ -10717,10 +10595,10 @@ var ably = {exports: {}};
10717
10595
  });
10718
10596
  }
10719
10597
  ping() {
10720
- var _this85 = this;
10598
+ var _this75 = this;
10721
10599
  return _asyncToGenerator(function* () {
10722
- logger_default.logAction(_this85.logger, logger_default.LOG_MINOR, "Connection.ping()", "");
10723
- return _this85.connectionManager.ping();
10600
+ logger_default.logAction(_this75.logger, logger_default.LOG_MINOR, "Connection.ping()", "");
10601
+ return _this75.connectionManager.ping();
10724
10602
  })();
10725
10603
  }
10726
10604
  close() {
@@ -10776,9 +10654,6 @@ var ably = {exports: {}};
10776
10654
  get channels() {
10777
10655
  return this._channels;
10778
10656
  }
10779
- get clientId() {
10780
- return this.auth.clientId;
10781
- }
10782
10657
  connect() {
10783
10658
  logger_default.logAction(this.logger, logger_default.LOG_MINOR, "Realtime.connect()", "");
10784
10659
  this.connection.connect();
@@ -10819,16 +10694,16 @@ var ably = {exports: {}};
10819
10694
  }
10820
10695
  // Access to this method is synchronised by ConnectionManager#processChannelMessage.
10821
10696
  processChannelMessage(msg) {
10822
- var _this86 = this;
10697
+ var _this76 = this;
10823
10698
  return _asyncToGenerator(function* () {
10824
10699
  var channelName = msg.channel;
10825
10700
  if (channelName === void 0) {
10826
- logger_default.logAction(_this86.logger, logger_default.LOG_ERROR, "Channels.processChannelMessage()", "received event unspecified channel, action = " + msg.action);
10701
+ logger_default.logAction(_this76.logger, logger_default.LOG_ERROR, "Channels.processChannelMessage()", "received event unspecified channel, action = " + msg.action);
10827
10702
  return;
10828
10703
  }
10829
- var channel = _this86.all[channelName];
10704
+ var channel = _this76.all[channelName];
10830
10705
  if (!channel) {
10831
- logger_default.logAction(_this86.logger, logger_default.LOG_ERROR, "Channels.processChannelMessage()", "received event for non-existent channel: " + channelName);
10706
+ logger_default.logAction(_this76.logger, logger_default.LOG_ERROR, "Channels.processChannelMessage()", "received event for non-existent channel: " + channelName);
10832
10707
  return;
10833
10708
  }
10834
10709
  yield channel.processMessage(msg);
@@ -11083,43 +10958,43 @@ var ably = {exports: {}};
11083
10958
  this.pendingPresence = [];
11084
10959
  }
11085
10960
  enter(data) {
11086
- var _this87 = this;
10961
+ var _this77 = this;
11087
10962
  return _asyncToGenerator(function* () {
11088
- if (isAnonymousOrWildcard(_this87)) {
10963
+ if (isAnonymousOrWildcard(_this77)) {
11089
10964
  throw new _ErrorInfo2("clientId must be specified to enter a presence channel", 40012, 400);
11090
10965
  }
11091
- return _this87._enterOrUpdateClient(void 0, void 0, data, "enter");
10966
+ return _this77._enterOrUpdateClient(void 0, void 0, data, "enter");
11092
10967
  })();
11093
10968
  }
11094
10969
  update(data) {
11095
- var _this88 = this;
10970
+ var _this78 = this;
11096
10971
  return _asyncToGenerator(function* () {
11097
- if (isAnonymousOrWildcard(_this88)) {
10972
+ if (isAnonymousOrWildcard(_this78)) {
11098
10973
  throw new _ErrorInfo2("clientId must be specified to update presence data", 40012, 400);
11099
10974
  }
11100
- return _this88._enterOrUpdateClient(void 0, void 0, data, "update");
10975
+ return _this78._enterOrUpdateClient(void 0, void 0, data, "update");
11101
10976
  })();
11102
10977
  }
11103
10978
  enterClient(clientId, data) {
11104
- var _this89 = this;
10979
+ var _this79 = this;
11105
10980
  return _asyncToGenerator(function* () {
11106
- return _this89._enterOrUpdateClient(void 0, clientId, data, "enter");
10981
+ return _this79._enterOrUpdateClient(void 0, clientId, data, "enter");
11107
10982
  })();
11108
10983
  }
11109
10984
  updateClient(clientId, data) {
11110
- var _this90 = this;
10985
+ var _this80 = this;
11111
10986
  return _asyncToGenerator(function* () {
11112
- return _this90._enterOrUpdateClient(void 0, clientId, data, "update");
10987
+ return _this80._enterOrUpdateClient(void 0, clientId, data, "update");
11113
10988
  })();
11114
10989
  }
11115
10990
  _enterOrUpdateClient(id, clientId, data, action) {
11116
- var _this91 = this;
10991
+ var _this81 = this;
11117
10992
  return _asyncToGenerator(function* () {
11118
- var channel = _this91.channel;
10993
+ var channel = _this81.channel;
11119
10994
  if (!channel.connectionManager.activeState()) {
11120
10995
  throw channel.connectionManager.getError();
11121
10996
  }
11122
- logger_default.logAction(_this91.logger, logger_default.LOG_MICRO, "RealtimePresence." + action + "Client()", "channel = " + channel.name + ", id = " + id + ", client = " + (clientId || "(implicit) " + getClientId(_this91)));
10997
+ logger_default.logAction(_this81.logger, logger_default.LOG_MICRO, "RealtimePresence." + action + "Client()", "channel = " + channel.name + ", id = " + id + ", client = " + (clientId || "(implicit) " + getClientId(_this81)));
11123
10998
  var presence = presencemessage_default.fromData(data);
11124
10999
  presence.action = action;
11125
11000
  if (id) {
@@ -11137,7 +11012,7 @@ var ably = {exports: {}};
11137
11012
  channel.attach();
11138
11013
  case "attaching":
11139
11014
  return new Promise((resolve, reject) => {
11140
- _this91.pendingPresence.push({
11015
+ _this81.pendingPresence.push({
11141
11016
  presence: wirePresMsg,
11142
11017
  callback: err => err ? reject(err) : resolve()
11143
11018
  });
@@ -11152,22 +11027,22 @@ var ably = {exports: {}};
11152
11027
  })();
11153
11028
  }
11154
11029
  leave(data) {
11155
- var _this92 = this;
11030
+ var _this82 = this;
11156
11031
  return _asyncToGenerator(function* () {
11157
- if (isAnonymousOrWildcard(_this92)) {
11032
+ if (isAnonymousOrWildcard(_this82)) {
11158
11033
  throw new _ErrorInfo2("clientId must have been specified to enter or leave a presence channel", 40012, 400);
11159
11034
  }
11160
- return _this92.leaveClient(void 0, data);
11035
+ return _this82.leaveClient(void 0, data);
11161
11036
  })();
11162
11037
  }
11163
11038
  leaveClient(clientId, data) {
11164
- var _this93 = this;
11039
+ var _this83 = this;
11165
11040
  return _asyncToGenerator(function* () {
11166
- var channel = _this93.channel;
11041
+ var channel = _this83.channel;
11167
11042
  if (!channel.connectionManager.activeState()) {
11168
11043
  throw channel.connectionManager.getError();
11169
11044
  }
11170
- logger_default.logAction(_this93.logger, logger_default.LOG_MICRO, "RealtimePresence.leaveClient()", "leaving; channel = " + _this93.channel.name + ", client = " + clientId);
11045
+ logger_default.logAction(_this83.logger, logger_default.LOG_MICRO, "RealtimePresence.leaveClient()", "leaving; channel = " + _this83.channel.name + ", client = " + clientId);
11171
11046
  var presence = presencemessage_default.fromData(data);
11172
11047
  presence.action = "leave";
11173
11048
  if (clientId) {
@@ -11179,7 +11054,7 @@ var ably = {exports: {}};
11179
11054
  return channel.sendPresence([wirePresMsg]);
11180
11055
  case "attaching":
11181
11056
  return new Promise((resolve, reject) => {
11182
- _this93.pendingPresence.push({
11057
+ _this83.pendingPresence.push({
11183
11058
  presence: wirePresMsg,
11184
11059
  callback: err => err ? reject(err) : resolve()
11185
11060
  });
@@ -11195,14 +11070,14 @@ var ably = {exports: {}};
11195
11070
  })();
11196
11071
  }
11197
11072
  get(params) {
11198
- var _this94 = this;
11073
+ var _this84 = this;
11199
11074
  return _asyncToGenerator(function* () {
11200
11075
  var waitForSync = !params || ("waitForSync" in params ? params.waitForSync : true);
11201
11076
  return new Promise((resolve, reject) => {
11202
11077
  function returnMembers(members) {
11203
11078
  resolve(params ? members.list(params) : members.values());
11204
11079
  }
11205
- if (_this94.channel.state === "suspended") {
11080
+ if (_this84.channel.state === "suspended") {
11206
11081
  if (waitForSync) {
11207
11082
  reject(_ErrorInfo2.fromValues({
11208
11083
  statusCode: 400,
@@ -11210,12 +11085,12 @@ var ably = {exports: {}};
11210
11085
  message: "Presence state is out of sync due to channel being in the SUSPENDED state"
11211
11086
  }));
11212
11087
  } else {
11213
- returnMembers(_this94.members);
11088
+ returnMembers(_this84.members);
11214
11089
  }
11215
11090
  return;
11216
11091
  }
11217
- waitAttached(_this94.channel, err => reject(err), () => {
11218
- var members = _this94.members;
11092
+ waitAttached(_this84.channel, err => reject(err), () => {
11093
+ var members = _this84.members;
11219
11094
  if (waitForSync) {
11220
11095
  members.waitSync(function () {
11221
11096
  returnMembers(members);
@@ -11228,19 +11103,19 @@ var ably = {exports: {}};
11228
11103
  })();
11229
11104
  }
11230
11105
  history(params) {
11231
- var _this95 = this;
11106
+ var _this85 = this;
11232
11107
  return _asyncToGenerator(function* () {
11233
- logger_default.logAction(_this95.logger, logger_default.LOG_MICRO, "RealtimePresence.history()", "channel = " + _this95.name);
11234
- var restMixin = _this95.channel.client.rest.presenceMixin;
11108
+ logger_default.logAction(_this85.logger, logger_default.LOG_MICRO, "RealtimePresence.history()", "channel = " + _this85.name);
11109
+ var restMixin = _this85.channel.client.rest.presenceMixin;
11235
11110
  if (params && params.untilAttach) {
11236
- if (_this95.channel.state === "attached") {
11111
+ if (_this85.channel.state === "attached") {
11237
11112
  delete params.untilAttach;
11238
- params.from_serial = _this95.channel.properties.attachSerial;
11113
+ params.from_serial = _this85.channel.properties.attachSerial;
11239
11114
  } else {
11240
- throw new _ErrorInfo2("option untilAttach requires the channel to be attached, was: " + _this95.channel.state, 4e4, 400);
11115
+ throw new _ErrorInfo2("option untilAttach requires the channel to be attached, was: " + _this85.channel.state, 4e4, 400);
11241
11116
  }
11242
11117
  }
11243
- return restMixin.history(_this95, params);
11118
+ return restMixin.history(_this85, params);
11244
11119
  })();
11245
11120
  }
11246
11121
  setPresence(presenceSet, isSync, syncChannelSerial) {
@@ -11368,7 +11243,7 @@ var ably = {exports: {}};
11368
11243
  }
11369
11244
  subscribe() {
11370
11245
  var _arguments5 = arguments,
11371
- _this96 = this;
11246
+ _this86 = this;
11372
11247
  return _asyncToGenerator(function* () {
11373
11248
  for (var _len12 = _arguments5.length, _args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
11374
11249
  _args[_key12] = _arguments5[_key12];
@@ -11376,11 +11251,11 @@ var ably = {exports: {}};
11376
11251
  var args = realtimechannel_default.processListenerArgs(_args);
11377
11252
  var event = args[0];
11378
11253
  var listener = args[1];
11379
- var channel = _this96.channel;
11254
+ var channel = _this86.channel;
11380
11255
  if (channel.state === "failed") {
11381
11256
  throw _ErrorInfo2.fromValues(channel.invalidStateError());
11382
11257
  }
11383
- _this96.subscriptions.on(event, listener);
11258
+ _this86.subscriptions.on(event, listener);
11384
11259
  if (channel.channelOptions.attachOnSubscribe !== false) {
11385
11260
  yield channel.attach();
11386
11261
  }
@@ -11552,8 +11427,8 @@ var ably = {exports: {}};
11552
11427
  isRef: !!((_f = (_e = m.extras) == null ? void 0 : _e.ref) == null ? void 0 : _f.timeserial),
11553
11428
  clientId: m.clientId
11554
11429
  };
11555
- if (Object.entries(filter).find(_ref12 => {
11556
- var [key, value] = _ref12;
11430
+ if (Object.entries(filter).find(_ref10 => {
11431
+ var [key, value] = _ref10;
11557
11432
  return value !== void 0 ? mapping[key] !== value : false;
11558
11433
  })) {
11559
11434
  return;
@@ -11581,8 +11456,8 @@ var ably = {exports: {}};
11581
11456
  return [];
11582
11457
  }
11583
11458
  if (!realListener && filter) {
11584
- return Array.from(channel.filteredSubscriptions.entries()).map(_ref13 => {
11585
- var [key, filterMaps] = _ref13;
11459
+ return Array.from(channel.filteredSubscriptions.entries()).map(_ref11 => {
11460
+ var [key, filterMaps] = _ref11;
11586
11461
  var _a2;
11587
11462
  var listenerMaps = filterMaps.get(filter);
11588
11463
  filterMaps.delete(filter);
@@ -12054,38 +11929,38 @@ var ably = {exports: {}};
12054
11929
  return output;
12055
11930
  }
12056
11931
  encrypt(plaintext) {
12057
- var _this97 = this;
11932
+ var _this87 = this;
12058
11933
  return _asyncToGenerator(function* () {
12059
- logger_default.logAction(_this97.logger, logger_default.LOG_MICRO, "CBCCipher.encrypt()", "");
12060
- var iv = yield _this97.getIv();
12061
- var cryptoKey = yield crypto.subtle.importKey("raw", _this97.key, _this97.webCryptoAlgorithm, false, ["encrypt"]);
11934
+ logger_default.logAction(_this87.logger, logger_default.LOG_MICRO, "CBCCipher.encrypt()", "");
11935
+ var iv = yield _this87.getIv();
11936
+ var cryptoKey = yield crypto.subtle.importKey("raw", _this87.key, _this87.webCryptoAlgorithm, false, ["encrypt"]);
12062
11937
  var ciphertext = yield crypto.subtle.encrypt({
12063
- name: _this97.webCryptoAlgorithm,
11938
+ name: _this87.webCryptoAlgorithm,
12064
11939
  iv
12065
11940
  }, cryptoKey, plaintext);
12066
- return _this97.concat(iv, ciphertext);
11941
+ return _this87.concat(iv, ciphertext);
12067
11942
  })();
12068
11943
  }
12069
11944
  decrypt(ciphertext) {
12070
- var _this98 = this;
11945
+ var _this88 = this;
12071
11946
  return _asyncToGenerator(function* () {
12072
- logger_default.logAction(_this98.logger, logger_default.LOG_MICRO, "CBCCipher.decrypt()", "");
11947
+ logger_default.logAction(_this88.logger, logger_default.LOG_MICRO, "CBCCipher.decrypt()", "");
12073
11948
  var ciphertextArrayBuffer = bufferUtils.toArrayBuffer(ciphertext);
12074
11949
  var iv = ciphertextArrayBuffer.slice(0, DEFAULT_BLOCKLENGTH);
12075
11950
  var ciphertextBody = ciphertextArrayBuffer.slice(DEFAULT_BLOCKLENGTH);
12076
- var cryptoKey = yield crypto.subtle.importKey("raw", _this98.key, _this98.webCryptoAlgorithm, false, ["decrypt"]);
11951
+ var cryptoKey = yield crypto.subtle.importKey("raw", _this88.key, _this88.webCryptoAlgorithm, false, ["decrypt"]);
12077
11952
  return crypto.subtle.decrypt({
12078
- name: _this98.webCryptoAlgorithm,
11953
+ name: _this88.webCryptoAlgorithm,
12079
11954
  iv
12080
11955
  }, cryptoKey, ciphertextBody);
12081
11956
  })();
12082
11957
  }
12083
11958
  getIv() {
12084
- var _this99 = this;
11959
+ var _this89 = this;
12085
11960
  return _asyncToGenerator(function* () {
12086
- if (_this99.iv) {
12087
- var iv = _this99.iv;
12088
- _this99.iv = null;
11961
+ if (_this89.iv) {
11962
+ var iv = _this89.iv;
11963
+ _this89.iv = null;
12089
11964
  return iv;
12090
11965
  }
12091
11966
  var randomBlock = yield config.getRandomArrayBuffer(DEFAULT_BLOCKLENGTH);
@@ -12132,7 +12007,7 @@ var ably = {exports: {}};
12132
12007
  if (Platform.Config.xhrSupported && xhrRequestImplementation) {
12133
12008
  this.supportsAuthHeaders = true;
12134
12009
  this.Request = /*#__PURE__*/function () {
12135
- var _ref14 = _asyncToGenerator(function* (method, uri, headers, params, body) {
12010
+ var _ref12 = _asyncToGenerator(function* (method, uri, headers, params, body) {
12136
12011
  return new Promise(resolve => {
12137
12012
  var _a3;
12138
12013
  var req = xhrRequestImplementation.createRequest(uri, headers, params, body, XHRStates_default.REQ_SEND, (_a3 = client && client.options.timeouts) != null ? _a3 : null, this.logger, method);
@@ -12146,8 +12021,8 @@ var ably = {exports: {}};
12146
12021
  req.exec();
12147
12022
  });
12148
12023
  });
12149
- return function (_x88, _x89, _x90, _x91, _x92) {
12150
- return _ref14.apply(this, arguments);
12024
+ return function (_x82, _x83, _x84, _x85, _x86) {
12025
+ return _ref12.apply(this, arguments);
12151
12026
  };
12152
12027
  }();
12153
12028
  if (client == null ? void 0 : client.options.disableConnectivityCheck) {
@@ -12172,11 +12047,11 @@ var ably = {exports: {}};
12172
12047
  } else if (Platform.Config.fetchSupported && fetchRequestImplementation) {
12173
12048
  this.supportsAuthHeaders = true;
12174
12049
  this.Request = /*#__PURE__*/function () {
12175
- var _ref17 = _asyncToGenerator(function* (method, uri, headers, params, body) {
12050
+ var _ref15 = _asyncToGenerator(function* (method, uri, headers, params, body) {
12176
12051
  return fetchRequestImplementation(method, client != null ? client : null, uri, headers, params, body);
12177
12052
  });
12178
- return function (_x93, _x94, _x95, _x96, _x97) {
12179
- return _ref17.apply(this, arguments);
12053
+ return function (_x87, _x88, _x89, _x90, _x91) {
12054
+ return _ref15.apply(this, arguments);
12180
12055
  };
12181
12056
  }();
12182
12057
  if (client == null ? void 0 : client.options.disableConnectivityCheck) {
@@ -12207,14 +12082,14 @@ var ably = {exports: {}};
12207
12082
  return (_b = (_a2 = this.client) == null ? void 0 : _a2.logger) != null ? _b : logger_default.defaultLogger;
12208
12083
  }
12209
12084
  doUri(method, uri, headers, body, params) {
12210
- var _this100 = this;
12085
+ var _this90 = this;
12211
12086
  return _asyncToGenerator(function* () {
12212
- if (!_this100.Request) {
12087
+ if (!_this90.Request) {
12213
12088
  return {
12214
12089
  error: new PartialErrorInfo("Request invoked before assigned to", null, 500)
12215
12090
  };
12216
12091
  }
12217
- return _this100.Request(method, uri, headers, params, body);
12092
+ return _this90.Request(method, uri, headers, params, body);
12218
12093
  })();
12219
12094
  }
12220
12095
  shouldFallback(errorInfo) {
@@ -12344,7 +12219,7 @@ var ably = {exports: {}};
12344
12219
  globalObject4.crypto.getRandomValues(byteArray);
12345
12220
  return byteArray.buffer;
12346
12221
  });
12347
- function getRandomArrayBuffer(_x98) {
12222
+ function getRandomArrayBuffer(_x92) {
12348
12223
  return _getRandomArrayBuffer.apply(this, arguments);
12349
12224
  }
12350
12225
  return getRandomArrayBuffer;
@@ -13489,7 +13364,7 @@ var ably = {exports: {}};
13489
13364
  });
13490
13365
  return result;
13491
13366
  }
13492
- function fetchRequest(_x99, _x100, _x101, _x102, _x103, _x104) {
13367
+ function fetchRequest(_x93, _x94, _x95, _x96, _x97, _x98) {
13493
13368
  return _fetchRequest.apply(this, arguments);
13494
13369
  } // src/platform/web/lib/http/request/index.ts
13495
13370
  function _fetchRequest() {
@@ -13620,7 +13495,7 @@ var ably = {exports: {}};
13620
13495
  })(ably);
13621
13496
 
13622
13497
  class ClientAblyService {
13623
- static startConnection(sessionId, ablyToken, onMessageReceived, tenantId) {
13498
+ static startConnection(sessionId, ablyToken, onMessageReceived, tenantId, onActionReceived) {
13624
13499
  var _this = this;
13625
13500
  return _asyncToGenerator(function* () {
13626
13501
  // Prevent multiple connections
@@ -13684,6 +13559,8 @@ class ClientAblyService {
13684
13559
  }
13685
13560
  }, 10000);
13686
13561
  });
13562
+ // Store optional action handler for this connection
13563
+ _this.onActionReceived = onActionReceived !== null && onActionReceived !== void 0 ? onActionReceived : null;
13687
13564
  // Subscribe to the session room
13688
13565
  yield _this.joinChannel(sessionId, onMessageReceived, tenantId);
13689
13566
  } catch (error) {
@@ -13719,13 +13596,15 @@ class ClientAblyService {
13719
13596
  });
13720
13597
  // Subscribe to assistant/system responses
13721
13598
  _this2.channel.subscribe('ReceiveMessage', message => {
13722
- var _a, _b, _c, _d, _e, _f, _g, _h;
13599
+ var _a, _b;
13723
13600
  try {
13724
13601
  // Ensure messageContent is always a string (default to empty string if undefined)
13725
- var messageContent = typeof message.data === 'string' ? message.data : (_d = (_b = (_a = message.data) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : (_c = message.data) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : '';
13726
- var senderType = ((_e = message.data) === null || _e === void 0 ? void 0 : _e.senderType) || 3; // Assistant
13727
- var needsAgent = ((_f = message.data) === null || _f === void 0 ? void 0 : _f.needsAgent) || ((_g = message.data) === null || _g === void 0 ? void 0 : _g.actionType) == 'needs_agent' || false;
13728
- var attachments = ((_h = message.data) === null || _h === void 0 ? void 0 : _h.attachments) || [];
13602
+ var rawData = message.data;
13603
+ var messageContent = typeof rawData === 'string' ? rawData : (_b = (_a = rawData === null || rawData === void 0 ? void 0 : rawData.content) !== null && _a !== void 0 ? _a : rawData === null || rawData === void 0 ? void 0 : rawData.message) !== null && _b !== void 0 ? _b : '';
13604
+ var senderType = (rawData === null || rawData === void 0 ? void 0 : rawData.senderType) || 3; // Assistant
13605
+ var needsAgent = (rawData === null || rawData === void 0 ? void 0 : rawData.needsAgent) || (rawData === null || rawData === void 0 ? void 0 : rawData.actionType) == 'needs_agent' || false;
13606
+ var attachments = (rawData === null || rawData === void 0 ? void 0 : rawData.attachments) || [];
13607
+ var actionType = rawData && typeof rawData.actionType === 'string' ? rawData.actionType : '';
13729
13608
  // Extract downloadUrl from attachments (Ably now returns downloadUrl directly)
13730
13609
  // Attachments can be: strings (URLs), objects with downloadUrl, or objects with id
13731
13610
  var attachmentUrls = attachments.map(attachment => {
@@ -13742,6 +13621,18 @@ class ClientAblyService {
13742
13621
  // If it's an object with id, we'll need to keep it for backward compatibility
13743
13622
  return null;
13744
13623
  }).filter(url => url !== null);
13624
+ // Invoke optional action handler first (non-blocking for message processing)
13625
+ if (_this2.onActionReceived && actionType !== undefined) {
13626
+ try {
13627
+ void _this2.onActionReceived(actionType, rawData);
13628
+ } catch (actionError) {
13629
+ console.error('[AblyService] Error in action handler callback', {
13630
+ error: actionError,
13631
+ actionType,
13632
+ rawData
13633
+ });
13634
+ }
13635
+ }
13745
13636
  onMessageReceived(messageContent, senderType, needsAgent, attachmentUrls);
13746
13637
  } catch (error) {
13747
13638
  console.error('[AblyService] Error processing message', {
@@ -13776,6 +13667,7 @@ class ClientAblyService {
13776
13667
  }
13777
13668
  _this3.isConnected = false;
13778
13669
  _this3.sessionId = null;
13670
+ _this3.onActionReceived = null;
13779
13671
  } catch (error) {
13780
13672
  console.error('[AblyService] Error in stopConnection', {
13781
13673
  error
@@ -13825,6 +13717,7 @@ ClientAblyService.channel = null;
13825
13717
  ClientAblyService.isConnected = false;
13826
13718
  ClientAblyService.sessionId = null;
13827
13719
  ClientAblyService.messageUnsubscribe = null;
13720
+ ClientAblyService.onActionReceived = null;
13828
13721
 
13829
13722
  class TokenService {
13830
13723
  constructor(baseUrl) {