1
- /*! 4.29.9 / Consumer */
1
+ /*! 4.29.8-rc1 / Consumer */
2
2
exports [ "PubNub" ] =
3
3
/******/ ( function ( modules ) { // webpackBootstrap
4
4
/******/ // The module cache
@@ -566,7 +566,7 @@ var _default = function () {
566
566
} , {
567
567
key : "getVersion" ,
568
568
value : function getVersion ( ) {
569
- return '4.29.9 ' ;
569
+ return '4.29.8-rc1 ' ;
570
570
}
571
571
} , {
572
572
key : "_addPnsdkSuffix" ,
@@ -756,8 +756,6 @@ Object.defineProperty(exports, "__esModule", {
756
756
value : true
757
757
} ) ;
758
758
exports . createValidationError = createValidationError ;
759
- exports . generatePNSDK = generatePNSDK ;
760
- exports . signRequest = signRequest ;
761
759
exports [ "default" ] = _default ;
762
760
exports . PubNubError = void 0 ;
763
761
@@ -894,10 +892,6 @@ function signRequest(modules, url, outgoingParams, incomingParams, endpoint) {
894
892
httpMethod = 'GET' ;
895
893
}
896
894
897
- if ( httpMethod === 'GETFILE' ) {
898
- httpMethod = 'GET' ;
899
- }
900
-
901
895
var signInput = "" . concat ( httpMethod , "\n" ) . concat ( config . publishKey , "\n" ) . concat ( url , "\n" ) . concat ( _utils [ "default" ] . signPamFromParams ( outgoingParams ) , "\n" ) ;
902
896
903
897
if ( httpMethod === 'POST' ) {
@@ -7692,18 +7686,6 @@ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(22));
7692
7686
7693
7687
var _endpoint = __webpack_require__ ( 16 ) ;
7694
7688
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
-
7707
7689
var sendFile = function sendFile ( _ref ) {
7708
7690
var generateUploadUrl = _ref . generateUploadUrl ,
7709
7691
publishFile = _ref . publishFile ,
@@ -7714,7 +7696,7 @@ var sendFile = function sendFile(_ref) {
7714
7696
networking = _ref$modules . networking ;
7715
7697
return function ( ) {
7716
7698
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 ;
7718
7700
7719
7701
return _regenerator [ "default" ] . wrap ( function _callee$ ( _context ) {
7720
7702
while ( 1 ) {
@@ -7870,43 +7852,34 @@ var sendFile = function sendFile(_ref) {
7870
7852
throw new Error ( 'Unsupported environment' ) ;
7871
7853
7872
7854
case 71 :
7873
- _context . next = 80 ;
7855
+ _context . next = 76 ;
7874
7856
break ;
7875
7857
7876
7858
case 73 :
7877
7859
_context . prev = 73 ;
7878
7860
_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 ) ;
7881
7862
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 :
7888
7864
if ( ! ( result . status !== 204 ) ) {
7889
- _context . next = 82 ;
7865
+ _context . next = 78 ;
7890
7866
break ;
7891
7867
}
7892
7868
7893
7869
throw new _endpoint . PubNubError ( 'Upload to bucket was unsuccessful' , result ) ;
7894
7870
7895
- case 82 :
7871
+ case 78 :
7896
7872
retries = 5 ;
7897
7873
wasSuccessful = false ;
7898
- publishResult = {
7899
- timetoken : '0'
7900
- } ;
7901
7874
7902
- case 85 :
7875
+ case 80 :
7903
7876
if ( ! ( ! wasSuccessful && retries > 0 ) ) {
7904
- _context . next = 98 ;
7877
+ _context . next = 92 ;
7905
7878
break ;
7906
7879
}
7907
7880
7908
- _context . prev = 86 ;
7909
- _context . next = 89 ;
7881
+ _context . prev = 81 ;
7882
+ _context . next = 84 ;
7910
7883
return publishFile ( {
7911
7884
channel : channel ,
7912
7885
message : message ,
@@ -7917,24 +7890,23 @@ var sendFile = function sendFile(_ref) {
7917
7890
ttl : ttl
7918
7891
} ) ;
7919
7892
7920
- case 89 :
7921
- publishResult = _context . sent ;
7893
+ case 84 :
7922
7894
wasSuccessful = true ;
7923
- _context . next = 96 ;
7895
+ _context . next = 90 ;
7924
7896
break ;
7925
7897
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 ) ;
7929
7901
retries -= 1 ;
7930
7902
7931
- case 96 :
7932
- _context . next = 85 ;
7903
+ case 90 :
7904
+ _context . next = 80 ;
7933
7905
break ;
7934
7906
7935
- case 98 :
7907
+ case 92 :
7936
7908
if ( wasSuccessful ) {
7937
- _context . next = 102 ;
7909
+ _context . next = 96 ;
7938
7910
break ;
7939
7911
}
7940
7912
@@ -7944,19 +7916,18 @@ var sendFile = function sendFile(_ref) {
7944
7916
name : name
7945
7917
} ) ;
7946
7918
7947
- case 102 :
7919
+ case 96 :
7948
7920
return _context . abrupt ( "return" , {
7949
- timetoken : publishResult . timetoken ,
7950
7921
id : id ,
7951
7922
name : name
7952
7923
} ) ;
7953
7924
7954
- case 103 :
7925
+ case 97 :
7955
7926
case "end" :
7956
7927
return _context . stop ( ) ;
7957
7928
}
7958
7929
}
7959
- } , _callee , null , [ [ 21 , 73 ] , [ 86 , 93 ] ] ) ;
7930
+ } , _callee , null , [ [ 21 , 73 ] , [ 81 , 87 ] ] ) ;
7960
7931
} ) ) ;
7961
7932
7962
7933
return function ( _x ) {
@@ -8754,11 +8725,11 @@ exports["default"] = void 0;
8754
8725
8755
8726
var _endpoint = __webpack_require__ ( 16 ) ;
8756
8727
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 ;
8762
8733
8763
8734
if ( ! channel ) {
8764
8735
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) {
8772
8743
throw new _endpoint . PubNubError ( 'Validation failed, check status for details' , ( 0 , _endpoint . createValidationError ) ( "file name can't be empty" ) ) ;
8773
8744
}
8774
8745
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 ) ;
8801
8747
} ;
8802
8748
8803
8749
exports [ "default" ] = _default ;
@@ -8860,11 +8806,15 @@ var endpoint = {
8860
8806
forceBuffered : function forceBuffered ( ) {
8861
8807
return true ;
8862
8808
} ,
8809
+ getAuthToken : function getAuthToken ( _ref3 ) {
8810
+ var tokenManager = _ref3 . tokenManager ;
8811
+ return tokenManager . getToken ( 'fileUpload' ) ;
8812
+ } ,
8863
8813
prepareParams : function prepareParams ( ) {
8864
8814
return { } ;
8865
8815
} ,
8866
8816
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 ) {
8868
8818
var _res$response$name ;
8869
8819
8870
8820
var PubNubFile , config , cryptography , body , _params$cipherKey ;
@@ -8873,7 +8823,7 @@ var endpoint = {
8873
8823
while ( 1 ) {
8874
8824
switch ( _context . prev = _context . next ) {
8875
8825
case 0 :
8876
- PubNubFile = _ref3 . PubNubFile , config = _ref3 . config , cryptography = _ref3 . cryptography ;
8826
+ PubNubFile = _ref4 . PubNubFile , config = _ref4 . config , cryptography = _ref4 . cryptography ;
8877
8827
body = res . response . body ;
8878
8828
8879
8829
if ( ! ( PubNubFile . supportsEncryptFile && config . cipherKey ) ) {
0 commit comments