pusher-js 8.4.2 → 8.5.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.
Files changed (54) hide show
  1. package/.github/workflows/release.yml +5 -5
  2. package/.github/workflows/release_pr.yml +4 -4
  3. package/.github/workflows/run-tests.yml +13 -8
  4. package/CHANGELOG.md +12 -0
  5. package/dist/node/pusher.js +5715 -5673
  6. package/dist/node/pusher.js.map +1 -1
  7. package/dist/react-native/pusher.js +2 -8
  8. package/dist/react-native/pusher.js.LICENSE.txt +7 -0
  9. package/dist/react-native/pusher.js.map +1 -1
  10. package/dist/web/pusher-with-encryption.js +353 -363
  11. package/dist/web/pusher-with-encryption.js.map +1 -1
  12. package/dist/web/pusher-with-encryption.min.js +2 -8
  13. package/dist/web/pusher-with-encryption.min.js.LICENSE.txt +7 -0
  14. package/dist/web/pusher-with-encryption.min.js.map +1 -1
  15. package/dist/web/pusher.js +340 -348
  16. package/dist/web/pusher.js.map +1 -1
  17. package/dist/web/pusher.min.js +2 -8
  18. package/dist/web/pusher.min.js.LICENSE.txt +7 -0
  19. package/dist/web/pusher.min.js.map +1 -1
  20. package/dist/worker/pusher-with-encryption.worker.js +327 -337
  21. package/dist/worker/pusher-with-encryption.worker.js.map +1 -1
  22. package/dist/worker/pusher-with-encryption.worker.min.js +2 -8
  23. package/dist/worker/pusher-with-encryption.worker.min.js.LICENSE.txt +7 -0
  24. package/dist/worker/pusher-with-encryption.worker.min.js.map +1 -1
  25. package/dist/worker/pusher.worker.js +314 -322
  26. package/dist/worker/pusher.worker.js.map +1 -1
  27. package/dist/worker/pusher.worker.min.js +2 -8
  28. package/dist/worker/pusher.worker.min.js.LICENSE.txt +7 -0
  29. package/dist/worker/pusher.worker.min.js.map +1 -1
  30. package/integration_tests_server/package-lock.json +565 -245
  31. package/integration_tests_server/package.json +2 -1
  32. package/package.json +21 -8
  33. package/spec/config/jasmine/webpack.integration.js +1 -1
  34. package/spec/config/jasmine/webpack.unit.js +1 -1
  35. package/spec/config/karma/config.ci.js +18 -18
  36. package/spec/javascripts/helpers/mocks.js +1 -0
  37. package/spec/javascripts/integration/index.web.js +14 -0
  38. package/spec/javascripts/unit/core/connection/connection_manager_spec.js +43 -0
  39. package/spec/javascripts/unit/core/pusher_spec.js +58 -0
  40. package/src/core/auth/options.ts +9 -11
  41. package/src/core/config.ts +23 -14
  42. package/src/core/connection/connection_manager.ts +9 -0
  43. package/src/core/options.ts +5 -0
  44. package/src/core/pusher.ts +17 -6
  45. package/types/src/core/auth/options.d.ts +5 -10
  46. package/types/src/core/connection/connection_manager.d.ts +1 -0
  47. package/types/src/core/options.d.ts +4 -0
  48. package/types/src/core/pusher.d.ts +3 -1
  49. package/webpack/config.node.js +1 -2
  50. package/webpack/config.react-native.js +1 -2
  51. package/webpack/config.shared.js +6 -6
  52. package/webpack/config.web.js +1 -2
  53. package/webpack/config.worker.js +1 -2
  54. package/webpack/dev.server.js +2 -9
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Pusher JavaScript Library v8.4.0
2
+ * Pusher JavaScript Library v8.5.0
3
3
  * https://pusher.com/
4
4
  *
5
5
  * Copyright 2020, Pusher
@@ -15,96 +15,12 @@
15
15
  exports["Pusher"] = factory();
16
16
  else
17
17
  root["Pusher"] = factory();
18
- })(window, function() {
19
- return /******/ (function(modules) { // webpackBootstrap
20
- /******/ // The module cache
21
- /******/ var installedModules = {};
22
- /******/
23
- /******/ // The require function
24
- /******/ function __webpack_require__(moduleId) {
25
- /******/
26
- /******/ // Check if module is in cache
27
- /******/ if(installedModules[moduleId]) {
28
- /******/ return installedModules[moduleId].exports;
29
- /******/ }
30
- /******/ // Create a new module (and put it into the cache)
31
- /******/ var module = installedModules[moduleId] = {
32
- /******/ i: moduleId,
33
- /******/ l: false,
34
- /******/ exports: {}
35
- /******/ };
36
- /******/
37
- /******/ // Execute the module function
38
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
39
- /******/
40
- /******/ // Flag the module as loaded
41
- /******/ module.l = true;
42
- /******/
43
- /******/ // Return the exports of the module
44
- /******/ return module.exports;
45
- /******/ }
46
- /******/
47
- /******/
48
- /******/ // expose the modules object (__webpack_modules__)
49
- /******/ __webpack_require__.m = modules;
50
- /******/
51
- /******/ // expose the module cache
52
- /******/ __webpack_require__.c = installedModules;
53
- /******/
54
- /******/ // define getter function for harmony exports
55
- /******/ __webpack_require__.d = function(exports, name, getter) {
56
- /******/ if(!__webpack_require__.o(exports, name)) {
57
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
58
- /******/ }
59
- /******/ };
60
- /******/
61
- /******/ // define __esModule on exports
62
- /******/ __webpack_require__.r = function(exports) {
63
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
64
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
65
- /******/ }
66
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
67
- /******/ };
68
- /******/
69
- /******/ // create a fake namespace object
70
- /******/ // mode & 1: value is a module id, require it
71
- /******/ // mode & 2: merge all properties of value into the ns
72
- /******/ // mode & 4: return value when already ns object
73
- /******/ // mode & 8|1: behave like require
74
- /******/ __webpack_require__.t = function(value, mode) {
75
- /******/ if(mode & 1) value = __webpack_require__(value);
76
- /******/ if(mode & 8) return value;
77
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
78
- /******/ var ns = Object.create(null);
79
- /******/ __webpack_require__.r(ns);
80
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
81
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
82
- /******/ return ns;
83
- /******/ };
84
- /******/
85
- /******/ // getDefaultExport function for compatibility with non-harmony modules
86
- /******/ __webpack_require__.n = function(module) {
87
- /******/ var getter = module && module.__esModule ?
88
- /******/ function getDefault() { return module['default']; } :
89
- /******/ function getModuleExports() { return module; };
90
- /******/ __webpack_require__.d(getter, 'a', getter);
91
- /******/ return getter;
92
- /******/ };
93
- /******/
94
- /******/ // Object.prototype.hasOwnProperty.call
95
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
96
- /******/
97
- /******/ // __webpack_public_path__
98
- /******/ __webpack_require__.p = "";
99
- /******/
100
- /******/
101
- /******/ // Load entry module and return exports
102
- /******/ return __webpack_require__(__webpack_require__.s = 2);
103
- /******/ })
104
- /************************************************************************/
105
- /******/ ([
106
- /* 0 */
107
- /***/ (function(module, exports, __webpack_require__) {
18
+ })(self, () => {
19
+ return /******/ (() => { // webpackBootstrap
20
+ /******/ var __webpack_modules__ = ({
21
+
22
+ /***/ 594
23
+ (__unused_webpack_module, exports) {
108
24
 
109
25
  "use strict";
110
26
 
@@ -123,7 +39,7 @@ var __extends = (this && this.__extends) || (function () {
123
39
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
124
40
  };
125
41
  })();
126
- Object.defineProperty(exports, "__esModule", { value: true });
42
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
127
43
  /**
128
44
  * Package base64 implements Base64 encoding and decoding.
129
45
  */
@@ -390,15 +306,17 @@ exports.decodedLength = function (s) {
390
306
  };
391
307
 
392
308
 
393
- /***/ }),
394
- /* 1 */
395
- /***/ (function(module, exports, __webpack_require__) {
309
+ /***/ },
310
+
311
+ /***/ 978
312
+ (__unused_webpack_module, exports) {
396
313
 
397
314
  "use strict";
315
+ var __webpack_unused_export__;
398
316
 
399
317
  // Copyright (C) 2016 Dmitry Chestnykh
400
318
  // MIT License. See LICENSE file for details.
401
- Object.defineProperty(exports, "__esModule", { value: true });
319
+ __webpack_unused_export__ = ({ value: true });
402
320
  /**
403
321
  * Package utf8 implements UTF-8 encoding and decoding.
404
322
  */
@@ -441,7 +359,7 @@ function encode(s) {
441
359
  }
442
360
  return arr;
443
361
  }
444
- exports.encode = encode;
362
+ __webpack_unused_export__ = encode;
445
363
  /**
446
364
  * Returns the number of bytes required to encode the given string into UTF-8.
447
365
  * Throws if the source string has invalid UTF-16 encoding.
@@ -472,7 +390,7 @@ function encodedLength(s) {
472
390
  }
473
391
  return result;
474
392
  }
475
- exports.encodedLength = encodedLength;
393
+ __webpack_unused_export__ = encodedLength;
476
394
  /**
477
395
  * Decodes the given byte array from UTF-8 into a string.
478
396
  * Throws if encoding is invalid.
@@ -542,26 +460,31 @@ function decode(arr) {
542
460
  }
543
461
  return chars.join("");
544
462
  }
545
- exports.decode = decode;
463
+ exports.D4 = decode;
464
+
546
465
 
466
+ /***/ },
547
467
 
548
- /***/ }),
549
- /* 2 */
550
- /***/ (function(module, exports, __webpack_require__) {
468
+ /***/ 721
469
+ (module, __unused_webpack_exports, __webpack_require__) {
551
470
 
552
471
  // required so we don't have to do require('pusher').default etc.
553
- module.exports = __webpack_require__(3).default;
472
+ module.exports = __webpack_require__(207)["default"];
554
473
 
555
474
 
556
- /***/ }),
557
- /* 3 */
558
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
475
+ /***/ },
476
+
477
+ /***/ 207
478
+ (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
559
479
 
560
480
  "use strict";
561
- // ESM COMPAT FLAG
562
- __webpack_require__.r(__webpack_exports__);
563
481
 
564
- // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
482
+ // EXPORTS
483
+ __webpack_require__.d(__webpack_exports__, {
484
+ "default": () => (/* binding */ pusher)
485
+ });
486
+
487
+ ;// ./src/runtimes/web/dom/script_receiver_factory.ts
565
488
  class ScriptReceiverFactory {
566
489
  constructor(prefix, name) {
567
490
  this.lastId = 0;
@@ -589,9 +512,9 @@ class ScriptReceiverFactory {
589
512
  }
590
513
  var ScriptReceivers = new ScriptReceiverFactory('_pusher_script_', 'Pusher.ScriptReceivers');
591
514
 
592
- // CONCATENATED MODULE: ./src/core/defaults.ts
515
+ ;// ./src/core/defaults.ts
593
516
  var Defaults = {
594
- VERSION: "8.4.0",
517
+ VERSION: "8.5.0",
595
518
  PROTOCOL: 7,
596
519
  wsPort: 80,
597
520
  wssPort: 443,
@@ -618,12 +541,12 @@ var Defaults = {
618
541
  cdn_https: "https://js.pusher.com",
619
542
  dependency_suffix: "",
620
543
  };
621
- /* harmony default export */ var defaults = (Defaults);
544
+ /* harmony default export */ const defaults = (Defaults);
622
545
 
623
- // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
546
+ ;// ./src/runtimes/web/dom/dependency_loader.ts
624
547
 
625
548
 
626
- class dependency_loader_DependencyLoader {
549
+ class DependencyLoader {
627
550
  constructor(options) {
628
551
  this.options = options;
629
552
  this.receivers = options.receivers || ScriptReceivers;
@@ -671,12 +594,12 @@ class dependency_loader_DependencyLoader {
671
594
  }
672
595
  }
673
596
 
674
- // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
597
+ ;// ./src/runtimes/web/dom/dependencies.ts
675
598
 
676
599
 
677
600
 
678
601
  var DependenciesReceivers = new ScriptReceiverFactory('_pusher_dependencies', 'Pusher.DependenciesReceivers');
679
- var Dependencies = new dependency_loader_DependencyLoader({
602
+ var Dependencies = new DependencyLoader({
680
603
  cdn_http: defaults.cdn_http,
681
604
  cdn_https: defaults.cdn_https,
682
605
  version: defaults.VERSION,
@@ -684,7 +607,7 @@ var Dependencies = new dependency_loader_DependencyLoader({
684
607
  receivers: DependenciesReceivers,
685
608
  });
686
609
 
687
- // CONCATENATED MODULE: ./src/core/utils/url_store.ts
610
+ ;// ./src/core/utils/url_store.ts
688
611
  const urlStore = {
689
612
  baseUrl: 'https://pusher.com',
690
613
  urls: {
@@ -721,16 +644,16 @@ const buildLogSuffix = function (key) {
721
644
  return '';
722
645
  return `${urlPrefix} ${url}`;
723
646
  };
724
- /* harmony default export */ var url_store = ({ buildLogSuffix });
647
+ /* harmony default export */ const url_store = ({ buildLogSuffix });
725
648
 
726
- // CONCATENATED MODULE: ./src/core/auth/options.ts
649
+ ;// ./src/core/auth/options.ts
727
650
  var AuthRequestType;
728
651
  (function (AuthRequestType) {
729
652
  AuthRequestType["UserAuthentication"] = "user-authentication";
730
653
  AuthRequestType["ChannelAuthorization"] = "channel-authorization";
731
654
  })(AuthRequestType || (AuthRequestType = {}));
732
655
 
733
- // CONCATENATED MODULE: ./src/core/errors.ts
656
+ ;// ./src/core/errors.ts
734
657
  class BadEventName extends Error {
735
658
  constructor(msg) {
736
659
  super(msg);
@@ -787,7 +710,7 @@ class HTTPAuthError extends Error {
787
710
  }
788
711
  }
789
712
 
790
- // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
713
+ ;// ./src/runtimes/isomorphic/auth/xhr_auth.ts
791
714
 
792
715
 
793
716
 
@@ -839,17 +762,17 @@ const ajax = function (context, query, authOptions, authRequestType, callback) {
839
762
  xhr.send(query);
840
763
  return xhr;
841
764
  };
842
- /* harmony default export */ var xhr_auth = (ajax);
765
+ /* harmony default export */ const xhr_auth = (ajax);
843
766
 
844
- // CONCATENATED MODULE: ./src/core/base64.ts
767
+ ;// ./src/core/base64.ts
845
768
  function encode(s) {
846
769
  return btoa(utob(s));
847
770
  }
848
771
  var fromCharCode = String.fromCharCode;
849
772
  var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
850
773
  var b64tab = {};
851
- for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
852
- b64tab[b64chars.charAt(base64_i)] = base64_i;
774
+ for (var i = 0, l = b64chars.length; i < l; i++) {
775
+ b64tab[b64chars.charAt(i)] = i;
853
776
  }
854
777
  var cb_utob = function (c) {
855
778
  var cc = c.charCodeAt(0);
@@ -882,7 +805,7 @@ var btoa = window.btoa ||
882
805
  return b.replace(/[\s\S]{1,3}/g, cb_encode);
883
806
  };
884
807
 
885
- // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
808
+ ;// ./src/core/utils/timers/abstract_timer.ts
886
809
  class Timer {
887
810
  constructor(set, clear, delay, callback) {
888
811
  this.clear = clear;
@@ -902,9 +825,9 @@ class Timer {
902
825
  }
903
826
  }
904
827
  }
905
- /* harmony default export */ var abstract_timer = (Timer);
828
+ /* harmony default export */ const abstract_timer = (Timer);
906
829
 
907
- // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
830
+ ;// ./src/core/utils/timers/index.ts
908
831
 
909
832
  function timers_clearTimeout(timer) {
910
833
  window.clearTimeout(timer);
@@ -912,7 +835,7 @@ function timers_clearTimeout(timer) {
912
835
  function timers_clearInterval(timer) {
913
836
  window.clearInterval(timer);
914
837
  }
915
- class timers_OneOffTimer extends abstract_timer {
838
+ class OneOffTimer extends abstract_timer {
916
839
  constructor(delay, callback) {
917
840
  super(setTimeout, timers_clearTimeout, delay, function (timer) {
918
841
  callback();
@@ -920,7 +843,7 @@ class timers_OneOffTimer extends abstract_timer {
920
843
  });
921
844
  }
922
845
  }
923
- class timers_PeriodicTimer extends abstract_timer {
846
+ class PeriodicTimer extends abstract_timer {
924
847
  constructor(delay, callback) {
925
848
  super(setInterval, timers_clearInterval, delay, function (timer) {
926
849
  callback();
@@ -929,7 +852,7 @@ class timers_PeriodicTimer extends abstract_timer {
929
852
  }
930
853
  }
931
854
 
932
- // CONCATENATED MODULE: ./src/core/util.ts
855
+ ;// ./src/core/util.ts
933
856
 
934
857
  var Util = {
935
858
  now() {
@@ -941,7 +864,7 @@ var Util = {
941
864
  }
942
865
  },
943
866
  defer(callback) {
944
- return new timers_OneOffTimer(0, callback);
867
+ return new OneOffTimer(0, callback);
945
868
  },
946
869
  method(name, ...args) {
947
870
  var boundArguments = Array.prototype.slice.call(arguments, 1);
@@ -950,9 +873,9 @@ var Util = {
950
873
  };
951
874
  },
952
875
  };
953
- /* harmony default export */ var util = (Util);
876
+ /* harmony default export */ const util = (Util);
954
877
 
955
- // CONCATENATED MODULE: ./src/core/utils/collections.ts
878
+ ;// ./src/core/utils/collections.ts
956
879
 
957
880
 
958
881
  function extend(target, ...sources) {
@@ -1146,10 +1069,10 @@ function safeJSONStringify(source) {
1146
1069
  }
1147
1070
  }
1148
1071
 
1149
- // CONCATENATED MODULE: ./src/core/logger.ts
1072
+ ;// ./src/core/logger.ts
1150
1073
 
1151
1074
 
1152
- class logger_Logger {
1075
+ class Logger {
1153
1076
  constructor() {
1154
1077
  this.globalLog = (message) => {
1155
1078
  if (window.console && window.console.log) {
@@ -1184,18 +1107,18 @@ class logger_Logger {
1184
1107
  }
1185
1108
  log(defaultLoggingFunction, ...args) {
1186
1109
  var message = stringify.apply(this, arguments);
1187
- if (core_pusher.log) {
1188
- core_pusher.log(message);
1110
+ if (pusher.log) {
1111
+ pusher.log(message);
1189
1112
  }
1190
- else if (core_pusher.logToConsole) {
1113
+ else if (pusher.logToConsole) {
1191
1114
  const log = defaultLoggingFunction.bind(this);
1192
1115
  log(message);
1193
1116
  }
1194
1117
  }
1195
1118
  }
1196
- /* harmony default export */ var logger = (new logger_Logger());
1119
+ /* harmony default export */ const logger = (new Logger());
1197
1120
 
1198
- // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
1121
+ ;// ./src/runtimes/web/auth/jsonp_auth.ts
1199
1122
 
1200
1123
  var jsonp = function (context, query, authOptions, authRequestType, callback) {
1201
1124
  if (authOptions.headers !== undefined ||
@@ -1219,9 +1142,9 @@ var jsonp = function (context, query, authOptions, authRequestType, callback) {
1219
1142
  var head = document.getElementsByTagName('head')[0] || document.documentElement;
1220
1143
  head.insertBefore(script, head.firstChild);
1221
1144
  };
1222
- /* harmony default export */ var jsonp_auth = (jsonp);
1145
+ /* harmony default export */ const jsonp_auth = (jsonp);
1223
1146
 
1224
- // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
1147
+ ;// ./src/runtimes/web/dom/script_request.ts
1225
1148
  class ScriptRequest {
1226
1149
  constructor(src) {
1227
1150
  this.src = src;
@@ -1283,10 +1206,10 @@ class ScriptRequest {
1283
1206
  }
1284
1207
  }
1285
1208
 
1286
- // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
1209
+ ;// ./src/runtimes/web/dom/jsonp_request.ts
1287
1210
 
1288
1211
 
1289
- class jsonp_request_JSONPRequest {
1212
+ class JSONPRequest {
1290
1213
  constructor(url, data) {
1291
1214
  this.url = url;
1292
1215
  this.data = data;
@@ -1307,7 +1230,7 @@ class jsonp_request_JSONPRequest {
1307
1230
  }
1308
1231
  }
1309
1232
 
1310
- // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
1233
+ ;// ./src/runtimes/web/timeline/jsonp_timeline.ts
1311
1234
 
1312
1235
 
1313
1236
  var getAgent = function (sender, useTLS) {
@@ -1332,9 +1255,9 @@ var jsonp_timeline_jsonp = {
1332
1255
  name: 'jsonp',
1333
1256
  getAgent,
1334
1257
  };
1335
- /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
1258
+ /* harmony default export */ const jsonp_timeline = (jsonp_timeline_jsonp);
1336
1259
 
1337
- // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
1260
+ ;// ./src/core/transports/url_schemes.ts
1338
1261
 
1339
1262
  function getGenericURL(baseScheme, params, path) {
1340
1263
  var scheme = baseScheme + (params.useTLS ? 's' : '');
@@ -1372,9 +1295,9 @@ var sockjs = {
1372
1295
  },
1373
1296
  };
1374
1297
 
1375
- // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
1298
+ ;// ./src/core/events/callback_registry.ts
1376
1299
 
1377
- class callback_registry_CallbackRegistry {
1300
+ class CallbackRegistry {
1378
1301
  constructor() {
1379
1302
  this._callbacks = {};
1380
1303
  }
@@ -1424,12 +1347,12 @@ function prefix(name) {
1424
1347
  return '_' + name;
1425
1348
  }
1426
1349
 
1427
- // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
1350
+ ;// ./src/core/events/dispatcher.ts
1428
1351
 
1429
1352
 
1430
- class dispatcher_Dispatcher {
1353
+ class Dispatcher {
1431
1354
  constructor(failThrough) {
1432
- this.callbacks = new callback_registry_CallbackRegistry();
1355
+ this.callbacks = new CallbackRegistry();
1433
1356
  this.global_callbacks = [];
1434
1357
  this.failThrough = failThrough;
1435
1358
  }
@@ -1482,13 +1405,13 @@ class dispatcher_Dispatcher {
1482
1405
  }
1483
1406
  }
1484
1407
 
1485
- // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
1408
+ ;// ./src/core/transports/transport_connection.ts
1486
1409
 
1487
1410
 
1488
1411
 
1489
1412
 
1490
1413
 
1491
- class transport_connection_TransportConnection extends dispatcher_Dispatcher {
1414
+ class TransportConnection extends Dispatcher {
1492
1415
  constructor(hooks, name, priority, key, options) {
1493
1416
  super();
1494
1417
  this.initialize = runtime.transportConnectionInitializer;
@@ -1629,9 +1552,9 @@ class transport_connection_TransportConnection extends dispatcher_Dispatcher {
1629
1552
  }
1630
1553
  }
1631
1554
 
1632
- // CONCATENATED MODULE: ./src/core/transports/transport.ts
1555
+ ;// ./src/core/transports/transport.ts
1633
1556
 
1634
- class transport_Transport {
1557
+ class Transport {
1635
1558
  constructor(hooks) {
1636
1559
  this.hooks = hooks;
1637
1560
  }
@@ -1639,16 +1562,16 @@ class transport_Transport {
1639
1562
  return this.hooks.isSupported(environment);
1640
1563
  }
1641
1564
  createConnection(name, priority, key, options) {
1642
- return new transport_connection_TransportConnection(this.hooks, name, priority, key, options);
1565
+ return new TransportConnection(this.hooks, name, priority, key, options);
1643
1566
  }
1644
1567
  }
1645
1568
 
1646
- // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
1569
+ ;// ./src/runtimes/isomorphic/transports/transports.ts
1647
1570
 
1648
1571
 
1649
1572
 
1650
1573
 
1651
- var WSTransport = new transport_Transport({
1574
+ var WSTransport = new Transport({
1652
1575
  urls: ws,
1653
1576
  handlesActivityChecks: false,
1654
1577
  supportsPing: false,
@@ -1685,23 +1608,23 @@ var xhrConfiguration = {
1685
1608
  return runtime.isXHRSupported();
1686
1609
  },
1687
1610
  };
1688
- var XHRStreamingTransport = new transport_Transport((extend({}, streamingConfiguration, xhrConfiguration)));
1689
- var XHRPollingTransport = new transport_Transport((extend({}, pollingConfiguration, xhrConfiguration)));
1611
+ var XHRStreamingTransport = new Transport((extend({}, streamingConfiguration, xhrConfiguration)));
1612
+ var XHRPollingTransport = new Transport((extend({}, pollingConfiguration, xhrConfiguration)));
1690
1613
  var Transports = {
1691
1614
  ws: WSTransport,
1692
1615
  xhr_streaming: XHRStreamingTransport,
1693
1616
  xhr_polling: XHRPollingTransport,
1694
1617
  };
1695
- /* harmony default export */ var transports = (Transports);
1618
+ /* harmony default export */ const transports = (Transports);
1696
1619
 
1697
- // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
1620
+ ;// ./src/runtimes/web/transports/transports.ts
1698
1621
 
1699
1622
 
1700
1623
 
1701
1624
 
1702
1625
 
1703
1626
 
1704
- var SockJSTransport = new transport_Transport({
1627
+ var SockJSTransport = new Transport({
1705
1628
  file: 'sockjs',
1706
1629
  urls: sockjs,
1707
1630
  handlesActivityChecks: true,
@@ -1732,16 +1655,16 @@ var xdrConfiguration = {
1732
1655
  return yes;
1733
1656
  },
1734
1657
  };
1735
- var XDRStreamingTransport = new transport_Transport((extend({}, streamingConfiguration, xdrConfiguration)));
1736
- var XDRPollingTransport = new transport_Transport((extend({}, pollingConfiguration, xdrConfiguration)));
1658
+ var XDRStreamingTransport = new Transport((extend({}, streamingConfiguration, xdrConfiguration)));
1659
+ var XDRPollingTransport = new Transport((extend({}, pollingConfiguration, xdrConfiguration)));
1737
1660
  transports.xdr_streaming = XDRStreamingTransport;
1738
1661
  transports.xdr_polling = XDRPollingTransport;
1739
1662
  transports.sockjs = SockJSTransport;
1740
- /* harmony default export */ var transports_transports = (transports);
1663
+ /* harmony default export */ const transports_transports = (transports);
1741
1664
 
1742
- // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
1665
+ ;// ./src/runtimes/web/net_info.ts
1743
1666
 
1744
- class net_info_NetInfo extends dispatcher_Dispatcher {
1667
+ class NetInfo extends Dispatcher {
1745
1668
  constructor() {
1746
1669
  super();
1747
1670
  var self = this;
@@ -1763,12 +1686,12 @@ class net_info_NetInfo extends dispatcher_Dispatcher {
1763
1686
  }
1764
1687
  }
1765
1688
  }
1766
- var net_info_Network = new net_info_NetInfo();
1689
+ var Network = new NetInfo();
1767
1690
 
1768
- // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
1691
+ ;// ./src/core/transports/assistant_to_the_transport_manager.ts
1769
1692
 
1770
1693
 
1771
- class assistant_to_the_transport_manager_AssistantToTheTransportManager {
1694
+ class AssistantToTheTransportManager {
1772
1695
  constructor(manager, transport, options) {
1773
1696
  this.manager = manager;
1774
1697
  this.transport = transport;
@@ -1808,7 +1731,7 @@ class assistant_to_the_transport_manager_AssistantToTheTransportManager {
1808
1731
  }
1809
1732
  }
1810
1733
 
1811
- // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
1734
+ ;// ./src/core/connection/protocol/protocol.ts
1812
1735
  const Protocol = {
1813
1736
  decodeMessage: function (messageEvent) {
1814
1737
  try {
@@ -1899,14 +1822,14 @@ const Protocol = {
1899
1822
  }
1900
1823
  },
1901
1824
  };
1902
- /* harmony default export */ var protocol_protocol = (Protocol);
1825
+ /* harmony default export */ const protocol = (Protocol);
1903
1826
 
1904
- // CONCATENATED MODULE: ./src/core/connection/connection.ts
1827
+ ;// ./src/core/connection/connection.ts
1905
1828
 
1906
1829
 
1907
1830
 
1908
1831
 
1909
- class connection_Connection extends dispatcher_Dispatcher {
1832
+ class Connection extends Dispatcher {
1910
1833
  constructor(id, transport) {
1911
1834
  super();
1912
1835
  this.id = id;
@@ -1926,7 +1849,7 @@ class connection_Connection extends dispatcher_Dispatcher {
1926
1849
  event.channel = channel;
1927
1850
  }
1928
1851
  logger.debug('Event sent', event);
1929
- return this.send(protocol_protocol.encodeMessage(event));
1852
+ return this.send(protocol.encodeMessage(event));
1930
1853
  }
1931
1854
  ping() {
1932
1855
  if (this.transport.supportsPing()) {
@@ -1944,7 +1867,7 @@ class connection_Connection extends dispatcher_Dispatcher {
1944
1867
  message: (messageEvent) => {
1945
1868
  var pusherEvent;
1946
1869
  try {
1947
- pusherEvent = protocol_protocol.decodeMessage(messageEvent);
1870
+ pusherEvent = protocol.decodeMessage(messageEvent);
1948
1871
  }
1949
1872
  catch (e) {
1950
1873
  this.emit('error', {
@@ -1997,8 +1920,8 @@ class connection_Connection extends dispatcher_Dispatcher {
1997
1920
  });
1998
1921
  }
1999
1922
  handleCloseEvent(closeEvent) {
2000
- var action = protocol_protocol.getCloseAction(closeEvent);
2001
- var error = protocol_protocol.getCloseError(closeEvent);
1923
+ var action = protocol.getCloseAction(closeEvent);
1924
+ var error = protocol.getCloseError(closeEvent);
2002
1925
  if (error) {
2003
1926
  this.emit('error', error);
2004
1927
  }
@@ -2008,11 +1931,11 @@ class connection_Connection extends dispatcher_Dispatcher {
2008
1931
  }
2009
1932
  }
2010
1933
 
2011
- // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
1934
+ ;// ./src/core/connection/handshake/index.ts
2012
1935
 
2013
1936
 
2014
1937
 
2015
- class handshake_Handshake {
1938
+ class Handshake {
2016
1939
  constructor(transport, callback) {
2017
1940
  this.transport = transport;
2018
1941
  this.callback = callback;
@@ -2027,7 +1950,7 @@ class handshake_Handshake {
2027
1950
  this.unbindListeners();
2028
1951
  var result;
2029
1952
  try {
2030
- result = protocol_protocol.processHandshake(m);
1953
+ result = protocol.processHandshake(m);
2031
1954
  }
2032
1955
  catch (e) {
2033
1956
  this.finish('error', { error: e });
@@ -2036,7 +1959,7 @@ class handshake_Handshake {
2036
1959
  }
2037
1960
  if (result.action === 'connected') {
2038
1961
  this.finish('connected', {
2039
- connection: new connection_Connection(result.id, this.transport),
1962
+ connection: new Connection(result.id, this.transport),
2040
1963
  activityTimeout: result.activityTimeout,
2041
1964
  });
2042
1965
  }
@@ -2047,8 +1970,8 @@ class handshake_Handshake {
2047
1970
  };
2048
1971
  this.onClosed = (closeEvent) => {
2049
1972
  this.unbindListeners();
2050
- var action = protocol_protocol.getCloseAction(closeEvent) || 'backoff';
2051
- var error = protocol_protocol.getCloseError(closeEvent);
1973
+ var action = protocol.getCloseAction(closeEvent) || 'backoff';
1974
+ var error = protocol.getCloseError(closeEvent);
2052
1975
  this.finish(action, { error: error });
2053
1976
  };
2054
1977
  this.transport.bind('message', this.onMessage);
@@ -2063,9 +1986,9 @@ class handshake_Handshake {
2063
1986
  }
2064
1987
  }
2065
1988
 
2066
- // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
1989
+ ;// ./src/core/timeline/timeline_sender.ts
2067
1990
 
2068
- class timeline_sender_TimelineSender {
1991
+ class TimelineSender {
2069
1992
  constructor(timeline, options) {
2070
1993
  this.timeline = timeline;
2071
1994
  this.options = options || {};
@@ -2078,13 +2001,13 @@ class timeline_sender_TimelineSender {
2078
2001
  }
2079
2002
  }
2080
2003
 
2081
- // CONCATENATED MODULE: ./src/core/channels/channel.ts
2004
+ ;// ./src/core/channels/channel.ts
2082
2005
 
2083
2006
 
2084
2007
 
2085
2008
 
2086
2009
 
2087
- class channel_Channel extends dispatcher_Dispatcher {
2010
+ class Channel extends Dispatcher {
2088
2011
  constructor(name, pusher) {
2089
2012
  super(function (event, data) {
2090
2013
  logger.debug('No callbacks on ' + name + ' for ' + event);
@@ -2180,9 +2103,9 @@ class channel_Channel extends dispatcher_Dispatcher {
2180
2103
  }
2181
2104
  }
2182
2105
 
2183
- // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
2106
+ ;// ./src/core/channels/private_channel.ts
2184
2107
 
2185
- class private_channel_PrivateChannel extends channel_Channel {
2108
+ class PrivateChannel extends Channel {
2186
2109
  authorize(socketId, callback) {
2187
2110
  return this.pusher.config.channelAuthorizer({
2188
2111
  channelName: this.name,
@@ -2191,9 +2114,9 @@ class private_channel_PrivateChannel extends channel_Channel {
2191
2114
  }
2192
2115
  }
2193
2116
 
2194
- // CONCATENATED MODULE: ./src/core/channels/members.ts
2117
+ ;// ./src/core/channels/members.ts
2195
2118
 
2196
- class members_Members {
2119
+ class Members {
2197
2120
  constructor() {
2198
2121
  this.reset();
2199
2122
  }
@@ -2244,7 +2167,7 @@ class members_Members {
2244
2167
  }
2245
2168
  }
2246
2169
 
2247
- // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
2170
+ ;// ./src/core/channels/presence_channel.ts
2248
2171
  var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
2249
2172
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
2250
2173
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -2258,10 +2181,10 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
2258
2181
 
2259
2182
 
2260
2183
 
2261
- class presence_channel_PresenceChannel extends private_channel_PrivateChannel {
2184
+ class PresenceChannel extends PrivateChannel {
2262
2185
  constructor(name, pusher) {
2263
2186
  super(name, pusher);
2264
- this.members = new members_Members();
2187
+ this.members = new Members();
2265
2188
  }
2266
2189
  authorize(socketId, callback) {
2267
2190
  super.authorize(socketId, (error, authData) => __awaiter(this, void 0, void 0, function* () {
@@ -2343,18 +2266,16 @@ class presence_channel_PresenceChannel extends private_channel_PrivateChannel {
2343
2266
  }
2344
2267
 
2345
2268
  // EXTERNAL MODULE: ./node_modules/@stablelib/utf8/lib/utf8.js
2346
- var utf8 = __webpack_require__(1);
2347
-
2269
+ var utf8 = __webpack_require__(978);
2348
2270
  // EXTERNAL MODULE: ./node_modules/@stablelib/base64/lib/base64.js
2349
- var base64 = __webpack_require__(0);
2271
+ var base64 = __webpack_require__(594);
2272
+ ;// ./src/core/channels/encrypted_channel.ts
2350
2273
 
2351
- // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
2352
2274
 
2353
2275
 
2354
2276
 
2355
2277
 
2356
-
2357
- class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel {
2278
+ class EncryptedChannel extends PrivateChannel {
2358
2279
  constructor(name, pusher, nacl) {
2359
2280
  super(name, pusher);
2360
2281
  this.key = null;
@@ -2371,7 +2292,7 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
2371
2292
  callback(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
2372
2293
  return;
2373
2294
  }
2374
- this.key = Object(base64["decode"])(sharedSecret);
2295
+ this.key = (0,base64.decode)(sharedSecret);
2375
2296
  delete authData['shared_secret'];
2376
2297
  callback(null, authData);
2377
2298
  });
@@ -2399,12 +2320,12 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
2399
2320
  data);
2400
2321
  return;
2401
2322
  }
2402
- let cipherText = Object(base64["decode"])(data.ciphertext);
2323
+ let cipherText = (0,base64.decode)(data.ciphertext);
2403
2324
  if (cipherText.length < this.nacl.secretbox.overheadLength) {
2404
2325
  logger.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${cipherText.length}`);
2405
2326
  return;
2406
2327
  }
2407
- let nonce = Object(base64["decode"])(data.nonce);
2328
+ let nonce = (0,base64.decode)(data.nonce);
2408
2329
  if (nonce.length < this.nacl.secretbox.nonceLength) {
2409
2330
  logger.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${nonce.length}`);
2410
2331
  return;
@@ -2430,7 +2351,7 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
2430
2351
  this.emit(event, this.getDataToEmit(bytes));
2431
2352
  }
2432
2353
  getDataToEmit(bytes) {
2433
- let raw = Object(utf8["decode"])(bytes);
2354
+ let raw = (0,utf8/* decode */.D4)(bytes);
2434
2355
  try {
2435
2356
  return JSON.parse(raw);
2436
2357
  }
@@ -2440,13 +2361,13 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
2440
2361
  }
2441
2362
  }
2442
2363
 
2443
- // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
2364
+ ;// ./src/core/connection/connection_manager.ts
2444
2365
 
2445
2366
 
2446
2367
 
2447
2368
 
2448
2369
 
2449
- class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
2370
+ class ConnectionManager extends Dispatcher {
2450
2371
  constructor(key, options) {
2451
2372
  super();
2452
2373
  this.state = 'initialized';
@@ -2473,6 +2394,11 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
2473
2394
  });
2474
2395
  this.updateStrategy();
2475
2396
  }
2397
+ switchCluster(key) {
2398
+ this.key = key;
2399
+ this.updateStrategy();
2400
+ this.retryIn(0);
2401
+ }
2476
2402
  connect() {
2477
2403
  if (this.connection || this.runner) {
2478
2404
  return;
@@ -2556,7 +2482,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
2556
2482
  if (delay > 0) {
2557
2483
  this.emit('connecting_in', Math.round(delay / 1000));
2558
2484
  }
2559
- this.retryTimer = new timers_OneOffTimer(delay || 0, () => {
2485
+ this.retryTimer = new OneOffTimer(delay || 0, () => {
2560
2486
  this.disconnectInternally();
2561
2487
  this.connect();
2562
2488
  });
@@ -2568,7 +2494,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
2568
2494
  }
2569
2495
  }
2570
2496
  setUnavailableTimer() {
2571
- this.unavailableTimer = new timers_OneOffTimer(this.options.unavailableTimeout, () => {
2497
+ this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, () => {
2572
2498
  this.updateState('unavailable');
2573
2499
  });
2574
2500
  }
@@ -2580,7 +2506,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
2580
2506
  sendActivityCheck() {
2581
2507
  this.stopActivityCheck();
2582
2508
  this.connection.ping();
2583
- this.activityTimer = new timers_OneOffTimer(this.options.pongTimeout, () => {
2509
+ this.activityTimer = new OneOffTimer(this.options.pongTimeout, () => {
2584
2510
  this.timeline.error({ pong_timed_out: this.options.pongTimeout });
2585
2511
  this.retryIn(0);
2586
2512
  });
@@ -2588,7 +2514,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
2588
2514
  resetActivityCheck() {
2589
2515
  this.stopActivityCheck();
2590
2516
  if (this.connection && !this.connection.handlesActivityChecks()) {
2591
- this.activityTimer = new timers_OneOffTimer(this.activityTimeout, () => {
2517
+ this.activityTimer = new OneOffTimer(this.activityTimeout, () => {
2592
2518
  this.sendActivityCheck();
2593
2519
  });
2594
2520
  }
@@ -2696,12 +2622,12 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
2696
2622
  }
2697
2623
  }
2698
2624
 
2699
- // CONCATENATED MODULE: ./src/core/channels/channels.ts
2625
+ ;// ./src/core/channels/channels.ts
2700
2626
 
2701
2627
 
2702
2628
 
2703
2629
 
2704
- class channels_Channels {
2630
+ class Channels {
2705
2631
  constructor() {
2706
2632
  this.channels = {};
2707
2633
  }
@@ -2751,7 +2677,7 @@ function createChannel(name, pusher) {
2751
2677
  }
2752
2678
  }
2753
2679
 
2754
- // CONCATENATED MODULE: ./src/core/utils/factory.ts
2680
+ ;// ./src/core/utils/factory.ts
2755
2681
 
2756
2682
 
2757
2683
 
@@ -2763,38 +2689,38 @@ function createChannel(name, pusher) {
2763
2689
 
2764
2690
  var Factory = {
2765
2691
  createChannels() {
2766
- return new channels_Channels();
2692
+ return new Channels();
2767
2693
  },
2768
2694
  createConnectionManager(key, options) {
2769
- return new connection_manager_ConnectionManager(key, options);
2695
+ return new ConnectionManager(key, options);
2770
2696
  },
2771
2697
  createChannel(name, pusher) {
2772
- return new channel_Channel(name, pusher);
2698
+ return new Channel(name, pusher);
2773
2699
  },
2774
2700
  createPrivateChannel(name, pusher) {
2775
- return new private_channel_PrivateChannel(name, pusher);
2701
+ return new PrivateChannel(name, pusher);
2776
2702
  },
2777
2703
  createPresenceChannel(name, pusher) {
2778
- return new presence_channel_PresenceChannel(name, pusher);
2704
+ return new PresenceChannel(name, pusher);
2779
2705
  },
2780
2706
  createEncryptedChannel(name, pusher, nacl) {
2781
- return new encrypted_channel_EncryptedChannel(name, pusher, nacl);
2707
+ return new EncryptedChannel(name, pusher, nacl);
2782
2708
  },
2783
2709
  createTimelineSender(timeline, options) {
2784
- return new timeline_sender_TimelineSender(timeline, options);
2710
+ return new TimelineSender(timeline, options);
2785
2711
  },
2786
2712
  createHandshake(transport, callback) {
2787
- return new handshake_Handshake(transport, callback);
2713
+ return new Handshake(transport, callback);
2788
2714
  },
2789
2715
  createAssistantToTheTransportManager(manager, transport, options) {
2790
- return new assistant_to_the_transport_manager_AssistantToTheTransportManager(manager, transport, options);
2716
+ return new AssistantToTheTransportManager(manager, transport, options);
2791
2717
  },
2792
2718
  };
2793
- /* harmony default export */ var factory = (Factory);
2719
+ /* harmony default export */ const factory = (Factory);
2794
2720
 
2795
- // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
2721
+ ;// ./src/core/transports/transport_manager.ts
2796
2722
 
2797
- class transport_manager_TransportManager {
2723
+ class TransportManager {
2798
2724
  constructor(options) {
2799
2725
  this.options = options || {};
2800
2726
  this.livesLeft = this.options.lives || Infinity;
@@ -2813,11 +2739,11 @@ class transport_manager_TransportManager {
2813
2739
  }
2814
2740
  }
2815
2741
 
2816
- // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
2742
+ ;// ./src/core/strategies/sequential_strategy.ts
2817
2743
 
2818
2744
 
2819
2745
 
2820
- class sequential_strategy_SequentialStrategy {
2746
+ class SequentialStrategy {
2821
2747
  constructor(strategies, options) {
2822
2748
  this.strategies = strategies;
2823
2749
  this.loop = Boolean(options.loop);
@@ -2873,7 +2799,7 @@ class sequential_strategy_SequentialStrategy {
2873
2799
  var timer = null;
2874
2800
  var runner = null;
2875
2801
  if (options.timeout > 0) {
2876
- timer = new timers_OneOffTimer(options.timeout, function () {
2802
+ timer = new OneOffTimer(options.timeout, function () {
2877
2803
  runner.abort();
2878
2804
  callback(true);
2879
2805
  });
@@ -2901,10 +2827,10 @@ class sequential_strategy_SequentialStrategy {
2901
2827
  }
2902
2828
  }
2903
2829
 
2904
- // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
2830
+ ;// ./src/core/strategies/best_connected_ever_strategy.ts
2905
2831
 
2906
2832
 
2907
- class best_connected_ever_strategy_BestConnectedEverStrategy {
2833
+ class BestConnectedEverStrategy {
2908
2834
  constructor(strategies) {
2909
2835
  this.strategies = strategies;
2910
2836
  }
@@ -2956,12 +2882,12 @@ function abortRunner(runner) {
2956
2882
  }
2957
2883
  }
2958
2884
 
2959
- // CONCATENATED MODULE: ./src/core/strategies/websocket_prioritized_cached_strategy.ts
2885
+ ;// ./src/core/strategies/websocket_prioritized_cached_strategy.ts
2960
2886
 
2961
2887
 
2962
2888
 
2963
2889
 
2964
- class websocket_prioritized_cached_strategy_WebSocketPrioritizedCachedStrategy {
2890
+ class WebSocketPrioritizedCachedStrategy {
2965
2891
  constructor(strategy, transports, options) {
2966
2892
  this.strategy = strategy;
2967
2893
  this.transports = transports;
@@ -2986,7 +2912,7 @@ class websocket_prioritized_cached_strategy_WebSocketPrioritizedCachedStrategy {
2986
2912
  transport: info.transport,
2987
2913
  latency: info.latency,
2988
2914
  });
2989
- strategies.push(new sequential_strategy_SequentialStrategy([transport], {
2915
+ strategies.push(new SequentialStrategy([transport], {
2990
2916
  timeout: info.latency * 2 + 1000,
2991
2917
  failFast: true,
2992
2918
  }));
@@ -3072,9 +2998,9 @@ function flushTransportCache(usingTLS) {
3072
2998
  }
3073
2999
  }
3074
3000
 
3075
- // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
3001
+ ;// ./src/core/strategies/delayed_strategy.ts
3076
3002
 
3077
- class delayed_strategy_DelayedStrategy {
3003
+ class DelayedStrategy {
3078
3004
  constructor(strategy, { delay: number }) {
3079
3005
  this.strategy = strategy;
3080
3006
  this.options = { delay: number };
@@ -3085,7 +3011,7 @@ class delayed_strategy_DelayedStrategy {
3085
3011
  connect(minPriority, callback) {
3086
3012
  var strategy = this.strategy;
3087
3013
  var runner;
3088
- var timer = new timers_OneOffTimer(this.options.delay, function () {
3014
+ var timer = new OneOffTimer(this.options.delay, function () {
3089
3015
  runner = strategy.connect(minPriority, callback);
3090
3016
  });
3091
3017
  return {
@@ -3105,7 +3031,7 @@ class delayed_strategy_DelayedStrategy {
3105
3031
  }
3106
3032
  }
3107
3033
 
3108
- // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
3034
+ ;// ./src/core/strategies/if_strategy.ts
3109
3035
  class IfStrategy {
3110
3036
  constructor(test, trueBranch, falseBranch) {
3111
3037
  this.test = test;
@@ -3122,7 +3048,7 @@ class IfStrategy {
3122
3048
  }
3123
3049
  }
3124
3050
 
3125
- // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
3051
+ ;// ./src/core/strategies/first_connected_strategy.ts
3126
3052
  class FirstConnectedStrategy {
3127
3053
  constructor(strategy) {
3128
3054
  this.strategy = strategy;
@@ -3141,7 +3067,7 @@ class FirstConnectedStrategy {
3141
3067
  }
3142
3068
  }
3143
3069
 
3144
- // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
3070
+ ;// ./src/runtimes/web/default_strategy.ts
3145
3071
 
3146
3072
 
3147
3073
 
@@ -3179,11 +3105,11 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
3179
3105
  timeout: 15000,
3180
3106
  timeoutLimit: 60000,
3181
3107
  };
3182
- var ws_manager = new transport_manager_TransportManager({
3108
+ var ws_manager = new TransportManager({
3183
3109
  minPingDelay: 10000,
3184
3110
  maxPingDelay: config.activityTimeout,
3185
3111
  });
3186
- var streaming_manager = new transport_manager_TransportManager({
3112
+ var streaming_manager = new TransportManager({
3187
3113
  lives: 2,
3188
3114
  minPingDelay: 10000,
3189
3115
  maxPingDelay: config.activityTimeout,
@@ -3195,47 +3121,47 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
3195
3121
  var xdr_streaming_transport = defineTransportStrategy('xdr_streaming', 'xdr_streaming', 1, sockjs_options, streaming_manager);
3196
3122
  var xhr_polling_transport = defineTransportStrategy('xhr_polling', 'xhr_polling', 1, sockjs_options);
3197
3123
  var xdr_polling_transport = defineTransportStrategy('xdr_polling', 'xdr_polling', 1, sockjs_options);
3198
- var ws_loop = new sequential_strategy_SequentialStrategy([ws_transport], timeouts);
3199
- var wss_loop = new sequential_strategy_SequentialStrategy([wss_transport], timeouts);
3200
- var sockjs_loop = new sequential_strategy_SequentialStrategy([sockjs_transport], timeouts);
3201
- var streaming_loop = new sequential_strategy_SequentialStrategy([
3124
+ var ws_loop = new SequentialStrategy([ws_transport], timeouts);
3125
+ var wss_loop = new SequentialStrategy([wss_transport], timeouts);
3126
+ var sockjs_loop = new SequentialStrategy([sockjs_transport], timeouts);
3127
+ var streaming_loop = new SequentialStrategy([
3202
3128
  new IfStrategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport),
3203
3129
  ], timeouts);
3204
- var polling_loop = new sequential_strategy_SequentialStrategy([
3130
+ var polling_loop = new SequentialStrategy([
3205
3131
  new IfStrategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport),
3206
3132
  ], timeouts);
3207
- var http_loop = new sequential_strategy_SequentialStrategy([
3208
- new IfStrategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy_BestConnectedEverStrategy([
3133
+ var http_loop = new SequentialStrategy([
3134
+ new IfStrategy(testSupportsStrategy(streaming_loop), new BestConnectedEverStrategy([
3209
3135
  streaming_loop,
3210
- new delayed_strategy_DelayedStrategy(polling_loop, { delay: 4000 }),
3136
+ new DelayedStrategy(polling_loop, { delay: 4000 }),
3211
3137
  ]), polling_loop),
3212
3138
  ], timeouts);
3213
3139
  var http_fallback_loop = new IfStrategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
3214
3140
  var wsStrategy;
3215
3141
  if (baseOptions.useTLS) {
3216
- wsStrategy = new best_connected_ever_strategy_BestConnectedEverStrategy([
3142
+ wsStrategy = new BestConnectedEverStrategy([
3217
3143
  ws_loop,
3218
- new delayed_strategy_DelayedStrategy(http_fallback_loop, { delay: 2000 }),
3144
+ new DelayedStrategy(http_fallback_loop, { delay: 2000 }),
3219
3145
  ]);
3220
3146
  }
3221
3147
  else {
3222
- wsStrategy = new best_connected_ever_strategy_BestConnectedEverStrategy([
3148
+ wsStrategy = new BestConnectedEverStrategy([
3223
3149
  ws_loop,
3224
- new delayed_strategy_DelayedStrategy(wss_loop, { delay: 2000 }),
3225
- new delayed_strategy_DelayedStrategy(http_fallback_loop, { delay: 5000 }),
3150
+ new DelayedStrategy(wss_loop, { delay: 2000 }),
3151
+ new DelayedStrategy(http_fallback_loop, { delay: 5000 }),
3226
3152
  ]);
3227
3153
  }
3228
- return new websocket_prioritized_cached_strategy_WebSocketPrioritizedCachedStrategy(new FirstConnectedStrategy(new IfStrategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
3154
+ return new WebSocketPrioritizedCachedStrategy(new FirstConnectedStrategy(new IfStrategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
3229
3155
  ttl: 1800000,
3230
3156
  timeline: baseOptions.timeline,
3231
3157
  useTLS: baseOptions.useTLS,
3232
3158
  });
3233
3159
  };
3234
- /* harmony default export */ var default_strategy = (getDefaultStrategy);
3160
+ /* harmony default export */ const default_strategy = (getDefaultStrategy);
3235
3161
 
3236
- // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
3162
+ ;// ./src/runtimes/web/transports/transport_connection_initializer.ts
3237
3163
 
3238
- /* harmony default export */ var transport_connection_initializer = (function () {
3164
+ /* harmony default export */ function transport_connection_initializer() {
3239
3165
  var self = this;
3240
3166
  self.timeline.info(self.buildTimelineMessage({
3241
3167
  transport: self.name + (self.options.useTLS ? 's' : ''),
@@ -3262,11 +3188,11 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
3262
3188
  else {
3263
3189
  self.onClose();
3264
3190
  }
3265
- });
3191
+ }
3266
3192
 
3267
- // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
3193
+ ;// ./src/runtimes/web/http/http_xdomain_request.ts
3268
3194
 
3269
- var http_xdomain_request_hooks = {
3195
+ var hooks = {
3270
3196
  getRequest: function (socket) {
3271
3197
  var xdr = new window.XDomainRequest();
3272
3198
  xdr.ontimeout = function () {
@@ -3296,13 +3222,13 @@ var http_xdomain_request_hooks = {
3296
3222
  xdr.abort();
3297
3223
  },
3298
3224
  };
3299
- /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
3225
+ /* harmony default export */ const http_xdomain_request = (hooks);
3300
3226
 
3301
- // CONCATENATED MODULE: ./src/core/http/http_request.ts
3227
+ ;// ./src/core/http/http_request.ts
3302
3228
 
3303
3229
 
3304
3230
  const MAX_BUFFER_LENGTH = 256 * 1024;
3305
- class http_request_HTTPRequest extends dispatcher_Dispatcher {
3231
+ class HTTPRequest extends Dispatcher {
3306
3232
  constructor(hooks, method, url) {
3307
3233
  super();
3308
3234
  this.hooks = hooks;
@@ -3362,21 +3288,21 @@ class http_request_HTTPRequest extends dispatcher_Dispatcher {
3362
3288
  }
3363
3289
  }
3364
3290
 
3365
- // CONCATENATED MODULE: ./src/core/http/state.ts
3291
+ ;// ./src/core/http/state.ts
3366
3292
  var State;
3367
3293
  (function (State) {
3368
3294
  State[State["CONNECTING"] = 0] = "CONNECTING";
3369
3295
  State[State["OPEN"] = 1] = "OPEN";
3370
3296
  State[State["CLOSED"] = 3] = "CLOSED";
3371
3297
  })(State || (State = {}));
3372
- /* harmony default export */ var state = (State);
3298
+ /* harmony default export */ const state = (State);
3373
3299
 
3374
- // CONCATENATED MODULE: ./src/core/http/http_socket.ts
3300
+ ;// ./src/core/http/http_socket.ts
3375
3301
 
3376
3302
 
3377
3303
 
3378
3304
  var autoIncrement = 1;
3379
- class http_socket_HTTPSocket {
3305
+ class HTTPSocket {
3380
3306
  constructor(hooks, url) {
3381
3307
  this.hooks = hooks;
3382
3308
  this.session = randomNumber(1000) + '/' + randomString(8);
@@ -3541,9 +3467,9 @@ function randomString(length) {
3541
3467
  }
3542
3468
  return result.join('');
3543
3469
  }
3544
- /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
3470
+ /* harmony default export */ const http_socket = (HTTPSocket);
3545
3471
 
3546
- // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
3472
+ ;// ./src/core/http/http_streaming_socket.ts
3547
3473
  var http_streaming_socket_hooks = {
3548
3474
  getReceiveURL: function (url, session) {
3549
3475
  return url.base + '/' + session + '/xhr_streaming' + url.queryString;
@@ -3558,9 +3484,9 @@ var http_streaming_socket_hooks = {
3558
3484
  socket.onClose(1006, 'Connection interrupted (' + status + ')', false);
3559
3485
  },
3560
3486
  };
3561
- /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
3487
+ /* harmony default export */ const http_streaming_socket = (http_streaming_socket_hooks);
3562
3488
 
3563
- // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
3489
+ ;// ./src/core/http/http_polling_socket.ts
3564
3490
  var http_polling_socket_hooks = {
3565
3491
  getReceiveURL: function (url, session) {
3566
3492
  return url.base + '/' + session + '/xhr' + url.queryString;
@@ -3579,9 +3505,9 @@ var http_polling_socket_hooks = {
3579
3505
  }
3580
3506
  },
3581
3507
  };
3582
- /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
3508
+ /* harmony default export */ const http_polling_socket = (http_polling_socket_hooks);
3583
3509
 
3584
- // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
3510
+ ;// ./src/runtimes/isomorphic/http/http_xhr_request.ts
3585
3511
 
3586
3512
  var http_xhr_request_hooks = {
3587
3513
  getRequest: function (socket) {
@@ -3610,9 +3536,9 @@ var http_xhr_request_hooks = {
3610
3536
  xhr.abort();
3611
3537
  },
3612
3538
  };
3613
- /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
3539
+ /* harmony default export */ const http_xhr_request = (http_xhr_request_hooks);
3614
3540
 
3615
- // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
3541
+ ;// ./src/runtimes/isomorphic/http/http.ts
3616
3542
 
3617
3543
 
3618
3544
 
@@ -3632,20 +3558,20 @@ var HTTP = {
3632
3558
  return this.createRequest(http_xhr_request, method, url);
3633
3559
  },
3634
3560
  createRequest(hooks, method, url) {
3635
- return new http_request_HTTPRequest(hooks, method, url);
3561
+ return new HTTPRequest(hooks, method, url);
3636
3562
  },
3637
3563
  };
3638
- /* harmony default export */ var http_http = (HTTP);
3564
+ /* harmony default export */ const http_http = (HTTP);
3639
3565
 
3640
- // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
3566
+ ;// ./src/runtimes/web/http/http.ts
3641
3567
 
3642
3568
 
3643
3569
  http_http.createXDR = function (method, url) {
3644
3570
  return this.createRequest(http_xdomain_request, method, url);
3645
3571
  };
3646
- /* harmony default export */ var web_http_http = (http_http);
3572
+ /* harmony default export */ const web_http_http = (http_http);
3647
3573
 
3648
- // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
3574
+ ;// ./src/runtimes/web/runtime.ts
3649
3575
 
3650
3576
 
3651
3577
 
@@ -3706,7 +3632,7 @@ var Runtime = {
3706
3632
  }
3707
3633
  },
3708
3634
  createJSONPRequest(url, data) {
3709
- return new jsonp_request_JSONPRequest(url, data);
3635
+ return new JSONPRequest(url, data);
3710
3636
  },
3711
3637
  createScriptRequest(src) {
3712
3638
  return new ScriptRequest(src);
@@ -3735,7 +3661,7 @@ var Runtime = {
3735
3661
  return new ActiveXObject('Microsoft.XMLHTTP');
3736
3662
  },
3737
3663
  getNetwork() {
3738
- return net_info_Network;
3664
+ return Network;
3739
3665
  },
3740
3666
  createWebSocket(url) {
3741
3667
  var Constructor = this.getWebSocketAPI();
@@ -3786,22 +3712,22 @@ var Runtime = {
3786
3712
  return Math.floor(random() * max);
3787
3713
  },
3788
3714
  };
3789
- /* harmony default export */ var runtime = (Runtime);
3715
+ /* harmony default export */ const runtime = (Runtime);
3790
3716
 
3791
- // CONCATENATED MODULE: ./src/core/timeline/level.ts
3717
+ ;// ./src/core/timeline/level.ts
3792
3718
  var TimelineLevel;
3793
3719
  (function (TimelineLevel) {
3794
3720
  TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
3795
3721
  TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
3796
3722
  TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
3797
3723
  })(TimelineLevel || (TimelineLevel = {}));
3798
- /* harmony default export */ var timeline_level = (TimelineLevel);
3724
+ /* harmony default export */ const level = (TimelineLevel);
3799
3725
 
3800
- // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
3726
+ ;// ./src/core/timeline/timeline.ts
3801
3727
 
3802
3728
 
3803
3729
 
3804
- class timeline_Timeline {
3730
+ class Timeline {
3805
3731
  constructor(key, session, options) {
3806
3732
  this.key = key;
3807
3733
  this.session = session;
@@ -3819,13 +3745,13 @@ class timeline_Timeline {
3819
3745
  }
3820
3746
  }
3821
3747
  error(event) {
3822
- this.log(timeline_level.ERROR, event);
3748
+ this.log(level.ERROR, event);
3823
3749
  }
3824
3750
  info(event) {
3825
- this.log(timeline_level.INFO, event);
3751
+ this.log(level.INFO, event);
3826
3752
  }
3827
3753
  debug(event) {
3828
- this.log(timeline_level.DEBUG, event);
3754
+ this.log(level.DEBUG, event);
3829
3755
  }
3830
3756
  isEmpty() {
3831
3757
  return this.events.length === 0;
@@ -3858,12 +3784,12 @@ class timeline_Timeline {
3858
3784
  }
3859
3785
  }
3860
3786
 
3861
- // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
3787
+ ;// ./src/core/strategies/transport_strategy.ts
3862
3788
 
3863
3789
 
3864
3790
 
3865
3791
 
3866
- class transport_strategy_TransportStrategy {
3792
+ class TransportStrategy {
3867
3793
  constructor(name, priority, transport, options) {
3868
3794
  this.name = name;
3869
3795
  this.priority = priority;
@@ -3956,14 +3882,14 @@ function failAttempt(error, callback) {
3956
3882
  };
3957
3883
  }
3958
3884
 
3959
- // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
3885
+ ;// ./src/core/strategies/strategy_builder.ts
3960
3886
 
3961
3887
 
3962
3888
 
3963
3889
 
3964
3890
 
3965
3891
  const { Transports: strategy_builder_Transports } = runtime;
3966
- var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
3892
+ var defineTransport = function (config, name, type, priority, options, manager) {
3967
3893
  var transportClass = strategy_builder_Transports[type];
3968
3894
  if (!transportClass) {
3969
3895
  throw new UnsupportedTransport(type);
@@ -3975,7 +3901,7 @@ var strategy_builder_defineTransport = function (config, name, type, priority, o
3975
3901
  var transport;
3976
3902
  if (enabled) {
3977
3903
  options = Object.assign({ ignoreNullOrigin: config.ignoreNullOrigin }, options);
3978
- transport = new transport_strategy_TransportStrategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, options);
3904
+ transport = new TransportStrategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, options);
3979
3905
  }
3980
3906
  else {
3981
3907
  transport = strategy_builder_UnsupportedStrategy;
@@ -3999,7 +3925,7 @@ var strategy_builder_UnsupportedStrategy = {
3999
3925
  },
4000
3926
  };
4001
3927
 
4002
- // CONCATENATED MODULE: ./src/core/options.ts
3928
+ ;// ./src/core/options.ts
4003
3929
 
4004
3930
  function validateOptions(options) {
4005
3931
  if (options == null) {
@@ -4013,7 +3939,7 @@ function validateOptions(options) {
4013
3939
  }
4014
3940
  }
4015
3941
 
4016
- // CONCATENATED MODULE: ./src/core/auth/user_authenticator.ts
3942
+ ;// ./src/core/auth/user_authenticator.ts
4017
3943
 
4018
3944
 
4019
3945
  const composeChannelQuery = (params, authOptions) => {
@@ -4046,9 +3972,9 @@ const UserAuthenticator = (authOptions) => {
4046
3972
  runtime.getAuthorizers()[authOptions.transport](runtime, query, authOptions, AuthRequestType.UserAuthentication, callback);
4047
3973
  };
4048
3974
  };
4049
- /* harmony default export */ var user_authenticator = (UserAuthenticator);
3975
+ /* harmony default export */ const user_authenticator = (UserAuthenticator);
4050
3976
 
4051
- // CONCATENATED MODULE: ./src/core/auth/channel_authorizer.ts
3977
+ ;// ./src/core/auth/channel_authorizer.ts
4052
3978
 
4053
3979
 
4054
3980
  const channel_authorizer_composeChannelQuery = (params, authOptions) => {
@@ -4082,9 +4008,9 @@ const ChannelAuthorizer = (authOptions) => {
4082
4008
  runtime.getAuthorizers()[authOptions.transport](runtime, query, authOptions, AuthRequestType.ChannelAuthorization, callback);
4083
4009
  };
4084
4010
  };
4085
- /* harmony default export */ var channel_authorizer = (ChannelAuthorizer);
4011
+ /* harmony default export */ const channel_authorizer = (ChannelAuthorizer);
4086
4012
 
4087
- // CONCATENATED MODULE: ./src/core/auth/deprecated_channel_authorizer.ts
4013
+ ;// ./src/core/auth/deprecated_channel_authorizer.ts
4088
4014
  const ChannelAuthorizerProxy = (pusher, authOptions, channelAuthorizerGenerator) => {
4089
4015
  const deprecatedAuthorizerOptions = {
4090
4016
  authTransport: authOptions.transport,
@@ -4101,7 +4027,7 @@ const ChannelAuthorizerProxy = (pusher, authOptions, channelAuthorizerGenerator)
4101
4027
  };
4102
4028
  };
4103
4029
 
4104
- // CONCATENATED MODULE: ./src/core/config.ts
4030
+ ;// ./src/core/config.ts
4105
4031
 
4106
4032
 
4107
4033
 
@@ -4176,10 +4102,12 @@ function getEnableStatsConfig(opts) {
4176
4102
  }
4177
4103
  return false;
4178
4104
  }
4105
+ const hasCustomHandler = (auth) => {
4106
+ return 'customHandler' in auth && auth['customHandler'] != null;
4107
+ };
4179
4108
  function buildUserAuthenticator(opts) {
4180
4109
  const userAuthentication = Object.assign(Object.assign({}, defaults.userAuthentication), opts.userAuthentication);
4181
- if ('customHandler' in userAuthentication &&
4182
- userAuthentication['customHandler'] != null) {
4110
+ if (hasCustomHandler(userAuthentication)) {
4183
4111
  return userAuthentication['customHandler'];
4184
4112
  }
4185
4113
  return user_authenticator(userAuthentication);
@@ -4200,24 +4128,26 @@ function buildChannelAuth(opts, pusher) {
4200
4128
  if ('headers' in opts.auth)
4201
4129
  channelAuthorization.headers = opts.auth.headers;
4202
4130
  }
4203
- if ('authorizer' in opts)
4204
- channelAuthorization.customHandler = ChannelAuthorizerProxy(pusher, channelAuthorization, opts.authorizer);
4131
+ if ('authorizer' in opts) {
4132
+ return {
4133
+ customHandler: ChannelAuthorizerProxy(pusher, channelAuthorization, opts.authorizer),
4134
+ };
4135
+ }
4205
4136
  }
4206
4137
  return channelAuthorization;
4207
4138
  }
4208
4139
  function buildChannelAuthorizer(opts, pusher) {
4209
4140
  const channelAuthorization = buildChannelAuth(opts, pusher);
4210
- if ('customHandler' in channelAuthorization &&
4211
- channelAuthorization['customHandler'] != null) {
4141
+ if (hasCustomHandler(channelAuthorization)) {
4212
4142
  return channelAuthorization['customHandler'];
4213
4143
  }
4214
4144
  return channel_authorizer(channelAuthorization);
4215
4145
  }
4216
4146
 
4217
- // CONCATENATED MODULE: ./src/core/watchlist.ts
4147
+ ;// ./src/core/watchlist.ts
4218
4148
 
4219
4149
 
4220
- class watchlist_WatchlistFacade extends dispatcher_Dispatcher {
4150
+ class WatchlistFacade extends Dispatcher {
4221
4151
  constructor(pusher) {
4222
4152
  super(function (eventName, data) {
4223
4153
  logger.debug(`No callbacks on watchlist events for ${eventName}`);
@@ -4240,7 +4170,7 @@ class watchlist_WatchlistFacade extends dispatcher_Dispatcher {
4240
4170
  }
4241
4171
  }
4242
4172
 
4243
- // CONCATENATED MODULE: ./src/core/utils/flat_promise.ts
4173
+ ;// ./src/core/utils/flat_promise.ts
4244
4174
  function flatPromise() {
4245
4175
  let resolve, reject;
4246
4176
  const promise = new Promise((res, rej) => {
@@ -4249,15 +4179,15 @@ function flatPromise() {
4249
4179
  });
4250
4180
  return { promise, resolve, reject };
4251
4181
  }
4252
- /* harmony default export */ var flat_promise = (flatPromise);
4182
+ /* harmony default export */ const flat_promise = (flatPromise);
4253
4183
 
4254
- // CONCATENATED MODULE: ./src/core/user.ts
4184
+ ;// ./src/core/user.ts
4255
4185
 
4256
4186
 
4257
4187
 
4258
4188
 
4259
4189
 
4260
- class user_UserFacade extends dispatcher_Dispatcher {
4190
+ class UserFacade extends Dispatcher {
4261
4191
  constructor(pusher) {
4262
4192
  super(function (eventName, data) {
4263
4193
  logger.debug('No callbacks on user for ' + eventName);
@@ -4288,7 +4218,7 @@ class user_UserFacade extends dispatcher_Dispatcher {
4288
4218
  this._newSigninPromiseIfNeeded();
4289
4219
  }
4290
4220
  });
4291
- this.watchlist = new watchlist_WatchlistFacade(pusher);
4221
+ this.watchlist = new WatchlistFacade(pusher);
4292
4222
  this.pusher.connection.bind('message', (event) => {
4293
4223
  var eventName = event.event;
4294
4224
  if (eventName === 'pusher:signin_success') {
@@ -4346,7 +4276,7 @@ class user_UserFacade extends dispatcher_Dispatcher {
4346
4276
  channel.subscribe();
4347
4277
  }
4348
4278
  };
4349
- this.serverToUserChannel = new channel_Channel(`#server-to-user-${this.user_data.id}`, this.pusher);
4279
+ this.serverToUserChannel = new Channel(`#server-to-user-${this.user_data.id}`, this.pusher);
4350
4280
  this.serverToUserChannel.bind_global((eventName, data) => {
4351
4281
  if (eventName.indexOf('pusher_internal:') === 0 ||
4352
4282
  eventName.indexOf('pusher:') === 0) {
@@ -4385,7 +4315,7 @@ class user_UserFacade extends dispatcher_Dispatcher {
4385
4315
  }
4386
4316
  }
4387
4317
 
4388
- // CONCATENATED MODULE: ./src/core/pusher.ts
4318
+ ;// ./src/core/pusher.ts
4389
4319
 
4390
4320
 
4391
4321
 
@@ -4399,11 +4329,11 @@ class user_UserFacade extends dispatcher_Dispatcher {
4399
4329
 
4400
4330
 
4401
4331
 
4402
- class pusher_Pusher {
4332
+ class Pusher {
4403
4333
  static ready() {
4404
- pusher_Pusher.isReady = true;
4405
- for (var i = 0, l = pusher_Pusher.instances.length; i < l; i++) {
4406
- pusher_Pusher.instances[i].connect();
4334
+ Pusher.isReady = true;
4335
+ for (var i = 0, l = Pusher.instances.length; i < l; i++) {
4336
+ Pusher.instances[i].connect();
4407
4337
  }
4408
4338
  }
4409
4339
  static getClientFeatures() {
@@ -4415,16 +4345,17 @@ class pusher_Pusher {
4415
4345
  checkAppKey(app_key);
4416
4346
  validateOptions(options);
4417
4347
  this.key = app_key;
4418
- this.config = getConfig(options, this);
4348
+ this.options = options;
4349
+ this.config = getConfig(this.options, this);
4419
4350
  this.channels = factory.createChannels();
4420
- this.global_emitter = new dispatcher_Dispatcher();
4351
+ this.global_emitter = new Dispatcher();
4421
4352
  this.sessionID = runtime.randomInt(1000000000);
4422
- this.timeline = new timeline_Timeline(this.key, this.sessionID, {
4353
+ this.timeline = new Timeline(this.key, this.sessionID, {
4423
4354
  cluster: this.config.cluster,
4424
- features: pusher_Pusher.getClientFeatures(),
4355
+ features: Pusher.getClientFeatures(),
4425
4356
  params: this.config.timelineParams || {},
4426
4357
  limit: 50,
4427
- level: timeline_level.INFO,
4358
+ level: level.INFO,
4428
4359
  version: defaults.VERSION,
4429
4360
  });
4430
4361
  if (this.config.enableStats) {
@@ -4434,7 +4365,7 @@ class pusher_Pusher {
4434
4365
  });
4435
4366
  }
4436
4367
  var getStrategy = (options) => {
4437
- return runtime.getDefaultStrategy(this.config, options, strategy_builder_defineTransport);
4368
+ return runtime.getDefaultStrategy(this.config, options, defineTransport);
4438
4369
  };
4439
4370
  this.connection = factory.createConnectionManager(this.key, {
4440
4371
  getStrategy: getStrategy,
@@ -4472,13 +4403,20 @@ class pusher_Pusher {
4472
4403
  this.connection.bind('error', (err) => {
4473
4404
  logger.warn(err);
4474
4405
  });
4475
- pusher_Pusher.instances.push(this);
4476
- this.timeline.info({ instances: pusher_Pusher.instances.length });
4477
- this.user = new user_UserFacade(this);
4478
- if (pusher_Pusher.isReady) {
4406
+ Pusher.instances.push(this);
4407
+ this.timeline.info({ instances: Pusher.instances.length });
4408
+ this.user = new UserFacade(this);
4409
+ if (Pusher.isReady) {
4479
4410
  this.connect();
4480
4411
  }
4481
4412
  }
4413
+ switchCluster(options) {
4414
+ const { appKey, cluster } = options;
4415
+ this.key = appKey;
4416
+ this.options = Object.assign(Object.assign({}, this.options), { cluster });
4417
+ this.config = getConfig(this.options, this);
4418
+ this.connection.switchCluster(this.key);
4419
+ }
4482
4420
  channel(name) {
4483
4421
  return this.channels.find(name);
4484
4422
  }
@@ -4491,7 +4429,7 @@ class pusher_Pusher {
4491
4429
  if (!this.timelineSenderTimer) {
4492
4430
  var usingTLS = this.connection.isUsingTLS();
4493
4431
  var timelineSender = this.timelineSender;
4494
- this.timelineSenderTimer = new timers_PeriodicTimer(60000, function () {
4432
+ this.timelineSenderTimer = new PeriodicTimer(60000, function () {
4495
4433
  timelineSender.send(usingTLS);
4496
4434
  });
4497
4435
  }
@@ -4565,23 +4503,77 @@ class pusher_Pusher {
4565
4503
  this.user.signin();
4566
4504
  }
4567
4505
  }
4568
- pusher_Pusher.instances = [];
4569
- pusher_Pusher.isReady = false;
4570
- pusher_Pusher.logToConsole = false;
4571
- pusher_Pusher.Runtime = runtime;
4572
- pusher_Pusher.ScriptReceivers = runtime.ScriptReceivers;
4573
- pusher_Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
4574
- pusher_Pusher.auth_callbacks = runtime.auth_callbacks;
4575
- /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
4506
+ Pusher.instances = [];
4507
+ Pusher.isReady = false;
4508
+ Pusher.logToConsole = false;
4509
+ Pusher.Runtime = runtime;
4510
+ Pusher.ScriptReceivers = runtime.ScriptReceivers;
4511
+ Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
4512
+ Pusher.auth_callbacks = runtime.auth_callbacks;
4513
+ /* harmony default export */ const pusher = (Pusher);
4576
4514
  function checkAppKey(key) {
4577
4515
  if (key === null || key === undefined) {
4578
4516
  throw 'You must pass your app key when you instantiate Pusher.';
4579
4517
  }
4580
4518
  }
4581
- runtime.setup(pusher_Pusher);
4519
+ runtime.setup(Pusher);
4582
4520
 
4583
4521
 
4584
- /***/ })
4585
- /******/ ]);
4522
+ /***/ }
4523
+
4524
+ /******/ });
4525
+ /************************************************************************/
4526
+ /******/ // The module cache
4527
+ /******/ var __webpack_module_cache__ = {};
4528
+ /******/
4529
+ /******/ // The require function
4530
+ /******/ function __webpack_require__(moduleId) {
4531
+ /******/ // Check if module is in cache
4532
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
4533
+ /******/ if (cachedModule !== undefined) {
4534
+ /******/ return cachedModule.exports;
4535
+ /******/ }
4536
+ /******/ // Create a new module (and put it into the cache)
4537
+ /******/ var module = __webpack_module_cache__[moduleId] = {
4538
+ /******/ // no module.id needed
4539
+ /******/ // no module.loaded needed
4540
+ /******/ exports: {}
4541
+ /******/ };
4542
+ /******/
4543
+ /******/ // Execute the module function
4544
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
4545
+ /******/
4546
+ /******/ // Return the exports of the module
4547
+ /******/ return module.exports;
4548
+ /******/ }
4549
+ /******/
4550
+ /************************************************************************/
4551
+ /******/ /* webpack/runtime/define property getters */
4552
+ /******/ (() => {
4553
+ /******/ // define getter functions for harmony exports
4554
+ /******/ __webpack_require__.d = (exports, definition) => {
4555
+ /******/ for(var key in definition) {
4556
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
4557
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
4558
+ /******/ }
4559
+ /******/ }
4560
+ /******/ };
4561
+ /******/ })();
4562
+ /******/
4563
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
4564
+ /******/ (() => {
4565
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
4566
+ /******/ })();
4567
+ /******/
4568
+ /************************************************************************/
4569
+ /******/
4570
+ /******/ // startup
4571
+ /******/ // Load entry module and return exports
4572
+ /******/ // This entry module used 'module' so it can't be inlined
4573
+ /******/ var __webpack_exports__ = __webpack_require__(721);
4574
+ /******/
4575
+ /******/ return __webpack_exports__;
4576
+ /******/ })()
4577
+ ;
4586
4578
  });
4587
4579
  //# sourceMappingURL=pusher.js.map