Comparing version 4.22.0 to 4.23.0
@@ -0,1 +1,13 @@ | ||
## [v4.23.0](https://github.com/pubnub/javascript/tree/v4.23.0) | ||
March-14-2019 | ||
[Full Changelog](https://github.com/pubnub/javascript/compare/v4.22.0...v4.23.0) | ||
- ⭐ `timetoken` is deprecated in message-counts API. Use `channelTimetokens` instead, pass one value in `channelTimetokens` to achieve the same results | ||
## [v4.22.0](https://github.com/pubnub/javascript/tree/v4.22.0) | ||
@@ -2,0 +14,0 @@ March-04-2019 |
@@ -1,1 +0,1 @@ | ||
{"errors":[],"warnings":[],"version":"1.15.0","hash":"6cbac5e4dac8492999fb","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":158728,"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":151058,"names":["main"],"files":["pubnub.js"],"hash":"1a330ced7ecb2ed7825d","parents":[],"modules":[],"filteredModules":44,"origins":[{"moduleId":0,"module":"/Users/madison/Documents/repos/javascript/node_modules/babel-loader/lib/index.js!/Users/madison/Documents/repos/javascript/src/titanium/index.js","moduleIdentifier":"/Users/madison/Documents/repos/javascript/node_modules/babel-loader/lib/index.js!/Users/madison/Documents/repos/javascript/src/titanium/index.js","moduleName":"./src/titanium/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":44,"children":[]} | ||
{"errors":[],"warnings":[],"version":"1.15.0","hash":"c97e53a44c54581767af","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":159785,"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":152106,"names":["main"],"files":["pubnub.js"],"hash":"dfbe3f74c84d0ca10359","parents":[],"modules":[],"filteredModules":44,"origins":[{"moduleId":0,"module":"/Users/madison/Documents/repos/javascript/node_modules/babel-loader/lib/index.js!/Users/madison/Documents/repos/javascript/src/titanium/index.js","moduleIdentifier":"/Users/madison/Documents/repos/javascript/node_modules/babel-loader/lib/index.js!/Users/madison/Documents/repos/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.15.0","hash":"5b3391eb97b0567f7acf","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":205640,"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":195825,"names":["main"],"files":["pubnub.js"],"hash":"495343b58b756f9715b7","parents":[],"modules":[],"filteredModules":50,"origins":[{"moduleId":0,"module":"/Users/madison/Documents/repos/javascript/node_modules/babel-loader/lib/index.js!/Users/madison/Documents/repos/javascript/src/web/index.js","moduleIdentifier":"/Users/madison/Documents/repos/javascript/node_modules/babel-loader/lib/index.js!/Users/madison/Documents/repos/javascript/src/web/index.js","moduleName":"./src/web/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":50,"children":[]} | ||
{"errors":[],"warnings":[],"version":"1.15.0","hash":"a5f33996074866c3f512","publicPath":"","assetsByChunkName":{"main":"pubnub.js"},"assets":[{"name":"pubnub.js","size":206697,"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":196873,"names":["main"],"files":["pubnub.js"],"hash":"906f018f7c7f42f99c5c","parents":[],"modules":[],"filteredModules":50,"origins":[{"moduleId":0,"module":"/Users/madison/Documents/repos/javascript/node_modules/babel-loader/lib/index.js!/Users/madison/Documents/repos/javascript/src/web/index.js","moduleIdentifier":"/Users/madison/Documents/repos/javascript/node_modules/babel-loader/lib/index.js!/Users/madison/Documents/repos/javascript/src/web/index.js","moduleName":"./src/web/index.js","loc":"","name":"main","reasons":[]}]}],"modules":[],"filteredModules":50,"children":[]} |
@@ -181,3 +181,3 @@ 'use strict'; | ||
value: function getVersion() { | ||
return '4.22.0'; | ||
return '4.23.0'; | ||
} | ||
@@ -184,0 +184,0 @@ }, { |
@@ -6,2 +6,5 @@ 'use strict'; | ||
}); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
exports.getOperation = getOperation; | ||
@@ -38,2 +41,3 @@ exports.validateParams = validateParams; | ||
if (timetoken && channelTimetokens) return 'timetoken and channelTimetokens are incompatible together'; | ||
if (timetoken && channelTimetokens && channelTimetokens.length > 1 && channels.length !== channelTimetokens.length) return 'Length of channelTimetokens and channels do not match'; | ||
if (!config.subscribeKey) return 'Missing Subscribe Key'; | ||
@@ -68,5 +72,13 @@ } | ||
if (timetoken) outgoingParams.timetoken = timetoken; | ||
if (channelTimetokens) outgoingParams.channelTimetokens = _utils2.default.encodeString(channelTimetokens.join(',')); | ||
if (channelTimetokens && channelTimetokens.length === 1) { | ||
var _channelTimetokens = _slicedToArray(channelTimetokens, 1), | ||
tt = _channelTimetokens[0]; | ||
outgoingParams.timetoken = tt; | ||
} else if (channelTimetokens) { | ||
outgoingParams.channelsTimetoken = channelTimetokens.join(','); | ||
} else if (timetoken) { | ||
outgoingParams.timetoken = timetoken; | ||
} | ||
return outgoingParams; | ||
@@ -76,5 +88,4 @@ } | ||
function handleResponse(modules, serverResponse) { | ||
return { channels: serverResponse.channels }; | ||
} | ||
//# sourceMappingURL=message_counts.js.map |
@@ -77,3 +77,3 @@ 'use strict'; | ||
var url = this.getStandardOrigin() + endpoint.url; | ||
return xdr.call(this, 'GET', url, params, null, endpoint, callback); | ||
return xdr.call(this, 'GET', url, params, '', endpoint, callback); | ||
} | ||
@@ -88,4 +88,4 @@ | ||
var url = this.getStandardOrigin() + endpoint.url; | ||
return xdr.call(this, 'DELETE', url, params, null, endpoint, callback); | ||
return xdr.call(this, 'DELETE', url, params, '', endpoint, callback); | ||
} | ||
//# sourceMappingURL=nativescript.js.map |
{ | ||
"name": "pubnub", | ||
"version": "4.22.0", | ||
"version": "4.23.0", | ||
"author": "PubNub <support@pubnub.com>", | ||
@@ -5,0 +5,0 @@ "description": "Publish & Subscribe Real-time Messaging with PubNub", |
@@ -25,3 +25,3 @@ # PubNub JavaScript SDK (V4) | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.22.0.min.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.22.0.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.23.0.min.js | ||
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.23.0.js |
@@ -231,3 +231,3 @@ /* @flow */ | ||
getVersion(): string { | ||
return '4.22.0'; | ||
return '4.23.0'; | ||
} | ||
@@ -234,0 +234,0 @@ |
@@ -22,2 +22,3 @@ /* @flow */ | ||
if (timetoken && channelTimetokens) return 'timetoken and channelTimetokens are incompatible together'; | ||
if ((timetoken && channelTimetokens) && (channelTimetokens.length > 1) && (channels.length !== channelTimetokens.length)) return 'Length of channelTimetokens and channels do not match'; | ||
if (!config.subscribeKey) return 'Missing Subscribe Key'; | ||
@@ -47,4 +48,10 @@ } | ||
if (timetoken) outgoingParams.timetoken = timetoken; | ||
if (channelTimetokens) outgoingParams.channelTimetokens = utils.encodeString(channelTimetokens.join(',')); | ||
if ((channelTimetokens) && (channelTimetokens.length === 1)) { | ||
let [tt] = channelTimetokens; | ||
outgoingParams.timetoken = tt; | ||
} else if (channelTimetokens) { | ||
outgoingParams.channelsTimetoken = channelTimetokens.join(','); | ||
} else if (timetoken) { | ||
outgoingParams.timetoken = timetoken; | ||
} | ||
@@ -54,6 +61,4 @@ return outgoingParams; | ||
export function handleResponse(modules: ModulesInject, serverResponse: MessageCounterArguments) | ||
: MessageCountersResponse { | ||
export function handleResponse(modules: ModulesInject, serverResponse: MessageCounterArguments): MessageCountersResponse { | ||
return { channels: serverResponse.channels }; | ||
} |
@@ -68,3 +68,3 @@ /* @flow */ | ||
let url = this.getStandardOrigin() + endpoint.url; | ||
return xdr.call(this, 'GET', url, params, null, endpoint, callback); | ||
return xdr.call(this, 'GET', url, params, '', endpoint, callback); | ||
} | ||
@@ -79,3 +79,3 @@ | ||
let url = this.getStandardOrigin() + endpoint.url; | ||
return xdr.call(this, 'DELETE', url, params, null, endpoint, callback); | ||
return xdr.call(this, 'DELETE', url, params, '', endpoint, callback); | ||
} |
@@ -51,10 +51,36 @@ /* global describe, beforeEach, it, before, after */ | ||
it('get history with messages for a channel using channelTimetokens', (done) => { | ||
const scope = utils.createNock().get('/v3/history/sub-key/mySubKey/message-counts/ch1') | ||
.query({ timetoken: '15495750401727535', pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, uuid: 'myUUID' }) | ||
.reply(200, '{"status": 200, "error": false, "error_message": "", "channels": {"ch1":2}}'); | ||
pubnub.messageCounts({ channels: ['ch1'], channelTimetokens: ['15495750401727535'] }, (status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.channels, { ch1: 2 }); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
}); | ||
}); | ||
it('get history with messages for multiple channels using channelTimetokens', (done) => { | ||
const scope = utils.createNock().get('/v3/history/sub-key/mySubKey/message-counts/ch1%2Cch2%2Cch3') | ||
.query({ channelTimetokens: '15495750401727535%2C15495750401727536%2C15495750401727537', pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, uuid: 'myUUID' }) | ||
.reply(200, '{"status": 200, "error": false, "error_message": "", "channels": {"ch1":0,"ch2":0,"ch3":0}}'); | ||
.query({ timetoken: '15495750401727535', pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, uuid: 'myUUID' }) | ||
.reply(200, '{"status": 200, "error": false, "error_message": "", "channels": {"ch1":0,"ch2":3,"ch3":0}}'); | ||
pubnub.messageCounts({ channels: ['ch1', 'ch2', 'ch3'], channelTimetokens: ['15495750401727535'] }, (status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.channels, { ch1: 0, ch2: 3, ch3: 0 }); | ||
assert.equal(scope.isDone(), true); | ||
done(); | ||
}); | ||
}); | ||
it('get history with messages for multiple channels using multiple channelTimetokens', (done) => { | ||
const scope = utils.createNock().get('/v3/history/sub-key/mySubKey/message-counts/ch1%2Cch2%2Cch3') | ||
.query({ channelsTimetoken: '15495750401727535,15495750401727536,15495750401727537', pnsdk: `PubNub-JS-Nodejs/${pubnub.getVersion()}`, uuid: 'myUUID' }) | ||
.reply(200, '{"status": 200, "error": false, "error_message": "", "channels": {"ch1":0,"ch2":0,"ch3":4}}'); | ||
pubnub.messageCounts({ channels: ['ch1', 'ch2', 'ch3'], channelTimetokens: ['15495750401727535', '15495750401727536', '15495750401727537'] }, (status, response) => { | ||
assert.equal(status.error, false); | ||
assert.deepEqual(response.channels, { ch1: 0, ch2: 0, ch3: 0 }); | ||
assert.deepEqual(response.channels, { ch1: 0, ch2: 0, ch3: 4 }); | ||
assert.equal(scope.isDone(), true); | ||
@@ -64,2 +90,2 @@ done(); | ||
}); | ||
}); | ||
}); |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1828794
19979