1- /*! 4.29.9 / Consumer */
1+ /*! 4.29.8-rc1 / Consumer */
22exports [ "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.9 ' ;
569+ return '4.29.8-rc1 ' ;
570570 }
571571 } , {
572572 key : "_addPnsdkSuffix" ,
@@ -756,8 +756,6 @@ Object.defineProperty(exports, "__esModule", {
756756 value : true
757757} ) ;
758758exports . createValidationError = createValidationError ;
759- exports . generatePNSDK = generatePNSDK ;
760- exports . signRequest = signRequest ;
761759exports [ "default" ] = _default ;
762760exports . PubNubError = void 0 ;
763761
@@ -894,10 +892,6 @@ function signRequest(modules, url, outgoingParams, incomingParams, endpoint) {
894892 httpMethod = 'GET' ;
895893 }
896894
897- if ( httpMethod === 'GETFILE' ) {
898- httpMethod = 'GET' ;
899- }
900-
901895 var signInput = "" . concat ( httpMethod , "\n" ) . concat ( config . publishKey , "\n" ) . concat ( url , "\n" ) . concat ( _utils [ "default" ] . signPamFromParams ( outgoingParams ) , "\n" ) ;
902896
903897 if ( httpMethod === 'POST' ) {
@@ -7692,18 +7686,6 @@ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(22));
76927686
76937687var _endpoint = __webpack_require__ ( 16 ) ;
76947688
7695- var getErrorFromResponse = function getErrorFromResponse ( response ) {
7696- return new Promise ( function ( resolve ) {
7697- var result = '' ;
7698- response . on ( 'data' , function ( data ) {
7699- result += data . toString ( 'utf8' ) ;
7700- } ) ;
7701- response . on ( 'end' , function ( ) {
7702- resolve ( result ) ;
7703- } ) ;
7704- } ) ;
7705- } ;
7706-
77077689var sendFile = function sendFile ( _ref ) {
77087690 var generateUploadUrl = _ref . generateUploadUrl ,
77097691 publishFile = _ref . publishFile ,
@@ -7714,7 +7696,7 @@ var sendFile = function sendFile(_ref) {
77147696 networking = _ref$modules . networking ;
77157697 return function ( ) {
77167698 var _ref3 = ( 0 , _asyncToGenerator2 [ "default" ] ) ( _regenerator [ "default" ] . mark ( function _callee ( _ref2 ) {
7717- var channel , input , message , cipherKey , meta , ttl , storeInHistory , file , _yield$generateUpload , _yield$generateUpload2 , url , formFields , _yield$generateUpload3 , id , name , formFieldsWithMimeType , result , errorBody , reason , retries , wasSuccessful , publishResult ;
7699+ var channel , input , message , cipherKey , meta , ttl , storeInHistory , file , _yield$generateUpload , _yield$generateUpload2 , url , formFields , _yield$generateUpload3 , id , name , formFieldsWithMimeType , result , retries , wasSuccessful ;
77187700
77197701 return _regenerator [ "default" ] . wrap ( function _callee$ ( _context ) {
77207702 while ( 1 ) {
@@ -7870,43 +7852,34 @@ var sendFile = function sendFile(_ref) {
78707852 throw new Error ( 'Unsupported environment' ) ;
78717853
78727854 case 71 :
7873- _context . next = 80 ;
7855+ _context . next = 76 ;
78747856 break ;
78757857
78767858 case 73 :
78777859 _context . prev = 73 ;
78787860 _context . t16 = _context [ "catch" ] ( 21 ) ;
7879- _context . next = 77 ;
7880- return getErrorFromResponse ( _context . t16 . response ) ;
7861+ throw new _endpoint . PubNubError ( 'Upload to bucket failed' , _context . t16 ) ;
78817862
7882- case 77 :
7883- errorBody = _context . sent ;
7884- reason = / < M e s s a g e > ( .* ) < \/ M e s s a g e > / gi. exec ( errorBody ) ;
7885- throw new _endpoint . PubNubError ( reason ? "Upload to bucket failed: " . concat ( reason [ 1 ] ) : 'Upload to bucket failed.' , _context . t16 ) ;
7886-
7887- case 80 :
7863+ case 76 :
78887864 if ( ! ( result . status !== 204 ) ) {
7889- _context . next = 82 ;
7865+ _context . next = 78 ;
78907866 break ;
78917867 }
78927868
78937869 throw new _endpoint . PubNubError ( 'Upload to bucket was unsuccessful' , result ) ;
78947870
7895- case 82 :
7871+ case 78 :
78967872 retries = 5 ;
78977873 wasSuccessful = false ;
7898- publishResult = {
7899- timetoken : '0'
7900- } ;
79017874
7902- case 85 :
7875+ case 80 :
79037876 if ( ! ( ! wasSuccessful && retries > 0 ) ) {
7904- _context . next = 98 ;
7877+ _context . next = 92 ;
79057878 break ;
79067879 }
79077880
7908- _context . prev = 86 ;
7909- _context . next = 89 ;
7881+ _context . prev = 81 ;
7882+ _context . next = 84 ;
79107883 return publishFile ( {
79117884 channel : channel ,
79127885 message : message ,
@@ -7917,24 +7890,23 @@ var sendFile = function sendFile(_ref) {
79177890 ttl : ttl
79187891 } ) ;
79197892
7920- case 89 :
7921- publishResult = _context . sent ;
7893+ case 84 :
79227894 wasSuccessful = true ;
7923- _context . next = 96 ;
7895+ _context . next = 90 ;
79247896 break ;
79257897
7926- case 93 :
7927- _context . prev = 93 ;
7928- _context . t17 = _context [ "catch" ] ( 86 ) ;
7898+ case 87 :
7899+ _context . prev = 87 ;
7900+ _context . t17 = _context [ "catch" ] ( 81 ) ;
79297901 retries -= 1 ;
79307902
7931- case 96 :
7932- _context . next = 85 ;
7903+ case 90 :
7904+ _context . next = 80 ;
79337905 break ;
79347906
7935- case 98 :
7907+ case 92 :
79367908 if ( wasSuccessful ) {
7937- _context . next = 102 ;
7909+ _context . next = 96 ;
79387910 break ;
79397911 }
79407912
@@ -7944,19 +7916,18 @@ var sendFile = function sendFile(_ref) {
79447916 name : name
79457917 } ) ;
79467918
7947- case 102 :
7919+ case 96 :
79487920 return _context . abrupt ( "return" , {
7949- timetoken : publishResult . timetoken ,
79507921 id : id ,
79517922 name : name
79527923 } ) ;
79537924
7954- case 103 :
7925+ case 97 :
79557926 case "end" :
79567927 return _context . stop ( ) ;
79577928 }
79587929 }
7959- } , _callee , null , [ [ 21 , 73 ] , [ 86 , 93 ] ] ) ;
7930+ } , _callee , null , [ [ 21 , 73 ] , [ 81 , 87 ] ] ) ;
79607931 } ) ) ;
79617932
79627933 return function ( _x ) {
@@ -8754,11 +8725,11 @@ exports["default"] = void 0;
87548725
87558726var _endpoint = __webpack_require__ ( 16 ) ;
87568727
8757- var _default = function _default ( modules , _ref ) {
8758- var channel = _ref . channel ,
8759- id = _ref . id ,
8760- name = _ref . name ;
8761- var config = modules . config ;
8728+ var _default = function _default ( _ref , _ref2 ) {
8729+ var config = _ref . config ;
8730+ var channel = _ref2 . channel ,
8731+ id = _ref2 . id ,
8732+ name = _ref2 . name ;
87628733
87638734 if ( ! channel ) {
87648735 throw new _endpoint . PubNubError ( 'Validation failed, check status for details' , ( 0 , _endpoint . createValidationError ) ( "channel can't be empty" ) ) ;
@@ -8772,32 +8743,7 @@ var _default = function _default(modules, _ref) {
87728743 throw new _endpoint . PubNubError ( 'Validation failed, check status for details' , ( 0 , _endpoint . createValidationError ) ( "file name can't be empty" ) ) ;
87738744 }
87748745
8775- var url = "/v1/files/" . concat ( config . subscribeKey , "/channels/" ) . concat ( channel , "/files/" ) . concat ( id , "/" ) . concat ( name ) ;
8776- var params = { } ;
8777- params . uuid = config . getUUID ( ) ;
8778- params . pnsdk = ( 0 , _endpoint . generatePNSDK ) ( config ) ;
8779-
8780- if ( config . getAuthKey ( ) ) {
8781- params . auth = config . getAuthKey ( ) ;
8782- }
8783-
8784- if ( config . secretKey ) {
8785- ( 0 , _endpoint . signRequest ) ( modules , url , params , { } , {
8786- getOperation : function getOperation ( ) {
8787- return 'PubNubGetFileUrlOperation' ;
8788- }
8789- } ) ;
8790- }
8791-
8792- var queryParams = Object . keys ( params ) . map ( function ( key ) {
8793- return "" . concat ( encodeURIComponent ( key ) , "=" ) . concat ( encodeURIComponent ( params [ key ] ) ) ;
8794- } ) . join ( '&' ) ;
8795-
8796- if ( queryParams !== '' ) {
8797- return "https://" . concat ( config . origin ) . concat ( url , "?" ) . concat ( queryParams ) ;
8798- }
8799-
8800- return "https://" . concat ( config . origin ) . concat ( url ) ;
8746+ return "https://" . concat ( config . origin , "/v1/files/" ) . concat ( config . subscribeKey , "/channels/" ) . concat ( channel , "/files/" ) . concat ( id , "/" ) . concat ( name ) ;
88018747} ;
88028748
88038749exports [ "default" ] = _default ;
@@ -8860,11 +8806,15 @@ var endpoint = {
88608806 forceBuffered : function forceBuffered ( ) {
88618807 return true ;
88628808 } ,
8809+ getAuthToken : function getAuthToken ( _ref3 ) {
8810+ var tokenManager = _ref3 . tokenManager ;
8811+ return tokenManager . getToken ( 'fileUpload' ) ;
8812+ } ,
88638813 prepareParams : function prepareParams ( ) {
88648814 return { } ;
88658815 } ,
88668816 handleResponse : function ( ) {
8867- var _handleResponse = ( 0 , _asyncToGenerator2 [ "default" ] ) ( _regenerator [ "default" ] . mark ( function _callee ( _ref3 , res , params ) {
8817+ var _handleResponse = ( 0 , _asyncToGenerator2 [ "default" ] ) ( _regenerator [ "default" ] . mark ( function _callee ( _ref4 , res , params ) {
88688818 var _res$response$name ;
88698819
88708820 var PubNubFile , config , cryptography , body , _params$cipherKey ;
@@ -8873,7 +8823,7 @@ var endpoint = {
88738823 while ( 1 ) {
88748824 switch ( _context . prev = _context . next ) {
88758825 case 0 :
8876- PubNubFile = _ref3 . PubNubFile , config = _ref3 . config , cryptography = _ref3 . cryptography ;
8826+ PubNubFile = _ref4 . PubNubFile , config = _ref4 . config , cryptography = _ref4 . cryptography ;
88778827 body = res . response . body ;
88788828
88798829 if ( ! ( PubNubFile . supportsEncryptFile && config . cipherKey ) ) {
0 commit comments