@aws-amplify/core 4.4.1-cloud-logging.7 → 4.4.1-unstable.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/aws-amplify-core.js +103 -281
  2. package/dist/aws-amplify-core.js.map +1 -1
  3. package/dist/aws-amplify-core.min.js +6 -6
  4. package/dist/aws-amplify-core.min.js.map +1 -1
  5. package/lib/Logger/ConsoleLogger.d.ts +0 -6
  6. package/lib/Logger/ConsoleLogger.js +43 -117
  7. package/lib/Logger/ConsoleLogger.js.map +1 -1
  8. package/lib/Providers/AWSCloudWatchProvider.d.ts +3 -11
  9. package/lib/Providers/AWSCloudWatchProvider.js +37 -97
  10. package/lib/Providers/AWSCloudWatchProvider.js.map +1 -1
  11. package/lib/Util/Constants.d.ts +1 -3
  12. package/lib/Util/Constants.js +0 -5
  13. package/lib/Util/Constants.js.map +1 -1
  14. package/lib/Util/Retry.js +1 -1
  15. package/lib/Util/Retry.js.map +1 -1
  16. package/lib/types/types.d.ts +0 -13
  17. package/lib-esm/Logger/ConsoleLogger.d.ts +0 -6
  18. package/lib-esm/Logger/ConsoleLogger.js +43 -117
  19. package/lib-esm/Logger/ConsoleLogger.js.map +1 -1
  20. package/lib-esm/Providers/AWSCloudWatchProvider.d.ts +3 -11
  21. package/lib-esm/Providers/AWSCloudWatchProvider.js +37 -97
  22. package/lib-esm/Providers/AWSCloudWatchProvider.js.map +1 -1
  23. package/lib-esm/Util/Constants.d.ts +1 -3
  24. package/lib-esm/Util/Constants.js +1 -4
  25. package/lib-esm/Util/Constants.js.map +1 -1
  26. package/lib-esm/Util/Retry.js +1 -1
  27. package/lib-esm/Util/Retry.js.map +1 -1
  28. package/lib-esm/types/types.d.ts +0 -13
  29. package/package.json +2 -3
  30. package/src/Logger/ConsoleLogger.ts +34 -117
  31. package/src/Providers/AWSCloudWatchProvider.ts +18 -112
  32. package/src/Util/Constants.ts +0 -7
  33. package/src/Util/Retry.ts +3 -2
  34. package/src/types/types.ts +62 -79
  35. package/lib/Providers/AmazonKinesisLoggingProvider.d.ts +0 -13
  36. package/lib/Providers/AmazonKinesisLoggingProvider.js +0 -30
  37. package/lib/Providers/AmazonKinesisLoggingProvider.js.map +0 -1
  38. package/lib-esm/Providers/AmazonKinesisLoggingProvider.d.ts +0 -13
  39. package/lib-esm/Providers/AmazonKinesisLoggingProvider.js +0 -28
  40. package/lib-esm/Providers/AmazonKinesisLoggingProvider.js.map +0 -1
  41. package/src/Providers/AmazonKinesisLoggingProvider.ts +0 -43
@@ -25979,24 +25979,6 @@ function tryDecode(str, decode) {
25979
25979
  }
25980
25980
 
25981
25981
 
25982
- /***/ }),
25983
-
25984
- /***/ "../../node_modules/fast-text-encoding/text.min.js":
25985
- /*!********************************************************************!*\
25986
- !*** /root/amplify-js/node_modules/fast-text-encoding/text.min.js ***!
25987
- \********************************************************************/
25988
- /*! no static exports found */
25989
- /***/ (function(module, exports, __webpack_require__) {
25990
-
25991
- /* WEBPACK VAR INJECTION */(function(global, Buffer) {(function(l){function m(){}function k(a,c){a=void 0===a?"utf-8":a;c=void 0===c?{fatal:!1}:c;if(-1===r.indexOf(a.toLowerCase()))throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+a+"') is invalid.");if(c.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.");}function t(a){return Buffer.from(a.buffer,a.byteOffset,a.byteLength).toString("utf-8")}function u(a){var c=URL.createObjectURL(new Blob([a],{type:"text/plain;charset=UTF-8"}));
25992
- try{var f=new XMLHttpRequest;f.open("GET",c,!1);f.send();return f.responseText}catch(e){return q(a)}finally{URL.revokeObjectURL(c)}}function q(a){for(var c=0,f=Math.min(65536,a.length+1),e=new Uint16Array(f),h=[],d=0;;){var b=c<a.length;if(!b||d>=f-1){h.push(String.fromCharCode.apply(null,e.subarray(0,d)));if(!b)return h.join("");a=a.subarray(c);d=c=0}b=a[c++];if(0===(b&128))e[d++]=b;else if(192===(b&224)){var g=a[c++]&63;e[d++]=(b&31)<<6|g}else if(224===(b&240)){g=a[c++]&63;var n=a[c++]&63;e[d++]=
25993
- (b&31)<<12|g<<6|n}else if(240===(b&248)){g=a[c++]&63;n=a[c++]&63;var v=a[c++]&63;b=(b&7)<<18|g<<12|n<<6|v;65535<b&&(b-=65536,e[d++]=b>>>10&1023|55296,b=56320|b&1023);e[d++]=b}}}if(l.TextEncoder&&l.TextDecoder)return!1;var r=["utf-8","utf8","unicode-1-1-utf-8"];Object.defineProperty(m.prototype,"encoding",{value:"utf-8"});m.prototype.encode=function(a,c){c=void 0===c?{stream:!1}:c;if(c.stream)throw Error("Failed to encode: the 'stream' option is unsupported.");c=0;for(var f=a.length,e=0,h=Math.max(32,
25994
- f+(f>>>1)+7),d=new Uint8Array(h>>>3<<3);c<f;){var b=a.charCodeAt(c++);if(55296<=b&&56319>=b){if(c<f){var g=a.charCodeAt(c);56320===(g&64512)&&(++c,b=((b&1023)<<10)+(g&1023)+65536)}if(55296<=b&&56319>=b)continue}e+4>d.length&&(h+=8,h*=1+c/a.length*2,h=h>>>3<<3,g=new Uint8Array(h),g.set(d),d=g);if(0===(b&4294967168))d[e++]=b;else{if(0===(b&4294965248))d[e++]=b>>>6&31|192;else if(0===(b&4294901760))d[e++]=b>>>12&15|224,d[e++]=b>>>6&63|128;else if(0===(b&4292870144))d[e++]=b>>>18&7|240,d[e++]=b>>>12&
25995
- 63|128,d[e++]=b>>>6&63|128;else continue;d[e++]=b&63|128}}return d.slice?d.slice(0,e):d.subarray(0,e)};Object.defineProperty(k.prototype,"encoding",{value:"utf-8"});Object.defineProperty(k.prototype,"fatal",{value:!1});Object.defineProperty(k.prototype,"ignoreBOM",{value:!1});var p=q;"function"===typeof Buffer&&Buffer.from?p=t:"function"===typeof Blob&&"function"===typeof URL&&"function"===typeof URL.createObjectURL&&(p=u);k.prototype.decode=function(a,c){c=void 0===c?{stream:!1}:c;if(c.stream)throw Error("Failed to decode: the 'stream' option is unsupported.");
25996
- a=a instanceof Uint8Array?a:a.buffer instanceof ArrayBuffer?new Uint8Array(a.buffer):new Uint8Array(a);return p(a)};l.TextEncoder=m;l.TextDecoder=k})("undefined"!==typeof window?window:"undefined"!==typeof global?global:this);
25997
-
25998
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../buffer/index.js */ "../../node_modules/buffer/index.js").Buffer))
25999
-
26000
25982
  /***/ }),
26001
25983
 
26002
25984
  /***/ "../../node_modules/ieee754/index.js":
@@ -31664,7 +31646,6 @@ var LOG_LEVELS = {
31664
31646
  WARN: 4,
31665
31647
  ERROR: 5
31666
31648
  };
31667
- var COMPATIBLE_PLUGINS = [_Util_Constants__WEBPACK_IMPORTED_MODULE_0__["AWS_CLOUDWATCH_CATEGORY"]];
31668
31649
  var LOG_TYPE;
31669
31650
 
31670
31651
  (function (LOG_TYPE) {
@@ -31674,13 +31655,12 @@ var LOG_TYPE;
31674
31655
  LOG_TYPE["WARN"] = "WARN";
31675
31656
  LOG_TYPE["VERBOSE"] = "VERBOSE";
31676
31657
  })(LOG_TYPE || (LOG_TYPE = {}));
31677
-
31678
- var cloudWatchExcludeList = ['AWSCloudWatch', 'Amplify', 'Credentials', 'AuthClass', 'CloudLogger'];
31679
31658
  /**
31680
31659
  * Write logs
31681
31660
  * @class Logger
31682
31661
  */
31683
31662
 
31663
+
31684
31664
  var ConsoleLogger =
31685
31665
  /** @class */
31686
31666
  function () {
@@ -31696,19 +31676,8 @@ function () {
31696
31676
  this.name = name;
31697
31677
  this.level = level;
31698
31678
  this._pluggables = [];
31699
- this.addPluggable = this.addPluggable.bind(this);
31700
31679
  }
31701
31680
 
31702
- ConsoleLogger.globalPluggables = function (pluggable) {
31703
- if (pluggable && COMPATIBLE_PLUGINS.includes(pluggable.getCategoryName())) {
31704
- ConsoleLogger._globalpluggables.push(pluggable);
31705
- }
31706
- };
31707
-
31708
- ConsoleLogger.clearGlobalPluggables = function () {
31709
- ConsoleLogger._globalpluggables = [];
31710
- };
31711
-
31712
31681
  ConsoleLogger.prototype._padding = function (n) {
31713
31682
  return n < 10 ? '0' + n : '' + n;
31714
31683
  };
@@ -31723,20 +31692,6 @@ function () {
31723
31692
  this._config = config;
31724
31693
  return this._config;
31725
31694
  };
31726
-
31727
- ConsoleLogger.prototype._checkPluggables = function () {
31728
- if (this._pluggables.length !== ConsoleLogger._globalpluggables.length) {
31729
- if (ConsoleLogger._globalpluggables.length > 0) {
31730
- ConsoleLogger._globalpluggables.forEach(this.addPluggable);
31731
-
31732
- return;
31733
- }
31734
-
31735
- if (ConsoleLogger._globalpluggables.length === 0) {
31736
- this._pluggables = [];
31737
- }
31738
- }
31739
- };
31740
31695
  /**
31741
31696
  * Write log
31742
31697
  * @method
@@ -31749,47 +31704,12 @@ function () {
31749
31704
  ConsoleLogger.prototype._log = function (type) {
31750
31705
  var e_1, _a;
31751
31706
 
31752
- var _this = this;
31753
-
31754
31707
  var msg = [];
31755
31708
 
31756
31709
  for (var _i = 1; _i < arguments.length; _i++) {
31757
31710
  msg[_i - 1] = arguments[_i];
31758
31711
  }
31759
31712
 
31760
- if (!cloudWatchExcludeList.includes(this.name)) {
31761
- this._checkPluggables();
31762
- }
31763
-
31764
- var generateCloudMessage = function generateCloudMessage(msg) {
31765
- var message = '';
31766
- var data;
31767
-
31768
- if (msg.length === 1 && typeof msg[0] === 'string') {
31769
- message = msg[0];
31770
- } else if (msg.length === 1) {
31771
- data = msg[0];
31772
- } else if (typeof msg[0] === 'string') {
31773
- var obj = msg.slice(1);
31774
-
31775
- if (obj.length === 1) {
31776
- obj = obj[0];
31777
- }
31778
-
31779
- message = msg[0];
31780
- data = obj;
31781
- } else {
31782
- data = msg;
31783
- }
31784
-
31785
- return JSON.stringify({
31786
- level: type,
31787
- "class": _this.name,
31788
- message: message,
31789
- data: data
31790
- });
31791
- };
31792
-
31793
31713
  var logger_level_name = this.level;
31794
31714
 
31795
31715
  if (ConsoleLogger.LOG_LEVEL) {
@@ -31803,72 +31723,62 @@ function () {
31803
31723
  var logger_level = LOG_LEVELS[logger_level_name];
31804
31724
  var type_level = LOG_LEVELS[type];
31805
31725
 
31806
- if (type_level >= logger_level) {
31807
- var log = console.log.bind(console);
31726
+ if (!(type_level >= logger_level)) {
31727
+ // Do nothing if type is not greater than or equal to logger level (handle undefined)
31728
+ return;
31729
+ }
31808
31730
 
31809
- if (type === LOG_TYPE.ERROR && console.error) {
31810
- log = console.error.bind(console);
31811
- }
31731
+ var log = console.log.bind(console);
31812
31732
 
31813
- if (type === LOG_TYPE.WARN && console.warn) {
31814
- log = console.warn.bind(console);
31815
- }
31733
+ if (type === LOG_TYPE.ERROR && console.error) {
31734
+ log = console.error.bind(console);
31735
+ }
31816
31736
 
31817
- var prefix = "[" + type + "] " + this._ts() + " " + this.name;
31818
- var message = '';
31819
- var data = void 0;
31737
+ if (type === LOG_TYPE.WARN && console.warn) {
31738
+ log = console.warn.bind(console);
31739
+ }
31820
31740
 
31821
- if (msg.length === 1 && typeof msg[0] === 'string') {
31822
- message = msg[0];
31823
- log(prefix + " - " + message);
31824
- } else if (msg.length === 1) {
31825
- data = msg[0];
31826
- log(prefix, data);
31827
- } else if (typeof msg[0] === 'string') {
31828
- var obj = msg.slice(1);
31741
+ var prefix = "[" + type + "] " + this._ts() + " " + this.name;
31742
+ var message = '';
31829
31743
 
31830
- if (obj.length === 1) {
31831
- obj = obj[0];
31832
- }
31744
+ if (msg.length === 1 && typeof msg[0] === 'string') {
31745
+ message = prefix + " - " + msg[0];
31746
+ log(message);
31747
+ } else if (msg.length === 1) {
31748
+ message = prefix + " " + msg[0];
31749
+ log(prefix, msg[0]);
31750
+ } else if (typeof msg[0] === 'string') {
31751
+ var obj = msg.slice(1);
31833
31752
 
31834
- message = msg[0];
31835
- data = obj;
31836
- log(prefix + " - " + message, data);
31837
- } else {
31838
- data = msg;
31839
- log(prefix, data);
31753
+ if (obj.length === 1) {
31754
+ obj = obj[0];
31840
31755
  }
31841
- }
31842
31756
 
31843
- if (ConsoleLogger.CLOUD_LOG_LEVEL != null && !cloudWatchExcludeList.includes(this.name)) {
31844
- var cloudMessage = generateCloudMessage(msg);
31757
+ message = prefix + " - " + msg[0] + " " + obj;
31758
+ log(prefix + " - " + msg[0], obj);
31759
+ } else {
31760
+ message = prefix + " " + msg;
31761
+ log(prefix, msg);
31762
+ }
31845
31763
 
31846
- try {
31847
- for (var _b = __values(this._pluggables), _c = _b.next(); !_c.done; _c = _b.next()) {
31848
- var plugin = _c.value;
31849
- var logger_level_1 = LOG_LEVELS[ConsoleLogger.CLOUD_LOG_LEVEL];
31850
- var type_level_1 = LOG_LEVELS[type];
31851
- var logEvent = {
31852
- message: cloudMessage,
31853
- timestamp: Date.now()
31854
- };
31855
-
31856
- if (type_level_1 >= logger_level_1) {
31857
- plugin.pushLogs([logEvent]);
31858
- } else {
31859
- plugin.pushLogs([]);
31860
- }
31861
- }
31862
- } catch (e_1_1) {
31863
- e_1 = {
31864
- error: e_1_1
31764
+ try {
31765
+ for (var _b = __values(this._pluggables), _c = _b.next(); !_c.done; _c = _b.next()) {
31766
+ var plugin = _c.value;
31767
+ var logEvent = {
31768
+ message: message,
31769
+ timestamp: Date.now()
31865
31770
  };
31771
+ plugin.pushLogs([logEvent]);
31772
+ }
31773
+ } catch (e_1_1) {
31774
+ e_1 = {
31775
+ error: e_1_1
31776
+ };
31777
+ } finally {
31778
+ try {
31779
+ if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
31866
31780
  } finally {
31867
- try {
31868
- if (_c && !_c.done && (_a = _b["return"])) _a.call(_b);
31869
- } finally {
31870
- if (e_1) throw e_1.error;
31871
- }
31781
+ if (e_1) throw e_1.error;
31872
31782
  }
31873
31783
  }
31874
31784
  };
@@ -31976,8 +31886,10 @@ function () {
31976
31886
  };
31977
31887
 
31978
31888
  ConsoleLogger.prototype.addPluggable = function (pluggable) {
31979
- if (pluggable && COMPATIBLE_PLUGINS.includes(pluggable.getCategoryName())) {
31889
+ if (pluggable && pluggable.getCategoryName() === _Util_Constants__WEBPACK_IMPORTED_MODULE_0__["AWS_CLOUDWATCH_CATEGORY"]) {
31980
31890
  this._pluggables.push(pluggable);
31891
+
31892
+ pluggable.configure(this._config);
31981
31893
  }
31982
31894
  };
31983
31895
 
@@ -31985,9 +31897,7 @@ function () {
31985
31897
  return this._pluggables;
31986
31898
  };
31987
31899
 
31988
- ConsoleLogger._globalpluggables = [];
31989
31900
  ConsoleLogger.LOG_LEVEL = null;
31990
- ConsoleLogger.CLOUD_LOG_LEVEL = null;
31991
31901
  return ConsoleLogger;
31992
31902
  }();
31993
31903
 
@@ -32835,15 +32745,6 @@ __webpack_require__.r(__webpack_exports__);
32835
32745
  /* harmony import */ var _Platform__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Platform */ "./lib-esm/Platform/index.js");
32836
32746
  /* harmony import */ var _Parser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Parser */ "./lib-esm/Parser.js");
32837
32747
  /* harmony import */ var _Util_Constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Util/Constants */ "./lib-esm/Util/Constants.js");
32838
- function _typeof(obj) {
32839
- "@babel/helpers - typeof";
32840
-
32841
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
32842
- return typeof obj;
32843
- } : function (obj) {
32844
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
32845
- }, _typeof(obj);
32846
- }
32847
32748
  /*
32848
32749
  * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
32849
32750
  *
@@ -32856,8 +32757,6 @@ function _typeof(obj) {
32856
32757
  * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
32857
32758
  * and limitations under the License.
32858
32759
  */
32859
-
32860
-
32861
32760
  var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
32862
32761
  function adopt(value) {
32863
32762
  return value instanceof P ? value : new P(function (resolve) {
@@ -33001,42 +32900,61 @@ var __generator = undefined && undefined.__generator || function (thisArg, body)
33001
32900
  }
33002
32901
  };
33003
32902
 
32903
+ var __read = undefined && undefined.__read || function (o, n) {
32904
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
32905
+ if (!m) return o;
32906
+ var i = m.call(o),
32907
+ r,
32908
+ ar = [],
32909
+ e;
33004
32910
 
32911
+ try {
32912
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
32913
+ ar.push(r.value);
32914
+ }
32915
+ } catch (error) {
32916
+ e = {
32917
+ error: error
32918
+ };
32919
+ } finally {
32920
+ try {
32921
+ if (r && !r.done && (m = i["return"])) m.call(i);
32922
+ } finally {
32923
+ if (e) throw e.error;
32924
+ }
32925
+ }
32926
+
32927
+ return ar;
32928
+ };
32929
+
32930
+ var __spread = undefined && undefined.__spread || function () {
32931
+ for (var ar = [], i = 0; i < arguments.length; i++) {
32932
+ ar = ar.concat(__read(arguments[i]));
32933
+ }
32934
+
32935
+ return ar;
32936
+ };
33005
32937
 
33006
32938
 
33007
32939
 
33008
32940
 
33009
32941
 
33010
32942
 
33011
- if (typeof window === 'undefined' || (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' && !window.TextEncoder) {
33012
- __webpack_require__(/*! fast-text-encoding */ "../../node_modules/fast-text-encoding/text.min.js");
33013
- }
33014
32943
 
33015
32944
  var logger = new _Logger__WEBPACK_IMPORTED_MODULE_2__["ConsoleLogger"]('AWSCloudWatch');
33016
- var INTERVAL = 10000;
33017
32945
 
33018
32946
  var AWSCloudWatchProvider =
33019
32947
  /** @class */
33020
32948
  function () {
33021
32949
  function AWSCloudWatchProvider(config) {
33022
- this._initialized = false;
33023
- console.log('cstr', config);
33024
-
33025
- if (!this._initialized) {
33026
- this.configure(config);
33027
- this._dataTracker = {
33028
- eventUploadInProgress: false,
33029
- logEvents: [],
33030
- verifiedLogGroup: {
33031
- logGroupName: this._config.logGroupName
33032
- }
33033
- };
33034
- this._currentLogBatch = [];
33035
-
33036
- this._initiateLogPushInterval();
32950
+ this.configure(config);
32951
+ this._dataTracker = {
32952
+ eventUploadInProgress: false,
32953
+ logEvents: []
32954
+ };
32955
+ this._currentLogBatch = [];
33037
32956
 
33038
- this._initialized = true;
33039
- }
32957
+ this._initiateLogPushInterval();
33040
32958
  }
33041
32959
 
33042
32960
  AWSCloudWatchProvider.prototype.getProviderName = function () {
@@ -33051,12 +32969,6 @@ function () {
33051
32969
  return this._dataTracker.logEvents;
33052
32970
  };
33053
32971
 
33054
- AWSCloudWatchProvider.prototype.setPreFlightCheck = function (cb) {
33055
- if (typeof cb === 'function') {
33056
- this._preFlightCheck = cb;
33057
- }
33058
- };
33059
-
33060
32972
  AWSCloudWatchProvider.prototype.configure = function (config) {
33061
32973
  if (!config) return this._config || {};
33062
32974
  var conf = Object.assign({}, this._config, Object(_Parser__WEBPACK_IMPORTED_MODULE_4__["parseMobileHubConfig"])(config).Logging, config);
@@ -33310,27 +33222,8 @@ function () {
33310
33222
  };
33311
33223
 
33312
33224
  AWSCloudWatchProvider.prototype.pushLogs = function (logs) {
33313
- logger.debug('pushing log events to buffer');
33314
- this._dataTracker.logEvents = this._dataTracker.logEvents.concat(logs);
33315
- };
33316
-
33317
- AWSCloudWatchProvider.prototype.pause = function () {
33318
- this._processing = false;
33319
-
33320
- if (this._timer) {
33321
- clearInterval(this._timer);
33322
- }
33323
- };
33324
-
33325
- AWSCloudWatchProvider.prototype.resume = function () {
33326
- this._processing = true;
33327
-
33328
- this._initiateLogPushInterval();
33329
- };
33330
-
33331
- AWSCloudWatchProvider.prototype.clear = function () {
33332
- this._dataTracker.logEvents = [];
33333
- this._currentLogBatch = [];
33225
+ logger.debug('pushing log events to Cloudwatch...');
33226
+ this._dataTracker.logEvents = __spread(this._dataTracker.logEvents, logs);
33334
33227
  };
33335
33228
 
33336
33229
  AWSCloudWatchProvider.prototype._validateLogGroupExistsAndCreate = function (logGroupName) {
@@ -33647,33 +33540,13 @@ function () {
33647
33540
  return __generator(this, function (_a) {
33648
33541
  switch (_a.label) {
33649
33542
  case 0:
33650
- _a.trys.push([0, 4,, 5]);
33651
-
33652
- return [4
33653
- /*yield*/
33654
- , this._preFlightCheck()];
33655
-
33656
- case 1:
33657
- /**
33658
- * CloudWatch has restrictions on the size of the log events that get sent up.
33659
- * We need to track both the size of each event and the total size of the batch
33660
- * of logs.
33661
- *
33662
- * We also need to ensure that the logs in the batch are sorted in chronological order.
33663
- * https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html
33664
- */
33665
- if (!_a.sent()) {
33666
- this.clear();
33667
- return [2
33668
- /*return*/
33669
- ];
33670
- }
33543
+ _a.trys.push([0, 3,, 4]);
33671
33544
 
33672
33545
  return [4
33673
33546
  /*yield*/
33674
33547
  , this._getNextSequenceToken()];
33675
33548
 
33676
- case 2:
33549
+ case 1:
33677
33550
  seqToken = _a.sent();
33678
33551
  logBatch = this._currentLogBatch.length === 0 ? this._getBufferedBatchOfLogs() : this._currentLogBatch;
33679
33552
  putLogsPayload = {
@@ -33687,7 +33560,7 @@ function () {
33687
33560
  /*yield*/
33688
33561
  , this._sendLogEvents(putLogsPayload)];
33689
33562
 
33690
- case 3:
33563
+ case 2:
33691
33564
  sendLogEventsResponse = _a.sent();
33692
33565
  this._nextSequenceToken = sendLogEventsResponse.nextSequenceToken;
33693
33566
  this._dataTracker.eventUploadInProgress = false;
@@ -33696,7 +33569,7 @@ function () {
33696
33569
  /*return*/
33697
33570
  , sendLogEventsResponse];
33698
33571
 
33699
- case 4:
33572
+ case 3:
33700
33573
  err_5 = _a.sent();
33701
33574
  logger.error("error during _safeUploadLogEvents: " + err_5);
33702
33575
 
@@ -33713,9 +33586,9 @@ function () {
33713
33586
 
33714
33587
  return [3
33715
33588
  /*break*/
33716
- , 5];
33589
+ , 4];
33717
33590
 
33718
- case 5:
33591
+ case 4:
33719
33592
  return [2
33720
33593
  /*return*/
33721
33594
  ];
@@ -33724,41 +33597,6 @@ function () {
33724
33597
  });
33725
33598
  };
33726
33599
 
33727
- AWSCloudWatchProvider.prototype.truncateOversizedEvent = function (event) {
33728
- var timestamp = event.timestamp,
33729
- message = event.message;
33730
- var messageJson;
33731
-
33732
- try {
33733
- messageJson = JSON.parse(message);
33734
- var truncated = JSON.stringify({
33735
- level: messageJson.level,
33736
- "class": messageJson["class"],
33737
- message: messageJson.message.substring(0, 500)
33738
- });
33739
-
33740
- if (messageJson.data != null) {
33741
- truncated['data'] = "OBJECT SIZE EXCEEDS CLOUDWATCH EVENT LIMIT. Truncated: " + JSON.stringify(messageJson.data).substring(0, 500);
33742
- }
33743
-
33744
- return {
33745
- timestamp: timestamp,
33746
- message: truncated
33747
- };
33748
- } catch (error) {
33749
- logger.warn('Could not minify oversized event', error);
33750
- var truncated = JSON.stringify({
33751
- level: 'UNKNOWN',
33752
- "class": 'Unknown',
33753
- message: 'OBJECT SIZE EXCEEDS CLOUDWATCH EVENT LIMIT. Could not parse event to truncate'
33754
- });
33755
- return {
33756
- timestamp: timestamp,
33757
- message: truncated
33758
- };
33759
- }
33760
- };
33761
-
33762
33600
  AWSCloudWatchProvider.prototype._getBufferedBatchOfLogs = function () {
33763
33601
  /**
33764
33602
  * CloudWatch has restrictions on the size of the log events that get sent up.
@@ -33778,9 +33616,7 @@ function () {
33778
33616
  if (eventSize > _Util_Constants__WEBPACK_IMPORTED_MODULE_5__["AWS_CLOUDWATCH_MAX_EVENT_SIZE"]) {
33779
33617
  var errString = "Log entry exceeds maximum size for CloudWatch logs. Log size: " + eventSize + ". Truncating log message.";
33780
33618
  logger.warn(errString);
33781
- currentEvent = this.truncateOversizedEvent(currentEvent);
33782
- this._dataTracker.logEvents[currentEventIdx] = currentEvent;
33783
- eventSize = new TextEncoder().encode(currentEvent.message).length + _Util_Constants__WEBPACK_IMPORTED_MODULE_5__["AWS_CLOUDWATCH_BASE_BUFFER_SIZE"];
33619
+ currentEvent.message = currentEvent.message.substring(0, eventSize);
33784
33620
  }
33785
33621
 
33786
33622
  if (totalByteSize + eventSize > _Util_Constants__WEBPACK_IMPORTED_MODULE_5__["AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE"]) break;
@@ -33871,7 +33707,6 @@ function () {
33871
33707
  case 3:
33872
33708
  err_7 = _a.sent();
33873
33709
  logger.error("error when calling _safeUploadLogEvents in the timer interval - " + err_7);
33874
- this.pause();
33875
33710
  return [3
33876
33711
  /*break*/
33877
33712
  , 4];
@@ -33883,7 +33718,7 @@ function () {
33883
33718
  }
33884
33719
  });
33885
33720
  });
33886
- }, INTERVAL);
33721
+ }, 2000);
33887
33722
  };
33888
33723
 
33889
33724
  AWSCloudWatchProvider.prototype._getDocUploadPermissibility = function () {
@@ -34915,7 +34750,7 @@ function () {
34915
34750
  /*!***********************************!*\
34916
34751
  !*** ./lib-esm/Util/Constants.js ***!
34917
34752
  \***********************************/
34918
- /*! exports provided: AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, AMAZON_KINESIS_LOGGING_PROVIDER_NAME, AMAZON_KINESIS_LOGGING_CATEGORY */
34753
+ /*! exports provided: AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES */
34919
34754
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
34920
34755
 
34921
34756
  "use strict";
@@ -34927,8 +34762,6 @@ __webpack_require__.r(__webpack_exports__);
34927
34762
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AWS_CLOUDWATCH_PROVIDER_NAME", function() { return AWS_CLOUDWATCH_PROVIDER_NAME; });
34928
34763
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NO_CREDS_ERROR_STRING", function() { return NO_CREDS_ERROR_STRING; });
34929
34764
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return RETRY_ERROR_CODES; });
34930
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_PROVIDER_NAME", function() { return AMAZON_KINESIS_LOGGING_PROVIDER_NAME; });
34931
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_CATEGORY", function() { return AMAZON_KINESIS_LOGGING_CATEGORY; });
34932
34765
  /*
34933
34766
  * Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
34934
34767
  *
@@ -34942,14 +34775,11 @@ __webpack_require__.r(__webpack_exports__);
34942
34775
  * and limitations under the License.
34943
34776
  */
34944
34777
  // Logging constants
34945
- // Cloudwatch
34946
34778
  var AWS_CLOUDWATCH_BASE_BUFFER_SIZE = 26;
34947
34779
  var AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE = 1048576;
34948
34780
  var AWS_CLOUDWATCH_MAX_EVENT_SIZE = 256000;
34949
34781
  var AWS_CLOUDWATCH_CATEGORY = 'Logging';
34950
34782
  var AWS_CLOUDWATCH_PROVIDER_NAME = 'AWSCloudWatch';
34951
- var AMAZON_KINESIS_LOGGING_CATEGORY = 'KinesisLogging';
34952
- var AMAZON_KINESIS_LOGGING_PROVIDER_NAME = 'AmazonKinesisLogging';
34953
34783
  var NO_CREDS_ERROR_STRING = 'No credentials';
34954
34784
  var RETRY_ERROR_CODES = ['ResourceNotFoundException', 'InvalidSequenceTokenException'];
34955
34785
 
@@ -35535,7 +35365,7 @@ function retry(functionToRetry, args, delayFn, attempt) {
35535
35365
  throw Error('functionToRetry must be a function');
35536
35366
  }
35537
35367
 
35538
- logger.debug(functionToRetry.name + " attempt #" + attempt + " with this vars:", args);
35368
+ logger.debug(functionToRetry.name + " attempt #" + attempt + " with this vars: " + JSON.stringify(args));
35539
35369
  _a.label = 1;
35540
35370
 
35541
35371
  case 1:
@@ -35652,7 +35482,7 @@ function urlSafeDecode(hex) {
35652
35482
  /*!*******************************!*\
35653
35483
  !*** ./lib-esm/Util/index.js ***!
35654
35484
  \*******************************/
35655
- /*! exports provided: NonRetryableError, retry, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, AMAZON_KINESIS_LOGGING_PROVIDER_NAME, AMAZON_KINESIS_LOGGING_CATEGORY */
35485
+ /*! exports provided: NonRetryableError, retry, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES */
35656
35486
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
35657
35487
 
35658
35488
  "use strict";
@@ -35693,10 +35523,6 @@ __webpack_require__.r(__webpack_exports__);
35693
35523
 
35694
35524
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["RETRY_ERROR_CODES"]; });
35695
35525
 
35696
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_PROVIDER_NAME", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["AMAZON_KINESIS_LOGGING_PROVIDER_NAME"]; });
35697
-
35698
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_CATEGORY", function() { return _Constants__WEBPACK_IMPORTED_MODULE_5__["AMAZON_KINESIS_LOGGING_CATEGORY"]; });
35699
-
35700
35526
 
35701
35527
 
35702
35528
 
@@ -35746,7 +35572,7 @@ var USER_AGENT_HEADER = 'x-amz-user-agent';
35746
35572
  /*!**************************!*\
35747
35573
  !*** ./lib-esm/index.js ***!
35748
35574
  \**************************/
35749
- /*! exports provided: AmplifyClass, ClientDevice, ConsoleLogger, Logger, missingConfig, invalidParameter, Hub, I18n, isEmpty, sortByField, objectLessAttributes, filenameToContentType, isTextFile, generateRandomString, makeQuerablePromise, isWebWorker, browserOrNode, transferKeyToLowerCase, transferKeyToUpperCase, isStrictObject, JS, Signer, parseMobileHubConfig, Parser, AWSCloudWatchProvider, FacebookOAuth, GoogleOAuth, Linking, AppState, AsyncStorage, Credentials, CredentialsClass, ServiceWorker, StorageHelper, MemoryStorage, UniversalStorage, Platform, getAmplifyUserAgent, INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER, INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, Constants, NonRetryableError, retry, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, AMAZON_KINESIS_LOGGING_PROVIDER_NAME, AMAZON_KINESIS_LOGGING_CATEGORY, Amplify, default */
35575
+ /*! exports provided: AmplifyClass, ClientDevice, ConsoleLogger, Logger, missingConfig, invalidParameter, Hub, I18n, isEmpty, sortByField, objectLessAttributes, filenameToContentType, isTextFile, generateRandomString, makeQuerablePromise, isWebWorker, browserOrNode, transferKeyToLowerCase, transferKeyToUpperCase, isStrictObject, JS, Signer, parseMobileHubConfig, Parser, AWSCloudWatchProvider, FacebookOAuth, GoogleOAuth, Linking, AppState, AsyncStorage, Credentials, CredentialsClass, ServiceWorker, StorageHelper, MemoryStorage, UniversalStorage, Platform, getAmplifyUserAgent, INTERNAL_AWS_APPSYNC_PUBSUB_PROVIDER, INTERNAL_AWS_APPSYNC_REALTIME_PUBSUB_PROVIDER, USER_AGENT_HEADER, Constants, NonRetryableError, retry, jitteredExponentialRetry, Mutex, Reachability, DateUtils, urlSafeEncode, urlSafeDecode, AWS_CLOUDWATCH_BASE_BUFFER_SIZE, AWS_CLOUDWATCH_CATEGORY, AWS_CLOUDWATCH_MAX_BATCH_EVENT_SIZE, AWS_CLOUDWATCH_MAX_EVENT_SIZE, AWS_CLOUDWATCH_PROVIDER_NAME, NO_CREDS_ERROR_STRING, RETRY_ERROR_CODES, Amplify, default */
35750
35576
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
35751
35577
 
35752
35578
  "use strict";
@@ -35885,10 +35711,6 @@ __webpack_require__.r(__webpack_exports__);
35885
35711
 
35886
35712
  /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RETRY_ERROR_CODES", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["RETRY_ERROR_CODES"]; });
35887
35713
 
35888
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_PROVIDER_NAME", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["AMAZON_KINESIS_LOGGING_PROVIDER_NAME"]; });
35889
-
35890
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AMAZON_KINESIS_LOGGING_CATEGORY", function() { return _Util__WEBPACK_IMPORTED_MODULE_18__["AMAZON_KINESIS_LOGGING_CATEGORY"]; });
35891
-
35892
35714
  /*
35893
35715
  * Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
35894
35716
  *