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
package/dist/web/pusher.js
CHANGED
|
@@ -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
|
|
@@ -593,7 +593,7 @@ var ScriptReceivers = new ScriptReceiverFactory('_pusher_script_', 'Pusher.Scrip
|
|
|
593
593
|
|
|
594
594
|
// CONCATENATED MODULE: ./src/core/defaults.ts
|
|
595
595
|
var Defaults = {
|
|
596
|
-
VERSION: "7.
|
|
596
|
+
VERSION: "7.5.0",
|
|
597
597
|
PROTOCOL: 7,
|
|
598
598
|
wsPort: 80,
|
|
599
599
|
wssPort: 443,
|
|
@@ -885,7 +885,7 @@ var ajax = function (context, query, authOptions, authRequestType, callback) {
|
|
|
885
885
|
suffix = url_store.buildLogSuffix('authenticationEndpoint');
|
|
886
886
|
break;
|
|
887
887
|
case AuthRequestType.ChannelAuthorization:
|
|
888
|
-
suffix = "Clients must be
|
|
888
|
+
suffix = "Clients must be authorized to join private or presence channels. " + url_store.buildLogSuffix('authorizationEndpoint');
|
|
889
889
|
break;
|
|
890
890
|
}
|
|
891
891
|
callback(new HTTPAuthError(xhr.status, "Unable to retrieve auth string from " + authRequestType.toString() + " endpoint - " +
|
|
@@ -2474,10 +2474,11 @@ var presence_channel_extends = (undefined && undefined.__extends) || (function (
|
|
|
2474
2474
|
};
|
|
2475
2475
|
})();
|
|
2476
2476
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2477
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2477
2478
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2478
2479
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2479
2480
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2480
|
-
function step(result) { result.done ? resolve(result.value) :
|
|
2481
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2481
2482
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2482
2483
|
});
|
|
2483
2484
|
};
|
|
@@ -3875,7 +3876,7 @@ function replaceHost(url, hostname) {
|
|
|
3875
3876
|
return urlParts[1] + hostname + urlParts[3];
|
|
3876
3877
|
}
|
|
3877
3878
|
function randomNumber(max) {
|
|
3878
|
-
return
|
|
3879
|
+
return runtime.randomInt(max);
|
|
3879
3880
|
}
|
|
3880
3881
|
function randomString(length) {
|
|
3881
3882
|
var result = [];
|
|
@@ -4121,6 +4122,14 @@ var Runtime = {
|
|
|
4121
4122
|
else if (window.detachEvent !== undefined) {
|
|
4122
4123
|
window.detachEvent('onunload', listener);
|
|
4123
4124
|
}
|
|
4125
|
+
},
|
|
4126
|
+
randomInt: function (max) {
|
|
4127
|
+
var random = function () {
|
|
4128
|
+
var crypto = window.crypto || window['msCrypto'];
|
|
4129
|
+
var random = crypto.getRandomValues(new Uint32Array(1))[0];
|
|
4130
|
+
return random / Math.pow(2, 32);
|
|
4131
|
+
};
|
|
4132
|
+
return Math.floor(random() * max);
|
|
4124
4133
|
}
|
|
4125
4134
|
};
|
|
4126
4135
|
/* harmony default export */ var runtime = (Runtime);
|
|
@@ -4500,7 +4509,7 @@ function getEnableStatsConfig(opts) {
|
|
|
4500
4509
|
return false;
|
|
4501
4510
|
}
|
|
4502
4511
|
function buildUserAuthenticator(opts) {
|
|
4503
|
-
var userAuthentication = __assign({}, defaults.userAuthentication, opts.userAuthentication);
|
|
4512
|
+
var userAuthentication = __assign(__assign({}, defaults.userAuthentication), opts.userAuthentication);
|
|
4504
4513
|
if ('customHandler' in userAuthentication &&
|
|
4505
4514
|
userAuthentication['customHandler'] != null) {
|
|
4506
4515
|
return userAuthentication['customHandler'];
|
|
@@ -4510,7 +4519,7 @@ function buildUserAuthenticator(opts) {
|
|
|
4510
4519
|
function buildChannelAuth(opts, pusher) {
|
|
4511
4520
|
var channelAuthorization;
|
|
4512
4521
|
if ('channelAuthorization' in opts) {
|
|
4513
|
-
channelAuthorization = __assign({}, defaults.channelAuthorization, opts.channelAuthorization);
|
|
4522
|
+
channelAuthorization = __assign(__assign({}, defaults.channelAuthorization), opts.channelAuthorization);
|
|
4514
4523
|
}
|
|
4515
4524
|
else {
|
|
4516
4525
|
channelAuthorization = {
|
|
@@ -4537,6 +4546,51 @@ function buildChannelAuthorizer(opts, pusher) {
|
|
|
4537
4546
|
return channel_authorizer(channelAuthorization);
|
|
4538
4547
|
}
|
|
4539
4548
|
|
|
4549
|
+
// CONCATENATED MODULE: ./src/core/watchlist.ts
|
|
4550
|
+
var watchlist_extends = (undefined && undefined.__extends) || (function () {
|
|
4551
|
+
var extendStatics = function (d, b) {
|
|
4552
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4553
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
4554
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
4555
|
+
return extendStatics(d, b);
|
|
4556
|
+
};
|
|
4557
|
+
return function (d, b) {
|
|
4558
|
+
extendStatics(d, b);
|
|
4559
|
+
function __() { this.constructor = d; }
|
|
4560
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
4561
|
+
};
|
|
4562
|
+
})();
|
|
4563
|
+
|
|
4564
|
+
|
|
4565
|
+
var watchlist_WatchlistFacade = (function (_super) {
|
|
4566
|
+
watchlist_extends(WatchlistFacade, _super);
|
|
4567
|
+
function WatchlistFacade(pusher) {
|
|
4568
|
+
var _this = _super.call(this, function (eventName, data) {
|
|
4569
|
+
logger.debug("No callbacks on watchlist events for " + eventName);
|
|
4570
|
+
}) || this;
|
|
4571
|
+
_this.pusher = pusher;
|
|
4572
|
+
_this.bindWatchlistInternalEvent();
|
|
4573
|
+
return _this;
|
|
4574
|
+
}
|
|
4575
|
+
WatchlistFacade.prototype.handleEvent = function (pusherEvent) {
|
|
4576
|
+
var _this = this;
|
|
4577
|
+
pusherEvent.data.events.forEach(function (watchlistEvent) {
|
|
4578
|
+
_this.emit(watchlistEvent.name, watchlistEvent);
|
|
4579
|
+
});
|
|
4580
|
+
};
|
|
4581
|
+
WatchlistFacade.prototype.bindWatchlistInternalEvent = function () {
|
|
4582
|
+
var _this = this;
|
|
4583
|
+
this.pusher.connection.bind('message', function (pusherEvent) {
|
|
4584
|
+
var eventName = pusherEvent.event;
|
|
4585
|
+
if (eventName === 'pusher_internal:watchlist_events') {
|
|
4586
|
+
_this.handleEvent(pusherEvent);
|
|
4587
|
+
}
|
|
4588
|
+
});
|
|
4589
|
+
};
|
|
4590
|
+
return WatchlistFacade;
|
|
4591
|
+
}(dispatcher));
|
|
4592
|
+
/* harmony default export */ var watchlist = (watchlist_WatchlistFacade);
|
|
4593
|
+
|
|
4540
4594
|
// CONCATENATED MODULE: ./src/core/utils/flat_promise.ts
|
|
4541
4595
|
function flatPromise() {
|
|
4542
4596
|
var resolve, reject;
|
|
@@ -4566,6 +4620,7 @@ var user_extends = (undefined && undefined.__extends) || (function () {
|
|
|
4566
4620
|
|
|
4567
4621
|
|
|
4568
4622
|
|
|
4623
|
+
|
|
4569
4624
|
var user_UserFacade = (function (_super) {
|
|
4570
4625
|
user_extends(UserFacade, _super);
|
|
4571
4626
|
function UserFacade(pusher) {
|
|
@@ -4599,6 +4654,7 @@ var user_UserFacade = (function (_super) {
|
|
|
4599
4654
|
_this._newSigninPromiseIfNeeded();
|
|
4600
4655
|
}
|
|
4601
4656
|
});
|
|
4657
|
+
_this.watchlist = new watchlist(pusher);
|
|
4602
4658
|
_this.pusher.connection.bind('message', function (event) {
|
|
4603
4659
|
var eventName = event.event;
|
|
4604
4660
|
if (eventName === 'pusher:signin_success') {
|
|
@@ -4729,7 +4785,7 @@ var pusher_Pusher = (function () {
|
|
|
4729
4785
|
this.config = getConfig(options, this);
|
|
4730
4786
|
this.channels = factory.createChannels();
|
|
4731
4787
|
this.global_emitter = new dispatcher();
|
|
4732
|
-
this.sessionID =
|
|
4788
|
+
this.sessionID = runtime.randomInt(1000000000);
|
|
4733
4789
|
this.timeline = new timeline_timeline(this.key, this.sessionID, {
|
|
4734
4790
|
cluster: this.config.cluster,
|
|
4735
4791
|
features: Pusher.getClientFeatures(),
|