1
- /*! 4.29.4 / Consumer */
1
+ /*! 4.29.5 / 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.4 ' ;
569
+ return '4.29.5 ' ;
570
570
}
571
571
} , {
572
572
key : "_addPnsdkSuffix" ,
@@ -827,6 +827,8 @@ function decideURL(endpoint, modules, incomingParams) {
827
827
return endpoint . postURL ( modules , incomingParams ) ;
828
828
} else if ( endpoint . usePatch && endpoint . usePatch ( modules , incomingParams ) ) {
829
829
return endpoint . patchURL ( modules , incomingParams ) ;
830
+ } else if ( endpoint . useGetFile && endpoint . useGetFile ( modules , incomingParams ) ) {
831
+ return endpoint . getFileURL ( modules , incomingParams ) ;
830
832
} else {
831
833
return endpoint . getURL ( modules , incomingParams ) ;
832
834
}
@@ -871,6 +873,8 @@ function getHttpMethod(modules, endpoint, incomingParams) {
871
873
return 'PATCH' ;
872
874
} else if ( endpoint . useDelete && endpoint . useDelete ( modules , incomingParams ) ) {
873
875
return 'DELETE' ;
876
+ } else if ( endpoint . useGetFile && endpoint . useGetFile ( modules , incomingParams ) ) {
877
+ return 'GETFILE' ;
874
878
} else {
875
879
return 'GET' ;
876
880
}
@@ -989,6 +993,8 @@ function _default(modules, endpoint) {
989
993
}
990
994
991
995
var onResponse = function onResponse ( status , payload ) {
996
+ var _responseP ;
997
+
992
998
if ( status . error ) {
993
999
if ( callback ) {
994
1000
callback ( status ) ;
@@ -1002,7 +1008,7 @@ function _default(modules, endpoint) {
1002
1008
telemetryManager . stopLatencyMeasure ( endpoint . getOperation ( ) , requestId ) ;
1003
1009
var responseP = endpoint . handleResponse ( modules , payload , incomingParams ) ;
1004
1010
1005
- if ( typeof responseP . then !== 'function' ) {
1011
+ if ( typeof ( ( _responseP = responseP ) === null || _responseP === void 0 ? void 0 : _responseP . then ) !== 'function' ) {
1006
1012
responseP = Promise . resolve ( responseP ) ;
1007
1013
}
1008
1014
@@ -1032,6 +1038,8 @@ function _default(modules, endpoint) {
1032
1038
callInstance = networking . PATCH ( outgoingParams , _payload2 , networkingParams , onResponse ) ;
1033
1039
} else if ( getHttpMethod ( modules , endpoint , incomingParams ) === 'DELETE' ) {
1034
1040
callInstance = networking . DELETE ( outgoingParams , networkingParams , onResponse ) ;
1041
+ } else if ( getHttpMethod ( modules , endpoint , incomingParams ) === 'GETFILE' ) {
1042
+ callInstance = networking . GETFILE ( outgoingParams , networkingParams , onResponse ) ;
1035
1043
} else {
1036
1044
callInstance = networking . GET ( outgoingParams , networkingParams , onResponse ) ;
1037
1045
}
@@ -7714,7 +7722,7 @@ var sendFile = function sendFile(_ref) {
7714
7722
id = _yield$generateUpload3 . id ;
7715
7723
name = _yield$generateUpload3 . name ;
7716
7724
7717
- if ( ! ( cipherKey !== null && cipherKey !== void 0 ? cipherKey : config . cipherKey ) ) {
7725
+ if ( ! ( PubNubFile . supportsEncryptFile && ( cipherKey !== null && cipherKey !== void 0 ? cipherKey : config . cipherKey ) ) ) {
7718
7726
_context . next = 19 ;
7719
7727
break ;
7720
7728
}
@@ -7739,7 +7747,7 @@ var sendFile = function sendFile(_ref) {
7739
7747
7740
7748
_context . prev = 21 ;
7741
7749
7742
- if ( ! PubNubFile . supportsFile ) {
7750
+ if ( ! ( PubNubFile . supportsFileUri && input . uri ) ) {
7743
7751
_context . next = 34 ;
7744
7752
break ;
7745
7753
}
@@ -7748,20 +7756,20 @@ var sendFile = function sendFile(_ref) {
7748
7756
_context . t1 = url ;
7749
7757
_context . t2 = formFieldsWithMimeType ;
7750
7758
_context . next = 28 ;
7751
- return file . toFile ( ) ;
7759
+ return file . toFileUri ( ) ;
7752
7760
7753
7761
case 28 :
7754
7762
_context . t3 = _context . sent ;
7755
7763
_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 ) ;
7757
7765
7758
7766
case 31 :
7759
7767
result = _context . sent ;
7760
- _context . next = 59 ;
7768
+ _context . next = 71 ;
7761
7769
break ;
7762
7770
7763
7771
case 34 :
7764
- if ( ! PubNubFile . supportsBuffer ) {
7772
+ if ( ! PubNubFile . supportsFile ) {
7765
7773
_context . next = 46 ;
7766
7774
break ;
7767
7775
}
@@ -7770,20 +7778,20 @@ var sendFile = function sendFile(_ref) {
7770
7778
_context . t5 = url ;
7771
7779
_context . t6 = formFieldsWithMimeType ;
7772
7780
_context . next = 40 ;
7773
- return file . toBuffer ( ) ;
7781
+ return file . toFile ( ) ;
7774
7782
7775
7783
case 40 :
7776
7784
_context . t7 = _context . sent ;
7777
7785
_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 ) ;
7779
7787
7780
7788
case 43 :
7781
7789
result = _context . sent ;
7782
- _context . next = 59 ;
7790
+ _context . next = 71 ;
7783
7791
break ;
7784
7792
7785
7793
case 46 :
7786
- if ( ! PubNubFile . supportsBlob ) {
7794
+ if ( ! PubNubFile . supportsBuffer ) {
7787
7795
_context . next = 58 ;
7788
7796
break ;
7789
7797
}
@@ -7792,50 +7800,72 @@ var sendFile = function sendFile(_ref) {
7792
7800
_context . t9 = url ;
7793
7801
_context . t10 = formFieldsWithMimeType ;
7794
7802
_context . next = 52 ;
7795
- return file . toBlob ( ) ;
7803
+ return file . toBuffer ( ) ;
7796
7804
7797
7805
case 52 :
7798
7806
_context . t11 = _context . sent ;
7799
7807
_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 ) ;
7801
7809
7802
7810
case 55 :
7803
7811
result = _context . sent ;
7804
- _context . next = 59 ;
7812
+ _context . next = 71 ;
7805
7813
break ;
7806
7814
7807
7815
case 58 :
7808
- throw new Error ( 'Unsupported environment' ) ;
7816
+ if ( ! PubNubFile . supportsBlob ) {
7817
+ _context . next = 70 ;
7818
+ break ;
7819
+ }
7809
7820
7810
- case 59 :
7821
+ _context . t12 = networking ;
7822
+ _context . t13 = url ;
7823
+ _context . t14 = formFieldsWithMimeType ;
7811
7824
_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 ;
7812
7835
break ;
7813
7836
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' ) ;
7818
7839
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 :
7820
7850
if ( ! ( result . status !== 204 ) ) {
7821
- _context . next = 66 ;
7851
+ _context . next = 78 ;
7822
7852
break ;
7823
7853
}
7824
7854
7825
7855
throw new _endpoint . PubNubError ( 'Upload to bucket was unsuccessful' , result ) ;
7826
7856
7827
- case 66 :
7857
+ case 78 :
7828
7858
retries = 5 ;
7829
7859
wasSuccessful = false ;
7830
7860
7831
- case 68 :
7861
+ case 80 :
7832
7862
if ( ! ( ! wasSuccessful && retries > 0 ) ) {
7833
- _context . next = 80 ;
7863
+ _context . next = 92 ;
7834
7864
break ;
7835
7865
}
7836
7866
7837
- _context . prev = 69 ;
7838
- _context . next = 72 ;
7867
+ _context . prev = 81 ;
7868
+ _context . next = 84 ;
7839
7869
return publishFile ( {
7840
7870
channel : channel ,
7841
7871
message : message ,
@@ -7846,23 +7876,23 @@ var sendFile = function sendFile(_ref) {
7846
7876
ttl : ttl
7847
7877
} ) ;
7848
7878
7849
- case 72 :
7879
+ case 84 :
7850
7880
wasSuccessful = true ;
7851
- _context . next = 78 ;
7881
+ _context . next = 90 ;
7852
7882
break ;
7853
7883
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 ) ;
7857
7887
retries -= 1 ;
7858
7888
7859
- case 78 :
7860
- _context . next = 68 ;
7889
+ case 90 :
7890
+ _context . next = 80 ;
7861
7891
break ;
7862
7892
7863
- case 80 :
7893
+ case 92 :
7864
7894
if ( wasSuccessful ) {
7865
- _context . next = 84 ;
7895
+ _context . next = 96 ;
7866
7896
break ;
7867
7897
}
7868
7898
@@ -7872,18 +7902,18 @@ var sendFile = function sendFile(_ref) {
7872
7902
name : name
7873
7903
} ) ;
7874
7904
7875
- case 84 :
7905
+ case 96 :
7876
7906
return _context . abrupt ( "return" , {
7877
7907
id : id ,
7878
7908
name : name
7879
7909
} ) ;
7880
7910
7881
- case 85 :
7911
+ case 97 :
7882
7912
case "end" :
7883
7913
return _context . stop ( ) ;
7884
7914
}
7885
7915
}
7886
- } , _callee , null , [ [ 21 , 61 ] , [ 69 , 75 ] ] ) ;
7916
+ } , _callee , null , [ [ 21 , 73 ] , [ 81 , 87 ] ] ) ;
7887
7917
} ) ) ;
7888
7918
7889
7919
return function ( _x ) {
@@ -8742,7 +8772,10 @@ var endpoint = {
8742
8772
return "id can't be empty" ;
8743
8773
}
8744
8774
} ,
8745
- getURL : function getURL ( _ref , params ) {
8775
+ useGetFile : function useGetFile ( ) {
8776
+ return true ;
8777
+ } ,
8778
+ getFileURL : function getFileURL ( _ref , params ) {
8746
8779
var config = _ref . config ;
8747
8780
return "/v1/files/" . concat ( config . subscribeKey , "/channels/" ) . concat ( params . channel , "/files/" ) . concat ( params . id , "/" ) . concat ( params . name ) ;
8748
8781
} ,
@@ -8779,7 +8812,7 @@ var endpoint = {
8779
8812
PubNubFile = _ref4 . PubNubFile , config = _ref4 . config , cryptography = _ref4 . cryptography ;
8780
8813
body = res . response . body ;
8781
8814
8782
- if ( ! config . cipherKey ) {
8815
+ if ( ! ( PubNubFile . supportsEncryptFile && config . cipherKey ) ) {
8783
8816
_context . next = 6 ;
8784
8817
break ;
8785
8818
}
@@ -13384,9 +13417,14 @@ var _default = function () {
13384
13417
return this . _standardOrigin ;
13385
13418
}
13386
13419
} , {
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 ) ;
13390
13428
}
13391
13429
} , {
13392
13430
key : "POST" ,
0 commit comments