@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.
@@ -4351,7 +4351,7 @@ var ably = {exports: {}};
4351
4351
  });
4352
4352
  return _withTimeoutAsync2.apply(this, arguments);
4353
4353
  }
4354
- var version = "2.15.0";
4354
+ var version = "2.13.0";
4355
4355
 
4356
4356
  // src/common/lib/util/defaults.ts
4357
4357
  var agent = "ably-js/" + version;
@@ -4599,10 +4599,10 @@ var ably = {exports: {}};
4599
4599
  };
4600
4600
  function defaultGetHeaders(options) {
4601
4601
  var {
4602
- format,
4602
+ format = defaultHeadersOptions.format,
4603
4603
  protocolVersion = defaultHeadersOptions.protocolVersion
4604
4604
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4605
- var accept = contentTypes[format != null ? format : options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */];
4605
+ var accept = contentTypes[format];
4606
4606
  return {
4607
4607
  accept,
4608
4608
  "X-Ably-Version": protocolVersion.toString(),
@@ -4611,11 +4611,11 @@ var ably = {exports: {}};
4611
4611
  }
4612
4612
  function defaultPostHeaders(options) {
4613
4613
  var {
4614
- format,
4614
+ format = defaultHeadersOptions.format,
4615
4615
  protocolVersion = defaultHeadersOptions.protocolVersion
4616
4616
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4617
- var accept = contentTypes[format != null ? format : options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */];
4618
- var contentType = accept;
4617
+ var contentType;
4618
+ var accept = contentType = contentTypes[format];
4619
4619
  return {
4620
4620
  accept,
4621
4621
  "content-type": contentType,
@@ -4939,9 +4939,7 @@ var ably = {exports: {}};
4939
4939
  tokenUri = function tokenUri(host) {
4940
4940
  return client.baseUri(host) + path;
4941
4941
  };
4942
- var requestHeaders = defaults_default.defaultPostHeaders(_this3.client.options, {
4943
- format: "json" /* json */
4944
- });
4942
+ var requestHeaders = defaults_default.defaultPostHeaders(_this3.client.options);
4945
4943
  if (resolvedAuthOptions.requestHeaders) _mixin(requestHeaders, resolvedAuthOptions.requestHeaders);
4946
4944
  logger_default.logAction(_this3.logger, logger_default.LOG_MICRO, "Auth.requestToken().requestToken", "Sending POST to " + path + "; Token params: " + JSON.stringify(signedTokenParams));
4947
4945
  _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));
@@ -6633,7 +6631,9 @@ var ably = {exports: {}};
6633
6631
  return _asyncToGenerator(function* () {
6634
6632
  var client = _this26.client;
6635
6633
  var format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6636
- headers = defaults_default.defaultPostHeaders(client.options),
6634
+ headers = defaults_default.defaultPostHeaders(client.options, {
6635
+ format
6636
+ }),
6637
6637
  params = {};
6638
6638
  var body = _mixin({
6639
6639
  recipient
@@ -6657,7 +6657,9 @@ var ably = {exports: {}};
6657
6657
  var client = _this27.client;
6658
6658
  var body = devicedetails_default.fromValues(device);
6659
6659
  var format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6660
- headers = defaults_default.defaultPostHeaders(client.options),
6660
+ headers = defaults_default.defaultPostHeaders(client.options, {
6661
+ format
6662
+ }),
6661
6663
  params = {};
6662
6664
  _mixin(headers, client.options.headers);
6663
6665
  if (client.options.pushFullWait) _mixin(params, {
@@ -6673,7 +6675,9 @@ var ably = {exports: {}};
6673
6675
  return _asyncToGenerator(function* () {
6674
6676
  var client = _this28.client,
6675
6677
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6676
- headers = defaults_default.defaultGetHeaders(client.options),
6678
+ headers = defaults_default.defaultGetHeaders(client.options, {
6679
+ format
6680
+ }),
6677
6681
  deviceId = deviceIdOrDetails.id || deviceIdOrDetails;
6678
6682
  if (typeof deviceId !== "string" || !deviceId.length) {
6679
6683
  throw new _ErrorInfo2("First argument to DeviceRegistrations#get must be a deviceId string or DeviceDetails", 4e4, 400);
@@ -6689,7 +6693,9 @@ var ably = {exports: {}};
6689
6693
  var client = _this29.client,
6690
6694
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6691
6695
  envelope = _this29.client.http.supportsLinkHeaders ? void 0 : format,
6692
- headers = defaults_default.defaultGetHeaders(client.options);
6696
+ headers = defaults_default.defaultGetHeaders(client.options, {
6697
+ format
6698
+ });
6693
6699
  _mixin(headers, client.options.headers);
6694
6700
  return new paginatedresource_default(client, "/push/deviceRegistrations", headers, envelope, /*#__PURE__*/function () {
6695
6701
  var _ref3 = _asyncToGenerator(function* (body, headers2, unpacked) {
@@ -6705,7 +6711,10 @@ var ably = {exports: {}};
6705
6711
  var _this30 = this;
6706
6712
  return _asyncToGenerator(function* () {
6707
6713
  var client = _this30.client,
6708
- headers = defaults_default.defaultGetHeaders(client.options),
6714
+ format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6715
+ headers = defaults_default.defaultGetHeaders(client.options, {
6716
+ format
6717
+ }),
6709
6718
  params = {},
6710
6719
  deviceId = deviceIdOrDetails.id || deviceIdOrDetails;
6711
6720
  if (typeof deviceId !== "string" || !deviceId.length) {
@@ -6746,7 +6755,9 @@ var ably = {exports: {}};
6746
6755
  var client = _this32.client;
6747
6756
  var body = pushchannelsubscription_default.fromValues(subscription);
6748
6757
  var format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6749
- headers = defaults_default.defaultPostHeaders(client.options),
6758
+ headers = defaults_default.defaultPostHeaders(client.options, {
6759
+ format
6760
+ }),
6750
6761
  params = {};
6751
6762
  _mixin(headers, client.options.headers);
6752
6763
  if (client.options.pushFullWait) _mixin(params, {
@@ -6763,7 +6774,9 @@ var ably = {exports: {}};
6763
6774
  var client = _this33.client,
6764
6775
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6765
6776
  envelope = _this33.client.http.supportsLinkHeaders ? void 0 : format,
6766
- headers = defaults_default.defaultGetHeaders(client.options);
6777
+ headers = defaults_default.defaultGetHeaders(client.options, {
6778
+ format
6779
+ });
6767
6780
  _mixin(headers, client.options.headers);
6768
6781
  return new paginatedresource_default(client, "/push/channelSubscriptions", headers, envelope, /*#__PURE__*/function () {
6769
6782
  var _ref4 = _asyncToGenerator(function* (body, headers2, unpacked) {
@@ -6796,7 +6809,9 @@ var ably = {exports: {}};
6796
6809
  var client = _this35.client,
6797
6810
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6798
6811
  envelope = _this35.client.http.supportsLinkHeaders ? void 0 : format,
6799
- headers = defaults_default.defaultGetHeaders(client.options);
6812
+ headers = defaults_default.defaultGetHeaders(client.options, {
6813
+ format
6814
+ });
6800
6815
  _mixin(headers, client.options.headers);
6801
6816
  if (client.options.pushFullWait) _mixin(params, {
6802
6817
  fullWait: "true"
@@ -6959,7 +6974,9 @@ var ably = {exports: {}};
6959
6974
  var client = _this38.channel.client,
6960
6975
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
6961
6976
  envelope = _this38.channel.client.http.supportsLinkHeaders ? void 0 : format,
6962
- headers = defaults_default.defaultGetHeaders(client.options);
6977
+ headers = defaults_default.defaultGetHeaders(client.options, {
6978
+ format
6979
+ });
6963
6980
  _mixin(headers, client.options.headers);
6964
6981
  return new paginatedresource_default(client, _this38.channel.client.rest.presenceMixin.basePath(_this38), headers, envelope, /*#__PURE__*/function () {
6965
6982
  var _ref6 = _asyncToGenerator(function* (body, headers2, unpacked) {
@@ -7083,21 +7100,6 @@ var ably = {exports: {}};
7083
7100
  } else if (!this.annotations.summary) {
7084
7101
  this.annotations.summary = {};
7085
7102
  }
7086
- if (this.annotations && this.annotations.summary) {
7087
- for (var [type, summaryEntry] of Object.entries(this.annotations.summary)) {
7088
- if (type.endsWith(":distinct.v1") || type.endsWith(":unique.v1") || type.endsWith(":multiple.v1")) {
7089
- for (var [, entry] of Object.entries(summaryEntry)) {
7090
- if (!entry.clipped) {
7091
- entry.clipped = false;
7092
- }
7093
- }
7094
- } else if (type.endsWith(":flag.v1")) {
7095
- if (!summaryEntry.clipped) {
7096
- summaryEntry.clipped = false;
7097
- }
7098
- }
7099
- }
7100
- }
7101
7103
  }
7102
7104
  encode(options) {
7103
7105
  var _this40 = this;
@@ -7247,7 +7249,9 @@ var ably = {exports: {}};
7247
7249
  options = client.options,
7248
7250
  format = options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7249
7251
  idempotentRestPublishing = client.options.idempotentRestPublishing,
7250
- headers = defaults_default.defaultPostHeaders(client.options);
7252
+ headers = defaults_default.defaultPostHeaders(client.options, {
7253
+ format
7254
+ });
7251
7255
  _mixin(headers, options.headers);
7252
7256
  if (idempotentRestPublishing && allEmptyIds(messages)) {
7253
7257
  var msgIdBase = yield _randomString(MSG_ID_ENTROPY_BYTES);
@@ -7276,38 +7280,6 @@ var ably = {exports: {}};
7276
7280
  return _this46.client.rest.channelMixin.status(_this46);
7277
7281
  })();
7278
7282
  }
7279
- getMessage(serialOrMessage) {
7280
- var _this47 = this;
7281
- return _asyncToGenerator(function* () {
7282
- logger_default.logAction(_this47.logger, logger_default.LOG_MICRO, "RestChannel.getMessage()", "channel = " + _this47.name);
7283
- return _this47.client.rest.channelMixin.getMessage(_this47, serialOrMessage);
7284
- })();
7285
- }
7286
- updateMessage(message, operation, params) {
7287
- var _this48 = this;
7288
- return _asyncToGenerator(function* () {
7289
- logger_default.logAction(_this48.logger, logger_default.LOG_MICRO, "RestChannel.updateMessage()", "channel = " + _this48.name);
7290
- return _this48.client.rest.channelMixin.updateDeleteMessage(_this48, {
7291
- isDelete: false
7292
- }, message, operation, params);
7293
- })();
7294
- }
7295
- deleteMessage(message, operation, params) {
7296
- var _this49 = this;
7297
- return _asyncToGenerator(function* () {
7298
- logger_default.logAction(_this49.logger, logger_default.LOG_MICRO, "RestChannel.deleteMessage()", "channel = " + _this49.name);
7299
- return _this49.client.rest.channelMixin.updateDeleteMessage(_this49, {
7300
- isDelete: true
7301
- }, message, operation, params);
7302
- })();
7303
- }
7304
- getMessageVersions(serialOrMessage, params) {
7305
- var _this50 = this;
7306
- return _asyncToGenerator(function* () {
7307
- logger_default.logAction(_this50.logger, logger_default.LOG_MICRO, "RestChannel.getMessageVersions()", "channel = " + _this50.name);
7308
- return _this50.client.rest.channelMixin.getMessageVersions(_this50, serialOrMessage, params);
7309
- })();
7310
- }
7311
7283
  };
7312
7284
  var restchannel_default = RestChannel;
7313
7285
 
@@ -7336,7 +7308,9 @@ var ably = {exports: {}};
7336
7308
  var client = channel.client,
7337
7309
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7338
7310
  envelope = channel.client.http.supportsLinkHeaders ? void 0 : format,
7339
- headers = defaults_default.defaultGetHeaders(client.options);
7311
+ headers = defaults_default.defaultGetHeaders(client.options, {
7312
+ format
7313
+ });
7340
7314
  _mixin(headers, client.options.headers);
7341
7315
  return new paginatedresource_default(client, this.basePath(channel) + "/messages", headers, envelope, /*#__PURE__*/function () {
7342
7316
  var _ref7 = _asyncToGenerator(function* (body, headers2, unpacked) {
@@ -7349,81 +7323,16 @@ var ably = {exports: {}};
7349
7323
  }()).get(params);
7350
7324
  }
7351
7325
  static status(channel) {
7352
- var _this51 = this;
7326
+ var _this47 = this;
7353
7327
  return _asyncToGenerator(function* () {
7354
7328
  var format = channel.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */;
7355
- var headers = defaults_default.defaultPostHeaders(channel.client.options);
7356
- var response = yield resource_default.get(channel.client, _this51.basePath(channel), headers, {}, format, true);
7329
+ var headers = defaults_default.defaultPostHeaders(channel.client.options, {
7330
+ format
7331
+ });
7332
+ var response = yield resource_default.get(channel.client, _this47.basePath(channel), headers, {}, format, true);
7357
7333
  return response.body;
7358
7334
  })();
7359
7335
  }
7360
- static getMessage(channel, serialOrMessage) {
7361
- var _this52 = this;
7362
- return _asyncToGenerator(function* () {
7363
- var serial = typeof serialOrMessage === "string" ? serialOrMessage : serialOrMessage.serial;
7364
- if (!serial) {
7365
- 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);
7366
- }
7367
- var client = channel.client;
7368
- var format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */;
7369
- var headers = defaults_default.defaultGetHeaders(client.options);
7370
- _mixin(headers, client.options.headers);
7371
- var {
7372
- body,
7373
- unpacked
7374
- } = yield resource_default.get(client, _this52.basePath(channel) + "/messages/" + encodeURIComponent(serial), headers, {}, null, true);
7375
- var decoded = unpacked ? body : _decodeBody(body, client._MsgPack, format);
7376
- return _fromEncoded2(decoded, channel);
7377
- })();
7378
- }
7379
- static updateDeleteMessage(channel, opts, message, operation, params) {
7380
- var _this53 = this;
7381
- return _asyncToGenerator(function* () {
7382
- if (!message.serial) {
7383
- 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);
7384
- }
7385
- var client = channel.client;
7386
- var format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */;
7387
- var headers = defaults_default.defaultPostHeaders(client.options);
7388
- _mixin(headers, client.options.headers);
7389
- var encoded = null;
7390
- if (message.data !== void 0) {
7391
- encoded = yield message_default.fromValues(message).encode(channel.channelOptions);
7392
- }
7393
- var req = {
7394
- serial: message.serial,
7395
- operation,
7396
- name: message.name,
7397
- data: encoded && encoded.data,
7398
- encoding: encoded && encoded.encoding,
7399
- extras: message.extras
7400
- };
7401
- var requestBody = serialize(req, client._MsgPack, format);
7402
- var method = opts.isDelete ? resource_default.post : resource_default.patch;
7403
- var pathSuffix = opts.isDelete ? "/delete" : "";
7404
- yield method(client, _this53.basePath(channel) + "/messages/" + encodeURIComponent(message.serial) + pathSuffix, requestBody, headers, params || {}, null, true);
7405
- })();
7406
- }
7407
- static getMessageVersions(channel, serialOrMessage, params) {
7408
- var serial = typeof serialOrMessage === "string" ? serialOrMessage : serialOrMessage.serial;
7409
- if (!serial) {
7410
- 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);
7411
- }
7412
- var client = channel.client;
7413
- var format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */;
7414
- var envelope = channel.client.http.supportsLinkHeaders ? void 0 : format;
7415
- var headers = defaults_default.defaultGetHeaders(client.options);
7416
- _mixin(headers, client.options.headers);
7417
- return new paginatedresource_default(client, this.basePath(channel) + "/messages/" + encodeURIComponent(serial) + "/versions", headers, envelope, /*#__PURE__*/function () {
7418
- var _ref8 = _asyncToGenerator(function* (body, headers2, unpacked) {
7419
- var decoded = unpacked ? body : _decodeBody(body, client._MsgPack, format);
7420
- return _fromEncodedArray2(decoded, channel);
7421
- });
7422
- return function (_x62, _x63, _x64) {
7423
- return _ref8.apply(this, arguments);
7424
- };
7425
- }()).get(params || {});
7426
- }
7427
7336
  };
7428
7337
 
7429
7338
  // src/common/lib/client/restpresencemixin.ts
@@ -7432,20 +7341,22 @@ var ably = {exports: {}};
7432
7341
  return RestChannelMixin.basePath(presence.channel) + "/presence";
7433
7342
  }
7434
7343
  static history(presence, params) {
7435
- var _this54 = this;
7344
+ var _this48 = this;
7436
7345
  return _asyncToGenerator(function* () {
7437
7346
  var client = presence.channel.client,
7438
7347
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7439
7348
  envelope = presence.channel.client.http.supportsLinkHeaders ? void 0 : format,
7440
- headers = defaults_default.defaultGetHeaders(client.options);
7349
+ headers = defaults_default.defaultGetHeaders(client.options, {
7350
+ format
7351
+ });
7441
7352
  _mixin(headers, client.options.headers);
7442
- return new paginatedresource_default(client, _this54.basePath(presence) + "/history", headers, envelope, /*#__PURE__*/function () {
7443
- var _ref9 = _asyncToGenerator(function* (body, headers2, unpacked) {
7353
+ return new paginatedresource_default(client, _this48.basePath(presence) + "/history", headers, envelope, /*#__PURE__*/function () {
7354
+ var _ref8 = _asyncToGenerator(function* (body, headers2, unpacked) {
7444
7355
  var decoded = unpacked ? body : _decodeBody(body, client._MsgPack, format);
7445
7356
  return _fromEncodedArray(decoded, presence.channel);
7446
7357
  });
7447
- return function (_x65, _x66, _x67) {
7448
- return _ref9.apply(this, arguments);
7358
+ return function (_x62, _x63, _x64) {
7359
+ return _ref8.apply(this, arguments);
7449
7360
  };
7450
7361
  }()).get(params);
7451
7362
  })();
@@ -7467,39 +7378,32 @@ var ably = {exports: {}};
7467
7378
  this.push = new push_default(this.client);
7468
7379
  }
7469
7380
  stats(params) {
7470
- var _this55 = this;
7381
+ var _this49 = this;
7471
7382
  return _asyncToGenerator(function* () {
7472
- var headers = defaults_default.defaultGetHeaders(_this55.client.options),
7473
- format = _this55.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7474
- envelope = _this55.client.http.supportsLinkHeaders ? void 0 : format;
7475
- _mixin(headers, _this55.client.options.headers);
7476
- return new paginatedresource_default(_this55.client, "/stats", headers, envelope, /*#__PURE__*/function () {
7477
- var _ref0 = _asyncToGenerator(function* (body, _, unpacked) {
7478
- var statsValues = unpacked ? body : _decodeBody(body, _this55.client._MsgPack, format);
7479
- for (var i = 0; i < statsValues.length; i++) statsValues[i] = stats_default.fromValues(statsValues[i]);
7480
- return statsValues;
7481
- });
7482
- return function (_x68, _x69, _x70) {
7483
- return _ref0.apply(this, arguments);
7484
- };
7485
- }()).get(params);
7383
+ var headers = defaults_default.defaultGetHeaders(_this49.client.options),
7384
+ format = _this49.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7385
+ envelope = _this49.client.http.supportsLinkHeaders ? void 0 : format;
7386
+ _mixin(headers, _this49.client.options.headers);
7387
+ return new paginatedresource_default(_this49.client, "/stats", headers, envelope, function (body, headers2, unpacked) {
7388
+ var statsValues = unpacked ? body : JSON.parse(body);
7389
+ for (var i = 0; i < statsValues.length; i++) statsValues[i] = stats_default.fromValues(statsValues[i]);
7390
+ return statsValues;
7391
+ }).get(params);
7486
7392
  })();
7487
7393
  }
7488
7394
  time(params) {
7489
- var _this56 = this;
7395
+ var _this50 = this;
7490
7396
  return _asyncToGenerator(function* () {
7491
- var headers = defaults_default.defaultGetHeaders(_this56.client.options, {
7492
- format: "json" /* json */
7493
- });
7494
- if (_this56.client.options.headers) _mixin(headers, _this56.client.options.headers);
7397
+ var headers = defaults_default.defaultGetHeaders(_this50.client.options);
7398
+ if (_this50.client.options.headers) _mixin(headers, _this50.client.options.headers);
7495
7399
  var timeUri = host => {
7496
- return _this56.client.baseUri(host) + "/time";
7400
+ return _this50.client.baseUri(host) + "/time";
7497
7401
  };
7498
7402
  var {
7499
7403
  error,
7500
7404
  body,
7501
7405
  unpacked
7502
- } = yield _this56.client.http.do(HttpMethods_default.Get, timeUri, headers, null, params);
7406
+ } = yield _this50.client.http.do(HttpMethods_default.Get, timeUri, headers, null, params);
7503
7407
  if (error) {
7504
7408
  throw error;
7505
7409
  }
@@ -7508,47 +7412,47 @@ var ably = {exports: {}};
7508
7412
  if (!time) {
7509
7413
  throw new _ErrorInfo2("Internal error (unexpected result type from GET /time)", 5e4, 500);
7510
7414
  }
7511
- _this56.client.serverTimeOffset = time - Date.now();
7415
+ _this50.client.serverTimeOffset = time - Date.now();
7512
7416
  return time;
7513
7417
  })();
7514
7418
  }
7515
7419
  request(method, path, version2, params, body, customHeaders) {
7516
- var _this57 = this;
7420
+ var _this51 = this;
7517
7421
  return _asyncToGenerator(function* () {
7518
7422
  var _a2;
7519
7423
  var [encoder, decoder, format] = (() => {
7520
- if (_this57.client.options.useBinaryProtocol) {
7521
- if (!_this57.client._MsgPack) {
7424
+ if (_this51.client.options.useBinaryProtocol) {
7425
+ if (!_this51.client._MsgPack) {
7522
7426
  _throwMissingPluginError("MsgPack");
7523
7427
  }
7524
- return [_this57.client._MsgPack.encode, _this57.client._MsgPack.decode, "msgpack" /* msgpack */];
7428
+ return [_this51.client._MsgPack.encode, _this51.client._MsgPack.decode, "msgpack" /* msgpack */];
7525
7429
  } else {
7526
7430
  return [JSON.stringify, JSON.parse, "json" /* json */];
7527
7431
  }
7528
7432
  })();
7529
- var envelope = _this57.client.http.supportsLinkHeaders ? void 0 : format;
7433
+ var envelope = _this51.client.http.supportsLinkHeaders ? void 0 : format;
7530
7434
  params = params || {};
7531
7435
  var _method = method.toLowerCase();
7532
- var headers = _method == "get" ? defaults_default.defaultGetHeaders(_this57.client.options, {
7436
+ var headers = _method == "get" ? defaults_default.defaultGetHeaders(_this51.client.options, {
7533
7437
  format,
7534
7438
  protocolVersion: version2
7535
- }) : defaults_default.defaultPostHeaders(_this57.client.options, {
7439
+ }) : defaults_default.defaultPostHeaders(_this51.client.options, {
7536
7440
  format,
7537
7441
  protocolVersion: version2
7538
7442
  });
7539
7443
  if (typeof body !== "string") {
7540
7444
  body = (_a2 = encoder(body)) != null ? _a2 : null;
7541
7445
  }
7542
- _mixin(headers, _this57.client.options.headers);
7446
+ _mixin(headers, _this51.client.options.headers);
7543
7447
  if (customHeaders) {
7544
7448
  _mixin(headers, customHeaders);
7545
7449
  }
7546
- var paginatedResource = new paginatedresource_default(_this57.client, path, headers, envelope, /*#__PURE__*/function () {
7547
- var _ref1 = _asyncToGenerator(function* (resbody, headers2, unpacked) {
7450
+ var paginatedResource = new paginatedresource_default(_this51.client, path, headers, envelope, /*#__PURE__*/function () {
7451
+ var _ref9 = _asyncToGenerator(function* (resbody, headers2, unpacked) {
7548
7452
  return _ensureArray(unpacked ? resbody : decoder(resbody));
7549
7453
  });
7550
- return function (_x71, _x72, _x73) {
7551
- return _ref1.apply(this, arguments);
7454
+ return function (_x65, _x66, _x67) {
7455
+ return _ref9.apply(this, arguments);
7552
7456
  };
7553
7457
  }(), /* useHttpPaginatedResponse: */
7554
7458
  true);
@@ -7563,7 +7467,7 @@ var ably = {exports: {}};
7563
7467
  })();
7564
7468
  }
7565
7469
  batchPublish(specOrSpecs) {
7566
- var _this58 = this;
7470
+ var _this52 = this;
7567
7471
  return _asyncToGenerator(function* () {
7568
7472
  var requestBodyDTO;
7569
7473
  var singleSpecMode;
@@ -7574,12 +7478,14 @@ var ably = {exports: {}};
7574
7478
  requestBodyDTO = [specOrSpecs];
7575
7479
  singleSpecMode = true;
7576
7480
  }
7577
- var format = _this58.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7578
- headers = defaults_default.defaultPostHeaders(_this58.client.options);
7579
- if (_this58.client.options.headers) _mixin(headers, _this58.client.options.headers);
7580
- var requestBody = _encodeBody(requestBodyDTO, _this58.client._MsgPack, format);
7581
- var response = yield resource_default.post(_this58.client, "/messages", requestBody, headers, {}, null, true);
7582
- var batchResults = response.unpacked ? response.body : _decodeBody(response.body, _this58.client._MsgPack, format);
7481
+ var format = _this52.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7482
+ headers = defaults_default.defaultPostHeaders(_this52.client.options, {
7483
+ format
7484
+ });
7485
+ if (_this52.client.options.headers) _mixin(headers, _this52.client.options.headers);
7486
+ var requestBody = _encodeBody(requestBodyDTO, _this52.client._MsgPack, format);
7487
+ var response = yield resource_default.post(_this52.client, "/messages", requestBody, headers, {}, null, true);
7488
+ var batchResults = response.unpacked ? response.body : _decodeBody(response.body, _this52.client._MsgPack, format);
7583
7489
  if (singleSpecMode) {
7584
7490
  return batchResults[0];
7585
7491
  } else {
@@ -7588,35 +7494,39 @@ var ably = {exports: {}};
7588
7494
  })();
7589
7495
  }
7590
7496
  batchPresence(channels) {
7591
- var _this59 = this;
7497
+ var _this53 = this;
7592
7498
  return _asyncToGenerator(function* () {
7593
- var format = _this59.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7594
- headers = defaults_default.defaultGetHeaders(_this59.client.options);
7595
- if (_this59.client.options.headers) _mixin(headers, _this59.client.options.headers);
7499
+ var format = _this53.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7500
+ headers = defaults_default.defaultPostHeaders(_this53.client.options, {
7501
+ format
7502
+ });
7503
+ if (_this53.client.options.headers) _mixin(headers, _this53.client.options.headers);
7596
7504
  var channelsParam = channels.join(",");
7597
- var response = yield resource_default.get(_this59.client, "/presence", headers, {
7505
+ var response = yield resource_default.get(_this53.client, "/presence", headers, {
7598
7506
  channels: channelsParam
7599
7507
  }, null, true);
7600
- return response.unpacked ? response.body : _decodeBody(response.body, _this59.client._MsgPack, format);
7508
+ return response.unpacked ? response.body : _decodeBody(response.body, _this53.client._MsgPack, format);
7601
7509
  })();
7602
7510
  }
7603
7511
  revokeTokens(specifiers, options) {
7604
- var _this60 = this;
7512
+ var _this54 = this;
7605
7513
  return _asyncToGenerator(function* () {
7606
- if (useTokenAuth(_this60.client.options)) {
7514
+ if (useTokenAuth(_this54.client.options)) {
7607
7515
  throw new _ErrorInfo2("Cannot revoke tokens when using token auth", 40162, 401);
7608
7516
  }
7609
- var keyName = _this60.client.options.keyName;
7517
+ var keyName = _this54.client.options.keyName;
7610
7518
  var resolvedOptions = options != null ? options : {};
7611
7519
  var requestBodyDTO = __spreadValues({
7612
7520
  targets: specifiers.map(specifier => "".concat(specifier.type, ":").concat(specifier.value))
7613
7521
  }, resolvedOptions);
7614
- var format = _this60.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7615
- headers = defaults_default.defaultPostHeaders(_this60.client.options);
7616
- if (_this60.client.options.headers) _mixin(headers, _this60.client.options.headers);
7617
- var requestBody = _encodeBody(requestBodyDTO, _this60.client._MsgPack, format);
7618
- var response = yield resource_default.post(_this60.client, "/keys/".concat(keyName, "/revokeTokens"), requestBody, headers, {}, null, true);
7619
- return response.unpacked ? response.body : _decodeBody(response.body, _this60.client._MsgPack, format);
7522
+ var format = _this54.client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7523
+ headers = defaults_default.defaultPostHeaders(_this54.client.options, {
7524
+ format
7525
+ });
7526
+ if (_this54.client.options.headers) _mixin(headers, _this54.client.options.headers);
7527
+ var requestBody = _encodeBody(requestBodyDTO, _this54.client._MsgPack, format);
7528
+ var response = yield resource_default.post(_this54.client, "/keys/".concat(keyName, "/revokeTokens"), requestBody, headers, {}, null, true);
7529
+ return response.unpacked ? response.body : _decodeBody(response.body, _this54.client._MsgPack, format);
7620
7530
  })();
7621
7531
  }
7622
7532
  };
@@ -7700,7 +7610,7 @@ var ably = {exports: {}};
7700
7610
 
7701
7611
  // src/common/lib/types/annotation.ts
7702
7612
  var actions4 = ["annotation.create", "annotation.delete"];
7703
- function fromEncoded3(_x74, _x75, _x76) {
7613
+ function fromEncoded3(_x68, _x69, _x70) {
7704
7614
  return _fromEncoded8.apply(this, arguments);
7705
7615
  }
7706
7616
  function _fromEncoded8() {
@@ -7710,7 +7620,7 @@ var ably = {exports: {}};
7710
7620
  });
7711
7621
  return _fromEncoded8.apply(this, arguments);
7712
7622
  }
7713
- function fromEncodedArray3(_x77, _x78, _x79) {
7623
+ function fromEncodedArray3(_x71, _x72, _x73) {
7714
7624
  return _fromEncodedArray8.apply(this, arguments);
7715
7625
  }
7716
7626
  function _fromEncodedArray8() {
@@ -7721,7 +7631,7 @@ var ably = {exports: {}};
7721
7631
  });
7722
7632
  return _fromEncodedArray8.apply(this, arguments);
7723
7633
  }
7724
- function _fromEncoded3(_x80, _x81) {
7634
+ function _fromEncoded3(_x74, _x75) {
7725
7635
  return _fromEncoded9.apply(this, arguments);
7726
7636
  }
7727
7637
  function _fromEncoded9() {
@@ -7730,7 +7640,7 @@ var ably = {exports: {}};
7730
7640
  });
7731
7641
  return _fromEncoded9.apply(this, arguments);
7732
7642
  }
7733
- function _fromEncodedArray3(_x82, _x83) {
7643
+ function _fromEncodedArray3(_x76, _x77) {
7734
7644
  return _fromEncodedArray9.apply(this, arguments);
7735
7645
  }
7736
7646
  function _fromEncodedArray9() {
@@ -7743,10 +7653,10 @@ var ably = {exports: {}};
7743
7653
  }
7744
7654
  var Annotation = class _Annotation extends BaseMessage {
7745
7655
  encode() {
7746
- var _this61 = this;
7656
+ var _this55 = this;
7747
7657
  return _asyncToGenerator(function* () {
7748
- var res = Object.assign(new WireAnnotation(), _this61, {
7749
- action: actions4.indexOf(_this61.action || "annotation.create")
7658
+ var res = Object.assign(new WireAnnotation(), _this55, {
7659
+ action: actions4.indexOf(_this55.action || "annotation.create")
7750
7660
  });
7751
7661
  return encode(res, {});
7752
7662
  })();
@@ -7775,10 +7685,10 @@ var ably = {exports: {}};
7775
7685
  return values.map(v => _WireAnnotation.fromValues(v));
7776
7686
  }
7777
7687
  decode(channelOptions, logger) {
7778
- var _this62 = this;
7688
+ var _this56 = this;
7779
7689
  return _asyncToGenerator(function* () {
7780
- var res = Object.assign(new Annotation(), __spreadProps(__spreadValues({}, _this62), {
7781
- action: actions4[_this62.action]
7690
+ var res = Object.assign(new Annotation(), __spreadProps(__spreadValues({}, _this56), {
7691
+ action: actions4[_this56.action]
7782
7692
  }));
7783
7693
  try {
7784
7694
  yield decode(res, channelOptions);
@@ -7847,43 +7757,47 @@ var ably = {exports: {}};
7847
7757
  this.channel = channel;
7848
7758
  }
7849
7759
  publish(msgOrSerial, annotationValues) {
7850
- var _this63 = this;
7760
+ var _this57 = this;
7851
7761
  return _asyncToGenerator(function* () {
7852
7762
  var annotation = constructValidateAnnotation(msgOrSerial, annotationValues);
7853
7763
  var wireAnnotation = yield annotation.encode();
7854
- var client = _this63.channel.client,
7764
+ var client = _this57.channel.client,
7855
7765
  options = client.options,
7856
7766
  format = options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7857
- headers = defaults_default.defaultPostHeaders(client.options),
7767
+ headers = defaults_default.defaultPostHeaders(client.options, {
7768
+ format
7769
+ }),
7858
7770
  params = {};
7859
7771
  _mixin(headers, client.options.headers);
7860
7772
  var requestBody = _encodeBody([wireAnnotation], client._MsgPack, format);
7861
- yield resource_default.post(client, basePathForSerial(_this63.channel, annotation.messageSerial), requestBody, headers, params, null, true);
7773
+ yield resource_default.post(client, basePathForSerial(_this57.channel, annotation.messageSerial), requestBody, headers, params, null, true);
7862
7774
  })();
7863
7775
  }
7864
7776
  delete(msgOrSerial, annotationValues) {
7865
- var _this64 = this;
7777
+ var _this58 = this;
7866
7778
  return _asyncToGenerator(function* () {
7867
7779
  annotationValues.action = "annotation.delete";
7868
- return _this64.publish(msgOrSerial, annotationValues);
7780
+ return _this58.publish(msgOrSerial, annotationValues);
7869
7781
  })();
7870
7782
  }
7871
7783
  get(msgOrSerial, params) {
7872
- var _this65 = this;
7784
+ var _this59 = this;
7873
7785
  return _asyncToGenerator(function* () {
7874
- var client = _this65.channel.client,
7786
+ var client = _this59.channel.client,
7875
7787
  messageSerial = serialFromMsgOrSerial(msgOrSerial),
7876
7788
  format = client.options.useBinaryProtocol ? "msgpack" /* msgpack */ : "json" /* json */,
7877
7789
  envelope = client.http.supportsLinkHeaders ? void 0 : format,
7878
- headers = defaults_default.defaultGetHeaders(client.options);
7790
+ headers = defaults_default.defaultGetHeaders(client.options, {
7791
+ format
7792
+ });
7879
7793
  _mixin(headers, client.options.headers);
7880
- return new paginatedresource_default(client, basePathForSerial(_this65.channel, messageSerial), headers, envelope, /*#__PURE__*/function () {
7881
- var _ref10 = _asyncToGenerator(function* (body, _, unpacked) {
7794
+ return new paginatedresource_default(client, basePathForSerial(_this59.channel, messageSerial), headers, envelope, /*#__PURE__*/function () {
7795
+ var _ref0 = _asyncToGenerator(function* (body, _, unpacked) {
7882
7796
  var decoded = unpacked ? body : _decodeBody(body, client._MsgPack, format);
7883
- return _fromEncodedArray3(decoded, _this65.channel);
7797
+ return _fromEncodedArray3(decoded, _this59.channel);
7884
7798
  });
7885
- return function (_x84, _x85, _x86) {
7886
- return _ref10.apply(this, arguments);
7799
+ return function (_x78, _x79, _x80) {
7800
+ return _ref0.apply(this, arguments);
7887
7801
  };
7888
7802
  }()).get(params);
7889
7803
  })();
@@ -8054,7 +7968,7 @@ var ably = {exports: {}};
8054
7968
  this._mode = 0;
8055
7969
  this.retryCount = 0;
8056
7970
  this.history = /*#__PURE__*/function () {
8057
- var _ref11 = _asyncToGenerator(function* (params) {
7971
+ var _ref1 = _asyncToGenerator(function* (params) {
8058
7972
  logger_default.logAction(this.logger, logger_default.LOG_MICRO, "RealtimeChannel.history()", "channel = " + this.name);
8059
7973
  var restMixin = this.client.rest.channelMixin;
8060
7974
  if (params && params.untilAttach) {
@@ -8069,8 +7983,8 @@ var ably = {exports: {}};
8069
7983
  }
8070
7984
  return restMixin.history(this, params);
8071
7985
  });
8072
- return function (_x87) {
8073
- return _ref11.apply(this, arguments);
7986
+ return function (_x81) {
7987
+ return _ref1.apply(this, arguments);
8074
7988
  };
8075
7989
  }();
8076
7990
  this.whenState = state => {
@@ -8149,20 +8063,20 @@ var ably = {exports: {}};
8149
8063
  return args;
8150
8064
  }
8151
8065
  setOptions(options) {
8152
- var _this66 = this;
8066
+ var _this60 = this;
8153
8067
  return _asyncToGenerator(function* () {
8154
8068
  var _a2;
8155
- var previousChannelOptions = _this66.channelOptions;
8069
+ var previousChannelOptions = _this60.channelOptions;
8156
8070
  var err = validateChannelOptions(options);
8157
8071
  if (err) {
8158
8072
  throw err;
8159
8073
  }
8160
- _this66.channelOptions = normaliseChannelOptions((_a2 = _this66.client._Crypto) != null ? _a2 : null, _this66.logger, options);
8161
- if (_this66._decodingContext) _this66._decodingContext.channelOptions = _this66.channelOptions;
8162
- if (_this66._shouldReattachToSetOptions(options, previousChannelOptions)) {
8163
- _this66.attachImpl();
8074
+ _this60.channelOptions = normaliseChannelOptions((_a2 = _this60.client._Crypto) != null ? _a2 : null, _this60.logger, options);
8075
+ if (_this60._decodingContext) _this60._decodingContext.channelOptions = _this60.channelOptions;
8076
+ if (_this60._shouldReattachToSetOptions(options, previousChannelOptions)) {
8077
+ _this60.attachImpl();
8164
8078
  return new Promise((resolve, reject) => {
8165
- _this66._allChannelChanges.once(["attached", "update", "detached", "failed"], function (stateChange) {
8079
+ _this60._allChannelChanges.once(["attached", "update", "detached", "failed"], function (stateChange) {
8166
8080
  switch (this.event) {
8167
8081
  case "update":
8168
8082
  case "attached":
@@ -8199,7 +8113,7 @@ var ably = {exports: {}};
8199
8113
  }
8200
8114
  publish() {
8201
8115
  var _arguments2 = arguments,
8202
- _this67 = this;
8116
+ _this61 = this;
8203
8117
  return _asyncToGenerator(function* () {
8204
8118
  var messages;
8205
8119
  var argCount = _arguments2.length;
@@ -8217,20 +8131,20 @@ var ably = {exports: {}};
8217
8131
  data: _arguments2.length <= 1 ? undefined : _arguments2[1]
8218
8132
  })];
8219
8133
  }
8220
- var maxMessageSize = _this67.client.options.maxMessageSize;
8221
- var wireMessages = yield encodeArray(messages, _this67.channelOptions);
8134
+ var maxMessageSize = _this61.client.options.maxMessageSize;
8135
+ var wireMessages = yield encodeArray(messages, _this61.channelOptions);
8222
8136
  var size = getMessagesSize(wireMessages);
8223
8137
  if (size > maxMessageSize) {
8224
8138
  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);
8225
8139
  }
8226
- _this67.throwIfUnpublishableState();
8227
- logger_default.logAction(_this67.logger, logger_default.LOG_MICRO, "RealtimeChannel.publish()", "sending message; channel state is " + _this67.state + ", message count = " + wireMessages.length);
8140
+ _this61.throwIfUnpublishableState();
8141
+ logger_default.logAction(_this61.logger, logger_default.LOG_MICRO, "RealtimeChannel.publish()", "sending message; channel state is " + _this61.state + ", message count = " + wireMessages.length);
8228
8142
  var pm = fromValues({
8229
8143
  action: actions.MESSAGE,
8230
- channel: _this67.name,
8144
+ channel: _this61.name,
8231
8145
  messages: wireMessages
8232
8146
  });
8233
- return _this67.sendMessage(pm);
8147
+ return _this61.sendMessage(pm);
8234
8148
  })();
8235
8149
  }
8236
8150
  throwIfUnpublishableState() {
@@ -8250,13 +8164,13 @@ var ably = {exports: {}};
8250
8164
  }
8251
8165
  }
8252
8166
  attach() {
8253
- var _this68 = this;
8167
+ var _this62 = this;
8254
8168
  return _asyncToGenerator(function* () {
8255
- if (_this68.state === "attached") {
8169
+ if (_this62.state === "attached") {
8256
8170
  return null;
8257
8171
  }
8258
8172
  return new Promise((resolve, reject) => {
8259
- _this68._attach(false, null, (err, result) => err ? reject(err) : resolve(result));
8173
+ _this62._attach(false, null, (err, result) => err ? reject(err) : resolve(result));
8260
8174
  });
8261
8175
  })();
8262
8176
  }
@@ -8314,25 +8228,25 @@ var ably = {exports: {}};
8314
8228
  this.sendMessage(attachMsg).catch(noop);
8315
8229
  }
8316
8230
  detach() {
8317
- var _this69 = this;
8231
+ var _this63 = this;
8318
8232
  return _asyncToGenerator(function* () {
8319
- var connectionManager = _this69.connectionManager;
8233
+ var connectionManager = _this63.connectionManager;
8320
8234
  if (!connectionManager.activeState()) {
8321
8235
  throw connectionManager.getError();
8322
8236
  }
8323
- switch (_this69.state) {
8237
+ switch (_this63.state) {
8324
8238
  case "suspended":
8325
- _this69.notifyState("detached");
8239
+ _this63.notifyState("detached");
8326
8240
  return;
8327
8241
  case "detached":
8328
8242
  return;
8329
8243
  case "failed":
8330
8244
  throw new _ErrorInfo2("Unable to detach; channel state = failed", 90001, 400);
8331
8245
  default:
8332
- _this69.requestState("detaching");
8246
+ _this63.requestState("detaching");
8333
8247
  case "detaching":
8334
8248
  return new Promise((resolve, reject) => {
8335
- _this69.once(function (stateChange) {
8249
+ _this63.once(function (stateChange) {
8336
8250
  switch (this.event) {
8337
8251
  case "detached":
8338
8252
  resolve();
@@ -8361,22 +8275,22 @@ var ably = {exports: {}};
8361
8275
  }
8362
8276
  subscribe() {
8363
8277
  var _arguments3 = arguments,
8364
- _this70 = this;
8278
+ _this64 = this;
8365
8279
  return _asyncToGenerator(function* () {
8366
8280
  for (var _len0 = _arguments3.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
8367
8281
  args[_key0] = _arguments3[_key0];
8368
8282
  }
8369
8283
  var [event, listener] = _RealtimeChannel.processListenerArgs(args);
8370
- if (_this70.state === "failed") {
8371
- throw _ErrorInfo2.fromValues(_this70.invalidStateError());
8284
+ if (_this64.state === "failed") {
8285
+ throw _ErrorInfo2.fromValues(_this64.invalidStateError());
8372
8286
  }
8373
8287
  if (event && typeof event === "object" && !Array.isArray(event)) {
8374
- _this70.client._FilteredSubscriptions.subscribeFilter(_this70, event, listener);
8288
+ _this64.client._FilteredSubscriptions.subscribeFilter(_this64, event, listener);
8375
8289
  } else {
8376
- _this70.subscriptions.on(event, listener);
8290
+ _this64.subscriptions.on(event, listener);
8377
8291
  }
8378
- if (_this70.channelOptions.attachOnSubscribe !== false) {
8379
- return _this70.attach();
8292
+ if (_this64.channelOptions.attachOnSubscribe !== false) {
8293
+ return _this64.attach();
8380
8294
  } else {
8381
8295
  return null;
8382
8296
  }
@@ -8415,10 +8329,10 @@ var ably = {exports: {}};
8415
8329
  connectionManager.send(syncMessage);
8416
8330
  }
8417
8331
  sendMessage(msg) {
8418
- var _this71 = this;
8332
+ var _this65 = this;
8419
8333
  return _asyncToGenerator(function* () {
8420
8334
  return new Promise((resolve, reject) => {
8421
- _this71.connectionManager.send(msg, _this71.client.options.queueMessages, err => {
8335
+ _this65.connectionManager.send(msg, _this65.client.options.queueMessages, err => {
8422
8336
  if (err) {
8423
8337
  reject(err);
8424
8338
  } else {
@@ -8429,14 +8343,14 @@ var ably = {exports: {}};
8429
8343
  })();
8430
8344
  }
8431
8345
  sendPresence(presence) {
8432
- var _this72 = this;
8346
+ var _this66 = this;
8433
8347
  return _asyncToGenerator(function* () {
8434
8348
  var msg = fromValues({
8435
8349
  action: actions.PRESENCE,
8436
- channel: _this72.name,
8350
+ channel: _this66.name,
8437
8351
  presence
8438
8352
  });
8439
- return _this72.sendMessage(msg);
8353
+ return _this66.sendMessage(msg);
8440
8354
  })();
8441
8355
  }
8442
8356
  sendState(objectMessages) {
@@ -8449,61 +8363,61 @@ var ably = {exports: {}};
8449
8363
  }
8450
8364
  // Access to this method is synchronised by ConnectionManager#processChannelMessage, in order to synchronise access to the state stored in _decodingContext.
8451
8365
  processMessage(message) {
8452
- var _this73 = this;
8366
+ var _this67 = this;
8453
8367
  return _asyncToGenerator(function* () {
8454
8368
  if (message.action === actions.ATTACHED || message.action === actions.MESSAGE || message.action === actions.PRESENCE || message.action === actions.OBJECT || message.action === actions.ANNOTATION) {
8455
- _this73.setChannelSerial(message.channelSerial);
8369
+ _this67.setChannelSerial(message.channelSerial);
8456
8370
  }
8457
8371
  var syncChannelSerial,
8458
8372
  isSync = false;
8459
8373
  switch (message.action) {
8460
8374
  case actions.ATTACHED:
8461
8375
  {
8462
- _this73.properties.attachSerial = message.channelSerial;
8463
- _this73._mode = message.getMode();
8464
- _this73.params = message.params || {};
8376
+ _this67.properties.attachSerial = message.channelSerial;
8377
+ _this67._mode = message.getMode();
8378
+ _this67.params = message.params || {};
8465
8379
  var modesFromFlags = message.decodeModesFromFlags();
8466
- _this73.modes = modesFromFlags && _allToLowerCase(modesFromFlags) || void 0;
8380
+ _this67.modes = modesFromFlags && _allToLowerCase(modesFromFlags) || void 0;
8467
8381
  var resumed = message.hasFlag("RESUMED");
8468
8382
  var hasPresence = message.hasFlag("HAS_PRESENCE");
8469
8383
  var hasBacklog = message.hasFlag("HAS_BACKLOG");
8470
8384
  var hasObjects = message.hasFlag("HAS_OBJECTS");
8471
- if (_this73.state === "attached") {
8385
+ if (_this67.state === "attached") {
8472
8386
  if (!resumed) {
8473
- if (_this73._presence) {
8474
- _this73._presence.onAttached(hasPresence);
8387
+ if (_this67._presence) {
8388
+ _this67._presence.onAttached(hasPresence);
8475
8389
  }
8476
- if (_this73._objects) {
8477
- _this73._objects.onAttached(hasObjects);
8390
+ if (_this67._objects) {
8391
+ _this67._objects.onAttached(hasObjects);
8478
8392
  }
8479
8393
  }
8480
- var change = new channelstatechange_default(_this73.state, _this73.state, resumed, hasBacklog, message.error);
8481
- _this73._allChannelChanges.emit("update", change);
8482
- if (!resumed || _this73.channelOptions.updateOnAttached) {
8483
- _this73.emit("update", change);
8394
+ var change = new channelstatechange_default(_this67.state, _this67.state, resumed, hasBacklog, message.error);
8395
+ _this67._allChannelChanges.emit("update", change);
8396
+ if (!resumed || _this67.channelOptions.updateOnAttached) {
8397
+ _this67.emit("update", change);
8484
8398
  }
8485
- } else if (_this73.state === "detaching") {
8486
- _this73.checkPendingState();
8399
+ } else if (_this67.state === "detaching") {
8400
+ _this67.checkPendingState();
8487
8401
  } else {
8488
- _this73.notifyState("attached", message.error, resumed, hasPresence, hasBacklog, hasObjects);
8402
+ _this67.notifyState("attached", message.error, resumed, hasPresence, hasBacklog, hasObjects);
8489
8403
  }
8490
8404
  break;
8491
8405
  }
8492
8406
  case actions.DETACHED:
8493
8407
  {
8494
8408
  var detachErr = message.error ? _ErrorInfo2.fromValues(message.error) : new _ErrorInfo2("Channel detached", 90001, 404);
8495
- if (_this73.state === "detaching") {
8496
- _this73.notifyState("detached", detachErr);
8497
- } else if (_this73.state === "attaching") {
8498
- _this73.notifyState("suspended", detachErr);
8499
- } else if (_this73.state === "attached" || _this73.state === "suspended") {
8500
- _this73.requestState("attaching", detachErr);
8409
+ if (_this67.state === "detaching") {
8410
+ _this67.notifyState("detached", detachErr);
8411
+ } else if (_this67.state === "attaching") {
8412
+ _this67.notifyState("suspended", detachErr);
8413
+ } else if (_this67.state === "attached" || _this67.state === "suspended") {
8414
+ _this67.requestState("attaching", detachErr);
8501
8415
  }
8502
8416
  break;
8503
8417
  }
8504
8418
  case actions.SYNC:
8505
8419
  isSync = true;
8506
- syncChannelSerial = _this73.syncChannelSerial = message.channelSerial;
8420
+ syncChannelSerial = _this67.syncChannelSerial = message.channelSerial;
8507
8421
  if (!message.presence) break;
8508
8422
  case actions.PRESENCE:
8509
8423
  {
@@ -8511,45 +8425,45 @@ var ably = {exports: {}};
8511
8425
  break;
8512
8426
  }
8513
8427
  populateFieldsFromParent(message);
8514
- var options = _this73.channelOptions;
8515
- if (_this73._presence) {
8428
+ var options = _this67.channelOptions;
8429
+ if (_this67._presence) {
8516
8430
  var presenceMessages = yield Promise.all(message.presence.map(wpm => {
8517
- return wpm.decode(options, _this73.logger);
8431
+ return wpm.decode(options, _this67.logger);
8518
8432
  }));
8519
- _this73._presence.setPresence(presenceMessages, isSync, syncChannelSerial);
8433
+ _this67._presence.setPresence(presenceMessages, isSync, syncChannelSerial);
8520
8434
  }
8521
8435
  break;
8522
8436
  }
8523
8437
  case actions.OBJECT:
8524
8438
  case actions.OBJECT_SYNC:
8525
8439
  {
8526
- if (!_this73._objects || !message.state) {
8440
+ if (!_this67._objects || !message.state) {
8527
8441
  return;
8528
8442
  }
8529
8443
  populateFieldsFromParent(message);
8530
- var format = _this73.client.connection.connectionManager.getActiveTransportFormat();
8531
- var objectMessages = message.state.map(om => om.decode(_this73.client, format));
8444
+ var format = _this67.client.connection.connectionManager.getActiveTransportFormat();
8445
+ var objectMessages = message.state.map(om => om.decode(_this67.client, format));
8532
8446
  if (message.action === actions.OBJECT) {
8533
- _this73._objects.handleObjectMessages(objectMessages);
8447
+ _this67._objects.handleObjectMessages(objectMessages);
8534
8448
  } else {
8535
- _this73._objects.handleObjectSyncMessages(objectMessages, message.channelSerial);
8449
+ _this67._objects.handleObjectSyncMessages(objectMessages, message.channelSerial);
8536
8450
  }
8537
8451
  break;
8538
8452
  }
8539
8453
  case actions.MESSAGE:
8540
8454
  {
8541
- if (_this73.state !== "attached") {
8542
- 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 + '").');
8455
+ if (_this67.state !== "attached") {
8456
+ 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 + '").');
8543
8457
  return;
8544
8458
  }
8545
8459
  populateFieldsFromParent(message);
8546
8460
  var encoded = message.messages,
8547
8461
  firstMessage = encoded[0],
8548
8462
  lastMessage = encoded[encoded.length - 1];
8549
- if (firstMessage.extras && firstMessage.extras.delta && firstMessage.extras.delta.from !== _this73._lastPayload.messageId) {
8550
- var msg = 'Delta message decode failure - previous message not available for message "' + message.id + '" on this channel "' + _this73.name + '".';
8551
- logger_default.logAction(_this73.logger, logger_default.LOG_ERROR, "RealtimeChannel.processMessage()", msg);
8552
- _this73._startDecodeFailureRecovery(new _ErrorInfo2(msg, 40018, 400));
8463
+ if (firstMessage.extras && firstMessage.extras.delta && firstMessage.extras.delta.from !== _this67._lastPayload.messageId) {
8464
+ var msg = 'Delta message decode failure - previous message not available for message "' + message.id + '" on this channel "' + _this67.name + '".';
8465
+ logger_default.logAction(_this67.logger, logger_default.LOG_ERROR, "RealtimeChannel.processMessage()", msg);
8466
+ _this67._startDecodeFailureRecovery(new _ErrorInfo2(msg, 40018, 400));
8553
8467
  break;
8554
8468
  }
8555
8469
  var messages = [];
@@ -8557,34 +8471,34 @@ var ably = {exports: {}};
8557
8471
  var {
8558
8472
  decoded,
8559
8473
  err
8560
- } = yield encoded[i].decodeWithErr(_this73._decodingContext, _this73.logger);
8474
+ } = yield encoded[i].decodeWithErr(_this67._decodingContext, _this67.logger);
8561
8475
  messages[i] = decoded;
8562
8476
  if (err) {
8563
8477
  switch (err.code) {
8564
8478
  case 40018:
8565
- _this73._startDecodeFailureRecovery(err);
8479
+ _this67._startDecodeFailureRecovery(err);
8566
8480
  return;
8567
8481
  case 40019:
8568
8482
  case 40021:
8569
- _this73.notifyState("failed", err);
8483
+ _this67.notifyState("failed", err);
8570
8484
  return;
8571
8485
  }
8572
8486
  }
8573
8487
  }
8574
- _this73._lastPayload.messageId = lastMessage.id;
8575
- _this73._lastPayload.protocolMessageChannelSerial = message.channelSerial;
8576
- _this73.onEvent(messages);
8488
+ _this67._lastPayload.messageId = lastMessage.id;
8489
+ _this67._lastPayload.protocolMessageChannelSerial = message.channelSerial;
8490
+ _this67.onEvent(messages);
8577
8491
  break;
8578
8492
  }
8579
8493
  case actions.ANNOTATION:
8580
8494
  {
8581
8495
  populateFieldsFromParent(message);
8582
- var _options = _this73.channelOptions;
8583
- if (_this73._annotations) {
8496
+ var _options = _this67.channelOptions;
8497
+ if (_this67._annotations) {
8584
8498
  var annotations = yield Promise.all((message.annotations || []).map(wpm => {
8585
- return wpm.decode(_options, _this73.logger);
8499
+ return wpm.decode(_options, _this67.logger);
8586
8500
  }));
8587
- _this73._annotations._processIncoming(annotations);
8501
+ _this67._annotations._processIncoming(annotations);
8588
8502
  }
8589
8503
  break;
8590
8504
  }
@@ -8592,14 +8506,14 @@ var ably = {exports: {}};
8592
8506
  {
8593
8507
  var _err = message.error;
8594
8508
  if (_err && _err.code == 80016) {
8595
- _this73.checkPendingState();
8509
+ _this67.checkPendingState();
8596
8510
  } else {
8597
- _this73.notifyState("failed", _ErrorInfo2.fromValues(_err));
8511
+ _this67.notifyState("failed", _ErrorInfo2.fromValues(_err));
8598
8512
  }
8599
8513
  break;
8600
8514
  }
8601
8515
  default:
8602
- logger_default.logAction(_this73.logger, logger_default.LOG_MAJOR, "RealtimeChannel.processMessage()", "Protocol error: unrecognised message action (" + message.action + ")");
8516
+ logger_default.logAction(_this67.logger, logger_default.LOG_MAJOR, "RealtimeChannel.processMessage()", "Protocol error: unrecognised message action (" + message.action + ")");
8603
8517
  }
8604
8518
  })();
8605
8519
  }
@@ -8755,45 +8669,9 @@ var ably = {exports: {}};
8755
8669
  }
8756
8670
  }
8757
8671
  status() {
8758
- var _this74 = this;
8759
- return _asyncToGenerator(function* () {
8760
- return _this74.client.rest.channelMixin.status(_this74);
8761
- })();
8762
- }
8763
- getMessage(serialOrMessage) {
8764
- var _this75 = this;
8765
- return _asyncToGenerator(function* () {
8766
- logger_default.logAction(_this75.logger, logger_default.LOG_MICRO, "RealtimeChannel.getMessage()", "channel = " + _this75.name);
8767
- var restMixin = _this75.client.rest.channelMixin;
8768
- return restMixin.getMessage(_this75, serialOrMessage);
8769
- })();
8770
- }
8771
- updateMessage(message, operation, params) {
8772
- var _this76 = this;
8773
- return _asyncToGenerator(function* () {
8774
- logger_default.logAction(_this76.logger, logger_default.LOG_MICRO, "RealtimeChannel.updateMessage()", "channel = " + _this76.name);
8775
- var restMixin = _this76.client.rest.channelMixin;
8776
- return restMixin.updateDeleteMessage(_this76, {
8777
- isDelete: false
8778
- }, message, operation, params);
8779
- })();
8780
- }
8781
- deleteMessage(message, operation, params) {
8782
- var _this77 = this;
8783
- return _asyncToGenerator(function* () {
8784
- logger_default.logAction(_this77.logger, logger_default.LOG_MICRO, "RealtimeChannel.deleteMessage()", "channel = " + _this77.name);
8785
- var restMixin = _this77.client.rest.channelMixin;
8786
- return restMixin.updateDeleteMessage(_this77, {
8787
- isDelete: true
8788
- }, message, operation, params);
8789
- })();
8790
- }
8791
- getMessageVersions(serialOrMessage, params) {
8792
- var _this78 = this;
8672
+ var _this68 = this;
8793
8673
  return _asyncToGenerator(function* () {
8794
- logger_default.logAction(_this78.logger, logger_default.LOG_MICRO, "RealtimeChannel.getMessageVersions()", "channel = " + _this78.name);
8795
- var restMixin = _this78.client.rest.channelMixin;
8796
- return restMixin.getMessageVersions(_this78, serialOrMessage, params);
8674
+ return _this68.client.rest.channelMixin.status(_this68);
8797
8675
  })();
8798
8676
  }
8799
8677
  };
@@ -8812,31 +8690,31 @@ var ably = {exports: {}};
8812
8690
  this.subscriptions = new eventemitter_default(this.logger);
8813
8691
  }
8814
8692
  publish(msgOrSerial, annotationValues) {
8815
- var _this79 = this;
8693
+ var _this69 = this;
8816
8694
  return _asyncToGenerator(function* () {
8817
- var channelName = _this79.channel.name;
8695
+ var channelName = _this69.channel.name;
8818
8696
  var annotation = constructValidateAnnotation(msgOrSerial, annotationValues);
8819
8697
  var wireAnnotation = yield annotation.encode();
8820
- _this79.channel.throwIfUnpublishableState();
8821
- logger_default.logAction(_this79.logger, logger_default.LOG_MICRO, "RealtimeAnnotations.publish()", "channelName = " + channelName + ", sending annotation with messageSerial = " + annotation.messageSerial + ", type = " + annotation.type);
8698
+ _this69.channel.throwIfUnpublishableState();
8699
+ logger_default.logAction(_this69.logger, logger_default.LOG_MICRO, "RealtimeAnnotations.publish()", "channelName = " + channelName + ", sending annotation with messageSerial = " + annotation.messageSerial + ", type = " + annotation.type);
8822
8700
  var pm = fromValues({
8823
8701
  action: actions.ANNOTATION,
8824
8702
  channel: channelName,
8825
8703
  annotations: [wireAnnotation]
8826
8704
  });
8827
- return _this79.channel.sendMessage(pm);
8705
+ return _this69.channel.sendMessage(pm);
8828
8706
  })();
8829
8707
  }
8830
8708
  delete(msgOrSerial, annotationValues) {
8831
- var _this80 = this;
8709
+ var _this70 = this;
8832
8710
  return _asyncToGenerator(function* () {
8833
8711
  annotationValues.action = "annotation.delete";
8834
- return _this80.publish(msgOrSerial, annotationValues);
8712
+ return _this70.publish(msgOrSerial, annotationValues);
8835
8713
  })();
8836
8714
  }
8837
8715
  subscribe() {
8838
8716
  var _arguments4 = arguments,
8839
- _this81 = this;
8717
+ _this71 = this;
8840
8718
  return _asyncToGenerator(function* () {
8841
8719
  for (var _len10 = _arguments4.length, _args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
8842
8720
  _args[_key10] = _arguments4[_key10];
@@ -8844,15 +8722,15 @@ var ably = {exports: {}};
8844
8722
  var args = realtimechannel_default.processListenerArgs(_args);
8845
8723
  var event = args[0];
8846
8724
  var listener = args[1];
8847
- var channel = _this81.channel;
8725
+ var channel = _this71.channel;
8848
8726
  if (channel.state === "failed") {
8849
8727
  throw _ErrorInfo2.fromValues(channel.invalidStateError());
8850
8728
  }
8851
- _this81.subscriptions.on(event, listener);
8852
- if (_this81.channel.channelOptions.attachOnSubscribe !== false) {
8729
+ _this71.subscriptions.on(event, listener);
8730
+ if (_this71.channel.channelOptions.attachOnSubscribe !== false) {
8853
8731
  yield channel.attach();
8854
8732
  }
8855
- if ((_this81.channel.state === "attached" && _this81.channel._mode & flags.ANNOTATION_SUBSCRIBE) === 0) {
8733
+ if ((_this71.channel.state === "attached" && _this71.channel._mode & flags.ANNOTATION_SUBSCRIBE) === 0) {
8856
8734
  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);
8857
8735
  }
8858
8736
  })();
@@ -8872,9 +8750,9 @@ var ably = {exports: {}};
8872
8750
  }
8873
8751
  }
8874
8752
  get(msgOrSerial, params) {
8875
- var _this82 = this;
8753
+ var _this72 = this;
8876
8754
  return _asyncToGenerator(function* () {
8877
- return restannotations_default.prototype.get.call(_this82, msgOrSerial, params);
8755
+ return restannotations_default.prototype.get.call(_this72, msgOrSerial, params);
8878
8756
  })();
8879
8757
  }
8880
8758
  };
@@ -10536,23 +10414,23 @@ var ably = {exports: {}};
10536
10414
  }
10537
10415
  }
10538
10416
  processChannelMessage(message) {
10539
- var _this83 = this;
10417
+ var _this73 = this;
10540
10418
  return _asyncToGenerator(function* () {
10541
- yield _this83.realtime.channels.processChannelMessage(message);
10419
+ yield _this73.realtime.channels.processChannelMessage(message);
10542
10420
  })();
10543
10421
  }
10544
10422
  ping() {
10545
- var _this84 = this;
10423
+ var _this74 = this;
10546
10424
  return _asyncToGenerator(function* () {
10547
10425
  var _a2;
10548
- if (_this84.state.state !== "connected") {
10426
+ if (_this74.state.state !== "connected") {
10549
10427
  throw new _ErrorInfo2("Unable to ping service; not connected", 4e4, 400);
10550
10428
  }
10551
- var transport = (_a2 = _this84.activeProtocol) == null ? void 0 : _a2.getTransport();
10429
+ var transport = (_a2 = _this74.activeProtocol) == null ? void 0 : _a2.getTransport();
10552
10430
  if (!transport) {
10553
- throw _this84.getStateError();
10431
+ throw _this74.getStateError();
10554
10432
  }
10555
- logger_default.logAction(_this84.logger, logger_default.LOG_MINOR, "ConnectionManager.ping()", "transport = " + transport);
10433
+ logger_default.logAction(_this74.logger, logger_default.LOG_MINOR, "ConnectionManager.ping()", "transport = " + transport);
10556
10434
  var pingStart = Date.now();
10557
10435
  var id = _cheapRandStr();
10558
10436
  return _withTimeoutAsync(new Promise(resolve => {
@@ -10564,7 +10442,7 @@ var ably = {exports: {}};
10564
10442
  };
10565
10443
  transport.on("heartbeat", onHeartbeat);
10566
10444
  transport.ping(id);
10567
- }), _this84.options.timeouts.realtimeRequestTimeout, "Timeout waiting for heartbeat response");
10445
+ }), _this74.options.timeouts.realtimeRequestTimeout, "Timeout waiting for heartbeat response");
10568
10446
  })();
10569
10447
  }
10570
10448
  abort(error) {
@@ -10713,10 +10591,10 @@ var ably = {exports: {}};
10713
10591
  });
10714
10592
  }
10715
10593
  ping() {
10716
- var _this85 = this;
10594
+ var _this75 = this;
10717
10595
  return _asyncToGenerator(function* () {
10718
- logger_default.logAction(_this85.logger, logger_default.LOG_MINOR, "Connection.ping()", "");
10719
- return _this85.connectionManager.ping();
10596
+ logger_default.logAction(_this75.logger, logger_default.LOG_MINOR, "Connection.ping()", "");
10597
+ return _this75.connectionManager.ping();
10720
10598
  })();
10721
10599
  }
10722
10600
  close() {
@@ -10772,9 +10650,6 @@ var ably = {exports: {}};
10772
10650
  get channels() {
10773
10651
  return this._channels;
10774
10652
  }
10775
- get clientId() {
10776
- return this.auth.clientId;
10777
- }
10778
10653
  connect() {
10779
10654
  logger_default.logAction(this.logger, logger_default.LOG_MINOR, "Realtime.connect()", "");
10780
10655
  this.connection.connect();
@@ -10815,16 +10690,16 @@ var ably = {exports: {}};
10815
10690
  }
10816
10691
  // Access to this method is synchronised by ConnectionManager#processChannelMessage.
10817
10692
  processChannelMessage(msg) {
10818
- var _this86 = this;
10693
+ var _this76 = this;
10819
10694
  return _asyncToGenerator(function* () {
10820
10695
  var channelName = msg.channel;
10821
10696
  if (channelName === void 0) {
10822
- logger_default.logAction(_this86.logger, logger_default.LOG_ERROR, "Channels.processChannelMessage()", "received event unspecified channel, action = " + msg.action);
10697
+ logger_default.logAction(_this76.logger, logger_default.LOG_ERROR, "Channels.processChannelMessage()", "received event unspecified channel, action = " + msg.action);
10823
10698
  return;
10824
10699
  }
10825
- var channel = _this86.all[channelName];
10700
+ var channel = _this76.all[channelName];
10826
10701
  if (!channel) {
10827
- logger_default.logAction(_this86.logger, logger_default.LOG_ERROR, "Channels.processChannelMessage()", "received event for non-existent channel: " + channelName);
10702
+ logger_default.logAction(_this76.logger, logger_default.LOG_ERROR, "Channels.processChannelMessage()", "received event for non-existent channel: " + channelName);
10828
10703
  return;
10829
10704
  }
10830
10705
  yield channel.processMessage(msg);
@@ -11079,43 +10954,43 @@ var ably = {exports: {}};
11079
10954
  this.pendingPresence = [];
11080
10955
  }
11081
10956
  enter(data) {
11082
- var _this87 = this;
10957
+ var _this77 = this;
11083
10958
  return _asyncToGenerator(function* () {
11084
- if (isAnonymousOrWildcard(_this87)) {
10959
+ if (isAnonymousOrWildcard(_this77)) {
11085
10960
  throw new _ErrorInfo2("clientId must be specified to enter a presence channel", 40012, 400);
11086
10961
  }
11087
- return _this87._enterOrUpdateClient(void 0, void 0, data, "enter");
10962
+ return _this77._enterOrUpdateClient(void 0, void 0, data, "enter");
11088
10963
  })();
11089
10964
  }
11090
10965
  update(data) {
11091
- var _this88 = this;
10966
+ var _this78 = this;
11092
10967
  return _asyncToGenerator(function* () {
11093
- if (isAnonymousOrWildcard(_this88)) {
10968
+ if (isAnonymousOrWildcard(_this78)) {
11094
10969
  throw new _ErrorInfo2("clientId must be specified to update presence data", 40012, 400);
11095
10970
  }
11096
- return _this88._enterOrUpdateClient(void 0, void 0, data, "update");
10971
+ return _this78._enterOrUpdateClient(void 0, void 0, data, "update");
11097
10972
  })();
11098
10973
  }
11099
10974
  enterClient(clientId, data) {
11100
- var _this89 = this;
10975
+ var _this79 = this;
11101
10976
  return _asyncToGenerator(function* () {
11102
- return _this89._enterOrUpdateClient(void 0, clientId, data, "enter");
10977
+ return _this79._enterOrUpdateClient(void 0, clientId, data, "enter");
11103
10978
  })();
11104
10979
  }
11105
10980
  updateClient(clientId, data) {
11106
- var _this90 = this;
10981
+ var _this80 = this;
11107
10982
  return _asyncToGenerator(function* () {
11108
- return _this90._enterOrUpdateClient(void 0, clientId, data, "update");
10983
+ return _this80._enterOrUpdateClient(void 0, clientId, data, "update");
11109
10984
  })();
11110
10985
  }
11111
10986
  _enterOrUpdateClient(id, clientId, data, action) {
11112
- var _this91 = this;
10987
+ var _this81 = this;
11113
10988
  return _asyncToGenerator(function* () {
11114
- var channel = _this91.channel;
10989
+ var channel = _this81.channel;
11115
10990
  if (!channel.connectionManager.activeState()) {
11116
10991
  throw channel.connectionManager.getError();
11117
10992
  }
11118
- logger_default.logAction(_this91.logger, logger_default.LOG_MICRO, "RealtimePresence." + action + "Client()", "channel = " + channel.name + ", id = " + id + ", client = " + (clientId || "(implicit) " + getClientId(_this91)));
10993
+ logger_default.logAction(_this81.logger, logger_default.LOG_MICRO, "RealtimePresence." + action + "Client()", "channel = " + channel.name + ", id = " + id + ", client = " + (clientId || "(implicit) " + getClientId(_this81)));
11119
10994
  var presence = presencemessage_default.fromData(data);
11120
10995
  presence.action = action;
11121
10996
  if (id) {
@@ -11133,7 +11008,7 @@ var ably = {exports: {}};
11133
11008
  channel.attach();
11134
11009
  case "attaching":
11135
11010
  return new Promise((resolve, reject) => {
11136
- _this91.pendingPresence.push({
11011
+ _this81.pendingPresence.push({
11137
11012
  presence: wirePresMsg,
11138
11013
  callback: err => err ? reject(err) : resolve()
11139
11014
  });
@@ -11148,22 +11023,22 @@ var ably = {exports: {}};
11148
11023
  })();
11149
11024
  }
11150
11025
  leave(data) {
11151
- var _this92 = this;
11026
+ var _this82 = this;
11152
11027
  return _asyncToGenerator(function* () {
11153
- if (isAnonymousOrWildcard(_this92)) {
11028
+ if (isAnonymousOrWildcard(_this82)) {
11154
11029
  throw new _ErrorInfo2("clientId must have been specified to enter or leave a presence channel", 40012, 400);
11155
11030
  }
11156
- return _this92.leaveClient(void 0, data);
11031
+ return _this82.leaveClient(void 0, data);
11157
11032
  })();
11158
11033
  }
11159
11034
  leaveClient(clientId, data) {
11160
- var _this93 = this;
11035
+ var _this83 = this;
11161
11036
  return _asyncToGenerator(function* () {
11162
- var channel = _this93.channel;
11037
+ var channel = _this83.channel;
11163
11038
  if (!channel.connectionManager.activeState()) {
11164
11039
  throw channel.connectionManager.getError();
11165
11040
  }
11166
- logger_default.logAction(_this93.logger, logger_default.LOG_MICRO, "RealtimePresence.leaveClient()", "leaving; channel = " + _this93.channel.name + ", client = " + clientId);
11041
+ logger_default.logAction(_this83.logger, logger_default.LOG_MICRO, "RealtimePresence.leaveClient()", "leaving; channel = " + _this83.channel.name + ", client = " + clientId);
11167
11042
  var presence = presencemessage_default.fromData(data);
11168
11043
  presence.action = "leave";
11169
11044
  if (clientId) {
@@ -11175,7 +11050,7 @@ var ably = {exports: {}};
11175
11050
  return channel.sendPresence([wirePresMsg]);
11176
11051
  case "attaching":
11177
11052
  return new Promise((resolve, reject) => {
11178
- _this93.pendingPresence.push({
11053
+ _this83.pendingPresence.push({
11179
11054
  presence: wirePresMsg,
11180
11055
  callback: err => err ? reject(err) : resolve()
11181
11056
  });
@@ -11191,14 +11066,14 @@ var ably = {exports: {}};
11191
11066
  })();
11192
11067
  }
11193
11068
  get(params) {
11194
- var _this94 = this;
11069
+ var _this84 = this;
11195
11070
  return _asyncToGenerator(function* () {
11196
11071
  var waitForSync = !params || ("waitForSync" in params ? params.waitForSync : true);
11197
11072
  return new Promise((resolve, reject) => {
11198
11073
  function returnMembers(members) {
11199
11074
  resolve(params ? members.list(params) : members.values());
11200
11075
  }
11201
- if (_this94.channel.state === "suspended") {
11076
+ if (_this84.channel.state === "suspended") {
11202
11077
  if (waitForSync) {
11203
11078
  reject(_ErrorInfo2.fromValues({
11204
11079
  statusCode: 400,
@@ -11206,12 +11081,12 @@ var ably = {exports: {}};
11206
11081
  message: "Presence state is out of sync due to channel being in the SUSPENDED state"
11207
11082
  }));
11208
11083
  } else {
11209
- returnMembers(_this94.members);
11084
+ returnMembers(_this84.members);
11210
11085
  }
11211
11086
  return;
11212
11087
  }
11213
- waitAttached(_this94.channel, err => reject(err), () => {
11214
- var members = _this94.members;
11088
+ waitAttached(_this84.channel, err => reject(err), () => {
11089
+ var members = _this84.members;
11215
11090
  if (waitForSync) {
11216
11091
  members.waitSync(function () {
11217
11092
  returnMembers(members);
@@ -11224,19 +11099,19 @@ var ably = {exports: {}};
11224
11099
  })();
11225
11100
  }
11226
11101
  history(params) {
11227
- var _this95 = this;
11102
+ var _this85 = this;
11228
11103
  return _asyncToGenerator(function* () {
11229
- logger_default.logAction(_this95.logger, logger_default.LOG_MICRO, "RealtimePresence.history()", "channel = " + _this95.name);
11230
- var restMixin = _this95.channel.client.rest.presenceMixin;
11104
+ logger_default.logAction(_this85.logger, logger_default.LOG_MICRO, "RealtimePresence.history()", "channel = " + _this85.name);
11105
+ var restMixin = _this85.channel.client.rest.presenceMixin;
11231
11106
  if (params && params.untilAttach) {
11232
- if (_this95.channel.state === "attached") {
11107
+ if (_this85.channel.state === "attached") {
11233
11108
  delete params.untilAttach;
11234
- params.from_serial = _this95.channel.properties.attachSerial;
11109
+ params.from_serial = _this85.channel.properties.attachSerial;
11235
11110
  } else {
11236
- throw new _ErrorInfo2("option untilAttach requires the channel to be attached, was: " + _this95.channel.state, 4e4, 400);
11111
+ throw new _ErrorInfo2("option untilAttach requires the channel to be attached, was: " + _this85.channel.state, 4e4, 400);
11237
11112
  }
11238
11113
  }
11239
- return restMixin.history(_this95, params);
11114
+ return restMixin.history(_this85, params);
11240
11115
  })();
11241
11116
  }
11242
11117
  setPresence(presenceSet, isSync, syncChannelSerial) {
@@ -11364,7 +11239,7 @@ var ably = {exports: {}};
11364
11239
  }
11365
11240
  subscribe() {
11366
11241
  var _arguments5 = arguments,
11367
- _this96 = this;
11242
+ _this86 = this;
11368
11243
  return _asyncToGenerator(function* () {
11369
11244
  for (var _len12 = _arguments5.length, _args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
11370
11245
  _args[_key12] = _arguments5[_key12];
@@ -11372,11 +11247,11 @@ var ably = {exports: {}};
11372
11247
  var args = realtimechannel_default.processListenerArgs(_args);
11373
11248
  var event = args[0];
11374
11249
  var listener = args[1];
11375
- var channel = _this96.channel;
11250
+ var channel = _this86.channel;
11376
11251
  if (channel.state === "failed") {
11377
11252
  throw _ErrorInfo2.fromValues(channel.invalidStateError());
11378
11253
  }
11379
- _this96.subscriptions.on(event, listener);
11254
+ _this86.subscriptions.on(event, listener);
11380
11255
  if (channel.channelOptions.attachOnSubscribe !== false) {
11381
11256
  yield channel.attach();
11382
11257
  }
@@ -11548,8 +11423,8 @@ var ably = {exports: {}};
11548
11423
  isRef: !!((_f = (_e = m.extras) == null ? void 0 : _e.ref) == null ? void 0 : _f.timeserial),
11549
11424
  clientId: m.clientId
11550
11425
  };
11551
- if (Object.entries(filter).find(_ref12 => {
11552
- var [key, value] = _ref12;
11426
+ if (Object.entries(filter).find(_ref10 => {
11427
+ var [key, value] = _ref10;
11553
11428
  return value !== void 0 ? mapping[key] !== value : false;
11554
11429
  })) {
11555
11430
  return;
@@ -11577,8 +11452,8 @@ var ably = {exports: {}};
11577
11452
  return [];
11578
11453
  }
11579
11454
  if (!realListener && filter) {
11580
- return Array.from(channel.filteredSubscriptions.entries()).map(_ref13 => {
11581
- var [key, filterMaps] = _ref13;
11455
+ return Array.from(channel.filteredSubscriptions.entries()).map(_ref11 => {
11456
+ var [key, filterMaps] = _ref11;
11582
11457
  var _a2;
11583
11458
  var listenerMaps = filterMaps.get(filter);
11584
11459
  filterMaps.delete(filter);
@@ -12050,38 +11925,38 @@ var ably = {exports: {}};
12050
11925
  return output;
12051
11926
  }
12052
11927
  encrypt(plaintext) {
12053
- var _this97 = this;
11928
+ var _this87 = this;
12054
11929
  return _asyncToGenerator(function* () {
12055
- logger_default.logAction(_this97.logger, logger_default.LOG_MICRO, "CBCCipher.encrypt()", "");
12056
- var iv = yield _this97.getIv();
12057
- var cryptoKey = yield crypto.subtle.importKey("raw", _this97.key, _this97.webCryptoAlgorithm, false, ["encrypt"]);
11930
+ logger_default.logAction(_this87.logger, logger_default.LOG_MICRO, "CBCCipher.encrypt()", "");
11931
+ var iv = yield _this87.getIv();
11932
+ var cryptoKey = yield crypto.subtle.importKey("raw", _this87.key, _this87.webCryptoAlgorithm, false, ["encrypt"]);
12058
11933
  var ciphertext = yield crypto.subtle.encrypt({
12059
- name: _this97.webCryptoAlgorithm,
11934
+ name: _this87.webCryptoAlgorithm,
12060
11935
  iv
12061
11936
  }, cryptoKey, plaintext);
12062
- return _this97.concat(iv, ciphertext);
11937
+ return _this87.concat(iv, ciphertext);
12063
11938
  })();
12064
11939
  }
12065
11940
  decrypt(ciphertext) {
12066
- var _this98 = this;
11941
+ var _this88 = this;
12067
11942
  return _asyncToGenerator(function* () {
12068
- logger_default.logAction(_this98.logger, logger_default.LOG_MICRO, "CBCCipher.decrypt()", "");
11943
+ logger_default.logAction(_this88.logger, logger_default.LOG_MICRO, "CBCCipher.decrypt()", "");
12069
11944
  var ciphertextArrayBuffer = bufferUtils.toArrayBuffer(ciphertext);
12070
11945
  var iv = ciphertextArrayBuffer.slice(0, DEFAULT_BLOCKLENGTH);
12071
11946
  var ciphertextBody = ciphertextArrayBuffer.slice(DEFAULT_BLOCKLENGTH);
12072
- var cryptoKey = yield crypto.subtle.importKey("raw", _this98.key, _this98.webCryptoAlgorithm, false, ["decrypt"]);
11947
+ var cryptoKey = yield crypto.subtle.importKey("raw", _this88.key, _this88.webCryptoAlgorithm, false, ["decrypt"]);
12073
11948
  return crypto.subtle.decrypt({
12074
- name: _this98.webCryptoAlgorithm,
11949
+ name: _this88.webCryptoAlgorithm,
12075
11950
  iv
12076
11951
  }, cryptoKey, ciphertextBody);
12077
11952
  })();
12078
11953
  }
12079
11954
  getIv() {
12080
- var _this99 = this;
11955
+ var _this89 = this;
12081
11956
  return _asyncToGenerator(function* () {
12082
- if (_this99.iv) {
12083
- var iv = _this99.iv;
12084
- _this99.iv = null;
11957
+ if (_this89.iv) {
11958
+ var iv = _this89.iv;
11959
+ _this89.iv = null;
12085
11960
  return iv;
12086
11961
  }
12087
11962
  var randomBlock = yield config.getRandomArrayBuffer(DEFAULT_BLOCKLENGTH);
@@ -12128,7 +12003,7 @@ var ably = {exports: {}};
12128
12003
  if (Platform.Config.xhrSupported && xhrRequestImplementation) {
12129
12004
  this.supportsAuthHeaders = true;
12130
12005
  this.Request = /*#__PURE__*/function () {
12131
- var _ref14 = _asyncToGenerator(function* (method, uri, headers, params, body) {
12006
+ var _ref12 = _asyncToGenerator(function* (method, uri, headers, params, body) {
12132
12007
  return new Promise(resolve => {
12133
12008
  var _a3;
12134
12009
  var req = xhrRequestImplementation.createRequest(uri, headers, params, body, XHRStates_default.REQ_SEND, (_a3 = client && client.options.timeouts) != null ? _a3 : null, this.logger, method);
@@ -12142,8 +12017,8 @@ var ably = {exports: {}};
12142
12017
  req.exec();
12143
12018
  });
12144
12019
  });
12145
- return function (_x88, _x89, _x90, _x91, _x92) {
12146
- return _ref14.apply(this, arguments);
12020
+ return function (_x82, _x83, _x84, _x85, _x86) {
12021
+ return _ref12.apply(this, arguments);
12147
12022
  };
12148
12023
  }();
12149
12024
  if (client == null ? void 0 : client.options.disableConnectivityCheck) {
@@ -12168,11 +12043,11 @@ var ably = {exports: {}};
12168
12043
  } else if (Platform.Config.fetchSupported && fetchRequestImplementation) {
12169
12044
  this.supportsAuthHeaders = true;
12170
12045
  this.Request = /*#__PURE__*/function () {
12171
- var _ref17 = _asyncToGenerator(function* (method, uri, headers, params, body) {
12046
+ var _ref15 = _asyncToGenerator(function* (method, uri, headers, params, body) {
12172
12047
  return fetchRequestImplementation(method, client != null ? client : null, uri, headers, params, body);
12173
12048
  });
12174
- return function (_x93, _x94, _x95, _x96, _x97) {
12175
- return _ref17.apply(this, arguments);
12049
+ return function (_x87, _x88, _x89, _x90, _x91) {
12050
+ return _ref15.apply(this, arguments);
12176
12051
  };
12177
12052
  }();
12178
12053
  if (client == null ? void 0 : client.options.disableConnectivityCheck) {
@@ -12203,14 +12078,14 @@ var ably = {exports: {}};
12203
12078
  return (_b = (_a2 = this.client) == null ? void 0 : _a2.logger) != null ? _b : logger_default.defaultLogger;
12204
12079
  }
12205
12080
  doUri(method, uri, headers, body, params) {
12206
- var _this100 = this;
12081
+ var _this90 = this;
12207
12082
  return _asyncToGenerator(function* () {
12208
- if (!_this100.Request) {
12083
+ if (!_this90.Request) {
12209
12084
  return {
12210
12085
  error: new PartialErrorInfo("Request invoked before assigned to", null, 500)
12211
12086
  };
12212
12087
  }
12213
- return _this100.Request(method, uri, headers, params, body);
12088
+ return _this90.Request(method, uri, headers, params, body);
12214
12089
  })();
12215
12090
  }
12216
12091
  shouldFallback(errorInfo) {
@@ -12340,7 +12215,7 @@ var ably = {exports: {}};
12340
12215
  globalObject4.crypto.getRandomValues(byteArray);
12341
12216
  return byteArray.buffer;
12342
12217
  });
12343
- function getRandomArrayBuffer(_x98) {
12218
+ function getRandomArrayBuffer(_x92) {
12344
12219
  return _getRandomArrayBuffer.apply(this, arguments);
12345
12220
  }
12346
12221
  return getRandomArrayBuffer;
@@ -13485,7 +13360,7 @@ var ably = {exports: {}};
13485
13360
  });
13486
13361
  return result;
13487
13362
  }
13488
- function fetchRequest(_x99, _x100, _x101, _x102, _x103, _x104) {
13363
+ function fetchRequest(_x93, _x94, _x95, _x96, _x97, _x98) {
13489
13364
  return _fetchRequest.apply(this, arguments);
13490
13365
  } // src/platform/web/lib/http/request/index.ts
13491
13366
  function _fetchRequest() {
@@ -13616,7 +13491,7 @@ var ably = {exports: {}};
13616
13491
  })(ably);
13617
13492
 
13618
13493
  class ClientAblyService {
13619
- static startConnection(sessionId, ablyToken, onMessageReceived, tenantId) {
13494
+ static startConnection(sessionId, ablyToken, onMessageReceived, tenantId, onActionReceived) {
13620
13495
  var _this = this;
13621
13496
  return _asyncToGenerator(function* () {
13622
13497
  // Prevent multiple connections
@@ -13680,6 +13555,8 @@ class ClientAblyService {
13680
13555
  }
13681
13556
  }, 10000);
13682
13557
  });
13558
+ // Store optional action handler for this connection
13559
+ _this.onActionReceived = onActionReceived !== null && onActionReceived !== void 0 ? onActionReceived : null;
13683
13560
  // Subscribe to the session room
13684
13561
  yield _this.joinChannel(sessionId, onMessageReceived, tenantId);
13685
13562
  } catch (error) {
@@ -13715,13 +13592,15 @@ class ClientAblyService {
13715
13592
  });
13716
13593
  // Subscribe to assistant/system responses
13717
13594
  _this2.channel.subscribe('ReceiveMessage', message => {
13718
- var _a, _b, _c, _d, _e, _f, _g, _h;
13595
+ var _a, _b;
13719
13596
  try {
13720
13597
  // Ensure messageContent is always a string (default to empty string if undefined)
13721
- 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 : '';
13722
- var senderType = ((_e = message.data) === null || _e === void 0 ? void 0 : _e.senderType) || 3; // Assistant
13723
- 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;
13724
- var attachments = ((_h = message.data) === null || _h === void 0 ? void 0 : _h.attachments) || [];
13598
+ var rawData = message.data;
13599
+ 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 : '';
13600
+ var senderType = (rawData === null || rawData === void 0 ? void 0 : rawData.senderType) || 3; // Assistant
13601
+ var needsAgent = (rawData === null || rawData === void 0 ? void 0 : rawData.needsAgent) || (rawData === null || rawData === void 0 ? void 0 : rawData.actionType) == 'needs_agent' || false;
13602
+ var attachments = (rawData === null || rawData === void 0 ? void 0 : rawData.attachments) || [];
13603
+ var actionType = rawData && typeof rawData.actionType === 'string' ? rawData.actionType : '';
13725
13604
  // Extract downloadUrl from attachments (Ably now returns downloadUrl directly)
13726
13605
  // Attachments can be: strings (URLs), objects with downloadUrl, or objects with id
13727
13606
  var attachmentUrls = attachments.map(attachment => {
@@ -13738,6 +13617,18 @@ class ClientAblyService {
13738
13617
  // If it's an object with id, we'll need to keep it for backward compatibility
13739
13618
  return null;
13740
13619
  }).filter(url => url !== null);
13620
+ // Invoke optional action handler first (non-blocking for message processing)
13621
+ if (_this2.onActionReceived && actionType !== undefined) {
13622
+ try {
13623
+ void _this2.onActionReceived(actionType, rawData);
13624
+ } catch (actionError) {
13625
+ console.error('[AblyService] Error in action handler callback', {
13626
+ error: actionError,
13627
+ actionType,
13628
+ rawData
13629
+ });
13630
+ }
13631
+ }
13741
13632
  onMessageReceived(messageContent, senderType, needsAgent, attachmentUrls);
13742
13633
  } catch (error) {
13743
13634
  console.error('[AblyService] Error processing message', {
@@ -13772,6 +13663,7 @@ class ClientAblyService {
13772
13663
  }
13773
13664
  _this3.isConnected = false;
13774
13665
  _this3.sessionId = null;
13666
+ _this3.onActionReceived = null;
13775
13667
  } catch (error) {
13776
13668
  console.error('[AblyService] Error in stopConnection', {
13777
13669
  error
@@ -13821,6 +13713,7 @@ ClientAblyService.channel = null;
13821
13713
  ClientAblyService.isConnected = false;
13822
13714
  ClientAblyService.sessionId = null;
13823
13715
  ClientAblyService.messageUnsubscribe = null;
13716
+ ClientAblyService.onActionReceived = null;
13824
13717
 
13825
13718
  class TokenService {
13826
13719
  constructor(baseUrl) {