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
|
|
@@ -897,7 +897,7 @@ function safeJSONStringify(source) {
|
|
|
897
897
|
|
|
898
898
|
// CONCATENATED MODULE: ./src/core/defaults.ts
|
|
899
899
|
var Defaults = {
|
|
900
|
-
VERSION: "7.
|
|
900
|
+
VERSION: "7.6.0",
|
|
901
901
|
PROTOCOL: 7,
|
|
902
902
|
wsPort: 80,
|
|
903
903
|
wssPort: 443,
|
|
@@ -3626,6 +3626,12 @@ var fetchAuth = function (context, query, authOptions, authRequestType, callback
|
|
|
3626
3626
|
for (var headerName in authOptions.headers) {
|
|
3627
3627
|
headers.set(headerName, authOptions.headers[headerName]);
|
|
3628
3628
|
}
|
|
3629
|
+
if (authOptions.headersProvider != null) {
|
|
3630
|
+
var dynamicHeaders = authOptions.headersProvider();
|
|
3631
|
+
for (var headerName in dynamicHeaders) {
|
|
3632
|
+
headers.set(headerName, dynamicHeaders[headerName]);
|
|
3633
|
+
}
|
|
3634
|
+
}
|
|
3629
3635
|
var body = query;
|
|
3630
3636
|
var request = new Request(authOptions.endpoint, {
|
|
3631
3637
|
headers: headers,
|
|
@@ -3961,12 +3967,22 @@ var AuthRequestType;
|
|
|
3961
3967
|
|
|
3962
3968
|
var composeChannelQuery = function (params, authOptions) {
|
|
3963
3969
|
var query = 'socket_id=' + encodeURIComponent(params.socketId);
|
|
3964
|
-
for (var
|
|
3970
|
+
for (var key in authOptions.params) {
|
|
3965
3971
|
query +=
|
|
3966
3972
|
'&' +
|
|
3967
|
-
encodeURIComponent(
|
|
3973
|
+
encodeURIComponent(key) +
|
|
3968
3974
|
'=' +
|
|
3969
|
-
encodeURIComponent(authOptions.params[
|
|
3975
|
+
encodeURIComponent(authOptions.params[key]);
|
|
3976
|
+
}
|
|
3977
|
+
if (authOptions.paramsProvider != null) {
|
|
3978
|
+
var dynamicParams = authOptions.paramsProvider();
|
|
3979
|
+
for (var key in dynamicParams) {
|
|
3980
|
+
query +=
|
|
3981
|
+
'&' +
|
|
3982
|
+
encodeURIComponent(key) +
|
|
3983
|
+
'=' +
|
|
3984
|
+
encodeURIComponent(dynamicParams[key]);
|
|
3985
|
+
}
|
|
3970
3986
|
}
|
|
3971
3987
|
return query;
|
|
3972
3988
|
};
|
|
@@ -3987,12 +4003,22 @@ var UserAuthenticator = function (authOptions) {
|
|
|
3987
4003
|
var channel_authorizer_composeChannelQuery = function (params, authOptions) {
|
|
3988
4004
|
var query = 'socket_id=' + encodeURIComponent(params.socketId);
|
|
3989
4005
|
query += '&channel_name=' + encodeURIComponent(params.channelName);
|
|
3990
|
-
for (var
|
|
4006
|
+
for (var key in authOptions.params) {
|
|
3991
4007
|
query +=
|
|
3992
4008
|
'&' +
|
|
3993
|
-
encodeURIComponent(
|
|
4009
|
+
encodeURIComponent(key) +
|
|
3994
4010
|
'=' +
|
|
3995
|
-
encodeURIComponent(authOptions.params[
|
|
4011
|
+
encodeURIComponent(authOptions.params[key]);
|
|
4012
|
+
}
|
|
4013
|
+
if (authOptions.paramsProvider != null) {
|
|
4014
|
+
var dynamicParams = authOptions.paramsProvider();
|
|
4015
|
+
for (var key in dynamicParams) {
|
|
4016
|
+
query +=
|
|
4017
|
+
'&' +
|
|
4018
|
+
encodeURIComponent(key) +
|
|
4019
|
+
'=' +
|
|
4020
|
+
encodeURIComponent(dynamicParams[key]);
|
|
4021
|
+
}
|
|
3996
4022
|
}
|
|
3997
4023
|
return query;
|
|
3998
4024
|
};
|
|
@@ -4151,6 +4177,51 @@ function buildChannelAuthorizer(opts, pusher) {
|
|
|
4151
4177
|
return channel_authorizer(channelAuthorization);
|
|
4152
4178
|
}
|
|
4153
4179
|
|
|
4180
|
+
// CONCATENATED MODULE: ./src/core/watchlist.ts
|
|
4181
|
+
var watchlist_extends = (undefined && undefined.__extends) || (function () {
|
|
4182
|
+
var extendStatics = function (d, b) {
|
|
4183
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4184
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
4185
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
4186
|
+
return extendStatics(d, b);
|
|
4187
|
+
};
|
|
4188
|
+
return function (d, b) {
|
|
4189
|
+
extendStatics(d, b);
|
|
4190
|
+
function __() { this.constructor = d; }
|
|
4191
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
4192
|
+
};
|
|
4193
|
+
})();
|
|
4194
|
+
|
|
4195
|
+
|
|
4196
|
+
var watchlist_WatchlistFacade = (function (_super) {
|
|
4197
|
+
watchlist_extends(WatchlistFacade, _super);
|
|
4198
|
+
function WatchlistFacade(pusher) {
|
|
4199
|
+
var _this = _super.call(this, function (eventName, data) {
|
|
4200
|
+
logger.debug("No callbacks on watchlist events for " + eventName);
|
|
4201
|
+
}) || this;
|
|
4202
|
+
_this.pusher = pusher;
|
|
4203
|
+
_this.bindWatchlistInternalEvent();
|
|
4204
|
+
return _this;
|
|
4205
|
+
}
|
|
4206
|
+
WatchlistFacade.prototype.handleEvent = function (pusherEvent) {
|
|
4207
|
+
var _this = this;
|
|
4208
|
+
pusherEvent.data.events.forEach(function (watchlistEvent) {
|
|
4209
|
+
_this.emit(watchlistEvent.name, watchlistEvent);
|
|
4210
|
+
});
|
|
4211
|
+
};
|
|
4212
|
+
WatchlistFacade.prototype.bindWatchlistInternalEvent = function () {
|
|
4213
|
+
var _this = this;
|
|
4214
|
+
this.pusher.connection.bind('message', function (pusherEvent) {
|
|
4215
|
+
var eventName = pusherEvent.event;
|
|
4216
|
+
if (eventName === 'pusher_internal:watchlist_events') {
|
|
4217
|
+
_this.handleEvent(pusherEvent);
|
|
4218
|
+
}
|
|
4219
|
+
});
|
|
4220
|
+
};
|
|
4221
|
+
return WatchlistFacade;
|
|
4222
|
+
}(dispatcher));
|
|
4223
|
+
/* harmony default export */ var watchlist = (watchlist_WatchlistFacade);
|
|
4224
|
+
|
|
4154
4225
|
// CONCATENATED MODULE: ./src/core/utils/flat_promise.ts
|
|
4155
4226
|
function flatPromise() {
|
|
4156
4227
|
var resolve, reject;
|
|
@@ -4180,6 +4251,7 @@ var user_extends = (undefined && undefined.__extends) || (function () {
|
|
|
4180
4251
|
|
|
4181
4252
|
|
|
4182
4253
|
|
|
4254
|
+
|
|
4183
4255
|
var user_UserFacade = (function (_super) {
|
|
4184
4256
|
user_extends(UserFacade, _super);
|
|
4185
4257
|
function UserFacade(pusher) {
|
|
@@ -4213,6 +4285,7 @@ var user_UserFacade = (function (_super) {
|
|
|
4213
4285
|
_this._newSigninPromiseIfNeeded();
|
|
4214
4286
|
}
|
|
4215
4287
|
});
|
|
4288
|
+
_this.watchlist = new watchlist(pusher);
|
|
4216
4289
|
_this.pusher.connection.bind('message', function (event) {
|
|
4217
4290
|
var eventName = event.event;
|
|
4218
4291
|
if (eventName === 'pusher:signin_success') {
|