pusher-js 8.0.2 → 8.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Pusher JavaScript Library v8.0.2
2
+ * Pusher JavaScript Library v8.1.0
3
3
  * https://pusher.com/
4
4
  *
5
5
  * Copyright 2020, Pusher
@@ -7189,6 +7189,9 @@ module.exports = require("https");
7189
7189
  // ESM COMPAT FLAG
7190
7190
  __webpack_require__.r(__webpack_exports__);
7191
7191
 
7192
+ // EXPORTS
7193
+ __webpack_require__.d(__webpack_exports__, "default", function() { return /* binding */ pusher_with_encryption_PusherWithEncryption; });
7194
+
7192
7195
  // CONCATENATED MODULE: ./src/core/base64.ts
7193
7196
  function encode(s) {
7194
7197
  return btoa(utob(s));
@@ -7231,43 +7234,28 @@ var btoa = global.btoa ||
7231
7234
  };
7232
7235
 
7233
7236
  // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
7234
- var Timer = (function () {
7235
- function Timer(set, clear, delay, callback) {
7236
- var _this = this;
7237
+ class Timer {
7238
+ constructor(set, clear, delay, callback) {
7237
7239
  this.clear = clear;
7238
- this.timer = set(function () {
7239
- if (_this.timer) {
7240
- _this.timer = callback(_this.timer);
7240
+ this.timer = set(() => {
7241
+ if (this.timer) {
7242
+ this.timer = callback(this.timer);
7241
7243
  }
7242
7244
  }, delay);
7243
7245
  }
7244
- Timer.prototype.isRunning = function () {
7246
+ isRunning() {
7245
7247
  return this.timer !== null;
7246
- };
7247
- Timer.prototype.ensureAborted = function () {
7248
+ }
7249
+ ensureAborted() {
7248
7250
  if (this.timer) {
7249
7251
  this.clear(this.timer);
7250
7252
  this.timer = null;
7251
7253
  }
7252
- };
7253
- return Timer;
7254
- }());
7254
+ }
7255
+ }
7255
7256
  /* harmony default export */ var abstract_timer = (Timer);
7256
7257
 
7257
7258
  // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
7258
- var __extends = (undefined && undefined.__extends) || (function () {
7259
- var extendStatics = function (d, b) {
7260
- extendStatics = Object.setPrototypeOf ||
7261
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7262
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7263
- return extendStatics(d, b);
7264
- };
7265
- return function (d, b) {
7266
- extendStatics(d, b);
7267
- function __() { this.constructor = d; }
7268
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7269
- };
7270
- })();
7271
7259
 
7272
7260
  function timers_clearTimeout(timer) {
7273
7261
  global.clearTimeout(timer);
@@ -7275,33 +7263,27 @@ function timers_clearTimeout(timer) {
7275
7263
  function timers_clearInterval(timer) {
7276
7264
  global.clearInterval(timer);
7277
7265
  }
7278
- var OneOffTimer = (function (_super) {
7279
- __extends(OneOffTimer, _super);
7280
- function OneOffTimer(delay, callback) {
7281
- return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
7266
+ class timers_OneOffTimer extends abstract_timer {
7267
+ constructor(delay, callback) {
7268
+ super(setTimeout, timers_clearTimeout, delay, function (timer) {
7282
7269
  callback();
7283
7270
  return null;
7284
- }) || this;
7271
+ });
7285
7272
  }
7286
- return OneOffTimer;
7287
- }(abstract_timer));
7288
-
7289
- var PeriodicTimer = (function (_super) {
7290
- __extends(PeriodicTimer, _super);
7291
- function PeriodicTimer(delay, callback) {
7292
- return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
7273
+ }
7274
+ class timers_PeriodicTimer extends abstract_timer {
7275
+ constructor(delay, callback) {
7276
+ super(setInterval, timers_clearInterval, delay, function (timer) {
7293
7277
  callback();
7294
7278
  return timer;
7295
- }) || this;
7279
+ });
7296
7280
  }
7297
- return PeriodicTimer;
7298
- }(abstract_timer));
7299
-
7281
+ }
7300
7282
 
7301
7283
  // CONCATENATED MODULE: ./src/core/util.ts
7302
7284
 
7303
7285
  var Util = {
7304
- now: function () {
7286
+ now() {
7305
7287
  if (Date.now) {
7306
7288
  return Date.now();
7307
7289
  }
@@ -7309,14 +7291,10 @@ var Util = {
7309
7291
  return new Date().valueOf();
7310
7292
  }
7311
7293
  },
7312
- defer: function (callback) {
7313
- return new OneOffTimer(0, callback);
7294
+ defer(callback) {
7295
+ return new timers_OneOffTimer(0, callback);
7314
7296
  },
7315
- method: function (name) {
7316
- var args = [];
7317
- for (var _i = 1; _i < arguments.length; _i++) {
7318
- args[_i - 1] = arguments[_i];
7319
- }
7297
+ method(name, ...args) {
7320
7298
  var boundArguments = Array.prototype.slice.call(arguments, 1);
7321
7299
  return function (object) {
7322
7300
  return object[name].apply(object, boundArguments.concat(arguments));
@@ -7328,11 +7306,7 @@ var Util = {
7328
7306
  // CONCATENATED MODULE: ./src/core/utils/collections.ts
7329
7307
 
7330
7308
 
7331
- function extend(target) {
7332
- var sources = [];
7333
- for (var _i = 1; _i < arguments.length; _i++) {
7334
- sources[_i - 1] = arguments[_i];
7335
- }
7309
+ function extend(target, ...sources) {
7336
7310
  for (var i = 0; i < sources.length; i++) {
7337
7311
  var extensions = sources[i];
7338
7312
  for (var property in extensions) {
@@ -7525,7 +7499,7 @@ function safeJSONStringify(source) {
7525
7499
 
7526
7500
  // CONCATENATED MODULE: ./src/core/defaults.ts
7527
7501
  var Defaults = {
7528
- VERSION: "8.0.2",
7502
+ VERSION: "8.1.0",
7529
7503
  PROTOCOL: 7,
7530
7504
  wsPort: 80,
7531
7505
  wssPort: 443,
@@ -7594,14 +7568,14 @@ var sockjs = {
7594
7568
 
7595
7569
  // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
7596
7570
 
7597
- var callback_registry_CallbackRegistry = (function () {
7598
- function CallbackRegistry() {
7571
+ class callback_registry_CallbackRegistry {
7572
+ constructor() {
7599
7573
  this._callbacks = {};
7600
7574
  }
7601
- CallbackRegistry.prototype.get = function (name) {
7575
+ get(name) {
7602
7576
  return this._callbacks[prefix(name)];
7603
- };
7604
- CallbackRegistry.prototype.add = function (name, callback, context) {
7577
+ }
7578
+ add(name, callback, context) {
7605
7579
  var prefixedEventName = prefix(name);
7606
7580
  this._callbacks[prefixedEventName] =
7607
7581
  this._callbacks[prefixedEventName] || [];
@@ -7609,8 +7583,8 @@ var callback_registry_CallbackRegistry = (function () {
7609
7583
  fn: callback,
7610
7584
  context: context
7611
7585
  });
7612
- };
7613
- CallbackRegistry.prototype.remove = function (name, callback, context) {
7586
+ }
7587
+ remove(name, callback, context) {
7614
7588
  if (!name && !callback && !context) {
7615
7589
  this._callbacks = {};
7616
7590
  return;
@@ -7622,8 +7596,8 @@ var callback_registry_CallbackRegistry = (function () {
7622
7596
  else {
7623
7597
  this.removeAllCallbacks(names);
7624
7598
  }
7625
- };
7626
- CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
7599
+ }
7600
+ removeCallback(names, callback, context) {
7627
7601
  apply(names, function (name) {
7628
7602
  this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
7629
7603
  return ((callback && callback !== binding.fn) ||
@@ -7633,15 +7607,13 @@ var callback_registry_CallbackRegistry = (function () {
7633
7607
  delete this._callbacks[name];
7634
7608
  }
7635
7609
  }, this);
7636
- };
7637
- CallbackRegistry.prototype.removeAllCallbacks = function (names) {
7610
+ }
7611
+ removeAllCallbacks(names) {
7638
7612
  apply(names, function (name) {
7639
7613
  delete this._callbacks[name];
7640
7614
  }, this);
7641
- };
7642
- return CallbackRegistry;
7643
- }());
7644
- /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
7615
+ }
7616
+ }
7645
7617
  function prefix(name) {
7646
7618
  return '_' + name;
7647
7619
  }
@@ -7649,38 +7621,38 @@ function prefix(name) {
7649
7621
  // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
7650
7622
 
7651
7623
 
7652
- var dispatcher_Dispatcher = (function () {
7653
- function Dispatcher(failThrough) {
7654
- this.callbacks = new callback_registry();
7624
+ class dispatcher_Dispatcher {
7625
+ constructor(failThrough) {
7626
+ this.callbacks = new callback_registry_CallbackRegistry();
7655
7627
  this.global_callbacks = [];
7656
7628
  this.failThrough = failThrough;
7657
7629
  }
7658
- Dispatcher.prototype.bind = function (eventName, callback, context) {
7630
+ bind(eventName, callback, context) {
7659
7631
  this.callbacks.add(eventName, callback, context);
7660
7632
  return this;
7661
- };
7662
- Dispatcher.prototype.bind_global = function (callback) {
7633
+ }
7634
+ bind_global(callback) {
7663
7635
  this.global_callbacks.push(callback);
7664
7636
  return this;
7665
- };
7666
- Dispatcher.prototype.unbind = function (eventName, callback, context) {
7637
+ }
7638
+ unbind(eventName, callback, context) {
7667
7639
  this.callbacks.remove(eventName, callback, context);
7668
7640
  return this;
7669
- };
7670
- Dispatcher.prototype.unbind_global = function (callback) {
7641
+ }
7642
+ unbind_global(callback) {
7671
7643
  if (!callback) {
7672
7644
  this.global_callbacks = [];
7673
7645
  return this;
7674
7646
  }
7675
- this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
7647
+ this.global_callbacks = filter(this.global_callbacks || [], c => c !== callback);
7676
7648
  return this;
7677
- };
7678
- Dispatcher.prototype.unbind_all = function () {
7649
+ }
7650
+ unbind_all() {
7679
7651
  this.unbind();
7680
7652
  this.unbind_global();
7681
7653
  return this;
7682
- };
7683
- Dispatcher.prototype.emit = function (eventName, data, metadata) {
7654
+ }
7655
+ emit(eventName, data, metadata) {
7684
7656
  for (var i = 0; i < this.global_callbacks.length; i++) {
7685
7657
  this.global_callbacks[i](eventName, data);
7686
7658
  }
@@ -7701,120 +7673,85 @@ var dispatcher_Dispatcher = (function () {
7701
7673
  this.failThrough(eventName, data);
7702
7674
  }
7703
7675
  return this;
7704
- };
7705
- return Dispatcher;
7706
- }());
7707
- /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
7676
+ }
7677
+ }
7708
7678
 
7709
7679
  // CONCATENATED MODULE: ./src/core/logger.ts
7710
7680
 
7711
7681
 
7712
- var logger_Logger = (function () {
7713
- function Logger() {
7714
- this.globalLog = function (message) {
7682
+ class logger_Logger {
7683
+ constructor() {
7684
+ this.globalLog = (message) => {
7715
7685
  if (global.console && global.console.log) {
7716
7686
  global.console.log(message);
7717
7687
  }
7718
7688
  };
7719
7689
  }
7720
- Logger.prototype.debug = function () {
7721
- var args = [];
7722
- for (var _i = 0; _i < arguments.length; _i++) {
7723
- args[_i] = arguments[_i];
7724
- }
7690
+ debug(...args) {
7725
7691
  this.log(this.globalLog, args);
7726
- };
7727
- Logger.prototype.warn = function () {
7728
- var args = [];
7729
- for (var _i = 0; _i < arguments.length; _i++) {
7730
- args[_i] = arguments[_i];
7731
- }
7692
+ }
7693
+ warn(...args) {
7732
7694
  this.log(this.globalLogWarn, args);
7733
- };
7734
- Logger.prototype.error = function () {
7735
- var args = [];
7736
- for (var _i = 0; _i < arguments.length; _i++) {
7737
- args[_i] = arguments[_i];
7738
- }
7695
+ }
7696
+ error(...args) {
7739
7697
  this.log(this.globalLogError, args);
7740
- };
7741
- Logger.prototype.globalLogWarn = function (message) {
7698
+ }
7699
+ globalLogWarn(message) {
7742
7700
  if (global.console && global.console.warn) {
7743
7701
  global.console.warn(message);
7744
7702
  }
7745
7703
  else {
7746
7704
  this.globalLog(message);
7747
7705
  }
7748
- };
7749
- Logger.prototype.globalLogError = function (message) {
7706
+ }
7707
+ globalLogError(message) {
7750
7708
  if (global.console && global.console.error) {
7751
7709
  global.console.error(message);
7752
7710
  }
7753
7711
  else {
7754
7712
  this.globalLogWarn(message);
7755
7713
  }
7756
- };
7757
- Logger.prototype.log = function (defaultLoggingFunction) {
7758
- var args = [];
7759
- for (var _i = 1; _i < arguments.length; _i++) {
7760
- args[_i - 1] = arguments[_i];
7761
- }
7714
+ }
7715
+ log(defaultLoggingFunction, ...args) {
7762
7716
  var message = stringify.apply(this, arguments);
7763
7717
  if (core_pusher.log) {
7764
7718
  core_pusher.log(message);
7765
7719
  }
7766
7720
  else if (core_pusher.logToConsole) {
7767
- var log = defaultLoggingFunction.bind(this);
7721
+ const log = defaultLoggingFunction.bind(this);
7768
7722
  log(message);
7769
7723
  }
7770
- };
7771
- return Logger;
7772
- }());
7724
+ }
7725
+ }
7773
7726
  /* harmony default export */ var logger = (new logger_Logger());
7774
7727
 
7775
7728
  // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
7776
- var transport_connection_extends = (undefined && undefined.__extends) || (function () {
7777
- var extendStatics = function (d, b) {
7778
- extendStatics = Object.setPrototypeOf ||
7779
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
7780
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7781
- return extendStatics(d, b);
7782
- };
7783
- return function (d, b) {
7784
- extendStatics(d, b);
7785
- function __() { this.constructor = d; }
7786
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7787
- };
7788
- })();
7789
7729
 
7790
7730
 
7791
7731
 
7792
7732
 
7793
7733
 
7794
- var transport_connection_TransportConnection = (function (_super) {
7795
- transport_connection_extends(TransportConnection, _super);
7796
- function TransportConnection(hooks, name, priority, key, options) {
7797
- var _this = _super.call(this) || this;
7798
- _this.initialize = node_runtime.transportConnectionInitializer;
7799
- _this.hooks = hooks;
7800
- _this.name = name;
7801
- _this.priority = priority;
7802
- _this.key = key;
7803
- _this.options = options;
7804
- _this.state = 'new';
7805
- _this.timeline = options.timeline;
7806
- _this.activityTimeout = options.activityTimeout;
7807
- _this.id = _this.timeline.generateUniqueID();
7808
- return _this;
7734
+ class transport_connection_TransportConnection extends dispatcher_Dispatcher {
7735
+ constructor(hooks, name, priority, key, options) {
7736
+ super();
7737
+ this.initialize = node_runtime.transportConnectionInitializer;
7738
+ this.hooks = hooks;
7739
+ this.name = name;
7740
+ this.priority = priority;
7741
+ this.key = key;
7742
+ this.options = options;
7743
+ this.state = 'new';
7744
+ this.timeline = options.timeline;
7745
+ this.activityTimeout = options.activityTimeout;
7746
+ this.id = this.timeline.generateUniqueID();
7809
7747
  }
7810
- TransportConnection.prototype.handlesActivityChecks = function () {
7748
+ handlesActivityChecks() {
7811
7749
  return Boolean(this.hooks.handlesActivityChecks);
7812
- };
7813
- TransportConnection.prototype.supportsPing = function () {
7750
+ }
7751
+ supportsPing() {
7814
7752
  return Boolean(this.hooks.supportsPing);
7815
- };
7816
- TransportConnection.prototype.connect = function () {
7817
- var _this = this;
7753
+ }
7754
+ connect() {
7818
7755
  if (this.socket || this.state !== 'initialized') {
7819
7756
  return false;
7820
7757
  }
@@ -7823,18 +7760,18 @@ var transport_connection_TransportConnection = (function (_super) {
7823
7760
  this.socket = this.hooks.getSocket(url, this.options);
7824
7761
  }
7825
7762
  catch (e) {
7826
- util.defer(function () {
7827
- _this.onError(e);
7828
- _this.changeState('closed');
7763
+ util.defer(() => {
7764
+ this.onError(e);
7765
+ this.changeState('closed');
7829
7766
  });
7830
7767
  return false;
7831
7768
  }
7832
7769
  this.bindListeners();
7833
- logger.debug('Connecting', { transport: this.name, url: url });
7770
+ logger.debug('Connecting', { transport: this.name, url });
7834
7771
  this.changeState('connecting');
7835
7772
  return true;
7836
- };
7837
- TransportConnection.prototype.close = function () {
7773
+ }
7774
+ close() {
7838
7775
  if (this.socket) {
7839
7776
  this.socket.close();
7840
7777
  return true;
@@ -7842,13 +7779,12 @@ var transport_connection_TransportConnection = (function (_super) {
7842
7779
  else {
7843
7780
  return false;
7844
7781
  }
7845
- };
7846
- TransportConnection.prototype.send = function (data) {
7847
- var _this = this;
7782
+ }
7783
+ send(data) {
7848
7784
  if (this.state === 'open') {
7849
- util.defer(function () {
7850
- if (_this.socket) {
7851
- _this.socket.send(data);
7785
+ util.defer(() => {
7786
+ if (this.socket) {
7787
+ this.socket.send(data);
7852
7788
  }
7853
7789
  });
7854
7790
  return true;
@@ -7856,24 +7792,24 @@ var transport_connection_TransportConnection = (function (_super) {
7856
7792
  else {
7857
7793
  return false;
7858
7794
  }
7859
- };
7860
- TransportConnection.prototype.ping = function () {
7795
+ }
7796
+ ping() {
7861
7797
  if (this.state === 'open' && this.supportsPing()) {
7862
7798
  this.socket.ping();
7863
7799
  }
7864
- };
7865
- TransportConnection.prototype.onOpen = function () {
7800
+ }
7801
+ onOpen() {
7866
7802
  if (this.hooks.beforeOpen) {
7867
7803
  this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
7868
7804
  }
7869
7805
  this.changeState('open');
7870
7806
  this.socket.onopen = undefined;
7871
- };
7872
- TransportConnection.prototype.onError = function (error) {
7807
+ }
7808
+ onError(error) {
7873
7809
  this.emit('error', { type: 'WebSocketError', error: error });
7874
7810
  this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
7875
- };
7876
- TransportConnection.prototype.onClose = function (closeEvent) {
7811
+ }
7812
+ onClose(closeEvent) {
7877
7813
  if (closeEvent) {
7878
7814
  this.changeState('closed', {
7879
7815
  code: closeEvent.code,
@@ -7886,34 +7822,33 @@ var transport_connection_TransportConnection = (function (_super) {
7886
7822
  }
7887
7823
  this.unbindListeners();
7888
7824
  this.socket = undefined;
7889
- };
7890
- TransportConnection.prototype.onMessage = function (message) {
7825
+ }
7826
+ onMessage(message) {
7891
7827
  this.emit('message', message);
7892
- };
7893
- TransportConnection.prototype.onActivity = function () {
7828
+ }
7829
+ onActivity() {
7894
7830
  this.emit('activity');
7895
- };
7896
- TransportConnection.prototype.bindListeners = function () {
7897
- var _this = this;
7898
- this.socket.onopen = function () {
7899
- _this.onOpen();
7831
+ }
7832
+ bindListeners() {
7833
+ this.socket.onopen = () => {
7834
+ this.onOpen();
7900
7835
  };
7901
- this.socket.onerror = function (error) {
7902
- _this.onError(error);
7836
+ this.socket.onerror = error => {
7837
+ this.onError(error);
7903
7838
  };
7904
- this.socket.onclose = function (closeEvent) {
7905
- _this.onClose(closeEvent);
7839
+ this.socket.onclose = closeEvent => {
7840
+ this.onClose(closeEvent);
7906
7841
  };
7907
- this.socket.onmessage = function (message) {
7908
- _this.onMessage(message);
7842
+ this.socket.onmessage = message => {
7843
+ this.onMessage(message);
7909
7844
  };
7910
7845
  if (this.supportsPing()) {
7911
- this.socket.onactivity = function () {
7912
- _this.onActivity();
7846
+ this.socket.onactivity = () => {
7847
+ this.onActivity();
7913
7848
  };
7914
7849
  }
7915
- };
7916
- TransportConnection.prototype.unbindListeners = function () {
7850
+ }
7851
+ unbindListeners() {
7917
7852
  if (this.socket) {
7918
7853
  this.socket.onopen = undefined;
7919
7854
  this.socket.onerror = undefined;
@@ -7923,44 +7858,40 @@ var transport_connection_TransportConnection = (function (_super) {
7923
7858
  this.socket.onactivity = undefined;
7924
7859
  }
7925
7860
  }
7926
- };
7927
- TransportConnection.prototype.changeState = function (state, params) {
7861
+ }
7862
+ changeState(state, params) {
7928
7863
  this.state = state;
7929
7864
  this.timeline.info(this.buildTimelineMessage({
7930
7865
  state: state,
7931
7866
  params: params
7932
7867
  }));
7933
7868
  this.emit(state, params);
7934
- };
7935
- TransportConnection.prototype.buildTimelineMessage = function (message) {
7869
+ }
7870
+ buildTimelineMessage(message) {
7936
7871
  return extend({ cid: this.id }, message);
7937
- };
7938
- return TransportConnection;
7939
- }(dispatcher));
7940
- /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
7872
+ }
7873
+ }
7941
7874
 
7942
7875
  // CONCATENATED MODULE: ./src/core/transports/transport.ts
7943
7876
 
7944
- var transport_Transport = (function () {
7945
- function Transport(hooks) {
7877
+ class transport_Transport {
7878
+ constructor(hooks) {
7946
7879
  this.hooks = hooks;
7947
7880
  }
7948
- Transport.prototype.isSupported = function (environment) {
7881
+ isSupported(environment) {
7949
7882
  return this.hooks.isSupported(environment);
7950
- };
7951
- Transport.prototype.createConnection = function (name, priority, key, options) {
7952
- return new transport_connection(this.hooks, name, priority, key, options);
7953
- };
7954
- return Transport;
7955
- }());
7956
- /* harmony default export */ var transports_transport = (transport_Transport);
7883
+ }
7884
+ createConnection(name, priority, key, options) {
7885
+ return new transport_connection_TransportConnection(this.hooks, name, priority, key, options);
7886
+ }
7887
+ }
7957
7888
 
7958
7889
  // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
7959
7890
 
7960
7891
 
7961
7892
 
7962
7893
 
7963
- var WSTransport = new transports_transport({
7894
+ var WSTransport = new transport_Transport({
7964
7895
  urls: ws,
7965
7896
  handlesActivityChecks: false,
7966
7897
  supportsPing: false,
@@ -7997,8 +7928,8 @@ var xhrConfiguration = {
7997
7928
  return node_runtime.isXHRSupported();
7998
7929
  }
7999
7930
  };
8000
- var XHRStreamingTransport = new transports_transport((extend({}, streamingConfiguration, xhrConfiguration)));
8001
- var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
7931
+ var XHRStreamingTransport = new transport_Transport((extend({}, streamingConfiguration, xhrConfiguration)));
7932
+ var XHRPollingTransport = new transport_Transport(extend({}, pollingConfiguration, xhrConfiguration));
8002
7933
  var Transports = {
8003
7934
  ws: WSTransport,
8004
7935
  xhr_streaming: XHRStreamingTransport,
@@ -8009,16 +7940,15 @@ var Transports = {
8009
7940
  // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
8010
7941
 
8011
7942
 
8012
- var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
8013
- function AssistantToTheTransportManager(manager, transport, options) {
7943
+ class assistant_to_the_transport_manager_AssistantToTheTransportManager {
7944
+ constructor(manager, transport, options) {
8014
7945
  this.manager = manager;
8015
7946
  this.transport = transport;
8016
7947
  this.minPingDelay = options.minPingDelay;
8017
7948
  this.maxPingDelay = options.maxPingDelay;
8018
7949
  this.pingDelay = undefined;
8019
7950
  }
8020
- AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
8021
- var _this = this;
7951
+ createConnection(name, priority, key, options) {
8022
7952
  options = extend({}, options, {
8023
7953
  activityTimeout: this.pingDelay
8024
7954
  });
@@ -8029,31 +7959,29 @@ var assistant_to_the_transport_manager_AssistantToTheTransportManager = (functio
8029
7959
  connection.bind('closed', onClosed);
8030
7960
  openTimestamp = util.now();
8031
7961
  };
8032
- var onClosed = function (closeEvent) {
7962
+ var onClosed = closeEvent => {
8033
7963
  connection.unbind('closed', onClosed);
8034
7964
  if (closeEvent.code === 1002 || closeEvent.code === 1003) {
8035
- _this.manager.reportDeath();
7965
+ this.manager.reportDeath();
8036
7966
  }
8037
7967
  else if (!closeEvent.wasClean && openTimestamp) {
8038
7968
  var lifespan = util.now() - openTimestamp;
8039
- if (lifespan < 2 * _this.maxPingDelay) {
8040
- _this.manager.reportDeath();
8041
- _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
7969
+ if (lifespan < 2 * this.maxPingDelay) {
7970
+ this.manager.reportDeath();
7971
+ this.pingDelay = Math.max(lifespan / 2, this.minPingDelay);
8042
7972
  }
8043
7973
  }
8044
7974
  };
8045
7975
  connection.bind('open', onOpen);
8046
7976
  return connection;
8047
- };
8048
- AssistantToTheTransportManager.prototype.isSupported = function (environment) {
7977
+ }
7978
+ isSupported(environment) {
8049
7979
  return this.manager.isAlive() && this.transport.isSupported(environment);
8050
- };
8051
- return AssistantToTheTransportManager;
8052
- }());
8053
- /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
7980
+ }
7981
+ }
8054
7982
 
8055
7983
  // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
8056
- var Protocol = {
7984
+ const Protocol = {
8057
7985
  decodeMessage: function (messageEvent) {
8058
7986
  try {
8059
7987
  var messageData = JSON.parse(messageEvent.data);
@@ -8146,68 +8074,52 @@ var Protocol = {
8146
8074
  /* harmony default export */ var protocol = (Protocol);
8147
8075
 
8148
8076
  // CONCATENATED MODULE: ./src/core/connection/connection.ts
8149
- var connection_extends = (undefined && undefined.__extends) || (function () {
8150
- var extendStatics = function (d, b) {
8151
- extendStatics = Object.setPrototypeOf ||
8152
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8153
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
8154
- return extendStatics(d, b);
8155
- };
8156
- return function (d, b) {
8157
- extendStatics(d, b);
8158
- function __() { this.constructor = d; }
8159
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8160
- };
8161
- })();
8162
8077
 
8163
8078
 
8164
8079
 
8165
8080
 
8166
- var connection_Connection = (function (_super) {
8167
- connection_extends(Connection, _super);
8168
- function Connection(id, transport) {
8169
- var _this = _super.call(this) || this;
8170
- _this.id = id;
8171
- _this.transport = transport;
8172
- _this.activityTimeout = transport.activityTimeout;
8173
- _this.bindListeners();
8174
- return _this;
8081
+ class connection_Connection extends dispatcher_Dispatcher {
8082
+ constructor(id, transport) {
8083
+ super();
8084
+ this.id = id;
8085
+ this.transport = transport;
8086
+ this.activityTimeout = transport.activityTimeout;
8087
+ this.bindListeners();
8175
8088
  }
8176
- Connection.prototype.handlesActivityChecks = function () {
8089
+ handlesActivityChecks() {
8177
8090
  return this.transport.handlesActivityChecks();
8178
- };
8179
- Connection.prototype.send = function (data) {
8091
+ }
8092
+ send(data) {
8180
8093
  return this.transport.send(data);
8181
- };
8182
- Connection.prototype.send_event = function (name, data, channel) {
8094
+ }
8095
+ send_event(name, data, channel) {
8183
8096
  var event = { event: name, data: data };
8184
8097
  if (channel) {
8185
8098
  event.channel = channel;
8186
8099
  }
8187
8100
  logger.debug('Event sent', event);
8188
8101
  return this.send(protocol.encodeMessage(event));
8189
- };
8190
- Connection.prototype.ping = function () {
8102
+ }
8103
+ ping() {
8191
8104
  if (this.transport.supportsPing()) {
8192
8105
  this.transport.ping();
8193
8106
  }
8194
8107
  else {
8195
8108
  this.send_event('pusher:ping', {});
8196
8109
  }
8197
- };
8198
- Connection.prototype.close = function () {
8110
+ }
8111
+ close() {
8199
8112
  this.transport.close();
8200
- };
8201
- Connection.prototype.bindListeners = function () {
8202
- var _this = this;
8113
+ }
8114
+ bindListeners() {
8203
8115
  var listeners = {
8204
- message: function (messageEvent) {
8116
+ message: (messageEvent) => {
8205
8117
  var pusherEvent;
8206
8118
  try {
8207
8119
  pusherEvent = protocol.decodeMessage(messageEvent);
8208
8120
  }
8209
8121
  catch (e) {
8210
- _this.emit('error', {
8122
+ this.emit('error', {
8211
8123
  type: 'MessageParseError',
8212
8124
  error: e,
8213
8125
  data: messageEvent.data
@@ -8217,46 +8129,46 @@ var connection_Connection = (function (_super) {
8217
8129
  logger.debug('Event recd', pusherEvent);
8218
8130
  switch (pusherEvent.event) {
8219
8131
  case 'pusher:error':
8220
- _this.emit('error', {
8132
+ this.emit('error', {
8221
8133
  type: 'PusherError',
8222
8134
  data: pusherEvent.data
8223
8135
  });
8224
8136
  break;
8225
8137
  case 'pusher:ping':
8226
- _this.emit('ping');
8138
+ this.emit('ping');
8227
8139
  break;
8228
8140
  case 'pusher:pong':
8229
- _this.emit('pong');
8141
+ this.emit('pong');
8230
8142
  break;
8231
8143
  }
8232
- _this.emit('message', pusherEvent);
8144
+ this.emit('message', pusherEvent);
8233
8145
  }
8234
8146
  },
8235
- activity: function () {
8236
- _this.emit('activity');
8147
+ activity: () => {
8148
+ this.emit('activity');
8237
8149
  },
8238
- error: function (error) {
8239
- _this.emit('error', error);
8150
+ error: error => {
8151
+ this.emit('error', error);
8240
8152
  },
8241
- closed: function (closeEvent) {
8153
+ closed: closeEvent => {
8242
8154
  unbindListeners();
8243
8155
  if (closeEvent && closeEvent.code) {
8244
- _this.handleCloseEvent(closeEvent);
8156
+ this.handleCloseEvent(closeEvent);
8245
8157
  }
8246
- _this.transport = null;
8247
- _this.emit('closed');
8158
+ this.transport = null;
8159
+ this.emit('closed');
8248
8160
  }
8249
8161
  };
8250
- var unbindListeners = function () {
8251
- objectApply(listeners, function (listener, event) {
8252
- _this.transport.unbind(event, listener);
8162
+ var unbindListeners = () => {
8163
+ objectApply(listeners, (listener, event) => {
8164
+ this.transport.unbind(event, listener);
8253
8165
  });
8254
8166
  };
8255
- objectApply(listeners, function (listener, event) {
8256
- _this.transport.bind(event, listener);
8167
+ objectApply(listeners, (listener, event) => {
8168
+ this.transport.bind(event, listener);
8257
8169
  });
8258
- };
8259
- Connection.prototype.handleCloseEvent = function (closeEvent) {
8170
+ }
8171
+ handleCloseEvent(closeEvent) {
8260
8172
  var action = protocol.getCloseAction(closeEvent);
8261
8173
  var error = protocol.getCloseError(closeEvent);
8262
8174
  if (error) {
@@ -8265,203 +8177,138 @@ var connection_Connection = (function (_super) {
8265
8177
  if (action) {
8266
8178
  this.emit(action, { action: action, error: error });
8267
8179
  }
8268
- };
8269
- return Connection;
8270
- }(dispatcher));
8271
- /* harmony default export */ var connection_connection = (connection_Connection);
8180
+ }
8181
+ }
8272
8182
 
8273
8183
  // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
8274
8184
 
8275
8185
 
8276
8186
 
8277
- var handshake_Handshake = (function () {
8278
- function Handshake(transport, callback) {
8187
+ class handshake_Handshake {
8188
+ constructor(transport, callback) {
8279
8189
  this.transport = transport;
8280
8190
  this.callback = callback;
8281
8191
  this.bindListeners();
8282
8192
  }
8283
- Handshake.prototype.close = function () {
8193
+ close() {
8284
8194
  this.unbindListeners();
8285
8195
  this.transport.close();
8286
- };
8287
- Handshake.prototype.bindListeners = function () {
8288
- var _this = this;
8289
- this.onMessage = function (m) {
8290
- _this.unbindListeners();
8196
+ }
8197
+ bindListeners() {
8198
+ this.onMessage = m => {
8199
+ this.unbindListeners();
8291
8200
  var result;
8292
8201
  try {
8293
8202
  result = protocol.processHandshake(m);
8294
8203
  }
8295
8204
  catch (e) {
8296
- _this.finish('error', { error: e });
8297
- _this.transport.close();
8205
+ this.finish('error', { error: e });
8206
+ this.transport.close();
8298
8207
  return;
8299
8208
  }
8300
8209
  if (result.action === 'connected') {
8301
- _this.finish('connected', {
8302
- connection: new connection_connection(result.id, _this.transport),
8210
+ this.finish('connected', {
8211
+ connection: new connection_Connection(result.id, this.transport),
8303
8212
  activityTimeout: result.activityTimeout
8304
8213
  });
8305
8214
  }
8306
8215
  else {
8307
- _this.finish(result.action, { error: result.error });
8308
- _this.transport.close();
8216
+ this.finish(result.action, { error: result.error });
8217
+ this.transport.close();
8309
8218
  }
8310
8219
  };
8311
- this.onClosed = function (closeEvent) {
8312
- _this.unbindListeners();
8220
+ this.onClosed = closeEvent => {
8221
+ this.unbindListeners();
8313
8222
  var action = protocol.getCloseAction(closeEvent) || 'backoff';
8314
8223
  var error = protocol.getCloseError(closeEvent);
8315
- _this.finish(action, { error: error });
8224
+ this.finish(action, { error: error });
8316
8225
  };
8317
8226
  this.transport.bind('message', this.onMessage);
8318
8227
  this.transport.bind('closed', this.onClosed);
8319
- };
8320
- Handshake.prototype.unbindListeners = function () {
8228
+ }
8229
+ unbindListeners() {
8321
8230
  this.transport.unbind('message', this.onMessage);
8322
8231
  this.transport.unbind('closed', this.onClosed);
8323
- };
8324
- Handshake.prototype.finish = function (action, params) {
8232
+ }
8233
+ finish(action, params) {
8325
8234
  this.callback(extend({ transport: this.transport, action: action }, params));
8326
- };
8327
- return Handshake;
8328
- }());
8329
- /* harmony default export */ var connection_handshake = (handshake_Handshake);
8235
+ }
8236
+ }
8330
8237
 
8331
8238
  // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
8332
8239
 
8333
- var timeline_sender_TimelineSender = (function () {
8334
- function TimelineSender(timeline, options) {
8240
+ class timeline_sender_TimelineSender {
8241
+ constructor(timeline, options) {
8335
8242
  this.timeline = timeline;
8336
8243
  this.options = options || {};
8337
8244
  }
8338
- TimelineSender.prototype.send = function (useTLS, callback) {
8245
+ send(useTLS, callback) {
8339
8246
  if (this.timeline.isEmpty()) {
8340
8247
  return;
8341
8248
  }
8342
8249
  this.timeline.send(node_runtime.TimelineTransport.getAgent(this, useTLS), callback);
8343
- };
8344
- return TimelineSender;
8345
- }());
8346
- /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
8250
+ }
8251
+ }
8347
8252
 
8348
8253
  // CONCATENATED MODULE: ./src/core/errors.ts
8349
- var errors_extends = (undefined && undefined.__extends) || (function () {
8350
- var extendStatics = function (d, b) {
8351
- extendStatics = Object.setPrototypeOf ||
8352
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8353
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
8354
- return extendStatics(d, b);
8355
- };
8356
- return function (d, b) {
8357
- extendStatics(d, b);
8358
- function __() { this.constructor = d; }
8359
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8360
- };
8361
- })();
8362
- var BadEventName = (function (_super) {
8363
- errors_extends(BadEventName, _super);
8364
- function BadEventName(msg) {
8365
- var _newTarget = this.constructor;
8366
- var _this = _super.call(this, msg) || this;
8367
- Object.setPrototypeOf(_this, _newTarget.prototype);
8368
- return _this;
8369
- }
8370
- return BadEventName;
8371
- }(Error));
8372
-
8373
- var BadChannelName = (function (_super) {
8374
- errors_extends(BadChannelName, _super);
8375
- function BadChannelName(msg) {
8376
- var _newTarget = this.constructor;
8377
- var _this = _super.call(this, msg) || this;
8378
- Object.setPrototypeOf(_this, _newTarget.prototype);
8379
- return _this;
8380
- }
8381
- return BadChannelName;
8382
- }(Error));
8383
-
8384
- var RequestTimedOut = (function (_super) {
8385
- errors_extends(RequestTimedOut, _super);
8386
- function RequestTimedOut(msg) {
8387
- var _newTarget = this.constructor;
8388
- var _this = _super.call(this, msg) || this;
8389
- Object.setPrototypeOf(_this, _newTarget.prototype);
8390
- return _this;
8391
- }
8392
- return RequestTimedOut;
8393
- }(Error));
8394
-
8395
- var TransportPriorityTooLow = (function (_super) {
8396
- errors_extends(TransportPriorityTooLow, _super);
8397
- function TransportPriorityTooLow(msg) {
8398
- var _newTarget = this.constructor;
8399
- var _this = _super.call(this, msg) || this;
8400
- Object.setPrototypeOf(_this, _newTarget.prototype);
8401
- return _this;
8402
- }
8403
- return TransportPriorityTooLow;
8404
- }(Error));
8405
-
8406
- var TransportClosed = (function (_super) {
8407
- errors_extends(TransportClosed, _super);
8408
- function TransportClosed(msg) {
8409
- var _newTarget = this.constructor;
8410
- var _this = _super.call(this, msg) || this;
8411
- Object.setPrototypeOf(_this, _newTarget.prototype);
8412
- return _this;
8413
- }
8414
- return TransportClosed;
8415
- }(Error));
8416
-
8417
- var UnsupportedFeature = (function (_super) {
8418
- errors_extends(UnsupportedFeature, _super);
8419
- function UnsupportedFeature(msg) {
8420
- var _newTarget = this.constructor;
8421
- var _this = _super.call(this, msg) || this;
8422
- Object.setPrototypeOf(_this, _newTarget.prototype);
8423
- return _this;
8424
- }
8425
- return UnsupportedFeature;
8426
- }(Error));
8427
-
8428
- var UnsupportedTransport = (function (_super) {
8429
- errors_extends(UnsupportedTransport, _super);
8430
- function UnsupportedTransport(msg) {
8431
- var _newTarget = this.constructor;
8432
- var _this = _super.call(this, msg) || this;
8433
- Object.setPrototypeOf(_this, _newTarget.prototype);
8434
- return _this;
8435
- }
8436
- return UnsupportedTransport;
8437
- }(Error));
8438
-
8439
- var UnsupportedStrategy = (function (_super) {
8440
- errors_extends(UnsupportedStrategy, _super);
8441
- function UnsupportedStrategy(msg) {
8442
- var _newTarget = this.constructor;
8443
- var _this = _super.call(this, msg) || this;
8444
- Object.setPrototypeOf(_this, _newTarget.prototype);
8445
- return _this;
8446
- }
8447
- return UnsupportedStrategy;
8448
- }(Error));
8449
-
8450
- var HTTPAuthError = (function (_super) {
8451
- errors_extends(HTTPAuthError, _super);
8452
- function HTTPAuthError(status, msg) {
8453
- var _newTarget = this.constructor;
8454
- var _this = _super.call(this, msg) || this;
8455
- _this.status = status;
8456
- Object.setPrototypeOf(_this, _newTarget.prototype);
8457
- return _this;
8458
- }
8459
- return HTTPAuthError;
8460
- }(Error));
8461
-
8254
+ class BadEventName extends Error {
8255
+ constructor(msg) {
8256
+ super(msg);
8257
+ Object.setPrototypeOf(this, new.target.prototype);
8258
+ }
8259
+ }
8260
+ class BadChannelName extends Error {
8261
+ constructor(msg) {
8262
+ super(msg);
8263
+ Object.setPrototypeOf(this, new.target.prototype);
8264
+ }
8265
+ }
8266
+ class RequestTimedOut extends Error {
8267
+ constructor(msg) {
8268
+ super(msg);
8269
+ Object.setPrototypeOf(this, new.target.prototype);
8270
+ }
8271
+ }
8272
+ class TransportPriorityTooLow extends Error {
8273
+ constructor(msg) {
8274
+ super(msg);
8275
+ Object.setPrototypeOf(this, new.target.prototype);
8276
+ }
8277
+ }
8278
+ class TransportClosed extends Error {
8279
+ constructor(msg) {
8280
+ super(msg);
8281
+ Object.setPrototypeOf(this, new.target.prototype);
8282
+ }
8283
+ }
8284
+ class UnsupportedFeature extends Error {
8285
+ constructor(msg) {
8286
+ super(msg);
8287
+ Object.setPrototypeOf(this, new.target.prototype);
8288
+ }
8289
+ }
8290
+ class UnsupportedTransport extends Error {
8291
+ constructor(msg) {
8292
+ super(msg);
8293
+ Object.setPrototypeOf(this, new.target.prototype);
8294
+ }
8295
+ }
8296
+ class UnsupportedStrategy extends Error {
8297
+ constructor(msg) {
8298
+ super(msg);
8299
+ Object.setPrototypeOf(this, new.target.prototype);
8300
+ }
8301
+ }
8302
+ class HTTPAuthError extends Error {
8303
+ constructor(status, msg) {
8304
+ super(msg);
8305
+ this.status = status;
8306
+ Object.setPrototypeOf(this, new.target.prototype);
8307
+ }
8308
+ }
8462
8309
 
8463
8310
  // CONCATENATED MODULE: ./src/core/utils/url_store.ts
8464
- var urlStore = {
8311
+ const urlStore = {
8465
8312
  baseUrl: 'https://pusher.com',
8466
8313
  urls: {
8467
8314
  authenticationEndpoint: {
@@ -8481,12 +8328,12 @@ var urlStore = {
8481
8328
  }
8482
8329
  }
8483
8330
  };
8484
- var buildLogSuffix = function (key) {
8485
- var urlPrefix = 'See:';
8486
- var urlObj = urlStore.urls[key];
8331
+ const buildLogSuffix = function (key) {
8332
+ const urlPrefix = 'See:';
8333
+ const urlObj = urlStore.urls[key];
8487
8334
  if (!urlObj)
8488
8335
  return '';
8489
- var url;
8336
+ let url;
8490
8337
  if (urlObj.fullUrl) {
8491
8338
  url = urlObj.fullUrl;
8492
8339
  }
@@ -8495,60 +8342,45 @@ var buildLogSuffix = function (key) {
8495
8342
  }
8496
8343
  if (!url)
8497
8344
  return '';
8498
- return urlPrefix + " " + url;
8345
+ return `${urlPrefix} ${url}`;
8499
8346
  };
8500
- /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
8347
+ /* harmony default export */ var url_store = ({ buildLogSuffix });
8501
8348
 
8502
8349
  // CONCATENATED MODULE: ./src/core/channels/channel.ts
8503
- var channel_extends = (undefined && undefined.__extends) || (function () {
8504
- var extendStatics = function (d, b) {
8505
- extendStatics = Object.setPrototypeOf ||
8506
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8507
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
8508
- return extendStatics(d, b);
8509
- };
8510
- return function (d, b) {
8511
- extendStatics(d, b);
8512
- function __() { this.constructor = d; }
8513
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8514
- };
8515
- })();
8516
8350
 
8517
8351
 
8518
8352
 
8519
8353
 
8520
8354
 
8521
- var channel_Channel = (function (_super) {
8522
- channel_extends(Channel, _super);
8523
- function Channel(name, pusher) {
8524
- var _this = _super.call(this, function (event, data) {
8355
+ class channel_Channel extends dispatcher_Dispatcher {
8356
+ constructor(name, pusher) {
8357
+ super(function (event, data) {
8525
8358
  logger.debug('No callbacks on ' + name + ' for ' + event);
8526
- }) || this;
8527
- _this.name = name;
8528
- _this.pusher = pusher;
8529
- _this.subscribed = false;
8530
- _this.subscriptionPending = false;
8531
- _this.subscriptionCancelled = false;
8532
- return _this;
8533
- }
8534
- Channel.prototype.authorize = function (socketId, callback) {
8359
+ });
8360
+ this.name = name;
8361
+ this.pusher = pusher;
8362
+ this.subscribed = false;
8363
+ this.subscriptionPending = false;
8364
+ this.subscriptionCancelled = false;
8365
+ }
8366
+ authorize(socketId, callback) {
8535
8367
  return callback(null, { auth: '' });
8536
- };
8537
- Channel.prototype.trigger = function (event, data) {
8368
+ }
8369
+ trigger(event, data) {
8538
8370
  if (event.indexOf('client-') !== 0) {
8539
8371
  throw new BadEventName("Event '" + event + "' does not start with 'client-'");
8540
8372
  }
8541
8373
  if (!this.subscribed) {
8542
8374
  var suffix = url_store.buildLogSuffix('triggeringClientEvents');
8543
- logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
8375
+ logger.warn(`Client event triggered before channel 'subscription_succeeded' event . ${suffix}`);
8544
8376
  }
8545
8377
  return this.pusher.send_event(event, data, this.name);
8546
- };
8547
- Channel.prototype.disconnect = function () {
8378
+ }
8379
+ disconnect() {
8548
8380
  this.subscribed = false;
8549
8381
  this.subscriptionPending = false;
8550
- };
8551
- Channel.prototype.handleEvent = function (event) {
8382
+ }
8383
+ handleEvent(event) {
8552
8384
  var eventName = event.event;
8553
8385
  var data = event.data;
8554
8386
  if (eventName === 'pusher_internal:subscription_succeeded') {
@@ -8561,8 +8393,8 @@ var channel_Channel = (function (_super) {
8561
8393
  var metadata = {};
8562
8394
  this.emit(eventName, data, metadata);
8563
8395
  }
8564
- };
8565
- Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
8396
+ }
8397
+ handleSubscriptionSucceededEvent(event) {
8566
8398
  this.subscriptionPending = false;
8567
8399
  this.subscribed = true;
8568
8400
  if (this.subscriptionCancelled) {
@@ -8571,91 +8403,69 @@ var channel_Channel = (function (_super) {
8571
8403
  else {
8572
8404
  this.emit('pusher:subscription_succeeded', event.data);
8573
8405
  }
8574
- };
8575
- Channel.prototype.handleSubscriptionCountEvent = function (event) {
8406
+ }
8407
+ handleSubscriptionCountEvent(event) {
8576
8408
  if (event.data.subscription_count) {
8577
8409
  this.subscriptionCount = event.data.subscription_count;
8578
8410
  }
8579
8411
  this.emit('pusher:subscription_count', event.data);
8580
- };
8581
- Channel.prototype.subscribe = function () {
8582
- var _this = this;
8412
+ }
8413
+ subscribe() {
8583
8414
  if (this.subscribed) {
8584
8415
  return;
8585
8416
  }
8586
8417
  this.subscriptionPending = true;
8587
8418
  this.subscriptionCancelled = false;
8588
- this.authorize(this.pusher.connection.socket_id, function (error, data) {
8419
+ this.authorize(this.pusher.connection.socket_id, (error, data) => {
8589
8420
  if (error) {
8590
- _this.subscriptionPending = false;
8421
+ this.subscriptionPending = false;
8591
8422
  logger.error(error.toString());
8592
- _this.emit('pusher:subscription_error', Object.assign({}, {
8423
+ this.emit('pusher:subscription_error', Object.assign({}, {
8593
8424
  type: 'AuthError',
8594
8425
  error: error.message
8595
8426
  }, error instanceof HTTPAuthError ? { status: error.status } : {}));
8596
8427
  }
8597
8428
  else {
8598
- _this.pusher.send_event('pusher:subscribe', {
8429
+ this.pusher.send_event('pusher:subscribe', {
8599
8430
  auth: data.auth,
8600
8431
  channel_data: data.channel_data,
8601
- channel: _this.name
8432
+ channel: this.name
8602
8433
  });
8603
8434
  }
8604
8435
  });
8605
- };
8606
- Channel.prototype.unsubscribe = function () {
8436
+ }
8437
+ unsubscribe() {
8607
8438
  this.subscribed = false;
8608
8439
  this.pusher.send_event('pusher:unsubscribe', {
8609
8440
  channel: this.name
8610
8441
  });
8611
- };
8612
- Channel.prototype.cancelSubscription = function () {
8442
+ }
8443
+ cancelSubscription() {
8613
8444
  this.subscriptionCancelled = true;
8614
- };
8615
- Channel.prototype.reinstateSubscription = function () {
8445
+ }
8446
+ reinstateSubscription() {
8616
8447
  this.subscriptionCancelled = false;
8617
- };
8618
- return Channel;
8619
- }(dispatcher));
8620
- /* harmony default export */ var channels_channel = (channel_Channel);
8448
+ }
8449
+ }
8621
8450
 
8622
8451
  // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
8623
- var private_channel_extends = (undefined && undefined.__extends) || (function () {
8624
- var extendStatics = function (d, b) {
8625
- extendStatics = Object.setPrototypeOf ||
8626
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8627
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
8628
- return extendStatics(d, b);
8629
- };
8630
- return function (d, b) {
8631
- extendStatics(d, b);
8632
- function __() { this.constructor = d; }
8633
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8634
- };
8635
- })();
8636
8452
 
8637
- var PrivateChannel = (function (_super) {
8638
- private_channel_extends(PrivateChannel, _super);
8639
- function PrivateChannel() {
8640
- return _super !== null && _super.apply(this, arguments) || this;
8641
- }
8642
- PrivateChannel.prototype.authorize = function (socketId, callback) {
8453
+ class private_channel_PrivateChannel extends channel_Channel {
8454
+ authorize(socketId, callback) {
8643
8455
  return this.pusher.config.channelAuthorizer({
8644
8456
  channelName: this.name,
8645
8457
  socketId: socketId
8646
8458
  }, callback);
8647
- };
8648
- return PrivateChannel;
8649
- }(channels_channel));
8650
- /* harmony default export */ var private_channel = (PrivateChannel);
8459
+ }
8460
+ }
8651
8461
 
8652
8462
  // CONCATENATED MODULE: ./src/core/channels/members.ts
8653
8463
 
8654
- var members_Members = (function () {
8655
- function Members() {
8464
+ class members_Members {
8465
+ constructor() {
8656
8466
  this.reset();
8657
8467
  }
8658
- Members.prototype.get = function (id) {
8468
+ get(id) {
8659
8469
  if (Object.prototype.hasOwnProperty.call(this.members, id)) {
8660
8470
  return {
8661
8471
  id: id,
@@ -8665,60 +8475,44 @@ var members_Members = (function () {
8665
8475
  else {
8666
8476
  return null;
8667
8477
  }
8668
- };
8669
- Members.prototype.each = function (callback) {
8670
- var _this = this;
8671
- objectApply(this.members, function (member, id) {
8672
- callback(_this.get(id));
8478
+ }
8479
+ each(callback) {
8480
+ objectApply(this.members, (member, id) => {
8481
+ callback(this.get(id));
8673
8482
  });
8674
- };
8675
- Members.prototype.setMyID = function (id) {
8483
+ }
8484
+ setMyID(id) {
8676
8485
  this.myID = id;
8677
- };
8678
- Members.prototype.onSubscription = function (subscriptionData) {
8486
+ }
8487
+ onSubscription(subscriptionData) {
8679
8488
  this.members = subscriptionData.presence.hash;
8680
8489
  this.count = subscriptionData.presence.count;
8681
8490
  this.me = this.get(this.myID);
8682
- };
8683
- Members.prototype.addMember = function (memberData) {
8491
+ }
8492
+ addMember(memberData) {
8684
8493
  if (this.get(memberData.user_id) === null) {
8685
8494
  this.count++;
8686
8495
  }
8687
8496
  this.members[memberData.user_id] = memberData.user_info;
8688
8497
  return this.get(memberData.user_id);
8689
- };
8690
- Members.prototype.removeMember = function (memberData) {
8498
+ }
8499
+ removeMember(memberData) {
8691
8500
  var member = this.get(memberData.user_id);
8692
8501
  if (member) {
8693
8502
  delete this.members[memberData.user_id];
8694
8503
  this.count--;
8695
8504
  }
8696
8505
  return member;
8697
- };
8698
- Members.prototype.reset = function () {
8506
+ }
8507
+ reset() {
8699
8508
  this.members = {};
8700
8509
  this.count = 0;
8701
8510
  this.myID = null;
8702
8511
  this.me = null;
8703
- };
8704
- return Members;
8705
- }());
8706
- /* harmony default export */ var members = (members_Members);
8512
+ }
8513
+ }
8707
8514
 
8708
8515
  // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
8709
- var presence_channel_extends = (undefined && undefined.__extends) || (function () {
8710
- var extendStatics = function (d, b) {
8711
- extendStatics = Object.setPrototypeOf ||
8712
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8713
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
8714
- return extendStatics(d, b);
8715
- };
8716
- return function (d, b) {
8717
- extendStatics(d, b);
8718
- function __() { this.constructor = d; }
8719
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8720
- };
8721
- })();
8722
8516
  var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
8723
8517
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8724
8518
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8728,80 +8522,42 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
8728
8522
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8729
8523
  });
8730
8524
  };
8731
- var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
8732
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
8733
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
8734
- function verb(n) { return function (v) { return step([n, v]); }; }
8735
- function step(op) {
8736
- if (f) throw new TypeError("Generator is already executing.");
8737
- while (_) try {
8738
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
8739
- if (y = 0, t) op = [op[0] & 2, t.value];
8740
- switch (op[0]) {
8741
- case 0: case 1: t = op; break;
8742
- case 4: _.label++; return { value: op[1], done: false };
8743
- case 5: _.label++; y = op[1]; op = [0]; continue;
8744
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
8745
- default:
8746
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
8747
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
8748
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
8749
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
8750
- if (t[2]) _.ops.pop();
8751
- _.trys.pop(); continue;
8752
- }
8753
- op = body.call(thisArg, _);
8754
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
8755
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
8756
- }
8757
- };
8758
-
8759
-
8760
-
8761
-
8762
- var presence_channel_PresenceChannel = (function (_super) {
8763
- presence_channel_extends(PresenceChannel, _super);
8764
- function PresenceChannel(name, pusher) {
8765
- var _this = _super.call(this, name, pusher) || this;
8766
- _this.members = new members();
8767
- return _this;
8768
- }
8769
- PresenceChannel.prototype.authorize = function (socketId, callback) {
8770
- var _this = this;
8771
- _super.prototype.authorize.call(this, socketId, function (error, authData) { return __awaiter(_this, void 0, void 0, function () {
8772
- var channelData, suffix;
8773
- return __generator(this, function (_a) {
8774
- switch (_a.label) {
8775
- case 0:
8776
- if (!!error) return [3, 3];
8777
- authData = authData;
8778
- if (!(authData.channel_data != null)) return [3, 1];
8779
- channelData = JSON.parse(authData.channel_data);
8780
- this.members.setMyID(channelData.user_id);
8781
- return [3, 3];
8782
- case 1: return [4, this.pusher.user.signinDonePromise];
8783
- case 2:
8784
- _a.sent();
8785
- if (this.pusher.user.user_data != null) {
8786
- this.members.setMyID(this.pusher.user.user_data.id);
8787
- }
8788
- else {
8789
- suffix = url_store.buildLogSuffix('authorizationEndpoint');
8790
- logger.error("Invalid auth response for channel '" + this.name + "', " +
8791
- ("expected 'channel_data' field. " + suffix + ", ") +
8792
- "or the user should be signed in.");
8793
- callback('Invalid auth response');
8794
- return [2];
8795
- }
8796
- _a.label = 3;
8797
- case 3:
8798
- callback(error, authData);
8799
- return [2];
8525
+
8526
+
8527
+
8528
+
8529
+ class presence_channel_PresenceChannel extends private_channel_PrivateChannel {
8530
+ constructor(name, pusher) {
8531
+ super(name, pusher);
8532
+ this.members = new members_Members();
8533
+ }
8534
+ authorize(socketId, callback) {
8535
+ super.authorize(socketId, (error, authData) => __awaiter(this, void 0, void 0, function* () {
8536
+ if (!error) {
8537
+ authData = authData;
8538
+ if (authData.channel_data != null) {
8539
+ var channelData = JSON.parse(authData.channel_data);
8540
+ this.members.setMyID(channelData.user_id);
8800
8541
  }
8801
- });
8802
- }); });
8803
- };
8804
- PresenceChannel.prototype.handleEvent = function (event) {
8542
+ else {
8543
+ yield this.pusher.user.signinDonePromise;
8544
+ if (this.pusher.user.user_data != null) {
8545
+ this.members.setMyID(this.pusher.user.user_data.id);
8546
+ }
8547
+ else {
8548
+ let suffix = url_store.buildLogSuffix('authorizationEndpoint');
8549
+ logger.error(`Invalid auth response for channel '${this.name}', ` +
8550
+ `expected 'channel_data' field. ${suffix}, ` +
8551
+ `or the user should be signed in.`);
8552
+ callback('Invalid auth response');
8553
+ return;
8554
+ }
8555
+ }
8556
+ }
8557
+ callback(error, authData);
8558
+ }));
8559
+ }
8560
+ handleEvent(event) {
8805
8561
  var eventName = event.event;
8806
8562
  if (eventName.indexOf('pusher_internal:') === 0) {
8807
8563
  this.handleInternalEvent(event);
@@ -8814,8 +8570,8 @@ var presence_channel_PresenceChannel = (function (_super) {
8814
8570
  }
8815
8571
  this.emit(eventName, data, metadata);
8816
8572
  }
8817
- };
8818
- PresenceChannel.prototype.handleInternalEvent = function (event) {
8573
+ }
8574
+ handleInternalEvent(event) {
8819
8575
  var eventName = event.event;
8820
8576
  var data = event.data;
8821
8577
  switch (eventName) {
@@ -8836,8 +8592,8 @@ var presence_channel_PresenceChannel = (function (_super) {
8836
8592
  }
8837
8593
  break;
8838
8594
  }
8839
- };
8840
- PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
8595
+ }
8596
+ handleSubscriptionSucceededEvent(event) {
8841
8597
  this.subscriptionPending = false;
8842
8598
  this.subscribed = true;
8843
8599
  if (this.subscriptionCancelled) {
@@ -8847,14 +8603,12 @@ var presence_channel_PresenceChannel = (function (_super) {
8847
8603
  this.members.onSubscription(event.data);
8848
8604
  this.emit('pusher:subscription_succeeded', this.members);
8849
8605
  }
8850
- };
8851
- PresenceChannel.prototype.disconnect = function () {
8606
+ }
8607
+ disconnect() {
8852
8608
  this.members.reset();
8853
- _super.prototype.disconnect.call(this);
8854
- };
8855
- return PresenceChannel;
8856
- }(private_channel));
8857
- /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
8609
+ super.disconnect();
8610
+ }
8611
+ }
8858
8612
 
8859
8613
  // EXTERNAL MODULE: ./node_modules/@stablelib/utf8/lib/utf8.js
8860
8614
  var utf8 = __webpack_require__(17);
@@ -8863,64 +8617,47 @@ var utf8 = __webpack_require__(17);
8863
8617
  var base64 = __webpack_require__(8);
8864
8618
 
8865
8619
  // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
8866
- var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
8867
- var extendStatics = function (d, b) {
8868
- extendStatics = Object.setPrototypeOf ||
8869
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8870
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
8871
- return extendStatics(d, b);
8872
- };
8873
- return function (d, b) {
8874
- extendStatics(d, b);
8875
- function __() { this.constructor = d; }
8876
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8877
- };
8878
- })();
8879
8620
 
8880
8621
 
8881
8622
 
8882
8623
 
8883
8624
 
8884
- var encrypted_channel_EncryptedChannel = (function (_super) {
8885
- encrypted_channel_extends(EncryptedChannel, _super);
8886
- function EncryptedChannel(name, pusher, nacl) {
8887
- var _this = _super.call(this, name, pusher) || this;
8888
- _this.key = null;
8889
- _this.nacl = nacl;
8890
- return _this;
8625
+ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel {
8626
+ constructor(name, pusher, nacl) {
8627
+ super(name, pusher);
8628
+ this.key = null;
8629
+ this.nacl = nacl;
8891
8630
  }
8892
- EncryptedChannel.prototype.authorize = function (socketId, callback) {
8893
- var _this = this;
8894
- _super.prototype.authorize.call(this, socketId, function (error, authData) {
8631
+ authorize(socketId, callback) {
8632
+ super.authorize(socketId, (error, authData) => {
8895
8633
  if (error) {
8896
8634
  callback(error, authData);
8897
8635
  return;
8898
8636
  }
8899
- var sharedSecret = authData['shared_secret'];
8637
+ let sharedSecret = authData['shared_secret'];
8900
8638
  if (!sharedSecret) {
8901
- callback(new Error("No shared_secret key in auth payload for encrypted channel: " + _this.name), null);
8639
+ callback(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
8902
8640
  return;
8903
8641
  }
8904
- _this.key = Object(base64["decode"])(sharedSecret);
8642
+ this.key = Object(base64["decode"])(sharedSecret);
8905
8643
  delete authData['shared_secret'];
8906
8644
  callback(null, authData);
8907
8645
  });
8908
- };
8909
- EncryptedChannel.prototype.trigger = function (event, data) {
8646
+ }
8647
+ trigger(event, data) {
8910
8648
  throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
8911
- };
8912
- EncryptedChannel.prototype.handleEvent = function (event) {
8649
+ }
8650
+ handleEvent(event) {
8913
8651
  var eventName = event.event;
8914
8652
  var data = event.data;
8915
8653
  if (eventName.indexOf('pusher_internal:') === 0 ||
8916
8654
  eventName.indexOf('pusher:') === 0) {
8917
- _super.prototype.handleEvent.call(this, event);
8655
+ super.handleEvent(event);
8918
8656
  return;
8919
8657
  }
8920
8658
  this.handleEncryptedEvent(eventName, data);
8921
- };
8922
- EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
8923
- var _this = this;
8659
+ }
8660
+ handleEncryptedEvent(event, data) {
8924
8661
  if (!this.key) {
8925
8662
  logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
8926
8663
  return;
@@ -8930,98 +8667,81 @@ var encrypted_channel_EncryptedChannel = (function (_super) {
8930
8667
  data);
8931
8668
  return;
8932
8669
  }
8933
- var cipherText = Object(base64["decode"])(data.ciphertext);
8670
+ let cipherText = Object(base64["decode"])(data.ciphertext);
8934
8671
  if (cipherText.length < this.nacl.secretbox.overheadLength) {
8935
- logger.error("Expected encrypted event ciphertext length to be " + this.nacl.secretbox.overheadLength + ", got: " + cipherText.length);
8672
+ logger.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${cipherText.length}`);
8936
8673
  return;
8937
8674
  }
8938
- var nonce = Object(base64["decode"])(data.nonce);
8675
+ let nonce = Object(base64["decode"])(data.nonce);
8939
8676
  if (nonce.length < this.nacl.secretbox.nonceLength) {
8940
- logger.error("Expected encrypted event nonce length to be " + this.nacl.secretbox.nonceLength + ", got: " + nonce.length);
8677
+ logger.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${nonce.length}`);
8941
8678
  return;
8942
8679
  }
8943
- var bytes = this.nacl.secretbox.open(cipherText, nonce, this.key);
8680
+ let bytes = this.nacl.secretbox.open(cipherText, nonce, this.key);
8944
8681
  if (bytes === null) {
8945
8682
  logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
8946
- this.authorize(this.pusher.connection.socket_id, function (error, authData) {
8683
+ this.authorize(this.pusher.connection.socket_id, (error, authData) => {
8947
8684
  if (error) {
8948
- logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
8685
+ logger.error(`Failed to make a request to the authEndpoint: ${authData}. Unable to fetch new key, so dropping encrypted event`);
8949
8686
  return;
8950
8687
  }
8951
- bytes = _this.nacl.secretbox.open(cipherText, nonce, _this.key);
8688
+ bytes = this.nacl.secretbox.open(cipherText, nonce, this.key);
8952
8689
  if (bytes === null) {
8953
- logger.error("Failed to decrypt event with new key. Dropping encrypted event");
8690
+ logger.error(`Failed to decrypt event with new key. Dropping encrypted event`);
8954
8691
  return;
8955
8692
  }
8956
- _this.emit(event, _this.getDataToEmit(bytes));
8693
+ this.emit(event, this.getDataToEmit(bytes));
8957
8694
  return;
8958
8695
  });
8959
8696
  return;
8960
8697
  }
8961
8698
  this.emit(event, this.getDataToEmit(bytes));
8962
- };
8963
- EncryptedChannel.prototype.getDataToEmit = function (bytes) {
8964
- var raw = Object(utf8["decode"])(bytes);
8699
+ }
8700
+ getDataToEmit(bytes) {
8701
+ let raw = Object(utf8["decode"])(bytes);
8965
8702
  try {
8966
8703
  return JSON.parse(raw);
8967
8704
  }
8968
8705
  catch (_a) {
8969
8706
  return raw;
8970
8707
  }
8971
- };
8972
- return EncryptedChannel;
8973
- }(private_channel));
8974
- /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
8708
+ }
8709
+ }
8975
8710
 
8976
8711
  // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
8977
- var connection_manager_extends = (undefined && undefined.__extends) || (function () {
8978
- var extendStatics = function (d, b) {
8979
- extendStatics = Object.setPrototypeOf ||
8980
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
8981
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
8982
- return extendStatics(d, b);
8983
- };
8984
- return function (d, b) {
8985
- extendStatics(d, b);
8986
- function __() { this.constructor = d; }
8987
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8988
- };
8989
- })();
8990
8712
 
8991
8713
 
8992
8714
 
8993
8715
 
8994
8716
 
8995
- var connection_manager_ConnectionManager = (function (_super) {
8996
- connection_manager_extends(ConnectionManager, _super);
8997
- function ConnectionManager(key, options) {
8998
- var _this = _super.call(this) || this;
8999
- _this.state = 'initialized';
9000
- _this.connection = null;
9001
- _this.key = key;
9002
- _this.options = options;
9003
- _this.timeline = _this.options.timeline;
9004
- _this.usingTLS = _this.options.useTLS;
9005
- _this.errorCallbacks = _this.buildErrorCallbacks();
9006
- _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
9007
- _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
8717
+ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
8718
+ constructor(key, options) {
8719
+ super();
8720
+ this.state = 'initialized';
8721
+ this.connection = null;
8722
+ this.key = key;
8723
+ this.options = options;
8724
+ this.timeline = this.options.timeline;
8725
+ this.usingTLS = this.options.useTLS;
8726
+ this.errorCallbacks = this.buildErrorCallbacks();
8727
+ this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks);
8728
+ this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
9008
8729
  var Network = node_runtime.getNetwork();
9009
- Network.bind('online', function () {
9010
- _this.timeline.info({ netinfo: 'online' });
9011
- if (_this.state === 'connecting' || _this.state === 'unavailable') {
9012
- _this.retryIn(0);
8730
+ Network.bind('online', () => {
8731
+ this.timeline.info({ netinfo: 'online' });
8732
+ if (this.state === 'connecting' || this.state === 'unavailable') {
8733
+ this.retryIn(0);
9013
8734
  }
9014
8735
  });
9015
- Network.bind('offline', function () {
9016
- _this.timeline.info({ netinfo: 'offline' });
9017
- if (_this.connection) {
9018
- _this.sendActivityCheck();
8736
+ Network.bind('offline', () => {
8737
+ this.timeline.info({ netinfo: 'offline' });
8738
+ if (this.connection) {
8739
+ this.sendActivityCheck();
9019
8740
  }
9020
8741
  });
9021
- _this.updateStrategy();
9022
- return _this;
8742
+ this.updateStrategy();
9023
8743
  }
9024
- ConnectionManager.prototype.connect = function () {
8744
+ connect() {
9025
8745
  if (this.connection || this.runner) {
9026
8746
  return;
9027
8747
  }
@@ -9032,59 +8752,58 @@ var connection_manager_ConnectionManager = (function (_super) {
9032
8752
  this.updateState('connecting');
9033
8753
  this.startConnecting();
9034
8754
  this.setUnavailableTimer();
9035
- };
9036
- ConnectionManager.prototype.send = function (data) {
8755
+ }
8756
+ send(data) {
9037
8757
  if (this.connection) {
9038
8758
  return this.connection.send(data);
9039
8759
  }
9040
8760
  else {
9041
8761
  return false;
9042
8762
  }
9043
- };
9044
- ConnectionManager.prototype.send_event = function (name, data, channel) {
8763
+ }
8764
+ send_event(name, data, channel) {
9045
8765
  if (this.connection) {
9046
8766
  return this.connection.send_event(name, data, channel);
9047
8767
  }
9048
8768
  else {
9049
8769
  return false;
9050
8770
  }
9051
- };
9052
- ConnectionManager.prototype.disconnect = function () {
8771
+ }
8772
+ disconnect() {
9053
8773
  this.disconnectInternally();
9054
8774
  this.updateState('disconnected');
9055
- };
9056
- ConnectionManager.prototype.isUsingTLS = function () {
8775
+ }
8776
+ isUsingTLS() {
9057
8777
  return this.usingTLS;
9058
- };
9059
- ConnectionManager.prototype.startConnecting = function () {
9060
- var _this = this;
9061
- var callback = function (error, handshake) {
8778
+ }
8779
+ startConnecting() {
8780
+ var callback = (error, handshake) => {
9062
8781
  if (error) {
9063
- _this.runner = _this.strategy.connect(0, callback);
8782
+ this.runner = this.strategy.connect(0, callback);
9064
8783
  }
9065
8784
  else {
9066
8785
  if (handshake.action === 'error') {
9067
- _this.emit('error', {
8786
+ this.emit('error', {
9068
8787
  type: 'HandshakeError',
9069
8788
  error: handshake.error
9070
8789
  });
9071
- _this.timeline.error({ handshakeError: handshake.error });
8790
+ this.timeline.error({ handshakeError: handshake.error });
9072
8791
  }
9073
8792
  else {
9074
- _this.abortConnecting();
9075
- _this.handshakeCallbacks[handshake.action](handshake);
8793
+ this.abortConnecting();
8794
+ this.handshakeCallbacks[handshake.action](handshake);
9076
8795
  }
9077
8796
  }
9078
8797
  };
9079
8798
  this.runner = this.strategy.connect(0, callback);
9080
- };
9081
- ConnectionManager.prototype.abortConnecting = function () {
8799
+ }
8800
+ abortConnecting() {
9082
8801
  if (this.runner) {
9083
8802
  this.runner.abort();
9084
8803
  this.runner = null;
9085
8804
  }
9086
- };
9087
- ConnectionManager.prototype.disconnectInternally = function () {
8805
+ }
8806
+ disconnectInternally() {
9088
8807
  this.abortConnecting();
9089
8808
  this.clearRetryTimer();
9090
8809
  this.clearUnavailableTimer();
@@ -9092,136 +8811,129 @@ var connection_manager_ConnectionManager = (function (_super) {
9092
8811
  var connection = this.abandonConnection();
9093
8812
  connection.close();
9094
8813
  }
9095
- };
9096
- ConnectionManager.prototype.updateStrategy = function () {
8814
+ }
8815
+ updateStrategy() {
9097
8816
  this.strategy = this.options.getStrategy({
9098
8817
  key: this.key,
9099
8818
  timeline: this.timeline,
9100
8819
  useTLS: this.usingTLS
9101
8820
  });
9102
- };
9103
- ConnectionManager.prototype.retryIn = function (delay) {
9104
- var _this = this;
8821
+ }
8822
+ retryIn(delay) {
9105
8823
  this.timeline.info({ action: 'retry', delay: delay });
9106
8824
  if (delay > 0) {
9107
8825
  this.emit('connecting_in', Math.round(delay / 1000));
9108
8826
  }
9109
- this.retryTimer = new OneOffTimer(delay || 0, function () {
9110
- _this.disconnectInternally();
9111
- _this.connect();
8827
+ this.retryTimer = new timers_OneOffTimer(delay || 0, () => {
8828
+ this.disconnectInternally();
8829
+ this.connect();
9112
8830
  });
9113
- };
9114
- ConnectionManager.prototype.clearRetryTimer = function () {
8831
+ }
8832
+ clearRetryTimer() {
9115
8833
  if (this.retryTimer) {
9116
8834
  this.retryTimer.ensureAborted();
9117
8835
  this.retryTimer = null;
9118
8836
  }
9119
- };
9120
- ConnectionManager.prototype.setUnavailableTimer = function () {
9121
- var _this = this;
9122
- this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
9123
- _this.updateState('unavailable');
8837
+ }
8838
+ setUnavailableTimer() {
8839
+ this.unavailableTimer = new timers_OneOffTimer(this.options.unavailableTimeout, () => {
8840
+ this.updateState('unavailable');
9124
8841
  });
9125
- };
9126
- ConnectionManager.prototype.clearUnavailableTimer = function () {
8842
+ }
8843
+ clearUnavailableTimer() {
9127
8844
  if (this.unavailableTimer) {
9128
8845
  this.unavailableTimer.ensureAborted();
9129
8846
  }
9130
- };
9131
- ConnectionManager.prototype.sendActivityCheck = function () {
9132
- var _this = this;
8847
+ }
8848
+ sendActivityCheck() {
9133
8849
  this.stopActivityCheck();
9134
8850
  this.connection.ping();
9135
- this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
9136
- _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
9137
- _this.retryIn(0);
8851
+ this.activityTimer = new timers_OneOffTimer(this.options.pongTimeout, () => {
8852
+ this.timeline.error({ pong_timed_out: this.options.pongTimeout });
8853
+ this.retryIn(0);
9138
8854
  });
9139
- };
9140
- ConnectionManager.prototype.resetActivityCheck = function () {
9141
- var _this = this;
8855
+ }
8856
+ resetActivityCheck() {
9142
8857
  this.stopActivityCheck();
9143
8858
  if (this.connection && !this.connection.handlesActivityChecks()) {
9144
- this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
9145
- _this.sendActivityCheck();
8859
+ this.activityTimer = new timers_OneOffTimer(this.activityTimeout, () => {
8860
+ this.sendActivityCheck();
9146
8861
  });
9147
8862
  }
9148
- };
9149
- ConnectionManager.prototype.stopActivityCheck = function () {
8863
+ }
8864
+ stopActivityCheck() {
9150
8865
  if (this.activityTimer) {
9151
8866
  this.activityTimer.ensureAborted();
9152
8867
  }
9153
- };
9154
- ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
9155
- var _this = this;
8868
+ }
8869
+ buildConnectionCallbacks(errorCallbacks) {
9156
8870
  return extend({}, errorCallbacks, {
9157
- message: function (message) {
9158
- _this.resetActivityCheck();
9159
- _this.emit('message', message);
8871
+ message: message => {
8872
+ this.resetActivityCheck();
8873
+ this.emit('message', message);
9160
8874
  },
9161
- ping: function () {
9162
- _this.send_event('pusher:pong', {});
8875
+ ping: () => {
8876
+ this.send_event('pusher:pong', {});
9163
8877
  },
9164
- activity: function () {
9165
- _this.resetActivityCheck();
8878
+ activity: () => {
8879
+ this.resetActivityCheck();
9166
8880
  },
9167
- error: function (error) {
9168
- _this.emit('error', error);
8881
+ error: error => {
8882
+ this.emit('error', error);
9169
8883
  },
9170
- closed: function () {
9171
- _this.abandonConnection();
9172
- if (_this.shouldRetry()) {
9173
- _this.retryIn(1000);
8884
+ closed: () => {
8885
+ this.abandonConnection();
8886
+ if (this.shouldRetry()) {
8887
+ this.retryIn(1000);
9174
8888
  }
9175
8889
  }
9176
8890
  });
9177
- };
9178
- ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
9179
- var _this = this;
8891
+ }
8892
+ buildHandshakeCallbacks(errorCallbacks) {
9180
8893
  return extend({}, errorCallbacks, {
9181
- connected: function (handshake) {
9182
- _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
9183
- _this.clearUnavailableTimer();
9184
- _this.setConnection(handshake.connection);
9185
- _this.socket_id = _this.connection.id;
9186
- _this.updateState('connected', { socket_id: _this.socket_id });
8894
+ connected: (handshake) => {
8895
+ this.activityTimeout = Math.min(this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
8896
+ this.clearUnavailableTimer();
8897
+ this.setConnection(handshake.connection);
8898
+ this.socket_id = this.connection.id;
8899
+ this.updateState('connected', { socket_id: this.socket_id });
9187
8900
  }
9188
8901
  });
9189
- };
9190
- ConnectionManager.prototype.buildErrorCallbacks = function () {
9191
- var _this = this;
9192
- var withErrorEmitted = function (callback) {
9193
- return function (result) {
8902
+ }
8903
+ buildErrorCallbacks() {
8904
+ let withErrorEmitted = callback => {
8905
+ return (result) => {
9194
8906
  if (result.error) {
9195
- _this.emit('error', { type: 'WebSocketError', error: result.error });
8907
+ this.emit('error', { type: 'WebSocketError', error: result.error });
9196
8908
  }
9197
8909
  callback(result);
9198
8910
  };
9199
8911
  };
9200
8912
  return {
9201
- tls_only: withErrorEmitted(function () {
9202
- _this.usingTLS = true;
9203
- _this.updateStrategy();
9204
- _this.retryIn(0);
8913
+ tls_only: withErrorEmitted(() => {
8914
+ this.usingTLS = true;
8915
+ this.updateStrategy();
8916
+ this.retryIn(0);
9205
8917
  }),
9206
- refused: withErrorEmitted(function () {
9207
- _this.disconnect();
8918
+ refused: withErrorEmitted(() => {
8919
+ this.disconnect();
9208
8920
  }),
9209
- backoff: withErrorEmitted(function () {
9210
- _this.retryIn(1000);
8921
+ backoff: withErrorEmitted(() => {
8922
+ this.retryIn(1000);
9211
8923
  }),
9212
- retry: withErrorEmitted(function () {
9213
- _this.retryIn(0);
8924
+ retry: withErrorEmitted(() => {
8925
+ this.retryIn(0);
9214
8926
  })
9215
8927
  };
9216
- };
9217
- ConnectionManager.prototype.setConnection = function (connection) {
8928
+ }
8929
+ setConnection(connection) {
9218
8930
  this.connection = connection;
9219
8931
  for (var event in this.connectionCallbacks) {
9220
8932
  this.connection.bind(event, this.connectionCallbacks[event]);
9221
8933
  }
9222
8934
  this.resetActivityCheck();
9223
- };
9224
- ConnectionManager.prototype.abandonConnection = function () {
8935
+ }
8936
+ abandonConnection() {
9225
8937
  if (!this.connection) {
9226
8938
  return;
9227
8939
  }
@@ -9232,8 +8944,8 @@ var connection_manager_ConnectionManager = (function (_super) {
9232
8944
  var connection = this.connection;
9233
8945
  this.connection = null;
9234
8946
  return connection;
9235
- };
9236
- ConnectionManager.prototype.updateState = function (newState, data) {
8947
+ }
8948
+ updateState(newState, data) {
9237
8949
  var previousState = this.state;
9238
8950
  this.state = newState;
9239
8951
  if (previousState !== newState) {
@@ -9246,56 +8958,52 @@ var connection_manager_ConnectionManager = (function (_super) {
9246
8958
  this.emit('state_change', { previous: previousState, current: newState });
9247
8959
  this.emit(newState, data);
9248
8960
  }
9249
- };
9250
- ConnectionManager.prototype.shouldRetry = function () {
8961
+ }
8962
+ shouldRetry() {
9251
8963
  return this.state === 'connecting' || this.state === 'connected';
9252
- };
9253
- return ConnectionManager;
9254
- }(dispatcher));
9255
- /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
8964
+ }
8965
+ }
9256
8966
 
9257
8967
  // CONCATENATED MODULE: ./src/core/channels/channels.ts
9258
8968
 
9259
8969
 
9260
8970
 
9261
8971
 
9262
- var channels_Channels = (function () {
9263
- function Channels() {
8972
+ class channels_Channels {
8973
+ constructor() {
9264
8974
  this.channels = {};
9265
8975
  }
9266
- Channels.prototype.add = function (name, pusher) {
8976
+ add(name, pusher) {
9267
8977
  if (!this.channels[name]) {
9268
8978
  this.channels[name] = createChannel(name, pusher);
9269
8979
  }
9270
8980
  return this.channels[name];
9271
- };
9272
- Channels.prototype.all = function () {
8981
+ }
8982
+ all() {
9273
8983
  return values(this.channels);
9274
- };
9275
- Channels.prototype.find = function (name) {
8984
+ }
8985
+ find(name) {
9276
8986
  return this.channels[name];
9277
- };
9278
- Channels.prototype.remove = function (name) {
8987
+ }
8988
+ remove(name) {
9279
8989
  var channel = this.channels[name];
9280
8990
  delete this.channels[name];
9281
8991
  return channel;
9282
- };
9283
- Channels.prototype.disconnect = function () {
8992
+ }
8993
+ disconnect() {
9284
8994
  objectApply(this.channels, function (channel) {
9285
8995
  channel.disconnect();
9286
8996
  });
9287
- };
9288
- return Channels;
9289
- }());
9290
- /* harmony default export */ var channels = (channels_Channels);
8997
+ }
8998
+ }
9291
8999
  function createChannel(name, pusher) {
9292
9000
  if (name.indexOf('private-encrypted-') === 0) {
9293
9001
  if (pusher.config.nacl) {
9294
9002
  return factory.createEncryptedChannel(name, pusher, pusher.config.nacl);
9295
9003
  }
9296
- var errMsg = 'Tried to subscribe to a private-encrypted- channel but no nacl implementation available';
9297
- var suffix = url_store.buildLogSuffix('encryptedChannelSupport');
9298
- throw new UnsupportedFeature(errMsg + ". " + suffix);
9004
+ let errMsg = 'Tried to subscribe to a private-encrypted- channel but no nacl implementation available';
9005
+ let suffix = url_store.buildLogSuffix('encryptedChannelSupport');
9006
+ throw new UnsupportedFeature(`${errMsg}. ${suffix}`);
9299
9007
  }
9300
9008
  else if (name.indexOf('private-') === 0) {
9301
9009
  return factory.createPrivateChannel(name, pusher);
@@ -9322,97 +9030,94 @@ function createChannel(name, pusher) {
9322
9030
 
9323
9031
 
9324
9032
  var Factory = {
9325
- createChannels: function () {
9326
- return new channels();
9033
+ createChannels() {
9034
+ return new channels_Channels();
9327
9035
  },
9328
- createConnectionManager: function (key, options) {
9329
- return new connection_manager(key, options);
9036
+ createConnectionManager(key, options) {
9037
+ return new connection_manager_ConnectionManager(key, options);
9330
9038
  },
9331
- createChannel: function (name, pusher) {
9332
- return new channels_channel(name, pusher);
9039
+ createChannel(name, pusher) {
9040
+ return new channel_Channel(name, pusher);
9333
9041
  },
9334
- createPrivateChannel: function (name, pusher) {
9335
- return new private_channel(name, pusher);
9042
+ createPrivateChannel(name, pusher) {
9043
+ return new private_channel_PrivateChannel(name, pusher);
9336
9044
  },
9337
- createPresenceChannel: function (name, pusher) {
9338
- return new presence_channel(name, pusher);
9045
+ createPresenceChannel(name, pusher) {
9046
+ return new presence_channel_PresenceChannel(name, pusher);
9339
9047
  },
9340
- createEncryptedChannel: function (name, pusher, nacl) {
9341
- return new encrypted_channel(name, pusher, nacl);
9048
+ createEncryptedChannel(name, pusher, nacl) {
9049
+ return new encrypted_channel_EncryptedChannel(name, pusher, nacl);
9342
9050
  },
9343
- createTimelineSender: function (timeline, options) {
9344
- return new timeline_sender(timeline, options);
9051
+ createTimelineSender(timeline, options) {
9052
+ return new timeline_sender_TimelineSender(timeline, options);
9345
9053
  },
9346
- createHandshake: function (transport, callback) {
9347
- return new connection_handshake(transport, callback);
9054
+ createHandshake(transport, callback) {
9055
+ return new handshake_Handshake(transport, callback);
9348
9056
  },
9349
- createAssistantToTheTransportManager: function (manager, transport, options) {
9350
- return new assistant_to_the_transport_manager(manager, transport, options);
9057
+ createAssistantToTheTransportManager(manager, transport, options) {
9058
+ return new assistant_to_the_transport_manager_AssistantToTheTransportManager(manager, transport, options);
9351
9059
  }
9352
9060
  };
9353
9061
  /* harmony default export */ var factory = (Factory);
9354
9062
 
9355
9063
  // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
9356
9064
 
9357
- var transport_manager_TransportManager = (function () {
9358
- function TransportManager(options) {
9065
+ class transport_manager_TransportManager {
9066
+ constructor(options) {
9359
9067
  this.options = options || {};
9360
9068
  this.livesLeft = this.options.lives || Infinity;
9361
9069
  }
9362
- TransportManager.prototype.getAssistant = function (transport) {
9070
+ getAssistant(transport) {
9363
9071
  return factory.createAssistantToTheTransportManager(this, transport, {
9364
9072
  minPingDelay: this.options.minPingDelay,
9365
9073
  maxPingDelay: this.options.maxPingDelay
9366
9074
  });
9367
- };
9368
- TransportManager.prototype.isAlive = function () {
9075
+ }
9076
+ isAlive() {
9369
9077
  return this.livesLeft > 0;
9370
- };
9371
- TransportManager.prototype.reportDeath = function () {
9078
+ }
9079
+ reportDeath() {
9372
9080
  this.livesLeft -= 1;
9373
- };
9374
- return TransportManager;
9375
- }());
9376
- /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
9081
+ }
9082
+ }
9377
9083
 
9378
9084
  // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
9379
9085
 
9380
9086
 
9381
9087
 
9382
- var sequential_strategy_SequentialStrategy = (function () {
9383
- function SequentialStrategy(strategies, options) {
9088
+ class sequential_strategy_SequentialStrategy {
9089
+ constructor(strategies, options) {
9384
9090
  this.strategies = strategies;
9385
9091
  this.loop = Boolean(options.loop);
9386
9092
  this.failFast = Boolean(options.failFast);
9387
9093
  this.timeout = options.timeout;
9388
9094
  this.timeoutLimit = options.timeoutLimit;
9389
9095
  }
9390
- SequentialStrategy.prototype.isSupported = function () {
9096
+ isSupported() {
9391
9097
  return any(this.strategies, util.method('isSupported'));
9392
- };
9393
- SequentialStrategy.prototype.connect = function (minPriority, callback) {
9394
- var _this = this;
9098
+ }
9099
+ connect(minPriority, callback) {
9395
9100
  var strategies = this.strategies;
9396
9101
  var current = 0;
9397
9102
  var timeout = this.timeout;
9398
9103
  var runner = null;
9399
- var tryNextStrategy = function (error, handshake) {
9104
+ var tryNextStrategy = (error, handshake) => {
9400
9105
  if (handshake) {
9401
9106
  callback(null, handshake);
9402
9107
  }
9403
9108
  else {
9404
9109
  current = current + 1;
9405
- if (_this.loop) {
9110
+ if (this.loop) {
9406
9111
  current = current % strategies.length;
9407
9112
  }
9408
9113
  if (current < strategies.length) {
9409
9114
  if (timeout) {
9410
9115
  timeout = timeout * 2;
9411
- if (_this.timeoutLimit) {
9412
- timeout = Math.min(timeout, _this.timeoutLimit);
9116
+ if (this.timeoutLimit) {
9117
+ timeout = Math.min(timeout, this.timeoutLimit);
9413
9118
  }
9414
9119
  }
9415
- runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
9120
+ runner = this.tryStrategy(strategies[current], minPriority, { timeout, failFast: this.failFast }, tryNextStrategy);
9416
9121
  }
9417
9122
  else {
9418
9123
  callback(true);
@@ -9431,12 +9136,12 @@ var sequential_strategy_SequentialStrategy = (function () {
9431
9136
  }
9432
9137
  }
9433
9138
  };
9434
- };
9435
- SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
9139
+ }
9140
+ tryStrategy(strategy, minPriority, options, callback) {
9436
9141
  var timer = null;
9437
9142
  var runner = null;
9438
9143
  if (options.timeout > 0) {
9439
- timer = new OneOffTimer(options.timeout, function () {
9144
+ timer = new timers_OneOffTimer(options.timeout, function () {
9440
9145
  runner.abort();
9441
9146
  callback(true);
9442
9147
  });
@@ -9461,22 +9166,20 @@ var sequential_strategy_SequentialStrategy = (function () {
9461
9166
  runner.forceMinPriority(p);
9462
9167
  }
9463
9168
  };
9464
- };
9465
- return SequentialStrategy;
9466
- }());
9467
- /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
9169
+ }
9170
+ }
9468
9171
 
9469
9172
  // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
9470
9173
 
9471
9174
 
9472
- var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
9473
- function BestConnectedEverStrategy(strategies) {
9175
+ class best_connected_ever_strategy_BestConnectedEverStrategy {
9176
+ constructor(strategies) {
9474
9177
  this.strategies = strategies;
9475
9178
  }
9476
- BestConnectedEverStrategy.prototype.isSupported = function () {
9179
+ isSupported() {
9477
9180
  return any(this.strategies, util.method('isSupported'));
9478
- };
9479
- BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
9181
+ }
9182
+ connect(minPriority, callback) {
9480
9183
  return connect(this.strategies, minPriority, function (i, runners) {
9481
9184
  return function (error, handshake) {
9482
9185
  runners[i].error = error;
@@ -9492,10 +9195,8 @@ var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
9492
9195
  callback(null, handshake);
9493
9196
  };
9494
9197
  });
9495
- };
9496
- return BestConnectedEverStrategy;
9497
- }());
9498
- /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
9198
+ }
9199
+ }
9499
9200
  function connect(strategies, minPriority, callbackBuilder) {
9500
9201
  var runners = map(strategies, function (strategy, i, _, rs) {
9501
9202
  return strategy.connect(minPriority, callbackBuilder(i, rs));
@@ -9528,18 +9229,18 @@ function abortRunner(runner) {
9528
9229
 
9529
9230
 
9530
9231
 
9531
- var cached_strategy_CachedStrategy = (function () {
9532
- function CachedStrategy(strategy, transports, options) {
9232
+ class cached_strategy_CachedStrategy {
9233
+ constructor(strategy, transports, options) {
9533
9234
  this.strategy = strategy;
9534
9235
  this.transports = transports;
9535
9236
  this.ttl = options.ttl || 1800 * 1000;
9536
9237
  this.usingTLS = options.useTLS;
9537
9238
  this.timeline = options.timeline;
9538
9239
  }
9539
- CachedStrategy.prototype.isSupported = function () {
9240
+ isSupported() {
9540
9241
  return this.strategy.isSupported();
9541
- };
9542
- CachedStrategy.prototype.connect = function (minPriority, callback) {
9242
+ }
9243
+ connect(minPriority, callback) {
9543
9244
  var usingTLS = this.usingTLS;
9544
9245
  var info = fetchTransportCache(usingTLS);
9545
9246
  var strategies = [this.strategy];
@@ -9551,7 +9252,7 @@ var cached_strategy_CachedStrategy = (function () {
9551
9252
  transport: info.transport,
9552
9253
  latency: info.latency
9553
9254
  });
9554
- strategies.push(new sequential_strategy([transport], {
9255
+ strategies.push(new sequential_strategy_SequentialStrategy([transport], {
9555
9256
  timeout: info.latency * 2 + 1000,
9556
9257
  failFast: true
9557
9258
  }));
@@ -9587,10 +9288,8 @@ var cached_strategy_CachedStrategy = (function () {
9587
9288
  }
9588
9289
  }
9589
9290
  };
9590
- };
9591
- return CachedStrategy;
9592
- }());
9593
- /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
9291
+ }
9292
+ }
9594
9293
  function getTransportCacheKey(usingTLS) {
9595
9294
  return 'pusherTransport' + (usingTLS ? 'TLS' : 'NonTLS');
9596
9295
  }
@@ -9636,19 +9335,18 @@ function flushTransportCache(usingTLS) {
9636
9335
 
9637
9336
  // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
9638
9337
 
9639
- var delayed_strategy_DelayedStrategy = (function () {
9640
- function DelayedStrategy(strategy, _a) {
9641
- var number = _a.delay;
9338
+ class delayed_strategy_DelayedStrategy {
9339
+ constructor(strategy, { delay: number }) {
9642
9340
  this.strategy = strategy;
9643
9341
  this.options = { delay: number };
9644
9342
  }
9645
- DelayedStrategy.prototype.isSupported = function () {
9343
+ isSupported() {
9646
9344
  return this.strategy.isSupported();
9647
- };
9648
- DelayedStrategy.prototype.connect = function (minPriority, callback) {
9345
+ }
9346
+ connect(minPriority, callback) {
9649
9347
  var strategy = this.strategy;
9650
9348
  var runner;
9651
- var timer = new OneOffTimer(this.options.delay, function () {
9349
+ var timer = new timers_OneOffTimer(this.options.delay, function () {
9652
9350
  runner = strategy.connect(minPriority, callback);
9653
9351
  });
9654
9352
  return {
@@ -9665,39 +9363,35 @@ var delayed_strategy_DelayedStrategy = (function () {
9665
9363
  }
9666
9364
  }
9667
9365
  };
9668
- };
9669
- return DelayedStrategy;
9670
- }());
9671
- /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
9366
+ }
9367
+ }
9672
9368
 
9673
9369
  // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
9674
- var IfStrategy = (function () {
9675
- function IfStrategy(test, trueBranch, falseBranch) {
9370
+ class IfStrategy {
9371
+ constructor(test, trueBranch, falseBranch) {
9676
9372
  this.test = test;
9677
9373
  this.trueBranch = trueBranch;
9678
9374
  this.falseBranch = falseBranch;
9679
9375
  }
9680
- IfStrategy.prototype.isSupported = function () {
9376
+ isSupported() {
9681
9377
  var branch = this.test() ? this.trueBranch : this.falseBranch;
9682
9378
  return branch.isSupported();
9683
- };
9684
- IfStrategy.prototype.connect = function (minPriority, callback) {
9379
+ }
9380
+ connect(minPriority, callback) {
9685
9381
  var branch = this.test() ? this.trueBranch : this.falseBranch;
9686
9382
  return branch.connect(minPriority, callback);
9687
- };
9688
- return IfStrategy;
9689
- }());
9690
- /* harmony default export */ var if_strategy = (IfStrategy);
9383
+ }
9384
+ }
9691
9385
 
9692
9386
  // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
9693
- var FirstConnectedStrategy = (function () {
9694
- function FirstConnectedStrategy(strategy) {
9387
+ class FirstConnectedStrategy {
9388
+ constructor(strategy) {
9695
9389
  this.strategy = strategy;
9696
9390
  }
9697
- FirstConnectedStrategy.prototype.isSupported = function () {
9391
+ isSupported() {
9698
9392
  return this.strategy.isSupported();
9699
- };
9700
- FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
9393
+ }
9394
+ connect(minPriority, callback) {
9701
9395
  var runner = this.strategy.connect(minPriority, function (error, handshake) {
9702
9396
  if (handshake) {
9703
9397
  runner.abort();
@@ -9705,10 +9399,8 @@ var FirstConnectedStrategy = (function () {
9705
9399
  callback(error, handshake);
9706
9400
  });
9707
9401
  return runner;
9708
- };
9709
- return FirstConnectedStrategy;
9710
- }());
9711
- /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
9402
+ }
9403
+ }
9712
9404
 
9713
9405
  // CONCATENATED MODULE: ./src/runtimes/isomorphic/default_strategy.ts
9714
9406
 
@@ -9749,12 +9441,12 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
9749
9441
  timeout: 15000,
9750
9442
  timeoutLimit: 60000
9751
9443
  };
9752
- var ws_manager = new transport_manager({
9444
+ var ws_manager = new transport_manager_TransportManager({
9753
9445
  lives: 2,
9754
9446
  minPingDelay: 10000,
9755
9447
  maxPingDelay: config.activityTimeout
9756
9448
  });
9757
- var streaming_manager = new transport_manager({
9449
+ var streaming_manager = new transport_manager_TransportManager({
9758
9450
  lives: 2,
9759
9451
  minPingDelay: 10000,
9760
9452
  maxPingDelay: config.activityTimeout
@@ -9763,31 +9455,31 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
9763
9455
  var wss_transport = defineTransportStrategy('wss', 'ws', 3, wss_options, ws_manager);
9764
9456
  var xhr_streaming_transport = defineTransportStrategy('xhr_streaming', 'xhr_streaming', 1, http_options, streaming_manager);
9765
9457
  var xhr_polling_transport = defineTransportStrategy('xhr_polling', 'xhr_polling', 1, http_options);
9766
- var ws_loop = new sequential_strategy([ws_transport], timeouts);
9767
- var wss_loop = new sequential_strategy([wss_transport], timeouts);
9768
- var streaming_loop = new sequential_strategy([xhr_streaming_transport], timeouts);
9769
- var polling_loop = new sequential_strategy([xhr_polling_transport], timeouts);
9770
- var http_loop = new sequential_strategy([
9771
- new if_strategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy([
9458
+ var ws_loop = new sequential_strategy_SequentialStrategy([ws_transport], timeouts);
9459
+ var wss_loop = new sequential_strategy_SequentialStrategy([wss_transport], timeouts);
9460
+ var streaming_loop = new sequential_strategy_SequentialStrategy([xhr_streaming_transport], timeouts);
9461
+ var polling_loop = new sequential_strategy_SequentialStrategy([xhr_polling_transport], timeouts);
9462
+ var http_loop = new sequential_strategy_SequentialStrategy([
9463
+ new IfStrategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy_BestConnectedEverStrategy([
9772
9464
  streaming_loop,
9773
- new delayed_strategy(polling_loop, { delay: 4000 })
9465
+ new delayed_strategy_DelayedStrategy(polling_loop, { delay: 4000 })
9774
9466
  ]), polling_loop)
9775
9467
  ], timeouts);
9776
9468
  var wsStrategy;
9777
9469
  if (baseOptions.useTLS) {
9778
- wsStrategy = new best_connected_ever_strategy([
9470
+ wsStrategy = new best_connected_ever_strategy_BestConnectedEverStrategy([
9779
9471
  ws_loop,
9780
- new delayed_strategy(http_loop, { delay: 2000 })
9472
+ new delayed_strategy_DelayedStrategy(http_loop, { delay: 2000 })
9781
9473
  ]);
9782
9474
  }
9783
9475
  else {
9784
- wsStrategy = new best_connected_ever_strategy([
9476
+ wsStrategy = new best_connected_ever_strategy_BestConnectedEverStrategy([
9785
9477
  ws_loop,
9786
- new delayed_strategy(wss_loop, { delay: 2000 }),
9787
- new delayed_strategy(http_loop, { delay: 5000 })
9478
+ new delayed_strategy_DelayedStrategy(wss_loop, { delay: 2000 }),
9479
+ new delayed_strategy_DelayedStrategy(http_loop, { delay: 5000 })
9788
9480
  ]);
9789
9481
  }
9790
- return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_loop)), definedTransports, {
9482
+ return new cached_strategy_CachedStrategy(new FirstConnectedStrategy(new IfStrategy(testSupportsStrategy(ws_transport), wsStrategy, http_loop)), definedTransports, {
9791
9483
  ttl: 1800000,
9792
9484
  timeline: baseOptions.timeline,
9793
9485
  useTLS: baseOptions.useTLS
@@ -9810,37 +9502,21 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
9810
9502
  });
9811
9503
 
9812
9504
  // CONCATENATED MODULE: ./src/core/http/http_request.ts
9813
- var http_request_extends = (undefined && undefined.__extends) || (function () {
9814
- var extendStatics = function (d, b) {
9815
- extendStatics = Object.setPrototypeOf ||
9816
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
9817
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
9818
- return extendStatics(d, b);
9819
- };
9820
- return function (d, b) {
9821
- extendStatics(d, b);
9822
- function __() { this.constructor = d; }
9823
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
9824
- };
9825
- })();
9826
9505
 
9827
9506
 
9828
- var MAX_BUFFER_LENGTH = 256 * 1024;
9829
- var http_request_HTTPRequest = (function (_super) {
9830
- http_request_extends(HTTPRequest, _super);
9831
- function HTTPRequest(hooks, method, url) {
9832
- var _this = _super.call(this) || this;
9833
- _this.hooks = hooks;
9834
- _this.method = method;
9835
- _this.url = url;
9836
- return _this;
9507
+ const MAX_BUFFER_LENGTH = 256 * 1024;
9508
+ class http_request_HTTPRequest extends dispatcher_Dispatcher {
9509
+ constructor(hooks, method, url) {
9510
+ super();
9511
+ this.hooks = hooks;
9512
+ this.method = method;
9513
+ this.url = url;
9837
9514
  }
9838
- HTTPRequest.prototype.start = function (payload) {
9839
- var _this = this;
9515
+ start(payload) {
9840
9516
  this.position = 0;
9841
9517
  this.xhr = this.hooks.getRequest(this);
9842
- this.unloader = function () {
9843
- _this.close();
9518
+ this.unloader = () => {
9519
+ this.close();
9844
9520
  };
9845
9521
  node_runtime.addUnloadListener(this.unloader);
9846
9522
  this.xhr.open(this.method, this.url, true);
@@ -9848,8 +9524,8 @@ var http_request_HTTPRequest = (function (_super) {
9848
9524
  this.xhr.setRequestHeader('Content-Type', 'application/json');
9849
9525
  }
9850
9526
  this.xhr.send(payload);
9851
- };
9852
- HTTPRequest.prototype.close = function () {
9527
+ }
9528
+ close() {
9853
9529
  if (this.unloader) {
9854
9530
  node_runtime.removeUnloadListener(this.unloader);
9855
9531
  this.unloader = null;
@@ -9858,8 +9534,8 @@ var http_request_HTTPRequest = (function (_super) {
9858
9534
  this.hooks.abortRequest(this.xhr);
9859
9535
  this.xhr = null;
9860
9536
  }
9861
- };
9862
- HTTPRequest.prototype.onChunk = function (status, data) {
9537
+ }
9538
+ onChunk(status, data) {
9863
9539
  while (true) {
9864
9540
  var chunk = this.advanceBuffer(data);
9865
9541
  if (chunk) {
@@ -9872,8 +9548,8 @@ var http_request_HTTPRequest = (function (_super) {
9872
9548
  if (this.isBufferTooLong(data)) {
9873
9549
  this.emit('buffer_too_long');
9874
9550
  }
9875
- };
9876
- HTTPRequest.prototype.advanceBuffer = function (buffer) {
9551
+ }
9552
+ advanceBuffer(buffer) {
9877
9553
  var unreadData = buffer.slice(this.position);
9878
9554
  var endOfLinePosition = unreadData.indexOf('\n');
9879
9555
  if (endOfLinePosition !== -1) {
@@ -9883,13 +9559,11 @@ var http_request_HTTPRequest = (function (_super) {
9883
9559
  else {
9884
9560
  return null;
9885
9561
  }
9886
- };
9887
- HTTPRequest.prototype.isBufferTooLong = function (buffer) {
9562
+ }
9563
+ isBufferTooLong(buffer) {
9888
9564
  return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
9889
- };
9890
- return HTTPRequest;
9891
- }(dispatcher));
9892
- /* harmony default export */ var http_request = (http_request_HTTPRequest);
9565
+ }
9566
+ }
9893
9567
 
9894
9568
  // CONCATENATED MODULE: ./src/core/http/state.ts
9895
9569
  var State;
@@ -9905,24 +9579,24 @@ var State;
9905
9579
 
9906
9580
 
9907
9581
  var autoIncrement = 1;
9908
- var http_socket_HTTPSocket = (function () {
9909
- function HTTPSocket(hooks, url) {
9582
+ class http_socket_HTTPSocket {
9583
+ constructor(hooks, url) {
9910
9584
  this.hooks = hooks;
9911
9585
  this.session = randomNumber(1000) + '/' + randomString(8);
9912
9586
  this.location = getLocation(url);
9913
9587
  this.readyState = state.CONNECTING;
9914
9588
  this.openStream();
9915
9589
  }
9916
- HTTPSocket.prototype.send = function (payload) {
9590
+ send(payload) {
9917
9591
  return this.sendRaw(JSON.stringify([payload]));
9918
- };
9919
- HTTPSocket.prototype.ping = function () {
9592
+ }
9593
+ ping() {
9920
9594
  this.hooks.sendHeartbeat(this);
9921
- };
9922
- HTTPSocket.prototype.close = function (code, reason) {
9595
+ }
9596
+ close(code, reason) {
9923
9597
  this.onClose(code, reason, true);
9924
- };
9925
- HTTPSocket.prototype.sendRaw = function (payload) {
9598
+ }
9599
+ sendRaw(payload) {
9926
9600
  if (this.readyState === state.OPEN) {
9927
9601
  try {
9928
9602
  node_runtime.createSocketRequest('POST', getUniqueURL(getSendURL(this.location, this.session))).start(payload);
@@ -9935,12 +9609,12 @@ var http_socket_HTTPSocket = (function () {
9935
9609
  else {
9936
9610
  return false;
9937
9611
  }
9938
- };
9939
- HTTPSocket.prototype.reconnect = function () {
9612
+ }
9613
+ reconnect() {
9940
9614
  this.closeStream();
9941
9615
  this.openStream();
9942
- };
9943
- HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
9616
+ }
9617
+ onClose(code, reason, wasClean) {
9944
9618
  this.closeStream();
9945
9619
  this.readyState = state.CLOSED;
9946
9620
  if (this.onclose) {
@@ -9950,8 +9624,8 @@ var http_socket_HTTPSocket = (function () {
9950
9624
  wasClean: wasClean
9951
9625
  });
9952
9626
  }
9953
- };
9954
- HTTPSocket.prototype.onChunk = function (chunk) {
9627
+ }
9628
+ onChunk(chunk) {
9955
9629
  if (chunk.status !== 200) {
9956
9630
  return;
9957
9631
  }
@@ -9983,8 +9657,8 @@ var http_socket_HTTPSocket = (function () {
9983
9657
  this.onClose(payload[0], payload[1], true);
9984
9658
  break;
9985
9659
  }
9986
- };
9987
- HTTPSocket.prototype.onOpen = function (options) {
9660
+ }
9661
+ onOpen(options) {
9988
9662
  if (this.readyState === state.CONNECTING) {
9989
9663
  if (options && options.hostname) {
9990
9664
  this.location.base = replaceHost(this.location.base, options.hostname);
@@ -9997,53 +9671,51 @@ var http_socket_HTTPSocket = (function () {
9997
9671
  else {
9998
9672
  this.onClose(1006, 'Server lost session', true);
9999
9673
  }
10000
- };
10001
- HTTPSocket.prototype.onEvent = function (event) {
9674
+ }
9675
+ onEvent(event) {
10002
9676
  if (this.readyState === state.OPEN && this.onmessage) {
10003
9677
  this.onmessage({ data: event });
10004
9678
  }
10005
- };
10006
- HTTPSocket.prototype.onActivity = function () {
9679
+ }
9680
+ onActivity() {
10007
9681
  if (this.onactivity) {
10008
9682
  this.onactivity();
10009
9683
  }
10010
- };
10011
- HTTPSocket.prototype.onError = function (error) {
9684
+ }
9685
+ onError(error) {
10012
9686
  if (this.onerror) {
10013
9687
  this.onerror(error);
10014
9688
  }
10015
- };
10016
- HTTPSocket.prototype.openStream = function () {
10017
- var _this = this;
9689
+ }
9690
+ openStream() {
10018
9691
  this.stream = node_runtime.createSocketRequest('POST', getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
10019
- this.stream.bind('chunk', function (chunk) {
10020
- _this.onChunk(chunk);
9692
+ this.stream.bind('chunk', chunk => {
9693
+ this.onChunk(chunk);
10021
9694
  });
10022
- this.stream.bind('finished', function (status) {
10023
- _this.hooks.onFinished(_this, status);
9695
+ this.stream.bind('finished', status => {
9696
+ this.hooks.onFinished(this, status);
10024
9697
  });
10025
- this.stream.bind('buffer_too_long', function () {
10026
- _this.reconnect();
9698
+ this.stream.bind('buffer_too_long', () => {
9699
+ this.reconnect();
10027
9700
  });
10028
9701
  try {
10029
9702
  this.stream.start();
10030
9703
  }
10031
9704
  catch (error) {
10032
- util.defer(function () {
10033
- _this.onError(error);
10034
- _this.onClose(1006, 'Could not start streaming', false);
9705
+ util.defer(() => {
9706
+ this.onError(error);
9707
+ this.onClose(1006, 'Could not start streaming', false);
10035
9708
  });
10036
9709
  }
10037
- };
10038
- HTTPSocket.prototype.closeStream = function () {
9710
+ }
9711
+ closeStream() {
10039
9712
  if (this.stream) {
10040
9713
  this.stream.unbind_all();
10041
9714
  this.stream.close();
10042
9715
  this.stream = null;
10043
9716
  }
10044
- };
10045
- return HTTPSocket;
10046
- }());
9717
+ }
9718
+ }
10047
9719
  function getLocation(url) {
10048
9720
  var parts = /([^\?]*)\/*(\??.*)/.exec(url);
10049
9721
  return {
@@ -10150,20 +9822,20 @@ var http_xhr_request_hooks = {
10150
9822
 
10151
9823
 
10152
9824
  var HTTP = {
10153
- createStreamingSocket: function (url) {
9825
+ createStreamingSocket(url) {
10154
9826
  return this.createSocket(http_streaming_socket, url);
10155
9827
  },
10156
- createPollingSocket: function (url) {
9828
+ createPollingSocket(url) {
10157
9829
  return this.createSocket(http_polling_socket, url);
10158
9830
  },
10159
- createSocket: function (hooks, url) {
9831
+ createSocket(hooks, url) {
10160
9832
  return new http_socket(hooks, url);
10161
9833
  },
10162
- createXHR: function (method, url) {
9834
+ createXHR(method, url) {
10163
9835
  return this.createRequest(http_xhr_request, method, url);
10164
9836
  },
10165
- createRequest: function (hooks, method, url) {
10166
- return new http_request(hooks, method, url);
9837
+ createRequest(hooks, method, url) {
9838
+ return new http_request_HTTPRequest(hooks, method, url);
10167
9839
  }
10168
9840
  };
10169
9841
  /* harmony default export */ var http_http = (HTTP);
@@ -10179,24 +9851,24 @@ var Isomorphic = {
10179
9851
  Transports: transports,
10180
9852
  transportConnectionInitializer: transport_connection_initializer,
10181
9853
  HTTPFactory: http_http,
10182
- setup: function (PusherClass) {
9854
+ setup(PusherClass) {
10183
9855
  PusherClass.ready();
10184
9856
  },
10185
- getLocalStorage: function () {
9857
+ getLocalStorage() {
10186
9858
  return undefined;
10187
9859
  },
10188
- getClientFeatures: function () {
9860
+ getClientFeatures() {
10189
9861
  return keys(filterObject({ ws: transports.ws }, function (t) {
10190
9862
  return t.isSupported({});
10191
9863
  }));
10192
9864
  },
10193
- getProtocol: function () {
9865
+ getProtocol() {
10194
9866
  return 'http:';
10195
9867
  },
10196
- isXHRSupported: function () {
9868
+ isXHRSupported() {
10197
9869
  return true;
10198
9870
  },
10199
- createSocketRequest: function (method, url) {
9871
+ createSocketRequest(method, url) {
10200
9872
  if (this.isXHRSupported()) {
10201
9873
  return this.HTTPFactory.createXHR(method, url);
10202
9874
  }
@@ -10204,16 +9876,16 @@ var Isomorphic = {
10204
9876
  throw 'Cross-origin HTTP requests are not supported';
10205
9877
  }
10206
9878
  },
10207
- createXHR: function () {
9879
+ createXHR() {
10208
9880
  var Constructor = this.getXHRAPI();
10209
9881
  return new Constructor();
10210
9882
  },
10211
- createWebSocket: function (url) {
9883
+ createWebSocket(url) {
10212
9884
  var Constructor = this.getWebSocketAPI();
10213
9885
  return new Constructor(url);
10214
9886
  },
10215
- addUnloadListener: function (listener) { },
10216
- removeUnloadListener: function (listener) { }
9887
+ addUnloadListener(listener) { },
9888
+ removeUnloadListener(listener) { }
10217
9889
  };
10218
9890
  /* harmony default export */ var runtime = (Isomorphic);
10219
9891
 
@@ -10224,32 +9896,13 @@ var websocket = __webpack_require__(18);
10224
9896
  var XMLHttpRequest = __webpack_require__(19);
10225
9897
 
10226
9898
  // CONCATENATED MODULE: ./src/runtimes/node/net_info.ts
10227
- var net_info_extends = (undefined && undefined.__extends) || (function () {
10228
- var extendStatics = function (d, b) {
10229
- extendStatics = Object.setPrototypeOf ||
10230
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
10231
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
10232
- return extendStatics(d, b);
10233
- };
10234
- return function (d, b) {
10235
- extendStatics(d, b);
10236
- function __() { this.constructor = d; }
10237
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10238
- };
10239
- })();
10240
9899
 
10241
- var NetInfo = (function (_super) {
10242
- net_info_extends(NetInfo, _super);
10243
- function NetInfo() {
10244
- return _super !== null && _super.apply(this, arguments) || this;
10245
- }
10246
- NetInfo.prototype.isOnline = function () {
9900
+ class net_info_NetInfo extends dispatcher_Dispatcher {
9901
+ isOnline() {
10247
9902
  return true;
10248
- };
10249
- return NetInfo;
10250
- }(dispatcher));
10251
-
10252
- var net_info_Network = new NetInfo();
9903
+ }
9904
+ }
9905
+ var net_info_Network = new net_info_NetInfo();
10253
9906
 
10254
9907
  // CONCATENATED MODULE: ./src/core/auth/options.ts
10255
9908
  var AuthRequestType;
@@ -10263,15 +9916,15 @@ var AuthRequestType;
10263
9916
 
10264
9917
 
10265
9918
 
10266
- var ajax = function (context, query, authOptions, authRequestType, callback) {
10267
- var xhr = node_runtime.createXHR();
9919
+ const ajax = function (context, query, authOptions, authRequestType, callback) {
9920
+ const xhr = node_runtime.createXHR();
10268
9921
  xhr.open('POST', authOptions.endpoint, true);
10269
9922
  xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
10270
9923
  for (var headerName in authOptions.headers) {
10271
9924
  xhr.setRequestHeader(headerName, authOptions.headers[headerName]);
10272
9925
  }
10273
9926
  if (authOptions.headersProvider != null) {
10274
- var dynamicHeaders = authOptions.headersProvider();
9927
+ let dynamicHeaders = authOptions.headersProvider();
10275
9928
  for (var headerName in dynamicHeaders) {
10276
9929
  xhr.setRequestHeader(headerName, dynamicHeaders[headerName]);
10277
9930
  }
@@ -10279,31 +9932,31 @@ var ajax = function (context, query, authOptions, authRequestType, callback) {
10279
9932
  xhr.onreadystatechange = function () {
10280
9933
  if (xhr.readyState === 4) {
10281
9934
  if (xhr.status === 200) {
10282
- var data = void 0;
10283
- var parsed = false;
9935
+ let data;
9936
+ let parsed = false;
10284
9937
  try {
10285
9938
  data = JSON.parse(xhr.responseText);
10286
9939
  parsed = true;
10287
9940
  }
10288
9941
  catch (e) {
10289
- callback(new HTTPAuthError(200, "JSON returned from " + authRequestType.toString() + " endpoint was invalid, yet status code was 200. Data was: " + xhr.responseText), null);
9942
+ callback(new HTTPAuthError(200, `JSON returned from ${authRequestType.toString()} endpoint was invalid, yet status code was 200. Data was: ${xhr.responseText}`), null);
10290
9943
  }
10291
9944
  if (parsed) {
10292
9945
  callback(null, data);
10293
9946
  }
10294
9947
  }
10295
9948
  else {
10296
- var suffix = '';
9949
+ let suffix = '';
10297
9950
  switch (authRequestType) {
10298
9951
  case AuthRequestType.UserAuthentication:
10299
9952
  suffix = url_store.buildLogSuffix('authenticationEndpoint');
10300
9953
  break;
10301
9954
  case AuthRequestType.ChannelAuthorization:
10302
- suffix = "Clients must be authorized to join private or presence channels. " + url_store.buildLogSuffix('authorizationEndpoint');
9955
+ suffix = `Clients must be authorized to join private or presence channels. ${url_store.buildLogSuffix('authorizationEndpoint')}`;
10303
9956
  break;
10304
9957
  }
10305
- callback(new HTTPAuthError(xhr.status, "Unable to retrieve auth string from " + authRequestType.toString() + " endpoint - " +
10306
- ("received status: " + xhr.status + " from " + authOptions.endpoint + ". " + suffix)), null);
9958
+ callback(new HTTPAuthError(xhr.status, `Unable to retrieve auth string from ${authRequestType.toString()} endpoint - ` +
9959
+ `received status: ${xhr.status} from ${authOptions.endpoint}. ${suffix}`), null);
10307
9960
  }
10308
9961
  }
10309
9962
  };
@@ -10326,16 +9979,16 @@ var getAgent = function (sender, useTLS) {
10326
9979
  xhr.open('GET', url, true);
10327
9980
  xhr.onreadystatechange = function () {
10328
9981
  if (xhr.readyState === 4) {
10329
- var status_1 = xhr.status, responseText = xhr.responseText;
10330
- if (status_1 !== 200) {
10331
- logger.debug("TimelineSender Error: received " + status_1 + " from stats.pusher.com");
9982
+ let { status, responseText } = xhr;
9983
+ if (status !== 200) {
9984
+ logger.debug(`TimelineSender Error: received ${status} from stats.pusher.com`);
10332
9985
  return;
10333
9986
  }
10334
9987
  try {
10335
- var host = JSON.parse(responseText).host;
9988
+ var { host } = JSON.parse(responseText);
10336
9989
  }
10337
9990
  catch (e) {
10338
- logger.debug("TimelineSenderError: invalid response " + responseText);
9991
+ logger.debug(`TimelineSenderError: invalid response ${responseText}`);
10339
9992
  }
10340
9993
  if (host) {
10341
9994
  sender.host = host;
@@ -10347,7 +10000,7 @@ var getAgent = function (sender, useTLS) {
10347
10000
  };
10348
10001
  var xhr_timeline_xhr = {
10349
10002
  name: 'xhr',
10350
- getAgent: getAgent
10003
+ getAgent
10351
10004
  };
10352
10005
  /* harmony default export */ var xhr_timeline = (xhr_timeline_xhr);
10353
10006
 
@@ -10362,35 +10015,35 @@ var external_crypto_ = __webpack_require__(3);
10362
10015
 
10363
10016
 
10364
10017
 
10365
- var runtime_getDefaultStrategy = runtime.getDefaultStrategy, runtime_Transports = runtime.Transports, setup = runtime.setup, getProtocol = runtime.getProtocol, isXHRSupported = runtime.isXHRSupported, getLocalStorage = runtime.getLocalStorage, createXHR = runtime.createXHR, createWebSocket = runtime.createWebSocket, addUnloadListener = runtime.addUnloadListener, removeUnloadListener = runtime.removeUnloadListener, transportConnectionInitializer = runtime.transportConnectionInitializer, createSocketRequest = runtime.createSocketRequest, HTTPFactory = runtime.HTTPFactory;
10366
- var NodeJS = {
10018
+ const { getDefaultStrategy: runtime_getDefaultStrategy, Transports: runtime_Transports, setup, getProtocol, isXHRSupported, getLocalStorage, createXHR, createWebSocket, addUnloadListener, removeUnloadListener, transportConnectionInitializer, createSocketRequest, HTTPFactory } = runtime;
10019
+ const NodeJS = {
10367
10020
  getDefaultStrategy: runtime_getDefaultStrategy,
10368
10021
  Transports: runtime_Transports,
10369
- setup: setup,
10370
- getProtocol: getProtocol,
10371
- isXHRSupported: isXHRSupported,
10372
- createSocketRequest: createSocketRequest,
10373
- getLocalStorage: getLocalStorage,
10374
- createXHR: createXHR,
10375
- createWebSocket: createWebSocket,
10376
- addUnloadListener: addUnloadListener,
10377
- removeUnloadListener: removeUnloadListener,
10378
- transportConnectionInitializer: transportConnectionInitializer,
10379
- HTTPFactory: HTTPFactory,
10022
+ setup,
10023
+ getProtocol,
10024
+ isXHRSupported,
10025
+ createSocketRequest,
10026
+ getLocalStorage,
10027
+ createXHR,
10028
+ createWebSocket,
10029
+ addUnloadListener,
10030
+ removeUnloadListener,
10031
+ transportConnectionInitializer,
10032
+ HTTPFactory,
10380
10033
  TimelineTransport: xhr_timeline,
10381
- getAuthorizers: function () {
10034
+ getAuthorizers() {
10382
10035
  return { ajax: xhr_auth };
10383
10036
  },
10384
- getWebSocketAPI: function () {
10037
+ getWebSocketAPI() {
10385
10038
  return websocket["Client"];
10386
10039
  },
10387
- getXHRAPI: function () {
10040
+ getXHRAPI() {
10388
10041
  return XMLHttpRequest["XMLHttpRequest"];
10389
10042
  },
10390
- getNetwork: function () {
10043
+ getNetwork() {
10391
10044
  return net_info_Network;
10392
10045
  },
10393
- randomInt: function (max) {
10046
+ randomInt(max) {
10394
10047
  return Object(external_crypto_["randomInt"])(max);
10395
10048
  }
10396
10049
  };
@@ -10409,8 +10062,8 @@ var TimelineLevel;
10409
10062
 
10410
10063
 
10411
10064
 
10412
- var timeline_Timeline = (function () {
10413
- function Timeline(key, session, options) {
10065
+ class timeline_Timeline {
10066
+ constructor(key, session, options) {
10414
10067
  this.key = key;
10415
10068
  this.session = session;
10416
10069
  this.events = [];
@@ -10418,28 +10071,27 @@ var timeline_Timeline = (function () {
10418
10071
  this.sent = 0;
10419
10072
  this.uniqueID = 0;
10420
10073
  }
10421
- Timeline.prototype.log = function (level, event) {
10074
+ log(level, event) {
10422
10075
  if (level <= this.options.level) {
10423
10076
  this.events.push(extend({}, event, { timestamp: util.now() }));
10424
10077
  if (this.options.limit && this.events.length > this.options.limit) {
10425
10078
  this.events.shift();
10426
10079
  }
10427
10080
  }
10428
- };
10429
- Timeline.prototype.error = function (event) {
10081
+ }
10082
+ error(event) {
10430
10083
  this.log(timeline_level.ERROR, event);
10431
- };
10432
- Timeline.prototype.info = function (event) {
10084
+ }
10085
+ info(event) {
10433
10086
  this.log(timeline_level.INFO, event);
10434
- };
10435
- Timeline.prototype.debug = function (event) {
10087
+ }
10088
+ debug(event) {
10436
10089
  this.log(timeline_level.DEBUG, event);
10437
- };
10438
- Timeline.prototype.isEmpty = function () {
10090
+ }
10091
+ isEmpty() {
10439
10092
  return this.events.length === 0;
10440
- };
10441
- Timeline.prototype.send = function (sendfn, callback) {
10442
- var _this = this;
10093
+ }
10094
+ send(sendfn, callback) {
10443
10095
  var data = extend({
10444
10096
  session: this.session,
10445
10097
  bundle: this.sent + 1,
@@ -10451,43 +10103,40 @@ var timeline_Timeline = (function () {
10451
10103
  timeline: this.events
10452
10104
  }, this.options.params);
10453
10105
  this.events = [];
10454
- sendfn(data, function (error, result) {
10106
+ sendfn(data, (error, result) => {
10455
10107
  if (!error) {
10456
- _this.sent++;
10108
+ this.sent++;
10457
10109
  }
10458
10110
  if (callback) {
10459
10111
  callback(error, result);
10460
10112
  }
10461
10113
  });
10462
10114
  return true;
10463
- };
10464
- Timeline.prototype.generateUniqueID = function () {
10115
+ }
10116
+ generateUniqueID() {
10465
10117
  this.uniqueID++;
10466
10118
  return this.uniqueID;
10467
- };
10468
- return Timeline;
10469
- }());
10470
- /* harmony default export */ var timeline_timeline = (timeline_Timeline);
10119
+ }
10120
+ }
10471
10121
 
10472
10122
  // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
10473
10123
 
10474
10124
 
10475
10125
 
10476
10126
 
10477
- var transport_strategy_TransportStrategy = (function () {
10478
- function TransportStrategy(name, priority, transport, options) {
10127
+ class transport_strategy_TransportStrategy {
10128
+ constructor(name, priority, transport, options) {
10479
10129
  this.name = name;
10480
10130
  this.priority = priority;
10481
10131
  this.transport = transport;
10482
10132
  this.options = options || {};
10483
10133
  }
10484
- TransportStrategy.prototype.isSupported = function () {
10134
+ isSupported() {
10485
10135
  return this.transport.isSupported({
10486
10136
  useTLS: this.options.useTLS
10487
10137
  });
10488
- };
10489
- TransportStrategy.prototype.connect = function (minPriority, callback) {
10490
- var _this = this;
10138
+ }
10139
+ connect(minPriority, callback) {
10491
10140
  if (!this.isSupported()) {
10492
10141
  return failAttempt(new UnsupportedStrategy(), callback);
10493
10142
  }
@@ -10530,7 +10179,7 @@ var transport_strategy_TransportStrategy = (function () {
10530
10179
  transport.bind('closed', onClosed);
10531
10180
  transport.initialize();
10532
10181
  return {
10533
- abort: function () {
10182
+ abort: () => {
10534
10183
  if (connected) {
10535
10184
  return;
10536
10185
  }
@@ -10542,11 +10191,11 @@ var transport_strategy_TransportStrategy = (function () {
10542
10191
  transport.close();
10543
10192
  }
10544
10193
  },
10545
- forceMinPriority: function (p) {
10194
+ forceMinPriority: p => {
10546
10195
  if (connected) {
10547
10196
  return;
10548
10197
  }
10549
- if (_this.priority < p) {
10198
+ if (this.priority < p) {
10550
10199
  if (handshake) {
10551
10200
  handshake.close();
10552
10201
  }
@@ -10556,10 +10205,8 @@ var transport_strategy_TransportStrategy = (function () {
10556
10205
  }
10557
10206
  }
10558
10207
  };
10559
- };
10560
- return TransportStrategy;
10561
- }());
10562
- /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
10208
+ }
10209
+ }
10563
10210
  function failAttempt(error, callback) {
10564
10211
  util.defer(function () {
10565
10212
  callback(error);
@@ -10576,7 +10223,7 @@ function failAttempt(error, callback) {
10576
10223
 
10577
10224
 
10578
10225
 
10579
- var strategy_builder_Transports = node_runtime.Transports;
10226
+ const { Transports: strategy_builder_Transports } = node_runtime;
10580
10227
  var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
10581
10228
  var transportClass = strategy_builder_Transports[type];
10582
10229
  if (!transportClass) {
@@ -10589,7 +10236,7 @@ var strategy_builder_defineTransport = function (config, name, type, priority, o
10589
10236
  var transport;
10590
10237
  if (enabled) {
10591
10238
  options = Object.assign({ ignoreNullOrigin: config.ignoreNullOrigin }, options);
10592
- transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, options);
10239
+ transport = new transport_strategy_TransportStrategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, options);
10593
10240
  }
10594
10241
  else {
10595
10242
  transport = strategy_builder_UnsupportedStrategy;
@@ -10630,7 +10277,7 @@ function validateOptions(options) {
10630
10277
  // CONCATENATED MODULE: ./src/core/auth/user_authenticator.ts
10631
10278
 
10632
10279
 
10633
- var composeChannelQuery = function (params, authOptions) {
10280
+ const composeChannelQuery = (params, authOptions) => {
10634
10281
  var query = 'socket_id=' + encodeURIComponent(params.socketId);
10635
10282
  for (var key in authOptions.params) {
10636
10283
  query +=
@@ -10640,7 +10287,7 @@ var composeChannelQuery = function (params, authOptions) {
10640
10287
  encodeURIComponent(authOptions.params[key]);
10641
10288
  }
10642
10289
  if (authOptions.paramsProvider != null) {
10643
- var dynamicParams = authOptions.paramsProvider();
10290
+ let dynamicParams = authOptions.paramsProvider();
10644
10291
  for (var key in dynamicParams) {
10645
10292
  query +=
10646
10293
  '&' +
@@ -10651,12 +10298,12 @@ var composeChannelQuery = function (params, authOptions) {
10651
10298
  }
10652
10299
  return query;
10653
10300
  };
10654
- var UserAuthenticator = function (authOptions) {
10301
+ const UserAuthenticator = (authOptions) => {
10655
10302
  if (typeof node_runtime.getAuthorizers()[authOptions.transport] === 'undefined') {
10656
- throw "'" + authOptions.transport + "' is not a recognized auth transport";
10303
+ throw `'${authOptions.transport}' is not a recognized auth transport`;
10657
10304
  }
10658
- return function (params, callback) {
10659
- var query = composeChannelQuery(params, authOptions);
10305
+ return (params, callback) => {
10306
+ const query = composeChannelQuery(params, authOptions);
10660
10307
  node_runtime.getAuthorizers()[authOptions.transport](node_runtime, query, authOptions, AuthRequestType.UserAuthentication, callback);
10661
10308
  };
10662
10309
  };
@@ -10665,7 +10312,7 @@ var UserAuthenticator = function (authOptions) {
10665
10312
  // CONCATENATED MODULE: ./src/core/auth/channel_authorizer.ts
10666
10313
 
10667
10314
 
10668
- var channel_authorizer_composeChannelQuery = function (params, authOptions) {
10315
+ const channel_authorizer_composeChannelQuery = (params, authOptions) => {
10669
10316
  var query = 'socket_id=' + encodeURIComponent(params.socketId);
10670
10317
  query += '&channel_name=' + encodeURIComponent(params.channelName);
10671
10318
  for (var key in authOptions.params) {
@@ -10676,7 +10323,7 @@ var channel_authorizer_composeChannelQuery = function (params, authOptions) {
10676
10323
  encodeURIComponent(authOptions.params[key]);
10677
10324
  }
10678
10325
  if (authOptions.paramsProvider != null) {
10679
- var dynamicParams = authOptions.paramsProvider();
10326
+ let dynamicParams = authOptions.paramsProvider();
10680
10327
  for (var key in dynamicParams) {
10681
10328
  query +=
10682
10329
  '&' +
@@ -10687,20 +10334,20 @@ var channel_authorizer_composeChannelQuery = function (params, authOptions) {
10687
10334
  }
10688
10335
  return query;
10689
10336
  };
10690
- var ChannelAuthorizer = function (authOptions) {
10337
+ const ChannelAuthorizer = (authOptions) => {
10691
10338
  if (typeof node_runtime.getAuthorizers()[authOptions.transport] === 'undefined') {
10692
- throw "'" + authOptions.transport + "' is not a recognized auth transport";
10339
+ throw `'${authOptions.transport}' is not a recognized auth transport`;
10693
10340
  }
10694
- return function (params, callback) {
10695
- var query = channel_authorizer_composeChannelQuery(params, authOptions);
10341
+ return (params, callback) => {
10342
+ const query = channel_authorizer_composeChannelQuery(params, authOptions);
10696
10343
  node_runtime.getAuthorizers()[authOptions.transport](node_runtime, query, authOptions, AuthRequestType.ChannelAuthorization, callback);
10697
10344
  };
10698
10345
  };
10699
10346
  /* harmony default export */ var channel_authorizer = (ChannelAuthorizer);
10700
10347
 
10701
10348
  // CONCATENATED MODULE: ./src/core/auth/deprecated_channel_authorizer.ts
10702
- var ChannelAuthorizerProxy = function (pusher, authOptions, channelAuthorizerGenerator) {
10703
- var deprecatedAuthorizerOptions = {
10349
+ const ChannelAuthorizerProxy = (pusher, authOptions, channelAuthorizerGenerator) => {
10350
+ const deprecatedAuthorizerOptions = {
10704
10351
  authTransport: authOptions.transport,
10705
10352
  authEndpoint: authOptions.endpoint,
10706
10353
  auth: {
@@ -10708,32 +10355,21 @@ var ChannelAuthorizerProxy = function (pusher, authOptions, channelAuthorizerGen
10708
10355
  headers: authOptions.headers
10709
10356
  }
10710
10357
  };
10711
- return function (params, callback) {
10712
- var channel = pusher.channel(params.channelName);
10713
- var channelAuthorizer = channelAuthorizerGenerator(channel, deprecatedAuthorizerOptions);
10358
+ return (params, callback) => {
10359
+ const channel = pusher.channel(params.channelName);
10360
+ const channelAuthorizer = channelAuthorizerGenerator(channel, deprecatedAuthorizerOptions);
10714
10361
  channelAuthorizer.authorize(params.socketId, callback);
10715
10362
  };
10716
10363
  };
10717
10364
 
10718
10365
  // CONCATENATED MODULE: ./src/core/config.ts
10719
- var __assign = (undefined && undefined.__assign) || function () {
10720
- __assign = Object.assign || function(t) {
10721
- for (var s, i = 1, n = arguments.length; i < n; i++) {
10722
- s = arguments[i];
10723
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10724
- t[p] = s[p];
10725
- }
10726
- return t;
10727
- };
10728
- return __assign.apply(this, arguments);
10729
- };
10730
10366
 
10731
10367
 
10732
10368
 
10733
10369
 
10734
10370
 
10735
10371
  function getConfig(opts, pusher) {
10736
- var config = {
10372
+ let config = {
10737
10373
  activityTimeout: opts.activityTimeout || defaults.activityTimeout,
10738
10374
  cluster: opts.cluster,
10739
10375
  httpPath: opts.httpPath || defaults.httpPath,
@@ -10770,7 +10406,7 @@ function getHttpHost(opts) {
10770
10406
  return opts.httpHost;
10771
10407
  }
10772
10408
  if (opts.cluster) {
10773
- return "sockjs-" + opts.cluster + ".pusher.com";
10409
+ return `sockjs-${opts.cluster}.pusher.com`;
10774
10410
  }
10775
10411
  return defaults.httpHost;
10776
10412
  }
@@ -10781,7 +10417,7 @@ function getWebsocketHost(opts) {
10781
10417
  return getWebsocketHostFromCluster(opts.cluster);
10782
10418
  }
10783
10419
  function getWebsocketHostFromCluster(cluster) {
10784
- return "ws-" + cluster + ".pusher.com";
10420
+ return `ws-${cluster}.pusher.com`;
10785
10421
  }
10786
10422
  function shouldUseTLS(opts) {
10787
10423
  if (node_runtime.getProtocol() === 'https:') {
@@ -10802,7 +10438,7 @@ function getEnableStatsConfig(opts) {
10802
10438
  return false;
10803
10439
  }
10804
10440
  function buildUserAuthenticator(opts) {
10805
- var userAuthentication = __assign(__assign({}, defaults.userAuthentication), opts.userAuthentication);
10441
+ const userAuthentication = Object.assign(Object.assign({}, defaults.userAuthentication), opts.userAuthentication);
10806
10442
  if ('customHandler' in userAuthentication &&
10807
10443
  userAuthentication['customHandler'] != null) {
10808
10444
  return userAuthentication['customHandler'];
@@ -10810,9 +10446,9 @@ function buildUserAuthenticator(opts) {
10810
10446
  return user_authenticator(userAuthentication);
10811
10447
  }
10812
10448
  function buildChannelAuth(opts, pusher) {
10813
- var channelAuthorization;
10449
+ let channelAuthorization;
10814
10450
  if ('channelAuthorization' in opts) {
10815
- channelAuthorization = __assign(__assign({}, defaults.channelAuthorization), opts.channelAuthorization);
10451
+ channelAuthorization = Object.assign(Object.assign({}, defaults.channelAuthorization), opts.channelAuthorization);
10816
10452
  }
10817
10453
  else {
10818
10454
  channelAuthorization = {
@@ -10831,7 +10467,7 @@ function buildChannelAuth(opts, pusher) {
10831
10467
  return channelAuthorization;
10832
10468
  }
10833
10469
  function buildChannelAuthorizer(opts, pusher) {
10834
- var channelAuthorization = buildChannelAuth(opts, pusher);
10470
+ const channelAuthorization = buildChannelAuth(opts, pusher);
10835
10471
  if ('customHandler' in channelAuthorization &&
10836
10472
  channelAuthorization['customHandler'] != null) {
10837
10473
  return channelAuthorization['customHandler'];
@@ -10840,134 +10476,99 @@ function buildChannelAuthorizer(opts, pusher) {
10840
10476
  }
10841
10477
 
10842
10478
  // CONCATENATED MODULE: ./src/core/watchlist.ts
10843
- var watchlist_extends = (undefined && undefined.__extends) || (function () {
10844
- var extendStatics = function (d, b) {
10845
- extendStatics = Object.setPrototypeOf ||
10846
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
10847
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
10848
- return extendStatics(d, b);
10849
- };
10850
- return function (d, b) {
10851
- extendStatics(d, b);
10852
- function __() { this.constructor = d; }
10853
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10854
- };
10855
- })();
10856
10479
 
10857
10480
 
10858
- var watchlist_WatchlistFacade = (function (_super) {
10859
- watchlist_extends(WatchlistFacade, _super);
10860
- function WatchlistFacade(pusher) {
10861
- var _this = _super.call(this, function (eventName, data) {
10862
- logger.debug("No callbacks on watchlist events for " + eventName);
10863
- }) || this;
10864
- _this.pusher = pusher;
10865
- _this.bindWatchlistInternalEvent();
10866
- return _this;
10867
- }
10868
- WatchlistFacade.prototype.handleEvent = function (pusherEvent) {
10869
- var _this = this;
10870
- pusherEvent.data.events.forEach(function (watchlistEvent) {
10871
- _this.emit(watchlistEvent.name, watchlistEvent);
10481
+ class watchlist_WatchlistFacade extends dispatcher_Dispatcher {
10482
+ constructor(pusher) {
10483
+ super(function (eventName, data) {
10484
+ logger.debug(`No callbacks on watchlist events for ${eventName}`);
10872
10485
  });
10873
- };
10874
- WatchlistFacade.prototype.bindWatchlistInternalEvent = function () {
10875
- var _this = this;
10876
- this.pusher.connection.bind('message', function (pusherEvent) {
10486
+ this.pusher = pusher;
10487
+ this.bindWatchlistInternalEvent();
10488
+ }
10489
+ handleEvent(pusherEvent) {
10490
+ pusherEvent.data.events.forEach(watchlistEvent => {
10491
+ this.emit(watchlistEvent.name, watchlistEvent);
10492
+ });
10493
+ }
10494
+ bindWatchlistInternalEvent() {
10495
+ this.pusher.connection.bind('message', pusherEvent => {
10877
10496
  var eventName = pusherEvent.event;
10878
10497
  if (eventName === 'pusher_internal:watchlist_events') {
10879
- _this.handleEvent(pusherEvent);
10498
+ this.handleEvent(pusherEvent);
10880
10499
  }
10881
10500
  });
10882
- };
10883
- return WatchlistFacade;
10884
- }(dispatcher));
10885
- /* harmony default export */ var watchlist = (watchlist_WatchlistFacade);
10501
+ }
10502
+ }
10886
10503
 
10887
10504
  // CONCATENATED MODULE: ./src/core/utils/flat_promise.ts
10888
10505
  function flatPromise() {
10889
- var resolve, reject;
10890
- var promise = new Promise(function (res, rej) {
10506
+ let resolve, reject;
10507
+ const promise = new Promise((res, rej) => {
10891
10508
  resolve = res;
10892
10509
  reject = rej;
10893
10510
  });
10894
- return { promise: promise, resolve: resolve, reject: reject };
10511
+ return { promise, resolve, reject };
10895
10512
  }
10896
10513
  /* harmony default export */ var flat_promise = (flatPromise);
10897
10514
 
10898
10515
  // CONCATENATED MODULE: ./src/core/user.ts
10899
- var user_extends = (undefined && undefined.__extends) || (function () {
10900
- var extendStatics = function (d, b) {
10901
- extendStatics = Object.setPrototypeOf ||
10902
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
10903
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
10904
- return extendStatics(d, b);
10905
- };
10906
- return function (d, b) {
10907
- extendStatics(d, b);
10908
- function __() { this.constructor = d; }
10909
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10910
- };
10911
- })();
10912
10516
 
10913
10517
 
10914
10518
 
10915
10519
 
10916
10520
 
10917
- var user_UserFacade = (function (_super) {
10918
- user_extends(UserFacade, _super);
10919
- function UserFacade(pusher) {
10920
- var _this = _super.call(this, function (eventName, data) {
10521
+ class user_UserFacade extends dispatcher_Dispatcher {
10522
+ constructor(pusher) {
10523
+ super(function (eventName, data) {
10921
10524
  logger.debug('No callbacks on user for ' + eventName);
10922
- }) || this;
10923
- _this.signin_requested = false;
10924
- _this.user_data = null;
10925
- _this.serverToUserChannel = null;
10926
- _this.signinDonePromise = null;
10927
- _this._signinDoneResolve = null;
10928
- _this._onAuthorize = function (err, authData) {
10525
+ });
10526
+ this.signin_requested = false;
10527
+ this.user_data = null;
10528
+ this.serverToUserChannel = null;
10529
+ this.signinDonePromise = null;
10530
+ this._signinDoneResolve = null;
10531
+ this._onAuthorize = (err, authData) => {
10929
10532
  if (err) {
10930
- logger.warn("Error during signin: " + err);
10931
- _this._cleanup();
10533
+ logger.warn(`Error during signin: ${err}`);
10534
+ this._cleanup();
10932
10535
  return;
10933
10536
  }
10934
- _this.pusher.send_event('pusher:signin', {
10537
+ this.pusher.send_event('pusher:signin', {
10935
10538
  auth: authData.auth,
10936
10539
  user_data: authData.user_data
10937
10540
  });
10938
10541
  };
10939
- _this.pusher = pusher;
10940
- _this.pusher.connection.bind('state_change', function (_a) {
10941
- var previous = _a.previous, current = _a.current;
10542
+ this.pusher = pusher;
10543
+ this.pusher.connection.bind('state_change', ({ previous, current }) => {
10942
10544
  if (previous !== 'connected' && current === 'connected') {
10943
- _this._signin();
10545
+ this._signin();
10944
10546
  }
10945
10547
  if (previous === 'connected' && current !== 'connected') {
10946
- _this._cleanup();
10947
- _this._newSigninPromiseIfNeeded();
10548
+ this._cleanup();
10549
+ this._newSigninPromiseIfNeeded();
10948
10550
  }
10949
10551
  });
10950
- _this.watchlist = new watchlist(pusher);
10951
- _this.pusher.connection.bind('message', function (event) {
10552
+ this.watchlist = new watchlist_WatchlistFacade(pusher);
10553
+ this.pusher.connection.bind('message', event => {
10952
10554
  var eventName = event.event;
10953
10555
  if (eventName === 'pusher:signin_success') {
10954
- _this._onSigninSuccess(event.data);
10556
+ this._onSigninSuccess(event.data);
10955
10557
  }
10956
- if (_this.serverToUserChannel &&
10957
- _this.serverToUserChannel.name === event.channel) {
10958
- _this.serverToUserChannel.handleEvent(event);
10558
+ if (this.serverToUserChannel &&
10559
+ this.serverToUserChannel.name === event.channel) {
10560
+ this.serverToUserChannel.handleEvent(event);
10959
10561
  }
10960
10562
  });
10961
- return _this;
10962
10563
  }
10963
- UserFacade.prototype.signin = function () {
10564
+ signin() {
10964
10565
  if (this.signin_requested) {
10965
10566
  return;
10966
10567
  }
10967
10568
  this.signin_requested = true;
10968
10569
  this._signin();
10969
- };
10970
- UserFacade.prototype._signin = function () {
10570
+ }
10571
+ _signin() {
10971
10572
  if (!this.signin_requested) {
10972
10573
  return;
10973
10574
  }
@@ -10978,46 +10579,45 @@ var user_UserFacade = (function (_super) {
10978
10579
  this.pusher.config.userAuthenticator({
10979
10580
  socketId: this.pusher.connection.socket_id
10980
10581
  }, this._onAuthorize);
10981
- };
10982
- UserFacade.prototype._onSigninSuccess = function (data) {
10582
+ }
10583
+ _onSigninSuccess(data) {
10983
10584
  try {
10984
10585
  this.user_data = JSON.parse(data.user_data);
10985
10586
  }
10986
10587
  catch (e) {
10987
- logger.error("Failed parsing user data after signin: " + data.user_data);
10588
+ logger.error(`Failed parsing user data after signin: ${data.user_data}`);
10988
10589
  this._cleanup();
10989
10590
  return;
10990
10591
  }
10991
10592
  if (typeof this.user_data.id !== 'string' || this.user_data.id === '') {
10992
- logger.error("user_data doesn't contain an id. user_data: " + this.user_data);
10593
+ logger.error(`user_data doesn't contain an id. user_data: ${this.user_data}`);
10993
10594
  this._cleanup();
10994
10595
  return;
10995
10596
  }
10996
10597
  this._signinDoneResolve();
10997
10598
  this._subscribeChannels();
10998
- };
10999
- UserFacade.prototype._subscribeChannels = function () {
11000
- var _this = this;
11001
- var ensure_subscribed = function (channel) {
10599
+ }
10600
+ _subscribeChannels() {
10601
+ const ensure_subscribed = channel => {
11002
10602
  if (channel.subscriptionPending && channel.subscriptionCancelled) {
11003
10603
  channel.reinstateSubscription();
11004
10604
  }
11005
10605
  else if (!channel.subscriptionPending &&
11006
- _this.pusher.connection.state === 'connected') {
10606
+ this.pusher.connection.state === 'connected') {
11007
10607
  channel.subscribe();
11008
10608
  }
11009
10609
  };
11010
- this.serverToUserChannel = new channels_channel("#server-to-user-" + this.user_data.id, this.pusher);
11011
- this.serverToUserChannel.bind_global(function (eventName, data) {
10610
+ this.serverToUserChannel = new channel_Channel(`#server-to-user-${this.user_data.id}`, this.pusher);
10611
+ this.serverToUserChannel.bind_global((eventName, data) => {
11012
10612
  if (eventName.indexOf('pusher_internal:') === 0 ||
11013
10613
  eventName.indexOf('pusher:') === 0) {
11014
10614
  return;
11015
10615
  }
11016
- _this.emit(eventName, data);
10616
+ this.emit(eventName, data);
11017
10617
  });
11018
10618
  ensure_subscribed(this.serverToUserChannel);
11019
- };
11020
- UserFacade.prototype._cleanup = function () {
10619
+ }
10620
+ _cleanup() {
11021
10621
  this.user_data = null;
11022
10622
  if (this.serverToUserChannel) {
11023
10623
  this.serverToUserChannel.unbind_all();
@@ -11027,26 +10627,24 @@ var user_UserFacade = (function (_super) {
11027
10627
  if (this.signin_requested) {
11028
10628
  this._signinDoneResolve();
11029
10629
  }
11030
- };
11031
- UserFacade.prototype._newSigninPromiseIfNeeded = function () {
10630
+ }
10631
+ _newSigninPromiseIfNeeded() {
11032
10632
  if (!this.signin_requested) {
11033
10633
  return;
11034
10634
  }
11035
10635
  if (this.signinDonePromise && !this.signinDonePromise.done) {
11036
10636
  return;
11037
10637
  }
11038
- var _a = flat_promise(), promise = _a.promise, resolve = _a.resolve, _ = _a.reject;
10638
+ const { promise, resolve, reject: _ } = flat_promise();
11039
10639
  promise.done = false;
11040
- var setDone = function () {
10640
+ const setDone = () => {
11041
10641
  promise.done = true;
11042
10642
  };
11043
- promise.then(setDone)["catch"](setDone);
10643
+ promise.then(setDone).catch(setDone);
11044
10644
  this.signinDonePromise = promise;
11045
10645
  this._signinDoneResolve = resolve;
11046
- };
11047
- return UserFacade;
11048
- }(dispatcher));
11049
- /* harmony default export */ var user = (user_UserFacade);
10646
+ }
10647
+ }
11050
10648
 
11051
10649
  // CONCATENATED MODULE: ./src/core/pusher.ts
11052
10650
 
@@ -11062,19 +10660,29 @@ var user_UserFacade = (function (_super) {
11062
10660
 
11063
10661
 
11064
10662
 
11065
- var pusher_Pusher = (function () {
11066
- function Pusher(app_key, options) {
11067
- var _this = this;
10663
+ class pusher_Pusher {
10664
+ static ready() {
10665
+ pusher_Pusher.isReady = true;
10666
+ for (var i = 0, l = pusher_Pusher.instances.length; i < l; i++) {
10667
+ pusher_Pusher.instances[i].connect();
10668
+ }
10669
+ }
10670
+ static getClientFeatures() {
10671
+ return keys(filterObject({ ws: node_runtime.Transports.ws }, function (t) {
10672
+ return t.isSupported({});
10673
+ }));
10674
+ }
10675
+ constructor(app_key, options) {
11068
10676
  checkAppKey(app_key);
11069
10677
  validateOptions(options);
11070
10678
  this.key = app_key;
11071
10679
  this.config = getConfig(options, this);
11072
10680
  this.channels = factory.createChannels();
11073
- this.global_emitter = new dispatcher();
10681
+ this.global_emitter = new dispatcher_Dispatcher();
11074
10682
  this.sessionID = node_runtime.randomInt(1000000000);
11075
- this.timeline = new timeline_timeline(this.key, this.sessionID, {
10683
+ this.timeline = new timeline_Timeline(this.key, this.sessionID, {
11076
10684
  cluster: this.config.cluster,
11077
- features: Pusher.getClientFeatures(),
10685
+ features: pusher_Pusher.getClientFeatures(),
11078
10686
  params: this.config.timelineParams || {},
11079
10687
  limit: 50,
11080
10688
  level: timeline_level.INFO,
@@ -11086,8 +10694,8 @@ var pusher_Pusher = (function () {
11086
10694
  path: '/timeline/v2/' + node_runtime.TimelineTransport.name
11087
10695
  });
11088
10696
  }
11089
- var getStrategy = function (options) {
11090
- return node_runtime.getDefaultStrategy(_this.config, options, strategy_builder_defineTransport);
10697
+ var getStrategy = (options) => {
10698
+ return node_runtime.getDefaultStrategy(this.config, options, strategy_builder_defineTransport);
11091
10699
  };
11092
10700
  this.connection = factory.createConnectionManager(this.key, {
11093
10701
  getStrategy: getStrategy,
@@ -11097,106 +10705,95 @@ var pusher_Pusher = (function () {
11097
10705
  unavailableTimeout: this.config.unavailableTimeout,
11098
10706
  useTLS: Boolean(this.config.useTLS)
11099
10707
  });
11100
- this.connection.bind('connected', function () {
11101
- _this.subscribeAll();
11102
- if (_this.timelineSender) {
11103
- _this.timelineSender.send(_this.connection.isUsingTLS());
10708
+ this.connection.bind('connected', () => {
10709
+ this.subscribeAll();
10710
+ if (this.timelineSender) {
10711
+ this.timelineSender.send(this.connection.isUsingTLS());
11104
10712
  }
11105
10713
  });
11106
- this.connection.bind('message', function (event) {
10714
+ this.connection.bind('message', event => {
11107
10715
  var eventName = event.event;
11108
10716
  var internal = eventName.indexOf('pusher_internal:') === 0;
11109
10717
  if (event.channel) {
11110
- var channel = _this.channel(event.channel);
10718
+ var channel = this.channel(event.channel);
11111
10719
  if (channel) {
11112
10720
  channel.handleEvent(event);
11113
10721
  }
11114
10722
  }
11115
10723
  if (!internal) {
11116
- _this.global_emitter.emit(event.event, event.data);
10724
+ this.global_emitter.emit(event.event, event.data);
11117
10725
  }
11118
10726
  });
11119
- this.connection.bind('connecting', function () {
11120
- _this.channels.disconnect();
10727
+ this.connection.bind('connecting', () => {
10728
+ this.channels.disconnect();
11121
10729
  });
11122
- this.connection.bind('disconnected', function () {
11123
- _this.channels.disconnect();
10730
+ this.connection.bind('disconnected', () => {
10731
+ this.channels.disconnect();
11124
10732
  });
11125
- this.connection.bind('error', function (err) {
10733
+ this.connection.bind('error', err => {
11126
10734
  logger.warn(err);
11127
10735
  });
11128
- Pusher.instances.push(this);
11129
- this.timeline.info({ instances: Pusher.instances.length });
11130
- this.user = new user(this);
11131
- if (Pusher.isReady) {
10736
+ pusher_Pusher.instances.push(this);
10737
+ this.timeline.info({ instances: pusher_Pusher.instances.length });
10738
+ this.user = new user_UserFacade(this);
10739
+ if (pusher_Pusher.isReady) {
11132
10740
  this.connect();
11133
10741
  }
11134
10742
  }
11135
- Pusher.ready = function () {
11136
- Pusher.isReady = true;
11137
- for (var i = 0, l = Pusher.instances.length; i < l; i++) {
11138
- Pusher.instances[i].connect();
11139
- }
11140
- };
11141
- Pusher.getClientFeatures = function () {
11142
- return keys(filterObject({ ws: node_runtime.Transports.ws }, function (t) {
11143
- return t.isSupported({});
11144
- }));
11145
- };
11146
- Pusher.prototype.channel = function (name) {
10743
+ channel(name) {
11147
10744
  return this.channels.find(name);
11148
- };
11149
- Pusher.prototype.allChannels = function () {
10745
+ }
10746
+ allChannels() {
11150
10747
  return this.channels.all();
11151
- };
11152
- Pusher.prototype.connect = function () {
10748
+ }
10749
+ connect() {
11153
10750
  this.connection.connect();
11154
10751
  if (this.timelineSender) {
11155
10752
  if (!this.timelineSenderTimer) {
11156
10753
  var usingTLS = this.connection.isUsingTLS();
11157
10754
  var timelineSender = this.timelineSender;
11158
- this.timelineSenderTimer = new PeriodicTimer(60000, function () {
10755
+ this.timelineSenderTimer = new timers_PeriodicTimer(60000, function () {
11159
10756
  timelineSender.send(usingTLS);
11160
10757
  });
11161
10758
  }
11162
10759
  }
11163
- };
11164
- Pusher.prototype.disconnect = function () {
10760
+ }
10761
+ disconnect() {
11165
10762
  this.connection.disconnect();
11166
10763
  if (this.timelineSenderTimer) {
11167
10764
  this.timelineSenderTimer.ensureAborted();
11168
10765
  this.timelineSenderTimer = null;
11169
10766
  }
11170
- };
11171
- Pusher.prototype.bind = function (event_name, callback, context) {
10767
+ }
10768
+ bind(event_name, callback, context) {
11172
10769
  this.global_emitter.bind(event_name, callback, context);
11173
10770
  return this;
11174
- };
11175
- Pusher.prototype.unbind = function (event_name, callback, context) {
10771
+ }
10772
+ unbind(event_name, callback, context) {
11176
10773
  this.global_emitter.unbind(event_name, callback, context);
11177
10774
  return this;
11178
- };
11179
- Pusher.prototype.bind_global = function (callback) {
10775
+ }
10776
+ bind_global(callback) {
11180
10777
  this.global_emitter.bind_global(callback);
11181
10778
  return this;
11182
- };
11183
- Pusher.prototype.unbind_global = function (callback) {
10779
+ }
10780
+ unbind_global(callback) {
11184
10781
  this.global_emitter.unbind_global(callback);
11185
10782
  return this;
11186
- };
11187
- Pusher.prototype.unbind_all = function (callback) {
10783
+ }
10784
+ unbind_all(callback) {
11188
10785
  this.global_emitter.unbind_all();
11189
10786
  return this;
11190
- };
11191
- Pusher.prototype.subscribeAll = function () {
10787
+ }
10788
+ subscribeAll() {
11192
10789
  var channelName;
11193
10790
  for (channelName in this.channels.channels) {
11194
10791
  if (this.channels.channels.hasOwnProperty(channelName)) {
11195
10792
  this.subscribe(channelName);
11196
10793
  }
11197
10794
  }
11198
- };
11199
- Pusher.prototype.subscribe = function (channel_name) {
10795
+ }
10796
+ subscribe(channel_name) {
11200
10797
  var channel = this.channels.add(channel_name, this);
11201
10798
  if (channel.subscriptionPending && channel.subscriptionCancelled) {
11202
10799
  channel.reinstateSubscription();
@@ -11206,8 +10803,8 @@ var pusher_Pusher = (function () {
11206
10803
  channel.subscribe();
11207
10804
  }
11208
10805
  return channel;
11209
- };
11210
- Pusher.prototype.unsubscribe = function (channel_name) {
10806
+ }
10807
+ unsubscribe(channel_name) {
11211
10808
  var channel = this.channels.find(channel_name);
11212
10809
  if (channel && channel.subscriptionPending) {
11213
10810
  channel.cancelSubscription();
@@ -11218,25 +10815,24 @@ var pusher_Pusher = (function () {
11218
10815
  channel.unsubscribe();
11219
10816
  }
11220
10817
  }
11221
- };
11222
- Pusher.prototype.send_event = function (event_name, data, channel) {
10818
+ }
10819
+ send_event(event_name, data, channel) {
11223
10820
  return this.connection.send_event(event_name, data, channel);
11224
- };
11225
- Pusher.prototype.shouldUseTLS = function () {
10821
+ }
10822
+ shouldUseTLS() {
11226
10823
  return this.config.useTLS;
11227
- };
11228
- Pusher.prototype.signin = function () {
10824
+ }
10825
+ signin() {
11229
10826
  this.user.signin();
11230
- };
11231
- Pusher.instances = [];
11232
- Pusher.isReady = false;
11233
- Pusher.logToConsole = false;
11234
- Pusher.Runtime = node_runtime;
11235
- Pusher.ScriptReceivers = node_runtime.ScriptReceivers;
11236
- Pusher.DependenciesReceivers = node_runtime.DependenciesReceivers;
11237
- Pusher.auth_callbacks = node_runtime.auth_callbacks;
11238
- return Pusher;
11239
- }());
10827
+ }
10828
+ }
10829
+ pusher_Pusher.instances = [];
10830
+ pusher_Pusher.isReady = false;
10831
+ pusher_Pusher.logToConsole = false;
10832
+ pusher_Pusher.Runtime = node_runtime;
10833
+ pusher_Pusher.ScriptReceivers = node_runtime.ScriptReceivers;
10834
+ pusher_Pusher.DependenciesReceivers = node_runtime.DependenciesReceivers;
10835
+ pusher_Pusher.auth_callbacks = node_runtime.auth_callbacks;
11240
10836
  /* harmony default export */ var core_pusher = (pusher_Pusher);
11241
10837
  function checkAppKey(key) {
11242
10838
  if (key === null || key === undefined) {
@@ -11249,36 +10845,18 @@ node_runtime.setup(pusher_Pusher);
11249
10845
  var nacl_fast = __webpack_require__(20);
11250
10846
 
11251
10847
  // CONCATENATED MODULE: ./src/core/pusher-with-encryption.ts
11252
- var pusher_with_encryption_extends = (undefined && undefined.__extends) || (function () {
11253
- var extendStatics = function (d, b) {
11254
- extendStatics = Object.setPrototypeOf ||
11255
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
11256
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
11257
- return extendStatics(d, b);
11258
- };
11259
- return function (d, b) {
11260
- extendStatics(d, b);
11261
- function __() { this.constructor = d; }
11262
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
11263
- };
11264
- })();
11265
10848
 
11266
10849
 
11267
10850
 
11268
- var pusher_with_encryption_PusherWithEncryption = (function (_super) {
11269
- pusher_with_encryption_extends(PusherWithEncryption, _super);
11270
- function PusherWithEncryption(app_key, options) {
11271
- var _this = this;
11272
- core_pusher.logToConsole = PusherWithEncryption.logToConsole;
11273
- core_pusher.log = PusherWithEncryption.log;
10851
+ class pusher_with_encryption_PusherWithEncryption extends core_pusher {
10852
+ constructor(app_key, options) {
10853
+ core_pusher.logToConsole = pusher_with_encryption_PusherWithEncryption.logToConsole;
10854
+ core_pusher.log = pusher_with_encryption_PusherWithEncryption.log;
11274
10855
  validateOptions(options);
11275
10856
  options.nacl = nacl_fast;
11276
- _this = _super.call(this, app_key, options) || this;
11277
- return _this;
10857
+ super(app_key, options);
11278
10858
  }
11279
- return PusherWithEncryption;
11280
- }(core_pusher));
11281
- /* harmony default export */ var pusher_with_encryption = __webpack_exports__["default"] = (pusher_with_encryption_PusherWithEncryption);
10859
+ }
11282
10860
 
11283
10861
 
11284
10862
  /***/ })