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.
Files changed (57) hide show
  1. package/.github/workflows/release_pr.yml +3 -1
  2. package/.github/workflows/run-tests.yml +27 -3
  3. package/CHANGELOG.md +8 -0
  4. package/Makefile +1 -0
  5. package/README.md +11 -3
  6. package/dist/node/pusher.js +139 -28
  7. package/dist/node/pusher.js.map +1 -1
  8. package/dist/react-native/pusher.js +5 -5
  9. package/dist/react-native/pusher.js.map +1 -1
  10. package/dist/web/pusher-with-encryption.js +83 -9
  11. package/dist/web/pusher-with-encryption.js.map +1 -1
  12. package/dist/web/pusher-with-encryption.min.js +2 -2
  13. package/dist/web/pusher-with-encryption.min.js.map +1 -1
  14. package/dist/web/pusher.js +83 -9
  15. package/dist/web/pusher.js.map +1 -1
  16. package/dist/web/pusher.min.js +2 -2
  17. package/dist/web/pusher.min.js.map +1 -1
  18. package/dist/worker/pusher-with-encryption.worker.js +81 -8
  19. package/dist/worker/pusher-with-encryption.worker.js.map +1 -1
  20. package/dist/worker/pusher-with-encryption.worker.min.js +2 -2
  21. package/dist/worker/pusher-with-encryption.worker.min.js.map +1 -1
  22. package/dist/worker/pusher.worker.js +81 -8
  23. package/dist/worker/pusher.worker.js.map +1 -1
  24. package/dist/worker/pusher.worker.min.js +2 -2
  25. package/dist/worker/pusher.worker.min.js.map +1 -1
  26. package/integration_tests_server/index.js +176 -0
  27. package/integration_tests_server/package-lock.json +1177 -0
  28. package/integration_tests_server/package.json +15 -0
  29. package/package.json +6 -5
  30. package/spec/config/karma/config.common.js +1 -2
  31. package/spec/javascripts/helpers/node/integration.js +2 -2
  32. package/spec/javascripts/helpers/web/integration.js +2 -2
  33. package/spec/javascripts/integration/core/cluster_config_spec.js +1 -1
  34. package/spec/javascripts/integration/core/pusher_spec/test_builder.js +13 -43
  35. package/spec/javascripts/integration/web/dom/jsonp_spec.js +2 -2
  36. package/spec/javascripts/unit/core/config_spec.js +91 -3
  37. package/spec/javascripts/unit/core/connection/connection_manager_spec.js +11 -1
  38. package/spec/javascripts/unit/core/http/http_request_spec.js +0 -6
  39. package/spec/javascripts/unit/core/transports/transport_connection_spec.js +5 -0
  40. package/spec/javascripts/unit/core/utils/timers_spec.js +0 -4
  41. package/spec/javascripts/unit/core/watchlist_spec.js +48 -0
  42. package/spec/javascripts/unit/core_with_runtime/auth/channel_authorizer_spec.js +82 -0
  43. package/spec/javascripts/unit/core_with_runtime/auth/user_authorizer_spec.js +76 -0
  44. package/spec/javascripts/unit/web/pusher_authorizer_spec.js +28 -0
  45. package/spec/javascripts/unit/worker/channel_authorizer_spec.js +46 -0
  46. package/src/core/auth/channel_authorizer.ts +14 -3
  47. package/src/core/auth/options.ts +4 -0
  48. package/src/core/auth/user_authenticator.ts +14 -3
  49. package/src/core/pusher.ts +0 -1
  50. package/src/core/user.ts +5 -0
  51. package/src/core/watchlist.ts +31 -0
  52. package/src/runtimes/isomorphic/auth/xhr_auth.ts +6 -0
  53. package/src/runtimes/web/auth/jsonp_auth.ts +4 -1
  54. package/src/runtimes/worker/auth/fetch_auth.ts +7 -0
  55. package/types/src/core/auth/options.d.ts +4 -0
  56. package/types/src/core/user.d.ts +2 -0
  57. package/types/src/core/watchlist.d.ts +8 -0
@@ -36,6 +36,8 @@ jobs:
36
36
 
37
37
  make build_all
38
38
 
39
- git add package.json CHANGELOG.md dist/
39
+ git status
40
+
41
+ git add package.json package-lock.json CHANGELOG.md dist/ types/
40
42
  git commit -m "Bump to version ${{ steps.bump.outputs.new_version }}"
41
43
  git push
@@ -20,8 +20,20 @@ jobs:
20
20
  - run: npm install
21
21
  - run: npm run check-format
22
22
  - run: make web_unit
23
- - run: make web_integration
23
+ - name: make web_integration
24
+ run: |
25
+ cd integration_tests_server
26
+ npm install
27
+ node index.js&
28
+ cd ..
29
+ make web_integration
24
30
  env:
31
+ INTEGRATION_TESTS_APP_MT1_APP_ID: ${{ secrets.INTEGRATION_TESTS_APP_MT1_APP_ID }}
32
+ INTEGRATION_TESTS_APP_MT1_KEY: ${{ secrets.INTEGRATION_TESTS_APP_MT1_KEY }}
33
+ INTEGRATION_TESTS_APP_MT1_SECRET: ${{ secrets.INTEGRATION_TESTS_APP_MT1_SECRET }}
34
+ INTEGRATION_TESTS_APP_EU_APP_ID: ${{ secrets.INTEGRATION_TESTS_APP_EU_APP_ID }}
35
+ INTEGRATION_TESTS_APP_EU_KEY: ${{ secrets.INTEGRATION_TESTS_APP_EU_KEY }}
36
+ INTEGRATION_TESTS_APP_EU_SECRET: ${{ secrets.INTEGRATION_TESTS_APP_EU_SECRET }}
25
37
  BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSER_STACK_ACCESS_KEY }}
26
38
  BROWSER_STACK_USERNAME: ${{ secrets.BROWSER_STACK_USERNAME }}
27
39
  run-node-tests:
@@ -34,5 +46,17 @@ jobs:
34
46
  - run: npm install
35
47
  - run: npm run check-format
36
48
  - run: make node_unit
37
- - run: make node_integration
38
-
49
+ - name: make node_integration
50
+ run: |
51
+ cd integration_tests_server
52
+ npm install
53
+ node index.js&
54
+ cd ..
55
+ make node_integration
56
+ env:
57
+ INTEGRATION_TESTS_APP_MT1_APP_ID: ${{ secrets.INTEGRATION_TESTS_APP_MT1_APP_ID }}
58
+ INTEGRATION_TESTS_APP_MT1_KEY: ${{ secrets.INTEGRATION_TESTS_APP_MT1_KEY }}
59
+ INTEGRATION_TESTS_APP_MT1_SECRET: ${{ secrets.INTEGRATION_TESTS_APP_MT1_SECRET }}
60
+ INTEGRATION_TESTS_APP_EU_APP_ID: ${{ secrets.INTEGRATION_TESTS_APP_EU_APP_ID }}
61
+ INTEGRATION_TESTS_APP_EU_KEY: ${{ secrets.INTEGRATION_TESTS_APP_EU_KEY }}
62
+ INTEGRATION_TESTS_APP_EU_SECRET: ${{ secrets.INTEGRATION_TESTS_APP_EU_SECRET }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 7.6.0
4
+
5
+ - [ADDED] Introduce and to channel authorization and user authentication in order to allow for changing header and param values after the Pusher object is initialized.
6
+
7
+ ## 7.5.0
8
+
9
+ - [ADDED] Watchlist Online Status
10
+
3
11
  ## 7.4.1
4
12
 
5
13
  - [CHANGED] Authorization error message.
package/Makefile CHANGED
@@ -72,6 +72,7 @@ node_integration:
72
72
  node_modules/webpack/bin/webpack.js --config=spec/config/jasmine/webpack.integration.js && \
73
73
  node_modules/.bin/jasmine --config=spec/config/jasmine/integration.json
74
74
 
75
+
75
76
  .PHONY: serve
76
77
  serve:
77
78
  node webpack/dev.server.js
package/README.md CHANGED
@@ -144,10 +144,10 @@ var presenceChannel: PusherTypes.PresenceChannel;
144
144
 
145
145
  ### React Native
146
146
 
147
- > **⚠️ Important notice**
147
+ > **⚠️ Important notice**
148
+ >
149
+ > React Native support has been **deprecated** and soon will be removed from this repository.
148
150
  >
149
- > React Native support has been **deprecated** and soon will be removed from this repository.
150
- >
151
151
  > Please, use our official [React Native SDK](https://github.com/pusher/pusher-websocket-react-native) instead.
152
152
 
153
153
  ### Web Workers
@@ -232,6 +232,10 @@ Object containing the configuration for user authentication. Valid keys are:
232
232
 
233
233
  * `headers` (Object) - Only applied when using `ajax` as authentication transport. Provides the ability to pass additional HTTP Headers to the user authentication endpoint. This can be useful with some web application frameworks that guard against CSRF CSRF (Cross-site request forgery).
234
234
 
235
+ * `paramsProvider` (Function) - When present, this function is called to get additional parameters to be sent when the user authentication endpoint is called. This is equivalent to passing them on the params key, but allows for the parameters to be retrieved dynamically at the time of the request.
236
+
237
+ * `headersProvider` (Function) - When present, this function is called to get additional headers to be sent when the user authentication endpoint is called. This is equivalent to passing them on the headers key, but allows for the headers to be retrieved dynamically at the time of the request.
238
+
235
239
  * `customHandler` (Function) - When present, this function is called instead of a request being made to the endpoint specified by `userAuthentication.endpoint`.
236
240
 
237
241
 
@@ -252,6 +256,10 @@ Object containing the configuration for user authorization. Valid keys are:
252
256
 
253
257
  * `headers` (Object) - Only applied when using `ajax` as authorizing transport. Provides the ability to pass additional HTTP Headers to the user authorization endpoint. This can be useful with some web application frameworks that guard against CSRF CSRF (Cross-site request forgery).
254
258
 
259
+ * `paramsProvider` (Function) - When present, this function is called to get additional parameters to be sent when the user authentication endpoint is called. This is equivalent to passing them on the params key, but allows for the parameters to be retrieved dynamically at the time of the request.
260
+
261
+ * `headersProvider` (Function) - When present, this function is called to get additional headers to be sent when the user authentication endpoint is called. This is equivalent to passing them on the headers key, but allows for the headers to be retrieved dynamically at the time of the request.
262
+
255
263
  * `customHandler` (Function) - When present, this function is called instead of a request being made to the endpoint specified by `channelAuthorization.endpoint`.
256
264
 
257
265
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Pusher JavaScript Library v7.4.1
2
+ * Pusher JavaScript Library v7.6.0
3
3
  * https://pusher.com/
4
4
  *
5
5
  * Copyright 2020, Pusher
@@ -897,9 +897,9 @@ HttpParser.METHODS = {
897
897
  32: 'UNLINK'
898
898
  };
899
899
 
900
- var VERSION = (process.version || '')
901
- .match(/[0-9]+/g)
902
- .map(function(n) { return parseInt(n, 10) });
900
+ var VERSION = process.version
901
+ ? process.version.match(/[0-9]+/g).map(function(n) { return parseInt(n, 10) })
902
+ : [];
903
903
 
904
904
  if (VERSION[0] === 0 && VERSION[1] === 12) {
905
905
  HttpParser.METHODS[16] = 'REPORT';
@@ -5553,6 +5553,15 @@ var assert = __webpack_require__(28);
5553
5553
 
5554
5554
  exports.HTTPParser = HTTPParser;
5555
5555
  function HTTPParser(type) {
5556
+ assert.ok(type === HTTPParser.REQUEST || type === HTTPParser.RESPONSE || type === undefined);
5557
+ if (type === undefined) {
5558
+ // Node v12+
5559
+ } else {
5560
+ this.initialize(type);
5561
+ }
5562
+ this.maxHeaderSize=HTTPParser.maxHeaderSize
5563
+ }
5564
+ HTTPParser.prototype.initialize = function (type, async_resource) {
5556
5565
  assert.ok(type === HTTPParser.REQUEST || type === HTTPParser.RESPONSE);
5557
5566
  this.type = type;
5558
5567
  this.state = type + '_LINE';
@@ -5568,14 +5577,19 @@ function HTTPParser(type) {
5568
5577
  this.body_bytes = null;
5569
5578
  this.isUserCall = false;
5570
5579
  this.hadError = false;
5571
- }
5580
+ };
5581
+
5582
+ HTTPParser.encoding = 'ascii';
5572
5583
  HTTPParser.maxHeaderSize = 80 * 1024; // maxHeaderSize (in bytes) is configurable, but 80kb by default;
5573
5584
  HTTPParser.REQUEST = 'REQUEST';
5574
5585
  HTTPParser.RESPONSE = 'RESPONSE';
5575
- var kOnHeaders = HTTPParser.kOnHeaders = 0;
5576
- var kOnHeadersComplete = HTTPParser.kOnHeadersComplete = 1;
5577
- var kOnBody = HTTPParser.kOnBody = 2;
5578
- var kOnMessageComplete = HTTPParser.kOnMessageComplete = 3;
5586
+
5587
+ // Note: *not* starting with kOnHeaders=0 line the Node parser, because any
5588
+ // newly added constants (kOnTimeout in Node v12.19.0) will overwrite 0!
5589
+ var kOnHeaders = HTTPParser.kOnHeaders = 1;
5590
+ var kOnHeadersComplete = HTTPParser.kOnHeadersComplete = 2;
5591
+ var kOnBody = HTTPParser.kOnBody = 3;
5592
+ var kOnMessageComplete = HTTPParser.kOnMessageComplete = 4;
5579
5593
 
5580
5594
  // Some handler stubs, needed for compatibility
5581
5595
  HTTPParser.prototype[kOnHeaders] =
@@ -5588,7 +5602,7 @@ Object.defineProperty(HTTPParser, 'kOnExecute', {
5588
5602
  get: function () {
5589
5603
  // hack for backward compatibility
5590
5604
  compatMode0_12 = false;
5591
- return 4;
5605
+ return 99;
5592
5606
  }
5593
5607
  });
5594
5608
 
@@ -5625,8 +5639,10 @@ var methods = exports.methods = HTTPParser.methods = [
5625
5639
  'PURGE',
5626
5640
  'MKCALENDAR',
5627
5641
  'LINK',
5628
- 'UNLINK'
5642
+ 'UNLINK',
5643
+ 'SOURCE',
5629
5644
  ];
5645
+ var method_connect = methods.indexOf('CONNECT');
5630
5646
  HTTPParser.prototype.reinitialize = HTTPParser;
5631
5647
  HTTPParser.prototype.close =
5632
5648
  HTTPParser.prototype.pause =
@@ -5670,7 +5686,7 @@ HTTPParser.prototype.execute = function (chunk, start, length) {
5670
5686
  length = this.offset - start;
5671
5687
  if (headerState[this.state]) {
5672
5688
  this.headerSize += length;
5673
- if (this.headerSize > HTTPParser.maxHeaderSize) {
5689
+ if (this.headerSize > (this.maxHeaderSize||HTTPParser.maxHeaderSize)) {
5674
5690
  return new Error('max header size exceeded');
5675
5691
  }
5676
5692
  }
@@ -5722,7 +5738,7 @@ HTTPParser.prototype.consumeLine = function () {
5722
5738
  chunk = this.chunk;
5723
5739
  for (var i = this.offset; i < end; i++) {
5724
5740
  if (chunk[i] === 0x0a) { // \n
5725
- var line = this.line + chunk.toString('ascii', this.offset, i);
5741
+ var line = this.line + chunk.toString(HTTPParser.encoding, this.offset, i);
5726
5742
  if (line.charAt(line.length - 1) === '\r') {
5727
5743
  line = line.substr(0, line.length - 1);
5728
5744
  }
@@ -5732,7 +5748,7 @@ HTTPParser.prototype.consumeLine = function () {
5732
5748
  }
5733
5749
  }
5734
5750
  //line split over multiple chunks
5735
- this.line += chunk.toString('ascii', this.offset, this.end);
5751
+ this.line += chunk.toString(HTTPParser.encoding, this.offset, this.end);
5736
5752
  this.offset = this.end;
5737
5753
  };
5738
5754
 
@@ -5773,9 +5789,6 @@ HTTPParser.prototype.REQUEST_LINE = function () {
5773
5789
  if (this.info.method === -1) {
5774
5790
  throw new Error('invalid request method');
5775
5791
  }
5776
- if (match[1] === 'CONNECT') {
5777
- this.info.upgrade = true;
5778
- }
5779
5792
  this.info.url = match[2];
5780
5793
  this.info.versionMajor = +match[3];
5781
5794
  this.info.versionMinor = +match[4];
@@ -5830,6 +5843,7 @@ HTTPParser.prototype.HEADER = function () {
5830
5843
  var headers = info.headers;
5831
5844
  var hasContentLength = false;
5832
5845
  var currentContentLengthValue;
5846
+ var hasUpgradeHeader = false;
5833
5847
  for (var i = 0; i < headers.length; i += 2) {
5834
5848
  switch (headers[i].toLowerCase()) {
5835
5849
  case 'transfer-encoding':
@@ -5855,13 +5869,33 @@ HTTPParser.prototype.HEADER = function () {
5855
5869
  this.connection += headers[i + 1].toLowerCase();
5856
5870
  break;
5857
5871
  case 'upgrade':
5858
- info.upgrade = true;
5872
+ hasUpgradeHeader = true;
5859
5873
  break;
5860
5874
  }
5861
5875
  }
5862
5876
 
5877
+ // if both isChunked and hasContentLength, isChunked wins
5878
+ // This is required so the body is parsed using the chunked method, and matches
5879
+ // Chrome's behavior. We could, maybe, ignore them both (would get chunked
5880
+ // encoding into the body), and/or disable shouldKeepAlive to be more
5881
+ // resilient.
5863
5882
  if (this.isChunked && hasContentLength) {
5864
- throw parseErrorCode('HPE_UNEXPECTED_CONTENT_LENGTH');
5883
+ hasContentLength = false;
5884
+ this.body_bytes = null;
5885
+ }
5886
+
5887
+ // Logic from https://github.com/nodejs/http-parser/blob/921d5585515a153fa00e411cf144280c59b41f90/http_parser.c#L1727-L1737
5888
+ // "For responses, "Upgrade: foo" and "Connection: upgrade" are
5889
+ // mandatory only when it is a 101 Switching Protocols response,
5890
+ // otherwise it is purely informational, to announce support.
5891
+ if (hasUpgradeHeader && this.connection.indexOf('upgrade') != -1) {
5892
+ info.upgrade = this.type === HTTPParser.REQUEST || info.statusCode === 101;
5893
+ } else {
5894
+ info.upgrade = info.method === method_connect;
5895
+ }
5896
+
5897
+ if (this.isChunked && info.upgrade) {
5898
+ this.isChunked = false;
5865
5899
  }
5866
5900
 
5867
5901
  info.shouldKeepAlive = this.shouldKeepAlive();
@@ -5874,13 +5908,16 @@ HTTPParser.prototype.HEADER = function () {
5874
5908
  info.versionMinor, info.headers, info.method, info.url, info.statusCode,
5875
5909
  info.statusMessage, info.upgrade, info.shouldKeepAlive));
5876
5910
  }
5877
- if (info.upgrade || skipBody === 2) {
5911
+ if (skipBody === 2) {
5878
5912
  this.nextRequest();
5879
5913
  return true;
5880
5914
  } else if (this.isChunked && !skipBody) {
5881
5915
  this.state = 'BODY_CHUNKHEAD';
5882
5916
  } else if (skipBody || this.body_bytes === 0) {
5883
5917
  this.nextRequest();
5918
+ // For older versions of node (v6.x and older?), that return skipBody=1 or skipBody=true,
5919
+ // need this "return true;" if it's an upgrade request.
5920
+ return info.upgrade;
5884
5921
  } else if (this.body_bytes === null) {
5885
5922
  this.state = 'BODY_RAW';
5886
5923
  } else {
@@ -5962,6 +5999,7 @@ HTTPParser.prototype.BODY_SIZED = function () {
5962
5999
  set: function (to) {
5963
6000
  // hack for backward compatibility
5964
6001
  this._compatMode0_11 = true;
6002
+ method_connect = 'CONNECT';
5965
6003
  return (this[k] = to);
5966
6004
  }
5967
6005
  });
@@ -6648,7 +6686,7 @@ var Server = function(options) {
6648
6686
  util.inherits(Server, Base);
6649
6687
 
6650
6688
  var instance = {
6651
- EVENTS: ['open', 'message', 'error', 'close'],
6689
+ EVENTS: ['open', 'message', 'error', 'close', 'ping', 'pong'],
6652
6690
 
6653
6691
  _bindEventListeners: function() {
6654
6692
  this.messages.on('error', function() {});
@@ -7487,7 +7525,7 @@ function safeJSONStringify(source) {
7487
7525
 
7488
7526
  // CONCATENATED MODULE: ./src/core/defaults.ts
7489
7527
  var Defaults = {
7490
- VERSION: "7.4.1",
7528
+ VERSION: "7.6.0",
7491
7529
  PROTOCOL: 7,
7492
7530
  wsPort: 80,
7493
7531
  wssPort: 443,
@@ -10233,6 +10271,12 @@ var ajax = function (context, query, authOptions, authRequestType, callback) {
10233
10271
  for (var headerName in authOptions.headers) {
10234
10272
  xhr.setRequestHeader(headerName, authOptions.headers[headerName]);
10235
10273
  }
10274
+ if (authOptions.headersProvider != null) {
10275
+ var dynamicHeaders = authOptions.headersProvider();
10276
+ for (var headerName in dynamicHeaders) {
10277
+ xhr.setRequestHeader(headerName, dynamicHeaders[headerName]);
10278
+ }
10279
+ }
10236
10280
  xhr.onreadystatechange = function () {
10237
10281
  if (xhr.readyState === 4) {
10238
10282
  if (xhr.status === 200) {
@@ -10575,12 +10619,22 @@ var strategy_builder_UnsupportedStrategy = {
10575
10619
 
10576
10620
  var composeChannelQuery = function (params, authOptions) {
10577
10621
  var query = 'socket_id=' + encodeURIComponent(params.socketId);
10578
- for (var i in authOptions.params) {
10622
+ for (var key in authOptions.params) {
10579
10623
  query +=
10580
10624
  '&' +
10581
- encodeURIComponent(i) +
10625
+ encodeURIComponent(key) +
10582
10626
  '=' +
10583
- encodeURIComponent(authOptions.params[i]);
10627
+ encodeURIComponent(authOptions.params[key]);
10628
+ }
10629
+ if (authOptions.paramsProvider != null) {
10630
+ var dynamicParams = authOptions.paramsProvider();
10631
+ for (var key in dynamicParams) {
10632
+ query +=
10633
+ '&' +
10634
+ encodeURIComponent(key) +
10635
+ '=' +
10636
+ encodeURIComponent(dynamicParams[key]);
10637
+ }
10584
10638
  }
10585
10639
  return query;
10586
10640
  };
@@ -10601,12 +10655,22 @@ var UserAuthenticator = function (authOptions) {
10601
10655
  var channel_authorizer_composeChannelQuery = function (params, authOptions) {
10602
10656
  var query = 'socket_id=' + encodeURIComponent(params.socketId);
10603
10657
  query += '&channel_name=' + encodeURIComponent(params.channelName);
10604
- for (var i in authOptions.params) {
10658
+ for (var key in authOptions.params) {
10605
10659
  query +=
10606
10660
  '&' +
10607
- encodeURIComponent(i) +
10661
+ encodeURIComponent(key) +
10608
10662
  '=' +
10609
- encodeURIComponent(authOptions.params[i]);
10663
+ encodeURIComponent(authOptions.params[key]);
10664
+ }
10665
+ if (authOptions.paramsProvider != null) {
10666
+ var dynamicParams = authOptions.paramsProvider();
10667
+ for (var key in dynamicParams) {
10668
+ query +=
10669
+ '&' +
10670
+ encodeURIComponent(key) +
10671
+ '=' +
10672
+ encodeURIComponent(dynamicParams[key]);
10673
+ }
10610
10674
  }
10611
10675
  return query;
10612
10676
  };
@@ -10765,6 +10829,51 @@ function buildChannelAuthorizer(opts, pusher) {
10765
10829
  return channel_authorizer(channelAuthorization);
10766
10830
  }
10767
10831
 
10832
+ // CONCATENATED MODULE: ./src/core/watchlist.ts
10833
+ var watchlist_extends = (undefined && undefined.__extends) || (function () {
10834
+ var extendStatics = function (d, b) {
10835
+ extendStatics = Object.setPrototypeOf ||
10836
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
10837
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
10838
+ return extendStatics(d, b);
10839
+ };
10840
+ return function (d, b) {
10841
+ extendStatics(d, b);
10842
+ function __() { this.constructor = d; }
10843
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10844
+ };
10845
+ })();
10846
+
10847
+
10848
+ var watchlist_WatchlistFacade = (function (_super) {
10849
+ watchlist_extends(WatchlistFacade, _super);
10850
+ function WatchlistFacade(pusher) {
10851
+ var _this = _super.call(this, function (eventName, data) {
10852
+ logger.debug("No callbacks on watchlist events for " + eventName);
10853
+ }) || this;
10854
+ _this.pusher = pusher;
10855
+ _this.bindWatchlistInternalEvent();
10856
+ return _this;
10857
+ }
10858
+ WatchlistFacade.prototype.handleEvent = function (pusherEvent) {
10859
+ var _this = this;
10860
+ pusherEvent.data.events.forEach(function (watchlistEvent) {
10861
+ _this.emit(watchlistEvent.name, watchlistEvent);
10862
+ });
10863
+ };
10864
+ WatchlistFacade.prototype.bindWatchlistInternalEvent = function () {
10865
+ var _this = this;
10866
+ this.pusher.connection.bind('message', function (pusherEvent) {
10867
+ var eventName = pusherEvent.event;
10868
+ if (eventName === 'pusher_internal:watchlist_events') {
10869
+ _this.handleEvent(pusherEvent);
10870
+ }
10871
+ });
10872
+ };
10873
+ return WatchlistFacade;
10874
+ }(dispatcher));
10875
+ /* harmony default export */ var watchlist = (watchlist_WatchlistFacade);
10876
+
10768
10877
  // CONCATENATED MODULE: ./src/core/utils/flat_promise.ts
10769
10878
  function flatPromise() {
10770
10879
  var resolve, reject;
@@ -10794,6 +10903,7 @@ var user_extends = (undefined && undefined.__extends) || (function () {
10794
10903
 
10795
10904
 
10796
10905
 
10906
+
10797
10907
  var user_UserFacade = (function (_super) {
10798
10908
  user_extends(UserFacade, _super);
10799
10909
  function UserFacade(pusher) {
@@ -10827,6 +10937,7 @@ var user_UserFacade = (function (_super) {
10827
10937
  _this._newSigninPromiseIfNeeded();
10828
10938
  }
10829
10939
  });
10940
+ _this.watchlist = new watchlist(pusher);
10830
10941
  _this.pusher.connection.bind('message', function (event) {
10831
10942
  var eventName = event.event;
10832
10943
  if (eventName === 'pusher:signin_success') {