Socket
Socket
Sign inDemoInstall

pubnub

Package Overview
Dependencies
Maintainers
4
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pubnub - npm Package Compare versions

Comparing version 4.8.0 to 4.9.0

lib/networking/modules/react_native.js

2

dist/titanium/stats.json

@@ -1,1 +0,1 @@

{"errors":[],"warnings":[],"version":"1.14.0","hash":"55ae2f11609be179e06a","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":147371,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":140287,"names":["main"],"files":["pubnub.js"],"hash":"dc009d2f3e552db012c8","parents":[],"modules":[],"filteredModules":43,"origins":[{"moduleId":0,"module":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/titanium/index.js","moduleIdentifier":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/titanium/index.js","moduleName":"./src/titanium/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":43,"children":[]}
{"errors":[],"warnings":[],"version":"1.15.0","hash":"9565a2906e8106190292","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":149038,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":141765,"names":["main"],"files":["pubnub.js"],"hash":"b55c899c39b145f5ba6e","parents":[],"modules":[],"filteredModules":44,"origins":[{"moduleId":0,"module":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/titanium/index.js","moduleIdentifier":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/titanium/index.js","moduleName":"./src/titanium/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":44,"children":[]}

@@ -1,1 +0,1 @@

{"errors":[],"warnings":[],"version":"1.14.0","hash":"7500975803a3253cde94","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":181605,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":172858,"names":["main"],"files":["pubnub.js"],"hash":"8d38d0fc1b8ae81ec64a","parents":[],"modules":[],"filteredModules":48,"origins":[{"moduleId":0,"module":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/web/index.js","moduleIdentifier":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/web/index.js","moduleName":"./src/web/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":48,"children":[]}
{"errors":[],"warnings":[],"version":"1.15.0","hash":"6be8cf6a01830d371a5e","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":183009,"chunks":[0],"chunkNames":["main"],"emitted":true},{"name":"stats.json","size":0,"chunks":[],"chunkNames":[]}],"chunks":[{"id":0,"rendered":true,"initial":true,"entry":true,"extraAsync":false,"size":174131,"names":["main"],"files":["pubnub.js"],"hash":"af4072df623b2f9fc07f","parents":[],"modules":[],"filteredModules":48,"origins":[{"moduleId":0,"module":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/web/index.js","moduleIdentifier":"/Users/Max/Desktop/CLIENT_CONTROL/javascript/node_modules/babel-loader/lib/index.js!/Users/Max/Desktop/CLIENT_CONTROL/javascript/src/web/index.js","moduleName":"./src/web/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":48,"children":[]}

@@ -134,2 +134,8 @@ /* eslint no-console: 0, arrow-body-style: 0 */

gulp.task('test_react-native', () => {
return gulp.src('test/dist/react-native.test.js', { read: false })
.pipe(mocha({ reporter: 'spec' }))
.pipe(gulpIstanbul.writeReports({ reporters: ['json', 'lcov', 'text'] }));
});
gulp.task('test_release', () => {

@@ -141,3 +147,5 @@ return gulp.src('test/release/**/*.test.js', { read: false })

gulp.task('test', (done) => {
runSequence('pre-test', 'test_node', 'test_web', 'test_titanium', 'test_release', 'validate', done);
runSequence('pre-test', 'test_node', 'test_web', 'test_titanium', 'test_react-native', 'test_release', 'validate', () => {
process.exit();
});
});

@@ -144,0 +152,0 @@

@@ -46,2 +46,5 @@ 'use strict';

this.customEncrypt = setup.customEncrypt;
this.customDecrypt = setup.customDecrypt;
if (typeof location !== 'undefined' && location.protocol === 'https:') {

@@ -169,3 +172,3 @@ this.secure = true;

value: function getVersion() {
return '4.8.0';
return '4.9.0';
}

@@ -172,0 +175,0 @@ }, {

@@ -115,2 +115,20 @@ 'use strict';

value: function encrypt(data, customCipherKey, options) {
if (this._config.customEncrypt) {
return this._config.customEncrypt(data);
} else {
return this.pnEncrypt(data, customCipherKey, options);
}
}
}, {
key: 'decrypt',
value: function decrypt(data, customCipherKey, options) {
if (this._config.customDecrypt) {
return this._config.customDecrypt(data);
} else {
return this.pnDecrypt(data, customCipherKey, options);
}
}
}, {
key: 'pnEncrypt',
value: function pnEncrypt(data, customCipherKey, options) {
if (!customCipherKey && !this._config.cipherKey) return data;

@@ -126,4 +144,4 @@ options = this._parseOptions(options);

}, {
key: 'decrypt',
value: function decrypt(data, customCipherKey, options) {
key: 'pnDecrypt',
value: function pnDecrypt(data, customCipherKey, options) {
if (!customCipherKey && !this._config.cipherKey) return data;

@@ -130,0 +148,0 @@ options = this._parseOptions(options);

@@ -73,2 +73,3 @@ 'use strict';

this._lastTimetoken = 0;
this._storedTimetoken = null;

@@ -126,2 +127,7 @@ this._subscriptionStatusAnnounced = false;

if (this._currentTimetoken !== '0') {
this._storedTimetoken = this._currentTimetoken;
this._currentTimetoken = 0;
}
channels.forEach(function (channel) {

@@ -178,2 +184,3 @@ _this2._channels[channel] = { state: {} };

this._currentTimetoken = 0;
this._storedTimetoken = null;
this._region = null;

@@ -324,2 +331,5 @@ this._reconnectionManager.stopPolling();

this._listenerManager.announceStatus(status);
} else if (status.category === _categories2.default.PNBadRequestCategory) {
this._stopHeartbeatTimer();
this._listenerManager.announceStatus(status);
} else {

@@ -332,4 +342,9 @@ this._listenerManager.announceStatus(status);

this._lastTimetoken = this._currentTimetoken;
this._currentTimetoken = payload.metadata.timetoken;
if (this._storedTimetoken) {
this._currentTimetoken = this._storedTimetoken;
this._storedTimetoken = null;
} else {
this._lastTimetoken = this._currentTimetoken;
this._currentTimetoken = payload.metadata.timetoken;
}

@@ -341,2 +356,3 @@ if (!this._subscriptionStatusAnnounced) {

connectedAnnounce.affectedChannels = this._pendingChannelSubscriptions;
connectedAnnounce.subscribedChannels = this.getSubscribedChannels();
connectedAnnounce.affectedChannelGroups = this._pendingChannelGroupSubscriptions;

@@ -343,0 +359,0 @@ connectedAnnounce.lastTimetoken = this._lastTimetoken;

@@ -230,4 +230,4 @@ 'use strict';

this.encrypt = crypto.encrypt.bind(crypto);
this.decrypt = crypto.decrypt.bind(crypto);
this.encrypt = crypto.pnEncrypt.bind(crypto);
this.decrypt = crypto.pnDecrypt.bind(crypto);

@@ -234,0 +234,0 @@ this.getAuthKey = modules.config.getAuthKey.bind(modules.config);

@@ -6,5 +6,2 @@ 'use strict';

});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.get = get;

@@ -15,2 +12,4 @@ exports.post = post;

var _utils = require('../utils');
function log(url, qs, res) {

@@ -53,30 +52,2 @@ var _pickLogger = function _pickLogger() {

function encodedKeyValuePair(pairs, key, value) {
if (value != null) {
if (Array.isArray(value)) {
value.forEach(function (item) {
encodedKeyValuePair(pairs, key, item);
});
} else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
Object.keys(value).forEach(function (subkey) {
encodedKeyValuePair(pairs, key + '[' + subkey + ']', value[subkey]);
});
} else {
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
}
} else if (value === null) {
pairs.push(encodeURIComponent('' + encodeURIComponent(key)));
}
}
function buildUrl(url, params) {
var pairs = [];
Object.keys(params).forEach(function (key) {
encodedKeyValuePair(pairs, key, params[key]);
});
return url + '?' + pairs.join('&');
}
function xdr(xhr, method, url, params, body, endpoint, callback) {

@@ -88,3 +59,3 @@ var _this = this;

xhr.open(method, buildUrl(url, params), true);
xhr.open(method, (0, _utils.buildUrl)(url, params), true);

@@ -91,0 +62,0 @@ keepAlive.call(this, xhr);

@@ -19,3 +19,3 @@ 'use strict';

var _webNode = require('../networking/modules/web-node');
var _react_native = require('../networking/modules/react_native');

@@ -39,4 +39,5 @@ var _flow_interfaces = require('../core/flow_interfaces');

setup.db = new _common2.default();
setup.networking = new _networking2.default({ get: _webNode.get, post: _webNode.post });
setup.networking = new _networking2.default({ get: _react_native.get, post: _react_native.post });
setup.sdkFamily = 'ReactNative';
setup.ssl = true;
return _possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).call(this, setup));

@@ -43,0 +44,0 @@ }

{
"name": "pubnub",
"version": "4.8.0",
"version": "4.9.0",
"author": "PubNub <support@pubnub.com>",

@@ -49,3 +49,3 @@ "description": "Publish & Subscribe Real-time Messaging with PubNub",

"eslint-plugin-react": "^6.9.0",
"flow-bin": "^0.39.0",
"flow-bin": "^0.44.0",
"gulp": "^3.9.1",

@@ -59,3 +59,3 @@ "gulp-babel": "^6.1.2",

"gulp-istanbul": "^1.1.1",
"gulp-mocha": "^3.0.1",
"gulp-mocha": "^4.3.0",
"gulp-rename": "^1.2.2",

@@ -77,10 +77,11 @@ "gulp-sourcemaps": "^2.4.0",

"karma-sinon-chai": "^1.2.4",
"karma-spec-reporter": "^0.0.26",
"karma-spec-reporter": "^0.0.31",
"mocha": "^3.2.0",
"nock": "^9.0.2",
"node-fetch": "^1.6.3",
"phantomjs-prebuilt": "^2.1.14",
"run-sequence": "^1.2.2",
"sinon": "^1.17.7",
"sinon": "^2.1.0",
"sinon-chai": "^2.8.0",
"stats-webpack-plugin": "^0.4.3",
"stats-webpack-plugin": "^0.6.0",
"uglify-js": "^2.7.5",

@@ -97,2 +98,2 @@ "underscore": "^1.8.3",

}
}
}

@@ -22,3 +22,3 @@ # PubNub JavaScript SDK (V4)

## CDN Links
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.8.0.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.8.0.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.9.0.min.js
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.9.0.js

@@ -111,2 +111,8 @@ /* @flow */

/*
support customp encryption and decryption functions.
*/
customEncrypt: Function // function to support custome encryption of messages
customDecrypt: Function // function used to decrypt old version messages
constructor({ setup, db } : ConfigConstructArgs) {

@@ -133,2 +139,5 @@ this._db = db;

this.customEncrypt = setup.customEncrypt;
this.customDecrypt = setup.customDecrypt;
// if location config exist and we are in https, force secure to true.

@@ -201,3 +210,3 @@ if (typeof location !== 'undefined' && location.protocol === 'https:') {

getVersion(): string {
return '4.8.0';
return '4.9.0';
}

@@ -204,0 +213,0 @@

@@ -101,2 +101,18 @@ /* @flow */

encrypt(data: string, customCipherKey: ?string, options: ?Object): Object | string | null {
if (this._config.customEncrypt) {
return this._config.customEncrypt(data);
} else {
return this.pnEncrypt(data, customCipherKey, options);
}
}
decrypt(data: string, customCipherKey: ?string, options: ?Object): Object | string | null {
if (this._config.customDecrypt) {
return this._config.customDecrypt(data);
} else {
return this.pnDecrypt(data, customCipherKey, options);
}
}
pnEncrypt(data: string, customCipherKey: ?string, options: ?Object): Object | string | null {
if (!customCipherKey && !this._config.cipherKey) return data;

@@ -112,3 +128,3 @@ options = this._parseOptions(options);

decrypt(data: Object, customCipherKey: ?string, options: ?Object): Object | null {
pnDecrypt(data: Object, customCipherKey: ?string, options: ?Object): Object | null {
if (!customCipherKey && !this._config.cipherKey) return data;

@@ -115,0 +131,0 @@ options = this._parseOptions(options);

@@ -59,2 +59,4 @@ /* @flow */

_lastTimetoken: number;
_storedTimetoken: ?number;
_region: ?number;

@@ -94,2 +96,3 @@

this._lastTimetoken = 0;
this._storedTimetoken = null;

@@ -128,2 +131,8 @@ this._subscriptionStatusAnnounced = false;

// reset the current timetoken to get a connect event.
if (this._currentTimetoken !== '0') {
this._storedTimetoken = this._currentTimetoken;
this._currentTimetoken = 0;
}
channels.forEach((channel: string) => {

@@ -177,2 +186,3 @@ this._channels[channel] = { state: {} };

this._currentTimetoken = 0;
this._storedTimetoken = null;
this._region = null;

@@ -303,2 +313,5 @@ this._reconnectionManager.stopPolling();

this._listenerManager.announceStatus(status);
} else if (status.category === categoryConstants.PNBadRequestCategory) {
this._stopHeartbeatTimer();
this._listenerManager.announceStatus(status);
} else {

@@ -311,6 +324,10 @@ this._listenerManager.announceStatus(status);

this._lastTimetoken = this._currentTimetoken;
this._currentTimetoken = payload.metadata.timetoken;
if (this._storedTimetoken) {
this._currentTimetoken = this._storedTimetoken;
this._storedTimetoken = null;
} else {
this._lastTimetoken = this._currentTimetoken;
this._currentTimetoken = payload.metadata.timetoken;
}
if (!this._subscriptionStatusAnnounced) {

@@ -321,2 +338,3 @@ let connectedAnnounce: StatusAnnouncement = {};

connectedAnnounce.affectedChannels = this._pendingChannelSubscriptions;
connectedAnnounce.subscribedChannels = this.getSubscribedChannels();
connectedAnnounce.affectedChannelGroups = this._pendingChannelGroupSubscriptions;

@@ -323,0 +341,0 @@ connectedAnnounce.lastTimetoken = this._lastTimetoken;

@@ -195,4 +195,4 @@ /* @flow */

// mount crypto
this.encrypt = crypto.encrypt.bind(crypto);
this.decrypt = crypto.decrypt.bind(crypto);
this.encrypt = crypto.pnEncrypt.bind(crypto);
this.decrypt = crypto.pnDecrypt.bind(crypto);

@@ -199,0 +199,0 @@ /** config **/

@@ -5,2 +5,3 @@ /* @flow */

import { EndpointDefinition, StatusAnnouncement } from '../../core/flow_interfaces';
import { buildUrl } from '../utils';

@@ -46,30 +47,2 @@ declare var Ti: any;

function encodedKeyValuePair(pairs, key: string, value: Object): void {
if (value != null) {
if (Array.isArray(value)) {
value.forEach((item) => {
encodedKeyValuePair(pairs, key, item);
});
} else if (typeof value === 'object') {
Object.keys(value).forEach((subkey) => {
encodedKeyValuePair(pairs, `${key}[${subkey}]`, value[subkey]);
});
} else {
pairs.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
}
} else if (value === null) {
pairs.push(encodeURIComponent(`${encodeURIComponent(key)}`));
}
}
function buildUrl(url: string, params: Object) {
let pairs = [];
Object.keys(params).forEach((key) => {
encodedKeyValuePair(pairs, key, params[key]);
});
return `${url}?${pairs.join('&')}`;
}
function xdr(xhr: any, method: string, url: string, params: Object, body: Object, endpoint: EndpointDefinition, callback: Function): void {

@@ -76,0 +49,0 @@ let status: StatusAnnouncement = {};

@@ -6,3 +6,3 @@ /* @flow */

import Database from '../db/common';
import { get, post } from '../networking/modules/web-node';
import { get, post } from '../networking/modules/react_native';
import { InternalSetupStruct } from '../core/flow_interfaces';

@@ -15,4 +15,5 @@

setup.sdkFamily = 'ReactNative';
setup.ssl = true;
super(setup);
}
}

@@ -9,3 +9,3 @@ /* global describe, beforeEach, it, before, afterEach, after, PubNub, chai */

describe('#distribution test', function () {
describe('#distribution test (titanium)', function () {
it('should have to subscribe a channel', function (done) {

@@ -12,0 +12,0 @@ listener = {

@@ -40,2 +40,8 @@ /* global describe, beforeEach, it, before, afterEach, after */

});
it('supports decryption with custom key', () => {
let pn = new PubNub({});
assert.deepEqual(pn.decrypt('TejX6F2JNqH/gIiGHWN4Cw==', 'customKey'), { hi: 'there' });
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc