pusher-js 7.4.1 → 7.6.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_pr.yml +3 -1
- package/.github/workflows/run-tests.yml +27 -3
- package/CHANGELOG.md +8 -0
- package/Makefile +1 -0
- package/README.md +11 -3
- package/dist/node/pusher.js +139 -28
- package/dist/node/pusher.js.map +1 -1
- package/dist/react-native/pusher.js +5 -5
- package/dist/react-native/pusher.js.map +1 -1
- package/dist/web/pusher-with-encryption.js +83 -9
- package/dist/web/pusher-with-encryption.js.map +1 -1
- package/dist/web/pusher-with-encryption.min.js +2 -2
- package/dist/web/pusher-with-encryption.min.js.map +1 -1
- package/dist/web/pusher.js +83 -9
- package/dist/web/pusher.js.map +1 -1
- package/dist/web/pusher.min.js +2 -2
- package/dist/web/pusher.min.js.map +1 -1
- package/dist/worker/pusher-with-encryption.worker.js +81 -8
- package/dist/worker/pusher-with-encryption.worker.js.map +1 -1
- package/dist/worker/pusher-with-encryption.worker.min.js +2 -2
- package/dist/worker/pusher-with-encryption.worker.min.js.map +1 -1
- package/dist/worker/pusher.worker.js +81 -8
- package/dist/worker/pusher.worker.js.map +1 -1
- package/dist/worker/pusher.worker.min.js +2 -2
- package/dist/worker/pusher.worker.min.js.map +1 -1
- package/integration_tests_server/index.js +176 -0
- package/integration_tests_server/package-lock.json +1177 -0
- package/integration_tests_server/package.json +15 -0
- package/package.json +6 -5
- package/spec/config/karma/config.common.js +1 -2
- package/spec/javascripts/helpers/node/integration.js +2 -2
- package/spec/javascripts/helpers/web/integration.js +2 -2
- package/spec/javascripts/integration/core/cluster_config_spec.js +1 -1
- package/spec/javascripts/integration/core/pusher_spec/test_builder.js +13 -43
- package/spec/javascripts/integration/web/dom/jsonp_spec.js +2 -2
- package/spec/javascripts/unit/core/config_spec.js +91 -3
- package/spec/javascripts/unit/core/connection/connection_manager_spec.js +11 -1
- package/spec/javascripts/unit/core/http/http_request_spec.js +0 -6
- package/spec/javascripts/unit/core/transports/transport_connection_spec.js +5 -0
- package/spec/javascripts/unit/core/utils/timers_spec.js +0 -4
- package/spec/javascripts/unit/core/watchlist_spec.js +48 -0
- package/spec/javascripts/unit/core_with_runtime/auth/channel_authorizer_spec.js +82 -0
- package/spec/javascripts/unit/core_with_runtime/auth/user_authorizer_spec.js +76 -0
- package/spec/javascripts/unit/web/pusher_authorizer_spec.js +28 -0
- package/spec/javascripts/unit/worker/channel_authorizer_spec.js +46 -0
- package/src/core/auth/channel_authorizer.ts +14 -3
- package/src/core/auth/options.ts +4 -0
- package/src/core/auth/user_authenticator.ts +14 -3
- package/src/core/pusher.ts +0 -1
- package/src/core/user.ts +5 -0
- package/src/core/watchlist.ts +31 -0
- package/src/runtimes/isomorphic/auth/xhr_auth.ts +6 -0
- package/src/runtimes/web/auth/jsonp_auth.ts +4 -1
- package/src/runtimes/worker/auth/fetch_auth.ts +7 -0
- package/types/src/core/auth/options.d.ts +4 -0
- package/types/src/core/user.d.ts +2 -0
- package/types/src/core/watchlist.d.ts +8 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Pusher JavaScript Library v7.
|
|
2
|
+
* Pusher JavaScript Library v7.6.0
|
|
3
3
|
* https://pusher.com/
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2020, Pusher
|
|
@@ -3299,7 +3299,7 @@ function safeJSONStringify(source) {
|
|
|
3299
3299
|
|
|
3300
3300
|
// CONCATENATED MODULE: ./src/core/defaults.ts
|
|
3301
3301
|
var Defaults = {
|
|
3302
|
-
VERSION: "7.
|
|
3302
|
+
VERSION: "7.6.0",
|
|
3303
3303
|
PROTOCOL: 7,
|
|
3304
3304
|
wsPort: 80,
|
|
3305
3305
|
wssPort: 443,
|
|
@@ -6028,6 +6028,12 @@ var fetchAuth = function (context, query, authOptions, authRequestType, callback
|
|
|
6028
6028
|
for (var headerName in authOptions.headers) {
|
|
6029
6029
|
headers.set(headerName, authOptions.headers[headerName]);
|
|
6030
6030
|
}
|
|
6031
|
+
if (authOptions.headersProvider != null) {
|
|
6032
|
+
var dynamicHeaders = authOptions.headersProvider();
|
|
6033
|
+
for (var headerName in dynamicHeaders) {
|
|
6034
|
+
headers.set(headerName, dynamicHeaders[headerName]);
|
|
6035
|
+
}
|
|
6036
|
+
}
|
|
6031
6037
|
var body = query;
|
|
6032
6038
|
var request = new Request(authOptions.endpoint, {
|
|
6033
6039
|
headers: headers,
|
|
@@ -6363,12 +6369,22 @@ var AuthRequestType;
|
|
|
6363
6369
|
|
|
6364
6370
|
var composeChannelQuery = function (params, authOptions) {
|
|
6365
6371
|
var query = 'socket_id=' + encodeURIComponent(params.socketId);
|
|
6366
|
-
for (var
|
|
6372
|
+
for (var key in authOptions.params) {
|
|
6367
6373
|
query +=
|
|
6368
6374
|
'&' +
|
|
6369
|
-
encodeURIComponent(
|
|
6375
|
+
encodeURIComponent(key) +
|
|
6370
6376
|
'=' +
|
|
6371
|
-
encodeURIComponent(authOptions.params[
|
|
6377
|
+
encodeURIComponent(authOptions.params[key]);
|
|
6378
|
+
}
|
|
6379
|
+
if (authOptions.paramsProvider != null) {
|
|
6380
|
+
var dynamicParams = authOptions.paramsProvider();
|
|
6381
|
+
for (var key in dynamicParams) {
|
|
6382
|
+
query +=
|
|
6383
|
+
'&' +
|
|
6384
|
+
encodeURIComponent(key) +
|
|
6385
|
+
'=' +
|
|
6386
|
+
encodeURIComponent(dynamicParams[key]);
|
|
6387
|
+
}
|
|
6372
6388
|
}
|
|
6373
6389
|
return query;
|
|
6374
6390
|
};
|
|
@@ -6389,12 +6405,22 @@ var UserAuthenticator = function (authOptions) {
|
|
|
6389
6405
|
var channel_authorizer_composeChannelQuery = function (params, authOptions) {
|
|
6390
6406
|
var query = 'socket_id=' + encodeURIComponent(params.socketId);
|
|
6391
6407
|
query += '&channel_name=' + encodeURIComponent(params.channelName);
|
|
6392
|
-
for (var
|
|
6408
|
+
for (var key in authOptions.params) {
|
|
6393
6409
|
query +=
|
|
6394
6410
|
'&' +
|
|
6395
|
-
encodeURIComponent(
|
|
6411
|
+
encodeURIComponent(key) +
|
|
6396
6412
|
'=' +
|
|
6397
|
-
encodeURIComponent(authOptions.params[
|
|
6413
|
+
encodeURIComponent(authOptions.params[key]);
|
|
6414
|
+
}
|
|
6415
|
+
if (authOptions.paramsProvider != null) {
|
|
6416
|
+
var dynamicParams = authOptions.paramsProvider();
|
|
6417
|
+
for (var key in dynamicParams) {
|
|
6418
|
+
query +=
|
|
6419
|
+
'&' +
|
|
6420
|
+
encodeURIComponent(key) +
|
|
6421
|
+
'=' +
|
|
6422
|
+
encodeURIComponent(dynamicParams[key]);
|
|
6423
|
+
}
|
|
6398
6424
|
}
|
|
6399
6425
|
return query;
|
|
6400
6426
|
};
|
|
@@ -6553,6 +6579,51 @@ function buildChannelAuthorizer(opts, pusher) {
|
|
|
6553
6579
|
return channel_authorizer(channelAuthorization);
|
|
6554
6580
|
}
|
|
6555
6581
|
|
|
6582
|
+
// CONCATENATED MODULE: ./src/core/watchlist.ts
|
|
6583
|
+
var watchlist_extends = (undefined && undefined.__extends) || (function () {
|
|
6584
|
+
var extendStatics = function (d, b) {
|
|
6585
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6586
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6587
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6588
|
+
return extendStatics(d, b);
|
|
6589
|
+
};
|
|
6590
|
+
return function (d, b) {
|
|
6591
|
+
extendStatics(d, b);
|
|
6592
|
+
function __() { this.constructor = d; }
|
|
6593
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
6594
|
+
};
|
|
6595
|
+
})();
|
|
6596
|
+
|
|
6597
|
+
|
|
6598
|
+
var watchlist_WatchlistFacade = (function (_super) {
|
|
6599
|
+
watchlist_extends(WatchlistFacade, _super);
|
|
6600
|
+
function WatchlistFacade(pusher) {
|
|
6601
|
+
var _this = _super.call(this, function (eventName, data) {
|
|
6602
|
+
logger.debug("No callbacks on watchlist events for " + eventName);
|
|
6603
|
+
}) || this;
|
|
6604
|
+
_this.pusher = pusher;
|
|
6605
|
+
_this.bindWatchlistInternalEvent();
|
|
6606
|
+
return _this;
|
|
6607
|
+
}
|
|
6608
|
+
WatchlistFacade.prototype.handleEvent = function (pusherEvent) {
|
|
6609
|
+
var _this = this;
|
|
6610
|
+
pusherEvent.data.events.forEach(function (watchlistEvent) {
|
|
6611
|
+
_this.emit(watchlistEvent.name, watchlistEvent);
|
|
6612
|
+
});
|
|
6613
|
+
};
|
|
6614
|
+
WatchlistFacade.prototype.bindWatchlistInternalEvent = function () {
|
|
6615
|
+
var _this = this;
|
|
6616
|
+
this.pusher.connection.bind('message', function (pusherEvent) {
|
|
6617
|
+
var eventName = pusherEvent.event;
|
|
6618
|
+
if (eventName === 'pusher_internal:watchlist_events') {
|
|
6619
|
+
_this.handleEvent(pusherEvent);
|
|
6620
|
+
}
|
|
6621
|
+
});
|
|
6622
|
+
};
|
|
6623
|
+
return WatchlistFacade;
|
|
6624
|
+
}(dispatcher));
|
|
6625
|
+
/* harmony default export */ var watchlist = (watchlist_WatchlistFacade);
|
|
6626
|
+
|
|
6556
6627
|
// CONCATENATED MODULE: ./src/core/utils/flat_promise.ts
|
|
6557
6628
|
function flatPromise() {
|
|
6558
6629
|
var resolve, reject;
|
|
@@ -6582,6 +6653,7 @@ var user_extends = (undefined && undefined.__extends) || (function () {
|
|
|
6582
6653
|
|
|
6583
6654
|
|
|
6584
6655
|
|
|
6656
|
+
|
|
6585
6657
|
var user_UserFacade = (function (_super) {
|
|
6586
6658
|
user_extends(UserFacade, _super);
|
|
6587
6659
|
function UserFacade(pusher) {
|
|
@@ -6615,6 +6687,7 @@ var user_UserFacade = (function (_super) {
|
|
|
6615
6687
|
_this._newSigninPromiseIfNeeded();
|
|
6616
6688
|
}
|
|
6617
6689
|
});
|
|
6690
|
+
_this.watchlist = new watchlist(pusher);
|
|
6618
6691
|
_this.pusher.connection.bind('message', function (event) {
|
|
6619
6692
|
var eventName = event.event;
|
|
6620
6693
|
if (eventName === 'pusher:signin_success') {
|