Skip to content

Commit f23c9f6

Browse files
Releasing v4.29.5
1 parent be73a09 commit f23c9f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1166
-414
lines changed

.pubnub.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
---
22
changelog:
3+
-
4+
changes:
5+
-
6+
text: "Add support for file upload via file URI in React Native."
7+
type: feature
8+
-
9+
text: "Fix file download to ArrayBuffer in React Native."
10+
type: bug
11+
date: 2020-09-01
12+
version: v4.29.5
313
-
414
changes:
515
-
@@ -930,4 +940,4 @@ supported-platforms:
930940
- "Ubuntu 14.04 and up"
931941
- "Windows 7 and up"
932942
version: "Pubnub Javascript for Node"
933-
version: "4.29.4"
943+
version: "4.29.5"

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## [v4.29.5](https://github.com/pubnub/javascript/releases/tag/v4.29.5)
2+
September-01-2020
3+
4+
[Full Changelog](https://github.com/pubnub/javascript/compare/v4.29.4...v4.29.5)
5+
6+
- 🌟️ Add support for file upload via file URI in React Native.
7+
- 🐛 Fix file download to ArrayBuffer in React Native.
8+
19
## [v4.29.4](https://github.com/pubnub/javascript/releases/tag/v4.29.4)
210
August-14-2020
311

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ please use the [master_3x](https://github.com/pubnub/javascript/tree/master_3x)
2222

2323

2424

25-
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.29.4.min.js
26-
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.29.4.js
25+
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.29.5.min.js
26+
* https://cdn.pubnub.com/sdk/javascript/pubnub.4.29.5.js

dist/titanium/pubnub.js

+84-46
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! 4.29.4 / Consumer */
1+
/*! 4.29.5 / Consumer */
22
exports["PubNub"] =
33
/******/ (function(modules) { // webpackBootstrap
44
/******/ // The module cache
@@ -566,7 +566,7 @@ var _default = function () {
566566
}, {
567567
key: "getVersion",
568568
value: function getVersion() {
569-
return '4.29.4';
569+
return '4.29.5';
570570
}
571571
}, {
572572
key: "_addPnsdkSuffix",
@@ -827,6 +827,8 @@ function decideURL(endpoint, modules, incomingParams) {
827827
return endpoint.postURL(modules, incomingParams);
828828
} else if (endpoint.usePatch && endpoint.usePatch(modules, incomingParams)) {
829829
return endpoint.patchURL(modules, incomingParams);
830+
} else if (endpoint.useGetFile && endpoint.useGetFile(modules, incomingParams)) {
831+
return endpoint.getFileURL(modules, incomingParams);
830832
} else {
831833
return endpoint.getURL(modules, incomingParams);
832834
}
@@ -871,6 +873,8 @@ function getHttpMethod(modules, endpoint, incomingParams) {
871873
return 'PATCH';
872874
} else if (endpoint.useDelete && endpoint.useDelete(modules, incomingParams)) {
873875
return 'DELETE';
876+
} else if (endpoint.useGetFile && endpoint.useGetFile(modules, incomingParams)) {
877+
return 'GETFILE';
874878
} else {
875879
return 'GET';
876880
}
@@ -989,6 +993,8 @@ function _default(modules, endpoint) {
989993
}
990994

991995
var onResponse = function onResponse(status, payload) {
996+
var _responseP;
997+
992998
if (status.error) {
993999
if (callback) {
9941000
callback(status);
@@ -1002,7 +1008,7 @@ function _default(modules, endpoint) {
10021008
telemetryManager.stopLatencyMeasure(endpoint.getOperation(), requestId);
10031009
var responseP = endpoint.handleResponse(modules, payload, incomingParams);
10041010

1005-
if (typeof responseP.then !== 'function') {
1011+
if (typeof ((_responseP = responseP) === null || _responseP === void 0 ? void 0 : _responseP.then) !== 'function') {
10061012
responseP = Promise.resolve(responseP);
10071013
}
10081014

@@ -1032,6 +1038,8 @@ function _default(modules, endpoint) {
10321038
callInstance = networking.PATCH(outgoingParams, _payload2, networkingParams, onResponse);
10331039
} else if (getHttpMethod(modules, endpoint, incomingParams) === 'DELETE') {
10341040
callInstance = networking.DELETE(outgoingParams, networkingParams, onResponse);
1041+
} else if (getHttpMethod(modules, endpoint, incomingParams) === 'GETFILE') {
1042+
callInstance = networking.GETFILE(outgoingParams, networkingParams, onResponse);
10351043
} else {
10361044
callInstance = networking.GET(outgoingParams, networkingParams, onResponse);
10371045
}
@@ -7714,7 +7722,7 @@ var sendFile = function sendFile(_ref) {
77147722
id = _yield$generateUpload3.id;
77157723
name = _yield$generateUpload3.name;
77167724

7717-
if (!(cipherKey !== null && cipherKey !== void 0 ? cipherKey : config.cipherKey)) {
7725+
if (!(PubNubFile.supportsEncryptFile && (cipherKey !== null && cipherKey !== void 0 ? cipherKey : config.cipherKey))) {
77187726
_context.next = 19;
77197727
break;
77207728
}
@@ -7739,7 +7747,7 @@ var sendFile = function sendFile(_ref) {
77397747

77407748
_context.prev = 21;
77417749

7742-
if (!PubNubFile.supportsFile) {
7750+
if (!(PubNubFile.supportsFileUri && input.uri)) {
77437751
_context.next = 34;
77447752
break;
77457753
}
@@ -7748,20 +7756,20 @@ var sendFile = function sendFile(_ref) {
77487756
_context.t1 = url;
77497757
_context.t2 = formFieldsWithMimeType;
77507758
_context.next = 28;
7751-
return file.toFile();
7759+
return file.toFileUri();
77527760

77537761
case 28:
77547762
_context.t3 = _context.sent;
77557763
_context.next = 31;
7756-
return _context.t0.FILE.call(_context.t0, _context.t1, _context.t2, _context.t3);
7764+
return _context.t0.POSTFILE.call(_context.t0, _context.t1, _context.t2, _context.t3);
77577765

77587766
case 31:
77597767
result = _context.sent;
7760-
_context.next = 59;
7768+
_context.next = 71;
77617769
break;
77627770

77637771
case 34:
7764-
if (!PubNubFile.supportsBuffer) {
7772+
if (!PubNubFile.supportsFile) {
77657773
_context.next = 46;
77667774
break;
77677775
}
@@ -7770,20 +7778,20 @@ var sendFile = function sendFile(_ref) {
77707778
_context.t5 = url;
77717779
_context.t6 = formFieldsWithMimeType;
77727780
_context.next = 40;
7773-
return file.toBuffer();
7781+
return file.toFile();
77747782

77757783
case 40:
77767784
_context.t7 = _context.sent;
77777785
_context.next = 43;
7778-
return _context.t4.FILE.call(_context.t4, _context.t5, _context.t6, _context.t7);
7786+
return _context.t4.POSTFILE.call(_context.t4, _context.t5, _context.t6, _context.t7);
77797787

77807788
case 43:
77817789
result = _context.sent;
7782-
_context.next = 59;
7790+
_context.next = 71;
77837791
break;
77847792

77857793
case 46:
7786-
if (!PubNubFile.supportsBlob) {
7794+
if (!PubNubFile.supportsBuffer) {
77877795
_context.next = 58;
77887796
break;
77897797
}
@@ -7792,50 +7800,72 @@ var sendFile = function sendFile(_ref) {
77927800
_context.t9 = url;
77937801
_context.t10 = formFieldsWithMimeType;
77947802
_context.next = 52;
7795-
return file.toBlob();
7803+
return file.toBuffer();
77967804

77977805
case 52:
77987806
_context.t11 = _context.sent;
77997807
_context.next = 55;
7800-
return _context.t8.FILE.call(_context.t8, _context.t9, _context.t10, _context.t11);
7808+
return _context.t8.POSTFILE.call(_context.t8, _context.t9, _context.t10, _context.t11);
78017809

78027810
case 55:
78037811
result = _context.sent;
7804-
_context.next = 59;
7812+
_context.next = 71;
78057813
break;
78067814

78077815
case 58:
7808-
throw new Error('Unsupported environment');
7816+
if (!PubNubFile.supportsBlob) {
7817+
_context.next = 70;
7818+
break;
7819+
}
78097820

7810-
case 59:
7821+
_context.t12 = networking;
7822+
_context.t13 = url;
7823+
_context.t14 = formFieldsWithMimeType;
78117824
_context.next = 64;
7825+
return file.toBlob();
7826+
7827+
case 64:
7828+
_context.t15 = _context.sent;
7829+
_context.next = 67;
7830+
return _context.t12.POSTFILE.call(_context.t12, _context.t13, _context.t14, _context.t15);
7831+
7832+
case 67:
7833+
result = _context.sent;
7834+
_context.next = 71;
78127835
break;
78137836

7814-
case 61:
7815-
_context.prev = 61;
7816-
_context.t12 = _context["catch"](21);
7817-
throw new _endpoint.PubNubError('Upload to bucket failed', _context.t12);
7837+
case 70:
7838+
throw new Error('Unsupported environment');
78187839

7819-
case 64:
7840+
case 71:
7841+
_context.next = 76;
7842+
break;
7843+
7844+
case 73:
7845+
_context.prev = 73;
7846+
_context.t16 = _context["catch"](21);
7847+
throw new _endpoint.PubNubError('Upload to bucket failed', _context.t16);
7848+
7849+
case 76:
78207850
if (!(result.status !== 204)) {
7821-
_context.next = 66;
7851+
_context.next = 78;
78227852
break;
78237853
}
78247854

78257855
throw new _endpoint.PubNubError('Upload to bucket was unsuccessful', result);
78267856

7827-
case 66:
7857+
case 78:
78287858
retries = 5;
78297859
wasSuccessful = false;
78307860

7831-
case 68:
7861+
case 80:
78327862
if (!(!wasSuccessful && retries > 0)) {
7833-
_context.next = 80;
7863+
_context.next = 92;
78347864
break;
78357865
}
78367866

7837-
_context.prev = 69;
7838-
_context.next = 72;
7867+
_context.prev = 81;
7868+
_context.next = 84;
78397869
return publishFile({
78407870
channel: channel,
78417871
message: message,
@@ -7846,23 +7876,23 @@ var sendFile = function sendFile(_ref) {
78467876
ttl: ttl
78477877
});
78487878

7849-
case 72:
7879+
case 84:
78507880
wasSuccessful = true;
7851-
_context.next = 78;
7881+
_context.next = 90;
78527882
break;
78537883

7854-
case 75:
7855-
_context.prev = 75;
7856-
_context.t13 = _context["catch"](69);
7884+
case 87:
7885+
_context.prev = 87;
7886+
_context.t17 = _context["catch"](81);
78577887
retries -= 1;
78587888

7859-
case 78:
7860-
_context.next = 68;
7889+
case 90:
7890+
_context.next = 80;
78617891
break;
78627892

7863-
case 80:
7893+
case 92:
78647894
if (wasSuccessful) {
7865-
_context.next = 84;
7895+
_context.next = 96;
78667896
break;
78677897
}
78687898

@@ -7872,18 +7902,18 @@ var sendFile = function sendFile(_ref) {
78727902
name: name
78737903
});
78747904

7875-
case 84:
7905+
case 96:
78767906
return _context.abrupt("return", {
78777907
id: id,
78787908
name: name
78797909
});
78807910

7881-
case 85:
7911+
case 97:
78827912
case "end":
78837913
return _context.stop();
78847914
}
78857915
}
7886-
}, _callee, null, [[21, 61], [69, 75]]);
7916+
}, _callee, null, [[21, 73], [81, 87]]);
78877917
}));
78887918

78897919
return function (_x) {
@@ -8742,7 +8772,10 @@ var endpoint = {
87428772
return "id can't be empty";
87438773
}
87448774
},
8745-
getURL: function getURL(_ref, params) {
8775+
useGetFile: function useGetFile() {
8776+
return true;
8777+
},
8778+
getFileURL: function getFileURL(_ref, params) {
87468779
var config = _ref.config;
87478780
return "/v1/files/".concat(config.subscribeKey, "/channels/").concat(params.channel, "/files/").concat(params.id, "/").concat(params.name);
87488781
},
@@ -8779,7 +8812,7 @@ var endpoint = {
87798812
PubNubFile = _ref4.PubNubFile, config = _ref4.config, cryptography = _ref4.cryptography;
87808813
body = res.response.body;
87818814

8782-
if (!config.cipherKey) {
8815+
if (!(PubNubFile.supportsEncryptFile && config.cipherKey)) {
87838816
_context.next = 6;
87848817
break;
87858818
}
@@ -13384,9 +13417,14 @@ var _default = function () {
1338413417
return this._standardOrigin;
1338513418
}
1338613419
}, {
13387-
key: "FILE",
13388-
value: function FILE(url, fields, file) {
13389-
return this._modules.file(url, fields, file);
13420+
key: "POSTFILE",
13421+
value: function POSTFILE(url, fields, file) {
13422+
return this._modules.postfile(url, fields, file);
13423+
}
13424+
}, {
13425+
key: "GETFILE",
13426+
value: function GETFILE(params, endpoint, callback) {
13427+
return this._modules.getfile(params, endpoint, callback);
1339013428
}
1339113429
}, {
1339213430
key: "POST",

dist/titanium/pubnub.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)