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.
- package/.github/workflows/release.yml +5 -5
- package/.github/workflows/release_pr.yml +4 -4
- package/.github/workflows/run-tests.yml +13 -8
- package/CHANGELOG.md +12 -0
- package/dist/node/pusher.js +5715 -5673
- package/dist/node/pusher.js.map +1 -1
- package/dist/react-native/pusher.js +2 -8
- package/dist/react-native/pusher.js.LICENSE.txt +7 -0
- package/dist/react-native/pusher.js.map +1 -1
- package/dist/web/pusher-with-encryption.js +353 -363
- package/dist/web/pusher-with-encryption.js.map +1 -1
- package/dist/web/pusher-with-encryption.min.js +2 -8
- package/dist/web/pusher-with-encryption.min.js.LICENSE.txt +7 -0
- package/dist/web/pusher-with-encryption.min.js.map +1 -1
- package/dist/web/pusher.js +340 -348
- package/dist/web/pusher.js.map +1 -1
- package/dist/web/pusher.min.js +2 -8
- package/dist/web/pusher.min.js.LICENSE.txt +7 -0
- package/dist/web/pusher.min.js.map +1 -1
- package/dist/worker/pusher-with-encryption.worker.js +327 -337
- package/dist/worker/pusher-with-encryption.worker.js.map +1 -1
- package/dist/worker/pusher-with-encryption.worker.min.js +2 -8
- package/dist/worker/pusher-with-encryption.worker.min.js.LICENSE.txt +7 -0
- package/dist/worker/pusher-with-encryption.worker.min.js.map +1 -1
- package/dist/worker/pusher.worker.js +314 -322
- package/dist/worker/pusher.worker.js.map +1 -1
- package/dist/worker/pusher.worker.min.js +2 -8
- package/dist/worker/pusher.worker.min.js.LICENSE.txt +7 -0
- package/dist/worker/pusher.worker.min.js.map +1 -1
- package/integration_tests_server/package-lock.json +565 -245
- package/integration_tests_server/package.json +2 -1
- package/package.json +21 -8
- package/spec/config/jasmine/webpack.integration.js +1 -1
- package/spec/config/jasmine/webpack.unit.js +1 -1
- package/spec/config/karma/config.ci.js +18 -18
- package/spec/javascripts/helpers/mocks.js +1 -0
- package/spec/javascripts/integration/index.web.js +14 -0
- package/spec/javascripts/unit/core/connection/connection_manager_spec.js +43 -0
- package/spec/javascripts/unit/core/pusher_spec.js +58 -0
- package/src/core/auth/options.ts +9 -11
- package/src/core/config.ts +23 -14
- package/src/core/connection/connection_manager.ts +9 -0
- package/src/core/options.ts +5 -0
- package/src/core/pusher.ts +17 -6
- package/types/src/core/auth/options.d.ts +5 -10
- package/types/src/core/connection/connection_manager.d.ts +1 -0
- package/types/src/core/options.d.ts +4 -0
- package/types/src/core/pusher.d.ts +3 -1
- package/webpack/config.node.js +1 -2
- package/webpack/config.react-native.js +1 -2
- package/webpack/config.shared.js +6 -6
- package/webpack/config.web.js +1 -2
- package/webpack/config.worker.js +1 -2
- package/webpack/dev.server.js +2 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Pusher JavaScript Library v8.
|
|
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
|
-
})(this,
|
|
19
|
-
return /******/ (
|
|
20
|
-
/******/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 = 3);
|
|
103
|
-
/******/ })
|
|
104
|
-
/************************************************************************/
|
|
105
|
-
/******/ ([
|
|
106
|
-
/* 0 */
|
|
107
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
18
|
+
})(this, () => {
|
|
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
|
-
|
|
395
|
-
/***/
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,12 +460,13 @@ function decode(arr) {
|
|
|
542
460
|
}
|
|
543
461
|
return chars.join("");
|
|
544
462
|
}
|
|
545
|
-
exports.
|
|
463
|
+
exports.D4 = decode;
|
|
464
|
+
|
|
546
465
|
|
|
466
|
+
/***/ },
|
|
547
467
|
|
|
548
|
-
/***/
|
|
549
|
-
|
|
550
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
468
|
+
/***/ 601
|
|
469
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
551
470
|
|
|
552
471
|
(function(nacl) {
|
|
553
472
|
'use strict';
|
|
@@ -2928,7 +2847,7 @@ nacl.setPRNG = function(fn) {
|
|
|
2928
2847
|
});
|
|
2929
2848
|
} else if (true) {
|
|
2930
2849
|
// Node.js.
|
|
2931
|
-
crypto = __webpack_require__(
|
|
2850
|
+
crypto = __webpack_require__(281);
|
|
2932
2851
|
if (crypto && crypto.randomBytes) {
|
|
2933
2852
|
nacl.setPRNG(function(x, n) {
|
|
2934
2853
|
var i, v = crypto.randomBytes(n);
|
|
@@ -2942,39 +2861,35 @@ nacl.setPRNG = function(fn) {
|
|
|
2942
2861
|
})( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
|
|
2943
2862
|
|
|
2944
2863
|
|
|
2945
|
-
/***/ }
|
|
2946
|
-
/* 3 */
|
|
2947
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2864
|
+
/***/ },
|
|
2948
2865
|
|
|
2949
|
-
|
|
2866
|
+
/***/ 42
|
|
2867
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
2950
2868
|
|
|
2869
|
+
module.exports = __webpack_require__(556)["default"];
|
|
2951
2870
|
|
|
2952
|
-
/***/ }),
|
|
2953
|
-
/* 4 */
|
|
2954
|
-
/***/ (function(module, exports) {
|
|
2955
2871
|
|
|
2956
|
-
|
|
2872
|
+
/***/ },
|
|
2957
2873
|
|
|
2958
|
-
/***/
|
|
2959
|
-
|
|
2960
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2874
|
+
/***/ 556
|
|
2875
|
+
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2961
2876
|
|
|
2962
2877
|
"use strict";
|
|
2963
|
-
// ESM COMPAT FLAG
|
|
2964
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2965
2878
|
|
|
2966
2879
|
// EXPORTS
|
|
2967
|
-
__webpack_require__.d(__webpack_exports__,
|
|
2880
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
2881
|
+
"default": () => (/* binding */ PusherWithEncryption)
|
|
2882
|
+
});
|
|
2968
2883
|
|
|
2969
|
-
|
|
2884
|
+
;// ./src/core/base64.ts
|
|
2970
2885
|
function encode(s) {
|
|
2971
2886
|
return btoa(utob(s));
|
|
2972
2887
|
}
|
|
2973
2888
|
var fromCharCode = String.fromCharCode;
|
|
2974
2889
|
var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
2975
2890
|
var b64tab = {};
|
|
2976
|
-
for (var
|
|
2977
|
-
b64tab[b64chars.charAt(
|
|
2891
|
+
for (var i = 0, l = b64chars.length; i < l; i++) {
|
|
2892
|
+
b64tab[b64chars.charAt(i)] = i;
|
|
2978
2893
|
}
|
|
2979
2894
|
var cb_utob = function (c) {
|
|
2980
2895
|
var cc = c.charCodeAt(0);
|
|
@@ -3007,7 +2922,7 @@ var btoa = self.btoa ||
|
|
|
3007
2922
|
return b.replace(/[\s\S]{1,3}/g, cb_encode);
|
|
3008
2923
|
};
|
|
3009
2924
|
|
|
3010
|
-
|
|
2925
|
+
;// ./src/core/utils/timers/abstract_timer.ts
|
|
3011
2926
|
class Timer {
|
|
3012
2927
|
constructor(set, clear, delay, callback) {
|
|
3013
2928
|
this.clear = clear;
|
|
@@ -3027,9 +2942,9 @@ class Timer {
|
|
|
3027
2942
|
}
|
|
3028
2943
|
}
|
|
3029
2944
|
}
|
|
3030
|
-
/* harmony default export */
|
|
2945
|
+
/* harmony default export */ const abstract_timer = (Timer);
|
|
3031
2946
|
|
|
3032
|
-
|
|
2947
|
+
;// ./src/core/utils/timers/index.ts
|
|
3033
2948
|
|
|
3034
2949
|
function timers_clearTimeout(timer) {
|
|
3035
2950
|
self.clearTimeout(timer);
|
|
@@ -3037,7 +2952,7 @@ function timers_clearTimeout(timer) {
|
|
|
3037
2952
|
function timers_clearInterval(timer) {
|
|
3038
2953
|
self.clearInterval(timer);
|
|
3039
2954
|
}
|
|
3040
|
-
class
|
|
2955
|
+
class OneOffTimer extends abstract_timer {
|
|
3041
2956
|
constructor(delay, callback) {
|
|
3042
2957
|
super(setTimeout, timers_clearTimeout, delay, function (timer) {
|
|
3043
2958
|
callback();
|
|
@@ -3045,7 +2960,7 @@ class timers_OneOffTimer extends abstract_timer {
|
|
|
3045
2960
|
});
|
|
3046
2961
|
}
|
|
3047
2962
|
}
|
|
3048
|
-
class
|
|
2963
|
+
class PeriodicTimer extends abstract_timer {
|
|
3049
2964
|
constructor(delay, callback) {
|
|
3050
2965
|
super(setInterval, timers_clearInterval, delay, function (timer) {
|
|
3051
2966
|
callback();
|
|
@@ -3054,7 +2969,7 @@ class timers_PeriodicTimer extends abstract_timer {
|
|
|
3054
2969
|
}
|
|
3055
2970
|
}
|
|
3056
2971
|
|
|
3057
|
-
|
|
2972
|
+
;// ./src/core/util.ts
|
|
3058
2973
|
|
|
3059
2974
|
var Util = {
|
|
3060
2975
|
now() {
|
|
@@ -3066,7 +2981,7 @@ var Util = {
|
|
|
3066
2981
|
}
|
|
3067
2982
|
},
|
|
3068
2983
|
defer(callback) {
|
|
3069
|
-
return new
|
|
2984
|
+
return new OneOffTimer(0, callback);
|
|
3070
2985
|
},
|
|
3071
2986
|
method(name, ...args) {
|
|
3072
2987
|
var boundArguments = Array.prototype.slice.call(arguments, 1);
|
|
@@ -3075,9 +2990,9 @@ var Util = {
|
|
|
3075
2990
|
};
|
|
3076
2991
|
},
|
|
3077
2992
|
};
|
|
3078
|
-
/* harmony default export */
|
|
2993
|
+
/* harmony default export */ const util = (Util);
|
|
3079
2994
|
|
|
3080
|
-
|
|
2995
|
+
;// ./src/core/utils/collections.ts
|
|
3081
2996
|
|
|
3082
2997
|
|
|
3083
2998
|
function extend(target, ...sources) {
|
|
@@ -3271,9 +3186,9 @@ function safeJSONStringify(source) {
|
|
|
3271
3186
|
}
|
|
3272
3187
|
}
|
|
3273
3188
|
|
|
3274
|
-
|
|
3189
|
+
;// ./src/core/defaults.ts
|
|
3275
3190
|
var Defaults = {
|
|
3276
|
-
VERSION: "8.
|
|
3191
|
+
VERSION: "8.5.0",
|
|
3277
3192
|
PROTOCOL: 7,
|
|
3278
3193
|
wsPort: 80,
|
|
3279
3194
|
wssPort: 443,
|
|
@@ -3300,9 +3215,9 @@ var Defaults = {
|
|
|
3300
3215
|
cdn_https: "https://js.pusher.com",
|
|
3301
3216
|
dependency_suffix: "",
|
|
3302
3217
|
};
|
|
3303
|
-
/* harmony default export */
|
|
3218
|
+
/* harmony default export */ const defaults = (Defaults);
|
|
3304
3219
|
|
|
3305
|
-
|
|
3220
|
+
;// ./src/core/transports/url_schemes.ts
|
|
3306
3221
|
|
|
3307
3222
|
function getGenericURL(baseScheme, params, path) {
|
|
3308
3223
|
var scheme = baseScheme + (params.useTLS ? 's' : '');
|
|
@@ -3340,9 +3255,9 @@ var sockjs = {
|
|
|
3340
3255
|
},
|
|
3341
3256
|
};
|
|
3342
3257
|
|
|
3343
|
-
|
|
3258
|
+
;// ./src/core/events/callback_registry.ts
|
|
3344
3259
|
|
|
3345
|
-
class
|
|
3260
|
+
class CallbackRegistry {
|
|
3346
3261
|
constructor() {
|
|
3347
3262
|
this._callbacks = {};
|
|
3348
3263
|
}
|
|
@@ -3392,12 +3307,12 @@ function prefix(name) {
|
|
|
3392
3307
|
return '_' + name;
|
|
3393
3308
|
}
|
|
3394
3309
|
|
|
3395
|
-
|
|
3310
|
+
;// ./src/core/events/dispatcher.ts
|
|
3396
3311
|
|
|
3397
3312
|
|
|
3398
|
-
class
|
|
3313
|
+
class Dispatcher {
|
|
3399
3314
|
constructor(failThrough) {
|
|
3400
|
-
this.callbacks = new
|
|
3315
|
+
this.callbacks = new CallbackRegistry();
|
|
3401
3316
|
this.global_callbacks = [];
|
|
3402
3317
|
this.failThrough = failThrough;
|
|
3403
3318
|
}
|
|
@@ -3450,10 +3365,10 @@ class dispatcher_Dispatcher {
|
|
|
3450
3365
|
}
|
|
3451
3366
|
}
|
|
3452
3367
|
|
|
3453
|
-
|
|
3368
|
+
;// ./src/core/logger.ts
|
|
3454
3369
|
|
|
3455
3370
|
|
|
3456
|
-
class
|
|
3371
|
+
class Logger {
|
|
3457
3372
|
constructor() {
|
|
3458
3373
|
this.globalLog = (message) => {
|
|
3459
3374
|
if (self.console && self.console.log) {
|
|
@@ -3488,24 +3403,24 @@ class logger_Logger {
|
|
|
3488
3403
|
}
|
|
3489
3404
|
log(defaultLoggingFunction, ...args) {
|
|
3490
3405
|
var message = stringify.apply(this, arguments);
|
|
3491
|
-
if (
|
|
3492
|
-
|
|
3406
|
+
if (pusher.log) {
|
|
3407
|
+
pusher.log(message);
|
|
3493
3408
|
}
|
|
3494
|
-
else if (
|
|
3409
|
+
else if (pusher.logToConsole) {
|
|
3495
3410
|
const log = defaultLoggingFunction.bind(this);
|
|
3496
3411
|
log(message);
|
|
3497
3412
|
}
|
|
3498
3413
|
}
|
|
3499
3414
|
}
|
|
3500
|
-
/* harmony default export */
|
|
3415
|
+
/* harmony default export */ const logger = (new Logger());
|
|
3501
3416
|
|
|
3502
|
-
|
|
3417
|
+
;// ./src/core/transports/transport_connection.ts
|
|
3503
3418
|
|
|
3504
3419
|
|
|
3505
3420
|
|
|
3506
3421
|
|
|
3507
3422
|
|
|
3508
|
-
class
|
|
3423
|
+
class TransportConnection extends Dispatcher {
|
|
3509
3424
|
constructor(hooks, name, priority, key, options) {
|
|
3510
3425
|
super();
|
|
3511
3426
|
this.initialize = worker_runtime.transportConnectionInitializer;
|
|
@@ -3646,9 +3561,9 @@ class transport_connection_TransportConnection extends dispatcher_Dispatcher {
|
|
|
3646
3561
|
}
|
|
3647
3562
|
}
|
|
3648
3563
|
|
|
3649
|
-
|
|
3564
|
+
;// ./src/core/transports/transport.ts
|
|
3650
3565
|
|
|
3651
|
-
class
|
|
3566
|
+
class Transport {
|
|
3652
3567
|
constructor(hooks) {
|
|
3653
3568
|
this.hooks = hooks;
|
|
3654
3569
|
}
|
|
@@ -3656,16 +3571,16 @@ class transport_Transport {
|
|
|
3656
3571
|
return this.hooks.isSupported(environment);
|
|
3657
3572
|
}
|
|
3658
3573
|
createConnection(name, priority, key, options) {
|
|
3659
|
-
return new
|
|
3574
|
+
return new TransportConnection(this.hooks, name, priority, key, options);
|
|
3660
3575
|
}
|
|
3661
3576
|
}
|
|
3662
3577
|
|
|
3663
|
-
|
|
3578
|
+
;// ./src/runtimes/isomorphic/transports/transports.ts
|
|
3664
3579
|
|
|
3665
3580
|
|
|
3666
3581
|
|
|
3667
3582
|
|
|
3668
|
-
var WSTransport = new
|
|
3583
|
+
var WSTransport = new Transport({
|
|
3669
3584
|
urls: ws,
|
|
3670
3585
|
handlesActivityChecks: false,
|
|
3671
3586
|
supportsPing: false,
|
|
@@ -3702,19 +3617,19 @@ var xhrConfiguration = {
|
|
|
3702
3617
|
return worker_runtime.isXHRSupported();
|
|
3703
3618
|
},
|
|
3704
3619
|
};
|
|
3705
|
-
var XHRStreamingTransport = new
|
|
3706
|
-
var XHRPollingTransport = new
|
|
3620
|
+
var XHRStreamingTransport = new Transport((extend({}, streamingConfiguration, xhrConfiguration)));
|
|
3621
|
+
var XHRPollingTransport = new Transport((extend({}, pollingConfiguration, xhrConfiguration)));
|
|
3707
3622
|
var Transports = {
|
|
3708
3623
|
ws: WSTransport,
|
|
3709
3624
|
xhr_streaming: XHRStreamingTransport,
|
|
3710
3625
|
xhr_polling: XHRPollingTransport,
|
|
3711
3626
|
};
|
|
3712
|
-
/* harmony default export */
|
|
3627
|
+
/* harmony default export */ const transports = (Transports);
|
|
3713
3628
|
|
|
3714
|
-
|
|
3629
|
+
;// ./src/core/transports/assistant_to_the_transport_manager.ts
|
|
3715
3630
|
|
|
3716
3631
|
|
|
3717
|
-
class
|
|
3632
|
+
class AssistantToTheTransportManager {
|
|
3718
3633
|
constructor(manager, transport, options) {
|
|
3719
3634
|
this.manager = manager;
|
|
3720
3635
|
this.transport = transport;
|
|
@@ -3754,7 +3669,7 @@ class assistant_to_the_transport_manager_AssistantToTheTransportManager {
|
|
|
3754
3669
|
}
|
|
3755
3670
|
}
|
|
3756
3671
|
|
|
3757
|
-
|
|
3672
|
+
;// ./src/core/connection/protocol/protocol.ts
|
|
3758
3673
|
const Protocol = {
|
|
3759
3674
|
decodeMessage: function (messageEvent) {
|
|
3760
3675
|
try {
|
|
@@ -3845,14 +3760,14 @@ const Protocol = {
|
|
|
3845
3760
|
}
|
|
3846
3761
|
},
|
|
3847
3762
|
};
|
|
3848
|
-
/* harmony default export */
|
|
3763
|
+
/* harmony default export */ const protocol = (Protocol);
|
|
3849
3764
|
|
|
3850
|
-
|
|
3765
|
+
;// ./src/core/connection/connection.ts
|
|
3851
3766
|
|
|
3852
3767
|
|
|
3853
3768
|
|
|
3854
3769
|
|
|
3855
|
-
class
|
|
3770
|
+
class Connection extends Dispatcher {
|
|
3856
3771
|
constructor(id, transport) {
|
|
3857
3772
|
super();
|
|
3858
3773
|
this.id = id;
|
|
@@ -3954,11 +3869,11 @@ class connection_Connection extends dispatcher_Dispatcher {
|
|
|
3954
3869
|
}
|
|
3955
3870
|
}
|
|
3956
3871
|
|
|
3957
|
-
|
|
3872
|
+
;// ./src/core/connection/handshake/index.ts
|
|
3958
3873
|
|
|
3959
3874
|
|
|
3960
3875
|
|
|
3961
|
-
class
|
|
3876
|
+
class Handshake {
|
|
3962
3877
|
constructor(transport, callback) {
|
|
3963
3878
|
this.transport = transport;
|
|
3964
3879
|
this.callback = callback;
|
|
@@ -3982,7 +3897,7 @@ class handshake_Handshake {
|
|
|
3982
3897
|
}
|
|
3983
3898
|
if (result.action === 'connected') {
|
|
3984
3899
|
this.finish('connected', {
|
|
3985
|
-
connection: new
|
|
3900
|
+
connection: new Connection(result.id, this.transport),
|
|
3986
3901
|
activityTimeout: result.activityTimeout,
|
|
3987
3902
|
});
|
|
3988
3903
|
}
|
|
@@ -4009,9 +3924,9 @@ class handshake_Handshake {
|
|
|
4009
3924
|
}
|
|
4010
3925
|
}
|
|
4011
3926
|
|
|
4012
|
-
|
|
3927
|
+
;// ./src/core/timeline/timeline_sender.ts
|
|
4013
3928
|
|
|
4014
|
-
class
|
|
3929
|
+
class TimelineSender {
|
|
4015
3930
|
constructor(timeline, options) {
|
|
4016
3931
|
this.timeline = timeline;
|
|
4017
3932
|
this.options = options || {};
|
|
@@ -4024,7 +3939,7 @@ class timeline_sender_TimelineSender {
|
|
|
4024
3939
|
}
|
|
4025
3940
|
}
|
|
4026
3941
|
|
|
4027
|
-
|
|
3942
|
+
;// ./src/core/errors.ts
|
|
4028
3943
|
class BadEventName extends Error {
|
|
4029
3944
|
constructor(msg) {
|
|
4030
3945
|
super(msg);
|
|
@@ -4081,7 +3996,7 @@ class HTTPAuthError extends Error {
|
|
|
4081
3996
|
}
|
|
4082
3997
|
}
|
|
4083
3998
|
|
|
4084
|
-
|
|
3999
|
+
;// ./src/core/utils/url_store.ts
|
|
4085
4000
|
const urlStore = {
|
|
4086
4001
|
baseUrl: 'https://pusher.com',
|
|
4087
4002
|
urls: {
|
|
@@ -4118,15 +4033,15 @@ const buildLogSuffix = function (key) {
|
|
|
4118
4033
|
return '';
|
|
4119
4034
|
return `${urlPrefix} ${url}`;
|
|
4120
4035
|
};
|
|
4121
|
-
/* harmony default export */
|
|
4036
|
+
/* harmony default export */ const url_store = ({ buildLogSuffix });
|
|
4122
4037
|
|
|
4123
|
-
|
|
4038
|
+
;// ./src/core/channels/channel.ts
|
|
4124
4039
|
|
|
4125
4040
|
|
|
4126
4041
|
|
|
4127
4042
|
|
|
4128
4043
|
|
|
4129
|
-
class
|
|
4044
|
+
class Channel extends Dispatcher {
|
|
4130
4045
|
constructor(name, pusher) {
|
|
4131
4046
|
super(function (event, data) {
|
|
4132
4047
|
logger.debug('No callbacks on ' + name + ' for ' + event);
|
|
@@ -4222,9 +4137,9 @@ class channel_Channel extends dispatcher_Dispatcher {
|
|
|
4222
4137
|
}
|
|
4223
4138
|
}
|
|
4224
4139
|
|
|
4225
|
-
|
|
4140
|
+
;// ./src/core/channels/private_channel.ts
|
|
4226
4141
|
|
|
4227
|
-
class
|
|
4142
|
+
class PrivateChannel extends Channel {
|
|
4228
4143
|
authorize(socketId, callback) {
|
|
4229
4144
|
return this.pusher.config.channelAuthorizer({
|
|
4230
4145
|
channelName: this.name,
|
|
@@ -4233,9 +4148,9 @@ class private_channel_PrivateChannel extends channel_Channel {
|
|
|
4233
4148
|
}
|
|
4234
4149
|
}
|
|
4235
4150
|
|
|
4236
|
-
|
|
4151
|
+
;// ./src/core/channels/members.ts
|
|
4237
4152
|
|
|
4238
|
-
class
|
|
4153
|
+
class Members {
|
|
4239
4154
|
constructor() {
|
|
4240
4155
|
this.reset();
|
|
4241
4156
|
}
|
|
@@ -4286,7 +4201,7 @@ class members_Members {
|
|
|
4286
4201
|
}
|
|
4287
4202
|
}
|
|
4288
4203
|
|
|
4289
|
-
|
|
4204
|
+
;// ./src/core/channels/presence_channel.ts
|
|
4290
4205
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4291
4206
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4292
4207
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -4300,10 +4215,10 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|
|
4300
4215
|
|
|
4301
4216
|
|
|
4302
4217
|
|
|
4303
|
-
class
|
|
4218
|
+
class PresenceChannel extends PrivateChannel {
|
|
4304
4219
|
constructor(name, pusher) {
|
|
4305
4220
|
super(name, pusher);
|
|
4306
|
-
this.members = new
|
|
4221
|
+
this.members = new Members();
|
|
4307
4222
|
}
|
|
4308
4223
|
authorize(socketId, callback) {
|
|
4309
4224
|
super.authorize(socketId, (error, authData) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -4385,18 +4300,16 @@ class presence_channel_PresenceChannel extends private_channel_PrivateChannel {
|
|
|
4385
4300
|
}
|
|
4386
4301
|
|
|
4387
4302
|
// EXTERNAL MODULE: ./node_modules/@stablelib/utf8/lib/utf8.js
|
|
4388
|
-
var utf8 = __webpack_require__(
|
|
4389
|
-
|
|
4303
|
+
var utf8 = __webpack_require__(978);
|
|
4390
4304
|
// EXTERNAL MODULE: ./node_modules/@stablelib/base64/lib/base64.js
|
|
4391
|
-
var base64 = __webpack_require__(
|
|
4392
|
-
|
|
4393
|
-
// CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
|
|
4305
|
+
var base64 = __webpack_require__(594);
|
|
4306
|
+
;// ./src/core/channels/encrypted_channel.ts
|
|
4394
4307
|
|
|
4395
4308
|
|
|
4396
4309
|
|
|
4397
4310
|
|
|
4398
4311
|
|
|
4399
|
-
class
|
|
4312
|
+
class EncryptedChannel extends PrivateChannel {
|
|
4400
4313
|
constructor(name, pusher, nacl) {
|
|
4401
4314
|
super(name, pusher);
|
|
4402
4315
|
this.key = null;
|
|
@@ -4413,7 +4326,7 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
|
|
|
4413
4326
|
callback(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
4414
4327
|
return;
|
|
4415
4328
|
}
|
|
4416
|
-
this.key =
|
|
4329
|
+
this.key = (0,base64.decode)(sharedSecret);
|
|
4417
4330
|
delete authData['shared_secret'];
|
|
4418
4331
|
callback(null, authData);
|
|
4419
4332
|
});
|
|
@@ -4441,12 +4354,12 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
|
|
|
4441
4354
|
data);
|
|
4442
4355
|
return;
|
|
4443
4356
|
}
|
|
4444
|
-
let cipherText =
|
|
4357
|
+
let cipherText = (0,base64.decode)(data.ciphertext);
|
|
4445
4358
|
if (cipherText.length < this.nacl.secretbox.overheadLength) {
|
|
4446
4359
|
logger.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${cipherText.length}`);
|
|
4447
4360
|
return;
|
|
4448
4361
|
}
|
|
4449
|
-
let nonce =
|
|
4362
|
+
let nonce = (0,base64.decode)(data.nonce);
|
|
4450
4363
|
if (nonce.length < this.nacl.secretbox.nonceLength) {
|
|
4451
4364
|
logger.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${nonce.length}`);
|
|
4452
4365
|
return;
|
|
@@ -4472,7 +4385,7 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
|
|
|
4472
4385
|
this.emit(event, this.getDataToEmit(bytes));
|
|
4473
4386
|
}
|
|
4474
4387
|
getDataToEmit(bytes) {
|
|
4475
|
-
let raw =
|
|
4388
|
+
let raw = (0,utf8/* decode */.D4)(bytes);
|
|
4476
4389
|
try {
|
|
4477
4390
|
return JSON.parse(raw);
|
|
4478
4391
|
}
|
|
@@ -4482,13 +4395,13 @@ class encrypted_channel_EncryptedChannel extends private_channel_PrivateChannel
|
|
|
4482
4395
|
}
|
|
4483
4396
|
}
|
|
4484
4397
|
|
|
4485
|
-
|
|
4398
|
+
;// ./src/core/connection/connection_manager.ts
|
|
4486
4399
|
|
|
4487
4400
|
|
|
4488
4401
|
|
|
4489
4402
|
|
|
4490
4403
|
|
|
4491
|
-
class
|
|
4404
|
+
class ConnectionManager extends Dispatcher {
|
|
4492
4405
|
constructor(key, options) {
|
|
4493
4406
|
super();
|
|
4494
4407
|
this.state = 'initialized';
|
|
@@ -4515,6 +4428,11 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
4515
4428
|
});
|
|
4516
4429
|
this.updateStrategy();
|
|
4517
4430
|
}
|
|
4431
|
+
switchCluster(key) {
|
|
4432
|
+
this.key = key;
|
|
4433
|
+
this.updateStrategy();
|
|
4434
|
+
this.retryIn(0);
|
|
4435
|
+
}
|
|
4518
4436
|
connect() {
|
|
4519
4437
|
if (this.connection || this.runner) {
|
|
4520
4438
|
return;
|
|
@@ -4598,7 +4516,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
4598
4516
|
if (delay > 0) {
|
|
4599
4517
|
this.emit('connecting_in', Math.round(delay / 1000));
|
|
4600
4518
|
}
|
|
4601
|
-
this.retryTimer = new
|
|
4519
|
+
this.retryTimer = new OneOffTimer(delay || 0, () => {
|
|
4602
4520
|
this.disconnectInternally();
|
|
4603
4521
|
this.connect();
|
|
4604
4522
|
});
|
|
@@ -4610,7 +4528,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
4610
4528
|
}
|
|
4611
4529
|
}
|
|
4612
4530
|
setUnavailableTimer() {
|
|
4613
|
-
this.unavailableTimer = new
|
|
4531
|
+
this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, () => {
|
|
4614
4532
|
this.updateState('unavailable');
|
|
4615
4533
|
});
|
|
4616
4534
|
}
|
|
@@ -4622,7 +4540,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
4622
4540
|
sendActivityCheck() {
|
|
4623
4541
|
this.stopActivityCheck();
|
|
4624
4542
|
this.connection.ping();
|
|
4625
|
-
this.activityTimer = new
|
|
4543
|
+
this.activityTimer = new OneOffTimer(this.options.pongTimeout, () => {
|
|
4626
4544
|
this.timeline.error({ pong_timed_out: this.options.pongTimeout });
|
|
4627
4545
|
this.retryIn(0);
|
|
4628
4546
|
});
|
|
@@ -4630,7 +4548,7 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
4630
4548
|
resetActivityCheck() {
|
|
4631
4549
|
this.stopActivityCheck();
|
|
4632
4550
|
if (this.connection && !this.connection.handlesActivityChecks()) {
|
|
4633
|
-
this.activityTimer = new
|
|
4551
|
+
this.activityTimer = new OneOffTimer(this.activityTimeout, () => {
|
|
4634
4552
|
this.sendActivityCheck();
|
|
4635
4553
|
});
|
|
4636
4554
|
}
|
|
@@ -4738,12 +4656,12 @@ class connection_manager_ConnectionManager extends dispatcher_Dispatcher {
|
|
|
4738
4656
|
}
|
|
4739
4657
|
}
|
|
4740
4658
|
|
|
4741
|
-
|
|
4659
|
+
;// ./src/core/channels/channels.ts
|
|
4742
4660
|
|
|
4743
4661
|
|
|
4744
4662
|
|
|
4745
4663
|
|
|
4746
|
-
class
|
|
4664
|
+
class Channels {
|
|
4747
4665
|
constructor() {
|
|
4748
4666
|
this.channels = {};
|
|
4749
4667
|
}
|
|
@@ -4793,7 +4711,7 @@ function createChannel(name, pusher) {
|
|
|
4793
4711
|
}
|
|
4794
4712
|
}
|
|
4795
4713
|
|
|
4796
|
-
|
|
4714
|
+
;// ./src/core/utils/factory.ts
|
|
4797
4715
|
|
|
4798
4716
|
|
|
4799
4717
|
|
|
@@ -4805,38 +4723,38 @@ function createChannel(name, pusher) {
|
|
|
4805
4723
|
|
|
4806
4724
|
var Factory = {
|
|
4807
4725
|
createChannels() {
|
|
4808
|
-
return new
|
|
4726
|
+
return new Channels();
|
|
4809
4727
|
},
|
|
4810
4728
|
createConnectionManager(key, options) {
|
|
4811
|
-
return new
|
|
4729
|
+
return new ConnectionManager(key, options);
|
|
4812
4730
|
},
|
|
4813
4731
|
createChannel(name, pusher) {
|
|
4814
|
-
return new
|
|
4732
|
+
return new Channel(name, pusher);
|
|
4815
4733
|
},
|
|
4816
4734
|
createPrivateChannel(name, pusher) {
|
|
4817
|
-
return new
|
|
4735
|
+
return new PrivateChannel(name, pusher);
|
|
4818
4736
|
},
|
|
4819
4737
|
createPresenceChannel(name, pusher) {
|
|
4820
|
-
return new
|
|
4738
|
+
return new PresenceChannel(name, pusher);
|
|
4821
4739
|
},
|
|
4822
4740
|
createEncryptedChannel(name, pusher, nacl) {
|
|
4823
|
-
return new
|
|
4741
|
+
return new EncryptedChannel(name, pusher, nacl);
|
|
4824
4742
|
},
|
|
4825
4743
|
createTimelineSender(timeline, options) {
|
|
4826
|
-
return new
|
|
4744
|
+
return new TimelineSender(timeline, options);
|
|
4827
4745
|
},
|
|
4828
4746
|
createHandshake(transport, callback) {
|
|
4829
|
-
return new
|
|
4747
|
+
return new Handshake(transport, callback);
|
|
4830
4748
|
},
|
|
4831
4749
|
createAssistantToTheTransportManager(manager, transport, options) {
|
|
4832
|
-
return new
|
|
4750
|
+
return new AssistantToTheTransportManager(manager, transport, options);
|
|
4833
4751
|
},
|
|
4834
4752
|
};
|
|
4835
|
-
/* harmony default export */
|
|
4753
|
+
/* harmony default export */ const factory = (Factory);
|
|
4836
4754
|
|
|
4837
|
-
|
|
4755
|
+
;// ./src/core/transports/transport_manager.ts
|
|
4838
4756
|
|
|
4839
|
-
class
|
|
4757
|
+
class TransportManager {
|
|
4840
4758
|
constructor(options) {
|
|
4841
4759
|
this.options = options || {};
|
|
4842
4760
|
this.livesLeft = this.options.lives || Infinity;
|
|
@@ -4855,11 +4773,11 @@ class transport_manager_TransportManager {
|
|
|
4855
4773
|
}
|
|
4856
4774
|
}
|
|
4857
4775
|
|
|
4858
|
-
|
|
4776
|
+
;// ./src/core/strategies/sequential_strategy.ts
|
|
4859
4777
|
|
|
4860
4778
|
|
|
4861
4779
|
|
|
4862
|
-
class
|
|
4780
|
+
class SequentialStrategy {
|
|
4863
4781
|
constructor(strategies, options) {
|
|
4864
4782
|
this.strategies = strategies;
|
|
4865
4783
|
this.loop = Boolean(options.loop);
|
|
@@ -4915,7 +4833,7 @@ class sequential_strategy_SequentialStrategy {
|
|
|
4915
4833
|
var timer = null;
|
|
4916
4834
|
var runner = null;
|
|
4917
4835
|
if (options.timeout > 0) {
|
|
4918
|
-
timer = new
|
|
4836
|
+
timer = new OneOffTimer(options.timeout, function () {
|
|
4919
4837
|
runner.abort();
|
|
4920
4838
|
callback(true);
|
|
4921
4839
|
});
|
|
@@ -4943,10 +4861,10 @@ class sequential_strategy_SequentialStrategy {
|
|
|
4943
4861
|
}
|
|
4944
4862
|
}
|
|
4945
4863
|
|
|
4946
|
-
|
|
4864
|
+
;// ./src/core/strategies/best_connected_ever_strategy.ts
|
|
4947
4865
|
|
|
4948
4866
|
|
|
4949
|
-
class
|
|
4867
|
+
class BestConnectedEverStrategy {
|
|
4950
4868
|
constructor(strategies) {
|
|
4951
4869
|
this.strategies = strategies;
|
|
4952
4870
|
}
|
|
@@ -4998,12 +4916,12 @@ function abortRunner(runner) {
|
|
|
4998
4916
|
}
|
|
4999
4917
|
}
|
|
5000
4918
|
|
|
5001
|
-
|
|
4919
|
+
;// ./src/core/strategies/websocket_prioritized_cached_strategy.ts
|
|
5002
4920
|
|
|
5003
4921
|
|
|
5004
4922
|
|
|
5005
4923
|
|
|
5006
|
-
class
|
|
4924
|
+
class WebSocketPrioritizedCachedStrategy {
|
|
5007
4925
|
constructor(strategy, transports, options) {
|
|
5008
4926
|
this.strategy = strategy;
|
|
5009
4927
|
this.transports = transports;
|
|
@@ -5028,7 +4946,7 @@ class websocket_prioritized_cached_strategy_WebSocketPrioritizedCachedStrategy {
|
|
|
5028
4946
|
transport: info.transport,
|
|
5029
4947
|
latency: info.latency,
|
|
5030
4948
|
});
|
|
5031
|
-
strategies.push(new
|
|
4949
|
+
strategies.push(new SequentialStrategy([transport], {
|
|
5032
4950
|
timeout: info.latency * 2 + 1000,
|
|
5033
4951
|
failFast: true,
|
|
5034
4952
|
}));
|
|
@@ -5114,9 +5032,9 @@ function flushTransportCache(usingTLS) {
|
|
|
5114
5032
|
}
|
|
5115
5033
|
}
|
|
5116
5034
|
|
|
5117
|
-
|
|
5035
|
+
;// ./src/core/strategies/delayed_strategy.ts
|
|
5118
5036
|
|
|
5119
|
-
class
|
|
5037
|
+
class DelayedStrategy {
|
|
5120
5038
|
constructor(strategy, { delay: number }) {
|
|
5121
5039
|
this.strategy = strategy;
|
|
5122
5040
|
this.options = { delay: number };
|
|
@@ -5127,7 +5045,7 @@ class delayed_strategy_DelayedStrategy {
|
|
|
5127
5045
|
connect(minPriority, callback) {
|
|
5128
5046
|
var strategy = this.strategy;
|
|
5129
5047
|
var runner;
|
|
5130
|
-
var timer = new
|
|
5048
|
+
var timer = new OneOffTimer(this.options.delay, function () {
|
|
5131
5049
|
runner = strategy.connect(minPriority, callback);
|
|
5132
5050
|
});
|
|
5133
5051
|
return {
|
|
@@ -5147,7 +5065,7 @@ class delayed_strategy_DelayedStrategy {
|
|
|
5147
5065
|
}
|
|
5148
5066
|
}
|
|
5149
5067
|
|
|
5150
|
-
|
|
5068
|
+
;// ./src/core/strategies/if_strategy.ts
|
|
5151
5069
|
class IfStrategy {
|
|
5152
5070
|
constructor(test, trueBranch, falseBranch) {
|
|
5153
5071
|
this.test = test;
|
|
@@ -5164,7 +5082,7 @@ class IfStrategy {
|
|
|
5164
5082
|
}
|
|
5165
5083
|
}
|
|
5166
5084
|
|
|
5167
|
-
|
|
5085
|
+
;// ./src/core/strategies/first_connected_strategy.ts
|
|
5168
5086
|
class FirstConnectedStrategy {
|
|
5169
5087
|
constructor(strategy) {
|
|
5170
5088
|
this.strategy = strategy;
|
|
@@ -5183,7 +5101,7 @@ class FirstConnectedStrategy {
|
|
|
5183
5101
|
}
|
|
5184
5102
|
}
|
|
5185
5103
|
|
|
5186
|
-
|
|
5104
|
+
;// ./src/runtimes/isomorphic/default_strategy.ts
|
|
5187
5105
|
|
|
5188
5106
|
|
|
5189
5107
|
|
|
@@ -5222,11 +5140,11 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
|
|
5222
5140
|
timeout: 15000,
|
|
5223
5141
|
timeoutLimit: 60000,
|
|
5224
5142
|
};
|
|
5225
|
-
var ws_manager = new
|
|
5143
|
+
var ws_manager = new TransportManager({
|
|
5226
5144
|
minPingDelay: 10000,
|
|
5227
5145
|
maxPingDelay: config.activityTimeout,
|
|
5228
5146
|
});
|
|
5229
|
-
var streaming_manager = new
|
|
5147
|
+
var streaming_manager = new TransportManager({
|
|
5230
5148
|
lives: 2,
|
|
5231
5149
|
minPingDelay: 10000,
|
|
5232
5150
|
maxPingDelay: config.activityTimeout,
|
|
@@ -5235,40 +5153,40 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
|
|
5235
5153
|
var wss_transport = defineTransportStrategy('wss', 'ws', 3, wss_options, ws_manager);
|
|
5236
5154
|
var xhr_streaming_transport = defineTransportStrategy('xhr_streaming', 'xhr_streaming', 1, http_options, streaming_manager);
|
|
5237
5155
|
var xhr_polling_transport = defineTransportStrategy('xhr_polling', 'xhr_polling', 1, http_options);
|
|
5238
|
-
var ws_loop = new
|
|
5239
|
-
var wss_loop = new
|
|
5240
|
-
var streaming_loop = new
|
|
5241
|
-
var polling_loop = new
|
|
5242
|
-
var http_loop = new
|
|
5243
|
-
new IfStrategy(testSupportsStrategy(streaming_loop), new
|
|
5156
|
+
var ws_loop = new SequentialStrategy([ws_transport], timeouts);
|
|
5157
|
+
var wss_loop = new SequentialStrategy([wss_transport], timeouts);
|
|
5158
|
+
var streaming_loop = new SequentialStrategy([xhr_streaming_transport], timeouts);
|
|
5159
|
+
var polling_loop = new SequentialStrategy([xhr_polling_transport], timeouts);
|
|
5160
|
+
var http_loop = new SequentialStrategy([
|
|
5161
|
+
new IfStrategy(testSupportsStrategy(streaming_loop), new BestConnectedEverStrategy([
|
|
5244
5162
|
streaming_loop,
|
|
5245
|
-
new
|
|
5163
|
+
new DelayedStrategy(polling_loop, { delay: 4000 }),
|
|
5246
5164
|
]), polling_loop),
|
|
5247
5165
|
], timeouts);
|
|
5248
5166
|
var wsStrategy;
|
|
5249
5167
|
if (baseOptions.useTLS) {
|
|
5250
|
-
wsStrategy = new
|
|
5168
|
+
wsStrategy = new BestConnectedEverStrategy([
|
|
5251
5169
|
ws_loop,
|
|
5252
|
-
new
|
|
5170
|
+
new DelayedStrategy(http_loop, { delay: 2000 }),
|
|
5253
5171
|
]);
|
|
5254
5172
|
}
|
|
5255
5173
|
else {
|
|
5256
|
-
wsStrategy = new
|
|
5174
|
+
wsStrategy = new BestConnectedEverStrategy([
|
|
5257
5175
|
ws_loop,
|
|
5258
|
-
new
|
|
5259
|
-
new
|
|
5176
|
+
new DelayedStrategy(wss_loop, { delay: 2000 }),
|
|
5177
|
+
new DelayedStrategy(http_loop, { delay: 5000 }),
|
|
5260
5178
|
]);
|
|
5261
5179
|
}
|
|
5262
|
-
return new
|
|
5180
|
+
return new WebSocketPrioritizedCachedStrategy(new FirstConnectedStrategy(new IfStrategy(testSupportsStrategy(ws_transport), wsStrategy, http_loop)), definedTransports, {
|
|
5263
5181
|
ttl: 1800000,
|
|
5264
5182
|
timeline: baseOptions.timeline,
|
|
5265
5183
|
useTLS: baseOptions.useTLS,
|
|
5266
5184
|
});
|
|
5267
5185
|
};
|
|
5268
|
-
/* harmony default export */
|
|
5186
|
+
/* harmony default export */ const default_strategy = (getDefaultStrategy);
|
|
5269
5187
|
|
|
5270
|
-
|
|
5271
|
-
/* harmony default export */
|
|
5188
|
+
;// ./src/runtimes/isomorphic/transports/transport_connection_initializer.ts
|
|
5189
|
+
/* harmony default export */ function transport_connection_initializer() {
|
|
5272
5190
|
var self = this;
|
|
5273
5191
|
self.timeline.info(self.buildTimelineMessage({
|
|
5274
5192
|
transport: self.name + (self.options.useTLS ? 's' : ''),
|
|
@@ -5279,13 +5197,13 @@ var getDefaultStrategy = function (config, baseOptions, defineTransport) {
|
|
|
5279
5197
|
else {
|
|
5280
5198
|
self.onClose();
|
|
5281
5199
|
}
|
|
5282
|
-
}
|
|
5200
|
+
}
|
|
5283
5201
|
|
|
5284
|
-
|
|
5202
|
+
;// ./src/core/http/http_request.ts
|
|
5285
5203
|
|
|
5286
5204
|
|
|
5287
5205
|
const MAX_BUFFER_LENGTH = 256 * 1024;
|
|
5288
|
-
class
|
|
5206
|
+
class HTTPRequest extends Dispatcher {
|
|
5289
5207
|
constructor(hooks, method, url) {
|
|
5290
5208
|
super();
|
|
5291
5209
|
this.hooks = hooks;
|
|
@@ -5345,21 +5263,21 @@ class http_request_HTTPRequest extends dispatcher_Dispatcher {
|
|
|
5345
5263
|
}
|
|
5346
5264
|
}
|
|
5347
5265
|
|
|
5348
|
-
|
|
5266
|
+
;// ./src/core/http/state.ts
|
|
5349
5267
|
var State;
|
|
5350
5268
|
(function (State) {
|
|
5351
5269
|
State[State["CONNECTING"] = 0] = "CONNECTING";
|
|
5352
5270
|
State[State["OPEN"] = 1] = "OPEN";
|
|
5353
5271
|
State[State["CLOSED"] = 3] = "CLOSED";
|
|
5354
5272
|
})(State || (State = {}));
|
|
5355
|
-
/* harmony default export */
|
|
5273
|
+
/* harmony default export */ const state = (State);
|
|
5356
5274
|
|
|
5357
|
-
|
|
5275
|
+
;// ./src/core/http/http_socket.ts
|
|
5358
5276
|
|
|
5359
5277
|
|
|
5360
5278
|
|
|
5361
5279
|
var autoIncrement = 1;
|
|
5362
|
-
class
|
|
5280
|
+
class HTTPSocket {
|
|
5363
5281
|
constructor(hooks, url) {
|
|
5364
5282
|
this.hooks = hooks;
|
|
5365
5283
|
this.session = randomNumber(1000) + '/' + randomString(8);
|
|
@@ -5524,10 +5442,10 @@ function randomString(length) {
|
|
|
5524
5442
|
}
|
|
5525
5443
|
return result.join('');
|
|
5526
5444
|
}
|
|
5527
|
-
/* harmony default export */
|
|
5445
|
+
/* harmony default export */ const http_socket = (HTTPSocket);
|
|
5528
5446
|
|
|
5529
|
-
|
|
5530
|
-
var
|
|
5447
|
+
;// ./src/core/http/http_streaming_socket.ts
|
|
5448
|
+
var hooks = {
|
|
5531
5449
|
getReceiveURL: function (url, session) {
|
|
5532
5450
|
return url.base + '/' + session + '/xhr_streaming' + url.queryString;
|
|
5533
5451
|
},
|
|
@@ -5541,9 +5459,9 @@ var http_streaming_socket_hooks = {
|
|
|
5541
5459
|
socket.onClose(1006, 'Connection interrupted (' + status + ')', false);
|
|
5542
5460
|
},
|
|
5543
5461
|
};
|
|
5544
|
-
/* harmony default export */
|
|
5462
|
+
/* harmony default export */ const http_streaming_socket = (hooks);
|
|
5545
5463
|
|
|
5546
|
-
|
|
5464
|
+
;// ./src/core/http/http_polling_socket.ts
|
|
5547
5465
|
var http_polling_socket_hooks = {
|
|
5548
5466
|
getReceiveURL: function (url, session) {
|
|
5549
5467
|
return url.base + '/' + session + '/xhr' + url.queryString;
|
|
@@ -5562,9 +5480,9 @@ var http_polling_socket_hooks = {
|
|
|
5562
5480
|
}
|
|
5563
5481
|
},
|
|
5564
5482
|
};
|
|
5565
|
-
/* harmony default export */
|
|
5483
|
+
/* harmony default export */ const http_polling_socket = (http_polling_socket_hooks);
|
|
5566
5484
|
|
|
5567
|
-
|
|
5485
|
+
;// ./src/runtimes/isomorphic/http/http_xhr_request.ts
|
|
5568
5486
|
|
|
5569
5487
|
var http_xhr_request_hooks = {
|
|
5570
5488
|
getRequest: function (socket) {
|
|
@@ -5593,9 +5511,9 @@ var http_xhr_request_hooks = {
|
|
|
5593
5511
|
xhr.abort();
|
|
5594
5512
|
},
|
|
5595
5513
|
};
|
|
5596
|
-
/* harmony default export */
|
|
5514
|
+
/* harmony default export */ const http_xhr_request = (http_xhr_request_hooks);
|
|
5597
5515
|
|
|
5598
|
-
|
|
5516
|
+
;// ./src/runtimes/isomorphic/http/http.ts
|
|
5599
5517
|
|
|
5600
5518
|
|
|
5601
5519
|
|
|
@@ -5615,12 +5533,12 @@ var HTTP = {
|
|
|
5615
5533
|
return this.createRequest(http_xhr_request, method, url);
|
|
5616
5534
|
},
|
|
5617
5535
|
createRequest(hooks, method, url) {
|
|
5618
|
-
return new
|
|
5536
|
+
return new HTTPRequest(hooks, method, url);
|
|
5619
5537
|
},
|
|
5620
5538
|
};
|
|
5621
|
-
/* harmony default export */
|
|
5539
|
+
/* harmony default export */ const http_http = (HTTP);
|
|
5622
5540
|
|
|
5623
|
-
|
|
5541
|
+
;// ./src/runtimes/isomorphic/runtime.ts
|
|
5624
5542
|
|
|
5625
5543
|
|
|
5626
5544
|
|
|
@@ -5667,18 +5585,18 @@ var Isomorphic = {
|
|
|
5667
5585
|
addUnloadListener(listener) { },
|
|
5668
5586
|
removeUnloadListener(listener) { },
|
|
5669
5587
|
};
|
|
5670
|
-
/* harmony default export */
|
|
5588
|
+
/* harmony default export */ const runtime = (Isomorphic);
|
|
5671
5589
|
|
|
5672
|
-
|
|
5590
|
+
;// ./src/runtimes/worker/net_info.ts
|
|
5673
5591
|
|
|
5674
|
-
class
|
|
5592
|
+
class NetInfo extends Dispatcher {
|
|
5675
5593
|
isOnline() {
|
|
5676
5594
|
return true;
|
|
5677
5595
|
}
|
|
5678
5596
|
}
|
|
5679
|
-
var
|
|
5597
|
+
var Network = new NetInfo();
|
|
5680
5598
|
|
|
5681
|
-
|
|
5599
|
+
;// ./src/runtimes/worker/auth/fetch_auth.ts
|
|
5682
5600
|
|
|
5683
5601
|
var fetchAuth = function (context, query, authOptions, authRequestType, callback) {
|
|
5684
5602
|
var headers = new Headers();
|
|
@@ -5721,9 +5639,9 @@ var fetchAuth = function (context, query, authOptions, authRequestType, callback
|
|
|
5721
5639
|
callback(err, null);
|
|
5722
5640
|
});
|
|
5723
5641
|
};
|
|
5724
|
-
/* harmony default export */
|
|
5642
|
+
/* harmony default export */ const fetch_auth = (fetchAuth);
|
|
5725
5643
|
|
|
5726
|
-
|
|
5644
|
+
;// ./src/runtimes/worker/timeline/fetch_timeline.ts
|
|
5727
5645
|
|
|
5728
5646
|
|
|
5729
5647
|
var getAgent = function (sender, useTLS) {
|
|
@@ -5753,9 +5671,9 @@ var fetchTimeline = {
|
|
|
5753
5671
|
name: 'xhr',
|
|
5754
5672
|
getAgent,
|
|
5755
5673
|
};
|
|
5756
|
-
/* harmony default export */
|
|
5674
|
+
/* harmony default export */ const fetch_timeline = (fetchTimeline);
|
|
5757
5675
|
|
|
5758
|
-
|
|
5676
|
+
;// ./src/runtimes/worker/runtime.ts
|
|
5759
5677
|
|
|
5760
5678
|
|
|
5761
5679
|
|
|
@@ -5786,7 +5704,7 @@ const Worker = {
|
|
|
5786
5704
|
return XMLHttpRequest;
|
|
5787
5705
|
},
|
|
5788
5706
|
getNetwork() {
|
|
5789
|
-
return
|
|
5707
|
+
return Network;
|
|
5790
5708
|
},
|
|
5791
5709
|
randomInt(max) {
|
|
5792
5710
|
const random = function () {
|
|
@@ -5797,22 +5715,22 @@ const Worker = {
|
|
|
5797
5715
|
return Math.floor(random() * max);
|
|
5798
5716
|
},
|
|
5799
5717
|
};
|
|
5800
|
-
/* harmony default export */
|
|
5718
|
+
/* harmony default export */ const worker_runtime = (Worker);
|
|
5801
5719
|
|
|
5802
|
-
|
|
5720
|
+
;// ./src/core/timeline/level.ts
|
|
5803
5721
|
var TimelineLevel;
|
|
5804
5722
|
(function (TimelineLevel) {
|
|
5805
5723
|
TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
|
|
5806
5724
|
TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
|
|
5807
5725
|
TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
|
|
5808
5726
|
})(TimelineLevel || (TimelineLevel = {}));
|
|
5809
|
-
/* harmony default export */
|
|
5727
|
+
/* harmony default export */ const level = (TimelineLevel);
|
|
5810
5728
|
|
|
5811
|
-
|
|
5729
|
+
;// ./src/core/timeline/timeline.ts
|
|
5812
5730
|
|
|
5813
5731
|
|
|
5814
5732
|
|
|
5815
|
-
class
|
|
5733
|
+
class Timeline {
|
|
5816
5734
|
constructor(key, session, options) {
|
|
5817
5735
|
this.key = key;
|
|
5818
5736
|
this.session = session;
|
|
@@ -5830,13 +5748,13 @@ class timeline_Timeline {
|
|
|
5830
5748
|
}
|
|
5831
5749
|
}
|
|
5832
5750
|
error(event) {
|
|
5833
|
-
this.log(
|
|
5751
|
+
this.log(level.ERROR, event);
|
|
5834
5752
|
}
|
|
5835
5753
|
info(event) {
|
|
5836
|
-
this.log(
|
|
5754
|
+
this.log(level.INFO, event);
|
|
5837
5755
|
}
|
|
5838
5756
|
debug(event) {
|
|
5839
|
-
this.log(
|
|
5757
|
+
this.log(level.DEBUG, event);
|
|
5840
5758
|
}
|
|
5841
5759
|
isEmpty() {
|
|
5842
5760
|
return this.events.length === 0;
|
|
@@ -5869,12 +5787,12 @@ class timeline_Timeline {
|
|
|
5869
5787
|
}
|
|
5870
5788
|
}
|
|
5871
5789
|
|
|
5872
|
-
|
|
5790
|
+
;// ./src/core/strategies/transport_strategy.ts
|
|
5873
5791
|
|
|
5874
5792
|
|
|
5875
5793
|
|
|
5876
5794
|
|
|
5877
|
-
class
|
|
5795
|
+
class TransportStrategy {
|
|
5878
5796
|
constructor(name, priority, transport, options) {
|
|
5879
5797
|
this.name = name;
|
|
5880
5798
|
this.priority = priority;
|
|
@@ -5967,14 +5885,14 @@ function failAttempt(error, callback) {
|
|
|
5967
5885
|
};
|
|
5968
5886
|
}
|
|
5969
5887
|
|
|
5970
|
-
|
|
5888
|
+
;// ./src/core/strategies/strategy_builder.ts
|
|
5971
5889
|
|
|
5972
5890
|
|
|
5973
5891
|
|
|
5974
5892
|
|
|
5975
5893
|
|
|
5976
5894
|
const { Transports: strategy_builder_Transports } = worker_runtime;
|
|
5977
|
-
var
|
|
5895
|
+
var defineTransport = function (config, name, type, priority, options, manager) {
|
|
5978
5896
|
var transportClass = strategy_builder_Transports[type];
|
|
5979
5897
|
if (!transportClass) {
|
|
5980
5898
|
throw new UnsupportedTransport(type);
|
|
@@ -5986,7 +5904,7 @@ var strategy_builder_defineTransport = function (config, name, type, priority, o
|
|
|
5986
5904
|
var transport;
|
|
5987
5905
|
if (enabled) {
|
|
5988
5906
|
options = Object.assign({ ignoreNullOrigin: config.ignoreNullOrigin }, options);
|
|
5989
|
-
transport = new
|
|
5907
|
+
transport = new TransportStrategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, options);
|
|
5990
5908
|
}
|
|
5991
5909
|
else {
|
|
5992
5910
|
transport = strategy_builder_UnsupportedStrategy;
|
|
@@ -6010,7 +5928,7 @@ var strategy_builder_UnsupportedStrategy = {
|
|
|
6010
5928
|
},
|
|
6011
5929
|
};
|
|
6012
5930
|
|
|
6013
|
-
|
|
5931
|
+
;// ./src/core/options.ts
|
|
6014
5932
|
|
|
6015
5933
|
function validateOptions(options) {
|
|
6016
5934
|
if (options == null) {
|
|
@@ -6024,14 +5942,14 @@ function validateOptions(options) {
|
|
|
6024
5942
|
}
|
|
6025
5943
|
}
|
|
6026
5944
|
|
|
6027
|
-
|
|
5945
|
+
;// ./src/core/auth/options.ts
|
|
6028
5946
|
var AuthRequestType;
|
|
6029
5947
|
(function (AuthRequestType) {
|
|
6030
5948
|
AuthRequestType["UserAuthentication"] = "user-authentication";
|
|
6031
5949
|
AuthRequestType["ChannelAuthorization"] = "channel-authorization";
|
|
6032
5950
|
})(AuthRequestType || (AuthRequestType = {}));
|
|
6033
5951
|
|
|
6034
|
-
|
|
5952
|
+
;// ./src/core/auth/user_authenticator.ts
|
|
6035
5953
|
|
|
6036
5954
|
|
|
6037
5955
|
const composeChannelQuery = (params, authOptions) => {
|
|
@@ -6064,9 +5982,9 @@ const UserAuthenticator = (authOptions) => {
|
|
|
6064
5982
|
worker_runtime.getAuthorizers()[authOptions.transport](worker_runtime, query, authOptions, AuthRequestType.UserAuthentication, callback);
|
|
6065
5983
|
};
|
|
6066
5984
|
};
|
|
6067
|
-
/* harmony default export */
|
|
5985
|
+
/* harmony default export */ const user_authenticator = (UserAuthenticator);
|
|
6068
5986
|
|
|
6069
|
-
|
|
5987
|
+
;// ./src/core/auth/channel_authorizer.ts
|
|
6070
5988
|
|
|
6071
5989
|
|
|
6072
5990
|
const channel_authorizer_composeChannelQuery = (params, authOptions) => {
|
|
@@ -6100,9 +6018,9 @@ const ChannelAuthorizer = (authOptions) => {
|
|
|
6100
6018
|
worker_runtime.getAuthorizers()[authOptions.transport](worker_runtime, query, authOptions, AuthRequestType.ChannelAuthorization, callback);
|
|
6101
6019
|
};
|
|
6102
6020
|
};
|
|
6103
|
-
/* harmony default export */
|
|
6021
|
+
/* harmony default export */ const channel_authorizer = (ChannelAuthorizer);
|
|
6104
6022
|
|
|
6105
|
-
|
|
6023
|
+
;// ./src/core/auth/deprecated_channel_authorizer.ts
|
|
6106
6024
|
const ChannelAuthorizerProxy = (pusher, authOptions, channelAuthorizerGenerator) => {
|
|
6107
6025
|
const deprecatedAuthorizerOptions = {
|
|
6108
6026
|
authTransport: authOptions.transport,
|
|
@@ -6119,7 +6037,7 @@ const ChannelAuthorizerProxy = (pusher, authOptions, channelAuthorizerGenerator)
|
|
|
6119
6037
|
};
|
|
6120
6038
|
};
|
|
6121
6039
|
|
|
6122
|
-
|
|
6040
|
+
;// ./src/core/config.ts
|
|
6123
6041
|
|
|
6124
6042
|
|
|
6125
6043
|
|
|
@@ -6194,10 +6112,12 @@ function getEnableStatsConfig(opts) {
|
|
|
6194
6112
|
}
|
|
6195
6113
|
return false;
|
|
6196
6114
|
}
|
|
6115
|
+
const hasCustomHandler = (auth) => {
|
|
6116
|
+
return 'customHandler' in auth && auth['customHandler'] != null;
|
|
6117
|
+
};
|
|
6197
6118
|
function buildUserAuthenticator(opts) {
|
|
6198
6119
|
const userAuthentication = Object.assign(Object.assign({}, defaults.userAuthentication), opts.userAuthentication);
|
|
6199
|
-
if (
|
|
6200
|
-
userAuthentication['customHandler'] != null) {
|
|
6120
|
+
if (hasCustomHandler(userAuthentication)) {
|
|
6201
6121
|
return userAuthentication['customHandler'];
|
|
6202
6122
|
}
|
|
6203
6123
|
return user_authenticator(userAuthentication);
|
|
@@ -6218,24 +6138,26 @@ function buildChannelAuth(opts, pusher) {
|
|
|
6218
6138
|
if ('headers' in opts.auth)
|
|
6219
6139
|
channelAuthorization.headers = opts.auth.headers;
|
|
6220
6140
|
}
|
|
6221
|
-
if ('authorizer' in opts)
|
|
6222
|
-
|
|
6141
|
+
if ('authorizer' in opts) {
|
|
6142
|
+
return {
|
|
6143
|
+
customHandler: ChannelAuthorizerProxy(pusher, channelAuthorization, opts.authorizer),
|
|
6144
|
+
};
|
|
6145
|
+
}
|
|
6223
6146
|
}
|
|
6224
6147
|
return channelAuthorization;
|
|
6225
6148
|
}
|
|
6226
6149
|
function buildChannelAuthorizer(opts, pusher) {
|
|
6227
6150
|
const channelAuthorization = buildChannelAuth(opts, pusher);
|
|
6228
|
-
if (
|
|
6229
|
-
channelAuthorization['customHandler'] != null) {
|
|
6151
|
+
if (hasCustomHandler(channelAuthorization)) {
|
|
6230
6152
|
return channelAuthorization['customHandler'];
|
|
6231
6153
|
}
|
|
6232
6154
|
return channel_authorizer(channelAuthorization);
|
|
6233
6155
|
}
|
|
6234
6156
|
|
|
6235
|
-
|
|
6157
|
+
;// ./src/core/watchlist.ts
|
|
6236
6158
|
|
|
6237
6159
|
|
|
6238
|
-
class
|
|
6160
|
+
class WatchlistFacade extends Dispatcher {
|
|
6239
6161
|
constructor(pusher) {
|
|
6240
6162
|
super(function (eventName, data) {
|
|
6241
6163
|
logger.debug(`No callbacks on watchlist events for ${eventName}`);
|
|
@@ -6258,7 +6180,7 @@ class watchlist_WatchlistFacade extends dispatcher_Dispatcher {
|
|
|
6258
6180
|
}
|
|
6259
6181
|
}
|
|
6260
6182
|
|
|
6261
|
-
|
|
6183
|
+
;// ./src/core/utils/flat_promise.ts
|
|
6262
6184
|
function flatPromise() {
|
|
6263
6185
|
let resolve, reject;
|
|
6264
6186
|
const promise = new Promise((res, rej) => {
|
|
@@ -6267,15 +6189,15 @@ function flatPromise() {
|
|
|
6267
6189
|
});
|
|
6268
6190
|
return { promise, resolve, reject };
|
|
6269
6191
|
}
|
|
6270
|
-
/* harmony default export */
|
|
6192
|
+
/* harmony default export */ const flat_promise = (flatPromise);
|
|
6271
6193
|
|
|
6272
|
-
|
|
6194
|
+
;// ./src/core/user.ts
|
|
6273
6195
|
|
|
6274
6196
|
|
|
6275
6197
|
|
|
6276
6198
|
|
|
6277
6199
|
|
|
6278
|
-
class
|
|
6200
|
+
class UserFacade extends Dispatcher {
|
|
6279
6201
|
constructor(pusher) {
|
|
6280
6202
|
super(function (eventName, data) {
|
|
6281
6203
|
logger.debug('No callbacks on user for ' + eventName);
|
|
@@ -6306,7 +6228,7 @@ class user_UserFacade extends dispatcher_Dispatcher {
|
|
|
6306
6228
|
this._newSigninPromiseIfNeeded();
|
|
6307
6229
|
}
|
|
6308
6230
|
});
|
|
6309
|
-
this.watchlist = new
|
|
6231
|
+
this.watchlist = new WatchlistFacade(pusher);
|
|
6310
6232
|
this.pusher.connection.bind('message', (event) => {
|
|
6311
6233
|
var eventName = event.event;
|
|
6312
6234
|
if (eventName === 'pusher:signin_success') {
|
|
@@ -6364,7 +6286,7 @@ class user_UserFacade extends dispatcher_Dispatcher {
|
|
|
6364
6286
|
channel.subscribe();
|
|
6365
6287
|
}
|
|
6366
6288
|
};
|
|
6367
|
-
this.serverToUserChannel = new
|
|
6289
|
+
this.serverToUserChannel = new Channel(`#server-to-user-${this.user_data.id}`, this.pusher);
|
|
6368
6290
|
this.serverToUserChannel.bind_global((eventName, data) => {
|
|
6369
6291
|
if (eventName.indexOf('pusher_internal:') === 0 ||
|
|
6370
6292
|
eventName.indexOf('pusher:') === 0) {
|
|
@@ -6403,7 +6325,7 @@ class user_UserFacade extends dispatcher_Dispatcher {
|
|
|
6403
6325
|
}
|
|
6404
6326
|
}
|
|
6405
6327
|
|
|
6406
|
-
|
|
6328
|
+
;// ./src/core/pusher.ts
|
|
6407
6329
|
|
|
6408
6330
|
|
|
6409
6331
|
|
|
@@ -6417,11 +6339,11 @@ class user_UserFacade extends dispatcher_Dispatcher {
|
|
|
6417
6339
|
|
|
6418
6340
|
|
|
6419
6341
|
|
|
6420
|
-
class
|
|
6342
|
+
class Pusher {
|
|
6421
6343
|
static ready() {
|
|
6422
|
-
|
|
6423
|
-
for (var i = 0, l =
|
|
6424
|
-
|
|
6344
|
+
Pusher.isReady = true;
|
|
6345
|
+
for (var i = 0, l = Pusher.instances.length; i < l; i++) {
|
|
6346
|
+
Pusher.instances[i].connect();
|
|
6425
6347
|
}
|
|
6426
6348
|
}
|
|
6427
6349
|
static getClientFeatures() {
|
|
@@ -6433,16 +6355,17 @@ class pusher_Pusher {
|
|
|
6433
6355
|
checkAppKey(app_key);
|
|
6434
6356
|
validateOptions(options);
|
|
6435
6357
|
this.key = app_key;
|
|
6436
|
-
this.
|
|
6358
|
+
this.options = options;
|
|
6359
|
+
this.config = getConfig(this.options, this);
|
|
6437
6360
|
this.channels = factory.createChannels();
|
|
6438
|
-
this.global_emitter = new
|
|
6361
|
+
this.global_emitter = new Dispatcher();
|
|
6439
6362
|
this.sessionID = worker_runtime.randomInt(1000000000);
|
|
6440
|
-
this.timeline = new
|
|
6363
|
+
this.timeline = new Timeline(this.key, this.sessionID, {
|
|
6441
6364
|
cluster: this.config.cluster,
|
|
6442
|
-
features:
|
|
6365
|
+
features: Pusher.getClientFeatures(),
|
|
6443
6366
|
params: this.config.timelineParams || {},
|
|
6444
6367
|
limit: 50,
|
|
6445
|
-
level:
|
|
6368
|
+
level: level.INFO,
|
|
6446
6369
|
version: defaults.VERSION,
|
|
6447
6370
|
});
|
|
6448
6371
|
if (this.config.enableStats) {
|
|
@@ -6452,7 +6375,7 @@ class pusher_Pusher {
|
|
|
6452
6375
|
});
|
|
6453
6376
|
}
|
|
6454
6377
|
var getStrategy = (options) => {
|
|
6455
|
-
return worker_runtime.getDefaultStrategy(this.config, options,
|
|
6378
|
+
return worker_runtime.getDefaultStrategy(this.config, options, defineTransport);
|
|
6456
6379
|
};
|
|
6457
6380
|
this.connection = factory.createConnectionManager(this.key, {
|
|
6458
6381
|
getStrategy: getStrategy,
|
|
@@ -6490,13 +6413,20 @@ class pusher_Pusher {
|
|
|
6490
6413
|
this.connection.bind('error', (err) => {
|
|
6491
6414
|
logger.warn(err);
|
|
6492
6415
|
});
|
|
6493
|
-
|
|
6494
|
-
this.timeline.info({ instances:
|
|
6495
|
-
this.user = new
|
|
6496
|
-
if (
|
|
6416
|
+
Pusher.instances.push(this);
|
|
6417
|
+
this.timeline.info({ instances: Pusher.instances.length });
|
|
6418
|
+
this.user = new UserFacade(this);
|
|
6419
|
+
if (Pusher.isReady) {
|
|
6497
6420
|
this.connect();
|
|
6498
6421
|
}
|
|
6499
6422
|
}
|
|
6423
|
+
switchCluster(options) {
|
|
6424
|
+
const { appKey, cluster } = options;
|
|
6425
|
+
this.key = appKey;
|
|
6426
|
+
this.options = Object.assign(Object.assign({}, this.options), { cluster });
|
|
6427
|
+
this.config = getConfig(this.options, this);
|
|
6428
|
+
this.connection.switchCluster(this.key);
|
|
6429
|
+
}
|
|
6500
6430
|
channel(name) {
|
|
6501
6431
|
return this.channels.find(name);
|
|
6502
6432
|
}
|
|
@@ -6509,7 +6439,7 @@ class pusher_Pusher {
|
|
|
6509
6439
|
if (!this.timelineSenderTimer) {
|
|
6510
6440
|
var usingTLS = this.connection.isUsingTLS();
|
|
6511
6441
|
var timelineSender = this.timelineSender;
|
|
6512
|
-
this.timelineSenderTimer = new
|
|
6442
|
+
this.timelineSenderTimer = new PeriodicTimer(60000, function () {
|
|
6513
6443
|
timelineSender.send(usingTLS);
|
|
6514
6444
|
});
|
|
6515
6445
|
}
|
|
@@ -6583,32 +6513,31 @@ class pusher_Pusher {
|
|
|
6583
6513
|
this.user.signin();
|
|
6584
6514
|
}
|
|
6585
6515
|
}
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
/* harmony default export */
|
|
6516
|
+
Pusher.instances = [];
|
|
6517
|
+
Pusher.isReady = false;
|
|
6518
|
+
Pusher.logToConsole = false;
|
|
6519
|
+
Pusher.Runtime = worker_runtime;
|
|
6520
|
+
Pusher.ScriptReceivers = worker_runtime.ScriptReceivers;
|
|
6521
|
+
Pusher.DependenciesReceivers = worker_runtime.DependenciesReceivers;
|
|
6522
|
+
Pusher.auth_callbacks = worker_runtime.auth_callbacks;
|
|
6523
|
+
/* harmony default export */ const pusher = (Pusher);
|
|
6594
6524
|
function checkAppKey(key) {
|
|
6595
6525
|
if (key === null || key === undefined) {
|
|
6596
6526
|
throw 'You must pass your app key when you instantiate Pusher.';
|
|
6597
6527
|
}
|
|
6598
6528
|
}
|
|
6599
|
-
worker_runtime.setup(
|
|
6529
|
+
worker_runtime.setup(Pusher);
|
|
6600
6530
|
|
|
6601
6531
|
// EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
|
|
6602
|
-
var nacl_fast = __webpack_require__(
|
|
6532
|
+
var nacl_fast = __webpack_require__(601);
|
|
6533
|
+
;// ./src/core/pusher-with-encryption.ts
|
|
6603
6534
|
|
|
6604
|
-
// CONCATENATED MODULE: ./src/core/pusher-with-encryption.ts
|
|
6605
6535
|
|
|
6606
6536
|
|
|
6607
|
-
|
|
6608
|
-
class pusher_with_encryption_PusherWithEncryption extends core_pusher {
|
|
6537
|
+
class PusherWithEncryption extends pusher {
|
|
6609
6538
|
constructor(app_key, options) {
|
|
6610
|
-
|
|
6611
|
-
|
|
6539
|
+
pusher.logToConsole = PusherWithEncryption.logToConsole;
|
|
6540
|
+
pusher.log = PusherWithEncryption.log;
|
|
6612
6541
|
validateOptions(options);
|
|
6613
6542
|
options.nacl = nacl_fast;
|
|
6614
6543
|
super(app_key, options);
|
|
@@ -6616,7 +6545,68 @@ class pusher_with_encryption_PusherWithEncryption extends core_pusher {
|
|
|
6616
6545
|
}
|
|
6617
6546
|
|
|
6618
6547
|
|
|
6619
|
-
/***/ }
|
|
6620
|
-
|
|
6548
|
+
/***/ },
|
|
6549
|
+
|
|
6550
|
+
/***/ 281
|
|
6551
|
+
() {
|
|
6552
|
+
|
|
6553
|
+
/* (ignored) */
|
|
6554
|
+
|
|
6555
|
+
/***/ }
|
|
6556
|
+
|
|
6557
|
+
/******/ });
|
|
6558
|
+
/************************************************************************/
|
|
6559
|
+
/******/ // The module cache
|
|
6560
|
+
/******/ var __webpack_module_cache__ = {};
|
|
6561
|
+
/******/
|
|
6562
|
+
/******/ // The require function
|
|
6563
|
+
/******/ function __webpack_require__(moduleId) {
|
|
6564
|
+
/******/ // Check if module is in cache
|
|
6565
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
6566
|
+
/******/ if (cachedModule !== undefined) {
|
|
6567
|
+
/******/ return cachedModule.exports;
|
|
6568
|
+
/******/ }
|
|
6569
|
+
/******/ // Create a new module (and put it into the cache)
|
|
6570
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
6571
|
+
/******/ // no module.id needed
|
|
6572
|
+
/******/ // no module.loaded needed
|
|
6573
|
+
/******/ exports: {}
|
|
6574
|
+
/******/ };
|
|
6575
|
+
/******/
|
|
6576
|
+
/******/ // Execute the module function
|
|
6577
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
6578
|
+
/******/
|
|
6579
|
+
/******/ // Return the exports of the module
|
|
6580
|
+
/******/ return module.exports;
|
|
6581
|
+
/******/ }
|
|
6582
|
+
/******/
|
|
6583
|
+
/************************************************************************/
|
|
6584
|
+
/******/ /* webpack/runtime/define property getters */
|
|
6585
|
+
/******/ (() => {
|
|
6586
|
+
/******/ // define getter functions for harmony exports
|
|
6587
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
6588
|
+
/******/ for(var key in definition) {
|
|
6589
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
6590
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
6591
|
+
/******/ }
|
|
6592
|
+
/******/ }
|
|
6593
|
+
/******/ };
|
|
6594
|
+
/******/ })();
|
|
6595
|
+
/******/
|
|
6596
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
6597
|
+
/******/ (() => {
|
|
6598
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
6599
|
+
/******/ })();
|
|
6600
|
+
/******/
|
|
6601
|
+
/************************************************************************/
|
|
6602
|
+
/******/
|
|
6603
|
+
/******/ // startup
|
|
6604
|
+
/******/ // Load entry module and return exports
|
|
6605
|
+
/******/ // This entry module used 'module' so it can't be inlined
|
|
6606
|
+
/******/ var __webpack_exports__ = __webpack_require__(42);
|
|
6607
|
+
/******/
|
|
6608
|
+
/******/ return __webpack_exports__;
|
|
6609
|
+
/******/ })()
|
|
6610
|
+
;
|
|
6621
6611
|
});
|
|
6622
6612
|
//# sourceMappingURL=pusher-with-encryption.worker.js.map
|