pusher-js 7.4.0 → 7.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/PULL_REQUEST_TEMPLATE.md +4 -0
- package/.github/workflows/release_pr.yml +4 -3
- package/CHANGELOG.md +12 -2
- package/README.md +1 -1
- package/dist/node/pusher.js +82 -27
- package/dist/node/pusher.js.map +1 -1
- package/dist/react-native/pusher.js +13 -2
- package/dist/react-native/pusher.js.map +1 -1
- package/dist/web/pusher-with-encryption.js +64 -8
- 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 +64 -8
- 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 +63 -7
- 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 +63 -7
- 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/package.json +1 -1
- package/spec/javascripts/unit/core/watchlist_spec.js +48 -0
- 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 +1 -1
- 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.5.0
|
|
3
3
|
* https://pusher.com/
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2020, Pusher
|
|
@@ -2995,7 +2995,7 @@ var ScriptReceivers = new ScriptReceiverFactory('_pusher_script_', 'Pusher.Scrip
|
|
|
2995
2995
|
|
|
2996
2996
|
// CONCATENATED MODULE: ./src/core/defaults.ts
|
|
2997
2997
|
var Defaults = {
|
|
2998
|
-
VERSION: "7.
|
|
2998
|
+
VERSION: "7.5.0",
|
|
2999
2999
|
PROTOCOL: 7,
|
|
3000
3000
|
wsPort: 80,
|
|
3001
3001
|
wssPort: 443,
|
|
@@ -3287,7 +3287,7 @@ var ajax = function (context, query, authOptions, authRequestType, callback) {
|
|
|
3287
3287
|
suffix = url_store.buildLogSuffix('authenticationEndpoint');
|
|
3288
3288
|
break;
|
|
3289
3289
|
case AuthRequestType.ChannelAuthorization:
|
|
3290
|
-
suffix = "Clients must be
|
|
3290
|
+
suffix = "Clients must be authorized to join private or presence channels. " + url_store.buildLogSuffix('authorizationEndpoint');
|
|
3291
3291
|
break;
|
|
3292
3292
|
}
|
|
3293
3293
|
callback(new HTTPAuthError(xhr.status, "Unable to retrieve auth string from " + authRequestType.toString() + " endpoint - " +
|
|
@@ -4876,10 +4876,11 @@ var presence_channel_extends = (undefined && undefined.__extends) || (function (
|
|
|
4876
4876
|
};
|
|
4877
4877
|
})();
|
|
4878
4878
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4879
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4879
4880
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4880
4881
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
4881
4882
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
4882
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
4883
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
4883
4884
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
4884
4885
|
});
|
|
4885
4886
|
};
|
|
@@ -6277,7 +6278,7 @@ function replaceHost(url, hostname) {
|
|
|
6277
6278
|
return urlParts[1] + hostname + urlParts[3];
|
|
6278
6279
|
}
|
|
6279
6280
|
function randomNumber(max) {
|
|
6280
|
-
return
|
|
6281
|
+
return runtime.randomInt(max);
|
|
6281
6282
|
}
|
|
6282
6283
|
function randomString(length) {
|
|
6283
6284
|
var result = [];
|
|
@@ -6523,6 +6524,14 @@ var Runtime = {
|
|
|
6523
6524
|
else if (window.detachEvent !== undefined) {
|
|
6524
6525
|
window.detachEvent('onunload', listener);
|
|
6525
6526
|
}
|
|
6527
|
+
},
|
|
6528
|
+
randomInt: function (max) {
|
|
6529
|
+
var random = function () {
|
|
6530
|
+
var crypto = window.crypto || window['msCrypto'];
|
|
6531
|
+
var random = crypto.getRandomValues(new Uint32Array(1))[0];
|
|
6532
|
+
return random / Math.pow(2, 32);
|
|
6533
|
+
};
|
|
6534
|
+
return Math.floor(random() * max);
|
|
6526
6535
|
}
|
|
6527
6536
|
};
|
|
6528
6537
|
/* harmony default export */ var runtime = (Runtime);
|
|
@@ -6902,7 +6911,7 @@ function getEnableStatsConfig(opts) {
|
|
|
6902
6911
|
return false;
|
|
6903
6912
|
}
|
|
6904
6913
|
function buildUserAuthenticator(opts) {
|
|
6905
|
-
var userAuthentication = __assign({}, defaults.userAuthentication, opts.userAuthentication);
|
|
6914
|
+
var userAuthentication = __assign(__assign({}, defaults.userAuthentication), opts.userAuthentication);
|
|
6906
6915
|
if ('customHandler' in userAuthentication &&
|
|
6907
6916
|
userAuthentication['customHandler'] != null) {
|
|
6908
6917
|
return userAuthentication['customHandler'];
|
|
@@ -6912,7 +6921,7 @@ function buildUserAuthenticator(opts) {
|
|
|
6912
6921
|
function buildChannelAuth(opts, pusher) {
|
|
6913
6922
|
var channelAuthorization;
|
|
6914
6923
|
if ('channelAuthorization' in opts) {
|
|
6915
|
-
channelAuthorization = __assign({}, defaults.channelAuthorization, opts.channelAuthorization);
|
|
6924
|
+
channelAuthorization = __assign(__assign({}, defaults.channelAuthorization), opts.channelAuthorization);
|
|
6916
6925
|
}
|
|
6917
6926
|
else {
|
|
6918
6927
|
channelAuthorization = {
|
|
@@ -6939,6 +6948,51 @@ function buildChannelAuthorizer(opts, pusher) {
|
|
|
6939
6948
|
return channel_authorizer(channelAuthorization);
|
|
6940
6949
|
}
|
|
6941
6950
|
|
|
6951
|
+
// CONCATENATED MODULE: ./src/core/watchlist.ts
|
|
6952
|
+
var watchlist_extends = (undefined && undefined.__extends) || (function () {
|
|
6953
|
+
var extendStatics = function (d, b) {
|
|
6954
|
+
extendStatics = Object.setPrototypeOf ||
|
|
6955
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6956
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6957
|
+
return extendStatics(d, b);
|
|
6958
|
+
};
|
|
6959
|
+
return function (d, b) {
|
|
6960
|
+
extendStatics(d, b);
|
|
6961
|
+
function __() { this.constructor = d; }
|
|
6962
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
6963
|
+
};
|
|
6964
|
+
})();
|
|
6965
|
+
|
|
6966
|
+
|
|
6967
|
+
var watchlist_WatchlistFacade = (function (_super) {
|
|
6968
|
+
watchlist_extends(WatchlistFacade, _super);
|
|
6969
|
+
function WatchlistFacade(pusher) {
|
|
6970
|
+
var _this = _super.call(this, function (eventName, data) {
|
|
6971
|
+
logger.debug("No callbacks on watchlist events for " + eventName);
|
|
6972
|
+
}) || this;
|
|
6973
|
+
_this.pusher = pusher;
|
|
6974
|
+
_this.bindWatchlistInternalEvent();
|
|
6975
|
+
return _this;
|
|
6976
|
+
}
|
|
6977
|
+
WatchlistFacade.prototype.handleEvent = function (pusherEvent) {
|
|
6978
|
+
var _this = this;
|
|
6979
|
+
pusherEvent.data.events.forEach(function (watchlistEvent) {
|
|
6980
|
+
_this.emit(watchlistEvent.name, watchlistEvent);
|
|
6981
|
+
});
|
|
6982
|
+
};
|
|
6983
|
+
WatchlistFacade.prototype.bindWatchlistInternalEvent = function () {
|
|
6984
|
+
var _this = this;
|
|
6985
|
+
this.pusher.connection.bind('message', function (pusherEvent) {
|
|
6986
|
+
var eventName = pusherEvent.event;
|
|
6987
|
+
if (eventName === 'pusher_internal:watchlist_events') {
|
|
6988
|
+
_this.handleEvent(pusherEvent);
|
|
6989
|
+
}
|
|
6990
|
+
});
|
|
6991
|
+
};
|
|
6992
|
+
return WatchlistFacade;
|
|
6993
|
+
}(dispatcher));
|
|
6994
|
+
/* harmony default export */ var watchlist = (watchlist_WatchlistFacade);
|
|
6995
|
+
|
|
6942
6996
|
// CONCATENATED MODULE: ./src/core/utils/flat_promise.ts
|
|
6943
6997
|
function flatPromise() {
|
|
6944
6998
|
var resolve, reject;
|
|
@@ -6968,6 +7022,7 @@ var user_extends = (undefined && undefined.__extends) || (function () {
|
|
|
6968
7022
|
|
|
6969
7023
|
|
|
6970
7024
|
|
|
7025
|
+
|
|
6971
7026
|
var user_UserFacade = (function (_super) {
|
|
6972
7027
|
user_extends(UserFacade, _super);
|
|
6973
7028
|
function UserFacade(pusher) {
|
|
@@ -7001,6 +7056,7 @@ var user_UserFacade = (function (_super) {
|
|
|
7001
7056
|
_this._newSigninPromiseIfNeeded();
|
|
7002
7057
|
}
|
|
7003
7058
|
});
|
|
7059
|
+
_this.watchlist = new watchlist(pusher);
|
|
7004
7060
|
_this.pusher.connection.bind('message', function (event) {
|
|
7005
7061
|
var eventName = event.event;
|
|
7006
7062
|
if (eventName === 'pusher:signin_success') {
|
|
@@ -7131,7 +7187,7 @@ var pusher_Pusher = (function () {
|
|
|
7131
7187
|
this.config = getConfig(options, this);
|
|
7132
7188
|
this.channels = factory.createChannels();
|
|
7133
7189
|
this.global_emitter = new dispatcher();
|
|
7134
|
-
this.sessionID =
|
|
7190
|
+
this.sessionID = runtime.randomInt(1000000000);
|
|
7135
7191
|
this.timeline = new timeline_timeline(this.key, this.sessionID, {
|
|
7136
7192
|
cluster: this.config.cluster,
|
|
7137
7193
|
features: Pusher.getClientFeatures(),
|