Skip to content

Commit

Permalink
add built bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
WillSewell committed Nov 18, 2019
1 parent 6a26e40 commit 432ad3a
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 110 deletions.
96 changes: 62 additions & 34 deletions dist/node/pusher.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Pusher JavaScript Library v5.0.2
* Pusher JavaScript Library v5.0.3
* https://pusher.com/
*
* Copyright 2017, Pusher
Expand Down Expand Up @@ -125,6 +125,8 @@ function SafeBuffer (arg, encodingOrOffset, length) {
return Buffer(arg, encodingOrOffset, length)
}

SafeBuffer.prototype = Object.create(Buffer.prototype)

// Copy static methods from Buffer
copyProps(Buffer, SafeBuffer)

Expand Down Expand Up @@ -7073,7 +7075,7 @@ function safeJSONStringify(source) {

// CONCATENATED MODULE: ./src/core/defaults.ts
var Defaults = {
VERSION: "5.0.2",
VERSION: "5.0.3",
PROTOCOL: 7,
host: 'ws.pusherapp.com',
ws_port: 80,
Expand Down Expand Up @@ -7247,37 +7249,68 @@ var dispatcher_Dispatcher = (function () {
// CONCATENATED MODULE: ./src/core/logger.ts


var Logger = {
debug: function () {
var logger_Logger = (function () {
function Logger() {
this.globalLog = function (message) {
if (global.console && global.console.log) {
global.console.log(message);
}
};
}
Logger.prototype.debug = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (!core_pusher.log) {
return;
this.log(this.globalLog, args);
};
Logger.prototype.warn = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
core_pusher.log(stringify.apply(this, arguments));
},
warn: function () {
this.log(this.globalLogWarn, args);
};
Logger.prototype.error = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
this.log(this.globalLogError, args);
};
Logger.prototype.globalLogWarn = function (message) {
if (global.console && global.console.warn) {
global.console.warn(message);
}
else {
this.globalLog(message);
}
};
Logger.prototype.globalLogError = function (message) {
if (global.console && global.console.error) {
global.console.error(message);
}
else {
this.globalLogWarn(message);
}
};
Logger.prototype.log = function (defaultLoggingFunction) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var message = stringify.apply(this, arguments);
if (core_pusher.log) {
core_pusher.log(message);
}
else if (global.console) {
if (global.console.warn) {
global.console.warn(message);
}
else if (global.console.log) {
global.console.log(message);
}
else if (core_pusher.logToConsole) {
var log = defaultLoggingFunction.bind(this);
log(message);
}
}
};
/* harmony default export */ var logger = (Logger);
};
return Logger;
}());
/* harmony default export */ var logger = (new logger_Logger());

// CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
var transport_connection_extends = (undefined && undefined.__extends) || (function () {
Expand Down Expand Up @@ -8077,6 +8110,7 @@ var channel_Channel = (function (_super) {
this.subscriptionCancelled = false;
this.authorize(this.pusher.connection.socket_id, function (error, data) {
if (error) {
logger.error(data);
_this.emit('pusher:subscription_error', data);
}
else {
Expand Down Expand Up @@ -8220,7 +8254,7 @@ var presence_channel_PresenceChannel = (function (_super) {
if (!error) {
if (authData.channel_data === undefined) {
var suffix = url_store.buildLogSuffix("authenticationEndpoint");
logger.warn("Invalid auth response for channel '" + _this.name + "'," +
logger.error("Invalid auth response for channel '" + _this.name + "'," +
("expected 'channel_data' field. " + suffix));
callback("Invalid auth response");
return;
Expand Down Expand Up @@ -8326,7 +8360,6 @@ var encrypted_channel_EncryptedChannel = (function (_super) {
if (!sharedSecret) {
var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
callback(true, errorMsg);
logger.warn("Error: " + errorMsg);
return;
}
_this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
Expand All @@ -8353,30 +8386,30 @@ var encrypted_channel_EncryptedChannel = (function (_super) {
return;
}
if (!data.ciphertext || !data.nonce) {
logger.warn('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
return;
}
var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
logger.warn("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
return;
}
var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
if (nonce.length < nacl_fast["secretbox"].nonceLength) {
logger.warn("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
return;
}
var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
if (bytes === null) {
logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
this.authorize(this.pusher.connection.socket_id, function (error, authData) {
if (error) {
logger.warn("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
return;
}
bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
if (bytes === null) {
logger.warn("Failed to decrypt event with new key. Dropping encrypted event");
logger.error("Failed to decrypt event with new key. Dropping encrypted event");
return;
}
_this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
Expand Down Expand Up @@ -9703,15 +9736,15 @@ var ajax = function (context, socketId, callback) {
parsed = true;
}
catch (e) {
callback(true, 'JSON returned from webapp was invalid, yet status code was 200. Data was: ' + xhr.responseText);
callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
}
if (parsed) {
callback(false, data);
}
}
else {
var suffix = url_store.buildLogSuffix("authenticationEndpoint");
logger.warn('Unable to retrieve auth string from auth endpoint - ' +
logger.error('Unable to retrieve auth string from auth endpoint - ' +
("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
("Clients must be authenticated to join private or presence channels. " + suffix));
callback(true, xhr.status);
Expand Down Expand Up @@ -10126,7 +10159,7 @@ var pusher_Pusher = (function () {
_this.channels.disconnect();
});
this.connection.bind('error', function (err) {
logger.warn('Error', err);
logger.warn(err);
});
Pusher.instances.push(this);
this.timeline.info({ instances: Pusher.instances.length });
Expand All @@ -10140,11 +10173,6 @@ var pusher_Pusher = (function () {
Pusher.instances[i].connect();
}
};
Pusher.log = function (message) {
if (Pusher.logToConsole && global.console && global.console.log) {
global.console.log(message);
}
};
Pusher.getClientFeatures = function () {
return keys(filterObject({ ws: node_runtime.Transports.ws }, function (t) {
return t.isSupported({});
Expand Down
4 changes: 2 additions & 2 deletions dist/react-native/pusher.js

Large diffs are not rendered by default.

Loading

0 comments on commit 432ad3a

Please sign in to comment.